+
+Denque is a well tested, extremely fast and lightweight [double-ended queue](http://en.wikipedia.org/wiki/Double-ended_queue)
+implementation with zero dependencies and includes TypeScript types.
+
+Double-ended queues can also be used as a:
+
+- [Stack](http://en.wikipedia.org/wiki/Stack_\(abstract_data_type\))
+- [Queue](http://en.wikipedia.org/wiki/Queue_\(data_structure\))
+
+This implementation is currently the fastest available, even faster than `double-ended-queue`, see the [benchmarks](https://docs.page/invertase/denque/benchmarks).
+
+Every queue operation is done at a constant `O(1)` - including random access from `.peekAt(index)`.
+
+**Works on all node versions >= v0.10**
+
+## Quick Start
+
+Install the package:
+
+```bash
+npm install denque
+```
+
+Create and consume a queue:
+
+```js
+const Denque = require("denque");
+
+const denque = new Denque([1,2,3,4]);
+denque.shift(); // 1
+denque.pop(); // 4
+```
+
+
+See the [API reference documentation](https://docs.page/invertase/denque/api) for more examples.
+
+---
+
+## Who's using it?
+
+- [Kafka Node.js client](https://www.npmjs.com/package/kafka-node)
+- [MariaDB Node.js client](https://www.npmjs.com/package/mariadb)
+- [MongoDB Node.js client](https://www.npmjs.com/package/mongodb)
+- [MySQL Node.js client](https://www.npmjs.com/package/mysql2)
+- [Redis Node.js clients](https://www.npmjs.com/package/redis)
+
+... and [many more](https://www.npmjs.com/browse/depended/denque).
+
+
+---
+
+## License
+
+- See [LICENSE](/LICENSE)
+
+---
+
+
+
diff --git a/node_modules/denque/index.d.ts b/node_modules/denque/index.d.ts
new file mode 100644
index 0000000..e125dd4
--- /dev/null
+++ b/node_modules/denque/index.d.ts
@@ -0,0 +1,47 @@
+declare class Denque {
+ length: number;
+
+ constructor();
+
+ constructor(array: T[]);
+
+ constructor(array: T[], options: IDenqueOptions);
+
+ push(item: T): number;
+
+ unshift(item: T): number;
+
+ pop(): T | undefined;
+
+ shift(): T | undefined;
+
+ peekBack(): T | undefined;
+
+ peekFront(): T | undefined;
+
+ peekAt(index: number): T | undefined;
+
+ get(index: number): T | undefined;
+
+ remove(index: number, count: number): T[];
+
+ removeOne(index: number): T | undefined;
+
+ splice(index: number, count: number, ...item: T[]): T[] | undefined;
+
+ isEmpty(): boolean;
+
+ clear(): void;
+
+ size(): number;
+
+ toString(): string;
+
+ toArray(): T[];
+}
+
+interface IDenqueOptions {
+ capacity?: number
+}
+
+export = Denque;
diff --git a/node_modules/denque/index.js b/node_modules/denque/index.js
new file mode 100644
index 0000000..6b2e9d8
--- /dev/null
+++ b/node_modules/denque/index.js
@@ -0,0 +1,481 @@
+'use strict';
+
+/**
+ * Custom implementation of a double ended queue.
+ */
+function Denque(array, options) {
+ var options = options || {};
+ this._capacity = options.capacity;
+
+ this._head = 0;
+ this._tail = 0;
+
+ if (Array.isArray(array)) {
+ this._fromArray(array);
+ } else {
+ this._capacityMask = 0x3;
+ this._list = new Array(4);
+ }
+}
+
+/**
+ * --------------
+ * PUBLIC API
+ * -------------
+ */
+
+/**
+ * Returns the item at the specified index from the list.
+ * 0 is the first element, 1 is the second, and so on...
+ * Elements at negative values are that many from the end: -1 is one before the end
+ * (the last element), -2 is two before the end (one before last), etc.
+ * @param index
+ * @returns {*}
+ */
+Denque.prototype.peekAt = function peekAt(index) {
+ var i = index;
+ // expect a number or return undefined
+ if ((i !== (i | 0))) {
+ return void 0;
+ }
+ var len = this.size();
+ if (i >= len || i < -len) return undefined;
+ if (i < 0) i += len;
+ i = (this._head + i) & this._capacityMask;
+ return this._list[i];
+};
+
+/**
+ * Alias for peekAt()
+ * @param i
+ * @returns {*}
+ */
+Denque.prototype.get = function get(i) {
+ return this.peekAt(i);
+};
+
+/**
+ * Returns the first item in the list without removing it.
+ * @returns {*}
+ */
+Denque.prototype.peek = function peek() {
+ if (this._head === this._tail) return undefined;
+ return this._list[this._head];
+};
+
+/**
+ * Alias for peek()
+ * @returns {*}
+ */
+Denque.prototype.peekFront = function peekFront() {
+ return this.peek();
+};
+
+/**
+ * Returns the item that is at the back of the queue without removing it.
+ * Uses peekAt(-1)
+ */
+Denque.prototype.peekBack = function peekBack() {
+ return this.peekAt(-1);
+};
+
+/**
+ * Returns the current length of the queue
+ * @return {Number}
+ */
+Object.defineProperty(Denque.prototype, 'length', {
+ get: function length() {
+ return this.size();
+ }
+});
+
+/**
+ * Return the number of items on the list, or 0 if empty.
+ * @returns {number}
+ */
+Denque.prototype.size = function size() {
+ if (this._head === this._tail) return 0;
+ if (this._head < this._tail) return this._tail - this._head;
+ else return this._capacityMask + 1 - (this._head - this._tail);
+};
+
+/**
+ * Add an item at the beginning of the list.
+ * @param item
+ */
+Denque.prototype.unshift = function unshift(item) {
+ if (arguments.length === 0) return this.size();
+ var len = this._list.length;
+ this._head = (this._head - 1 + len) & this._capacityMask;
+ this._list[this._head] = item;
+ if (this._tail === this._head) this._growArray();
+ if (this._capacity && this.size() > this._capacity) this.pop();
+ if (this._head < this._tail) return this._tail - this._head;
+ else return this._capacityMask + 1 - (this._head - this._tail);
+};
+
+/**
+ * Remove and return the first item on the list,
+ * Returns undefined if the list is empty.
+ * @returns {*}
+ */
+Denque.prototype.shift = function shift() {
+ var head = this._head;
+ if (head === this._tail) return undefined;
+ var item = this._list[head];
+ this._list[head] = undefined;
+ this._head = (head + 1) & this._capacityMask;
+ if (head < 2 && this._tail > 10000 && this._tail <= this._list.length >>> 2) this._shrinkArray();
+ return item;
+};
+
+/**
+ * Add an item to the bottom of the list.
+ * @param item
+ */
+Denque.prototype.push = function push(item) {
+ if (arguments.length === 0) return this.size();
+ var tail = this._tail;
+ this._list[tail] = item;
+ this._tail = (tail + 1) & this._capacityMask;
+ if (this._tail === this._head) {
+ this._growArray();
+ }
+ if (this._capacity && this.size() > this._capacity) {
+ this.shift();
+ }
+ if (this._head < this._tail) return this._tail - this._head;
+ else return this._capacityMask + 1 - (this._head - this._tail);
+};
+
+/**
+ * Remove and return the last item on the list.
+ * Returns undefined if the list is empty.
+ * @returns {*}
+ */
+Denque.prototype.pop = function pop() {
+ var tail = this._tail;
+ if (tail === this._head) return undefined;
+ var len = this._list.length;
+ this._tail = (tail - 1 + len) & this._capacityMask;
+ var item = this._list[this._tail];
+ this._list[this._tail] = undefined;
+ if (this._head < 2 && tail > 10000 && tail <= len >>> 2) this._shrinkArray();
+ return item;
+};
+
+/**
+ * Remove and return the item at the specified index from the list.
+ * Returns undefined if the list is empty.
+ * @param index
+ * @returns {*}
+ */
+Denque.prototype.removeOne = function removeOne(index) {
+ var i = index;
+ // expect a number or return undefined
+ if ((i !== (i | 0))) {
+ return void 0;
+ }
+ if (this._head === this._tail) return void 0;
+ var size = this.size();
+ var len = this._list.length;
+ if (i >= size || i < -size) return void 0;
+ if (i < 0) i += size;
+ i = (this._head + i) & this._capacityMask;
+ var item = this._list[i];
+ var k;
+ if (index < size / 2) {
+ for (k = index; k > 0; k--) {
+ this._list[i] = this._list[i = (i - 1 + len) & this._capacityMask];
+ }
+ this._list[i] = void 0;
+ this._head = (this._head + 1 + len) & this._capacityMask;
+ } else {
+ for (k = size - 1 - index; k > 0; k--) {
+ this._list[i] = this._list[i = (i + 1 + len) & this._capacityMask];
+ }
+ this._list[i] = void 0;
+ this._tail = (this._tail - 1 + len) & this._capacityMask;
+ }
+ return item;
+};
+
+/**
+ * Remove number of items from the specified index from the list.
+ * Returns array of removed items.
+ * Returns undefined if the list is empty.
+ * @param index
+ * @param count
+ * @returns {array}
+ */
+Denque.prototype.remove = function remove(index, count) {
+ var i = index;
+ var removed;
+ var del_count = count;
+ // expect a number or return undefined
+ if ((i !== (i | 0))) {
+ return void 0;
+ }
+ if (this._head === this._tail) return void 0;
+ var size = this.size();
+ var len = this._list.length;
+ if (i >= size || i < -size || count < 1) return void 0;
+ if (i < 0) i += size;
+ if (count === 1 || !count) {
+ removed = new Array(1);
+ removed[0] = this.removeOne(i);
+ return removed;
+ }
+ if (i === 0 && i + count >= size) {
+ removed = this.toArray();
+ this.clear();
+ return removed;
+ }
+ if (i + count > size) count = size - i;
+ var k;
+ removed = new Array(count);
+ for (k = 0; k < count; k++) {
+ removed[k] = this._list[(this._head + i + k) & this._capacityMask];
+ }
+ i = (this._head + i) & this._capacityMask;
+ if (index + count === size) {
+ this._tail = (this._tail - count + len) & this._capacityMask;
+ for (k = count; k > 0; k--) {
+ this._list[i = (i + 1 + len) & this._capacityMask] = void 0;
+ }
+ return removed;
+ }
+ if (index === 0) {
+ this._head = (this._head + count + len) & this._capacityMask;
+ for (k = count - 1; k > 0; k--) {
+ this._list[i = (i + 1 + len) & this._capacityMask] = void 0;
+ }
+ return removed;
+ }
+ if (i < size / 2) {
+ this._head = (this._head + index + count + len) & this._capacityMask;
+ for (k = index; k > 0; k--) {
+ this.unshift(this._list[i = (i - 1 + len) & this._capacityMask]);
+ }
+ i = (this._head - 1 + len) & this._capacityMask;
+ while (del_count > 0) {
+ this._list[i = (i - 1 + len) & this._capacityMask] = void 0;
+ del_count--;
+ }
+ if (index < 0) this._tail = i;
+ } else {
+ this._tail = i;
+ i = (i + count + len) & this._capacityMask;
+ for (k = size - (count + index); k > 0; k--) {
+ this.push(this._list[i++]);
+ }
+ i = this._tail;
+ while (del_count > 0) {
+ this._list[i = (i + 1 + len) & this._capacityMask] = void 0;
+ del_count--;
+ }
+ }
+ if (this._head < 2 && this._tail > 10000 && this._tail <= len >>> 2) this._shrinkArray();
+ return removed;
+};
+
+/**
+ * Native splice implementation.
+ * Remove number of items from the specified index from the list and/or add new elements.
+ * Returns array of removed items or empty array if count == 0.
+ * Returns undefined if the list is empty.
+ *
+ * @param index
+ * @param count
+ * @param {...*} [elements]
+ * @returns {array}
+ */
+Denque.prototype.splice = function splice(index, count) {
+ var i = index;
+ // expect a number or return undefined
+ if ((i !== (i | 0))) {
+ return void 0;
+ }
+ var size = this.size();
+ if (i < 0) i += size;
+ if (i > size) return void 0;
+ if (arguments.length > 2) {
+ var k;
+ var temp;
+ var removed;
+ var arg_len = arguments.length;
+ var len = this._list.length;
+ var arguments_index = 2;
+ if (!size || i < size / 2) {
+ temp = new Array(i);
+ for (k = 0; k < i; k++) {
+ temp[k] = this._list[(this._head + k) & this._capacityMask];
+ }
+ if (count === 0) {
+ removed = [];
+ if (i > 0) {
+ this._head = (this._head + i + len) & this._capacityMask;
+ }
+ } else {
+ removed = this.remove(i, count);
+ this._head = (this._head + i + len) & this._capacityMask;
+ }
+ while (arg_len > arguments_index) {
+ this.unshift(arguments[--arg_len]);
+ }
+ for (k = i; k > 0; k--) {
+ this.unshift(temp[k - 1]);
+ }
+ } else {
+ temp = new Array(size - (i + count));
+ var leng = temp.length;
+ for (k = 0; k < leng; k++) {
+ temp[k] = this._list[(this._head + i + count + k) & this._capacityMask];
+ }
+ if (count === 0) {
+ removed = [];
+ if (i != size) {
+ this._tail = (this._head + i + len) & this._capacityMask;
+ }
+ } else {
+ removed = this.remove(i, count);
+ this._tail = (this._tail - leng + len) & this._capacityMask;
+ }
+ while (arguments_index < arg_len) {
+ this.push(arguments[arguments_index++]);
+ }
+ for (k = 0; k < leng; k++) {
+ this.push(temp[k]);
+ }
+ }
+ return removed;
+ } else {
+ return this.remove(i, count);
+ }
+};
+
+/**
+ * Soft clear - does not reset capacity.
+ */
+Denque.prototype.clear = function clear() {
+ this._list = new Array(this._list.length);
+ this._head = 0;
+ this._tail = 0;
+};
+
+/**
+ * Returns true or false whether the list is empty.
+ * @returns {boolean}
+ */
+Denque.prototype.isEmpty = function isEmpty() {
+ return this._head === this._tail;
+};
+
+/**
+ * Returns an array of all queue items.
+ * @returns {Array}
+ */
+Denque.prototype.toArray = function toArray() {
+ return this._copyArray(false);
+};
+
+/**
+ * -------------
+ * INTERNALS
+ * -------------
+ */
+
+/**
+ * Fills the queue with items from an array
+ * For use in the constructor
+ * @param array
+ * @private
+ */
+Denque.prototype._fromArray = function _fromArray(array) {
+ var length = array.length;
+ var capacity = this._nextPowerOf2(length);
+
+ this._list = new Array(capacity);
+ this._capacityMask = capacity - 1;
+ this._tail = length;
+
+ for (var i = 0; i < length; i++) this._list[i] = array[i];
+};
+
+/**
+ *
+ * @param fullCopy
+ * @param size Initialize the array with a specific size. Will default to the current list size
+ * @returns {Array}
+ * @private
+ */
+Denque.prototype._copyArray = function _copyArray(fullCopy, size) {
+ var src = this._list;
+ var capacity = src.length;
+ var length = this.length;
+ size = size | length;
+
+ // No prealloc requested and the buffer is contiguous
+ if (size == length && this._head < this._tail) {
+ // Simply do a fast slice copy
+ return this._list.slice(this._head, this._tail);
+ }
+
+ var dest = new Array(size);
+
+ var k = 0;
+ var i;
+ if (fullCopy || this._head > this._tail) {
+ for (i = this._head; i < capacity; i++) dest[k++] = src[i];
+ for (i = 0; i < this._tail; i++) dest[k++] = src[i];
+ } else {
+ for (i = this._head; i < this._tail; i++) dest[k++] = src[i];
+ }
+
+ return dest;
+}
+
+/**
+ * Grows the internal list array.
+ * @private
+ */
+Denque.prototype._growArray = function _growArray() {
+ if (this._head != 0) {
+ // double array size and copy existing data, head to end, then beginning to tail.
+ var newList = this._copyArray(true, this._list.length << 1);
+
+ this._tail = this._list.length;
+ this._head = 0;
+
+ this._list = newList;
+ } else {
+ this._tail = this._list.length;
+ this._list.length <<= 1;
+ }
+
+ this._capacityMask = (this._capacityMask << 1) | 1;
+};
+
+/**
+ * Shrinks the internal list array.
+ * @private
+ */
+Denque.prototype._shrinkArray = function _shrinkArray() {
+ this._list.length >>>= 1;
+ this._capacityMask >>>= 1;
+};
+
+/**
+ * Find the next power of 2, at least 4
+ * @private
+ * @param {number} num
+ * @returns {number}
+ */
+Denque.prototype._nextPowerOf2 = function _nextPowerOf2(num) {
+ var log2 = Math.log(num) / Math.log(2);
+ var nextPow2 = 1 << (log2 + 1);
+
+ return Math.max(nextPow2, 4);
+}
+
+module.exports = Denque;
diff --git a/node_modules/denque/package.json b/node_modules/denque/package.json
new file mode 100644
index 0000000..a635910
--- /dev/null
+++ b/node_modules/denque/package.json
@@ -0,0 +1,58 @@
+{
+ "name": "denque",
+ "version": "2.1.0",
+ "description": "The fastest javascript implementation of a double-ended queue. Used by the official Redis, MongoDB, MariaDB & MySQL libraries for Node.js and many other libraries. Maintains compatability with deque.",
+ "main": "index.js",
+ "engines": {
+ "node": ">=0.10"
+ },
+ "keywords": [
+ "data-structure",
+ "data-structures",
+ "queue",
+ "double",
+ "end",
+ "ended",
+ "deque",
+ "denque",
+ "double-ended-queue"
+ ],
+ "scripts": {
+ "test": "istanbul cover --report lcov _mocha && npm run typescript",
+ "coveralls": "cat ./coverage/lcov.info | coveralls",
+ "typescript": "tsc --project ./test/type/tsconfig.json",
+ "benchmark_thousand": "node benchmark/thousand",
+ "benchmark_2mil": "node benchmark/two_million",
+ "benchmark_splice": "node benchmark/splice",
+ "benchmark_remove": "node benchmark/remove",
+ "benchmark_removeOne": "node benchmark/removeOne",
+ "benchmark_growth": "node benchmark/growth",
+ "benchmark_toArray": "node benchmark/toArray",
+ "benchmark_fromArray": "node benchmark/fromArray"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/invertase/denque.git"
+ },
+ "license": "Apache-2.0",
+ "author": {
+ "name": "Invertase",
+ "email": "oss@invertase.io",
+ "url": "http://github.com/invertase/"
+ },
+ "contributors": [
+ "Mike Diarmid (Salakar) "
+ ],
+ "bugs": {
+ "url": "https://github.com/invertase/denque/issues"
+ },
+ "homepage": "https://docs.page/invertase/denque",
+ "devDependencies": {
+ "benchmark": "^2.1.4",
+ "codecov": "^3.8.3",
+ "double-ended-queue": "^2.1.0-0",
+ "istanbul": "^0.4.5",
+ "mocha": "^3.5.3",
+ "typescript": "^3.4.1"
+ }
+}
diff --git a/node_modules/ecdsa-sig-formatter/CODEOWNERS b/node_modules/ecdsa-sig-formatter/CODEOWNERS
new file mode 100644
index 0000000..4451d3d
--- /dev/null
+++ b/node_modules/ecdsa-sig-formatter/CODEOWNERS
@@ -0,0 +1 @@
+* @omsmith
diff --git a/node_modules/ecdsa-sig-formatter/LICENSE b/node_modules/ecdsa-sig-formatter/LICENSE
new file mode 100644
index 0000000..8754ed6
--- /dev/null
+++ b/node_modules/ecdsa-sig-formatter/LICENSE
@@ -0,0 +1,201 @@
+Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2015 D2L Corporation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/node_modules/ecdsa-sig-formatter/README.md b/node_modules/ecdsa-sig-formatter/README.md
new file mode 100644
index 0000000..daa95d6
--- /dev/null
+++ b/node_modules/ecdsa-sig-formatter/README.md
@@ -0,0 +1,65 @@
+# ecdsa-sig-formatter
+
+[](https://travis-ci.org/Brightspace/node-ecdsa-sig-formatter) [](https://coveralls.io/r/Brightspace/node-ecdsa-sig-formatter)
+
+Translate between JOSE and ASN.1/DER encodings for ECDSA signatures
+
+## Install
+```sh
+npm install ecdsa-sig-formatter --save
+```
+
+## Usage
+```js
+var format = require('ecdsa-sig-formatter');
+
+var derSignature = '..'; // asn.1/DER encoded ecdsa signature
+
+var joseSignature = format.derToJose(derSignature);
+
+```
+
+### API
+
+---
+
+#### `.derToJose(Buffer|String signature, String alg)` -> `String`
+
+Convert the ASN.1/DER encoded signature to a JOSE-style concatenated signature.
+Returns a _base64 url_ encoded `String`.
+
+* If _signature_ is a `String`, it should be _base64_ encoded
+* _alg_ must be one of _ES256_, _ES384_ or _ES512_
+
+---
+
+#### `.joseToDer(Buffer|String signature, String alg)` -> `Buffer`
+
+Convert the JOSE-style concatenated signature to an ASN.1/DER encoded
+signature. Returns a `Buffer`
+
+* If _signature_ is a `String`, it should be _base64 url_ encoded
+* _alg_ must be one of _ES256_, _ES384_ or _ES512_
+
+## Contributing
+
+1. **Fork** the repository. Committing directly against this repository is
+ highly discouraged.
+
+2. Make your modifications in a branch, updating and writing new unit tests
+ as necessary in the `spec` directory.
+
+3. Ensure that all tests pass with `npm test`
+
+4. `rebase` your changes against master. *Do not merge*.
+
+5. Submit a pull request to this repository. Wait for tests to run and someone
+ to chime in.
+
+### Code Style
+
+This repository is configured with [EditorConfig][EditorConfig] and
+[ESLint][ESLint] rules.
+
+[EditorConfig]: http://editorconfig.org/
+[ESLint]: http://eslint.org
diff --git a/node_modules/ecdsa-sig-formatter/package.json b/node_modules/ecdsa-sig-formatter/package.json
new file mode 100644
index 0000000..6fb5ebf
--- /dev/null
+++ b/node_modules/ecdsa-sig-formatter/package.json
@@ -0,0 +1,46 @@
+{
+ "name": "ecdsa-sig-formatter",
+ "version": "1.0.11",
+ "description": "Translate ECDSA signatures between ASN.1/DER and JOSE-style concatenation",
+ "main": "src/ecdsa-sig-formatter.js",
+ "scripts": {
+ "check-style": "eslint .",
+ "pretest": "npm run check-style",
+ "test": "istanbul cover --root src _mocha -- spec",
+ "report-cov": "cat ./coverage/lcov.info | coveralls"
+ },
+ "typings": "./src/ecdsa-sig-formatter.d.ts",
+ "repository": {
+ "type": "git",
+ "url": "git+ssh://git@github.com/Brightspace/node-ecdsa-sig-formatter.git"
+ },
+ "keywords": [
+ "ecdsa",
+ "der",
+ "asn.1",
+ "jwt",
+ "jwa",
+ "jsonwebtoken",
+ "jose"
+ ],
+ "author": "D2L Corporation",
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/Brightspace/node-ecdsa-sig-formatter/issues"
+ },
+ "homepage": "https://github.com/Brightspace/node-ecdsa-sig-formatter#readme",
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ },
+ "devDependencies": {
+ "bench": "^0.3.6",
+ "chai": "^3.5.0",
+ "coveralls": "^2.11.9",
+ "eslint": "^2.12.0",
+ "eslint-config-brightspace": "^0.2.1",
+ "istanbul": "^0.4.3",
+ "jwk-to-pem": "^1.2.5",
+ "mocha": "^2.5.3",
+ "native-crypto": "^1.7.0"
+ }
+}
diff --git a/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.d.ts b/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.d.ts
new file mode 100644
index 0000000..9693aa0
--- /dev/null
+++ b/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.d.ts
@@ -0,0 +1,17 @@
+///
+
+declare module "ecdsa-sig-formatter" {
+ /**
+ * Convert the ASN.1/DER encoded signature to a JOSE-style concatenated signature. Returns a base64 url encoded String.
+ * If signature is a String, it should be base64 encoded
+ * alg must be one of ES256, ES384 or ES512
+ */
+ export function derToJose(signature: Buffer | string, alg: string): string;
+
+ /**
+ * Convert the JOSE-style concatenated signature to an ASN.1/DER encoded signature. Returns a Buffer
+ * If signature is a String, it should be base64 url encoded
+ * alg must be one of ES256, ES384 or ES512
+ */
+ export function joseToDer(signature: Buffer | string, alg: string): Buffer
+}
diff --git a/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js b/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js
new file mode 100644
index 0000000..38eeb9b
--- /dev/null
+++ b/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js
@@ -0,0 +1,187 @@
+'use strict';
+
+var Buffer = require('safe-buffer').Buffer;
+
+var getParamBytesForAlg = require('./param-bytes-for-alg');
+
+var MAX_OCTET = 0x80,
+ CLASS_UNIVERSAL = 0,
+ PRIMITIVE_BIT = 0x20,
+ TAG_SEQ = 0x10,
+ TAG_INT = 0x02,
+ ENCODED_TAG_SEQ = (TAG_SEQ | PRIMITIVE_BIT) | (CLASS_UNIVERSAL << 6),
+ ENCODED_TAG_INT = TAG_INT | (CLASS_UNIVERSAL << 6);
+
+function base64Url(base64) {
+ return base64
+ .replace(/=/g, '')
+ .replace(/\+/g, '-')
+ .replace(/\//g, '_');
+}
+
+function signatureAsBuffer(signature) {
+ if (Buffer.isBuffer(signature)) {
+ return signature;
+ } else if ('string' === typeof signature) {
+ return Buffer.from(signature, 'base64');
+ }
+
+ throw new TypeError('ECDSA signature must be a Base64 string or a Buffer');
+}
+
+function derToJose(signature, alg) {
+ signature = signatureAsBuffer(signature);
+ var paramBytes = getParamBytesForAlg(alg);
+
+ // the DER encoded param should at most be the param size, plus a padding
+ // zero, since due to being a signed integer
+ var maxEncodedParamLength = paramBytes + 1;
+
+ var inputLength = signature.length;
+
+ var offset = 0;
+ if (signature[offset++] !== ENCODED_TAG_SEQ) {
+ throw new Error('Could not find expected "seq"');
+ }
+
+ var seqLength = signature[offset++];
+ if (seqLength === (MAX_OCTET | 1)) {
+ seqLength = signature[offset++];
+ }
+
+ if (inputLength - offset < seqLength) {
+ throw new Error('"seq" specified length of "' + seqLength + '", only "' + (inputLength - offset) + '" remaining');
+ }
+
+ if (signature[offset++] !== ENCODED_TAG_INT) {
+ throw new Error('Could not find expected "int" for "r"');
+ }
+
+ var rLength = signature[offset++];
+
+ if (inputLength - offset - 2 < rLength) {
+ throw new Error('"r" specified length of "' + rLength + '", only "' + (inputLength - offset - 2) + '" available');
+ }
+
+ if (maxEncodedParamLength < rLength) {
+ throw new Error('"r" specified length of "' + rLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
+ }
+
+ var rOffset = offset;
+ offset += rLength;
+
+ if (signature[offset++] !== ENCODED_TAG_INT) {
+ throw new Error('Could not find expected "int" for "s"');
+ }
+
+ var sLength = signature[offset++];
+
+ if (inputLength - offset !== sLength) {
+ throw new Error('"s" specified length of "' + sLength + '", expected "' + (inputLength - offset) + '"');
+ }
+
+ if (maxEncodedParamLength < sLength) {
+ throw new Error('"s" specified length of "' + sLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
+ }
+
+ var sOffset = offset;
+ offset += sLength;
+
+ if (offset !== inputLength) {
+ throw new Error('Expected to consume entire buffer, but "' + (inputLength - offset) + '" bytes remain');
+ }
+
+ var rPadding = paramBytes - rLength,
+ sPadding = paramBytes - sLength;
+
+ var dst = Buffer.allocUnsafe(rPadding + rLength + sPadding + sLength);
+
+ for (offset = 0; offset < rPadding; ++offset) {
+ dst[offset] = 0;
+ }
+ signature.copy(dst, offset, rOffset + Math.max(-rPadding, 0), rOffset + rLength);
+
+ offset = paramBytes;
+
+ for (var o = offset; offset < o + sPadding; ++offset) {
+ dst[offset] = 0;
+ }
+ signature.copy(dst, offset, sOffset + Math.max(-sPadding, 0), sOffset + sLength);
+
+ dst = dst.toString('base64');
+ dst = base64Url(dst);
+
+ return dst;
+}
+
+function countPadding(buf, start, stop) {
+ var padding = 0;
+ while (start + padding < stop && buf[start + padding] === 0) {
+ ++padding;
+ }
+
+ var needsSign = buf[start + padding] >= MAX_OCTET;
+ if (needsSign) {
+ --padding;
+ }
+
+ return padding;
+}
+
+function joseToDer(signature, alg) {
+ signature = signatureAsBuffer(signature);
+ var paramBytes = getParamBytesForAlg(alg);
+
+ var signatureBytes = signature.length;
+ if (signatureBytes !== paramBytes * 2) {
+ throw new TypeError('"' + alg + '" signatures must be "' + paramBytes * 2 + '" bytes, saw "' + signatureBytes + '"');
+ }
+
+ var rPadding = countPadding(signature, 0, paramBytes);
+ var sPadding = countPadding(signature, paramBytes, signature.length);
+ var rLength = paramBytes - rPadding;
+ var sLength = paramBytes - sPadding;
+
+ var rsBytes = 1 + 1 + rLength + 1 + 1 + sLength;
+
+ var shortLength = rsBytes < MAX_OCTET;
+
+ var dst = Buffer.allocUnsafe((shortLength ? 2 : 3) + rsBytes);
+
+ var offset = 0;
+ dst[offset++] = ENCODED_TAG_SEQ;
+ if (shortLength) {
+ // Bit 8 has value "0"
+ // bits 7-1 give the length.
+ dst[offset++] = rsBytes;
+ } else {
+ // Bit 8 of first octet has value "1"
+ // bits 7-1 give the number of additional length octets.
+ dst[offset++] = MAX_OCTET | 1;
+ // length, base 256
+ dst[offset++] = rsBytes & 0xff;
+ }
+ dst[offset++] = ENCODED_TAG_INT;
+ dst[offset++] = rLength;
+ if (rPadding < 0) {
+ dst[offset++] = 0;
+ offset += signature.copy(dst, offset, 0, paramBytes);
+ } else {
+ offset += signature.copy(dst, offset, rPadding, paramBytes);
+ }
+ dst[offset++] = ENCODED_TAG_INT;
+ dst[offset++] = sLength;
+ if (sPadding < 0) {
+ dst[offset++] = 0;
+ signature.copy(dst, offset, paramBytes);
+ } else {
+ signature.copy(dst, offset, paramBytes + sPadding);
+ }
+
+ return dst;
+}
+
+module.exports = {
+ derToJose: derToJose,
+ joseToDer: joseToDer
+};
diff --git a/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js b/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js
new file mode 100644
index 0000000..9fe67ac
--- /dev/null
+++ b/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js
@@ -0,0 +1,23 @@
+'use strict';
+
+function getParamSize(keySize) {
+ var result = ((keySize / 8) | 0) + (keySize % 8 === 0 ? 0 : 1);
+ return result;
+}
+
+var paramBytesForAlg = {
+ ES256: getParamSize(256),
+ ES384: getParamSize(384),
+ ES512: getParamSize(521)
+};
+
+function getParamBytesForAlg(alg) {
+ var paramBytes = paramBytesForAlg[alg];
+ if (paramBytes) {
+ return paramBytes;
+ }
+
+ throw new Error('Unknown algorithm "' + alg + '"');
+}
+
+module.exports = getParamBytesForAlg;
diff --git a/node_modules/generate-function/.travis.yml b/node_modules/generate-function/.travis.yml
new file mode 100644
index 0000000..6e5919d
--- /dev/null
+++ b/node_modules/generate-function/.travis.yml
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+ - "0.10"
diff --git a/node_modules/generate-function/LICENSE b/node_modules/generate-function/LICENSE
new file mode 100644
index 0000000..757562e
--- /dev/null
+++ b/node_modules/generate-function/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Mathias Buus
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file
diff --git a/node_modules/generate-function/README.md b/node_modules/generate-function/README.md
new file mode 100644
index 0000000..97419e9
--- /dev/null
+++ b/node_modules/generate-function/README.md
@@ -0,0 +1,89 @@
+# generate-function
+
+Module that helps you write generated functions in Node
+
+```
+npm install generate-function
+```
+
+[](http://travis-ci.org/mafintosh/generate-function)
+
+## Disclamer
+
+Writing code that generates code is hard.
+You should only use this if you really, really, really need this for performance reasons (like schema validators / parsers etc).
+
+## Usage
+
+``` js
+const genfun = require('generate-function')
+const { d } = genfun.formats
+
+function addNumber (val) {
+ const gen = genfun()
+
+ gen(`
+ function add (n) {')
+ return n + ${d(val)}) // supports format strings to insert values
+ }
+ `)
+
+ return gen.toFunction() // will compile the function
+}
+
+const add2 = addNumber(2)
+
+console.log('1 + 2 =', add2(1))
+console.log(add2.toString()) // prints the generated function
+```
+
+If you need to close over variables in your generated function pass them to `toFunction(scope)`
+
+``` js
+function multiply (a, b) {
+ return a * b
+}
+
+function addAndMultiplyNumber (val) {
+ const gen = genfun()
+
+ gen(`
+ function (n) {
+ if (typeof n !== 'number') {
+ throw new Error('argument should be a number')
+ }
+ const result = multiply(${d(val)}, n + ${d(val)})
+ return result
+ }
+ `)
+
+ // use gen.toString() if you want to see the generated source
+
+ return gen.toFunction({multiply})
+}
+
+const addAndMultiply2 = addAndMultiplyNumber(2)
+
+console.log(addAndMultiply2.toString())
+console.log('(3 + 2) * 2 =', addAndMultiply2(3))
+```
+
+You can call `gen(src)` as many times as you want to append more source code to the function.
+
+## Variables
+
+If you need a unique safe identifier for the scope of the generated function call `str = gen.sym('friendlyName')`.
+These are safe to use for variable names etc.
+
+## Object properties
+
+If you need to access an object property use the `str = gen.property('objectName', 'propertyName')`.
+
+This returns `'objectName.propertyName'` if `propertyName` is safe to use as a variable. Otherwise
+it returns `objectName[propertyNameAsString]`.
+
+If you only pass `gen.property('propertyName')` it will only return the `propertyName` part safely
+
+## License
+
+MIT
diff --git a/node_modules/generate-function/example.js b/node_modules/generate-function/example.js
new file mode 100644
index 0000000..7c36c76
--- /dev/null
+++ b/node_modules/generate-function/example.js
@@ -0,0 +1,27 @@
+const genfun = require('./')
+const { d } = genfun.formats
+
+function multiply (a, b) {
+ return a * b
+}
+
+function addAndMultiplyNumber (val) {
+ const fn = genfun(`
+ function (n) {
+ if (typeof n !== 'number') {
+ throw new Error('argument should be a number')
+ }
+ const result = multiply(${d(val)}, n + ${d(val)})
+ return result
+ }
+ `)
+
+ // use fn.toString() if you want to see the generated source
+
+ return fn.toFunction({multiply})
+}
+
+const addAndMultiply2 = addAndMultiplyNumber(2)
+
+console.log(addAndMultiply2.toString())
+console.log('(3 + 2) * 2 =', addAndMultiply2(3))
diff --git a/node_modules/generate-function/index.js b/node_modules/generate-function/index.js
new file mode 100644
index 0000000..8105dc0
--- /dev/null
+++ b/node_modules/generate-function/index.js
@@ -0,0 +1,181 @@
+var util = require('util')
+var isProperty = require('is-property')
+
+var INDENT_START = /[\{\[]/
+var INDENT_END = /[\}\]]/
+
+// from https://mathiasbynens.be/notes/reserved-keywords
+var RESERVED = [
+ 'do',
+ 'if',
+ 'in',
+ 'for',
+ 'let',
+ 'new',
+ 'try',
+ 'var',
+ 'case',
+ 'else',
+ 'enum',
+ 'eval',
+ 'null',
+ 'this',
+ 'true',
+ 'void',
+ 'with',
+ 'await',
+ 'break',
+ 'catch',
+ 'class',
+ 'const',
+ 'false',
+ 'super',
+ 'throw',
+ 'while',
+ 'yield',
+ 'delete',
+ 'export',
+ 'import',
+ 'public',
+ 'return',
+ 'static',
+ 'switch',
+ 'typeof',
+ 'default',
+ 'extends',
+ 'finally',
+ 'package',
+ 'private',
+ 'continue',
+ 'debugger',
+ 'function',
+ 'arguments',
+ 'interface',
+ 'protected',
+ 'implements',
+ 'instanceof',
+ 'NaN',
+ 'undefined'
+]
+
+var RESERVED_MAP = {}
+
+for (var i = 0; i < RESERVED.length; i++) {
+ RESERVED_MAP[RESERVED[i]] = true
+}
+
+var isVariable = function (name) {
+ return isProperty(name) && !RESERVED_MAP.hasOwnProperty(name)
+}
+
+var formats = {
+ s: function(s) {
+ return '' + s
+ },
+ d: function(d) {
+ return '' + Number(d)
+ },
+ o: function(o) {
+ return JSON.stringify(o)
+ }
+}
+
+var genfun = function() {
+ var lines = []
+ var indent = 0
+ var vars = {}
+
+ var push = function(str) {
+ var spaces = ''
+ while (spaces.length < indent*2) spaces += ' '
+ lines.push(spaces+str)
+ }
+
+ var pushLine = function(line) {
+ if (INDENT_END.test(line.trim()[0]) && INDENT_START.test(line[line.length-1])) {
+ indent--
+ push(line)
+ indent++
+ return
+ }
+ if (INDENT_START.test(line[line.length-1])) {
+ push(line)
+ indent++
+ return
+ }
+ if (INDENT_END.test(line.trim()[0])) {
+ indent--
+ push(line)
+ return
+ }
+
+ push(line)
+ }
+
+ var line = function(fmt) {
+ if (!fmt) return line
+
+ if (arguments.length === 1 && fmt.indexOf('\n') > -1) {
+ var lines = fmt.trim().split('\n')
+ for (var i = 0; i < lines.length; i++) {
+ pushLine(lines[i].trim())
+ }
+ } else {
+ pushLine(util.format.apply(util, arguments))
+ }
+
+ return line
+ }
+
+ line.scope = {}
+ line.formats = formats
+
+ line.sym = function(name) {
+ if (!name || !isVariable(name)) name = 'tmp'
+ if (!vars[name]) vars[name] = 0
+ return name + (vars[name]++ || '')
+ }
+
+ line.property = function(obj, name) {
+ if (arguments.length === 1) {
+ name = obj
+ obj = ''
+ }
+
+ name = name + ''
+
+ if (isProperty(name)) return (obj ? obj + '.' + name : name)
+ return obj ? obj + '[' + JSON.stringify(name) + ']' : JSON.stringify(name)
+ }
+
+ line.toString = function() {
+ return lines.join('\n')
+ }
+
+ line.toFunction = function(scope) {
+ if (!scope) scope = {}
+
+ var src = 'return ('+line.toString()+')'
+
+ Object.keys(line.scope).forEach(function (key) {
+ if (!scope[key]) scope[key] = line.scope[key]
+ })
+
+ var keys = Object.keys(scope).map(function(key) {
+ return key
+ })
+
+ var vals = keys.map(function(key) {
+ return scope[key]
+ })
+
+ return Function.apply(null, keys.concat(src)).apply(null, vals)
+ }
+
+ if (arguments.length) line.apply(null, arguments)
+
+ return line
+}
+
+genfun.formats = formats
+module.exports = genfun
diff --git a/node_modules/generate-function/package.json b/node_modules/generate-function/package.json
new file mode 100644
index 0000000..be2ac04
--- /dev/null
+++ b/node_modules/generate-function/package.json
@@ -0,0 +1,32 @@
+{
+ "name": "generate-function",
+ "version": "2.3.1",
+ "description": "Module that helps you write generated functions in Node",
+ "main": "index.js",
+ "scripts": {
+ "test": "tape test.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/mafintosh/generate-function"
+ },
+ "keywords": [
+ "generate",
+ "code",
+ "generation",
+ "function",
+ "performance"
+ ],
+ "author": "Mathias Buus",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/mafintosh/generate-function/issues"
+ },
+ "homepage": "https://github.com/mafintosh/generate-function",
+ "devDependencies": {
+ "tape": "^4.9.1"
+ },
+ "dependencies": {
+ "is-property": "^1.0.2"
+ }
+}
diff --git a/node_modules/generate-function/test.js b/node_modules/generate-function/test.js
new file mode 100644
index 0000000..9337b71
--- /dev/null
+++ b/node_modules/generate-function/test.js
@@ -0,0 +1,49 @@
+var tape = require('tape')
+var genfun = require('./')
+
+tape('generate add function', function(t) {
+ var fn = genfun()
+ ('function add(n) {')
+ ('return n + %d', 42)
+ ('}')
+
+ t.same(fn.toString(), 'function add(n) {\n return n + 42\n}', 'code is indented')
+ t.same(fn.toFunction()(10), 52, 'function works')
+ t.end()
+})
+
+tape('generate function + closed variables', function(t) {
+ var fn = genfun()
+ ('function add(n) {')
+ ('return n + %d + number', 42)
+ ('}')
+
+ var notGood = fn.toFunction()
+ var good = fn.toFunction({number:10})
+
+ try {
+ notGood(10)
+ t.ok(false, 'function should not work')
+ } catch (err) {
+ t.same(err.message, 'number is not defined', 'throws reference error')
+ }
+
+ t.same(good(11), 63, 'function with closed var works')
+ t.end()
+})
+
+tape('generate property', function(t) {
+ var gen = genfun()
+
+ t.same(gen.property('a'), 'a')
+ t.same(gen.property('42'), '"42"')
+ t.same(gen.property('b', 'a'), 'b.a')
+ t.same(gen.property('b', '42'), 'b["42"]')
+ t.same(gen.sym(42), 'tmp')
+ t.same(gen.sym('a'), 'a')
+ t.same(gen.sym('a'), 'a1')
+ t.same(gen.sym(42), 'tmp1')
+ t.same(gen.sym('const'), 'tmp2')
+
+ t.end()
+})
diff --git a/node_modules/is-property/.npmignore b/node_modules/is-property/.npmignore
new file mode 100644
index 0000000..8ecfa25
--- /dev/null
+++ b/node_modules/is-property/.npmignore
@@ -0,0 +1,17 @@
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+
+pids
+logs
+results
+
+npm-debug.log
+node_modules/*
+*.DS_Store
+test/*
\ No newline at end of file
diff --git a/node_modules/is-property/LICENSE b/node_modules/is-property/LICENSE
new file mode 100644
index 0000000..8ce206a
--- /dev/null
+++ b/node_modules/is-property/LICENSE
@@ -0,0 +1,22 @@
+
+The MIT License (MIT)
+
+Copyright (c) 2013 Mikola Lysenko
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/is-property/README.md b/node_modules/is-property/README.md
new file mode 100644
index 0000000..ef1d00b
--- /dev/null
+++ b/node_modules/is-property/README.md
@@ -0,0 +1,28 @@
+is-property
+===========
+Tests if a property of a JavaScript object can be accessed using the dot (.) notation or if it must be enclosed in brackets, (ie use x[" ... "])
+
+Example
+-------
+
+```javascript
+var isProperty = require("is-property")
+
+console.log(isProperty("foo")) //Prints true
+console.log(isProperty("0")) //Prints false
+```
+
+Install
+-------
+
+ npm install is-property
+
+### `require("is-property")(str)`
+Checks if str is a property
+
+* `str` is a string which we will test if it is a property or not
+
+**Returns** true or false depending if str is a property
+
+## Credits
+(c) 2013 Mikola Lysenko. MIT License
\ No newline at end of file
diff --git a/node_modules/is-property/is-property.js b/node_modules/is-property/is-property.js
new file mode 100644
index 0000000..db58b47
--- /dev/null
+++ b/node_modules/is-property/is-property.js
@@ -0,0 +1,5 @@
+"use strict"
+function isProperty(str) {
+ return /^[$A-Z\_a-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc][$A-Z\_a-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc0-9\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e4-\u08fe\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d02\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19b0-\u19c0\u19c8\u19c9\u19d0-\u19d9\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1dc0-\u1de6\u1dfc-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f1\ua900-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f]*$/.test(str)
+}
+module.exports = isProperty
\ No newline at end of file
diff --git a/node_modules/is-property/package.json b/node_modules/is-property/package.json
new file mode 100644
index 0000000..2105f7b
--- /dev/null
+++ b/node_modules/is-property/package.json
@@ -0,0 +1,36 @@
+{
+ "name": "is-property",
+ "version": "1.0.2",
+ "description": "Tests if a JSON property can be accessed using . syntax",
+ "main": "is-property.js",
+ "directories": {
+ "test": "test"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "tape": "~1.0.4"
+ },
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/mikolalysenko/is-property.git"
+ },
+ "keywords": [
+ "is",
+ "property",
+ "json",
+ "dot",
+ "bracket",
+ ".",
+ "[]"
+ ],
+ "author": "Mikola Lysenko",
+ "license": "MIT",
+ "readmeFilename": "README.md",
+ "gitHead": "0a85ea5b6b1264ea1cdecc6e5cf186adbb3ffc50",
+ "bugs": {
+ "url": "https://github.com/mikolalysenko/is-property/issues"
+ }
+}
diff --git a/node_modules/jsonwebtoken/LICENSE b/node_modules/jsonwebtoken/LICENSE
new file mode 100644
index 0000000..bcd1854
--- /dev/null
+++ b/node_modules/jsonwebtoken/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Auth0, Inc. (http://auth0.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/jsonwebtoken/README.md b/node_modules/jsonwebtoken/README.md
new file mode 100644
index 0000000..4e20dd9
--- /dev/null
+++ b/node_modules/jsonwebtoken/README.md
@@ -0,0 +1,396 @@
+# jsonwebtoken
+
+| **Build** | **Dependency** |
+|-----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
+| [](http://travis-ci.org/auth0/node-jsonwebtoken) | [](https://david-dm.org/auth0/node-jsonwebtoken) |
+
+
+An implementation of [JSON Web Tokens](https://tools.ietf.org/html/rfc7519).
+
+This was developed against `draft-ietf-oauth-json-web-token-08`. It makes use of [node-jws](https://github.com/brianloveswords/node-jws)
+
+# Install
+
+```bash
+$ npm install jsonwebtoken
+```
+
+# Migration notes
+
+* [From v8 to v9](https://github.com/auth0/node-jsonwebtoken/wiki/Migration-Notes:-v8-to-v9)
+* [From v7 to v8](https://github.com/auth0/node-jsonwebtoken/wiki/Migration-Notes:-v7-to-v8)
+
+# Usage
+
+### jwt.sign(payload, secretOrPrivateKey, [options, callback])
+
+(Asynchronous) If a callback is supplied, the callback is called with the `err` or the JWT.
+
+(Synchronous) Returns the JsonWebToken as string
+
+`payload` could be an object literal, buffer or string representing valid JSON.
+> **Please _note_ that** `exp` or any other claim is only set if the payload is an object literal. Buffer or string payloads are not checked for JSON validity.
+
+> If `payload` is not a buffer or a string, it will be coerced into a string using `JSON.stringify`.
+
+`secretOrPrivateKey` is a string (utf-8 encoded), buffer, object, or KeyObject containing either the secret for HMAC algorithms or the PEM
+encoded private key for RSA and ECDSA. In case of a private key with passphrase an object `{ key, passphrase }` can be used (based on [crypto documentation](https://nodejs.org/api/crypto.html#crypto_sign_sign_private_key_output_format)), in this case be sure you pass the `algorithm` option.
+When signing with RSA algorithms the minimum modulus length is 2048 except when the allowInsecureKeySizes option is set to true. Private keys below this size will be rejected with an error.
+
+`options`:
+
+* `algorithm` (default: `HS256`)
+* `expiresIn`: expressed in seconds or a string describing a time span [vercel/ms](https://github.com/vercel/ms).
+ > Eg: `60`, `"2 days"`, `"10h"`, `"7d"`. A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (days, hours, etc), otherwise milliseconds unit is used by default (`"120"` is equal to `"120ms"`).
+* `notBefore`: expressed in seconds or a string describing a time span [vercel/ms](https://github.com/vercel/ms).
+ > Eg: `60`, `"2 days"`, `"10h"`, `"7d"`. A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (days, hours, etc), otherwise milliseconds unit is used by default (`"120"` is equal to `"120ms"`).
+* `audience`
+* `issuer`
+* `jwtid`
+* `subject`
+* `noTimestamp`
+* `header`
+* `keyid`
+* `mutatePayload`: if true, the sign function will modify the payload object directly. This is useful if you need a raw reference to the payload after claims have been applied to it but before it has been encoded into a token.
+* `allowInsecureKeySizes`: if true allows private keys with a modulus below 2048 to be used for RSA
+* `allowInvalidAsymmetricKeyTypes`: if true, allows asymmetric keys which do not match the specified algorithm. This option is intended only for backwards compatability and should be avoided.
+
+
+
+> There are no default values for `expiresIn`, `notBefore`, `audience`, `subject`, `issuer`. These claims can also be provided in the payload directly with `exp`, `nbf`, `aud`, `sub` and `iss` respectively, but you **_can't_** include in both places.
+
+Remember that `exp`, `nbf` and `iat` are **NumericDate**, see related [Token Expiration (exp claim)](#token-expiration-exp-claim)
+
+
+The header can be customized via the `options.header` object.
+
+Generated jwts will include an `iat` (issued at) claim by default unless `noTimestamp` is specified. If `iat` is inserted in the payload, it will be used instead of the real timestamp for calculating other things like `exp` given a timespan in `options.expiresIn`.
+
+Synchronous Sign with default (HMAC SHA256)
+
+```js
+var jwt = require('jsonwebtoken');
+var token = jwt.sign({ foo: 'bar' }, 'shhhhh');
+```
+
+Synchronous Sign with RSA SHA256
+```js
+// sign with RSA SHA256
+var privateKey = fs.readFileSync('private.key');
+var token = jwt.sign({ foo: 'bar' }, privateKey, { algorithm: 'RS256' });
+```
+
+Sign asynchronously
+```js
+jwt.sign({ foo: 'bar' }, privateKey, { algorithm: 'RS256' }, function(err, token) {
+ console.log(token);
+});
+```
+
+Backdate a jwt 30 seconds
+```js
+var older_token = jwt.sign({ foo: 'bar', iat: Math.floor(Date.now() / 1000) - 30 }, 'shhhhh');
+```
+
+#### Token Expiration (exp claim)
+
+The standard for JWT defines an `exp` claim for expiration. The expiration is represented as a **NumericDate**:
+
+> A JSON numeric value representing the number of seconds from 1970-01-01T00:00:00Z UTC until the specified UTC date/time, ignoring leap seconds. This is equivalent to the IEEE Std 1003.1, 2013 Edition [POSIX.1] definition "Seconds Since the Epoch", in which each day is accounted for by exactly 86400 seconds, other than that non-integer values can be represented. See RFC 3339 [RFC3339] for details regarding date/times in general and UTC in particular.
+
+This means that the `exp` field should contain the number of seconds since the epoch.
+
+Signing a token with 1 hour of expiration:
+
+```javascript
+jwt.sign({
+ exp: Math.floor(Date.now() / 1000) + (60 * 60),
+ data: 'foobar'
+}, 'secret');
+```
+
+Another way to generate a token like this with this library is:
+
+```javascript
+jwt.sign({
+ data: 'foobar'
+}, 'secret', { expiresIn: 60 * 60 });
+
+//or even better:
+
+jwt.sign({
+ data: 'foobar'
+}, 'secret', { expiresIn: '1h' });
+```
+
+### jwt.verify(token, secretOrPublicKey, [options, callback])
+
+(Asynchronous) If a callback is supplied, function acts asynchronously. The callback is called with the decoded payload if the signature is valid and optional expiration, audience, or issuer are valid. If not, it will be called with the error.
+
+(Synchronous) If a callback is not supplied, function acts synchronously. Returns the payload decoded if the signature is valid and optional expiration, audience, or issuer are valid. If not, it will throw the error.
+
+> __Warning:__ When the token comes from an untrusted source (e.g. user input or external requests), the returned decoded payload should be treated like any other user input; please make sure to sanitize and only work with properties that are expected
+
+`token` is the JsonWebToken string
+
+`secretOrPublicKey` is a string (utf-8 encoded), buffer, or KeyObject containing either the secret for HMAC algorithms, or the PEM
+encoded public key for RSA and ECDSA.
+If `jwt.verify` is called asynchronous, `secretOrPublicKey` can be a function that should fetch the secret or public key. See below for a detailed example
+
+As mentioned in [this comment](https://github.com/auth0/node-jsonwebtoken/issues/208#issuecomment-231861138), there are other libraries that expect base64 encoded secrets (random bytes encoded using base64), if that is your case you can pass `Buffer.from(secret, 'base64')`, by doing this the secret will be decoded using base64 and the token verification will use the original random bytes.
+
+`options`
+
+* `algorithms`: List of strings with the names of the allowed algorithms. For instance, `["HS256", "HS384"]`.
+ > If not specified a defaults will be used based on the type of key provided
+ > * secret - ['HS256', 'HS384', 'HS512']
+ > * rsa - ['RS256', 'RS384', 'RS512']
+ > * ec - ['ES256', 'ES384', 'ES512']
+ > * default - ['RS256', 'RS384', 'RS512']
+* `audience`: if you want to check audience (`aud`), provide a value here. The audience can be checked against a string, a regular expression or a list of strings and/or regular expressions.
+ > Eg: `"urn:foo"`, `/urn:f[o]{2}/`, `[/urn:f[o]{2}/, "urn:bar"]`
+* `complete`: return an object with the decoded `{ payload, header, signature }` instead of only the usual content of the payload.
+* `issuer` (optional): string or array of strings of valid values for the `iss` field.
+* `jwtid` (optional): if you want to check JWT ID (`jti`), provide a string value here.
+* `ignoreExpiration`: if `true` do not validate the expiration of the token.
+* `ignoreNotBefore`...
+* `subject`: if you want to check subject (`sub`), provide a value here
+* `clockTolerance`: number of seconds to tolerate when checking the `nbf` and `exp` claims, to deal with small clock differences among different servers
+* `maxAge`: the maximum allowed age for tokens to still be valid. It is expressed in seconds or a string describing a time span [vercel/ms](https://github.com/vercel/ms).
+ > Eg: `1000`, `"2 days"`, `"10h"`, `"7d"`. A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (days, hours, etc), otherwise milliseconds unit is used by default (`"120"` is equal to `"120ms"`).
+* `clockTimestamp`: the time in seconds that should be used as the current time for all necessary comparisons.
+* `nonce`: if you want to check `nonce` claim, provide a string value here. It is used on Open ID for the ID Tokens. ([Open ID implementation notes](https://openid.net/specs/openid-connect-core-1_0.html#NonceNotes))
+* `allowInvalidAsymmetricKeyTypes`: if true, allows asymmetric keys which do not match the specified algorithm. This option is intended only for backwards compatability and should be avoided.
+
+```js
+// verify a token symmetric - synchronous
+var decoded = jwt.verify(token, 'shhhhh');
+console.log(decoded.foo) // bar
+
+// verify a token symmetric
+jwt.verify(token, 'shhhhh', function(err, decoded) {
+ console.log(decoded.foo) // bar
+});
+
+// invalid token - synchronous
+try {
+ var decoded = jwt.verify(token, 'wrong-secret');
+} catch(err) {
+ // err
+}
+
+// invalid token
+jwt.verify(token, 'wrong-secret', function(err, decoded) {
+ // err
+ // decoded undefined
+});
+
+// verify a token asymmetric
+var cert = fs.readFileSync('public.pem'); // get public key
+jwt.verify(token, cert, function(err, decoded) {
+ console.log(decoded.foo) // bar
+});
+
+// verify audience
+var cert = fs.readFileSync('public.pem'); // get public key
+jwt.verify(token, cert, { audience: 'urn:foo' }, function(err, decoded) {
+ // if audience mismatch, err == invalid audience
+});
+
+// verify issuer
+var cert = fs.readFileSync('public.pem'); // get public key
+jwt.verify(token, cert, { audience: 'urn:foo', issuer: 'urn:issuer' }, function(err, decoded) {
+ // if issuer mismatch, err == invalid issuer
+});
+
+// verify jwt id
+var cert = fs.readFileSync('public.pem'); // get public key
+jwt.verify(token, cert, { audience: 'urn:foo', issuer: 'urn:issuer', jwtid: 'jwtid' }, function(err, decoded) {
+ // if jwt id mismatch, err == invalid jwt id
+});
+
+// verify subject
+var cert = fs.readFileSync('public.pem'); // get public key
+jwt.verify(token, cert, { audience: 'urn:foo', issuer: 'urn:issuer', jwtid: 'jwtid', subject: 'subject' }, function(err, decoded) {
+ // if subject mismatch, err == invalid subject
+});
+
+// alg mismatch
+var cert = fs.readFileSync('public.pem'); // get public key
+jwt.verify(token, cert, { algorithms: ['RS256'] }, function (err, payload) {
+ // if token alg != RS256, err == invalid signature
+});
+
+// Verify using getKey callback
+// Example uses https://github.com/auth0/node-jwks-rsa as a way to fetch the keys.
+var jwksClient = require('jwks-rsa');
+var client = jwksClient({
+ jwksUri: 'https://sandrino.auth0.com/.well-known/jwks.json'
+});
+function getKey(header, callback){
+ client.getSigningKey(header.kid, function(err, key) {
+ var signingKey = key.publicKey || key.rsaPublicKey;
+ callback(null, signingKey);
+ });
+}
+
+jwt.verify(token, getKey, options, function(err, decoded) {
+ console.log(decoded.foo) // bar
+});
+
+```
+
+
+Need to peek into a JWT without verifying it? (Click to expand)
+
+### jwt.decode(token [, options])
+
+(Synchronous) Returns the decoded payload without verifying if the signature is valid.
+
+> __Warning:__ This will __not__ verify whether the signature is valid. You should __not__ use this for untrusted messages. You most likely want to use `jwt.verify` instead.
+
+> __Warning:__ When the token comes from an untrusted source (e.g. user input or external request), the returned decoded payload should be treated like any other user input; please make sure to sanitize and only work with properties that are expected
+
+
+`token` is the JsonWebToken string
+
+`options`:
+
+* `json`: force JSON.parse on the payload even if the header doesn't contain `"typ":"JWT"`.
+* `complete`: return an object with the decoded payload and header.
+
+Example
+
+```js
+// get the decoded payload ignoring signature, no secretOrPrivateKey needed
+var decoded = jwt.decode(token);
+
+// get the decoded payload and header
+var decoded = jwt.decode(token, {complete: true});
+console.log(decoded.header);
+console.log(decoded.payload)
+```
+
+
+
+## Errors & Codes
+Possible thrown errors during verification.
+Error is the first argument of the verification callback.
+
+### TokenExpiredError
+
+Thrown error if the token is expired.
+
+Error object:
+
+* name: 'TokenExpiredError'
+* message: 'jwt expired'
+* expiredAt: [ExpDate]
+
+```js
+jwt.verify(token, 'shhhhh', function(err, decoded) {
+ if (err) {
+ /*
+ err = {
+ name: 'TokenExpiredError',
+ message: 'jwt expired',
+ expiredAt: 1408621000
+ }
+ */
+ }
+});
+```
+
+### JsonWebTokenError
+Error object:
+
+* name: 'JsonWebTokenError'
+* message:
+ * 'invalid token' - the header or payload could not be parsed
+ * 'jwt malformed' - the token does not have three components (delimited by a `.`)
+ * 'jwt signature is required'
+ * 'invalid signature'
+ * 'jwt audience invalid. expected: [OPTIONS AUDIENCE]'
+ * 'jwt issuer invalid. expected: [OPTIONS ISSUER]'
+ * 'jwt id invalid. expected: [OPTIONS JWT ID]'
+ * 'jwt subject invalid. expected: [OPTIONS SUBJECT]'
+
+```js
+jwt.verify(token, 'shhhhh', function(err, decoded) {
+ if (err) {
+ /*
+ err = {
+ name: 'JsonWebTokenError',
+ message: 'jwt malformed'
+ }
+ */
+ }
+});
+```
+
+### NotBeforeError
+Thrown if current time is before the nbf claim.
+
+Error object:
+
+* name: 'NotBeforeError'
+* message: 'jwt not active'
+* date: 2018-10-04T16:10:44.000Z
+
+```js
+jwt.verify(token, 'shhhhh', function(err, decoded) {
+ if (err) {
+ /*
+ err = {
+ name: 'NotBeforeError',
+ message: 'jwt not active',
+ date: 2018-10-04T16:10:44.000Z
+ }
+ */
+ }
+});
+```
+
+
+## Algorithms supported
+
+Array of supported algorithms. The following algorithms are currently supported.
+
+| alg Parameter Value | Digital Signature or MAC Algorithm |
+|---------------------|------------------------------------------------------------------------|
+| HS256 | HMAC using SHA-256 hash algorithm |
+| HS384 | HMAC using SHA-384 hash algorithm |
+| HS512 | HMAC using SHA-512 hash algorithm |
+| RS256 | RSASSA-PKCS1-v1_5 using SHA-256 hash algorithm |
+| RS384 | RSASSA-PKCS1-v1_5 using SHA-384 hash algorithm |
+| RS512 | RSASSA-PKCS1-v1_5 using SHA-512 hash algorithm |
+| PS256 | RSASSA-PSS using SHA-256 hash algorithm (only node ^6.12.0 OR >=8.0.0) |
+| PS384 | RSASSA-PSS using SHA-384 hash algorithm (only node ^6.12.0 OR >=8.0.0) |
+| PS512 | RSASSA-PSS using SHA-512 hash algorithm (only node ^6.12.0 OR >=8.0.0) |
+| ES256 | ECDSA using P-256 curve and SHA-256 hash algorithm |
+| ES384 | ECDSA using P-384 curve and SHA-384 hash algorithm |
+| ES512 | ECDSA using P-521 curve and SHA-512 hash algorithm |
+| none | No digital signature or MAC value included |
+
+## Refreshing JWTs
+
+First of all, we recommend you to think carefully if auto-refreshing a JWT will not introduce any vulnerability in your system.
+
+We are not comfortable including this as part of the library, however, you can take a look at [this example](https://gist.github.com/ziluvatar/a3feb505c4c0ec37059054537b38fc48) to show how this could be accomplished.
+Apart from that example there are [an issue](https://github.com/auth0/node-jsonwebtoken/issues/122) and [a pull request](https://github.com/auth0/node-jsonwebtoken/pull/172) to get more knowledge about this topic.
+
+# TODO
+
+* X.509 certificate chain is not checked
+
+## Issue Reporting
+
+If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
+
+## Author
+
+[Auth0](https://auth0.com)
+
+## License
+
+This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.
diff --git a/node_modules/jsonwebtoken/decode.js b/node_modules/jsonwebtoken/decode.js
new file mode 100644
index 0000000..8fe1adc
--- /dev/null
+++ b/node_modules/jsonwebtoken/decode.js
@@ -0,0 +1,30 @@
+var jws = require('jws');
+
+module.exports = function (jwt, options) {
+ options = options || {};
+ var decoded = jws.decode(jwt, options);
+ if (!decoded) { return null; }
+ var payload = decoded.payload;
+
+ //try parse the payload
+ if(typeof payload === 'string') {
+ try {
+ var obj = JSON.parse(payload);
+ if(obj !== null && typeof obj === 'object') {
+ payload = obj;
+ }
+ } catch (e) { }
+ }
+
+ //return header if `complete` option is enabled. header includes claims
+ //such as `kid` and `alg` used to select the key within a JWKS needed to
+ //verify the signature
+ if (options.complete === true) {
+ return {
+ header: decoded.header,
+ payload: payload,
+ signature: decoded.signature
+ };
+ }
+ return payload;
+};
diff --git a/node_modules/jsonwebtoken/index.js b/node_modules/jsonwebtoken/index.js
new file mode 100644
index 0000000..161eb2d
--- /dev/null
+++ b/node_modules/jsonwebtoken/index.js
@@ -0,0 +1,8 @@
+module.exports = {
+ decode: require('./decode'),
+ verify: require('./verify'),
+ sign: require('./sign'),
+ JsonWebTokenError: require('./lib/JsonWebTokenError'),
+ NotBeforeError: require('./lib/NotBeforeError'),
+ TokenExpiredError: require('./lib/TokenExpiredError'),
+};
diff --git a/node_modules/jsonwebtoken/lib/JsonWebTokenError.js b/node_modules/jsonwebtoken/lib/JsonWebTokenError.js
new file mode 100644
index 0000000..e068222
--- /dev/null
+++ b/node_modules/jsonwebtoken/lib/JsonWebTokenError.js
@@ -0,0 +1,14 @@
+var JsonWebTokenError = function (message, error) {
+ Error.call(this, message);
+ if(Error.captureStackTrace) {
+ Error.captureStackTrace(this, this.constructor);
+ }
+ this.name = 'JsonWebTokenError';
+ this.message = message;
+ if (error) this.inner = error;
+};
+
+JsonWebTokenError.prototype = Object.create(Error.prototype);
+JsonWebTokenError.prototype.constructor = JsonWebTokenError;
+
+module.exports = JsonWebTokenError;
diff --git a/node_modules/jsonwebtoken/lib/NotBeforeError.js b/node_modules/jsonwebtoken/lib/NotBeforeError.js
new file mode 100644
index 0000000..7b30084
--- /dev/null
+++ b/node_modules/jsonwebtoken/lib/NotBeforeError.js
@@ -0,0 +1,13 @@
+var JsonWebTokenError = require('./JsonWebTokenError');
+
+var NotBeforeError = function (message, date) {
+ JsonWebTokenError.call(this, message);
+ this.name = 'NotBeforeError';
+ this.date = date;
+};
+
+NotBeforeError.prototype = Object.create(JsonWebTokenError.prototype);
+
+NotBeforeError.prototype.constructor = NotBeforeError;
+
+module.exports = NotBeforeError;
\ No newline at end of file
diff --git a/node_modules/jsonwebtoken/lib/TokenExpiredError.js b/node_modules/jsonwebtoken/lib/TokenExpiredError.js
new file mode 100644
index 0000000..abb704f
--- /dev/null
+++ b/node_modules/jsonwebtoken/lib/TokenExpiredError.js
@@ -0,0 +1,13 @@
+var JsonWebTokenError = require('./JsonWebTokenError');
+
+var TokenExpiredError = function (message, expiredAt) {
+ JsonWebTokenError.call(this, message);
+ this.name = 'TokenExpiredError';
+ this.expiredAt = expiredAt;
+};
+
+TokenExpiredError.prototype = Object.create(JsonWebTokenError.prototype);
+
+TokenExpiredError.prototype.constructor = TokenExpiredError;
+
+module.exports = TokenExpiredError;
\ No newline at end of file
diff --git a/node_modules/jsonwebtoken/lib/asymmetricKeyDetailsSupported.js b/node_modules/jsonwebtoken/lib/asymmetricKeyDetailsSupported.js
new file mode 100644
index 0000000..a6ede56
--- /dev/null
+++ b/node_modules/jsonwebtoken/lib/asymmetricKeyDetailsSupported.js
@@ -0,0 +1,3 @@
+const semver = require('semver');
+
+module.exports = semver.satisfies(process.version, '>=15.7.0');
diff --git a/node_modules/jsonwebtoken/lib/psSupported.js b/node_modules/jsonwebtoken/lib/psSupported.js
new file mode 100644
index 0000000..8c04144
--- /dev/null
+++ b/node_modules/jsonwebtoken/lib/psSupported.js
@@ -0,0 +1,3 @@
+var semver = require('semver');
+
+module.exports = semver.satisfies(process.version, '^6.12.0 || >=8.0.0');
diff --git a/node_modules/jsonwebtoken/lib/rsaPssKeyDetailsSupported.js b/node_modules/jsonwebtoken/lib/rsaPssKeyDetailsSupported.js
new file mode 100644
index 0000000..7fcf368
--- /dev/null
+++ b/node_modules/jsonwebtoken/lib/rsaPssKeyDetailsSupported.js
@@ -0,0 +1,3 @@
+const semver = require('semver');
+
+module.exports = semver.satisfies(process.version, '>=16.9.0');
diff --git a/node_modules/jsonwebtoken/lib/timespan.js b/node_modules/jsonwebtoken/lib/timespan.js
new file mode 100644
index 0000000..e509869
--- /dev/null
+++ b/node_modules/jsonwebtoken/lib/timespan.js
@@ -0,0 +1,18 @@
+var ms = require('ms');
+
+module.exports = function (time, iat) {
+ var timestamp = iat || Math.floor(Date.now() / 1000);
+
+ if (typeof time === 'string') {
+ var milliseconds = ms(time);
+ if (typeof milliseconds === 'undefined') {
+ return;
+ }
+ return Math.floor(timestamp + milliseconds / 1000);
+ } else if (typeof time === 'number') {
+ return timestamp + time;
+ } else {
+ return;
+ }
+
+};
\ No newline at end of file
diff --git a/node_modules/jsonwebtoken/lib/validateAsymmetricKey.js b/node_modules/jsonwebtoken/lib/validateAsymmetricKey.js
new file mode 100644
index 0000000..c10340b
--- /dev/null
+++ b/node_modules/jsonwebtoken/lib/validateAsymmetricKey.js
@@ -0,0 +1,66 @@
+const ASYMMETRIC_KEY_DETAILS_SUPPORTED = require('./asymmetricKeyDetailsSupported');
+const RSA_PSS_KEY_DETAILS_SUPPORTED = require('./rsaPssKeyDetailsSupported');
+
+const allowedAlgorithmsForKeys = {
+ 'ec': ['ES256', 'ES384', 'ES512'],
+ 'rsa': ['RS256', 'PS256', 'RS384', 'PS384', 'RS512', 'PS512'],
+ 'rsa-pss': ['PS256', 'PS384', 'PS512']
+};
+
+const allowedCurves = {
+ ES256: 'prime256v1',
+ ES384: 'secp384r1',
+ ES512: 'secp521r1',
+};
+
+module.exports = function(algorithm, key) {
+ if (!algorithm || !key) return;
+
+ const keyType = key.asymmetricKeyType;
+ if (!keyType) return;
+
+ const allowedAlgorithms = allowedAlgorithmsForKeys[keyType];
+
+ if (!allowedAlgorithms) {
+ throw new Error(`Unknown key type "${keyType}".`);
+ }
+
+ if (!allowedAlgorithms.includes(algorithm)) {
+ throw new Error(`"alg" parameter for "${keyType}" key type must be one of: ${allowedAlgorithms.join(', ')}.`)
+ }
+
+ /*
+ * Ignore the next block from test coverage because it gets executed
+ * conditionally depending on the Node version. Not ignoring it would
+ * prevent us from reaching the target % of coverage for versions of
+ * Node under 15.7.0.
+ */
+ /* istanbul ignore next */
+ if (ASYMMETRIC_KEY_DETAILS_SUPPORTED) {
+ switch (keyType) {
+ case 'ec':
+ const keyCurve = key.asymmetricKeyDetails.namedCurve;
+ const allowedCurve = allowedCurves[algorithm];
+
+ if (keyCurve !== allowedCurve) {
+ throw new Error(`"alg" parameter "${algorithm}" requires curve "${allowedCurve}".`);
+ }
+ break;
+
+ case 'rsa-pss':
+ if (RSA_PSS_KEY_DETAILS_SUPPORTED) {
+ const length = parseInt(algorithm.slice(-3), 10);
+ const { hashAlgorithm, mgf1HashAlgorithm, saltLength } = key.asymmetricKeyDetails;
+
+ if (hashAlgorithm !== `sha${length}` || mgf1HashAlgorithm !== hashAlgorithm) {
+ throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${algorithm}.`);
+ }
+
+ if (saltLength !== undefined && saltLength > length >> 3) {
+ throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${algorithm}.`)
+ }
+ }
+ break;
+ }
+ }
+}
diff --git a/node_modules/jsonwebtoken/node_modules/ms/index.js b/node_modules/jsonwebtoken/node_modules/ms/index.js
new file mode 100644
index 0000000..ea734fb
--- /dev/null
+++ b/node_modules/jsonwebtoken/node_modules/ms/index.js
@@ -0,0 +1,162 @@
+/**
+ * Helpers.
+ */
+
+var s = 1000;
+var m = s * 60;
+var h = m * 60;
+var d = h * 24;
+var w = d * 7;
+var y = d * 365.25;
+
+/**
+ * Parse or format the given `val`.
+ *
+ * Options:
+ *
+ * - `long` verbose formatting [false]
+ *
+ * @param {String|Number} val
+ * @param {Object} [options]
+ * @throws {Error} throw an error if val is not a non-empty string or a number
+ * @return {String|Number}
+ * @api public
+ */
+
+module.exports = function (val, options) {
+ options = options || {};
+ var type = typeof val;
+ if (type === 'string' && val.length > 0) {
+ return parse(val);
+ } else if (type === 'number' && isFinite(val)) {
+ return options.long ? fmtLong(val) : fmtShort(val);
+ }
+ throw new Error(
+ 'val is not a non-empty string or a valid number. val=' +
+ JSON.stringify(val)
+ );
+};
+
+/**
+ * Parse the given `str` and return milliseconds.
+ *
+ * @param {String} str
+ * @return {Number}
+ * @api private
+ */
+
+function parse(str) {
+ str = String(str);
+ if (str.length > 100) {
+ return;
+ }
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
+ str
+ );
+ if (!match) {
+ return;
+ }
+ var n = parseFloat(match[1]);
+ var type = (match[2] || 'ms').toLowerCase();
+ switch (type) {
+ case 'years':
+ case 'year':
+ case 'yrs':
+ case 'yr':
+ case 'y':
+ return n * y;
+ case 'weeks':
+ case 'week':
+ case 'w':
+ return n * w;
+ case 'days':
+ case 'day':
+ case 'd':
+ return n * d;
+ case 'hours':
+ case 'hour':
+ case 'hrs':
+ case 'hr':
+ case 'h':
+ return n * h;
+ case 'minutes':
+ case 'minute':
+ case 'mins':
+ case 'min':
+ case 'm':
+ return n * m;
+ case 'seconds':
+ case 'second':
+ case 'secs':
+ case 'sec':
+ case 's':
+ return n * s;
+ case 'milliseconds':
+ case 'millisecond':
+ case 'msecs':
+ case 'msec':
+ case 'ms':
+ return n;
+ default:
+ return undefined;
+ }
+}
+
+/**
+ * Short format for `ms`.
+ *
+ * @param {Number} ms
+ * @return {String}
+ * @api private
+ */
+
+function fmtShort(ms) {
+ var msAbs = Math.abs(ms);
+ if (msAbs >= d) {
+ return Math.round(ms / d) + 'd';
+ }
+ if (msAbs >= h) {
+ return Math.round(ms / h) + 'h';
+ }
+ if (msAbs >= m) {
+ return Math.round(ms / m) + 'm';
+ }
+ if (msAbs >= s) {
+ return Math.round(ms / s) + 's';
+ }
+ return ms + 'ms';
+}
+
+/**
+ * Long format for `ms`.
+ *
+ * @param {Number} ms
+ * @return {String}
+ * @api private
+ */
+
+function fmtLong(ms) {
+ var msAbs = Math.abs(ms);
+ if (msAbs >= d) {
+ return plural(ms, msAbs, d, 'day');
+ }
+ if (msAbs >= h) {
+ return plural(ms, msAbs, h, 'hour');
+ }
+ if (msAbs >= m) {
+ return plural(ms, msAbs, m, 'minute');
+ }
+ if (msAbs >= s) {
+ return plural(ms, msAbs, s, 'second');
+ }
+ return ms + ' ms';
+}
+
+/**
+ * Pluralization helper.
+ */
+
+function plural(ms, msAbs, n, name) {
+ var isPlural = msAbs >= n * 1.5;
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
+}
diff --git a/node_modules/jsonwebtoken/node_modules/ms/license.md b/node_modules/jsonwebtoken/node_modules/ms/license.md
new file mode 100644
index 0000000..fa5d39b
--- /dev/null
+++ b/node_modules/jsonwebtoken/node_modules/ms/license.md
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2020 Vercel, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/jsonwebtoken/node_modules/ms/package.json b/node_modules/jsonwebtoken/node_modules/ms/package.json
new file mode 100644
index 0000000..4997189
--- /dev/null
+++ b/node_modules/jsonwebtoken/node_modules/ms/package.json
@@ -0,0 +1,38 @@
+{
+ "name": "ms",
+ "version": "2.1.3",
+ "description": "Tiny millisecond conversion utility",
+ "repository": "vercel/ms",
+ "main": "./index",
+ "files": [
+ "index.js"
+ ],
+ "scripts": {
+ "precommit": "lint-staged",
+ "lint": "eslint lib/* bin/*",
+ "test": "mocha tests.js"
+ },
+ "eslintConfig": {
+ "extends": "eslint:recommended",
+ "env": {
+ "node": true,
+ "es6": true
+ }
+ },
+ "lint-staged": {
+ "*.js": [
+ "npm run lint",
+ "prettier --single-quote --write",
+ "git add"
+ ]
+ },
+ "license": "MIT",
+ "devDependencies": {
+ "eslint": "4.18.2",
+ "expect.js": "0.3.1",
+ "husky": "0.14.3",
+ "lint-staged": "5.0.0",
+ "mocha": "4.0.1",
+ "prettier": "2.0.5"
+ }
+}
diff --git a/node_modules/jsonwebtoken/node_modules/ms/readme.md b/node_modules/jsonwebtoken/node_modules/ms/readme.md
new file mode 100644
index 0000000..0fc1abb
--- /dev/null
+++ b/node_modules/jsonwebtoken/node_modules/ms/readme.md
@@ -0,0 +1,59 @@
+# ms
+
+
+
+Use this package to easily convert various time formats to milliseconds.
+
+## Examples
+
+```js
+ms('2 days') // 172800000
+ms('1d') // 86400000
+ms('10h') // 36000000
+ms('2.5 hrs') // 9000000
+ms('2h') // 7200000
+ms('1m') // 60000
+ms('5s') // 5000
+ms('1y') // 31557600000
+ms('100') // 100
+ms('-3 days') // -259200000
+ms('-1h') // -3600000
+ms('-200') // -200
+```
+
+### Convert from Milliseconds
+
+```js
+ms(60000) // "1m"
+ms(2 * 60000) // "2m"
+ms(-3 * 60000) // "-3m"
+ms(ms('10 hours')) // "10h"
+```
+
+### Time Format Written-Out
+
+```js
+ms(60000, { long: true }) // "1 minute"
+ms(2 * 60000, { long: true }) // "2 minutes"
+ms(-3 * 60000, { long: true }) // "-3 minutes"
+ms(ms('10 hours'), { long: true }) // "10 hours"
+```
+
+## Features
+
+- Works both in [Node.js](https://nodejs.org) and in the browser
+- If a number is supplied to `ms`, a string with a unit is returned
+- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
+- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
+
+## Related Packages
+
+- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
+
+## Caught a Bug?
+
+1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
+2. Link the package to the global module directory: `npm link`
+3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
+
+As always, you can run the tests using: `npm test`
diff --git a/node_modules/jsonwebtoken/package.json b/node_modules/jsonwebtoken/package.json
new file mode 100644
index 0000000..81f78da
--- /dev/null
+++ b/node_modules/jsonwebtoken/package.json
@@ -0,0 +1,71 @@
+{
+ "name": "jsonwebtoken",
+ "version": "9.0.2",
+ "description": "JSON Web Token implementation (symmetric and asymmetric)",
+ "main": "index.js",
+ "nyc": {
+ "check-coverage": true,
+ "lines": 95,
+ "statements": 95,
+ "functions": 100,
+ "branches": 95,
+ "exclude": [
+ "./test/**"
+ ],
+ "reporter": [
+ "json",
+ "lcov",
+ "text-summary"
+ ]
+ },
+ "scripts": {
+ "lint": "eslint .",
+ "coverage": "nyc mocha --use_strict",
+ "test": "npm run lint && npm run coverage && cost-of-modules"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/auth0/node-jsonwebtoken"
+ },
+ "keywords": [
+ "jwt"
+ ],
+ "author": "auth0",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/auth0/node-jsonwebtoken/issues"
+ },
+ "dependencies": {
+ "jws": "^3.2.2",
+ "lodash.includes": "^4.3.0",
+ "lodash.isboolean": "^3.0.3",
+ "lodash.isinteger": "^4.0.4",
+ "lodash.isnumber": "^3.0.3",
+ "lodash.isplainobject": "^4.0.6",
+ "lodash.isstring": "^4.0.1",
+ "lodash.once": "^4.0.0",
+ "ms": "^2.1.1",
+ "semver": "^7.5.4"
+ },
+ "devDependencies": {
+ "atob": "^2.1.2",
+ "chai": "^4.1.2",
+ "conventional-changelog": "~1.1.0",
+ "cost-of-modules": "^1.0.1",
+ "eslint": "^4.19.1",
+ "mocha": "^5.2.0",
+ "nsp": "^2.6.2",
+ "nyc": "^11.9.0",
+ "sinon": "^6.0.0"
+ },
+ "engines": {
+ "npm": ">=6",
+ "node": ">=12"
+ },
+ "files": [
+ "lib",
+ "decode.js",
+ "sign.js",
+ "verify.js"
+ ]
+}
diff --git a/node_modules/jsonwebtoken/sign.js b/node_modules/jsonwebtoken/sign.js
new file mode 100644
index 0000000..82bf526
--- /dev/null
+++ b/node_modules/jsonwebtoken/sign.js
@@ -0,0 +1,253 @@
+const timespan = require('./lib/timespan');
+const PS_SUPPORTED = require('./lib/psSupported');
+const validateAsymmetricKey = require('./lib/validateAsymmetricKey');
+const jws = require('jws');
+const includes = require('lodash.includes');
+const isBoolean = require('lodash.isboolean');
+const isInteger = require('lodash.isinteger');
+const isNumber = require('lodash.isnumber');
+const isPlainObject = require('lodash.isplainobject');
+const isString = require('lodash.isstring');
+const once = require('lodash.once');
+const { KeyObject, createSecretKey, createPrivateKey } = require('crypto')
+
+const SUPPORTED_ALGS = ['RS256', 'RS384', 'RS512', 'ES256', 'ES384', 'ES512', 'HS256', 'HS384', 'HS512', 'none'];
+if (PS_SUPPORTED) {
+ SUPPORTED_ALGS.splice(3, 0, 'PS256', 'PS384', 'PS512');
+}
+
+const sign_options_schema = {
+ expiresIn: { isValid: function(value) { return isInteger(value) || (isString(value) && value); }, message: '"expiresIn" should be a number of seconds or string representing a timespan' },
+ notBefore: { isValid: function(value) { return isInteger(value) || (isString(value) && value); }, message: '"notBefore" should be a number of seconds or string representing a timespan' },
+ audience: { isValid: function(value) { return isString(value) || Array.isArray(value); }, message: '"audience" must be a string or array' },
+ algorithm: { isValid: includes.bind(null, SUPPORTED_ALGS), message: '"algorithm" must be a valid string enum value' },
+ header: { isValid: isPlainObject, message: '"header" must be an object' },
+ encoding: { isValid: isString, message: '"encoding" must be a string' },
+ issuer: { isValid: isString, message: '"issuer" must be a string' },
+ subject: { isValid: isString, message: '"subject" must be a string' },
+ jwtid: { isValid: isString, message: '"jwtid" must be a string' },
+ noTimestamp: { isValid: isBoolean, message: '"noTimestamp" must be a boolean' },
+ keyid: { isValid: isString, message: '"keyid" must be a string' },
+ mutatePayload: { isValid: isBoolean, message: '"mutatePayload" must be a boolean' },
+ allowInsecureKeySizes: { isValid: isBoolean, message: '"allowInsecureKeySizes" must be a boolean'},
+ allowInvalidAsymmetricKeyTypes: { isValid: isBoolean, message: '"allowInvalidAsymmetricKeyTypes" must be a boolean'}
+};
+
+const registered_claims_schema = {
+ iat: { isValid: isNumber, message: '"iat" should be a number of seconds' },
+ exp: { isValid: isNumber, message: '"exp" should be a number of seconds' },
+ nbf: { isValid: isNumber, message: '"nbf" should be a number of seconds' }
+};
+
+function validate(schema, allowUnknown, object, parameterName) {
+ if (!isPlainObject(object)) {
+ throw new Error('Expected "' + parameterName + '" to be a plain object.');
+ }
+ Object.keys(object)
+ .forEach(function(key) {
+ const validator = schema[key];
+ if (!validator) {
+ if (!allowUnknown) {
+ throw new Error('"' + key + '" is not allowed in "' + parameterName + '"');
+ }
+ return;
+ }
+ if (!validator.isValid(object[key])) {
+ throw new Error(validator.message);
+ }
+ });
+}
+
+function validateOptions(options) {
+ return validate(sign_options_schema, false, options, 'options');
+}
+
+function validatePayload(payload) {
+ return validate(registered_claims_schema, true, payload, 'payload');
+}
+
+const options_to_payload = {
+ 'audience': 'aud',
+ 'issuer': 'iss',
+ 'subject': 'sub',
+ 'jwtid': 'jti'
+};
+
+const options_for_objects = [
+ 'expiresIn',
+ 'notBefore',
+ 'noTimestamp',
+ 'audience',
+ 'issuer',
+ 'subject',
+ 'jwtid',
+];
+
+module.exports = function (payload, secretOrPrivateKey, options, callback) {
+ if (typeof options === 'function') {
+ callback = options;
+ options = {};
+ } else {
+ options = options || {};
+ }
+
+ const isObjectPayload = typeof payload === 'object' &&
+ !Buffer.isBuffer(payload);
+
+ const header = Object.assign({
+ alg: options.algorithm || 'HS256',
+ typ: isObjectPayload ? 'JWT' : undefined,
+ kid: options.keyid
+ }, options.header);
+
+ function failure(err) {
+ if (callback) {
+ return callback(err);
+ }
+ throw err;
+ }
+
+ if (!secretOrPrivateKey && options.algorithm !== 'none') {
+ return failure(new Error('secretOrPrivateKey must have a value'));
+ }
+
+ if (secretOrPrivateKey != null && !(secretOrPrivateKey instanceof KeyObject)) {
+ try {
+ secretOrPrivateKey = createPrivateKey(secretOrPrivateKey)
+ } catch (_) {
+ try {
+ secretOrPrivateKey = createSecretKey(typeof secretOrPrivateKey === 'string' ? Buffer.from(secretOrPrivateKey) : secretOrPrivateKey)
+ } catch (_) {
+ return failure(new Error('secretOrPrivateKey is not valid key material'));
+ }
+ }
+ }
+
+ if (header.alg.startsWith('HS') && secretOrPrivateKey.type !== 'secret') {
+ return failure(new Error((`secretOrPrivateKey must be a symmetric key when using ${header.alg}`)))
+ } else if (/^(?:RS|PS|ES)/.test(header.alg)) {
+ if (secretOrPrivateKey.type !== 'private') {
+ return failure(new Error((`secretOrPrivateKey must be an asymmetric key when using ${header.alg}`)))
+ }
+ if (!options.allowInsecureKeySizes &&
+ !header.alg.startsWith('ES') &&
+ secretOrPrivateKey.asymmetricKeyDetails !== undefined && //KeyObject.asymmetricKeyDetails is supported in Node 15+
+ secretOrPrivateKey.asymmetricKeyDetails.modulusLength < 2048) {
+ return failure(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`));
+ }
+ }
+
+ if (typeof payload === 'undefined') {
+ return failure(new Error('payload is required'));
+ } else if (isObjectPayload) {
+ try {
+ validatePayload(payload);
+ }
+ catch (error) {
+ return failure(error);
+ }
+ if (!options.mutatePayload) {
+ payload = Object.assign({},payload);
+ }
+ } else {
+ const invalid_options = options_for_objects.filter(function (opt) {
+ return typeof options[opt] !== 'undefined';
+ });
+
+ if (invalid_options.length > 0) {
+ return failure(new Error('invalid ' + invalid_options.join(',') + ' option for ' + (typeof payload ) + ' payload'));
+ }
+ }
+
+ if (typeof payload.exp !== 'undefined' && typeof options.expiresIn !== 'undefined') {
+ return failure(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));
+ }
+
+ if (typeof payload.nbf !== 'undefined' && typeof options.notBefore !== 'undefined') {
+ return failure(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));
+ }
+
+ try {
+ validateOptions(options);
+ }
+ catch (error) {
+ return failure(error);
+ }
+
+ if (!options.allowInvalidAsymmetricKeyTypes) {
+ try {
+ validateAsymmetricKey(header.alg, secretOrPrivateKey);
+ } catch (error) {
+ return failure(error);
+ }
+ }
+
+ const timestamp = payload.iat || Math.floor(Date.now() / 1000);
+
+ if (options.noTimestamp) {
+ delete payload.iat;
+ } else if (isObjectPayload) {
+ payload.iat = timestamp;
+ }
+
+ if (typeof options.notBefore !== 'undefined') {
+ try {
+ payload.nbf = timespan(options.notBefore, timestamp);
+ }
+ catch (err) {
+ return failure(err);
+ }
+ if (typeof payload.nbf === 'undefined') {
+ return failure(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
+ }
+ }
+
+ if (typeof options.expiresIn !== 'undefined' && typeof payload === 'object') {
+ try {
+ payload.exp = timespan(options.expiresIn, timestamp);
+ }
+ catch (err) {
+ return failure(err);
+ }
+ if (typeof payload.exp === 'undefined') {
+ return failure(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
+ }
+ }
+
+ Object.keys(options_to_payload).forEach(function (key) {
+ const claim = options_to_payload[key];
+ if (typeof options[key] !== 'undefined') {
+ if (typeof payload[claim] !== 'undefined') {
+ return failure(new Error('Bad "options.' + key + '" option. The payload already has an "' + claim + '" property.'));
+ }
+ payload[claim] = options[key];
+ }
+ });
+
+ const encoding = options.encoding || 'utf8';
+
+ if (typeof callback === 'function') {
+ callback = callback && once(callback);
+
+ jws.createSign({
+ header: header,
+ privateKey: secretOrPrivateKey,
+ payload: payload,
+ encoding: encoding
+ }).once('error', callback)
+ .once('done', function (signature) {
+ // TODO: Remove in favor of the modulus length check before signing once node 15+ is the minimum supported version
+ if(!options.allowInsecureKeySizes && /^(?:RS|PS)/.test(header.alg) && signature.length < 256) {
+ return callback(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`))
+ }
+ callback(null, signature);
+ });
+ } else {
+ let signature = jws.sign({header: header, payload: payload, secret: secretOrPrivateKey, encoding: encoding});
+ // TODO: Remove in favor of the modulus length check before signing once node 15+ is the minimum supported version
+ if(!options.allowInsecureKeySizes && /^(?:RS|PS)/.test(header.alg) && signature.length < 256) {
+ throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`)
+ }
+ return signature
+ }
+};
diff --git a/node_modules/jsonwebtoken/verify.js b/node_modules/jsonwebtoken/verify.js
new file mode 100644
index 0000000..cdbfdc4
--- /dev/null
+++ b/node_modules/jsonwebtoken/verify.js
@@ -0,0 +1,263 @@
+const JsonWebTokenError = require('./lib/JsonWebTokenError');
+const NotBeforeError = require('./lib/NotBeforeError');
+const TokenExpiredError = require('./lib/TokenExpiredError');
+const decode = require('./decode');
+const timespan = require('./lib/timespan');
+const validateAsymmetricKey = require('./lib/validateAsymmetricKey');
+const PS_SUPPORTED = require('./lib/psSupported');
+const jws = require('jws');
+const {KeyObject, createSecretKey, createPublicKey} = require("crypto");
+
+const PUB_KEY_ALGS = ['RS256', 'RS384', 'RS512'];
+const EC_KEY_ALGS = ['ES256', 'ES384', 'ES512'];
+const RSA_KEY_ALGS = ['RS256', 'RS384', 'RS512'];
+const HS_ALGS = ['HS256', 'HS384', 'HS512'];
+
+if (PS_SUPPORTED) {
+ PUB_KEY_ALGS.splice(PUB_KEY_ALGS.length, 0, 'PS256', 'PS384', 'PS512');
+ RSA_KEY_ALGS.splice(RSA_KEY_ALGS.length, 0, 'PS256', 'PS384', 'PS512');
+}
+
+module.exports = function (jwtString, secretOrPublicKey, options, callback) {
+ if ((typeof options === 'function') && !callback) {
+ callback = options;
+ options = {};
+ }
+
+ if (!options) {
+ options = {};
+ }
+
+ //clone this object since we are going to mutate it.
+ options = Object.assign({}, options);
+
+ let done;
+
+ if (callback) {
+ done = callback;
+ } else {
+ done = function(err, data) {
+ if (err) throw err;
+ return data;
+ };
+ }
+
+ if (options.clockTimestamp && typeof options.clockTimestamp !== 'number') {
+ return done(new JsonWebTokenError('clockTimestamp must be a number'));
+ }
+
+ if (options.nonce !== undefined && (typeof options.nonce !== 'string' || options.nonce.trim() === '')) {
+ return done(new JsonWebTokenError('nonce must be a non-empty string'));
+ }
+
+ if (options.allowInvalidAsymmetricKeyTypes !== undefined && typeof options.allowInvalidAsymmetricKeyTypes !== 'boolean') {
+ return done(new JsonWebTokenError('allowInvalidAsymmetricKeyTypes must be a boolean'));
+ }
+
+ const clockTimestamp = options.clockTimestamp || Math.floor(Date.now() / 1000);
+
+ if (!jwtString){
+ return done(new JsonWebTokenError('jwt must be provided'));
+ }
+
+ if (typeof jwtString !== 'string') {
+ return done(new JsonWebTokenError('jwt must be a string'));
+ }
+
+ const parts = jwtString.split('.');
+
+ if (parts.length !== 3){
+ return done(new JsonWebTokenError('jwt malformed'));
+ }
+
+ let decodedToken;
+
+ try {
+ decodedToken = decode(jwtString, { complete: true });
+ } catch(err) {
+ return done(err);
+ }
+
+ if (!decodedToken) {
+ return done(new JsonWebTokenError('invalid token'));
+ }
+
+ const header = decodedToken.header;
+ let getSecret;
+
+ if(typeof secretOrPublicKey === 'function') {
+ if(!callback) {
+ return done(new JsonWebTokenError('verify must be called asynchronous if secret or public key is provided as a callback'));
+ }
+
+ getSecret = secretOrPublicKey;
+ }
+ else {
+ getSecret = function(header, secretCallback) {
+ return secretCallback(null, secretOrPublicKey);
+ };
+ }
+
+ return getSecret(header, function(err, secretOrPublicKey) {
+ if(err) {
+ return done(new JsonWebTokenError('error in secret or public key callback: ' + err.message));
+ }
+
+ const hasSignature = parts[2].trim() !== '';
+
+ if (!hasSignature && secretOrPublicKey){
+ return done(new JsonWebTokenError('jwt signature is required'));
+ }
+
+ if (hasSignature && !secretOrPublicKey) {
+ return done(new JsonWebTokenError('secret or public key must be provided'));
+ }
+
+ if (!hasSignature && !options.algorithms) {
+ return done(new JsonWebTokenError('please specify "none" in "algorithms" to verify unsigned tokens'));
+ }
+
+ if (secretOrPublicKey != null && !(secretOrPublicKey instanceof KeyObject)) {
+ try {
+ secretOrPublicKey = createPublicKey(secretOrPublicKey);
+ } catch (_) {
+ try {
+ secretOrPublicKey = createSecretKey(typeof secretOrPublicKey === 'string' ? Buffer.from(secretOrPublicKey) : secretOrPublicKey);
+ } catch (_) {
+ return done(new JsonWebTokenError('secretOrPublicKey is not valid key material'))
+ }
+ }
+ }
+
+ if (!options.algorithms) {
+ if (secretOrPublicKey.type === 'secret') {
+ options.algorithms = HS_ALGS;
+ } else if (['rsa', 'rsa-pss'].includes(secretOrPublicKey.asymmetricKeyType)) {
+ options.algorithms = RSA_KEY_ALGS
+ } else if (secretOrPublicKey.asymmetricKeyType === 'ec') {
+ options.algorithms = EC_KEY_ALGS
+ } else {
+ options.algorithms = PUB_KEY_ALGS
+ }
+ }
+
+ if (options.algorithms.indexOf(decodedToken.header.alg) === -1) {
+ return done(new JsonWebTokenError('invalid algorithm'));
+ }
+
+ if (header.alg.startsWith('HS') && secretOrPublicKey.type !== 'secret') {
+ return done(new JsonWebTokenError((`secretOrPublicKey must be a symmetric key when using ${header.alg}`)))
+ } else if (/^(?:RS|PS|ES)/.test(header.alg) && secretOrPublicKey.type !== 'public') {
+ return done(new JsonWebTokenError((`secretOrPublicKey must be an asymmetric key when using ${header.alg}`)))
+ }
+
+ if (!options.allowInvalidAsymmetricKeyTypes) {
+ try {
+ validateAsymmetricKey(header.alg, secretOrPublicKey);
+ } catch (e) {
+ return done(e);
+ }
+ }
+
+ let valid;
+
+ try {
+ valid = jws.verify(jwtString, decodedToken.header.alg, secretOrPublicKey);
+ } catch (e) {
+ return done(e);
+ }
+
+ if (!valid) {
+ return done(new JsonWebTokenError('invalid signature'));
+ }
+
+ const payload = decodedToken.payload;
+
+ if (typeof payload.nbf !== 'undefined' && !options.ignoreNotBefore) {
+ if (typeof payload.nbf !== 'number') {
+ return done(new JsonWebTokenError('invalid nbf value'));
+ }
+ if (payload.nbf > clockTimestamp + (options.clockTolerance || 0)) {
+ return done(new NotBeforeError('jwt not active', new Date(payload.nbf * 1000)));
+ }
+ }
+
+ if (typeof payload.exp !== 'undefined' && !options.ignoreExpiration) {
+ if (typeof payload.exp !== 'number') {
+ return done(new JsonWebTokenError('invalid exp value'));
+ }
+ if (clockTimestamp >= payload.exp + (options.clockTolerance || 0)) {
+ return done(new TokenExpiredError('jwt expired', new Date(payload.exp * 1000)));
+ }
+ }
+
+ if (options.audience) {
+ const audiences = Array.isArray(options.audience) ? options.audience : [options.audience];
+ const target = Array.isArray(payload.aud) ? payload.aud : [payload.aud];
+
+ const match = target.some(function (targetAudience) {
+ return audiences.some(function (audience) {
+ return audience instanceof RegExp ? audience.test(targetAudience) : audience === targetAudience;
+ });
+ });
+
+ if (!match) {
+ return done(new JsonWebTokenError('jwt audience invalid. expected: ' + audiences.join(' or ')));
+ }
+ }
+
+ if (options.issuer) {
+ const invalid_issuer =
+ (typeof options.issuer === 'string' && payload.iss !== options.issuer) ||
+ (Array.isArray(options.issuer) && options.issuer.indexOf(payload.iss) === -1);
+
+ if (invalid_issuer) {
+ return done(new JsonWebTokenError('jwt issuer invalid. expected: ' + options.issuer));
+ }
+ }
+
+ if (options.subject) {
+ if (payload.sub !== options.subject) {
+ return done(new JsonWebTokenError('jwt subject invalid. expected: ' + options.subject));
+ }
+ }
+
+ if (options.jwtid) {
+ if (payload.jti !== options.jwtid) {
+ return done(new JsonWebTokenError('jwt jwtid invalid. expected: ' + options.jwtid));
+ }
+ }
+
+ if (options.nonce) {
+ if (payload.nonce !== options.nonce) {
+ return done(new JsonWebTokenError('jwt nonce invalid. expected: ' + options.nonce));
+ }
+ }
+
+ if (options.maxAge) {
+ if (typeof payload.iat !== 'number') {
+ return done(new JsonWebTokenError('iat required when maxAge is specified'));
+ }
+
+ const maxAgeTimestamp = timespan(options.maxAge, payload.iat);
+ if (typeof maxAgeTimestamp === 'undefined') {
+ return done(new JsonWebTokenError('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
+ }
+ if (clockTimestamp >= maxAgeTimestamp + (options.clockTolerance || 0)) {
+ return done(new TokenExpiredError('maxAge exceeded', new Date(maxAgeTimestamp * 1000)));
+ }
+ }
+
+ if (options.complete === true) {
+ const signature = decodedToken.signature;
+
+ return done(null, {
+ header: header,
+ payload: payload,
+ signature: signature
+ });
+ }
+
+ return done(null, payload);
+ });
+};
diff --git a/node_modules/jwa/LICENSE b/node_modules/jwa/LICENSE
new file mode 100644
index 0000000..caeb849
--- /dev/null
+++ b/node_modules/jwa/LICENSE
@@ -0,0 +1,17 @@
+Copyright (c) 2013 Brian J. Brennan
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
+Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/jwa/README.md b/node_modules/jwa/README.md
new file mode 100644
index 0000000..fb433e2
--- /dev/null
+++ b/node_modules/jwa/README.md
@@ -0,0 +1,150 @@
+# node-jwa [](https://travis-ci.org/brianloveswords/node-jwa)
+
+A
+[JSON Web Algorithms](http://tools.ietf.org/id/draft-ietf-jose-json-web-algorithms-08.html)
+implementation focusing (exclusively, at this point) on the algorithms necessary for
+[JSON Web Signatures](http://self-issued.info/docs/draft-ietf-jose-json-web-signature.html).
+
+This library supports all of the required, recommended and optional cryptographic algorithms for JWS:
+
+alg Parameter Value | Digital Signature or MAC Algorithm
+----------------|----------------------------
+HS256 | HMAC using SHA-256 hash algorithm
+HS384 | HMAC using SHA-384 hash algorithm
+HS512 | HMAC using SHA-512 hash algorithm
+RS256 | RSASSA using SHA-256 hash algorithm
+RS384 | RSASSA using SHA-384 hash algorithm
+RS512 | RSASSA using SHA-512 hash algorithm
+PS256 | RSASSA-PSS using SHA-256 hash algorithm
+PS384 | RSASSA-PSS using SHA-384 hash algorithm
+PS512 | RSASSA-PSS using SHA-512 hash algorithm
+ES256 | ECDSA using P-256 curve and SHA-256 hash algorithm
+ES384 | ECDSA using P-384 curve and SHA-384 hash algorithm
+ES512 | ECDSA using P-521 curve and SHA-512 hash algorithm
+none | No digital signature or MAC value included
+
+Please note that PS* only works on Node 6.12+ (excluding 7.x).
+
+# Requirements
+
+In order to run the tests, a recent version of OpenSSL is
+required. **The version that comes with OS X (OpenSSL 0.9.8r 8 Feb
+2011) is not recent enough**, as it does not fully support ECDSA
+keys. You'll need to use a version > 1.0.0; I tested with OpenSSL 1.0.1c 10 May 2012.
+
+# Testing
+
+To run the tests, do
+
+```bash
+$ npm test
+```
+
+This will generate a bunch of keypairs to use in testing. If you want to
+generate new keypairs, do `make clean` before running `npm test` again.
+
+## Methodology
+
+I spawn `openssl dgst -sign` to test OpenSSL sign → JS verify and
+`openssl dgst -verify` to test JS sign → OpenSSL verify for each of the
+RSA and ECDSA algorithms.
+
+# Usage
+
+## jwa(algorithm)
+
+Creates a new `jwa` object with `sign` and `verify` methods for the
+algorithm. Valid values for algorithm can be found in the table above
+(`'HS256'`, `'HS384'`, etc) and are case-insensitive. Passing an invalid
+algorithm value will throw a `TypeError`.
+
+
+## jwa#sign(input, secretOrPrivateKey)
+
+Sign some input with either a secret for HMAC algorithms, or a private
+key for RSA and ECDSA algorithms.
+
+If input is not already a string or buffer, `JSON.stringify` will be
+called on it to attempt to coerce it.
+
+For the HMAC algorithm, `secretOrPrivateKey` should be a string or a
+buffer. For ECDSA and RSA, the value should be a string representing a
+PEM encoded **private** key.
+
+Output [base64url](http://en.wikipedia.org/wiki/Base64#URL_applications)
+formatted. This is for convenience as JWS expects the signature in this
+format. If your application needs the output in a different format,
+[please open an issue](https://github.com/brianloveswords/node-jwa/issues). In
+the meantime, you can use
+[brianloveswords/base64url](https://github.com/brianloveswords/base64url)
+to decode the signature.
+
+As of nodejs *v0.11.8*, SPKAC support was introduce. If your nodeJs
+version satisfies, then you can pass an object `{ key: '..', passphrase: '...' }`
+
+
+## jwa#verify(input, signature, secretOrPublicKey)
+
+Verify a signature. Returns `true` or `false`.
+
+`signature` should be a base64url encoded string.
+
+For the HMAC algorithm, `secretOrPublicKey` should be a string or a
+buffer. For ECDSA and RSA, the value should be a string represented a
+PEM encoded **public** key.
+
+
+# Example
+
+HMAC
+```js
+const jwa = require('jwa');
+
+const hmac = jwa('HS256');
+const input = 'super important stuff';
+const secret = 'shhhhhh';
+
+const signature = hmac.sign(input, secret);
+hmac.verify(input, signature, secret) // === true
+hmac.verify(input, signature, 'trickery!') // === false
+```
+
+With keys
+```js
+const fs = require('fs');
+const jwa = require('jwa');
+const privateKey = fs.readFileSync(__dirname + '/ecdsa-p521-private.pem');
+const publicKey = fs.readFileSync(__dirname + '/ecdsa-p521-public.pem');
+
+const ecdsa = jwa('ES512');
+const input = 'very important stuff';
+
+const signature = ecdsa.sign(input, privateKey);
+ecdsa.verify(input, signature, publicKey) // === true
+```
+## License
+
+MIT
+
+```
+Copyright (c) 2013 Brian J. Brennan
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+```
diff --git a/node_modules/jwa/index.js b/node_modules/jwa/index.js
new file mode 100644
index 0000000..e71e6d1
--- /dev/null
+++ b/node_modules/jwa/index.js
@@ -0,0 +1,252 @@
+var bufferEqual = require('buffer-equal-constant-time');
+var Buffer = require('safe-buffer').Buffer;
+var crypto = require('crypto');
+var formatEcdsa = require('ecdsa-sig-formatter');
+var util = require('util');
+
+var MSG_INVALID_ALGORITHM = '"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".'
+var MSG_INVALID_SECRET = 'secret must be a string or buffer';
+var MSG_INVALID_VERIFIER_KEY = 'key must be a string or a buffer';
+var MSG_INVALID_SIGNER_KEY = 'key must be a string, a buffer or an object';
+
+var supportsKeyObjects = typeof crypto.createPublicKey === 'function';
+if (supportsKeyObjects) {
+ MSG_INVALID_VERIFIER_KEY += ' or a KeyObject';
+ MSG_INVALID_SECRET += 'or a KeyObject';
+}
+
+function checkIsPublicKey(key) {
+ if (Buffer.isBuffer(key)) {
+ return;
+ }
+
+ if (typeof key === 'string') {
+ return;
+ }
+
+ if (!supportsKeyObjects) {
+ throw typeError(MSG_INVALID_VERIFIER_KEY);
+ }
+
+ if (typeof key !== 'object') {
+ throw typeError(MSG_INVALID_VERIFIER_KEY);
+ }
+
+ if (typeof key.type !== 'string') {
+ throw typeError(MSG_INVALID_VERIFIER_KEY);
+ }
+
+ if (typeof key.asymmetricKeyType !== 'string') {
+ throw typeError(MSG_INVALID_VERIFIER_KEY);
+ }
+
+ if (typeof key.export !== 'function') {
+ throw typeError(MSG_INVALID_VERIFIER_KEY);
+ }
+};
+
+function checkIsPrivateKey(key) {
+ if (Buffer.isBuffer(key)) {
+ return;
+ }
+
+ if (typeof key === 'string') {
+ return;
+ }
+
+ if (typeof key === 'object') {
+ return;
+ }
+
+ throw typeError(MSG_INVALID_SIGNER_KEY);
+};
+
+function checkIsSecretKey(key) {
+ if (Buffer.isBuffer(key)) {
+ return;
+ }
+
+ if (typeof key === 'string') {
+ return key;
+ }
+
+ if (!supportsKeyObjects) {
+ throw typeError(MSG_INVALID_SECRET);
+ }
+
+ if (typeof key !== 'object') {
+ throw typeError(MSG_INVALID_SECRET);
+ }
+
+ if (key.type !== 'secret') {
+ throw typeError(MSG_INVALID_SECRET);
+ }
+
+ if (typeof key.export !== 'function') {
+ throw typeError(MSG_INVALID_SECRET);
+ }
+}
+
+function fromBase64(base64) {
+ return base64
+ .replace(/=/g, '')
+ .replace(/\+/g, '-')
+ .replace(/\//g, '_');
+}
+
+function toBase64(base64url) {
+ base64url = base64url.toString();
+
+ var padding = 4 - base64url.length % 4;
+ if (padding !== 4) {
+ for (var i = 0; i < padding; ++i) {
+ base64url += '=';
+ }
+ }
+
+ return base64url
+ .replace(/\-/g, '+')
+ .replace(/_/g, '/');
+}
+
+function typeError(template) {
+ var args = [].slice.call(arguments, 1);
+ var errMsg = util.format.bind(util, template).apply(null, args);
+ return new TypeError(errMsg);
+}
+
+function bufferOrString(obj) {
+ return Buffer.isBuffer(obj) || typeof obj === 'string';
+}
+
+function normalizeInput(thing) {
+ if (!bufferOrString(thing))
+ thing = JSON.stringify(thing);
+ return thing;
+}
+
+function createHmacSigner(bits) {
+ return function sign(thing, secret) {
+ checkIsSecretKey(secret);
+ thing = normalizeInput(thing);
+ var hmac = crypto.createHmac('sha' + bits, secret);
+ var sig = (hmac.update(thing), hmac.digest('base64'))
+ return fromBase64(sig);
+ }
+}
+
+function createHmacVerifier(bits) {
+ return function verify(thing, signature, secret) {
+ var computedSig = createHmacSigner(bits)(thing, secret);
+ return bufferEqual(Buffer.from(signature), Buffer.from(computedSig));
+ }
+}
+
+function createKeySigner(bits) {
+ return function sign(thing, privateKey) {
+ checkIsPrivateKey(privateKey);
+ thing = normalizeInput(thing);
+ // Even though we are specifying "RSA" here, this works with ECDSA
+ // keys as well.
+ var signer = crypto.createSign('RSA-SHA' + bits);
+ var sig = (signer.update(thing), signer.sign(privateKey, 'base64'));
+ return fromBase64(sig);
+ }
+}
+
+function createKeyVerifier(bits) {
+ return function verify(thing, signature, publicKey) {
+ checkIsPublicKey(publicKey);
+ thing = normalizeInput(thing);
+ signature = toBase64(signature);
+ var verifier = crypto.createVerify('RSA-SHA' + bits);
+ verifier.update(thing);
+ return verifier.verify(publicKey, signature, 'base64');
+ }
+}
+
+function createPSSKeySigner(bits) {
+ return function sign(thing, privateKey) {
+ checkIsPrivateKey(privateKey);
+ thing = normalizeInput(thing);
+ var signer = crypto.createSign('RSA-SHA' + bits);
+ var sig = (signer.update(thing), signer.sign({
+ key: privateKey,
+ padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
+ saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST
+ }, 'base64'));
+ return fromBase64(sig);
+ }
+}
+
+function createPSSKeyVerifier(bits) {
+ return function verify(thing, signature, publicKey) {
+ checkIsPublicKey(publicKey);
+ thing = normalizeInput(thing);
+ signature = toBase64(signature);
+ var verifier = crypto.createVerify('RSA-SHA' + bits);
+ verifier.update(thing);
+ return verifier.verify({
+ key: publicKey,
+ padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
+ saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST
+ }, signature, 'base64');
+ }
+}
+
+function createECDSASigner(bits) {
+ var inner = createKeySigner(bits);
+ return function sign() {
+ var signature = inner.apply(null, arguments);
+ signature = formatEcdsa.derToJose(signature, 'ES' + bits);
+ return signature;
+ };
+}
+
+function createECDSAVerifer(bits) {
+ var inner = createKeyVerifier(bits);
+ return function verify(thing, signature, publicKey) {
+ signature = formatEcdsa.joseToDer(signature, 'ES' + bits).toString('base64');
+ var result = inner(thing, signature, publicKey);
+ return result;
+ };
+}
+
+function createNoneSigner() {
+ return function sign() {
+ return '';
+ }
+}
+
+function createNoneVerifier() {
+ return function verify(thing, signature) {
+ return signature === '';
+ }
+}
+
+module.exports = function jwa(algorithm) {
+ var signerFactories = {
+ hs: createHmacSigner,
+ rs: createKeySigner,
+ ps: createPSSKeySigner,
+ es: createECDSASigner,
+ none: createNoneSigner,
+ }
+ var verifierFactories = {
+ hs: createHmacVerifier,
+ rs: createKeyVerifier,
+ ps: createPSSKeyVerifier,
+ es: createECDSAVerifer,
+ none: createNoneVerifier,
+ }
+ var match = algorithm.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/i);
+ if (!match)
+ throw typeError(MSG_INVALID_ALGORITHM, algorithm);
+ var algo = (match[1] || match[3]).toLowerCase();
+ var bits = match[2];
+
+ return {
+ sign: signerFactories[algo](bits),
+ verify: verifierFactories[algo](bits),
+ }
+};
diff --git a/node_modules/jwa/package.json b/node_modules/jwa/package.json
new file mode 100644
index 0000000..0777d53
--- /dev/null
+++ b/node_modules/jwa/package.json
@@ -0,0 +1,37 @@
+{
+ "name": "jwa",
+ "version": "1.4.1",
+ "description": "JWA implementation (supports all JWS algorithms)",
+ "main": "index.js",
+ "directories": {
+ "test": "test"
+ },
+ "dependencies": {
+ "buffer-equal-constant-time": "1.0.1",
+ "ecdsa-sig-formatter": "1.0.11",
+ "safe-buffer": "^5.0.1"
+ },
+ "devDependencies": {
+ "base64url": "^2.0.0",
+ "jwk-to-pem": "^2.0.1",
+ "semver": "4.3.6",
+ "tap": "6.2.0"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/brianloveswords/node-jwa.git"
+ },
+ "keywords": [
+ "jwa",
+ "jws",
+ "jwt",
+ "rsa",
+ "ecdsa",
+ "hmac"
+ ],
+ "author": "Brian J. Brennan ",
+ "license": "MIT"
+}
diff --git a/node_modules/jws/CHANGELOG.md b/node_modules/jws/CHANGELOG.md
new file mode 100644
index 0000000..af8fc28
--- /dev/null
+++ b/node_modules/jws/CHANGELOG.md
@@ -0,0 +1,34 @@
+# Change Log
+All notable changes to this project will be documented in this file.
+
+## [3.0.0]
+### Changed
+- **BREAKING**: `jwt.verify` now requires an `algorithm` parameter, and
+ `jws.createVerify` requires an `algorithm` option. The `"alg"` field
+ signature headers is ignored. This mitigates a critical security flaw
+ in the library which would allow an attacker to generate signatures with
+ arbitrary contents that would be accepted by `jwt.verify`. See
+ https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/
+ for details.
+
+## [2.0.0] - 2015-01-30
+### Changed
+- **BREAKING**: Default payload encoding changed from `binary` to
+ `utf8`. `utf8` is a is a more sensible default than `binary` because
+ many payloads, as far as I can tell, will contain user-facing
+ strings that could be in any language. ([6b6de48])
+
+- Code reorganization, thanks [@fearphage]! ([7880050])
+
+### Added
+- Option in all relevant methods for `encoding`. For those few users
+ that might be depending on a `binary` encoding of the messages, this
+ is for them. ([6b6de48])
+
+[unreleased]: https://github.com/brianloveswords/node-jws/compare/v2.0.0...HEAD
+[2.0.0]: https://github.com/brianloveswords/node-jws/compare/v1.0.1...v2.0.0
+
+[7880050]: https://github.com/brianloveswords/node-jws/commit/7880050
+[6b6de48]: https://github.com/brianloveswords/node-jws/commit/6b6de48
+
+[@fearphage]: https://github.com/fearphage
diff --git a/node_modules/jws/LICENSE b/node_modules/jws/LICENSE
new file mode 100644
index 0000000..caeb849
--- /dev/null
+++ b/node_modules/jws/LICENSE
@@ -0,0 +1,17 @@
+Copyright (c) 2013 Brian J. Brennan
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
+Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/jws/index.js b/node_modules/jws/index.js
new file mode 100644
index 0000000..8c8da93
--- /dev/null
+++ b/node_modules/jws/index.js
@@ -0,0 +1,22 @@
+/*global exports*/
+var SignStream = require('./lib/sign-stream');
+var VerifyStream = require('./lib/verify-stream');
+
+var ALGORITHMS = [
+ 'HS256', 'HS384', 'HS512',
+ 'RS256', 'RS384', 'RS512',
+ 'PS256', 'PS384', 'PS512',
+ 'ES256', 'ES384', 'ES512'
+];
+
+exports.ALGORITHMS = ALGORITHMS;
+exports.sign = SignStream.sign;
+exports.verify = VerifyStream.verify;
+exports.decode = VerifyStream.decode;
+exports.isValid = VerifyStream.isValid;
+exports.createSign = function createSign(opts) {
+ return new SignStream(opts);
+};
+exports.createVerify = function createVerify(opts) {
+ return new VerifyStream(opts);
+};
diff --git a/node_modules/jws/lib/data-stream.js b/node_modules/jws/lib/data-stream.js
new file mode 100644
index 0000000..3535d31
--- /dev/null
+++ b/node_modules/jws/lib/data-stream.js
@@ -0,0 +1,55 @@
+/*global module, process*/
+var Buffer = require('safe-buffer').Buffer;
+var Stream = require('stream');
+var util = require('util');
+
+function DataStream(data) {
+ this.buffer = null;
+ this.writable = true;
+ this.readable = true;
+
+ // No input
+ if (!data) {
+ this.buffer = Buffer.alloc(0);
+ return this;
+ }
+
+ // Stream
+ if (typeof data.pipe === 'function') {
+ this.buffer = Buffer.alloc(0);
+ data.pipe(this);
+ return this;
+ }
+
+ // Buffer or String
+ // or Object (assumedly a passworded key)
+ if (data.length || typeof data === 'object') {
+ this.buffer = data;
+ this.writable = false;
+ process.nextTick(function () {
+ this.emit('end', data);
+ this.readable = false;
+ this.emit('close');
+ }.bind(this));
+ return this;
+ }
+
+ throw new TypeError('Unexpected data type ('+ typeof data + ')');
+}
+util.inherits(DataStream, Stream);
+
+DataStream.prototype.write = function write(data) {
+ this.buffer = Buffer.concat([this.buffer, Buffer.from(data)]);
+ this.emit('data', data);
+};
+
+DataStream.prototype.end = function end(data) {
+ if (data)
+ this.write(data);
+ this.emit('end', data);
+ this.emit('close');
+ this.writable = false;
+ this.readable = false;
+};
+
+module.exports = DataStream;
diff --git a/node_modules/jws/lib/sign-stream.js b/node_modules/jws/lib/sign-stream.js
new file mode 100644
index 0000000..6a7ee42
--- /dev/null
+++ b/node_modules/jws/lib/sign-stream.js
@@ -0,0 +1,78 @@
+/*global module*/
+var Buffer = require('safe-buffer').Buffer;
+var DataStream = require('./data-stream');
+var jwa = require('jwa');
+var Stream = require('stream');
+var toString = require('./tostring');
+var util = require('util');
+
+function base64url(string, encoding) {
+ return Buffer
+ .from(string, encoding)
+ .toString('base64')
+ .replace(/=/g, '')
+ .replace(/\+/g, '-')
+ .replace(/\//g, '_');
+}
+
+function jwsSecuredInput(header, payload, encoding) {
+ encoding = encoding || 'utf8';
+ var encodedHeader = base64url(toString(header), 'binary');
+ var encodedPayload = base64url(toString(payload), encoding);
+ return util.format('%s.%s', encodedHeader, encodedPayload);
+}
+
+function jwsSign(opts) {
+ var header = opts.header;
+ var payload = opts.payload;
+ var secretOrKey = opts.secret || opts.privateKey;
+ var encoding = opts.encoding;
+ var algo = jwa(header.alg);
+ var securedInput = jwsSecuredInput(header, payload, encoding);
+ var signature = algo.sign(securedInput, secretOrKey);
+ return util.format('%s.%s', securedInput, signature);
+}
+
+function SignStream(opts) {
+ var secret = opts.secret||opts.privateKey||opts.key;
+ var secretStream = new DataStream(secret);
+ this.readable = true;
+ this.header = opts.header;
+ this.encoding = opts.encoding;
+ this.secret = this.privateKey = this.key = secretStream;
+ this.payload = new DataStream(opts.payload);
+ this.secret.once('close', function () {
+ if (!this.payload.writable && this.readable)
+ this.sign();
+ }.bind(this));
+
+ this.payload.once('close', function () {
+ if (!this.secret.writable && this.readable)
+ this.sign();
+ }.bind(this));
+}
+util.inherits(SignStream, Stream);
+
+SignStream.prototype.sign = function sign() {
+ try {
+ var signature = jwsSign({
+ header: this.header,
+ payload: this.payload.buffer,
+ secret: this.secret.buffer,
+ encoding: this.encoding
+ });
+ this.emit('done', signature);
+ this.emit('data', signature);
+ this.emit('end');
+ this.readable = false;
+ return signature;
+ } catch (e) {
+ this.readable = false;
+ this.emit('error', e);
+ this.emit('close');
+ }
+};
+
+SignStream.sign = jwsSign;
+
+module.exports = SignStream;
diff --git a/node_modules/jws/lib/tostring.js b/node_modules/jws/lib/tostring.js
new file mode 100644
index 0000000..f5a49a3
--- /dev/null
+++ b/node_modules/jws/lib/tostring.js
@@ -0,0 +1,10 @@
+/*global module*/
+var Buffer = require('buffer').Buffer;
+
+module.exports = function toString(obj) {
+ if (typeof obj === 'string')
+ return obj;
+ if (typeof obj === 'number' || Buffer.isBuffer(obj))
+ return obj.toString();
+ return JSON.stringify(obj);
+};
diff --git a/node_modules/jws/lib/verify-stream.js b/node_modules/jws/lib/verify-stream.js
new file mode 100644
index 0000000..39f7c73
--- /dev/null
+++ b/node_modules/jws/lib/verify-stream.js
@@ -0,0 +1,120 @@
+/*global module*/
+var Buffer = require('safe-buffer').Buffer;
+var DataStream = require('./data-stream');
+var jwa = require('jwa');
+var Stream = require('stream');
+var toString = require('./tostring');
+var util = require('util');
+var JWS_REGEX = /^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;
+
+function isObject(thing) {
+ return Object.prototype.toString.call(thing) === '[object Object]';
+}
+
+function safeJsonParse(thing) {
+ if (isObject(thing))
+ return thing;
+ try { return JSON.parse(thing); }
+ catch (e) { return undefined; }
+}
+
+function headerFromJWS(jwsSig) {
+ var encodedHeader = jwsSig.split('.', 1)[0];
+ return safeJsonParse(Buffer.from(encodedHeader, 'base64').toString('binary'));
+}
+
+function securedInputFromJWS(jwsSig) {
+ return jwsSig.split('.', 2).join('.');
+}
+
+function signatureFromJWS(jwsSig) {
+ return jwsSig.split('.')[2];
+}
+
+function payloadFromJWS(jwsSig, encoding) {
+ encoding = encoding || 'utf8';
+ var payload = jwsSig.split('.')[1];
+ return Buffer.from(payload, 'base64').toString(encoding);
+}
+
+function isValidJws(string) {
+ return JWS_REGEX.test(string) && !!headerFromJWS(string);
+}
+
+function jwsVerify(jwsSig, algorithm, secretOrKey) {
+ if (!algorithm) {
+ var err = new Error("Missing algorithm parameter for jws.verify");
+ err.code = "MISSING_ALGORITHM";
+ throw err;
+ }
+ jwsSig = toString(jwsSig);
+ var signature = signatureFromJWS(jwsSig);
+ var securedInput = securedInputFromJWS(jwsSig);
+ var algo = jwa(algorithm);
+ return algo.verify(securedInput, signature, secretOrKey);
+}
+
+function jwsDecode(jwsSig, opts) {
+ opts = opts || {};
+ jwsSig = toString(jwsSig);
+
+ if (!isValidJws(jwsSig))
+ return null;
+
+ var header = headerFromJWS(jwsSig);
+
+ if (!header)
+ return null;
+
+ var payload = payloadFromJWS(jwsSig);
+ if (header.typ === 'JWT' || opts.json)
+ payload = JSON.parse(payload, opts.encoding);
+
+ return {
+ header: header,
+ payload: payload,
+ signature: signatureFromJWS(jwsSig)
+ };
+}
+
+function VerifyStream(opts) {
+ opts = opts || {};
+ var secretOrKey = opts.secret||opts.publicKey||opts.key;
+ var secretStream = new DataStream(secretOrKey);
+ this.readable = true;
+ this.algorithm = opts.algorithm;
+ this.encoding = opts.encoding;
+ this.secret = this.publicKey = this.key = secretStream;
+ this.signature = new DataStream(opts.signature);
+ this.secret.once('close', function () {
+ if (!this.signature.writable && this.readable)
+ this.verify();
+ }.bind(this));
+
+ this.signature.once('close', function () {
+ if (!this.secret.writable && this.readable)
+ this.verify();
+ }.bind(this));
+}
+util.inherits(VerifyStream, Stream);
+VerifyStream.prototype.verify = function verify() {
+ try {
+ var valid = jwsVerify(this.signature.buffer, this.algorithm, this.key.buffer);
+ var obj = jwsDecode(this.signature.buffer, this.encoding);
+ this.emit('done', valid, obj);
+ this.emit('data', valid);
+ this.emit('end');
+ this.readable = false;
+ return valid;
+ } catch (e) {
+ this.readable = false;
+ this.emit('error', e);
+ this.emit('close');
+ }
+};
+
+VerifyStream.decode = jwsDecode;
+VerifyStream.isValid = isValidJws;
+VerifyStream.verify = jwsVerify;
+
+module.exports = VerifyStream;
diff --git a/node_modules/jws/package.json b/node_modules/jws/package.json
new file mode 100644
index 0000000..3fb2837
--- /dev/null
+++ b/node_modules/jws/package.json
@@ -0,0 +1,34 @@
+{
+ "name": "jws",
+ "version": "3.2.2",
+ "description": "Implementation of JSON Web Signatures",
+ "main": "index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/brianloveswords/node-jws.git"
+ },
+ "keywords": [
+ "jws",
+ "json",
+ "web",
+ "signatures"
+ ],
+ "author": "Brian J Brennan",
+ "license": "MIT",
+ "readmeFilename": "readme.md",
+ "gitHead": "c0f6b27bcea5a2ad2e304d91c2e842e4076a6b03",
+ "dependencies": {
+ "jwa": "^1.4.1",
+ "safe-buffer": "^5.0.1"
+ },
+ "devDependencies": {
+ "semver": "^5.1.0",
+ "tape": "~2.14.0"
+ }
+}
diff --git a/node_modules/jws/readme.md b/node_modules/jws/readme.md
new file mode 100644
index 0000000..1910c9a
--- /dev/null
+++ b/node_modules/jws/readme.md
@@ -0,0 +1,255 @@
+# node-jws [](http://travis-ci.org/brianloveswords/node-jws)
+
+An implementation of [JSON Web Signatures](http://self-issued.info/docs/draft-ietf-jose-json-web-signature.html).
+
+This was developed against `draft-ietf-jose-json-web-signature-08` and
+implements the entire spec **except** X.509 Certificate Chain
+signing/verifying (patches welcome).
+
+There are both synchronous (`jws.sign`, `jws.verify`) and streaming
+(`jws.createSign`, `jws.createVerify`) APIs.
+
+# Install
+
+```bash
+$ npm install jws
+```
+
+# Usage
+
+## jws.ALGORITHMS
+
+Array of supported algorithms. The following algorithms are currently supported.
+
+alg Parameter Value | Digital Signature or MAC Algorithm
+----------------|----------------------------
+HS256 | HMAC using SHA-256 hash algorithm
+HS384 | HMAC using SHA-384 hash algorithm
+HS512 | HMAC using SHA-512 hash algorithm
+RS256 | RSASSA using SHA-256 hash algorithm
+RS384 | RSASSA using SHA-384 hash algorithm
+RS512 | RSASSA using SHA-512 hash algorithm
+PS256 | RSASSA-PSS using SHA-256 hash algorithm
+PS384 | RSASSA-PSS using SHA-384 hash algorithm
+PS512 | RSASSA-PSS using SHA-512 hash algorithm
+ES256 | ECDSA using P-256 curve and SHA-256 hash algorithm
+ES384 | ECDSA using P-384 curve and SHA-384 hash algorithm
+ES512 | ECDSA using P-521 curve and SHA-512 hash algorithm
+none | No digital signature or MAC value included
+
+## jws.sign(options)
+
+(Synchronous) Return a JSON Web Signature for a header and a payload.
+
+Options:
+
+* `header`
+* `payload`
+* `secret` or `privateKey`
+* `encoding` (Optional, defaults to 'utf8')
+
+`header` must be an object with an `alg` property. `header.alg` must be
+one a value found in `jws.ALGORITHMS`. See above for a table of
+supported algorithms.
+
+If `payload` is not a buffer or a string, it will be coerced into a string
+using `JSON.stringify`.
+
+Example
+
+```js
+const signature = jws.sign({
+ header: { alg: 'HS256' },
+ payload: 'h. jon benjamin',
+ secret: 'has a van',
+});
+```
+
+## jws.verify(signature, algorithm, secretOrKey)
+
+(Synchronous) Returns `true` or `false` for whether a signature matches a
+secret or key.
+
+`signature` is a JWS Signature. `header.alg` must be a value found in `jws.ALGORITHMS`.
+See above for a table of supported algorithms. `secretOrKey` is a string or
+buffer containing either the secret for HMAC algorithms, or the PEM
+encoded public key for RSA and ECDSA.
+
+Note that the `"alg"` value from the signature header is ignored.
+
+
+## jws.decode(signature)
+
+(Synchronous) Returns the decoded header, decoded payload, and signature
+parts of the JWS Signature.
+
+Returns an object with three properties, e.g.
+```js
+{ header: { alg: 'HS256' },
+ payload: 'h. jon benjamin',
+ signature: 'YOWPewyGHKu4Y_0M_vtlEnNlqmFOclqp4Hy6hVHfFT4'
+}
+```
+
+## jws.createSign(options)
+
+Returns a new SignStream object.
+
+Options:
+
+* `header` (required)
+* `payload`
+* `key` || `privateKey` || `secret`
+* `encoding` (Optional, defaults to 'utf8')
+
+Other than `header`, all options expect a string or a buffer when the
+value is known ahead of time, or a stream for convenience.
+`key`/`privateKey`/`secret` may also be an object when using an encrypted
+private key, see the [crypto documentation][encrypted-key-docs].
+
+Example:
+
+```js
+
+// This...
+jws.createSign({
+ header: { alg: 'RS256' },
+ privateKey: privateKeyStream,
+ payload: payloadStream,
+}).on('done', function(signature) {
+ // ...
+});
+
+// is equivalent to this:
+const signer = jws.createSign({
+ header: { alg: 'RS256' },
+});
+privateKeyStream.pipe(signer.privateKey);
+payloadStream.pipe(signer.payload);
+signer.on('done', function(signature) {
+ // ...
+});
+```
+
+## jws.createVerify(options)
+
+Returns a new VerifyStream object.
+
+Options:
+
+* `signature`
+* `algorithm`
+* `key` || `publicKey` || `secret`
+* `encoding` (Optional, defaults to 'utf8')
+
+All options expect a string or a buffer when the value is known ahead of
+time, or a stream for convenience.
+
+Example:
+
+```js
+
+// This...
+jws.createVerify({
+ publicKey: pubKeyStream,
+ signature: sigStream,
+}).on('done', function(verified, obj) {
+ // ...
+});
+
+// is equivilant to this:
+const verifier = jws.createVerify();
+pubKeyStream.pipe(verifier.publicKey);
+sigStream.pipe(verifier.signature);
+verifier.on('done', function(verified, obj) {
+ // ...
+});
+```
+
+## Class: SignStream
+
+A `Readable Stream` that emits a single data event (the calculated
+signature) when done.
+
+### Event: 'done'
+`function (signature) { }`
+
+### signer.payload
+
+A `Writable Stream` that expects the JWS payload. Do *not* use if you
+passed a `payload` option to the constructor.
+
+Example:
+
+```js
+payloadStream.pipe(signer.payload);
+```
+
+### signer.secret signer.key signer.privateKey
+
+A `Writable Stream`. Expects the JWS secret for HMAC, or the privateKey
+for ECDSA and RSA. Do *not* use if you passed a `secret` or `key` option
+to the constructor.
+
+Example:
+
+```js
+privateKeyStream.pipe(signer.privateKey);
+```
+
+## Class: VerifyStream
+
+This is a `Readable Stream` that emits a single data event, the result
+of whether or not that signature was valid.
+
+### Event: 'done'
+`function (valid, obj) { }`
+
+`valid` is a boolean for whether or not the signature is valid.
+
+### verifier.signature
+
+A `Writable Stream` that expects a JWS Signature. Do *not* use if you
+passed a `signature` option to the constructor.
+
+### verifier.secret verifier.key verifier.publicKey
+
+A `Writable Stream` that expects a public key or secret. Do *not* use if you
+passed a `key` or `secret` option to the constructor.
+
+# TODO
+
+* It feels like there should be some convenience options/APIs for
+ defining the algorithm rather than having to define a header object
+ with `{ alg: 'ES512' }` or whatever every time.
+
+* X.509 support, ugh
+
+# License
+
+MIT
+
+```
+Copyright (c) 2013-2015 Brian J. Brennan
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+```
+
+[encrypted-key-docs]: https://nodejs.org/api/crypto.html#crypto_sign_sign_private_key_output_format
diff --git a/node_modules/lodash.includes/LICENSE b/node_modules/lodash.includes/LICENSE
new file mode 100644
index 0000000..e0c69d5
--- /dev/null
+++ b/node_modules/lodash.includes/LICENSE
@@ -0,0 +1,47 @@
+Copyright jQuery Foundation and other contributors
+
+Based on Underscore.js, copyright Jeremy Ashkenas,
+DocumentCloud and Investigative Reporters & Editors
+
+This software consists of voluntary contributions made by many
+individuals. For exact contribution history, see the revision history
+available at https://github.com/lodash/lodash
+
+The following license applies to all parts of this software except as
+documented below:
+
+====
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+====
+
+Copyright and related rights for sample code are waived via CC0. Sample
+code is defined as all source code displayed within the prose of the
+documentation.
+
+CC0: http://creativecommons.org/publicdomain/zero/1.0/
+
+====
+
+Files located in the node_modules and vendor directories are externally
+maintained libraries used by this software which have their own
+licenses; we recommend you read them, as their terms may differ from the
+terms above.
diff --git a/node_modules/lodash.includes/README.md b/node_modules/lodash.includes/README.md
new file mode 100644
index 0000000..26e9377
--- /dev/null
+++ b/node_modules/lodash.includes/README.md
@@ -0,0 +1,18 @@
+# lodash.includes v4.3.0
+
+The [lodash](https://lodash.com/) method `_.includes` exported as a [Node.js](https://nodejs.org/) module.
+
+## Installation
+
+Using npm:
+```bash
+$ {sudo -H} npm i -g npm
+$ npm i --save lodash.includes
+```
+
+In Node.js:
+```js
+var includes = require('lodash.includes');
+```
+
+See the [documentation](https://lodash.com/docs#includes) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.includes) for more details.
diff --git a/node_modules/lodash.includes/index.js b/node_modules/lodash.includes/index.js
new file mode 100644
index 0000000..e88d533
--- /dev/null
+++ b/node_modules/lodash.includes/index.js
@@ -0,0 +1,745 @@
+/**
+ * lodash (Custom Build)
+ * Build: `lodash modularize exports="npm" -o ./`
+ * Copyright jQuery Foundation and other contributors
+ * Released under MIT license
+ * Based on Underscore.js 1.8.3
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ */
+
+/** Used as references for various `Number` constants. */
+var INFINITY = 1 / 0,
+ MAX_SAFE_INTEGER = 9007199254740991,
+ MAX_INTEGER = 1.7976931348623157e+308,
+ NAN = 0 / 0;
+
+/** `Object#toString` result references. */
+var argsTag = '[object Arguments]',
+ funcTag = '[object Function]',
+ genTag = '[object GeneratorFunction]',
+ stringTag = '[object String]',
+ symbolTag = '[object Symbol]';
+
+/** Used to match leading and trailing whitespace. */
+var reTrim = /^\s+|\s+$/g;
+
+/** Used to detect bad signed hexadecimal string values. */
+var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
+
+/** Used to detect binary string values. */
+var reIsBinary = /^0b[01]+$/i;
+
+/** Used to detect octal string values. */
+var reIsOctal = /^0o[0-7]+$/i;
+
+/** Used to detect unsigned integer values. */
+var reIsUint = /^(?:0|[1-9]\d*)$/;
+
+/** Built-in method references without a dependency on `root`. */
+var freeParseInt = parseInt;
+
+/**
+ * A specialized version of `_.map` for arrays without support for iteratee
+ * shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the new mapped array.
+ */
+function arrayMap(array, iteratee) {
+ var index = -1,
+ length = array ? array.length : 0,
+ result = Array(length);
+
+ while (++index < length) {
+ result[index] = iteratee(array[index], index, array);
+ }
+ return result;
+}
+
+/**
+ * The base implementation of `_.findIndex` and `_.findLastIndex` without
+ * support for iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Function} predicate The function invoked per iteration.
+ * @param {number} fromIndex The index to search from.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+function baseFindIndex(array, predicate, fromIndex, fromRight) {
+ var length = array.length,
+ index = fromIndex + (fromRight ? 1 : -1);
+
+ while ((fromRight ? index-- : ++index < length)) {
+ if (predicate(array[index], index, array)) {
+ return index;
+ }
+ }
+ return -1;
+}
+
+/**
+ * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+function baseIndexOf(array, value, fromIndex) {
+ if (value !== value) {
+ return baseFindIndex(array, baseIsNaN, fromIndex);
+ }
+ var index = fromIndex - 1,
+ length = array.length;
+
+ while (++index < length) {
+ if (array[index] === value) {
+ return index;
+ }
+ }
+ return -1;
+}
+
+/**
+ * The base implementation of `_.isNaN` without support for number objects.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
+ */
+function baseIsNaN(value) {
+ return value !== value;
+}
+
+/**
+ * The base implementation of `_.times` without support for iteratee shorthands
+ * or max array length checks.
+ *
+ * @private
+ * @param {number} n The number of times to invoke `iteratee`.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the array of results.
+ */
+function baseTimes(n, iteratee) {
+ var index = -1,
+ result = Array(n);
+
+ while (++index < n) {
+ result[index] = iteratee(index);
+ }
+ return result;
+}
+
+/**
+ * The base implementation of `_.values` and `_.valuesIn` which creates an
+ * array of `object` property values corresponding to the property names
+ * of `props`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array} props The property names to get values for.
+ * @returns {Object} Returns the array of property values.
+ */
+function baseValues(object, props) {
+ return arrayMap(props, function(key) {
+ return object[key];
+ });
+}
+
+/**
+ * Creates a unary function that invokes `func` with its argument transformed.
+ *
+ * @private
+ * @param {Function} func The function to wrap.
+ * @param {Function} transform The argument transform.
+ * @returns {Function} Returns the new function.
+ */
+function overArg(func, transform) {
+ return function(arg) {
+ return func(transform(arg));
+ };
+}
+
+/** Used for built-in method references. */
+var objectProto = Object.prototype;
+
+/** Used to check objects for own properties. */
+var hasOwnProperty = objectProto.hasOwnProperty;
+
+/**
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+var objectToString = objectProto.toString;
+
+/** Built-in value references. */
+var propertyIsEnumerable = objectProto.propertyIsEnumerable;
+
+/* Built-in method references for those with the same name as other `lodash` methods. */
+var nativeKeys = overArg(Object.keys, Object),
+ nativeMax = Math.max;
+
+/**
+ * Creates an array of the enumerable property names of the array-like `value`.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @param {boolean} inherited Specify returning inherited property names.
+ * @returns {Array} Returns the array of property names.
+ */
+function arrayLikeKeys(value, inherited) {
+ // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
+ // Safari 9 makes `arguments.length` enumerable in strict mode.
+ var result = (isArray(value) || isArguments(value))
+ ? baseTimes(value.length, String)
+ : [];
+
+ var length = result.length,
+ skipIndexes = !!length;
+
+ for (var key in value) {
+ if ((inherited || hasOwnProperty.call(value, key)) &&
+ !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
+ result.push(key);
+ }
+ }
+ return result;
+}
+
+/**
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ */
+function baseKeys(object) {
+ if (!isPrototype(object)) {
+ return nativeKeys(object);
+ }
+ var result = [];
+ for (var key in Object(object)) {
+ if (hasOwnProperty.call(object, key) && key != 'constructor') {
+ result.push(key);
+ }
+ }
+ return result;
+}
+
+/**
+ * Checks if `value` is a valid array-like index.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+ */
+function isIndex(value, length) {
+ length = length == null ? MAX_SAFE_INTEGER : length;
+ return !!length &&
+ (typeof value == 'number' || reIsUint.test(value)) &&
+ (value > -1 && value % 1 == 0 && value < length);
+}
+
+/**
+ * Checks if `value` is likely a prototype object.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
+ */
+function isPrototype(value) {
+ var Ctor = value && value.constructor,
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
+
+ return value === proto;
+}
+
+/**
+ * Checks if `value` is in `collection`. If `collection` is a string, it's
+ * checked for a substring of `value`, otherwise
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+ * is used for equality comparisons. If `fromIndex` is negative, it's used as
+ * the offset from the end of `collection`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} [fromIndex=0] The index to search from.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
+ * @example
+ *
+ * _.includes([1, 2, 3], 1);
+ * // => true
+ *
+ * _.includes([1, 2, 3], 1, 2);
+ * // => false
+ *
+ * _.includes({ 'a': 1, 'b': 2 }, 1);
+ * // => true
+ *
+ * _.includes('abcd', 'bc');
+ * // => true
+ */
+function includes(collection, value, fromIndex, guard) {
+ collection = isArrayLike(collection) ? collection : values(collection);
+ fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
+
+ var length = collection.length;
+ if (fromIndex < 0) {
+ fromIndex = nativeMax(length + fromIndex, 0);
+ }
+ return isString(collection)
+ ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
+ : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
+}
+
+/**
+ * Checks if `value` is likely an `arguments` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
+ * else `false`.
+ * @example
+ *
+ * _.isArguments(function() { return arguments; }());
+ * // => true
+ *
+ * _.isArguments([1, 2, 3]);
+ * // => false
+ */
+function isArguments(value) {
+ // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
+ return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
+ (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
+}
+
+/**
+ * Checks if `value` is classified as an `Array` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
+ * @example
+ *
+ * _.isArray([1, 2, 3]);
+ * // => true
+ *
+ * _.isArray(document.body.children);
+ * // => false
+ *
+ * _.isArray('abc');
+ * // => false
+ *
+ * _.isArray(_.noop);
+ * // => false
+ */
+var isArray = Array.isArray;
+
+/**
+ * Checks if `value` is array-like. A value is considered array-like if it's
+ * not a function and has a `value.length` that's an integer greater than or
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
+ * @example
+ *
+ * _.isArrayLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isArrayLike(document.body.children);
+ * // => true
+ *
+ * _.isArrayLike('abc');
+ * // => true
+ *
+ * _.isArrayLike(_.noop);
+ * // => false
+ */
+function isArrayLike(value) {
+ return value != null && isLength(value.length) && !isFunction(value);
+}
+
+/**
+ * This method is like `_.isArrayLike` except that it also checks if `value`
+ * is an object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an array-like object,
+ * else `false`.
+ * @example
+ *
+ * _.isArrayLikeObject([1, 2, 3]);
+ * // => true
+ *
+ * _.isArrayLikeObject(document.body.children);
+ * // => true
+ *
+ * _.isArrayLikeObject('abc');
+ * // => false
+ *
+ * _.isArrayLikeObject(_.noop);
+ * // => false
+ */
+function isArrayLikeObject(value) {
+ return isObjectLike(value) && isArrayLike(value);
+}
+
+/**
+ * Checks if `value` is classified as a `Function` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
+ * @example
+ *
+ * _.isFunction(_);
+ * // => true
+ *
+ * _.isFunction(/abc/);
+ * // => false
+ */
+function isFunction(value) {
+ // The use of `Object#toString` avoids issues with the `typeof` operator
+ // in Safari 8-9 which returns 'object' for typed array and other constructors.
+ var tag = isObject(value) ? objectToString.call(value) : '';
+ return tag == funcTag || tag == genTag;
+}
+
+/**
+ * Checks if `value` is a valid array-like length.
+ *
+ * **Note:** This method is loosely based on
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
+ * @example
+ *
+ * _.isLength(3);
+ * // => true
+ *
+ * _.isLength(Number.MIN_VALUE);
+ * // => false
+ *
+ * _.isLength(Infinity);
+ * // => false
+ *
+ * _.isLength('3');
+ * // => false
+ */
+function isLength(value) {
+ return typeof value == 'number' &&
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
+}
+
+/**
+ * Checks if `value` is the
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
+ * @example
+ *
+ * _.isObject({});
+ * // => true
+ *
+ * _.isObject([1, 2, 3]);
+ * // => true
+ *
+ * _.isObject(_.noop);
+ * // => true
+ *
+ * _.isObject(null);
+ * // => false
+ */
+function isObject(value) {
+ var type = typeof value;
+ return !!value && (type == 'object' || type == 'function');
+}
+
+/**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+function isObjectLike(value) {
+ return !!value && typeof value == 'object';
+}
+
+/**
+ * Checks if `value` is classified as a `String` primitive or object.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a string, else `false`.
+ * @example
+ *
+ * _.isString('abc');
+ * // => true
+ *
+ * _.isString(1);
+ * // => false
+ */
+function isString(value) {
+ return typeof value == 'string' ||
+ (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);
+}
+
+/**
+ * Checks if `value` is classified as a `Symbol` primitive or object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
+ * @example
+ *
+ * _.isSymbol(Symbol.iterator);
+ * // => true
+ *
+ * _.isSymbol('abc');
+ * // => false
+ */
+function isSymbol(value) {
+ return typeof value == 'symbol' ||
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
+}
+
+/**
+ * Converts `value` to a finite number.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.12.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {number} Returns the converted number.
+ * @example
+ *
+ * _.toFinite(3.2);
+ * // => 3.2
+ *
+ * _.toFinite(Number.MIN_VALUE);
+ * // => 5e-324
+ *
+ * _.toFinite(Infinity);
+ * // => 1.7976931348623157e+308
+ *
+ * _.toFinite('3.2');
+ * // => 3.2
+ */
+function toFinite(value) {
+ if (!value) {
+ return value === 0 ? value : 0;
+ }
+ value = toNumber(value);
+ if (value === INFINITY || value === -INFINITY) {
+ var sign = (value < 0 ? -1 : 1);
+ return sign * MAX_INTEGER;
+ }
+ return value === value ? value : 0;
+}
+
+/**
+ * Converts `value` to an integer.
+ *
+ * **Note:** This method is loosely based on
+ * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {number} Returns the converted integer.
+ * @example
+ *
+ * _.toInteger(3.2);
+ * // => 3
+ *
+ * _.toInteger(Number.MIN_VALUE);
+ * // => 0
+ *
+ * _.toInteger(Infinity);
+ * // => 1.7976931348623157e+308
+ *
+ * _.toInteger('3.2');
+ * // => 3
+ */
+function toInteger(value) {
+ var result = toFinite(value),
+ remainder = result % 1;
+
+ return result === result ? (remainder ? result - remainder : result) : 0;
+}
+
+/**
+ * Converts `value` to a number.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to process.
+ * @returns {number} Returns the number.
+ * @example
+ *
+ * _.toNumber(3.2);
+ * // => 3.2
+ *
+ * _.toNumber(Number.MIN_VALUE);
+ * // => 5e-324
+ *
+ * _.toNumber(Infinity);
+ * // => Infinity
+ *
+ * _.toNumber('3.2');
+ * // => 3.2
+ */
+function toNumber(value) {
+ if (typeof value == 'number') {
+ return value;
+ }
+ if (isSymbol(value)) {
+ return NAN;
+ }
+ if (isObject(value)) {
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
+ value = isObject(other) ? (other + '') : other;
+ }
+ if (typeof value != 'string') {
+ return value === 0 ? value : +value;
+ }
+ value = value.replace(reTrim, '');
+ var isBinary = reIsBinary.test(value);
+ return (isBinary || reIsOctal.test(value))
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
+ : (reIsBadHex.test(value) ? NAN : +value);
+}
+
+/**
+ * Creates an array of the own enumerable property names of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects. See the
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
+ * for more details.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.keys(new Foo);
+ * // => ['a', 'b'] (iteration order is not guaranteed)
+ *
+ * _.keys('hi');
+ * // => ['0', '1']
+ */
+function keys(object) {
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
+}
+
+/**
+ * Creates an array of the own enumerable string keyed property values of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property values.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.values(new Foo);
+ * // => [1, 2] (iteration order is not guaranteed)
+ *
+ * _.values('hi');
+ * // => ['h', 'i']
+ */
+function values(object) {
+ return object ? baseValues(object, keys(object)) : [];
+}
+
+module.exports = includes;
diff --git a/node_modules/lodash.includes/package.json b/node_modules/lodash.includes/package.json
new file mode 100644
index 0000000..a02e645
--- /dev/null
+++ b/node_modules/lodash.includes/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "lodash.includes",
+ "version": "4.3.0",
+ "description": "The lodash method `_.includes` exported as a module.",
+ "homepage": "https://lodash.com/",
+ "icon": "https://lodash.com/icon.svg",
+ "license": "MIT",
+ "keywords": "lodash-modularized, includes",
+ "author": "John-David Dalton (http://allyoucanleet.com/)",
+ "contributors": [
+ "John-David Dalton (http://allyoucanleet.com/)",
+ "Blaine Bublitz (https://github.com/phated)",
+ "Mathias Bynens (https://mathiasbynens.be/)"
+ ],
+ "repository": "lodash/lodash",
+ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }
+}
diff --git a/node_modules/lodash.isboolean/LICENSE b/node_modules/lodash.isboolean/LICENSE
new file mode 100644
index 0000000..b054ca5
--- /dev/null
+++ b/node_modules/lodash.isboolean/LICENSE
@@ -0,0 +1,22 @@
+Copyright 2012-2016 The Dojo Foundation
+Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
+DocumentCloud and Investigative Reporters & Editors
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/lodash.isboolean/README.md b/node_modules/lodash.isboolean/README.md
new file mode 100644
index 0000000..b3c476b
--- /dev/null
+++ b/node_modules/lodash.isboolean/README.md
@@ -0,0 +1,18 @@
+# lodash.isboolean v3.0.3
+
+The [lodash](https://lodash.com/) method `_.isBoolean` exported as a [Node.js](https://nodejs.org/) module.
+
+## Installation
+
+Using npm:
+```bash
+$ {sudo -H} npm i -g npm
+$ npm i --save lodash.isboolean
+```
+
+In Node.js:
+```js
+var isBoolean = require('lodash.isboolean');
+```
+
+See the [documentation](https://lodash.com/docs#isBoolean) or [package source](https://github.com/lodash/lodash/blob/3.0.3-npm-packages/lodash.isboolean) for more details.
diff --git a/node_modules/lodash.isboolean/index.js b/node_modules/lodash.isboolean/index.js
new file mode 100644
index 0000000..23bbabd
--- /dev/null
+++ b/node_modules/lodash.isboolean/index.js
@@ -0,0 +1,70 @@
+/**
+ * lodash 3.0.3 (Custom Build)
+ * Build: `lodash modularize exports="npm" -o ./`
+ * Copyright 2012-2016 The Dojo Foundation
+ * Based on Underscore.js 1.8.3
+ * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ * Available under MIT license
+ */
+
+/** `Object#toString` result references. */
+var boolTag = '[object Boolean]';
+
+/** Used for built-in method references. */
+var objectProto = Object.prototype;
+
+/**
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+var objectToString = objectProto.toString;
+
+/**
+ * Checks if `value` is classified as a boolean primitive or object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isBoolean(false);
+ * // => true
+ *
+ * _.isBoolean(null);
+ * // => false
+ */
+function isBoolean(value) {
+ return value === true || value === false ||
+ (isObjectLike(value) && objectToString.call(value) == boolTag);
+}
+
+/**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+function isObjectLike(value) {
+ return !!value && typeof value == 'object';
+}
+
+module.exports = isBoolean;
diff --git a/node_modules/lodash.isboolean/package.json b/node_modules/lodash.isboolean/package.json
new file mode 100644
index 0000000..01d6e8b
--- /dev/null
+++ b/node_modules/lodash.isboolean/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "lodash.isboolean",
+ "version": "3.0.3",
+ "description": "The lodash method `_.isBoolean` exported as a module.",
+ "homepage": "https://lodash.com/",
+ "icon": "https://lodash.com/icon.svg",
+ "license": "MIT",
+ "keywords": "lodash-modularized, isboolean",
+ "author": "John-David Dalton (http://allyoucanleet.com/)",
+ "contributors": [
+ "John-David Dalton (http://allyoucanleet.com/)",
+ "Blaine Bublitz (https://github.com/phated)",
+ "Mathias Bynens (https://mathiasbynens.be/)"
+ ],
+ "repository": "lodash/lodash",
+ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }
+}
diff --git a/node_modules/lodash.isinteger/LICENSE b/node_modules/lodash.isinteger/LICENSE
new file mode 100644
index 0000000..e0c69d5
--- /dev/null
+++ b/node_modules/lodash.isinteger/LICENSE
@@ -0,0 +1,47 @@
+Copyright jQuery Foundation and other contributors
+
+Based on Underscore.js, copyright Jeremy Ashkenas,
+DocumentCloud and Investigative Reporters & Editors
+
+This software consists of voluntary contributions made by many
+individuals. For exact contribution history, see the revision history
+available at https://github.com/lodash/lodash
+
+The following license applies to all parts of this software except as
+documented below:
+
+====
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+====
+
+Copyright and related rights for sample code are waived via CC0. Sample
+code is defined as all source code displayed within the prose of the
+documentation.
+
+CC0: http://creativecommons.org/publicdomain/zero/1.0/
+
+====
+
+Files located in the node_modules and vendor directories are externally
+maintained libraries used by this software which have their own
+licenses; we recommend you read them, as their terms may differ from the
+terms above.
diff --git a/node_modules/lodash.isinteger/README.md b/node_modules/lodash.isinteger/README.md
new file mode 100644
index 0000000..3a78567
--- /dev/null
+++ b/node_modules/lodash.isinteger/README.md
@@ -0,0 +1,18 @@
+# lodash.isinteger v4.0.4
+
+The [lodash](https://lodash.com/) method `_.isInteger` exported as a [Node.js](https://nodejs.org/) module.
+
+## Installation
+
+Using npm:
+```bash
+$ {sudo -H} npm i -g npm
+$ npm i --save lodash.isinteger
+```
+
+In Node.js:
+```js
+var isInteger = require('lodash.isinteger');
+```
+
+See the [documentation](https://lodash.com/docs#isInteger) or [package source](https://github.com/lodash/lodash/blob/4.0.4-npm-packages/lodash.isinteger) for more details.
diff --git a/node_modules/lodash.isinteger/index.js b/node_modules/lodash.isinteger/index.js
new file mode 100644
index 0000000..3bf06f0
--- /dev/null
+++ b/node_modules/lodash.isinteger/index.js
@@ -0,0 +1,265 @@
+/**
+ * lodash (Custom Build)
+ * Build: `lodash modularize exports="npm" -o ./`
+ * Copyright jQuery Foundation and other contributors
+ * Released under MIT license
+ * Based on Underscore.js 1.8.3
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ */
+
+/** Used as references for various `Number` constants. */
+var INFINITY = 1 / 0,
+ MAX_INTEGER = 1.7976931348623157e+308,
+ NAN = 0 / 0;
+
+/** `Object#toString` result references. */
+var symbolTag = '[object Symbol]';
+
+/** Used to match leading and trailing whitespace. */
+var reTrim = /^\s+|\s+$/g;
+
+/** Used to detect bad signed hexadecimal string values. */
+var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
+
+/** Used to detect binary string values. */
+var reIsBinary = /^0b[01]+$/i;
+
+/** Used to detect octal string values. */
+var reIsOctal = /^0o[0-7]+$/i;
+
+/** Built-in method references without a dependency on `root`. */
+var freeParseInt = parseInt;
+
+/** Used for built-in method references. */
+var objectProto = Object.prototype;
+
+/**
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+var objectToString = objectProto.toString;
+
+/**
+ * Checks if `value` is an integer.
+ *
+ * **Note:** This method is based on
+ * [`Number.isInteger`](https://mdn.io/Number/isInteger).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
+ * @example
+ *
+ * _.isInteger(3);
+ * // => true
+ *
+ * _.isInteger(Number.MIN_VALUE);
+ * // => false
+ *
+ * _.isInteger(Infinity);
+ * // => false
+ *
+ * _.isInteger('3');
+ * // => false
+ */
+function isInteger(value) {
+ return typeof value == 'number' && value == toInteger(value);
+}
+
+/**
+ * Checks if `value` is the
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
+ * @example
+ *
+ * _.isObject({});
+ * // => true
+ *
+ * _.isObject([1, 2, 3]);
+ * // => true
+ *
+ * _.isObject(_.noop);
+ * // => true
+ *
+ * _.isObject(null);
+ * // => false
+ */
+function isObject(value) {
+ var type = typeof value;
+ return !!value && (type == 'object' || type == 'function');
+}
+
+/**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+function isObjectLike(value) {
+ return !!value && typeof value == 'object';
+}
+
+/**
+ * Checks if `value` is classified as a `Symbol` primitive or object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
+ * @example
+ *
+ * _.isSymbol(Symbol.iterator);
+ * // => true
+ *
+ * _.isSymbol('abc');
+ * // => false
+ */
+function isSymbol(value) {
+ return typeof value == 'symbol' ||
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
+}
+
+/**
+ * Converts `value` to a finite number.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.12.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {number} Returns the converted number.
+ * @example
+ *
+ * _.toFinite(3.2);
+ * // => 3.2
+ *
+ * _.toFinite(Number.MIN_VALUE);
+ * // => 5e-324
+ *
+ * _.toFinite(Infinity);
+ * // => 1.7976931348623157e+308
+ *
+ * _.toFinite('3.2');
+ * // => 3.2
+ */
+function toFinite(value) {
+ if (!value) {
+ return value === 0 ? value : 0;
+ }
+ value = toNumber(value);
+ if (value === INFINITY || value === -INFINITY) {
+ var sign = (value < 0 ? -1 : 1);
+ return sign * MAX_INTEGER;
+ }
+ return value === value ? value : 0;
+}
+
+/**
+ * Converts `value` to an integer.
+ *
+ * **Note:** This method is loosely based on
+ * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {number} Returns the converted integer.
+ * @example
+ *
+ * _.toInteger(3.2);
+ * // => 3
+ *
+ * _.toInteger(Number.MIN_VALUE);
+ * // => 0
+ *
+ * _.toInteger(Infinity);
+ * // => 1.7976931348623157e+308
+ *
+ * _.toInteger('3.2');
+ * // => 3
+ */
+function toInteger(value) {
+ var result = toFinite(value),
+ remainder = result % 1;
+
+ return result === result ? (remainder ? result - remainder : result) : 0;
+}
+
+/**
+ * Converts `value` to a number.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to process.
+ * @returns {number} Returns the number.
+ * @example
+ *
+ * _.toNumber(3.2);
+ * // => 3.2
+ *
+ * _.toNumber(Number.MIN_VALUE);
+ * // => 5e-324
+ *
+ * _.toNumber(Infinity);
+ * // => Infinity
+ *
+ * _.toNumber('3.2');
+ * // => 3.2
+ */
+function toNumber(value) {
+ if (typeof value == 'number') {
+ return value;
+ }
+ if (isSymbol(value)) {
+ return NAN;
+ }
+ if (isObject(value)) {
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
+ value = isObject(other) ? (other + '') : other;
+ }
+ if (typeof value != 'string') {
+ return value === 0 ? value : +value;
+ }
+ value = value.replace(reTrim, '');
+ var isBinary = reIsBinary.test(value);
+ return (isBinary || reIsOctal.test(value))
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
+ : (reIsBadHex.test(value) ? NAN : +value);
+}
+
+module.exports = isInteger;
diff --git a/node_modules/lodash.isinteger/package.json b/node_modules/lodash.isinteger/package.json
new file mode 100644
index 0000000..92db256
--- /dev/null
+++ b/node_modules/lodash.isinteger/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "lodash.isinteger",
+ "version": "4.0.4",
+ "description": "The lodash method `_.isInteger` exported as a module.",
+ "homepage": "https://lodash.com/",
+ "icon": "https://lodash.com/icon.svg",
+ "license": "MIT",
+ "keywords": "lodash-modularized, isinteger",
+ "author": "John-David Dalton (http://allyoucanleet.com/)",
+ "contributors": [
+ "John-David Dalton (http://allyoucanleet.com/)",
+ "Blaine Bublitz (https://github.com/phated)",
+ "Mathias Bynens (https://mathiasbynens.be/)"
+ ],
+ "repository": "lodash/lodash",
+ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }
+}
diff --git a/node_modules/lodash.isnumber/LICENSE b/node_modules/lodash.isnumber/LICENSE
new file mode 100644
index 0000000..b054ca5
--- /dev/null
+++ b/node_modules/lodash.isnumber/LICENSE
@@ -0,0 +1,22 @@
+Copyright 2012-2016 The Dojo Foundation
+Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
+DocumentCloud and Investigative Reporters & Editors
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/lodash.isnumber/README.md b/node_modules/lodash.isnumber/README.md
new file mode 100644
index 0000000..a1d434d
--- /dev/null
+++ b/node_modules/lodash.isnumber/README.md
@@ -0,0 +1,18 @@
+# lodash.isnumber v3.0.3
+
+The [lodash](https://lodash.com/) method `_.isNumber` exported as a [Node.js](https://nodejs.org/) module.
+
+## Installation
+
+Using npm:
+```bash
+$ {sudo -H} npm i -g npm
+$ npm i --save lodash.isnumber
+```
+
+In Node.js:
+```js
+var isNumber = require('lodash.isnumber');
+```
+
+See the [documentation](https://lodash.com/docs#isNumber) or [package source](https://github.com/lodash/lodash/blob/3.0.3-npm-packages/lodash.isnumber) for more details.
diff --git a/node_modules/lodash.isnumber/index.js b/node_modules/lodash.isnumber/index.js
new file mode 100644
index 0000000..35a8573
--- /dev/null
+++ b/node_modules/lodash.isnumber/index.js
@@ -0,0 +1,79 @@
+/**
+ * lodash 3.0.3 (Custom Build)
+ * Build: `lodash modularize exports="npm" -o ./`
+ * Copyright 2012-2016 The Dojo Foundation
+ * Based on Underscore.js 1.8.3
+ * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ * Available under MIT license
+ */
+
+/** `Object#toString` result references. */
+var numberTag = '[object Number]';
+
+/** Used for built-in method references. */
+var objectProto = Object.prototype;
+
+/**
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+var objectToString = objectProto.toString;
+
+/**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+function isObjectLike(value) {
+ return !!value && typeof value == 'object';
+}
+
+/**
+ * Checks if `value` is classified as a `Number` primitive or object.
+ *
+ * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
+ * as numbers, use the `_.isFinite` method.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isNumber(3);
+ * // => true
+ *
+ * _.isNumber(Number.MIN_VALUE);
+ * // => true
+ *
+ * _.isNumber(Infinity);
+ * // => true
+ *
+ * _.isNumber('3');
+ * // => false
+ */
+function isNumber(value) {
+ return typeof value == 'number' ||
+ (isObjectLike(value) && objectToString.call(value) == numberTag);
+}
+
+module.exports = isNumber;
diff --git a/node_modules/lodash.isnumber/package.json b/node_modules/lodash.isnumber/package.json
new file mode 100644
index 0000000..4c33c2a
--- /dev/null
+++ b/node_modules/lodash.isnumber/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "lodash.isnumber",
+ "version": "3.0.3",
+ "description": "The lodash method `_.isNumber` exported as a module.",
+ "homepage": "https://lodash.com/",
+ "icon": "https://lodash.com/icon.svg",
+ "license": "MIT",
+ "keywords": "lodash-modularized, isnumber",
+ "author": "John-David Dalton (http://allyoucanleet.com/)",
+ "contributors": [
+ "John-David Dalton (http://allyoucanleet.com/)",
+ "Blaine Bublitz (https://github.com/phated)",
+ "Mathias Bynens (https://mathiasbynens.be/)"
+ ],
+ "repository": "lodash/lodash",
+ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }
+}
diff --git a/node_modules/lodash.isplainobject/LICENSE b/node_modules/lodash.isplainobject/LICENSE
new file mode 100644
index 0000000..e0c69d5
--- /dev/null
+++ b/node_modules/lodash.isplainobject/LICENSE
@@ -0,0 +1,47 @@
+Copyright jQuery Foundation and other contributors
+
+Based on Underscore.js, copyright Jeremy Ashkenas,
+DocumentCloud and Investigative Reporters & Editors
+
+This software consists of voluntary contributions made by many
+individuals. For exact contribution history, see the revision history
+available at https://github.com/lodash/lodash
+
+The following license applies to all parts of this software except as
+documented below:
+
+====
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+====
+
+Copyright and related rights for sample code are waived via CC0. Sample
+code is defined as all source code displayed within the prose of the
+documentation.
+
+CC0: http://creativecommons.org/publicdomain/zero/1.0/
+
+====
+
+Files located in the node_modules and vendor directories are externally
+maintained libraries used by this software which have their own
+licenses; we recommend you read them, as their terms may differ from the
+terms above.
diff --git a/node_modules/lodash.isplainobject/README.md b/node_modules/lodash.isplainobject/README.md
new file mode 100644
index 0000000..aeefd74
--- /dev/null
+++ b/node_modules/lodash.isplainobject/README.md
@@ -0,0 +1,18 @@
+# lodash.isplainobject v4.0.6
+
+The [lodash](https://lodash.com/) method `_.isPlainObject` exported as a [Node.js](https://nodejs.org/) module.
+
+## Installation
+
+Using npm:
+```bash
+$ {sudo -H} npm i -g npm
+$ npm i --save lodash.isplainobject
+```
+
+In Node.js:
+```js
+var isPlainObject = require('lodash.isplainobject');
+```
+
+See the [documentation](https://lodash.com/docs#isPlainObject) or [package source](https://github.com/lodash/lodash/blob/4.0.6-npm-packages/lodash.isplainobject) for more details.
diff --git a/node_modules/lodash.isplainobject/index.js b/node_modules/lodash.isplainobject/index.js
new file mode 100644
index 0000000..0f820ee
--- /dev/null
+++ b/node_modules/lodash.isplainobject/index.js
@@ -0,0 +1,139 @@
+/**
+ * lodash (Custom Build)
+ * Build: `lodash modularize exports="npm" -o ./`
+ * Copyright jQuery Foundation and other contributors
+ * Released under MIT license
+ * Based on Underscore.js 1.8.3
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ */
+
+/** `Object#toString` result references. */
+var objectTag = '[object Object]';
+
+/**
+ * Checks if `value` is a host object in IE < 9.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
+ */
+function isHostObject(value) {
+ // Many host objects are `Object` objects that can coerce to strings
+ // despite having improperly defined `toString` methods.
+ var result = false;
+ if (value != null && typeof value.toString != 'function') {
+ try {
+ result = !!(value + '');
+ } catch (e) {}
+ }
+ return result;
+}
+
+/**
+ * Creates a unary function that invokes `func` with its argument transformed.
+ *
+ * @private
+ * @param {Function} func The function to wrap.
+ * @param {Function} transform The argument transform.
+ * @returns {Function} Returns the new function.
+ */
+function overArg(func, transform) {
+ return function(arg) {
+ return func(transform(arg));
+ };
+}
+
+/** Used for built-in method references. */
+var funcProto = Function.prototype,
+ objectProto = Object.prototype;
+
+/** Used to resolve the decompiled source of functions. */
+var funcToString = funcProto.toString;
+
+/** Used to check objects for own properties. */
+var hasOwnProperty = objectProto.hasOwnProperty;
+
+/** Used to infer the `Object` constructor. */
+var objectCtorString = funcToString.call(Object);
+
+/**
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+var objectToString = objectProto.toString;
+
+/** Built-in value references. */
+var getPrototype = overArg(Object.getPrototypeOf, Object);
+
+/**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+function isObjectLike(value) {
+ return !!value && typeof value == 'object';
+}
+
+/**
+ * Checks if `value` is a plain object, that is, an object created by the
+ * `Object` constructor or one with a `[[Prototype]]` of `null`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.8.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * }
+ *
+ * _.isPlainObject(new Foo);
+ * // => false
+ *
+ * _.isPlainObject([1, 2, 3]);
+ * // => false
+ *
+ * _.isPlainObject({ 'x': 0, 'y': 0 });
+ * // => true
+ *
+ * _.isPlainObject(Object.create(null));
+ * // => true
+ */
+function isPlainObject(value) {
+ if (!isObjectLike(value) ||
+ objectToString.call(value) != objectTag || isHostObject(value)) {
+ return false;
+ }
+ var proto = getPrototype(value);
+ if (proto === null) {
+ return true;
+ }
+ var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
+ return (typeof Ctor == 'function' &&
+ Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
+}
+
+module.exports = isPlainObject;
diff --git a/node_modules/lodash.isplainobject/package.json b/node_modules/lodash.isplainobject/package.json
new file mode 100644
index 0000000..86f6a07
--- /dev/null
+++ b/node_modules/lodash.isplainobject/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "lodash.isplainobject",
+ "version": "4.0.6",
+ "description": "The lodash method `_.isPlainObject` exported as a module.",
+ "homepage": "https://lodash.com/",
+ "icon": "https://lodash.com/icon.svg",
+ "license": "MIT",
+ "keywords": "lodash-modularized, isplainobject",
+ "author": "John-David Dalton (http://allyoucanleet.com/)",
+ "contributors": [
+ "John-David Dalton (http://allyoucanleet.com/)",
+ "Blaine Bublitz (https://github.com/phated)",
+ "Mathias Bynens (https://mathiasbynens.be/)"
+ ],
+ "repository": "lodash/lodash",
+ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }
+}
diff --git a/node_modules/lodash.isstring/LICENSE b/node_modules/lodash.isstring/LICENSE
new file mode 100644
index 0000000..b054ca5
--- /dev/null
+++ b/node_modules/lodash.isstring/LICENSE
@@ -0,0 +1,22 @@
+Copyright 2012-2016 The Dojo Foundation
+Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
+DocumentCloud and Investigative Reporters & Editors
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/lodash.isstring/README.md b/node_modules/lodash.isstring/README.md
new file mode 100644
index 0000000..f184029
--- /dev/null
+++ b/node_modules/lodash.isstring/README.md
@@ -0,0 +1,18 @@
+# lodash.isstring v4.0.1
+
+The [lodash](https://lodash.com/) method `_.isString` exported as a [Node.js](https://nodejs.org/) module.
+
+## Installation
+
+Using npm:
+```bash
+$ {sudo -H} npm i -g npm
+$ npm i --save lodash.isstring
+```
+
+In Node.js:
+```js
+var isString = require('lodash.isstring');
+```
+
+See the [documentation](https://lodash.com/docs#isString) or [package source](https://github.com/lodash/lodash/blob/4.0.1-npm-packages/lodash.isstring) for more details.
diff --git a/node_modules/lodash.isstring/index.js b/node_modules/lodash.isstring/index.js
new file mode 100644
index 0000000..408225c
--- /dev/null
+++ b/node_modules/lodash.isstring/index.js
@@ -0,0 +1,95 @@
+/**
+ * lodash 4.0.1 (Custom Build)
+ * Build: `lodash modularize exports="npm" -o ./`
+ * Copyright 2012-2016 The Dojo Foundation
+ * Based on Underscore.js 1.8.3
+ * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ * Available under MIT license
+ */
+
+/** `Object#toString` result references. */
+var stringTag = '[object String]';
+
+/** Used for built-in method references. */
+var objectProto = Object.prototype;
+
+/**
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+var objectToString = objectProto.toString;
+
+/**
+ * Checks if `value` is classified as an `Array` object.
+ *
+ * @static
+ * @memberOf _
+ * @type Function
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isArray([1, 2, 3]);
+ * // => true
+ *
+ * _.isArray(document.body.children);
+ * // => false
+ *
+ * _.isArray('abc');
+ * // => false
+ *
+ * _.isArray(_.noop);
+ * // => false
+ */
+var isArray = Array.isArray;
+
+/**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+function isObjectLike(value) {
+ return !!value && typeof value == 'object';
+}
+
+/**
+ * Checks if `value` is classified as a `String` primitive or object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isString('abc');
+ * // => true
+ *
+ * _.isString(1);
+ * // => false
+ */
+function isString(value) {
+ return typeof value == 'string' ||
+ (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);
+}
+
+module.exports = isString;
diff --git a/node_modules/lodash.isstring/package.json b/node_modules/lodash.isstring/package.json
new file mode 100644
index 0000000..1331535
--- /dev/null
+++ b/node_modules/lodash.isstring/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "lodash.isstring",
+ "version": "4.0.1",
+ "description": "The lodash method `_.isString` exported as a module.",
+ "homepage": "https://lodash.com/",
+ "icon": "https://lodash.com/icon.svg",
+ "license": "MIT",
+ "keywords": "lodash-modularized, isstring",
+ "author": "John-David Dalton (http://allyoucanleet.com/)",
+ "contributors": [
+ "John-David Dalton (http://allyoucanleet.com/)",
+ "Blaine Bublitz (https://github.com/phated)",
+ "Mathias Bynens (https://mathiasbynens.be/)"
+ ],
+ "repository": "lodash/lodash",
+ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }
+}
diff --git a/node_modules/lodash.once/LICENSE b/node_modules/lodash.once/LICENSE
new file mode 100644
index 0000000..e0c69d5
--- /dev/null
+++ b/node_modules/lodash.once/LICENSE
@@ -0,0 +1,47 @@
+Copyright jQuery Foundation and other contributors
+
+Based on Underscore.js, copyright Jeremy Ashkenas,
+DocumentCloud and Investigative Reporters & Editors
+
+This software consists of voluntary contributions made by many
+individuals. For exact contribution history, see the revision history
+available at https://github.com/lodash/lodash
+
+The following license applies to all parts of this software except as
+documented below:
+
+====
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+====
+
+Copyright and related rights for sample code are waived via CC0. Sample
+code is defined as all source code displayed within the prose of the
+documentation.
+
+CC0: http://creativecommons.org/publicdomain/zero/1.0/
+
+====
+
+Files located in the node_modules and vendor directories are externally
+maintained libraries used by this software which have their own
+licenses; we recommend you read them, as their terms may differ from the
+terms above.
diff --git a/node_modules/lodash.once/README.md b/node_modules/lodash.once/README.md
new file mode 100644
index 0000000..c4a2f16
--- /dev/null
+++ b/node_modules/lodash.once/README.md
@@ -0,0 +1,18 @@
+# lodash.once v4.1.1
+
+The [lodash](https://lodash.com/) method `_.once` exported as a [Node.js](https://nodejs.org/) module.
+
+## Installation
+
+Using npm:
+```bash
+$ {sudo -H} npm i -g npm
+$ npm i --save lodash.once
+```
+
+In Node.js:
+```js
+var once = require('lodash.once');
+```
+
+See the [documentation](https://lodash.com/docs#once) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.once) for more details.
diff --git a/node_modules/lodash.once/index.js b/node_modules/lodash.once/index.js
new file mode 100644
index 0000000..414ceb3
--- /dev/null
+++ b/node_modules/lodash.once/index.js
@@ -0,0 +1,294 @@
+/**
+ * lodash (Custom Build)
+ * Build: `lodash modularize exports="npm" -o ./`
+ * Copyright jQuery Foundation and other contributors
+ * Released under MIT license
+ * Based on Underscore.js 1.8.3
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ */
+
+/** Used as the `TypeError` message for "Functions" methods. */
+var FUNC_ERROR_TEXT = 'Expected a function';
+
+/** Used as references for various `Number` constants. */
+var INFINITY = 1 / 0,
+ MAX_INTEGER = 1.7976931348623157e+308,
+ NAN = 0 / 0;
+
+/** `Object#toString` result references. */
+var symbolTag = '[object Symbol]';
+
+/** Used to match leading and trailing whitespace. */
+var reTrim = /^\s+|\s+$/g;
+
+/** Used to detect bad signed hexadecimal string values. */
+var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
+
+/** Used to detect binary string values. */
+var reIsBinary = /^0b[01]+$/i;
+
+/** Used to detect octal string values. */
+var reIsOctal = /^0o[0-7]+$/i;
+
+/** Built-in method references without a dependency on `root`. */
+var freeParseInt = parseInt;
+
+/** Used for built-in method references. */
+var objectProto = Object.prototype;
+
+/**
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+var objectToString = objectProto.toString;
+
+/**
+ * Creates a function that invokes `func`, with the `this` binding and arguments
+ * of the created function, while it's called less than `n` times. Subsequent
+ * calls to the created function return the result of the last `func` invocation.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Function
+ * @param {number} n The number of calls at which `func` is no longer invoked.
+ * @param {Function} func The function to restrict.
+ * @returns {Function} Returns the new restricted function.
+ * @example
+ *
+ * jQuery(element).on('click', _.before(5, addContactToList));
+ * // => Allows adding up to 4 contacts to the list.
+ */
+function before(n, func) {
+ var result;
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ n = toInteger(n);
+ return function() {
+ if (--n > 0) {
+ result = func.apply(this, arguments);
+ }
+ if (n <= 1) {
+ func = undefined;
+ }
+ return result;
+ };
+}
+
+/**
+ * Creates a function that is restricted to invoking `func` once. Repeat calls
+ * to the function return the value of the first invocation. The `func` is
+ * invoked with the `this` binding and arguments of the created function.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Function
+ * @param {Function} func The function to restrict.
+ * @returns {Function} Returns the new restricted function.
+ * @example
+ *
+ * var initialize = _.once(createApplication);
+ * initialize();
+ * initialize();
+ * // => `createApplication` is invoked once
+ */
+function once(func) {
+ return before(2, func);
+}
+
+/**
+ * Checks if `value` is the
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
+ * @example
+ *
+ * _.isObject({});
+ * // => true
+ *
+ * _.isObject([1, 2, 3]);
+ * // => true
+ *
+ * _.isObject(_.noop);
+ * // => true
+ *
+ * _.isObject(null);
+ * // => false
+ */
+function isObject(value) {
+ var type = typeof value;
+ return !!value && (type == 'object' || type == 'function');
+}
+
+/**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+function isObjectLike(value) {
+ return !!value && typeof value == 'object';
+}
+
+/**
+ * Checks if `value` is classified as a `Symbol` primitive or object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
+ * @example
+ *
+ * _.isSymbol(Symbol.iterator);
+ * // => true
+ *
+ * _.isSymbol('abc');
+ * // => false
+ */
+function isSymbol(value) {
+ return typeof value == 'symbol' ||
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
+}
+
+/**
+ * Converts `value` to a finite number.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.12.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {number} Returns the converted number.
+ * @example
+ *
+ * _.toFinite(3.2);
+ * // => 3.2
+ *
+ * _.toFinite(Number.MIN_VALUE);
+ * // => 5e-324
+ *
+ * _.toFinite(Infinity);
+ * // => 1.7976931348623157e+308
+ *
+ * _.toFinite('3.2');
+ * // => 3.2
+ */
+function toFinite(value) {
+ if (!value) {
+ return value === 0 ? value : 0;
+ }
+ value = toNumber(value);
+ if (value === INFINITY || value === -INFINITY) {
+ var sign = (value < 0 ? -1 : 1);
+ return sign * MAX_INTEGER;
+ }
+ return value === value ? value : 0;
+}
+
+/**
+ * Converts `value` to an integer.
+ *
+ * **Note:** This method is loosely based on
+ * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {number} Returns the converted integer.
+ * @example
+ *
+ * _.toInteger(3.2);
+ * // => 3
+ *
+ * _.toInteger(Number.MIN_VALUE);
+ * // => 0
+ *
+ * _.toInteger(Infinity);
+ * // => 1.7976931348623157e+308
+ *
+ * _.toInteger('3.2');
+ * // => 3
+ */
+function toInteger(value) {
+ var result = toFinite(value),
+ remainder = result % 1;
+
+ return result === result ? (remainder ? result - remainder : result) : 0;
+}
+
+/**
+ * Converts `value` to a number.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to process.
+ * @returns {number} Returns the number.
+ * @example
+ *
+ * _.toNumber(3.2);
+ * // => 3.2
+ *
+ * _.toNumber(Number.MIN_VALUE);
+ * // => 5e-324
+ *
+ * _.toNumber(Infinity);
+ * // => Infinity
+ *
+ * _.toNumber('3.2');
+ * // => 3.2
+ */
+function toNumber(value) {
+ if (typeof value == 'number') {
+ return value;
+ }
+ if (isSymbol(value)) {
+ return NAN;
+ }
+ if (isObject(value)) {
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
+ value = isObject(other) ? (other + '') : other;
+ }
+ if (typeof value != 'string') {
+ return value === 0 ? value : +value;
+ }
+ value = value.replace(reTrim, '');
+ var isBinary = reIsBinary.test(value);
+ return (isBinary || reIsOctal.test(value))
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
+ : (reIsBadHex.test(value) ? NAN : +value);
+}
+
+module.exports = once;
diff --git a/node_modules/lodash.once/package.json b/node_modules/lodash.once/package.json
new file mode 100644
index 0000000..fae782c
--- /dev/null
+++ b/node_modules/lodash.once/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "lodash.once",
+ "version": "4.1.1",
+ "description": "The lodash method `_.once` exported as a module.",
+ "homepage": "https://lodash.com/",
+ "icon": "https://lodash.com/icon.svg",
+ "license": "MIT",
+ "keywords": "lodash-modularized, once",
+ "author": "John-David Dalton (http://allyoucanleet.com/)",
+ "contributors": [
+ "John-David Dalton (http://allyoucanleet.com/)",
+ "Blaine Bublitz (https://github.com/phated)",
+ "Mathias Bynens (https://mathiasbynens.be/)"
+ ],
+ "repository": "lodash/lodash",
+ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }
+}
diff --git a/node_modules/long/LICENSE b/node_modules/long/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/node_modules/long/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/node_modules/long/README.md b/node_modules/long/README.md
new file mode 100644
index 0000000..ab168f1
--- /dev/null
+++ b/node_modules/long/README.md
@@ -0,0 +1,280 @@
+long.js
+=======
+
+A Long class for representing a 64 bit two's-complement integer value derived from the [Closure Library](https://github.com/google/closure-library)
+for stand-alone use and extended with unsigned support.
+
+[](https://github.com/dcodeIO/long.js/actions?query=workflow%3ATest) [](https://github.com/dcodeIO/long.js/actions?query=workflow%3APublish) [](https://www.npmjs.com/package/long)
+
+Background
+----------
+
+As of [ECMA-262 5th Edition](http://ecma262-5.com/ELS5_HTML.htm#Section_8.5), "all the positive and negative integers
+whose magnitude is no greater than 253 are representable in the Number type", which is "representing the
+doubleprecision 64-bit format IEEE 754 values as specified in the IEEE Standard for Binary Floating-Point Arithmetic".
+The [maximum safe integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)
+in JavaScript is 253-1.
+
+Example: 264-1 is 1844674407370955**1615** but in JavaScript it evaluates to 1844674407370955**2000**.
+
+Furthermore, bitwise operators in JavaScript "deal only with integers in the range −231 through
+231−1, inclusive, or in the range 0 through 232−1, inclusive. These operators accept any value of
+the Number type but first convert each such value to one of 232 integer values."
+
+In some use cases, however, it is required to be able to reliably work with and perform bitwise operations on the full
+64 bits. This is where long.js comes into play.
+
+Usage
+-----
+
+The package exports an ECMAScript module with an UMD fallback.
+
+```
+$> npm install long
+```
+
+```js
+import Long from "long";
+
+var value = new Long(0xFFFFFFFF, 0x7FFFFFFF);
+console.log(value.toString());
+...
+```
+
+Note that mixing ESM and CommonJS is not recommended as it yields different classes, albeit with the same functionality.
+
+### Usage with a CDN
+
+ * From GitHub via [jsDelivr](https://www.jsdelivr.com):
+ `https://cdn.jsdelivr.net/gh/dcodeIO/long.js@TAG/index.js` (ESM)
+ * From npm via [jsDelivr](https://www.jsdelivr.com):
+ `https://cdn.jsdelivr.net/npm/long@VERSION/index.js` (ESM)
+ `https://cdn.jsdelivr.net/npm/long@VERSION/umd/index.js` (UMD)
+ * From npm via [unpkg](https://unpkg.com):
+ `https://unpkg.com/long@VERSION/index.js` (ESM)
+ `https://unpkg.com/long@VERSION/umd/index.js` (UMD)
+
+ Replace `TAG` respectively `VERSION` with a [specific version](https://github.com/dcodeIO/long.js/releases) or omit it (not recommended in production) to use main/latest.
+
+API
+---
+
+### Constructor
+
+* new **Long**(low: `number`, high?: `number`, unsigned?: `boolean`)
+ Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers. See the from* functions below for more convenient ways of constructing Longs.
+
+### Fields
+
+* Long#**low**: `number`
+ The low 32 bits as a signed value.
+
+* Long#**high**: `number`
+ The high 32 bits as a signed value.
+
+* Long#**unsigned**: `boolean`
+ Whether unsigned or not.
+
+### Constants
+
+* Long.**ZERO**: `Long`
+ Signed zero.
+
+* Long.**ONE**: `Long`
+ Signed one.
+
+* Long.**NEG_ONE**: `Long`
+ Signed negative one.
+
+* Long.**UZERO**: `Long`
+ Unsigned zero.
+
+* Long.**UONE**: `Long`
+ Unsigned one.
+
+* Long.**MAX_VALUE**: `Long`
+ Maximum signed value.
+
+* Long.**MIN_VALUE**: `Long`
+ Minimum signed value.
+
+* Long.**MAX_UNSIGNED_VALUE**: `Long`
+ Maximum unsigned value.
+
+### Utility
+
+* Long.**isLong**(obj: `*`): `boolean`
+ Tests if the specified object is a Long.
+
+* Long.**fromBits**(lowBits: `number`, highBits: `number`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits.
+
+* Long.**fromBytes**(bytes: `number[]`, unsigned?: `boolean`, le?: `boolean`): `Long`
+ Creates a Long from its byte representation.
+
+* Long.**fromBytesLE**(bytes: `number[]`, unsigned?: `boolean`): `Long`
+ Creates a Long from its little endian byte representation.
+
+* Long.**fromBytesBE**(bytes: `number[]`, unsigned?: `boolean`): `Long`
+ Creates a Long from its big endian byte representation.
+
+* Long.**fromInt**(value: `number`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the given 32 bit integer value.
+
+* Long.**fromNumber**(value: `number`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+
+* Long.**fromString**(str: `string`, unsigned?: `boolean`, radix?: `number`)
+ Long.**fromString**(str: `string`, radix: `number`)
+ Returns a Long representation of the given string, written using the specified radix.
+
+* Long.**fromValue**(val: `*`, unsigned?: `boolean`): `Long`
+ Converts the specified value to a Long using the appropriate from* function for its type.
+
+### Methods
+
+* Long#**add**(addend: `Long | number | string`): `Long`
+ Returns the sum of this and the specified Long.
+
+* Long#**and**(other: `Long | number | string`): `Long`
+ Returns the bitwise AND of this Long and the specified.
+
+* Long#**compare**/**comp**(other: `Long | number | string`): `number`
+ Compares this Long's value with the specified's. Returns `0` if they are the same, `1` if the this is greater and `-1` if the given one is greater.
+
+* Long#**divide**/**div**(divisor: `Long | number | string`): `Long`
+ Returns this Long divided by the specified.
+
+* Long#**equals**/**eq**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value equals the specified's.
+
+* Long#**getHighBits**(): `number`
+ Gets the high 32 bits as a signed integer.
+
+* Long#**getHighBitsUnsigned**(): `number`
+ Gets the high 32 bits as an unsigned integer.
+
+* Long#**getLowBits**(): `number`
+ Gets the low 32 bits as a signed integer.
+
+* Long#**getLowBitsUnsigned**(): `number`
+ Gets the low 32 bits as an unsigned integer.
+
+* Long#**getNumBitsAbs**(): `number`
+ Gets the number of bits needed to represent the absolute value of this Long.
+
+* Long#**greaterThan**/**gt**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value is greater than the specified's.
+
+* Long#**greaterThanOrEqual**/**gte**/**ge**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value is greater than or equal the specified's.
+
+* Long#**isEven**(): `boolean`
+ Tests if this Long's value is even.
+
+* Long#**isNegative**(): `boolean`
+ Tests if this Long's value is negative.
+
+* Long#**isOdd**(): `boolean`
+ Tests if this Long's value is odd.
+
+* Long#**isPositive**(): `boolean`
+ Tests if this Long's value is positive or zero.
+
+* Long#**isZero**/**eqz**(): `boolean`
+ Tests if this Long's value equals zero.
+
+* Long#**lessThan**/**lt**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value is less than the specified's.
+
+* Long#**lessThanOrEqual**/**lte**/**le**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value is less than or equal the specified's.
+
+* Long#**modulo**/**mod**/**rem**(divisor: `Long | number | string`): `Long`
+ Returns this Long modulo the specified.
+
+* Long#**multiply**/**mul**(multiplier: `Long | number | string`): `Long`
+ Returns the product of this and the specified Long.
+
+* Long#**negate**/**neg**(): `Long`
+ Negates this Long's value.
+
+* Long#**not**(): `Long`
+ Returns the bitwise NOT of this Long.
+
+* Long#**countLeadingZeros**/**clz**(): `number`
+ Returns count leading zeros of this Long.
+
+* Long#**countTrailingZeros**/**ctz**(): `number`
+ Returns count trailing zeros of this Long.
+
+* Long#**notEquals**/**neq**/**ne**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value differs from the specified's.
+
+* Long#**or**(other: `Long | number | string`): `Long`
+ Returns the bitwise OR of this Long and the specified.
+
+* Long#**shiftLeft**/**shl**(numBits: `Long | number | string`): `Long`
+ Returns this Long with bits shifted to the left by the given amount.
+
+* Long#**shiftRight**/**shr**(numBits: `Long | number | string`): `Long`
+ Returns this Long with bits arithmetically shifted to the right by the given amount.
+
+* Long#**shiftRightUnsigned**/**shru**/**shr_u**(numBits: `Long | number | string`): `Long`
+ Returns this Long with bits logically shifted to the right by the given amount.
+
+* Long#**rotateLeft**/**rotl**(numBits: `Long | number | string`): `Long`
+ Returns this Long with bits rotated to the left by the given amount.
+
+* Long#**rotateRight**/**rotr**(numBits: `Long | number | string`): `Long`
+ Returns this Long with bits rotated to the right by the given amount.
+
+* Long#**subtract**/**sub**(subtrahend: `Long | number | string`): `Long`
+ Returns the difference of this and the specified Long.
+
+* Long#**toBytes**(le?: `boolean`): `number[]`
+ Converts this Long to its byte representation.
+
+* Long#**toBytesLE**(): `number[]`
+ Converts this Long to its little endian byte representation.
+
+* Long#**toBytesBE**(): `number[]`
+ Converts this Long to its big endian byte representation.
+
+* Long#**toInt**(): `number`
+ Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
+
+* Long#**toNumber**(): `number`
+ Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
+
+* Long#**toSigned**(): `Long`
+ Converts this Long to signed.
+
+* Long#**toString**(radix?: `number`): `string`
+ Converts the Long to a string written in the specified radix.
+
+* Long#**toUnsigned**(): `Long`
+ Converts this Long to unsigned.
+
+* Long#**xor**(other: `Long | number | string`): `Long`
+ Returns the bitwise XOR of this Long and the given one.
+
+WebAssembly support
+-------------------
+
+[WebAssembly](http://webassembly.org) supports 64-bit integer arithmetic out of the box, hence a [tiny WebAssembly module](./wasm.wat) is used to compute operations like multiplication, division and remainder more efficiently (slow operations like division are around twice as fast), falling back to floating point based computations in JavaScript where WebAssembly is not yet supported, e.g., in older versions of node.
+
+Building
+--------
+
+Building the UMD fallback:
+
+```
+$> npm run build
+```
+
+Running the [tests](./tests):
+
+```
+$> npm test
+```
diff --git a/node_modules/long/index.d.ts b/node_modules/long/index.d.ts
new file mode 100644
index 0000000..521533d
--- /dev/null
+++ b/node_modules/long/index.d.ts
@@ -0,0 +1,457 @@
+declare class Long {
+ /**
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs.
+ */
+ constructor(low: number, high?: number, unsigned?: boolean);
+
+ /**
+ * Maximum unsigned value.
+ */
+ static MAX_UNSIGNED_VALUE: Long;
+
+ /**
+ * Maximum signed value.
+ */
+ static MAX_VALUE: Long;
+
+ /**
+ * Minimum signed value.
+ */
+ static MIN_VALUE: Long;
+
+ /**
+ * Signed negative one.
+ */
+ static NEG_ONE: Long;
+
+ /**
+ * Signed one.
+ */
+ static ONE: Long;
+
+ /**
+ * Unsigned one.
+ */
+ static UONE: Long;
+
+ /**
+ * Unsigned zero.
+ */
+ static UZERO: Long;
+
+ /**
+ * Signed zero
+ */
+ static ZERO: Long;
+
+ /**
+ * The high 32 bits as a signed value.
+ */
+ high: number;
+
+ /**
+ * The low 32 bits as a signed value.
+ */
+ low: number;
+
+ /**
+ * Whether unsigned or not.
+ */
+ unsigned: boolean;
+
+ /**
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits.
+ */
+ static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long;
+
+ /**
+ * Returns a Long representing the given 32 bit integer value.
+ */
+ static fromInt(value: number, unsigned?: boolean): Long;
+
+ /**
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+ */
+ static fromNumber(value: number, unsigned?: boolean): Long;
+
+ /**
+ * Returns a Long representation of the given string, written using the specified radix.
+ */
+ static fromString(
+ str: string,
+ unsigned?: boolean | number,
+ radix?: number
+ ): Long;
+
+ /**
+ * Creates a Long from its byte representation.
+ */
+ static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long;
+
+ /**
+ * Creates a Long from its little endian byte representation.
+ */
+ static fromBytesLE(bytes: number[], unsigned?: boolean): Long;
+
+ /**
+ * Creates a Long from its big endian byte representation.
+ */
+ static fromBytesBE(bytes: number[], unsigned?: boolean): Long;
+
+ /**
+ * Tests if the specified object is a Long.
+ */
+ static isLong(obj: any): obj is Long;
+
+ /**
+ * Converts the specified value to a Long.
+ */
+ static fromValue(
+ val:
+ | Long
+ | number
+ | string
+ | { low: number; high: number; unsigned: boolean },
+ unsigned?: boolean
+ ): Long;
+
+ /**
+ * Returns the sum of this and the specified Long.
+ */
+ add(addend: number | Long | string): Long;
+
+ /**
+ * Returns the bitwise AND of this Long and the specified.
+ */
+ and(other: Long | number | string): Long;
+
+ /**
+ * Compares this Long's value with the specified's.
+ */
+ compare(other: Long | number | string): number;
+
+ /**
+ * Compares this Long's value with the specified's.
+ */
+ comp(other: Long | number | string): number;
+
+ /**
+ * Returns this Long divided by the specified.
+ */
+ divide(divisor: Long | number | string): Long;
+
+ /**
+ * Returns this Long divided by the specified.
+ */
+ div(divisor: Long | number | string): Long;
+
+ /**
+ * Tests if this Long's value equals the specified's.
+ */
+ equals(other: Long | number | string): boolean;
+
+ /**
+ * Tests if this Long's value equals the specified's.
+ */
+ eq(other: Long | number | string): boolean;
+
+ /**
+ * Gets the high 32 bits as a signed integer.
+ */
+ getHighBits(): number;
+
+ /**
+ * Gets the high 32 bits as an unsigned integer.
+ */
+ getHighBitsUnsigned(): number;
+
+ /**
+ * Gets the low 32 bits as a signed integer.
+ */
+ getLowBits(): number;
+
+ /**
+ * Gets the low 32 bits as an unsigned integer.
+ */
+ getLowBitsUnsigned(): number;
+
+ /**
+ * Gets the number of bits needed to represent the absolute value of this Long.
+ */
+ getNumBitsAbs(): number;
+
+ /**
+ * Tests if this Long's value is greater than the specified's.
+ */
+ greaterThan(other: Long | number | string): boolean;
+
+ /**
+ * Tests if this Long's value is greater than the specified's.
+ */
+ gt(other: Long | number | string): boolean;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ */
+ greaterThanOrEqual(other: Long | number | string): boolean;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ */
+ gte(other: Long | number | string): boolean;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ */
+ ge(other: Long | number | string): boolean;
+
+ /**
+ * Tests if this Long's value is even.
+ */
+ isEven(): boolean;
+
+ /**
+ * Tests if this Long's value is negative.
+ */
+ isNegative(): boolean;
+
+ /**
+ * Tests if this Long's value is odd.
+ */
+ isOdd(): boolean;
+
+ /**
+ * Tests if this Long's value is positive or zero.
+ */
+ isPositive(): boolean;
+
+ /**
+ * Tests if this Long's value equals zero.
+ */
+ isZero(): boolean;
+
+ /**
+ * Tests if this Long's value equals zero.
+ */
+ eqz(): boolean;
+
+ /**
+ * Tests if this Long's value is less than the specified's.
+ */
+ lessThan(other: Long | number | string): boolean;
+
+ /**
+ * Tests if this Long's value is less than the specified's.
+ */
+ lt(other: Long | number | string): boolean;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ */
+ lessThanOrEqual(other: Long | number | string): boolean;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ */
+ lte(other: Long | number | string): boolean;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ */
+ le(other: Long | number | string): boolean;
+
+ /**
+ * Returns this Long modulo the specified.
+ */
+ modulo(other: Long | number | string): Long;
+
+ /**
+ * Returns this Long modulo the specified.
+ */
+ mod(other: Long | number | string): Long;
+
+ /**
+ * Returns this Long modulo the specified.
+ */
+ rem(other: Long | number | string): Long;
+
+ /**
+ * Returns the product of this and the specified Long.
+ */
+ multiply(multiplier: Long | number | string): Long;
+
+ /**
+ * Returns the product of this and the specified Long.
+ */
+ mul(multiplier: Long | number | string): Long;
+
+ /**
+ * Negates this Long's value.
+ */
+ negate(): Long;
+
+ /**
+ * Negates this Long's value.
+ */
+ neg(): Long;
+
+ /**
+ * Returns the bitwise NOT of this Long.
+ */
+ not(): Long;
+
+ /**
+ * Returns count leading zeros of this Long.
+ */
+ countLeadingZeros(): number;
+
+ /**
+ * Returns count leading zeros of this Long.
+ */
+ clz(): number;
+
+ /**
+ * Returns count trailing zeros of this Long.
+ */
+ countTrailingZeros(): number;
+
+ /**
+ * Returns count trailing zeros of this Long.
+ */
+ ctz(): number;
+
+ /**
+ * Tests if this Long's value differs from the specified's.
+ */
+ notEquals(other: Long | number | string): boolean;
+
+ /**
+ * Tests if this Long's value differs from the specified's.
+ */
+ neq(other: Long | number | string): boolean;
+
+ /**
+ * Tests if this Long's value differs from the specified's.
+ */
+ ne(other: Long | number | string): boolean;
+
+ /**
+ * Returns the bitwise OR of this Long and the specified.
+ */
+ or(other: Long | number | string): Long;
+
+ /**
+ * Returns this Long with bits shifted to the left by the given amount.
+ */
+ shiftLeft(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits shifted to the left by the given amount.
+ */
+ shl(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ */
+ shiftRight(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ */
+ shr(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ */
+ shiftRightUnsigned(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ */
+ shru(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ */
+ shr_u(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits rotated to the left by the given amount.
+ */
+ rotateLeft(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits rotated to the left by the given amount.
+ */
+ rotl(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits rotated to the right by the given amount.
+ */
+ rotateRight(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits rotated to the right by the given amount.
+ */
+ rotr(numBits: number | Long): Long;
+
+ /**
+ * Returns the difference of this and the specified Long.
+ */
+ subtract(subtrahend: number | Long | string): Long;
+
+ /**
+ * Returns the difference of this and the specified Long.
+ */
+ sub(subtrahend: number | Long | string): Long;
+
+ /**
+ * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
+ */
+ toInt(): number;
+
+ /**
+ * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
+ */
+ toNumber(): number;
+
+ /**
+ * Converts this Long to its byte representation.
+ */
+
+ toBytes(le?: boolean): number[];
+
+ /**
+ * Converts this Long to its little endian byte representation.
+ */
+
+ toBytesLE(): number[];
+
+ /**
+ * Converts this Long to its big endian byte representation.
+ */
+
+ toBytesBE(): number[];
+
+ /**
+ * Converts this Long to signed.
+ */
+ toSigned(): Long;
+
+ /**
+ * Converts the Long to a string written in the specified radix.
+ */
+ toString(radix?: number): string;
+
+ /**
+ * Converts this Long to unsigned.
+ */
+ toUnsigned(): Long;
+
+ /**
+ * Returns the bitwise XOR of this Long and the given one.
+ */
+ xor(other: Long | number | string): Long;
+}
+
+export default Long; // compatible with `import Long from "long"`
diff --git a/node_modules/long/index.js b/node_modules/long/index.js
new file mode 100644
index 0000000..f04775e
--- /dev/null
+++ b/node_modules/long/index.js
@@ -0,0 +1,1467 @@
+/**
+ * @license
+ * Copyright 2009 The Closure Library Authors
+ * Copyright 2020 Daniel Wirtz / The long.js Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+// WebAssembly optimizations to do native i64 multiplication and divide
+var wasm = null;
+try {
+ wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([
+ 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11
+ ])), {}).exports;
+} catch (e) {
+ // no wasm support :(
+}
+
+/**
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
+ * See the from* functions below for more convenient ways of constructing Longs.
+ * @exports Long
+ * @class A Long class for representing a 64 bit two's-complement integer value.
+ * @param {number} low The low (signed) 32 bits of the long
+ * @param {number} high The high (signed) 32 bits of the long
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @constructor
+ */
+function Long(low, high, unsigned) {
+
+ /**
+ * The low 32 bits as a signed value.
+ * @type {number}
+ */
+ this.low = low | 0;
+
+ /**
+ * The high 32 bits as a signed value.
+ * @type {number}
+ */
+ this.high = high | 0;
+
+ /**
+ * Whether unsigned or not.
+ * @type {boolean}
+ */
+ this.unsigned = !!unsigned;
+}
+
+// The internal representation of a long is the two given signed, 32-bit values.
+// We use 32-bit pieces because these are the size of integers on which
+// Javascript performs bit-operations. For operations like addition and
+// multiplication, we split each number into 16 bit pieces, which can easily be
+// multiplied within Javascript's floating-point representation without overflow
+// or change in sign.
+//
+// In the algorithms below, we frequently reduce the negative case to the
+// positive case by negating the input(s) and then post-processing the result.
+// Note that we must ALWAYS check specially whether those values are MIN_VALUE
+// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
+// a positive number, it overflows back into a negative). Not handling this
+// case would often result in infinite recursion.
+//
+// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
+// methods on which they depend.
+
+/**
+ * An indicator used to reliably determine if an object is a Long or not.
+ * @type {boolean}
+ * @const
+ * @private
+ */
+Long.prototype.__isLong__;
+
+Object.defineProperty(Long.prototype, "__isLong__", { value: true });
+
+/**
+ * @function
+ * @param {*} obj Object
+ * @returns {boolean}
+ * @inner
+ */
+function isLong(obj) {
+ return (obj && obj["__isLong__"]) === true;
+}
+
+/**
+ * @function
+ * @param {*} value number
+ * @returns {number}
+ * @inner
+ */
+function ctz32(value) {
+ var c = Math.clz32(value & -value);
+ return value ? 31 - c : c;
+}
+
+/**
+ * Tests if the specified object is a Long.
+ * @function
+ * @param {*} obj Object
+ * @returns {boolean}
+ */
+Long.isLong = isLong;
+
+/**
+ * A cache of the Long representations of small integer values.
+ * @type {!Object}
+ * @inner
+ */
+var INT_CACHE = {};
+
+/**
+ * A cache of the Long representations of small unsigned integer values.
+ * @type {!Object}
+ * @inner
+ */
+var UINT_CACHE = {};
+
+/**
+ * @param {number} value
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+function fromInt(value, unsigned) {
+ var obj, cachedObj, cache;
+ if (unsigned) {
+ value >>>= 0;
+ if (cache = (0 <= value && value < 256)) {
+ cachedObj = UINT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = fromBits(value, 0, true);
+ if (cache)
+ UINT_CACHE[value] = obj;
+ return obj;
+ } else {
+ value |= 0;
+ if (cache = (-128 <= value && value < 128)) {
+ cachedObj = INT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = fromBits(value, value < 0 ? -1 : 0, false);
+ if (cache)
+ INT_CACHE[value] = obj;
+ return obj;
+ }
+}
+
+/**
+ * Returns a Long representing the given 32 bit integer value.
+ * @function
+ * @param {number} value The 32 bit integer in question
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+Long.fromInt = fromInt;
+
+/**
+ * @param {number} value
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+function fromNumber(value, unsigned) {
+ if (isNaN(value))
+ return unsigned ? UZERO : ZERO;
+ if (unsigned) {
+ if (value < 0)
+ return UZERO;
+ if (value >= TWO_PWR_64_DBL)
+ return MAX_UNSIGNED_VALUE;
+ } else {
+ if (value <= -TWO_PWR_63_DBL)
+ return MIN_VALUE;
+ if (value + 1 >= TWO_PWR_63_DBL)
+ return MAX_VALUE;
+ }
+ if (value < 0)
+ return fromNumber(-value, unsigned).neg();
+ return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
+}
+
+/**
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+ * @function
+ * @param {number} value The number in question
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+Long.fromNumber = fromNumber;
+
+/**
+ * @param {number} lowBits
+ * @param {number} highBits
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+function fromBits(lowBits, highBits, unsigned) {
+ return new Long(lowBits, highBits, unsigned);
+}
+
+/**
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
+ * assumed to use 32 bits.
+ * @function
+ * @param {number} lowBits The low 32 bits
+ * @param {number} highBits The high 32 bits
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+Long.fromBits = fromBits;
+
+/**
+ * @function
+ * @param {number} base
+ * @param {number} exponent
+ * @returns {number}
+ * @inner
+ */
+var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
+
+/**
+ * @param {string} str
+ * @param {(boolean|number)=} unsigned
+ * @param {number=} radix
+ * @returns {!Long}
+ * @inner
+ */
+function fromString(str, unsigned, radix) {
+ if (str.length === 0)
+ throw Error('empty string');
+ if (typeof unsigned === 'number') {
+ // For goog.math.long compatibility
+ radix = unsigned;
+ unsigned = false;
+ } else {
+ unsigned = !!unsigned;
+ }
+ if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
+ return unsigned ? UZERO : ZERO;
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix)
+ throw RangeError('radix');
+
+ var p;
+ if ((p = str.indexOf('-')) > 0)
+ throw Error('interior hyphen');
+ else if (p === 0) {
+ return fromString(str.substring(1), unsigned, radix).neg();
+ }
+
+ // Do several (8) digits each time through the loop, so as to
+ // minimize the calls to the very expensive emulated div.
+ var radixToPower = fromNumber(pow_dbl(radix, 8));
+
+ var result = ZERO;
+ for (var i = 0; i < str.length; i += 8) {
+ var size = Math.min(8, str.length - i),
+ value = parseInt(str.substring(i, i + size), radix);
+ if (size < 8) {
+ var power = fromNumber(pow_dbl(radix, size));
+ result = result.mul(power).add(fromNumber(value));
+ } else {
+ result = result.mul(radixToPower);
+ result = result.add(fromNumber(value));
+ }
+ }
+ result.unsigned = unsigned;
+ return result;
+}
+
+/**
+ * Returns a Long representation of the given string, written using the specified radix.
+ * @function
+ * @param {string} str The textual representation of the Long
+ * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed
+ * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
+ * @returns {!Long} The corresponding Long value
+ */
+Long.fromString = fromString;
+
+/**
+ * @function
+ * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+function fromValue(val, unsigned) {
+ if (typeof val === 'number')
+ return fromNumber(val, unsigned);
+ if (typeof val === 'string')
+ return fromString(val, unsigned);
+ // Throws for non-objects, converts non-instanceof Long:
+ return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);
+}
+
+/**
+ * Converts the specified value to a Long using the appropriate from* function for its type.
+ * @function
+ * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long}
+ */
+Long.fromValue = fromValue;
+
+// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
+// no runtime penalty for these.
+
+/**
+ * @type {number}
+ * @const
+ * @inner
+ */
+var TWO_PWR_16_DBL = 1 << 16;
+
+/**
+ * @type {number}
+ * @const
+ * @inner
+ */
+var TWO_PWR_24_DBL = 1 << 24;
+
+/**
+ * @type {number}
+ * @const
+ * @inner
+ */
+var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
+
+/**
+ * @type {number}
+ * @const
+ * @inner
+ */
+var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
+
+/**
+ * @type {number}
+ * @const
+ * @inner
+ */
+var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
+
+/**
+ * @type {!Long}
+ * @const
+ * @inner
+ */
+var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var ZERO = fromInt(0);
+
+/**
+ * Signed zero.
+ * @type {!Long}
+ */
+Long.ZERO = ZERO;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var UZERO = fromInt(0, true);
+
+/**
+ * Unsigned zero.
+ * @type {!Long}
+ */
+Long.UZERO = UZERO;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var ONE = fromInt(1);
+
+/**
+ * Signed one.
+ * @type {!Long}
+ */
+Long.ONE = ONE;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var UONE = fromInt(1, true);
+
+/**
+ * Unsigned one.
+ * @type {!Long}
+ */
+Long.UONE = UONE;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var NEG_ONE = fromInt(-1);
+
+/**
+ * Signed negative one.
+ * @type {!Long}
+ */
+Long.NEG_ONE = NEG_ONE;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var MAX_VALUE = fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0, false);
+
+/**
+ * Maximum signed value.
+ * @type {!Long}
+ */
+Long.MAX_VALUE = MAX_VALUE;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF | 0, 0xFFFFFFFF | 0, true);
+
+/**
+ * Maximum unsigned value.
+ * @type {!Long}
+ */
+Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var MIN_VALUE = fromBits(0, 0x80000000 | 0, false);
+
+/**
+ * Minimum signed value.
+ * @type {!Long}
+ */
+Long.MIN_VALUE = MIN_VALUE;
+
+/**
+ * @alias Long.prototype
+ * @inner
+ */
+var LongPrototype = Long.prototype;
+
+/**
+ * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
+ * @this {!Long}
+ * @returns {number}
+ */
+LongPrototype.toInt = function toInt() {
+ return this.unsigned ? this.low >>> 0 : this.low;
+};
+
+/**
+ * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
+ * @this {!Long}
+ * @returns {number}
+ */
+LongPrototype.toNumber = function toNumber() {
+ if (this.unsigned)
+ return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
+};
+
+/**
+ * Converts the Long to a string written in the specified radix.
+ * @this {!Long}
+ * @param {number=} radix Radix (2-36), defaults to 10
+ * @returns {string}
+ * @override
+ * @throws {RangeError} If `radix` is out of range
+ */
+LongPrototype.toString = function toString(radix) {
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix)
+ throw RangeError('radix');
+ if (this.isZero())
+ return '0';
+ if (this.isNegative()) { // Unsigned Longs are never negative
+ if (this.eq(MIN_VALUE)) {
+ // We need to change the Long value before it can be negated, so we remove
+ // the bottom-most digit in this base and then recurse to do the rest.
+ var radixLong = fromNumber(radix),
+ div = this.div(radixLong),
+ rem1 = div.mul(radixLong).sub(this);
+ return div.toString(radix) + rem1.toInt().toString(radix);
+ } else
+ return '-' + this.neg().toString(radix);
+ }
+
+ // Do several (6) digits each time through the loop, so as to
+ // minimize the calls to the very expensive emulated div.
+ var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
+ rem = this;
+ var result = '';
+ while (true) {
+ var remDiv = rem.div(radixToPower),
+ intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
+ digits = intval.toString(radix);
+ rem = remDiv;
+ if (rem.isZero())
+ return digits + result;
+ else {
+ while (digits.length < 6)
+ digits = '0' + digits;
+ result = '' + digits + result;
+ }
+ }
+};
+
+/**
+ * Gets the high 32 bits as a signed integer.
+ * @this {!Long}
+ * @returns {number} Signed high bits
+ */
+LongPrototype.getHighBits = function getHighBits() {
+ return this.high;
+};
+
+/**
+ * Gets the high 32 bits as an unsigned integer.
+ * @this {!Long}
+ * @returns {number} Unsigned high bits
+ */
+LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
+ return this.high >>> 0;
+};
+
+/**
+ * Gets the low 32 bits as a signed integer.
+ * @this {!Long}
+ * @returns {number} Signed low bits
+ */
+LongPrototype.getLowBits = function getLowBits() {
+ return this.low;
+};
+
+/**
+ * Gets the low 32 bits as an unsigned integer.
+ * @this {!Long}
+ * @returns {number} Unsigned low bits
+ */
+LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
+ return this.low >>> 0;
+};
+
+/**
+ * Gets the number of bits needed to represent the absolute value of this Long.
+ * @this {!Long}
+ * @returns {number}
+ */
+LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
+ if (this.isNegative()) // Unsigned Longs are never negative
+ return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
+ var val = this.high != 0 ? this.high : this.low;
+ for (var bit = 31; bit > 0; bit--)
+ if ((val & (1 << bit)) != 0)
+ break;
+ return this.high != 0 ? bit + 33 : bit + 1;
+};
+
+/**
+ * Tests if this Long's value equals zero.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+LongPrototype.isZero = function isZero() {
+ return this.high === 0 && this.low === 0;
+};
+
+/**
+ * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.
+ * @returns {boolean}
+ */
+LongPrototype.eqz = LongPrototype.isZero;
+
+/**
+ * Tests if this Long's value is negative.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+LongPrototype.isNegative = function isNegative() {
+ return !this.unsigned && this.high < 0;
+};
+
+/**
+ * Tests if this Long's value is positive or zero.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+LongPrototype.isPositive = function isPositive() {
+ return this.unsigned || this.high >= 0;
+};
+
+/**
+ * Tests if this Long's value is odd.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+LongPrototype.isOdd = function isOdd() {
+ return (this.low & 1) === 1;
+};
+
+/**
+ * Tests if this Long's value is even.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+LongPrototype.isEven = function isEven() {
+ return (this.low & 1) === 0;
+};
+
+/**
+ * Tests if this Long's value equals the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.equals = function equals(other) {
+ if (!isLong(other))
+ other = fromValue(other);
+ if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
+ return false;
+ return this.high === other.high && this.low === other.low;
+};
+
+/**
+ * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.eq = LongPrototype.equals;
+
+/**
+ * Tests if this Long's value differs from the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.notEquals = function notEquals(other) {
+ return !this.eq(/* validates */ other);
+};
+
+/**
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.neq = LongPrototype.notEquals;
+
+/**
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.ne = LongPrototype.notEquals;
+
+/**
+ * Tests if this Long's value is less than the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.lessThan = function lessThan(other) {
+ return this.comp(/* validates */ other) < 0;
+};
+
+/**
+ * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.lt = LongPrototype.lessThan;
+
+/**
+ * Tests if this Long's value is less than or equal the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
+ return this.comp(/* validates */ other) <= 0;
+};
+
+/**
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.lte = LongPrototype.lessThanOrEqual;
+
+/**
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.le = LongPrototype.lessThanOrEqual;
+
+/**
+ * Tests if this Long's value is greater than the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.greaterThan = function greaterThan(other) {
+ return this.comp(/* validates */ other) > 0;
+};
+
+/**
+ * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.gt = LongPrototype.greaterThan;
+
+/**
+ * Tests if this Long's value is greater than or equal the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
+ return this.comp(/* validates */ other) >= 0;
+};
+
+/**
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.gte = LongPrototype.greaterThanOrEqual;
+
+/**
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.ge = LongPrototype.greaterThanOrEqual;
+
+/**
+ * Compares this Long's value with the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
+ * if the given one is greater
+ */
+LongPrototype.compare = function compare(other) {
+ if (!isLong(other))
+ other = fromValue(other);
+ if (this.eq(other))
+ return 0;
+ var thisNeg = this.isNegative(),
+ otherNeg = other.isNegative();
+ if (thisNeg && !otherNeg)
+ return -1;
+ if (!thisNeg && otherNeg)
+ return 1;
+ // At this point the sign bits are the same
+ if (!this.unsigned)
+ return this.sub(other).isNegative() ? -1 : 1;
+ // Both are positive if at least one is unsigned
+ return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
+};
+
+/**
+ * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
+ * if the given one is greater
+ */
+LongPrototype.comp = LongPrototype.compare;
+
+/**
+ * Negates this Long's value.
+ * @this {!Long}
+ * @returns {!Long} Negated Long
+ */
+LongPrototype.negate = function negate() {
+ if (!this.unsigned && this.eq(MIN_VALUE))
+ return MIN_VALUE;
+ return this.not().add(ONE);
+};
+
+/**
+ * Negates this Long's value. This is an alias of {@link Long#negate}.
+ * @function
+ * @returns {!Long} Negated Long
+ */
+LongPrototype.neg = LongPrototype.negate;
+
+/**
+ * Returns the sum of this and the specified Long.
+ * @this {!Long}
+ * @param {!Long|number|string} addend Addend
+ * @returns {!Long} Sum
+ */
+LongPrototype.add = function add(addend) {
+ if (!isLong(addend))
+ addend = fromValue(addend);
+
+ // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
+
+ var a48 = this.high >>> 16;
+ var a32 = this.high & 0xFFFF;
+ var a16 = this.low >>> 16;
+ var a00 = this.low & 0xFFFF;
+
+ var b48 = addend.high >>> 16;
+ var b32 = addend.high & 0xFFFF;
+ var b16 = addend.low >>> 16;
+ var b00 = addend.low & 0xFFFF;
+
+ var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 + b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xFFFF;
+ c16 += a16 + b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xFFFF;
+ c32 += a32 + b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xFFFF;
+ c48 += a48 + b48;
+ c48 &= 0xFFFF;
+ return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+};
+
+/**
+ * Returns the difference of this and the specified Long.
+ * @this {!Long}
+ * @param {!Long|number|string} subtrahend Subtrahend
+ * @returns {!Long} Difference
+ */
+LongPrototype.subtract = function subtract(subtrahend) {
+ if (!isLong(subtrahend))
+ subtrahend = fromValue(subtrahend);
+ return this.add(subtrahend.neg());
+};
+
+/**
+ * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
+ * @function
+ * @param {!Long|number|string} subtrahend Subtrahend
+ * @returns {!Long} Difference
+ */
+LongPrototype.sub = LongPrototype.subtract;
+
+/**
+ * Returns the product of this and the specified Long.
+ * @this {!Long}
+ * @param {!Long|number|string} multiplier Multiplier
+ * @returns {!Long} Product
+ */
+LongPrototype.multiply = function multiply(multiplier) {
+ if (this.isZero())
+ return this;
+ if (!isLong(multiplier))
+ multiplier = fromValue(multiplier);
+
+ // use wasm support if present
+ if (wasm) {
+ var low = wasm["mul"](this.low,
+ this.high,
+ multiplier.low,
+ multiplier.high);
+ return fromBits(low, wasm["get_high"](), this.unsigned);
+ }
+
+ if (multiplier.isZero())
+ return this.unsigned ? UZERO : ZERO;
+ if (this.eq(MIN_VALUE))
+ return multiplier.isOdd() ? MIN_VALUE : ZERO;
+ if (multiplier.eq(MIN_VALUE))
+ return this.isOdd() ? MIN_VALUE : ZERO;
+
+ if (this.isNegative()) {
+ if (multiplier.isNegative())
+ return this.neg().mul(multiplier.neg());
+ else
+ return this.neg().mul(multiplier).neg();
+ } else if (multiplier.isNegative())
+ return this.mul(multiplier.neg()).neg();
+
+ // If both longs are small, use float multiplication
+ if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
+ return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
+
+ // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
+ // We can skip products that would overflow.
+
+ var a48 = this.high >>> 16;
+ var a32 = this.high & 0xFFFF;
+ var a16 = this.low >>> 16;
+ var a00 = this.low & 0xFFFF;
+
+ var b48 = multiplier.high >>> 16;
+ var b32 = multiplier.high & 0xFFFF;
+ var b16 = multiplier.low >>> 16;
+ var b00 = multiplier.low & 0xFFFF;
+
+ var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 * b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xFFFF;
+ c16 += a16 * b00;
+ c32 += c16 >>> 16;
+ c16 &= 0xFFFF;
+ c16 += a00 * b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xFFFF;
+ c32 += a32 * b00;
+ c48 += c32 >>> 16;
+ c32 &= 0xFFFF;
+ c32 += a16 * b16;
+ c48 += c32 >>> 16;
+ c32 &= 0xFFFF;
+ c32 += a00 * b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xFFFF;
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
+ c48 &= 0xFFFF;
+ return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+};
+
+/**
+ * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
+ * @function
+ * @param {!Long|number|string} multiplier Multiplier
+ * @returns {!Long} Product
+ */
+LongPrototype.mul = LongPrototype.multiply;
+
+/**
+ * Returns this Long divided by the specified. The result is signed if this Long is signed or
+ * unsigned if this Long is unsigned.
+ * @this {!Long}
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Quotient
+ */
+LongPrototype.divide = function divide(divisor) {
+ if (!isLong(divisor))
+ divisor = fromValue(divisor);
+ if (divisor.isZero())
+ throw Error('division by zero');
+
+ // use wasm support if present
+ if (wasm) {
+ // guard against signed division overflow: the largest
+ // negative number / -1 would be 1 larger than the largest
+ // positive number, due to two's complement.
+ if (!this.unsigned &&
+ this.high === -0x80000000 &&
+ divisor.low === -1 && divisor.high === -1) {
+ // be consistent with non-wasm code path
+ return this;
+ }
+ var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])(
+ this.low,
+ this.high,
+ divisor.low,
+ divisor.high
+ );
+ return fromBits(low, wasm["get_high"](), this.unsigned);
+ }
+
+ if (this.isZero())
+ return this.unsigned ? UZERO : ZERO;
+ var approx, rem, res;
+ if (!this.unsigned) {
+ // This section is only relevant for signed longs and is derived from the
+ // closure library as a whole.
+ if (this.eq(MIN_VALUE)) {
+ if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
+ return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
+ else if (divisor.eq(MIN_VALUE))
+ return ONE;
+ else {
+ // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
+ var halfThis = this.shr(1);
+ approx = halfThis.div(divisor).shl(1);
+ if (approx.eq(ZERO)) {
+ return divisor.isNegative() ? ONE : NEG_ONE;
+ } else {
+ rem = this.sub(divisor.mul(approx));
+ res = approx.add(rem.div(divisor));
+ return res;
+ }
+ }
+ } else if (divisor.eq(MIN_VALUE))
+ return this.unsigned ? UZERO : ZERO;
+ if (this.isNegative()) {
+ if (divisor.isNegative())
+ return this.neg().div(divisor.neg());
+ return this.neg().div(divisor).neg();
+ } else if (divisor.isNegative())
+ return this.div(divisor.neg()).neg();
+ res = ZERO;
+ } else {
+ // The algorithm below has not been made for unsigned longs. It's therefore
+ // required to take special care of the MSB prior to running it.
+ if (!divisor.unsigned)
+ divisor = divisor.toUnsigned();
+ if (divisor.gt(this))
+ return UZERO;
+ if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
+ return UONE;
+ res = UZERO;
+ }
+
+ // Repeat the following until the remainder is less than other: find a
+ // floating-point that approximates remainder / other *from below*, add this
+ // into the result, and subtract it from the remainder. It is critical that
+ // the approximate value is less than or equal to the real value so that the
+ // remainder never becomes negative.
+ rem = this;
+ while (rem.gte(divisor)) {
+ // Approximate the result of division. This may be a little greater or
+ // smaller than the actual value.
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
+
+ // We will tweak the approximate result by changing it in the 48-th digit or
+ // the smallest non-fractional digit, whichever is larger.
+ var log2 = Math.ceil(Math.log(approx) / Math.LN2),
+ delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),
+
+ // Decrease the approximation until it is smaller than the remainder. Note
+ // that if it is too large, the product overflows and is negative.
+ approxRes = fromNumber(approx),
+ approxRem = approxRes.mul(divisor);
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
+ approx -= delta;
+ approxRes = fromNumber(approx, this.unsigned);
+ approxRem = approxRes.mul(divisor);
+ }
+
+ // We know the answer can't be zero... and actually, zero would cause
+ // infinite recursion since we would make no progress.
+ if (approxRes.isZero())
+ approxRes = ONE;
+
+ res = res.add(approxRes);
+ rem = rem.sub(approxRem);
+ }
+ return res;
+};
+
+/**
+ * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
+ * @function
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Quotient
+ */
+LongPrototype.div = LongPrototype.divide;
+
+/**
+ * Returns this Long modulo the specified.
+ * @this {!Long}
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+LongPrototype.modulo = function modulo(divisor) {
+ if (!isLong(divisor))
+ divisor = fromValue(divisor);
+
+ // use wasm support if present
+ if (wasm) {
+ var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(
+ this.low,
+ this.high,
+ divisor.low,
+ divisor.high
+ );
+ return fromBits(low, wasm["get_high"](), this.unsigned);
+ }
+
+ return this.sub(this.div(divisor).mul(divisor));
+};
+
+/**
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
+ * @function
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+LongPrototype.mod = LongPrototype.modulo;
+
+/**
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
+ * @function
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+LongPrototype.rem = LongPrototype.modulo;
+
+/**
+ * Returns the bitwise NOT of this Long.
+ * @this {!Long}
+ * @returns {!Long}
+ */
+LongPrototype.not = function not() {
+ return fromBits(~this.low, ~this.high, this.unsigned);
+};
+
+/**
+ * Returns count leading zeros of this Long.
+ * @this {!Long}
+ * @returns {!number}
+ */
+LongPrototype.countLeadingZeros = function countLeadingZeros() {
+ return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;
+};
+
+/**
+ * Returns count leading zeros. This is an alias of {@link Long#countLeadingZeros}.
+ * @function
+ * @param {!Long}
+ * @returns {!number}
+ */
+LongPrototype.clz = LongPrototype.countLeadingZeros;
+
+/**
+ * Returns count trailing zeros of this Long.
+ * @this {!Long}
+ * @returns {!number}
+ */
+LongPrototype.countTrailingZeros = function countTrailingZeros() {
+ return this.low ? ctz32(this.low) : ctz32(this.high) + 32;
+};
+
+/**
+ * Returns count trailing zeros. This is an alias of {@link Long#countTrailingZeros}.
+ * @function
+ * @param {!Long}
+ * @returns {!number}
+ */
+LongPrototype.ctz = LongPrototype.countTrailingZeros;
+
+/**
+ * Returns the bitwise AND of this Long and the specified.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other Long
+ * @returns {!Long}
+ */
+LongPrototype.and = function and(other) {
+ if (!isLong(other))
+ other = fromValue(other);
+ return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
+};
+
+/**
+ * Returns the bitwise OR of this Long and the specified.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other Long
+ * @returns {!Long}
+ */
+LongPrototype.or = function or(other) {
+ if (!isLong(other))
+ other = fromValue(other);
+ return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
+};
+
+/**
+ * Returns the bitwise XOR of this Long and the given one.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other Long
+ * @returns {!Long}
+ */
+LongPrototype.xor = function xor(other) {
+ if (!isLong(other))
+ other = fromValue(other);
+ return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
+};
+
+/**
+ * Returns this Long with bits shifted to the left by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shiftLeft = function shiftLeft(numBits) {
+ if (isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
+ else
+ return fromBits(0, this.low << (numBits - 32), this.unsigned);
+};
+
+/**
+ * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shl = LongPrototype.shiftLeft;
+
+/**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shiftRight = function shiftRight(numBits) {
+ if (isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
+ else
+ return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
+};
+
+/**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shr = LongPrototype.shiftRight;
+
+/**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ if (numBits < 32) return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >>> numBits, this.unsigned);
+ if (numBits === 32) return fromBits(this.high, 0, this.unsigned);
+ return fromBits(this.high >>> (numBits - 32), 0, this.unsigned);
+};
+
+/**
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shru = LongPrototype.shiftRightUnsigned;
+
+/**
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
+
+/**
+ * Returns this Long with bits rotated to the left by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+LongPrototype.rotateLeft = function rotateLeft(numBits) {
+ var b;
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
+ if (numBits < 32) {
+ b = (32 - numBits);
+ return fromBits(((this.low << numBits) | (this.high >>> b)), ((this.high << numBits) | (this.low >>> b)), this.unsigned);
+ }
+ numBits -= 32;
+ b = (32 - numBits);
+ return fromBits(((this.high << numBits) | (this.low >>> b)), ((this.low << numBits) | (this.high >>> b)), this.unsigned);
+}
+/**
+ * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+LongPrototype.rotl = LongPrototype.rotateLeft;
+
+/**
+ * Returns this Long with bits rotated to the right by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+LongPrototype.rotateRight = function rotateRight(numBits) {
+ var b;
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
+ if (numBits < 32) {
+ b = (32 - numBits);
+ return fromBits(((this.high << b) | (this.low >>> numBits)), ((this.low << b) | (this.high >>> numBits)), this.unsigned);
+ }
+ numBits -= 32;
+ b = (32 - numBits);
+ return fromBits(((this.low << b) | (this.high >>> numBits)), ((this.high << b) | (this.low >>> numBits)), this.unsigned);
+}
+/**
+ * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+LongPrototype.rotr = LongPrototype.rotateRight;
+
+/**
+ * Converts this Long to signed.
+ * @this {!Long}
+ * @returns {!Long} Signed long
+ */
+LongPrototype.toSigned = function toSigned() {
+ if (!this.unsigned)
+ return this;
+ return fromBits(this.low, this.high, false);
+};
+
+/**
+ * Converts this Long to unsigned.
+ * @this {!Long}
+ * @returns {!Long} Unsigned long
+ */
+LongPrototype.toUnsigned = function toUnsigned() {
+ if (this.unsigned)
+ return this;
+ return fromBits(this.low, this.high, true);
+};
+
+/**
+ * Converts this Long to its byte representation.
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
+ * @this {!Long}
+ * @returns {!Array.} Byte representation
+ */
+LongPrototype.toBytes = function toBytes(le) {
+ return le ? this.toBytesLE() : this.toBytesBE();
+};
+
+/**
+ * Converts this Long to its little endian byte representation.
+ * @this {!Long}
+ * @returns {!Array.} Little endian byte representation
+ */
+LongPrototype.toBytesLE = function toBytesLE() {
+ var hi = this.high,
+ lo = this.low;
+ return [
+ lo & 0xff,
+ lo >>> 8 & 0xff,
+ lo >>> 16 & 0xff,
+ lo >>> 24,
+ hi & 0xff,
+ hi >>> 8 & 0xff,
+ hi >>> 16 & 0xff,
+ hi >>> 24
+ ];
+};
+
+/**
+ * Converts this Long to its big endian byte representation.
+ * @this {!Long}
+ * @returns {!Array.} Big endian byte representation
+ */
+LongPrototype.toBytesBE = function toBytesBE() {
+ var hi = this.high,
+ lo = this.low;
+ return [
+ hi >>> 24,
+ hi >>> 16 & 0xff,
+ hi >>> 8 & 0xff,
+ hi & 0xff,
+ lo >>> 24,
+ lo >>> 16 & 0xff,
+ lo >>> 8 & 0xff,
+ lo & 0xff
+ ];
+};
+
+/**
+ * Creates a Long from its byte representation.
+ * @param {!Array.} bytes Byte representation
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
+ * @returns {Long} The corresponding Long value
+ */
+Long.fromBytes = function fromBytes(bytes, unsigned, le) {
+ return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
+};
+
+/**
+ * Creates a Long from its little endian byte representation.
+ * @param {!Array.} bytes Little endian byte representation
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {Long} The corresponding Long value
+ */
+Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
+ return new Long(
+ bytes[0] |
+ bytes[1] << 8 |
+ bytes[2] << 16 |
+ bytes[3] << 24,
+ bytes[4] |
+ bytes[5] << 8 |
+ bytes[6] << 16 |
+ bytes[7] << 24,
+ unsigned
+ );
+};
+
+/**
+ * Creates a Long from its big endian byte representation.
+ * @param {!Array.} bytes Big endian byte representation
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {Long} The corresponding Long value
+ */
+Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
+ return new Long(
+ bytes[4] << 24 |
+ bytes[5] << 16 |
+ bytes[6] << 8 |
+ bytes[7],
+ bytes[0] << 24 |
+ bytes[1] << 16 |
+ bytes[2] << 8 |
+ bytes[3],
+ unsigned
+ );
+};
+
+export default Long;
diff --git a/node_modules/long/package.json b/node_modules/long/package.json
new file mode 100644
index 0000000..3a06362
--- /dev/null
+++ b/node_modules/long/package.json
@@ -0,0 +1,50 @@
+{
+ "name": "long",
+ "version": "5.2.3",
+ "author": "Daniel Wirtz ",
+ "description": "A Long class for representing a 64-bit two's-complement integer value.",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dcodeIO/long.js.git"
+ },
+ "bugs": {
+ "url": "https://github.com/dcodeIO/long.js/issues"
+ },
+ "keywords": [
+ "math",
+ "long",
+ "int64"
+ ],
+ "license": "Apache-2.0",
+ "type": "module",
+ "main": "umd/index.js",
+ "types": "umd/index.d.ts",
+ "exports": {
+ ".": {
+ "import": {
+ "types": "./index.d.ts",
+ "default": "./index.js"
+ },
+ "require": {
+ "types": "./umd/index.d.ts",
+ "default": "./umd/index.js"
+ }
+ }
+ },
+ "scripts": {
+ "build": "esm2umd Long index.js > umd/index.js",
+ "test": "node tests"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts",
+ "umd/index.js",
+ "umd/index.d.ts",
+ "umd/package.json",
+ "LICENSE",
+ "README.md"
+ ],
+ "devDependencies": {
+ "esm2umd": "^0.2.1"
+ }
+}
diff --git a/node_modules/long/umd/index.d.ts b/node_modules/long/umd/index.d.ts
new file mode 100644
index 0000000..c623535
--- /dev/null
+++ b/node_modules/long/umd/index.d.ts
@@ -0,0 +1,2 @@
+import Long from "../index.js";
+export = Long;
diff --git a/node_modules/long/umd/index.js b/node_modules/long/umd/index.js
new file mode 100644
index 0000000..a6ccd9c
--- /dev/null
+++ b/node_modules/long/umd/index.js
@@ -0,0 +1,1432 @@
+// GENERATED FILE. DO NOT EDIT.
+var Long = (function(exports) {
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ exports.default = void 0;
+
+ /**
+ * @license
+ * Copyright 2009 The Closure Library Authors
+ * Copyright 2020 Daniel Wirtz / The long.js Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+ // WebAssembly optimizations to do native i64 multiplication and divide
+ var wasm = null;
+
+ try {
+ wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11])), {}).exports;
+ } catch (e) {// no wasm support :(
+ }
+ /**
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
+ * See the from* functions below for more convenient ways of constructing Longs.
+ * @exports Long
+ * @class A Long class for representing a 64 bit two's-complement integer value.
+ * @param {number} low The low (signed) 32 bits of the long
+ * @param {number} high The high (signed) 32 bits of the long
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @constructor
+ */
+
+
+ function Long(low, high, unsigned) {
+ /**
+ * The low 32 bits as a signed value.
+ * @type {number}
+ */
+ this.low = low | 0;
+ /**
+ * The high 32 bits as a signed value.
+ * @type {number}
+ */
+
+ this.high = high | 0;
+ /**
+ * Whether unsigned or not.
+ * @type {boolean}
+ */
+
+ this.unsigned = !!unsigned;
+ } // The internal representation of a long is the two given signed, 32-bit values.
+ // We use 32-bit pieces because these are the size of integers on which
+ // Javascript performs bit-operations. For operations like addition and
+ // multiplication, we split each number into 16 bit pieces, which can easily be
+ // multiplied within Javascript's floating-point representation without overflow
+ // or change in sign.
+ //
+ // In the algorithms below, we frequently reduce the negative case to the
+ // positive case by negating the input(s) and then post-processing the result.
+ // Note that we must ALWAYS check specially whether those values are MIN_VALUE
+ // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
+ // a positive number, it overflows back into a negative). Not handling this
+ // case would often result in infinite recursion.
+ //
+ // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
+ // methods on which they depend.
+
+ /**
+ * An indicator used to reliably determine if an object is a Long or not.
+ * @type {boolean}
+ * @const
+ * @private
+ */
+
+
+ Long.prototype.__isLong__;
+ Object.defineProperty(Long.prototype, "__isLong__", {
+ value: true
+ });
+ /**
+ * @function
+ * @param {*} obj Object
+ * @returns {boolean}
+ * @inner
+ */
+
+ function isLong(obj) {
+ return (obj && obj["__isLong__"]) === true;
+ }
+ /**
+ * @function
+ * @param {*} value number
+ * @returns {number}
+ * @inner
+ */
+
+
+ function ctz32(value) {
+ var c = Math.clz32(value & -value);
+ return value ? 31 - c : c;
+ }
+ /**
+ * Tests if the specified object is a Long.
+ * @function
+ * @param {*} obj Object
+ * @returns {boolean}
+ */
+
+
+ Long.isLong = isLong;
+ /**
+ * A cache of the Long representations of small integer values.
+ * @type {!Object}
+ * @inner
+ */
+
+ var INT_CACHE = {};
+ /**
+ * A cache of the Long representations of small unsigned integer values.
+ * @type {!Object}
+ * @inner
+ */
+
+ var UINT_CACHE = {};
+ /**
+ * @param {number} value
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+
+ function fromInt(value, unsigned) {
+ var obj, cachedObj, cache;
+
+ if (unsigned) {
+ value >>>= 0;
+
+ if (cache = 0 <= value && value < 256) {
+ cachedObj = UINT_CACHE[value];
+ if (cachedObj) return cachedObj;
+ }
+
+ obj = fromBits(value, 0, true);
+ if (cache) UINT_CACHE[value] = obj;
+ return obj;
+ } else {
+ value |= 0;
+
+ if (cache = -128 <= value && value < 128) {
+ cachedObj = INT_CACHE[value];
+ if (cachedObj) return cachedObj;
+ }
+
+ obj = fromBits(value, value < 0 ? -1 : 0, false);
+ if (cache) INT_CACHE[value] = obj;
+ return obj;
+ }
+ }
+ /**
+ * Returns a Long representing the given 32 bit integer value.
+ * @function
+ * @param {number} value The 32 bit integer in question
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+
+
+ Long.fromInt = fromInt;
+ /**
+ * @param {number} value
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+
+ function fromNumber(value, unsigned) {
+ if (isNaN(value)) return unsigned ? UZERO : ZERO;
+
+ if (unsigned) {
+ if (value < 0) return UZERO;
+ if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
+ } else {
+ if (value <= -TWO_PWR_63_DBL) return MIN_VALUE;
+ if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
+ }
+
+ if (value < 0) return fromNumber(-value, unsigned).neg();
+ return fromBits(value % TWO_PWR_32_DBL | 0, value / TWO_PWR_32_DBL | 0, unsigned);
+ }
+ /**
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+ * @function
+ * @param {number} value The number in question
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+
+
+ Long.fromNumber = fromNumber;
+ /**
+ * @param {number} lowBits
+ * @param {number} highBits
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+
+ function fromBits(lowBits, highBits, unsigned) {
+ return new Long(lowBits, highBits, unsigned);
+ }
+ /**
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
+ * assumed to use 32 bits.
+ * @function
+ * @param {number} lowBits The low 32 bits
+ * @param {number} highBits The high 32 bits
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+
+
+ Long.fromBits = fromBits;
+ /**
+ * @function
+ * @param {number} base
+ * @param {number} exponent
+ * @returns {number}
+ * @inner
+ */
+
+ var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
+
+ /**
+ * @param {string} str
+ * @param {(boolean|number)=} unsigned
+ * @param {number=} radix
+ * @returns {!Long}
+ * @inner
+ */
+
+ function fromString(str, unsigned, radix) {
+ if (str.length === 0) throw Error('empty string');
+
+ if (typeof unsigned === 'number') {
+ // For goog.math.long compatibility
+ radix = unsigned;
+ unsigned = false;
+ } else {
+ unsigned = !!unsigned;
+ }
+
+ if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity") return unsigned ? UZERO : ZERO;
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix) throw RangeError('radix');
+ var p;
+ if ((p = str.indexOf('-')) > 0) throw Error('interior hyphen');else if (p === 0) {
+ return fromString(str.substring(1), unsigned, radix).neg();
+ } // Do several (8) digits each time through the loop, so as to
+ // minimize the calls to the very expensive emulated div.
+
+ var radixToPower = fromNumber(pow_dbl(radix, 8));
+ var result = ZERO;
+
+ for (var i = 0; i < str.length; i += 8) {
+ var size = Math.min(8, str.length - i),
+ value = parseInt(str.substring(i, i + size), radix);
+
+ if (size < 8) {
+ var power = fromNumber(pow_dbl(radix, size));
+ result = result.mul(power).add(fromNumber(value));
+ } else {
+ result = result.mul(radixToPower);
+ result = result.add(fromNumber(value));
+ }
+ }
+
+ result.unsigned = unsigned;
+ return result;
+ }
+ /**
+ * Returns a Long representation of the given string, written using the specified radix.
+ * @function
+ * @param {string} str The textual representation of the Long
+ * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed
+ * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
+ * @returns {!Long} The corresponding Long value
+ */
+
+
+ Long.fromString = fromString;
+ /**
+ * @function
+ * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+
+ function fromValue(val, unsigned) {
+ if (typeof val === 'number') return fromNumber(val, unsigned);
+ if (typeof val === 'string') return fromString(val, unsigned); // Throws for non-objects, converts non-instanceof Long:
+
+ return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);
+ }
+ /**
+ * Converts the specified value to a Long using the appropriate from* function for its type.
+ * @function
+ * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long}
+ */
+
+
+ Long.fromValue = fromValue; // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
+ // no runtime penalty for these.
+
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+
+ var TWO_PWR_16_DBL = 1 << 16;
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+
+ var TWO_PWR_24_DBL = 1 << 24;
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+
+ var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+
+ var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+
+ var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
+ /**
+ * @type {!Long}
+ * @const
+ * @inner
+ */
+
+ var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
+ /**
+ * @type {!Long}
+ * @inner
+ */
+
+ var ZERO = fromInt(0);
+ /**
+ * Signed zero.
+ * @type {!Long}
+ */
+
+ Long.ZERO = ZERO;
+ /**
+ * @type {!Long}
+ * @inner
+ */
+
+ var UZERO = fromInt(0, true);
+ /**
+ * Unsigned zero.
+ * @type {!Long}
+ */
+
+ Long.UZERO = UZERO;
+ /**
+ * @type {!Long}
+ * @inner
+ */
+
+ var ONE = fromInt(1);
+ /**
+ * Signed one.
+ * @type {!Long}
+ */
+
+ Long.ONE = ONE;
+ /**
+ * @type {!Long}
+ * @inner
+ */
+
+ var UONE = fromInt(1, true);
+ /**
+ * Unsigned one.
+ * @type {!Long}
+ */
+
+ Long.UONE = UONE;
+ /**
+ * @type {!Long}
+ * @inner
+ */
+
+ var NEG_ONE = fromInt(-1);
+ /**
+ * Signed negative one.
+ * @type {!Long}
+ */
+
+ Long.NEG_ONE = NEG_ONE;
+ /**
+ * @type {!Long}
+ * @inner
+ */
+
+ var MAX_VALUE = fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0, false);
+ /**
+ * Maximum signed value.
+ * @type {!Long}
+ */
+
+ Long.MAX_VALUE = MAX_VALUE;
+ /**
+ * @type {!Long}
+ * @inner
+ */
+
+ var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF | 0, 0xFFFFFFFF | 0, true);
+ /**
+ * Maximum unsigned value.
+ * @type {!Long}
+ */
+
+ Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
+ /**
+ * @type {!Long}
+ * @inner
+ */
+
+ var MIN_VALUE = fromBits(0, 0x80000000 | 0, false);
+ /**
+ * Minimum signed value.
+ * @type {!Long}
+ */
+
+ Long.MIN_VALUE = MIN_VALUE;
+ /**
+ * @alias Long.prototype
+ * @inner
+ */
+
+ var LongPrototype = Long.prototype;
+ /**
+ * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
+ * @this {!Long}
+ * @returns {number}
+ */
+
+ LongPrototype.toInt = function toInt() {
+ return this.unsigned ? this.low >>> 0 : this.low;
+ };
+ /**
+ * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
+ * @this {!Long}
+ * @returns {number}
+ */
+
+
+ LongPrototype.toNumber = function toNumber() {
+ if (this.unsigned) return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
+ };
+ /**
+ * Converts the Long to a string written in the specified radix.
+ * @this {!Long}
+ * @param {number=} radix Radix (2-36), defaults to 10
+ * @returns {string}
+ * @override
+ * @throws {RangeError} If `radix` is out of range
+ */
+
+
+ LongPrototype.toString = function toString(radix) {
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix) throw RangeError('radix');
+ if (this.isZero()) return '0';
+
+ if (this.isNegative()) {
+ // Unsigned Longs are never negative
+ if (this.eq(MIN_VALUE)) {
+ // We need to change the Long value before it can be negated, so we remove
+ // the bottom-most digit in this base and then recurse to do the rest.
+ var radixLong = fromNumber(radix),
+ div = this.div(radixLong),
+ rem1 = div.mul(radixLong).sub(this);
+ return div.toString(radix) + rem1.toInt().toString(radix);
+ } else return '-' + this.neg().toString(radix);
+ } // Do several (6) digits each time through the loop, so as to
+ // minimize the calls to the very expensive emulated div.
+
+
+ var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
+ rem = this;
+ var result = '';
+
+ while (true) {
+ var remDiv = rem.div(radixToPower),
+ intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
+ digits = intval.toString(radix);
+ rem = remDiv;
+ if (rem.isZero()) return digits + result;else {
+ while (digits.length < 6) digits = '0' + digits;
+
+ result = '' + digits + result;
+ }
+ }
+ };
+ /**
+ * Gets the high 32 bits as a signed integer.
+ * @this {!Long}
+ * @returns {number} Signed high bits
+ */
+
+
+ LongPrototype.getHighBits = function getHighBits() {
+ return this.high;
+ };
+ /**
+ * Gets the high 32 bits as an unsigned integer.
+ * @this {!Long}
+ * @returns {number} Unsigned high bits
+ */
+
+
+ LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
+ return this.high >>> 0;
+ };
+ /**
+ * Gets the low 32 bits as a signed integer.
+ * @this {!Long}
+ * @returns {number} Signed low bits
+ */
+
+
+ LongPrototype.getLowBits = function getLowBits() {
+ return this.low;
+ };
+ /**
+ * Gets the low 32 bits as an unsigned integer.
+ * @this {!Long}
+ * @returns {number} Unsigned low bits
+ */
+
+
+ LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
+ return this.low >>> 0;
+ };
+ /**
+ * Gets the number of bits needed to represent the absolute value of this Long.
+ * @this {!Long}
+ * @returns {number}
+ */
+
+
+ LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
+ if (this.isNegative()) // Unsigned Longs are never negative
+ return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
+ var val = this.high != 0 ? this.high : this.low;
+
+ for (var bit = 31; bit > 0; bit--) if ((val & 1 << bit) != 0) break;
+
+ return this.high != 0 ? bit + 33 : bit + 1;
+ };
+ /**
+ * Tests if this Long's value equals zero.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+
+
+ LongPrototype.isZero = function isZero() {
+ return this.high === 0 && this.low === 0;
+ };
+ /**
+ * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.
+ * @returns {boolean}
+ */
+
+
+ LongPrototype.eqz = LongPrototype.isZero;
+ /**
+ * Tests if this Long's value is negative.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+
+ LongPrototype.isNegative = function isNegative() {
+ return !this.unsigned && this.high < 0;
+ };
+ /**
+ * Tests if this Long's value is positive or zero.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+
+
+ LongPrototype.isPositive = function isPositive() {
+ return this.unsigned || this.high >= 0;
+ };
+ /**
+ * Tests if this Long's value is odd.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+
+
+ LongPrototype.isOdd = function isOdd() {
+ return (this.low & 1) === 1;
+ };
+ /**
+ * Tests if this Long's value is even.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+
+
+ LongPrototype.isEven = function isEven() {
+ return (this.low & 1) === 0;
+ };
+ /**
+ * Tests if this Long's value equals the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+
+ LongPrototype.equals = function equals(other) {
+ if (!isLong(other)) other = fromValue(other);
+ if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1) return false;
+ return this.high === other.high && this.low === other.low;
+ };
+ /**
+ * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+
+ LongPrototype.eq = LongPrototype.equals;
+ /**
+ * Tests if this Long's value differs from the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+ LongPrototype.notEquals = function notEquals(other) {
+ return !this.eq(
+ /* validates */
+ other);
+ };
+ /**
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+
+ LongPrototype.neq = LongPrototype.notEquals;
+ /**
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+ LongPrototype.ne = LongPrototype.notEquals;
+ /**
+ * Tests if this Long's value is less than the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+ LongPrototype.lessThan = function lessThan(other) {
+ return this.comp(
+ /* validates */
+ other) < 0;
+ };
+ /**
+ * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+
+ LongPrototype.lt = LongPrototype.lessThan;
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+ LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
+ return this.comp(
+ /* validates */
+ other) <= 0;
+ };
+ /**
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+
+ LongPrototype.lte = LongPrototype.lessThanOrEqual;
+ /**
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+ LongPrototype.le = LongPrototype.lessThanOrEqual;
+ /**
+ * Tests if this Long's value is greater than the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+ LongPrototype.greaterThan = function greaterThan(other) {
+ return this.comp(
+ /* validates */
+ other) > 0;
+ };
+ /**
+ * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+
+ LongPrototype.gt = LongPrototype.greaterThan;
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+ LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
+ return this.comp(
+ /* validates */
+ other) >= 0;
+ };
+ /**
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+
+ LongPrototype.gte = LongPrototype.greaterThanOrEqual;
+ /**
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+
+ LongPrototype.ge = LongPrototype.greaterThanOrEqual;
+ /**
+ * Compares this Long's value with the specified's.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other value
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
+ * if the given one is greater
+ */
+
+ LongPrototype.compare = function compare(other) {
+ if (!isLong(other)) other = fromValue(other);
+ if (this.eq(other)) return 0;
+ var thisNeg = this.isNegative(),
+ otherNeg = other.isNegative();
+ if (thisNeg && !otherNeg) return -1;
+ if (!thisNeg && otherNeg) return 1; // At this point the sign bits are the same
+
+ if (!this.unsigned) return this.sub(other).isNegative() ? -1 : 1; // Both are positive if at least one is unsigned
+
+ return other.high >>> 0 > this.high >>> 0 || other.high === this.high && other.low >>> 0 > this.low >>> 0 ? -1 : 1;
+ };
+ /**
+ * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
+ * if the given one is greater
+ */
+
+
+ LongPrototype.comp = LongPrototype.compare;
+ /**
+ * Negates this Long's value.
+ * @this {!Long}
+ * @returns {!Long} Negated Long
+ */
+
+ LongPrototype.negate = function negate() {
+ if (!this.unsigned && this.eq(MIN_VALUE)) return MIN_VALUE;
+ return this.not().add(ONE);
+ };
+ /**
+ * Negates this Long's value. This is an alias of {@link Long#negate}.
+ * @function
+ * @returns {!Long} Negated Long
+ */
+
+
+ LongPrototype.neg = LongPrototype.negate;
+ /**
+ * Returns the sum of this and the specified Long.
+ * @this {!Long}
+ * @param {!Long|number|string} addend Addend
+ * @returns {!Long} Sum
+ */
+
+ LongPrototype.add = function add(addend) {
+ if (!isLong(addend)) addend = fromValue(addend); // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
+
+ var a48 = this.high >>> 16;
+ var a32 = this.high & 0xFFFF;
+ var a16 = this.low >>> 16;
+ var a00 = this.low & 0xFFFF;
+ var b48 = addend.high >>> 16;
+ var b32 = addend.high & 0xFFFF;
+ var b16 = addend.low >>> 16;
+ var b00 = addend.low & 0xFFFF;
+ var c48 = 0,
+ c32 = 0,
+ c16 = 0,
+ c00 = 0;
+ c00 += a00 + b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xFFFF;
+ c16 += a16 + b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xFFFF;
+ c32 += a32 + b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xFFFF;
+ c48 += a48 + b48;
+ c48 &= 0xFFFF;
+ return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
+ };
+ /**
+ * Returns the difference of this and the specified Long.
+ * @this {!Long}
+ * @param {!Long|number|string} subtrahend Subtrahend
+ * @returns {!Long} Difference
+ */
+
+
+ LongPrototype.subtract = function subtract(subtrahend) {
+ if (!isLong(subtrahend)) subtrahend = fromValue(subtrahend);
+ return this.add(subtrahend.neg());
+ };
+ /**
+ * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
+ * @function
+ * @param {!Long|number|string} subtrahend Subtrahend
+ * @returns {!Long} Difference
+ */
+
+
+ LongPrototype.sub = LongPrototype.subtract;
+ /**
+ * Returns the product of this and the specified Long.
+ * @this {!Long}
+ * @param {!Long|number|string} multiplier Multiplier
+ * @returns {!Long} Product
+ */
+
+ LongPrototype.multiply = function multiply(multiplier) {
+ if (this.isZero()) return this;
+ if (!isLong(multiplier)) multiplier = fromValue(multiplier); // use wasm support if present
+
+ if (wasm) {
+ var low = wasm["mul"](this.low, this.high, multiplier.low, multiplier.high);
+ return fromBits(low, wasm["get_high"](), this.unsigned);
+ }
+
+ if (multiplier.isZero()) return this.unsigned ? UZERO : ZERO;
+ if (this.eq(MIN_VALUE)) return multiplier.isOdd() ? MIN_VALUE : ZERO;
+ if (multiplier.eq(MIN_VALUE)) return this.isOdd() ? MIN_VALUE : ZERO;
+
+ if (this.isNegative()) {
+ if (multiplier.isNegative()) return this.neg().mul(multiplier.neg());else return this.neg().mul(multiplier).neg();
+ } else if (multiplier.isNegative()) return this.mul(multiplier.neg()).neg(); // If both longs are small, use float multiplication
+
+
+ if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24)) return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned); // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
+ // We can skip products that would overflow.
+
+ var a48 = this.high >>> 16;
+ var a32 = this.high & 0xFFFF;
+ var a16 = this.low >>> 16;
+ var a00 = this.low & 0xFFFF;
+ var b48 = multiplier.high >>> 16;
+ var b32 = multiplier.high & 0xFFFF;
+ var b16 = multiplier.low >>> 16;
+ var b00 = multiplier.low & 0xFFFF;
+ var c48 = 0,
+ c32 = 0,
+ c16 = 0,
+ c00 = 0;
+ c00 += a00 * b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xFFFF;
+ c16 += a16 * b00;
+ c32 += c16 >>> 16;
+ c16 &= 0xFFFF;
+ c16 += a00 * b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xFFFF;
+ c32 += a32 * b00;
+ c48 += c32 >>> 16;
+ c32 &= 0xFFFF;
+ c32 += a16 * b16;
+ c48 += c32 >>> 16;
+ c32 &= 0xFFFF;
+ c32 += a00 * b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xFFFF;
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
+ c48 &= 0xFFFF;
+ return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
+ };
+ /**
+ * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
+ * @function
+ * @param {!Long|number|string} multiplier Multiplier
+ * @returns {!Long} Product
+ */
+
+
+ LongPrototype.mul = LongPrototype.multiply;
+ /**
+ * Returns this Long divided by the specified. The result is signed if this Long is signed or
+ * unsigned if this Long is unsigned.
+ * @this {!Long}
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Quotient
+ */
+
+ LongPrototype.divide = function divide(divisor) {
+ if (!isLong(divisor)) divisor = fromValue(divisor);
+ if (divisor.isZero()) throw Error('division by zero'); // use wasm support if present
+
+ if (wasm) {
+ // guard against signed division overflow: the largest
+ // negative number / -1 would be 1 larger than the largest
+ // positive number, due to two's complement.
+ if (!this.unsigned && this.high === -0x80000000 && divisor.low === -1 && divisor.high === -1) {
+ // be consistent with non-wasm code path
+ return this;
+ }
+
+ var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])(this.low, this.high, divisor.low, divisor.high);
+ return fromBits(low, wasm["get_high"](), this.unsigned);
+ }
+
+ if (this.isZero()) return this.unsigned ? UZERO : ZERO;
+ var approx, rem, res;
+
+ if (!this.unsigned) {
+ // This section is only relevant for signed longs and is derived from the
+ // closure library as a whole.
+ if (this.eq(MIN_VALUE)) {
+ if (divisor.eq(ONE) || divisor.eq(NEG_ONE)) return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
+ else if (divisor.eq(MIN_VALUE)) return ONE;else {
+ // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
+ var halfThis = this.shr(1);
+ approx = halfThis.div(divisor).shl(1);
+
+ if (approx.eq(ZERO)) {
+ return divisor.isNegative() ? ONE : NEG_ONE;
+ } else {
+ rem = this.sub(divisor.mul(approx));
+ res = approx.add(rem.div(divisor));
+ return res;
+ }
+ }
+ } else if (divisor.eq(MIN_VALUE)) return this.unsigned ? UZERO : ZERO;
+
+ if (this.isNegative()) {
+ if (divisor.isNegative()) return this.neg().div(divisor.neg());
+ return this.neg().div(divisor).neg();
+ } else if (divisor.isNegative()) return this.div(divisor.neg()).neg();
+
+ res = ZERO;
+ } else {
+ // The algorithm below has not been made for unsigned longs. It's therefore
+ // required to take special care of the MSB prior to running it.
+ if (!divisor.unsigned) divisor = divisor.toUnsigned();
+ if (divisor.gt(this)) return UZERO;
+ if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
+ return UONE;
+ res = UZERO;
+ } // Repeat the following until the remainder is less than other: find a
+ // floating-point that approximates remainder / other *from below*, add this
+ // into the result, and subtract it from the remainder. It is critical that
+ // the approximate value is less than or equal to the real value so that the
+ // remainder never becomes negative.
+
+
+ rem = this;
+
+ while (rem.gte(divisor)) {
+ // Approximate the result of division. This may be a little greater or
+ // smaller than the actual value.
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber())); // We will tweak the approximate result by changing it in the 48-th digit or
+ // the smallest non-fractional digit, whichever is larger.
+
+ var log2 = Math.ceil(Math.log(approx) / Math.LN2),
+ delta = log2 <= 48 ? 1 : pow_dbl(2, log2 - 48),
+ // Decrease the approximation until it is smaller than the remainder. Note
+ // that if it is too large, the product overflows and is negative.
+ approxRes = fromNumber(approx),
+ approxRem = approxRes.mul(divisor);
+
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
+ approx -= delta;
+ approxRes = fromNumber(approx, this.unsigned);
+ approxRem = approxRes.mul(divisor);
+ } // We know the answer can't be zero... and actually, zero would cause
+ // infinite recursion since we would make no progress.
+
+
+ if (approxRes.isZero()) approxRes = ONE;
+ res = res.add(approxRes);
+ rem = rem.sub(approxRem);
+ }
+
+ return res;
+ };
+ /**
+ * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
+ * @function
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Quotient
+ */
+
+
+ LongPrototype.div = LongPrototype.divide;
+ /**
+ * Returns this Long modulo the specified.
+ * @this {!Long}
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+
+ LongPrototype.modulo = function modulo(divisor) {
+ if (!isLong(divisor)) divisor = fromValue(divisor); // use wasm support if present
+
+ if (wasm) {
+ var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(this.low, this.high, divisor.low, divisor.high);
+ return fromBits(low, wasm["get_high"](), this.unsigned);
+ }
+
+ return this.sub(this.div(divisor).mul(divisor));
+ };
+ /**
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
+ * @function
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+
+
+ LongPrototype.mod = LongPrototype.modulo;
+ /**
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
+ * @function
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+
+ LongPrototype.rem = LongPrototype.modulo;
+ /**
+ * Returns the bitwise NOT of this Long.
+ * @this {!Long}
+ * @returns {!Long}
+ */
+
+ LongPrototype.not = function not() {
+ return fromBits(~this.low, ~this.high, this.unsigned);
+ };
+ /**
+ * Returns count leading zeros of this Long.
+ * @this {!Long}
+ * @returns {!number}
+ */
+
+
+ LongPrototype.countLeadingZeros = function countLeadingZeros() {
+ return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;
+ };
+ /**
+ * Returns count leading zeros. This is an alias of {@link Long#countLeadingZeros}.
+ * @function
+ * @param {!Long}
+ * @returns {!number}
+ */
+
+
+ LongPrototype.clz = LongPrototype.countLeadingZeros;
+ /**
+ * Returns count trailing zeros of this Long.
+ * @this {!Long}
+ * @returns {!number}
+ */
+
+ LongPrototype.countTrailingZeros = function countTrailingZeros() {
+ return this.low ? ctz32(this.low) : ctz32(this.high) + 32;
+ };
+ /**
+ * Returns count trailing zeros. This is an alias of {@link Long#countTrailingZeros}.
+ * @function
+ * @param {!Long}
+ * @returns {!number}
+ */
+
+
+ LongPrototype.ctz = LongPrototype.countTrailingZeros;
+ /**
+ * Returns the bitwise AND of this Long and the specified.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other Long
+ * @returns {!Long}
+ */
+
+ LongPrototype.and = function and(other) {
+ if (!isLong(other)) other = fromValue(other);
+ return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
+ };
+ /**
+ * Returns the bitwise OR of this Long and the specified.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other Long
+ * @returns {!Long}
+ */
+
+
+ LongPrototype.or = function or(other) {
+ if (!isLong(other)) other = fromValue(other);
+ return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
+ };
+ /**
+ * Returns the bitwise XOR of this Long and the given one.
+ * @this {!Long}
+ * @param {!Long|number|string} other Other Long
+ * @returns {!Long}
+ */
+
+
+ LongPrototype.xor = function xor(other) {
+ if (!isLong(other)) other = fromValue(other);
+ return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
+ };
+ /**
+ * Returns this Long with bits shifted to the left by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+
+
+ LongPrototype.shiftLeft = function shiftLeft(numBits) {
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;else if (numBits < 32) return fromBits(this.low << numBits, this.high << numBits | this.low >>> 32 - numBits, this.unsigned);else return fromBits(0, this.low << numBits - 32, this.unsigned);
+ };
+ /**
+ * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+
+
+ LongPrototype.shl = LongPrototype.shiftLeft;
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+
+ LongPrototype.shiftRight = function shiftRight(numBits) {
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;else if (numBits < 32) return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >> numBits, this.unsigned);else return fromBits(this.high >> numBits - 32, this.high >= 0 ? 0 : -1, this.unsigned);
+ };
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+
+
+ LongPrototype.shr = LongPrototype.shiftRight;
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+
+ LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ if (numBits < 32) return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >>> numBits, this.unsigned);
+ if (numBits === 32) return fromBits(this.high, 0, this.unsigned);
+ return fromBits(this.high >>> numBits - 32, 0, this.unsigned);
+ };
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+
+
+ LongPrototype.shru = LongPrototype.shiftRightUnsigned;
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+
+ LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
+ /**
+ * Returns this Long with bits rotated to the left by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+
+ LongPrototype.rotateLeft = function rotateLeft(numBits) {
+ var b;
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
+
+ if (numBits < 32) {
+ b = 32 - numBits;
+ return fromBits(this.low << numBits | this.high >>> b, this.high << numBits | this.low >>> b, this.unsigned);
+ }
+
+ numBits -= 32;
+ b = 32 - numBits;
+ return fromBits(this.high << numBits | this.low >>> b, this.low << numBits | this.high >>> b, this.unsigned);
+ };
+ /**
+ * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+
+
+ LongPrototype.rotl = LongPrototype.rotateLeft;
+ /**
+ * Returns this Long with bits rotated to the right by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+
+ LongPrototype.rotateRight = function rotateRight(numBits) {
+ var b;
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
+
+ if (numBits < 32) {
+ b = 32 - numBits;
+ return fromBits(this.high << b | this.low >>> numBits, this.low << b | this.high >>> numBits, this.unsigned);
+ }
+
+ numBits -= 32;
+ b = 32 - numBits;
+ return fromBits(this.low << b | this.high >>> numBits, this.high << b | this.low >>> numBits, this.unsigned);
+ };
+ /**
+ * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+
+
+ LongPrototype.rotr = LongPrototype.rotateRight;
+ /**
+ * Converts this Long to signed.
+ * @this {!Long}
+ * @returns {!Long} Signed long
+ */
+
+ LongPrototype.toSigned = function toSigned() {
+ if (!this.unsigned) return this;
+ return fromBits(this.low, this.high, false);
+ };
+ /**
+ * Converts this Long to unsigned.
+ * @this {!Long}
+ * @returns {!Long} Unsigned long
+ */
+
+
+ LongPrototype.toUnsigned = function toUnsigned() {
+ if (this.unsigned) return this;
+ return fromBits(this.low, this.high, true);
+ };
+ /**
+ * Converts this Long to its byte representation.
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
+ * @this {!Long}
+ * @returns {!Array.} Byte representation
+ */
+
+
+ LongPrototype.toBytes = function toBytes(le) {
+ return le ? this.toBytesLE() : this.toBytesBE();
+ };
+ /**
+ * Converts this Long to its little endian byte representation.
+ * @this {!Long}
+ * @returns {!Array.} Little endian byte representation
+ */
+
+
+ LongPrototype.toBytesLE = function toBytesLE() {
+ var hi = this.high,
+ lo = this.low;
+ return [lo & 0xff, lo >>> 8 & 0xff, lo >>> 16 & 0xff, lo >>> 24, hi & 0xff, hi >>> 8 & 0xff, hi >>> 16 & 0xff, hi >>> 24];
+ };
+ /**
+ * Converts this Long to its big endian byte representation.
+ * @this {!Long}
+ * @returns {!Array.} Big endian byte representation
+ */
+
+
+ LongPrototype.toBytesBE = function toBytesBE() {
+ var hi = this.high,
+ lo = this.low;
+ return [hi >>> 24, hi >>> 16 & 0xff, hi >>> 8 & 0xff, hi & 0xff, lo >>> 24, lo >>> 16 & 0xff, lo >>> 8 & 0xff, lo & 0xff];
+ };
+ /**
+ * Creates a Long from its byte representation.
+ * @param {!Array.} bytes Byte representation
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
+ * @returns {Long} The corresponding Long value
+ */
+
+
+ Long.fromBytes = function fromBytes(bytes, unsigned, le) {
+ return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
+ };
+ /**
+ * Creates a Long from its little endian byte representation.
+ * @param {!Array.} bytes Little endian byte representation
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {Long} The corresponding Long value
+ */
+
+
+ Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
+ return new Long(bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24, bytes[4] | bytes[5] << 8 | bytes[6] << 16 | bytes[7] << 24, unsigned);
+ };
+ /**
+ * Creates a Long from its big endian byte representation.
+ * @param {!Array.} bytes Big endian byte representation
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {Long} The corresponding Long value
+ */
+
+
+ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
+ return new Long(bytes[4] << 24 | bytes[5] << 16 | bytes[6] << 8 | bytes[7], bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], unsigned);
+ };
+
+ var _default = Long;
+ exports.default = _default;
+ return "default" in exports ? exports.default : exports;
+})({});
+if (typeof define === 'function' && define.amd) define([], function() { return Long; });
+else if (typeof module === 'object' && typeof exports === 'object') module.exports = Long;
diff --git a/node_modules/long/umd/package.json b/node_modules/long/umd/package.json
new file mode 100644
index 0000000..5bbefff
--- /dev/null
+++ b/node_modules/long/umd/package.json
@@ -0,0 +1,3 @@
+{
+ "type": "commonjs"
+}
diff --git a/node_modules/lru-cache/LICENSE b/node_modules/lru-cache/LICENSE
new file mode 100644
index 0000000..f785757
--- /dev/null
+++ b/node_modules/lru-cache/LICENSE
@@ -0,0 +1,15 @@
+The ISC License
+
+Copyright (c) 2010-2023 Isaac Z. Schlueter and Contributors
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/lru-cache/README.md b/node_modules/lru-cache/README.md
new file mode 100644
index 0000000..bd86f4e
--- /dev/null
+++ b/node_modules/lru-cache/README.md
@@ -0,0 +1,1180 @@
+# lru-cache
+
+A cache object that deletes the least-recently-used items.
+
+Specify a max number of the most recently used items that you
+want to keep, and this cache will keep that many of the most
+recently accessed items.
+
+This is not primarily a TTL cache, and does not make strong TTL
+guarantees. There is no preemptive pruning of expired items by
+default, but you _may_ set a TTL on the cache or on a single
+`set`. If you do so, it will treat expired items as missing, and
+delete them when fetched. If you are more interested in TTL
+caching than LRU caching, check out
+[@isaacs/ttlcache](http://npm.im/@isaacs/ttlcache).
+
+As of version 7, this is one of the most performant LRU
+implementations available in JavaScript, and supports a wide
+diversity of use cases. However, note that using some of the
+features will necessarily impact performance, by causing the
+cache to have to do more work. See the "Performance" section
+below.
+
+## Installation
+
+```bash
+npm install lru-cache --save
+```
+
+## Usage
+
+```js
+// hybrid module, either works
+import LRUCache from 'lru-cache'
+// or:
+const LRUCache = require('lru-cache')
+// or in minified form for web browsers:
+import LRUCache from 'http://unpkg.com/lru-cache@8/dist/mjs/index.min.mjs'
+
+// At least one of 'max', 'ttl', or 'maxSize' is required, to prevent
+// unsafe unbounded storage.
+//
+// In most cases, it's best to specify a max for performance, so all
+// the required memory allocation is done up-front.
+//
+// All the other options are optional, see the sections below for
+// documentation on what each one does. Most of them can be
+// overridden for specific items in get()/set()
+const options = {
+ max: 500,
+
+ // for use with tracking overall storage size
+ maxSize: 5000,
+ sizeCalculation: (value, key) => {
+ return 1
+ },
+
+ // for use when you need to clean up something when objects
+ // are evicted from the cache
+ dispose: (value, key) => {
+ freeFromMemoryOrWhatever(value)
+ },
+
+ // how long to live in ms
+ ttl: 1000 * 60 * 5,
+
+ // return stale items before removing from cache?
+ allowStale: false,
+
+ updateAgeOnGet: false,
+ updateAgeOnHas: false,
+
+ // async method to use for cache.fetch(), for
+ // stale-while-revalidate type of behavior
+ fetchMethod: async (
+ key,
+ staleValue,
+ { options, signal, context }
+ ) => {},
+}
+
+const cache = new LRUCache(options)
+
+cache.set('key', 'value')
+cache.get('key') // "value"
+
+// non-string keys ARE fully supported
+// but note that it must be THE SAME object, not
+// just a JSON-equivalent object.
+var someObject = { a: 1 }
+cache.set(someObject, 'a value')
+// Object keys are not toString()-ed
+cache.set('[object Object]', 'a different value')
+assert.equal(cache.get(someObject), 'a value')
+// A similar object with same keys/values won't work,
+// because it's a different object identity
+assert.equal(cache.get({ a: 1 }), undefined)
+
+cache.clear() // empty the cache
+```
+
+If you put more stuff in the cache, then less recently used items
+will fall out. That's what an LRU cache is.
+
+## `class LRUCache(options)`
+
+Create a new `LRUCache` object.
+
+When using TypeScript, set the `K` and `V` types to the `key` and
+`value` types, respectively.
+
+The `FC` ("fetch context") generic type defaults to `unknown`.
+If set to a value other than `void` or `undefined`, then any
+calls to `cache.fetch()` _must_ provide a `context` option
+matching the `FC` type. If `FC` is set to `void` or `undefined`,
+then `cache.fetch()` _must not_ provide a `context` option. See
+the documentation on `async fetch()` below.
+
+## Options
+
+All options are available on the LRUCache instance, making it
+safe to pass an LRUCache instance as the options argument to make
+another empty cache of the same type.
+
+Some options are marked read-only because changing them after
+instantiation is not safe. Changing any of the other options
+will of course only have an effect on subsequent method calls.
+
+### `max` (read only)
+
+The maximum number of items that remain in the cache (assuming no
+TTL pruning or explicit deletions). Note that fewer items may be
+stored if size calculation is used, and `maxSize` is exceeded.
+This must be a positive finite intger.
+
+At least one of `max`, `maxSize`, or `TTL` is required. This
+must be a positive integer if set.
+
+**It is strongly recommended to set a `max` to prevent unbounded
+growth of the cache.** See "Storage Bounds Safety" below.
+
+### `maxSize` (read only)
+
+Set to a positive integer to track the sizes of items added to
+the cache, and automatically evict items in order to stay below
+this size. Note that this may result in fewer than `max` items
+being stored.
+
+Attempting to add an item to the cache whose calculated size is
+greater that this amount will be a no-op. The item will not be
+cached, and no other items will be evicted.
+
+Optional, must be a positive integer if provided.
+
+Sets `maxEntrySize` to the same value, unless a different value
+is provided for `maxEntrySize`.
+
+At least one of `max`, `maxSize`, or `TTL` is required. This
+must be a positive integer if set.
+
+Even if size tracking is enabled, **it is strongly recommended to
+set a `max` to prevent unbounded growth of the cache.** See
+"Storage Bounds Safety" below.
+
+### `maxEntrySize`
+
+Set to a positive integer to track the sizes of items added to
+the cache, and prevent caching any item over a given size.
+Attempting to add an item whose calculated size is greater than
+this amount will be a no-op. The item will not be cached, and no
+other items will be evicted.
+
+Optional, must be a positive integer if provided. Defaults to
+the value of `maxSize` if provided.
+
+### `sizeCalculation`
+
+Function used to calculate the size of stored items. If you're
+storing strings or buffers, then you probably want to do
+something like `n => n.length`. The item is passed as the first
+argument, and the key is passed as the second argument.
+
+This may be overridden by passing an options object to
+`cache.set()`.
+
+Requires `maxSize` to be set.
+
+If the `size` (or return value of `sizeCalculation`) for a given
+entry is greater than `maxEntrySize`, then the item will not be
+added to the cache.
+
+### `fetchMethod` (read only)
+
+Function that is used to make background asynchronous fetches.
+Called with `fetchMethod(key, staleValue, { signal, options,
+context })`. May return a Promise.
+
+If `fetchMethod` is not provided, then `cache.fetch(key)` is
+equivalent to `Promise.resolve(cache.get(key))`.
+
+If at any time, `signal.aborted` is set to `true`, or if the
+`signal.onabort` method is called, or if it emits an `'abort'`
+event which you can listen to with `addEventListener`, then that
+means that the fetch should be abandoned. This may be passed
+along to async functions aware of AbortController/AbortSignal
+behavior.
+
+The `fetchMethod` should **only** return `undefined` or a Promise
+resolving to `undefined` if the AbortController signaled an
+`abort` event. In all other cases, it should return or resolve
+to a value suitable for adding to the cache.
+
+The `options` object is a union of the options that may be
+provided to `set()` and `get()`. If they are modified, then that
+will result in modifying the settings to `cache.set()` when the
+value is resolved, and in the case of `noDeleteOnFetchRejection`
+and `allowStaleOnFetchRejection`, the handling of `fetchMethod`
+failures.
+
+For example, a DNS cache may update the TTL based on the value
+returned from a remote DNS server by changing `options.ttl` in
+the `fetchMethod`.
+
+### `noDeleteOnFetchRejection`
+
+If a `fetchMethod` throws an error or returns a rejected promise,
+then by default, any existing stale value will be removed from
+the cache.
+
+If `noDeleteOnFetchRejection` is set to `true`, then this
+behavior is suppressed, and the stale value remains in the cache
+in the case of a rejected `fetchMethod`.
+
+This is important in cases where a `fetchMethod` is _only_ called
+as a background update while the stale value is returned, when
+`allowStale` is used.
+
+This is implicitly in effect when `allowStaleOnFetchRejection` is
+set.
+
+This may be set in calls to `fetch()`, or defaulted on the
+constructor, or overridden by modifying the options object in the
+`fetchMethod`.
+
+### `allowStaleOnFetchRejection`
+
+Set to true to return a stale value from the cache when a
+`fetchMethod` throws an error or returns a rejected Promise.
+
+If a `fetchMethod` fails, and there is no stale value available,
+the `fetch()` will resolve to `undefined`. Ie, all `fetchMethod`
+errors are suppressed.
+
+Implies `noDeleteOnFetchRejection`.
+
+This may be set in calls to `fetch()`, or defaulted on the
+constructor, or overridden by modifying the options object in the
+`fetchMethod`.
+
+### `allowStaleOnFetchAbort`
+
+Set to true to return a stale value from the cache when the
+`AbortSignal` passed to the `fetchMethod` dispatches an `'abort'`
+event, whether user-triggered, or due to internal cache behavior.
+
+Unless `ignoreFetchAbort` is also set, the underlying
+`fetchMethod` will still be considered canceled, and its return
+value will be ignored and not cached.
+
+### `ignoreFetchAbort`
+
+Set to true to ignore the `abort` event emitted by the
+`AbortSignal` object passed to `fetchMethod`, and still cache the
+resulting resolution value, as long as it is not `undefined`.
+
+When used on its own, this means aborted `fetch()` calls are not
+immediately resolved or rejected when they are aborted, and
+instead take the full time to await.
+
+When used with `allowStaleOnFetchAbort`, aborted `fetch()` calls
+will resolve immediately to their stale cached value or
+`undefined`, and will continue to process and eventually update
+the cache when they resolve, as long as the resulting value is
+not `undefined`, thus supporting a "return stale on timeout while
+refreshing" mechanism by passing `AbortSignal.timeout(n)` as the
+signal.
+
+For example:
+
+```js
+const c = new LRUCache({
+ ttl: 100,
+ ignoreFetchAbort: true,
+ allowStaleOnFetchAbort: true,
+ fetchMethod: async (key, oldValue, { signal }) => {
+ // note: do NOT pass the signal to fetch()!
+ // let's say this fetch can take a long time.
+ const res = await fetch(`https://slow-backend-server/${key}`)
+ return await res.json()
+ },
+})
+
+// this will return the stale value after 100ms, while still
+// updating in the background for next time.
+const val = await c.fetch('key', { signal: AbortSignal.timeout(100) })
+```
+
+**Note**: regardless of this setting, an `abort` event _is still
+emitted on the `AbortSignal` object_, so may result in invalid
+results when passed to other underlying APIs that use
+AbortSignals.
+
+This may be overridden on the `fetch()` call or in the
+`fetchMethod` itself.
+
+### `dispose` (read only)
+
+Function that is called on items when they are dropped from the
+cache, as `this.dispose(value, key, reason)`.
+
+This can be handy if you want to close file descriptors or do
+other cleanup tasks when items are no longer stored in the cache.
+
+**NOTE**: It is called _before_ the item has been fully removed
+from the cache, so if you want to put it right back in, you need
+to wait until the next tick. If you try to add it back in during
+the `dispose()` function call, it will break things in subtle and
+weird ways.
+
+Unlike several other options, this may _not_ be overridden by
+passing an option to `set()`, for performance reasons.
+
+The `reason` will be one of the following strings, corresponding
+to the reason for the item's deletion:
+
+- `evict` Item was evicted to make space for a new addition
+- `set` Item was overwritten by a new value
+- `delete` Item was removed by explicit `cache.delete(key)` or by
+ calling `cache.clear()`, which deletes everything.
+
+The `dispose()` method is _not_ called for canceled calls to
+`fetchMethod()`. If you wish to handle evictions, overwrites,
+and deletes of in-flight asynchronous fetches, you must use the
+`AbortSignal` provided.
+
+Optional, must be a function.
+
+### `disposeAfter` (read only)
+
+The same as `dispose`, but called _after_ the entry is completely
+removed and the cache is once again in a clean state.
+
+It is safe to add an item right back into the cache at this
+point. However, note that it is _very_ easy to inadvertently
+create infinite recursion in this way.
+
+The `disposeAfter()` method is _not_ called for canceled calls to
+`fetchMethod()`. If you wish to handle evictions, overwrites,
+and deletes of in-flight asynchronous fetches, you must use the
+`AbortSignal` provided.
+
+### `noDisposeOnSet`
+
+Set to `true` to suppress calling the `dispose()` function if the
+entry key is still accessible within the cache.
+
+This may be overridden by passing an options object to
+`cache.set()`.
+
+Boolean, default `false`. Only relevant if `dispose` or
+`disposeAfter` options are set.
+
+### `ttl`
+
+Max time to live for items before they are considered stale.
+Note that stale items are NOT preemptively removed by default,
+and MAY live in the cache, contributing to its LRU max, long
+after they have expired.
+
+Also, as this cache is optimized for LRU/MRU operations, some of
+the staleness/TTL checks will reduce performance.
+
+This is not primarily a TTL cache, and does not make strong TTL
+guarantees. There is no pre-emptive pruning of expired items,
+but you _may_ set a TTL on the cache, and it will treat expired
+items as missing when they are fetched, and delete them.
+
+Optional, but must be a positive integer in ms if specified.
+
+This may be overridden by passing an options object to
+`cache.set()`.
+
+At least one of `max`, `maxSize`, or `TTL` is required. This
+must be a positive integer if set.
+
+Even if ttl tracking is enabled, **it is strongly recommended to
+set a `max` to prevent unbounded growth of the cache.** See
+"Storage Bounds Safety" below.
+
+If ttl tracking is enabled, and `max` and `maxSize` are not set,
+and `ttlAutopurge` is not set, then a warning will be emitted
+cautioning about the potential for unbounded memory consumption.
+(The TypeScript definitions will also discourage this.)
+
+### `noUpdateTTL`
+
+Boolean flag to tell the cache to not update the TTL when setting
+a new value for an existing key (ie, when updating a value rather
+than inserting a new value). Note that the TTL value is _always_
+set (if provided) when adding a new entry into the cache.
+
+This may be passed as an option to `cache.set()`.
+
+Boolean, default false.
+
+### `ttlResolution`
+
+Minimum amount of time in ms in which to check for staleness.
+Defaults to `1`, which means that the current time is checked at
+most once per millisecond.
+
+Set to `0` to check the current time every time staleness is
+tested.
+
+Note that setting this to a higher value _will_ improve
+performance somewhat while using ttl tracking, albeit at the
+expense of keeping stale items around a bit longer than intended.
+
+### `ttlAutopurge`
+
+Preemptively remove stale items from the cache.
+
+Note that this may _significantly_ degrade performance,
+especially if the cache is storing a large number of items. It
+is almost always best to just leave the stale items in the cache,
+and let them fall out as new items are added.
+
+Note that this means that `allowStale` is a bit pointless, as
+stale items will be deleted almost as soon as they expire.
+
+Use with caution!
+
+Boolean, default `false`
+
+### `allowStale`
+
+By default, if you set `ttl`, it'll only delete stale items from
+the cache when you `get(key)`. That is, it's not preemptively
+pruning items.
+
+If you set `allowStale:true`, it'll return the stale value as
+well as deleting it. If you don't set this, then it'll return
+`undefined` when you try to get a stale entry.
+
+Note that when a stale entry is fetched, _even if it is returned
+due to `allowStale` being set_, it is removed from the cache
+immediately. You can immediately put it back in the cache if you
+wish, thus resetting the TTL.
+
+This may be overridden by passing an options object to
+`cache.get()`. The `cache.has()` method will always return
+`false` for stale items.
+
+Boolean, default false, only relevant if `ttl` is set.
+
+### `noDeleteOnStaleGet`
+
+When using time-expiring entries with `ttl`, by default stale
+items will be removed from the cache when the key is accessed
+with `cache.get()`.
+
+Setting `noDeleteOnStaleGet` to `true` will cause stale items to
+remain in the cache, until they are explicitly deleted with
+`cache.delete(key)`, or retrieved with `noDeleteOnStaleGet` set
+to `false`.
+
+This may be overridden by passing an options object to
+`cache.get()`.
+
+Boolean, default false, only relevant if `ttl` is set.
+
+### `updateAgeOnGet`
+
+When using time-expiring entries with `ttl`, setting this to
+`true` will make each item's age reset to 0 whenever it is
+retrieved from cache with `get()`, causing it to not expire. (It
+can still fall out of cache based on recency of use, of course.)
+
+This may be overridden by passing an options object to
+`cache.get()`.
+
+Boolean, default false, only relevant if `ttl` is set.
+
+### `updateAgeOnHas`
+
+When using time-expiring entries with `ttl`, setting this to
+`true` will make each item's age reset to 0 whenever its presence
+in the cache is checked with `has()`, causing it to not expire.
+(It can still fall out of cache based on recency of use, of
+course.)
+
+This may be overridden by passing an options object to
+`cache.has()`.
+
+Boolean, default false, only relevant if `ttl` is set.
+
+## API
+
+### `new LRUCache(options)`
+
+Create a new LRUCache. All options are documented above, and are
+on the cache as public members.
+
+The `K` and `V` types define the key and value types,
+respectively. The optional `FC` type defines the type of the
+`context` object passed to `cache.fetch()`.
+
+Keys and values **must not** be `null` or `undefined`.
+
+### `cache.max`, `cache.maxSize`, `cache.allowStale`,
+
+`cache.noDisposeOnSet`, `cache.sizeCalculation`, `cache.dispose`,
+`cache.maxSize`, `cache.ttl`, `cache.updateAgeOnGet`,
+`cache.updateAgeOnHas`
+
+All option names are exposed as public members on the cache
+object.
+
+These are intended for read access only. Changing them during
+program operation can cause undefined behavior.
+
+### `cache.size`
+
+The total number of items held in the cache at the current
+moment.
+
+### `cache.calculatedSize`
+
+The total size of items in cache when using size tracking.
+
+### `set(key, value, [{ size, sizeCalculation, ttl, noDisposeOnSet, start, status }])`
+
+Add a value to the cache.
+
+Optional options object may contain `ttl` and `sizeCalculation`
+as described above, which default to the settings on the cache
+object.
+
+If `start` is provided, then that will set the effective start
+time for the TTL calculation. Note that this must be a previous
+value of `performance.now()` if supported, or a previous value of
+`Date.now()` if not.
+
+Options object may also include `size`, which will prevent
+calling the `sizeCalculation` function and just use the specified
+number if it is a positive integer, and `noDisposeOnSet` which
+will prevent calling a `dispose` function in the case of
+overwrites.
+
+If the `size` (or return value of `sizeCalculation`) for a given
+entry is greater than `maxEntrySize`, then the item will not be
+added to the cache.
+
+Will update the recency of the entry.
+
+Returns the cache object.
+
+For the usage of the `status` option, see **Status Tracking**
+below.
+
+### `get(key, { updateAgeOnGet, allowStale, status } = {}) => value`
+
+Return a value from the cache.
+
+Will update the recency of the cache entry found.
+
+If the key is not found, `get()` will return `undefined`.
+
+For the usage of the `status` option, see **Status Tracking**
+below.
+
+### `async fetch(key, options = {}) => Promise`
+
+The following options are supported:
+
+- `updateAgeOnGet`
+- `allowStale`
+- `size`
+- `sizeCalculation`
+- `ttl`
+- `noDisposeOnSet`
+- `forceRefresh`
+- `status` - See **Status Tracking** below.
+- `signal` - AbortSignal can be used to cancel the `fetch()`.
+ Note that the `signal` option provided to the `fetchMethod` is
+ a different object, because it must also respond to internal
+ cache state changes, but aborting this signal will abort the
+ one passed to `fetchMethod` as well.
+- `context` - sets the `context` option passed to the underlying
+ `fetchMethod`.
+
+If the value is in the cache and not stale, then the returned
+Promise resolves to the value.
+
+If not in the cache, or beyond its TTL staleness, then
+`fetchMethod(key, staleValue, { options, signal, context })` is
+called, and the value returned will be added to the cache once
+resolved.
+
+If called with `allowStale`, and an asynchronous fetch is
+currently in progress to reload a stale value, then the former
+stale value will be returned.
+
+If called with `forceRefresh`, then the cached item will be
+re-fetched, even if it is not stale. However, if `allowStale` is
+set, then the old value will still be returned. This is useful
+in cases where you want to force a reload of a cached value. If
+a background fetch is already in progress, then `forceRefresh`
+has no effect.
+
+Multiple fetches for the same `key` will only call `fetchMethod`
+a single time, and all will be resolved when the value is
+resolved, even if different options are used.
+
+If `fetchMethod` is not specified, then this is effectively an
+alias for `Promise.resolve(cache.get(key))`.
+
+When the fetch method resolves to a value, if the fetch has not
+been aborted due to deletion, eviction, or being overwritten,
+then it is added to the cache using the options provided.
+
+If the key is evicted or deleted before the `fetchMethod`
+resolves, then the AbortSignal passed to the `fetchMethod` will
+receive an `abort` event, and the promise returned by `fetch()`
+will reject with the reason for the abort.
+
+If a `signal` is passed to the `fetch()` call, then aborting the
+signal will abort the fetch and cause the `fetch()` promise to
+reject with the reason provided.
+
+#### Setting `context`
+
+If an `FC` type is set to a type other than `unknown`, `void`, or
+`undefined` in the LRUCache constructor, then all
+calls to `cache.fetch()` _must_ provide a `context` option. If
+set to `undefined` or `void`, then calls to fetch _must not_
+provide a `context` option.
+
+The `context` param allows you to provide arbitrary data that
+might be relevant in the course of fetching the data. It is only
+relevant for the course of a single `fetch()` operation, and
+discarded afterwards.
+
+#### Note: `fetch()` calls are inflight-unique
+
+If you call `fetch()` multiple times with the same key value,
+then every call after the first will resolve on the same
+promise1,
+_even if they have different settings that would otherwise change
+the behvavior of the fetch_, such as `noDeleteOnFetchRejection`
+or `ignoreFetchAbort`.
+
+In most cases, this is not a problem (in fact, only fetching
+something once is what you probably want, if you're caching in
+the first place). If you are changing the fetch() options
+dramatically between runs, there's a good chance that you might
+be trying to fit divergent semantics into a single object, and
+would be better off with multiple cache instances.
+
+**1**: Ie, they're not the "same Promise", but they resolve at
+the same time, because they're both waiting on the same
+underlying fetchMethod response.
+
+### `peek(key, { allowStale } = {}) => value`
+
+Like `get()` but doesn't update recency or delete stale items.
+
+Returns `undefined` if the item is stale, unless `allowStale` is
+set either on the cache or in the options object.
+
+### `has(key, { updateAgeOnHas, status } = {}) => Boolean`
+
+Check if a key is in the cache, without updating the recency of
+use. Age is updated if `updateAgeOnHas` is set to `true` in
+either the options or the constructor.
+
+Will return `false` if the item is stale, even though it is
+technically in the cache. The difference can be determined (if
+it matters) by using a `status` argument, and inspecting the
+`has` field.
+
+For the usage of the `status` option, see **Status Tracking**
+below.
+
+### `delete(key)`
+
+Deletes a key out of the cache.
+
+Returns `true` if the key was deleted, `false` otherwise.
+
+### `clear()`
+
+Clear the cache entirely, throwing away all values.
+
+### `keys()`
+
+Return a generator yielding the keys in the cache, in order from
+most recently used to least recently used.
+
+### `rkeys()`
+
+Return a generator yielding the keys in the cache, in order from
+least recently used to most recently used.
+
+### `values()`
+
+Return a generator yielding the values in the cache, in order
+from most recently used to least recently used.
+
+### `rvalues()`
+
+Return a generator yielding the values in the cache, in order
+from least recently used to most recently used.
+
+### `entries()`
+
+Return a generator yielding `[key, value]` pairs, in order from
+most recently used to least recently used.
+
+### `rentries()`
+
+Return a generator yielding `[key, value]` pairs, in order from
+least recently used to most recently used.
+
+### `find(fn, [getOptions])`
+
+Find a value for which the supplied `fn` method returns a truthy
+value, similar to `Array.find()`.
+
+`fn` is called as `fn(value, key, cache)`.
+
+The optional `getOptions` are applied to the resulting `get()` of
+the item found.
+
+### `dump()`
+
+Return an array of `[key, entry]` objects which can be passed to
+`cache.load()`
+
+The `start` fields are calculated relative to a portable
+`Date.now()` timestamp, even if `performance.now()` is available.
+
+Stale entries are always included in the `dump`, even if
+`allowStale` is false.
+
+Note: this returns an actual array, not a generator, so it can be
+more easily passed around.
+
+### `load(entries)`
+
+Reset the cache and load in the items in `entries` in the order
+listed. Note that the shape of the resulting cache may be
+different if the same options are not used in both caches.
+
+The `start` fields are assumed to be calculated relative to a
+portable `Date.now()` timestamp, even if `performance.now()` is
+available.
+
+### `purgeStale()`
+
+Delete any stale entries. Returns `true` if anything was
+removed, `false` otherwise.
+
+### `getRemainingTTL(key)`
+
+Return the number of ms left in the item's TTL. If item is not
+in cache, returns `0`. Returns `Infinity` if item is in cache
+without a defined TTL.
+
+### `forEach(fn, [thisp])`
+
+Call the `fn` function with each set of `fn(value, key, cache)`
+in the LRU cache, from most recent to least recently used.
+
+Does not affect recency of use.
+
+If `thisp` is provided, function will be called in the
+`this`-context of the provided object.
+
+### `rforEach(fn, [thisp])`
+
+Same as `cache.forEach(fn, thisp)`, but in order from least
+recently used to most recently used.
+
+### `pop()`
+
+Evict the least recently used item, returning its value.
+
+Returns `undefined` if cache is empty.
+
+### Internal Methods and Properties
+
+In order to optimize performance as much as possible, "private"
+members and methods are exposed on the object as normal
+properties, rather than being accessed via Symbols, private
+members, or closure variables.
+
+**Do not use or rely on these.** They will change or be removed
+without notice. They will cause undefined behavior if used
+inappropriately. There is no need or reason to ever call them
+directly.
+
+This documentation is here so that it is especially clear that
+this not "undocumented" because someone forgot; it _is_
+documented, and the documentation is telling you not to do it.
+
+**Do not report bugs that stem from using these properties.**
+They will be ignored.
+
+- `initializeTTLTracking()` Set up the cache for tracking TTLs
+- `updateItemAge(index)` Called when an item age is updated, by
+ internal ID
+- `setItemTTL(index)` Called when an item ttl is updated, by
+ internal ID
+- `isStale(index)` Called to check an item's staleness, by
+ internal ID
+- `initializeSizeTracking()` Set up the cache for tracking item
+ size. Called automatically when a size is specified.
+- `removeItemSize(index)` Updates the internal size calculation
+ when an item is removed or modified, by internal ID
+- `addItemSize(index)` Updates the internal size calculation when
+ an item is added or modified, by internal ID
+- `indexes()` An iterator over the non-stale internal IDs, from
+ most recently to least recently used.
+- `rindexes()` An iterator over the non-stale internal IDs, from
+ least recently to most recently used.
+- `newIndex()` Create a new internal ID, either reusing a deleted
+ ID, evicting the least recently used ID, or walking to the end
+ of the allotted space.
+- `evict()` Evict the least recently used internal ID, returning
+ its ID. Does not do any bounds checking.
+- `connect(p, n)` Connect the `p` and `n` internal IDs in the
+ linked list.
+- `moveToTail(index)` Move the specified internal ID to the most
+ recently used position.
+- `keyMap` Map of keys to internal IDs
+- `keyList` List of keys by internal ID
+- `valList` List of values by internal ID
+- `sizes` List of calculated sizes by internal ID
+- `ttls` List of TTL values by internal ID
+- `starts` List of start time values by internal ID
+- `next` Array of "next" pointers by internal ID
+- `prev` Array of "previous" pointers by internal ID
+- `head` Internal ID of least recently used item
+- `tail` Internal ID of most recently used item
+- `free` Stack of deleted internal IDs
+
+## Status Tracking
+
+Occasionally, it may be useful to track the internal behavior of
+the cache, particularly for logging, debugging, or for behavior
+within the `fetchMethod`. To do this, you can pass a `status`
+object to the `get()`, `set()`, `has()`, and `fetch()` methods.
+
+The `status` option should be a plain JavaScript object.
+
+The following fields will be set appropriately:
+
+```ts
+interface Status {
+ /**
+ * The status of a set() operation.
+ *
+ * - add: the item was not found in the cache, and was added
+ * - update: the item was in the cache, with the same value provided
+ * - replace: the item was in the cache, and replaced
+ * - miss: the item was not added to the cache for some reason
+ */
+ set?: 'add' | 'update' | 'replace' | 'miss'
+
+ /**
+ * the ttl stored for the item, or undefined if ttls are not used.
+ */
+ ttl?: LRUMilliseconds
+
+ /**
+ * the start time for the item, or undefined if ttls are not used.
+ */
+ start?: LRUMilliseconds
+
+ /**
+ * The timestamp used for TTL calculation
+ */
+ now?: LRUMilliseconds
+
+ /**
+ * the remaining ttl for the item, or undefined if ttls are not used.
+ */
+ remainingTTL?: LRUMilliseconds
+
+ /**
+ * The calculated size for the item, if sizes are used.
+ */
+ size?: LRUSize
+
+ /**
+ * A flag indicating that the item was not stored, due to exceeding the
+ * {@link maxEntrySize}
+ */
+ maxEntrySizeExceeded?: true
+
+ /**
+ * The old value, specified in the case of `set:'update'` or
+ * `set:'replace'`
+ */
+ oldValue?: V
+
+ /**
+ * The results of a {@link has} operation
+ *
+ * - hit: the item was found in the cache
+ * - stale: the item was found in the cache, but is stale
+ * - miss: the item was not found in the cache
+ */
+ has?: 'hit' | 'stale' | 'miss'
+
+ /**
+ * The status of a {@link fetch} operation.
+ * Note that this can change as the underlying fetch() moves through
+ * various states.
+ *
+ * - inflight: there is another fetch() for this key which is in process
+ * - get: there is no fetchMethod, so {@link get} was called.
+ * - miss: the item is not in cache, and will be fetched.
+ * - hit: the item is in the cache, and was resolved immediately.
+ * - stale: the item is in the cache, but stale.
+ * - refresh: the item is in the cache, and not stale, but
+ * {@link forceRefresh} was specified.
+ */
+ fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh'
+
+ /**
+ * The {@link fetchMethod} was called
+ */
+ fetchDispatched?: true
+
+ /**
+ * The cached value was updated after a successful call to fetchMethod
+ */
+ fetchUpdated?: true
+
+ /**
+ * The reason for a fetch() rejection. Either the error raised by the
+ * {@link fetchMethod}, or the reason for an AbortSignal.
+ */
+ fetchError?: Error
+
+ /**
+ * The fetch received an abort signal
+ */
+ fetchAborted?: true
+
+ /**
+ * The abort signal received was ignored, and the fetch was allowed to
+ * continue.
+ */
+ fetchAbortIgnored?: true
+
+ /**
+ * The fetchMethod promise resolved successfully
+ */
+ fetchResolved?: true
+
+ /**
+ * The results of the fetchMethod promise were stored in the cache
+ */
+ fetchUpdated?: true
+
+ /**
+ * The fetchMethod promise was rejected
+ */
+ fetchRejected?: true
+
+ /**
+ * The status of a {@link get} operation.
+ *
+ * - fetching: The item is currently being fetched. If a previous value is
+ * present and allowed, that will be returned.
+ * - stale: The item is in the cache, and is stale.
+ * - hit: the item is in the cache
+ * - miss: the item is not in the cache
+ */
+ get?: 'stale' | 'hit' | 'miss'
+
+ /**
+ * A fetch or get operation returned a stale value.
+ */
+ returnedStale?: true
+}
+```
+
+## Storage Bounds Safety
+
+This implementation aims to be as flexible as possible, within
+the limits of safe memory consumption and optimal performance.
+
+At initial object creation, storage is allocated for `max` items.
+If `max` is set to zero, then some performance is lost, and item
+count is unbounded. Either `maxSize` or `ttl` _must_ be set if
+`max` is not specified.
+
+If `maxSize` is set, then this creates a safe limit on the
+maximum storage consumed, but without the performance benefits of
+pre-allocation. When `maxSize` is set, every item _must_ provide
+a size, either via the `sizeCalculation` method provided to the
+constructor, or via a `size` or `sizeCalculation` option provided
+to `cache.set()`. The size of every item _must_ be a positive
+integer.
+
+If neither `max` nor `maxSize` are set, then `ttl` tracking must
+be enabled. Note that, even when tracking item `ttl`, items are
+_not_ preemptively deleted when they become stale, unless
+`ttlAutopurge` is enabled. Instead, they are only purged the
+next time the key is requested. Thus, if `ttlAutopurge`, `max`,
+and `maxSize` are all not set, then the cache will potentially
+grow unbounded.
+
+In this case, a warning is printed to standard error. Future
+versions may require the use of `ttlAutopurge` if `max` and
+`maxSize` are not specified.
+
+If you truly wish to use a cache that is bound _only_ by TTL
+expiration, consider using a `Map` object, and calling
+`setTimeout` to delete entries when they expire. It will perform
+much better than an LRU cache.
+
+Here is an implementation you may use, under the same
+[license](./LICENSE) as this package:
+
+```js
+// a storage-unbounded ttl cache that is not an lru-cache
+const cache = {
+ data: new Map(),
+ timers: new Map(),
+ set: (k, v, ttl) => {
+ if (cache.timers.has(k)) {
+ clearTimeout(cache.timers.get(k))
+ }
+ cache.timers.set(
+ k,
+ setTimeout(() => cache.delete(k), ttl)
+ )
+ cache.data.set(k, v)
+ },
+ get: k => cache.data.get(k),
+ has: k => cache.data.has(k),
+ delete: k => {
+ if (cache.timers.has(k)) {
+ clearTimeout(cache.timers.get(k))
+ }
+ cache.timers.delete(k)
+ return cache.data.delete(k)
+ },
+ clear: () => {
+ cache.data.clear()
+ for (const v of cache.timers.values()) {
+ clearTimeout(v)
+ }
+ cache.timers.clear()
+ },
+}
+```
+
+If that isn't to your liking, check out
+[@isaacs/ttlcache](http://npm.im/@isaacs/ttlcache).
+
+## Performance
+
+As of January 2022, version 7 of this library is one of the most
+performant LRU cache implementations in JavaScript.
+
+Benchmarks can be extremely difficult to get right. In
+particular, the performance of set/get/delete operations on
+objects will vary _wildly_ depending on the type of key used. V8
+is highly optimized for objects with keys that are short strings,
+especially integer numeric strings. Thus any benchmark which
+tests _solely_ using numbers as keys will tend to find that an
+object-based approach performs the best.
+
+Note that coercing _anything_ to strings to use as object keys is
+unsafe, unless you can be 100% certain that no other type of
+value will be used. For example:
+
+```js
+const myCache = {}
+const set = (k, v) => (myCache[k] = v)
+const get = k => myCache[k]
+
+set({}, 'please hang onto this for me')
+set('[object Object]', 'oopsie')
+```
+
+Also beware of "Just So" stories regarding performance. Garbage
+collection of large (especially: deep) object graphs can be
+incredibly costly, with several "tipping points" where it
+increases exponentially. As a result, putting that off until
+later can make it much worse, and less predictable. If a library
+performs well, but only in a scenario where the object graph is
+kept shallow, then that won't help you if you are using large
+objects as keys.
+
+In general, when attempting to use a library to improve
+performance (such as a cache like this one), it's best to choose
+an option that will perform well in the sorts of scenarios where
+you'll actually use it.
+
+This library is optimized for repeated gets and minimizing
+eviction time, since that is the expected need of a LRU. Set
+operations are somewhat slower on average than a few other
+options, in part because of that optimization. It is assumed
+that you'll be caching some costly operation, ideally as rarely
+as possible, so optimizing set over get would be unwise.
+
+If performance matters to you:
+
+1. If it's at all possible to use small integer values as keys,
+ and you can guarantee that no other types of values will be
+ used as keys, then do that, and use a cache such as
+ [lru-fast](https://npmjs.com/package/lru-fast), or
+ [mnemonist's
+ LRUCache](https://yomguithereal.github.io/mnemonist/lru-cache)
+ which uses an Object as its data store.
+
+2. Failing that, if at all possible, use short non-numeric
+ strings (ie, less than 256 characters) as your keys, and use
+ [mnemonist's
+ LRUCache](https://yomguithereal.github.io/mnemonist/lru-cache).
+
+3. If the types of your keys will be anything else, especially
+ long strings, strings that look like floats, objects, or some
+ mix of types, or if you aren't sure, then this library will
+ work well for you.
+
+ If you do not need the features that this library provides
+ (like asynchronous fetching, a variety of TTL staleness
+ options, and so on), then [mnemonist's
+ LRUMap](https://yomguithereal.github.io/mnemonist/lru-map) is
+ a very good option, and just slightly faster than this module
+ (since it does considerably less).
+
+4. Do not use a `dispose` function, size tracking, or especially
+ ttl behavior, unless absolutely needed. These features are
+ convenient, and necessary in some use cases, and every attempt
+ has been made to make the performance impact minimal, but it
+ isn't nothing.
+
+## Breaking Changes in Version 7
+
+This library changed to a different algorithm and internal data
+structure in version 7, yielding significantly better
+performance, albeit with some subtle changes as a result.
+
+If you were relying on the internals of LRUCache in version 6 or
+before, it probably will not work in version 7 and above.
+
+## Breaking Changes in Version 8
+
+- The `fetchContext` option was renamed to `context`, and may no
+ longer be set on the cache instance itself.
+- Rewritten in TypeScript, so pretty much all the types moved
+ around a lot.
+- The AbortController/AbortSignal polyfill is removed. For this
+ reason, **Node version 16.14.0 or higher is now required**.
+- Internal properties were moved to actual private class
+ properties.
+- Keys and values must not be `null` or `undefined`.
+- Minified export available at `'lru-cache/min'`, for both CJS
+ and MJS builds.
+
+For more info, see the [change log](CHANGELOG.md).
diff --git a/node_modules/lru-cache/dist/cjs/index-cjs.d.ts b/node_modules/lru-cache/dist/cjs/index-cjs.d.ts
new file mode 100644
index 0000000..177a96f
--- /dev/null
+++ b/node_modules/lru-cache/dist/cjs/index-cjs.d.ts
@@ -0,0 +1,7 @@
+import LRUCache from './index.js';
+declare const _default: typeof LRUCache & {
+ default: typeof LRUCache;
+ LRUCache: typeof LRUCache;
+};
+export = _default;
+//# sourceMappingURL=index-cjs.d.ts.map
\ No newline at end of file
diff --git a/node_modules/lru-cache/dist/cjs/index-cjs.d.ts.map b/node_modules/lru-cache/dist/cjs/index-cjs.d.ts.map
new file mode 100644
index 0000000..15ad4ae
--- /dev/null
+++ b/node_modules/lru-cache/dist/cjs/index-cjs.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"index-cjs.d.ts","sourceRoot":"","sources":["../../src/index-cjs.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAA;;;;;AAEjC,kBAAiE"}
\ No newline at end of file
diff --git a/node_modules/lru-cache/dist/cjs/index-cjs.js b/node_modules/lru-cache/dist/cjs/index-cjs.js
new file mode 100644
index 0000000..00f0952
--- /dev/null
+++ b/node_modules/lru-cache/dist/cjs/index-cjs.js
@@ -0,0 +1,7 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+const index_js_1 = __importDefault(require("./index.js"));
+module.exports = Object.assign(index_js_1.default, { default: index_js_1.default, LRUCache: index_js_1.default });
+//# sourceMappingURL=index-cjs.js.map
\ No newline at end of file
diff --git a/node_modules/lru-cache/dist/cjs/index-cjs.js.map b/node_modules/lru-cache/dist/cjs/index-cjs.js.map
new file mode 100644
index 0000000..fa4be4c
--- /dev/null
+++ b/node_modules/lru-cache/dist/cjs/index-cjs.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index-cjs.js","sourceRoot":"","sources":["../../src/index-cjs.ts"],"names":[],"mappings":";;;;AAAA,0DAAiC;AAEjC,iBAAS,MAAM,CAAC,MAAM,CAAC,kBAAQ,EAAE,EAAE,OAAO,EAAE,kBAAQ,EAAE,QAAQ,EAAR,kBAAQ,EAAE,CAAC,CAAA","sourcesContent":["import LRUCache from './index.js'\n\nexport = Object.assign(LRUCache, { default: LRUCache, LRUCache })\n"]}
\ No newline at end of file
diff --git a/node_modules/lru-cache/dist/cjs/index.d.ts b/node_modules/lru-cache/dist/cjs/index.d.ts
new file mode 100644
index 0000000..8415eeb
--- /dev/null
+++ b/node_modules/lru-cache/dist/cjs/index.d.ts
@@ -0,0 +1,807 @@
+/**
+ * @module LRUCache
+ */
+declare const TYPE: unique symbol;
+type Index = number & {
+ [TYPE]: 'LRUCache Index';
+};
+type UintArray = Uint8Array | Uint16Array | Uint32Array;
+type NumberArray = UintArray | number[];
+declare class ZeroArray extends Array {
+ constructor(size: number);
+}
+type StackLike = Stack | Index[];
+declare class Stack {
+ #private;
+ heap: NumberArray;
+ length: number;
+ static create(max: number): StackLike;
+ constructor(max: number, HeapCls: {
+ new (n: number): NumberArray;
+ });
+ push(n: Index): void;
+ pop(): Index;
+}
+/**
+ * Promise representing an in-progress {@link LRUCache#fetch} call
+ */
+export type BackgroundFetch = Promise & {
+ __returned: BackgroundFetch | undefined;
+ __abortController: AbortController;
+ __staleWhileFetching: V | undefined;
+};
+export declare namespace LRUCache {
+ /**
+ * An integer greater than 0, reflecting the calculated size of items
+ */
+ type Size = number;
+ /**
+ * Integer greater than 0, representing some number of milliseconds, or the
+ * time at which a TTL started counting from.
+ */
+ type Milliseconds = number;
+ /**
+ * An integer greater than 0, reflecting a number of items
+ */
+ type Count = number;
+ /**
+ * The reason why an item was removed from the cache, passed
+ * to the {@link Disposer} methods.
+ */
+ type DisposeReason = 'evict' | 'set' | 'delete';
+ /**
+ * A method called upon item removal, passed as the
+ * {@link OptionsBase.dispose} and/or
+ * {@link OptionsBase.disposeAfter} options.
+ */
+ type Disposer = (value: V, key: K, reason: DisposeReason) => void;
+ /**
+ * A function that returns the effective calculated size
+ * of an entry in the cache.
+ */
+ type SizeCalculator = (value: V, key: K) => Size;
+ /**
+ * Options provided to the
+ * {@link OptionsBase.fetchMethod} function.
+ */
+ interface FetcherOptions {
+ signal: AbortSignal;
+ options: FetcherFetchOptions;
+ /**
+ * Object provided in the {@link FetchOptions.context} option to
+ * {@link LRUCache#fetch}
+ */
+ context: FC;
+ }
+ /**
+ * Status object that may be passed to {@link LRUCache#fetch},
+ * {@link LRUCache#get}, {@link LRUCache#set}, and {@link LRUCache#has}.
+ */
+ interface Status {
+ /**
+ * The status of a set() operation.
+ *
+ * - add: the item was not found in the cache, and was added
+ * - update: the item was in the cache, with the same value provided
+ * - replace: the item was in the cache, and replaced
+ * - miss: the item was not added to the cache for some reason
+ */
+ set?: 'add' | 'update' | 'replace' | 'miss';
+ /**
+ * the ttl stored for the item, or undefined if ttls are not used.
+ */
+ ttl?: Milliseconds;
+ /**
+ * the start time for the item, or undefined if ttls are not used.
+ */
+ start?: Milliseconds;
+ /**
+ * The timestamp used for TTL calculation
+ */
+ now?: Milliseconds;
+ /**
+ * the remaining ttl for the item, or undefined if ttls are not used.
+ */
+ remainingTTL?: Milliseconds;
+ /**
+ * The calculated size for the item, if sizes are used.
+ */
+ entrySize?: Size;
+ /**
+ * The total calculated size of the cache, if sizes are used.
+ */
+ totalCalculatedSize?: Size;
+ /**
+ * A flag indicating that the item was not stored, due to exceeding the
+ * {@link OptionsBase.maxEntrySize}
+ */
+ maxEntrySizeExceeded?: true;
+ /**
+ * The old value, specified in the case of `set:'update'` or
+ * `set:'replace'`
+ */
+ oldValue?: V;
+ /**
+ * The results of a {@link LRUCache#has} operation
+ *
+ * - hit: the item was found in the cache
+ * - stale: the item was found in the cache, but is stale
+ * - miss: the item was not found in the cache
+ */
+ has?: 'hit' | 'stale' | 'miss';
+ /**
+ * The status of a {@link LRUCache#fetch} operation.
+ * Note that this can change as the underlying fetch() moves through
+ * various states.
+ *
+ * - inflight: there is another fetch() for this key which is in process
+ * - get: there is no fetchMethod, so {@link LRUCache#get} was called.
+ * - miss: the item is not in cache, and will be fetched.
+ * - hit: the item is in the cache, and was resolved immediately.
+ * - stale: the item is in the cache, but stale.
+ * - refresh: the item is in the cache, and not stale, but
+ * {@link FetchOptions.forceRefresh} was specified.
+ */
+ fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh';
+ /**
+ * The {@link OptionsBase.fetchMethod} was called
+ */
+ fetchDispatched?: true;
+ /**
+ * The cached value was updated after a successful call to
+ * {@link OptionsBase.fetchMethod}
+ */
+ fetchUpdated?: true;
+ /**
+ * The reason for a fetch() rejection. Either the error raised by the
+ * {@link OptionsBase.fetchMethod}, or the reason for an
+ * AbortSignal.
+ */
+ fetchError?: Error;
+ /**
+ * The fetch received an abort signal
+ */
+ fetchAborted?: true;
+ /**
+ * The abort signal received was ignored, and the fetch was allowed to
+ * continue.
+ */
+ fetchAbortIgnored?: true;
+ /**
+ * The fetchMethod promise resolved successfully
+ */
+ fetchResolved?: true;
+ /**
+ * The fetchMethod promise was rejected
+ */
+ fetchRejected?: true;
+ /**
+ * The status of a {@link LRUCache#get} operation.
+ *
+ * - fetching: The item is currently being fetched. If a previous value
+ * is present and allowed, that will be returned.
+ * - stale: The item is in the cache, and is stale.
+ * - hit: the item is in the cache
+ * - miss: the item is not in the cache
+ */
+ get?: 'stale' | 'hit' | 'miss';
+ /**
+ * A fetch or get operation returned a stale value.
+ */
+ returnedStale?: true;
+ }
+ /**
+ * options which override the options set in the LRUCache constructor
+ * when calling {@link LRUCache#fetch}.
+ *
+ * This is the union of {@link GetOptions} and {@link SetOptions}, plus
+ * {@link OptionsBase.noDeleteOnFetchRejection},
+ * {@link OptionsBase.allowStaleOnFetchRejection},
+ * {@link FetchOptions.forceRefresh}, and
+ * {@link OptionsBase.context}
+ *
+ * Any of these may be modified in the {@link OptionsBase.fetchMethod}
+ * function, but the {@link GetOptions} fields will of course have no
+ * effect, as the {@link LRUCache#get} call already happened by the time
+ * the fetchMethod is called.
+ */
+ interface FetcherFetchOptions extends Pick, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet' | 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL' | 'noDeleteOnFetchRejection' | 'allowStaleOnFetchRejection' | 'ignoreFetchAbort' | 'allowStaleOnFetchAbort'> {
+ status?: Status;
+ size?: Size;
+ }
+ /**
+ * Options that may be passed to the {@link LRUCache#fetch} method.
+ */
+ interface FetchOptions extends FetcherFetchOptions {
+ /**
+ * Set to true to force a re-load of the existing data, even if it
+ * is not yet stale.
+ */
+ forceRefresh?: boolean;
+ /**
+ * Context provided to the {@link OptionsBase.fetchMethod} as
+ * the {@link FetcherOptions.context} param.
+ *
+ * If the FC type is specified as unknown (the default),
+ * undefined or void, then this is optional. Otherwise, it will
+ * be required.
+ */
+ context?: FC;
+ signal?: AbortSignal;
+ status?: Status;
+ }
+ /**
+ * Options provided to {@link LRUCache#fetch} when the FC type is something
+ * other than `unknown`, `undefined`, or `void`
+ */
+ interface FetchOptionsWithContext extends FetchOptions {
+ context: FC;
+ }
+ /**
+ * Options provided to {@link LRUCache#fetch} when the FC type is
+ * `undefined` or `void`
+ */
+ interface FetchOptionsNoContext extends FetchOptions {
+ context?: undefined;
+ }
+ /**
+ * Options that may be passed to the {@link LRUCache#has} method.
+ */
+ interface HasOptions extends Pick, 'updateAgeOnHas'> {
+ status?: Status;
+ }
+ /**
+ * Options that may be passed to the {@link LRUCache#get} method.
+ */
+ interface GetOptions extends Pick, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet'> {
+ status?: Status;
+ }
+ /**
+ * Options that may be passed to the {@link LRUCache#peek} method.
+ */
+ interface PeekOptions extends Pick, 'allowStale'> {
+ }
+ /**
+ * Options that may be passed to the {@link LRUCache#set} method.
+ */
+ interface SetOptions extends Pick, 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL'> {
+ /**
+ * If size tracking is enabled, then setting an explicit size
+ * in the {@link LRUCache#set} call will prevent calling the
+ * {@link OptionsBase.sizeCalculation} function.
+ */
+ size?: Size;
+ /**
+ * If TTL tracking is enabled, then setting an explicit start
+ * time in the {@link LRUCache#set} call will override the
+ * default time from `performance.now()` or `Date.now()`.
+ *
+ * Note that it must be a valid value for whichever time-tracking
+ * method is in use.
+ */
+ start?: Milliseconds;
+ status?: Status;
+ }
+ /**
+ * The type signature for the {@link OptionsBase.fetchMethod} option.
+ */
+ type Fetcher = (key: K, staleValue: V | undefined, options: FetcherOptions) => Promise | V | void | undefined;
+ /**
+ * Options which may be passed to the {@link LRUCache} constructor.
+ *
+ * Most of these may be overridden in the various options that use
+ * them.
+ *
+ * Despite all being technically optional, the constructor requires that
+ * a cache is at minimum limited by one or more of {@link OptionsBase.max},
+ * {@link OptionsBase.ttl}, or {@link OptionsBase.maxSize}.
+ *
+ * If {@link OptionsBase.ttl} is used alone, then it is strongly advised
+ * (and in fact required by the type definitions here) that the cache
+ * also set {@link OptionsBase.ttlAutopurge}, to prevent potentially
+ * unbounded storage.
+ */
+ interface OptionsBase {
+ /**
+ * The maximum number of items to store in the cache before evicting
+ * old entries. This is read-only on the {@link LRUCache} instance,
+ * and may not be overridden.
+ *
+ * If set, then storage space will be pre-allocated at construction
+ * time, and the cache will perform significantly faster.
+ *
+ * Note that significantly fewer items may be stored, if
+ * {@link OptionsBase.maxSize} and/or {@link OptionsBase.ttl} are also
+ * set.
+ */
+ max?: Count;
+ /**
+ * Max time in milliseconds for items to live in cache before they are
+ * considered stale. Note that stale items are NOT preemptively removed
+ * by default, and MAY live in the cache long after they have expired.
+ *
+ * Also, as this cache is optimized for LRU/MRU operations, some of
+ * the staleness/TTL checks will reduce performance, as they will incur
+ * overhead by deleting items.
+ *
+ * Must be an integer number of ms. If set to 0, this indicates "no TTL"
+ *
+ * @default 0
+ */
+ ttl?: Milliseconds;
+ /**
+ * Minimum amount of time in ms in which to check for staleness.
+ * Defaults to 1, which means that the current time is checked
+ * at most once per millisecond.
+ *
+ * Set to 0 to check the current time every time staleness is tested.
+ * (This reduces performance, and is theoretically unnecessary.)
+ *
+ * Setting this to a higher value will improve performance somewhat
+ * while using ttl tracking, albeit at the expense of keeping stale
+ * items around a bit longer than their TTLs would indicate.
+ *
+ * @default 1
+ */
+ ttlResolution?: Milliseconds;
+ /**
+ * Preemptively remove stale items from the cache.
+ * Note that this may significantly degrade performance,
+ * especially if the cache is storing a large number of items.
+ * It is almost always best to just leave the stale items in
+ * the cache, and let them fall out as new items are added.
+ *
+ * Note that this means that {@link OptionsBase.allowStale} is a bit
+ * pointless, as stale items will be deleted almost as soon as they
+ * expire.
+ *
+ * @default false
+ */
+ ttlAutopurge?: boolean;
+ /**
+ * Update the age of items on {@link LRUCache#get}, renewing their TTL
+ *
+ * Has no effect if {@link OptionsBase.ttl} is not set.
+ *
+ * @default false
+ */
+ updateAgeOnGet?: boolean;
+ /**
+ * Update the age of items on {@link LRUCache#has}, renewing their TTL
+ *
+ * Has no effect if {@link OptionsBase.ttl} is not set.
+ *
+ * @default false
+ */
+ updateAgeOnHas?: boolean;
+ /**
+ * Allow {@link LRUCache#get} and {@link LRUCache#fetch} calls to return
+ * stale data, if available.
+ */
+ allowStale?: boolean;
+ /**
+ * Function that is called on items when they are dropped from the cache.
+ * This can be handy if you want to close file descriptors or do other
+ * cleanup tasks when items are no longer accessible. Called with `key,
+ * value`. It's called before actually removing the item from the
+ * internal cache, so it is *NOT* safe to re-add them.
+ *
+ * Use {@link OptionsBase.disposeAfter} if you wish to dispose items after
+ * they have been full removed, when it is safe to add them back to the
+ * cache.
+ */
+ dispose?: Disposer;
+ /**
+ * The same as {@link OptionsBase.dispose}, but called *after* the entry
+ * is completely removed and the cache is once again in a clean state.
+ * It is safe to add an item right back into the cache at this point.
+ * However, note that it is *very* easy to inadvertently create infinite
+ * recursion this way.
+ */
+ disposeAfter?: Disposer;
+ /**
+ * Set to true to suppress calling the
+ * {@link OptionsBase.dispose} function if the entry key is
+ * still accessible within the cache.
+ * This may be overridden by passing an options object to
+ * {@link LRUCache#set}.
+ */
+ noDisposeOnSet?: boolean;
+ /**
+ * Boolean flag to tell the cache to not update the TTL when
+ * setting a new value for an existing key (ie, when updating a value
+ * rather than inserting a new value). Note that the TTL value is
+ * _always_ set (if provided) when adding a new entry into the cache.
+ *
+ * Has no effect if a {@link OptionsBase.ttl} is not set.
+ */
+ noUpdateTTL?: boolean;
+ /**
+ * If you wish to track item size, you must provide a maxSize
+ * note that we still will only keep up to max *actual items*,
+ * if max is set, so size tracking may cause fewer than max items
+ * to be stored. At the extreme, a single item of maxSize size
+ * will cause everything else in the cache to be dropped when it
+ * is added. Use with caution!
+ *
+ * Note also that size tracking can negatively impact performance,
+ * though for most cases, only minimally.
+ */
+ maxSize?: Size;
+ /**
+ * The maximum allowed size for any single item in the cache.
+ *
+ * If a larger item is passed to {@link LRUCache#set} or returned by a
+ * {@link OptionsBase.fetchMethod}, then it will not be stored in the
+ * cache.
+ */
+ maxEntrySize?: Size;
+ /**
+ * A function that returns a number indicating the item's size.
+ *
+ * If not provided, and {@link OptionsBase.maxSize} or
+ * {@link OptionsBase.maxEntrySize} are set, then all
+ * {@link LRUCache#set} calls **must** provide an explicit
+ * {@link SetOptions.size} or sizeCalculation param.
+ */
+ sizeCalculation?: SizeCalculator;
+ /**
+ * Method that provides the implementation for {@link LRUCache#fetch}
+ */
+ fetchMethod?: Fetcher;
+ /**
+ * Set to true to suppress the deletion of stale data when a
+ * {@link OptionsBase.fetchMethod} returns a rejected promise.
+ */
+ noDeleteOnFetchRejection?: boolean;
+ /**
+ * Do not delete stale items when they are retrieved with
+ * {@link LRUCache#get}.
+ *
+ * Note that the `get` return value will still be `undefined`
+ * unless {@link OptionsBase.allowStale} is true.
+ */
+ noDeleteOnStaleGet?: boolean;
+ /**
+ * Set to true to allow returning stale data when a
+ * {@link OptionsBase.fetchMethod} throws an error or returns a rejected
+ * promise.
+ *
+ * This differs from using {@link OptionsBase.allowStale} in that stale
+ * data will ONLY be returned in the case that the
+ * {@link LRUCache#fetch} fails, not any other times.
+ */
+ allowStaleOnFetchRejection?: boolean;
+ /**
+ * Set to true to return a stale value from the cache when the
+ * `AbortSignal` passed to the {@link OptionsBase.fetchMethod} dispatches an `'abort'`
+ * event, whether user-triggered, or due to internal cache behavior.
+ *
+ * Unless {@link OptionsBase.ignoreFetchAbort} is also set, the underlying
+ * {@link OptionsBase.fetchMethod} will still be considered canceled, and its return
+ * value will be ignored and not cached.
+ */
+ allowStaleOnFetchAbort?: boolean;
+ /**
+ * Set to true to ignore the `abort` event emitted by the `AbortSignal`
+ * object passed to {@link OptionsBase.fetchMethod}, and still cache the
+ * resulting resolution value, as long as it is not `undefined`.
+ *
+ * When used on its own, this means aborted {@link LRUCache#fetch} calls are not
+ * immediately resolved or rejected when they are aborted, and instead
+ * take the full time to await.
+ *
+ * When used with {@link OptionsBase.allowStaleOnFetchAbort}, aborted
+ * {@link LRUCache#fetch} calls will resolve immediately to their stale
+ * cached value or `undefined`, and will continue to process and eventually
+ * update the cache when they resolve, as long as the resulting value is
+ * not `undefined`, thus supporting a "return stale on timeout while
+ * refreshing" mechanism by passing `AbortSignal.timeout(n)` as the signal.
+ *
+ * **Note**: regardless of this setting, an `abort` event _is still
+ * emitted on the `AbortSignal` object_, so may result in invalid results
+ * when passed to other underlying APIs that use AbortSignals.
+ *
+ * This may be overridden in the {@link OptionsBase.fetchMethod} or the
+ * call to {@link LRUCache#fetch}.
+ */
+ ignoreFetchAbort?: boolean;
+ }
+ interface OptionsMaxLimit extends OptionsBase {
+ max: Count;
+ }
+ interface OptionsTTLLimit extends OptionsBase {
+ ttl: Milliseconds;
+ ttlAutopurge: boolean;
+ }
+ interface OptionsSizeLimit extends OptionsBase {
+ maxSize: Size;
+ }
+ /**
+ * The valid safe options for the {@link LRUCache} constructor
+ */
+ type Options = OptionsMaxLimit | OptionsSizeLimit | OptionsTTLLimit;
+ /**
+ * Entry objects used by {@link LRUCache#load} and {@link LRUCache#dump}
+ */
+ interface Entry {
+ value: V;
+ ttl?: Milliseconds;
+ size?: Size;
+ start?: Milliseconds;
+ }
+}
+/**
+ * Default export, the thing you're using this module to get.
+ *
+ * All properties from the options object (with the exception of
+ * {@link OptionsBase.max} and {@link OptionsBase.maxSize}) are added as
+ * normal public members. (`max` and `maxBase` are read-only getters.)
+ * Changing any of these will alter the defaults for subsequent method calls,
+ * but is otherwise safe.
+ */
+export declare class LRUCache {
+ #private;
+ /**
+ * {@link LRUCache.OptionsBase.ttl}
+ */
+ ttl: LRUCache.Milliseconds;
+ /**
+ * {@link LRUCache.OptionsBase.ttlResolution}
+ */
+ ttlResolution: LRUCache.Milliseconds;
+ /**
+ * {@link LRUCache.OptionsBase.ttlAutopurge}
+ */
+ ttlAutopurge: boolean;
+ /**
+ * {@link LRUCache.OptionsBase.updateAgeOnGet}
+ */
+ updateAgeOnGet: boolean;
+ /**
+ * {@link LRUCache.OptionsBase.updateAgeOnHas}
+ */
+ updateAgeOnHas: boolean;
+ /**
+ * {@link LRUCache.OptionsBase.allowStale}
+ */
+ allowStale: boolean;
+ /**
+ * {@link LRUCache.OptionsBase.noDisposeOnSet}
+ */
+ noDisposeOnSet: boolean;
+ /**
+ * {@link LRUCache.OptionsBase.noUpdateTTL}
+ */
+ noUpdateTTL: boolean;
+ /**
+ * {@link LRUCache.OptionsBase.maxEntrySize}
+ */
+ maxEntrySize: LRUCache.Size;
+ /**
+ * {@link LRUCache.OptionsBase.sizeCalculation}
+ */
+ sizeCalculation?: LRUCache.SizeCalculator;
+ /**
+ * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
+ */
+ noDeleteOnFetchRejection: boolean;
+ /**
+ * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
+ */
+ noDeleteOnStaleGet: boolean;
+ /**
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
+ */
+ allowStaleOnFetchAbort: boolean;
+ /**
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
+ */
+ allowStaleOnFetchRejection: boolean;
+ /**
+ * {@link LRUCache.OptionsBase.ignoreFetchAbort}
+ */
+ ignoreFetchAbort: boolean;
+ /**
+ * Do not call this method unless you need to inspect the
+ * inner workings of the cache. If anything returned by this
+ * object is modified in any way, strange breakage may occur.
+ *
+ * These fields are private for a reason!
+ *
+ * @internal
+ */
+ static unsafeExposeInternals(c: LRUCache): {
+ starts: ZeroArray | undefined;
+ ttls: ZeroArray | undefined;
+ sizes: ZeroArray | undefined;
+ keyMap: Map;
+ keyList: (K | undefined)[];
+ valList: (V | BackgroundFetch | undefined)[];
+ next: NumberArray;
+ prev: NumberArray;
+ readonly head: Index;
+ readonly tail: Index;
+ free: StackLike;
+ isBackgroundFetch: (p: any) => boolean;
+ backgroundFetch: (k: K, index: number | undefined, options: LRUCache.FetchOptions, context: any) => BackgroundFetch;
+ moveToTail: (index: number) => void;
+ indexes: (options?: {
+ allowStale: boolean;
+ }) => Generator;
+ rindexes: (options?: {
+ allowStale: boolean;
+ }) => Generator;
+ isStale: (index: number | undefined) => boolean;
+ };
+ /**
+ * {@link LRUCache.OptionsBase.max} (read-only)
+ */
+ get max(): LRUCache.Count;
+ /**
+ * {@link LRUCache.OptionsBase.maxSize} (read-only)
+ */
+ get maxSize(): LRUCache.Count;
+ /**
+ * The total computed size of items in the cache (read-only)
+ */
+ get calculatedSize(): LRUCache.Size;
+ /**
+ * The number of items stored in the cache (read-only)
+ */
+ get size(): LRUCache.Count;
+ /**
+ * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
+ */
+ get fetchMethod(): LRUCache.Fetcher | undefined;
+ /**
+ * {@link LRUCache.OptionsBase.dispose} (read-only)
+ */
+ get dispose(): LRUCache.Disposer | undefined;
+ /**
+ * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
+ */
+ get disposeAfter(): LRUCache.Disposer | undefined;
+ constructor(options: LRUCache.Options | LRUCache);
+ /**
+ * Return the remaining TTL time for a given entry key
+ */
+ getRemainingTTL(key: K): number;
+ /**
+ * Return a generator yielding `[key, value]` pairs,
+ * in order from most recently used to least recently used.
+ */
+ entries(): Generator<(K | V | BackgroundFetch | undefined)[], void, unknown>;
+ /**
+ * Inverse order version of {@link LRUCache.entries}
+ *
+ * Return a generator yielding `[key, value]` pairs,
+ * in order from least recently used to most recently used.
+ */
+ rentries(): Generator<(K | V | BackgroundFetch | undefined)[], void, unknown>;
+ /**
+ * Return a generator yielding the keys in the cache,
+ * in order from most recently used to least recently used.
+ */
+ keys(): Generator;
+ /**
+ * Inverse order version of {@link LRUCache.keys}
+ *
+ * Return a generator yielding the keys in the cache,
+ * in order from least recently used to most recently used.
+ */
+ rkeys(): Generator;
+ /**
+ * Return a generator yielding the values in the cache,
+ * in order from most recently used to least recently used.
+ */
+ values(): Generator | undefined, void, unknown>;
+ /**
+ * Inverse order version of {@link LRUCache.values}
+ *
+ * Return a generator yielding the values in the cache,
+ * in order from least recently used to most recently used.
+ */
+ rvalues(): Generator | undefined, void, unknown>;
+ /**
+ * Iterating over the cache itself yields the same results as
+ * {@link LRUCache.entries}
+ */
+ [Symbol.iterator](): Generator<(K | V | BackgroundFetch | undefined)[], void, unknown>;
+ /**
+ * Find a value for which the supplied fn method returns a truthy value,
+ * similar to Array.find(). fn is called as fn(value, key, cache).
+ */
+ find(fn: (v: V, k: K, self: LRUCache) => boolean, getOptions?: LRUCache.GetOptions): V | undefined;
+ /**
+ * Call the supplied function on each item in the cache, in order from
+ * most recently used to least recently used. fn is called as
+ * fn(value, key, cache). Does not update age or recenty of use.
+ * Does not iterate over stale values.
+ */
+ forEach(fn: (v: V, k: K, self: LRUCache) => any, thisp?: any): void;
+ /**
+ * The same as {@link LRUCache.forEach} but items are iterated over in
+ * reverse order. (ie, less recently used items are iterated over first.)
+ */
+ rforEach(fn: (v: V, k: K, self: LRUCache) => any, thisp?: any): void;
+ /**
+ * Delete any stale entries. Returns true if anything was removed,
+ * false otherwise.
+ */
+ purgeStale(): boolean;
+ /**
+ * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
+ * passed to cache.load()
+ */
+ dump(): [K, LRUCache.Entry][];
+ /**
+ * Reset the cache and load in the items in entries in the order listed.
+ * Note that the shape of the resulting cache may be different if the
+ * same options are not used in both caches.
+ */
+ load(arr: [K, LRUCache.Entry][]): void;
+ /**
+ * Add a value to the cache.
+ */
+ set(k: K, v: V | BackgroundFetch, setOptions?: LRUCache.SetOptions): this;
+ /**
+ * Evict the least recently used item, returning its value or
+ * `undefined` if cache is empty.
+ */
+ pop(): V | undefined;
+ /**
+ * Check if a key is in the cache, without updating the recency of use.
+ * Will return false if the item is stale, even though it is technically
+ * in the cache.
+ *
+ * Will not update item age unless
+ * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
+ */
+ has(k: K, hasOptions?: LRUCache.HasOptions): boolean;
+ /**
+ * Like {@link LRUCache#get} but doesn't update recency or delete stale
+ * items.
+ *
+ * Returns `undefined` if the item is stale, unless
+ * {@link LRUCache.OptionsBase.allowStale} is set.
+ */
+ peek(k: K, peekOptions?: LRUCache.PeekOptions): V | undefined;
+ /**
+ * Make an asynchronous cached fetch using the
+ * {@link LRUCache.OptionsBase.fetchMethod} function.
+ *
+ * If multiple fetches for the same key are issued, then they will all be
+ * coalesced into a single call to fetchMethod.
+ *
+ * Note that this means that handling options such as
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort},
+ * {@link LRUCache.FetchOptions.signal},
+ * and {@link LRUCache.OptionsBase.allowStaleOnFetchRejection} will be
+ * determined by the FIRST fetch() call for a given key.
+ *
+ * This is a known (fixable) shortcoming which will be addresed on when
+ * someone complains about it, as the fix would involve added complexity and
+ * may not be worth the costs for this edge case.
+ */
+ fetch(k: K, fetchOptions: unknown extends FC ? LRUCache.FetchOptions : FC extends undefined | void ? LRUCache.FetchOptionsNoContext : LRUCache.FetchOptionsWithContext): Promise;
+ fetch(k: unknown extends FC ? K : FC extends undefined | void ? K : never, fetchOptions?: unknown extends FC ? LRUCache.FetchOptions : FC extends undefined | void ? LRUCache.FetchOptionsNoContext : never): Promise;
+ /**
+ * Return a value from the cache. Will update the recency of the cache
+ * entry found.
+ *
+ * If the key is not found, get() will return `undefined`.
+ */
+ get(k: K, getOptions?: LRUCache.GetOptions): V | undefined;
+ /**
+ * Deletes a key out of the cache.
+ * Returns true if the key was deleted, false otherwise.
+ */
+ delete(k: K): boolean;
+ /**
+ * Clear the cache entirely, throwing away all values.
+ */
+ clear(): void;
+}
+export default LRUCache;
+//# sourceMappingURL=index.d.ts.map
\ No newline at end of file
diff --git a/node_modules/lru-cache/dist/cjs/index.d.ts.map b/node_modules/lru-cache/dist/cjs/index.d.ts.map
new file mode 100644
index 0000000..2f068e4
--- /dev/null
+++ b/node_modules/lru-cache/dist/cjs/index.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AA+BH,QAAA,MAAM,IAAI,eAAiB,CAAA;AAE3B,KAAK,KAAK,GAAG,MAAM,GAAG;IAAE,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAA;AAKlD,KAAK,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,CAAA;AACvD,KAAK,WAAW,GAAG,SAAS,GAAG,MAAM,EAAE,CAAA;AAyBvC,cAAM,SAAU,SAAQ,KAAK,CAAC,MAAM,CAAC;gBACvB,IAAI,EAAE,MAAM;CAIzB;AAED,KAAK,SAAS,GAAG,KAAK,GAAG,KAAK,EAAE,CAAA;AAChC,cAAM,KAAK;;IACT,IAAI,EAAE,WAAW,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IAGd,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;gBASnC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE;IAU3C,IAAI,CAAC,CAAC,EAAE,KAAK;IAGb,GAAG,IAAI,KAAK;CAGb;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,GAAG;IAC/D,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;IAC1C,iBAAiB,EAAE,eAAe,CAAA;IAClC,oBAAoB,EAAE,CAAC,GAAG,SAAS,CAAA;CACpC,CAAA;AAQD,yBAAiB,QAAQ,CAAC;IACxB;;OAEG;IACH,KAAY,IAAI,GAAG,MAAM,CAAA;IAEzB;;;OAGG;IACH,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AAA"}
\ No newline at end of file
diff --git a/node_modules/lru-cache/dist/cjs/index.js b/node_modules/lru-cache/dist/cjs/index.js
new file mode 100644
index 0000000..09f15dd
--- /dev/null
+++ b/node_modules/lru-cache/dist/cjs/index.js
@@ -0,0 +1,1334 @@
+"use strict";
+/**
+ * @module LRUCache
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.LRUCache = void 0;
+const perf = typeof performance === 'object' &&
+ performance &&
+ typeof performance.now === 'function'
+ ? performance
+ : Date;
+const warned = new Set();
+const emitWarning = (msg, type, code, fn) => {
+ typeof process === 'object' &&
+ process &&
+ typeof process.emitWarning === 'function'
+ ? process.emitWarning(msg, type, code, fn)
+ : console.error(`[${code}] ${type}: ${msg}`);
+};
+const shouldWarn = (code) => !warned.has(code);
+const TYPE = Symbol('type');
+const isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
+/* c8 ignore start */
+// This is a little bit ridiculous, tbh.
+// The maximum array length is 2^32-1 or thereabouts on most JS impls.
+// And well before that point, you're caching the entire world, I mean,
+// that's ~32GB of just integers for the next/prev links, plus whatever
+// else to hold that many keys and values. Just filling the memory with
+// zeroes at init time is brutal when you get that big.
+// But why not be complete?
+// Maybe in the future, these limits will have expanded.
+const getUintArray = (max) => !isPosInt(max)
+ ? null
+ : max <= Math.pow(2, 8)
+ ? Uint8Array
+ : max <= Math.pow(2, 16)
+ ? Uint16Array
+ : max <= Math.pow(2, 32)
+ ? Uint32Array
+ : max <= Number.MAX_SAFE_INTEGER
+ ? ZeroArray
+ : null;
+/* c8 ignore stop */
+class ZeroArray extends Array {
+ constructor(size) {
+ super(size);
+ this.fill(0);
+ }
+}
+class Stack {
+ heap;
+ length;
+ // private constructor
+ static #constructing = false;
+ static create(max) {
+ const HeapCls = getUintArray(max);
+ if (!HeapCls)
+ return [];
+ Stack.#constructing = true;
+ const s = new Stack(max, HeapCls);
+ Stack.#constructing = false;
+ return s;
+ }
+ constructor(max, HeapCls) {
+ /* c8 ignore start */
+ if (!Stack.#constructing) {
+ throw new TypeError('instantiate Stack using Stack.create(n)');
+ }
+ /* c8 ignore stop */
+ this.heap = new HeapCls(max);
+ this.length = 0;
+ }
+ push(n) {
+ this.heap[this.length++] = n;
+ }
+ pop() {
+ return this.heap[--this.length];
+ }
+}
+/**
+ * Default export, the thing you're using this module to get.
+ *
+ * All properties from the options object (with the exception of
+ * {@link OptionsBase.max} and {@link OptionsBase.maxSize}) are added as
+ * normal public members. (`max` and `maxBase` are read-only getters.)
+ * Changing any of these will alter the defaults for subsequent method calls,
+ * but is otherwise safe.
+ */
+class LRUCache {
+ // properties coming in from the options of these, only max and maxSize
+ // really *need* to be protected. The rest can be modified, as they just
+ // set defaults for various methods.
+ #max;
+ #maxSize;
+ #dispose;
+ #disposeAfter;
+ #fetchMethod;
+ /**
+ * {@link LRUCache.OptionsBase.ttl}
+ */
+ ttl;
+ /**
+ * {@link LRUCache.OptionsBase.ttlResolution}
+ */
+ ttlResolution;
+ /**
+ * {@link LRUCache.OptionsBase.ttlAutopurge}
+ */
+ ttlAutopurge;
+ /**
+ * {@link LRUCache.OptionsBase.updateAgeOnGet}
+ */
+ updateAgeOnGet;
+ /**
+ * {@link LRUCache.OptionsBase.updateAgeOnHas}
+ */
+ updateAgeOnHas;
+ /**
+ * {@link LRUCache.OptionsBase.allowStale}
+ */
+ allowStale;
+ /**
+ * {@link LRUCache.OptionsBase.noDisposeOnSet}
+ */
+ noDisposeOnSet;
+ /**
+ * {@link LRUCache.OptionsBase.noUpdateTTL}
+ */
+ noUpdateTTL;
+ /**
+ * {@link LRUCache.OptionsBase.maxEntrySize}
+ */
+ maxEntrySize;
+ /**
+ * {@link LRUCache.OptionsBase.sizeCalculation}
+ */
+ sizeCalculation;
+ /**
+ * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
+ */
+ noDeleteOnFetchRejection;
+ /**
+ * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
+ */
+ noDeleteOnStaleGet;
+ /**
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
+ */
+ allowStaleOnFetchAbort;
+ /**
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
+ */
+ allowStaleOnFetchRejection;
+ /**
+ * {@link LRUCache.OptionsBase.ignoreFetchAbort}
+ */
+ ignoreFetchAbort;
+ // computed properties
+ #size;
+ #calculatedSize;
+ #keyMap;
+ #keyList;
+ #valList;
+ #next;
+ #prev;
+ #head;
+ #tail;
+ #free;
+ #disposed;
+ #sizes;
+ #starts;
+ #ttls;
+ #hasDispose;
+ #hasFetchMethod;
+ #hasDisposeAfter;
+ /**
+ * Do not call this method unless you need to inspect the
+ * inner workings of the cache. If anything returned by this
+ * object is modified in any way, strange breakage may occur.
+ *
+ * These fields are private for a reason!
+ *
+ * @internal
+ */
+ static unsafeExposeInternals(c) {
+ return {
+ // properties
+ starts: c.#starts,
+ ttls: c.#ttls,
+ sizes: c.#sizes,
+ keyMap: c.#keyMap,
+ keyList: c.#keyList,
+ valList: c.#valList,
+ next: c.#next,
+ prev: c.#prev,
+ get head() {
+ return c.#head;
+ },
+ get tail() {
+ return c.#tail;
+ },
+ free: c.#free,
+ // methods
+ isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
+ backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
+ moveToTail: (index) => c.#moveToTail(index),
+ indexes: (options) => c.#indexes(options),
+ rindexes: (options) => c.#rindexes(options),
+ isStale: (index) => c.#isStale(index),
+ };
+ }
+ // Protected read-only members
+ /**
+ * {@link LRUCache.OptionsBase.max} (read-only)
+ */
+ get max() {
+ return this.#max;
+ }
+ /**
+ * {@link LRUCache.OptionsBase.maxSize} (read-only)
+ */
+ get maxSize() {
+ return this.#maxSize;
+ }
+ /**
+ * The total computed size of items in the cache (read-only)
+ */
+ get calculatedSize() {
+ return this.#calculatedSize;
+ }
+ /**
+ * The number of items stored in the cache (read-only)
+ */
+ get size() {
+ return this.#size;
+ }
+ /**
+ * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
+ */
+ get fetchMethod() {
+ return this.#fetchMethod;
+ }
+ /**
+ * {@link LRUCache.OptionsBase.dispose} (read-only)
+ */
+ get dispose() {
+ return this.#dispose;
+ }
+ /**
+ * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
+ */
+ get disposeAfter() {
+ return this.#disposeAfter;
+ }
+ constructor(options) {
+ const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, } = options;
+ if (max !== 0 && !isPosInt(max)) {
+ throw new TypeError('max option must be a nonnegative integer');
+ }
+ const UintArray = max ? getUintArray(max) : Array;
+ if (!UintArray) {
+ throw new Error('invalid max value: ' + max);
+ }
+ this.#max = max;
+ this.#maxSize = maxSize;
+ this.maxEntrySize = maxEntrySize || this.#maxSize;
+ this.sizeCalculation = sizeCalculation;
+ if (this.sizeCalculation) {
+ if (!this.#maxSize && !this.maxEntrySize) {
+ throw new TypeError('cannot set sizeCalculation without setting maxSize or maxEntrySize');
+ }
+ if (typeof this.sizeCalculation !== 'function') {
+ throw new TypeError('sizeCalculation set to non-function');
+ }
+ }
+ if (fetchMethod !== undefined &&
+ typeof fetchMethod !== 'function') {
+ throw new TypeError('fetchMethod must be a function if specified');
+ }
+ this.#fetchMethod = fetchMethod;
+ this.#hasFetchMethod = !!fetchMethod;
+ this.#keyMap = new Map();
+ this.#keyList = new Array(max).fill(undefined);
+ this.#valList = new Array(max).fill(undefined);
+ this.#next = new UintArray(max);
+ this.#prev = new UintArray(max);
+ this.#head = 0;
+ this.#tail = 0;
+ this.#free = Stack.create(max);
+ this.#size = 0;
+ this.#calculatedSize = 0;
+ if (typeof dispose === 'function') {
+ this.#dispose = dispose;
+ }
+ if (typeof disposeAfter === 'function') {
+ this.#disposeAfter = disposeAfter;
+ this.#disposed = [];
+ }
+ else {
+ this.#disposeAfter = undefined;
+ this.#disposed = undefined;
+ }
+ this.#hasDispose = !!this.#dispose;
+ this.#hasDisposeAfter = !!this.#disposeAfter;
+ this.noDisposeOnSet = !!noDisposeOnSet;
+ this.noUpdateTTL = !!noUpdateTTL;
+ this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
+ this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
+ this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
+ this.ignoreFetchAbort = !!ignoreFetchAbort;
+ // NB: maxEntrySize is set to maxSize if it's set
+ if (this.maxEntrySize !== 0) {
+ if (this.#maxSize !== 0) {
+ if (!isPosInt(this.#maxSize)) {
+ throw new TypeError('maxSize must be a positive integer if specified');
+ }
+ }
+ if (!isPosInt(this.maxEntrySize)) {
+ throw new TypeError('maxEntrySize must be a positive integer if specified');
+ }
+ this.#initializeSizeTracking();
+ }
+ this.allowStale = !!allowStale;
+ this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
+ this.updateAgeOnGet = !!updateAgeOnGet;
+ this.updateAgeOnHas = !!updateAgeOnHas;
+ this.ttlResolution =
+ isPosInt(ttlResolution) || ttlResolution === 0
+ ? ttlResolution
+ : 1;
+ this.ttlAutopurge = !!ttlAutopurge;
+ this.ttl = ttl || 0;
+ if (this.ttl) {
+ if (!isPosInt(this.ttl)) {
+ throw new TypeError('ttl must be a positive integer if specified');
+ }
+ this.#initializeTTLTracking();
+ }
+ // do not allow completely unbounded caches
+ if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
+ throw new TypeError('At least one of max, maxSize, or ttl is required');
+ }
+ if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
+ const code = 'LRU_CACHE_UNBOUNDED';
+ if (shouldWarn(code)) {
+ warned.add(code);
+ const msg = 'TTL caching without ttlAutopurge, max, or maxSize can ' +
+ 'result in unbounded memory consumption.';
+ emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache);
+ }
+ }
+ }
+ /**
+ * Return the remaining TTL time for a given entry key
+ */
+ getRemainingTTL(key) {
+ return this.#keyMap.has(key) ? Infinity : 0;
+ }
+ #initializeTTLTracking() {
+ const ttls = new ZeroArray(this.#max);
+ const starts = new ZeroArray(this.#max);
+ this.#ttls = ttls;
+ this.#starts = starts;
+ this.#setItemTTL = (index, ttl, start = perf.now()) => {
+ starts[index] = ttl !== 0 ? start : 0;
+ ttls[index] = ttl;
+ if (ttl !== 0 && this.ttlAutopurge) {
+ const t = setTimeout(() => {
+ if (this.#isStale(index)) {
+ this.delete(this.#keyList[index]);
+ }
+ }, ttl + 1);
+ // unref() not supported on all platforms
+ /* c8 ignore start */
+ if (t.unref) {
+ t.unref();
+ }
+ /* c8 ignore stop */
+ }
+ };
+ this.#updateItemAge = index => {
+ starts[index] = ttls[index] !== 0 ? perf.now() : 0;
+ };
+ this.#statusTTL = (status, index) => {
+ if (ttls[index]) {
+ const ttl = ttls[index];
+ const start = starts[index];
+ status.ttl = ttl;
+ status.start = start;
+ status.now = cachedNow || getNow();
+ status.remainingTTL = status.now + ttl - start;
+ }
+ };
+ // debounce calls to perf.now() to 1s so we're not hitting
+ // that costly call repeatedly.
+ let cachedNow = 0;
+ const getNow = () => {
+ const n = perf.now();
+ if (this.ttlResolution > 0) {
+ cachedNow = n;
+ const t = setTimeout(() => (cachedNow = 0), this.ttlResolution);
+ // not available on all platforms
+ /* c8 ignore start */
+ if (t.unref) {
+ t.unref();
+ }
+ /* c8 ignore stop */
+ }
+ return n;
+ };
+ this.getRemainingTTL = key => {
+ const index = this.#keyMap.get(key);
+ if (index === undefined) {
+ return 0;
+ }
+ return ttls[index] === 0 || starts[index] === 0
+ ? Infinity
+ : starts[index] + ttls[index] - (cachedNow || getNow());
+ };
+ this.#isStale = index => {
+ return (ttls[index] !== 0 &&
+ starts[index] !== 0 &&
+ (cachedNow || getNow()) - starts[index] > ttls[index]);
+ };
+ }
+ // conditionally set private methods related to TTL
+ #updateItemAge = () => { };
+ #statusTTL = () => { };
+ #setItemTTL = () => { };
+ /* c8 ignore stop */
+ #isStale = () => false;
+ #initializeSizeTracking() {
+ const sizes = new ZeroArray(this.#max);
+ this.#calculatedSize = 0;
+ this.#sizes = sizes;
+ this.#removeItemSize = index => {
+ this.#calculatedSize -= sizes[index];
+ sizes[index] = 0;
+ };
+ this.#requireSize = (k, v, size, sizeCalculation) => {
+ // provisionally accept background fetches.
+ // actual value size will be checked when they return.
+ if (this.#isBackgroundFetch(v)) {
+ return 0;
+ }
+ if (!isPosInt(size)) {
+ if (sizeCalculation) {
+ if (typeof sizeCalculation !== 'function') {
+ throw new TypeError('sizeCalculation must be a function');
+ }
+ size = sizeCalculation(v, k);
+ if (!isPosInt(size)) {
+ throw new TypeError('sizeCalculation return invalid (expect positive integer)');
+ }
+ }
+ else {
+ throw new TypeError('invalid size value (must be positive integer). ' +
+ 'When maxSize or maxEntrySize is used, sizeCalculation ' +
+ 'or size must be set.');
+ }
+ }
+ return size;
+ };
+ this.#addItemSize = (index, size, status) => {
+ sizes[index] = size;
+ if (this.#maxSize) {
+ const maxSize = this.#maxSize - sizes[index];
+ while (this.#calculatedSize > maxSize) {
+ this.#evict(true);
+ }
+ }
+ this.#calculatedSize += sizes[index];
+ if (status) {
+ status.entrySize = size;
+ status.totalCalculatedSize = this.#calculatedSize;
+ }
+ };
+ }
+ #removeItemSize = _i => { };
+ #addItemSize = (_i, _s, _st) => { };
+ #requireSize = (_k, _v, size, sizeCalculation) => {
+ if (size || sizeCalculation) {
+ throw new TypeError('cannot set size without setting maxSize or maxEntrySize on cache');
+ }
+ return 0;
+ };
+ *#indexes({ allowStale = this.allowStale } = {}) {
+ if (this.#size) {
+ for (let i = this.#tail; true;) {
+ if (!this.#isValidIndex(i)) {
+ break;
+ }
+ if (allowStale || !this.#isStale(i)) {
+ yield i;
+ }
+ if (i === this.#head) {
+ break;
+ }
+ else {
+ i = this.#prev[i];
+ }
+ }
+ }
+ }
+ *#rindexes({ allowStale = this.allowStale } = {}) {
+ if (this.#size) {
+ for (let i = this.#head; true;) {
+ if (!this.#isValidIndex(i)) {
+ break;
+ }
+ if (allowStale || !this.#isStale(i)) {
+ yield i;
+ }
+ if (i === this.#tail) {
+ break;
+ }
+ else {
+ i = this.#next[i];
+ }
+ }
+ }
+ }
+ #isValidIndex(index) {
+ return (index !== undefined &&
+ this.#keyMap.get(this.#keyList[index]) === index);
+ }
+ /**
+ * Return a generator yielding `[key, value]` pairs,
+ * in order from most recently used to least recently used.
+ */
+ *entries() {
+ for (const i of this.#indexes()) {
+ if (this.#valList[i] !== undefined &&
+ this.#keyList[i] !== undefined &&
+ !this.#isBackgroundFetch(this.#valList[i])) {
+ yield [this.#keyList[i], this.#valList[i]];
+ }
+ }
+ }
+ /**
+ * Inverse order version of {@link LRUCache.entries}
+ *
+ * Return a generator yielding `[key, value]` pairs,
+ * in order from least recently used to most recently used.
+ */
+ *rentries() {
+ for (const i of this.#rindexes()) {
+ if (this.#valList[i] !== undefined &&
+ this.#keyList[i] !== undefined &&
+ !this.#isBackgroundFetch(this.#valList[i])) {
+ yield [this.#keyList[i], this.#valList[i]];
+ }
+ }
+ }
+ /**
+ * Return a generator yielding the keys in the cache,
+ * in order from most recently used to least recently used.
+ */
+ *keys() {
+ for (const i of this.#indexes()) {
+ const k = this.#keyList[i];
+ if (k !== undefined &&
+ !this.#isBackgroundFetch(this.#valList[i])) {
+ yield k;
+ }
+ }
+ }
+ /**
+ * Inverse order version of {@link LRUCache.keys}
+ *
+ * Return a generator yielding the keys in the cache,
+ * in order from least recently used to most recently used.
+ */
+ *rkeys() {
+ for (const i of this.#rindexes()) {
+ const k = this.#keyList[i];
+ if (k !== undefined &&
+ !this.#isBackgroundFetch(this.#valList[i])) {
+ yield k;
+ }
+ }
+ }
+ /**
+ * Return a generator yielding the values in the cache,
+ * in order from most recently used to least recently used.
+ */
+ *values() {
+ for (const i of this.#indexes()) {
+ const v = this.#valList[i];
+ if (v !== undefined &&
+ !this.#isBackgroundFetch(this.#valList[i])) {
+ yield this.#valList[i];
+ }
+ }
+ }
+ /**
+ * Inverse order version of {@link LRUCache.values}
+ *
+ * Return a generator yielding the values in the cache,
+ * in order from least recently used to most recently used.
+ */
+ *rvalues() {
+ for (const i of this.#rindexes()) {
+ const v = this.#valList[i];
+ if (v !== undefined &&
+ !this.#isBackgroundFetch(this.#valList[i])) {
+ yield this.#valList[i];
+ }
+ }
+ }
+ /**
+ * Iterating over the cache itself yields the same results as
+ * {@link LRUCache.entries}
+ */
+ [Symbol.iterator]() {
+ return this.entries();
+ }
+ /**
+ * Find a value for which the supplied fn method returns a truthy value,
+ * similar to Array.find(). fn is called as fn(value, key, cache).
+ */
+ find(fn, getOptions = {}) {
+ for (const i of this.#indexes()) {
+ const v = this.#valList[i];
+ const value = this.#isBackgroundFetch(v)
+ ? v.__staleWhileFetching
+ : v;
+ if (value === undefined)
+ continue;
+ if (fn(value, this.#keyList[i], this)) {
+ return this.get(this.#keyList[i], getOptions);
+ }
+ }
+ }
+ /**
+ * Call the supplied function on each item in the cache, in order from
+ * most recently used to least recently used. fn is called as
+ * fn(value, key, cache). Does not update age or recenty of use.
+ * Does not iterate over stale values.
+ */
+ forEach(fn, thisp = this) {
+ for (const i of this.#indexes()) {
+ const v = this.#valList[i];
+ const value = this.#isBackgroundFetch(v)
+ ? v.__staleWhileFetching
+ : v;
+ if (value === undefined)
+ continue;
+ fn.call(thisp, value, this.#keyList[i], this);
+ }
+ }
+ /**
+ * The same as {@link LRUCache.forEach} but items are iterated over in
+ * reverse order. (ie, less recently used items are iterated over first.)
+ */
+ rforEach(fn, thisp = this) {
+ for (const i of this.#rindexes()) {
+ const v = this.#valList[i];
+ const value = this.#isBackgroundFetch(v)
+ ? v.__staleWhileFetching
+ : v;
+ if (value === undefined)
+ continue;
+ fn.call(thisp, value, this.#keyList[i], this);
+ }
+ }
+ /**
+ * Delete any stale entries. Returns true if anything was removed,
+ * false otherwise.
+ */
+ purgeStale() {
+ let deleted = false;
+ for (const i of this.#rindexes({ allowStale: true })) {
+ if (this.#isStale(i)) {
+ this.delete(this.#keyList[i]);
+ deleted = true;
+ }
+ }
+ return deleted;
+ }
+ /**
+ * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
+ * passed to cache.load()
+ */
+ dump() {
+ const arr = [];
+ for (const i of this.#indexes({ allowStale: true })) {
+ const key = this.#keyList[i];
+ const v = this.#valList[i];
+ const value = this.#isBackgroundFetch(v)
+ ? v.__staleWhileFetching
+ : v;
+ if (value === undefined || key === undefined)
+ continue;
+ const entry = { value };
+ if (this.#ttls && this.#starts) {
+ entry.ttl = this.#ttls[i];
+ // always dump the start relative to a portable timestamp
+ // it's ok for this to be a bit slow, it's a rare operation.
+ const age = perf.now() - this.#starts[i];
+ entry.start = Math.floor(Date.now() - age);
+ }
+ if (this.#sizes) {
+ entry.size = this.#sizes[i];
+ }
+ arr.unshift([key, entry]);
+ }
+ return arr;
+ }
+ /**
+ * Reset the cache and load in the items in entries in the order listed.
+ * Note that the shape of the resulting cache may be different if the
+ * same options are not used in both caches.
+ */
+ load(arr) {
+ this.clear();
+ for (const [key, entry] of arr) {
+ if (entry.start) {
+ // entry.start is a portable timestamp, but we may be using
+ // node's performance.now(), so calculate the offset, so that
+ // we get the intended remaining TTL, no matter how long it's
+ // been on ice.
+ //
+ // it's ok for this to be a bit slow, it's a rare operation.
+ const age = Date.now() - entry.start;
+ entry.start = perf.now() - age;
+ }
+ this.set(key, entry.value, entry);
+ }
+ }
+ /**
+ * Add a value to the cache.
+ */
+ set(k, v, setOptions = {}) {
+ const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status, } = setOptions;
+ let { noUpdateTTL = this.noUpdateTTL } = setOptions;
+ const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
+ // if the item doesn't fit, don't do anything
+ // NB: maxEntrySize set to maxSize by default
+ if (this.maxEntrySize && size > this.maxEntrySize) {
+ if (status) {
+ status.set = 'miss';
+ status.maxEntrySizeExceeded = true;
+ }
+ // have to delete, in case something is there already.
+ this.delete(k);
+ return this;
+ }
+ let index = this.#size === 0 ? undefined : this.#keyMap.get(k);
+ if (index === undefined) {
+ // addition
+ index = (this.#size === 0
+ ? this.#tail
+ : this.#free.length !== 0
+ ? this.#free.pop()
+ : this.#size === this.#max
+ ? this.#evict(false)
+ : this.#size);
+ this.#keyList[index] = k;
+ this.#valList[index] = v;
+ this.#keyMap.set(k, index);
+ this.#next[this.#tail] = index;
+ this.#prev[index] = this.#tail;
+ this.#tail = index;
+ this.#size++;
+ this.#addItemSize(index, size, status);
+ if (status)
+ status.set = 'add';
+ noUpdateTTL = false;
+ }
+ else {
+ // update
+ this.#moveToTail(index);
+ const oldVal = this.#valList[index];
+ if (v !== oldVal) {
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
+ oldVal.__abortController.abort(new Error('replaced'));
+ }
+ else if (!noDisposeOnSet) {
+ if (this.#hasDispose) {
+ this.#dispose?.(oldVal, k, 'set');
+ }
+ if (this.#hasDisposeAfter) {
+ this.#disposed?.push([oldVal, k, 'set']);
+ }
+ }
+ this.#removeItemSize(index);
+ this.#addItemSize(index, size, status);
+ this.#valList[index] = v;
+ if (status) {
+ status.set = 'replace';
+ const oldValue = oldVal && this.#isBackgroundFetch(oldVal)
+ ? oldVal.__staleWhileFetching
+ : oldVal;
+ if (oldValue !== undefined)
+ status.oldValue = oldValue;
+ }
+ }
+ else if (status) {
+ status.set = 'update';
+ }
+ }
+ if (ttl !== 0 && !this.#ttls) {
+ this.#initializeTTLTracking();
+ }
+ if (this.#ttls) {
+ if (!noUpdateTTL) {
+ this.#setItemTTL(index, ttl, start);
+ }
+ if (status)
+ this.#statusTTL(status, index);
+ }
+ if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
+ const dt = this.#disposed;
+ let task;
+ while ((task = dt?.shift())) {
+ this.#disposeAfter?.(...task);
+ }
+ }
+ return this;
+ }
+ /**
+ * Evict the least recently used item, returning its value or
+ * `undefined` if cache is empty.
+ */
+ pop() {
+ try {
+ while (this.#size) {
+ const val = this.#valList[this.#head];
+ this.#evict(true);
+ if (this.#isBackgroundFetch(val)) {
+ if (val.__staleWhileFetching) {
+ return val.__staleWhileFetching;
+ }
+ }
+ else if (val !== undefined) {
+ return val;
+ }
+ }
+ }
+ finally {
+ if (this.#hasDisposeAfter && this.#disposed) {
+ const dt = this.#disposed;
+ let task;
+ while ((task = dt?.shift())) {
+ this.#disposeAfter?.(...task);
+ }
+ }
+ }
+ }
+ #evict(free) {
+ const head = this.#head;
+ const k = this.#keyList[head];
+ const v = this.#valList[head];
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
+ v.__abortController.abort(new Error('evicted'));
+ }
+ else if (this.#hasDispose || this.#hasDisposeAfter) {
+ if (this.#hasDispose) {
+ this.#dispose?.(v, k, 'evict');
+ }
+ if (this.#hasDisposeAfter) {
+ this.#disposed?.push([v, k, 'evict']);
+ }
+ }
+ this.#removeItemSize(head);
+ // if we aren't about to use the index, then null these out
+ if (free) {
+ this.#keyList[head] = undefined;
+ this.#valList[head] = undefined;
+ this.#free.push(head);
+ }
+ if (this.#size === 1) {
+ this.#head = this.#tail = 0;
+ this.#free.length = 0;
+ }
+ else {
+ this.#head = this.#next[head];
+ }
+ this.#keyMap.delete(k);
+ this.#size--;
+ return head;
+ }
+ /**
+ * Check if a key is in the cache, without updating the recency of use.
+ * Will return false if the item is stale, even though it is technically
+ * in the cache.
+ *
+ * Will not update item age unless
+ * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
+ */
+ has(k, hasOptions = {}) {
+ const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
+ const index = this.#keyMap.get(k);
+ if (index !== undefined) {
+ const v = this.#valList[index];
+ if (this.#isBackgroundFetch(v) &&
+ v.__staleWhileFetching === undefined) {
+ return false;
+ }
+ if (!this.#isStale(index)) {
+ if (updateAgeOnHas) {
+ this.#updateItemAge(index);
+ }
+ if (status) {
+ status.has = 'hit';
+ this.#statusTTL(status, index);
+ }
+ return true;
+ }
+ else if (status) {
+ status.has = 'stale';
+ this.#statusTTL(status, index);
+ }
+ }
+ else if (status) {
+ status.has = 'miss';
+ }
+ return false;
+ }
+ /**
+ * Like {@link LRUCache#get} but doesn't update recency or delete stale
+ * items.
+ *
+ * Returns `undefined` if the item is stale, unless
+ * {@link LRUCache.OptionsBase.allowStale} is set.
+ */
+ peek(k, peekOptions = {}) {
+ const { allowStale = this.allowStale } = peekOptions;
+ const index = this.#keyMap.get(k);
+ if (index !== undefined &&
+ (allowStale || !this.#isStale(index))) {
+ const v = this.#valList[index];
+ // either stale and allowed, or forcing a refresh of non-stale value
+ return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
+ }
+ }
+ #backgroundFetch(k, index, options, context) {
+ const v = index === undefined ? undefined : this.#valList[index];
+ if (this.#isBackgroundFetch(v)) {
+ return v;
+ }
+ const ac = new AbortController();
+ const { signal } = options;
+ // when/if our AC signals, then stop listening to theirs.
+ signal?.addEventListener('abort', () => ac.abort(signal.reason), {
+ signal: ac.signal,
+ });
+ const fetchOpts = {
+ signal: ac.signal,
+ options,
+ context,
+ };
+ const cb = (v, updateCache = false) => {
+ const { aborted } = ac.signal;
+ const ignoreAbort = options.ignoreFetchAbort && v !== undefined;
+ if (options.status) {
+ if (aborted && !updateCache) {
+ options.status.fetchAborted = true;
+ options.status.fetchError = ac.signal.reason;
+ if (ignoreAbort)
+ options.status.fetchAbortIgnored = true;
+ }
+ else {
+ options.status.fetchResolved = true;
+ }
+ }
+ if (aborted && !ignoreAbort && !updateCache) {
+ return fetchFail(ac.signal.reason);
+ }
+ // either we didn't abort, and are still here, or we did, and ignored
+ const bf = p;
+ if (this.#valList[index] === p) {
+ if (v === undefined) {
+ if (bf.__staleWhileFetching) {
+ this.#valList[index] = bf.__staleWhileFetching;
+ }
+ else {
+ this.delete(k);
+ }
+ }
+ else {
+ if (options.status)
+ options.status.fetchUpdated = true;
+ this.set(k, v, fetchOpts.options);
+ }
+ }
+ return v;
+ };
+ const eb = (er) => {
+ if (options.status) {
+ options.status.fetchRejected = true;
+ options.status.fetchError = er;
+ }
+ return fetchFail(er);
+ };
+ const fetchFail = (er) => {
+ const { aborted } = ac.signal;
+ const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
+ const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
+ const noDelete = allowStale || options.noDeleteOnFetchRejection;
+ const bf = p;
+ if (this.#valList[index] === p) {
+ // if we allow stale on fetch rejections, then we need to ensure that
+ // the stale value is not removed from the cache when the fetch fails.
+ const del = !noDelete || bf.__staleWhileFetching === undefined;
+ if (del) {
+ this.delete(k);
+ }
+ else if (!allowStaleAborted) {
+ // still replace the *promise* with the stale value,
+ // since we are done with the promise at this point.
+ // leave it untouched if we're still waiting for an
+ // aborted background fetch that hasn't yet returned.
+ this.#valList[index] = bf.__staleWhileFetching;
+ }
+ }
+ if (allowStale) {
+ if (options.status && bf.__staleWhileFetching !== undefined) {
+ options.status.returnedStale = true;
+ }
+ return bf.__staleWhileFetching;
+ }
+ else if (bf.__returned === bf) {
+ throw er;
+ }
+ };
+ const pcall = (res, rej) => {
+ const fmp = this.#fetchMethod?.(k, v, fetchOpts);
+ if (fmp && fmp instanceof Promise) {
+ fmp.then(v => res(v), rej);
+ }
+ // ignored, we go until we finish, regardless.
+ // defer check until we are actually aborting,
+ // so fetchMethod can override.
+ ac.signal.addEventListener('abort', () => {
+ if (!options.ignoreFetchAbort ||
+ options.allowStaleOnFetchAbort) {
+ res();
+ // when it eventually resolves, update the cache.
+ if (options.allowStaleOnFetchAbort) {
+ res = v => cb(v, true);
+ }
+ }
+ });
+ };
+ if (options.status)
+ options.status.fetchDispatched = true;
+ const p = new Promise(pcall).then(cb, eb);
+ const bf = Object.assign(p, {
+ __abortController: ac,
+ __staleWhileFetching: v,
+ __returned: undefined,
+ });
+ if (index === undefined) {
+ // internal, don't expose status.
+ this.set(k, bf, { ...fetchOpts.options, status: undefined });
+ index = this.#keyMap.get(k);
+ }
+ else {
+ this.#valList[index] = bf;
+ }
+ return bf;
+ }
+ #isBackgroundFetch(p) {
+ if (!this.#hasFetchMethod)
+ return false;
+ const b = p;
+ return (!!b &&
+ b instanceof Promise &&
+ b.hasOwnProperty('__staleWhileFetching') &&
+ b.__abortController instanceof AbortController);
+ }
+ async fetch(k, fetchOptions = {}) {
+ const {
+ // get options
+ allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet,
+ // set options
+ ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL,
+ // fetch exclusive options
+ noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, ignoreFetchAbort = this.ignoreFetchAbort, allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, context, forceRefresh = false, status, signal, } = fetchOptions;
+ if (!this.#hasFetchMethod) {
+ if (status)
+ status.fetch = 'get';
+ return this.get(k, {
+ allowStale,
+ updateAgeOnGet,
+ noDeleteOnStaleGet,
+ status,
+ });
+ }
+ const options = {
+ allowStale,
+ updateAgeOnGet,
+ noDeleteOnStaleGet,
+ ttl,
+ noDisposeOnSet,
+ size,
+ sizeCalculation,
+ noUpdateTTL,
+ noDeleteOnFetchRejection,
+ allowStaleOnFetchRejection,
+ allowStaleOnFetchAbort,
+ ignoreFetchAbort,
+ status,
+ signal,
+ };
+ let index = this.#keyMap.get(k);
+ if (index === undefined) {
+ if (status)
+ status.fetch = 'miss';
+ const p = this.#backgroundFetch(k, index, options, context);
+ return (p.__returned = p);
+ }
+ else {
+ // in cache, maybe already fetching
+ const v = this.#valList[index];
+ if (this.#isBackgroundFetch(v)) {
+ const stale = allowStale && v.__staleWhileFetching !== undefined;
+ if (status) {
+ status.fetch = 'inflight';
+ if (stale)
+ status.returnedStale = true;
+ }
+ return stale ? v.__staleWhileFetching : (v.__returned = v);
+ }
+ // if we force a refresh, that means do NOT serve the cached value,
+ // unless we are already in the process of refreshing the cache.
+ const isStale = this.#isStale(index);
+ if (!forceRefresh && !isStale) {
+ if (status)
+ status.fetch = 'hit';
+ this.#moveToTail(index);
+ if (updateAgeOnGet) {
+ this.#updateItemAge(index);
+ }
+ if (status)
+ this.#statusTTL(status, index);
+ return v;
+ }
+ // ok, it is stale or a forced refresh, and not already fetching.
+ // refresh the cache.
+ const p = this.#backgroundFetch(k, index, options, context);
+ const hasStale = p.__staleWhileFetching !== undefined;
+ const staleVal = hasStale && allowStale;
+ if (status) {
+ status.fetch = isStale ? 'stale' : 'refresh';
+ if (staleVal && isStale)
+ status.returnedStale = true;
+ }
+ return staleVal ? p.__staleWhileFetching : (p.__returned = p);
+ }
+ }
+ /**
+ * Return a value from the cache. Will update the recency of the cache
+ * entry found.
+ *
+ * If the key is not found, get() will return `undefined`.
+ */
+ get(k, getOptions = {}) {
+ const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status, } = getOptions;
+ const index = this.#keyMap.get(k);
+ if (index !== undefined) {
+ const value = this.#valList[index];
+ const fetching = this.#isBackgroundFetch(value);
+ if (status)
+ this.#statusTTL(status, index);
+ if (this.#isStale(index)) {
+ if (status)
+ status.get = 'stale';
+ // delete only if not an in-flight background fetch
+ if (!fetching) {
+ if (!noDeleteOnStaleGet) {
+ this.delete(k);
+ }
+ if (status && allowStale)
+ status.returnedStale = true;
+ return allowStale ? value : undefined;
+ }
+ else {
+ if (status &&
+ allowStale &&
+ value.__staleWhileFetching !== undefined) {
+ status.returnedStale = true;
+ }
+ return allowStale ? value.__staleWhileFetching : undefined;
+ }
+ }
+ else {
+ if (status)
+ status.get = 'hit';
+ // if we're currently fetching it, we don't actually have it yet
+ // it's not stale, which means this isn't a staleWhileRefetching.
+ // If it's not stale, and fetching, AND has a __staleWhileFetching
+ // value, then that means the user fetched with {forceRefresh:true},
+ // so it's safe to return that value.
+ if (fetching) {
+ return value.__staleWhileFetching;
+ }
+ this.#moveToTail(index);
+ if (updateAgeOnGet) {
+ this.#updateItemAge(index);
+ }
+ return value;
+ }
+ }
+ else if (status) {
+ status.get = 'miss';
+ }
+ }
+ #connect(p, n) {
+ this.#prev[n] = p;
+ this.#next[p] = n;
+ }
+ #moveToTail(index) {
+ // if tail already, nothing to do
+ // if head, move head to next[index]
+ // else
+ // move next[prev[index]] to next[index] (head has no prev)
+ // move prev[next[index]] to prev[index]
+ // prev[index] = tail
+ // next[tail] = index
+ // tail = index
+ if (index !== this.#tail) {
+ if (index === this.#head) {
+ this.#head = this.#next[index];
+ }
+ else {
+ this.#connect(this.#prev[index], this.#next[index]);
+ }
+ this.#connect(this.#tail, index);
+ this.#tail = index;
+ }
+ }
+ /**
+ * Deletes a key out of the cache.
+ * Returns true if the key was deleted, false otherwise.
+ */
+ delete(k) {
+ let deleted = false;
+ if (this.#size !== 0) {
+ const index = this.#keyMap.get(k);
+ if (index !== undefined) {
+ deleted = true;
+ if (this.#size === 1) {
+ this.clear();
+ }
+ else {
+ this.#removeItemSize(index);
+ const v = this.#valList[index];
+ if (this.#isBackgroundFetch(v)) {
+ v.__abortController.abort(new Error('deleted'));
+ }
+ else if (this.#hasDispose || this.#hasDisposeAfter) {
+ if (this.#hasDispose) {
+ this.#dispose?.(v, k, 'delete');
+ }
+ if (this.#hasDisposeAfter) {
+ this.#disposed?.push([v, k, 'delete']);
+ }
+ }
+ this.#keyMap.delete(k);
+ this.#keyList[index] = undefined;
+ this.#valList[index] = undefined;
+ if (index === this.#tail) {
+ this.#tail = this.#prev[index];
+ }
+ else if (index === this.#head) {
+ this.#head = this.#next[index];
+ }
+ else {
+ this.#next[this.#prev[index]] = this.#next[index];
+ this.#prev[this.#next[index]] = this.#prev[index];
+ }
+ this.#size--;
+ this.#free.push(index);
+ }
+ }
+ }
+ if (this.#hasDisposeAfter && this.#disposed?.length) {
+ const dt = this.#disposed;
+ let task;
+ while ((task = dt?.shift())) {
+ this.#disposeAfter?.(...task);
+ }
+ }
+ return deleted;
+ }
+ /**
+ * Clear the cache entirely, throwing away all values.
+ */
+ clear() {
+ for (const index of this.#rindexes({ allowStale: true })) {
+ const v = this.#valList[index];
+ if (this.#isBackgroundFetch(v)) {
+ v.__abortController.abort(new Error('deleted'));
+ }
+ else {
+ const k = this.#keyList[index];
+ if (this.#hasDispose) {
+ this.#dispose?.(v, k, 'delete');
+ }
+ if (this.#hasDisposeAfter) {
+ this.#disposed?.push([v, k, 'delete']);
+ }
+ }
+ }
+ this.#keyMap.clear();
+ this.#valList.fill(undefined);
+ this.#keyList.fill(undefined);
+ if (this.#ttls && this.#starts) {
+ this.#ttls.fill(0);
+ this.#starts.fill(0);
+ }
+ if (this.#sizes) {
+ this.#sizes.fill(0);
+ }
+ this.#head = 0;
+ this.#tail = 0;
+ this.#free.length = 0;
+ this.#calculatedSize = 0;
+ this.#size = 0;
+ if (this.#hasDisposeAfter && this.#disposed) {
+ const dt = this.#disposed;
+ let task;
+ while ((task = dt?.shift())) {
+ this.#disposeAfter?.(...task);
+ }
+ }
+ }
+}
+exports.LRUCache = LRUCache;
+exports.default = LRUCache;
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/lru-cache/dist/cjs/index.js.map b/node_modules/lru-cache/dist/cjs/index.js.map
new file mode 100644
index 0000000..eb4e477
--- /dev/null
+++ b/node_modules/lru-cache/dist/cjs/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH,MAAM,IAAI,GACR,OAAO,WAAW,KAAK,QAAQ;IAC/B,WAAW;IACX,OAAO,WAAW,CAAC,GAAG,KAAK,UAAU;IACnC,CAAC,CAAC,WAAW;IACb,CAAC,CAAC,IAAI,CAAA;AAEV,MAAM,MAAM,GAAG,IAAI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MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;SACpB;QACD,IAAI,CAAC,KAAK,GAAG,CAAU,CAAA;QACvB,IAAI,CAAC,KAAK,GAAG,CAAU,CAAA;QACvB,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;QACrB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAA;QACxB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;QACd,IAAI,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,SAAS,EAAE;YAC3C,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAA;YACzB,IAAI,IAAmC,CAAA;YACvC,OAAO,CAAC,IAAI,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE;gBAC3B,IAAI,CAAC,aAAa,EAAE,CAAC,GAAG,IAAI,CAAC,CAAA;aAC9B;SACF;IACH,CAAC;CACF;AAj9CD,4BAi9CC;AAED,kBAAe,QAAQ,CAAA","sourcesContent":["/**\n * @module LRUCache\n */\n\n// module-private names and types\ntype Perf = { now: () => number }\nconst perf: Perf =\n typeof performance === 'object' &&\n performance &&\n typeof performance.now === 'function'\n ? performance\n : Date\n\nconst warned = new Set()\n\n// either a function or a class\ntype ForC = ((...a: any[]) => any) | { new (...a: any[]): any }\n\nconst emitWarning = (\n msg: string,\n type: string,\n code: string,\n fn: ForC\n) => {\n typeof process === 'object' &&\n process &&\n typeof process.emitWarning === 'function'\n ? process.emitWarning(msg, type, code, fn)\n : console.error(`[${code}] ${type}: ${msg}`)\n}\n\nconst shouldWarn = (code: string) => !warned.has(code)\n\nconst TYPE = Symbol('type')\ntype PosInt = number & { [TYPE]: 'Positive Integer' }\ntype Index = number & { [TYPE]: 'LRUCache Index' }\n\nconst isPosInt = (n: any): n is PosInt =>\n n && n === Math.floor(n) && n > 0 && isFinite(n)\n\ntype UintArray = Uint8Array | Uint16Array | Uint32Array\ntype NumberArray = UintArray | number[]\n\n/* c8 ignore start */\n// This is a little bit ridiculous, tbh.\n// The maximum array length is 2^32-1 or thereabouts on most JS impls.\n// And well before that point, you're caching the entire world, I mean,\n// that's ~32GB of just integers for the next/prev links, plus whatever\n// else to hold that many keys and values. Just filling the memory with\n// zeroes at init time is brutal when you get that big.\n// But why not be complete?\n// Maybe in the future, these limits will have expanded.\nconst getUintArray = (max: number) =>\n !isPosInt(max)\n ? null\n : max <= Math.pow(2, 8)\n ? Uint8Array\n : max <= Math.pow(2, 16)\n ? Uint16Array\n : max <= Math.pow(2, 32)\n ? Uint32Array\n : max <= Number.MAX_SAFE_INTEGER\n ? ZeroArray\n : null\n/* c8 ignore stop */\n\nclass ZeroArray extends Array {\n constructor(size: number) {\n super(size)\n this.fill(0)\n }\n}\n\ntype StackLike = Stack | Index[]\nclass Stack {\n heap: NumberArray\n length: number\n // private constructor\n static #constructing: boolean = false\n static create(max: number): StackLike {\n const HeapCls = getUintArray(max)\n if (!HeapCls) return []\n Stack.#constructing = true\n const s = new Stack(max, HeapCls)\n Stack.#constructing = false\n return s\n }\n constructor(\n max: number,\n HeapCls: { new (n: number): NumberArray }\n ) {\n /* c8 ignore start */\n if (!Stack.#constructing) {\n throw new TypeError('instantiate Stack using Stack.create(n)')\n }\n /* c8 ignore stop */\n this.heap = new HeapCls(max)\n this.length = 0\n }\n push(n: Index) {\n this.heap[this.length++] = n\n }\n pop(): Index {\n return this.heap[--this.length] as Index\n }\n}\n\n/**\n * Promise representing an in-progress {@link LRUCache#fetch} call\n */\nexport type BackgroundFetch = Promise & {\n __returned: BackgroundFetch | undefined\n __abortController: AbortController\n __staleWhileFetching: V | undefined\n}\n\ntype DisposeTask = [\n value: V,\n key: K,\n reason: LRUCache.DisposeReason\n]\n\nexport namespace LRUCache {\n /**\n * An integer greater than 0, reflecting the calculated size of items\n */\n export type Size = number\n\n /**\n * Integer greater than 0, representing some number of milliseconds, or the\n * time at which a TTL started counting from.\n */\n export type Milliseconds = number\n\n /**\n * An integer greater than 0, reflecting a number of items\n */\n export type Count = number\n\n /**\n * The reason why an item was removed from the cache, passed\n * to the {@link Disposer} methods.\n */\n export type DisposeReason = 'evict' | 'set' | 'delete'\n /**\n * A method called upon item removal, passed as the\n * {@link OptionsBase.dispose} and/or\n * {@link OptionsBase.disposeAfter} options.\n */\n export type Disposer = (\n value: V,\n key: K,\n reason: DisposeReason\n ) => void\n\n /**\n * A function that returns the effective calculated size\n * of an entry in the cache.\n */\n export type SizeCalculator = (value: V, key: K) => Size\n\n /**\n * Options provided to the\n * {@link OptionsBase.fetchMethod} function.\n */\n export interface FetcherOptions {\n signal: AbortSignal\n options: FetcherFetchOptions\n /**\n * Object provided in the {@link FetchOptions.context} option to\n * {@link LRUCache#fetch}\n */\n context: FC\n }\n\n /**\n * Status object that may be passed to {@link LRUCache#fetch},\n * {@link LRUCache#get}, {@link LRUCache#set}, and {@link LRUCache#has}.\n */\n export interface Status {\n /**\n * The status of a set() operation.\n *\n * - add: the item was not found in the cache, and was added\n * - update: the item was in the cache, with the same value provided\n * - replace: the item was in the cache, and replaced\n * - miss: the item was not added to the cache for some reason\n */\n set?: 'add' | 'update' | 'replace' | 'miss'\n\n /**\n * the ttl stored for the item, or undefined if ttls are not used.\n */\n ttl?: Milliseconds\n\n /**\n * the start time for the item, or undefined if ttls are not used.\n */\n start?: Milliseconds\n\n /**\n * The timestamp used for TTL calculation\n */\n now?: Milliseconds\n\n /**\n * the remaining ttl for the item, or undefined if ttls are not used.\n */\n remainingTTL?: Milliseconds\n\n /**\n * The calculated size for the item, if sizes are used.\n */\n entrySize?: Size\n\n /**\n * The total calculated size of the cache, if sizes are used.\n */\n totalCalculatedSize?: Size\n\n /**\n * A flag indicating that the item was not stored, due to exceeding the\n * {@link OptionsBase.maxEntrySize}\n */\n maxEntrySizeExceeded?: true\n\n /**\n * The old value, specified in the case of `set:'update'` or\n * `set:'replace'`\n */\n oldValue?: V\n\n /**\n * The results of a {@link LRUCache#has} operation\n *\n * - hit: the item was found in the cache\n * - stale: the item was found in the cache, but is stale\n * - miss: the item was not found in the cache\n */\n has?: 'hit' | 'stale' | 'miss'\n\n /**\n * The status of a {@link LRUCache#fetch} operation.\n * Note that this can change as the underlying fetch() moves through\n * various states.\n *\n * - inflight: there is another fetch() for this key which is in process\n * - get: there is no fetchMethod, so {@link LRUCache#get} was called.\n * - miss: the item is not in cache, and will be fetched.\n * - hit: the item is in the cache, and was resolved immediately.\n * - stale: the item is in the cache, but stale.\n * - refresh: the item is in the cache, and not stale, but\n * {@link FetchOptions.forceRefresh} was specified.\n */\n fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh'\n\n /**\n * The {@link OptionsBase.fetchMethod} was called\n */\n fetchDispatched?: true\n\n /**\n * The cached value was updated after a successful call to\n * {@link OptionsBase.fetchMethod}\n */\n fetchUpdated?: true\n\n /**\n * The reason for a fetch() rejection. Either the error raised by the\n * {@link OptionsBase.fetchMethod}, or the reason for an\n * AbortSignal.\n */\n fetchError?: Error\n\n /**\n * The fetch received an abort signal\n */\n fetchAborted?: true\n\n /**\n * The abort signal received was ignored, and the fetch was allowed to\n * continue.\n */\n fetchAbortIgnored?: true\n\n /**\n * The fetchMethod promise resolved successfully\n */\n fetchResolved?: true\n\n /**\n * The fetchMethod promise was rejected\n */\n fetchRejected?: true\n\n /**\n * The status of a {@link LRUCache#get} operation.\n *\n * - fetching: The item is currently being fetched. If a previous value\n * is present and allowed, that will be returned.\n * - stale: The item is in the cache, and is stale.\n * - hit: the item is in the cache\n * - miss: the item is not in the cache\n */\n get?: 'stale' | 'hit' | 'miss'\n\n /**\n * A fetch or get operation returned a stale value.\n */\n returnedStale?: true\n }\n\n /**\n * options which override the options set in the LRUCache constructor\n * when calling {@link LRUCache#fetch}.\n *\n * This is the union of {@link GetOptions} and {@link SetOptions}, plus\n * {@link OptionsBase.noDeleteOnFetchRejection},\n * {@link OptionsBase.allowStaleOnFetchRejection},\n * {@link FetchOptions.forceRefresh}, and\n * {@link OptionsBase.context}\n *\n * Any of these may be modified in the {@link OptionsBase.fetchMethod}\n * function, but the {@link GetOptions} fields will of course have no\n * effect, as the {@link LRUCache#get} call already happened by the time\n * the fetchMethod is called.\n */\n export interface FetcherFetchOptions\n extends Pick<\n OptionsBase,\n | 'allowStale'\n | 'updateAgeOnGet'\n | 'noDeleteOnStaleGet'\n | 'sizeCalculation'\n | 'ttl'\n | 'noDisposeOnSet'\n | 'noUpdateTTL'\n | 'noDeleteOnFetchRejection'\n | 'allowStaleOnFetchRejection'\n | 'ignoreFetchAbort'\n | 'allowStaleOnFetchAbort'\n > {\n status?: Status\n size?: Size\n }\n\n /**\n * Options that may be passed to the {@link LRUCache#fetch} method.\n */\n export interface FetchOptions\n extends FetcherFetchOptions {\n /**\n * Set to true to force a re-load of the existing data, even if it\n * is not yet stale.\n */\n forceRefresh?: boolean\n /**\n * Context provided to the {@link OptionsBase.fetchMethod} as\n * the {@link FetcherOptions.context} param.\n *\n * If the FC type is specified as unknown (the default),\n * undefined or void, then this is optional. Otherwise, it will\n * be required.\n */\n context?: FC\n signal?: AbortSignal\n status?: Status\n }\n /**\n * Options provided to {@link LRUCache#fetch} when the FC type is something\n * other than `unknown`, `undefined`, or `void`\n */\n export interface FetchOptionsWithContext\n extends FetchOptions {\n context: FC\n }\n /**\n * Options provided to {@link LRUCache#fetch} when the FC type is\n * `undefined` or `void`\n */\n export interface FetchOptionsNoContext\n extends FetchOptions {\n context?: undefined\n }\n\n /**\n * Options that may be passed to the {@link LRUCache#has} method.\n */\n export interface HasOptions\n extends Pick, 'updateAgeOnHas'> {\n status?: Status\n }\n\n /**\n * Options that may be passed to the {@link LRUCache#get} method.\n */\n export interface GetOptions\n extends Pick<\n OptionsBase,\n 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet'\n > {\n status?: Status\n }\n\n /**\n * Options that may be passed to the {@link LRUCache#peek} method.\n */\n export interface PeekOptions\n extends Pick, 'allowStale'> {}\n\n /**\n * Options that may be passed to the {@link LRUCache#set} method.\n */\n export interface SetOptions\n extends Pick<\n OptionsBase,\n 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL'\n > {\n /**\n * If size tracking is enabled, then setting an explicit size\n * in the {@link LRUCache#set} call will prevent calling the\n * {@link OptionsBase.sizeCalculation} function.\n */\n size?: Size\n /**\n * If TTL tracking is enabled, then setting an explicit start\n * time in the {@link LRUCache#set} call will override the\n * default time from `performance.now()` or `Date.now()`.\n *\n * Note that it must be a valid value for whichever time-tracking\n * method is in use.\n */\n start?: Milliseconds\n status?: Status\n }\n\n /**\n * The type signature for the {@link OptionsBase.fetchMethod} option.\n */\n export type Fetcher = (\n key: K,\n staleValue: V | undefined,\n options: FetcherOptions\n ) => Promise | V | void | undefined\n\n /**\n * Options which may be passed to the {@link LRUCache} constructor.\n *\n * Most of these may be overridden in the various options that use\n * them.\n *\n * Despite all being technically optional, the constructor requires that\n * a cache is at minimum limited by one or more of {@link OptionsBase.max},\n * {@link OptionsBase.ttl}, or {@link OptionsBase.maxSize}.\n *\n * If {@link OptionsBase.ttl} is used alone, then it is strongly advised\n * (and in fact required by the type definitions here) that the cache\n * also set {@link OptionsBase.ttlAutopurge}, to prevent potentially\n * unbounded storage.\n */\n export interface OptionsBase {\n /**\n * The maximum number of items to store in the cache before evicting\n * old entries. This is read-only on the {@link LRUCache} instance,\n * and may not be overridden.\n *\n * If set, then storage space will be pre-allocated at construction\n * time, and the cache will perform significantly faster.\n *\n * Note that significantly fewer items may be stored, if\n * {@link OptionsBase.maxSize} and/or {@link OptionsBase.ttl} are also\n * set.\n */\n max?: Count\n\n /**\n * Max time in milliseconds for items to live in cache before they are\n * considered stale. Note that stale items are NOT preemptively removed\n * by default, and MAY live in the cache long after they have expired.\n *\n * Also, as this cache is optimized for LRU/MRU operations, some of\n * the staleness/TTL checks will reduce performance, as they will incur\n * overhead by deleting items.\n *\n * Must be an integer number of ms. If set to 0, this indicates \"no TTL\"\n *\n * @default 0\n */\n ttl?: Milliseconds\n\n /**\n * Minimum amount of time in ms in which to check for staleness.\n * Defaults to 1, which means that the current time is checked\n * at most once per millisecond.\n *\n * Set to 0 to check the current time every time staleness is tested.\n * (This reduces performance, and is theoretically unnecessary.)\n *\n * Setting this to a higher value will improve performance somewhat\n * while using ttl tracking, albeit at the expense of keeping stale\n * items around a bit longer than their TTLs would indicate.\n *\n * @default 1\n */\n ttlResolution?: Milliseconds\n\n /**\n * Preemptively remove stale items from the cache.\n * Note that this may significantly degrade performance,\n * especially if the cache is storing a large number of items.\n * It is almost always best to just leave the stale items in\n * the cache, and let them fall out as new items are added.\n *\n * Note that this means that {@link OptionsBase.allowStale} is a bit\n * pointless, as stale items will be deleted almost as soon as they\n * expire.\n *\n * @default false\n */\n ttlAutopurge?: boolean\n\n /**\n * Update the age of items on {@link LRUCache#get}, renewing their TTL\n *\n * Has no effect if {@link OptionsBase.ttl} is not set.\n *\n * @default false\n */\n updateAgeOnGet?: boolean\n\n /**\n * Update the age of items on {@link LRUCache#has}, renewing their TTL\n *\n * Has no effect if {@link OptionsBase.ttl} is not set.\n *\n * @default false\n */\n updateAgeOnHas?: boolean\n\n /**\n * Allow {@link LRUCache#get} and {@link LRUCache#fetch} calls to return\n * stale data, if available.\n */\n allowStale?: boolean\n\n /**\n * Function that is called on items when they are dropped from the cache.\n * This can be handy if you want to close file descriptors or do other\n * cleanup tasks when items are no longer accessible. Called with `key,\n * value`. It's called before actually removing the item from the\n * internal cache, so it is *NOT* safe to re-add them.\n *\n * Use {@link OptionsBase.disposeAfter} if you wish to dispose items after\n * they have been full removed, when it is safe to add them back to the\n * cache.\n */\n dispose?: Disposer\n\n /**\n * The same as {@link OptionsBase.dispose}, but called *after* the entry\n * is completely removed and the cache is once again in a clean state.\n * It is safe to add an item right back into the cache at this point.\n * However, note that it is *very* easy to inadvertently create infinite\n * recursion this way.\n */\n disposeAfter?: Disposer\n\n /**\n * Set to true to suppress calling the\n * {@link OptionsBase.dispose} function if the entry key is\n * still accessible within the cache.\n * This may be overridden by passing an options object to\n * {@link LRUCache#set}.\n */\n noDisposeOnSet?: boolean\n\n /**\n * Boolean flag to tell the cache to not update the TTL when\n * setting a new value for an existing key (ie, when updating a value\n * rather than inserting a new value). Note that the TTL value is\n * _always_ set (if provided) when adding a new entry into the cache.\n *\n * Has no effect if a {@link OptionsBase.ttl} is not set.\n */\n noUpdateTTL?: boolean\n\n /**\n * If you wish to track item size, you must provide a maxSize\n * note that we still will only keep up to max *actual items*,\n * if max is set, so size tracking may cause fewer than max items\n * to be stored. At the extreme, a single item of maxSize size\n * will cause everything else in the cache to be dropped when it\n * is added. Use with caution!\n *\n * Note also that size tracking can negatively impact performance,\n * though for most cases, only minimally.\n */\n maxSize?: Size\n\n /**\n * The maximum allowed size for any single item in the cache.\n *\n * If a larger item is passed to {@link LRUCache#set} or returned by a\n * {@link OptionsBase.fetchMethod}, then it will not be stored in the\n * cache.\n */\n maxEntrySize?: Size\n\n /**\n * A function that returns a number indicating the item's size.\n *\n * If not provided, and {@link OptionsBase.maxSize} or\n * {@link OptionsBase.maxEntrySize} are set, then all\n * {@link LRUCache#set} calls **must** provide an explicit\n * {@link SetOptions.size} or sizeCalculation param.\n */\n sizeCalculation?: SizeCalculator\n\n /**\n * Method that provides the implementation for {@link LRUCache#fetch}\n */\n fetchMethod?: Fetcher\n\n /**\n * Set to true to suppress the deletion of stale data when a\n * {@link OptionsBase.fetchMethod} returns a rejected promise.\n */\n noDeleteOnFetchRejection?: boolean\n\n /**\n * Do not delete stale items when they are retrieved with\n * {@link LRUCache#get}.\n *\n * Note that the `get` return value will still be `undefined`\n * unless {@link OptionsBase.allowStale} is true.\n */\n noDeleteOnStaleGet?: boolean\n\n /**\n * Set to true to allow returning stale data when a\n * {@link OptionsBase.fetchMethod} throws an error or returns a rejected\n * promise.\n *\n * This differs from using {@link OptionsBase.allowStale} in that stale\n * data will ONLY be returned in the case that the\n * {@link LRUCache#fetch} fails, not any other times.\n */\n allowStaleOnFetchRejection?: boolean\n\n /**\n * Set to true to return a stale value from the cache when the\n * `AbortSignal` passed to the {@link OptionsBase.fetchMethod} dispatches an `'abort'`\n * event, whether user-triggered, or due to internal cache behavior.\n *\n * Unless {@link OptionsBase.ignoreFetchAbort} is also set, the underlying\n * {@link OptionsBase.fetchMethod} will still be considered canceled, and its return\n * value will be ignored and not cached.\n */\n allowStaleOnFetchAbort?: boolean\n\n /**\n * Set to true to ignore the `abort` event emitted by the `AbortSignal`\n * object passed to {@link OptionsBase.fetchMethod}, and still cache the\n * resulting resolution value, as long as it is not `undefined`.\n *\n * When used on its own, this means aborted {@link LRUCache#fetch} calls are not\n * immediately resolved or rejected when they are aborted, and instead\n * take the full time to await.\n *\n * When used with {@link OptionsBase.allowStaleOnFetchAbort}, aborted\n * {@link LRUCache#fetch} calls will resolve immediately to their stale\n * cached value or `undefined`, and will continue to process and eventually\n * update the cache when they resolve, as long as the resulting value is\n * not `undefined`, thus supporting a \"return stale on timeout while\n * refreshing\" mechanism by passing `AbortSignal.timeout(n)` as the signal.\n *\n * **Note**: regardless of this setting, an `abort` event _is still\n * emitted on the `AbortSignal` object_, so may result in invalid results\n * when passed to other underlying APIs that use AbortSignals.\n *\n * This may be overridden in the {@link OptionsBase.fetchMethod} or the\n * call to {@link LRUCache#fetch}.\n */\n ignoreFetchAbort?: boolean\n }\n\n export interface OptionsMaxLimit\n extends OptionsBase {\n max: Count\n }\n export interface OptionsTTLLimit\n extends OptionsBase {\n ttl: Milliseconds\n ttlAutopurge: boolean\n }\n export interface OptionsSizeLimit\n extends OptionsBase {\n maxSize: Size\n }\n\n /**\n * The valid safe options for the {@link LRUCache} constructor\n */\n export type Options =\n | OptionsMaxLimit\n | OptionsSizeLimit\n | OptionsTTLLimit\n\n /**\n * Entry objects used by {@link LRUCache#load} and {@link LRUCache#dump}\n */\n export interface Entry {\n value: V\n ttl?: Milliseconds\n size?: Size\n start?: Milliseconds\n }\n}\n\n/**\n * Default export, the thing you're using this module to get.\n *\n * All properties from the options object (with the exception of\n * {@link OptionsBase.max} and {@link OptionsBase.maxSize}) are added as\n * normal public members. (`max` and `maxBase` are read-only getters.)\n * Changing any of these will alter the defaults for subsequent method calls,\n * but is otherwise safe.\n */\nexport class LRUCache {\n // properties coming in from the options of these, only max and maxSize\n // really *need* to be protected. The rest can be modified, as they just\n // set defaults for various methods.\n readonly #max: LRUCache.Count\n readonly #maxSize: LRUCache.Size\n readonly #dispose?: LRUCache.Disposer\n readonly #disposeAfter?: LRUCache.Disposer\n readonly #fetchMethod?: LRUCache.Fetcher\n\n /**\n * {@link LRUCache.OptionsBase.ttl}\n */\n ttl: LRUCache.Milliseconds\n\n /**\n * {@link LRUCache.OptionsBase.ttlResolution}\n */\n ttlResolution: LRUCache.Milliseconds\n /**\n * {@link LRUCache.OptionsBase.ttlAutopurge}\n */\n ttlAutopurge: boolean\n /**\n * {@link LRUCache.OptionsBase.updateAgeOnGet}\n */\n updateAgeOnGet: boolean\n /**\n * {@link LRUCache.OptionsBase.updateAgeOnHas}\n */\n updateAgeOnHas: boolean\n /**\n * {@link LRUCache.OptionsBase.allowStale}\n */\n allowStale: boolean\n\n /**\n * {@link LRUCache.OptionsBase.noDisposeOnSet}\n */\n noDisposeOnSet: boolean\n /**\n * {@link LRUCache.OptionsBase.noUpdateTTL}\n */\n noUpdateTTL: boolean\n /**\n * {@link LRUCache.OptionsBase.maxEntrySize}\n */\n maxEntrySize: LRUCache.Size\n /**\n * {@link LRUCache.OptionsBase.sizeCalculation}\n */\n sizeCalculation?: LRUCache.SizeCalculator\n /**\n * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}\n */\n noDeleteOnFetchRejection: boolean\n /**\n * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}\n */\n noDeleteOnStaleGet: boolean\n /**\n * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}\n */\n allowStaleOnFetchAbort: boolean\n /**\n * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}\n */\n allowStaleOnFetchRejection: boolean\n /**\n * {@link LRUCache.OptionsBase.ignoreFetchAbort}\n */\n ignoreFetchAbort: boolean\n\n // computed properties\n #size: LRUCache.Count\n #calculatedSize: LRUCache.Size\n #keyMap: Map\n #keyList: (K | undefined)[]\n #valList: (V | BackgroundFetch | undefined)[]\n #next: NumberArray\n #prev: NumberArray\n #head: Index\n #tail: Index\n #free: StackLike\n #disposed?: DisposeTask[]\n #sizes?: ZeroArray\n #starts?: ZeroArray\n #ttls?: ZeroArray\n\n #hasDispose: boolean\n #hasFetchMethod: boolean\n #hasDisposeAfter: boolean\n\n /**\n * Do not call this method unless you need to inspect the\n * inner workings of the cache. If anything returned by this\n * object is modified in any way, strange breakage may occur.\n *\n * These fields are private for a reason!\n *\n * @internal\n */\n static unsafeExposeInternals<\n K extends {},\n V extends {},\n FC extends unknown = unknown\n >(c: LRUCache) {\n return {\n // properties\n starts: c.#starts,\n ttls: c.#ttls,\n sizes: c.#sizes,\n keyMap: c.#keyMap as Map,\n keyList: c.#keyList,\n valList: c.#valList,\n next: c.#next,\n prev: c.#prev,\n get head() {\n return c.#head\n },\n get tail() {\n return c.#tail\n },\n free: c.#free,\n // methods\n isBackgroundFetch: (p: any) => c.#isBackgroundFetch(p),\n backgroundFetch: (\n k: K,\n index: number | undefined,\n options: LRUCache.FetchOptions,\n context: any\n ): BackgroundFetch =>\n c.#backgroundFetch(\n k,\n index as Index | undefined,\n options,\n context\n ),\n moveToTail: (index: number): void =>\n c.#moveToTail(index as Index),\n indexes: (options?: { allowStale: boolean }) =>\n c.#indexes(options),\n rindexes: (options?: { allowStale: boolean }) =>\n c.#rindexes(options),\n isStale: (index: number | undefined) =>\n c.#isStale(index as Index),\n }\n }\n\n // Protected read-only members\n\n /**\n * {@link LRUCache.OptionsBase.max} (read-only)\n */\n get max(): LRUCache.Count {\n return this.#max\n }\n /**\n * {@link LRUCache.OptionsBase.maxSize} (read-only)\n */\n get maxSize(): LRUCache.Count {\n return this.#maxSize\n }\n /**\n * The total computed size of items in the cache (read-only)\n */\n get calculatedSize(): LRUCache.Size {\n return this.#calculatedSize\n }\n /**\n * The number of items stored in the cache (read-only)\n */\n get size(): LRUCache.Count {\n return this.#size\n }\n /**\n * {@link LRUCache.OptionsBase.fetchMethod} (read-only)\n */\n get fetchMethod(): LRUCache.Fetcher | undefined {\n return this.#fetchMethod\n }\n /**\n * {@link LRUCache.OptionsBase.dispose} (read-only)\n */\n get dispose() {\n return this.#dispose\n }\n /**\n * {@link LRUCache.OptionsBase.disposeAfter} (read-only)\n */\n get disposeAfter() {\n return this.#disposeAfter\n }\n\n constructor(\n options: LRUCache.Options | LRUCache\n ) {\n const {\n max = 0,\n ttl,\n ttlResolution = 1,\n ttlAutopurge,\n updateAgeOnGet,\n updateAgeOnHas,\n allowStale,\n dispose,\n disposeAfter,\n noDisposeOnSet,\n noUpdateTTL,\n maxSize = 0,\n maxEntrySize = 0,\n sizeCalculation,\n fetchMethod,\n noDeleteOnFetchRejection,\n noDeleteOnStaleGet,\n allowStaleOnFetchRejection,\n allowStaleOnFetchAbort,\n ignoreFetchAbort,\n } = options\n\n if (max !== 0 && !isPosInt(max)) {\n throw new TypeError('max option must be a nonnegative integer')\n }\n\n const UintArray = max ? getUintArray(max) : Array\n if (!UintArray) {\n throw new Error('invalid max value: ' + max)\n }\n\n this.#max = max\n this.#maxSize = maxSize\n this.maxEntrySize = maxEntrySize || this.#maxSize\n this.sizeCalculation = sizeCalculation\n if (this.sizeCalculation) {\n if (!this.#maxSize && !this.maxEntrySize) {\n throw new TypeError(\n 'cannot set sizeCalculation without setting maxSize or maxEntrySize'\n )\n }\n if (typeof this.sizeCalculation !== 'function') {\n throw new TypeError('sizeCalculation set to non-function')\n }\n }\n\n if (\n fetchMethod !== undefined &&\n typeof fetchMethod !== 'function'\n ) {\n throw new TypeError(\n 'fetchMethod must be a function if specified'\n )\n }\n this.#fetchMethod = fetchMethod\n this.#hasFetchMethod = !!fetchMethod\n\n this.#keyMap = new Map()\n this.#keyList = new Array(max).fill(undefined)\n this.#valList = new Array(max).fill(undefined)\n this.#next = new UintArray(max)\n this.#prev = new UintArray(max)\n this.#head = 0 as Index\n this.#tail = 0 as Index\n this.#free = Stack.create(max)\n this.#size = 0\n this.#calculatedSize = 0\n\n if (typeof dispose === 'function') {\n this.#dispose = dispose\n }\n if (typeof disposeAfter === 'function') {\n this.#disposeAfter = disposeAfter\n this.#disposed = []\n } else {\n this.#disposeAfter = undefined\n this.#disposed = undefined\n }\n this.#hasDispose = !!this.#dispose\n this.#hasDisposeAfter = !!this.#disposeAfter\n\n this.noDisposeOnSet = !!noDisposeOnSet\n this.noUpdateTTL = !!noUpdateTTL\n this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection\n this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection\n this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort\n this.ignoreFetchAbort = !!ignoreFetchAbort\n\n // NB: maxEntrySize is set to maxSize if it's set\n if (this.maxEntrySize !== 0) {\n if (this.#maxSize !== 0) {\n if (!isPosInt(this.#maxSize)) {\n throw new TypeError(\n 'maxSize must be a positive integer if specified'\n )\n }\n }\n if (!isPosInt(this.maxEntrySize)) {\n throw new TypeError(\n 'maxEntrySize must be a positive integer if specified'\n )\n }\n this.#initializeSizeTracking()\n }\n\n this.allowStale = !!allowStale\n this.noDeleteOnStaleGet = !!noDeleteOnStaleGet\n this.updateAgeOnGet = !!updateAgeOnGet\n this.updateAgeOnHas = !!updateAgeOnHas\n this.ttlResolution =\n isPosInt(ttlResolution) || ttlResolution === 0\n ? ttlResolution\n : 1\n this.ttlAutopurge = !!ttlAutopurge\n this.ttl = ttl || 0\n if (this.ttl) {\n if (!isPosInt(this.ttl)) {\n throw new TypeError(\n 'ttl must be a positive integer if specified'\n )\n }\n this.#initializeTTLTracking()\n }\n\n // do not allow completely unbounded caches\n if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {\n throw new TypeError(\n 'At least one of max, maxSize, or ttl is required'\n )\n }\n if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {\n const code = 'LRU_CACHE_UNBOUNDED'\n if (shouldWarn(code)) {\n warned.add(code)\n const msg =\n 'TTL caching without ttlAutopurge, max, or maxSize can ' +\n 'result in unbounded memory consumption.'\n emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache)\n }\n }\n }\n\n /**\n * Return the remaining TTL time for a given entry key\n */\n getRemainingTTL(key: K) {\n return this.#keyMap.has(key) ? Infinity : 0\n }\n\n #initializeTTLTracking() {\n const ttls = new ZeroArray(this.#max)\n const starts = new ZeroArray(this.#max)\n this.#ttls = ttls\n this.#starts = starts\n\n this.#setItemTTL = (index, ttl, start = perf.now()) => {\n starts[index] = ttl !== 0 ? start : 0\n ttls[index] = ttl\n if (ttl !== 0 && this.ttlAutopurge) {\n const t = setTimeout(() => {\n if (this.#isStale(index)) {\n this.delete(this.#keyList[index] as K)\n }\n }, ttl + 1)\n // unref() not supported on all platforms\n /* c8 ignore start */\n if (t.unref) {\n t.unref()\n }\n /* c8 ignore stop */\n }\n }\n\n this.#updateItemAge = index => {\n starts[index] = ttls[index] !== 0 ? perf.now() : 0\n }\n\n this.#statusTTL = (status, index) => {\n if (ttls[index]) {\n const ttl = ttls[index]\n const start = starts[index]\n status.ttl = ttl\n status.start = start\n status.now = cachedNow || getNow()\n status.remainingTTL = status.now + ttl - start\n }\n }\n\n // debounce calls to perf.now() to 1s so we're not hitting\n // that costly call repeatedly.\n let cachedNow = 0\n const getNow = () => {\n const n = perf.now()\n if (this.ttlResolution > 0) {\n cachedNow = n\n const t = setTimeout(\n () => (cachedNow = 0),\n this.ttlResolution\n )\n // not available on all platforms\n /* c8 ignore start */\n if (t.unref) {\n t.unref()\n }\n /* c8 ignore stop */\n }\n return n\n }\n\n this.getRemainingTTL = key => {\n const index = this.#keyMap.get(key)\n if (index === undefined) {\n return 0\n }\n return ttls[index] === 0 || starts[index] === 0\n ? Infinity\n : starts[index] + ttls[index] - (cachedNow || getNow())\n }\n\n this.#isStale = index => {\n return (\n ttls[index] !== 0 &&\n starts[index] !== 0 &&\n (cachedNow || getNow()) - starts[index] > ttls[index]\n )\n }\n }\n\n // conditionally set private methods related to TTL\n #updateItemAge: (index: Index) => void = () => {}\n #statusTTL: (status: LRUCache.Status, index: Index) => void =\n () => {}\n #setItemTTL: (\n index: Index,\n ttl: LRUCache.Milliseconds,\n start?: LRUCache.Milliseconds\n // ignore because we never call this if we're not already in TTL mode\n /* c8 ignore start */\n ) => void = () => {}\n /* c8 ignore stop */\n\n #isStale: (index: Index) => boolean = () => false\n\n #initializeSizeTracking() {\n const sizes = new ZeroArray(this.#max)\n this.#calculatedSize = 0\n this.#sizes = sizes\n this.#removeItemSize = index => {\n this.#calculatedSize -= sizes[index]\n sizes[index] = 0\n }\n this.#requireSize = (k, v, size, sizeCalculation) => {\n // provisionally accept background fetches.\n // actual value size will be checked when they return.\n if (this.#isBackgroundFetch(v)) {\n return 0\n }\n if (!isPosInt(size)) {\n if (sizeCalculation) {\n if (typeof sizeCalculation !== 'function') {\n throw new TypeError('sizeCalculation must be a function')\n }\n size = sizeCalculation(v, k)\n if (!isPosInt(size)) {\n throw new TypeError(\n 'sizeCalculation return invalid (expect positive integer)'\n )\n }\n } else {\n throw new TypeError(\n 'invalid size value (must be positive integer). ' +\n 'When maxSize or maxEntrySize is used, sizeCalculation ' +\n 'or size must be set.'\n )\n }\n }\n return size\n }\n this.#addItemSize = (\n index: Index,\n size: LRUCache.Size,\n status?: LRUCache.Status\n ) => {\n sizes[index] = size\n if (this.#maxSize) {\n const maxSize = this.#maxSize - sizes[index]\n while (this.#calculatedSize > maxSize) {\n this.#evict(true)\n }\n }\n this.#calculatedSize += sizes[index]\n if (status) {\n status.entrySize = size\n status.totalCalculatedSize = this.#calculatedSize\n }\n }\n }\n\n #removeItemSize: (index: Index) => void = _i => {}\n #addItemSize: (\n index: Index,\n size: LRUCache.Size,\n status?: LRUCache.Status\n ) => void = (_i, _s, _st) => {}\n #requireSize: (\n k: K,\n v: V | BackgroundFetch,\n size?: LRUCache.Size,\n sizeCalculation?: LRUCache.SizeCalculator\n ) => LRUCache.Size = (\n _k: K,\n _v: V | BackgroundFetch,\n size?: LRUCache.Size,\n sizeCalculation?: LRUCache.SizeCalculator\n ) => {\n if (size || sizeCalculation) {\n throw new TypeError(\n 'cannot set size without setting maxSize or maxEntrySize on cache'\n )\n }\n return 0\n };\n\n *#indexes({ allowStale = this.allowStale } = {}) {\n if (this.#size) {\n for (let i = this.#tail; true; ) {\n if (!this.#isValidIndex(i)) {\n break\n }\n if (allowStale || !this.#isStale(i)) {\n yield i\n }\n if (i === this.#head) {\n break\n } else {\n i = this.#prev[i] as Index\n }\n }\n }\n }\n\n *#rindexes({ allowStale = this.allowStale } = {}) {\n if (this.#size) {\n for (let i = this.#head; true; ) {\n if (!this.#isValidIndex(i)) {\n break\n }\n if (allowStale || !this.#isStale(i)) {\n yield i\n }\n if (i === this.#tail) {\n break\n } else {\n i = this.#next[i] as Index\n }\n }\n }\n }\n\n #isValidIndex(index: Index) {\n return (\n index !== undefined &&\n this.#keyMap.get(this.#keyList[index] as K) === index\n )\n }\n\n /**\n * Return a generator yielding `[key, value]` pairs,\n * in order from most recently used to least recently used.\n */\n *entries() {\n for (const i of this.#indexes()) {\n if (\n this.#valList[i] !== undefined &&\n this.#keyList[i] !== undefined &&\n !this.#isBackgroundFetch(this.#valList[i])\n ) {\n yield [this.#keyList[i], this.#valList[i]]\n }\n }\n }\n\n /**\n * Inverse order version of {@link LRUCache.entries}\n *\n * Return a generator yielding `[key, value]` pairs,\n * in order from least recently used to most recently used.\n */\n *rentries() {\n for (const i of this.#rindexes()) {\n if (\n this.#valList[i] !== undefined &&\n this.#keyList[i] !== undefined &&\n !this.#isBackgroundFetch(this.#valList[i])\n ) {\n yield [this.#keyList[i], this.#valList[i]]\n }\n }\n }\n\n /**\n * Return a generator yielding the keys in the cache,\n * in order from most recently used to least recently used.\n */\n *keys() {\n for (const i of this.#indexes()) {\n const k = this.#keyList[i]\n if (\n k !== undefined &&\n !this.#isBackgroundFetch(this.#valList[i])\n ) {\n yield k\n }\n }\n }\n\n /**\n * Inverse order version of {@link LRUCache.keys}\n *\n * Return a generator yielding the keys in the cache,\n * in order from least recently used to most recently used.\n */\n *rkeys() {\n for (const i of this.#rindexes()) {\n const k = this.#keyList[i]\n if (\n k !== undefined &&\n !this.#isBackgroundFetch(this.#valList[i])\n ) {\n yield k\n }\n }\n }\n\n /**\n * Return a generator yielding the values in the cache,\n * in order from most recently used to least recently used.\n */\n *values() {\n for (const i of this.#indexes()) {\n const v = this.#valList[i]\n if (\n v !== undefined &&\n !this.#isBackgroundFetch(this.#valList[i])\n ) {\n yield this.#valList[i]\n }\n }\n }\n\n /**\n * Inverse order version of {@link LRUCache.values}\n *\n * Return a generator yielding the values in the cache,\n * in order from least recently used to most recently used.\n */\n *rvalues() {\n for (const i of this.#rindexes()) {\n const v = this.#valList[i]\n if (\n v !== undefined &&\n !this.#isBackgroundFetch(this.#valList[i])\n ) {\n yield this.#valList[i]\n }\n }\n }\n\n /**\n * Iterating over the cache itself yields the same results as\n * {@link LRUCache.entries}\n */\n [Symbol.iterator]() {\n return this.entries()\n }\n\n /**\n * Find a value for which the supplied fn method returns a truthy value,\n * similar to Array.find(). fn is called as fn(value, key, cache).\n */\n find(\n fn: (v: V, k: K, self: LRUCache) => boolean,\n getOptions: LRUCache.GetOptions = {}\n ) {\n for (const i of this.#indexes()) {\n const v = this.#valList[i]\n const value = this.#isBackgroundFetch(v)\n ? v.__staleWhileFetching\n : v\n if (value === undefined) continue\n if (fn(value, this.#keyList[i] as K, this)) {\n return this.get(this.#keyList[i] as K, getOptions)\n }\n }\n }\n\n /**\n * Call the supplied function on each item in the cache, in order from\n * most recently used to least recently used. fn is called as\n * fn(value, key, cache). Does not update age or recenty of use.\n * Does not iterate over stale values.\n */\n forEach(\n fn: (v: V, k: K, self: LRUCache) => any,\n thisp: any = this\n ) {\n for (const i of this.#indexes()) {\n const v = this.#valList[i]\n const value = this.#isBackgroundFetch(v)\n ? v.__staleWhileFetching\n : v\n if (value === undefined) continue\n fn.call(thisp, value, this.#keyList[i] as K, this)\n }\n }\n\n /**\n * The same as {@link LRUCache.forEach} but items are iterated over in\n * reverse order. (ie, less recently used items are iterated over first.)\n */\n rforEach(\n fn: (v: V, k: K, self: LRUCache) => any,\n thisp: any = this\n ) {\n for (const i of this.#rindexes()) {\n const v = this.#valList[i]\n const value = this.#isBackgroundFetch(v)\n ? v.__staleWhileFetching\n : v\n if (value === undefined) continue\n fn.call(thisp, value, this.#keyList[i] as K, this)\n }\n }\n\n /**\n * Delete any stale entries. Returns true if anything was removed,\n * false otherwise.\n */\n purgeStale() {\n let deleted = false\n for (const i of this.#rindexes({ allowStale: true })) {\n if (this.#isStale(i)) {\n this.delete(this.#keyList[i] as K)\n deleted = true\n }\n }\n return deleted\n }\n\n /**\n * Return an array of [key, {@link LRUCache.Entry}] tuples which can be\n * passed to cache.load()\n */\n dump() {\n const arr: [K, LRUCache.Entry][] = []\n for (const i of this.#indexes({ allowStale: true })) {\n const key = this.#keyList[i]\n const v = this.#valList[i]\n const value: V | undefined = this.#isBackgroundFetch(v)\n ? v.__staleWhileFetching\n : v\n if (value === undefined || key === undefined) continue\n const entry: LRUCache.Entry = { value }\n if (this.#ttls && this.#starts) {\n entry.ttl = this.#ttls[i]\n // always dump the start relative to a portable timestamp\n // it's ok for this to be a bit slow, it's a rare operation.\n const age = perf.now() - this.#starts[i]\n entry.start = Math.floor(Date.now() - age)\n }\n if (this.#sizes) {\n entry.size = this.#sizes[i]\n }\n arr.unshift([key, entry])\n }\n return arr\n }\n\n /**\n * Reset the cache and load in the items in entries in the order listed.\n * Note that the shape of the resulting cache may be different if the\n * same options are not used in both caches.\n */\n load(arr: [K, LRUCache.Entry][]) {\n this.clear()\n for (const [key, entry] of arr) {\n if (entry.start) {\n // entry.start is a portable timestamp, but we may be using\n // node's performance.now(), so calculate the offset, so that\n // we get the intended remaining TTL, no matter how long it's\n // been on ice.\n //\n // it's ok for this to be a bit slow, it's a rare operation.\n const age = Date.now() - entry.start\n entry.start = perf.now() - age\n }\n this.set(key, entry.value, entry)\n }\n }\n\n /**\n * Add a value to the cache.\n */\n set(\n k: K,\n v: V | BackgroundFetch,\n setOptions: LRUCache.SetOptions = {}\n ) {\n const {\n ttl = this.ttl,\n start,\n noDisposeOnSet = this.noDisposeOnSet,\n sizeCalculation = this.sizeCalculation,\n status,\n } = setOptions\n let { noUpdateTTL = this.noUpdateTTL } = setOptions\n\n const size = this.#requireSize(\n k,\n v,\n setOptions.size || 0,\n sizeCalculation\n )\n // if the item doesn't fit, don't do anything\n // NB: maxEntrySize set to maxSize by default\n if (this.maxEntrySize && size > this.maxEntrySize) {\n if (status) {\n status.set = 'miss'\n status.maxEntrySizeExceeded = true\n }\n // have to delete, in case something is there already.\n this.delete(k)\n return this\n }\n let index = this.#size === 0 ? undefined : this.#keyMap.get(k)\n if (index === undefined) {\n // addition\n index = (\n this.#size === 0\n ? this.#tail\n : this.#free.length !== 0\n ? this.#free.pop()\n : this.#size === this.#max\n ? this.#evict(false)\n : this.#size\n ) as Index\n this.#keyList[index] = k\n this.#valList[index] = v\n this.#keyMap.set(k, index)\n this.#next[this.#tail] = index\n this.#prev[index] = this.#tail\n this.#tail = index\n this.#size++\n this.#addItemSize(index, size, status)\n if (status) status.set = 'add'\n noUpdateTTL = false\n } else {\n // update\n this.#moveToTail(index)\n const oldVal = this.#valList[index] as V | BackgroundFetch\n if (v !== oldVal) {\n if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {\n oldVal.__abortController.abort(new Error('replaced'))\n } else if (!noDisposeOnSet) {\n if (this.#hasDispose) {\n this.#dispose?.(oldVal as V, k, 'set')\n }\n if (this.#hasDisposeAfter) {\n this.#disposed?.push([oldVal as V, k, 'set'])\n }\n }\n this.#removeItemSize(index)\n this.#addItemSize(index, size, status)\n this.#valList[index] = v\n if (status) {\n status.set = 'replace'\n const oldValue =\n oldVal && this.#isBackgroundFetch(oldVal)\n ? oldVal.__staleWhileFetching\n : oldVal\n if (oldValue !== undefined) status.oldValue = oldValue\n }\n } else if (status) {\n status.set = 'update'\n }\n }\n if (ttl !== 0 && !this.#ttls) {\n this.#initializeTTLTracking()\n }\n if (this.#ttls) {\n if (!noUpdateTTL) {\n this.#setItemTTL(index, ttl, start)\n }\n if (status) this.#statusTTL(status, index)\n }\n if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {\n const dt = this.#disposed\n let task: DisposeTask | undefined\n while ((task = dt?.shift())) {\n this.#disposeAfter?.(...task)\n }\n }\n return this\n }\n\n /**\n * Evict the least recently used item, returning its value or\n * `undefined` if cache is empty.\n */\n pop(): V | undefined {\n try {\n while (this.#size) {\n const val = this.#valList[this.#head]\n this.#evict(true)\n if (this.#isBackgroundFetch(val)) {\n if (val.__staleWhileFetching) {\n return val.__staleWhileFetching\n }\n } else if (val !== undefined) {\n return val\n }\n }\n } finally {\n if (this.#hasDisposeAfter && this.#disposed) {\n const dt = this.#disposed\n let task: DisposeTask | undefined\n while ((task = dt?.shift())) {\n this.#disposeAfter?.(...task)\n }\n }\n }\n }\n\n #evict(free: boolean) {\n const head = this.#head\n const k = this.#keyList[head] as K\n const v = this.#valList[head] as V\n if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {\n v.__abortController.abort(new Error('evicted'))\n } else if (this.#hasDispose || this.#hasDisposeAfter) {\n if (this.#hasDispose) {\n this.#dispose?.(v, k, 'evict')\n }\n if (this.#hasDisposeAfter) {\n this.#disposed?.push([v, k, 'evict'])\n }\n }\n this.#removeItemSize(head)\n // if we aren't about to use the index, then null these out\n if (free) {\n this.#keyList[head] = undefined\n this.#valList[head] = undefined\n this.#free.push(head)\n }\n if (this.#size === 1) {\n this.#head = this.#tail = 0 as Index\n this.#free.length = 0\n } else {\n this.#head = this.#next[head] as Index\n }\n this.#keyMap.delete(k)\n this.#size--\n return head\n }\n\n /**\n * Check if a key is in the cache, without updating the recency of use.\n * Will return false if the item is stale, even though it is technically\n * in the cache.\n *\n * Will not update item age unless\n * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.\n */\n has(k: K, hasOptions: LRUCache.HasOptions = {}) {\n const { updateAgeOnHas = this.updateAgeOnHas, status } =\n hasOptions\n const index = this.#keyMap.get(k)\n if (index !== undefined) {\n const v = this.#valList[index]\n if (\n this.#isBackgroundFetch(v) &&\n v.__staleWhileFetching === undefined\n ) {\n return false\n }\n if (!this.#isStale(index)) {\n if (updateAgeOnHas) {\n this.#updateItemAge(index)\n }\n if (status) {\n status.has = 'hit'\n this.#statusTTL(status, index)\n }\n return true\n } else if (status) {\n status.has = 'stale'\n this.#statusTTL(status, index)\n }\n } else if (status) {\n status.has = 'miss'\n }\n return false\n }\n\n /**\n * Like {@link LRUCache#get} but doesn't update recency or delete stale\n * items.\n *\n * Returns `undefined` if the item is stale, unless\n * {@link LRUCache.OptionsBase.allowStale} is set.\n */\n peek(k: K, peekOptions: LRUCache.PeekOptions = {}) {\n const { allowStale = this.allowStale } = peekOptions\n const index = this.#keyMap.get(k)\n if (\n index !== undefined &&\n (allowStale || !this.#isStale(index))\n ) {\n const v = this.#valList[index]\n // either stale and allowed, or forcing a refresh of non-stale value\n return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v\n }\n }\n\n #backgroundFetch(\n k: K,\n index: Index | undefined,\n options: LRUCache.FetchOptions,\n context: any\n ): BackgroundFetch {\n const v = index === undefined ? undefined : this.#valList[index]\n if (this.#isBackgroundFetch(v)) {\n return v\n }\n\n const ac = new AbortController()\n const { signal } = options\n // when/if our AC signals, then stop listening to theirs.\n signal?.addEventListener('abort', () => ac.abort(signal.reason), {\n signal: ac.signal,\n })\n\n const fetchOpts = {\n signal: ac.signal,\n options,\n context,\n }\n\n const cb = (\n v: V | void | undefined,\n updateCache = false\n ): V | undefined | void => {\n const { aborted } = ac.signal\n const ignoreAbort = options.ignoreFetchAbort && v !== undefined\n if (options.status) {\n if (aborted && !updateCache) {\n options.status.fetchAborted = true\n options.status.fetchError = ac.signal.reason\n if (ignoreAbort) options.status.fetchAbortIgnored = true\n } else {\n options.status.fetchResolved = true\n }\n }\n if (aborted && !ignoreAbort && !updateCache) {\n return fetchFail(ac.signal.reason)\n }\n // either we didn't abort, and are still here, or we did, and ignored\n const bf = p as BackgroundFetch\n if (this.#valList[index as Index] === p) {\n if (v === undefined) {\n if (bf.__staleWhileFetching) {\n this.#valList[index as Index] = bf.__staleWhileFetching\n } else {\n this.delete(k)\n }\n } else {\n if (options.status) options.status.fetchUpdated = true\n this.set(k, v, fetchOpts.options)\n }\n }\n return v\n }\n\n const eb = (er: any) => {\n if (options.status) {\n options.status.fetchRejected = true\n options.status.fetchError = er\n }\n return fetchFail(er)\n }\n\n const fetchFail = (er: any): V | undefined => {\n const { aborted } = ac.signal\n const allowStaleAborted =\n aborted && options.allowStaleOnFetchAbort\n const allowStale =\n allowStaleAborted || options.allowStaleOnFetchRejection\n const noDelete = allowStale || options.noDeleteOnFetchRejection\n const bf = p as BackgroundFetch\n if (this.#valList[index as Index] === p) {\n // if we allow stale on fetch rejections, then we need to ensure that\n // the stale value is not removed from the cache when the fetch fails.\n const del = !noDelete || bf.__staleWhileFetching === undefined\n if (del) {\n this.delete(k)\n } else if (!allowStaleAborted) {\n // still replace the *promise* with the stale value,\n // since we are done with the promise at this point.\n // leave it untouched if we're still waiting for an\n // aborted background fetch that hasn't yet returned.\n this.#valList[index as Index] = bf.__staleWhileFetching\n }\n }\n if (allowStale) {\n if (options.status && bf.__staleWhileFetching !== undefined) {\n options.status.returnedStale = true\n }\n return bf.__staleWhileFetching\n } else if (bf.__returned === bf) {\n throw er\n }\n }\n\n const pcall = (\n res: (v: V | void | undefined) => void,\n rej: (e: any) => void\n ) => {\n const fmp = this.#fetchMethod?.(k, v, fetchOpts)\n if (fmp && fmp instanceof Promise) {\n fmp.then(v => res(v), rej)\n }\n // ignored, we go until we finish, regardless.\n // defer check until we are actually aborting,\n // so fetchMethod can override.\n ac.signal.addEventListener('abort', () => {\n if (\n !options.ignoreFetchAbort ||\n options.allowStaleOnFetchAbort\n ) {\n res()\n // when it eventually resolves, update the cache.\n if (options.allowStaleOnFetchAbort) {\n res = v => cb(v, true)\n }\n }\n })\n }\n\n if (options.status) options.status.fetchDispatched = true\n const p = new Promise(pcall).then(cb, eb)\n const bf = Object.assign(p, {\n __abortController: ac,\n __staleWhileFetching: v,\n __returned: undefined,\n })\n\n if (index === undefined) {\n // internal, don't expose status.\n this.set(k, bf, { ...fetchOpts.options, status: undefined })\n index = this.#keyMap.get(k)\n } else {\n this.#valList[index] = bf\n }\n return bf\n }\n\n #isBackgroundFetch(p: any): p is BackgroundFetch {\n if (!this.#hasFetchMethod) return false\n const b = p as BackgroundFetch\n return (\n !!b &&\n b instanceof Promise &&\n b.hasOwnProperty('__staleWhileFetching') &&\n b.__abortController instanceof AbortController\n )\n }\n\n /**\n * Make an asynchronous cached fetch using the\n * {@link LRUCache.OptionsBase.fetchMethod} function.\n *\n * If multiple fetches for the same key are issued, then they will all be\n * coalesced into a single call to fetchMethod.\n *\n * Note that this means that handling options such as\n * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort},\n * {@link LRUCache.FetchOptions.signal},\n * and {@link LRUCache.OptionsBase.allowStaleOnFetchRejection} will be\n * determined by the FIRST fetch() call for a given key.\n *\n * This is a known (fixable) shortcoming which will be addresed on when\n * someone complains about it, as the fix would involve added complexity and\n * may not be worth the costs for this edge case.\n */\n fetch(\n k: K,\n fetchOptions: unknown extends FC\n ? LRUCache.FetchOptions\n : FC extends undefined | void\n ? LRUCache.FetchOptionsNoContext\n : LRUCache.FetchOptionsWithContext\n ): Promise\n // this overload not allowed if context is required\n fetch(\n k: unknown extends FC\n ? K\n : FC extends undefined | void\n ? K\n : never,\n fetchOptions?: unknown extends FC\n ? LRUCache.FetchOptions\n : FC extends undefined | void\n ? LRUCache.FetchOptionsNoContext\n : never\n ): Promise\n async fetch(\n k: K,\n fetchOptions: LRUCache.FetchOptions = {}\n ): Promise {\n const {\n // get options\n allowStale = this.allowStale,\n updateAgeOnGet = this.updateAgeOnGet,\n noDeleteOnStaleGet = this.noDeleteOnStaleGet,\n // set options\n ttl = this.ttl,\n noDisposeOnSet = this.noDisposeOnSet,\n size = 0,\n sizeCalculation = this.sizeCalculation,\n noUpdateTTL = this.noUpdateTTL,\n // fetch exclusive options\n noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,\n allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,\n ignoreFetchAbort = this.ignoreFetchAbort,\n allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,\n context,\n forceRefresh = false,\n status,\n signal,\n } = fetchOptions\n\n if (!this.#hasFetchMethod) {\n if (status) status.fetch = 'get'\n return this.get(k, {\n allowStale,\n updateAgeOnGet,\n noDeleteOnStaleGet,\n status,\n })\n }\n\n const options = {\n allowStale,\n updateAgeOnGet,\n noDeleteOnStaleGet,\n ttl,\n noDisposeOnSet,\n size,\n sizeCalculation,\n noUpdateTTL,\n noDeleteOnFetchRejection,\n allowStaleOnFetchRejection,\n allowStaleOnFetchAbort,\n ignoreFetchAbort,\n status,\n signal,\n }\n\n let index = this.#keyMap.get(k)\n if (index === undefined) {\n if (status) status.fetch = 'miss'\n const p = this.#backgroundFetch(k, index, options, context)\n return (p.__returned = p)\n } else {\n // in cache, maybe already fetching\n const v = this.#valList[index]\n if (this.#isBackgroundFetch(v)) {\n const stale =\n allowStale && v.__staleWhileFetching !== undefined\n if (status) {\n status.fetch = 'inflight'\n if (stale) status.returnedStale = true\n }\n return stale ? v.__staleWhileFetching : (v.__returned = v)\n }\n\n // if we force a refresh, that means do NOT serve the cached value,\n // unless we are already in the process of refreshing the cache.\n const isStale = this.#isStale(index)\n if (!forceRefresh && !isStale) {\n if (status) status.fetch = 'hit'\n this.#moveToTail(index)\n if (updateAgeOnGet) {\n this.#updateItemAge(index)\n }\n if (status) this.#statusTTL(status, index)\n return v\n }\n\n // ok, it is stale or a forced refresh, and not already fetching.\n // refresh the cache.\n const p = this.#backgroundFetch(k, index, options, context)\n const hasStale = p.__staleWhileFetching !== undefined\n const staleVal = hasStale && allowStale\n if (status) {\n status.fetch = isStale ? 'stale' : 'refresh'\n if (staleVal && isStale) status.returnedStale = true\n }\n return staleVal ? p.__staleWhileFetching : (p.__returned = p)\n }\n }\n\n /**\n * Return a value from the cache. Will update the recency of the cache\n * entry found.\n *\n * If the key is not found, get() will return `undefined`.\n */\n get(k: K, getOptions: LRUCache.GetOptions = {}) {\n const {\n allowStale = this.allowStale,\n updateAgeOnGet = this.updateAgeOnGet,\n noDeleteOnStaleGet = this.noDeleteOnStaleGet,\n status,\n } = getOptions\n const index = this.#keyMap.get(k)\n if (index !== undefined) {\n const value = this.#valList[index]\n const fetching = this.#isBackgroundFetch(value)\n if (status) this.#statusTTL(status, index)\n if (this.#isStale(index)) {\n if (status) status.get = 'stale'\n // delete only if not an in-flight background fetch\n if (!fetching) {\n if (!noDeleteOnStaleGet) {\n this.delete(k)\n }\n if (status && allowStale) status.returnedStale = true\n return allowStale ? value : undefined\n } else {\n if (\n status &&\n allowStale &&\n value.__staleWhileFetching !== undefined\n ) {\n status.returnedStale = true\n }\n return allowStale ? value.__staleWhileFetching : undefined\n }\n } else {\n if (status) status.get = 'hit'\n // if we're currently fetching it, we don't actually have it yet\n // it's not stale, which means this isn't a staleWhileRefetching.\n // If it's not stale, and fetching, AND has a __staleWhileFetching\n // value, then that means the user fetched with {forceRefresh:true},\n // so it's safe to return that value.\n if (fetching) {\n return value.__staleWhileFetching\n }\n this.#moveToTail(index)\n if (updateAgeOnGet) {\n this.#updateItemAge(index)\n }\n return value\n }\n } else if (status) {\n status.get = 'miss'\n }\n }\n\n #connect(p: Index, n: Index) {\n this.#prev[n] = p\n this.#next[p] = n\n }\n\n #moveToTail(index: Index): void {\n // if tail already, nothing to do\n // if head, move head to next[index]\n // else\n // move next[prev[index]] to next[index] (head has no prev)\n // move prev[next[index]] to prev[index]\n // prev[index] = tail\n // next[tail] = index\n // tail = index\n if (index !== this.#tail) {\n if (index === this.#head) {\n this.#head = this.#next[index] as Index\n } else {\n this.#connect(\n this.#prev[index] as Index,\n this.#next[index] as Index\n )\n }\n this.#connect(this.#tail, index)\n this.#tail = index\n }\n }\n\n /**\n * Deletes a key out of the cache.\n * Returns true if the key was deleted, false otherwise.\n */\n delete(k: K) {\n let deleted = false\n if (this.#size !== 0) {\n const index = this.#keyMap.get(k)\n if (index !== undefined) {\n deleted = true\n if (this.#size === 1) {\n this.clear()\n } else {\n this.#removeItemSize(index)\n const v = this.#valList[index]\n if (this.#isBackgroundFetch(v)) {\n v.__abortController.abort(new Error('deleted'))\n } else if (this.#hasDispose || this.#hasDisposeAfter) {\n if (this.#hasDispose) {\n this.#dispose?.(v as V, k, 'delete')\n }\n if (this.#hasDisposeAfter) {\n this.#disposed?.push([v as V, k, 'delete'])\n }\n }\n this.#keyMap.delete(k)\n this.#keyList[index] = undefined\n this.#valList[index] = undefined\n if (index === this.#tail) {\n this.#tail = this.#prev[index] as Index\n } else if (index === this.#head) {\n this.#head = this.#next[index] as Index\n } else {\n this.#next[this.#prev[index]] = this.#next[index]\n this.#prev[this.#next[index]] = this.#prev[index]\n }\n this.#size--\n this.#free.push(index)\n }\n }\n }\n if (this.#hasDisposeAfter && this.#disposed?.length) {\n const dt = this.#disposed\n let task: DisposeTask | undefined\n while ((task = dt?.shift())) {\n this.#disposeAfter?.(...task)\n }\n }\n return deleted\n }\n\n /**\n * Clear the cache entirely, throwing away all values.\n */\n clear() {\n for (const index of this.#rindexes({ allowStale: true })) {\n const v = this.#valList[index]\n if (this.#isBackgroundFetch(v)) {\n v.__abortController.abort(new Error('deleted'))\n } else {\n const k = this.#keyList[index]\n if (this.#hasDispose) {\n this.#dispose?.(v as V, k as K, 'delete')\n }\n if (this.#hasDisposeAfter) {\n this.#disposed?.push([v as V, k as K, 'delete'])\n }\n }\n }\n\n this.#keyMap.clear()\n this.#valList.fill(undefined)\n this.#keyList.fill(undefined)\n if (this.#ttls && this.#starts) {\n this.#ttls.fill(0)\n this.#starts.fill(0)\n }\n if (this.#sizes) {\n this.#sizes.fill(0)\n }\n this.#head = 0 as Index\n this.#tail = 0 as Index\n this.#free.length = 0\n this.#calculatedSize = 0\n this.#size = 0\n if (this.#hasDisposeAfter && this.#disposed) {\n const dt = this.#disposed\n let task: DisposeTask