From f733c7ef83747f114d2a543e7beba48097a84895 Mon Sep 17 00:00:00 2001 From: LiosK Date: Sat, 12 Oct 2024 14:58:49 +0900 Subject: [PATCH 1/2] feat: add CommonJS entry point to support older environments --- CHANGELOG.md | 6 + README.md | 6 + dist/index.cjs | 602 +++++++++++++++++++++++++++++++++++++++++++++++ dist/index.d.cts | 300 +++++++++++++++++++++++ package.json | 5 +- src/index.cts | 1 + 6 files changed, 919 insertions(+), 1 deletion(-) create mode 100644 dist/index.cjs create mode 100644 dist/index.d.cts create mode 120000 src/index.cts diff --git a/CHANGELOG.md b/CHANGELOG.md index 426ec8e..ebb70f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +## Added + +- CommonJS entry point to support older environments + ## v3.0.5 - 2024-06-19 ### Maintenance diff --git a/README.md b/README.md index bd14a6d..7a1d056 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,12 @@ See [SCRU128 Specification] for details. [KSUID]: https://github.com/segmentio/ksuid [SCRU128 Specification]: https://github.com/scru128/spec +## CommonJS support + +The CommonJS entry point is deprecated and provided for backward compatibility +purposes only. The entry point is no longer tested and will be removed in the +future. + ## License Licensed under the Apache License, Version 2.0. diff --git a/dist/index.cjs b/dist/index.cjs new file mode 100644 index 0000000..3e9f808 --- /dev/null +++ b/dist/index.cjs @@ -0,0 +1,602 @@ +"use strict"; +/** + * SCRU128: Sortable, Clock and Random number-based Unique identifier + * + * @example + * ```javascript + * import { scru128, scru128String } from "scru128"; + * // or on browsers: + * // import { scru128, scru128String } from "https://unpkg.com/scru128@^3"; + * + * // generate a new identifier object + * const x = scru128(); + * console.log(String(x)); // e.g., "036z951mhjikzik2gsl81gr7l" + * console.log(x.toBigInt()); // as a 128-bit unsigned integer + * + * // generate a textual representation directly + * console.log(scru128String()); // e.g., "036z951mhzx67t63mq9xe6q0j" + * ``` + * + * @packageDocumentation + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.scru128String = exports.scru128 = exports.Scru128Generator = exports.Scru128Id = void 0; +/** The maximum value of 48-bit `timestamp` field. */ +const MAX_TIMESTAMP = 281474976710655; +/** The maximum value of 24-bit `counter_hi` field. */ +const MAX_COUNTER_HI = 16777215; +/** The maximum value of 24-bit `counter_lo` field. */ +const MAX_COUNTER_LO = 16777215; +/** Digit characters used in the Base36 notation. */ +const DIGITS = "0123456789abcdefghijklmnopqrstuvwxyz"; +/** An O(1) map from ASCII code points to Base36 digit values. */ +const DECODE_MAP = [ + 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, + 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, + 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, + 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, + 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, + 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, + 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, + 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, +]; +/** The default timestamp rollback allowance. */ +const DEFAULT_ROLLBACK_ALLOWANCE = 10000; // 10 seconds +/** + * Represents a SCRU128 ID and provides converters and comparison operators. + * + * @example + * ```javascript + * import { Scru128Id } from "scru128"; + * + * const x = Scru128Id.fromString("036z968fu2tugy7svkfznewkk"); + * console.log(String(x)); + * + * const y = Scru128Id.fromBigInt(0x017fa1de51a80fd992f9e8cc2d5eb88en); + * console.log(y.toBigInt()); + * ``` + */ +class Scru128Id { + /** Creates an object from a 16-byte byte array. */ + constructor(bytes) { + this.bytes = bytes; + } + /** + * Creates an object from the internal representation, a 16-byte byte array + * containing the 128-bit unsigned integer representation in the big-endian + * (network) byte order. + * + * This method does NOT shallow-copy the argument, and thus the created object + * holds the reference to the underlying buffer. + * + * @throws TypeError if the length of the argument is not 16. + */ + static ofInner(bytes) { + if (bytes.length === 16) { + return new Scru128Id(bytes); + } + else { + throw new TypeError("invalid length of byte array: " + + bytes.length + + " bytes (expected 16)"); + } + } + /** + * Creates an object from field values. + * + * @param timestamp - A 48-bit `timestamp` field value. + * @param counterHi - A 24-bit `counter_hi` field value. + * @param counterLo - A 24-bit `counter_lo` field value. + * @param entropy - A 32-bit `entropy` field value. + * @throws RangeError if any argument is out of the value range of the field. + * @category Conversion + */ + static fromFields(timestamp, counterHi, counterLo, entropy) { + if (!Number.isInteger(timestamp) || + !Number.isInteger(counterHi) || + !Number.isInteger(counterLo) || + !Number.isInteger(entropy) || + timestamp < 0 || + counterHi < 0 || + counterLo < 0 || + entropy < 0 || + timestamp > MAX_TIMESTAMP || + counterHi > MAX_COUNTER_HI || + counterLo > MAX_COUNTER_LO || + entropy > 4294967295) { + throw new RangeError("invalid field value"); + } + const bytes = new Uint8Array(16); + bytes[0] = timestamp / 1099511627776; + bytes[1] = timestamp / 4294967296; + bytes[2] = timestamp >>> 24; + bytes[3] = timestamp >>> 16; + bytes[4] = timestamp >>> 8; + bytes[5] = timestamp; + bytes[6] = counterHi >>> 16; + bytes[7] = counterHi >>> 8; + bytes[8] = counterHi; + bytes[9] = counterLo >>> 16; + bytes[10] = counterLo >>> 8; + bytes[11] = counterLo; + bytes[12] = entropy >>> 24; + bytes[13] = entropy >>> 16; + bytes[14] = entropy >>> 8; + bytes[15] = entropy; + return new Scru128Id(bytes); + } + /** Returns the 48-bit `timestamp` field value. */ + get timestamp() { + return this.subUint(0, 6); + } + /** Returns the 24-bit `counter_hi` field value. */ + get counterHi() { + return this.subUint(6, 9); + } + /** Returns the 24-bit `counter_lo` field value. */ + get counterLo() { + return this.subUint(9, 12); + } + /** Returns the 32-bit `entropy` field value. */ + get entropy() { + return this.subUint(12, 16); + } + /** + * Creates an object from a 25-digit string representation. + * + * @throws SyntaxError if the argument is not a valid string representation. + * @category Conversion + */ + static fromString(value) { + var _a; + if (value.length !== 25) { + throw new SyntaxError("invalid length: " + value.length + " (expected 25)"); + } + const src = new Uint8Array(25); + for (let i = 0; i < 25; i++) { + src[i] = (_a = DECODE_MAP[value.charCodeAt(i)]) !== null && _a !== void 0 ? _a : 0x7f; + if (src[i] == 0x7f) { + const c = String.fromCodePoint(value.codePointAt(i)); + throw new SyntaxError("invalid digit '" + c + "' at " + i); + } + } + return Scru128Id.fromDigitValues(src); + } + /** + * Creates an object from an array of Base36 digit values representing a + * 25-digit string representation. + * + * @throws SyntaxError if the argument does not contain a valid string + * representation. + * @category Conversion + */ + static fromDigitValues(src) { + if (src.length !== 25) { + throw new SyntaxError("invalid length: " + src.length + " (expected 25)"); + } + const dst = new Uint8Array(16); + let minIndex = 99; // any number greater than size of output array + for (let i = -7; i < 25; i += 8) { + // implement Base36 using 8-digit words + let carry = 0; + for (let j = i < 0 ? 0 : i; j < i + 8; j++) { + const e = src[j]; + if (e < 0 || e > 35 || !Number.isInteger(e)) { + throw new SyntaxError("invalid digit at " + j); + } + carry = carry * 36 + e; + } + // iterate over output array from right to left while carry != 0 but at + // least up to place already filled + let j = dst.length - 1; + for (; carry > 0 || j > minIndex; j--) { + if (j < 0) { + throw new SyntaxError("out of 128-bit value range"); + } + carry += dst[j] * 2821109907456; // 36 ** 8 + const quo = Math.trunc(carry / 0x100); + dst[j] = carry & 0xff; // remainder + carry = quo; + } + minIndex = j; + } + return new Scru128Id(dst); + } + /** + * Returns the 25-digit canonical string representation. + * + * @category Conversion + */ + toString() { + const dst = new Uint8Array(25); + let minIndex = 99; // any number greater than size of output array + for (let i = -4; i < 16; i += 5) { + // implement Base36 using 40-bit words + let carry = this.subUint(i < 0 ? 0 : i, i + 5); + // iterate over output array from right to left while carry != 0 but at + // least up to place already filled + let j = dst.length - 1; + for (; carry > 0 || j > minIndex; j--) { + // console.assert(j >= 0); + carry += dst[j] * 1099511627776; + const quo = Math.trunc(carry / 36); + dst[j] = carry - quo * 36; // remainder + carry = quo; + } + minIndex = j; + } + let text = ""; + for (const d of dst) { + text += DIGITS.charAt(d); + } + return text; + } + /** + * Creates an object from a byte array representing either a 128-bit unsigned + * integer or a 25-digit Base36 string. + * + * This method shallow-copies the content of the argument, so the created + * object holds another instance of the byte array. + * + * @param value - An array of 16 bytes that contains a 128-bit unsigned + * integer in the big-endian (network) byte order or an array of 25 ASCII code + * points that reads a 25-digit Base36 string. + * @throws SyntaxError if conversion fails. + * @category Conversion + */ + static fromBytes(value) { + for (let i = 0; i < value.length; i++) { + const e = value[i]; + if (e < 0 || e > 0xff || !Number.isInteger(e)) { + throw new SyntaxError("invalid byte value " + e + " at " + i); + } + } + if (value.length === 16) { + return new Scru128Id(Uint8Array.from(value)); + } + else if (value.length === 25) { + return Scru128Id.fromDigitValues(Uint8Array.from(value, (c) => { var _a; return (_a = DECODE_MAP[c]) !== null && _a !== void 0 ? _a : 0x7f; })); + } + else { + throw new SyntaxError("invalid length of byte array: " + value.length + " bytes"); + } + } + /** + * Creates an object from a 128-bit unsigned integer. + * + * @throws RangeError if the argument is out of the range of 128-bit unsigned + * integer. + * @category Conversion + */ + static fromBigInt(value) { + if (value < 0 || value >> BigInt(128) > 0) { + throw new RangeError("out of 128-bit value range"); + } + const bytes = new Uint8Array(16); + for (let i = 15; i >= 0; i--) { + bytes[i] = Number(value & BigInt(0xff)); + value >>= BigInt(8); + } + return new Scru128Id(bytes); + } + /** + * Returns the 128-bit unsigned integer representation. + * + * @category Conversion + */ + toBigInt() { + return this.bytes.reduce((acc, curr) => (acc << BigInt(8)) | BigInt(curr), BigInt(0)); + } + /** + * Creates an object from a 128-bit unsigned integer encoded in a hexadecimal + * string. + * + * @throws SyntaxError if the argument is not a hexadecimal string encoding a + * 128-bit unsigned integer. + * @category Conversion + */ + static fromHex(value) { + const m = value.match(/^(?:0x)?0*(0|[1-9a-f][0-9a-f]*)$/i); + if (m === null || m[1].length > 32) { + throw new SyntaxError("invalid hexadecimal integer"); + } + const gap = 32 - m[1].length; + const bytes = new Uint8Array(16); + for (let i = 0; i < 16; i++) { + const pos = i * 2 - gap; + bytes[i] = + (pos < 0 ? 0 : DECODE_MAP[m[1].charCodeAt(pos)] << 4) | + (pos + 1 < 0 ? 0 : DECODE_MAP[m[1].charCodeAt(pos + 1)]); + } + return new Scru128Id(bytes); + } + /** + * Returns the 128-bit unsigned integer representation as a 32-digit + * hexadecimal string prefixed with "0x". + * + * @category Conversion + */ + toHex() { + const digits = "0123456789abcdef"; + let text = "0x"; + for (const e of this.bytes) { + text += digits.charAt(e >>> 4); + text += digits.charAt(e & 0xf); + } + return text; + } + /** Represents `this` in JSON as a 25-digit canonical string. */ + toJSON() { + return this.toString(); + } + /** + * Creates an object from `this`. + * + * Note that this class is designed to be immutable, and thus `clone()` is not + * necessary unless properties marked as private are modified directly. + */ + clone() { + return new Scru128Id(this.bytes.slice(0)); + } + /** Returns true if `this` is equivalent to `other`. */ + equals(other) { + return this.compareTo(other) === 0; + } + /** + * Returns a negative integer, zero, or positive integer if `this` is less + * than, equal to, or greater than `other`, respectively. + */ + compareTo(other) { + for (let i = 0; i < 16; i++) { + const diff = this.bytes[i] - other.bytes[i]; + if (diff !== 0) { + return Math.sign(diff); + } + } + return 0; + } + /** Returns a part of `bytes` as an unsigned integer. */ + subUint(beginIndex, endIndex) { + let buffer = 0; + while (beginIndex < endIndex) { + buffer = buffer * 0x100 + this.bytes[beginIndex++]; + } + return buffer; + } +} +exports.Scru128Id = Scru128Id; +/** + * Represents a SCRU128 ID generator that encapsulates the monotonic counters + * and other internal states. + * + * @example + * ```javascript + * import { Scru128Generator } from "scru128"; + * + * const g = new Scru128Generator(); + * const x = g.generate(); + * console.log(String(x)); + * console.log(x.toBigInt()); + * ``` + * + * @remarks + * The generator comes with four different methods that generate a SCRU128 ID: + * + * | Flavor | Timestamp | On big clock rewind | + * | --------------------------- | --------- | ------------------- | + * | {@link generate} | Now | Resets generator | + * | {@link generateOrAbort} | Now | Returns `undefined` | + * | {@link generateOrResetCore} | Argument | Resets generator | + * | {@link generateOrAbortCore} | Argument | Returns `undefined` | + * + * All of the four return a monotonically increasing ID by reusing the previous + * `timestamp` even if the one provided is smaller than the immediately + * preceding ID's. However, when such a clock rollback is considered significant + * (by default, more than ten seconds): + * + * 1. `generate` (OrReset) methods reset the generator and return a new ID based + * on the given `timestamp`, breaking the increasing order of IDs. + * 2. `OrAbort` variants abort and return `undefined` immediately. + * + * The `Core` functions offer low-level primitives to customize the behavior. + */ +class Scru128Generator { + /** + * Creates a generator object with the default random number generator, or + * with the specified one if passed as an argument. The specified random + * number generator should be cryptographically strong and securely seeded. + */ + constructor(randomNumberGenerator) { + this.timestamp = 0; + this.counterHi = 0; + this.counterLo = 0; + /** The timestamp at the last renewal of `counter_hi` field. */ + this.tsCounterHi = 0; + this.rng = randomNumberGenerator || getDefaultRandom(); + } + /** + * Generates a new SCRU128 ID object from the current `timestamp`, or resets + * the generator upon significant timestamp rollback. + * + * See the {@link Scru128Generator} class documentation for the description. + */ + generate() { + return this.generateOrResetCore(Date.now(), DEFAULT_ROLLBACK_ALLOWANCE); + } + /** + * Generates a new SCRU128 ID object from the current `timestamp`, or returns + * `undefined` upon significant timestamp rollback. + * + * See the {@link Scru128Generator} class documentation for the description. + * + * @example + * ```javascript + * import { Scru128Generator } from "scru128"; + * + * const g = new Scru128Generator(); + * const x = g.generateOrAbort(); + * const y = g.generateOrAbort(); + * if (y === undefined) { + * throw new Error("The clock went backwards by ten seconds!"); + * } + * console.assert(x.compareTo(y) < 0); + * ``` + */ + generateOrAbort() { + return this.generateOrAbortCore(Date.now(), DEFAULT_ROLLBACK_ALLOWANCE); + } + /** + * Generates a new SCRU128 ID object from the `timestamp` passed, or resets + * the generator upon significant timestamp rollback. + * + * See the {@link Scru128Generator} class documentation for the description. + * + * @param rollbackAllowance - The amount of `timestamp` rollback that is + * considered significant. A suggested value is `10_000` (milliseconds). + * @throws RangeError if `timestamp` is not a 48-bit positive integer. + */ + generateOrResetCore(timestamp, rollbackAllowance) { + let value = this.generateOrAbortCore(timestamp, rollbackAllowance); + if (value === undefined) { + // reset state and resume + this.timestamp = 0; + this.tsCounterHi = 0; + value = this.generateOrAbortCore(timestamp, rollbackAllowance); + } + return value; + } + /** + * Generates a new SCRU128 ID object from the `timestamp` passed, or returns + * `undefined` upon significant timestamp rollback. + * + * See the {@link Scru128Generator} class documentation for the description. + * + * @param rollbackAllowance - The amount of `timestamp` rollback that is + * considered significant. A suggested value is `10_000` (milliseconds). + * @throws RangeError if `timestamp` is not a 48-bit positive integer. + */ + generateOrAbortCore(timestamp, rollbackAllowance) { + if (!Number.isInteger(timestamp) || + timestamp < 1 || + timestamp > MAX_TIMESTAMP) { + throw new RangeError("`timestamp` must be a 48-bit positive integer"); + } + else if (rollbackAllowance < 0 || rollbackAllowance > MAX_TIMESTAMP) { + throw new RangeError("`rollbackAllowance` out of reasonable range"); + } + if (timestamp > this.timestamp) { + this.timestamp = timestamp; + this.counterLo = this.rng.nextUint32() & MAX_COUNTER_LO; + } + else if (timestamp + rollbackAllowance >= this.timestamp) { + // go on with previous timestamp if new one is not much smaller + this.counterLo++; + if (this.counterLo > MAX_COUNTER_LO) { + this.counterLo = 0; + this.counterHi++; + if (this.counterHi > MAX_COUNTER_HI) { + this.counterHi = 0; + // increment timestamp at counter overflow + this.timestamp++; + this.counterLo = this.rng.nextUint32() & MAX_COUNTER_LO; + } + } + } + else { + // abort if clock went backwards to unbearable extent + return undefined; + } + if (this.timestamp - this.tsCounterHi >= 1000 || this.tsCounterHi < 1) { + this.tsCounterHi = this.timestamp; + this.counterHi = this.rng.nextUint32() & MAX_COUNTER_HI; + } + return Scru128Id.fromFields(this.timestamp, this.counterHi, this.counterLo, this.rng.nextUint32()); + } + /** + * Returns an infinite iterator object that produces a new ID for each call of + * `next()`. + * + * @example + * ```javascript + * import { Scru128Generator } from "scru128"; + * + * const [a, b, c] = new Scru128Generator(); + * console.log(String(a)); // e.g., "038mqr9e14cjc12dh9amw7i5o" + * console.log(String(b)); // e.g., "038mqr9e14cjc12dh9dtpwfr3" + * console.log(String(c)); // e.g., "038mqr9e14cjc12dh9e6rjmqi" + * ``` + */ + [Symbol.iterator]() { + return this; + } + /** + * Returns a new SCRU128 ID object for each call, infinitely. + * + * This method wraps the result of {@link generate} in an [`IteratorResult`] + * object to use `this` as an infinite iterator. + * + * [`IteratorResult`]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Iteration_protocols + */ + next() { + return { value: this.generate(), done: false }; + } +} +exports.Scru128Generator = Scru128Generator; +/** Returns the default random number generator available in the environment. */ +const getDefaultRandom = () => { + // detect Web Crypto API + if (typeof crypto !== "undefined" && + typeof crypto.getRandomValues !== "undefined") { + return new BufferedCryptoRandom(); + } + else { + // fall back on Math.random() unless the flag is set to true + if (typeof SCRU128_DENY_WEAK_RNG !== "undefined" && SCRU128_DENY_WEAK_RNG) { + throw new Error("no cryptographically strong RNG available"); + } + return { + nextUint32: () => Math.trunc(Math.random() * 65536) * 65536 + + Math.trunc(Math.random() * 65536), + }; + } +}; +/** + * Wraps `crypto.getRandomValues()` to enable buffering; this uses a small + * buffer by default to avoid both unbearable throughput decline in some + * environments and the waste of time and space for unused values. + */ +class BufferedCryptoRandom { + constructor() { + this.buffer = new Uint32Array(8); + this.cursor = 0xffff; + } + nextUint32() { + if (this.cursor >= this.buffer.length) { + crypto.getRandomValues(this.buffer); + this.cursor = 0; + } + return this.buffer[this.cursor++]; + } +} +let globalGenerator; +/** Generates a new SCRU128 ID object using the global generator. */ +const scru128 = () => (globalGenerator || (globalGenerator = new Scru128Generator())).generate(); +exports.scru128 = scru128; +/** + * Generates a new SCRU128 ID encoded in a string using the global generator. + * + * Use this function to quickly get a new SCRU128 ID as a string. + * + * @returns The 25-digit canonical string representation. + * @example + * ```javascript + * import { scru128String } from "scru128"; + * + * const x = scru128String(); + * console.log(x); + * ``` + */ +const scru128String = () => (0, exports.scru128)().toString(); +exports.scru128String = scru128String; diff --git a/dist/index.d.cts b/dist/index.d.cts new file mode 100644 index 0000000..ddce4cd --- /dev/null +++ b/dist/index.d.cts @@ -0,0 +1,300 @@ +/** + * SCRU128: Sortable, Clock and Random number-based Unique identifier + * + * @example + * ```javascript + * import { scru128, scru128String } from "scru128"; + * // or on browsers: + * // import { scru128, scru128String } from "https://unpkg.com/scru128@^3"; + * + * // generate a new identifier object + * const x = scru128(); + * console.log(String(x)); // e.g., "036z951mhjikzik2gsl81gr7l" + * console.log(x.toBigInt()); // as a 128-bit unsigned integer + * + * // generate a textual representation directly + * console.log(scru128String()); // e.g., "036z951mhzx67t63mq9xe6q0j" + * ``` + * + * @packageDocumentation + */ +/** + * Represents a SCRU128 ID and provides converters and comparison operators. + * + * @example + * ```javascript + * import { Scru128Id } from "scru128"; + * + * const x = Scru128Id.fromString("036z968fu2tugy7svkfznewkk"); + * console.log(String(x)); + * + * const y = Scru128Id.fromBigInt(0x017fa1de51a80fd992f9e8cc2d5eb88en); + * console.log(y.toBigInt()); + * ``` + */ +export declare class Scru128Id { + /** + * A 16-byte byte array containing the 128-bit unsigned integer representation + * in the big-endian (network) byte order. + */ + readonly bytes: Readonly; + /** Creates an object from a 16-byte byte array. */ + private constructor(); + /** + * Creates an object from the internal representation, a 16-byte byte array + * containing the 128-bit unsigned integer representation in the big-endian + * (network) byte order. + * + * This method does NOT shallow-copy the argument, and thus the created object + * holds the reference to the underlying buffer. + * + * @throws TypeError if the length of the argument is not 16. + */ + static ofInner(bytes: Uint8Array): Scru128Id; + /** + * Creates an object from field values. + * + * @param timestamp - A 48-bit `timestamp` field value. + * @param counterHi - A 24-bit `counter_hi` field value. + * @param counterLo - A 24-bit `counter_lo` field value. + * @param entropy - A 32-bit `entropy` field value. + * @throws RangeError if any argument is out of the value range of the field. + * @category Conversion + */ + static fromFields(timestamp: number, counterHi: number, counterLo: number, entropy: number): Scru128Id; + /** Returns the 48-bit `timestamp` field value. */ + get timestamp(): number; + /** Returns the 24-bit `counter_hi` field value. */ + get counterHi(): number; + /** Returns the 24-bit `counter_lo` field value. */ + get counterLo(): number; + /** Returns the 32-bit `entropy` field value. */ + get entropy(): number; + /** + * Creates an object from a 25-digit string representation. + * + * @throws SyntaxError if the argument is not a valid string representation. + * @category Conversion + */ + static fromString(value: string): Scru128Id; + /** + * Creates an object from an array of Base36 digit values representing a + * 25-digit string representation. + * + * @throws SyntaxError if the argument does not contain a valid string + * representation. + * @category Conversion + */ + private static fromDigitValues; + /** + * Returns the 25-digit canonical string representation. + * + * @category Conversion + */ + toString(): string; + /** + * Creates an object from a byte array representing either a 128-bit unsigned + * integer or a 25-digit Base36 string. + * + * This method shallow-copies the content of the argument, so the created + * object holds another instance of the byte array. + * + * @param value - An array of 16 bytes that contains a 128-bit unsigned + * integer in the big-endian (network) byte order or an array of 25 ASCII code + * points that reads a 25-digit Base36 string. + * @throws SyntaxError if conversion fails. + * @category Conversion + */ + static fromBytes(value: ArrayLike): Scru128Id; + /** + * Creates an object from a 128-bit unsigned integer. + * + * @throws RangeError if the argument is out of the range of 128-bit unsigned + * integer. + * @category Conversion + */ + static fromBigInt(value: bigint): Scru128Id; + /** + * Returns the 128-bit unsigned integer representation. + * + * @category Conversion + */ + toBigInt(): bigint; + /** + * Creates an object from a 128-bit unsigned integer encoded in a hexadecimal + * string. + * + * @throws SyntaxError if the argument is not a hexadecimal string encoding a + * 128-bit unsigned integer. + * @category Conversion + */ + static fromHex(value: string): Scru128Id; + /** + * Returns the 128-bit unsigned integer representation as a 32-digit + * hexadecimal string prefixed with "0x". + * + * @category Conversion + */ + toHex(): string; + /** Represents `this` in JSON as a 25-digit canonical string. */ + toJSON(): string; + /** + * Creates an object from `this`. + * + * Note that this class is designed to be immutable, and thus `clone()` is not + * necessary unless properties marked as private are modified directly. + */ + clone(): Scru128Id; + /** Returns true if `this` is equivalent to `other`. */ + equals(other: Scru128Id): boolean; + /** + * Returns a negative integer, zero, or positive integer if `this` is less + * than, equal to, or greater than `other`, respectively. + */ + compareTo(other: Scru128Id): number; + /** Returns a part of `bytes` as an unsigned integer. */ + private subUint; +} +/** + * Represents a SCRU128 ID generator that encapsulates the monotonic counters + * and other internal states. + * + * @example + * ```javascript + * import { Scru128Generator } from "scru128"; + * + * const g = new Scru128Generator(); + * const x = g.generate(); + * console.log(String(x)); + * console.log(x.toBigInt()); + * ``` + * + * @remarks + * The generator comes with four different methods that generate a SCRU128 ID: + * + * | Flavor | Timestamp | On big clock rewind | + * | --------------------------- | --------- | ------------------- | + * | {@link generate} | Now | Resets generator | + * | {@link generateOrAbort} | Now | Returns `undefined` | + * | {@link generateOrResetCore} | Argument | Resets generator | + * | {@link generateOrAbortCore} | Argument | Returns `undefined` | + * + * All of the four return a monotonically increasing ID by reusing the previous + * `timestamp` even if the one provided is smaller than the immediately + * preceding ID's. However, when such a clock rollback is considered significant + * (by default, more than ten seconds): + * + * 1. `generate` (OrReset) methods reset the generator and return a new ID based + * on the given `timestamp`, breaking the increasing order of IDs. + * 2. `OrAbort` variants abort and return `undefined` immediately. + * + * The `Core` functions offer low-level primitives to customize the behavior. + */ +export declare class Scru128Generator { + private timestamp; + private counterHi; + private counterLo; + /** The timestamp at the last renewal of `counter_hi` field. */ + private tsCounterHi; + /** The random number generator used by the generator. */ + private rng; + /** + * Creates a generator object with the default random number generator, or + * with the specified one if passed as an argument. The specified random + * number generator should be cryptographically strong and securely seeded. + */ + constructor(randomNumberGenerator?: { + /** Returns a 32-bit random unsigned integer. */ + nextUint32(): number; + }); + /** + * Generates a new SCRU128 ID object from the current `timestamp`, or resets + * the generator upon significant timestamp rollback. + * + * See the {@link Scru128Generator} class documentation for the description. + */ + generate(): Scru128Id; + /** + * Generates a new SCRU128 ID object from the current `timestamp`, or returns + * `undefined` upon significant timestamp rollback. + * + * See the {@link Scru128Generator} class documentation for the description. + * + * @example + * ```javascript + * import { Scru128Generator } from "scru128"; + * + * const g = new Scru128Generator(); + * const x = g.generateOrAbort(); + * const y = g.generateOrAbort(); + * if (y === undefined) { + * throw new Error("The clock went backwards by ten seconds!"); + * } + * console.assert(x.compareTo(y) < 0); + * ``` + */ + generateOrAbort(): Scru128Id | undefined; + /** + * Generates a new SCRU128 ID object from the `timestamp` passed, or resets + * the generator upon significant timestamp rollback. + * + * See the {@link Scru128Generator} class documentation for the description. + * + * @param rollbackAllowance - The amount of `timestamp` rollback that is + * considered significant. A suggested value is `10_000` (milliseconds). + * @throws RangeError if `timestamp` is not a 48-bit positive integer. + */ + generateOrResetCore(timestamp: number, rollbackAllowance: number): Scru128Id; + /** + * Generates a new SCRU128 ID object from the `timestamp` passed, or returns + * `undefined` upon significant timestamp rollback. + * + * See the {@link Scru128Generator} class documentation for the description. + * + * @param rollbackAllowance - The amount of `timestamp` rollback that is + * considered significant. A suggested value is `10_000` (milliseconds). + * @throws RangeError if `timestamp` is not a 48-bit positive integer. + */ + generateOrAbortCore(timestamp: number, rollbackAllowance: number): Scru128Id | undefined; + /** + * Returns an infinite iterator object that produces a new ID for each call of + * `next()`. + * + * @example + * ```javascript + * import { Scru128Generator } from "scru128"; + * + * const [a, b, c] = new Scru128Generator(); + * console.log(String(a)); // e.g., "038mqr9e14cjc12dh9amw7i5o" + * console.log(String(b)); // e.g., "038mqr9e14cjc12dh9dtpwfr3" + * console.log(String(c)); // e.g., "038mqr9e14cjc12dh9e6rjmqi" + * ``` + */ + [Symbol.iterator](): Iterator; + /** + * Returns a new SCRU128 ID object for each call, infinitely. + * + * This method wraps the result of {@link generate} in an [`IteratorResult`] + * object to use `this` as an infinite iterator. + * + * [`IteratorResult`]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Iteration_protocols + */ + next(): IteratorResult; +} +/** Generates a new SCRU128 ID object using the global generator. */ +export declare const scru128: () => Scru128Id; +/** + * Generates a new SCRU128 ID encoded in a string using the global generator. + * + * Use this function to quickly get a new SCRU128 ID as a string. + * + * @returns The 25-digit canonical string representation. + * @example + * ```javascript + * import { scru128String } from "scru128"; + * + * const x = scru128String(); + * console.log(x); + * ``` + */ +export declare const scru128String: () => string; diff --git a/package.json b/package.json index 71f7ff4..37552e1 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,10 @@ "type": "module", "main": "dist/index.js", "types": "./dist/index.d.ts", - "exports": "./dist/index.js", + "exports": { + "require": "./dist/index.cjs", + "default": "./dist/index.js" + }, "files": [ "CHANGELOG.md", "dist" diff --git a/src/index.cts b/src/index.cts new file mode 120000 index 0000000..a2e78d7 --- /dev/null +++ b/src/index.cts @@ -0,0 +1 @@ +index.ts \ No newline at end of file From 83b95490f1111d20b67646feca4ef64bae628739 Mon Sep 17 00:00:00 2001 From: LiosK Date: Sat, 12 Oct 2024 15:00:16 +0900 Subject: [PATCH 2/2] build: update dev dependencies and prepare for release --- CHANGELOG.md | 6 +- docs/assets/icons.js | 31 +- docs/assets/icons.svg | 2 +- docs/assets/main.js | 9 +- docs/assets/search.js | 2 +- docs/assets/style.css | 185 +++++-- docs/classes/Scru128Generator.html | 60 ++- docs/classes/Scru128Id.html | 70 ++- docs/functions/scru128.html | 4 +- docs/functions/scru128String.html | 11 +- docs/index.html | 28 +- docs/modules.html | 11 +- package-lock.json | 771 ++++++++++++++++++++++++----- package.json | 8 +- 14 files changed, 909 insertions(+), 289 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebb70f4..302f239 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,15 @@ # Changelog -## Unreleased +## v3.0.6 - 2024-10-12 ## Added - CommonJS entry point to support older environments +### Maintenance + +- Updated dev dependencies + ## v3.0.5 - 2024-06-19 ### Maintenance diff --git a/docs/assets/icons.js b/docs/assets/icons.js index b79c9e8..3dfbd32 100644 --- a/docs/assets/icons.js +++ b/docs/assets/icons.js @@ -1,15 +1,18 @@ -(function(svg) { - svg.innerHTML = ``; - svg.style.display = 'none'; - if (location.protocol === 'file:') { - if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', updateUseElements); - else updateUseElements() - function updateUseElements() { - document.querySelectorAll('use').forEach(el => { - if (el.getAttribute('href').includes('#icon-')) { - el.setAttribute('href', el.getAttribute('href').replace(/.*#/, '#')); - } - }); - } +(function() { + addIcons(); + function addIcons() { + if (document.readyState === "loading") return document.addEventListener("DOMContentLoaded", addIcons); + const svg = document.body.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg")); + svg.innerHTML = `MMNEPVFCICPMFPCPTTAAATR`; + svg.style.display = "none"; + if (location.protocol === "file:") updateUseElements(); } -})(document.body.appendChild(document.createElementNS('http://www.w3.org/2000/svg', 'svg'))) \ No newline at end of file + + function updateUseElements() { + document.querySelectorAll("use").forEach(el => { + if (el.getAttribute("href").includes("#icon-")) { + el.setAttribute("href", el.getAttribute("href").replace(/.*#/, "#")); + } + }); + } +})() \ No newline at end of file diff --git a/docs/assets/icons.svg b/docs/assets/icons.svg index 7dead61..a19417d 100644 --- a/docs/assets/icons.svg +++ b/docs/assets/icons.svg @@ -1 +1 @@ - \ No newline at end of file +MMNEPVFCICPMFPCPTTAAATR \ No newline at end of file diff --git a/docs/assets/main.js b/docs/assets/main.js index d6f1388..99097a0 100644 --- a/docs/assets/main.js +++ b/docs/assets/main.js @@ -1,8 +1,9 @@ "use strict"; -"use strict";(()=>{var Ce=Object.create;var ne=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Pe(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Ce(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. -`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),y=s.str.charAt(1),p;y in s.node.edges?p=s.node.edges[y]:(p=new t.TokenSet,s.node.edges[y]=p),s.str.length==1&&(p.final=!0),i.push({node:p,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible()),document.body.style.display||(this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}showPage(){document.body.style.display&&(console.log("Show page"),document.body.style.removeProperty("display"),this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}scrollToHash(){if(location.hash){console.log("Scorlling");let e=document.getElementById(location.hash.substring(1));if(!e)return;e.scrollIntoView({behavior:"instant",block:"start"})}}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e&&!e.checkVisibility()){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}updateIndexVisibility(){let e=document.querySelector(".tsd-index-content"),n=e?.open;e&&(e.open=!0),document.querySelectorAll(".tsd-index-section").forEach(r=>{r.style.display="block";let i=Array.from(r.querySelectorAll(".tsd-index-link")).every(s=>s.offsetParent==null);r.style.display=i?"none":"block"}),e&&(e.open=n)}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ve(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ne(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ve(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` - ${ce(l.parent,i)}.${d}`);let y=document.createElement("li");y.classList.value=l.classes??"";let p=document.createElement("a");p.href=r.base+l.url,p.innerHTML=u+d,y.append(p),e.appendChild(y)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ne(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var He={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>He[e])}var I=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",fe="mousemove",H="mouseup",J={x:0,y:0},pe=!1,ee=!1,Be=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(Be=!0,F="touchstart",fe="touchmove",H="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(fe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(H,()=>{ee=!1});document.addEventListener("click",t=>{pe&&(t.preventDefault(),t.stopImmediatePropagation(),pe=!1)});var X=class extends I{constructor(e){super(e),this.className=this.el.dataset.toggle||"",this.el.addEventListener(H,n=>this.onPointerUp(n)),this.el.addEventListener("click",n=>n.preventDefault()),document.addEventListener(F,n=>this.onDocumentPointerDown(n)),document.addEventListener(H,n=>this.onDocumentPointerUp(n))}setActive(e){if(this.active==e)return;this.active=e,document.documentElement.classList.toggle("has-"+this.className,e),this.el.classList.toggle("active",e);let n=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(n),setTimeout(()=>document.documentElement.classList.remove(n),500)}onPointerUp(e){D||(this.setActive(!0),e.preventDefault())}onDocumentPointerDown(e){if(this.active){if(e.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(e){if(!D&&this.active&&e.target.closest(".col-sidebar")){let n=e.target.closest("a");if(n){let r=window.location.href;r.indexOf("#")!=-1&&(r=r.substring(0,r.indexOf("#"))),n.href.substring(0,r.length)==r&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ye=document.head.appendChild(document.createElement("style"));ye.dataset.for="filters";var Y=class extends I{constructor(e){super(e),this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ye.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } -`,this.app.updateIndexVisibility()}fromLocalStorage(){let e=Q.getItem(this.key);return e?e==="true":this.el.checked}setLocalStorage(e){Q.setItem(this.key,e.toString()),this.value=e,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),this.app.updateIndexVisibility()}};var Z=class extends I{constructor(e){super(e),this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let n=Q.getItem(this.key);this.el.open=n?n==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let r=this.summary.querySelector("a");r&&r.addEventListener("click",()=>{location.assign(r.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ve(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ve(t.value)})}function ve(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.showPage(),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.pathname===r.pathname&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); +window.translations={"copy":"Copy","copied":"Copied!","normally_hidden":"This member is normally hidden due to your filter settings."}; +"use strict";(()=>{var Pe=Object.create;var ie=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Re=Object.getPrototypeOf,Me=Object.prototype.hasOwnProperty;var Fe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var De=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _e(e))!Me.call(t,i)&&i!==n&&ie(t,i,{get:()=>e[i],enumerable:!(r=Oe(e,i))||r.enumerable});return t};var Ae=(t,e,n)=>(n=t!=null?Pe(Re(t)):{},De(e||!t||!t.__esModule?ie(n,"default",{value:t,enumerable:!0}):n,t));var ue=Fe((ae,le)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),m=s.str.charAt(1),p;m in s.node.edges?p=s.node.edges[m]:(p=new t.TokenSet,s.node.edges[m]=p),s.str.length==1&&(p.final=!0),i.push({node:p,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof ae=="object"?le.exports=n():e.lunr=n()}(this,function(){return t})})()});var se=[];function G(t,e){se.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible()),document.body.style.display||(this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}createComponents(e){se.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}showPage(){document.body.style.display&&(document.body.style.removeProperty("display"),this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}scrollToHash(){if(location.hash){let e=document.getElementById(location.hash.substring(1));if(!e)return;e.scrollIntoView({behavior:"instant",block:"start"})}}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e&&!Ve(e)){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r,document.querySelector(".col-sidebar").scrollTop=r}}updateIndexVisibility(){let e=document.querySelector(".tsd-index-content"),n=e?.open;e&&(e.open=!0),document.querySelectorAll(".tsd-index-section").forEach(r=>{r.style.display="block";let i=Array.from(r.querySelectorAll(".tsd-index-link")).every(s=>s.offsetParent==null);r.style.display=i?"none":"block"}),e&&(e.open=n)}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(!n)return;let r=n.offsetParent==null,i=n;for(;i!==document.body;)i instanceof HTMLDetailsElement&&(i.open=!0),i=i.parentElement;if(n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let s=document.createElement("p");s.classList.add("warning"),s.textContent=window.translations.normally_hidden,n.prepend(s)}r&&e.scrollIntoView()}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent=window.translations.copied,e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent=window.translations.copy},100)},1e3)})})}};function Ve(t){let e=t.getBoundingClientRect(),n=Math.max(document.documentElement.clientHeight,window.innerHeight);return!(e.bottom<0||e.top-n>=0)}var oe=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var pe=Ae(ue());async function ce(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=pe.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function fe(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{ce(e,t)}),ce(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");i.addEventListener("mouseup",()=>{te(t)}),r.addEventListener("focus",()=>t.classList.add("has-focus")),He(t,i,r,e)}function He(t,e,n,r){n.addEventListener("input",oe(()=>{Ne(t,e,n,r)},200)),n.addEventListener("keydown",i=>{i.key=="Enter"?Be(e,t):i.key=="ArrowUp"?(de(e,n,-1),i.preventDefault()):i.key==="ArrowDown"&&(de(e,n,1),i.preventDefault())}),document.body.addEventListener("keypress",i=>{i.altKey||i.ctrlKey||i.metaKey||!n.matches(":focus")&&i.key==="/"&&(i.preventDefault(),n.focus())}),document.body.addEventListener("keyup",i=>{t.classList.contains("has-focus")&&(i.key==="Escape"||!e.matches(":focus-within")&&!n.matches(":focus"))&&(n.blur(),te(t))})}function te(t){t.classList.remove("has-focus")}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=he(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` + ${he(l.parent,i)}.${d}`);let m=document.createElement("li");m.classList.value=l.classes??"";let p=document.createElement("a");p.href=r.base+l.url,p.innerHTML=u+d,m.append(p),p.addEventListener("focus",()=>{e.querySelector(".current")?.classList.remove("current"),m.classList.add("current")}),e.appendChild(m)}}function de(t,e,n){let r=t.querySelector(".current");if(!r)r=t.querySelector(n==1?"li:first-child":"li:last-child"),r&&r.classList.add("current");else{let i=r;if(n===1)do i=i.nextElementSibling??void 0;while(i instanceof HTMLElement&&i.offsetParent==null);else do i=i.previousElementSibling??void 0;while(i instanceof HTMLElement&&i.offsetParent==null);i?(r.classList.remove("current"),i.classList.add("current")):n===-1&&(r.classList.remove("current"),e.focus())}}function Be(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),te(e)}}function he(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(ee(t.substring(s,o)),`${ee(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(ee(t.substring(s))),i.join("")}var je={"&":"&","<":"<",">":">","'":"'",'"':"""};function ee(t){return t.replace(/[&<>"'"]/g,e=>je[e])}var I=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",ye="mousemove",N="mouseup",J={x:0,y:0},me=!1,ne=!1,qe=!1,D=!1,ve=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(ve?"is-mobile":"not-mobile");ve&&"ontouchstart"in document.documentElement&&(qe=!0,F="touchstart",ye="touchmove",N="touchend");document.addEventListener(F,t=>{ne=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(ye,t=>{if(ne&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(N,()=>{ne=!1});document.addEventListener("click",t=>{me&&(t.preventDefault(),t.stopImmediatePropagation(),me=!1)});var X=class extends I{constructor(e){super(e),this.className=this.el.dataset.toggle||"",this.el.addEventListener(N,n=>this.onPointerUp(n)),this.el.addEventListener("click",n=>n.preventDefault()),document.addEventListener(F,n=>this.onDocumentPointerDown(n)),document.addEventListener(N,n=>this.onDocumentPointerUp(n))}setActive(e){if(this.active==e)return;this.active=e,document.documentElement.classList.toggle("has-"+this.className,e),this.el.classList.toggle("active",e);let n=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(n),setTimeout(()=>document.documentElement.classList.remove(n),500)}onPointerUp(e){D||(this.setActive(!0),e.preventDefault())}onDocumentPointerDown(e){if(this.active){if(e.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(e){if(!D&&this.active&&e.target.closest(".col-sidebar")){let n=e.target.closest("a");if(n){let r=window.location.href;r.indexOf("#")!=-1&&(r=r.substring(0,r.indexOf("#"))),n.href.substring(0,r.length)==r&&setTimeout(()=>this.setActive(!1),250)}}}};var re;try{re=localStorage}catch{re={getItem(){return null},setItem(){}}}var Q=re;var ge=document.head.appendChild(document.createElement("style"));ge.dataset.for="filters";var Y=class extends I{constructor(e){super(e),this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ge.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } +`,this.app.updateIndexVisibility()}fromLocalStorage(){let e=Q.getItem(this.key);return e?e==="true":this.el.checked}setLocalStorage(e){Q.setItem(this.key,e.toString()),this.value=e,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),this.app.updateIndexVisibility()}};var Z=class extends I{constructor(e){super(e),this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let n=Q.getItem(this.key);this.el.open=n?n==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let r=this.summary.querySelector("a");r&&r.addEventListener("click",()=>{location.assign(r.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function Ee(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,xe(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),xe(t.value)})}function xe(t){document.documentElement.dataset.theme=t}var K;function we(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",Le),Le())}async function Le(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();K=t.dataset.base,K.endsWith("/")||(K+="/"),t.innerHTML="";for(let s of i)Se(s,t,[]);window.app.createComponents(t),window.app.showPage(),window.app.ensureActivePageVisible()}function Se(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-accordion`:"tsd-accordion";let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.dataset.key=i.join("$"),o.innerHTML='',be(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)Se(u,l,i)}else be(t,r,t.class)}function be(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=K+t.path,n&&(r.className=n),location.pathname===r.pathname&&!r.href.includes("#")&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else{let r=e.appendChild(document.createElement("span"));r.innerHTML='',r.appendChild(document.createElement("span")).textContent=t.text}}G(X,"a[data-toggle]");G(Z,".tsd-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Te=document.getElementById("tsd-theme");Te&&Ee(Te);var $e=new U;Object.defineProperty(window,"app",{value:$e});fe();we();})(); /*! Bundled license information: lunr/lunr.js: diff --git a/docs/assets/search.js b/docs/assets/search.js index bb1b09a..ee98dc4 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE61Z25LiNhD9F+fVy9AtMAxv2U0lO6lUtiqb7AtFTXHxME7AJrY82Slq/j2SbaxuI2Fj5tH4HJ12n1brwtFLk/8ybzY/ev9E8cabAU59L17uQ2/mfV2nuXp+2Hi+l6c79ct6t8yyMLur3wye5X6nXlcvFMR7809j4XBkBkueHuI4TFuG+sHAyJC+d1imYSxZTA6dpzTZ/xyFu03WJsWQN6h9lWkUb7uo1cgb1H6KtpH8ttzlYacP5HCjK7PNhyj7cEijl6UMr47i46vspn8C3vDFH6Ptg0J3ETshb1D7HH7vIlXCuuuMAWuZdRJnMs3XMmmdDhza1z4Y4qhWX3WxbnW9bQHCyKjIaB9mcrk/tClRYG+1dZLHMkw/R+35NMBb1X5LOqoVwN5qCpgmh9c2LQPrWfwy6dbICK63UrcpTXC9lTpM5xOot8avX7/83i5SoXqqrHdJHLbWWwXqqRH+my93ra2hRvX9kmSvwX92mD0G2FMry1d/Re2FZmC9O+z5tumXUO1jlhd6fA24uIm6cuHggzrXD8v3mHgdC0drS29o2zt7a15b42ht9mc5sPX8d4vDvQzY42isBrfHIbNPV2aEM94zltS9fjRiSBsrSC/tYDwWQS3++ChfD84mea4/qAndJsZAx+zoNHH4XeoeIvBq/QHjdg/lFL4jom2J7ZoPAr+6TVh1v6Q/rpLU2Xsd8ob1XlH8EWah/JSk1yaCM981J72ioczbotH11lG+gt6mN49kCVh0VH08ER77aAemHWUlqpZ9yuO1jNSaeFe9ubj0ng/U2CGfDVe+tw268D01ptpnzo7eS5hmiqV+x4EY3CvkU3kNMZuXer7eJO31hy6qd99CvYRrRAm5G3r+fOgLHEzFaLHw5ydG8aL4oYCBegIbDBhMNZ452mDIYEI9CRtMMNhIPY1ssBGDjdXT2AYbM1igngIbLGCwiXqa2GATBlO1MJ/6OBlMMGCwKYMpU+b3ttHueXp1tmFoGw8aRhROgBXJvQCdc7XpsyG5HaDTDlZDgDsCOvNg9QS4KaCTD1ZbgPsCOv9gdQa4NaAtAKs5wN0B7QJMrUhuEGgjwGoRcI9QG4HWuYLcI9RGoHW6YGO+FBPGPmO4RyhcBYfcIhw5Swm5RTh2lhJyizBwlhJyi1D7gNZSQm6R7qZztJYScotQ+4DWUkJukSgsspaS4BaJwiJrKQlukSgsspaSaHQ1bQRaS0lwj4Q2QlhLSXCPhDZCWEtJcI+ENkJYS0lwj4Q2Qtj7L/dIaCOE1SNRelQsR2odkuHmoVyW1MJy2g4fvcdqrVLuVSvg0VOezY5vb2Zt0k966Oqu0LDuDcnFqW4qDAemhqSmuoNV3gjIhMU4JDEOnUxyDjZcIlpo+p6ala4RihPTc8SiBhI1VCOML4+wY9Gb070aAasRAscI9R0f4QvCd8V+urIhNOIRuEzS99yraFvcjBhqYJiuOAtisypIKbkypHkb/YfFS/WHhWGPDHt0gV1tpGh5kOq4QHzWV4CGNTGsyQVWVu0HDZHY4XLDnLRIlERQQAsxSZflGYnwSSUL13c2+OviLEFCJxNJuJJsxkj16ag5BpK6Eq4EnHb3TJz4JFx1VZ5GCIlMP+EqKk3Kq9M1CZSUsXB1jeQpKv+MJBOHzBsHK+UVgaR00dXZ6oMK+ThaSq4irHhbc9dIhGnpu2qiGiDaUCYpBFdqKp5lApDPFc7PzVd5o60gySy6UkuuFIklJFwYVi3UVb8yOe9oQFoTuMpIJo0WAaSCwFWxMvk7Uyc9SiMzHVy2yuQ8sUASC87Py6zrFJJaQquo2hAcokO4i9SyPJsv3t7+B6/qHb4aIAAA"; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE62Z227jNhCG30V7KySZsXy82xZoN0XRBZqiN4IRODbtqLVFV6LbXRh+95I6cWjS8UTOzWJlzf8PRX7DEZVjVMj/ymiWHqO/s3wVzQAncZQvdiKaRU/L4qCvH1dRHB2Krf5luV2UpSjvuzt3r2q31bebGzokOsWtFz4k1kyuH/NcFFesPtkwYhlH+0UhcuWM6UKedSF3P2ViuyqvpXIib8j2pIos33CydZE3ZPvhuxKsR2sDb8mVbR51NCdZG3lDti/iGydVHcbPAw+YdHleOLP38v6ZGyEkNovKdqJUi93+WiYa2DvbUh5yJYov2bVsNPDWbL9KZrYqsHc2HVjI/fdruWxYT/6U5FUxieudiVdVJK53JkZFtUG9c/zy9PW360maqJ5ZlluZi6u8NUE9c4h/Dovt1a2hi+r7JHJngv9gVI8NfMde53fvn4VupwslL3beLuDNXj4EJA+Rl6o4LNmmn1zFm89jx3thCjd1wEUezlKT8I/J+7X4/CKLi/V7Ib1VfdQofhelUD/K4r0T4So/dE56jYYqbxtNLr5xl6UJvS1fmqk6YM7M+twKnvvkHtm2WNZRXdr1IV+qTBfZfXPnzVr2jc6an2dX3w+ZzuNIe+oWMjtG/4qi1Cr9O94N7qY6cl2/Xs/SOl9s9r+dqJraSi4P1X/nTdifwmwPJriOvn+I4vQhxunddDiez+O0FVc3qh9aD/tLJQR9BSEheEJwhKivMCRET4iOcKCvBiHhwBMOHGGir5KQMPGEiSMc6qthSDj0hENHONJXo5Bw5AlHjnCsr8Yh4dgTjh2hxjSdhIQTTzhxhJqgdBoSTj3h1AXA8ABBdsCHB87oqfAJ8xMAyCUIDBcQZAh8iMClCAwbEOQIfJDAJQkMHxBkCXyYwKUJDCMQ5Al8oMAlCgwnEGQKfKjApQoMKxDkCnywwCULDC8QZAt8uMClCwwzEOQLfMDAJQwNMxgkDH3C0CUMDTMYJAx9wvBsj6o2qfAuFdimXMLQMINBwtAnDF3C0DCDQcLQJwxdwtAwg0HC0CcMXcLQMINBwtAnDF3C0DCDQcLQJwxdwkyPTTFIGPqENT9VPVE3QyVWj3Vv1C2t+ahwjJ6bfjlum/AxGut/TifbHfUVaZDmXpW4PuBYB11znYUuK5ZHfaxQ0vGZEJ8J04e80FsnXRGdk4ae51R9JnjNqM/U2kzf47J1n4uMBnij6T4kEBcgLsBzaU6JxISsNvCW23zresk2mXlbskZD6zPk25yzl1iXhO3SvMzR5SarzbZ5Nd8brAdhmIew8Sib91VrM7A2A5aNPReS5yFLjbylbm1ksajPd8SNTg9vfs7cltWpiDiSdUPewlnHwpz6PEcyb8ibuPYM49iQVUTeMtYnMGJByEYe2nKd1X8rIHVGyozl0Z2kyEhIrSKvVhuXjf3WQoZENjPg7WaNXbaiPmQz4+1ljYtfK0j2e+Tt9+RDtfUhNkwX6W9oQAgEHoFKnu0hQOoCeHWh5F+lPqpSEwIg8ABU0p9cIFUPjKrXLwv7bC+2me7ts3R+Ov0PH0GRdJMbAAA="; \ No newline at end of file diff --git a/docs/assets/style.css b/docs/assets/style.css index 778b949..178bfb0 100644 --- a/docs/assets/style.css +++ b/docs/assets/style.css @@ -4,12 +4,19 @@ --light-color-background-secondary: #eff0f1; --light-color-warning-text: #222; --light-color-background-warning: #e6e600; - --light-color-icon-background: var(--light-color-background); --light-color-accent: #c5c7c9; --light-color-active-menu-item: var(--light-color-accent); --light-color-text: #222; --light-color-text-aside: #6e6e6e; + + --light-color-icon-background: var(--light-color-background); + --light-color-icon-text: var(--light-color-text); + + --light-color-comment-tag-text: var(--light-color-text); + --light-color-comment-tag: var(--light-color-background); + --light-color-link: #1f70c2; + --light-color-focus-outline: #3584e4; --light-color-ts-keyword: #056bd6; --light-color-ts-project: #b111c9; @@ -21,20 +28,22 @@ --light-color-ts-function: #572be7; --light-color-ts-class: #1f70c2; --light-color-ts-interface: #108024; - --light-color-ts-constructor: var(--light-color-ts-class); - --light-color-ts-property: var(--light-color-ts-variable); - --light-color-ts-method: var(--light-color-ts-function); + --light-color-ts-constructor: #4d7fff; + --light-color-ts-property: #ff984d; + --light-color-ts-method: #ff4db8; + --light-color-ts-reference: #ff4d82; --light-color-ts-call-signature: var(--light-color-ts-method); --light-color-ts-index-signature: var(--light-color-ts-property); --light-color-ts-constructor-signature: var(--light-color-ts-constructor); --light-color-ts-parameter: var(--light-color-ts-variable); /* type literal not included as links will never be generated to it */ --light-color-ts-type-parameter: #a55c0e; - --light-color-ts-accessor: var(--light-color-ts-property); + --light-color-ts-accessor: #ff4d4d; --light-color-ts-get-signature: var(--light-color-ts-accessor); --light-color-ts-set-signature: var(--light-color-ts-accessor); --light-color-ts-type-alias: #d51270; /* reference not included as links will be colored with the kind that it points to */ + --light-color-document: #000000; --light-external-icon: url("data:image/svg+xml;utf8,"); --light-color-scheme: light; @@ -44,12 +53,19 @@ --dark-color-background-secondary: #1e2024; --dark-color-background-warning: #bebe00; --dark-color-warning-text: #222; - --dark-color-icon-background: var(--dark-color-background-secondary); --dark-color-accent: #9096a2; --dark-color-active-menu-item: #5d5d6a; --dark-color-text: #f5f5f5; --dark-color-text-aside: #dddddd; + + --dark-color-icon-background: var(--dark-color-background-secondary); + --dark-color-icon-text: var(--dark-color-text); + + --dark-color-comment-tag-text: var(--dark-color-text); + --dark-color-comment-tag: var(--dark-color-background); + --dark-color-link: #00aff4; + --dark-color-focus-outline: #4c97f2; --dark-color-ts-keyword: #3399ff; --dark-color-ts-project: #e358ff; @@ -61,20 +77,22 @@ --dark-color-ts-function: #a280ff; --dark-color-ts-class: #8ac4ff; --dark-color-ts-interface: #6cff87; - --dark-color-ts-constructor: var(--dark-color-ts-class); - --dark-color-ts-property: var(--dark-color-ts-variable); - --dark-color-ts-method: var(--dark-color-ts-function); + --dark-color-ts-constructor: #4d7fff; + --dark-color-ts-property: #ff984d; + --dark-color-ts-method: #ff4db8; + --dark-color-ts-reference: #ff4d82; --dark-color-ts-call-signature: var(--dark-color-ts-method); --dark-color-ts-index-signature: var(--dark-color-ts-property); --dark-color-ts-constructor-signature: var(--dark-color-ts-constructor); --dark-color-ts-parameter: var(--dark-color-ts-variable); /* type literal not included as links will never be generated to it */ --dark-color-ts-type-parameter: #e07d13; - --dark-color-ts-accessor: var(--dark-color-ts-property); + --dark-color-ts-accessor: #ff4d4d; --dark-color-ts-get-signature: var(--dark-color-ts-accessor); --dark-color-ts-set-signature: var(--dark-color-ts-accessor); --dark-color-ts-type-alias: #ff6492; /* reference not included as links will be colored with the kind that it points to */ + --dark-color-document: #ffffff; --dark-external-icon: url("data:image/svg+xml;utf8,"); --dark-color-scheme: dark; @@ -86,14 +104,22 @@ --color-background-secondary: var(--light-color-background-secondary); --color-background-warning: var(--light-color-background-warning); --color-warning-text: var(--light-color-warning-text); - --color-icon-background: var(--light-color-icon-background); --color-accent: var(--light-color-accent); --color-active-menu-item: var(--light-color-active-menu-item); --color-text: var(--light-color-text); --color-text-aside: var(--light-color-text-aside); + + --color-icon-background: var(--light-color-icon-background); + --color-icon-text: var(--light-color-icon-text); + + --color-comment-tag-text: var(--light-color-text); + --color-comment-tag: var(--light-color-background); + --color-link: var(--light-color-link); + --color-focus-outline: var(--light-color-focus-outline); --color-ts-keyword: var(--light-color-ts-keyword); + --color-ts-project: var(--light-color-ts-project); --color-ts-module: var(--light-color-ts-module); --color-ts-namespace: var(--light-color-ts-namespace); --color-ts-enum: var(--light-color-ts-enum); @@ -105,6 +131,7 @@ --color-ts-constructor: var(--light-color-ts-constructor); --color-ts-property: var(--light-color-ts-property); --color-ts-method: var(--light-color-ts-method); + --color-ts-reference: var(--light-color-ts-reference); --color-ts-call-signature: var(--light-color-ts-call-signature); --color-ts-index-signature: var(--light-color-ts-index-signature); --color-ts-constructor-signature: var( @@ -116,6 +143,7 @@ --color-ts-get-signature: var(--light-color-ts-get-signature); --color-ts-set-signature: var(--light-color-ts-set-signature); --color-ts-type-alias: var(--light-color-ts-type-alias); + --color-document: var(--light-color-document); --external-icon: var(--light-external-icon); --color-scheme: var(--light-color-scheme); @@ -128,14 +156,22 @@ --color-background-secondary: var(--dark-color-background-secondary); --color-background-warning: var(--dark-color-background-warning); --color-warning-text: var(--dark-color-warning-text); - --color-icon-background: var(--dark-color-icon-background); --color-accent: var(--dark-color-accent); --color-active-menu-item: var(--dark-color-active-menu-item); --color-text: var(--dark-color-text); --color-text-aside: var(--dark-color-text-aside); + + --color-icon-background: var(--dark-color-icon-background); + --color-icon-text: var(--dark-color-icon-text); + + --color-comment-tag-text: var(--dark-color-text); + --color-comment-tag: var(--dark-color-background); + --color-link: var(--dark-color-link); + --color-focus-outline: var(--dark-color-focus-outline); --color-ts-keyword: var(--dark-color-ts-keyword); + --color-ts-project: var(--dark-color-ts-project); --color-ts-module: var(--dark-color-ts-module); --color-ts-namespace: var(--dark-color-ts-namespace); --color-ts-enum: var(--dark-color-ts-enum); @@ -147,6 +183,7 @@ --color-ts-constructor: var(--dark-color-ts-constructor); --color-ts-property: var(--dark-color-ts-property); --color-ts-method: var(--dark-color-ts-method); + --color-ts-reference: var(--dark-color-ts-reference); --color-ts-call-signature: var(--dark-color-ts-call-signature); --color-ts-index-signature: var(--dark-color-ts-index-signature); --color-ts-constructor-signature: var( @@ -158,6 +195,7 @@ --color-ts-get-signature: var(--dark-color-ts-get-signature); --color-ts-set-signature: var(--dark-color-ts-set-signature); --color-ts-type-alias: var(--dark-color-ts-type-alias); + --color-document: var(--dark-color-document); --external-icon: var(--dark-external-icon); --color-scheme: var(--dark-color-scheme); @@ -182,9 +220,16 @@ body { --color-active-menu-item: var(--light-color-active-menu-item); --color-text: var(--light-color-text); --color-text-aside: var(--light-color-text-aside); + --color-icon-text: var(--light-color-icon-text); + + --color-comment-tag-text: var(--light-color-text); + --color-comment-tag: var(--light-color-background); + --color-link: var(--light-color-link); + --color-focus-outline: var(--light-color-focus-outline); --color-ts-keyword: var(--light-color-ts-keyword); + --color-ts-project: var(--light-color-ts-project); --color-ts-module: var(--light-color-ts-module); --color-ts-namespace: var(--light-color-ts-namespace); --color-ts-enum: var(--light-color-ts-enum); @@ -196,6 +241,7 @@ body { --color-ts-constructor: var(--light-color-ts-constructor); --color-ts-property: var(--light-color-ts-property); --color-ts-method: var(--light-color-ts-method); + --color-ts-reference: var(--light-color-ts-reference); --color-ts-call-signature: var(--light-color-ts-call-signature); --color-ts-index-signature: var(--light-color-ts-index-signature); --color-ts-constructor-signature: var( @@ -207,6 +253,7 @@ body { --color-ts-get-signature: var(--light-color-ts-get-signature); --color-ts-set-signature: var(--light-color-ts-set-signature); --color-ts-type-alias: var(--light-color-ts-type-alias); + --color-document: var(--light-color-document); --external-icon: var(--light-external-icon); --color-scheme: var(--light-color-scheme); @@ -222,9 +269,16 @@ body { --color-active-menu-item: var(--dark-color-active-menu-item); --color-text: var(--dark-color-text); --color-text-aside: var(--dark-color-text-aside); + --color-icon-text: var(--dark-color-icon-text); + + --color-comment-tag-text: var(--dark-color-text); + --color-comment-tag: var(--dark-color-background); + --color-link: var(--dark-color-link); + --color-focus-outline: var(--dark-color-focus-outline); --color-ts-keyword: var(--dark-color-ts-keyword); + --color-ts-project: var(--dark-color-ts-project); --color-ts-module: var(--dark-color-ts-module); --color-ts-namespace: var(--dark-color-ts-namespace); --color-ts-enum: var(--dark-color-ts-enum); @@ -236,6 +290,7 @@ body { --color-ts-constructor: var(--dark-color-ts-constructor); --color-ts-property: var(--dark-color-ts-property); --color-ts-method: var(--dark-color-ts-method); + --color-ts-reference: var(--dark-color-ts-reference); --color-ts-call-signature: var(--dark-color-ts-call-signature); --color-ts-index-signature: var(--dark-color-ts-index-signature); --color-ts-constructor-signature: var( @@ -247,11 +302,17 @@ body { --color-ts-get-signature: var(--dark-color-ts-get-signature); --color-ts-set-signature: var(--dark-color-ts-set-signature); --color-ts-type-alias: var(--dark-color-ts-type-alias); + --color-document: var(--dark-color-document); --external-icon: var(--dark-external-icon); --color-scheme: var(--dark-color-scheme); } +*:focus-visible, +.tsd-accordion-summary:focus-visible svg { + outline: 2px solid var(--color-focus-outline); +} + .always-visible, .always-visible .tsd-signatures { display: inherit !important; @@ -266,16 +327,6 @@ h6 { line-height: 1.2; } -h1 > a:not(.link), -h2 > a:not(.link), -h3 > a:not(.link), -h4 > a:not(.link), -h5 > a:not(.link), -h6 > a:not(.link) { - text-decoration: none; - color: var(--color-text); -} - h1 { font-size: 1.875rem; margin: 0.67rem 0; @@ -306,10 +357,6 @@ h6 { margin: 2.33rem 0; } -.uppercase { - text-transform: uppercase; -} - dl, menu, ol, @@ -333,7 +380,7 @@ footer { padding-bottom: 1rem; max-height: 3.5rem; } -.tsd-generator { +footer > p { margin: 0 1em; } @@ -421,6 +468,9 @@ a.external[target="_blank"] { background-repeat: no-repeat; padding-right: 13px; } +a.tsd-anchor-link { + color: var(--color-text); +} code, pre { @@ -433,7 +483,6 @@ pre { pre { position: relative; - white-space: pre; white-space: pre-wrap; word-wrap: break-word; padding: 10px; @@ -580,13 +629,13 @@ dl.tsd-comment-tag-group p { } .tsd-filter-input { display: flex; - width: fit-content; width: -moz-fit-content; + width: fit-content; align-items: center; - user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; + user-select: none; cursor: pointer; } .tsd-filter-input input[type="checkbox"] { @@ -609,11 +658,8 @@ dl.tsd-comment-tag-group p { Don't remove unless you know what you're doing. */ opacity: 0.99; } -.tsd-filter-input input[type="checkbox"]:focus + svg { - transform: scale(0.95); -} -.tsd-filter-input input[type="checkbox"]:focus:not(:focus-visible) + svg { - transform: scale(1); +.tsd-filter-input input[type="checkbox"]:focus-visible + svg { + outline: 2px solid var(--color-focus-outline); } .tsd-checkbox-background { fill: var(--color-accent); @@ -630,13 +676,18 @@ input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { stroke: var(--color-accent); } -.tsd-theme-toggle { - padding-top: 0.75rem; +.settings-label { + font-weight: bold; + text-transform: uppercase; + display: inline-block; } -.tsd-theme-toggle > h4 { - display: inline; - vertical-align: middle; - margin-right: 0.75rem; + +.tsd-filter-visibility .settings-label { + margin: 0.75rem 0 0.5rem 0; +} + +.tsd-theme-toggle .settings-label { + margin: 0.75rem 0.75rem 0 0; } .tsd-hierarchy { @@ -769,6 +820,9 @@ input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { padding: 0; max-width: 100%; } +.tsd-navigation .tsd-nav-link { + display: none; +} .tsd-nested-navigation { margin-left: 3rem; } @@ -782,6 +836,15 @@ input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { margin-left: -1.5rem; } +.tsd-page-navigation-section { + margin-left: 10px; +} +.tsd-page-navigation-section > summary { + padding: 0.25rem; +} +.tsd-page-navigation-section > div { + margin-left: 20px; +} .tsd-page-navigation ul { padding-left: 1.75rem; } @@ -812,10 +875,10 @@ a.tsd-index-link { } .tsd-accordion-summary, .tsd-accordion-summary a { - user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; + user-select: none; cursor: pointer; } @@ -828,8 +891,9 @@ a.tsd-index-link { padding-top: 0; padding-bottom: 0; } -.tsd-index-accordion .tsd-accordion-summary > svg { +.tsd-accordion .tsd-accordion-summary > svg { margin-left: 0.25rem; + vertical-align: text-top; } .tsd-index-content > :not(:first-child) { margin-top: 0.75rem; @@ -839,6 +903,12 @@ a.tsd-index-link { margin-bottom: 0.75rem; } +.tsd-no-select { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} .tsd-kind-icon { margin-right: 0.5rem; width: 1.25rem; @@ -846,10 +916,6 @@ a.tsd-index-link { min-width: 1.25rem; min-height: 1.25rem; } -.tsd-kind-icon path { - transform-origin: center; - transform: scale(1.1); -} .tsd-signature > .tsd-kind-icon { margin-right: 0.8rem; } @@ -877,7 +943,7 @@ a.tsd-index-link { } .tsd-panel-group { - margin: 4rem 0; + margin: 2rem 0; } .tsd-panel-group.tsd-index-group { margin: 2rem 0; @@ -885,6 +951,9 @@ a.tsd-index-link { .tsd-panel-group.tsd-index-group details { margin: 2rem 0; } +.tsd-panel-group > .tsd-accordion-summary { + margin-bottom: 1rem; +} #tsd-search { transition: background-color 0.2s; @@ -1034,6 +1103,12 @@ a.tsd-index-link { border-width: 1px 0; transition: background-color 0.1s; } +.tsd-signatures .tsd-index-signature:not(:last-child) { + margin-bottom: 1em; +} +.tsd-signatures .tsd-index-signature .tsd-signature { + border-width: 1px; +} .tsd-description .tsd-signatures .tsd-signature { border-width: 1px; } @@ -1212,6 +1287,9 @@ img { .tsd-kind-method { color: var(--color-ts-method); } +.tsd-kind-reference { + color: var(--color-ts-reference); +} .tsd-kind-call-signature { color: var(--color-ts-call-signature); } @@ -1224,9 +1302,6 @@ img { .tsd-kind-parameter { color: var(--color-ts-parameter); } -.tsd-kind-type-literal { - color: var(--color-ts-type-literal); -} .tsd-kind-type-parameter { color: var(--color-ts-type-parameter); } @@ -1347,6 +1422,12 @@ img { .has-menu .tsd-navigation { max-height: 100%; } + #tsd-toolbar-links { + display: none; + } + .tsd-navigation .tsd-nav-link { + display: flex; + } } /* one sidebar */ @@ -1399,7 +1480,7 @@ img { } .site-menu { - margin-top: 1rem 0; + margin-top: 1rem; } .page-menu, diff --git a/docs/classes/Scru128Generator.html b/docs/classes/Scru128Generator.html index 81c2797..de1288f 100644 --- a/docs/classes/Scru128Generator.html +++ b/docs/classes/Scru128Generator.html @@ -1,8 +1,9 @@ -Scru128Generator | scru128

Class Scru128Generator

Represents a SCRU128 ID generator that encapsulates the monotonic counters +Scru128Generator | scru128

ClassScru128Generator

Represents a SCRU128 ID generator that encapsulates the monotonic counters and other internal states.

-

Example

import { Scru128Generator } from "scru128";

const g = new Scru128Generator();
const x = g.generate();
console.log(String(x));
console.log(x.toBigInt()); -
-

Remarks

The generator comes with four different methods that generate a SCRU128 ID:

+
import { Scru128Generator } from "scru128";

const g = new Scru128Generator();
const x = g.generate();
console.log(String(x));
console.log(x.toBigInt()); +
+ +

The generator comes with four different methods that generate a SCRU128 ID:

@@ -11,7 +12,8 @@

Remarks

The generator comes with four different methods that generate

- + + @@ -31,10 +33,11 @@

Remarks

The generator comes with four different methods that generate

-
On big clock rewind
generate Now Resets generatorArgument Returns undefined
+ +

All of the four return a monotonically increasing ID by reusing the previous timestamp even if the one provided is smaller than the immediately -preceding ID's. However, when such a clock rollback is considered significant +preceding ID's. However, when such a clock rollback is considered significant (by default, more than ten seconds):

  1. generate (OrReset) methods reset the generator and return a new ID based @@ -42,49 +45,44 @@

    Remarks

    The generator comes with four different methods that generate

  2. OrAbort variants abort and return undefined immediately.

The Core functions offer low-level primitives to customize the behavior.

-

Constructors

  • Creates a generator object with the default random number generator, or +

Constructors

  • Creates a generator object with the default random number generator, or with the specified one if passed as an argument. The specified random number generator should be cryptographically strong and securely seeded.

    -

    Parameters

    • Optional randomNumberGenerator: {
          nextUint32(): number;
      }
      • nextUint32:function
        • Returns a 32-bit random unsigned integer.

          -

          Returns number

    Returns Scru128Generator

Properties

counterHi: number = 0
counterLo: number = 0
rng: {
    nextUint32(): number;
}

The random number generator used by the generator.

-

Type declaration

  • nextUint32:function
timestamp: number = 0
tsCounterHi: number = 0

The timestamp at the last renewal of counter_hi field.

-

Methods

  • Returns an infinite iterator object that produces a new ID for each call of +

    Parameters

    • OptionalrandomNumberGenerator: {
          nextUint32(): number;
      }
      • nextUint32:function
        • Returns a 32-bit random unsigned integer.

          +

          Returns number

    Returns Scru128Generator

Methods

  • Returns an infinite iterator object that produces a new ID for each call of next().

    -

    Returns Iterator<Scru128Id, undefined, undefined>

    Example

    import { Scru128Generator } from "scru128";

    const [a, b, c] = new Scru128Generator();
    console.log(String(a)); // e.g., "038mqr9e14cjc12dh9amw7i5o"
    console.log(String(b)); // e.g., "038mqr9e14cjc12dh9dtpwfr3"
    console.log(String(c)); // e.g., "038mqr9e14cjc12dh9e6rjmqi" -
    -
  • Generates a new SCRU128 ID object from the current timestamp, or resets +

    Returns Iterator<Scru128Id, undefined, any>

    import { Scru128Generator } from "scru128";

    const [a, b, c] = new Scru128Generator();
    console.log(String(a)); // e.g., "038mqr9e14cjc12dh9amw7i5o"
    console.log(String(b)); // e.g., "038mqr9e14cjc12dh9dtpwfr3"
    console.log(String(c)); // e.g., "038mqr9e14cjc12dh9e6rjmqi" +
    + +
  • Generates a new SCRU128 ID object from the current timestamp, or resets the generator upon significant timestamp rollback.

    See the Scru128Generator class documentation for the description.

    -

    Returns Scru128Id

  • Generates a new SCRU128 ID object from the current timestamp, or returns +

    Returns Scru128Id

  • Generates a new SCRU128 ID object from the current timestamp, or returns undefined upon significant timestamp rollback.

    See the Scru128Generator class documentation for the description.

    -

    Returns undefined | Scru128Id

    Example

    import { Scru128Generator } from "scru128";

    const g = new Scru128Generator();
    const x = g.generateOrAbort();
    const y = g.generateOrAbort();
    if (y === undefined) {
    throw new Error("The clock went backwards by ten seconds!");
    }
    console.assert(x.compareTo(y) < 0); -
    -
  • Generates a new SCRU128 ID object from the timestamp passed, or returns +

    Returns undefined | Scru128Id

    import { Scru128Generator } from "scru128";

    const g = new Scru128Generator();
    const x = g.generateOrAbort();
    const y = g.generateOrAbort();
    if (y === undefined) {
    throw new Error("The clock went backwards by ten seconds!");
    }
    console.assert(x.compareTo(y) < 0); +
    + +
  • Generates a new SCRU128 ID object from the timestamp passed, or returns undefined upon significant timestamp rollback.

    See the Scru128Generator class documentation for the description.

    Parameters

    • timestamp: number
    • rollbackAllowance: number

      The amount of timestamp rollback that is considered significant. A suggested value is 10_000 (milliseconds).

      -

    Returns undefined | Scru128Id

    Throws

    RangeError if timestamp is not a 48-bit positive integer.

    -
  • Generates a new SCRU128 ID object from the timestamp passed, or resets +

Returns undefined | Scru128Id

RangeError if timestamp is not a 48-bit positive integer.

+
  • Generates a new SCRU128 ID object from the timestamp passed, or resets the generator upon significant timestamp rollback.

    See the Scru128Generator class documentation for the description.

    Parameters

    • timestamp: number
    • rollbackAllowance: number

      The amount of timestamp rollback that is considered significant. A suggested value is 10_000 (milliseconds).

      -

    Returns Scru128Id

    Throws

    RangeError if timestamp is not a 48-bit positive integer.

    -
  • Returns a new SCRU128 ID object for each call, infinitely.

    -

    This method wraps the result of generate in an IteratorResult +

Returns Scru128Id

RangeError if timestamp is not a 48-bit positive integer.

+
  • Returns a new SCRU128 ID object for each call, infinitely.

    +

    This method wraps the result of generate in an IteratorResult object to use this as an infinite iterator.

    -

    Returns IteratorResult<Scru128Id, undefined>

\ No newline at end of file +

Returns IteratorResult<Scru128Id, undefined>

diff --git a/docs/classes/Scru128Id.html b/docs/classes/Scru128Id.html index eaa5f20..83fd986 100644 --- a/docs/classes/Scru128Id.html +++ b/docs/classes/Scru128Id.html @@ -1,17 +1,16 @@ -Scru128Id | scru128

Class Scru128Id

Represents a SCRU128 ID and provides converters and comparison operators.

-

Example

import { Scru128Id } from "scru128";

const x = Scru128Id.fromString("036z968fu2tugy7svkfznewkk");
console.log(String(x));

const y = Scru128Id.fromBigInt(0x017fa1de51a80fd992f9e8cc2d5eb88en);
console.log(y.toBigInt()); -
-

Conversion

toBigInt +Scru128Id | scru128

ClassScru128Id

Represents a SCRU128 ID and provides converters and comparison operators.

+
import { Scru128Id } from "scru128";

const x = Scru128Id.fromString("036z968fu2tugy7svkfznewkk");
console.log(String(x));

const y = Scru128Id.fromBigInt(0x017fa1de51a80fd992f9e8cc2d5eb88en);
console.log(y.toBigInt()); +
+ +

Conversion

  • Returns the 128-bit unsigned integer representation.

    -

    Returns bigint

  • Returns the 128-bit unsigned integer representation as a 32-digit +

Conversion

  • Returns the 128-bit unsigned integer representation.

    +

    Returns bigint

  • Returns the 128-bit unsigned integer representation as a 32-digit hexadecimal string prefixed with "0x".

    -

    Returns string

  • Returns the 25-digit canonical string representation.

    -

    Returns string

  • Creates an object from a 128-bit unsigned integer.

    -

    Parameters

    • value: bigint

    Returns Scru128Id

    Throws

    RangeError if the argument is out of the range of 128-bit unsigned +

    Returns string

  • Returns the 25-digit canonical string representation.

    +

    Returns string

  • Creates an object from a 128-bit unsigned integer.

    +

    Parameters

    • value: bigint

    Returns Scru128Id

    RangeError if the argument is out of the range of 128-bit unsigned integer.

    -
  • Creates an object from a byte array representing either a 128-bit unsigned +

  • Creates an object from a byte array representing either a 128-bit unsigned integer or a 25-digit Base36 string.

    This method shallow-copies the content of the argument, so the created object holds another instance of the byte array.

    Parameters

    • value: ArrayLike<number>

      An array of 16 bytes that contains a 128-bit unsigned integer in the big-endian (network) byte order or an array of 25 ASCII code points that reads a 25-digit Base36 string.

      -

    Returns Scru128Id

    Throws

    SyntaxError if conversion fails.

    -
  • Creates an object from an array of Base36 digit values representing a -25-digit string representation.

    -

    Parameters

    • src: ArrayLike<number>

    Returns Scru128Id

    Throws

    SyntaxError if the argument does not contain a valid string -representation.

    -
  • Creates an object from field values.

    +

Returns Scru128Id

SyntaxError if conversion fails.

+
  • Creates an object from field values.

    Parameters

    • timestamp: number

      A 48-bit timestamp field value.

    • counterHi: number

      A 24-bit counter_hi field value.

    • counterLo: number

      A 24-bit counter_lo field value.

    • entropy: number

      A 32-bit entropy field value.

      -

    Returns Scru128Id

    Throws

    RangeError if any argument is out of the value range of the field.

    -
  • Creates an object from a 128-bit unsigned integer encoded in a hexadecimal +

Returns Scru128Id

RangeError if any argument is out of the value range of the field.

+
  • Creates an object from a 128-bit unsigned integer encoded in a hexadecimal string.

    -

    Parameters

    • value: string

    Returns Scru128Id

    Throws

    SyntaxError if the argument is not a hexadecimal string encoding a +

    Parameters

    • value: string

    Returns Scru128Id

    SyntaxError if the argument is not a hexadecimal string encoding a 128-bit unsigned integer.

    -
  • Creates an object from a 25-digit string representation.

    -

    Parameters

    • value: string

    Returns Scru128Id

    Throws

    SyntaxError if the argument is not a valid string representation.

    -

Other

  • Creates an object from a 16-byte byte array.

    -

    Parameters

    • bytes: Readonly<Uint8Array>

    Returns Scru128Id

bytes: Readonly<Uint8Array>

A 16-byte byte array containing the 128-bit unsigned integer representation +

  • Creates an object from a 25-digit string representation.

    +

    Parameters

    • value: string

    Returns Scru128Id

    SyntaxError if the argument is not a valid string representation.

    +

Other

bytes: Readonly<Uint8Array>

A 16-byte byte array containing the 128-bit unsigned integer representation in the big-endian (network) byte order.

-
  • get counterHi(): number
  • Returns the 24-bit counter_hi field value.

    -

    Returns number

  • get counterLo(): number
  • Returns the 24-bit counter_lo field value.

    -

    Returns number

  • get entropy(): number
  • Returns the 32-bit entropy field value.

    -

    Returns number

  • get timestamp(): number
  • Returns the 48-bit timestamp field value.

    -

    Returns number

  • get counterHi(): number
  • Returns the 24-bit counter_hi field value.

    +

    Returns number

  • get counterLo(): number
  • Returns the 24-bit counter_lo field value.

    +

    Returns number

  • get entropy(): number
  • Returns the 32-bit entropy field value.

    +

    Returns number

  • get timestamp(): number
  • Returns the 48-bit timestamp field value.

    +

    Returns number

  • Creates an object from this.

    Note that this class is designed to be immutable, and thus clone() is not necessary unless properties marked as private are modified directly.

    -

    Returns Scru128Id

  • Returns a negative integer, zero, or positive integer if this is less +

    Returns Scru128Id

  • Returns a negative integer, zero, or positive integer if this is less than, equal to, or greater than other, respectively.

    -

    Parameters

    Returns number

  • Returns true if this is equivalent to other.

    -

    Parameters

    Returns boolean

  • Returns a part of bytes as an unsigned integer.

    -

    Parameters

    • beginIndex: number
    • endIndex: number

    Returns number

  • Represents this in JSON as a 25-digit canonical string.

    -

    Returns string

  • Creates an object from the internal representation, a 16-byte byte array +

    Parameters

    Returns number

  • Returns true if this is equivalent to other.

    +

    Parameters

    Returns boolean

  • Represents this in JSON as a 25-digit canonical string.

    +

    Returns string

  • Creates an object from the internal representation, a 16-byte byte array containing the 128-bit unsigned integer representation in the big-endian (network) byte order.

    This method does NOT shallow-copy the argument, and thus the created object holds the reference to the underlying buffer.

    -

    Parameters

    • bytes: Uint8Array

    Returns Scru128Id

    Throws

    TypeError if the length of the argument is not 16.

    -
\ No newline at end of file +

Parameters

  • bytes: Uint8Array

Returns Scru128Id

TypeError if the length of the argument is not 16.

+
diff --git a/docs/functions/scru128.html b/docs/functions/scru128.html index 1afcf81..3e09789 100644 --- a/docs/functions/scru128.html +++ b/docs/functions/scru128.html @@ -1,2 +1,2 @@ -scru128 | scru128

Function scru128

\ No newline at end of file +scru128 | scru128

Functionscru128

Generates a new SCRU128 ID object using the global generator.

+
diff --git a/docs/functions/scru128String.html b/docs/functions/scru128String.html index db3d123..043d5df 100644 --- a/docs/functions/scru128String.html +++ b/docs/functions/scru128String.html @@ -1,6 +1,7 @@ -scru128String | scru128

Function scru128String

  • Generates a new SCRU128 ID encoded in a string using the global generator.

    +scru128String | scru128

    Functionscru128String

    Generates a new SCRU128 ID encoded in a string using the global generator.

    Use this function to quickly get a new SCRU128 ID as a string.

    -

    Returns string

    The 25-digit canonical string representation.

    -

    Example

    import { scru128String } from "scru128";

    const x = scru128String();
    console.log(x); -
    -
\ No newline at end of file +
import { scru128String } from "scru128";

const x = scru128String();
console.log(x); +
+ +
  • Returns string

    The 25-digit canonical string representation.

    +
diff --git a/docs/index.html b/docs/index.html index f507999..73ae2f7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,8 +1,8 @@ -scru128

scru128

SCRU128: Sortable, Clock and Random number-based Unique identifier

npm -License

-

SCRU128 ID is yet another attempt to supersede UUID for the users who need +scru128

scru128

SCRU128: Sortable, Clock and Random number-based Unique identifier

npm +License

+

SCRU128 ID is yet another attempt to supersede UUID for the users who need decentralized, globally unique time-ordered identifiers. SCRU128 is inspired by -ULID and KSUID and has the following features:

+ULID and KSUID and has the following features:

  • 128-bit unsigned integer type
  • Sortable by generation time (as integer and as text)
  • @@ -11,12 +11,16 @@
  • Up to 281 trillion time-ordered but unpredictable unique IDs per millisecond
  • 80-bit three-layer randomness for global uniqueness
-
import { scru128, scru128String } from "scru128";
// or on browsers:
// import { scru128, scru128String } from "https://unpkg.com/scru128@^3";

// generate a new identifier object
const x = scru128();
console.log(String(x)); // e.g., "036z951mhjikzik2gsl81gr7l"
console.log(x.toBigInt()); // as a 128-bit unsigned integer

// generate a textual representation directly
console.log(scru128String()); // e.g., "036z951mhzx67t63mq9xe6q0j" -
-

See SCRU128 Specification for details.

-

License

Licensed under the Apache License, Version 2.0.

-

See also

    -
  • API Documentation
  • -
  • Run tests on your browser
  • +
    import { scru128, scru128String } from "scru128";
    // or on browsers:
    // import { scru128, scru128String } from "https://unpkg.com/scru128@^3";

    // generate a new identifier object
    const x = scru128();
    console.log(String(x)); // e.g., "036z951mhjikzik2gsl81gr7l"
    console.log(x.toBigInt()); // as a 128-bit unsigned integer

    // generate a textual representation directly
    console.log(scru128String()); // e.g., "036z951mhzx67t63mq9xe6q0j" +
    + +

    See SCRU128 Specification for details.

    +

    The CommonJS entry point is deprecated and provided for backward compatibility +purposes only. The entry point is no longer tested and will be removed in the +future.

    +

    Licensed under the Apache License, Version 2.0.

    + -
\ No newline at end of file +
diff --git a/docs/modules.html b/docs/modules.html index 239038a..4123257 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -1,8 +1,9 @@ -scru128

scru128

SCRU128: Sortable, Clock and Random number-based Unique identifier

-

Example

import { scru128, scru128String } from "scru128";
// or on browsers:
// import { scru128, scru128String } from "https://unpkg.com/scru128@^3";

// generate a new identifier object
const x = scru128();
console.log(String(x)); // e.g., "036z951mhjikzik2gsl81gr7l"
console.log(x.toBigInt()); // as a 128-bit unsigned integer

// generate a textual representation directly
console.log(scru128String()); // e.g., "036z951mhzx67t63mq9xe6q0j" -
-

Index

Classes

Scru128Generator +scru128

scru128

SCRU128: Sortable, Clock and Random number-based Unique identifier

+
import { scru128, scru128String } from "scru128";
// or on browsers:
// import { scru128, scru128String } from "https://unpkg.com/scru128@^3";

// generate a new identifier object
const x = scru128();
console.log(String(x)); // e.g., "036z951mhjikzik2gsl81gr7l"
console.log(x.toBigInt()); // as a 128-bit unsigned integer

// generate a textual representation directly
console.log(scru128String()); // e.g., "036z951mhzx67t63mq9xe6q0j" +
+ +

Index

Classes

Functions

\ No newline at end of file +
diff --git a/package-lock.json b/package-lock.json index 7cdbdf3..31f2579 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,23 +1,113 @@ { "name": "scru128", - "version": "3.0.5", + "version": "3.0.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "scru128", - "version": "3.0.5", + "version": "3.0.6", "license": "Apache-2.0", "devDependencies": { - "mocha": "^10.4.0", - "typedoc": "^0.25.13", - "typescript": "^5.4.5" + "mocha": "^10.7.3", + "typedoc": "^0.26.9", + "typescript": "^5.6.3" } }, + "node_modules/@shikijs/core": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.22.0.tgz", + "integrity": "sha512-S8sMe4q71TJAW+qG93s5VaiihujRK6rqDFqBnxqvga/3LvqHEnxqBIOPkt//IdXVtHkQWKu4nOQNk0uBGicU7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/engine-javascript": "1.22.0", + "@shikijs/engine-oniguruma": "1.22.0", + "@shikijs/types": "1.22.0", + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4", + "hast-util-to-html": "^9.0.3" + } + }, + "node_modules/@shikijs/engine-javascript": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.22.0.tgz", + "integrity": "sha512-AeEtF4Gcck2dwBqCFUKYfsCq0s+eEbCEbkUuFou53NZ0sTGnJnJ/05KHQFZxpii5HMXbocV9URYVowOP2wH5kw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "1.22.0", + "@shikijs/vscode-textmate": "^9.3.0", + "oniguruma-to-js": "0.4.3" + } + }, + "node_modules/@shikijs/engine-oniguruma": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.22.0.tgz", + "integrity": "sha512-5iBVjhu/DYs1HB0BKsRRFipRrD7rqjxlWTj4F2Pf+nQSPqc3kcyqFFeZXnBMzDf0HdqaFVvhDRAGiYNvyLP+Mw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "1.22.0", + "@shikijs/vscode-textmate": "^9.3.0" + } + }, + "node_modules/@shikijs/types": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.22.0.tgz", + "integrity": "sha512-Fw/Nr7FGFhlQqHfxzZY8Cwtwk5E9nKDUgeLjZgt3UuhcM3yJR9xj3ZGNravZZok8XmEZMiYkSMTPlPkULB8nww==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-9.3.0.tgz", + "integrity": "sha512-jn7/7ky30idSkd/O5yDBfAnVt+JJpepofP/POZ1iMOxK59cOfqIgg/Dj0eFsjOTMw+4ycJN0uhZH/Eb0bs/EUA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true, + "license": "ISC" + }, "node_modules/ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", "dev": true, "license": "MIT", "engines": { @@ -34,13 +124,6 @@ "node": ">=8" } }, - "node_modules/ansi-sequence-parser": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz", - "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", - "dev": true, - "license": "MIT" - }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -141,6 +224,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -171,17 +265,33 @@ "node": ">=8" } }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], "license": "MIT", "dependencies": { "anymatch": "~3.1.2", @@ -195,6 +305,9 @@ "engines": { "node": ">= 8.10.0" }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, "optionalDependencies": { "fsevents": "~2.3.2" } @@ -231,14 +344,25 @@ "dev": true, "license": "MIT" }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -249,13 +373,6 @@ } } }, - "node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true, - "license": "MIT" - }, "node_modules/decamelize": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", @@ -269,10 +386,34 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", "dev": true, "license": "BSD-3-Clause", "engines": { @@ -286,10 +427,23 @@ "dev": true, "license": "MIT" }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/escalade": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", - "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, "license": "MIT", "engines": { @@ -425,6 +579,44 @@ "node": ">=8" } }, + "node_modules/hast-util-to-html": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.3.tgz", + "integrity": "sha512-M17uBDzMJ9RPCqLMO92gNNUDuBSq10a25SDBI08iCCxmorf4Yy6sYHK57n9WAbRAAaU+DuR4W6GN9K4DFZesYg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-whitespace": "^3.0.0", + "html-void-elements": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "stringify-entities": "^4.0.0", + "zwitch": "^2.0.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -435,6 +627,17 @@ "he": "bin/he" } }, + "node_modules/html-void-elements": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", + "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -546,12 +749,15 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/jsonc-parser": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", - "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", + "node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "dependencies": { + "uc.micro": "^2.0.0" + } }, "node_modules/locate-path": { "version": "6.0.0", @@ -593,23 +799,151 @@ "dev": true, "license": "MIT" }, - "node_modules/marked": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", - "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", "dev": true, "license": "MIT", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, "bin": { - "marked": "bin/marked.js" + "markdown-it": "bin/markdown-it.mjs" + } + }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz", + "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" }, - "engines": { - "node": ">= 12" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "dev": true, + "license": "MIT" + }, + "node_modules/micromark-util-character": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.0.tgz", + "integrity": "sha512-KvOVV+X1yLBfs9dCBSopq/+G1PcgT3lAK07mC4BzXi5E7ahzMAF8oIupDDJ6mievI6F+lAATkbQQlQixJfT3aQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.0.tgz", + "integrity": "sha512-pS+ROfCXAGLWCOc8egcBvT0kf27GoWMqtdarNfDcjb6YLuV5cM3ioG45Ys2qOVqeqSbjaKg72vU+Wby3eddPsA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.0.tgz", + "integrity": "sha512-WhYv5UEcZrbAtlsnPuChHUAsu/iBPOVaEVsntLBIdpibO0ddy8OzavZz3iL2xVvBZOpolujSliP65Kq0/7KIYw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" } }, + "node_modules/micromark-util-symbol": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.0.tgz", + "integrity": "sha512-8JZt9ElZ5kyTnO94muPxIGS8oyElRJaiJO8EzV6ZSyGQ1Is8xwl4Q45qU5UOg+bGH4AikWziz0iN4sFLWs8PGw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.0.tgz", + "integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, "node_modules/minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dev": true, "license": "ISC", "dependencies": { @@ -620,32 +954,32 @@ } }, "node_modules/mocha": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.4.0.tgz", - "integrity": "sha512-eqhGB8JKapEYcC4ytX/xrzKforgEc3j1pGlAXVy3eRwrtAy5/nIfT1SvgGzfN0XZZxeLq0aQWkOUAmqIJiv+bA==", + "version": "10.7.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.7.3.tgz", + "integrity": "sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==", "dev": true, "license": "MIT", "dependencies": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.4", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "8.1.0", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "5.0.1", - "ms": "2.1.3", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "workerpool": "6.2.1", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" + "ansi-colors": "^4.1.3", + "browser-stdout": "^1.3.1", + "chokidar": "^3.5.3", + "debug": "^4.3.5", + "diff": "^5.2.0", + "escape-string-regexp": "^4.0.0", + "find-up": "^5.0.0", + "glob": "^8.1.0", + "he": "^1.2.0", + "js-yaml": "^4.1.0", + "log-symbols": "^4.1.0", + "minimatch": "^5.1.6", + "ms": "^2.1.3", + "serialize-javascript": "^6.0.2", + "strip-json-comments": "^3.1.1", + "supports-color": "^8.1.1", + "workerpool": "^6.5.1", + "yargs": "^16.2.0", + "yargs-parser": "^20.2.9", + "yargs-unparser": "^2.0.0" }, "bin": { "_mocha": "bin/_mocha", @@ -682,6 +1016,19 @@ "wrappy": "1" } }, + "node_modules/oniguruma-to-js": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/oniguruma-to-js/-/oniguruma-to-js-0.4.3.tgz", + "integrity": "sha512-X0jWUcAlxORhOqqBREgPMgnshB7ZGYszBNspP+tS9hPD3l13CdaXcHbgImoHUHlrvGx/7AvFEkTRhAGYh+jzjQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "regex": "^4.3.2" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -737,6 +1084,27 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/property-information": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.5.0.tgz", + "integrity": "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -760,6 +1128,13 @@ "node": ">=8.10.0" } }, + "node_modules/regex": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/regex/-/regex-4.3.3.tgz", + "integrity": "sha512-r/AadFO7owAq1QJVeZ/nq9jNS1vyZt+6t1p/E59B56Rn2GCya+gr1KSyOzNL/er+r+B7phv5jG2xU2Nz1YkmJg==", + "dev": true, + "license": "MIT" + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -792,9 +1167,9 @@ "license": "MIT" }, "node_modules/serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -802,16 +1177,29 @@ } }, "node_modules/shiki": { - "version": "0.14.7", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.7.tgz", - "integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==", + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.22.0.tgz", + "integrity": "sha512-/t5LlhNs+UOKQCYBtl5ZsH/Vclz73GIqT2yQsCBygr8L/ppTdmpL4w3kPLoZJbMKVWtoG77Ue1feOjZfDxvMkw==", "dev": true, "license": "MIT", "dependencies": { - "ansi-sequence-parser": "^1.1.0", - "jsonc-parser": "^3.2.0", - "vscode-oniguruma": "^1.7.0", - "vscode-textmate": "^8.0.0" + "@shikijs/core": "1.22.0", + "@shikijs/engine-javascript": "1.22.0", + "@shikijs/engine-oniguruma": "1.22.0", + "@shikijs/types": "1.22.0", + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4" + } + }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, "node_modules/string-width": { @@ -829,6 +1217,21 @@ "node": ">=8" } }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "dev": true, + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -884,32 +1287,44 @@ "node": ">=8.0" } }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/typedoc": { - "version": "0.25.13", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.13.tgz", - "integrity": "sha512-pQqiwiJ+Z4pigfOnnysObszLiU3mVLWAExSPf+Mu06G/qsc3wzbuM56SZQvONhHLncLUhYzOVkjFFpFfL5AzhQ==", + "version": "0.26.9", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.9.tgz", + "integrity": "sha512-Rc7QpWL7EtmrT8yxV0GmhOR6xHgFnnhphbD9Suti3fz3um7ZOrou6q/g9d6+zC5PssTLZmjaW4Upmzv8T1rCcQ==", "dev": true, "license": "Apache-2.0", "dependencies": { "lunr": "^2.3.9", - "marked": "^4.3.0", - "minimatch": "^9.0.3", - "shiki": "^0.14.7" + "markdown-it": "^14.1.0", + "minimatch": "^9.0.5", + "shiki": "^1.16.2", + "yaml": "^2.5.1" }, "bin": { "typedoc": "bin/typedoc" }, "engines": { - "node": ">= 16" + "node": ">= 18" }, "peerDependencies": { - "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x" + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x" } }, "node_modules/typedoc/node_modules/minimatch": { - "version": "9.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", - "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, "license": "ISC", "dependencies": { @@ -923,9 +1338,9 @@ } }, "node_modules/typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -936,24 +1351,120 @@ "node": ">=14.17" } }, - "node_modules/vscode-oniguruma": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", - "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", "dev": true, "license": "MIT" }, - "node_modules/vscode-textmate": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", - "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", + "node_modules/unist-util-is": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", "dev": true, - "license": "MIT" + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", + "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, "node_modules/workerpool": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", - "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", + "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==", "dev": true, "license": "Apache-2.0" }, @@ -992,6 +1503,19 @@ "node": ">=10" } }, + "node_modules/yaml": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz", + "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==", + "dev": true, + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -1012,9 +1536,9 @@ } }, "node_modules/yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dev": true, "license": "ISC", "engines": { @@ -1049,6 +1573,17 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } } } } diff --git a/package.json b/package.json index 37552e1..25ea3ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scru128", - "version": "3.0.5", + "version": "3.0.6", "description": "SCRU128: Sortable, Clock and Random number-based Unique identifier", "type": "module", "main": "dist/index.js", @@ -40,8 +40,8 @@ }, "homepage": "https://github.com/scru128/javascript#readme", "devDependencies": { - "mocha": "^10.4.0", - "typedoc": "^0.25.13", - "typescript": "^5.4.5" + "mocha": "^10.7.3", + "typedoc": "^0.26.9", + "typescript": "^5.6.3" } }