{"version":3,"file":"swim-util.mjs","sources":["../main/Random.ts","../main/ByteOrder.ts","../main/Murmur3.ts","../main/Lazy.ts","../main/Equals.ts","../main/HashCode.ts","../main/Equivalent.ts","../main/Compare.ts","../main/Identity.ts","../main/Booleans.ts","../main/Numbers.ts","../main/Strings.ts","../main/Identifiers.ts","../main/Functions.ts","../main/Constructors.ts","../main/Arrays.ts","../main/Objects.ts","../main/Values.ts","../main/Like.ts","../main/Creatable.ts","../main/Observable.ts","../main/Consumable.ts","../main/Cursor.ts","../main/Mapping.ts","../main/Domain.ts","../main/Range.ts","../main/Interpolate.ts","../main/Interpolator.ts","../main/Timing.ts","../main/Easing.ts","../main/Tweening.ts","../main/Scale.ts","../main/LinearDomain.ts","../main/LinearRange.ts","../main/LinearScale.ts","../main/Assert.ts","../main/Severity.ts"],"sourcesContent":["// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/** @public */\nexport const Random = {\n  fillBytes: (function () {\n    if (typeof window !== \"undefined\" && window.crypto !== void 0) {\n      return function (array: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array): void {\n        window.crypto.getRandomValues(array);\n      };\n    } else if (typeof window !== \"undefined\" && (window as any).msCrypto !== void 0) {\n      return function (array: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array): void {\n        ((window as any).msCrypto as Crypto).getRandomValues(array);\n      };\n    }\n    return function (array: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array): void {\n      if (array instanceof Int8Array) {\n        for (let i = 0; i < array.length; i += 1) {\n          array[i] = 128 - Math.round(Math.random() * 256);\n        }\n      } else if (array instanceof Uint8Array) {\n        for (let i = 0; i < array.length; i += 1) {\n          array[i] = Math.round(Math.random() * 256);\n        }\n      } else if (array instanceof Int16Array) {\n        for (let i = 0; i < array.length; i += 1) {\n          array[i] = 32768 - Math.round(Math.random() * 65536);\n        }\n      } else if (array instanceof Uint16Array) {\n        for (let i = 0; i < array.length; i += 1) {\n          array[i] = Math.round(Math.random() * 65536);\n        }\n      } else if (array instanceof Int32Array) {\n        for (let i = 0; i < array.length; i += 1) {\n          array[i] = 2147483648 - Math.round(Math.random() * 4294967296);\n        }\n      } else if (array instanceof Uint32Array) {\n        for (let i = 0; i < array.length; i += 1) {\n          array[i] = Math.round(Math.random() * 4294967296);\n        }\n      } else {\n        throw new TypeError(\"\" + array);\n      }\n    };\n  })(),\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Endianness of multi-byte words.\n * @public\n */\nexport type ByteOrder = \"BE\" | \"LE\";\n\n/** @public */\nexport const ByteOrder = {\n  /**\n   * The `ByteOrder` where the most significant byte comes first.\n   */\n  get BigEndian(): ByteOrder {\n    return \"BE\";\n  },\n\n  /**\n   * The `ByteOrder` where the least significant byte comes first.\n   */\n  get LittleEndian(): ByteOrder {\n    return \"LE\";\n  },\n\n  /**\n   * Memoized `NativeOrder`.\n   * @internal\n   */\n  NativeEndian: void 0 as ByteOrder | undefined,\n\n  /**\n   * The `ByteOrder` of the host machine.\n   */\n  get NativeOrder(): ByteOrder {\n    if (this.NativeEndian === void 0) {\n      const bom = new ArrayBuffer(2);\n      new Uint16Array(bom)[0] = 0xfeff;\n      const b = new Uint8Array(bom);\n      if (b[0] === 0xfe && b[1] === 0xff) {\n        this.NativeEndian = this.BigEndian;\n      } else if (b[0] === 0xff && b[1] === 0xfe) {\n        this.NativeEndian = this.LittleEndian;\n      } else {\n        throw new Error();\n      }\n    }\n    return this.NativeEndian;\n  }\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {ByteOrder} from \"./ByteOrder\";\nimport {Strings} from \"./\"; // forward import\n\n/**\n * 32-bit [MurmurHash](https://en.wikipedia.org/wiki/MurmurHash) algorithm,\n * version 3.\n * @public\n */\nexport const Murmur3 = {\n  /**\n   * Mixes a new hash `value` into the accumulated hash `code`,\n   * and returns the accumulated hash value.\n   */\n  mix(code: number, value: number): number {\n    value = ((value & 0xffff) * 0xcc9e2d51) + (((value >>> 16) * 0xcc9e2d51 & 0xffff) << 16) & 0xffffffff;\n    value = this.rotl(value, 15);\n    value = ((value & 0xffff) * 0x1b873593) + (((value >>> 16) * 0x1b873593 & 0xffff) << 16) & 0xffffffff;\n    code ^= value;\n    code = this.rotl(code, 13);\n    code = ((code & 0xffff) * 5) + (((code >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;\n    code = ((code & 0xffff) + 0x6b64) + (((code >>> 16) + 0xe654 & 0xffff) << 16);\n    return code;\n  },\n\n  /**\n   * Mixes each consecutive 4-byte word of `array` into `code`,\n   * and returns the accumulated hash value.\n   */\n  mixUint8Array(code: number, array: Uint8Array): number {\n    if (ByteOrder.NativeOrder === ByteOrder.BigEndian) {\n      return this.mixUint8ArrayBE(code, array);\n    } else if (ByteOrder.NativeOrder === ByteOrder.LittleEndian) {\n      return this.mixUInt8ArrayLE(code, array);\n    }\n    throw new Error();\n  },\n\n  /** @internal */\n  mixUint8ArrayBE(code: number, array: Uint8Array): number {\n    let offset = 0;\n    const limit = array.length;\n    while (offset + 3 < limit) {\n      const word = (array[offset    ]! & 0xff) << 24 | (array[offset + 1]! & 0xff) << 16\n                 | (array[offset + 2]! & 0xff) <<  8 |  array[offset + 3]! & 0xff;\n      code = this.mix(code, word);\n      offset += 4;\n    }\n    if (offset < limit) {\n      let word = (array[offset]! & 0xff) << 24;\n      if (offset + 1 < limit) {\n        word |= (array[offset + 1]! & 0xff) << 16;\n        if (offset + 2 < limit) {\n          word |= (array[offset + 2]! & 0xff) << 8;\n          //assert offset + 3 === limit;\n        }\n      }\n      word = ((word & 0xffff) * 0xcc9e2d51) + (((word >>> 16) * 0xcc9e2d51 & 0xffff) << 16) & 0xffffffff;\n      word = this.rotl(word, 15);\n      word = ((word & 0xffff) * 0x1b873593) + (((word >>> 16) * 0x1b873593 & 0xffff) << 16) & 0xffffffff;\n      code ^= word;\n    }\n    return code ^ limit;\n  },\n\n  /** @internal */\n  mixUInt8ArrayLE(code: number, array: Uint8Array): number {\n    let offset = 0;\n    const limit = array.length;\n    while (offset + 3 < limit) {\n      const word =  array[offset    ]! & 0xff        | (array[offset + 1]! & 0xff) <<  8\n                 | (array[offset + 2]! & 0xff) << 16 | (array[offset + 3]! & 0xff) << 24;\n      code = this.mix(code, word);\n      offset += 4;\n    }\n    if (offset < limit) {\n      let word = array[offset]! & 0xff;\n      if (offset + 1 < limit) {\n        word |= (array[offset + 1]! & 0xff) << 8;\n        if (offset + 2 < limit) {\n          word |= (array[offset + 2]! & 0xff) << 16;\n          //assert offset + 3 === limit;\n        }\n      }\n      word = ((word & 0xffff) * 0xcc9e2d51) + (((word >>> 16) * 0xcc9e2d51 & 0xffff) << 16) & 0xffffffff;\n      word = this.rotl(word, 15);\n      word = ((word & 0xffff) * 0x1b873593) + (((word >>> 16) * 0x1b873593 & 0xffff) << 16) & 0xffffffff;\n      code ^= word;\n    }\n    return code ^ limit;\n  },\n\n  /**\n   * Mixes each consecutive 4-byte word of the UTF-8 encoding of `string`\n   * into `code`, and returns the accumulated hash value.\n   */\n  mixString(code: number, string: string): number {\n    if (ByteOrder.NativeOrder === ByteOrder.BigEndian) {\n      return this.mixStringBE(code, string);\n    } else if (ByteOrder.NativeOrder === ByteOrder.LittleEndian) {\n      return this.mixStringLE(code, string);\n    }\n    throw new Error();\n  },\n\n  /** @internal */\n  mixStringBE(code: number, string: string): number {\n    let word = 0;\n    let k = 32;\n    let i = 0;\n    const n = string.length;\n    let utf8Length = 0;\n    while (i < n) {\n      let c = string.codePointAt(i);\n      if (c === void 0) {\n        c = string.charCodeAt(i);\n      }\n      if (c >= 0 && c <= 0x7f) { // U+0000..U+007F\n        k -= 8;\n        word |= c << k;\n        if (k === 0) { code = this.mix(code, word); word = 0; k = 32; }\n        utf8Length += 1;\n      } else if (c >= 0x80 && c <= 0x7ff) { // U+0080..U+07FF\n        k -= 8;\n        word |= (0xc0 | (c >>> 6)) << k;\n        if (k === 0) { code = this.mix(code, word); word = 0; k = 32; }\n        k -= 8;\n        word |= (0x80 | (c & 0x3f)) << k;\n        if (k === 0) { code = this.mix(code, word); word = 0; k = 32; }\n        utf8Length += 2;\n      } else if (c >= 0x0800 && c <= 0xffff || // U+0800..U+D7FF\n                 c >= 0xe000 && c <= 0xffff) { // U+E000..U+FFFF\n        k -= 8;\n        word |= (0xe0 | (c  >>> 12)) << k;\n        if (k === 0) { code = this.mix(code, word); word = 0; k = 32; }\n        k -= 8;\n        word |= (0x80 | ((c >>>  6) & 0x3f)) << k;\n        if (k === 0) { code = this.mix(code, word); word = 0; k = 32; }\n        k -= 8;\n        word |= (0x80 | (c & 0x3f)) << k;\n        if (k === 0) { code = this.mix(code, word); word = 0; k = 32; }\n        utf8Length += 3;\n      } else if (c >= 0x10000 && c <= 0x10ffff) { // U+10000..U+10FFFF\n        k -= 8;\n        word |= (0xf0 | (c  >>> 18)) << k;\n        if (k === 0) { code = this.mix(code, word); word = 0; k = 32; }\n        k -= 8;\n        word |= (0x80 | ((c >>> 12) & 0x3f)) << k;\n        if (k === 0) { code = this.mix(code, word); word = 0; k = 32; }\n        k -= 8;\n        word |= (0x80 | ((c >>>  6) & 0x3f)) << k;\n        if (k === 0) { code = this.mix(code, word); word = 0; k = 32; }\n        k -= 8;\n        word |= (0x80 | (c & 0x3f)) << k;\n        if (k === 0) { code = this.mix(code, word); word = 0; k = 32; }\n        utf8Length += 4;\n      } else { // surrogate or invalid code point\n        k -= 8;\n        word |= 0xef << k;\n        if (k === 0) { code = this.mix(code, word); word = 0; k = 32; }\n        k -= 8;\n        word |= 0xbf << k;\n        if (k === 0) { code = this.mix(code, word); word = 0; k = 32; }\n        k -= 8;\n        word |= 0xbd << k;\n        if (k === 0) { code = this.mix(code, word); word = 0; k = 32; }\n        utf8Length += 3;\n      }\n      i = Strings.offsetByCodePoints(string, i, 1);\n    }\n    if (k !== 32) {\n      word = ((word & 0xffff) * 0xcc9e2d51) + (((word >>> 16) * 0xcc9e2d51 & 0xffff) << 16) & 0xffffffff;\n      word = this.rotl(word, 15);\n      word = ((word & 0xffff) * 0x1b873593) + (((word >>> 16) * 0x1b873593 & 0xffff) << 16) & 0xffffffff;\n      code ^= word;\n    }\n    return code ^ utf8Length;\n  },\n\n  /** @internal */\n  mixStringLE(code: number, string: string): number {\n    let word = 0;\n    let k = 0;\n    let i = 0;\n    const n = string.length;\n    let utf8Length = 0;\n    while (i < n) {\n      let c = string.codePointAt(i);\n      if (c === void 0) {\n        c = string.charCodeAt(i);\n      }\n      if (c >= 0 && c <= 0x7f) { // U+0000..U+007F\n        word |= c << k;\n        k += 8;\n        if (k === 32) { code = this.mix(code, word); word = 0; k = 0; }\n        utf8Length += 1;\n      } else if (c >= 0x80 && c <= 0x7ff) { // U+0080..U+07FF\n        word |= (0xc0 | (c >>> 6)) << k;\n        k += 8;\n        if (k === 32) { code = this.mix(code, word); word = 0; k = 0; }\n        word |= (0x80 | (c & 0x3f)) << k;\n        k += 8;\n        if (k === 32) { code = this.mix(code, word); word = 0; k = 0; }\n        utf8Length += 2;\n      } else if (c >= 0x0800 && c <= 0xffff || // U+0800..U+D7FF\n                 c >= 0xe000 && c <= 0xffff) { // U+E000..U+FFFF\n        word |= (0xe0 | (c  >>> 12)) << k;\n        k += 8;\n        if (k === 32) { code = this.mix(code, word); word = 0; k = 0; }\n        word |= (0x80 | ((c >>>  6) & 0x3f)) << k;\n        k += 8;\n        if (k === 32) { code = this.mix(code, word); word = 0; k = 0; }\n        word |= (0x80 | (c & 0x3f)) << k;\n        k += 8;\n        if (k === 32) { code = this.mix(code, word); word = 0; k = 0; }\n        utf8Length += 3;\n      } else if (c >= 0x10000 && c <= 0x10ffff) { // U+10000..U+10FFFF\n        word |= (0xf0 | (c  >>> 18)) << k;\n        k += 8;\n        if (k === 32) { code = this.mix(code, word); word = 0; k = 0; }\n        word |= (0x80 | ((c >>> 12) & 0x3f)) << k;\n        k += 8;\n        if (k === 32) { code = this.mix(code, word); word = 0; k = 0; }\n        word |= (0x80 | ((c >>>  6) & 0x3f)) << k;\n        k += 8;\n        if (k === 32) { code = this.mix(code, word); word = 0; k = 0; }\n        word |= (0x80 | (c & 0x3f)) << k;\n        k += 8;\n        if (k === 32) { code = this.mix(code, word); word = 0; k = 0; }\n        utf8Length += 4;\n      } else { // surrogate or invalid code point\n        word |= 0xef << k;\n        k += 8;\n        if (k === 32) { code = this.mix(code, word); word = 0; k = 0; }\n        word |= 0xbf << k;\n        k += 8;\n        if (k === 32) { code = this.mix(code, word); word = 0; k = 0; }\n        word |= 0xbd << k;\n        k += 8;\n        if (k === 32) { code = this.mix(code, word); word = 0; k = 0; }\n        utf8Length += 3;\n      }\n      i = Strings.offsetByCodePoints(string, i, 1);\n    }\n    if (k !== 32) {\n      word = ((word & 0xffff) * 0xcc9e2d51) + (((word >>> 16) * 0xcc9e2d51 & 0xffff) << 16) & 0xffffffff;\n      word = this.rotl(word, 15);\n      word = ((word & 0xffff) * 0x1b873593) + (((word >>> 16) * 0x1b873593 & 0xffff) << 16) & 0xffffffff;\n      code ^= word;\n    }\n    return code ^ utf8Length;\n  },\n\n  /**\n   * Finalizes the given hash `code`.\n   */\n  mash(code: number): number {\n    code ^= code >>> 16;\n    code = ((code & 0xffff) * 0x85ebca6b) + (((code >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;\n    code ^= code >>> 13;\n    code = ((code & 0xffff) * 0xc2b2ae35) + (((code >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;\n    code ^= code >>> 16;\n    return code >>> 0;\n  },\n\n  /** @internal */\n  rotl(value: number, distance: number): number {\n    return (value << distance) | (value >>> (32 - distance));\n  },\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Decorator that memoizes the computed value of a getter or nullary method.\n * @public\n */\nexport const Lazy: {\n  <F extends () => unknown>(target: F, context?: ClassMethodDecoratorContext<ThisParameterType<F>, F>): F;\n  <T, R>(target: (this: T) => R, context?: ClassGetterDecoratorContext<T, R>): (this: T) => R;\n} = function <T, R>(target: (this: T) => R, context?: ClassMethodDecoratorContext<T, (this: T) => R> | ClassGetterDecoratorContext<T, R>): (this: T) => R {\n  let defined = false;\n  let value: R;\n  return function (this: T): R {\n    if (!defined) {\n      defined = true;\n      value = target.call(this);\n    }\n    return value;\n  };\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Type that implements a universal equality relation.\n * @public\n */\nexport interface Equals {\n  /**\n   * Returns `true` if `this` is equal to `that`, otherwise returns `false`.\n   */\n  equals(that: unknown): boolean;\n}\n\n/** @public */\nexport const Equals = (function () {\n  const Equals = function (x: unknown, y: unknown): boolean {\n    if (Equals[Symbol.hasInstance](x)) {\n      return x.equals(y);\n    }\n    return x === y;\n  } as {\n    /**\n     * Returns `true` if `x` conforms to [[Equals]] and is\n     * [[Equals.equals equal]] to `y`, otherwise returns `x === y`.\n     */\n    (x: unknown, y: unknown): boolean;\n\n    /**\n     * Returns `true` if `instance` appears to conform to the [[Equals]] interface.\n     */\n    [Symbol.hasInstance](instance: unknown): instance is Equals;\n  };\n\n  Object.defineProperty(Equals, Symbol.hasInstance, {\n    value: function (instance: unknown): instance is Equals {\n      if (instance === null || (typeof instance !== \"object\" && typeof instance !== \"function\")) {\n        return false;\n      }\n      return typeof (instance as Equals).equals === \"function\";\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  return Equals;\n})();\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Equals} from \"./Equals\";\n\n/**\n * Type that is convertible to a hash value consistent with its universal\n * equality relation.\n * @public\n */\nexport interface HashCode extends Equals {\n  /**\n   * Returns a 32-bit hash value for this object.\n   */\n  hashCode(): number;\n}\n\n/** @public */\nexport const HashCode = (function () {\n  const HashCode = function (x: HashCode | null | undefined): number {\n    if (x === void 0) {\n      return 0;\n    } else if (x === null) {\n      return 1;\n    }\n    return x.hashCode();\n  } as {\n    /**\n     * Returns the [[HashCode.hashCode hash code]] of `x`, if `x` is an object;\n     * otherwise returns `0` or `1` if `x` is `undefined` or `null`, respectively.\n     */\n    (x: HashCode | null | undefined): number;\n\n    /**\n     * Returns `true` if `instance` appears to conform to the [[HashCode]] interface.\n     */\n    [Symbol.hasInstance](instance: unknown): instance is HashCode;\n  };\n\n  Object.defineProperty(HashCode, Symbol.hasInstance, {\n    value: function (instance: unknown): instance is HashCode {\n      if (instance === null || (typeof instance !== \"object\" && typeof instance !== \"function\")) {\n        return false;\n      }\n      return typeof (instance as HashCode).hashCode === \"function\";\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  return HashCode;\n})();\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Type that implements a universal equivalence relation.\n * @public\n */\nexport interface Equivalent {\n  /**\n   * Returns `true` if `this` is equivalent to `that` within some optionally\n   * specified error tolerance `epsilon`, otherwise returns `false`.\n   */\n  equivalentTo(that: unknown, epsilon?: number): boolean;\n}\n\n/** @public */\nexport const Equivalent = (function () {\n  const Equivalent = function (x:unknown, y: unknown, epsilon?: number): boolean {\n    if (Equivalent[Symbol.hasInstance](x)) {\n      return x.equivalentTo(y, epsilon);\n    }\n    return x === y;\n  } as {\n    /**\n     * Returns `true` if `x` conforms to [[Equivalent]] and is\n     * [[Equivalent.equivalentTo equivalent to]] `y`, otherwise returns `x === y`.\n     */\n    (x: unknown, y: unknown, epsilon?: number): boolean;\n\n    /**\n     * Returns `true` if `instance` appears to conform to the [[Equivalent]] interface.\n     */\n    [Symbol.hasInstance](instance: unknown): instance is Equivalent;\n\n    /**\n     * Default equivalence tolerance.\n     */\n    readonly Epsilon: number;\n  };\n\n  Object.defineProperty(Equivalent, Symbol.hasInstance, {\n    value: function (instance: unknown): instance is Equivalent {\n      if (instance === null || (typeof instance !== \"object\" && typeof instance !== \"function\")) {\n        return false;\n      }\n      return typeof (instance as Equivalent).equivalentTo === \"function\";\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  Object.defineProperty(Equivalent, \"Epsilon\", {\n    value: 1.0e-8,\n    enumerable: true,\n    configurable: true,\n  });\n\n  return Equivalent;\n})();\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/** @public */\nexport type Comparator<T> = (a: T, b: T) => number;\n\n/**\n * Type that implements a universal partial order.\n * @public\n */\nexport interface Compare {\n  /**\n   * Returns the relative order of `this` with respect to `that`. Returns `-1`\n   * if `this` orders before `that`; returns `1` if `this` orders after `that`;\n   * returns `0` if `this` and `that` are equivalent; and returns `NaN` if\n   * `this` is not comparable to `that`.\n   */\n  compareTo(that: unknown): number;\n}\n\n/** @public */\nexport const Compare = (function () {\n  const Compare = function (x: unknown, y: unknown): number {\n    if (x === void 0) {\n      if (y === void 0) {\n        return 0;\n      }\n      return 1;\n    } else if (x === null) {\n      if (y === void 0) {\n        return -1;\n      } else if (y === null) {\n        return 0;\n      }\n      return 1;\n    } else if (typeof (x as Compare).compareTo === \"function\") {\n      if (y === void 0 || y === null) {\n        return -1;\n      }\n      return (x as Compare).compareTo(y);\n    }\n    return NaN;\n  } as {\n    /**\n     * Returns the relative order of `x` with respect to `y`. Returns `-1` if `x`\n     * orders before `y`; returns `1` if `x` orders after `y`; returns `0` if `x`\n     * and `y` are equivalent; and returns `NaN` if `x` is not comparable to `y`.\n     * Objects are [[Compare.compareTo compared to]] each other when both are\n     * defined, otherwise defined objects order before `null`, and `null` orders\n     * before `undefined`.\n     */\n    (x: unknown, y: unknown): number;\n\n    /**\n     * Returns `true` if `instance` appears to conform to the [[Compare]] interface.\n     */\n    [Symbol.hasInstance](instance: unknown): instance is Compare;\n  };\n\n  Object.defineProperty(Compare, Symbol.hasInstance, {\n    value: function (instance: unknown): instance is Compare {\n      if (instance === null || (typeof instance !== \"object\" && typeof instance !== \"function\")) {\n        return false;\n      }\n      return typeof (instance as Compare).compareTo === \"function\";\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  return Compare;\n})();\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Utilities for comparing and hashing object identities.\n * @public\n */\nexport const Identity = {\n  /**\n   * Returns the relative order of `x` with respect to `y`. Returns `-1` if\n   * the hash code of object `x` is less than the hash code of object `y`;\n   * returns `1` if the hash code of object `x` is greater than the hash code\n   * of object `y`; and returns `0` if `x` and `y` are identical objects.\n   * If either `x` or `y` is `null` or `undefined`, then objects order before\n   * `null`, and `null` orders before `undefined`.\n   */\n  compare(x: object | null | undefined, y: object | null | undefined): number {\n    if (x !== null && typeof x === \"object\") {\n      if (y !== null && typeof y === \"object\") {\n        const xh = Identity.hash(x);\n        const yh = Identity.hash(y);\n        return xh < yh ? -1 : xh > yh ? 1 : 0;\n      }\n      return -1;\n    } else if (x === null) {\n      return y === void 0 ? -1 : y === null ? 0 : 1;\n    } else if (x === void 0) {\n      return y === void 0 ? 0 : 1;\n    }\n    return NaN;\n  },\n\n  /**\n   * Returns a unique 32-bit hash value for a particular object instance.\n   */\n  hash: (function () {\n    let codes: WeakMap<object, number> | null = null;\n    let nextCode = 2;\n    return function hash(x: object | null | undefined): number {\n      if (x !== null && typeof x === \"object\") {\n        if (codes === null) {\n          codes = new WeakMap<object, number>();\n        }\n        let hashCode = codes.get(x);\n        if (hashCode === void 0) {\n          hashCode = ~~nextCode;\n          codes.set(x, hashCode);\n          nextCode += 1;\n        }\n        return hashCode;\n      } else if (x === null) {\n        return 1;\n      } else if (x === void 0) {\n        return 0;\n      }\n      throw new TypeError(\"\" + x);\n    };\n  })(),\n\n  fromLike<T>(value: T): T {\n    return value;\n  },\n\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Uninitable} from \"./types\";\n\n/**\n * Utilities for comparing and hashing booleans.\n * @public\n */\nexport const Booleans = {\n  /**\n   * Returns the relative order of `x` with respect to `y`. Returns `-1` if\n   * `x` is `true` and `y` is `false`; returns `1` if `x` is `false` and `y`\n   * is `true`; and returns `0` if `x` and `y` are equal booleans. If either\n   * `x` or `y` is `null` or `undefined`, then booleans order before `null`,\n   * and `null` orders before `undefined`.\n   */\n  compare(x: boolean | null | undefined, y: boolean | null | undefined): number {\n    if (typeof x === \"boolean\") {\n      return typeof y === \"boolean\" ? (x && !y ? -1 : !x && y ? 1 : 0) : -1;\n    } else if (x === null) {\n      return y === void 0 ? -1 : y === null ? 0 : 1;\n    } else if (x === void 0) {\n      return y === void 0 ? 0 : 1;\n    }\n    return NaN;\n  },\n\n  /**\n   * Returns a hash code for a number.\n   */\n  hash(x: boolean | null | undefined): number {\n    if (x === true) {\n      return 3;\n    } else if (x === false) {\n      return 2;\n    } else if (x === null) {\n      return 1;\n    } else if (x === void 0) {\n      return 0;\n    }\n    throw new TypeError(\"\" + x);\n  },\n\n  fromLike<T extends boolean | string | number | null | undefined>(value: T): boolean | Uninitable<T> {\n    if (value === void 0 || value === null) {\n      return value as boolean | Uninitable<T>;\n    }\n    return Boolean(value);\n  },\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Uninitable} from \"./types\";\nimport {Equivalent} from \"./Equivalent\";\n\n/**\n * Utilities for comparing and hashing numbers.\n * @public\n */\nexport const Numbers = {\n  /**\n   * Returns `true` if `x` and `y` are equal numbers, or if both are `NaN`;\n   * otherwise returns `x === y` if either `x` or `y` is not defined.\n   */\n  equal(x: number | null | undefined, y: number | null | undefined): boolean {\n    return x === y || typeof x === \"number\" && typeof y === \"number\" && isNaN(x) && isNaN(y);\n  },\n\n  /**\n   * Returns `true` if `x` and `y` are both defined, and the difference between\n   * the two is less than `epsilon`, or if both are `NaN`; otherwise returns\n   * `x === y` if either `x` or `y` is not defined.\n   */\n  equivalent(x: number | null | undefined, y: number | null | undefined, epsilon?: number): boolean {\n    return x === y || typeof x === \"number\" && typeof y === \"number\" && (isNaN(x) && isNaN(y) || Math.abs(y - x) < (epsilon !== void 0 ? epsilon : Equivalent.Epsilon));\n  },\n\n  /**\n   * Returns the relative order of `x` with respect to `y`. Returns `-1` if\n   * the number `x` less than the number `y`; returns `1` if the number `x` is\n   * greater than the number `y`; and returns `0` if `x` and `y` are equal\n   * numbers, or if both are `NaN`. If either `x` or `y` is `NaN`, `null`,\n   * or `undefined`, then numbers order before `NaN`, `NaN` orders before\n   * `null`, and `null` orders before `undefined`.\n   */\n  compare(x: number | null | undefined, y: number | null | undefined): number {\n    if (typeof x === \"number\") {\n      return typeof y === \"number\" ? (x < y ? -1 : x > y ? 1 : isNaN(y) ? (isNaN(x) ? 0 : -1) : isNaN(x) ? 1 : 0) : -1;\n    } else if (x === null) {\n      return y === void 0 ? -1 : y === null ? 0 : 1;\n    } else if (x === void 0) {\n      return y === void 0 ? 0 : 1;\n    }\n    return NaN;\n  },\n\n  /**\n   * Returns a 32-bit hash value for the number `x`, if defined; otherwise\n   * returns `0` or `1` if `x` is `undefined` or `null`, respectively.\n   */\n  hash: (function () {\n    let hashArrayBuffer: ArrayBuffer | null = null;\n    let hashFloat64Array: Float64Array | null = null;\n    let hashInt32Array: Int32Array | null = null;\n    return function hash(x: number | null | undefined): number {\n      if (typeof x === \"number\") {\n        if (x === ~~x) {\n          return ~~x;\n        } else if (hashArrayBuffer === null) {\n          hashArrayBuffer = new ArrayBuffer(8);\n          hashFloat64Array = new Float64Array(hashArrayBuffer);\n          hashInt32Array = new Int32Array(hashArrayBuffer);\n        }\n        hashFloat64Array![0] = x;\n        return hashInt32Array![0]! ^ hashInt32Array![1]!;\n      } else if (x === null) {\n        return 1;\n      } else if (x === void 0) {\n        return 0;\n      }\n      throw new TypeError(\"\" + x);\n    };\n  })(),\n\n  fromLike<T extends number | string | boolean | null | undefined>(value: T): number | Uninitable<T> {\n    if (value === void 0 || value === null) {\n      return value as number | Uninitable<T>;\n    }\n    return Number(value);\n  },\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Uninitable} from \"./types\";\nimport {Murmur3} from \"./Murmur3\";\n\n/**\n * Utilities for comparing and hashing strings.\n * @public\n */\nexport const Strings = {\n  codePointAt(string: string, index: number): number | undefined {\n    const length = string.length;\n    index = index ? Number(index) : 0; // Coerce to number.\n    if (index !== index) { // Convert NaN to zero.\n      index = 0;\n    }\n    if (index >= 0 && index < length) {\n      const c1 = string.charCodeAt(index);\n      if (c1 <= 0xd7ff || c1 >= 0xe000) { // U+0000..U+D7FF | U+E000..U+FFFF\n        return c1;\n      } else if (c1 <= 0xdbff && index + 1 < length) {\n        const c2 = string.charCodeAt(index + 1);\n        if (c2 >= 0xdc00 && c2 <= 0xdfff) { // U+10000..U+10FFFF\n          return ((c1 & 0x03ff) << 10 + c2 & 0x03ff) + 0x10000;\n        }\n      }\n    }\n    return void 0;\n  },\n\n  offsetByCodePoints(string: string, index: number, count: number): number {\n    if (count > 0) {\n      const length = string.length;\n      while (count > 0 && index < length) {\n        const c1 = string.charCodeAt(index);\n        if (c1 <= 0xd7ff || c1 >= 0xe000) { // U+0000..U+D7FF | U+E000..U+FFFF\n          index += 1;\n        } else if (c1 <= 0xdbff && index + 1 < length) {\n          const c2 = string.charCodeAt(index + 1);\n          if (c2 >= 0xdc00 && c2 <= 0xdfff) { // U+10000..U+10FFFF\n            index += 2;\n          } else {\n            index += 1;\n          }\n        } else {\n          index += 1;\n        }\n        count -= 1;\n      }\n    } else if (count < 0) {\n      while (count < 0 && index > 0) {\n        const c2 = string.charCodeAt(index - 1);\n        if (c2 <= 0xd7ff || c2 >= 0xe000) { // U+0000..U+D7FF | U+E000..U+FFFF\n          index -= 1;\n        } else if (c2 >= 0xdc00 && c2 <= 0xdfff && index - 1 > 0) {\n          const c1 = string.charCodeAt(index - 2);\n          if (c1 >= 0xd800 && c1 <= 0xdfff) { // U+10000..U+10FFFF\n            index -= 2;\n          } else {\n            index -= 1;\n          }\n        } else {\n          index -= 1;\n        }\n        count -= 1;\n      }\n    }\n    return index;\n  },\n\n  /**\n   * Returns the relative order of `x` with respect to `y`. Returns `-1` if\n   * the string `x` lexicographically orders before the string `y`; returns `1`\n   * if the string `x` lexicographically orders after the string `y`; and\n   * returns `0` if `x` and `y` are equal strings. If either `x` or `y` is\n   * `null` or `undefined`, then strings order before `null`, and `null` orders\n   * before `undefined`.\n   */\n  compare(x: string | null | undefined, y: string | null | undefined): number {\n    if (typeof x === \"string\") {\n      return typeof y === \"string\" ? (x < y ? -1 : x > y ? 1 : 0) : -1;\n    } else if (x === null) {\n      return y === void 0 ? -1 : y === null ? 0 : 1;\n    } else if (x === void 0) {\n      return y === void 0 ? 0 : 1;\n    }\n    return NaN;\n  },\n\n  /**\n   * Returns a hash code for a string.\n   */\n  hash(x: string | null | undefined): number {\n    if (typeof x === \"string\") {\n      return Murmur3.mash(Murmur3.mixString(0, x));\n    } else if (x === null) {\n      return 1;\n    } else if (x === void 0) {\n      return 0;\n    }\n    throw new TypeError(\"\" + x);\n  },\n\n  fromLike<T extends string | number | boolean | null | undefined>(value: T): string | Uninitable<T> {\n    if (value === void 0 || value === null) {\n      return value as string | Uninitable<T>;\n    }\n    return String(value);\n  },\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {Strings} from \"./Strings\";\n\n/**\n * Utilities for working with ECMAScript identifiers.\n * @public\n */\nexport const Identifiers = {\n  /** @internal */\n  isStartChar(c: number): boolean {\n    return c >= 65/*'A'*/ && c <= 90/*'Z'*/\n        || c === 95/*'_'*/\n        || c >= 97/*'a'*/ && c <= 122/*'z'*/\n        || c >= 0xc0 && c <= 0xd6\n        || c >= 0xd8 && c <= 0xf6\n        || c >= 0xf8 && c <= 0x2ff\n        || c >= 0x370 && c <= 0x37d\n        || c >= 0x37f && c <= 0x1fff\n        || c >= 0x200c && c <= 0x200d\n        || c >= 0x2070 && c <= 0x218f\n        || c >= 0x2c00 && c <= 0x2fef\n        || c >= 0x3001 && c <= 0xd7ff\n        || c >= 0xf900 && c <= 0xfdcf\n        || c >= 0xfdf0 && c <= 0xfffd\n        || c >= 0x10000 && c <= 0xeffff;\n  },\n\n  /** @internal */\n  isPartChar(c: number): boolean {\n    return c === 45/*'-'*/\n        || c >= 48/*'0'*/ && c <= 57/*'9'*/\n        || c >= 65/*'A'*/ && c <= 90/*'Z'*/\n        || c === 95/*'_'*/\n        || c >= 97/*'a'*/ && c <= 122/*'z'*/\n        || c === 0xb7\n        || c >= 0xc0 && c <= 0xd6\n        || c >= 0xd8 && c <= 0xf6\n        || c >= 0xf8 && c <= 0x37d\n        || c >= 0x37f && c <= 0x1fff\n        || c >= 0x200c && c <= 0x200d\n        || c >= 0x203f && c <= 0x2040\n        || c >= 0x2070 && c <= 0x218f\n        || c >= 0x2c00 && c <= 0x2fef\n        || c >= 0x3001 && c <= 0xd7ff\n        || c >= 0xf900 && c <= 0xfdcf\n        || c >= 0xfdf0 && c <= 0xfffd\n        || c >= 0x10000 && c <= 0xeffff;\n  },\n\n  isValid(identifier: string): boolean {\n    let c: number | undefined;\n    if (identifier.length === 0 || (c = identifier.codePointAt(0)) === void 0 || !this.isStartChar(c)) {\n      return false;\n    }\n    let i = Strings.offsetByCodePoints(identifier, 0, 1);\n    while (i < identifier.length && (c = identifier.codePointAt(0)) !== void 0 && this.isPartChar(c)) {\n      i = Strings.offsetByCodePoints(identifier, i, 1);\n    }\n    return i === identifier.length && !this.isReserved(identifier);\n  },\n\n  isReserved(identifier: string): boolean {\n    switch (identifier) {\n      case \"await\":\n      case \"break\":\n      case \"case\":\n      case \"catch\":\n      case \"class\":\n      case \"const\":\n      case \"continue\":\n      case \"debugger\":\n      case \"default\":\n      case \"delete\":\n      case \"do\":\n      case \"else\":\n      case \"enum\":\n      case \"export\":\n      case \"extends\":\n      case \"false\":\n      case \"finally\":\n      case \"for\":\n      case \"function\":\n      case \"if\":\n      case \"import\":\n      case \"in\":\n      case \"instanceof\":\n      case \"new\":\n      case \"null\":\n      case \"return\":\n      case \"super\":\n      case \"switch\":\n      case \"this\":\n      case \"throw\":\n      case \"true\":\n      case \"try\":\n      case \"typeof\":\n      case \"var\":\n      case \"void\":\n      case \"while\":\n      case \"with\":\n      case \"yield\":\n        return true;\n      default:\n        return false;\n    }\n  },\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Utilities for comparing and hashing functions.\n * @public\n */\nexport const Functions = {\n  /**\n   * Returns the relative order of `x` with respect to `y`. Returns `-1` if\n   * the hash code of function `x` is less than the hash code of function `y`;\n   * returns `1` if the hash code of function `x` is greater than the hash code\n   * of function `y`; and returns `0` if `x` and `y` are identical functions.\n   * If either `x` or `y` is `null` or `undefined`, then functions order before\n   * `null`, and `null` orders before `undefined`.\n   */\n  compare(x: Function | null | undefined, y: Function | null | undefined): number {\n    if (typeof x === \"function\") {\n      if (typeof y === \"function\") {\n        const xh = Functions.hash(x);\n        const yh = Functions.hash(y);\n        return xh < yh ? -1 : xh > yh ? 1 : 0;\n      }\n      return -1;\n    } else if (x === null) {\n      return y === void 0 ? -1 : y === null ? 0 : 1;\n    } else if (x === void 0) {\n      return y === void 0 ? 0 : 1;\n    }\n    return NaN;\n  },\n\n  /**\n   * Returns a 32-bit hash value for a function.\n   */\n  hash: (function () {\n    let codes: WeakMap<Function, number> | null = null;\n    let nextCode = 2;\n    return function hash(x: Function | null | undefined): number {\n      if (typeof x === \"function\") {\n        if (codes === null) {\n          codes = new WeakMap<Function, number>();\n        }\n        let hashCode = codes.get(x);\n        if (hashCode === void 0) {\n          hashCode = ~~nextCode;\n          codes.set(x, hashCode);\n          nextCode += 1;\n        }\n        return hashCode;\n      } else if (x === null) {\n        return 1;\n      } else if (x === void 0) {\n        return 0;\n      }\n      throw new TypeError(\"\" + x);\n    };\n  })(),\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {Murmur3} from \"./Murmur3\";\n\n/**\n * Utilities for comparing and hashing constructors.\n * @public\n */\nexport const Constructors = {\n  /**\n   * Returns the relative order of `x` with respect to `y`. Returns `-1` if\n   * the hash code of constructor `x` is less than the hash code of constructor\n   * `y`; returns `1` if the hash code of constructor `x` is greater than the\n   * hash code of constructor `y`; and returns `0` if `x` and `y` are identical\n   * constructors. If either `x` or `y` is `null` or `undefined`, then\n   * constructors order before `null`, and `null` orders before `undefined`.\n   */\n  compare(x: Function | null | undefined, y: Function | null | undefined): number {\n    if (typeof x === \"function\") {\n      if (typeof y === \"function\") {\n        const xh = Constructors.hash(x);\n        const yh = Constructors.hash(y);\n        return xh < yh ? -1 : xh > yh ? 1 : 0;\n      }\n      return -1;\n    } else if (x === null) {\n      return y === void 0 ? -1 : y === null ? 0 : 1;\n    } else if (x === void 0) {\n      return y === void 0 ? 0 : 1;\n    }\n    return NaN;\n  },\n\n  /**\n   * Returns a 32-bit hash value for a constructor.\n   */\n  hash: (function () {\n    let codes: WeakMap<Function, number> | null = null;\n    return function hash(x: Function | null | undefined): number {\n      if (typeof x === \"function\") {\n        if (codes === null) {\n          codes = new WeakMap<Function, number>();\n        }\n        let hashCode = codes.get(x);\n        if (hashCode === void 0) {\n          hashCode = Murmur3.mash(Murmur3.mixString(0, x.name));\n          codes.set(x, hashCode);\n        }\n        return hashCode;\n      } else if (x === null) {\n        return 1;\n      } else if (x === void 0) {\n        return 0;\n      }\n      throw new TypeError(\"\" + x);\n    };\n  })(),\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {Murmur3} from \"./Murmur3\";\nimport {Lazy} from \"./Lazy\";\nimport {Values} from \"./\"; // forward import\n\n/**\n * Utilities for immutably updating, comparing, and hashing arrays.\n * @public\n */\nexport const Arrays = {\n  empty: Lazy(function <T>(): readonly T[] {\n    return Object.freeze([]);\n  }) as <T>() => readonly T[],\n\n  /**\n   * Returns a copy of an array with the given element inserted, if the element\n   * is not already present in the array; otherwise returns the input array if\n   * it already contains the specified element.\n   */\n  inserted<T>(newElement: T, oldArray: readonly T[] | null | undefined): readonly T[] {\n    const n = oldArray !== void 0 && oldArray !== null ? oldArray.length : 0;\n    const newArray = new Array<T>(n + 1);\n    for (let i = 0; i < n; i += 1) {\n      const element = oldArray![i]!;\n      if (element === newElement) {\n        return oldArray!;\n      }\n      newArray[i] = element;\n    }\n    newArray[n] = newElement;\n    return newArray;\n  },\n\n  /**\n   * Returns a copy of an array with the given element removed; returns the\n   * input array if it does not contain the specified element.\n   */\n  removed<T>(oldElement: T, oldArray: readonly T[] | null | undefined): readonly T[] {\n    const n = oldArray !== void 0 && oldArray !== null ? oldArray.length : 0;\n    if (n === 0) {\n      return oldArray !== void 0 && oldArray !== null ? oldArray : Arrays.empty();\n    } else if (n === 1) {\n      return oldArray![0]! !== oldElement ? oldArray! : Arrays.empty();\n    }\n    const newArray = new Array<T>(n - 1);\n    let i = 0;\n    while (i < n) {\n      const element = oldArray![i]!;\n      if (element === oldElement) {\n        i += 1;\n        while (i < n) {\n          newArray[i - 1] = oldArray![i]!;\n          i += 1;\n        }\n        return newArray;\n      }\n      newArray[i] = element;\n      i += 1;\n    }\n    return oldArray!;\n  },\n\n  /**\n   * Returns `true` if `x` and `y` are structurally equal arrays; otherwise\n   * returns `x === y` if either `x` or `y` is not an array.\n   */\n  equal(x: ArrayLike<unknown> | null | undefined, y: ArrayLike<unknown> | null | undefined): boolean {\n    if (x === y) {\n      return true;\n    } else if (x !== null && typeof x === \"object\" && y !== null && typeof y === \"object\") {\n      const n = x.length;\n      if (n !== y.length) {\n        return false;\n      }\n      for (let i = 0; i < n; i += 1) {\n        if (!Values.equal(x[i], y[i])) {\n          return false;\n        }\n      }\n      return true;\n    }\n    return false;\n  },\n\n  /**\n   * Returns `true` if `x` and `y` are structurally [[Equivalent.equivalentTo\n   * equivalent]] arrays; otherwise returns `x === y` if either `x` or `y` is\n   * not an array.\n   */\n  equivalent(x: ArrayLike<unknown> | null | undefined, y: ArrayLike<unknown> | null | undefined, epsilon?: number): boolean {\n    if (x === y) {\n      return true;\n    } else if (x !== null && typeof x === \"object\" && y !== null && typeof y === \"object\") {\n      const n = x.length;\n      if (n !== y.length) {\n        return false;\n      }\n      for (let i = 0; i < n; i += 1) {\n        if (!Values.equivalent(x[i], y[i], epsilon)) {\n          return false;\n        }\n      }\n      return true;\n    }\n    return false;\n  },\n\n  /**\n   * Returns the relative order of `x` with respect to `y`. Returns `-1` if\n   * the elements of array `x` order lexicographically before the elements of\n   * array `y`; returns `1` if the elements of array `x` order lexicographically\n   * after the elements of array `y`; and returns `0` if `x` and `y` are equal\n   * arrays. If either `x` or `y` is `null` or `undefined`, then arrays order\n   * before `null`, and `null` orders before `undefined`.\n   */\n  compare(x: ArrayLike<unknown> | null | undefined, y: ArrayLike<unknown> | null | undefined): number {\n    if (x !== null && typeof x === \"object\") {\n      if (y !== null && typeof y === \"object\") {\n        if (x === y) {\n          return 0;\n        }\n        const p = x.length;\n        const q = y.length;\n        let order = 0;\n        for (let i = 0, n = Math.min(p, q); i < n && order === 0; i += 1) {\n          order = Values.compare(x[i], y[i]);\n        }\n        return order !== 0 ? order : p > q ? 1 : p < q ? -1 : 0;\n      }\n      return -1;\n    } else if (x === null) {\n      return y === void 0 ? -1 : y === null ? 0 : 1;\n    } else if (x === void 0) {\n      return y === void 0 ? 0 : 1;\n    }\n    return NaN;\n  },\n\n  /**\n   * Returns a 32-bit hash value for the elements of array `x`, if defined;\n   * otherwise returns `0` or `1` if `x` is `undefined` or `null`, respectively.\n   */\n  hash(x: ArrayLike<unknown> | null | undefined): number {\n    if (typeof x === \"object\" && x !== null) {\n      let code = 0;\n      for (let i = 0; i < x.length; i += 1) {\n        code = Murmur3.mix(code, Values.hash(x[i]));\n      }\n      return Murmur3.mash(code);\n    } else if (x === null) {\n      return 1;\n    } else if (x === void 0) {\n      return 0;\n    }\n    throw new TypeError(\"\" + x);\n  },\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {Murmur3} from \"./Murmur3\";\nimport {Strings} from \"./Strings\";\nimport {Values} from \"./\"; // forward import\n\n/**\n * Utilities for comparing and hashing structural objects.\n * @public\n */\nexport const Objects = {\n  /**\n   * Returns `true` if the given object has no own properties.\n   */\n  isEmpty(x: object | null | undefined): boolean {\n    if (x !== null && typeof x === \"object\") {\n      for (const k in x) {\n        if (Object.prototype.hasOwnProperty.call(x, k)) {\n          return false;\n        }\n      }\n    }\n    return true;\n  },\n\n  /**\n   * Returns `true` if `object` has any of the specified `keys`,\n   * as determined by `key in object`. Returns `false` if `object`\n   * is `undefined` or `null`, or if `typeof object` is neither\n   * `\"object\"` nor `\"function\"`, or if none of the specified `keys`\n   * are present in `object`.\n   */\n  hasAnyKey<O>(object: unknown, ...keys: (keyof O)[]): object is O {\n    if (object === null || (typeof object !== \"object\" && typeof object !== \"function\")) {\n      return false;\n    }\n    for (let i = 0; i < keys.length; i += 1) {\n      if (keys[i]! in object) {\n        return true;\n      }\n    }\n    return false;\n  },\n\n  /**\n   * Returns `true` if `object` has all of the specified `keys`,\n   * as determined by `key in object`. Returns `false` if `object`\n   * is `undefined` or `null`, or if `typeof object` is neither\n   * `\"object\"` nor `\"function\"`, or if at least one of specified `keys`\n   * are not present in `object`.\n   */\n  hasAllKeys<O>(object: unknown, ...keys: (keyof O)[]): object is O {\n    if (object === null || (typeof object !== \"object\" && typeof object !== \"function\")) {\n      return false;\n    }\n    for (let i = 0; i < keys.length; i += 1) {\n      if (!(keys[i]! in object)) {\n        return false;\n      }\n    }\n    return true;\n  },\n\n  /**\n   * Returns a shallow copy of `object` with the given `key`-`value` pair\n   * inserted before the `target` entry value, in traversal order.\n   */\n  inserted<O, K extends keyof O>(object: O, key: K, value: O[K], target: unknown): O {\n    let inserted = false;\n    const newObject = {} as O;\n    for (const oldKey in object) {\n      if (Object.prototype.hasOwnProperty.call(object, oldKey)) {\n        const oldValue = object[oldKey]!;\n        if (!inserted && oldValue === target) {\n          newObject[key as keyof O] = value as O[keyof O];\n          inserted = true;\n        }\n        newObject[oldKey] = oldValue;\n      }\n    }\n    if (!inserted) {\n      newObject[key as keyof O] = value as O[keyof O];\n    }\n    return newObject;\n  },\n\n  getFirstKey<O>(object: O): keyof O | undefined {\n    for (const k in object) {\n      if (Object.prototype.hasOwnProperty.call(object, k)) {\n        return k;\n      }\n    }\n    return void 0;\n  },\n\n  getFirstValue<O>(object: O): O[keyof O] | undefined {\n    for (const k in object) {\n      if (Object.prototype.hasOwnProperty.call(object, k)) {\n        return object[k]!;\n      }\n    }\n    return void 0;\n  },\n\n  getNextKey<O>(object: O, key: keyof O): keyof O | undefined {\n    let mark = false;\n    for (const k in object) {\n      if (Object.prototype.hasOwnProperty.call(object, k)) {\n        if (mark) {\n          return k;\n        } else if (k === key) {\n          mark = true;\n        }\n      }\n    }\n    return void 0;\n  },\n\n  getNextValue<O>(object: O, key: keyof O): O[keyof O] | undefined {\n    let mark = false;\n    for (const k in object) {\n      if (Object.prototype.hasOwnProperty.call(object, k)) {\n        if (mark) {\n          return object[k]!;\n        } else if (k === key) {\n          mark = true;\n        }\n      }\n    }\n    return void 0;\n  },\n\n  /**\n   * Returns `true` if `x` and `y` are structurally equal objects; otherwise\n   * returns `x === y` if either `x` or `y` is not an object.\n   */\n  equal(x: object | null | undefined, y: object | null | undefined): boolean {\n    if (x === y) {\n      return true;\n    } else if (x !== null && typeof x === \"object\" && y !== null && typeof y === \"object\") {\n      const xKeys = Object.keys(x);\n      const yKeys = Object.keys(y);\n      const n = xKeys.length;\n      if (n !== yKeys.length) {\n        return false;\n      }\n      for (let i = 0; i < n; i += 1) {\n        const key = xKeys[i]!;\n        if (key !== yKeys[i] || !Values.equal((x as any)[key], (y as any)[key])) {\n          return false;\n        }\n      }\n      return true;\n    }\n    return false;\n  },\n\n  /**\n   * Returns `true` if `x` and `y` are structurally [[Equivalent.equivalentTo\n   * equivalent]] objects; otherwise returns `x === y` if either `x` or `y` is\n   * not an object.\n   */\n  equivalent(x: object | null | undefined, y: object | null | undefined, epsilon?: number): boolean {\n    if (x === y) {\n      return true;\n    } else if (x !== null && typeof x === \"object\" && y !== null && typeof y === \"object\") {\n      const xKeys = Object.keys(x);\n      const yKeys = Object.keys(y);\n      const n = xKeys.length;\n      if (n !== yKeys.length) {\n        return false;\n      }\n      for (let i = 0; i < n; i += 1) {\n        const key = xKeys[i]!;\n        if (key !== yKeys[i] || !Values.equivalent((x as any)[key], (y as any)[key], epsilon)) {\n          return false;\n        }\n      }\n      return true;\n    }\n    return false;\n  },\n\n  /**\n   * Returns the relative order of `x` with respect to `y`. Returns `-1` if\n   * the entries of object `x` order lexicographically before the entries of\n   * object `y`; returns `1` if the entries of object `x` order\n   * lexicographically after the entries of object `y`; and returns `0` if `x`\n   * and `y` are equal objects. If either `x` or `y` is `null` or `undefined`,\n   * then objects order before `null`, and `null` orders before `undefined`.\n   */\n  compare(x: object | null | undefined, y: object | null | undefined): number {\n    if (x !== null && typeof x === \"object\") {\n      if (y !== null && typeof y === \"object\") {\n        if (x === y) {\n          return 0;\n        }\n        const xKeys = Object.keys(x);\n        const yKeys = Object.keys(y);\n        const p = xKeys.length;\n        const q = yKeys.length;\n        const n = Math.min(p, q);\n        let order = 0;\n        for (let i = 0; i < n && order === 0; i += 1) {\n          const xKey = xKeys[i]!;\n          const yKey = yKeys[i]!;\n          order = Strings.compare(xKey, yKey);\n          if (order === 0) {\n            order = Values.compare((x as any)[xKey], (y as any)[yKey]);\n          }\n        }\n        return order !== 0 ? order : p > q ? 1 : p < q ? -1 : 0;\n      }\n      return -1;\n    } else if (x === null) {\n      return y === void 0 ? -1 : y === null ? 0 : 1;\n    } else if (x === void 0) {\n      return y === void 0 ? 0 : 1;\n    }\n    return NaN;\n  },\n\n  /**\n   * Returns a 32-bit hash value for the entries of object `x`, if defined;\n   * otherwise returns `0` or `1` if `x` is `undefined` or `null`, respectively.\n   */\n  hash(x: object | null | undefined): number {\n    if (typeof x === \"object\" && x !== null) {\n      let code = 0;\n      const keys = Object.keys(x);\n      for (let i = 0; i < keys.length; i += 1) {\n        const key = keys[i]!;\n        code = Murmur3.mix(Murmur3.mix(code, Strings.hash(key)), Values.hash((x as any)[key]));\n      }\n      return Murmur3.mash(code);\n    } else if (x === null) {\n      return 1;\n    } else if (x === void 0) {\n      return 0;\n    }\n    throw new TypeError(\"\" + x);\n  },\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {Equals} from \"./Equals\";\nimport {HashCode} from \"./HashCode\";\nimport {Equivalent} from \"./Equivalent\";\nimport {Compare} from \"./Compare\";\nimport {Numbers} from \"./Numbers\";\nimport {Strings} from \"./Strings\";\nimport {Functions} from \"./Functions\";\nimport {Arrays} from \"./Arrays\";\nimport {Objects} from \"./Objects\";\n\n/**\n * Utilities for comparing and hashing structural values. A structural value\n * is typed by object structure, rather than by name.\n * @public\n */\nexport const Values = {\n  /**\n   * Returns `true` if `x` and `y` are structurally equal, otherwise returns `false`.\n   */\n  equal(x: unknown, y: unknown): boolean {\n    if (x instanceof Date) {\n      x = x.getTime();\n    }\n    if (y instanceof Date) {\n      y = y.getTime();\n    }\n\n    if (x === y) {\n      return true;\n    } else if (typeof x === \"number\") {\n      if (typeof y === \"number\") {\n        return isNaN(x) && isNaN(y);\n      }\n    } else if (Equals[Symbol.hasInstance](x)) {\n      return x.equals(y);\n    } else if (Array.isArray(x)) {\n      if (Array.isArray(y)) {\n        return Arrays.equal(x, y);\n      }\n    } else if (x !== null && typeof x === \"object\") {\n      if (y !== null && typeof y === \"object\") {\n        return Objects.equal(x, y);\n      }\n    }\n    return false;\n  },\n\n  /**\n   * Returns `true` if `x` and `y` are structurally equivalent, otherwise returns `false`.\n   */\n  equivalent(x: unknown, y: unknown, epsilon: number = Equivalent.Epsilon): boolean {\n    if (x instanceof Date) {\n      x = x.getTime();\n    }\n    if (y instanceof Date) {\n      y = y.getTime();\n    }\n\n    if (x === y) {\n      return true;\n    } else if (typeof x === \"number\") {\n      if (typeof y === \"number\") {\n        return isNaN(x) && isNaN(y) || Math.abs(y - x) < epsilon;\n      }\n    } else if (Equivalent[Symbol.hasInstance](x)) {\n      return x.equivalentTo(y, epsilon);\n    } else if (Array.isArray(x)) {\n      if (Array.isArray(y)) {\n        return Arrays.equivalent(x, y, epsilon);\n      }\n    } else if (typeof x === \"object\" && x !== null) {\n      if (typeof y === \"object\" && y !== null) {\n        return Objects.equivalent(x, y, epsilon);\n      }\n    }\n    return false;\n  },\n\n  /**\n   * Returns `-1` if `x` orders before `y`; returns `1` if `x` orders after `y`;\n   * returns `0` if `x` and `y` are equivalent; and returns `NaN` if `x` is not\n   * comparable to `y`.\n   */\n  compare(x: unknown, y: unknown): number {\n    if (x instanceof Date) {\n      x = x.getTime();\n    }\n    if (y instanceof Date) {\n      y = y.getTime();\n    }\n\n    if (x === void 0) {\n      if (y === void 0) {\n        return 0;\n      }\n      return 1;\n    } else if (x === null) {\n      if (y === void 0) {\n        return -1;\n      } else if (y === null) {\n        return 0;\n      }\n      return 1;\n    } else if (typeof x === \"boolean\") {\n      if (y === void 0 || y === null) {\n        return -1;\n      } else if (typeof y === \"boolean\") {\n        return x && !y ? -1 : !x && y ? 1 : 0;\n      }\n      return 1;\n    } else if (typeof x === \"number\") {\n      if (y === void 0 || y === null || typeof y === \"boolean\") {\n        return -1;\n      } else if (typeof y === \"number\") {\n        return x < y ? -1 : x > y ? 1 : isNaN(y) ? (isNaN(x) ? 0 : -1) : isNaN(x) ? 1 : 0;\n      }\n      return 1;\n    } else if (typeof x === \"string\") {\n      if (y === void 0 || y === null || typeof y === \"boolean\" || typeof y === \"number\") {\n        return -1;\n      } else if (typeof y === \"string\") {\n        return x < y ? -1 : x > y ? 1 : 0;\n      }\n      return 1;\n    } else if (Compare[Symbol.hasInstance](x)) {\n      return x.compareTo(y);\n    } else if (typeof x === \"function\") {\n      if (y === void 0 || y === null || typeof y === \"boolean\" || typeof y === \"number\" || typeof y === \"string\") {\n        return -1;\n      } else if (typeof y === \"function\") {\n        return Functions.compare(x, y);\n      }\n      return 1;\n    } else if (Array.isArray(x)) {\n      if (y === void 0 || y === null || typeof y === \"boolean\" || typeof y === \"number\" || typeof y === \"string\" || typeof y === \"function\") {\n        return -1;\n      } else if (Array.isArray(y)) {\n        return Arrays.compare(x, y);\n      }\n      return 1;\n    } else if (typeof x === \"object\") {\n      if (y === void 0 || y === null || typeof y === \"boolean\" || typeof y === \"number\" || typeof y === \"string\" || typeof y === \"function\" || Array.isArray(y)) {\n        return -1;\n      } else if (typeof y === \"object\") {\n        return Objects.compare(x, y);\n      }\n      return 1;\n    }\n    return NaN;\n  },\n\n  /**\n   * Returns a hash code for a structural value.\n   */\n  hash(x: unknown): number {\n    if (x instanceof Date) {\n      x = x.getTime();\n    }\n\n    if (x === void 0) {\n      return 0;\n    } else if (x === null) {\n      return 1;\n    } else if (x === false) {\n      return 2;\n    } else if (x === true) {\n      return 3;\n    } else if (typeof x === \"number\") {\n      return Numbers.hash(x);\n    } else if (typeof x === \"string\") {\n      return Strings.hash(x);\n    } else if (HashCode[Symbol.hasInstance](x)) {\n      return x.hashCode();\n    } else if (typeof x === \"function\") {\n      return Functions.hash(x);\n    } else if (Array.isArray(x)) {\n      return Arrays.hash(x);\n    } else if (typeof x === \"object\") {\n      return Objects.hash(x);\n    }\n    throw new TypeError(\"\" + x);\n  },\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {Identity} from \"./Identity\";\nimport {Strings} from \"./Strings\";\nimport {Numbers} from \"./Numbers\";\nimport {Booleans} from \"./Booleans\";\nimport {Objects} from \"./Objects\";\n\n/**\n * Associates a type `T` with a loosely typed representation `L`. Loose type\n * representations are modeled as a phantom method `likeType?(like: L): void`\n * whose argument type is the loosely typed representation of `T`. Because the\n * `likeType` method is optional, values of type `T` are assignable to type\n * `Like<T, L>`, and vice versa.\n *\n * The preferred way to associate loose type representations with a custom\n * class is to declare a `likeType?(like: L): void` method on the class itself.\n * The `Like` type is used to inject a phantom `likeType` method into an\n * existing type. This enables ad hoc loose types to be declared without\n * needing to change the declaration of the strict type.\n *\n * @example Ad hoc number coercion\n *\n * ```ts\n * const NumberLike: FromLike<Like<number, string | boolean>> = {\n *   fromLike(value: number | string | boolean): number {\n *     return Number(value);\n *   },\n * };\n *\n * NumberLike.fromLike(\"42\") // yields 42\n * NumberLike.fromLike(true) // yields 1\n * ```\n *\n * @example Using an ad hoc conversion with a `@Property` fastener\n *\n * ```ts\n * class Person {\n *   @Property({valueType: NumberLike})\n *   readonly age!: Property<Like<number, string | boolean>>;\n * }\n *\n * const person = new Person();\n * person.age.setValue(\"42\");\n * person.age.value // yields 42\n * ```\n *\n * @public\n */\nexport type Like<T, L> = T & {likeType?(like: LikeType<T> | L): void};\n\n/**\n * Extracts the loosely typed representation of a type `T`. `LikeType` is used\n * in conjunction with [[FromLike]] to generically convert loosely typed values\n * to strictly typed instances using only a single generic type parameter to\n * track both strict and loose types.\n * @public\n */\nexport type LikeType<T> = T extends {likeType?(like: infer L): any} ? L : never;\n\n/**\n * Conversion from loosely typed values to a strictly typed instances.\n *\n * @example Generic wrapper class\n *\n * Consider the case of implementing a generic wrapper class. Although the\n * wrapper encapsulates a particular concrete type, the API for the wrapper\n * should accept similarly typed values--but not any value. Two generic types\n * are in play here, the strict type being wrapped, and a loose type that's\n * accepted as arguments and internally converted to the strict type. These\n * types are not independent of each other; each strict type has an associated\n * loose type from which it can be converted. To minimize boilerplate, the\n * wrapper class should only need to be parameterized with a single type.\n *\n * These requirements can be cleanly met with a combination of [[Like]] types\n * and `FromLike` conversions. The generic wrapper class described above can\n * be implemented as follows:\n *\n * ```\n * class GenericWrapper<T> {\n *   valueType: FromLike<T>;\n *   value: T;\n *   constructor(valueType: FromLike<T>, value: T) {\n *     this.valueType = valueType;\n *     this.value = value;\n *   }\n *   set(value: T | LikeType<T>): void {\n *     this.value = this.valueType.fromLike(value);\n *   }\n * }\n * ```\n *\n * When no loose type conversions are needed, `GenericWrapper` can be\n * instantiated with an identity `FromLike` converter.\n *\n * ```\n * const greeting = new GenericWrapper(FromLike<string>(), \"\");\n * greeting.set(\"Hello, world!\");\n * greeting.value // yields \"Hello, world!\";\n * ```\n *\n * A `GenericWrapper` parameterized with a `Like` type and accompanying\n * `FromLike` conversion can be set with any like-typed value.\n *\n * ```\n * const NumberLike: FromLike<Like<number, string | boolean>> = {\n *   fromLike(value: number | string | boolean): number {\n *     return Number(value);\n *   },\n * };\n * export const foo = new GenericWrapper(NumberLike, 0);\n * foo.set(\"42\")\n * foo.value // yields 42\n * ```\n *\n * @public\n */\nexport interface FromLike<T> {\n  /**\n   * Coerces a loosely typed `value` to a strictly typed instance.\n   */\n  fromLike(value: T | LikeType<T>): T;\n}\n\n/** @public */\nexport const FromLike = (function () {\n  const FromLike = function <F>(type?: F, value?: F extends {fromLike(value: infer L): any} ? L : unknown): (F extends {fromLike(...args: any): infer T} ? T : unknown) | FromLike<F extends abstract new (...args: any) => infer T ? T : any> {\n    let likeness: FromLike<any>;\n    if (FromLike[Symbol.hasInstance](type)) {\n      likeness = type;\n    } else if (type === String) {\n      likeness = Strings;\n    } else if (type === Number) {\n      likeness = Numbers;\n    } else if (type === Boolean) {\n      likeness = Booleans;\n    } else {\n      likeness = Identity;\n    }\n    if (arguments.length < 2) {\n      return likeness;\n    }\n    return likeness.fromLike(value);\n  } as {\n    /**\n     * Returns the [[FromLike.fromLike fromLike]] conversion of `value` by `type`,\n     * if `type` conforms to the `FromLike` interface; otherwise returns `value` itself.\n     */\n    <F>(type: F, value: F extends {fromLike(value: infer L): any} ? L : any): F extends {fromLike(...args: any): infer T} ? T : any;\n    /**\n     * Returns a [[FromLike]] converter for the given `type`. Returns `type` itself,\n     * if `type` conforms to the `FromLike` interface; returns a primitive converter,\n     * if `type` is the `String`, `Number`, or `Boolean` constructor; otherwise\n     * returns an identity converter.\n     */\n    <F>(type: F): FromLike<F extends abstract new (...args: any) => infer T ? T : any>;\n    /**\n     * Returns an identity [[FromLike]] converter.\n     */\n    <T>(): FromLike<T>;\n\n    /**\n     * Returns `true` if `instance` appears to conform to the [[FromLike]] interface.\n     */\n    [Symbol.hasInstance]<T>(instance: unknown): instance is FromLike<T>\n  };\n\n  Object.defineProperty(FromLike, Symbol.hasInstance, {\n    value: function <T>(instance: unknown): instance is FromLike<T> {\n      return Objects.hasAllKeys<FromLike<T>>(instance, \"fromLike\");\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  return FromLike;\n})();\n\n/**\n * Conversion to loosely typed values from strictly typed instances.\n * @public\n */\nexport interface ToLike<T> {\n  /**\n   * Returns a loosely typed representation of this instance.\n   */\n  toLike(): LikeType<T>;\n}\n\n/** @public */\nexport const ToLike = (function () {\n  const ToLike = function (value: unknown): unknown {\n    if (ToLike[Symbol.hasInstance](value)) {\n      return value.toLike();\n    }\n    return value;\n  } as {\n    /**\n     * Returns the [[ToLike.toLike toLike]] conversion of `value`, if `value`\n     * conforms to the `ToLike` interface; otherwise returns `value` itself.\n     */\n    <T>(value: ToLike<T>): T;\n    (value: any): any;\n\n    /**\n     * Returns `true` if `instance` appears to conform to the [[ToLike]] interface.\n     */\n    [Symbol.hasInstance]<T>(instance: unknown): instance is ToLike<T>\n  };\n\n  Object.defineProperty(ToLike, Symbol.hasInstance, {\n    value: function <T>(instance: unknown): instance is ToLike<T> {\n      return Objects.hasAllKeys<ToLike<T>>(instance, \"toLike\");\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  return ToLike;\n})();\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/** @public */\nexport type Creates<C> =\n  C extends {create(...args: any): infer T} ? T : never;\n\n/** @public */\nexport interface Creatable<T> {\n  create(): T;\n}\n\n/** @public */\nexport const Creatable = {\n  [Symbol.hasInstance]<T>(instance: unknown): instance is Creatable<T> {\n    if (instance === null || (typeof instance !== \"object\" && typeof instance !== \"function\")) {\n      return false;\n    }\n    return typeof (instance as Creatable<T>).create === \"function\";\n  },\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Class} from \"./types\";\nimport type {Observer} from \"./Observer\";\n\n/** @public */\nexport type Observes<O> =\n  O extends {readonly observerType?: Class<infer T>} ? T : {};\n\n/** @public */\nexport interface Observable {\n  readonly observerType?: Class<Observer>;\n\n  observe(observer: Observes<this>): void;\n\n  unobserve(observer: Observes<this>): void;\n}\n\n/** @public */\nexport const Observable = {\n  [Symbol.hasInstance](instance: unknown): instance is Observable {\n    if (instance === null || (typeof instance !== \"object\" && typeof instance !== \"function\")) {\n      return false;\n    }\n    return typeof (instance as Observable).observe === \"function\"\n        && typeof (instance as Observable).unobserve === \"function\";\n  },\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/** @public */\nexport type Consumer = unknown;\n\n/** @public */\nexport interface Consumable {\n  consume(consumer: Consumer): void;\n\n  unconsume(consumer: Consumer): void;\n}\n\n/** @public */\nexport const Consumable = {\n  [Symbol.hasInstance](instance: unknown): instance is Consumable {\n    if (instance === null || (typeof instance !== \"object\" && typeof instance !== \"function\")) {\n      return false;\n    }\n    return typeof (instance as Consumable).consume === \"function\"\n        && typeof (instance as Consumable).unconsume === \"function\";\n  },\n};\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {Lazy} from \"./Lazy\";\n\n/** @public */\nexport abstract class Cursor<T> implements IterableIterator<T> {\n  abstract isEmpty(): boolean;\n\n  abstract head(): T;\n\n  abstract step(): void;\n\n  abstract skip(count: number): void;\n\n  abstract hasNext(): boolean;\n\n  abstract nextIndex(): number;\n\n  abstract next(): IteratorResult<T>;\n\n  abstract hasPrevious(): boolean;\n\n  abstract previousIndex(): number;\n\n  abstract previous(): IteratorResult<T>;\n\n  set(newValue: T): void {\n    throw new Error(\"immutable\");\n  }\n\n  delete(): void {\n    throw new Error(\"immutable\");\n  }\n\n  [Symbol.iterator](): IterableIterator<T> {\n    return this;\n  }\n\n  @Lazy\n  static empty<T>(): Cursor<T> {\n    return new EmptyCursor();\n  }\n\n  static unary<T>(value: T): Cursor<T> {\n    return new UnaryCursor<T>(value);\n  }\n\n  static array<T>(array: readonly T[], index?: number, limit?: number): Cursor<T> {\n    if (index === void 0) {\n      index = 0;\n    }\n    if (limit === void 0) {\n      limit = array.length;\n    }\n    return new ArrayCursor<T>(array, index, limit);\n  }\n\n  static keys<K, V>(cursor: Cursor<[K, V]>): Cursor<K> {\n    return new KeysCursor<K, V>(cursor);\n  }\n\n  static values<K, V>(cursor: Cursor<[K, V]>): Cursor<V> {\n    return new ValuesCursor<K, V>(cursor);\n  }\n}\n\n/** @internal */\nexport class EmptyCursor<T> extends Cursor<T> {\n  override isEmpty(): boolean {\n    return true;\n  }\n\n  override head(): T {\n    throw new Error(\"empty\");\n  }\n\n  override step(): void {\n    throw new Error(\"empty\");\n  }\n\n  override skip(count: number): void {\n    // nop\n  }\n\n  override hasNext(): boolean {\n    return false;\n  }\n\n  override nextIndex(): number {\n    return 0;\n  }\n\n  override next(): IteratorResult<T> {\n    return {done: true, value: void 0};\n  }\n\n  override hasPrevious(): boolean {\n    return false;\n  }\n\n  override previousIndex(): number {\n    return -1;\n  }\n\n  override previous(): IteratorResult<T> {\n    return {done: true, value: void 0};\n  }\n}\n\n/** @internal */\nexport class UnaryCursor<T> extends Cursor<T> {\n  constructor(value: T) {\n    super();\n    this.value = value;\n    this.index = 0;\n  }\n\n  /** @internal */\n  readonly value: T;\n\n  /** @internal */\n  index: number;\n\n  override isEmpty(): boolean {\n    return this.index !== 0;\n  }\n\n  override head(): T {\n    if (this.index !== 0) {\n      throw new Error(\"empty\");\n    }\n    return this.value;\n  }\n\n  override step(): void {\n    if (this.index !== 0) {\n      throw new Error(\"empty\");\n    }\n    this.index = 1;\n  }\n\n  override skip(count: number): void {\n    this.index = Math.min(Math.max(0, this.index + count), 1);\n  }\n\n  override hasNext(): boolean {\n    return this.index === 0;\n  }\n\n  override nextIndex(): number {\n    return this.index;\n  }\n\n  override next(): IteratorResult<T> {\n    if (this.index !== 0) {\n      return {done: true, value: void 0};\n    }\n    this.index = 1;\n    return {done: true, value: this.value};\n  }\n\n  override hasPrevious(): boolean {\n    return this.index === 1;\n  }\n\n  override previousIndex(): number {\n    return this.index - 1;\n  }\n\n  override previous(): IteratorResult<T> {\n    if (this.index !== 1) {\n      return {done: true, value: void 0};\n    }\n    this.index = 0;\n    return {done: true, value: this.value};\n  }\n}\n\n/** @internal */\nexport class ArrayCursor<T> extends Cursor<T> {\n  constructor(array: readonly T[], index: number, limit: number) {\n    super();\n    this.array = array;\n    this.index = index;\n    this.limit = limit;\n  }\n\n  /** @internal */\n  readonly array: readonly T[];\n\n  /** @internal */\n  index: number;\n\n  /** @internal */\n  readonly limit: number;\n\n  override isEmpty(): boolean {\n    return this.index >= this.limit;\n  }\n\n  override head(): T {\n    if (this.index >= this.limit) {\n      throw new Error(\"empty\");\n    }\n    return this.array[this.index]!;\n  }\n\n  override step(): void {\n    const index = this.index;\n    if (index >= this.limit) {\n      throw new Error(\"empty\");\n    }\n    this.index += 1;\n  }\n\n  override skip(count: number): void {\n    this.index = Math.min(this.index + count, this.limit);\n  }\n\n  override hasNext(): boolean {\n    return this.index < this.limit;\n  }\n\n  override nextIndex(): number {\n    return this.index;\n  }\n\n  override next(): IteratorResult<T> {\n    const index = this.index;\n    if (index >= this.limit) {\n      this.index = this.limit;\n      return {done: true, value: void 0};\n    }\n    this.index += 1;\n    return {done: this.index === this.limit, value: this.array[index]!};\n  }\n\n  override hasPrevious(): boolean {\n    return this.index > 0;\n  }\n\n  override previousIndex(): number {\n    return this.index - 1;\n  }\n\n  override previous(): IteratorResult<T> {\n    const index = this.index - 1;\n    if (index < 0) {\n      this.index = 0;\n      return {done: true, value: void 0};\n    }\n    this.index = index;\n    return {done: index === 0, value: this.array[index]!};\n  }\n}\n\n/** @internal */\nexport class KeysCursor<K, V> extends Cursor<K> {\n  constructor(cursor: Cursor<[K, V]>) {\n    super();\n    this.cursor = cursor;\n  }\n\n  /** @internal */\n  readonly cursor: Cursor<[K, V]>;\n\n  override isEmpty(): boolean {\n    return this.cursor.isEmpty();\n  }\n\n  override head(): K {\n    return this.cursor.head()[0];\n  }\n\n  override step(): void {\n    this.cursor.step();\n  }\n\n  override skip(count: number): void {\n    this.cursor.skip(count);\n  }\n\n  override hasNext(): boolean {\n    return this.cursor.hasNext();\n  }\n\n  override nextIndex(): number {\n    return this.cursor.nextIndex();\n  }\n\n  override next(): IteratorResult<K> {\n    const next = this.cursor.next();\n    return {done: next.done, value: next.value !== void 0 ? next.value[0] : void 0};\n  }\n\n  override hasPrevious(): boolean {\n    return this.cursor.hasPrevious();\n  }\n\n  override previousIndex(): number {\n    return this.cursor.previousIndex();\n  }\n\n  override previous(): IteratorResult<K> {\n    const previous = this.cursor.previous();\n    return {done: previous.done, value: previous.value !== void 0 ? previous.value[0] : void 0};\n  }\n\n  override delete(): void {\n    this.cursor.delete();\n  }\n}\n\n/** @internal */\nexport class ValuesCursor<K, V> extends Cursor<V> {\n  constructor(cursor: Cursor<[K, V]>) {\n    super();\n    this.cursor = cursor;\n  }\n\n  /** @internal */\n  readonly cursor: Cursor<[K, V]>;\n\n  override isEmpty(): boolean {\n    return this.cursor.isEmpty();\n  }\n\n  override head(): V {\n    return this.cursor.head()[1];\n  }\n\n  override step(): void {\n    this.cursor.step();\n  }\n\n  override skip(count: number): void {\n    this.cursor.skip(count);\n  }\n\n  override hasNext(): boolean {\n    return this.cursor.hasNext();\n  }\n\n  override nextIndex(): number {\n    return this.cursor.nextIndex();\n  }\n\n  override next(): IteratorResult<V> {\n    const next = this.cursor.next();\n    return {done: next.done, value: next.value !== void 0 ? next.value[1] : void 0};\n  }\n\n  override hasPrevious(): boolean {\n    return this.cursor.hasPrevious();\n  }\n\n  override previousIndex(): number {\n    return this.cursor.previousIndex();\n  }\n\n  override previous(): IteratorResult<V> {\n    const previous = this.cursor.previous();\n    return {done: previous.done, value: previous.value !== void 0 ? previous.value[1] : void 0};\n  }\n\n  override delete(): void {\n    this.cursor.delete();\n  }\n}\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Mutable} from \"./types\";\nimport type {Equals} from \"./Equals\";\nimport type {Equivalent} from \"./Equivalent\";\nimport type {Domain} from \"./Domain\";\nimport type {Range} from \"./Range\";\n\n/** @public */\nexport interface Mapping<X, Y> extends Equals, Equivalent {\n  (x: X): Y;\n\n  readonly domain: Domain<X>;\n\n  readonly range: Range<Y>;\n\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  equivalentTo(that: unknown, epsilon?: number): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const Mapping = (function (_super: typeof Function) {\n  const Mapping = function <X, Y>(domain: Domain<X>, range: Range<Y>): Mapping<X, Y> {\n    const mapping = function (x: X): Y {\n      return mapping.range(mapping.domain(x));\n    } as Mapping<X, Y>;\n    Object.setPrototypeOf(mapping, Mapping.prototype);\n    (mapping as Mutable<typeof mapping>).domain = domain;\n    (mapping as Mutable<typeof mapping>).range = range;\n    return mapping;\n  } as {\n    <X, Y>(domain: Domain<X>, range: Range<Y>): Mapping<X, Y>;\n\n    /** @internal */\n    prototype: Mapping<any, any>;\n  };\n\n  Mapping.prototype = Object.create(_super.prototype);\n  Mapping.prototype.constructor = Mapping;\n\n  Mapping.prototype.canEqual = function <X, Y>(this: Mapping<X, Y>, that: unknown): boolean {\n    return that instanceof Mapping;\n  };\n\n  Mapping.prototype.equals = function <X, Y>(this: Mapping<X, Y>, that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Mapping) {\n      return that.canEqual(this)\n          && this.domain.equals(that.domain)\n          && this.range.equals(that.range);\n    }\n    return false;\n  };\n\n  Mapping.prototype.equivalentTo = function <X, Y>(this: Mapping<X, Y>, that: unknown, epsilon?: number): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Mapping) {\n      return this.domain.equivalentTo(that.domain, epsilon)\n          && this.range.equivalentTo(that.range, epsilon);\n    }\n    return false;\n  };\n\n  Mapping.prototype.toString = function <X, Y>(this: Mapping<X, Y>): string {\n    return \"Mapping(\" + this.domain + \", \" + this.range + \")\";\n  };\n\n  return Mapping;\n})(Function);\n\n/** @public */\nexport interface Piecewise<X, Y> extends Mapping<X, Y> {\n  readonly intervals: readonly Mapping<X, Y>[];\n\n  interval(x: X): Mapping<X, Y>;\n\n  /** @override */\n  readonly domain: Domain<X>;\n\n  /** @override */\n  readonly range: Range<Y>;\n\n  /** @override */\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  equivalentTo(that: unknown, epsilon?: number): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const Piecewise = (function (_super: typeof Mapping) {\n  const Piecewise = function <X, Y>(...intervals: readonly Mapping<X, Y>[]): Piecewise<X, Y> {\n    const piecewise = function (x: X): Y {\n      const interval = piecewise.interval(x);\n      return interval(x);\n    } as Piecewise<X, Y>;\n    Object.setPrototypeOf(piecewise, Piecewise.prototype);\n    const n = intervals.length;\n    if (n === 0) {\n      throw new Error(\"no piecewise intervals\");\n    }\n    let interval = intervals[0]!;\n    let domain = interval.domain;\n    let range = interval.range;\n    for (let i = 1; i < n; i += 1) {\n      interval = intervals[i]!;\n      domain = domain.union(interval.domain);\n      range = range.union(interval.range);\n    }\n    (piecewise as Mutable<typeof piecewise>).intervals = intervals;\n    (piecewise as Mutable<typeof piecewise>).domain = domain;\n    (piecewise as Mutable<typeof piecewise>).range = range;\n    return piecewise;\n  } as {\n    /** @internal */\n    <X, Y>(...intervals: readonly Mapping<X, Y>[]): Piecewise<X, Y>;\n\n    /** @internal */\n    prototype: Piecewise<any, any>;\n  };\n\n  Piecewise.prototype = Object.create(_super.prototype);\n  Piecewise.prototype.constructor = Piecewise;\n\n  Piecewise.prototype.interval = function <X, Y>(this: Piecewise<X, Y>, x: X): Mapping<X, Y> {\n    const intervals = this.intervals;\n    let lo = 0;\n    let hi = intervals.length - 1;\n    let interval: Mapping<X, Y> | undefined;\n    while (lo <= hi) {\n      const mid = (lo + hi) >>> 1;\n      interval = intervals[mid]!;\n      const domain = interval.domain;\n      const u = domain(x);\n      if (u < 0) {\n        hi = mid - 1;\n      } else if (u >= 1) {\n        lo = mid + 1;\n      } else {\n        break;\n      }\n    }\n    return interval!;\n  };\n\n  Piecewise.prototype.canEqual = function <X, Y>(this: Piecewise<X, Y>, that: unknown): boolean {\n    return that instanceof Piecewise;\n  };\n\n  Piecewise.prototype.equals = function <X, Y>(this: Piecewise<X, Y>, that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Piecewise) {\n      return that.canEqual(this)\n          && this.domain.equals(that.domain)\n          && this.range.equals(that.range);\n    }\n    return false;\n  };\n\n  Piecewise.prototype.toString = function <X, Y>(this: Piecewise<X, Y>): string {\n    let s = \"Piecewise(\";\n    const intervals = this.intervals;\n    for (let i = 0; i < intervals.length; i += 1) {\n      const interval = intervals[i]!;\n      if (i !== 0) {\n        s += \", \";\n      }\n      s += interval.toString();\n    }\n    s += \")\";\n    return s;\n  };\n\n  return Piecewise;\n})(Mapping);\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Mutable} from \"./types\";\nimport {Lazy} from \"./Lazy\";\nimport {Values} from \"./Values\";\nimport {Mapping} from \"./Mapping\";\nimport {Range} from \"./\"; // forward import\nimport {LinearDomain} from \"./\"; // forward import\nimport type {LinearRange} from \"./LinearRange\";\n\n/** @public */\nexport type DomainLike<X> = Domain<X> | readonly [X, X];\n\n/** @public */\nexport interface Domain<X> extends Mapping<X, number> {\n  readonly 0: X;\n\n  readonly 1: X;\n\n  /** @override */\n  readonly domain: this;\n\n  /** @override */\n  readonly range: LinearRange;\n\n  contains(x: X): boolean;\n\n  union(that: Domain<X>): Domain<X>;\n\n  /** @override */\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  equivalentTo(that: unknown, epsilon?: number): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const Domain = (function (_super: typeof Mapping) {\n  const Domain = function <X>(x0: X, x1: X): Domain<X> {\n    const domain = function (x: X): number {\n      return Values.equal(x, domain[1]) ? 1 : 0;\n    } as Domain<X>;\n    Object.setPrototypeOf(domain, Domain.prototype);\n    (domain as Mutable<typeof domain>)[0] = x0;\n    (domain as Mutable<typeof domain>)[1] = x1;\n    return domain;\n  } as {\n    <X>(x0: X, x1: X): Domain<X>;\n\n    /** @internal */\n    prototype: Domain<any>;\n\n    unit(): LinearDomain;\n  };\n\n  Domain.prototype = Object.create(_super.prototype);\n  Domain.prototype.constructor = Domain;\n\n  Object.defineProperty(Domain.prototype, \"domain\", {\n    get<X>(this: Domain<X>): Domain<X> {\n      return this;\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  Object.defineProperty(Domain.prototype, \"range\", {\n    get<X>(this: Domain<X>): LinearRange {\n      return Range.unit();\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  Domain.prototype.contains = function <X>(this: Domain<X>, x: X): boolean {\n    return Values.compare(this[0], x) <= 0 && Values.compare(x, this[1]) <= 0;\n  };\n\n  Domain.prototype.union = function <X>(this: Domain<X>, that: Domain<X>): Domain<X> {\n    const x00 = this[0];\n    const x01 = this[1];\n    const x10 = that[0];\n    const x11 = that[1];\n    const x0 = Values.compare(x00, x10) <= 0 ? x00 : x10;\n    const x1 = Values.compare(x01, x11) >= 0 ? x01 : x11;\n    return Domain(x0, x1);\n  };\n\n  Domain.prototype.canEqual = function <X>(this: Domain<X>, that: unknown): boolean {\n    return that instanceof Domain;\n  };\n\n  Domain.prototype.equals = function <X>(this: Domain<X>, that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Domain) {\n      return that.canEqual(this)\n          && Values.equal(this[0], that[0])\n          && Values.equal(this[1], that[1]);\n    }\n    return false;\n  };\n\n  Domain.prototype.equivalentTo = function <X>(this: Domain<X>, that: unknown, epsilon?: number): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Domain) {\n      return Values.equivalent(this[0], that[0], epsilon)\n          && Values.equivalent(this[1], that[1], epsilon);\n    }\n    return false;\n  };\n\n  Domain.prototype.toString = function <X>(this: Domain<X>): string {\n    return \"Domain(\" + this[0] + \", \" + this[1] + \")\";\n  };\n\n  Domain.unit = Lazy(function (): LinearDomain {\n    return LinearDomain(0, 1);\n  });\n\n  return Domain;\n})(Mapping);\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Mutable} from \"./types\";\nimport {Lazy} from \"./Lazy\";\nimport {Values} from \"./Values\";\nimport {Mapping} from \"./Mapping\";\nimport {Domain} from \"./Domain\";\nimport type {LinearDomain} from \"./LinearDomain\";\nimport {LinearRange} from \"./\"; // forward import\n\n/** @public */\nexport type RangeLike<Y> = Range<Y> | readonly [Y, Y];\n\n/** @public */\nexport interface Range<Y> extends Mapping<number, Y> {\n  readonly 0: Y;\n\n  readonly 1: Y;\n\n  /** @override */\n  readonly domain: LinearDomain;\n\n  /** @override */\n  readonly range: this;\n\n  union(that: Range<Y>): Range<Y>;\n\n  /** @override */\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  equivalentTo(that: unknown, epsilon?: number): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const Range = (function (_super: typeof Mapping) {\n  const Range = function <Y>(y0: Y, y1: Y): Range<Y> {\n    const range = function (u: number): Y {\n      return u < 1 ? range[0] : range[1];\n    } as Range<Y>;\n    Object.setPrototypeOf(range, Range.prototype);\n    (range as Mutable<typeof range>)[0] = y0;\n    (range as Mutable<typeof range>)[1] = y1;\n    return range;\n  } as {\n    <Y>(y0: Y, y1: Y): Range<Y>;\n\n    /** @internal */\n    prototype: Range<any>;\n\n    unit(): LinearRange;\n  };\n\n  Range.prototype = Object.create(_super.prototype);\n  Range.prototype.constructor = Range;\n\n  Object.defineProperty(Range.prototype, \"domain\", {\n    get<Y>(this: Range<Y>): LinearDomain {\n      return Domain.unit();\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  Object.defineProperty(Range.prototype, \"range\", {\n    get<Y>(this: Range<Y>): Range<Y> {\n      return this;\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  Range.prototype.union = function <Y>(this: Range<Y>, that: Range<Y>): Range<Y> {\n    const y00 = this[0];\n    const y01 = this[1];\n    const y10 = that[0];\n    const y11 = that[1];\n    const y0Order = Values.compare(y00, y01);\n    const y1Order = Values.compare(y10, y11);\n    let y0: Y;\n    let y1: Y;\n    if (y0Order <= 0 && y1Order <= 0) {\n      y0 = Values.compare(y00, y10) <= 0 ? y00 : y10;\n      y1 = Values.compare(y01, y11) >= 0 ? y01 : y11;\n    } else if (y0Order >= 0 && y1Order >= 0) {\n      y0 = Values.compare(y00, y10) >= 0 ? y00 : y10;\n      y1 = Values.compare(y01, y11) <= 0 ? y01 : y11;\n    } else if (y0Order <= 0 && y1Order >= 0) {\n      y0 = Values.compare(y00, y11) <= 0 ? y00 : y11;\n      y1 = Values.compare(y01, y10) >= 0 ? y01 : y10;\n    } else { // y0Order >= 0 && y1Order <= 0\n      y0 = Values.compare(y01, y10) <= 0 ? y01 : y10;\n      y1 = Values.compare(y00, y11) >= 0 ? y00 : y11;\n    }\n    return Range(y0, y1);\n  };\n\n  Range.prototype.canEqual = function <Y>(this: Domain<Y>, that: unknown): boolean {\n    return that instanceof Range;\n  };\n\n  Range.prototype.equals = function <Y>(this: Domain<Y>, that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Range) {\n      return that.canEqual(this)\n          && Values.equal(this[0], that[0])\n          && Values.equal(this[1], that[1]);\n    }\n    return false;\n  };\n\n  Range.prototype.equivalentTo = function <Y>(this: Domain<Y>, that: unknown, epsilon?: number): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Range) {\n      return Values.equivalent(this[0], that[0], epsilon)\n          && Values.equivalent(this[1], that[1], epsilon);\n    }\n    return false;\n  };\n\n  Range.prototype.toString = function <Y>(this: Domain<Y>): string {\n    return \"Range(\" + this[0] + \", \" + this[1] + \")\";\n  };\n\n  Range.unit = Lazy(function (): LinearRange {\n    return LinearRange(0, 1);\n  });\n\n  return Range;\n})(Mapping);\n\n/** @public */\nexport interface Constant<Y> extends Range<Y> {\n  readonly value: Y;\n\n  /** @override */\n  readonly 0: Y;\n\n  /** @override */\n  readonly 1: Y;\n\n  /** @override */\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const Constant = (function (_super: typeof Range) {\n  const Constant = function <Y>(value: Y): Constant<Y> {\n    const range = function (u: number): Y {\n      return range.value;\n    } as Constant<Y>;\n    Object.setPrototypeOf(range, Constant.prototype);\n    (range as Mutable<typeof range>).value = value;\n    return range;\n  } as {\n    <Y>(value: Y): Constant<Y>;\n\n    /** @internal */\n    prototype: Constant<any>;\n  };\n\n  Constant.prototype = Object.create(_super.prototype);\n  Constant.prototype.constructor = Constant;\n\n  Object.defineProperty(Constant.prototype, 0, {\n    get<Y>(this: Constant<Y>): Y {\n      return this.value;\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  Object.defineProperty(Constant.prototype, 1, {\n    get<Y>(this: Constant<Y>): Y {\n      return this.value;\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  Constant.prototype.canEqual = function (that: unknown): boolean {\n    return that instanceof Constant;\n  };\n\n  Constant.prototype.equals = function (that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Constant) {\n      return that.canEqual(this) && Values.equal(this.value, that.value);\n    }\n    return false;\n  };\n\n  Constant.prototype.toString = function (): string {\n    return \"Constant(\" + this.value + \")\";\n  };\n\n  return Constant;\n})(Range);\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Interpolator} from \"./Interpolator\";\n\n/**\n * Type that can be [[Interpolator interpolated]] to values of type `T`.\n * @public\n */\nexport interface Interpolate<T = unknown> {\n  /**\n   * Returns an [[Interpolator]] function that blends between `this` value and\n   * `that` value, if possible; otherwise returns `null` if `this` is unable to\n   * construct an interpolator to `that`.\n   */\n  interpolateTo(that: unknown): Interpolator<T> | null;\n}\n\n/** @public */\nexport const Interpolate = (function () {\n  const Interpolate = function (x: unknown, y: unknown): Interpolator | null {\n    if (Interpolate[Symbol.hasInstance](x)) {\n      return x.interpolateTo(y);\n    }\n    return null;\n  } as {\n    /**\n     * Returns `x.interpolateTo(y)`, if `x` conforms to the\n     * [[Interpolate]] interface; otherwise returns `null`.\n     */\n    <T>(x: Interpolate<T> | null | undefined, y: unknown): Interpolator<T> | null;\n    (x: unknown, y: unknown): Interpolator | null;\n\n    /**\n     * Returns `true` if `instance` appears to conform to the [[Interpolate]] interface.\n     */\n    [Symbol.hasInstance](instance: unknown): instance is Interpolate;\n  };\n\n  Object.defineProperty(Interpolate, Symbol.hasInstance, {\n    value: function (instance: unknown): instance is Interpolate {\n      if (instance === null || (typeof instance !== \"object\" && typeof instance !== \"function\")) {\n        return false;\n      }\n      return typeof (instance as Interpolate).interpolateTo === \"function\";\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  return Interpolate;\n})();\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Mutable} from \"./types\";\nimport {Values} from \"./Values\";\nimport {Range} from \"./Range\";\nimport {Interpolate} from \"./Interpolate\";\n\n/** @public */\nexport interface Interpolator<Y = unknown> extends Range<Y>, Interpolate<Interpolator<Y>> {\n  /** @override */\n  readonly 0: Y;\n\n  /** @override */\n  readonly 1: Y;\n\n  /** @override */\n  union(that: Range<Y>): Interpolator<Y>;\n\n  map<Y2>(transform: (y: Y) => Y2): Interpolator<Y2>;\n\n  interpolateTo(that: Interpolator<Y>): Interpolator<Interpolator<Y>>;\n  interpolateTo(that: unknown): Interpolator<Interpolator<Y>> | null;\n\n  /** @override */\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const Interpolator = (function (_super: typeof Range) {\n  const Interpolator = function (y0: unknown, y1: unknown): Interpolator {\n    let interpolator: Interpolator | null;\n    if (y0 === y1) {\n      interpolator = IdentityInterpolator(y0);\n    } else if (typeof y0 === \"number\" && typeof y1 === \"number\") {\n      interpolator = NumberInterpolator(y0, y1);\n    } else if (Array.isArray(y0) && Array.isArray(y1)) {\n      interpolator = ArrayInterpolator(y0, y1);\n    } else {\n      interpolator = Interpolate(y0, y1);\n      if (interpolator === null) {\n        interpolator = StepInterpolator(y0, y1);\n      }\n    }\n    return interpolator;\n  } as {\n    <Y>(y0: Y, y1: Y): Interpolator<Y>;\n    (y0: unknown, y1: unknown): Interpolator;\n\n    /** @internal */\n    prototype: Interpolator<any>;\n  };\n\n  Interpolator.prototype = Object.create(_super.prototype);\n  Interpolator.prototype.constructor = Interpolator;\n\n  Interpolator.prototype.union = function <Y>(this: Interpolator<Y>, that: Range<Y>): Interpolator<Y> {\n    const y00 = this[0];\n    const y01 = this[1];\n    const y10 = that[0];\n    const y11 = that[1];\n    const y0Order = Values.compare(y00, y01);\n    const y1Order = Values.compare(y10, y11);\n    let y0: Y;\n    let y1: Y;\n    if (y0Order <= 0 && y1Order <= 0) {\n      y0 = Values.compare(y00, y10) <= 0 ? y00 : y10;\n      y1 = Values.compare(y01, y11) >= 0 ? y01 : y11;\n    } else if (y0Order >= 0 && y1Order >= 0) {\n      y0 = Values.compare(y00, y10) >= 0 ? y00 : y10;\n      y1 = Values.compare(y01, y11) <= 0 ? y01 : y11;\n    } else if (y0Order <= 0 && y1Order >= 0) {\n      y0 = Values.compare(y00, y11) <= 0 ? y00 : y11;\n      y1 = Values.compare(y01, y10) >= 0 ? y01 : y10;\n    } else { // y0Order >= 0 && y1Order <= 0\n      y0 = Values.compare(y01, y10) <= 0 ? y01 : y10;\n      y1 = Values.compare(y00, y11) >= 0 ? y00 : y11;\n    }\n    return Interpolator(y0, y1);\n  };\n\n  Interpolator.prototype.map = function <Y, Y2>(this: Interpolator<Y>, transform: (y: Y) => Y2): Interpolator<Y2> {\n    return InterpolatorMap(this, transform);\n  };\n\n  Interpolator.prototype.interpolateTo = function <Y>(this: Interpolator<Y>, that: unknown): Interpolator<Interpolator<Y>> | null {\n    if (that instanceof Interpolator) {\n      return InterpolatorInterpolator(this, that);\n    }\n    return null;\n  } as typeof Interpolator.prototype.interpolateTo;\n\n  Interpolator.prototype.canEqual = function <Y>(this: Interpolator<Y>, that: unknown): boolean {\n    return that instanceof this.constructor;\n  };\n\n  Interpolator.prototype.equals = function <Y>(this: Interpolator<Y>, that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Interpolator) {\n      return that.canEqual(this)\n          && Values.equal(this[0], that[0])\n          && Values.equal(this[1], that[1]);\n    }\n    return false;\n  };\n\n  Interpolator.prototype.toString = function <Y>(this: Interpolator<Y>): string {\n    return \"Interpolator(\" + this[0] + \", \" + this[1] + \")\";\n  };\n\n  return Interpolator;\n})(Range);\n\n/** @internal */\nexport interface InterpolatorMap<Y, Y2> extends Interpolator<Y2> {\n  /** @internal */\n  readonly interpolator: Interpolator<Y>;\n\n  /** @internal */\n  readonly transform: (y: Y) => Y2;\n\n  /** @override */\n  readonly 0: Y2;\n\n  /** @override */\n  readonly 1: Y2;\n\n  /** @override */\n  equals(that: unknown): boolean;\n}\n\n/** @internal */\nexport const InterpolatorMap = (function (_super: typeof Interpolator) {\n  const InterpolatorMap = function <Y, Y2>(interpolator: Interpolator<Y>, transform: (y: Y) => Y2): InterpolatorMap<Y, Y2> {\n    const map = function (u: number): Y2 {\n      return map.transform(map.interpolator(u));\n    } as InterpolatorMap<Y, Y2>;\n    Object.setPrototypeOf(map, InterpolatorMap.prototype);\n    (map as Mutable<typeof map>).interpolator = interpolator;\n    (map as Mutable<typeof map>).transform = transform;\n    return map;\n  } as {\n    <Y, Y2>(interpolator: Interpolator<Y>, transform: (y: Y) => Y2): InterpolatorMap<Y, Y2>;\n\n    /** @internal */\n    prototype: InterpolatorMap<any, any>;\n  };\n\n  InterpolatorMap.prototype = Object.create(_super.prototype);\n  InterpolatorMap.prototype.constructor = InterpolatorMap;\n\n  Object.defineProperty(InterpolatorMap.prototype, 0, {\n    get<Y, Y2>(this: InterpolatorMap<Y, Y2>): Y2 {\n      return this.transform(this.interpolator[0]);\n    },\n    configurable: true,\n  });\n\n  Object.defineProperty(InterpolatorMap.prototype, 1, {\n    get<Y, Y2>(this: InterpolatorMap<Y, Y2>): Y2 {\n      return this.transform(this.interpolator[1]);\n    },\n    configurable: true,\n  });\n\n  InterpolatorMap.prototype.equals = function <Y, Y2>(this: InterpolatorMap<Y, Y2>, that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof InterpolatorMap) {\n      return this.interpolator.equals(that.interpolator)\n          && this.transform === that.transform;\n    }\n    return false;\n  };\n\n  return InterpolatorMap;\n})(Interpolator);\n\n/** @internal */\nexport interface IdentityInterpolator<Y> extends Interpolator<Y> {\n  /** @internal */\n  readonly value: Y;\n\n  /** @override */\n  readonly 0: Y;\n\n  /** @override */\n  readonly 1: Y;\n\n  /** @override */\n  equals(that: unknown): boolean;\n}\n\n/** @internal */\nexport const IdentityInterpolator = (function (_super: typeof Interpolator) {\n  const IdentityInterpolator = function <Y>(value: Y): IdentityInterpolator<Y> {\n    const interpolator = function (u: number): Y {\n      return interpolator.value;\n    } as IdentityInterpolator<Y>;\n    Object.setPrototypeOf(interpolator, IdentityInterpolator.prototype);\n    (interpolator as Mutable<typeof interpolator>).value = value;\n    return interpolator;\n  } as {\n    <Y>(value: Y): IdentityInterpolator<Y>;\n\n    /** @internal */\n    prototype: IdentityInterpolator<any>;\n  };\n\n  IdentityInterpolator.prototype = Object.create(_super.prototype);\n  IdentityInterpolator.prototype.constructor = IdentityInterpolator;\n\n  Object.defineProperty(IdentityInterpolator.prototype, 0, {\n    get<Y>(this: IdentityInterpolator<Y>): Y {\n      return this.value;\n    },\n    configurable: true,\n  });\n\n  Object.defineProperty(IdentityInterpolator.prototype, 1, {\n    get<Y>(this: IdentityInterpolator<Y>): Y {\n      return this.value;\n    },\n    configurable: true,\n  });\n\n  IdentityInterpolator.prototype.equals = function (that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof IdentityInterpolator) {\n      return this.value === that.value;\n    }\n    return false;\n  };\n\n  return IdentityInterpolator;\n})(Interpolator);\n\n/** @internal */\nexport interface StepInterpolator<Y> extends Interpolator<Y> {\n  /** @internal */\n  readonly phase: number;\n\n  /** @override */\n  equals(that: unknown): boolean;\n}\n\n/** @internal */\nexport const StepInterpolator = (function (_super: typeof Interpolator) {\n  const StepInterpolator = function <Y>(y0: Y, y1: Y, phase?: number): StepInterpolator<Y> {\n    const interpolator = function (u: number): Y {\n      return u < interpolator.phase ? interpolator[0] : interpolator[1];\n    } as StepInterpolator<Y>;\n    Object.setPrototypeOf(interpolator, StepInterpolator.prototype);\n    if (phase === void 0) {\n      phase = 1;\n    }\n    (interpolator as Mutable<typeof interpolator>).phase = phase;\n    (interpolator as Mutable<typeof interpolator>)[0] = y0;\n    (interpolator as Mutable<typeof interpolator>)[1] = y1;\n    return interpolator;\n  } as {\n    <Y>(y0: Y, y1: Y, phase?: number): StepInterpolator<Y>;\n\n    /** @internal */\n    prototype: StepInterpolator<any>;\n  };\n\n  StepInterpolator.prototype = Object.create(_super.prototype);\n  StepInterpolator.prototype.constructor = StepInterpolator;\n\n  StepInterpolator.prototype.equals = function <Y>(this: StepInterpolator<Y>, that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof StepInterpolator) {\n      return that.canEqual(this)\n          && this.phase === that.phase\n          && Values.equal(this[0], that[0])\n          && Values.equal(this[1], that[1]);\n    }\n    return false;\n  };\n\n  return StepInterpolator;\n})(Interpolator);\n\n/** @internal */\nexport const NumberInterpolator = (function (_super: typeof Interpolator) {\n  const NumberInterpolator = function (y0: number, y1: number): Interpolator<number> {\n    const interpolator = function (u: number): number {\n      const y0 = interpolator[0];\n      const y1 = interpolator[1];\n      return y0 + u * (y1 - y0);\n    } as Interpolator<number>;\n    Object.setPrototypeOf(interpolator, NumberInterpolator.prototype);\n    (interpolator as Mutable<typeof interpolator>)[0] = y0;\n    (interpolator as Mutable<typeof interpolator>)[1] = y1;\n    return interpolator;\n  } as {\n    (y0: number, y1: number): Interpolator<number>;\n\n    /** @internal */\n    prototype: Interpolator<number>;\n  };\n\n  NumberInterpolator.prototype = Object.create(_super.prototype);\n  NumberInterpolator.prototype.constructor = NumberInterpolator;\n\n  return NumberInterpolator;\n})(Interpolator);\n\n/** @internal */\nexport interface ArrayInterpolator<Y> extends Interpolator<readonly Y[]> {\n  /** @internal */\n  readonly interpolators: readonly Interpolator<Y>[];\n\n  /** @override */\n  readonly 0: readonly Y[];\n\n  /** @override */\n  readonly 1: readonly Y[];\n\n  /** @override */\n  equals(that: unknown): boolean;\n}\n\n/** @internal */\nexport const ArrayInterpolator = (function (_super: typeof Interpolator) {\n  const ArrayInterpolator = function <Y>(y0: readonly Y[], y1: readonly Y[]): ArrayInterpolator<Y> {\n    const interpolator = function (u: number): readonly Y[] {\n      const interpolators = interpolator.interpolators;\n      const interpolatorCount = interpolators.length;\n      const array = new Array<Y>(interpolatorCount);\n      for (let i = 0; i < interpolatorCount; i += 1) {\n        array[i] = interpolators[i]!(u);\n      }\n      return array;\n    } as ArrayInterpolator<Y>;\n    Object.setPrototypeOf(interpolator, ArrayInterpolator.prototype);\n    const interpolatorCount = Math.min(y0.length, y1.length);\n    const interpolators = new Array<Interpolator<Y>>(interpolatorCount);\n    for (let i = 0; i < interpolatorCount; i += 1) {\n      interpolators[i] = Interpolator(y0[i]!, y1[i]!);\n    }\n    (interpolator as Mutable<typeof interpolator>).interpolators = interpolators;\n    return interpolator;\n  } as {\n    <Y>(y0: readonly Y[], y1: readonly Y[]): ArrayInterpolator<Y>;\n\n    /** @internal */\n    prototype: ArrayInterpolator<any>;\n  };\n\n  ArrayInterpolator.prototype = Object.create(_super.prototype);\n  ArrayInterpolator.prototype.constructor = ArrayInterpolator;\n\n  Object.defineProperty(ArrayInterpolator.prototype, 0, {\n    get<Y>(this: ArrayInterpolator<Y>): readonly Y[] {\n      const interpolators = this.interpolators;\n      const interpolatorCount = interpolators.length;\n      const array = new Array<Y>(interpolatorCount);\n      for (let i = 0; i < interpolatorCount; i += 1) {\n        array[i] = interpolators[i]![0];\n      }\n      return array;\n    },\n    configurable: true,\n  });\n\n  Object.defineProperty(ArrayInterpolator.prototype, 1, {\n    get<Y>(this: ArrayInterpolator<Y>): readonly Y[] {\n      const interpolators = this.interpolators;\n      const interpolatorCount = interpolators.length;\n      const array = new Array<Y>(interpolatorCount);\n      for (let i = 0; i < interpolatorCount; i += 1) {\n        array[i] = interpolators[i]![1];\n      }\n      return array;\n    },\n    configurable: true,\n  });\n\n  ArrayInterpolator.prototype.equals = function <Y>(this: ArrayInterpolator<Y>, that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof ArrayInterpolator) {\n      const n = this.interpolators.length;\n      if (n !== that.interpolators.length) {\n        return false;\n      }\n      for (let i = 0; i < n; i += 1) {\n        if (!this.interpolators[i]!.equals(that.interpolators[i]!)) {\n          return false;\n        }\n      }\n      return true;\n    }\n    return false;\n  };\n\n  return ArrayInterpolator;\n})(Interpolator);\n\n/** @internal */\nexport const InterpolatorInterpolator = (function (_super: typeof Interpolator) {\n  const InterpolatorInterpolator = function <Y>(y0: Interpolator<Y>, y1: Interpolator<Y>): Interpolator<Interpolator<Y>> {\n    const interpolator = function (u: number): Interpolator<Y> {\n      if (u === 0) {\n        return interpolator[0];\n      } else if (u === 1) {\n        return interpolator[1];\n      }\n      return Interpolator(interpolator[0](u), interpolator[1](u));\n    } as Interpolator<Interpolator<Y>>;\n    Object.setPrototypeOf(interpolator, InterpolatorInterpolator.prototype);\n    (interpolator as Mutable<typeof interpolator>)[0] = y0;\n    (interpolator as Mutable<typeof interpolator>)[1] = y1;\n    return interpolator;\n  } as {\n    <Y>(y0: Interpolator<Y>, y1: Interpolator<Y>): Interpolator<Interpolator<Y>>;\n\n    /** @internal */\n    prototype: Interpolator<any>;\n  };\n\n  InterpolatorInterpolator.prototype = Object.create(_super.prototype);\n  InterpolatorInterpolator.prototype.constructor = InterpolatorInterpolator;\n\n  return InterpolatorInterpolator;\n})(Interpolator);\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Uninitable} from \"./types\";\nimport type {Mutable} from \"./types\";\nimport {Values} from \"./Values\";\nimport {Domain} from \"./Domain\";\nimport {Interpolator} from \"./Interpolator\";\nimport type {EasingLike} from \"./Easing\";\nimport type {EasingType} from \"./Easing\";\nimport {Easing} from \"./\"; // forward import\nimport {Tweening} from \"./\"; // forward import\n\n/** @public */\nexport type TimingLike = Timing | TimingInit;\n\n/** @public */\nexport interface TimingInit {\n  /** @internal */\n  readonly typeid?: \"TimingInit\";\n  easing?: EasingLike;\n  t0?: number;\n  t1?: number;\n  dt?: number;\n}\n\n/** @public */\nexport interface Timing extends Domain<number> {\n  /** @internal */\n  readonly typeid?: \"Timing\";\n\n  likeType?(like: TimingInit | EasingType): void;\n\n  /** @override */\n  readonly 0: number;\n\n  /** @override */\n  readonly 1: number;\n\n  readonly duration: number;\n\n  readonly easing: Easing;\n\n  /** @override */\n  contains(t: number): boolean;\n\n  withDomain(t0: number, t1: number): Timing;\n\n  withDuration(dt: number): Timing;\n\n  overRange<Y>(range: Interpolator<Y>): Tweening<Y>;\n  overRange<Y>(y0: Y, y1: Y): Tweening<Y>;\n\n  /** @override */\n  union(that: Domain<number>): Timing;\n\n  /** @override */\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  equivalentTo(that: unknown, epsilon?: number): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const Timing = (function (_super: typeof Domain) {\n  const Timing = function (easing: Easing, t0: number, t1: number): Timing {\n    const timing = function (t: number): number {\n      const t0 = timing[0];\n      const t1 = timing[1];\n      return timing.easing(Math.min(Math.max(0, (t - t0) / (t1 - t0)), 1));\n    } as Timing;\n    Object.setPrototypeOf(timing, Timing.prototype);\n    (timing as Mutable<typeof timing>).easing = easing;\n    (timing as Mutable<typeof timing>)[0] = t0;\n    (timing as Mutable<typeof timing>)[1] = t1;\n    return timing;\n  } as {\n    (easing: Easing, t0: number, t1: number): Timing;\n\n    /** @internal */\n    prototype: Timing;\n\n    fromLike<T extends TimingLike | boolean | null | undefined>(value: T): Timing | (T extends true ? true : never) | (T extends false ? false : never) | Uninitable<T>;\n\n    fromInit(init: TimingInit): Timing;\n  };\n\n  Timing.prototype = Object.create(_super.prototype);\n  Timing.prototype.constructor = Timing;\n\n  Object.defineProperty(Timing.prototype, \"duration\", {\n    get(this: Timing): number {\n      return this[1] - this[0];\n    },\n    configurable: true,\n  });\n\n  Timing.prototype.contains = function (t: number): boolean {\n    return this[0] <= t && t <= this[1];\n  };\n\n  Timing.prototype.withDomain = function (t0: number, t1: number): Timing {\n    return Timing(this.easing, t0, t1);\n  };\n\n  Timing.prototype.withDuration = function (dt: number): Timing {\n    const t0 = this[0];\n    return Timing(this.easing, t0, t0 + dt);\n  };\n\n  Timing.prototype.overRange = function <Y>(this: Timing, y0: Interpolator<Y> | Y, y1: Y): Tweening<Y> {\n    let range: Interpolator<Y>;\n    if (arguments.length === 1) {\n      range = y0 as Interpolator<Y>;\n    } else {\n      range = Interpolator(y0 as Y, y1);\n    }\n    return Tweening(this, range);\n  } as typeof Timing.prototype.overRange;\n\n  Timing.prototype.union = function (that: Domain<number>): Timing {\n    return Timing(this.easing, Math.min(this[0], that[0]), Math.max(this[1], that[1]));\n  };\n\n  Timing.prototype.canEqual = function (that: unknown): boolean {\n    return that instanceof Timing;\n  };\n\n  Timing.prototype.equals = function (that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Timing) {\n      return that.canEqual(this)\n          && this.easing.equals(that.easing)\n          && Values.equal(this[0], that[0])\n          && Values.equal(this[1], that[1]);\n    }\n    return false;\n  };\n\n  Timing.prototype.equivalentTo = function (that: unknown, epsilon?: number): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Timing) {\n      return this.easing.equivalentTo(that.easing, epsilon)\n          && Values.equivalent(this[0], that[0], epsilon)\n          && Values.equivalent(this[1], that[1], epsilon);\n    }\n    return false;\n  };\n\n  Timing.prototype.toString = function (): string {\n    return \"Timing(\" + this.easing + \", \" + this[0] + \", \" + this[1] + \")\";\n  };\n\n  Timing.fromLike = function <T extends TimingLike | boolean | null | undefined>(value: T): Timing | (T extends true ? true : never) | (T extends false ? false : never) | Uninitable<T> {\n    if (value === void 0 || value === null || typeof value === \"boolean\" || value instanceof Timing) {\n      return value as Timing | (T extends true ? true : never) | (T extends false ? false : never) | Uninitable<T>;\n    } else if (typeof value === \"object\") {\n      return this.fromInit(value);\n    }\n    throw new TypeError(\"\" + value);\n  };\n\n  Timing.fromInit = function (init: TimingInit): Timing {\n    let easing = init.easing;\n    if (easing === void 0) {\n      easing = Easing.linear;\n    } else if (typeof easing === \"string\") {\n      easing = Easing(easing);\n    }\n    let t0 = init.t0;\n    if (t0 === void 0) {\n      t0 = 0;\n    }\n    let t1 = init.t1;\n    if (t1 === void 0) {\n      const dt = init.dt;\n      if (dt !== void 0) {\n        t1 = t0 + dt;\n      } else {\n        t1 = t0;\n      }\n    }\n    return Timing(easing, t0, t1);\n  };\n\n  return Timing;\n})(Domain);\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Uninitable} from \"./types\";\nimport type {Mutable} from \"./types\";\nimport {Timing} from \"./Timing\";\n\n/** @public */\nexport type EasingLike = Easing | EasingType;\n\n/** @public */\nexport type EasingType = \"linear\" | \"quad-in\" | \"quad-out\" | \"quad-in-out\"\n                       | \"cubic-in\" | \"cubic-out\" | \"cubic-in-out\"\n                       | \"quart-in\" | \"quart-out\" | \"quart-in-out\"\n                       | \"expo-in\" | \"expo-out\" | \"expo-in-out\"\n                       | \"circ-in\" | \"circ-out\" | \"circ-in-out\"\n                       | \"back-in\" | \"back-out\" | \"back-in-out\"\n                       | \"elastic-in\" | \"elastic-out\" | \"elastic-in-out\"\n                       | \"bounce-in\" | \"bounce-out\" | \"bounce-in-out\";\n\n/** @public */\nexport interface Easing extends Timing {\n  /** @override */\n  likeType?(like: EasingType): void;\n\n  readonly type: string;\n\n  /** @override */\n  readonly 0: 0;\n\n  /** @override */\n  readonly 1: 1;\n\n  /** @override */\n  readonly easing: this;\n\n  /** @override */\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  equivalentTo(that: unknown, epsilon?: number): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const Easing = (function (_super: typeof Timing) {\n  const Easing = function (type: string): Easing {\n    switch (type) {\n      case \"linear\": return Easing.linear;\n      case \"quad-in\": return Easing.quadIn;\n      case \"quad-out\": return Easing.quadOut;\n      case \"quad-in-out\": return Easing.quadInOut;\n      case \"cubic-in\": return Easing.cubicIn;\n      case \"cubic-out\": return Easing.cubicOut;\n      case \"cubic-in-out\": return Easing.cubicInOut;\n      case \"quart-in\": return Easing.quartIn;\n      case \"quart-out\": return Easing.quartOut;\n      case \"quart-in-out\": return Easing.quartInOut;\n      case \"expo-in\": return Easing.expoIn;\n      case \"expo-out\": return Easing.expoOut;\n      case \"expo-in-out\": return Easing.expoInOut;\n      case \"circ-in\": return Easing.circIn;\n      case \"circ-out\": return Easing.circOut;\n      case \"circ-in-out\": return Easing.circInOut;\n      case \"back-in\": return Easing.backIn;\n      case \"back-out\": return Easing.backOut;\n      case \"back-in-out\": return Easing.backInOut;\n      case \"elastic-in\": return Easing.elasticIn;\n      case \"elastic-out\": return Easing.elasticOut;\n      case \"elastic-in-out\": return Easing.elasticInOut;\n      case \"bounce-in\": return Easing.bounceIn;\n      case \"bounce-out\": return Easing.bounceOut;\n      case \"bounce-in-out\": return Easing.bounceInOut;\n      default: throw new Error(\"unknown easing function: \" + type);\n    }\n  } as {\n    (type: string): Easing;\n\n    /** @internal */\n    prototype: Easing;\n\n    readonly linear: Easing;\n    readonly quadIn: Easing;\n    readonly quadOut: Easing;\n    readonly quadInOut: Easing;\n    readonly cubicIn: Easing;\n    readonly cubicOut: Easing;\n    readonly cubicInOut: Easing;\n    readonly quartIn: Easing;\n    readonly quartOut: Easing;\n    readonly quartInOut: Easing;\n    readonly expoIn: Easing;\n    readonly expoOut: Easing;\n    readonly expoInOut: Easing;\n    readonly circIn: Easing;\n    readonly circOut: Easing;\n    readonly circInOut: Easing;\n    readonly backIn: Easing;\n    readonly backOut: Easing;\n    readonly backInOut: Easing;\n    readonly elasticIn: Easing;\n    readonly elasticOut: Easing;\n    readonly elasticInOut: Easing;\n    readonly bounceIn: Easing;\n    readonly bounceOut: Easing;\n    readonly bounceInOut: Easing;\n\n    fromLike<T extends EasingLike | null | undefined>(value: T): Easing | Uninitable<T>;\n  };\n\n  Easing.prototype = Object.create(_super.prototype);\n  Easing.prototype.constructor = Easing;\n\n  Object.defineProperty(Easing.prototype, 0, {\n    value: 0,\n  });\n\n  Object.defineProperty(Easing.prototype, 1, {\n    value: 1,\n  });\n\n  Object.defineProperty(Easing.prototype, \"easing\", {\n    get(this: Easing): Easing {\n      return this;\n    },\n  });\n\n  Easing.prototype.canEqual = function (that: unknown): boolean {\n    return that instanceof Easing;\n  };\n\n  Easing.prototype.equals = function (that: unknown): boolean {\n    return this === that;\n  };\n\n  Easing.prototype.equivalentTo = function (that: unknown, epsilon?: number): boolean {\n    return this === that;\n  };\n\n  Easing.prototype.toString = function (): string {\n    return \"Easing(\\\"\" + this.type + \"\\\")\";\n  };\n\n  Easing.fromLike = function <T extends EasingLike | null | undefined>(value: T): Easing | Uninitable<T> {\n    if (value === void 0 || value === null || value instanceof Easing) {\n      return value as Easing | Uninitable<T>;\n    } else if (typeof value === \"string\") {\n      return Easing(value);\n    }\n    throw new TypeError(\"\" + value);\n  };\n\n  (Easing as Mutable<typeof Easing>).linear = function (u: number): number {\n    return u;\n  } as Easing;\n  Object.setPrototypeOf(Easing.linear, Easing.prototype);\n  (Easing.linear as Mutable<Easing>).type = \"linear\";\n\n  (Easing as Mutable<typeof Easing>).quadIn = function (u: number): number {\n    return u * u;\n  } as Easing;\n  Object.setPrototypeOf(Easing.quadIn, Easing.prototype);\n  (Easing.quadIn as Mutable<Easing>).type = \"quad-in\";\n\n  (Easing as Mutable<typeof Easing>).quadOut = function (u: number): number {\n    return u * (2 - u);\n  } as Easing;\n  Object.setPrototypeOf(Easing.quadOut, Easing.prototype);\n  (Easing.quadOut as Mutable<Easing>).type = \"quad-out\";\n\n  (Easing as Mutable<typeof Easing>).quadInOut = function (u: number): number {\n    u *= 2;\n    if (u <= 1) {\n      u = u * u;\n    } else {\n      u -= 1;\n      u = u * (2 - u);\n      u += 1;\n    }\n    u /= 2;\n    return u;\n  } as Easing;\n  Object.setPrototypeOf(Easing.quadInOut, Easing.prototype);\n  (Easing.quadInOut as Mutable<Easing>).type = \"quad-in-out\";\n\n  (Easing as Mutable<typeof Easing>).cubicIn = function (u: number): number {\n    return u * u * u;\n  } as Easing;\n  Object.setPrototypeOf(Easing.cubicIn, Easing.prototype);\n  (Easing.cubicIn as Mutable<Easing>).type = \"cubic-in\";\n\n  (Easing as Mutable<typeof Easing>).cubicOut = function (u: number): number {\n    u -= 1;\n    u = u * u * u;\n    u += 1;\n    return u;\n  } as Easing;\n  Object.setPrototypeOf(Easing.cubicOut, Easing.prototype);\n  (Easing.cubicOut as Mutable<Easing>).type = \"cubic-out\";\n\n  (Easing as Mutable<typeof Easing>).cubicInOut = function (u: number): number {\n    u *= 2;\n    if (u <= 1) {\n      u = u * u * u;\n    } else {\n      u -= 2;\n      u = u * u * u;\n      u += 2;\n    }\n    u /= 2;\n    return u;\n  } as Easing;\n  Object.setPrototypeOf(Easing.cubicInOut, Easing.prototype);\n  (Easing.cubicInOut as Mutable<Easing>).type = \"cubic-in-out\";\n\n  (Easing as Mutable<typeof Easing>).quartIn = function (u: number): number {\n    return u * u * u * u;\n  } as Easing;\n  Object.setPrototypeOf(Easing.quartIn, Easing.prototype);\n  (Easing.quartIn as Mutable<Easing>).type = \"quart-in\";\n\n  (Easing as Mutable<typeof Easing>).quartOut = function (u: number): number {\n    u -= 1;\n    return 1 - u * u * u * u;\n  } as Easing;\n  Object.setPrototypeOf(Easing.quartOut, Easing.prototype);\n  (Easing.quartOut as Mutable<Easing>).type = \"quart-out\";\n\n  (Easing as Mutable<typeof Easing>).quartInOut = function (u: number): number {\n    const v = u - 1;\n    return u < 0.5 ? 8 * u * u * u * u : 1 - 8 * v * v * v * v;\n  } as Easing;\n  Object.setPrototypeOf(Easing.quartInOut, Easing.prototype);\n  (Easing.quartInOut as Mutable<Easing>).type = \"quart-in-out\";\n\n  (Easing as Mutable<typeof Easing>).expoIn = function (u: number): number {\n    if (u === 0) {\n      return 0;\n    }\n    return Math.pow(2, 10 * (u - 1));\n  } as Easing;\n  Object.setPrototypeOf(Easing.expoIn, Easing.prototype);\n  (Easing.expoIn as Mutable<Easing>).type = \"expo-in\";\n\n  (Easing as Mutable<typeof Easing>).expoOut = function (u: number): number {\n    if (u === 1) {\n      return 1;\n    }\n    return (-Math.pow(2, -10 * u) + 1);\n  } as Easing;\n  Object.setPrototypeOf(Easing.expoOut, Easing.prototype);\n  (Easing.expoOut as Mutable<Easing>).type = \"expo-out\";\n\n  (Easing as Mutable<typeof Easing>).expoInOut = function (u: number): number {\n    if (u === 1 || u === 0) {\n      return u;\n    }\n    u *= 2;\n    if (u < 1) {\n      return 0.5 * Math.pow(2, 10 * (u - 1));\n    }\n    return 0.5 * (-Math.pow(2, -10 * (u - 1)) + 2);\n  } as Easing;\n  Object.setPrototypeOf(Easing.expoInOut, Easing.prototype);\n  (Easing.expoInOut as Mutable<Easing>).type = \"expo-in-out\";\n\n  (Easing as Mutable<typeof Easing>).circIn = function (u: number): number {\n    return -1 * (Math.sqrt(1 - (u / 1) * u) - 1);\n  } as Easing;\n  Object.setPrototypeOf(Easing.circIn, Easing.prototype);\n  (Easing.circIn as Mutable<Easing>).type = \"circ-in\";\n\n  (Easing as Mutable<typeof Easing>).circOut = function (u: number): number {\n    u -= 1;\n    return Math.sqrt(1 - u * u);\n  } as Easing;\n  Object.setPrototypeOf(Easing.circOut, Easing.prototype);\n  (Easing.circOut as Mutable<Easing>).type = \"circ-out\";\n\n  (Easing as Mutable<typeof Easing>).circInOut = function (u: number): number {\n    u *= 2;\n    if (u < 1) {\n      return -0.5 * (Math.sqrt(1 - u * u) - 1);\n    }\n    const st = u - 2;\n    return 0.5 * (Math.sqrt(1 - st * st) + 1);\n  } as Easing;\n  Object.setPrototypeOf(Easing.circInOut, Easing.prototype);\n  (Easing.circInOut as Mutable<Easing>).type = \"circ-in-out\";\n\n  (Easing as Mutable<typeof Easing>).backIn = function (u: number): number {\n    const m = 1.70158; // m - Magnitude\n    return u * u * ((m + 1) * u - m);\n  } as Easing;\n  Object.setPrototypeOf(Easing.backIn, Easing.prototype);\n  (Easing.backIn as Mutable<Easing>).type = \"back-in\";\n\n  (Easing as Mutable<typeof Easing>).backOut = function (u: number): number {\n    const m = 1.70158;\n    const st = (u / 1) - 1;\n    return (st * st * ((m + 1) * m + m)) + 1;\n  } as Easing;\n  Object.setPrototypeOf(Easing.backOut, Easing.prototype);\n  (Easing.backOut as Mutable<Easing>).type = \"back-out\";\n\n  (Easing as Mutable<typeof Easing>).backInOut = function (u: number): number {\n    const m = 1.70158;\n    const s = m * 1.525;\n    if ((u *= 2) < 1) {\n      return 0.5 * u * u * (((s + 1) * u) - s);\n    }\n    const st = u - 2;\n    return 0.5 * (st * st * ((s + 1) * st + s) + 2);\n  } as Easing;\n  Object.setPrototypeOf(Easing.backInOut, Easing.prototype);\n  (Easing.backInOut as Mutable<Easing>).type = \"back-in-out\";\n\n  (Easing as Mutable<typeof Easing>).elasticIn = function (u: number): number {\n    if (u === 0 || u === 1) {\n      return u;\n    }\n    const m = 0.7;\n    const st = (u / 1) - 1;\n    const s = (1 - m) / 2 * Math.PI * Math.asin(1);\n    return -(Math.pow(2, 10 * st) * Math.sin((st - s) * 2 * Math.PI / (1 - m)));\n  } as Easing;\n  Object.setPrototypeOf(Easing.elasticIn, Easing.prototype);\n  (Easing.elasticIn as Mutable<Easing>).type = \"elastic-in\";\n\n  (Easing as Mutable<typeof Easing>).elasticOut = function (u: number): number {\n    if (u === 0 || u === 1) {\n      return u;\n    }\n    const m = 0.7;\n    const s = (1 -  m) / (2 * Math.PI) * Math.asin(1);\n    u *= 2;\n    return (Math.pow(2, -10 * u) * Math.sin((u - s) * 2 * Math.PI / (1 - m))) + 1;\n  } as Easing;\n  Object.setPrototypeOf(Easing.elasticOut, Easing.prototype);\n  (Easing.elasticOut as Mutable<Easing>).type = \"elastic-out\";\n\n  (Easing as Mutable<typeof Easing>).elasticInOut = function (u: number): number {\n    if (u === 0 || u === 1) {\n      return u;\n    }\n    const m = 0.65;\n    const s = (1 - m) / (2 * Math.PI) * Math.asin(1);\n    const st = u * 2;\n    const st1 = st - 1;\n    if(st < 1) {\n      return -0.5 * (Math.pow(2, 10 * st1) * Math.sin((st1 - s) * 2 * Math.PI / (1 - m)));\n    }\n    return (Math.pow(2, -10 * st1) * Math.sin((st1 - s) * 2 * Math.PI / (1 - m)) * 0.5) + 1;\n  } as Easing;\n  Object.setPrototypeOf(Easing.elasticInOut, Easing.prototype);\n  (Easing.elasticInOut as Mutable<Easing>).type = \"elastic-in-out\";\n\n  (Easing as Mutable<typeof Easing>).bounceIn = function (u: number): number {\n    const p = 7.5625;\n    if ((u = 1 - u) < 1 / 2.75) {\n      return 1 - (p * u * u);\n    } else if (u < 2 / 2.75) {\n      return 1 - (p * (u -= 1.5 / 2.75) * u + 0.75);\n    } else if (u < 2.5 / 2.75) {\n      return 1 - (p * (u -= 2.25 / 2.75) * u + 0.9375);\n    }\n    return 1 - (p * (u -= 2.625 / 2.75) * u + 0.984375);\n  } as Easing;\n  Object.setPrototypeOf(Easing.bounceIn, Easing.prototype);\n  (Easing.bounceIn as Mutable<Easing>).type = \"bounce-in\";\n\n  (Easing as Mutable<typeof Easing>).bounceOut = function (u: number): number {\n    const p = 7.5625;\n    if (u < 1 / 2.75) {\n      return p * u * u;\n    } else if (u < 2 / 2.75) {\n      return p * (u -= 1.5 / 2.75) * u + 0.75;\n    } else if (u < 2.5 / 2.75) {\n      return p * (u -= 2.25 / 2.75) * u + 0.9375;\n    }\n    return p * (u -= 2.625 / 2.75) * u + 0.984375;\n  } as Easing;\n  Object.setPrototypeOf(Easing.bounceOut, Easing.prototype);\n  (Easing.bounceOut as Mutable<Easing>).type = \"bounce-out\";\n\n  (Easing as Mutable<typeof Easing>).bounceInOut = function (u: number): number {\n    const invert = u < 0.5;\n    u = invert ? 1 - (u * 2) : (u * 2) - 1;\n    const p = 7.5625;\n    if (u < 1 / 2.75) {\n      u = p * u * u;\n    } else if (u < 2 / 2.75) {\n      u = p * (u -= 1.5 / 2.75) * u + 0.75;\n    } else if (u < 2.5 / 2.75) {\n      u = p * (u -= 2.25 / 2.75) * u + 0.9375;\n    } else {\n      u = p * (u -= 2.625 / 2.75) * u + 0.984375;\n    }\n    return invert ? (1 - u) * 0.5 : u * 0.5 + 0.5;\n  } as Easing;\n  Object.setPrototypeOf(Easing.bounceInOut, Easing.prototype);\n  (Easing.bounceInOut as Mutable<Easing>).type = \"bounce-in-out\";\n\n  return Easing;\n})(Timing);\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Mutable} from \"./types\";\nimport {Mapping} from \"./Mapping\";\nimport type {Interpolator} from \"./Interpolator\";\nimport type {Timing} from \"./Timing\";\n\n/** @public */\nexport interface Tweening<Y> extends Mapping<number, Y> {\n  /** @override */\n  readonly domain: Timing;\n\n  /** @override */\n  readonly range: Interpolator<Y>;\n\n  withDomain(t0: number, t1: number): Tweening<Y>;\n\n  /** @override */\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const Tweening = (function (_super: typeof Mapping) {\n  const Tweening = function <Y>(domain: Timing, range: Interpolator<Y>): Tweening<Y> {\n    const tweening = function (u: number): Y {\n      return tweening.range(tweening.domain(u));\n    } as Tweening<Y>;\n    Object.setPrototypeOf(tweening, Tweening.prototype);\n    (tweening as Mutable<typeof tweening>).domain = domain;\n    (tweening as Mutable<typeof tweening>).range = range;\n    return tweening;\n  } as {\n    <Y>(domain: Timing, range: Interpolator<Y>): Tweening<Y>\n\n    /** @internal */\n    prototype: Tweening<any>;\n  };\n\n  Tweening.prototype = Object.create(_super.prototype);\n  Tweening.prototype.constructor = Tweening;\n\n  Tweening.prototype.withDomain = function <Y>(this: Tweening<Y>, t0: number, t1: number): Tweening<Y> {\n    return this.domain.withDomain(t0, t1).overRange(this.range);\n  };\n\n  Tweening.prototype.canEqual = function <Y>(this: Tweening<Y>, that: unknown): boolean {\n    return that instanceof Tweening;\n  };\n\n  Tweening.prototype.equals = function <Y>(this: Tweening<Y>, that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Tweening) {\n      return this.domain.equals(that.domain) && this.range.equals(that.range);\n    }\n    return false;\n  };\n\n  Tweening.prototype.toString = function <Y>(this: Tweening<Y>): string {\n    return \"Tweening(\" + this.domain + \", \" + this.range + \")\";\n  };\n\n  return Tweening;\n})(Mapping);\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {Mapping} from \"./Mapping\";\nimport type {Domain} from \"./Domain\";\nimport type {Range} from \"./Range\";\n\n/** @public */\nexport interface Scale<X, Y> extends Mapping<X, Y> {\n  readonly inverse: Mapping<Y, X>;\n\n  withDomain(domain: Domain<X>): Scale<X, Y>;\n  withDomain(x0: X, x1: X): Scale<X, Y>;\n\n  overRange(range: Range<Y>): Scale<X, Y>;\n  overRange(y0: Y, y1: Y): Scale<X, Y>;\n\n  /** @override */\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const Scale = (function (_super: typeof Mapping) {\n  const Scale = function (): never {\n    throw new Error();\n  } as {\n    /** @internal */\n    (): never;\n\n    /** @internal */\n    prototype: Scale<any, any>;\n  };\n\n  Scale.prototype = Object.create(_super.prototype);\n  Scale.prototype.constructor = Scale;\n\n  Scale.prototype.canEqual = function (that: unknown): boolean {\n    return that instanceof Scale;\n  };\n\n  Scale.prototype.equals = function (that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Scale) {\n      return this.domain.equals(that.domain) && this.range.equals(that.range);\n    }\n    return false;\n  };\n\n  Scale.prototype.toString = function (): string {\n    return \"Scale(\" + this.domain + \", \" + this.range + \")\";\n  };\n\n  return Scale;\n})(Mapping);\n\n/** @public */\nexport interface ContinuousScale<X, Y> extends Scale<X, Y> {\n  /** @override */\n  readonly inverse: Mapping<Y, X>;\n\n  /** @override */\n  withDomain(domain: Domain<X>): ContinuousScale<X, Y>;\n  withDomain(x0: X, x1: X): ContinuousScale<X, Y>;\n\n  /** @override */\n  overRange(range: Range<Y>): ContinuousScale<X, Y>;\n  overRange(y0: Y, y1: Y): ContinuousScale<X, Y>;\n\n  clampDomain(xMin: X | undefined, xMax: X | undefined,\n              zMin: number | undefined, zMax: number | undefined,\n              epsilon?: number): ContinuousScale<X, Y>;\n\n  solveDomain(x1: X, y1: Y, x2?: X, y2?: Y,\n              reflect?: boolean, epsilon?: number): ContinuousScale<X, Y>;\n\n  /** @override */\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const ContinuousScale = (function (_super: typeof Scale) {\n  const ContinuousScale = function (): never {\n    throw new Error();\n  } as {\n    /** @internal */\n    (): never;\n\n    /** @internal */\n    prototype: ContinuousScale<any, any>;\n  };\n\n  ContinuousScale.prototype = Object.create(_super.prototype);\n  ContinuousScale.prototype.constructor = ContinuousScale;\n\n  ContinuousScale.prototype.canEqual = function (that: unknown): boolean {\n    return that instanceof ContinuousScale;\n  };\n\n  ContinuousScale.prototype.equals = function (that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof ContinuousScale) {\n      return this.domain.equals(that.domain) && this.range.equals(that.range);\n    }\n    return false;\n  };\n\n  ContinuousScale.prototype.toString = function (): string {\n    return \"ContinuousScale(\" + this.domain + \", \" + this.range + \")\";\n  };\n\n  return ContinuousScale;\n})(Scale);\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Mutable} from \"./types\";\nimport {Domain} from \"./Domain\";\nimport type {Interpolate} from \"./Interpolate\";\nimport {Interpolator} from \"./Interpolator\";\nimport {LinearRange} from \"./\"; // forward import\n\n/** @public */\nexport interface LinearDomain extends Domain<number>, Interpolate<LinearDomain> {\n  /** @override */\n  readonly 0: number;\n\n  /** @override */\n  readonly 1: number;\n\n  readonly inverse: LinearRange;\n\n  /** @override */\n  contains(x: number): boolean;\n\n  /** @override */\n  union(that: Domain<number>): LinearDomain;\n\n  /** @override */\n  interpolateTo(that: LinearDomain): Interpolator<LinearDomain>;\n  interpolateTo(that: unknown): Interpolator<LinearDomain> | null;\n\n  /** @override */\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const LinearDomain = (function (_super: typeof Domain) {\n  const LinearDomain = function (x0: number, x1: number): LinearDomain {\n    const domain = function (x: number): number {\n      const x0 = domain[0];\n      const x1 = domain[1];\n      const dx = x1 - x0;\n      return dx !== 0 ? (x - x0) / dx : 0;\n    } as LinearDomain;\n    Object.setPrototypeOf(domain, LinearDomain.prototype);\n    (domain as Mutable<typeof domain>)[0] = x0;\n    (domain as Mutable<typeof domain>)[1] = x1;\n    return domain;\n  } as {\n    (x0: number, x1: number): LinearDomain;\n\n    /** @internal */\n    prototype: LinearDomain;\n  };\n\n  LinearDomain.prototype = Object.create(_super.prototype);\n  LinearDomain.prototype.constructor = LinearDomain;\n\n  Object.defineProperty(LinearDomain.prototype, \"inverse\", {\n    get(this: LinearDomain): LinearRange {\n      return LinearRange(this[0], this[1]);\n    },\n    configurable: true,\n  });\n\n  LinearDomain.prototype.contains = function (x: number): boolean {\n    return this[0] <= x && x <= this[1];\n  };\n\n  LinearDomain.prototype.union = function (that: Domain<number>): LinearDomain {\n    return LinearDomain(Math.min(this[0], that[0]), Math.max(this[1], that[1]));\n  };\n\n  LinearDomain.prototype.interpolateTo = function (this: LinearDomain, that: unknown): Interpolator<LinearDomain> | null {\n    if (that instanceof LinearDomain) {\n      return LinearDomainInterpolator(this, that);\n    }\n    return null;\n  } as typeof LinearDomain.prototype.interpolateTo;\n\n  LinearDomain.prototype.canEqual = function (that: unknown): boolean {\n    return that instanceof LinearDomain;\n  };\n\n  LinearDomain.prototype.equals = function (that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof LinearDomain) {\n      return that.canEqual(this) && this[0] === that[0] && this[1] === that[1];\n    }\n    return false;\n  };\n\n  LinearDomain.prototype.toString = function (): string {\n    return \"LinearDomain(\" + this[0] + \", \" + this[1] + \")\";\n  };\n\n  return LinearDomain;\n})(Domain);\n\n/** @internal */\nexport const LinearDomainInterpolator = (function (_super: typeof Interpolator) {\n  const LinearDomainInterpolator = function (x0: LinearDomain, x1: LinearDomain): Interpolator<LinearDomain> {\n    const interpolator = function (u: number): LinearDomain {\n      const x0 = interpolator[0];\n      const x00 = x0[0];\n      const x01 = x0[1];\n      const x1 = interpolator[1];\n      const x10 = x1[0];\n      const x11 = x1[1];\n      return LinearDomain(x00 + u * (x10 - x00), x01 + u * (x11 - x01));\n    } as Interpolator<LinearDomain>;\n    Object.setPrototypeOf(interpolator, LinearDomainInterpolator.prototype);\n    (interpolator as Mutable<typeof interpolator>)[0] = x0;\n    (interpolator as Mutable<typeof interpolator>)[1] = x1;\n    return interpolator;\n  } as {\n    (x0: LinearDomain, x1: LinearDomain): Interpolator<LinearDomain>;\n\n    /** @internal */\n    prototype: Interpolator<LinearDomain>;\n  };\n\n  LinearDomainInterpolator.prototype = Object.create(_super.prototype);\n  LinearDomainInterpolator.prototype.constructor = LinearDomainInterpolator;\n\n  return LinearDomainInterpolator;\n})(Interpolator);\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Mutable} from \"./types\";\nimport {Range} from \"./Range\";\nimport type {Interpolate} from \"./Interpolate\";\nimport {Interpolator} from \"./Interpolator\";\nimport {LinearDomain} from \"./LinearDomain\";\n\n/** @public */\nexport interface LinearRange extends Range<number>, Interpolate<LinearRange> {\n  /** @override */\n  readonly 0: number;\n\n  /** @override */\n  readonly 1: number;\n\n  readonly inverse: LinearDomain;\n\n  /** @override */\n  union(that: Range<number>): LinearRange;\n\n  /** @override */\n  interpolateTo(that: LinearRange): Interpolator<LinearRange>;\n  interpolateTo(that: unknown): Interpolator<LinearRange> | null;\n\n  /** @override */\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const LinearRange = (function (_super: typeof Range) {\n  const LinearRange = function (y0: number, y1: number): LinearRange {\n    const range = function (u: number): number {\n      const y0 = range[0];\n      const y1 = range[1];\n      return y0 + u * (y1 - y0);\n    } as LinearRange;\n    Object.setPrototypeOf(range, LinearRange.prototype);\n    (range as Mutable<typeof range>)[0] = y0;\n    (range as Mutable<typeof range>)[1] = y1;\n    return range;\n  } as {\n    (y0: number, y1: number): LinearRange;\n\n    /** @internal */\n    prototype: LinearRange;\n  };\n\n  LinearRange.prototype = Object.create(_super.prototype);\n  LinearRange.prototype.constructor = LinearRange;\n\n  Object.defineProperty(LinearRange.prototype, \"inverse\", {\n    get(this: LinearRange): LinearDomain {\n      return LinearDomain(this[0], this[1]);\n    },\n    configurable: true,\n  });\n\n  LinearRange.prototype.union = function (that: Range<number>): LinearRange {\n    const y00 = this[0];\n    const y01 = this[1];\n    const y10 = that[0];\n    const y11 = that[1];\n    let y0: number;\n    let y1: number;\n    if (y00 <= y01 && y10 <= y11) {\n      y0 = Math.min(y00, y10);\n      y1 = Math.max(y01, y11);\n    } else if (y00 >= y01 && y10 >= y11) {\n      y0 = Math.max(y00, y10);\n      y1 = Math.min(y01, y11);\n    } else if (y00 <= y01 && y10 >= y11) {\n      y0 = Math.min(y00, y11);\n      y1 = Math.max(y01, y10);\n    } else { // y00 >= y01 && y10 <= y11\n      y0 = Math.min(y01, y10);\n      y1 = Math.max(y00, y11);\n    }\n    return LinearRange(y0, y1);\n  };\n\n  LinearRange.prototype.interpolateTo = function (this: LinearRange, that: unknown): Interpolator<LinearRange> | null {\n    if (that instanceof LinearRange) {\n      return LinearRangeInterpolator(this, that);\n    }\n    return null;\n  } as typeof LinearRange.prototype.interpolateTo;\n\n  LinearRange.prototype.canEqual = function (that: unknown): boolean {\n    return that instanceof LinearRange;\n  };\n\n  LinearRange.prototype.equals = function (that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof LinearRange) {\n      return that.canEqual(this) && this[0] === that[0] && this[1] === that[1];\n    }\n    return false;\n  };\n\n  LinearRange.prototype.toString = function (): string {\n    return \"LinearRange(\" + this[0] + \", \" + this[1] + \")\";\n  };\n\n  return LinearRange;\n})(Range);\n\n/** @internal */\nexport const LinearRangeInterpolator = (function (_super: typeof Interpolator) {\n  const LinearRangeInterpolator = function (y0: LinearRange, y1: LinearRange): Interpolator<LinearRange> {\n    const interpolator = function (u: number): LinearRange {\n      const y0 = interpolator[0];\n      const y00 = y0[0];\n      const y01 = y0[1];\n      const y1 = interpolator[1];\n      const y10 = y1[0];\n      const y11 = y1[1];\n      return LinearRange(y00 + u * (y10 - y00), y01 + u * (y11 - y01));\n    } as Interpolator<LinearRange>;\n    Object.setPrototypeOf(interpolator, LinearRangeInterpolator.prototype);\n    (interpolator as Mutable<typeof interpolator>)[0] = y0;\n    (interpolator as Mutable<typeof interpolator>)[1] = y1;\n    return interpolator;\n  } as {\n    (y0: LinearRange, y1: LinearRange): Interpolator<LinearRange>;\n\n    /** @internal */\n    prototype: Interpolator<LinearRange>;\n  };\n\n  LinearRangeInterpolator.prototype = Object.create(_super.prototype);\n  LinearRangeInterpolator.prototype.constructor = LinearRangeInterpolator;\n\n  return LinearRangeInterpolator;\n})(Interpolator);\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {Mutable} from \"./types\";\nimport {Equivalent} from \"./Equivalent\";\nimport type {Interpolate} from \"./Interpolate\";\nimport {Interpolator} from \"./Interpolator\";\nimport {ContinuousScale} from \"./Scale\";\nimport {LinearDomain} from \"./LinearDomain\";\nimport {LinearRange} from \"./LinearRange\";\n\n/** @public */\nexport interface LinearScale extends ContinuousScale<number, number>, Interpolate<LinearScale> {\n  /** @override */\n  readonly domain: LinearDomain;\n\n  /** @override */\n  readonly range: LinearRange;\n\n  /** @override */\n  readonly inverse: LinearScale;\n\n  /** @override */\n  withDomain(domain: LinearDomain): LinearScale;\n  withDomain(x0: number, x1: number): LinearScale;\n\n  /** @override */\n  overRange(range: LinearRange): LinearScale;\n  overRange(y0: number, y1: number): LinearScale;\n\n  /** @override */\n  clampDomain(xMin: number | undefined, xMax: number | undefined,\n              zMin: number | undefined, zMax: number | undefined,\n              epsilon?: number): LinearScale;\n\n  /** @override */\n  solveDomain(x1: number, y1: number, x2?: number, y2?: number,\n              reflect?: boolean, epsilon?: number): LinearScale;\n\n  /** @override */\n  interpolateTo(that: LinearScale): Interpolator<LinearScale>;\n  interpolateTo(that: unknown): Interpolator<LinearScale> | null;\n\n  /** @override */\n  canEqual(that: unknown): boolean;\n\n  /** @override */\n  equals(that: unknown): boolean;\n\n  /** @override */\n  toString(): string;\n}\n\n/** @public */\nexport const LinearScale = (function (_super: typeof ContinuousScale) {\n  const LinearScale = function (domain: LinearDomain, range: LinearRange): LinearScale {\n    const scale = function (x: number): number {\n      return scale.range(scale.domain(x));\n    } as LinearScale;\n    Object.setPrototypeOf(scale, LinearScale.prototype);\n    (scale as Mutable<typeof scale>).domain = domain;\n    (scale as Mutable<typeof scale>).range = range;\n    return scale;\n  } as {\n    (domain: LinearDomain, range: LinearRange): LinearScale;\n\n    /** @internal */\n    prototype: LinearScale;\n  };\n\n  LinearScale.prototype = Object.create(_super.prototype);\n  LinearScale.prototype.constructor = LinearScale;\n\n  Object.defineProperty(LinearScale.prototype, \"inverse\", {\n    get(this: LinearScale): LinearScale {\n      return LinearScale(this.range.inverse, this.domain.inverse);\n    },\n    configurable: true,\n  });\n\n  LinearScale.prototype.withDomain = function (x0: LinearDomain | number, x1?: number): LinearScale {\n    let domain: LinearDomain;\n    if (arguments.length === 1) {\n      domain = x0 as LinearDomain;\n    } else {\n      domain = LinearDomain(x0 as number, x1!);\n    }\n    return LinearScale(domain, this.range);\n  };\n\n  LinearScale.prototype.overRange = function (y0: LinearRange | number, y1?: number): LinearScale {\n    let range: LinearRange;\n    if (arguments.length === 1) {\n      range = y0 as LinearRange;\n    } else {\n      range = LinearRange(y0 as number, y1!);\n    }\n    return LinearScale(this.domain, range);\n  };\n\n  LinearScale.prototype.clampDomain = function (xMin: number | undefined, xMax: number | undefined,\n                                                zMin: number | undefined, zMax: number | undefined,\n                                                epsilon?: number): LinearScale {\n    if (epsilon === void 0) {\n      epsilon = Equivalent.Epsilon;\n    }\n    let x0 = this.domain[0];\n    let x1 = this.domain[1];\n    if (xMin !== void 0 && xMax !== void 0 && Math.abs(x1 - x0) > xMax - xMin) {\n      if (x0 < x1) {\n        x0 = xMin;\n        x1 = xMax;\n      } else {\n        x1 = xMin;\n        x0 = xMax;\n      }\n    } else {\n      if (xMin !== void 0) {\n        if (x0 < x1 && x0 < xMin) {\n          x1 += xMin - x0;\n          x0 = xMin;\n        } else if (x1 < x0 && x1 < xMin) {\n          x0 += xMin - x1;\n          x1 = xMin;\n        }\n      }\n      if (xMax !== void 0) {\n        if (x0 < x1 && x1 > xMax) {\n          x0 -= x1 - xMax;\n          x1 = xMax;\n        } else if (x1 < x0 && x0 > xMax) {\n          x1 -= x0 - xMax;\n          x0 = xMax;\n        }\n      }\n    }\n\n    const y0 = this(x0);\n    const y1 = this(x1);\n    const dy = y0 < y1 ? y1 - y0 : y0 - y1;\n    const z = Math.abs(dy / (x1 - x0));\n    if (zMin !== void 0 && z < 1 / zMin) {\n      const dz = dy * zMin;\n      const xSum = x0 + x1;\n      x0 = (xSum - dz) / 2;\n      x1 = (xSum + dz) / 2;\n    } else if (zMax !== void 0 && z > 1 / zMax) {\n      const dz = dy * zMax;\n      const xSum = x0 + x1;\n      x0 = (xSum - dz) / 2;\n      x1 = (xSum + dz) / 2;\n    }\n\n    if (Math.abs(x0 - this.domain[0]) < epsilon && Math.abs(x1 - this.domain[1]) < epsilon) {\n      return this;\n    }\n    return LinearScale(LinearDomain(x0, x1), this.range);\n  };\n\n  LinearScale.prototype.solveDomain = function (x1: number, y1: number, x2?: number, y2?: number,\n                                                reflect?: boolean, epsilon?: number): LinearScale {\n    if (epsilon === void 0) {\n      epsilon = Equivalent.Epsilon;\n    }\n    const dx = this.domain[1] - this.domain[0];\n    const y0 = this.range[0];\n    const y3 = this.range[1];\n    let m: number;\n    if (x2 === void 0 || y2 === void 0 || Math.abs(x2 - x1) < epsilon || Math.abs(y2 - y1) < epsilon) {\n      m = (y3 - y0) / (dx !== 0 ? dx : epsilon);\n    } else {\n      m = (y2 - y1) / (x2 - x1);\n      if ((reflect === void 0 || !reflect) && (m < 0 !== (y3 - y0) / dx < 0)) {\n        m = -m;\n      }\n    }\n    const b = y1 - m * x1;\n    const x0 = (y0 - b) / m;\n    const x3 = (y3 - b) / m;\n\n    if (Math.abs(x0 - this.domain[0]) < epsilon && Math.abs(x3 - this.domain[1]) < epsilon) {\n      return this;\n    }\n    return LinearScale(LinearDomain(x0, x3), this.range);\n  };\n\n  LinearScale.prototype.interpolateTo = function (this: LinearScale, that: unknown): Interpolator<LinearScale> | null {\n    if (that instanceof LinearScale) {\n      return LinearScaleInterpolator(this, that);\n    }\n    return null;\n  } as typeof LinearScale.prototype.interpolateTo;\n\n  LinearScale.prototype.canEqual = function (that: unknown): boolean {\n    return that instanceof LinearScale;\n  };\n\n  LinearScale.prototype.equals = function (that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof LinearScale) {\n      return this.domain.equals(that.domain) && this.range.equals(that.range);\n    }\n    return false;\n  };\n\n  LinearScale.prototype.toString = function (): string {\n    return \"LinearScale(\" + this.domain + \", \" + this.range + \")\";\n  };\n\n  return LinearScale;\n})(ContinuousScale);\n\n/** @internal */\nexport const LinearScaleInterpolator = (function (_super: typeof Interpolator) {\n  const LinearScaleInterpolator = function (s0: LinearScale, s1: LinearScale): Interpolator<LinearScale> {\n    const interpolator = function (u: number): LinearScale {\n      const s0 = interpolator[0];\n      const s1 = interpolator[1];\n      const x0 = s0.domain;\n      const x00 = x0[0];\n      const x01 = x0[1];\n      const x1 = s1.domain;\n      const x10 = x1[0];\n      const x11 = x1[1];\n      const domain = LinearDomain(x00 + u * (x10 - x00), x01 + u * (x11 - x01));\n      const y0 = s0.range;\n      const y00 = y0[0];\n      const y01 = y0[1];\n      const y1 = s1.range;\n      const y10 = y1[0];\n      const y11 = y1[1];\n      const range = LinearRange(y00 + u * (y10 - y00), y01 + u * (y11 - y01));\n      return LinearScale(domain, range);\n    } as Interpolator<LinearScale>;\n    Object.setPrototypeOf(interpolator, LinearScaleInterpolator.prototype);\n    (interpolator as Mutable<typeof interpolator>)[0] = s0;\n    (interpolator as Mutable<typeof interpolator>)[1] = s1;\n    return interpolator;\n  } as {\n    (s0: LinearScale, s1: LinearScale): Interpolator<LinearScale>;\n\n    /** @internal */\n    prototype: Interpolator<LinearScale>;\n  };\n\n  LinearScaleInterpolator.prototype = Object.create(_super.prototype);\n  LinearScaleInterpolator.prototype.constructor = LinearScaleInterpolator;\n\n  return LinearScaleInterpolator;\n})(Interpolator);\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {Values} from \"./Values\";\n\n/**\n * Exception thrown when an [[Assert]] fails.\n * @public\n */\nexport class AssertException extends Error {\n  constructor(message?: string) {\n    super(message);\n    Object.setPrototypeOf(this, AssertException.prototype);\n  }\n}\n\n/**\n * Callable [[Assert]] interface.\n *\n * @public\n */\nexport interface AssertFunction extends Assert {\n  /**\n   * Asserts that `condition` is truthy.\n   *\n   * @throws [[AssertException]] with `message` if `condition` is falsy.\n   */\n  (condition: unknown, message?: string): void;\n}\n\n/**\n * Type that implements common assertion functions.\n * @public\n */\nexport interface Assert {\n  /**\n   * Asserts that `condition` is truthy.\n   *\n   * @throws [[AssertException]] with `message` if `condition` is falsy.\n   */\n  ok(condition: unknown, message?: string): void;\n\n  /**\n   * Asserts that `condition` is falsy.\n   *\n   * @throws [[AssertException]] with `message` if `condition` is truthy.\n   */\n  notOk(condition: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is identical (`===`) to `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is not identical (`!==`) to `rhs`.\n   */\n  identical(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is not identical (`!==`) to `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is identical (`===`) to `rhs`.\n   */\n  notIdentical(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is less than (`<`) `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is not less than (`!<`) `rhs`.\n   */\n  lessThan(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is less than or equal (`<=`) to `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is not less than or equal (`!<=`) to `rhs`.\n   */\n  lessThanOrEqual(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is greater than (`>`) `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is not greater than (`!>`) `rhs`.\n   */\n  greaterThan(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is greater than or equal (`>=`) to `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is not greater than or equal (`!>=`) to `rhs`.\n   */\n  greaterThanOrEqual(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is not less than (`!<`) `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is less than (`<`) `rhs`.\n   */\n  notLessThan(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is not less than or equal (`!<=`) to `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is less than or equal (`<=`) to `rhs`.\n   */\n  notLessThanOrEqual(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is not greater than (`!>`) `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is greater than (`>`) `rhs`.\n   */\n  notGreaterThan(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is not greater than or equal (`!>=`) to `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is greater than or equal (`>=`) to `rhs`.\n   */\n  notGreaterThanOrEqual(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `object` has the prototype of `constructor` in its prototype chain.\n   *\n   * @throws [[AssertException]] with `message` if `object` does not have the prototype of `constructor` in its prototype chain.\n   */\n  instanceOf(object: unknown, constructor: Function, message?: string): void;\n\n  /**\n   * Asserts that `object` does not have the prototype of `constructor` in its prototype chain.\n   *\n   * @throws [[AssertException]] with `message` if `object` does have the prototype of `constructor` in its prototype chain.\n   */\n  notInstanceOf(object: unknown, constructor: Function, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is [[Values.equal structurally equal]] to `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is not structurally equal to `rhs`.\n   */\n  equal(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is not [[Values.equal structurally equal]] to `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is structurally equal to `rhs`.\n   */\n  notEqual(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is [[Values.equivalent structurally equivalent]] to `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is not structurally equivalent to `rhs`.\n   */\n  equivalent(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` is not [[Values.equivalent structurally equivalent]] to `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` is structurally equivalent to `rhs`.\n   */\n  notEquivalent(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` [[Values.compare structurally orders before]] `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` does not structurally order before `rhs`.\n   */\n  compareLessThan(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` does not [[Values.compare structurally order before]] `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` does structurally order before `rhs`.\n   */\n  compareNotLessThan(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` [[Values.compare structurally orders before or the same as]] `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` does not structurally order before or the same as `rhs`.\n   */\n  compareLessThanOrEqual(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` does not [[Values.compare structurally order before or the same as]] `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` does structurally order before or the same as `rhs`.\n   */\n  compareNotLessThanOrEqual(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` [[Values.compare structurally orders the same as]] `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` does not structurally order before or the same as `rhs`.\n   */\n  compareEqual(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` does not [[Values.compare structurally order the same as]] `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` does structurally order before or the same as `rhs`.\n   */\n  compareNotEqual(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` [[Values.compare structurally orders after or the same as]] `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` does not structurally order after or the same as `rhs`.\n   */\n  compareGreaterThanOrEqual(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` does not [[Values.compare structurally order after or the same as]] `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` does structurally order after or the same as `rhs`.\n   */\n  compareNotGreaterThanOrEqual(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` [[Values.compare structurally orders after]] `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` does not structurally order after `rhs`.\n   */\n  compareGreaterThan(lhs: unknown, rhs: unknown, message?: string): void;\n\n  /**\n   * Asserts that `lhs` does not [[Values.compare structurally order after]] `rhs`.\n   *\n   * @throws [[AssertException]] with `message` if `lhs` does structurally order after `rhs`.\n   */\n  compareNotGreaterThan(lhs: unknown, rhs: unknown, message?: string): void;\n}\n\n/** @public */\nexport const Assert = (function () {\n  const Assert = function (condition: unknown, message?: string): void {\n    if (!condition) {\n      throw new AssertException(message);\n    }\n  } as AssertFunction;\n\n  Assert.ok = function (condition: unknown, message?: string): void {\n    if (!condition) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.notOk = function (condition: unknown, message?: string): void {\n    if (condition) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.equal = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (!Values.equal(lhs, rhs)) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.notEqual = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (Values.equal(lhs, rhs)) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.identical = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (lhs !== rhs) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.notIdentical = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (lhs === rhs) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.lessThan = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (!((lhs as any) < (rhs as any))) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.lessThanOrEqual = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (!((lhs as any) <= (rhs as any))) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.greaterThan = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (!((lhs as any) > (rhs as any))) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.greaterThanOrEqual = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (!((lhs as any) >= (rhs as any))) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.notLessThan = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if ((lhs as any) < (rhs as any)) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.notLessThanOrEqual = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if ((lhs as any) <= (rhs as any)) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.notGreaterThan = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if ((lhs as any) > (rhs as any)) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.notGreaterThanOrEqual = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if ((lhs as any) >= (rhs as any)) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.instanceOf = function (object: unknown, constructor: Function, message?: string): void {\n    if (!(object instanceof constructor)) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.notInstanceOf = function (object: unknown, constructor: Function, message?: string): void {\n    if (object instanceof constructor) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.compareLessThan = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (!(Values.compare(lhs, rhs) < 0)) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.compareNotLessThan = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (Values.compare(lhs, rhs) < 0) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.compareLessThanOrEqual = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (!(Values.compare(lhs, rhs) <= 0)) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.compareNotLessThanOrEqual = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (Values.compare(lhs, rhs) <= 0) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.compareEqual = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (!(Values.compare(lhs, rhs) === 0)) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.compareNotEqual = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (Values.compare(lhs, rhs) === 0) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.compareGreaterThanOrEqual = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (!(Values.compare(lhs, rhs) >= 0)) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.compareNotGreaterThanOrEqual = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (Values.compare(lhs, rhs) >= 0) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.compareGreaterThan = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (!(Values.compare(lhs, rhs) > 0)) {\n      throw new AssertException(message);\n    }\n  };\n\n  Assert.compareNotGreaterThan = function (lhs: unknown, rhs: unknown, message?: string): void {\n    if (Values.compare(lhs, rhs) > 0) {\n      throw new AssertException(message);\n    }\n  };\n\n  return Assert;\n})();\n","// Copyright 2015-2024 Nstream, inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {Murmur3} from \"./Murmur3\";\nimport type {HashCode} from \"./HashCode\";\nimport type {Compare} from \"./Compare\";\nimport {Numbers} from \"./Numbers\";\nimport {Strings} from \"./Strings\";\nimport {Constructors} from \"./Constructors\";\n\n/**\n * Level of importance. Used for log levels and diagnostic classifications.\n * @public\n */\nexport class Severity implements HashCode, Compare {\n  /** @internal */\n  constructor(level: number, label: string) {\n    this.level = level;\n    this.label = label;\n  }\n\n  /**\n   * The integer level of importance of this `Severity`, with higher  levels\n   * signifying greater importance. An integer between `0` and `7`, inclusive.\n   * One of `TraceLevel`, `DebugLevel`, `InfoLevel`, `NoteLevel`,\n   * `WarningLevel`, `ErrorLevel`, `AlertLevel`, `FatalLevel`.\n   */\n  readonly level: number;\n\n  /**\n   * A descriptive label for this `Severity`.\n   */\n  readonly label: string;\n\n  /**\n   * Returns `true` if this `Severity` has `TraceLevel` of importance.\n   */\n  isTrace(): boolean {\n    return this.level === Severity.TraceLevel;\n  }\n\n  /**\n   * Returns `true` if this `Severity` has `DebugLevel` of importance.\n   */\n  isDebug(): boolean {\n    return this.level === Severity.DebugLevel;\n  }\n\n  /**\n   * Returns `true` if this `Severity` has `InfoLevel` of importance.\n   */\n  isInfo(): boolean {\n    return this.level === Severity.InfoLevel;\n  }\n\n  /**\n   * Returns `true` if this `Severity` has `NoteLevel` of importance.\n   */\n  isNote(): boolean {\n    return this.level === Severity.NoteLevel;\n  }\n\n  /**\n   * Returns `true` if this `Severity` has `WarningLevel` of importance.\n   */\n  isWarning(): boolean {\n    return this.level === Severity.WarningLevel;\n  }\n\n  /**\n   * Returns `true` if this `Severity` has `ErrorLevel` of importance.\n   */\n  isError(): boolean {\n    return this.level === Severity.ErrorLevel;\n  }\n\n  /**\n   * Returns `true` if this `Severity` has `AlertLevel` of importance.\n   */\n  isAlert(): boolean {\n    return this.level === Severity.AlertLevel;\n  }\n\n  /**\n   * Returns `true` if this `Severity` has `FatalLevel` of importance.\n   */\n  isFatal(): boolean {\n    return this.level === Severity.FatalLevel;\n  }\n\n  compareTo(that: unknown): number {\n    if (this === that) {\n      return 0;\n    } else if (that instanceof Severity) {\n      if (this.level < that.level) {\n        return -1;\n      } else if (this.level > that.level) {\n        return 1;\n      }\n      return this.label.localeCompare(that.label);\n    }\n    return NaN;\n  }\n\n  equals(that: unknown): boolean {\n    if (this === that) {\n      return true;\n    } else if (that instanceof Severity) {\n      return this.level === that.level && this.label === that.label;\n    }\n    return false;\n  }\n\n  hashCode(): number {\n    return Murmur3.mash(Murmur3.mix(Murmur3.mix(Constructors.hash(Severity),\n        Numbers.hash(this.level)), Strings.hash(this.label)));\n  }\n\n  toString(): string {\n    return this.label;\n  }\n\n  static readonly TraceLevel: number = 0;\n  static readonly DebugLevel: number = 1;\n  static readonly InfoLevel: number = 2;\n  static readonly NoteLevel: number = 3;\n  static readonly WarningLevel: number = 4;\n  static readonly ErrorLevel: number = 5;\n  static readonly AlertLevel: number = 6;\n  static readonly FatalLevel: number = 7;\n\n  static readonly TraceLabel: string = \"trace\";\n  static readonly DebugLabel: string = \"debug\";\n  static readonly InfoLabel: string = \"info\";\n  static readonly NoteLabel: string = \"note\";\n  static readonly WarningLabel: string = \"warning\";\n  static readonly ErrorLabel: string = \"error\";\n  static readonly AlertLabel: string = \"alert\";\n  static readonly FatalLabel: string = \"fatal\";\n\n  /** @internal */\n  static Trace: Severity | null = null;\n  /** @internal */\n  static Debug: Severity | null = null;\n  /** @internal */\n  static Info: Severity | null = null;\n  /** @internal */\n  static Note: Severity | null = null;\n  /** @internal */\n  static Warning: Severity | null = null;\n  /** @internal */\n  static Error: Severity | null = null;\n  /** @internal */\n  static Alert: Severity | null = null;\n  /** @internal */\n  static Fatal: Severity | null = null;\n\n  /**\n   * Returns a `Severity` with the given importance `level`, and optional\n   * descriptive `label`.\n   *\n   * @throws `Error` if `level` is not a valid level of importance.\n   */\n  static create(level: number, label?: string): Severity {\n    switch (level) {\n      case this.TraceLevel:\n        return this.trace(label);\n      case this.DebugLevel:\n        return this.debug(label);\n      case this.InfoLevel:\n        return this.info(label);\n      case this.NoteLevel:\n        return this.note(label);\n      case this.WarningLevel:\n        return this.warning(label);\n      case this.ErrorLevel:\n        return this.error(label);\n      case this.AlertLevel:\n        return this.alert(label);\n      case this.FatalLevel:\n        return this.fatal(label);\n      default:\n        throw new Error(\"\" + level);\n    }\n  }\n\n  /**\n   * Returns a `Severity` with `TraceLevel` of importance, and an optional\n   * descriptive `label`.\n   */\n  static trace(label?: string): Severity {\n    if (label === void 0 || label === this.TraceLabel) {\n      if (this.Trace === null) {\n        this.Trace = new Severity(this.TraceLevel, this.TraceLabel);\n      }\n      return this.Trace;\n    }\n    return new Severity(this.TraceLevel, label);\n  }\n\n  /**\n   * Returns a `Severity` with `DebugLevel` of importance, and an optional\n   * descriptive `label`.\n   */\n  static debug(label?: string): Severity {\n    if (label === void 0 || label === this.DebugLabel) {\n      if (this.Debug === null) {\n        this.Debug = new Severity(this.DebugLevel, this.DebugLabel);\n      }\n      return this.Debug;\n    }\n    return new Severity(this.DebugLevel, label);\n  }\n\n  /**\n   * Returns a `Severity` with `InfoLevel` of importance, and an optional\n   * descriptive `label`.\n   */\n  static info(label?: string): Severity {\n    if (label === void 0 || label === this.InfoLabel) {\n      if (this.Info === null) {\n        this.Info = new Severity(this.InfoLevel, this.InfoLabel);\n      }\n      return this.Info;\n    }\n    return new Severity(this.InfoLevel, label);\n  }\n\n  /**\n   * Returns a `Severity` with `NoteLevel` of importance, and an optional\n   * descriptive `label`.\n   */\n  static note(label?: string): Severity {\n    if (label === void 0 || label === this.NoteLabel) {\n      if (this.Note === null) {\n        this.Note = new Severity(this.NoteLevel, this.NoteLabel);\n      }\n      return this.Note;\n    }\n    return new Severity(this.NoteLevel, label);\n  }\n\n  /**\n   * Returns a `Severity` with `WarningLevel` of importance, and an optional\n   * descriptive `label`.\n   */\n  static warning(label?: string): Severity {\n    if (label === void 0 || label === this.WarningLabel) {\n      if (this.Warning === null) {\n        this.Warning = new Severity(this.WarningLevel, this.WarningLabel);\n      }\n      return this.Warning;\n    }\n    return new Severity(this.WarningLevel, label);\n  }\n\n  /**\n   * Returns a `Severity` with `ErrorLevel` of importance, and an optional\n   * descriptive `label`.\n   */\n  static error(label?: string): Severity {\n    if (label === void 0 || label === this.ErrorLabel) {\n      if (this.Error === null) {\n        this.Error = new Severity(this.ErrorLevel, this.ErrorLabel);\n      }\n      return this.Error;\n    }\n    return new Severity(this.ErrorLevel, label);\n  }\n\n  /**\n   * Returns a `Severity` with `AlertLevel` of importance, and an optional\n   * descriptive `label`.\n   */\n  static alert(label?: string): Severity {\n    if (label === void 0 || label === this.AlertLabel) {\n      if (this.Alert === null) {\n        this.Alert = new Severity(this.AlertLevel, this.AlertLabel);\n      }\n      return this.Alert;\n    }\n    return new Severity(this.AlertLevel, label);\n  }\n\n  /**\n   * Returns a `Severity` with `FatalLevel` of importance, and an optional\n   * descriptive `label`.\n   */\n  static fatal(label?: string): Severity {\n    if (label === void 0 || label === this.FatalLabel) {\n      if (this.Fatal === null) {\n        this.Fatal = new Severity(this.FatalLevel, this.FatalLabel);\n      }\n      return this.Fatal;\n    }\n    return new Severity(this.FatalLevel, label);\n  }\n}\n"],"names":["Random","fillBytes","window","crypto","array","getRandomValues","msCrypto","Int8Array","i","length","Math","round","random","Uint8Array","Int16Array","Uint16Array","Int32Array","Uint32Array","TypeError","ByteOrder","BigEndian","LittleEndian","NativeEndian","NativeOrder","this","bom","ArrayBuffer","b","Error","Murmur3","mix","code","value","rotl","mixUint8Array","mixUint8ArrayBE","mixUInt8ArrayLE","offset","limit","word","mixString","string","mixStringBE","mixStringLE","k","n","utf8Length","c","codePointAt","charCodeAt","Strings","offsetByCodePoints","mash","distance","Lazy","target","context","defined","call","Equals","x","y","Symbol","hasInstance","equals","Object","defineProperty","instance","enumerable","configurable","HashCode","hashCode","Equivalent","epsilon","equivalentTo","Compare","compareTo","NaN","Identity","compare","xh","hash","yh","codes","nextCode","WeakMap","get","set","fromLike","Booleans","Boolean","Numbers","equal","isNaN","equivalent","abs","Epsilon","hashArrayBuffer","hashFloat64Array","hashInt32Array","Float64Array","Number","index","c1","c2","count","String","Identifiers","isStartChar","isPartChar","isValid","identifier","isReserved","Functions","Constructors","name","Arrays","empty","freeze","inserted","newElement","oldArray","newArray","Array","element","removed","oldElement","Values","p","q","order","min","Objects","isEmpty","prototype","hasOwnProperty","hasAnyKey","object","keys","hasAllKeys","key","newObject","oldKey","oldValue","getFirstKey","getFirstValue","getNextKey","mark","getNextValue","xKeys","yKeys","xKey","yKey","Date","getTime","isArray","FromLike","type","likeness","arguments","ToLike","toLike","Creatable","create","Observable","observe","unobserve","Consumable","consume","unconsume","Cursor","newValue","iterator","EmptyCursor","unary","UnaryCursor","ArrayCursor","cursor","KeysCursor","values","ValuesCursor","__esDecorate","_a","_static_empty_decorators","kind","static","private","access","has","obj","metadata","_metadata","_staticExtraInitializers","__runInitializers","head","step","skip","hasNext","nextIndex","next","done","hasPrevious","previousIndex","previous","constructor","super","max","delete","Mapping","_super","domain","range","mapping","setPrototypeOf","canEqual","that","toString","Function","Piecewise","intervals","piecewise","interval","union","lo","hi","mid","u","s","Domain","x0","x1","Range","unit","contains","x00","x01","x10","x11","LinearDomain","y0","y1","y00","y01","y10","y11","y0Order","y1Order","LinearRange","Constant","Interpolate","interpolateTo","Interpolator","interpolator","IdentityInterpolator","NumberInterpolator","ArrayInterpolator","StepInterpolator","map","transform","InterpolatorMap","InterpolatorInterpolator","phase","interpolators","interpolatorCount","Timing","easing","t0","t1","timing","t","withDomain","withDuration","dt","overRange","Tweening","fromInit","init","Easing","linear","quadIn","quadOut","quadInOut","cubicIn","cubicOut","cubicInOut","quartIn","quartOut","quartInOut","expoIn","expoOut","expoInOut","circIn","circOut","circInOut","backIn","backOut","backInOut","elasticIn","elasticOut","elasticInOut","bounceIn","bounceOut","bounceInOut","v","pow","sqrt","st","m","PI","asin","sin","st1","invert","tweening","Scale","ContinuousScale","dx","LinearDomainInterpolator","LinearRangeInterpolator","LinearScale","scale","inverse","clampDomain","xMin","xMax","zMin","zMax","dy","z","dz","xSum","solveDomain","x2","y2","reflect","y3","x3","LinearScaleInterpolator","s0","s1","AssertException","message","Assert","condition","ok","notOk","lhs","rhs","notEqual","identical","notIdentical","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","notLessThan","notLessThanOrEqual","notGreaterThan","notGreaterThanOrEqual","instanceOf","notInstanceOf","compareLessThan","compareNotLessThan","compareLessThanOrEqual","compareNotLessThanOrEqual","compareEqual","compareNotEqual","compareGreaterThanOrEqual","compareNotGreaterThanOrEqual","compareGreaterThan","compareNotGreaterThan","Severity","level","label","isTrace","TraceLevel","isDebug","DebugLevel","isInfo","InfoLevel","isNote","NoteLevel","isWarning","WarningLevel","isError","ErrorLevel","isAlert","AlertLevel","isFatal","FatalLevel","localeCompare","trace","debug","info","note","warning","error","alert","fatal","TraceLabel","Trace","DebugLabel","Debug","InfoLabel","Info","NoteLabel","Note","WarningLabel","Warning","ErrorLabel","AlertLabel","Alert","FatalLabel","Fatal"],"mappings":";;;AAea,MAAAA,SAAS;EACpBC,WAAW;IACT,WAAWC,WAAW,eAAeA,OAAOC,gBAAgB,GAAG;MAC7D,OAAO,SAAUC;QACfF,OAAOC,OAAOE,gBAAgBD;AAChC;AACD,WAAM,WAAWF,WAAW,eAAgBA,OAAeI,kBAAkB,GAAG;MAC/E,OAAO,SAAUF;QACbF,OAAeI,SAAoBD,gBAAgBD;AACvD;AACD;IACD,OAAO,SAAUA;MACf,IAAIA,iBAAiBG,WAAW;QAC9B,KAAK,IAAIC,IAAI,GAAGA,IAAIJ,MAAMK,QAAQD,KAAK,GAAG;UACxCJ,MAAMI,KAAK,MAAME,KAAKC,MAAMD,KAAKE,WAAW;AAC7C;AACF,aAAM,IAAIR,iBAAiBS,YAAY;QACtC,KAAK,IAAIL,IAAI,GAAGA,IAAIJ,MAAMK,QAAQD,KAAK,GAAG;UACxCJ,MAAMI,KAAKE,KAAKC,MAAMD,KAAKE,WAAW;AACvC;AACF,aAAM,IAAIR,iBAAiBU,YAAY;QACtC,KAAK,IAAIN,IAAI,GAAGA,IAAIJ,MAAM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