@amazon/vinyl-hls-parser 1.2.0 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/hlsTestAssets/types/current/tsconfig.tsbuildinfo +1 -1
  2. package/dist/index.cjs +132 -57
  3. package/dist/index.cjs.map +4 -4
  4. package/dist/index.js +131 -56
  5. package/dist/index.js.map +4 -4
  6. package/dist/test/benchmark.es5.js +52 -36
  7. package/dist/test/benchmark.js +428 -260
  8. package/dist/test/benchmark.js.map +4 -4
  9. package/dist/types/current/index.d.ts +11 -10
  10. package/dist/types/current/index.d.ts.map +1 -1
  11. package/dist/types/current/index.js +11 -10
  12. package/dist/types/current/parse/parseMainPlaylist.d.ts +8 -3
  13. package/dist/types/current/parse/parseMainPlaylist.d.ts.map +1 -1
  14. package/dist/types/current/parse/parseMainPlaylist.js +27 -3
  15. package/dist/types/current/parse/parseMediaPlaylist.d.ts +11 -4
  16. package/dist/types/current/parse/parseMediaPlaylist.d.ts.map +1 -1
  17. package/dist/types/current/parse/parseMediaPlaylist.js +111 -7
  18. package/dist/types/current/tsconfig.tsbuildinfo +1 -1
  19. package/dist/types/current/types/AlternativeRendition.d.ts +13 -0
  20. package/dist/types/current/types/AlternativeRendition.d.ts.map +1 -1
  21. package/dist/types/current/types/HlsDateRange.d.ts +51 -0
  22. package/dist/types/current/types/HlsDateRange.d.ts.map +1 -0
  23. package/dist/types/current/types/HlsDateRange.js +11 -0
  24. package/dist/types/current/types/{MainPlaylist.d.ts → HlsMainPlaylist.d.ts} +4 -4
  25. package/dist/types/current/types/HlsMainPlaylist.d.ts.map +1 -0
  26. package/dist/types/{ts4.1/types/MediaPlaylist.d.ts → current/types/HlsMediaPlaylist.d.ts} +11 -4
  27. package/dist/types/current/types/HlsMediaPlaylist.d.ts.map +1 -0
  28. package/dist/types/ts3.7/index.d.ts +11 -10
  29. package/dist/types/ts3.7/parse/parseMainPlaylist.d.ts +8 -3
  30. package/dist/types/ts3.7/parse/parseMediaPlaylist.d.ts +11 -4
  31. package/dist/types/ts3.7/types/AlternativeRendition.d.ts +13 -0
  32. package/dist/types/ts3.7/types/HlsDateRange.d.ts +51 -0
  33. package/dist/types/ts3.7/types/{MainPlaylist.d.ts → HlsMainPlaylist.d.ts} +4 -4
  34. package/dist/types/ts3.7/types/{MediaPlaylist.d.ts → HlsMediaPlaylist.d.ts} +11 -4
  35. package/dist/types/ts4.1/index.d.ts +11 -10
  36. package/dist/types/ts4.1/parse/parseMainPlaylist.d.ts +8 -3
  37. package/dist/types/ts4.1/parse/parseMediaPlaylist.d.ts +11 -4
  38. package/dist/types/ts4.1/types/AlternativeRendition.d.ts +13 -0
  39. package/dist/types/ts4.1/types/HlsDateRange.d.ts +51 -0
  40. package/dist/types/{ts4.7/types/MainPlaylist.d.ts → ts4.1/types/HlsMainPlaylist.d.ts} +4 -4
  41. package/dist/types/{ts4.7/types/MediaPlaylist.d.ts → ts4.1/types/HlsMediaPlaylist.d.ts} +11 -4
  42. package/dist/types/ts4.7/index.d.ts +11 -10
  43. package/dist/types/ts4.7/parse/parseMainPlaylist.d.ts +8 -3
  44. package/dist/types/ts4.7/parse/parseMediaPlaylist.d.ts +11 -4
  45. package/dist/types/ts4.7/types/AlternativeRendition.d.ts +13 -0
  46. package/dist/types/ts4.7/types/HlsDateRange.d.ts +51 -0
  47. package/dist/types/{ts4.1/types/MainPlaylist.d.ts → ts4.7/types/HlsMainPlaylist.d.ts} +4 -4
  48. package/dist/types/{current/types/MediaPlaylist.d.ts → ts4.7/types/HlsMediaPlaylist.d.ts} +11 -4
  49. package/package.json +14 -14
  50. package/dist/types/current/types/MainPlaylist.d.ts.map +0 -1
  51. package/dist/types/current/types/MediaPlaylist.d.ts.map +0 -1
  52. /package/dist/types/current/types/{MainPlaylist.js → HlsMainPlaylist.js} +0 -0
  53. /package/dist/types/current/types/{MediaPlaylist.js → HlsMediaPlaylist.js} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../vinyl-util/src/util/type.ts", "../../../vinyl-util/src/error/ErrorOrigin.ts", "../../../vinyl-util/src/error/ReportableError.ts", "../../../vinyl-util/src/error/IllegalArgumentError.ts", "../../../vinyl-util/src/util/map/map.ts", "../../../vinyl-util/src/util/string/string.ts", "../../../vinyl-util/src/util/math/math.ts", "../../../vinyl-util/src/util/serialization/ParseError.ts", "../../../vinyl-util/src/util/string/StringReader.ts", "../../../vinyl-util/src/util/object/object.ts", "../../../vinyl-util/src/util/serialization/json.ts", "../../../vinyl-util/src/util/serialization/stringifyForPrint.ts", "../../../vinyl-util/src/error/ValidationError.ts", "../../../vinyl-validation/src/validation/Validator.ts", "../../../vinyl-validation/src/validation/andValidators.ts", "../../../vinyl-validation/src/validation/orValidators.ts", "../../../vinyl-validation/src/validation/SchemaBase.ts", "../../../vinyl-validation/src/validation/ValueSchema.ts", "../../../vinyl-validation/src/validation/validators.ts", "../../src/types/EncryptionKey.ts", "../../src/types/AlternativeRendition.ts", "../../src/parse/parseUtil.ts", "../../src/parse/parseAttributes.ts", "../../src/parse/parseMediaPlaylist.ts", "../../src/parse/parseMainPlaylist.ts", "../../../vinyl-util/test/browserTestUtil/mock/createSpyFactory.ts", "../../../vinyl-util/test/browserTestUtil/mock/dom/lib.dom.ts", "../../../vinyl-util/test/browserTestUtil/mock/dom/globals.ts", "../../../vinyl-util/test/browserTestUtil/expect/expectNothing.ts", "../../../vinyl-util/test/browserTestUtil/env/jasmineEnv.ts", "../../../vinyl-util/test/browserTestUtil/benchmark/Benchmark.ts", "../../test/benchmark/setup.ts", "../../test/benchmark/manifest/hls/parseHlsManifest.bench.ts"],
4
- "sourcesContent": ["/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/*\n * Type-safety utility\n */\n\n/**\n * Distributes the value types of an array into a union.\n */\nexport type Flatten<T> = T extends readonly any[] ? T[number] : T\n\n/**\n * Property keys of an object that do not map to functions.\n */\nexport type NonFunctionPropertyNames<T> = {\n [K in keyof T]: T[K] extends (...args: any) => any ? never : K\n}[keyof T]\n\n/**\n * All primitive types.\n */\nexport type Primitive =\n | bigint\n | boolean\n | number\n | string\n | symbol\n | null\n | undefined\n\n/**\n * An empty object, safer than using `object` type.\n */\nexport type AnyRecord = Record<never, any>\n\n/**\n * never, with a message to help explain the problem.\n * https://github.com/microsoft/TypeScript/issues/33098\n */\nexport type Never<Message extends string> = [never, Message]\n\n/**\n * A type representing any type of function.\n */\nexport type Fun = (...args: any[]) => any\n\n/**\n * Enforces that the type represents data that can be serialized via JSON.stringify.\n */\nexport type JsonCompatible<T> = unknown extends T\n ? never\n : T extends bigint | symbol | Fun\n ? never\n : T extends\n | boolean\n | number\n | string\n | null\n | undefined\n | { toJSON(): any }\n ? T\n : T extends readonly any[]\n ? readonly JsonCompatible<T[number]>[]\n : {\n [P in keyof T]: JsonCompatible<T[P]>\n }\n\n/**\n * A compile-time check that the given value/array/object is serializable via JSON.stringify.\n *\n * A value is serializable if any of these are true:\n * - It is an object with a toJSON() function\n * - It is an object with only serializable members.\n * - It is an array with only serializable elements.\n * - It is type boolean, string, number, null, or undefined.\n */\nexport function jsonCompatible<T>(value: JsonCompatible<T>): T {\n return value as T\n}\n\n/**\n * An object whose properties are all optional, and all sub-properties are optional.\n * Note: does not convert array or tuple elements to Partial.\n */\nexport type PartialDeep<T> = T extends Fun | Primitive\n ? T\n : T extends object\n ? {\n [P in keyof T]?: PartialDeep<T[P]>\n }\n : T\n\n/**\n * Defines specific properties of T that are not required.\n */\nexport type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>\n\n/**\n * Possible values `typeof` operator may return.\n */\nexport type Typeof =\n | 'bigint'\n | 'boolean'\n | 'function'\n | 'number'\n | 'object'\n | 'string'\n | 'symbol'\n | 'undefined'\n\n/**\n * Given a possible result from `typeof`, provides the type to the matched value.\n */\nexport type FromTypeof<T extends Typeof> = T extends 'bigint'\n ? bigint\n : T extends 'boolean'\n ? boolean\n : T extends 'function'\n ? Fun\n : T extends 'number'\n ? number\n : T extends 'object'\n ? object | null\n : T extends 'string'\n ? string\n : T extends 'symbol'\n ? symbol\n : T extends 'undefined'\n ? undefined\n : any\n\n/**\n * Extracts values from T which extends type U.\n */\nexport type ExtractValues<T, U> = Pick<\n T,\n {\n [P in keyof T]: T[P] extends U ? P : never\n }[keyof T]\n>\n\n/**\n * Excludes values from T which extends type U.\n */\nexport type ExcludeValues<T, U> = Pick<\n T,\n {\n [P in keyof T]: T[P] extends U ? never : P\n }[keyof T]\n>\n\nexport type Maybe<T> = T | undefined | null\n\n/**\n * Infers the element type from an Array type.\n */\nexport type ElementType<T extends readonly any[]> =\n T extends ReadonlyArray<infer E> ? E : never\n\n/**\n * Infers the element type from a Set type.\n */\nexport type SetElementType<T extends ReadonlySet<any>> =\n T extends ReadonlySet<infer E> ? E : never\n\n/**\n * Enforces type T to be in an invariant position.\n * For example `Invariant<Square>` cannot be assigned to type `Invariant<Polygon>` or vice versa.\n *\n * This should be used when an interface with type parameter T needs strict invariance in addition to what the\n * compiler can infer from use.\n *\n * {@link https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)}\n */\nexport type Invariant<T> = T &\n Required<T> &\n ((input: T & Required<T>) => T & Required<T>)\n\nexport function invariant<T>(): Invariant<T> {\n return undefined as any\n}\n\n/**\n * Enforces type T to be in a covariant position.\n * For example `Invariant<Square>` can be assigned to type `Invariant<Polygon>` but not vice versa.\n *\n * This should be used when an interface with type parameter T does not explicitly use T in an\n * output position, but the interface implies `out T`.\n */\nexport type Covariant<T> = () => T\n\nexport function covariant<T>(): Covariant<T> {\n return undefined as any\n}\n\n/**\n * Enforces type T to be in a covariant position.\n * For example `Invariant<Polygon>` can be assigned to type `Invariant<Square>` but not vice versa.\n *\n * This should be used when an interface with type parameter T does not explicitly use T in an\n * input position, but the interface implies `in T`.\n */\nexport type Contravariant<T> = (input: T) => void\n\nexport function contravariant<T>(): Contravariant<T> {\n return undefined as any\n}\n\n/**\n * A type which may either be a direct instance of T or a promise that resolves to T.\n */\nexport type MaybePromise<T> = PromiseLike<T> | T\n\n/**\n * Deeply excludes all keys from T extending K.\n */\nexport type OmitDeep<T, K extends keyof any> = Omit<\n {\n [P in keyof T]: T[P] extends Primitive ? T[P] : OmitDeep<T[P], K>\n },\n K\n>\n\n/**\n * Make properties of T extending K optional.\n */\nexport type Optional<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>\n\n/**\n * Make properties of T extending K optional, recursively.\n */\nexport type OptionalDeep<T, K extends keyof any> = Optional<\n {\n [P in keyof T]: T[P] extends Primitive ? T[P] : OptionalDeep<T[P], K>\n },\n K & keyof T\n>\n\n/**\n * true if T extends never, otherwise false\n */\nexport type IsNever<T> = [T] extends [never] ? true : false\n\n/**\n * true if T extends any, otherwise false\n */\nexport type IsAny<T> = 0 extends 1 & T ? true : false\n\n/**\n * Determines whether a property `P` of object type `U` is declared as optional.\n *\n * This checks whether the `{}` type (an empty object) is assignable to\n * `Pick<U, P>`. In TypeScript, this is true only when `P` is marked optional\n * using the `?` modifier in the type definition.\n *\n * Importantly, this detects *actual optionality* rather than checking whether\n * the property's type includes `undefined`. For example:\n *\n * ```ts\n * type A = { x?: string }; // optional\n * type B = { x: string | undefined }; // required but allows undefined\n *\n * IsPropertyOptional<A, \"x\"> // true\n * IsPropertyOptional<B, \"x\"> // false\n * ```\n *\n * @template U - The object type containing the property.\n * @template P - The key of the property to test.\n * @returns `true` if `P` is an optional property, otherwise `false`.\n */\nexport type IsPropertyOptional<U, P extends keyof U> =\n AnyRecord extends Pick<U, P> ? true : false\n\n/**\n * A type that equals true if Left and Right are loosely equal, that is, that Left extends Right\n * and Right extends Left.\n * This will always equal true or false, and never the union `true | false`\n */\nexport type Equal<Left, Right> = [Left] extends [Right]\n ? [Right] extends [Left]\n ? true\n : false\n : false\n\n/**\n * A type that equals true if Left and Right are strictly equal.\n * Works with complex objects, readonly, and optional modifiers.\n * Works with method input arguments.\n * This will always equal true or false, and never the union `true | false`\n */\nexport type StrictEqual<Left, Right> =\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters\n (<T>() => T extends Left ? 0 : 1) extends <T>() => T extends Right ? 0 : 1\n ? Equal<Left, Right>\n : false\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const ErrorOrigin = {\n /**\n * The error originated from Vinyl and was reported from the uncaught exception or promise\n * rejection handlers.\n */\n UNCAUGHT: 'uncaught',\n\n /**\n * The error originated from Vinyl and was caught.\n */\n INTERNAL: 'internal',\n\n /**\n * A Vinyl interface was used incorrectly by a consumer.\n */\n API: 'api',\n\n /**\n * The error originated from a failed service call (500 errors).\n */\n SERVICE_EXTERNAL: 'serviceExternal',\n\n /**\n * The error originated from a failed service call (400 errors).\n */\n SERVICE_INTERNAL: 'serviceInternal',\n\n /**\n * The error originated from a problem playing provided media.\n * The reporter is from a component such as the element, source buffer, media source, etc.\n */\n MEDIA: 'media',\n\n /**\n * The error originated from a problem parsing input data.\n * Such as a malformed Dash or HLS manifest.\n */\n PARSING: 'parsing',\n\n /**\n * The error originated from an incompatibility with browser APIs,\n * such as EME.\n */\n COMPATIBILITY: 'compatibility',\n\n /**\n * The error originated from DRM.\n * This does not include internal or service errors, only errors from the creation of media keys or media key\n * sessions.\n */\n DRM: 'drm',\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin } from './ErrorOrigin'\nimport type { Json } from '../util/serialization/json'\n\nexport enum ErrorLevel {\n /**\n * Fatal errors are not recoverable.\n */\n FATAL = 'fatal',\n\n /**\n * Warn level errors should be reported, but are recoverable.\n */\n WARN = 'warn',\n\n /**\n * Silent errors should not be reported. For example aborting a play operation due to a new track loading.\n */\n SILENT = 'silent',\n}\n\n/**\n * A Serializable Error that contains an error origin.\n */\nexport class ReportableError extends Error {\n get [Symbol.toStringTag](): string {\n return 'ReportableError'\n }\n\n constructor(\n message?: string,\n readonly origin: string = ErrorOrigin.INTERNAL,\n readonly level: ErrorLevel = ErrorLevel.FATAL\n ) {\n super(message)\n Object.setPrototypeOf(this, ReportableError.prototype)\n }\n\n get name(): string {\n return this[Symbol.toStringTag]\n }\n\n /**\n * All ReportableError instances must be serializable.\n */\n toJSON(): Json {\n return {\n level: this.level,\n message: this.message,\n name: this.name,\n origin: this.origin,\n stack: this.stack,\n }\n }\n}\n\n/**\n * Returns true if the given object is a ReportableError.\n */\nexport function isReportableError(error: any): error is ReportableError {\n // This does not use instanceof ReportableError to avoid ambiguity in the case where this module\n // is loaded multiple times due to version conflicts or code splitting.\n return error instanceof Error && 'origin' in error && 'level' in error\n}\n\n/**\n * Returns true if the error is a ReportableError and is level SILENT.\n * @param error\n */\nexport function isSilentError(error: any): boolean {\n return isReportableError(error) && error.level === ErrorLevel.SILENT\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin } from './ErrorOrigin'\nimport { ReportableError } from './ReportableError'\n\n/**\n * An error indicating that a method was called with illegal arguments.\n */\nexport class IllegalArgumentError extends ReportableError {\n get [Symbol.toStringTag](): string {\n return 'IllegalArgumentError'\n }\n\n constructor(\n message: string,\n readonly isInternal = true\n ) {\n super(message, isInternal ? ErrorOrigin.INTERNAL : ErrorOrigin.API)\n Object.setPrototypeOf(this, IllegalArgumentError.prototype)\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The minimal `Map`-shaped interface that {@link getOrSet} needs.\n */\ninterface GetOrSetMap<K, V> {\n has(key: K): boolean\n get(key: K): V | undefined\n set(key: K, value: V): unknown\n}\n\n/**\n * Gets the value on map for the given key if it exists, otherwise sets [key] to `defaultValue`,\n * returning the newly set value.\n *\n * @param map\n * @param key\n * @param defaultValue\n */\nexport function getOrSet<K, V>(\n map: GetOrSetMap<K, V>,\n key: K,\n defaultValue: (key: K) => V\n): V {\n if (map.has(key)) {\n return map.get(key) as V\n } else {\n const value = defaultValue(key)\n map.set(key, value)\n return value\n }\n}\n\n/**\n * Flips a map so that the keys become the values and the values become the keys.\n *\n * @param map\n * @return Returns a new map.\n */\nexport function flipMap<K, V>(map: Iterable<readonly [K, V]>): Map<V, K> {\n const result = new Map<V, K>()\n for (const [key, value] of map) {\n result.set(value, key)\n }\n return result\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IllegalArgumentError } from '../../error/IllegalArgumentError'\nimport { flipMap } from '../map/map'\nimport type { Maybe } from '../type'\nimport type { ReadonlyRecord } from '../object/readonlyType'\n\n/**\n * @private\n */\nconst locale = {\n variableNotDefined: \"Variable '{name}' is not defined\",\n} as const\n\n/**\n * The default substitution pattern, matching `{name}`.\n */\nconst DEFAULT_SUBSTITUTE_PATTERN = /\\{(\\w+)}/g\n\n/**\n * Substitutes named variable references in a string.\n *\n * Example:\n * ```\n * substitute('{fruit}, {veg}', { fruit: 'apples', veg: 'carrots' }) // 'apples, carrots'\n * ```\n *\n * @param str The template string.\n * @param variables A record of variable names to values.\n * @param pattern A regex whose first capture group is the variable name. Defaults to `{name}`.\n * @throws IllegalArgumentError if a referenced variable is not defined.\n */\nexport function substitute(\n str: string,\n variables: Readonly<Record<string, any>>,\n pattern: RegExp = DEFAULT_SUBSTITUTE_PATTERN\n): string {\n return str.replace(pattern, (_, name) => {\n if (!(name in variables)) {\n throw new IllegalArgumentError(\n locale.variableNotDefined.replace('{name}', String(name))\n )\n }\n return String(variables[name])\n })\n}\n\n/**\n * Replaces substitution tokens.\n *\n * Each identifier may be suffixed, within the enclosing '$' characters, with an additional format tag for number\n * padding following the prototype: `%0[width]d`\n * For example:\n * 'Segment_$Time%04d$' Where the `Time` property is `42` will have a replacement value of: `Segment_0042`\n */\nexport function substituteIdentifiers(\n str: string,\n props: ReadonlyRecord<string, string | number>\n): string {\n return str.replace(/\\$(\\w*)(?:%0(\\d+)d)?\\$/g, (_, match, maxLength) => {\n if (!match) return '$'\n if (!(match in props)) {\n throw new IllegalArgumentError(\n `Template substitution token '${match}' was not understood`\n )\n }\n let prop = String(props[match])\n if (maxLength) prop = prop.padStart(maxLength, '0')\n return prop\n })\n}\n\n/**\n * Returns true if the character is one of: ' ', '\\t', '\\n', '\\r'\n *\n * @param charCode The character code to test\n */\nexport function isWhitespaceChar(charCode: number): boolean {\n return (\n charCode === 0x20 || // ' ' (space)\n charCode === 0x09 || // '\\t' (tab)\n charCode === 0x0d || // '\\r' (carriage return)\n charCode === 0x0a // '\\n' (line feed)\n )\n}\n\nconst encodedEntitiesRegex = /&(#(\\d+)|\\w+);/gi\n\n/**\n * Predefined general xml entities\n * https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent\n */\nexport const predefinedDecodeEntities: ReadonlyMap<string, string> = new Map([\n ['apos', \"'\"],\n ['amp', '&'],\n ['lt', '<'],\n ['gt', '>'],\n ['quot', '\"'],\n])\n\n/**\n * Replaces all specified entities with their mapped representations.\n * For example (using {@link predefinedDecodeEntities}):\n * ```\n * `&lt;Hello to y&apos;all&#33;&gt;` becomes `<Hello to y'all!>`\n * ```\n *\n * @param str\n * @param namedEntities\n */\nexport function decodeEntities(\n str: string,\n namedEntities: ReadonlyMap<string, string> = predefinedDecodeEntities\n): string {\n if (encodedEntitiesRegex.test(str)) {\n return str.replace(\n encodedEntitiesRegex,\n (substring, entityName, codePoint) => {\n if (codePoint !== undefined)\n return String.fromCharCode(parseInt(codePoint))\n const entityValue = namedEntities.get(entityName.toLowerCase())\n if (!entityValue) return substring\n return entityValue\n }\n )\n } else {\n return str\n }\n}\n\nconst standardEntityValueToNames = flipMap(predefinedDecodeEntities)\nconst entitiesRegex = /['&<>\"]/g\n\n/**\n * Encodes the predefined xml standard entities into their entity names.\n *\n * & to &amp;\n * ' to &apos;\n * > to &gt;\n * < to &lt;\n * \" to &quot;\n *\n * @param str\n */\nexport function encodeEntities(str: string): string {\n if (entitiesRegex.test(str)) {\n return str.replace(entitiesRegex, (entityValue) => {\n const entityName = standardEntityValueToNames.get(entityValue)\n return `&${entityName};`\n })\n } else {\n return str\n }\n}\n\n/**\n * Returns true if the two strings are equal, optionally ignoring case.\n *\n * @param a\n * @param b\n * @param ignoreCase\n */\nexport function eqStr(\n a: string | null,\n b: string | null,\n ignoreCase = false\n): boolean {\n if (a == null && b == null) return true\n if (a == null || b == null) return false\n if (a === b) return true\n if (ignoreCase)\n return a.length === b.length && a.toLowerCase() === b.toLowerCase()\n return false\n}\n\n/**\n * Given a single character string, returns the char code of the first character.\n *\n * @param str A single character string from which to get the first code point.\n */\nexport function char(str: string): number {\n return str.charCodeAt(0)\n}\n\n/**\n * Returns the substring of string after the last instance of searchString, excluding searchString.\n * If searchString is not found, the whole string will be returned.\n *\n * @param string\n * @param searchString\n * @param caseSensitive If true (default) the search will be case-sensitive.\n */\nexport function substringAfterLast(\n string: string,\n searchString: string,\n caseSensitive = true\n): string {\n const i = (caseSensitive ? string : string.toLowerCase()).lastIndexOf(\n caseSensitive ? searchString : searchString.toLowerCase()\n )\n if (i === -1) return string\n return string.substring(i + searchString.length)\n}\n\n/**\n * Returns the substring of string before the first occurrence of searchString, excluding\n * searchString.\n * If searchString is not found, the whole string will be returned.\n *\n * @param string\n * @param searchString\n * @param caseSensitive If true (default) the search will be case-sensitive.\n */\nexport function substringBefore(\n string: string,\n searchString: string,\n caseSensitive = true\n): string {\n const i = (caseSensitive ? string : string.toLowerCase()).indexOf(\n caseSensitive ? searchString : searchString.toLowerCase()\n )\n if (i === -1) return string\n return string.substring(0, i)\n}\n\n/**\n * Tokenizes a string into lowercase alphanumeric words.\n *\n * E.g. `'Amazon Music x86_64'` becomes `['amazon', 'music', 'x86', '64']`\n *\n * @param str\n */\nexport function tokenizeWords(str: string): string[] {\n const words: string[] = []\n const regex = /[a-z\\d]+/gi\n let match: RegExpMatchArray | null\n while ((match = regex.exec(str))) {\n words.push(match[0].toLowerCase())\n }\n return words\n}\n\nexport function toLowerCase<T extends string>(str: T): Lowercase<T> {\n return str.toLowerCase() as Lowercase<T>\n}\n\nexport function toUpperCase<T extends string>(str: T): Uppercase<T> {\n return str.toUpperCase() as Uppercase<T>\n}\n\n/**\n * If the given string is greater than a max length, truncate the string with an indicator.\n * Example:\n * truncate('a very long string', 10) // 'a very ...'\n *\n * @param str A nullable string.\n * @param maxLength\n * @param indicator The string to indicate there was truncation, default is an ellipses \u2026 (U+2026)\n * @return Returns the truncated string, or the nullish value if str is nullish.\n */\nexport function truncate<T extends Maybe<string>>(\n str: T,\n maxLength: number,\n indicator = '\u2026'\n): T | string {\n if (str == null) return str\n if (str.length > maxLength)\n return str.substring(0, maxLength - indicator.length) + indicator\n return str\n}\n\n/**\n * Converts a string to kebab-case.\n *\n * This function transforms camelCase, PascalCase, snake_case, and space-separated\n * strings into a normalized kebab-case format. It removes non-alphanumeric characters\n * (excluding hyphens), collapses multiple delimiters, and trims leading/trailing hyphens.\n *\n * @example\n * toKebabCase(\"HelloWorld\") // \"hello-world\"\n * toKebabCase(\"hello_world test\") // \"hello-world-test\"\n * toKebabCase(\"SomeText123\") // \"some-text123\"\n *\n * @param str - The input string to convert.\n * @returns The kebab-case version of the input.\n */\nexport function toKebabCase(str: string): string {\n return str\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .replace(/[\\s_]+/g, '-')\n .replace(/[^a-zA-Z0-9-]/g, '')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '')\n .toLowerCase()\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Clamps the given value between `min` and `max`.\n *\n * @param value\n * @param min The lower bounds.\n * @param max The upper bounds. If this value is less than min, this value will always be returned.\n */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max)\n}\n\n/**\n * Linearly interpolates between `from` and `to` given a percentage.\n *\n * @param from The alpha = 0.0 value\n * @param to The alpha = 1.0 value\n * @param alpha A percentage where 0 is `from`, and 1 is `to`. E.g. 0.5 would return halfway\n * between `from` and `to`.\n */\nexport function lerp(from: number, to: number, alpha: number): number {\n return from + (to - from) * alpha\n}\n\n/**\n * Floors a value to the nearest snap interval.\n *\n * Examples:\n *\n * ```\n * floorToNearest(3, 2) // 2\n * floorToNearest(16, 5) // 15\n * floorToNearest(16, 5, 2) // 17\n * ```\n *\n * @param value The value to floor with the given snap interval and offset.\n * @param snap The interval between output values. Should be a finite, non-zero number.\n * @param offset The offset of the interval. E.g. if snap is 10 and offset is 1, values will be\n * snapped to `-19, -9, 1, 11, 21, 31, 41, ...`\n */\nexport function floorToNearest(\n value: number,\n snap: number,\n offset = 0\n): number {\n return Math.floor((value - offset) / snap) * snap + offset\n}\n\n/**\n * Ceilings a value to the nearest snap interval.\n *\n * Examples:\n *\n * ```\n * ceilToNearest(3, 2) // 4\n * ceilToNearest(16, 5) // 20\n * ceilToNearest(10, 5) // 10\n * ceilToNearest(16, 5, 2) // 22\n * ```\n *\n * @param value The value to ceil with the given snap interval and offset.\n * @param snap The interval between output values. Should be a finite, non-zero number.\n * @param offset The offset of the interval. E.g. if snap is 10 and offset is 1, values will be\n * snapped to `-19, -9, 1, 11, 21, 31, 41, ...`\n */\nexport function ceilToNearest(value: number, snap: number, offset = 0): number {\n return Math.ceil((value - offset) / snap) * snap + offset\n}\n\n/**\n * Rounds a value to the nearest snap interval.\n *\n * Examples:\n *\n * ```\n * roundToNearest(3, 2) // 4\n * roundToNearest(16, 5) // 15\n * roundToNearest(18, 5) // 20\n * roundToNearest(16, 10, 2) // 22\n * ```\n *\n * @param value The value to round with the given snap interval and offset.\n * @param snap The interval between output values. Should be a finite, non-zero number.\n * @param offset The offset of the interval. E.g. if snap is 10 and offset is 1, values will be\n * snapped to `-19, -9, 1, 11, 21, 31, 41, ...`\n */\nexport function roundToNearest(\n value: number,\n snap: number,\n offset = 0\n): number {\n return Math.round((value - offset) / snap) * snap + offset\n}\n\n/**\n * Returns true if `x` is within `tolerance` of `y`.\n *\n * @param x\n * @param y\n * @param tolerance\n */\nexport function closeTo(\n x: number,\n y: number,\n tolerance: number = Number.EPSILON\n): boolean {\n return Math.abs(x - y) <= tolerance\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { clamp } from '../math/math'\n\nexport interface ParseError {\n /**\n * The full reason and location.\n */\n readonly message: string\n\n /**\n * The reason for the error.\n */\n readonly reason: string\n\n /**\n * A description of the location the error occurred.\n */\n readonly location: string\n}\n\nexport interface PrintStringPositionOptions {\n /**\n * The maximum number of character columns to output.\n * The number of columns shown will be the min of this value and the number of columns\n * at the index row.\n * The default is 60.\n */\n maxColumns?: number\n\n /**\n * The caret indicator.\n * The caret will be printed on a second row, directly underneath the column index\n * represents. This may more than one character, where the first character will align\n * with the index column.\n * The default value is '^'.\n */\n caret?: string\n\n /**\n * A number between 0 and 1 representing the percentage of trailing to leading characters.\n * 0 Indicates all trailing, 1 indicates all leading, and 0.5 indicates that the index\n * column is as close to the middle as possible.\n * The default value is 0.6.\n */\n split?: number\n}\n\n/**\n * Given a string and a position index, gets the row the index represents, displaying the\n * surrounding characters, with a second row showing a caret indicator pointing at the index.\n *\n * @param str\n * @param index The\n * @param options Display options\n */\nexport function printStringPosition(\n str: string,\n index: number,\n options?: PrintStringPositionOptions\n): string {\n const caret = options?.caret || '^'\n index = clamp(index, 0, str.length)\n const minIndex = str.lastIndexOf('\\n', index - 1) + 1\n let maxIndex = str.indexOf('\\n', index)\n if (maxIndex === -1) maxIndex = str.length\n const split = options?.split === undefined ? 0.6 : options.split\n const cols = (options?.maxColumns ?? 60) - caret.length\n let leadingChars = cols * split\n let trailingChars = cols * (1 - split)\n const maxLeadingChars = index - minIndex\n const maxTrailingChars = maxIndex - index\n if (leadingChars > maxLeadingChars) {\n trailingChars += leadingChars - maxLeadingChars\n leadingChars = maxLeadingChars\n if (trailingChars > maxTrailingChars) trailingChars = maxTrailingChars\n } else if (trailingChars > maxTrailingChars) {\n leadingChars += trailingChars - maxTrailingChars\n trailingChars = maxTrailingChars\n if (leadingChars > maxLeadingChars) leadingChars = maxLeadingChars\n }\n let out = str.substring(index - leadingChars, index + trailingChars) + '\\n'\n out += ' '.repeat(leadingChars) + caret\n return out\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin } from '../../error/ErrorOrigin'\nimport { ReportableError } from '../../error/ReportableError'\nimport type { ParseError } from '../serialization/ParseError'\nimport { printStringPosition } from '../serialization/ParseError'\nimport { eqStr, isWhitespaceChar } from './string'\nimport type { Json } from '../serialization/json'\n\n/**\n * A cursor on a string that allows for fast, naive parsing.\n */\nexport class StringReader {\n /**\n * @param data The string to read.\n */\n constructor(public data: string) {}\n\n /**\n * The current cursor.\n * This should always be between the range 0 and `data.length`\n */\n position = 0\n\n /**\n * Returns true if the current {@link position} is less than the source data's length.\n */\n hasNext(): boolean {\n return this.position < this.data.length\n }\n\n /**\n * Returns the number of characters remaining to be read.\n */\n get remaining(): number {\n return this.data.length - this.position\n }\n\n /**\n * Returns the length of {@link data}.\n */\n get length(): number {\n return this.data.length\n }\n\n /**\n * Throws a {@link StringParseError} where the location uses {@link printStringPosition} to\n * show a friendly message indicating the current position.\n *\n * @param message\n * @param offset The offset to add to the current position.\n */\n err(message: string, offset = 0): never {\n throw new StringParseError(this.data, this.position + offset, message)\n }\n\n /**\n * Reads and returns the character code at the current position.\n * To read the next character without advancing the cursor, use {@link peek}\n *\n * Note:\n * This method has no bounds checking; if {@link position} is greater than or equal to\n * `str.length` then NaN will be returned and {@link position} will still be incremented.\n *\n * @see String.charCodeAt\n */\n next(): number {\n return this.data.charCodeAt(this.position++)\n }\n\n /**\n * Reads characters until the predicate returns false or the data length has been reached.\n *\n * @param predicate Given the char code at the cursor index, returns true if the character\n * should be included in the substring result.\n * @returns number The start position.\n */\n while(predicate: (charCode: number) => boolean): number {\n const start = this.position\n let i = start\n const n = this.data.length\n while (i < n && predicate(this.data.charCodeAt(i))) i++\n this.position = i\n return start\n }\n\n /**\n * Reads characters until the predicate returns true or the string length has been reached.\n *\n * @param predicate\n * @returns number Returns the start index.\n */\n until(predicate: (charCode: number) => boolean): number {\n return this.while((charCode) => !predicate(charCode))\n }\n\n /**\n * Reads characters until the given character has been found or the string length has been\n * reached.\n *\n * @param charCode\n * @return number Returns the start index.\n */\n untilChar(charCode: number): number {\n return this.until((cc) => cc === charCode)\n }\n\n /**\n * Reads characters until the given string has been found or the string length has been\n * reached.\n *\n * @param string The string to match\n * @return number Returns the start index.\n */\n untilString(string: string): number {\n const start = this.position\n const index = this.data.indexOf(string, this.position)\n this.position = index === -1 ? this.data.length : index\n return start\n }\n\n /**\n * The same as {@link while} except returns the read substring as a result.\n */\n substringWhile(predicate: (charCode: number) => boolean): string {\n return this.data.substring(this.while(predicate), this.position)\n }\n\n /**\n * The same as {@link until} except returns the read substring as a result.\n */\n substringUntil(predicate: (charCode: number) => boolean): string {\n return this.substringWhile((charCode) => !predicate(charCode))\n }\n\n /**\n * The same as {@link untilChar} except returns the read substring as a result.\n */\n substringUntilChar(charCode: number): string {\n return this.substringWhile((iCharCode) => charCode !== iCharCode)\n }\n\n /**\n * Reads the substring from the current index with the given length.\n *\n * @param length\n */\n substr(length: number): string {\n const sub = this.data.substring(this.position, this.position + length)\n this.position += sub.length\n return sub\n }\n\n /**\n * Reads the expected string from the current position.\n * If the read string doesn't match the given string, a {@link StringParseError} is thrown.\n *\n * @param str The string required to match at the current position.\n * @param ignoreCase If true, the comparison will be case-insensitive.\n */\n read(str: string, ignoreCase = false): string {\n const actual = this.substr(str.length)\n if (!eqStr(actual, str, ignoreCase))\n this.err(`Expected '${str}', actual: '${actual}'`)\n return actual\n }\n\n /**\n * Reads the expected char code from the current position.\n * If the read character doesn't match the given character, a {@link StringParseError} is\n * thrown.\n *\n * @param charCode The character code required to match at the current position.\n */\n readChar(charCode: number): number {\n const actual = this.next()\n if (actual !== charCode)\n this.err(\n `Expected '${String.fromCharCode(charCode)}', ` +\n `actual: '${String.fromCharCode(actual)}'`\n )\n return actual\n }\n\n /**\n * Returns the character at the current position without advancing the cursor.\n *\n * Note:\n * This method has no bounds checking; if {@link position} is greater than or equal to\n * `str.length` then `NaN` will be returned.\n *\n * @see String.charCodeAt\n */\n get peek(): number {\n return this.data.charCodeAt(this.position)\n }\n\n /**\n * Reads through all whitespace characters, returning the starting index.\n */\n white(): number {\n return this.while(isWhitespaceChar)\n }\n\n /**\n * If {@link peek} equals the given character code, returns true and advances the index by\n * one.\n *\n * @param charCode\n */\n charIf(charCode: number): boolean {\n if (this.peek === charCode) {\n this.next()\n return true\n } else {\n return false\n }\n }\n\n /**\n * If the given string matches the substring at the current position, returns true and advances\n * the index by the string's length.\n */\n stringIf(string: string, ignoreCase = false): boolean {\n if (this.remaining < string.length) return false\n const substr = this.data.substring(\n this.position,\n this.position + string.length\n )\n const match = eqStr(substr, string, ignoreCase)\n if (match) this.position += string.length\n return match\n }\n}\n\nconst locale = {\n messageSeparator: ', at: \\n',\n} as const\n\nexport class StringParseError extends ReportableError implements ParseError {\n get [Symbol.toStringTag](): string {\n return 'StringParseError'\n }\n\n readonly location: string\n\n constructor(\n str: string,\n readonly position: number,\n readonly reason: string\n ) {\n const location = printStringPosition(str, position)\n super(\n `${reason}${locale.messageSeparator}${location}`,\n ErrorOrigin.PARSING\n )\n this.location = location\n Object.setPrototypeOf(this, StringParseError.prototype)\n }\n\n toJSON(): Json {\n return {\n ...super.toJSON(),\n position: this.position,\n location: this.location,\n reason: this.reason,\n }\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Returns the keys (both property names and symbols) of all own properties.\n * Unlike `Object.keys`, this will also return non-enumerable properties.\n * Does not return keys inherited from the object's prototype.\n *\n * Implementation details:\n * If Reflect is supported, Reflect.ownKeys will be used, wrapping in a Set, otherwise\n * Object.getOwnPropertyNames and Object.getOwnPropertySymbols will be used. This will typically\n * be equivalent. Proxies may alter the order of keys but platforms that do not support Reflect\n * will also typically not support Proxies.\n *\n * @see Reflect.ownKeys\n * @see Object.getOwnPropertyNames\n * @see Object.getOwnPropertySymbols\n * @param obj\n * @return Returns a `Set` of the own properties of the target object, including non-enumerable.\n * The ordering will be: positive numeric indexes in order, strings in insertion order,\n * symbols in insertion order.\n */\nexport function ownKeys<T>(obj: T): Set<keyof T> {\n if (!obj) return new Set()\n if (typeof Reflect !== 'undefined')\n return new Set(Reflect.ownKeys(obj) as (keyof T)[])\n const properties = new Set()\n Object.getOwnPropertyNames(obj).forEach((item) => properties.add(item))\n Object.getOwnPropertySymbols(obj).forEach((item) => properties.add(item))\n return properties as Set<keyof T>\n}\n\n/**\n * Returns the prototype chain of the given object.\n *\n * Example:\n * ```\n * class A {}\n * class B extends A {}\n * class C extends B {}\n * const c = new C()\n * getPrototypeChain(c) // [c, C.prototype, B.prototype, A.prototype, Object.prototype]\n * ```\n * @param obj\n */\nexport function getPrototypeChain(obj: any): any[] {\n const out = []\n let current = obj\n do {\n out.push(current)\n } while ((current = Object.getPrototypeOf(current)))\n return out\n}\n\n/**\n * Returns true if the given object represents a plain object and not a class instance.\n */\nexport function isPlainObject(value: any): boolean {\n if (!value || typeof value !== 'object' || Array.isArray(value))\n return false\n const proto = Object.getPrototypeOf(value)\n // if not the null prototype, not a plain object:\n return !proto || !Object.getPrototypeOf(proto)\n}\n\n/**\n * Gets the object's value for the given key if it exists, otherwise sets [key] to\n * `defaultValue`, returning the newly set value.\n *\n * @param object\n * @param key\n * @param defaultValue\n */\nexport function getOrSetProp<K extends keyof T, T extends object>(\n object: T,\n key: K,\n defaultValue: () => T[K]\n): T[K] {\n if (key in object) {\n return object[key]\n } else {\n const value = defaultValue()\n object[key] = value\n return value\n }\n}\n\n/**\n * Returns true if value is not null. Provides a type guard which can be used in filters.\n * Example:\n * [1, null, 2, 3, null, 4].filter(isNonNull) // type number[]\n * @param value\n */\nexport function isNonNull<T>(value: T): value is NonNullable<T> {\n return value != null\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { isPlainObject } from '../object/object'\nimport type { AnyRecord, Fun, IsAny } from '../type'\n\n/**\n * A representation of the conversion the toJson function will apply to make an input JSON compatible.\n */\nexport type Json<T = any> =\n IsAny<T> extends true\n ? // inputs of type `any` are allowed, use AnyRecord as the mapped type to pass JsonCompatible<T> validation.\n AnyRecord\n : unknown extends T\n ? never\n : T extends bigint | symbol | Fun\n ? string\n : T extends { toJSON(): infer R }\n ? R\n : T extends boolean | number | string | null | undefined\n ? T\n : T extends Set<infer U>\n ? Json<U>[]\n : T extends readonly any[]\n ? Json<T[number]>[]\n : {\n [P in keyof T]: Json<T[P]>\n }\n\n/**\n * Converts a dynamic value to a serializable value.\n * The value must be either an object with a toJSON function, a primitive, or a plain object\n * where all enumerable properties map to values supported by this function.\n * Properties not enumerable will be omitted, properties not serializable will be converted\n * to strings.\n * - bigint -> value.toString\n * - function -> [function <name>]\n * - symbol -> [symbol <name>]\n *\n * Error instances have a special case where non-serializable errors will still have their\n * name, message, and stack properties serialized.\n *\n * Note that this is not intended for use in serializing objects where all values are known;\n * it's intended to cover the case of reporting or logging an unknown object that may or may not\n * be serializable.\n *\n * @param value\n */\nexport function toJson<T>(value: T): Json<T> {\n return toJsonInternal(value, new Set())\n}\n\nfunction toJsonInternal(value: any, visited: Set<any>): any {\n switch (typeof value) {\n case 'object':\n return objectToJsonInternal(value, visited)\n case 'undefined':\n case 'boolean':\n case 'number':\n case 'string':\n return value\n case 'function':\n return `[function ${value.name}]`\n case 'symbol':\n return `[symbol ${value.toString().slice(7, -1)}]`\n case 'bigint':\n return value.toString()\n }\n}\n\nfunction objectToJsonInternal(value: any, visited: Set<any>): any {\n if (value == null) return value\n if (visited.has(value)) return `<circular reference: ${String(value)}>`\n visited.add(value)\n if ('toJSON' in value && typeof value.toJSON === 'function')\n return value.toJSON()\n if (value instanceof Set) {\n return Array.from(value).map((e) => toJsonInternal(e, visited))\n } else if (Array.isArray(value)) {\n return value.map((e) => toJsonInternal(e, visited))\n } else {\n if (isPlainObject(value)) {\n const o: Record<any, any> = {}\n for (const key in value) {\n o[key] = toJsonInternal(value[key], visited)\n }\n return o\n } else if (value instanceof Error) {\n // non-enumerable properties\n return {\n name: value.name,\n message: value.message,\n stack: value.stack,\n }\n } else {\n return value.toString()\n }\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { toJson } from './json'\nimport { truncate } from '../string/string'\n\n/**\n * Stringifies a value suitable for human-readable messages.\n *\n * The value is first run through {@link toJson} which makes it safe for serialization.\n * (Circular references will become strings, and toJSON serializers will be respected)\n * The safe json is then stringified, using a JSON.stringify replacer that preserves\n * representations for NaN, Infinity, undefined, and Symbol.\n *\n * @param value Any value.\n * @param maxLength If provided, will truncate the final string.\n * @param indicator The truncation indicator.\n */\nexport function stringifyForPrint(\n value: any,\n maxLength?: number,\n indicator = '\u2026'\n): string {\n // Preserve Symbol, function, and undefined, NaN, and +/- Infinity\n let str = JSON.stringify(\n toJson(value),\n (_, value) => {\n const type = typeof value\n if (['undefined'].includes(type)) {\n return `{{${String(value)}}}`\n }\n if (type === 'number') {\n if (Number.isNaN(value) || !Number.isFinite(value))\n return `{{${value.toString()}}}`\n }\n return value\n },\n ' '\n )\n // Replace templated\n\n str = str.replace(/(\"\\{\\{.*}}\")/g, (_, s) => {\n return s.substring(3, s.length - 3)\n })\n if (maxLength) str = truncate(str, maxLength, indicator)\n return str\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ReportableError } from './ReportableError'\nimport { ErrorOrigin } from './ErrorOrigin'\nimport type { Json } from '../util/serialization/json'\n\n/**\n * An error indicating that input had an invalid shape.\n */\nexport class ValidationError extends ReportableError {\n get [Symbol.toStringTag](): string {\n return 'ValidationError'\n }\n\n /**\n * @param message The validation error message.\n * @param origin The error origin, typically API (default) or SERVICE_EXTERNAL\n * @param path The property path to the invalid field.\n */\n constructor(\n message: string,\n origin: string = ErrorOrigin.API,\n readonly path: readonly string[] = []\n ) {\n super(message, origin)\n Object.setPrototypeOf(this, ValidationError.prototype)\n }\n\n toJSON(): Json {\n return {\n ...super.toJSON(),\n origin: this.origin,\n path: this.path,\n }\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { type Invariant, ValidationError } from '@amazon/vinyl-util'\nimport { stringifyForPrint, substitute } from '@amazon/vinyl-util'\n\n/**\n * Represents a validation failure.\n */\nexport interface ValidationErrorMessage {\n readonly message: string\n readonly path: readonly string[]\n}\n\nexport interface ValidationOptions {\n /**\n * If true, collect all validation errors.\n * Default: false\n */\n readonly all?: boolean\n}\n\n/**\n * A Validator can assert that an input matches this validator's schema.\n */\nexport interface Validator<Output extends Input, in Input = unknown> {\n /**\n * Enforces T is in an invariant position.\n * This prevents a validator with more strict rules is assigned to a less strict type, which\n * can cause unexpected validation errors.\n */\n __type?: Invariant<Output>\n\n /**\n * A short description of the validator.\n */\n readonly description: string\n\n /**\n * Returns true if the input is valid according to this validator.\n *\n * @param input\n */\n readonly isValid: (input: Input) => input is Output\n\n /**\n * Validates the provided input, returning a list of error messages, or an empty array if the\n * input passes this validator.\n *\n * @param input The input to validate.\n * @param options Validation options.\n * @param path The current field path to this validator.\n * @return Returns an array of validation failures. If `options.all` is not true, only the\n * first error will be returned.\n */\n readonly validate: (\n input: Input,\n options?: ValidationOptions,\n path?: readonly string[]\n ) => readonly ValidationErrorMessage[]\n\n /**\n * Validates the given input, asserting that the input is type `T`.\n * If the input is not valid, a {@link ValidationError} will be thrown.\n *\n * @param input The input to validate.\n * @param origin The error origin. `ErrorOrigin.API` by default.\n * @param path The current field path to this validator.\n * @return Returns the input, cast as the validated type T\n */\n readonly assert: (\n input: Input,\n origin?: string,\n path?: readonly string[]\n ) => asserts input is Output\n}\n\n/**\n * @private\n */\nconst validatorLocale = {\n /**\n * The expectation template string with the following replacement tokens:\n *\n * `{expected}` - The expected description.\n * `{actual}` - The actual value.\n * `{path}` - The path, dot separated.\n */\n template: 'Expected: {expected}, but was: {actual}. At: {path}',\n}\n\n/**\n * Creates a message string for a ValidationErrorMessage based on the input and its expectation.\n *\n * @param expectationMessage\n * @param input\n * @param path\n * @param inputStringify\n */\nexport function createValidationExpectationMessage<Input>(\n expectationMessage: string,\n input: Input,\n path: readonly string[],\n inputStringify: (input: Input) => string = (input) =>\n stringifyForPrint(input, 500)\n): string {\n return substitute(validatorLocale.template, {\n expected: expectationMessage,\n actual: inputStringify(input),\n path: path.join('.'),\n })\n}\n\n/**\n * Creates a new basic validator.\n *\n * For a deep validator which has sub-fields, use {@link createDeepValidator}.\n *\n * @param expectationMessage The message to use to describe what is expected. This will be used in\n * the error message template.\n * @param isValid Returns true if the given input is valid.\n * @param inputStringify Stringifies the input for use as the actual `{actual}` token in the validation\n * expectation template. Default is `stringifyForPrint` with a 500 character max length.\n */\nexport function createValidator<Output extends Input, Input = unknown>(\n expectationMessage: string,\n isValid: (input: Input) => boolean,\n inputStringify: (input: Input) => string = (input) =>\n stringifyForPrint(input, 500)\n): Validator<Output, Input> {\n return {\n description: expectationMessage,\n\n isValid(input: Input): input is Output {\n return isValid(input)\n },\n\n validate(\n input: Input,\n _?: ValidationOptions,\n path: readonly string[] = []\n ): readonly ValidationErrorMessage[] {\n if (!isValid(input)) {\n return [\n {\n message: createValidationExpectationMessage(\n expectationMessage,\n input,\n path,\n inputStringify\n ),\n path,\n },\n ]\n }\n return []\n },\n\n assert: (\n input: Input,\n origin?: string,\n path: readonly string[] = []\n ): asserts input is Output => {\n if (!isValid(input)) {\n throw new ValidationError(\n createValidationExpectationMessage(\n expectationMessage,\n input,\n path,\n inputStringify\n ),\n origin,\n path\n )\n }\n },\n }\n}\n\n/**\n * Creates a new deep validator.\n *\n * For a shallow validator which validates one value, use {@link createValidator}.\n *\n * @param description Describes the validator.\n * @param validate Returns an array of validation failures.\n */\nexport function createDeepValidator<Output extends Input, Input = unknown>(\n description: string,\n validate: (\n input: Input,\n options: ValidationOptions,\n path: readonly string[]\n ) => readonly ValidationErrorMessage[]\n): Validator<Output, Input> {\n return {\n description,\n\n isValid(input: Input): input is Output {\n return validate(input, { all: false }, []).length === 0\n },\n\n validate(\n input: Input,\n options?: ValidationOptions,\n path: readonly string[] = []\n ): readonly ValidationErrorMessage[] {\n return validate(input, options ?? { all: false }, path)\n },\n\n assert: (\n input: Input,\n origin?: string,\n path: readonly string[] = []\n ): asserts input is Output => {\n const errors = validate(input, { all: false }, path)\n if (errors.length) {\n const error = errors[0]\n throw new ValidationError(error.message, origin, error.path)\n }\n },\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { substitute } from '@amazon/vinyl-util'\nimport type { Validator } from './Validator'\nimport { createDeepValidator } from './Validator'\n\n/*\n * @brief\n * andValidators will intersect an arbitrary number of validators.\n *\n * While in most cases validating that an input passes two validators, the asserted output is the\n * intersection of those two validator outputs, this is not always the case.\n * For example, take two validators with outputs `A[]` and `B[]`, their combined validated output\n * type would be `(A & B)[]`, not `A[] & B[]`. Use casting when necessary.\n *\n * Also note that there is no contravariance safety with the chained validator inputs. That is,\n * there's no compile-time checking that validatorB accepts an input that is the super of\n * validatorA's output.\n */\n\n/**\n * @private\n */\nconst locale = {\n /**\n * {value} The child validators' descriptions, joined with `separator`.\n *\n * groupings of and validators is unimportant,\n * and(and(a, b), c) is the same as and(a, and(b, c)), so `a & b & c` is an accurate\n * representation for either.\n */\n template: '{value}',\n\n /**\n * The separator with which to join child validator descriptions.\n */\n separator: ' & ',\n} as const\n\n/**\n * Validates that all the given validators pass.\n */\nexport function andValidators<A extends Input, B, Input>(\n validatorA: Validator<A, Input>,\n validatorB: Validator<B, any>\n): Validator<A & B, Input>\n\n/**\n * Validates that all the given validators pass.\n */\nexport function andValidators<A extends Input, B, C, Input>(\n validatorA: Validator<A, Input>,\n validatorB: Validator<B, any>,\n validatorC: Validator<C, any>\n): Validator<A & B & C, Input>\n\n/**\n * Validates that all the given validators pass.\n */\nexport function andValidators<A extends Input, B, C, D, Input>(\n validatorA: Validator<A, Input>,\n validatorB: Validator<B, any>,\n validatorC: Validator<C, any>,\n validatorD: Validator<D, any>\n): Validator<A & B & C & D, any>\n\n/**\n * Validates that all the given validators pass.\n */\nexport function andValidators<A extends Input, B, C, D, E, Input>(\n validatorA: Validator<A, Input>,\n validatorB: Validator<B, any>,\n validatorC: Validator<C, any>,\n validatorD: Validator<D, any>,\n validatorE: Validator<E, any>\n): Validator<A & B & C & D & E, any>\n\nexport function andValidators(\n ...validators: Validator<any, any>[]\n): Validator<any, any>\n\nexport function andValidators(\n ...validators: Validator<any, any>[]\n): Validator<any, any> {\n return createDeepValidator(\n substitute(locale.template, {\n value: validators.map((v) => v.description).join(locale.separator),\n }),\n (input, options, path) => {\n for (const validator of validators) {\n const errors = validator.validate(input, options, path)\n if (errors.length) return errors\n }\n return []\n }\n )\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { substitute } from '@amazon/vinyl-util'\nimport type { ValidationErrorMessage, Validator } from './Validator'\nimport {\n createDeepValidator,\n createValidationExpectationMessage,\n} from './Validator'\n\n/*\n * @brief\n * orValidators will union an arbitrary number of validators.\n * input type is always type any; it's not strictly necessary for all validators to accept the same\n * input type. For example, if validatorA asserts that a value is not null, validatorB can safely\n * assume its input is not null.\n * output type will be the union of the validator outputs up to 5 validators, 6 or more will be\n * type any.\n */\n\n/**\n * @private\n */\nconst locale = {\n /**\n * {value} - The child validators' descriptions, joined with `separator`.\n */\n template: '({value})',\n\n /**\n * The separator with which to join child validator descriptions.\n */\n separator: ' | ',\n} as const\n\n/**\n * Validates that one of the given validators pass.\n */\nexport function orValidators<A, B>(\n validatorA: Validator<A, any>,\n validatorB: Validator<B, any>\n): Validator<A | B, any>\n\n/**\n * Validates that one of the given validators pass.\n */\nexport function orValidators<A, B, C>(\n validatorA: Validator<A, any>,\n validatorB: Validator<B, any>,\n validatorC: Validator<C, any>\n): Validator<A | B | C, any>\n\n/**\n * Validates that one of the given validators pass.\n */\nexport function orValidators<A, B, C, D>(\n validatorA: Validator<A, any>,\n validatorB: Validator<B, any>,\n validatorC: Validator<C, any>,\n validatorD: Validator<D, any>\n): Validator<A | B | C | D, any>\n\n/**\n * Validates that one of the given validators pass.\n */\nexport function orValidators<A, B, C, D, E>(\n validatorA: Validator<A, any>,\n validatorB: Validator<B, any>,\n validatorC: Validator<C, any>,\n validatorD: Validator<D, any>,\n validatorE: Validator<E, any>\n): Validator<A | B | C | D | E, any>\n\nexport function orValidators(\n ...validators: Validator<any, any>[]\n): Validator<any, any>\n\n/**\n * Validates that one of the given validators pass.\n *\n * If all validators fail, the validator that produced an error at the deepest path will have its\n * error message bubbled. If all validators failed at the current depth, a concatenation of\n * validator descriptions will be used.\n *\n * For example:\n * `orValidators(number(), string()).validate(false)` will produce the message:\n * 'Expected (number | string), but was false, At: '\n *\n * And:\n * `orValidators(number(), object({ childProp: number() })).validate({ childProp: 'not-a-number' })`\n * will produce:\n * 'Expected number, but was \"not-a-number\", At: childProp'\n *\n * @param validators The validators to test.\n */\nexport function orValidators(\n ...validators: Validator<any, any>[]\n): Validator<any, any> {\n const description = substitute(locale.template, {\n value: validators.map((v) => v.description).join(locale.separator),\n })\n\n return createDeepValidator(description, (input, options, path) => {\n let longestErrors: readonly ValidationErrorMessage[] = []\n let longestPath = 0\n for (const validator of validators) {\n const errors = validator.validate(input, options, path)\n if (!errors.length) return errors\n // Take the deepest error to bubble.\n const pathLength = errors.reduce(\n (max, m) => Math.max(m.path.length, max),\n 0\n )\n if (pathLength >= longestPath) {\n longestErrors = errors\n longestPath = pathLength\n }\n }\n return longestPath > path.length\n ? longestErrors\n : [\n {\n message: createValidationExpectationMessage(\n description,\n input,\n path\n ),\n path,\n },\n ]\n })\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IllegalArgumentError, invariant, type Maybe } from '@amazon/vinyl-util'\nimport { andValidators } from './andValidators'\nimport type {\n ValidationErrorMessage,\n ValidationOptions,\n Validator,\n} from './Validator'\nimport type {\n PropertyValidator,\n PropertyValidatorOptions,\n PropertyValidatorWithOptions,\n} from './PropertyValidator'\n\nconst requiredValidationOptions = {\n optional: false,\n} as const satisfies PropertyValidatorOptions\n\n/**\n * A base class for validation state.\n * Provides methods for chaining.\n *\n * Subclasses should not override constructors.\n */\nexport abstract class SchemaBase<T> implements PropertyValidator<\n T,\n { readonly optional: false }\n> {\n __type = invariant<T>()\n\n private readonly validator: Validator<T>\n private _options = requiredValidationOptions\n\n get options() {\n return this._options\n }\n\n /**\n * Constructs the first link in a schema chain.\n *\n * @param currentValidator\n */\n constructor(currentValidator: Validator<any, any>)\n\n /**\n * Constructs linking to the given previous schema.\n *\n * @param currentValidator\n * @param previousSchema\n * @param operation\n */\n constructor(\n currentValidator: Validator<any, any>,\n previousSchema: SchemaBase<any>,\n operation: (\n validatorA: Validator<any>,\n validatorB: Validator<any, any>\n ) => Validator<T>\n )\n\n constructor(\n private readonly currentValidator: Validator<any, any>,\n private readonly previousSchema?: Maybe<SchemaBase<any>>,\n private readonly operation?: Maybe<\n (\n validatorA: Validator<any>,\n validatorB: Validator<any, any>\n ) => Validator<T>\n >\n ) {\n this.validator =\n operation == null\n ? currentValidator\n : operation(previousSchema!, currentValidator)\n }\n\n get description(): string {\n return this.validator.description\n }\n\n readonly assert: (\n input: unknown,\n origin?: string,\n path?: readonly string[]\n ) => asserts input is T = (input, origin?, path?): asserts input is T => {\n this.validator.assert(input, origin, path)\n }\n\n readonly isValid: (input: unknown) => input is T = (\n input: unknown\n ): input is T => this.validator.isValid(input)\n\n readonly validate = (\n input: unknown,\n options?: ValidationOptions,\n path?: readonly string[]\n ): readonly ValidationErrorMessage[] =>\n this.validator.validate(input, options, path)\n\n /**\n * Clones this schema, transforming all validators with the given mutator.\n *\n * @param transform A transformer which takes an existing validator in the chain and returns\n * a new one. Validators should be considered to be immutable; transform should not change the\n * input but instead return a new validator.\n */\n protected clone(\n transform: (validator: Validator<any>) => Validator<any> = (v) => v\n ): any {\n const cloned = this.operation\n ? this.self(\n transform(this.currentValidator),\n this.previousSchema!.clone(transform),\n this.operation\n )\n : this.self(transform(this.currentValidator))\n cloned._options = this._options\n return cloned\n }\n\n protected self(current: Validator<any, any>): any\n\n protected self(\n currentValidator: Validator<any, any>,\n previousSchema: SchemaBase<any> | undefined,\n operation:\n | ((\n validatorA: Validator<any>,\n validatorB: Validator<any, any>\n ) => Validator<T>)\n | undefined\n ): any\n\n protected self(\n current: Validator<any, any>,\n previous?: SchemaBase<any>,\n operation?: (\n validatorA: Validator<any>,\n validatorB: Validator<any, any>\n ) => Validator<T> | undefined\n ): any {\n if (this.constructor.length > 3) {\n throw new IllegalArgumentError(\n 'constructor should have at most three required arguments'\n )\n }\n return new (this.constructor as any)(current, previous, operation)\n }\n\n /**\n * Constructs a new schema with a validator chaining the current validator with the\n * provided next in an AND operation.\n *\n * @param nextValidator The validator to run after the current.\n * @return Returns a new Schema instance the same class with a new validator chaining the\n * current validator with the given next in an AND operation.\n */\n protected chain(nextValidator: Validator<any, any>): any {\n return this.self(nextValidator, this, andValidators)\n }\n\n optional(): PropertyValidatorWithOptions<\n this,\n T,\n { readonly optional: true }\n > {\n const cloned = this.clone()\n cloned._options = {\n ...cloned.options,\n optional: true,\n }\n return cloned\n }\n\n required(): PropertyValidatorWithOptions<\n this,\n T,\n { readonly optional: false }\n > {\n const cloned = this.clone()\n cloned._options = {\n ...cloned.options,\n optional: false,\n }\n return cloned\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { andValidators } from './andValidators'\nimport { orValidators } from './orValidators'\nimport { SchemaBase } from './SchemaBase'\nimport type { Validator } from './Validator'\nimport { createValidator } from './Validator'\n\nconst locale = {\n null: 'null',\n nullish: 'nullish',\n undefined: 'undefined',\n} as const\n\nexport const valueValidators = {\n any(): Validator<any> {\n // no need for localization, validator cannot fail.\n return createValidator('', () => true)\n },\n\n /**\n * Creates a validator that asserts that the input is nullish.\n */\n nullish(): Validator<null | undefined> {\n return createValidator(locale.nullish, (input) => input == null)\n },\n\n /**\n * Creates a validator that asserts that the input is strictly null.\n */\n null(): Validator<null> {\n return createValidator(locale.null, (input) => input === null)\n },\n\n /**\n * Creates a validator that asserts that the input is strictly undefined.\n */\n undefined(): Validator<undefined> {\n return createValidator(locale.undefined, (input) => input === undefined)\n },\n} as const\n\nexport class ValueSchema<T> extends SchemaBase<T> {\n /**\n * Prepends this validator allowing for null or undefined.\n */\n maybe(): ValueSchema<T | undefined | null> {\n return this.or(valueValidators.nullish())\n }\n\n /**\n * Prepends this validator allowing for null.\n */\n orNull(): ValueSchema<T | null> {\n return this.or(valueValidators.null())\n }\n\n /**\n * Prepends this validator allowing for undefined.\n */\n orUndefined(): ValueSchema<T | undefined> {\n return this.or(valueValidators.undefined())\n }\n\n /**\n * Returns a validator that asserts if this validator and the next passes.\n *\n * @see andValidators\n *\n * @param nextValidator The validator to run after the current.\n * @return Returns a new ValueSchema intersecting this validator and the next.\n */\n and<U>(nextValidator: Validator<U>): ValueSchema<T & U> {\n return new ValueSchema(nextValidator, this, andValidators)\n }\n\n /**\n * Returns a validator that asserts if this validator or the next passes.\n *\n * Implementation note:\n * subclasses should not change the schema instance returned unless all chainable validators\n * accept input type 'unknown'.\n *\n * @param nextValidator The validator to run after the current.\n * @return Returns a new ValueSchema providing the union of this validator and the next.\n */\n or<U>(nextValidator: Validator<U, any>): ValueSchema<T | U> {\n return new ValueSchema(nextValidator, this, orValidators)\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n type AnyRecord,\n type Fun,\n type Primitive,\n type ReadonlyRecord,\n stringifyForPrint,\n substitute,\n} from '@amazon/vinyl-util'\nimport { ArraySchema } from './ArraySchema'\nimport { FunctionSchema } from './FunctionSchema'\nimport { SetSchema } from './SetSchema'\nimport { ValueSchema, valueValidators } from './ValueSchema'\nimport { NumberSchema } from './NumberSchema'\nimport { type ExtendedPropertyValidators, ObjectSchema } from './ObjectSchema'\nimport { RecordSchema } from './RecordSchema'\nimport { StringSchema } from './StringSchema'\nimport { typeOfValidators } from './typeOfValidators'\nimport type { Validator } from './Validator'\nimport { createValidator } from './Validator'\n\n/**\n * @private\n */\nconst locale = {\n isOneOf: 'one of: {value}',\n instanceOf: 'instance of {value}',\n oneOfSeparator: ' | ',\n} as const\n\n/**\n * Creates a no-op validator. The value can be any type.\n */\nexport function any(): ValueSchema<any> {\n return new ValueSchema(valueValidators.any())\n}\n\n/**\n * Creates a validator that asserts that the input is an array.\n */\nexport function array(): ArraySchema<unknown[]>\n\n/**\n * Creates a validator that asserts that the input is an array and every element passes the\n * given validator.\n *\n * @param elementValidator\n */\nexport function array<U>(elementValidator: Validator<U>): ArraySchema<U[]>\n\nexport function array(\n elementValidator?: Validator<any>\n): ArraySchema<unknown[]> {\n if (!elementValidator) return ArraySchema.base\n else return ArraySchema.base.withElements(elementValidator)\n}\n\n/**\n * Creates a validator that asserts that the input is a boolean.\n */\nexport function boolean(): ValueSchema<boolean> {\n return new ValueSchema(typeOfValidators.boolean)\n}\n\n/**\n * Creates a validator that asserts that the input is a function.\n */\nexport function func(): FunctionSchema<Fun> {\n return FunctionSchema.base\n}\n\n/**\n * Validates that the input is an instanceof the given prototype.\n * @param clazz\n */\nexport function instanceOf<const T>(\n clazz: new (...args: any[]) => T\n): ValueSchema<T> {\n return new ValueSchema(\n createValidator(\n substitute(locale.instanceOf, { value: clazz.name }),\n (input) => input instanceof clazz\n )\n )\n}\n\n/**\n * Creates a validator that asserts that the input is nullish or one of the given possible values.\n *\n * @param possibleValues\n */\nexport function isOneOf<const U extends readonly Primitive[]>(\n ...possibleValues: U\n): ValueSchema<U[number]> {\n return new ValueSchema(\n createValidator(\n substitute(locale.isOneOf, {\n value: possibleValues.join(locale.oneOfSeparator),\n }),\n (input) => possibleValues.includes(input as U[number])\n )\n )\n}\n\n/**\n * Creates a validator that asserts that the input is one of the values of the given enum.\n *\n * @param enumObject The enum to validate against.\n */\nexport function enumOf<const T extends Record<string, Primitive>>(\n enumObject: T\n): ValueSchema<T[keyof T]> {\n return isOneOf(...Object.values(enumObject)) as unknown as ValueSchema<\n T[keyof T]\n >\n}\n\n/**\n * Creates a validator that asserts that the input is null.\n */\nexport function exactlyNull(): Validator<null> {\n return valueValidators.null()\n}\n\n/**\n * Creates a validator that asserts that the input is nullish.\n */\nexport function nullish(): Validator<null | undefined> {\n return valueValidators.nullish()\n}\n\n/**\n * Creates a validator that asserts that the input is a number.\n */\nexport function number(): NumberSchema {\n return NumberSchema.base\n}\n\n/**\n * Creates a validator that validates the input has properties that pass their respective\n * validators.\n */\nexport function object<const U extends object>(\n propertyValidators: NoInfer<ExtendedPropertyValidators<AnyRecord, U>>\n): ObjectSchema<U> {\n return ObjectSchema.base.extend<U>(propertyValidators)\n}\n\n/**\n * Returns a validator that asserts that the object's own enumerable properties has keys and\n * values that match their respective validators.\n *\n * Prototype members are not included.\n * Numeric keys are validated as strings. For example the object `{ [0]: 1 }` will be passed\n * to the key validator as '0'.\n *\n * To assume string keys, use {@link recordValues}\n *\n * @param keyValidator Validates each key.\n * @param valueValidator Validates each value.\n */\nexport function record<const K extends string | symbol, const V>(\n keyValidator: Validator<K>,\n valueValidator: Validator<V>\n): RecordSchema<ReadonlyRecord<K, V>> {\n return RecordSchema.base.record(keyValidator, valueValidator)\n}\n\n/**\n * Returns a validator that asserts that the input object's own enumerable properties has\n * string keys and values that match the given validator.\n *\n * Prototype members are not included.\n *\n * @param valueValidator Validates each value.\n */\nexport function recordValues<const V>(\n valueValidator: Validator<V>\n): RecordSchema<Record<string, V>> {\n return RecordSchema.base.recordValues(valueValidator)\n}\n\n/**\n * Returns a validator that asserts the input is a set with elements that match the given\n * element validator.\n * @param elementValidator\n */\nexport function set<const U>(\n elementValidator: Validator<U>\n): SetSchema<Set<U>> {\n return SetSchema.base.withElements(elementValidator)\n}\n\n/**\n * Creates a validator that asserts that the input is type 'string'.\n */\nexport function string(): StringSchema {\n return StringSchema.base\n}\n\n/**\n * Creates a validator that asserts that the input array is a tuple whose elements match\n * the given validators.\n *\n * @param validators\n */\nexport function tuple<U extends readonly any[]>(\n ...validators: {\n [Index in keyof U]: Validator<U[Index]>\n }\n): ArraySchema<{\n [Index in keyof U]: U[Index]\n}> {\n return ArraySchema.base.tuple(...validators)\n}\n\n/**\n * Creates a validator that asserts that the input is type 'symbol'.\n */\nexport function symbol(): ValueSchema<symbol> {\n return new ValueSchema(typeOfValidators.symbol)\n}\n\n/**\n * Creates a validator that asserts that the input is strictly undefined.\n */\nexport function exactlyUndefined(): ValueSchema<undefined> {\n return new ValueSchema(valueValidators.undefined())\n}\n\n/**\n * Returns a custom\n * @param expectationMessage\n * @param isValid\n * @param inputStringify\n */\nexport function custom<T>(\n expectationMessage: string,\n isValid: (input: unknown) => boolean,\n inputStringify: (input: unknown) => string = (input) =>\n stringifyForPrint(input, 500)\n): ValueSchema<T> {\n return new ValueSchema(\n createValidator(expectationMessage, isValid, inputStringify)\n )\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ValueSchema } from '@amazon/vinyl-validation'\nimport { isOneOf } from '@amazon/vinyl-validation'\n\n/**\n * Encryption key metadata for an HLS media segment (EXT-X-KEY).\n *\n * Specifies how media segments are encrypted and provides the information needed to decrypt them.\n *\n * @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.2.4\n */\nexport interface EncryptionKey {\n /** The encryption method applied to media segments (METHOD). */\n readonly method: EncryptionMethod\n\n /** The URI for obtaining the decryption key (URI). Required unless method is NONE. */\n readonly uri?: string\n\n /** The initialization vector for decryption as a hexadecimal string (IV). */\n readonly iv?: string\n\n /** The format of the key in the response (KEYFORMAT). Identifies the DRM system, e.g. FairPlay. */\n readonly keyFormat?: string\n\n /** A slash-separated list of integers indicating compatible key format versions (KEYFORMATVERSIONS). */\n readonly keyFormatVersions?: string\n}\n\n/**\n * The encryption method for an HLS segment (EXT-X-KEY METHOD attribute).\n *\n * @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.2.4\n */\nexport type EncryptionMethod =\n | 'NONE'\n | 'AES-128'\n | 'SAMPLE-AES'\n | 'SAMPLE-AES-CTR'\n\nexport const encryptionMethodValidator: ValueSchema<EncryptionMethod> = isOneOf(\n 'NONE',\n 'AES-128',\n 'SAMPLE-AES',\n 'SAMPLE-AES-CTR'\n)\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ValueSchema } from '@amazon/vinyl-validation'\nimport { isOneOf } from '@amazon/vinyl-validation'\n\n/**\n * An alternative rendition defined by EXT-X-MEDIA in an HLS Master Playlist.\n *\n * Alternative renditions allow a presentation to offer multiple versions of the same content,\n * such as audio in different languages or subtitles, that can be selected independently of the\n * variant stream.\n *\n * @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.4.1\n */\nexport interface AlternativeRendition {\n /** The media type of this rendition (AUDIO, VIDEO, SUBTITLES, or CLOSED-CAPTIONS). */\n readonly type: RenditionType\n\n /** The group to which this rendition belongs (GROUP-ID). Variants reference groups to associate renditions. */\n readonly groupId: string\n\n /** A human-readable description of this rendition (NAME). */\n readonly name: string\n\n /** The URI of the Media Playlist for this rendition. Absent for CLOSED-CAPTIONS or when muxed into the variant. */\n readonly uri?: string\n\n /** The primary language of this rendition as a BCP 47 tag (LANGUAGE). */\n readonly language?: string\n\n /** Whether this rendition should be played when the user has not expressed a preference (DEFAULT). */\n readonly default?: boolean\n\n /** Whether the client may choose to play this rendition without explicit user selection (AUTOSELECT). */\n readonly autoSelect?: boolean\n}\n\n/**\n * The media type of an alternative rendition (EXT-X-MEDIA TYPE attribute).\n *\n * @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.4.1\n */\nexport type RenditionType = 'AUDIO' | 'VIDEO' | 'SUBTITLES' | 'CLOSED-CAPTIONS'\n\nexport const renditionTypeValidator: ValueSchema<RenditionType> = isOneOf(\n 'AUDIO',\n 'VIDEO',\n 'SUBTITLES',\n 'CLOSED-CAPTIONS'\n)\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { char, isWhitespaceChar, type StringReader } from '@amazon/vinyl-util'\n\nconst LF = char('\\n')\nconst CR = char('\\r')\n\n/**\n * Reads a line from the StringReader, advancing past the line ending.\n * Returns the line content without the line ending.\n */\nexport function readLine(reader: StringReader): string {\n const line = reader.substringUntil((cc) => cc === LF || cc === CR)\n if (reader.hasNext() && reader.peek === CR) reader.next()\n if (reader.hasNext() && reader.peek === LF) reader.next()\n return line\n}\n\n/**\n * Skips whitespace-only content at the current position up to and including\n * the next line ending. Returns true if a whitespace-only line was skipped.\n */\nexport function skipWhitespaceLine(reader: StringReader): boolean {\n const start = reader.position\n reader.while((cc) => isWhitespaceChar(cc) && cc !== LF && cc !== CR)\n if (!reader.hasNext() || reader.peek === LF || reader.peek === CR) {\n if (reader.hasNext()) {\n if (reader.peek === CR) reader.next()\n if (reader.hasNext() && reader.peek === LF) reader.next()\n }\n return true\n }\n reader.position = start\n return false\n}\n\n/**\n * Conditionally adds properties from an attribute map to an object.\n * Only adds a property if the corresponding attribute key exists and is truthy.\n */\nexport function addIfPresent<T extends Record<string, any>>(\n obj: T,\n attrs: Record<string, string>,\n mappings: Record<string, string>\n): T {\n for (const [attrKey, objKey] of Object.entries(mappings)) {\n if (attrs[attrKey]) {\n ;(obj as any)[objKey] = attrs[attrKey]\n }\n }\n return obj\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { StringReader } from '@amazon/vinyl-util'\nimport { char } from '@amazon/vinyl-util'\n\nconst EQUALS = char('=')\nconst COMMA = char(',')\nconst QUOTE = char('\"')\n\n/**\n * Parses an HLS attribute list (e.g. `KEY=VALUE,KEY=\"quoted,value\"`) using\n * StringReader cursor-based parsing. Handles quoted values with embedded commas.\n */\nexport function parseAttributes(reader: StringReader): Record<string, string> {\n const attrs: Record<string, string> = {}\n\n while (\n reader.hasNext() &&\n reader.peek !== char('\\n') &&\n reader.peek !== char('\\r')\n ) {\n const key = reader.substringUntilChar(EQUALS)\n if (!key || !reader.hasNext()) break\n reader.next() // skip '='\n\n let value: string\n if (reader.peek === QUOTE) {\n reader.next() // skip opening quote\n value = reader.substringUntilChar(QUOTE)\n if (reader.hasNext()) reader.next() // skip closing quote\n } else {\n value = reader.substringUntil(\n (cc) => cc === COMMA || cc === char('\\n') || cc === char('\\r')\n )\n }\n\n attrs[key] = value\n\n if (reader.hasNext() && reader.peek === COMMA) {\n reader.next() // skip ','\n }\n }\n\n return attrs\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { StringReader, substitute } from '@amazon/vinyl-util'\nimport type { EncryptionKey } from '../types/EncryptionKey'\nimport { encryptionMethodValidator } from '../types/EncryptionKey'\nimport type { HlsSegment, HlsMap } from '../types/HlsSegment'\nimport type { MediaPlaylist } from '../types/MediaPlaylist'\nimport { parseAttributes } from './parseAttributes'\nimport { readLine, skipWhitespaceLine, addIfPresent } from './parseUtil'\n\nexport const HLS_VARIABLE_PATTERN = /\\{\\$([^}]+)}/g\n\nconst EXTM3U = '#EXTM3U'\nconst EXTINF = '#EXTINF:'\nconst EXT_X_TARGETDURATION = '#EXT-X-TARGETDURATION:'\nconst EXT_X_MEDIA_SEQUENCE = '#EXT-X-MEDIA-SEQUENCE:'\nconst EXT_X_ENDLIST = '#EXT-X-ENDLIST'\nconst EXT_X_PLAYLIST_TYPE = '#EXT-X-PLAYLIST-TYPE:'\nconst EXT_X_VERSION = '#EXT-X-VERSION:'\nconst EXT_X_KEY = '#EXT-X-KEY:'\nconst EXT_X_BYTERANGE = '#EXT-X-BYTERANGE:'\nconst EXT_X_DISCONTINUITY = '#EXT-X-DISCONTINUITY'\nconst EXT_X_PROGRAM_DATE_TIME = '#EXT-X-PROGRAM-DATE-TIME:'\nconst EXT_X_MAP = '#EXT-X-MAP:'\n\n/**\n * Parses an HLS media playlist from M3U8 text.\n *\n * @param text The raw M3U8 manifest string.\n * @param variables Optional variable definitions from the master playlist's #EXT-X-DEFINE tags.\n * @returns A readonly MediaPlaylist structure.\n * @throws StringParseError if the manifest is malformed.\n */\nexport function parseMediaPlaylist(\n text: string,\n variables?: Readonly<Record<string, string>>\n): MediaPlaylist {\n const reader = new StringReader(text)\n\n reader.white()\n if (!reader.stringIf(EXTM3U)) {\n reader.err('Expected #EXTM3U')\n }\n readLine(reader)\n\n let version = 1\n let targetDuration = 0\n let mediaSequence = 0\n let playlistType: 'VOD' | 'EVENT' | 'LIVE' = 'LIVE'\n let ended = false\n\n let currentKey: EncryptionKey | undefined\n let currentMap: HlsMap | undefined\n let pendingByteRange: { length: number; offset: number } | undefined\n let pendingDiscontinuity = false\n let pendingDateTime: string | undefined\n\n const segments: HlsSegment[] = []\n let sequenceCounter = 0\n\n while (reader.hasNext()) {\n if (skipWhitespaceLine(reader)) continue\n\n const line = readLine(reader)\n const trimmed = line.trim()\n if (!trimmed) continue\n\n if (trimmed.startsWith(EXTINF)) {\n const durationStr = trimmed.substring(EXTINF.length).split(',')[0]\n const duration = Number(durationStr)\n\n // Find the URI, skipping any tags that come between EXTINF and URI\n let uri = ''\n while (reader.hasNext()) {\n if (skipWhitespaceLine(reader)) continue\n const nextLine = readLine(reader).trim()\n if (!nextLine.startsWith('#')) {\n uri = variables\n ? substitute(nextLine, variables, HLS_VARIABLE_PATTERN)\n : nextLine\n break\n }\n // Process tags that come between EXTINF and URI\n if (nextLine.startsWith(EXT_X_BYTERANGE)) {\n const rangeStr = nextLine.substring(EXT_X_BYTERANGE.length)\n pendingByteRange = parseByteRangeString(rangeStr)\n } else if (nextLine === EXT_X_DISCONTINUITY) {\n pendingDiscontinuity = true\n } else if (nextLine.startsWith(EXT_X_PROGRAM_DATE_TIME)) {\n pendingDateTime = nextLine.substring(\n EXT_X_PROGRAM_DATE_TIME.length\n )\n } else if (nextLine.startsWith(EXT_X_MAP)) {\n const attrStr = nextLine.substring(EXT_X_MAP.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n const mapUri = attrs['URI']\n if (mapUri) {\n const byteRangeStr = attrs['BYTERANGE']\n currentMap = {\n uri: mapUri,\n ...(byteRangeStr && {\n byteRange: parseByteRangeString(byteRangeStr),\n }),\n }\n }\n }\n }\n\n segments.push({\n uri,\n duration,\n sequenceNumber: mediaSequence + sequenceCounter,\n ...(currentKey && { key: currentKey }),\n ...(currentMap && { map: currentMap }),\n ...(pendingByteRange && { byteRange: pendingByteRange }),\n discontinuity: pendingDiscontinuity,\n ...(pendingDateTime && { programDateTime: pendingDateTime }),\n })\n\n sequenceCounter++\n pendingByteRange = undefined\n pendingDiscontinuity = false\n pendingDateTime = undefined\n } else if (trimmed.startsWith(EXT_X_TARGETDURATION)) {\n targetDuration = Number(\n trimmed.substring(EXT_X_TARGETDURATION.length)\n )\n } else if (trimmed.startsWith(EXT_X_MEDIA_SEQUENCE)) {\n mediaSequence = Number(\n trimmed.substring(EXT_X_MEDIA_SEQUENCE.length)\n )\n } else if (trimmed === EXT_X_ENDLIST) {\n ended = true\n } else if (trimmed.startsWith(EXT_X_PLAYLIST_TYPE)) {\n const val = trimmed.substring(EXT_X_PLAYLIST_TYPE.length).trim()\n if (val === 'VOD' || val === 'EVENT') {\n playlistType = val\n }\n } else if (trimmed.startsWith(EXT_X_VERSION)) {\n version = Number(trimmed.substring(EXT_X_VERSION.length))\n } else if (trimmed.startsWith(EXT_X_KEY)) {\n const attrStr = trimmed.substring(EXT_X_KEY.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n\n const method = attrs['METHOD']\n encryptionMethodValidator.assert(method)\n\n currentKey = addIfPresent(\n {\n method,\n },\n attrs,\n {\n URI: 'uri',\n IV: 'iv',\n KEYFORMAT: 'keyFormat',\n KEYFORMATVERSIONS: 'keyFormatVersions',\n }\n )\n } else if (trimmed.startsWith(EXT_X_MAP)) {\n const attrStr = trimmed.substring(EXT_X_MAP.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n\n const mapUri = attrs['URI']\n if (mapUri) {\n const byteRangeStr = attrs['BYTERANGE']\n currentMap = {\n uri: mapUri,\n ...(byteRangeStr && {\n byteRange: parseByteRangeString(byteRangeStr),\n }),\n }\n }\n } else if (trimmed.startsWith(EXT_X_BYTERANGE)) {\n const rangeStr = trimmed.substring(EXT_X_BYTERANGE.length)\n pendingByteRange = parseByteRangeString(rangeStr)\n } else if (trimmed === EXT_X_DISCONTINUITY) {\n pendingDiscontinuity = true\n } else if (trimmed.startsWith(EXT_X_PROGRAM_DATE_TIME)) {\n pendingDateTime = trimmed.substring(EXT_X_PROGRAM_DATE_TIME.length)\n }\n // Unrecognized tags and comments are silently skipped\n }\n\n return {\n version,\n targetDuration,\n mediaSequence,\n playlistType,\n ended,\n segments,\n }\n}\n\n/**\n * Parses a byte range string (e.g. \"1000@500\" or \"1000\") into length and offset.\n */\nfunction parseByteRangeString(str: string): {\n length: number\n offset: number\n} {\n const parts = str.split('@')\n return {\n length: Number(parts[0]),\n offset: parts.length > 1 ? Number(parts[1]) : 0,\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { StringReader, substitute, ValidationError } from '@amazon/vinyl-util'\nimport type { AlternativeRendition } from '../types/AlternativeRendition'\nimport { renditionTypeValidator } from '../types/AlternativeRendition'\nimport type { MainPlaylist } from '../types/MainPlaylist'\nimport type { SessionData } from '../types/SessionData'\nimport type { VariantStream } from '../types/VariantStream'\nimport { HLS_VARIABLE_PATTERN } from './parseMediaPlaylist'\nimport { parseAttributes } from './parseAttributes'\nimport { readLine, skipWhitespaceLine, addIfPresent } from './parseUtil'\n\nconst EXTM3U = '#EXTM3U'\nconst EXT_X_STREAM_INF = '#EXT-X-STREAM-INF:'\nconst EXT_X_MEDIA = '#EXT-X-MEDIA:'\nconst EXT_X_SESSION_DATA = '#EXT-X-SESSION-DATA:'\nconst EXT_X_DEFINE = '#EXT-X-DEFINE:'\n\n/**\n * Parses an HLS master playlist from M3U8 text.\n *\n * @param text The raw M3U8 manifest string.\n * @returns A readonly MainPlaylist structure.\n * @throws StringParseError if the manifest is malformed.\n */\nexport function parseMainPlaylist(text: string): MainPlaylist {\n const reader = new StringReader(text)\n\n reader.white()\n if (!reader.stringIf(EXTM3U)) {\n reader.err('Expected #EXTM3U')\n }\n // Advance past the rest of the #EXTM3U line\n readLine(reader)\n\n const variants: VariantStream[] = []\n const alternativeRenditions: AlternativeRendition[] = []\n const sessionData: SessionData[] = []\n const defines: Record<string, string> = {}\n\n while (reader.hasNext()) {\n if (skipWhitespaceLine(reader)) continue\n\n const line = readLine(reader)\n const trimmed = line.trim()\n if (!trimmed) continue\n\n if (trimmed.startsWith(EXT_X_STREAM_INF)) {\n const attrStr = trimmed.substring(EXT_X_STREAM_INF.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n\n // Next non-empty line is the URI\n let uri = ''\n while (reader.hasNext()) {\n if (skipWhitespaceLine(reader)) continue\n uri = readLine(reader).trim()\n break\n }\n\n variants.push(\n addIfPresent(\n {\n bandwidth: Number(attrs['BANDWIDTH']),\n uri: substituteHlsVariables(uri, defines),\n ...(attrs['FRAME-RATE'] && {\n frameRate: Number(attrs['FRAME-RATE']),\n }),\n ...(attrs.RESOLUTION &&\n parseResolution(attrs.RESOLUTION)),\n },\n attrs,\n {\n CODECS: 'codecs',\n AUDIO: 'audioGroup',\n VIDEO: 'videoGroup',\n SUBTITLES: 'subtitlesGroup',\n 'CLOSED-CAPTIONS': 'closedCaptionsGroup',\n }\n )\n )\n } else if (trimmed.startsWith(EXT_X_MEDIA)) {\n const attrStr = trimmed.substring(EXT_X_MEDIA.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n\n const type = attrs['TYPE']\n renditionTypeValidator.assert(type)\n\n if (attrs['URI']) {\n attrs['URI'] = substituteHlsVariables(attrs['URI'], defines)\n }\n\n alternativeRenditions.push(\n addIfPresent(\n {\n type,\n groupId: attrs['GROUP-ID'],\n name: attrs['NAME'],\n ...(attrs['DEFAULT'] && {\n default: attrs['DEFAULT'] === 'YES',\n }),\n ...(attrs['AUTOSELECT'] && {\n autoSelect: attrs['AUTOSELECT'] === 'YES',\n }),\n },\n attrs,\n {\n URI: 'uri',\n LANGUAGE: 'language',\n }\n )\n )\n } else if (trimmed.startsWith(EXT_X_SESSION_DATA)) {\n const attrStr = trimmed.substring(EXT_X_SESSION_DATA.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n\n sessionData.push(\n addIfPresent(\n {\n dataId: attrs['DATA-ID'],\n },\n attrs,\n {\n VALUE: 'value',\n URI: 'uri',\n LANGUAGE: 'language',\n }\n )\n )\n } else if (trimmed.startsWith(EXT_X_DEFINE)) {\n const attrStr = trimmed.substring(EXT_X_DEFINE.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n if (attrs['NAME'] && attrs['VALUE']) {\n defines[attrs['NAME']] = attrs['VALUE']\n }\n }\n // Unrecognized tags and comments are silently skipped\n }\n\n return { variants, alternativeRenditions, sessionData, defines }\n}\n\n/**\n * Applies EXT-X-DEFINE variable substitution (per RFC 8216 \u00A74.2) to a manifest\n * value, replacing `{$NAME}` tokens with the values declared earlier in the\n * playlist. Returns the input unchanged when no variables have been declared.\n */\nfunction substituteHlsVariables(\n value: string,\n variables: Readonly<Record<string, string>>\n): string {\n if (!value || Object.keys(variables).length === 0) return value\n return substitute(value, variables, HLS_VARIABLE_PATTERN)\n}\n\n/**\n * Parses a resolution string (e.g., \"1920x1080\") into width and height numbers.\n * Throws ValidationError for invalid formats per HLS spec.\n */\nfunction parseResolution(resolution: string): {\n width: number\n height: number\n} {\n const parts = resolution.split('x')\n if (parts.length !== 2) {\n throw new ValidationError(\n 'Invalid resolution format, expected WIDTHxHEIGHT'\n )\n }\n\n const width = Number(parts[0])\n const height = Number(parts[1])\n\n if (\n !Number.isInteger(width) ||\n !Number.isInteger(height) ||\n width <= 0 ||\n height <= 0\n ) {\n throw new ValidationError(\n 'Invalid resolution values, width and height must be positive integers'\n )\n }\n\n return { width, height }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport createSpy = jasmine.createSpy\nimport Spy = jasmine.Spy\nimport SpyAnd = jasmine.SpyAnd\nimport Calls = jasmine.Calls\nimport MatchableArgs = jasmine.MatchableArgs\n\ntype Fun = (...args: any[]) => any\n\n/**\n * A SpyFactory creates spies by member access. The spies will be named based on the key,\n * and the type interface of the Spy will match the corresponding interface function.\n */\nexport interface SpyFactory<T> {\n <K extends FunctionKeys<T>>(\n key: K\n ): T[K] extends Fun ? Spy2<NoThisType<NonNullable<T[K]>>> : never\n}\n\n/**\n * Fixes Jasmine's Spy type.\n * Jasmine's Spy interface has a call signature instead of intersecting the original function type.\n * This causes parameterized types of the call signature to be dropped.\n */\nexport type Spy2<Fn extends Fun> = Fn & {\n and: SpyAnd<Fn>\n calls: Calls<Fn>\n withArgs(...args: MatchableArgs<Fn>): Spy<Fn>\n}\n\nexport type FunctionKeys<T> = {\n [P in keyof T]: T[P] extends Fun ? P : never\n}[keyof T]\n\n/**\n * Creates a new spy factory.\n *\n * @param createFake If provided, all spies will be created with the fake implementation createFake\n * returns for the given key.\n */\nexport function createSpyFactory<T>(\n createFake?: (key: FunctionKeys<T>) => Fun\n): SpyFactory<T> {\n return (key: FunctionKeys<T>) => {\n const spy = createSpy(String(key))\n if (createFake) spy.and.callFake(createFake(key))\n return spy as any\n }\n}\n\n/**\n * Creates a Spy.\n * This is an alias to jasmine.createSpy with fixed type parameters.\n * @param key\n */\nexport function createSpy2<Fn extends Fun | undefined>(\n key: keyof any\n): Spy2<NoThisType<NonNullable<Fn>>> {\n return createSpy(String(key)) as any\n}\n\n/**\n * Replaces `this` type with `any` in a method signature.\n */\nexport type NoThisType<Fn extends Fun> =\n ReturnType<Fn> extends ThisType<any>\n ? Fn & ((...args: Parameters<Fn>) => any)\n : Fn\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/*\n * AUTO-GENERATED FILE - DO NOT EDIT\n * Generated by @amazon/vinyl-mock-generator\n */\n\n/* eslint-disable @typescript-eslint/prefer-as-const */\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nimport { createSpy2 } from '../createSpyFactory'\n\nexport class MockAbortController implements AbortController {\n signal: AbortSignal = undefined as any\n\n abort = createSpy2<AbortController['abort']>('abort')\n}\n\nexport class MockAbortSignal implements AbortSignal {\n aborted: boolean = false\n onabort: ((this: AbortSignal, ev: Event) => any) | null = null\n reason: any = undefined\n\n throwIfAborted = createSpy2<AbortSignal['throwIfAborted']>('throwIfAborted')\n addEventListener =\n createSpy2<AbortSignal['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<AbortSignal['removeEventListener']>(\n 'removeEventListener'\n )\n dispatchEvent = createSpy2<AbortSignal['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockAudioContext implements AudioContext {\n baseLatency: number = 0\n outputLatency: number = 0\n audioWorklet: AudioWorklet = undefined as any\n currentTime: number = 0\n destination: AudioDestinationNode = undefined as any\n listener: AudioListener = undefined as any\n onstatechange: ((this: BaseAudioContext, ev: Event) => any) | null = null\n sampleRate: number = 0\n state: AudioContextState = 'closed'\n\n close = createSpy2<AudioContext['close']>('close')\n createMediaElementSource = createSpy2<\n AudioContext['createMediaElementSource']\n >('createMediaElementSource')\n createMediaStreamDestination = createSpy2<\n AudioContext['createMediaStreamDestination']\n >('createMediaStreamDestination')\n createMediaStreamSource = createSpy2<\n AudioContext['createMediaStreamSource']\n >('createMediaStreamSource')\n getOutputTimestamp =\n createSpy2<AudioContext['getOutputTimestamp']>('getOutputTimestamp')\n resume = createSpy2<AudioContext['resume']>('resume')\n suspend = createSpy2<AudioContext['suspend']>('suspend')\n addEventListener =\n createSpy2<AudioContext['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<AudioContext['removeEventListener']>(\n 'removeEventListener'\n )\n createAnalyser =\n createSpy2<AudioContext['createAnalyser']>('createAnalyser')\n createBiquadFilter =\n createSpy2<AudioContext['createBiquadFilter']>('createBiquadFilter')\n createBuffer = createSpy2<AudioContext['createBuffer']>('createBuffer')\n createBufferSource =\n createSpy2<AudioContext['createBufferSource']>('createBufferSource')\n createChannelMerger = createSpy2<AudioContext['createChannelMerger']>(\n 'createChannelMerger'\n )\n createChannelSplitter = createSpy2<AudioContext['createChannelSplitter']>(\n 'createChannelSplitter'\n )\n createConstantSource = createSpy2<AudioContext['createConstantSource']>(\n 'createConstantSource'\n )\n createConvolver =\n createSpy2<AudioContext['createConvolver']>('createConvolver')\n createDelay = createSpy2<AudioContext['createDelay']>('createDelay')\n createDynamicsCompressor = createSpy2<\n AudioContext['createDynamicsCompressor']\n >('createDynamicsCompressor')\n createGain = createSpy2<AudioContext['createGain']>('createGain')\n createIIRFilter =\n createSpy2<AudioContext['createIIRFilter']>('createIIRFilter')\n createOscillator =\n createSpy2<AudioContext['createOscillator']>('createOscillator')\n createPanner = createSpy2<AudioContext['createPanner']>('createPanner')\n createPeriodicWave =\n createSpy2<AudioContext['createPeriodicWave']>('createPeriodicWave')\n createScriptProcessor = createSpy2<AudioContext['createScriptProcessor']>(\n 'createScriptProcessor'\n )\n createStereoPanner =\n createSpy2<AudioContext['createStereoPanner']>('createStereoPanner')\n createWaveShaper =\n createSpy2<AudioContext['createWaveShaper']>('createWaveShaper')\n decodeAudioData =\n createSpy2<AudioContext['decodeAudioData']>('decodeAudioData')\n dispatchEvent = createSpy2<AudioContext['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockCache implements Cache {\n add = createSpy2<Cache['add']>('add')\n addAll = createSpy2<Cache['addAll']>('addAll')\n delete = createSpy2<Cache['delete']>('delete')\n keys = createSpy2<Cache['keys']>('keys')\n match = createSpy2<Cache['match']>('match')\n matchAll = createSpy2<Cache['matchAll']>('matchAll')\n put = createSpy2<Cache['put']>('put')\n}\n\nexport class MockCacheStorage implements CacheStorage {\n delete = createSpy2<CacheStorage['delete']>('delete')\n has = createSpy2<CacheStorage['has']>('has')\n keys = createSpy2<CacheStorage['keys']>('keys')\n match = createSpy2<CacheStorage['match']>('match')\n open = createSpy2<CacheStorage['open']>('open')\n}\n\nexport class MockCustomEvent<T = any> implements CustomEvent<T> {\n detail: T = undefined as any\n bubbles: boolean = false\n cancelBubble: boolean = false\n cancelable: boolean = false\n composed: boolean = false\n currentTarget: EventTarget | null = null\n defaultPrevented: boolean = false\n eventPhase: number = 0\n isTrusted: boolean = false\n returnValue: boolean = false\n srcElement: EventTarget | null = null\n target: EventTarget | null = null\n timeStamp: DOMHighResTimeStamp = 0\n type: string = ''\n NONE: 0 = 0\n CAPTURING_PHASE: 1 = 1\n AT_TARGET: 2 = 2\n BUBBLING_PHASE: 3 = 3\n\n initCustomEvent =\n createSpy2<CustomEvent<T>['initCustomEvent']>('initCustomEvent')\n composedPath = createSpy2<CustomEvent<T>['composedPath']>('composedPath')\n initEvent = createSpy2<CustomEvent<T>['initEvent']>('initEvent')\n preventDefault =\n createSpy2<CustomEvent<T>['preventDefault']>('preventDefault')\n stopImmediatePropagation = createSpy2<\n CustomEvent<T>['stopImmediatePropagation']\n >('stopImmediatePropagation')\n stopPropagation =\n createSpy2<CustomEvent<T>['stopPropagation']>('stopPropagation')\n}\n\nexport class MockDocument implements Document {\n URL: string = ''\n alinkColor: string = ''\n all: HTMLAllCollection = undefined as any\n anchors: HTMLCollectionOf<HTMLAnchorElement> = undefined as any\n applets: HTMLCollection = undefined as any\n bgColor: string = ''\n body: HTMLElement = undefined as any\n characterSet: string = ''\n charset: string = ''\n compatMode: string = ''\n contentType: string = ''\n cookie: string = ''\n currentScript: HTMLOrSVGScriptElement | null = undefined as any\n defaultView: (WindowProxy & typeof globalThis) | null = undefined as any\n designMode: string = ''\n dir: string = ''\n doctype: DocumentType | null = null\n documentElement: HTMLElement = undefined as any\n documentURI: string = ''\n domain: string = ''\n embeds: HTMLCollectionOf<HTMLEmbedElement> = undefined as any\n fgColor: string = ''\n forms: HTMLCollectionOf<HTMLFormElement> = undefined as any\n fragmentDirective: FragmentDirective = undefined as any\n fullscreen: boolean = false\n fullscreenEnabled: boolean = false\n head: HTMLHeadElement = undefined as any\n hidden: boolean = false\n images: HTMLCollectionOf<HTMLImageElement> = undefined as any\n implementation: DOMImplementation = undefined as any\n inputEncoding: string = ''\n lastModified: string = ''\n linkColor: string = ''\n links: HTMLCollectionOf<HTMLAnchorElement | HTMLAreaElement> =\n undefined as any\n onfullscreenchange: ((this: Document, ev: Event) => any) | null = null\n onfullscreenerror: ((this: Document, ev: Event) => any) | null = null\n onpointerlockchange: ((this: Document, ev: Event) => any) | null = null\n onpointerlockerror: ((this: Document, ev: Event) => any) | null = null\n onreadystatechange: ((this: Document, ev: Event) => any) | null = null\n onvisibilitychange: ((this: Document, ev: Event) => any) | null = null\n ownerDocument: null = null\n pictureInPictureEnabled: boolean = false\n plugins: HTMLCollectionOf<HTMLEmbedElement> = undefined as any\n readyState: DocumentReadyState = 'complete'\n referrer: string = ''\n rootElement: SVGSVGElement | null = null\n scripts: HTMLCollectionOf<HTMLScriptElement> = undefined as any\n scrollingElement: Element | null = null\n timeline: DocumentTimeline = undefined as any\n title: string = ''\n visibilityState: DocumentVisibilityState = 'hidden'\n vlinkColor: string = ''\n location: any = undefined\n textContent: null = null\n baseURI: string = ''\n childNodes: NodeListOf<ChildNode> = undefined as any\n firstChild: ChildNode | null = null\n isConnected: boolean = false\n lastChild: ChildNode | null = null\n nextSibling: ChildNode | null = null\n nodeName: string = ''\n nodeType: number = 0\n nodeValue: string | null = ''\n parentElement: HTMLElement | null = null\n parentNode: ParentNode | null = null\n previousSibling: ChildNode | null = null\n ELEMENT_NODE: 1 = 1\n ATTRIBUTE_NODE: 2 = 2\n TEXT_NODE: 3 = 3\n CDATA_SECTION_NODE: 4 = 4\n ENTITY_REFERENCE_NODE: 5 = 5\n ENTITY_NODE: 6 = 6\n PROCESSING_INSTRUCTION_NODE: 7 = 7\n COMMENT_NODE: 8 = 8\n DOCUMENT_NODE: 9 = 9\n DOCUMENT_TYPE_NODE: 10 = 10\n DOCUMENT_FRAGMENT_NODE: 11 = 11\n NOTATION_NODE: 12 = 12\n DOCUMENT_POSITION_DISCONNECTED: 0x01 = 1\n DOCUMENT_POSITION_PRECEDING: 0x02 = 2\n DOCUMENT_POSITION_FOLLOWING: 0x04 = 4\n DOCUMENT_POSITION_CONTAINS: 0x08 = 8\n DOCUMENT_POSITION_CONTAINED_BY: 0x10 = 16\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 = 32\n activeElement: Element | null = null\n adoptedStyleSheets: CSSStyleSheet[] = []\n fullscreenElement: Element | null = null\n pictureInPictureElement: Element | null = null\n pointerLockElement: Element | null = null\n styleSheets: StyleSheetList = undefined as any\n fonts: FontFaceSet = undefined as any\n onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onanimationcancel:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationend:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationiteration:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationstart:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null =\n null\n onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onbeforetoggle:\n | ((this: GlobalEventHandlers, ev: ToggleEvent) => any)\n | null = null\n onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextmenu:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onended: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onerror: OnErrorEventHandler = undefined as any\n onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null =\n null\n ongotpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onlostpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onpointercancel:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerdown:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerenter:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerleave:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointermove:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerout:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerover:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null =\n null\n onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsecuritypolicyviolation:\n | ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any)\n | null = null\n onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null =\n null\n onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null =\n null\n ontransitioncancel:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionend:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionrun:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionstart:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onwebkitanimationend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationiteration:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationstart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkittransitionend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null = null\n childElementCount: number = 0\n children: HTMLCollection = undefined as any\n firstElementChild: Element | null = null\n lastElementChild: Element | null = null\n\n adoptNode = createSpy2<Document['adoptNode']>('adoptNode')\n captureEvents = createSpy2<Document['captureEvents']>('captureEvents')\n caretPositionFromPoint = createSpy2<Document['caretPositionFromPoint']>(\n 'caretPositionFromPoint'\n )\n caretRangeFromPoint = createSpy2<Document['caretRangeFromPoint']>(\n 'caretRangeFromPoint'\n )\n clear = createSpy2<Document['clear']>('clear')\n close = createSpy2<Document['close']>('close')\n createAttribute = createSpy2<Document['createAttribute']>('createAttribute')\n createAttributeNS =\n createSpy2<Document['createAttributeNS']>('createAttributeNS')\n createCDATASection =\n createSpy2<Document['createCDATASection']>('createCDATASection')\n createComment = createSpy2<Document['createComment']>('createComment')\n createDocumentFragment = createSpy2<Document['createDocumentFragment']>(\n 'createDocumentFragment'\n )\n createElement = createSpy2<Document['createElement']>('createElement')\n createElementNS = createSpy2<Document['createElementNS']>('createElementNS')\n createEvent = createSpy2<Document['createEvent']>('createEvent')\n createNodeIterator =\n createSpy2<Document['createNodeIterator']>('createNodeIterator')\n createProcessingInstruction = createSpy2<\n Document['createProcessingInstruction']\n >('createProcessingInstruction')\n createRange = createSpy2<Document['createRange']>('createRange')\n createTextNode = createSpy2<Document['createTextNode']>('createTextNode')\n createTreeWalker =\n createSpy2<Document['createTreeWalker']>('createTreeWalker')\n execCommand = createSpy2<Document['execCommand']>('execCommand')\n exitFullscreen = createSpy2<Document['exitFullscreen']>('exitFullscreen')\n exitPictureInPicture = createSpy2<Document['exitPictureInPicture']>(\n 'exitPictureInPicture'\n )\n exitPointerLock = createSpy2<Document['exitPointerLock']>('exitPointerLock')\n getElementById = createSpy2<Document['getElementById']>('getElementById')\n getElementsByClassName = createSpy2<Document['getElementsByClassName']>(\n 'getElementsByClassName'\n )\n getElementsByName =\n createSpy2<Document['getElementsByName']>('getElementsByName')\n getElementsByTagName = createSpy2<Document['getElementsByTagName']>(\n 'getElementsByTagName'\n )\n getElementsByTagNameNS = createSpy2<Document['getElementsByTagNameNS']>(\n 'getElementsByTagNameNS'\n )\n getSelection = createSpy2<Document['getSelection']>('getSelection')\n hasFocus = createSpy2<Document['hasFocus']>('hasFocus')\n hasStorageAccess =\n createSpy2<Document['hasStorageAccess']>('hasStorageAccess')\n importNode = createSpy2<Document['importNode']>('importNode')\n open = createSpy2<Document['open']>('open')\n queryCommandEnabled = createSpy2<Document['queryCommandEnabled']>(\n 'queryCommandEnabled'\n )\n queryCommandIndeterm = createSpy2<Document['queryCommandIndeterm']>(\n 'queryCommandIndeterm'\n )\n queryCommandState =\n createSpy2<Document['queryCommandState']>('queryCommandState')\n queryCommandSupported = createSpy2<Document['queryCommandSupported']>(\n 'queryCommandSupported'\n )\n queryCommandValue =\n createSpy2<Document['queryCommandValue']>('queryCommandValue')\n releaseEvents = createSpy2<Document['releaseEvents']>('releaseEvents')\n requestStorageAccess = createSpy2<Document['requestStorageAccess']>(\n 'requestStorageAccess'\n )\n startViewTransition = createSpy2<Document['startViewTransition']>(\n 'startViewTransition'\n )\n write = createSpy2<Document['write']>('write')\n writeln = createSpy2<Document['writeln']>('writeln')\n addEventListener =\n createSpy2<Document['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<Document['removeEventListener']>(\n 'removeEventListener'\n )\n appendChild = createSpy2<Document['appendChild']>('appendChild')\n cloneNode = createSpy2<Document['cloneNode']>('cloneNode')\n compareDocumentPosition = createSpy2<Document['compareDocumentPosition']>(\n 'compareDocumentPosition'\n )\n contains = createSpy2<Document['contains']>('contains')\n getRootNode = createSpy2<Document['getRootNode']>('getRootNode')\n hasChildNodes = createSpy2<Document['hasChildNodes']>('hasChildNodes')\n insertBefore = createSpy2<Document['insertBefore']>('insertBefore')\n isDefaultNamespace =\n createSpy2<Document['isDefaultNamespace']>('isDefaultNamespace')\n isEqualNode = createSpy2<Document['isEqualNode']>('isEqualNode')\n isSameNode = createSpy2<Document['isSameNode']>('isSameNode')\n lookupNamespaceURI =\n createSpy2<Document['lookupNamespaceURI']>('lookupNamespaceURI')\n lookupPrefix = createSpy2<Document['lookupPrefix']>('lookupPrefix')\n normalize = createSpy2<Document['normalize']>('normalize')\n removeChild = createSpy2<Document['removeChild']>('removeChild')\n replaceChild = createSpy2<Document['replaceChild']>('replaceChild')\n elementFromPoint =\n createSpy2<Document['elementFromPoint']>('elementFromPoint')\n elementsFromPoint =\n createSpy2<Document['elementsFromPoint']>('elementsFromPoint')\n getAnimations = createSpy2<Document['getAnimations']>('getAnimations')\n append = createSpy2<Document['append']>('append')\n prepend = createSpy2<Document['prepend']>('prepend')\n querySelector = createSpy2<Document['querySelector']>('querySelector')\n querySelectorAll =\n createSpy2<Document['querySelectorAll']>('querySelectorAll')\n replaceChildren = createSpy2<Document['replaceChildren']>('replaceChildren')\n createExpression =\n createSpy2<Document['createExpression']>('createExpression')\n createNSResolver =\n createSpy2<Document['createNSResolver']>('createNSResolver')\n evaluate = createSpy2<Document['evaluate']>('evaluate')\n dispatchEvent = createSpy2<Document['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockErrorEvent implements ErrorEvent {\n colno: number = 0\n error: any = undefined\n filename: string = ''\n lineno: number = 0\n message: string = ''\n bubbles: boolean = false\n cancelBubble: boolean = false\n cancelable: boolean = false\n composed: boolean = false\n currentTarget: EventTarget | null = null\n defaultPrevented: boolean = false\n eventPhase: number = 0\n isTrusted: boolean = false\n returnValue: boolean = false\n srcElement: EventTarget | null = null\n target: EventTarget | null = null\n timeStamp: DOMHighResTimeStamp = 0\n type: string = ''\n NONE: 0 = 0\n CAPTURING_PHASE: 1 = 1\n AT_TARGET: 2 = 2\n BUBBLING_PHASE: 3 = 3\n\n composedPath = createSpy2<ErrorEvent['composedPath']>('composedPath')\n initEvent = createSpy2<ErrorEvent['initEvent']>('initEvent')\n preventDefault = createSpy2<ErrorEvent['preventDefault']>('preventDefault')\n stopImmediatePropagation = createSpy2<\n ErrorEvent['stopImmediatePropagation']\n >('stopImmediatePropagation')\n stopPropagation =\n createSpy2<ErrorEvent['stopPropagation']>('stopPropagation')\n}\n\nexport class MockEvent implements Event {\n bubbles: boolean = false\n cancelBubble: boolean = false\n cancelable: boolean = false\n composed: boolean = false\n currentTarget: EventTarget | null = null\n defaultPrevented: boolean = false\n eventPhase: number = 0\n isTrusted: boolean = false\n returnValue: boolean = false\n srcElement: EventTarget | null = null\n target: EventTarget | null = null\n timeStamp: DOMHighResTimeStamp = 0\n type: string = ''\n NONE: 0 = 0\n CAPTURING_PHASE: 1 = 1\n AT_TARGET: 2 = 2\n BUBBLING_PHASE: 3 = 3\n\n composedPath = createSpy2<Event['composedPath']>('composedPath')\n initEvent = createSpy2<Event['initEvent']>('initEvent')\n preventDefault = createSpy2<Event['preventDefault']>('preventDefault')\n stopImmediatePropagation = createSpy2<Event['stopImmediatePropagation']>(\n 'stopImmediatePropagation'\n )\n stopPropagation = createSpy2<Event['stopPropagation']>('stopPropagation')\n}\n\nexport class MockEventTarget implements EventTarget {\n addEventListener =\n createSpy2<EventTarget['addEventListener']>('addEventListener')\n dispatchEvent = createSpy2<EventTarget['dispatchEvent']>('dispatchEvent')\n removeEventListener = createSpy2<EventTarget['removeEventListener']>(\n 'removeEventListener'\n )\n}\n\nexport class MockHTMLAudioElement implements HTMLAudioElement {\n autoplay: boolean = false\n buffered: TimeRanges = undefined as any\n controls: boolean = false\n crossOrigin: string | null = ''\n currentSrc: string = ''\n currentTime: number = 0\n defaultMuted: boolean = false\n defaultPlaybackRate: number = 0\n disableRemotePlayback: boolean = false\n duration: number = 0\n ended: boolean = false\n error: MediaError | null = null\n loop: boolean = false\n mediaKeys: MediaKeys | null = null\n muted: boolean = false\n networkState: number = 0\n onencrypted:\n | ((this: HTMLMediaElement, ev: MediaEncryptedEvent) => any)\n | null = null\n onwaitingforkey: ((this: HTMLMediaElement, ev: Event) => any) | null = null\n paused: boolean = false\n playbackRate: number = 0\n played: TimeRanges = undefined as any\n preload: 'none' | 'metadata' | 'auto' | '' = 'none'\n preservesPitch: boolean = false\n readyState: number = 0\n remote: RemotePlayback = undefined as any\n seekable: TimeRanges = undefined as any\n seeking: boolean = false\n sinkId: string = ''\n src: string = ''\n srcObject: MediaProvider | null = undefined as any\n textTracks: TextTrackList = undefined as any\n volume: number = 0\n NETWORK_EMPTY: 0 = 0\n NETWORK_IDLE: 1 = 1\n NETWORK_LOADING: 2 = 2\n NETWORK_NO_SOURCE: 3 = 3\n HAVE_NOTHING: 0 = 0\n HAVE_METADATA: 1 = 1\n HAVE_CURRENT_DATA: 2 = 2\n HAVE_FUTURE_DATA: 3 = 3\n HAVE_ENOUGH_DATA: 4 = 4\n accessKey: string = ''\n accessKeyLabel: string = ''\n autocapitalize: string = ''\n autocorrect: boolean = false\n dir: string = ''\n draggable: boolean = false\n hidden: boolean = false\n inert: boolean = false\n innerText: string = ''\n lang: string = ''\n offsetHeight: number = 0\n offsetLeft: number = 0\n offsetParent: Element | null = null\n offsetTop: number = 0\n offsetWidth: number = 0\n outerText: string = ''\n popover: string | null = ''\n spellcheck: boolean = false\n title: string = ''\n translate: boolean = false\n writingSuggestions: string = ''\n attributes: NamedNodeMap = undefined as any\n className: string = ''\n clientHeight: number = 0\n clientLeft: number = 0\n clientTop: number = 0\n clientWidth: number = 0\n currentCSSZoom: number = 0\n id: string = ''\n innerHTML: string = ''\n localName: string = ''\n namespaceURI: string | null = ''\n onfullscreenchange: ((this: Element, ev: Event) => any) | null = null\n onfullscreenerror: ((this: Element, ev: Event) => any) | null = null\n outerHTML: string = ''\n ownerDocument: Document = undefined as any\n prefix: string | null = ''\n scrollHeight: number = 0\n scrollLeft: number = 0\n scrollTop: number = 0\n scrollWidth: number = 0\n shadowRoot: ShadowRoot | null = null\n slot: string = ''\n tagName: string = ''\n classList: any = undefined\n part: any = undefined\n textContent: any = undefined\n attributeStyleMap: StylePropertyMap = undefined as any\n style: any = undefined\n contentEditable: string = ''\n enterKeyHint: string = ''\n inputMode: string = ''\n isContentEditable: boolean = false\n onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onanimationcancel:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationend:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationiteration:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationstart:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null =\n null\n onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onbeforetoggle:\n | ((this: GlobalEventHandlers, ev: ToggleEvent) => any)\n | null = null\n onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextmenu:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onended: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onerror: OnErrorEventHandler = undefined as any\n onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null =\n null\n ongotpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onlostpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onpointercancel:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerdown:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerenter:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerleave:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointermove:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerout:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerover:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null =\n null\n onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsecuritypolicyviolation:\n | ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any)\n | null = null\n onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null =\n null\n onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null =\n null\n ontransitioncancel:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionend:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionrun:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionstart:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onwebkitanimationend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationiteration:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationstart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkittransitionend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null = null\n autofocus: boolean = false\n dataset: DOMStringMap = undefined as any\n tabIndex: number = 0\n baseURI: string = ''\n childNodes: NodeListOf<ChildNode> = undefined as any\n firstChild: ChildNode | null = null\n isConnected: boolean = false\n lastChild: ChildNode | null = null\n nextSibling: ChildNode | null = null\n nodeName: string = ''\n nodeType: number = 0\n nodeValue: string | null = ''\n parentElement: HTMLElement | null = null\n parentNode: ParentNode | null = null\n previousSibling: ChildNode | null = null\n ELEMENT_NODE: 1 = 1\n ATTRIBUTE_NODE: 2 = 2\n TEXT_NODE: 3 = 3\n CDATA_SECTION_NODE: 4 = 4\n ENTITY_REFERENCE_NODE: 5 = 5\n ENTITY_NODE: 6 = 6\n PROCESSING_INSTRUCTION_NODE: 7 = 7\n COMMENT_NODE: 8 = 8\n DOCUMENT_NODE: 9 = 9\n DOCUMENT_TYPE_NODE: 10 = 10\n DOCUMENT_FRAGMENT_NODE: 11 = 11\n NOTATION_NODE: 12 = 12\n DOCUMENT_POSITION_DISCONNECTED: 0x01 = 1\n DOCUMENT_POSITION_PRECEDING: 0x02 = 2\n DOCUMENT_POSITION_FOLLOWING: 0x04 = 4\n DOCUMENT_POSITION_CONTAINS: 0x08 = 8\n DOCUMENT_POSITION_CONTAINED_BY: 0x10 = 16\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 = 32\n ariaActiveDescendantElement: Element | null = null\n ariaAtomic: string | null = ''\n ariaAutoComplete: string | null = ''\n ariaBrailleLabel: string | null = ''\n ariaBrailleRoleDescription: string | null = ''\n ariaBusy: string | null = ''\n ariaChecked: string | null = ''\n ariaColCount: string | null = ''\n ariaColIndex: string | null = ''\n ariaColIndexText: string | null = ''\n ariaColSpan: string | null = ''\n ariaControlsElements: ReadonlyArray<Element> | null = null\n ariaCurrent: string | null = ''\n ariaDescribedByElements: ReadonlyArray<Element> | null = null\n ariaDescription: string | null = ''\n ariaDetailsElements: ReadonlyArray<Element> | null = null\n ariaDisabled: string | null = ''\n ariaErrorMessageElements: ReadonlyArray<Element> | null = null\n ariaExpanded: string | null = ''\n ariaFlowToElements: ReadonlyArray<Element> | null = null\n ariaHasPopup: string | null = ''\n ariaHidden: string | null = ''\n ariaInvalid: string | null = ''\n ariaKeyShortcuts: string | null = ''\n ariaLabel: string | null = ''\n ariaLabelledByElements: ReadonlyArray<Element> | null = null\n ariaLevel: string | null = ''\n ariaLive: string | null = ''\n ariaModal: string | null = ''\n ariaMultiLine: string | null = ''\n ariaMultiSelectable: string | null = ''\n ariaOrientation: string | null = ''\n ariaOwnsElements: ReadonlyArray<Element> | null = null\n ariaPlaceholder: string | null = ''\n ariaPosInSet: string | null = ''\n ariaPressed: string | null = ''\n ariaReadOnly: string | null = ''\n ariaRelevant: string | null = ''\n ariaRequired: string | null = ''\n ariaRoleDescription: string | null = ''\n ariaRowCount: string | null = ''\n ariaRowIndex: string | null = ''\n ariaRowIndexText: string | null = ''\n ariaRowSpan: string | null = ''\n ariaSelected: string | null = ''\n ariaSetSize: string | null = ''\n ariaSort: string | null = ''\n ariaValueMax: string | null = ''\n ariaValueMin: string | null = ''\n ariaValueNow: string | null = ''\n ariaValueText: string | null = ''\n role: string | null = ''\n nextElementSibling: Element | null = null\n previousElementSibling: Element | null = null\n childElementCount: number = 0\n children: HTMLCollection = undefined as any\n firstElementChild: Element | null = null\n lastElementChild: Element | null = null\n assignedSlot: HTMLSlotElement | null = null\n\n addEventListener =\n createSpy2<HTMLAudioElement['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<HTMLAudioElement['removeEventListener']>(\n 'removeEventListener'\n )\n addTextTrack = createSpy2<HTMLAudioElement['addTextTrack']>('addTextTrack')\n canPlayType = createSpy2<HTMLAudioElement['canPlayType']>('canPlayType')\n fastSeek = createSpy2<HTMLAudioElement['fastSeek']>('fastSeek')\n load = createSpy2<HTMLAudioElement['load']>('load')\n pause = createSpy2<HTMLAudioElement['pause']>('pause')\n play = createSpy2<HTMLAudioElement['play']>('play')\n setMediaKeys = createSpy2<HTMLAudioElement['setMediaKeys']>('setMediaKeys')\n setSinkId = createSpy2<HTMLAudioElement['setSinkId']>('setSinkId')\n attachInternals =\n createSpy2<HTMLAudioElement['attachInternals']>('attachInternals')\n click = createSpy2<HTMLAudioElement['click']>('click')\n hidePopover = createSpy2<HTMLAudioElement['hidePopover']>('hidePopover')\n showPopover = createSpy2<HTMLAudioElement['showPopover']>('showPopover')\n togglePopover =\n createSpy2<HTMLAudioElement['togglePopover']>('togglePopover')\n attachShadow = createSpy2<HTMLAudioElement['attachShadow']>('attachShadow')\n checkVisibility =\n createSpy2<HTMLAudioElement['checkVisibility']>('checkVisibility')\n closest = createSpy2<HTMLAudioElement['closest']>('closest')\n computedStyleMap =\n createSpy2<HTMLAudioElement['computedStyleMap']>('computedStyleMap')\n getAttribute = createSpy2<HTMLAudioElement['getAttribute']>('getAttribute')\n getAttributeNS =\n createSpy2<HTMLAudioElement['getAttributeNS']>('getAttributeNS')\n getAttributeNames =\n createSpy2<HTMLAudioElement['getAttributeNames']>('getAttributeNames')\n getAttributeNode =\n createSpy2<HTMLAudioElement['getAttributeNode']>('getAttributeNode')\n getAttributeNodeNS =\n createSpy2<HTMLAudioElement['getAttributeNodeNS']>('getAttributeNodeNS')\n getBoundingClientRect = createSpy2<\n HTMLAudioElement['getBoundingClientRect']\n >('getBoundingClientRect')\n getClientRects =\n createSpy2<HTMLAudioElement['getClientRects']>('getClientRects')\n getElementsByClassName = createSpy2<\n HTMLAudioElement['getElementsByClassName']\n >('getElementsByClassName')\n getElementsByTagName = createSpy2<HTMLAudioElement['getElementsByTagName']>(\n 'getElementsByTagName'\n )\n getElementsByTagNameNS = createSpy2<\n HTMLAudioElement['getElementsByTagNameNS']\n >('getElementsByTagNameNS')\n getHTML = createSpy2<HTMLAudioElement['getHTML']>('getHTML')\n hasAttribute = createSpy2<HTMLAudioElement['hasAttribute']>('hasAttribute')\n hasAttributeNS =\n createSpy2<HTMLAudioElement['hasAttributeNS']>('hasAttributeNS')\n hasAttributes =\n createSpy2<HTMLAudioElement['hasAttributes']>('hasAttributes')\n hasPointerCapture =\n createSpy2<HTMLAudioElement['hasPointerCapture']>('hasPointerCapture')\n insertAdjacentElement = createSpy2<\n HTMLAudioElement['insertAdjacentElement']\n >('insertAdjacentElement')\n insertAdjacentHTML =\n createSpy2<HTMLAudioElement['insertAdjacentHTML']>('insertAdjacentHTML')\n insertAdjacentText =\n createSpy2<HTMLAudioElement['insertAdjacentText']>('insertAdjacentText')\n matches = createSpy2<HTMLAudioElement['matches']>('matches')\n releasePointerCapture = createSpy2<\n HTMLAudioElement['releasePointerCapture']\n >('releasePointerCapture')\n removeAttribute =\n createSpy2<HTMLAudioElement['removeAttribute']>('removeAttribute')\n removeAttributeNS =\n createSpy2<HTMLAudioElement['removeAttributeNS']>('removeAttributeNS')\n removeAttributeNode = createSpy2<HTMLAudioElement['removeAttributeNode']>(\n 'removeAttributeNode'\n )\n requestFullscreen =\n createSpy2<HTMLAudioElement['requestFullscreen']>('requestFullscreen')\n requestPointerLock =\n createSpy2<HTMLAudioElement['requestPointerLock']>('requestPointerLock')\n scroll = createSpy2<HTMLAudioElement['scroll']>('scroll')\n scrollBy = createSpy2<HTMLAudioElement['scrollBy']>('scrollBy')\n scrollIntoView =\n createSpy2<HTMLAudioElement['scrollIntoView']>('scrollIntoView')\n scrollTo = createSpy2<HTMLAudioElement['scrollTo']>('scrollTo')\n setAttribute = createSpy2<HTMLAudioElement['setAttribute']>('setAttribute')\n setAttributeNS =\n createSpy2<HTMLAudioElement['setAttributeNS']>('setAttributeNS')\n setAttributeNode =\n createSpy2<HTMLAudioElement['setAttributeNode']>('setAttributeNode')\n setAttributeNodeNS =\n createSpy2<HTMLAudioElement['setAttributeNodeNS']>('setAttributeNodeNS')\n setHTMLUnsafe =\n createSpy2<HTMLAudioElement['setHTMLUnsafe']>('setHTMLUnsafe')\n setPointerCapture =\n createSpy2<HTMLAudioElement['setPointerCapture']>('setPointerCapture')\n toggleAttribute =\n createSpy2<HTMLAudioElement['toggleAttribute']>('toggleAttribute')\n webkitMatchesSelector = createSpy2<\n HTMLAudioElement['webkitMatchesSelector']\n >('webkitMatchesSelector')\n blur = createSpy2<HTMLAudioElement['blur']>('blur')\n focus = createSpy2<HTMLAudioElement['focus']>('focus')\n appendChild = createSpy2<HTMLAudioElement['appendChild']>('appendChild')\n cloneNode = createSpy2<HTMLAudioElement['cloneNode']>('cloneNode')\n compareDocumentPosition = createSpy2<\n HTMLAudioElement['compareDocumentPosition']\n >('compareDocumentPosition')\n contains = createSpy2<HTMLAudioElement['contains']>('contains')\n getRootNode = createSpy2<HTMLAudioElement['getRootNode']>('getRootNode')\n hasChildNodes =\n createSpy2<HTMLAudioElement['hasChildNodes']>('hasChildNodes')\n insertBefore = createSpy2<HTMLAudioElement['insertBefore']>('insertBefore')\n isDefaultNamespace =\n createSpy2<HTMLAudioElement['isDefaultNamespace']>('isDefaultNamespace')\n isEqualNode = createSpy2<HTMLAudioElement['isEqualNode']>('isEqualNode')\n isSameNode = createSpy2<HTMLAudioElement['isSameNode']>('isSameNode')\n lookupNamespaceURI =\n createSpy2<HTMLAudioElement['lookupNamespaceURI']>('lookupNamespaceURI')\n lookupPrefix = createSpy2<HTMLAudioElement['lookupPrefix']>('lookupPrefix')\n normalize = createSpy2<HTMLAudioElement['normalize']>('normalize')\n removeChild = createSpy2<HTMLAudioElement['removeChild']>('removeChild')\n replaceChild = createSpy2<HTMLAudioElement['replaceChild']>('replaceChild')\n animate = createSpy2<HTMLAudioElement['animate']>('animate')\n getAnimations =\n createSpy2<HTMLAudioElement['getAnimations']>('getAnimations')\n after = createSpy2<HTMLAudioElement['after']>('after')\n before = createSpy2<HTMLAudioElement['before']>('before')\n remove = createSpy2<HTMLAudioElement['remove']>('remove')\n replaceWith = createSpy2<HTMLAudioElement['replaceWith']>('replaceWith')\n append = createSpy2<HTMLAudioElement['append']>('append')\n prepend = createSpy2<HTMLAudioElement['prepend']>('prepend')\n querySelector =\n createSpy2<HTMLAudioElement['querySelector']>('querySelector')\n querySelectorAll =\n createSpy2<HTMLAudioElement['querySelectorAll']>('querySelectorAll')\n replaceChildren =\n createSpy2<HTMLAudioElement['replaceChildren']>('replaceChildren')\n dispatchEvent =\n createSpy2<HTMLAudioElement['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockHTMLDivElement implements HTMLDivElement {\n align: string = ''\n accessKey: string = ''\n accessKeyLabel: string = ''\n autocapitalize: string = ''\n autocorrect: boolean = false\n dir: string = ''\n draggable: boolean = false\n hidden: boolean = false\n inert: boolean = false\n innerText: string = ''\n lang: string = ''\n offsetHeight: number = 0\n offsetLeft: number = 0\n offsetParent: Element | null = null\n offsetTop: number = 0\n offsetWidth: number = 0\n outerText: string = ''\n popover: string | null = ''\n spellcheck: boolean = false\n title: string = ''\n translate: boolean = false\n writingSuggestions: string = ''\n attributes: NamedNodeMap = undefined as any\n className: string = ''\n clientHeight: number = 0\n clientLeft: number = 0\n clientTop: number = 0\n clientWidth: number = 0\n currentCSSZoom: number = 0\n id: string = ''\n innerHTML: string = ''\n localName: string = ''\n namespaceURI: string | null = ''\n onfullscreenchange: ((this: Element, ev: Event) => any) | null = null\n onfullscreenerror: ((this: Element, ev: Event) => any) | null = null\n outerHTML: string = ''\n ownerDocument: Document = undefined as any\n prefix: string | null = ''\n scrollHeight: number = 0\n scrollLeft: number = 0\n scrollTop: number = 0\n scrollWidth: number = 0\n shadowRoot: ShadowRoot | null = null\n slot: string = ''\n tagName: string = ''\n classList: any = undefined\n part: any = undefined\n textContent: any = undefined\n attributeStyleMap: StylePropertyMap = undefined as any\n style: any = undefined\n contentEditable: string = ''\n enterKeyHint: string = ''\n inputMode: string = ''\n isContentEditable: boolean = false\n onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onanimationcancel:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationend:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationiteration:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationstart:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null =\n null\n onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onbeforetoggle:\n | ((this: GlobalEventHandlers, ev: ToggleEvent) => any)\n | null = null\n onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextmenu:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onended: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onerror: OnErrorEventHandler = undefined as any\n onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null =\n null\n ongotpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onlostpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onpointercancel:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerdown:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerenter:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerleave:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointermove:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerout:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerover:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null =\n null\n onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsecuritypolicyviolation:\n | ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any)\n | null = null\n onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null =\n null\n onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null =\n null\n ontransitioncancel:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionend:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionrun:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionstart:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onwebkitanimationend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationiteration:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationstart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkittransitionend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null = null\n autofocus: boolean = false\n dataset: DOMStringMap = undefined as any\n tabIndex: number = 0\n baseURI: string = ''\n childNodes: NodeListOf<ChildNode> = undefined as any\n firstChild: ChildNode | null = null\n isConnected: boolean = false\n lastChild: ChildNode | null = null\n nextSibling: ChildNode | null = null\n nodeName: string = ''\n nodeType: number = 0\n nodeValue: string | null = ''\n parentElement: HTMLElement | null = null\n parentNode: ParentNode | null = null\n previousSibling: ChildNode | null = null\n ELEMENT_NODE: 1 = 1\n ATTRIBUTE_NODE: 2 = 2\n TEXT_NODE: 3 = 3\n CDATA_SECTION_NODE: 4 = 4\n ENTITY_REFERENCE_NODE: 5 = 5\n ENTITY_NODE: 6 = 6\n PROCESSING_INSTRUCTION_NODE: 7 = 7\n COMMENT_NODE: 8 = 8\n DOCUMENT_NODE: 9 = 9\n DOCUMENT_TYPE_NODE: 10 = 10\n DOCUMENT_FRAGMENT_NODE: 11 = 11\n NOTATION_NODE: 12 = 12\n DOCUMENT_POSITION_DISCONNECTED: 0x01 = 1\n DOCUMENT_POSITION_PRECEDING: 0x02 = 2\n DOCUMENT_POSITION_FOLLOWING: 0x04 = 4\n DOCUMENT_POSITION_CONTAINS: 0x08 = 8\n DOCUMENT_POSITION_CONTAINED_BY: 0x10 = 16\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 = 32\n ariaActiveDescendantElement: Element | null = null\n ariaAtomic: string | null = ''\n ariaAutoComplete: string | null = ''\n ariaBrailleLabel: string | null = ''\n ariaBrailleRoleDescription: string | null = ''\n ariaBusy: string | null = ''\n ariaChecked: string | null = ''\n ariaColCount: string | null = ''\n ariaColIndex: string | null = ''\n ariaColIndexText: string | null = ''\n ariaColSpan: string | null = ''\n ariaControlsElements: ReadonlyArray<Element> | null = null\n ariaCurrent: string | null = ''\n ariaDescribedByElements: ReadonlyArray<Element> | null = null\n ariaDescription: string | null = ''\n ariaDetailsElements: ReadonlyArray<Element> | null = null\n ariaDisabled: string | null = ''\n ariaErrorMessageElements: ReadonlyArray<Element> | null = null\n ariaExpanded: string | null = ''\n ariaFlowToElements: ReadonlyArray<Element> | null = null\n ariaHasPopup: string | null = ''\n ariaHidden: string | null = ''\n ariaInvalid: string | null = ''\n ariaKeyShortcuts: string | null = ''\n ariaLabel: string | null = ''\n ariaLabelledByElements: ReadonlyArray<Element> | null = null\n ariaLevel: string | null = ''\n ariaLive: string | null = ''\n ariaModal: string | null = ''\n ariaMultiLine: string | null = ''\n ariaMultiSelectable: string | null = ''\n ariaOrientation: string | null = ''\n ariaOwnsElements: ReadonlyArray<Element> | null = null\n ariaPlaceholder: string | null = ''\n ariaPosInSet: string | null = ''\n ariaPressed: string | null = ''\n ariaReadOnly: string | null = ''\n ariaRelevant: string | null = ''\n ariaRequired: string | null = ''\n ariaRoleDescription: string | null = ''\n ariaRowCount: string | null = ''\n ariaRowIndex: string | null = ''\n ariaRowIndexText: string | null = ''\n ariaRowSpan: string | null = ''\n ariaSelected: string | null = ''\n ariaSetSize: string | null = ''\n ariaSort: string | null = ''\n ariaValueMax: string | null = ''\n ariaValueMin: string | null = ''\n ariaValueNow: string | null = ''\n ariaValueText: string | null = ''\n role: string | null = ''\n nextElementSibling: Element | null = null\n previousElementSibling: Element | null = null\n childElementCount: number = 0\n children: HTMLCollection = undefined as any\n firstElementChild: Element | null = null\n lastElementChild: Element | null = null\n assignedSlot: HTMLSlotElement | null = null\n\n addEventListener =\n createSpy2<HTMLDivElement['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<HTMLDivElement['removeEventListener']>(\n 'removeEventListener'\n )\n attachInternals =\n createSpy2<HTMLDivElement['attachInternals']>('attachInternals')\n click = createSpy2<HTMLDivElement['click']>('click')\n hidePopover = createSpy2<HTMLDivElement['hidePopover']>('hidePopover')\n showPopover = createSpy2<HTMLDivElement['showPopover']>('showPopover')\n togglePopover = createSpy2<HTMLDivElement['togglePopover']>('togglePopover')\n attachShadow = createSpy2<HTMLDivElement['attachShadow']>('attachShadow')\n checkVisibility =\n createSpy2<HTMLDivElement['checkVisibility']>('checkVisibility')\n closest = createSpy2<HTMLDivElement['closest']>('closest')\n computedStyleMap =\n createSpy2<HTMLDivElement['computedStyleMap']>('computedStyleMap')\n getAttribute = createSpy2<HTMLDivElement['getAttribute']>('getAttribute')\n getAttributeNS =\n createSpy2<HTMLDivElement['getAttributeNS']>('getAttributeNS')\n getAttributeNames =\n createSpy2<HTMLDivElement['getAttributeNames']>('getAttributeNames')\n getAttributeNode =\n createSpy2<HTMLDivElement['getAttributeNode']>('getAttributeNode')\n getAttributeNodeNS =\n createSpy2<HTMLDivElement['getAttributeNodeNS']>('getAttributeNodeNS')\n getBoundingClientRect = createSpy2<HTMLDivElement['getBoundingClientRect']>(\n 'getBoundingClientRect'\n )\n getClientRects =\n createSpy2<HTMLDivElement['getClientRects']>('getClientRects')\n getElementsByClassName = createSpy2<\n HTMLDivElement['getElementsByClassName']\n >('getElementsByClassName')\n getElementsByTagName = createSpy2<HTMLDivElement['getElementsByTagName']>(\n 'getElementsByTagName'\n )\n getElementsByTagNameNS = createSpy2<\n HTMLDivElement['getElementsByTagNameNS']\n >('getElementsByTagNameNS')\n getHTML = createSpy2<HTMLDivElement['getHTML']>('getHTML')\n hasAttribute = createSpy2<HTMLDivElement['hasAttribute']>('hasAttribute')\n hasAttributeNS =\n createSpy2<HTMLDivElement['hasAttributeNS']>('hasAttributeNS')\n hasAttributes = createSpy2<HTMLDivElement['hasAttributes']>('hasAttributes')\n hasPointerCapture =\n createSpy2<HTMLDivElement['hasPointerCapture']>('hasPointerCapture')\n insertAdjacentElement = createSpy2<HTMLDivElement['insertAdjacentElement']>(\n 'insertAdjacentElement'\n )\n insertAdjacentHTML =\n createSpy2<HTMLDivElement['insertAdjacentHTML']>('insertAdjacentHTML')\n insertAdjacentText =\n createSpy2<HTMLDivElement['insertAdjacentText']>('insertAdjacentText')\n matches = createSpy2<HTMLDivElement['matches']>('matches')\n releasePointerCapture = createSpy2<HTMLDivElement['releasePointerCapture']>(\n 'releasePointerCapture'\n )\n removeAttribute =\n createSpy2<HTMLDivElement['removeAttribute']>('removeAttribute')\n removeAttributeNS =\n createSpy2<HTMLDivElement['removeAttributeNS']>('removeAttributeNS')\n removeAttributeNode = createSpy2<HTMLDivElement['removeAttributeNode']>(\n 'removeAttributeNode'\n )\n requestFullscreen =\n createSpy2<HTMLDivElement['requestFullscreen']>('requestFullscreen')\n requestPointerLock =\n createSpy2<HTMLDivElement['requestPointerLock']>('requestPointerLock')\n scroll = createSpy2<HTMLDivElement['scroll']>('scroll')\n scrollBy = createSpy2<HTMLDivElement['scrollBy']>('scrollBy')\n scrollIntoView =\n createSpy2<HTMLDivElement['scrollIntoView']>('scrollIntoView')\n scrollTo = createSpy2<HTMLDivElement['scrollTo']>('scrollTo')\n setAttribute = createSpy2<HTMLDivElement['setAttribute']>('setAttribute')\n setAttributeNS =\n createSpy2<HTMLDivElement['setAttributeNS']>('setAttributeNS')\n setAttributeNode =\n createSpy2<HTMLDivElement['setAttributeNode']>('setAttributeNode')\n setAttributeNodeNS =\n createSpy2<HTMLDivElement['setAttributeNodeNS']>('setAttributeNodeNS')\n setHTMLUnsafe = createSpy2<HTMLDivElement['setHTMLUnsafe']>('setHTMLUnsafe')\n setPointerCapture =\n createSpy2<HTMLDivElement['setPointerCapture']>('setPointerCapture')\n toggleAttribute =\n createSpy2<HTMLDivElement['toggleAttribute']>('toggleAttribute')\n webkitMatchesSelector = createSpy2<HTMLDivElement['webkitMatchesSelector']>(\n 'webkitMatchesSelector'\n )\n blur = createSpy2<HTMLDivElement['blur']>('blur')\n focus = createSpy2<HTMLDivElement['focus']>('focus')\n appendChild = createSpy2<HTMLDivElement['appendChild']>('appendChild')\n cloneNode = createSpy2<HTMLDivElement['cloneNode']>('cloneNode')\n compareDocumentPosition = createSpy2<\n HTMLDivElement['compareDocumentPosition']\n >('compareDocumentPosition')\n contains = createSpy2<HTMLDivElement['contains']>('contains')\n getRootNode = createSpy2<HTMLDivElement['getRootNode']>('getRootNode')\n hasChildNodes = createSpy2<HTMLDivElement['hasChildNodes']>('hasChildNodes')\n insertBefore = createSpy2<HTMLDivElement['insertBefore']>('insertBefore')\n isDefaultNamespace =\n createSpy2<HTMLDivElement['isDefaultNamespace']>('isDefaultNamespace')\n isEqualNode = createSpy2<HTMLDivElement['isEqualNode']>('isEqualNode')\n isSameNode = createSpy2<HTMLDivElement['isSameNode']>('isSameNode')\n lookupNamespaceURI =\n createSpy2<HTMLDivElement['lookupNamespaceURI']>('lookupNamespaceURI')\n lookupPrefix = createSpy2<HTMLDivElement['lookupPrefix']>('lookupPrefix')\n normalize = createSpy2<HTMLDivElement['normalize']>('normalize')\n removeChild = createSpy2<HTMLDivElement['removeChild']>('removeChild')\n replaceChild = createSpy2<HTMLDivElement['replaceChild']>('replaceChild')\n animate = createSpy2<HTMLDivElement['animate']>('animate')\n getAnimations = createSpy2<HTMLDivElement['getAnimations']>('getAnimations')\n after = createSpy2<HTMLDivElement['after']>('after')\n before = createSpy2<HTMLDivElement['before']>('before')\n remove = createSpy2<HTMLDivElement['remove']>('remove')\n replaceWith = createSpy2<HTMLDivElement['replaceWith']>('replaceWith')\n append = createSpy2<HTMLDivElement['append']>('append')\n prepend = createSpy2<HTMLDivElement['prepend']>('prepend')\n querySelector = createSpy2<HTMLDivElement['querySelector']>('querySelector')\n querySelectorAll =\n createSpy2<HTMLDivElement['querySelectorAll']>('querySelectorAll')\n replaceChildren =\n createSpy2<HTMLDivElement['replaceChildren']>('replaceChildren')\n dispatchEvent = createSpy2<HTMLDivElement['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockHTMLMediaElement implements HTMLMediaElement {\n autoplay: boolean = false\n buffered: TimeRanges = undefined as any\n controls: boolean = false\n crossOrigin: string | null = ''\n currentSrc: string = ''\n currentTime: number = 0\n defaultMuted: boolean = false\n defaultPlaybackRate: number = 0\n disableRemotePlayback: boolean = false\n duration: number = 0\n ended: boolean = false\n error: MediaError | null = null\n loop: boolean = false\n mediaKeys: MediaKeys | null = null\n muted: boolean = false\n networkState: number = 0\n onencrypted:\n | ((this: HTMLMediaElement, ev: MediaEncryptedEvent) => any)\n | null = null\n onwaitingforkey: ((this: HTMLMediaElement, ev: Event) => any) | null = null\n paused: boolean = false\n playbackRate: number = 0\n played: TimeRanges = undefined as any\n preload: 'none' | 'metadata' | 'auto' | '' = 'none'\n preservesPitch: boolean = false\n readyState: number = 0\n remote: RemotePlayback = undefined as any\n seekable: TimeRanges = undefined as any\n seeking: boolean = false\n sinkId: string = ''\n src: string = ''\n srcObject: MediaProvider | null = undefined as any\n textTracks: TextTrackList = undefined as any\n volume: number = 0\n NETWORK_EMPTY: 0 = 0\n NETWORK_IDLE: 1 = 1\n NETWORK_LOADING: 2 = 2\n NETWORK_NO_SOURCE: 3 = 3\n HAVE_NOTHING: 0 = 0\n HAVE_METADATA: 1 = 1\n HAVE_CURRENT_DATA: 2 = 2\n HAVE_FUTURE_DATA: 3 = 3\n HAVE_ENOUGH_DATA: 4 = 4\n accessKey: string = ''\n accessKeyLabel: string = ''\n autocapitalize: string = ''\n autocorrect: boolean = false\n dir: string = ''\n draggable: boolean = false\n hidden: boolean = false\n inert: boolean = false\n innerText: string = ''\n lang: string = ''\n offsetHeight: number = 0\n offsetLeft: number = 0\n offsetParent: Element | null = null\n offsetTop: number = 0\n offsetWidth: number = 0\n outerText: string = ''\n popover: string | null = ''\n spellcheck: boolean = false\n title: string = ''\n translate: boolean = false\n writingSuggestions: string = ''\n attributes: NamedNodeMap = undefined as any\n className: string = ''\n clientHeight: number = 0\n clientLeft: number = 0\n clientTop: number = 0\n clientWidth: number = 0\n currentCSSZoom: number = 0\n id: string = ''\n innerHTML: string = ''\n localName: string = ''\n namespaceURI: string | null = ''\n onfullscreenchange: ((this: Element, ev: Event) => any) | null = null\n onfullscreenerror: ((this: Element, ev: Event) => any) | null = null\n outerHTML: string = ''\n ownerDocument: Document = undefined as any\n prefix: string | null = ''\n scrollHeight: number = 0\n scrollLeft: number = 0\n scrollTop: number = 0\n scrollWidth: number = 0\n shadowRoot: ShadowRoot | null = null\n slot: string = ''\n tagName: string = ''\n classList: any = undefined\n part: any = undefined\n textContent: any = undefined\n attributeStyleMap: StylePropertyMap = undefined as any\n style: any = undefined\n contentEditable: string = ''\n enterKeyHint: string = ''\n inputMode: string = ''\n isContentEditable: boolean = false\n onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onanimationcancel:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationend:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationiteration:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationstart:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null =\n null\n onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onbeforetoggle:\n | ((this: GlobalEventHandlers, ev: ToggleEvent) => any)\n | null = null\n onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextmenu:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onended: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onerror: OnErrorEventHandler = undefined as any\n onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null =\n null\n ongotpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onlostpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onpointercancel:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerdown:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerenter:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerleave:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointermove:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerout:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerover:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null =\n null\n onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsecuritypolicyviolation:\n | ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any)\n | null = null\n onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null =\n null\n onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null =\n null\n ontransitioncancel:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionend:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionrun:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionstart:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onwebkitanimationend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationiteration:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationstart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkittransitionend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null = null\n autofocus: boolean = false\n dataset: DOMStringMap = undefined as any\n tabIndex: number = 0\n baseURI: string = ''\n childNodes: NodeListOf<ChildNode> = undefined as any\n firstChild: ChildNode | null = null\n isConnected: boolean = false\n lastChild: ChildNode | null = null\n nextSibling: ChildNode | null = null\n nodeName: string = ''\n nodeType: number = 0\n nodeValue: string | null = ''\n parentElement: HTMLElement | null = null\n parentNode: ParentNode | null = null\n previousSibling: ChildNode | null = null\n ELEMENT_NODE: 1 = 1\n ATTRIBUTE_NODE: 2 = 2\n TEXT_NODE: 3 = 3\n CDATA_SECTION_NODE: 4 = 4\n ENTITY_REFERENCE_NODE: 5 = 5\n ENTITY_NODE: 6 = 6\n PROCESSING_INSTRUCTION_NODE: 7 = 7\n COMMENT_NODE: 8 = 8\n DOCUMENT_NODE: 9 = 9\n DOCUMENT_TYPE_NODE: 10 = 10\n DOCUMENT_FRAGMENT_NODE: 11 = 11\n NOTATION_NODE: 12 = 12\n DOCUMENT_POSITION_DISCONNECTED: 0x01 = 1\n DOCUMENT_POSITION_PRECEDING: 0x02 = 2\n DOCUMENT_POSITION_FOLLOWING: 0x04 = 4\n DOCUMENT_POSITION_CONTAINS: 0x08 = 8\n DOCUMENT_POSITION_CONTAINED_BY: 0x10 = 16\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 = 32\n ariaActiveDescendantElement: Element | null = null\n ariaAtomic: string | null = ''\n ariaAutoComplete: string | null = ''\n ariaBrailleLabel: string | null = ''\n ariaBrailleRoleDescription: string | null = ''\n ariaBusy: string | null = ''\n ariaChecked: string | null = ''\n ariaColCount: string | null = ''\n ariaColIndex: string | null = ''\n ariaColIndexText: string | null = ''\n ariaColSpan: string | null = ''\n ariaControlsElements: ReadonlyArray<Element> | null = null\n ariaCurrent: string | null = ''\n ariaDescribedByElements: ReadonlyArray<Element> | null = null\n ariaDescription: string | null = ''\n ariaDetailsElements: ReadonlyArray<Element> | null = null\n ariaDisabled: string | null = ''\n ariaErrorMessageElements: ReadonlyArray<Element> | null = null\n ariaExpanded: string | null = ''\n ariaFlowToElements: ReadonlyArray<Element> | null = null\n ariaHasPopup: string | null = ''\n ariaHidden: string | null = ''\n ariaInvalid: string | null = ''\n ariaKeyShortcuts: string | null = ''\n ariaLabel: string | null = ''\n ariaLabelledByElements: ReadonlyArray<Element> | null = null\n ariaLevel: string | null = ''\n ariaLive: string | null = ''\n ariaModal: string | null = ''\n ariaMultiLine: string | null = ''\n ariaMultiSelectable: string | null = ''\n ariaOrientation: string | null = ''\n ariaOwnsElements: ReadonlyArray<Element> | null = null\n ariaPlaceholder: string | null = ''\n ariaPosInSet: string | null = ''\n ariaPressed: string | null = ''\n ariaReadOnly: string | null = ''\n ariaRelevant: string | null = ''\n ariaRequired: string | null = ''\n ariaRoleDescription: string | null = ''\n ariaRowCount: string | null = ''\n ariaRowIndex: string | null = ''\n ariaRowIndexText: string | null = ''\n ariaRowSpan: string | null = ''\n ariaSelected: string | null = ''\n ariaSetSize: string | null = ''\n ariaSort: string | null = ''\n ariaValueMax: string | null = ''\n ariaValueMin: string | null = ''\n ariaValueNow: string | null = ''\n ariaValueText: string | null = ''\n role: string | null = ''\n nextElementSibling: Element | null = null\n previousElementSibling: Element | null = null\n childElementCount: number = 0\n children: HTMLCollection = undefined as any\n firstElementChild: Element | null = null\n lastElementChild: Element | null = null\n assignedSlot: HTMLSlotElement | null = null\n\n addTextTrack = createSpy2<HTMLMediaElement['addTextTrack']>('addTextTrack')\n canPlayType = createSpy2<HTMLMediaElement['canPlayType']>('canPlayType')\n fastSeek = createSpy2<HTMLMediaElement['fastSeek']>('fastSeek')\n load = createSpy2<HTMLMediaElement['load']>('load')\n pause = createSpy2<HTMLMediaElement['pause']>('pause')\n play = createSpy2<HTMLMediaElement['play']>('play')\n setMediaKeys = createSpy2<HTMLMediaElement['setMediaKeys']>('setMediaKeys')\n setSinkId = createSpy2<HTMLMediaElement['setSinkId']>('setSinkId')\n addEventListener =\n createSpy2<HTMLMediaElement['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<HTMLMediaElement['removeEventListener']>(\n 'removeEventListener'\n )\n attachInternals =\n createSpy2<HTMLMediaElement['attachInternals']>('attachInternals')\n click = createSpy2<HTMLMediaElement['click']>('click')\n hidePopover = createSpy2<HTMLMediaElement['hidePopover']>('hidePopover')\n showPopover = createSpy2<HTMLMediaElement['showPopover']>('showPopover')\n togglePopover =\n createSpy2<HTMLMediaElement['togglePopover']>('togglePopover')\n attachShadow = createSpy2<HTMLMediaElement['attachShadow']>('attachShadow')\n checkVisibility =\n createSpy2<HTMLMediaElement['checkVisibility']>('checkVisibility')\n closest = createSpy2<HTMLMediaElement['closest']>('closest')\n computedStyleMap =\n createSpy2<HTMLMediaElement['computedStyleMap']>('computedStyleMap')\n getAttribute = createSpy2<HTMLMediaElement['getAttribute']>('getAttribute')\n getAttributeNS =\n createSpy2<HTMLMediaElement['getAttributeNS']>('getAttributeNS')\n getAttributeNames =\n createSpy2<HTMLMediaElement['getAttributeNames']>('getAttributeNames')\n getAttributeNode =\n createSpy2<HTMLMediaElement['getAttributeNode']>('getAttributeNode')\n getAttributeNodeNS =\n createSpy2<HTMLMediaElement['getAttributeNodeNS']>('getAttributeNodeNS')\n getBoundingClientRect = createSpy2<\n HTMLMediaElement['getBoundingClientRect']\n >('getBoundingClientRect')\n getClientRects =\n createSpy2<HTMLMediaElement['getClientRects']>('getClientRects')\n getElementsByClassName = createSpy2<\n HTMLMediaElement['getElementsByClassName']\n >('getElementsByClassName')\n getElementsByTagName = createSpy2<HTMLMediaElement['getElementsByTagName']>(\n 'getElementsByTagName'\n )\n getElementsByTagNameNS = createSpy2<\n HTMLMediaElement['getElementsByTagNameNS']\n >('getElementsByTagNameNS')\n getHTML = createSpy2<HTMLMediaElement['getHTML']>('getHTML')\n hasAttribute = createSpy2<HTMLMediaElement['hasAttribute']>('hasAttribute')\n hasAttributeNS =\n createSpy2<HTMLMediaElement['hasAttributeNS']>('hasAttributeNS')\n hasAttributes =\n createSpy2<HTMLMediaElement['hasAttributes']>('hasAttributes')\n hasPointerCapture =\n createSpy2<HTMLMediaElement['hasPointerCapture']>('hasPointerCapture')\n insertAdjacentElement = createSpy2<\n HTMLMediaElement['insertAdjacentElement']\n >('insertAdjacentElement')\n insertAdjacentHTML =\n createSpy2<HTMLMediaElement['insertAdjacentHTML']>('insertAdjacentHTML')\n insertAdjacentText =\n createSpy2<HTMLMediaElement['insertAdjacentText']>('insertAdjacentText')\n matches = createSpy2<HTMLMediaElement['matches']>('matches')\n releasePointerCapture = createSpy2<\n HTMLMediaElement['releasePointerCapture']\n >('releasePointerCapture')\n removeAttribute =\n createSpy2<HTMLMediaElement['removeAttribute']>('removeAttribute')\n removeAttributeNS =\n createSpy2<HTMLMediaElement['removeAttributeNS']>('removeAttributeNS')\n removeAttributeNode = createSpy2<HTMLMediaElement['removeAttributeNode']>(\n 'removeAttributeNode'\n )\n requestFullscreen =\n createSpy2<HTMLMediaElement['requestFullscreen']>('requestFullscreen')\n requestPointerLock =\n createSpy2<HTMLMediaElement['requestPointerLock']>('requestPointerLock')\n scroll = createSpy2<HTMLMediaElement['scroll']>('scroll')\n scrollBy = createSpy2<HTMLMediaElement['scrollBy']>('scrollBy')\n scrollIntoView =\n createSpy2<HTMLMediaElement['scrollIntoView']>('scrollIntoView')\n scrollTo = createSpy2<HTMLMediaElement['scrollTo']>('scrollTo')\n setAttribute = createSpy2<HTMLMediaElement['setAttribute']>('setAttribute')\n setAttributeNS =\n createSpy2<HTMLMediaElement['setAttributeNS']>('setAttributeNS')\n setAttributeNode =\n createSpy2<HTMLMediaElement['setAttributeNode']>('setAttributeNode')\n setAttributeNodeNS =\n createSpy2<HTMLMediaElement['setAttributeNodeNS']>('setAttributeNodeNS')\n setHTMLUnsafe =\n createSpy2<HTMLMediaElement['setHTMLUnsafe']>('setHTMLUnsafe')\n setPointerCapture =\n createSpy2<HTMLMediaElement['setPointerCapture']>('setPointerCapture')\n toggleAttribute =\n createSpy2<HTMLMediaElement['toggleAttribute']>('toggleAttribute')\n webkitMatchesSelector = createSpy2<\n HTMLMediaElement['webkitMatchesSelector']\n >('webkitMatchesSelector')\n blur = createSpy2<HTMLMediaElement['blur']>('blur')\n focus = createSpy2<HTMLMediaElement['focus']>('focus')\n appendChild = createSpy2<HTMLMediaElement['appendChild']>('appendChild')\n cloneNode = createSpy2<HTMLMediaElement['cloneNode']>('cloneNode')\n compareDocumentPosition = createSpy2<\n HTMLMediaElement['compareDocumentPosition']\n >('compareDocumentPosition')\n contains = createSpy2<HTMLMediaElement['contains']>('contains')\n getRootNode = createSpy2<HTMLMediaElement['getRootNode']>('getRootNode')\n hasChildNodes =\n createSpy2<HTMLMediaElement['hasChildNodes']>('hasChildNodes')\n insertBefore = createSpy2<HTMLMediaElement['insertBefore']>('insertBefore')\n isDefaultNamespace =\n createSpy2<HTMLMediaElement['isDefaultNamespace']>('isDefaultNamespace')\n isEqualNode = createSpy2<HTMLMediaElement['isEqualNode']>('isEqualNode')\n isSameNode = createSpy2<HTMLMediaElement['isSameNode']>('isSameNode')\n lookupNamespaceURI =\n createSpy2<HTMLMediaElement['lookupNamespaceURI']>('lookupNamespaceURI')\n lookupPrefix = createSpy2<HTMLMediaElement['lookupPrefix']>('lookupPrefix')\n normalize = createSpy2<HTMLMediaElement['normalize']>('normalize')\n removeChild = createSpy2<HTMLMediaElement['removeChild']>('removeChild')\n replaceChild = createSpy2<HTMLMediaElement['replaceChild']>('replaceChild')\n animate = createSpy2<HTMLMediaElement['animate']>('animate')\n getAnimations =\n createSpy2<HTMLMediaElement['getAnimations']>('getAnimations')\n after = createSpy2<HTMLMediaElement['after']>('after')\n before = createSpy2<HTMLMediaElement['before']>('before')\n remove = createSpy2<HTMLMediaElement['remove']>('remove')\n replaceWith = createSpy2<HTMLMediaElement['replaceWith']>('replaceWith')\n append = createSpy2<HTMLMediaElement['append']>('append')\n prepend = createSpy2<HTMLMediaElement['prepend']>('prepend')\n querySelector =\n createSpy2<HTMLMediaElement['querySelector']>('querySelector')\n querySelectorAll =\n createSpy2<HTMLMediaElement['querySelectorAll']>('querySelectorAll')\n replaceChildren =\n createSpy2<HTMLMediaElement['replaceChildren']>('replaceChildren')\n dispatchEvent =\n createSpy2<HTMLMediaElement['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockMediaError implements MediaError {\n code: number = 0\n message: string = ''\n MEDIA_ERR_ABORTED: 1 = 1\n MEDIA_ERR_NETWORK: 2 = 2\n MEDIA_ERR_DECODE: 3 = 3\n MEDIA_ERR_SRC_NOT_SUPPORTED: 4 = 4\n}\n\nexport class MockMediaKeyMessageEvent implements MediaKeyMessageEvent {\n message: ArrayBuffer = new ArrayBuffer(0)\n messageType: MediaKeyMessageType = 'individualization-request'\n bubbles: boolean = false\n cancelBubble: boolean = false\n cancelable: boolean = false\n composed: boolean = false\n currentTarget: EventTarget | null = null\n defaultPrevented: boolean = false\n eventPhase: number = 0\n isTrusted: boolean = false\n returnValue: boolean = false\n srcElement: EventTarget | null = null\n target: EventTarget | null = null\n timeStamp: DOMHighResTimeStamp = 0\n type: string = ''\n NONE: 0 = 0\n CAPTURING_PHASE: 1 = 1\n AT_TARGET: 2 = 2\n BUBBLING_PHASE: 3 = 3\n\n composedPath =\n createSpy2<MediaKeyMessageEvent['composedPath']>('composedPath')\n initEvent = createSpy2<MediaKeyMessageEvent['initEvent']>('initEvent')\n preventDefault =\n createSpy2<MediaKeyMessageEvent['preventDefault']>('preventDefault')\n stopImmediatePropagation = createSpy2<\n MediaKeyMessageEvent['stopImmediatePropagation']\n >('stopImmediatePropagation')\n stopPropagation =\n createSpy2<MediaKeyMessageEvent['stopPropagation']>('stopPropagation')\n}\n\nexport class MockMediaKeySession implements MediaKeySession {\n closed: Promise<MediaKeySessionClosedReason> = undefined as any\n expiration: number = 0\n keyStatuses: MediaKeyStatusMap = undefined as any\n onkeystatuseschange: ((this: MediaKeySession, ev: Event) => any) | null =\n null\n onmessage:\n | ((this: MediaKeySession, ev: MediaKeyMessageEvent) => any)\n | null = null\n sessionId: string = ''\n\n close = createSpy2<MediaKeySession['close']>('close')\n generateRequest =\n createSpy2<MediaKeySession['generateRequest']>('generateRequest')\n load = createSpy2<MediaKeySession['load']>('load')\n remove = createSpy2<MediaKeySession['remove']>('remove')\n update = createSpy2<MediaKeySession['update']>('update')\n addEventListener =\n createSpy2<MediaKeySession['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<MediaKeySession['removeEventListener']>(\n 'removeEventListener'\n )\n dispatchEvent =\n createSpy2<MediaKeySession['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockMediaKeySystemAccess implements MediaKeySystemAccess {\n keySystem: string = ''\n\n createMediaKeys =\n createSpy2<MediaKeySystemAccess['createMediaKeys']>('createMediaKeys')\n getConfiguration =\n createSpy2<MediaKeySystemAccess['getConfiguration']>('getConfiguration')\n}\n\nexport class MockMediaKeys implements MediaKeys {\n createSession = createSpy2<MediaKeys['createSession']>('createSession')\n getStatusForPolicy =\n createSpy2<MediaKeys['getStatusForPolicy']>('getStatusForPolicy')\n setServerCertificate = createSpy2<MediaKeys['setServerCertificate']>(\n 'setServerCertificate'\n )\n}\n\nexport class MockMediaSource implements MediaSource {\n activeSourceBuffers: SourceBufferList = undefined as any\n duration: number = 0\n onsourceclose: ((this: MediaSource, ev: Event) => any) | null = null\n onsourceended: ((this: MediaSource, ev: Event) => any) | null = null\n onsourceopen: ((this: MediaSource, ev: Event) => any) | null = null\n readyState: ReadyState = 'closed'\n sourceBuffers: SourceBufferList = undefined as any\n\n addSourceBuffer =\n createSpy2<MediaSource['addSourceBuffer']>('addSourceBuffer')\n clearLiveSeekableRange = createSpy2<MediaSource['clearLiveSeekableRange']>(\n 'clearLiveSeekableRange'\n )\n endOfStream = createSpy2<MediaSource['endOfStream']>('endOfStream')\n removeSourceBuffer =\n createSpy2<MediaSource['removeSourceBuffer']>('removeSourceBuffer')\n setLiveSeekableRange = createSpy2<MediaSource['setLiveSeekableRange']>(\n 'setLiveSeekableRange'\n )\n addEventListener =\n createSpy2<MediaSource['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<MediaSource['removeEventListener']>(\n 'removeEventListener'\n )\n dispatchEvent = createSpy2<MediaSource['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockMediaStream implements MediaStream {\n active: boolean = false\n id: string = ''\n onaddtrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null =\n null\n onremovetrack:\n | ((this: MediaStream, ev: MediaStreamTrackEvent) => any)\n | null = null\n\n addTrack = createSpy2<MediaStream['addTrack']>('addTrack')\n clone = createSpy2<MediaStream['clone']>('clone')\n getAudioTracks = createSpy2<MediaStream['getAudioTracks']>('getAudioTracks')\n getTrackById = createSpy2<MediaStream['getTrackById']>('getTrackById')\n getTracks = createSpy2<MediaStream['getTracks']>('getTracks')\n getVideoTracks = createSpy2<MediaStream['getVideoTracks']>('getVideoTracks')\n removeTrack = createSpy2<MediaStream['removeTrack']>('removeTrack')\n addEventListener =\n createSpy2<MediaStream['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<MediaStream['removeEventListener']>(\n 'removeEventListener'\n )\n dispatchEvent = createSpy2<MediaStream['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockNavigator implements Navigator {\n clipboard: Clipboard = undefined as any\n credentials: CredentialsContainer = undefined as any\n doNotTrack: string | null = ''\n geolocation: Geolocation = undefined as any\n login: NavigatorLogin = undefined as any\n maxTouchPoints: number = 0\n mediaCapabilities: MediaCapabilities = undefined as any\n mediaDevices: MediaDevices = undefined as any\n mediaSession: MediaSession = undefined as any\n permissions: Permissions = undefined as any\n serviceWorker: ServiceWorkerContainer = undefined as any\n userActivation: UserActivation = undefined as any\n wakeLock: WakeLock = undefined as any\n webdriver: boolean = false\n hardwareConcurrency: number = 0\n cookieEnabled: boolean = false\n appCodeName: string = ''\n appName: string = ''\n appVersion: string = ''\n platform: string = ''\n product: string = ''\n productSub: string = ''\n userAgent: string = ''\n vendor: string = ''\n vendorSub: string = ''\n language: string = ''\n languages: ReadonlyArray<string> = []\n locks: LockManager = undefined as any\n onLine: boolean = false\n mimeTypes: MimeTypeArray = undefined as any\n pdfViewerEnabled: boolean = false\n plugins: PluginArray = undefined as any\n storage: StorageManager = undefined as any\n\n canShare = createSpy2<Navigator['canShare']>('canShare')\n getGamepads = createSpy2<Navigator['getGamepads']>('getGamepads')\n requestMIDIAccess =\n createSpy2<Navigator['requestMIDIAccess']>('requestMIDIAccess')\n requestMediaKeySystemAccess = createSpy2<\n Navigator['requestMediaKeySystemAccess']\n >('requestMediaKeySystemAccess')\n sendBeacon = createSpy2<Navigator['sendBeacon']>('sendBeacon')\n share = createSpy2<Navigator['share']>('share')\n vibrate = createSpy2<Navigator['vibrate']>('vibrate')\n clearAppBadge = createSpy2<Navigator['clearAppBadge']>('clearAppBadge')\n setAppBadge = createSpy2<Navigator['setAppBadge']>('setAppBadge')\n registerProtocolHandler = createSpy2<Navigator['registerProtocolHandler']>(\n 'registerProtocolHandler'\n )\n javaEnabled = createSpy2<Navigator['javaEnabled']>('javaEnabled')\n}\n\nexport class MockNode implements Node {\n baseURI: string = ''\n childNodes: NodeListOf<ChildNode> = undefined as any\n firstChild: ChildNode | null = null\n isConnected: boolean = false\n lastChild: ChildNode | null = null\n nextSibling: ChildNode | null = null\n nodeName: string = ''\n nodeType: number = 0\n nodeValue: string | null = ''\n ownerDocument: Document | null = null\n parentElement: HTMLElement | null = null\n parentNode: ParentNode | null = null\n previousSibling: ChildNode | null = null\n textContent: string | null = ''\n ELEMENT_NODE: 1 = 1\n ATTRIBUTE_NODE: 2 = 2\n TEXT_NODE: 3 = 3\n CDATA_SECTION_NODE: 4 = 4\n ENTITY_REFERENCE_NODE: 5 = 5\n ENTITY_NODE: 6 = 6\n PROCESSING_INSTRUCTION_NODE: 7 = 7\n COMMENT_NODE: 8 = 8\n DOCUMENT_NODE: 9 = 9\n DOCUMENT_TYPE_NODE: 10 = 10\n DOCUMENT_FRAGMENT_NODE: 11 = 11\n NOTATION_NODE: 12 = 12\n DOCUMENT_POSITION_DISCONNECTED: 0x01 = 1\n DOCUMENT_POSITION_PRECEDING: 0x02 = 2\n DOCUMENT_POSITION_FOLLOWING: 0x04 = 4\n DOCUMENT_POSITION_CONTAINS: 0x08 = 8\n DOCUMENT_POSITION_CONTAINED_BY: 0x10 = 16\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 = 32\n\n appendChild = createSpy2<Node['appendChild']>('appendChild')\n cloneNode = createSpy2<Node['cloneNode']>('cloneNode')\n compareDocumentPosition = createSpy2<Node['compareDocumentPosition']>(\n 'compareDocumentPosition'\n )\n contains = createSpy2<Node['contains']>('contains')\n getRootNode = createSpy2<Node['getRootNode']>('getRootNode')\n hasChildNodes = createSpy2<Node['hasChildNodes']>('hasChildNodes')\n insertBefore = createSpy2<Node['insertBefore']>('insertBefore')\n isDefaultNamespace =\n createSpy2<Node['isDefaultNamespace']>('isDefaultNamespace')\n isEqualNode = createSpy2<Node['isEqualNode']>('isEqualNode')\n isSameNode = createSpy2<Node['isSameNode']>('isSameNode')\n lookupNamespaceURI =\n createSpy2<Node['lookupNamespaceURI']>('lookupNamespaceURI')\n lookupPrefix = createSpy2<Node['lookupPrefix']>('lookupPrefix')\n normalize = createSpy2<Node['normalize']>('normalize')\n removeChild = createSpy2<Node['removeChild']>('removeChild')\n replaceChild = createSpy2<Node['replaceChild']>('replaceChild')\n addEventListener = createSpy2<Node['addEventListener']>('addEventListener')\n dispatchEvent = createSpy2<Node['dispatchEvent']>('dispatchEvent')\n removeEventListener = createSpy2<Node['removeEventListener']>(\n 'removeEventListener'\n )\n}\n\nexport class MockProgressEvent<\n T extends EventTarget = EventTarget,\n> implements ProgressEvent<T> {\n lengthComputable: boolean = false\n loaded: number = 0\n target: T | null = undefined as any\n total: number = 0\n bubbles: boolean = false\n cancelBubble: boolean = false\n cancelable: boolean = false\n composed: boolean = false\n currentTarget: EventTarget | null = null\n defaultPrevented: boolean = false\n eventPhase: number = 0\n isTrusted: boolean = false\n returnValue: boolean = false\n srcElement: EventTarget | null = null\n timeStamp: DOMHighResTimeStamp = 0\n type: string = ''\n NONE: 0 = 0\n CAPTURING_PHASE: 1 = 1\n AT_TARGET: 2 = 2\n BUBBLING_PHASE: 3 = 3\n\n composedPath = createSpy2<ProgressEvent<T>['composedPath']>('composedPath')\n initEvent = createSpy2<ProgressEvent<T>['initEvent']>('initEvent')\n preventDefault =\n createSpy2<ProgressEvent<T>['preventDefault']>('preventDefault')\n stopImmediatePropagation = createSpy2<\n ProgressEvent<T>['stopImmediatePropagation']\n >('stopImmediatePropagation')\n stopPropagation =\n createSpy2<ProgressEvent<T>['stopPropagation']>('stopPropagation')\n}\n\nexport class MockPromiseRejectionEvent implements PromiseRejectionEvent {\n promise: Promise<any> = undefined as any\n reason: any = undefined\n bubbles: boolean = false\n cancelBubble: boolean = false\n cancelable: boolean = false\n composed: boolean = false\n currentTarget: EventTarget | null = null\n defaultPrevented: boolean = false\n eventPhase: number = 0\n isTrusted: boolean = false\n returnValue: boolean = false\n srcElement: EventTarget | null = null\n target: EventTarget | null = null\n timeStamp: DOMHighResTimeStamp = 0\n type: string = ''\n NONE: 0 = 0\n CAPTURING_PHASE: 1 = 1\n AT_TARGET: 2 = 2\n BUBBLING_PHASE: 3 = 3\n\n composedPath =\n createSpy2<PromiseRejectionEvent['composedPath']>('composedPath')\n initEvent = createSpy2<PromiseRejectionEvent['initEvent']>('initEvent')\n preventDefault =\n createSpy2<PromiseRejectionEvent['preventDefault']>('preventDefault')\n stopImmediatePropagation = createSpy2<\n PromiseRejectionEvent['stopImmediatePropagation']\n >('stopImmediatePropagation')\n stopPropagation =\n createSpy2<PromiseRejectionEvent['stopPropagation']>('stopPropagation')\n}\n\nexport class MockSourceBuffer implements SourceBuffer {\n appendWindowEnd: number = 0\n appendWindowStart: number = 0\n buffered: TimeRanges = undefined as any\n mode: AppendMode = 'segments'\n onabort: ((this: SourceBuffer, ev: Event) => any) | null = null\n onerror: ((this: SourceBuffer, ev: Event) => any) | null = null\n onupdate: ((this: SourceBuffer, ev: Event) => any) | null = null\n onupdateend: ((this: SourceBuffer, ev: Event) => any) | null = null\n onupdatestart: ((this: SourceBuffer, ev: Event) => any) | null = null\n timestampOffset: number = 0\n updating: boolean = false\n\n abort = createSpy2<SourceBuffer['abort']>('abort')\n appendBuffer = createSpy2<SourceBuffer['appendBuffer']>('appendBuffer')\n changeType = createSpy2<SourceBuffer['changeType']>('changeType')\n remove = createSpy2<SourceBuffer['remove']>('remove')\n addEventListener =\n createSpy2<SourceBuffer['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<SourceBuffer['removeEventListener']>(\n 'removeEventListener'\n )\n dispatchEvent = createSpy2<SourceBuffer['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockStorage implements Storage {\n [key: string]: any\n\n length: number = 0\n\n clear = createSpy2<Storage['clear']>('clear')\n getItem = createSpy2<Storage['getItem']>('getItem')\n key = createSpy2<Storage['key']>('key')\n removeItem = createSpy2<Storage['removeItem']>('removeItem')\n setItem = createSpy2<Storage['setItem']>('setItem')\n}\n\nexport class MockText implements Text {\n wholeText: string = ''\n data: string = ''\n length: number = 0\n ownerDocument: Document = undefined as any\n textContent: any = undefined\n assignedSlot: HTMLSlotElement | null = null\n baseURI: string = ''\n childNodes: NodeListOf<ChildNode> = undefined as any\n firstChild: ChildNode | null = null\n isConnected: boolean = false\n lastChild: ChildNode | null = null\n nextSibling: ChildNode | null = null\n nodeName: string = ''\n nodeType: number = 0\n nodeValue: string | null = ''\n parentElement: HTMLElement | null = null\n parentNode: ParentNode | null = null\n previousSibling: ChildNode | null = null\n ELEMENT_NODE: 1 = 1\n ATTRIBUTE_NODE: 2 = 2\n TEXT_NODE: 3 = 3\n CDATA_SECTION_NODE: 4 = 4\n ENTITY_REFERENCE_NODE: 5 = 5\n ENTITY_NODE: 6 = 6\n PROCESSING_INSTRUCTION_NODE: 7 = 7\n COMMENT_NODE: 8 = 8\n DOCUMENT_NODE: 9 = 9\n DOCUMENT_TYPE_NODE: 10 = 10\n DOCUMENT_FRAGMENT_NODE: 11 = 11\n NOTATION_NODE: 12 = 12\n DOCUMENT_POSITION_DISCONNECTED: 0x01 = 1\n DOCUMENT_POSITION_PRECEDING: 0x02 = 2\n DOCUMENT_POSITION_FOLLOWING: 0x04 = 4\n DOCUMENT_POSITION_CONTAINS: 0x08 = 8\n DOCUMENT_POSITION_CONTAINED_BY: 0x10 = 16\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 = 32\n nextElementSibling: Element | null = null\n previousElementSibling: Element | null = null\n\n splitText = createSpy2<Text['splitText']>('splitText')\n appendData = createSpy2<Text['appendData']>('appendData')\n deleteData = createSpy2<Text['deleteData']>('deleteData')\n insertData = createSpy2<Text['insertData']>('insertData')\n replaceData = createSpy2<Text['replaceData']>('replaceData')\n substringData = createSpy2<Text['substringData']>('substringData')\n appendChild = createSpy2<Text['appendChild']>('appendChild')\n cloneNode = createSpy2<Text['cloneNode']>('cloneNode')\n compareDocumentPosition = createSpy2<Text['compareDocumentPosition']>(\n 'compareDocumentPosition'\n )\n contains = createSpy2<Text['contains']>('contains')\n getRootNode = createSpy2<Text['getRootNode']>('getRootNode')\n hasChildNodes = createSpy2<Text['hasChildNodes']>('hasChildNodes')\n insertBefore = createSpy2<Text['insertBefore']>('insertBefore')\n isDefaultNamespace =\n createSpy2<Text['isDefaultNamespace']>('isDefaultNamespace')\n isEqualNode = createSpy2<Text['isEqualNode']>('isEqualNode')\n isSameNode = createSpy2<Text['isSameNode']>('isSameNode')\n lookupNamespaceURI =\n createSpy2<Text['lookupNamespaceURI']>('lookupNamespaceURI')\n lookupPrefix = createSpy2<Text['lookupPrefix']>('lookupPrefix')\n normalize = createSpy2<Text['normalize']>('normalize')\n removeChild = createSpy2<Text['removeChild']>('removeChild')\n replaceChild = createSpy2<Text['replaceChild']>('replaceChild')\n after = createSpy2<Text['after']>('after')\n before = createSpy2<Text['before']>('before')\n remove = createSpy2<Text['remove']>('remove')\n replaceWith = createSpy2<Text['replaceWith']>('replaceWith')\n addEventListener = createSpy2<Text['addEventListener']>('addEventListener')\n dispatchEvent = createSpy2<Text['dispatchEvent']>('dispatchEvent')\n removeEventListener = createSpy2<Text['removeEventListener']>(\n 'removeEventListener'\n )\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { MockAbortSignal, MockMediaSource } from './lib.dom'\nimport { createSpy2 } from '../createSpyFactory'\n\nexport class MockMediaSourceGlobal extends MockMediaSource {\n static canConstructInDedicatedWorker = false\n static isTypeSupported =\n createSpy2<(typeof global.MediaSource)['isTypeSupported']>(\n 'isTypeSupported'\n )\n}\n\nexport class MockAbortSignalGlobal extends MockAbortSignal {\n static abort = createSpy2<(typeof global.AbortSignal)['abort']>('abort')\n static any = createSpy2<(typeof global.AbortSignal)['any']>('any')\n static timeout =\n createSpy2<(typeof global.AbortSignal)['timeout']>('timeout')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Some tests (such as benchmarks or type expectations) have no jasmine expectations.\n */\nexport function expectNothing() {\n expect(true).toBeTruthy()\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nlet nextTestTimeoutOverridden: boolean = false\n\n/**\n * Sets the timeout for the current describe block.\n *\n * @param timeout The test timeout, in seconds.\n */\nexport function setTestTimeout(timeout: number) {\n let originalTimeout: number | null = null\n beforeEach(() => {\n originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL\n if (!nextTestTimeoutOverridden)\n jasmine.DEFAULT_TIMEOUT_INTERVAL = timeout * 1000\n })\n\n afterEach(() => {\n if (originalTimeout) jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout\n if (nextTestTimeoutOverridden) nextTestTimeoutOverridden = false\n })\n}\n\n/**\n * Sets the timeout for the next test and only the next test,\n * overriding any value set subsequently to setTestTimeout.\n *\n * @param timeout The test timeout, in seconds.\n */\nexport function setNextTestTimeout(timeout: number) {\n nextTestTimeoutOverridden = true\n jasmine.DEFAULT_TIMEOUT_INTERVAL = timeout * 1000\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n//-------------------------------------------------------------------------\n// A Benchmarking utility for testing and comparing performance.\n//-------------------------------------------------------------------------\n\n/**\n * Gets the current high resolution timestamp, platform dependent.\n */\nlet now: () => number\nif (\n typeof window !== 'undefined' &&\n typeof window.performance !== 'undefined' &&\n typeof window.performance.now !== 'undefined'\n) {\n now = () => window.performance.now()\n} else if (\n typeof self !== 'undefined' &&\n typeof self.performance !== 'undefined' &&\n typeof self.performance.now !== 'undefined'\n) {\n now = () => self.performance.now()\n} else {\n now = () => Date.now()\n}\n\nexport interface BenchMarkOptions {\n /**\n * The amount of time to run the executor before beginning measurement (in seconds).\n */\n readonly warmupTime: number\n\n /**\n * When time has elapsed past this duration during a cycle (in seconds), there will be no\n * operations.\n * The cycle will end when `maxCycleDuration` has been reached.\n */\n readonly maxCycleDuration: number\n\n /**\n * The number of trials to run.\n */\n readonly cycles: number\n}\n\nexport interface CycleResults {\n /**\n * The number of seconds the cycle ran.\n */\n readonly duration: number\n\n /**\n * The number of completed executions.\n */\n readonly ops: number\n}\n\nexport class BenchmarkRunResults {\n readonly cycleResults: number[] = []\n\n private _totalSamples = 0\n get totalSamples(): number {\n return this._totalSamples\n }\n\n get cycleResultsNoOutliers(): number[] {\n const sD = this.standardDeviation\n const avg = average(this.cycleResults)\n return this.cycleResults.filter((e) => {\n const zScore = (avg - e) / sD\n return Math.abs(zScore) < 3\n })\n }\n\n /**\n * Returns the mean ops per second minus outliers of greater than 3 standard deviations.\n */\n get meanOpsPerSec(): number {\n return average(this.cycleResultsNoOutliers)\n }\n\n get standardDeviation(): number {\n return standardDeviation(this.cycleResults)\n }\n\n get variance(): number {\n return this.standardDeviation / this.meanOpsPerSec\n }\n\n /**\n * Returns the mean ops / s \u00B1 variance % as a string.\n */\n get meanOpsStr(): string {\n const mean = this.meanOpsPerSec.toLocaleString(undefined, {\n maximumSignificantDigits: 4,\n })\n const variance = this.variance.toLocaleString(undefined, {\n style: 'percent',\n })\n return `${mean} \u00B1${variance}`\n }\n\n constructor(readonly name: string) {}\n\n add(cycle: CycleResults) {\n const opsPerSecond = cycle.ops / cycle.duration\n let index = this.cycleResults.findIndex((value) => opsPerSecond < value)\n if (index < 0) index = this.cycleResults.length\n this.cycleResults.splice(index, 0, opsPerSecond)\n this._totalSamples += cycle.ops\n }\n\n toString(): string {\n if (!this.cycleResults.length) return 'No results'\n return `${this.name}: ${this.meanOpsStr} ops/sec`\n }\n}\n\nexport class RunResultsComparison {\n /**\n * Sorted by median ops/s from slowest to fastest.\n */\n readonly results: BenchmarkRunResults[]\n\n constructor(\n readonly name: string,\n results: BenchmarkRunResults[]\n ) {\n this.results = results.sort((a, b) => {\n return a.meanOpsPerSec - b.meanOpsPerSec\n })\n }\n\n logToTable(): void {\n const r = this.results.map((run) => {\n const variance = run.variance.toLocaleString(undefined, {\n style: 'percent',\n })\n const mean = run.meanOpsPerSec.toLocaleString(undefined, {\n maximumSignificantDigits: 4,\n })\n\n return {\n Name: run.name,\n Mean: `${mean} \u00B1${variance}`,\n Samples: run.totalSamples,\n Compare: this.runComparisonToString(run),\n }\n })\n // Use the names as the index.\n const table = r.reduce<any>((acc, { Name, ...x }) => {\n acc[Name] = x\n return acc\n }, {})\n console.log('\\n' + this.name)\n console.table(table)\n }\n\n runComparisonToString(run: BenchmarkRunResults): string {\n const baseline = this.results[0]?.meanOpsPerSec ?? 0\n const fasterPercent = run.meanOpsPerSec / baseline - 1\n return fasterPercent < 0.01\n ? '-'\n : fasterPercent.toLocaleString(undefined, {\n style: 'percent',\n }) + ' faster'\n }\n}\n\nexport function compareResults(\n name: string,\n ...results: BenchmarkRunResults[]\n): RunResultsComparison {\n return new RunResultsComparison(name, results)\n}\n\nconst defaultBenchmarkOptions: BenchMarkOptions = {\n warmupTime: 0.5,\n maxCycleDuration: 0.5,\n cycles: 9,\n} as const\n\nexport class Benchmark {\n private static semaphore: Promise<any> = nextFrame()\n\n private readonly options: BenchMarkOptions\n\n /**\n * Constructs a new Benchmark.\n *\n * @param name The name of the benchmark, to be used when logging.\n * @param executor The method to execute and measure. If this method returns a promise, the\n * promise will be awaited. The executor should either always return a promise, or never.\n * @param options Optional configuration for the benchmark.\n */\n constructor(\n readonly name: string,\n readonly executor: () => any,\n options?: Partial<BenchMarkOptions>\n ) {\n this.options = { ...defaultBenchmarkOptions, ...options }\n }\n\n async run(): Promise<BenchmarkRunResults> {\n const opts = this.options\n // Wait for any currently running work to complete.\n await Benchmark.semaphore\n\n const warmupTimeMs = opts.warmupTime * 1000\n const cycleStart = now()\n let isAsync = false\n do {\n const result = this.executor()\n // If the executor returns a promise, it is considered an async test and the benchmark\n // should await its result.\n isAsync = isAsync || (result && typeof result.then === 'function')\n if (isAsync) await result\n } while (now() - cycleStart < warmupTimeMs)\n const resultsPromise: Promise<BenchmarkRunResults> = (async () => {\n const results = new BenchmarkRunResults(this.name)\n for (let i = 0; i < opts.cycles; i++) {\n const cycleResults = await this.runCycle(isAsync)\n results.add(cycleResults)\n await nextFrame()\n }\n return results\n })()\n Benchmark.semaphore = resultsPromise\n return await resultsPromise\n }\n\n /**\n * Runs one cycle. A cycle will repeat the executor approximately `options.maxCycleDuration`\n * seconds.\n *\n * @param isAsync\n * @return Returns the duration (in seconds) and number of operations the cycle repeated.\n */\n private async runCycle(isAsync: boolean): Promise<CycleResults> {\n const cycleMs = this.options.maxCycleDuration * 1000\n let ops = 0\n const cycleStart = now()\n do {\n const result = this.executor()\n if (isAsync) await result\n ops++\n } while (now() - cycleStart < cycleMs)\n const duration = (now() - cycleStart) / 1000\n return {\n duration,\n ops,\n }\n }\n}\n\n/**\n * Creates and runs a benchmark, logging the result.\n *\n * @param name\n * @param executor\n * @param options\n */\nexport function benchmark(\n name: string,\n executor: () => any,\n options?: Partial<BenchMarkOptions>\n): Promise<BenchmarkRunResults> {\n const benchmark = new Benchmark(name, executor, options)\n return benchmark.run().then((results) => {\n console.log(results.toString())\n return results\n })\n}\n\n/**\n * To avoid killing the browser's frame.\n */\nfunction nextFrame(): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve)\n })\n}\n\n/**\n * Returns the standard deviation of the given values.\n *\n * @param values\n */\nfunction standardDeviation(values: readonly number[]): number {\n const avg = average(values)\n const squareDiffs = values.map((value) => {\n const diff = value - avg\n return diff * diff\n })\n const avgSquareDiff = average(squareDiffs)\n return Math.sqrt(avgSquareDiff)\n}\n\n/**\n * Returns the mean/average of the given values.\n *\n * @param values\n */\nfunction average(values: readonly number[]): number {\n const sum = values.reduce((acc, value) => acc + value, 0)\n return sum / values.length\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n BenchmarkRunResults,\n RunResultsComparison,\n} from '@amazon/vinyl-util/browserTestUtil'\nimport {\n compareResults,\n expectNothing,\n setTestTimeout,\n} from '@amazon/vinyl-util/browserTestUtil'\n\nexport function setupBenchmark(): void {\n setTestTimeout(180)\n afterEach(expectNothing)\n}\n\nconst comparisons: RunResultsComparison[] = []\n\n/**\n * Adds a benchmark comparison to be displayed at the end of the test.\n * @param comparison\n */\nexport function addComparison(comparison: RunResultsComparison) {\n comparisons.push(comparison)\n}\n\n/**\n * Adds a list of benchmark results to be compared with each other.\n * The results will be logged then for browser environments displayed at the end of the suite.\n *\n * @param name The comparison suite name.\n * @param results\n */\nexport function addBenchmarks(name: string, ...results: BenchmarkRunResults[]) {\n const comparison = compareResults(name, ...results)\n comparison.logToTable()\n comparisons.push(comparison)\n}\n\nif (typeof document !== 'undefined') {\n jasmine.getEnv().addReporter({\n jasmineDone: () => {\n console.log('Tests complete')\n const jasmineContainer = document.getElementsByClassName(\n 'jasmine_html-reporter'\n )[0]\n jasmineContainer.parentElement?.removeChild(jasmineContainer)\n const container = createEl('div', document.body)\n container.id = 'benchmarkResults'\n const sortedComparisons = [...comparisons].sort((a, b) =>\n a.name > b.name ? 1 : -1\n )\n for (const comparison of sortedComparisons) {\n toTableHtml(comparison, container)\n }\n },\n })\n}\n\nfunction toTableHtml(\n comparison: RunResultsComparison,\n parent?: HTMLElement\n): HTMLDivElement {\n const container = createEl('div', parent)\n container.className = 'benchmarkComparison'\n const title = createEl('h2', container)\n title.innerText = comparison.name\n const table = createEl('table', container)\n const head = createEl('thead', table)\n const headRow = createEl('tr', head)\n const name = createEl('th', headRow)\n name.innerText = 'Name'\n const median = createEl('th', headRow)\n median.innerText = 'Mean ops/s'\n const samples = createEl('th', headRow)\n samples.innerText = 'Samples'\n const compare = createEl('th', headRow)\n compare.innerText = '% Comparison'\n\n const body = createEl('tbody', table)\n comparison.results.forEach((result) => {\n const row = createEl('tr', body)\n createEl('th', row).innerText = result.name\n createEl('td', row).innerText = result.meanOpsStr\n createEl('td', row).innerText = result.totalSamples.toLocaleString()\n createEl('td', row).innerText = comparison.runComparisonToString(result)\n })\n return container\n}\n\nfunction createEl<K extends keyof HTMLElementTagNameMap>(\n tagName: K,\n parent?: HTMLElement,\n options?: ElementCreationOptions\n): HTMLElementTagNameMap[K] {\n const element = document.createElement(tagName, options)\n if (parent) parent.appendChild(element)\n return element\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { parseMainPlaylist, parseMediaPlaylist } from '@amazon/vinyl-hls-parser'\nimport { benchmark } from '@amazon/vinyl-util/browserTestUtil'\nimport { addBenchmarks, setupBenchmark } from '../../setup'\n\nconst sampleMainPlaylist = `#EXTM3U\n#EXT-X-VERSION:6\n#EXT-X-INDEPENDENT-SEGMENTS\n\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"English\",LANGUAGE=\"en\",DEFAULT=YES,AUTOSELECT=YES,URI=\"audio/en/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Spanish\",LANGUAGE=\"es\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/es/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"French\",LANGUAGE=\"fr\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/fr/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"German\",LANGUAGE=\"de\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/de/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Italian\",LANGUAGE=\"it\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/it/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Portuguese\",LANGUAGE=\"pt\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/pt/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Japanese\",LANGUAGE=\"ja\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/ja/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Korean\",LANGUAGE=\"ko\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/ko/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Chinese\",LANGUAGE=\"zh\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/zh/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Russian\",LANGUAGE=\"ru\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/ru/64k/index.m3u8\"\n\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-128\",NAME=\"English\",LANGUAGE=\"en\",DEFAULT=YES,AUTOSELECT=YES,URI=\"audio/en/128k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-128\",NAME=\"Spanish\",LANGUAGE=\"es\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/es/128k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-128\",NAME=\"French\",LANGUAGE=\"fr\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/fr/128k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-128\",NAME=\"German\",LANGUAGE=\"de\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/de/128k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-128\",NAME=\"Italian\",LANGUAGE=\"it\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/it/128k/index.m3u8\"\n\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"English\",LANGUAGE=\"en\",DEFAULT=YES,AUTOSELECT=YES,URI=\"subtitles/en/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Spanish\",LANGUAGE=\"es\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/es/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"French\",LANGUAGE=\"fr\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/fr/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"German\",LANGUAGE=\"de\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/de/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Italian\",LANGUAGE=\"it\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/it/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Portuguese\",LANGUAGE=\"pt\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/pt/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Japanese\",LANGUAGE=\"ja\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/ja/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Korean\",LANGUAGE=\"ko\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/ko/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Chinese\",LANGUAGE=\"zh\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/zh/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Russian\",LANGUAGE=\"ru\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/ru/index.m3u8\"\n\n#EXT-X-STREAM-INF:BANDWIDTH=400000,AVERAGE-BANDWIDTH=380000,CODECS=\"avc1.42e00a,mp4a.40.2\",RESOLUTION=416x234,FRAME-RATE=23.976,AUDIO=\"audio-aacl-64\",SUBTITLES=\"subs\"\nvideo/400k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=800000,AVERAGE-BANDWIDTH=760000,CODECS=\"avc1.42e015,mp4a.40.2\",RESOLUTION=640x360,FRAME-RATE=23.976,AUDIO=\"audio-aacl-64\",SUBTITLES=\"subs\"\nvideo/800k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=1200000,AVERAGE-BANDWIDTH=1140000,CODECS=\"avc1.42e01e,mp4a.40.2\",RESOLUTION=854x480,FRAME-RATE=23.976,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/1200k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=1800000,AVERAGE-BANDWIDTH=1710000,CODECS=\"avc1.42e01f,mp4a.40.2\",RESOLUTION=1280x720,FRAME-RATE=23.976,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/1800k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=2500000,AVERAGE-BANDWIDTH=2375000,CODECS=\"avc1.42e020,mp4a.40.2\",RESOLUTION=1280x720,FRAME-RATE=29.97,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/2500k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=3500000,AVERAGE-BANDWIDTH=3325000,CODECS=\"avc1.42e028,mp4a.40.2\",RESOLUTION=1920x1080,FRAME-RATE=23.976,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/3500k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=5000000,AVERAGE-BANDWIDTH=4750000,CODECS=\"avc1.42e028,mp4a.40.2\",RESOLUTION=1920x1080,FRAME-RATE=29.97,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/5000k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=7500000,AVERAGE-BANDWIDTH=7125000,CODECS=\"avc1.42e032,mp4a.40.2\",RESOLUTION=1920x1080,FRAME-RATE=59.94,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/7500k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=10000000,AVERAGE-BANDWIDTH=9500000,CODECS=\"avc1.640028,mp4a.40.2\",RESOLUTION=3840x2160,FRAME-RATE=23.976,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/10000k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=15000000,AVERAGE-BANDWIDTH=14250000,CODECS=\"avc1.640028,mp4a.40.2\",RESOLUTION=3840x2160,FRAME-RATE=29.97,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/15000k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=20000000,AVERAGE-BANDWIDTH=19000000,CODECS=\"avc1.640032,mp4a.40.2\",RESOLUTION=3840x2160,FRAME-RATE=59.94,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/20000k/index.m3u8`\n\nconst sampleMediaPlaylist = `#EXTM3U\n#EXT-X-VERSION:6\n#EXT-X-TARGETDURATION:10\n#EXT-X-MEDIA-SEQUENCE:0\n#EXT-X-PLAYLIST-TYPE:VOD\n\n#EXT-X-KEY:METHOD=AES-128,URI=\"https://example.com/keys/key1.bin\",IV=0x99b74007b6254e4bd1c6e03631cad15b\n\n#EXTINF:9.009,\nsegment00000.ts\n#EXTINF:9.009,\nsegment00001.ts\n#EXTINF:9.009,\nsegment00002.ts\n#EXTINF:9.009,\nsegment00003.ts\n#EXTINF:9.009,\nsegment00004.ts\n#EXTINF:9.009,\nsegment00005.ts\n#EXTINF:9.009,\nsegment00006.ts\n#EXTINF:9.009,\nsegment00007.ts\n#EXTINF:9.009,\nsegment00008.ts\n#EXTINF:9.009,\nsegment00009.ts\n#EXTINF:9.009,\nsegment00010.ts\n#EXTINF:9.009,\nsegment00011.ts\n#EXTINF:9.009,\nsegment00012.ts\n#EXTINF:9.009,\nsegment00013.ts\n#EXTINF:9.009,\nsegment00014.ts\n#EXTINF:9.009,\nsegment00015.ts\n#EXTINF:9.009,\nsegment00016.ts\n#EXTINF:9.009,\nsegment00017.ts\n#EXTINF:9.009,\nsegment00018.ts\n#EXTINF:9.009,\nsegment00019.ts\n\n#EXT-X-KEY:METHOD=AES-128,URI=\"https://example.com/keys/key2.bin\",IV=0x12345678901234567890123456789012\n\n#EXTINF:9.009,\nsegment00020.ts\n#EXTINF:9.009,\nsegment00021.ts\n#EXTINF:9.009,\nsegment00022.ts\n#EXTINF:9.009,\nsegment00023.ts\n#EXTINF:9.009,\nsegment00024.ts\n#EXTINF:9.009,\nsegment00025.ts\n#EXTINF:9.009,\nsegment00026.ts\n#EXTINF:9.009,\nsegment00027.ts\n#EXTINF:9.009,\nsegment00028.ts\n#EXTINF:9.009,\nsegment00029.ts\n\n#EXT-X-DISCONTINUITY\n#EXT-X-KEY:METHOD=AES-128,URI=\"https://example.com/keys/key3.bin\",IV=0xabcdef1234567890abcdef1234567890\n\n#EXTINF:9.009,\nsegment00030.ts\n#EXTINF:9.009,\nsegment00031.ts\n#EXTINF:9.009,\nsegment00032.ts\n#EXTINF:9.009,\nsegment00033.ts\n#EXTINF:9.009,\nsegment00034.ts\n#EXTINF:9.009,\nsegment00035.ts\n#EXTINF:9.009,\nsegment00036.ts\n#EXTINF:9.009,\nsegment00037.ts\n#EXTINF:9.009,\nsegment00038.ts\n#EXTINF:9.009,\nsegment00039.ts\n#EXTINF:9.009,\nsegment00040.ts\n#EXTINF:9.009,\nsegment00041.ts\n#EXTINF:9.009,\nsegment00042.ts\n#EXTINF:9.009,\nsegment00043.ts\n#EXTINF:9.009,\nsegment00044.ts\n#EXTINF:9.009,\nsegment00045.ts\n#EXTINF:9.009,\nsegment00046.ts\n#EXTINF:9.009,\nsegment00047.ts\n#EXTINF:9.009,\nsegment00048.ts\n#EXTINF:9.009,\nsegment00049.ts\n\n#EXT-X-KEY:METHOD=NONE\n\n#EXTINF:9.009,\nsegment00050.ts\n#EXTINF:9.009,\nsegment00051.ts\n#EXTINF:9.009,\nsegment00052.ts\n#EXTINF:9.009,\nsegment00053.ts\n#EXTINF:9.009,\nsegment00054.ts\n#EXTINF:9.009,\nsegment00055.ts\n#EXTINF:9.009,\nsegment00056.ts\n#EXTINF:9.009,\nsegment00057.ts\n#EXTINF:9.009,\nsegment00058.ts\n#EXTINF:9.009,\nsegment00059.ts\n#EXTINF:9.009,\nsegment00060.ts\n#EXTINF:9.009,\nsegment00061.ts\n#EXTINF:9.009,\nsegment00062.ts\n#EXTINF:9.009,\nsegment00063.ts\n#EXTINF:9.009,\nsegment00064.ts\n#EXTINF:9.009,\nsegment00065.ts\n#EXTINF:9.009,\nsegment00066.ts\n#EXTINF:9.009,\nsegment00067.ts\n#EXTINF:9.009,\nsegment00068.ts\n#EXTINF:9.009,\nsegment00069.ts\n#EXTINF:9.009,\nsegment00070.ts\n#EXTINF:9.009,\nsegment00071.ts\n#EXTINF:9.009,\nsegment00072.ts\n#EXTINF:9.009,\nsegment00073.ts\n#EXTINF:9.009,\nsegment00074.ts\n#EXTINF:9.009,\nsegment00075.ts\n#EXTINF:9.009,\nsegment00076.ts\n#EXTINF:9.009,\nsegment00077.ts\n#EXTINF:9.009,\nsegment00078.ts\n#EXTINF:9.009,\nsegment00079.ts\n#EXTINF:9.009,\nsegment00080.ts\n#EXTINF:9.009,\nsegment00081.ts\n#EXTINF:9.009,\nsegment00082.ts\n#EXTINF:9.009,\nsegment00083.ts\n#EXTINF:9.009,\nsegment00084.ts\n#EXTINF:9.009,\nsegment00085.ts\n#EXTINF:9.009,\nsegment00086.ts\n#EXTINF:9.009,\nsegment00087.ts\n#EXTINF:9.009,\nsegment00088.ts\n#EXTINF:9.009,\nsegment00089.ts\n#EXTINF:9.009,\nsegment00090.ts\n#EXTINF:9.009,\nsegment00091.ts\n#EXTINF:9.009,\nsegment00092.ts\n#EXTINF:9.009,\nsegment00093.ts\n#EXTINF:9.009,\nsegment00094.ts\n#EXTINF:9.009,\nsegment00095.ts\n#EXTINF:9.009,\nsegment00096.ts\n#EXTINF:9.009,\nsegment00097.ts\n#EXTINF:9.009,\nsegment00098.ts\n#EXTINF:5.005,\nsegment00099.ts\n\n#EXT-X-ENDLIST`\n\ndescribe('parseHlsManifest', () => {\n setupBenchmark()\n\n it('Parse HLS Main Playlist', async () => {\n addBenchmarks(\n 'Parse HLS Main Playlist',\n await benchmark('HLS Main', () =>\n parseMainPlaylist(sampleMainPlaylist)\n )\n )\n })\n\n it('Parse HLS Media Playlist', async () => {\n addBenchmarks(\n 'Parse HLS Media Playlist',\n await benchmark('HLS Media', () =>\n parseMediaPlaylist(sampleMediaPlaylist)\n )\n )\n })\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqLO,WAAS,YAA6B;AACzC,WAAO;AAAA,EACX;;;AClLO,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA,IAKvB,UAAU;AAAA;AAAA;AAAA;AAAA,IAKV,UAAU;AAAA;AAAA;AAAA;AAAA,IAKV,KAAK;AAAA;AAAA;AAAA;AAAA,IAKL,kBAAkB;AAAA;AAAA;AAAA;AAAA,IAKlB,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,IAMlB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAMP,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,IAMT,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOf,KAAK;AAAA,EACT;;;AC5BO,MAAM,kBAAN,MAAM,yBAAwB,MAAM;AAAA,IAKvC,YACI,SACS,SAAiB,YAAY,UAC7B,QAAoB,qBAC/B;AACE,YAAM,OAAO;AAHJ;AACA;AAGT,aAAO,eAAe,MAAM,iBAAgB,SAAS;AAAA,IACzD;AAAA,IAXA,KAAK,OAAO,WAAW,IAAY;AAC/B,aAAO;AAAA,IACX;AAAA,IAWA,IAAI,OAAe;AACf,aAAO,KAAK,OAAO,WAAW;AAAA,IAClC;AA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6N5B,WAAS,oBAAoB,MAAM;AAC/B,mBAAe;AAEf,OAAG,2BAA2B,YAAY;AACtC;AAAA,QACI;AAAA,QACA,MAAM;AAAA,UAAU;AAAA,UAAY,MACxB,kBAAkB,kBAAkB;AAAA,QACxC;AAAA,MACJ;AAAA,IACJ,CAAC;AAED,OAAG,4BAA4B,YAAY;AACvC;AAAA,QACI;AAAA,QACA,MAAM;AAAA,UAAU;AAAA,UAAa,MACzB,mBAAmB,mBAAmB;AAAA,QAC1C;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;",
6
- "names": ["locale", "value", "input", "locale", "locale", "locale", "locale", "locale", "EXTM3U", "benchmark"]
3
+ "sources": ["../../../vinyl-util/src/error/ErrorOrigin.ts", "../../../vinyl-util/src/error/ReportableError.ts", "../../../vinyl-util/src/error/IllegalArgumentError.ts", "../../../vinyl-util/src/util/map/map.ts", "../../../vinyl-util/src/util/type.ts", "../../../vinyl-util/src/util/string/string.ts", "../../../vinyl-util/src/util/object/object.ts", "../../../vinyl-util/src/util/serialization/json.ts", "../../../vinyl-util/src/error/ValidationError.ts", "../../../vinyl-util/src/util/math/math.ts", "../../../vinyl-util/src/util/serialization/ParseError.ts", "../../../vinyl-util/src/util/serialization/stringifyForPrint.ts", "../../../vinyl-util/src/util/string/StringReader.ts", "../../src/parse/parseAttributes.ts", "../../../vinyl-validation/src/validation/Validator.ts", "../../../vinyl-validation/src/validation/JsonSchema.ts", "../../../vinyl-validation/src/validation/andValidators.ts", "../../../vinyl-validation/src/validation/orValidators.ts", "../../../vinyl-validation/src/validation/SchemaBase.ts", "../../../vinyl-validation/src/validation/ValueSchema.ts", "../../../vinyl-validation/src/validation/validators.ts", "../../src/types/AlternativeRendition.ts", "../../src/types/EncryptionKey.ts", "../../src/parse/parseUtil.ts", "../../src/parse/parseMediaPlaylist.ts", "../../src/parse/parseMainPlaylist.ts", "../../../vinyl-util/test/browserTestUtil/benchmark/Benchmark.ts", "../../../vinyl-util/test/browserTestUtil/env/jasmineEnv.ts", "../../../vinyl-util/test/browserTestUtil/expect/expectNothing.ts", "../../../vinyl-util/test/browserTestUtil/mock/createSpyFactory.ts", "../../../vinyl-util/test/browserTestUtil/mock/dom/lib.dom.ts", "../../../vinyl-util/test/browserTestUtil/mock/dom/globals.ts", "../../test/benchmark/setup.ts", "../../test/benchmark/manifest/hls/parseHlsManifest.bench.ts"],
4
+ "sourcesContent": ["/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const ErrorOrigin = {\n /**\n * The error originated from Vinyl and was reported from the uncaught exception or promise\n * rejection handlers.\n */\n UNCAUGHT: 'uncaught',\n\n /**\n * The error originated from Vinyl and was caught.\n */\n INTERNAL: 'internal',\n\n /**\n * A Vinyl interface was used incorrectly by a consumer.\n */\n API: 'api',\n\n /**\n * The error originated from a failed service call (500 errors).\n */\n SERVICE_EXTERNAL: 'serviceExternal',\n\n /**\n * The error originated from a failed service call (400 errors).\n */\n SERVICE_INTERNAL: 'serviceInternal',\n\n /**\n * The error originated from a problem playing provided media.\n * The reporter is from a component such as the element, source buffer, media source, etc.\n */\n MEDIA: 'media',\n\n /**\n * The error originated from a problem parsing input data.\n * Such as a malformed Dash or HLS manifest.\n */\n PARSING: 'parsing',\n\n /**\n * The error originated from an incompatibility with browser APIs,\n * such as EME.\n */\n COMPATIBILITY: 'compatibility',\n\n /**\n * The error originated from DRM.\n * This does not include internal or service errors, only errors from the creation of media keys or media key\n * sessions.\n */\n DRM: 'drm',\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin } from './ErrorOrigin'\nimport type { Json } from '../util/serialization/json'\n\nexport enum ErrorLevel {\n /**\n * Fatal errors are not recoverable.\n */\n FATAL = 'fatal',\n\n /**\n * Warn level errors should be reported, but are recoverable.\n */\n WARN = 'warn',\n\n /**\n * Silent errors should not be reported. For example aborting a play operation due to a new track loading.\n */\n SILENT = 'silent',\n}\n\n/**\n * A Serializable Error that contains an error origin.\n */\nexport class ReportableError extends Error {\n get [Symbol.toStringTag](): string {\n return 'ReportableError'\n }\n\n constructor(\n message?: string,\n readonly origin: string = ErrorOrigin.INTERNAL,\n readonly level: ErrorLevel = ErrorLevel.FATAL\n ) {\n super(message)\n Object.setPrototypeOf(this, ReportableError.prototype)\n }\n\n get name(): string {\n return this[Symbol.toStringTag]\n }\n\n /**\n * All ReportableError instances must be serializable.\n */\n toJSON(): Json {\n return {\n level: this.level,\n message: this.message,\n name: this.name,\n origin: this.origin,\n stack: this.stack,\n }\n }\n}\n\n/**\n * Returns true if the given object is a ReportableError.\n */\nexport function isReportableError(error: any): error is ReportableError {\n // This does not use instanceof ReportableError to avoid ambiguity in the case where this module\n // is loaded multiple times due to version conflicts or code splitting.\n return error instanceof Error && 'origin' in error && 'level' in error\n}\n\n/**\n * Returns true if the error is a ReportableError and is level SILENT.\n * @param error\n */\nexport function isSilentError(error: any): boolean {\n return isReportableError(error) && error.level === ErrorLevel.SILENT\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin } from './ErrorOrigin'\nimport { ReportableError } from './ReportableError'\n\n/**\n * An error indicating that a method was called with illegal arguments.\n */\nexport class IllegalArgumentError extends ReportableError {\n get [Symbol.toStringTag](): string {\n return 'IllegalArgumentError'\n }\n\n constructor(\n message: string,\n readonly isInternal = true\n ) {\n super(message, isInternal ? ErrorOrigin.INTERNAL : ErrorOrigin.API)\n Object.setPrototypeOf(this, IllegalArgumentError.prototype)\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The minimal `Map`-shaped interface that {@link getOrSet} needs.\n */\nexport interface GetOrSetMap<K, V> {\n has(key: K): boolean\n get(key: K): V | undefined\n set(key: K, value: V): unknown\n}\n\n/**\n * Gets the value on map for the given key if it exists, otherwise sets [key] to `defaultValue`,\n * returning the newly set value.\n *\n * @param map\n * @param key\n * @param defaultValue\n */\nexport function getOrSet<K, V>(\n map: GetOrSetMap<K, V>,\n key: K,\n defaultValue: (key: K) => V\n): V {\n if (map.has(key)) {\n return map.get(key) as V\n } else {\n const value = defaultValue(key)\n map.set(key, value)\n return value\n }\n}\n\n/**\n * Flips a map so that the keys become the values and the values become the keys.\n *\n * @param map\n * @return Returns a new map.\n */\nexport function flipMap<K, V>(map: Iterable<readonly [K, V]>): Map<V, K> {\n const result = new Map<V, K>()\n for (const [key, value] of map) {\n result.set(value, key)\n }\n return result\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/*\n * Type-safety utility\n */\n\n/**\n * Distributes the value types of an array into a union.\n */\nexport type Flatten<T> = T extends readonly any[] ? T[number] : T\n\n/**\n * Property keys of an object that do not map to functions.\n */\nexport type NonFunctionPropertyNames<T> = {\n [K in keyof T]: T[K] extends (...args: any) => any ? never : K\n}[keyof T]\n\n/**\n * All primitive types.\n */\nexport type Primitive =\n | bigint\n | boolean\n | number\n | string\n | symbol\n | null\n | undefined\n\n/**\n * An empty object, safer than using `object` type.\n */\nexport type AnyRecord = Record<never, any>\n\n/**\n * never, with a message to help explain the problem.\n * https://github.com/microsoft/TypeScript/issues/33098\n */\nexport type Never<Message extends string> = [never, Message]\n\n/**\n * A type representing any type of function.\n */\nexport type Fun = (...args: any[]) => any\n\n/**\n * Enforces that the type represents data that can be serialized via JSON.stringify.\n */\nexport type JsonCompatible<T> = unknown extends T\n ? never\n : T extends bigint | symbol | Fun\n ? never\n : T extends\n | boolean\n | number\n | string\n | null\n | undefined\n | { toJSON(): any }\n ? T\n : T extends readonly any[]\n ? readonly JsonCompatible<T[number]>[]\n : {\n [P in keyof T]: JsonCompatible<T[P]>\n }\n\n/**\n * A compile-time check that the given value/array/object is serializable via JSON.stringify.\n *\n * A value is serializable if any of these are true:\n * - It is an object with a toJSON() function\n * - It is an object with only serializable members.\n * - It is an array with only serializable elements.\n * - It is type boolean, string, number, null, or undefined.\n */\nexport function jsonCompatible<T>(value: JsonCompatible<T>): T {\n return value as T\n}\n\n/**\n * An object whose properties are all optional, and all sub-properties are optional.\n * Note: does not convert array or tuple elements to Partial.\n */\nexport type PartialDeep<T> = T extends Fun | Primitive\n ? T\n : T extends object\n ? {\n [P in keyof T]?: PartialDeep<T[P]>\n }\n : T\n\n/**\n * Defines specific properties of T that are not required.\n */\nexport type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>\n\n/**\n * Possible values `typeof` operator may return.\n */\nexport type Typeof =\n | 'bigint'\n | 'boolean'\n | 'function'\n | 'number'\n | 'object'\n | 'string'\n | 'symbol'\n | 'undefined'\n\n/**\n * Given a possible result from `typeof`, provides the type to the matched value.\n */\nexport type FromTypeof<T extends Typeof> = T extends 'bigint'\n ? bigint\n : T extends 'boolean'\n ? boolean\n : T extends 'function'\n ? Fun\n : T extends 'number'\n ? number\n : T extends 'object'\n ? object | null\n : T extends 'string'\n ? string\n : T extends 'symbol'\n ? symbol\n : T extends 'undefined'\n ? undefined\n : any\n\n/**\n * Extracts values from T which extends type U.\n */\nexport type ExtractValues<T, U> = Pick<\n T,\n {\n [P in keyof T]: T[P] extends U ? P : never\n }[keyof T]\n>\n\n/**\n * Excludes values from T which extends type U.\n */\nexport type ExcludeValues<T, U> = Pick<\n T,\n {\n [P in keyof T]: T[P] extends U ? never : P\n }[keyof T]\n>\n\nexport type Maybe<T> = T | undefined | null\n\n/**\n * Infers the element type from an Array type.\n */\nexport type ElementType<T extends readonly any[]> =\n T extends ReadonlyArray<infer E> ? E : never\n\n/**\n * Infers the element type from a Set type.\n */\nexport type SetElementType<T extends ReadonlySet<any>> =\n T extends ReadonlySet<infer E> ? E : never\n\n/**\n * Enforces type T to be in an invariant position.\n * For example `Invariant<Square>` cannot be assigned to type `Invariant<Polygon>` or vice versa.\n *\n * This should be used when an interface with type parameter T needs strict invariance in addition to what the\n * compiler can infer from use.\n *\n * {@link https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)}\n */\nexport type Invariant<T> = T &\n Required<T> &\n ((input: T & Required<T>) => T & Required<T>)\n\nexport function invariant<T>(): Invariant<T> {\n return undefined as any\n}\n\n/**\n * Enforces type T to be in a covariant position.\n * For example `Invariant<Square>` can be assigned to type `Invariant<Polygon>` but not vice versa.\n *\n * This should be used when an interface with type parameter T does not explicitly use T in an\n * output position, but the interface implies `out T`.\n */\nexport type Covariant<T> = () => T\n\nexport function covariant<T>(): Covariant<T> {\n return undefined as any\n}\n\n/**\n * Enforces type T to be in a covariant position.\n * For example `Invariant<Polygon>` can be assigned to type `Invariant<Square>` but not vice versa.\n *\n * This should be used when an interface with type parameter T does not explicitly use T in an\n * input position, but the interface implies `in T`.\n */\nexport type Contravariant<T> = (input: T) => void\n\nexport function contravariant<T>(): Contravariant<T> {\n return undefined as any\n}\n\n/**\n * A type which may either be a direct instance of T or a promise that resolves to T.\n */\nexport type MaybePromise<T> = PromiseLike<T> | T\n\n/**\n * Deeply excludes all keys from T extending K.\n */\nexport type OmitDeep<T, K extends keyof any> = Omit<\n {\n [P in keyof T]: T[P] extends Primitive ? T[P] : OmitDeep<T[P], K>\n },\n K\n>\n\n/**\n * Make properties of T extending K optional.\n */\nexport type Optional<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>\n\n/**\n * Make properties of T extending K optional, recursively.\n */\nexport type OptionalDeep<T, K extends keyof any> = Optional<\n {\n [P in keyof T]: T[P] extends Primitive ? T[P] : OptionalDeep<T[P], K>\n },\n K & keyof T\n>\n\n/**\n * true if T extends never, otherwise false\n */\nexport type IsNever<T> = [T] extends [never] ? true : false\n\n/**\n * true if T extends any, otherwise false\n */\nexport type IsAny<T> = 0 extends 1 & T ? true : false\n\n/**\n * Determines whether a property `P` of object type `U` is declared as optional.\n *\n * This checks whether the `{}` type (an empty object) is assignable to\n * `Pick<U, P>`. In TypeScript, this is true only when `P` is marked optional\n * using the `?` modifier in the type definition.\n *\n * Importantly, this detects *actual optionality* rather than checking whether\n * the property's type includes `undefined`. For example:\n *\n * ```ts\n * type A = { x?: string }; // optional\n * type B = { x: string | undefined }; // required but allows undefined\n *\n * IsPropertyOptional<A, \"x\"> // true\n * IsPropertyOptional<B, \"x\"> // false\n * ```\n *\n * @template U - The object type containing the property.\n * @template P - The key of the property to test.\n * @returns `true` if `P` is an optional property, otherwise `false`.\n */\nexport type IsPropertyOptional<U, P extends keyof U> =\n AnyRecord extends Pick<U, P> ? true : false\n\n/**\n * A type that equals true if Left and Right are loosely equal, that is, that Left extends Right\n * and Right extends Left.\n * This will always equal true or false, and never the union `true | false`\n */\nexport type Equal<Left, Right> = [Left] extends [Right]\n ? [Right] extends [Left]\n ? true\n : false\n : false\n\n/**\n * A type that equals true if Left and Right are strictly equal.\n * Works with complex objects, readonly, and optional modifiers.\n * Works with method input arguments.\n * This will always equal true or false, and never the union `true | false`\n */\nexport type StrictEqual<Left, Right> =\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters\n (<T>() => T extends Left ? 0 : 1) extends <T>() => T extends Right ? 0 : 1\n ? Equal<Left, Right>\n : false\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IllegalArgumentError } from '../../error/IllegalArgumentError'\nimport { flipMap } from '../map/map'\nimport type { Maybe } from '../type'\nimport type { ReadonlyRecord } from '../object/readonlyType'\n\n/**\n * @private\n */\nconst locale = {\n variableNotDefined: \"Variable '{name}' is not defined\",\n} as const\n\n/**\n * The default substitution pattern, matching `{name}`.\n */\nconst DEFAULT_SUBSTITUTE_PATTERN = /\\{(\\w+)}/g\n\n/**\n * Substitutes named variable references in a string.\n *\n * Example:\n * ```\n * substitute('{fruit}, {veg}', { fruit: 'apples', veg: 'carrots' }) // 'apples, carrots'\n * ```\n *\n * @param str The template string.\n * @param variables A record of variable names to values.\n * @param pattern A regex whose first capture group is the variable name. Defaults to `{name}`.\n * @throws IllegalArgumentError if a referenced variable is not defined.\n */\nexport function substitute(\n str: string,\n variables: Readonly<Record<string, any>>,\n pattern: RegExp = DEFAULT_SUBSTITUTE_PATTERN\n): string {\n return str.replace(pattern, (_, name) => {\n if (!(name in variables)) {\n throw new IllegalArgumentError(\n locale.variableNotDefined.replace('{name}', String(name))\n )\n }\n return String(variables[name])\n })\n}\n\n/**\n * Replaces substitution tokens.\n *\n * Each identifier may be suffixed, within the enclosing '$' characters, with an additional format tag for number\n * padding following the prototype: `%0[width]d`\n * For example:\n * 'Segment_$Time%04d$' Where the `Time` property is `42` will have a replacement value of: `Segment_0042`\n */\nexport function substituteIdentifiers(\n str: string,\n props: ReadonlyRecord<string, string | number>\n): string {\n return str.replace(/\\$(\\w*)(?:%0(\\d+)d)?\\$/g, (_, match, maxLength) => {\n if (!match) return '$'\n if (!(match in props)) {\n throw new IllegalArgumentError(\n `Template substitution token '${match}' was not understood`\n )\n }\n let prop = String(props[match])\n if (maxLength) prop = prop.padStart(maxLength, '0')\n return prop\n })\n}\n\n/**\n * Returns true if the character is one of: ' ', '\\t', '\\n', '\\r'\n *\n * @param charCode The character code to test\n */\nexport function isWhitespaceChar(charCode: number): boolean {\n return (\n charCode === 0x20 || // ' ' (space)\n charCode === 0x09 || // '\\t' (tab)\n charCode === 0x0d || // '\\r' (carriage return)\n charCode === 0x0a // '\\n' (line feed)\n )\n}\n\nconst encodedEntitiesRegex = /&(#(\\d+)|\\w+);/gi\n\n/**\n * Predefined general xml entities\n * https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent\n */\nexport const predefinedDecodeEntities: ReadonlyMap<string, string> = new Map([\n ['apos', \"'\"],\n ['amp', '&'],\n ['lt', '<'],\n ['gt', '>'],\n ['quot', '\"'],\n])\n\n/**\n * Replaces all specified entities with their mapped representations.\n * For example (using {@link predefinedDecodeEntities}):\n * ```\n * `&lt;Hello to y&apos;all&#33;&gt;` becomes `<Hello to y'all!>`\n * ```\n *\n * @param str\n * @param namedEntities\n */\nexport function decodeEntities(\n str: string,\n namedEntities: ReadonlyMap<string, string> = predefinedDecodeEntities\n): string {\n if (encodedEntitiesRegex.test(str)) {\n return str.replace(\n encodedEntitiesRegex,\n (substring, entityName, codePoint) => {\n if (codePoint !== undefined)\n return String.fromCharCode(parseInt(codePoint))\n const entityValue = namedEntities.get(entityName.toLowerCase())\n if (!entityValue) return substring\n return entityValue\n }\n )\n } else {\n return str\n }\n}\n\nconst standardEntityValueToNames = flipMap(predefinedDecodeEntities)\nconst entitiesRegex = /['&<>\"]/g\n\n/**\n * Encodes the predefined xml standard entities into their entity names.\n *\n * & to &amp;\n * ' to &apos;\n * > to &gt;\n * < to &lt;\n * \" to &quot;\n *\n * @param str\n */\nexport function encodeEntities(str: string): string {\n if (entitiesRegex.test(str)) {\n return str.replace(entitiesRegex, (entityValue) => {\n const entityName = standardEntityValueToNames.get(entityValue)\n return `&${entityName};`\n })\n } else {\n return str\n }\n}\n\n/**\n * Returns true if the two strings are equal, optionally ignoring case.\n *\n * @param a\n * @param b\n * @param ignoreCase\n */\nexport function eqStr(\n a: string | null,\n b: string | null,\n ignoreCase = false\n): boolean {\n if (a == null && b == null) return true\n if (a == null || b == null) return false\n if (a === b) return true\n if (ignoreCase)\n return a.length === b.length && a.toLowerCase() === b.toLowerCase()\n return false\n}\n\n/**\n * Given a single character string, returns the char code of the first character.\n *\n * @param str A single character string from which to get the first code point.\n */\nexport function char(str: string): number {\n return str.charCodeAt(0)\n}\n\n/**\n * Returns the substring of string after the last instance of searchString, excluding searchString.\n * If searchString is not found, the whole string will be returned.\n *\n * @param string\n * @param searchString\n * @param caseSensitive If true (default) the search will be case-sensitive.\n */\nexport function substringAfterLast(\n string: string,\n searchString: string,\n caseSensitive = true\n): string {\n const i = (caseSensitive ? string : string.toLowerCase()).lastIndexOf(\n caseSensitive ? searchString : searchString.toLowerCase()\n )\n if (i === -1) return string\n return string.substring(i + searchString.length)\n}\n\n/**\n * Returns the substring of string before the first occurrence of searchString, excluding\n * searchString.\n * If searchString is not found, the whole string will be returned.\n *\n * @param string\n * @param searchString\n * @param caseSensitive If true (default) the search will be case-sensitive.\n */\nexport function substringBefore(\n string: string,\n searchString: string,\n caseSensitive = true\n): string {\n const i = (caseSensitive ? string : string.toLowerCase()).indexOf(\n caseSensitive ? searchString : searchString.toLowerCase()\n )\n if (i === -1) return string\n return string.substring(0, i)\n}\n\n/**\n * Tokenizes a string into lowercase alphanumeric words.\n *\n * E.g. `'Amazon Music x86_64'` becomes `['amazon', 'music', 'x86', '64']`\n *\n * @param str\n */\nexport function tokenizeWords(str: string): string[] {\n const words: string[] = []\n const regex = /[a-z\\d]+/gi\n let match: RegExpMatchArray | null\n while ((match = regex.exec(str))) {\n words.push(match[0].toLowerCase())\n }\n return words\n}\n\nexport function toLowerCase<T extends string>(str: T): Lowercase<T> {\n return str.toLowerCase() as Lowercase<T>\n}\n\nexport function toUpperCase<T extends string>(str: T): Uppercase<T> {\n return str.toUpperCase() as Uppercase<T>\n}\n\n/**\n * If the given string is greater than a max length, truncate the string with an indicator.\n * Example:\n * truncate('a very long string', 10) // 'a very ...'\n *\n * @param str A nullable string.\n * @param maxLength\n * @param indicator The string to indicate there was truncation, default is an ellipses \u2026 (U+2026)\n * @return Returns the truncated string, or the nullish value if str is nullish.\n */\nexport function truncate<T extends Maybe<string>>(\n str: T,\n maxLength: number,\n indicator = '\u2026'\n): T | string {\n if (str == null) return str\n if (str.length > maxLength)\n return str.substring(0, maxLength - indicator.length) + indicator\n return str\n}\n\n/**\n * Converts a string to kebab-case.\n *\n * This function transforms camelCase, PascalCase, snake_case, and space-separated\n * strings into a normalized kebab-case format. It removes non-alphanumeric characters\n * (excluding hyphens), collapses multiple delimiters, and trims leading/trailing hyphens.\n *\n * @example\n * toKebabCase(\"HelloWorld\") // \"hello-world\"\n * toKebabCase(\"hello_world test\") // \"hello-world-test\"\n * toKebabCase(\"SomeText123\") // \"some-text123\"\n *\n * @param str - The input string to convert.\n * @returns The kebab-case version of the input.\n */\nexport function toKebabCase(str: string): string {\n return str\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .replace(/[\\s_]+/g, '-')\n .replace(/[^a-zA-Z0-9-]/g, '')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '')\n .toLowerCase()\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Returns the keys (both property names and symbols) of all own properties.\n * Unlike `Object.keys`, this will also return non-enumerable properties.\n * Does not return keys inherited from the object's prototype.\n *\n * Implementation details:\n * If Reflect is supported, Reflect.ownKeys will be used, wrapping in a Set, otherwise\n * Object.getOwnPropertyNames and Object.getOwnPropertySymbols will be used. This will typically\n * be equivalent. Proxies may alter the order of keys but platforms that do not support Reflect\n * will also typically not support Proxies.\n *\n * @see Reflect.ownKeys\n * @see Object.getOwnPropertyNames\n * @see Object.getOwnPropertySymbols\n * @param obj\n * @return Returns a `Set` of the own properties of the target object, including non-enumerable.\n * The ordering will be: positive numeric indexes in order, strings in insertion order,\n * symbols in insertion order.\n */\nexport function ownKeys<T>(obj: T): Set<keyof T> {\n if (!obj) return new Set()\n if (typeof Reflect !== 'undefined')\n return new Set(Reflect.ownKeys(obj) as (keyof T)[])\n const properties = new Set()\n Object.getOwnPropertyNames(obj).forEach((item) => properties.add(item))\n Object.getOwnPropertySymbols(obj).forEach((item) => properties.add(item))\n return properties as Set<keyof T>\n}\n\n/**\n * Returns the prototype chain of the given object.\n *\n * Example:\n * ```\n * class A {}\n * class B extends A {}\n * class C extends B {}\n * const c = new C()\n * getPrototypeChain(c) // [c, C.prototype, B.prototype, A.prototype, Object.prototype]\n * ```\n * @param obj\n */\nexport function getPrototypeChain(obj: any): any[] {\n const out = []\n let current = obj\n do {\n out.push(current)\n } while ((current = Object.getPrototypeOf(current)))\n return out\n}\n\n/**\n * Returns true if the given object represents a plain object and not a class instance.\n */\nexport function isPlainObject(value: any): boolean {\n if (!value || typeof value !== 'object' || Array.isArray(value))\n return false\n const proto = Object.getPrototypeOf(value)\n // if not the null prototype, not a plain object:\n return !proto || !Object.getPrototypeOf(proto)\n}\n\n/**\n * Gets the object's value for the given key if it exists, otherwise sets [key] to\n * `defaultValue`, returning the newly set value.\n *\n * @param object\n * @param key\n * @param defaultValue\n */\nexport function getOrSetProp<K extends keyof T, T extends object>(\n object: T,\n key: K,\n defaultValue: () => T[K]\n): T[K] {\n if (key in object) {\n return object[key]\n } else {\n const value = defaultValue()\n object[key] = value\n return value\n }\n}\n\n/**\n * Returns true if value is not null. Provides a type guard which can be used in filters.\n * Example:\n * [1, null, 2, 3, null, 4].filter(isNonNull) // type number[]\n * @param value\n */\nexport function isNonNull<T>(value: T): value is NonNullable<T> {\n return value != null\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { isPlainObject } from '../object/object'\nimport type { AnyRecord, Fun, IsAny } from '../type'\n\n/**\n * A representation of the conversion the toJson function will apply to make an input JSON compatible.\n */\nexport type Json<T = any> =\n IsAny<T> extends true\n ? // inputs of type `any` are allowed, use AnyRecord as the mapped type to pass JsonCompatible<T> validation.\n AnyRecord\n : unknown extends T\n ? never\n : T extends bigint | symbol | Fun\n ? string\n : T extends { toJSON(): infer R }\n ? R\n : T extends boolean | number | string | null | undefined\n ? T\n : T extends Set<infer U>\n ? Json<U>[]\n : T extends readonly any[]\n ? Json<T[number]>[]\n : {\n [P in keyof T]: Json<T[P]>\n }\n\n/**\n * Converts a dynamic value to a serializable value.\n * The value must be either an object with a toJSON function, a primitive, or a plain object\n * where all enumerable properties map to values supported by this function.\n * Properties not enumerable will be omitted, properties not serializable will be converted\n * to strings.\n * - bigint -> value.toString\n * - function -> [function <name>]\n * - symbol -> [symbol <name>]\n *\n * Error instances have a special case where non-serializable errors will still have their\n * name, message, and stack properties serialized.\n *\n * Note that this is not intended for use in serializing objects where all values are known;\n * it's intended to cover the case of reporting or logging an unknown object that may or may not\n * be serializable.\n *\n * @param value\n */\nexport function toJson<T>(value: T): Json<T> {\n return toJsonInternal(value, new Set())\n}\n\nfunction toJsonInternal(value: any, visited: Set<any>): any {\n switch (typeof value) {\n case 'object':\n return objectToJsonInternal(value, visited)\n case 'undefined':\n case 'boolean':\n case 'number':\n case 'string':\n return value\n case 'function':\n return `[function ${value.name}]`\n case 'symbol':\n return `[symbol ${value.toString().slice(7, -1)}]`\n case 'bigint':\n return value.toString()\n }\n}\n\nfunction objectToJsonInternal(value: any, visited: Set<any>): any {\n if (value == null) return value\n if (visited.has(value)) return `<circular reference: ${String(value)}>`\n visited.add(value)\n if ('toJSON' in value && typeof value.toJSON === 'function')\n return value.toJSON()\n if (value instanceof Set) {\n return Array.from(value).map((e) => toJsonInternal(e, visited))\n } else if (Array.isArray(value)) {\n return value.map((e) => toJsonInternal(e, visited))\n } else {\n if (isPlainObject(value)) {\n const o: Record<any, any> = {}\n for (const key in value) {\n o[key] = toJsonInternal(value[key], visited)\n }\n return o\n } else if (value instanceof Error) {\n // non-enumerable properties\n return {\n name: value.name,\n message: value.message,\n stack: value.stack,\n }\n } else {\n return value.toString()\n }\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ReportableError } from './ReportableError'\nimport { ErrorOrigin } from './ErrorOrigin'\nimport type { Json } from '../util/serialization/json'\n\n/**\n * An error indicating that input had an invalid shape.\n */\nexport class ValidationError extends ReportableError {\n get [Symbol.toStringTag](): string {\n return 'ValidationError'\n }\n\n /**\n * @param message The validation error message.\n * @param origin The error origin, typically API (default) or SERVICE_EXTERNAL\n * @param path The property path to the invalid field.\n */\n constructor(\n message: string,\n origin: string = ErrorOrigin.API,\n readonly path: readonly string[] = []\n ) {\n super(message, origin)\n Object.setPrototypeOf(this, ValidationError.prototype)\n }\n\n toJSON(): Json {\n return {\n ...super.toJSON(),\n origin: this.origin,\n path: this.path,\n }\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Clamps the given value between `min` and `max`.\n *\n * @param value\n * @param min The lower bounds.\n * @param max The upper bounds. If this value is less than min, this value will always be returned.\n */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max)\n}\n\n/**\n * Linearly interpolates between `from` and `to` given a percentage.\n *\n * @param from The alpha = 0.0 value\n * @param to The alpha = 1.0 value\n * @param alpha A percentage where 0 is `from`, and 1 is `to`. E.g. 0.5 would return halfway\n * between `from` and `to`.\n */\nexport function lerp(from: number, to: number, alpha: number): number {\n return from + (to - from) * alpha\n}\n\n/**\n * Floors a value to the nearest snap interval.\n *\n * Examples:\n *\n * ```\n * floorToNearest(3, 2) // 2\n * floorToNearest(16, 5) // 15\n * floorToNearest(16, 5, 2) // 17\n * ```\n *\n * @param value The value to floor with the given snap interval and offset.\n * @param snap The interval between output values. Should be a finite, non-zero number.\n * @param offset The offset of the interval. E.g. if snap is 10 and offset is 1, values will be\n * snapped to `-19, -9, 1, 11, 21, 31, 41, ...`\n */\nexport function floorToNearest(\n value: number,\n snap: number,\n offset = 0\n): number {\n return Math.floor((value - offset) / snap) * snap + offset\n}\n\n/**\n * Ceilings a value to the nearest snap interval.\n *\n * Examples:\n *\n * ```\n * ceilToNearest(3, 2) // 4\n * ceilToNearest(16, 5) // 20\n * ceilToNearest(10, 5) // 10\n * ceilToNearest(16, 5, 2) // 22\n * ```\n *\n * @param value The value to ceil with the given snap interval and offset.\n * @param snap The interval between output values. Should be a finite, non-zero number.\n * @param offset The offset of the interval. E.g. if snap is 10 and offset is 1, values will be\n * snapped to `-19, -9, 1, 11, 21, 31, 41, ...`\n */\nexport function ceilToNearest(value: number, snap: number, offset = 0): number {\n return Math.ceil((value - offset) / snap) * snap + offset\n}\n\n/**\n * Rounds a value to the nearest snap interval.\n *\n * Examples:\n *\n * ```\n * roundToNearest(3, 2) // 4\n * roundToNearest(16, 5) // 15\n * roundToNearest(18, 5) // 20\n * roundToNearest(16, 10, 2) // 22\n * ```\n *\n * @param value The value to round with the given snap interval and offset.\n * @param snap The interval between output values. Should be a finite, non-zero number.\n * @param offset The offset of the interval. E.g. if snap is 10 and offset is 1, values will be\n * snapped to `-19, -9, 1, 11, 21, 31, 41, ...`\n */\nexport function roundToNearest(\n value: number,\n snap: number,\n offset = 0\n): number {\n return Math.round((value - offset) / snap) * snap + offset\n}\n\n/**\n * Returns true if `x` is within `tolerance` of `y`.\n *\n * @param x\n * @param y\n * @param tolerance\n */\nexport function closeTo(\n x: number,\n y: number,\n tolerance: number = Number.EPSILON\n): boolean {\n return Math.abs(x - y) <= tolerance\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { clamp } from '../math/math'\n\nexport interface ParseError {\n /**\n * The full reason and location.\n */\n readonly message: string\n\n /**\n * The reason for the error.\n */\n readonly reason: string\n\n /**\n * A description of the location the error occurred.\n */\n readonly location: string\n}\n\nexport interface PrintStringPositionOptions {\n /**\n * The maximum number of character columns to output.\n * The number of columns shown will be the min of this value and the number of columns\n * at the index row.\n * The default is 60.\n */\n maxColumns?: number\n\n /**\n * The caret indicator.\n * The caret will be printed on a second row, directly underneath the column index\n * represents. This may more than one character, where the first character will align\n * with the index column.\n * The default value is '^'.\n */\n caret?: string\n\n /**\n * A number between 0 and 1 representing the percentage of trailing to leading characters.\n * 0 Indicates all trailing, 1 indicates all leading, and 0.5 indicates that the index\n * column is as close to the middle as possible.\n * The default value is 0.6.\n */\n split?: number\n}\n\n/**\n * Given a string and a position index, gets the row the index represents, displaying the\n * surrounding characters, with a second row showing a caret indicator pointing at the index.\n *\n * @param str\n * @param index The\n * @param options Display options\n */\nexport function printStringPosition(\n str: string,\n index: number,\n options?: PrintStringPositionOptions\n): string {\n const caret = options?.caret || '^'\n index = clamp(index, 0, str.length)\n const minIndex = str.lastIndexOf('\\n', index - 1) + 1\n let maxIndex = str.indexOf('\\n', index)\n if (maxIndex === -1) maxIndex = str.length\n const split = options?.split === undefined ? 0.6 : options.split\n const cols = (options?.maxColumns ?? 60) - caret.length\n let leadingChars = cols * split\n let trailingChars = cols * (1 - split)\n const maxLeadingChars = index - minIndex\n const maxTrailingChars = maxIndex - index\n if (leadingChars > maxLeadingChars) {\n trailingChars += leadingChars - maxLeadingChars\n leadingChars = maxLeadingChars\n if (trailingChars > maxTrailingChars) trailingChars = maxTrailingChars\n } else if (trailingChars > maxTrailingChars) {\n leadingChars += trailingChars - maxTrailingChars\n trailingChars = maxTrailingChars\n if (leadingChars > maxLeadingChars) leadingChars = maxLeadingChars\n }\n let out = str.substring(index - leadingChars, index + trailingChars) + '\\n'\n out += ' '.repeat(leadingChars) + caret\n return out\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { toJson } from './json'\nimport { truncate } from '../string/string'\n\n/**\n * Stringifies a value suitable for human-readable messages.\n *\n * The value is first run through {@link toJson} which makes it safe for serialization.\n * (Circular references will become strings, and toJSON serializers will be respected)\n * The safe json is then stringified, using a JSON.stringify replacer that preserves\n * representations for NaN, Infinity, undefined, and Symbol.\n *\n * @param value Any value.\n * @param maxLength If provided, will truncate the final string.\n * @param indicator The truncation indicator.\n */\nexport function stringifyForPrint(\n value: any,\n maxLength?: number,\n indicator = '\u2026'\n): string {\n // Preserve Symbol, function, and undefined, NaN, and +/- Infinity\n let str = JSON.stringify(\n toJson(value),\n (_, value) => {\n const type = typeof value\n if (['undefined'].includes(type)) {\n return `{{${String(value)}}}`\n }\n if (type === 'number') {\n if (Number.isNaN(value) || !Number.isFinite(value))\n return `{{${value.toString()}}}`\n }\n return value\n },\n ' '\n )\n // Replace templated\n\n str = str.replace(/(\"\\{\\{.*}}\")/g, (_, s) => {\n return s.substring(3, s.length - 3)\n })\n if (maxLength) str = truncate(str, maxLength, indicator)\n return str\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin } from '../../error/ErrorOrigin'\nimport { ReportableError } from '../../error/ReportableError'\nimport type { ParseError } from '../serialization/ParseError'\nimport { printStringPosition } from '../serialization/ParseError'\nimport { eqStr, isWhitespaceChar } from './string'\nimport type { Json } from '../serialization/json'\n\n/**\n * A cursor on a string that allows for fast, naive parsing.\n */\nexport class StringReader {\n /**\n * @param data The string to read.\n */\n constructor(public data: string) {}\n\n /**\n * The current cursor.\n * This should always be between the range 0 and `data.length`\n */\n position = 0\n\n /**\n * Returns true if the current {@link position} is less than the source data's length.\n */\n hasNext(): boolean {\n return this.position < this.data.length\n }\n\n /**\n * Returns the number of characters remaining to be read.\n */\n get remaining(): number {\n return this.data.length - this.position\n }\n\n /**\n * Returns the length of {@link data}.\n */\n get length(): number {\n return this.data.length\n }\n\n /**\n * Throws a {@link StringParseError} where the location uses {@link printStringPosition} to\n * show a friendly message indicating the current position.\n *\n * @param message\n * @param offset The offset to add to the current position.\n */\n err(message: string, offset = 0): never {\n throw new StringParseError(this.data, this.position + offset, message)\n }\n\n /**\n * Reads and returns the character code at the current position.\n * To read the next character without advancing the cursor, use {@link peek}\n *\n * Note:\n * This method has no bounds checking; if {@link position} is greater than or equal to\n * `str.length` then NaN will be returned and {@link position} will still be incremented.\n *\n * @see String.charCodeAt\n */\n next(): number {\n return this.data.charCodeAt(this.position++)\n }\n\n /**\n * Reads characters until the predicate returns false or the data length has been reached.\n *\n * @param predicate Given the char code at the cursor index, returns true if the character\n * should be included in the substring result.\n * @returns number The start position.\n */\n while(predicate: (charCode: number) => boolean): number {\n const start = this.position\n let i = start\n const n = this.data.length\n while (i < n && predicate(this.data.charCodeAt(i))) i++\n this.position = i\n return start\n }\n\n /**\n * Reads characters until the predicate returns true or the string length has been reached.\n *\n * @param predicate\n * @returns number Returns the start index.\n */\n until(predicate: (charCode: number) => boolean): number {\n return this.while((charCode) => !predicate(charCode))\n }\n\n /**\n * Reads characters until the given character has been found or the string length has been\n * reached.\n *\n * @param charCode\n * @return number Returns the start index.\n */\n untilChar(charCode: number): number {\n return this.until((cc) => cc === charCode)\n }\n\n /**\n * Reads characters until the given string has been found or the string length has been\n * reached.\n *\n * @param string The string to match\n * @return number Returns the start index.\n */\n untilString(string: string): number {\n const start = this.position\n const index = this.data.indexOf(string, this.position)\n this.position = index === -1 ? this.data.length : index\n return start\n }\n\n /**\n * The same as {@link while} except returns the read substring as a result.\n */\n substringWhile(predicate: (charCode: number) => boolean): string {\n return this.data.substring(this.while(predicate), this.position)\n }\n\n /**\n * The same as {@link until} except returns the read substring as a result.\n */\n substringUntil(predicate: (charCode: number) => boolean): string {\n return this.substringWhile((charCode) => !predicate(charCode))\n }\n\n /**\n * The same as {@link untilChar} except returns the read substring as a result.\n */\n substringUntilChar(charCode: number): string {\n return this.substringWhile((iCharCode) => charCode !== iCharCode)\n }\n\n /**\n * Reads the substring from the current index with the given length.\n *\n * @param length\n */\n substr(length: number): string {\n const sub = this.data.substring(this.position, this.position + length)\n this.position += sub.length\n return sub\n }\n\n /**\n * Reads the expected string from the current position.\n * If the read string doesn't match the given string, a {@link StringParseError} is thrown.\n *\n * @param str The string required to match at the current position.\n * @param ignoreCase If true, the comparison will be case-insensitive.\n */\n read(str: string, ignoreCase = false): string {\n const actual = this.substr(str.length)\n if (!eqStr(actual, str, ignoreCase))\n this.err(`Expected '${str}', actual: '${actual}'`)\n return actual\n }\n\n /**\n * Reads the expected char code from the current position.\n * If the read character doesn't match the given character, a {@link StringParseError} is\n * thrown.\n *\n * @param charCode The character code required to match at the current position.\n */\n readChar(charCode: number): number {\n const actual = this.next()\n if (actual !== charCode)\n this.err(\n `Expected '${String.fromCharCode(charCode)}', ` +\n `actual: '${String.fromCharCode(actual)}'`\n )\n return actual\n }\n\n /**\n * Returns the character at the current position without advancing the cursor.\n *\n * Note:\n * This method has no bounds checking; if {@link position} is greater than or equal to\n * `str.length` then `NaN` will be returned.\n *\n * @see String.charCodeAt\n */\n get peek(): number {\n return this.data.charCodeAt(this.position)\n }\n\n /**\n * Reads through all whitespace characters, returning the starting index.\n */\n white(): number {\n return this.while(isWhitespaceChar)\n }\n\n /**\n * If {@link peek} equals the given character code, returns true and advances the index by\n * one.\n *\n * @param charCode\n */\n charIf(charCode: number): boolean {\n if (this.peek === charCode) {\n this.next()\n return true\n } else {\n return false\n }\n }\n\n /**\n * If the given string matches the substring at the current position, returns true and advances\n * the index by the string's length.\n */\n stringIf(string: string, ignoreCase = false): boolean {\n if (this.remaining < string.length) return false\n const substr = this.data.substring(\n this.position,\n this.position + string.length\n )\n const match = eqStr(substr, string, ignoreCase)\n if (match) this.position += string.length\n return match\n }\n}\n\nconst locale = {\n messageSeparator: ', at: \\n',\n} as const\n\nexport class StringParseError extends ReportableError implements ParseError {\n get [Symbol.toStringTag](): string {\n return 'StringParseError'\n }\n\n readonly location: string\n\n constructor(\n str: string,\n readonly position: number,\n readonly reason: string\n ) {\n const location = printStringPosition(str, position)\n super(\n `${reason}${locale.messageSeparator}${location}`,\n ErrorOrigin.PARSING\n )\n this.location = location\n Object.setPrototypeOf(this, StringParseError.prototype)\n }\n\n toJSON(): Json {\n return {\n ...super.toJSON(),\n position: this.position,\n location: this.location,\n reason: this.reason,\n }\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { StringReader } from '@amazon/vinyl-util'\nimport { char } from '@amazon/vinyl-util'\n\nconst EQUALS = char('=')\nconst COMMA = char(',')\nconst QUOTE = char('\"')\n\n/**\n * Parses an HLS attribute list (e.g. `KEY=VALUE,KEY=\"quoted,value\"`) using\n * StringReader cursor-based parsing. Handles quoted values with embedded commas.\n */\nexport function parseAttributes(reader: StringReader): Record<string, string> {\n const attrs: Record<string, string> = {}\n\n while (\n reader.hasNext() &&\n reader.peek !== char('\\n') &&\n reader.peek !== char('\\r')\n ) {\n const key = reader.substringUntilChar(EQUALS)\n if (!key || !reader.hasNext()) break\n reader.next() // skip '='\n\n let value: string\n if (reader.peek === QUOTE) {\n reader.next() // skip opening quote\n value = reader.substringUntilChar(QUOTE)\n if (reader.hasNext()) reader.next() // skip closing quote\n } else {\n value = reader.substringUntil(\n (cc) => cc === COMMA || cc === char('\\n') || cc === char('\\r')\n )\n }\n\n attrs[key] = value\n\n if (reader.hasNext() && reader.peek === COMMA) {\n reader.next() // skip ','\n }\n }\n\n return attrs\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { type Invariant, ValidationError } from '@amazon/vinyl-util'\nimport { stringifyForPrint, substitute } from '@amazon/vinyl-util'\nimport type { JsonSchema } from './JsonSchema'\n\n/**\n * Represents a validation failure.\n */\nexport interface ValidationErrorMessage {\n readonly message: string\n readonly path: readonly string[]\n}\n\nexport interface ValidationOptions {\n /**\n * If true, collect all validation errors.\n * Default: false\n */\n readonly all?: boolean\n}\n\n/**\n * A Validator can assert that an input matches this validator's schema.\n */\nexport interface Validator<Output extends Input, in Input = unknown> {\n /**\n * Enforces T is in an invariant position.\n * This prevents a validator with more strict rules is assigned to a less strict type, which\n * can cause unexpected validation errors.\n */\n __type?: Invariant<Output>\n\n /**\n * A short description of the validator.\n */\n readonly description: string\n\n /**\n * The JSON Schema fragment this validator contributes, if any.\n *\n * Fragments compose the same way the {@link description} does: chaining validators with `and`\n * merges their fragments, and `or` unions them into an `anyOf`. Serialize a full schema with\n * {@link toJsonSchema}. A validator with no meaningful shape (for example a bare type check)\n * may omit this.\n */\n readonly jsonSchema?: JsonSchema | undefined\n\n /**\n * Returns true if the input is valid according to this validator.\n *\n * @param input\n */\n readonly isValid: (input: Input) => input is Output\n\n /**\n * Validates the provided input, returning a list of error messages, or an empty array if the\n * input passes this validator.\n *\n * @param input The input to validate.\n * @param options Validation options.\n * @param path The current field path to this validator.\n * @return Returns an array of validation failures. If `options.all` is not true, only the\n * first error will be returned.\n */\n readonly validate: (\n input: Input,\n options?: ValidationOptions,\n path?: readonly string[]\n ) => readonly ValidationErrorMessage[]\n\n /**\n * Validates the given input, asserting that the input is type `T`.\n * If the input is not valid, a {@link ValidationError} will be thrown.\n *\n * @param input The input to validate.\n * @param origin The error origin. `ErrorOrigin.API` by default.\n * @param path The current field path to this validator.\n * @return Returns the input, cast as the validated type T\n */\n readonly assert: (\n input: Input,\n origin?: string,\n path?: readonly string[]\n ) => asserts input is Output\n}\n\n/**\n * @private\n */\nconst validatorLocale = {\n /**\n * The expectation template string with the following replacement tokens:\n *\n * `{expected}` - The expected description.\n * `{actual}` - The actual value.\n * `{path}` - The path, dot separated.\n */\n template: 'Expected: {expected}, but was: {actual}. At: {path}',\n}\n\n/**\n * Creates a message string for a ValidationErrorMessage based on the input and its expectation.\n *\n * @param expectationMessage\n * @param input\n * @param path\n * @param inputStringify\n */\nexport function createValidationExpectationMessage<Input>(\n expectationMessage: string,\n input: Input,\n path: readonly string[],\n inputStringify: (input: Input) => string = (input) =>\n stringifyForPrint(input, 500)\n): string {\n return substitute(validatorLocale.template, {\n expected: expectationMessage,\n actual: inputStringify(input),\n path: path.join('.'),\n })\n}\n\n/**\n * Creates a new basic validator.\n *\n * For a deep validator which has sub-fields, use {@link createDeepValidator}.\n *\n * @param expectationMessage The message to use to describe what is expected. This will be used in\n * the error message template.\n * @param isValid Returns true if the given input is valid.\n * @param inputStringify Stringifies the input for use as the actual `{actual}` token in the validation\n * expectation template. Default is `stringifyForPrint` with a 500 character max length.\n * @param jsonSchema The JSON Schema fragment this validator contributes, if any.\n */\nexport function createValidator<Output extends Input, Input = unknown>(\n expectationMessage: string,\n isValid: (input: Input) => boolean,\n inputStringify: (input: Input) => string = (input) =>\n stringifyForPrint(input, 500),\n jsonSchema?: JsonSchema\n): Validator<Output, Input> {\n return {\n description: expectationMessage,\n jsonSchema,\n\n isValid(input: Input): input is Output {\n return isValid(input)\n },\n\n validate(\n input: Input,\n _?: ValidationOptions,\n path: readonly string[] = []\n ): readonly ValidationErrorMessage[] {\n if (!isValid(input)) {\n return [\n {\n message: createValidationExpectationMessage(\n expectationMessage,\n input,\n path,\n inputStringify\n ),\n path,\n },\n ]\n }\n return []\n },\n\n assert: (\n input: Input,\n origin?: string,\n path: readonly string[] = []\n ): asserts input is Output => {\n if (!isValid(input)) {\n throw new ValidationError(\n createValidationExpectationMessage(\n expectationMessage,\n input,\n path,\n inputStringify\n ),\n origin,\n path\n )\n }\n },\n }\n}\n\n/**\n * Creates a new deep validator.\n *\n * For a shallow validator which validates one value, use {@link createValidator}.\n *\n * @param description Describes the validator.\n * @param validate Returns an array of validation failures.\n * @param jsonSchema The JSON Schema fragment this validator contributes, if any.\n */\nexport function createDeepValidator<Output extends Input, Input = unknown>(\n description: string,\n validate: (\n input: Input,\n options: ValidationOptions,\n path: readonly string[]\n ) => readonly ValidationErrorMessage[],\n jsonSchema?: JsonSchema\n): Validator<Output, Input> {\n return {\n description,\n jsonSchema,\n\n isValid(input: Input): input is Output {\n return validate(input, { all: false }, []).length === 0\n },\n\n validate(\n input: Input,\n options?: ValidationOptions,\n path: readonly string[] = []\n ): readonly ValidationErrorMessage[] {\n return validate(input, options ?? { all: false }, path)\n },\n\n assert: (\n input: Input,\n origin?: string,\n path: readonly string[] = []\n ): asserts input is Output => {\n const errors = validate(input, { all: false }, path)\n if (errors.length) {\n const error = errors[0]\n throw new ValidationError(error.message, origin, error.path)\n }\n },\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ownKeys } from '@amazon/vinyl-util'\nimport type { Validator } from './Validator'\n\n/**\n * The `type` keyword value of a JSON Schema node.\n */\nexport type JsonSchemaType =\n | 'string'\n | 'number'\n | 'integer'\n | 'boolean'\n | 'object'\n | 'array'\n | 'null'\n\n/**\n * A JSON Schema definition (a draft-07 compatible subset) describing the shape a value must take.\n *\n * This is the serializable representation produced by {@link toJsonSchema}, suitable for handing to\n * an LLM as the shape it must produce. It intentionally mirrors zod-to-json-schema output for the\n * node types this library supports.\n */\nexport interface JsonSchema {\n readonly type?: JsonSchemaType | readonly JsonSchemaType[]\n\n /**\n * A human-readable description, attached to a schema node via its `describe` method.\n */\n readonly description?: string\n\n // Object\n readonly properties?: Readonly<Record<string, JsonSchema>>\n readonly required?: readonly string[]\n readonly additionalProperties?: boolean | JsonSchema\n\n // Array\n readonly items?: JsonSchema | readonly JsonSchema[]\n readonly additionalItems?: boolean\n readonly minItems?: number\n readonly maxItems?: number\n readonly uniqueItems?: boolean\n\n // String\n readonly minLength?: number\n readonly maxLength?: number\n readonly pattern?: string\n\n // Number\n readonly minimum?: number\n readonly maximum?: number\n readonly exclusiveMinimum?: number\n readonly exclusiveMaximum?: number\n\n // Enumeration\n readonly enum?: readonly unknown[]\n\n // Composition\n readonly anyOf?: readonly JsonSchema[]\n}\n\n/**\n * A source that can produce its own JSON Schema definition. Schema nodes implement this so that\n * per-node metadata (such as a `describe` description) is honored during serialization.\n */\nexport interface JsonSchemaProvider {\n toJsonSchema(): JsonSchema\n}\n\ntype MutableJsonSchema = {\n -readonly [K in keyof JsonSchema]: JsonSchema[K]\n}\n\n/**\n * Merges JSON Schema fragments into a single definition, later fragments taking precedence.\n *\n * This mirrors an intersection (`and`) of constraints: `properties` are combined and `required`\n * keys are unioned, while all other keywords are overridden by the last fragment that defines them.\n *\n * @param fragments The fragments to merge. `undefined` fragments are ignored.\n */\nexport function mergeJsonSchema(\n ...fragments: readonly (JsonSchema | undefined)[]\n): JsonSchema {\n const merged: MutableJsonSchema = {}\n for (const fragment of fragments) {\n if (fragment == null) continue\n for (const key of ownKeys(fragment)) {\n if (fragment[key] === undefined) continue\n if (key === 'properties') {\n merged.properties = {\n ...merged.properties,\n ...fragment.properties,\n }\n } else if (key === 'required') {\n merged.required = [\n ...new Set([\n ...(merged.required ?? []),\n ...(fragment.required as readonly string[]),\n ]),\n ]\n } else {\n // A homogeneous copy of one key; the key/value are drawn from the same fragment.\n merged[key] = fragment[key] as never\n }\n }\n }\n return merged\n}\n\n/**\n * Serializes a validator to a JSON Schema definition.\n *\n * Schema nodes ({@link JsonSchemaProvider}s) serialize themselves so that per-node metadata is\n * honored; other validators contribute their attached JSON Schema fragment, defaulting to the empty\n * schema (which matches any value) when none is attached.\n *\n * @param source The validator or schema node to serialize.\n */\nexport function toJsonSchema(source: Validator<any, any>): JsonSchema {\n const provider = source as Partial<JsonSchemaProvider>\n if (typeof provider.toJsonSchema === 'function') {\n return provider.toJsonSchema()\n }\n return { ...source.jsonSchema }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { substitute } from '@amazon/vinyl-util'\nimport type { Validator } from './Validator'\nimport { createDeepValidator } from './Validator'\nimport { mergeJsonSchema } from './JsonSchema'\n\n/*\n * @brief\n * andValidators will intersect an arbitrary number of validators.\n *\n * While in most cases validating that an input passes two validators, the asserted output is the\n * intersection of those two validator outputs, this is not always the case.\n * For example, take two validators with outputs `A[]` and `B[]`, their combined validated output\n * type would be `(A & B)[]`, not `A[] & B[]`. Use casting when necessary.\n *\n * Also note that there is no contravariance safety with the chained validator inputs. That is,\n * there's no compile-time checking that validatorB accepts an input that is the super of\n * validatorA's output.\n */\n\n/**\n * @private\n */\nconst locale = {\n /**\n * {value} The child validators' descriptions, joined with `separator`.\n *\n * groupings of and validators is unimportant,\n * and(and(a, b), c) is the same as and(a, and(b, c)), so `a & b & c` is an accurate\n * representation for either.\n */\n template: '{value}',\n\n /**\n * The separator with which to join child validator descriptions.\n */\n separator: ' & ',\n} as const\n\n/**\n * Validates that all the given validators pass.\n */\nexport function andValidators<A extends Input, B, Input>(\n validatorA: Validator<A, Input>,\n validatorB: Validator<B, any>\n): Validator<A & B, Input>\n\n/**\n * Validates that all the given validators pass.\n */\nexport function andValidators<A extends Input, B, C, Input>(\n validatorA: Validator<A, Input>,\n validatorB: Validator<B, any>,\n validatorC: Validator<C, any>\n): Validator<A & B & C, Input>\n\n/**\n * Validates that all the given validators pass.\n */\nexport function andValidators<A extends Input, B, C, D, Input>(\n validatorA: Validator<A, Input>,\n validatorB: Validator<B, any>,\n validatorC: Validator<C, any>,\n validatorD: Validator<D, any>\n): Validator<A & B & C & D, any>\n\n/**\n * Validates that all the given validators pass.\n */\nexport function andValidators<A extends Input, B, C, D, E, Input>(\n validatorA: Validator<A, Input>,\n validatorB: Validator<B, any>,\n validatorC: Validator<C, any>,\n validatorD: Validator<D, any>,\n validatorE: Validator<E, any>\n): Validator<A & B & C & D & E, any>\n\nexport function andValidators(\n ...validators: Validator<any, any>[]\n): Validator<any, any>\n\nexport function andValidators(\n ...validators: Validator<any, any>[]\n): Validator<any, any> {\n return createDeepValidator(\n substitute(locale.template, {\n value: validators.map((v) => v.description).join(locale.separator),\n }),\n (input, options, path) => {\n for (const validator of validators) {\n const errors = validator.validate(input, options, path)\n if (errors.length) return errors\n }\n return []\n },\n mergeJsonSchema(...validators.map((v) => v.jsonSchema))\n )\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { substitute } from '@amazon/vinyl-util'\nimport type { ValidationErrorMessage, Validator } from './Validator'\nimport {\n createDeepValidator,\n createValidationExpectationMessage,\n} from './Validator'\nimport type { JsonSchema } from './JsonSchema'\n\n/*\n * @brief\n * orValidators will union an arbitrary number of validators.\n * input type is always type any; it's not strictly necessary for all validators to accept the same\n * input type. For example, if validatorA asserts that a value is not null, validatorB can safely\n * assume its input is not null.\n * output type will be the union of the validator outputs up to 5 validators, 6 or more will be\n * type any.\n */\n\n/**\n * @private\n */\nconst locale = {\n /**\n * {value} - The child validators' descriptions, joined with `separator`.\n */\n template: '({value})',\n\n /**\n * The separator with which to join child validator descriptions.\n */\n separator: ' | ',\n} as const\n\n/**\n * Composes the child validators' JSON Schema fragments into a union.\n *\n * Branches with no fragment are skipped: JSON Schema has no representation for `undefined`, and a\n * value's optionality is instead conveyed by an object's `required` list. A single remaining branch\n * collapses to that branch rather than a redundant `anyOf`.\n */\nfunction unionJsonSchema(\n validators: readonly Validator<any, any>[]\n): JsonSchema | undefined {\n const branches = validators\n .map((v) => v.jsonSchema)\n .filter((fragment): fragment is JsonSchema => fragment != null)\n if (branches.length === 0) return undefined\n if (branches.length === 1) return branches[0]\n return { anyOf: branches }\n}\n\n/**\n * Validates that one of the given validators pass.\n */\nexport function orValidators<A, B>(\n validatorA: Validator<A, any>,\n validatorB: Validator<B, any>\n): Validator<A | B, any>\n\n/**\n * Validates that one of the given validators pass.\n */\nexport function orValidators<A, B, C>(\n validatorA: Validator<A, any>,\n validatorB: Validator<B, any>,\n validatorC: Validator<C, any>\n): Validator<A | B | C, any>\n\n/**\n * Validates that one of the given validators pass.\n */\nexport function orValidators<A, B, C, D>(\n validatorA: Validator<A, any>,\n validatorB: Validator<B, any>,\n validatorC: Validator<C, any>,\n validatorD: Validator<D, any>\n): Validator<A | B | C | D, any>\n\n/**\n * Validates that one of the given validators pass.\n */\nexport function orValidators<A, B, C, D, E>(\n validatorA: Validator<A, any>,\n validatorB: Validator<B, any>,\n validatorC: Validator<C, any>,\n validatorD: Validator<D, any>,\n validatorE: Validator<E, any>\n): Validator<A | B | C | D | E, any>\n\nexport function orValidators(\n ...validators: Validator<any, any>[]\n): Validator<any, any>\n\n/**\n * Validates that one of the given validators pass.\n *\n * If all validators fail, the validator that produced an error at the deepest path will have its\n * error message bubbled. If all validators failed at the current depth, a concatenation of\n * validator descriptions will be used.\n *\n * For example:\n * `orValidators(number(), string()).validate(false)` will produce the message:\n * 'Expected (number | string), but was false, At: '\n *\n * And:\n * `orValidators(number(), object({ childProp: number() })).validate({ childProp: 'not-a-number' })`\n * will produce:\n * 'Expected number, but was \"not-a-number\", At: childProp'\n *\n * @param validators The validators to test.\n */\nexport function orValidators(\n ...validators: Validator<any, any>[]\n): Validator<any, any> {\n const description = substitute(locale.template, {\n value: validators.map((v) => v.description).join(locale.separator),\n })\n\n return createDeepValidator(\n description,\n (input, options, path) => {\n let longestErrors: readonly ValidationErrorMessage[] = []\n let longestPath = 0\n for (const validator of validators) {\n const errors = validator.validate(input, options, path)\n if (!errors.length) return errors\n // Take the deepest error to bubble.\n const pathLength = errors.reduce(\n (max, m) => Math.max(m.path.length, max),\n 0\n )\n if (pathLength >= longestPath) {\n longestErrors = errors\n longestPath = pathLength\n }\n }\n return longestPath > path.length\n ? longestErrors\n : [\n {\n message: createValidationExpectationMessage(\n description,\n input,\n path\n ),\n path,\n },\n ]\n },\n unionJsonSchema(validators)\n )\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IllegalArgumentError, invariant, type Maybe } from '@amazon/vinyl-util'\nimport { andValidators } from './andValidators'\nimport type {\n ValidationErrorMessage,\n ValidationOptions,\n Validator,\n} from './Validator'\nimport type {\n PropertyValidator,\n PropertyValidatorOptions,\n PropertyValidatorWithOptions,\n} from './PropertyValidator'\nimport type { JsonSchema, JsonSchemaProvider } from './JsonSchema'\nimport { mergeJsonSchema } from './JsonSchema'\n\nconst requiredValidationOptions = {\n optional: false,\n} as const satisfies PropertyValidatorOptions\n\n/**\n * A base class for validation state.\n * Provides methods for chaining.\n *\n * Subclasses should not override constructors.\n */\nexport abstract class SchemaBase<T>\n implements\n PropertyValidator<T, { readonly optional: false }>,\n JsonSchemaProvider\n{\n __type = invariant<T>()\n\n private readonly validator: Validator<T>\n private _options = requiredValidationOptions\n private _jsonSchemaDescription?: string\n\n get options() {\n return this._options\n }\n\n /**\n * Constructs the first link in a schema chain.\n *\n * @param currentValidator\n */\n constructor(currentValidator: Validator<any, any>)\n\n /**\n * Constructs linking to the given previous schema.\n *\n * @param currentValidator\n * @param previousSchema\n * @param operation\n */\n constructor(\n currentValidator: Validator<any, any>,\n previousSchema: SchemaBase<any>,\n operation: (\n validatorA: Validator<any>,\n validatorB: Validator<any, any>\n ) => Validator<T>\n )\n\n constructor(\n private readonly currentValidator: Validator<any, any>,\n private readonly previousSchema?: Maybe<SchemaBase<any>>,\n private readonly operation?: Maybe<\n (\n validatorA: Validator<any>,\n validatorB: Validator<any, any>\n ) => Validator<T>\n >\n ) {\n this.validator =\n operation == null\n ? currentValidator\n : operation(previousSchema!, currentValidator)\n }\n\n get description(): string {\n return this.validator.description\n }\n\n /**\n * The composed JSON Schema fragment for this schema, including any {@link describe} description.\n * Composes through chaining the same way {@link description} does; serialize a complete\n * definition with {@link toJsonSchema}.\n */\n get jsonSchema(): JsonSchema | undefined {\n const base = this.validator.jsonSchema\n if (this._jsonSchemaDescription == null) return base\n return mergeJsonSchema(base, {\n description: this._jsonSchemaDescription,\n })\n }\n\n /**\n * Attaches a human-readable description to this schema, akin to zod's `describe`.\n * The description is metadata only; it does not affect validation, and surfaces in the output\n * of {@link toJsonSchema}.\n *\n * @param description The description to attach.\n * @return A clone of this schema carrying the description.\n */\n describe(description: string): this {\n const cloned = this.clone()\n cloned._jsonSchemaDescription = description\n return cloned\n }\n\n /**\n * Serializes this schema to a JSON Schema definition, suitable for describing the shape to an\n * LLM or other consumer. Works similarly to zod-to-json-schema.\n */\n toJsonSchema(): JsonSchema {\n return this.jsonSchema ?? {}\n }\n\n readonly assert: (\n input: unknown,\n origin?: string,\n path?: readonly string[]\n ) => asserts input is T = (input, origin?, path?): asserts input is T => {\n this.validator.assert(input, origin, path)\n }\n\n readonly isValid: (input: unknown) => input is T = (\n input: unknown\n ): input is T => this.validator.isValid(input)\n\n readonly validate = (\n input: unknown,\n options?: ValidationOptions,\n path?: readonly string[]\n ): readonly ValidationErrorMessage[] =>\n this.validator.validate(input, options, path)\n\n /**\n * Clones this schema, transforming all validators with the given mutator.\n *\n * @param transform A transformer which takes an existing validator in the chain and returns\n * a new one. Validators should be considered to be immutable; transform should not change the\n * input but instead return a new validator.\n */\n protected clone(\n transform: (validator: Validator<any>) => Validator<any> = (v) => v\n ): any {\n const cloned = this.operation\n ? this.self(\n transform(this.currentValidator),\n this.previousSchema!.clone(transform),\n this.operation\n )\n : this.self(transform(this.currentValidator))\n cloned._options = this._options\n cloned._jsonSchemaDescription = this._jsonSchemaDescription\n return cloned\n }\n\n protected self(current: Validator<any, any>): any\n\n protected self(\n currentValidator: Validator<any, any>,\n previousSchema: SchemaBase<any> | undefined,\n operation:\n | ((\n validatorA: Validator<any>,\n validatorB: Validator<any, any>\n ) => Validator<T>)\n | undefined\n ): any\n\n protected self(\n current: Validator<any, any>,\n previous?: SchemaBase<any>,\n operation?: (\n validatorA: Validator<any>,\n validatorB: Validator<any, any>\n ) => Validator<T> | undefined\n ): any {\n if (this.constructor.length > 3) {\n throw new IllegalArgumentError(\n 'constructor should have at most three required arguments'\n )\n }\n return new (this.constructor as any)(current, previous, operation)\n }\n\n /**\n * Constructs a new schema with a validator chaining the current validator with the\n * provided next in an AND operation.\n *\n * @param nextValidator The validator to run after the current.\n * @return Returns a new Schema instance the same class with a new validator chaining the\n * current validator with the given next in an AND operation.\n */\n protected chain(nextValidator: Validator<any, any>): any {\n return this.self(nextValidator, this, andValidators)\n }\n\n optional(): PropertyValidatorWithOptions<\n this,\n T,\n { readonly optional: true }\n > {\n const cloned = this.clone()\n cloned._options = {\n ...cloned.options,\n optional: true,\n }\n return cloned\n }\n\n required(): PropertyValidatorWithOptions<\n this,\n T,\n { readonly optional: false }\n > {\n const cloned = this.clone()\n cloned._options = {\n ...cloned.options,\n optional: false,\n }\n return cloned\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { andValidators } from './andValidators'\nimport { orValidators } from './orValidators'\nimport { SchemaBase } from './SchemaBase'\nimport type { Validator } from './Validator'\nimport { createValidator } from './Validator'\n\nconst locale = {\n null: 'null',\n nullish: 'nullish',\n undefined: 'undefined',\n} as const\n\nexport const valueValidators = {\n any(): Validator<any> {\n // no need for localization, validator cannot fail.\n return createValidator('', () => true)\n },\n\n /**\n * Creates a validator that asserts that the input is nullish.\n * JSON Schema has no representation for `undefined`, so only `null` is expressed.\n */\n nullish(): Validator<null | undefined> {\n return createValidator(\n locale.nullish,\n (input) => input == null,\n undefined,\n {\n type: 'null',\n }\n )\n },\n\n /**\n * Creates a validator that asserts that the input is strictly null.\n */\n null(): Validator<null> {\n return createValidator(\n locale.null,\n (input) => input === null,\n undefined,\n {\n type: 'null',\n }\n )\n },\n\n /**\n * Creates a validator that asserts that the input is strictly undefined.\n */\n undefined(): Validator<undefined> {\n return createValidator(locale.undefined, (input) => input === undefined)\n },\n} as const\n\nexport class ValueSchema<T> extends SchemaBase<T> {\n /**\n * Prepends this validator allowing for null or undefined.\n */\n maybe(): ValueSchema<T | undefined | null> {\n return this.or(valueValidators.nullish())\n }\n\n /**\n * Prepends this validator allowing for null.\n */\n orNull(): ValueSchema<T | null> {\n return this.or(valueValidators.null())\n }\n\n /**\n * Prepends this validator allowing for undefined.\n */\n orUndefined(): ValueSchema<T | undefined> {\n return this.or(valueValidators.undefined())\n }\n\n /**\n * Returns a validator that asserts if this validator and the next passes.\n *\n * @see andValidators\n *\n * @param nextValidator The validator to run after the current.\n * @return Returns a new ValueSchema intersecting this validator and the next.\n */\n and<U>(nextValidator: Validator<U>): ValueSchema<T & U> {\n return new ValueSchema(nextValidator, this, andValidators)\n }\n\n /**\n * Returns a validator that asserts if this validator or the next passes.\n *\n * Implementation note:\n * subclasses should not change the schema instance returned unless all chainable validators\n * accept input type 'unknown'.\n *\n * @param nextValidator The validator to run after the current.\n * @return Returns a new ValueSchema providing the union of this validator and the next.\n */\n or<U>(nextValidator: Validator<U, any>): ValueSchema<T | U> {\n return new ValueSchema(nextValidator, this, orValidators)\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n type AnyRecord,\n type Fun,\n type Primitive,\n type ReadonlyRecord,\n stringifyForPrint,\n substitute,\n} from '@amazon/vinyl-util'\nimport { ArraySchema } from './ArraySchema'\nimport { FunctionSchema } from './FunctionSchema'\nimport { SetSchema } from './SetSchema'\nimport { ValueSchema, valueValidators } from './ValueSchema'\nimport { NumberSchema } from './NumberSchema'\nimport { type ExtendedPropertyValidators, ObjectSchema } from './ObjectSchema'\nimport { RecordSchema } from './RecordSchema'\nimport { StringSchema } from './StringSchema'\nimport { typeOfValidators } from './typeOfValidators'\nimport type { Validator } from './Validator'\nimport { createValidator } from './Validator'\n\n/**\n * @private\n */\nconst locale = {\n isOneOf: 'one of: {value}',\n instanceOf: 'instance of {value}',\n oneOfSeparator: ' | ',\n} as const\n\n/**\n * Creates a no-op validator. The value can be any type.\n */\nexport function any(): ValueSchema<any> {\n return new ValueSchema(valueValidators.any())\n}\n\n/**\n * Creates a validator that asserts that the input is an array.\n */\nexport function array(): ArraySchema<unknown[]>\n\n/**\n * Creates a validator that asserts that the input is an array and every element passes the\n * given validator.\n *\n * @param elementValidator\n */\nexport function array<U>(elementValidator: Validator<U>): ArraySchema<U[]>\n\nexport function array(\n elementValidator?: Validator<any>\n): ArraySchema<unknown[]> {\n if (!elementValidator) return ArraySchema.base\n else return ArraySchema.base.withElements(elementValidator)\n}\n\n/**\n * Creates a validator that asserts that the input is a boolean.\n */\nexport function boolean(): ValueSchema<boolean> {\n return new ValueSchema(typeOfValidators.boolean)\n}\n\n/**\n * Creates a validator that asserts that the input is a function.\n */\nexport function func(): FunctionSchema<Fun> {\n return FunctionSchema.base\n}\n\n/**\n * Validates that the input is an instanceof the given prototype.\n * @param clazz\n */\nexport function instanceOf<const T>(\n clazz: new (...args: any[]) => T\n): ValueSchema<T> {\n return new ValueSchema(\n createValidator(\n substitute(locale.instanceOf, { value: clazz.name }),\n (input) => input instanceof clazz\n )\n )\n}\n\n/**\n * Creates a validator that asserts that the input is nullish or one of the given possible values.\n *\n * @param possibleValues\n */\nexport function isOneOf<const U extends readonly Primitive[]>(\n ...possibleValues: U\n): ValueSchema<U[number]> {\n return new ValueSchema(\n createValidator(\n substitute(locale.isOneOf, {\n value: possibleValues.join(locale.oneOfSeparator),\n }),\n (input) => possibleValues.includes(input as U[number]),\n undefined,\n { enum: [...possibleValues] }\n )\n )\n}\n\n/**\n * Creates a validator that asserts that the input is one of the values of the given enum.\n *\n * @param enumObject The enum to validate against.\n */\nexport function enumOf<const T extends Record<string, Primitive>>(\n enumObject: T\n): ValueSchema<T[keyof T]> {\n return isOneOf(...Object.values(enumObject)) as unknown as ValueSchema<\n T[keyof T]\n >\n}\n\n/**\n * Creates a validator that asserts that the input is null.\n */\nexport function exactlyNull(): Validator<null> {\n return valueValidators.null()\n}\n\n/**\n * Creates a validator that asserts that the input is nullish.\n */\nexport function nullish(): Validator<null | undefined> {\n return valueValidators.nullish()\n}\n\n/**\n * Creates a validator that asserts that the input is a number.\n */\nexport function number(): NumberSchema {\n return NumberSchema.base\n}\n\n/**\n * Creates a validator that validates the input has properties that pass their respective\n * validators.\n */\nexport function object<const U extends object>(\n propertyValidators: NoInfer<ExtendedPropertyValidators<AnyRecord, U>>\n): ObjectSchema<U> {\n return ObjectSchema.base.extend<U>(propertyValidators)\n}\n\n/**\n * Returns a validator that asserts that the object's own enumerable properties has keys and\n * values that match their respective validators.\n *\n * Prototype members are not included.\n * Numeric keys are validated as strings. For example the object `{ [0]: 1 }` will be passed\n * to the key validator as '0'.\n *\n * To assume string keys, use {@link recordValues}\n *\n * @param keyValidator Validates each key.\n * @param valueValidator Validates each value.\n */\nexport function record<const K extends string | symbol, const V>(\n keyValidator: Validator<K>,\n valueValidator: Validator<V>\n): RecordSchema<ReadonlyRecord<K, V>> {\n return RecordSchema.base.record(keyValidator, valueValidator)\n}\n\n/**\n * Returns a validator that asserts that the input object's own enumerable properties has\n * string keys and values that match the given validator.\n *\n * Prototype members are not included.\n *\n * @param valueValidator Validates each value.\n */\nexport function recordValues<const V>(\n valueValidator: Validator<V>\n): RecordSchema<Record<string, V>> {\n return RecordSchema.base.recordValues(valueValidator)\n}\n\n/**\n * Returns a validator that asserts the input is a set with elements that match the given\n * element validator.\n * @param elementValidator\n */\nexport function set<const U>(\n elementValidator: Validator<U>\n): SetSchema<Set<U>> {\n return SetSchema.base.withElements(elementValidator)\n}\n\n/**\n * Creates a validator that asserts that the input is type 'string'.\n */\nexport function string(): StringSchema {\n return StringSchema.base\n}\n\n/**\n * Creates a validator that asserts that the input array is a tuple whose elements match\n * the given validators.\n *\n * @param validators\n */\nexport function tuple<U extends readonly any[]>(\n ...validators: {\n [Index in keyof U]: Validator<U[Index]>\n }\n): ArraySchema<{\n [Index in keyof U]: U[Index]\n}> {\n return ArraySchema.base.tuple(...validators)\n}\n\n/**\n * Creates a validator that asserts that the input is type 'symbol'.\n */\nexport function symbol(): ValueSchema<symbol> {\n return new ValueSchema(typeOfValidators.symbol)\n}\n\n/**\n * Creates a validator that asserts that the input is strictly undefined.\n */\nexport function exactlyUndefined(): ValueSchema<undefined> {\n return new ValueSchema(valueValidators.undefined())\n}\n\n/**\n * Returns a custom\n * @param expectationMessage\n * @param isValid\n * @param inputStringify\n */\nexport function custom<T>(\n expectationMessage: string,\n isValid: (input: unknown) => boolean,\n inputStringify: (input: unknown) => string = (input) =>\n stringifyForPrint(input, 500)\n): ValueSchema<T> {\n return new ValueSchema(\n createValidator(expectationMessage, isValid, inputStringify)\n )\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ValueSchema } from '@amazon/vinyl-validation'\nimport { isOneOf } from '@amazon/vinyl-validation'\n\n/**\n * An alternative rendition defined by EXT-X-MEDIA in an HLS Master Playlist.\n *\n * Alternative renditions allow a presentation to offer multiple versions of the same content,\n * such as audio in different languages or subtitles, that can be selected independently of the\n * variant stream.\n *\n * @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.4.1\n */\nexport interface AlternativeRendition {\n /** The media type of this rendition (AUDIO, VIDEO, SUBTITLES, or CLOSED-CAPTIONS). */\n readonly type: RenditionType\n\n /** The group to which this rendition belongs (GROUP-ID). Variants reference groups to associate renditions. */\n readonly groupId: string\n\n /** A human-readable description of this rendition (NAME). */\n readonly name: string\n\n /** The URI of the Media Playlist for this rendition. Absent for CLOSED-CAPTIONS or when muxed into the variant. */\n readonly uri?: string\n\n /** The primary language of this rendition as a BCP 47 tag (LANGUAGE). */\n readonly language?: string\n\n /** Whether this rendition should be played when the user has not expressed a preference (DEFAULT). */\n readonly default?: boolean\n\n /** Whether the client may choose to play this rendition without explicit user selection (AUTOSELECT). */\n readonly autoSelect?: boolean\n\n /**\n * Whether this is a forced rendition (FORCED=YES): it presents essential\n * text (e.g. translations of foreign dialogue) that should be shown even\n * when the user has not enabled subtitles. Only meaningful for SUBTITLES.\n */\n readonly forced?: boolean\n\n /**\n * Media Characteristic Tags (CHARACTERISTICS), a comma-separated list of\n * Uniform Type Identifiers describing the rendition, e.g.\n * `public.accessibility.transcribes-spoken-dialog`. Parsed into individual\n * tags. Absent when the attribute is not present.\n */\n readonly characteristics?: readonly string[]\n}\n\n/**\n * The media type of an alternative rendition (EXT-X-MEDIA TYPE attribute).\n *\n * @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.4.1\n */\nexport type RenditionType = 'AUDIO' | 'VIDEO' | 'SUBTITLES' | 'CLOSED-CAPTIONS'\n\nexport const renditionTypeValidator: ValueSchema<RenditionType> = isOneOf(\n 'AUDIO',\n 'VIDEO',\n 'SUBTITLES',\n 'CLOSED-CAPTIONS'\n)\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ValueSchema } from '@amazon/vinyl-validation'\nimport { isOneOf } from '@amazon/vinyl-validation'\n\n/**\n * Encryption key metadata for an HLS media segment (EXT-X-KEY).\n *\n * Specifies how media segments are encrypted and provides the information needed to decrypt them.\n *\n * @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.2.4\n */\nexport interface EncryptionKey {\n /** The encryption method applied to media segments (METHOD). */\n readonly method: EncryptionMethod\n\n /** The URI for obtaining the decryption key (URI). Required unless method is NONE. */\n readonly uri?: string\n\n /** The initialization vector for decryption as a hexadecimal string (IV). */\n readonly iv?: string\n\n /** The format of the key in the response (KEYFORMAT). Identifies the DRM system, e.g. FairPlay. */\n readonly keyFormat?: string\n\n /** A slash-separated list of integers indicating compatible key format versions (KEYFORMATVERSIONS). */\n readonly keyFormatVersions?: string\n}\n\n/**\n * The encryption method for an HLS segment (EXT-X-KEY METHOD attribute).\n *\n * @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.2.4\n */\nexport type EncryptionMethod =\n | 'NONE'\n | 'AES-128'\n | 'SAMPLE-AES'\n | 'SAMPLE-AES-CTR'\n\nexport const encryptionMethodValidator: ValueSchema<EncryptionMethod> = isOneOf(\n 'NONE',\n 'AES-128',\n 'SAMPLE-AES',\n 'SAMPLE-AES-CTR'\n)\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { char, isWhitespaceChar, type StringReader } from '@amazon/vinyl-util'\n\nconst LF = char('\\n')\nconst CR = char('\\r')\n\n/**\n * Reads a line from the StringReader, advancing past the line ending.\n * Returns the line content without the line ending.\n */\nexport function readLine(reader: StringReader): string {\n const line = reader.substringUntil((cc) => cc === LF || cc === CR)\n if (reader.hasNext() && reader.peek === CR) reader.next()\n if (reader.hasNext() && reader.peek === LF) reader.next()\n return line\n}\n\n/**\n * Skips whitespace-only content at the current position up to and including\n * the next line ending. Returns true if a whitespace-only line was skipped.\n */\nexport function skipWhitespaceLine(reader: StringReader): boolean {\n const start = reader.position\n reader.while((cc) => isWhitespaceChar(cc) && cc !== LF && cc !== CR)\n if (!reader.hasNext() || reader.peek === LF || reader.peek === CR) {\n if (reader.hasNext()) {\n if (reader.peek === CR) reader.next()\n if (reader.hasNext() && reader.peek === LF) reader.next()\n }\n return true\n }\n reader.position = start\n return false\n}\n\n/**\n * Conditionally adds properties from an attribute map to an object.\n * Only adds a property if the corresponding attribute key exists and is truthy.\n */\nexport function addIfPresent<T extends Record<string, any>>(\n obj: T,\n attrs: Record<string, string>,\n mappings: Record<string, string>\n): T {\n for (const [attrKey, objKey] of Object.entries(mappings)) {\n if (attrs[attrKey]) {\n ;(obj as any)[objKey] = attrs[attrKey]\n }\n }\n return obj\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { StringReader, substitute } from '@amazon/vinyl-util'\nimport type { HlsDateRange } from '../types/HlsDateRange'\nimport type { EncryptionKey } from '../types/EncryptionKey'\nimport { encryptionMethodValidator } from '../types/EncryptionKey'\nimport type { HlsSegment, HlsMap } from '../types/HlsSegment'\nimport type { HlsMediaPlaylist } from '../types/HlsMediaPlaylist'\nimport { parseAttributes } from './parseAttributes'\nimport { readLine, skipWhitespaceLine, addIfPresent } from './parseUtil'\n\n// The variable-name class excludes `{` (and `}`) so a match attempt can't\n// scan across token boundaries. With `[^}]` a crafted value such as\n// `{$|{$|{$|\u2026` makes replace() do polynomial work (ReDoS); `[^{}]` keeps it\n// linear, and HLS variable names never contain `{`/`}`.\nexport const HLS_VARIABLE_PATTERN = /\\{\\$([^{}]+)}/g\n\nconst EXTM3U = '#EXTM3U'\nconst EXTINF = '#EXTINF:'\nconst EXT_X_TARGETDURATION = '#EXT-X-TARGETDURATION:'\nconst EXT_X_MEDIA_SEQUENCE = '#EXT-X-MEDIA-SEQUENCE:'\nconst EXT_X_ENDLIST = '#EXT-X-ENDLIST'\nconst EXT_X_PLAYLIST_TYPE = '#EXT-X-PLAYLIST-TYPE:'\nconst EXT_X_VERSION = '#EXT-X-VERSION:'\nconst EXT_X_KEY = '#EXT-X-KEY:'\nconst EXT_X_BYTERANGE = '#EXT-X-BYTERANGE:'\nconst EXT_X_DISCONTINUITY = '#EXT-X-DISCONTINUITY'\nconst EXT_X_PROGRAM_DATE_TIME = '#EXT-X-PROGRAM-DATE-TIME:'\nconst EXT_X_MAP = '#EXT-X-MAP:'\nconst EXT_X_DEFINE = '#EXT-X-DEFINE:'\nconst EXT_X_DATERANGE = '#EXT-X-DATERANGE:'\n\n/**\n * Parses an HLS media playlist from M3U8 text.\n *\n * @param text The raw M3U8 manifest string.\n * @param variables Optional variable definitions from the parent multivariant\n * playlist's #EXT-X-DEFINE tags. Media-playlist `#EXT-X-DEFINE:IMPORT=\"name\"`\n * entries resolve against this map. Local `#EXT-X-DEFINE:NAME=,VALUE=`\n * entries are also supported and take precedence.\n * @param queryParams Optional query parameters from the playlist's own URL,\n * used to resolve `#EXT-X-DEFINE:QUERYPARAM=\"name\"` entries (RFC 8216\n * \u00A74.4.5.1). Interstitial ad manifests (e.g. AWS MediaTailor) commonly carry\n * session tokens this way and reference them as `{$name}` in child URIs.\n * @returns A readonly HlsMediaPlaylist structure.\n * @throws StringParseError if the manifest is malformed.\n */\nexport function parseMediaPlaylist(\n text: string,\n variables?: Readonly<Record<string, string>>,\n queryParams?: Readonly<Record<string, string>>\n): HlsMediaPlaylist {\n const defines: Record<string, string> = { ...(variables ?? {}) }\n const substituteVars = (v: string): string =>\n Object.keys(defines).length === 0\n ? v\n : substitute(v, defines, HLS_VARIABLE_PATTERN)\n\n const reader = new StringReader(text)\n\n reader.white()\n if (!reader.stringIf(EXTM3U)) {\n reader.err('Expected #EXTM3U')\n }\n readLine(reader)\n\n let version = 1\n let targetDuration = 0\n let mediaSequence = 0\n let playlistType: 'VOD' | 'EVENT' | 'LIVE' = 'LIVE'\n let ended = false\n\n let currentKey: EncryptionKey | undefined\n let currentMap: HlsMap | undefined\n let pendingByteRange: { length: number; offset: number } | undefined\n let pendingDiscontinuity = false\n let pendingDateTime: string | undefined\n\n const segments: HlsSegment[] = []\n const dateRanges: HlsDateRange[] = []\n let sequenceCounter = 0\n\n while (reader.hasNext()) {\n if (skipWhitespaceLine(reader)) continue\n\n const line = readLine(reader)\n const trimmed = line.trim()\n if (!trimmed) continue\n\n if (trimmed.startsWith(EXTINF)) {\n const durationStr = trimmed.substring(EXTINF.length).split(',')[0]\n const duration = Number(durationStr)\n\n // Find the URI, skipping any tags that come between EXTINF and URI\n let uri = ''\n while (reader.hasNext()) {\n if (skipWhitespaceLine(reader)) continue\n const nextLine = readLine(reader).trim()\n if (!nextLine.startsWith('#')) {\n uri = substituteVars(nextLine)\n break\n }\n // Process tags that come between EXTINF and URI\n if (nextLine.startsWith(EXT_X_BYTERANGE)) {\n const rangeStr = nextLine.substring(EXT_X_BYTERANGE.length)\n pendingByteRange = parseByteRangeString(rangeStr)\n } else if (nextLine === EXT_X_DISCONTINUITY) {\n pendingDiscontinuity = true\n } else if (nextLine.startsWith(EXT_X_PROGRAM_DATE_TIME)) {\n pendingDateTime = nextLine.substring(\n EXT_X_PROGRAM_DATE_TIME.length\n )\n } else if (nextLine.startsWith(EXT_X_MAP)) {\n const attrStr = nextLine.substring(EXT_X_MAP.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n const mapUri = attrs['URI']\n if (mapUri) {\n const byteRangeStr = attrs['BYTERANGE']\n currentMap = {\n uri: mapUri,\n ...(byteRangeStr && {\n byteRange: parseByteRangeString(byteRangeStr),\n }),\n }\n }\n }\n }\n\n segments.push({\n uri,\n duration,\n sequenceNumber: mediaSequence + sequenceCounter,\n ...(currentKey && { key: currentKey }),\n ...(currentMap && { map: currentMap }),\n ...(pendingByteRange && { byteRange: pendingByteRange }),\n discontinuity: pendingDiscontinuity,\n ...(pendingDateTime && { programDateTime: pendingDateTime }),\n })\n\n sequenceCounter++\n pendingByteRange = undefined\n pendingDiscontinuity = false\n pendingDateTime = undefined\n } else if (trimmed.startsWith(EXT_X_TARGETDURATION)) {\n targetDuration = Number(\n trimmed.substring(EXT_X_TARGETDURATION.length)\n )\n } else if (trimmed.startsWith(EXT_X_MEDIA_SEQUENCE)) {\n mediaSequence = Number(\n trimmed.substring(EXT_X_MEDIA_SEQUENCE.length)\n )\n } else if (trimmed === EXT_X_ENDLIST) {\n ended = true\n } else if (trimmed.startsWith(EXT_X_PLAYLIST_TYPE)) {\n const val = trimmed.substring(EXT_X_PLAYLIST_TYPE.length).trim()\n if (val === 'VOD' || val === 'EVENT') {\n playlistType = val\n }\n } else if (trimmed.startsWith(EXT_X_VERSION)) {\n version = Number(trimmed.substring(EXT_X_VERSION.length))\n } else if (trimmed.startsWith(EXT_X_KEY)) {\n const attrStr = trimmed.substring(EXT_X_KEY.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n\n const method = attrs['METHOD']\n encryptionMethodValidator.assert(method)\n\n currentKey = addIfPresent(\n {\n method,\n },\n attrs,\n {\n URI: 'uri',\n IV: 'iv',\n KEYFORMAT: 'keyFormat',\n KEYFORMATVERSIONS: 'keyFormatVersions',\n }\n )\n } else if (trimmed.startsWith(EXT_X_MAP)) {\n const attrStr = trimmed.substring(EXT_X_MAP.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n\n const mapUri = attrs['URI']\n if (mapUri) {\n const byteRangeStr = attrs['BYTERANGE']\n currentMap = {\n uri: mapUri,\n ...(byteRangeStr && {\n byteRange: parseByteRangeString(byteRangeStr),\n }),\n }\n }\n } else if (trimmed.startsWith(EXT_X_BYTERANGE)) {\n const rangeStr = trimmed.substring(EXT_X_BYTERANGE.length)\n pendingByteRange = parseByteRangeString(rangeStr)\n } else if (trimmed === EXT_X_DISCONTINUITY) {\n pendingDiscontinuity = true\n } else if (trimmed.startsWith(EXT_X_PROGRAM_DATE_TIME)) {\n pendingDateTime = trimmed.substring(EXT_X_PROGRAM_DATE_TIME.length)\n } else if (trimmed.startsWith(EXT_X_DEFINE)) {\n const attrStr = trimmed.substring(EXT_X_DEFINE.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n const importName = attrs['IMPORT']\n const queryParamName = attrs['QUERYPARAM']\n if (importName) {\n // Per RFC 8216 \u00A74.4.2.3: IMPORT copies the value from the\n // parent multivariant's DEFINE map. Ignore silently if unknown.\n const imported = variables?.[importName]\n if (imported !== undefined) defines[importName] = imported\n } else if (queryParamName) {\n // Per RFC 8216 \u00A74.4.5.1: QUERYPARAM copies the value from the\n // named query parameter of the playlist's own URL. Ignore\n // silently if the parameter is absent.\n const queryValue = queryParams?.[queryParamName]\n if (queryValue !== undefined) {\n defines[queryParamName] = queryValue\n }\n } else if (attrs['NAME'] && attrs['VALUE']) {\n defines[attrs['NAME']] = attrs['VALUE']\n }\n } else if (trimmed.startsWith(EXT_X_DATERANGE)) {\n const dateRange = parseHlsDateRange(\n trimmed.substring(EXT_X_DATERANGE.length),\n substituteVars\n )\n if (dateRange) dateRanges.push(dateRange)\n }\n // Unrecognized tags and comments are silently skipped\n }\n\n return {\n version,\n targetDuration,\n mediaSequence,\n playlistType,\n ended,\n segments,\n dateRanges,\n }\n}\n\n/**\n * Attribute names that map to typed {@link HlsDateRange} fields and are therefore\n * excluded from the free-form {@link HlsDateRange.clientAttributes} bag.\n */\nconst DATERANGE_RESERVED_ATTRS = new Set([\n 'ID',\n 'CLASS',\n 'START-DATE',\n 'END-DATE',\n 'DURATION',\n 'PLANNED-DURATION',\n 'END-ON-NEXT',\n])\n\n/**\n * Parses the attribute list of an EXT-X-DATERANGE tag. Returns undefined when\n * the tag is missing the required ID or START-DATE attributes (per RFC 8216\n * \u00A74.3.2.7 a Date Range without both is not usable), so malformed tags are\n * skipped rather than throwing.\n *\n * The `X-` client-defined attributes are collected verbatim into\n * {@link HlsDateRange.clientAttributes}. Interstitial attributes such as\n * `X-ASSET-URI` frequently reference EXT-X-DEFINE variables, so string values\n * are passed through the same substitution applied to segment URIs.\n */\nfunction parseHlsDateRange(\n attrStr: string,\n substituteVars: (v: string) => string\n): HlsDateRange | undefined {\n const attrs = parseAttributes(new StringReader(attrStr))\n\n const id = attrs['ID']\n // START-DATE may be absent (the Record index type hides this), so gate on\n // key presence rather than a nullish fallback.\n const startDate = 'START-DATE' in attrs ? attrs['START-DATE'] : ''\n // END-ON-NEXT ranges anchor to the following range and may legitimately\n // omit START-DATE; RFC requires ID and CLASS in that case.\n const endOnNext = attrs['END-ON-NEXT'] === 'YES'\n if (!id) return undefined\n if (!startDate && !endOnNext) return undefined\n\n const clientAttributes: Record<string, string> = {}\n for (const [key, value] of Object.entries(attrs)) {\n if (DATERANGE_RESERVED_ATTRS.has(key)) continue\n clientAttributes[key] = substituteVars(value)\n }\n\n return {\n id,\n startDate,\n ...(attrs['CLASS'] && { classId: attrs['CLASS'] }),\n ...(attrs['END-DATE'] && { endDate: attrs['END-DATE'] }),\n ...(attrs['DURATION'] && { duration: Number(attrs['DURATION']) }),\n ...(attrs['PLANNED-DURATION'] && {\n plannedDuration: Number(attrs['PLANNED-DURATION']),\n }),\n ...(endOnNext && { endOnNext: true }),\n clientAttributes,\n }\n}\n\n/**\n * Parses a byte range string (e.g. \"1000@500\" or \"1000\") into length and offset.\n */\nfunction parseByteRangeString(str: string): {\n readonly length: number\n readonly offset: number\n} {\n const parts = str.split('@')\n return {\n length: Number(parts[0]),\n offset: parts.length > 1 ? Number(parts[1]) : 0,\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { StringReader, substitute, ValidationError } from '@amazon/vinyl-util'\nimport type { AlternativeRendition } from '../types/AlternativeRendition'\nimport { renditionTypeValidator } from '../types/AlternativeRendition'\nimport type { HlsMainPlaylist } from '../types/HlsMainPlaylist'\nimport type { SessionData } from '../types/SessionData'\nimport type { VariantStream } from '../types/VariantStream'\nimport { HLS_VARIABLE_PATTERN } from './parseMediaPlaylist'\nimport { parseAttributes } from './parseAttributes'\nimport { readLine, skipWhitespaceLine, addIfPresent } from './parseUtil'\n\nconst EXTM3U = '#EXTM3U'\nconst EXT_X_STREAM_INF = '#EXT-X-STREAM-INF:'\nconst EXT_X_MEDIA = '#EXT-X-MEDIA:'\nconst EXT_X_SESSION_DATA = '#EXT-X-SESSION-DATA:'\nconst EXT_X_DEFINE = '#EXT-X-DEFINE:'\n\n/**\n * Parses an HLS master playlist from M3U8 text.\n *\n * @param text The raw M3U8 manifest string.\n * @param queryParams Optional query parameters from the playlist's own URL,\n * used to resolve `#EXT-X-DEFINE:QUERYPARAM=\"name\"` entries (RFC 8216\n * \u00A74.4.5.1). Resolved values are exposed via {@link HlsMainPlaylist.defines} so\n * child media playlists can `IMPORT` them. Interstitial ad manifests (e.g.\n * AWS MediaTailor) carry session tokens this way.\n * @returns A readonly HlsMainPlaylist structure.\n * @throws StringParseError if the manifest is malformed.\n */\nexport function parseMainPlaylist(\n text: string,\n queryParams?: Readonly<Record<string, string>>\n): HlsMainPlaylist {\n const reader = new StringReader(text)\n\n reader.white()\n if (!reader.stringIf(EXTM3U)) {\n reader.err('Expected #EXTM3U')\n }\n // Advance past the rest of the #EXTM3U line\n readLine(reader)\n\n const variants: VariantStream[] = []\n const alternativeRenditions: AlternativeRendition[] = []\n const sessionData: SessionData[] = []\n const defines: Record<string, string> = {}\n\n while (reader.hasNext()) {\n if (skipWhitespaceLine(reader)) continue\n\n const line = readLine(reader)\n const trimmed = line.trim()\n if (!trimmed) continue\n\n if (trimmed.startsWith(EXT_X_STREAM_INF)) {\n const attrStr = trimmed.substring(EXT_X_STREAM_INF.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n\n // Next non-empty line is the URI\n let uri = ''\n while (reader.hasNext()) {\n if (skipWhitespaceLine(reader)) continue\n uri = readLine(reader).trim()\n break\n }\n\n variants.push(\n addIfPresent(\n {\n bandwidth: Number(attrs['BANDWIDTH']),\n uri: substituteHlsVariables(uri, defines),\n ...(attrs['FRAME-RATE'] && {\n frameRate: Number(attrs['FRAME-RATE']),\n }),\n ...(attrs.RESOLUTION &&\n parseResolution(attrs.RESOLUTION)),\n },\n attrs,\n {\n CODECS: 'codecs',\n AUDIO: 'audioGroup',\n VIDEO: 'videoGroup',\n SUBTITLES: 'subtitlesGroup',\n 'CLOSED-CAPTIONS': 'closedCaptionsGroup',\n }\n )\n )\n } else if (trimmed.startsWith(EXT_X_MEDIA)) {\n const attrStr = trimmed.substring(EXT_X_MEDIA.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n\n const type = attrs['TYPE']\n renditionTypeValidator.assert(type)\n\n if (attrs['URI']) {\n attrs['URI'] = substituteHlsVariables(attrs['URI'], defines)\n }\n\n alternativeRenditions.push(\n addIfPresent(\n {\n type,\n groupId: attrs['GROUP-ID'],\n name: attrs['NAME'],\n ...(attrs['DEFAULT'] && {\n default: attrs['DEFAULT'] === 'YES',\n }),\n ...(attrs['AUTOSELECT'] && {\n autoSelect: attrs['AUTOSELECT'] === 'YES',\n }),\n ...(attrs['FORCED'] && {\n forced: attrs['FORCED'] === 'YES',\n }),\n ...(attrs['CHARACTERISTICS'] && {\n characteristics: attrs['CHARACTERISTICS']\n .split(',')\n .map((c) => c.trim())\n .filter((c) => c.length > 0),\n }),\n },\n attrs,\n {\n URI: 'uri',\n LANGUAGE: 'language',\n }\n )\n )\n } else if (trimmed.startsWith(EXT_X_SESSION_DATA)) {\n const attrStr = trimmed.substring(EXT_X_SESSION_DATA.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n\n sessionData.push(\n addIfPresent(\n {\n dataId: attrs['DATA-ID'],\n },\n attrs,\n {\n VALUE: 'value',\n URI: 'uri',\n LANGUAGE: 'language',\n }\n )\n )\n } else if (trimmed.startsWith(EXT_X_DEFINE)) {\n const attrStr = trimmed.substring(EXT_X_DEFINE.length)\n const attrReader = new StringReader(attrStr)\n const attrs = parseAttributes(attrReader)\n const queryParamName = attrs['QUERYPARAM']\n if (queryParamName) {\n // Per RFC 8216 \u00A74.4.5.1: QUERYPARAM copies the value from the\n // named query parameter of the playlist's own URL. Ignore\n // silently if the parameter is absent.\n const queryValue = queryParams?.[queryParamName]\n if (queryValue !== undefined) {\n defines[queryParamName] = queryValue\n }\n } else if (attrs['NAME'] && attrs['VALUE']) {\n defines[attrs['NAME']] = attrs['VALUE']\n }\n }\n // Unrecognized tags and comments are silently skipped\n }\n\n return { variants, alternativeRenditions, sessionData, defines }\n}\n\n/**\n * Applies EXT-X-DEFINE variable substitution (per RFC 8216 \u00A74.2) to a manifest\n * value, replacing `{$NAME}` tokens with the values declared earlier in the\n * playlist. Returns the input unchanged when no variables have been declared.\n */\nfunction substituteHlsVariables(\n value: string,\n variables: Readonly<Record<string, string>>\n): string {\n if (!value || Object.keys(variables).length === 0) return value\n return substitute(value, variables, HLS_VARIABLE_PATTERN)\n}\n\n/**\n * Parses a resolution string (e.g., \"1920x1080\") into width and height numbers.\n * Throws ValidationError for invalid formats per HLS spec.\n */\nfunction parseResolution(resolution: string): {\n width: number\n height: number\n} {\n const parts = resolution.split('x')\n if (parts.length !== 2) {\n throw new ValidationError(\n 'Invalid resolution format, expected WIDTHxHEIGHT'\n )\n }\n\n const width = Number(parts[0])\n const height = Number(parts[1])\n\n if (\n !Number.isInteger(width) ||\n !Number.isInteger(height) ||\n width <= 0 ||\n height <= 0\n ) {\n throw new ValidationError(\n 'Invalid resolution values, width and height must be positive integers'\n )\n }\n\n return { width, height }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n//-------------------------------------------------------------------------\n// A Benchmarking utility for testing and comparing performance.\n//-------------------------------------------------------------------------\n\n/**\n * Gets the current high resolution timestamp, platform dependent.\n */\nlet now: () => number\nif (\n typeof window !== 'undefined' &&\n typeof window.performance !== 'undefined' &&\n typeof window.performance.now !== 'undefined'\n) {\n now = () => window.performance.now()\n} else if (\n typeof self !== 'undefined' &&\n typeof self.performance !== 'undefined' &&\n typeof self.performance.now !== 'undefined'\n) {\n now = () => self.performance.now()\n} else {\n now = () => Date.now()\n}\n\nexport interface BenchMarkOptions {\n /**\n * The amount of time to run the executor before beginning measurement (in seconds).\n */\n readonly warmupTime: number\n\n /**\n * When time has elapsed past this duration during a cycle (in seconds), there will be no\n * operations.\n * The cycle will end when `maxCycleDuration` has been reached.\n */\n readonly maxCycleDuration: number\n\n /**\n * The number of trials to run.\n */\n readonly cycles: number\n}\n\nexport interface CycleResults {\n /**\n * The number of seconds the cycle ran.\n */\n readonly duration: number\n\n /**\n * The number of completed executions.\n */\n readonly ops: number\n}\n\nexport class BenchmarkRunResults {\n readonly cycleResults: number[] = []\n\n private _totalSamples = 0\n get totalSamples(): number {\n return this._totalSamples\n }\n\n get cycleResultsNoOutliers(): number[] {\n const sD = this.standardDeviation\n const avg = average(this.cycleResults)\n return this.cycleResults.filter((e) => {\n const zScore = (avg - e) / sD\n return Math.abs(zScore) < 3\n })\n }\n\n /**\n * Returns the mean ops per second minus outliers of greater than 3 standard deviations.\n */\n get meanOpsPerSec(): number {\n return average(this.cycleResultsNoOutliers)\n }\n\n get standardDeviation(): number {\n return standardDeviation(this.cycleResults)\n }\n\n get variance(): number {\n return this.standardDeviation / this.meanOpsPerSec\n }\n\n /**\n * Returns the mean ops / s \u00B1 variance % as a string.\n */\n get meanOpsStr(): string {\n const mean = this.meanOpsPerSec.toLocaleString(undefined, {\n maximumSignificantDigits: 4,\n })\n const variance = this.variance.toLocaleString(undefined, {\n style: 'percent',\n })\n return `${mean} \u00B1${variance}`\n }\n\n constructor(readonly name: string) {}\n\n add(cycle: CycleResults) {\n const opsPerSecond = cycle.ops / cycle.duration\n let index = this.cycleResults.findIndex((value) => opsPerSecond < value)\n if (index < 0) index = this.cycleResults.length\n this.cycleResults.splice(index, 0, opsPerSecond)\n this._totalSamples += cycle.ops\n }\n\n toString(): string {\n if (!this.cycleResults.length) return 'No results'\n return `${this.name}: ${this.meanOpsStr} ops/sec`\n }\n}\n\nexport class RunResultsComparison {\n /**\n * Sorted by median ops/s from slowest to fastest.\n */\n readonly results: BenchmarkRunResults[]\n\n constructor(\n readonly name: string,\n results: BenchmarkRunResults[]\n ) {\n this.results = results.sort((a, b) => {\n return a.meanOpsPerSec - b.meanOpsPerSec\n })\n }\n\n logToTable(): void {\n const r = this.results.map((run) => {\n const variance = run.variance.toLocaleString(undefined, {\n style: 'percent',\n })\n const mean = run.meanOpsPerSec.toLocaleString(undefined, {\n maximumSignificantDigits: 4,\n })\n\n return {\n Name: run.name,\n Mean: `${mean} \u00B1${variance}`,\n Samples: run.totalSamples,\n Compare: this.runComparisonToString(run),\n }\n })\n // Use the names as the index.\n const table = r.reduce<any>((acc, { Name, ...x }) => {\n acc[Name] = x\n return acc\n }, {})\n console.log('\\n' + this.name)\n console.table(table)\n }\n\n runComparisonToString(run: BenchmarkRunResults): string {\n const baseline = this.results[0]?.meanOpsPerSec ?? 0\n const fasterPercent = run.meanOpsPerSec / baseline - 1\n return fasterPercent < 0.01\n ? '-'\n : fasterPercent.toLocaleString(undefined, {\n style: 'percent',\n }) + ' faster'\n }\n}\n\nexport function compareResults(\n name: string,\n ...results: BenchmarkRunResults[]\n): RunResultsComparison {\n return new RunResultsComparison(name, results)\n}\n\nconst defaultBenchmarkOptions: BenchMarkOptions = {\n warmupTime: 0.5,\n maxCycleDuration: 0.5,\n cycles: 9,\n} as const\n\nexport class Benchmark {\n private static semaphore: Promise<any> = nextFrame()\n\n private readonly options: BenchMarkOptions\n\n /**\n * Constructs a new Benchmark.\n *\n * @param name The name of the benchmark, to be used when logging.\n * @param executor The method to execute and measure. If this method returns a promise, the\n * promise will be awaited. The executor should either always return a promise, or never.\n * @param options Optional configuration for the benchmark.\n */\n constructor(\n readonly name: string,\n readonly executor: () => any,\n options?: Partial<BenchMarkOptions>\n ) {\n this.options = { ...defaultBenchmarkOptions, ...options }\n }\n\n async run(): Promise<BenchmarkRunResults> {\n const opts = this.options\n // Wait for any currently running work to complete.\n await Benchmark.semaphore\n\n const warmupTimeMs = opts.warmupTime * 1000\n const cycleStart = now()\n let isAsync = false\n do {\n const result = this.executor()\n // If the executor returns a promise, it is considered an async test and the benchmark\n // should await its result.\n isAsync = isAsync || (result && typeof result.then === 'function')\n if (isAsync) await result\n } while (now() - cycleStart < warmupTimeMs)\n const resultsPromise: Promise<BenchmarkRunResults> = (async () => {\n const results = new BenchmarkRunResults(this.name)\n for (let i = 0; i < opts.cycles; i++) {\n const cycleResults = await this.runCycle(isAsync)\n results.add(cycleResults)\n await nextFrame()\n }\n return results\n })()\n Benchmark.semaphore = resultsPromise\n return await resultsPromise\n }\n\n /**\n * Runs one cycle. A cycle will repeat the executor approximately `options.maxCycleDuration`\n * seconds.\n *\n * @param isAsync\n * @return Returns the duration (in seconds) and number of operations the cycle repeated.\n */\n private async runCycle(isAsync: boolean): Promise<CycleResults> {\n const cycleMs = this.options.maxCycleDuration * 1000\n let ops = 0\n const cycleStart = now()\n do {\n const result = this.executor()\n if (isAsync) await result\n ops++\n } while (now() - cycleStart < cycleMs)\n const duration = (now() - cycleStart) / 1000\n return {\n duration,\n ops,\n }\n }\n}\n\n/**\n * Creates and runs a benchmark, logging the result.\n *\n * @param name\n * @param executor\n * @param options\n */\nexport function benchmark(\n name: string,\n executor: () => any,\n options?: Partial<BenchMarkOptions>\n): Promise<BenchmarkRunResults> {\n const benchmark = new Benchmark(name, executor, options)\n return benchmark.run().then((results) => {\n console.log(results.toString())\n return results\n })\n}\n\n/**\n * To avoid killing the browser's frame.\n */\nfunction nextFrame(): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve)\n })\n}\n\n/**\n * Returns the standard deviation of the given values.\n *\n * @param values\n */\nfunction standardDeviation(values: readonly number[]): number {\n const avg = average(values)\n const squareDiffs = values.map((value) => {\n const diff = value - avg\n return diff * diff\n })\n const avgSquareDiff = average(squareDiffs)\n return Math.sqrt(avgSquareDiff)\n}\n\n/**\n * Returns the mean/average of the given values.\n *\n * @param values\n */\nfunction average(values: readonly number[]): number {\n const sum = values.reduce((acc, value) => acc + value, 0)\n return sum / values.length\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nlet nextTestTimeoutOverridden: boolean = false\n\n/**\n * Sets the timeout for the current describe block.\n *\n * @param timeout The test timeout, in seconds.\n */\nexport function setTestTimeout(timeout: number) {\n let originalTimeout: number | null = null\n beforeEach(() => {\n originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL\n if (!nextTestTimeoutOverridden)\n jasmine.DEFAULT_TIMEOUT_INTERVAL = timeout * 1000\n })\n\n afterEach(() => {\n if (originalTimeout) jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout\n if (nextTestTimeoutOverridden) nextTestTimeoutOverridden = false\n })\n}\n\n/**\n * Sets the timeout for the next test and only the next test,\n * overriding any value set subsequently to setTestTimeout.\n *\n * @param timeout The test timeout, in seconds.\n */\nexport function setNextTestTimeout(timeout: number) {\n nextTestTimeoutOverridden = true\n jasmine.DEFAULT_TIMEOUT_INTERVAL = timeout * 1000\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Some tests (such as benchmarks or type expectations) have no jasmine expectations.\n */\nexport function expectNothing() {\n expect(true).toBeTruthy()\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport createSpy = jasmine.createSpy\nimport Spy = jasmine.Spy\nimport SpyAnd = jasmine.SpyAnd\nimport Calls = jasmine.Calls\nimport MatchableArgs = jasmine.MatchableArgs\n\ntype Fun = (...args: any[]) => any\n\n/**\n * A SpyFactory creates spies by member access. The spies will be named based on the key,\n * and the type interface of the Spy will match the corresponding interface function.\n */\nexport interface SpyFactory<T> {\n <K extends FunctionKeys<T>>(\n key: K\n ): T[K] extends Fun ? Spy2<NoThisType<NonNullable<T[K]>>> : never\n}\n\n/**\n * Fixes Jasmine's Spy type.\n * Jasmine's Spy interface has a call signature instead of intersecting the original function type.\n * This causes parameterized types of the call signature to be dropped.\n */\nexport type Spy2<Fn extends Fun> = Fn & {\n and: SpyAnd<Fn>\n calls: Calls<Fn>\n withArgs(...args: MatchableArgs<Fn>): Spy<Fn>\n}\n\nexport type FunctionKeys<T> = {\n [P in keyof T]: T[P] extends Fun ? P : never\n}[keyof T]\n\n/**\n * Creates a new spy factory.\n *\n * @param createFake If provided, all spies will be created with the fake implementation createFake\n * returns for the given key.\n */\nexport function createSpyFactory<T>(\n createFake?: (key: FunctionKeys<T>) => Fun\n): SpyFactory<T> {\n return (key: FunctionKeys<T>) => {\n const spy = createSpy(String(key))\n if (createFake) spy.and.callFake(createFake(key))\n return spy as any\n }\n}\n\n/**\n * Creates a Spy.\n * This is an alias to jasmine.createSpy with fixed type parameters.\n * @param key\n */\nexport function createSpy2<Fn extends Fun | undefined>(\n key: keyof any\n): Spy2<NoThisType<NonNullable<Fn>>> {\n return createSpy(String(key)) as any\n}\n\n/**\n * Replaces `this` type with `any` in a method signature.\n */\nexport type NoThisType<Fn extends Fun> =\n ReturnType<Fn> extends ThisType<any>\n ? Fn & ((...args: Parameters<Fn>) => any)\n : Fn\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/*\n * AUTO-GENERATED FILE - DO NOT EDIT\n * Generated by @amazon/vinyl-mock-generator\n */\n\n/* eslint-disable @typescript-eslint/prefer-as-const */\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nimport { createSpy2 } from '../createSpyFactory'\n\nexport class MockAbortController implements AbortController {\n signal: AbortSignal = undefined as any\n\n abort = createSpy2<AbortController['abort']>('abort')\n}\n\nexport class MockAbortSignal implements AbortSignal {\n aborted: boolean = false\n onabort: ((this: AbortSignal, ev: Event) => any) | null = null\n reason: any = undefined\n\n throwIfAborted = createSpy2<AbortSignal['throwIfAborted']>('throwIfAborted')\n addEventListener =\n createSpy2<AbortSignal['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<AbortSignal['removeEventListener']>(\n 'removeEventListener'\n )\n dispatchEvent = createSpy2<AbortSignal['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockAudioContext implements AudioContext {\n baseLatency: number = 0\n outputLatency: number = 0\n audioWorklet: AudioWorklet = undefined as any\n currentTime: number = 0\n destination: AudioDestinationNode = undefined as any\n listener: AudioListener = undefined as any\n onstatechange: ((this: BaseAudioContext, ev: Event) => any) | null = null\n sampleRate: number = 0\n state: AudioContextState = 'closed'\n\n close = createSpy2<AudioContext['close']>('close')\n createMediaElementSource = createSpy2<\n AudioContext['createMediaElementSource']\n >('createMediaElementSource')\n createMediaStreamDestination = createSpy2<\n AudioContext['createMediaStreamDestination']\n >('createMediaStreamDestination')\n createMediaStreamSource = createSpy2<\n AudioContext['createMediaStreamSource']\n >('createMediaStreamSource')\n getOutputTimestamp =\n createSpy2<AudioContext['getOutputTimestamp']>('getOutputTimestamp')\n resume = createSpy2<AudioContext['resume']>('resume')\n suspend = createSpy2<AudioContext['suspend']>('suspend')\n addEventListener =\n createSpy2<AudioContext['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<AudioContext['removeEventListener']>(\n 'removeEventListener'\n )\n createAnalyser =\n createSpy2<AudioContext['createAnalyser']>('createAnalyser')\n createBiquadFilter =\n createSpy2<AudioContext['createBiquadFilter']>('createBiquadFilter')\n createBuffer = createSpy2<AudioContext['createBuffer']>('createBuffer')\n createBufferSource =\n createSpy2<AudioContext['createBufferSource']>('createBufferSource')\n createChannelMerger = createSpy2<AudioContext['createChannelMerger']>(\n 'createChannelMerger'\n )\n createChannelSplitter = createSpy2<AudioContext['createChannelSplitter']>(\n 'createChannelSplitter'\n )\n createConstantSource = createSpy2<AudioContext['createConstantSource']>(\n 'createConstantSource'\n )\n createConvolver =\n createSpy2<AudioContext['createConvolver']>('createConvolver')\n createDelay = createSpy2<AudioContext['createDelay']>('createDelay')\n createDynamicsCompressor = createSpy2<\n AudioContext['createDynamicsCompressor']\n >('createDynamicsCompressor')\n createGain = createSpy2<AudioContext['createGain']>('createGain')\n createIIRFilter =\n createSpy2<AudioContext['createIIRFilter']>('createIIRFilter')\n createOscillator =\n createSpy2<AudioContext['createOscillator']>('createOscillator')\n createPanner = createSpy2<AudioContext['createPanner']>('createPanner')\n createPeriodicWave =\n createSpy2<AudioContext['createPeriodicWave']>('createPeriodicWave')\n createScriptProcessor = createSpy2<AudioContext['createScriptProcessor']>(\n 'createScriptProcessor'\n )\n createStereoPanner =\n createSpy2<AudioContext['createStereoPanner']>('createStereoPanner')\n createWaveShaper =\n createSpy2<AudioContext['createWaveShaper']>('createWaveShaper')\n decodeAudioData =\n createSpy2<AudioContext['decodeAudioData']>('decodeAudioData')\n dispatchEvent = createSpy2<AudioContext['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockCache implements Cache {\n add = createSpy2<Cache['add']>('add')\n addAll = createSpy2<Cache['addAll']>('addAll')\n delete = createSpy2<Cache['delete']>('delete')\n keys = createSpy2<Cache['keys']>('keys')\n match = createSpy2<Cache['match']>('match')\n matchAll = createSpy2<Cache['matchAll']>('matchAll')\n put = createSpy2<Cache['put']>('put')\n}\n\nexport class MockCacheStorage implements CacheStorage {\n delete = createSpy2<CacheStorage['delete']>('delete')\n has = createSpy2<CacheStorage['has']>('has')\n keys = createSpy2<CacheStorage['keys']>('keys')\n match = createSpy2<CacheStorage['match']>('match')\n open = createSpy2<CacheStorage['open']>('open')\n}\n\nexport class MockCustomEvent<T = any> implements CustomEvent<T> {\n detail: T = undefined as any\n bubbles: boolean = false\n cancelBubble: boolean = false\n cancelable: boolean = false\n composed: boolean = false\n currentTarget: EventTarget | null = null\n defaultPrevented: boolean = false\n eventPhase: number = 0\n isTrusted: boolean = false\n returnValue: boolean = false\n srcElement: EventTarget | null = null\n target: EventTarget | null = null\n timeStamp: DOMHighResTimeStamp = 0\n type: string = ''\n NONE: 0 = 0\n CAPTURING_PHASE: 1 = 1\n AT_TARGET: 2 = 2\n BUBBLING_PHASE: 3 = 3\n\n initCustomEvent =\n createSpy2<CustomEvent<T>['initCustomEvent']>('initCustomEvent')\n composedPath = createSpy2<CustomEvent<T>['composedPath']>('composedPath')\n initEvent = createSpy2<CustomEvent<T>['initEvent']>('initEvent')\n preventDefault =\n createSpy2<CustomEvent<T>['preventDefault']>('preventDefault')\n stopImmediatePropagation = createSpy2<\n CustomEvent<T>['stopImmediatePropagation']\n >('stopImmediatePropagation')\n stopPropagation =\n createSpy2<CustomEvent<T>['stopPropagation']>('stopPropagation')\n}\n\nexport class MockDocument implements Document {\n URL: string = ''\n alinkColor: string = ''\n all: HTMLAllCollection = undefined as any\n anchors: HTMLCollectionOf<HTMLAnchorElement> = undefined as any\n applets: HTMLCollection = undefined as any\n bgColor: string = ''\n body: HTMLElement = undefined as any\n characterSet: string = ''\n charset: string = ''\n compatMode: string = ''\n contentType: string = ''\n cookie: string = ''\n currentScript: HTMLOrSVGScriptElement | null = undefined as any\n defaultView: (WindowProxy & typeof globalThis) | null = undefined as any\n designMode: string = ''\n dir: string = ''\n doctype: DocumentType | null = null\n documentElement: HTMLElement = undefined as any\n documentURI: string = ''\n domain: string = ''\n embeds: HTMLCollectionOf<HTMLEmbedElement> = undefined as any\n fgColor: string = ''\n forms: HTMLCollectionOf<HTMLFormElement> = undefined as any\n fragmentDirective: FragmentDirective = undefined as any\n fullscreen: boolean = false\n fullscreenEnabled: boolean = false\n head: HTMLHeadElement = undefined as any\n hidden: boolean = false\n images: HTMLCollectionOf<HTMLImageElement> = undefined as any\n implementation: DOMImplementation = undefined as any\n inputEncoding: string = ''\n lastModified: string = ''\n linkColor: string = ''\n links: HTMLCollectionOf<HTMLAnchorElement | HTMLAreaElement> =\n undefined as any\n onfullscreenchange: ((this: Document, ev: Event) => any) | null = null\n onfullscreenerror: ((this: Document, ev: Event) => any) | null = null\n onpointerlockchange: ((this: Document, ev: Event) => any) | null = null\n onpointerlockerror: ((this: Document, ev: Event) => any) | null = null\n onreadystatechange: ((this: Document, ev: Event) => any) | null = null\n onvisibilitychange: ((this: Document, ev: Event) => any) | null = null\n ownerDocument: null = null\n pictureInPictureEnabled: boolean = false\n plugins: HTMLCollectionOf<HTMLEmbedElement> = undefined as any\n readyState: DocumentReadyState = 'complete'\n referrer: string = ''\n rootElement: SVGSVGElement | null = null\n scripts: HTMLCollectionOf<HTMLScriptElement> = undefined as any\n scrollingElement: Element | null = null\n timeline: DocumentTimeline = undefined as any\n title: string = ''\n visibilityState: DocumentVisibilityState = 'hidden'\n vlinkColor: string = ''\n location: any = undefined\n textContent: null = null\n baseURI: string = ''\n childNodes: NodeListOf<ChildNode> = undefined as any\n firstChild: ChildNode | null = null\n isConnected: boolean = false\n lastChild: ChildNode | null = null\n nextSibling: ChildNode | null = null\n nodeName: string = ''\n nodeType: number = 0\n nodeValue: string | null = ''\n parentElement: HTMLElement | null = null\n parentNode: ParentNode | null = null\n previousSibling: ChildNode | null = null\n ELEMENT_NODE: 1 = 1\n ATTRIBUTE_NODE: 2 = 2\n TEXT_NODE: 3 = 3\n CDATA_SECTION_NODE: 4 = 4\n ENTITY_REFERENCE_NODE: 5 = 5\n ENTITY_NODE: 6 = 6\n PROCESSING_INSTRUCTION_NODE: 7 = 7\n COMMENT_NODE: 8 = 8\n DOCUMENT_NODE: 9 = 9\n DOCUMENT_TYPE_NODE: 10 = 10\n DOCUMENT_FRAGMENT_NODE: 11 = 11\n NOTATION_NODE: 12 = 12\n DOCUMENT_POSITION_DISCONNECTED: 0x01 = 1\n DOCUMENT_POSITION_PRECEDING: 0x02 = 2\n DOCUMENT_POSITION_FOLLOWING: 0x04 = 4\n DOCUMENT_POSITION_CONTAINS: 0x08 = 8\n DOCUMENT_POSITION_CONTAINED_BY: 0x10 = 16\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 = 32\n activeElement: Element | null = null\n adoptedStyleSheets: CSSStyleSheet[] = []\n fullscreenElement: Element | null = null\n pictureInPictureElement: Element | null = null\n pointerLockElement: Element | null = null\n styleSheets: StyleSheetList = undefined as any\n fonts: FontFaceSet = undefined as any\n onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onanimationcancel:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationend:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationiteration:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationstart:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null =\n null\n onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onbeforetoggle:\n | ((this: GlobalEventHandlers, ev: ToggleEvent) => any)\n | null = null\n onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextmenu:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onended: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onerror: OnErrorEventHandler = undefined as any\n onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null =\n null\n ongotpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onlostpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onpointercancel:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerdown:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerenter:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerleave:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointermove:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerout:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerover:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null =\n null\n onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsecuritypolicyviolation:\n | ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any)\n | null = null\n onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null =\n null\n onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null =\n null\n ontransitioncancel:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionend:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionrun:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionstart:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onwebkitanimationend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationiteration:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationstart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkittransitionend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null = null\n childElementCount: number = 0\n children: HTMLCollection = undefined as any\n firstElementChild: Element | null = null\n lastElementChild: Element | null = null\n\n adoptNode = createSpy2<Document['adoptNode']>('adoptNode')\n captureEvents = createSpy2<Document['captureEvents']>('captureEvents')\n caretPositionFromPoint = createSpy2<Document['caretPositionFromPoint']>(\n 'caretPositionFromPoint'\n )\n caretRangeFromPoint = createSpy2<Document['caretRangeFromPoint']>(\n 'caretRangeFromPoint'\n )\n clear = createSpy2<Document['clear']>('clear')\n close = createSpy2<Document['close']>('close')\n createAttribute = createSpy2<Document['createAttribute']>('createAttribute')\n createAttributeNS =\n createSpy2<Document['createAttributeNS']>('createAttributeNS')\n createCDATASection =\n createSpy2<Document['createCDATASection']>('createCDATASection')\n createComment = createSpy2<Document['createComment']>('createComment')\n createDocumentFragment = createSpy2<Document['createDocumentFragment']>(\n 'createDocumentFragment'\n )\n createElement = createSpy2<Document['createElement']>('createElement')\n createElementNS = createSpy2<Document['createElementNS']>('createElementNS')\n createEvent = createSpy2<Document['createEvent']>('createEvent')\n createNodeIterator =\n createSpy2<Document['createNodeIterator']>('createNodeIterator')\n createProcessingInstruction = createSpy2<\n Document['createProcessingInstruction']\n >('createProcessingInstruction')\n createRange = createSpy2<Document['createRange']>('createRange')\n createTextNode = createSpy2<Document['createTextNode']>('createTextNode')\n createTreeWalker =\n createSpy2<Document['createTreeWalker']>('createTreeWalker')\n execCommand = createSpy2<Document['execCommand']>('execCommand')\n exitFullscreen = createSpy2<Document['exitFullscreen']>('exitFullscreen')\n exitPictureInPicture = createSpy2<Document['exitPictureInPicture']>(\n 'exitPictureInPicture'\n )\n exitPointerLock = createSpy2<Document['exitPointerLock']>('exitPointerLock')\n getElementById = createSpy2<Document['getElementById']>('getElementById')\n getElementsByClassName = createSpy2<Document['getElementsByClassName']>(\n 'getElementsByClassName'\n )\n getElementsByName =\n createSpy2<Document['getElementsByName']>('getElementsByName')\n getElementsByTagName = createSpy2<Document['getElementsByTagName']>(\n 'getElementsByTagName'\n )\n getElementsByTagNameNS = createSpy2<Document['getElementsByTagNameNS']>(\n 'getElementsByTagNameNS'\n )\n getSelection = createSpy2<Document['getSelection']>('getSelection')\n hasFocus = createSpy2<Document['hasFocus']>('hasFocus')\n hasStorageAccess =\n createSpy2<Document['hasStorageAccess']>('hasStorageAccess')\n importNode = createSpy2<Document['importNode']>('importNode')\n open = createSpy2<Document['open']>('open')\n queryCommandEnabled = createSpy2<Document['queryCommandEnabled']>(\n 'queryCommandEnabled'\n )\n queryCommandIndeterm = createSpy2<Document['queryCommandIndeterm']>(\n 'queryCommandIndeterm'\n )\n queryCommandState =\n createSpy2<Document['queryCommandState']>('queryCommandState')\n queryCommandSupported = createSpy2<Document['queryCommandSupported']>(\n 'queryCommandSupported'\n )\n queryCommandValue =\n createSpy2<Document['queryCommandValue']>('queryCommandValue')\n releaseEvents = createSpy2<Document['releaseEvents']>('releaseEvents')\n requestStorageAccess = createSpy2<Document['requestStorageAccess']>(\n 'requestStorageAccess'\n )\n startViewTransition = createSpy2<Document['startViewTransition']>(\n 'startViewTransition'\n )\n write = createSpy2<Document['write']>('write')\n writeln = createSpy2<Document['writeln']>('writeln')\n addEventListener =\n createSpy2<Document['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<Document['removeEventListener']>(\n 'removeEventListener'\n )\n appendChild = createSpy2<Document['appendChild']>('appendChild')\n cloneNode = createSpy2<Document['cloneNode']>('cloneNode')\n compareDocumentPosition = createSpy2<Document['compareDocumentPosition']>(\n 'compareDocumentPosition'\n )\n contains = createSpy2<Document['contains']>('contains')\n getRootNode = createSpy2<Document['getRootNode']>('getRootNode')\n hasChildNodes = createSpy2<Document['hasChildNodes']>('hasChildNodes')\n insertBefore = createSpy2<Document['insertBefore']>('insertBefore')\n isDefaultNamespace =\n createSpy2<Document['isDefaultNamespace']>('isDefaultNamespace')\n isEqualNode = createSpy2<Document['isEqualNode']>('isEqualNode')\n isSameNode = createSpy2<Document['isSameNode']>('isSameNode')\n lookupNamespaceURI =\n createSpy2<Document['lookupNamespaceURI']>('lookupNamespaceURI')\n lookupPrefix = createSpy2<Document['lookupPrefix']>('lookupPrefix')\n normalize = createSpy2<Document['normalize']>('normalize')\n removeChild = createSpy2<Document['removeChild']>('removeChild')\n replaceChild = createSpy2<Document['replaceChild']>('replaceChild')\n elementFromPoint =\n createSpy2<Document['elementFromPoint']>('elementFromPoint')\n elementsFromPoint =\n createSpy2<Document['elementsFromPoint']>('elementsFromPoint')\n getAnimations = createSpy2<Document['getAnimations']>('getAnimations')\n append = createSpy2<Document['append']>('append')\n prepend = createSpy2<Document['prepend']>('prepend')\n querySelector = createSpy2<Document['querySelector']>('querySelector')\n querySelectorAll =\n createSpy2<Document['querySelectorAll']>('querySelectorAll')\n replaceChildren = createSpy2<Document['replaceChildren']>('replaceChildren')\n createExpression =\n createSpy2<Document['createExpression']>('createExpression')\n createNSResolver =\n createSpy2<Document['createNSResolver']>('createNSResolver')\n evaluate = createSpy2<Document['evaluate']>('evaluate')\n dispatchEvent = createSpy2<Document['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockErrorEvent implements ErrorEvent {\n colno: number = 0\n error: any = undefined\n filename: string = ''\n lineno: number = 0\n message: string = ''\n bubbles: boolean = false\n cancelBubble: boolean = false\n cancelable: boolean = false\n composed: boolean = false\n currentTarget: EventTarget | null = null\n defaultPrevented: boolean = false\n eventPhase: number = 0\n isTrusted: boolean = false\n returnValue: boolean = false\n srcElement: EventTarget | null = null\n target: EventTarget | null = null\n timeStamp: DOMHighResTimeStamp = 0\n type: string = ''\n NONE: 0 = 0\n CAPTURING_PHASE: 1 = 1\n AT_TARGET: 2 = 2\n BUBBLING_PHASE: 3 = 3\n\n composedPath = createSpy2<ErrorEvent['composedPath']>('composedPath')\n initEvent = createSpy2<ErrorEvent['initEvent']>('initEvent')\n preventDefault = createSpy2<ErrorEvent['preventDefault']>('preventDefault')\n stopImmediatePropagation = createSpy2<\n ErrorEvent['stopImmediatePropagation']\n >('stopImmediatePropagation')\n stopPropagation =\n createSpy2<ErrorEvent['stopPropagation']>('stopPropagation')\n}\n\nexport class MockEvent implements Event {\n bubbles: boolean = false\n cancelBubble: boolean = false\n cancelable: boolean = false\n composed: boolean = false\n currentTarget: EventTarget | null = null\n defaultPrevented: boolean = false\n eventPhase: number = 0\n isTrusted: boolean = false\n returnValue: boolean = false\n srcElement: EventTarget | null = null\n target: EventTarget | null = null\n timeStamp: DOMHighResTimeStamp = 0\n type: string = ''\n NONE: 0 = 0\n CAPTURING_PHASE: 1 = 1\n AT_TARGET: 2 = 2\n BUBBLING_PHASE: 3 = 3\n\n composedPath = createSpy2<Event['composedPath']>('composedPath')\n initEvent = createSpy2<Event['initEvent']>('initEvent')\n preventDefault = createSpy2<Event['preventDefault']>('preventDefault')\n stopImmediatePropagation = createSpy2<Event['stopImmediatePropagation']>(\n 'stopImmediatePropagation'\n )\n stopPropagation = createSpy2<Event['stopPropagation']>('stopPropagation')\n}\n\nexport class MockEventTarget implements EventTarget {\n addEventListener =\n createSpy2<EventTarget['addEventListener']>('addEventListener')\n dispatchEvent = createSpy2<EventTarget['dispatchEvent']>('dispatchEvent')\n removeEventListener = createSpy2<EventTarget['removeEventListener']>(\n 'removeEventListener'\n )\n}\n\nexport class MockHTMLAudioElement implements HTMLAudioElement {\n autoplay: boolean = false\n buffered: TimeRanges = undefined as any\n controls: boolean = false\n crossOrigin: string | null = ''\n currentSrc: string = ''\n currentTime: number = 0\n defaultMuted: boolean = false\n defaultPlaybackRate: number = 0\n disableRemotePlayback: boolean = false\n duration: number = 0\n ended: boolean = false\n error: MediaError | null = null\n loop: boolean = false\n mediaKeys: MediaKeys | null = null\n muted: boolean = false\n networkState: number = 0\n onencrypted:\n | ((this: HTMLMediaElement, ev: MediaEncryptedEvent) => any)\n | null = null\n onwaitingforkey: ((this: HTMLMediaElement, ev: Event) => any) | null = null\n paused: boolean = false\n playbackRate: number = 0\n played: TimeRanges = undefined as any\n preload: 'none' | 'metadata' | 'auto' | '' = 'none'\n preservesPitch: boolean = false\n readyState: number = 0\n remote: RemotePlayback = undefined as any\n seekable: TimeRanges = undefined as any\n seeking: boolean = false\n sinkId: string = ''\n src: string = ''\n srcObject: MediaProvider | null = undefined as any\n textTracks: TextTrackList = undefined as any\n volume: number = 0\n NETWORK_EMPTY: 0 = 0\n NETWORK_IDLE: 1 = 1\n NETWORK_LOADING: 2 = 2\n NETWORK_NO_SOURCE: 3 = 3\n HAVE_NOTHING: 0 = 0\n HAVE_METADATA: 1 = 1\n HAVE_CURRENT_DATA: 2 = 2\n HAVE_FUTURE_DATA: 3 = 3\n HAVE_ENOUGH_DATA: 4 = 4\n accessKey: string = ''\n accessKeyLabel: string = ''\n autocapitalize: string = ''\n autocorrect: boolean = false\n dir: string = ''\n draggable: boolean = false\n hidden: boolean = false\n inert: boolean = false\n innerText: string = ''\n lang: string = ''\n offsetHeight: number = 0\n offsetLeft: number = 0\n offsetParent: Element | null = null\n offsetTop: number = 0\n offsetWidth: number = 0\n outerText: string = ''\n popover: string | null = ''\n spellcheck: boolean = false\n title: string = ''\n translate: boolean = false\n writingSuggestions: string = ''\n attributes: NamedNodeMap = undefined as any\n className: string = ''\n clientHeight: number = 0\n clientLeft: number = 0\n clientTop: number = 0\n clientWidth: number = 0\n currentCSSZoom: number = 0\n id: string = ''\n innerHTML: string = ''\n localName: string = ''\n namespaceURI: string | null = ''\n onfullscreenchange: ((this: Element, ev: Event) => any) | null = null\n onfullscreenerror: ((this: Element, ev: Event) => any) | null = null\n outerHTML: string = ''\n ownerDocument: Document = undefined as any\n prefix: string | null = ''\n scrollHeight: number = 0\n scrollLeft: number = 0\n scrollTop: number = 0\n scrollWidth: number = 0\n shadowRoot: ShadowRoot | null = null\n slot: string = ''\n tagName: string = ''\n classList: any = undefined\n part: any = undefined\n textContent: any = undefined\n attributeStyleMap: StylePropertyMap = undefined as any\n style: any = undefined\n contentEditable: string = ''\n enterKeyHint: string = ''\n inputMode: string = ''\n isContentEditable: boolean = false\n onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onanimationcancel:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationend:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationiteration:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationstart:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null =\n null\n onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onbeforetoggle:\n | ((this: GlobalEventHandlers, ev: ToggleEvent) => any)\n | null = null\n onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextmenu:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onended: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onerror: OnErrorEventHandler = undefined as any\n onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null =\n null\n ongotpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onlostpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onpointercancel:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerdown:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerenter:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerleave:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointermove:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerout:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerover:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null =\n null\n onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsecuritypolicyviolation:\n | ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any)\n | null = null\n onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null =\n null\n onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null =\n null\n ontransitioncancel:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionend:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionrun:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionstart:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onwebkitanimationend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationiteration:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationstart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkittransitionend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null = null\n autofocus: boolean = false\n dataset: DOMStringMap = undefined as any\n tabIndex: number = 0\n baseURI: string = ''\n childNodes: NodeListOf<ChildNode> = undefined as any\n firstChild: ChildNode | null = null\n isConnected: boolean = false\n lastChild: ChildNode | null = null\n nextSibling: ChildNode | null = null\n nodeName: string = ''\n nodeType: number = 0\n nodeValue: string | null = ''\n parentElement: HTMLElement | null = null\n parentNode: ParentNode | null = null\n previousSibling: ChildNode | null = null\n ELEMENT_NODE: 1 = 1\n ATTRIBUTE_NODE: 2 = 2\n TEXT_NODE: 3 = 3\n CDATA_SECTION_NODE: 4 = 4\n ENTITY_REFERENCE_NODE: 5 = 5\n ENTITY_NODE: 6 = 6\n PROCESSING_INSTRUCTION_NODE: 7 = 7\n COMMENT_NODE: 8 = 8\n DOCUMENT_NODE: 9 = 9\n DOCUMENT_TYPE_NODE: 10 = 10\n DOCUMENT_FRAGMENT_NODE: 11 = 11\n NOTATION_NODE: 12 = 12\n DOCUMENT_POSITION_DISCONNECTED: 0x01 = 1\n DOCUMENT_POSITION_PRECEDING: 0x02 = 2\n DOCUMENT_POSITION_FOLLOWING: 0x04 = 4\n DOCUMENT_POSITION_CONTAINS: 0x08 = 8\n DOCUMENT_POSITION_CONTAINED_BY: 0x10 = 16\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 = 32\n ariaActiveDescendantElement: Element | null = null\n ariaAtomic: string | null = ''\n ariaAutoComplete: string | null = ''\n ariaBrailleLabel: string | null = ''\n ariaBrailleRoleDescription: string | null = ''\n ariaBusy: string | null = ''\n ariaChecked: string | null = ''\n ariaColCount: string | null = ''\n ariaColIndex: string | null = ''\n ariaColIndexText: string | null = ''\n ariaColSpan: string | null = ''\n ariaControlsElements: ReadonlyArray<Element> | null = null\n ariaCurrent: string | null = ''\n ariaDescribedByElements: ReadonlyArray<Element> | null = null\n ariaDescription: string | null = ''\n ariaDetailsElements: ReadonlyArray<Element> | null = null\n ariaDisabled: string | null = ''\n ariaErrorMessageElements: ReadonlyArray<Element> | null = null\n ariaExpanded: string | null = ''\n ariaFlowToElements: ReadonlyArray<Element> | null = null\n ariaHasPopup: string | null = ''\n ariaHidden: string | null = ''\n ariaInvalid: string | null = ''\n ariaKeyShortcuts: string | null = ''\n ariaLabel: string | null = ''\n ariaLabelledByElements: ReadonlyArray<Element> | null = null\n ariaLevel: string | null = ''\n ariaLive: string | null = ''\n ariaModal: string | null = ''\n ariaMultiLine: string | null = ''\n ariaMultiSelectable: string | null = ''\n ariaOrientation: string | null = ''\n ariaOwnsElements: ReadonlyArray<Element> | null = null\n ariaPlaceholder: string | null = ''\n ariaPosInSet: string | null = ''\n ariaPressed: string | null = ''\n ariaReadOnly: string | null = ''\n ariaRelevant: string | null = ''\n ariaRequired: string | null = ''\n ariaRoleDescription: string | null = ''\n ariaRowCount: string | null = ''\n ariaRowIndex: string | null = ''\n ariaRowIndexText: string | null = ''\n ariaRowSpan: string | null = ''\n ariaSelected: string | null = ''\n ariaSetSize: string | null = ''\n ariaSort: string | null = ''\n ariaValueMax: string | null = ''\n ariaValueMin: string | null = ''\n ariaValueNow: string | null = ''\n ariaValueText: string | null = ''\n role: string | null = ''\n nextElementSibling: Element | null = null\n previousElementSibling: Element | null = null\n childElementCount: number = 0\n children: HTMLCollection = undefined as any\n firstElementChild: Element | null = null\n lastElementChild: Element | null = null\n assignedSlot: HTMLSlotElement | null = null\n\n addEventListener =\n createSpy2<HTMLAudioElement['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<HTMLAudioElement['removeEventListener']>(\n 'removeEventListener'\n )\n addTextTrack = createSpy2<HTMLAudioElement['addTextTrack']>('addTextTrack')\n canPlayType = createSpy2<HTMLAudioElement['canPlayType']>('canPlayType')\n fastSeek = createSpy2<HTMLAudioElement['fastSeek']>('fastSeek')\n load = createSpy2<HTMLAudioElement['load']>('load')\n pause = createSpy2<HTMLAudioElement['pause']>('pause')\n play = createSpy2<HTMLAudioElement['play']>('play')\n setMediaKeys = createSpy2<HTMLAudioElement['setMediaKeys']>('setMediaKeys')\n setSinkId = createSpy2<HTMLAudioElement['setSinkId']>('setSinkId')\n attachInternals =\n createSpy2<HTMLAudioElement['attachInternals']>('attachInternals')\n click = createSpy2<HTMLAudioElement['click']>('click')\n hidePopover = createSpy2<HTMLAudioElement['hidePopover']>('hidePopover')\n showPopover = createSpy2<HTMLAudioElement['showPopover']>('showPopover')\n togglePopover =\n createSpy2<HTMLAudioElement['togglePopover']>('togglePopover')\n attachShadow = createSpy2<HTMLAudioElement['attachShadow']>('attachShadow')\n checkVisibility =\n createSpy2<HTMLAudioElement['checkVisibility']>('checkVisibility')\n closest = createSpy2<HTMLAudioElement['closest']>('closest')\n computedStyleMap =\n createSpy2<HTMLAudioElement['computedStyleMap']>('computedStyleMap')\n getAttribute = createSpy2<HTMLAudioElement['getAttribute']>('getAttribute')\n getAttributeNS =\n createSpy2<HTMLAudioElement['getAttributeNS']>('getAttributeNS')\n getAttributeNames =\n createSpy2<HTMLAudioElement['getAttributeNames']>('getAttributeNames')\n getAttributeNode =\n createSpy2<HTMLAudioElement['getAttributeNode']>('getAttributeNode')\n getAttributeNodeNS =\n createSpy2<HTMLAudioElement['getAttributeNodeNS']>('getAttributeNodeNS')\n getBoundingClientRect = createSpy2<\n HTMLAudioElement['getBoundingClientRect']\n >('getBoundingClientRect')\n getClientRects =\n createSpy2<HTMLAudioElement['getClientRects']>('getClientRects')\n getElementsByClassName = createSpy2<\n HTMLAudioElement['getElementsByClassName']\n >('getElementsByClassName')\n getElementsByTagName = createSpy2<HTMLAudioElement['getElementsByTagName']>(\n 'getElementsByTagName'\n )\n getElementsByTagNameNS = createSpy2<\n HTMLAudioElement['getElementsByTagNameNS']\n >('getElementsByTagNameNS')\n getHTML = createSpy2<HTMLAudioElement['getHTML']>('getHTML')\n hasAttribute = createSpy2<HTMLAudioElement['hasAttribute']>('hasAttribute')\n hasAttributeNS =\n createSpy2<HTMLAudioElement['hasAttributeNS']>('hasAttributeNS')\n hasAttributes =\n createSpy2<HTMLAudioElement['hasAttributes']>('hasAttributes')\n hasPointerCapture =\n createSpy2<HTMLAudioElement['hasPointerCapture']>('hasPointerCapture')\n insertAdjacentElement = createSpy2<\n HTMLAudioElement['insertAdjacentElement']\n >('insertAdjacentElement')\n insertAdjacentHTML =\n createSpy2<HTMLAudioElement['insertAdjacentHTML']>('insertAdjacentHTML')\n insertAdjacentText =\n createSpy2<HTMLAudioElement['insertAdjacentText']>('insertAdjacentText')\n matches = createSpy2<HTMLAudioElement['matches']>('matches')\n releasePointerCapture = createSpy2<\n HTMLAudioElement['releasePointerCapture']\n >('releasePointerCapture')\n removeAttribute =\n createSpy2<HTMLAudioElement['removeAttribute']>('removeAttribute')\n removeAttributeNS =\n createSpy2<HTMLAudioElement['removeAttributeNS']>('removeAttributeNS')\n removeAttributeNode = createSpy2<HTMLAudioElement['removeAttributeNode']>(\n 'removeAttributeNode'\n )\n requestFullscreen =\n createSpy2<HTMLAudioElement['requestFullscreen']>('requestFullscreen')\n requestPointerLock =\n createSpy2<HTMLAudioElement['requestPointerLock']>('requestPointerLock')\n scroll = createSpy2<HTMLAudioElement['scroll']>('scroll')\n scrollBy = createSpy2<HTMLAudioElement['scrollBy']>('scrollBy')\n scrollIntoView =\n createSpy2<HTMLAudioElement['scrollIntoView']>('scrollIntoView')\n scrollTo = createSpy2<HTMLAudioElement['scrollTo']>('scrollTo')\n setAttribute = createSpy2<HTMLAudioElement['setAttribute']>('setAttribute')\n setAttributeNS =\n createSpy2<HTMLAudioElement['setAttributeNS']>('setAttributeNS')\n setAttributeNode =\n createSpy2<HTMLAudioElement['setAttributeNode']>('setAttributeNode')\n setAttributeNodeNS =\n createSpy2<HTMLAudioElement['setAttributeNodeNS']>('setAttributeNodeNS')\n setHTMLUnsafe =\n createSpy2<HTMLAudioElement['setHTMLUnsafe']>('setHTMLUnsafe')\n setPointerCapture =\n createSpy2<HTMLAudioElement['setPointerCapture']>('setPointerCapture')\n toggleAttribute =\n createSpy2<HTMLAudioElement['toggleAttribute']>('toggleAttribute')\n webkitMatchesSelector = createSpy2<\n HTMLAudioElement['webkitMatchesSelector']\n >('webkitMatchesSelector')\n blur = createSpy2<HTMLAudioElement['blur']>('blur')\n focus = createSpy2<HTMLAudioElement['focus']>('focus')\n appendChild = createSpy2<HTMLAudioElement['appendChild']>('appendChild')\n cloneNode = createSpy2<HTMLAudioElement['cloneNode']>('cloneNode')\n compareDocumentPosition = createSpy2<\n HTMLAudioElement['compareDocumentPosition']\n >('compareDocumentPosition')\n contains = createSpy2<HTMLAudioElement['contains']>('contains')\n getRootNode = createSpy2<HTMLAudioElement['getRootNode']>('getRootNode')\n hasChildNodes =\n createSpy2<HTMLAudioElement['hasChildNodes']>('hasChildNodes')\n insertBefore = createSpy2<HTMLAudioElement['insertBefore']>('insertBefore')\n isDefaultNamespace =\n createSpy2<HTMLAudioElement['isDefaultNamespace']>('isDefaultNamespace')\n isEqualNode = createSpy2<HTMLAudioElement['isEqualNode']>('isEqualNode')\n isSameNode = createSpy2<HTMLAudioElement['isSameNode']>('isSameNode')\n lookupNamespaceURI =\n createSpy2<HTMLAudioElement['lookupNamespaceURI']>('lookupNamespaceURI')\n lookupPrefix = createSpy2<HTMLAudioElement['lookupPrefix']>('lookupPrefix')\n normalize = createSpy2<HTMLAudioElement['normalize']>('normalize')\n removeChild = createSpy2<HTMLAudioElement['removeChild']>('removeChild')\n replaceChild = createSpy2<HTMLAudioElement['replaceChild']>('replaceChild')\n animate = createSpy2<HTMLAudioElement['animate']>('animate')\n getAnimations =\n createSpy2<HTMLAudioElement['getAnimations']>('getAnimations')\n after = createSpy2<HTMLAudioElement['after']>('after')\n before = createSpy2<HTMLAudioElement['before']>('before')\n remove = createSpy2<HTMLAudioElement['remove']>('remove')\n replaceWith = createSpy2<HTMLAudioElement['replaceWith']>('replaceWith')\n append = createSpy2<HTMLAudioElement['append']>('append')\n prepend = createSpy2<HTMLAudioElement['prepend']>('prepend')\n querySelector =\n createSpy2<HTMLAudioElement['querySelector']>('querySelector')\n querySelectorAll =\n createSpy2<HTMLAudioElement['querySelectorAll']>('querySelectorAll')\n replaceChildren =\n createSpy2<HTMLAudioElement['replaceChildren']>('replaceChildren')\n dispatchEvent =\n createSpy2<HTMLAudioElement['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockHTMLDivElement implements HTMLDivElement {\n align: string = ''\n accessKey: string = ''\n accessKeyLabel: string = ''\n autocapitalize: string = ''\n autocorrect: boolean = false\n dir: string = ''\n draggable: boolean = false\n hidden: boolean = false\n inert: boolean = false\n innerText: string = ''\n lang: string = ''\n offsetHeight: number = 0\n offsetLeft: number = 0\n offsetParent: Element | null = null\n offsetTop: number = 0\n offsetWidth: number = 0\n outerText: string = ''\n popover: string | null = ''\n spellcheck: boolean = false\n title: string = ''\n translate: boolean = false\n writingSuggestions: string = ''\n attributes: NamedNodeMap = undefined as any\n className: string = ''\n clientHeight: number = 0\n clientLeft: number = 0\n clientTop: number = 0\n clientWidth: number = 0\n currentCSSZoom: number = 0\n id: string = ''\n innerHTML: string = ''\n localName: string = ''\n namespaceURI: string | null = ''\n onfullscreenchange: ((this: Element, ev: Event) => any) | null = null\n onfullscreenerror: ((this: Element, ev: Event) => any) | null = null\n outerHTML: string = ''\n ownerDocument: Document = undefined as any\n prefix: string | null = ''\n scrollHeight: number = 0\n scrollLeft: number = 0\n scrollTop: number = 0\n scrollWidth: number = 0\n shadowRoot: ShadowRoot | null = null\n slot: string = ''\n tagName: string = ''\n classList: any = undefined\n part: any = undefined\n textContent: any = undefined\n attributeStyleMap: StylePropertyMap = undefined as any\n style: any = undefined\n contentEditable: string = ''\n enterKeyHint: string = ''\n inputMode: string = ''\n isContentEditable: boolean = false\n onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onanimationcancel:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationend:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationiteration:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationstart:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null =\n null\n onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onbeforetoggle:\n | ((this: GlobalEventHandlers, ev: ToggleEvent) => any)\n | null = null\n onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextmenu:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onended: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onerror: OnErrorEventHandler = undefined as any\n onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null =\n null\n ongotpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onlostpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onpointercancel:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerdown:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerenter:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerleave:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointermove:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerout:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerover:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null =\n null\n onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsecuritypolicyviolation:\n | ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any)\n | null = null\n onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null =\n null\n onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null =\n null\n ontransitioncancel:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionend:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionrun:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionstart:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onwebkitanimationend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationiteration:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationstart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkittransitionend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null = null\n autofocus: boolean = false\n dataset: DOMStringMap = undefined as any\n tabIndex: number = 0\n baseURI: string = ''\n childNodes: NodeListOf<ChildNode> = undefined as any\n firstChild: ChildNode | null = null\n isConnected: boolean = false\n lastChild: ChildNode | null = null\n nextSibling: ChildNode | null = null\n nodeName: string = ''\n nodeType: number = 0\n nodeValue: string | null = ''\n parentElement: HTMLElement | null = null\n parentNode: ParentNode | null = null\n previousSibling: ChildNode | null = null\n ELEMENT_NODE: 1 = 1\n ATTRIBUTE_NODE: 2 = 2\n TEXT_NODE: 3 = 3\n CDATA_SECTION_NODE: 4 = 4\n ENTITY_REFERENCE_NODE: 5 = 5\n ENTITY_NODE: 6 = 6\n PROCESSING_INSTRUCTION_NODE: 7 = 7\n COMMENT_NODE: 8 = 8\n DOCUMENT_NODE: 9 = 9\n DOCUMENT_TYPE_NODE: 10 = 10\n DOCUMENT_FRAGMENT_NODE: 11 = 11\n NOTATION_NODE: 12 = 12\n DOCUMENT_POSITION_DISCONNECTED: 0x01 = 1\n DOCUMENT_POSITION_PRECEDING: 0x02 = 2\n DOCUMENT_POSITION_FOLLOWING: 0x04 = 4\n DOCUMENT_POSITION_CONTAINS: 0x08 = 8\n DOCUMENT_POSITION_CONTAINED_BY: 0x10 = 16\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 = 32\n ariaActiveDescendantElement: Element | null = null\n ariaAtomic: string | null = ''\n ariaAutoComplete: string | null = ''\n ariaBrailleLabel: string | null = ''\n ariaBrailleRoleDescription: string | null = ''\n ariaBusy: string | null = ''\n ariaChecked: string | null = ''\n ariaColCount: string | null = ''\n ariaColIndex: string | null = ''\n ariaColIndexText: string | null = ''\n ariaColSpan: string | null = ''\n ariaControlsElements: ReadonlyArray<Element> | null = null\n ariaCurrent: string | null = ''\n ariaDescribedByElements: ReadonlyArray<Element> | null = null\n ariaDescription: string | null = ''\n ariaDetailsElements: ReadonlyArray<Element> | null = null\n ariaDisabled: string | null = ''\n ariaErrorMessageElements: ReadonlyArray<Element> | null = null\n ariaExpanded: string | null = ''\n ariaFlowToElements: ReadonlyArray<Element> | null = null\n ariaHasPopup: string | null = ''\n ariaHidden: string | null = ''\n ariaInvalid: string | null = ''\n ariaKeyShortcuts: string | null = ''\n ariaLabel: string | null = ''\n ariaLabelledByElements: ReadonlyArray<Element> | null = null\n ariaLevel: string | null = ''\n ariaLive: string | null = ''\n ariaModal: string | null = ''\n ariaMultiLine: string | null = ''\n ariaMultiSelectable: string | null = ''\n ariaOrientation: string | null = ''\n ariaOwnsElements: ReadonlyArray<Element> | null = null\n ariaPlaceholder: string | null = ''\n ariaPosInSet: string | null = ''\n ariaPressed: string | null = ''\n ariaReadOnly: string | null = ''\n ariaRelevant: string | null = ''\n ariaRequired: string | null = ''\n ariaRoleDescription: string | null = ''\n ariaRowCount: string | null = ''\n ariaRowIndex: string | null = ''\n ariaRowIndexText: string | null = ''\n ariaRowSpan: string | null = ''\n ariaSelected: string | null = ''\n ariaSetSize: string | null = ''\n ariaSort: string | null = ''\n ariaValueMax: string | null = ''\n ariaValueMin: string | null = ''\n ariaValueNow: string | null = ''\n ariaValueText: string | null = ''\n role: string | null = ''\n nextElementSibling: Element | null = null\n previousElementSibling: Element | null = null\n childElementCount: number = 0\n children: HTMLCollection = undefined as any\n firstElementChild: Element | null = null\n lastElementChild: Element | null = null\n assignedSlot: HTMLSlotElement | null = null\n\n addEventListener =\n createSpy2<HTMLDivElement['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<HTMLDivElement['removeEventListener']>(\n 'removeEventListener'\n )\n attachInternals =\n createSpy2<HTMLDivElement['attachInternals']>('attachInternals')\n click = createSpy2<HTMLDivElement['click']>('click')\n hidePopover = createSpy2<HTMLDivElement['hidePopover']>('hidePopover')\n showPopover = createSpy2<HTMLDivElement['showPopover']>('showPopover')\n togglePopover = createSpy2<HTMLDivElement['togglePopover']>('togglePopover')\n attachShadow = createSpy2<HTMLDivElement['attachShadow']>('attachShadow')\n checkVisibility =\n createSpy2<HTMLDivElement['checkVisibility']>('checkVisibility')\n closest = createSpy2<HTMLDivElement['closest']>('closest')\n computedStyleMap =\n createSpy2<HTMLDivElement['computedStyleMap']>('computedStyleMap')\n getAttribute = createSpy2<HTMLDivElement['getAttribute']>('getAttribute')\n getAttributeNS =\n createSpy2<HTMLDivElement['getAttributeNS']>('getAttributeNS')\n getAttributeNames =\n createSpy2<HTMLDivElement['getAttributeNames']>('getAttributeNames')\n getAttributeNode =\n createSpy2<HTMLDivElement['getAttributeNode']>('getAttributeNode')\n getAttributeNodeNS =\n createSpy2<HTMLDivElement['getAttributeNodeNS']>('getAttributeNodeNS')\n getBoundingClientRect = createSpy2<HTMLDivElement['getBoundingClientRect']>(\n 'getBoundingClientRect'\n )\n getClientRects =\n createSpy2<HTMLDivElement['getClientRects']>('getClientRects')\n getElementsByClassName = createSpy2<\n HTMLDivElement['getElementsByClassName']\n >('getElementsByClassName')\n getElementsByTagName = createSpy2<HTMLDivElement['getElementsByTagName']>(\n 'getElementsByTagName'\n )\n getElementsByTagNameNS = createSpy2<\n HTMLDivElement['getElementsByTagNameNS']\n >('getElementsByTagNameNS')\n getHTML = createSpy2<HTMLDivElement['getHTML']>('getHTML')\n hasAttribute = createSpy2<HTMLDivElement['hasAttribute']>('hasAttribute')\n hasAttributeNS =\n createSpy2<HTMLDivElement['hasAttributeNS']>('hasAttributeNS')\n hasAttributes = createSpy2<HTMLDivElement['hasAttributes']>('hasAttributes')\n hasPointerCapture =\n createSpy2<HTMLDivElement['hasPointerCapture']>('hasPointerCapture')\n insertAdjacentElement = createSpy2<HTMLDivElement['insertAdjacentElement']>(\n 'insertAdjacentElement'\n )\n insertAdjacentHTML =\n createSpy2<HTMLDivElement['insertAdjacentHTML']>('insertAdjacentHTML')\n insertAdjacentText =\n createSpy2<HTMLDivElement['insertAdjacentText']>('insertAdjacentText')\n matches = createSpy2<HTMLDivElement['matches']>('matches')\n releasePointerCapture = createSpy2<HTMLDivElement['releasePointerCapture']>(\n 'releasePointerCapture'\n )\n removeAttribute =\n createSpy2<HTMLDivElement['removeAttribute']>('removeAttribute')\n removeAttributeNS =\n createSpy2<HTMLDivElement['removeAttributeNS']>('removeAttributeNS')\n removeAttributeNode = createSpy2<HTMLDivElement['removeAttributeNode']>(\n 'removeAttributeNode'\n )\n requestFullscreen =\n createSpy2<HTMLDivElement['requestFullscreen']>('requestFullscreen')\n requestPointerLock =\n createSpy2<HTMLDivElement['requestPointerLock']>('requestPointerLock')\n scroll = createSpy2<HTMLDivElement['scroll']>('scroll')\n scrollBy = createSpy2<HTMLDivElement['scrollBy']>('scrollBy')\n scrollIntoView =\n createSpy2<HTMLDivElement['scrollIntoView']>('scrollIntoView')\n scrollTo = createSpy2<HTMLDivElement['scrollTo']>('scrollTo')\n setAttribute = createSpy2<HTMLDivElement['setAttribute']>('setAttribute')\n setAttributeNS =\n createSpy2<HTMLDivElement['setAttributeNS']>('setAttributeNS')\n setAttributeNode =\n createSpy2<HTMLDivElement['setAttributeNode']>('setAttributeNode')\n setAttributeNodeNS =\n createSpy2<HTMLDivElement['setAttributeNodeNS']>('setAttributeNodeNS')\n setHTMLUnsafe = createSpy2<HTMLDivElement['setHTMLUnsafe']>('setHTMLUnsafe')\n setPointerCapture =\n createSpy2<HTMLDivElement['setPointerCapture']>('setPointerCapture')\n toggleAttribute =\n createSpy2<HTMLDivElement['toggleAttribute']>('toggleAttribute')\n webkitMatchesSelector = createSpy2<HTMLDivElement['webkitMatchesSelector']>(\n 'webkitMatchesSelector'\n )\n blur = createSpy2<HTMLDivElement['blur']>('blur')\n focus = createSpy2<HTMLDivElement['focus']>('focus')\n appendChild = createSpy2<HTMLDivElement['appendChild']>('appendChild')\n cloneNode = createSpy2<HTMLDivElement['cloneNode']>('cloneNode')\n compareDocumentPosition = createSpy2<\n HTMLDivElement['compareDocumentPosition']\n >('compareDocumentPosition')\n contains = createSpy2<HTMLDivElement['contains']>('contains')\n getRootNode = createSpy2<HTMLDivElement['getRootNode']>('getRootNode')\n hasChildNodes = createSpy2<HTMLDivElement['hasChildNodes']>('hasChildNodes')\n insertBefore = createSpy2<HTMLDivElement['insertBefore']>('insertBefore')\n isDefaultNamespace =\n createSpy2<HTMLDivElement['isDefaultNamespace']>('isDefaultNamespace')\n isEqualNode = createSpy2<HTMLDivElement['isEqualNode']>('isEqualNode')\n isSameNode = createSpy2<HTMLDivElement['isSameNode']>('isSameNode')\n lookupNamespaceURI =\n createSpy2<HTMLDivElement['lookupNamespaceURI']>('lookupNamespaceURI')\n lookupPrefix = createSpy2<HTMLDivElement['lookupPrefix']>('lookupPrefix')\n normalize = createSpy2<HTMLDivElement['normalize']>('normalize')\n removeChild = createSpy2<HTMLDivElement['removeChild']>('removeChild')\n replaceChild = createSpy2<HTMLDivElement['replaceChild']>('replaceChild')\n animate = createSpy2<HTMLDivElement['animate']>('animate')\n getAnimations = createSpy2<HTMLDivElement['getAnimations']>('getAnimations')\n after = createSpy2<HTMLDivElement['after']>('after')\n before = createSpy2<HTMLDivElement['before']>('before')\n remove = createSpy2<HTMLDivElement['remove']>('remove')\n replaceWith = createSpy2<HTMLDivElement['replaceWith']>('replaceWith')\n append = createSpy2<HTMLDivElement['append']>('append')\n prepend = createSpy2<HTMLDivElement['prepend']>('prepend')\n querySelector = createSpy2<HTMLDivElement['querySelector']>('querySelector')\n querySelectorAll =\n createSpy2<HTMLDivElement['querySelectorAll']>('querySelectorAll')\n replaceChildren =\n createSpy2<HTMLDivElement['replaceChildren']>('replaceChildren')\n dispatchEvent = createSpy2<HTMLDivElement['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockHTMLMediaElement implements HTMLMediaElement {\n autoplay: boolean = false\n buffered: TimeRanges = undefined as any\n controls: boolean = false\n crossOrigin: string | null = ''\n currentSrc: string = ''\n currentTime: number = 0\n defaultMuted: boolean = false\n defaultPlaybackRate: number = 0\n disableRemotePlayback: boolean = false\n duration: number = 0\n ended: boolean = false\n error: MediaError | null = null\n loop: boolean = false\n mediaKeys: MediaKeys | null = null\n muted: boolean = false\n networkState: number = 0\n onencrypted:\n | ((this: HTMLMediaElement, ev: MediaEncryptedEvent) => any)\n | null = null\n onwaitingforkey: ((this: HTMLMediaElement, ev: Event) => any) | null = null\n paused: boolean = false\n playbackRate: number = 0\n played: TimeRanges = undefined as any\n preload: 'none' | 'metadata' | 'auto' | '' = 'none'\n preservesPitch: boolean = false\n readyState: number = 0\n remote: RemotePlayback = undefined as any\n seekable: TimeRanges = undefined as any\n seeking: boolean = false\n sinkId: string = ''\n src: string = ''\n srcObject: MediaProvider | null = undefined as any\n textTracks: TextTrackList = undefined as any\n volume: number = 0\n NETWORK_EMPTY: 0 = 0\n NETWORK_IDLE: 1 = 1\n NETWORK_LOADING: 2 = 2\n NETWORK_NO_SOURCE: 3 = 3\n HAVE_NOTHING: 0 = 0\n HAVE_METADATA: 1 = 1\n HAVE_CURRENT_DATA: 2 = 2\n HAVE_FUTURE_DATA: 3 = 3\n HAVE_ENOUGH_DATA: 4 = 4\n accessKey: string = ''\n accessKeyLabel: string = ''\n autocapitalize: string = ''\n autocorrect: boolean = false\n dir: string = ''\n draggable: boolean = false\n hidden: boolean = false\n inert: boolean = false\n innerText: string = ''\n lang: string = ''\n offsetHeight: number = 0\n offsetLeft: number = 0\n offsetParent: Element | null = null\n offsetTop: number = 0\n offsetWidth: number = 0\n outerText: string = ''\n popover: string | null = ''\n spellcheck: boolean = false\n title: string = ''\n translate: boolean = false\n writingSuggestions: string = ''\n attributes: NamedNodeMap = undefined as any\n className: string = ''\n clientHeight: number = 0\n clientLeft: number = 0\n clientTop: number = 0\n clientWidth: number = 0\n currentCSSZoom: number = 0\n id: string = ''\n innerHTML: string = ''\n localName: string = ''\n namespaceURI: string | null = ''\n onfullscreenchange: ((this: Element, ev: Event) => any) | null = null\n onfullscreenerror: ((this: Element, ev: Event) => any) | null = null\n outerHTML: string = ''\n ownerDocument: Document = undefined as any\n prefix: string | null = ''\n scrollHeight: number = 0\n scrollLeft: number = 0\n scrollTop: number = 0\n scrollWidth: number = 0\n shadowRoot: ShadowRoot | null = null\n slot: string = ''\n tagName: string = ''\n classList: any = undefined\n part: any = undefined\n textContent: any = undefined\n attributeStyleMap: StylePropertyMap = undefined as any\n style: any = undefined\n contentEditable: string = ''\n enterKeyHint: string = ''\n inputMode: string = ''\n isContentEditable: boolean = false\n onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onanimationcancel:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationend:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationiteration:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onanimationstart:\n | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)\n | null = null\n onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null =\n null\n onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onbeforetoggle:\n | ((this: GlobalEventHandlers, ev: ToggleEvent) => any)\n | null = null\n onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncontextmenu:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null =\n null\n ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null = null\n ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onended: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onerror: OnErrorEventHandler = undefined as any\n onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null = null\n onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null =\n null\n ongotpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null =\n null\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onlostpointercapture:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null =\n null\n onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null =\n null\n onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onpointercancel:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerdown:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerenter:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerleave:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointermove:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerout:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerover:\n | ((this: GlobalEventHandlers, ev: PointerEvent) => any)\n | null = null\n onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null =\n null\n onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null =\n null\n onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null = null\n onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsecuritypolicyviolation:\n | ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any)\n | null = null\n onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null =\n null\n onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null =\n null\n ontransitioncancel:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionend:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionrun:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n ontransitionstart:\n | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)\n | null = null\n onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null =\n null\n onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null = null\n onwebkitanimationend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationiteration:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkitanimationstart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwebkittransitionend:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = null\n onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null = null\n autofocus: boolean = false\n dataset: DOMStringMap = undefined as any\n tabIndex: number = 0\n baseURI: string = ''\n childNodes: NodeListOf<ChildNode> = undefined as any\n firstChild: ChildNode | null = null\n isConnected: boolean = false\n lastChild: ChildNode | null = null\n nextSibling: ChildNode | null = null\n nodeName: string = ''\n nodeType: number = 0\n nodeValue: string | null = ''\n parentElement: HTMLElement | null = null\n parentNode: ParentNode | null = null\n previousSibling: ChildNode | null = null\n ELEMENT_NODE: 1 = 1\n ATTRIBUTE_NODE: 2 = 2\n TEXT_NODE: 3 = 3\n CDATA_SECTION_NODE: 4 = 4\n ENTITY_REFERENCE_NODE: 5 = 5\n ENTITY_NODE: 6 = 6\n PROCESSING_INSTRUCTION_NODE: 7 = 7\n COMMENT_NODE: 8 = 8\n DOCUMENT_NODE: 9 = 9\n DOCUMENT_TYPE_NODE: 10 = 10\n DOCUMENT_FRAGMENT_NODE: 11 = 11\n NOTATION_NODE: 12 = 12\n DOCUMENT_POSITION_DISCONNECTED: 0x01 = 1\n DOCUMENT_POSITION_PRECEDING: 0x02 = 2\n DOCUMENT_POSITION_FOLLOWING: 0x04 = 4\n DOCUMENT_POSITION_CONTAINS: 0x08 = 8\n DOCUMENT_POSITION_CONTAINED_BY: 0x10 = 16\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 = 32\n ariaActiveDescendantElement: Element | null = null\n ariaAtomic: string | null = ''\n ariaAutoComplete: string | null = ''\n ariaBrailleLabel: string | null = ''\n ariaBrailleRoleDescription: string | null = ''\n ariaBusy: string | null = ''\n ariaChecked: string | null = ''\n ariaColCount: string | null = ''\n ariaColIndex: string | null = ''\n ariaColIndexText: string | null = ''\n ariaColSpan: string | null = ''\n ariaControlsElements: ReadonlyArray<Element> | null = null\n ariaCurrent: string | null = ''\n ariaDescribedByElements: ReadonlyArray<Element> | null = null\n ariaDescription: string | null = ''\n ariaDetailsElements: ReadonlyArray<Element> | null = null\n ariaDisabled: string | null = ''\n ariaErrorMessageElements: ReadonlyArray<Element> | null = null\n ariaExpanded: string | null = ''\n ariaFlowToElements: ReadonlyArray<Element> | null = null\n ariaHasPopup: string | null = ''\n ariaHidden: string | null = ''\n ariaInvalid: string | null = ''\n ariaKeyShortcuts: string | null = ''\n ariaLabel: string | null = ''\n ariaLabelledByElements: ReadonlyArray<Element> | null = null\n ariaLevel: string | null = ''\n ariaLive: string | null = ''\n ariaModal: string | null = ''\n ariaMultiLine: string | null = ''\n ariaMultiSelectable: string | null = ''\n ariaOrientation: string | null = ''\n ariaOwnsElements: ReadonlyArray<Element> | null = null\n ariaPlaceholder: string | null = ''\n ariaPosInSet: string | null = ''\n ariaPressed: string | null = ''\n ariaReadOnly: string | null = ''\n ariaRelevant: string | null = ''\n ariaRequired: string | null = ''\n ariaRoleDescription: string | null = ''\n ariaRowCount: string | null = ''\n ariaRowIndex: string | null = ''\n ariaRowIndexText: string | null = ''\n ariaRowSpan: string | null = ''\n ariaSelected: string | null = ''\n ariaSetSize: string | null = ''\n ariaSort: string | null = ''\n ariaValueMax: string | null = ''\n ariaValueMin: string | null = ''\n ariaValueNow: string | null = ''\n ariaValueText: string | null = ''\n role: string | null = ''\n nextElementSibling: Element | null = null\n previousElementSibling: Element | null = null\n childElementCount: number = 0\n children: HTMLCollection = undefined as any\n firstElementChild: Element | null = null\n lastElementChild: Element | null = null\n assignedSlot: HTMLSlotElement | null = null\n\n addTextTrack = createSpy2<HTMLMediaElement['addTextTrack']>('addTextTrack')\n canPlayType = createSpy2<HTMLMediaElement['canPlayType']>('canPlayType')\n fastSeek = createSpy2<HTMLMediaElement['fastSeek']>('fastSeek')\n load = createSpy2<HTMLMediaElement['load']>('load')\n pause = createSpy2<HTMLMediaElement['pause']>('pause')\n play = createSpy2<HTMLMediaElement['play']>('play')\n setMediaKeys = createSpy2<HTMLMediaElement['setMediaKeys']>('setMediaKeys')\n setSinkId = createSpy2<HTMLMediaElement['setSinkId']>('setSinkId')\n addEventListener =\n createSpy2<HTMLMediaElement['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<HTMLMediaElement['removeEventListener']>(\n 'removeEventListener'\n )\n attachInternals =\n createSpy2<HTMLMediaElement['attachInternals']>('attachInternals')\n click = createSpy2<HTMLMediaElement['click']>('click')\n hidePopover = createSpy2<HTMLMediaElement['hidePopover']>('hidePopover')\n showPopover = createSpy2<HTMLMediaElement['showPopover']>('showPopover')\n togglePopover =\n createSpy2<HTMLMediaElement['togglePopover']>('togglePopover')\n attachShadow = createSpy2<HTMLMediaElement['attachShadow']>('attachShadow')\n checkVisibility =\n createSpy2<HTMLMediaElement['checkVisibility']>('checkVisibility')\n closest = createSpy2<HTMLMediaElement['closest']>('closest')\n computedStyleMap =\n createSpy2<HTMLMediaElement['computedStyleMap']>('computedStyleMap')\n getAttribute = createSpy2<HTMLMediaElement['getAttribute']>('getAttribute')\n getAttributeNS =\n createSpy2<HTMLMediaElement['getAttributeNS']>('getAttributeNS')\n getAttributeNames =\n createSpy2<HTMLMediaElement['getAttributeNames']>('getAttributeNames')\n getAttributeNode =\n createSpy2<HTMLMediaElement['getAttributeNode']>('getAttributeNode')\n getAttributeNodeNS =\n createSpy2<HTMLMediaElement['getAttributeNodeNS']>('getAttributeNodeNS')\n getBoundingClientRect = createSpy2<\n HTMLMediaElement['getBoundingClientRect']\n >('getBoundingClientRect')\n getClientRects =\n createSpy2<HTMLMediaElement['getClientRects']>('getClientRects')\n getElementsByClassName = createSpy2<\n HTMLMediaElement['getElementsByClassName']\n >('getElementsByClassName')\n getElementsByTagName = createSpy2<HTMLMediaElement['getElementsByTagName']>(\n 'getElementsByTagName'\n )\n getElementsByTagNameNS = createSpy2<\n HTMLMediaElement['getElementsByTagNameNS']\n >('getElementsByTagNameNS')\n getHTML = createSpy2<HTMLMediaElement['getHTML']>('getHTML')\n hasAttribute = createSpy2<HTMLMediaElement['hasAttribute']>('hasAttribute')\n hasAttributeNS =\n createSpy2<HTMLMediaElement['hasAttributeNS']>('hasAttributeNS')\n hasAttributes =\n createSpy2<HTMLMediaElement['hasAttributes']>('hasAttributes')\n hasPointerCapture =\n createSpy2<HTMLMediaElement['hasPointerCapture']>('hasPointerCapture')\n insertAdjacentElement = createSpy2<\n HTMLMediaElement['insertAdjacentElement']\n >('insertAdjacentElement')\n insertAdjacentHTML =\n createSpy2<HTMLMediaElement['insertAdjacentHTML']>('insertAdjacentHTML')\n insertAdjacentText =\n createSpy2<HTMLMediaElement['insertAdjacentText']>('insertAdjacentText')\n matches = createSpy2<HTMLMediaElement['matches']>('matches')\n releasePointerCapture = createSpy2<\n HTMLMediaElement['releasePointerCapture']\n >('releasePointerCapture')\n removeAttribute =\n createSpy2<HTMLMediaElement['removeAttribute']>('removeAttribute')\n removeAttributeNS =\n createSpy2<HTMLMediaElement['removeAttributeNS']>('removeAttributeNS')\n removeAttributeNode = createSpy2<HTMLMediaElement['removeAttributeNode']>(\n 'removeAttributeNode'\n )\n requestFullscreen =\n createSpy2<HTMLMediaElement['requestFullscreen']>('requestFullscreen')\n requestPointerLock =\n createSpy2<HTMLMediaElement['requestPointerLock']>('requestPointerLock')\n scroll = createSpy2<HTMLMediaElement['scroll']>('scroll')\n scrollBy = createSpy2<HTMLMediaElement['scrollBy']>('scrollBy')\n scrollIntoView =\n createSpy2<HTMLMediaElement['scrollIntoView']>('scrollIntoView')\n scrollTo = createSpy2<HTMLMediaElement['scrollTo']>('scrollTo')\n setAttribute = createSpy2<HTMLMediaElement['setAttribute']>('setAttribute')\n setAttributeNS =\n createSpy2<HTMLMediaElement['setAttributeNS']>('setAttributeNS')\n setAttributeNode =\n createSpy2<HTMLMediaElement['setAttributeNode']>('setAttributeNode')\n setAttributeNodeNS =\n createSpy2<HTMLMediaElement['setAttributeNodeNS']>('setAttributeNodeNS')\n setHTMLUnsafe =\n createSpy2<HTMLMediaElement['setHTMLUnsafe']>('setHTMLUnsafe')\n setPointerCapture =\n createSpy2<HTMLMediaElement['setPointerCapture']>('setPointerCapture')\n toggleAttribute =\n createSpy2<HTMLMediaElement['toggleAttribute']>('toggleAttribute')\n webkitMatchesSelector = createSpy2<\n HTMLMediaElement['webkitMatchesSelector']\n >('webkitMatchesSelector')\n blur = createSpy2<HTMLMediaElement['blur']>('blur')\n focus = createSpy2<HTMLMediaElement['focus']>('focus')\n appendChild = createSpy2<HTMLMediaElement['appendChild']>('appendChild')\n cloneNode = createSpy2<HTMLMediaElement['cloneNode']>('cloneNode')\n compareDocumentPosition = createSpy2<\n HTMLMediaElement['compareDocumentPosition']\n >('compareDocumentPosition')\n contains = createSpy2<HTMLMediaElement['contains']>('contains')\n getRootNode = createSpy2<HTMLMediaElement['getRootNode']>('getRootNode')\n hasChildNodes =\n createSpy2<HTMLMediaElement['hasChildNodes']>('hasChildNodes')\n insertBefore = createSpy2<HTMLMediaElement['insertBefore']>('insertBefore')\n isDefaultNamespace =\n createSpy2<HTMLMediaElement['isDefaultNamespace']>('isDefaultNamespace')\n isEqualNode = createSpy2<HTMLMediaElement['isEqualNode']>('isEqualNode')\n isSameNode = createSpy2<HTMLMediaElement['isSameNode']>('isSameNode')\n lookupNamespaceURI =\n createSpy2<HTMLMediaElement['lookupNamespaceURI']>('lookupNamespaceURI')\n lookupPrefix = createSpy2<HTMLMediaElement['lookupPrefix']>('lookupPrefix')\n normalize = createSpy2<HTMLMediaElement['normalize']>('normalize')\n removeChild = createSpy2<HTMLMediaElement['removeChild']>('removeChild')\n replaceChild = createSpy2<HTMLMediaElement['replaceChild']>('replaceChild')\n animate = createSpy2<HTMLMediaElement['animate']>('animate')\n getAnimations =\n createSpy2<HTMLMediaElement['getAnimations']>('getAnimations')\n after = createSpy2<HTMLMediaElement['after']>('after')\n before = createSpy2<HTMLMediaElement['before']>('before')\n remove = createSpy2<HTMLMediaElement['remove']>('remove')\n replaceWith = createSpy2<HTMLMediaElement['replaceWith']>('replaceWith')\n append = createSpy2<HTMLMediaElement['append']>('append')\n prepend = createSpy2<HTMLMediaElement['prepend']>('prepend')\n querySelector =\n createSpy2<HTMLMediaElement['querySelector']>('querySelector')\n querySelectorAll =\n createSpy2<HTMLMediaElement['querySelectorAll']>('querySelectorAll')\n replaceChildren =\n createSpy2<HTMLMediaElement['replaceChildren']>('replaceChildren')\n dispatchEvent =\n createSpy2<HTMLMediaElement['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockMediaError implements MediaError {\n code: number = 0\n message: string = ''\n MEDIA_ERR_ABORTED: 1 = 1\n MEDIA_ERR_NETWORK: 2 = 2\n MEDIA_ERR_DECODE: 3 = 3\n MEDIA_ERR_SRC_NOT_SUPPORTED: 4 = 4\n}\n\nexport class MockMediaKeyMessageEvent implements MediaKeyMessageEvent {\n message: ArrayBuffer = new ArrayBuffer(0)\n messageType: MediaKeyMessageType = 'individualization-request'\n bubbles: boolean = false\n cancelBubble: boolean = false\n cancelable: boolean = false\n composed: boolean = false\n currentTarget: EventTarget | null = null\n defaultPrevented: boolean = false\n eventPhase: number = 0\n isTrusted: boolean = false\n returnValue: boolean = false\n srcElement: EventTarget | null = null\n target: EventTarget | null = null\n timeStamp: DOMHighResTimeStamp = 0\n type: string = ''\n NONE: 0 = 0\n CAPTURING_PHASE: 1 = 1\n AT_TARGET: 2 = 2\n BUBBLING_PHASE: 3 = 3\n\n composedPath =\n createSpy2<MediaKeyMessageEvent['composedPath']>('composedPath')\n initEvent = createSpy2<MediaKeyMessageEvent['initEvent']>('initEvent')\n preventDefault =\n createSpy2<MediaKeyMessageEvent['preventDefault']>('preventDefault')\n stopImmediatePropagation = createSpy2<\n MediaKeyMessageEvent['stopImmediatePropagation']\n >('stopImmediatePropagation')\n stopPropagation =\n createSpy2<MediaKeyMessageEvent['stopPropagation']>('stopPropagation')\n}\n\nexport class MockMediaKeySession implements MediaKeySession {\n closed: Promise<MediaKeySessionClosedReason> = undefined as any\n expiration: number = 0\n keyStatuses: MediaKeyStatusMap = undefined as any\n onkeystatuseschange: ((this: MediaKeySession, ev: Event) => any) | null =\n null\n onmessage:\n | ((this: MediaKeySession, ev: MediaKeyMessageEvent) => any)\n | null = null\n sessionId: string = ''\n\n close = createSpy2<MediaKeySession['close']>('close')\n generateRequest =\n createSpy2<MediaKeySession['generateRequest']>('generateRequest')\n load = createSpy2<MediaKeySession['load']>('load')\n remove = createSpy2<MediaKeySession['remove']>('remove')\n update = createSpy2<MediaKeySession['update']>('update')\n addEventListener =\n createSpy2<MediaKeySession['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<MediaKeySession['removeEventListener']>(\n 'removeEventListener'\n )\n dispatchEvent =\n createSpy2<MediaKeySession['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockMediaKeySystemAccess implements MediaKeySystemAccess {\n keySystem: string = ''\n\n createMediaKeys =\n createSpy2<MediaKeySystemAccess['createMediaKeys']>('createMediaKeys')\n getConfiguration =\n createSpy2<MediaKeySystemAccess['getConfiguration']>('getConfiguration')\n}\n\nexport class MockMediaKeys implements MediaKeys {\n createSession = createSpy2<MediaKeys['createSession']>('createSession')\n getStatusForPolicy =\n createSpy2<MediaKeys['getStatusForPolicy']>('getStatusForPolicy')\n setServerCertificate = createSpy2<MediaKeys['setServerCertificate']>(\n 'setServerCertificate'\n )\n}\n\nexport class MockMediaSource implements MediaSource {\n activeSourceBuffers: SourceBufferList = undefined as any\n duration: number = 0\n onsourceclose: ((this: MediaSource, ev: Event) => any) | null = null\n onsourceended: ((this: MediaSource, ev: Event) => any) | null = null\n onsourceopen: ((this: MediaSource, ev: Event) => any) | null = null\n readyState: ReadyState = 'closed'\n sourceBuffers: SourceBufferList = undefined as any\n\n addSourceBuffer =\n createSpy2<MediaSource['addSourceBuffer']>('addSourceBuffer')\n clearLiveSeekableRange = createSpy2<MediaSource['clearLiveSeekableRange']>(\n 'clearLiveSeekableRange'\n )\n endOfStream = createSpy2<MediaSource['endOfStream']>('endOfStream')\n removeSourceBuffer =\n createSpy2<MediaSource['removeSourceBuffer']>('removeSourceBuffer')\n setLiveSeekableRange = createSpy2<MediaSource['setLiveSeekableRange']>(\n 'setLiveSeekableRange'\n )\n addEventListener =\n createSpy2<MediaSource['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<MediaSource['removeEventListener']>(\n 'removeEventListener'\n )\n dispatchEvent = createSpy2<MediaSource['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockMediaStream implements MediaStream {\n active: boolean = false\n id: string = ''\n onaddtrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null =\n null\n onremovetrack:\n | ((this: MediaStream, ev: MediaStreamTrackEvent) => any)\n | null = null\n\n addTrack = createSpy2<MediaStream['addTrack']>('addTrack')\n clone = createSpy2<MediaStream['clone']>('clone')\n getAudioTracks = createSpy2<MediaStream['getAudioTracks']>('getAudioTracks')\n getTrackById = createSpy2<MediaStream['getTrackById']>('getTrackById')\n getTracks = createSpy2<MediaStream['getTracks']>('getTracks')\n getVideoTracks = createSpy2<MediaStream['getVideoTracks']>('getVideoTracks')\n removeTrack = createSpy2<MediaStream['removeTrack']>('removeTrack')\n addEventListener =\n createSpy2<MediaStream['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<MediaStream['removeEventListener']>(\n 'removeEventListener'\n )\n dispatchEvent = createSpy2<MediaStream['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockNavigator implements Navigator {\n clipboard: Clipboard = undefined as any\n credentials: CredentialsContainer = undefined as any\n doNotTrack: string | null = ''\n geolocation: Geolocation = undefined as any\n login: NavigatorLogin = undefined as any\n maxTouchPoints: number = 0\n mediaCapabilities: MediaCapabilities = undefined as any\n mediaDevices: MediaDevices = undefined as any\n mediaSession: MediaSession = undefined as any\n permissions: Permissions = undefined as any\n serviceWorker: ServiceWorkerContainer = undefined as any\n userActivation: UserActivation = undefined as any\n wakeLock: WakeLock = undefined as any\n webdriver: boolean = false\n hardwareConcurrency: number = 0\n cookieEnabled: boolean = false\n appCodeName: string = ''\n appName: string = ''\n appVersion: string = ''\n platform: string = ''\n product: string = ''\n productSub: string = ''\n userAgent: string = ''\n vendor: string = ''\n vendorSub: string = ''\n language: string = ''\n languages: ReadonlyArray<string> = []\n locks: LockManager = undefined as any\n onLine: boolean = false\n mimeTypes: MimeTypeArray = undefined as any\n pdfViewerEnabled: boolean = false\n plugins: PluginArray = undefined as any\n storage: StorageManager = undefined as any\n\n canShare = createSpy2<Navigator['canShare']>('canShare')\n getGamepads = createSpy2<Navigator['getGamepads']>('getGamepads')\n requestMIDIAccess =\n createSpy2<Navigator['requestMIDIAccess']>('requestMIDIAccess')\n requestMediaKeySystemAccess = createSpy2<\n Navigator['requestMediaKeySystemAccess']\n >('requestMediaKeySystemAccess')\n sendBeacon = createSpy2<Navigator['sendBeacon']>('sendBeacon')\n share = createSpy2<Navigator['share']>('share')\n vibrate = createSpy2<Navigator['vibrate']>('vibrate')\n clearAppBadge = createSpy2<Navigator['clearAppBadge']>('clearAppBadge')\n setAppBadge = createSpy2<Navigator['setAppBadge']>('setAppBadge')\n registerProtocolHandler = createSpy2<Navigator['registerProtocolHandler']>(\n 'registerProtocolHandler'\n )\n javaEnabled = createSpy2<Navigator['javaEnabled']>('javaEnabled')\n}\n\nexport class MockNode implements Node {\n baseURI: string = ''\n childNodes: NodeListOf<ChildNode> = undefined as any\n firstChild: ChildNode | null = null\n isConnected: boolean = false\n lastChild: ChildNode | null = null\n nextSibling: ChildNode | null = null\n nodeName: string = ''\n nodeType: number = 0\n nodeValue: string | null = ''\n ownerDocument: Document | null = null\n parentElement: HTMLElement | null = null\n parentNode: ParentNode | null = null\n previousSibling: ChildNode | null = null\n textContent: string | null = ''\n ELEMENT_NODE: 1 = 1\n ATTRIBUTE_NODE: 2 = 2\n TEXT_NODE: 3 = 3\n CDATA_SECTION_NODE: 4 = 4\n ENTITY_REFERENCE_NODE: 5 = 5\n ENTITY_NODE: 6 = 6\n PROCESSING_INSTRUCTION_NODE: 7 = 7\n COMMENT_NODE: 8 = 8\n DOCUMENT_NODE: 9 = 9\n DOCUMENT_TYPE_NODE: 10 = 10\n DOCUMENT_FRAGMENT_NODE: 11 = 11\n NOTATION_NODE: 12 = 12\n DOCUMENT_POSITION_DISCONNECTED: 0x01 = 1\n DOCUMENT_POSITION_PRECEDING: 0x02 = 2\n DOCUMENT_POSITION_FOLLOWING: 0x04 = 4\n DOCUMENT_POSITION_CONTAINS: 0x08 = 8\n DOCUMENT_POSITION_CONTAINED_BY: 0x10 = 16\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 = 32\n\n appendChild = createSpy2<Node['appendChild']>('appendChild')\n cloneNode = createSpy2<Node['cloneNode']>('cloneNode')\n compareDocumentPosition = createSpy2<Node['compareDocumentPosition']>(\n 'compareDocumentPosition'\n )\n contains = createSpy2<Node['contains']>('contains')\n getRootNode = createSpy2<Node['getRootNode']>('getRootNode')\n hasChildNodes = createSpy2<Node['hasChildNodes']>('hasChildNodes')\n insertBefore = createSpy2<Node['insertBefore']>('insertBefore')\n isDefaultNamespace =\n createSpy2<Node['isDefaultNamespace']>('isDefaultNamespace')\n isEqualNode = createSpy2<Node['isEqualNode']>('isEqualNode')\n isSameNode = createSpy2<Node['isSameNode']>('isSameNode')\n lookupNamespaceURI =\n createSpy2<Node['lookupNamespaceURI']>('lookupNamespaceURI')\n lookupPrefix = createSpy2<Node['lookupPrefix']>('lookupPrefix')\n normalize = createSpy2<Node['normalize']>('normalize')\n removeChild = createSpy2<Node['removeChild']>('removeChild')\n replaceChild = createSpy2<Node['replaceChild']>('replaceChild')\n addEventListener = createSpy2<Node['addEventListener']>('addEventListener')\n dispatchEvent = createSpy2<Node['dispatchEvent']>('dispatchEvent')\n removeEventListener = createSpy2<Node['removeEventListener']>(\n 'removeEventListener'\n )\n}\n\nexport class MockProgressEvent<\n T extends EventTarget = EventTarget,\n> implements ProgressEvent<T> {\n lengthComputable: boolean = false\n loaded: number = 0\n target: T | null = undefined as any\n total: number = 0\n bubbles: boolean = false\n cancelBubble: boolean = false\n cancelable: boolean = false\n composed: boolean = false\n currentTarget: EventTarget | null = null\n defaultPrevented: boolean = false\n eventPhase: number = 0\n isTrusted: boolean = false\n returnValue: boolean = false\n srcElement: EventTarget | null = null\n timeStamp: DOMHighResTimeStamp = 0\n type: string = ''\n NONE: 0 = 0\n CAPTURING_PHASE: 1 = 1\n AT_TARGET: 2 = 2\n BUBBLING_PHASE: 3 = 3\n\n composedPath = createSpy2<ProgressEvent<T>['composedPath']>('composedPath')\n initEvent = createSpy2<ProgressEvent<T>['initEvent']>('initEvent')\n preventDefault =\n createSpy2<ProgressEvent<T>['preventDefault']>('preventDefault')\n stopImmediatePropagation = createSpy2<\n ProgressEvent<T>['stopImmediatePropagation']\n >('stopImmediatePropagation')\n stopPropagation =\n createSpy2<ProgressEvent<T>['stopPropagation']>('stopPropagation')\n}\n\nexport class MockPromiseRejectionEvent implements PromiseRejectionEvent {\n promise: Promise<any> = undefined as any\n reason: any = undefined\n bubbles: boolean = false\n cancelBubble: boolean = false\n cancelable: boolean = false\n composed: boolean = false\n currentTarget: EventTarget | null = null\n defaultPrevented: boolean = false\n eventPhase: number = 0\n isTrusted: boolean = false\n returnValue: boolean = false\n srcElement: EventTarget | null = null\n target: EventTarget | null = null\n timeStamp: DOMHighResTimeStamp = 0\n type: string = ''\n NONE: 0 = 0\n CAPTURING_PHASE: 1 = 1\n AT_TARGET: 2 = 2\n BUBBLING_PHASE: 3 = 3\n\n composedPath =\n createSpy2<PromiseRejectionEvent['composedPath']>('composedPath')\n initEvent = createSpy2<PromiseRejectionEvent['initEvent']>('initEvent')\n preventDefault =\n createSpy2<PromiseRejectionEvent['preventDefault']>('preventDefault')\n stopImmediatePropagation = createSpy2<\n PromiseRejectionEvent['stopImmediatePropagation']\n >('stopImmediatePropagation')\n stopPropagation =\n createSpy2<PromiseRejectionEvent['stopPropagation']>('stopPropagation')\n}\n\nexport class MockSourceBuffer implements SourceBuffer {\n appendWindowEnd: number = 0\n appendWindowStart: number = 0\n buffered: TimeRanges = undefined as any\n mode: AppendMode = 'segments'\n onabort: ((this: SourceBuffer, ev: Event) => any) | null = null\n onerror: ((this: SourceBuffer, ev: Event) => any) | null = null\n onupdate: ((this: SourceBuffer, ev: Event) => any) | null = null\n onupdateend: ((this: SourceBuffer, ev: Event) => any) | null = null\n onupdatestart: ((this: SourceBuffer, ev: Event) => any) | null = null\n timestampOffset: number = 0\n updating: boolean = false\n\n abort = createSpy2<SourceBuffer['abort']>('abort')\n appendBuffer = createSpy2<SourceBuffer['appendBuffer']>('appendBuffer')\n changeType = createSpy2<SourceBuffer['changeType']>('changeType')\n remove = createSpy2<SourceBuffer['remove']>('remove')\n addEventListener =\n createSpy2<SourceBuffer['addEventListener']>('addEventListener')\n removeEventListener = createSpy2<SourceBuffer['removeEventListener']>(\n 'removeEventListener'\n )\n dispatchEvent = createSpy2<SourceBuffer['dispatchEvent']>('dispatchEvent')\n}\n\nexport class MockStorage implements Storage {\n [key: string]: any\n\n length: number = 0\n\n clear = createSpy2<Storage['clear']>('clear')\n getItem = createSpy2<Storage['getItem']>('getItem')\n key = createSpy2<Storage['key']>('key')\n removeItem = createSpy2<Storage['removeItem']>('removeItem')\n setItem = createSpy2<Storage['setItem']>('setItem')\n}\n\nexport class MockText implements Text {\n wholeText: string = ''\n data: string = ''\n length: number = 0\n ownerDocument: Document = undefined as any\n textContent: any = undefined\n assignedSlot: HTMLSlotElement | null = null\n baseURI: string = ''\n childNodes: NodeListOf<ChildNode> = undefined as any\n firstChild: ChildNode | null = null\n isConnected: boolean = false\n lastChild: ChildNode | null = null\n nextSibling: ChildNode | null = null\n nodeName: string = ''\n nodeType: number = 0\n nodeValue: string | null = ''\n parentElement: HTMLElement | null = null\n parentNode: ParentNode | null = null\n previousSibling: ChildNode | null = null\n ELEMENT_NODE: 1 = 1\n ATTRIBUTE_NODE: 2 = 2\n TEXT_NODE: 3 = 3\n CDATA_SECTION_NODE: 4 = 4\n ENTITY_REFERENCE_NODE: 5 = 5\n ENTITY_NODE: 6 = 6\n PROCESSING_INSTRUCTION_NODE: 7 = 7\n COMMENT_NODE: 8 = 8\n DOCUMENT_NODE: 9 = 9\n DOCUMENT_TYPE_NODE: 10 = 10\n DOCUMENT_FRAGMENT_NODE: 11 = 11\n NOTATION_NODE: 12 = 12\n DOCUMENT_POSITION_DISCONNECTED: 0x01 = 1\n DOCUMENT_POSITION_PRECEDING: 0x02 = 2\n DOCUMENT_POSITION_FOLLOWING: 0x04 = 4\n DOCUMENT_POSITION_CONTAINS: 0x08 = 8\n DOCUMENT_POSITION_CONTAINED_BY: 0x10 = 16\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 = 32\n nextElementSibling: Element | null = null\n previousElementSibling: Element | null = null\n\n splitText = createSpy2<Text['splitText']>('splitText')\n appendData = createSpy2<Text['appendData']>('appendData')\n deleteData = createSpy2<Text['deleteData']>('deleteData')\n insertData = createSpy2<Text['insertData']>('insertData')\n replaceData = createSpy2<Text['replaceData']>('replaceData')\n substringData = createSpy2<Text['substringData']>('substringData')\n appendChild = createSpy2<Text['appendChild']>('appendChild')\n cloneNode = createSpy2<Text['cloneNode']>('cloneNode')\n compareDocumentPosition = createSpy2<Text['compareDocumentPosition']>(\n 'compareDocumentPosition'\n )\n contains = createSpy2<Text['contains']>('contains')\n getRootNode = createSpy2<Text['getRootNode']>('getRootNode')\n hasChildNodes = createSpy2<Text['hasChildNodes']>('hasChildNodes')\n insertBefore = createSpy2<Text['insertBefore']>('insertBefore')\n isDefaultNamespace =\n createSpy2<Text['isDefaultNamespace']>('isDefaultNamespace')\n isEqualNode = createSpy2<Text['isEqualNode']>('isEqualNode')\n isSameNode = createSpy2<Text['isSameNode']>('isSameNode')\n lookupNamespaceURI =\n createSpy2<Text['lookupNamespaceURI']>('lookupNamespaceURI')\n lookupPrefix = createSpy2<Text['lookupPrefix']>('lookupPrefix')\n normalize = createSpy2<Text['normalize']>('normalize')\n removeChild = createSpy2<Text['removeChild']>('removeChild')\n replaceChild = createSpy2<Text['replaceChild']>('replaceChild')\n after = createSpy2<Text['after']>('after')\n before = createSpy2<Text['before']>('before')\n remove = createSpy2<Text['remove']>('remove')\n replaceWith = createSpy2<Text['replaceWith']>('replaceWith')\n addEventListener = createSpy2<Text['addEventListener']>('addEventListener')\n dispatchEvent = createSpy2<Text['dispatchEvent']>('dispatchEvent')\n removeEventListener = createSpy2<Text['removeEventListener']>(\n 'removeEventListener'\n )\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { MockAbortSignal, MockMediaSource } from './lib.dom'\nimport { createSpy2 } from '../createSpyFactory'\n\nexport class MockMediaSourceGlobal extends MockMediaSource {\n static canConstructInDedicatedWorker = false\n static isTypeSupported =\n createSpy2<(typeof global.MediaSource)['isTypeSupported']>(\n 'isTypeSupported'\n )\n}\n\nexport class MockAbortSignalGlobal extends MockAbortSignal {\n static abort = createSpy2<(typeof global.AbortSignal)['abort']>('abort')\n static any = createSpy2<(typeof global.AbortSignal)['any']>('any')\n static timeout =\n createSpy2<(typeof global.AbortSignal)['timeout']>('timeout')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n BenchmarkRunResults,\n RunResultsComparison,\n} from '@amazon/vinyl-util/browserTestUtil'\nimport {\n compareResults,\n expectNothing,\n setTestTimeout,\n} from '@amazon/vinyl-util/browserTestUtil'\n\nexport function setupBenchmark(): void {\n setTestTimeout(180)\n afterEach(expectNothing)\n}\n\nconst comparisons: RunResultsComparison[] = []\n\n/**\n * Adds a benchmark comparison to be displayed at the end of the test.\n * @param comparison\n */\nexport function addComparison(comparison: RunResultsComparison) {\n comparisons.push(comparison)\n}\n\n/**\n * Adds a list of benchmark results to be compared with each other.\n * The results will be logged then for browser environments displayed at the end of the suite.\n *\n * @param name The comparison suite name.\n * @param results\n */\nexport function addBenchmarks(name: string, ...results: BenchmarkRunResults[]) {\n const comparison = compareResults(name, ...results)\n comparison.logToTable()\n comparisons.push(comparison)\n}\n\nif (typeof document !== 'undefined') {\n jasmine.getEnv().addReporter({\n jasmineDone: () => {\n console.log('Tests complete')\n const jasmineContainer = document.getElementsByClassName(\n 'jasmine_html-reporter'\n )[0]\n jasmineContainer.parentElement?.removeChild(jasmineContainer)\n const container = createEl('div', document.body)\n container.id = 'benchmarkResults'\n const sortedComparisons = [...comparisons].sort((a, b) =>\n a.name > b.name ? 1 : -1\n )\n for (const comparison of sortedComparisons) {\n toTableHtml(comparison, container)\n }\n },\n })\n}\n\nfunction toTableHtml(\n comparison: RunResultsComparison,\n parent?: HTMLElement\n): HTMLDivElement {\n const container = createEl('div', parent)\n container.className = 'benchmarkComparison'\n const title = createEl('h2', container)\n title.innerText = comparison.name\n const table = createEl('table', container)\n const head = createEl('thead', table)\n const headRow = createEl('tr', head)\n const name = createEl('th', headRow)\n name.innerText = 'Name'\n const median = createEl('th', headRow)\n median.innerText = 'Mean ops/s'\n const samples = createEl('th', headRow)\n samples.innerText = 'Samples'\n const compare = createEl('th', headRow)\n compare.innerText = '% Comparison'\n\n const body = createEl('tbody', table)\n comparison.results.forEach((result) => {\n const row = createEl('tr', body)\n createEl('th', row).innerText = result.name\n createEl('td', row).innerText = result.meanOpsStr\n createEl('td', row).innerText = result.totalSamples.toLocaleString()\n createEl('td', row).innerText = comparison.runComparisonToString(result)\n })\n return container\n}\n\nfunction createEl<K extends keyof HTMLElementTagNameMap>(\n tagName: K,\n parent?: HTMLElement,\n options?: ElementCreationOptions\n): HTMLElementTagNameMap[K] {\n const element = document.createElement(tagName, options)\n if (parent) parent.appendChild(element)\n return element\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { parseMainPlaylist, parseMediaPlaylist } from '@amazon/vinyl-hls-parser'\nimport { benchmark } from '@amazon/vinyl-util/browserTestUtil'\nimport { addBenchmarks, setupBenchmark } from '../../setup'\n\nconst sampleMainPlaylist = `#EXTM3U\n#EXT-X-VERSION:6\n#EXT-X-INDEPENDENT-SEGMENTS\n\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"English\",LANGUAGE=\"en\",DEFAULT=YES,AUTOSELECT=YES,URI=\"audio/en/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Spanish\",LANGUAGE=\"es\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/es/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"French\",LANGUAGE=\"fr\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/fr/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"German\",LANGUAGE=\"de\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/de/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Italian\",LANGUAGE=\"it\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/it/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Portuguese\",LANGUAGE=\"pt\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/pt/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Japanese\",LANGUAGE=\"ja\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/ja/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Korean\",LANGUAGE=\"ko\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/ko/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Chinese\",LANGUAGE=\"zh\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/zh/64k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-64\",NAME=\"Russian\",LANGUAGE=\"ru\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/ru/64k/index.m3u8\"\n\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-128\",NAME=\"English\",LANGUAGE=\"en\",DEFAULT=YES,AUTOSELECT=YES,URI=\"audio/en/128k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-128\",NAME=\"Spanish\",LANGUAGE=\"es\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/es/128k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-128\",NAME=\"French\",LANGUAGE=\"fr\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/fr/128k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-128\",NAME=\"German\",LANGUAGE=\"de\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/de/128k/index.m3u8\"\n#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio-aacl-128\",NAME=\"Italian\",LANGUAGE=\"it\",DEFAULT=NO,AUTOSELECT=YES,URI=\"audio/it/128k/index.m3u8\"\n\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"English\",LANGUAGE=\"en\",DEFAULT=YES,AUTOSELECT=YES,URI=\"subtitles/en/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Spanish\",LANGUAGE=\"es\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/es/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"French\",LANGUAGE=\"fr\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/fr/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"German\",LANGUAGE=\"de\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/de/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Italian\",LANGUAGE=\"it\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/it/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Portuguese\",LANGUAGE=\"pt\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/pt/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Japanese\",LANGUAGE=\"ja\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/ja/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Korean\",LANGUAGE=\"ko\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/ko/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Chinese\",LANGUAGE=\"zh\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/zh/index.m3u8\"\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Russian\",LANGUAGE=\"ru\",DEFAULT=NO,AUTOSELECT=YES,URI=\"subtitles/ru/index.m3u8\"\n\n#EXT-X-STREAM-INF:BANDWIDTH=400000,AVERAGE-BANDWIDTH=380000,CODECS=\"avc1.42e00a,mp4a.40.2\",RESOLUTION=416x234,FRAME-RATE=23.976,AUDIO=\"audio-aacl-64\",SUBTITLES=\"subs\"\nvideo/400k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=800000,AVERAGE-BANDWIDTH=760000,CODECS=\"avc1.42e015,mp4a.40.2\",RESOLUTION=640x360,FRAME-RATE=23.976,AUDIO=\"audio-aacl-64\",SUBTITLES=\"subs\"\nvideo/800k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=1200000,AVERAGE-BANDWIDTH=1140000,CODECS=\"avc1.42e01e,mp4a.40.2\",RESOLUTION=854x480,FRAME-RATE=23.976,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/1200k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=1800000,AVERAGE-BANDWIDTH=1710000,CODECS=\"avc1.42e01f,mp4a.40.2\",RESOLUTION=1280x720,FRAME-RATE=23.976,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/1800k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=2500000,AVERAGE-BANDWIDTH=2375000,CODECS=\"avc1.42e020,mp4a.40.2\",RESOLUTION=1280x720,FRAME-RATE=29.97,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/2500k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=3500000,AVERAGE-BANDWIDTH=3325000,CODECS=\"avc1.42e028,mp4a.40.2\",RESOLUTION=1920x1080,FRAME-RATE=23.976,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/3500k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=5000000,AVERAGE-BANDWIDTH=4750000,CODECS=\"avc1.42e028,mp4a.40.2\",RESOLUTION=1920x1080,FRAME-RATE=29.97,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/5000k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=7500000,AVERAGE-BANDWIDTH=7125000,CODECS=\"avc1.42e032,mp4a.40.2\",RESOLUTION=1920x1080,FRAME-RATE=59.94,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/7500k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=10000000,AVERAGE-BANDWIDTH=9500000,CODECS=\"avc1.640028,mp4a.40.2\",RESOLUTION=3840x2160,FRAME-RATE=23.976,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/10000k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=15000000,AVERAGE-BANDWIDTH=14250000,CODECS=\"avc1.640028,mp4a.40.2\",RESOLUTION=3840x2160,FRAME-RATE=29.97,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/15000k/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=20000000,AVERAGE-BANDWIDTH=19000000,CODECS=\"avc1.640032,mp4a.40.2\",RESOLUTION=3840x2160,FRAME-RATE=59.94,AUDIO=\"audio-aacl-128\",SUBTITLES=\"subs\"\nvideo/20000k/index.m3u8`\n\nconst sampleMediaPlaylist = `#EXTM3U\n#EXT-X-VERSION:6\n#EXT-X-TARGETDURATION:10\n#EXT-X-MEDIA-SEQUENCE:0\n#EXT-X-PLAYLIST-TYPE:VOD\n\n#EXT-X-KEY:METHOD=AES-128,URI=\"https://example.com/keys/key1.bin\",IV=0x99b74007b6254e4bd1c6e03631cad15b\n\n#EXTINF:9.009,\nsegment00000.ts\n#EXTINF:9.009,\nsegment00001.ts\n#EXTINF:9.009,\nsegment00002.ts\n#EXTINF:9.009,\nsegment00003.ts\n#EXTINF:9.009,\nsegment00004.ts\n#EXTINF:9.009,\nsegment00005.ts\n#EXTINF:9.009,\nsegment00006.ts\n#EXTINF:9.009,\nsegment00007.ts\n#EXTINF:9.009,\nsegment00008.ts\n#EXTINF:9.009,\nsegment00009.ts\n#EXTINF:9.009,\nsegment00010.ts\n#EXTINF:9.009,\nsegment00011.ts\n#EXTINF:9.009,\nsegment00012.ts\n#EXTINF:9.009,\nsegment00013.ts\n#EXTINF:9.009,\nsegment00014.ts\n#EXTINF:9.009,\nsegment00015.ts\n#EXTINF:9.009,\nsegment00016.ts\n#EXTINF:9.009,\nsegment00017.ts\n#EXTINF:9.009,\nsegment00018.ts\n#EXTINF:9.009,\nsegment00019.ts\n\n#EXT-X-KEY:METHOD=AES-128,URI=\"https://example.com/keys/key2.bin\",IV=0x12345678901234567890123456789012\n\n#EXTINF:9.009,\nsegment00020.ts\n#EXTINF:9.009,\nsegment00021.ts\n#EXTINF:9.009,\nsegment00022.ts\n#EXTINF:9.009,\nsegment00023.ts\n#EXTINF:9.009,\nsegment00024.ts\n#EXTINF:9.009,\nsegment00025.ts\n#EXTINF:9.009,\nsegment00026.ts\n#EXTINF:9.009,\nsegment00027.ts\n#EXTINF:9.009,\nsegment00028.ts\n#EXTINF:9.009,\nsegment00029.ts\n\n#EXT-X-DISCONTINUITY\n#EXT-X-KEY:METHOD=AES-128,URI=\"https://example.com/keys/key3.bin\",IV=0xabcdef1234567890abcdef1234567890\n\n#EXTINF:9.009,\nsegment00030.ts\n#EXTINF:9.009,\nsegment00031.ts\n#EXTINF:9.009,\nsegment00032.ts\n#EXTINF:9.009,\nsegment00033.ts\n#EXTINF:9.009,\nsegment00034.ts\n#EXTINF:9.009,\nsegment00035.ts\n#EXTINF:9.009,\nsegment00036.ts\n#EXTINF:9.009,\nsegment00037.ts\n#EXTINF:9.009,\nsegment00038.ts\n#EXTINF:9.009,\nsegment00039.ts\n#EXTINF:9.009,\nsegment00040.ts\n#EXTINF:9.009,\nsegment00041.ts\n#EXTINF:9.009,\nsegment00042.ts\n#EXTINF:9.009,\nsegment00043.ts\n#EXTINF:9.009,\nsegment00044.ts\n#EXTINF:9.009,\nsegment00045.ts\n#EXTINF:9.009,\nsegment00046.ts\n#EXTINF:9.009,\nsegment00047.ts\n#EXTINF:9.009,\nsegment00048.ts\n#EXTINF:9.009,\nsegment00049.ts\n\n#EXT-X-KEY:METHOD=NONE\n\n#EXTINF:9.009,\nsegment00050.ts\n#EXTINF:9.009,\nsegment00051.ts\n#EXTINF:9.009,\nsegment00052.ts\n#EXTINF:9.009,\nsegment00053.ts\n#EXTINF:9.009,\nsegment00054.ts\n#EXTINF:9.009,\nsegment00055.ts\n#EXTINF:9.009,\nsegment00056.ts\n#EXTINF:9.009,\nsegment00057.ts\n#EXTINF:9.009,\nsegment00058.ts\n#EXTINF:9.009,\nsegment00059.ts\n#EXTINF:9.009,\nsegment00060.ts\n#EXTINF:9.009,\nsegment00061.ts\n#EXTINF:9.009,\nsegment00062.ts\n#EXTINF:9.009,\nsegment00063.ts\n#EXTINF:9.009,\nsegment00064.ts\n#EXTINF:9.009,\nsegment00065.ts\n#EXTINF:9.009,\nsegment00066.ts\n#EXTINF:9.009,\nsegment00067.ts\n#EXTINF:9.009,\nsegment00068.ts\n#EXTINF:9.009,\nsegment00069.ts\n#EXTINF:9.009,\nsegment00070.ts\n#EXTINF:9.009,\nsegment00071.ts\n#EXTINF:9.009,\nsegment00072.ts\n#EXTINF:9.009,\nsegment00073.ts\n#EXTINF:9.009,\nsegment00074.ts\n#EXTINF:9.009,\nsegment00075.ts\n#EXTINF:9.009,\nsegment00076.ts\n#EXTINF:9.009,\nsegment00077.ts\n#EXTINF:9.009,\nsegment00078.ts\n#EXTINF:9.009,\nsegment00079.ts\n#EXTINF:9.009,\nsegment00080.ts\n#EXTINF:9.009,\nsegment00081.ts\n#EXTINF:9.009,\nsegment00082.ts\n#EXTINF:9.009,\nsegment00083.ts\n#EXTINF:9.009,\nsegment00084.ts\n#EXTINF:9.009,\nsegment00085.ts\n#EXTINF:9.009,\nsegment00086.ts\n#EXTINF:9.009,\nsegment00087.ts\n#EXTINF:9.009,\nsegment00088.ts\n#EXTINF:9.009,\nsegment00089.ts\n#EXTINF:9.009,\nsegment00090.ts\n#EXTINF:9.009,\nsegment00091.ts\n#EXTINF:9.009,\nsegment00092.ts\n#EXTINF:9.009,\nsegment00093.ts\n#EXTINF:9.009,\nsegment00094.ts\n#EXTINF:9.009,\nsegment00095.ts\n#EXTINF:9.009,\nsegment00096.ts\n#EXTINF:9.009,\nsegment00097.ts\n#EXTINF:9.009,\nsegment00098.ts\n#EXTINF:5.005,\nsegment00099.ts\n\n#EXT-X-ENDLIST`\n\ndescribe('parseHlsManifest', () => {\n setupBenchmark()\n\n it('Parse HLS Main Playlist', async () => {\n addBenchmarks(\n 'Parse HLS Main Playlist',\n await benchmark('HLS Main', () =>\n parseMainPlaylist(sampleMainPlaylist)\n )\n )\n })\n\n it('Parse HLS Media Playlist', async () => {\n addBenchmarks(\n 'Parse HLS Media Playlist',\n await benchmark('HLS Media', () =>\n parseMediaPlaylist(sampleMediaPlaylist)\n )\n )\n })\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA,IAKvB,UAAU;AAAA;AAAA;AAAA;AAAA,IAKV,UAAU;AAAA;AAAA;AAAA;AAAA,IAKV,KAAK;AAAA;AAAA;AAAA;AAAA,IAKL,kBAAkB;AAAA;AAAA;AAAA;AAAA,IAKlB,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,IAMlB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAMP,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,IAMT,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOf,KAAK;AAAA,EACT;;;AC5BO,MAAM,kBAAN,MAAM,yBAAwB,MAAM;AAAA,IAKvC,YACI,SACS,SAAiB,YAAY,UAC7B,QAAoB,qBAC/B;AACE,YAAM,OAAO;AAHJ;AACA;AAGT,aAAO,eAAe,MAAM,iBAAgB,SAAS;AAAA,IACzD;AAAA,IAXA,KAAK,OAAO,WAAW,IAAY;AAC/B,aAAO;AAAA,IACX;AAAA,IAWA,IAAI,OAAe;AACf,aAAO,KAAK,OAAO,WAAW;AAAA,IAClC;AAA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