@amazon/vinyl 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +603 -317
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +622 -329
- package/dist/index.js.map +4 -4
- package/dist/test/benchmark.es5.js +8 -5
- package/dist/test/benchmark.js +228 -0
- package/dist/test/benchmark.js.map +4 -4
- package/dist/test/integ.es5.js +182 -156
- package/dist/test/integ.js +1853 -796
- package/dist/test/integ.js.map +4 -4
- package/dist/types/current/index.d.ts +4 -0
- package/dist/types/current/index.d.ts.map +1 -1
- package/dist/types/current/index.js +4 -0
- package/dist/types/current/streaming/AudioOptions.d.ts +39 -0
- package/dist/types/current/streaming/AudioOptions.d.ts.map +1 -0
- package/dist/types/current/streaming/AudioOptions.js +15 -0
- package/dist/types/current/streaming/createDefaultMediaTimelineTransformer.d.ts +2 -2
- package/dist/types/current/streaming/createDefaultMediaTimelineTransformer.d.ts.map +1 -1
- package/dist/types/current/streaming/createDefaultMediaTimelineTransformer.js +5 -5
- package/dist/types/current/text/HtmlTextTrackRenderer.d.ts +60 -0
- package/dist/types/current/text/HtmlTextTrackRenderer.d.ts.map +1 -0
- package/dist/types/current/text/HtmlTextTrackRenderer.js +231 -0
- package/dist/types/current/text/SidecarTextTrackController.d.ts +65 -53
- package/dist/types/current/text/SidecarTextTrackController.d.ts.map +1 -1
- package/dist/types/current/text/SidecarTextTrackController.js +167 -154
- package/dist/types/current/text/SidecarTextTrackLoader.d.ts +5 -0
- package/dist/types/current/text/SidecarTextTrackLoader.d.ts.map +1 -1
- package/dist/types/current/text/SidecarTextTrackLoader.js +13 -7
- package/dist/types/current/text/TextTrack.d.ts +74 -20
- package/dist/types/current/text/TextTrack.d.ts.map +1 -1
- package/dist/types/current/text/TextTrack.js +20 -0
- package/dist/types/current/text/TextTrackRenderer.d.ts +24 -0
- package/dist/types/current/text/TextTrackRenderer.d.ts.map +1 -0
- package/dist/types/current/text/TextTrackRenderer.js +5 -0
- package/dist/types/current/text/mediaTextTrackProvider.d.ts +34 -0
- package/dist/types/current/text/mediaTextTrackProvider.d.ts.map +1 -0
- package/dist/types/current/text/mediaTextTrackProvider.js +42 -0
- package/dist/types/current/text/parseWebVtt.d.ts +16 -2
- package/dist/types/current/text/parseWebVtt.d.ts.map +1 -1
- package/dist/types/current/text/parseWebVtt.js +176 -48
- package/dist/types/current/text/pickPreferredTextTrack.d.ts +2 -1
- package/dist/types/current/text/pickPreferredTextTrack.d.ts.map +1 -1
- package/dist/types/current/text/pickPreferredTextTrack.js +6 -3
- package/dist/types/current/track/Track.d.ts +1 -1
- package/dist/types/current/track/dash/createDashFactories.d.ts +21 -10
- package/dist/types/current/track/dash/createDashFactories.d.ts.map +1 -1
- package/dist/types/current/track/dash/createDashFactories.js +9 -21
- package/dist/types/current/track/hls/createHlsFactories.d.ts +21 -10
- package/dist/types/current/track/hls/createHlsFactories.d.ts.map +1 -1
- package/dist/types/current/track/hls/createHlsFactories.js +9 -21
- package/dist/types/current/track/mse/MseTrack.d.ts +1 -2
- package/dist/types/current/track/mse/MseTrack.d.ts.map +1 -1
- package/dist/types/current/track/mse/MseTrack.js +3 -7
- package/dist/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/types/current/vinyl/VinylOptions.d.ts +18 -40
- package/dist/types/current/vinyl/VinylOptions.d.ts.map +1 -1
- package/dist/types/current/vinyl/VinylOptions.js +12 -11
- package/dist/types/current/vinyl/VinylPlayer.d.ts +0 -6
- package/dist/types/current/vinyl/VinylPlayer.d.ts.map +1 -1
- package/dist/types/current/vinyl/VinylPlayer.js +2 -23
- package/dist/types/current/vinyl/createVinylFactories.d.ts +32 -18
- package/dist/types/current/vinyl/createVinylFactories.d.ts.map +1 -1
- package/dist/types/current/vinyl/createVinylFactories.js +6 -0
- package/dist/types/ts3.7/index.d.ts +4 -0
- package/dist/types/ts3.7/streaming/AudioOptions.d.ts +39 -0
- package/dist/types/ts3.7/streaming/createDefaultMediaTimelineTransformer.d.ts +2 -2
- package/dist/types/ts3.7/text/HtmlTextTrackRenderer.d.ts +60 -0
- package/dist/types/ts3.7/text/SidecarTextTrackController.d.ts +65 -53
- package/dist/types/ts3.7/text/SidecarTextTrackLoader.d.ts +5 -0
- package/dist/types/ts3.7/text/TextTrack.d.ts +74 -20
- package/dist/types/ts3.7/text/TextTrackRenderer.d.ts +24 -0
- package/dist/types/ts3.7/text/mediaTextTrackProvider.d.ts +34 -0
- package/dist/types/ts3.7/text/parseWebVtt.d.ts +16 -2
- package/dist/types/ts3.7/text/pickPreferredTextTrack.d.ts +2 -1
- package/dist/types/ts3.7/track/Track.d.ts +1 -1
- package/dist/types/ts3.7/track/dash/createDashFactories.d.ts +21 -10
- package/dist/types/ts3.7/track/hls/createHlsFactories.d.ts +21 -10
- package/dist/types/ts3.7/track/mse/MseTrack.d.ts +1 -2
- package/dist/types/ts3.7/vinyl/VinylOptions.d.ts +18 -40
- package/dist/types/ts3.7/vinyl/VinylPlayer.d.ts +0 -6
- package/dist/types/ts3.7/vinyl/createVinylFactories.d.ts +32 -18
- package/dist/types/ts4.1/index.d.ts +4 -0
- package/dist/types/ts4.1/streaming/AudioOptions.d.ts +39 -0
- package/dist/types/ts4.1/streaming/createDefaultMediaTimelineTransformer.d.ts +2 -2
- package/dist/types/ts4.1/text/HtmlTextTrackRenderer.d.ts +60 -0
- package/dist/types/ts4.1/text/SidecarTextTrackController.d.ts +65 -53
- package/dist/types/ts4.1/text/SidecarTextTrackLoader.d.ts +5 -0
- package/dist/types/ts4.1/text/TextTrack.d.ts +74 -20
- package/dist/types/ts4.1/text/TextTrackRenderer.d.ts +24 -0
- package/dist/types/ts4.1/text/mediaTextTrackProvider.d.ts +34 -0
- package/dist/types/ts4.1/text/parseWebVtt.d.ts +16 -2
- package/dist/types/ts4.1/text/pickPreferredTextTrack.d.ts +2 -1
- package/dist/types/ts4.1/track/Track.d.ts +1 -1
- package/dist/types/ts4.1/track/dash/createDashFactories.d.ts +21 -10
- package/dist/types/ts4.1/track/hls/createHlsFactories.d.ts +21 -10
- package/dist/types/ts4.1/track/mse/MseTrack.d.ts +1 -2
- package/dist/types/ts4.1/vinyl/VinylOptions.d.ts +18 -40
- package/dist/types/ts4.1/vinyl/VinylPlayer.d.ts +0 -6
- package/dist/types/ts4.1/vinyl/createVinylFactories.d.ts +32 -18
- package/dist/types/ts4.7/index.d.ts +4 -0
- package/dist/types/ts4.7/streaming/AudioOptions.d.ts +39 -0
- package/dist/types/ts4.7/streaming/createDefaultMediaTimelineTransformer.d.ts +2 -2
- package/dist/types/ts4.7/text/HtmlTextTrackRenderer.d.ts +60 -0
- package/dist/types/ts4.7/text/SidecarTextTrackController.d.ts +65 -53
- package/dist/types/ts4.7/text/SidecarTextTrackLoader.d.ts +5 -0
- package/dist/types/ts4.7/text/TextTrack.d.ts +74 -20
- package/dist/types/ts4.7/text/TextTrackRenderer.d.ts +24 -0
- package/dist/types/ts4.7/text/mediaTextTrackProvider.d.ts +34 -0
- package/dist/types/ts4.7/text/parseWebVtt.d.ts +16 -2
- package/dist/types/ts4.7/text/pickPreferredTextTrack.d.ts +2 -1
- package/dist/types/ts4.7/track/Track.d.ts +1 -1
- package/dist/types/ts4.7/track/dash/createDashFactories.d.ts +21 -10
- package/dist/types/ts4.7/track/hls/createHlsFactories.d.ts +21 -10
- package/dist/types/ts4.7/track/mse/MseTrack.d.ts +1 -2
- package/dist/types/ts4.7/vinyl/VinylOptions.d.ts +18 -40
- package/dist/types/ts4.7/vinyl/VinylPlayer.d.ts +0 -6
- package/dist/types/ts4.7/vinyl/createVinylFactories.d.ts +32 -18
- package/dist/unit/types/current/index.d.ts +2 -0
- package/dist/unit/types/current/index.d.ts.map +1 -1
- package/dist/unit/types/current/index.js +2 -0
- package/dist/unit/types/current/streaming/MseTrack.test.js +13 -7
- package/dist/unit/types/current/streaming/createDefaultMediaTimelineTransformer.test.js +8 -4
- package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.d.ts +2 -0
- package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.js +231 -0
- package/dist/unit/types/current/text/SidecarTextTrackController.test.js +432 -333
- package/dist/unit/types/current/text/SidecarTextTrackLoader.test.js +29 -0
- package/dist/unit/types/current/text/mediaTextTrackProvider.test.d.ts +2 -0
- package/dist/unit/types/current/text/mediaTextTrackProvider.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/mediaTextTrackProvider.test.js +86 -0
- package/dist/unit/types/current/text/parseWebVtt.test.js +187 -6
- package/dist/unit/types/current/text/pickPreferredTextTrack.test.js +12 -1
- package/dist/unit/types/current/track/dash/createDashFactories.test.js +1 -2
- package/dist/unit/types/current/track/hls/buildHlsMediaTimeline.test.js +1 -2
- package/dist/unit/types/current/track/hls/createHlsFactories.test.js +1 -2
- package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/unit/types/current/vinyl/VinylPlayerTextTracks.test.js +102 -177
- package/dist/unit/types/current/vinyl/createVinylFactories.test.js +2 -0
- package/dist/vinylTestUtil/index.js +14 -8
- package/dist/vinylTestUtil/index.js.map +2 -2
- package/dist/vinylTestUtil/types/current/mock/player/MockVinylPlayerDependencies.d.ts +3 -2
- package/dist/vinylTestUtil/types/current/mock/player/MockVinylPlayerDependencies.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/mock/player/MockVinylPlayerDependencies.js +5 -2
- package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.d.ts +3 -3
- package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.js +3 -3
- package/dist/vinylTestUtil/types/current/mock/track/dash/createMockDashDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/current/mock/track/dash/createMockDashDependencies.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/mock/track/dash/createMockDashDependencies.js +3 -2
- package/dist/vinylTestUtil/types/current/mock/track/hls/createMockHlsDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/current/mock/track/hls/createMockHlsDependencies.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/mock/track/hls/createMockHlsDependencies.js +3 -2
- package/dist/vinylTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/vinylTestUtil/types/ts3.7/mock/player/MockVinylPlayerDependencies.d.ts +3 -2
- package/dist/vinylTestUtil/types/ts3.7/mock/text/MockTextTrackController.d.ts +3 -3
- package/dist/vinylTestUtil/types/ts3.7/mock/track/dash/createMockDashDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/ts3.7/mock/track/hls/createMockHlsDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/ts4.1/mock/player/MockVinylPlayerDependencies.d.ts +3 -2
- package/dist/vinylTestUtil/types/ts4.1/mock/text/MockTextTrackController.d.ts +3 -3
- package/dist/vinylTestUtil/types/ts4.1/mock/track/dash/createMockDashDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/ts4.1/mock/track/hls/createMockHlsDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/ts4.7/mock/player/MockVinylPlayerDependencies.d.ts +3 -2
- package/dist/vinylTestUtil/types/ts4.7/mock/text/MockTextTrackController.d.ts +3 -3
- package/dist/vinylTestUtil/types/ts4.7/mock/track/dash/createMockDashDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/ts4.7/mock/track/hls/createMockHlsDependencies.d.ts +1 -2
- package/docs/USAGE.md +82 -31
- package/package.json +12 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../vinyl-util/src/error/ErrorOrigin.ts", "../../../vinyl-util/src/error/ReportableError.ts", "../../../vinyl-util/src/error/IllegalArgumentError.ts", "../../../vinyl-util/src/util/collection/LinkedList.ts", "../../../vinyl-util/src/event/Signal.ts", "../../../vinyl-util/src/util/map/map.ts", "../../../vinyl-util/src/util/type.ts", "../../../vinyl-util/src/logging/LogTarget.ts", "../../../vinyl-util/src/event/EventHost.ts", "../../../vinyl-util/src/util/collection/array.ts", "../../../vinyl-util/src/util/iteration/iterable.ts", "../../../vinyl-util/src/error/IllegalStateError.ts", "../../../vinyl-util/src/util/collection/LruCache.ts", "../../../vinyl-util/src/util/fun/memoize.ts", "../../../vinyl-util/src/util/string/string.ts", "../../../vinyl-util/src/util/serialization/primitives.ts", "../../../vinyl-util/src/core/disposable.ts", "../../../vinyl-util/src/global/globalRegistry.ts", "../../../vinyl-util/src/core/cloneable.ts", "../../../vinyl-util/src/util/object/object.ts", "../../../vinyl-util/src/util/serialization/json.ts", "../../../vinyl-util/src/error/ValidationError.ts", "../../../vinyl-util/src/global/environment.ts", "../../../vinyl-util/src/util/browser/searchParams.ts", "../../../vinyl-util/src/logging/getLogLevelFromSearch.ts", "../../../vinyl-util/src/logging/Logger.ts", "../../../vinyl-util/src/util/math/math.ts", "../../../vinyl-util/src/util/collection/typedArray.ts", "../../../vinyl-util/src/util/set/set.ts", "../../../vinyl-util/src/util/object/mergeDeep.ts", "../../../vinyl-util/src/util/object/clone.ts", "../../../vinyl-util/src/util/object/lazy.ts", "../../../vinyl-util/src/util/date/date.ts", "../../../vinyl-util/src/util/serialization/ParseError.ts", "../../../vinyl-util/src/util/serialization/stringifyForPrint.ts", "../../../vinyl-util/src/util/string/StringReader.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/logging/Logging.bench.ts", "../../../vinyl-mpd-parser/src/duration/duration.ts", "../../../vinyl-mpd-parser/src/error/parsingError.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/typeOfValidators.ts", "../../../vinyl-validation/src/validation/NumberSchema.ts", "../../../vinyl-validation/src/validation/validators.ts", "../../../vinyl-xml/src/xlink/actuateValidator.ts", "../../../vinyl-xml/src/xml/xmlRules.ts", "../../../vinyl-xml/src/xml/mappedXmlRules.ts", "../../../vinyl-xml/src/xml/mergeXmlRules.ts", "../../../vinyl-xml/src/xml/parseXml.ts", "../../../vinyl-xml/src/xml/XmlSchemaError.ts", "../../../vinyl-xml/src/xml/ParseXmlHandlerImpl.ts", "../../../vinyl-mpd-parser/src/media/byteRange.ts", "../../../vinyl-mpd-parser/src/media/ratio.ts", "../../../vinyl-mpd-parser/src/media/frameRate.ts", "../../../vinyl-mpd-parser/src/manifest/dashManifestXmlRules.ts", "../../../vinyl-mpd-parser/src/xmlns/mpeg/cenc/2013.ts", "../../../vinyl-mpd-parser/src/manifest/ext/drm/cencXmlRules.ts", "../../../vinyl-mpd-parser/src/manifest/ext/drm/contentProtection.ts", "../../../vinyl-mpd-parser/src/xmlns/microsoft/playready.ts", "../../../vinyl-mpd-parser/src/manifest/ext/drm/playreadyXmlRules.ts", "../../../vinyl-mpd-parser/src/manifest/dashParser.ts", "../../test/vinylTestUtil/assets/dash_segmentListMediaRange.ts", "../../test/vinylTestUtil/player/mediaRef.ts", "../../test/vinylTestUtil/media/FrequencyAnalyzer.ts", "../../../vinyl-util/test/testUtil/mock/logging/MockLogger.ts", "../../../vinyl-util/test/testUtil/mock/network/emptyRequestInfo.ts", "../../../vinyl-util/test/testUtil/mock/network/MockNetworkMetricsController.ts", "../../../vinyl-util/test/testUtil/mock/network/MockNetworkState.ts", "../../../vinyl-util/test/testUtil/mock/network/MockRequester.ts", "../../../vinyl-util/test/testUtil/reporters/LogReporter.ts", "../../test/vinylTestUtil/mock/ad/MockAdController.ts", "../../test/vinylTestUtil/mock/client/MockCapabilities.ts", "../../test/vinylTestUtil/mock/dash/mockDashManifest.ts", "../../test/vinylTestUtil/mock/dash/MockDashManifestController.ts", "../../test/vinylTestUtil/mock/dom/ms/MockMSMediaKeys.ts", "../../test/vinylTestUtil/mock/dom/ms/MockMSMediaKeySession.ts", "../../test/vinylTestUtil/mock/dom/webkit/MockWebKitMediaKeys.ts", "../../test/vinylTestUtil/mock/dom/webkit/MockWebKitMediaKeySession.ts", "../../test/vinylTestUtil/mock/drm/MockCommonEme.ts", "../../test/vinylTestUtil/mock/drm/MockCommonMediaKeys.ts", "../../test/vinylTestUtil/mock/drm/MockCommonMediaKeySession.ts", "../../test/vinylTestUtil/mock/drm/MockCommonMediaKeySystemAccess.ts", "../../test/vinylTestUtil/mock/drm/MockDrmController.ts", "../../test/vinylTestUtil/mock/hls/MockHlsManifestController.ts", "../../test/vinylTestUtil/mock/logging/MockHistoryLogHandler.ts", "../../test/vinylTestUtil/mock/playback/MockLoudnessNormalizationController.ts", "../../test/vinylTestUtil/mock/playback/MockPlaybackController.ts", "../../test/vinylTestUtil/mock/playback/MockPlaybackSource.ts", "../../test/vinylTestUtil/mock/track/MockTrackController.ts", "../../test/vinylTestUtil/mock/streaming/buffering/MockMediaSourceController.ts", "../../test/vinylTestUtil/mock/streaming/MockContentStream.ts", "../../test/vinylTestUtil/mock/text/MockTextTrackController.ts", "../../test/vinylTestUtil/mock/track/dash/createMockDashDependencies.ts", "../../test/vinylTestUtil/mock/track/MockAutoResetController.ts", "../../test/vinylTestUtil/mock/streaming/abr/MockQualitySelector.ts", "../../test/vinylTestUtil/mock/streaming/buffering/MockBufferingController.ts", "../../test/vinylTestUtil/mock/streaming/buffering/MockSourceBufferController.ts", "../../test/vinylTestUtil/mock/streaming/MockSegmentController.ts", "../../test/vinylTestUtil/mock/track/hls/createMockHlsDependencies.ts", "../../test/vinylTestUtil/mock/track/MockTrack.ts", "../../test/benchmark/manifest/dash/parseDashManifest.bench.ts", "../../test/benchmark/util/collection/LinkedList.bench.ts", "../../test/benchmark/util/object/mergeDeep.bench.ts", "../../test/benchmark/util/serialization/toJson.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 * A doubly-linked node.\n *\n * If a node is to move from one list to another, it must be removed first.\n */\nexport interface LinkedNode<T> {\n previous: LinkedNode<T> | null\n value: T\n removed: boolean\n next: LinkedNode<T> | null\n}\n\n/**\n * A standard doubly-linked list implementation.\n */\nexport class LinkedList<T> implements Iterable<T> {\n private _head: LinkedNode<T> | null = null\n private _tail: LinkedNode<T> | null = null\n\n /**\n * Returns the current head.\n */\n get head(): LinkedNode<T> | null {\n return this._head\n }\n\n /**\n * Returns the current tail.\n */\n get tail(): LinkedNode<T> | null {\n return this._tail\n }\n\n /**\n * Returns true if the list is empty.\n */\n get empty(): boolean {\n return this._head === null\n }\n\n /**\n * Creates a new node for the given value, adding it to the end of the list.\n *\n * @param value\n * @return Returns the newly created node.\n */\n push(value: T): LinkedNode<T> {\n const node: LinkedNode<T> = {\n previous: this._tail,\n value,\n removed: false,\n next: null,\n }\n this.pushNode(node)\n return node\n }\n\n /**\n * Appends all given values to the end of this list.\n *\n * @param values\n */\n pushAll(...values: T[]) {\n for (const value of values) {\n this.push(value)\n }\n }\n\n /**\n * Appends the given node to the tail of this list.\n * If the node is already at the tail, it will no-op.\n * If the node is in this list, it will be removed.\n *\n * @param node The node to add or move to the tail of this list.\n */\n pushNode(node: LinkedNode<T>) {\n if (this._tail === node) return\n this.remove(node)\n node.removed = false\n node.next = null\n node.previous = this._tail\n if (this._tail) this._tail.next = node\n this._tail = node\n if (!this._head) this._head = node\n }\n\n /**\n * Removes the last node (the tail), returning it.\n * If this list is empty, null is returned.\n */\n pop(): LinkedNode<T> | null {\n const node = this._tail\n if (!node) return null\n this.remove(node)\n return node\n }\n\n /**\n * Creates a new node, adding it to the front of the list.\n *\n * @param value The value to box in a linked node.\n * @return Returns the new node.\n */\n unshift(value: T): LinkedNode<T> {\n const node: LinkedNode<T> = {\n previous: null,\n value,\n removed: true,\n next: this._head,\n }\n this.unshiftNode(node)\n return node\n }\n\n /**\n * Prepends all the given values to the head of this list.\n * The values will maintain their order.\n *\n * E.g.\n * ```\n * list.unshiftAll(8, 9, 10) // 8, 9, 10\n * list.unshiftAll(4, 5, 6, 7) // 4, 5, 6, 7, 8, 9, 10\n * list.unshiftAll(1, 2, 3) // 1, 2, 3, 4, 5, 6, 7, 8, 9, 10\n * ```\n *\n * @param values The values to box in linked nodes.\n */\n unshiftAll(...values: T[]) {\n for (let i = values.length - 1; i >= 0; i--) {\n this.unshift(values[i])\n }\n }\n\n /**\n * Prepends the given node to the head of this list.\n * - If the node is already at the head, it will no-op.\n * - If the node is in this list, it will be removed.\n *\n * @param node The node to add or move to the head of this list.\n */\n unshiftNode(node: LinkedNode<T>) {\n if (this._head === node) return\n this.remove(node)\n node.removed = false\n node.previous = null\n node.next = this._head\n if (this._head) this._head.previous = node\n this._head = node\n if (!this._tail) this._tail = node\n }\n\n /**\n * Removes the first node (the head), returning it.\n * - If this list is empty, null is returned.\n */\n shift(): LinkedNode<T> | null {\n const node = this._head\n if (!node) return null\n this.remove(node)\n return node\n }\n\n /**\n * Removes the given linked node.\n *\n * @param node\n */\n remove(node: LinkedNode<T>): void {\n if (node.removed) return\n node.removed = true\n if (node.previous) node.previous.next = node.next\n if (node.next) node.next.previous = node.previous\n if (this._head === node) this._head = node.next\n if (this._tail === node) this._tail = node.previous\n }\n\n /**\n * Inserts the given node before pointer node.\n *\n * @param node The node to insert before pointer. If this node is currently in this list, it\n * will first be removed.\n * @param pointer The pointer node.\n */\n insertNodeBefore(node: LinkedNode<T>, pointer: LinkedNode<T>) {\n if (!node.removed && node.next === pointer) return\n this.remove(node)\n node.removed = false\n if (pointer.previous) {\n pointer.previous.next = node\n node.previous = pointer.previous\n } else {\n this._head = node\n node.previous = null\n }\n node.next = pointer\n pointer.previous = node\n }\n\n /**\n * Inserts the given node after pointer node.\n *\n * @param node The node to insert after pointer. If this node is currently in this list, it\n * will first be removed.\n * @param pointer The pointer node.\n */\n insertNodeAfter(node: LinkedNode<T>, pointer: LinkedNode<T>) {\n if (!node.removed && node.previous === pointer) return\n this.remove(node)\n node.removed = false\n if (pointer.next) {\n pointer.next.previous = node\n node.next = pointer.next\n } else {\n this._tail = node\n node.next = null\n }\n node.previous = pointer\n pointer.next = node\n }\n\n /**\n * Iterates over every element, invoking the given callback.\n *\n * @param callback\n */\n forEach(callback: (element: T) => void): void {\n let current: LinkedNode<T> | null = this._head\n while (current) {\n if (!current.removed) callback(current.value)\n current = current.next\n }\n }\n\n /**\n * Similar to `Array.prototype.some`, returns true if at least one element passes the given\n * predicate.\n *\n * @param predicate\n */\n some(predicate: (element: T) => boolean): boolean {\n let current: LinkedNode<T> | null = this._head\n while (current) {\n if (!current.removed && predicate(current.value)) return true\n current = current.next\n }\n return false\n }\n\n /**\n * Returns the first node matching the given predicate.\n *\n * @param predicate A function where, when true is returned, returns the current node.\n */\n find(predicate: (element: T) => boolean): LinkedNode<T> | null {\n let current: LinkedNode<T> | null = this._head\n while (current) {\n if (!current.removed && predicate(current.value)) return current\n current = current.next\n }\n return null\n }\n\n /**\n * Returns the last node matching the given predicate.\n *\n * @param predicate A function where, when true is returned, returns the current node.\n */\n findLast(predicate: (element: T) => boolean): LinkedNode<T> | null {\n let current: LinkedNode<T> | null = this._tail\n while (current) {\n if (!current.removed && predicate(current.value)) return current\n current = current.previous\n }\n return null\n }\n\n /**\n * Clears this list.\n */\n clear(): void {\n let current = this._head\n while (current != null) {\n const next = current.next\n current.removed = true\n current = next\n }\n this._head = null\n this._tail = null\n }\n\n /**\n * Returns a new iterator, starting at the head.\n */\n [Symbol.iterator](): IterableIterator<T> {\n return this.createIterator(this._head, null, (node) => node.next)\n }\n\n /**\n * Returns a new reversed iterable where the iterator starts at the tail, moving backwards\n * to the head.\n */\n reversed(): IterableIterator<T> {\n return this.createIterator(this._tail, null, (node) => node.previous)\n }\n\n /**\n * Creates an iterable iterator, starting at the specified node, getting the next node from\n * the next() function.\n *\n * Note that using iterators is not as performant as {@link some} or {@link forEach}\n *\n * @param start The starting node. (inclusive)\n * @param end The ending node (exclusive).\n * @param next A method that is given the current node, and returns the next node.\n */\n createIterator(\n start: LinkedNode<T> | null,\n end: LinkedNode<T> | null,\n next: (current: LinkedNode<T>) => LinkedNode<T> | null\n ): IterableIterator<T> {\n let current: LinkedNode<T> | null = start\n return {\n [Symbol.iterator](): IterableIterator<T> {\n return this\n },\n\n next: (): IteratorResult<T> => {\n if (current === end || !current) {\n return {\n value: undefined,\n done: true,\n }\n }\n\n const result = {\n value: current.value,\n done: false,\n }\n current = next(current)\n while (current?.removed) {\n current = next(current)\n }\n return result\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 type { Disposable } from '../core/disposable'\nimport type { Unsubscribe } from '../core/Unsubscribe'\nimport { LinkedList } from '../util/collection/LinkedList'\n\nexport type EventHandler<in T> = (event: T) => void\n\nexport interface SignalOptions {\n /**\n * If true, removes the handler after the first invocation.\n */\n once?: boolean\n}\n\nexport interface Signal<T> {\n /**\n * Returns true if this signal has no handlers.\n */\n readonly empty: boolean\n\n /**\n * Adds an event handler that will be invoked upon signal dispatch.\n *\n * @param handler The handler to invoke on signal dispatch.\n * @param options Options for changing listening behavior.\n * @return Unsubscribe - Returns a method where, when invoked, will remove the handler.\n * If the handler has already been removed, Unsubscribe will do nothing.\n */\n listen(handler: EventHandler<T>, options?: SignalOptions): Unsubscribe\n}\n\n/**\n * An object that may dispatch one type of event and have handlers for that event.\n */\nexport class SignalImpl<T> implements Signal<T>, Disposable {\n private handlers = new LinkedList<EventHandler<any>>()\n\n get empty(): boolean {\n return this.handlers.empty\n }\n\n listen(handler: EventHandler<T>, options?: SignalOptions): Unsubscribe {\n const remove = () => this.handlers.remove(node)\n const node = this.handlers.push(\n options?.once\n ? (event) => {\n remove()\n handler(event)\n }\n : handler\n )\n return remove\n }\n\n /**\n * Invokes all handlers, providing the given event.\n *\n * Handlers may add/remove callbacks or do a nested dispatch.\n *\n * If a handler is added within a handler, the new handler will not be invoked until the\n * next dispatch.\n *\n * @param event\n */\n dispatch(event: T): void {\n const handlers = this.handlers\n const tail = handlers.tail\n handlers.some((handler) => {\n handler(event)\n return handler === tail!.value\n })\n }\n\n /**\n * Removes all handlers.\n */\n clear(): void {\n this.handlers.clear()\n }\n\n /**\n * Same as clear.\n */\n dispose(): void {\n this.clear()\n }\n}\n\n/**\n * Constructs a new SignalImpl.\n */\nexport function signal<T>(): SignalImpl<T> {\n return new SignalImpl<T>()\n}\n\nexport const emptySignal: Signal<any> = {\n empty: true,\n\n listen(): Unsubscribe {\n return () => {}\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\n/**\n * Provides the logging prefix for all logs made by this target.\n */\nexport interface LogTarget {\n /**\n * A string prefix for all log statements made by this target.\n */\n readonly logPrefix: string\n}\n\n/**\n * A static counter for creating a locally-unique id.\n */\nlet counter = 0\n\n/**\n * Creates a unique log prefix.\n *\n * @param target Either a string or an object with a toStringTag.\n * The log prefix will append a unique counter.\n */\nexport function createLogPrefix(\n target: string | { readonly [Symbol.toStringTag]: string }\n): string {\n const name =\n typeof target === 'string' ? target : target[Symbol.toStringTag]\n return `${name}/${++counter}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Disposable } from '../core/disposable'\nimport type { EventHandler, SignalImpl, SignalOptions } from './Signal'\nimport { signal } from './Signal'\nimport type { Unsubscribe } from '../core/Unsubscribe'\nimport { getOrSet } from '../util/map/map'\nimport type { Covariant } from '../util/type'\nimport { covariant } from '../util/type'\nimport { createLogPrefix, type LogTarget } from '../logging/LogTarget'\n\nexport interface EventDispatcher<in EventMap> extends LogTarget {\n /**\n * Dispatches an event.\n *\n * @param type The key of the event within `EventMap`\n * @param event If the passed event is read-only, then it may be re-used/cached. Otherwise,\n * it should be a new event object every dispatch. If no target property is set on the event,\n * the target will be set to this host.\n */\n dispatch<K extends keyof EventMap>(type: K, event: EventMap[K]): void\n}\n\nexport interface ReadonlyEventHost<out EventMap> {\n /**\n * Adds an event handler for the given typed event.\n *\n * @param type The key representing the event type to listen for.\n * @param handler A callback to invoke when the event with the given type is dispatched.\n * @param options Options for changing listening behavior.\n * @return Returns a method, when invoked, removes the handler.\n */\n on<K extends keyof EventMap>(\n type: K,\n handler: EventHandler<EventMap[K]>,\n options?: SignalOptions\n ): Unsubscribe\n\n /**\n * Returns true if the event host has any listeners.\n */\n hasAnyListeners(): boolean\n\n /**\n * Returns true if the event host has any listeners for the given type.\n */\n hasListeners(type: keyof EventMap): boolean\n\n /**\n * Exists for EventMap type inference.\n *\n * @private\n */\n __eventMapType: Covariant<EventMap>\n}\n\n/**\n * An object that may dispatch events and have handlers for those events.\n * Similar to the DOM's `EventTarget`, this is a basic event system based on event naming.\n *\n * Some of the advantages of EventHost over EventTarget:\n * - Not all supported platforms support EventTarget construction or extension.\n * - EventTarget is designed for the DOM, with bubble and capture phases not necessary in Vinyl.\n * - Event types are strict.\n * - Events can be plain objects, no need to extend CustomEvent.\n * - Easier unsubscription and disposal; reduces the risk of memory leaks.\n *\n * EventHost supports concurrent modification, that is, handlers may be added or removed during\n * the execution of another handler.\n */\nexport interface EventHost<EventMap>\n extends ReadonlyEventHost<EventMap>, EventDispatcher<EventMap> {}\n\nexport class EventHostImpl<EventMap>\n implements EventHost<EventMap>, Disposable\n{\n get [Symbol.toStringTag](): string {\n return 'EventHostImpl'\n }\n\n readonly logPrefix = createLogPrefix(this)\n\n private readonly signals = new Map<keyof EventMap, SignalImpl<any>>()\n\n hasAnyListeners(): boolean {\n for (const value of this.signals.values()) {\n if (!value.empty) return true\n }\n return false\n }\n\n hasListeners(type: keyof EventMap): boolean {\n return this.signals.get(type)?.empty === false\n }\n\n on<K extends keyof EventMap>(\n type: K,\n handler: EventHandler<EventMap[K]>,\n options?: SignalOptions\n ): Unsubscribe {\n const sig = getOrSet(this.signals, type, () => signal<any>())\n return sig.listen(handler, options)\n }\n\n dispatch<K extends keyof EventMap>(type: K, event: EventMap[K]): void {\n this.signals.get(type)?.dispatch(event)\n }\n\n dispose(): void {\n for (const signal of this.signals.values()) signal.dispose()\n this.signals.clear()\n }\n\n __eventMapType = covariant<EventMap>()\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { type Comparator, compare } from '../comparison/compare'\nimport type { Maybe, MaybePromise, Primitive } from '../type'\nimport { IllegalArgumentError } from '../../error/IllegalArgumentError'\nimport { createTaskQueue } from '../async/TaskQueue'\n\nexport type FilterPredicateAsync<T> = (\n value: T,\n index: number,\n array: ArrayLike<T>\n) => Promise<boolean>\n\nexport type FilterPredicate<T> = (\n value: T,\n index: number,\n array: ArrayLike<T>\n) => boolean\n\n/**\n * indexOf on ArrayLike objects.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf\n */\nexport function indexOf<E>(arrayLike: ArrayLike<E>, element: E): number {\n return Array.prototype.indexOf.call(arrayLike, element)\n}\n\n/**\n * lastIndexOf on ArrayLike objects.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf\n */\nexport function lastIndexOf<E>(arrayLike: ArrayLike<E>, element: E): number {\n return Array.prototype.lastIndexOf.call(arrayLike, element)\n}\n\nexport function filter<T, S extends T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, array: ArrayLike<T>) => value is S,\n thisArg?: any\n): S[]\n\nexport function filter<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, array: ArrayLike<T>) => boolean,\n thisArg?: any\n): T[]\n\n/**\n * filter on ArrayLike objects.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter\n */\nexport function filter<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, array: ArrayLike<T>) => boolean,\n thisArg?: any\n): T[] {\n return Array.prototype.filter.call(arrayLike, predicate, thisArg)\n}\n\n/**\n * Filter an ArrayLike with an asynchronous predicate.\n *\n * Runs the predicate across all elements, then filters the elements by the booleans\n * resolved by the predicate.\n *\n * @param arrayLike The array-like object to filter\n * @param predicate Async function that tests each element\n * @param options Optional configuration object\n * @param options.simultaneous Maximum number of predicates to run simultaneously (default: 1)\n */\nexport async function filterAsync<T>(\n arrayLike: MaybePromise<ArrayLike<T>>,\n predicate: (\n value: T,\n index: number,\n array: ArrayLike<T>\n ) => Promise<boolean>,\n options?: { readonly simultaneous?: number }\n): Promise<T[]> {\n const results = await mapAsync(arrayLike, predicate, options)\n return filter(await arrayLike, (_, index) => results[index])\n}\n\n/**\n * map on ArrayLike objects.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map\n */\nexport function map<T, U>(\n arrayLike: ArrayLike<T>,\n transform: (value: T, index: number, array: ArrayLike<T>) => U,\n thisArg?: any\n): U[] {\n return Array.prototype.map.call(arrayLike, transform, thisArg) as U[]\n}\n\n/**\n * Map on ArrayLike objects with an asynchronous transformer.\n *\n * @param arrayLike The array-like object to transform\n * @param transform Async function that transforms each element\n * @param options Optional configuration object\n * @param options.simultaneous Maximum number of transforms to run simultaneously (default: 1)\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map\n */\nexport async function mapAsync<T, U>(\n arrayLike: MaybePromise<ArrayLike<T>>,\n transform: (value: T, index: number, array: ArrayLike<T>) => Promise<U>,\n options?: { readonly simultaneous?: number }\n): Promise<U[]> {\n const resolvedArray = await arrayLike\n const { simultaneous = 1 } = options || {}\n\n if (simultaneous >= resolvedArray.length) {\n return Promise.all(map(resolvedArray, transform))\n }\n\n const results: U[] = new Array(resolvedArray.length)\n const queue = createTaskQueue()\n queue.simultaneous = simultaneous\n\n const tasks = map(resolvedArray, (value, index) =>\n queue.enqueue(() =>\n transform(value, index, resolvedArray).then((result) => {\n results[index] = result\n })\n )\n )\n\n await Promise.all(tasks)\n return results\n}\n\n/**\n * Determines whether all the members of an array satisfy the specified test.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every\n */\nexport function every<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, array: ArrayLike<T>) => boolean,\n thisArg?: any\n): boolean {\n return Array.prototype.every.call(arrayLike, predicate, thisArg)\n}\n\n/**\n * Determines whether any the members of an array satisfy the specified test.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some\n */\nexport function some<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, array: ArrayLike<T>) => boolean,\n thisArg?: any\n): boolean {\n return Array.prototype.some.call(arrayLike, predicate, thisArg)\n}\n\n/**\n * Determines whether all the members of an array satisfy the specified asynchronous test.\n *\n * @param arrayLike The array-like object to test\n * @param predicate Async function that tests each element\n * @param options Optional configuration object\n * @param options.simultaneous Maximum number of predicates to run simultaneously (default: 1)\n */\nexport async function everyAsync<T>(\n arrayLike: MaybePromise<ArrayLike<T>>,\n predicate: (\n value: T,\n index: number,\n array: ArrayLike<T>\n ) => Promise<boolean>,\n options?: { readonly simultaneous?: number }\n): Promise<boolean> {\n const resolvedArray = await arrayLike\n\n const chunks = chunk(resolvedArray, options?.simultaneous ?? 1)\n let index = 0\n\n for (const chunkArray of chunks) {\n const chunkPromises = chunkArray.map((value, chunkIndex) =>\n predicate(value, index + chunkIndex, resolvedArray)\n )\n const chunkResults = await Promise.all(chunkPromises)\n if (chunkResults.some((result) => !result)) {\n return false\n }\n index += chunkArray.length\n }\n return true\n}\n\n/**\n * Determines whether any the members of an array satisfy the specified asynchronous test.\n *\n * @param arrayLike The array-like object to test\n * @param predicate Async function that tests each element\n * @param options Optional configuration object\n * @param options.simultaneous Maximum number of predicates to run simultaneously (default: 1)\n */\nexport async function someAsync<T>(\n arrayLike: MaybePromise<ArrayLike<T>>,\n predicate: (\n value: T,\n index: number,\n array: ArrayLike<T>\n ) => Promise<boolean>,\n options?: { readonly simultaneous?: number }\n): Promise<boolean> {\n return !(await everyAsync(\n arrayLike,\n async (value, index, array) => !(await predicate(value, index, array)),\n options\n ))\n}\n\n/**\n * forEach on ArrayLike objects.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach\n */\nexport function forEach<T>(\n arrayLike: ArrayLike<T>,\n action: (value: T, index: number, array: ArrayLike<T>) => void,\n thisArg?: any\n): void {\n return Array.prototype.forEach.call(arrayLike, action, thisArg)\n}\n\n/**\n * Executes an asynchronous function on each element in an array.\n *\n * @param arrayLike The array-like object to iterate over\n * @param executor Async function to execute for each element\n * @param options Optional configuration object\n * @param options.simultaneous Maximum number of executors to run simultaneously (default: 1)\n */\nexport function forEachAsync<T>(\n arrayLike: MaybePromise<ArrayLike<T>>,\n executor: (value: T, index: number, array: ArrayLike<T>) => Promise<void>,\n options?: { readonly simultaneous?: number }\n): Promise<void> {\n return mapAsync(arrayLike, executor, options).then()\n}\n\nexport function find<T, S extends T>(\n arrayLike: ArrayLike<T>,\n predicate: (this: void, value: T, index: number, obj: T[]) => value is S,\n thisArg?: any\n): S | undefined\n\nexport function find<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, obj: T[]) => boolean,\n thisArg?: any\n): T | undefined\n\n/**\n * find on ArrayLike objects\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find\n */\nexport function find<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, obj: T[]) => boolean,\n thisArg?: any\n): T | undefined {\n return Array.prototype.find.call(arrayLike, predicate, thisArg)\n}\n\n/**\n * findIndex on ArrayLike objects\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex\n */\nexport function findIndex<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, obj: ArrayLike<T>) => unknown,\n thisArg?: any\n): number {\n return Array.prototype.findIndex.call(arrayLike, predicate, thisArg)\n}\n\n/**\n * Returns the first element of an ArrayLike.\n */\nexport function first<T>(arrayLike: Maybe<ArrayLike<T>>): T | undefined {\n if (!arrayLike) return undefined\n return arrayLike[0]\n}\n\n/**\n * Returns the last element of an ArrayLike.\n */\nexport function last<T>(arrayLike: Maybe<ArrayLike<T>>): T | undefined {\n if (!arrayLike) return undefined\n return arrayLike[arrayLike.length - 1]\n}\n\n/**\n * Returns the first `count` elements of an ArrayLike.\n * @param arrayLike\n * @param count\n */\nexport function takeFirst<T>(arrayLike: ArrayLike<T>, count: number): T[] {\n if (count <= 0) return []\n return Array.prototype.slice.call(arrayLike, 0, count)\n}\n\n/**\n * Returns the last `count` elements of an ArrayLike.\n *\n * @param arrayLike\n * @param count\n */\nexport function takeLast<T>(arrayLike: ArrayLike<T>, count: number): T[] {\n if (count <= 0) return []\n return Array.prototype.slice.call(arrayLike, -count)\n}\n\n/**\n * Returns a subsection of an array-like.\n * For both start and end, a negative index can be used to indicate an offset from the end of\n * the array.\n * For example, -2 refers to the second to last element of the array.\n *\n * @param arrayLike An ArrayLike to copy.\n * @param start The beginning index of the array-like. Default: 0\n * @param end The end index of the specified portion of the array-like (exclusive). Default: length\n */\nexport function slice<T>(\n arrayLike: ArrayLike<T>,\n start?: number,\n end?: number\n): T[] {\n return Array.prototype.slice.call(arrayLike, start, end)\n}\n\n/**\n * Removes an element from the array, returning true if it was found.\n */\nexport function remove<T>(array: T[], element: T): boolean {\n const index = array.indexOf(element)\n if (index === -1) return false\n array.splice(index, 1)\n return true\n}\n\n/**\n * Removes an element from the array at the given index, returning the removed element if the index\n * was within range.\n * @param array The Array to update.\n * @param index If negative, will remove from the end of the list (-1 is last element), if\n * greater than or equal to the list length, undefined will be returned.\n */\nexport function removeAt<T>(array: T[], index: number): T | undefined {\n return array.splice(index, 1)[0]\n}\n\n/**\n * Returns the index of the first element in the given array with the highest value according to\n * the comparator.\n * @param array\n * @param comparator\n */\nexport function indexOfHighest<T>(\n array: ArrayLike<T>,\n comparator: Comparator<T>\n): number {\n if (array.length === 0) return -1\n let highestIndex = 0\n let highest = array[highestIndex]\n for (let i = 1; i < array.length; i++) {\n const current = array[i]\n if (comparator(current, highest) > 0) {\n highest = current\n highestIndex = i\n }\n }\n return highestIndex\n}\n\n/**\n * Returns the index of the last element in the given array with the highest value according to\n * the comparator.\n * To find the index of the lowest value, use `util.comparator.reversed`\n * @param array\n * @param comparator\n */\nexport function lastIndexOfHighest<T>(\n array: ArrayLike<T>,\n comparator: Comparator<T>\n): number {\n if (array.length === 0) return -1\n let highestIndex = array.length - 1\n let highest = array[highestIndex]\n for (let i = array.length - 2; i >= 0; i--) {\n const current = array[i]\n if (comparator(current, highest) > 0) {\n highest = current\n highestIndex = i\n }\n }\n return highestIndex\n}\n\n/**\n * Given an array using the given comparator function, finds the insertion index of an element.\n *\n * @param array An array sorted using the comparator.\n * @param element The element to compare against array elements.\n * @param comparator A function where given the return value of `comparator(element, array[i])`\n * if less than zero the returned index will be before i, otherwise after.\n * @param start The starting index (inclusive). Default: 0\n * @param end The ending index (exclusive). Default: array.length\n */\nexport function sortedInsertionIndex<T, U = T>(\n array: ArrayLike<T>,\n element: U,\n comparator: Comparator<U, T>,\n start = 0,\n end = array.length\n): number {\n let indexA = start\n let indexB = end\n while (indexA < indexB) {\n const midIndex = (indexA + indexB) >>> 1\n const comparison = comparator(element, array[midIndex])\n if (comparison < 0) {\n indexB = midIndex\n } else {\n indexA = midIndex + 1\n }\n }\n return indexA\n}\n\n/**\n * Creates an iterator for an ArrayLike.\n * If the given ArrayLike is iterable, then use its provided iterator.\n *\n * @param arrayLike\n */\nexport function createArrayLikeIterator<T>(\n arrayLike: ArrayLike<T>\n): IterableIterator<T> {\n if (Symbol.iterator in arrayLike)\n return (arrayLike as Iterable<T>)[\n Symbol.iterator\n ]() as IterableIterator<T>\n\n let currentIndex = 0\n return {\n [Symbol.iterator](): IterableIterator<T> {\n return createArrayLikeIterator(arrayLike)\n },\n\n next: (): IteratorResult<T> => {\n if (currentIndex >= arrayLike.length) {\n return {\n value: undefined,\n done: true,\n }\n }\n return {\n value: arrayLike[currentIndex++],\n done: false,\n }\n },\n }\n}\n\n/**\n * Gets the element in the ArrayLike at the given index, or throws an IllegalArgumentError if out of range.\n */\nexport function getElementAt<T>(array: ArrayLike<T>, index: number): T {\n const n = array.length\n if (index >= 0 && index < n) {\n return array[index]\n }\n throw new IllegalArgumentError(`index ${index} is out of range 0-${n}`)\n}\n\n/**\n * Gets the element in the ArrayLike at the given index, or returns the provided default value.\n */\nexport function getElementOrDefault<T, V>(\n array: ArrayLike<T>,\n index: number,\n defaultValue: V\n): T | V {\n const n = array.length\n if (index >= 0 && index < n) {\n return array[index]\n }\n return defaultValue\n}\n\n/**\n * Counts the number of elements in an array that return true when passed to a predicate function.\n *\n * @param array\n * @param predicate\n */\nexport function countElements<T>(\n array: ArrayLike<T>,\n predicate: (value: T, index: number, obj: ArrayLike<T>) => boolean\n): number {\n let count = 0\n const n = array.length\n for (let i = 0; i < n; i++) {\n if (predicate(array[i], i, array)) {\n count++\n }\n }\n return count\n}\n\n/**\n * Splits an array into chunks of the specified size.\n *\n * @param array The array to chunk\n * @param chunkSize Maximum size of each chunk\n * @returns Array of chunks\n */\nexport function chunk<T>(array: ArrayLike<T>, chunkSize: number): T[][] {\n const chunks: T[][] = []\n for (let i = 0; i < array.length; i += chunkSize) {\n chunks.push(slice(array, i, i + chunkSize))\n }\n return chunks\n}\n\nexport function min<T extends Exclude<Primitive, symbol>>(\n arrayLike: ArrayLike<T>\n): T | undefined\nexport function min<T>(\n arrayLike: ArrayLike<T>,\n comparator: Comparator<T>\n): T | undefined\n\n/**\n * Finds the minimum value in an array of comparable elements.\n * @param arrayLike The array-like object to search\n * @param comparator Optional comparator function\n */\nexport function min<T>(\n arrayLike: ArrayLike<T>,\n comparator?: Comparator<T>\n): T | undefined {\n if (arrayLike.length === 0) return undefined\n\n let minValue = arrayLike[0]\n if (!comparator) comparator = compare as Comparator<T>\n for (let i = 1; i < arrayLike.length; i++) {\n if (comparator(arrayLike[i], minValue) < 0) {\n minValue = arrayLike[i]\n }\n }\n return minValue\n}\n\nexport function max<T extends Exclude<Primitive, symbol>>(\n arrayLike: ArrayLike<T>\n): T | undefined\nexport function max<T>(\n arrayLike: ArrayLike<T>,\n comparator: Comparator<T>\n): T | undefined\n\n/**\n * Finds the maximum value in an array of comparable elements.\n * @param arrayLike The array-like object to search\n * @param comparator Optional comparator function\n */\nexport function max<T>(\n arrayLike: ArrayLike<T>,\n comparator?: Comparator<T>\n): T | undefined {\n if (arrayLike.length === 0) return undefined\n\n let maxValue = arrayLike[0]\n if (!comparator) comparator = compare as Comparator<T>\n for (let i = 1; i < arrayLike.length; i++) {\n if (comparator(arrayLike[i], maxValue) > 0) {\n maxValue = arrayLike[i]\n }\n }\n return maxValue\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'\n\n/**\n * Returns an array of numbers between start and end, incrementing by step.\n *\n * E.g.\n * ```\n * range(1, 10) // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n * range(5, 2) // [5, 4, 3, 2]\n * range(5, 4, -0.2) // [5.0, 4.8, 4.6, 4.4, 4.2, 4.0]\n * ```\n * @param start Start position (inclusive)\n * @param endInclusive End position (inclusive)\n * @param step The amount to increment.\n */\nexport function createRangeIter(\n start: number,\n endInclusive: number,\n step = 1\n): IterableIterator<number> {\n const positive = endInclusive >= start\n if (\n (endInclusive > start && step <= 0) ||\n (endInclusive < start && step >= 0)\n ) {\n throw new IllegalArgumentError('Iterator will never complete.')\n }\n let i = start\n return {\n [Symbol.iterator](): IterableIterator<number> {\n return this\n },\n\n next: (): IteratorResult<number> => {\n const result = {\n value: i,\n done: positive ? i > endInclusive : i < endInclusive,\n }\n i += step\n return result\n },\n }\n}\n\n/**\n * Maps an iterable object using the given transform.\n * Unlike `Array#map`, this doesn't create a new Array in memory, the transform is done on\n * iteration.\n *\n * @param iterable\n * @param transform Transforms each element as it's requested.\n */\nexport function mapIter<T, U>(\n iterable: Iterable<T>,\n transform: (element: T) => U\n): IterableIterator<U> {\n const it: Iterator<T> = iterable[Symbol.iterator]()\n return {\n [Symbol.iterator](): IterableIterator<U> {\n return mapIter(iterable, transform)\n },\n next: (): IteratorResult<U> => {\n const result = it.next()\n if (result.done) return result\n return {\n value: transform(result.value),\n done: false,\n }\n },\n }\n}\n\nexport function filterIter<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T) => value is S\n): IterableIterator<S>\n\nexport function filterIter<T>(\n iterable: Iterable<T>,\n predicate: (value: T) => boolean\n): IterableIterator<T>\n\n/**\n * Filters an iterable object using the given predicate.\n * Unlike `Array#filter`, this doesn't create a new Array in memory, the filter is done on\n * iteration.\n *\n * @param iterable\n * @param predicate Returns true if the element should be included in the new iteration.\n */\nexport function filterIter<T>(\n iterable: Iterable<T>,\n predicate: (value: T) => boolean\n): IterableIterator<T> {\n const it = iterable[Symbol.iterator]()\n return {\n [Symbol.iterator](): IterableIterator<T> {\n return filterIter(iterable, predicate)\n },\n\n next: (): IteratorResult<T> => {\n while (true) {\n const next = it.next()\n if (next.done) {\n return {\n value: undefined,\n done: true,\n }\n } else if (predicate(next.value)) {\n return {\n value: next.value,\n done: false,\n }\n }\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 { ReportableError } from './ReportableError'\n\n/**\n * An error indicating an unexpected state.\n */\nexport class IllegalStateError extends ReportableError {\n get [Symbol.toStringTag](): string {\n return 'IllegalStateError'\n }\n\n constructor(message: string) {\n super(message)\n Object.setPrototypeOf(this, IllegalStateError.prototype)\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 { CacheMap } from './CacheMap'\nimport { mapIter } from '../iteration/iterable'\nimport type { LinkedNode } from './LinkedList'\nimport { LinkedList } from './LinkedList'\nimport { IllegalStateError } from '../../error/IllegalStateError'\n\n/**\n * An LRU Cache implementation.\n * An LRU (Least Recently Used) Cache is a Map with a fixed capacity. When the capacity is\n * exceeded, the least recently used element will be removed.\n * An element is considered to be used when it has been retrieved via `get`, or when it's been\n * `set`.\n * Iteration does not affect ordering.\n */\nexport class LruCache<K, V> implements CacheMap<K, V> {\n /**\n * A map of the list nodes.\n *\n * @private\n */\n private cache: Map<K, LinkedNode<[K, V]>> = new Map()\n\n /**\n * Most recently used elements are at the tail, least recently used are at the head.\n * @private\n */\n private list = new LinkedList<[K, V]>()\n\n /**\n * An element is about to be removed. Should return true if the element may be evicted,\n * otherwise false.\n * If false is returned for all elements, an IllegalStateError is thrown.\n */\n onEvicting: ((element: V, key: K, list: CacheMap<K, V>) => boolean) | null =\n null\n\n /**\n * When an element is added when at capacity, the least recently used element will be removed.\n * This callback can be set to be notified with the element being evicted, which may be used\n * for disposal.\n */\n onEvict: ((element: V, key: K, list: CacheMap<K, V>) => void) | null = null\n\n private _capacity = 0\n\n constructor(initialCapacity: number) {\n this._capacity = initialCapacity\n }\n\n get capacity(): number {\n return this._capacity\n }\n\n set capacity(value: number) {\n this._capacity = value\n while (this.cache.size > this.capacity) {\n this.evictLeastRecentlyUsed()\n }\n }\n\n /**\n * @returns the number of elements in the Map.\n */\n get size(): number {\n return this.cache.size\n }\n\n /**\n * @returns boolean indicating whether an element with the specified key exists or not.\n */\n has(key: K): boolean {\n return this.cache.has(key)\n }\n\n /**\n * Returns the mapped value for the given key, and moves the element to the most recently\n * used position.\n *\n * @returns Returns the element associated with the given key, or undefined if no such\n * element exists.\n */\n get(key: K): V | undefined {\n const node = this.cache.get(key)\n if (!node) return undefined\n this.list.pushNode(node)\n return node.value[1]\n }\n\n /**\n * Adds a new element with a specified key and value to the Map. If an element with the\n * same key already exists, the element will be updated and position moved to most recently\n * used.\n */\n set(key: K, value: V): this {\n if (this.has(key)) {\n const node = this.cache.get(key)!\n node.value[1] = value\n this.list.pushNode(node)\n } else {\n const node = this.list.push([key, value])\n this.cache.set(key, node)\n if (this.cache.size > this.capacity) {\n this.evictLeastRecentlyUsed()\n }\n }\n return this\n }\n\n private evictLeastRecentlyUsed() {\n let node = this.list.head\n while (node) {\n const [key, value] = node.value\n const allowed =\n this.onEvicting?.call(null, value, key, this) ?? true\n if (allowed) break\n node = node.next\n }\n if (!node)\n throw new IllegalStateError(\n 'onEvicting returned false for all elements'\n )\n const [key, value] = node.value\n this.list.remove(node)\n this.cache.delete(node.value[0])\n this.onEvict?.call(null, value, key, this)\n }\n\n /**\n * Clears all elements from the cache.\n */\n clear(): void {\n this.list.clear()\n this.cache.clear()\n }\n\n /**\n * @returns true if an element in the Map existed and has been removed, or false if the element does not exist.\n */\n delete(key: K): boolean {\n if (!this.has(key)) return false\n const node = this.cache.get(key)!\n this.cache.delete(key)\n this.list.remove(node)\n return true\n }\n\n /**\n * Executes a provided function once per each key/value pair in the Map, in insertion order.\n *\n * @param callback A callback to invoke for every element in the cache.\n * @param thisArg Value to use as this when executing callback\n */\n forEach(\n callback: (value: V, key: K, map: this) => void,\n thisArg?: any\n ): void {\n return this.list.forEach((entry) => {\n callback.call(thisArg, entry[1], entry[0], this)\n })\n }\n\n /**\n * Returns an iterable of key, value pairs for every entry in the map.\n */\n entries(): IterableIterator<[K, V]> {\n return this[Symbol.iterator]()\n }\n\n /**\n * Returns an iterable of keys in the map. This will be ordered from least recently used to\n * most.\n */\n keys(): IterableIterator<K> {\n return mapIter(this.list, ([key]) => key)\n }\n\n /**\n * Returns an iterable of values in the map. This will be ordered from least recently used to\n * most.\n */\n values(): IterableIterator<V> {\n return mapIter(this.list, ([, value]) => value)\n }\n\n [Symbol.iterator](): IterableIterator<[K, V]> {\n return this.list[Symbol.iterator]()\n }\n\n get [Symbol.toStringTag](): string {\n return 'LruCache'\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { LruCache } from '../collection/LruCache'\nimport { getOrSet } from '../map/map'\nimport type { Fun } from '../type'\n\nexport interface MemoizedFunction {\n clear(): void\n}\n\n/**\n * Returns a wrapper function where when called, retains the return value of `inner`, returning that\n * value on consecutive calls without invoking `inner` again.\n *\n * @param inner The function to memoize results.\n * @return Returns a memoized function with a `clear` method to reset the cached value.\n */\nexport function memoize<T extends () => any>(inner: T): MemoizedFunction & T\n\n/**\n * Returns a wrapper function where when called, retains the return value of `inner`, returning that\n * value on consecutive calls without invoking `inner` again.\n *\n * @param inner The function to memoize results.\n * @param keyProvider When more than one parameter is expected, a keyProvider is required, which\n * returns a unique key given the arguments provided to the memoized function.\n * @param capacity\n * @return Returns a memoized function with a `clear` method to reset the cache.\n */\nexport function memoize<T extends Fun>(\n inner: T,\n keyProvider: (...args: Parameters<T>) => any,\n capacity?: number\n): MemoizedFunction & T\n\nexport function memoize<T extends Fun>(\n inner: T,\n keyProvider?: (...args: Parameters<T>) => any,\n capacity = 500\n): MemoizedFunction & T {\n if (!keyProvider) {\n let cached = false\n let value: ReturnType<T> | undefined = undefined\n const memoized = (): ReturnType<T> => {\n if (!cached) {\n cached = true\n value = inner()\n }\n return value as ReturnType<T>\n }\n return Object.assign(\n memoized as T,\n {\n clear: () => {\n cached = false\n value = undefined\n },\n } as const\n )\n } else if (capacity === 0) {\n const memoized = (...args: Parameters<T>): ReturnType<T> =>\n inner(...args)\n return Object.assign(\n memoized as T,\n {\n clear: () => {},\n } as const\n )\n } else if (capacity === 1) {\n let hasValue = false\n let cachedKey: any\n let cachedValue: ReturnType<T>\n const memoized = (...args: Parameters<T>): ReturnType<T> => {\n const key = keyProvider(...args)\n if (!hasValue || cachedKey !== key) {\n hasValue = true\n cachedKey = key\n cachedValue = inner(...args)\n }\n return cachedValue\n }\n return Object.assign(\n memoized as T,\n {\n clear: () => {\n hasValue = false\n },\n } as const\n )\n } else {\n const cache = new LruCache<any, ReturnType<T>>(capacity)\n const memoized = (...args: Parameters<T>): ReturnType<T> => {\n const key = keyProvider(...args)\n return getOrSet(cache, key, () => inner(...args))\n }\n return Object.assign(\n memoized as T,\n {\n clear: () => {\n cache.clear()\n },\n } as const\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 } 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 * `<Hello to y'all!>` 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 &\n * ' to '\n * > to >\n * < to <\n * \" to "\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\nimport type { Maybe } from '../type'\n\n/**\n * Returns true if the given string is 'true' or '1'\n *\n * @param str\n */\nexport function parseBoolean(str: Maybe<string>): boolean {\n return str === 'true' || str === '1'\n}\n\n/**\n * Returns the toString() value of the given object.\n *\n * @param value\n */\nexport function stringify(value: any): string {\n if (value === null) return 'null'\n if (value === undefined) return 'undefined'\n return value.toString()\n}\n\n/**\n * Parses a string into an integer.\n * If the string is nullish, empty, or is not a finite number, returns null.\n */\nexport function parseIntSafe(\n str: Maybe<string>,\n radix?: number\n): number | null {\n if (!str) return null\n const value = parseInt(str, radix)\n if (!Number.isFinite(value)) return null\n return value\n}\n\n/**\n * Parses a string into a number.\n * If the string is nullish, empty, or is not a finite number, returns null.\n */\nexport function parseFloatSafe(str: Maybe<string>): number | null {\n if (!str) return null\n const value = parseFloat(str)\n if (!Number.isFinite(value)) return null\n return value\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IllegalStateError } from '../error/IllegalStateError'\nimport type { Unsubscribe } from './Unsubscribe'\nimport type { Maybe } from '../util/type'\n\n/**\n * Any object that may be disposed.\n */\nexport interface Disposable {\n dispose(): void\n}\n\n/**\n * Returns true if the given value is disposable.\n *\n * @param value Any value. The value will be considered Disposable if it contains a method named\n * 'dispose', and that function requires zero parameters. This value will be type guarded to\n * Disposable if true is returned.\n */\nexport function isDisposable(value: any): value is Disposable {\n return (\n value != null &&\n typeof value.dispose === 'function' &&\n value.dispose.length === 0\n )\n}\n\n/**\n * Disposes all the given {@link Disposable} objects.\n *\n * @param disposables\n */\nexport function disposeAll(disposables: Iterable<Disposable>): void {\n for (const disposable of disposables) {\n disposable.dispose()\n }\n}\n\n/**\n * Returns a Disposable that invokes the given function on dispose.\n *\n * @param unsub\n */\nexport function toDisposable(unsub: () => void): Disposable {\n return { dispose: unsub }\n}\n\nexport type AddDisposable = <T extends Maybe<Disposable | Unsubscribe>>(\n disposable: T\n) => T\n\n/**\n * A Disposer disposes added disposables as a group.\n * The method members may be called without a receiver.\n */\nexport interface Disposer extends Disposable {\n readonly disposed: boolean\n readonly add: AddDisposable\n readonly dispose: () => void\n}\n\n/**\n * Creates a Disposer, an object on which {@link Disposable} instances may be added, and disposed\n * as a group.\n *\n * The method members may be called without a receiver, thus allowing destructuring.\n * Example:\n * ```\n * function create(): Disposable {\n * const { dispose, add } = disposer()\n * add(someDisposable)\n * add(anotherDisposable)\n * return {\n * dispose\n * }\n * }\n * ```\n *\n */\nexport function createDisposer(): Disposer {\n const disposables: Disposable[] = []\n let _disposed = false\n const add = <T extends Maybe<Unsubscribe | Disposable>>(\n disposableOrUnsub: T\n ): T => {\n if (_disposed) throw new DisposedError()\n if (disposableOrUnsub) {\n disposables.push(\n 'dispose' in disposableOrUnsub\n ? disposableOrUnsub\n : toDisposable(disposableOrUnsub)\n )\n }\n return disposableOrUnsub\n }\n return {\n dispose() {\n if (_disposed) throw new DisposedError()\n _disposed = true\n disposeAll(disposables)\n },\n add,\n get disposed() {\n return _disposed\n },\n }\n}\n\n/**\n * An illegal state error indicating that an object has been disposed.\n */\nexport class DisposedError extends IllegalStateError {\n get [Symbol.toStringTag](): string {\n return 'DisposedError'\n }\n\n constructor(message = 'Instance is disposed') {\n super(message)\n Object.setPrototypeOf(this, DisposedError.prototype)\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { isDisposable } from '../core/disposable'\nimport { IllegalStateError } from '../error/IllegalStateError'\nimport { remove } from '../util/collection/array'\nimport type { Maybe } from '../util/type'\n\n/**\n * Manages global initializers.\n */\nexport class GlobalRegistry {\n private registry: GlobalRef<any>[] = []\n\n /**\n * Returns the number of references currently in the registry.\n */\n get size(): number {\n return this.registry.length\n }\n\n /**\n * Registers an initializer that will be invoked during global state initialization.\n * @param initializer\n */\n register<T extends GlobalRef<any>>(initializer: T): T {\n this.registry.push(initializer)\n return initializer\n }\n\n /**\n * Removes a global ref from the registry.\n * May be called at any time.\n * @param ref\n * @return Returns true if the global ref was removed.\n */\n unregister(ref: GlobalRef<any>): boolean {\n return remove(this.registry, ref)\n }\n\n /**\n * Resets all registered initializers and sets this registry back to its pre-initialized state.\n * This is typically only done within unit tests, but may be called if all players are\n * disposed and the consumer intends to teardown global state.\n */\n reset() {\n for (const registryElement of this.registry) {\n registryElement.reset()\n }\n }\n}\n\nlet _registry: GlobalRegistry | null = null\n\n/**\n * Gets or creates the global registry instance.\n */\nexport function getGlobalRegistry(): GlobalRegistry {\n if (!_registry) _registry = new GlobalRegistry()\n return _registry\n}\n\nexport interface GlobalRef<T> {\n /**\n * True if this has been initialized.\n */\n readonly initialized: boolean\n\n /**\n * Returns the factory-produced value.\n * Throws an {@link IllegalStateError} if the global registry has not been initialized.\n */\n readonly value: T\n\n /**\n * Overrides this initializer.\n * The previous initializer will be provided as an argument for extension.\n *\n * Throws an {@link IllegalStateError} if the global registry has been initialized.\n * @return Returns this\n */\n set(newInitializer: (previousInitializer: () => T) => T): GlobalRef<T>\n\n /**\n * Resets this initializer back to its pre-initialized state.\n * If the initializer produced a disposable value, it will be disposed.\n */\n reset(): void\n\n /**\n * Initializes the global ref.\n * This is done automatically on first use of `value`, but may be initialized eagerly.\n */\n initialize(): void\n}\n\n/**\n * When set, GlobalRefImpl records a stack trace each time it is initialized,\n * so a later \"Cannot call when initialized\" error can include the stack of\n * whoever last touched the ref. Used to diagnose async leakage between specs.\n *\n * Tests opt in via setGlobalRefDebug(true).\n */\nlet globalRefDebug = false\n\nexport function setGlobalRefDebug(enabled: boolean): void {\n globalRefDebug = enabled\n}\n\nexport class GlobalRefImpl<T> implements GlobalRef<T> {\n private _value: T | undefined\n private _initialized = false\n private constructing = false\n private initializer: () => T\n private lastInitStack: Maybe<string> = null\n\n constructor(private readonly defaultInitializer: () => T) {\n this.initializer = defaultInitializer\n }\n\n get initialized(): boolean {\n return this._initialized\n }\n\n get value(): T {\n this.initialize()\n return this._value!\n }\n\n reset(): void {\n this.initializer = this.defaultInitializer\n if (!this._initialized) return\n this.assertNotConstructing()\n this._initialized = false\n this.lastInitStack = null\n if (isDisposable(this._value)) {\n this._value.dispose()\n }\n this._value = undefined\n }\n\n initialize(): void {\n if (this._initialized) return\n this.assertNotConstructing()\n this.constructing = true\n try {\n this._value = this.initializer()\n } catch (error) {\n this.constructing = false\n throw error\n }\n this.constructing = false\n this._initialized = true\n if (globalRefDebug) {\n this.lastInitStack = new Error('globalRef initialized').stack\n }\n }\n\n set(newInitializer: (previousInitializer: () => T) => T): GlobalRef<T> {\n this.assertNotInitialized()\n const overriddenInitializer = () => {\n return newInitializer(this.defaultInitializer)\n }\n this.initializer = overriddenInitializer\n return new GlobalRefOverride(\n this,\n overriddenInitializer,\n (newInitializer) => {\n this.initializer = newInitializer\n }\n )\n }\n\n private assertNotInitialized() {\n if (this._initialized) {\n const detail = this.lastInitStack\n ? `\\nLast initialized at:\\n${this.lastInitStack}`\n : ''\n throw new IllegalStateError(`Cannot call when initialized${detail}`)\n }\n }\n\n private assertNotConstructing() {\n if (this.constructing)\n throw new IllegalStateError('Cannot call during construction')\n }\n}\n\nclass GlobalRefOverride<T> implements GlobalRef<T> {\n private initializer: () => T\n\n constructor(\n private readonly original: GlobalRef<T>,\n private readonly defaultInitializer: () => T,\n private readonly setInitializer: (value: () => T) => void\n ) {\n this.initializer = defaultInitializer\n }\n\n get initialized(): boolean {\n return this.original.initialized\n }\n\n get value(): T {\n return this.original.value\n }\n\n initialize(): void {\n this.setInitializer(this.initializer)\n this.original.initialize()\n }\n\n reset(): void {\n this.initializer = this.defaultInitializer\n this.original.reset()\n this.setInitializer(this.initializer)\n }\n\n set(newInitializer: (previousInitializer: () => T) => T): GlobalRef<T> {\n const overriddenInitializer = () => {\n return newInitializer(this.defaultInitializer)\n }\n this.initializer = overriddenInitializer\n this.setInitializer(overriddenInitializer)\n return new GlobalRefOverride(\n this,\n overriddenInitializer,\n this.setInitializer\n )\n }\n}\n\n/**\n * Creates a global reference that can be lazily initialized.\n * This function is tree-shakable as it doesn't perform any side effects on import.\n *\n * @param init Factory function that creates the value\n */\nexport function globalRef<T>(init: () => T): GlobalRef<T> {\n return getGlobalRegistry().register(new GlobalRefImpl(init))\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An interface that may be implemented to provide custom clone behavior.\n */\nexport interface Cloneable<T> {\n /**\n * Produces a copy of this object.\n */\n clone(): T\n}\n\n/**\n * Returns true if the given value implements Cloneable.\n */\nexport function isCloneable<T>(value: T): value is T & Cloneable<T> {\n return (\n value != null &&\n typeof value === 'object' &&\n 'clone' in value &&\n typeof value.clone === 'function' &&\n value.clone.length === 0\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 { 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\nlet _isNode: boolean | null = null\n\n/**\n * Returns true if this is a nodejs environment.\n */\nexport function isNode(): boolean {\n if (_isNode === null) {\n _isNode =\n typeof process !== 'undefined' &&\n 'versions' in process &&\n typeof process.versions.node === 'string'\n }\n return _isNode\n}\n/**\n * Node's global setTimeout differs slightly from the browser. Use this when storing timeout ids.\n */\nexport type TimeoutId = ReturnType<typeof setTimeout>\n\n/**\n * A subset of `Location` properties available in all environments.\n */\nexport interface PartialLocation {\n readonly origin: string\n readonly search: string\n readonly href: string\n}\n\n/**\n * Returns the global `location` object, or a default with empty values\n * when `location` is not defined (e.g. Node, Web Workers).\n */\nexport function getLocation(): PartialLocation {\n return typeof location === 'object' ? location : defaultLocation\n}\n\nconst defaultLocation: PartialLocation = {\n origin: '',\n search: '',\n href: '',\n}\n\n/**\n * Node's global setInterval differs slightly from the browser. Use this when storing interval ids.\n */\nexport type IntervalId = ReturnType<typeof setInterval>\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { memoize } from '../fun/memoize'\nimport { getLocation } from '../../global/environment'\n\n/**\n * Returns a `URLSearchParams` object for the given search substring. This is memoized for the\n * last search provided.\n * @param search (Optional) The window's search substring. Defaults to `location.search`, overridden\n * only for unit tests.\n */\nexport const getSearchParams = memoize(\n (search: string = getLocationSearch()): URLSearchParams => {\n const url = new URL('about:blank')\n url.search = search\n // Uses `URL.searchParams` over `new URLSearchParams`; URLSearchParams constructor is not\n // as widely supported.\n return url.searchParams\n },\n (search: string = getLocationSearch()) => search,\n 1\n)\n\n/**\n * If the environment has a `location` object, returns the location's search. Otherwise,\n * an empty string.\n */\nexport function getLocationSearch(): string {\n return getLocation().search\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n getLocationSearch,\n getSearchParams,\n} from '../util/browser/searchParams'\nimport { LogLevel, parseLogLevel } from './Logger'\n\n/**\n * Returns the current vinyl logging level, as set by the querystring parameter: vinylLogLevel.\n * @param search\n * @param defaultLevel\n */\nexport function getLogLevelFromSearch(\n search: string = getLocationSearch(),\n defaultLevel: LogLevel = LogLevel.WARN\n): LogLevel {\n const str = getSearchParams(search).get('vinylLogLevel')\n if (!str) return defaultLevel\n return parseLogLevel(str) ?? defaultLevel\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ReadonlyEventHost } from '../event/EventHost'\nimport { EventHostImpl } from '../event/EventHost'\nimport { globalRef } from '../global/globalRegistry'\nimport { toJson } from '../util/serialization/json'\nimport type { LogTarget } from './LogTarget'\nimport { getLogLevelFromSearch } from './getLogLevelFromSearch'\n\nexport enum LogLevel {\n VERBOSE,\n DEBUG,\n INFO,\n WARN,\n ERROR,\n NONE,\n}\n\nexport interface LogEvent {\n readonly messages: any[]\n readonly target: LogTarget\n readonly level: LogLevel\n}\n\nexport interface LogEventMap {\n readonly log: LogEvent\n}\n\n/**\n * The interface for a basic logger implementation.\n */\nexport interface Logger extends ReadonlyEventHost<LogEventMap> {\n logLevel: LogLevel\n\n log(target: LogTarget, level: LogLevel, ...messages: readonly any[]): void\n}\n\nexport class LoggerImpl extends EventHostImpl<LogEventMap> implements Logger {\n get [Symbol.toStringTag](): string {\n return 'Logger'\n }\n\n constructor(public logLevel: LogLevel = LogLevel.DEBUG) {\n super()\n }\n\n log(target: LogTarget, level: LogLevel, ...messages: readonly any[]): void {\n if (level === LogLevel.NONE || level < this.logLevel) return\n this.dispatch('log', {\n level,\n messages: toJson(messages),\n target,\n })\n }\n}\n\n/**\n * A global reference to the logger.\n * @private\n */\nexport const loggerRef = globalRef<Logger>(\n () =>\n new LoggerImpl(\n // The logger is initialized to VERBOSE if vinylLogLevel=verbose is in the query string\n // Otherwise use DEBUG.\n getLogLevelFromSearch() === LogLevel.VERBOSE\n ? LogLevel.VERBOSE\n : LogLevel.DEBUG\n )\n)\n\n/**\n * Returns the current log level.\n */\nexport function getLogLevel(): LogLevel {\n return loggerRef.value.logLevel\n}\n\n/**\n * Sets the current log level.\n *\n * @param value\n */\nexport function setLogLevel(value: LogLevel): void {\n loggerRef.value.logLevel = value\n}\n\nexport function log(\n target: LogTarget,\n level: LogLevel,\n ...messages: readonly any[]\n): void {\n loggerRef.value.log(target, level, ...messages)\n}\n\nexport function logVerbose(\n target: LogTarget,\n ...messages: readonly any[]\n): void {\n loggerRef.value.log(target, LogLevel.VERBOSE, ...messages)\n}\n\nexport function logDebug(target: LogTarget, ...messages: readonly any[]): void {\n loggerRef.value.log(target, LogLevel.DEBUG, ...messages)\n}\n\nexport function logInfo(target: LogTarget, ...messages: readonly any[]): void {\n loggerRef.value.log(target, LogLevel.INFO, ...messages)\n}\n\nexport function logWarn(target: LogTarget, ...messages: readonly any[]): void {\n loggerRef.value.log(target, LogLevel.WARN, ...messages)\n}\n\nexport function logError(target: LogTarget, ...messages: readonly any[]): void {\n loggerRef.value.log(target, LogLevel.ERROR, ...messages)\n}\n\nconst strToLogLevel: Record<string, LogLevel> = {\n verbose: LogLevel.VERBOSE,\n debug: LogLevel.DEBUG,\n info: LogLevel.INFO,\n warn: LogLevel.WARN,\n error: LogLevel.ERROR,\n none: LogLevel.NONE,\n} as const\n\n/**\n * From a case-insensitive string, returns the log level.\n * Possible values match to the keys in {@link LogLevel}.\n *\n * @param str\n */\nexport function parseLogLevel(str: string): LogLevel | null {\n return strToLogLevel[str.toLowerCase()] ?? null\n}\n\nconst logLevelToString: Record<LogLevel, string> = {\n [LogLevel.VERBOSE]: 'verbose',\n [LogLevel.DEBUG]: 'debug',\n [LogLevel.INFO]: 'info',\n [LogLevel.WARN]: 'warn',\n [LogLevel.ERROR]: 'error',\n [LogLevel.NONE]: 'none',\n} as const\n\n/**\n * Returns the log level as a lowercase string.\n * E.g. stringifyLogLevel(LogLevel.DEBUG) returns 'debug'\n */\nexport function stringifyLogLevel(logLevel: LogLevel): string {\n return logLevelToString[logLevel]\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\n/**\n * Array views of a data buffer.\n */\nexport type TypedArray =\n | Float32Array\n | Float64Array\n | Int16Array\n | Int32Array\n | Int8Array\n | Uint16Array\n | Uint32Array\n | Uint8Array\n | Uint8ClampedArray\n\n/**\n * Creates a new typed array with identical contents as the source.\n *\n * @param array\n */\nexport function cloneTypedArray<T extends TypedArray>(array: T): T {\n // typed array slice() is not supported on Comcast OTT device.\n return new (array.constructor as new (array: T) => T)(array)\n}\n\nconst typedArrayTypes = [\n Float32Array,\n Float64Array,\n Int16Array,\n Int32Array,\n Int8Array,\n Uint16Array,\n Uint32Array,\n Uint8Array,\n Uint8ClampedArray,\n]\n\n/**\n * Returns true if the given value is an instance of one of the typed array types.\n *\n * @param value\n */\nexport function isTypedArray(value: any): value is TypedArray {\n return typedArrayTypes.some((type) => value instanceof type)\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 union of two sets. That is, the unique elements of A and B.\n *\n * @param a\n * @param b\n * @return Returns a new Set `A \u222A B`\n */\nexport function union<T, U>(a: ReadonlySet<T>, b: ReadonlySet<U>): Set<T | U> {\n return new Set([...a, ...b])\n}\n\n/**\n * Returns the set difference of A and B. That is, the elements of A that are not in B.\n *\n * @param a\n * @param b\n * @return Returns a new Set that is `A \\ B`\n */\nexport function diff<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): Set<T> {\n const out: Set<T> = new Set()\n a.forEach((e) => {\n if (!b.has(e)) out.add(e)\n })\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 { IllegalArgumentError } from '../../error/IllegalArgumentError'\nimport type { TypedArray } from '../collection/typedArray'\nimport { cloneTypedArray, isTypedArray } from '../collection/typedArray'\nimport { union } from '../set/set'\nimport { substitute } from '../string/string'\nimport { ownKeys, isPlainObject } from './object'\nimport { ReportableError } from '../../error/ReportableError'\nimport { type Cloneable, isCloneable } from '../../core/cloneable'\n\nconst locale = {\n cyclicRefError: 'Cyclic reference found at: {path}',\n mergeReferenceError: `No merge rule found at {path} for \"{source}\" and reference copy not allowed`,\n} as const\n\n/**\n * Concatenates multiple arrays together where each element is deeply cloned.\n */\nexport function mergeDeep<T extends Array<any>>(\n sources: readonly T[],\n options?: Partial<MergeOptions>\n): T\n\n/**\n * Deep clones the given object.\n */\nexport function mergeDeep<T>(\n sources: readonly [T],\n options?: Partial<MergeOptions>\n): T\n\n/**\n * Deep merges the two objects.\n * If common keys are both arrays, they will be concatenated, if common keys are both objects, they\n * will be merged. Incompatible types, e.g. an object and an array will use the later source.\n */\nexport function mergeDeep<A, B>(\n sources: readonly [A, B],\n options?: Partial<MergeOptions>\n): A & B\n\n/**\n * Deep merges the three objects.\n * If common keys are both arrays, they will be concatenated, if common keys are both objects, they\n * will be merged. Incompatible types, e.g. an object and an array will use the later source.\n */\nexport function mergeDeep<A, B, C>(\n sources: readonly [A, B, C],\n options?: Partial<MergeOptions>\n): A & B & C\n\n/**\n * Deep merges the four objects.\n * If common keys are both arrays, they will be concatenated, if common keys are both objects, they\n * will be merged. Incompatible types, e.g. an object and an array will use the later source.\n */\nexport function mergeDeep<A, B, C, D>(\n sources: readonly [A, B, C, D],\n options?: Partial<MergeOptions>\n): A & B & C & D\n\n/**\n * Deep merges the five objects.\n * If common keys are both arrays, they will be concatenated, if common keys are both objects, they\n * will be merged. Incompatible types, e.g. an object and an array will use the later source.\n */\nexport function mergeDeep<A, B, C, D, E>(\n sources: readonly [A, B, C, D, E],\n options?: Partial<MergeOptions>\n): A & B & C & D & E\n\n/**\n * Deep merges the six objects.\n * If common keys are both arrays, they will be concatenated, if common keys are both objects, they\n * will be merged. Incompatible types, e.g. an object and an array will use the later source.\n */\nexport function mergeDeep<A, B, C, D, E, F>(\n sources: readonly [A, B, C, D, E, F],\n options?: Partial<MergeOptions>\n): A & B & C & D & E & F\n\n/**\n * Deep merges all objects.\n * If common keys are both arrays, they will be concatenated, if common keys are both objects, they\n * will be merged. Incompatible types, e.g. an object and an array will use the later source.\n */\nexport function mergeDeep(\n sources: readonly any[],\n options?: Partial<MergeOptions>\n): any\n\n/**\n * Recursively copies the values of all the enumerable own properties from one or two source\n * objects to a new object.\n * Arrays will be concatenated.\n *\n * @param sources One or more source objects from which to copy properties. A single source\n * provided will return a deep clone. Incompatible objects, for example given a number and an\n * array, will return a clone of the last argument.\n * @param options\n * @see merge\n */\nexport function mergeDeep(\n sources: readonly any[],\n options?: Partial<MergeOptions>\n): any {\n if (!sources.length) return undefined\n const finalOpts: MergeOptions = {\n ...defaultMergeOptions,\n ...options,\n }\n const stack = new PropStack()\n const n = sources.length\n\n if (n === 1)\n // Clone the single element.\n return _mergeDeep(undefined, sources[0], stack, 0, finalOpts)\n // Initial accumulator:\n let out = _mergeDeep(sources[0], sources[1], stack, 1, finalOpts)\n for (let i = 2; i < n; i++) {\n out = _mergeDeep(out, sources[i], stack, i, finalOpts)\n }\n return out\n}\n\n/**\n * Merge options defines the behavior for {@link mergeDeep}.\n * See the {@link defaultMergeOptions} for defaults that will be used if any merge options are\n * omitted.\n */\nexport interface MergeOptions {\n /**\n * If an object does not pass any of the rules, if this is true (default) the reference will be\n * copied. If false, a {@link MergeReferenceError} will be thrown.\n * This only applies to objects, not functions or primitives.\n */\n readonly allowReferenceCopy: boolean\n\n /**\n * The first merge rule where the second source object matches will be used.\n * Rules are only checked for values that have a typeof value of 'object'\n * If the first object does not pass the match, undefined will be passed to sourceA and the\n * rule is expected to return a clone of sourceB.\n * If no rules match, the value will be copied by reference unless `allowReferenceCopy` is\n * false, in which case, a {@link MergeReferenceError} will be thrown.\n */\n readonly rules: readonly MergeRule<any>[]\n}\n\n/**\n * A merge function to be provided to merge rules.\n */\nexport type MergeCallback<T = any> = (\n /**\n * The first like object to merge, or undefined. If undefined is provided, a\n * clone of sourceB is expected to be returned. If defined, this object is guaranteed to have\n * passed {@link MergeRule.matches}\n */\n sourceA: T | undefined,\n\n /**\n * The second object to merge or clone.\n */\n sourceB: T,\n\n /**\n * The identifier to be used in error reporting.\n */\n prop: string | number\n) => T\n\nexport interface MergeRule<T> {\n /**\n * Returns true if this MergeRule should be applied for the given object.\n * @param object\n */\n readonly matches: (object: any) => object is T\n\n /**\n * Merges the two sources.\n * @param sourceA May be undefined, the first object to merge.\n * @param sourceB The second object to merge or clone if sourceA is undefined.\n * @param merge This callback may be used to merge or clone sub-properties.\n */\n readonly merge: (\n sourceA: T | undefined,\n sourceB: T,\n merge: MergeCallback\n ) => T\n}\n\n/**\n * A stack of the current property recursion.\n * PropStack has two purposes, it provides the current property path in the node traversal and\n * ensures that nodes do not cyclically reference themselves.\n */\nclass PropStack {\n /**\n * Object references for sourceA.\n */\n private refsA = new Set<any>()\n\n /**\n * Object references for sourceB.\n */\n private refsB = new Set<any>()\n private propStack: [any, any, keyof any | undefined][] = []\n\n /**\n * The property stack, joined by .\n */\n get currentPath(): string {\n return this.propStack\n .map((e) => e[2])\n .filter((e) => e != null)\n .join('.')\n }\n\n push(sourceA: any, sourceB: any, prop?: keyof any) {\n this.propStack.push([sourceA, sourceB, prop])\n this.addRef(this.refsA, sourceA)\n this.addRef(this.refsB, sourceB)\n }\n\n pop() {\n const last = this.propStack.pop()!\n this.refsA.delete(last[0])\n this.refsB.delete(last[1])\n }\n\n private addRef(refSet: Set<any>, source: any) {\n if (typeof source !== 'object') return\n if (refSet.has(source)) {\n throw new IllegalArgumentError(\n substitute(locale.cyclicRefError, { path: this.currentPath })\n )\n }\n refSet.add(source)\n }\n}\n\nfunction _mergeDeep<T>(\n sourceA: T | undefined,\n sourceB: T,\n propStack: PropStack,\n prop: keyof any | undefined,\n options: MergeOptions\n): T {\n if (typeof sourceB !== 'object' || sourceB === null) return sourceB\n\n const merge: MergeCallback = (sourceA, sourceB, prop) => {\n return _mergeDeep(sourceA, sourceB, propStack, prop, options)\n }\n for (const rule of options.rules) {\n if (rule.matches(sourceB)) {\n propStack.push(sourceA, sourceB, prop)\n const result = rule.merge(\n rule.matches(sourceA) ? sourceA : undefined,\n sourceB,\n merge\n )\n propStack.pop()\n return result\n }\n }\n if (!options.allowReferenceCopy) {\n // push before throwing to get the full currentPath:\n propStack.push(sourceA, sourceB, prop)\n throw new MergeReferenceError(propStack.currentPath, sourceB)\n }\n return sourceB\n}\n\nexport class MergeReferenceError extends ReportableError {\n constructor(propPath: string, source: any) {\n super(\n substitute(locale.mergeReferenceError, {\n path: propPath,\n source,\n })\n )\n Object.setPrototypeOf(this, MergeReferenceError.prototype)\n }\n}\n\n/**\n * Cloneable objects are not expected to be mergeable, but should be cloned.\n */\nexport const cloneableMergeRule: MergeRule<Cloneable<any>> = {\n matches(object: any): object is Cloneable<any> {\n return isCloneable(object)\n },\n\n merge(\n _1: Cloneable<any> | undefined,\n sourceB: Cloneable<any>,\n _2: MergeCallback\n ): Cloneable<any> {\n return sourceB.clone()\n },\n}\n\nexport const arrayMergeRule: MergeRule<any[]> = {\n matches(object: any): object is any[] {\n return Array.isArray(object)\n },\n\n merge(\n sourceA: any[] | undefined,\n sourceB: any[],\n merge: MergeCallback\n ): any[] {\n const out = []\n if (sourceA) {\n for (const element of sourceA) {\n out.push(merge(undefined, element, out.length))\n }\n }\n for (const element of sourceB) {\n out.push(merge(undefined, element, out.length))\n }\n return out\n },\n} as const\n\nexport const plainObjectMergeRule: MergeRule<Record<any, any>> = {\n matches(object: any): object is Record<any, any> {\n return isPlainObject(object)\n },\n\n merge(\n sourceA: Record<any, any> | undefined,\n sourceB: Record<any, any>,\n merge: MergeCallback\n ): Record<any, any> {\n const out: any = {}\n // Iterate over the unique set of the union of keys between the two objects.\n for (const key of union(ownKeys(sourceA), ownKeys(sourceB))) {\n if (sourceA && key in sourceB && key in sourceA) {\n out[key] = merge(sourceA[key], sourceB[key], key)\n } else if (sourceA && key in sourceA) {\n out[key] = merge(undefined, sourceA[key], key)\n } else {\n out[key] = merge(undefined, sourceB[key], key)\n }\n }\n return out\n },\n} as const\n\nexport const regexpMergeRule: MergeRule<RegExp> = {\n matches(object: any): object is RegExp {\n return object instanceof RegExp\n },\n merge(_1: RegExp | undefined, sourceB: RegExp, _2: MergeCallback): RegExp {\n // Clone the regex; they are stateful.\n return new RegExp(sourceB.source, sourceB.flags)\n },\n} as const\n\nexport const dateMergeRule: MergeRule<Date> = {\n matches(object: any): object is Date {\n return object instanceof Date\n },\n merge(_1: Date | undefined, sourceB: Date, _2: MergeCallback): Date {\n return new Date(sourceB.getTime())\n },\n} as const\n\nexport const mapMergeRule: MergeRule<Map<any, any>> = {\n matches(object: any): object is Map<any, any> {\n return object instanceof Map\n },\n merge(\n sourceA: Map<any, any> | undefined,\n sourceB: Map<any, any>,\n merge: MergeCallback\n ): Map<any, any> {\n const out = new Map()\n // Iterate over the unique set of the union of keys between the two objects.\n for (const key of new Set([\n ...(sourceA?.keys() ?? []),\n ...sourceB.keys(),\n ])) {\n if (sourceB.has(key) && sourceA?.has(key)) {\n out.set(key, merge(sourceA.get(key), sourceB.get(key), key))\n } else if (sourceA?.has(key)) {\n out.set(key, merge(undefined, sourceA.get(key), key))\n } else {\n out.set(key, merge(undefined, sourceB.get(key), key))\n }\n }\n return out\n },\n} as const\n\nexport const setMergeRule: MergeRule<Set<any>> = {\n matches(object: any): object is Set<any> {\n return object instanceof Set\n },\n merge(\n sourceA: Set<any> | undefined,\n sourceB: Set<any>,\n merge: MergeCallback\n ): Set<any> {\n return new Set(\n [...(sourceA?.values() ?? []), ...sourceB.values()].map(\n (element, index) => {\n return merge(undefined, element, index)\n }\n )\n )\n },\n} as const\n\n/**\n * Typed arrays will not concatenate by default like arrays. Typed arrays generally represent data,\n * not configuration, and the more reasonable default is to clone, not concatenate.\n */\nexport const typedArrayMergeRule: MergeRule<TypedArray> = {\n matches(object: any): object is TypedArray {\n return isTypedArray(object)\n },\n merge(\n _1: TypedArray | undefined,\n sourceB: TypedArray,\n _2: MergeCallback\n ): TypedArray {\n return cloneTypedArray(sourceB)\n },\n} as const\n\nexport const urlMergeRule: MergeRule<URL> = {\n matches(object: any): object is URL {\n return object instanceof URL\n },\n merge(_1: URL | undefined, sourceB: URL, _2: MergeCallback): URL {\n return new URL(sourceB.toString())\n },\n} as const\n\n/**\n * The default merge options provide rules for merging arrays, plain objects, RegExp, Date,\n * Map, Set, and TypedArray.\n */\nexport const defaultMergeOptions: MergeOptions = {\n allowReferenceCopy: true,\n rules: [\n cloneableMergeRule,\n arrayMergeRule,\n plainObjectMergeRule,\n regexpMergeRule,\n dateMergeRule,\n mapMergeRule,\n setMergeRule,\n typedArrayMergeRule,\n urlMergeRule,\n ],\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { MergeCallback, MergeRule } from './mergeDeep'\nimport { defaultMergeOptions, mergeDeep } from './mergeDeep'\nimport type { MutableDeep } from './mutableType'\n\n/**\n * Merge options defines the behavior for {@link mergeDeep}.\n * See the {@link defaultMergeOptions} for defaults that will be used if any merge options are\n * omitted.\n */\nexport interface CloneOptions {\n /**\n * If an object does not pass any of the rules, if this is true the reference will be\n * copied. If false (default), a {@link MergeReferenceError} will be thrown.\n * This only applies to objects, not functions or primitives.\n */\n readonly allowReferenceCopy: boolean\n\n /**\n * The first clone rule that matches will be used.\n *\n * If no rules match, the value will be copied by reference unless `allowReferenceCopy` is\n * false (default), in which case, a {@link MergeReferenceError} will be thrown.\n */\n readonly rules: readonly CloneRule<any>[]\n}\n\n/**\n * A CloneRule defines if and how an object should be cloned.\n */\nexport interface CloneRule<T> {\n /**\n * Returns true if this MergeRule should be applied for the given object.\n * @param object\n */\n readonly matches: (object: any) => object is T\n\n /**\n * Clones the given value.\n *\n * @param source A value guaranteed to have matched with `matches`.\n * @param clone This callback may be used to clone sub-properties.\n */\n readonly clone: (source: T, clone: CloneCallback) => MutableDeep<T>\n}\n\n/**\n * A function to clone a sub-object from a clone rule.\n */\nexport type CloneCallback = <T>(\n /**\n * The source object to clone.\n */\n source: T,\n\n /**\n * The identifier to be used in error reporting.\n */\n prop: string | number\n) => MutableDeep<T>\n\n/**\n * Performs a deep clone on the target object.\n *\n * This is an alias for `mergeDeep(target)` that additionally converts clone rules to one-sided\n * merge rules.\n *\n * @param target The target object to clone.\n * @param options The merge options to use.\n * `clone`, unlike `mergeDeep`, `allowReferenceCopy` will default to false.\n * @see mergeDeep\n */\nexport function clone<T>(\n target: T,\n options?: Partial<CloneOptions>\n): MutableDeep<T> {\n // mergeDeep works as a deep clone if given a single source.\n return mergeDeep<T>([target], {\n allowReferenceCopy: options?.allowReferenceCopy ?? false,\n rules: options?.rules?.map(toMergeRule) ?? defaultMergeOptions.rules,\n }) as MutableDeep<T>\n}\n\n/**\n * Creates a wrapper to convert a clone rule to a merge rule.\n */\nexport function toMergeRule<T>(cloneRule: CloneRule<T>): MergeRule<T> {\n return {\n matches: cloneRule.matches,\n merge(_sourceA: T | undefined, sourceB: T, merge: MergeCallback): T {\n return cloneRule.clone(\n sourceB,\n <S>(source: S, prop: string | number): MutableDeep<S> => {\n return merge(undefined, source, prop) as MutableDeep<S>\n }\n ) as T\n },\n } as const\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Disposable } from '../../core/disposable'\nimport { DisposedError, isDisposable } from '../../core/disposable'\nimport { IllegalStateError } from '../../error/IllegalStateError'\n\nexport interface ReadonlyLazy<T> {\n /**\n * True if the lazy instance has been constructed.\n */\n readonly constructed: boolean\n\n /**\n * When invoked the first time, constructs the value and returns it.\n * Consecutive calls will return that cached value.\n * @throws DisposedError If this lazy factory is disposed.\n */\n get value(): T\n}\n\nexport interface Lazy<T> extends ReadonlyLazy<T>, Disposable {\n /**\n * Sets the lazy instance's value.\n * If disposed, a {@link DisposedError} will be thrown.\n * @param value\n */\n set value(value: T)\n\n /**\n * Clears the lazy instance, disposing its value.\n * Unlike dispose(), this allows the lazy instance to be reconstructed upon the next get.\n * Typically used only in unit testing. May be used after {@link dispose}.\n */\n clear(): void\n}\n\n/**\n * A factory to lazily instantiate a single cached instance.\n */\nexport class LazyImpl<T> implements Lazy<T>, Disposable {\n private _constructing = false\n private _constructed = false\n private disposed = false\n private _value: T | undefined = undefined\n\n /**\n * @param factory A factory function that will be invoked at most once.\n */\n constructor(private readonly factory: () => T) {}\n\n get constructed(): boolean {\n return this._constructed\n }\n\n get value(): T {\n if (this.disposed) throw new DisposedError()\n if (this._constructing)\n throw new IllegalStateError('Lazy instance is constructing')\n if (this._constructed) return this._value as T\n this._constructing = true\n this._value = this.factory()\n this._constructing = false\n this._constructed = true\n return this._value\n }\n\n set value(value: T) {\n if (this.disposed) throw new DisposedError()\n this.clear()\n this._constructed = true\n this._value = value\n }\n\n clear(): void {\n this.disposed = false\n if (this._constructed) {\n if (isDisposable(this._value)) {\n this._value.dispose()\n }\n this._constructed = false\n this._value = undefined\n }\n }\n\n dispose() {\n if (this.disposed) throw new DisposedError()\n this.clear()\n this.disposed = true\n }\n}\n\n/**\n * Creates a new {@link Lazy} instance.\n *\n * @param factory A factory function that will be invoked at most once. If the instance produced\n * is disposable, it will be disposed on clear.\n */\nexport function lazy<T>(factory: () => T): Lazy<T> {\n return new LazyImpl<T>(factory)\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 type { ReadonlyDate } from '../object/readonlyType'\nimport { substitute } from '../string/string'\nimport { ValidationError } from '../../error/ValidationError'\n\n/**\n * @private\n */\nconst locale = {\n invalidDateError: `\"{value}\" is an invalid date`,\n} as const\n\n/**\n * Returns the signed time difference of end - start, in seconds.\n *\n * @param start The beginning date\n * @param end The later date\n */\nexport function timeDelta(start: ReadonlyDate, end: ReadonlyDate): number {\n return (end.getTime() - start.getTime()) / 1000\n}\n\n/**\n * A type alias to clarify that a number represents a unix timestamp\n * (milliseconds from 1970-1-1 00:00).\n */\nexport type Timestamp = number\n\n/**\n * Parses a string into a unix Timestamp using `Date.parse`, if the date is invalid, throws a\n * `ValidationError`\n * @param str\n */\nexport function parseTimestamp(str: string): Timestamp {\n const timestamp = Date.parse(str)\n if (Number.isNaN(timestamp))\n throw new ValidationError(\n substitute(locale.invalidDateError, { value: str }),\n ErrorOrigin.PARSING\n )\n return timestamp\n}\n\n/**\n * Parses a string into a date using `Date.parse`, if the date is invalid, throws a\n * `ValidationError`\n * @param str\n */\nexport function parseDate(str: string): Date {\n return new Date(parseTimestamp(str))\n}\n\n/**\n * Returns the iso 8601 string representation of a `Date` value.\n *\n * @param value\n */\nexport function stringifyDate(value: ReadonlyDate): string {\n return value.toISOString()\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\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 { logDebug, type LogTarget } from '@amazon/vinyl-util'\nimport { benchmark } from '@amazon/vinyl-util/browserTestUtil'\nimport { addBenchmarks, setupBenchmark } from '../setup'\n\ndescribe('Logging', () => {\n setupBenchmark()\n\n it('logDebug', async () => {\n const target: LogTarget = {\n logPrefix: 'path',\n }\n const results = await benchmark(`logDebug`, () => {\n logDebug(target, {\n requestInfo: {\n fetchId: 'lgn9lrwaid8o3utd5r',\n init: {\n method: 'POST',\n headers: {\n 'Content-Encoding': 'amz-1.0',\n 'Content-Type': 'application/json',\n 'X-Amz-Target':\n 'com.amazon.digitalmusiclocator.DigitalMusicLocatorServiceExternal.getStreamingURLs',\n },\n body: '{\"contentIdList\":[{\"identifier\":\"d9e4e337-97ba-41a9-9f31-84a8bf99f1dc\",\"identifierType\":\"COID\"}],\"bitRate\":\"HIGH\",\"deviceToken\":{\"deviceId\":\"lg4msezd1e355heuc5b\",\"deviceTypeId\":\"A16ZV8BU3SN1N3\"},\"appMetadata\":{\"appId\":\"WebCP\",\"https\":true,\"appVersion\":\"1.0.0\"},\"clientMetadata\":{\"clientId\":\"WebCP\",\"clientRequestId\":\"lgn9lrw623mgvi7k3et\"}}',\n signal: '[object AbortSignal]',\n },\n input: 'https://example.com/bar/',\n maxRetries: 1,\n timestamp: new Date('2023-04-19T05:40:17.914Z'),\n fetchOptions: {\n serviceId: null,\n readErrorBody: 1,\n },\n },\n attemptInfo: {\n currentTry: 1,\n timestamp: new Date('2023-04-19T05:40:17.914Z'),\n },\n target: '[object FetchProviderImpl]',\n })\n })\n addBenchmarks('logDebug', results)\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 ErrorOrigin,\n roundToNearest,\n ValidationError,\n} from '@amazon/vinyl-util'\n\n// ESBuild (https://github.com/evanw/esbuild/issues/3988) considers multiplication and division\n// to have a side effect and will inhibit tree shaking.\n// E.g. H = 60 * 60 will not be removed when not referenced.\nconst I = 60\nconst H = 3600\nconst D = 86400\nconst M = 2592000\nconst Y = 31536000\n\n/**\n * A duration, in seconds. (This may be negative)\n */\nexport type Duration = number\n\n/**\n * https://www.w3.org/TR/xmlschema-2/#duration\n */\nconst iso8601Duration =\n /^(-?)P?(\\d+(?:\\.\\d*)?Y)?(\\d+(?:\\.\\d*)?M)?(\\d+(?:\\.\\d*)?D)?T?(\\d+(?:\\.\\d*)?H)?(\\d+(?:\\.\\d*)?M)?(\\d+(?:\\.\\d*)?S?)?$/i\n\n/**\n * Parses an ISO 8601 duration into seconds.\n * The accepted format is P(n)Y(n)M(n)DT(n)H(n)M(n)S\n *\n * All units shall have a fixed size.\n *\n * P - Period designator, precedes all durations.\n * 1Y (Year) = 365 * 24 * 60 * 60 Seconds\n * 1M (Month) = 30 * 24 * 60 * 60 Seconds\n * 1D (Day) = 24 * 60 * 60 Seconds\n *\n * T - Time designator, precedes all time components.\n * 1H (Hour) = 60 * 60 Seconds\n * 1M (Minute) = 60 Seconds\n * 1S (Second)\n *\n *\n * @param value\n * @return Returns the duration in seconds or throws an {@link ValidationError}\n * if not properly formatted.\n * @see https://www.w3.org/TR/xmlschema-2/#duration\n */\nexport function parseDuration(value: string): Duration {\n const match = iso8601Duration.exec(value)\n if (match == null)\n throw new ValidationError(\n `Unexpected duration: '${value}', should be in iso 8601 format`,\n ErrorOrigin.PARSING\n )\n\n const sign = match[1] === '-' ? -1 : 1\n return (\n sign *\n (parseFloat(match[2] || '0') * Y +\n parseFloat(match[3] || '0') * M +\n parseFloat(match[4] || '0') * D +\n parseFloat(match[5] || '0') * H +\n parseFloat(match[6] || '0') * I +\n parseFloat(match[7] || '0'))\n )\n}\n\n/**\n * Returns the iso 8601 string representation of a duration value.\n *\n * @param value A duration value, in seconds.\n */\nexport function stringifyDuration(value: Duration): string {\n const sign = value < 0 ? '-' : ''\n let abs = Math.abs(value)\n\n const years = Math.floor(abs / Y)\n abs -= years * Y\n const months = Math.floor((abs % Y) / M)\n const days = Math.floor((abs % M) / D)\n const hours = Math.floor((abs % D) / H)\n const minutes = Math.floor((abs % H) / I)\n const seconds = abs % I\n let isoString = `${sign}P`\n if (years > 0) isoString += `${years}Y`\n if (months > 0) isoString += `${months}M`\n if (days > 0) isoString += `${days}D`\n isoString += 'T'\n if (hours > 0) isoString += `${hours}H`\n if (minutes > 0) isoString += `${minutes}M`\n if (seconds > 0 || !value) isoString += `${roundToNearest(seconds, 0.001)}S`\n return isoString\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin, ValidationError } from '@amazon/vinyl-util'\n\nexport function throwParsingError(message: string): never {\n throw new ValidationError(message, ErrorOrigin.PARSING)\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 type { FromTypeof, Typeof } from '@amazon/vinyl-util'\nimport { substitute } from '@amazon/vinyl-util'\nimport type { Validator } from './Validator'\nimport { createValidator } from './Validator'\nimport type { JsonSchema, JsonSchemaType } from './JsonSchema'\n\n/**\n * @private\n */\nconst locale = {\n template: 'type {value}',\n} as const\n\n/**\n * The JSON Schema `type` for each JavaScript `typeof` value that has a JSON representation.\n * Types with no JSON equivalent (`function`, `symbol`) are absent and contribute no fragment.\n */\nconst jsonSchemaTypeByTypeof: Partial<Record<Typeof, JsonSchemaType>> = {\n string: 'string',\n number: 'number',\n boolean: 'boolean',\n object: 'object',\n}\n\n/**\n * Creates a validator that validates that the input is not nullish and its `typeof` matches the\n * expected value.\n *\n * Note: while `typeof null === 'object'`, `typeOfValidator('object')` will assert that its\n * input is not nullish.\n *\n * @param expected\n */\nfunction typeOfValidator<T extends Typeof>(\n expected: T\n): Validator<NonNullable<FromTypeof<T>>> {\n const jsonType = jsonSchemaTypeByTypeof[expected]\n const jsonSchema: JsonSchema | undefined =\n jsonType == null ? undefined : { type: jsonType }\n return createValidator(\n substitute(locale.template, { value: expected }),\n (input: unknown): input is NonNullable<FromTypeof<T>> => {\n return input != null && typeof input === expected\n },\n undefined,\n jsonSchema\n )\n}\n\nconst typeOfValidatorCache: any = {}\n\nfunction cachedTypeOfValidator<T extends Typeof>(\n type: T\n): Validator<NonNullable<FromTypeof<T>>> {\n if (!(type in typeOfValidatorCache)) {\n typeOfValidatorCache[type] = typeOfValidator(type)\n }\n return typeOfValidatorCache[type]\n}\n\n/**\n * Validators asserting typeof input matches the expected value.\n *\n * Note: bigint is omitted; not all supported platforms can use BigInt.\n */\nexport const typeOfValidators = {\n get boolean() {\n return cachedTypeOfValidator('boolean')\n },\n get func() {\n return cachedTypeOfValidator('function')\n },\n get number() {\n return cachedTypeOfValidator('number')\n },\n get object() {\n return cachedTypeOfValidator('object')\n },\n get string() {\n return cachedTypeOfValidator('string')\n },\n get symbol() {\n return cachedTypeOfValidator('symbol')\n },\n} as const\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 { ValueSchema } from './ValueSchema'\nimport { typeOfValidators } from './typeOfValidators'\nimport type { Validator } from './Validator'\nimport { createValidator } from './Validator'\n\nconst locale = {\n gte: 'at least {value}',\n gt: 'greater than {value}',\n lte: 'at most {value}',\n lt: 'less than {value}',\n within: 'within {min} and {max}',\n safeInteger: 'safe integer',\n finite: 'finite',\n} as const\n\nexport const numberValidators = {\n /**\n * Creates a validator that asserts that the input number is at least the provided minimum\n * value.\n *\n * @param min The minimum (inclusive) the value may be.\n */\n gte(min: number): Validator<number, number> {\n return createValidator(\n substitute(locale.gte, { value: min }),\n (input) => input >= min,\n undefined,\n { minimum: min }\n )\n },\n\n /**\n * Creates a validator that asserts that the input number is greater than the provided minimum\n * value.\n *\n * @param min The minimum (exclusive) the value may be.\n */\n gt(min: number): Validator<number, number> {\n return createValidator(\n substitute(locale.gt, { value: min }),\n (input) => input > min,\n undefined,\n { exclusiveMinimum: min }\n )\n },\n\n /**\n * Creates a validator that asserts that the input number is at most the provided maximum\n * value.\n *\n * @param max The maximum (inclusive) the value may be.\n */\n lte(max: number): Validator<number, number> {\n return createValidator(\n substitute(locale.lte, { value: max }),\n (input) => input <= max,\n undefined,\n { maximum: max }\n )\n },\n\n /**\n * Creates a validator that asserts that the input number is less than the provided maximum\n * value.\n *\n * @param max The maximum (exclusive) the value may be.\n */\n lt(max: number): Validator<number, number> {\n return createValidator(\n substitute(locale.lt, { value: max }),\n (input) => input < max,\n undefined,\n { exclusiveMaximum: max }\n )\n },\n\n /**\n * Creates a validator that asserts that the input number is at least the provided minimum\n * and at most the provided maximum values.\n *\n * @param min The minimum (inclusive) value the input may be.\n * @param max The maximum (inclusive) value the input may be.\n */\n within(min: number, max: number): Validator<number, number> {\n return createValidator(\n substitute(locale.within, { min, max }),\n (input) => input >= min && input <= max,\n undefined,\n { minimum: min, maximum: max }\n )\n },\n\n /**\n * Creates a validator that asserts that the input number is finite.\n */\n finite(): Validator<number, number> {\n return createValidator(locale.finite, (input) => Number.isFinite(input))\n },\n\n /**\n * Creates a validator that asserts that the input number is a safe integer.\n */\n safeInteger(): Validator<number, number> {\n return createValidator(\n locale.safeInteger,\n (input) => Number.isSafeInteger(input),\n undefined,\n { type: 'integer' }\n )\n },\n} as const\n\nexport class NumberSchema extends ValueSchema<number> {\n private static _base: NumberSchema | null = null\n\n /**\n * The base Object validator validating that the input is an object.\n */\n static get base(): NumberSchema {\n if (this._base == null)\n this._base = new NumberSchema(typeOfValidators.number)\n return this._base\n }\n\n /**\n * Creates a validator that asserts that the input number is at least the provided minimum\n * value.\n *\n * @param min The minimum (inclusive) the value may be.\n */\n gte(min: number): this {\n return this.chain(numberValidators.gte(min))\n }\n\n /**\n * Creates a validator that asserts that the input number is greater than the provided minimum\n * value.\n *\n * @param min The minimum (exclusive) the value may be.\n */\n gt(min: number): this {\n return this.chain(numberValidators.gt(min))\n }\n\n /**\n * Creates a validator that asserts that the input number is at most the provided maximum\n * value.\n *\n * @param max The maximum (inclusive) the value may be.\n */\n lte(max: number): this {\n return this.chain(numberValidators.lte(max))\n }\n\n /**\n * Creates a validator that asserts that the input number is less than the provided maximum\n * value.\n *\n * @param max The maximum (exclusive) the value may be.\n */\n lt(max: number): this {\n return this.chain(numberValidators.lt(max))\n }\n\n /**\n * Creates a validator that asserts that the input number is at least the provided minimum\n * and at most the provided maximum values.\n *\n * @param min The minimum (inclusive) value the input may be.\n * @param max The maximum (inclusive) value the input may be.\n */\n within(min: number, max: number): this {\n return this.chain(numberValidators.within(min, max))\n }\n\n /**\n * Creates a validator that asserts that the input number is finite.\n */\n finite(): this {\n return this.chain(numberValidators.finite())\n }\n\n /**\n * Creates a validator that asserts that the input number is a safe integer.\n */\n safeInteger(): this {\n return this.chain(numberValidators.safeInteger())\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 { isOneOf, type Validator } from '@amazon/vinyl-validation'\nimport type { actuateType } from '../xmlns/org/w3/1999/xlink'\nimport { ErrorOrigin } from '@amazon/vinyl-util'\n\nconst actuateValidator: Validator<actuateType> = isOneOf('onLoad', 'onRequest')\n\nexport function assertActuateEnum(str: string): actuateType {\n actuateValidator.assert(str, ErrorOrigin.PARSING)\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\n/**\n * A set of utilities for easily writing schema-based rule definitions to be used with the\n * `parseXml` parser.\n *\n * @module\n */\n\nimport {\n parseDate,\n stringifyDate,\n parseBoolean,\n stringify,\n type Invariant,\n type Maybe,\n type ReadonlyDate,\n} from '@amazon/vinyl-util'\n\nimport type { Uri } from '../xmlns/org/w3/2001/XmlSchema'\n\nexport enum XmlRuleType {\n CHARACTERS = 'characters',\n ATTRIBUTE = 'attribute',\n ELEMENT = 'element',\n ELEMENTS = 'elements',\n}\n\n/**\n * Reserved keys that may not be used in XmlRules.\n *\n * If a schema uses a reserved word, set `localPart` in the rule options to associate.\n */\nexport type ReservedXmlRuleKeys = 'parent' | 'clone' | 'toJSON'\n\n/**\n * A schema for XML serialization and deserialization.\n *\n * The parser values may be lazy, represented as a function that returns a property parser.\n * @typeParam T The object type these parsing rules model.\n */\nexport type XmlRules<T extends object> = {\n readonly [P in Exclude<keyof T, ReservedXmlRuleKeys>]-?:\n | XmlRule<T[P]>\n | LazyXmlRule<T[P]>\n}\n\n/**\n * A union of the supported parsing types.\n */\nexport type XmlRule<T> =\n | AttributeRule<T>\n | CharactersRule<T>\n | ElementsRule<T & (readonly object[] | undefined)>\n | ElementRule<T & (object | undefined)>\n\n/**\n * A function that returns a property handler.\n * Useful when there are recursive rules.\n */\nexport type LazyXmlRule<T> = () => XmlRule<T>\n\nexport interface NamespacedRuleOptions {\n /**\n * Matches the `QName.localPart` of the element. If undefined, this will match against\n * the property name from {@link XmlRules}.\n */\n readonly localPart?: string | undefined\n\n /**\n * Matches the `namespaceUri` of the element or attribute.\n *\n * If null, this will only match against a null namespace.\n * If undefined, this will default to the namespace of the parent element for elements, or\n * null for attributes.\n *\n * Note that attributes do not inherit default namespaces as elements do.\n */\n readonly namespaceUri?: Maybe<Uri>\n}\n\n/**\n * A rule definition for a list of elements.\n */\nexport interface ElementsRule<\n T extends readonly object[] | undefined,\n> extends Required<ElementsRuleOptions> {\n readonly type: XmlRuleType.ELEMENTS\n\n /**\n * Prevents rule from losing nullable type information.\n */\n readonly __invariant?: Invariant<T>\n\n /**\n * Returns the schema for matched elements.\n * These rules will be applied per element, collecting into an array.\n */\n readonly rules: XmlRules<NonNullable<T>[number]>\n}\n\nexport interface ElementsRuleOptions extends NamespacedRuleOptions {\n /**\n * The minimum number of elements.\n */\n readonly minOccurs?: number\n\n /**\n * The maximum number of elements. Use null for unbounded.\n */\n readonly maxOccurs?: number | null\n\n /**\n * If true and there are 0 occurrences of the element, the parsed value will be an empty array\n * instead of undefined.\n */\n readonly useEmptyArrays?: boolean\n}\n\n/**\n * A rule definition for a single element.\n */\nexport interface ElementRule<\n T extends object | undefined,\n> extends Required<ElementRuleOptions> {\n /**\n * Prevents rule from losing nullable type information.\n */\n readonly __invariant?: Invariant<T>\n\n readonly type: XmlRuleType.ELEMENT\n\n /**\n * Returns the schema for the matched element.\n */\n readonly rules: XmlRules<NonNullable<T>>\n}\n\nexport interface ElementRuleOptions extends NamespacedRuleOptions {\n /**\n * If true, a parsing error will be thrown if the value is undefined.\n */\n readonly required?: boolean\n}\n\n/**\n * A rule definition for an attribute.\n */\nexport interface AttributeRule<T> extends Required<AttributeRuleOptions<T>> {\n readonly type: XmlRuleType.ATTRIBUTE\n\n /**\n * Parses the attribute value.\n */\n readonly parse: (value: string) => T\n\n /**\n * Stringifies the value.\n */\n readonly stringify: (value: NonNullable<T>) => string\n}\n\nexport interface AttributeRuleOptions<T> extends NamespacedRuleOptions {\n /**\n * If true, a parsing error will be thrown if the value is undefined.\n */\n readonly required?: boolean\n\n /**\n * If the current element has no matching attribute, default will be used.\n */\n readonly default?: T | undefined\n\n /**\n * Matches the `namespaceUri` of the attribute.\n *\n * If null, this will only match against a null namespace.\n *\n * Note that attributes do not inherit default namespaces as elements do.\n */\n readonly namespaceUri?: Uri | null\n}\n\n/**\n * A rule definition for an element's text content.\n */\nexport interface CharactersRule<T> {\n readonly type: XmlRuleType.CHARACTERS\n\n /**\n * Parses the unescaped/processed characters.\n * This will always be called, but characters may be an empty string if the element has no\n * text content.\n */\n readonly parse: (characters: string) => T\n\n /**\n * Stringifies the value.\n */\n readonly stringify: (value: NonNullable<T>) => string\n}\n\nexport interface RequiredElementRuleOptions extends ElementRuleOptions {\n readonly required: true\n}\n\nexport function element<T extends object>(\n rules: XmlRules<T>,\n options: RequiredElementRuleOptions\n): ElementRule<T>\n\nexport function element<T extends object | undefined>(\n rules: XmlRules<NonNullable<T>>,\n options?: ElementRuleOptions\n): ElementRule<T | undefined>\n\n/**\n * Returns a schema for a single object based on a map of rules.\n *\n * If more than one element is found with a matching name, a `ParseError` is thrown.\n */\nexport function element<T extends object | undefined>(\n rules: XmlRules<NonNullable<T>>,\n options?: ElementRuleOptions\n): ElementRule<T | undefined> {\n return {\n type: XmlRuleType.ELEMENT,\n localPart: undefined,\n namespaceUri: undefined,\n required: false,\n ...options,\n rules,\n }\n}\n\n/**\n * Elements options that guarantee that there is a non-null array.\n * For minOccurs types greater than 10, a type cast is required.\n */\nexport type RequiredElementsOptions =\n | (ElementsRuleOptions & { readonly useEmptyArrays: true })\n | (ElementsRuleOptions & {\n readonly minOccurs: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10\n })\n\nexport function elements<T extends object>(\n rules: XmlRules<T>,\n options: RequiredElementsOptions\n): ElementsRule<readonly T[]>\n\nexport function elements<T extends object>(\n rules: XmlRules<T>,\n options?: ElementsRuleOptions\n): ElementsRule<readonly T[] | undefined>\n\n/**\n * Handles a list of child nodes where each matching child node is parsed into a corresponding\n * object represented by the given rules.\n *\n * @param rules The parsing rules to use for each element.\n * @param options\n * @see parseChildNodes\n */\nexport function elements<T extends object>(\n rules: XmlRules<T>,\n options?: ElementsRuleOptions\n): ElementsRule<readonly T[] | undefined> | ElementsRule<readonly T[]> {\n return {\n type: XmlRuleType.ELEMENTS,\n localPart: undefined,\n namespaceUri: undefined,\n minOccurs: 0,\n maxOccurs: null,\n useEmptyArrays: false,\n ...options,\n rules,\n }\n}\n\n/**\n * Parses the text content of the current element via the given parse and stringify functions.\n *\n * Does not currently support mixing text and element nodes.\n * E.g. the XML `<note>Dear <name>John</name>, I regret to inform you...</note>` could not be\n * serialized or deserialized using xml rule mappings.\n *\n * @param parse The string passed to this parser is the processed text content of the current\n * element.\n * @param stringify Serializes the value.\n *\n * @see processCharacters\n */\nexport function characters<T>(\n parse: (str: string) => T,\n stringify: (value: T) => string\n): CharactersRule<T> {\n return { type: XmlRuleType.CHARACTERS, parse, stringify }\n}\n\n/**\n * Handles the processed text content without any modification.\n *\n * @see characters\n */\nexport const charactersString = characters((i) => i, stringify)\n\nexport type RequiredAttributeOptions<T> = AttributeRuleOptions<T> &\n ({ required: true } | { default: T })\n\nexport function attr<T>(\n parse: (value: string) => T,\n stringify: (value: T) => string,\n options: RequiredAttributeOptions<T>\n): AttributeRule<T>\n\nexport function attr<T>(\n parse: (value: string) => T,\n stringify: (value: NonNullable<T>) => string,\n options?: AttributeRuleOptions<T>\n): AttributeRule<T | undefined>\n\n/**\n * Handles an attribute using the given parse and stringify functions.\n *\n * @param parse\n * @param stringify\n * @param options\n */\nexport function attr<T>(\n parse: (value: string) => T,\n stringify: (value: T) => string,\n options?: AttributeRuleOptions<T>\n): AttributeRule<T> | AttributeRule<T | undefined> {\n return {\n type: XmlRuleType.ATTRIBUTE,\n localPart: undefined,\n namespaceUri: null,\n required: false,\n default: undefined,\n ...options,\n parse,\n stringify,\n }\n}\n\nexport function attrString(\n options: RequiredAttributeOptions<string>\n): AttributeRule<string>\n\nexport function attrString(\n options?: AttributeRuleOptions<string>\n): AttributeRule<string | undefined>\n\n/**\n * Keeps an attribute's string value as is.\n *\n * @param options\n */\nexport function attrString(\n options?: AttributeRuleOptions<string>\n): AttributeRule<string> | AttributeRule<string | undefined> {\n return attr((i) => i, stringify, options)\n}\n\nexport function attrInt(\n options: RequiredAttributeOptions<number>\n): AttributeRule<number>\n\nexport function attrInt(\n options?: AttributeRuleOptions<number>\n): AttributeRule<number | undefined>\n\n/**\n * Parses an attribute's value using `parseInt`\n *\n * @param options\n */\nexport function attrInt(\n options?: AttributeRuleOptions<number>\n): AttributeRule<number> | AttributeRule<number | undefined> {\n return attr(parseInt, stringify, options)\n}\n\nexport function attrFloat(\n options: RequiredAttributeOptions<number>\n): AttributeRule<number>\n\nexport function attrFloat(\n options?: AttributeRuleOptions<number>\n): AttributeRule<number | undefined>\n\n/**\n * Parses an attribute using `parseFloat`\n *\n * @param options\n */\nexport function attrFloat(\n options?: AttributeRuleOptions<number>\n): AttributeRule<number> | AttributeRule<number | undefined> {\n return attr(parseFloat, stringify, options)\n}\n\nexport function attrBoolean(\n options: RequiredAttributeOptions<boolean>\n): AttributeRule<boolean>\n\nexport function attrBoolean(\n options?: AttributeRuleOptions<boolean>\n): AttributeRule<boolean | undefined>\n\n/**\n * Parses an attribute's value `\"true\"` or `\"1\"` as `true`.\n *\n * @param options\n */\nexport function attrBoolean(\n options?: AttributeRuleOptions<boolean>\n): AttributeRule<boolean> | AttributeRule<boolean | undefined> {\n return attr(parseBoolean, stringify, options)\n}\n\nexport function attrDateTime(\n options: RequiredAttributeOptions<Date>\n): AttributeRule<ReadonlyDate>\n\nexport function attrDateTime(\n options?: AttributeRuleOptions<ReadonlyDate>\n): AttributeRule<ReadonlyDate | undefined>\n\n/**\n * Parses an attribute using `Date.parse`\n *\n * @param options\n */\nexport function attrDateTime(\n options?: AttributeRuleOptions<ReadonlyDate>\n): AttributeRule<ReadonlyDate> | AttributeRule<ReadonlyDate | undefined> {\n return attr(parseDate, stringifyDate, options)\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 IllegalArgumentError,\n invariant,\n type Invariant,\n memoize,\n} from '@amazon/vinyl-util'\n\nimport type { XmlRule, XmlRules } from './xmlRules'\nimport { XmlRuleType } from './xmlRules'\nimport type { Uri } from '../xmlns/org/w3/2001/XmlSchema'\n\n/**\n * A machine-readable representation of parse rules for random access based on qualified namespace\n * keys.\n *\n * Rule keys will either be `namespaceUri:localPart` or just `localPart` for wildcard rules if\n * namespaceUri is not defined in the handler.\n */\nexport interface MappedXmlRules<T> {\n /**\n * Enforces that this rule set can only be used to parse the expected type T.\n */\n readonly __type: Invariant<T>\n readonly attributes: ReadonlyMap<string, MappedAttributeRule>\n readonly elements: ReadonlyMap<string, MappedElementsRule>\n readonly characters: MappedCharactersRule | undefined\n}\n\nexport interface MappedAttributeRule {\n /**\n * The property name.\n */\n readonly property: keyof any\n\n /**\n * If true, a parsing error will be thrown if the value is undefined.\n */\n readonly required: boolean\n\n /**\n * If the current element has no matching attribute, default will be used.\n */\n readonly default: any\n\n /**\n * Parses the attribute value.\n */\n readonly parse: (value: string) => any\n\n /**\n * Converts the attribute value to a string.\n */\n readonly stringify: (value: any) => string\n\n /**\n * The local part of the QName.\n */\n readonly localPart: string\n\n /**\n * The namespace uri that must match.\n */\n readonly namespaceUri: Uri | null\n}\n\nexport interface MappedElementsRule {\n /**\n * The name of the property to set on the parent element.\n */\n readonly property: keyof any\n\n /**\n * True if the parsed elements should populate into an array.\n */\n readonly array: boolean\n\n /**\n * The minimum number of elements.\n */\n readonly minOccurs: number\n\n /**\n * The maximum number of elements. Use null for unbounded.\n */\n readonly maxOccurs: number | null\n\n /**\n * If true and there are 0 occurrences of the element, the parsed value will be an empty array\n * instead of undefined.\n */\n readonly useEmptyArrays: boolean\n\n /**\n * Returns the mappings for matched element(s).\n */\n readonly rules: () => MappedXmlRules<any>\n\n /**\n * The local part of the QName.\n */\n readonly localPart: string\n\n /**\n * The namespace uri that must match.\n */\n readonly namespaceUri: Uri | null\n}\n\nexport interface MappedCharactersRule {\n readonly property: keyof any\n\n /**\n * Parses the unescaped/processed characters.\n * This will always be called, but characters may be an empty string if the element has no\n * text content.\n */\n readonly parse: (characters: string) => any\n\n /**\n * Converts the value to a string.\n */\n readonly stringify: (value: any) => string\n}\n\n/**\n * An empty rules map, used when there was no match for the started element.\n * @private\n */\nexport const EmptyRules: MappedXmlRules<AnyRecord> = {\n __type: invariant(),\n attributes: new Map(),\n elements: new Map(),\n characters: undefined,\n} as const\n\n/**\n * Creates machine-friendly content handler rules from the given {@link XmlRules}.\n *\n * @param rules The {@link XmlRules} to convert.\n * @param parentNamespaceUri\n */\nexport function mapXmlRules<T extends object>(\n rules: XmlRules<T>,\n parentNamespaceUri: Uri | null = null\n): MappedXmlRules<T> {\n const attributeRules = new Map<string, MappedAttributeRule>()\n const elementRules = new Map<string, MappedElementsRule>()\n let charactersRule: MappedCharactersRule | undefined = undefined\n\n for (const property in rules) {\n const handlerOrFunction = rules[property as keyof typeof rules]\n let handler: XmlRule<any>\n if (typeof handlerOrFunction === 'function') {\n handler = handlerOrFunction()\n } else {\n handler = handlerOrFunction\n }\n let key: string\n switch (handler.type) {\n case XmlRuleType.CHARACTERS:\n if (charactersRule !== undefined)\n throw new IllegalArgumentError(\n 'characters handler already defined'\n )\n charactersRule = {\n property,\n parse: handler.parse,\n stringify: handler.stringify,\n }\n break\n case XmlRuleType.ELEMENT:\n case XmlRuleType.ELEMENTS: {\n const localPart = handler.localPart ?? property\n const namespaceUri: Uri | null =\n handler.namespaceUri === undefined\n ? parentNamespaceUri\n : handler.namespaceUri\n key = xmlRuleKey(localPart, namespaceUri)\n if (elementRules.has(key)) {\n throw new IllegalArgumentError(\n `Multiple element rules for ${key}`\n )\n }\n if (handler.type === XmlRuleType.ELEMENT) {\n const rules = handler.rules\n elementRules.set(key, {\n array: false,\n property,\n minOccurs: handler.required ? 1 : 0,\n maxOccurs: 1,\n rules: memoize(() => mapXmlRules(rules, namespaceUri)),\n useEmptyArrays: false,\n localPart,\n namespaceUri,\n })\n } else {\n const rules = handler.rules\n elementRules.set(key, {\n array: true,\n property,\n maxOccurs: handler.maxOccurs,\n minOccurs: handler.minOccurs,\n rules: memoize(() => mapXmlRules(rules, namespaceUri)),\n useEmptyArrays: handler.useEmptyArrays,\n localPart,\n namespaceUri,\n })\n }\n break\n }\n case XmlRuleType.ATTRIBUTE: {\n // Attributes should not inherit the namespace of the parent element.\n const namespaceUri = handler.namespaceUri\n const localPart = handler.localPart ?? property\n key = xmlRuleKey(localPart, namespaceUri)\n if (attributeRules.has(key)) {\n throw new IllegalArgumentError(\n `Multiple attribute rules for ${key}`\n )\n }\n attributeRules.set(key, {\n property,\n default: handler.default,\n parse: handler.parse,\n stringify: handler.stringify,\n required: handler.required,\n localPart,\n namespaceUri: handler.namespaceUri ?? null,\n })\n break\n }\n }\n }\n return {\n __type: invariant(),\n attributes: attributeRules,\n elements: elementRules,\n characters: charactersRule,\n }\n}\n\n/**\n * Creates a rule key for mapped xml rules.\n *\n * @private\n * @param localPart The {@link QName.localPart}\n * @param namespaceUri The `namespaceUri` of the element.\n */\nexport function xmlRuleKey(\n localPart: string,\n namespaceUri: Uri | null = null\n): string {\n return `${namespaceUri ?? ''}:${localPart}`\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 Fun,\n plainObjectMergeRule,\n substitute,\n ValidationError,\n} from '@amazon/vinyl-util'\n\nimport {\n type AttributeRule,\n type ElementRule,\n type ElementsRule,\n type LazyXmlRule,\n type XmlRule,\n type XmlRules,\n XmlRuleType,\n} from './xmlRules'\n\nconst locale = {\n illegalRuleOverrideTypeError:\n 'Cannot override the rule {property} of type {sourceType} with a rule of type {overrideType}',\n illegalQNameOverrideError:\n 'Cannot override the rule {property} with a different localPart or namespace',\n} as const\n\n/**\n * Recursively merges array types so that S[] & T[] becomes (S & T)[]\n * When two array elements parsing rules are merged, the result is an array with intersected\n * element types.\n */\nexport type Merged<T> = T extends readonly any[]\n ? MergedTupleOrArray<T>\n : T extends Fun\n ? T\n : T extends object\n ? {\n [P in keyof T]: Merged<T[P]>\n }\n : T\n\n/**\n * `[S0, T0] & [S1, T1]` cannot be converted to `[S0 & S1, T0 & T1]`, but we can at least preserve\n * the tuple when not intersected.\n *\n * Intersected tuples become arrays. E.g. `[S0, T0] & [S1, T1]` becomes `Array<S0 | S1 | T0 | T1>`\n */\nexport type MergedTupleOrArray<T extends readonly any[]> = T extends [infer V0]\n ? // Support tuples up to 5 in length\n [Merged<V0>]\n : T extends [infer V0, infer V1]\n ? [Merged<V0>, Merged<V1>]\n : T extends [infer V0, infer V1, infer V2]\n ? [Merged<V0>, Merged<V1>, Merged<V2>]\n : T extends [infer V0, infer V1, infer V2, infer V3]\n ? [Merged<V0>, Merged<V1>, Merged<V2>, Merged<V3>]\n : T extends [infer V0, infer V1, infer V2, infer V3, infer V4]\n ? [Merged<V0>, Merged<V1>, Merged<V2>, Merged<V3>, Merged<V4>]\n : T extends any[]\n ? Array<Merged<T[number]>>\n : T extends readonly [infer V0]\n ? readonly [Merged<V0>]\n : T extends readonly [infer V0, infer V1]\n ? readonly [Merged<V0>, Merged<V1>]\n : T extends readonly [infer V0, infer V1, infer V2]\n ? readonly [Merged<V0>, Merged<V1>, Merged<V2>]\n : T extends readonly [\n infer V0,\n infer V1,\n infer V2,\n infer V3,\n ]\n ? readonly [\n Merged<V0>,\n Merged<V1>,\n Merged<V2>,\n Merged<V3>,\n ]\n : T extends readonly [\n infer V0,\n infer V1,\n infer V2,\n infer V3,\n infer V4,\n ]\n ? readonly [\n Merged<V0>,\n Merged<V1>,\n Merged<V2>,\n Merged<V3>,\n Merged<V4>,\n ]\n : ReadonlyArray<Merged<T[number]>>\n\n/**\n * Merges the given two xml rule sets into one.\n */\nexport function mergeXmlRules<A extends object, B extends object>(\n a: XmlRules<A>,\n b: XmlRules<B>\n): XmlRules<Merged<A & B>>\n\n/**\n * Merges the given three xml rule sets into one.\n */\nexport function mergeXmlRules<\n A extends object,\n B extends object,\n C extends object,\n>(a: XmlRules<A>, b: XmlRules<B>, c: XmlRules<C>): XmlRules<Merged<A & B & C>>\n\n/**\n * Merges the given four xml rule sets into one.\n */\nexport function mergeXmlRules<\n A extends object,\n B extends object,\n C extends object,\n D extends object,\n>(\n a: XmlRules<A>,\n b: XmlRules<B>,\n c: XmlRules<C>,\n d: XmlRules<D>\n): XmlRules<Merged<A & B & C & D>>\n\n/**\n * Merges the given five xml rule sets into one.\n */\nexport function mergeXmlRules<\n A extends object,\n B extends object,\n C extends object,\n D extends object,\n E extends object,\n>(\n a: XmlRules<A>,\n b: XmlRules<B>,\n c: XmlRules<C>,\n d: XmlRules<D>,\n e: XmlRules<E>\n): XmlRules<Merged<A & B & C & D & E>>\n\n/**\n * Merges the given six xml rule sets into one.\n */\nexport function mergeXmlRules<\n A extends object,\n B extends object,\n C extends object,\n D extends object,\n E extends object,\n F extends object,\n>(\n a: XmlRules<A>,\n b: XmlRules<B>,\n c: XmlRules<C>,\n d: XmlRules<D>,\n e: XmlRules<E>,\n f: XmlRules<F>\n): XmlRules<Merged<A & B & C & D & E & F>>\n\n/**\n * Merges the given rules into one ruleset.\n *\n * @param rules\n * @return A new XmlRules map with the merged rules.\n */\nexport function mergeXmlRules(\n ...rules: XmlRules<any>[]\n): XmlRules<Merged<any>> {\n let finalRule = rules[0]\n for (let i = 1; i < rules.length; i++) {\n finalRule = plainObjectMergeRule.merge(\n finalRule,\n rules[i],\n mergeXmlRule\n ) as XmlRules<any>\n }\n return finalRule\n}\n\nfunction mergeXmlRule(\n sourceA: XmlRule<any> | undefined,\n sourceB: XmlRule<any>,\n prop: string | number\n): XmlRule<any>\n\nfunction mergeXmlRule(\n sourceA: XmlRule<any> | LazyXmlRule<any> | undefined,\n sourceB: XmlRule<any> | LazyXmlRule<any>,\n prop: string | number\n): XmlRule<any> | LazyXmlRule<any>\n\nfunction mergeXmlRule(\n sourceA: XmlRule<any> | LazyXmlRule<any> | undefined,\n sourceB: XmlRule<any> | LazyXmlRule<any>,\n prop: string | number\n): XmlRule<any> | LazyXmlRule<any> {\n if (sourceA == null) return sourceB\n const sourceAIsLazy = typeof sourceA === 'function'\n const sourceBIsLazy = typeof sourceB === 'function'\n if (sourceAIsLazy || sourceBIsLazy) {\n return () => {\n const a = sourceAIsLazy ? sourceA() : sourceA\n const b = sourceBIsLazy ? sourceB() : sourceB\n return mergeXmlRule(a, b, prop)\n }\n }\n if (sourceA.type !== sourceB.type) {\n throw new ValidationError(\n substitute(locale.illegalRuleOverrideTypeError, {\n property: prop,\n sourceType: sourceA.type,\n overrideType: sourceB.type,\n })\n )\n }\n switch (sourceA.type) {\n case XmlRuleType.ATTRIBUTE:\n case XmlRuleType.ELEMENT:\n case XmlRuleType.ELEMENTS: {\n const b = sourceB as ElementRule<any>\n if (\n sourceA.namespaceUri !== b.namespaceUri ||\n (sourceA.localPart ?? prop) !== (b.localPart ?? prop)\n ) {\n throw new ValidationError(\n substitute(locale.illegalQNameOverrideError, {\n property: prop,\n })\n )\n }\n break\n }\n }\n\n switch (sourceA.type) {\n case XmlRuleType.ATTRIBUTE: {\n const b = sourceB as AttributeRule<any>\n return {\n ...b,\n default: b.default ?? sourceA.default,\n }\n }\n case XmlRuleType.CHARACTERS:\n return sourceB\n case XmlRuleType.ELEMENT: {\n const b = sourceB as ElementRule<any>\n return {\n ...b,\n required: sourceA.required || b.required,\n rules: mergeXmlRules(sourceA.rules, b.rules),\n }\n }\n case XmlRuleType.ELEMENTS: {\n const b = sourceB as ElementsRule<any>\n const maxOccurs =\n sourceA.maxOccurs != null && b.maxOccurs != null\n ? Math.min(sourceA.maxOccurs, b.maxOccurs)\n : (sourceA.maxOccurs ?? b.maxOccurs)\n return {\n ...b,\n minOccurs: Math.max(sourceA.minOccurs, b.minOccurs),\n maxOccurs,\n useEmptyArrays: sourceA.useEmptyArrays || b.useEmptyArrays,\n rules: mergeXmlRules(sourceA.rules, b.rules),\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 {\n char,\n decodeEntities,\n last,\n type MutableDeep,\n StringReader,\n} from '@amazon/vinyl-util'\n\nimport type { Uri } from '../xmlns/org/w3/2001/XmlSchema'\nimport type { Attributes, ParseXmlHandler } from './ParseXmlHandler'\nimport type { QName } from './QName'\nimport type { XmlElement } from './ParseXmlHandlerImpl'\n\nexport const XMLNS = 'http://www.w3.org/2000/xmlns/'\n\nconst LT = char('<')\nconst GT = char('>')\nconst EQ = char('=')\nconst SLASH = char('/')\nconst COLON = char(':')\nconst QMARK = char('?')\nconst EXCL = char('!')\nconst APOS = char(\"'\")\nconst QUOT = char('\"')\nconst QUOTES = new Set([APOS, QUOT])\n\n/**\n * Nested xml elements push current namespace information onto a stack.\n *\n * @private\n */\nexport interface StackElement {\n /**\n * The qualified name of the current element on the stack. Used to validate expected closing\n * element.\n */\n readonly qName: string\n\n /**\n * The (mutable) namespaces map for the current stack.\n */\n readonly namespaceMap: Namespaces\n\n /**\n * The default namespace.\n */\n defaultNamespaceUri: Uri | null\n}\n\n/**\n * Parses an XML document using a partial sax-style content handler.\n * This allows for parsing without the entire document being read into memory first.\n *\n * XML Documents are mapped to data structures through content handlers instead of needing an\n * intermediate model.\n */\nexport function parseXml<T>(\n str: string,\n handler: ParseXmlHandler<T>\n): T & XmlElement<T> {\n const c = new StringReader(str)\n let current: StackElement = {\n qName: '#document',\n namespaceMap: new Map(),\n defaultNamespaceUri: null,\n }\n const stack: StackElement[] = [current]\n\n /**\n * Provides the namespace uri for the given prefix on the current stack.\n * @param prefix\n */\n const namespaceLookup = (prefix: string | null): Uri | null => {\n if (!prefix) return current.defaultNamespaceUri\n for (let i = stack.length - 1; i >= 0; i--) {\n const map = stack[i].namespaceMap\n if (map.has(prefix)) return stack[i].namespaceMap.get(prefix)!\n }\n return null\n }\n\n try {\n handler.startDocument()\n } catch (e: any) {\n c.err(e.message)\n }\n while (c.hasNext()) {\n const charsStart = c.untilChar(LT)\n if (charsStart < c.position) {\n const chars = str.substring(charsStart, c.position)\n try {\n handler.textNode(chars)\n } catch (e: any) {\n c.err(e.message)\n }\n }\n if (!c.hasNext()) break // eos\n c.next() // <\n if (c.charIf(SLASH)) {\n // </ prepare for ending the element.\n c.white()\n const name = readQName(c)\n if (name.qName !== current.qName)\n c.err(`Expected </${current.qName}> but was </${name.qName}>`)\n stack.pop()\n current = last(stack)!\n c.white()\n c.readChar(GT)\n try {\n handler.endElement()\n } catch (e: any) {\n c.err(e.message)\n }\n } else if (c.charIf(QMARK)) {\n // <? Processing instruction\n untilTagClose(c)\n } else if (c.charIf(EXCL)) {\n // <! Declaration\n if (c.charIf(0x2d /* - */)) {\n c.readChar(0x2d)\n // <!-- Comment\n c.untilString('-->')\n c.read('-->')\n } else if (c.stringIf('[CDATA[')) {\n // <![CDATA[\n const charsStart = c.untilString(']]>')\n try {\n handler.cDataNode(str.substring(charsStart, c.position))\n } catch (e: any) {\n c.err(e.message)\n }\n c.read(']]>')\n } else {\n // <! Declaration\n untilTagClose(c)\n }\n } else {\n // < Prepare for beginning the element\n // Create a new stack element, inheriting the namespaces of the parent.\n const name: MutableDeep<QName> = readQName(c)\n current = {\n qName: name.qName,\n namespaceMap: new Map(),\n defaultNamespaceUri: current.defaultNamespaceUri,\n }\n stack.push(current)\n const attributes = xmlAttributes(c, current)\n // The namespaces can only be looked up after all attributes are parsed;\n // a namespace prefix may be defined after it's used on the same element.\n name.namespaceUri = namespaceLookup(name.prefix)\n for (const attributesKey in attributes) {\n const value = attributes[attributesKey]!\n const name = value.name\n // Attributes do not inherit the default namespace.\n if (name.prefix && !name.namespaceUri) {\n name.namespaceUri = namespaceLookup(name.prefix)\n }\n }\n\n try {\n handler.startElement(name, attributes)\n } catch (e: any) {\n c.err(e.message)\n }\n if (c.charIf(SLASH)) {\n c.readChar(GT)\n stack.pop()\n current = last(stack)!\n // Closed tag <example/>\n try {\n handler.endElement()\n } catch (e: any) {\n c.err(e.message)\n }\n } else {\n c.readChar(GT)\n }\n }\n }\n try {\n return handler.endDocument()\n } catch (e: any) {\n return c.err(e.message)\n }\n}\n\n/**\n * @private\n */\nexport type Namespaces = Map<string, Uri | null>\n\n// noinspection GrazieInspection\n/**\n * Given that the cursor is at a ' or \", reads the sequence of characters until an end quote is\n * reached.\n * The returned unescaped string is the text within the quotes.\n * @private\n */\nexport function readAttributeValue(c: StringReader): string {\n const quote = c.next()\n if (!QUOTES.has(quote)) c.err('Expected \\' or \"')\n const value = c.substringUntil((charCode) => charCode === quote)\n c.readChar(quote)\n return decodeEntities(value)\n}\n\n/**\n * Reads until the end of the tag >\n * @private\n */\nexport function untilTagClose(c: StringReader): void {\n while (true) {\n c.until((c) => c === APOS || c === QUOT || c === GT)\n const char = c.next()\n if (QUOTES.has(char)) {\n c.untilChar(char)\n c.next()\n } else {\n // >\n break\n }\n }\n}\n\n/**\n * Returns true if the char code is a valid xml name character.\n * @see https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar\n * @param charCode\n * @private\n */\nexport function isNameChar(charCode: number): boolean {\n if (charCode >= 0x61 /* a */) {\n if (charCode >= 0xb7 /* \u00B7 */) {\n if (charCode >= 0x300) {\n if (charCode >= 0x203f) {\n return charCode <= 0x2040\n } else {\n return charCode <= 0x36f\n }\n } else {\n return charCode === 0xb7 /* \u00B7 */\n }\n } else {\n return charCode <= 0x7a /* z */\n }\n } else {\n if (charCode >= 0x5f /* _ */) {\n return charCode === 0x5f\n } else {\n if (charCode >= 0x41 /* A */) {\n return charCode <= 0x5a /* Z */\n } else {\n if (charCode >= 0x2d /* - */) {\n if (charCode >= 0x30 /* 0 */) {\n return charCode <= 0x39 /* 9 */\n } else {\n return charCode <= 0x2e /* . */\n }\n } else {\n return false\n }\n }\n }\n }\n}\n\n/**\n * Reads an xml {@link QName}.\n * The {@link QName.namespaceUri} returned will be null; it must be separately looked up.\n *\n * @param reader The current string reader.\n * @private\n */\nexport function readQName(reader: StringReader): MutableDeep<QName> {\n const prefixOrLocalName = reader.substringWhile(isNameChar)\n let prefix: string | null, localPart: string, name: string\n if (reader.charIf(COLON)) {\n prefix = prefixOrLocalName\n localPart = reader.substringWhile(isNameChar)\n name = `${prefix}:${localPart}`\n } else {\n prefix = null\n localPart = prefixOrLocalName\n name = localPart\n }\n return { prefix, localPart, qName: name, namespaceUri: null }\n}\n\n/**\n * Reads a series of xml attributes, separated by whitespace.\n * Example: `ns1:key1=\"value1\" key2 key3='value3'`\n * Note: consumes all whitespace before and after attributes series.\n *\n * @return Returns a map of attribute `qName:string` to `Attribute` objects.\n *\n * @private\n */\nexport function xmlAttributes(\n reader: StringReader,\n stackElement: StackElement\n): MutableDeep<Attributes> {\n const attributes: MutableDeep<Attributes> = {}\n while (true) {\n reader.white()\n if (!isNameChar(reader.peek)) break\n const name = readQName(reader)\n reader.white()\n let value = ''\n if (reader.charIf(EQ)) {\n reader.white()\n value = readAttributeValue(reader)\n } else {\n // Attributes without values are valid in html, but not xml\n }\n\n if (name.prefix === 'xmlns') {\n name.namespaceUri = XMLNS\n stackElement.namespaceMap.set(\n name.localPart,\n value === '' ? null : value\n )\n } else if (!name.prefix && name.localPart === 'xmlns') {\n name.namespaceUri = XMLNS\n stackElement.defaultNamespaceUri = !value ? null : value\n }\n if (attributes[name.qName] != null)\n reader.err(`Attribute '${name.qName}' is already specified.`)\n attributes[name.qName] = { name, value }\n }\n return attributes\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin, ReportableError } from '@amazon/vinyl-util'\n\n/**\n * @private\n */\nexport const xmlSchemaErrorLocale = {\n atLeastElements:\n 'Expected at least {expected} occurrences of {property} but was {actual}',\n atMostElements:\n 'Expected at most {expected} occurrences of {property} but was {actual}',\n cyclicReferences: 'Cyclic reference detected',\n requiredAttribute: `Attribute '{property}' is required`,\n} as const\n\nexport class XmlSchemaError extends ReportableError {\n get [Symbol.toStringTag](): string {\n return 'XmlSchemaError'\n }\n\n constructor(message: string) {\n super(message, ErrorOrigin.PARSING)\n Object.setPrototypeOf(this, XmlSchemaError.prototype)\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 clone,\n type Cloneable,\n decodeEntities,\n IllegalStateError,\n last,\n substitute,\n toJson,\n} from '@amazon/vinyl-util'\n\nimport type { XmlRules } from './xmlRules'\nimport type { MappedXmlRules } from './mappedXmlRules'\nimport { EmptyRules, mapXmlRules, xmlRuleKey } from './mappedXmlRules'\nimport type { Attributes, ParseXmlHandler } from './ParseXmlHandler'\nimport type { QName } from './QName'\nimport { XmlSchemaError, xmlSchemaErrorLocale } from './XmlSchemaError'\n\ninterface StackElement {\n /**\n * The current object being built.\n */\n readonly element: any\n\n /**\n * The current element's text content. This will be appended to on every {@link characters}\n * callback.\n */\n characters: string\n\n /**\n * The current element rules.\n */\n readonly rules: MappedXmlRules<any>\n}\n\n/**\n * Choose the rule using namespaces first, if there is no match, query the wildcard namespace rules.\n */\nfunction getRule<T>(\n name: QName,\n rules: ReadonlyMap<string, T | undefined>\n): T | undefined {\n return rules.get(xmlRuleKey(name.localPart, name.namespaceUri))\n}\n\nexport interface ParseXmlHandlerOptions {\n readonly validateRules: boolean\n}\n\n/**\n * A {@link ParseXmlHandler} implementation that follows {@link XmlRules}, building an object of\n * the parameterized type.\n */\nexport class ParseXmlHandlerImpl<T> implements ParseXmlHandler<T> {\n private stack: StackElement[] = []\n\n private options: ParseXmlHandlerOptions\n private busy = false\n\n constructor(\n private readonly rules: MappedXmlRules<T>,\n options?: Partial<ParseXmlHandlerOptions>\n ) {\n this.options = { validateRules: true, ...options }\n }\n\n startDocument(): void {\n if (this.busy)\n throw new IllegalStateError('XML content handler is busy')\n this.busy = true\n const rules = this.rules\n this.stack.push({\n element: new XmlElementImpl(),\n rules,\n characters: '',\n })\n }\n\n startElement(name: QName, attributes: Attributes): void {\n const parent = last(this.stack)!\n let element: any = null\n const elementRule = getRule(name, parent.rules.elements)\n const rules = elementRule?.rules() ?? EmptyRules\n if (elementRule) {\n const prop = elementRule.property\n element = new XmlElementImpl(parent.element)\n if (elementRule.array) {\n const arr = parent.element[prop]\n if (Array.isArray(arr)) {\n arr.push(element)\n } else {\n parent.element[prop] = [element]\n }\n } else {\n if (parent.element[prop]) {\n throw new XmlSchemaError(\n `Expected single element with name ${name.qName}`\n )\n } else {\n parent.element[prop] = element\n }\n }\n\n const attributeRules = rules.attributes\n for (const k in attributes) {\n const attribute = attributes[k]!\n const name = attribute.name\n const attributeRule = getRule(name, attributeRules)\n if (attributeRule) {\n element[attributeRule.property] = attributeRule.parse(\n attribute.value\n )\n }\n }\n\n // Set attribute defaults:\n attributeRules.forEach((_value, key) => {\n const rule = attributeRules.get(key)!\n if (!(rule.property in element)) {\n if (rule.default != null) {\n element[rule.property] = rule.default\n } else if (this.options.validateRules && rule.required) {\n throw new XmlSchemaError(\n substitute(xmlSchemaErrorLocale.requiredAttribute, {\n property: rule.property,\n })\n )\n }\n }\n })\n }\n this.stack.push({\n element,\n rules,\n characters: '',\n })\n }\n\n textNode(str: string): void {\n const current = last(this.stack)!\n if (!current.rules.characters) return\n current.characters += decodeEntities(str.trim())\n }\n\n cDataNode(str: string): void {\n const current = last(this.stack)!\n if (!current.rules.characters) return\n current.characters += str\n }\n\n endElement(): void {\n const lastEl = this.stack.pop()!\n const charactersRule = lastEl.rules.characters\n if (charactersRule)\n lastEl.element[charactersRule.property] = charactersRule.parse(\n lastEl.characters\n )\n lastEl.rules.elements.forEach((rule) => {\n if (rule.array && !(rule.property in lastEl.element)) {\n if (rule.useEmptyArrays) {\n lastEl.element[rule.property] = []\n }\n }\n })\n this.validate(lastEl)\n }\n\n endDocument(): T & XmlElement<T> {\n this.busy = false\n const last = this.stack.pop()!\n this.validate(last)\n return last.element\n }\n\n private validate(current: StackElement) {\n if (!this.options.validateRules) return\n current.rules.elements.forEach((rule) => {\n const length = rule.array\n ? (current.element[rule.property]?.length ?? 0)\n : current.element[rule.property]\n ? 1\n : 0\n if (length < rule.minOccurs) {\n throw new XmlSchemaError(\n substitute(xmlSchemaErrorLocale.atLeastElements, {\n property: rule.property,\n expected: rule.minOccurs,\n actual: length,\n })\n )\n }\n if (rule.maxOccurs != null && length > rule.maxOccurs) {\n throw new XmlSchemaError(\n substitute(xmlSchemaErrorLocale.atMostElements, {\n property: rule.property,\n expected: rule.maxOccurs,\n actual: length,\n })\n )\n }\n })\n }\n}\n\n/**\n * Creates an XML content handler for the given parsing rules.\n *\n * @param rules\n * @param options\n */\nexport function parseXmlHandler<T extends object>(\n rules: XmlRules<T>,\n options?: Partial<ParseXmlHandlerOptions>\n): ParseXmlHandlerImpl<T> {\n return new ParseXmlHandlerImpl<T>(mapXmlRules(rules), options)\n}\n\n// Use a symbol to prevent parent from inclusion in property enumeration.\nconst parentSymbol = Symbol('parent')\n\nexport interface XmlElement<T = any> extends Cloneable<T & XmlElement<T>> {\n get parent(): XmlElement | null\n toJSON(): any\n}\n\nexport class XmlElementImpl<T> implements XmlElement<T> {\n [prop: keyof any]: any\n\n private [parentSymbol]: XmlElement | null\n\n constructor(parent: XmlElement | null = null) {\n this[parentSymbol] = parent\n }\n\n get parent(): XmlElement | null {\n return this[parentSymbol]\n }\n\n set parent(value: XmlElement | null) {\n this[parentSymbol] = value\n }\n\n clone(): T & XmlElementImpl<T> {\n const out: any = new XmlElementImpl(this.parent)\n for (const key in this) {\n // Clone all children, setting their parent references to the new cloned parent.\n const child: any = clone(this[key])\n if (Array.isArray(child)) {\n for (const e of child) {\n if (typeof e === 'object' && 'parent' in e) e.parent = out\n }\n } else if (typeof child === 'object' && 'parent' in child) {\n child.parent = out\n }\n out[key] = child\n }\n return out\n }\n\n toJSON(): any {\n const out: any = {}\n for (const key in this) {\n out[key] = toJson(this[key])\n }\n return out\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { parseIntSafe } from '@amazon/vinyl-util'\nimport { throwParsingError } from '../error/parsingError'\n\n/**\n * A range of bytes, [from, to (optional, inclusive)].\n */\nexport type ByteRange = readonly [number, number | null]\n\nconst byteRangeExp = /^(-?[0-9]+)-(-?[0-9]*)$/\n\nexport function parseByteRange(str: string): ByteRange {\n const match = str ? byteRangeExp.exec(str) : null\n if (!match) throwParsingError(`invalid byte range: '${str}'`)\n let start = parseInt(match[1])\n // Convert possibly-negative Int32 overflow value to its Uint32 equivalent\n // (reinterpret 32-bit signed integer bits as unsigned)\n if (start < 0) start >>>= 0\n let end = parseIntSafe(match[2])\n if (end != null && end < 0) end = end >>> 0\n return [start, end]\n}\n\n/**\n * Returns the string representation of a {@link ByteRange} value.\n *\n * @param value\n */\nexport function stringifyByteRange(value: ByteRange): string {\n const end = value[1]\n return `${value[0]}-${end == null ? '' : end}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { throwParsingError } from '../error/parsingError'\n\n/**\n * A numerator and denominator.\n */\nexport type Ratio = readonly [number, number]\n\n/**\n * The XSD specifies `[0-9]*`, and not `[0-9]+`, which would match `'23:'`\n * For missing dimensions, default to 1.\n */\nconst ratioRegExp = /^([0-9]*):([0-9]*)$/\n\n/**\n * Parses a string representing a ratio into [number, number].\n * The string must satisfy the pattern: `/^([0-9]*):([0-9]*)$/`\n * Examples:\n * ```\n * parseRatio('4:3') // [4, 3]\n * parseRatio('16:9') // [16, 9]\n * parseRatio('2:') // [2, 1]\n * ```\n *\n * @private\n */\nexport function parseRatio(str: string): Ratio {\n const match = str ? ratioRegExp.exec(str) : null\n if (!match) throwParsingError(`invalid ratio format: ${str}`)\n return [parseInt(match[1] || '1'), parseInt(match[2] || '1')]\n}\n\n/**\n * Returns the string representation of a {@link Ratio} value.\n *\n * @param value\n */\nexport function stringifyRatio(value: Ratio): string {\n return `${value[0]}:${value[1]}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { throwParsingError } from '../error/parsingError'\n\nexport type FrameRate = readonly [number, number]\n\nconst framerateRegexp = /^(\\d+)(?:\\/(\\d+))?$/\n\n/**\n * Parses a string into a {@link FrameRate}\n *\n * @private\n */\nexport function parseFrameRate(str: string): FrameRate {\n const match = str ? framerateRegexp.exec(str) : null\n if (!match) throwParsingError(`invalid frame rate: '${str}'`)\n return [parseInt(match[1]), parseInt(match[2] || '1')]\n}\n\n/**\n * Returns the string representation of a {@link FrameRate} value.\n *\n * @param value\n */\nexport function stringifyFrameRate(value: FrameRate): string {\n return value[1] === 1 ? value[0].toString() : `${value[0]}/${value[1]}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Parser definitions for a dash manifest.\n * Attribute order does not matter, element order matters for writing.\n *\n * @module\n */\n\nimport type { actuateType, UriType } from '@amazon/vinyl-xml'\nimport {\n assertActuateEnum,\n attr,\n attrBoolean,\n attrDateTime,\n attrFloat,\n attrInt,\n attrString,\n charactersString,\n element,\n elements,\n type XmlRules,\n} from '@amazon/vinyl-xml'\nimport { ErrorOrigin, stringify } from '@amazon/vinyl-util'\nimport { isOneOf, number, type Validator } from '@amazon/vinyl-validation'\nimport { parseDuration, stringifyDuration } from '../duration/duration'\nimport { parseByteRange, stringifyByteRange } from '../media/byteRange'\nimport { parseRatio, stringifyRatio } from '../media/ratio'\nimport { parseFrameRate, stringifyFrameRate } from '../media/frameRate'\nimport type {\n AdaptationSetType,\n BaseURLType,\n ConditionalUintType,\n ContentComponentType,\n DashManifest,\n DescriptorType,\n EventStreamType,\n EventType,\n MetricsType,\n MPDtype,\n MultipleSegmentBaseType,\n PeriodType,\n PresentationType,\n ProgramInformationType,\n RangeType,\n RepresentationBaseType,\n RepresentationType,\n SegmentBaseType,\n SegmentListType,\n SegmentTemplateType,\n SegmentTimelineType,\n SegmentTimelineTypeSType,\n SegmentURLType,\n SubRepresentationType,\n SubsetType,\n SwitchingType,\n SwitchingTypeType,\n URLType,\n VideoScanType,\n} from '../xmlns/mpeg/dash/schema/mpd/2011'\n\nexport const dashNamespaceUri = 'urn:mpeg:dash:schema:mpd:2011'\n\nexport function dashManifestXmlRules(): XmlRules<DashManifest> {\n const attrActuateType = attr<actuateType>(assertActuateEnum, stringify, {\n default: 'onRequest',\n } as const)\n\n const descriptorType: XmlRules<DescriptorType> = {\n id: attrString,\n schemeIdUri: attrString({ required: true }),\n value: attrString,\n } as const\n\n const baseURLType: XmlRules<BaseURLType> = {\n availabilityTimeComplete: attrBoolean,\n availabilityTimeOffset: attrFloat,\n byteRange: attrString,\n serviceLocation: attrString,\n _content: charactersString,\n } as const\n\n const contentComponentType: XmlRules<ContentComponentType> = {\n contentType: attrString,\n id: attrInt,\n lang: attrString,\n par: attr(parseRatio, stringifyRatio),\n Accessibility: elements(descriptorType),\n Rating: elements(descriptorType),\n Role: elements(descriptorType),\n Viewpoint: elements(descriptorType),\n } as const\n\n const urlType: XmlRules<URLType> = {\n range: attr(parseByteRange, stringifyByteRange),\n sourceURL: attrString,\n } as const\n\n const uriType: XmlRules<UriType> = { _content: charactersString } as const\n\n const segmentBaseType: XmlRules<SegmentBaseType> = {\n Initialization: element(urlType),\n RepresentationIndex: element(urlType),\n availabilityTimeComplete: attrBoolean,\n availabilityTimeOffset: attrInt,\n indexRange: attr(parseByteRange, stringifyByteRange),\n indexRangeExact: attrBoolean({ default: false }),\n presentationTimeOffset: attrFloat,\n timescale: attrInt,\n } as const\n\n const segmentTimelineTypeSType: XmlRules<SegmentTimelineTypeSType> = {\n d: attrInt({ required: true }),\n n: attrInt,\n r: attrInt({ default: 0 }),\n t: attrInt,\n } as const\n\n const segmentTimelineType: XmlRules<SegmentTimelineType> = {\n S: elements(segmentTimelineTypeSType),\n } as const\n\n const multipleSegmentBaseType: XmlRules<MultipleSegmentBaseType> = {\n ...segmentBaseType,\n SegmentTimeline: element(segmentTimelineType),\n BitstreamSwitching: element(urlType),\n duration: attrInt,\n startNumber: attrInt,\n } as const\n\n const segmentURLType: XmlRules<SegmentURLType> = {\n index: attrString,\n indexRange: attr(parseByteRange, stringifyByteRange),\n media: attrString,\n mediaRange: attr(parseByteRange, stringifyByteRange),\n } as const\n\n const segmentListType: XmlRules<SegmentListType> = {\n ...multipleSegmentBaseType,\n actuate: attrActuateType,\n href: attrString,\n SegmentURL: elements(segmentURLType),\n } as const\n\n const segmentTemplateType: XmlRules<SegmentTemplateType> = {\n ...multipleSegmentBaseType,\n bitstreamSwitching: attrString,\n index: attrString,\n initialization: attrString,\n media: attrString,\n } as const\n\n const subsetType: XmlRules<SubsetType> = {\n contains: attr(parseIntVector, stringifyIntVector, { required: true }),\n id: attrString,\n } as const\n\n const eventType: XmlRules<EventType> = {\n duration: attrInt,\n id: attrInt,\n messageData: attrString,\n presentationTime: attrInt({ default: 0 }),\n } as const\n\n const eventStreamType: XmlRules<EventStreamType> = {\n Event: elements(eventType),\n actuate: attrActuateType,\n href: attrString,\n messageData: attrString,\n schemeIdUri: attrString({ required: true }),\n timescale: attrInt,\n value: attrString,\n } as const\n\n const switchingType: XmlRules<SwitchingType> = {\n interval: attrInt({ required: true }),\n type: attr(parseSwitchingTypeType, stringify),\n } as const\n\n const representationBaseType: XmlRules<RepresentationBaseType> = {\n FramePacking: elements(descriptorType),\n AudioChannelConfiguration: elements(descriptorType),\n ContentProtection: elements(descriptorType),\n EssentialProperty: elements(descriptorType),\n SupplementalProperty: elements(descriptorType),\n InbandEventStream: elements(eventStreamType),\n Switching: elements(switchingType),\n audioSamplingRate: attr(parseIntVector, stringifyIntVector),\n codecs: attrString,\n codingDependency: attrBoolean,\n frameRate: attr(parseFrameRate, stringifyFrameRate),\n height: attrInt,\n maximumSAPPeriod: attrInt,\n maxPlayoutRate: attrInt,\n mimeType: attrString,\n profiles: attr(parseProfiles, stringifyProfiles),\n sar: attr(parseRatio, stringifyRatio),\n scanType: attr(parseVideoScan, stringify),\n segmentProfiles: attrString,\n startWithSAP: attr(parseSap, stringify),\n width: attrInt,\n } as const\n\n const subRepresentationType: XmlRules<SubRepresentationType> = {\n ...representationBaseType,\n bandwidth: attrInt,\n contentComponent: attr(parseStringVector, stringifyStringVector),\n dependencyLevel: attr(parseIntVector, stringifyIntVector),\n level: attrInt,\n } as const\n\n const representationType: XmlRules<RepresentationType> = {\n ...representationBaseType,\n bandwidth: attrInt({ required: true }),\n bitrate: attrInt,\n dependencyId: attr(parseStringVector, stringifyStringVector),\n id: attrString({ required: true }),\n mediaStreamStructureId: attr(parseStringVector, stringifyStringVector),\n qualityRanking: attrInt,\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n SubRepresentation: elements(subRepresentationType),\n } as const\n\n const adaptationSetType: XmlRules<AdaptationSetType> = {\n ...representationBaseType,\n Accessibility: elements(descriptorType),\n Role: elements(descriptorType),\n Rating: elements(descriptorType),\n Viewpoint: elements(descriptorType),\n ContentComponent: elements(contentComponentType),\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n Representation: elements(representationType),\n actuate: attrActuateType,\n bitstreamSwitching: attrBoolean,\n contentType: attrString,\n group: attrInt,\n href: attrString,\n id: attrInt,\n lang: attrString,\n maxBandwidth: attrInt,\n maxFrameRate: attr(parseFrameRate, stringifyFrameRate),\n maxHeight: attrInt,\n maxWidth: attrInt,\n minBandwidth: attrInt,\n minFrameRate: attr(parseFrameRate, stringifyFrameRate),\n minHeight: attrInt,\n minWidth: attrInt,\n par: attr(parseRatio, stringifyRatio),\n segmentAlignment: attr(parseConditionalUint, stringify, {\n default: false,\n }),\n selectionPriority: attrInt({\n default: 1,\n }),\n subsegmentAlignment: attr(parseConditionalUint, stringify, {\n default: false,\n }),\n subsegmentStartsWithSAP: attr(parseSap, stringify, { default: 0 }),\n } as const\n\n const rangeType: XmlRules<RangeType> = {\n duration: attr(parseDuration, stringifyDuration),\n starttime: attr(parseDuration, stringifyDuration),\n } as const\n\n const metricsType: XmlRules<MetricsType> = {\n metrics: attrString({ required: true }),\n Range: elements(rangeType),\n Reporting: elements(descriptorType, { minOccurs: 1 }),\n } as const\n\n const periodType: XmlRules<PeriodType> = {\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n AssetIdentifier: element(descriptorType),\n EventStream: elements(eventStreamType),\n AdaptationSet: elements(adaptationSetType),\n Subset: elements(subsetType),\n SupplementalProperty: elements(descriptorType),\n actuate: attrActuateType,\n bitstreamSwitching: attrBoolean({ default: false }),\n duration: attr(parseDuration, stringifyDuration),\n href: attrString,\n id: attrString,\n start: attr(parseDuration, stringifyDuration),\n } as const\n\n const programInformationType: XmlRules<ProgramInformationType> = {\n lang: attrString,\n moreInformationURL: attrString,\n Copyright: attrString,\n Source: attrString,\n Title: attrString,\n } as const\n\n const mpdType: XmlRules<MPDtype> = {\n ProgramInformation: elements(programInformationType),\n BaseURL: elements(baseURLType),\n Location: elements(uriType),\n Period: elements(periodType, { minOccurs: 1 }),\n Metrics: elements(metricsType),\n EssentialProperty: elements(descriptorType),\n SupplementalProperty: elements(descriptorType),\n UTCTiming: elements(descriptorType),\n availabilityEndTime: attrDateTime,\n availabilityStartTime: attrDateTime,\n id: attrString,\n maxSegmentDuration: attr(parseDuration, stringifyDuration),\n maxSubsegmentDuration: attr(parseDuration, stringifyDuration),\n mediaPresentationDuration: attr(parseDuration, stringifyDuration),\n minBufferTime: attr(parseDuration, stringifyDuration, {\n required: true,\n }),\n minimumUpdatePeriod: attr(parseDuration, stringifyDuration),\n profiles: attr(parseProfiles, stringifyProfiles, { required: true }),\n publishTime: attrDateTime,\n suggestedPresentationDelay: attr(parseDuration, stringifyDuration),\n timeShiftBufferDepth: attr(parseDuration, stringifyDuration),\n type: attr(parsePresentationTypeType, stringify, {\n default: 'static',\n } as const),\n } as const\n\n return {\n MPD: element(mpdType, {\n required: true,\n namespaceUri: dashNamespaceUri,\n }),\n } as const\n}\n\n/**\n * Parses a comma delimited list of profiles.\n * Profile values are not whitespace trimmed.\n *\n * @param str\n */\nexport function parseProfiles(str: string): readonly string[] {\n return str.split(',')\n}\n\n/**\n * Returns the string representation of a {@link FrameRate} value.\n *\n * @param value\n */\nexport function stringifyProfiles(value: readonly string[]): string {\n return value.join(',')\n}\n\nconst videoScanTypeValidator: Validator<VideoScanType> = isOneOf(\n 'progressive',\n 'interlaced',\n 'unknown'\n)\n\n/**\n * @private\n */\nexport function parseVideoScan(str: string): VideoScanType {\n videoScanTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\nconst switchingTypeTypeValidator: Validator<SwitchingTypeType> = isOneOf(\n 'media',\n 'bitstream'\n)\n\n/**\n * @private\n */\nexport function parseSwitchingTypeType(str: string): SwitchingTypeType {\n switchingTypeTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\nconst validateSap: Validator<number> = number().within(0, 6)\n\n/**\n * @private\n */\nexport function parseSap(str: string): number {\n const number = parseInt(str)\n validateSap.assert(number, ErrorOrigin.PARSING)\n return number\n}\n\n/**\n * Splits a string by whitespace.\n *\n * @private\n */\nexport function parseStringVector(str: string): readonly string[] {\n return str.split(/\\s+/)\n}\n\n/**\n * Returns the string representation of a string vector value.\n *\n * @param value\n */\nexport function stringifyStringVector(value: readonly string[]): string {\n return value.join(' ')\n}\n\n/**\n * Splits a string by whitespace and parses as int.\n *\n * @private\n */\nexport function parseIntVector(str: string): readonly number[] {\n return str.split(/\\s+/).map((subStr) => parseInt(subStr))\n}\n\n/**\n * Returns the string representation of an int vector value.\n *\n * @param value\n */\nexport function stringifyIntVector(value: readonly number[]): string {\n return value.join(' ')\n}\n\nconst presentationTypeValidator: Validator<PresentationType> = isOneOf(\n 'static',\n 'dynamic'\n)\n\n/**\n * Asserts that the given string is one of the {@link PresentationType} enumerated values.\n * @param str\n */\nexport function parsePresentationTypeType(str: string): PresentationType {\n presentationTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\n/**\n * Parses a string into true, false, or a number.\n *\n * @private\n */\nexport function parseConditionalUint(str: string): ConditionalUintType {\n const lower = str.toLowerCase()\n switch (lower) {\n case 'true':\n return true\n case 'false':\n return false\n default:\n return parseInt(str)\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 { Base64BinaryType } from '@amazon/vinyl-xml'\n\n/**\n * Cenc content protection xml types.\n *\n * @see https://github.com/sannies/rtp2dash/blob/master/src/main/resources/auxxsd/cenc.xsd\n * @module\n */\n\nexport const CENC_NAMESPACE_URI = 'urn:mpeg:cenc:2013'\n\n/**\n * A 128-bit integer written in canonical UUID notation.\n * Must be in the form:\n * `[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}`\n */\nexport type KeyIdType = string\n\nexport interface CencContentProtection {\n readonly default_KID?: readonly KeyIdType[]\n readonly pssh?: Base64BinaryType\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n parseStringVector,\n stringifyStringVector,\n} from '../../dashManifestXmlRules'\nimport type { XmlRules } from '@amazon/vinyl-xml'\nimport { attr, charactersString, element } from '@amazon/vinyl-xml'\nimport type { CencContentProtection } from '../../../xmlns/mpeg/cenc/2013'\nimport { CENC_NAMESPACE_URI } from '../../../xmlns/mpeg/cenc/2013'\n\n/**\n * A parser for ContentProtection elements using the cenc namespace.\n * @see https://github.com/sannies/rtp2dash/blob/master/src/main/resources/auxxsd/cenc.xsd\n */\nexport const cencXmlRules: XmlRules<CencContentProtection> = {\n default_KID: attr(parseStringVector, stringifyStringVector, {\n namespaceUri: CENC_NAMESPACE_URI,\n }),\n pssh: element(\n {\n _content: charactersString,\n },\n {\n namespaceUri: CENC_NAMESPACE_URI,\n }\n ),\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { element, elements, type XmlRules } from '@amazon/vinyl-xml'\nimport { dashNamespaceUri } from '../../dashManifestXmlRules'\n\n/**\n * ContentProtection extension point for Dash manifests.\n *\n * @module\n */\n\nexport interface WithProtections<T> {\n readonly ContentProtection?: readonly T[]\n}\n\nexport interface RepresentationTypeProtections<T> extends WithProtections<T> {\n readonly SubRepresentation?: readonly WithProtections<T>[]\n}\n\nexport interface AdaptationSetProtections<T> extends WithProtections<T> {\n readonly Representation?: readonly RepresentationTypeProtections<T>[]\n}\n\nexport interface PeriodProtections<T> {\n readonly AdaptationSet?: readonly AdaptationSetProtections<T>[]\n}\n\nexport interface MPDProtections<T> {\n readonly Period: readonly PeriodProtections<T>[]\n}\n\nexport interface DashProtections<T> {\n readonly MPD: MPDProtections<T>\n}\n\n/**\n * Creates a dash extension for content protection parsing rules.\n *\n * @param contentProtectionRules Rules to be used when processing `ContentProtection` elements.\n * @return Returns a rules map that should be merged with the dash manifest rules.\n */\nexport function createDashProtectionXmlRules<T extends object>(\n contentProtectionRules: XmlRules<T>\n): XmlRules<DashProtections<T>> {\n const withProtections: XmlRules<WithProtections<T>> = {\n ContentProtection: elements(contentProtectionRules),\n } as const\n\n return {\n MPD: element<MPDProtections<T>>(\n {\n Period: elements<PeriodProtections<T>>(\n {\n AdaptationSet: elements<AdaptationSetProtections<T>>({\n ...withProtections,\n Representation: elements<\n RepresentationTypeProtections<T>\n >({\n ...withProtections,\n SubRepresentation:\n elements<WithProtections<T>>(\n withProtections\n ),\n }),\n }),\n },\n {\n minOccurs: 1,\n }\n ),\n },\n { required: true, namespaceUri: dashNamespaceUri } as const\n ),\n } as const\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Base64BinaryType } from '@amazon/vinyl-xml'\n\n/**\n * Cenc content protection playready.\n *\n * @see https://learn.microsoft.com/en-us/playready/specifications/mpeg-dash-playready#21-dash-contentprotection-descriptor-elements\n * @module\n */\n\nexport const PLAY_READY_NAMESPACE_URI = 'urn:microsoft:playready'\n\nexport interface PlayreadyContentProtection {\n readonly pro?: Base64BinaryType\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { charactersString, element, type XmlRules } from '@amazon/vinyl-xml'\nimport type { PlayreadyContentProtection } from '../../../xmlns/microsoft/playready'\nimport { PLAY_READY_NAMESPACE_URI } from '../../../xmlns/microsoft/playready'\n\nexport const playreadyXmlRules: XmlRules<PlayreadyContentProtection> = {\n pro: element(\n {\n _content: charactersString,\n },\n {\n namespaceUri: PLAY_READY_NAMESPACE_URI,\n }\n ),\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ReservedXmlRuleKeys } from '@amazon/vinyl-xml'\nimport {\n mapXmlRules,\n type Merged,\n mergeXmlRules,\n parseXml,\n ParseXmlHandlerImpl,\n stringifyXml,\n} from '@amazon/vinyl-xml'\nimport type { PlayreadyContentProtection } from '../xmlns/microsoft/playready'\nimport type { CencContentProtection } from '../xmlns/mpeg/cenc/2013'\nimport type {\n DashManifest,\n DescriptorType,\n} from '../xmlns/mpeg/dash/schema/mpd/2011'\nimport { dashManifestXmlRules } from './dashManifestXmlRules'\nimport { cencXmlRules } from './ext/drm/cencXmlRules'\nimport type { DashProtections } from './ext/drm/contentProtection'\nimport { createDashProtectionXmlRules } from './ext/drm/contentProtection'\nimport { playreadyXmlRules } from './ext/drm/playreadyXmlRules'\nimport type { OptionalDeep } from '@amazon/vinyl-util'\n\n/**\n * Creates a Dash Manifest parser with supported extensions.\n *\n * @module\n */\n\nexport type DashDrmManifest = Merged<\n DashManifest & DashProtections<ContentProtection>\n>\n\nexport interface ContentProtection\n extends DescriptorType, CencContentProtection, PlayreadyContentProtection {}\n\nconst dashDrmRules = mergeXmlRules(\n dashManifestXmlRules(),\n createDashProtectionXmlRules(cencXmlRules),\n createDashProtectionXmlRules(playreadyXmlRules)\n)\n\nconst dashDrmRulesMapped = mapXmlRules(dashDrmRules)\n\n/**\n * A Content handler for a dash manifest.\n */\nfunction dashManifestHandler() {\n return new ParseXmlHandlerImpl(dashDrmRulesMapped)\n}\n\n/**\n * Parses a Dash Manifest, according to the mpd:2011 schema.\n * @see https://raw.githubusercontent.com/Dash-Industry-Forum/MPEG-Conformance-and-reference-source/master/conformance/MPDValidator/schemas/DASH-MPD.xsd\n * @param manifest\n */\nexport function parseDashManifest(manifest: string): DashDrmManifest {\n return parseXml(manifest, dashManifestHandler())\n}\n\nexport function stringifyDashManifest(\n manifest: OptionalDeep<DashDrmManifest, ReservedXmlRuleKeys>\n): string {\n return stringifyXml(manifest, dashDrmRulesMapped)\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An Amazon flac/opus catalog track example.\n * A SegmentList with SegmentURL elements using media ranges.\n *\n * (Mothership connection, parliament)\n */\n// language=XML\nexport const dash_segmentListMediaRange = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<MPD minBufferTime=\"PT2S\" type=\"static\" mediaPresentationDuration=\"PT400.0133056640625S\" profiles=\"urn:mpeg:dash:profile:isoff-on-demand:2011\" xmlns=\"urn:mpeg:dash:schema:mpd:2011\" xmlns:amz-music=\"urn:amazon:music:drm:2019\" xmlns:cenc=\"urn:mpeg:cenc:2013\" xmlns:mspr=\"urn:microsoft:playready\">\n <Period id=\"0\">\n <AdaptationSet id=\"1\" contentType=\"audio\" selectionPriority=\"2000\">\n <ContentProtection schemeIdUri=\"urn:mpeg:dash:mp4protection:2011\" cenc:default_KID=\"53443d2c-a548-037d-dfca-b6873a3b16a7\" value=\"cenc\"/>\n <ContentProtection schemeIdUri=\"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed\">\n <cenc:pssh>AAAAXXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAD0SEFNEPSylSAN938q2hzo7FqcaC0FtYXpvbk11c2ljIhxjaWQ6VTBROUxLVklBMzNmeXJhSE9qc1dwdz09</cenc:pssh>\n </ContentProtection>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:mpegB:cicp:ProgramLoudness\" value=\"-13.5 LUFS\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:trackType\" value=\"HD\"/>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:dash:adaptation-set-switching:2016\" value=\"2\"/>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:mpegB:cicp:AnchorLoudness\" value=\"-11.7 LUFS\"/>\n <Representation id=\"1\" qualityRanking=\"4\" codecs=\"flac\" audioSamplingRate=\"44100\" bandwidth=\"1021104\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:bitDepth\" value=\"16\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/a3ce7553-e9a3-3ca6-8fda-8f354b8cee0f.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=HD_44&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"44100\" duration=\"441000\">\n <Initialization range=\"0-1067\"/>\n <SegmentURL mediaRange=\"1580-1124387\"/>\n <SegmentURL mediaRange=\"1124388-2301681\"/>\n <SegmentURL mediaRange=\"2301682-3413884\"/>\n <SegmentURL mediaRange=\"3413885-4563668\"/>\n <SegmentURL mediaRange=\"4563669-5789595\"/>\n <SegmentURL mediaRange=\"5789596-7027203\"/>\n <SegmentURL mediaRange=\"7027204-8258589\"/>\n <SegmentURL mediaRange=\"8258590-9476689\"/>\n <SegmentURL mediaRange=\"9476690-10663879\"/>\n <SegmentURL mediaRange=\"10663880-11801656\"/>\n <SegmentURL mediaRange=\"11801657-13028295\"/>\n <SegmentURL mediaRange=\"13028296-14259035\"/>\n <SegmentURL mediaRange=\"14259036-15501034\"/>\n <SegmentURL mediaRange=\"15501035-16715074\"/>\n <SegmentURL mediaRange=\"16715075-17945696\"/>\n <SegmentURL mediaRange=\"17945697-19181760\"/>\n <SegmentURL mediaRange=\"19181761-20430664\"/>\n <SegmentURL mediaRange=\"20430665-21668186\"/>\n <SegmentURL mediaRange=\"21668187-22889588\"/>\n <SegmentURL mediaRange=\"22889589-24105876\"/>\n <SegmentURL mediaRange=\"24105877-25286931\"/>\n <SegmentURL mediaRange=\"25286932-26474293\"/>\n <SegmentURL mediaRange=\"26474294-27717336\"/>\n <SegmentURL mediaRange=\"27717337-28944000\"/>\n <SegmentURL mediaRange=\"28944001-30217943\"/>\n <SegmentURL mediaRange=\"30217944-31494322\"/>\n <SegmentURL mediaRange=\"31494323-32753722\"/>\n <SegmentURL mediaRange=\"32753723-33819438\"/>\n <SegmentURL mediaRange=\"33819439-34871800\"/>\n <SegmentURL mediaRange=\"34871801-35987451\"/>\n <SegmentURL mediaRange=\"35987452-37198633\"/>\n <SegmentURL mediaRange=\"37198634-38400513\"/>\n <SegmentURL mediaRange=\"38400514-39590378\"/>\n <SegmentURL mediaRange=\"39590379-40775418\"/>\n <SegmentURL mediaRange=\"40775419-42023162\"/>\n <SegmentURL mediaRange=\"42023163-43262782\"/>\n <SegmentURL mediaRange=\"43262783-44466388\"/>\n <SegmentURL mediaRange=\"44466389-45664349\"/>\n <SegmentURL mediaRange=\"45664350-46838625\"/>\n <SegmentURL mediaRange=\"46838626-47421889\"/>\n </SegmentList>\n </Representation>\n <Representation id=\"2\" qualityRanking=\"3\" codecs=\"flac\" audioSamplingRate=\"48000\" bandwidth=\"1855801\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:bitDepth\" value=\"24\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/f5b706c9-5892-3a17-9d01-4da362cfad35.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=UHD_48&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"48000\" duration=\"480000\">\n <Initialization range=\"0-1067\"/>\n <SegmentURL mediaRange=\"1580-2140301\"/>\n <SegmentURL mediaRange=\"2140302-4352961\"/>\n <SegmentURL mediaRange=\"4352962-6499834\"/>\n <SegmentURL mediaRange=\"6499835-8687556\"/>\n <SegmentURL mediaRange=\"8687557-10955471\"/>\n <SegmentURL mediaRange=\"10955472-13235819\"/>\n <SegmentURL mediaRange=\"13235820-15509496\"/>\n <SegmentURL mediaRange=\"15509497-17768731\"/>\n <SegmentURL mediaRange=\"17768732-19993372\"/>\n <SegmentURL mediaRange=\"19993373-22167125\"/>\n <SegmentURL mediaRange=\"22167126-24434254\"/>\n <SegmentURL mediaRange=\"24434255-26706557\"/>\n <SegmentURL mediaRange=\"26706558-28990196\"/>\n <SegmentURL mediaRange=\"28990197-31245239\"/>\n <SegmentURL mediaRange=\"31245240-33516976\"/>\n <SegmentURL mediaRange=\"33516977-35793411\"/>\n <SegmentURL mediaRange=\"35793412-38083225\"/>\n <SegmentURL mediaRange=\"38083226-40361780\"/>\n <SegmentURL mediaRange=\"40361781-42623154\"/>\n <SegmentURL mediaRange=\"42623155-44879987\"/>\n <SegmentURL mediaRange=\"44879988-47098315\"/>\n <SegmentURL mediaRange=\"47098316-49322904\"/>\n <SegmentURL mediaRange=\"49322905-51607367\"/>\n <SegmentURL mediaRange=\"51607368-53874862\"/>\n <SegmentURL mediaRange=\"53874863-56192866\"/>\n <SegmentURL mediaRange=\"56192867-58512617\"/>\n <SegmentURL mediaRange=\"58512618-60815181\"/>\n <SegmentURL mediaRange=\"60815182-62914181\"/>\n <SegmentURL mediaRange=\"62914182-65000611\"/>\n <SegmentURL mediaRange=\"65000612-67150839\"/>\n <SegmentURL mediaRange=\"67150840-69402495\"/>\n <SegmentURL mediaRange=\"69402496-71643660\"/>\n <SegmentURL mediaRange=\"71643661-73870974\"/>\n <SegmentURL mediaRange=\"73870975-76093618\"/>\n <SegmentURL mediaRange=\"76093619-78383457\"/>\n <SegmentURL mediaRange=\"78383458-80665083\"/>\n <SegmentURL mediaRange=\"80665084-82909593\"/>\n <SegmentURL mediaRange=\"82909594-85145972\"/>\n <SegmentURL mediaRange=\"85145973-87356513\"/>\n <SegmentURL mediaRange=\"87356514-88804457\"/>\n </SegmentList>\n </Representation>\n <Representation id=\"3\" qualityRanking=\"2\" codecs=\"flac\" audioSamplingRate=\"96000\" bandwidth=\"3278164\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:bitDepth\" value=\"24\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/02b134c4-8144-3ab1-b125-5af2d0133d5b.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=UHD_96&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"96000\" duration=\"960000\">\n <Initialization range=\"0-1067\"/>\n <SegmentURL mediaRange=\"1580-3813567\"/>\n <SegmentURL mediaRange=\"3813568-7746339\"/>\n <SegmentURL mediaRange=\"7746340-11599579\"/>\n <SegmentURL mediaRange=\"11599580-15505023\"/>\n <SegmentURL mediaRange=\"15505024-19519493\"/>\n <SegmentURL mediaRange=\"19519494-23556777\"/>\n <SegmentURL mediaRange=\"23556778-27581158\"/>\n <SegmentURL mediaRange=\"27581159-31586807\"/>\n <SegmentURL mediaRange=\"31586808-35549718\"/>\n <SegmentURL mediaRange=\"35549719-39435585\"/>\n <SegmentURL mediaRange=\"39435586-43443650\"/>\n <SegmentURL mediaRange=\"43443651-47467685\"/>\n <SegmentURL mediaRange=\"47467686-51498910\"/>\n <SegmentURL mediaRange=\"51498911-55496614\"/>\n <SegmentURL mediaRange=\"55496615-59513566\"/>\n <SegmentURL mediaRange=\"59513567-63538385\"/>\n <SegmentURL mediaRange=\"63538386-67582593\"/>\n <SegmentURL mediaRange=\"67582594-71608871\"/>\n <SegmentURL mediaRange=\"71608872-75612860\"/>\n <SegmentURL mediaRange=\"75612861-79601033\"/>\n <SegmentURL mediaRange=\"79601034-83549776\"/>\n <SegmentURL mediaRange=\"83549777-87488907\"/>\n <SegmentURL mediaRange=\"87488908-91534801\"/>\n <SegmentURL mediaRange=\"91534802-95552040\"/>\n <SegmentURL mediaRange=\"95552041-99649744\"/>\n <SegmentURL mediaRange=\"99649745-103743373\"/>\n <SegmentURL mediaRange=\"103743374-107815594\"/>\n <SegmentURL mediaRange=\"107815595-111613915\"/>\n <SegmentURL mediaRange=\"111613916-115390443\"/>\n <SegmentURL mediaRange=\"115390444-119249732\"/>\n <SegmentURL mediaRange=\"119249733-123233807\"/>\n <SegmentURL mediaRange=\"123233808-127209398\"/>\n <SegmentURL mediaRange=\"127209399-131167116\"/>\n <SegmentURL mediaRange=\"131167117-135119879\"/>\n <SegmentURL mediaRange=\"135119880-139163685\"/>\n <SegmentURL mediaRange=\"139163686-143201079\"/>\n <SegmentURL mediaRange=\"143201080-147195194\"/>\n <SegmentURL mediaRange=\"147195195-151164220\"/>\n <SegmentURL mediaRange=\"151164221-155096800\"/>\n <SegmentURL mediaRange=\"155096801-157757393\"/>\n </SegmentList>\n </Representation>\n <Representation id=\"4\" qualityRanking=\"1\" codecs=\"flac\" audioSamplingRate=\"192000\" bandwidth=\"5666448\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:bitDepth\" value=\"24\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/edf9f9cb-46ce-33bd-96e1-8456547fbef4.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=UHD_192&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"192000\" duration=\"1920000\">\n <Initialization range=\"0-1067\"/>\n <SegmentURL mediaRange=\"1580-6720450\"/>\n <SegmentURL mediaRange=\"6720451-13610816\"/>\n <SegmentURL mediaRange=\"13610817-20415282\"/>\n <SegmentURL mediaRange=\"20415283-27272412\"/>\n <SegmentURL mediaRange=\"27272413-34250251\"/>\n <SegmentURL mediaRange=\"34250252-41260291\"/>\n <SegmentURL mediaRange=\"41260292-48255248\"/>\n <SegmentURL mediaRange=\"48255249-55224355\"/>\n <SegmentURL mediaRange=\"55224356-62157463\"/>\n <SegmentURL mediaRange=\"62157464-68996670\"/>\n <SegmentURL mediaRange=\"68996671-75970335\"/>\n <SegmentURL mediaRange=\"75970336-82964531\"/>\n <SegmentURL mediaRange=\"82964532-89965755\"/>\n <SegmentURL mediaRange=\"89965756-96928368\"/>\n <SegmentURL mediaRange=\"96928369-103911265\"/>\n <SegmentURL mediaRange=\"103911266-110903999\"/>\n <SegmentURL mediaRange=\"110904000-117921608\"/>\n <SegmentURL mediaRange=\"117921609-124920837\"/>\n <SegmentURL mediaRange=\"124920838-131897214\"/>\n <SegmentURL mediaRange=\"131897215-138848614\"/>\n <SegmentURL mediaRange=\"138848615-145764349\"/>\n <SegmentURL mediaRange=\"145764350-152655256\"/>\n <SegmentURL mediaRange=\"152655257-159680382\"/>\n <SegmentURL mediaRange=\"159680383-166667521\"/>\n <SegmentURL mediaRange=\"166667522-173750581\"/>\n <SegmentURL mediaRange=\"173750582-180827932\"/>\n <SegmentURL mediaRange=\"180827933-187877145\"/>\n <SegmentURL mediaRange=\"187877146-194626820\"/>\n <SegmentURL mediaRange=\"194626821-201345524\"/>\n <SegmentURL mediaRange=\"201345525-208145573\"/>\n <SegmentURL mediaRange=\"208145574-215088653\"/>\n <SegmentURL mediaRange=\"215088654-222022478\"/>\n <SegmentURL mediaRange=\"222022479-228934595\"/>\n <SegmentURL mediaRange=\"228934596-235844464\"/>\n <SegmentURL mediaRange=\"235844465-242852767\"/>\n <SegmentURL mediaRange=\"242852768-249863893\"/>\n <SegmentURL mediaRange=\"249863894-256824103\"/>\n <SegmentURL mediaRange=\"256824104-263749124\"/>\n <SegmentURL mediaRange=\"263749125-270634182\"/>\n <SegmentURL mediaRange=\"270634183-275673081\"/>\n </SegmentList>\n </Representation>\n </AdaptationSet>\n <AdaptationSet id=\"2\" contentType=\"audio\" selectionPriority=\"1000\">\n <ContentProtection schemeIdUri=\"urn:mpeg:dash:mp4protection:2011\" cenc:default_KID=\"f65d52c1-4de5-e5b6-7296-2f48eddf7378\" value=\"cenc\"/>\n <ContentProtection schemeIdUri=\"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed\">\n <cenc:pssh>AAAAXXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAD0SEPZdUsFN5eW2cpYvSO3fc3gaC0FtYXpvbk11c2ljIhxjaWQ6OWwxU3dVM2w1Ylp5bGk5STdkOXplQT09</cenc:pssh>\n </ContentProtection>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:mpegB:cicp:ProgramLoudness\" value=\"-13.5 LUFS\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:trackType\" value=\"SD\"/>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:dash:adaptation-set-switching:2016\" value=\"1\"/>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:mpegB:cicp:AnchorLoudness\" value=\"-11.7 LUFS\"/>\n <Representation id=\"5\" qualityRanking=\"3\" codecs=\"opus\" audioSamplingRate=\"48000\" bandwidth=\"52950\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/7e2d628d-7666-3ad5-a9df-8ba4e1c6391c.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=SD_LOW&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"48000\" duration=\"480000\">\n <Initialization range=\"0-1031\"/>\n <SegmentURL mediaRange=\"1544-61799\"/>\n <SegmentURL mediaRange=\"61800-121935\"/>\n <SegmentURL mediaRange=\"121936-182071\"/>\n <SegmentURL mediaRange=\"182072-246260\"/>\n <SegmentURL mediaRange=\"246261-310449\"/>\n <SegmentURL mediaRange=\"310450-374638\"/>\n <SegmentURL mediaRange=\"374639-438827\"/>\n <SegmentURL mediaRange=\"438828-503016\"/>\n <SegmentURL mediaRange=\"503017-567205\"/>\n <SegmentURL mediaRange=\"567206-631394\"/>\n <SegmentURL mediaRange=\"631395-695583\"/>\n <SegmentURL mediaRange=\"695584-759772\"/>\n <SegmentURL mediaRange=\"759773-823961\"/>\n <SegmentURL mediaRange=\"823962-888150\"/>\n <SegmentURL mediaRange=\"888151-952339\"/>\n <SegmentURL mediaRange=\"952340-1016528\"/>\n <SegmentURL mediaRange=\"1016529-1080717\"/>\n <SegmentURL mediaRange=\"1080718-1144906\"/>\n <SegmentURL mediaRange=\"1144907-1209095\"/>\n <SegmentURL mediaRange=\"1209096-1273284\"/>\n <SegmentURL mediaRange=\"1273285-1337473\"/>\n <SegmentURL mediaRange=\"1337474-1401662\"/>\n <SegmentURL mediaRange=\"1401663-1465851\"/>\n <SegmentURL mediaRange=\"1465852-1530040\"/>\n <SegmentURL mediaRange=\"1530041-1594229\"/>\n <SegmentURL mediaRange=\"1594230-1658418\"/>\n <SegmentURL mediaRange=\"1658419-1722607\"/>\n <SegmentURL mediaRange=\"1722608-1786796\"/>\n <SegmentURL mediaRange=\"1786797-1850985\"/>\n <SegmentURL mediaRange=\"1850986-1915174\"/>\n <SegmentURL mediaRange=\"1915175-1979363\"/>\n <SegmentURL mediaRange=\"1979364-2043552\"/>\n <SegmentURL mediaRange=\"2043553-2107741\"/>\n <SegmentURL mediaRange=\"2107742-2171930\"/>\n <SegmentURL mediaRange=\"2171931-2236119\"/>\n <SegmentURL mediaRange=\"2236120-2300308\"/>\n <SegmentURL mediaRange=\"2300309-2364497\"/>\n <SegmentURL mediaRange=\"2364498-2428686\"/>\n <SegmentURL mediaRange=\"2428687-2492875\"/>\n <SegmentURL mediaRange=\"2492876-2559060\"/>\n </SegmentList>\n </Representation>\n <Representation id=\"6\" qualityRanking=\"2\" codecs=\"opus\" audioSamplingRate=\"48000\" bandwidth=\"196953\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/8e453bd1-9428-30fa-940f-fa85911368c2.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=SD_MEDIUM&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"48000\" duration=\"480000\">\n <Initialization range=\"0-1031\"/>\n <SegmentURL mediaRange=\"1544-242159\"/>\n <SegmentURL mediaRange=\"242160-482295\"/>\n <SegmentURL mediaRange=\"482296-722431\"/>\n <SegmentURL mediaRange=\"722432-966620\"/>\n <SegmentURL mediaRange=\"966621-1210809\"/>\n <SegmentURL mediaRange=\"1210810-1454998\"/>\n <SegmentURL mediaRange=\"1454999-1699187\"/>\n <SegmentURL mediaRange=\"1699188-1943376\"/>\n <SegmentURL mediaRange=\"1943377-2187565\"/>\n <SegmentURL mediaRange=\"2187566-2431754\"/>\n <SegmentURL mediaRange=\"2431755-2675943\"/>\n <SegmentURL mediaRange=\"2675944-2920132\"/>\n <SegmentURL mediaRange=\"2920133-3164321\"/>\n <SegmentURL mediaRange=\"3164322-3408510\"/>\n <SegmentURL mediaRange=\"3408511-3652699\"/>\n <SegmentURL mediaRange=\"3652700-3896888\"/>\n <SegmentURL mediaRange=\"3896889-4141077\"/>\n <SegmentURL mediaRange=\"4141078-4385266\"/>\n <SegmentURL mediaRange=\"4385267-4629455\"/>\n <SegmentURL mediaRange=\"4629456-4873644\"/>\n <SegmentURL mediaRange=\"4873645-5117833\"/>\n <SegmentURL mediaRange=\"5117834-5362022\"/>\n <SegmentURL mediaRange=\"5362023-5606211\"/>\n <SegmentURL mediaRange=\"5606212-5850400\"/>\n <SegmentURL mediaRange=\"5850401-6094589\"/>\n <SegmentURL mediaRange=\"6094590-6338778\"/>\n <SegmentURL mediaRange=\"6338779-6582967\"/>\n <SegmentURL mediaRange=\"6582968-6827156\"/>\n <SegmentURL mediaRange=\"6827157-7071345\"/>\n <SegmentURL mediaRange=\"7071346-7315534\"/>\n <SegmentURL mediaRange=\"7315535-7559723\"/>\n <SegmentURL mediaRange=\"7559724-7803912\"/>\n <SegmentURL mediaRange=\"7803913-8048101\"/>\n <SegmentURL mediaRange=\"8048102-8292290\"/>\n <SegmentURL mediaRange=\"8292291-8536479\"/>\n <SegmentURL mediaRange=\"8536480-8780668\"/>\n <SegmentURL mediaRange=\"8780669-9024857\"/>\n <SegmentURL mediaRange=\"9024858-9269046\"/>\n <SegmentURL mediaRange=\"9269047-9513235\"/>\n <SegmentURL mediaRange=\"9513236-9759420\"/>\n </SegmentList>\n </Representation>\n <Representation id=\"7\" qualityRanking=\"1\" codecs=\"opus\" audioSamplingRate=\"48000\" bandwidth=\"324955\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/40ba3a06-d285-3130-838f-0c1508c1d18b.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=SD_HIGH&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"48000\" duration=\"480000\">\n <Initialization range=\"0-1031\"/>\n <SegmentURL mediaRange=\"1544-402479\"/>\n <SegmentURL mediaRange=\"402480-802615\"/>\n <SegmentURL mediaRange=\"802616-1202751\"/>\n <SegmentURL mediaRange=\"1202752-1606940\"/>\n <SegmentURL mediaRange=\"1606941-2011129\"/>\n <SegmentURL mediaRange=\"2011130-2415318\"/>\n <SegmentURL mediaRange=\"2415319-2819507\"/>\n <SegmentURL mediaRange=\"2819508-3223696\"/>\n <SegmentURL mediaRange=\"3223697-3627885\"/>\n <SegmentURL mediaRange=\"3627886-4032074\"/>\n <SegmentURL mediaRange=\"4032075-4436263\"/>\n <SegmentURL mediaRange=\"4436264-4840452\"/>\n <SegmentURL mediaRange=\"4840453-5244641\"/>\n <SegmentURL mediaRange=\"5244642-5648830\"/>\n <SegmentURL mediaRange=\"5648831-6053019\"/>\n <SegmentURL mediaRange=\"6053020-6457208\"/>\n <SegmentURL mediaRange=\"6457209-6861397\"/>\n <SegmentURL mediaRange=\"6861398-7265586\"/>\n <SegmentURL mediaRange=\"7265587-7669775\"/>\n <SegmentURL mediaRange=\"7669776-8073964\"/>\n <SegmentURL mediaRange=\"8073965-8478153\"/>\n <SegmentURL mediaRange=\"8478154-8882342\"/>\n <SegmentURL mediaRange=\"8882343-9286531\"/>\n <SegmentURL mediaRange=\"9286532-9690720\"/>\n <SegmentURL mediaRange=\"9690721-10094909\"/>\n <SegmentURL mediaRange=\"10094910-10499098\"/>\n <SegmentURL mediaRange=\"10499099-10903287\"/>\n <SegmentURL mediaRange=\"10903288-11307476\"/>\n <SegmentURL mediaRange=\"11307477-11711665\"/>\n <SegmentURL mediaRange=\"11711666-12115854\"/>\n <SegmentURL mediaRange=\"12115855-12520043\"/>\n <SegmentURL mediaRange=\"12520044-12924232\"/>\n <SegmentURL mediaRange=\"12924233-13328421\"/>\n <SegmentURL mediaRange=\"13328422-13732610\"/>\n <SegmentURL mediaRange=\"13732611-14136799\"/>\n <SegmentURL mediaRange=\"14136800-14540988\"/>\n <SegmentURL mediaRange=\"14540989-14945177\"/>\n <SegmentURL mediaRange=\"14945178-15349366\"/>\n <SegmentURL mediaRange=\"15349367-15753555\"/>\n <SegmentURL mediaRange=\"15753556-16159740\"/>\n </SegmentList>\n </Representation>\n </AdaptationSet>\n <AdaptationSet id=\"3\" contentType=\"audio\" selectionPriority=\"500\">\n <ContentProtection schemeIdUri=\"urn:mpeg:dash:mp4protection:2011\" cenc:default_KID=\"4e4c6e3a-d760-ffd5-78b0-3824890da09d\" value=\"cenc\"/>\n <ContentProtection schemeIdUri=\"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed\">\n <cenc:pssh>AAAAXXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAD0SEE5MbjrXYP/VeLA4JIkNoJ0aC0FtYXpvbk11c2ljIhxjaWQ6VGt4dU90ZGcvOVY0c0Rna2lRMmduUT09</cenc:pssh>\n </ContentProtection>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:mpegB:cicp:ProgramLoudness\" value=\"-13.5 LUFS\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:trackType\" value=\"LD\"/>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:mpegB:cicp:AnchorLoudness\" value=\"-11.7 LUFS\"/>\n <Representation id=\"8\" qualityRanking=\"2000\" codecs=\"opus\" audioSamplingRate=\"48000\" bandwidth=\"52950\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/748096ab-6991-368b-b9ca-5477bf90ba5a.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=LD_LOW&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"48000\" duration=\"480000\">\n <Initialization range=\"0-1031\"/>\n <SegmentURL mediaRange=\"1544-61799\"/>\n <SegmentURL mediaRange=\"61800-121935\"/>\n <SegmentURL mediaRange=\"121936-182071\"/>\n <SegmentURL mediaRange=\"182072-246260\"/>\n <SegmentURL mediaRange=\"246261-310449\"/>\n <SegmentURL mediaRange=\"310450-374638\"/>\n <SegmentURL mediaRange=\"374639-438827\"/>\n <SegmentURL mediaRange=\"438828-503016\"/>\n <SegmentURL mediaRange=\"503017-567205\"/>\n <SegmentURL mediaRange=\"567206-631394\"/>\n <SegmentURL mediaRange=\"631395-695583\"/>\n <SegmentURL mediaRange=\"695584-759772\"/>\n <SegmentURL mediaRange=\"759773-823961\"/>\n <SegmentURL mediaRange=\"823962-888150\"/>\n <SegmentURL mediaRange=\"888151-952339\"/>\n <SegmentURL mediaRange=\"952340-1016528\"/>\n <SegmentURL mediaRange=\"1016529-1080717\"/>\n <SegmentURL mediaRange=\"1080718-1144906\"/>\n <SegmentURL mediaRange=\"1144907-1209095\"/>\n <SegmentURL mediaRange=\"1209096-1273284\"/>\n <SegmentURL mediaRange=\"1273285-1337473\"/>\n <SegmentURL mediaRange=\"1337474-1401662\"/>\n <SegmentURL mediaRange=\"1401663-1465851\"/>\n <SegmentURL mediaRange=\"1465852-1530040\"/>\n <SegmentURL mediaRange=\"1530041-1594229\"/>\n <SegmentURL mediaRange=\"1594230-1658418\"/>\n <SegmentURL mediaRange=\"1658419-1722607\"/>\n <SegmentURL mediaRange=\"1722608-1786796\"/>\n <SegmentURL mediaRange=\"1786797-1850985\"/>\n <SegmentURL mediaRange=\"1850986-1915174\"/>\n <SegmentURL mediaRange=\"1915175-1979363\"/>\n <SegmentURL mediaRange=\"1979364-2043552\"/>\n <SegmentURL mediaRange=\"2043553-2107741\"/>\n <SegmentURL mediaRange=\"2107742-2171930\"/>\n <SegmentURL mediaRange=\"2171931-2236119\"/>\n <SegmentURL mediaRange=\"2236120-2300308\"/>\n <SegmentURL mediaRange=\"2300309-2364497\"/>\n <SegmentURL mediaRange=\"2364498-2428686\"/>\n <SegmentURL mediaRange=\"2428687-2492875\"/>\n <SegmentURL mediaRange=\"2492876-2559060\"/>\n </SegmentList>\n </Representation>\n <Representation id=\"9\" qualityRanking=\"1000\" codecs=\"opus\" audioSamplingRate=\"48000\" bandwidth=\"164952\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/8be307d6-71ea-3111-a869-40720e08a6f9.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=LD_MEDIUM&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"48000\" duration=\"480000\">\n <Initialization range=\"0-1031\"/>\n <SegmentURL mediaRange=\"1544-202079\"/>\n <SegmentURL mediaRange=\"202080-402215\"/>\n <SegmentURL mediaRange=\"402216-602351\"/>\n <SegmentURL mediaRange=\"602352-806540\"/>\n <SegmentURL mediaRange=\"806541-1010729\"/>\n <SegmentURL mediaRange=\"1010730-1214918\"/>\n <SegmentURL mediaRange=\"1214919-1419107\"/>\n <SegmentURL mediaRange=\"1419108-1623296\"/>\n <SegmentURL mediaRange=\"1623297-1827485\"/>\n <SegmentURL mediaRange=\"1827486-2031674\"/>\n <SegmentURL mediaRange=\"2031675-2235863\"/>\n <SegmentURL mediaRange=\"2235864-2440052\"/>\n <SegmentURL mediaRange=\"2440053-2644241\"/>\n <SegmentURL mediaRange=\"2644242-2848430\"/>\n <SegmentURL mediaRange=\"2848431-3052619\"/>\n <SegmentURL mediaRange=\"3052620-3256808\"/>\n <SegmentURL mediaRange=\"3256809-3460997\"/>\n <SegmentURL mediaRange=\"3460998-3665186\"/>\n <SegmentURL mediaRange=\"3665187-3869375\"/>\n <SegmentURL mediaRange=\"3869376-4073564\"/>\n <SegmentURL mediaRange=\"4073565-4277753\"/>\n <SegmentURL mediaRange=\"4277754-4481942\"/>\n <SegmentURL mediaRange=\"4481943-4686131\"/>\n <SegmentURL mediaRange=\"4686132-4890320\"/>\n <SegmentURL mediaRange=\"4890321-5094509\"/>\n <SegmentURL mediaRange=\"5094510-5298698\"/>\n <SegmentURL mediaRange=\"5298699-5502887\"/>\n <SegmentURL mediaRange=\"5502888-5707076\"/>\n <SegmentURL mediaRange=\"5707077-5911265\"/>\n <SegmentURL mediaRange=\"5911266-6115454\"/>\n <SegmentURL mediaRange=\"6115455-6319643\"/>\n <SegmentURL mediaRange=\"6319644-6523832\"/>\n <SegmentURL mediaRange=\"6523833-6728021\"/>\n <SegmentURL mediaRange=\"6728022-6932210\"/>\n <SegmentURL mediaRange=\"6932211-7136399\"/>\n <SegmentURL mediaRange=\"7136400-7340588\"/>\n <SegmentURL mediaRange=\"7340589-7544777\"/>\n <SegmentURL mediaRange=\"7544778-7748966\"/>\n <SegmentURL mediaRange=\"7748967-7953155\"/>\n <SegmentURL mediaRange=\"7953156-8159340\"/>\n </SegmentList>\n </Representation>\n </AdaptationSet>\n </Period>\n</MPD>`\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { lazy } from '@amazon/vinyl-util'\n\n/**\n * For reliable integ tests on 3P devices, there should be a single media element.\n * When using the media element, unload any sources and reset any state after each test.\n */\nexport const mediaRef = lazy<HTMLMediaElement>(() => {\n const media = document.createElement('video')\n media.muted = true\n media.playsInline = true // needed for iOS\n media.disableRemotePlayback = true // Disables casting. Needed for ManagedMediaSource\n return media\n})\n\nafterEach(() => {\n if (mediaRef.constructed) {\n // Reset the media element.\n const media = mediaRef.value\n media.removeAttribute('src')\n media.load()\n }\n})\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { getAudioContext } from '@amazon/vinyl'\nimport { type LogTarget, TimeoutError } from '@amazon/vinyl-util'\nimport { sleep } from '@amazon/vinyl-util'\nimport { parseBoolean } from '@amazon/vinyl-util'\nimport { logDebug } from '@amazon/vinyl-util'\nimport { getSearchParams } from '@amazon/vinyl-util'\nimport { createLogPrefix } from '@amazon/vinyl-util'\nimport { mediaRef } from '../player/mediaRef'\nimport { requireUserInteraction } from '../ui/requireUserInteraction'\nimport { unlockMediaElement } from './unlockMediaElement'\nimport { setNextTestTimeout } from '@amazon/vinyl-util/browserTestUtil'\n\n/**\n * The percent tolerance the time estimate based on the analyzed frequency can be off from the actual currentTime.\n */\nconst TIME_ESTIMATE_TOLERANCE = 0.02\n\nexport interface FrequencyAnalyzerOptions {\n /**\n * The frequency the sweep starts at.\n */\n readonly startFrequency: number\n\n /**\n * The frequency the sweep ends at.\n */\n readonly endFrequency: number\n\n /**\n * The window size in samples. Default: 4096.\n * A higher value will result in more details in the frequency domain but fewer details in the amplitude domain.\n */\n readonly fftSize:\n | 32\n | 64\n | 128\n | 256\n | 512\n | 1024\n | 2048\n | 4096\n | 8192\n | 16384\n | 32768\n}\n\nconst defaultFrequencyAnalyzerOptions = {\n startFrequency: 100,\n endFrequency: 6000,\n fftSize: 4096,\n} as const satisfies FrequencyAnalyzerOptions\n\nexport class FrequencyAnalyzer implements LogTarget {\n private readonly data: Float32Array<ArrayBuffer>\n private readonly analyser: AnalyserNode\n\n private readonly options: FrequencyAnalyzerOptions\n\n readonly logPrefix = createLogPrefix('FrequencyAnalyzer')\n\n constructor(\n private readonly audioContext: AudioContext,\n private readonly source: MediaElementAudioSourceNode,\n options?: Partial<FrequencyAnalyzerOptions>\n ) {\n this.options = {\n ...defaultFrequencyAnalyzerOptions,\n ...options,\n }\n // Set up the AnalyserNode\n this.analyser = this.audioContext.createAnalyser()\n this.analyser.fftSize = this.options.fftSize\n this.analyser.connect(this.audioContext.destination)\n this.data = new Float32Array(this.analyser.frequencyBinCount)\n this.source.connect(this.analyser)\n }\n\n /**\n * Estimates the frequency of the current frame window.\n *\n * The frequency estimate is the frequency of the highest decibel bin within the frame window. The number of\n * bins is 1/2 the fftSize.\n */\n get frequency(): number {\n const audioCtx = this.audioContext\n const analyser = this.analyser\n const data = this.data\n analyser.getFloatFrequencyData(data)\n const maxIndex = data.reduce(\n (iMax, x, i, arr) => (x > arr[iMax] ? i : iMax),\n 0\n )\n return (maxIndex * audioCtx.sampleRate) / analyser.fftSize\n }\n\n get estimatedTime(): number {\n const frequency = this.frequency\n const start = this.options.startFrequency\n const end = this.options.endFrequency\n return (\n ((frequency - start) / (end - start)) *\n this.source.mediaElement.duration\n )\n }\n\n /**\n * Asserts that the next samples of audio plays at its expected frequency.\n */\n async assertFrequency(timeout = 10) {\n // Reconnect the analyzer to clear the buffer\n this.analyser.disconnect()\n this.analyser.connect(this.audioContext.destination)\n\n const media = this.source.mediaElement\n if (isNaN(media.duration)) fail('media is not loaded')\n if (media.paused) fail('media is paused')\n const startTime = Date.now()\n const mediaStartTime = media.currentTime\n // The minimum amount of time to fill the buffer up with data from the time the frequency assertion is\n // requested.\n const playbackTime = 0.25\n\n const maxDifference = media.duration * TIME_ESTIMATE_TOLERANCE\n\n // Check if there is enough time remaining in track to accurately test frequency.\n if (media.currentTime + playbackTime >= media.duration) {\n logDebug(\n this,\n 'Ignoring assertFrequency, currentTime is at duration'\n )\n return\n }\n\n let estimatedTime: number\n let diff: number\n let elapsed: number\n do {\n if (Date.now() - startTime > timeout * 1000) {\n throw new TimeoutError(\n 'Frequency data could not be filled, media is not playing.'\n )\n }\n elapsed = media.currentTime - mediaStartTime\n estimatedTime = this.estimatedTime\n diff = Math.abs(estimatedTime - media.currentTime)\n await sleep(playbackTime)\n } while (elapsed < playbackTime && diff > maxDifference)\n\n logDebug(\n this,\n 'time from frequency:',\n estimatedTime.toFixed(2),\n 'actual time:',\n media.currentTime.toFixed(2)\n )\n if (diff > maxDifference) {\n const percentFormatter = new Intl.NumberFormat('en-US', {\n style: 'percent',\n })\n fail(\n `The measured frequency at time ${media.currentTime.toFixed(2)} ` +\n `was measured to be ${this.frequency.toFixed(2)}Hz. ` +\n `The expected time is ${estimatedTime.toFixed(2)}, the actual time ` +\n `is ${media.currentTime.toFixed(2)}, ` +\n `for a difference of ${percentFormatter.format(\n diff / media.duration\n )} track duration. (Tolerance is ${percentFormatter.format(TIME_ESTIMATE_TOLERANCE)})`\n )\n }\n }\n}\n\n/**\n * A query param, if present, will indicate that audio should be analyzed. Does not work in CI environments.\n */\nexport const shouldCheckAudio = parseBoolean(\n (getSearchParams().get('checkAudio') ?? '0').toLowerCase()\n)\n\nlet frequencyAnalyzer: FrequencyAnalyzer | null = null\n\n/**\n * If `shouldCheckAudio` is true and AudioContext is supported, asserts that the currently playing media is playing\n * the frequency expected from the sweep tone of the test assets.\n */\nexport function assertFrequency(): Promise<void> {\n return frequencyAnalyzer?.assertFrequency() ?? Promise.resolve()\n}\n\n/**\n * Displays an interaction prompt if checkAudio is present in the query params.\n *\n * The checkAudio query param, if present, indicates that the actual sound output should be analyzed. This requires\n * a user gesture unless the UA doesn't require it. Most browsers require the gesture, but some platforms this\n * requirement may be skipped with a flag. Note that Google deprecated --autoplay-policy=no-user-gesture-required\n * March 2023, but older versions may still support it.\n */\nexport function initializeFrequencyAnalyzer() {\n if (shouldCheckAudio) {\n // If a user interaction is required, give extra time to interact before a timeout.\n setNextTestTimeout(300)\n beforeAll(async () => {\n // Creates the audio context and 'unlocks' the media element in response to a user gesture.\n const media = mediaRef.value\n media.crossOrigin = 'anonymous'\n media.muted = false\n media.volume = 0.01 // Save your ears. Analyzers do not work at volume 0 or muted; measured dB is affected.\n await requireUserInteraction()\n const audioContext = getAudioContext()\n await unlockMediaElement()\n\n if (audioContext) {\n const source = audioContext.createMediaElementSource(\n mediaRef.value\n )\n frequencyAnalyzer = new FrequencyAnalyzer(audioContext, source)\n } else {\n console.warn('AudioContext not supported')\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 type { LogEventMap, Logger, LogTarget } from '@amazon/vinyl-util'\nimport { loggerRef, LogLevel } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { overrideGlobalInit } from '../../global/overrideGlobalInit'\nimport { MockEventHost } from '../event/MockEventHost'\nimport createSpy = jasmine.createSpy\n\ntype LogFilterFun = (target: LogTarget, ...messages: any[]) => void\n\nconst spyFactory = createSpyFactory<Logger>()\nexport class MockLogger extends MockEventHost<LogEventMap> implements Logger {\n logLevel: LogLevel = LogLevel.DEBUG\n\n log = spyFactory('log').and.callFake((target, level, ...messages) => {\n switch (level) {\n // Delegates logs to spies separated by log level.\n case LogLevel.VERBOSE:\n this.verbose(target, ...messages)\n break\n case LogLevel.DEBUG:\n this.debug(target, ...messages)\n break\n case LogLevel.INFO:\n this.info(target, ...messages)\n break\n case LogLevel.WARN:\n this.warn(target, ...messages)\n break\n case LogLevel.ERROR:\n this.error(target, ...messages)\n break\n }\n })\n\n verbose = createSpy<LogFilterFun>('verbose')\n debug = createSpy<LogFilterFun>('debug')\n info = createSpy<LogFilterFun>('info')\n warn = createSpy<LogFilterFun>('warn')\n error = createSpy<LogFilterFun>('error')\n}\n\nexport function useMockLogger(): { readonly value: MockLogger } {\n return overrideGlobalInit(loggerRef, () => new MockLogger())\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n//-------------------------------------------------------------\n// Empty FetchCompletedInfo objects for tests.\n//-------------------------------------------------------------\n\nimport {\n ErrorBodyType,\n type FetchRequestInfo,\n type RequestAttemptInfo,\n type RequestCaughtErrorEvent,\n type RequestNetworkErrorEvent,\n type RequestResponseErrorEvent,\n type RequestSuccessEvent,\n type ResponseInfo,\n} from '@amazon/vinyl-util'\nimport { RequestFailureType } from '@amazon/vinyl-util'\n\nexport const emptyRequestInfo: FetchRequestInfo = {\n requestId: '',\n requestOptions: { readErrorBody: ErrorBodyType.DISABLED, serviceId: null },\n init: {},\n input: '',\n maxRetries: 0,\n timestamp: 0,\n}\n\nexport const emptyRequestAttemptInfo: RequestAttemptInfo = {\n currentTry: 0,\n timestamp: 0,\n}\n\nexport const emptyResponseInfo: ResponseInfo = {\n ok: false,\n redirected: false,\n status: 0,\n statusText: '',\n type: 'default',\n url: '',\n contentLength: 0,\n}\n\nexport const emptyRequestSuccessEvent: RequestSuccessEvent = {\n ok: true,\n requestInfo: emptyRequestInfo,\n timestamp: 0,\n attemptInfo: emptyRequestAttemptInfo,\n responseInfo: emptyResponseInfo,\n}\n\nexport const emptyInternalError: RequestCaughtErrorEvent = {\n ok: false,\n reason: null,\n requestInfo: emptyRequestInfo,\n retryAfter: null,\n timestamp: 0,\n type: RequestFailureType.INTERNAL,\n willRetry: false,\n}\n\nexport const emptyNetworkError: RequestNetworkErrorEvent = {\n ok: false,\n reason: null,\n requestInfo: emptyRequestInfo,\n retryAfter: null,\n timestamp: 0,\n type: RequestFailureType.NETWORK,\n willRetry: false,\n attemptInfo: emptyRequestAttemptInfo,\n}\n\nexport const emptyResponseError: RequestResponseErrorEvent = {\n ok: false,\n reason: null,\n requestInfo: emptyRequestInfo,\n retryAfter: null,\n timestamp: 0,\n type: RequestFailureType.RESPONSE,\n willRetry: false,\n attemptInfo: emptyRequestAttemptInfo,\n responseInfo: emptyResponseInfo,\n}\n\nexport const emptyAbortError: RequestCaughtErrorEvent = {\n ...emptyInternalError,\n type: RequestFailureType.ABORT,\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 NetworkMetrics,\n NetworkMetricsController,\n NetworkMetricsEventMap,\n} from '@amazon/vinyl-util'\nimport { EMPTY_NETWORK_METRICS } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nimport { MockEventHost } from '../event/MockEventHost'\n\nconst spyFactory = createSpyFactory<NetworkMetricsController>()\nexport class MockNetworkMetricsController\n extends MockEventHost<NetworkMetricsEventMap>\n implements NetworkMetricsController\n{\n maxHistorySize = 0\n\n metrics: NetworkMetrics = EMPTY_NETWORK_METRICS\n\n addMetricsEntry = spyFactory('addMetricsEntry')\n\n getServiceMetrics = spyFactory('getServiceMetrics')\n\n addDownlinkTransferEntry = spyFactory('addDownlinkTransferEntry')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { NetworkState, NetworkStateEventMap } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '../event/MockEventHost'\n\nconst spyFactory = createSpyFactory<NetworkState>()\nexport class MockNetworkState\n extends MockEventHost<NetworkStateEventMap>\n implements NetworkState\n{\n onLine = false\n\n nextOnLine = spyFactory('nextOnLine')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Requester, RequesterImplEventMap } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '../event/MockEventHost'\n\nconst spyFactory = createSpyFactory<Requester>()\nexport class MockRequester\n extends MockEventHost<RequesterImplEventMap>\n implements Requester\n{\n request = spyFactory('request')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport CustomReporter = jasmine.CustomReporter\nimport JasmineDoneInfo = jasmine.JasmineDoneInfo\nimport JasmineStartedInfo = jasmine.JasmineStartedInfo\nimport SpecResult = jasmine.SpecResult\nimport { LogLevel, type ReadonlyDate } from '@amazon/vinyl-util'\n\n/**\n * The minimum number of seconds between progress reports.\n */\nconst UPDATE_INTERVAL = 1\n\n/**\n * The maximum number of log statements before forcing a flush.\n * This can be reached if a single test is long-running and has excessive logs.\n */\nconst MAX_LOGS_BUFFER = 200\n\nexport interface LogReporterStartedEvent {\n readonly totalSpecs: number\n}\n\nexport interface LogReporterProgressEvent {\n readonly totalCompleted: number\n readonly totalSpecs: number\n readonly logs: readonly LogEntry[]\n}\n\nexport interface LogReporterDoneEvent {\n readonly overallStatus: 'passed' | 'failed'\n readonly totalCompleted: number\n readonly totalSpecs: number\n readonly reason: string\n}\n\nexport interface LogEntry {\n readonly timestamp: ReadonlyDate\n readonly messages: readonly any[]\n readonly level: LogLevel\n}\n\nexport abstract class LogReporter implements CustomReporter {\n /**\n * The first failed spec.\n *\n * Jasmine's spec result in `jasmineDone` does not provide these correctly in\n * failedExpectations, save this from `specDone`.\n */\n private failedResult: SpecResult | null = null\n\n private totalSpecs = 0\n private totalCompleted = 0\n\n /**\n * The timestamp of the last progress update.\n */\n protected lastProgressTimestamp = 0\n protected updateInterval = UPDATE_INTERVAL\n protected maxLogsBuffer = MAX_LOGS_BUFFER\n\n private consoleInterceptor = new ConsoleInterceptor()\n\n private readonly logs: LogEntry[] = []\n\n protected constructor() {\n this.consoleInterceptor.onLog = (entry) => {\n this.logs.push(entry)\n if (this.logs.length >= this.maxLogsBuffer)\n this.maybeReportProgress(true)\n }\n }\n\n jasmineStarted(suiteInfo: JasmineStartedInfo): void {\n this.onStarted({\n totalSpecs: suiteInfo.totalSpecsDefined,\n }).catch((e) => {\n console.error(`'done' failed to report`, e)\n })\n this.totalCompleted = 0\n this.totalSpecs = suiteInfo.totalSpecsDefined\n }\n\n protected abstract onStarted(action: LogReporterStartedEvent): Promise<void>\n\n specStarted(result: SpecResult): void {\n // Log the running spec and flush immediately. A spec that hangs never\n // reaches specDone, so without this the buffered logs \u2014 and which spec\n // was running \u2014 never reach the reporter and the log just cuts off. The\n // forced flush makes the last logged spec name identify the culprit.\n console.info(`Running spec: ${result.fullName}`)\n this.maybeReportProgress()\n }\n\n specDone(result: SpecResult): void {\n if (!this.failedResult && result.status === 'failed')\n this.failedResult = result\n this.totalCompleted++\n this.maybeReportProgress()\n }\n\n jasmineDone(runDetails: JasmineDoneInfo): void {\n this.maybeReportProgress(true)\n this.consoleInterceptor.dispose()\n const reason = this.failedResult\n ? `${this.failedResult.fullName}:\\n${this.failedResult.failedExpectations[0]?.message}`\n : runDetails.overallStatus === 'incomplete'\n ? runDetails.incompleteReason\n : ''\n const body: LogReporterDoneEvent = {\n // one of: 'passed', 'failed', 'incomplete'\n overallStatus:\n runDetails.overallStatus === 'incomplete'\n ? 'passed'\n : (runDetails.overallStatus as 'passed' | 'failed'),\n totalCompleted: this.totalCompleted,\n totalSpecs: this.totalSpecs,\n reason,\n }\n this.onDone(body).catch((_) => {\n // One retry:\n this.onDone(body).catch((e) => {\n console.error(`'done' failed to report`, e)\n })\n })\n }\n\n /**\n * If there has not been a progress update within `updateInterval`, emit another progress\n * event.\n * @private\n */\n private maybeReportProgress(force: boolean = false) {\n const now = Date.now()\n if (\n force ||\n now - this.lastProgressTimestamp > this.updateInterval * 1000\n ) {\n const logs = this.logs.slice()\n this.logs.length = 0\n this.onProgress({\n totalCompleted: this.totalCompleted,\n totalSpecs: this.totalSpecs,\n logs,\n }).catch((e) => {\n console.error(`'progress' failed to report`, e)\n })\n this.lastProgressTimestamp = now\n }\n }\n\n protected abstract onProgress(\n action: LogReporterProgressEvent\n ): Promise<void>\n\n protected abstract onDone(action: LogReporterDoneEvent): Promise<void>\n}\n\nconst consoleMethods = [\n 'debug',\n 'log',\n 'info',\n 'warn',\n 'error',\n] as const satisfies (keyof Console)[]\n\nconst consoleMethodLevels: Record<string, LogLevel> = {\n debug: LogLevel.DEBUG,\n log: LogLevel.DEBUG,\n warn: LogLevel.WARN,\n info: LogLevel.INFO,\n error: LogLevel.ERROR,\n} as const\n\n/**\n * Intercepts console, logging to an array as well.\n */\nclass ConsoleInterceptor {\n private readonly originalMethods: Record<string, (...args: any[]) => void>\n\n /**\n * Invoked on every log statement.\n */\n onLog: ((entry: LogEntry) => void) | null = null\n\n constructor() {\n this.originalMethods = {}\n for (const consoleMethod of consoleMethods) {\n this.originalMethods[consoleMethod] = console[consoleMethod]\n console[consoleMethod] = (...args) => {\n if (this.onLog)\n this.onLog({\n level:\n consoleMethodLevels[consoleMethod] ??\n LogLevel.DEBUG,\n timestamp: new Date(),\n messages: args,\n })\n this.originalMethods[consoleMethod].apply(console, args)\n }\n }\n }\n\n dispose() {\n for (const consoleMethod of consoleMethods) {\n console[consoleMethod] = this.originalMethods[consoleMethod]\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 {\n AdBreakInfo,\n AdController,\n AdInfo,\n TrackAds,\n} from '../../../../src'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<AdController>()\nexport class MockAdController extends MockEventHost implements AdController {\n currentTrackAds: TrackAds | null = null\n currentAd: AdInfo | null = null\n currentAdBreak: AdBreakInfo | null = null\n\n setAdsProvider = spyFactory('setAdsProvider')\n failAd = spyFactory('failAd')\n skipAd = spyFactory('skipAd')\n skipAdBreak = spyFactory('skipAdBreak')\n enterPreroll = spyFactory('enterPreroll')\n enterPostroll = spyFactory('enterPostroll')\n\n constructor() {\n super()\n // enterPreroll/enterPostroll are awaited by the TrackController, so\n // default them to resolve with \"no roll\" (null); tests override with\n // resolveTo() as needed.\n this.enterPreroll.and.resolveTo(null)\n this.enterPostroll.and.resolveTo(null)\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 Capabilities } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<Capabilities>()\nexport class MockCapabilities implements Capabilities {\n sampleRate: number | null = null\n dash = false\n hls = false\n mse = false\n eme = false\n\n canPlayType = spyFactory('canPlayType')\n canPlayTypeMse = spyFactory('canPlayTypeMse')\n supportsKeySystem = spyFactory('supportsKeySystem')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Required properties on AdaptationSetType\nimport { parseDashManifest } from '@amazon/vinyl-mpd-parser'\n\nexport const mockDashManifest = parseDashManifest(\n // language=XML\n `<?xml version=\"1.0\" ?>\n<MPD profiles=\"\" minBufferTime=\"PT0.0S\" type=\"static\" xmlns=\"urn:mpeg:dash:schema:mpd:2011\">\n <Period>\n <AdaptationSet>\n <Representation id=\"0\" bandwidth=\"0\"/>\n </AdaptationSet>\n </Period>\n</MPD>`\n)\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport type {\n DashManifestController,\n DashManifestData,\n ManifestControllerEventMap,\n} from '@amazon/vinyl'\nimport {\n type EventHandler,\n EventHostImpl,\n type SignalOptions,\n} from '@amazon/vinyl-util'\nimport { data } from '@amazon/vinyl-observable'\nimport { mockDashManifest } from './mockDashManifest'\n\nconst spyFactory = createSpyFactory<DashManifestController>()\n\n/**\n * Mock implementation of DashManifestController.\n *\n * Uses a real MutableValue internally so that map/pick/onData work correctly.\n */\nexport class MockDashManifestController implements DashManifestController {\n private readonly _data = data<Promise<DashManifestData>>(\n Promise.resolve({\n manifest: mockDashManifest,\n baseUrl: 'https://example.com',\n })\n )\n private readonly events = new EventHostImpl<ManifestControllerEventMap>()\n\n refresh = spyFactory('refresh')\n reset = spyFactory('reset')\n\n on<K extends keyof ManifestControllerEventMap>(\n type: K,\n handler: EventHandler<ManifestControllerEventMap[K]>,\n options?: SignalOptions\n ) {\n return this.events.on(type, handler, options)\n }\n\n dispatch<K extends keyof ManifestControllerEventMap>(\n type: K,\n event: ManifestControllerEventMap[K]\n ) {\n this.events.dispatch(type, event)\n }\n\n hasAnyListeners() {\n return this.events.hasAnyListeners()\n }\n\n hasListeners(type: keyof ManifestControllerEventMap) {\n return this.events.hasListeners(type)\n }\n\n readonly __eventMapType = this.events.__eventMapType\n\n get value() {\n return this._data.value\n }\n\n get changeId() {\n return this._data.changeId\n }\n\n getValue() {\n return this._data.getValue()\n }\n\n onData(\n callback: (\n value: Promise<DashManifestData>,\n previous: Promise<DashManifestData> | undefined\n ) => void\n ) {\n return this._data.onData(callback)\n }\n\n map<U>(transform: (value: Promise<DashManifestData>) => U) {\n return this._data.map(transform)\n }\n\n pick<K extends keyof NonNullable<Promise<DashManifestData>>>(prop: K) {\n return this._data.pick(prop)\n }\n\n setManifest(manifest: Promise<DashManifestData>) {\n this._data.value = manifest\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 { DrmKeySystem } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<typeof MSMediaKeys & MSMediaKeys>()\n\nexport class MockMSMediaKeys implements MSMediaKeys {\n constructor(readonly keySystem: DrmKeySystem) {}\n\n createSession = spyFactory('createSession')\n\n static isTypeSupported = spyFactory('isTypeSupported')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n createSpyFactory,\n MockEventTarget,\n} from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<MSMediaKeySession>()\nexport class MockMSMediaKeySession\n extends MockEventTarget\n implements MSMediaKeySession\n{\n error: MSMediaKeyError | null = null\n keySystem = ''\n onmskeyadded = null\n onmskeyerror = null\n onmskeymessage = null\n sessionId = ''\n\n close = spyFactory('close')\n\n update = spyFactory('update')\n\n addEventListener = spyFactory('addEventListener')\n\n dispatchEvent = spyFactory('dispatchEvent')\n\n removeEventListener = spyFactory('removeEventListener')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DrmKeySystem } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<typeof WebKitMediaKeys & WebKitMediaKeys>()\n\nexport class MockWebKitMediaKeys implements WebKitMediaKeys {\n constructor(public readonly keySystem: DrmKeySystem) {}\n\n createSession = spyFactory('createSession')\n\n static isTypeSupported = spyFactory('isTypeSupported')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n MockEventTarget,\n createSpyFactory,\n} from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<WebKitMediaKeySession>()\nexport class MockWebKitMediaKeySession\n extends MockEventTarget\n implements WebKitMediaKeySession\n{\n error: WebKitMediaKeyError | null = null\n keySystem = ''\n onwebkitkeyadded = null\n onwebkitkeyerror = null\n onwebkitkeymessage = null\n sessionId = ''\n\n close = spyFactory('close')\n\n update = spyFactory('update')\n\n addEventListener = spyFactory('addEventListener')\n\n dispatchEvent = spyFactory('dispatchEvent')\n\n removeEventListener = spyFactory('removeEventListener')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { CommonEme } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<CommonEme>()\n\nexport class MockCommonEme implements CommonEme {\n requestMediaKeySystemAccess = spyFactory('requestMediaKeySystemAccess')\n\n addEncryptedListener = spyFactory('addEncryptedListener')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { type CommonMediaKeys, DrmKeySystem } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<CommonMediaKeys>()\nexport class MockCommonMediaKeys implements CommonMediaKeys {\n keySystem: DrmKeySystem = DrmKeySystem.CLEAR_KEY\n clearFromElement = spyFactory('clearFromElement')\n createSession = spyFactory('createSession')\n setOnElement = spyFactory('setOnElement')\n setServerCertificate = spyFactory('setServerCertificate')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DrmInitDataType } from '@amazon/vinyl'\nimport {\n type CommonMediaKeySession,\n type CommonMediaKeySessionEventMap,\n type EncryptedInitData,\n} from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<CommonMediaKeySession>()\nexport class MockCommonMediaKeySession\n extends MockEventHost<CommonMediaKeySessionEventMap>\n implements CommonMediaKeySession\n{\n initData: EncryptedInitData = new ArrayBuffer(0)\n initDataType: DrmInitDataType = 'cenc'\n mimeType = ''\n disposed = false\n\n update = spyFactory('update')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DrmKeySystem } from '@amazon/vinyl'\nimport { type CommonMediaKeySystemAccess } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<CommonMediaKeySystemAccess>()\n\nexport class MockCommonMediaKeySystemAccess implements CommonMediaKeySystemAccess {\n constructor(public keySystem: DrmKeySystem) {}\n\n createMediaKeys = spyFactory('createMediaKeys')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DrmController, DrmControllerEventMap } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<DrmController>()\nexport class MockDrmController\n extends MockEventHost<DrmControllerEventMap>\n implements DrmController\n{\n error: Error | null = null\n\n configure = spyFactory('configure')\n isEmeSupported = spyFactory('isEmeSupported')\n isSupported = spyFactory('isSupported')\n initializeForPlayback = spyFactory('initializeForPlayback')\n setBufferingDrmInfo = spyFactory('setBufferingDrmInfo')\n closeSessions = spyFactory('closeSessions')\n reset = spyFactory('reset')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport type {\n HlsManifestController,\n HlsManifestData,\n ManifestControllerEventMap,\n} from '@amazon/vinyl'\nimport {\n type EventHandler,\n EventHostImpl,\n type SignalOptions,\n} from '@amazon/vinyl-util'\nimport { data } from '@amazon/vinyl-observable'\nimport { mockHlsManifestData } from './mockHlsManifest'\n\nconst spyFactory = createSpyFactory<HlsManifestController>()\n\n/**\n * Mock implementation of HlsManifestController.\n *\n * Uses a real MutableValue internally so that map/pick/onData work correctly.\n */\nexport class MockHlsManifestController implements HlsManifestController {\n private readonly _data = data<Promise<HlsManifestData>>(\n Promise.resolve(mockHlsManifestData)\n )\n private readonly events = new EventHostImpl<ManifestControllerEventMap>()\n\n refresh = spyFactory('refresh')\n reset = spyFactory('reset')\n\n on<K extends keyof ManifestControllerEventMap>(\n type: K,\n handler: EventHandler<ManifestControllerEventMap[K]>,\n options?: SignalOptions\n ) {\n return this.events.on(type, handler, options)\n }\n\n hasAnyListeners() {\n return this.events.hasAnyListeners()\n }\n\n hasListeners(type: keyof ManifestControllerEventMap) {\n return this.events.hasListeners(type)\n }\n\n readonly __eventMapType = this.events.__eventMapType\n\n get value() {\n return this._data.value\n }\n\n get changeId() {\n return this._data.changeId\n }\n\n getValue() {\n return this._data.getValue()\n }\n\n onData(\n callback: (\n value: Promise<HlsManifestData>,\n previous: Promise<HlsManifestData> | undefined\n ) => void\n ) {\n return this._data.onData(callback)\n }\n\n map<U>(transform: (value: Promise<HlsManifestData>) => U) {\n return this._data.map(transform)\n }\n\n pick<K extends keyof NonNullable<Promise<HlsManifestData>>>(prop: K) {\n return this._data.pick(prop)\n }\n\n setManifest(manifest: Promise<HlsManifestData>) {\n this._data.value = manifest\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 { HistoryLogHandler, HistoryLogItem } from '@amazon/vinyl-util'\nimport { LogLevel } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<HistoryLogHandler>()\nexport class MockHistoryLogHandler implements HistoryLogHandler {\n logLevel: LogLevel = LogLevel.DEBUG\n maxHistorySize = 0\n history: HistoryLogItem[] = []\n clear = spyFactory('clear')\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 LoudnessNormalizationController,\n LoudnessNormalizationControllerEventMap,\n} from '@amazon/vinyl'\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<LoudnessNormalizationController>()\n\nexport class MockLoudnessNormalizationController\n extends MockEventHost<LoudnessNormalizationControllerEventMap>\n implements LoudnessNormalizationController\n{\n gain = 1.0\n setTrackLoudness = spyFactory('setTrackLoudness')\n clear = spyFactory('clear')\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 PlaybackController,\n PlaybackControllerEventMap,\n} from '@amazon/vinyl'\nimport { PlaybackNetworkState, PlaybackReadyState } from '@amazon/vinyl'\nimport { RangesImpl } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<PlaybackController>()\n\nexport class MockPlaybackController\n extends MockEventHost<PlaybackControllerEventMap>\n implements PlaybackController\n{\n buffered = new RangesImpl()\n canPlay = false\n canPlayThrough = false\n currentTime = 0\n currentTimePercent = 0\n defaultPlaybackRate = 0\n duration = 0\n ended = false\n error: Error | null = null\n hasMetadata = false\n loop = false\n muted = false\n networkState: PlaybackNetworkState = PlaybackNetworkState.NETWORK_IDLE\n pause = spyFactory('pause')\n paused = false\n play = spyFactory('play')\n playIsPending = false\n playbackRate = 0\n playing = false\n preservesPitch = true\n readyState: PlaybackReadyState = PlaybackReadyState.HAVE_NOTHING\n reset = spyFactory('reset')\n seekTo = spyFactory('seekTo')\n seekable = new RangesImpl()\n seeking = false\n volume = 0\n waiting = false\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { CrossOrigin, PlaybackSource } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<PlaybackSource>()\nexport class MockPlaybackSource implements PlaybackSource {\n crossOrigin: CrossOrigin = null\n currentSrc = ''\n src: string | null = null\n srcObject: MediaStream | null = null\n disableRemotePlayback = false\n\n load = spyFactory('load')\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 Track,\n TrackController,\n TrackControllerEventMap,\n TrackLoadOptions,\n} from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<TrackController<any>>()\n\nexport class MockTrackController<\n TrackLoadOptionsType extends TrackLoadOptions = TrackLoadOptions,\n>\n extends MockEventHost<TrackControllerEventMap<TrackLoadOptionsType>>\n implements TrackController<TrackLoadOptionsType>\n{\n activeTrack: Track | null = null\n\n currentAdTrack: Track | null = null\n\n queue: any[] = []\n\n clearPrefetch = spyFactory('clearPrefetch')\n clearQueue = spyFactory('clearQueue')\n clearTrackCache = spyFactory('clearTrackCache')\n enqueue = spyFactory('enqueue')\n getCachedTrack = spyFactory('getCachedTrack')\n getCachedTracks = spyFactory('getCachedTracks')\n hasNext = spyFactory('hasNext')\n isTrackCached = spyFactory('isTrackCached')\n load = spyFactory('load')\n next = spyFactory('next')\n preload = spyFactory('preload')\n unload = spyFactory('unload')\n reset = spyFactory('reset')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport {\n type MediaSourceController,\n type MediaSourceControllerEventMap,\n} from '@amazon/vinyl'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<MediaSourceController>()\n\nexport class MockMediaSourceController\n extends MockEventHost<MediaSourceControllerEventMap>\n implements MediaSourceController\n{\n readyState: ReadyState = 'closed'\n createSourceBuffer = spyFactory('createSourceBuffer')\n endOfStream = spyFactory('endOfStream')\n activate = spyFactory('activate')\n deactivate = spyFactory('deactivate')\n readyToAppend = false\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 ContentStream,\n ContentType,\n MediaQualityMetadata,\n StreamingEventMap,\n} from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\nimport { RangesImpl } from '@amazon/vinyl-util'\n\nconst spyFactory = createSpyFactory<ContentStream>()\n\nexport class MockContentStream\n extends MockEventHost<StreamingEventMap>\n implements ContentStream\n{\n contentType: ContentType = 'audio'\n bufferingQuality: MediaQualityMetadata | null = null\n error: Error | null = null\n fetchedRanges = new RangesImpl()\n playbackQuality: MediaQualityMetadata | null = null\n streamingQuality: MediaQualityMetadata | null = null\n bufferingEnded = false\n hasData = false\n\n clearPrefetch = spyFactory('clearPrefetch')\n\n activate = spyFactory('activate')\n\n deactivate = spyFactory('deactivate')\n\n preload = spyFactory('preload')\n\n reset = spyFactory('reset')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TextTrackController, TextTrackInfo } from '../../../../src'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<TextTrackController>()\n\nexport class MockTextTrackController\n extends MockEventHost\n implements TextTrackController\n{\n textTracks: readonly TextTrackInfo[] = []\n activeTextTrack: TextTrackInfo | null = null\n\n setActiveTextTrack = spyFactory('setActiveTextTrack')\n suspend = spyFactory('suspend')\n resume = spyFactory('resume')\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 ContentType,\n createEmptyMediaQualityMetadata,\n type DashMediaQualityMetadataResolver,\n type DashTrackDeps,\n defaultQualitySelectorImplOptions,\n type MediaTimeline,\n type VinylOptions,\n} from '@amazon/vinyl'\nimport { MockDashManifestController } from '../../dash/MockDashManifestController'\nimport { MockMediaSourceController } from '../../streaming/buffering/MockMediaSourceController'\nimport { MockPlaybackSource } from '../../playback/MockPlaybackSource'\nimport { MockContentStream } from '../../streaming/MockContentStream'\nimport { MockPlaybackController } from '../../playback/MockPlaybackController'\nimport { MockDrmController } from '../../drm/MockDrmController'\nimport { MockTextTrackController } from '../../text/MockTextTrackController'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { data } from '@amazon/vinyl-observable'\n\nimport createSpy = jasmine.createSpy\n\nconst emptyTimeline: MediaTimeline = {\n periods: [],\n minBufferTime: 0,\n getAdBreaks: () => Promise.resolve([]),\n getDuration: () => Promise.resolve(Infinity),\n}\n\nconst spyFactory = createSpyFactory<DashTrackDeps>()\nexport function createMockDashDependencies() {\n const playbackController = new MockPlaybackController()\n playbackController.seekTo.and.resolveTo(void 0)\n\n const manifestController = new MockDashManifestController()\n\n return {\n textTrackController: new MockTextTrackController(),\n contentTypesValue: data(Promise.resolve(new Set<ContentType>())),\n contentStreamFactory: spyFactory('contentStreamFactory').and.callFake(\n (contentType) => {\n const stream = new MockContentStream()\n stream.contentType = contentType\n return stream\n }\n ),\n manifestController,\n manifestTransformed: manifestController,\n mediaTimeline: data(Promise.resolve(emptyTimeline)),\n mediaTimelineTransformed: data(Promise.resolve(emptyTimeline)),\n mediaSourceController: new MockMediaSourceController(),\n playbackSource: new MockPlaybackSource(),\n playbackController,\n drmController: new MockDrmController(),\n mediaQualityMetadataResolver:\n createSpy<DashMediaQualityMetadataResolver>().and.callFake(() =>\n createEmptyMediaQualityMetadata()\n ),\n preferredAudioLanguage:\n data<VinylOptions['preferredAudioLanguage']>(null),\n allowedContentTypes: data<VinylOptions['allowedContentTypes']>(null),\n preferDescriptiveAudio:\n data<VinylOptions['preferDescriptiveAudio']>(false),\n abr: data<VinylOptions['abr']>(defaultQualitySelectorImplOptions),\n } as const satisfies DashTrackDeps\n}\n\nexport type MockDashDependencies = ReturnType<typeof createMockDashDependencies>\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n AutoResetController,\n AutoResetControllerEventMap,\n} from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<AutoResetController>()\nexport class MockAutoResetController\n extends MockEventHost<AutoResetControllerEventMap>\n implements AutoResetController\n{\n setError = spyFactory('setError')\n clear = spyFactory('clear')\n resetPending = false\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport type { QualitySelector } from '@amazon/vinyl'\n\nconst spyFactory = createSpyFactory<QualitySelector>()\n\nexport class MockQualitySelector implements QualitySelector {\n selectQuality = spyFactory('selectQuality')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport type {\n BufferingController,\n BufferingControllerEventMap,\n MediaQualityMetadata,\n} from '@amazon/vinyl'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<BufferingController>()\n\nexport class MockBufferingController\n extends MockEventHost<BufferingControllerEventMap>\n implements BufferingController\n{\n error: Error | null = null\n active = false\n bufferingEnded = false\n hasData = false\n playbackQuality: MediaQualityMetadata | null = null\n bufferingQuality: MediaQualityMetadata | null = null\n activate = spyFactory('activate')\n deactivate = spyFactory('deactivate')\n clear = spyFactory('clear')\n reset = spyFactory('reset')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { type SourceBufferController } from '@amazon/vinyl'\n\nimport { RangesImpl } from '@amazon/vinyl-util'\n\nconst spyFactory = createSpyFactory<SourceBufferController>()\n\nexport class MockSourceBufferController implements SourceBufferController {\n buffered = new RangesImpl()\n\n append = spyFactory('append')\n\n appendInit = spyFactory('appendInit')\n\n clear = spyFactory('clear')\n\n enqueue = spyFactory('enqueue')\n\n isBusy = spyFactory('isBusy')\n\n remove = spyFactory('remove')\n\n setAppendWindow = spyFactory('setAppendWindow')\n\n setTimestampOffset = spyFactory('setTimestampOffset')\n\n dispose = spyFactory('dispose')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport {\n type MediaQualityMetadata,\n type SegmentController,\n type SegmentControllerEventMap,\n} from '@amazon/vinyl'\nimport { emptyRanges } from '@amazon/vinyl-util'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<SegmentController>()\n\nexport class MockSegmentController\n extends MockEventHost<SegmentControllerEventMap>\n implements SegmentController\n{\n error: Error | null = null\n\n configure = spyFactory('configure')\n\n fetchedRanges = emptyRanges\n\n activate = spyFactory('activate')\n\n clear = spyFactory('clear')\n\n deactivate = spyFactory('deactivate')\n\n getSegment = spyFactory('getSegment')\n\n streamingQuality: MediaQualityMetadata | null = null\n\n reset = spyFactory('reset')\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 ContentType,\n createEmptyMediaQualityMetadata,\n defaultQualitySelectorImplOptions,\n type HlsMediaQualityMetadataResolver,\n type HlsTrackDeps,\n type MediaTimeline,\n type VinylOptions,\n} from '@amazon/vinyl'\nimport { MockHlsManifestController } from '../../hls/MockHlsManifestController'\nimport { MockMediaSourceController } from '../../streaming/buffering/MockMediaSourceController'\nimport { MockPlaybackSource } from '../../playback/MockPlaybackSource'\nimport { MockContentStream } from '../../streaming/MockContentStream'\nimport { MockPlaybackController } from '../../playback/MockPlaybackController'\nimport { MockDrmController } from '../../drm/MockDrmController'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { data } from '@amazon/vinyl-observable'\n\nimport createSpy = jasmine.createSpy\n\nconst emptyTimeline: MediaTimeline = {\n periods: [],\n minBufferTime: 0,\n getAdBreaks: () => Promise.resolve([]),\n getDuration: () => Promise.resolve(Infinity),\n}\n\nconst spyFactory = createSpyFactory<HlsTrackDeps>()\nexport function createMockHlsDependencies() {\n const playbackController = new MockPlaybackController()\n playbackController.seekTo.and.resolveTo(void 0)\n\n const manifestController = new MockHlsManifestController()\n\n return {\n contentTypesValue: data(Promise.resolve(new Set<ContentType>())),\n contentStreamFactory: spyFactory('contentStreamFactory').and.callFake(\n (contentType) => {\n const stream = new MockContentStream()\n stream.contentType = contentType\n return stream\n }\n ),\n manifestController,\n manifestTransformed: manifestController.map((v) => v),\n mediaTimeline: data(Promise.resolve(emptyTimeline)),\n mediaTimelineTransformed: data(Promise.resolve(emptyTimeline)),\n mediaSourceController: new MockMediaSourceController(),\n playbackSource: new MockPlaybackSource(),\n playbackController,\n drmController: new MockDrmController(),\n mediaQualityMetadataResolver:\n createSpy<HlsMediaQualityMetadataResolver>().and.callFake(() =>\n createEmptyMediaQualityMetadata()\n ),\n preferredAudioLanguage:\n data<VinylOptions['preferredAudioLanguage']>(null),\n allowedContentTypes: data<VinylOptions['allowedContentTypes']>(null),\n preferDescriptiveAudio:\n data<VinylOptions['preferDescriptiveAudio']>(false),\n abr: data<VinylOptions['abr']>(defaultQualitySelectorImplOptions),\n } as const satisfies HlsTrackDeps\n}\n\nexport type MockHlsDependencies = ReturnType<typeof createMockHlsDependencies>\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n type AdController,\n type ContentType,\n type MediaQualityMetadata,\n type SeekRange,\n type TextTrackController,\n type Track,\n type TrackAds,\n type TrackEventMap,\n} from '@amazon/vinyl'\nimport { RangesImpl } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<Track>()\n\nexport class MockTrack extends MockEventHost<TrackEventMap> implements Track {\n get [Symbol.toStringTag](): string {\n return `MockTrack(${this.uri})`\n }\n\n ads: TrackAds | null = null\n\n /**\n * Resolves the track's ads. Mirrors the real async `getAds()` contract; the\n * `ads` field is the backing value (defaulting to an empty break list).\n */\n getAds(): Promise<TrackAds> {\n return Promise.resolve(this.ads ?? { trackUri: this.uri, adBreaks: [] })\n }\n\n uri = ''\n type = ''\n active = false\n fetchedRanges = new RangesImpl()\n preload = spyFactory('preload')\n contentTypes: Set<ContentType> = new Set()\n qualities: readonly MediaQualityMetadata[] | null = null\n qualitiesUnfiltered: readonly MediaQualityMetadata[] | null = null\n getStreamingQuality = spyFactory('getStreamingQuality')\n getBufferingQuality = spyFactory('getBufferingQuality')\n getPlaybackQuality = spyFactory('getPlaybackQuality')\n extra: any = undefined\n error: Error | null = null\n textTrackController: TextTrackController | null = null\n adController: AdController | null = null\n seekRange: SeekRange | null = null\n\n activate = spyFactory('activate')\n deactivate = spyFactory('deactivate')\n\n clearPrefetch = spyFactory('clearPrefetch')\n reset = spyFactory('reset')\n disposed = false\n\n /**\n * Installs fakes for activate and deactivate to set active status.\n */\n implementActivateFakes() {\n this.activate.and.callFake(() => {\n this.active = true\n })\n this.deactivate.and.callFake(() => {\n this.active = false\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 { parseDashManifest } from '@amazon/vinyl-mpd-parser'\nimport { benchmark } from '@amazon/vinyl-util/browserTestUtil'\nimport { dash_segmentListMediaRange } from '@amazon/vinyl/vinylTestUtil'\nimport { addBenchmarks, setupBenchmark } from '../../setup'\n\ndescribe('parseDashManifest', () => {\n setupBenchmark()\n\n it('Parse Dash', async () => {\n addBenchmarks(\n 'Parse Dash - isoff on demand',\n await benchmark('SAX', () =>\n parseDashManifest(dash_segmentListMediaRange)\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 { LinkedList } from '@amazon/vinyl-util'\nimport { benchmark } from '@amazon/vinyl-util/browserTestUtil'\nimport { addBenchmarks, setupBenchmark } from '../../setup'\n\ndescribe('LinkedList', () => {\n setupBenchmark()\n\n interface Element {\n r: number\n a: number\n b: number\n }\n\n function createList(n: number): LinkedList<Element> {\n const list = new LinkedList<Element>()\n for (let i = 0; i < n; i++) {\n list.push({ r: 0, a: Math.random(), b: Math.random() })\n }\n return list\n }\n\n function createArray(n: number) {\n const arr: Element[] = []\n for (let i = 0; i < n; i++) {\n arr.push({ r: 0, a: Math.random(), b: Math.random() })\n }\n return arr\n }\n\n ;[100, 1000].forEach((size) => {\n const list = createList(size)\n const arr = createArray(size)\n\n describe(`size: ${size}`, () => {\n it('forEach', async () => {\n const name = `forEach ${size}`\n // Having an unpredictable output in the executor prevents the JS engine from\n // any potential caching.\n const listResults = await benchmark(\n `LinkedList ${name}`,\n () => {\n list.forEach((e: Element) => (e.r = e.a + e.b))\n }\n )\n const arrayResults = await benchmark(`Array ${name}`, () => {\n arr.forEach((e) => (e.r = e.a + e.b))\n })\n addBenchmarks(name, listResults, arrayResults)\n })\n\n it('unshift', async () => {\n const name = `unshift/shift ${size}`\n const e = { r: 0, a: 0, b: 0 }\n const listResults = await benchmark(\n `LinkedList ${name}`,\n () => {\n list.unshift(e)\n list.shift()\n }\n )\n const arrayResults = await benchmark(`Array ${name}`, () => {\n arr.unshift(e)\n arr.shift()\n })\n addBenchmarks(name, listResults, arrayResults)\n })\n\n it('push', async () => {\n const name = `push/pop ${size}`\n const e = { r: 0, a: 0, b: 0 }\n const listResults = await benchmark(\n `LinkedList ${name}`,\n () => {\n list.push(e)\n list.pop()\n }\n )\n const arrayResults = await benchmark(`Array ${name}`, () => {\n arr.push(e)\n arr.pop()\n })\n addBenchmarks(name, listResults, arrayResults)\n })\n\n it('for of', async () => {\n const name = `for of ${size}`\n const listResults = await benchmark(\n `LinkedList ${name}`,\n () => {\n for (const e of list) {\n e.r = e.a + e.b\n }\n }\n )\n const arrayResults = await benchmark(`Array ${name}`, () => {\n for (const e of arr) {\n e.r = e.a + e.b\n }\n })\n addBenchmarks(name, listResults, arrayResults)\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 { mergeDeep } from '@amazon/vinyl-util'\nimport { benchmark } from '@amazon/vinyl-util/browserTestUtil'\nimport { addBenchmarks, setupBenchmark } from '../../setup'\n\ndescribe('mergeDeep', () => {\n setupBenchmark()\n it('object merge', async () => {\n const a = {\n b: {\n c: 3,\n d: 4,\n e: 'test',\n },\n f: {\n g: 5,\n h: true,\n i: false,\n },\n j: {\n k: {\n m: 5,\n },\n },\n }\n\n const b = {\n b: {\n d: 4,\n f2: 'test2',\n },\n f: {\n g: 5,\n h: true,\n i: false,\n },\n j: {\n k: {\n m: 5,\n },\n },\n }\n\n const mergeDeepResults = await benchmark(`mergeDeep`, () => {\n mergeDeep([a, b])\n })\n addBenchmarks('merge deep', mergeDeepResults)\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 '@amazon/vinyl-util'\nimport { benchmark } from '@amazon/vinyl-util/browserTestUtil'\nimport { addBenchmarks, setupBenchmark } from '../../setup'\n\ndescribe('json', () => {\n setupBenchmark()\n\n it('toJson', async () => {\n const results = await benchmark(`toJson`, () => {\n toJson({\n requestInfo: {\n fetchId: 'lgn9lrwaid8o3utd5r',\n init: {\n method: 'POST',\n headers: {\n 'Content-Encoding': 'amz-1.0',\n 'Content-Type': 'application/json',\n 'X-Amz-Target':\n 'com.amazon.digitalmusiclocator.DigitalMusicLocatorServiceExternal.getStreamingURLs',\n },\n body: '{\"contentIdList\":[{\"identifier\":\"d9e4e337-97ba-41a9-9f31-84a8bf99f1dc\",\"identifierType\":\"COID\"}],\"bitRate\":\"HIGH\",\"deviceToken\":{\"deviceId\":\"lg4msezd1e355heuc5b\",\"deviceTypeId\":\"A16ZV8BU3SN1N3\"},\"appMetadata\":{\"appId\":\"WebCP\",\"https\":true,\"appVersion\":\"1.0.0\"},\"clientMetadata\":{\"clientId\":\"WebCP\",\"clientRequestId\":\"lgn9lrw623mgvi7k3et\"}}',\n signal: '[object AbortSignal]',\n },\n input: 'https://example.com/bar/',\n maxRetries: 1,\n timestamp: new Date('2023-04-19T05:40:17.914Z'),\n requestOptions: {\n serviceId: null,\n readErrorBody: 1,\n },\n },\n attemptInfo: {\n currentTry: 1,\n timestamp: new Date('2023-04-19T05:40:17.914Z'),\n },\n target: '[object FetchProviderImpl]',\n })\n })\n addBenchmarks('toJson', results)\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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oBAAoB;AAAA,gBACpB,gBAAgB;AAAA,gBAChB,gBACI;AAAA,cACR;AAAA,cACA,MAAM;AAAA,cACN,QAAQ;AAAA,YACZ;AAAA,YACA,OAAO;AAAA,YACP,YAAY;AAAA,YACZ,WAAW,oBAAI,KAAK,0BAA0B;AAAA,YAC9C,gBAAgB;AAAA,cACZ,WAAW;AAAA,cACX,eAAe;AAAA,YACnB;AAAA,UACJ;AAAA,UACA,aAAa;AAAA,YACT,YAAY;AAAA,YACZ,WAAW,oBAAI,KAAK,0BAA0B;AAAA,UAClD;AAAA,UACA,QAAQ;AAAA,QACZ,CAAC;AAAA,MACL,CAAC;AACD,oBAAc,UAAU,OAAO;AAAA,IACnC,CAAC;AAAA,EACL,CAAC;",
|
|
6
|
-
"names": ["remove", "_a", "signal", "element", "it", "_a", "key", "value", "newInitializer", "_a", "_a", "locale", "last", "sourceA", "sourceB", "prop", "element", "_a", "_a", "locale", "locale", "_a", "value", "locale", "location", "_a", "benchmark", "_a", "element", "input", "_a", "locale", "locale", "_a", "locale", "locale", "locale", "locale", "locale", "stringify", "_a", "rules", "locale", "_a", "charsStart", "name", "c", "char", "_a", "element", "name", "last", "number", "_a", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory"]
|
|
3
|
+
"sources": ["../../../vinyl-util/src/error/ErrorOrigin.ts", "../../../vinyl-util/src/error/ReportableError.ts", "../../../vinyl-util/src/error/IllegalArgumentError.ts", "../../../vinyl-util/src/util/collection/LinkedList.ts", "../../../vinyl-util/src/event/Signal.ts", "../../../vinyl-util/src/util/map/map.ts", "../../../vinyl-util/src/util/type.ts", "../../../vinyl-util/src/logging/LogTarget.ts", "../../../vinyl-util/src/event/EventHost.ts", "../../../vinyl-util/src/util/collection/array.ts", "../../../vinyl-util/src/util/iteration/iterable.ts", "../../../vinyl-util/src/error/IllegalStateError.ts", "../../../vinyl-util/src/util/collection/LruCache.ts", "../../../vinyl-util/src/util/fun/memoize.ts", "../../../vinyl-util/src/util/string/string.ts", "../../../vinyl-util/src/util/serialization/primitives.ts", "../../../vinyl-util/src/core/disposable.ts", "../../../vinyl-util/src/global/globalRegistry.ts", "../../../vinyl-util/src/core/cloneable.ts", "../../../vinyl-util/src/util/object/object.ts", "../../../vinyl-util/src/util/serialization/json.ts", "../../../vinyl-util/src/error/ValidationError.ts", "../../../vinyl-util/src/global/environment.ts", "../../../vinyl-util/src/util/browser/searchParams.ts", "../../../vinyl-util/src/logging/getLogLevelFromSearch.ts", "../../../vinyl-util/src/logging/Logger.ts", "../../../vinyl-util/src/util/math/math.ts", "../../../vinyl-util/src/util/collection/typedArray.ts", "../../../vinyl-util/src/util/set/set.ts", "../../../vinyl-util/src/util/object/mergeDeep.ts", "../../../vinyl-util/src/util/object/clone.ts", "../../../vinyl-util/src/util/object/lazy.ts", "../../../vinyl-util/src/util/date/date.ts", "../../../vinyl-util/src/util/serialization/ParseError.ts", "../../../vinyl-util/src/util/serialization/stringifyForPrint.ts", "../../../vinyl-util/src/util/string/StringReader.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/logging/Logging.bench.ts", "../../../vinyl-mpd-parser/src/duration/duration.ts", "../../../vinyl-mpd-parser/src/error/parsingError.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/typeOfValidators.ts", "../../../vinyl-validation/src/validation/NumberSchema.ts", "../../../vinyl-validation/src/validation/validators.ts", "../../../vinyl-xml/src/xlink/actuateValidator.ts", "../../../vinyl-xml/src/xml/xmlRules.ts", "../../../vinyl-xml/src/xml/mappedXmlRules.ts", "../../../vinyl-xml/src/xml/mergeXmlRules.ts", "../../../vinyl-xml/src/xml/parseXml.ts", "../../../vinyl-xml/src/xml/XmlSchemaError.ts", "../../../vinyl-xml/src/xml/ParseXmlHandlerImpl.ts", "../../../vinyl-mpd-parser/src/media/byteRange.ts", "../../../vinyl-mpd-parser/src/media/ratio.ts", "../../../vinyl-mpd-parser/src/media/frameRate.ts", "../../../vinyl-mpd-parser/src/manifest/dashManifestXmlRules.ts", "../../../vinyl-mpd-parser/src/xmlns/mpeg/cenc/2013.ts", "../../../vinyl-mpd-parser/src/manifest/ext/drm/cencXmlRules.ts", "../../../vinyl-mpd-parser/src/manifest/ext/drm/contentProtection.ts", "../../../vinyl-mpd-parser/src/xmlns/microsoft/playready.ts", "../../../vinyl-mpd-parser/src/manifest/ext/drm/playreadyXmlRules.ts", "../../../vinyl-mpd-parser/src/manifest/dashParser.ts", "../../test/vinylTestUtil/assets/dash_segmentListMediaRange.ts", "../../src/text/parseWebVtt.ts", "../../test/vinylTestUtil/player/mediaRef.ts", "../../test/vinylTestUtil/media/FrequencyAnalyzer.ts", "../../../vinyl-util/test/testUtil/mock/logging/MockLogger.ts", "../../../vinyl-util/test/testUtil/mock/network/emptyRequestInfo.ts", "../../../vinyl-util/test/testUtil/mock/network/MockNetworkMetricsController.ts", "../../../vinyl-util/test/testUtil/mock/network/MockNetworkState.ts", "../../../vinyl-util/test/testUtil/mock/network/MockRequester.ts", "../../../vinyl-util/test/testUtil/reporters/LogReporter.ts", "../../test/vinylTestUtil/mock/ad/MockAdController.ts", "../../test/vinylTestUtil/mock/client/MockCapabilities.ts", "../../test/vinylTestUtil/mock/dash/mockDashManifest.ts", "../../test/vinylTestUtil/mock/dash/MockDashManifestController.ts", "../../test/vinylTestUtil/mock/dom/ms/MockMSMediaKeys.ts", "../../test/vinylTestUtil/mock/dom/ms/MockMSMediaKeySession.ts", "../../test/vinylTestUtil/mock/dom/webkit/MockWebKitMediaKeys.ts", "../../test/vinylTestUtil/mock/dom/webkit/MockWebKitMediaKeySession.ts", "../../test/vinylTestUtil/mock/drm/MockCommonEme.ts", "../../test/vinylTestUtil/mock/drm/MockCommonMediaKeys.ts", "../../test/vinylTestUtil/mock/drm/MockCommonMediaKeySession.ts", "../../test/vinylTestUtil/mock/drm/MockCommonMediaKeySystemAccess.ts", "../../test/vinylTestUtil/mock/drm/MockDrmController.ts", "../../test/vinylTestUtil/mock/hls/MockHlsManifestController.ts", "../../test/vinylTestUtil/mock/logging/MockHistoryLogHandler.ts", "../../test/vinylTestUtil/mock/playback/MockLoudnessNormalizationController.ts", "../../test/vinylTestUtil/mock/playback/MockPlaybackController.ts", "../../test/vinylTestUtil/mock/playback/MockPlaybackSource.ts", "../../test/vinylTestUtil/mock/track/MockTrackController.ts", "../../test/vinylTestUtil/mock/streaming/buffering/MockMediaSourceController.ts", "../../test/vinylTestUtil/mock/streaming/MockContentStream.ts", "../../test/vinylTestUtil/mock/text/MockTextTrackController.ts", "../../test/vinylTestUtil/mock/track/dash/createMockDashDependencies.ts", "../../test/vinylTestUtil/mock/track/MockAutoResetController.ts", "../../test/vinylTestUtil/mock/streaming/abr/MockQualitySelector.ts", "../../test/vinylTestUtil/mock/streaming/buffering/MockBufferingController.ts", "../../test/vinylTestUtil/mock/streaming/buffering/MockSourceBufferController.ts", "../../test/vinylTestUtil/mock/streaming/MockSegmentController.ts", "../../test/vinylTestUtil/mock/track/hls/createMockHlsDependencies.ts", "../../test/vinylTestUtil/mock/track/MockTrack.ts", "../../test/benchmark/manifest/dash/parseDashManifest.bench.ts", "../../test/benchmark/text/sampleVtt.ts", "../../test/benchmark/text/parseWebVtt.bench.ts", "../../test/benchmark/util/collection/LinkedList.bench.ts", "../../test/benchmark/util/object/mergeDeep.bench.ts", "../../test/benchmark/util/serialization/toJson.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 * A doubly-linked node.\n *\n * If a node is to move from one list to another, it must be removed first.\n */\nexport interface LinkedNode<T> {\n previous: LinkedNode<T> | null\n value: T\n removed: boolean\n next: LinkedNode<T> | null\n}\n\n/**\n * A standard doubly-linked list implementation.\n */\nexport class LinkedList<T> implements Iterable<T> {\n private _head: LinkedNode<T> | null = null\n private _tail: LinkedNode<T> | null = null\n\n /**\n * Returns the current head.\n */\n get head(): LinkedNode<T> | null {\n return this._head\n }\n\n /**\n * Returns the current tail.\n */\n get tail(): LinkedNode<T> | null {\n return this._tail\n }\n\n /**\n * Returns true if the list is empty.\n */\n get empty(): boolean {\n return this._head === null\n }\n\n /**\n * Creates a new node for the given value, adding it to the end of the list.\n *\n * @param value\n * @return Returns the newly created node.\n */\n push(value: T): LinkedNode<T> {\n const node: LinkedNode<T> = {\n previous: this._tail,\n value,\n removed: false,\n next: null,\n }\n this.pushNode(node)\n return node\n }\n\n /**\n * Appends all given values to the end of this list.\n *\n * @param values\n */\n pushAll(...values: T[]) {\n for (const value of values) {\n this.push(value)\n }\n }\n\n /**\n * Appends the given node to the tail of this list.\n * If the node is already at the tail, it will no-op.\n * If the node is in this list, it will be removed.\n *\n * @param node The node to add or move to the tail of this list.\n */\n pushNode(node: LinkedNode<T>) {\n if (this._tail === node) return\n this.remove(node)\n node.removed = false\n node.next = null\n node.previous = this._tail\n if (this._tail) this._tail.next = node\n this._tail = node\n if (!this._head) this._head = node\n }\n\n /**\n * Removes the last node (the tail), returning it.\n * If this list is empty, null is returned.\n */\n pop(): LinkedNode<T> | null {\n const node = this._tail\n if (!node) return null\n this.remove(node)\n return node\n }\n\n /**\n * Creates a new node, adding it to the front of the list.\n *\n * @param value The value to box in a linked node.\n * @return Returns the new node.\n */\n unshift(value: T): LinkedNode<T> {\n const node: LinkedNode<T> = {\n previous: null,\n value,\n removed: true,\n next: this._head,\n }\n this.unshiftNode(node)\n return node\n }\n\n /**\n * Prepends all the given values to the head of this list.\n * The values will maintain their order.\n *\n * E.g.\n * ```\n * list.unshiftAll(8, 9, 10) // 8, 9, 10\n * list.unshiftAll(4, 5, 6, 7) // 4, 5, 6, 7, 8, 9, 10\n * list.unshiftAll(1, 2, 3) // 1, 2, 3, 4, 5, 6, 7, 8, 9, 10\n * ```\n *\n * @param values The values to box in linked nodes.\n */\n unshiftAll(...values: T[]) {\n for (let i = values.length - 1; i >= 0; i--) {\n this.unshift(values[i])\n }\n }\n\n /**\n * Prepends the given node to the head of this list.\n * - If the node is already at the head, it will no-op.\n * - If the node is in this list, it will be removed.\n *\n * @param node The node to add or move to the head of this list.\n */\n unshiftNode(node: LinkedNode<T>) {\n if (this._head === node) return\n this.remove(node)\n node.removed = false\n node.previous = null\n node.next = this._head\n if (this._head) this._head.previous = node\n this._head = node\n if (!this._tail) this._tail = node\n }\n\n /**\n * Removes the first node (the head), returning it.\n * - If this list is empty, null is returned.\n */\n shift(): LinkedNode<T> | null {\n const node = this._head\n if (!node) return null\n this.remove(node)\n return node\n }\n\n /**\n * Removes the given linked node.\n *\n * @param node\n */\n remove(node: LinkedNode<T>): void {\n if (node.removed) return\n node.removed = true\n if (node.previous) node.previous.next = node.next\n if (node.next) node.next.previous = node.previous\n if (this._head === node) this._head = node.next\n if (this._tail === node) this._tail = node.previous\n }\n\n /**\n * Inserts the given node before pointer node.\n *\n * @param node The node to insert before pointer. If this node is currently in this list, it\n * will first be removed.\n * @param pointer The pointer node.\n */\n insertNodeBefore(node: LinkedNode<T>, pointer: LinkedNode<T>) {\n if (!node.removed && node.next === pointer) return\n this.remove(node)\n node.removed = false\n if (pointer.previous) {\n pointer.previous.next = node\n node.previous = pointer.previous\n } else {\n this._head = node\n node.previous = null\n }\n node.next = pointer\n pointer.previous = node\n }\n\n /**\n * Inserts the given node after pointer node.\n *\n * @param node The node to insert after pointer. If this node is currently in this list, it\n * will first be removed.\n * @param pointer The pointer node.\n */\n insertNodeAfter(node: LinkedNode<T>, pointer: LinkedNode<T>) {\n if (!node.removed && node.previous === pointer) return\n this.remove(node)\n node.removed = false\n if (pointer.next) {\n pointer.next.previous = node\n node.next = pointer.next\n } else {\n this._tail = node\n node.next = null\n }\n node.previous = pointer\n pointer.next = node\n }\n\n /**\n * Iterates over every element, invoking the given callback.\n *\n * @param callback\n */\n forEach(callback: (element: T) => void): void {\n let current: LinkedNode<T> | null = this._head\n while (current) {\n if (!current.removed) callback(current.value)\n current = current.next\n }\n }\n\n /**\n * Similar to `Array.prototype.some`, returns true if at least one element passes the given\n * predicate.\n *\n * @param predicate\n */\n some(predicate: (element: T) => boolean): boolean {\n let current: LinkedNode<T> | null = this._head\n while (current) {\n if (!current.removed && predicate(current.value)) return true\n current = current.next\n }\n return false\n }\n\n /**\n * Returns the first node matching the given predicate.\n *\n * @param predicate A function where, when true is returned, returns the current node.\n */\n find(predicate: (element: T) => boolean): LinkedNode<T> | null {\n let current: LinkedNode<T> | null = this._head\n while (current) {\n if (!current.removed && predicate(current.value)) return current\n current = current.next\n }\n return null\n }\n\n /**\n * Returns the last node matching the given predicate.\n *\n * @param predicate A function where, when true is returned, returns the current node.\n */\n findLast(predicate: (element: T) => boolean): LinkedNode<T> | null {\n let current: LinkedNode<T> | null = this._tail\n while (current) {\n if (!current.removed && predicate(current.value)) return current\n current = current.previous\n }\n return null\n }\n\n /**\n * Clears this list.\n */\n clear(): void {\n let current = this._head\n while (current != null) {\n const next = current.next\n current.removed = true\n current = next\n }\n this._head = null\n this._tail = null\n }\n\n /**\n * Returns a new iterator, starting at the head.\n */\n [Symbol.iterator](): IterableIterator<T> {\n return this.createIterator(this._head, null, (node) => node.next)\n }\n\n /**\n * Returns a new reversed iterable where the iterator starts at the tail, moving backwards\n * to the head.\n */\n reversed(): IterableIterator<T> {\n return this.createIterator(this._tail, null, (node) => node.previous)\n }\n\n /**\n * Creates an iterable iterator, starting at the specified node, getting the next node from\n * the next() function.\n *\n * Note that using iterators is not as performant as {@link some} or {@link forEach}\n *\n * @param start The starting node. (inclusive)\n * @param end The ending node (exclusive).\n * @param next A method that is given the current node, and returns the next node.\n */\n createIterator(\n start: LinkedNode<T> | null,\n end: LinkedNode<T> | null,\n next: (current: LinkedNode<T>) => LinkedNode<T> | null\n ): IterableIterator<T> {\n let current: LinkedNode<T> | null = start\n return {\n [Symbol.iterator](): IterableIterator<T> {\n return this\n },\n\n next: (): IteratorResult<T> => {\n if (current === end || !current) {\n return {\n value: undefined,\n done: true,\n }\n }\n\n const result = {\n value: current.value,\n done: false,\n }\n current = next(current)\n while (current?.removed) {\n current = next(current)\n }\n return result\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 type { Disposable } from '../core/disposable'\nimport type { Unsubscribe } from '../core/Unsubscribe'\nimport { LinkedList } from '../util/collection/LinkedList'\n\nexport type EventHandler<in T> = (event: T) => void\n\nexport interface SignalOptions {\n /**\n * If true, removes the handler after the first invocation.\n */\n once?: boolean\n}\n\nexport interface Signal<T> {\n /**\n * Returns true if this signal has no handlers.\n */\n readonly empty: boolean\n\n /**\n * Adds an event handler that will be invoked upon signal dispatch.\n *\n * @param handler The handler to invoke on signal dispatch.\n * @param options Options for changing listening behavior.\n * @return Unsubscribe - Returns a method where, when invoked, will remove the handler.\n * If the handler has already been removed, Unsubscribe will do nothing.\n */\n listen(handler: EventHandler<T>, options?: SignalOptions): Unsubscribe\n}\n\n/**\n * An object that may dispatch one type of event and have handlers for that event.\n */\nexport class SignalImpl<T> implements Signal<T>, Disposable {\n private handlers = new LinkedList<EventHandler<any>>()\n\n get empty(): boolean {\n return this.handlers.empty\n }\n\n listen(handler: EventHandler<T>, options?: SignalOptions): Unsubscribe {\n const remove = () => this.handlers.remove(node)\n const node = this.handlers.push(\n options?.once\n ? (event) => {\n remove()\n handler(event)\n }\n : handler\n )\n return remove\n }\n\n /**\n * Invokes all handlers, providing the given event.\n *\n * Handlers may add/remove callbacks or do a nested dispatch.\n *\n * If a handler is added within a handler, the new handler will not be invoked until the\n * next dispatch.\n *\n * @param event\n */\n dispatch(event: T): void {\n const handlers = this.handlers\n const tail = handlers.tail\n handlers.some((handler) => {\n handler(event)\n return handler === tail!.value\n })\n }\n\n /**\n * Removes all handlers.\n */\n clear(): void {\n this.handlers.clear()\n }\n\n /**\n * Same as clear.\n */\n dispose(): void {\n this.clear()\n }\n}\n\n/**\n * Constructs a new SignalImpl.\n */\nexport function signal<T>(): SignalImpl<T> {\n return new SignalImpl<T>()\n}\n\nexport const emptySignal: Signal<any> = {\n empty: true,\n\n listen(): Unsubscribe {\n return () => {}\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\n/**\n * Provides the logging prefix for all logs made by this target.\n */\nexport interface LogTarget {\n /**\n * A string prefix for all log statements made by this target.\n */\n readonly logPrefix: string\n}\n\n/**\n * A static counter for creating a locally-unique id.\n */\nlet counter = 0\n\n/**\n * Creates a unique log prefix.\n *\n * @param target Either a string or an object with a toStringTag.\n * The log prefix will append a unique counter.\n */\nexport function createLogPrefix(\n target: string | { readonly [Symbol.toStringTag]: string }\n): string {\n const name =\n typeof target === 'string' ? target : target[Symbol.toStringTag]\n return `${name}/${++counter}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Disposable } from '../core/disposable'\nimport type { EventHandler, SignalImpl, SignalOptions } from './Signal'\nimport { signal } from './Signal'\nimport type { Unsubscribe } from '../core/Unsubscribe'\nimport { getOrSet } from '../util/map/map'\nimport type { Covariant } from '../util/type'\nimport { covariant } from '../util/type'\nimport { createLogPrefix, type LogTarget } from '../logging/LogTarget'\n\nexport interface EventDispatcher<in EventMap> extends LogTarget {\n /**\n * Dispatches an event.\n *\n * @param type The key of the event within `EventMap`\n * @param event If the passed event is read-only, then it may be re-used/cached. Otherwise,\n * it should be a new event object every dispatch. If no target property is set on the event,\n * the target will be set to this host.\n */\n dispatch<K extends keyof EventMap>(type: K, event: EventMap[K]): void\n}\n\nexport interface ReadonlyEventHost<out EventMap> {\n /**\n * Adds an event handler for the given typed event.\n *\n * @param type The key representing the event type to listen for.\n * @param handler A callback to invoke when the event with the given type is dispatched.\n * @param options Options for changing listening behavior.\n * @return Returns a method, when invoked, removes the handler.\n */\n on<K extends keyof EventMap>(\n type: K,\n handler: EventHandler<EventMap[K]>,\n options?: SignalOptions\n ): Unsubscribe\n\n /**\n * Returns true if the event host has any listeners.\n */\n hasAnyListeners(): boolean\n\n /**\n * Returns true if the event host has any listeners for the given type.\n */\n hasListeners(type: keyof EventMap): boolean\n\n /**\n * Exists for EventMap type inference.\n *\n * @private\n */\n __eventMapType: Covariant<EventMap>\n}\n\n/**\n * An object that may dispatch events and have handlers for those events.\n * Similar to the DOM's `EventTarget`, this is a basic event system based on event naming.\n *\n * Some of the advantages of EventHost over EventTarget:\n * - Not all supported platforms support EventTarget construction or extension.\n * - EventTarget is designed for the DOM, with bubble and capture phases not necessary in Vinyl.\n * - Event types are strict.\n * - Events can be plain objects, no need to extend CustomEvent.\n * - Easier unsubscription and disposal; reduces the risk of memory leaks.\n *\n * EventHost supports concurrent modification, that is, handlers may be added or removed during\n * the execution of another handler.\n */\nexport interface EventHost<EventMap>\n extends ReadonlyEventHost<EventMap>, EventDispatcher<EventMap> {}\n\nexport class EventHostImpl<EventMap>\n implements EventHost<EventMap>, Disposable\n{\n get [Symbol.toStringTag](): string {\n return 'EventHostImpl'\n }\n\n readonly logPrefix = createLogPrefix(this)\n\n private readonly signals = new Map<keyof EventMap, SignalImpl<any>>()\n\n hasAnyListeners(): boolean {\n for (const value of this.signals.values()) {\n if (!value.empty) return true\n }\n return false\n }\n\n hasListeners(type: keyof EventMap): boolean {\n return this.signals.get(type)?.empty === false\n }\n\n on<K extends keyof EventMap>(\n type: K,\n handler: EventHandler<EventMap[K]>,\n options?: SignalOptions\n ): Unsubscribe {\n const sig = getOrSet(this.signals, type, () => signal<any>())\n return sig.listen(handler, options)\n }\n\n dispatch<K extends keyof EventMap>(type: K, event: EventMap[K]): void {\n this.signals.get(type)?.dispatch(event)\n }\n\n dispose(): void {\n for (const signal of this.signals.values()) signal.dispose()\n this.signals.clear()\n }\n\n __eventMapType = covariant<EventMap>()\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { type Comparator, compare } from '../comparison/compare'\nimport type { Maybe, MaybePromise, Primitive } from '../type'\nimport { IllegalArgumentError } from '../../error/IllegalArgumentError'\nimport { createTaskQueue } from '../async/TaskQueue'\n\nexport type FilterPredicateAsync<T> = (\n value: T,\n index: number,\n array: ArrayLike<T>\n) => Promise<boolean>\n\nexport type FilterPredicate<T> = (\n value: T,\n index: number,\n array: ArrayLike<T>\n) => boolean\n\n/**\n * indexOf on ArrayLike objects.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf\n */\nexport function indexOf<E>(arrayLike: ArrayLike<E>, element: E): number {\n return Array.prototype.indexOf.call(arrayLike, element)\n}\n\n/**\n * lastIndexOf on ArrayLike objects.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf\n */\nexport function lastIndexOf<E>(arrayLike: ArrayLike<E>, element: E): number {\n return Array.prototype.lastIndexOf.call(arrayLike, element)\n}\n\nexport function filter<T, S extends T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, array: ArrayLike<T>) => value is S,\n thisArg?: any\n): S[]\n\nexport function filter<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, array: ArrayLike<T>) => boolean,\n thisArg?: any\n): T[]\n\n/**\n * filter on ArrayLike objects.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter\n */\nexport function filter<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, array: ArrayLike<T>) => boolean,\n thisArg?: any\n): T[] {\n return Array.prototype.filter.call(arrayLike, predicate, thisArg)\n}\n\n/**\n * Filter an ArrayLike with an asynchronous predicate.\n *\n * Runs the predicate across all elements, then filters the elements by the booleans\n * resolved by the predicate.\n *\n * @param arrayLike The array-like object to filter\n * @param predicate Async function that tests each element\n * @param options Optional configuration object\n * @param options.simultaneous Maximum number of predicates to run simultaneously (default: 1)\n */\nexport async function filterAsync<T>(\n arrayLike: MaybePromise<ArrayLike<T>>,\n predicate: (\n value: T,\n index: number,\n array: ArrayLike<T>\n ) => Promise<boolean>,\n options?: { readonly simultaneous?: number }\n): Promise<T[]> {\n const results = await mapAsync(arrayLike, predicate, options)\n return filter(await arrayLike, (_, index) => results[index])\n}\n\n/**\n * map on ArrayLike objects.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map\n */\nexport function map<T, U>(\n arrayLike: ArrayLike<T>,\n transform: (value: T, index: number, array: ArrayLike<T>) => U,\n thisArg?: any\n): U[] {\n return Array.prototype.map.call(arrayLike, transform, thisArg) as U[]\n}\n\n/**\n * Map on ArrayLike objects with an asynchronous transformer.\n *\n * @param arrayLike The array-like object to transform\n * @param transform Async function that transforms each element\n * @param options Optional configuration object\n * @param options.simultaneous Maximum number of transforms to run simultaneously (default: 1)\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map\n */\nexport async function mapAsync<T, U>(\n arrayLike: MaybePromise<ArrayLike<T>>,\n transform: (value: T, index: number, array: ArrayLike<T>) => Promise<U>,\n options?: { readonly simultaneous?: number }\n): Promise<U[]> {\n const resolvedArray = await arrayLike\n const { simultaneous = 1 } = options || {}\n\n if (simultaneous >= resolvedArray.length) {\n return Promise.all(map(resolvedArray, transform))\n }\n\n const results: U[] = new Array(resolvedArray.length)\n const queue = createTaskQueue()\n queue.simultaneous = simultaneous\n\n const tasks = map(resolvedArray, (value, index) =>\n queue.enqueue(() =>\n transform(value, index, resolvedArray).then((result) => {\n results[index] = result\n })\n )\n )\n\n await Promise.all(tasks)\n return results\n}\n\n/**\n * Determines whether all the members of an array satisfy the specified test.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every\n */\nexport function every<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, array: ArrayLike<T>) => boolean,\n thisArg?: any\n): boolean {\n return Array.prototype.every.call(arrayLike, predicate, thisArg)\n}\n\n/**\n * Determines whether any the members of an array satisfy the specified test.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some\n */\nexport function some<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, array: ArrayLike<T>) => boolean,\n thisArg?: any\n): boolean {\n return Array.prototype.some.call(arrayLike, predicate, thisArg)\n}\n\n/**\n * Determines whether all the members of an array satisfy the specified asynchronous test.\n *\n * @param arrayLike The array-like object to test\n * @param predicate Async function that tests each element\n * @param options Optional configuration object\n * @param options.simultaneous Maximum number of predicates to run simultaneously (default: 1)\n */\nexport async function everyAsync<T>(\n arrayLike: MaybePromise<ArrayLike<T>>,\n predicate: (\n value: T,\n index: number,\n array: ArrayLike<T>\n ) => Promise<boolean>,\n options?: { readonly simultaneous?: number }\n): Promise<boolean> {\n const resolvedArray = await arrayLike\n\n const chunks = chunk(resolvedArray, options?.simultaneous ?? 1)\n let index = 0\n\n for (const chunkArray of chunks) {\n const chunkPromises = chunkArray.map((value, chunkIndex) =>\n predicate(value, index + chunkIndex, resolvedArray)\n )\n const chunkResults = await Promise.all(chunkPromises)\n if (chunkResults.some((result) => !result)) {\n return false\n }\n index += chunkArray.length\n }\n return true\n}\n\n/**\n * Determines whether any the members of an array satisfy the specified asynchronous test.\n *\n * @param arrayLike The array-like object to test\n * @param predicate Async function that tests each element\n * @param options Optional configuration object\n * @param options.simultaneous Maximum number of predicates to run simultaneously (default: 1)\n */\nexport async function someAsync<T>(\n arrayLike: MaybePromise<ArrayLike<T>>,\n predicate: (\n value: T,\n index: number,\n array: ArrayLike<T>\n ) => Promise<boolean>,\n options?: { readonly simultaneous?: number }\n): Promise<boolean> {\n return !(await everyAsync(\n arrayLike,\n async (value, index, array) => !(await predicate(value, index, array)),\n options\n ))\n}\n\n/**\n * forEach on ArrayLike objects.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach\n */\nexport function forEach<T>(\n arrayLike: ArrayLike<T>,\n action: (value: T, index: number, array: ArrayLike<T>) => void,\n thisArg?: any\n): void {\n return Array.prototype.forEach.call(arrayLike, action, thisArg)\n}\n\n/**\n * Executes an asynchronous function on each element in an array.\n *\n * @param arrayLike The array-like object to iterate over\n * @param executor Async function to execute for each element\n * @param options Optional configuration object\n * @param options.simultaneous Maximum number of executors to run simultaneously (default: 1)\n */\nexport function forEachAsync<T>(\n arrayLike: MaybePromise<ArrayLike<T>>,\n executor: (value: T, index: number, array: ArrayLike<T>) => Promise<void>,\n options?: { readonly simultaneous?: number }\n): Promise<void> {\n return mapAsync(arrayLike, executor, options).then()\n}\n\nexport function find<T, S extends T>(\n arrayLike: ArrayLike<T>,\n predicate: (this: void, value: T, index: number, obj: T[]) => value is S,\n thisArg?: any\n): S | undefined\n\nexport function find<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, obj: T[]) => boolean,\n thisArg?: any\n): T | undefined\n\n/**\n * find on ArrayLike objects\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find\n */\nexport function find<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, obj: T[]) => boolean,\n thisArg?: any\n): T | undefined {\n return Array.prototype.find.call(arrayLike, predicate, thisArg)\n}\n\n/**\n * findIndex on ArrayLike objects\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex\n */\nexport function findIndex<T>(\n arrayLike: ArrayLike<T>,\n predicate: (value: T, index: number, obj: ArrayLike<T>) => unknown,\n thisArg?: any\n): number {\n return Array.prototype.findIndex.call(arrayLike, predicate, thisArg)\n}\n\n/**\n * Returns the first element of an ArrayLike.\n */\nexport function first<T>(arrayLike: Maybe<ArrayLike<T>>): T | undefined {\n if (!arrayLike) return undefined\n return arrayLike[0]\n}\n\n/**\n * Returns the last element of an ArrayLike.\n */\nexport function last<T>(arrayLike: Maybe<ArrayLike<T>>): T | undefined {\n if (!arrayLike) return undefined\n return arrayLike[arrayLike.length - 1]\n}\n\n/**\n * Returns the first `count` elements of an ArrayLike.\n * @param arrayLike\n * @param count\n */\nexport function takeFirst<T>(arrayLike: ArrayLike<T>, count: number): T[] {\n if (count <= 0) return []\n return Array.prototype.slice.call(arrayLike, 0, count)\n}\n\n/**\n * Returns the last `count` elements of an ArrayLike.\n *\n * @param arrayLike\n * @param count\n */\nexport function takeLast<T>(arrayLike: ArrayLike<T>, count: number): T[] {\n if (count <= 0) return []\n return Array.prototype.slice.call(arrayLike, -count)\n}\n\n/**\n * Returns a subsection of an array-like.\n * For both start and end, a negative index can be used to indicate an offset from the end of\n * the array.\n * For example, -2 refers to the second to last element of the array.\n *\n * @param arrayLike An ArrayLike to copy.\n * @param start The beginning index of the array-like. Default: 0\n * @param end The end index of the specified portion of the array-like (exclusive). Default: length\n */\nexport function slice<T>(\n arrayLike: ArrayLike<T>,\n start?: number,\n end?: number\n): T[] {\n return Array.prototype.slice.call(arrayLike, start, end)\n}\n\n/**\n * Removes an element from the array, returning true if it was found.\n */\nexport function remove<T>(array: T[], element: T): boolean {\n const index = array.indexOf(element)\n if (index === -1) return false\n array.splice(index, 1)\n return true\n}\n\n/**\n * Removes an element from the array at the given index, returning the removed element if the index\n * was within range.\n * @param array The Array to update.\n * @param index If negative, will remove from the end of the list (-1 is last element), if\n * greater than or equal to the list length, undefined will be returned.\n */\nexport function removeAt<T>(array: T[], index: number): T | undefined {\n return array.splice(index, 1)[0]\n}\n\n/**\n * Returns the index of the first element in the given array with the highest value according to\n * the comparator.\n * @param array\n * @param comparator\n */\nexport function indexOfHighest<T>(\n array: ArrayLike<T>,\n comparator: Comparator<T>\n): number {\n if (array.length === 0) return -1\n let highestIndex = 0\n let highest = array[highestIndex]\n for (let i = 1; i < array.length; i++) {\n const current = array[i]\n if (comparator(current, highest) > 0) {\n highest = current\n highestIndex = i\n }\n }\n return highestIndex\n}\n\n/**\n * Returns the index of the last element in the given array with the highest value according to\n * the comparator.\n * To find the index of the lowest value, use `util.comparator.reversed`\n * @param array\n * @param comparator\n */\nexport function lastIndexOfHighest<T>(\n array: ArrayLike<T>,\n comparator: Comparator<T>\n): number {\n if (array.length === 0) return -1\n let highestIndex = array.length - 1\n let highest = array[highestIndex]\n for (let i = array.length - 2; i >= 0; i--) {\n const current = array[i]\n if (comparator(current, highest) > 0) {\n highest = current\n highestIndex = i\n }\n }\n return highestIndex\n}\n\n/**\n * Given an array using the given comparator function, finds the insertion index of an element.\n *\n * @param array An array sorted using the comparator.\n * @param element The element to compare against array elements.\n * @param comparator A function where given the return value of `comparator(element, array[i])`\n * if less than zero the returned index will be before i, otherwise after.\n * @param start The starting index (inclusive). Default: 0\n * @param end The ending index (exclusive). Default: array.length\n */\nexport function sortedInsertionIndex<T, U = T>(\n array: ArrayLike<T>,\n element: U,\n comparator: Comparator<U, T>,\n start = 0,\n end = array.length\n): number {\n let indexA = start\n let indexB = end\n while (indexA < indexB) {\n const midIndex = (indexA + indexB) >>> 1\n const comparison = comparator(element, array[midIndex])\n if (comparison < 0) {\n indexB = midIndex\n } else {\n indexA = midIndex + 1\n }\n }\n return indexA\n}\n\n/**\n * Creates an iterator for an ArrayLike.\n * If the given ArrayLike is iterable, then use its provided iterator.\n *\n * @param arrayLike\n */\nexport function createArrayLikeIterator<T>(\n arrayLike: ArrayLike<T>\n): IterableIterator<T> {\n if (Symbol.iterator in arrayLike)\n return (arrayLike as Iterable<T>)[\n Symbol.iterator\n ]() as IterableIterator<T>\n\n let currentIndex = 0\n return {\n [Symbol.iterator](): IterableIterator<T> {\n return createArrayLikeIterator(arrayLike)\n },\n\n next: (): IteratorResult<T> => {\n if (currentIndex >= arrayLike.length) {\n return {\n value: undefined,\n done: true,\n }\n }\n return {\n value: arrayLike[currentIndex++],\n done: false,\n }\n },\n }\n}\n\n/**\n * Gets the element in the ArrayLike at the given index, or throws an IllegalArgumentError if out of range.\n */\nexport function getElementAt<T>(array: ArrayLike<T>, index: number): T {\n const n = array.length\n if (index >= 0 && index < n) {\n return array[index]\n }\n throw new IllegalArgumentError(`index ${index} is out of range 0-${n}`)\n}\n\n/**\n * Gets the element in the ArrayLike at the given index, or returns the provided default value.\n */\nexport function getElementOrDefault<T, V>(\n array: ArrayLike<T>,\n index: number,\n defaultValue: V\n): T | V {\n const n = array.length\n if (index >= 0 && index < n) {\n return array[index]\n }\n return defaultValue\n}\n\n/**\n * Counts the number of elements in an array that return true when passed to a predicate function.\n *\n * @param array\n * @param predicate\n */\nexport function countElements<T>(\n array: ArrayLike<T>,\n predicate: (value: T, index: number, obj: ArrayLike<T>) => boolean\n): number {\n let count = 0\n const n = array.length\n for (let i = 0; i < n; i++) {\n if (predicate(array[i], i, array)) {\n count++\n }\n }\n return count\n}\n\n/**\n * Splits an array into chunks of the specified size.\n *\n * @param array The array to chunk\n * @param chunkSize Maximum size of each chunk\n * @returns Array of chunks\n */\nexport function chunk<T>(array: ArrayLike<T>, chunkSize: number): T[][] {\n const chunks: T[][] = []\n for (let i = 0; i < array.length; i += chunkSize) {\n chunks.push(slice(array, i, i + chunkSize))\n }\n return chunks\n}\n\nexport function min<T extends Exclude<Primitive, symbol>>(\n arrayLike: ArrayLike<T>\n): T | undefined\nexport function min<T>(\n arrayLike: ArrayLike<T>,\n comparator: Comparator<T>\n): T | undefined\n\n/**\n * Finds the minimum value in an array of comparable elements.\n * @param arrayLike The array-like object to search\n * @param comparator Optional comparator function\n */\nexport function min<T>(\n arrayLike: ArrayLike<T>,\n comparator?: Comparator<T>\n): T | undefined {\n if (arrayLike.length === 0) return undefined\n\n let minValue = arrayLike[0]\n if (!comparator) comparator = compare as Comparator<T>\n for (let i = 1; i < arrayLike.length; i++) {\n if (comparator(arrayLike[i], minValue) < 0) {\n minValue = arrayLike[i]\n }\n }\n return minValue\n}\n\nexport function max<T extends Exclude<Primitive, symbol>>(\n arrayLike: ArrayLike<T>\n): T | undefined\nexport function max<T>(\n arrayLike: ArrayLike<T>,\n comparator: Comparator<T>\n): T | undefined\n\n/**\n * Finds the maximum value in an array of comparable elements.\n * @param arrayLike The array-like object to search\n * @param comparator Optional comparator function\n */\nexport function max<T>(\n arrayLike: ArrayLike<T>,\n comparator?: Comparator<T>\n): T | undefined {\n if (arrayLike.length === 0) return undefined\n\n let maxValue = arrayLike[0]\n if (!comparator) comparator = compare as Comparator<T>\n for (let i = 1; i < arrayLike.length; i++) {\n if (comparator(arrayLike[i], maxValue) > 0) {\n maxValue = arrayLike[i]\n }\n }\n return maxValue\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'\n\n/**\n * Returns an array of numbers between start and end, incrementing by step.\n *\n * E.g.\n * ```\n * range(1, 10) // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n * range(5, 2) // [5, 4, 3, 2]\n * range(5, 4, -0.2) // [5.0, 4.8, 4.6, 4.4, 4.2, 4.0]\n * ```\n * @param start Start position (inclusive)\n * @param endInclusive End position (inclusive)\n * @param step The amount to increment.\n */\nexport function createRangeIter(\n start: number,\n endInclusive: number,\n step = 1\n): IterableIterator<number> {\n const positive = endInclusive >= start\n if (\n (endInclusive > start && step <= 0) ||\n (endInclusive < start && step >= 0)\n ) {\n throw new IllegalArgumentError('Iterator will never complete.')\n }\n let i = start\n return {\n [Symbol.iterator](): IterableIterator<number> {\n return this\n },\n\n next: (): IteratorResult<number> => {\n const result = {\n value: i,\n done: positive ? i > endInclusive : i < endInclusive,\n }\n i += step\n return result\n },\n }\n}\n\n/**\n * Maps an iterable object using the given transform.\n * Unlike `Array#map`, this doesn't create a new Array in memory, the transform is done on\n * iteration.\n *\n * @param iterable\n * @param transform Transforms each element as it's requested.\n */\nexport function mapIter<T, U>(\n iterable: Iterable<T>,\n transform: (element: T) => U\n): IterableIterator<U> {\n const it: Iterator<T> = iterable[Symbol.iterator]()\n return {\n [Symbol.iterator](): IterableIterator<U> {\n return mapIter(iterable, transform)\n },\n next: (): IteratorResult<U> => {\n const result = it.next()\n if (result.done) return result\n return {\n value: transform(result.value),\n done: false,\n }\n },\n }\n}\n\nexport function filterIter<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T) => value is S\n): IterableIterator<S>\n\nexport function filterIter<T>(\n iterable: Iterable<T>,\n predicate: (value: T) => boolean\n): IterableIterator<T>\n\n/**\n * Filters an iterable object using the given predicate.\n * Unlike `Array#filter`, this doesn't create a new Array in memory, the filter is done on\n * iteration.\n *\n * @param iterable\n * @param predicate Returns true if the element should be included in the new iteration.\n */\nexport function filterIter<T>(\n iterable: Iterable<T>,\n predicate: (value: T) => boolean\n): IterableIterator<T> {\n const it = iterable[Symbol.iterator]()\n return {\n [Symbol.iterator](): IterableIterator<T> {\n return filterIter(iterable, predicate)\n },\n\n next: (): IteratorResult<T> => {\n while (true) {\n const next = it.next()\n if (next.done) {\n return {\n value: undefined,\n done: true,\n }\n } else if (predicate(next.value)) {\n return {\n value: next.value,\n done: false,\n }\n }\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 { ReportableError } from './ReportableError'\n\n/**\n * An error indicating an unexpected state.\n */\nexport class IllegalStateError extends ReportableError {\n get [Symbol.toStringTag](): string {\n return 'IllegalStateError'\n }\n\n constructor(message: string) {\n super(message)\n Object.setPrototypeOf(this, IllegalStateError.prototype)\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 { CacheMap } from './CacheMap'\nimport { mapIter } from '../iteration/iterable'\nimport type { LinkedNode } from './LinkedList'\nimport { LinkedList } from './LinkedList'\nimport { IllegalStateError } from '../../error/IllegalStateError'\n\n/**\n * An LRU Cache implementation.\n * An LRU (Least Recently Used) Cache is a Map with a fixed capacity. When the capacity is\n * exceeded, the least recently used element will be removed.\n * An element is considered to be used when it has been retrieved via `get`, or when it's been\n * `set`.\n * Iteration does not affect ordering.\n */\nexport class LruCache<K, V> implements CacheMap<K, V> {\n /**\n * A map of the list nodes.\n *\n * @private\n */\n private cache: Map<K, LinkedNode<[K, V]>> = new Map()\n\n /**\n * Most recently used elements are at the tail, least recently used are at the head.\n * @private\n */\n private list = new LinkedList<[K, V]>()\n\n /**\n * An element is about to be removed. Should return true if the element may be evicted,\n * otherwise false.\n * If false is returned for all elements, an IllegalStateError is thrown.\n */\n onEvicting: ((element: V, key: K, list: CacheMap<K, V>) => boolean) | null =\n null\n\n /**\n * When an element is added when at capacity, the least recently used element will be removed.\n * This callback can be set to be notified with the element being evicted, which may be used\n * for disposal.\n */\n onEvict: ((element: V, key: K, list: CacheMap<K, V>) => void) | null = null\n\n private _capacity = 0\n\n constructor(initialCapacity: number) {\n this._capacity = initialCapacity\n }\n\n get capacity(): number {\n return this._capacity\n }\n\n set capacity(value: number) {\n this._capacity = value\n while (this.cache.size > this.capacity) {\n this.evictLeastRecentlyUsed()\n }\n }\n\n /**\n * @returns the number of elements in the Map.\n */\n get size(): number {\n return this.cache.size\n }\n\n /**\n * @returns boolean indicating whether an element with the specified key exists or not.\n */\n has(key: K): boolean {\n return this.cache.has(key)\n }\n\n /**\n * Returns the mapped value for the given key, and moves the element to the most recently\n * used position.\n *\n * @returns Returns the element associated with the given key, or undefined if no such\n * element exists.\n */\n get(key: K): V | undefined {\n const node = this.cache.get(key)\n if (!node) return undefined\n this.list.pushNode(node)\n return node.value[1]\n }\n\n /**\n * Adds a new element with a specified key and value to the Map. If an element with the\n * same key already exists, the element will be updated and position moved to most recently\n * used.\n */\n set(key: K, value: V): this {\n if (this.has(key)) {\n const node = this.cache.get(key)!\n node.value[1] = value\n this.list.pushNode(node)\n } else {\n const node = this.list.push([key, value])\n this.cache.set(key, node)\n if (this.cache.size > this.capacity) {\n this.evictLeastRecentlyUsed()\n }\n }\n return this\n }\n\n private evictLeastRecentlyUsed() {\n let node = this.list.head\n while (node) {\n const [key, value] = node.value\n const allowed =\n this.onEvicting?.call(null, value, key, this) ?? true\n if (allowed) break\n node = node.next\n }\n if (!node)\n throw new IllegalStateError(\n 'onEvicting returned false for all elements'\n )\n const [key, value] = node.value\n this.list.remove(node)\n this.cache.delete(node.value[0])\n this.onEvict?.call(null, value, key, this)\n }\n\n /**\n * Clears all elements from the cache.\n */\n clear(): void {\n this.list.clear()\n this.cache.clear()\n }\n\n /**\n * @returns true if an element in the Map existed and has been removed, or false if the element does not exist.\n */\n delete(key: K): boolean {\n if (!this.has(key)) return false\n const node = this.cache.get(key)!\n this.cache.delete(key)\n this.list.remove(node)\n return true\n }\n\n /**\n * Executes a provided function once per each key/value pair in the Map, in insertion order.\n *\n * @param callback A callback to invoke for every element in the cache.\n * @param thisArg Value to use as this when executing callback\n */\n forEach(\n callback: (value: V, key: K, map: this) => void,\n thisArg?: any\n ): void {\n return this.list.forEach((entry) => {\n callback.call(thisArg, entry[1], entry[0], this)\n })\n }\n\n /**\n * Returns an iterable of key, value pairs for every entry in the map.\n */\n entries(): IterableIterator<[K, V]> {\n return this[Symbol.iterator]()\n }\n\n /**\n * Returns an iterable of keys in the map. This will be ordered from least recently used to\n * most.\n */\n keys(): IterableIterator<K> {\n return mapIter(this.list, ([key]) => key)\n }\n\n /**\n * Returns an iterable of values in the map. This will be ordered from least recently used to\n * most.\n */\n values(): IterableIterator<V> {\n return mapIter(this.list, ([, value]) => value)\n }\n\n [Symbol.iterator](): IterableIterator<[K, V]> {\n return this.list[Symbol.iterator]()\n }\n\n get [Symbol.toStringTag](): string {\n return 'LruCache'\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { LruCache } from '../collection/LruCache'\nimport { getOrSet } from '../map/map'\nimport type { Fun } from '../type'\n\nexport interface MemoizedFunction {\n clear(): void\n}\n\n/**\n * Returns a wrapper function where when called, retains the return value of `inner`, returning that\n * value on consecutive calls without invoking `inner` again.\n *\n * @param inner The function to memoize results.\n * @return Returns a memoized function with a `clear` method to reset the cached value.\n */\nexport function memoize<T extends () => any>(inner: T): MemoizedFunction & T\n\n/**\n * Returns a wrapper function where when called, retains the return value of `inner`, returning that\n * value on consecutive calls without invoking `inner` again.\n *\n * @param inner The function to memoize results.\n * @param keyProvider When more than one parameter is expected, a keyProvider is required, which\n * returns a unique key given the arguments provided to the memoized function.\n * @param capacity\n * @return Returns a memoized function with a `clear` method to reset the cache.\n */\nexport function memoize<T extends Fun>(\n inner: T,\n keyProvider: (...args: Parameters<T>) => any,\n capacity?: number\n): MemoizedFunction & T\n\nexport function memoize<T extends Fun>(\n inner: T,\n keyProvider?: (...args: Parameters<T>) => any,\n capacity = 500\n): MemoizedFunction & T {\n if (!keyProvider) {\n let cached = false\n let value: ReturnType<T> | undefined = undefined\n const memoized = (): ReturnType<T> => {\n if (!cached) {\n cached = true\n value = inner()\n }\n return value as ReturnType<T>\n }\n return Object.assign(\n memoized as T,\n {\n clear: () => {\n cached = false\n value = undefined\n },\n } as const\n )\n } else if (capacity === 0) {\n const memoized = (...args: Parameters<T>): ReturnType<T> =>\n inner(...args)\n return Object.assign(\n memoized as T,\n {\n clear: () => {},\n } as const\n )\n } else if (capacity === 1) {\n let hasValue = false\n let cachedKey: any\n let cachedValue: ReturnType<T>\n const memoized = (...args: Parameters<T>): ReturnType<T> => {\n const key = keyProvider(...args)\n if (!hasValue || cachedKey !== key) {\n hasValue = true\n cachedKey = key\n cachedValue = inner(...args)\n }\n return cachedValue\n }\n return Object.assign(\n memoized as T,\n {\n clear: () => {\n hasValue = false\n },\n } as const\n )\n } else {\n const cache = new LruCache<any, ReturnType<T>>(capacity)\n const memoized = (...args: Parameters<T>): ReturnType<T> => {\n const key = keyProvider(...args)\n return getOrSet(cache, key, () => inner(...args))\n }\n return Object.assign(\n memoized as T,\n {\n clear: () => {\n cache.clear()\n },\n } as const\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 } 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 * `<Hello to y'all!>` 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 &\n * ' to '\n * > to >\n * < to <\n * \" to "\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\nimport type { Maybe } from '../type'\n\n/**\n * Returns true if the given string is 'true' or '1'\n *\n * @param str\n */\nexport function parseBoolean(str: Maybe<string>): boolean {\n return str === 'true' || str === '1'\n}\n\n/**\n * Returns the toString() value of the given object.\n *\n * @param value\n */\nexport function stringify(value: any): string {\n if (value === null) return 'null'\n if (value === undefined) return 'undefined'\n return value.toString()\n}\n\n/**\n * Parses a string into an integer.\n * If the string is nullish, empty, or is not a finite number, returns null.\n */\nexport function parseIntSafe(\n str: Maybe<string>,\n radix?: number\n): number | null {\n if (!str) return null\n const value = parseInt(str, radix)\n if (!Number.isFinite(value)) return null\n return value\n}\n\n/**\n * Parses a string into a number.\n * If the string is nullish, empty, or is not a finite number, returns null.\n */\nexport function parseFloatSafe(str: Maybe<string>): number | null {\n if (!str) return null\n const value = parseFloat(str)\n if (!Number.isFinite(value)) return null\n return value\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IllegalStateError } from '../error/IllegalStateError'\nimport type { Unsubscribe } from './Unsubscribe'\nimport type { Maybe } from '../util/type'\n\n/**\n * Any object that may be disposed.\n */\nexport interface Disposable {\n dispose(): void\n}\n\n/**\n * Returns true if the given value is disposable.\n *\n * @param value Any value. The value will be considered Disposable if it contains a method named\n * 'dispose', and that function requires zero parameters. This value will be type guarded to\n * Disposable if true is returned.\n */\nexport function isDisposable(value: any): value is Disposable {\n return (\n value != null &&\n typeof value.dispose === 'function' &&\n value.dispose.length === 0\n )\n}\n\n/**\n * Disposes all the given {@link Disposable} objects.\n *\n * @param disposables\n */\nexport function disposeAll(disposables: Iterable<Disposable>): void {\n for (const disposable of disposables) {\n disposable.dispose()\n }\n}\n\n/**\n * Returns a Disposable that invokes the given function on dispose.\n *\n * @param unsub\n */\nexport function toDisposable(unsub: () => void): Disposable {\n return { dispose: unsub }\n}\n\nexport type AddDisposable = <T extends Maybe<Disposable | Unsubscribe>>(\n disposable: T\n) => T\n\n/**\n * A Disposer disposes added disposables as a group.\n * The method members may be called without a receiver.\n */\nexport interface Disposer extends Disposable {\n readonly disposed: boolean\n readonly add: AddDisposable\n readonly dispose: () => void\n}\n\n/**\n * Creates a Disposer, an object on which {@link Disposable} instances may be added, and disposed\n * as a group.\n *\n * The method members may be called without a receiver, thus allowing destructuring.\n * Example:\n * ```\n * function create(): Disposable {\n * const { dispose, add } = disposer()\n * add(someDisposable)\n * add(anotherDisposable)\n * return {\n * dispose\n * }\n * }\n * ```\n *\n */\nexport function createDisposer(): Disposer {\n const disposables: Disposable[] = []\n let _disposed = false\n const add = <T extends Maybe<Unsubscribe | Disposable>>(\n disposableOrUnsub: T\n ): T => {\n if (_disposed) throw new DisposedError()\n if (disposableOrUnsub) {\n disposables.push(\n 'dispose' in disposableOrUnsub\n ? disposableOrUnsub\n : toDisposable(disposableOrUnsub)\n )\n }\n return disposableOrUnsub\n }\n return {\n dispose() {\n if (_disposed) throw new DisposedError()\n _disposed = true\n disposeAll(disposables)\n },\n add,\n get disposed() {\n return _disposed\n },\n }\n}\n\n/**\n * An illegal state error indicating that an object has been disposed.\n */\nexport class DisposedError extends IllegalStateError {\n get [Symbol.toStringTag](): string {\n return 'DisposedError'\n }\n\n constructor(message = 'Instance is disposed') {\n super(message)\n Object.setPrototypeOf(this, DisposedError.prototype)\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { isDisposable } from '../core/disposable'\nimport { IllegalStateError } from '../error/IllegalStateError'\nimport { remove } from '../util/collection/array'\nimport type { Maybe } from '../util/type'\n\n/**\n * Manages global initializers.\n */\nexport class GlobalRegistry {\n private registry: GlobalRef<any>[] = []\n\n /**\n * Returns the number of references currently in the registry.\n */\n get size(): number {\n return this.registry.length\n }\n\n /**\n * Registers an initializer that will be invoked during global state initialization.\n * @param initializer\n */\n register<T extends GlobalRef<any>>(initializer: T): T {\n this.registry.push(initializer)\n return initializer\n }\n\n /**\n * Removes a global ref from the registry.\n * May be called at any time.\n * @param ref\n * @return Returns true if the global ref was removed.\n */\n unregister(ref: GlobalRef<any>): boolean {\n return remove(this.registry, ref)\n }\n\n /**\n * Resets all registered initializers and sets this registry back to its pre-initialized state.\n * This is typically only done within unit tests, but may be called if all players are\n * disposed and the consumer intends to teardown global state.\n */\n reset() {\n for (const registryElement of this.registry) {\n registryElement.reset()\n }\n }\n}\n\nlet _registry: GlobalRegistry | null = null\n\n/**\n * Gets or creates the global registry instance.\n */\nexport function getGlobalRegistry(): GlobalRegistry {\n if (!_registry) _registry = new GlobalRegistry()\n return _registry\n}\n\nexport interface GlobalRef<T> {\n /**\n * True if this has been initialized.\n */\n readonly initialized: boolean\n\n /**\n * Returns the factory-produced value.\n * Throws an {@link IllegalStateError} if the global registry has not been initialized.\n */\n readonly value: T\n\n /**\n * Overrides this initializer.\n * The previous initializer will be provided as an argument for extension.\n *\n * Throws an {@link IllegalStateError} if the global registry has been initialized.\n * @return Returns this\n */\n set(newInitializer: (previousInitializer: () => T) => T): GlobalRef<T>\n\n /**\n * Resets this initializer back to its pre-initialized state.\n * If the initializer produced a disposable value, it will be disposed.\n */\n reset(): void\n\n /**\n * Initializes the global ref.\n * This is done automatically on first use of `value`, but may be initialized eagerly.\n */\n initialize(): void\n}\n\n/**\n * When set, GlobalRefImpl records a stack trace each time it is initialized,\n * so a later \"Cannot call when initialized\" error can include the stack of\n * whoever last touched the ref. Used to diagnose async leakage between specs.\n *\n * Tests opt in via setGlobalRefDebug(true).\n */\nlet globalRefDebug = false\n\nexport function setGlobalRefDebug(enabled: boolean): void {\n globalRefDebug = enabled\n}\n\nexport class GlobalRefImpl<T> implements GlobalRef<T> {\n private _value: T | undefined\n private _initialized = false\n private constructing = false\n private initializer: () => T\n private lastInitStack: Maybe<string> = null\n\n constructor(private readonly defaultInitializer: () => T) {\n this.initializer = defaultInitializer\n }\n\n get initialized(): boolean {\n return this._initialized\n }\n\n get value(): T {\n this.initialize()\n return this._value!\n }\n\n reset(): void {\n this.initializer = this.defaultInitializer\n if (!this._initialized) return\n this.assertNotConstructing()\n this._initialized = false\n this.lastInitStack = null\n if (isDisposable(this._value)) {\n this._value.dispose()\n }\n this._value = undefined\n }\n\n initialize(): void {\n if (this._initialized) return\n this.assertNotConstructing()\n this.constructing = true\n try {\n this._value = this.initializer()\n } catch (error) {\n this.constructing = false\n throw error\n }\n this.constructing = false\n this._initialized = true\n if (globalRefDebug) {\n this.lastInitStack = new Error('globalRef initialized').stack\n }\n }\n\n set(newInitializer: (previousInitializer: () => T) => T): GlobalRef<T> {\n this.assertNotInitialized()\n const overriddenInitializer = () => {\n return newInitializer(this.defaultInitializer)\n }\n this.initializer = overriddenInitializer\n return new GlobalRefOverride(\n this,\n overriddenInitializer,\n (newInitializer) => {\n this.initializer = newInitializer\n }\n )\n }\n\n private assertNotInitialized() {\n if (this._initialized) {\n const detail = this.lastInitStack\n ? `\\nLast initialized at:\\n${this.lastInitStack}`\n : ''\n throw new IllegalStateError(`Cannot call when initialized${detail}`)\n }\n }\n\n private assertNotConstructing() {\n if (this.constructing)\n throw new IllegalStateError('Cannot call during construction')\n }\n}\n\nclass GlobalRefOverride<T> implements GlobalRef<T> {\n private initializer: () => T\n\n constructor(\n private readonly original: GlobalRef<T>,\n private readonly defaultInitializer: () => T,\n private readonly setInitializer: (value: () => T) => void\n ) {\n this.initializer = defaultInitializer\n }\n\n get initialized(): boolean {\n return this.original.initialized\n }\n\n get value(): T {\n return this.original.value\n }\n\n initialize(): void {\n this.setInitializer(this.initializer)\n this.original.initialize()\n }\n\n reset(): void {\n this.initializer = this.defaultInitializer\n this.original.reset()\n this.setInitializer(this.initializer)\n }\n\n set(newInitializer: (previousInitializer: () => T) => T): GlobalRef<T> {\n const overriddenInitializer = () => {\n return newInitializer(this.defaultInitializer)\n }\n this.initializer = overriddenInitializer\n this.setInitializer(overriddenInitializer)\n return new GlobalRefOverride(\n this,\n overriddenInitializer,\n this.setInitializer\n )\n }\n}\n\n/**\n * Creates a global reference that can be lazily initialized.\n * This function is tree-shakable as it doesn't perform any side effects on import.\n *\n * @param init Factory function that creates the value\n */\nexport function globalRef<T>(init: () => T): GlobalRef<T> {\n return getGlobalRegistry().register(new GlobalRefImpl(init))\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An interface that may be implemented to provide custom clone behavior.\n */\nexport interface Cloneable<T> {\n /**\n * Produces a copy of this object.\n */\n clone(): T\n}\n\n/**\n * Returns true if the given value implements Cloneable.\n */\nexport function isCloneable<T>(value: T): value is T & Cloneable<T> {\n return (\n value != null &&\n typeof value === 'object' &&\n 'clone' in value &&\n typeof value.clone === 'function' &&\n value.clone.length === 0\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 { 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\nlet _isNode: boolean | null = null\n\n/**\n * Returns true if this is a nodejs environment.\n */\nexport function isNode(): boolean {\n if (_isNode === null) {\n _isNode =\n typeof process !== 'undefined' &&\n 'versions' in process &&\n typeof process.versions.node === 'string'\n }\n return _isNode\n}\n/**\n * Node's global setTimeout differs slightly from the browser. Use this when storing timeout ids.\n */\nexport type TimeoutId = ReturnType<typeof setTimeout>\n\n/**\n * A subset of `Location` properties available in all environments.\n */\nexport interface PartialLocation {\n readonly origin: string\n readonly search: string\n readonly href: string\n}\n\n/**\n * Returns the global `location` object, or a default with empty values\n * when `location` is not defined (e.g. Node, Web Workers).\n */\nexport function getLocation(): PartialLocation {\n return typeof location === 'object' ? location : defaultLocation\n}\n\nconst defaultLocation: PartialLocation = {\n origin: '',\n search: '',\n href: '',\n}\n\n/**\n * Node's global setInterval differs slightly from the browser. Use this when storing interval ids.\n */\nexport type IntervalId = ReturnType<typeof setInterval>\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { memoize } from '../fun/memoize'\nimport { getLocation } from '../../global/environment'\n\n/**\n * Returns a `URLSearchParams` object for the given search substring. This is memoized for the\n * last search provided.\n * @param search (Optional) The window's search substring. Defaults to `location.search`, overridden\n * only for unit tests.\n */\nexport const getSearchParams = memoize(\n (search: string = getLocationSearch()): URLSearchParams => {\n const url = new URL('about:blank')\n url.search = search\n // Uses `URL.searchParams` over `new URLSearchParams`; URLSearchParams constructor is not\n // as widely supported.\n return url.searchParams\n },\n (search: string = getLocationSearch()) => search,\n 1\n)\n\n/**\n * If the environment has a `location` object, returns the location's search. Otherwise,\n * an empty string.\n */\nexport function getLocationSearch(): string {\n return getLocation().search\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n getLocationSearch,\n getSearchParams,\n} from '../util/browser/searchParams'\nimport { LogLevel, parseLogLevel } from './Logger'\n\n/**\n * Returns the current vinyl logging level, as set by the querystring parameter: vinylLogLevel.\n * @param search\n * @param defaultLevel\n */\nexport function getLogLevelFromSearch(\n search: string = getLocationSearch(),\n defaultLevel: LogLevel = LogLevel.WARN\n): LogLevel {\n const str = getSearchParams(search).get('vinylLogLevel')\n if (!str) return defaultLevel\n return parseLogLevel(str) ?? defaultLevel\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ReadonlyEventHost } from '../event/EventHost'\nimport { EventHostImpl } from '../event/EventHost'\nimport { globalRef } from '../global/globalRegistry'\nimport { toJson } from '../util/serialization/json'\nimport type { LogTarget } from './LogTarget'\nimport { getLogLevelFromSearch } from './getLogLevelFromSearch'\n\nexport enum LogLevel {\n VERBOSE,\n DEBUG,\n INFO,\n WARN,\n ERROR,\n NONE,\n}\n\nexport interface LogEvent {\n readonly messages: any[]\n readonly target: LogTarget\n readonly level: LogLevel\n}\n\nexport interface LogEventMap {\n readonly log: LogEvent\n}\n\n/**\n * The interface for a basic logger implementation.\n */\nexport interface Logger extends ReadonlyEventHost<LogEventMap> {\n logLevel: LogLevel\n\n log(target: LogTarget, level: LogLevel, ...messages: readonly any[]): void\n}\n\nexport class LoggerImpl extends EventHostImpl<LogEventMap> implements Logger {\n get [Symbol.toStringTag](): string {\n return 'Logger'\n }\n\n constructor(public logLevel: LogLevel = LogLevel.DEBUG) {\n super()\n }\n\n log(target: LogTarget, level: LogLevel, ...messages: readonly any[]): void {\n if (level === LogLevel.NONE || level < this.logLevel) return\n this.dispatch('log', {\n level,\n messages: toJson(messages),\n target,\n })\n }\n}\n\n/**\n * A global reference to the logger.\n * @private\n */\nexport const loggerRef = globalRef<Logger>(\n () =>\n new LoggerImpl(\n // The logger is initialized to VERBOSE if vinylLogLevel=verbose is in the query string\n // Otherwise use DEBUG.\n getLogLevelFromSearch() === LogLevel.VERBOSE\n ? LogLevel.VERBOSE\n : LogLevel.DEBUG\n )\n)\n\n/**\n * Returns the current log level.\n */\nexport function getLogLevel(): LogLevel {\n return loggerRef.value.logLevel\n}\n\n/**\n * Sets the current log level.\n *\n * @param value\n */\nexport function setLogLevel(value: LogLevel): void {\n loggerRef.value.logLevel = value\n}\n\nexport function log(\n target: LogTarget,\n level: LogLevel,\n ...messages: readonly any[]\n): void {\n loggerRef.value.log(target, level, ...messages)\n}\n\nexport function logVerbose(\n target: LogTarget,\n ...messages: readonly any[]\n): void {\n loggerRef.value.log(target, LogLevel.VERBOSE, ...messages)\n}\n\nexport function logDebug(target: LogTarget, ...messages: readonly any[]): void {\n loggerRef.value.log(target, LogLevel.DEBUG, ...messages)\n}\n\nexport function logInfo(target: LogTarget, ...messages: readonly any[]): void {\n loggerRef.value.log(target, LogLevel.INFO, ...messages)\n}\n\nexport function logWarn(target: LogTarget, ...messages: readonly any[]): void {\n loggerRef.value.log(target, LogLevel.WARN, ...messages)\n}\n\nexport function logError(target: LogTarget, ...messages: readonly any[]): void {\n loggerRef.value.log(target, LogLevel.ERROR, ...messages)\n}\n\nconst strToLogLevel: Record<string, LogLevel> = {\n verbose: LogLevel.VERBOSE,\n debug: LogLevel.DEBUG,\n info: LogLevel.INFO,\n warn: LogLevel.WARN,\n error: LogLevel.ERROR,\n none: LogLevel.NONE,\n} as const\n\n/**\n * From a case-insensitive string, returns the log level.\n * Possible values match to the keys in {@link LogLevel}.\n *\n * @param str\n */\nexport function parseLogLevel(str: string): LogLevel | null {\n return strToLogLevel[str.toLowerCase()] ?? null\n}\n\nconst logLevelToString: Record<LogLevel, string> = {\n [LogLevel.VERBOSE]: 'verbose',\n [LogLevel.DEBUG]: 'debug',\n [LogLevel.INFO]: 'info',\n [LogLevel.WARN]: 'warn',\n [LogLevel.ERROR]: 'error',\n [LogLevel.NONE]: 'none',\n} as const\n\n/**\n * Returns the log level as a lowercase string.\n * E.g. stringifyLogLevel(LogLevel.DEBUG) returns 'debug'\n */\nexport function stringifyLogLevel(logLevel: LogLevel): string {\n return logLevelToString[logLevel]\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\n/**\n * Array views of a data buffer.\n */\nexport type TypedArray =\n | Float32Array\n | Float64Array\n | Int16Array\n | Int32Array\n | Int8Array\n | Uint16Array\n | Uint32Array\n | Uint8Array\n | Uint8ClampedArray\n\n/**\n * Creates a new typed array with identical contents as the source.\n *\n * @param array\n */\nexport function cloneTypedArray<T extends TypedArray>(array: T): T {\n // typed array slice() is not supported on Comcast OTT device.\n return new (array.constructor as new (array: T) => T)(array)\n}\n\nconst typedArrayTypes = [\n Float32Array,\n Float64Array,\n Int16Array,\n Int32Array,\n Int8Array,\n Uint16Array,\n Uint32Array,\n Uint8Array,\n Uint8ClampedArray,\n]\n\n/**\n * Returns true if the given value is an instance of one of the typed array types.\n *\n * @param value\n */\nexport function isTypedArray(value: any): value is TypedArray {\n return typedArrayTypes.some((type) => value instanceof type)\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 union of two sets. That is, the unique elements of A and B.\n *\n * @param a\n * @param b\n * @return Returns a new Set `A \u222A B`\n */\nexport function union<T, U>(a: ReadonlySet<T>, b: ReadonlySet<U>): Set<T | U> {\n return new Set([...a, ...b])\n}\n\n/**\n * Returns the set difference of A and B. That is, the elements of A that are not in B.\n *\n * @param a\n * @param b\n * @return Returns a new Set that is `A \\ B`\n */\nexport function diff<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): Set<T> {\n const out: Set<T> = new Set()\n a.forEach((e) => {\n if (!b.has(e)) out.add(e)\n })\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 { IllegalArgumentError } from '../../error/IllegalArgumentError'\nimport type { TypedArray } from '../collection/typedArray'\nimport { cloneTypedArray, isTypedArray } from '../collection/typedArray'\nimport { union } from '../set/set'\nimport { substitute } from '../string/string'\nimport { ownKeys, isPlainObject } from './object'\nimport { ReportableError } from '../../error/ReportableError'\nimport { type Cloneable, isCloneable } from '../../core/cloneable'\n\nconst locale = {\n cyclicRefError: 'Cyclic reference found at: {path}',\n mergeReferenceError: `No merge rule found at {path} for \"{source}\" and reference copy not allowed`,\n} as const\n\n/**\n * Concatenates multiple arrays together where each element is deeply cloned.\n */\nexport function mergeDeep<T extends Array<any>>(\n sources: readonly T[],\n options?: Partial<MergeOptions>\n): T\n\n/**\n * Deep clones the given object.\n */\nexport function mergeDeep<T>(\n sources: readonly [T],\n options?: Partial<MergeOptions>\n): T\n\n/**\n * Deep merges the two objects.\n * If common keys are both arrays, they will be concatenated, if common keys are both objects, they\n * will be merged. Incompatible types, e.g. an object and an array will use the later source.\n */\nexport function mergeDeep<A, B>(\n sources: readonly [A, B],\n options?: Partial<MergeOptions>\n): A & B\n\n/**\n * Deep merges the three objects.\n * If common keys are both arrays, they will be concatenated, if common keys are both objects, they\n * will be merged. Incompatible types, e.g. an object and an array will use the later source.\n */\nexport function mergeDeep<A, B, C>(\n sources: readonly [A, B, C],\n options?: Partial<MergeOptions>\n): A & B & C\n\n/**\n * Deep merges the four objects.\n * If common keys are both arrays, they will be concatenated, if common keys are both objects, they\n * will be merged. Incompatible types, e.g. an object and an array will use the later source.\n */\nexport function mergeDeep<A, B, C, D>(\n sources: readonly [A, B, C, D],\n options?: Partial<MergeOptions>\n): A & B & C & D\n\n/**\n * Deep merges the five objects.\n * If common keys are both arrays, they will be concatenated, if common keys are both objects, they\n * will be merged. Incompatible types, e.g. an object and an array will use the later source.\n */\nexport function mergeDeep<A, B, C, D, E>(\n sources: readonly [A, B, C, D, E],\n options?: Partial<MergeOptions>\n): A & B & C & D & E\n\n/**\n * Deep merges the six objects.\n * If common keys are both arrays, they will be concatenated, if common keys are both objects, they\n * will be merged. Incompatible types, e.g. an object and an array will use the later source.\n */\nexport function mergeDeep<A, B, C, D, E, F>(\n sources: readonly [A, B, C, D, E, F],\n options?: Partial<MergeOptions>\n): A & B & C & D & E & F\n\n/**\n * Deep merges all objects.\n * If common keys are both arrays, they will be concatenated, if common keys are both objects, they\n * will be merged. Incompatible types, e.g. an object and an array will use the later source.\n */\nexport function mergeDeep(\n sources: readonly any[],\n options?: Partial<MergeOptions>\n): any\n\n/**\n * Recursively copies the values of all the enumerable own properties from one or two source\n * objects to a new object.\n * Arrays will be concatenated.\n *\n * @param sources One or more source objects from which to copy properties. A single source\n * provided will return a deep clone. Incompatible objects, for example given a number and an\n * array, will return a clone of the last argument.\n * @param options\n * @see merge\n */\nexport function mergeDeep(\n sources: readonly any[],\n options?: Partial<MergeOptions>\n): any {\n if (!sources.length) return undefined\n const finalOpts: MergeOptions = {\n ...defaultMergeOptions,\n ...options,\n }\n const stack = new PropStack()\n const n = sources.length\n\n if (n === 1)\n // Clone the single element.\n return _mergeDeep(undefined, sources[0], stack, 0, finalOpts)\n // Initial accumulator:\n let out = _mergeDeep(sources[0], sources[1], stack, 1, finalOpts)\n for (let i = 2; i < n; i++) {\n out = _mergeDeep(out, sources[i], stack, i, finalOpts)\n }\n return out\n}\n\n/**\n * Merge options defines the behavior for {@link mergeDeep}.\n * See the {@link defaultMergeOptions} for defaults that will be used if any merge options are\n * omitted.\n */\nexport interface MergeOptions {\n /**\n * If an object does not pass any of the rules, if this is true (default) the reference will be\n * copied. If false, a {@link MergeReferenceError} will be thrown.\n * This only applies to objects, not functions or primitives.\n */\n readonly allowReferenceCopy: boolean\n\n /**\n * The first merge rule where the second source object matches will be used.\n * Rules are only checked for values that have a typeof value of 'object'\n * If the first object does not pass the match, undefined will be passed to sourceA and the\n * rule is expected to return a clone of sourceB.\n * If no rules match, the value will be copied by reference unless `allowReferenceCopy` is\n * false, in which case, a {@link MergeReferenceError} will be thrown.\n */\n readonly rules: readonly MergeRule<any>[]\n}\n\n/**\n * A merge function to be provided to merge rules.\n */\nexport type MergeCallback<T = any> = (\n /**\n * The first like object to merge, or undefined. If undefined is provided, a\n * clone of sourceB is expected to be returned. If defined, this object is guaranteed to have\n * passed {@link MergeRule.matches}\n */\n sourceA: T | undefined,\n\n /**\n * The second object to merge or clone.\n */\n sourceB: T,\n\n /**\n * The identifier to be used in error reporting.\n */\n prop: string | number\n) => T\n\nexport interface MergeRule<T> {\n /**\n * Returns true if this MergeRule should be applied for the given object.\n * @param object\n */\n readonly matches: (object: any) => object is T\n\n /**\n * Merges the two sources.\n * @param sourceA May be undefined, the first object to merge.\n * @param sourceB The second object to merge or clone if sourceA is undefined.\n * @param merge This callback may be used to merge or clone sub-properties.\n */\n readonly merge: (\n sourceA: T | undefined,\n sourceB: T,\n merge: MergeCallback\n ) => T\n}\n\n/**\n * A stack of the current property recursion.\n * PropStack has two purposes, it provides the current property path in the node traversal and\n * ensures that nodes do not cyclically reference themselves.\n */\nclass PropStack {\n /**\n * Object references for sourceA.\n */\n private refsA = new Set<any>()\n\n /**\n * Object references for sourceB.\n */\n private refsB = new Set<any>()\n private propStack: [any, any, keyof any | undefined][] = []\n\n /**\n * The property stack, joined by .\n */\n get currentPath(): string {\n return this.propStack\n .map((e) => e[2])\n .filter((e) => e != null)\n .join('.')\n }\n\n push(sourceA: any, sourceB: any, prop?: keyof any) {\n this.propStack.push([sourceA, sourceB, prop])\n this.addRef(this.refsA, sourceA)\n this.addRef(this.refsB, sourceB)\n }\n\n pop() {\n const last = this.propStack.pop()!\n this.refsA.delete(last[0])\n this.refsB.delete(last[1])\n }\n\n private addRef(refSet: Set<any>, source: any) {\n if (typeof source !== 'object') return\n if (refSet.has(source)) {\n throw new IllegalArgumentError(\n substitute(locale.cyclicRefError, { path: this.currentPath })\n )\n }\n refSet.add(source)\n }\n}\n\nfunction _mergeDeep<T>(\n sourceA: T | undefined,\n sourceB: T,\n propStack: PropStack,\n prop: keyof any | undefined,\n options: MergeOptions\n): T {\n if (typeof sourceB !== 'object' || sourceB === null) return sourceB\n\n const merge: MergeCallback = (sourceA, sourceB, prop) => {\n return _mergeDeep(sourceA, sourceB, propStack, prop, options)\n }\n for (const rule of options.rules) {\n if (rule.matches(sourceB)) {\n propStack.push(sourceA, sourceB, prop)\n const result = rule.merge(\n rule.matches(sourceA) ? sourceA : undefined,\n sourceB,\n merge\n )\n propStack.pop()\n return result\n }\n }\n if (!options.allowReferenceCopy) {\n // push before throwing to get the full currentPath:\n propStack.push(sourceA, sourceB, prop)\n throw new MergeReferenceError(propStack.currentPath, sourceB)\n }\n return sourceB\n}\n\nexport class MergeReferenceError extends ReportableError {\n constructor(propPath: string, source: any) {\n super(\n substitute(locale.mergeReferenceError, {\n path: propPath,\n source,\n })\n )\n Object.setPrototypeOf(this, MergeReferenceError.prototype)\n }\n}\n\n/**\n * Cloneable objects are not expected to be mergeable, but should be cloned.\n */\nexport const cloneableMergeRule: MergeRule<Cloneable<any>> = {\n matches(object: any): object is Cloneable<any> {\n return isCloneable(object)\n },\n\n merge(\n _1: Cloneable<any> | undefined,\n sourceB: Cloneable<any>,\n _2: MergeCallback\n ): Cloneable<any> {\n return sourceB.clone()\n },\n}\n\nexport const arrayMergeRule: MergeRule<any[]> = {\n matches(object: any): object is any[] {\n return Array.isArray(object)\n },\n\n merge(\n sourceA: any[] | undefined,\n sourceB: any[],\n merge: MergeCallback\n ): any[] {\n const out = []\n if (sourceA) {\n for (const element of sourceA) {\n out.push(merge(undefined, element, out.length))\n }\n }\n for (const element of sourceB) {\n out.push(merge(undefined, element, out.length))\n }\n return out\n },\n} as const\n\nexport const plainObjectMergeRule: MergeRule<Record<any, any>> = {\n matches(object: any): object is Record<any, any> {\n return isPlainObject(object)\n },\n\n merge(\n sourceA: Record<any, any> | undefined,\n sourceB: Record<any, any>,\n merge: MergeCallback\n ): Record<any, any> {\n const out: any = {}\n // Iterate over the unique set of the union of keys between the two objects.\n for (const key of union(ownKeys(sourceA), ownKeys(sourceB))) {\n if (sourceA && key in sourceB && key in sourceA) {\n out[key] = merge(sourceA[key], sourceB[key], key)\n } else if (sourceA && key in sourceA) {\n out[key] = merge(undefined, sourceA[key], key)\n } else {\n out[key] = merge(undefined, sourceB[key], key)\n }\n }\n return out\n },\n} as const\n\nexport const regexpMergeRule: MergeRule<RegExp> = {\n matches(object: any): object is RegExp {\n return object instanceof RegExp\n },\n merge(_1: RegExp | undefined, sourceB: RegExp, _2: MergeCallback): RegExp {\n // Clone the regex; they are stateful.\n return new RegExp(sourceB.source, sourceB.flags)\n },\n} as const\n\nexport const dateMergeRule: MergeRule<Date> = {\n matches(object: any): object is Date {\n return object instanceof Date\n },\n merge(_1: Date | undefined, sourceB: Date, _2: MergeCallback): Date {\n return new Date(sourceB.getTime())\n },\n} as const\n\nexport const mapMergeRule: MergeRule<Map<any, any>> = {\n matches(object: any): object is Map<any, any> {\n return object instanceof Map\n },\n merge(\n sourceA: Map<any, any> | undefined,\n sourceB: Map<any, any>,\n merge: MergeCallback\n ): Map<any, any> {\n const out = new Map()\n // Iterate over the unique set of the union of keys between the two objects.\n for (const key of new Set([\n ...(sourceA?.keys() ?? []),\n ...sourceB.keys(),\n ])) {\n if (sourceB.has(key) && sourceA?.has(key)) {\n out.set(key, merge(sourceA.get(key), sourceB.get(key), key))\n } else if (sourceA?.has(key)) {\n out.set(key, merge(undefined, sourceA.get(key), key))\n } else {\n out.set(key, merge(undefined, sourceB.get(key), key))\n }\n }\n return out\n },\n} as const\n\nexport const setMergeRule: MergeRule<Set<any>> = {\n matches(object: any): object is Set<any> {\n return object instanceof Set\n },\n merge(\n sourceA: Set<any> | undefined,\n sourceB: Set<any>,\n merge: MergeCallback\n ): Set<any> {\n return new Set(\n [...(sourceA?.values() ?? []), ...sourceB.values()].map(\n (element, index) => {\n return merge(undefined, element, index)\n }\n )\n )\n },\n} as const\n\n/**\n * Typed arrays will not concatenate by default like arrays. Typed arrays generally represent data,\n * not configuration, and the more reasonable default is to clone, not concatenate.\n */\nexport const typedArrayMergeRule: MergeRule<TypedArray> = {\n matches(object: any): object is TypedArray {\n return isTypedArray(object)\n },\n merge(\n _1: TypedArray | undefined,\n sourceB: TypedArray,\n _2: MergeCallback\n ): TypedArray {\n return cloneTypedArray(sourceB)\n },\n} as const\n\nexport const urlMergeRule: MergeRule<URL> = {\n matches(object: any): object is URL {\n return object instanceof URL\n },\n merge(_1: URL | undefined, sourceB: URL, _2: MergeCallback): URL {\n return new URL(sourceB.toString())\n },\n} as const\n\n/**\n * The default merge options provide rules for merging arrays, plain objects, RegExp, Date,\n * Map, Set, and TypedArray.\n */\nexport const defaultMergeOptions: MergeOptions = {\n allowReferenceCopy: true,\n rules: [\n cloneableMergeRule,\n arrayMergeRule,\n plainObjectMergeRule,\n regexpMergeRule,\n dateMergeRule,\n mapMergeRule,\n setMergeRule,\n typedArrayMergeRule,\n urlMergeRule,\n ],\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { MergeCallback, MergeRule } from './mergeDeep'\nimport { defaultMergeOptions, mergeDeep } from './mergeDeep'\nimport type { MutableDeep } from './mutableType'\n\n/**\n * Merge options defines the behavior for {@link mergeDeep}.\n * See the {@link defaultMergeOptions} for defaults that will be used if any merge options are\n * omitted.\n */\nexport interface CloneOptions {\n /**\n * If an object does not pass any of the rules, if this is true the reference will be\n * copied. If false (default), a {@link MergeReferenceError} will be thrown.\n * This only applies to objects, not functions or primitives.\n */\n readonly allowReferenceCopy: boolean\n\n /**\n * The first clone rule that matches will be used.\n *\n * If no rules match, the value will be copied by reference unless `allowReferenceCopy` is\n * false (default), in which case, a {@link MergeReferenceError} will be thrown.\n */\n readonly rules: readonly CloneRule<any>[]\n}\n\n/**\n * A CloneRule defines if and how an object should be cloned.\n */\nexport interface CloneRule<T> {\n /**\n * Returns true if this MergeRule should be applied for the given object.\n * @param object\n */\n readonly matches: (object: any) => object is T\n\n /**\n * Clones the given value.\n *\n * @param source A value guaranteed to have matched with `matches`.\n * @param clone This callback may be used to clone sub-properties.\n */\n readonly clone: (source: T, clone: CloneCallback) => MutableDeep<T>\n}\n\n/**\n * A function to clone a sub-object from a clone rule.\n */\nexport type CloneCallback = <T>(\n /**\n * The source object to clone.\n */\n source: T,\n\n /**\n * The identifier to be used in error reporting.\n */\n prop: string | number\n) => MutableDeep<T>\n\n/**\n * Performs a deep clone on the target object.\n *\n * This is an alias for `mergeDeep(target)` that additionally converts clone rules to one-sided\n * merge rules.\n *\n * @param target The target object to clone.\n * @param options The merge options to use.\n * `clone`, unlike `mergeDeep`, `allowReferenceCopy` will default to false.\n * @see mergeDeep\n */\nexport function clone<T>(\n target: T,\n options?: Partial<CloneOptions>\n): MutableDeep<T> {\n // mergeDeep works as a deep clone if given a single source.\n return mergeDeep<T>([target], {\n allowReferenceCopy: options?.allowReferenceCopy ?? false,\n rules: options?.rules?.map(toMergeRule) ?? defaultMergeOptions.rules,\n }) as MutableDeep<T>\n}\n\n/**\n * Creates a wrapper to convert a clone rule to a merge rule.\n */\nexport function toMergeRule<T>(cloneRule: CloneRule<T>): MergeRule<T> {\n return {\n matches: cloneRule.matches,\n merge(_sourceA: T | undefined, sourceB: T, merge: MergeCallback): T {\n return cloneRule.clone(\n sourceB,\n <S>(source: S, prop: string | number): MutableDeep<S> => {\n return merge(undefined, source, prop) as MutableDeep<S>\n }\n ) as T\n },\n } as const\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Disposable } from '../../core/disposable'\nimport { DisposedError, isDisposable } from '../../core/disposable'\nimport { IllegalStateError } from '../../error/IllegalStateError'\n\nexport interface ReadonlyLazy<T> {\n /**\n * True if the lazy instance has been constructed.\n */\n readonly constructed: boolean\n\n /**\n * When invoked the first time, constructs the value and returns it.\n * Consecutive calls will return that cached value.\n * @throws DisposedError If this lazy factory is disposed.\n */\n get value(): T\n}\n\nexport interface Lazy<T> extends ReadonlyLazy<T>, Disposable {\n /**\n * Sets the lazy instance's value.\n * If disposed, a {@link DisposedError} will be thrown.\n * @param value\n */\n set value(value: T)\n\n /**\n * Clears the lazy instance, disposing its value.\n * Unlike dispose(), this allows the lazy instance to be reconstructed upon the next get.\n * Typically used only in unit testing. May be used after {@link dispose}.\n */\n clear(): void\n}\n\n/**\n * A factory to lazily instantiate a single cached instance.\n */\nexport class LazyImpl<T> implements Lazy<T>, Disposable {\n private _constructing = false\n private _constructed = false\n private disposed = false\n private _value: T | undefined = undefined\n\n /**\n * @param factory A factory function that will be invoked at most once.\n */\n constructor(private readonly factory: () => T) {}\n\n get constructed(): boolean {\n return this._constructed\n }\n\n get value(): T {\n if (this.disposed) throw new DisposedError()\n if (this._constructing)\n throw new IllegalStateError('Lazy instance is constructing')\n if (this._constructed) return this._value as T\n this._constructing = true\n this._value = this.factory()\n this._constructing = false\n this._constructed = true\n return this._value\n }\n\n set value(value: T) {\n if (this.disposed) throw new DisposedError()\n this.clear()\n this._constructed = true\n this._value = value\n }\n\n clear(): void {\n this.disposed = false\n if (this._constructed) {\n if (isDisposable(this._value)) {\n this._value.dispose()\n }\n this._constructed = false\n this._value = undefined\n }\n }\n\n dispose() {\n if (this.disposed) throw new DisposedError()\n this.clear()\n this.disposed = true\n }\n}\n\n/**\n * Creates a new {@link Lazy} instance.\n *\n * @param factory A factory function that will be invoked at most once. If the instance produced\n * is disposable, it will be disposed on clear.\n */\nexport function lazy<T>(factory: () => T): Lazy<T> {\n return new LazyImpl<T>(factory)\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 type { ReadonlyDate } from '../object/readonlyType'\nimport { substitute } from '../string/string'\nimport { ValidationError } from '../../error/ValidationError'\n\n/**\n * @private\n */\nconst locale = {\n invalidDateError: `\"{value}\" is an invalid date`,\n} as const\n\n/**\n * Returns the signed time difference of end - start, in seconds.\n *\n * @param start The beginning date\n * @param end The later date\n */\nexport function timeDelta(start: ReadonlyDate, end: ReadonlyDate): number {\n return (end.getTime() - start.getTime()) / 1000\n}\n\n/**\n * A type alias to clarify that a number represents a unix timestamp\n * (milliseconds from 1970-1-1 00:00).\n */\nexport type Timestamp = number\n\n/**\n * Parses a string into a unix Timestamp using `Date.parse`, if the date is invalid, throws a\n * `ValidationError`\n * @param str\n */\nexport function parseTimestamp(str: string): Timestamp {\n const timestamp = Date.parse(str)\n if (Number.isNaN(timestamp))\n throw new ValidationError(\n substitute(locale.invalidDateError, { value: str }),\n ErrorOrigin.PARSING\n )\n return timestamp\n}\n\n/**\n * Parses a string into a date using `Date.parse`, if the date is invalid, throws a\n * `ValidationError`\n * @param str\n */\nexport function parseDate(str: string): Date {\n return new Date(parseTimestamp(str))\n}\n\n/**\n * Returns the iso 8601 string representation of a `Date` value.\n *\n * @param value\n */\nexport function stringifyDate(value: ReadonlyDate): string {\n return value.toISOString()\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\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 { logDebug, type LogTarget } from '@amazon/vinyl-util'\nimport { benchmark } from '@amazon/vinyl-util/browserTestUtil'\nimport { addBenchmarks, setupBenchmark } from '../setup'\n\ndescribe('Logging', () => {\n setupBenchmark()\n\n it('logDebug', async () => {\n const target: LogTarget = {\n logPrefix: 'path',\n }\n const results = await benchmark(`logDebug`, () => {\n logDebug(target, {\n requestInfo: {\n fetchId: 'lgn9lrwaid8o3utd5r',\n init: {\n method: 'POST',\n headers: {\n 'Content-Encoding': 'amz-1.0',\n 'Content-Type': 'application/json',\n 'X-Amz-Target':\n 'com.amazon.digitalmusiclocator.DigitalMusicLocatorServiceExternal.getStreamingURLs',\n },\n body: '{\"contentIdList\":[{\"identifier\":\"d9e4e337-97ba-41a9-9f31-84a8bf99f1dc\",\"identifierType\":\"COID\"}],\"bitRate\":\"HIGH\",\"deviceToken\":{\"deviceId\":\"lg4msezd1e355heuc5b\",\"deviceTypeId\":\"A16ZV8BU3SN1N3\"},\"appMetadata\":{\"appId\":\"WebCP\",\"https\":true,\"appVersion\":\"1.0.0\"},\"clientMetadata\":{\"clientId\":\"WebCP\",\"clientRequestId\":\"lgn9lrw623mgvi7k3et\"}}',\n signal: '[object AbortSignal]',\n },\n input: 'https://example.com/bar/',\n maxRetries: 1,\n timestamp: new Date('2023-04-19T05:40:17.914Z'),\n fetchOptions: {\n serviceId: null,\n readErrorBody: 1,\n },\n },\n attemptInfo: {\n currentTry: 1,\n timestamp: new Date('2023-04-19T05:40:17.914Z'),\n },\n target: '[object FetchProviderImpl]',\n })\n })\n addBenchmarks('logDebug', results)\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 ErrorOrigin,\n roundToNearest,\n ValidationError,\n} from '@amazon/vinyl-util'\n\n// ESBuild (https://github.com/evanw/esbuild/issues/3988) considers multiplication and division\n// to have a side effect and will inhibit tree shaking.\n// E.g. H = 60 * 60 will not be removed when not referenced.\nconst I = 60\nconst H = 3600\nconst D = 86400\nconst M = 2592000\nconst Y = 31536000\n\n/**\n * A duration, in seconds. (This may be negative)\n */\nexport type Duration = number\n\n/**\n * https://www.w3.org/TR/xmlschema-2/#duration\n */\nconst iso8601Duration =\n /^(-?)P?(\\d+(?:\\.\\d*)?Y)?(\\d+(?:\\.\\d*)?M)?(\\d+(?:\\.\\d*)?D)?T?(\\d+(?:\\.\\d*)?H)?(\\d+(?:\\.\\d*)?M)?(\\d+(?:\\.\\d*)?S?)?$/i\n\n/**\n * Parses an ISO 8601 duration into seconds.\n * The accepted format is P(n)Y(n)M(n)DT(n)H(n)M(n)S\n *\n * All units shall have a fixed size.\n *\n * P - Period designator, precedes all durations.\n * 1Y (Year) = 365 * 24 * 60 * 60 Seconds\n * 1M (Month) = 30 * 24 * 60 * 60 Seconds\n * 1D (Day) = 24 * 60 * 60 Seconds\n *\n * T - Time designator, precedes all time components.\n * 1H (Hour) = 60 * 60 Seconds\n * 1M (Minute) = 60 Seconds\n * 1S (Second)\n *\n *\n * @param value\n * @return Returns the duration in seconds or throws an {@link ValidationError}\n * if not properly formatted.\n * @see https://www.w3.org/TR/xmlschema-2/#duration\n */\nexport function parseDuration(value: string): Duration {\n const match = iso8601Duration.exec(value)\n if (match == null)\n throw new ValidationError(\n `Unexpected duration: '${value}', should be in iso 8601 format`,\n ErrorOrigin.PARSING\n )\n\n const sign = match[1] === '-' ? -1 : 1\n return (\n sign *\n (parseFloat(match[2] || '0') * Y +\n parseFloat(match[3] || '0') * M +\n parseFloat(match[4] || '0') * D +\n parseFloat(match[5] || '0') * H +\n parseFloat(match[6] || '0') * I +\n parseFloat(match[7] || '0'))\n )\n}\n\n/**\n * Returns the iso 8601 string representation of a duration value.\n *\n * @param value A duration value, in seconds.\n */\nexport function stringifyDuration(value: Duration): string {\n const sign = value < 0 ? '-' : ''\n let abs = Math.abs(value)\n\n const years = Math.floor(abs / Y)\n abs -= years * Y\n const months = Math.floor((abs % Y) / M)\n const days = Math.floor((abs % M) / D)\n const hours = Math.floor((abs % D) / H)\n const minutes = Math.floor((abs % H) / I)\n const seconds = abs % I\n let isoString = `${sign}P`\n if (years > 0) isoString += `${years}Y`\n if (months > 0) isoString += `${months}M`\n if (days > 0) isoString += `${days}D`\n isoString += 'T'\n if (hours > 0) isoString += `${hours}H`\n if (minutes > 0) isoString += `${minutes}M`\n if (seconds > 0 || !value) isoString += `${roundToNearest(seconds, 0.001)}S`\n return isoString\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin, ValidationError } from '@amazon/vinyl-util'\n\nexport function throwParsingError(message: string): never {\n throw new ValidationError(message, ErrorOrigin.PARSING)\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 type { FromTypeof, Typeof } from '@amazon/vinyl-util'\nimport { substitute } from '@amazon/vinyl-util'\nimport type { Validator } from './Validator'\nimport { createValidator } from './Validator'\nimport type { JsonSchema, JsonSchemaType } from './JsonSchema'\n\n/**\n * @private\n */\nconst locale = {\n template: 'type {value}',\n} as const\n\n/**\n * The JSON Schema `type` for each JavaScript `typeof` value that has a JSON representation.\n * Types with no JSON equivalent (`function`, `symbol`) are absent and contribute no fragment.\n */\nconst jsonSchemaTypeByTypeof: Partial<Record<Typeof, JsonSchemaType>> = {\n string: 'string',\n number: 'number',\n boolean: 'boolean',\n object: 'object',\n}\n\n/**\n * Creates a validator that validates that the input is not nullish and its `typeof` matches the\n * expected value.\n *\n * Note: while `typeof null === 'object'`, `typeOfValidator('object')` will assert that its\n * input is not nullish.\n *\n * @param expected\n */\nfunction typeOfValidator<T extends Typeof>(\n expected: T\n): Validator<NonNullable<FromTypeof<T>>> {\n const jsonType = jsonSchemaTypeByTypeof[expected]\n const jsonSchema: JsonSchema | undefined =\n jsonType == null ? undefined : { type: jsonType }\n return createValidator(\n substitute(locale.template, { value: expected }),\n (input: unknown): input is NonNullable<FromTypeof<T>> => {\n return input != null && typeof input === expected\n },\n undefined,\n jsonSchema\n )\n}\n\nconst typeOfValidatorCache: any = {}\n\nfunction cachedTypeOfValidator<T extends Typeof>(\n type: T\n): Validator<NonNullable<FromTypeof<T>>> {\n if (!(type in typeOfValidatorCache)) {\n typeOfValidatorCache[type] = typeOfValidator(type)\n }\n return typeOfValidatorCache[type]\n}\n\n/**\n * Validators asserting typeof input matches the expected value.\n *\n * Note: bigint is omitted; not all supported platforms can use BigInt.\n */\nexport const typeOfValidators = {\n get boolean() {\n return cachedTypeOfValidator('boolean')\n },\n get func() {\n return cachedTypeOfValidator('function')\n },\n get number() {\n return cachedTypeOfValidator('number')\n },\n get object() {\n return cachedTypeOfValidator('object')\n },\n get string() {\n return cachedTypeOfValidator('string')\n },\n get symbol() {\n return cachedTypeOfValidator('symbol')\n },\n} as const\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 { ValueSchema } from './ValueSchema'\nimport { typeOfValidators } from './typeOfValidators'\nimport type { Validator } from './Validator'\nimport { createValidator } from './Validator'\n\nconst locale = {\n gte: 'at least {value}',\n gt: 'greater than {value}',\n lte: 'at most {value}',\n lt: 'less than {value}',\n within: 'within {min} and {max}',\n safeInteger: 'safe integer',\n finite: 'finite',\n} as const\n\nexport const numberValidators = {\n /**\n * Creates a validator that asserts that the input number is at least the provided minimum\n * value.\n *\n * @param min The minimum (inclusive) the value may be.\n */\n gte(min: number): Validator<number, number> {\n return createValidator(\n substitute(locale.gte, { value: min }),\n (input) => input >= min,\n undefined,\n { minimum: min }\n )\n },\n\n /**\n * Creates a validator that asserts that the input number is greater than the provided minimum\n * value.\n *\n * @param min The minimum (exclusive) the value may be.\n */\n gt(min: number): Validator<number, number> {\n return createValidator(\n substitute(locale.gt, { value: min }),\n (input) => input > min,\n undefined,\n { exclusiveMinimum: min }\n )\n },\n\n /**\n * Creates a validator that asserts that the input number is at most the provided maximum\n * value.\n *\n * @param max The maximum (inclusive) the value may be.\n */\n lte(max: number): Validator<number, number> {\n return createValidator(\n substitute(locale.lte, { value: max }),\n (input) => input <= max,\n undefined,\n { maximum: max }\n )\n },\n\n /**\n * Creates a validator that asserts that the input number is less than the provided maximum\n * value.\n *\n * @param max The maximum (exclusive) the value may be.\n */\n lt(max: number): Validator<number, number> {\n return createValidator(\n substitute(locale.lt, { value: max }),\n (input) => input < max,\n undefined,\n { exclusiveMaximum: max }\n )\n },\n\n /**\n * Creates a validator that asserts that the input number is at least the provided minimum\n * and at most the provided maximum values.\n *\n * @param min The minimum (inclusive) value the input may be.\n * @param max The maximum (inclusive) value the input may be.\n */\n within(min: number, max: number): Validator<number, number> {\n return createValidator(\n substitute(locale.within, { min, max }),\n (input) => input >= min && input <= max,\n undefined,\n { minimum: min, maximum: max }\n )\n },\n\n /**\n * Creates a validator that asserts that the input number is finite.\n */\n finite(): Validator<number, number> {\n return createValidator(locale.finite, (input) => Number.isFinite(input))\n },\n\n /**\n * Creates a validator that asserts that the input number is a safe integer.\n */\n safeInteger(): Validator<number, number> {\n return createValidator(\n locale.safeInteger,\n (input) => Number.isSafeInteger(input),\n undefined,\n { type: 'integer' }\n )\n },\n} as const\n\nexport class NumberSchema extends ValueSchema<number> {\n private static _base: NumberSchema | null = null\n\n /**\n * The base Object validator validating that the input is an object.\n */\n static get base(): NumberSchema {\n if (this._base == null)\n this._base = new NumberSchema(typeOfValidators.number)\n return this._base\n }\n\n /**\n * Creates a validator that asserts that the input number is at least the provided minimum\n * value.\n *\n * @param min The minimum (inclusive) the value may be.\n */\n gte(min: number): this {\n return this.chain(numberValidators.gte(min))\n }\n\n /**\n * Creates a validator that asserts that the input number is greater than the provided minimum\n * value.\n *\n * @param min The minimum (exclusive) the value may be.\n */\n gt(min: number): this {\n return this.chain(numberValidators.gt(min))\n }\n\n /**\n * Creates a validator that asserts that the input number is at most the provided maximum\n * value.\n *\n * @param max The maximum (inclusive) the value may be.\n */\n lte(max: number): this {\n return this.chain(numberValidators.lte(max))\n }\n\n /**\n * Creates a validator that asserts that the input number is less than the provided maximum\n * value.\n *\n * @param max The maximum (exclusive) the value may be.\n */\n lt(max: number): this {\n return this.chain(numberValidators.lt(max))\n }\n\n /**\n * Creates a validator that asserts that the input number is at least the provided minimum\n * and at most the provided maximum values.\n *\n * @param min The minimum (inclusive) value the input may be.\n * @param max The maximum (inclusive) value the input may be.\n */\n within(min: number, max: number): this {\n return this.chain(numberValidators.within(min, max))\n }\n\n /**\n * Creates a validator that asserts that the input number is finite.\n */\n finite(): this {\n return this.chain(numberValidators.finite())\n }\n\n /**\n * Creates a validator that asserts that the input number is a safe integer.\n */\n safeInteger(): this {\n return this.chain(numberValidators.safeInteger())\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 { isOneOf, type Validator } from '@amazon/vinyl-validation'\nimport type { actuateType } from '../xmlns/org/w3/1999/xlink'\nimport { ErrorOrigin } from '@amazon/vinyl-util'\n\nconst actuateValidator: Validator<actuateType> = isOneOf('onLoad', 'onRequest')\n\nexport function assertActuateEnum(str: string): actuateType {\n actuateValidator.assert(str, ErrorOrigin.PARSING)\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\n/**\n * A set of utilities for easily writing schema-based rule definitions to be used with the\n * `parseXml` parser.\n *\n * @module\n */\n\nimport {\n parseDate,\n stringifyDate,\n parseBoolean,\n stringify,\n type Invariant,\n type Maybe,\n type ReadonlyDate,\n} from '@amazon/vinyl-util'\n\nimport type { Uri } from '../xmlns/org/w3/2001/XmlSchema'\n\nexport enum XmlRuleType {\n CHARACTERS = 'characters',\n ATTRIBUTE = 'attribute',\n ELEMENT = 'element',\n ELEMENTS = 'elements',\n}\n\n/**\n * Reserved keys that may not be used in XmlRules.\n *\n * If a schema uses a reserved word, set `localPart` in the rule options to associate.\n */\nexport type ReservedXmlRuleKeys = 'parent' | 'clone' | 'toJSON'\n\n/**\n * A schema for XML serialization and deserialization.\n *\n * The parser values may be lazy, represented as a function that returns a property parser.\n * @typeParam T The object type these parsing rules model.\n */\nexport type XmlRules<T extends object> = {\n readonly [P in Exclude<keyof T, ReservedXmlRuleKeys>]-?:\n | XmlRule<T[P]>\n | LazyXmlRule<T[P]>\n}\n\n/**\n * A union of the supported parsing types.\n */\nexport type XmlRule<T> =\n | AttributeRule<T>\n | CharactersRule<T>\n | ElementsRule<T & (readonly object[] | undefined)>\n | ElementRule<T & (object | undefined)>\n\n/**\n * A function that returns a property handler.\n * Useful when there are recursive rules.\n */\nexport type LazyXmlRule<T> = () => XmlRule<T>\n\nexport interface NamespacedRuleOptions {\n /**\n * Matches the `QName.localPart` of the element. If undefined, this will match against\n * the property name from {@link XmlRules}.\n */\n readonly localPart?: string | undefined\n\n /**\n * Matches the `namespaceUri` of the element or attribute.\n *\n * If null, this will only match against a null namespace.\n * If undefined, this will default to the namespace of the parent element for elements, or\n * null for attributes.\n *\n * Note that attributes do not inherit default namespaces as elements do.\n */\n readonly namespaceUri?: Maybe<Uri>\n}\n\n/**\n * A rule definition for a list of elements.\n */\nexport interface ElementsRule<\n T extends readonly object[] | undefined,\n> extends Required<ElementsRuleOptions> {\n readonly type: XmlRuleType.ELEMENTS\n\n /**\n * Prevents rule from losing nullable type information.\n */\n readonly __invariant?: Invariant<T>\n\n /**\n * Returns the schema for matched elements.\n * These rules will be applied per element, collecting into an array.\n */\n readonly rules: XmlRules<NonNullable<T>[number]>\n}\n\nexport interface ElementsRuleOptions extends NamespacedRuleOptions {\n /**\n * The minimum number of elements.\n */\n readonly minOccurs?: number\n\n /**\n * The maximum number of elements. Use null for unbounded.\n */\n readonly maxOccurs?: number | null\n\n /**\n * If true and there are 0 occurrences of the element, the parsed value will be an empty array\n * instead of undefined.\n */\n readonly useEmptyArrays?: boolean\n}\n\n/**\n * A rule definition for a single element.\n */\nexport interface ElementRule<\n T extends object | undefined,\n> extends Required<ElementRuleOptions> {\n /**\n * Prevents rule from losing nullable type information.\n */\n readonly __invariant?: Invariant<T>\n\n readonly type: XmlRuleType.ELEMENT\n\n /**\n * Returns the schema for the matched element.\n */\n readonly rules: XmlRules<NonNullable<T>>\n}\n\nexport interface ElementRuleOptions extends NamespacedRuleOptions {\n /**\n * If true, a parsing error will be thrown if the value is undefined.\n */\n readonly required?: boolean\n}\n\n/**\n * A rule definition for an attribute.\n */\nexport interface AttributeRule<T> extends Required<AttributeRuleOptions<T>> {\n readonly type: XmlRuleType.ATTRIBUTE\n\n /**\n * Parses the attribute value.\n */\n readonly parse: (value: string) => T\n\n /**\n * Stringifies the value.\n */\n readonly stringify: (value: NonNullable<T>) => string\n}\n\nexport interface AttributeRuleOptions<T> extends NamespacedRuleOptions {\n /**\n * If true, a parsing error will be thrown if the value is undefined.\n */\n readonly required?: boolean\n\n /**\n * If the current element has no matching attribute, default will be used.\n */\n readonly default?: T | undefined\n\n /**\n * Matches the `namespaceUri` of the attribute.\n *\n * If null, this will only match against a null namespace.\n *\n * Note that attributes do not inherit default namespaces as elements do.\n */\n readonly namespaceUri?: Uri | null\n}\n\n/**\n * A rule definition for an element's text content.\n */\nexport interface CharactersRule<T> {\n readonly type: XmlRuleType.CHARACTERS\n\n /**\n * Parses the unescaped/processed characters.\n * This will always be called, but characters may be an empty string if the element has no\n * text content.\n */\n readonly parse: (characters: string) => T\n\n /**\n * Stringifies the value.\n */\n readonly stringify: (value: NonNullable<T>) => string\n}\n\nexport interface RequiredElementRuleOptions extends ElementRuleOptions {\n readonly required: true\n}\n\nexport function element<T extends object>(\n rules: XmlRules<T>,\n options: RequiredElementRuleOptions\n): ElementRule<T>\n\nexport function element<T extends object | undefined>(\n rules: XmlRules<NonNullable<T>>,\n options?: ElementRuleOptions\n): ElementRule<T | undefined>\n\n/**\n * Returns a schema for a single object based on a map of rules.\n *\n * If more than one element is found with a matching name, a `ParseError` is thrown.\n */\nexport function element<T extends object | undefined>(\n rules: XmlRules<NonNullable<T>>,\n options?: ElementRuleOptions\n): ElementRule<T | undefined> {\n return {\n type: XmlRuleType.ELEMENT,\n localPart: undefined,\n namespaceUri: undefined,\n required: false,\n ...options,\n rules,\n }\n}\n\n/**\n * Elements options that guarantee that there is a non-null array.\n * For minOccurs types greater than 10, a type cast is required.\n */\nexport type RequiredElementsOptions =\n | (ElementsRuleOptions & { readonly useEmptyArrays: true })\n | (ElementsRuleOptions & {\n readonly minOccurs: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10\n })\n\nexport function elements<T extends object>(\n rules: XmlRules<T>,\n options: RequiredElementsOptions\n): ElementsRule<readonly T[]>\n\nexport function elements<T extends object>(\n rules: XmlRules<T>,\n options?: ElementsRuleOptions\n): ElementsRule<readonly T[] | undefined>\n\n/**\n * Handles a list of child nodes where each matching child node is parsed into a corresponding\n * object represented by the given rules.\n *\n * @param rules The parsing rules to use for each element.\n * @param options\n * @see parseChildNodes\n */\nexport function elements<T extends object>(\n rules: XmlRules<T>,\n options?: ElementsRuleOptions\n): ElementsRule<readonly T[] | undefined> | ElementsRule<readonly T[]> {\n return {\n type: XmlRuleType.ELEMENTS,\n localPart: undefined,\n namespaceUri: undefined,\n minOccurs: 0,\n maxOccurs: null,\n useEmptyArrays: false,\n ...options,\n rules,\n }\n}\n\n/**\n * Parses the text content of the current element via the given parse and stringify functions.\n *\n * Does not currently support mixing text and element nodes.\n * E.g. the XML `<note>Dear <name>John</name>, I regret to inform you...</note>` could not be\n * serialized or deserialized using xml rule mappings.\n *\n * @param parse The string passed to this parser is the processed text content of the current\n * element.\n * @param stringify Serializes the value.\n *\n * @see processCharacters\n */\nexport function characters<T>(\n parse: (str: string) => T,\n stringify: (value: T) => string\n): CharactersRule<T> {\n return { type: XmlRuleType.CHARACTERS, parse, stringify }\n}\n\n/**\n * Handles the processed text content without any modification.\n *\n * @see characters\n */\nexport const charactersString = characters((i) => i, stringify)\n\nexport type RequiredAttributeOptions<T> = AttributeRuleOptions<T> &\n ({ required: true } | { default: T })\n\nexport function attr<T>(\n parse: (value: string) => T,\n stringify: (value: T) => string,\n options: RequiredAttributeOptions<T>\n): AttributeRule<T>\n\nexport function attr<T>(\n parse: (value: string) => T,\n stringify: (value: NonNullable<T>) => string,\n options?: AttributeRuleOptions<T>\n): AttributeRule<T | undefined>\n\n/**\n * Handles an attribute using the given parse and stringify functions.\n *\n * @param parse\n * @param stringify\n * @param options\n */\nexport function attr<T>(\n parse: (value: string) => T,\n stringify: (value: T) => string,\n options?: AttributeRuleOptions<T>\n): AttributeRule<T> | AttributeRule<T | undefined> {\n return {\n type: XmlRuleType.ATTRIBUTE,\n localPart: undefined,\n namespaceUri: null,\n required: false,\n default: undefined,\n ...options,\n parse,\n stringify,\n }\n}\n\nexport function attrString(\n options: RequiredAttributeOptions<string>\n): AttributeRule<string>\n\nexport function attrString(\n options?: AttributeRuleOptions<string>\n): AttributeRule<string | undefined>\n\n/**\n * Keeps an attribute's string value as is.\n *\n * @param options\n */\nexport function attrString(\n options?: AttributeRuleOptions<string>\n): AttributeRule<string> | AttributeRule<string | undefined> {\n return attr((i) => i, stringify, options)\n}\n\nexport function attrInt(\n options: RequiredAttributeOptions<number>\n): AttributeRule<number>\n\nexport function attrInt(\n options?: AttributeRuleOptions<number>\n): AttributeRule<number | undefined>\n\n/**\n * Parses an attribute's value using `parseInt`\n *\n * @param options\n */\nexport function attrInt(\n options?: AttributeRuleOptions<number>\n): AttributeRule<number> | AttributeRule<number | undefined> {\n return attr(parseInt, stringify, options)\n}\n\nexport function attrFloat(\n options: RequiredAttributeOptions<number>\n): AttributeRule<number>\n\nexport function attrFloat(\n options?: AttributeRuleOptions<number>\n): AttributeRule<number | undefined>\n\n/**\n * Parses an attribute using `parseFloat`\n *\n * @param options\n */\nexport function attrFloat(\n options?: AttributeRuleOptions<number>\n): AttributeRule<number> | AttributeRule<number | undefined> {\n return attr(parseFloat, stringify, options)\n}\n\nexport function attrBoolean(\n options: RequiredAttributeOptions<boolean>\n): AttributeRule<boolean>\n\nexport function attrBoolean(\n options?: AttributeRuleOptions<boolean>\n): AttributeRule<boolean | undefined>\n\n/**\n * Parses an attribute's value `\"true\"` or `\"1\"` as `true`.\n *\n * @param options\n */\nexport function attrBoolean(\n options?: AttributeRuleOptions<boolean>\n): AttributeRule<boolean> | AttributeRule<boolean | undefined> {\n return attr(parseBoolean, stringify, options)\n}\n\nexport function attrDateTime(\n options: RequiredAttributeOptions<Date>\n): AttributeRule<ReadonlyDate>\n\nexport function attrDateTime(\n options?: AttributeRuleOptions<ReadonlyDate>\n): AttributeRule<ReadonlyDate | undefined>\n\n/**\n * Parses an attribute using `Date.parse`\n *\n * @param options\n */\nexport function attrDateTime(\n options?: AttributeRuleOptions<ReadonlyDate>\n): AttributeRule<ReadonlyDate> | AttributeRule<ReadonlyDate | undefined> {\n return attr(parseDate, stringifyDate, options)\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 IllegalArgumentError,\n invariant,\n type Invariant,\n memoize,\n} from '@amazon/vinyl-util'\n\nimport type { XmlRule, XmlRules } from './xmlRules'\nimport { XmlRuleType } from './xmlRules'\nimport type { Uri } from '../xmlns/org/w3/2001/XmlSchema'\n\n/**\n * A machine-readable representation of parse rules for random access based on qualified namespace\n * keys.\n *\n * Rule keys will either be `namespaceUri:localPart` or just `localPart` for wildcard rules if\n * namespaceUri is not defined in the handler.\n */\nexport interface MappedXmlRules<T> {\n /**\n * Enforces that this rule set can only be used to parse the expected type T.\n */\n readonly __type: Invariant<T>\n readonly attributes: ReadonlyMap<string, MappedAttributeRule>\n readonly elements: ReadonlyMap<string, MappedElementsRule>\n readonly characters: MappedCharactersRule | undefined\n}\n\nexport interface MappedAttributeRule {\n /**\n * The property name.\n */\n readonly property: keyof any\n\n /**\n * If true, a parsing error will be thrown if the value is undefined.\n */\n readonly required: boolean\n\n /**\n * If the current element has no matching attribute, default will be used.\n */\n readonly default: any\n\n /**\n * Parses the attribute value.\n */\n readonly parse: (value: string) => any\n\n /**\n * Converts the attribute value to a string.\n */\n readonly stringify: (value: any) => string\n\n /**\n * The local part of the QName.\n */\n readonly localPart: string\n\n /**\n * The namespace uri that must match.\n */\n readonly namespaceUri: Uri | null\n}\n\nexport interface MappedElementsRule {\n /**\n * The name of the property to set on the parent element.\n */\n readonly property: keyof any\n\n /**\n * True if the parsed elements should populate into an array.\n */\n readonly array: boolean\n\n /**\n * The minimum number of elements.\n */\n readonly minOccurs: number\n\n /**\n * The maximum number of elements. Use null for unbounded.\n */\n readonly maxOccurs: number | null\n\n /**\n * If true and there are 0 occurrences of the element, the parsed value will be an empty array\n * instead of undefined.\n */\n readonly useEmptyArrays: boolean\n\n /**\n * Returns the mappings for matched element(s).\n */\n readonly rules: () => MappedXmlRules<any>\n\n /**\n * The local part of the QName.\n */\n readonly localPart: string\n\n /**\n * The namespace uri that must match.\n */\n readonly namespaceUri: Uri | null\n}\n\nexport interface MappedCharactersRule {\n readonly property: keyof any\n\n /**\n * Parses the unescaped/processed characters.\n * This will always be called, but characters may be an empty string if the element has no\n * text content.\n */\n readonly parse: (characters: string) => any\n\n /**\n * Converts the value to a string.\n */\n readonly stringify: (value: any) => string\n}\n\n/**\n * An empty rules map, used when there was no match for the started element.\n * @private\n */\nexport const EmptyRules: MappedXmlRules<AnyRecord> = {\n __type: invariant(),\n attributes: new Map(),\n elements: new Map(),\n characters: undefined,\n} as const\n\n/**\n * Creates machine-friendly content handler rules from the given {@link XmlRules}.\n *\n * @param rules The {@link XmlRules} to convert.\n * @param parentNamespaceUri\n */\nexport function mapXmlRules<T extends object>(\n rules: XmlRules<T>,\n parentNamespaceUri: Uri | null = null\n): MappedXmlRules<T> {\n const attributeRules = new Map<string, MappedAttributeRule>()\n const elementRules = new Map<string, MappedElementsRule>()\n let charactersRule: MappedCharactersRule | undefined = undefined\n\n for (const property in rules) {\n const handlerOrFunction = rules[property as keyof typeof rules]\n let handler: XmlRule<any>\n if (typeof handlerOrFunction === 'function') {\n handler = handlerOrFunction()\n } else {\n handler = handlerOrFunction\n }\n let key: string\n switch (handler.type) {\n case XmlRuleType.CHARACTERS:\n if (charactersRule !== undefined)\n throw new IllegalArgumentError(\n 'characters handler already defined'\n )\n charactersRule = {\n property,\n parse: handler.parse,\n stringify: handler.stringify,\n }\n break\n case XmlRuleType.ELEMENT:\n case XmlRuleType.ELEMENTS: {\n const localPart = handler.localPart ?? property\n const namespaceUri: Uri | null =\n handler.namespaceUri === undefined\n ? parentNamespaceUri\n : handler.namespaceUri\n key = xmlRuleKey(localPart, namespaceUri)\n if (elementRules.has(key)) {\n throw new IllegalArgumentError(\n `Multiple element rules for ${key}`\n )\n }\n if (handler.type === XmlRuleType.ELEMENT) {\n const rules = handler.rules\n elementRules.set(key, {\n array: false,\n property,\n minOccurs: handler.required ? 1 : 0,\n maxOccurs: 1,\n rules: memoize(() => mapXmlRules(rules, namespaceUri)),\n useEmptyArrays: false,\n localPart,\n namespaceUri,\n })\n } else {\n const rules = handler.rules\n elementRules.set(key, {\n array: true,\n property,\n maxOccurs: handler.maxOccurs,\n minOccurs: handler.minOccurs,\n rules: memoize(() => mapXmlRules(rules, namespaceUri)),\n useEmptyArrays: handler.useEmptyArrays,\n localPart,\n namespaceUri,\n })\n }\n break\n }\n case XmlRuleType.ATTRIBUTE: {\n // Attributes should not inherit the namespace of the parent element.\n const namespaceUri = handler.namespaceUri\n const localPart = handler.localPart ?? property\n key = xmlRuleKey(localPart, namespaceUri)\n if (attributeRules.has(key)) {\n throw new IllegalArgumentError(\n `Multiple attribute rules for ${key}`\n )\n }\n attributeRules.set(key, {\n property,\n default: handler.default,\n parse: handler.parse,\n stringify: handler.stringify,\n required: handler.required,\n localPart,\n namespaceUri: handler.namespaceUri ?? null,\n })\n break\n }\n }\n }\n return {\n __type: invariant(),\n attributes: attributeRules,\n elements: elementRules,\n characters: charactersRule,\n }\n}\n\n/**\n * Creates a rule key for mapped xml rules.\n *\n * @private\n * @param localPart The {@link QName.localPart}\n * @param namespaceUri The `namespaceUri` of the element.\n */\nexport function xmlRuleKey(\n localPart: string,\n namespaceUri: Uri | null = null\n): string {\n return `${namespaceUri ?? ''}:${localPart}`\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 Fun,\n plainObjectMergeRule,\n substitute,\n ValidationError,\n} from '@amazon/vinyl-util'\n\nimport {\n type AttributeRule,\n type ElementRule,\n type ElementsRule,\n type LazyXmlRule,\n type XmlRule,\n type XmlRules,\n XmlRuleType,\n} from './xmlRules'\n\nconst locale = {\n illegalRuleOverrideTypeError:\n 'Cannot override the rule {property} of type {sourceType} with a rule of type {overrideType}',\n illegalQNameOverrideError:\n 'Cannot override the rule {property} with a different localPart or namespace',\n} as const\n\n/**\n * Recursively merges array types so that S[] & T[] becomes (S & T)[]\n * When two array elements parsing rules are merged, the result is an array with intersected\n * element types.\n */\nexport type Merged<T> = T extends readonly any[]\n ? MergedTupleOrArray<T>\n : T extends Fun\n ? T\n : T extends object\n ? {\n [P in keyof T]: Merged<T[P]>\n }\n : T\n\n/**\n * `[S0, T0] & [S1, T1]` cannot be converted to `[S0 & S1, T0 & T1]`, but we can at least preserve\n * the tuple when not intersected.\n *\n * Intersected tuples become arrays. E.g. `[S0, T0] & [S1, T1]` becomes `Array<S0 | S1 | T0 | T1>`\n */\nexport type MergedTupleOrArray<T extends readonly any[]> = T extends [infer V0]\n ? // Support tuples up to 5 in length\n [Merged<V0>]\n : T extends [infer V0, infer V1]\n ? [Merged<V0>, Merged<V1>]\n : T extends [infer V0, infer V1, infer V2]\n ? [Merged<V0>, Merged<V1>, Merged<V2>]\n : T extends [infer V0, infer V1, infer V2, infer V3]\n ? [Merged<V0>, Merged<V1>, Merged<V2>, Merged<V3>]\n : T extends [infer V0, infer V1, infer V2, infer V3, infer V4]\n ? [Merged<V0>, Merged<V1>, Merged<V2>, Merged<V3>, Merged<V4>]\n : T extends any[]\n ? Array<Merged<T[number]>>\n : T extends readonly [infer V0]\n ? readonly [Merged<V0>]\n : T extends readonly [infer V0, infer V1]\n ? readonly [Merged<V0>, Merged<V1>]\n : T extends readonly [infer V0, infer V1, infer V2]\n ? readonly [Merged<V0>, Merged<V1>, Merged<V2>]\n : T extends readonly [\n infer V0,\n infer V1,\n infer V2,\n infer V3,\n ]\n ? readonly [\n Merged<V0>,\n Merged<V1>,\n Merged<V2>,\n Merged<V3>,\n ]\n : T extends readonly [\n infer V0,\n infer V1,\n infer V2,\n infer V3,\n infer V4,\n ]\n ? readonly [\n Merged<V0>,\n Merged<V1>,\n Merged<V2>,\n Merged<V3>,\n Merged<V4>,\n ]\n : ReadonlyArray<Merged<T[number]>>\n\n/**\n * Merges the given two xml rule sets into one.\n */\nexport function mergeXmlRules<A extends object, B extends object>(\n a: XmlRules<A>,\n b: XmlRules<B>\n): XmlRules<Merged<A & B>>\n\n/**\n * Merges the given three xml rule sets into one.\n */\nexport function mergeXmlRules<\n A extends object,\n B extends object,\n C extends object,\n>(a: XmlRules<A>, b: XmlRules<B>, c: XmlRules<C>): XmlRules<Merged<A & B & C>>\n\n/**\n * Merges the given four xml rule sets into one.\n */\nexport function mergeXmlRules<\n A extends object,\n B extends object,\n C extends object,\n D extends object,\n>(\n a: XmlRules<A>,\n b: XmlRules<B>,\n c: XmlRules<C>,\n d: XmlRules<D>\n): XmlRules<Merged<A & B & C & D>>\n\n/**\n * Merges the given five xml rule sets into one.\n */\nexport function mergeXmlRules<\n A extends object,\n B extends object,\n C extends object,\n D extends object,\n E extends object,\n>(\n a: XmlRules<A>,\n b: XmlRules<B>,\n c: XmlRules<C>,\n d: XmlRules<D>,\n e: XmlRules<E>\n): XmlRules<Merged<A & B & C & D & E>>\n\n/**\n * Merges the given six xml rule sets into one.\n */\nexport function mergeXmlRules<\n A extends object,\n B extends object,\n C extends object,\n D extends object,\n E extends object,\n F extends object,\n>(\n a: XmlRules<A>,\n b: XmlRules<B>,\n c: XmlRules<C>,\n d: XmlRules<D>,\n e: XmlRules<E>,\n f: XmlRules<F>\n): XmlRules<Merged<A & B & C & D & E & F>>\n\n/**\n * Merges the given rules into one ruleset.\n *\n * @param rules\n * @return A new XmlRules map with the merged rules.\n */\nexport function mergeXmlRules(\n ...rules: XmlRules<any>[]\n): XmlRules<Merged<any>> {\n let finalRule = rules[0]\n for (let i = 1; i < rules.length; i++) {\n finalRule = plainObjectMergeRule.merge(\n finalRule,\n rules[i],\n mergeXmlRule\n ) as XmlRules<any>\n }\n return finalRule\n}\n\nfunction mergeXmlRule(\n sourceA: XmlRule<any> | undefined,\n sourceB: XmlRule<any>,\n prop: string | number\n): XmlRule<any>\n\nfunction mergeXmlRule(\n sourceA: XmlRule<any> | LazyXmlRule<any> | undefined,\n sourceB: XmlRule<any> | LazyXmlRule<any>,\n prop: string | number\n): XmlRule<any> | LazyXmlRule<any>\n\nfunction mergeXmlRule(\n sourceA: XmlRule<any> | LazyXmlRule<any> | undefined,\n sourceB: XmlRule<any> | LazyXmlRule<any>,\n prop: string | number\n): XmlRule<any> | LazyXmlRule<any> {\n if (sourceA == null) return sourceB\n const sourceAIsLazy = typeof sourceA === 'function'\n const sourceBIsLazy = typeof sourceB === 'function'\n if (sourceAIsLazy || sourceBIsLazy) {\n return () => {\n const a = sourceAIsLazy ? sourceA() : sourceA\n const b = sourceBIsLazy ? sourceB() : sourceB\n return mergeXmlRule(a, b, prop)\n }\n }\n if (sourceA.type !== sourceB.type) {\n throw new ValidationError(\n substitute(locale.illegalRuleOverrideTypeError, {\n property: prop,\n sourceType: sourceA.type,\n overrideType: sourceB.type,\n })\n )\n }\n switch (sourceA.type) {\n case XmlRuleType.ATTRIBUTE:\n case XmlRuleType.ELEMENT:\n case XmlRuleType.ELEMENTS: {\n const b = sourceB as ElementRule<any>\n if (\n sourceA.namespaceUri !== b.namespaceUri ||\n (sourceA.localPart ?? prop) !== (b.localPart ?? prop)\n ) {\n throw new ValidationError(\n substitute(locale.illegalQNameOverrideError, {\n property: prop,\n })\n )\n }\n break\n }\n }\n\n switch (sourceA.type) {\n case XmlRuleType.ATTRIBUTE: {\n const b = sourceB as AttributeRule<any>\n return {\n ...b,\n default: b.default ?? sourceA.default,\n }\n }\n case XmlRuleType.CHARACTERS:\n return sourceB\n case XmlRuleType.ELEMENT: {\n const b = sourceB as ElementRule<any>\n return {\n ...b,\n required: sourceA.required || b.required,\n rules: mergeXmlRules(sourceA.rules, b.rules),\n }\n }\n case XmlRuleType.ELEMENTS: {\n const b = sourceB as ElementsRule<any>\n const maxOccurs =\n sourceA.maxOccurs != null && b.maxOccurs != null\n ? Math.min(sourceA.maxOccurs, b.maxOccurs)\n : (sourceA.maxOccurs ?? b.maxOccurs)\n return {\n ...b,\n minOccurs: Math.max(sourceA.minOccurs, b.minOccurs),\n maxOccurs,\n useEmptyArrays: sourceA.useEmptyArrays || b.useEmptyArrays,\n rules: mergeXmlRules(sourceA.rules, b.rules),\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 {\n char,\n decodeEntities,\n last,\n type MutableDeep,\n StringReader,\n} from '@amazon/vinyl-util'\n\nimport type { Uri } from '../xmlns/org/w3/2001/XmlSchema'\nimport type { Attributes, ParseXmlHandler } from './ParseXmlHandler'\nimport type { QName } from './QName'\nimport type { XmlElement } from './ParseXmlHandlerImpl'\n\nexport const XMLNS = 'http://www.w3.org/2000/xmlns/'\n\nconst LT = char('<')\nconst GT = char('>')\nconst EQ = char('=')\nconst SLASH = char('/')\nconst COLON = char(':')\nconst QMARK = char('?')\nconst EXCL = char('!')\nconst APOS = char(\"'\")\nconst QUOT = char('\"')\nconst QUOTES = new Set([APOS, QUOT])\n\n/**\n * Nested xml elements push current namespace information onto a stack.\n *\n * @private\n */\nexport interface StackElement {\n /**\n * The qualified name of the current element on the stack. Used to validate expected closing\n * element.\n */\n readonly qName: string\n\n /**\n * The (mutable) namespaces map for the current stack.\n */\n readonly namespaceMap: Namespaces\n\n /**\n * The default namespace.\n */\n defaultNamespaceUri: Uri | null\n}\n\n/**\n * Parses an XML document using a partial sax-style content handler.\n * This allows for parsing without the entire document being read into memory first.\n *\n * XML Documents are mapped to data structures through content handlers instead of needing an\n * intermediate model.\n */\nexport function parseXml<T>(\n str: string,\n handler: ParseXmlHandler<T>\n): T & XmlElement<T> {\n const c = new StringReader(str)\n let current: StackElement = {\n qName: '#document',\n namespaceMap: new Map(),\n defaultNamespaceUri: null,\n }\n const stack: StackElement[] = [current]\n\n /**\n * Provides the namespace uri for the given prefix on the current stack.\n * @param prefix\n */\n const namespaceLookup = (prefix: string | null): Uri | null => {\n if (!prefix) return current.defaultNamespaceUri\n for (let i = stack.length - 1; i >= 0; i--) {\n const map = stack[i].namespaceMap\n if (map.has(prefix)) return stack[i].namespaceMap.get(prefix)!\n }\n return null\n }\n\n try {\n handler.startDocument()\n } catch (e: any) {\n c.err(e.message)\n }\n while (c.hasNext()) {\n const charsStart = c.untilChar(LT)\n if (charsStart < c.position) {\n const chars = str.substring(charsStart, c.position)\n try {\n handler.textNode(chars)\n } catch (e: any) {\n c.err(e.message)\n }\n }\n if (!c.hasNext()) break // eos\n c.next() // <\n if (c.charIf(SLASH)) {\n // </ prepare for ending the element.\n c.white()\n const name = readQName(c)\n if (name.qName !== current.qName)\n c.err(`Expected </${current.qName}> but was </${name.qName}>`)\n stack.pop()\n current = last(stack)!\n c.white()\n c.readChar(GT)\n try {\n handler.endElement()\n } catch (e: any) {\n c.err(e.message)\n }\n } else if (c.charIf(QMARK)) {\n // <? Processing instruction\n untilTagClose(c)\n } else if (c.charIf(EXCL)) {\n // <! Declaration\n if (c.charIf(0x2d /* - */)) {\n c.readChar(0x2d)\n // <!-- Comment\n c.untilString('-->')\n c.read('-->')\n } else if (c.stringIf('[CDATA[')) {\n // <![CDATA[\n const charsStart = c.untilString(']]>')\n try {\n handler.cDataNode(str.substring(charsStart, c.position))\n } catch (e: any) {\n c.err(e.message)\n }\n c.read(']]>')\n } else {\n // <! Declaration\n untilTagClose(c)\n }\n } else {\n // < Prepare for beginning the element\n // Create a new stack element, inheriting the namespaces of the parent.\n const name: MutableDeep<QName> = readQName(c)\n current = {\n qName: name.qName,\n namespaceMap: new Map(),\n defaultNamespaceUri: current.defaultNamespaceUri,\n }\n stack.push(current)\n const attributes = xmlAttributes(c, current)\n // The namespaces can only be looked up after all attributes are parsed;\n // a namespace prefix may be defined after it's used on the same element.\n name.namespaceUri = namespaceLookup(name.prefix)\n for (const attributesKey in attributes) {\n const value = attributes[attributesKey]!\n const name = value.name\n // Attributes do not inherit the default namespace.\n if (name.prefix && !name.namespaceUri) {\n name.namespaceUri = namespaceLookup(name.prefix)\n }\n }\n\n try {\n handler.startElement(name, attributes)\n } catch (e: any) {\n c.err(e.message)\n }\n if (c.charIf(SLASH)) {\n c.readChar(GT)\n stack.pop()\n current = last(stack)!\n // Closed tag <example/>\n try {\n handler.endElement()\n } catch (e: any) {\n c.err(e.message)\n }\n } else {\n c.readChar(GT)\n }\n }\n }\n try {\n return handler.endDocument()\n } catch (e: any) {\n return c.err(e.message)\n }\n}\n\n/**\n * @private\n */\nexport type Namespaces = Map<string, Uri | null>\n\n// noinspection GrazieInspection\n/**\n * Given that the cursor is at a ' or \", reads the sequence of characters until an end quote is\n * reached.\n * The returned unescaped string is the text within the quotes.\n * @private\n */\nexport function readAttributeValue(c: StringReader): string {\n const quote = c.next()\n if (!QUOTES.has(quote)) c.err('Expected \\' or \"')\n const value = c.substringUntil((charCode) => charCode === quote)\n c.readChar(quote)\n return decodeEntities(value)\n}\n\n/**\n * Reads until the end of the tag >\n * @private\n */\nexport function untilTagClose(c: StringReader): void {\n while (true) {\n c.until((c) => c === APOS || c === QUOT || c === GT)\n const char = c.next()\n if (QUOTES.has(char)) {\n c.untilChar(char)\n c.next()\n } else {\n // >\n break\n }\n }\n}\n\n/**\n * Returns true if the char code is a valid xml name character.\n * @see https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar\n * @param charCode\n * @private\n */\nexport function isNameChar(charCode: number): boolean {\n if (charCode >= 0x61 /* a */) {\n if (charCode >= 0xb7 /* \u00B7 */) {\n if (charCode >= 0x300) {\n if (charCode >= 0x203f) {\n return charCode <= 0x2040\n } else {\n return charCode <= 0x36f\n }\n } else {\n return charCode === 0xb7 /* \u00B7 */\n }\n } else {\n return charCode <= 0x7a /* z */\n }\n } else {\n if (charCode >= 0x5f /* _ */) {\n return charCode === 0x5f\n } else {\n if (charCode >= 0x41 /* A */) {\n return charCode <= 0x5a /* Z */\n } else {\n if (charCode >= 0x2d /* - */) {\n if (charCode >= 0x30 /* 0 */) {\n return charCode <= 0x39 /* 9 */\n } else {\n return charCode <= 0x2e /* . */\n }\n } else {\n return false\n }\n }\n }\n }\n}\n\n/**\n * Reads an xml {@link QName}.\n * The {@link QName.namespaceUri} returned will be null; it must be separately looked up.\n *\n * @param reader The current string reader.\n * @private\n */\nexport function readQName(reader: StringReader): MutableDeep<QName> {\n const prefixOrLocalName = reader.substringWhile(isNameChar)\n let prefix: string | null, localPart: string, name: string\n if (reader.charIf(COLON)) {\n prefix = prefixOrLocalName\n localPart = reader.substringWhile(isNameChar)\n name = `${prefix}:${localPart}`\n } else {\n prefix = null\n localPart = prefixOrLocalName\n name = localPart\n }\n return { prefix, localPart, qName: name, namespaceUri: null }\n}\n\n/**\n * Reads a series of xml attributes, separated by whitespace.\n * Example: `ns1:key1=\"value1\" key2 key3='value3'`\n * Note: consumes all whitespace before and after attributes series.\n *\n * @return Returns a map of attribute `qName:string` to `Attribute` objects.\n *\n * @private\n */\nexport function xmlAttributes(\n reader: StringReader,\n stackElement: StackElement\n): MutableDeep<Attributes> {\n const attributes: MutableDeep<Attributes> = {}\n while (true) {\n reader.white()\n if (!isNameChar(reader.peek)) break\n const name = readQName(reader)\n reader.white()\n let value = ''\n if (reader.charIf(EQ)) {\n reader.white()\n value = readAttributeValue(reader)\n } else {\n // Attributes without values are valid in html, but not xml\n }\n\n if (name.prefix === 'xmlns') {\n name.namespaceUri = XMLNS\n stackElement.namespaceMap.set(\n name.localPart,\n value === '' ? null : value\n )\n } else if (!name.prefix && name.localPart === 'xmlns') {\n name.namespaceUri = XMLNS\n stackElement.defaultNamespaceUri = !value ? null : value\n }\n if (attributes[name.qName] != null)\n reader.err(`Attribute '${name.qName}' is already specified.`)\n attributes[name.qName] = { name, value }\n }\n return attributes\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin, ReportableError } from '@amazon/vinyl-util'\n\n/**\n * @private\n */\nexport const xmlSchemaErrorLocale = {\n atLeastElements:\n 'Expected at least {expected} occurrences of {property} but was {actual}',\n atMostElements:\n 'Expected at most {expected} occurrences of {property} but was {actual}',\n cyclicReferences: 'Cyclic reference detected',\n requiredAttribute: `Attribute '{property}' is required`,\n} as const\n\nexport class XmlSchemaError extends ReportableError {\n get [Symbol.toStringTag](): string {\n return 'XmlSchemaError'\n }\n\n constructor(message: string) {\n super(message, ErrorOrigin.PARSING)\n Object.setPrototypeOf(this, XmlSchemaError.prototype)\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 clone,\n type Cloneable,\n decodeEntities,\n IllegalStateError,\n last,\n substitute,\n toJson,\n} from '@amazon/vinyl-util'\n\nimport type { XmlRules } from './xmlRules'\nimport type { MappedXmlRules } from './mappedXmlRules'\nimport { EmptyRules, mapXmlRules, xmlRuleKey } from './mappedXmlRules'\nimport type { Attributes, ParseXmlHandler } from './ParseXmlHandler'\nimport type { QName } from './QName'\nimport { XmlSchemaError, xmlSchemaErrorLocale } from './XmlSchemaError'\n\ninterface StackElement {\n /**\n * The current object being built.\n */\n readonly element: any\n\n /**\n * The current element's text content. This will be appended to on every {@link characters}\n * callback.\n */\n characters: string\n\n /**\n * The current element rules.\n */\n readonly rules: MappedXmlRules<any>\n}\n\n/**\n * Choose the rule using namespaces first, if there is no match, query the wildcard namespace rules.\n */\nfunction getRule<T>(\n name: QName,\n rules: ReadonlyMap<string, T | undefined>\n): T | undefined {\n return rules.get(xmlRuleKey(name.localPart, name.namespaceUri))\n}\n\nexport interface ParseXmlHandlerOptions {\n readonly validateRules: boolean\n}\n\n/**\n * A {@link ParseXmlHandler} implementation that follows {@link XmlRules}, building an object of\n * the parameterized type.\n */\nexport class ParseXmlHandlerImpl<T> implements ParseXmlHandler<T> {\n private stack: StackElement[] = []\n\n private options: ParseXmlHandlerOptions\n private busy = false\n\n constructor(\n private readonly rules: MappedXmlRules<T>,\n options?: Partial<ParseXmlHandlerOptions>\n ) {\n this.options = { validateRules: true, ...options }\n }\n\n startDocument(): void {\n if (this.busy)\n throw new IllegalStateError('XML content handler is busy')\n this.busy = true\n const rules = this.rules\n this.stack.push({\n element: new XmlElementImpl(),\n rules,\n characters: '',\n })\n }\n\n startElement(name: QName, attributes: Attributes): void {\n const parent = last(this.stack)!\n let element: any = null\n const elementRule = getRule(name, parent.rules.elements)\n const rules = elementRule?.rules() ?? EmptyRules\n if (elementRule) {\n const prop = elementRule.property\n element = new XmlElementImpl(parent.element)\n if (elementRule.array) {\n const arr = parent.element[prop]\n if (Array.isArray(arr)) {\n arr.push(element)\n } else {\n parent.element[prop] = [element]\n }\n } else {\n if (parent.element[prop]) {\n throw new XmlSchemaError(\n `Expected single element with name ${name.qName}`\n )\n } else {\n parent.element[prop] = element\n }\n }\n\n const attributeRules = rules.attributes\n for (const k in attributes) {\n const attribute = attributes[k]!\n const name = attribute.name\n const attributeRule = getRule(name, attributeRules)\n if (attributeRule) {\n element[attributeRule.property] = attributeRule.parse(\n attribute.value\n )\n }\n }\n\n // Set attribute defaults:\n attributeRules.forEach((_value, key) => {\n const rule = attributeRules.get(key)!\n if (!(rule.property in element)) {\n if (rule.default != null) {\n element[rule.property] = rule.default\n } else if (this.options.validateRules && rule.required) {\n throw new XmlSchemaError(\n substitute(xmlSchemaErrorLocale.requiredAttribute, {\n property: rule.property,\n })\n )\n }\n }\n })\n }\n this.stack.push({\n element,\n rules,\n characters: '',\n })\n }\n\n textNode(str: string): void {\n const current = last(this.stack)!\n if (!current.rules.characters) return\n current.characters += decodeEntities(str.trim())\n }\n\n cDataNode(str: string): void {\n const current = last(this.stack)!\n if (!current.rules.characters) return\n current.characters += str\n }\n\n endElement(): void {\n const lastEl = this.stack.pop()!\n const charactersRule = lastEl.rules.characters\n if (charactersRule)\n lastEl.element[charactersRule.property] = charactersRule.parse(\n lastEl.characters\n )\n lastEl.rules.elements.forEach((rule) => {\n if (rule.array && !(rule.property in lastEl.element)) {\n if (rule.useEmptyArrays) {\n lastEl.element[rule.property] = []\n }\n }\n })\n this.validate(lastEl)\n }\n\n endDocument(): T & XmlElement<T> {\n this.busy = false\n const last = this.stack.pop()!\n this.validate(last)\n return last.element\n }\n\n private validate(current: StackElement) {\n if (!this.options.validateRules) return\n current.rules.elements.forEach((rule) => {\n const length = rule.array\n ? (current.element[rule.property]?.length ?? 0)\n : current.element[rule.property]\n ? 1\n : 0\n if (length < rule.minOccurs) {\n throw new XmlSchemaError(\n substitute(xmlSchemaErrorLocale.atLeastElements, {\n property: rule.property,\n expected: rule.minOccurs,\n actual: length,\n })\n )\n }\n if (rule.maxOccurs != null && length > rule.maxOccurs) {\n throw new XmlSchemaError(\n substitute(xmlSchemaErrorLocale.atMostElements, {\n property: rule.property,\n expected: rule.maxOccurs,\n actual: length,\n })\n )\n }\n })\n }\n}\n\n/**\n * Creates an XML content handler for the given parsing rules.\n *\n * @param rules\n * @param options\n */\nexport function parseXmlHandler<T extends object>(\n rules: XmlRules<T>,\n options?: Partial<ParseXmlHandlerOptions>\n): ParseXmlHandlerImpl<T> {\n return new ParseXmlHandlerImpl<T>(mapXmlRules(rules), options)\n}\n\n// Use a symbol to prevent parent from inclusion in property enumeration.\nconst parentSymbol = Symbol('parent')\n\nexport interface XmlElement<T = any> extends Cloneable<T & XmlElement<T>> {\n get parent(): XmlElement | null\n toJSON(): any\n}\n\nexport class XmlElementImpl<T> implements XmlElement<T> {\n [prop: keyof any]: any\n\n private [parentSymbol]: XmlElement | null\n\n constructor(parent: XmlElement | null = null) {\n this[parentSymbol] = parent\n }\n\n get parent(): XmlElement | null {\n return this[parentSymbol]\n }\n\n set parent(value: XmlElement | null) {\n this[parentSymbol] = value\n }\n\n clone(): T & XmlElementImpl<T> {\n const out: any = new XmlElementImpl(this.parent)\n for (const key in this) {\n // Clone all children, setting their parent references to the new cloned parent.\n const child: any = clone(this[key])\n if (Array.isArray(child)) {\n for (const e of child) {\n if (typeof e === 'object' && 'parent' in e) e.parent = out\n }\n } else if (typeof child === 'object' && 'parent' in child) {\n child.parent = out\n }\n out[key] = child\n }\n return out\n }\n\n toJSON(): any {\n const out: any = {}\n for (const key in this) {\n out[key] = toJson(this[key])\n }\n return out\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { parseIntSafe } from '@amazon/vinyl-util'\nimport { throwParsingError } from '../error/parsingError'\n\n/**\n * A range of bytes, [from, to (optional, inclusive)].\n */\nexport type ByteRange = readonly [number, number | null]\n\nconst byteRangeExp = /^(-?[0-9]+)-(-?[0-9]*)$/\n\nexport function parseByteRange(str: string): ByteRange {\n const match = str ? byteRangeExp.exec(str) : null\n if (!match) throwParsingError(`invalid byte range: '${str}'`)\n let start = parseInt(match[1])\n // Convert possibly-negative Int32 overflow value to its Uint32 equivalent\n // (reinterpret 32-bit signed integer bits as unsigned)\n if (start < 0) start >>>= 0\n let end = parseIntSafe(match[2])\n if (end != null && end < 0) end = end >>> 0\n return [start, end]\n}\n\n/**\n * Returns the string representation of a {@link ByteRange} value.\n *\n * @param value\n */\nexport function stringifyByteRange(value: ByteRange): string {\n const end = value[1]\n return `${value[0]}-${end == null ? '' : end}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { throwParsingError } from '../error/parsingError'\n\n/**\n * A numerator and denominator.\n */\nexport type Ratio = readonly [number, number]\n\n/**\n * The XSD specifies `[0-9]*`, and not `[0-9]+`, which would match `'23:'`\n * For missing dimensions, default to 1.\n */\nconst ratioRegExp = /^([0-9]*):([0-9]*)$/\n\n/**\n * Parses a string representing a ratio into [number, number].\n * The string must satisfy the pattern: `/^([0-9]*):([0-9]*)$/`\n * Examples:\n * ```\n * parseRatio('4:3') // [4, 3]\n * parseRatio('16:9') // [16, 9]\n * parseRatio('2:') // [2, 1]\n * ```\n *\n * @private\n */\nexport function parseRatio(str: string): Ratio {\n const match = str ? ratioRegExp.exec(str) : null\n if (!match) throwParsingError(`invalid ratio format: ${str}`)\n return [parseInt(match[1] || '1'), parseInt(match[2] || '1')]\n}\n\n/**\n * Returns the string representation of a {@link Ratio} value.\n *\n * @param value\n */\nexport function stringifyRatio(value: Ratio): string {\n return `${value[0]}:${value[1]}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { throwParsingError } from '../error/parsingError'\n\nexport type FrameRate = readonly [number, number]\n\nconst framerateRegexp = /^(\\d+)(?:\\/(\\d+))?$/\n\n/**\n * Parses a string into a {@link FrameRate}\n *\n * @private\n */\nexport function parseFrameRate(str: string): FrameRate {\n const match = str ? framerateRegexp.exec(str) : null\n if (!match) throwParsingError(`invalid frame rate: '${str}'`)\n return [parseInt(match[1]), parseInt(match[2] || '1')]\n}\n\n/**\n * Returns the string representation of a {@link FrameRate} value.\n *\n * @param value\n */\nexport function stringifyFrameRate(value: FrameRate): string {\n return value[1] === 1 ? value[0].toString() : `${value[0]}/${value[1]}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Parser definitions for a dash manifest.\n * Attribute order does not matter, element order matters for writing.\n *\n * @module\n */\n\nimport type { actuateType, UriType } from '@amazon/vinyl-xml'\nimport {\n assertActuateEnum,\n attr,\n attrBoolean,\n attrDateTime,\n attrFloat,\n attrInt,\n attrString,\n charactersString,\n element,\n elements,\n type XmlRules,\n} from '@amazon/vinyl-xml'\nimport { ErrorOrigin, stringify } from '@amazon/vinyl-util'\nimport { isOneOf, number, type Validator } from '@amazon/vinyl-validation'\nimport { parseDuration, stringifyDuration } from '../duration/duration'\nimport { parseByteRange, stringifyByteRange } from '../media/byteRange'\nimport { parseRatio, stringifyRatio } from '../media/ratio'\nimport { parseFrameRate, stringifyFrameRate } from '../media/frameRate'\nimport type {\n AdaptationSetType,\n BaseURLType,\n ConditionalUintType,\n ContentComponentType,\n DashManifest,\n DescriptorType,\n EventStreamType,\n EventType,\n MetricsType,\n MPDtype,\n MultipleSegmentBaseType,\n PeriodType,\n PresentationType,\n ProgramInformationType,\n RangeType,\n RepresentationBaseType,\n RepresentationType,\n SegmentBaseType,\n SegmentListType,\n SegmentTemplateType,\n SegmentTimelineType,\n SegmentTimelineTypeSType,\n SegmentURLType,\n SubRepresentationType,\n SubsetType,\n SwitchingType,\n SwitchingTypeType,\n URLType,\n VideoScanType,\n} from '../xmlns/mpeg/dash/schema/mpd/2011'\n\nexport const dashNamespaceUri = 'urn:mpeg:dash:schema:mpd:2011'\n\nexport function dashManifestXmlRules(): XmlRules<DashManifest> {\n const attrActuateType = attr<actuateType>(assertActuateEnum, stringify, {\n default: 'onRequest',\n } as const)\n\n const descriptorType: XmlRules<DescriptorType> = {\n id: attrString,\n schemeIdUri: attrString({ required: true }),\n value: attrString,\n } as const\n\n const baseURLType: XmlRules<BaseURLType> = {\n availabilityTimeComplete: attrBoolean,\n availabilityTimeOffset: attrFloat,\n byteRange: attrString,\n serviceLocation: attrString,\n _content: charactersString,\n } as const\n\n const contentComponentType: XmlRules<ContentComponentType> = {\n contentType: attrString,\n id: attrInt,\n lang: attrString,\n par: attr(parseRatio, stringifyRatio),\n Accessibility: elements(descriptorType),\n Rating: elements(descriptorType),\n Role: elements(descriptorType),\n Viewpoint: elements(descriptorType),\n } as const\n\n const urlType: XmlRules<URLType> = {\n range: attr(parseByteRange, stringifyByteRange),\n sourceURL: attrString,\n } as const\n\n const uriType: XmlRules<UriType> = { _content: charactersString } as const\n\n const segmentBaseType: XmlRules<SegmentBaseType> = {\n Initialization: element(urlType),\n RepresentationIndex: element(urlType),\n availabilityTimeComplete: attrBoolean,\n availabilityTimeOffset: attrInt,\n indexRange: attr(parseByteRange, stringifyByteRange),\n indexRangeExact: attrBoolean({ default: false }),\n presentationTimeOffset: attrFloat,\n timescale: attrInt,\n } as const\n\n const segmentTimelineTypeSType: XmlRules<SegmentTimelineTypeSType> = {\n d: attrInt({ required: true }),\n n: attrInt,\n r: attrInt({ default: 0 }),\n t: attrInt,\n } as const\n\n const segmentTimelineType: XmlRules<SegmentTimelineType> = {\n S: elements(segmentTimelineTypeSType),\n } as const\n\n const multipleSegmentBaseType: XmlRules<MultipleSegmentBaseType> = {\n ...segmentBaseType,\n SegmentTimeline: element(segmentTimelineType),\n BitstreamSwitching: element(urlType),\n duration: attrInt,\n startNumber: attrInt,\n } as const\n\n const segmentURLType: XmlRules<SegmentURLType> = {\n index: attrString,\n indexRange: attr(parseByteRange, stringifyByteRange),\n media: attrString,\n mediaRange: attr(parseByteRange, stringifyByteRange),\n } as const\n\n const segmentListType: XmlRules<SegmentListType> = {\n ...multipleSegmentBaseType,\n actuate: attrActuateType,\n href: attrString,\n SegmentURL: elements(segmentURLType),\n } as const\n\n const segmentTemplateType: XmlRules<SegmentTemplateType> = {\n ...multipleSegmentBaseType,\n bitstreamSwitching: attrString,\n index: attrString,\n initialization: attrString,\n media: attrString,\n } as const\n\n const subsetType: XmlRules<SubsetType> = {\n contains: attr(parseIntVector, stringifyIntVector, { required: true }),\n id: attrString,\n } as const\n\n const eventType: XmlRules<EventType> = {\n duration: attrInt,\n id: attrInt,\n messageData: attrString,\n presentationTime: attrInt({ default: 0 }),\n } as const\n\n const eventStreamType: XmlRules<EventStreamType> = {\n Event: elements(eventType),\n actuate: attrActuateType,\n href: attrString,\n messageData: attrString,\n schemeIdUri: attrString({ required: true }),\n timescale: attrInt,\n value: attrString,\n } as const\n\n const switchingType: XmlRules<SwitchingType> = {\n interval: attrInt({ required: true }),\n type: attr(parseSwitchingTypeType, stringify),\n } as const\n\n const representationBaseType: XmlRules<RepresentationBaseType> = {\n FramePacking: elements(descriptorType),\n AudioChannelConfiguration: elements(descriptorType),\n ContentProtection: elements(descriptorType),\n EssentialProperty: elements(descriptorType),\n SupplementalProperty: elements(descriptorType),\n InbandEventStream: elements(eventStreamType),\n Switching: elements(switchingType),\n audioSamplingRate: attr(parseIntVector, stringifyIntVector),\n codecs: attrString,\n codingDependency: attrBoolean,\n frameRate: attr(parseFrameRate, stringifyFrameRate),\n height: attrInt,\n maximumSAPPeriod: attrInt,\n maxPlayoutRate: attrInt,\n mimeType: attrString,\n profiles: attr(parseProfiles, stringifyProfiles),\n sar: attr(parseRatio, stringifyRatio),\n scanType: attr(parseVideoScan, stringify),\n segmentProfiles: attrString,\n startWithSAP: attr(parseSap, stringify),\n width: attrInt,\n } as const\n\n const subRepresentationType: XmlRules<SubRepresentationType> = {\n ...representationBaseType,\n bandwidth: attrInt,\n contentComponent: attr(parseStringVector, stringifyStringVector),\n dependencyLevel: attr(parseIntVector, stringifyIntVector),\n level: attrInt,\n } as const\n\n const representationType: XmlRules<RepresentationType> = {\n ...representationBaseType,\n bandwidth: attrInt({ required: true }),\n bitrate: attrInt,\n dependencyId: attr(parseStringVector, stringifyStringVector),\n id: attrString({ required: true }),\n mediaStreamStructureId: attr(parseStringVector, stringifyStringVector),\n qualityRanking: attrInt,\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n SubRepresentation: elements(subRepresentationType),\n } as const\n\n const adaptationSetType: XmlRules<AdaptationSetType> = {\n ...representationBaseType,\n Accessibility: elements(descriptorType),\n Role: elements(descriptorType),\n Rating: elements(descriptorType),\n Viewpoint: elements(descriptorType),\n ContentComponent: elements(contentComponentType),\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n Representation: elements(representationType),\n actuate: attrActuateType,\n bitstreamSwitching: attrBoolean,\n contentType: attrString,\n group: attrInt,\n href: attrString,\n id: attrInt,\n lang: attrString,\n maxBandwidth: attrInt,\n maxFrameRate: attr(parseFrameRate, stringifyFrameRate),\n maxHeight: attrInt,\n maxWidth: attrInt,\n minBandwidth: attrInt,\n minFrameRate: attr(parseFrameRate, stringifyFrameRate),\n minHeight: attrInt,\n minWidth: attrInt,\n par: attr(parseRatio, stringifyRatio),\n segmentAlignment: attr(parseConditionalUint, stringify, {\n default: false,\n }),\n selectionPriority: attrInt({\n default: 1,\n }),\n subsegmentAlignment: attr(parseConditionalUint, stringify, {\n default: false,\n }),\n subsegmentStartsWithSAP: attr(parseSap, stringify, { default: 0 }),\n } as const\n\n const rangeType: XmlRules<RangeType> = {\n duration: attr(parseDuration, stringifyDuration),\n starttime: attr(parseDuration, stringifyDuration),\n } as const\n\n const metricsType: XmlRules<MetricsType> = {\n metrics: attrString({ required: true }),\n Range: elements(rangeType),\n Reporting: elements(descriptorType, { minOccurs: 1 }),\n } as const\n\n const periodType: XmlRules<PeriodType> = {\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n AssetIdentifier: element(descriptorType),\n EventStream: elements(eventStreamType),\n AdaptationSet: elements(adaptationSetType),\n Subset: elements(subsetType),\n SupplementalProperty: elements(descriptorType),\n actuate: attrActuateType,\n bitstreamSwitching: attrBoolean({ default: false }),\n duration: attr(parseDuration, stringifyDuration),\n href: attrString,\n id: attrString,\n start: attr(parseDuration, stringifyDuration),\n } as const\n\n const programInformationType: XmlRules<ProgramInformationType> = {\n lang: attrString,\n moreInformationURL: attrString,\n Copyright: attrString,\n Source: attrString,\n Title: attrString,\n } as const\n\n const mpdType: XmlRules<MPDtype> = {\n ProgramInformation: elements(programInformationType),\n BaseURL: elements(baseURLType),\n Location: elements(uriType),\n Period: elements(periodType, { minOccurs: 1 }),\n Metrics: elements(metricsType),\n EssentialProperty: elements(descriptorType),\n SupplementalProperty: elements(descriptorType),\n UTCTiming: elements(descriptorType),\n availabilityEndTime: attrDateTime,\n availabilityStartTime: attrDateTime,\n id: attrString,\n maxSegmentDuration: attr(parseDuration, stringifyDuration),\n maxSubsegmentDuration: attr(parseDuration, stringifyDuration),\n mediaPresentationDuration: attr(parseDuration, stringifyDuration),\n minBufferTime: attr(parseDuration, stringifyDuration, {\n required: true,\n }),\n minimumUpdatePeriod: attr(parseDuration, stringifyDuration),\n profiles: attr(parseProfiles, stringifyProfiles, { required: true }),\n publishTime: attrDateTime,\n suggestedPresentationDelay: attr(parseDuration, stringifyDuration),\n timeShiftBufferDepth: attr(parseDuration, stringifyDuration),\n type: attr(parsePresentationTypeType, stringify, {\n default: 'static',\n } as const),\n } as const\n\n return {\n MPD: element(mpdType, {\n required: true,\n namespaceUri: dashNamespaceUri,\n }),\n } as const\n}\n\n/**\n * Parses a comma delimited list of profiles.\n * Profile values are not whitespace trimmed.\n *\n * @param str\n */\nexport function parseProfiles(str: string): readonly string[] {\n return str.split(',')\n}\n\n/**\n * Returns the string representation of a {@link FrameRate} value.\n *\n * @param value\n */\nexport function stringifyProfiles(value: readonly string[]): string {\n return value.join(',')\n}\n\nconst videoScanTypeValidator: Validator<VideoScanType> = isOneOf(\n 'progressive',\n 'interlaced',\n 'unknown'\n)\n\n/**\n * @private\n */\nexport function parseVideoScan(str: string): VideoScanType {\n videoScanTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\nconst switchingTypeTypeValidator: Validator<SwitchingTypeType> = isOneOf(\n 'media',\n 'bitstream'\n)\n\n/**\n * @private\n */\nexport function parseSwitchingTypeType(str: string): SwitchingTypeType {\n switchingTypeTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\nconst validateSap: Validator<number> = number().within(0, 6)\n\n/**\n * @private\n */\nexport function parseSap(str: string): number {\n const number = parseInt(str)\n validateSap.assert(number, ErrorOrigin.PARSING)\n return number\n}\n\n/**\n * Splits a string by whitespace.\n *\n * @private\n */\nexport function parseStringVector(str: string): readonly string[] {\n return str.split(/\\s+/)\n}\n\n/**\n * Returns the string representation of a string vector value.\n *\n * @param value\n */\nexport function stringifyStringVector(value: readonly string[]): string {\n return value.join(' ')\n}\n\n/**\n * Splits a string by whitespace and parses as int.\n *\n * @private\n */\nexport function parseIntVector(str: string): readonly number[] {\n return str.split(/\\s+/).map((subStr) => parseInt(subStr))\n}\n\n/**\n * Returns the string representation of an int vector value.\n *\n * @param value\n */\nexport function stringifyIntVector(value: readonly number[]): string {\n return value.join(' ')\n}\n\nconst presentationTypeValidator: Validator<PresentationType> = isOneOf(\n 'static',\n 'dynamic'\n)\n\n/**\n * Asserts that the given string is one of the {@link PresentationType} enumerated values.\n * @param str\n */\nexport function parsePresentationTypeType(str: string): PresentationType {\n presentationTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\n/**\n * Parses a string into true, false, or a number.\n *\n * @private\n */\nexport function parseConditionalUint(str: string): ConditionalUintType {\n const lower = str.toLowerCase()\n switch (lower) {\n case 'true':\n return true\n case 'false':\n return false\n default:\n return parseInt(str)\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 { Base64BinaryType } from '@amazon/vinyl-xml'\n\n/**\n * Cenc content protection xml types.\n *\n * @see https://github.com/sannies/rtp2dash/blob/master/src/main/resources/auxxsd/cenc.xsd\n * @module\n */\n\nexport const CENC_NAMESPACE_URI = 'urn:mpeg:cenc:2013'\n\n/**\n * A 128-bit integer written in canonical UUID notation.\n * Must be in the form:\n * `[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}`\n */\nexport type KeyIdType = string\n\nexport interface CencContentProtection {\n readonly default_KID?: readonly KeyIdType[]\n readonly pssh?: Base64BinaryType\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n parseStringVector,\n stringifyStringVector,\n} from '../../dashManifestXmlRules'\nimport type { XmlRules } from '@amazon/vinyl-xml'\nimport { attr, charactersString, element } from '@amazon/vinyl-xml'\nimport type { CencContentProtection } from '../../../xmlns/mpeg/cenc/2013'\nimport { CENC_NAMESPACE_URI } from '../../../xmlns/mpeg/cenc/2013'\n\n/**\n * A parser for ContentProtection elements using the cenc namespace.\n * @see https://github.com/sannies/rtp2dash/blob/master/src/main/resources/auxxsd/cenc.xsd\n */\nexport const cencXmlRules: XmlRules<CencContentProtection> = {\n default_KID: attr(parseStringVector, stringifyStringVector, {\n namespaceUri: CENC_NAMESPACE_URI,\n }),\n pssh: element(\n {\n _content: charactersString,\n },\n {\n namespaceUri: CENC_NAMESPACE_URI,\n }\n ),\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { element, elements, type XmlRules } from '@amazon/vinyl-xml'\nimport { dashNamespaceUri } from '../../dashManifestXmlRules'\n\n/**\n * ContentProtection extension point for Dash manifests.\n *\n * @module\n */\n\nexport interface WithProtections<T> {\n readonly ContentProtection?: readonly T[]\n}\n\nexport interface RepresentationTypeProtections<T> extends WithProtections<T> {\n readonly SubRepresentation?: readonly WithProtections<T>[]\n}\n\nexport interface AdaptationSetProtections<T> extends WithProtections<T> {\n readonly Representation?: readonly RepresentationTypeProtections<T>[]\n}\n\nexport interface PeriodProtections<T> {\n readonly AdaptationSet?: readonly AdaptationSetProtections<T>[]\n}\n\nexport interface MPDProtections<T> {\n readonly Period: readonly PeriodProtections<T>[]\n}\n\nexport interface DashProtections<T> {\n readonly MPD: MPDProtections<T>\n}\n\n/**\n * Creates a dash extension for content protection parsing rules.\n *\n * @param contentProtectionRules Rules to be used when processing `ContentProtection` elements.\n * @return Returns a rules map that should be merged with the dash manifest rules.\n */\nexport function createDashProtectionXmlRules<T extends object>(\n contentProtectionRules: XmlRules<T>\n): XmlRules<DashProtections<T>> {\n const withProtections: XmlRules<WithProtections<T>> = {\n ContentProtection: elements(contentProtectionRules),\n } as const\n\n return {\n MPD: element<MPDProtections<T>>(\n {\n Period: elements<PeriodProtections<T>>(\n {\n AdaptationSet: elements<AdaptationSetProtections<T>>({\n ...withProtections,\n Representation: elements<\n RepresentationTypeProtections<T>\n >({\n ...withProtections,\n SubRepresentation:\n elements<WithProtections<T>>(\n withProtections\n ),\n }),\n }),\n },\n {\n minOccurs: 1,\n }\n ),\n },\n { required: true, namespaceUri: dashNamespaceUri } as const\n ),\n } as const\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Base64BinaryType } from '@amazon/vinyl-xml'\n\n/**\n * Cenc content protection playready.\n *\n * @see https://learn.microsoft.com/en-us/playready/specifications/mpeg-dash-playready#21-dash-contentprotection-descriptor-elements\n * @module\n */\n\nexport const PLAY_READY_NAMESPACE_URI = 'urn:microsoft:playready'\n\nexport interface PlayreadyContentProtection {\n readonly pro?: Base64BinaryType\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { charactersString, element, type XmlRules } from '@amazon/vinyl-xml'\nimport type { PlayreadyContentProtection } from '../../../xmlns/microsoft/playready'\nimport { PLAY_READY_NAMESPACE_URI } from '../../../xmlns/microsoft/playready'\n\nexport const playreadyXmlRules: XmlRules<PlayreadyContentProtection> = {\n pro: element(\n {\n _content: charactersString,\n },\n {\n namespaceUri: PLAY_READY_NAMESPACE_URI,\n }\n ),\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ReservedXmlRuleKeys } from '@amazon/vinyl-xml'\nimport {\n mapXmlRules,\n type Merged,\n mergeXmlRules,\n parseXml,\n ParseXmlHandlerImpl,\n stringifyXml,\n} from '@amazon/vinyl-xml'\nimport type { PlayreadyContentProtection } from '../xmlns/microsoft/playready'\nimport type { CencContentProtection } from '../xmlns/mpeg/cenc/2013'\nimport type {\n DashManifest,\n DescriptorType,\n} from '../xmlns/mpeg/dash/schema/mpd/2011'\nimport { dashManifestXmlRules } from './dashManifestXmlRules'\nimport { cencXmlRules } from './ext/drm/cencXmlRules'\nimport type { DashProtections } from './ext/drm/contentProtection'\nimport { createDashProtectionXmlRules } from './ext/drm/contentProtection'\nimport { playreadyXmlRules } from './ext/drm/playreadyXmlRules'\nimport type { OptionalDeep } from '@amazon/vinyl-util'\n\n/**\n * Creates a Dash Manifest parser with supported extensions.\n *\n * @module\n */\n\nexport type DashDrmManifest = Merged<\n DashManifest & DashProtections<ContentProtection>\n>\n\nexport interface ContentProtection\n extends DescriptorType, CencContentProtection, PlayreadyContentProtection {}\n\nconst dashDrmRules = mergeXmlRules(\n dashManifestXmlRules(),\n createDashProtectionXmlRules(cencXmlRules),\n createDashProtectionXmlRules(playreadyXmlRules)\n)\n\nconst dashDrmRulesMapped = mapXmlRules(dashDrmRules)\n\n/**\n * A Content handler for a dash manifest.\n */\nfunction dashManifestHandler() {\n return new ParseXmlHandlerImpl(dashDrmRulesMapped)\n}\n\n/**\n * Parses a Dash Manifest, according to the mpd:2011 schema.\n * @see https://raw.githubusercontent.com/Dash-Industry-Forum/MPEG-Conformance-and-reference-source/master/conformance/MPDValidator/schemas/DASH-MPD.xsd\n * @param manifest\n */\nexport function parseDashManifest(manifest: string): DashDrmManifest {\n return parseXml(manifest, dashManifestHandler())\n}\n\nexport function stringifyDashManifest(\n manifest: OptionalDeep<DashDrmManifest, ReservedXmlRuleKeys>\n): string {\n return stringifyXml(manifest, dashDrmRulesMapped)\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An Amazon flac/opus catalog track example.\n * A SegmentList with SegmentURL elements using media ranges.\n *\n * (Mothership connection, parliament)\n */\n// language=XML\nexport const dash_segmentListMediaRange = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<MPD minBufferTime=\"PT2S\" type=\"static\" mediaPresentationDuration=\"PT400.0133056640625S\" profiles=\"urn:mpeg:dash:profile:isoff-on-demand:2011\" xmlns=\"urn:mpeg:dash:schema:mpd:2011\" xmlns:amz-music=\"urn:amazon:music:drm:2019\" xmlns:cenc=\"urn:mpeg:cenc:2013\" xmlns:mspr=\"urn:microsoft:playready\">\n <Period id=\"0\">\n <AdaptationSet id=\"1\" contentType=\"audio\" selectionPriority=\"2000\">\n <ContentProtection schemeIdUri=\"urn:mpeg:dash:mp4protection:2011\" cenc:default_KID=\"53443d2c-a548-037d-dfca-b6873a3b16a7\" value=\"cenc\"/>\n <ContentProtection schemeIdUri=\"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed\">\n <cenc:pssh>AAAAXXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAD0SEFNEPSylSAN938q2hzo7FqcaC0FtYXpvbk11c2ljIhxjaWQ6VTBROUxLVklBMzNmeXJhSE9qc1dwdz09</cenc:pssh>\n </ContentProtection>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:mpegB:cicp:ProgramLoudness\" value=\"-13.5 LUFS\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:trackType\" value=\"HD\"/>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:dash:adaptation-set-switching:2016\" value=\"2\"/>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:mpegB:cicp:AnchorLoudness\" value=\"-11.7 LUFS\"/>\n <Representation id=\"1\" qualityRanking=\"4\" codecs=\"flac\" audioSamplingRate=\"44100\" bandwidth=\"1021104\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:bitDepth\" value=\"16\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/a3ce7553-e9a3-3ca6-8fda-8f354b8cee0f.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=HD_44&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"44100\" duration=\"441000\">\n <Initialization range=\"0-1067\"/>\n <SegmentURL mediaRange=\"1580-1124387\"/>\n <SegmentURL mediaRange=\"1124388-2301681\"/>\n <SegmentURL mediaRange=\"2301682-3413884\"/>\n <SegmentURL mediaRange=\"3413885-4563668\"/>\n <SegmentURL mediaRange=\"4563669-5789595\"/>\n <SegmentURL mediaRange=\"5789596-7027203\"/>\n <SegmentURL mediaRange=\"7027204-8258589\"/>\n <SegmentURL mediaRange=\"8258590-9476689\"/>\n <SegmentURL mediaRange=\"9476690-10663879\"/>\n <SegmentURL mediaRange=\"10663880-11801656\"/>\n <SegmentURL mediaRange=\"11801657-13028295\"/>\n <SegmentURL mediaRange=\"13028296-14259035\"/>\n <SegmentURL mediaRange=\"14259036-15501034\"/>\n <SegmentURL mediaRange=\"15501035-16715074\"/>\n <SegmentURL mediaRange=\"16715075-17945696\"/>\n <SegmentURL mediaRange=\"17945697-19181760\"/>\n <SegmentURL mediaRange=\"19181761-20430664\"/>\n <SegmentURL mediaRange=\"20430665-21668186\"/>\n <SegmentURL mediaRange=\"21668187-22889588\"/>\n <SegmentURL mediaRange=\"22889589-24105876\"/>\n <SegmentURL mediaRange=\"24105877-25286931\"/>\n <SegmentURL mediaRange=\"25286932-26474293\"/>\n <SegmentURL mediaRange=\"26474294-27717336\"/>\n <SegmentURL mediaRange=\"27717337-28944000\"/>\n <SegmentURL mediaRange=\"28944001-30217943\"/>\n <SegmentURL mediaRange=\"30217944-31494322\"/>\n <SegmentURL mediaRange=\"31494323-32753722\"/>\n <SegmentURL mediaRange=\"32753723-33819438\"/>\n <SegmentURL mediaRange=\"33819439-34871800\"/>\n <SegmentURL mediaRange=\"34871801-35987451\"/>\n <SegmentURL mediaRange=\"35987452-37198633\"/>\n <SegmentURL mediaRange=\"37198634-38400513\"/>\n <SegmentURL mediaRange=\"38400514-39590378\"/>\n <SegmentURL mediaRange=\"39590379-40775418\"/>\n <SegmentURL mediaRange=\"40775419-42023162\"/>\n <SegmentURL mediaRange=\"42023163-43262782\"/>\n <SegmentURL mediaRange=\"43262783-44466388\"/>\n <SegmentURL mediaRange=\"44466389-45664349\"/>\n <SegmentURL mediaRange=\"45664350-46838625\"/>\n <SegmentURL mediaRange=\"46838626-47421889\"/>\n </SegmentList>\n </Representation>\n <Representation id=\"2\" qualityRanking=\"3\" codecs=\"flac\" audioSamplingRate=\"48000\" bandwidth=\"1855801\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:bitDepth\" value=\"24\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/f5b706c9-5892-3a17-9d01-4da362cfad35.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=UHD_48&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"48000\" duration=\"480000\">\n <Initialization range=\"0-1067\"/>\n <SegmentURL mediaRange=\"1580-2140301\"/>\n <SegmentURL mediaRange=\"2140302-4352961\"/>\n <SegmentURL mediaRange=\"4352962-6499834\"/>\n <SegmentURL mediaRange=\"6499835-8687556\"/>\n <SegmentURL mediaRange=\"8687557-10955471\"/>\n <SegmentURL mediaRange=\"10955472-13235819\"/>\n <SegmentURL mediaRange=\"13235820-15509496\"/>\n <SegmentURL mediaRange=\"15509497-17768731\"/>\n <SegmentURL mediaRange=\"17768732-19993372\"/>\n <SegmentURL mediaRange=\"19993373-22167125\"/>\n <SegmentURL mediaRange=\"22167126-24434254\"/>\n <SegmentURL mediaRange=\"24434255-26706557\"/>\n <SegmentURL mediaRange=\"26706558-28990196\"/>\n <SegmentURL mediaRange=\"28990197-31245239\"/>\n <SegmentURL mediaRange=\"31245240-33516976\"/>\n <SegmentURL mediaRange=\"33516977-35793411\"/>\n <SegmentURL mediaRange=\"35793412-38083225\"/>\n <SegmentURL mediaRange=\"38083226-40361780\"/>\n <SegmentURL mediaRange=\"40361781-42623154\"/>\n <SegmentURL mediaRange=\"42623155-44879987\"/>\n <SegmentURL mediaRange=\"44879988-47098315\"/>\n <SegmentURL mediaRange=\"47098316-49322904\"/>\n <SegmentURL mediaRange=\"49322905-51607367\"/>\n <SegmentURL mediaRange=\"51607368-53874862\"/>\n <SegmentURL mediaRange=\"53874863-56192866\"/>\n <SegmentURL mediaRange=\"56192867-58512617\"/>\n <SegmentURL mediaRange=\"58512618-60815181\"/>\n <SegmentURL mediaRange=\"60815182-62914181\"/>\n <SegmentURL mediaRange=\"62914182-65000611\"/>\n <SegmentURL mediaRange=\"65000612-67150839\"/>\n <SegmentURL mediaRange=\"67150840-69402495\"/>\n <SegmentURL mediaRange=\"69402496-71643660\"/>\n <SegmentURL mediaRange=\"71643661-73870974\"/>\n <SegmentURL mediaRange=\"73870975-76093618\"/>\n <SegmentURL mediaRange=\"76093619-78383457\"/>\n <SegmentURL mediaRange=\"78383458-80665083\"/>\n <SegmentURL mediaRange=\"80665084-82909593\"/>\n <SegmentURL mediaRange=\"82909594-85145972\"/>\n <SegmentURL mediaRange=\"85145973-87356513\"/>\n <SegmentURL mediaRange=\"87356514-88804457\"/>\n </SegmentList>\n </Representation>\n <Representation id=\"3\" qualityRanking=\"2\" codecs=\"flac\" audioSamplingRate=\"96000\" bandwidth=\"3278164\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:bitDepth\" value=\"24\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/02b134c4-8144-3ab1-b125-5af2d0133d5b.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=UHD_96&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"96000\" duration=\"960000\">\n <Initialization range=\"0-1067\"/>\n <SegmentURL mediaRange=\"1580-3813567\"/>\n <SegmentURL mediaRange=\"3813568-7746339\"/>\n <SegmentURL mediaRange=\"7746340-11599579\"/>\n <SegmentURL mediaRange=\"11599580-15505023\"/>\n <SegmentURL mediaRange=\"15505024-19519493\"/>\n <SegmentURL mediaRange=\"19519494-23556777\"/>\n <SegmentURL mediaRange=\"23556778-27581158\"/>\n <SegmentURL mediaRange=\"27581159-31586807\"/>\n <SegmentURL mediaRange=\"31586808-35549718\"/>\n <SegmentURL mediaRange=\"35549719-39435585\"/>\n <SegmentURL mediaRange=\"39435586-43443650\"/>\n <SegmentURL mediaRange=\"43443651-47467685\"/>\n <SegmentURL mediaRange=\"47467686-51498910\"/>\n <SegmentURL mediaRange=\"51498911-55496614\"/>\n <SegmentURL mediaRange=\"55496615-59513566\"/>\n <SegmentURL mediaRange=\"59513567-63538385\"/>\n <SegmentURL mediaRange=\"63538386-67582593\"/>\n <SegmentURL mediaRange=\"67582594-71608871\"/>\n <SegmentURL mediaRange=\"71608872-75612860\"/>\n <SegmentURL mediaRange=\"75612861-79601033\"/>\n <SegmentURL mediaRange=\"79601034-83549776\"/>\n <SegmentURL mediaRange=\"83549777-87488907\"/>\n <SegmentURL mediaRange=\"87488908-91534801\"/>\n <SegmentURL mediaRange=\"91534802-95552040\"/>\n <SegmentURL mediaRange=\"95552041-99649744\"/>\n <SegmentURL mediaRange=\"99649745-103743373\"/>\n <SegmentURL mediaRange=\"103743374-107815594\"/>\n <SegmentURL mediaRange=\"107815595-111613915\"/>\n <SegmentURL mediaRange=\"111613916-115390443\"/>\n <SegmentURL mediaRange=\"115390444-119249732\"/>\n <SegmentURL mediaRange=\"119249733-123233807\"/>\n <SegmentURL mediaRange=\"123233808-127209398\"/>\n <SegmentURL mediaRange=\"127209399-131167116\"/>\n <SegmentURL mediaRange=\"131167117-135119879\"/>\n <SegmentURL mediaRange=\"135119880-139163685\"/>\n <SegmentURL mediaRange=\"139163686-143201079\"/>\n <SegmentURL mediaRange=\"143201080-147195194\"/>\n <SegmentURL mediaRange=\"147195195-151164220\"/>\n <SegmentURL mediaRange=\"151164221-155096800\"/>\n <SegmentURL mediaRange=\"155096801-157757393\"/>\n </SegmentList>\n </Representation>\n <Representation id=\"4\" qualityRanking=\"1\" codecs=\"flac\" audioSamplingRate=\"192000\" bandwidth=\"5666448\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:bitDepth\" value=\"24\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/edf9f9cb-46ce-33bd-96e1-8456547fbef4.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=UHD_192&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"192000\" duration=\"1920000\">\n <Initialization range=\"0-1067\"/>\n <SegmentURL mediaRange=\"1580-6720450\"/>\n <SegmentURL mediaRange=\"6720451-13610816\"/>\n <SegmentURL mediaRange=\"13610817-20415282\"/>\n <SegmentURL mediaRange=\"20415283-27272412\"/>\n <SegmentURL mediaRange=\"27272413-34250251\"/>\n <SegmentURL mediaRange=\"34250252-41260291\"/>\n <SegmentURL mediaRange=\"41260292-48255248\"/>\n <SegmentURL mediaRange=\"48255249-55224355\"/>\n <SegmentURL mediaRange=\"55224356-62157463\"/>\n <SegmentURL mediaRange=\"62157464-68996670\"/>\n <SegmentURL mediaRange=\"68996671-75970335\"/>\n <SegmentURL mediaRange=\"75970336-82964531\"/>\n <SegmentURL mediaRange=\"82964532-89965755\"/>\n <SegmentURL mediaRange=\"89965756-96928368\"/>\n <SegmentURL mediaRange=\"96928369-103911265\"/>\n <SegmentURL mediaRange=\"103911266-110903999\"/>\n <SegmentURL mediaRange=\"110904000-117921608\"/>\n <SegmentURL mediaRange=\"117921609-124920837\"/>\n <SegmentURL mediaRange=\"124920838-131897214\"/>\n <SegmentURL mediaRange=\"131897215-138848614\"/>\n <SegmentURL mediaRange=\"138848615-145764349\"/>\n <SegmentURL mediaRange=\"145764350-152655256\"/>\n <SegmentURL mediaRange=\"152655257-159680382\"/>\n <SegmentURL mediaRange=\"159680383-166667521\"/>\n <SegmentURL mediaRange=\"166667522-173750581\"/>\n <SegmentURL mediaRange=\"173750582-180827932\"/>\n <SegmentURL mediaRange=\"180827933-187877145\"/>\n <SegmentURL mediaRange=\"187877146-194626820\"/>\n <SegmentURL mediaRange=\"194626821-201345524\"/>\n <SegmentURL mediaRange=\"201345525-208145573\"/>\n <SegmentURL mediaRange=\"208145574-215088653\"/>\n <SegmentURL mediaRange=\"215088654-222022478\"/>\n <SegmentURL mediaRange=\"222022479-228934595\"/>\n <SegmentURL mediaRange=\"228934596-235844464\"/>\n <SegmentURL mediaRange=\"235844465-242852767\"/>\n <SegmentURL mediaRange=\"242852768-249863893\"/>\n <SegmentURL mediaRange=\"249863894-256824103\"/>\n <SegmentURL mediaRange=\"256824104-263749124\"/>\n <SegmentURL mediaRange=\"263749125-270634182\"/>\n <SegmentURL mediaRange=\"270634183-275673081\"/>\n </SegmentList>\n </Representation>\n </AdaptationSet>\n <AdaptationSet id=\"2\" contentType=\"audio\" selectionPriority=\"1000\">\n <ContentProtection schemeIdUri=\"urn:mpeg:dash:mp4protection:2011\" cenc:default_KID=\"f65d52c1-4de5-e5b6-7296-2f48eddf7378\" value=\"cenc\"/>\n <ContentProtection schemeIdUri=\"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed\">\n <cenc:pssh>AAAAXXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAD0SEPZdUsFN5eW2cpYvSO3fc3gaC0FtYXpvbk11c2ljIhxjaWQ6OWwxU3dVM2w1Ylp5bGk5STdkOXplQT09</cenc:pssh>\n </ContentProtection>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:mpegB:cicp:ProgramLoudness\" value=\"-13.5 LUFS\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:trackType\" value=\"SD\"/>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:dash:adaptation-set-switching:2016\" value=\"1\"/>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:mpegB:cicp:AnchorLoudness\" value=\"-11.7 LUFS\"/>\n <Representation id=\"5\" qualityRanking=\"3\" codecs=\"opus\" audioSamplingRate=\"48000\" bandwidth=\"52950\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/7e2d628d-7666-3ad5-a9df-8ba4e1c6391c.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=SD_LOW&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"48000\" duration=\"480000\">\n <Initialization range=\"0-1031\"/>\n <SegmentURL mediaRange=\"1544-61799\"/>\n <SegmentURL mediaRange=\"61800-121935\"/>\n <SegmentURL mediaRange=\"121936-182071\"/>\n <SegmentURL mediaRange=\"182072-246260\"/>\n <SegmentURL mediaRange=\"246261-310449\"/>\n <SegmentURL mediaRange=\"310450-374638\"/>\n <SegmentURL mediaRange=\"374639-438827\"/>\n <SegmentURL mediaRange=\"438828-503016\"/>\n <SegmentURL mediaRange=\"503017-567205\"/>\n <SegmentURL mediaRange=\"567206-631394\"/>\n <SegmentURL mediaRange=\"631395-695583\"/>\n <SegmentURL mediaRange=\"695584-759772\"/>\n <SegmentURL mediaRange=\"759773-823961\"/>\n <SegmentURL mediaRange=\"823962-888150\"/>\n <SegmentURL mediaRange=\"888151-952339\"/>\n <SegmentURL mediaRange=\"952340-1016528\"/>\n <SegmentURL mediaRange=\"1016529-1080717\"/>\n <SegmentURL mediaRange=\"1080718-1144906\"/>\n <SegmentURL mediaRange=\"1144907-1209095\"/>\n <SegmentURL mediaRange=\"1209096-1273284\"/>\n <SegmentURL mediaRange=\"1273285-1337473\"/>\n <SegmentURL mediaRange=\"1337474-1401662\"/>\n <SegmentURL mediaRange=\"1401663-1465851\"/>\n <SegmentURL mediaRange=\"1465852-1530040\"/>\n <SegmentURL mediaRange=\"1530041-1594229\"/>\n <SegmentURL mediaRange=\"1594230-1658418\"/>\n <SegmentURL mediaRange=\"1658419-1722607\"/>\n <SegmentURL mediaRange=\"1722608-1786796\"/>\n <SegmentURL mediaRange=\"1786797-1850985\"/>\n <SegmentURL mediaRange=\"1850986-1915174\"/>\n <SegmentURL mediaRange=\"1915175-1979363\"/>\n <SegmentURL mediaRange=\"1979364-2043552\"/>\n <SegmentURL mediaRange=\"2043553-2107741\"/>\n <SegmentURL mediaRange=\"2107742-2171930\"/>\n <SegmentURL mediaRange=\"2171931-2236119\"/>\n <SegmentURL mediaRange=\"2236120-2300308\"/>\n <SegmentURL mediaRange=\"2300309-2364497\"/>\n <SegmentURL mediaRange=\"2364498-2428686\"/>\n <SegmentURL mediaRange=\"2428687-2492875\"/>\n <SegmentURL mediaRange=\"2492876-2559060\"/>\n </SegmentList>\n </Representation>\n <Representation id=\"6\" qualityRanking=\"2\" codecs=\"opus\" audioSamplingRate=\"48000\" bandwidth=\"196953\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/8e453bd1-9428-30fa-940f-fa85911368c2.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=SD_MEDIUM&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"48000\" duration=\"480000\">\n <Initialization range=\"0-1031\"/>\n <SegmentURL mediaRange=\"1544-242159\"/>\n <SegmentURL mediaRange=\"242160-482295\"/>\n <SegmentURL mediaRange=\"482296-722431\"/>\n <SegmentURL mediaRange=\"722432-966620\"/>\n <SegmentURL mediaRange=\"966621-1210809\"/>\n <SegmentURL mediaRange=\"1210810-1454998\"/>\n <SegmentURL mediaRange=\"1454999-1699187\"/>\n <SegmentURL mediaRange=\"1699188-1943376\"/>\n <SegmentURL mediaRange=\"1943377-2187565\"/>\n <SegmentURL mediaRange=\"2187566-2431754\"/>\n <SegmentURL mediaRange=\"2431755-2675943\"/>\n <SegmentURL mediaRange=\"2675944-2920132\"/>\n <SegmentURL mediaRange=\"2920133-3164321\"/>\n <SegmentURL mediaRange=\"3164322-3408510\"/>\n <SegmentURL mediaRange=\"3408511-3652699\"/>\n <SegmentURL mediaRange=\"3652700-3896888\"/>\n <SegmentURL mediaRange=\"3896889-4141077\"/>\n <SegmentURL mediaRange=\"4141078-4385266\"/>\n <SegmentURL mediaRange=\"4385267-4629455\"/>\n <SegmentURL mediaRange=\"4629456-4873644\"/>\n <SegmentURL mediaRange=\"4873645-5117833\"/>\n <SegmentURL mediaRange=\"5117834-5362022\"/>\n <SegmentURL mediaRange=\"5362023-5606211\"/>\n <SegmentURL mediaRange=\"5606212-5850400\"/>\n <SegmentURL mediaRange=\"5850401-6094589\"/>\n <SegmentURL mediaRange=\"6094590-6338778\"/>\n <SegmentURL mediaRange=\"6338779-6582967\"/>\n <SegmentURL mediaRange=\"6582968-6827156\"/>\n <SegmentURL mediaRange=\"6827157-7071345\"/>\n <SegmentURL mediaRange=\"7071346-7315534\"/>\n <SegmentURL mediaRange=\"7315535-7559723\"/>\n <SegmentURL mediaRange=\"7559724-7803912\"/>\n <SegmentURL mediaRange=\"7803913-8048101\"/>\n <SegmentURL mediaRange=\"8048102-8292290\"/>\n <SegmentURL mediaRange=\"8292291-8536479\"/>\n <SegmentURL mediaRange=\"8536480-8780668\"/>\n <SegmentURL mediaRange=\"8780669-9024857\"/>\n <SegmentURL mediaRange=\"9024858-9269046\"/>\n <SegmentURL mediaRange=\"9269047-9513235\"/>\n <SegmentURL mediaRange=\"9513236-9759420\"/>\n </SegmentList>\n </Representation>\n <Representation id=\"7\" qualityRanking=\"1\" codecs=\"opus\" audioSamplingRate=\"48000\" bandwidth=\"324955\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/40ba3a06-d285-3130-838f-0c1508c1d18b.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=SD_HIGH&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"48000\" duration=\"480000\">\n <Initialization range=\"0-1031\"/>\n <SegmentURL mediaRange=\"1544-402479\"/>\n <SegmentURL mediaRange=\"402480-802615\"/>\n <SegmentURL mediaRange=\"802616-1202751\"/>\n <SegmentURL mediaRange=\"1202752-1606940\"/>\n <SegmentURL mediaRange=\"1606941-2011129\"/>\n <SegmentURL mediaRange=\"2011130-2415318\"/>\n <SegmentURL mediaRange=\"2415319-2819507\"/>\n <SegmentURL mediaRange=\"2819508-3223696\"/>\n <SegmentURL mediaRange=\"3223697-3627885\"/>\n <SegmentURL mediaRange=\"3627886-4032074\"/>\n <SegmentURL mediaRange=\"4032075-4436263\"/>\n <SegmentURL mediaRange=\"4436264-4840452\"/>\n <SegmentURL mediaRange=\"4840453-5244641\"/>\n <SegmentURL mediaRange=\"5244642-5648830\"/>\n <SegmentURL mediaRange=\"5648831-6053019\"/>\n <SegmentURL mediaRange=\"6053020-6457208\"/>\n <SegmentURL mediaRange=\"6457209-6861397\"/>\n <SegmentURL mediaRange=\"6861398-7265586\"/>\n <SegmentURL mediaRange=\"7265587-7669775\"/>\n <SegmentURL mediaRange=\"7669776-8073964\"/>\n <SegmentURL mediaRange=\"8073965-8478153\"/>\n <SegmentURL mediaRange=\"8478154-8882342\"/>\n <SegmentURL mediaRange=\"8882343-9286531\"/>\n <SegmentURL mediaRange=\"9286532-9690720\"/>\n <SegmentURL mediaRange=\"9690721-10094909\"/>\n <SegmentURL mediaRange=\"10094910-10499098\"/>\n <SegmentURL mediaRange=\"10499099-10903287\"/>\n <SegmentURL mediaRange=\"10903288-11307476\"/>\n <SegmentURL mediaRange=\"11307477-11711665\"/>\n <SegmentURL mediaRange=\"11711666-12115854\"/>\n <SegmentURL mediaRange=\"12115855-12520043\"/>\n <SegmentURL mediaRange=\"12520044-12924232\"/>\n <SegmentURL mediaRange=\"12924233-13328421\"/>\n <SegmentURL mediaRange=\"13328422-13732610\"/>\n <SegmentURL mediaRange=\"13732611-14136799\"/>\n <SegmentURL mediaRange=\"14136800-14540988\"/>\n <SegmentURL mediaRange=\"14540989-14945177\"/>\n <SegmentURL mediaRange=\"14945178-15349366\"/>\n <SegmentURL mediaRange=\"15349367-15753555\"/>\n <SegmentURL mediaRange=\"15753556-16159740\"/>\n </SegmentList>\n </Representation>\n </AdaptationSet>\n <AdaptationSet id=\"3\" contentType=\"audio\" selectionPriority=\"500\">\n <ContentProtection schemeIdUri=\"urn:mpeg:dash:mp4protection:2011\" cenc:default_KID=\"4e4c6e3a-d760-ffd5-78b0-3824890da09d\" value=\"cenc\"/>\n <ContentProtection schemeIdUri=\"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed\">\n <cenc:pssh>AAAAXXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAD0SEE5MbjrXYP/VeLA4JIkNoJ0aC0FtYXpvbk11c2ljIhxjaWQ6VGt4dU90ZGcvOVY0c0Rna2lRMmduUT09</cenc:pssh>\n </ContentProtection>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:mpegB:cicp:ProgramLoudness\" value=\"-13.5 LUFS\"/>\n <SupplementalProperty schemeIdUri=\"amz-music:trackType\" value=\"LD\"/>\n <SupplementalProperty schemeIdUri=\"urn:mpeg:mpegB:cicp:AnchorLoudness\" value=\"-11.7 LUFS\"/>\n <Representation id=\"8\" qualityRanking=\"2000\" codecs=\"opus\" audioSamplingRate=\"48000\" bandwidth=\"52950\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/748096ab-6991-368b-b9ca-5477bf90ba5a.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=LD_LOW&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"48000\" duration=\"480000\">\n <Initialization range=\"0-1031\"/>\n <SegmentURL mediaRange=\"1544-61799\"/>\n <SegmentURL mediaRange=\"61800-121935\"/>\n <SegmentURL mediaRange=\"121936-182071\"/>\n <SegmentURL mediaRange=\"182072-246260\"/>\n <SegmentURL mediaRange=\"246261-310449\"/>\n <SegmentURL mediaRange=\"310450-374638\"/>\n <SegmentURL mediaRange=\"374639-438827\"/>\n <SegmentURL mediaRange=\"438828-503016\"/>\n <SegmentURL mediaRange=\"503017-567205\"/>\n <SegmentURL mediaRange=\"567206-631394\"/>\n <SegmentURL mediaRange=\"631395-695583\"/>\n <SegmentURL mediaRange=\"695584-759772\"/>\n <SegmentURL mediaRange=\"759773-823961\"/>\n <SegmentURL mediaRange=\"823962-888150\"/>\n <SegmentURL mediaRange=\"888151-952339\"/>\n <SegmentURL mediaRange=\"952340-1016528\"/>\n <SegmentURL mediaRange=\"1016529-1080717\"/>\n <SegmentURL mediaRange=\"1080718-1144906\"/>\n <SegmentURL mediaRange=\"1144907-1209095\"/>\n <SegmentURL mediaRange=\"1209096-1273284\"/>\n <SegmentURL mediaRange=\"1273285-1337473\"/>\n <SegmentURL mediaRange=\"1337474-1401662\"/>\n <SegmentURL mediaRange=\"1401663-1465851\"/>\n <SegmentURL mediaRange=\"1465852-1530040\"/>\n <SegmentURL mediaRange=\"1530041-1594229\"/>\n <SegmentURL mediaRange=\"1594230-1658418\"/>\n <SegmentURL mediaRange=\"1658419-1722607\"/>\n <SegmentURL mediaRange=\"1722608-1786796\"/>\n <SegmentURL mediaRange=\"1786797-1850985\"/>\n <SegmentURL mediaRange=\"1850986-1915174\"/>\n <SegmentURL mediaRange=\"1915175-1979363\"/>\n <SegmentURL mediaRange=\"1979364-2043552\"/>\n <SegmentURL mediaRange=\"2043553-2107741\"/>\n <SegmentURL mediaRange=\"2107742-2171930\"/>\n <SegmentURL mediaRange=\"2171931-2236119\"/>\n <SegmentURL mediaRange=\"2236120-2300308\"/>\n <SegmentURL mediaRange=\"2300309-2364497\"/>\n <SegmentURL mediaRange=\"2364498-2428686\"/>\n <SegmentURL mediaRange=\"2428687-2492875\"/>\n <SegmentURL mediaRange=\"2492876-2559060\"/>\n </SegmentList>\n </Representation>\n <Representation id=\"9\" qualityRanking=\"1000\" codecs=\"opus\" audioSamplingRate=\"48000\" bandwidth=\"164952\" mimeType=\"audio/mp4\">\n <AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"2\"/>\n <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/8be307d6-71ea-3111-a869-40720e08a6f9.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&rs=NA&mt=US&ql=LD_MEDIUM&dtype=A16ZV8BU3SN1N3</BaseURL>\n <SegmentList timescale=\"48000\" duration=\"480000\">\n <Initialization range=\"0-1031\"/>\n <SegmentURL mediaRange=\"1544-202079\"/>\n <SegmentURL mediaRange=\"202080-402215\"/>\n <SegmentURL mediaRange=\"402216-602351\"/>\n <SegmentURL mediaRange=\"602352-806540\"/>\n <SegmentURL mediaRange=\"806541-1010729\"/>\n <SegmentURL mediaRange=\"1010730-1214918\"/>\n <SegmentURL mediaRange=\"1214919-1419107\"/>\n <SegmentURL mediaRange=\"1419108-1623296\"/>\n <SegmentURL mediaRange=\"1623297-1827485\"/>\n <SegmentURL mediaRange=\"1827486-2031674\"/>\n <SegmentURL mediaRange=\"2031675-2235863\"/>\n <SegmentURL mediaRange=\"2235864-2440052\"/>\n <SegmentURL mediaRange=\"2440053-2644241\"/>\n <SegmentURL mediaRange=\"2644242-2848430\"/>\n <SegmentURL mediaRange=\"2848431-3052619\"/>\n <SegmentURL mediaRange=\"3052620-3256808\"/>\n <SegmentURL mediaRange=\"3256809-3460997\"/>\n <SegmentURL mediaRange=\"3460998-3665186\"/>\n <SegmentURL mediaRange=\"3665187-3869375\"/>\n <SegmentURL mediaRange=\"3869376-4073564\"/>\n <SegmentURL mediaRange=\"4073565-4277753\"/>\n <SegmentURL mediaRange=\"4277754-4481942\"/>\n <SegmentURL mediaRange=\"4481943-4686131\"/>\n <SegmentURL mediaRange=\"4686132-4890320\"/>\n <SegmentURL mediaRange=\"4890321-5094509\"/>\n <SegmentURL mediaRange=\"5094510-5298698\"/>\n <SegmentURL mediaRange=\"5298699-5502887\"/>\n <SegmentURL mediaRange=\"5502888-5707076\"/>\n <SegmentURL mediaRange=\"5707077-5911265\"/>\n <SegmentURL mediaRange=\"5911266-6115454\"/>\n <SegmentURL mediaRange=\"6115455-6319643\"/>\n <SegmentURL mediaRange=\"6319644-6523832\"/>\n <SegmentURL mediaRange=\"6523833-6728021\"/>\n <SegmentURL mediaRange=\"6728022-6932210\"/>\n <SegmentURL mediaRange=\"6932211-7136399\"/>\n <SegmentURL mediaRange=\"7136400-7340588\"/>\n <SegmentURL mediaRange=\"7340589-7544777\"/>\n <SegmentURL mediaRange=\"7544778-7748966\"/>\n <SegmentURL mediaRange=\"7748967-7953155\"/>\n <SegmentURL mediaRange=\"7953156-8159340\"/>\n </SegmentList>\n </Representation>\n </AdaptationSet>\n </Period>\n</MPD>`\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin, type Mutable, ValidationError } from '@amazon/vinyl-util'\nimport type { VttCueStyle } from './VttCueStyle'\n\n/**\n * A single WebVTT cue.\n *\n * @see https://www.w3.org/TR/webvtt1/\n */\nexport interface WebVttCue {\n /**\n * Optional cue identifier, the line that appears before the timing line.\n */\n readonly id: string | null\n\n /**\n * Cue start time in seconds.\n */\n readonly startTime: number\n\n /**\n * Cue end time in seconds.\n */\n readonly endTime: number\n\n /**\n * The cue text payload, with line breaks preserved as `\\n`.\n */\n readonly text: string\n\n /**\n * The authored cue settings from the timing line (position/line/size/\n * align/vertical), when any were present. Preserved so a renderer can\n * position the cue faithfully. Absent when the cue declared no settings.\n */\n readonly settings?: VttCueStyle\n}\n\n/**\n * The result of parsing a WebVTT document.\n */\nexport interface WebVttDocument {\n /**\n * Parsed cues in document order.\n */\n readonly cues: readonly WebVttCue[]\n\n /**\n * The raw CSS body of each `STYLE` block, in document order. These carry\n * `::cue` rules (e.g. `::cue(.loud) { font-weight: bold }`) an HTML renderer\n * can apply. Empty when the document declared no styles.\n */\n readonly styles: readonly string[]\n}\n\nconst WEBVTT_HEADER = 'WEBVTT'\n\n// A single WebVTT timestamp anchored at the start: `[ hours \":\" ] minutes \":\"\n// seconds \".\" ms`, with hours two-or-more digits (optional), minutes/seconds\n// two digits in 0-59, and milliseconds three digits (per the spec's \"collect a\n// WebVTT timestamp\"). Timestamp collection stops after the milliseconds \u2014 it is\n// NOT anchored at the end \u2014 so the start match must be checked to consume its\n// whole (pre-`-->`) token, while for the end match any remainder is cue\n// settings. The only unbounded quantifier is `\\d+`, followed by a literal `:`\n// (no nested/overlapping quantifiers), so it matches in linear time, and it\n// only ever runs against a single short token \u2014 backtracking is a non-issue.\nconst TIMESTAMP_RE = /^(?:(\\d+):)?([0-5]\\d):([0-5]\\d)\\.(\\d{3})/\n\n/**\n * Parses a WebVTT document into a list of cues.\n *\n * Implements a forgiving subset of the WebVTT 1.0 specification: header\n * detection, comment blocks (lines starting with `NOTE`), styling/region\n * blocks (STYLE bodies are captured, REGION skipped), cue identifiers, and\n * HH:MM:SS.mmm or MM:SS.mmm timestamps with optional cue settings.\n *\n * @param input The raw WebVTT document text. Both LF and CRLF line endings\n * are supported, and a leading BOM is stripped if present.\n * @throws ValidationError if the input is missing the WEBVTT header.\n * @see https://www.w3.org/TR/webvtt1/#webvtt-timestamp\n */\nexport function parseWebVtt(input: string): WebVttDocument {\n if (typeof input !== 'string') {\n throw new ValidationError(\n 'WebVTT input must be a string',\n ErrorOrigin.MEDIA\n )\n }\n let text = input\n // Strip a leading BOM, then normalize line endings.\n if (text.charCodeAt(0) === 0xfeff) text = text.slice(1)\n const lines = text.split(/\\r\\n|\\r|\\n/)\n\n if (lines.length === 0 || !isWebVttHeader(lines[0])) {\n throw new ValidationError(\n 'WebVTT must begin with a WEBVTT header',\n ErrorOrigin.MEDIA\n )\n }\n\n const cues: WebVttCue[] = []\n const styles: string[] = []\n // Per the WebVTT spec, everything from the `WEBVTT` signature up to (and\n // including) the first blank line is the file header \u2014 metadata lines (e.g.\n // HLS's `X-TIMESTAMP-MAP=...`) belong in that block and MUST NOT be\n // interpreted as cue content.\n let i = 1\n while (i < lines.length && lines[i] !== '') i++\n\n while (i < lines.length) {\n // Skip blank lines between blocks.\n if (lines[i] === '') {\n i++\n continue\n }\n // NOTE comment / REGION blocks: skip until the blank line. A NOTE line\n // is `NOTE` alone or `NOTE` followed by whitespace (space or tab).\n if (\n lines[i] === 'NOTE' ||\n lines[i].startsWith('NOTE ') ||\n lines[i].startsWith('NOTE\\t') ||\n lines[i] === 'REGION'\n ) {\n i++\n while (i < lines.length && lines[i] !== '') i++\n continue\n }\n // STYLE block: capture its CSS body (up to the blank line).\n if (lines[i] === 'STYLE') {\n i++\n const start = i\n while (i < lines.length && lines[i] !== '') i++\n const css = lines.slice(start, i).join('\\n').trim()\n if (css) styles.push(css)\n continue\n }\n\n // Cue: an optional identifier line, then a timing line, then payload.\n // A cue identifier never contains `-->`, so a line without it is the\n // identifier and the timing line follows (spec: \"collect a WebVTT\n // block\").\n let id: string | null = null\n if (!lines[i].includes('-->')) {\n id = lines[i]\n i++\n if (i >= lines.length) break // identifier with no timing line\n }\n const timing = parseTiming(lines[i])\n i++\n if (!timing) {\n // Malformed timing line: drain to the next blank line.\n while (i < lines.length && lines[i] !== '') i++\n continue\n }\n\n const payloadLines: string[] = []\n while (i < lines.length && lines[i] !== '') {\n payloadLines.push(lines[i])\n i++\n }\n const text = payloadLines.join('\\n')\n // Omit the optional `settings` key entirely when there are none.\n cues.push(\n timing.settings === undefined\n ? {\n id,\n startTime: timing.startTime,\n endTime: timing.endTime,\n text,\n }\n : {\n id,\n startTime: timing.startTime,\n endTime: timing.endTime,\n text,\n settings: timing.settings,\n }\n )\n }\n\n return { cues, styles }\n}\n\n/**\n * Parses a WebVTT timing line (\"start --> end settings\"), returning the two\n * times (in seconds) and any parsed cue settings, or null if it is not a valid\n * timing line. Splitting on the literal `-->` (and on the whitespace before the\n * settings) keeps each timestamp match a fixed, anchored token.\n */\nfunction parseTiming(line: string): {\n startTime: number\n endTime: number\n settings: VttCueStyle | undefined\n} | null {\n const arrow = line.indexOf('-->')\n if (arrow < 0) return null\n // Before the arrow: only the start timestamp (whitespace-trimmed), so the\n // match must consume the whole token.\n const before = line.slice(0, arrow).trim()\n const start = TIMESTAMP_RE.exec(before)\n if (!start || start[0].length !== before.length) return null\n // After the arrow: the end timestamp, then whatever follows is cue settings.\n const rest = line.slice(arrow + 3).trim()\n const end = TIMESTAMP_RE.exec(rest)\n if (!end) return null\n return {\n startTime: toSeconds(start[1], start[2], start[3], start[4]),\n endTime: toSeconds(end[1], end[2], end[3], end[4]),\n settings: parseCueSettings(rest.slice(end[0].length)),\n }\n}\n\nfunction toSeconds(\n hours: string | undefined,\n minutes: string,\n seconds: string,\n millis: string\n): number {\n return (\n (hours ? Number(hours) * 3600 : 0) +\n Number(minutes) * 60 +\n Number(seconds) +\n Number(millis) / 1000\n )\n}\n\nfunction isWebVttHeader(line: string): boolean {\n if (!line.startsWith(WEBVTT_HEADER)) return false\n if (line.length === WEBVTT_HEADER.length) return true\n const next = line.charCodeAt(WEBVTT_HEADER.length)\n // Header may be followed by space, tab, or any text after a separator.\n return next === 0x20 || next === 0x09\n}\n\nconst ALIGN = new Set(['start', 'center', 'end', 'left', 'right'])\nconst LINE_ALIGN = new Set(['start', 'center', 'end'])\nconst POSITION_ALIGN = new Set(['line-left', 'center', 'line-right', 'auto'])\nconst VERTICAL = new Set(['rl', 'lr'])\n\n/**\n * Parses the cue-settings tail of a timing line (e.g.\n * `align:center line:80% position:50%,center size:90% vertical:rl`) into a\n * {@link VttCueStyle}. Unknown keys and malformed values are skipped; returns\n * undefined when nothing valid was found.\n */\nfunction parseCueSettings(text: string | undefined): VttCueStyle | undefined {\n if (!text) return undefined\n const settings: Mutable<VttCueStyle> = {}\n for (const token of text.trim().split(/\\s+/)) {\n const colon = token.indexOf(':')\n if (colon <= 0) continue\n const key = token.slice(0, colon)\n const value = token.slice(colon + 1)\n switch (key) {\n case 'align': {\n // 'middle' is the legacy spelling of 'center'.\n const align = value === 'middle' ? 'center' : value\n if (ALIGN.has(align)) settings.align = align as AlignSetting\n break\n }\n case 'vertical':\n if (VERTICAL.has(value))\n settings.vertical = value as DirectionSetting\n break\n case 'size': {\n const size = parsePercent(value)\n if (size != null) settings.size = size\n break\n }\n case 'line':\n parseLine(value, settings)\n break\n case 'position':\n parsePosition(value, settings)\n break\n }\n }\n return Object.keys(settings).length > 0 ? settings : undefined\n}\n\nfunction parseLine(value: string, settings: Mutable<VttCueStyle>): void {\n const [pos, align] = value.split(',') as [string, string?]\n if (pos.endsWith('%')) {\n const percent = parsePercent(pos)\n if (percent == null) return\n settings.line = percent\n settings.snapToLines = false\n } else {\n const n = Number(pos)\n if (!Number.isInteger(n)) return\n settings.line = n\n settings.snapToLines = true\n }\n const lineAlign = align === 'middle' ? 'center' : align\n if (lineAlign && LINE_ALIGN.has(lineAlign))\n settings.lineAlign = lineAlign as LineAlignSetting\n}\n\nfunction parsePosition(value: string, settings: Mutable<VttCueStyle>): void {\n const [pos, align] = value.split(',') as [string, string?]\n const percent = parsePercent(pos)\n if (percent == null) return\n settings.position = percent\n const positionAlign = align === 'middle' ? 'center' : align\n if (positionAlign && POSITION_ALIGN.has(positionAlign))\n settings.positionAlign = positionAlign as PositionAlignSetting\n}\n\n/** Parses an `N%` token to its numeric percentage, or null when malformed. */\nfunction parsePercent(value: string): number | null {\n if (!value.endsWith('%')) return null\n const n = Number(value.slice(0, -1))\n return Number.isFinite(n) ? n : null\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { lazy } from '@amazon/vinyl-util'\n\n/**\n * For reliable integ tests on 3P devices, there should be a single media element.\n * When using the media element, unload any sources and reset any state after each test.\n */\nexport const mediaRef = lazy<HTMLMediaElement>(() => {\n const media = document.createElement('video')\n media.muted = true\n media.playsInline = true // needed for iOS\n media.disableRemotePlayback = true // Disables casting. Needed for ManagedMediaSource\n return media\n})\n\nafterEach(() => {\n if (mediaRef.constructed) {\n // Reset the media element.\n const media = mediaRef.value\n media.removeAttribute('src')\n media.load()\n }\n})\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { getAudioContext } from '@amazon/vinyl'\nimport { type LogTarget, TimeoutError } from '@amazon/vinyl-util'\nimport { sleep } from '@amazon/vinyl-util'\nimport { parseBoolean } from '@amazon/vinyl-util'\nimport { logDebug } from '@amazon/vinyl-util'\nimport { getSearchParams } from '@amazon/vinyl-util'\nimport { createLogPrefix } from '@amazon/vinyl-util'\nimport { mediaRef } from '../player/mediaRef'\nimport { requireUserInteraction } from '../ui/requireUserInteraction'\nimport { unlockMediaElement } from './unlockMediaElement'\nimport { setNextTestTimeout } from '@amazon/vinyl-util/browserTestUtil'\n\n/**\n * The percent tolerance the time estimate based on the analyzed frequency can be off from the actual currentTime.\n */\nconst TIME_ESTIMATE_TOLERANCE = 0.02\n\nexport interface FrequencyAnalyzerOptions {\n /**\n * The frequency the sweep starts at.\n */\n readonly startFrequency: number\n\n /**\n * The frequency the sweep ends at.\n */\n readonly endFrequency: number\n\n /**\n * The window size in samples. Default: 4096.\n * A higher value will result in more details in the frequency domain but fewer details in the amplitude domain.\n */\n readonly fftSize:\n | 32\n | 64\n | 128\n | 256\n | 512\n | 1024\n | 2048\n | 4096\n | 8192\n | 16384\n | 32768\n}\n\nconst defaultFrequencyAnalyzerOptions = {\n startFrequency: 100,\n endFrequency: 6000,\n fftSize: 4096,\n} as const satisfies FrequencyAnalyzerOptions\n\nexport class FrequencyAnalyzer implements LogTarget {\n private readonly data: Float32Array<ArrayBuffer>\n private readonly analyser: AnalyserNode\n\n private readonly options: FrequencyAnalyzerOptions\n\n readonly logPrefix = createLogPrefix('FrequencyAnalyzer')\n\n constructor(\n private readonly audioContext: AudioContext,\n private readonly source: MediaElementAudioSourceNode,\n options?: Partial<FrequencyAnalyzerOptions>\n ) {\n this.options = {\n ...defaultFrequencyAnalyzerOptions,\n ...options,\n }\n // Set up the AnalyserNode\n this.analyser = this.audioContext.createAnalyser()\n this.analyser.fftSize = this.options.fftSize\n this.analyser.connect(this.audioContext.destination)\n this.data = new Float32Array(this.analyser.frequencyBinCount)\n this.source.connect(this.analyser)\n }\n\n /**\n * Estimates the frequency of the current frame window.\n *\n * The frequency estimate is the frequency of the highest decibel bin within the frame window. The number of\n * bins is 1/2 the fftSize.\n */\n get frequency(): number {\n const audioCtx = this.audioContext\n const analyser = this.analyser\n const data = this.data\n analyser.getFloatFrequencyData(data)\n const maxIndex = data.reduce(\n (iMax, x, i, arr) => (x > arr[iMax] ? i : iMax),\n 0\n )\n return (maxIndex * audioCtx.sampleRate) / analyser.fftSize\n }\n\n get estimatedTime(): number {\n const frequency = this.frequency\n const start = this.options.startFrequency\n const end = this.options.endFrequency\n return (\n ((frequency - start) / (end - start)) *\n this.source.mediaElement.duration\n )\n }\n\n /**\n * Asserts that the next samples of audio plays at its expected frequency.\n */\n async assertFrequency(timeout = 10) {\n // Reconnect the analyzer to clear the buffer\n this.analyser.disconnect()\n this.analyser.connect(this.audioContext.destination)\n\n const media = this.source.mediaElement\n if (isNaN(media.duration)) fail('media is not loaded')\n if (media.paused) fail('media is paused')\n const startTime = Date.now()\n const mediaStartTime = media.currentTime\n // The minimum amount of time to fill the buffer up with data from the time the frequency assertion is\n // requested.\n const playbackTime = 0.25\n\n const maxDifference = media.duration * TIME_ESTIMATE_TOLERANCE\n\n // Check if there is enough time remaining in track to accurately test frequency.\n if (media.currentTime + playbackTime >= media.duration) {\n logDebug(\n this,\n 'Ignoring assertFrequency, currentTime is at duration'\n )\n return\n }\n\n let estimatedTime: number\n let diff: number\n let elapsed: number\n do {\n if (Date.now() - startTime > timeout * 1000) {\n throw new TimeoutError(\n 'Frequency data could not be filled, media is not playing.'\n )\n }\n elapsed = media.currentTime - mediaStartTime\n estimatedTime = this.estimatedTime\n diff = Math.abs(estimatedTime - media.currentTime)\n await sleep(playbackTime)\n } while (elapsed < playbackTime && diff > maxDifference)\n\n logDebug(\n this,\n 'time from frequency:',\n estimatedTime.toFixed(2),\n 'actual time:',\n media.currentTime.toFixed(2)\n )\n if (diff > maxDifference) {\n const percentFormatter = new Intl.NumberFormat('en-US', {\n style: 'percent',\n })\n fail(\n `The measured frequency at time ${media.currentTime.toFixed(2)} ` +\n `was measured to be ${this.frequency.toFixed(2)}Hz. ` +\n `The expected time is ${estimatedTime.toFixed(2)}, the actual time ` +\n `is ${media.currentTime.toFixed(2)}, ` +\n `for a difference of ${percentFormatter.format(\n diff / media.duration\n )} track duration. (Tolerance is ${percentFormatter.format(TIME_ESTIMATE_TOLERANCE)})`\n )\n }\n }\n}\n\n/**\n * A query param, if present, will indicate that audio should be analyzed. Does not work in CI environments.\n */\nexport const shouldCheckAudio = parseBoolean(\n (getSearchParams().get('checkAudio') ?? '0').toLowerCase()\n)\n\nlet frequencyAnalyzer: FrequencyAnalyzer | null = null\n\n/**\n * If `shouldCheckAudio` is true and AudioContext is supported, asserts that the currently playing media is playing\n * the frequency expected from the sweep tone of the test assets.\n */\nexport function assertFrequency(): Promise<void> {\n return frequencyAnalyzer?.assertFrequency() ?? Promise.resolve()\n}\n\n/**\n * Displays an interaction prompt if checkAudio is present in the query params.\n *\n * The checkAudio query param, if present, indicates that the actual sound output should be analyzed. This requires\n * a user gesture unless the UA doesn't require it. Most browsers require the gesture, but some platforms this\n * requirement may be skipped with a flag. Note that Google deprecated --autoplay-policy=no-user-gesture-required\n * March 2023, but older versions may still support it.\n */\nexport function initializeFrequencyAnalyzer() {\n if (shouldCheckAudio) {\n // If a user interaction is required, give extra time to interact before a timeout.\n setNextTestTimeout(300)\n beforeAll(async () => {\n // Creates the audio context and 'unlocks' the media element in response to a user gesture.\n const media = mediaRef.value\n media.crossOrigin = 'anonymous'\n media.muted = false\n media.volume = 0.01 // Save your ears. Analyzers do not work at volume 0 or muted; measured dB is affected.\n await requireUserInteraction()\n const audioContext = getAudioContext()\n await unlockMediaElement()\n\n if (audioContext) {\n const source = audioContext.createMediaElementSource(\n mediaRef.value\n )\n frequencyAnalyzer = new FrequencyAnalyzer(audioContext, source)\n } else {\n console.warn('AudioContext not supported')\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 type { LogEventMap, Logger, LogTarget } from '@amazon/vinyl-util'\nimport { loggerRef, LogLevel } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { overrideGlobalInit } from '../../global/overrideGlobalInit'\nimport { MockEventHost } from '../event/MockEventHost'\nimport createSpy = jasmine.createSpy\n\ntype LogFilterFun = (target: LogTarget, ...messages: any[]) => void\n\nconst spyFactory = createSpyFactory<Logger>()\nexport class MockLogger extends MockEventHost<LogEventMap> implements Logger {\n logLevel: LogLevel = LogLevel.DEBUG\n\n log = spyFactory('log').and.callFake((target, level, ...messages) => {\n switch (level) {\n // Delegates logs to spies separated by log level.\n case LogLevel.VERBOSE:\n this.verbose(target, ...messages)\n break\n case LogLevel.DEBUG:\n this.debug(target, ...messages)\n break\n case LogLevel.INFO:\n this.info(target, ...messages)\n break\n case LogLevel.WARN:\n this.warn(target, ...messages)\n break\n case LogLevel.ERROR:\n this.error(target, ...messages)\n break\n }\n })\n\n verbose = createSpy<LogFilterFun>('verbose')\n debug = createSpy<LogFilterFun>('debug')\n info = createSpy<LogFilterFun>('info')\n warn = createSpy<LogFilterFun>('warn')\n error = createSpy<LogFilterFun>('error')\n}\n\nexport function useMockLogger(): { readonly value: MockLogger } {\n return overrideGlobalInit(loggerRef, () => new MockLogger())\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n//-------------------------------------------------------------\n// Empty FetchCompletedInfo objects for tests.\n//-------------------------------------------------------------\n\nimport {\n ErrorBodyType,\n type FetchRequestInfo,\n type RequestAttemptInfo,\n type RequestCaughtErrorEvent,\n type RequestNetworkErrorEvent,\n type RequestResponseErrorEvent,\n type RequestSuccessEvent,\n type ResponseInfo,\n} from '@amazon/vinyl-util'\nimport { RequestFailureType } from '@amazon/vinyl-util'\n\nexport const emptyRequestInfo: FetchRequestInfo = {\n requestId: '',\n requestOptions: { readErrorBody: ErrorBodyType.DISABLED, serviceId: null },\n init: {},\n input: '',\n maxRetries: 0,\n timestamp: 0,\n}\n\nexport const emptyRequestAttemptInfo: RequestAttemptInfo = {\n currentTry: 0,\n timestamp: 0,\n}\n\nexport const emptyResponseInfo: ResponseInfo = {\n ok: false,\n redirected: false,\n status: 0,\n statusText: '',\n type: 'default',\n url: '',\n contentLength: 0,\n}\n\nexport const emptyRequestSuccessEvent: RequestSuccessEvent = {\n ok: true,\n requestInfo: emptyRequestInfo,\n timestamp: 0,\n attemptInfo: emptyRequestAttemptInfo,\n responseInfo: emptyResponseInfo,\n}\n\nexport const emptyInternalError: RequestCaughtErrorEvent = {\n ok: false,\n reason: null,\n requestInfo: emptyRequestInfo,\n retryAfter: null,\n timestamp: 0,\n type: RequestFailureType.INTERNAL,\n willRetry: false,\n}\n\nexport const emptyNetworkError: RequestNetworkErrorEvent = {\n ok: false,\n reason: null,\n requestInfo: emptyRequestInfo,\n retryAfter: null,\n timestamp: 0,\n type: RequestFailureType.NETWORK,\n willRetry: false,\n attemptInfo: emptyRequestAttemptInfo,\n}\n\nexport const emptyResponseError: RequestResponseErrorEvent = {\n ok: false,\n reason: null,\n requestInfo: emptyRequestInfo,\n retryAfter: null,\n timestamp: 0,\n type: RequestFailureType.RESPONSE,\n willRetry: false,\n attemptInfo: emptyRequestAttemptInfo,\n responseInfo: emptyResponseInfo,\n}\n\nexport const emptyAbortError: RequestCaughtErrorEvent = {\n ...emptyInternalError,\n type: RequestFailureType.ABORT,\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 NetworkMetrics,\n NetworkMetricsController,\n NetworkMetricsEventMap,\n} from '@amazon/vinyl-util'\nimport { EMPTY_NETWORK_METRICS } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nimport { MockEventHost } from '../event/MockEventHost'\n\nconst spyFactory = createSpyFactory<NetworkMetricsController>()\nexport class MockNetworkMetricsController\n extends MockEventHost<NetworkMetricsEventMap>\n implements NetworkMetricsController\n{\n maxHistorySize = 0\n\n metrics: NetworkMetrics = EMPTY_NETWORK_METRICS\n\n addMetricsEntry = spyFactory('addMetricsEntry')\n\n getServiceMetrics = spyFactory('getServiceMetrics')\n\n addDownlinkTransferEntry = spyFactory('addDownlinkTransferEntry')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { NetworkState, NetworkStateEventMap } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '../event/MockEventHost'\n\nconst spyFactory = createSpyFactory<NetworkState>()\nexport class MockNetworkState\n extends MockEventHost<NetworkStateEventMap>\n implements NetworkState\n{\n onLine = false\n\n nextOnLine = spyFactory('nextOnLine')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Requester, RequesterImplEventMap } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '../event/MockEventHost'\n\nconst spyFactory = createSpyFactory<Requester>()\nexport class MockRequester\n extends MockEventHost<RequesterImplEventMap>\n implements Requester\n{\n request = spyFactory('request')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport CustomReporter = jasmine.CustomReporter\nimport JasmineDoneInfo = jasmine.JasmineDoneInfo\nimport JasmineStartedInfo = jasmine.JasmineStartedInfo\nimport SpecResult = jasmine.SpecResult\nimport { LogLevel, type ReadonlyDate } from '@amazon/vinyl-util'\n\n/**\n * The minimum number of seconds between progress reports.\n */\nconst UPDATE_INTERVAL = 1\n\n/**\n * The maximum number of log statements before forcing a flush.\n * This can be reached if a single test is long-running and has excessive logs.\n */\nconst MAX_LOGS_BUFFER = 200\n\nexport interface LogReporterStartedEvent {\n readonly totalSpecs: number\n}\n\nexport interface LogReporterProgressEvent {\n readonly totalCompleted: number\n readonly totalSpecs: number\n readonly logs: readonly LogEntry[]\n}\n\nexport interface LogReporterDoneEvent {\n readonly overallStatus: 'passed' | 'failed'\n readonly totalCompleted: number\n readonly totalSpecs: number\n readonly reason: string\n}\n\nexport interface LogEntry {\n readonly timestamp: ReadonlyDate\n readonly messages: readonly any[]\n readonly level: LogLevel\n}\n\nexport abstract class LogReporter implements CustomReporter {\n /**\n * The first failed spec.\n *\n * Jasmine's spec result in `jasmineDone` does not provide these correctly in\n * failedExpectations, save this from `specDone`.\n */\n private failedResult: SpecResult | null = null\n\n private totalSpecs = 0\n private totalCompleted = 0\n\n /**\n * The timestamp of the last progress update.\n */\n protected lastProgressTimestamp = 0\n protected updateInterval = UPDATE_INTERVAL\n protected maxLogsBuffer = MAX_LOGS_BUFFER\n\n private consoleInterceptor = new ConsoleInterceptor()\n\n private readonly logs: LogEntry[] = []\n\n protected constructor() {\n this.consoleInterceptor.onLog = (entry) => {\n this.logs.push(entry)\n if (this.logs.length >= this.maxLogsBuffer)\n this.maybeReportProgress(true)\n }\n }\n\n jasmineStarted(suiteInfo: JasmineStartedInfo): void {\n this.onStarted({\n totalSpecs: suiteInfo.totalSpecsDefined,\n }).catch((e) => {\n console.error(`'done' failed to report`, e)\n })\n this.totalCompleted = 0\n this.totalSpecs = suiteInfo.totalSpecsDefined\n }\n\n protected abstract onStarted(action: LogReporterStartedEvent): Promise<void>\n\n specStarted(result: SpecResult): void {\n // Log the running spec and flush immediately. A spec that hangs never\n // reaches specDone, so without this the buffered logs \u2014 and which spec\n // was running \u2014 never reach the reporter and the log just cuts off. The\n // forced flush makes the last logged spec name identify the culprit.\n console.info(`Running spec: ${result.fullName}`)\n this.maybeReportProgress()\n }\n\n specDone(result: SpecResult): void {\n if (!this.failedResult && result.status === 'failed')\n this.failedResult = result\n this.totalCompleted++\n this.maybeReportProgress()\n }\n\n jasmineDone(runDetails: JasmineDoneInfo): void {\n this.maybeReportProgress(true)\n this.consoleInterceptor.dispose()\n const reason = this.failedResult\n ? `${this.failedResult.fullName}:\\n${this.failedResult.failedExpectations[0]?.message}`\n : runDetails.overallStatus === 'incomplete'\n ? runDetails.incompleteReason\n : ''\n const body: LogReporterDoneEvent = {\n // one of: 'passed', 'failed', 'incomplete'\n overallStatus:\n runDetails.overallStatus === 'incomplete'\n ? 'passed'\n : (runDetails.overallStatus as 'passed' | 'failed'),\n totalCompleted: this.totalCompleted,\n totalSpecs: this.totalSpecs,\n reason,\n }\n this.onDone(body).catch((_) => {\n // One retry:\n this.onDone(body).catch((e) => {\n console.error(`'done' failed to report`, e)\n })\n })\n }\n\n /**\n * If there has not been a progress update within `updateInterval`, emit another progress\n * event.\n * @private\n */\n private maybeReportProgress(force: boolean = false) {\n const now = Date.now()\n if (\n force ||\n now - this.lastProgressTimestamp > this.updateInterval * 1000\n ) {\n const logs = this.logs.slice()\n this.logs.length = 0\n this.onProgress({\n totalCompleted: this.totalCompleted,\n totalSpecs: this.totalSpecs,\n logs,\n }).catch((e) => {\n console.error(`'progress' failed to report`, e)\n })\n this.lastProgressTimestamp = now\n }\n }\n\n protected abstract onProgress(\n action: LogReporterProgressEvent\n ): Promise<void>\n\n protected abstract onDone(action: LogReporterDoneEvent): Promise<void>\n}\n\nconst consoleMethods = [\n 'debug',\n 'log',\n 'info',\n 'warn',\n 'error',\n] as const satisfies (keyof Console)[]\n\nconst consoleMethodLevels: Record<string, LogLevel> = {\n debug: LogLevel.DEBUG,\n log: LogLevel.DEBUG,\n warn: LogLevel.WARN,\n info: LogLevel.INFO,\n error: LogLevel.ERROR,\n} as const\n\n/**\n * Intercepts console, logging to an array as well.\n */\nclass ConsoleInterceptor {\n private readonly originalMethods: Record<string, (...args: any[]) => void>\n\n /**\n * Invoked on every log statement.\n */\n onLog: ((entry: LogEntry) => void) | null = null\n\n constructor() {\n this.originalMethods = {}\n for (const consoleMethod of consoleMethods) {\n this.originalMethods[consoleMethod] = console[consoleMethod]\n console[consoleMethod] = (...args) => {\n if (this.onLog)\n this.onLog({\n level:\n consoleMethodLevels[consoleMethod] ??\n LogLevel.DEBUG,\n timestamp: new Date(),\n messages: args,\n })\n this.originalMethods[consoleMethod].apply(console, args)\n }\n }\n }\n\n dispose() {\n for (const consoleMethod of consoleMethods) {\n console[consoleMethod] = this.originalMethods[consoleMethod]\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 {\n AdBreakInfo,\n AdController,\n AdInfo,\n TrackAds,\n} from '../../../../src'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<AdController>()\nexport class MockAdController extends MockEventHost implements AdController {\n currentTrackAds: TrackAds | null = null\n currentAd: AdInfo | null = null\n currentAdBreak: AdBreakInfo | null = null\n\n setAdsProvider = spyFactory('setAdsProvider')\n failAd = spyFactory('failAd')\n skipAd = spyFactory('skipAd')\n skipAdBreak = spyFactory('skipAdBreak')\n enterPreroll = spyFactory('enterPreroll')\n enterPostroll = spyFactory('enterPostroll')\n\n constructor() {\n super()\n // enterPreroll/enterPostroll are awaited by the TrackController, so\n // default them to resolve with \"no roll\" (null); tests override with\n // resolveTo() as needed.\n this.enterPreroll.and.resolveTo(null)\n this.enterPostroll.and.resolveTo(null)\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 Capabilities } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<Capabilities>()\nexport class MockCapabilities implements Capabilities {\n sampleRate: number | null = null\n dash = false\n hls = false\n mse = false\n eme = false\n\n canPlayType = spyFactory('canPlayType')\n canPlayTypeMse = spyFactory('canPlayTypeMse')\n supportsKeySystem = spyFactory('supportsKeySystem')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Required properties on AdaptationSetType\nimport { parseDashManifest } from '@amazon/vinyl-mpd-parser'\n\nexport const mockDashManifest = parseDashManifest(\n // language=XML\n `<?xml version=\"1.0\" ?>\n<MPD profiles=\"\" minBufferTime=\"PT0.0S\" type=\"static\" xmlns=\"urn:mpeg:dash:schema:mpd:2011\">\n <Period>\n <AdaptationSet>\n <Representation id=\"0\" bandwidth=\"0\"/>\n </AdaptationSet>\n </Period>\n</MPD>`\n)\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport type {\n DashManifestController,\n DashManifestData,\n ManifestControllerEventMap,\n} from '@amazon/vinyl'\nimport {\n type EventHandler,\n EventHostImpl,\n type SignalOptions,\n} from '@amazon/vinyl-util'\nimport { data } from '@amazon/vinyl-observable'\nimport { mockDashManifest } from './mockDashManifest'\n\nconst spyFactory = createSpyFactory<DashManifestController>()\n\n/**\n * Mock implementation of DashManifestController.\n *\n * Uses a real MutableValue internally so that map/pick/onData work correctly.\n */\nexport class MockDashManifestController implements DashManifestController {\n private readonly _data = data<Promise<DashManifestData>>(\n Promise.resolve({\n manifest: mockDashManifest,\n baseUrl: 'https://example.com',\n })\n )\n private readonly events = new EventHostImpl<ManifestControllerEventMap>()\n\n refresh = spyFactory('refresh')\n reset = spyFactory('reset')\n\n on<K extends keyof ManifestControllerEventMap>(\n type: K,\n handler: EventHandler<ManifestControllerEventMap[K]>,\n options?: SignalOptions\n ) {\n return this.events.on(type, handler, options)\n }\n\n dispatch<K extends keyof ManifestControllerEventMap>(\n type: K,\n event: ManifestControllerEventMap[K]\n ) {\n this.events.dispatch(type, event)\n }\n\n hasAnyListeners() {\n return this.events.hasAnyListeners()\n }\n\n hasListeners(type: keyof ManifestControllerEventMap) {\n return this.events.hasListeners(type)\n }\n\n readonly __eventMapType = this.events.__eventMapType\n\n get value() {\n return this._data.value\n }\n\n get changeId() {\n return this._data.changeId\n }\n\n getValue() {\n return this._data.getValue()\n }\n\n onData(\n callback: (\n value: Promise<DashManifestData>,\n previous: Promise<DashManifestData> | undefined\n ) => void\n ) {\n return this._data.onData(callback)\n }\n\n map<U>(transform: (value: Promise<DashManifestData>) => U) {\n return this._data.map(transform)\n }\n\n pick<K extends keyof NonNullable<Promise<DashManifestData>>>(prop: K) {\n return this._data.pick(prop)\n }\n\n setManifest(manifest: Promise<DashManifestData>) {\n this._data.value = manifest\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 { DrmKeySystem } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<typeof MSMediaKeys & MSMediaKeys>()\n\nexport class MockMSMediaKeys implements MSMediaKeys {\n constructor(readonly keySystem: DrmKeySystem) {}\n\n createSession = spyFactory('createSession')\n\n static isTypeSupported = spyFactory('isTypeSupported')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n createSpyFactory,\n MockEventTarget,\n} from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<MSMediaKeySession>()\nexport class MockMSMediaKeySession\n extends MockEventTarget\n implements MSMediaKeySession\n{\n error: MSMediaKeyError | null = null\n keySystem = ''\n onmskeyadded = null\n onmskeyerror = null\n onmskeymessage = null\n sessionId = ''\n\n close = spyFactory('close')\n\n update = spyFactory('update')\n\n addEventListener = spyFactory('addEventListener')\n\n dispatchEvent = spyFactory('dispatchEvent')\n\n removeEventListener = spyFactory('removeEventListener')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DrmKeySystem } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<typeof WebKitMediaKeys & WebKitMediaKeys>()\n\nexport class MockWebKitMediaKeys implements WebKitMediaKeys {\n constructor(public readonly keySystem: DrmKeySystem) {}\n\n createSession = spyFactory('createSession')\n\n static isTypeSupported = spyFactory('isTypeSupported')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n MockEventTarget,\n createSpyFactory,\n} from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<WebKitMediaKeySession>()\nexport class MockWebKitMediaKeySession\n extends MockEventTarget\n implements WebKitMediaKeySession\n{\n error: WebKitMediaKeyError | null = null\n keySystem = ''\n onwebkitkeyadded = null\n onwebkitkeyerror = null\n onwebkitkeymessage = null\n sessionId = ''\n\n close = spyFactory('close')\n\n update = spyFactory('update')\n\n addEventListener = spyFactory('addEventListener')\n\n dispatchEvent = spyFactory('dispatchEvent')\n\n removeEventListener = spyFactory('removeEventListener')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { CommonEme } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<CommonEme>()\n\nexport class MockCommonEme implements CommonEme {\n requestMediaKeySystemAccess = spyFactory('requestMediaKeySystemAccess')\n\n addEncryptedListener = spyFactory('addEncryptedListener')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { type CommonMediaKeys, DrmKeySystem } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<CommonMediaKeys>()\nexport class MockCommonMediaKeys implements CommonMediaKeys {\n keySystem: DrmKeySystem = DrmKeySystem.CLEAR_KEY\n clearFromElement = spyFactory('clearFromElement')\n createSession = spyFactory('createSession')\n setOnElement = spyFactory('setOnElement')\n setServerCertificate = spyFactory('setServerCertificate')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DrmInitDataType } from '@amazon/vinyl'\nimport {\n type CommonMediaKeySession,\n type CommonMediaKeySessionEventMap,\n type EncryptedInitData,\n} from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<CommonMediaKeySession>()\nexport class MockCommonMediaKeySession\n extends MockEventHost<CommonMediaKeySessionEventMap>\n implements CommonMediaKeySession\n{\n initData: EncryptedInitData = new ArrayBuffer(0)\n initDataType: DrmInitDataType = 'cenc'\n mimeType = ''\n disposed = false\n\n update = spyFactory('update')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DrmKeySystem } from '@amazon/vinyl'\nimport { type CommonMediaKeySystemAccess } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<CommonMediaKeySystemAccess>()\n\nexport class MockCommonMediaKeySystemAccess implements CommonMediaKeySystemAccess {\n constructor(public keySystem: DrmKeySystem) {}\n\n createMediaKeys = spyFactory('createMediaKeys')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DrmController, DrmControllerEventMap } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<DrmController>()\nexport class MockDrmController\n extends MockEventHost<DrmControllerEventMap>\n implements DrmController\n{\n error: Error | null = null\n\n configure = spyFactory('configure')\n isEmeSupported = spyFactory('isEmeSupported')\n isSupported = spyFactory('isSupported')\n initializeForPlayback = spyFactory('initializeForPlayback')\n setBufferingDrmInfo = spyFactory('setBufferingDrmInfo')\n closeSessions = spyFactory('closeSessions')\n reset = spyFactory('reset')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport type {\n HlsManifestController,\n HlsManifestData,\n ManifestControllerEventMap,\n} from '@amazon/vinyl'\nimport {\n type EventHandler,\n EventHostImpl,\n type SignalOptions,\n} from '@amazon/vinyl-util'\nimport { data } from '@amazon/vinyl-observable'\nimport { mockHlsManifestData } from './mockHlsManifest'\n\nconst spyFactory = createSpyFactory<HlsManifestController>()\n\n/**\n * Mock implementation of HlsManifestController.\n *\n * Uses a real MutableValue internally so that map/pick/onData work correctly.\n */\nexport class MockHlsManifestController implements HlsManifestController {\n private readonly _data = data<Promise<HlsManifestData>>(\n Promise.resolve(mockHlsManifestData)\n )\n private readonly events = new EventHostImpl<ManifestControllerEventMap>()\n\n refresh = spyFactory('refresh')\n reset = spyFactory('reset')\n\n on<K extends keyof ManifestControllerEventMap>(\n type: K,\n handler: EventHandler<ManifestControllerEventMap[K]>,\n options?: SignalOptions\n ) {\n return this.events.on(type, handler, options)\n }\n\n hasAnyListeners() {\n return this.events.hasAnyListeners()\n }\n\n hasListeners(type: keyof ManifestControllerEventMap) {\n return this.events.hasListeners(type)\n }\n\n readonly __eventMapType = this.events.__eventMapType\n\n get value() {\n return this._data.value\n }\n\n get changeId() {\n return this._data.changeId\n }\n\n getValue() {\n return this._data.getValue()\n }\n\n onData(\n callback: (\n value: Promise<HlsManifestData>,\n previous: Promise<HlsManifestData> | undefined\n ) => void\n ) {\n return this._data.onData(callback)\n }\n\n map<U>(transform: (value: Promise<HlsManifestData>) => U) {\n return this._data.map(transform)\n }\n\n pick<K extends keyof NonNullable<Promise<HlsManifestData>>>(prop: K) {\n return this._data.pick(prop)\n }\n\n setManifest(manifest: Promise<HlsManifestData>) {\n this._data.value = manifest\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 { HistoryLogHandler, HistoryLogItem } from '@amazon/vinyl-util'\nimport { LogLevel } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<HistoryLogHandler>()\nexport class MockHistoryLogHandler implements HistoryLogHandler {\n logLevel: LogLevel = LogLevel.DEBUG\n maxHistorySize = 0\n history: HistoryLogItem[] = []\n clear = spyFactory('clear')\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 LoudnessNormalizationController,\n LoudnessNormalizationControllerEventMap,\n} from '@amazon/vinyl'\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<LoudnessNormalizationController>()\n\nexport class MockLoudnessNormalizationController\n extends MockEventHost<LoudnessNormalizationControllerEventMap>\n implements LoudnessNormalizationController\n{\n gain = 1.0\n setTrackLoudness = spyFactory('setTrackLoudness')\n clear = spyFactory('clear')\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 PlaybackController,\n PlaybackControllerEventMap,\n} from '@amazon/vinyl'\nimport { PlaybackNetworkState, PlaybackReadyState } from '@amazon/vinyl'\nimport { RangesImpl } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<PlaybackController>()\n\nexport class MockPlaybackController\n extends MockEventHost<PlaybackControllerEventMap>\n implements PlaybackController\n{\n buffered = new RangesImpl()\n canPlay = false\n canPlayThrough = false\n currentTime = 0\n currentTimePercent = 0\n defaultPlaybackRate = 0\n duration = 0\n ended = false\n error: Error | null = null\n hasMetadata = false\n loop = false\n muted = false\n networkState: PlaybackNetworkState = PlaybackNetworkState.NETWORK_IDLE\n pause = spyFactory('pause')\n paused = false\n play = spyFactory('play')\n playIsPending = false\n playbackRate = 0\n playing = false\n preservesPitch = true\n readyState: PlaybackReadyState = PlaybackReadyState.HAVE_NOTHING\n reset = spyFactory('reset')\n seekTo = spyFactory('seekTo')\n seekable = new RangesImpl()\n seeking = false\n volume = 0\n waiting = false\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { CrossOrigin, PlaybackSource } from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<PlaybackSource>()\nexport class MockPlaybackSource implements PlaybackSource {\n crossOrigin: CrossOrigin = null\n currentSrc = ''\n src: string | null = null\n srcObject: MediaStream | null = null\n disableRemotePlayback = false\n\n load = spyFactory('load')\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 Track,\n TrackController,\n TrackControllerEventMap,\n TrackLoadOptions,\n} from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<TrackController<any>>()\n\nexport class MockTrackController<\n TrackLoadOptionsType extends TrackLoadOptions = TrackLoadOptions,\n>\n extends MockEventHost<TrackControllerEventMap<TrackLoadOptionsType>>\n implements TrackController<TrackLoadOptionsType>\n{\n activeTrack: Track | null = null\n\n currentAdTrack: Track | null = null\n\n queue: any[] = []\n\n clearPrefetch = spyFactory('clearPrefetch')\n clearQueue = spyFactory('clearQueue')\n clearTrackCache = spyFactory('clearTrackCache')\n enqueue = spyFactory('enqueue')\n getCachedTrack = spyFactory('getCachedTrack')\n getCachedTracks = spyFactory('getCachedTracks')\n hasNext = spyFactory('hasNext')\n isTrackCached = spyFactory('isTrackCached')\n load = spyFactory('load')\n next = spyFactory('next')\n preload = spyFactory('preload')\n unload = spyFactory('unload')\n reset = spyFactory('reset')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport {\n type MediaSourceController,\n type MediaSourceControllerEventMap,\n} from '@amazon/vinyl'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<MediaSourceController>()\n\nexport class MockMediaSourceController\n extends MockEventHost<MediaSourceControllerEventMap>\n implements MediaSourceController\n{\n readyState: ReadyState = 'closed'\n createSourceBuffer = spyFactory('createSourceBuffer')\n endOfStream = spyFactory('endOfStream')\n activate = spyFactory('activate')\n deactivate = spyFactory('deactivate')\n readyToAppend = false\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 ContentStream,\n ContentType,\n MediaQualityMetadata,\n StreamingEventMap,\n} from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\nimport { RangesImpl } from '@amazon/vinyl-util'\n\nconst spyFactory = createSpyFactory<ContentStream>()\n\nexport class MockContentStream\n extends MockEventHost<StreamingEventMap>\n implements ContentStream\n{\n contentType: ContentType = 'audio'\n bufferingQuality: MediaQualityMetadata | null = null\n error: Error | null = null\n fetchedRanges = new RangesImpl()\n playbackQuality: MediaQualityMetadata | null = null\n streamingQuality: MediaQualityMetadata | null = null\n bufferingEnded = false\n hasData = false\n\n clearPrefetch = spyFactory('clearPrefetch')\n\n activate = spyFactory('activate')\n\n deactivate = spyFactory('deactivate')\n\n preload = spyFactory('preload')\n\n reset = spyFactory('reset')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TextTrackController, TextTrackInfo } from '../../../../src'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nconst spyFactory = createSpyFactory<TextTrackController>()\n\nexport class MockTextTrackController\n extends MockEventHost\n implements TextTrackController\n{\n textTracks: readonly TextTrackInfo[] = []\n activeTextTrack: TextTrackInfo | null = null\n active = false\n\n deactivate = spyFactory('deactivate')\n activate = spyFactory('activate')\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 ContentType,\n createEmptyMediaQualityMetadata,\n type DashMediaQualityMetadataResolver,\n type DashTrackDeps,\n defaultQualitySelectorImplOptions,\n type MediaTimeline,\n type VinylOptions,\n} from '@amazon/vinyl'\nimport { MockDashManifestController } from '../../dash/MockDashManifestController'\nimport { MockMediaSourceController } from '../../streaming/buffering/MockMediaSourceController'\nimport { MockPlaybackSource } from '../../playback/MockPlaybackSource'\nimport { MockContentStream } from '../../streaming/MockContentStream'\nimport { MockPlaybackController } from '../../playback/MockPlaybackController'\nimport { MockDrmController } from '../../drm/MockDrmController'\nimport { MockTextTrackController } from '../../text/MockTextTrackController'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { data } from '@amazon/vinyl-observable'\n\nimport createSpy = jasmine.createSpy\n\nconst emptyTimeline: MediaTimeline = {\n periods: [],\n minBufferTime: 0,\n getAdBreaks: () => Promise.resolve([]),\n getDuration: () => Promise.resolve(Infinity),\n}\n\nconst spyFactory = createSpyFactory<DashTrackDeps>()\nexport function createMockDashDependencies() {\n const playbackController = new MockPlaybackController()\n playbackController.seekTo.and.resolveTo(void 0)\n\n const manifestController = new MockDashManifestController()\n\n return {\n textTrackController: new MockTextTrackController(),\n contentTypesValue: data(Promise.resolve(new Set<ContentType>())),\n contentStreamFactory: spyFactory('contentStreamFactory').and.callFake(\n (contentType) => {\n const stream = new MockContentStream()\n stream.contentType = contentType\n return stream\n }\n ),\n manifestController,\n manifestTransformed: manifestController,\n mediaTimeline: data(Promise.resolve(emptyTimeline)),\n mediaTimelineTransformed: data(Promise.resolve(emptyTimeline)),\n mediaSourceController: new MockMediaSourceController(),\n playbackSource: new MockPlaybackSource(),\n playbackController,\n drmController: new MockDrmController(),\n mediaQualityMetadataResolver:\n createSpy<DashMediaQualityMetadataResolver>().and.callFake(() =>\n createEmptyMediaQualityMetadata()\n ),\n audio: data<VinylOptions['audio']>({\n selection: { language: null, descriptive: false },\n }),\n allowedContentTypes: data<VinylOptions['allowedContentTypes']>(null),\n abr: data<VinylOptions['abr']>(defaultQualitySelectorImplOptions),\n } as const satisfies DashTrackDeps\n}\n\nexport type MockDashDependencies = ReturnType<typeof createMockDashDependencies>\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n AutoResetController,\n AutoResetControllerEventMap,\n} from '@amazon/vinyl'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<AutoResetController>()\nexport class MockAutoResetController\n extends MockEventHost<AutoResetControllerEventMap>\n implements AutoResetController\n{\n setError = spyFactory('setError')\n clear = spyFactory('clear')\n resetPending = false\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport type { QualitySelector } from '@amazon/vinyl'\n\nconst spyFactory = createSpyFactory<QualitySelector>()\n\nexport class MockQualitySelector implements QualitySelector {\n selectQuality = spyFactory('selectQuality')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport type {\n BufferingController,\n BufferingControllerEventMap,\n MediaQualityMetadata,\n} from '@amazon/vinyl'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<BufferingController>()\n\nexport class MockBufferingController\n extends MockEventHost<BufferingControllerEventMap>\n implements BufferingController\n{\n error: Error | null = null\n active = false\n bufferingEnded = false\n hasData = false\n playbackQuality: MediaQualityMetadata | null = null\n bufferingQuality: MediaQualityMetadata | null = null\n activate = spyFactory('activate')\n deactivate = spyFactory('deactivate')\n clear = spyFactory('clear')\n reset = spyFactory('reset')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { type SourceBufferController } from '@amazon/vinyl'\n\nimport { RangesImpl } from '@amazon/vinyl-util'\n\nconst spyFactory = createSpyFactory<SourceBufferController>()\n\nexport class MockSourceBufferController implements SourceBufferController {\n buffered = new RangesImpl()\n\n append = spyFactory('append')\n\n appendInit = spyFactory('appendInit')\n\n clear = spyFactory('clear')\n\n enqueue = spyFactory('enqueue')\n\n isBusy = spyFactory('isBusy')\n\n remove = spyFactory('remove')\n\n setAppendWindow = spyFactory('setAppendWindow')\n\n setTimestampOffset = spyFactory('setTimestampOffset')\n\n dispose = spyFactory('dispose')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport {\n type MediaQualityMetadata,\n type SegmentController,\n type SegmentControllerEventMap,\n} from '@amazon/vinyl'\nimport { emptyRanges } from '@amazon/vinyl-util'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<SegmentController>()\n\nexport class MockSegmentController\n extends MockEventHost<SegmentControllerEventMap>\n implements SegmentController\n{\n error: Error | null = null\n\n configure = spyFactory('configure')\n\n fetchedRanges = emptyRanges\n\n activate = spyFactory('activate')\n\n clear = spyFactory('clear')\n\n deactivate = spyFactory('deactivate')\n\n getSegment = spyFactory('getSegment')\n\n streamingQuality: MediaQualityMetadata | null = null\n\n reset = spyFactory('reset')\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 ContentType,\n createEmptyMediaQualityMetadata,\n defaultQualitySelectorImplOptions,\n type HlsMediaQualityMetadataResolver,\n type HlsTrackDeps,\n type MediaTimeline,\n type VinylOptions,\n} from '@amazon/vinyl'\nimport { MockHlsManifestController } from '../../hls/MockHlsManifestController'\nimport { MockMediaSourceController } from '../../streaming/buffering/MockMediaSourceController'\nimport { MockPlaybackSource } from '../../playback/MockPlaybackSource'\nimport { MockContentStream } from '../../streaming/MockContentStream'\nimport { MockPlaybackController } from '../../playback/MockPlaybackController'\nimport { MockDrmController } from '../../drm/MockDrmController'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { data } from '@amazon/vinyl-observable'\n\nimport createSpy = jasmine.createSpy\n\nconst emptyTimeline: MediaTimeline = {\n periods: [],\n minBufferTime: 0,\n getAdBreaks: () => Promise.resolve([]),\n getDuration: () => Promise.resolve(Infinity),\n}\n\nconst spyFactory = createSpyFactory<HlsTrackDeps>()\nexport function createMockHlsDependencies() {\n const playbackController = new MockPlaybackController()\n playbackController.seekTo.and.resolveTo(void 0)\n\n const manifestController = new MockHlsManifestController()\n\n return {\n contentTypesValue: data(Promise.resolve(new Set<ContentType>())),\n contentStreamFactory: spyFactory('contentStreamFactory').and.callFake(\n (contentType) => {\n const stream = new MockContentStream()\n stream.contentType = contentType\n return stream\n }\n ),\n manifestController,\n manifestTransformed: manifestController.map((v) => v),\n mediaTimeline: data(Promise.resolve(emptyTimeline)),\n mediaTimelineTransformed: data(Promise.resolve(emptyTimeline)),\n mediaSourceController: new MockMediaSourceController(),\n playbackSource: new MockPlaybackSource(),\n playbackController,\n drmController: new MockDrmController(),\n mediaQualityMetadataResolver:\n createSpy<HlsMediaQualityMetadataResolver>().and.callFake(() =>\n createEmptyMediaQualityMetadata()\n ),\n audio: data<VinylOptions['audio']>({\n selection: { language: null, descriptive: false },\n }),\n allowedContentTypes: data<VinylOptions['allowedContentTypes']>(null),\n abr: data<VinylOptions['abr']>(defaultQualitySelectorImplOptions),\n } as const satisfies HlsTrackDeps\n}\n\nexport type MockHlsDependencies = ReturnType<typeof createMockHlsDependencies>\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n type AdController,\n type ContentType,\n type MediaQualityMetadata,\n type SeekRange,\n type TextTrackController,\n type Track,\n type TrackAds,\n type TrackEventMap,\n} from '@amazon/vinyl'\nimport { RangesImpl } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '@amazon/vinyl-util/testUtil'\n\nconst spyFactory = createSpyFactory<Track>()\n\nexport class MockTrack extends MockEventHost<TrackEventMap> implements Track {\n get [Symbol.toStringTag](): string {\n return `MockTrack(${this.uri})`\n }\n\n ads: TrackAds | null = null\n\n /**\n * Resolves the track's ads. Mirrors the real async `getAds()` contract; the\n * `ads` field is the backing value (defaulting to an empty break list).\n */\n getAds(): Promise<TrackAds> {\n return Promise.resolve(this.ads ?? { trackUri: this.uri, adBreaks: [] })\n }\n\n uri = ''\n type = ''\n active = false\n fetchedRanges = new RangesImpl()\n preload = spyFactory('preload')\n contentTypes: Set<ContentType> = new Set()\n qualities: readonly MediaQualityMetadata[] | null = null\n qualitiesUnfiltered: readonly MediaQualityMetadata[] | null = null\n getStreamingQuality = spyFactory('getStreamingQuality')\n getBufferingQuality = spyFactory('getBufferingQuality')\n getPlaybackQuality = spyFactory('getPlaybackQuality')\n extra: any = undefined\n error: Error | null = null\n textTrackController: TextTrackController | null = null\n adController: AdController | null = null\n seekRange: SeekRange | null = null\n\n activate = spyFactory('activate')\n deactivate = spyFactory('deactivate')\n\n clearPrefetch = spyFactory('clearPrefetch')\n reset = spyFactory('reset')\n disposed = false\n\n /**\n * Installs fakes for activate and deactivate to set active status.\n */\n implementActivateFakes() {\n this.activate.and.callFake(() => {\n this.active = true\n })\n this.deactivate.and.callFake(() => {\n this.active = false\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 { parseDashManifest } from '@amazon/vinyl-mpd-parser'\nimport { benchmark } from '@amazon/vinyl-util/browserTestUtil'\nimport { dash_segmentListMediaRange } from '@amazon/vinyl/vinylTestUtil'\nimport { addBenchmarks, setupBenchmark } from '../../setup'\n\ndescribe('parseDashManifest', () => {\n setupBenchmark()\n\n it('Parse Dash', async () => {\n addBenchmarks(\n 'Parse Dash - isoff on demand',\n await benchmark('SAX', () =>\n parseDashManifest(dash_segmentListMediaRange)\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\n/** Payload templates cycled across the generated cues, exercising the payload\n * shapes the parser must handle: styled classes, inline tags, voice/lang spans,\n * multi-line cues, and dialogue dashes. Generic placeholder text. */\nconst PAYLOADS = [\n `<c.emphasis>The quick brown fox jumps</c>`,\n `<c.emphasis>over the lazy dog.</c>`,\n `<c.emphasis>A sentence that wraps\\nacross two lines of caption.</c>`,\n `-<c.emphasis>First speaker line.</c>\\n-Second speaker replies.`,\n `-Line one of dialogue.\\n-Line two of dialogue.`,\n `<i>Italic emphasis here</i>\\n<b>and bold on the next line.</b>`,\n `<v Speaker>A line attributed to a voice.</v>`,\n `Lorem ipsum dolor sit amet.`,\n]\n\nconst SETTINGS = [\n ' align:middle line:85%,start position:50%,middle',\n ' align:start line:80% position:20%,line-left size:80%',\n '',\n]\n\nfunction buildSampleVtt(cueCount: number): string {\n const blocks = [\n 'WEBVTT',\n 'X-TIMESTAMP-MAP=MPEGTS:900000,LOCAL:00:00:00.000',\n '',\n 'STYLE',\n '::cue(.emphasis) { font-style:italic }',\n '',\n ]\n for (let i = 0; i < cueCount; i++) {\n blocks.push(\n String(i + 1),\n `${formatTs(i * 3)} --> ${formatTs(i * 3 + 2)}${SETTINGS[i % SETTINGS.length]}`,\n PAYLOADS[i % PAYLOADS.length],\n ''\n )\n }\n return blocks.join('\\n')\n}\n\nfunction formatTs(totalSeconds: number): string {\n const h = Math.floor(totalSeconds / 3600)\n const m = Math.floor((totalSeconds % 3600) / 60)\n const s = totalSeconds % 60\n const pad = (n: number) => n.toString().padStart(2, '0')\n return `${pad(h)}:${pad(m)}:${pad(s)}.000`\n}\n\n/**\n * A large, complex WebVTT document for benchmarking the parser. Modeled on\n * real sidecar caption output (a `STYLE` block with a `::cue` class rule,\n * per-cue timing settings, `<c.class>` / `<i>` / `<v>` payload tags, multi-line\n * cues, and dialogue dashes), scaled up to thousands of cues.\n */\nexport const sampleVtt = buildSampleVtt(4000)\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { parseWebVtt } from '@amazon/vinyl'\nimport { benchmark } from '@amazon/vinyl-util/browserTestUtil'\nimport { addBenchmarks, setupBenchmark } from '../setup'\nimport { sampleVtt } from './sampleVtt'\n\n/** Benchmarks the WebVTT parser over a large, complex document. */\ndescribe('parseWebVtt', () => {\n setupBenchmark()\n\n it('parses a large document', async () => {\n addBenchmarks(\n 'parseWebVtt - large document',\n await benchmark('parseWebVtt', () => parseWebVtt(sampleVtt))\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 { LinkedList } from '@amazon/vinyl-util'\nimport { benchmark } from '@amazon/vinyl-util/browserTestUtil'\nimport { addBenchmarks, setupBenchmark } from '../../setup'\n\ndescribe('LinkedList', () => {\n setupBenchmark()\n\n interface Element {\n r: number\n a: number\n b: number\n }\n\n function createList(n: number): LinkedList<Element> {\n const list = new LinkedList<Element>()\n for (let i = 0; i < n; i++) {\n list.push({ r: 0, a: Math.random(), b: Math.random() })\n }\n return list\n }\n\n function createArray(n: number) {\n const arr: Element[] = []\n for (let i = 0; i < n; i++) {\n arr.push({ r: 0, a: Math.random(), b: Math.random() })\n }\n return arr\n }\n\n ;[100, 1000].forEach((size) => {\n const list = createList(size)\n const arr = createArray(size)\n\n describe(`size: ${size}`, () => {\n it('forEach', async () => {\n const name = `forEach ${size}`\n // Having an unpredictable output in the executor prevents the JS engine from\n // any potential caching.\n const listResults = await benchmark(\n `LinkedList ${name}`,\n () => {\n list.forEach((e: Element) => (e.r = e.a + e.b))\n }\n )\n const arrayResults = await benchmark(`Array ${name}`, () => {\n arr.forEach((e) => (e.r = e.a + e.b))\n })\n addBenchmarks(name, listResults, arrayResults)\n })\n\n it('unshift', async () => {\n const name = `unshift/shift ${size}`\n const e = { r: 0, a: 0, b: 0 }\n const listResults = await benchmark(\n `LinkedList ${name}`,\n () => {\n list.unshift(e)\n list.shift()\n }\n )\n const arrayResults = await benchmark(`Array ${name}`, () => {\n arr.unshift(e)\n arr.shift()\n })\n addBenchmarks(name, listResults, arrayResults)\n })\n\n it('push', async () => {\n const name = `push/pop ${size}`\n const e = { r: 0, a: 0, b: 0 }\n const listResults = await benchmark(\n `LinkedList ${name}`,\n () => {\n list.push(e)\n list.pop()\n }\n )\n const arrayResults = await benchmark(`Array ${name}`, () => {\n arr.push(e)\n arr.pop()\n })\n addBenchmarks(name, listResults, arrayResults)\n })\n\n it('for of', async () => {\n const name = `for of ${size}`\n const listResults = await benchmark(\n `LinkedList ${name}`,\n () => {\n for (const e of list) {\n e.r = e.a + e.b\n }\n }\n )\n const arrayResults = await benchmark(`Array ${name}`, () => {\n for (const e of arr) {\n e.r = e.a + e.b\n }\n })\n addBenchmarks(name, listResults, arrayResults)\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 { mergeDeep } from '@amazon/vinyl-util'\nimport { benchmark } from '@amazon/vinyl-util/browserTestUtil'\nimport { addBenchmarks, setupBenchmark } from '../../setup'\n\ndescribe('mergeDeep', () => {\n setupBenchmark()\n it('object merge', async () => {\n const a = {\n b: {\n c: 3,\n d: 4,\n e: 'test',\n },\n f: {\n g: 5,\n h: true,\n i: false,\n },\n j: {\n k: {\n m: 5,\n },\n },\n }\n\n const b = {\n b: {\n d: 4,\n f2: 'test2',\n },\n f: {\n g: 5,\n h: true,\n i: false,\n },\n j: {\n k: {\n m: 5,\n },\n },\n }\n\n const mergeDeepResults = await benchmark(`mergeDeep`, () => {\n mergeDeep([a, b])\n })\n addBenchmarks('merge deep', mergeDeepResults)\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 '@amazon/vinyl-util'\nimport { benchmark } from '@amazon/vinyl-util/browserTestUtil'\nimport { addBenchmarks, setupBenchmark } from '../../setup'\n\ndescribe('json', () => {\n setupBenchmark()\n\n it('toJson', async () => {\n const results = await benchmark(`toJson`, () => {\n toJson({\n requestInfo: {\n fetchId: 'lgn9lrwaid8o3utd5r',\n init: {\n method: 'POST',\n headers: {\n 'Content-Encoding': 'amz-1.0',\n 'Content-Type': 'application/json',\n 'X-Amz-Target':\n 'com.amazon.digitalmusiclocator.DigitalMusicLocatorServiceExternal.getStreamingURLs',\n },\n body: '{\"contentIdList\":[{\"identifier\":\"d9e4e337-97ba-41a9-9f31-84a8bf99f1dc\",\"identifierType\":\"COID\"}],\"bitRate\":\"HIGH\",\"deviceToken\":{\"deviceId\":\"lg4msezd1e355heuc5b\",\"deviceTypeId\":\"A16ZV8BU3SN1N3\"},\"appMetadata\":{\"appId\":\"WebCP\",\"https\":true,\"appVersion\":\"1.0.0\"},\"clientMetadata\":{\"clientId\":\"WebCP\",\"clientRequestId\":\"lgn9lrw623mgvi7k3et\"}}',\n signal: '[object AbortSignal]',\n },\n input: 'https://example.com/bar/',\n maxRetries: 1,\n timestamp: new Date('2023-04-19T05:40:17.914Z'),\n requestOptions: {\n serviceId: null,\n readErrorBody: 1,\n },\n },\n attemptInfo: {\n currentTry: 1,\n timestamp: new Date('2023-04-19T05:40:17.914Z'),\n },\n target: '[object FetchProviderImpl]',\n })\n })\n addBenchmarks('toJson', results)\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;AAAA;AAAA;AAAA;AAAA,IAKA,SAAe;AACX,aAAO;AAAA,QACH,OAAO,KAAK;AAAA,QACZ,SAAS,KAAK;AAAA,QACd,MAAM,KAAK;AAAA,QACX,QAAQ,KAAK;AAAA,QACb,OAAO,KAAK;AAAA,MAChB;AAAA,IACJ;AAAA,EACJ;;;AC/CO,MAAM,uBAAN,MAAM,8BAA6B,gBAAgB;AAAA,IAKtD,YACI,SACS,aAAa,MACxB;AACE,YAAM,SAAS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MACJ;AAEA,YAAM,IAAI;AAAA,QACN,GAAG;AAAA,UACC,GAAG;AAAA,UACH,IAAI;AAAA,QACR;AAAA,QACA,GAAG;AAAA,UACC,GAAG;AAAA,UACH,GAAG;AAAA,UACH,GAAG;AAAA,QACP;AAAA,QACA,GAAG;AAAA,UACC,GAAG;AAAA,YACC,GAAG;AAAA,UACP;AAAA,QACJ;AAAA,MACJ;AAEA,YAAM,mBAAmB,MAAM,UAAU,aAAa,MAAM;AACxD,kBAAU,CAAC,GAAG,CAAC,CAAC;AAAA,MACpB,CAAC;AACD,oBAAc,cAAc,gBAAgB;AAAA,IAChD,CAAC;AAAA,EACL,CAAC;;;AC3CD,WAAS,QAAQ,MAAM;AACnB,mBAAe;AAEf,OAAG,UAAU,YAAY;AACrB,YAAM,UAAU,MAAM,UAAU,UAAU,MAAM;AAC5C,eAAO;AAAA,UACH,aAAa;AAAA,YACT,SAAS;AAAA,YACT,MAAM;AAAA,cACF,QAAQ;AAAA,cACR,SAAS;AAAA,gBACL,oBAAoB;AAAA,gBACpB,gBAAgB;AAAA,gBAChB,gBACI;AAAA,cACR;AAAA,cACA,MAAM;AAAA,cACN,QAAQ;AAAA,YACZ;AAAA,YACA,OAAO;AAAA,YACP,YAAY;AAAA,YACZ,WAAW,oBAAI,KAAK,0BAA0B;AAAA,YAC9C,gBAAgB;AAAA,cACZ,WAAW;AAAA,cACX,eAAe;AAAA,YACnB;AAAA,UACJ;AAAA,UACA,aAAa;AAAA,YACT,YAAY;AAAA,YACZ,WAAW,oBAAI,KAAK,0BAA0B;AAAA,UAClD;AAAA,UACA,QAAQ;AAAA,QACZ,CAAC;AAAA,MACL,CAAC;AACD,oBAAc,UAAU,OAAO;AAAA,IACnC,CAAC;AAAA,EACL,CAAC;",
|
|
6
|
+
"names": ["remove", "_a", "signal", "element", "it", "_a", "key", "value", "newInitializer", "_a", "_a", "locale", "last", "sourceA", "sourceB", "prop", "element", "_a", "_a", "locale", "locale", "_a", "value", "locale", "location", "_a", "benchmark", "_a", "element", "input", "_a", "locale", "locale", "_a", "locale", "locale", "locale", "locale", "locale", "stringify", "_a", "rules", "locale", "_a", "charsStart", "name", "c", "char", "_a", "element", "name", "last", "number", "text", "_a", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory", "spyFactory"]
|
|
7
7
|
}
|