From 78078da0cd035d0d177cc2cb696e05d96fba7d11 Mon Sep 17 00:00:00 2001 From: Ivan <98037481+IvanZosimov@users.noreply.github.com> Date: Tue, 17 Oct 2023 11:09:10 +0200 Subject: [PATCH] Update @actions/cache dependency and documentation (#549) * deps: Update actions/cache dep, rebuild solution, update docs * docs: fix typo * deps: update jest dependencies and licenses * deps: fix vulnerable dependencies, rebuild solution * licenses: update --- .licenses/npm/@actions/cache.dep.yml | 2 +- .../npm/@actions/http-client-2.2.0.dep.yml | 32 + .licenses/npm/@azure/abort-controller.dep.yml | 4 +- .licenses/npm/@fastify/busboy.dep.yml | 30 + ...16.11.25.dep.yml => node-16.18.58.dep.yml} | 2 +- .licenses/npm/psl.dep.yml | 43 - .licenses/npm/punycode.dep.yml | 34 - .licenses/npm/semver-6.3.0.dep.yml | 26 - ...ver-7.3.8.dep.yml => semver-6.3.1.dep.yml} | 2 +- .licenses/npm/tough-cookie.dep.yml | 23 - .../npm/{ip-regex.dep.yml => undici.dep.yml} | 26 +- README.md | 16 + dist/cleanup/index.js | 34786 +++++- dist/setup/index.js | 99118 ++++++++++------ package-lock.json | 2924 +- package.json | 4 +- 16 files changed, 91741 insertions(+), 45331 deletions(-) create mode 100644 .licenses/npm/@actions/http-client-2.2.0.dep.yml create mode 100644 .licenses/npm/@fastify/busboy.dep.yml rename .licenses/npm/@types/{node-16.11.25.dep.yml => node-16.18.58.dep.yml} (98%) delete mode 100644 .licenses/npm/psl.dep.yml delete mode 100644 .licenses/npm/punycode.dep.yml delete mode 100644 .licenses/npm/semver-6.3.0.dep.yml rename .licenses/npm/{semver-7.3.8.dep.yml => semver-6.3.1.dep.yml} (98%) delete mode 100644 .licenses/npm/tough-cookie.dep.yml rename .licenses/npm/{ip-regex.dep.yml => undici.dep.yml} (69%) diff --git a/.licenses/npm/@actions/cache.dep.yml b/.licenses/npm/@actions/cache.dep.yml index d9a80f6ba..59bff0609 100644 --- a/.licenses/npm/@actions/cache.dep.yml +++ b/.licenses/npm/@actions/cache.dep.yml @@ -1,6 +1,6 @@ --- name: "@actions/cache" -version: 3.0.4 +version: 3.2.2 type: npm summary: Actions cache lib homepage: https://github.com/actions/toolkit/tree/main/packages/cache diff --git a/.licenses/npm/@actions/http-client-2.2.0.dep.yml b/.licenses/npm/@actions/http-client-2.2.0.dep.yml new file mode 100644 index 000000000..216d36c94 --- /dev/null +++ b/.licenses/npm/@actions/http-client-2.2.0.dep.yml @@ -0,0 +1,32 @@ +--- +name: "@actions/http-client" +version: 2.2.0 +type: npm +summary: Actions Http Client +homepage: https://github.com/actions/toolkit/tree/main/packages/http-client +license: mit +licenses: +- sources: LICENSE + text: | + Actions Http Client for Node.js + + Copyright (c) GitHub, Inc. + + All rights reserved. + + MIT License + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +notices: [] diff --git a/.licenses/npm/@azure/abort-controller.dep.yml b/.licenses/npm/@azure/abort-controller.dep.yml index f303d5c3e..b19b8f7a4 100644 --- a/.licenses/npm/@azure/abort-controller.dep.yml +++ b/.licenses/npm/@azure/abort-controller.dep.yml @@ -1,9 +1,9 @@ --- name: "@azure/abort-controller" -version: 1.0.4 +version: 1.1.0 type: npm summary: Microsoft Azure SDK for JavaScript - Aborter -homepage: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/core/abort-controller/README.md +homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/abort-controller/README.md license: mit licenses: - sources: LICENSE diff --git a/.licenses/npm/@fastify/busboy.dep.yml b/.licenses/npm/@fastify/busboy.dep.yml new file mode 100644 index 000000000..ffcc69551 --- /dev/null +++ b/.licenses/npm/@fastify/busboy.dep.yml @@ -0,0 +1,30 @@ +--- +name: "@fastify/busboy" +version: 2.0.0 +type: npm +summary: A streaming parser for HTML form data for node.js +homepage: +license: mit +licenses: +- sources: LICENSE + text: |- + Copyright Brian White. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. +notices: [] diff --git a/.licenses/npm/@types/node-16.11.25.dep.yml b/.licenses/npm/@types/node-16.18.58.dep.yml similarity index 98% rename from .licenses/npm/@types/node-16.11.25.dep.yml rename to .licenses/npm/@types/node-16.18.58.dep.yml index ffa0d8fa0..8219e3849 100644 --- a/.licenses/npm/@types/node-16.11.25.dep.yml +++ b/.licenses/npm/@types/node-16.18.58.dep.yml @@ -1,6 +1,6 @@ --- name: "@types/node" -version: 16.11.25 +version: 16.18.58 type: npm summary: TypeScript definitions for Node.js homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node diff --git a/.licenses/npm/psl.dep.yml b/.licenses/npm/psl.dep.yml deleted file mode 100644 index 385e9aace..000000000 --- a/.licenses/npm/psl.dep.yml +++ /dev/null @@ -1,43 +0,0 @@ ---- -name: psl -version: 1.8.0 -type: npm -summary: Domain name parser based on the Public Suffix List -homepage: https://github.com/lupomontero/psl#readme -license: mit -licenses: -- sources: LICENSE - text: | - The MIT License (MIT) - - Copyright (c) 2017 Lupo Montero lupomontero@gmail.com - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- sources: README.md - text: |- - The MIT License (MIT) - - Copyright (c) 2017 Lupo Montero - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -notices: [] diff --git a/.licenses/npm/punycode.dep.yml b/.licenses/npm/punycode.dep.yml deleted file mode 100644 index 4a9547e61..000000000 --- a/.licenses/npm/punycode.dep.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- -name: punycode -version: 2.1.1 -type: npm -summary: A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, - and works on nearly all JavaScript platforms. -homepage: https://mths.be/punycode -license: mit -licenses: -- sources: LICENSE-MIT.txt - text: | - Copyright Mathias Bynens - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- sources: README.md - text: Punycode.js is available under the [MIT](https://mths.be/mit) license. -notices: [] diff --git a/.licenses/npm/semver-6.3.0.dep.yml b/.licenses/npm/semver-6.3.0.dep.yml deleted file mode 100644 index 8c62b4ffb..000000000 --- a/.licenses/npm/semver-6.3.0.dep.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -name: semver -version: 6.3.0 -type: npm -summary: The semantic version parser used by npm. -homepage: https://github.com/npm/node-semver#readme -license: isc -licenses: -- sources: LICENSE - text: | - The ISC License - - Copyright (c) Isaac Z. Schlueter and Contributors - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -notices: [] diff --git a/.licenses/npm/semver-7.3.8.dep.yml b/.licenses/npm/semver-6.3.1.dep.yml similarity index 98% rename from .licenses/npm/semver-7.3.8.dep.yml rename to .licenses/npm/semver-6.3.1.dep.yml index 609663b57..248cb0301 100644 --- a/.licenses/npm/semver-7.3.8.dep.yml +++ b/.licenses/npm/semver-6.3.1.dep.yml @@ -1,6 +1,6 @@ --- name: semver -version: 7.3.8 +version: 6.3.1 type: npm summary: The semantic version parser used by npm. homepage: diff --git a/.licenses/npm/tough-cookie.dep.yml b/.licenses/npm/tough-cookie.dep.yml deleted file mode 100644 index 1496c1093..000000000 --- a/.licenses/npm/tough-cookie.dep.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: tough-cookie -version: 3.0.1 -type: npm -summary: RFC6265 Cookies and Cookie Jar for node.js -homepage: https://github.com/salesforce/tough-cookie -license: bsd-3-clause -licenses: -- sources: LICENSE - text: | - Copyright (c) 2015, Salesforce.com, Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -notices: [] diff --git a/.licenses/npm/ip-regex.dep.yml b/.licenses/npm/undici.dep.yml similarity index 69% rename from .licenses/npm/ip-regex.dep.yml rename to .licenses/npm/undici.dep.yml index 95d4b6b56..c59ce5eb8 100644 --- a/.licenses/npm/ip-regex.dep.yml +++ b/.licenses/npm/undici.dep.yml @@ -1,16 +1,16 @@ --- -name: ip-regex -version: 2.1.0 +name: undici +version: 5.26.3 type: npm -summary: Regular expression for matching IP addresses (IPv4 & IPv6) -homepage: https://github.com/sindresorhus/ip-regex#readme +summary: An HTTP/1.1 client, written from scratch for Node.js +homepage: https://undici.nodejs.org license: mit licenses: -- sources: license +- sources: LICENSE text: | - The MIT License (MIT) + MIT License - Copyright (c) Sindre Sorhus (sindresorhus.com) + Copyright (c) Matteo Collina and Undici contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -19,16 +19,16 @@ licenses: copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -- sources: readme.md - text: MIT © [Sindre Sorhus](https://sindresorhus.com) + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +- sources: README.md + text: MIT notices: [] diff --git a/README.md b/README.md index a5512c696..2a333089d 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,22 @@ steps: run: sbt package ``` +#### Cache segment restore timeout +Usually, cache gets downloaded in multiple segments of fixed sizes. Sometimes, a segment download gets stuck, which causes the workflow job to be stuck. The cache segment download timeout [was introduced](https://github.com/actions/toolkit/tree/main/packages/cache#cache-segment-restore-timeout) to solve this issue as it allows the segment download to get aborted and hence allows the job to proceed with a cache miss. The default value of the cache segment download timeout is set to 10 minutes and can be customized by specifying an environment variable named `SEGMENT_DOWNLOAD_TIMEOUT_MINS` with a timeout value in minutes. + +```yaml +env: + SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5' +steps: +- uses: actions/checkout@v3 +- uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + cache: 'gradle' +- run: ./gradlew build --no-daemon +``` + ### Check latest In the basic examples above, the `check-latest` flag defaults to `false`. When set to `false`, the action tries to first resolve a version of Java from the local tool cache on the runner. If unable to find a specific version in the cache, the action will download a version of Java. Use the default or set `check-latest` to `false` if you prefer a faster more consistent setup experience that prioritizes trying to use the cached versions at the expense of newer versions sometimes being available for download. diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 34e109d6a..f302d0281 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -6,6 +6,29 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -15,14 +38,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.saveCache = exports.restoreCache = exports.isFeatureAvailable = exports.ReserveCacheError = exports.ValidationError = void 0; const core = __importStar(__nccwpck_require__(2186)); const path = __importStar(__nccwpck_require__(1017)); const utils = __importStar(__nccwpck_require__(1518)); @@ -74,9 +91,10 @@ exports.isFeatureAvailable = isFeatureAvailable; * @param primaryKey an explicit key for restoring the cache * @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key * @param downloadOptions cache download options + * @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform * @returns string returns the key for the cache hit, otherwise returns undefined */ -function restoreCache(paths, primaryKey, restoreKeys, options) { +function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) { return __awaiter(this, void 0, void 0, function* () { checkPaths(paths); restoreKeys = restoreKeys || []; @@ -94,22 +112,27 @@ function restoreCache(paths, primaryKey, restoreKeys, options) { try { // path are needed to compute version const cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, { - compressionMethod + compressionMethod, + enableCrossOsArchive }); if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) { // Cache not found return undefined; } + if (options === null || options === void 0 ? void 0 : options.lookupOnly) { + core.info('Lookup only - skipping download'); + return cacheEntry.cacheKey; + } archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); core.debug(`Archive Path: ${archivePath}`); // Download the cache from the cache entry yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options); if (core.isDebug()) { - yield tar_1.listTar(archivePath, compressionMethod); + yield (0, tar_1.listTar)(archivePath, compressionMethod); } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`); - yield tar_1.extractTar(archivePath, compressionMethod); + yield (0, tar_1.extractTar)(archivePath, compressionMethod); core.info('Cache restored successfully'); return cacheEntry.cacheKey; } @@ -141,10 +164,11 @@ exports.restoreCache = restoreCache; * * @param paths a list of file paths to be cached * @param key an explicit key for restoring the cache + * @param enableCrossOsArchive an optional boolean enabled to save cache on windows which could be restored on any platform * @param options cache upload options * @returns number returns cacheId if the cache was saved successfully and throws an error if save fails */ -function saveCache(paths, key, options) { +function saveCache(paths, key, options, enableCrossOsArchive = false) { var _a, _b, _c, _d, _e; return __awaiter(this, void 0, void 0, function* () { checkPaths(paths); @@ -161,9 +185,9 @@ function saveCache(paths, key, options) { const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod)); core.debug(`Archive Path: ${archivePath}`); try { - yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod); + yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod); if (core.isDebug()) { - yield tar_1.listTar(archivePath, compressionMethod); + yield (0, tar_1.listTar)(archivePath, compressionMethod); } const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); @@ -175,6 +199,7 @@ function saveCache(paths, key, options) { core.debug('Reserving Cache'); const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, { compressionMethod, + enableCrossOsArchive, cacheSize: archiveFileSize }); if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) { @@ -223,6 +248,29 @@ exports.saveCache = saveCache; "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -232,14 +280,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.saveCache = exports.reserveCache = exports.downloadCache = exports.getCacheEntry = exports.getCacheVersion = void 0; const core = __importStar(__nccwpck_require__(2186)); const http_client_1 = __nccwpck_require__(1825); const auth_1 = __nccwpck_require__(2001); @@ -247,7 +289,6 @@ const crypto = __importStar(__nccwpck_require__(6113)); const fs = __importStar(__nccwpck_require__(7147)); const url_1 = __nccwpck_require__(7310); const utils = __importStar(__nccwpck_require__(1518)); -const constants_1 = __nccwpck_require__(8840); const downloadUtils_1 = __nccwpck_require__(5500); const options_1 = __nccwpck_require__(6215); const requestUtils_1 = __nccwpck_require__(3981); @@ -277,33 +318,43 @@ function createHttpClient() { const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token); return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions()); } -function getCacheVersion(paths, compressionMethod) { - const components = paths.concat(!compressionMethod || compressionMethod === constants_1.CompressionMethod.Gzip - ? [] - : [compressionMethod]); +function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) { + const components = paths; + // Add compression method to cache version to restore + // compressed cache as per compression method + if (compressionMethod) { + components.push(compressionMethod); + } + // Only check for windows platforms if enableCrossOsArchive is false + if (process.platform === 'win32' && !enableCrossOsArchive) { + components.push('windows-only'); + } // Add salt to cache version to support breaking changes in cache entry components.push(versionSalt); - return crypto - .createHash('sha256') - .update(components.join('|')) - .digest('hex'); + return crypto.createHash('sha256').update(components.join('|')).digest('hex'); } exports.getCacheVersion = getCacheVersion; function getCacheEntry(keys, paths, options) { return __awaiter(this, void 0, void 0, function* () { const httpClient = createHttpClient(); - const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod); + const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive); const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`; - const response = yield requestUtils_1.retryTypedResponse('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); })); + const response = yield (0, requestUtils_1.retryTypedResponse)('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); })); + // Cache not found if (response.statusCode === 204) { + // List cache for primary key only if cache miss occurs + if (core.isDebug()) { + yield printCachesListForDiagnostics(keys[0], httpClient, version); + } return null; } - if (!requestUtils_1.isSuccessStatusCode(response.statusCode)) { + if (!(0, requestUtils_1.isSuccessStatusCode)(response.statusCode)) { throw new Error(`Cache service responded with ${response.statusCode}`); } const cacheResult = response.result; const cacheDownloadUrl = cacheResult === null || cacheResult === void 0 ? void 0 : cacheResult.archiveLocation; if (!cacheDownloadUrl) { + // Cache achiveLocation not found. This should never happen, and hence bail out. throw new Error('Cache not found.'); } core.setSecret(cacheDownloadUrl); @@ -313,18 +364,42 @@ function getCacheEntry(keys, paths, options) { }); } exports.getCacheEntry = getCacheEntry; +function printCachesListForDiagnostics(key, httpClient, version) { + return __awaiter(this, void 0, void 0, function* () { + const resource = `caches?key=${encodeURIComponent(key)}`; + const response = yield (0, requestUtils_1.retryTypedResponse)('listCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); })); + if (response.statusCode === 200) { + const cacheListResult = response.result; + const totalCount = cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.totalCount; + if (totalCount && totalCount > 0) { + core.debug(`No matching cache found for cache key '${key}', version '${version} and scope ${process.env['GITHUB_REF']}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key \nOther caches with similar key:`); + for (const cacheEntry of (cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.artifactCaches) || []) { + core.debug(`Cache Key: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheKey}, Cache Version: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheVersion}, Cache Scope: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.scope}, Cache Created: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.creationTime}`); + } + } + } + }); +} function downloadCache(archiveLocation, archivePath, options) { return __awaiter(this, void 0, void 0, function* () { const archiveUrl = new url_1.URL(archiveLocation); - const downloadOptions = options_1.getDownloadOptions(options); - if (downloadOptions.useAzureSdk && - archiveUrl.hostname.endsWith('.blob.core.windows.net')) { - // Use Azure storage SDK to download caches hosted on Azure to improve speed and reliability. - yield downloadUtils_1.downloadCacheStorageSDK(archiveLocation, archivePath, downloadOptions); + const downloadOptions = (0, options_1.getDownloadOptions)(options); + if (archiveUrl.hostname.endsWith('.blob.core.windows.net')) { + if (downloadOptions.useAzureSdk) { + // Use Azure storage SDK to download caches hosted on Azure to improve speed and reliability. + yield (0, downloadUtils_1.downloadCacheStorageSDK)(archiveLocation, archivePath, downloadOptions); + } + else if (downloadOptions.concurrentBlobDownloads) { + // Use concurrent implementation with HttpClient to work around blob SDK issue + yield (0, downloadUtils_1.downloadCacheHttpClientConcurrent)(archiveLocation, archivePath, downloadOptions); + } + else { + // Otherwise, download using the Actions http-client. + yield (0, downloadUtils_1.downloadCacheHttpClient)(archiveLocation, archivePath); + } } else { - // Otherwise, download using the Actions http-client. - yield downloadUtils_1.downloadCacheHttpClient(archiveLocation, archivePath); + yield (0, downloadUtils_1.downloadCacheHttpClient)(archiveLocation, archivePath); } }); } @@ -333,13 +408,13 @@ exports.downloadCache = downloadCache; function reserveCache(key, paths, options) { return __awaiter(this, void 0, void 0, function* () { const httpClient = createHttpClient(); - const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod); + const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive); const reserveCacheRequest = { key, version, cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize }; - const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () { + const response = yield (0, requestUtils_1.retryTypedResponse)('reserveCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest); })); return response; @@ -356,17 +431,15 @@ function getContentRange(start, end) { } function uploadChunk(httpClient, resourceUrl, openStream, start, end) { return __awaiter(this, void 0, void 0, function* () { - core.debug(`Uploading chunk of size ${end - - start + - 1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`); + core.debug(`Uploading chunk of size ${end - start + 1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`); const additionalHeaders = { 'Content-Type': 'application/octet-stream', 'Content-Range': getContentRange(start, end) }; - const uploadChunkResponse = yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () { + const uploadChunkResponse = yield (0, requestUtils_1.retryHttpClientResponse)(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () { return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders); })); - if (!requestUtils_1.isSuccessStatusCode(uploadChunkResponse.message.statusCode)) { + if (!(0, requestUtils_1.isSuccessStatusCode)(uploadChunkResponse.message.statusCode)) { throw new Error(`Cache service responded with ${uploadChunkResponse.message.statusCode} during upload chunk.`); } }); @@ -377,7 +450,7 @@ function uploadFile(httpClient, cacheId, archivePath, options) { const fileSize = utils.getArchiveFileSizeInBytes(archivePath); const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`); const fd = fs.openSync(archivePath, 'r'); - const uploadOptions = options_1.getUploadOptions(options); + const uploadOptions = (0, options_1.getUploadOptions)(options); const concurrency = utils.assertDefined('uploadConcurrency', uploadOptions.uploadConcurrency); const maxChunkSize = utils.assertDefined('uploadChunkSize', uploadOptions.uploadChunkSize); const parallelUploads = [...new Array(concurrency).keys()]; @@ -412,7 +485,7 @@ function uploadFile(httpClient, cacheId, archivePath, options) { function commitCache(httpClient, cacheId, filesize) { return __awaiter(this, void 0, void 0, function* () { const commitCacheRequest = { size: filesize }; - return yield requestUtils_1.retryTypedResponse('commitCache', () => __awaiter(this, void 0, void 0, function* () { + return yield (0, requestUtils_1.retryTypedResponse)('commitCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest); })); }); @@ -427,7 +500,7 @@ function saveCache(cacheId, archivePath, options) { const cacheSize = utils.getArchiveFileSizeInBytes(archivePath); core.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`); const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize); - if (!requestUtils_1.isSuccessStatusCode(commitCacheResponse.statusCode)) { + if (!(0, requestUtils_1.isSuccessStatusCode)(commitCacheResponse.statusCode)) { throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`); } core.info('Cache saved successfully'); @@ -443,6 +516,29 @@ exports.saveCache = saveCache; "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -459,14 +555,8 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isGhes = exports.assertDefined = exports.getGnuTarPathOnWindows = exports.getCacheFileName = exports.getCompressionMethod = exports.unlinkFile = exports.resolvePaths = exports.getArchiveFileSizeInBytes = exports.createTempDirectory = void 0; const core = __importStar(__nccwpck_require__(2186)); const exec = __importStar(__nccwpck_require__(1514)); const glob = __importStar(__nccwpck_require__(1597)); @@ -498,7 +588,7 @@ function createTempDirectory() { } tempDirectory = path.join(baseLocation, 'actions', 'temp'); } - const dest = path.join(tempDirectory, uuid_1.v4()); + const dest = path.join(tempDirectory, (0, uuid_1.v4)()); yield io.mkdirP(dest); return dest; }); @@ -509,35 +599,42 @@ function getArchiveFileSizeInBytes(filePath) { } exports.getArchiveFileSizeInBytes = getArchiveFileSizeInBytes; function resolvePaths(patterns) { - var e_1, _a; - var _b; + var _a, e_1, _b, _c; + var _d; return __awaiter(this, void 0, void 0, function* () { const paths = []; - const workspace = (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd(); + const workspace = (_d = process.env['GITHUB_WORKSPACE']) !== null && _d !== void 0 ? _d : process.cwd(); const globber = yield glob.create(patterns.join('\n'), { implicitDescendants: false }); try { - for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) { - const file = _d.value; - const relativeFile = path - .relative(workspace, file) - .replace(new RegExp(`\\${path.sep}`, 'g'), '/'); - core.debug(`Matched: ${relativeFile}`); - // Paths are made relative so the tar entries are all relative to the root of the workspace. - if (relativeFile === '') { - // path.relative returns empty string if workspace and file are equal - paths.push('.'); + for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a;) { + _c = _g.value; + _e = false; + try { + const file = _c; + const relativeFile = path + .relative(workspace, file) + .replace(new RegExp(`\\${path.sep}`, 'g'), '/'); + core.debug(`Matched: ${relativeFile}`); + // Paths are made relative so the tar entries are all relative to the root of the workspace. + if (relativeFile === '') { + // path.relative returns empty string if workspace and file are equal + paths.push('.'); + } + else { + paths.push(`${relativeFile}`); + } } - else { - paths.push(`${relativeFile}`); + finally { + _e = true; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { - if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c); + if (!_e && !_a && (_b = _f.return)) yield _b.call(_f); } finally { if (e_1) throw e_1.error; } } @@ -551,12 +648,13 @@ function unlinkFile(filePath) { }); } exports.unlinkFile = unlinkFile; -function getVersion(app) { +function getVersion(app, additionalArgs = []) { return __awaiter(this, void 0, void 0, function* () { - core.debug(`Checking ${app} --version`); let versionOutput = ''; + additionalArgs.push('--version'); + core.debug(`Checking ${app} ${additionalArgs.join(' ')}`); try { - yield exec.exec(`${app} --version`, [], { + yield exec.exec(`${app}`, additionalArgs, { ignoreReturnCode: true, silent: true, listeners: { @@ -576,23 +674,14 @@ function getVersion(app) { // Use zstandard if possible to maximize cache performance function getCompressionMethod() { return __awaiter(this, void 0, void 0, function* () { - if (process.platform === 'win32' && !(yield isGnuTarInstalled())) { - // Disable zstd due to bug https://github.com/actions/cache/issues/301 - return constants_1.CompressionMethod.Gzip; - } - const versionOutput = yield getVersion('zstd'); + const versionOutput = yield getVersion('zstd', ['--quiet']); const version = semver.clean(versionOutput); - if (!versionOutput.toLowerCase().includes('zstd command line interface')) { - // zstd is not installed + core.debug(`zstd version: ${version}`); + if (versionOutput === '') { return constants_1.CompressionMethod.Gzip; } - else if (!version || semver.lt(version, 'v1.3.2')) { - // zstd is installed but using a version earlier than v1.3.2 - // v1.3.2 is required to use the `--long` options in zstd - return constants_1.CompressionMethod.ZstdWithoutLong; - } else { - return constants_1.CompressionMethod.Zstd; + return constants_1.CompressionMethod.ZstdWithoutLong; } }); } @@ -603,13 +692,16 @@ function getCacheFileName(compressionMethod) { : constants_1.CacheFilename.Zstd; } exports.getCacheFileName = getCacheFileName; -function isGnuTarInstalled() { +function getGnuTarPathOnWindows() { return __awaiter(this, void 0, void 0, function* () { + if (fs.existsSync(constants_1.GnuTarPathOnWindows)) { + return constants_1.GnuTarPathOnWindows; + } const versionOutput = yield getVersion('tar'); - return versionOutput.toLowerCase().includes('gnu tar'); + return versionOutput.toLowerCase().includes('gnu tar') ? io.which('tar') : ''; }); } -exports.isGnuTarInstalled = isGnuTarInstalled; +exports.getGnuTarPathOnWindows = getGnuTarPathOnWindows; function assertDefined(name, value) { if (value === undefined) { throw Error(`Expected ${name} but value was undefiend`); @@ -632,6 +724,7 @@ exports.isGhes = isGhes; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ManifestFilename = exports.TarFilename = exports.SystemTarPathOnWindows = exports.GnuTarPathOnWindows = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.ArchiveToolType = exports.CompressionMethod = exports.CacheFilename = void 0; var CacheFilename; (function (CacheFilename) { CacheFilename["Gzip"] = "cache.tgz"; @@ -645,6 +738,11 @@ var CompressionMethod; CompressionMethod["ZstdWithoutLong"] = "zstd-without-long"; CompressionMethod["Zstd"] = "zstd"; })(CompressionMethod = exports.CompressionMethod || (exports.CompressionMethod = {})); +var ArchiveToolType; +(function (ArchiveToolType) { + ArchiveToolType["GNU"] = "gnu"; + ArchiveToolType["BSD"] = "bsd"; +})(ArchiveToolType = exports.ArchiveToolType || (exports.ArchiveToolType = {})); // The default number of retry attempts. exports.DefaultRetryAttempts = 2; // The default delay in milliseconds between retry attempts. @@ -653,6 +751,12 @@ exports.DefaultRetryDelay = 5000; // over the socket during this period, the socket is destroyed and the download // is aborted. exports.SocketTimeout = 5000; +// The default path of GNUtar on hosted Windows runners +exports.GnuTarPathOnWindows = `${process.env['PROGRAMFILES']}\\Git\\usr\\bin\\tar.exe`; +// The default path of BSDtar on hosted Windows runners +exports.SystemTarPathOnWindows = `${process.env['SYSTEMDRIVE']}\\Windows\\System32\\tar.exe`; +exports.TarFilename = 'cache.tar'; +exports.ManifestFilename = 'manifest.txt'; //# sourceMappingURL=constants.js.map /***/ }), @@ -662,6 +766,29 @@ exports.SocketTimeout = 5000; "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -671,14 +798,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.downloadCacheStorageSDK = exports.downloadCacheHttpClientConcurrent = exports.downloadCacheHttpClient = exports.DownloadProgress = void 0; const core = __importStar(__nccwpck_require__(2186)); const http_client_1 = __nccwpck_require__(1825); const storage_blob_1 = __nccwpck_require__(4100); @@ -813,7 +934,7 @@ function downloadCacheHttpClient(archiveLocation, archivePath) { return __awaiter(this, void 0, void 0, function* () { const writeStream = fs.createWriteStream(archivePath); const httpClient = new http_client_1.HttpClient('actions/cache'); - const downloadResponse = yield requestUtils_1.retryHttpClientResponse('downloadCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); })); + const downloadResponse = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); })); // Abort download if no traffic received over the socket. downloadResponse.message.socket.setTimeout(constants_1.SocketTimeout, () => { downloadResponse.message.destroy(); @@ -835,6 +956,115 @@ function downloadCacheHttpClient(archiveLocation, archivePath) { }); } exports.downloadCacheHttpClient = downloadCacheHttpClient; +/** + * Download the cache using the Actions toolkit http-client concurrently + * + * @param archiveLocation the URL for the cache + * @param archivePath the local path where the cache is saved + */ +function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + const archiveDescriptor = yield fs.promises.open(archivePath, 'w'); + const httpClient = new http_client_1.HttpClient('actions/cache', undefined, { + socketTimeout: options.timeoutInMs, + keepAlive: true + }); + try { + const res = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCacheMetadata', () => __awaiter(this, void 0, void 0, function* () { return yield httpClient.request('HEAD', archiveLocation, null, {}); })); + const lengthHeader = res.message.headers['content-length']; + if (lengthHeader === undefined || lengthHeader === null) { + throw new Error('Content-Length not found on blob response'); + } + const length = parseInt(lengthHeader); + if (Number.isNaN(length)) { + throw new Error(`Could not interpret Content-Length: ${length}`); + } + const downloads = []; + const blockSize = 4 * 1024 * 1024; + for (let offset = 0; offset < length; offset += blockSize) { + const count = Math.min(blockSize, length - offset); + downloads.push({ + offset, + promiseGetter: () => __awaiter(this, void 0, void 0, function* () { + return yield downloadSegmentRetry(httpClient, archiveLocation, offset, count); + }) + }); + } + // reverse to use .pop instead of .shift + downloads.reverse(); + let actives = 0; + let bytesDownloaded = 0; + const progress = new DownloadProgress(length); + progress.startDisplayTimer(); + const progressFn = progress.onProgress(); + const activeDownloads = []; + let nextDownload; + const waitAndWrite = () => __awaiter(this, void 0, void 0, function* () { + const segment = yield Promise.race(Object.values(activeDownloads)); + yield archiveDescriptor.write(segment.buffer, 0, segment.count, segment.offset); + actives--; + delete activeDownloads[segment.offset]; + bytesDownloaded += segment.count; + progressFn({ loadedBytes: bytesDownloaded }); + }); + while ((nextDownload = downloads.pop())) { + activeDownloads[nextDownload.offset] = nextDownload.promiseGetter(); + actives++; + if (actives >= ((_a = options.downloadConcurrency) !== null && _a !== void 0 ? _a : 10)) { + yield waitAndWrite(); + } + } + while (actives > 0) { + yield waitAndWrite(); + } + } + finally { + httpClient.dispose(); + yield archiveDescriptor.close(); + } + }); +} +exports.downloadCacheHttpClientConcurrent = downloadCacheHttpClientConcurrent; +function downloadSegmentRetry(httpClient, archiveLocation, offset, count) { + return __awaiter(this, void 0, void 0, function* () { + const retries = 5; + let failures = 0; + while (true) { + try { + const timeout = 30000; + const result = yield promiseWithTimeout(timeout, downloadSegment(httpClient, archiveLocation, offset, count)); + if (typeof result === 'string') { + throw new Error('downloadSegmentRetry failed due to timeout'); + } + return result; + } + catch (err) { + if (failures >= retries) { + throw err; + } + failures++; + } + } + }); +} +function downloadSegment(httpClient, archiveLocation, offset, count) { + return __awaiter(this, void 0, void 0, function* () { + const partRes = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCachePart', () => __awaiter(this, void 0, void 0, function* () { + return yield httpClient.get(archiveLocation, { + Range: `bytes=${offset}-${offset + count - 1}` + }); + })); + if (!partRes.readBodyBuffer) { + throw new Error('Expected HttpClientResponse to implement readBodyBuffer'); + } + return { + offset, + count, + buffer: yield partRes.readBodyBuffer() + }; + }); +} /** * Download the cache using the Azure Storage SDK. Only call this method if the * URL points to an Azure Storage endpoint. @@ -868,7 +1098,8 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) { // If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB // on 64-bit systems), split the download into multiple segments // ~2 GB = 2147483647, beyond this, we start getting out of range error. So, capping it accordingly. - const maxSegmentSize = Math.min(2147483647, buffer.constants.MAX_LENGTH); + // Updated segment size to 128MB = 134217728 bytes, to complete a segment faster and fail fast + const maxSegmentSize = Math.min(134217728, buffer.constants.MAX_LENGTH); const downloadProgress = new DownloadProgress(contentLength); const fd = fs.openSync(archivePath, 'w'); try { @@ -920,6 +1151,29 @@ const promiseWithTimeout = (timeoutMs, promise) => __awaiter(void 0, void 0, voi "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -929,14 +1183,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.retryHttpClientResponse = exports.retryTypedResponse = exports.retry = exports.isRetryableStatusCode = exports.isServerErrorStatusCode = exports.isSuccessStatusCode = void 0; const core = __importStar(__nccwpck_require__(2186)); const http_client_1 = __nccwpck_require__(1825); const constants_1 = __nccwpck_require__(8840); @@ -1047,6 +1295,29 @@ exports.retryHttpClientResponse = retryHttpClientResponse; "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -1056,14 +1327,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createTar = exports.extractTar = exports.listTar = void 0; const exec_1 = __nccwpck_require__(1514); const io = __importStar(__nccwpck_require__(7436)); const fs_1 = __nccwpck_require__(7147); @@ -1071,21 +1336,19 @@ const path = __importStar(__nccwpck_require__(1017)); const utils = __importStar(__nccwpck_require__(1518)); const constants_1 = __nccwpck_require__(8840); const IS_WINDOWS = process.platform === 'win32'; -function getTarPath(args, compressionMethod) { +// Returns tar path and type: BSD or GNU +function getTarPath() { return __awaiter(this, void 0, void 0, function* () { switch (process.platform) { case 'win32': { - const systemTar = `${process.env['windir']}\\System32\\tar.exe`; - if (compressionMethod !== constants_1.CompressionMethod.Gzip) { - // We only use zstandard compression on windows when gnu tar is installed due to - // a bug with compressing large files with bsdtar + zstd - args.push('--force-local'); + const gnuTar = yield utils.getGnuTarPathOnWindows(); + const systemTar = constants_1.SystemTarPathOnWindows; + if (gnuTar) { + // Use GNUtar as default on windows + return { path: gnuTar, type: constants_1.ArchiveToolType.GNU }; } - else if (fs_1.existsSync(systemTar)) { - return systemTar; - } - else if (yield utils.isGnuTarInstalled()) { - args.push('--force-local'); + else if ((0, fs_1.existsSync)(systemTar)) { + return { path: systemTar, type: constants_1.ArchiveToolType.BSD }; } break; } @@ -1093,25 +1356,92 @@ function getTarPath(args, compressionMethod) { const gnuTar = yield io.which('gtar', false); if (gnuTar) { // fix permission denied errors when extracting BSD tar archive with GNU tar - https://github.com/actions/cache/issues/527 - args.push('--delay-directory-restore'); - return gnuTar; + return { path: gnuTar, type: constants_1.ArchiveToolType.GNU }; + } + else { + return { + path: yield io.which('tar', true), + type: constants_1.ArchiveToolType.BSD + }; } - break; } default: break; } - return yield io.which('tar', true); + // Default assumption is GNU tar is present in path + return { + path: yield io.which('tar', true), + type: constants_1.ArchiveToolType.GNU + }; }); } -function execTar(args, compressionMethod, cwd) { +// Return arguments for tar as per tarPath, compressionMethod, method type and os +function getTarArgs(tarPath, compressionMethod, type, archivePath = '') { return __awaiter(this, void 0, void 0, function* () { - try { - yield exec_1.exec(`"${yield getTarPath(args, compressionMethod)}"`, args, { cwd }); + const args = [`"${tarPath.path}"`]; + const cacheFileName = utils.getCacheFileName(compressionMethod); + const tarFile = 'cache.tar'; + const workingDirectory = getWorkingDirectory(); + // Speficic args for BSD tar on windows for workaround + const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD && + compressionMethod !== constants_1.CompressionMethod.Gzip && + IS_WINDOWS; + // Method specific args + switch (type) { + case 'create': + args.push('--posix', '-cf', BSD_TAR_ZSTD + ? tarFile + : cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '--exclude', BSD_TAR_ZSTD + ? tarFile + : cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P', '-C', workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '--files-from', constants_1.ManifestFilename); + break; + case 'extract': + args.push('-xf', BSD_TAR_ZSTD + ? tarFile + : archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P', '-C', workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/')); + break; + case 'list': + args.push('-tf', BSD_TAR_ZSTD + ? tarFile + : archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P'); + break; } - catch (error) { - throw new Error(`Tar failed with error: ${error === null || error === void 0 ? void 0 : error.message}`); + // Platform specific args + if (tarPath.type === constants_1.ArchiveToolType.GNU) { + switch (process.platform) { + case 'win32': + args.push('--force-local'); + break; + case 'darwin': + args.push('--delay-directory-restore'); + break; + } } + return args; + }); +} +// Returns commands to run tar and compression program +function getCommands(compressionMethod, type, archivePath = '') { + return __awaiter(this, void 0, void 0, function* () { + let args; + const tarPath = yield getTarPath(); + const tarArgs = yield getTarArgs(tarPath, compressionMethod, type, archivePath); + const compressionArgs = type !== 'create' + ? yield getDecompressionProgram(tarPath, compressionMethod, archivePath) + : yield getCompressionProgram(tarPath, compressionMethod); + const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD && + compressionMethod !== constants_1.CompressionMethod.Gzip && + IS_WINDOWS; + if (BSD_TAR_ZSTD && type !== 'create') { + args = [[...compressionArgs].join(' '), [...tarArgs].join(' ')]; + } + else { + args = [[...tarArgs].join(' '), [...compressionArgs].join(' ')]; + } + if (BSD_TAR_ZSTD) { + return args; + } + return [args.join(' ')]; }); } function getWorkingDirectory() { @@ -1119,91 +1449,119 @@ function getWorkingDirectory() { return (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : process.cwd(); } // Common function for extractTar and listTar to get the compression method -function getCompressionProgram(compressionMethod) { - // -d: Decompress. - // unzstd is equivalent to 'zstd -d' - // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. - // Using 30 here because we also support 32-bit self-hosted runners. - switch (compressionMethod) { - case constants_1.CompressionMethod.Zstd: - return [ - '--use-compress-program', - IS_WINDOWS ? 'zstd -d --long=30' : 'unzstd --long=30' - ]; - case constants_1.CompressionMethod.ZstdWithoutLong: - return ['--use-compress-program', IS_WINDOWS ? 'zstd -d' : 'unzstd']; - default: - return ['-z']; - } +function getDecompressionProgram(tarPath, compressionMethod, archivePath) { + return __awaiter(this, void 0, void 0, function* () { + // -d: Decompress. + // unzstd is equivalent to 'zstd -d' + // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. + // Using 30 here because we also support 32-bit self-hosted runners. + const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD && + compressionMethod !== constants_1.CompressionMethod.Gzip && + IS_WINDOWS; + switch (compressionMethod) { + case constants_1.CompressionMethod.Zstd: + return BSD_TAR_ZSTD + ? [ + 'zstd -d --long=30 --force -o', + constants_1.TarFilename, + archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/') + ] + : [ + '--use-compress-program', + IS_WINDOWS ? '"zstd -d --long=30"' : 'unzstd --long=30' + ]; + case constants_1.CompressionMethod.ZstdWithoutLong: + return BSD_TAR_ZSTD + ? [ + 'zstd -d --force -o', + constants_1.TarFilename, + archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/') + ] + : ['--use-compress-program', IS_WINDOWS ? '"zstd -d"' : 'unzstd']; + default: + return ['-z']; + } + }); +} +// Used for creating the archive +// -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores. +// zstdmt is equivalent to 'zstd -T0' +// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. +// Using 30 here because we also support 32-bit self-hosted runners. +// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd. +function getCompressionProgram(tarPath, compressionMethod) { + return __awaiter(this, void 0, void 0, function* () { + const cacheFileName = utils.getCacheFileName(compressionMethod); + const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD && + compressionMethod !== constants_1.CompressionMethod.Gzip && + IS_WINDOWS; + switch (compressionMethod) { + case constants_1.CompressionMethod.Zstd: + return BSD_TAR_ZSTD + ? [ + 'zstd -T0 --long=30 --force -o', + cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), + constants_1.TarFilename + ] + : [ + '--use-compress-program', + IS_WINDOWS ? '"zstd -T0 --long=30"' : 'zstdmt --long=30' + ]; + case constants_1.CompressionMethod.ZstdWithoutLong: + return BSD_TAR_ZSTD + ? [ + 'zstd -T0 --force -o', + cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), + constants_1.TarFilename + ] + : ['--use-compress-program', IS_WINDOWS ? '"zstd -T0"' : 'zstdmt']; + default: + return ['-z']; + } + }); } +// Executes all commands as separate processes +function execCommands(commands, cwd) { + return __awaiter(this, void 0, void 0, function* () { + for (const command of commands) { + try { + yield (0, exec_1.exec)(command, undefined, { + cwd, + env: Object.assign(Object.assign({}, process.env), { MSYS: 'winsymlinks:nativestrict' }) + }); + } + catch (error) { + throw new Error(`${command.split(' ')[0]} failed with error: ${error === null || error === void 0 ? void 0 : error.message}`); + } + } + }); +} +// List the contents of a tar function listTar(archivePath, compressionMethod) { return __awaiter(this, void 0, void 0, function* () { - const args = [ - ...getCompressionProgram(compressionMethod), - '-tf', - archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), - '-P' - ]; - yield execTar(args, compressionMethod); + const commands = yield getCommands(compressionMethod, 'list', archivePath); + yield execCommands(commands); }); } exports.listTar = listTar; +// Extract a tar function extractTar(archivePath, compressionMethod) { return __awaiter(this, void 0, void 0, function* () { // Create directory to extract tar into const workingDirectory = getWorkingDirectory(); yield io.mkdirP(workingDirectory); - const args = [ - ...getCompressionProgram(compressionMethod), - '-xf', - archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), - '-P', - '-C', - workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/') - ]; - yield execTar(args, compressionMethod); + const commands = yield getCommands(compressionMethod, 'extract', archivePath); + yield execCommands(commands); }); } exports.extractTar = extractTar; +// Create a tar function createTar(archiveFolder, sourceDirectories, compressionMethod) { return __awaiter(this, void 0, void 0, function* () { // Write source directories to manifest.txt to avoid command length limits - const manifestFilename = 'manifest.txt'; - const cacheFileName = utils.getCacheFileName(compressionMethod); - fs_1.writeFileSync(path.join(archiveFolder, manifestFilename), sourceDirectories.join('\n')); - const workingDirectory = getWorkingDirectory(); - // -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores. - // zstdmt is equivalent to 'zstd -T0' - // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. - // Using 30 here because we also support 32-bit self-hosted runners. - // Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd. - function getCompressionProgram() { - switch (compressionMethod) { - case constants_1.CompressionMethod.Zstd: - return [ - '--use-compress-program', - IS_WINDOWS ? 'zstd -T0 --long=30' : 'zstdmt --long=30' - ]; - case constants_1.CompressionMethod.ZstdWithoutLong: - return ['--use-compress-program', IS_WINDOWS ? 'zstd -T0' : 'zstdmt']; - default: - return ['-z']; - } - } - const args = [ - '--posix', - ...getCompressionProgram(), - '-cf', - cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), - '--exclude', - cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), - '-P', - '-C', - workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), - '--files-from', - manifestFilename - ]; - yield execTar(args, compressionMethod, archiveFolder); + (0, fs_1.writeFileSync)(path.join(archiveFolder, constants_1.ManifestFilename), sourceDirectories.join('\n')); + const commands = yield getCommands(compressionMethod, 'create'); + yield execCommands(commands, archiveFolder); }); } exports.createTar = createTar; @@ -1216,14 +1574,31 @@ exports.createTar = createTar; "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getDownloadOptions = exports.getUploadOptions = void 0; const core = __importStar(__nccwpck_require__(2186)); /** * Returns a copy of the upload options with defaults filled in. @@ -1255,15 +1630,20 @@ exports.getUploadOptions = getUploadOptions; */ function getDownloadOptions(copy) { const result = { - useAzureSdk: true, + useAzureSdk: false, + concurrentBlobDownloads: true, downloadConcurrency: 8, timeoutInMs: 30000, - segmentTimeoutInMs: 3600000 + segmentTimeoutInMs: 600000, + lookupOnly: false }; if (copy) { if (typeof copy.useAzureSdk === 'boolean') { result.useAzureSdk = copy.useAzureSdk; } + if (typeof copy.concurrentBlobDownloads === 'boolean') { + result.concurrentBlobDownloads = copy.concurrentBlobDownloads; + } if (typeof copy.downloadConcurrency === 'number') { result.downloadConcurrency = copy.downloadConcurrency; } @@ -1273,6 +1653,9 @@ function getDownloadOptions(copy) { if (typeof copy.segmentTimeoutInMs === 'number') { result.segmentTimeoutInMs = copy.segmentTimeoutInMs; } + if (typeof copy.lookupOnly === 'boolean') { + result.lookupOnly = copy.lookupOnly; + } } const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']; if (segmentDownloadTimeoutMins && @@ -1285,6 +1668,7 @@ function getDownloadOptions(copy) { core.debug(`Request timeout (ms): ${result.timeoutInMs}`); core.debug(`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`); core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`); + core.debug(`Lookup only: ${result.lookupOnly}`); return result; } exports.getDownloadOptions = getDownloadOptions; @@ -2451,7 +2835,11 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand /* eslint-disable @typescript-eslint/no-explicit-any */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -2464,7 +2852,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -2483,6 +2871,7 @@ const http = __importStar(__nccwpck_require__(3685)); const https = __importStar(__nccwpck_require__(5687)); const pm = __importStar(__nccwpck_require__(4977)); const tunnel = __importStar(__nccwpck_require__(4294)); +const undici_1 = __nccwpck_require__(1773); var HttpCodes; (function (HttpCodes) { HttpCodes[HttpCodes["OK"] = 200] = "OK"; @@ -2512,16 +2901,16 @@ var HttpCodes; HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; -})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); +})(HttpCodes || (exports.HttpCodes = HttpCodes = {})); var Headers; (function (Headers) { Headers["Accept"] = "accept"; Headers["ContentType"] = "content-type"; -})(Headers = exports.Headers || (exports.Headers = {})); +})(Headers || (exports.Headers = Headers = {})); var MediaTypes; (function (MediaTypes) { MediaTypes["ApplicationJson"] = "application/json"; -})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); +})(MediaTypes || (exports.MediaTypes = MediaTypes = {})); /** * Returns the proxy URL, depending upon the supplied url and proxy environment variables. * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com @@ -2572,6 +2961,19 @@ class HttpClientResponse { })); }); } + readBodyBuffer() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { + const chunks = []; + this.message.on('data', (chunk) => { + chunks.push(chunk); + }); + this.message.on('end', () => { + resolve(Buffer.concat(chunks)); + }); + })); + }); + } } exports.HttpClientResponse = HttpClientResponse; function isHttps(requestUrl) { @@ -2877,6 +3279,15 @@ class HttpClient { const parsedUrl = new URL(serverUrl); return this._getAgent(parsedUrl); } + getAgentDispatcher(serverUrl) { + const parsedUrl = new URL(serverUrl); + const proxyUrl = pm.getProxyUrl(parsedUrl); + const useProxy = proxyUrl && proxyUrl.hostname; + if (!useProxy) { + return; + } + return this._getProxyAgentDispatcher(parsedUrl, proxyUrl); + } _prepareRequest(method, requestUrl, headers) { const info = {}; info.parsedUrl = requestUrl; @@ -2976,6 +3387,30 @@ class HttpClient { } return agent; } + _getProxyAgentDispatcher(parsedUrl, proxyUrl) { + let proxyAgent; + if (this._keepAlive) { + proxyAgent = this._proxyAgentDispatcher; + } + // if agent is already assigned use that agent. + if (proxyAgent) { + return proxyAgent; + } + const usingSsl = parsedUrl.protocol === 'https:'; + proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl.href, pipelining: !this._keepAlive ? 0 : 1 }, ((proxyUrl.username || proxyUrl.password) && { + token: `${proxyUrl.username}:${proxyUrl.password}` + }))); + this._proxyAgentDispatcher = proxyAgent; + if (usingSsl && this._ignoreSslError) { + // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process + // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options + // we have to cast it to any and change it directly + proxyAgent.options = Object.assign(proxyAgent.options.requestTls || {}, { + rejectUnauthorized: false + }); + } + return proxyAgent; + } _performExponentialBackoff(retryNumber) { return __awaiter(this, void 0, void 0, function* () { retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); @@ -3076,7 +3511,13 @@ function getProxyUrl(reqUrl) { } })(); if (proxyVar) { - return new URL(proxyVar); + try { + return new URL(proxyVar); + } + catch (_a) { + if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://')) + return new URL(`http://${proxyVar}`); + } } else { return undefined; @@ -3087,6 +3528,10 @@ function checkBypass(reqUrl) { if (!reqUrl.hostname) { return false; } + const reqHost = reqUrl.hostname; + if (isLoopbackAddress(reqHost)) { + return true; + } const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; if (!noProxy) { return false; @@ -3112,13 +3557,24 @@ function checkBypass(reqUrl) { .split(',') .map(x => x.trim().toUpperCase()) .filter(x => x)) { - if (upperReqHosts.some(x => x === upperNoProxyItem)) { + if (upperNoProxyItem === '*' || + upperReqHosts.some(x => x === upperNoProxyItem || + x.endsWith(`.${upperNoProxyItem}`) || + (upperNoProxyItem.startsWith('.') && + x.endsWith(`${upperNoProxyItem}`)))) { return true; } } return false; } exports.checkBypass = checkBypass; +function isLoopbackAddress(host) { + const hostLower = host.toLowerCase(); + return (hostLower === 'localhost' || + hostLower.startsWith('127.') || + hostLower.startsWith('[::1]') || + hostLower.startsWith('[0:0:0:0:0:0:0:1]')); +} //# sourceMappingURL=proxy.js.map /***/ }), @@ -3154,8 +3610,11 @@ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || // Max safe segment length for coercion. var MAX_SAFE_COMPONENT_LENGTH = 16 +var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + // The actual regexps go on exports.re var re = exports.re = [] +var safeRe = exports.safeRe = [] var src = exports.src = [] var t = exports.tokens = {} var R = 0 @@ -3164,6 +3623,31 @@ function tok (n) { t[n] = R++ } +var LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +var safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +function makeSafeRe (value) { + for (var i = 0; i < safeRegexReplacements.length; i++) { + var token = safeRegexReplacements[i][0] + var max = safeRegexReplacements[i][1] + value = value + .split(token + '*').join(token + '{0,' + max + '}') + .split(token + '+').join(token + '{1,' + max + '}') + } + return value +} + // The following Regular Expressions can be used for tokenizing, // validating, and parsing SemVer version strings. @@ -3173,14 +3657,14 @@ function tok (n) { tok('NUMERICIDENTIFIER') src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*' tok('NUMERICIDENTIFIERLOOSE') -src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+' +src[t.NUMERICIDENTIFIERLOOSE] = '\\d+' // ## Non-numeric Identifier // Zero or more digits, followed by a letter or hyphen, and then zero or // more letters, digits, or hyphens. tok('NONNUMERICIDENTIFIER') -src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' +src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*' // ## Main Version // Three dot-separated numeric identifiers. @@ -3222,7 +3706,7 @@ src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + // Any combination of digits, letters, or hyphens. tok('BUILDIDENTIFIER') -src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+' +src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+' // ## Build Metadata // Plus sign, followed by one or more period-separated build metadata @@ -3302,6 +3786,7 @@ src[t.COERCE] = '(^|[^\\d])' + '(?:$|[^\\d])' tok('COERCERTL') re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g') +safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g') // Tilde ranges. // Meaning is "reasonably at or greater than" @@ -3311,6 +3796,7 @@ src[t.LONETILDE] = '(?:~>?)' tok('TILDETRIM') src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+' re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g') +safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g') var tildeTrimReplace = '$1~' tok('TILDE') @@ -3326,6 +3812,7 @@ src[t.LONECARET] = '(?:\\^)' tok('CARETTRIM') src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+' re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g') +safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g') var caretTrimReplace = '$1^' tok('CARET') @@ -3347,6 +3834,7 @@ src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + // this one has to use the /g flag re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g') +safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g') var comparatorTrimReplace = '$1$2$3' // Something like `1.2.3 - 1.2.4` @@ -3375,6 +3863,14 @@ for (var i = 0; i < R; i++) { debug(i, src[i]) if (!re[i]) { re[i] = new RegExp(src[i]) + + // Replace all greedy whitespace to prevent regex dos issues. These regex are + // used internally via the safeRe object since all inputs in this library get + // normalized first to trim and collapse all extra whitespace. The original + // regexes are exported for userland consumption and lower level usage. A + // future breaking change could export the safer regex only with a note that + // all input should have extra whitespace removed. + safeRe[i] = new RegExp(makeSafeRe(src[i])) } } @@ -3399,7 +3895,7 @@ function parse (version, options) { return null } - var r = options.loose ? re[t.LOOSE] : re[t.FULL] + var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL] if (!r.test(version)) { return null } @@ -3454,7 +3950,7 @@ function SemVer (version, options) { this.options = options this.loose = !!options.loose - var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]) if (!m) { throw new TypeError('Invalid Version: ' + version) @@ -3899,6 +4395,7 @@ function Comparator (comp, options) { return new Comparator(comp, options) } + comp = comp.trim().split(/\s+/).join(' ') debug('comparator', comp, options) this.options = options this.loose = !!options.loose @@ -3915,7 +4412,7 @@ function Comparator (comp, options) { var ANY = {} Comparator.prototype.parse = function (comp) { - var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] var m = comp.match(r) if (!m) { @@ -4039,9 +4536,16 @@ function Range (range, options) { this.loose = !!options.loose this.includePrerelease = !!options.includePrerelease - // First, split based on boolean or || + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. this.raw = range - this.set = range.split(/\s*\|\|\s*/).map(function (range) { + .trim() + .split(/\s+/) + .join(' ') + + // First, split based on boolean or || + this.set = this.raw.split('||').map(function (range) { return this.parseRange(range.trim()) }, this).filter(function (c) { // throw out any that are not relevant for whatever reason @@ -4049,7 +4553,7 @@ function Range (range, options) { }) if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range) + throw new TypeError('Invalid SemVer Range: ' + this.raw) } this.format() @@ -4068,20 +4572,19 @@ Range.prototype.toString = function () { Range.prototype.parseRange = function (range) { var loose = this.options.loose - range = range.trim() // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE] range = range.replace(hr, hyphenReplace) debug('hyphen replace', range) // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[t.COMPARATORTRIM]) + range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, safeRe[t.COMPARATORTRIM]) // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace) // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[t.CARETTRIM], caretTrimReplace) + range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace) // normalize spaces range = range.split(/\s+/).join(' ') @@ -4089,7 +4592,7 @@ Range.prototype.parseRange = function (range) { // At this point, the range is completely trimmed and // ready to be split into comparators. - var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] var set = range.split(' ').map(function (comp) { return parseComparator(comp, this.options) }, this).join(' ').split(/\s+/) @@ -4189,7 +4692,7 @@ function replaceTildes (comp, options) { } function replaceTilde (comp, options) { - var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE] return comp.replace(r, function (_, M, m, p, pr) { debug('tilde', comp, _, M, m, p, pr) var ret @@ -4230,7 +4733,7 @@ function replaceCarets (comp, options) { function replaceCaret (comp, options) { debug('caret', comp, options) - var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET] return comp.replace(r, function (_, M, m, p, pr) { debug('caret', comp, _, M, m, p, pr) var ret @@ -4289,7 +4792,7 @@ function replaceXRanges (comp, options) { function replaceXRange (comp, options) { comp = comp.trim() - var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE] return comp.replace(r, function (ret, gtlt, M, m, p, pr) { debug('xRange', comp, ret, gtlt, M, m, p, pr) var xM = isX(M) @@ -4364,7 +4867,7 @@ function replaceXRange (comp, options) { function replaceStars (comp, options) { debug('replaceStars', comp, options) // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[t.STAR], '') + return comp.trim().replace(safeRe[t.STAR], '') } // This function is passed to string.replace(re[t.HYPHENRANGE]) @@ -4690,7 +5193,7 @@ function coerce (version, options) { var match = null if (!options.rtl) { - match = version.match(re[t.COERCE]) + match = version.match(safeRe[t.COERCE]) } else { // Find the right-most coercible string that does not share // a terminus with a more left-ward coercible string. @@ -4701,17 +5204,17 @@ function coerce (version, options) { // Stop when we get a match that ends at the string end, since no // coercible string can be more right-ward without the same terminus. var next - while ((next = re[t.COERCERTL].exec(version)) && + while ((next = safeRe[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length) ) { if (!match || next.index + next[0].length !== match.index + match[0].length) { match = next } - re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length } // leave it in a clean state - re[t.COERCERTL].lastIndex = -1 + safeRe[t.COERCERTL].lastIndex = -1 } if (match === null) { @@ -10921,8 +11424,11 @@ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || // Max safe segment length for coercion. var MAX_SAFE_COMPONENT_LENGTH = 16 +var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + // The actual regexps go on exports.re var re = exports.re = [] +var safeRe = exports.safeRe = [] var src = exports.src = [] var t = exports.tokens = {} var R = 0 @@ -10931,6 +11437,31 @@ function tok (n) { t[n] = R++ } +var LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +var safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +function makeSafeRe (value) { + for (var i = 0; i < safeRegexReplacements.length; i++) { + var token = safeRegexReplacements[i][0] + var max = safeRegexReplacements[i][1] + value = value + .split(token + '*').join(token + '{0,' + max + '}') + .split(token + '+').join(token + '{1,' + max + '}') + } + return value +} + // The following Regular Expressions can be used for tokenizing, // validating, and parsing SemVer version strings. @@ -10940,14 +11471,14 @@ function tok (n) { tok('NUMERICIDENTIFIER') src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*' tok('NUMERICIDENTIFIERLOOSE') -src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+' +src[t.NUMERICIDENTIFIERLOOSE] = '\\d+' // ## Non-numeric Identifier // Zero or more digits, followed by a letter or hyphen, and then zero or // more letters, digits, or hyphens. tok('NONNUMERICIDENTIFIER') -src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' +src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*' // ## Main Version // Three dot-separated numeric identifiers. @@ -10989,7 +11520,7 @@ src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + // Any combination of digits, letters, or hyphens. tok('BUILDIDENTIFIER') -src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+' +src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+' // ## Build Metadata // Plus sign, followed by one or more period-separated build metadata @@ -11069,6 +11600,7 @@ src[t.COERCE] = '(^|[^\\d])' + '(?:$|[^\\d])' tok('COERCERTL') re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g') +safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g') // Tilde ranges. // Meaning is "reasonably at or greater than" @@ -11078,6 +11610,7 @@ src[t.LONETILDE] = '(?:~>?)' tok('TILDETRIM') src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+' re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g') +safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g') var tildeTrimReplace = '$1~' tok('TILDE') @@ -11093,6 +11626,7 @@ src[t.LONECARET] = '(?:\\^)' tok('CARETTRIM') src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+' re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g') +safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g') var caretTrimReplace = '$1^' tok('CARET') @@ -11114,6 +11648,7 @@ src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + // this one has to use the /g flag re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g') +safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g') var comparatorTrimReplace = '$1$2$3' // Something like `1.2.3 - 1.2.4` @@ -11142,6 +11677,14 @@ for (var i = 0; i < R; i++) { debug(i, src[i]) if (!re[i]) { re[i] = new RegExp(src[i]) + + // Replace all greedy whitespace to prevent regex dos issues. These regex are + // used internally via the safeRe object since all inputs in this library get + // normalized first to trim and collapse all extra whitespace. The original + // regexes are exported for userland consumption and lower level usage. A + // future breaking change could export the safer regex only with a note that + // all input should have extra whitespace removed. + safeRe[i] = new RegExp(makeSafeRe(src[i])) } } @@ -11166,7 +11709,7 @@ function parse (version, options) { return null } - var r = options.loose ? re[t.LOOSE] : re[t.FULL] + var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL] if (!r.test(version)) { return null } @@ -11221,7 +11764,7 @@ function SemVer (version, options) { this.options = options this.loose = !!options.loose - var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]) if (!m) { throw new TypeError('Invalid Version: ' + version) @@ -11666,6 +12209,7 @@ function Comparator (comp, options) { return new Comparator(comp, options) } + comp = comp.trim().split(/\s+/).join(' ') debug('comparator', comp, options) this.options = options this.loose = !!options.loose @@ -11682,7 +12226,7 @@ function Comparator (comp, options) { var ANY = {} Comparator.prototype.parse = function (comp) { - var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] var m = comp.match(r) if (!m) { @@ -11806,9 +12350,16 @@ function Range (range, options) { this.loose = !!options.loose this.includePrerelease = !!options.includePrerelease - // First, split based on boolean or || + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. this.raw = range - this.set = range.split(/\s*\|\|\s*/).map(function (range) { + .trim() + .split(/\s+/) + .join(' ') + + // First, split based on boolean or || + this.set = this.raw.split('||').map(function (range) { return this.parseRange(range.trim()) }, this).filter(function (c) { // throw out any that are not relevant for whatever reason @@ -11816,7 +12367,7 @@ function Range (range, options) { }) if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range) + throw new TypeError('Invalid SemVer Range: ' + this.raw) } this.format() @@ -11835,20 +12386,19 @@ Range.prototype.toString = function () { Range.prototype.parseRange = function (range) { var loose = this.options.loose - range = range.trim() // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE] range = range.replace(hr, hyphenReplace) debug('hyphen replace', range) // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[t.COMPARATORTRIM]) + range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, safeRe[t.COMPARATORTRIM]) // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace) // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[t.CARETTRIM], caretTrimReplace) + range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace) // normalize spaces range = range.split(/\s+/).join(' ') @@ -11856,7 +12406,7 @@ Range.prototype.parseRange = function (range) { // At this point, the range is completely trimmed and // ready to be split into comparators. - var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] var set = range.split(' ').map(function (comp) { return parseComparator(comp, this.options) }, this).join(' ').split(/\s+/) @@ -11956,7 +12506,7 @@ function replaceTildes (comp, options) { } function replaceTilde (comp, options) { - var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE] return comp.replace(r, function (_, M, m, p, pr) { debug('tilde', comp, _, M, m, p, pr) var ret @@ -11997,7 +12547,7 @@ function replaceCarets (comp, options) { function replaceCaret (comp, options) { debug('caret', comp, options) - var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET] return comp.replace(r, function (_, M, m, p, pr) { debug('caret', comp, _, M, m, p, pr) var ret @@ -12056,7 +12606,7 @@ function replaceXRanges (comp, options) { function replaceXRange (comp, options) { comp = comp.trim() - var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE] return comp.replace(r, function (ret, gtlt, M, m, p, pr) { debug('xRange', comp, ret, gtlt, M, m, p, pr) var xM = isX(M) @@ -12131,7 +12681,7 @@ function replaceXRange (comp, options) { function replaceStars (comp, options) { debug('replaceStars', comp, options) // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[t.STAR], '') + return comp.trim().replace(safeRe[t.STAR], '') } // This function is passed to string.replace(re[t.HYPHENRANGE]) @@ -12457,7 +13007,7 @@ function coerce (version, options) { var match = null if (!options.rtl) { - match = version.match(re[t.COERCE]) + match = version.match(safeRe[t.COERCE]) } else { // Find the right-most coercible string that does not share // a terminus with a more left-ward coercible string. @@ -12468,17 +13018,17 @@ function coerce (version, options) { // Stop when we get a match that ends at the string end, since no // coercible string can be more right-ward without the same terminus. var next - while ((next = re[t.COERCERTL].exec(version)) && + while ((next = safeRe[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length) ) { if (!match || next.index + next[0].length !== match.index + match[0].length) { match = next } - re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length } // leave it in a clean state - re[t.COERCERTL].lastIndex = -1 + safeRe[t.COERCERTL].lastIndex = -1 } if (match === null) { @@ -12494,19 +13044,18 @@ function coerce (version, options) { /***/ }), /***/ 2557: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var tslib = __nccwpck_require__(9268); - // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -var listenersMap = new WeakMap(); -var abortedMap = new WeakMap(); +/// +const listenersMap = new WeakMap(); +const abortedMap = new WeakMap(); /** * An aborter instance implements AbortSignal interface, can abort HTTP requests. * @@ -12520,8 +13069,8 @@ var abortedMap = new WeakMap(); * await doAsyncWork(AbortSignal.none); * ``` */ -var AbortSignal = /** @class */ (function () { - function AbortSignal() { +class AbortSignal { + constructor() { /** * onabort event listener. */ @@ -12529,74 +13078,65 @@ var AbortSignal = /** @class */ (function () { listenersMap.set(this, []); abortedMap.set(this, false); } - Object.defineProperty(AbortSignal.prototype, "aborted", { - /** - * Status of whether aborted or not. - * - * @readonly - */ - get: function () { - if (!abortedMap.has(this)) { - throw new TypeError("Expected `this` to be an instance of AbortSignal."); - } - return abortedMap.get(this); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AbortSignal, "none", { - /** - * Creates a new AbortSignal instance that will never be aborted. - * - * @readonly - */ - get: function () { - return new AbortSignal(); - }, - enumerable: false, - configurable: true - }); + /** + * Status of whether aborted or not. + * + * @readonly + */ + get aborted() { + if (!abortedMap.has(this)) { + throw new TypeError("Expected `this` to be an instance of AbortSignal."); + } + return abortedMap.get(this); + } + /** + * Creates a new AbortSignal instance that will never be aborted. + * + * @readonly + */ + static get none() { + return new AbortSignal(); + } /** * Added new "abort" event listener, only support "abort" event. * * @param _type - Only support "abort" event * @param listener - The listener to be added */ - AbortSignal.prototype.addEventListener = function ( + addEventListener( // tslint:disable-next-line:variable-name _type, listener) { if (!listenersMap.has(this)) { throw new TypeError("Expected `this` to be an instance of AbortSignal."); } - var listeners = listenersMap.get(this); + const listeners = listenersMap.get(this); listeners.push(listener); - }; + } /** * Remove "abort" event listener, only support "abort" event. * * @param _type - Only support "abort" event * @param listener - The listener to be removed */ - AbortSignal.prototype.removeEventListener = function ( + removeEventListener( // tslint:disable-next-line:variable-name _type, listener) { if (!listenersMap.has(this)) { throw new TypeError("Expected `this` to be an instance of AbortSignal."); } - var listeners = listenersMap.get(this); - var index = listeners.indexOf(listener); + const listeners = listenersMap.get(this); + const index = listeners.indexOf(listener); if (index > -1) { listeners.splice(index, 1); } - }; + } /** * Dispatches a synthetic event to the AbortSignal. */ - AbortSignal.prototype.dispatchEvent = function (_event) { + dispatchEvent(_event) { throw new Error("This is a stub dispatchEvent implementation that should not be used. It only exists for type-checking purposes."); - }; - return AbortSignal; -}()); + } +} /** * Helper to trigger an abort event immediately, the onabort and all abort event listeners will be triggered. * Will try to trigger abort event for all linked AbortSignal nodes. @@ -12614,12 +13154,12 @@ function abortSignal(signal) { if (signal.onabort) { signal.onabort.call(signal); } - var listeners = listenersMap.get(signal); + const listeners = listenersMap.get(signal); if (listeners) { // Create a copy of listeners so mutations to the array // (e.g. via removeListener calls) don't affect the listeners // we invoke. - listeners.slice().forEach(function (listener) { + listeners.slice().forEach((listener) => { listener.call(signal, { type: "abort" }); }); } @@ -12645,15 +13185,12 @@ function abortSignal(signal) { * } * ``` */ -var AbortError = /** @class */ (function (_super) { - tslib.__extends(AbortError, _super); - function AbortError(message) { - var _this = _super.call(this, message) || this; - _this.name = "AbortError"; - return _this; +class AbortError extends Error { + constructor(message) { + super(message); + this.name = "AbortError"; } - return AbortError; -}(Error)); +} /** * An AbortController provides an AbortSignal and the associated controls to signal * that an asynchronous operation should be aborted. @@ -12688,10 +13225,9 @@ var AbortError = /** @class */ (function (_super) { * await doAsyncWork(aborter.withTimeout(25 * 1000)); * ``` */ -var AbortController = /** @class */ (function () { +class AbortController { // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - function AbortController(parentSignals) { - var _this = this; + constructor(parentSignals) { this._signal = new AbortSignal(); if (!parentSignals) { return; @@ -12701,8 +13237,7 @@ var AbortController = /** @class */ (function () { // eslint-disable-next-line prefer-rest-params parentSignals = arguments; } - for (var _i = 0, parentSignals_1 = parentSignals; _i < parentSignals_1.length; _i++) { - var parentSignal = parentSignals_1[_i]; + for (const parentSignal of parentSignals) { // if the parent signal has already had abort() called, // then call abort on this signal as well. if (parentSignal.aborted) { @@ -12710,47 +13245,42 @@ var AbortController = /** @class */ (function () { } else { // when the parent signal aborts, this signal should as well. - parentSignal.addEventListener("abort", function () { - _this.abort(); + parentSignal.addEventListener("abort", () => { + this.abort(); }); } } } - Object.defineProperty(AbortController.prototype, "signal", { - /** - * The AbortSignal associated with this controller that will signal aborted - * when the abort method is called on this controller. - * - * @readonly - */ - get: function () { - return this._signal; - }, - enumerable: false, - configurable: true - }); + /** + * The AbortSignal associated with this controller that will signal aborted + * when the abort method is called on this controller. + * + * @readonly + */ + get signal() { + return this._signal; + } /** * Signal that any operations passed this controller's associated abort signal * to cancel any remaining work and throw an `AbortError`. */ - AbortController.prototype.abort = function () { + abort() { abortSignal(this._signal); - }; + } /** * Creates a new AbortSignal instance that will abort after the provided ms. * @param ms - Elapsed time in milliseconds to trigger an abort. */ - AbortController.timeout = function (ms) { - var signal = new AbortSignal(); - var timer = setTimeout(abortSignal, ms, signal); + static timeout(ms) { + const signal = new AbortSignal(); + const timer = setTimeout(abortSignal, ms, signal); // Prevent the active Timer from keeping the Node.js event loop active. if (typeof timer.unref === "function") { timer.unref(); } return signal; - }; - return AbortController; -}()); + } +} exports.AbortController = AbortController; exports.AbortError = AbortError; @@ -12758,319 +13288,6 @@ exports.AbortSignal = AbortSignal; //# sourceMappingURL=index.js.map -/***/ }), - -/***/ 9268: -/***/ ((module) => { - -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if ( true && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); -}); - - /***/ }), /***/ 2356: @@ -19318,376 +19535,376 @@ module.exports = function(dst, src) { /***/ 2107: /***/ ((module) => { -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __esDecorate; -var __runInitializers; -var __propKey; -var __setFunctionName; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __classPrivateFieldIn; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if ( true && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for (var i = decorators.length - 1; i >= 0; i--) { - var context = {}; - for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; - for (var p in contextIn.access) context.access[p] = contextIn.access[p]; - context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; - var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.push(_); - } - else if (_ = accept(result)) { - if (kind === "field") initializers.push(_); - else descriptor[key] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; - }; - - __runInitializers = function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; - }; - - __propKey = function (x) { - return typeof x === "symbol" ? x : "".concat(x); - }; - - __setFunctionName = function (f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; - - __classPrivateFieldIn = function (state, receiver) { - if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__esDecorate", __esDecorate); - exporter("__runInitializers", __runInitializers); - exporter("__propKey", __propKey); - exporter("__setFunctionName", __setFunctionName); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); - exporter("__classPrivateFieldIn", __classPrivateFieldIn); -}); +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __esDecorate; +var __runInitializers; +var __propKey; +var __setFunctionName; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __classPrivateFieldIn; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.push(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.push(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; + }; + + __runInitializers = function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; + }; + + __propKey = function (x) { + return typeof x === "symbol" ? x : "".concat(x); + }; + + __setFunctionName = function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + + __classPrivateFieldIn = function (state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__esDecorate", __esDecorate); + exporter("__runInitializers", __runInitializers); + exporter("__propKey", __propKey); + exporter("__setFunctionName", __setFunctionName); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); + exporter("__classPrivateFieldIn", __classPrivateFieldIn); +}); /***/ }), @@ -21182,312 +21399,312 @@ exports.getPagedAsyncIterator = getPagedAsyncIterator; /***/ 6429: /***/ ((module) => { -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if ( true && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); -}); +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); +}); /***/ }), @@ -47311,981 +47528,1739 @@ exports.newPipeline = newPipeline; /***/ 679: /***/ ((module) => { -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if ( true && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); -}); - - -/***/ }), - -/***/ 7171: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; -"use strict"; + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var __spreadArray = (this && this.__spreadArray) || function (to, from) { - for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) - to[j] = from[i]; - return to; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ContextAPI = void 0; -var NoopContextManager_1 = __nccwpck_require__(4118); -var global_utils_1 = __nccwpck_require__(5135); -var diag_1 = __nccwpck_require__(1877); -var API_NAME = 'context'; -var NOOP_CONTEXT_MANAGER = new NoopContextManager_1.NoopContextManager(); -/** - * Singleton object which represents the entry point to the OpenTelemetry Context API - */ -var ContextAPI = /** @class */ (function () { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - function ContextAPI() { - } - /** Get the singleton instance of the Context API */ - ContextAPI.getInstance = function () { - if (!this._instance) { - this._instance = new ContextAPI(); + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } - return this._instance; + return t; }; - /** - * Set the current context manager. - * - * @returns true if the context manager was successfully registered, else false - */ - ContextAPI.prototype.setGlobalContextManager = function (contextManager) { - return global_utils_1.registerGlobal(API_NAME, contextManager, diag_1.DiagAPI.instance()); + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; }; - /** - * Get the currently active context - */ - ContextAPI.prototype.active = function () { - return this._getContextManager().active(); + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; }; - /** - * Execute a function with an active context - * - * @param context context to be active during function execution - * @param fn function to execute in a context - * @param thisArg optional receiver to be used for calling fn - * @param args optional arguments forwarded to fn - */ - ContextAPI.prototype.with = function (context, fn, thisArg) { - var _a; - var args = []; - for (var _i = 3; _i < arguments.length; _i++) { - args[_i - 3] = arguments[_i]; - } - return (_a = this._getContextManager()).with.apply(_a, __spreadArray([context, fn, thisArg], args)); + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } }; - /** - * Bind a context to a target function or event emitter - * - * @param context context to bind to the event emitter or function. Defaults to the currently active context - * @param target function or event emitter to bind - */ - ContextAPI.prototype.bind = function (context, target) { - return this._getContextManager().bind(context, target); + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); }; - ContextAPI.prototype._getContextManager = function () { - return global_utils_1.getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); }; - /** Disable and remove the global context manager */ - ContextAPI.prototype.disable = function () { - this._getContextManager().disable(); - global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance()); + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } }; - return ContextAPI; -}()); -exports.ContextAPI = ContextAPI; -//# sourceMappingURL=context.js.map -/***/ }), + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; -/***/ 1877: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); -"use strict"; + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.DiagAPI = void 0; -var ComponentLogger_1 = __nccwpck_require__(7978); -var logLevelLogger_1 = __nccwpck_require__(9639); -var types_1 = __nccwpck_require__(8077); -var global_utils_1 = __nccwpck_require__(5135); -var API_NAME = 'diag'; -/** - * Singleton object which represents the entry point to the OpenTelemetry internal - * diagnostic API - */ -var DiagAPI = /** @class */ (function () { - /** - * Private internal constructor - * @private - */ - function DiagAPI() { - function _logProxy(funcName) { - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - var logger = global_utils_1.getGlobal('diag'); - // shortcut if logger not set - if (!logger) - return; - return logger[funcName].apply(logger, args); - }; + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } - // Using self local variable for minification purposes as 'this' cannot be minified - var self = this; - // DiagAPI specific functions - self.setLogger = function (logger, logLevel) { - var _a, _b; - if (logLevel === void 0) { logLevel = types_1.DiagLogLevel.INFO; } - if (logger === self) { - // There isn't much we can do here. - // Logging to the console might break the user application. - // Try to log to self. If a logger was previously registered it will receive the log. - var err = new Error('Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation'); - self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message); - return false; + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); } - var oldLogger = global_utils_1.getGlobal('diag'); - var newLogger = logLevelLogger_1.createLogLevelDiagLogger(logLevel, logger); - // There already is an logger registered. We'll let it know before overwriting it. - if (oldLogger) { - var stack = (_b = new Error().stack) !== null && _b !== void 0 ? _b : ''; - oldLogger.warn("Current logger will be overwritten from " + stack); - newLogger.warn("Current logger will overwrite one already registered from " + stack); + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; } - return global_utils_1.registerGlobal('diag', newLogger, self, true); - }; - self.disable = function () { - global_utils_1.unregisterGlobal(API_NAME, self); - }; - self.createComponentLogger = function (options) { - return new ComponentLogger_1.DiagComponentLogger(options); - }; - self.verbose = _logProxy('verbose'); - self.debug = _logProxy('debug'); - self.info = _logProxy('info'); - self.warn = _logProxy('warn'); - self.error = _logProxy('error'); - } - /** Get the singleton instance of the DiagAPI API */ - DiagAPI.instance = function () { - if (!this._instance) { - this._instance = new DiagAPI(); } - return this._instance; + return to.concat(ar || Array.prototype.slice.call(from)); }; - return DiagAPI; -}()); -exports.DiagAPI = DiagAPI; -//# sourceMappingURL=diag.js.map -/***/ }), + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; -/***/ 9909: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; -"use strict"; + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + }; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.PropagationAPI = void 0; -var global_utils_1 = __nccwpck_require__(5135); -var NoopTextMapPropagator_1 = __nccwpck_require__(2368); -var TextMapPropagator_1 = __nccwpck_require__(865); -var context_helpers_1 = __nccwpck_require__(7682); -var utils_1 = __nccwpck_require__(8136); -var diag_1 = __nccwpck_require__(1877); -var API_NAME = 'propagation'; -var NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator_1.NoopTextMapPropagator(); -/** - * Singleton object which represents the entry point to the OpenTelemetry Propagation API - */ -var PropagationAPI = /** @class */ (function () { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - function PropagationAPI() { - this.createBaggage = utils_1.createBaggage; - this.getBaggage = context_helpers_1.getBaggage; - this.setBaggage = context_helpers_1.setBaggage; - this.deleteBaggage = context_helpers_1.deleteBaggage; - } - /** Get the singleton instance of the Propagator API */ - PropagationAPI.getInstance = function () { - if (!this._instance) { - this._instance = new PropagationAPI(); - } - return this._instance; + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } }; - /** - * Set the current propagator. - * - * @returns true if the propagator was successfully registered, else false - */ - PropagationAPI.prototype.setGlobalPropagator = function (propagator) { - return global_utils_1.registerGlobal(API_NAME, propagator, diag_1.DiagAPI.instance()); + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; }; - /** - * Inject context into a carrier to be propagated inter-process - * - * @param context Context carrying tracing data to inject - * @param carrier carrier to inject context into - * @param setter Function used to set values on the carrier - */ - PropagationAPI.prototype.inject = function (context, carrier, setter) { - if (setter === void 0) { setter = TextMapPropagator_1.defaultTextMapSetter; } - return this._getGlobalPropagator().inject(context, carrier, setter); + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; }; - /** - * Extract context from a carrier - * - * @param context Context which the newly created context will inherit from - * @param carrier Carrier to extract context from - * @param getter Function used to extract keys from a carrier - */ - PropagationAPI.prototype.extract = function (context, carrier, getter) { - if (getter === void 0) { getter = TextMapPropagator_1.defaultTextMapGetter; } - return this._getGlobalPropagator().extract(context, carrier, getter); + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; }; - /** - * Return a list of all fields which may be used by the propagator. - */ - PropagationAPI.prototype.fields = function () { - return this._getGlobalPropagator().fields(); + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; }; - /** Remove the global propagator */ - PropagationAPI.prototype.disable = function () { - global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance()); + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; - PropagationAPI.prototype._getGlobalPropagator = function () { - return global_utils_1.getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; - return PropagationAPI; -}()); -exports.PropagationAPI = PropagationAPI; -//# sourceMappingURL=propagation.js.map + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); +}); + /***/ }), -/***/ 1539: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 2856: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.TraceAPI = void 0; -var global_utils_1 = __nccwpck_require__(5135); -var ProxyTracerProvider_1 = __nccwpck_require__(2285); -var spancontext_utils_1 = __nccwpck_require__(9745); -var context_utils_1 = __nccwpck_require__(3326); -var diag_1 = __nccwpck_require__(1877); -var API_NAME = 'trace'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Tracing API - */ -var TraceAPI = /** @class */ (function () { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - function TraceAPI() { - this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider(); - this.wrapSpanContext = spancontext_utils_1.wrapSpanContext; - this.isSpanContextValid = spancontext_utils_1.isSpanContextValid; - this.deleteSpan = context_utils_1.deleteSpan; - this.getSpan = context_utils_1.getSpan; - this.getSpanContext = context_utils_1.getSpanContext; - this.setSpan = context_utils_1.setSpan; - this.setSpanContext = context_utils_1.setSpanContext; - } - /** Get the singleton instance of the Trace API */ - TraceAPI.getInstance = function () { - if (!this._instance) { - this._instance = new TraceAPI(); - } - return this._instance; - }; - /** - * Set the current global tracer. - * - * @returns true if the tracer provider was successfully registered, else false - */ - TraceAPI.prototype.setGlobalTracerProvider = function (provider) { - var success = global_utils_1.registerGlobal(API_NAME, this._proxyTracerProvider, diag_1.DiagAPI.instance()); - if (success) { - this._proxyTracerProvider.setDelegate(provider); + +const WritableStream = (__nccwpck_require__(4492).Writable) +const inherits = (__nccwpck_require__(7261).inherits) + +const StreamSearch = __nccwpck_require__(8534) + +const PartStream = __nccwpck_require__(8710) +const HeaderParser = __nccwpck_require__(333) + +const DASH = 45 +const B_ONEDASH = Buffer.from('-') +const B_CRLF = Buffer.from('\r\n') +const EMPTY_FN = function () {} + +function Dicer (cfg) { + if (!(this instanceof Dicer)) { return new Dicer(cfg) } + WritableStream.call(this, cfg) + + if (!cfg || (!cfg.headerFirst && typeof cfg.boundary !== 'string')) { throw new TypeError('Boundary required') } + + if (typeof cfg.boundary === 'string') { this.setBoundary(cfg.boundary) } else { this._bparser = undefined } + + this._headerFirst = cfg.headerFirst + + this._dashes = 0 + this._parts = 0 + this._finished = false + this._realFinish = false + this._isPreamble = true + this._justMatched = false + this._firstWrite = true + this._inHeader = true + this._part = undefined + this._cb = undefined + this._ignoreData = false + this._partOpts = { highWaterMark: cfg.partHwm } + this._pause = false + + const self = this + this._hparser = new HeaderParser(cfg) + this._hparser.on('header', function (header) { + self._inHeader = false + self._part.emit('header', header) + }) +} +inherits(Dicer, WritableStream) + +Dicer.prototype.emit = function (ev) { + if (ev === 'finish' && !this._realFinish) { + if (!this._finished) { + const self = this + process.nextTick(function () { + self.emit('error', new Error('Unexpected end of multipart data')) + if (self._part && !self._ignoreData) { + const type = (self._isPreamble ? 'Preamble' : 'Part') + self._part.emit('error', new Error(type + ' terminated early due to unexpected end of multipart data')) + self._part.push(null) + process.nextTick(function () { + self._realFinish = true + self.emit('finish') + self._realFinish = false + }) + return } - return success; - }; - /** - * Returns the global tracer provider. - */ - TraceAPI.prototype.getTracerProvider = function () { - return global_utils_1.getGlobal(API_NAME) || this._proxyTracerProvider; - }; - /** - * Returns a tracer from the global tracer provider. - */ - TraceAPI.prototype.getTracer = function (name, version) { - return this.getTracerProvider().getTracer(name, version); - }; - /** Remove the global tracer provider */ - TraceAPI.prototype.disable = function () { - global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance()); - this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider(); - }; - return TraceAPI; -}()); -exports.TraceAPI = TraceAPI; -//# sourceMappingURL=trace.js.map + self._realFinish = true + self.emit('finish') + self._realFinish = false + }) + } + } else { WritableStream.prototype.emit.apply(this, arguments) } +} -/***/ }), +Dicer.prototype._write = function (data, encoding, cb) { + // ignore unexpected data (e.g. extra trailer data after finished) + if (!this._hparser && !this._bparser) { return cb() } -/***/ 7682: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + if (this._headerFirst && this._isPreamble) { + if (!this._part) { + this._part = new PartStream(this._partOpts) + if (this._events.preamble) { this.emit('preamble', this._part) } else { this._ignore() } + } + const r = this._hparser.push(data) + if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r) } else { return cb() } + } -"use strict"; + // allows for "easier" testing + if (this._firstWrite) { + this._bparser.push(B_CRLF) + this._firstWrite = false + } -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.deleteBaggage = exports.setBaggage = exports.getBaggage = void 0; -var context_1 = __nccwpck_require__(8242); -/** - * Baggage key - */ -var BAGGAGE_KEY = context_1.createContextKey('OpenTelemetry Baggage Key'); -/** - * Retrieve the current baggage from the given context - * - * @param {Context} Context that manage all context values - * @returns {Baggage} Extracted baggage from the context - */ -function getBaggage(context) { - return context.getValue(BAGGAGE_KEY) || undefined; + this._bparser.push(data) + + if (this._pause) { this._cb = cb } else { cb() } } -exports.getBaggage = getBaggage; -/** - * Store a baggage in the given context - * - * @param {Context} Context that manage all context values - * @param {Baggage} baggage that will be set in the actual context - */ -function setBaggage(context, baggage) { - return context.setValue(BAGGAGE_KEY, baggage); + +Dicer.prototype.reset = function () { + this._part = undefined + this._bparser = undefined + this._hparser = undefined } -exports.setBaggage = setBaggage; -/** - * Delete the baggage stored in the given context - * - * @param {Context} Context that manage all context values - */ -function deleteBaggage(context) { - return context.deleteValue(BAGGAGE_KEY); + +Dicer.prototype.setBoundary = function (boundary) { + const self = this + this._bparser = new StreamSearch('\r\n--' + boundary) + this._bparser.on('info', function (isMatch, data, start, end) { + self._oninfo(isMatch, data, start, end) + }) +} + +Dicer.prototype._ignore = function () { + if (this._part && !this._ignoreData) { + this._ignoreData = true + this._part.on('error', EMPTY_FN) + // we must perform some kind of read on the stream even though we are + // ignoring the data, otherwise node's Readable stream will not emit 'end' + // after pushing null to the stream + this._part.resume() + } +} + +Dicer.prototype._oninfo = function (isMatch, data, start, end) { + let buf; const self = this; let i = 0; let r; let shouldWriteMore = true + + if (!this._part && this._justMatched && data) { + while (this._dashes < 2 && (start + i) < end) { + if (data[start + i] === DASH) { + ++i + ++this._dashes + } else { + if (this._dashes) { buf = B_ONEDASH } + this._dashes = 0 + break + } + } + if (this._dashes === 2) { + if ((start + i) < end && this._events.trailer) { this.emit('trailer', data.slice(start + i, end)) } + this.reset() + this._finished = true + // no more parts will be added + if (self._parts === 0) { + self._realFinish = true + self.emit('finish') + self._realFinish = false + } + } + if (this._dashes) { return } + } + if (this._justMatched) { this._justMatched = false } + if (!this._part) { + this._part = new PartStream(this._partOpts) + this._part._read = function (n) { + self._unpause() + } + if (this._isPreamble && this._events.preamble) { this.emit('preamble', this._part) } else if (this._isPreamble !== true && this._events.part) { this.emit('part', this._part) } else { this._ignore() } + if (!this._isPreamble) { this._inHeader = true } + } + if (data && start < end && !this._ignoreData) { + if (this._isPreamble || !this._inHeader) { + if (buf) { shouldWriteMore = this._part.push(buf) } + shouldWriteMore = this._part.push(data.slice(start, end)) + if (!shouldWriteMore) { this._pause = true } + } else if (!this._isPreamble && this._inHeader) { + if (buf) { this._hparser.push(buf) } + r = this._hparser.push(data.slice(start, end)) + if (!this._inHeader && r !== undefined && r < end) { this._oninfo(false, data, start + r, end) } + } + } + if (isMatch) { + this._hparser.reset() + if (this._isPreamble) { this._isPreamble = false } else { + if (start !== end) { + ++this._parts + this._part.on('end', function () { + if (--self._parts === 0) { + if (self._finished) { + self._realFinish = true + self.emit('finish') + self._realFinish = false + } else { + self._unpause() + } + } + }) + } + } + this._part.push(null) + this._part = undefined + this._ignoreData = false + this._justMatched = true + this._dashes = 0 + } +} + +Dicer.prototype._unpause = function () { + if (!this._pause) { return } + + this._pause = false + if (this._cb) { + const cb = this._cb + this._cb = undefined + cb() + } } -exports.deleteBaggage = deleteBaggage; -//# sourceMappingURL=context-helpers.js.map + +module.exports = Dicer + /***/ }), -/***/ 4811: -/***/ ((__unused_webpack_module, exports) => { +/***/ 333: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BaggageImpl = void 0; -var BaggageImpl = /** @class */ (function () { - function BaggageImpl(entries) { - this._entries = entries ? new Map(entries) : new Map(); + +const EventEmitter = (__nccwpck_require__(5673).EventEmitter) +const inherits = (__nccwpck_require__(7261).inherits) +const getLimit = __nccwpck_require__(9692) + +const StreamSearch = __nccwpck_require__(8534) + +const B_DCRLF = Buffer.from('\r\n\r\n') +const RE_CRLF = /\r\n/g +const RE_HDR = /^([^:]+):[ \t]?([\x00-\xFF]+)?$/ // eslint-disable-line no-control-regex + +function HeaderParser (cfg) { + EventEmitter.call(this) + + cfg = cfg || {} + const self = this + this.nread = 0 + this.maxed = false + this.npairs = 0 + this.maxHeaderPairs = getLimit(cfg, 'maxHeaderPairs', 2000) + this.maxHeaderSize = getLimit(cfg, 'maxHeaderSize', 80 * 1024) + this.buffer = '' + this.header = {} + this.finished = false + this.ss = new StreamSearch(B_DCRLF) + this.ss.on('info', function (isMatch, data, start, end) { + if (data && !self.maxed) { + if (self.nread + end - start >= self.maxHeaderSize) { + end = self.maxHeaderSize - self.nread + start + self.nread = self.maxHeaderSize + self.maxed = true + } else { self.nread += (end - start) } + + self.buffer += data.toString('binary', start, end) + } + if (isMatch) { self._finish() } + }) +} +inherits(HeaderParser, EventEmitter) + +HeaderParser.prototype.push = function (data) { + const r = this.ss.push(data) + if (this.finished) { return r } +} + +HeaderParser.prototype.reset = function () { + this.finished = false + this.buffer = '' + this.header = {} + this.ss.reset() +} + +HeaderParser.prototype._finish = function () { + if (this.buffer) { this._parseHeader() } + this.ss.matches = this.ss.maxMatches + const header = this.header + this.header = {} + this.buffer = '' + this.finished = true + this.nread = this.npairs = 0 + this.maxed = false + this.emit('header', header) +} + +HeaderParser.prototype._parseHeader = function () { + if (this.npairs === this.maxHeaderPairs) { return } + + const lines = this.buffer.split(RE_CRLF) + const len = lines.length + let m, h + + for (var i = 0; i < len; ++i) { // eslint-disable-line no-var + if (lines[i].length === 0) { continue } + if (lines[i][0] === '\t' || lines[i][0] === ' ') { + // folded header content + // RFC2822 says to just remove the CRLF and not the whitespace following + // it, so we follow the RFC and include the leading whitespace ... + if (h) { + this.header[h][this.header[h].length - 1] += lines[i] + continue + } } - BaggageImpl.prototype.getEntry = function (key) { - var entry = this._entries.get(key); - if (!entry) { - return undefined; - } - return Object.assign({}, entry); - }; - BaggageImpl.prototype.getAllEntries = function () { - return Array.from(this._entries.entries()).map(function (_a) { - var k = _a[0], v = _a[1]; - return [k, v]; - }); - }; - BaggageImpl.prototype.setEntry = function (key, entry) { - var newBaggage = new BaggageImpl(this._entries); - newBaggage._entries.set(key, entry); - return newBaggage; - }; - BaggageImpl.prototype.removeEntry = function (key) { - var newBaggage = new BaggageImpl(this._entries); - newBaggage._entries.delete(key); - return newBaggage; - }; - BaggageImpl.prototype.removeEntries = function () { - var keys = []; - for (var _i = 0; _i < arguments.length; _i++) { - keys[_i] = arguments[_i]; - } - var newBaggage = new BaggageImpl(this._entries); - for (var _a = 0, keys_1 = keys; _a < keys_1.length; _a++) { - var key = keys_1[_a]; - newBaggage._entries.delete(key); - } - return newBaggage; - }; - BaggageImpl.prototype.clear = function () { - return new BaggageImpl(); - }; - return BaggageImpl; -}()); -exports.BaggageImpl = BaggageImpl; -//# sourceMappingURL=baggage-impl.js.map + + const posColon = lines[i].indexOf(':') + if ( + posColon === -1 || + posColon === 0 + ) { + return + } + m = RE_HDR.exec(lines[i]) + h = m[1].toLowerCase() + this.header[h] = this.header[h] || [] + this.header[h].push((m[2] || '')) + if (++this.npairs === this.maxHeaderPairs) { break } + } +} + +module.exports = HeaderParser + /***/ }), -/***/ 3542: -/***/ ((__unused_webpack_module, exports) => { +/***/ 8710: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.baggageEntryMetadataSymbol = void 0; -/** - * Symbol used to make BaggageEntryMetadata an opaque type - */ -exports.baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata'); -//# sourceMappingURL=symbol.js.map + +const inherits = (__nccwpck_require__(7261).inherits) +const ReadableStream = (__nccwpck_require__(4492).Readable) + +function PartStream (opts) { + ReadableStream.call(this, opts) +} +inherits(PartStream, ReadableStream) + +PartStream.prototype._read = function (n) {} + +module.exports = PartStream + /***/ }), -/***/ 1508: -/***/ ((__unused_webpack_module, exports) => { +/***/ 8534: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -/* - * Copyright The OpenTelemetry Authors + +/** + * Copyright Brian White. All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * @see https://github.com/mscdex/streamsearch * - * https://www.apache.org/licenses/LICENSE-2.0 + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Based heavily on the Streaming Boyer-Moore-Horspool C++ implementation + * by Hongli Lai at: https://github.com/FooBarWidget/boyer-moore-horspool */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=types.js.map +const EventEmitter = (__nccwpck_require__(5673).EventEmitter) +const inherits = (__nccwpck_require__(7261).inherits) + +function SBMH (needle) { + if (typeof needle === 'string') { + needle = Buffer.from(needle) + } + + if (!Buffer.isBuffer(needle)) { + throw new TypeError('The needle has to be a String or a Buffer.') + } + + const needleLength = needle.length + + if (needleLength === 0) { + throw new Error('The needle cannot be an empty String/Buffer.') + } + + if (needleLength > 256) { + throw new Error('The needle cannot have a length bigger than 256.') + } + + this.maxMatches = Infinity + this.matches = 0 + + this._occ = new Array(256) + .fill(needleLength) // Initialize occurrence table. + this._lookbehind_size = 0 + this._needle = needle + this._bufpos = 0 + + this._lookbehind = Buffer.alloc(needleLength) + + // Populate occurrence table with analysis of the needle, + // ignoring last letter. + for (var i = 0; i < needleLength - 1; ++i) { // eslint-disable-line no-var + this._occ[needle[i]] = needleLength - 1 - i + } +} +inherits(SBMH, EventEmitter) + +SBMH.prototype.reset = function () { + this._lookbehind_size = 0 + this.matches = 0 + this._bufpos = 0 +} + +SBMH.prototype.push = function (chunk, pos) { + if (!Buffer.isBuffer(chunk)) { + chunk = Buffer.from(chunk, 'binary') + } + const chlen = chunk.length + this._bufpos = pos || 0 + let r + while (r !== chlen && this.matches < this.maxMatches) { r = this._sbmh_feed(chunk) } + return r +} + +SBMH.prototype._sbmh_feed = function (data) { + const len = data.length + const needle = this._needle + const needleLength = needle.length + const lastNeedleChar = needle[needleLength - 1] + + // Positive: points to a position in `data` + // pos == 3 points to data[3] + // Negative: points to a position in the lookbehind buffer + // pos == -2 points to lookbehind[lookbehind_size - 2] + let pos = -this._lookbehind_size + let ch + + if (pos < 0) { + // Lookbehind buffer is not empty. Perform Boyer-Moore-Horspool + // search with character lookup code that considers both the + // lookbehind buffer and the current round's haystack data. + // + // Loop until + // there is a match. + // or until + // we've moved past the position that requires the + // lookbehind buffer. In this case we switch to the + // optimized loop. + // or until + // the character to look at lies outside the haystack. + while (pos < 0 && pos <= len - needleLength) { + ch = this._sbmh_lookup_char(data, pos + needleLength - 1) + + if ( + ch === lastNeedleChar && + this._sbmh_memcmp(data, pos, needleLength - 1) + ) { + this._lookbehind_size = 0 + ++this.matches + this.emit('info', true) + + return (this._bufpos = pos + needleLength) + } + pos += this._occ[ch] + } + + // No match. + + if (pos < 0) { + // There's too few data for Boyer-Moore-Horspool to run, + // so let's use a different algorithm to skip as much as + // we can. + // Forward pos until + // the trailing part of lookbehind + data + // looks like the beginning of the needle + // or until + // pos == 0 + while (pos < 0 && !this._sbmh_memcmp(data, pos, len - pos)) { ++pos } + } + + if (pos >= 0) { + // Discard lookbehind buffer. + this.emit('info', false, this._lookbehind, 0, this._lookbehind_size) + this._lookbehind_size = 0 + } else { + // Cut off part of the lookbehind buffer that has + // been processed and append the entire haystack + // into it. + const bytesToCutOff = this._lookbehind_size + pos + if (bytesToCutOff > 0) { + // The cut off data is guaranteed not to contain the needle. + this.emit('info', false, this._lookbehind, 0, bytesToCutOff) + } + + this._lookbehind.copy(this._lookbehind, 0, bytesToCutOff, + this._lookbehind_size - bytesToCutOff) + this._lookbehind_size -= bytesToCutOff + + data.copy(this._lookbehind, this._lookbehind_size) + this._lookbehind_size += len + + this._bufpos = len + return len + } + } + + pos += (pos >= 0) * this._bufpos + + // Lookbehind buffer is now empty. We only need to check if the + // needle is in the haystack. + if (data.indexOf(needle, pos) !== -1) { + pos = data.indexOf(needle, pos) + ++this.matches + if (pos > 0) { this.emit('info', true, data, this._bufpos, pos) } else { this.emit('info', true) } + + return (this._bufpos = pos + needleLength) + } else { + pos = len - needleLength + } + + // There was no match. If there's trailing haystack data that we cannot + // match yet using the Boyer-Moore-Horspool algorithm (because the trailing + // data is less than the needle size) then match using a modified + // algorithm that starts matching from the beginning instead of the end. + // Whatever trailing data is left after running this algorithm is added to + // the lookbehind buffer. + while ( + pos < len && + ( + data[pos] !== needle[0] || + ( + (Buffer.compare( + data.subarray(pos, pos + len - pos), + needle.subarray(0, len - pos) + ) !== 0) + ) + ) + ) { + ++pos + } + if (pos < len) { + data.copy(this._lookbehind, 0, pos, pos + (len - pos)) + this._lookbehind_size = len - pos + } + + // Everything until pos is guaranteed not to contain needle data. + if (pos > 0) { this.emit('info', false, data, this._bufpos, pos < len ? pos : len) } + + this._bufpos = len + return len +} + +SBMH.prototype._sbmh_lookup_char = function (data, pos) { + return (pos < 0) + ? this._lookbehind[this._lookbehind_size + pos] + : data[pos] +} + +SBMH.prototype._sbmh_memcmp = function (data, pos, len) { + for (var i = 0; i < len; ++i) { // eslint-disable-line no-var + if (this._sbmh_lookup_char(data, pos + i) !== this._needle[i]) { return false } + } + return true +} + +module.exports = SBMH + /***/ }), -/***/ 8136: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 3438: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.baggageEntryMetadataFromString = exports.createBaggage = void 0; -var diag_1 = __nccwpck_require__(1877); -var baggage_impl_1 = __nccwpck_require__(4811); -var symbol_1 = __nccwpck_require__(3542); -var diag = diag_1.DiagAPI.instance(); -/** - * Create a new Baggage with optional entries - * - * @param entries An array of baggage entries the new baggage should contain - */ -function createBaggage(entries) { - if (entries === void 0) { entries = {}; } - return new baggage_impl_1.BaggageImpl(new Map(Object.entries(entries))); + +const WritableStream = (__nccwpck_require__(4492).Writable) +const { inherits } = __nccwpck_require__(7261) +const Dicer = __nccwpck_require__(2856) + +const MultipartParser = __nccwpck_require__(415) +const UrlencodedParser = __nccwpck_require__(6780) +const parseParams = __nccwpck_require__(4426) + +function Busboy (opts) { + if (!(this instanceof Busboy)) { return new Busboy(opts) } + + if (typeof opts !== 'object') { + throw new TypeError('Busboy expected an options-Object.') + } + if (typeof opts.headers !== 'object') { + throw new TypeError('Busboy expected an options-Object with headers-attribute.') + } + if (typeof opts.headers['content-type'] !== 'string') { + throw new TypeError('Missing Content-Type-header.') + } + + const { + headers, + ...streamOptions + } = opts + + this.opts = { + autoDestroy: false, + ...streamOptions + } + WritableStream.call(this, this.opts) + + this._done = false + this._parser = this.getParserByHeaders(headers) + this._finished = false } -exports.createBaggage = createBaggage; -/** - * Create a serializable BaggageEntryMetadata object from a string. - * - * @param str string metadata. Format is currently not defined by the spec and has no special meaning. - * - */ -function baggageEntryMetadataFromString(str) { - if (typeof str !== 'string') { - diag.error("Cannot create baggage metadata from unknown type: " + typeof str); - str = ''; +inherits(Busboy, WritableStream) + +Busboy.prototype.emit = function (ev) { + if (ev === 'finish') { + if (!this._done) { + this._parser?.end() + return + } else if (this._finished) { + return } - return { - __TYPE__: symbol_1.baggageEntryMetadataSymbol, - toString: function () { - return str; - }, - }; + this._finished = true + } + WritableStream.prototype.emit.apply(this, arguments) } -exports.baggageEntryMetadataFromString = baggageEntryMetadataFromString; -//# sourceMappingURL=utils.js.map + +Busboy.prototype.getParserByHeaders = function (headers) { + const parsed = parseParams(headers['content-type']) + + const cfg = { + defCharset: this.opts.defCharset, + fileHwm: this.opts.fileHwm, + headers, + highWaterMark: this.opts.highWaterMark, + isPartAFile: this.opts.isPartAFile, + limits: this.opts.limits, + parsedConType: parsed, + preservePath: this.opts.preservePath + } + + if (MultipartParser.detect.test(parsed[0])) { + return new MultipartParser(this, cfg) + } + if (UrlencodedParser.detect.test(parsed[0])) { + return new UrlencodedParser(this, cfg) + } + throw new Error('Unsupported Content-Type.') +} + +Busboy.prototype._write = function (chunk, encoding, cb) { + this._parser.write(chunk, cb) +} + +module.exports = Busboy +module.exports["default"] = Busboy +module.exports.Busboy = Busboy + +module.exports.Dicer = Dicer + /***/ }), -/***/ 4447: -/***/ ((__unused_webpack_module, exports) => { +/***/ 415: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=Exception.js.map + +// TODO: +// * support 1 nested multipart level +// (see second multipart example here: +// http://www.w3.org/TR/html401/interact/forms.html#didx-multipartform-data) +// * support limits.fieldNameSize +// -- this will require modifications to utils.parseParams + +const { Readable } = __nccwpck_require__(4492) +const { inherits } = __nccwpck_require__(7261) + +const Dicer = __nccwpck_require__(2856) + +const parseParams = __nccwpck_require__(4426) +const decodeText = __nccwpck_require__(9136) +const basename = __nccwpck_require__(496) +const getLimit = __nccwpck_require__(9692) + +const RE_BOUNDARY = /^boundary$/i +const RE_FIELD = /^form-data$/i +const RE_CHARSET = /^charset$/i +const RE_FILENAME = /^filename$/i +const RE_NAME = /^name$/i + +Multipart.detect = /^multipart\/form-data/i +function Multipart (boy, cfg) { + let i + let len + const self = this + let boundary + const limits = cfg.limits + const isPartAFile = cfg.isPartAFile || ((fieldName, contentType, fileName) => (contentType === 'application/octet-stream' || fileName !== undefined)) + const parsedConType = cfg.parsedConType || [] + const defCharset = cfg.defCharset || 'utf8' + const preservePath = cfg.preservePath + const fileOpts = { highWaterMark: cfg.fileHwm } + + for (i = 0, len = parsedConType.length; i < len; ++i) { + if (Array.isArray(parsedConType[i]) && + RE_BOUNDARY.test(parsedConType[i][0])) { + boundary = parsedConType[i][1] + break + } + } + + function checkFinished () { + if (nends === 0 && finished && !boy._done) { + finished = false + self.end() + } + } + + if (typeof boundary !== 'string') { throw new Error('Multipart: Boundary not found') } + + const fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024) + const fileSizeLimit = getLimit(limits, 'fileSize', Infinity) + const filesLimit = getLimit(limits, 'files', Infinity) + const fieldsLimit = getLimit(limits, 'fields', Infinity) + const partsLimit = getLimit(limits, 'parts', Infinity) + const headerPairsLimit = getLimit(limits, 'headerPairs', 2000) + const headerSizeLimit = getLimit(limits, 'headerSize', 80 * 1024) + + let nfiles = 0 + let nfields = 0 + let nends = 0 + let curFile + let curField + let finished = false + + this._needDrain = false + this._pause = false + this._cb = undefined + this._nparts = 0 + this._boy = boy + + const parserCfg = { + boundary, + maxHeaderPairs: headerPairsLimit, + maxHeaderSize: headerSizeLimit, + partHwm: fileOpts.highWaterMark, + highWaterMark: cfg.highWaterMark + } + + this.parser = new Dicer(parserCfg) + this.parser.on('drain', function () { + self._needDrain = false + if (self._cb && !self._pause) { + const cb = self._cb + self._cb = undefined + cb() + } + }).on('part', function onPart (part) { + if (++self._nparts > partsLimit) { + self.parser.removeListener('part', onPart) + self.parser.on('part', skipPart) + boy.hitPartsLimit = true + boy.emit('partsLimit') + return skipPart(part) + } + + // hack because streams2 _always_ doesn't emit 'end' until nextTick, so let + // us emit 'end' early since we know the part has ended if we are already + // seeing the next part + if (curField) { + const field = curField + field.emit('end') + field.removeAllListeners('end') + } + + part.on('header', function (header) { + let contype + let fieldname + let parsed + let charset + let encoding + let filename + let nsize = 0 + + if (header['content-type']) { + parsed = parseParams(header['content-type'][0]) + if (parsed[0]) { + contype = parsed[0].toLowerCase() + for (i = 0, len = parsed.length; i < len; ++i) { + if (RE_CHARSET.test(parsed[i][0])) { + charset = parsed[i][1].toLowerCase() + break + } + } + } + } + + if (contype === undefined) { contype = 'text/plain' } + if (charset === undefined) { charset = defCharset } + + if (header['content-disposition']) { + parsed = parseParams(header['content-disposition'][0]) + if (!RE_FIELD.test(parsed[0])) { return skipPart(part) } + for (i = 0, len = parsed.length; i < len; ++i) { + if (RE_NAME.test(parsed[i][0])) { + fieldname = parsed[i][1] + } else if (RE_FILENAME.test(parsed[i][0])) { + filename = parsed[i][1] + if (!preservePath) { filename = basename(filename) } + } + } + } else { return skipPart(part) } + + if (header['content-transfer-encoding']) { encoding = header['content-transfer-encoding'][0].toLowerCase() } else { encoding = '7bit' } + + let onData, + onEnd + + if (isPartAFile(fieldname, contype, filename)) { + // file/binary field + if (nfiles === filesLimit) { + if (!boy.hitFilesLimit) { + boy.hitFilesLimit = true + boy.emit('filesLimit') + } + return skipPart(part) + } + + ++nfiles + + if (!boy._events.file) { + self.parser._ignore() + return + } + + ++nends + const file = new FileStream(fileOpts) + curFile = file + file.on('end', function () { + --nends + self._pause = false + checkFinished() + if (self._cb && !self._needDrain) { + const cb = self._cb + self._cb = undefined + cb() + } + }) + file._read = function (n) { + if (!self._pause) { return } + self._pause = false + if (self._cb && !self._needDrain) { + const cb = self._cb + self._cb = undefined + cb() + } + } + boy.emit('file', fieldname, file, filename, encoding, contype) + + onData = function (data) { + if ((nsize += data.length) > fileSizeLimit) { + const extralen = fileSizeLimit - nsize + data.length + if (extralen > 0) { file.push(data.slice(0, extralen)) } + file.truncated = true + file.bytesRead = fileSizeLimit + part.removeAllListeners('data') + file.emit('limit') + return + } else if (!file.push(data)) { self._pause = true } + + file.bytesRead = nsize + } + + onEnd = function () { + curFile = undefined + file.push(null) + } + } else { + // non-file field + if (nfields === fieldsLimit) { + if (!boy.hitFieldsLimit) { + boy.hitFieldsLimit = true + boy.emit('fieldsLimit') + } + return skipPart(part) + } + + ++nfields + ++nends + let buffer = '' + let truncated = false + curField = part + + onData = function (data) { + if ((nsize += data.length) > fieldSizeLimit) { + const extralen = (fieldSizeLimit - (nsize - data.length)) + buffer += data.toString('binary', 0, extralen) + truncated = true + part.removeAllListeners('data') + } else { buffer += data.toString('binary') } + } + + onEnd = function () { + curField = undefined + if (buffer.length) { buffer = decodeText(buffer, 'binary', charset) } + boy.emit('field', fieldname, buffer, false, truncated, encoding, contype) + --nends + checkFinished() + } + } + + /* As of node@2efe4ab761666 (v0.10.29+/v0.11.14+), busboy had become + broken. Streams2/streams3 is a huge black box of confusion, but + somehow overriding the sync state seems to fix things again (and still + seems to work for previous node versions). + */ + part._readableState.sync = false + + part.on('data', onData) + part.on('end', onEnd) + }).on('error', function (err) { + if (curFile) { curFile.emit('error', err) } + }) + }).on('error', function (err) { + boy.emit('error', err) + }).on('finish', function () { + finished = true + checkFinished() + }) +} + +Multipart.prototype.write = function (chunk, cb) { + const r = this.parser.write(chunk) + if (r && !this._pause) { + cb() + } else { + this._needDrain = !r + this._cb = cb + } +} + +Multipart.prototype.end = function () { + const self = this + + if (self.parser.writable) { + self.parser.end() + } else if (!self._boy._done) { + process.nextTick(function () { + self._boy._done = true + self._boy.emit('finish') + }) + } +} + +function skipPart (part) { + part.resume() +} + +function FileStream (opts) { + Readable.call(this, opts) + + this.bytesRead = 0 + + this.truncated = false +} + +inherits(FileStream, Readable) + +FileStream.prototype._read = function (n) {} + +module.exports = Multipart + /***/ }), -/***/ 2358: -/***/ ((__unused_webpack_module, exports) => { +/***/ 6780: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=Time.js.map + +const Decoder = __nccwpck_require__(9730) +const decodeText = __nccwpck_require__(9136) +const getLimit = __nccwpck_require__(9692) + +const RE_CHARSET = /^charset$/i + +UrlEncoded.detect = /^application\/x-www-form-urlencoded/i +function UrlEncoded (boy, cfg) { + const limits = cfg.limits + const parsedConType = cfg.parsedConType + this.boy = boy + + this.fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024) + this.fieldNameSizeLimit = getLimit(limits, 'fieldNameSize', 100) + this.fieldsLimit = getLimit(limits, 'fields', Infinity) + + let charset + for (var i = 0, len = parsedConType.length; i < len; ++i) { // eslint-disable-line no-var + if (Array.isArray(parsedConType[i]) && + RE_CHARSET.test(parsedConType[i][0])) { + charset = parsedConType[i][1].toLowerCase() + break + } + } + + if (charset === undefined) { charset = cfg.defCharset || 'utf8' } + + this.decoder = new Decoder() + this.charset = charset + this._fields = 0 + this._state = 'key' + this._checkingBytes = true + this._bytesKey = 0 + this._bytesVal = 0 + this._key = '' + this._val = '' + this._keyTrunc = false + this._valTrunc = false + this._hitLimit = false +} + +UrlEncoded.prototype.write = function (data, cb) { + if (this._fields === this.fieldsLimit) { + if (!this.boy.hitFieldsLimit) { + this.boy.hitFieldsLimit = true + this.boy.emit('fieldsLimit') + } + return cb() + } + + let idxeq; let idxamp; let i; let p = 0; const len = data.length + + while (p < len) { + if (this._state === 'key') { + idxeq = idxamp = undefined + for (i = p; i < len; ++i) { + if (!this._checkingBytes) { ++p } + if (data[i] === 0x3D/* = */) { + idxeq = i + break + } else if (data[i] === 0x26/* & */) { + idxamp = i + break + } + if (this._checkingBytes && this._bytesKey === this.fieldNameSizeLimit) { + this._hitLimit = true + break + } else if (this._checkingBytes) { ++this._bytesKey } + } + + if (idxeq !== undefined) { + // key with assignment + if (idxeq > p) { this._key += this.decoder.write(data.toString('binary', p, idxeq)) } + this._state = 'val' + + this._hitLimit = false + this._checkingBytes = true + this._val = '' + this._bytesVal = 0 + this._valTrunc = false + this.decoder.reset() + + p = idxeq + 1 + } else if (idxamp !== undefined) { + // key with no assignment + ++this._fields + let key; const keyTrunc = this._keyTrunc + if (idxamp > p) { key = (this._key += this.decoder.write(data.toString('binary', p, idxamp))) } else { key = this._key } + + this._hitLimit = false + this._checkingBytes = true + this._key = '' + this._bytesKey = 0 + this._keyTrunc = false + this.decoder.reset() + + if (key.length) { + this.boy.emit('field', decodeText(key, 'binary', this.charset), + '', + keyTrunc, + false) + } + + p = idxamp + 1 + if (this._fields === this.fieldsLimit) { return cb() } + } else if (this._hitLimit) { + // we may not have hit the actual limit if there are encoded bytes... + if (i > p) { this._key += this.decoder.write(data.toString('binary', p, i)) } + p = i + if ((this._bytesKey = this._key.length) === this.fieldNameSizeLimit) { + // yep, we actually did hit the limit + this._checkingBytes = false + this._keyTrunc = true + } + } else { + if (p < len) { this._key += this.decoder.write(data.toString('binary', p)) } + p = len + } + } else { + idxamp = undefined + for (i = p; i < len; ++i) { + if (!this._checkingBytes) { ++p } + if (data[i] === 0x26/* & */) { + idxamp = i + break + } + if (this._checkingBytes && this._bytesVal === this.fieldSizeLimit) { + this._hitLimit = true + break + } else if (this._checkingBytes) { ++this._bytesVal } + } + + if (idxamp !== undefined) { + ++this._fields + if (idxamp > p) { this._val += this.decoder.write(data.toString('binary', p, idxamp)) } + this.boy.emit('field', decodeText(this._key, 'binary', this.charset), + decodeText(this._val, 'binary', this.charset), + this._keyTrunc, + this._valTrunc) + this._state = 'key' + + this._hitLimit = false + this._checkingBytes = true + this._key = '' + this._bytesKey = 0 + this._keyTrunc = false + this.decoder.reset() + + p = idxamp + 1 + if (this._fields === this.fieldsLimit) { return cb() } + } else if (this._hitLimit) { + // we may not have hit the actual limit if there are encoded bytes... + if (i > p) { this._val += this.decoder.write(data.toString('binary', p, i)) } + p = i + if ((this._val === '' && this.fieldSizeLimit === 0) || + (this._bytesVal = this._val.length) === this.fieldSizeLimit) { + // yep, we actually did hit the limit + this._checkingBytes = false + this._valTrunc = true + } + } else { + if (p < len) { this._val += this.decoder.write(data.toString('binary', p)) } + p = len + } + } + } + cb() +} + +UrlEncoded.prototype.end = function () { + if (this.boy._done) { return } + + if (this._state === 'key' && this._key.length > 0) { + this.boy.emit('field', decodeText(this._key, 'binary', this.charset), + '', + this._keyTrunc, + false) + } else if (this._state === 'val') { + this.boy.emit('field', decodeText(this._key, 'binary', this.charset), + decodeText(this._val, 'binary', this.charset), + this._keyTrunc, + this._valTrunc) + } + this.boy._done = true + this.boy.emit('finish') +} + +module.exports = UrlEncoded + /***/ }), -/***/ 4118: +/***/ 9730: +/***/ ((module) => { + +"use strict"; + + +const RE_PLUS = /\+/g + +const HEX = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +] + +function Decoder () { + this.buffer = undefined +} +Decoder.prototype.write = function (str) { + // Replace '+' with ' ' before decoding + str = str.replace(RE_PLUS, ' ') + let res = '' + let i = 0; let p = 0; const len = str.length + for (; i < len; ++i) { + if (this.buffer !== undefined) { + if (!HEX[str.charCodeAt(i)]) { + res += '%' + this.buffer + this.buffer = undefined + --i // retry character + } else { + this.buffer += str[i] + ++p + if (this.buffer.length === 2) { + res += String.fromCharCode(parseInt(this.buffer, 16)) + this.buffer = undefined + } + } + } else if (str[i] === '%') { + if (i > p) { + res += str.substring(p, i) + p = i + } + this.buffer = '' + ++p + } + } + if (p < len && this.buffer === undefined) { res += str.substring(p) } + return res +} +Decoder.prototype.reset = function () { + this.buffer = undefined +} + +module.exports = Decoder + + +/***/ }), + +/***/ 496: +/***/ ((module) => { + +"use strict"; + + +module.exports = function basename (path) { + if (typeof path !== 'string') { return '' } + for (var i = path.length - 1; i >= 0; --i) { // eslint-disable-line no-var + switch (path.charCodeAt(i)) { + case 0x2F: // '/' + case 0x5C: // '\' + path = path.slice(i + 1) + return (path === '..' || path === '.' ? '' : path) + } + } + return (path === '..' || path === '.' ? '' : path) +} + + +/***/ }), + +/***/ 9136: +/***/ ((module) => { + +"use strict"; + + +// Node has always utf-8 +const utf8Decoder = new TextDecoder('utf-8') +const textDecoders = new Map([ + ['utf-8', utf8Decoder], + ['utf8', utf8Decoder] +]) + +function decodeText (text, textEncoding, destEncoding) { + if (text) { + if (textDecoders.has(destEncoding)) { + try { + return textDecoders.get(destEncoding).decode(Buffer.from(text, textEncoding)) + } catch (e) { } + } else { + try { + textDecoders.set(destEncoding, new TextDecoder(destEncoding)) + return textDecoders.get(destEncoding).decode(Buffer.from(text, textEncoding)) + } catch (e) { } + } + } + return text +} + +module.exports = decodeText + + +/***/ }), + +/***/ 9692: +/***/ ((module) => { + +"use strict"; + + +module.exports = function getLimit (limits, name, defaultLimit) { + if ( + !limits || + limits[name] === undefined || + limits[name] === null + ) { return defaultLimit } + + if ( + typeof limits[name] !== 'number' || + isNaN(limits[name]) + ) { throw new TypeError('Limit ' + name + ' is not a valid number') } + + return limits[name] +} + + +/***/ }), + +/***/ 4426: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const decodeText = __nccwpck_require__(9136) + +const RE_ENCODED = /%([a-fA-F0-9]{2})/g + +function encodedReplacer (match, byte) { + return String.fromCharCode(parseInt(byte, 16)) +} + +function parseParams (str) { + const res = [] + let state = 'key' + let charset = '' + let inquote = false + let escaping = false + let p = 0 + let tmp = '' + + for (var i = 0, len = str.length; i < len; ++i) { // eslint-disable-line no-var + const char = str[i] + if (char === '\\' && inquote) { + if (escaping) { escaping = false } else { + escaping = true + continue + } + } else if (char === '"') { + if (!escaping) { + if (inquote) { + inquote = false + state = 'key' + } else { inquote = true } + continue + } else { escaping = false } + } else { + if (escaping && inquote) { tmp += '\\' } + escaping = false + if ((state === 'charset' || state === 'lang') && char === "'") { + if (state === 'charset') { + state = 'lang' + charset = tmp.substring(1) + } else { state = 'value' } + tmp = '' + continue + } else if (state === 'key' && + (char === '*' || char === '=') && + res.length) { + if (char === '*') { state = 'charset' } else { state = 'value' } + res[p] = [tmp, undefined] + tmp = '' + continue + } else if (!inquote && char === ';') { + state = 'key' + if (charset) { + if (tmp.length) { + tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), + 'binary', + charset) + } + charset = '' + } else if (tmp.length) { + tmp = decodeText(tmp, 'binary', 'utf8') + } + if (res[p] === undefined) { res[p] = tmp } else { res[p][1] = tmp } + tmp = '' + ++p + continue + } else if (!inquote && (char === ' ' || char === '\t')) { continue } + } + tmp += char + } + if (charset && tmp.length) { + tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), + 'binary', + charset) + } else if (tmp) { + tmp = decodeText(tmp, 'binary', 'utf8') + } + + if (res[p] === undefined) { + if (tmp) { res[p] = tmp } + } else { res[p][1] = tmp } + + return res +} + +module.exports = parseParams + + +/***/ }), + +/***/ 7171: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -48311,39 +49286,82 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) { return to; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.NoopContextManager = void 0; -var context_1 = __nccwpck_require__(8242); -var NoopContextManager = /** @class */ (function () { - function NoopContextManager() { +exports.ContextAPI = void 0; +var NoopContextManager_1 = __nccwpck_require__(4118); +var global_utils_1 = __nccwpck_require__(5135); +var diag_1 = __nccwpck_require__(1877); +var API_NAME = 'context'; +var NOOP_CONTEXT_MANAGER = new NoopContextManager_1.NoopContextManager(); +/** + * Singleton object which represents the entry point to the OpenTelemetry Context API + */ +var ContextAPI = /** @class */ (function () { + /** Empty private constructor prevents end users from constructing a new instance of the API */ + function ContextAPI() { } - NoopContextManager.prototype.active = function () { - return context_1.ROOT_CONTEXT; - }; - NoopContextManager.prototype.with = function (_context, fn, thisArg) { + /** Get the singleton instance of the Context API */ + ContextAPI.getInstance = function () { + if (!this._instance) { + this._instance = new ContextAPI(); + } + return this._instance; + }; + /** + * Set the current context manager. + * + * @returns true if the context manager was successfully registered, else false + */ + ContextAPI.prototype.setGlobalContextManager = function (contextManager) { + return global_utils_1.registerGlobal(API_NAME, contextManager, diag_1.DiagAPI.instance()); + }; + /** + * Get the currently active context + */ + ContextAPI.prototype.active = function () { + return this._getContextManager().active(); + }; + /** + * Execute a function with an active context + * + * @param context context to be active during function execution + * @param fn function to execute in a context + * @param thisArg optional receiver to be used for calling fn + * @param args optional arguments forwarded to fn + */ + ContextAPI.prototype.with = function (context, fn, thisArg) { + var _a; var args = []; for (var _i = 3; _i < arguments.length; _i++) { args[_i - 3] = arguments[_i]; } - return fn.call.apply(fn, __spreadArray([thisArg], args)); + return (_a = this._getContextManager()).with.apply(_a, __spreadArray([context, fn, thisArg], args)); }; - NoopContextManager.prototype.bind = function (_context, target) { - return target; + /** + * Bind a context to a target function or event emitter + * + * @param context context to bind to the event emitter or function. Defaults to the currently active context + * @param target function or event emitter to bind + */ + ContextAPI.prototype.bind = function (context, target) { + return this._getContextManager().bind(context, target); }; - NoopContextManager.prototype.enable = function () { - return this; + ContextAPI.prototype._getContextManager = function () { + return global_utils_1.getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER; }; - NoopContextManager.prototype.disable = function () { - return this; + /** Disable and remove the global context manager */ + ContextAPI.prototype.disable = function () { + this._getContextManager().disable(); + global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance()); }; - return NoopContextManager; + return ContextAPI; }()); -exports.NoopContextManager = NoopContextManager; -//# sourceMappingURL=NoopContextManager.js.map +exports.ContextAPI = ContextAPI; +//# sourceMappingURL=context.js.map /***/ }), -/***/ 8242: -/***/ ((__unused_webpack_module, exports) => { +/***/ 1877: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -48363,50 +49381,87 @@ exports.NoopContextManager = NoopContextManager; * limitations under the License. */ Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ROOT_CONTEXT = exports.createContextKey = void 0; -/** Get a key to uniquely identify a context value */ -function createContextKey(description) { - // The specification states that for the same input, multiple calls should - // return different keys. Due to the nature of the JS dependency management - // system, this creates problems where multiple versions of some package - // could hold different keys for the same property. - // - // Therefore, we use Symbol.for which returns the same key for the same input. - return Symbol.for(description); -} -exports.createContextKey = createContextKey; -var BaseContext = /** @class */ (function () { +exports.DiagAPI = void 0; +var ComponentLogger_1 = __nccwpck_require__(7978); +var logLevelLogger_1 = __nccwpck_require__(9639); +var types_1 = __nccwpck_require__(8077); +var global_utils_1 = __nccwpck_require__(5135); +var API_NAME = 'diag'; +/** + * Singleton object which represents the entry point to the OpenTelemetry internal + * diagnostic API + */ +var DiagAPI = /** @class */ (function () { /** - * Construct a new context which inherits values from an optional parent context. - * - * @param parentContext a context from which to inherit values + * Private internal constructor + * @private */ - function BaseContext(parentContext) { - // for minification + function DiagAPI() { + function _logProxy(funcName) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var logger = global_utils_1.getGlobal('diag'); + // shortcut if logger not set + if (!logger) + return; + return logger[funcName].apply(logger, args); + }; + } + // Using self local variable for minification purposes as 'this' cannot be minified var self = this; - self._currentContext = parentContext ? new Map(parentContext) : new Map(); - self.getValue = function (key) { return self._currentContext.get(key); }; - self.setValue = function (key, value) { - var context = new BaseContext(self._currentContext); - context._currentContext.set(key, value); - return context; + // DiagAPI specific functions + self.setLogger = function (logger, logLevel) { + var _a, _b; + if (logLevel === void 0) { logLevel = types_1.DiagLogLevel.INFO; } + if (logger === self) { + // There isn't much we can do here. + // Logging to the console might break the user application. + // Try to log to self. If a logger was previously registered it will receive the log. + var err = new Error('Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation'); + self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message); + return false; + } + var oldLogger = global_utils_1.getGlobal('diag'); + var newLogger = logLevelLogger_1.createLogLevelDiagLogger(logLevel, logger); + // There already is an logger registered. We'll let it know before overwriting it. + if (oldLogger) { + var stack = (_b = new Error().stack) !== null && _b !== void 0 ? _b : ''; + oldLogger.warn("Current logger will be overwritten from " + stack); + newLogger.warn("Current logger will overwrite one already registered from " + stack); + } + return global_utils_1.registerGlobal('diag', newLogger, self, true); }; - self.deleteValue = function (key) { - var context = new BaseContext(self._currentContext); - context._currentContext.delete(key); - return context; + self.disable = function () { + global_utils_1.unregisterGlobal(API_NAME, self); + }; + self.createComponentLogger = function (options) { + return new ComponentLogger_1.DiagComponentLogger(options); }; + self.verbose = _logProxy('verbose'); + self.debug = _logProxy('debug'); + self.info = _logProxy('info'); + self.warn = _logProxy('warn'); + self.error = _logProxy('error'); } - return BaseContext; + /** Get the singleton instance of the DiagAPI API */ + DiagAPI.instance = function () { + if (!this._instance) { + this._instance = new DiagAPI(); + } + return this._instance; + }; + return DiagAPI; }()); -/** The root context is used as the default parent context when there is no active context */ -exports.ROOT_CONTEXT = new BaseContext(); -//# sourceMappingURL=context.js.map +exports.DiagAPI = DiagAPI; +//# sourceMappingURL=diag.js.map /***/ }), -/***/ 6504: -/***/ ((__unused_webpack_module, exports) => { +/***/ 9909: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -48426,11 +49481,84 @@ exports.ROOT_CONTEXT = new BaseContext(); * limitations under the License. */ Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=types.js.map +exports.PropagationAPI = void 0; +var global_utils_1 = __nccwpck_require__(5135); +var NoopTextMapPropagator_1 = __nccwpck_require__(2368); +var TextMapPropagator_1 = __nccwpck_require__(865); +var context_helpers_1 = __nccwpck_require__(7682); +var utils_1 = __nccwpck_require__(8136); +var diag_1 = __nccwpck_require__(1877); +var API_NAME = 'propagation'; +var NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator_1.NoopTextMapPropagator(); +/** + * Singleton object which represents the entry point to the OpenTelemetry Propagation API + */ +var PropagationAPI = /** @class */ (function () { + /** Empty private constructor prevents end users from constructing a new instance of the API */ + function PropagationAPI() { + this.createBaggage = utils_1.createBaggage; + this.getBaggage = context_helpers_1.getBaggage; + this.setBaggage = context_helpers_1.setBaggage; + this.deleteBaggage = context_helpers_1.deleteBaggage; + } + /** Get the singleton instance of the Propagator API */ + PropagationAPI.getInstance = function () { + if (!this._instance) { + this._instance = new PropagationAPI(); + } + return this._instance; + }; + /** + * Set the current propagator. + * + * @returns true if the propagator was successfully registered, else false + */ + PropagationAPI.prototype.setGlobalPropagator = function (propagator) { + return global_utils_1.registerGlobal(API_NAME, propagator, diag_1.DiagAPI.instance()); + }; + /** + * Inject context into a carrier to be propagated inter-process + * + * @param context Context carrying tracing data to inject + * @param carrier carrier to inject context into + * @param setter Function used to set values on the carrier + */ + PropagationAPI.prototype.inject = function (context, carrier, setter) { + if (setter === void 0) { setter = TextMapPropagator_1.defaultTextMapSetter; } + return this._getGlobalPropagator().inject(context, carrier, setter); + }; + /** + * Extract context from a carrier + * + * @param context Context which the newly created context will inherit from + * @param carrier Carrier to extract context from + * @param getter Function used to extract keys from a carrier + */ + PropagationAPI.prototype.extract = function (context, carrier, getter) { + if (getter === void 0) { getter = TextMapPropagator_1.defaultTextMapGetter; } + return this._getGlobalPropagator().extract(context, carrier, getter); + }; + /** + * Return a list of all fields which may be used by the propagator. + */ + PropagationAPI.prototype.fields = function () { + return this._getGlobalPropagator().fields(); + }; + /** Remove the global propagator */ + PropagationAPI.prototype.disable = function () { + global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance()); + }; + PropagationAPI.prototype._getGlobalPropagator = function () { + return global_utils_1.getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR; + }; + return PropagationAPI; +}()); +exports.PropagationAPI = PropagationAPI; +//# sourceMappingURL=propagation.js.map /***/ }), -/***/ 7978: +/***/ 1539: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -48451,74 +49579,73 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); * limitations under the License. */ Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.DiagComponentLogger = void 0; +exports.TraceAPI = void 0; var global_utils_1 = __nccwpck_require__(5135); +var ProxyTracerProvider_1 = __nccwpck_require__(2285); +var spancontext_utils_1 = __nccwpck_require__(9745); +var context_utils_1 = __nccwpck_require__(3326); +var diag_1 = __nccwpck_require__(1877); +var API_NAME = 'trace'; /** - * Component Logger which is meant to be used as part of any component which - * will add automatically additional namespace in front of the log message. - * It will then forward all message to global diag logger - * @example - * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' }); - * cLogger.debug('test'); - * // @opentelemetry/instrumentation-http test + * Singleton object which represents the entry point to the OpenTelemetry Tracing API */ -var DiagComponentLogger = /** @class */ (function () { - function DiagComponentLogger(props) { - this._namespace = props.namespace || 'DiagComponentLogger'; +var TraceAPI = /** @class */ (function () { + /** Empty private constructor prevents end users from constructing a new instance of the API */ + function TraceAPI() { + this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider(); + this.wrapSpanContext = spancontext_utils_1.wrapSpanContext; + this.isSpanContextValid = spancontext_utils_1.isSpanContextValid; + this.deleteSpan = context_utils_1.deleteSpan; + this.getSpan = context_utils_1.getSpan; + this.getSpanContext = context_utils_1.getSpanContext; + this.setSpan = context_utils_1.setSpan; + this.setSpanContext = context_utils_1.setSpanContext; } - DiagComponentLogger.prototype.debug = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; + /** Get the singleton instance of the Trace API */ + TraceAPI.getInstance = function () { + if (!this._instance) { + this._instance = new TraceAPI(); } - return logProxy('debug', this._namespace, args); + return this._instance; }; - DiagComponentLogger.prototype.error = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; + /** + * Set the current global tracer. + * + * @returns true if the tracer provider was successfully registered, else false + */ + TraceAPI.prototype.setGlobalTracerProvider = function (provider) { + var success = global_utils_1.registerGlobal(API_NAME, this._proxyTracerProvider, diag_1.DiagAPI.instance()); + if (success) { + this._proxyTracerProvider.setDelegate(provider); } - return logProxy('error', this._namespace, args); + return success; }; - DiagComponentLogger.prototype.info = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return logProxy('info', this._namespace, args); + /** + * Returns the global tracer provider. + */ + TraceAPI.prototype.getTracerProvider = function () { + return global_utils_1.getGlobal(API_NAME) || this._proxyTracerProvider; }; - DiagComponentLogger.prototype.warn = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return logProxy('warn', this._namespace, args); + /** + * Returns a tracer from the global tracer provider. + */ + TraceAPI.prototype.getTracer = function (name, version) { + return this.getTracerProvider().getTracer(name, version); }; - DiagComponentLogger.prototype.verbose = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return logProxy('verbose', this._namespace, args); + /** Remove the global tracer provider */ + TraceAPI.prototype.disable = function () { + global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance()); + this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider(); }; - return DiagComponentLogger; + return TraceAPI; }()); -exports.DiagComponentLogger = DiagComponentLogger; -function logProxy(funcName, namespace, args) { - var logger = global_utils_1.getGlobal('diag'); - // shortcut if logger not set - if (!logger) { - return; - } - args.unshift(namespace); - return logger[funcName].apply(logger, args); -} -//# sourceMappingURL=ComponentLogger.js.map +exports.TraceAPI = TraceAPI; +//# sourceMappingURL=trace.js.map /***/ }), -/***/ 3041: -/***/ ((__unused_webpack_module, exports) => { +/***/ 7682: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -48538,56 +49665,47 @@ function logProxy(funcName, namespace, args) { * limitations under the License. */ Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.DiagConsoleLogger = void 0; -var consoleMap = [ - { n: 'error', c: 'error' }, - { n: 'warn', c: 'warn' }, - { n: 'info', c: 'info' }, - { n: 'debug', c: 'debug' }, - { n: 'verbose', c: 'trace' }, -]; +exports.deleteBaggage = exports.setBaggage = exports.getBaggage = void 0; +var context_1 = __nccwpck_require__(8242); /** - * A simple Immutable Console based diagnostic logger which will output any messages to the Console. - * If you want to limit the amount of logging to a specific level or lower use the - * {@link createLogLevelDiagLogger} + * Baggage key */ -var DiagConsoleLogger = /** @class */ (function () { - function DiagConsoleLogger() { - function _consoleFunc(funcName) { - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - if (console) { - // Some environments only expose the console when the F12 developer console is open - // eslint-disable-next-line no-console - var theFunc = console[funcName]; - if (typeof theFunc !== 'function') { - // Not all environments support all functions - // eslint-disable-next-line no-console - theFunc = console.log; - } - // One last final check - if (typeof theFunc === 'function') { - return theFunc.apply(console, args); - } - } - }; - } - for (var i = 0; i < consoleMap.length; i++) { - this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c); - } - } - return DiagConsoleLogger; -}()); -exports.DiagConsoleLogger = DiagConsoleLogger; -//# sourceMappingURL=consoleLogger.js.map +var BAGGAGE_KEY = context_1.createContextKey('OpenTelemetry Baggage Key'); +/** + * Retrieve the current baggage from the given context + * + * @param {Context} Context that manage all context values + * @returns {Baggage} Extracted baggage from the context + */ +function getBaggage(context) { + return context.getValue(BAGGAGE_KEY) || undefined; +} +exports.getBaggage = getBaggage; +/** + * Store a baggage in the given context + * + * @param {Context} Context that manage all context values + * @param {Baggage} baggage that will be set in the actual context + */ +function setBaggage(context, baggage) { + return context.setValue(BAGGAGE_KEY, baggage); +} +exports.setBaggage = setBaggage; +/** + * Delete the baggage stored in the given context + * + * @param {Context} Context that manage all context values + */ +function deleteBaggage(context) { + return context.deleteValue(BAGGAGE_KEY); +} +exports.deleteBaggage = deleteBaggage; +//# sourceMappingURL=context-helpers.js.map /***/ }), -/***/ 1634: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 4811: +/***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -48606,25 +49724,59 @@ exports.DiagConsoleLogger = DiagConsoleLogger; * See the License for the specific language governing permissions and * limitations under the License. */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(3041), exports); -__exportStar(__nccwpck_require__(8077), exports); -//# sourceMappingURL=index.js.map +exports.BaggageImpl = void 0; +var BaggageImpl = /** @class */ (function () { + function BaggageImpl(entries) { + this._entries = entries ? new Map(entries) : new Map(); + } + BaggageImpl.prototype.getEntry = function (key) { + var entry = this._entries.get(key); + if (!entry) { + return undefined; + } + return Object.assign({}, entry); + }; + BaggageImpl.prototype.getAllEntries = function () { + return Array.from(this._entries.entries()).map(function (_a) { + var k = _a[0], v = _a[1]; + return [k, v]; + }); + }; + BaggageImpl.prototype.setEntry = function (key, entry) { + var newBaggage = new BaggageImpl(this._entries); + newBaggage._entries.set(key, entry); + return newBaggage; + }; + BaggageImpl.prototype.removeEntry = function (key) { + var newBaggage = new BaggageImpl(this._entries); + newBaggage._entries.delete(key); + return newBaggage; + }; + BaggageImpl.prototype.removeEntries = function () { + var keys = []; + for (var _i = 0; _i < arguments.length; _i++) { + keys[_i] = arguments[_i]; + } + var newBaggage = new BaggageImpl(this._entries); + for (var _a = 0, keys_1 = keys; _a < keys_1.length; _a++) { + var key = keys_1[_a]; + newBaggage._entries.delete(key); + } + return newBaggage; + }; + BaggageImpl.prototype.clear = function () { + return new BaggageImpl(); + }; + return BaggageImpl; +}()); +exports.BaggageImpl = BaggageImpl; +//# sourceMappingURL=baggage-impl.js.map /***/ }), -/***/ 9639: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 3542: +/***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -48644,22 +49796,509 @@ __exportStar(__nccwpck_require__(8077), exports); * limitations under the License. */ Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createLogLevelDiagLogger = void 0; -var types_1 = __nccwpck_require__(8077); -function createLogLevelDiagLogger(maxLevel, logger) { - if (maxLevel < types_1.DiagLogLevel.NONE) { - maxLevel = types_1.DiagLogLevel.NONE; - } - else if (maxLevel > types_1.DiagLogLevel.ALL) { - maxLevel = types_1.DiagLogLevel.ALL; - } - // In case the logger is null or undefined - logger = logger || {}; - function _filterFunc(funcName, theLevel) { - var theFunc = logger[funcName]; - if (typeof theFunc === 'function' && maxLevel >= theLevel) { - return theFunc.bind(logger); - } +exports.baggageEntryMetadataSymbol = void 0; +/** + * Symbol used to make BaggageEntryMetadata an opaque type + */ +exports.baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata'); +//# sourceMappingURL=symbol.js.map + +/***/ }), + +/***/ 1508: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=types.js.map + +/***/ }), + +/***/ 8136: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.baggageEntryMetadataFromString = exports.createBaggage = void 0; +var diag_1 = __nccwpck_require__(1877); +var baggage_impl_1 = __nccwpck_require__(4811); +var symbol_1 = __nccwpck_require__(3542); +var diag = diag_1.DiagAPI.instance(); +/** + * Create a new Baggage with optional entries + * + * @param entries An array of baggage entries the new baggage should contain + */ +function createBaggage(entries) { + if (entries === void 0) { entries = {}; } + return new baggage_impl_1.BaggageImpl(new Map(Object.entries(entries))); +} +exports.createBaggage = createBaggage; +/** + * Create a serializable BaggageEntryMetadata object from a string. + * + * @param str string metadata. Format is currently not defined by the spec and has no special meaning. + * + */ +function baggageEntryMetadataFromString(str) { + if (typeof str !== 'string') { + diag.error("Cannot create baggage metadata from unknown type: " + typeof str); + str = ''; + } + return { + __TYPE__: symbol_1.baggageEntryMetadataSymbol, + toString: function () { + return str; + }, + }; +} +exports.baggageEntryMetadataFromString = baggageEntryMetadataFromString; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 4447: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=Exception.js.map + +/***/ }), + +/***/ 2358: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=Time.js.map + +/***/ }), + +/***/ 4118: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __spreadArray = (this && this.__spreadArray) || function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.NoopContextManager = void 0; +var context_1 = __nccwpck_require__(8242); +var NoopContextManager = /** @class */ (function () { + function NoopContextManager() { + } + NoopContextManager.prototype.active = function () { + return context_1.ROOT_CONTEXT; + }; + NoopContextManager.prototype.with = function (_context, fn, thisArg) { + var args = []; + for (var _i = 3; _i < arguments.length; _i++) { + args[_i - 3] = arguments[_i]; + } + return fn.call.apply(fn, __spreadArray([thisArg], args)); + }; + NoopContextManager.prototype.bind = function (_context, target) { + return target; + }; + NoopContextManager.prototype.enable = function () { + return this; + }; + NoopContextManager.prototype.disable = function () { + return this; + }; + return NoopContextManager; +}()); +exports.NoopContextManager = NoopContextManager; +//# sourceMappingURL=NoopContextManager.js.map + +/***/ }), + +/***/ 8242: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ROOT_CONTEXT = exports.createContextKey = void 0; +/** Get a key to uniquely identify a context value */ +function createContextKey(description) { + // The specification states that for the same input, multiple calls should + // return different keys. Due to the nature of the JS dependency management + // system, this creates problems where multiple versions of some package + // could hold different keys for the same property. + // + // Therefore, we use Symbol.for which returns the same key for the same input. + return Symbol.for(description); +} +exports.createContextKey = createContextKey; +var BaseContext = /** @class */ (function () { + /** + * Construct a new context which inherits values from an optional parent context. + * + * @param parentContext a context from which to inherit values + */ + function BaseContext(parentContext) { + // for minification + var self = this; + self._currentContext = parentContext ? new Map(parentContext) : new Map(); + self.getValue = function (key) { return self._currentContext.get(key); }; + self.setValue = function (key, value) { + var context = new BaseContext(self._currentContext); + context._currentContext.set(key, value); + return context; + }; + self.deleteValue = function (key) { + var context = new BaseContext(self._currentContext); + context._currentContext.delete(key); + return context; + }; + } + return BaseContext; +}()); +/** The root context is used as the default parent context when there is no active context */ +exports.ROOT_CONTEXT = new BaseContext(); +//# sourceMappingURL=context.js.map + +/***/ }), + +/***/ 6504: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=types.js.map + +/***/ }), + +/***/ 7978: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DiagComponentLogger = void 0; +var global_utils_1 = __nccwpck_require__(5135); +/** + * Component Logger which is meant to be used as part of any component which + * will add automatically additional namespace in front of the log message. + * It will then forward all message to global diag logger + * @example + * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' }); + * cLogger.debug('test'); + * // @opentelemetry/instrumentation-http test + */ +var DiagComponentLogger = /** @class */ (function () { + function DiagComponentLogger(props) { + this._namespace = props.namespace || 'DiagComponentLogger'; + } + DiagComponentLogger.prototype.debug = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return logProxy('debug', this._namespace, args); + }; + DiagComponentLogger.prototype.error = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return logProxy('error', this._namespace, args); + }; + DiagComponentLogger.prototype.info = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return logProxy('info', this._namespace, args); + }; + DiagComponentLogger.prototype.warn = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return logProxy('warn', this._namespace, args); + }; + DiagComponentLogger.prototype.verbose = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return logProxy('verbose', this._namespace, args); + }; + return DiagComponentLogger; +}()); +exports.DiagComponentLogger = DiagComponentLogger; +function logProxy(funcName, namespace, args) { + var logger = global_utils_1.getGlobal('diag'); + // shortcut if logger not set + if (!logger) { + return; + } + args.unshift(namespace); + return logger[funcName].apply(logger, args); +} +//# sourceMappingURL=ComponentLogger.js.map + +/***/ }), + +/***/ 3041: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DiagConsoleLogger = void 0; +var consoleMap = [ + { n: 'error', c: 'error' }, + { n: 'warn', c: 'warn' }, + { n: 'info', c: 'info' }, + { n: 'debug', c: 'debug' }, + { n: 'verbose', c: 'trace' }, +]; +/** + * A simple Immutable Console based diagnostic logger which will output any messages to the Console. + * If you want to limit the amount of logging to a specific level or lower use the + * {@link createLogLevelDiagLogger} + */ +var DiagConsoleLogger = /** @class */ (function () { + function DiagConsoleLogger() { + function _consoleFunc(funcName) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (console) { + // Some environments only expose the console when the F12 developer console is open + // eslint-disable-next-line no-console + var theFunc = console[funcName]; + if (typeof theFunc !== 'function') { + // Not all environments support all functions + // eslint-disable-next-line no-console + theFunc = console.log; + } + // One last final check + if (typeof theFunc === 'function') { + return theFunc.apply(console, args); + } + } + }; + } + for (var i = 0; i < consoleMap.length; i++) { + this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c); + } + } + return DiagConsoleLogger; +}()); +exports.DiagConsoleLogger = DiagConsoleLogger; +//# sourceMappingURL=consoleLogger.js.map + +/***/ }), + +/***/ 1634: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(3041), exports); +__exportStar(__nccwpck_require__(8077), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 9639: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createLogLevelDiagLogger = void 0; +var types_1 = __nccwpck_require__(8077); +function createLogLevelDiagLogger(maxLevel, logger) { + if (maxLevel < types_1.DiagLogLevel.NONE) { + maxLevel = types_1.DiagLogLevel.NONE; + } + else if (maxLevel > types_1.DiagLogLevel.ALL) { + maxLevel = types_1.DiagLogLevel.ALL; + } + // In case the logger is null or undefined + logger = logger || {}; + function _filterFunc(funcName, theLevel) { + var theFunc = logger[funcName]; + if (typeof theFunc === 'function' && maxLevel >= theLevel) { + return theFunc.bind(logger); + } return function () { }; } return { @@ -55237,1303 +56876,1303 @@ exports.parseURL = __nccwpck_require__(33).parseURL; /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; - -const punycode = __nccwpck_require__(5477); -const tr46 = __nccwpck_require__(2299); - -const specialSchemes = { - ftp: 21, - file: null, - gopher: 70, - http: 80, - https: 443, - ws: 80, - wss: 443 -}; - -const failure = Symbol("failure"); - -function countSymbols(str) { - return punycode.ucs2.decode(str).length; -} - -function at(input, idx) { - const c = input[idx]; - return isNaN(c) ? undefined : String.fromCodePoint(c); -} - -function isASCIIDigit(c) { - return c >= 0x30 && c <= 0x39; -} - -function isASCIIAlpha(c) { - return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A); -} - -function isASCIIAlphanumeric(c) { - return isASCIIAlpha(c) || isASCIIDigit(c); -} - -function isASCIIHex(c) { - return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66); -} - -function isSingleDot(buffer) { - return buffer === "." || buffer.toLowerCase() === "%2e"; -} - -function isDoubleDot(buffer) { - buffer = buffer.toLowerCase(); - return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; -} - -function isWindowsDriveLetterCodePoints(cp1, cp2) { - return isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124); -} - -function isWindowsDriveLetterString(string) { - return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|"); -} - -function isNormalizedWindowsDriveLetterString(string) { - return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && string[1] === ":"; -} - -function containsForbiddenHostCodePoint(string) { - return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1; -} - -function containsForbiddenHostCodePointExcludingPercent(string) { - return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1; -} - -function isSpecialScheme(scheme) { - return specialSchemes[scheme] !== undefined; -} - -function isSpecial(url) { - return isSpecialScheme(url.scheme); -} - -function defaultPort(scheme) { - return specialSchemes[scheme]; -} - -function percentEncode(c) { - let hex = c.toString(16).toUpperCase(); - if (hex.length === 1) { - hex = "0" + hex; - } - - return "%" + hex; -} - -function utf8PercentEncode(c) { - const buf = new Buffer(c); - - let str = ""; - - for (let i = 0; i < buf.length; ++i) { - str += percentEncode(buf[i]); - } - - return str; -} - -function utf8PercentDecode(str) { - const input = new Buffer(str); - const output = []; - for (let i = 0; i < input.length; ++i) { - if (input[i] !== 37) { - output.push(input[i]); - } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { - output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); - i += 2; - } else { - output.push(input[i]); - } - } - return new Buffer(output).toString(); -} - -function isC0ControlPercentEncode(c) { - return c <= 0x1F || c > 0x7E; -} - -const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); -function isPathPercentEncode(c) { - return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); -} - -const extraUserinfoPercentEncodeSet = - new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); -function isUserinfoPercentEncode(c) { - return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); -} - -function percentEncodeChar(c, encodeSetPredicate) { - const cStr = String.fromCodePoint(c); - - if (encodeSetPredicate(c)) { - return utf8PercentEncode(cStr); - } - - return cStr; -} - -function parseIPv4Number(input) { - let R = 10; - - if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { - input = input.substring(2); - R = 16; - } else if (input.length >= 2 && input.charAt(0) === "0") { - input = input.substring(1); - R = 8; - } - - if (input === "") { - return 0; - } - - const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); - if (regex.test(input)) { - return failure; - } - - return parseInt(input, R); -} - -function parseIPv4(input) { - const parts = input.split("."); - if (parts[parts.length - 1] === "") { - if (parts.length > 1) { - parts.pop(); - } - } - - if (parts.length > 4) { - return input; - } - - const numbers = []; - for (const part of parts) { - if (part === "") { - return input; - } - const n = parseIPv4Number(part); - if (n === failure) { - return input; - } - - numbers.push(n); - } - - for (let i = 0; i < numbers.length - 1; ++i) { - if (numbers[i] > 255) { - return failure; - } - } - if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { - return failure; - } - - let ipv4 = numbers.pop(); - let counter = 0; - - for (const n of numbers) { - ipv4 += n * Math.pow(256, 3 - counter); - ++counter; - } - - return ipv4; -} - -function serializeIPv4(address) { - let output = ""; - let n = address; - - for (let i = 1; i <= 4; ++i) { - output = String(n % 256) + output; - if (i !== 4) { - output = "." + output; - } - n = Math.floor(n / 256); - } - - return output; -} - -function parseIPv6(input) { - const address = [0, 0, 0, 0, 0, 0, 0, 0]; - let pieceIndex = 0; - let compress = null; - let pointer = 0; - - input = punycode.ucs2.decode(input); - - if (input[pointer] === 58) { - if (input[pointer + 1] !== 58) { - return failure; - } - - pointer += 2; - ++pieceIndex; - compress = pieceIndex; - } - - while (pointer < input.length) { - if (pieceIndex === 8) { - return failure; - } - - if (input[pointer] === 58) { - if (compress !== null) { - return failure; - } - ++pointer; - ++pieceIndex; - compress = pieceIndex; - continue; - } - - let value = 0; - let length = 0; - - while (length < 4 && isASCIIHex(input[pointer])) { - value = value * 0x10 + parseInt(at(input, pointer), 16); - ++pointer; - ++length; - } - - if (input[pointer] === 46) { - if (length === 0) { - return failure; - } - - pointer -= length; - - if (pieceIndex > 6) { - return failure; - } - - let numbersSeen = 0; - - while (input[pointer] !== undefined) { - let ipv4Piece = null; - - if (numbersSeen > 0) { - if (input[pointer] === 46 && numbersSeen < 4) { - ++pointer; - } else { - return failure; - } - } - - if (!isASCIIDigit(input[pointer])) { - return failure; - } - - while (isASCIIDigit(input[pointer])) { - const number = parseInt(at(input, pointer)); - if (ipv4Piece === null) { - ipv4Piece = number; - } else if (ipv4Piece === 0) { - return failure; - } else { - ipv4Piece = ipv4Piece * 10 + number; - } - if (ipv4Piece > 255) { - return failure; - } - ++pointer; - } - - address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; - - ++numbersSeen; - - if (numbersSeen === 2 || numbersSeen === 4) { - ++pieceIndex; - } - } - - if (numbersSeen !== 4) { - return failure; - } - - break; - } else if (input[pointer] === 58) { - ++pointer; - if (input[pointer] === undefined) { - return failure; - } - } else if (input[pointer] !== undefined) { - return failure; - } - - address[pieceIndex] = value; - ++pieceIndex; - } - - if (compress !== null) { - let swaps = pieceIndex - compress; - pieceIndex = 7; - while (pieceIndex !== 0 && swaps > 0) { - const temp = address[compress + swaps - 1]; - address[compress + swaps - 1] = address[pieceIndex]; - address[pieceIndex] = temp; - --pieceIndex; - --swaps; - } - } else if (compress === null && pieceIndex !== 8) { - return failure; - } - - return address; -} - -function serializeIPv6(address) { - let output = ""; - const seqResult = findLongestZeroSequence(address); - const compress = seqResult.idx; - let ignore0 = false; - - for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { - if (ignore0 && address[pieceIndex] === 0) { - continue; - } else if (ignore0) { - ignore0 = false; - } - - if (compress === pieceIndex) { - const separator = pieceIndex === 0 ? "::" : ":"; - output += separator; - ignore0 = true; - continue; - } - - output += address[pieceIndex].toString(16); - - if (pieceIndex !== 7) { - output += ":"; - } - } - - return output; -} - -function parseHost(input, isSpecialArg) { - if (input[0] === "[") { - if (input[input.length - 1] !== "]") { - return failure; - } - - return parseIPv6(input.substring(1, input.length - 1)); - } - - if (!isSpecialArg) { - return parseOpaqueHost(input); - } - - const domain = utf8PercentDecode(input); - const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); - if (asciiDomain === null) { - return failure; - } - - if (containsForbiddenHostCodePoint(asciiDomain)) { - return failure; - } - - const ipv4Host = parseIPv4(asciiDomain); - if (typeof ipv4Host === "number" || ipv4Host === failure) { - return ipv4Host; - } - - return asciiDomain; -} - -function parseOpaqueHost(input) { - if (containsForbiddenHostCodePointExcludingPercent(input)) { - return failure; - } - - let output = ""; - const decoded = punycode.ucs2.decode(input); - for (let i = 0; i < decoded.length; ++i) { - output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); - } - return output; -} - -function findLongestZeroSequence(arr) { - let maxIdx = null; - let maxLen = 1; // only find elements > 1 - let currStart = null; - let currLen = 0; - - for (let i = 0; i < arr.length; ++i) { - if (arr[i] !== 0) { - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } - - currStart = null; - currLen = 0; - } else { - if (currStart === null) { - currStart = i; - } - ++currLen; - } - } - - // if trailing zeros - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } - - return { - idx: maxIdx, - len: maxLen - }; -} - -function serializeHost(host) { - if (typeof host === "number") { - return serializeIPv4(host); - } - - // IPv6 serializer - if (host instanceof Array) { - return "[" + serializeIPv6(host) + "]"; - } - - return host; -} - -function trimControlChars(url) { - return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); -} - -function trimTabAndNewline(url) { - return url.replace(/\u0009|\u000A|\u000D/g, ""); -} - -function shortenPath(url) { - const path = url.path; - if (path.length === 0) { - return; - } - if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { - return; - } - - path.pop(); -} - -function includesCredentials(url) { - return url.username !== "" || url.password !== ""; -} - -function cannotHaveAUsernamePasswordPort(url) { - return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; -} - -function isNormalizedWindowsDriveLetter(string) { - return /^[A-Za-z]:$/.test(string); -} - -function URLStateMachine(input, base, encodingOverride, url, stateOverride) { - this.pointer = 0; - this.input = input; - this.base = base || null; - this.encodingOverride = encodingOverride || "utf-8"; - this.stateOverride = stateOverride; - this.url = url; - this.failure = false; - this.parseError = false; - - if (!this.url) { - this.url = { - scheme: "", - username: "", - password: "", - host: null, - port: null, - path: [], - query: null, - fragment: null, - - cannotBeABaseURL: false - }; - - const res = trimControlChars(this.input); - if (res !== this.input) { - this.parseError = true; - } - this.input = res; - } - - const res = trimTabAndNewline(this.input); - if (res !== this.input) { - this.parseError = true; - } - this.input = res; - - this.state = stateOverride || "scheme start"; - - this.buffer = ""; - this.atFlag = false; - this.arrFlag = false; - this.passwordTokenSeenFlag = false; - - this.input = punycode.ucs2.decode(this.input); - - for (; this.pointer <= this.input.length; ++this.pointer) { - const c = this.input[this.pointer]; - const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); - - // exec state machine - const ret = this["parse " + this.state](c, cStr); - if (!ret) { - break; // terminate algorithm - } else if (ret === failure) { - this.failure = true; - break; - } - } -} - -URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { - if (isASCIIAlpha(c)) { - this.buffer += cStr.toLowerCase(); - this.state = "scheme"; - } else if (!this.stateOverride) { - this.state = "no scheme"; - --this.pointer; - } else { - this.parseError = true; - return failure; - } - - return true; -}; - -URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { - if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { - this.buffer += cStr.toLowerCase(); - } else if (c === 58) { - if (this.stateOverride) { - if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { - return false; - } - - if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { - return false; - } - - if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { - return false; - } - - if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { - return false; - } - } - this.url.scheme = this.buffer; - this.buffer = ""; - if (this.stateOverride) { - return false; - } - if (this.url.scheme === "file") { - if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { - this.parseError = true; - } - this.state = "file"; - } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { - this.state = "special relative or authority"; - } else if (isSpecial(this.url)) { - this.state = "special authority slashes"; - } else if (this.input[this.pointer + 1] === 47) { - this.state = "path or authority"; - ++this.pointer; - } else { - this.url.cannotBeABaseURL = true; - this.url.path.push(""); - this.state = "cannot-be-a-base-URL path"; - } - } else if (!this.stateOverride) { - this.buffer = ""; - this.state = "no scheme"; - this.pointer = -1; - } else { - this.parseError = true; - return failure; - } - - return true; -}; - -URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { - if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { - return failure; - } else if (this.base.cannotBeABaseURL && c === 35) { - this.url.scheme = this.base.scheme; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.url.cannotBeABaseURL = true; - this.state = "fragment"; - } else if (this.base.scheme === "file") { - this.state = "file"; - --this.pointer; - } else { - this.state = "relative"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; - } else { - this.parseError = true; - this.state = "relative"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { - if (c === 47) { - this.state = "authority"; - } else { - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse relative"] = function parseRelative(c) { - this.url.scheme = this.base.scheme; - if (isNaN(c)) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 47) { - this.state = "relative slash"; - } else if (c === 63) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else if (isSpecial(this.url) && c === 92) { - this.parseError = true; - this.state = "relative slash"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(0, this.base.path.length - 1); - - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { - if (isSpecial(this.url) && (c === 47 || c === 92)) { - if (c === 92) { - this.parseError = true; - } - this.state = "special authority ignore slashes"; - } else if (c === 47) { - this.state = "authority"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; - } else { - this.parseError = true; - this.state = "special authority ignore slashes"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { - if (c !== 47 && c !== 92) { - this.state = "authority"; - --this.pointer; - } else { - this.parseError = true; - } - - return true; -}; - -URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { - if (c === 64) { - this.parseError = true; - if (this.atFlag) { - this.buffer = "%40" + this.buffer; - } - this.atFlag = true; - - // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars - const len = countSymbols(this.buffer); - for (let pointer = 0; pointer < len; ++pointer) { - const codePoint = this.buffer.codePointAt(pointer); - - if (codePoint === 58 && !this.passwordTokenSeenFlag) { - this.passwordTokenSeenFlag = true; - continue; - } - const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); - if (this.passwordTokenSeenFlag) { - this.url.password += encodedCodePoints; - } else { - this.url.username += encodedCodePoints; - } - } - this.buffer = ""; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - if (this.atFlag && this.buffer === "") { - this.parseError = true; - return failure; - } - this.pointer -= countSymbols(this.buffer) + 1; - this.buffer = ""; - this.state = "host"; - } else { - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse hostname"] = -URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { - if (this.stateOverride && this.url.scheme === "file") { - --this.pointer; - this.state = "file host"; - } else if (c === 58 && !this.arrFlag) { - if (this.buffer === "") { - this.parseError = true; - return failure; - } - - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - - this.url.host = host; - this.buffer = ""; - this.state = "port"; - if (this.stateOverride === "hostname") { - return false; - } - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - --this.pointer; - if (isSpecial(this.url) && this.buffer === "") { - this.parseError = true; - return failure; - } else if (this.stateOverride && this.buffer === "" && - (includesCredentials(this.url) || this.url.port !== null)) { - this.parseError = true; - return false; - } - - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - - this.url.host = host; - this.buffer = ""; - this.state = "path start"; - if (this.stateOverride) { - return false; - } - } else { - if (c === 91) { - this.arrFlag = true; - } else if (c === 93) { - this.arrFlag = false; - } - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { - if (isASCIIDigit(c)) { - this.buffer += cStr; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92) || - this.stateOverride) { - if (this.buffer !== "") { - const port = parseInt(this.buffer); - if (port > Math.pow(2, 16) - 1) { - this.parseError = true; - return failure; - } - this.url.port = port === defaultPort(this.url.scheme) ? null : port; - this.buffer = ""; - } - if (this.stateOverride) { - return false; - } - this.state = "path start"; - --this.pointer; - } else { - this.parseError = true; - return failure; - } - - return true; -}; - -const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); - -URLStateMachine.prototype["parse file"] = function parseFile(c) { - this.url.scheme = "file"; - - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file slash"; - } else if (this.base !== null && this.base.scheme === "file") { - if (isNaN(c)) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 63) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else { - if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points - !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || - (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points - !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - shortenPath(this.url); - } else { - this.parseError = true; - } - - this.state = "path"; - --this.pointer; - } - } else { - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file host"; - } else { - if (this.base !== null && this.base.scheme === "file") { - if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { - this.url.path.push(this.base.path[0]); - } else { - this.url.host = this.base.host; - } - } - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { - if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { - --this.pointer; - if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { - this.parseError = true; - this.state = "path"; - } else if (this.buffer === "") { - this.url.host = ""; - if (this.stateOverride) { - return false; - } - this.state = "path start"; - } else { - let host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - if (host === "localhost") { - host = ""; - } - this.url.host = host; - - if (this.stateOverride) { - return false; - } - - this.buffer = ""; - this.state = "path start"; - } - } else { - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { - if (isSpecial(this.url)) { - if (c === 92) { - this.parseError = true; - } - this.state = "path"; - - if (c !== 47 && c !== 92) { - --this.pointer; - } - } else if (!this.stateOverride && c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (!this.stateOverride && c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else if (c !== undefined) { - this.state = "path"; - if (c !== 47) { - --this.pointer; - } - } - - return true; -}; - -URLStateMachine.prototype["parse path"] = function parsePath(c) { - if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || - (!this.stateOverride && (c === 63 || c === 35))) { - if (isSpecial(this.url) && c === 92) { - this.parseError = true; - } - - if (isDoubleDot(this.buffer)) { - shortenPath(this.url); - if (c !== 47 && !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); - } - } else if (isSingleDot(this.buffer) && c !== 47 && - !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); - } else if (!isSingleDot(this.buffer)) { - if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { - if (this.url.host !== "" && this.url.host !== null) { - this.parseError = true; - this.url.host = ""; - } - this.buffer = this.buffer[0] + ":"; - } - this.url.path.push(this.buffer); - } - this.buffer = ""; - if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { - while (this.url.path.length > 1 && this.url.path[0] === "") { - this.parseError = true; - this.url.path.shift(); - } - } - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } - } else { - // TODO: If c is not a URL code point and not "%", parse error. - - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - this.buffer += percentEncodeChar(c, isPathPercentEncode); - } - - return true; -}; - -URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else { - // TODO: Add: not a URL code point - if (!isNaN(c) && c !== 37) { - this.parseError = true; - } - - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - if (!isNaN(c)) { - this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); - } - } - - return true; -}; - -URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { - if (isNaN(c) || (!this.stateOverride && c === 35)) { - if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { - this.encodingOverride = "utf-8"; - } - - const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead - for (let i = 0; i < buffer.length; ++i) { - if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || - buffer[i] === 0x3C || buffer[i] === 0x3E) { - this.url.query += percentEncode(buffer[i]); - } else { - this.url.query += String.fromCodePoint(buffer[i]); - } - } - - this.buffer = ""; - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { - if (isNaN(c)) { // do nothing - } else if (c === 0x0) { - this.parseError = true; - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); - } - - return true; -}; - -function serializeURL(url, excludeFragment) { - let output = url.scheme + ":"; - if (url.host !== null) { - output += "//"; - - if (url.username !== "" || url.password !== "") { - output += url.username; - if (url.password !== "") { - output += ":" + url.password; - } - output += "@"; - } - - output += serializeHost(url.host); - - if (url.port !== null) { - output += ":" + url.port; - } - } else if (url.host === null && url.scheme === "file") { - output += "//"; - } - - if (url.cannotBeABaseURL) { - output += url.path[0]; - } else { - for (const string of url.path) { - output += "/" + string; - } - } - - if (url.query !== null) { - output += "?" + url.query; - } - - if (!excludeFragment && url.fragment !== null) { - output += "#" + url.fragment; - } - - return output; -} - -function serializeOrigin(tuple) { - let result = tuple.scheme + "://"; - result += serializeHost(tuple.host); - - if (tuple.port !== null) { - result += ":" + tuple.port; - } - - return result; -} - -module.exports.serializeURL = serializeURL; - -module.exports.serializeURLOrigin = function (url) { - // https://url.spec.whatwg.org/#concept-url-origin - switch (url.scheme) { - case "blob": - try { - return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); - } catch (e) { - // serializing an opaque origin returns "null" - return "null"; - } - case "ftp": - case "gopher": - case "http": - case "https": - case "ws": - case "wss": - return serializeOrigin({ - scheme: url.scheme, - host: url.host, - port: url.port - }); - case "file": - // spec says "exercise to the reader", chrome says "file://" - return "file://"; - default: - // serializing an opaque origin returns "null" - return "null"; - } -}; - -module.exports.basicURLParse = function (input, options) { - if (options === undefined) { - options = {}; - } - - const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); - if (usm.failure) { - return "failure"; - } - - return usm.url; -}; - -module.exports.setTheUsername = function (url, username) { - url.username = ""; - const decoded = punycode.ucs2.decode(username); - for (let i = 0; i < decoded.length; ++i) { - url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); - } -}; - -module.exports.setThePassword = function (url, password) { - url.password = ""; - const decoded = punycode.ucs2.decode(password); - for (let i = 0; i < decoded.length; ++i) { - url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); - } -}; - -module.exports.serializeHost = serializeHost; - -module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; - -module.exports.serializeInteger = function (integer) { - return String(integer); -}; - -module.exports.parseURL = function (input, options) { - if (options === undefined) { - options = {}; - } - - // We don't handle blobs, so this just delegates: - return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); -}; + +const punycode = __nccwpck_require__(5477); +const tr46 = __nccwpck_require__(2299); + +const specialSchemes = { + ftp: 21, + file: null, + gopher: 70, + http: 80, + https: 443, + ws: 80, + wss: 443 +}; + +const failure = Symbol("failure"); + +function countSymbols(str) { + return punycode.ucs2.decode(str).length; +} + +function at(input, idx) { + const c = input[idx]; + return isNaN(c) ? undefined : String.fromCodePoint(c); +} + +function isASCIIDigit(c) { + return c >= 0x30 && c <= 0x39; +} + +function isASCIIAlpha(c) { + return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A); +} + +function isASCIIAlphanumeric(c) { + return isASCIIAlpha(c) || isASCIIDigit(c); +} + +function isASCIIHex(c) { + return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66); +} + +function isSingleDot(buffer) { + return buffer === "." || buffer.toLowerCase() === "%2e"; +} + +function isDoubleDot(buffer) { + buffer = buffer.toLowerCase(); + return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; +} + +function isWindowsDriveLetterCodePoints(cp1, cp2) { + return isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124); +} + +function isWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|"); +} + +function isNormalizedWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && string[1] === ":"; +} + +function containsForbiddenHostCodePoint(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function containsForbiddenHostCodePointExcludingPercent(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function isSpecialScheme(scheme) { + return specialSchemes[scheme] !== undefined; +} + +function isSpecial(url) { + return isSpecialScheme(url.scheme); +} + +function defaultPort(scheme) { + return specialSchemes[scheme]; +} + +function percentEncode(c) { + let hex = c.toString(16).toUpperCase(); + if (hex.length === 1) { + hex = "0" + hex; + } + + return "%" + hex; +} + +function utf8PercentEncode(c) { + const buf = new Buffer(c); + + let str = ""; + + for (let i = 0; i < buf.length; ++i) { + str += percentEncode(buf[i]); + } + + return str; +} + +function utf8PercentDecode(str) { + const input = new Buffer(str); + const output = []; + for (let i = 0; i < input.length; ++i) { + if (input[i] !== 37) { + output.push(input[i]); + } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { + output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); + i += 2; + } else { + output.push(input[i]); + } + } + return new Buffer(output).toString(); +} + +function isC0ControlPercentEncode(c) { + return c <= 0x1F || c > 0x7E; +} + +const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); +function isPathPercentEncode(c) { + return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); +} + +const extraUserinfoPercentEncodeSet = + new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); +function isUserinfoPercentEncode(c) { + return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); +} + +function percentEncodeChar(c, encodeSetPredicate) { + const cStr = String.fromCodePoint(c); + + if (encodeSetPredicate(c)) { + return utf8PercentEncode(cStr); + } + + return cStr; +} + +function parseIPv4Number(input) { + let R = 10; + + if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { + input = input.substring(2); + R = 16; + } else if (input.length >= 2 && input.charAt(0) === "0") { + input = input.substring(1); + R = 8; + } + + if (input === "") { + return 0; + } + + const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); + if (regex.test(input)) { + return failure; + } + + return parseInt(input, R); +} + +function parseIPv4(input) { + const parts = input.split("."); + if (parts[parts.length - 1] === "") { + if (parts.length > 1) { + parts.pop(); + } + } + + if (parts.length > 4) { + return input; + } + + const numbers = []; + for (const part of parts) { + if (part === "") { + return input; + } + const n = parseIPv4Number(part); + if (n === failure) { + return input; + } + + numbers.push(n); + } + + for (let i = 0; i < numbers.length - 1; ++i) { + if (numbers[i] > 255) { + return failure; + } + } + if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { + return failure; + } + + let ipv4 = numbers.pop(); + let counter = 0; + + for (const n of numbers) { + ipv4 += n * Math.pow(256, 3 - counter); + ++counter; + } + + return ipv4; +} + +function serializeIPv4(address) { + let output = ""; + let n = address; + + for (let i = 1; i <= 4; ++i) { + output = String(n % 256) + output; + if (i !== 4) { + output = "." + output; + } + n = Math.floor(n / 256); + } + + return output; +} + +function parseIPv6(input) { + const address = [0, 0, 0, 0, 0, 0, 0, 0]; + let pieceIndex = 0; + let compress = null; + let pointer = 0; + + input = punycode.ucs2.decode(input); + + if (input[pointer] === 58) { + if (input[pointer + 1] !== 58) { + return failure; + } + + pointer += 2; + ++pieceIndex; + compress = pieceIndex; + } + + while (pointer < input.length) { + if (pieceIndex === 8) { + return failure; + } + + if (input[pointer] === 58) { + if (compress !== null) { + return failure; + } + ++pointer; + ++pieceIndex; + compress = pieceIndex; + continue; + } + + let value = 0; + let length = 0; + + while (length < 4 && isASCIIHex(input[pointer])) { + value = value * 0x10 + parseInt(at(input, pointer), 16); + ++pointer; + ++length; + } + + if (input[pointer] === 46) { + if (length === 0) { + return failure; + } + + pointer -= length; + + if (pieceIndex > 6) { + return failure; + } + + let numbersSeen = 0; + + while (input[pointer] !== undefined) { + let ipv4Piece = null; + + if (numbersSeen > 0) { + if (input[pointer] === 46 && numbersSeen < 4) { + ++pointer; + } else { + return failure; + } + } + + if (!isASCIIDigit(input[pointer])) { + return failure; + } + + while (isASCIIDigit(input[pointer])) { + const number = parseInt(at(input, pointer)); + if (ipv4Piece === null) { + ipv4Piece = number; + } else if (ipv4Piece === 0) { + return failure; + } else { + ipv4Piece = ipv4Piece * 10 + number; + } + if (ipv4Piece > 255) { + return failure; + } + ++pointer; + } + + address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; + + ++numbersSeen; + + if (numbersSeen === 2 || numbersSeen === 4) { + ++pieceIndex; + } + } + + if (numbersSeen !== 4) { + return failure; + } + + break; + } else if (input[pointer] === 58) { + ++pointer; + if (input[pointer] === undefined) { + return failure; + } + } else if (input[pointer] !== undefined) { + return failure; + } + + address[pieceIndex] = value; + ++pieceIndex; + } + + if (compress !== null) { + let swaps = pieceIndex - compress; + pieceIndex = 7; + while (pieceIndex !== 0 && swaps > 0) { + const temp = address[compress + swaps - 1]; + address[compress + swaps - 1] = address[pieceIndex]; + address[pieceIndex] = temp; + --pieceIndex; + --swaps; + } + } else if (compress === null && pieceIndex !== 8) { + return failure; + } + + return address; +} + +function serializeIPv6(address) { + let output = ""; + const seqResult = findLongestZeroSequence(address); + const compress = seqResult.idx; + let ignore0 = false; + + for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { + if (ignore0 && address[pieceIndex] === 0) { + continue; + } else if (ignore0) { + ignore0 = false; + } + + if (compress === pieceIndex) { + const separator = pieceIndex === 0 ? "::" : ":"; + output += separator; + ignore0 = true; + continue; + } + + output += address[pieceIndex].toString(16); + + if (pieceIndex !== 7) { + output += ":"; + } + } + + return output; +} + +function parseHost(input, isSpecialArg) { + if (input[0] === "[") { + if (input[input.length - 1] !== "]") { + return failure; + } + + return parseIPv6(input.substring(1, input.length - 1)); + } + + if (!isSpecialArg) { + return parseOpaqueHost(input); + } + + const domain = utf8PercentDecode(input); + const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); + if (asciiDomain === null) { + return failure; + } + + if (containsForbiddenHostCodePoint(asciiDomain)) { + return failure; + } + + const ipv4Host = parseIPv4(asciiDomain); + if (typeof ipv4Host === "number" || ipv4Host === failure) { + return ipv4Host; + } + + return asciiDomain; +} + +function parseOpaqueHost(input) { + if (containsForbiddenHostCodePointExcludingPercent(input)) { + return failure; + } + + let output = ""; + const decoded = punycode.ucs2.decode(input); + for (let i = 0; i < decoded.length; ++i) { + output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); + } + return output; +} + +function findLongestZeroSequence(arr) { + let maxIdx = null; + let maxLen = 1; // only find elements > 1 + let currStart = null; + let currLen = 0; + + for (let i = 0; i < arr.length; ++i) { + if (arr[i] !== 0) { + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + currStart = null; + currLen = 0; + } else { + if (currStart === null) { + currStart = i; + } + ++currLen; + } + } + + // if trailing zeros + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + return { + idx: maxIdx, + len: maxLen + }; +} + +function serializeHost(host) { + if (typeof host === "number") { + return serializeIPv4(host); + } + + // IPv6 serializer + if (host instanceof Array) { + return "[" + serializeIPv6(host) + "]"; + } + + return host; +} + +function trimControlChars(url) { + return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); +} + +function trimTabAndNewline(url) { + return url.replace(/\u0009|\u000A|\u000D/g, ""); +} + +function shortenPath(url) { + const path = url.path; + if (path.length === 0) { + return; + } + if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { + return; + } + + path.pop(); +} + +function includesCredentials(url) { + return url.username !== "" || url.password !== ""; +} + +function cannotHaveAUsernamePasswordPort(url) { + return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; +} + +function isNormalizedWindowsDriveLetter(string) { + return /^[A-Za-z]:$/.test(string); +} + +function URLStateMachine(input, base, encodingOverride, url, stateOverride) { + this.pointer = 0; + this.input = input; + this.base = base || null; + this.encodingOverride = encodingOverride || "utf-8"; + this.stateOverride = stateOverride; + this.url = url; + this.failure = false; + this.parseError = false; + + if (!this.url) { + this.url = { + scheme: "", + username: "", + password: "", + host: null, + port: null, + path: [], + query: null, + fragment: null, + + cannotBeABaseURL: false + }; + + const res = trimControlChars(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + } + + const res = trimTabAndNewline(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + + this.state = stateOverride || "scheme start"; + + this.buffer = ""; + this.atFlag = false; + this.arrFlag = false; + this.passwordTokenSeenFlag = false; + + this.input = punycode.ucs2.decode(this.input); + + for (; this.pointer <= this.input.length; ++this.pointer) { + const c = this.input[this.pointer]; + const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); + + // exec state machine + const ret = this["parse " + this.state](c, cStr); + if (!ret) { + break; // terminate algorithm + } else if (ret === failure) { + this.failure = true; + break; + } + } +} + +URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { + if (isASCIIAlpha(c)) { + this.buffer += cStr.toLowerCase(); + this.state = "scheme"; + } else if (!this.stateOverride) { + this.state = "no scheme"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { + if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { + this.buffer += cStr.toLowerCase(); + } else if (c === 58) { + if (this.stateOverride) { + if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { + return false; + } + + if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { + return false; + } + + if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { + return false; + } + + if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { + return false; + } + } + this.url.scheme = this.buffer; + this.buffer = ""; + if (this.stateOverride) { + return false; + } + if (this.url.scheme === "file") { + if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { + this.parseError = true; + } + this.state = "file"; + } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { + this.state = "special relative or authority"; + } else if (isSpecial(this.url)) { + this.state = "special authority slashes"; + } else if (this.input[this.pointer + 1] === 47) { + this.state = "path or authority"; + ++this.pointer; + } else { + this.url.cannotBeABaseURL = true; + this.url.path.push(""); + this.state = "cannot-be-a-base-URL path"; + } + } else if (!this.stateOverride) { + this.buffer = ""; + this.state = "no scheme"; + this.pointer = -1; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { + if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { + return failure; + } else if (this.base.cannotBeABaseURL && c === 35) { + this.url.scheme = this.base.scheme; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.url.cannotBeABaseURL = true; + this.state = "fragment"; + } else if (this.base.scheme === "file") { + this.state = "file"; + --this.pointer; + } else { + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { + if (c === 47) { + this.state = "authority"; + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative"] = function parseRelative(c) { + this.url.scheme = this.base.scheme; + if (isNaN(c)) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 47) { + this.state = "relative slash"; + } else if (c === 63) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else if (isSpecial(this.url) && c === 92) { + this.parseError = true; + this.state = "relative slash"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(0, this.base.path.length - 1); + + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { + if (isSpecial(this.url) && (c === 47 || c === 92)) { + if (c === 92) { + this.parseError = true; + } + this.state = "special authority ignore slashes"; + } else if (c === 47) { + this.state = "authority"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "special authority ignore slashes"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { + if (c !== 47 && c !== 92) { + this.state = "authority"; + --this.pointer; + } else { + this.parseError = true; + } + + return true; +}; + +URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { + if (c === 64) { + this.parseError = true; + if (this.atFlag) { + this.buffer = "%40" + this.buffer; + } + this.atFlag = true; + + // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars + const len = countSymbols(this.buffer); + for (let pointer = 0; pointer < len; ++pointer) { + const codePoint = this.buffer.codePointAt(pointer); + + if (codePoint === 58 && !this.passwordTokenSeenFlag) { + this.passwordTokenSeenFlag = true; + continue; + } + const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); + if (this.passwordTokenSeenFlag) { + this.url.password += encodedCodePoints; + } else { + this.url.username += encodedCodePoints; + } + } + this.buffer = ""; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + if (this.atFlag && this.buffer === "") { + this.parseError = true; + return failure; + } + this.pointer -= countSymbols(this.buffer) + 1; + this.buffer = ""; + this.state = "host"; + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse hostname"] = +URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { + if (this.stateOverride && this.url.scheme === "file") { + --this.pointer; + this.state = "file host"; + } else if (c === 58 && !this.arrFlag) { + if (this.buffer === "") { + this.parseError = true; + return failure; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "port"; + if (this.stateOverride === "hostname") { + return false; + } + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + --this.pointer; + if (isSpecial(this.url) && this.buffer === "") { + this.parseError = true; + return failure; + } else if (this.stateOverride && this.buffer === "" && + (includesCredentials(this.url) || this.url.port !== null)) { + this.parseError = true; + return false; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "path start"; + if (this.stateOverride) { + return false; + } + } else { + if (c === 91) { + this.arrFlag = true; + } else if (c === 93) { + this.arrFlag = false; + } + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { + if (isASCIIDigit(c)) { + this.buffer += cStr; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92) || + this.stateOverride) { + if (this.buffer !== "") { + const port = parseInt(this.buffer); + if (port > Math.pow(2, 16) - 1) { + this.parseError = true; + return failure; + } + this.url.port = port === defaultPort(this.url.scheme) ? null : port; + this.buffer = ""; + } + if (this.stateOverride) { + return false; + } + this.state = "path start"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); + +URLStateMachine.prototype["parse file"] = function parseFile(c) { + this.url.scheme = "file"; + + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file slash"; + } else if (this.base !== null && this.base.scheme === "file") { + if (isNaN(c)) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 63) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else { + if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points + !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || + (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points + !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + shortenPath(this.url); + } else { + this.parseError = true; + } + + this.state = "path"; + --this.pointer; + } + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file host"; + } else { + if (this.base !== null && this.base.scheme === "file") { + if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { + this.url.path.push(this.base.path[0]); + } else { + this.url.host = this.base.host; + } + } + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { + if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { + --this.pointer; + if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { + this.parseError = true; + this.state = "path"; + } else if (this.buffer === "") { + this.url.host = ""; + if (this.stateOverride) { + return false; + } + this.state = "path start"; + } else { + let host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + if (host === "localhost") { + host = ""; + } + this.url.host = host; + + if (this.stateOverride) { + return false; + } + + this.buffer = ""; + this.state = "path start"; + } + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { + if (isSpecial(this.url)) { + if (c === 92) { + this.parseError = true; + } + this.state = "path"; + + if (c !== 47 && c !== 92) { + --this.pointer; + } + } else if (!this.stateOverride && c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (!this.stateOverride && c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else if (c !== undefined) { + this.state = "path"; + if (c !== 47) { + --this.pointer; + } + } + + return true; +}; + +URLStateMachine.prototype["parse path"] = function parsePath(c) { + if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || + (!this.stateOverride && (c === 63 || c === 35))) { + if (isSpecial(this.url) && c === 92) { + this.parseError = true; + } + + if (isDoubleDot(this.buffer)) { + shortenPath(this.url); + if (c !== 47 && !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } + } else if (isSingleDot(this.buffer) && c !== 47 && + !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } else if (!isSingleDot(this.buffer)) { + if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { + if (this.url.host !== "" && this.url.host !== null) { + this.parseError = true; + this.url.host = ""; + } + this.buffer = this.buffer[0] + ":"; + } + this.url.path.push(this.buffer); + } + this.buffer = ""; + if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { + while (this.url.path.length > 1 && this.url.path[0] === "") { + this.parseError = true; + this.url.path.shift(); + } + } + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += percentEncodeChar(c, isPathPercentEncode); + } + + return true; +}; + +URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else { + // TODO: Add: not a URL code point + if (!isNaN(c) && c !== 37) { + this.parseError = true; + } + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + if (!isNaN(c)) { + this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); + } + } + + return true; +}; + +URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { + if (isNaN(c) || (!this.stateOverride && c === 35)) { + if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { + this.encodingOverride = "utf-8"; + } + + const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead + for (let i = 0; i < buffer.length; ++i) { + if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || + buffer[i] === 0x3C || buffer[i] === 0x3E) { + this.url.query += percentEncode(buffer[i]); + } else { + this.url.query += String.fromCodePoint(buffer[i]); + } + } + + this.buffer = ""; + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { + if (isNaN(c)) { // do nothing + } else if (c === 0x0) { + this.parseError = true; + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); + } + + return true; +}; + +function serializeURL(url, excludeFragment) { + let output = url.scheme + ":"; + if (url.host !== null) { + output += "//"; + + if (url.username !== "" || url.password !== "") { + output += url.username; + if (url.password !== "") { + output += ":" + url.password; + } + output += "@"; + } + + output += serializeHost(url.host); + + if (url.port !== null) { + output += ":" + url.port; + } + } else if (url.host === null && url.scheme === "file") { + output += "//"; + } + + if (url.cannotBeABaseURL) { + output += url.path[0]; + } else { + for (const string of url.path) { + output += "/" + string; + } + } + + if (url.query !== null) { + output += "?" + url.query; + } + + if (!excludeFragment && url.fragment !== null) { + output += "#" + url.fragment; + } + + return output; +} + +function serializeOrigin(tuple) { + let result = tuple.scheme + "://"; + result += serializeHost(tuple.host); + + if (tuple.port !== null) { + result += ":" + tuple.port; + } + + return result; +} + +module.exports.serializeURL = serializeURL; + +module.exports.serializeURLOrigin = function (url) { + // https://url.spec.whatwg.org/#concept-url-origin + switch (url.scheme) { + case "blob": + try { + return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); + } catch (e) { + // serializing an opaque origin returns "null" + return "null"; + } + case "ftp": + case "gopher": + case "http": + case "https": + case "ws": + case "wss": + return serializeOrigin({ + scheme: url.scheme, + host: url.host, + port: url.port + }); + case "file": + // spec says "exercise to the reader", chrome says "file://" + return "file://"; + default: + // serializing an opaque origin returns "null" + return "null"; + } +}; + +module.exports.basicURLParse = function (input, options) { + if (options === undefined) { + options = {}; + } + + const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); + if (usm.failure) { + return "failure"; + } + + return usm.url; +}; + +module.exports.setTheUsername = function (url, username) { + url.username = ""; + const decoded = punycode.ucs2.decode(username); + for (let i = 0; i < decoded.length; ++i) { + url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.setThePassword = function (url, password) { + url.password = ""; + const decoded = punycode.ucs2.decode(password); + for (let i = 0; i < decoded.length; ++i) { + url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.serializeHost = serializeHost; + +module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; + +module.exports.serializeInteger = function (integer) { + return String(integer); +}; + +module.exports.parseURL = function (input, options) { + if (options === undefined) { + options = {}; + } + + // We don't handle blobs, so this just delegates: + return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); +}; /***/ }), @@ -58133,2761 +59772,24174 @@ module.exports.implForWrapper = function (wrapper) { } }()) } -})( false ? 0 : exports) +})( false ? 0 : exports) + + +/***/ }), + +/***/ 1532: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const ANY = Symbol('SemVer ANY') +// hoisted class for cyclic dependency +class Comparator { + static get ANY () { + return ANY + } + + constructor (comp, options) { + options = parseOptions(options) + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + comp = comp.trim().split(/\s+/).join(' ') + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) + } + + parse (comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + const m = comp.match(r) + + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`) + } + + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } + } + + toString () { + return this.value + } + + test (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY || version === ANY) { + return true + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + return cmp(version, this.operator, this.semver, this.options) + } + + intersects (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (this.operator === '') { + if (this.value === '') { + return true + } + return new Range(comp.value, options).test(this.value) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + return new Range(this.value, options).test(comp.semver) + } + + options = parseOptions(options) + + // Special cases where nothing can possibly be lower + if (options.includePrerelease && + (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) { + return false + } + if (!options.includePrerelease && + (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) { + return false + } + + // Same direction increasing (> or >=) + if (this.operator.startsWith('>') && comp.operator.startsWith('>')) { + return true + } + // Same direction decreasing (< or <=) + if (this.operator.startsWith('<') && comp.operator.startsWith('<')) { + return true + } + // same SemVer and both sides are inclusive (<= or >=) + if ( + (this.semver.version === comp.semver.version) && + this.operator.includes('=') && comp.operator.includes('=')) { + return true + } + // opposite directions less than + if (cmp(this.semver, '<', comp.semver, options) && + this.operator.startsWith('>') && comp.operator.startsWith('<')) { + return true + } + // opposite directions greater than + if (cmp(this.semver, '>', comp.semver, options) && + this.operator.startsWith('<') && comp.operator.startsWith('>')) { + return true + } + return false + } +} + +module.exports = Comparator + +const parseOptions = __nccwpck_require__(785) +const { safeRe: re, t } = __nccwpck_require__(9523) +const cmp = __nccwpck_require__(5098) +const debug = __nccwpck_require__(106) +const SemVer = __nccwpck_require__(8088) +const Range = __nccwpck_require__(9828) + + +/***/ }), + +/***/ 9828: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// hoisted class for cyclic dependency +class Range { + constructor (range, options) { + options = parseOptions(options) + + if (range instanceof Range) { + if ( + range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease + ) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + // just put it in the set and return + this.raw = range.value + this.set = [[range]] + this.format() + return this + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. + this.raw = range + .trim() + .split(/\s+/) + .join(' ') + + // First, split on || + this.set = this.raw + .split('||') + // map the range to a 2d array of comparators + .map(r => this.parseRange(r.trim())) + // throw out any comparator lists that are empty + // this generally means that it was not a valid range, which is allowed + // in loose mode, but will still throw if the WHOLE range is invalid. + .filter(c => c.length) + + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${this.raw}`) + } + + // if we have any that are not the null set, throw out null sets. + if (this.set.length > 1) { + // keep the first one, in case they're all null sets + const first = this.set[0] + this.set = this.set.filter(c => !isNullSet(c[0])) + if (this.set.length === 0) { + this.set = [first] + } else if (this.set.length > 1) { + // if we have any that are *, then the range is just * + for (const c of this.set) { + if (c.length === 1 && isAny(c[0])) { + this.set = [c] + break + } + } + } + } + + this.format() + } + + format () { + this.range = this.set + .map((comps) => comps.join(' ').trim()) + .join('||') + .trim() + return this.range + } + + toString () { + return this.range + } + + parseRange (range) { + // memoize range parsing for performance. + // this is a very hot path, and fully deterministic. + const memoOpts = + (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | + (this.options.loose && FLAG_LOOSE) + const memoKey = memoOpts + ':' + range + const cached = cache.get(memoKey) + if (cached) { + return cached + } + + const loose = this.options.loose + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) + debug('hyphen replace', range) + + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + debug('tilde trim', range) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[t.CARETTRIM], caretTrimReplace) + debug('caret trim', range) + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + let rangeList = range + .split(' ') + .map(comp => parseComparator(comp, this.options)) + .join(' ') + .split(/\s+/) + // >=0.0.0 is equivalent to * + .map(comp => replaceGTE0(comp, this.options)) + + if (loose) { + // in loose mode, throw out any that are not valid comparators + rangeList = rangeList.filter(comp => { + debug('loose invalid filter', comp, this.options) + return !!comp.match(re[t.COMPARATORLOOSE]) + }) + } + debug('range list', rangeList) + + // if any comparators are the null set, then replace with JUST null set + // if more than one comparator, remove any * comparators + // also, don't include the same comparator more than once + const rangeMap = new Map() + const comparators = rangeList.map(comp => new Comparator(comp, this.options)) + for (const comp of comparators) { + if (isNullSet(comp)) { + return [comp] + } + rangeMap.set(comp.value, comp) + } + if (rangeMap.size > 1 && rangeMap.has('')) { + rangeMap.delete('') + } + + const result = [...rangeMap.values()] + cache.set(memoKey, result) + return result + } + + intersects (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some((thisComparators) => { + return ( + isSatisfiable(thisComparators, options) && + range.set.some((rangeComparators) => { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) + } + + // if ANY of the sets match ALL of its comparators, then pass + test (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false + } +} + +module.exports = Range + +const LRU = __nccwpck_require__(7129) +const cache = new LRU({ max: 1000 }) + +const parseOptions = __nccwpck_require__(785) +const Comparator = __nccwpck_require__(1532) +const debug = __nccwpck_require__(106) +const SemVer = __nccwpck_require__(8088) +const { + safeRe: re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace, +} = __nccwpck_require__(9523) +const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = __nccwpck_require__(2293) + +const isNullSet = c => c.value === '<0.0.0-0' +const isAny = c => c.value === '' + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +const isSatisfiable = (comparators, options) => { + let result = true + const remainingComparators = comparators.slice() + let testComparator = remainingComparators.pop() + + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options) + }) + + testComparator = remainingComparators.pop() + } + + return result +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +const parseComparator = (comp, options) => { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +const isX = id => !id || id.toLowerCase() === 'x' || id === '*' + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 +// ~0.0.1 --> >=0.0.1 <0.1.0-0 +const replaceTildes = (comp, options) => { + return comp + .trim() + .split(/\s+/) + .map((c) => replaceTilde(c, options)) + .join(' ') +} + +const replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + return comp.replace(r, (_, M, m, p, pr) => { + debug('tilde', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0` + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0-0 + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` + } else if (pr) { + debug('replaceTilde pr', pr) + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } else { + // ~1.2.3 == >=1.2.3 <1.3.0-0 + ret = `>=${M}.${m}.${p + } <${M}.${+m + 1}.0-0` + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 +// ^1.2.3 --> >=1.2.3 <2.0.0-0 +// ^1.2.0 --> >=1.2.0 <2.0.0-0 +// ^0.0.1 --> >=0.0.1 <0.0.2-0 +// ^0.1.0 --> >=0.1.0 <0.2.0-0 +const replaceCarets = (comp, options) => { + return comp + .trim() + .split(/\s+/) + .map((c) => replaceCaret(c, options)) + .join(' ') +} + +const replaceCaret = (comp, options) => { + debug('caret', comp, options) + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + const z = options.includePrerelease ? '-0' : '' + return comp.replace(r, (_, M, m, p, pr) => { + debug('caret', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` + } else if (isX(p)) { + if (M === '0') { + ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` + } else { + ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${+M + 1}.0.0-0` + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p + }${z} <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p + }${z} <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p + } <${+M + 1}.0.0-0` + } + } + + debug('caret return', ret) + return ret + }) +} + +const replaceXRanges = (comp, options) => { + debug('replaceXRanges', comp, options) + return comp + .split(/\s+/) + .map((c) => replaceXRange(c, options)) + .join(' ') +} + +const replaceXRange = (comp, options) => { + comp = comp.trim() + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + const xM = isX(M) + const xm = xM || isX(m) + const xp = xm || isX(p) + const anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + if (gtlt === '<') { + pr = '-0' + } + + ret = `${gtlt + M}.${m}.${p}${pr}` + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` + } else if (xp) { + ret = `>=${M}.${m}.0${pr + } <${M}.${+m + 1}.0-0` + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +const replaceStars = (comp, options) => { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp + .trim() + .replace(re[t.STAR], '') +} + +const replaceGTE0 = (comp, options) => { + debug('replaceGTE0', comp, options) + return comp + .trim() + .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') +} + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 +const hyphenReplace = incPr => ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) => { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? '-0' : ''}` + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` + } else if (fpr) { + from = `>=${from}` + } else { + from = `>=${from}${incPr ? '-0' : ''}` + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0` + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0` + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}` + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0` + } else { + to = `<=${to}` + } + + return `${from} ${to}`.trim() +} + +const testSet = (set, version, options) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (let i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === Comparator.ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} + + +/***/ }), + +/***/ 8088: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const debug = __nccwpck_require__(106) +const { MAX_LENGTH, MAX_SAFE_INTEGER } = __nccwpck_require__(2293) +const { safeRe: re, t } = __nccwpck_require__(9523) + +const parseOptions = __nccwpck_require__(785) +const { compareIdentifiers } = __nccwpck_require__(2463) +class SemVer { + constructor (version, options) { + options = parseOptions(options) + + if (version instanceof SemVer) { + if (version.loose === !!options.loose && + version.includePrerelease === !!options.includePrerelease) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError( + `version is longer than ${MAX_LENGTH} characters` + ) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + // this isn't actually relevant for versions, but keep it so that we + // don't run into trouble passing this.options around. + this.includePrerelease = !!options.includePrerelease + + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + + if (!m) { + throw new TypeError(`Invalid Version: ${version}`) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() + } + + format () { + this.version = `${this.major}.${this.minor}.${this.patch}` + if (this.prerelease.length) { + this.version += `-${this.prerelease.join('.')}` + } + return this.version + } + + toString () { + return this.version + } + + compare (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + if (typeof other === 'string' && other === this.version) { + return 0 + } + other = new SemVer(other, this.options) + } + + if (other.version === this.version) { + return 0 + } + + return this.compareMain(other) || this.comparePre(other) + } + + compareMain (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return ( + compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) + ) + } + + comparePre (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + let i = 0 + do { + const a = this.prerelease[i] + const b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + compareBuild (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + let i = 0 + do { + const a = this.build[i] + const b = other.build[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc (release, identifier, identifierBase) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier, identifierBase) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier, identifierBase) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier, identifierBase) + this.inc('pre', identifier, identifierBase) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier, identifierBase) + } + this.inc('pre', identifier, identifierBase) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if ( + this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0 + ) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. + case 'pre': { + const base = Number(identifierBase) ? 1 : 0 + + if (!identifier && identifierBase === false) { + throw new Error('invalid increment argument: identifier is empty') + } + + if (this.prerelease.length === 0) { + this.prerelease = [base] + } else { + let i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + if (identifier === this.prerelease.join('.') && identifierBase === false) { + throw new Error('invalid increment argument: identifier already exists') + } + this.prerelease.push(base) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + let prerelease = [identifier, base] + if (identifierBase === false) { + prerelease = [identifier] + } + if (compareIdentifiers(this.prerelease[0], identifier) === 0) { + if (isNaN(this.prerelease[1])) { + this.prerelease = prerelease + } + } else { + this.prerelease = prerelease + } + } + break + } + default: + throw new Error(`invalid increment argument: ${release}`) + } + this.raw = this.format() + if (this.build.length) { + this.raw += `+${this.build.join('.')}` + } + return this + } +} + +module.exports = SemVer + + +/***/ }), + +/***/ 8848: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const parse = __nccwpck_require__(5925) +const clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} +module.exports = clean + + +/***/ }), + +/***/ 5098: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const eq = __nccwpck_require__(1898) +const neq = __nccwpck_require__(6017) +const gt = __nccwpck_require__(4123) +const gte = __nccwpck_require__(5522) +const lt = __nccwpck_require__(194) +const lte = __nccwpck_require__(7520) + +const cmp = (a, op, b, loose) => { + switch (op) { + case '===': + if (typeof a === 'object') { + a = a.version + } + if (typeof b === 'object') { + b = b.version + } + return a === b + + case '!==': + if (typeof a === 'object') { + a = a.version + } + if (typeof b === 'object') { + b = b.version + } + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError(`Invalid operator: ${op}`) + } +} +module.exports = cmp + + +/***/ }), + +/***/ 3466: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const SemVer = __nccwpck_require__(8088) +const parse = __nccwpck_require__(5925) +const { safeRe: re, t } = __nccwpck_require__(9523) + +const coerce = (version, options) => { + if (version instanceof SemVer) { + return version + } + + if (typeof version === 'number') { + version = String(version) + } + + if (typeof version !== 'string') { + return null + } + + options = options || {} + + let match = null + if (!options.rtl) { + match = version.match(re[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + let next + while ((next = re[t.COERCERTL].exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + re[t.COERCERTL].lastIndex = -1 + } + + if (match === null) { + return null + } + + return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options) +} +module.exports = coerce + + +/***/ }), + +/***/ 2156: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const SemVer = __nccwpck_require__(8088) +const compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose) + const versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} +module.exports = compareBuild + + +/***/ }), + +/***/ 2804: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const compare = __nccwpck_require__(4309) +const compareLoose = (a, b) => compare(a, b, true) +module.exports = compareLoose + + +/***/ }), + +/***/ 4309: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const SemVer = __nccwpck_require__(8088) +const compare = (a, b, loose) => + new SemVer(a, loose).compare(new SemVer(b, loose)) + +module.exports = compare + + +/***/ }), + +/***/ 4297: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const parse = __nccwpck_require__(5925) + +const diff = (version1, version2) => { + const v1 = parse(version1, null, true) + const v2 = parse(version2, null, true) + const comparison = v1.compare(v2) + + if (comparison === 0) { + return null + } + + const v1Higher = comparison > 0 + const highVersion = v1Higher ? v1 : v2 + const lowVersion = v1Higher ? v2 : v1 + const highHasPre = !!highVersion.prerelease.length + const lowHasPre = !!lowVersion.prerelease.length + + if (lowHasPre && !highHasPre) { + // Going from prerelease -> no prerelease requires some special casing + + // If the low version has only a major, then it will always be a major + // Some examples: + // 1.0.0-1 -> 1.0.0 + // 1.0.0-1 -> 1.1.1 + // 1.0.0-1 -> 2.0.0 + if (!lowVersion.patch && !lowVersion.minor) { + return 'major' + } + + // Otherwise it can be determined by checking the high version + + if (highVersion.patch) { + // anything higher than a patch bump would result in the wrong version + return 'patch' + } + + if (highVersion.minor) { + // anything higher than a minor bump would result in the wrong version + return 'minor' + } + + // bumping major/minor/patch all have same result + return 'major' + } + + // add the `pre` prefix if we are going to a prerelease version + const prefix = highHasPre ? 'pre' : '' + + if (v1.major !== v2.major) { + return prefix + 'major' + } + + if (v1.minor !== v2.minor) { + return prefix + 'minor' + } + + if (v1.patch !== v2.patch) { + return prefix + 'patch' + } + + // high and low are preleases + return 'prerelease' +} + +module.exports = diff + + +/***/ }), + +/***/ 1898: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const compare = __nccwpck_require__(4309) +const eq = (a, b, loose) => compare(a, b, loose) === 0 +module.exports = eq + + +/***/ }), + +/***/ 4123: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const compare = __nccwpck_require__(4309) +const gt = (a, b, loose) => compare(a, b, loose) > 0 +module.exports = gt + + +/***/ }), + +/***/ 5522: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const compare = __nccwpck_require__(4309) +const gte = (a, b, loose) => compare(a, b, loose) >= 0 +module.exports = gte + + +/***/ }), + +/***/ 900: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const SemVer = __nccwpck_require__(8088) + +const inc = (version, release, options, identifier, identifierBase) => { + if (typeof (options) === 'string') { + identifierBase = identifier + identifier = options + options = undefined + } + + try { + return new SemVer( + version instanceof SemVer ? version.version : version, + options + ).inc(release, identifier, identifierBase).version + } catch (er) { + return null + } +} +module.exports = inc + + +/***/ }), + +/***/ 194: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const compare = __nccwpck_require__(4309) +const lt = (a, b, loose) => compare(a, b, loose) < 0 +module.exports = lt + + +/***/ }), + +/***/ 7520: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const compare = __nccwpck_require__(4309) +const lte = (a, b, loose) => compare(a, b, loose) <= 0 +module.exports = lte + + +/***/ }), + +/***/ 6688: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const SemVer = __nccwpck_require__(8088) +const major = (a, loose) => new SemVer(a, loose).major +module.exports = major + + +/***/ }), + +/***/ 8447: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const SemVer = __nccwpck_require__(8088) +const minor = (a, loose) => new SemVer(a, loose).minor +module.exports = minor + + +/***/ }), + +/***/ 6017: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const compare = __nccwpck_require__(4309) +const neq = (a, b, loose) => compare(a, b, loose) !== 0 +module.exports = neq + + +/***/ }), + +/***/ 5925: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const SemVer = __nccwpck_require__(8088) +const parse = (version, options, throwErrors = false) => { + if (version instanceof SemVer) { + return version + } + try { + return new SemVer(version, options) + } catch (er) { + if (!throwErrors) { + return null + } + throw er + } +} + +module.exports = parse + + +/***/ }), + +/***/ 2866: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const SemVer = __nccwpck_require__(8088) +const patch = (a, loose) => new SemVer(a, loose).patch +module.exports = patch + + +/***/ }), + +/***/ 4016: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const parse = __nccwpck_require__(5925) +const prerelease = (version, options) => { + const parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} +module.exports = prerelease + + +/***/ }), + +/***/ 6417: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const compare = __nccwpck_require__(4309) +const rcompare = (a, b, loose) => compare(b, a, loose) +module.exports = rcompare + + +/***/ }), + +/***/ 8701: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const compareBuild = __nccwpck_require__(2156) +const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) +module.exports = rsort + + +/***/ }), + +/***/ 6055: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const Range = __nccwpck_require__(9828) +const satisfies = (version, range, options) => { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} +module.exports = satisfies + + +/***/ }), + +/***/ 1426: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const compareBuild = __nccwpck_require__(2156) +const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) +module.exports = sort + + +/***/ }), + +/***/ 9601: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const parse = __nccwpck_require__(5925) +const valid = (version, options) => { + const v = parse(version, options) + return v ? v.version : null +} +module.exports = valid + + +/***/ }), + +/***/ 1383: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// just pre-load all the stuff that index.js lazily exports +const internalRe = __nccwpck_require__(9523) +const constants = __nccwpck_require__(2293) +const SemVer = __nccwpck_require__(8088) +const identifiers = __nccwpck_require__(2463) +const parse = __nccwpck_require__(5925) +const valid = __nccwpck_require__(9601) +const clean = __nccwpck_require__(8848) +const inc = __nccwpck_require__(900) +const diff = __nccwpck_require__(4297) +const major = __nccwpck_require__(6688) +const minor = __nccwpck_require__(8447) +const patch = __nccwpck_require__(2866) +const prerelease = __nccwpck_require__(4016) +const compare = __nccwpck_require__(4309) +const rcompare = __nccwpck_require__(6417) +const compareLoose = __nccwpck_require__(2804) +const compareBuild = __nccwpck_require__(2156) +const sort = __nccwpck_require__(1426) +const rsort = __nccwpck_require__(8701) +const gt = __nccwpck_require__(4123) +const lt = __nccwpck_require__(194) +const eq = __nccwpck_require__(1898) +const neq = __nccwpck_require__(6017) +const gte = __nccwpck_require__(5522) +const lte = __nccwpck_require__(7520) +const cmp = __nccwpck_require__(5098) +const coerce = __nccwpck_require__(3466) +const Comparator = __nccwpck_require__(1532) +const Range = __nccwpck_require__(9828) +const satisfies = __nccwpck_require__(6055) +const toComparators = __nccwpck_require__(2706) +const maxSatisfying = __nccwpck_require__(579) +const minSatisfying = __nccwpck_require__(832) +const minVersion = __nccwpck_require__(4179) +const validRange = __nccwpck_require__(2098) +const outside = __nccwpck_require__(420) +const gtr = __nccwpck_require__(9380) +const ltr = __nccwpck_require__(3323) +const intersects = __nccwpck_require__(7008) +const simplifyRange = __nccwpck_require__(5297) +const subset = __nccwpck_require__(7863) +module.exports = { + parse, + valid, + clean, + inc, + diff, + major, + minor, + patch, + prerelease, + compare, + rcompare, + compareLoose, + compareBuild, + sort, + rsort, + gt, + lt, + eq, + neq, + gte, + lte, + cmp, + coerce, + Comparator, + Range, + satisfies, + toComparators, + maxSatisfying, + minSatisfying, + minVersion, + validRange, + outside, + gtr, + ltr, + intersects, + simplifyRange, + subset, + SemVer, + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, + RELEASE_TYPES: constants.RELEASE_TYPES, + compareIdentifiers: identifiers.compareIdentifiers, + rcompareIdentifiers: identifiers.rcompareIdentifiers, +} + + +/***/ }), + +/***/ 2293: +/***/ ((module) => { + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +const SEMVER_SPEC_VERSION = '2.0.0' + +const MAX_LENGTH = 256 +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || +/* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +const MAX_SAFE_COMPONENT_LENGTH = 16 + +// Max safe length for a build identifier. The max length minus 6 characters for +// the shortest version with a build 0.0.0+BUILD. +const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + +const RELEASE_TYPES = [ + 'major', + 'premajor', + 'minor', + 'preminor', + 'patch', + 'prepatch', + 'prerelease', +] + +module.exports = { + MAX_LENGTH, + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_SAFE_INTEGER, + RELEASE_TYPES, + SEMVER_SPEC_VERSION, + FLAG_INCLUDE_PRERELEASE: 0b001, + FLAG_LOOSE: 0b010, +} + + +/***/ }), + +/***/ 106: +/***/ ((module) => { + +const debug = ( + typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG) +) ? (...args) => console.error('SEMVER', ...args) + : () => {} + +module.exports = debug + + +/***/ }), + +/***/ 2463: +/***/ ((module) => { + +const numeric = /^[0-9]+$/ +const compareIdentifiers = (a, b) => { + const anum = numeric.test(a) + const bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) + +module.exports = { + compareIdentifiers, + rcompareIdentifiers, +} + + +/***/ }), + +/***/ 785: +/***/ ((module) => { + +// parse out just the options we care about +const looseOption = Object.freeze({ loose: true }) +const emptyOpts = Object.freeze({ }) +const parseOptions = options => { + if (!options) { + return emptyOpts + } + + if (typeof options !== 'object') { + return looseOption + } + + return options +} +module.exports = parseOptions + + +/***/ }), + +/***/ 9523: +/***/ ((module, exports, __nccwpck_require__) => { + +const { + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_LENGTH, +} = __nccwpck_require__(2293) +const debug = __nccwpck_require__(106) +exports = module.exports = {} + +// The actual regexps go on exports.re +const re = exports.re = [] +const safeRe = exports.safeRe = [] +const src = exports.src = [] +const t = exports.t = {} +let R = 0 + +const LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +const safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +const makeSafeRegex = (value) => { + for (const [token, max] of safeRegexReplacements) { + value = value + .split(`${token}*`).join(`${token}{0,${max}}`) + .split(`${token}+`).join(`${token}{1,${max}}`) + } + return value +} + +const createToken = (name, value, isGlobal) => { + const safe = makeSafeRegex(value) + const index = R++ + debug(name, index, value) + t[name] = index + src[index] = value + re[index] = new RegExp(value, isGlobal ? 'g' : undefined) + safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined) +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') +createToken('NUMERICIDENTIFIERLOOSE', '\\d+') + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`) + +// ## Main Version +// Three dot-separated numeric identifiers. + +createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})`) + +createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})`) + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] +}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) + +createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] +}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`) + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] +}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +createToken('FULLPLAIN', `v?${src[t.MAINVERSION] +}${src[t.PRERELEASE]}?${ + src[t.BUILD]}?`) + +createToken('FULL', `^${src[t.FULLPLAIN]}$`) + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] +}${src[t.PRERELEASELOOSE]}?${ + src[t.BUILD]}?`) + +createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) + +createToken('GTLT', '((?:<|>)?=?)') + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) +createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) + +createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:${src[t.PRERELEASE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:${src[t.PRERELEASELOOSE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) +createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +createToken('COERCE', `${'(^|[^\\d])' + + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:$|[^\\d])`) +createToken('COERCERTL', src[t.COERCE], true) + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +createToken('LONETILDE', '(?:~>?)') + +createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) +exports.tildeTrimReplace = '$1~' + +createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) +createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +createToken('LONECARET', '(?:\\^)') + +createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) +exports.caretTrimReplace = '$1^' + +createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) +createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) +createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] +}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) +exports.comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAIN]})` + + `\\s*$`) + +createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAINLOOSE]})` + + `\\s*$`) + +// Star ranges basically just allow anything at all. +createToken('STAR', '(<|>)?=?\\s*\\*') +// >=0.0.0 is like a star +createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$') +createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$') + + +/***/ }), + +/***/ 9380: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// Determine if version is greater than all the versions possible in the range. +const outside = __nccwpck_require__(420) +const gtr = (version, range, options) => outside(version, range, '>', options) +module.exports = gtr + + +/***/ }), + +/***/ 7008: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const Range = __nccwpck_require__(9828) +const intersects = (r1, r2, options) => { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2, options) +} +module.exports = intersects + + +/***/ }), + +/***/ 3323: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const outside = __nccwpck_require__(420) +// Determine if version is less than all the versions possible in the range +const ltr = (version, range, options) => outside(version, range, '<', options) +module.exports = ltr + + +/***/ }), + +/***/ 579: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const SemVer = __nccwpck_require__(8088) +const Range = __nccwpck_require__(9828) + +const maxSatisfying = (versions, range, options) => { + let max = null + let maxSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} +module.exports = maxSatisfying + + +/***/ }), + +/***/ 832: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const SemVer = __nccwpck_require__(8088) +const Range = __nccwpck_require__(9828) +const minSatisfying = (versions, range, options) => { + let min = null + let minSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} +module.exports = minSatisfying + + +/***/ }), + +/***/ 4179: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const SemVer = __nccwpck_require__(8088) +const Range = __nccwpck_require__(9828) +const gt = __nccwpck_require__(4123) + +const minVersion = (range, loose) => { + range = new Range(range, loose) + + let minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let setMin = null + comparators.forEach((comparator) => { + // Clone to avoid manipulating the comparator's semver object. + const compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!setMin || gt(compver, setMin)) { + setMin = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error(`Unexpected operation: ${comparator.operator}`) + } + }) + if (setMin && (!minver || gt(minver, setMin))) { + minver = setMin + } + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} +module.exports = minVersion + + +/***/ }), + +/***/ 420: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const SemVer = __nccwpck_require__(8088) +const Comparator = __nccwpck_require__(1532) +const { ANY } = Comparator +const Range = __nccwpck_require__(9828) +const satisfies = __nccwpck_require__(6055) +const gt = __nccwpck_require__(4123) +const lt = __nccwpck_require__(194) +const lte = __nccwpck_require__(7520) +const gte = __nccwpck_require__(5522) + +const outside = (version, range, hilo, options) => { + version = new SemVer(version, options) + range = new Range(range, options) + + let gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisfies the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let high = null + let low = null + + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +module.exports = outside + + +/***/ }), + +/***/ 5297: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// given a set of versions and a range, create a "simplified" range +// that includes the same versions that the original range does +// If the original range is shorter than the simplified one, return that. +const satisfies = __nccwpck_require__(6055) +const compare = __nccwpck_require__(4309) +module.exports = (versions, range, options) => { + const set = [] + let first = null + let prev = null + const v = versions.sort((a, b) => compare(a, b, options)) + for (const version of v) { + const included = satisfies(version, range, options) + if (included) { + prev = version + if (!first) { + first = version + } + } else { + if (prev) { + set.push([first, prev]) + } + prev = null + first = null + } + } + if (first) { + set.push([first, null]) + } + + const ranges = [] + for (const [min, max] of set) { + if (min === max) { + ranges.push(min) + } else if (!max && min === v[0]) { + ranges.push('*') + } else if (!max) { + ranges.push(`>=${min}`) + } else if (min === v[0]) { + ranges.push(`<=${max}`) + } else { + ranges.push(`${min} - ${max}`) + } + } + const simplified = ranges.join(' || ') + const original = typeof range.raw === 'string' ? range.raw : String(range) + return simplified.length < original.length ? simplified : range +} + + +/***/ }), + +/***/ 7863: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const Range = __nccwpck_require__(9828) +const Comparator = __nccwpck_require__(1532) +const { ANY } = Comparator +const satisfies = __nccwpck_require__(6055) +const compare = __nccwpck_require__(4309) + +// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: +// - Every simple range `r1, r2, ...` is a null set, OR +// - Every simple range `r1, r2, ...` which is not a null set is a subset of +// some `R1, R2, ...` +// +// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: +// - If c is only the ANY comparator +// - If C is only the ANY comparator, return true +// - Else if in prerelease mode, return false +// - else replace c with `[>=0.0.0]` +// - If C is only the ANY comparator +// - if in prerelease mode, return true +// - else replace C with `[>=0.0.0]` +// - Let EQ be the set of = comparators in c +// - If EQ is more than one, return true (null set) +// - Let GT be the highest > or >= comparator in c +// - Let LT be the lowest < or <= comparator in c +// - If GT and LT, and GT.semver > LT.semver, return true (null set) +// - If any C is a = range, and GT or LT are set, return false +// - If EQ +// - If GT, and EQ does not satisfy GT, return true (null set) +// - If LT, and EQ does not satisfy LT, return true (null set) +// - If EQ satisfies every C, return true +// - Else return false +// - If GT +// - If GT.semver is lower than any > or >= comp in C, return false +// - If GT is >=, and GT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the GT.semver tuple, return false +// - If LT +// - If LT.semver is greater than any < or <= comp in C, return false +// - If LT is <=, and LT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the LT.semver tuple, return false +// - Else return true + +const subset = (sub, dom, options = {}) => { + if (sub === dom) { + return true + } + + sub = new Range(sub, options) + dom = new Range(dom, options) + let sawNonNull = false + + OUTER: for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options) + sawNonNull = sawNonNull || isSub !== null + if (isSub) { + continue OUTER + } + } + // the null set is a subset of everything, but null simple ranges in + // a complex range should be ignored. so if we saw a non-null range, + // then we know this isn't a subset, but if EVERY simple range was null, + // then it is a subset. + if (sawNonNull) { + return false + } + } + return true +} + +const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')] +const minimumVersion = [new Comparator('>=0.0.0')] + +const simpleSubset = (sub, dom, options) => { + if (sub === dom) { + return true + } + + if (sub.length === 1 && sub[0].semver === ANY) { + if (dom.length === 1 && dom[0].semver === ANY) { + return true + } else if (options.includePrerelease) { + sub = minimumVersionWithPreRelease + } else { + sub = minimumVersion + } + } + + if (dom.length === 1 && dom[0].semver === ANY) { + if (options.includePrerelease) { + return true + } else { + dom = minimumVersion + } + } + + const eqSet = new Set() + let gt, lt + for (const c of sub) { + if (c.operator === '>' || c.operator === '>=') { + gt = higherGT(gt, c, options) + } else if (c.operator === '<' || c.operator === '<=') { + lt = lowerLT(lt, c, options) + } else { + eqSet.add(c.semver) + } + } + + if (eqSet.size > 1) { + return null + } + + let gtltComp + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options) + if (gtltComp > 0) { + return null + } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { + return null + } + } + + // will iterate one or zero times + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) { + return null + } + + if (lt && !satisfies(eq, String(lt), options)) { + return null + } + + for (const c of dom) { + if (!satisfies(eq, String(c), options)) { + return false + } + } + + return true + } + + let higher, lower + let hasDomLT, hasDomGT + // if the subset has a prerelease, we need a comparator in the superset + // with the same tuple and a prerelease, or it's not a subset + let needDomLTPre = lt && + !options.includePrerelease && + lt.semver.prerelease.length ? lt.semver : false + let needDomGTPre = gt && + !options.includePrerelease && + gt.semver.prerelease.length ? gt.semver : false + // exception: <1.2.3-0 is the same as <1.2.3 + if (needDomLTPre && needDomLTPre.prerelease.length === 1 && + lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { + needDomLTPre = false + } + + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' + hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' + if (gt) { + if (needDomGTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomGTPre.major && + c.semver.minor === needDomGTPre.minor && + c.semver.patch === needDomGTPre.patch) { + needDomGTPre = false + } + } + if (c.operator === '>' || c.operator === '>=') { + higher = higherGT(gt, c, options) + if (higher === c && higher !== gt) { + return false + } + } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { + return false + } + } + if (lt) { + if (needDomLTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomLTPre.major && + c.semver.minor === needDomLTPre.minor && + c.semver.patch === needDomLTPre.patch) { + needDomLTPre = false + } + } + if (c.operator === '<' || c.operator === '<=') { + lower = lowerLT(lt, c, options) + if (lower === c && lower !== lt) { + return false + } + } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) { + return false + } + } + if (!c.operator && (lt || gt) && gtltComp !== 0) { + return false + } + } + + // if there was a < or >, and nothing in the dom, then must be false + // UNLESS it was limited by another range in the other direction. + // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 + if (gt && hasDomLT && !lt && gtltComp !== 0) { + return false + } + + if (lt && hasDomGT && !gt && gtltComp !== 0) { + return false + } + + // we needed a prerelease range in a specific tuple, but didn't get one + // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, + // because it includes prereleases in the 1.2.3 tuple + if (needDomGTPre || needDomLTPre) { + return false + } + + return true +} + +// >=1.2.3 is lower than >1.2.3 +const higherGT = (a, b, options) => { + if (!a) { + return b + } + const comp = compare(a.semver, b.semver, options) + return comp > 0 ? a + : comp < 0 ? b + : b.operator === '>' && a.operator === '>=' ? b + : a +} + +// <=1.2.3 is higher than <1.2.3 +const lowerLT = (a, b, options) => { + if (!a) { + return b + } + const comp = compare(a.semver, b.semver, options) + return comp < 0 ? a + : comp > 0 ? b + : b.operator === '<' && a.operator === '<=' ? b + : a +} + +module.exports = subset + + +/***/ }), + +/***/ 2706: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const Range = __nccwpck_require__(9828) + +// Mostly just for testing and legacy API reasons +const toComparators = (range, options) => + new Range(range, options).set + .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) + +module.exports = toComparators + + +/***/ }), + +/***/ 2098: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const Range = __nccwpck_require__(9828) +const validRange = (range, options) => { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} +module.exports = validRange + + +/***/ }), + +/***/ 4294: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = __nccwpck_require__(4219); + + +/***/ }), + +/***/ 4219: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +var net = __nccwpck_require__(1808); +var tls = __nccwpck_require__(4404); +var http = __nccwpck_require__(3685); +var https = __nccwpck_require__(5687); +var events = __nccwpck_require__(2361); +var assert = __nccwpck_require__(9491); +var util = __nccwpck_require__(3837); + + +exports.httpOverHttp = httpOverHttp; +exports.httpsOverHttp = httpsOverHttp; +exports.httpOverHttps = httpOverHttps; +exports.httpsOverHttps = httpsOverHttps; + + +function httpOverHttp(options) { + var agent = new TunnelingAgent(options); + agent.request = http.request; + return agent; +} + +function httpsOverHttp(options) { + var agent = new TunnelingAgent(options); + agent.request = http.request; + agent.createSocket = createSecureSocket; + agent.defaultPort = 443; + return agent; +} + +function httpOverHttps(options) { + var agent = new TunnelingAgent(options); + agent.request = https.request; + return agent; +} + +function httpsOverHttps(options) { + var agent = new TunnelingAgent(options); + agent.request = https.request; + agent.createSocket = createSecureSocket; + agent.defaultPort = 443; + return agent; +} + + +function TunnelingAgent(options) { + var self = this; + self.options = options || {}; + self.proxyOptions = self.options.proxy || {}; + self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; + self.requests = []; + self.sockets = []; + + self.on('free', function onFree(socket, host, port, localAddress) { + var options = toOptions(host, port, localAddress); + for (var i = 0, len = self.requests.length; i < len; ++i) { + var pending = self.requests[i]; + if (pending.host === options.host && pending.port === options.port) { + // Detect the request to connect same origin server, + // reuse the connection. + self.requests.splice(i, 1); + pending.request.onSocket(socket); + return; + } + } + socket.destroy(); + self.removeSocket(socket); + }); +} +util.inherits(TunnelingAgent, events.EventEmitter); + +TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { + var self = this; + var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); + + if (self.sockets.length >= this.maxSockets) { + // We are over limit so we'll add it to the queue. + self.requests.push(options); + return; + } + + // If we are under maxSockets create a new one. + self.createSocket(options, function(socket) { + socket.on('free', onFree); + socket.on('close', onCloseOrRemove); + socket.on('agentRemove', onCloseOrRemove); + req.onSocket(socket); + + function onFree() { + self.emit('free', socket, options); + } + + function onCloseOrRemove(err) { + self.removeSocket(socket); + socket.removeListener('free', onFree); + socket.removeListener('close', onCloseOrRemove); + socket.removeListener('agentRemove', onCloseOrRemove); + } + }); +}; + +TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { + var self = this; + var placeholder = {}; + self.sockets.push(placeholder); + + var connectOptions = mergeOptions({}, self.proxyOptions, { + method: 'CONNECT', + path: options.host + ':' + options.port, + agent: false, + headers: { + host: options.host + ':' + options.port + } + }); + if (options.localAddress) { + connectOptions.localAddress = options.localAddress; + } + if (connectOptions.proxyAuth) { + connectOptions.headers = connectOptions.headers || {}; + connectOptions.headers['Proxy-Authorization'] = 'Basic ' + + new Buffer(connectOptions.proxyAuth).toString('base64'); + } + + debug('making CONNECT request'); + var connectReq = self.request(connectOptions); + connectReq.useChunkedEncodingByDefault = false; // for v0.6 + connectReq.once('response', onResponse); // for v0.6 + connectReq.once('upgrade', onUpgrade); // for v0.6 + connectReq.once('connect', onConnect); // for v0.7 or later + connectReq.once('error', onError); + connectReq.end(); + + function onResponse(res) { + // Very hacky. This is necessary to avoid http-parser leaks. + res.upgrade = true; + } + + function onUpgrade(res, socket, head) { + // Hacky. + process.nextTick(function() { + onConnect(res, socket, head); + }); + } + + function onConnect(res, socket, head) { + connectReq.removeAllListeners(); + socket.removeAllListeners(); + + if (res.statusCode !== 200) { + debug('tunneling socket could not be established, statusCode=%d', + res.statusCode); + socket.destroy(); + var error = new Error('tunneling socket could not be established, ' + + 'statusCode=' + res.statusCode); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + return; + } + if (head.length > 0) { + debug('got illegal response body from proxy'); + socket.destroy(); + var error = new Error('got illegal response body from proxy'); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + return; + } + debug('tunneling connection has established'); + self.sockets[self.sockets.indexOf(placeholder)] = socket; + return cb(socket); + } + + function onError(cause) { + connectReq.removeAllListeners(); + + debug('tunneling socket could not be established, cause=%s\n', + cause.message, cause.stack); + var error = new Error('tunneling socket could not be established, ' + + 'cause=' + cause.message); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + } +}; + +TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { + var pos = this.sockets.indexOf(socket) + if (pos === -1) { + return; + } + this.sockets.splice(pos, 1); + + var pending = this.requests.shift(); + if (pending) { + // If we have pending requests and a socket gets closed a new one + // needs to be created to take over in the pool for the one that closed. + this.createSocket(pending, function(socket) { + pending.request.onSocket(socket); + }); + } +}; + +function createSecureSocket(options, cb) { + var self = this; + TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { + var hostHeader = options.request.getHeader('host'); + var tlsOptions = mergeOptions({}, self.options, { + socket: socket, + servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host + }); + + // 0 is dummy port for v0.6 + var secureSocket = tls.connect(0, tlsOptions); + self.sockets[self.sockets.indexOf(socket)] = secureSocket; + cb(secureSocket); + }); +} + + +function toOptions(host, port, localAddress) { + if (typeof host === 'string') { // since v0.10 + return { + host: host, + port: port, + localAddress: localAddress + }; + } + return host; // for v0.11 or later +} + +function mergeOptions(target) { + for (var i = 1, len = arguments.length; i < len; ++i) { + var overrides = arguments[i]; + if (typeof overrides === 'object') { + var keys = Object.keys(overrides); + for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { + var k = keys[j]; + if (overrides[k] !== undefined) { + target[k] = overrides[k]; + } + } + } + } + return target; +} + + +var debug; +if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { + debug = function() { + var args = Array.prototype.slice.call(arguments); + if (typeof args[0] === 'string') { + args[0] = 'TUNNEL: ' + args[0]; + } else { + args.unshift('TUNNEL:'); + } + console.error.apply(console, args); + } +} else { + debug = function() {}; +} +exports.debug = debug; // for test + + +/***/ }), + +/***/ 1773: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Client = __nccwpck_require__(3598) +const Dispatcher = __nccwpck_require__(412) +const errors = __nccwpck_require__(8045) +const Pool = __nccwpck_require__(4634) +const BalancedPool = __nccwpck_require__(7931) +const Agent = __nccwpck_require__(7890) +const util = __nccwpck_require__(3983) +const { InvalidArgumentError } = errors +const api = __nccwpck_require__(4059) +const buildConnector = __nccwpck_require__(2067) +const MockClient = __nccwpck_require__(8687) +const MockAgent = __nccwpck_require__(6771) +const MockPool = __nccwpck_require__(6193) +const mockErrors = __nccwpck_require__(888) +const ProxyAgent = __nccwpck_require__(7858) +const { getGlobalDispatcher, setGlobalDispatcher } = __nccwpck_require__(1892) +const DecoratorHandler = __nccwpck_require__(6930) +const RedirectHandler = __nccwpck_require__(2860) +const createRedirectInterceptor = __nccwpck_require__(8861) + +let hasCrypto +try { + __nccwpck_require__(6113) + hasCrypto = true +} catch { + hasCrypto = false +} + +Object.assign(Dispatcher.prototype, api) + +module.exports.Dispatcher = Dispatcher +module.exports.Client = Client +module.exports.Pool = Pool +module.exports.BalancedPool = BalancedPool +module.exports.Agent = Agent +module.exports.ProxyAgent = ProxyAgent + +module.exports.DecoratorHandler = DecoratorHandler +module.exports.RedirectHandler = RedirectHandler +module.exports.createRedirectInterceptor = createRedirectInterceptor + +module.exports.buildConnector = buildConnector +module.exports.errors = errors + +function makeDispatcher (fn) { + return (url, opts, handler) => { + if (typeof opts === 'function') { + handler = opts + opts = null + } + + if (!url || (typeof url !== 'string' && typeof url !== 'object' && !(url instanceof URL))) { + throw new InvalidArgumentError('invalid url') + } + + if (opts != null && typeof opts !== 'object') { + throw new InvalidArgumentError('invalid opts') + } + + if (opts && opts.path != null) { + if (typeof opts.path !== 'string') { + throw new InvalidArgumentError('invalid opts.path') + } + + let path = opts.path + if (!opts.path.startsWith('/')) { + path = `/${path}` + } + + url = new URL(util.parseOrigin(url).origin + path) + } else { + if (!opts) { + opts = typeof url === 'object' ? url : {} + } + + url = util.parseURL(url) + } + + const { agent, dispatcher = getGlobalDispatcher() } = opts + + if (agent) { + throw new InvalidArgumentError('unsupported opts.agent. Did you mean opts.client?') + } + + return fn.call(dispatcher, { + ...opts, + origin: url.origin, + path: url.search ? `${url.pathname}${url.search}` : url.pathname, + method: opts.method || (opts.body ? 'PUT' : 'GET') + }, handler) + } +} + +module.exports.setGlobalDispatcher = setGlobalDispatcher +module.exports.getGlobalDispatcher = getGlobalDispatcher + +if (util.nodeMajor > 16 || (util.nodeMajor === 16 && util.nodeMinor >= 8)) { + let fetchImpl = null + module.exports.fetch = async function fetch (resource) { + if (!fetchImpl) { + fetchImpl = (__nccwpck_require__(4881).fetch) + } + + try { + return await fetchImpl(...arguments) + } catch (err) { + if (typeof err === 'object') { + Error.captureStackTrace(err, this) + } + + throw err + } + } + module.exports.Headers = __nccwpck_require__(554).Headers + module.exports.Response = __nccwpck_require__(7823).Response + module.exports.Request = __nccwpck_require__(8359).Request + module.exports.FormData = __nccwpck_require__(2015).FormData + module.exports.File = __nccwpck_require__(8511).File + module.exports.FileReader = __nccwpck_require__(1446).FileReader + + const { setGlobalOrigin, getGlobalOrigin } = __nccwpck_require__(1246) + + module.exports.setGlobalOrigin = setGlobalOrigin + module.exports.getGlobalOrigin = getGlobalOrigin + + const { CacheStorage } = __nccwpck_require__(7907) + const { kConstruct } = __nccwpck_require__(9174) + + // Cache & CacheStorage are tightly coupled with fetch. Even if it may run + // in an older version of Node, it doesn't have any use without fetch. + module.exports.caches = new CacheStorage(kConstruct) +} + +if (util.nodeMajor >= 16) { + const { deleteCookie, getCookies, getSetCookies, setCookie } = __nccwpck_require__(1724) + + module.exports.deleteCookie = deleteCookie + module.exports.getCookies = getCookies + module.exports.getSetCookies = getSetCookies + module.exports.setCookie = setCookie + + const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685) + + module.exports.parseMIMEType = parseMIMEType + module.exports.serializeAMimeType = serializeAMimeType +} + +if (util.nodeMajor >= 18 && hasCrypto) { + const { WebSocket } = __nccwpck_require__(4284) + + module.exports.WebSocket = WebSocket +} + +module.exports.request = makeDispatcher(api.request) +module.exports.stream = makeDispatcher(api.stream) +module.exports.pipeline = makeDispatcher(api.pipeline) +module.exports.connect = makeDispatcher(api.connect) +module.exports.upgrade = makeDispatcher(api.upgrade) + +module.exports.MockClient = MockClient +module.exports.MockPool = MockPool +module.exports.MockAgent = MockAgent +module.exports.mockErrors = mockErrors + + +/***/ }), + +/***/ 7890: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { InvalidArgumentError } = __nccwpck_require__(8045) +const { kClients, kRunning, kClose, kDestroy, kDispatch, kInterceptors } = __nccwpck_require__(2785) +const DispatcherBase = __nccwpck_require__(4839) +const Pool = __nccwpck_require__(4634) +const Client = __nccwpck_require__(3598) +const util = __nccwpck_require__(3983) +const createRedirectInterceptor = __nccwpck_require__(8861) +const { WeakRef, FinalizationRegistry } = __nccwpck_require__(6436)() + +const kOnConnect = Symbol('onConnect') +const kOnDisconnect = Symbol('onDisconnect') +const kOnConnectionError = Symbol('onConnectionError') +const kMaxRedirections = Symbol('maxRedirections') +const kOnDrain = Symbol('onDrain') +const kFactory = Symbol('factory') +const kFinalizer = Symbol('finalizer') +const kOptions = Symbol('options') + +function defaultFactory (origin, opts) { + return opts && opts.connections === 1 + ? new Client(origin, opts) + : new Pool(origin, opts) +} + +class Agent extends DispatcherBase { + constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) { + super() + + if (typeof factory !== 'function') { + throw new InvalidArgumentError('factory must be a function.') + } + + if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') { + throw new InvalidArgumentError('connect must be a function or an object') + } + + if (!Number.isInteger(maxRedirections) || maxRedirections < 0) { + throw new InvalidArgumentError('maxRedirections must be a positive number') + } + + if (connect && typeof connect !== 'function') { + connect = { ...connect } + } + + this[kInterceptors] = options.interceptors && options.interceptors.Agent && Array.isArray(options.interceptors.Agent) + ? options.interceptors.Agent + : [createRedirectInterceptor({ maxRedirections })] + + this[kOptions] = { ...util.deepClone(options), connect } + this[kOptions].interceptors = options.interceptors + ? { ...options.interceptors } + : undefined + this[kMaxRedirections] = maxRedirections + this[kFactory] = factory + this[kClients] = new Map() + this[kFinalizer] = new FinalizationRegistry(/* istanbul ignore next: gc is undeterministic */ key => { + const ref = this[kClients].get(key) + if (ref !== undefined && ref.deref() === undefined) { + this[kClients].delete(key) + } + }) + + const agent = this + + this[kOnDrain] = (origin, targets) => { + agent.emit('drain', origin, [agent, ...targets]) + } + + this[kOnConnect] = (origin, targets) => { + agent.emit('connect', origin, [agent, ...targets]) + } + + this[kOnDisconnect] = (origin, targets, err) => { + agent.emit('disconnect', origin, [agent, ...targets], err) + } + + this[kOnConnectionError] = (origin, targets, err) => { + agent.emit('connectionError', origin, [agent, ...targets], err) + } + } + + get [kRunning] () { + let ret = 0 + for (const ref of this[kClients].values()) { + const client = ref.deref() + /* istanbul ignore next: gc is undeterministic */ + if (client) { + ret += client[kRunning] + } + } + return ret + } + + [kDispatch] (opts, handler) { + let key + if (opts.origin && (typeof opts.origin === 'string' || opts.origin instanceof URL)) { + key = String(opts.origin) + } else { + throw new InvalidArgumentError('opts.origin must be a non-empty string or URL.') + } + + const ref = this[kClients].get(key) + + let dispatcher = ref ? ref.deref() : null + if (!dispatcher) { + dispatcher = this[kFactory](opts.origin, this[kOptions]) + .on('drain', this[kOnDrain]) + .on('connect', this[kOnConnect]) + .on('disconnect', this[kOnDisconnect]) + .on('connectionError', this[kOnConnectionError]) + + this[kClients].set(key, new WeakRef(dispatcher)) + this[kFinalizer].register(dispatcher, key) + } + + return dispatcher.dispatch(opts, handler) + } + + async [kClose] () { + const closePromises = [] + for (const ref of this[kClients].values()) { + const client = ref.deref() + /* istanbul ignore else: gc is undeterministic */ + if (client) { + closePromises.push(client.close()) + } + } + + await Promise.all(closePromises) + } + + async [kDestroy] (err) { + const destroyPromises = [] + for (const ref of this[kClients].values()) { + const client = ref.deref() + /* istanbul ignore else: gc is undeterministic */ + if (client) { + destroyPromises.push(client.destroy(err)) + } + } + + await Promise.all(destroyPromises) + } +} + +module.exports = Agent + + +/***/ }), + +/***/ 7032: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const { addAbortListener } = __nccwpck_require__(3983) +const { RequestAbortedError } = __nccwpck_require__(8045) + +const kListener = Symbol('kListener') +const kSignal = Symbol('kSignal') + +function abort (self) { + if (self.abort) { + self.abort() + } else { + self.onError(new RequestAbortedError()) + } +} + +function addSignal (self, signal) { + self[kSignal] = null + self[kListener] = null + + if (!signal) { + return + } + + if (signal.aborted) { + abort(self) + return + } + + self[kSignal] = signal + self[kListener] = () => { + abort(self) + } + + addAbortListener(self[kSignal], self[kListener]) +} + +function removeSignal (self) { + if (!self[kSignal]) { + return + } + + if ('removeEventListener' in self[kSignal]) { + self[kSignal].removeEventListener('abort', self[kListener]) + } else { + self[kSignal].removeListener('abort', self[kListener]) + } + + self[kSignal] = null + self[kListener] = null +} + +module.exports = { + addSignal, + removeSignal +} + + +/***/ }), + +/***/ 9744: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { AsyncResource } = __nccwpck_require__(852) +const { InvalidArgumentError, RequestAbortedError, SocketError } = __nccwpck_require__(8045) +const util = __nccwpck_require__(3983) +const { addSignal, removeSignal } = __nccwpck_require__(7032) + +class ConnectHandler extends AsyncResource { + constructor (opts, callback) { + if (!opts || typeof opts !== 'object') { + throw new InvalidArgumentError('invalid opts') + } + + if (typeof callback !== 'function') { + throw new InvalidArgumentError('invalid callback') + } + + const { signal, opaque, responseHeaders } = opts + + if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { + throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') + } + + super('UNDICI_CONNECT') + + this.opaque = opaque || null + this.responseHeaders = responseHeaders || null + this.callback = callback + this.abort = null + + addSignal(this, signal) + } + + onConnect (abort, context) { + if (!this.callback) { + throw new RequestAbortedError() + } + + this.abort = abort + this.context = context + } + + onHeaders () { + throw new SocketError('bad connect', null) + } + + onUpgrade (statusCode, rawHeaders, socket) { + const { callback, opaque, context } = this + + removeSignal(this) + + this.callback = null + + let headers = rawHeaders + // Indicates is an HTTP2Session + if (headers != null) { + headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) + } + + this.runInAsyncScope(callback, null, null, { + statusCode, + headers, + socket, + opaque, + context + }) + } + + onError (err) { + const { callback, opaque } = this + + removeSignal(this) + + if (callback) { + this.callback = null + queueMicrotask(() => { + this.runInAsyncScope(callback, null, err, { opaque }) + }) + } + } +} + +function connect (opts, callback) { + if (callback === undefined) { + return new Promise((resolve, reject) => { + connect.call(this, opts, (err, data) => { + return err ? reject(err) : resolve(data) + }) + }) + } + + try { + const connectHandler = new ConnectHandler(opts, callback) + this.dispatch({ ...opts, method: 'CONNECT' }, connectHandler) + } catch (err) { + if (typeof callback !== 'function') { + throw err + } + const opaque = opts && opts.opaque + queueMicrotask(() => callback(err, { opaque })) + } +} + +module.exports = connect + + +/***/ }), + +/***/ 8752: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { + Readable, + Duplex, + PassThrough +} = __nccwpck_require__(2781) +const { + InvalidArgumentError, + InvalidReturnValueError, + RequestAbortedError +} = __nccwpck_require__(8045) +const util = __nccwpck_require__(3983) +const { AsyncResource } = __nccwpck_require__(852) +const { addSignal, removeSignal } = __nccwpck_require__(7032) +const assert = __nccwpck_require__(9491) + +const kResume = Symbol('resume') + +class PipelineRequest extends Readable { + constructor () { + super({ autoDestroy: true }) + + this[kResume] = null + } + + _read () { + const { [kResume]: resume } = this + + if (resume) { + this[kResume] = null + resume() + } + } + + _destroy (err, callback) { + this._read() + + callback(err) + } +} + +class PipelineResponse extends Readable { + constructor (resume) { + super({ autoDestroy: true }) + this[kResume] = resume + } + + _read () { + this[kResume]() + } + + _destroy (err, callback) { + if (!err && !this._readableState.endEmitted) { + err = new RequestAbortedError() + } + + callback(err) + } +} + +class PipelineHandler extends AsyncResource { + constructor (opts, handler) { + if (!opts || typeof opts !== 'object') { + throw new InvalidArgumentError('invalid opts') + } + + if (typeof handler !== 'function') { + throw new InvalidArgumentError('invalid handler') + } + + const { signal, method, opaque, onInfo, responseHeaders } = opts + + if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { + throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') + } + + if (method === 'CONNECT') { + throw new InvalidArgumentError('invalid method') + } + + if (onInfo && typeof onInfo !== 'function') { + throw new InvalidArgumentError('invalid onInfo callback') + } + + super('UNDICI_PIPELINE') + + this.opaque = opaque || null + this.responseHeaders = responseHeaders || null + this.handler = handler + this.abort = null + this.context = null + this.onInfo = onInfo || null + + this.req = new PipelineRequest().on('error', util.nop) + + this.ret = new Duplex({ + readableObjectMode: opts.objectMode, + autoDestroy: true, + read: () => { + const { body } = this + + if (body && body.resume) { + body.resume() + } + }, + write: (chunk, encoding, callback) => { + const { req } = this + + if (req.push(chunk, encoding) || req._readableState.destroyed) { + callback() + } else { + req[kResume] = callback + } + }, + destroy: (err, callback) => { + const { body, req, res, ret, abort } = this + + if (!err && !ret._readableState.endEmitted) { + err = new RequestAbortedError() + } + + if (abort && err) { + abort() + } + + util.destroy(body, err) + util.destroy(req, err) + util.destroy(res, err) + + removeSignal(this) + + callback(err) + } + }).on('prefinish', () => { + const { req } = this + + // Node < 15 does not call _final in same tick. + req.push(null) + }) + + this.res = null + + addSignal(this, signal) + } + + onConnect (abort, context) { + const { ret, res } = this + + assert(!res, 'pipeline cannot be retried') + + if (ret.destroyed) { + throw new RequestAbortedError() + } + + this.abort = abort + this.context = context + } + + onHeaders (statusCode, rawHeaders, resume) { + const { opaque, handler, context } = this + + if (statusCode < 200) { + if (this.onInfo) { + const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) + this.onInfo({ statusCode, headers }) + } + return + } + + this.res = new PipelineResponse(resume) + + let body + try { + this.handler = null + const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) + body = this.runInAsyncScope(handler, null, { + statusCode, + headers, + opaque, + body: this.res, + context + }) + } catch (err) { + this.res.on('error', util.nop) + throw err + } + + if (!body || typeof body.on !== 'function') { + throw new InvalidReturnValueError('expected Readable') + } + + body + .on('data', (chunk) => { + const { ret, body } = this + + if (!ret.push(chunk) && body.pause) { + body.pause() + } + }) + .on('error', (err) => { + const { ret } = this + + util.destroy(ret, err) + }) + .on('end', () => { + const { ret } = this + + ret.push(null) + }) + .on('close', () => { + const { ret } = this + + if (!ret._readableState.ended) { + util.destroy(ret, new RequestAbortedError()) + } + }) + + this.body = body + } + + onData (chunk) { + const { res } = this + return res.push(chunk) + } + + onComplete (trailers) { + const { res } = this + res.push(null) + } + + onError (err) { + const { ret } = this + this.handler = null + util.destroy(ret, err) + } +} + +function pipeline (opts, handler) { + try { + const pipelineHandler = new PipelineHandler(opts, handler) + this.dispatch({ ...opts, body: pipelineHandler.req }, pipelineHandler) + return pipelineHandler.ret + } catch (err) { + return new PassThrough().destroy(err) + } +} + +module.exports = pipeline + + +/***/ }), + +/***/ 5448: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Readable = __nccwpck_require__(3858) +const { + InvalidArgumentError, + RequestAbortedError +} = __nccwpck_require__(8045) +const util = __nccwpck_require__(3983) +const { getResolveErrorBodyCallback } = __nccwpck_require__(7474) +const { AsyncResource } = __nccwpck_require__(852) +const { addSignal, removeSignal } = __nccwpck_require__(7032) + +class RequestHandler extends AsyncResource { + constructor (opts, callback) { + if (!opts || typeof opts !== 'object') { + throw new InvalidArgumentError('invalid opts') + } + + const { signal, method, opaque, body, onInfo, responseHeaders, throwOnError, highWaterMark } = opts + + try { + if (typeof callback !== 'function') { + throw new InvalidArgumentError('invalid callback') + } + + if (highWaterMark && (typeof highWaterMark !== 'number' || highWaterMark < 0)) { + throw new InvalidArgumentError('invalid highWaterMark') + } + + if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { + throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') + } + + if (method === 'CONNECT') { + throw new InvalidArgumentError('invalid method') + } + + if (onInfo && typeof onInfo !== 'function') { + throw new InvalidArgumentError('invalid onInfo callback') + } + + super('UNDICI_REQUEST') + } catch (err) { + if (util.isStream(body)) { + util.destroy(body.on('error', util.nop), err) + } + throw err + } + + this.responseHeaders = responseHeaders || null + this.opaque = opaque || null + this.callback = callback + this.res = null + this.abort = null + this.body = body + this.trailers = {} + this.context = null + this.onInfo = onInfo || null + this.throwOnError = throwOnError + this.highWaterMark = highWaterMark + + if (util.isStream(body)) { + body.on('error', (err) => { + this.onError(err) + }) + } + + addSignal(this, signal) + } + + onConnect (abort, context) { + if (!this.callback) { + throw new RequestAbortedError() + } + + this.abort = abort + this.context = context + } + + onHeaders (statusCode, rawHeaders, resume, statusMessage) { + const { callback, opaque, abort, context, responseHeaders, highWaterMark } = this + + const headers = responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) + + if (statusCode < 200) { + if (this.onInfo) { + this.onInfo({ statusCode, headers }) + } + return + } + + const parsedHeaders = responseHeaders === 'raw' ? util.parseHeaders(rawHeaders) : headers + const contentType = parsedHeaders['content-type'] + const body = new Readable({ resume, abort, contentType, highWaterMark }) + + this.callback = null + this.res = body + if (callback !== null) { + if (this.throwOnError && statusCode >= 400) { + this.runInAsyncScope(getResolveErrorBodyCallback, null, + { callback, body, contentType, statusCode, statusMessage, headers } + ) + } else { + this.runInAsyncScope(callback, null, null, { + statusCode, + headers, + trailers: this.trailers, + opaque, + body, + context + }) + } + } + } + + onData (chunk) { + const { res } = this + return res.push(chunk) + } + + onComplete (trailers) { + const { res } = this + + removeSignal(this) + + util.parseHeaders(trailers, this.trailers) + + res.push(null) + } + + onError (err) { + const { res, callback, body, opaque } = this + + removeSignal(this) + + if (callback) { + // TODO: Does this need queueMicrotask? + this.callback = null + queueMicrotask(() => { + this.runInAsyncScope(callback, null, err, { opaque }) + }) + } + + if (res) { + this.res = null + // Ensure all queued handlers are invoked before destroying res. + queueMicrotask(() => { + util.destroy(res, err) + }) + } + + if (body) { + this.body = null + util.destroy(body, err) + } + } +} + +function request (opts, callback) { + if (callback === undefined) { + return new Promise((resolve, reject) => { + request.call(this, opts, (err, data) => { + return err ? reject(err) : resolve(data) + }) + }) + } + + try { + this.dispatch(opts, new RequestHandler(opts, callback)) + } catch (err) { + if (typeof callback !== 'function') { + throw err + } + const opaque = opts && opts.opaque + queueMicrotask(() => callback(err, { opaque })) + } +} + +module.exports = request + + +/***/ }), + +/***/ 5395: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { finished, PassThrough } = __nccwpck_require__(2781) +const { + InvalidArgumentError, + InvalidReturnValueError, + RequestAbortedError +} = __nccwpck_require__(8045) +const util = __nccwpck_require__(3983) +const { getResolveErrorBodyCallback } = __nccwpck_require__(7474) +const { AsyncResource } = __nccwpck_require__(852) +const { addSignal, removeSignal } = __nccwpck_require__(7032) + +class StreamHandler extends AsyncResource { + constructor (opts, factory, callback) { + if (!opts || typeof opts !== 'object') { + throw new InvalidArgumentError('invalid opts') + } + + const { signal, method, opaque, body, onInfo, responseHeaders, throwOnError } = opts + + try { + if (typeof callback !== 'function') { + throw new InvalidArgumentError('invalid callback') + } + + if (typeof factory !== 'function') { + throw new InvalidArgumentError('invalid factory') + } + + if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { + throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') + } + + if (method === 'CONNECT') { + throw new InvalidArgumentError('invalid method') + } + + if (onInfo && typeof onInfo !== 'function') { + throw new InvalidArgumentError('invalid onInfo callback') + } + + super('UNDICI_STREAM') + } catch (err) { + if (util.isStream(body)) { + util.destroy(body.on('error', util.nop), err) + } + throw err + } + + this.responseHeaders = responseHeaders || null + this.opaque = opaque || null + this.factory = factory + this.callback = callback + this.res = null + this.abort = null + this.context = null + this.trailers = null + this.body = body + this.onInfo = onInfo || null + this.throwOnError = throwOnError || false + + if (util.isStream(body)) { + body.on('error', (err) => { + this.onError(err) + }) + } + + addSignal(this, signal) + } + + onConnect (abort, context) { + if (!this.callback) { + throw new RequestAbortedError() + } + + this.abort = abort + this.context = context + } + + onHeaders (statusCode, rawHeaders, resume, statusMessage) { + const { factory, opaque, context, callback, responseHeaders } = this + + const headers = responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) + + if (statusCode < 200) { + if (this.onInfo) { + this.onInfo({ statusCode, headers }) + } + return + } + + this.factory = null + + let res + + if (this.throwOnError && statusCode >= 400) { + const parsedHeaders = responseHeaders === 'raw' ? util.parseHeaders(rawHeaders) : headers + const contentType = parsedHeaders['content-type'] + res = new PassThrough() + + this.callback = null + this.runInAsyncScope(getResolveErrorBodyCallback, null, + { callback, body: res, contentType, statusCode, statusMessage, headers } + ) + } else { + res = this.runInAsyncScope(factory, null, { + statusCode, + headers, + opaque, + context + }) + + if ( + !res || + typeof res.write !== 'function' || + typeof res.end !== 'function' || + typeof res.on !== 'function' + ) { + throw new InvalidReturnValueError('expected Writable') + } + + // TODO: Avoid finished. It registers an unnecessary amount of listeners. + finished(res, { readable: false }, (err) => { + const { callback, res, opaque, trailers, abort } = this + + this.res = null + if (err || !res.readable) { + util.destroy(res, err) + } + + this.callback = null + this.runInAsyncScope(callback, null, err || null, { opaque, trailers }) + + if (err) { + abort() + } + }) + } + + res.on('drain', resume) + + this.res = res + + const needDrain = res.writableNeedDrain !== undefined + ? res.writableNeedDrain + : res._writableState && res._writableState.needDrain + + return needDrain !== true + } + + onData (chunk) { + const { res } = this + + return res.write(chunk) + } + + onComplete (trailers) { + const { res } = this + + removeSignal(this) + + this.trailers = util.parseHeaders(trailers) + + res.end() + } + + onError (err) { + const { res, callback, opaque, body } = this + + removeSignal(this) + + this.factory = null + + if (res) { + this.res = null + util.destroy(res, err) + } else if (callback) { + this.callback = null + queueMicrotask(() => { + this.runInAsyncScope(callback, null, err, { opaque }) + }) + } + + if (body) { + this.body = null + util.destroy(body, err) + } + } +} + +function stream (opts, factory, callback) { + if (callback === undefined) { + return new Promise((resolve, reject) => { + stream.call(this, opts, factory, (err, data) => { + return err ? reject(err) : resolve(data) + }) + }) + } + + try { + this.dispatch(opts, new StreamHandler(opts, factory, callback)) + } catch (err) { + if (typeof callback !== 'function') { + throw err + } + const opaque = opts && opts.opaque + queueMicrotask(() => callback(err, { opaque })) + } +} + +module.exports = stream + + +/***/ }), + +/***/ 6923: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { InvalidArgumentError, RequestAbortedError, SocketError } = __nccwpck_require__(8045) +const { AsyncResource } = __nccwpck_require__(852) +const util = __nccwpck_require__(3983) +const { addSignal, removeSignal } = __nccwpck_require__(7032) +const assert = __nccwpck_require__(9491) + +class UpgradeHandler extends AsyncResource { + constructor (opts, callback) { + if (!opts || typeof opts !== 'object') { + throw new InvalidArgumentError('invalid opts') + } + + if (typeof callback !== 'function') { + throw new InvalidArgumentError('invalid callback') + } + + const { signal, opaque, responseHeaders } = opts + + if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { + throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') + } + + super('UNDICI_UPGRADE') + + this.responseHeaders = responseHeaders || null + this.opaque = opaque || null + this.callback = callback + this.abort = null + this.context = null + + addSignal(this, signal) + } + + onConnect (abort, context) { + if (!this.callback) { + throw new RequestAbortedError() + } + + this.abort = abort + this.context = null + } + + onHeaders () { + throw new SocketError('bad upgrade', null) + } + + onUpgrade (statusCode, rawHeaders, socket) { + const { callback, opaque, context } = this + + assert.strictEqual(statusCode, 101) + + removeSignal(this) + + this.callback = null + const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) + this.runInAsyncScope(callback, null, null, { + headers, + socket, + opaque, + context + }) + } + + onError (err) { + const { callback, opaque } = this + + removeSignal(this) + + if (callback) { + this.callback = null + queueMicrotask(() => { + this.runInAsyncScope(callback, null, err, { opaque }) + }) + } + } +} + +function upgrade (opts, callback) { + if (callback === undefined) { + return new Promise((resolve, reject) => { + upgrade.call(this, opts, (err, data) => { + return err ? reject(err) : resolve(data) + }) + }) + } + + try { + const upgradeHandler = new UpgradeHandler(opts, callback) + this.dispatch({ + ...opts, + method: opts.method || 'GET', + upgrade: opts.protocol || 'Websocket' + }, upgradeHandler) + } catch (err) { + if (typeof callback !== 'function') { + throw err + } + const opaque = opts && opts.opaque + queueMicrotask(() => callback(err, { opaque })) + } +} + +module.exports = upgrade + + +/***/ }), + +/***/ 4059: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports.request = __nccwpck_require__(5448) +module.exports.stream = __nccwpck_require__(5395) +module.exports.pipeline = __nccwpck_require__(8752) +module.exports.upgrade = __nccwpck_require__(6923) +module.exports.connect = __nccwpck_require__(9744) + + +/***/ }), + +/***/ 3858: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// Ported from https://github.com/nodejs/undici/pull/907 + + + +const assert = __nccwpck_require__(9491) +const { Readable } = __nccwpck_require__(2781) +const { RequestAbortedError, NotSupportedError, InvalidArgumentError } = __nccwpck_require__(8045) +const util = __nccwpck_require__(3983) +const { ReadableStreamFrom, toUSVString } = __nccwpck_require__(3983) + +let Blob + +const kConsume = Symbol('kConsume') +const kReading = Symbol('kReading') +const kBody = Symbol('kBody') +const kAbort = Symbol('abort') +const kContentType = Symbol('kContentType') + +module.exports = class BodyReadable extends Readable { + constructor ({ + resume, + abort, + contentType = '', + highWaterMark = 64 * 1024 // Same as nodejs fs streams. + }) { + super({ + autoDestroy: true, + read: resume, + highWaterMark + }) + + this._readableState.dataEmitted = false + + this[kAbort] = abort + this[kConsume] = null + this[kBody] = null + this[kContentType] = contentType + + // Is stream being consumed through Readable API? + // This is an optimization so that we avoid checking + // for 'data' and 'readable' listeners in the hot path + // inside push(). + this[kReading] = false + } + + destroy (err) { + if (this.destroyed) { + // Node < 16 + return this + } + + if (!err && !this._readableState.endEmitted) { + err = new RequestAbortedError() + } + + if (err) { + this[kAbort]() + } + + return super.destroy(err) + } + + emit (ev, ...args) { + if (ev === 'data') { + // Node < 16.7 + this._readableState.dataEmitted = true + } else if (ev === 'error') { + // Node < 16 + this._readableState.errorEmitted = true + } + return super.emit(ev, ...args) + } + + on (ev, ...args) { + if (ev === 'data' || ev === 'readable') { + this[kReading] = true + } + return super.on(ev, ...args) + } + + addListener (ev, ...args) { + return this.on(ev, ...args) + } + + off (ev, ...args) { + const ret = super.off(ev, ...args) + if (ev === 'data' || ev === 'readable') { + this[kReading] = ( + this.listenerCount('data') > 0 || + this.listenerCount('readable') > 0 + ) + } + return ret + } + + removeListener (ev, ...args) { + return this.off(ev, ...args) + } + + push (chunk) { + if (this[kConsume] && chunk !== null && this.readableLength === 0) { + consumePush(this[kConsume], chunk) + return this[kReading] ? super.push(chunk) : true + } + return super.push(chunk) + } + + // https://fetch.spec.whatwg.org/#dom-body-text + async text () { + return consume(this, 'text') + } + + // https://fetch.spec.whatwg.org/#dom-body-json + async json () { + return consume(this, 'json') + } + + // https://fetch.spec.whatwg.org/#dom-body-blob + async blob () { + return consume(this, 'blob') + } + + // https://fetch.spec.whatwg.org/#dom-body-arraybuffer + async arrayBuffer () { + return consume(this, 'arrayBuffer') + } + + // https://fetch.spec.whatwg.org/#dom-body-formdata + async formData () { + // TODO: Implement. + throw new NotSupportedError() + } + + // https://fetch.spec.whatwg.org/#dom-body-bodyused + get bodyUsed () { + return util.isDisturbed(this) + } + + // https://fetch.spec.whatwg.org/#dom-body-body + get body () { + if (!this[kBody]) { + this[kBody] = ReadableStreamFrom(this) + if (this[kConsume]) { + // TODO: Is this the best way to force a lock? + this[kBody].getReader() // Ensure stream is locked. + assert(this[kBody].locked) + } + } + return this[kBody] + } + + async dump (opts) { + let limit = opts && Number.isFinite(opts.limit) ? opts.limit : 262144 + const signal = opts && opts.signal + const abortFn = () => { + this.destroy() + } + let signalListenerCleanup + if (signal) { + if (typeof signal !== 'object' || !('aborted' in signal)) { + throw new InvalidArgumentError('signal must be an AbortSignal') + } + util.throwIfAborted(signal) + signalListenerCleanup = util.addAbortListener(signal, abortFn) + } + try { + for await (const chunk of this) { + util.throwIfAborted(signal) + limit -= Buffer.byteLength(chunk) + if (limit < 0) { + return + } + } + } catch { + util.throwIfAborted(signal) + } finally { + if (typeof signalListenerCleanup === 'function') { + signalListenerCleanup() + } else if (signalListenerCleanup) { + signalListenerCleanup[Symbol.dispose]() + } + } + } +} + +// https://streams.spec.whatwg.org/#readablestream-locked +function isLocked (self) { + // Consume is an implicit lock. + return (self[kBody] && self[kBody].locked === true) || self[kConsume] +} + +// https://fetch.spec.whatwg.org/#body-unusable +function isUnusable (self) { + return util.isDisturbed(self) || isLocked(self) +} + +async function consume (stream, type) { + if (isUnusable(stream)) { + throw new TypeError('unusable') + } + + assert(!stream[kConsume]) + + return new Promise((resolve, reject) => { + stream[kConsume] = { + type, + stream, + resolve, + reject, + length: 0, + body: [] + } + + stream + .on('error', function (err) { + consumeFinish(this[kConsume], err) + }) + .on('close', function () { + if (this[kConsume].body !== null) { + consumeFinish(this[kConsume], new RequestAbortedError()) + } + }) + + process.nextTick(consumeStart, stream[kConsume]) + }) +} + +function consumeStart (consume) { + if (consume.body === null) { + return + } + + const { _readableState: state } = consume.stream + + for (const chunk of state.buffer) { + consumePush(consume, chunk) + } + + if (state.endEmitted) { + consumeEnd(this[kConsume]) + } else { + consume.stream.on('end', function () { + consumeEnd(this[kConsume]) + }) + } + + consume.stream.resume() + + while (consume.stream.read() != null) { + // Loop + } +} + +function consumeEnd (consume) { + const { type, body, resolve, stream, length } = consume + + try { + if (type === 'text') { + resolve(toUSVString(Buffer.concat(body))) + } else if (type === 'json') { + resolve(JSON.parse(Buffer.concat(body))) + } else if (type === 'arrayBuffer') { + const dst = new Uint8Array(length) + + let pos = 0 + for (const buf of body) { + dst.set(buf, pos) + pos += buf.byteLength + } + + resolve(dst) + } else if (type === 'blob') { + if (!Blob) { + Blob = (__nccwpck_require__(4300).Blob) + } + resolve(new Blob(body, { type: stream[kContentType] })) + } + + consumeFinish(consume) + } catch (err) { + stream.destroy(err) + } +} + +function consumePush (consume, chunk) { + consume.length += chunk.length + consume.body.push(chunk) +} + +function consumeFinish (consume, err) { + if (consume.body === null) { + return + } + + if (err) { + consume.reject(err) + } else { + consume.resolve() + } + + consume.type = null + consume.stream = null + consume.resolve = null + consume.reject = null + consume.length = 0 + consume.body = null +} + + +/***/ }), + +/***/ 7474: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const assert = __nccwpck_require__(9491) +const { + ResponseStatusCodeError +} = __nccwpck_require__(8045) +const { toUSVString } = __nccwpck_require__(3983) + +async function getResolveErrorBodyCallback ({ callback, body, contentType, statusCode, statusMessage, headers }) { + assert(body) + + let chunks = [] + let limit = 0 + + for await (const chunk of body) { + chunks.push(chunk) + limit += chunk.length + if (limit > 128 * 1024) { + chunks = null + break + } + } + + if (statusCode === 204 || !contentType || !chunks) { + process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers)) + return + } + + try { + if (contentType.startsWith('application/json')) { + const payload = JSON.parse(toUSVString(Buffer.concat(chunks))) + process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers, payload)) + return + } + + if (contentType.startsWith('text/')) { + const payload = toUSVString(Buffer.concat(chunks)) + process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers, payload)) + return + } + } catch (err) { + // Process in a fallback if error + } + + process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers)) +} + +module.exports = { getResolveErrorBodyCallback } + + +/***/ }), + +/***/ 7931: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { + BalancedPoolMissingUpstreamError, + InvalidArgumentError +} = __nccwpck_require__(8045) +const { + PoolBase, + kClients, + kNeedDrain, + kAddClient, + kRemoveClient, + kGetDispatcher +} = __nccwpck_require__(3198) +const Pool = __nccwpck_require__(4634) +const { kUrl, kInterceptors } = __nccwpck_require__(2785) +const { parseOrigin } = __nccwpck_require__(3983) +const kFactory = Symbol('factory') + +const kOptions = Symbol('options') +const kGreatestCommonDivisor = Symbol('kGreatestCommonDivisor') +const kCurrentWeight = Symbol('kCurrentWeight') +const kIndex = Symbol('kIndex') +const kWeight = Symbol('kWeight') +const kMaxWeightPerServer = Symbol('kMaxWeightPerServer') +const kErrorPenalty = Symbol('kErrorPenalty') + +function getGreatestCommonDivisor (a, b) { + if (b === 0) return a + return getGreatestCommonDivisor(b, a % b) +} + +function defaultFactory (origin, opts) { + return new Pool(origin, opts) +} + +class BalancedPool extends PoolBase { + constructor (upstreams = [], { factory = defaultFactory, ...opts } = {}) { + super() + + this[kOptions] = opts + this[kIndex] = -1 + this[kCurrentWeight] = 0 + + this[kMaxWeightPerServer] = this[kOptions].maxWeightPerServer || 100 + this[kErrorPenalty] = this[kOptions].errorPenalty || 15 + + if (!Array.isArray(upstreams)) { + upstreams = [upstreams] + } + + if (typeof factory !== 'function') { + throw new InvalidArgumentError('factory must be a function.') + } + + this[kInterceptors] = opts.interceptors && opts.interceptors.BalancedPool && Array.isArray(opts.interceptors.BalancedPool) + ? opts.interceptors.BalancedPool + : [] + this[kFactory] = factory + + for (const upstream of upstreams) { + this.addUpstream(upstream) + } + this._updateBalancedPoolStats() + } + + addUpstream (upstream) { + const upstreamOrigin = parseOrigin(upstream).origin + + if (this[kClients].find((pool) => ( + pool[kUrl].origin === upstreamOrigin && + pool.closed !== true && + pool.destroyed !== true + ))) { + return this + } + const pool = this[kFactory](upstreamOrigin, Object.assign({}, this[kOptions])) + + this[kAddClient](pool) + pool.on('connect', () => { + pool[kWeight] = Math.min(this[kMaxWeightPerServer], pool[kWeight] + this[kErrorPenalty]) + }) + + pool.on('connectionError', () => { + pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty]) + this._updateBalancedPoolStats() + }) + + pool.on('disconnect', (...args) => { + const err = args[2] + if (err && err.code === 'UND_ERR_SOCKET') { + // decrease the weight of the pool. + pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty]) + this._updateBalancedPoolStats() + } + }) + + for (const client of this[kClients]) { + client[kWeight] = this[kMaxWeightPerServer] + } + + this._updateBalancedPoolStats() + + return this + } + + _updateBalancedPoolStats () { + this[kGreatestCommonDivisor] = this[kClients].map(p => p[kWeight]).reduce(getGreatestCommonDivisor, 0) + } + + removeUpstream (upstream) { + const upstreamOrigin = parseOrigin(upstream).origin + + const pool = this[kClients].find((pool) => ( + pool[kUrl].origin === upstreamOrigin && + pool.closed !== true && + pool.destroyed !== true + )) + + if (pool) { + this[kRemoveClient](pool) + } + + return this + } + + get upstreams () { + return this[kClients] + .filter(dispatcher => dispatcher.closed !== true && dispatcher.destroyed !== true) + .map((p) => p[kUrl].origin) + } + + [kGetDispatcher] () { + // We validate that pools is greater than 0, + // otherwise we would have to wait until an upstream + // is added, which might never happen. + if (this[kClients].length === 0) { + throw new BalancedPoolMissingUpstreamError() + } + + const dispatcher = this[kClients].find(dispatcher => ( + !dispatcher[kNeedDrain] && + dispatcher.closed !== true && + dispatcher.destroyed !== true + )) + + if (!dispatcher) { + return + } + + const allClientsBusy = this[kClients].map(pool => pool[kNeedDrain]).reduce((a, b) => a && b, true) + + if (allClientsBusy) { + return + } + + let counter = 0 + + let maxWeightIndex = this[kClients].findIndex(pool => !pool[kNeedDrain]) + + while (counter++ < this[kClients].length) { + this[kIndex] = (this[kIndex] + 1) % this[kClients].length + const pool = this[kClients][this[kIndex]] + + // find pool index with the largest weight + if (pool[kWeight] > this[kClients][maxWeightIndex][kWeight] && !pool[kNeedDrain]) { + maxWeightIndex = this[kIndex] + } + + // decrease the current weight every `this[kClients].length`. + if (this[kIndex] === 0) { + // Set the current weight to the next lower weight. + this[kCurrentWeight] = this[kCurrentWeight] - this[kGreatestCommonDivisor] + + if (this[kCurrentWeight] <= 0) { + this[kCurrentWeight] = this[kMaxWeightPerServer] + } + } + if (pool[kWeight] >= this[kCurrentWeight] && (!pool[kNeedDrain])) { + return pool + } + } + + this[kCurrentWeight] = this[kClients][maxWeightIndex][kWeight] + this[kIndex] = maxWeightIndex + return this[kClients][maxWeightIndex] + } +} + +module.exports = BalancedPool + + +/***/ }), + +/***/ 6101: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { kConstruct } = __nccwpck_require__(9174) +const { urlEquals, fieldValues: getFieldValues } = __nccwpck_require__(2396) +const { kEnumerableProperty, isDisturbed } = __nccwpck_require__(3983) +const { kHeadersList } = __nccwpck_require__(2785) +const { webidl } = __nccwpck_require__(1744) +const { Response, cloneResponse } = __nccwpck_require__(7823) +const { Request } = __nccwpck_require__(8359) +const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(5861) +const { fetching } = __nccwpck_require__(4881) +const { urlIsHttpHttpsScheme, createDeferredPromise, readAllBytes } = __nccwpck_require__(2538) +const assert = __nccwpck_require__(9491) +const { getGlobalDispatcher } = __nccwpck_require__(1892) + +/** + * @see https://w3c.github.io/ServiceWorker/#dfn-cache-batch-operation + * @typedef {Object} CacheBatchOperation + * @property {'delete' | 'put'} type + * @property {any} request + * @property {any} response + * @property {import('../../types/cache').CacheQueryOptions} options + */ + +/** + * @see https://w3c.github.io/ServiceWorker/#dfn-request-response-list + * @typedef {[any, any][]} requestResponseList + */ + +class Cache { + /** + * @see https://w3c.github.io/ServiceWorker/#dfn-relevant-request-response-list + * @type {requestResponseList} + */ + #relevantRequestResponseList + + constructor () { + if (arguments[0] !== kConstruct) { + webidl.illegalConstructor() + } + + this.#relevantRequestResponseList = arguments[1] + } + + async match (request, options = {}) { + webidl.brandCheck(this, Cache) + webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.match' }) + + request = webidl.converters.RequestInfo(request) + options = webidl.converters.CacheQueryOptions(options) + + const p = await this.matchAll(request, options) + + if (p.length === 0) { + return + } + + return p[0] + } + + async matchAll (request = undefined, options = {}) { + webidl.brandCheck(this, Cache) + + if (request !== undefined) request = webidl.converters.RequestInfo(request) + options = webidl.converters.CacheQueryOptions(options) + + // 1. + let r = null + + // 2. + if (request !== undefined) { + if (request instanceof Request) { + // 2.1.1 + r = request[kState] + + // 2.1.2 + if (r.method !== 'GET' && !options.ignoreMethod) { + return [] + } + } else if (typeof request === 'string') { + // 2.2.1 + r = new Request(request)[kState] + } + } + + // 5. + // 5.1 + const responses = [] + + // 5.2 + if (request === undefined) { + // 5.2.1 + for (const requestResponse of this.#relevantRequestResponseList) { + responses.push(requestResponse[1]) + } + } else { // 5.3 + // 5.3.1 + const requestResponses = this.#queryCache(r, options) + + // 5.3.2 + for (const requestResponse of requestResponses) { + responses.push(requestResponse[1]) + } + } + + // 5.4 + // We don't implement CORs so we don't need to loop over the responses, yay! + + // 5.5.1 + const responseList = [] + + // 5.5.2 + for (const response of responses) { + // 5.5.2.1 + const responseObject = new Response(response.body?.source ?? null) + const body = responseObject[kState].body + responseObject[kState] = response + responseObject[kState].body = body + responseObject[kHeaders][kHeadersList] = response.headersList + responseObject[kHeaders][kGuard] = 'immutable' + + responseList.push(responseObject) + } + + // 6. + return Object.freeze(responseList) + } + + async add (request) { + webidl.brandCheck(this, Cache) + webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.add' }) + + request = webidl.converters.RequestInfo(request) + + // 1. + const requests = [request] + + // 2. + const responseArrayPromise = this.addAll(requests) + + // 3. + return await responseArrayPromise + } + + async addAll (requests) { + webidl.brandCheck(this, Cache) + webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.addAll' }) + + requests = webidl.converters['sequence'](requests) + + // 1. + const responsePromises = [] + + // 2. + const requestList = [] + + // 3. + for (const request of requests) { + if (typeof request === 'string') { + continue + } + + // 3.1 + const r = request[kState] + + // 3.2 + if (!urlIsHttpHttpsScheme(r.url) || r.method !== 'GET') { + throw webidl.errors.exception({ + header: 'Cache.addAll', + message: 'Expected http/s scheme when method is not GET.' + }) + } + } + + // 4. + /** @type {ReturnType[]} */ + const fetchControllers = [] + + // 5. + for (const request of requests) { + // 5.1 + const r = new Request(request)[kState] + + // 5.2 + if (!urlIsHttpHttpsScheme(r.url)) { + throw webidl.errors.exception({ + header: 'Cache.addAll', + message: 'Expected http/s scheme.' + }) + } + + // 5.4 + r.initiator = 'fetch' + r.destination = 'subresource' + + // 5.5 + requestList.push(r) + + // 5.6 + const responsePromise = createDeferredPromise() + + // 5.7 + fetchControllers.push(fetching({ + request: r, + dispatcher: getGlobalDispatcher(), + processResponse (response) { + // 1. + if (response.type === 'error' || response.status === 206 || response.status < 200 || response.status > 299) { + responsePromise.reject(webidl.errors.exception({ + header: 'Cache.addAll', + message: 'Received an invalid status code or the request failed.' + })) + } else if (response.headersList.contains('vary')) { // 2. + // 2.1 + const fieldValues = getFieldValues(response.headersList.get('vary')) + + // 2.2 + for (const fieldValue of fieldValues) { + // 2.2.1 + if (fieldValue === '*') { + responsePromise.reject(webidl.errors.exception({ + header: 'Cache.addAll', + message: 'invalid vary field value' + })) + + for (const controller of fetchControllers) { + controller.abort() + } + + return + } + } + } + }, + processResponseEndOfBody (response) { + // 1. + if (response.aborted) { + responsePromise.reject(new DOMException('aborted', 'AbortError')) + return + } + + // 2. + responsePromise.resolve(response) + } + })) + + // 5.8 + responsePromises.push(responsePromise.promise) + } + + // 6. + const p = Promise.all(responsePromises) + + // 7. + const responses = await p + + // 7.1 + const operations = [] + + // 7.2 + let index = 0 + + // 7.3 + for (const response of responses) { + // 7.3.1 + /** @type {CacheBatchOperation} */ + const operation = { + type: 'put', // 7.3.2 + request: requestList[index], // 7.3.3 + response // 7.3.4 + } + + operations.push(operation) // 7.3.5 + + index++ // 7.3.6 + } + + // 7.5 + const cacheJobPromise = createDeferredPromise() + + // 7.6.1 + let errorData = null + + // 7.6.2 + try { + this.#batchCacheOperations(operations) + } catch (e) { + errorData = e + } + + // 7.6.3 + queueMicrotask(() => { + // 7.6.3.1 + if (errorData === null) { + cacheJobPromise.resolve(undefined) + } else { + // 7.6.3.2 + cacheJobPromise.reject(errorData) + } + }) + + // 7.7 + return cacheJobPromise.promise + } + + async put (request, response) { + webidl.brandCheck(this, Cache) + webidl.argumentLengthCheck(arguments, 2, { header: 'Cache.put' }) + + request = webidl.converters.RequestInfo(request) + response = webidl.converters.Response(response) + + // 1. + let innerRequest = null + + // 2. + if (request instanceof Request) { + innerRequest = request[kState] + } else { // 3. + innerRequest = new Request(request)[kState] + } + + // 4. + if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== 'GET') { + throw webidl.errors.exception({ + header: 'Cache.put', + message: 'Expected an http/s scheme when method is not GET' + }) + } + + // 5. + const innerResponse = response[kState] + + // 6. + if (innerResponse.status === 206) { + throw webidl.errors.exception({ + header: 'Cache.put', + message: 'Got 206 status' + }) + } + + // 7. + if (innerResponse.headersList.contains('vary')) { + // 7.1. + const fieldValues = getFieldValues(innerResponse.headersList.get('vary')) + + // 7.2. + for (const fieldValue of fieldValues) { + // 7.2.1 + if (fieldValue === '*') { + throw webidl.errors.exception({ + header: 'Cache.put', + message: 'Got * vary field value' + }) + } + } + } + + // 8. + if (innerResponse.body && (isDisturbed(innerResponse.body.stream) || innerResponse.body.stream.locked)) { + throw webidl.errors.exception({ + header: 'Cache.put', + message: 'Response body is locked or disturbed' + }) + } + + // 9. + const clonedResponse = cloneResponse(innerResponse) + + // 10. + const bodyReadPromise = createDeferredPromise() + + // 11. + if (innerResponse.body != null) { + // 11.1 + const stream = innerResponse.body.stream + + // 11.2 + const reader = stream.getReader() + + // 11.3 + readAllBytes(reader).then(bodyReadPromise.resolve, bodyReadPromise.reject) + } else { + bodyReadPromise.resolve(undefined) + } + + // 12. + /** @type {CacheBatchOperation[]} */ + const operations = [] + + // 13. + /** @type {CacheBatchOperation} */ + const operation = { + type: 'put', // 14. + request: innerRequest, // 15. + response: clonedResponse // 16. + } + + // 17. + operations.push(operation) + + // 19. + const bytes = await bodyReadPromise.promise + + if (clonedResponse.body != null) { + clonedResponse.body.source = bytes + } + + // 19.1 + const cacheJobPromise = createDeferredPromise() + + // 19.2.1 + let errorData = null + + // 19.2.2 + try { + this.#batchCacheOperations(operations) + } catch (e) { + errorData = e + } + + // 19.2.3 + queueMicrotask(() => { + // 19.2.3.1 + if (errorData === null) { + cacheJobPromise.resolve() + } else { // 19.2.3.2 + cacheJobPromise.reject(errorData) + } + }) + + return cacheJobPromise.promise + } + + async delete (request, options = {}) { + webidl.brandCheck(this, Cache) + webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.delete' }) + + request = webidl.converters.RequestInfo(request) + options = webidl.converters.CacheQueryOptions(options) + + /** + * @type {Request} + */ + let r = null + + if (request instanceof Request) { + r = request[kState] + + if (r.method !== 'GET' && !options.ignoreMethod) { + return false + } + } else { + assert(typeof request === 'string') + + r = new Request(request)[kState] + } + + /** @type {CacheBatchOperation[]} */ + const operations = [] + + /** @type {CacheBatchOperation} */ + const operation = { + type: 'delete', + request: r, + options + } + + operations.push(operation) + + const cacheJobPromise = createDeferredPromise() + + let errorData = null + let requestResponses + + try { + requestResponses = this.#batchCacheOperations(operations) + } catch (e) { + errorData = e + } + + queueMicrotask(() => { + if (errorData === null) { + cacheJobPromise.resolve(!!requestResponses?.length) + } else { + cacheJobPromise.reject(errorData) + } + }) + + return cacheJobPromise.promise + } + + /** + * @see https://w3c.github.io/ServiceWorker/#dom-cache-keys + * @param {any} request + * @param {import('../../types/cache').CacheQueryOptions} options + * @returns {readonly Request[]} + */ + async keys (request = undefined, options = {}) { + webidl.brandCheck(this, Cache) + + if (request !== undefined) request = webidl.converters.RequestInfo(request) + options = webidl.converters.CacheQueryOptions(options) + + // 1. + let r = null + + // 2. + if (request !== undefined) { + // 2.1 + if (request instanceof Request) { + // 2.1.1 + r = request[kState] + + // 2.1.2 + if (r.method !== 'GET' && !options.ignoreMethod) { + return [] + } + } else if (typeof request === 'string') { // 2.2 + r = new Request(request)[kState] + } + } + + // 4. + const promise = createDeferredPromise() + + // 5. + // 5.1 + const requests = [] + + // 5.2 + if (request === undefined) { + // 5.2.1 + for (const requestResponse of this.#relevantRequestResponseList) { + // 5.2.1.1 + requests.push(requestResponse[0]) + } + } else { // 5.3 + // 5.3.1 + const requestResponses = this.#queryCache(r, options) + + // 5.3.2 + for (const requestResponse of requestResponses) { + // 5.3.2.1 + requests.push(requestResponse[0]) + } + } + + // 5.4 + queueMicrotask(() => { + // 5.4.1 + const requestList = [] + + // 5.4.2 + for (const request of requests) { + const requestObject = new Request('https://a') + requestObject[kState] = request + requestObject[kHeaders][kHeadersList] = request.headersList + requestObject[kHeaders][kGuard] = 'immutable' + requestObject[kRealm] = request.client + + // 5.4.2.1 + requestList.push(requestObject) + } + + // 5.4.3 + promise.resolve(Object.freeze(requestList)) + }) + + return promise.promise + } + + /** + * @see https://w3c.github.io/ServiceWorker/#batch-cache-operations-algorithm + * @param {CacheBatchOperation[]} operations + * @returns {requestResponseList} + */ + #batchCacheOperations (operations) { + // 1. + const cache = this.#relevantRequestResponseList + + // 2. + const backupCache = [...cache] + + // 3. + const addedItems = [] + + // 4.1 + const resultList = [] + + try { + // 4.2 + for (const operation of operations) { + // 4.2.1 + if (operation.type !== 'delete' && operation.type !== 'put') { + throw webidl.errors.exception({ + header: 'Cache.#batchCacheOperations', + message: 'operation type does not match "delete" or "put"' + }) + } + + // 4.2.2 + if (operation.type === 'delete' && operation.response != null) { + throw webidl.errors.exception({ + header: 'Cache.#batchCacheOperations', + message: 'delete operation should not have an associated response' + }) + } + + // 4.2.3 + if (this.#queryCache(operation.request, operation.options, addedItems).length) { + throw new DOMException('???', 'InvalidStateError') + } + + // 4.2.4 + let requestResponses + + // 4.2.5 + if (operation.type === 'delete') { + // 4.2.5.1 + requestResponses = this.#queryCache(operation.request, operation.options) + + // TODO: the spec is wrong, this is needed to pass WPTs + if (requestResponses.length === 0) { + return [] + } + + // 4.2.5.2 + for (const requestResponse of requestResponses) { + const idx = cache.indexOf(requestResponse) + assert(idx !== -1) + + // 4.2.5.2.1 + cache.splice(idx, 1) + } + } else if (operation.type === 'put') { // 4.2.6 + // 4.2.6.1 + if (operation.response == null) { + throw webidl.errors.exception({ + header: 'Cache.#batchCacheOperations', + message: 'put operation should have an associated response' + }) + } + + // 4.2.6.2 + const r = operation.request + + // 4.2.6.3 + if (!urlIsHttpHttpsScheme(r.url)) { + throw webidl.errors.exception({ + header: 'Cache.#batchCacheOperations', + message: 'expected http or https scheme' + }) + } + + // 4.2.6.4 + if (r.method !== 'GET') { + throw webidl.errors.exception({ + header: 'Cache.#batchCacheOperations', + message: 'not get method' + }) + } + + // 4.2.6.5 + if (operation.options != null) { + throw webidl.errors.exception({ + header: 'Cache.#batchCacheOperations', + message: 'options must not be defined' + }) + } + + // 4.2.6.6 + requestResponses = this.#queryCache(operation.request) + + // 4.2.6.7 + for (const requestResponse of requestResponses) { + const idx = cache.indexOf(requestResponse) + assert(idx !== -1) + + // 4.2.6.7.1 + cache.splice(idx, 1) + } + + // 4.2.6.8 + cache.push([operation.request, operation.response]) + + // 4.2.6.10 + addedItems.push([operation.request, operation.response]) + } + + // 4.2.7 + resultList.push([operation.request, operation.response]) + } + + // 4.3 + return resultList + } catch (e) { // 5. + // 5.1 + this.#relevantRequestResponseList.length = 0 + + // 5.2 + this.#relevantRequestResponseList = backupCache + + // 5.3 + throw e + } + } + + /** + * @see https://w3c.github.io/ServiceWorker/#query-cache + * @param {any} requestQuery + * @param {import('../../types/cache').CacheQueryOptions} options + * @param {requestResponseList} targetStorage + * @returns {requestResponseList} + */ + #queryCache (requestQuery, options, targetStorage) { + /** @type {requestResponseList} */ + const resultList = [] + + const storage = targetStorage ?? this.#relevantRequestResponseList + + for (const requestResponse of storage) { + const [cachedRequest, cachedResponse] = requestResponse + if (this.#requestMatchesCachedItem(requestQuery, cachedRequest, cachedResponse, options)) { + resultList.push(requestResponse) + } + } + + return resultList + } + + /** + * @see https://w3c.github.io/ServiceWorker/#request-matches-cached-item-algorithm + * @param {any} requestQuery + * @param {any} request + * @param {any | null} response + * @param {import('../../types/cache').CacheQueryOptions | undefined} options + * @returns {boolean} + */ + #requestMatchesCachedItem (requestQuery, request, response = null, options) { + // if (options?.ignoreMethod === false && request.method === 'GET') { + // return false + // } + + const queryURL = new URL(requestQuery.url) + + const cachedURL = new URL(request.url) + + if (options?.ignoreSearch) { + cachedURL.search = '' + + queryURL.search = '' + } + + if (!urlEquals(queryURL, cachedURL, true)) { + return false + } + + if ( + response == null || + options?.ignoreVary || + !response.headersList.contains('vary') + ) { + return true + } + + const fieldValues = getFieldValues(response.headersList.get('vary')) + + for (const fieldValue of fieldValues) { + if (fieldValue === '*') { + return false + } + + const requestValue = request.headersList.get(fieldValue) + const queryValue = requestQuery.headersList.get(fieldValue) + + // If one has the header and the other doesn't, or one has + // a different value than the other, return false + if (requestValue !== queryValue) { + return false + } + } + + return true + } +} + +Object.defineProperties(Cache.prototype, { + [Symbol.toStringTag]: { + value: 'Cache', + configurable: true + }, + match: kEnumerableProperty, + matchAll: kEnumerableProperty, + add: kEnumerableProperty, + addAll: kEnumerableProperty, + put: kEnumerableProperty, + delete: kEnumerableProperty, + keys: kEnumerableProperty +}) + +const cacheQueryOptionConverters = [ + { + key: 'ignoreSearch', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'ignoreMethod', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'ignoreVary', + converter: webidl.converters.boolean, + defaultValue: false + } +] + +webidl.converters.CacheQueryOptions = webidl.dictionaryConverter(cacheQueryOptionConverters) + +webidl.converters.MultiCacheQueryOptions = webidl.dictionaryConverter([ + ...cacheQueryOptionConverters, + { + key: 'cacheName', + converter: webidl.converters.DOMString + } +]) + +webidl.converters.Response = webidl.interfaceConverter(Response) + +webidl.converters['sequence'] = webidl.sequenceConverter( + webidl.converters.RequestInfo +) + +module.exports = { + Cache +} + + +/***/ }), + +/***/ 7907: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { kConstruct } = __nccwpck_require__(9174) +const { Cache } = __nccwpck_require__(6101) +const { webidl } = __nccwpck_require__(1744) +const { kEnumerableProperty } = __nccwpck_require__(3983) + +class CacheStorage { + /** + * @see https://w3c.github.io/ServiceWorker/#dfn-relevant-name-to-cache-map + * @type {Map} + */ + async has (cacheName) { + webidl.brandCheck(this, CacheStorage) + webidl.argumentLengthCheck(arguments, 1, { header: 'CacheStorage.has' }) + + cacheName = webidl.converters.DOMString(cacheName) + + // 2.1.1 + // 2.2 + return this.#caches.has(cacheName) + } + + /** + * @see https://w3c.github.io/ServiceWorker/#dom-cachestorage-open + * @param {string} cacheName + * @returns {Promise} + */ + async open (cacheName) { + webidl.brandCheck(this, CacheStorage) + webidl.argumentLengthCheck(arguments, 1, { header: 'CacheStorage.open' }) + + cacheName = webidl.converters.DOMString(cacheName) + + // 2.1 + if (this.#caches.has(cacheName)) { + // await caches.open('v1') !== await caches.open('v1') + + // 2.1.1 + const cache = this.#caches.get(cacheName) + + // 2.1.1.1 + return new Cache(kConstruct, cache) + } + + // 2.2 + const cache = [] + + // 2.3 + this.#caches.set(cacheName, cache) + + // 2.4 + return new Cache(kConstruct, cache) + } + + /** + * @see https://w3c.github.io/ServiceWorker/#cache-storage-delete + * @param {string} cacheName + * @returns {Promise} + */ + async delete (cacheName) { + webidl.brandCheck(this, CacheStorage) + webidl.argumentLengthCheck(arguments, 1, { header: 'CacheStorage.delete' }) + + cacheName = webidl.converters.DOMString(cacheName) + + return this.#caches.delete(cacheName) + } + + /** + * @see https://w3c.github.io/ServiceWorker/#cache-storage-keys + * @returns {string[]} + */ + async keys () { + webidl.brandCheck(this, CacheStorage) + + // 2.1 + const keys = this.#caches.keys() + + // 2.2 + return [...keys] + } +} + +Object.defineProperties(CacheStorage.prototype, { + [Symbol.toStringTag]: { + value: 'CacheStorage', + configurable: true + }, + match: kEnumerableProperty, + has: kEnumerableProperty, + open: kEnumerableProperty, + delete: kEnumerableProperty, + keys: kEnumerableProperty +}) + +module.exports = { + CacheStorage +} + + +/***/ }), + +/***/ 9174: +/***/ ((module) => { + +"use strict"; + + +module.exports = { + kConstruct: Symbol('constructable') +} + + +/***/ }), + +/***/ 2396: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const assert = __nccwpck_require__(9491) +const { URLSerializer } = __nccwpck_require__(685) +const { isValidHeaderName } = __nccwpck_require__(2538) + +/** + * @see https://url.spec.whatwg.org/#concept-url-equals + * @param {URL} A + * @param {URL} B + * @param {boolean | undefined} excludeFragment + * @returns {boolean} + */ +function urlEquals (A, B, excludeFragment = false) { + const serializedA = URLSerializer(A, excludeFragment) + + const serializedB = URLSerializer(B, excludeFragment) + + return serializedA === serializedB +} + +/** + * @see https://github.com/chromium/chromium/blob/694d20d134cb553d8d89e5500b9148012b1ba299/content/browser/cache_storage/cache_storage_cache.cc#L260-L262 + * @param {string} header + */ +function fieldValues (header) { + assert(header !== null) + + const values = [] + + for (let value of header.split(',')) { + value = value.trim() + + if (!value.length) { + continue + } else if (!isValidHeaderName(value)) { + continue + } + + values.push(value) + } + + return values +} + +module.exports = { + urlEquals, + fieldValues +} + + +/***/ }), + +/***/ 3598: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// @ts-check + + + +/* global WebAssembly */ + +const assert = __nccwpck_require__(9491) +const net = __nccwpck_require__(1808) +const http = __nccwpck_require__(3685) +const { pipeline } = __nccwpck_require__(2781) +const util = __nccwpck_require__(3983) +const timers = __nccwpck_require__(9459) +const Request = __nccwpck_require__(2905) +const DispatcherBase = __nccwpck_require__(4839) +const { + RequestContentLengthMismatchError, + ResponseContentLengthMismatchError, + InvalidArgumentError, + RequestAbortedError, + HeadersTimeoutError, + HeadersOverflowError, + SocketError, + InformationalError, + BodyTimeoutError, + HTTPParserError, + ResponseExceededMaxSizeError, + ClientDestroyedError +} = __nccwpck_require__(8045) +const buildConnector = __nccwpck_require__(2067) +const { + kUrl, + kReset, + kServerName, + kClient, + kBusy, + kParser, + kConnect, + kBlocking, + kResuming, + kRunning, + kPending, + kSize, + kWriting, + kQueue, + kConnected, + kConnecting, + kNeedDrain, + kNoRef, + kKeepAliveDefaultTimeout, + kHostHeader, + kPendingIdx, + kRunningIdx, + kError, + kPipelining, + kSocket, + kKeepAliveTimeoutValue, + kMaxHeadersSize, + kKeepAliveMaxTimeout, + kKeepAliveTimeoutThreshold, + kHeadersTimeout, + kBodyTimeout, + kStrictContentLength, + kConnector, + kMaxRedirections, + kMaxRequests, + kCounter, + kClose, + kDestroy, + kDispatch, + kInterceptors, + kLocalAddress, + kMaxResponseSize, + kHTTPConnVersion, + // HTTP2 + kHost, + kHTTP2Session, + kHTTP2SessionState, + kHTTP2BuildRequest, + kHTTP2CopyHeaders, + kHTTP1BuildRequest +} = __nccwpck_require__(2785) + +/** @type {import('http2')} */ +let http2 +try { + http2 = __nccwpck_require__(5158) +} catch { + // @ts-ignore + http2 = { constants: {} } +} + +const { + constants: { + HTTP2_HEADER_AUTHORITY, + HTTP2_HEADER_METHOD, + HTTP2_HEADER_PATH, + HTTP2_HEADER_SCHEME, + HTTP2_HEADER_CONTENT_LENGTH, + HTTP2_HEADER_EXPECT, + HTTP2_HEADER_STATUS + } +} = http2 + +// Experimental +let h2ExperimentalWarned = false + +const FastBuffer = Buffer[Symbol.species] + +const kClosedResolve = Symbol('kClosedResolve') + +const channels = {} + +try { + const diagnosticsChannel = __nccwpck_require__(7643) + channels.sendHeaders = diagnosticsChannel.channel('undici:client:sendHeaders') + channels.beforeConnect = diagnosticsChannel.channel('undici:client:beforeConnect') + channels.connectError = diagnosticsChannel.channel('undici:client:connectError') + channels.connected = diagnosticsChannel.channel('undici:client:connected') +} catch { + channels.sendHeaders = { hasSubscribers: false } + channels.beforeConnect = { hasSubscribers: false } + channels.connectError = { hasSubscribers: false } + channels.connected = { hasSubscribers: false } +} + +/** + * @type {import('../types/client').default} + */ +class Client extends DispatcherBase { + /** + * + * @param {string|URL} url + * @param {import('../types/client').Client.Options} options + */ + constructor (url, { + interceptors, + maxHeaderSize, + headersTimeout, + socketTimeout, + requestTimeout, + connectTimeout, + bodyTimeout, + idleTimeout, + keepAlive, + keepAliveTimeout, + maxKeepAliveTimeout, + keepAliveMaxTimeout, + keepAliveTimeoutThreshold, + socketPath, + pipelining, + tls, + strictContentLength, + maxCachedSessions, + maxRedirections, + connect, + maxRequestsPerClient, + localAddress, + maxResponseSize, + autoSelectFamily, + autoSelectFamilyAttemptTimeout, + // h2 + allowH2, + maxConcurrentStreams + } = {}) { + super() + + if (keepAlive !== undefined) { + throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead') + } + + if (socketTimeout !== undefined) { + throw new InvalidArgumentError('unsupported socketTimeout, use headersTimeout & bodyTimeout instead') + } + + if (requestTimeout !== undefined) { + throw new InvalidArgumentError('unsupported requestTimeout, use headersTimeout & bodyTimeout instead') + } + + if (idleTimeout !== undefined) { + throw new InvalidArgumentError('unsupported idleTimeout, use keepAliveTimeout instead') + } + + if (maxKeepAliveTimeout !== undefined) { + throw new InvalidArgumentError('unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead') + } + + if (maxHeaderSize != null && !Number.isFinite(maxHeaderSize)) { + throw new InvalidArgumentError('invalid maxHeaderSize') + } + + if (socketPath != null && typeof socketPath !== 'string') { + throw new InvalidArgumentError('invalid socketPath') + } + + if (connectTimeout != null && (!Number.isFinite(connectTimeout) || connectTimeout < 0)) { + throw new InvalidArgumentError('invalid connectTimeout') + } + + if (keepAliveTimeout != null && (!Number.isFinite(keepAliveTimeout) || keepAliveTimeout <= 0)) { + throw new InvalidArgumentError('invalid keepAliveTimeout') + } + + if (keepAliveMaxTimeout != null && (!Number.isFinite(keepAliveMaxTimeout) || keepAliveMaxTimeout <= 0)) { + throw new InvalidArgumentError('invalid keepAliveMaxTimeout') + } + + if (keepAliveTimeoutThreshold != null && !Number.isFinite(keepAliveTimeoutThreshold)) { + throw new InvalidArgumentError('invalid keepAliveTimeoutThreshold') + } + + if (headersTimeout != null && (!Number.isInteger(headersTimeout) || headersTimeout < 0)) { + throw new InvalidArgumentError('headersTimeout must be a positive integer or zero') + } + + if (bodyTimeout != null && (!Number.isInteger(bodyTimeout) || bodyTimeout < 0)) { + throw new InvalidArgumentError('bodyTimeout must be a positive integer or zero') + } + + if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') { + throw new InvalidArgumentError('connect must be a function or an object') + } + + if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) { + throw new InvalidArgumentError('maxRedirections must be a positive number') + } + + if (maxRequestsPerClient != null && (!Number.isInteger(maxRequestsPerClient) || maxRequestsPerClient < 0)) { + throw new InvalidArgumentError('maxRequestsPerClient must be a positive number') + } + + if (localAddress != null && (typeof localAddress !== 'string' || net.isIP(localAddress) === 0)) { + throw new InvalidArgumentError('localAddress must be valid string IP address') + } + + if (maxResponseSize != null && (!Number.isInteger(maxResponseSize) || maxResponseSize < -1)) { + throw new InvalidArgumentError('maxResponseSize must be a positive number') + } + + if ( + autoSelectFamilyAttemptTimeout != null && + (!Number.isInteger(autoSelectFamilyAttemptTimeout) || autoSelectFamilyAttemptTimeout < -1) + ) { + throw new InvalidArgumentError('autoSelectFamilyAttemptTimeout must be a positive number') + } + + // h2 + if (allowH2 != null && typeof allowH2 !== 'boolean') { + throw new InvalidArgumentError('allowH2 must be a valid boolean value') + } + + if (maxConcurrentStreams != null && (typeof maxConcurrentStreams !== 'number' || maxConcurrentStreams < 1)) { + throw new InvalidArgumentError('maxConcurrentStreams must be a possitive integer, greater than 0') + } + + if (typeof connect !== 'function') { + connect = buildConnector({ + ...tls, + maxCachedSessions, + allowH2, + socketPath, + timeout: connectTimeout, + ...(util.nodeHasAutoSelectFamily && autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : undefined), + ...connect + }) + } + + this[kInterceptors] = interceptors && interceptors.Client && Array.isArray(interceptors.Client) + ? interceptors.Client + : [createRedirectInterceptor({ maxRedirections })] + this[kUrl] = util.parseOrigin(url) + this[kConnector] = connect + this[kSocket] = null + this[kPipelining] = pipelining != null ? pipelining : 1 + this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize + this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout + this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 600e3 : keepAliveMaxTimeout + this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 1e3 : keepAliveTimeoutThreshold + this[kKeepAliveTimeoutValue] = this[kKeepAliveDefaultTimeout] + this[kServerName] = null + this[kLocalAddress] = localAddress != null ? localAddress : null + this[kResuming] = 0 // 0, idle, 1, scheduled, 2 resuming + this[kNeedDrain] = 0 // 0, idle, 1, scheduled, 2 resuming + this[kHostHeader] = `host: ${this[kUrl].hostname}${this[kUrl].port ? `:${this[kUrl].port}` : ''}\r\n` + this[kBodyTimeout] = bodyTimeout != null ? bodyTimeout : 300e3 + this[kHeadersTimeout] = headersTimeout != null ? headersTimeout : 300e3 + this[kStrictContentLength] = strictContentLength == null ? true : strictContentLength + this[kMaxRedirections] = maxRedirections + this[kMaxRequests] = maxRequestsPerClient + this[kClosedResolve] = null + this[kMaxResponseSize] = maxResponseSize > -1 ? maxResponseSize : -1 + this[kHTTPConnVersion] = 'h1' + + // HTTP/2 + this[kHTTP2Session] = null + this[kHTTP2SessionState] = !allowH2 + ? null + : { + // streams: null, // Fixed queue of streams - For future support of `push` + openStreams: 0, // Keep track of them to decide wether or not unref the session + maxConcurrentStreams: maxConcurrentStreams != null ? maxConcurrentStreams : 100 // Max peerConcurrentStreams for a Node h2 server + } + this[kHost] = `${this[kUrl].hostname}${this[kUrl].port ? `:${this[kUrl].port}` : ''}` + + // kQueue is built up of 3 sections separated by + // the kRunningIdx and kPendingIdx indices. + // | complete | running | pending | + // ^ kRunningIdx ^ kPendingIdx ^ kQueue.length + // kRunningIdx points to the first running element. + // kPendingIdx points to the first pending element. + // This implements a fast queue with an amortized + // time of O(1). + + this[kQueue] = [] + this[kRunningIdx] = 0 + this[kPendingIdx] = 0 + } + + get pipelining () { + return this[kPipelining] + } + + set pipelining (value) { + this[kPipelining] = value + resume(this, true) + } + + get [kPending] () { + return this[kQueue].length - this[kPendingIdx] + } + + get [kRunning] () { + return this[kPendingIdx] - this[kRunningIdx] + } + + get [kSize] () { + return this[kQueue].length - this[kRunningIdx] + } + + get [kConnected] () { + return !!this[kSocket] && !this[kConnecting] && !this[kSocket].destroyed + } + + get [kBusy] () { + const socket = this[kSocket] + return ( + (socket && (socket[kReset] || socket[kWriting] || socket[kBlocking])) || + (this[kSize] >= (this[kPipelining] || 1)) || + this[kPending] > 0 + ) + } + + /* istanbul ignore: only used for test */ + [kConnect] (cb) { + connect(this) + this.once('connect', cb) + } + + [kDispatch] (opts, handler) { + const origin = opts.origin || this[kUrl].origin + + const request = this[kHTTPConnVersion] === 'h2' + ? Request[kHTTP2BuildRequest](origin, opts, handler) + : Request[kHTTP1BuildRequest](origin, opts, handler) + + this[kQueue].push(request) + if (this[kResuming]) { + // Do nothing. + } else if (util.bodyLength(request.body) == null && util.isIterable(request.body)) { + // Wait a tick in case stream/iterator is ended in the same tick. + this[kResuming] = 1 + process.nextTick(resume, this) + } else { + resume(this, true) + } + + if (this[kResuming] && this[kNeedDrain] !== 2 && this[kBusy]) { + this[kNeedDrain] = 2 + } + + return this[kNeedDrain] < 2 + } + + async [kClose] () { + // TODO: for H2 we need to gracefully flush the remaining enqueued + // request and close each stream. + return new Promise((resolve) => { + if (!this[kSize]) { + resolve(null) + } else { + this[kClosedResolve] = resolve + } + }) + } + + async [kDestroy] (err) { + return new Promise((resolve) => { + const requests = this[kQueue].splice(this[kPendingIdx]) + for (let i = 0; i < requests.length; i++) { + const request = requests[i] + errorRequest(this, request, err) + } + + const callback = () => { + if (this[kClosedResolve]) { + // TODO (fix): Should we error here with ClientDestroyedError? + this[kClosedResolve]() + this[kClosedResolve] = null + } + resolve() + } + + if (this[kHTTP2Session] != null) { + util.destroy(this[kHTTP2Session], err) + this[kHTTP2Session] = null + this[kHTTP2SessionState] = null + } + + if (!this[kSocket]) { + queueMicrotask(callback) + } else { + util.destroy(this[kSocket].on('close', callback), err) + } + + resume(this) + }) + } +} + +function onHttp2SessionError (err) { + assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID') + + this[kSocket][kError] = err + + onError(this[kClient], err) +} + +function onHttp2FrameError (type, code, id) { + const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`) + + if (id === 0) { + this[kSocket][kError] = err + onError(this[kClient], err) + } +} + +function onHttp2SessionEnd () { + util.destroy(this, new SocketError('other side closed')) + util.destroy(this[kSocket], new SocketError('other side closed')) +} + +function onHTTP2GoAway (code) { + const client = this[kClient] + const err = new InformationalError(`HTTP/2: "GOAWAY" frame received with code ${code}`) + client[kSocket] = null + client[kHTTP2Session] = null + + if (client.destroyed) { + assert(this[kPending] === 0) + + // Fail entire queue. + const requests = client[kQueue].splice(client[kRunningIdx]) + for (let i = 0; i < requests.length; i++) { + const request = requests[i] + errorRequest(this, request, err) + } + } else if (client[kRunning] > 0) { + // Fail head of pipeline. + const request = client[kQueue][client[kRunningIdx]] + client[kQueue][client[kRunningIdx]++] = null + + errorRequest(client, request, err) + } + + client[kPendingIdx] = client[kRunningIdx] + + assert(client[kRunning] === 0) + + client.emit('disconnect', + client[kUrl], + [client], + err + ) + + resume(client) +} + +const constants = __nccwpck_require__(953) +const createRedirectInterceptor = __nccwpck_require__(8861) +const EMPTY_BUF = Buffer.alloc(0) + +async function lazyllhttp () { + const llhttpWasmData = process.env.JEST_WORKER_ID ? __nccwpck_require__(1145) : undefined + + let mod + try { + mod = await WebAssembly.compile(Buffer.from(__nccwpck_require__(5627), 'base64')) + } catch (e) { + /* istanbul ignore next */ + + // We could check if the error was caused by the simd option not + // being enabled, but the occurring of this other error + // * https://github.com/emscripten-core/emscripten/issues/11495 + // got me to remove that check to avoid breaking Node 12. + mod = await WebAssembly.compile(Buffer.from(llhttpWasmData || __nccwpck_require__(1145), 'base64')) + } + + return await WebAssembly.instantiate(mod, { + env: { + /* eslint-disable camelcase */ + + wasm_on_url: (p, at, len) => { + /* istanbul ignore next */ + return 0 + }, + wasm_on_status: (p, at, len) => { + assert.strictEqual(currentParser.ptr, p) + const start = at - currentBufferPtr + currentBufferRef.byteOffset + return currentParser.onStatus(new FastBuffer(currentBufferRef.buffer, start, len)) || 0 + }, + wasm_on_message_begin: (p) => { + assert.strictEqual(currentParser.ptr, p) + return currentParser.onMessageBegin() || 0 + }, + wasm_on_header_field: (p, at, len) => { + assert.strictEqual(currentParser.ptr, p) + const start = at - currentBufferPtr + currentBufferRef.byteOffset + return currentParser.onHeaderField(new FastBuffer(currentBufferRef.buffer, start, len)) || 0 + }, + wasm_on_header_value: (p, at, len) => { + assert.strictEqual(currentParser.ptr, p) + const start = at - currentBufferPtr + currentBufferRef.byteOffset + return currentParser.onHeaderValue(new FastBuffer(currentBufferRef.buffer, start, len)) || 0 + }, + wasm_on_headers_complete: (p, statusCode, upgrade, shouldKeepAlive) => { + assert.strictEqual(currentParser.ptr, p) + return currentParser.onHeadersComplete(statusCode, Boolean(upgrade), Boolean(shouldKeepAlive)) || 0 + }, + wasm_on_body: (p, at, len) => { + assert.strictEqual(currentParser.ptr, p) + const start = at - currentBufferPtr + currentBufferRef.byteOffset + return currentParser.onBody(new FastBuffer(currentBufferRef.buffer, start, len)) || 0 + }, + wasm_on_message_complete: (p) => { + assert.strictEqual(currentParser.ptr, p) + return currentParser.onMessageComplete() || 0 + } + + /* eslint-enable camelcase */ + } + }) +} + +let llhttpInstance = null +let llhttpPromise = lazyllhttp() +llhttpPromise.catch() + +let currentParser = null +let currentBufferRef = null +let currentBufferSize = 0 +let currentBufferPtr = null + +const TIMEOUT_HEADERS = 1 +const TIMEOUT_BODY = 2 +const TIMEOUT_IDLE = 3 + +class Parser { + constructor (client, socket, { exports }) { + assert(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0) + + this.llhttp = exports + this.ptr = this.llhttp.llhttp_alloc(constants.TYPE.RESPONSE) + this.client = client + this.socket = socket + this.timeout = null + this.timeoutValue = null + this.timeoutType = null + this.statusCode = null + this.statusText = '' + this.upgrade = false + this.headers = [] + this.headersSize = 0 + this.headersMaxSize = client[kMaxHeadersSize] + this.shouldKeepAlive = false + this.paused = false + this.resume = this.resume.bind(this) + + this.bytesRead = 0 + + this.keepAlive = '' + this.contentLength = '' + this.connection = '' + this.maxResponseSize = client[kMaxResponseSize] + } + + setTimeout (value, type) { + this.timeoutType = type + if (value !== this.timeoutValue) { + timers.clearTimeout(this.timeout) + if (value) { + this.timeout = timers.setTimeout(onParserTimeout, value, this) + // istanbul ignore else: only for jest + if (this.timeout.unref) { + this.timeout.unref() + } + } else { + this.timeout = null + } + this.timeoutValue = value + } else if (this.timeout) { + // istanbul ignore else: only for jest + if (this.timeout.refresh) { + this.timeout.refresh() + } + } + } + + resume () { + if (this.socket.destroyed || !this.paused) { + return + } + + assert(this.ptr != null) + assert(currentParser == null) + + this.llhttp.llhttp_resume(this.ptr) + + assert(this.timeoutType === TIMEOUT_BODY) + if (this.timeout) { + // istanbul ignore else: only for jest + if (this.timeout.refresh) { + this.timeout.refresh() + } + } + + this.paused = false + this.execute(this.socket.read() || EMPTY_BUF) // Flush parser. + this.readMore() + } + + readMore () { + while (!this.paused && this.ptr) { + const chunk = this.socket.read() + if (chunk === null) { + break + } + this.execute(chunk) + } + } + + execute (data) { + assert(this.ptr != null) + assert(currentParser == null) + assert(!this.paused) + + const { socket, llhttp } = this + + if (data.length > currentBufferSize) { + if (currentBufferPtr) { + llhttp.free(currentBufferPtr) + } + currentBufferSize = Math.ceil(data.length / 4096) * 4096 + currentBufferPtr = llhttp.malloc(currentBufferSize) + } + + new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(data) + + // Call `execute` on the wasm parser. + // We pass the `llhttp_parser` pointer address, the pointer address of buffer view data, + // and finally the length of bytes to parse. + // The return value is an error code or `constants.ERROR.OK`. + try { + let ret + + try { + currentBufferRef = data + currentParser = this + ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr, data.length) + /* eslint-disable-next-line no-useless-catch */ + } catch (err) { + /* istanbul ignore next: difficult to make a test case for */ + throw err + } finally { + currentParser = null + currentBufferRef = null + } + + const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr + + if (ret === constants.ERROR.PAUSED_UPGRADE) { + this.onUpgrade(data.slice(offset)) + } else if (ret === constants.ERROR.PAUSED) { + this.paused = true + socket.unshift(data.slice(offset)) + } else if (ret !== constants.ERROR.OK) { + const ptr = llhttp.llhttp_get_error_reason(this.ptr) + let message = '' + /* istanbul ignore else: difficult to make a test case for */ + if (ptr) { + const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0) + message = + 'Response does not match the HTTP/1.1 protocol (' + + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + + ')' + } + throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset)) + } + } catch (err) { + util.destroy(socket, err) + } + } + + destroy () { + assert(this.ptr != null) + assert(currentParser == null) + + this.llhttp.llhttp_free(this.ptr) + this.ptr = null + + timers.clearTimeout(this.timeout) + this.timeout = null + this.timeoutValue = null + this.timeoutType = null + + this.paused = false + } + + onStatus (buf) { + this.statusText = buf.toString() + } + + onMessageBegin () { + const { socket, client } = this + + /* istanbul ignore next: difficult to make a test case for */ + if (socket.destroyed) { + return -1 + } + + const request = client[kQueue][client[kRunningIdx]] + if (!request) { + return -1 + } + } + + onHeaderField (buf) { + const len = this.headers.length + + if ((len & 1) === 0) { + this.headers.push(buf) + } else { + this.headers[len - 1] = Buffer.concat([this.headers[len - 1], buf]) + } + + this.trackHeader(buf.length) + } + + onHeaderValue (buf) { + let len = this.headers.length + + if ((len & 1) === 1) { + this.headers.push(buf) + len += 1 + } else { + this.headers[len - 1] = Buffer.concat([this.headers[len - 1], buf]) + } + + const key = this.headers[len - 2] + if (key.length === 10 && key.toString().toLowerCase() === 'keep-alive') { + this.keepAlive += buf.toString() + } else if (key.length === 10 && key.toString().toLowerCase() === 'connection') { + this.connection += buf.toString() + } else if (key.length === 14 && key.toString().toLowerCase() === 'content-length') { + this.contentLength += buf.toString() + } + + this.trackHeader(buf.length) + } + + trackHeader (len) { + this.headersSize += len + if (this.headersSize >= this.headersMaxSize) { + util.destroy(this.socket, new HeadersOverflowError()) + } + } + + onUpgrade (head) { + const { upgrade, client, socket, headers, statusCode } = this + + assert(upgrade) + + const request = client[kQueue][client[kRunningIdx]] + assert(request) + + assert(!socket.destroyed) + assert(socket === client[kSocket]) + assert(!this.paused) + assert(request.upgrade || request.method === 'CONNECT') + + this.statusCode = null + this.statusText = '' + this.shouldKeepAlive = null + + assert(this.headers.length % 2 === 0) + this.headers = [] + this.headersSize = 0 + + socket.unshift(head) + + socket[kParser].destroy() + socket[kParser] = null + + socket[kClient] = null + socket[kError] = null + socket + .removeListener('error', onSocketError) + .removeListener('readable', onSocketReadable) + .removeListener('end', onSocketEnd) + .removeListener('close', onSocketClose) + + client[kSocket] = null + client[kQueue][client[kRunningIdx]++] = null + client.emit('disconnect', client[kUrl], [client], new InformationalError('upgrade')) + + try { + request.onUpgrade(statusCode, headers, socket) + } catch (err) { + util.destroy(socket, err) + } + + resume(client) + } + + onHeadersComplete (statusCode, upgrade, shouldKeepAlive) { + const { client, socket, headers, statusText } = this + + /* istanbul ignore next: difficult to make a test case for */ + if (socket.destroyed) { + return -1 + } + + const request = client[kQueue][client[kRunningIdx]] + + /* istanbul ignore next: difficult to make a test case for */ + if (!request) { + return -1 + } + + assert(!this.upgrade) + assert(this.statusCode < 200) + + if (statusCode === 100) { + util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket))) + return -1 + } + + /* this can only happen if server is misbehaving */ + if (upgrade && !request.upgrade) { + util.destroy(socket, new SocketError('bad upgrade', util.getSocketInfo(socket))) + return -1 + } + + assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS) + + this.statusCode = statusCode + this.shouldKeepAlive = ( + shouldKeepAlive || + // Override llhttp value which does not allow keepAlive for HEAD. + (request.method === 'HEAD' && !socket[kReset] && this.connection.toLowerCase() === 'keep-alive') + ) + + if (this.statusCode >= 200) { + const bodyTimeout = request.bodyTimeout != null + ? request.bodyTimeout + : client[kBodyTimeout] + this.setTimeout(bodyTimeout, TIMEOUT_BODY) + } else if (this.timeout) { + // istanbul ignore else: only for jest + if (this.timeout.refresh) { + this.timeout.refresh() + } + } + + if (request.method === 'CONNECT') { + assert(client[kRunning] === 1) + this.upgrade = true + return 2 + } + + if (upgrade) { + assert(client[kRunning] === 1) + this.upgrade = true + return 2 + } + + assert(this.headers.length % 2 === 0) + this.headers = [] + this.headersSize = 0 + + if (this.shouldKeepAlive && client[kPipelining]) { + const keepAliveTimeout = this.keepAlive ? util.parseKeepAliveTimeout(this.keepAlive) : null + + if (keepAliveTimeout != null) { + const timeout = Math.min( + keepAliveTimeout - client[kKeepAliveTimeoutThreshold], + client[kKeepAliveMaxTimeout] + ) + if (timeout <= 0) { + socket[kReset] = true + } else { + client[kKeepAliveTimeoutValue] = timeout + } + } else { + client[kKeepAliveTimeoutValue] = client[kKeepAliveDefaultTimeout] + } + } else { + // Stop more requests from being dispatched. + socket[kReset] = true + } + + let pause + try { + pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false + } catch (err) { + util.destroy(socket, err) + return -1 + } + + if (request.method === 'HEAD') { + return 1 + } + + if (statusCode < 200) { + return 1 + } + + if (socket[kBlocking]) { + socket[kBlocking] = false + resume(client) + } + + return pause ? constants.ERROR.PAUSED : 0 + } + + onBody (buf) { + const { client, socket, statusCode, maxResponseSize } = this + + if (socket.destroyed) { + return -1 + } + + const request = client[kQueue][client[kRunningIdx]] + assert(request) + + assert.strictEqual(this.timeoutType, TIMEOUT_BODY) + if (this.timeout) { + // istanbul ignore else: only for jest + if (this.timeout.refresh) { + this.timeout.refresh() + } + } + + assert(statusCode >= 200) + + if (maxResponseSize > -1 && this.bytesRead + buf.length > maxResponseSize) { + util.destroy(socket, new ResponseExceededMaxSizeError()) + return -1 + } + + this.bytesRead += buf.length + + try { + if (request.onData(buf) === false) { + return constants.ERROR.PAUSED + } + } catch (err) { + util.destroy(socket, err) + return -1 + } + } + + onMessageComplete () { + const { client, socket, statusCode, upgrade, headers, contentLength, bytesRead, shouldKeepAlive } = this + + if (socket.destroyed && (!statusCode || shouldKeepAlive)) { + return -1 + } + + if (upgrade) { + return + } + + const request = client[kQueue][client[kRunningIdx]] + assert(request) + + assert(statusCode >= 100) + + this.statusCode = null + this.statusText = '' + this.bytesRead = 0 + this.contentLength = '' + this.keepAlive = '' + this.connection = '' + + assert(this.headers.length % 2 === 0) + this.headers = [] + this.headersSize = 0 + + if (statusCode < 200) { + return + } + + /* istanbul ignore next: should be handled by llhttp? */ + if (request.method !== 'HEAD' && contentLength && bytesRead !== parseInt(contentLength, 10)) { + util.destroy(socket, new ResponseContentLengthMismatchError()) + return -1 + } + + try { + request.onComplete(headers) + } catch (err) { + errorRequest(client, request, err) + } + + client[kQueue][client[kRunningIdx]++] = null + + if (socket[kWriting]) { + assert.strictEqual(client[kRunning], 0) + // Response completed before request. + util.destroy(socket, new InformationalError('reset')) + return constants.ERROR.PAUSED + } else if (!shouldKeepAlive) { + util.destroy(socket, new InformationalError('reset')) + return constants.ERROR.PAUSED + } else if (socket[kReset] && client[kRunning] === 0) { + // Destroy socket once all requests have completed. + // The request at the tail of the pipeline is the one + // that requested reset and no further requests should + // have been queued since then. + util.destroy(socket, new InformationalError('reset')) + return constants.ERROR.PAUSED + } else if (client[kPipelining] === 1) { + // We must wait a full event loop cycle to reuse this socket to make sure + // that non-spec compliant servers are not closing the connection even if they + // said they won't. + setImmediate(resume, client) + } else { + resume(client) + } + } +} + +function onParserTimeout (parser) { + const { socket, timeoutType, client } = parser + + /* istanbul ignore else */ + if (timeoutType === TIMEOUT_HEADERS) { + if (!socket[kWriting] || socket.writableNeedDrain || client[kRunning] > 1) { + assert(!parser.paused, 'cannot be paused while waiting for headers') + util.destroy(socket, new HeadersTimeoutError()) + } + } else if (timeoutType === TIMEOUT_BODY) { + if (!parser.paused) { + util.destroy(socket, new BodyTimeoutError()) + } + } else if (timeoutType === TIMEOUT_IDLE) { + assert(client[kRunning] === 0 && client[kKeepAliveTimeoutValue]) + util.destroy(socket, new InformationalError('socket idle timeout')) + } +} + +function onSocketReadable () { + const { [kParser]: parser } = this + parser.readMore() +} + +function onSocketError (err) { + const { [kClient]: client, [kParser]: parser } = this + + assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID') + + if (client[kHTTPConnVersion] !== 'h2') { + // On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded + // to the user. + if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) { + // We treat all incoming data so for as a valid response. + parser.onMessageComplete() + return + } + } + + this[kError] = err + + onError(this[kClient], err) +} + +function onError (client, err) { + if ( + client[kRunning] === 0 && + err.code !== 'UND_ERR_INFO' && + err.code !== 'UND_ERR_SOCKET' + ) { + // Error is not caused by running request and not a recoverable + // socket error. + + assert(client[kPendingIdx] === client[kRunningIdx]) + + const requests = client[kQueue].splice(client[kRunningIdx]) + for (let i = 0; i < requests.length; i++) { + const request = requests[i] + errorRequest(client, request, err) + } + assert(client[kSize] === 0) + } +} + +function onSocketEnd () { + const { [kParser]: parser, [kClient]: client } = this + + if (client[kHTTPConnVersion] !== 'h2') { + if (parser.statusCode && !parser.shouldKeepAlive) { + // We treat all incoming data so far as a valid response. + parser.onMessageComplete() + return + } + } + + util.destroy(this, new SocketError('other side closed', util.getSocketInfo(this))) +} + +function onSocketClose () { + const { [kClient]: client, [kParser]: parser } = this + + if (client[kHTTPConnVersion] === 'h1' && parser) { + if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) { + // We treat all incoming data so far as a valid response. + parser.onMessageComplete() + } + + this[kParser].destroy() + this[kParser] = null + } + + const err = this[kError] || new SocketError('closed', util.getSocketInfo(this)) + + client[kSocket] = null + + if (client.destroyed) { + assert(client[kPending] === 0) + + // Fail entire queue. + const requests = client[kQueue].splice(client[kRunningIdx]) + for (let i = 0; i < requests.length; i++) { + const request = requests[i] + errorRequest(client, request, err) + } + } else if (client[kRunning] > 0 && err.code !== 'UND_ERR_INFO') { + // Fail head of pipeline. + const request = client[kQueue][client[kRunningIdx]] + client[kQueue][client[kRunningIdx]++] = null + + errorRequest(client, request, err) + } + + client[kPendingIdx] = client[kRunningIdx] + + assert(client[kRunning] === 0) + + client.emit('disconnect', client[kUrl], [client], err) + + resume(client) +} + +async function connect (client) { + assert(!client[kConnecting]) + assert(!client[kSocket]) + + let { host, hostname, protocol, port } = client[kUrl] + + // Resolve ipv6 + if (hostname[0] === '[') { + const idx = hostname.indexOf(']') + + assert(idx !== -1) + const ip = hostname.substr(1, idx - 1) + + assert(net.isIP(ip)) + hostname = ip + } + + client[kConnecting] = true + + if (channels.beforeConnect.hasSubscribers) { + channels.beforeConnect.publish({ + connectParams: { + host, + hostname, + protocol, + port, + servername: client[kServerName], + localAddress: client[kLocalAddress] + }, + connector: client[kConnector] + }) + } + + try { + const socket = await new Promise((resolve, reject) => { + client[kConnector]({ + host, + hostname, + protocol, + port, + servername: client[kServerName], + localAddress: client[kLocalAddress] + }, (err, socket) => { + if (err) { + reject(err) + } else { + resolve(socket) + } + }) + }) + + if (client.destroyed) { + util.destroy(socket.on('error', () => {}), new ClientDestroyedError()) + return + } + + client[kConnecting] = false + + assert(socket) + + const isH2 = socket.alpnProtocol === 'h2' + if (isH2) { + if (!h2ExperimentalWarned) { + h2ExperimentalWarned = true + process.emitWarning('H2 support is experimental, expect them to change at any time.', { + code: 'UNDICI-H2' + }) + } + + const session = http2.connect(client[kUrl], { + createConnection: () => socket, + peerMaxConcurrentStreams: client[kHTTP2SessionState].maxConcurrentStreams + }) + + client[kHTTPConnVersion] = 'h2' + session[kClient] = client + session[kSocket] = socket + session.on('error', onHttp2SessionError) + session.on('frameError', onHttp2FrameError) + session.on('end', onHttp2SessionEnd) + session.on('goaway', onHTTP2GoAway) + session.on('close', onSocketClose) + session.unref() + + client[kHTTP2Session] = session + socket[kHTTP2Session] = session + } else { + if (!llhttpInstance) { + llhttpInstance = await llhttpPromise + llhttpPromise = null + } + + socket[kNoRef] = false + socket[kWriting] = false + socket[kReset] = false + socket[kBlocking] = false + socket[kParser] = new Parser(client, socket, llhttpInstance) + } + + socket[kCounter] = 0 + socket[kMaxRequests] = client[kMaxRequests] + socket[kClient] = client + socket[kError] = null + + socket + .on('error', onSocketError) + .on('readable', onSocketReadable) + .on('end', onSocketEnd) + .on('close', onSocketClose) + + client[kSocket] = socket + + if (channels.connected.hasSubscribers) { + channels.connected.publish({ + connectParams: { + host, + hostname, + protocol, + port, + servername: client[kServerName], + localAddress: client[kLocalAddress] + }, + connector: client[kConnector], + socket + }) + } + client.emit('connect', client[kUrl], [client]) + } catch (err) { + if (client.destroyed) { + return + } + + client[kConnecting] = false + + if (channels.connectError.hasSubscribers) { + channels.connectError.publish({ + connectParams: { + host, + hostname, + protocol, + port, + servername: client[kServerName], + localAddress: client[kLocalAddress] + }, + connector: client[kConnector], + error: err + }) + } + + if (err.code === 'ERR_TLS_CERT_ALTNAME_INVALID') { + assert(client[kRunning] === 0) + while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { + const request = client[kQueue][client[kPendingIdx]++] + errorRequest(client, request, err) + } + } else { + onError(client, err) + } + + client.emit('connectionError', client[kUrl], [client], err) + } + + resume(client) +} + +function emitDrain (client) { + client[kNeedDrain] = 0 + client.emit('drain', client[kUrl], [client]) +} + +function resume (client, sync) { + if (client[kResuming] === 2) { + return + } + + client[kResuming] = 2 + + _resume(client, sync) + client[kResuming] = 0 + + if (client[kRunningIdx] > 256) { + client[kQueue].splice(0, client[kRunningIdx]) + client[kPendingIdx] -= client[kRunningIdx] + client[kRunningIdx] = 0 + } +} + +function _resume (client, sync) { + while (true) { + if (client.destroyed) { + assert(client[kPending] === 0) + return + } + + if (client[kClosedResolve] && !client[kSize]) { + client[kClosedResolve]() + client[kClosedResolve] = null + return + } + + const socket = client[kSocket] + + if (socket && !socket.destroyed && socket.alpnProtocol !== 'h2') { + if (client[kSize] === 0) { + if (!socket[kNoRef] && socket.unref) { + socket.unref() + socket[kNoRef] = true + } + } else if (socket[kNoRef] && socket.ref) { + socket.ref() + socket[kNoRef] = false + } + + if (client[kSize] === 0) { + if (socket[kParser].timeoutType !== TIMEOUT_IDLE) { + socket[kParser].setTimeout(client[kKeepAliveTimeoutValue], TIMEOUT_IDLE) + } + } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { + if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { + const request = client[kQueue][client[kRunningIdx]] + const headersTimeout = request.headersTimeout != null + ? request.headersTimeout + : client[kHeadersTimeout] + socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS) + } + } + } + + if (client[kBusy]) { + client[kNeedDrain] = 2 + } else if (client[kNeedDrain] === 2) { + if (sync) { + client[kNeedDrain] = 1 + process.nextTick(emitDrain, client) + } else { + emitDrain(client) + } + continue + } + + if (client[kPending] === 0) { + return + } + + if (client[kRunning] >= (client[kPipelining] || 1)) { + return + } + + const request = client[kQueue][client[kPendingIdx]] + + if (client[kUrl].protocol === 'https:' && client[kServerName] !== request.servername) { + if (client[kRunning] > 0) { + return + } + + client[kServerName] = request.servername + + if (socket && socket.servername !== request.servername) { + util.destroy(socket, new InformationalError('servername changed')) + return + } + } + + if (client[kConnecting]) { + return + } + + if (!socket && !client[kHTTP2Session]) { + connect(client) + return + } + + if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { + return + } + + if (client[kRunning] > 0 && !request.idempotent) { + // Non-idempotent request cannot be retried. + // Ensure that no other requests are inflight and + // could cause failure. + return + } + + if (client[kRunning] > 0 && (request.upgrade || request.method === 'CONNECT')) { + // Don't dispatch an upgrade until all preceding requests have completed. + // A misbehaving server might upgrade the connection before all pipelined + // request has completed. + return + } + + if (util.isStream(request.body) && util.bodyLength(request.body) === 0) { + request.body + .on('data', /* istanbul ignore next */ function () { + /* istanbul ignore next */ + assert(false) + }) + .on('error', function (err) { + errorRequest(client, request, err) + }) + .on('end', function () { + util.destroy(this) + }) + + request.body = null + } + + if (client[kRunning] > 0 && + (util.isStream(request.body) || util.isAsyncIterable(request.body))) { + // Request with stream or iterator body can error while other requests + // are inflight and indirectly error those as well. + // Ensure this doesn't happen by waiting for inflight + // to complete before dispatching. + + // Request with stream or iterator body cannot be retried. + // Ensure that no other requests are inflight and + // could cause failure. + return + } + + if (!request.aborted && write(client, request)) { + client[kPendingIdx]++ + } else { + client[kQueue].splice(client[kPendingIdx], 1) + } + } +} + +function write (client, request) { + if (client[kHTTPConnVersion] === 'h2') { + writeH2(client, client[kHTTP2Session], request) + return + } + + const { body, method, path, host, upgrade, headers, blocking, reset } = request + + // https://tools.ietf.org/html/rfc7231#section-4.3.1 + // https://tools.ietf.org/html/rfc7231#section-4.3.2 + // https://tools.ietf.org/html/rfc7231#section-4.3.5 + + // Sending a payload body on a request that does not + // expect it can cause undefined behavior on some + // servers and corrupt connection state. Do not + // re-use the connection for further requests. + + const expectsPayload = ( + method === 'PUT' || + method === 'POST' || + method === 'PATCH' + ) + + if (body && typeof body.read === 'function') { + // Try to read EOF in order to get length. + body.read(0) + } + + let contentLength = util.bodyLength(body) + + if (contentLength === null) { + contentLength = request.contentLength + } + + if (contentLength === 0 && !expectsPayload) { + // https://tools.ietf.org/html/rfc7230#section-3.3.2 + // A user agent SHOULD NOT send a Content-Length header field when + // the request message does not contain a payload body and the method + // semantics do not anticipate such a body. + + contentLength = null + } + + if (request.contentLength !== null && request.contentLength !== contentLength) { + if (client[kStrictContentLength]) { + errorRequest(client, request, new RequestContentLengthMismatchError()) + return false + } + + process.emitWarning(new RequestContentLengthMismatchError()) + } + + const socket = client[kSocket] + + try { + request.onConnect((err) => { + if (request.aborted || request.completed) { + return + } + + errorRequest(client, request, err || new RequestAbortedError()) + + util.destroy(socket, new InformationalError('aborted')) + }) + } catch (err) { + errorRequest(client, request, err) + } + + if (request.aborted) { + return false + } + + if (method === 'HEAD') { + // https://github.com/mcollina/undici/issues/258 + // Close after a HEAD request to interop with misbehaving servers + // that may send a body in the response. + + socket[kReset] = true + } + + if (upgrade || method === 'CONNECT') { + // On CONNECT or upgrade, block pipeline from dispatching further + // requests on this connection. + + socket[kReset] = true + } + + if (reset != null) { + socket[kReset] = reset + } + + if (client[kMaxRequests] && socket[kCounter]++ >= client[kMaxRequests]) { + socket[kReset] = true + } + + if (blocking) { + socket[kBlocking] = true + } + + let header = `${method} ${path} HTTP/1.1\r\n` + + if (typeof host === 'string') { + header += `host: ${host}\r\n` + } else { + header += client[kHostHeader] + } + + if (upgrade) { + header += `connection: upgrade\r\nupgrade: ${upgrade}\r\n` + } else if (client[kPipelining] && !socket[kReset]) { + header += 'connection: keep-alive\r\n' + } else { + header += 'connection: close\r\n' + } + + if (headers) { + header += headers + } + + if (channels.sendHeaders.hasSubscribers) { + channels.sendHeaders.publish({ request, headers: header, socket }) + } + + /* istanbul ignore else: assertion */ + if (!body) { + if (contentLength === 0) { + socket.write(`${header}content-length: 0\r\n\r\n`, 'latin1') + } else { + assert(contentLength === null, 'no body must not have content length') + socket.write(`${header}\r\n`, 'latin1') + } + request.onRequestSent() + } else if (util.isBuffer(body)) { + assert(contentLength === body.byteLength, 'buffer body must have content length') + + socket.cork() + socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1') + socket.write(body) + socket.uncork() + request.onBodySent(body) + request.onRequestSent() + if (!expectsPayload) { + socket[kReset] = true + } + } else if (util.isBlobLike(body)) { + if (typeof body.stream === 'function') { + writeIterable({ body: body.stream(), client, request, socket, contentLength, header, expectsPayload }) + } else { + writeBlob({ body, client, request, socket, contentLength, header, expectsPayload }) + } + } else if (util.isStream(body)) { + writeStream({ body, client, request, socket, contentLength, header, expectsPayload }) + } else if (util.isIterable(body)) { + writeIterable({ body, client, request, socket, contentLength, header, expectsPayload }) + } else { + assert(false) + } + + return true +} + +function writeH2 (client, session, request) { + const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request + + let headers + if (typeof reqHeaders === 'string') headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()) + else headers = reqHeaders + + if (upgrade) { + errorRequest(client, request, new Error('Upgrade not supported for H2')) + return false + } + + try { + // TODO(HTTP/2): Should we call onConnect immediately or on stream ready event? + request.onConnect((err) => { + if (request.aborted || request.completed) { + return + } + + errorRequest(client, request, err || new RequestAbortedError()) + }) + } catch (err) { + errorRequest(client, request, err) + } + + if (request.aborted) { + return false + } + + let stream + const h2State = client[kHTTP2SessionState] + + headers[HTTP2_HEADER_AUTHORITY] = host || client[kHost] + headers[HTTP2_HEADER_METHOD] = method + + if (method === 'CONNECT') { + session.ref() + // we are already connected, streams are pending, first request + // will create a new stream. We trigger a request to create the stream and wait until + // `ready` event is triggered + // We disabled endStream to allow the user to write to the stream + stream = session.request(headers, { endStream: false, signal }) + + if (stream.id && !stream.pending) { + request.onUpgrade(null, null, stream) + ++h2State.openStreams + } else { + stream.once('ready', () => { + request.onUpgrade(null, null, stream) + ++h2State.openStreams + }) + } + + stream.once('close', () => { + h2State.openStreams -= 1 + // TODO(HTTP/2): unref only if current streams count is 0 + if (h2State.openStreams === 0) session.unref() + }) + + return true + } + + // https://tools.ietf.org/html/rfc7540#section-8.3 + // :path and :scheme headers must be omited when sending CONNECT + + headers[HTTP2_HEADER_PATH] = path + headers[HTTP2_HEADER_SCHEME] = 'https' + + // https://tools.ietf.org/html/rfc7231#section-4.3.1 + // https://tools.ietf.org/html/rfc7231#section-4.3.2 + // https://tools.ietf.org/html/rfc7231#section-4.3.5 + + // Sending a payload body on a request that does not + // expect it can cause undefined behavior on some + // servers and corrupt connection state. Do not + // re-use the connection for further requests. + + const expectsPayload = ( + method === 'PUT' || + method === 'POST' || + method === 'PATCH' + ) + + if (body && typeof body.read === 'function') { + // Try to read EOF in order to get length. + body.read(0) + } + + let contentLength = util.bodyLength(body) + + if (contentLength == null) { + contentLength = request.contentLength + } + + if (contentLength === 0 || !expectsPayload) { + // https://tools.ietf.org/html/rfc7230#section-3.3.2 + // A user agent SHOULD NOT send a Content-Length header field when + // the request message does not contain a payload body and the method + // semantics do not anticipate such a body. + + contentLength = null + } + + if (request.contentLength != null && request.contentLength !== contentLength) { + if (client[kStrictContentLength]) { + errorRequest(client, request, new RequestContentLengthMismatchError()) + return false + } + + process.emitWarning(new RequestContentLengthMismatchError()) + } + + if (contentLength != null) { + assert(body, 'no body must not have content length') + headers[HTTP2_HEADER_CONTENT_LENGTH] = `${contentLength}` + } + + session.ref() + + const shouldEndStream = method === 'GET' || method === 'HEAD' + if (expectContinue) { + headers[HTTP2_HEADER_EXPECT] = '100-continue' + /** + * @type {import('node:http2').ClientHttp2Stream} + */ + stream = session.request(headers, { endStream: shouldEndStream, signal }) + + stream.once('continue', writeBodyH2) + } else { + /** @type {import('node:http2').ClientHttp2Stream} */ + stream = session.request(headers, { + endStream: shouldEndStream, + signal + }) + writeBodyH2() + } + + // Increment counter as we have new several streams open + ++h2State.openStreams + + stream.once('response', headers => { + if (request.onHeaders(Number(headers[HTTP2_HEADER_STATUS]), headers, stream.resume.bind(stream), '') === false) { + stream.pause() + } + }) + + stream.once('end', () => { + request.onComplete([]) + }) + + stream.on('data', (chunk) => { + if (request.onData(chunk) === false) stream.pause() + }) + + stream.once('close', () => { + h2State.openStreams -= 1 + // TODO(HTTP/2): unref only if current streams count is 0 + if (h2State.openStreams === 0) session.unref() + }) + + stream.once('error', function (err) { + if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { + h2State.streams -= 1 + util.destroy(stream, err) + } + }) + + stream.once('frameError', (type, code) => { + const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`) + errorRequest(client, request, err) + + if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { + h2State.streams -= 1 + util.destroy(stream, err) + } + }) + + // stream.on('aborted', () => { + // // TODO(HTTP/2): Support aborted + // }) + + // stream.on('timeout', () => { + // // TODO(HTTP/2): Support timeout + // }) + + // stream.on('push', headers => { + // // TODO(HTTP/2): Suppor push + // }) + + // stream.on('trailers', headers => { + // // TODO(HTTP/2): Support trailers + // }) + + return true + + function writeBodyH2 () { + /* istanbul ignore else: assertion */ + if (!body) { + request.onRequestSent() + } else if (util.isBuffer(body)) { + assert(contentLength === body.byteLength, 'buffer body must have content length') + stream.cork() + stream.write(body) + stream.uncork() + stream.end() + request.onBodySent(body) + request.onRequestSent() + } else if (util.isBlobLike(body)) { + if (typeof body.stream === 'function') { + writeIterable({ + client, + request, + contentLength, + h2stream: stream, + expectsPayload, + body: body.stream(), + socket: client[kSocket], + header: '' + }) + } else { + writeBlob({ + body, + client, + request, + contentLength, + expectsPayload, + h2stream: stream, + header: '', + socket: client[kSocket] + }) + } + } else if (util.isStream(body)) { + writeStream({ + body, + client, + request, + contentLength, + expectsPayload, + socket: client[kSocket], + h2stream: stream, + header: '' + }) + } else if (util.isIterable(body)) { + writeIterable({ + body, + client, + request, + contentLength, + expectsPayload, + header: '', + h2stream: stream, + socket: client[kSocket] + }) + } else { + assert(false) + } + } +} + +function writeStream ({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) { + assert(contentLength !== 0 || client[kRunning] === 0, 'stream body cannot be pipelined') + + if (client[kHTTPConnVersion] === 'h2') { + // For HTTP/2, is enough to pipe the stream + const pipe = pipeline( + body, + h2stream, + (err) => { + if (err) { + util.destroy(body, err) + util.destroy(h2stream, err) + } else { + request.onRequestSent() + } + } + ) + + pipe.on('data', onPipeData) + pipe.once('end', () => { + pipe.removeListener('data', onPipeData) + util.destroy(pipe) + }) + + function onPipeData (chunk) { + request.onBodySent(chunk) + } + + return + } + + let finished = false + + const writer = new AsyncWriter({ socket, request, contentLength, client, expectsPayload, header }) + + const onData = function (chunk) { + if (finished) { + return + } + + try { + if (!writer.write(chunk) && this.pause) { + this.pause() + } + } catch (err) { + util.destroy(this, err) + } + } + const onDrain = function () { + if (finished) { + return + } + + if (body.resume) { + body.resume() + } + } + const onAbort = function () { + onFinished(new RequestAbortedError()) + } + const onFinished = function (err) { + if (finished) { + return + } + + finished = true + + assert(socket.destroyed || (socket[kWriting] && client[kRunning] <= 1)) + + socket + .off('drain', onDrain) + .off('error', onFinished) + + body + .removeListener('data', onData) + .removeListener('end', onFinished) + .removeListener('error', onFinished) + .removeListener('close', onAbort) + + if (!err) { + try { + writer.end() + } catch (er) { + err = er + } + } + + writer.destroy(err) + + if (err && (err.code !== 'UND_ERR_INFO' || err.message !== 'reset')) { + util.destroy(body, err) + } else { + util.destroy(body) + } + } + + body + .on('data', onData) + .on('end', onFinished) + .on('error', onFinished) + .on('close', onAbort) + + if (body.resume) { + body.resume() + } + + socket + .on('drain', onDrain) + .on('error', onFinished) +} + +async function writeBlob ({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) { + assert(contentLength === body.size, 'blob body must have content length') + + const isH2 = client[kHTTPConnVersion] === 'h2' + try { + if (contentLength != null && contentLength !== body.size) { + throw new RequestContentLengthMismatchError() + } + + const buffer = Buffer.from(await body.arrayBuffer()) + + if (isH2) { + h2stream.cork() + h2stream.write(buffer) + h2stream.uncork() + } else { + socket.cork() + socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1') + socket.write(buffer) + socket.uncork() + } + + request.onBodySent(buffer) + request.onRequestSent() + + if (!expectsPayload) { + socket[kReset] = true + } + + resume(client) + } catch (err) { + util.destroy(isH2 ? h2stream : socket, err) + } +} + +async function writeIterable ({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) { + assert(contentLength !== 0 || client[kRunning] === 0, 'iterator body cannot be pipelined') + + let callback = null + function onDrain () { + if (callback) { + const cb = callback + callback = null + cb() + } + } + + const waitForDrain = () => new Promise((resolve, reject) => { + assert(callback === null) + + if (socket[kError]) { + reject(socket[kError]) + } else { + callback = resolve + } + }) + + if (client[kHTTPConnVersion] === 'h2') { + h2stream + .on('close', onDrain) + .on('drain', onDrain) + + try { + // It's up to the user to somehow abort the async iterable. + for await (const chunk of body) { + if (socket[kError]) { + throw socket[kError] + } + + const res = h2stream.write(chunk) + request.onBodySent(chunk) + if (!res) { + await waitForDrain() + } + } + } catch (err) { + h2stream.destroy(err) + } finally { + request.onRequestSent() + h2stream.end() + h2stream + .off('close', onDrain) + .off('drain', onDrain) + } + + return + } + + socket + .on('close', onDrain) + .on('drain', onDrain) + + const writer = new AsyncWriter({ socket, request, contentLength, client, expectsPayload, header }) + try { + // It's up to the user to somehow abort the async iterable. + for await (const chunk of body) { + if (socket[kError]) { + throw socket[kError] + } + + if (!writer.write(chunk)) { + await waitForDrain() + } + } + + writer.end() + } catch (err) { + writer.destroy(err) + } finally { + socket + .off('close', onDrain) + .off('drain', onDrain) + } +} + +class AsyncWriter { + constructor ({ socket, request, contentLength, client, expectsPayload, header }) { + this.socket = socket + this.request = request + this.contentLength = contentLength + this.client = client + this.bytesWritten = 0 + this.expectsPayload = expectsPayload + this.header = header + + socket[kWriting] = true + } + + write (chunk) { + const { socket, request, contentLength, client, bytesWritten, expectsPayload, header } = this + + if (socket[kError]) { + throw socket[kError] + } + + if (socket.destroyed) { + return false + } + + const len = Buffer.byteLength(chunk) + if (!len) { + return true + } + + // We should defer writing chunks. + if (contentLength !== null && bytesWritten + len > contentLength) { + if (client[kStrictContentLength]) { + throw new RequestContentLengthMismatchError() + } + + process.emitWarning(new RequestContentLengthMismatchError()) + } + + socket.cork() + + if (bytesWritten === 0) { + if (!expectsPayload) { + socket[kReset] = true + } + + if (contentLength === null) { + socket.write(`${header}transfer-encoding: chunked\r\n`, 'latin1') + } else { + socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1') + } + } + + if (contentLength === null) { + socket.write(`\r\n${len.toString(16)}\r\n`, 'latin1') + } + + this.bytesWritten += len + + const ret = socket.write(chunk) + + socket.uncork() + + request.onBodySent(chunk) + + if (!ret) { + if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { + // istanbul ignore else: only for jest + if (socket[kParser].timeout.refresh) { + socket[kParser].timeout.refresh() + } + } + } + + return ret + } + + end () { + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request } = this + request.onRequestSent() + + socket[kWriting] = false + + if (socket[kError]) { + throw socket[kError] + } + + if (socket.destroyed) { + return + } + + if (bytesWritten === 0) { + if (expectsPayload) { + // https://tools.ietf.org/html/rfc7230#section-3.3.2 + // A user agent SHOULD send a Content-Length in a request message when + // no Transfer-Encoding is sent and the request method defines a meaning + // for an enclosed payload body. + + socket.write(`${header}content-length: 0\r\n\r\n`, 'latin1') + } else { + socket.write(`${header}\r\n`, 'latin1') + } + } else if (contentLength === null) { + socket.write('\r\n0\r\n\r\n', 'latin1') + } + + if (contentLength !== null && bytesWritten !== contentLength) { + if (client[kStrictContentLength]) { + throw new RequestContentLengthMismatchError() + } else { + process.emitWarning(new RequestContentLengthMismatchError()) + } + } + + if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { + // istanbul ignore else: only for jest + if (socket[kParser].timeout.refresh) { + socket[kParser].timeout.refresh() + } + } + + resume(client) + } + + destroy (err) { + const { socket, client } = this + + socket[kWriting] = false + + if (err) { + assert(client[kRunning] <= 1, 'pipeline should only contain this request') + util.destroy(socket, err) + } + } +} + +function errorRequest (client, request, err) { + try { + request.onError(err) + assert(request.aborted) + } catch (err) { + client.emit('error', err) + } +} + +module.exports = Client + + +/***/ }), + +/***/ 6436: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +/* istanbul ignore file: only for Node 12 */ + +const { kConnected, kSize } = __nccwpck_require__(2785) + +class CompatWeakRef { + constructor (value) { + this.value = value + } + + deref () { + return this.value[kConnected] === 0 && this.value[kSize] === 0 + ? undefined + : this.value + } +} + +class CompatFinalizer { + constructor (finalizer) { + this.finalizer = finalizer + } + + register (dispatcher, key) { + if (dispatcher.on) { + dispatcher.on('disconnect', () => { + if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) { + this.finalizer(key) + } + }) + } + } +} + +module.exports = function () { + // FIXME: remove workaround when the Node bug is fixed + // https://github.com/nodejs/node/issues/49344#issuecomment-1741776308 + if (process.env.NODE_V8_COVERAGE) { + return { + WeakRef: CompatWeakRef, + FinalizationRegistry: CompatFinalizer + } + } + return { + WeakRef: global.WeakRef || CompatWeakRef, + FinalizationRegistry: global.FinalizationRegistry || CompatFinalizer + } +} + + +/***/ }), + +/***/ 663: +/***/ ((module) => { + +"use strict"; + + +// https://wicg.github.io/cookie-store/#cookie-maximum-attribute-value-size +const maxAttributeValueSize = 1024 + +// https://wicg.github.io/cookie-store/#cookie-maximum-name-value-pair-size +const maxNameValuePairSize = 4096 + +module.exports = { + maxAttributeValueSize, + maxNameValuePairSize +} + + +/***/ }), + +/***/ 1724: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { parseSetCookie } = __nccwpck_require__(4408) +const { stringify, getHeadersList } = __nccwpck_require__(3121) +const { webidl } = __nccwpck_require__(1744) +const { Headers } = __nccwpck_require__(554) + +/** + * @typedef {Object} Cookie + * @property {string} name + * @property {string} value + * @property {Date|number|undefined} expires + * @property {number|undefined} maxAge + * @property {string|undefined} domain + * @property {string|undefined} path + * @property {boolean|undefined} secure + * @property {boolean|undefined} httpOnly + * @property {'Strict'|'Lax'|'None'} sameSite + * @property {string[]} unparsed + */ + +/** + * @param {Headers} headers + * @returns {Record} + */ +function getCookies (headers) { + webidl.argumentLengthCheck(arguments, 1, { header: 'getCookies' }) + + webidl.brandCheck(headers, Headers, { strict: false }) + + const cookie = headers.get('cookie') + const out = {} + + if (!cookie) { + return out + } + + for (const piece of cookie.split(';')) { + const [name, ...value] = piece.split('=') + + out[name.trim()] = value.join('=') + } + + return out +} + +/** + * @param {Headers} headers + * @param {string} name + * @param {{ path?: string, domain?: string }|undefined} attributes + * @returns {void} + */ +function deleteCookie (headers, name, attributes) { + webidl.argumentLengthCheck(arguments, 2, { header: 'deleteCookie' }) + + webidl.brandCheck(headers, Headers, { strict: false }) + + name = webidl.converters.DOMString(name) + attributes = webidl.converters.DeleteCookieAttributes(attributes) + + // Matches behavior of + // https://github.com/denoland/deno_std/blob/63827b16330b82489a04614027c33b7904e08be5/http/cookie.ts#L278 + setCookie(headers, { + name, + value: '', + expires: new Date(0), + ...attributes + }) +} + +/** + * @param {Headers} headers + * @returns {Cookie[]} + */ +function getSetCookies (headers) { + webidl.argumentLengthCheck(arguments, 1, { header: 'getSetCookies' }) + + webidl.brandCheck(headers, Headers, { strict: false }) + + const cookies = getHeadersList(headers).cookies + + if (!cookies) { + return [] + } + + // In older versions of undici, cookies is a list of name:value. + return cookies.map((pair) => parseSetCookie(Array.isArray(pair) ? pair[1] : pair)) +} + +/** + * @param {Headers} headers + * @param {Cookie} cookie + * @returns {void} + */ +function setCookie (headers, cookie) { + webidl.argumentLengthCheck(arguments, 2, { header: 'setCookie' }) + + webidl.brandCheck(headers, Headers, { strict: false }) + + cookie = webidl.converters.Cookie(cookie) + + const str = stringify(cookie) + + if (str) { + headers.append('Set-Cookie', stringify(cookie)) + } +} + +webidl.converters.DeleteCookieAttributes = webidl.dictionaryConverter([ + { + converter: webidl.nullableConverter(webidl.converters.DOMString), + key: 'path', + defaultValue: null + }, + { + converter: webidl.nullableConverter(webidl.converters.DOMString), + key: 'domain', + defaultValue: null + } +]) + +webidl.converters.Cookie = webidl.dictionaryConverter([ + { + converter: webidl.converters.DOMString, + key: 'name' + }, + { + converter: webidl.converters.DOMString, + key: 'value' + }, + { + converter: webidl.nullableConverter((value) => { + if (typeof value === 'number') { + return webidl.converters['unsigned long long'](value) + } + + return new Date(value) + }), + key: 'expires', + defaultValue: null + }, + { + converter: webidl.nullableConverter(webidl.converters['long long']), + key: 'maxAge', + defaultValue: null + }, + { + converter: webidl.nullableConverter(webidl.converters.DOMString), + key: 'domain', + defaultValue: null + }, + { + converter: webidl.nullableConverter(webidl.converters.DOMString), + key: 'path', + defaultValue: null + }, + { + converter: webidl.nullableConverter(webidl.converters.boolean), + key: 'secure', + defaultValue: null + }, + { + converter: webidl.nullableConverter(webidl.converters.boolean), + key: 'httpOnly', + defaultValue: null + }, + { + converter: webidl.converters.USVString, + key: 'sameSite', + allowedValues: ['Strict', 'Lax', 'None'] + }, + { + converter: webidl.sequenceConverter(webidl.converters.DOMString), + key: 'unparsed', + defaultValue: [] + } +]) + +module.exports = { + getCookies, + deleteCookie, + getSetCookies, + setCookie +} + + +/***/ }), + +/***/ 4408: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { maxNameValuePairSize, maxAttributeValueSize } = __nccwpck_require__(663) +const { isCTLExcludingHtab } = __nccwpck_require__(3121) +const { collectASequenceOfCodePointsFast } = __nccwpck_require__(685) +const assert = __nccwpck_require__(9491) + +/** + * @description Parses the field-value attributes of a set-cookie header string. + * @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4 + * @param {string} header + * @returns if the header is invalid, null will be returned + */ +function parseSetCookie (header) { + // 1. If the set-cookie-string contains a %x00-08 / %x0A-1F / %x7F + // character (CTL characters excluding HTAB): Abort these steps and + // ignore the set-cookie-string entirely. + if (isCTLExcludingHtab(header)) { + return null + } + + let nameValuePair = '' + let unparsedAttributes = '' + let name = '' + let value = '' + + // 2. If the set-cookie-string contains a %x3B (";") character: + if (header.includes(';')) { + // 1. The name-value-pair string consists of the characters up to, + // but not including, the first %x3B (";"), and the unparsed- + // attributes consist of the remainder of the set-cookie-string + // (including the %x3B (";") in question). + const position = { position: 0 } + + nameValuePair = collectASequenceOfCodePointsFast(';', header, position) + unparsedAttributes = header.slice(position.position) + } else { + // Otherwise: + + // 1. The name-value-pair string consists of all the characters + // contained in the set-cookie-string, and the unparsed- + // attributes is the empty string. + nameValuePair = header + } + + // 3. If the name-value-pair string lacks a %x3D ("=") character, then + // the name string is empty, and the value string is the value of + // name-value-pair. + if (!nameValuePair.includes('=')) { + value = nameValuePair + } else { + // Otherwise, the name string consists of the characters up to, but + // not including, the first %x3D ("=") character, and the (possibly + // empty) value string consists of the characters after the first + // %x3D ("=") character. + const position = { position: 0 } + name = collectASequenceOfCodePointsFast( + '=', + nameValuePair, + position + ) + value = nameValuePair.slice(position.position + 1) + } + + // 4. Remove any leading or trailing WSP characters from the name + // string and the value string. + name = name.trim() + value = value.trim() + + // 5. If the sum of the lengths of the name string and the value string + // is more than 4096 octets, abort these steps and ignore the set- + // cookie-string entirely. + if (name.length + value.length > maxNameValuePairSize) { + return null + } + + // 6. The cookie-name is the name string, and the cookie-value is the + // value string. + return { + name, value, ...parseUnparsedAttributes(unparsedAttributes) + } +} + +/** + * Parses the remaining attributes of a set-cookie header + * @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4 + * @param {string} unparsedAttributes + * @param {[Object.]={}} cookieAttributeList + */ +function parseUnparsedAttributes (unparsedAttributes, cookieAttributeList = {}) { + // 1. If the unparsed-attributes string is empty, skip the rest of + // these steps. + if (unparsedAttributes.length === 0) { + return cookieAttributeList + } + + // 2. Discard the first character of the unparsed-attributes (which + // will be a %x3B (";") character). + assert(unparsedAttributes[0] === ';') + unparsedAttributes = unparsedAttributes.slice(1) + + let cookieAv = '' + + // 3. If the remaining unparsed-attributes contains a %x3B (";") + // character: + if (unparsedAttributes.includes(';')) { + // 1. Consume the characters of the unparsed-attributes up to, but + // not including, the first %x3B (";") character. + cookieAv = collectASequenceOfCodePointsFast( + ';', + unparsedAttributes, + { position: 0 } + ) + unparsedAttributes = unparsedAttributes.slice(cookieAv.length) + } else { + // Otherwise: + + // 1. Consume the remainder of the unparsed-attributes. + cookieAv = unparsedAttributes + unparsedAttributes = '' + } + + // Let the cookie-av string be the characters consumed in this step. + + let attributeName = '' + let attributeValue = '' + + // 4. If the cookie-av string contains a %x3D ("=") character: + if (cookieAv.includes('=')) { + // 1. The (possibly empty) attribute-name string consists of the + // characters up to, but not including, the first %x3D ("=") + // character, and the (possibly empty) attribute-value string + // consists of the characters after the first %x3D ("=") + // character. + const position = { position: 0 } + + attributeName = collectASequenceOfCodePointsFast( + '=', + cookieAv, + position + ) + attributeValue = cookieAv.slice(position.position + 1) + } else { + // Otherwise: + + // 1. The attribute-name string consists of the entire cookie-av + // string, and the attribute-value string is empty. + attributeName = cookieAv + } + + // 5. Remove any leading or trailing WSP characters from the attribute- + // name string and the attribute-value string. + attributeName = attributeName.trim() + attributeValue = attributeValue.trim() + + // 6. If the attribute-value is longer than 1024 octets, ignore the + // cookie-av string and return to Step 1 of this algorithm. + if (attributeValue.length > maxAttributeValueSize) { + return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList) + } + + // 7. Process the attribute-name and attribute-value according to the + // requirements in the following subsections. (Notice that + // attributes with unrecognized attribute-names are ignored.) + const attributeNameLowercase = attributeName.toLowerCase() + + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.1 + // If the attribute-name case-insensitively matches the string + // "Expires", the user agent MUST process the cookie-av as follows. + if (attributeNameLowercase === 'expires') { + // 1. Let the expiry-time be the result of parsing the attribute-value + // as cookie-date (see Section 5.1.1). + const expiryTime = new Date(attributeValue) + + // 2. If the attribute-value failed to parse as a cookie date, ignore + // the cookie-av. + + cookieAttributeList.expires = expiryTime + } else if (attributeNameLowercase === 'max-age') { + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.2 + // If the attribute-name case-insensitively matches the string "Max- + // Age", the user agent MUST process the cookie-av as follows. + + // 1. If the first character of the attribute-value is not a DIGIT or a + // "-" character, ignore the cookie-av. + const charCode = attributeValue.charCodeAt(0) + + if ((charCode < 48 || charCode > 57) && attributeValue[0] !== '-') { + return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList) + } + + // 2. If the remainder of attribute-value contains a non-DIGIT + // character, ignore the cookie-av. + if (!/^\d+$/.test(attributeValue)) { + return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList) + } + + // 3. Let delta-seconds be the attribute-value converted to an integer. + const deltaSeconds = Number(attributeValue) + + // 4. Let cookie-age-limit be the maximum age of the cookie (which + // SHOULD be 400 days or less, see Section 4.1.2.2). + + // 5. Set delta-seconds to the smaller of its present value and cookie- + // age-limit. + // deltaSeconds = Math.min(deltaSeconds * 1000, maxExpiresMs) + + // 6. If delta-seconds is less than or equal to zero (0), let expiry- + // time be the earliest representable date and time. Otherwise, let + // the expiry-time be the current date and time plus delta-seconds + // seconds. + // const expiryTime = deltaSeconds <= 0 ? Date.now() : Date.now() + deltaSeconds + + // 7. Append an attribute to the cookie-attribute-list with an + // attribute-name of Max-Age and an attribute-value of expiry-time. + cookieAttributeList.maxAge = deltaSeconds + } else if (attributeNameLowercase === 'domain') { + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.3 + // If the attribute-name case-insensitively matches the string "Domain", + // the user agent MUST process the cookie-av as follows. + + // 1. Let cookie-domain be the attribute-value. + let cookieDomain = attributeValue + + // 2. If cookie-domain starts with %x2E ("."), let cookie-domain be + // cookie-domain without its leading %x2E ("."). + if (cookieDomain[0] === '.') { + cookieDomain = cookieDomain.slice(1) + } + + // 3. Convert the cookie-domain to lower case. + cookieDomain = cookieDomain.toLowerCase() + + // 4. Append an attribute to the cookie-attribute-list with an + // attribute-name of Domain and an attribute-value of cookie-domain. + cookieAttributeList.domain = cookieDomain + } else if (attributeNameLowercase === 'path') { + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.4 + // If the attribute-name case-insensitively matches the string "Path", + // the user agent MUST process the cookie-av as follows. + + // 1. If the attribute-value is empty or if the first character of the + // attribute-value is not %x2F ("/"): + let cookiePath = '' + if (attributeValue.length === 0 || attributeValue[0] !== '/') { + // 1. Let cookie-path be the default-path. + cookiePath = '/' + } else { + // Otherwise: + + // 1. Let cookie-path be the attribute-value. + cookiePath = attributeValue + } + + // 2. Append an attribute to the cookie-attribute-list with an + // attribute-name of Path and an attribute-value of cookie-path. + cookieAttributeList.path = cookiePath + } else if (attributeNameLowercase === 'secure') { + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.5 + // If the attribute-name case-insensitively matches the string "Secure", + // the user agent MUST append an attribute to the cookie-attribute-list + // with an attribute-name of Secure and an empty attribute-value. + + cookieAttributeList.secure = true + } else if (attributeNameLowercase === 'httponly') { + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.6 + // If the attribute-name case-insensitively matches the string + // "HttpOnly", the user agent MUST append an attribute to the cookie- + // attribute-list with an attribute-name of HttpOnly and an empty + // attribute-value. + + cookieAttributeList.httpOnly = true + } else if (attributeNameLowercase === 'samesite') { + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.7 + // If the attribute-name case-insensitively matches the string + // "SameSite", the user agent MUST process the cookie-av as follows: + + // 1. Let enforcement be "Default". + let enforcement = 'Default' + + const attributeValueLowercase = attributeValue.toLowerCase() + // 2. If cookie-av's attribute-value is a case-insensitive match for + // "None", set enforcement to "None". + if (attributeValueLowercase.includes('none')) { + enforcement = 'None' + } + + // 3. If cookie-av's attribute-value is a case-insensitive match for + // "Strict", set enforcement to "Strict". + if (attributeValueLowercase.includes('strict')) { + enforcement = 'Strict' + } + + // 4. If cookie-av's attribute-value is a case-insensitive match for + // "Lax", set enforcement to "Lax". + if (attributeValueLowercase.includes('lax')) { + enforcement = 'Lax' + } + + // 5. Append an attribute to the cookie-attribute-list with an + // attribute-name of "SameSite" and an attribute-value of + // enforcement. + cookieAttributeList.sameSite = enforcement + } else { + cookieAttributeList.unparsed ??= [] + + cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`) + } + + // 8. Return to Step 1 of this algorithm. + return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList) +} + +module.exports = { + parseSetCookie, + parseUnparsedAttributes +} + + +/***/ }), + +/***/ 3121: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const assert = __nccwpck_require__(9491) +const { kHeadersList } = __nccwpck_require__(2785) + +function isCTLExcludingHtab (value) { + if (value.length === 0) { + return false + } + + for (const char of value) { + const code = char.charCodeAt(0) + + if ( + (code >= 0x00 || code <= 0x08) || + (code >= 0x0A || code <= 0x1F) || + code === 0x7F + ) { + return false + } + } +} + +/** + CHAR = + token = 1* + separators = "(" | ")" | "<" | ">" | "@" + | "," | ";" | ":" | "\" | <"> + | "/" | "[" | "]" | "?" | "=" + | "{" | "}" | SP | HT + * @param {string} name + */ +function validateCookieName (name) { + for (const char of name) { + const code = char.charCodeAt(0) + + if ( + (code <= 0x20 || code > 0x7F) || + char === '(' || + char === ')' || + char === '>' || + char === '<' || + char === '@' || + char === ',' || + char === ';' || + char === ':' || + char === '\\' || + char === '"' || + char === '/' || + char === '[' || + char === ']' || + char === '?' || + char === '=' || + char === '{' || + char === '}' + ) { + throw new Error('Invalid cookie name') + } + } +} + +/** + cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE ) + cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E + ; US-ASCII characters excluding CTLs, + ; whitespace DQUOTE, comma, semicolon, + ; and backslash + * @param {string} value + */ +function validateCookieValue (value) { + for (const char of value) { + const code = char.charCodeAt(0) + + if ( + code < 0x21 || // exclude CTLs (0-31) + code === 0x22 || + code === 0x2C || + code === 0x3B || + code === 0x5C || + code > 0x7E // non-ascii + ) { + throw new Error('Invalid header value') + } + } +} + +/** + * path-value = + * @param {string} path + */ +function validateCookiePath (path) { + for (const char of path) { + const code = char.charCodeAt(0) + + if (code < 0x21 || char === ';') { + throw new Error('Invalid cookie path') + } + } +} + +/** + * I have no idea why these values aren't allowed to be honest, + * but Deno tests these. - Khafra + * @param {string} domain + */ +function validateCookieDomain (domain) { + if ( + domain.startsWith('-') || + domain.endsWith('.') || + domain.endsWith('-') + ) { + throw new Error('Invalid cookie domain') + } +} + +/** + * @see https://www.rfc-editor.org/rfc/rfc7231#section-7.1.1.1 + * @param {number|Date} date + IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT + ; fixed length/zone/capitalization subset of the format + ; see Section 3.3 of [RFC5322] + + day-name = %x4D.6F.6E ; "Mon", case-sensitive + / %x54.75.65 ; "Tue", case-sensitive + / %x57.65.64 ; "Wed", case-sensitive + / %x54.68.75 ; "Thu", case-sensitive + / %x46.72.69 ; "Fri", case-sensitive + / %x53.61.74 ; "Sat", case-sensitive + / %x53.75.6E ; "Sun", case-sensitive + date1 = day SP month SP year + ; e.g., 02 Jun 1982 + + day = 2DIGIT + month = %x4A.61.6E ; "Jan", case-sensitive + / %x46.65.62 ; "Feb", case-sensitive + / %x4D.61.72 ; "Mar", case-sensitive + / %x41.70.72 ; "Apr", case-sensitive + / %x4D.61.79 ; "May", case-sensitive + / %x4A.75.6E ; "Jun", case-sensitive + / %x4A.75.6C ; "Jul", case-sensitive + / %x41.75.67 ; "Aug", case-sensitive + / %x53.65.70 ; "Sep", case-sensitive + / %x4F.63.74 ; "Oct", case-sensitive + / %x4E.6F.76 ; "Nov", case-sensitive + / %x44.65.63 ; "Dec", case-sensitive + year = 4DIGIT + + GMT = %x47.4D.54 ; "GMT", case-sensitive + + time-of-day = hour ":" minute ":" second + ; 00:00:00 - 23:59:60 (leap second) + + hour = 2DIGIT + minute = 2DIGIT + second = 2DIGIT + */ +function toIMFDate (date) { + if (typeof date === 'number') { + date = new Date(date) + } + + const days = [ + 'Sun', 'Mon', 'Tue', 'Wed', + 'Thu', 'Fri', 'Sat' + ] + + const months = [ + 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', + 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' + ] + + const dayName = days[date.getUTCDay()] + const day = date.getUTCDate().toString().padStart(2, '0') + const month = months[date.getUTCMonth()] + const year = date.getUTCFullYear() + const hour = date.getUTCHours().toString().padStart(2, '0') + const minute = date.getUTCMinutes().toString().padStart(2, '0') + const second = date.getUTCSeconds().toString().padStart(2, '0') + + return `${dayName}, ${day} ${month} ${year} ${hour}:${minute}:${second} GMT` +} + +/** + max-age-av = "Max-Age=" non-zero-digit *DIGIT + ; In practice, both expires-av and max-age-av + ; are limited to dates representable by the + ; user agent. + * @param {number} maxAge + */ +function validateCookieMaxAge (maxAge) { + if (maxAge < 0) { + throw new Error('Invalid cookie max-age') + } +} + +/** + * @see https://www.rfc-editor.org/rfc/rfc6265#section-4.1.1 + * @param {import('./index').Cookie} cookie + */ +function stringify (cookie) { + if (cookie.name.length === 0) { + return null + } + + validateCookieName(cookie.name) + validateCookieValue(cookie.value) + + const out = [`${cookie.name}=${cookie.value}`] + + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.1 + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.2 + if (cookie.name.startsWith('__Secure-')) { + cookie.secure = true + } + + if (cookie.name.startsWith('__Host-')) { + cookie.secure = true + cookie.domain = null + cookie.path = '/' + } + + if (cookie.secure) { + out.push('Secure') + } + + if (cookie.httpOnly) { + out.push('HttpOnly') + } + + if (typeof cookie.maxAge === 'number') { + validateCookieMaxAge(cookie.maxAge) + out.push(`Max-Age=${cookie.maxAge}`) + } + + if (cookie.domain) { + validateCookieDomain(cookie.domain) + out.push(`Domain=${cookie.domain}`) + } + + if (cookie.path) { + validateCookiePath(cookie.path) + out.push(`Path=${cookie.path}`) + } + + if (cookie.expires && cookie.expires.toString() !== 'Invalid Date') { + out.push(`Expires=${toIMFDate(cookie.expires)}`) + } + + if (cookie.sameSite) { + out.push(`SameSite=${cookie.sameSite}`) + } + + for (const part of cookie.unparsed) { + if (!part.includes('=')) { + throw new Error('Invalid unparsed') + } + + const [key, ...value] = part.split('=') + + out.push(`${key.trim()}=${value.join('=')}`) + } + + return out.join('; ') +} + +let kHeadersListNode + +function getHeadersList (headers) { + if (headers[kHeadersList]) { + return headers[kHeadersList] + } + + if (!kHeadersListNode) { + kHeadersListNode = Object.getOwnPropertySymbols(headers).find( + (symbol) => symbol.description === 'headers list' + ) + + assert(kHeadersListNode, 'Headers cannot be parsed') + } + + const headersList = headers[kHeadersListNode] + assert(headersList) + + return headersList +} + +module.exports = { + isCTLExcludingHtab, + stringify, + getHeadersList +} + + +/***/ }), + +/***/ 2067: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const net = __nccwpck_require__(1808) +const assert = __nccwpck_require__(9491) +const util = __nccwpck_require__(3983) +const { InvalidArgumentError, ConnectTimeoutError } = __nccwpck_require__(8045) + +let tls // include tls conditionally since it is not always available + +// TODO: session re-use does not wait for the first +// connection to resolve the session and might therefore +// resolve the same servername multiple times even when +// re-use is enabled. + +let SessionCache +// FIXME: remove workaround when the Node bug is fixed +// https://github.com/nodejs/node/issues/49344#issuecomment-1741776308 +if (global.FinalizationRegistry && !process.env.NODE_V8_COVERAGE) { + SessionCache = class WeakSessionCache { + constructor (maxCachedSessions) { + this._maxCachedSessions = maxCachedSessions + this._sessionCache = new Map() + this._sessionRegistry = new global.FinalizationRegistry((key) => { + if (this._sessionCache.size < this._maxCachedSessions) { + return + } + + const ref = this._sessionCache.get(key) + if (ref !== undefined && ref.deref() === undefined) { + this._sessionCache.delete(key) + } + }) + } + + get (sessionKey) { + const ref = this._sessionCache.get(sessionKey) + return ref ? ref.deref() : null + } + + set (sessionKey, session) { + if (this._maxCachedSessions === 0) { + return + } + + this._sessionCache.set(sessionKey, new WeakRef(session)) + this._sessionRegistry.register(session, sessionKey) + } + } +} else { + SessionCache = class SimpleSessionCache { + constructor (maxCachedSessions) { + this._maxCachedSessions = maxCachedSessions + this._sessionCache = new Map() + } + + get (sessionKey) { + return this._sessionCache.get(sessionKey) + } + + set (sessionKey, session) { + if (this._maxCachedSessions === 0) { + return + } + + if (this._sessionCache.size >= this._maxCachedSessions) { + // remove the oldest session + const { value: oldestKey } = this._sessionCache.keys().next() + this._sessionCache.delete(oldestKey) + } + + this._sessionCache.set(sessionKey, session) + } + } +} + +function buildConnector ({ allowH2, maxCachedSessions, socketPath, timeout, ...opts }) { + if (maxCachedSessions != null && (!Number.isInteger(maxCachedSessions) || maxCachedSessions < 0)) { + throw new InvalidArgumentError('maxCachedSessions must be a positive integer or zero') + } + + const options = { path: socketPath, ...opts } + const sessionCache = new SessionCache(maxCachedSessions == null ? 100 : maxCachedSessions) + timeout = timeout == null ? 10e3 : timeout + allowH2 = allowH2 != null ? allowH2 : false + return function connect ({ hostname, host, protocol, port, servername, localAddress, httpSocket }, callback) { + let socket + if (protocol === 'https:') { + if (!tls) { + tls = __nccwpck_require__(4404) + } + servername = servername || options.servername || util.getServerName(host) || null + + const sessionKey = servername || hostname + const session = sessionCache.get(sessionKey) || null + + assert(sessionKey) + + socket = tls.connect({ + highWaterMark: 16384, // TLS in node can't have bigger HWM anyway... + ...options, + servername, + session, + localAddress, + // TODO(HTTP/2): Add support for h2c + ALPNProtocols: allowH2 ? ['http/1.1', 'h2'] : ['http/1.1'], + socket: httpSocket, // upgrade socket connection + port: port || 443, + host: hostname + }) + + socket + .on('session', function (session) { + // TODO (fix): Can a session become invalid once established? Don't think so? + sessionCache.set(sessionKey, session) + }) + } else { + assert(!httpSocket, 'httpSocket can only be sent on TLS update') + socket = net.connect({ + highWaterMark: 64 * 1024, // Same as nodejs fs streams. + ...options, + localAddress, + port: port || 80, + host: hostname + }) + } + + // Set TCP keep alive options on the socket here instead of in connect() for the case of assigning the socket + if (options.keepAlive == null || options.keepAlive) { + const keepAliveInitialDelay = options.keepAliveInitialDelay === undefined ? 60e3 : options.keepAliveInitialDelay + socket.setKeepAlive(true, keepAliveInitialDelay) + } + + const cancelTimeout = setupTimeout(() => onConnectTimeout(socket), timeout) + + socket + .setNoDelay(true) + .once(protocol === 'https:' ? 'secureConnect' : 'connect', function () { + cancelTimeout() + + if (callback) { + const cb = callback + callback = null + cb(null, this) + } + }) + .on('error', function (err) { + cancelTimeout() + + if (callback) { + const cb = callback + callback = null + cb(err) + } + }) + + return socket + } +} + +function setupTimeout (onConnectTimeout, timeout) { + if (!timeout) { + return () => {} + } + + let s1 = null + let s2 = null + const timeoutId = setTimeout(() => { + // setImmediate is added to make sure that we priotorise socket error events over timeouts + s1 = setImmediate(() => { + if (process.platform === 'win32') { + // Windows needs an extra setImmediate probably due to implementation differences in the socket logic + s2 = setImmediate(() => onConnectTimeout()) + } else { + onConnectTimeout() + } + }) + }, timeout) + return () => { + clearTimeout(timeoutId) + clearImmediate(s1) + clearImmediate(s2) + } +} + +function onConnectTimeout (socket) { + util.destroy(socket, new ConnectTimeoutError()) +} + +module.exports = buildConnector + + +/***/ }), + +/***/ 8045: +/***/ ((module) => { + +"use strict"; + + +class UndiciError extends Error { + constructor (message) { + super(message) + this.name = 'UndiciError' + this.code = 'UND_ERR' + } +} + +class ConnectTimeoutError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, ConnectTimeoutError) + this.name = 'ConnectTimeoutError' + this.message = message || 'Connect Timeout Error' + this.code = 'UND_ERR_CONNECT_TIMEOUT' + } +} + +class HeadersTimeoutError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, HeadersTimeoutError) + this.name = 'HeadersTimeoutError' + this.message = message || 'Headers Timeout Error' + this.code = 'UND_ERR_HEADERS_TIMEOUT' + } +} + +class HeadersOverflowError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, HeadersOverflowError) + this.name = 'HeadersOverflowError' + this.message = message || 'Headers Overflow Error' + this.code = 'UND_ERR_HEADERS_OVERFLOW' + } +} + +class BodyTimeoutError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, BodyTimeoutError) + this.name = 'BodyTimeoutError' + this.message = message || 'Body Timeout Error' + this.code = 'UND_ERR_BODY_TIMEOUT' + } +} + +class ResponseStatusCodeError extends UndiciError { + constructor (message, statusCode, headers, body) { + super(message) + Error.captureStackTrace(this, ResponseStatusCodeError) + this.name = 'ResponseStatusCodeError' + this.message = message || 'Response Status Code Error' + this.code = 'UND_ERR_RESPONSE_STATUS_CODE' + this.body = body + this.status = statusCode + this.statusCode = statusCode + this.headers = headers + } +} + +class InvalidArgumentError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, InvalidArgumentError) + this.name = 'InvalidArgumentError' + this.message = message || 'Invalid Argument Error' + this.code = 'UND_ERR_INVALID_ARG' + } +} + +class InvalidReturnValueError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, InvalidReturnValueError) + this.name = 'InvalidReturnValueError' + this.message = message || 'Invalid Return Value Error' + this.code = 'UND_ERR_INVALID_RETURN_VALUE' + } +} + +class RequestAbortedError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, RequestAbortedError) + this.name = 'AbortError' + this.message = message || 'Request aborted' + this.code = 'UND_ERR_ABORTED' + } +} + +class InformationalError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, InformationalError) + this.name = 'InformationalError' + this.message = message || 'Request information' + this.code = 'UND_ERR_INFO' + } +} + +class RequestContentLengthMismatchError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, RequestContentLengthMismatchError) + this.name = 'RequestContentLengthMismatchError' + this.message = message || 'Request body length does not match content-length header' + this.code = 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' + } +} + +class ResponseContentLengthMismatchError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, ResponseContentLengthMismatchError) + this.name = 'ResponseContentLengthMismatchError' + this.message = message || 'Response body length does not match content-length header' + this.code = 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH' + } +} + +class ClientDestroyedError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, ClientDestroyedError) + this.name = 'ClientDestroyedError' + this.message = message || 'The client is destroyed' + this.code = 'UND_ERR_DESTROYED' + } +} + +class ClientClosedError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, ClientClosedError) + this.name = 'ClientClosedError' + this.message = message || 'The client is closed' + this.code = 'UND_ERR_CLOSED' + } +} + +class SocketError extends UndiciError { + constructor (message, socket) { + super(message) + Error.captureStackTrace(this, SocketError) + this.name = 'SocketError' + this.message = message || 'Socket error' + this.code = 'UND_ERR_SOCKET' + this.socket = socket + } +} + +class NotSupportedError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, NotSupportedError) + this.name = 'NotSupportedError' + this.message = message || 'Not supported error' + this.code = 'UND_ERR_NOT_SUPPORTED' + } +} + +class BalancedPoolMissingUpstreamError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, NotSupportedError) + this.name = 'MissingUpstreamError' + this.message = message || 'No upstream has been added to the BalancedPool' + this.code = 'UND_ERR_BPL_MISSING_UPSTREAM' + } +} + +class HTTPParserError extends Error { + constructor (message, code, data) { + super(message) + Error.captureStackTrace(this, HTTPParserError) + this.name = 'HTTPParserError' + this.code = code ? `HPE_${code}` : undefined + this.data = data ? data.toString() : undefined + } +} + +class ResponseExceededMaxSizeError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, ResponseExceededMaxSizeError) + this.name = 'ResponseExceededMaxSizeError' + this.message = message || 'Response content exceeded max size' + this.code = 'UND_ERR_RES_EXCEEDED_MAX_SIZE' + } +} + +module.exports = { + HTTPParserError, + UndiciError, + HeadersTimeoutError, + HeadersOverflowError, + BodyTimeoutError, + RequestContentLengthMismatchError, + ConnectTimeoutError, + ResponseStatusCodeError, + InvalidArgumentError, + InvalidReturnValueError, + RequestAbortedError, + ClientDestroyedError, + ClientClosedError, + InformationalError, + SocketError, + NotSupportedError, + ResponseContentLengthMismatchError, + BalancedPoolMissingUpstreamError, + ResponseExceededMaxSizeError +} + + +/***/ }), + +/***/ 2905: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { + InvalidArgumentError, + NotSupportedError +} = __nccwpck_require__(8045) +const assert = __nccwpck_require__(9491) +const { kHTTP2BuildRequest, kHTTP2CopyHeaders, kHTTP1BuildRequest } = __nccwpck_require__(2785) +const util = __nccwpck_require__(3983) + +// tokenRegExp and headerCharRegex have been lifted from +// https://github.com/nodejs/node/blob/main/lib/_http_common.js + +/** + * Verifies that the given val is a valid HTTP token + * per the rules defined in RFC 7230 + * See https://tools.ietf.org/html/rfc7230#section-3.2.6 + */ +const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/ + +/** + * Matches if val contains an invalid field-vchar + * field-value = *( field-content / obs-fold ) + * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] + * field-vchar = VCHAR / obs-text + */ +const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/ + +// Verifies that a given path is valid does not contain control chars \x00 to \x20 +const invalidPathRegex = /[^\u0021-\u00ff]/ + +const kHandler = Symbol('handler') + +const channels = {} + +let extractBody + +try { + const diagnosticsChannel = __nccwpck_require__(7643) + channels.create = diagnosticsChannel.channel('undici:request:create') + channels.bodySent = diagnosticsChannel.channel('undici:request:bodySent') + channels.headers = diagnosticsChannel.channel('undici:request:headers') + channels.trailers = diagnosticsChannel.channel('undici:request:trailers') + channels.error = diagnosticsChannel.channel('undici:request:error') +} catch { + channels.create = { hasSubscribers: false } + channels.bodySent = { hasSubscribers: false } + channels.headers = { hasSubscribers: false } + channels.trailers = { hasSubscribers: false } + channels.error = { hasSubscribers: false } +} + +class Request { + constructor (origin, { + path, + method, + body, + headers, + query, + idempotent, + blocking, + upgrade, + headersTimeout, + bodyTimeout, + reset, + throwOnError, + expectContinue + }, handler) { + if (typeof path !== 'string') { + throw new InvalidArgumentError('path must be a string') + } else if ( + path[0] !== '/' && + !(path.startsWith('http://') || path.startsWith('https://')) && + method !== 'CONNECT' + ) { + throw new InvalidArgumentError('path must be an absolute URL or start with a slash') + } else if (invalidPathRegex.exec(path) !== null) { + throw new InvalidArgumentError('invalid request path') + } + + if (typeof method !== 'string') { + throw new InvalidArgumentError('method must be a string') + } else if (tokenRegExp.exec(method) === null) { + throw new InvalidArgumentError('invalid request method') + } + + if (upgrade && typeof upgrade !== 'string') { + throw new InvalidArgumentError('upgrade must be a string') + } + + if (headersTimeout != null && (!Number.isFinite(headersTimeout) || headersTimeout < 0)) { + throw new InvalidArgumentError('invalid headersTimeout') + } + + if (bodyTimeout != null && (!Number.isFinite(bodyTimeout) || bodyTimeout < 0)) { + throw new InvalidArgumentError('invalid bodyTimeout') + } + + if (reset != null && typeof reset !== 'boolean') { + throw new InvalidArgumentError('invalid reset') + } + + if (expectContinue != null && typeof expectContinue !== 'boolean') { + throw new InvalidArgumentError('invalid expectContinue') + } + + this.headersTimeout = headersTimeout + + this.bodyTimeout = bodyTimeout + + this.throwOnError = throwOnError === true + + this.method = method + + if (body == null) { + this.body = null + } else if (util.isStream(body)) { + this.body = body + } else if (util.isBuffer(body)) { + this.body = body.byteLength ? body : null + } else if (ArrayBuffer.isView(body)) { + this.body = body.buffer.byteLength ? Buffer.from(body.buffer, body.byteOffset, body.byteLength) : null + } else if (body instanceof ArrayBuffer) { + this.body = body.byteLength ? Buffer.from(body) : null + } else if (typeof body === 'string') { + this.body = body.length ? Buffer.from(body) : null + } else if (util.isFormDataLike(body) || util.isIterable(body) || util.isBlobLike(body)) { + this.body = body + } else { + throw new InvalidArgumentError('body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable') + } + + this.completed = false + + this.aborted = false + + this.upgrade = upgrade || null + + this.path = query ? util.buildURL(path, query) : path + + this.origin = origin + + this.idempotent = idempotent == null + ? method === 'HEAD' || method === 'GET' + : idempotent + + this.blocking = blocking == null ? false : blocking + + this.reset = reset == null ? null : reset + + this.host = null + + this.contentLength = null + + this.contentType = null + + this.headers = '' + + // Only for H2 + this.expectContinue = expectContinue != null ? expectContinue : false + + if (Array.isArray(headers)) { + if (headers.length % 2 !== 0) { + throw new InvalidArgumentError('headers array must be even') + } + for (let i = 0; i < headers.length; i += 2) { + processHeader(this, headers[i], headers[i + 1]) + } + } else if (headers && typeof headers === 'object') { + const keys = Object.keys(headers) + for (let i = 0; i < keys.length; i++) { + const key = keys[i] + processHeader(this, key, headers[key]) + } + } else if (headers != null) { + throw new InvalidArgumentError('headers must be an object or an array') + } + + if (util.isFormDataLike(this.body)) { + if (util.nodeMajor < 16 || (util.nodeMajor === 16 && util.nodeMinor < 8)) { + throw new InvalidArgumentError('Form-Data bodies are only supported in node v16.8 and newer.') + } + + if (!extractBody) { + extractBody = (__nccwpck_require__(9990).extractBody) + } + + const [bodyStream, contentType] = extractBody(body) + if (this.contentType == null) { + this.contentType = contentType + this.headers += `content-type: ${contentType}\r\n` + } + this.body = bodyStream.stream + this.contentLength = bodyStream.length + } else if (util.isBlobLike(body) && this.contentType == null && body.type) { + this.contentType = body.type + this.headers += `content-type: ${body.type}\r\n` + } + + util.validateHandler(handler, method, upgrade) + + this.servername = util.getServerName(this.host) + + this[kHandler] = handler + + if (channels.create.hasSubscribers) { + channels.create.publish({ request: this }) + } + } + + onBodySent (chunk) { + if (this[kHandler].onBodySent) { + try { + this[kHandler].onBodySent(chunk) + } catch (err) { + this.onError(err) + } + } + } + + onRequestSent () { + if (channels.bodySent.hasSubscribers) { + channels.bodySent.publish({ request: this }) + } + } + + onConnect (abort) { + assert(!this.aborted) + assert(!this.completed) + + return this[kHandler].onConnect(abort) + } + + onHeaders (statusCode, headers, resume, statusText) { + assert(!this.aborted) + assert(!this.completed) + + if (channels.headers.hasSubscribers) { + channels.headers.publish({ request: this, response: { statusCode, headers, statusText } }) + } + + return this[kHandler].onHeaders(statusCode, headers, resume, statusText) + } + + onData (chunk) { + assert(!this.aborted) + assert(!this.completed) + + return this[kHandler].onData(chunk) + } + + onUpgrade (statusCode, headers, socket) { + assert(!this.aborted) + assert(!this.completed) + + return this[kHandler].onUpgrade(statusCode, headers, socket) + } + + onComplete (trailers) { + assert(!this.aborted) + + this.completed = true + if (channels.trailers.hasSubscribers) { + channels.trailers.publish({ request: this, trailers }) + } + return this[kHandler].onComplete(trailers) + } + + onError (error) { + if (channels.error.hasSubscribers) { + channels.error.publish({ request: this, error }) + } + + if (this.aborted) { + return + } + this.aborted = true + return this[kHandler].onError(error) + } + + // TODO: adjust to support H2 + addHeader (key, value) { + processHeader(this, key, value) + return this + } + + static [kHTTP1BuildRequest] (origin, opts, handler) { + // TODO: Migrate header parsing here, to make Requests + // HTTP agnostic + return new Request(origin, opts, handler) + } + + static [kHTTP2BuildRequest] (origin, opts, handler) { + const headers = opts.headers + opts = { ...opts, headers: null } + + const request = new Request(origin, opts, handler) + + request.headers = {} + + if (Array.isArray(headers)) { + if (headers.length % 2 !== 0) { + throw new InvalidArgumentError('headers array must be even') + } + for (let i = 0; i < headers.length; i += 2) { + processHeader(request, headers[i], headers[i + 1], true) + } + } else if (headers && typeof headers === 'object') { + const keys = Object.keys(headers) + for (let i = 0; i < keys.length; i++) { + const key = keys[i] + processHeader(request, key, headers[key], true) + } + } else if (headers != null) { + throw new InvalidArgumentError('headers must be an object or an array') + } + + return request + } + + static [kHTTP2CopyHeaders] (raw) { + const rawHeaders = raw.split('\r\n') + const headers = {} + + for (const header of rawHeaders) { + const [key, value] = header.split(': ') + + if (value == null || value.length === 0) continue + + if (headers[key]) headers[key] += `,${value}` + else headers[key] = value + } + + return headers + } +} + +function processHeaderValue (key, val, skipAppend) { + if (val && typeof val === 'object') { + throw new InvalidArgumentError(`invalid ${key} header`) + } + + val = val != null ? `${val}` : '' + + if (headerCharRegex.exec(val) !== null) { + throw new InvalidArgumentError(`invalid ${key} header`) + } + + return skipAppend ? val : `${key}: ${val}\r\n` +} + +function processHeader (request, key, val, skipAppend = false) { + if (val && (typeof val === 'object' && !Array.isArray(val))) { + throw new InvalidArgumentError(`invalid ${key} header`) + } else if (val === undefined) { + return + } + + if ( + request.host === null && + key.length === 4 && + key.toLowerCase() === 'host' + ) { + if (headerCharRegex.exec(val) !== null) { + throw new InvalidArgumentError(`invalid ${key} header`) + } + // Consumed by Client + request.host = val + } else if ( + request.contentLength === null && + key.length === 14 && + key.toLowerCase() === 'content-length' + ) { + request.contentLength = parseInt(val, 10) + if (!Number.isFinite(request.contentLength)) { + throw new InvalidArgumentError('invalid content-length header') + } + } else if ( + request.contentType === null && + key.length === 12 && + key.toLowerCase() === 'content-type' + ) { + request.contentType = val + if (skipAppend) request.headers[key] = processHeaderValue(key, val, skipAppend) + else request.headers += processHeaderValue(key, val) + } else if ( + key.length === 17 && + key.toLowerCase() === 'transfer-encoding' + ) { + throw new InvalidArgumentError('invalid transfer-encoding header') + } else if ( + key.length === 10 && + key.toLowerCase() === 'connection' + ) { + const value = typeof val === 'string' ? val.toLowerCase() : null + if (value !== 'close' && value !== 'keep-alive') { + throw new InvalidArgumentError('invalid connection header') + } else if (value === 'close') { + request.reset = true + } + } else if ( + key.length === 10 && + key.toLowerCase() === 'keep-alive' + ) { + throw new InvalidArgumentError('invalid keep-alive header') + } else if ( + key.length === 7 && + key.toLowerCase() === 'upgrade' + ) { + throw new InvalidArgumentError('invalid upgrade header') + } else if ( + key.length === 6 && + key.toLowerCase() === 'expect' + ) { + throw new NotSupportedError('expect header not supported') + } else if (tokenRegExp.exec(key) === null) { + throw new InvalidArgumentError('invalid header key') + } else { + if (Array.isArray(val)) { + for (let i = 0; i < val.length; i++) { + if (skipAppend) { + if (request.headers[key]) request.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}` + else request.headers[key] = processHeaderValue(key, val[i], skipAppend) + } else { + request.headers += processHeaderValue(key, val[i]) + } + } + } else { + if (skipAppend) request.headers[key] = processHeaderValue(key, val, skipAppend) + else request.headers += processHeaderValue(key, val) + } + } +} + +module.exports = Request + + +/***/ }), + +/***/ 2785: +/***/ ((module) => { + +module.exports = { + kClose: Symbol('close'), + kDestroy: Symbol('destroy'), + kDispatch: Symbol('dispatch'), + kUrl: Symbol('url'), + kWriting: Symbol('writing'), + kResuming: Symbol('resuming'), + kQueue: Symbol('queue'), + kConnect: Symbol('connect'), + kConnecting: Symbol('connecting'), + kHeadersList: Symbol('headers list'), + kKeepAliveDefaultTimeout: Symbol('default keep alive timeout'), + kKeepAliveMaxTimeout: Symbol('max keep alive timeout'), + kKeepAliveTimeoutThreshold: Symbol('keep alive timeout threshold'), + kKeepAliveTimeoutValue: Symbol('keep alive timeout'), + kKeepAlive: Symbol('keep alive'), + kHeadersTimeout: Symbol('headers timeout'), + kBodyTimeout: Symbol('body timeout'), + kServerName: Symbol('server name'), + kLocalAddress: Symbol('local address'), + kHost: Symbol('host'), + kNoRef: Symbol('no ref'), + kBodyUsed: Symbol('used'), + kRunning: Symbol('running'), + kBlocking: Symbol('blocking'), + kPending: Symbol('pending'), + kSize: Symbol('size'), + kBusy: Symbol('busy'), + kQueued: Symbol('queued'), + kFree: Symbol('free'), + kConnected: Symbol('connected'), + kClosed: Symbol('closed'), + kNeedDrain: Symbol('need drain'), + kReset: Symbol('reset'), + kDestroyed: Symbol.for('nodejs.stream.destroyed'), + kMaxHeadersSize: Symbol('max headers size'), + kRunningIdx: Symbol('running index'), + kPendingIdx: Symbol('pending index'), + kError: Symbol('error'), + kClients: Symbol('clients'), + kClient: Symbol('client'), + kParser: Symbol('parser'), + kOnDestroyed: Symbol('destroy callbacks'), + kPipelining: Symbol('pipelining'), + kSocket: Symbol('socket'), + kHostHeader: Symbol('host header'), + kConnector: Symbol('connector'), + kStrictContentLength: Symbol('strict content length'), + kMaxRedirections: Symbol('maxRedirections'), + kMaxRequests: Symbol('maxRequestsPerClient'), + kProxy: Symbol('proxy agent options'), + kCounter: Symbol('socket request counter'), + kInterceptors: Symbol('dispatch interceptors'), + kMaxResponseSize: Symbol('max response size'), + kHTTP2Session: Symbol('http2Session'), + kHTTP2SessionState: Symbol('http2Session state'), + kHTTP2BuildRequest: Symbol('http2 build request'), + kHTTP1BuildRequest: Symbol('http1 build request'), + kHTTP2CopyHeaders: Symbol('http2 copy headers'), + kHTTPConnVersion: Symbol('http connection version') +} + + +/***/ }), + +/***/ 3983: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const assert = __nccwpck_require__(9491) +const { kDestroyed, kBodyUsed } = __nccwpck_require__(2785) +const { IncomingMessage } = __nccwpck_require__(3685) +const stream = __nccwpck_require__(2781) +const net = __nccwpck_require__(1808) +const { InvalidArgumentError } = __nccwpck_require__(8045) +const { Blob } = __nccwpck_require__(4300) +const nodeUtil = __nccwpck_require__(3837) +const { stringify } = __nccwpck_require__(3477) + +const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v)) + +function nop () {} + +function isStream (obj) { + return obj && typeof obj === 'object' && typeof obj.pipe === 'function' && typeof obj.on === 'function' +} + +// based on https://github.com/node-fetch/fetch-blob/blob/8ab587d34080de94140b54f07168451e7d0b655e/index.js#L229-L241 (MIT License) +function isBlobLike (object) { + return (Blob && object instanceof Blob) || ( + object && + typeof object === 'object' && + (typeof object.stream === 'function' || + typeof object.arrayBuffer === 'function') && + /^(Blob|File)$/.test(object[Symbol.toStringTag]) + ) +} + +function buildURL (url, queryParams) { + if (url.includes('?') || url.includes('#')) { + throw new Error('Query params cannot be passed when url already contains "?" or "#".') + } + + const stringified = stringify(queryParams) + + if (stringified) { + url += '?' + stringified + } + + return url +} + +function parseURL (url) { + if (typeof url === 'string') { + url = new URL(url) + + if (!/^https?:/.test(url.origin || url.protocol)) { + throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.') + } + + return url + } + + if (!url || typeof url !== 'object') { + throw new InvalidArgumentError('Invalid URL: The URL argument must be a non-null object.') + } + + if (!/^https?:/.test(url.origin || url.protocol)) { + throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.') + } + + if (!(url instanceof URL)) { + if (url.port != null && url.port !== '' && !Number.isFinite(parseInt(url.port))) { + throw new InvalidArgumentError('Invalid URL: port must be a valid integer or a string representation of an integer.') + } + + if (url.path != null && typeof url.path !== 'string') { + throw new InvalidArgumentError('Invalid URL path: the path must be a string or null/undefined.') + } + + if (url.pathname != null && typeof url.pathname !== 'string') { + throw new InvalidArgumentError('Invalid URL pathname: the pathname must be a string or null/undefined.') + } + + if (url.hostname != null && typeof url.hostname !== 'string') { + throw new InvalidArgumentError('Invalid URL hostname: the hostname must be a string or null/undefined.') + } + + if (url.origin != null && typeof url.origin !== 'string') { + throw new InvalidArgumentError('Invalid URL origin: the origin must be a string or null/undefined.') + } + + const port = url.port != null + ? url.port + : (url.protocol === 'https:' ? 443 : 80) + let origin = url.origin != null + ? url.origin + : `${url.protocol}//${url.hostname}:${port}` + let path = url.path != null + ? url.path + : `${url.pathname || ''}${url.search || ''}` + + if (origin.endsWith('/')) { + origin = origin.substring(0, origin.length - 1) + } + + if (path && !path.startsWith('/')) { + path = `/${path}` + } + // new URL(path, origin) is unsafe when `path` contains an absolute URL + // From https://developer.mozilla.org/en-US/docs/Web/API/URL/URL: + // If first parameter is a relative URL, second param is required, and will be used as the base URL. + // If first parameter is an absolute URL, a given second param will be ignored. + url = new URL(origin + path) + } + + return url +} + +function parseOrigin (url) { + url = parseURL(url) + + if (url.pathname !== '/' || url.search || url.hash) { + throw new InvalidArgumentError('invalid url') + } + + return url +} + +function getHostname (host) { + if (host[0] === '[') { + const idx = host.indexOf(']') + + assert(idx !== -1) + return host.substr(1, idx - 1) + } + + const idx = host.indexOf(':') + if (idx === -1) return host + + return host.substr(0, idx) +} + +// IP addresses are not valid server names per RFC6066 +// > Currently, the only server names supported are DNS hostnames +function getServerName (host) { + if (!host) { + return null + } + + assert.strictEqual(typeof host, 'string') + + const servername = getHostname(host) + if (net.isIP(servername)) { + return '' + } + + return servername +} + +function deepClone (obj) { + return JSON.parse(JSON.stringify(obj)) +} + +function isAsyncIterable (obj) { + return !!(obj != null && typeof obj[Symbol.asyncIterator] === 'function') +} + +function isIterable (obj) { + return !!(obj != null && (typeof obj[Symbol.iterator] === 'function' || typeof obj[Symbol.asyncIterator] === 'function')) +} + +function bodyLength (body) { + if (body == null) { + return 0 + } else if (isStream(body)) { + const state = body._readableState + return state && state.objectMode === false && state.ended === true && Number.isFinite(state.length) + ? state.length + : null + } else if (isBlobLike(body)) { + return body.size != null ? body.size : null + } else if (isBuffer(body)) { + return body.byteLength + } + + return null +} + +function isDestroyed (stream) { + return !stream || !!(stream.destroyed || stream[kDestroyed]) +} + +function isReadableAborted (stream) { + const state = stream && stream._readableState + return isDestroyed(stream) && state && !state.endEmitted +} + +function destroy (stream, err) { + if (!isStream(stream) || isDestroyed(stream)) { + return + } + + if (typeof stream.destroy === 'function') { + if (Object.getPrototypeOf(stream).constructor === IncomingMessage) { + // See: https://github.com/nodejs/node/pull/38505/files + stream.socket = null + } + + stream.destroy(err) + } else if (err) { + process.nextTick((stream, err) => { + stream.emit('error', err) + }, stream, err) + } + + if (stream.destroyed !== true) { + stream[kDestroyed] = true + } +} + +const KEEPALIVE_TIMEOUT_EXPR = /timeout=(\d+)/ +function parseKeepAliveTimeout (val) { + const m = val.toString().match(KEEPALIVE_TIMEOUT_EXPR) + return m ? parseInt(m[1], 10) * 1000 : null +} + +function parseHeaders (headers, obj = {}) { + // For H2 support + if (!Array.isArray(headers)) return headers + + for (let i = 0; i < headers.length; i += 2) { + const key = headers[i].toString().toLowerCase() + let val = obj[key] + + if (!val) { + if (Array.isArray(headers[i + 1])) { + obj[key] = headers[i + 1] + } else { + obj[key] = headers[i + 1].toString('utf8') + } + } else { + if (!Array.isArray(val)) { + val = [val] + obj[key] = val + } + val.push(headers[i + 1].toString('utf8')) + } + } + + // See https://github.com/nodejs/node/pull/46528 + if ('content-length' in obj && 'content-disposition' in obj) { + obj['content-disposition'] = Buffer.from(obj['content-disposition']).toString('latin1') + } + + return obj +} + +function parseRawHeaders (headers) { + const ret = [] + let hasContentLength = false + let contentDispositionIdx = -1 + + for (let n = 0; n < headers.length; n += 2) { + const key = headers[n + 0].toString() + const val = headers[n + 1].toString('utf8') + + if (key.length === 14 && (key === 'content-length' || key.toLowerCase() === 'content-length')) { + ret.push(key, val) + hasContentLength = true + } else if (key.length === 19 && (key === 'content-disposition' || key.toLowerCase() === 'content-disposition')) { + contentDispositionIdx = ret.push(key, val) - 1 + } else { + ret.push(key, val) + } + } + + // See https://github.com/nodejs/node/pull/46528 + if (hasContentLength && contentDispositionIdx !== -1) { + ret[contentDispositionIdx] = Buffer.from(ret[contentDispositionIdx]).toString('latin1') + } + + return ret +} + +function isBuffer (buffer) { + // See, https://github.com/mcollina/undici/pull/319 + return buffer instanceof Uint8Array || Buffer.isBuffer(buffer) +} + +function validateHandler (handler, method, upgrade) { + if (!handler || typeof handler !== 'object') { + throw new InvalidArgumentError('handler must be an object') + } + + if (typeof handler.onConnect !== 'function') { + throw new InvalidArgumentError('invalid onConnect method') + } + + if (typeof handler.onError !== 'function') { + throw new InvalidArgumentError('invalid onError method') + } + + if (typeof handler.onBodySent !== 'function' && handler.onBodySent !== undefined) { + throw new InvalidArgumentError('invalid onBodySent method') + } + + if (upgrade || method === 'CONNECT') { + if (typeof handler.onUpgrade !== 'function') { + throw new InvalidArgumentError('invalid onUpgrade method') + } + } else { + if (typeof handler.onHeaders !== 'function') { + throw new InvalidArgumentError('invalid onHeaders method') + } + + if (typeof handler.onData !== 'function') { + throw new InvalidArgumentError('invalid onData method') + } + + if (typeof handler.onComplete !== 'function') { + throw new InvalidArgumentError('invalid onComplete method') + } + } +} + +// A body is disturbed if it has been read from and it cannot +// be re-used without losing state or data. +function isDisturbed (body) { + return !!(body && ( + stream.isDisturbed + ? stream.isDisturbed(body) || body[kBodyUsed] // TODO (fix): Why is body[kBodyUsed] needed? + : body[kBodyUsed] || + body.readableDidRead || + (body._readableState && body._readableState.dataEmitted) || + isReadableAborted(body) + )) +} + +function isErrored (body) { + return !!(body && ( + stream.isErrored + ? stream.isErrored(body) + : /state: 'errored'/.test(nodeUtil.inspect(body) + ))) +} + +function isReadable (body) { + return !!(body && ( + stream.isReadable + ? stream.isReadable(body) + : /state: 'readable'/.test(nodeUtil.inspect(body) + ))) +} + +function getSocketInfo (socket) { + return { + localAddress: socket.localAddress, + localPort: socket.localPort, + remoteAddress: socket.remoteAddress, + remotePort: socket.remotePort, + remoteFamily: socket.remoteFamily, + timeout: socket.timeout, + bytesWritten: socket.bytesWritten, + bytesRead: socket.bytesRead + } +} + +async function * convertIterableToBuffer (iterable) { + for await (const chunk of iterable) { + yield Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk) + } +} + +let ReadableStream +function ReadableStreamFrom (iterable) { + if (!ReadableStream) { + ReadableStream = (__nccwpck_require__(5356).ReadableStream) + } + + if (ReadableStream.from) { + return ReadableStream.from(convertIterableToBuffer(iterable)) + } + + let iterator + return new ReadableStream( + { + async start () { + iterator = iterable[Symbol.asyncIterator]() + }, + async pull (controller) { + const { done, value } = await iterator.next() + if (done) { + queueMicrotask(() => { + controller.close() + }) + } else { + const buf = Buffer.isBuffer(value) ? value : Buffer.from(value) + controller.enqueue(new Uint8Array(buf)) + } + return controller.desiredSize > 0 + }, + async cancel (reason) { + await iterator.return() + } + }, + 0 + ) +} + +// The chunk should be a FormData instance and contains +// all the required methods. +function isFormDataLike (object) { + return ( + object && + typeof object === 'object' && + typeof object.append === 'function' && + typeof object.delete === 'function' && + typeof object.get === 'function' && + typeof object.getAll === 'function' && + typeof object.has === 'function' && + typeof object.set === 'function' && + object[Symbol.toStringTag] === 'FormData' + ) +} + +function throwIfAborted (signal) { + if (!signal) { return } + if (typeof signal.throwIfAborted === 'function') { + signal.throwIfAborted() + } else { + if (signal.aborted) { + // DOMException not available < v17.0.0 + const err = new Error('The operation was aborted') + err.name = 'AbortError' + throw err + } + } +} + +let events +function addAbortListener (signal, listener) { + if (typeof Symbol.dispose === 'symbol') { + if (!events) { + events = __nccwpck_require__(2361) + } + if (typeof events.addAbortListener === 'function' && 'aborted' in signal) { + return events.addAbortListener(signal, listener) + } + } + if ('addEventListener' in signal) { + signal.addEventListener('abort', listener, { once: true }) + return () => signal.removeEventListener('abort', listener) + } + signal.addListener('abort', listener) + return () => signal.removeListener('abort', listener) +} + +const hasToWellFormed = !!String.prototype.toWellFormed + +/** + * @param {string} val + */ +function toUSVString (val) { + if (hasToWellFormed) { + return `${val}`.toWellFormed() + } else if (nodeUtil.toUSVString) { + return nodeUtil.toUSVString(val) + } + + return `${val}` +} + +const kEnumerableProperty = Object.create(null) +kEnumerableProperty.enumerable = true + +module.exports = { + kEnumerableProperty, + nop, + isDisturbed, + isErrored, + isReadable, + toUSVString, + isReadableAborted, + isBlobLike, + parseOrigin, + parseURL, + getServerName, + isStream, + isIterable, + isAsyncIterable, + isDestroyed, + parseRawHeaders, + parseHeaders, + parseKeepAliveTimeout, + destroy, + bodyLength, + deepClone, + ReadableStreamFrom, + isBuffer, + validateHandler, + getSocketInfo, + isFormDataLike, + buildURL, + throwIfAborted, + addAbortListener, + nodeMajor, + nodeMinor, + nodeHasAutoSelectFamily: nodeMajor > 18 || (nodeMajor === 18 && nodeMinor >= 13) +} + + +/***/ }), + +/***/ 4839: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Dispatcher = __nccwpck_require__(412) +const { + ClientDestroyedError, + ClientClosedError, + InvalidArgumentError +} = __nccwpck_require__(8045) +const { kDestroy, kClose, kDispatch, kInterceptors } = __nccwpck_require__(2785) + +const kDestroyed = Symbol('destroyed') +const kClosed = Symbol('closed') +const kOnDestroyed = Symbol('onDestroyed') +const kOnClosed = Symbol('onClosed') +const kInterceptedDispatch = Symbol('Intercepted Dispatch') + +class DispatcherBase extends Dispatcher { + constructor () { + super() + + this[kDestroyed] = false + this[kOnDestroyed] = null + this[kClosed] = false + this[kOnClosed] = [] + } + + get destroyed () { + return this[kDestroyed] + } + + get closed () { + return this[kClosed] + } + + get interceptors () { + return this[kInterceptors] + } + + set interceptors (newInterceptors) { + if (newInterceptors) { + for (let i = newInterceptors.length - 1; i >= 0; i--) { + const interceptor = this[kInterceptors][i] + if (typeof interceptor !== 'function') { + throw new InvalidArgumentError('interceptor must be an function') + } + } + } + + this[kInterceptors] = newInterceptors + } + + close (callback) { + if (callback === undefined) { + return new Promise((resolve, reject) => { + this.close((err, data) => { + return err ? reject(err) : resolve(data) + }) + }) + } + + if (typeof callback !== 'function') { + throw new InvalidArgumentError('invalid callback') + } + + if (this[kDestroyed]) { + queueMicrotask(() => callback(new ClientDestroyedError(), null)) + return + } + + if (this[kClosed]) { + if (this[kOnClosed]) { + this[kOnClosed].push(callback) + } else { + queueMicrotask(() => callback(null, null)) + } + return + } + + this[kClosed] = true + this[kOnClosed].push(callback) + + const onClosed = () => { + const callbacks = this[kOnClosed] + this[kOnClosed] = null + for (let i = 0; i < callbacks.length; i++) { + callbacks[i](null, null) + } + } + + // Should not error. + this[kClose]() + .then(() => this.destroy()) + .then(() => { + queueMicrotask(onClosed) + }) + } + + destroy (err, callback) { + if (typeof err === 'function') { + callback = err + err = null + } + + if (callback === undefined) { + return new Promise((resolve, reject) => { + this.destroy(err, (err, data) => { + return err ? /* istanbul ignore next: should never error */ reject(err) : resolve(data) + }) + }) + } + + if (typeof callback !== 'function') { + throw new InvalidArgumentError('invalid callback') + } + + if (this[kDestroyed]) { + if (this[kOnDestroyed]) { + this[kOnDestroyed].push(callback) + } else { + queueMicrotask(() => callback(null, null)) + } + return + } + + if (!err) { + err = new ClientDestroyedError() + } + + this[kDestroyed] = true + this[kOnDestroyed] = this[kOnDestroyed] || [] + this[kOnDestroyed].push(callback) + + const onDestroyed = () => { + const callbacks = this[kOnDestroyed] + this[kOnDestroyed] = null + for (let i = 0; i < callbacks.length; i++) { + callbacks[i](null, null) + } + } + + // Should not error. + this[kDestroy](err).then(() => { + queueMicrotask(onDestroyed) + }) + } + + [kInterceptedDispatch] (opts, handler) { + if (!this[kInterceptors] || this[kInterceptors].length === 0) { + this[kInterceptedDispatch] = this[kDispatch] + return this[kDispatch](opts, handler) + } + + let dispatch = this[kDispatch].bind(this) + for (let i = this[kInterceptors].length - 1; i >= 0; i--) { + dispatch = this[kInterceptors][i](dispatch) + } + this[kInterceptedDispatch] = dispatch + return dispatch(opts, handler) + } + + dispatch (opts, handler) { + if (!handler || typeof handler !== 'object') { + throw new InvalidArgumentError('handler must be an object') + } + + try { + if (!opts || typeof opts !== 'object') { + throw new InvalidArgumentError('opts must be an object.') + } + + if (this[kDestroyed] || this[kOnDestroyed]) { + throw new ClientDestroyedError() + } + + if (this[kClosed]) { + throw new ClientClosedError() + } + + return this[kInterceptedDispatch](opts, handler) + } catch (err) { + if (typeof handler.onError !== 'function') { + throw new InvalidArgumentError('invalid onError method') + } + + handler.onError(err) + + return false + } + } +} + +module.exports = DispatcherBase + + +/***/ }), + +/***/ 412: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const EventEmitter = __nccwpck_require__(2361) + +class Dispatcher extends EventEmitter { + dispatch () { + throw new Error('not implemented') + } + + close () { + throw new Error('not implemented') + } + + destroy () { + throw new Error('not implemented') + } +} + +module.exports = Dispatcher + + +/***/ }), + +/***/ 9990: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Busboy = __nccwpck_require__(3438) +const util = __nccwpck_require__(3983) +const { + ReadableStreamFrom, + isBlobLike, + isReadableStreamLike, + readableStreamClose, + createDeferredPromise, + fullyReadBody +} = __nccwpck_require__(2538) +const { FormData } = __nccwpck_require__(2015) +const { kState } = __nccwpck_require__(5861) +const { webidl } = __nccwpck_require__(1744) +const { DOMException, structuredClone } = __nccwpck_require__(1037) +const { Blob, File: NativeFile } = __nccwpck_require__(4300) +const { kBodyUsed } = __nccwpck_require__(2785) +const assert = __nccwpck_require__(9491) +const { isErrored } = __nccwpck_require__(3983) +const { isUint8Array, isArrayBuffer } = __nccwpck_require__(4978) +const { File: UndiciFile } = __nccwpck_require__(8511) +const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685) + +let ReadableStream = globalThis.ReadableStream + +/** @type {globalThis['File']} */ +const File = NativeFile ?? UndiciFile + +// https://fetch.spec.whatwg.org/#concept-bodyinit-extract +function extractBody (object, keepalive = false) { + if (!ReadableStream) { + ReadableStream = (__nccwpck_require__(5356).ReadableStream) + } + + // 1. Let stream be null. + let stream = null + + // 2. If object is a ReadableStream object, then set stream to object. + if (object instanceof ReadableStream) { + stream = object + } else if (isBlobLike(object)) { + // 3. Otherwise, if object is a Blob object, set stream to the + // result of running object’s get stream. + stream = object.stream() + } else { + // 4. Otherwise, set stream to a new ReadableStream object, and set + // up stream. + stream = new ReadableStream({ + async pull (controller) { + controller.enqueue( + typeof source === 'string' ? new TextEncoder().encode(source) : source + ) + queueMicrotask(() => readableStreamClose(controller)) + }, + start () {}, + type: undefined + }) + } + + // 5. Assert: stream is a ReadableStream object. + assert(isReadableStreamLike(stream)) + + // 6. Let action be null. + let action = null + + // 7. Let source be null. + let source = null + + // 8. Let length be null. + let length = null + + // 9. Let type be null. + let type = null + + // 10. Switch on object: + if (typeof object === 'string') { + // Set source to the UTF-8 encoding of object. + // Note: setting source to a Uint8Array here breaks some mocking assumptions. + source = object + + // Set type to `text/plain;charset=UTF-8`. + type = 'text/plain;charset=UTF-8' + } else if (object instanceof URLSearchParams) { + // URLSearchParams + + // spec says to run application/x-www-form-urlencoded on body.list + // this is implemented in Node.js as apart of an URLSearchParams instance toString method + // See: https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L490 + // and https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L1100 + + // Set source to the result of running the application/x-www-form-urlencoded serializer with object’s list. + source = object.toString() + + // Set type to `application/x-www-form-urlencoded;charset=UTF-8`. + type = 'application/x-www-form-urlencoded;charset=UTF-8' + } else if (isArrayBuffer(object)) { + // BufferSource/ArrayBuffer + + // Set source to a copy of the bytes held by object. + source = new Uint8Array(object.slice()) + } else if (ArrayBuffer.isView(object)) { + // BufferSource/ArrayBufferView + + // Set source to a copy of the bytes held by object. + source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength)) + } else if (util.isFormDataLike(object)) { + const boundary = `----formdata-undici-0${`${Math.floor(Math.random() * 1e11)}`.padStart(11, '0')}` + const prefix = `--${boundary}\r\nContent-Disposition: form-data` + + /*! formdata-polyfill. MIT License. Jimmy Wärting */ + const escape = (str) => + str.replace(/\n/g, '%0A').replace(/\r/g, '%0D').replace(/"/g, '%22') + const normalizeLinefeeds = (value) => value.replace(/\r?\n|\r/g, '\r\n') + + // Set action to this step: run the multipart/form-data + // encoding algorithm, with object’s entry list and UTF-8. + // - This ensures that the body is immutable and can't be changed afterwords + // - That the content-length is calculated in advance. + // - And that all parts are pre-encoded and ready to be sent. + + const enc = new TextEncoder() + const blobParts = [] + const rn = new Uint8Array([13, 10]) // '\r\n' + length = 0 + let hasUnknownSizeValue = false + + for (const [name, value] of object) { + if (typeof value === 'string') { + const chunk = enc.encode(prefix + + `; name="${escape(normalizeLinefeeds(name))}"` + + `\r\n\r\n${normalizeLinefeeds(value)}\r\n`) + blobParts.push(chunk) + length += chunk.byteLength + } else { + const chunk = enc.encode(`${prefix}; name="${escape(normalizeLinefeeds(name))}"` + + (value.name ? `; filename="${escape(value.name)}"` : '') + '\r\n' + + `Content-Type: ${ + value.type || 'application/octet-stream' + }\r\n\r\n`) + blobParts.push(chunk, value, rn) + if (typeof value.size === 'number') { + length += chunk.byteLength + value.size + rn.byteLength + } else { + hasUnknownSizeValue = true + } + } + } + + const chunk = enc.encode(`--${boundary}--`) + blobParts.push(chunk) + length += chunk.byteLength + if (hasUnknownSizeValue) { + length = null + } + + // Set source to object. + source = object + + action = async function * () { + for (const part of blobParts) { + if (part.stream) { + yield * part.stream() + } else { + yield part + } + } + } + + // Set type to `multipart/form-data; boundary=`, + // followed by the multipart/form-data boundary string generated + // by the multipart/form-data encoding algorithm. + type = 'multipart/form-data; boundary=' + boundary + } else if (isBlobLike(object)) { + // Blob + + // Set source to object. + source = object + + // Set length to object’s size. + length = object.size + + // If object’s type attribute is not the empty byte sequence, set + // type to its value. + if (object.type) { + type = object.type + } + } else if (typeof object[Symbol.asyncIterator] === 'function') { + // If keepalive is true, then throw a TypeError. + if (keepalive) { + throw new TypeError('keepalive') + } + + // If object is disturbed or locked, then throw a TypeError. + if (util.isDisturbed(object) || object.locked) { + throw new TypeError( + 'Response body object should not be disturbed or locked' + ) + } + + stream = + object instanceof ReadableStream ? object : ReadableStreamFrom(object) + } + + // 11. If source is a byte sequence, then set action to a + // step that returns source and length to source’s length. + if (typeof source === 'string' || util.isBuffer(source)) { + length = Buffer.byteLength(source) + } + + // 12. If action is non-null, then run these steps in in parallel: + if (action != null) { + // Run action. + let iterator + stream = new ReadableStream({ + async start () { + iterator = action(object)[Symbol.asyncIterator]() + }, + async pull (controller) { + const { value, done } = await iterator.next() + if (done) { + // When running action is done, close stream. + queueMicrotask(() => { + controller.close() + }) + } else { + // Whenever one or more bytes are available and stream is not errored, + // enqueue a Uint8Array wrapping an ArrayBuffer containing the available + // bytes into stream. + if (!isErrored(stream)) { + controller.enqueue(new Uint8Array(value)) + } + } + return controller.desiredSize > 0 + }, + async cancel (reason) { + await iterator.return() + }, + type: undefined + }) + } + + // 13. Let body be a body whose stream is stream, source is source, + // and length is length. + const body = { stream, source, length } + + // 14. Return (body, type). + return [body, type] +} + +// https://fetch.spec.whatwg.org/#bodyinit-safely-extract +function safelyExtractBody (object, keepalive = false) { + if (!ReadableStream) { + // istanbul ignore next + ReadableStream = (__nccwpck_require__(5356).ReadableStream) + } + + // To safely extract a body and a `Content-Type` value from + // a byte sequence or BodyInit object object, run these steps: + + // 1. If object is a ReadableStream object, then: + if (object instanceof ReadableStream) { + // Assert: object is neither disturbed nor locked. + // istanbul ignore next + assert(!util.isDisturbed(object), 'The body has already been consumed.') + // istanbul ignore next + assert(!object.locked, 'The stream is locked.') + } + + // 2. Return the results of extracting object. + return extractBody(object, keepalive) +} + +function cloneBody (body) { + // To clone a body body, run these steps: + + // https://fetch.spec.whatwg.org/#concept-body-clone + + // 1. Let « out1, out2 » be the result of teeing body’s stream. + const [out1, out2] = body.stream.tee() + const out2Clone = structuredClone(out2, { transfer: [out2] }) + // This, for whatever reasons, unrefs out2Clone which allows + // the process to exit by itself. + const [, finalClone] = out2Clone.tee() + + // 2. Set body’s stream to out1. + body.stream = out1 + + // 3. Return a body whose stream is out2 and other members are copied from body. + return { + stream: finalClone, + length: body.length, + source: body.source + } +} + +async function * consumeBody (body) { + if (body) { + if (isUint8Array(body)) { + yield body + } else { + const stream = body.stream + + if (util.isDisturbed(stream)) { + throw new TypeError('The body has already been consumed.') + } + + if (stream.locked) { + throw new TypeError('The stream is locked.') + } + + // Compat. + stream[kBodyUsed] = true + + yield * stream + } + } +} + +function throwIfAborted (state) { + if (state.aborted) { + throw new DOMException('The operation was aborted.', 'AbortError') + } +} + +function bodyMixinMethods (instance) { + const methods = { + blob () { + // The blob() method steps are to return the result of + // running consume body with this and the following step + // given a byte sequence bytes: return a Blob whose + // contents are bytes and whose type attribute is this’s + // MIME type. + return specConsumeBody(this, (bytes) => { + let mimeType = bodyMimeType(this) + + if (mimeType === 'failure') { + mimeType = '' + } else if (mimeType) { + mimeType = serializeAMimeType(mimeType) + } + + // Return a Blob whose contents are bytes and type attribute + // is mimeType. + return new Blob([bytes], { type: mimeType }) + }, instance) + }, + + arrayBuffer () { + // The arrayBuffer() method steps are to return the result + // of running consume body with this and the following step + // given a byte sequence bytes: return a new ArrayBuffer + // whose contents are bytes. + return specConsumeBody(this, (bytes) => { + return new Uint8Array(bytes).buffer + }, instance) + }, + + text () { + // The text() method steps are to return the result of running + // consume body with this and UTF-8 decode. + return specConsumeBody(this, utf8DecodeBytes, instance) + }, + + json () { + // The json() method steps are to return the result of running + // consume body with this and parse JSON from bytes. + return specConsumeBody(this, parseJSONFromBytes, instance) + }, + + async formData () { + webidl.brandCheck(this, instance) + + throwIfAborted(this[kState]) + + const contentType = this.headers.get('Content-Type') + + // If mimeType’s essence is "multipart/form-data", then: + if (/multipart\/form-data/.test(contentType)) { + const headers = {} + for (const [key, value] of this.headers) headers[key.toLowerCase()] = value + + const responseFormData = new FormData() + + let busboy + + try { + busboy = new Busboy({ + headers, + preservePath: true + }) + } catch (err) { + throw new DOMException(`${err}`, 'AbortError') + } + + busboy.on('field', (name, value) => { + responseFormData.append(name, value) + }) + busboy.on('file', (name, value, filename, encoding, mimeType) => { + const chunks = [] + + if (encoding === 'base64' || encoding.toLowerCase() === 'base64') { + let base64chunk = '' + + value.on('data', (chunk) => { + base64chunk += chunk.toString().replace(/[\r\n]/gm, '') + + const end = base64chunk.length - base64chunk.length % 4 + chunks.push(Buffer.from(base64chunk.slice(0, end), 'base64')) + + base64chunk = base64chunk.slice(end) + }) + value.on('end', () => { + chunks.push(Buffer.from(base64chunk, 'base64')) + responseFormData.append(name, new File(chunks, filename, { type: mimeType })) + }) + } else { + value.on('data', (chunk) => { + chunks.push(chunk) + }) + value.on('end', () => { + responseFormData.append(name, new File(chunks, filename, { type: mimeType })) + }) + } + }) + + const busboyResolve = new Promise((resolve, reject) => { + busboy.on('finish', resolve) + busboy.on('error', (err) => reject(new TypeError(err))) + }) + + if (this.body !== null) for await (const chunk of consumeBody(this[kState].body)) busboy.write(chunk) + busboy.end() + await busboyResolve + + return responseFormData + } else if (/application\/x-www-form-urlencoded/.test(contentType)) { + // Otherwise, if mimeType’s essence is "application/x-www-form-urlencoded", then: + + // 1. Let entries be the result of parsing bytes. + let entries + try { + let text = '' + // application/x-www-form-urlencoded parser will keep the BOM. + // https://url.spec.whatwg.org/#concept-urlencoded-parser + const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }) + for await (const chunk of consumeBody(this[kState].body)) { + if (!isUint8Array(chunk)) { + throw new TypeError('Expected Uint8Array chunk') + } + text += textDecoder.decode(chunk, { stream: true }) + } + text += textDecoder.decode() + entries = new URLSearchParams(text) + } catch (err) { + // istanbul ignore next: Unclear when new URLSearchParams can fail on a string. + // 2. If entries is failure, then throw a TypeError. + throw Object.assign(new TypeError(), { cause: err }) + } + + // 3. Return a new FormData object whose entries are entries. + const formData = new FormData() + for (const [name, value] of entries) { + formData.append(name, value) + } + return formData + } else { + // Wait a tick before checking if the request has been aborted. + // Otherwise, a TypeError can be thrown when an AbortError should. + await Promise.resolve() + + throwIfAborted(this[kState]) + + // Otherwise, throw a TypeError. + throw webidl.errors.exception({ + header: `${instance.name}.formData`, + message: 'Could not parse content as FormData.' + }) + } + } + } + + return methods +} + +function mixinBody (prototype) { + Object.assign(prototype.prototype, bodyMixinMethods(prototype)) +} + +/** + * @see https://fetch.spec.whatwg.org/#concept-body-consume-body + * @param {Response|Request} object + * @param {(value: unknown) => unknown} convertBytesToJSValue + * @param {Response|Request} instance + */ +async function specConsumeBody (object, convertBytesToJSValue, instance) { + webidl.brandCheck(object, instance) + + throwIfAborted(object[kState]) + + // 1. If object is unusable, then return a promise rejected + // with a TypeError. + if (bodyUnusable(object[kState].body)) { + throw new TypeError('Body is unusable') + } + + // 2. Let promise be a new promise. + const promise = createDeferredPromise() + + // 3. Let errorSteps given error be to reject promise with error. + const errorSteps = (error) => promise.reject(error) + + // 4. Let successSteps given a byte sequence data be to resolve + // promise with the result of running convertBytesToJSValue + // with data. If that threw an exception, then run errorSteps + // with that exception. + const successSteps = (data) => { + try { + promise.resolve(convertBytesToJSValue(data)) + } catch (e) { + errorSteps(e) + } + } + + // 5. If object’s body is null, then run successSteps with an + // empty byte sequence. + if (object[kState].body == null) { + successSteps(new Uint8Array()) + return promise.promise + } + + // 6. Otherwise, fully read object’s body given successSteps, + // errorSteps, and object’s relevant global object. + await fullyReadBody(object[kState].body, successSteps, errorSteps) + + // 7. Return promise. + return promise.promise +} + +// https://fetch.spec.whatwg.org/#body-unusable +function bodyUnusable (body) { + // An object including the Body interface mixin is + // said to be unusable if its body is non-null and + // its body’s stream is disturbed or locked. + return body != null && (body.stream.locked || util.isDisturbed(body.stream)) +} + +/** + * @see https://encoding.spec.whatwg.org/#utf-8-decode + * @param {Buffer} buffer + */ +function utf8DecodeBytes (buffer) { + if (buffer.length === 0) { + return '' + } + + // 1. Let buffer be the result of peeking three bytes from + // ioQueue, converted to a byte sequence. + + // 2. If buffer is 0xEF 0xBB 0xBF, then read three + // bytes from ioQueue. (Do nothing with those bytes.) + if (buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) { + buffer = buffer.subarray(3) + } + + // 3. Process a queue with an instance of UTF-8’s + // decoder, ioQueue, output, and "replacement". + const output = new TextDecoder().decode(buffer) + + // 4. Return output. + return output +} + +/** + * @see https://infra.spec.whatwg.org/#parse-json-bytes-to-a-javascript-value + * @param {Uint8Array} bytes + */ +function parseJSONFromBytes (bytes) { + return JSON.parse(utf8DecodeBytes(bytes)) +} + +/** + * @see https://fetch.spec.whatwg.org/#concept-body-mime-type + * @param {import('./response').Response|import('./request').Request} object + */ +function bodyMimeType (object) { + const { headersList } = object[kState] + const contentType = headersList.get('content-type') + + if (contentType === null) { + return 'failure' + } + + return parseMIMEType(contentType) +} + +module.exports = { + extractBody, + safelyExtractBody, + cloneBody, + mixinBody +} + + +/***/ }), + +/***/ 1037: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { MessageChannel, receiveMessageOnPort } = __nccwpck_require__(1267) + +const corsSafeListedMethods = ['GET', 'HEAD', 'POST'] + +const nullBodyStatus = [101, 204, 205, 304] + +const redirectStatus = [301, 302, 303, 307, 308] + +// https://fetch.spec.whatwg.org/#block-bad-port +const badPorts = [ + '1', '7', '9', '11', '13', '15', '17', '19', '20', '21', '22', '23', '25', '37', '42', '43', '53', '69', '77', '79', + '87', '95', '101', '102', '103', '104', '109', '110', '111', '113', '115', '117', '119', '123', '135', '137', + '139', '143', '161', '179', '389', '427', '465', '512', '513', '514', '515', '526', '530', '531', '532', + '540', '548', '554', '556', '563', '587', '601', '636', '989', '990', '993', '995', '1719', '1720', '1723', + '2049', '3659', '4045', '5060', '5061', '6000', '6566', '6665', '6666', '6667', '6668', '6669', '6697', + '10080' +] + +// https://w3c.github.io/webappsec-referrer-policy/#referrer-policies +const referrerPolicy = [ + '', + 'no-referrer', + 'no-referrer-when-downgrade', + 'same-origin', + 'origin', + 'strict-origin', + 'origin-when-cross-origin', + 'strict-origin-when-cross-origin', + 'unsafe-url' +] + +const requestRedirect = ['follow', 'manual', 'error'] + +const safeMethods = ['GET', 'HEAD', 'OPTIONS', 'TRACE'] + +const requestMode = ['navigate', 'same-origin', 'no-cors', 'cors'] + +const requestCredentials = ['omit', 'same-origin', 'include'] + +const requestCache = [ + 'default', + 'no-store', + 'reload', + 'no-cache', + 'force-cache', + 'only-if-cached' +] + +// https://fetch.spec.whatwg.org/#request-body-header-name +const requestBodyHeader = [ + 'content-encoding', + 'content-language', + 'content-location', + 'content-type', + // See https://github.com/nodejs/undici/issues/2021 + // 'Content-Length' is a forbidden header name, which is typically + // removed in the Headers implementation. However, undici doesn't + // filter out headers, so we add it here. + 'content-length' +] + +// https://fetch.spec.whatwg.org/#enumdef-requestduplex +const requestDuplex = [ + 'half' +] + +// http://fetch.spec.whatwg.org/#forbidden-method +const forbiddenMethods = ['CONNECT', 'TRACE', 'TRACK'] + +const subresource = [ + 'audio', + 'audioworklet', + 'font', + 'image', + 'manifest', + 'paintworklet', + 'script', + 'style', + 'track', + 'video', + 'xslt', + '' +] + +/** @type {globalThis['DOMException']} */ +const DOMException = globalThis.DOMException ?? (() => { + // DOMException was only made a global in Node v17.0.0, + // but fetch supports >= v16.8. + try { + atob('~') + } catch (err) { + return Object.getPrototypeOf(err).constructor + } +})() + +let channel + +/** @type {globalThis['structuredClone']} */ +const structuredClone = + globalThis.structuredClone ?? + // https://github.com/nodejs/node/blob/b27ae24dcc4251bad726d9d84baf678d1f707fed/lib/internal/structured_clone.js + // structuredClone was added in v17.0.0, but fetch supports v16.8 + function structuredClone (value, options = undefined) { + if (arguments.length === 0) { + throw new TypeError('missing argument') + } + + if (!channel) { + channel = new MessageChannel() + } + channel.port1.unref() + channel.port2.unref() + channel.port1.postMessage(value, options?.transfer) + return receiveMessageOnPort(channel.port2).message + } + +module.exports = { + DOMException, + structuredClone, + subresource, + forbiddenMethods, + requestBodyHeader, + referrerPolicy, + requestRedirect, + requestMode, + requestCredentials, + requestCache, + redirectStatus, + corsSafeListedMethods, + nullBodyStatus, + safeMethods, + badPorts, + requestDuplex +} + + +/***/ }), + +/***/ 685: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const assert = __nccwpck_require__(9491) +const { atob } = __nccwpck_require__(4300) +const { isomorphicDecode } = __nccwpck_require__(2538) + +const encoder = new TextEncoder() + +/** + * @see https://mimesniff.spec.whatwg.org/#http-token-code-point + */ +const HTTP_TOKEN_CODEPOINTS = /^[!#$%&'*+-.^_|~A-Za-z0-9]+$/ +const HTTP_WHITESPACE_REGEX = /(\u000A|\u000D|\u0009|\u0020)/ // eslint-disable-line +/** + * @see https://mimesniff.spec.whatwg.org/#http-quoted-string-token-code-point + */ +const HTTP_QUOTED_STRING_TOKENS = /[\u0009|\u0020-\u007E|\u0080-\u00FF]/ // eslint-disable-line + +// https://fetch.spec.whatwg.org/#data-url-processor +/** @param {URL} dataURL */ +function dataURLProcessor (dataURL) { + // 1. Assert: dataURL’s scheme is "data". + assert(dataURL.protocol === 'data:') + + // 2. Let input be the result of running the URL + // serializer on dataURL with exclude fragment + // set to true. + let input = URLSerializer(dataURL, true) + + // 3. Remove the leading "data:" string from input. + input = input.slice(5) + + // 4. Let position point at the start of input. + const position = { position: 0 } + + // 5. Let mimeType be the result of collecting a + // sequence of code points that are not equal + // to U+002C (,), given position. + let mimeType = collectASequenceOfCodePointsFast( + ',', + input, + position + ) + + // 6. Strip leading and trailing ASCII whitespace + // from mimeType. + // Undici implementation note: we need to store the + // length because if the mimetype has spaces removed, + // the wrong amount will be sliced from the input in + // step #9 + const mimeTypeLength = mimeType.length + mimeType = removeASCIIWhitespace(mimeType, true, true) + + // 7. If position is past the end of input, then + // return failure + if (position.position >= input.length) { + return 'failure' + } + + // 8. Advance position by 1. + position.position++ + + // 9. Let encodedBody be the remainder of input. + const encodedBody = input.slice(mimeTypeLength + 1) + + // 10. Let body be the percent-decoding of encodedBody. + let body = stringPercentDecode(encodedBody) + + // 11. If mimeType ends with U+003B (;), followed by + // zero or more U+0020 SPACE, followed by an ASCII + // case-insensitive match for "base64", then: + if (/;(\u0020){0,}base64$/i.test(mimeType)) { + // 1. Let stringBody be the isomorphic decode of body. + const stringBody = isomorphicDecode(body) + + // 2. Set body to the forgiving-base64 decode of + // stringBody. + body = forgivingBase64(stringBody) + + // 3. If body is failure, then return failure. + if (body === 'failure') { + return 'failure' + } + + // 4. Remove the last 6 code points from mimeType. + mimeType = mimeType.slice(0, -6) + + // 5. Remove trailing U+0020 SPACE code points from mimeType, + // if any. + mimeType = mimeType.replace(/(\u0020)+$/, '') + + // 6. Remove the last U+003B (;) code point from mimeType. + mimeType = mimeType.slice(0, -1) + } + + // 12. If mimeType starts with U+003B (;), then prepend + // "text/plain" to mimeType. + if (mimeType.startsWith(';')) { + mimeType = 'text/plain' + mimeType + } + + // 13. Let mimeTypeRecord be the result of parsing + // mimeType. + let mimeTypeRecord = parseMIMEType(mimeType) + + // 14. If mimeTypeRecord is failure, then set + // mimeTypeRecord to text/plain;charset=US-ASCII. + if (mimeTypeRecord === 'failure') { + mimeTypeRecord = parseMIMEType('text/plain;charset=US-ASCII') + } + + // 15. Return a new data: URL struct whose MIME + // type is mimeTypeRecord and body is body. + // https://fetch.spec.whatwg.org/#data-url-struct + return { mimeType: mimeTypeRecord, body } +} + +// https://url.spec.whatwg.org/#concept-url-serializer +/** + * @param {URL} url + * @param {boolean} excludeFragment + */ +function URLSerializer (url, excludeFragment = false) { + const href = url.href + + if (!excludeFragment) { + return href + } + + const hash = href.lastIndexOf('#') + if (hash === -1) { + return href + } + return href.slice(0, hash) +} + +// https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points +/** + * @param {(char: string) => boolean} condition + * @param {string} input + * @param {{ position: number }} position + */ +function collectASequenceOfCodePoints (condition, input, position) { + // 1. Let result be the empty string. + let result = '' + + // 2. While position doesn’t point past the end of input and the + // code point at position within input meets the condition condition: + while (position.position < input.length && condition(input[position.position])) { + // 1. Append that code point to the end of result. + result += input[position.position] + + // 2. Advance position by 1. + position.position++ + } + + // 3. Return result. + return result +} + +/** + * A faster collectASequenceOfCodePoints that only works when comparing a single character. + * @param {string} char + * @param {string} input + * @param {{ position: number }} position + */ +function collectASequenceOfCodePointsFast (char, input, position) { + const idx = input.indexOf(char, position.position) + const start = position.position + + if (idx === -1) { + position.position = input.length + return input.slice(start) + } + + position.position = idx + return input.slice(start, position.position) +} + +// https://url.spec.whatwg.org/#string-percent-decode +/** @param {string} input */ +function stringPercentDecode (input) { + // 1. Let bytes be the UTF-8 encoding of input. + const bytes = encoder.encode(input) + + // 2. Return the percent-decoding of bytes. + return percentDecode(bytes) +} + +// https://url.spec.whatwg.org/#percent-decode +/** @param {Uint8Array} input */ +function percentDecode (input) { + // 1. Let output be an empty byte sequence. + /** @type {number[]} */ + const output = [] + + // 2. For each byte byte in input: + for (let i = 0; i < input.length; i++) { + const byte = input[i] + + // 1. If byte is not 0x25 (%), then append byte to output. + if (byte !== 0x25) { + output.push(byte) + + // 2. Otherwise, if byte is 0x25 (%) and the next two bytes + // after byte in input are not in the ranges + // 0x30 (0) to 0x39 (9), 0x41 (A) to 0x46 (F), + // and 0x61 (a) to 0x66 (f), all inclusive, append byte + // to output. + } else if ( + byte === 0x25 && + !/^[0-9A-Fa-f]{2}$/i.test(String.fromCharCode(input[i + 1], input[i + 2])) + ) { + output.push(0x25) + + // 3. Otherwise: + } else { + // 1. Let bytePoint be the two bytes after byte in input, + // decoded, and then interpreted as hexadecimal number. + const nextTwoBytes = String.fromCharCode(input[i + 1], input[i + 2]) + const bytePoint = Number.parseInt(nextTwoBytes, 16) + + // 2. Append a byte whose value is bytePoint to output. + output.push(bytePoint) + + // 3. Skip the next two bytes in input. + i += 2 + } + } + + // 3. Return output. + return Uint8Array.from(output) +} + +// https://mimesniff.spec.whatwg.org/#parse-a-mime-type +/** @param {string} input */ +function parseMIMEType (input) { + // 1. Remove any leading and trailing HTTP whitespace + // from input. + input = removeHTTPWhitespace(input, true, true) + + // 2. Let position be a position variable for input, + // initially pointing at the start of input. + const position = { position: 0 } + + // 3. Let type be the result of collecting a sequence + // of code points that are not U+002F (/) from + // input, given position. + const type = collectASequenceOfCodePointsFast( + '/', + input, + position + ) + + // 4. If type is the empty string or does not solely + // contain HTTP token code points, then return failure. + // https://mimesniff.spec.whatwg.org/#http-token-code-point + if (type.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(type)) { + return 'failure' + } + + // 5. If position is past the end of input, then return + // failure + if (position.position > input.length) { + return 'failure' + } + + // 6. Advance position by 1. (This skips past U+002F (/).) + position.position++ + + // 7. Let subtype be the result of collecting a sequence of + // code points that are not U+003B (;) from input, given + // position. + let subtype = collectASequenceOfCodePointsFast( + ';', + input, + position + ) + + // 8. Remove any trailing HTTP whitespace from subtype. + subtype = removeHTTPWhitespace(subtype, false, true) + + // 9. If subtype is the empty string or does not solely + // contain HTTP token code points, then return failure. + if (subtype.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(subtype)) { + return 'failure' + } + + const typeLowercase = type.toLowerCase() + const subtypeLowercase = subtype.toLowerCase() + + // 10. Let mimeType be a new MIME type record whose type + // is type, in ASCII lowercase, and subtype is subtype, + // in ASCII lowercase. + // https://mimesniff.spec.whatwg.org/#mime-type + const mimeType = { + type: typeLowercase, + subtype: subtypeLowercase, + /** @type {Map} */ + parameters: new Map(), + // https://mimesniff.spec.whatwg.org/#mime-type-essence + essence: `${typeLowercase}/${subtypeLowercase}` + } + + // 11. While position is not past the end of input: + while (position.position < input.length) { + // 1. Advance position by 1. (This skips past U+003B (;).) + position.position++ + + // 2. Collect a sequence of code points that are HTTP + // whitespace from input given position. + collectASequenceOfCodePoints( + // https://fetch.spec.whatwg.org/#http-whitespace + char => HTTP_WHITESPACE_REGEX.test(char), + input, + position + ) + + // 3. Let parameterName be the result of collecting a + // sequence of code points that are not U+003B (;) + // or U+003D (=) from input, given position. + let parameterName = collectASequenceOfCodePoints( + (char) => char !== ';' && char !== '=', + input, + position + ) + + // 4. Set parameterName to parameterName, in ASCII + // lowercase. + parameterName = parameterName.toLowerCase() + + // 5. If position is not past the end of input, then: + if (position.position < input.length) { + // 1. If the code point at position within input is + // U+003B (;), then continue. + if (input[position.position] === ';') { + continue + } + + // 2. Advance position by 1. (This skips past U+003D (=).) + position.position++ + } + + // 6. If position is past the end of input, then break. + if (position.position > input.length) { + break + } + + // 7. Let parameterValue be null. + let parameterValue = null + + // 8. If the code point at position within input is + // U+0022 ("), then: + if (input[position.position] === '"') { + // 1. Set parameterValue to the result of collecting + // an HTTP quoted string from input, given position + // and the extract-value flag. + parameterValue = collectAnHTTPQuotedString(input, position, true) + + // 2. Collect a sequence of code points that are not + // U+003B (;) from input, given position. + collectASequenceOfCodePointsFast( + ';', + input, + position + ) + + // 9. Otherwise: + } else { + // 1. Set parameterValue to the result of collecting + // a sequence of code points that are not U+003B (;) + // from input, given position. + parameterValue = collectASequenceOfCodePointsFast( + ';', + input, + position + ) + + // 2. Remove any trailing HTTP whitespace from parameterValue. + parameterValue = removeHTTPWhitespace(parameterValue, false, true) + + // 3. If parameterValue is the empty string, then continue. + if (parameterValue.length === 0) { + continue + } + } + + // 10. If all of the following are true + // - parameterName is not the empty string + // - parameterName solely contains HTTP token code points + // - parameterValue solely contains HTTP quoted-string token code points + // - mimeType’s parameters[parameterName] does not exist + // then set mimeType’s parameters[parameterName] to parameterValue. + if ( + parameterName.length !== 0 && + HTTP_TOKEN_CODEPOINTS.test(parameterName) && + (parameterValue.length === 0 || HTTP_QUOTED_STRING_TOKENS.test(parameterValue)) && + !mimeType.parameters.has(parameterName) + ) { + mimeType.parameters.set(parameterName, parameterValue) + } + } + + // 12. Return mimeType. + return mimeType +} + +// https://infra.spec.whatwg.org/#forgiving-base64-decode +/** @param {string} data */ +function forgivingBase64 (data) { + // 1. Remove all ASCII whitespace from data. + data = data.replace(/[\u0009\u000A\u000C\u000D\u0020]/g, '') // eslint-disable-line + + // 2. If data’s code point length divides by 4 leaving + // no remainder, then: + if (data.length % 4 === 0) { + // 1. If data ends with one or two U+003D (=) code points, + // then remove them from data. + data = data.replace(/=?=$/, '') + } + + // 3. If data’s code point length divides by 4 leaving + // a remainder of 1, then return failure. + if (data.length % 4 === 1) { + return 'failure' + } + + // 4. If data contains a code point that is not one of + // U+002B (+) + // U+002F (/) + // ASCII alphanumeric + // then return failure. + if (/[^+/0-9A-Za-z]/.test(data)) { + return 'failure' + } + + const binary = atob(data) + const bytes = new Uint8Array(binary.length) + + for (let byte = 0; byte < binary.length; byte++) { + bytes[byte] = binary.charCodeAt(byte) + } + + return bytes +} + +// https://fetch.spec.whatwg.org/#collect-an-http-quoted-string +// tests: https://fetch.spec.whatwg.org/#example-http-quoted-string +/** + * @param {string} input + * @param {{ position: number }} position + * @param {boolean?} extractValue + */ +function collectAnHTTPQuotedString (input, position, extractValue) { + // 1. Let positionStart be position. + const positionStart = position.position + + // 2. Let value be the empty string. + let value = '' + + // 3. Assert: the code point at position within input + // is U+0022 ("). + assert(input[position.position] === '"') + + // 4. Advance position by 1. + position.position++ + + // 5. While true: + while (true) { + // 1. Append the result of collecting a sequence of code points + // that are not U+0022 (") or U+005C (\) from input, given + // position, to value. + value += collectASequenceOfCodePoints( + (char) => char !== '"' && char !== '\\', + input, + position + ) + + // 2. If position is past the end of input, then break. + if (position.position >= input.length) { + break + } + + // 3. Let quoteOrBackslash be the code point at position within + // input. + const quoteOrBackslash = input[position.position] + + // 4. Advance position by 1. + position.position++ + + // 5. If quoteOrBackslash is U+005C (\), then: + if (quoteOrBackslash === '\\') { + // 1. If position is past the end of input, then append + // U+005C (\) to value and break. + if (position.position >= input.length) { + value += '\\' + break + } + + // 2. Append the code point at position within input to value. + value += input[position.position] + + // 3. Advance position by 1. + position.position++ + + // 6. Otherwise: + } else { + // 1. Assert: quoteOrBackslash is U+0022 ("). + assert(quoteOrBackslash === '"') + + // 2. Break. + break + } + } + + // 6. If the extract-value flag is set, then return value. + if (extractValue) { + return value + } + + // 7. Return the code points from positionStart to position, + // inclusive, within input. + return input.slice(positionStart, position.position) +} + +/** + * @see https://mimesniff.spec.whatwg.org/#serialize-a-mime-type + */ +function serializeAMimeType (mimeType) { + assert(mimeType !== 'failure') + const { parameters, essence } = mimeType + + // 1. Let serialization be the concatenation of mimeType’s + // type, U+002F (/), and mimeType’s subtype. + let serialization = essence + + // 2. For each name → value of mimeType’s parameters: + for (let [name, value] of parameters.entries()) { + // 1. Append U+003B (;) to serialization. + serialization += ';' + + // 2. Append name to serialization. + serialization += name + + // 3. Append U+003D (=) to serialization. + serialization += '=' + + // 4. If value does not solely contain HTTP token code + // points or value is the empty string, then: + if (!HTTP_TOKEN_CODEPOINTS.test(value)) { + // 1. Precede each occurence of U+0022 (") or + // U+005C (\) in value with U+005C (\). + value = value.replace(/(\\|")/g, '\\$1') + + // 2. Prepend U+0022 (") to value. + value = '"' + value + + // 3. Append U+0022 (") to value. + value += '"' + } + + // 5. Append value to serialization. + serialization += value + } + + // 3. Return serialization. + return serialization +} + +/** + * @see https://fetch.spec.whatwg.org/#http-whitespace + * @param {string} char + */ +function isHTTPWhiteSpace (char) { + return char === '\r' || char === '\n' || char === '\t' || char === ' ' +} + +/** + * @see https://fetch.spec.whatwg.org/#http-whitespace + * @param {string} str + */ +function removeHTTPWhitespace (str, leading = true, trailing = true) { + let lead = 0 + let trail = str.length - 1 + + if (leading) { + for (; lead < str.length && isHTTPWhiteSpace(str[lead]); lead++); + } + + if (trailing) { + for (; trail > 0 && isHTTPWhiteSpace(str[trail]); trail--); + } + + return str.slice(lead, trail + 1) +} + +/** + * @see https://infra.spec.whatwg.org/#ascii-whitespace + * @param {string} char + */ +function isASCIIWhitespace (char) { + return char === '\r' || char === '\n' || char === '\t' || char === '\f' || char === ' ' +} + +/** + * @see https://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace + */ +function removeASCIIWhitespace (str, leading = true, trailing = true) { + let lead = 0 + let trail = str.length - 1 + + if (leading) { + for (; lead < str.length && isASCIIWhitespace(str[lead]); lead++); + } + + if (trailing) { + for (; trail > 0 && isASCIIWhitespace(str[trail]); trail--); + } + + return str.slice(lead, trail + 1) +} + +module.exports = { + dataURLProcessor, + URLSerializer, + collectASequenceOfCodePoints, + collectASequenceOfCodePointsFast, + stringPercentDecode, + parseMIMEType, + collectAnHTTPQuotedString, + serializeAMimeType +} + + +/***/ }), + +/***/ 8511: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { Blob, File: NativeFile } = __nccwpck_require__(4300) +const { types } = __nccwpck_require__(3837) +const { kState } = __nccwpck_require__(5861) +const { isBlobLike } = __nccwpck_require__(2538) +const { webidl } = __nccwpck_require__(1744) +const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685) +const { kEnumerableProperty } = __nccwpck_require__(3983) + +class File extends Blob { + constructor (fileBits, fileName, options = {}) { + // The File constructor is invoked with two or three parameters, depending + // on whether the optional dictionary parameter is used. When the File() + // constructor is invoked, user agents must run the following steps: + webidl.argumentLengthCheck(arguments, 2, { header: 'File constructor' }) + + fileBits = webidl.converters['sequence'](fileBits) + fileName = webidl.converters.USVString(fileName) + options = webidl.converters.FilePropertyBag(options) + + // 1. Let bytes be the result of processing blob parts given fileBits and + // options. + // Note: Blob handles this for us + + // 2. Let n be the fileName argument to the constructor. + const n = fileName + + // 3. Process FilePropertyBag dictionary argument by running the following + // substeps: + + // 1. If the type member is provided and is not the empty string, let t + // be set to the type dictionary member. If t contains any characters + // outside the range U+0020 to U+007E, then set t to the empty string + // and return from these substeps. + // 2. Convert every character in t to ASCII lowercase. + let t = options.type + let d + + // eslint-disable-next-line no-labels + substep: { + if (t) { + t = parseMIMEType(t) + + if (t === 'failure') { + t = '' + // eslint-disable-next-line no-labels + break substep + } + + t = serializeAMimeType(t).toLowerCase() + } + + // 3. If the lastModified member is provided, let d be set to the + // lastModified dictionary member. If it is not provided, set d to the + // current date and time represented as the number of milliseconds since + // the Unix Epoch (which is the equivalent of Date.now() [ECMA-262]). + d = options.lastModified + } + + // 4. Return a new File object F such that: + // F refers to the bytes byte sequence. + // F.size is set to the number of total bytes in bytes. + // F.name is set to n. + // F.type is set to t. + // F.lastModified is set to d. + + super(processBlobParts(fileBits, options), { type: t }) + this[kState] = { + name: n, + lastModified: d, + type: t + } + } + + get name () { + webidl.brandCheck(this, File) + + return this[kState].name + } + + get lastModified () { + webidl.brandCheck(this, File) + + return this[kState].lastModified + } + + get type () { + webidl.brandCheck(this, File) + + return this[kState].type + } +} + +class FileLike { + constructor (blobLike, fileName, options = {}) { + // TODO: argument idl type check + + // The File constructor is invoked with two or three parameters, depending + // on whether the optional dictionary parameter is used. When the File() + // constructor is invoked, user agents must run the following steps: + + // 1. Let bytes be the result of processing blob parts given fileBits and + // options. + + // 2. Let n be the fileName argument to the constructor. + const n = fileName + + // 3. Process FilePropertyBag dictionary argument by running the following + // substeps: + + // 1. If the type member is provided and is not the empty string, let t + // be set to the type dictionary member. If t contains any characters + // outside the range U+0020 to U+007E, then set t to the empty string + // and return from these substeps. + // TODO + const t = options.type + + // 2. Convert every character in t to ASCII lowercase. + // TODO + + // 3. If the lastModified member is provided, let d be set to the + // lastModified dictionary member. If it is not provided, set d to the + // current date and time represented as the number of milliseconds since + // the Unix Epoch (which is the equivalent of Date.now() [ECMA-262]). + const d = options.lastModified ?? Date.now() + + // 4. Return a new File object F such that: + // F refers to the bytes byte sequence. + // F.size is set to the number of total bytes in bytes. + // F.name is set to n. + // F.type is set to t. + // F.lastModified is set to d. + + this[kState] = { + blobLike, + name: n, + type: t, + lastModified: d + } + } + + stream (...args) { + webidl.brandCheck(this, FileLike) + + return this[kState].blobLike.stream(...args) + } + + arrayBuffer (...args) { + webidl.brandCheck(this, FileLike) + + return this[kState].blobLike.arrayBuffer(...args) + } + + slice (...args) { + webidl.brandCheck(this, FileLike) + + return this[kState].blobLike.slice(...args) + } + + text (...args) { + webidl.brandCheck(this, FileLike) + + return this[kState].blobLike.text(...args) + } + + get size () { + webidl.brandCheck(this, FileLike) + + return this[kState].blobLike.size + } + + get type () { + webidl.brandCheck(this, FileLike) + + return this[kState].blobLike.type + } + + get name () { + webidl.brandCheck(this, FileLike) + + return this[kState].name + } + + get lastModified () { + webidl.brandCheck(this, FileLike) + + return this[kState].lastModified + } + + get [Symbol.toStringTag] () { + return 'File' + } +} + +Object.defineProperties(File.prototype, { + [Symbol.toStringTag]: { + value: 'File', + configurable: true + }, + name: kEnumerableProperty, + lastModified: kEnumerableProperty +}) + +webidl.converters.Blob = webidl.interfaceConverter(Blob) + +webidl.converters.BlobPart = function (V, opts) { + if (webidl.util.Type(V) === 'Object') { + if (isBlobLike(V)) { + return webidl.converters.Blob(V, { strict: false }) + } + + if ( + ArrayBuffer.isView(V) || + types.isAnyArrayBuffer(V) + ) { + return webidl.converters.BufferSource(V, opts) + } + } + + return webidl.converters.USVString(V, opts) +} + +webidl.converters['sequence'] = webidl.sequenceConverter( + webidl.converters.BlobPart +) + +// https://www.w3.org/TR/FileAPI/#dfn-FilePropertyBag +webidl.converters.FilePropertyBag = webidl.dictionaryConverter([ + { + key: 'lastModified', + converter: webidl.converters['long long'], + get defaultValue () { + return Date.now() + } + }, + { + key: 'type', + converter: webidl.converters.DOMString, + defaultValue: '' + }, + { + key: 'endings', + converter: (value) => { + value = webidl.converters.DOMString(value) + value = value.toLowerCase() + + if (value !== 'native') { + value = 'transparent' + } + + return value + }, + defaultValue: 'transparent' + } +]) + +/** + * @see https://www.w3.org/TR/FileAPI/#process-blob-parts + * @param {(NodeJS.TypedArray|Blob|string)[]} parts + * @param {{ type: string, endings: string }} options + */ +function processBlobParts (parts, options) { + // 1. Let bytes be an empty sequence of bytes. + /** @type {NodeJS.TypedArray[]} */ + const bytes = [] + + // 2. For each element in parts: + for (const element of parts) { + // 1. If element is a USVString, run the following substeps: + if (typeof element === 'string') { + // 1. Let s be element. + let s = element + + // 2. If the endings member of options is "native", set s + // to the result of converting line endings to native + // of element. + if (options.endings === 'native') { + s = convertLineEndingsNative(s) + } + + // 3. Append the result of UTF-8 encoding s to bytes. + bytes.push(new TextEncoder().encode(s)) + } else if ( + types.isAnyArrayBuffer(element) || + types.isTypedArray(element) + ) { + // 2. If element is a BufferSource, get a copy of the + // bytes held by the buffer source, and append those + // bytes to bytes. + if (!element.buffer) { // ArrayBuffer + bytes.push(new Uint8Array(element)) + } else { + bytes.push( + new Uint8Array(element.buffer, element.byteOffset, element.byteLength) + ) + } + } else if (isBlobLike(element)) { + // 3. If element is a Blob, append the bytes it represents + // to bytes. + bytes.push(element) + } + } + + // 3. Return bytes. + return bytes +} + +/** + * @see https://www.w3.org/TR/FileAPI/#convert-line-endings-to-native + * @param {string} s + */ +function convertLineEndingsNative (s) { + // 1. Let native line ending be be the code point U+000A LF. + let nativeLineEnding = '\n' + + // 2. If the underlying platform’s conventions are to + // represent newlines as a carriage return and line feed + // sequence, set native line ending to the code point + // U+000D CR followed by the code point U+000A LF. + if (process.platform === 'win32') { + nativeLineEnding = '\r\n' + } + + return s.replace(/\r?\n/g, nativeLineEnding) +} + +// If this function is moved to ./util.js, some tools (such as +// rollup) will warn about circular dependencies. See: +// https://github.com/nodejs/undici/issues/1629 +function isFileLike (object) { + return ( + (NativeFile && object instanceof NativeFile) || + object instanceof File || ( + object && + (typeof object.stream === 'function' || + typeof object.arrayBuffer === 'function') && + object[Symbol.toStringTag] === 'File' + ) + ) +} + +module.exports = { File, FileLike, isFileLike } + + +/***/ }), + +/***/ 2015: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { isBlobLike, toUSVString, makeIterator } = __nccwpck_require__(2538) +const { kState } = __nccwpck_require__(5861) +const { File: UndiciFile, FileLike, isFileLike } = __nccwpck_require__(8511) +const { webidl } = __nccwpck_require__(1744) +const { Blob, File: NativeFile } = __nccwpck_require__(4300) + +/** @type {globalThis['File']} */ +const File = NativeFile ?? UndiciFile + +// https://xhr.spec.whatwg.org/#formdata +class FormData { + constructor (form) { + if (form !== undefined) { + throw webidl.errors.conversionFailed({ + prefix: 'FormData constructor', + argument: 'Argument 1', + types: ['undefined'] + }) + } + + this[kState] = [] + } + + append (name, value, filename = undefined) { + webidl.brandCheck(this, FormData) + + webidl.argumentLengthCheck(arguments, 2, { header: 'FormData.append' }) + + if (arguments.length === 3 && !isBlobLike(value)) { + throw new TypeError( + "Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'" + ) + } + + // 1. Let value be value if given; otherwise blobValue. + + name = webidl.converters.USVString(name) + value = isBlobLike(value) + ? webidl.converters.Blob(value, { strict: false }) + : webidl.converters.USVString(value) + filename = arguments.length === 3 + ? webidl.converters.USVString(filename) + : undefined + + // 2. Let entry be the result of creating an entry with + // name, value, and filename if given. + const entry = makeEntry(name, value, filename) + + // 3. Append entry to this’s entry list. + this[kState].push(entry) + } + + delete (name) { + webidl.brandCheck(this, FormData) + + webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.delete' }) + + name = webidl.converters.USVString(name) + + // The delete(name) method steps are to remove all entries whose name + // is name from this’s entry list. + this[kState] = this[kState].filter(entry => entry.name !== name) + } + + get (name) { + webidl.brandCheck(this, FormData) + + webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.get' }) + + name = webidl.converters.USVString(name) + + // 1. If there is no entry whose name is name in this’s entry list, + // then return null. + const idx = this[kState].findIndex((entry) => entry.name === name) + if (idx === -1) { + return null + } + + // 2. Return the value of the first entry whose name is name from + // this’s entry list. + return this[kState][idx].value + } + + getAll (name) { + webidl.brandCheck(this, FormData) + + webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.getAll' }) + + name = webidl.converters.USVString(name) + + // 1. If there is no entry whose name is name in this’s entry list, + // then return the empty list. + // 2. Return the values of all entries whose name is name, in order, + // from this’s entry list. + return this[kState] + .filter((entry) => entry.name === name) + .map((entry) => entry.value) + } + + has (name) { + webidl.brandCheck(this, FormData) + + webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.has' }) + + name = webidl.converters.USVString(name) + + // The has(name) method steps are to return true if there is an entry + // whose name is name in this’s entry list; otherwise false. + return this[kState].findIndex((entry) => entry.name === name) !== -1 + } + + set (name, value, filename = undefined) { + webidl.brandCheck(this, FormData) + + webidl.argumentLengthCheck(arguments, 2, { header: 'FormData.set' }) + + if (arguments.length === 3 && !isBlobLike(value)) { + throw new TypeError( + "Failed to execute 'set' on 'FormData': parameter 2 is not of type 'Blob'" + ) + } + + // The set(name, value) and set(name, blobValue, filename) method steps + // are: + + // 1. Let value be value if given; otherwise blobValue. + + name = webidl.converters.USVString(name) + value = isBlobLike(value) + ? webidl.converters.Blob(value, { strict: false }) + : webidl.converters.USVString(value) + filename = arguments.length === 3 + ? toUSVString(filename) + : undefined + + // 2. Let entry be the result of creating an entry with name, value, and + // filename if given. + const entry = makeEntry(name, value, filename) + + // 3. If there are entries in this’s entry list whose name is name, then + // replace the first such entry with entry and remove the others. + const idx = this[kState].findIndex((entry) => entry.name === name) + if (idx !== -1) { + this[kState] = [ + ...this[kState].slice(0, idx), + entry, + ...this[kState].slice(idx + 1).filter((entry) => entry.name !== name) + ] + } else { + // 4. Otherwise, append entry to this’s entry list. + this[kState].push(entry) + } + } + + entries () { + webidl.brandCheck(this, FormData) + + return makeIterator( + () => this[kState].map(pair => [pair.name, pair.value]), + 'FormData', + 'key+value' + ) + } + + keys () { + webidl.brandCheck(this, FormData) + + return makeIterator( + () => this[kState].map(pair => [pair.name, pair.value]), + 'FormData', + 'key' + ) + } + + values () { + webidl.brandCheck(this, FormData) + + return makeIterator( + () => this[kState].map(pair => [pair.name, pair.value]), + 'FormData', + 'value' + ) + } + + /** + * @param {(value: string, key: string, self: FormData) => void} callbackFn + * @param {unknown} thisArg + */ + forEach (callbackFn, thisArg = globalThis) { + webidl.brandCheck(this, FormData) + + webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.forEach' }) + + if (typeof callbackFn !== 'function') { + throw new TypeError( + "Failed to execute 'forEach' on 'FormData': parameter 1 is not of type 'Function'." + ) + } + + for (const [key, value] of this) { + callbackFn.apply(thisArg, [value, key, this]) + } + } +} + +FormData.prototype[Symbol.iterator] = FormData.prototype.entries + +Object.defineProperties(FormData.prototype, { + [Symbol.toStringTag]: { + value: 'FormData', + configurable: true + } +}) + +/** + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#create-an-entry + * @param {string} name + * @param {string|Blob} value + * @param {?string} filename + * @returns + */ +function makeEntry (name, value, filename) { + // 1. Set name to the result of converting name into a scalar value string. + // "To convert a string into a scalar value string, replace any surrogates + // with U+FFFD." + // see: https://nodejs.org/dist/latest-v18.x/docs/api/buffer.html#buftostringencoding-start-end + name = Buffer.from(name).toString('utf8') + + // 2. If value is a string, then set value to the result of converting + // value into a scalar value string. + if (typeof value === 'string') { + value = Buffer.from(value).toString('utf8') + } else { + // 3. Otherwise: + + // 1. If value is not a File object, then set value to a new File object, + // representing the same bytes, whose name attribute value is "blob" + if (!isFileLike(value)) { + value = value instanceof Blob + ? new File([value], 'blob', { type: value.type }) + : new FileLike(value, 'blob', { type: value.type }) + } + + // 2. If filename is given, then set value to a new File object, + // representing the same bytes, whose name attribute is filename. + if (filename !== undefined) { + /** @type {FilePropertyBag} */ + const options = { + type: value.type, + lastModified: value.lastModified + } + + value = (NativeFile && value instanceof NativeFile) || value instanceof UndiciFile + ? new File([value], filename, options) + : new FileLike(value, filename, options) + } + } + + // 4. Return an entry whose name is name and whose value is value. + return { name, value } +} + +module.exports = { FormData } + + +/***/ }), + +/***/ 1246: +/***/ ((module) => { + +"use strict"; + + +// In case of breaking changes, increase the version +// number to avoid conflicts. +const globalOrigin = Symbol.for('undici.globalOrigin.1') + +function getGlobalOrigin () { + return globalThis[globalOrigin] +} + +function setGlobalOrigin (newOrigin) { + if (newOrigin === undefined) { + Object.defineProperty(globalThis, globalOrigin, { + value: undefined, + writable: true, + enumerable: false, + configurable: false + }) + + return + } + + const parsedURL = new URL(newOrigin) + + if (parsedURL.protocol !== 'http:' && parsedURL.protocol !== 'https:') { + throw new TypeError(`Only http & https urls are allowed, received ${parsedURL.protocol}`) + } + + Object.defineProperty(globalThis, globalOrigin, { + value: parsedURL, + writable: true, + enumerable: false, + configurable: false + }) +} + +module.exports = { + getGlobalOrigin, + setGlobalOrigin +} + + +/***/ }), + +/***/ 554: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// https://github.com/Ethan-Arrowood/undici-fetch + + + +const { kHeadersList } = __nccwpck_require__(2785) +const { kGuard } = __nccwpck_require__(5861) +const { kEnumerableProperty } = __nccwpck_require__(3983) +const { + makeIterator, + isValidHeaderName, + isValidHeaderValue +} = __nccwpck_require__(2538) +const { webidl } = __nccwpck_require__(1744) +const assert = __nccwpck_require__(9491) + +const kHeadersMap = Symbol('headers map') +const kHeadersSortedMap = Symbol('headers map sorted') + +/** + * @see https://fetch.spec.whatwg.org/#concept-header-value-normalize + * @param {string} potentialValue + */ +function headerValueNormalize (potentialValue) { + // To normalize a byte sequence potentialValue, remove + // any leading and trailing HTTP whitespace bytes from + // potentialValue. + + // Trimming the end with `.replace()` and a RegExp is typically subject to + // ReDoS. This is safer and faster. + let i = potentialValue.length + while (/[\r\n\t ]/.test(potentialValue.charAt(--i))); + return potentialValue.slice(0, i + 1).replace(/^[\r\n\t ]+/, '') +} + +function fill (headers, object) { + // To fill a Headers object headers with a given object object, run these steps: + + // 1. If object is a sequence, then for each header in object: + // Note: webidl conversion to array has already been done. + if (Array.isArray(object)) { + for (const header of object) { + // 1. If header does not contain exactly two items, then throw a TypeError. + if (header.length !== 2) { + throw webidl.errors.exception({ + header: 'Headers constructor', + message: `expected name/value pair to be length 2, found ${header.length}.` + }) + } + + // 2. Append (header’s first item, header’s second item) to headers. + headers.append(header[0], header[1]) + } + } else if (typeof object === 'object' && object !== null) { + // Note: null should throw + + // 2. Otherwise, object is a record, then for each key → value in object, + // append (key, value) to headers + for (const [key, value] of Object.entries(object)) { + headers.append(key, value) + } + } else { + throw webidl.errors.conversionFailed({ + prefix: 'Headers constructor', + argument: 'Argument 1', + types: ['sequence>', 'record'] + }) + } +} + +class HeadersList { + /** @type {[string, string][]|null} */ + cookies = null + + constructor (init) { + if (init instanceof HeadersList) { + this[kHeadersMap] = new Map(init[kHeadersMap]) + this[kHeadersSortedMap] = init[kHeadersSortedMap] + this.cookies = init.cookies + } else { + this[kHeadersMap] = new Map(init) + this[kHeadersSortedMap] = null + } + } + + // https://fetch.spec.whatwg.org/#header-list-contains + contains (name) { + // A header list list contains a header name name if list + // contains a header whose name is a byte-case-insensitive + // match for name. + name = name.toLowerCase() + + return this[kHeadersMap].has(name) + } + + clear () { + this[kHeadersMap].clear() + this[kHeadersSortedMap] = null + this.cookies = null + } + + // https://fetch.spec.whatwg.org/#concept-header-list-append + append (name, value) { + this[kHeadersSortedMap] = null + + // 1. If list contains name, then set name to the first such + // header’s name. + const lowercaseName = name.toLowerCase() + const exists = this[kHeadersMap].get(lowercaseName) + + // 2. Append (name, value) to list. + if (exists) { + const delimiter = lowercaseName === 'cookie' ? '; ' : ', ' + this[kHeadersMap].set(lowercaseName, { + name: exists.name, + value: `${exists.value}${delimiter}${value}` + }) + } else { + this[kHeadersMap].set(lowercaseName, { name, value }) + } + + if (lowercaseName === 'set-cookie') { + this.cookies ??= [] + this.cookies.push(value) + } + } + + // https://fetch.spec.whatwg.org/#concept-header-list-set + set (name, value) { + this[kHeadersSortedMap] = null + const lowercaseName = name.toLowerCase() + + if (lowercaseName === 'set-cookie') { + this.cookies = [value] + } + + // 1. If list contains name, then set the value of + // the first such header to value and remove the + // others. + // 2. Otherwise, append header (name, value) to list. + return this[kHeadersMap].set(lowercaseName, { name, value }) + } + + // https://fetch.spec.whatwg.org/#concept-header-list-delete + delete (name) { + this[kHeadersSortedMap] = null + + name = name.toLowerCase() + + if (name === 'set-cookie') { + this.cookies = null + } + + return this[kHeadersMap].delete(name) + } + + // https://fetch.spec.whatwg.org/#concept-header-list-get + get (name) { + // 1. If list does not contain name, then return null. + if (!this.contains(name)) { + return null + } + + // 2. Return the values of all headers in list whose name + // is a byte-case-insensitive match for name, + // separated from each other by 0x2C 0x20, in order. + return this[kHeadersMap].get(name.toLowerCase())?.value ?? null + } + + * [Symbol.iterator] () { + // use the lowercased name + for (const [name, { value }] of this[kHeadersMap]) { + yield [name, value] + } + } + + get entries () { + const headers = {} + + if (this[kHeadersMap].size) { + for (const { name, value } of this[kHeadersMap].values()) { + headers[name] = value + } + } + + return headers + } +} + +// https://fetch.spec.whatwg.org/#headers-class +class Headers { + constructor (init = undefined) { + this[kHeadersList] = new HeadersList() + + // The new Headers(init) constructor steps are: + + // 1. Set this’s guard to "none". + this[kGuard] = 'none' + + // 2. If init is given, then fill this with init. + if (init !== undefined) { + init = webidl.converters.HeadersInit(init) + fill(this, init) + } + } + + // https://fetch.spec.whatwg.org/#dom-headers-append + append (name, value) { + webidl.brandCheck(this, Headers) + + webidl.argumentLengthCheck(arguments, 2, { header: 'Headers.append' }) + + name = webidl.converters.ByteString(name) + value = webidl.converters.ByteString(value) + + // 1. Normalize value. + value = headerValueNormalize(value) + + // 2. If name is not a header name or value is not a + // header value, then throw a TypeError. + if (!isValidHeaderName(name)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.append', + value: name, + type: 'header name' + }) + } else if (!isValidHeaderValue(value)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.append', + value, + type: 'header value' + }) + } + + // 3. If headers’s guard is "immutable", then throw a TypeError. + // 4. Otherwise, if headers’s guard is "request" and name is a + // forbidden header name, return. + // Note: undici does not implement forbidden header names + if (this[kGuard] === 'immutable') { + throw new TypeError('immutable') + } else if (this[kGuard] === 'request-no-cors') { + // 5. Otherwise, if headers’s guard is "request-no-cors": + // TODO + } + + // 6. Otherwise, if headers’s guard is "response" and name is a + // forbidden response-header name, return. + + // 7. Append (name, value) to headers’s header list. + // 8. If headers’s guard is "request-no-cors", then remove + // privileged no-CORS request headers from headers + return this[kHeadersList].append(name, value) + } + + // https://fetch.spec.whatwg.org/#dom-headers-delete + delete (name) { + webidl.brandCheck(this, Headers) + + webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.delete' }) + + name = webidl.converters.ByteString(name) + + // 1. If name is not a header name, then throw a TypeError. + if (!isValidHeaderName(name)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.delete', + value: name, + type: 'header name' + }) + } + + // 2. If this’s guard is "immutable", then throw a TypeError. + // 3. Otherwise, if this’s guard is "request" and name is a + // forbidden header name, return. + // 4. Otherwise, if this’s guard is "request-no-cors", name + // is not a no-CORS-safelisted request-header name, and + // name is not a privileged no-CORS request-header name, + // return. + // 5. Otherwise, if this’s guard is "response" and name is + // a forbidden response-header name, return. + // Note: undici does not implement forbidden header names + if (this[kGuard] === 'immutable') { + throw new TypeError('immutable') + } else if (this[kGuard] === 'request-no-cors') { + // TODO + } + + // 6. If this’s header list does not contain name, then + // return. + if (!this[kHeadersList].contains(name)) { + return + } + + // 7. Delete name from this’s header list. + // 8. If this’s guard is "request-no-cors", then remove + // privileged no-CORS request headers from this. + return this[kHeadersList].delete(name) + } + + // https://fetch.spec.whatwg.org/#dom-headers-get + get (name) { + webidl.brandCheck(this, Headers) + + webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.get' }) + + name = webidl.converters.ByteString(name) + + // 1. If name is not a header name, then throw a TypeError. + if (!isValidHeaderName(name)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.get', + value: name, + type: 'header name' + }) + } + + // 2. Return the result of getting name from this’s header + // list. + return this[kHeadersList].get(name) + } + + // https://fetch.spec.whatwg.org/#dom-headers-has + has (name) { + webidl.brandCheck(this, Headers) + + webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.has' }) + + name = webidl.converters.ByteString(name) + + // 1. If name is not a header name, then throw a TypeError. + if (!isValidHeaderName(name)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.has', + value: name, + type: 'header name' + }) + } + + // 2. Return true if this’s header list contains name; + // otherwise false. + return this[kHeadersList].contains(name) + } + + // https://fetch.spec.whatwg.org/#dom-headers-set + set (name, value) { + webidl.brandCheck(this, Headers) + + webidl.argumentLengthCheck(arguments, 2, { header: 'Headers.set' }) + + name = webidl.converters.ByteString(name) + value = webidl.converters.ByteString(value) + + // 1. Normalize value. + value = headerValueNormalize(value) + + // 2. If name is not a header name or value is not a + // header value, then throw a TypeError. + if (!isValidHeaderName(name)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.set', + value: name, + type: 'header name' + }) + } else if (!isValidHeaderValue(value)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.set', + value, + type: 'header value' + }) + } + + // 3. If this’s guard is "immutable", then throw a TypeError. + // 4. Otherwise, if this’s guard is "request" and name is a + // forbidden header name, return. + // 5. Otherwise, if this’s guard is "request-no-cors" and + // name/value is not a no-CORS-safelisted request-header, + // return. + // 6. Otherwise, if this’s guard is "response" and name is a + // forbidden response-header name, return. + // Note: undici does not implement forbidden header names + if (this[kGuard] === 'immutable') { + throw new TypeError('immutable') + } else if (this[kGuard] === 'request-no-cors') { + // TODO + } + + // 7. Set (name, value) in this’s header list. + // 8. If this’s guard is "request-no-cors", then remove + // privileged no-CORS request headers from this + return this[kHeadersList].set(name, value) + } + + // https://fetch.spec.whatwg.org/#dom-headers-getsetcookie + getSetCookie () { + webidl.brandCheck(this, Headers) + + // 1. If this’s header list does not contain `Set-Cookie`, then return « ». + // 2. Return the values of all headers in this’s header list whose name is + // a byte-case-insensitive match for `Set-Cookie`, in order. + + const list = this[kHeadersList].cookies + + if (list) { + return [...list] + } + + return [] + } + + // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine + get [kHeadersSortedMap] () { + if (this[kHeadersList][kHeadersSortedMap]) { + return this[kHeadersList][kHeadersSortedMap] + } + + // 1. Let headers be an empty list of headers with the key being the name + // and value the value. + const headers = [] + + // 2. Let names be the result of convert header names to a sorted-lowercase + // set with all the names of the headers in list. + const names = [...this[kHeadersList]].sort((a, b) => a[0] < b[0] ? -1 : 1) + const cookies = this[kHeadersList].cookies + + // 3. For each name of names: + for (const [name, value] of names) { + // 1. If name is `set-cookie`, then: + if (name === 'set-cookie') { + // 1. Let values be a list of all values of headers in list whose name + // is a byte-case-insensitive match for name, in order. + + // 2. For each value of values: + // 1. Append (name, value) to headers. + for (const value of cookies) { + headers.push([name, value]) + } + } else { + // 2. Otherwise: + + // 1. Let value be the result of getting name from list. + + // 2. Assert: value is non-null. + assert(value !== null) + + // 3. Append (name, value) to headers. + headers.push([name, value]) + } + } + + this[kHeadersList][kHeadersSortedMap] = headers + + // 4. Return headers. + return headers + } + + keys () { + webidl.brandCheck(this, Headers) + + return makeIterator( + () => [...this[kHeadersSortedMap].values()], + 'Headers', + 'key' + ) + } + + values () { + webidl.brandCheck(this, Headers) + + return makeIterator( + () => [...this[kHeadersSortedMap].values()], + 'Headers', + 'value' + ) + } + + entries () { + webidl.brandCheck(this, Headers) + + return makeIterator( + () => [...this[kHeadersSortedMap].values()], + 'Headers', + 'key+value' + ) + } + + /** + * @param {(value: string, key: string, self: Headers) => void} callbackFn + * @param {unknown} thisArg + */ + forEach (callbackFn, thisArg = globalThis) { + webidl.brandCheck(this, Headers) + + webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.forEach' }) + + if (typeof callbackFn !== 'function') { + throw new TypeError( + "Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'." + ) + } + + for (const [key, value] of this) { + callbackFn.apply(thisArg, [value, key, this]) + } + } + + [Symbol.for('nodejs.util.inspect.custom')] () { + webidl.brandCheck(this, Headers) + + return this[kHeadersList] + } +} + +Headers.prototype[Symbol.iterator] = Headers.prototype.entries + +Object.defineProperties(Headers.prototype, { + append: kEnumerableProperty, + delete: kEnumerableProperty, + get: kEnumerableProperty, + has: kEnumerableProperty, + set: kEnumerableProperty, + getSetCookie: kEnumerableProperty, + keys: kEnumerableProperty, + values: kEnumerableProperty, + entries: kEnumerableProperty, + forEach: kEnumerableProperty, + [Symbol.iterator]: { enumerable: false }, + [Symbol.toStringTag]: { + value: 'Headers', + configurable: true + } +}) + +webidl.converters.HeadersInit = function (V) { + if (webidl.util.Type(V) === 'Object') { + if (V[Symbol.iterator]) { + return webidl.converters['sequence>'](V) + } + + return webidl.converters['record'](V) + } + + throw webidl.errors.conversionFailed({ + prefix: 'Headers constructor', + argument: 'Argument 1', + types: ['sequence>', 'record'] + }) +} + +module.exports = { + fill, + Headers, + HeadersList +} + + +/***/ }), + +/***/ 4881: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// https://github.com/Ethan-Arrowood/undici-fetch + + + +const { + Response, + makeNetworkError, + makeAppropriateNetworkError, + filterResponse, + makeResponse +} = __nccwpck_require__(7823) +const { Headers } = __nccwpck_require__(554) +const { Request, makeRequest } = __nccwpck_require__(8359) +const zlib = __nccwpck_require__(9796) +const { + bytesMatch, + makePolicyContainer, + clonePolicyContainer, + requestBadPort, + TAOCheck, + appendRequestOriginHeader, + responseLocationURL, + requestCurrentURL, + setRequestReferrerPolicyOnRedirect, + tryUpgradeRequestToAPotentiallyTrustworthyURL, + createOpaqueTimingInfo, + appendFetchMetadata, + corsCheck, + crossOriginResourcePolicyCheck, + determineRequestsReferrer, + coarsenedSharedCurrentTime, + createDeferredPromise, + isBlobLike, + sameOrigin, + isCancelled, + isAborted, + isErrorLike, + fullyReadBody, + readableStreamClose, + isomorphicEncode, + urlIsLocal, + urlIsHttpHttpsScheme, + urlHasHttpsScheme +} = __nccwpck_require__(2538) +const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(5861) +const assert = __nccwpck_require__(9491) +const { safelyExtractBody } = __nccwpck_require__(9990) +const { + redirectStatus, + nullBodyStatus, + safeMethods, + requestBodyHeader, + subresource, + DOMException +} = __nccwpck_require__(1037) +const { kHeadersList } = __nccwpck_require__(2785) +const EE = __nccwpck_require__(2361) +const { Readable, pipeline } = __nccwpck_require__(2781) +const { addAbortListener, isErrored, isReadable, nodeMajor, nodeMinor } = __nccwpck_require__(3983) +const { dataURLProcessor, serializeAMimeType } = __nccwpck_require__(685) +const { TransformStream } = __nccwpck_require__(5356) +const { getGlobalDispatcher } = __nccwpck_require__(1892) +const { webidl } = __nccwpck_require__(1744) +const { STATUS_CODES } = __nccwpck_require__(3685) + +/** @type {import('buffer').resolveObjectURL} */ +let resolveObjectURL +let ReadableStream = globalThis.ReadableStream + +class Fetch extends EE { + constructor (dispatcher) { + super() + + this.dispatcher = dispatcher + this.connection = null + this.dump = false + this.state = 'ongoing' + // 2 terminated listeners get added per request, + // but only 1 gets removed. If there are 20 redirects, + // 21 listeners will be added. + // See https://github.com/nodejs/undici/issues/1711 + // TODO (fix): Find and fix root cause for leaked listener. + this.setMaxListeners(21) + } + + terminate (reason) { + if (this.state !== 'ongoing') { + return + } + + this.state = 'terminated' + this.connection?.destroy(reason) + this.emit('terminated', reason) + } + + // https://fetch.spec.whatwg.org/#fetch-controller-abort + abort (error) { + if (this.state !== 'ongoing') { + return + } + + // 1. Set controller’s state to "aborted". + this.state = 'aborted' + + // 2. Let fallbackError be an "AbortError" DOMException. + // 3. Set error to fallbackError if it is not given. + if (!error) { + error = new DOMException('The operation was aborted.', 'AbortError') + } + + // 4. Let serializedError be StructuredSerialize(error). + // If that threw an exception, catch it, and let + // serializedError be StructuredSerialize(fallbackError). + + // 5. Set controller’s serialized abort reason to serializedError. + this.serializedAbortReason = error + + this.connection?.destroy(error) + this.emit('terminated', error) + } +} + +// https://fetch.spec.whatwg.org/#fetch-method +async function fetch (input, init = {}) { + webidl.argumentLengthCheck(arguments, 1, { header: 'globalThis.fetch' }) + + // 1. Let p be a new promise. + const p = createDeferredPromise() + + // 2. Let requestObject be the result of invoking the initial value of + // Request as constructor with input and init as arguments. If this throws + // an exception, reject p with it and return p. + let requestObject + + try { + requestObject = new Request(input, init) + } catch (e) { + p.reject(e) + return p.promise + } + + // 3. Let request be requestObject’s request. + const request = requestObject[kState] + + // 4. If requestObject’s signal’s aborted flag is set, then: + if (requestObject.signal.aborted) { + // 1. Abort the fetch() call with p, request, null, and + // requestObject’s signal’s abort reason. + abortFetch(p, request, null, requestObject.signal.reason) + + // 2. Return p. + return p.promise + } + + // 5. Let globalObject be request’s client’s global object. + const globalObject = request.client.globalObject + + // 6. If globalObject is a ServiceWorkerGlobalScope object, then set + // request’s service-workers mode to "none". + if (globalObject?.constructor?.name === 'ServiceWorkerGlobalScope') { + request.serviceWorkers = 'none' + } + + // 7. Let responseObject be null. + let responseObject = null + + // 8. Let relevantRealm be this’s relevant Realm. + const relevantRealm = null + + // 9. Let locallyAborted be false. + let locallyAborted = false + + // 10. Let controller be null. + let controller = null + + // 11. Add the following abort steps to requestObject’s signal: + addAbortListener( + requestObject.signal, + () => { + // 1. Set locallyAborted to true. + locallyAborted = true + + // 2. Assert: controller is non-null. + assert(controller != null) + + // 3. Abort controller with requestObject’s signal’s abort reason. + controller.abort(requestObject.signal.reason) + + // 4. Abort the fetch() call with p, request, responseObject, + // and requestObject’s signal’s abort reason. + abortFetch(p, request, responseObject, requestObject.signal.reason) + } + ) + + // 12. Let handleFetchDone given response response be to finalize and + // report timing with response, globalObject, and "fetch". + const handleFetchDone = (response) => + finalizeAndReportTiming(response, 'fetch') + + // 13. Set controller to the result of calling fetch given request, + // with processResponseEndOfBody set to handleFetchDone, and processResponse + // given response being these substeps: + + const processResponse = (response) => { + // 1. If locallyAborted is true, terminate these substeps. + if (locallyAborted) { + return + } + + // 2. If response’s aborted flag is set, then: + if (response.aborted) { + // 1. Let deserializedError be the result of deserialize a serialized + // abort reason given controller’s serialized abort reason and + // relevantRealm. + + // 2. Abort the fetch() call with p, request, responseObject, and + // deserializedError. + + abortFetch(p, request, responseObject, controller.serializedAbortReason) + return + } + + // 3. If response is a network error, then reject p with a TypeError + // and terminate these substeps. + if (response.type === 'error') { + p.reject( + Object.assign(new TypeError('fetch failed'), { cause: response.error }) + ) + return + } + + // 4. Set responseObject to the result of creating a Response object, + // given response, "immutable", and relevantRealm. + responseObject = new Response() + responseObject[kState] = response + responseObject[kRealm] = relevantRealm + responseObject[kHeaders][kHeadersList] = response.headersList + responseObject[kHeaders][kGuard] = 'immutable' + responseObject[kHeaders][kRealm] = relevantRealm + + // 5. Resolve p with responseObject. + p.resolve(responseObject) + } + + controller = fetching({ + request, + processResponseEndOfBody: handleFetchDone, + processResponse, + dispatcher: init.dispatcher ?? getGlobalDispatcher() // undici + }) + + // 14. Return p. + return p.promise +} + +// https://fetch.spec.whatwg.org/#finalize-and-report-timing +function finalizeAndReportTiming (response, initiatorType = 'other') { + // 1. If response is an aborted network error, then return. + if (response.type === 'error' && response.aborted) { + return + } + + // 2. If response’s URL list is null or empty, then return. + if (!response.urlList?.length) { + return + } + + // 3. Let originalURL be response’s URL list[0]. + const originalURL = response.urlList[0] + + // 4. Let timingInfo be response’s timing info. + let timingInfo = response.timingInfo + + // 5. Let cacheState be response’s cache state. + let cacheState = response.cacheState + + // 6. If originalURL’s scheme is not an HTTP(S) scheme, then return. + if (!urlIsHttpHttpsScheme(originalURL)) { + return + } + + // 7. If timingInfo is null, then return. + if (timingInfo === null) { + return + } + + // 8. If response’s timing allow passed flag is not set, then: + if (!timingInfo.timingAllowPassed) { + // 1. Set timingInfo to a the result of creating an opaque timing info for timingInfo. + timingInfo = createOpaqueTimingInfo({ + startTime: timingInfo.startTime + }) + + // 2. Set cacheState to the empty string. + cacheState = '' + } + + // 9. Set timingInfo’s end time to the coarsened shared current time + // given global’s relevant settings object’s cross-origin isolated + // capability. + // TODO: given global’s relevant settings object’s cross-origin isolated + // capability? + timingInfo.endTime = coarsenedSharedCurrentTime() + + // 10. Set response’s timing info to timingInfo. + response.timingInfo = timingInfo + + // 11. Mark resource timing for timingInfo, originalURL, initiatorType, + // global, and cacheState. + markResourceTiming( + timingInfo, + originalURL, + initiatorType, + globalThis, + cacheState + ) +} + +// https://w3c.github.io/resource-timing/#dfn-mark-resource-timing +function markResourceTiming (timingInfo, originalURL, initiatorType, globalThis, cacheState) { + if (nodeMajor > 18 || (nodeMajor === 18 && nodeMinor >= 2)) { + performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis, cacheState) + } +} + +// https://fetch.spec.whatwg.org/#abort-fetch +function abortFetch (p, request, responseObject, error) { + // Note: AbortSignal.reason was added in node v17.2.0 + // which would give us an undefined error to reject with. + // Remove this once node v16 is no longer supported. + if (!error) { + error = new DOMException('The operation was aborted.', 'AbortError') + } + + // 1. Reject promise with error. + p.reject(error) + + // 2. If request’s body is not null and is readable, then cancel request’s + // body with error. + if (request.body != null && isReadable(request.body?.stream)) { + request.body.stream.cancel(error).catch((err) => { + if (err.code === 'ERR_INVALID_STATE') { + // Node bug? + return + } + throw err + }) + } + + // 3. If responseObject is null, then return. + if (responseObject == null) { + return + } + + // 4. Let response be responseObject’s response. + const response = responseObject[kState] + + // 5. If response’s body is not null and is readable, then error response’s + // body with error. + if (response.body != null && isReadable(response.body?.stream)) { + response.body.stream.cancel(error).catch((err) => { + if (err.code === 'ERR_INVALID_STATE') { + // Node bug? + return + } + throw err + }) + } +} + +// https://fetch.spec.whatwg.org/#fetching +function fetching ({ + request, + processRequestBodyChunkLength, + processRequestEndOfBody, + processResponse, + processResponseEndOfBody, + processResponseConsumeBody, + useParallelQueue = false, + dispatcher // undici +}) { + // 1. Let taskDestination be null. + let taskDestination = null + + // 2. Let crossOriginIsolatedCapability be false. + let crossOriginIsolatedCapability = false + + // 3. If request’s client is non-null, then: + if (request.client != null) { + // 1. Set taskDestination to request’s client’s global object. + taskDestination = request.client.globalObject + + // 2. Set crossOriginIsolatedCapability to request’s client’s cross-origin + // isolated capability. + crossOriginIsolatedCapability = + request.client.crossOriginIsolatedCapability + } + + // 4. If useParallelQueue is true, then set taskDestination to the result of + // starting a new parallel queue. + // TODO + + // 5. Let timingInfo be a new fetch timing info whose start time and + // post-redirect start time are the coarsened shared current time given + // crossOriginIsolatedCapability. + const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability) + const timingInfo = createOpaqueTimingInfo({ + startTime: currenTime + }) + + // 6. Let fetchParams be a new fetch params whose + // request is request, + // timing info is timingInfo, + // process request body chunk length is processRequestBodyChunkLength, + // process request end-of-body is processRequestEndOfBody, + // process response is processResponse, + // process response consume body is processResponseConsumeBody, + // process response end-of-body is processResponseEndOfBody, + // task destination is taskDestination, + // and cross-origin isolated capability is crossOriginIsolatedCapability. + const fetchParams = { + controller: new Fetch(dispatcher), + request, + timingInfo, + processRequestBodyChunkLength, + processRequestEndOfBody, + processResponse, + processResponseConsumeBody, + processResponseEndOfBody, + taskDestination, + crossOriginIsolatedCapability + } + + // 7. If request’s body is a byte sequence, then set request’s body to + // request’s body as a body. + // NOTE: Since fetching is only called from fetch, body should already be + // extracted. + assert(!request.body || request.body.stream) + + // 8. If request’s window is "client", then set request’s window to request’s + // client, if request’s client’s global object is a Window object; otherwise + // "no-window". + if (request.window === 'client') { + // TODO: What if request.client is null? + request.window = + request.client?.globalObject?.constructor?.name === 'Window' + ? request.client + : 'no-window' + } + + // 9. If request’s origin is "client", then set request’s origin to request’s + // client’s origin. + if (request.origin === 'client') { + // TODO: What if request.client is null? + request.origin = request.client?.origin + } + + // 10. If all of the following conditions are true: + // TODO + + // 11. If request’s policy container is "client", then: + if (request.policyContainer === 'client') { + // 1. If request’s client is non-null, then set request’s policy + // container to a clone of request’s client’s policy container. [HTML] + if (request.client != null) { + request.policyContainer = clonePolicyContainer( + request.client.policyContainer + ) + } else { + // 2. Otherwise, set request’s policy container to a new policy + // container. + request.policyContainer = makePolicyContainer() + } + } + + // 12. If request’s header list does not contain `Accept`, then: + if (!request.headersList.contains('accept')) { + // 1. Let value be `*/*`. + const value = '*/*' + + // 2. A user agent should set value to the first matching statement, if + // any, switching on request’s destination: + // "document" + // "frame" + // "iframe" + // `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8` + // "image" + // `image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5` + // "style" + // `text/css,*/*;q=0.1` + // TODO + + // 3. Append `Accept`/value to request’s header list. + request.headersList.append('accept', value) + } + + // 13. If request’s header list does not contain `Accept-Language`, then + // user agents should append `Accept-Language`/an appropriate value to + // request’s header list. + if (!request.headersList.contains('accept-language')) { + request.headersList.append('accept-language', '*') + } + + // 14. If request’s priority is null, then use request’s initiator and + // destination appropriately in setting request’s priority to a + // user-agent-defined object. + if (request.priority === null) { + // TODO + } + + // 15. If request is a subresource request, then: + if (subresource.includes(request.destination)) { + // TODO + } + + // 16. Run main fetch given fetchParams. + mainFetch(fetchParams) + .catch(err => { + fetchParams.controller.terminate(err) + }) + + // 17. Return fetchParam's controller + return fetchParams.controller +} + +// https://fetch.spec.whatwg.org/#concept-main-fetch +async function mainFetch (fetchParams, recursive = false) { + // 1. Let request be fetchParams’s request. + const request = fetchParams.request + + // 2. Let response be null. + let response = null + + // 3. If request’s local-URLs-only flag is set and request’s current URL is + // not local, then set response to a network error. + if (request.localURLsOnly && !urlIsLocal(requestCurrentURL(request))) { + response = makeNetworkError('local URLs only') + } + + // 4. Run report Content Security Policy violations for request. + // TODO + + // 5. Upgrade request to a potentially trustworthy URL, if appropriate. + tryUpgradeRequestToAPotentiallyTrustworthyURL(request) + + // 6. If should request be blocked due to a bad port, should fetching request + // be blocked as mixed content, or should request be blocked by Content + // Security Policy returns blocked, then set response to a network error. + if (requestBadPort(request) === 'blocked') { + response = makeNetworkError('bad port') + } + // TODO: should fetching request be blocked as mixed content? + // TODO: should request be blocked by Content Security Policy? + + // 7. If request’s referrer policy is the empty string, then set request’s + // referrer policy to request’s policy container’s referrer policy. + if (request.referrerPolicy === '') { + request.referrerPolicy = request.policyContainer.referrerPolicy + } + + // 8. If request’s referrer is not "no-referrer", then set request’s + // referrer to the result of invoking determine request’s referrer. + if (request.referrer !== 'no-referrer') { + request.referrer = determineRequestsReferrer(request) + } + + // 9. Set request’s current URL’s scheme to "https" if all of the following + // conditions are true: + // - request’s current URL’s scheme is "http" + // - request’s current URL’s host is a domain + // - Matching request’s current URL’s host per Known HSTS Host Domain Name + // Matching results in either a superdomain match with an asserted + // includeSubDomains directive or a congruent match (with or without an + // asserted includeSubDomains directive). [HSTS] + // TODO + + // 10. If recursive is false, then run the remaining steps in parallel. + // TODO + + // 11. If response is null, then set response to the result of running + // the steps corresponding to the first matching statement: + if (response === null) { + response = await (async () => { + const currentURL = requestCurrentURL(request) + + if ( + // - request’s current URL’s origin is same origin with request’s origin, + // and request’s response tainting is "basic" + (sameOrigin(currentURL, request.url) && request.responseTainting === 'basic') || + // request’s current URL’s scheme is "data" + (currentURL.protocol === 'data:') || + // - request’s mode is "navigate" or "websocket" + (request.mode === 'navigate' || request.mode === 'websocket') + ) { + // 1. Set request’s response tainting to "basic". + request.responseTainting = 'basic' + + // 2. Return the result of running scheme fetch given fetchParams. + return await schemeFetch(fetchParams) + } + + // request’s mode is "same-origin" + if (request.mode === 'same-origin') { + // 1. Return a network error. + return makeNetworkError('request mode cannot be "same-origin"') + } + + // request’s mode is "no-cors" + if (request.mode === 'no-cors') { + // 1. If request’s redirect mode is not "follow", then return a network + // error. + if (request.redirect !== 'follow') { + return makeNetworkError( + 'redirect mode cannot be "follow" for "no-cors" request' + ) + } + + // 2. Set request’s response tainting to "opaque". + request.responseTainting = 'opaque' + + // 3. Return the result of running scheme fetch given fetchParams. + return await schemeFetch(fetchParams) + } + + // request’s current URL’s scheme is not an HTTP(S) scheme + if (!urlIsHttpHttpsScheme(requestCurrentURL(request))) { + // Return a network error. + return makeNetworkError('URL scheme must be a HTTP(S) scheme') + } + + // - request’s use-CORS-preflight flag is set + // - request’s unsafe-request flag is set and either request’s method is + // not a CORS-safelisted method or CORS-unsafe request-header names with + // request’s header list is not empty + // 1. Set request’s response tainting to "cors". + // 2. Let corsWithPreflightResponse be the result of running HTTP fetch + // given fetchParams and true. + // 3. If corsWithPreflightResponse is a network error, then clear cache + // entries using request. + // 4. Return corsWithPreflightResponse. + // TODO + + // Otherwise + // 1. Set request’s response tainting to "cors". + request.responseTainting = 'cors' + + // 2. Return the result of running HTTP fetch given fetchParams. + return await httpFetch(fetchParams) + })() + } + + // 12. If recursive is true, then return response. + if (recursive) { + return response + } + + // 13. If response is not a network error and response is not a filtered + // response, then: + if (response.status !== 0 && !response.internalResponse) { + // If request’s response tainting is "cors", then: + if (request.responseTainting === 'cors') { + // 1. Let headerNames be the result of extracting header list values + // given `Access-Control-Expose-Headers` and response’s header list. + // TODO + // 2. If request’s credentials mode is not "include" and headerNames + // contains `*`, then set response’s CORS-exposed header-name list to + // all unique header names in response’s header list. + // TODO + // 3. Otherwise, if headerNames is not null or failure, then set + // response’s CORS-exposed header-name list to headerNames. + // TODO + } + + // Set response to the following filtered response with response as its + // internal response, depending on request’s response tainting: + if (request.responseTainting === 'basic') { + response = filterResponse(response, 'basic') + } else if (request.responseTainting === 'cors') { + response = filterResponse(response, 'cors') + } else if (request.responseTainting === 'opaque') { + response = filterResponse(response, 'opaque') + } else { + assert(false) + } + } + + // 14. Let internalResponse be response, if response is a network error, + // and response’s internal response otherwise. + let internalResponse = + response.status === 0 ? response : response.internalResponse + + // 15. If internalResponse’s URL list is empty, then set it to a clone of + // request’s URL list. + if (internalResponse.urlList.length === 0) { + internalResponse.urlList.push(...request.urlList) + } + + // 16. If request’s timing allow failed flag is unset, then set + // internalResponse’s timing allow passed flag. + if (!request.timingAllowFailed) { + response.timingAllowPassed = true + } + + // 17. If response is not a network error and any of the following returns + // blocked + // - should internalResponse to request be blocked as mixed content + // - should internalResponse to request be blocked by Content Security Policy + // - should internalResponse to request be blocked due to its MIME type + // - should internalResponse to request be blocked due to nosniff + // TODO + + // 18. If response’s type is "opaque", internalResponse’s status is 206, + // internalResponse’s range-requested flag is set, and request’s header + // list does not contain `Range`, then set response and internalResponse + // to a network error. + if ( + response.type === 'opaque' && + internalResponse.status === 206 && + internalResponse.rangeRequested && + !request.headers.contains('range') + ) { + response = internalResponse = makeNetworkError() + } + + // 19. If response is not a network error and either request’s method is + // `HEAD` or `CONNECT`, or internalResponse’s status is a null body status, + // set internalResponse’s body to null and disregard any enqueuing toward + // it (if any). + if ( + response.status !== 0 && + (request.method === 'HEAD' || + request.method === 'CONNECT' || + nullBodyStatus.includes(internalResponse.status)) + ) { + internalResponse.body = null + fetchParams.controller.dump = true + } + + // 20. If request’s integrity metadata is not the empty string, then: + if (request.integrity) { + // 1. Let processBodyError be this step: run fetch finale given fetchParams + // and a network error. + const processBodyError = (reason) => + fetchFinale(fetchParams, makeNetworkError(reason)) + + // 2. If request’s response tainting is "opaque", or response’s body is null, + // then run processBodyError and abort these steps. + if (request.responseTainting === 'opaque' || response.body == null) { + processBodyError(response.error) + return + } + + // 3. Let processBody given bytes be these steps: + const processBody = (bytes) => { + // 1. If bytes do not match request’s integrity metadata, + // then run processBodyError and abort these steps. [SRI] + if (!bytesMatch(bytes, request.integrity)) { + processBodyError('integrity mismatch') + return + } + + // 2. Set response’s body to bytes as a body. + response.body = safelyExtractBody(bytes)[0] + + // 3. Run fetch finale given fetchParams and response. + fetchFinale(fetchParams, response) + } + + // 4. Fully read response’s body given processBody and processBodyError. + await fullyReadBody(response.body, processBody, processBodyError) + } else { + // 21. Otherwise, run fetch finale given fetchParams and response. + fetchFinale(fetchParams, response) + } +} + +// https://fetch.spec.whatwg.org/#concept-scheme-fetch +// given a fetch params fetchParams +async function schemeFetch (fetchParams) { + // Note: since the connection is destroyed on redirect, which sets fetchParams to a + // cancelled state, we do not want this condition to trigger *unless* there have been + // no redirects. See https://github.com/nodejs/undici/issues/1776 + // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams. + if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { + return makeAppropriateNetworkError(fetchParams) + } + + // 2. Let request be fetchParams’s request. + const { request } = fetchParams + + const { protocol: scheme } = requestCurrentURL(request) + + // 3. Switch on request’s current URL’s scheme and run the associated steps: + switch (scheme) { + case 'about:': { + // If request’s current URL’s path is the string "blank", then return a new response + // whose status message is `OK`, header list is « (`Content-Type`, `text/html;charset=utf-8`) », + // and body is the empty byte sequence as a body. + + // Otherwise, return a network error. + return makeNetworkError('about scheme is not supported') + } + case 'blob:': { + if (!resolveObjectURL) { + resolveObjectURL = (__nccwpck_require__(4300).resolveObjectURL) + } + + // 1. Let blobURLEntry be request’s current URL’s blob URL entry. + const blobURLEntry = requestCurrentURL(request) + + // https://github.com/web-platform-tests/wpt/blob/7b0ebaccc62b566a1965396e5be7bb2bc06f841f/FileAPI/url/resources/fetch-tests.js#L52-L56 + // Buffer.resolveObjectURL does not ignore URL queries. + if (blobURLEntry.search.length !== 0) { + return makeNetworkError('NetworkError when attempting to fetch resource.') + } + + const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()) + + // 2. If request’s method is not `GET`, blobURLEntry is null, or blobURLEntry’s + // object is not a Blob object, then return a network error. + if (request.method !== 'GET' || !isBlobLike(blobURLEntryObject)) { + return makeNetworkError('invalid method') + } + + // 3. Let bodyWithType be the result of safely extracting blobURLEntry’s object. + const bodyWithType = safelyExtractBody(blobURLEntryObject) + + // 4. Let body be bodyWithType’s body. + const body = bodyWithType[0] + + // 5. Let length be body’s length, serialized and isomorphic encoded. + const length = isomorphicEncode(`${body.length}`) + + // 6. Let type be bodyWithType’s type if it is non-null; otherwise the empty byte sequence. + const type = bodyWithType[1] ?? '' + + // 7. Return a new response whose status message is `OK`, header list is + // « (`Content-Length`, length), (`Content-Type`, type) », and body is body. + const response = makeResponse({ + statusText: 'OK', + headersList: [ + ['content-length', { name: 'Content-Length', value: length }], + ['content-type', { name: 'Content-Type', value: type }] + ] + }) + + response.body = body + + return response + } + case 'data:': { + // 1. Let dataURLStruct be the result of running the + // data: URL processor on request’s current URL. + const currentURL = requestCurrentURL(request) + const dataURLStruct = dataURLProcessor(currentURL) + + // 2. If dataURLStruct is failure, then return a + // network error. + if (dataURLStruct === 'failure') { + return makeNetworkError('failed to fetch the data URL') + } + + // 3. Let mimeType be dataURLStruct’s MIME type, serialized. + const mimeType = serializeAMimeType(dataURLStruct.mimeType) + + // 4. Return a response whose status message is `OK`, + // header list is « (`Content-Type`, mimeType) », + // and body is dataURLStruct’s body as a body. + return makeResponse({ + statusText: 'OK', + headersList: [ + ['content-type', { name: 'Content-Type', value: mimeType }] + ], + body: safelyExtractBody(dataURLStruct.body)[0] + }) + } + case 'file:': { + // For now, unfortunate as it is, file URLs are left as an exercise for the reader. + // When in doubt, return a network error. + return makeNetworkError('not implemented... yet...') + } + case 'http:': + case 'https:': { + // Return the result of running HTTP fetch given fetchParams. + + return await httpFetch(fetchParams) + .catch((err) => makeNetworkError(err)) + } + default: { + return makeNetworkError('unknown scheme') + } + } +} + +// https://fetch.spec.whatwg.org/#finalize-response +function finalizeResponse (fetchParams, response) { + // 1. Set fetchParams’s request’s done flag. + fetchParams.request.done = true + + // 2, If fetchParams’s process response done is not null, then queue a fetch + // task to run fetchParams’s process response done given response, with + // fetchParams’s task destination. + if (fetchParams.processResponseDone != null) { + queueMicrotask(() => fetchParams.processResponseDone(response)) + } +} + +// https://fetch.spec.whatwg.org/#fetch-finale +async function fetchFinale (fetchParams, response) { + // 1. If response is a network error, then: + if (response.type === 'error') { + // 1. Set response’s URL list to « fetchParams’s request’s URL list[0] ». + response.urlList = [fetchParams.request.urlList[0]] + + // 2. Set response’s timing info to the result of creating an opaque timing + // info for fetchParams’s timing info. + response.timingInfo = createOpaqueTimingInfo({ + startTime: fetchParams.timingInfo.startTime + }) + } + + // 2. Let processResponseEndOfBody be the following steps: + const processResponseEndOfBody = () => { + // 1. Set fetchParams’s request’s done flag. + fetchParams.request.done = true + + // If fetchParams’s process response end-of-body is not null, + // then queue a fetch task to run fetchParams’s process response + // end-of-body given response with fetchParams’s task destination. + if (fetchParams.processResponseEndOfBody != null) { + queueMicrotask(() => fetchParams.processResponseEndOfBody(response)) + } + } + + // 3. If fetchParams’s process response is non-null, then queue a fetch task + // to run fetchParams’s process response given response, with fetchParams’s + // task destination. + if (fetchParams.processResponse != null) { + queueMicrotask(() => fetchParams.processResponse(response)) + } + + // 4. If response’s body is null, then run processResponseEndOfBody. + if (response.body == null) { + processResponseEndOfBody() + } else { + // 5. Otherwise: + + // 1. Let transformStream be a new a TransformStream. + + // 2. Let identityTransformAlgorithm be an algorithm which, given chunk, + // enqueues chunk in transformStream. + const identityTransformAlgorithm = (chunk, controller) => { + controller.enqueue(chunk) + } + + // 3. Set up transformStream with transformAlgorithm set to identityTransformAlgorithm + // and flushAlgorithm set to processResponseEndOfBody. + const transformStream = new TransformStream({ + start () {}, + transform: identityTransformAlgorithm, + flush: processResponseEndOfBody + }, { + size () { + return 1 + } + }, { + size () { + return 1 + } + }) + + // 4. Set response’s body to the result of piping response’s body through transformStream. + response.body = { stream: response.body.stream.pipeThrough(transformStream) } + } + + // 6. If fetchParams’s process response consume body is non-null, then: + if (fetchParams.processResponseConsumeBody != null) { + // 1. Let processBody given nullOrBytes be this step: run fetchParams’s + // process response consume body given response and nullOrBytes. + const processBody = (nullOrBytes) => fetchParams.processResponseConsumeBody(response, nullOrBytes) + + // 2. Let processBodyError be this step: run fetchParams’s process + // response consume body given response and failure. + const processBodyError = (failure) => fetchParams.processResponseConsumeBody(response, failure) + + // 3. If response’s body is null, then queue a fetch task to run processBody + // given null, with fetchParams’s task destination. + if (response.body == null) { + queueMicrotask(() => processBody(null)) + } else { + // 4. Otherwise, fully read response’s body given processBody, processBodyError, + // and fetchParams’s task destination. + await fullyReadBody(response.body, processBody, processBodyError) + } + } +} + +// https://fetch.spec.whatwg.org/#http-fetch +async function httpFetch (fetchParams) { + // 1. Let request be fetchParams’s request. + const request = fetchParams.request + + // 2. Let response be null. + let response = null + + // 3. Let actualResponse be null. + let actualResponse = null + + // 4. Let timingInfo be fetchParams’s timing info. + const timingInfo = fetchParams.timingInfo + + // 5. If request’s service-workers mode is "all", then: + if (request.serviceWorkers === 'all') { + // TODO + } + + // 6. If response is null, then: + if (response === null) { + // 1. If makeCORSPreflight is true and one of these conditions is true: + // TODO + + // 2. If request’s redirect mode is "follow", then set request’s + // service-workers mode to "none". + if (request.redirect === 'follow') { + request.serviceWorkers = 'none' + } + + // 3. Set response and actualResponse to the result of running + // HTTP-network-or-cache fetch given fetchParams. + actualResponse = response = await httpNetworkOrCacheFetch(fetchParams) + + // 4. If request’s response tainting is "cors" and a CORS check + // for request and response returns failure, then return a network error. + if ( + request.responseTainting === 'cors' && + corsCheck(request, response) === 'failure' + ) { + return makeNetworkError('cors failure') + } + + // 5. If the TAO check for request and response returns failure, then set + // request’s timing allow failed flag. + if (TAOCheck(request, response) === 'failure') { + request.timingAllowFailed = true + } + } + + // 7. If either request’s response tainting or response’s type + // is "opaque", and the cross-origin resource policy check with + // request’s origin, request’s client, request’s destination, + // and actualResponse returns blocked, then return a network error. + if ( + (request.responseTainting === 'opaque' || response.type === 'opaque') && + crossOriginResourcePolicyCheck( + request.origin, + request.client, + request.destination, + actualResponse + ) === 'blocked' + ) { + return makeNetworkError('blocked') + } + + // 8. If actualResponse’s status is a redirect status, then: + if (redirectStatus.includes(actualResponse.status)) { + // 1. If actualResponse’s status is not 303, request’s body is not null, + // and the connection uses HTTP/2, then user agents may, and are even + // encouraged to, transmit an RST_STREAM frame. + // See, https://github.com/whatwg/fetch/issues/1288 + if (request.redirect !== 'manual') { + fetchParams.controller.connection.destroy() + } + + // 2. Switch on request’s redirect mode: + if (request.redirect === 'error') { + // Set response to a network error. + response = makeNetworkError('unexpected redirect') + } else if (request.redirect === 'manual') { + // Set response to an opaque-redirect filtered response whose internal + // response is actualResponse. + // NOTE(spec): On the web this would return an `opaqueredirect` response, + // but that doesn't make sense server side. + // See https://github.com/nodejs/undici/issues/1193. + response = actualResponse + } else if (request.redirect === 'follow') { + // Set response to the result of running HTTP-redirect fetch given + // fetchParams and response. + response = await httpRedirectFetch(fetchParams, response) + } else { + assert(false) + } + } + + // 9. Set response’s timing info to timingInfo. + response.timingInfo = timingInfo + + // 10. Return response. + return response +} + +// https://fetch.spec.whatwg.org/#http-redirect-fetch +async function httpRedirectFetch (fetchParams, response) { + // 1. Let request be fetchParams’s request. + const request = fetchParams.request + + // 2. Let actualResponse be response, if response is not a filtered response, + // and response’s internal response otherwise. + const actualResponse = response.internalResponse + ? response.internalResponse + : response + + // 3. Let locationURL be actualResponse’s location URL given request’s current + // URL’s fragment. + let locationURL + + try { + locationURL = responseLocationURL( + actualResponse, + requestCurrentURL(request).hash + ) + + // 4. If locationURL is null, then return response. + if (locationURL == null) { + return response + } + } catch (err) { + // 5. If locationURL is failure, then return a network error. + return makeNetworkError(err) + } + + // 6. If locationURL’s scheme is not an HTTP(S) scheme, then return a network + // error. + if (!urlIsHttpHttpsScheme(locationURL)) { + return makeNetworkError('URL scheme must be a HTTP(S) scheme') + } + + // 7. If request’s redirect count is 20, then return a network error. + if (request.redirectCount === 20) { + return makeNetworkError('redirect count exceeded') + } + + // 8. Increase request’s redirect count by 1. + request.redirectCount += 1 + + // 9. If request’s mode is "cors", locationURL includes credentials, and + // request’s origin is not same origin with locationURL’s origin, then return + // a network error. + if ( + request.mode === 'cors' && + (locationURL.username || locationURL.password) && + !sameOrigin(request, locationURL) + ) { + return makeNetworkError('cross origin not allowed for request mode "cors"') + } + + // 10. If request’s response tainting is "cors" and locationURL includes + // credentials, then return a network error. + if ( + request.responseTainting === 'cors' && + (locationURL.username || locationURL.password) + ) { + return makeNetworkError( + 'URL cannot contain credentials for request mode "cors"' + ) + } + + // 11. If actualResponse’s status is not 303, request’s body is non-null, + // and request’s body’s source is null, then return a network error. + if ( + actualResponse.status !== 303 && + request.body != null && + request.body.source == null + ) { + return makeNetworkError() + } + + // 12. If one of the following is true + // - actualResponse’s status is 301 or 302 and request’s method is `POST` + // - actualResponse’s status is 303 and request’s method is not `GET` or `HEAD` + if ( + ([301, 302].includes(actualResponse.status) && request.method === 'POST') || + (actualResponse.status === 303 && + !['GET', 'HEAD'].includes(request.method)) + ) { + // then: + // 1. Set request’s method to `GET` and request’s body to null. + request.method = 'GET' + request.body = null + + // 2. For each headerName of request-body-header name, delete headerName from + // request’s header list. + for (const headerName of requestBodyHeader) { + request.headersList.delete(headerName) + } + } + + // 13. If request’s current URL’s origin is not same origin with locationURL’s + // origin, then for each headerName of CORS non-wildcard request-header name, + // delete headerName from request’s header list. + if (!sameOrigin(requestCurrentURL(request), locationURL)) { + // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name + request.headersList.delete('authorization') + + // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement. + request.headersList.delete('cookie') + request.headersList.delete('host') + } + + // 14. If request’s body is non-null, then set request’s body to the first return + // value of safely extracting request’s body’s source. + if (request.body != null) { + assert(request.body.source != null) + request.body = safelyExtractBody(request.body.source)[0] + } + + // 15. Let timingInfo be fetchParams’s timing info. + const timingInfo = fetchParams.timingInfo + + // 16. Set timingInfo’s redirect end time and post-redirect start time to the + // coarsened shared current time given fetchParams’s cross-origin isolated + // capability. + timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = + coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability) + + // 17. If timingInfo’s redirect start time is 0, then set timingInfo’s + // redirect start time to timingInfo’s start time. + if (timingInfo.redirectStartTime === 0) { + timingInfo.redirectStartTime = timingInfo.startTime + } + + // 18. Append locationURL to request’s URL list. + request.urlList.push(locationURL) + + // 19. Invoke set request’s referrer policy on redirect on request and + // actualResponse. + setRequestReferrerPolicyOnRedirect(request, actualResponse) + + // 20. Return the result of running main fetch given fetchParams and true. + return mainFetch(fetchParams, true) +} + +// https://fetch.spec.whatwg.org/#http-network-or-cache-fetch +async function httpNetworkOrCacheFetch ( + fetchParams, + isAuthenticationFetch = false, + isNewConnectionFetch = false +) { + // 1. Let request be fetchParams’s request. + const request = fetchParams.request + + // 2. Let httpFetchParams be null. + let httpFetchParams = null + + // 3. Let httpRequest be null. + let httpRequest = null + + // 4. Let response be null. + let response = null + + // 5. Let storedResponse be null. + // TODO: cache + + // 6. Let httpCache be null. + const httpCache = null + + // 7. Let the revalidatingFlag be unset. + const revalidatingFlag = false + + // 8. Run these steps, but abort when the ongoing fetch is terminated: + + // 1. If request’s window is "no-window" and request’s redirect mode is + // "error", then set httpFetchParams to fetchParams and httpRequest to + // request. + if (request.window === 'no-window' && request.redirect === 'error') { + httpFetchParams = fetchParams + httpRequest = request + } else { + // Otherwise: + + // 1. Set httpRequest to a clone of request. + httpRequest = makeRequest(request) + + // 2. Set httpFetchParams to a copy of fetchParams. + httpFetchParams = { ...fetchParams } + + // 3. Set httpFetchParams’s request to httpRequest. + httpFetchParams.request = httpRequest + } + + // 3. Let includeCredentials be true if one of + const includeCredentials = + request.credentials === 'include' || + (request.credentials === 'same-origin' && + request.responseTainting === 'basic') + + // 4. Let contentLength be httpRequest’s body’s length, if httpRequest’s + // body is non-null; otherwise null. + const contentLength = httpRequest.body ? httpRequest.body.length : null + + // 5. Let contentLengthHeaderValue be null. + let contentLengthHeaderValue = null + + // 6. If httpRequest’s body is null and httpRequest’s method is `POST` or + // `PUT`, then set contentLengthHeaderValue to `0`. + if ( + httpRequest.body == null && + ['POST', 'PUT'].includes(httpRequest.method) + ) { + contentLengthHeaderValue = '0' + } + + // 7. If contentLength is non-null, then set contentLengthHeaderValue to + // contentLength, serialized and isomorphic encoded. + if (contentLength != null) { + contentLengthHeaderValue = isomorphicEncode(`${contentLength}`) + } + + // 8. If contentLengthHeaderValue is non-null, then append + // `Content-Length`/contentLengthHeaderValue to httpRequest’s header + // list. + if (contentLengthHeaderValue != null) { + httpRequest.headersList.append('content-length', contentLengthHeaderValue) + } + + // 9. If contentLengthHeaderValue is non-null, then append (`Content-Length`, + // contentLengthHeaderValue) to httpRequest’s header list. + + // 10. If contentLength is non-null and httpRequest’s keepalive is true, + // then: + if (contentLength != null && httpRequest.keepalive) { + // NOTE: keepalive is a noop outside of browser context. + } + + // 11. If httpRequest’s referrer is a URL, then append + // `Referer`/httpRequest’s referrer, serialized and isomorphic encoded, + // to httpRequest’s header list. + if (httpRequest.referrer instanceof URL) { + httpRequest.headersList.append('referer', isomorphicEncode(httpRequest.referrer.href)) + } + + // 12. Append a request `Origin` header for httpRequest. + appendRequestOriginHeader(httpRequest) + + // 13. Append the Fetch metadata headers for httpRequest. [FETCH-METADATA] + appendFetchMetadata(httpRequest) + + // 14. If httpRequest’s header list does not contain `User-Agent`, then + // user agents should append `User-Agent`/default `User-Agent` value to + // httpRequest’s header list. + if (!httpRequest.headersList.contains('user-agent')) { + httpRequest.headersList.append('user-agent', typeof esbuildDetection === 'undefined' ? 'undici' : 'node') + } + + // 15. If httpRequest’s cache mode is "default" and httpRequest’s header + // list contains `If-Modified-Since`, `If-None-Match`, + // `If-Unmodified-Since`, `If-Match`, or `If-Range`, then set + // httpRequest’s cache mode to "no-store". + if ( + httpRequest.cache === 'default' && + (httpRequest.headersList.contains('if-modified-since') || + httpRequest.headersList.contains('if-none-match') || + httpRequest.headersList.contains('if-unmodified-since') || + httpRequest.headersList.contains('if-match') || + httpRequest.headersList.contains('if-range')) + ) { + httpRequest.cache = 'no-store' + } + + // 16. If httpRequest’s cache mode is "no-cache", httpRequest’s prevent + // no-cache cache-control header modification flag is unset, and + // httpRequest’s header list does not contain `Cache-Control`, then append + // `Cache-Control`/`max-age=0` to httpRequest’s header list. + if ( + httpRequest.cache === 'no-cache' && + !httpRequest.preventNoCacheCacheControlHeaderModification && + !httpRequest.headersList.contains('cache-control') + ) { + httpRequest.headersList.append('cache-control', 'max-age=0') + } + + // 17. If httpRequest’s cache mode is "no-store" or "reload", then: + if (httpRequest.cache === 'no-store' || httpRequest.cache === 'reload') { + // 1. If httpRequest’s header list does not contain `Pragma`, then append + // `Pragma`/`no-cache` to httpRequest’s header list. + if (!httpRequest.headersList.contains('pragma')) { + httpRequest.headersList.append('pragma', 'no-cache') + } + + // 2. If httpRequest’s header list does not contain `Cache-Control`, + // then append `Cache-Control`/`no-cache` to httpRequest’s header list. + if (!httpRequest.headersList.contains('cache-control')) { + httpRequest.headersList.append('cache-control', 'no-cache') + } + } + + // 18. If httpRequest’s header list contains `Range`, then append + // `Accept-Encoding`/`identity` to httpRequest’s header list. + if (httpRequest.headersList.contains('range')) { + httpRequest.headersList.append('accept-encoding', 'identity') + } + + // 19. Modify httpRequest’s header list per HTTP. Do not append a given + // header if httpRequest’s header list contains that header’s name. + // TODO: https://github.com/whatwg/fetch/issues/1285#issuecomment-896560129 + if (!httpRequest.headersList.contains('accept-encoding')) { + if (urlHasHttpsScheme(requestCurrentURL(httpRequest))) { + httpRequest.headersList.append('accept-encoding', 'br, gzip, deflate') + } else { + httpRequest.headersList.append('accept-encoding', 'gzip, deflate') + } + } + + httpRequest.headersList.delete('host') + + // 20. If includeCredentials is true, then: + if (includeCredentials) { + // 1. If the user agent is not configured to block cookies for httpRequest + // (see section 7 of [COOKIES]), then: + // TODO: credentials + // 2. If httpRequest’s header list does not contain `Authorization`, then: + // TODO: credentials + } + + // 21. If there’s a proxy-authentication entry, use it as appropriate. + // TODO: proxy-authentication + + // 22. Set httpCache to the result of determining the HTTP cache + // partition, given httpRequest. + // TODO: cache + + // 23. If httpCache is null, then set httpRequest’s cache mode to + // "no-store". + if (httpCache == null) { + httpRequest.cache = 'no-store' + } + + // 24. If httpRequest’s cache mode is neither "no-store" nor "reload", + // then: + if (httpRequest.mode !== 'no-store' && httpRequest.mode !== 'reload') { + // TODO: cache + } + + // 9. If aborted, then return the appropriate network error for fetchParams. + // TODO + + // 10. If response is null, then: + if (response == null) { + // 1. If httpRequest’s cache mode is "only-if-cached", then return a + // network error. + if (httpRequest.mode === 'only-if-cached') { + return makeNetworkError('only if cached') + } + + // 2. Let forwardResponse be the result of running HTTP-network fetch + // given httpFetchParams, includeCredentials, and isNewConnectionFetch. + const forwardResponse = await httpNetworkFetch( + httpFetchParams, + includeCredentials, + isNewConnectionFetch + ) + + // 3. If httpRequest’s method is unsafe and forwardResponse’s status is + // in the range 200 to 399, inclusive, invalidate appropriate stored + // responses in httpCache, as per the "Invalidation" chapter of HTTP + // Caching, and set storedResponse to null. [HTTP-CACHING] + if ( + !safeMethods.includes(httpRequest.method) && + forwardResponse.status >= 200 && + forwardResponse.status <= 399 + ) { + // TODO: cache + } + + // 4. If the revalidatingFlag is set and forwardResponse’s status is 304, + // then: + if (revalidatingFlag && forwardResponse.status === 304) { + // TODO: cache + } + + // 5. If response is null, then: + if (response == null) { + // 1. Set response to forwardResponse. + response = forwardResponse + + // 2. Store httpRequest and forwardResponse in httpCache, as per the + // "Storing Responses in Caches" chapter of HTTP Caching. [HTTP-CACHING] + // TODO: cache + } + } + + // 11. Set response’s URL list to a clone of httpRequest’s URL list. + response.urlList = [...httpRequest.urlList] + + // 12. If httpRequest’s header list contains `Range`, then set response’s + // range-requested flag. + if (httpRequest.headersList.contains('range')) { + response.rangeRequested = true + } + + // 13. Set response’s request-includes-credentials to includeCredentials. + response.requestIncludesCredentials = includeCredentials + + // 14. If response’s status is 401, httpRequest’s response tainting is not + // "cors", includeCredentials is true, and request’s window is an environment + // settings object, then: + // TODO + + // 15. If response’s status is 407, then: + if (response.status === 407) { + // 1. If request’s window is "no-window", then return a network error. + if (request.window === 'no-window') { + return makeNetworkError() + } + + // 2. ??? + + // 3. If fetchParams is canceled, then return the appropriate network error for fetchParams. + if (isCancelled(fetchParams)) { + return makeAppropriateNetworkError(fetchParams) + } + + // 4. Prompt the end user as appropriate in request’s window and store + // the result as a proxy-authentication entry. [HTTP-AUTH] + // TODO: Invoke some kind of callback? + + // 5. Set response to the result of running HTTP-network-or-cache fetch given + // fetchParams. + // TODO + return makeNetworkError('proxy authentication required') + } + + // 16. If all of the following are true + if ( + // response’s status is 421 + response.status === 421 && + // isNewConnectionFetch is false + !isNewConnectionFetch && + // request’s body is null, or request’s body is non-null and request’s body’s source is non-null + (request.body == null || request.body.source != null) + ) { + // then: + + // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams. + if (isCancelled(fetchParams)) { + return makeAppropriateNetworkError(fetchParams) + } + + // 2. Set response to the result of running HTTP-network-or-cache + // fetch given fetchParams, isAuthenticationFetch, and true. + + // TODO (spec): The spec doesn't specify this but we need to cancel + // the active response before we can start a new one. + // https://github.com/whatwg/fetch/issues/1293 + fetchParams.controller.connection.destroy() + + response = await httpNetworkOrCacheFetch( + fetchParams, + isAuthenticationFetch, + true + ) + } + + // 17. If isAuthenticationFetch is true, then create an authentication entry + if (isAuthenticationFetch) { + // TODO + } + + // 18. Return response. + return response +} + +// https://fetch.spec.whatwg.org/#http-network-fetch +async function httpNetworkFetch ( + fetchParams, + includeCredentials = false, + forceNewConnection = false +) { + assert(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed) + + fetchParams.controller.connection = { + abort: null, + destroyed: false, + destroy (err) { + if (!this.destroyed) { + this.destroyed = true + this.abort?.(err ?? new DOMException('The operation was aborted.', 'AbortError')) + } + } + } + + // 1. Let request be fetchParams’s request. + const request = fetchParams.request + + // 2. Let response be null. + let response = null + + // 3. Let timingInfo be fetchParams’s timing info. + const timingInfo = fetchParams.timingInfo + + // 4. Let httpCache be the result of determining the HTTP cache partition, + // given request. + // TODO: cache + const httpCache = null + + // 5. If httpCache is null, then set request’s cache mode to "no-store". + if (httpCache == null) { + request.cache = 'no-store' + } + + // 6. Let networkPartitionKey be the result of determining the network + // partition key given request. + // TODO + + // 7. Let newConnection be "yes" if forceNewConnection is true; otherwise + // "no". + const newConnection = forceNewConnection ? 'yes' : 'no' // eslint-disable-line no-unused-vars + + // 8. Switch on request’s mode: + if (request.mode === 'websocket') { + // Let connection be the result of obtaining a WebSocket connection, + // given request’s current URL. + // TODO + } else { + // Let connection be the result of obtaining a connection, given + // networkPartitionKey, request’s current URL’s origin, + // includeCredentials, and forceNewConnection. + // TODO + } + + // 9. Run these steps, but abort when the ongoing fetch is terminated: + + // 1. If connection is failure, then return a network error. + + // 2. Set timingInfo’s final connection timing info to the result of + // calling clamp and coarsen connection timing info with connection’s + // timing info, timingInfo’s post-redirect start time, and fetchParams’s + // cross-origin isolated capability. + + // 3. If connection is not an HTTP/2 connection, request’s body is non-null, + // and request’s body’s source is null, then append (`Transfer-Encoding`, + // `chunked`) to request’s header list. + + // 4. Set timingInfo’s final network-request start time to the coarsened + // shared current time given fetchParams’s cross-origin isolated + // capability. + + // 5. Set response to the result of making an HTTP request over connection + // using request with the following caveats: + + // - Follow the relevant requirements from HTTP. [HTTP] [HTTP-SEMANTICS] + // [HTTP-COND] [HTTP-CACHING] [HTTP-AUTH] + + // - If request’s body is non-null, and request’s body’s source is null, + // then the user agent may have a buffer of up to 64 kibibytes and store + // a part of request’s body in that buffer. If the user agent reads from + // request’s body beyond that buffer’s size and the user agent needs to + // resend request, then instead return a network error. + + // - Set timingInfo’s final network-response start time to the coarsened + // shared current time given fetchParams’s cross-origin isolated capability, + // immediately after the user agent’s HTTP parser receives the first byte + // of the response (e.g., frame header bytes for HTTP/2 or response status + // line for HTTP/1.x). + + // - Wait until all the headers are transmitted. + + // - Any responses whose status is in the range 100 to 199, inclusive, + // and is not 101, are to be ignored, except for the purposes of setting + // timingInfo’s final network-response start time above. + + // - If request’s header list contains `Transfer-Encoding`/`chunked` and + // response is transferred via HTTP/1.0 or older, then return a network + // error. + + // - If the HTTP request results in a TLS client certificate dialog, then: + + // 1. If request’s window is an environment settings object, make the + // dialog available in request’s window. + + // 2. Otherwise, return a network error. + + // To transmit request’s body body, run these steps: + let requestBody = null + // 1. If body is null and fetchParams’s process request end-of-body is + // non-null, then queue a fetch task given fetchParams’s process request + // end-of-body and fetchParams’s task destination. + if (request.body == null && fetchParams.processRequestEndOfBody) { + queueMicrotask(() => fetchParams.processRequestEndOfBody()) + } else if (request.body != null) { + // 2. Otherwise, if body is non-null: + + // 1. Let processBodyChunk given bytes be these steps: + const processBodyChunk = async function * (bytes) { + // 1. If the ongoing fetch is terminated, then abort these steps. + if (isCancelled(fetchParams)) { + return + } + + // 2. Run this step in parallel: transmit bytes. + yield bytes + + // 3. If fetchParams’s process request body is non-null, then run + // fetchParams’s process request body given bytes’s length. + fetchParams.processRequestBodyChunkLength?.(bytes.byteLength) + } + + // 2. Let processEndOfBody be these steps: + const processEndOfBody = () => { + // 1. If fetchParams is canceled, then abort these steps. + if (isCancelled(fetchParams)) { + return + } + + // 2. If fetchParams’s process request end-of-body is non-null, + // then run fetchParams’s process request end-of-body. + if (fetchParams.processRequestEndOfBody) { + fetchParams.processRequestEndOfBody() + } + } + + // 3. Let processBodyError given e be these steps: + const processBodyError = (e) => { + // 1. If fetchParams is canceled, then abort these steps. + if (isCancelled(fetchParams)) { + return + } + + // 2. If e is an "AbortError" DOMException, then abort fetchParams’s controller. + if (e.name === 'AbortError') { + fetchParams.controller.abort() + } else { + fetchParams.controller.terminate(e) + } + } + + // 4. Incrementally read request’s body given processBodyChunk, processEndOfBody, + // processBodyError, and fetchParams’s task destination. + requestBody = (async function * () { + try { + for await (const bytes of request.body.stream) { + yield * processBodyChunk(bytes) + } + processEndOfBody() + } catch (err) { + processBodyError(err) + } + })() + } + + try { + // socket is only provided for websockets + const { body, status, statusText, headersList, socket } = await dispatch({ body: requestBody }) + + if (socket) { + response = makeResponse({ status, statusText, headersList, socket }) + } else { + const iterator = body[Symbol.asyncIterator]() + fetchParams.controller.next = () => iterator.next() + + response = makeResponse({ status, statusText, headersList }) + } + } catch (err) { + // 10. If aborted, then: + if (err.name === 'AbortError') { + // 1. If connection uses HTTP/2, then transmit an RST_STREAM frame. + fetchParams.controller.connection.destroy() + + // 2. Return the appropriate network error for fetchParams. + return makeAppropriateNetworkError(fetchParams, err) + } + + return makeNetworkError(err) + } + + // 11. Let pullAlgorithm be an action that resumes the ongoing fetch + // if it is suspended. + const pullAlgorithm = () => { + fetchParams.controller.resume() + } + + // 12. Let cancelAlgorithm be an algorithm that aborts fetchParams’s + // controller with reason, given reason. + const cancelAlgorithm = (reason) => { + fetchParams.controller.abort(reason) + } + + // 13. Let highWaterMark be a non-negative, non-NaN number, chosen by + // the user agent. + // TODO + + // 14. Let sizeAlgorithm be an algorithm that accepts a chunk object + // and returns a non-negative, non-NaN, non-infinite number, chosen by the user agent. + // TODO + + // 15. Let stream be a new ReadableStream. + // 16. Set up stream with pullAlgorithm set to pullAlgorithm, + // cancelAlgorithm set to cancelAlgorithm, highWaterMark set to + // highWaterMark, and sizeAlgorithm set to sizeAlgorithm. + if (!ReadableStream) { + ReadableStream = (__nccwpck_require__(5356).ReadableStream) + } + + const stream = new ReadableStream( + { + async start (controller) { + fetchParams.controller.controller = controller + }, + async pull (controller) { + await pullAlgorithm(controller) + }, + async cancel (reason) { + await cancelAlgorithm(reason) + } + }, + { + highWaterMark: 0, + size () { + return 1 + } + } + ) + + // 17. Run these steps, but abort when the ongoing fetch is terminated: + + // 1. Set response’s body to a new body whose stream is stream. + response.body = { stream } + + // 2. If response is not a network error and request’s cache mode is + // not "no-store", then update response in httpCache for request. + // TODO + + // 3. If includeCredentials is true and the user agent is not configured + // to block cookies for request (see section 7 of [COOKIES]), then run the + // "set-cookie-string" parsing algorithm (see section 5.2 of [COOKIES]) on + // the value of each header whose name is a byte-case-insensitive match for + // `Set-Cookie` in response’s header list, if any, and request’s current URL. + // TODO + + // 18. If aborted, then: + // TODO + + // 19. Run these steps in parallel: + + // 1. Run these steps, but abort when fetchParams is canceled: + fetchParams.controller.on('terminated', onAborted) + fetchParams.controller.resume = async () => { + // 1. While true + while (true) { + // 1-3. See onData... + + // 4. Set bytes to the result of handling content codings given + // codings and bytes. + let bytes + let isFailure + try { + const { done, value } = await fetchParams.controller.next() + + if (isAborted(fetchParams)) { + break + } + + bytes = done ? undefined : value + } catch (err) { + if (fetchParams.controller.ended && !timingInfo.encodedBodySize) { + // zlib doesn't like empty streams. + bytes = undefined + } else { + bytes = err + + // err may be propagated from the result of calling readablestream.cancel, + // which might not be an error. https://github.com/nodejs/undici/issues/2009 + isFailure = true + } + } + + if (bytes === undefined) { + // 2. Otherwise, if the bytes transmission for response’s message + // body is done normally and stream is readable, then close + // stream, finalize response for fetchParams and response, and + // abort these in-parallel steps. + readableStreamClose(fetchParams.controller.controller) + + finalizeResponse(fetchParams, response) + + return + } + + // 5. Increase timingInfo’s decoded body size by bytes’s length. + timingInfo.decodedBodySize += bytes?.byteLength ?? 0 + + // 6. If bytes is failure, then terminate fetchParams’s controller. + if (isFailure) { + fetchParams.controller.terminate(bytes) + return + } + + // 7. Enqueue a Uint8Array wrapping an ArrayBuffer containing bytes + // into stream. + fetchParams.controller.controller.enqueue(new Uint8Array(bytes)) + + // 8. If stream is errored, then terminate the ongoing fetch. + if (isErrored(stream)) { + fetchParams.controller.terminate() + return + } + + // 9. If stream doesn’t need more data ask the user agent to suspend + // the ongoing fetch. + if (!fetchParams.controller.controller.desiredSize) { + return + } + } + } + + // 2. If aborted, then: + function onAborted (reason) { + // 2. If fetchParams is aborted, then: + if (isAborted(fetchParams)) { + // 1. Set response’s aborted flag. + response.aborted = true + + // 2. If stream is readable, then error stream with the result of + // deserialize a serialized abort reason given fetchParams’s + // controller’s serialized abort reason and an + // implementation-defined realm. + if (isReadable(stream)) { + fetchParams.controller.controller.error( + fetchParams.controller.serializedAbortReason + ) + } + } else { + // 3. Otherwise, if stream is readable, error stream with a TypeError. + if (isReadable(stream)) { + fetchParams.controller.controller.error(new TypeError('terminated', { + cause: isErrorLike(reason) ? reason : undefined + })) + } + } + + // 4. If connection uses HTTP/2, then transmit an RST_STREAM frame. + // 5. Otherwise, the user agent should close connection unless it would be bad for performance to do so. + fetchParams.controller.connection.destroy() + } + + // 20. Return response. + return response + + async function dispatch ({ body }) { + const url = requestCurrentURL(request) + /** @type {import('../..').Agent} */ + const agent = fetchParams.controller.dispatcher + + return new Promise((resolve, reject) => agent.dispatch( + { + path: url.pathname + url.search, + origin: url.origin, + method: request.method, + body: fetchParams.controller.dispatcher.isMockActive ? request.body && request.body.source : body, + headers: request.headersList.entries, + maxRedirections: 0, + upgrade: request.mode === 'websocket' ? 'websocket' : undefined + }, + { + body: null, + abort: null, + + onConnect (abort) { + // TODO (fix): Do we need connection here? + const { connection } = fetchParams.controller + + if (connection.destroyed) { + abort(new DOMException('The operation was aborted.', 'AbortError')) + } else { + fetchParams.controller.on('terminated', abort) + this.abort = connection.abort = abort + } + }, + + onHeaders (status, headersList, resume, statusText) { + if (status < 200) { + return + } + + let codings = [] + let location = '' + + const headers = new Headers() + + // For H2, the headers are a plain JS object + // We distinguish between them and iterate accordingly + if (Array.isArray(headersList)) { + for (let n = 0; n < headersList.length; n += 2) { + const key = headersList[n + 0].toString('latin1') + const val = headersList[n + 1].toString('latin1') + if (key.toLowerCase() === 'content-encoding') { + // https://www.rfc-editor.org/rfc/rfc7231#section-3.1.2.1 + // "All content-coding values are case-insensitive..." + codings = val.toLowerCase().split(',').map((x) => x.trim()) + } else if (key.toLowerCase() === 'location') { + location = val + } + + headers.append(key, val) + } + } else { + const keys = Object.keys(headersList) + for (const key of keys) { + const val = headersList[key] + if (key.toLowerCase() === 'content-encoding') { + // https://www.rfc-editor.org/rfc/rfc7231#section-3.1.2.1 + // "All content-coding values are case-insensitive..." + codings = val.toLowerCase().split(',').map((x) => x.trim()).reverse() + } else if (key.toLowerCase() === 'location') { + location = val + } + + headers.append(key, val) + } + } + + this.body = new Readable({ read: resume }) + + const decoders = [] + + const willFollow = request.redirect === 'follow' && + location && + redirectStatus.includes(status) + + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding + if (request.method !== 'HEAD' && request.method !== 'CONNECT' && !nullBodyStatus.includes(status) && !willFollow) { + for (const coding of codings) { + // https://www.rfc-editor.org/rfc/rfc9112.html#section-7.2 + if (coding === 'x-gzip' || coding === 'gzip') { + decoders.push(zlib.createGunzip({ + // Be less strict when decoding compressed responses, since sometimes + // servers send slightly invalid responses that are still accepted + // by common browsers. + // Always using Z_SYNC_FLUSH is what cURL does. + flush: zlib.constants.Z_SYNC_FLUSH, + finishFlush: zlib.constants.Z_SYNC_FLUSH + })) + } else if (coding === 'deflate') { + decoders.push(zlib.createInflate()) + } else if (coding === 'br') { + decoders.push(zlib.createBrotliDecompress()) + } else { + decoders.length = 0 + break + } + } + } + + resolve({ + status, + statusText, + headersList: headers[kHeadersList], + body: decoders.length + ? pipeline(this.body, ...decoders, () => { }) + : this.body.on('error', () => {}) + }) + + return true + }, + + onData (chunk) { + if (fetchParams.controller.dump) { + return + } + + // 1. If one or more bytes have been transmitted from response’s + // message body, then: + + // 1. Let bytes be the transmitted bytes. + const bytes = chunk + + // 2. Let codings be the result of extracting header list values + // given `Content-Encoding` and response’s header list. + // See pullAlgorithm. + + // 3. Increase timingInfo’s encoded body size by bytes’s length. + timingInfo.encodedBodySize += bytes.byteLength + + // 4. See pullAlgorithm... + + return this.body.push(bytes) + }, + + onComplete () { + if (this.abort) { + fetchParams.controller.off('terminated', this.abort) + } + + fetchParams.controller.ended = true + + this.body.push(null) + }, + + onError (error) { + if (this.abort) { + fetchParams.controller.off('terminated', this.abort) + } + + this.body?.destroy(error) + + fetchParams.controller.terminate(error) + + reject(error) + }, + + onUpgrade (status, headersList, socket) { + if (status !== 101) { + return + } + + const headers = new Headers() + + for (let n = 0; n < headersList.length; n += 2) { + const key = headersList[n + 0].toString('latin1') + const val = headersList[n + 1].toString('latin1') + + headers.append(key, val) + } + + resolve({ + status, + statusText: STATUS_CODES[status], + headersList: headers[kHeadersList], + socket + }) + + return true + } + } + )) + } +} + +module.exports = { + fetch, + Fetch, + fetching, + finalizeAndReportTiming +} + + +/***/ }), + +/***/ 8359: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +/* globals AbortController */ + + + +const { extractBody, mixinBody, cloneBody } = __nccwpck_require__(9990) +const { Headers, fill: fillHeaders, HeadersList } = __nccwpck_require__(554) +const { FinalizationRegistry } = __nccwpck_require__(6436)() +const util = __nccwpck_require__(3983) +const { + isValidHTTPToken, + sameOrigin, + normalizeMethod, + makePolicyContainer +} = __nccwpck_require__(2538) +const { + forbiddenMethods, + corsSafeListedMethods, + referrerPolicy, + requestRedirect, + requestMode, + requestCredentials, + requestCache, + requestDuplex +} = __nccwpck_require__(1037) +const { kEnumerableProperty } = util +const { kHeaders, kSignal, kState, kGuard, kRealm } = __nccwpck_require__(5861) +const { webidl } = __nccwpck_require__(1744) +const { getGlobalOrigin } = __nccwpck_require__(1246) +const { URLSerializer } = __nccwpck_require__(685) +const { kHeadersList } = __nccwpck_require__(2785) +const assert = __nccwpck_require__(9491) +const { getMaxListeners, setMaxListeners, getEventListeners, defaultMaxListeners } = __nccwpck_require__(2361) + +let TransformStream = globalThis.TransformStream + +const kInit = Symbol('init') +const kAbortController = Symbol('abortController') + +const requestFinalizer = new FinalizationRegistry(({ signal, abort }) => { + signal.removeEventListener('abort', abort) +}) + +// https://fetch.spec.whatwg.org/#request-class +class Request { + // https://fetch.spec.whatwg.org/#dom-request + constructor (input, init = {}) { + if (input === kInit) { + return + } + + webidl.argumentLengthCheck(arguments, 1, { header: 'Request constructor' }) + + input = webidl.converters.RequestInfo(input) + init = webidl.converters.RequestInit(init) + + // https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object + this[kRealm] = { + settingsObject: { + baseUrl: getGlobalOrigin(), + get origin () { + return this.baseUrl?.origin + }, + policyContainer: makePolicyContainer() + } + } + + // 1. Let request be null. + let request = null + + // 2. Let fallbackMode be null. + let fallbackMode = null + + // 3. Let baseURL be this’s relevant settings object’s API base URL. + const baseUrl = this[kRealm].settingsObject.baseUrl + + // 4. Let signal be null. + let signal = null + + // 5. If input is a string, then: + if (typeof input === 'string') { + // 1. Let parsedURL be the result of parsing input with baseURL. + // 2. If parsedURL is failure, then throw a TypeError. + let parsedURL + try { + parsedURL = new URL(input, baseUrl) + } catch (err) { + throw new TypeError('Failed to parse URL from ' + input, { cause: err }) + } + + // 3. If parsedURL includes credentials, then throw a TypeError. + if (parsedURL.username || parsedURL.password) { + throw new TypeError( + 'Request cannot be constructed from a URL that includes credentials: ' + + input + ) + } + + // 4. Set request to a new request whose URL is parsedURL. + request = makeRequest({ urlList: [parsedURL] }) + + // 5. Set fallbackMode to "cors". + fallbackMode = 'cors' + } else { + // 6. Otherwise: + + // 7. Assert: input is a Request object. + assert(input instanceof Request) + + // 8. Set request to input’s request. + request = input[kState] + + // 9. Set signal to input’s signal. + signal = input[kSignal] + } + + // 7. Let origin be this’s relevant settings object’s origin. + const origin = this[kRealm].settingsObject.origin + + // 8. Let window be "client". + let window = 'client' + + // 9. If request’s window is an environment settings object and its origin + // is same origin with origin, then set window to request’s window. + if ( + request.window?.constructor?.name === 'EnvironmentSettingsObject' && + sameOrigin(request.window, origin) + ) { + window = request.window + } + + // 10. If init["window"] exists and is non-null, then throw a TypeError. + if (init.window != null) { + throw new TypeError(`'window' option '${window}' must be null`) + } + + // 11. If init["window"] exists, then set window to "no-window". + if ('window' in init) { + window = 'no-window' + } + + // 12. Set request to a new request with the following properties: + request = makeRequest({ + // URL request’s URL. + // undici implementation note: this is set as the first item in request's urlList in makeRequest + // method request’s method. + method: request.method, + // header list A copy of request’s header list. + // undici implementation note: headersList is cloned in makeRequest + headersList: request.headersList, + // unsafe-request flag Set. + unsafeRequest: request.unsafeRequest, + // client This’s relevant settings object. + client: this[kRealm].settingsObject, + // window window. + window, + // priority request’s priority. + priority: request.priority, + // origin request’s origin. The propagation of the origin is only significant for navigation requests + // being handled by a service worker. In this scenario a request can have an origin that is different + // from the current client. + origin: request.origin, + // referrer request’s referrer. + referrer: request.referrer, + // referrer policy request’s referrer policy. + referrerPolicy: request.referrerPolicy, + // mode request’s mode. + mode: request.mode, + // credentials mode request’s credentials mode. + credentials: request.credentials, + // cache mode request’s cache mode. + cache: request.cache, + // redirect mode request’s redirect mode. + redirect: request.redirect, + // integrity metadata request’s integrity metadata. + integrity: request.integrity, + // keepalive request’s keepalive. + keepalive: request.keepalive, + // reload-navigation flag request’s reload-navigation flag. + reloadNavigation: request.reloadNavigation, + // history-navigation flag request’s history-navigation flag. + historyNavigation: request.historyNavigation, + // URL list A clone of request’s URL list. + urlList: [...request.urlList] + }) + + // 13. If init is not empty, then: + if (Object.keys(init).length > 0) { + // 1. If request’s mode is "navigate", then set it to "same-origin". + if (request.mode === 'navigate') { + request.mode = 'same-origin' + } + + // 2. Unset request’s reload-navigation flag. + request.reloadNavigation = false + + // 3. Unset request’s history-navigation flag. + request.historyNavigation = false + + // 4. Set request’s origin to "client". + request.origin = 'client' + + // 5. Set request’s referrer to "client" + request.referrer = 'client' + + // 6. Set request’s referrer policy to the empty string. + request.referrerPolicy = '' + + // 7. Set request’s URL to request’s current URL. + request.url = request.urlList[request.urlList.length - 1] + + // 8. Set request’s URL list to « request’s URL ». + request.urlList = [request.url] + } + + // 14. If init["referrer"] exists, then: + if (init.referrer !== undefined) { + // 1. Let referrer be init["referrer"]. + const referrer = init.referrer + + // 2. If referrer is the empty string, then set request’s referrer to "no-referrer". + if (referrer === '') { + request.referrer = 'no-referrer' + } else { + // 1. Let parsedReferrer be the result of parsing referrer with + // baseURL. + // 2. If parsedReferrer is failure, then throw a TypeError. + let parsedReferrer + try { + parsedReferrer = new URL(referrer, baseUrl) + } catch (err) { + throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }) + } + + // 3. If one of the following is true + // - parsedReferrer’s scheme is "about" and path is the string "client" + // - parsedReferrer’s origin is not same origin with origin + // then set request’s referrer to "client". + if ( + (parsedReferrer.protocol === 'about:' && parsedReferrer.hostname === 'client') || + (origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) + ) { + request.referrer = 'client' + } else { + // 4. Otherwise, set request’s referrer to parsedReferrer. + request.referrer = parsedReferrer + } + } + } + + // 15. If init["referrerPolicy"] exists, then set request’s referrer policy + // to it. + if (init.referrerPolicy !== undefined) { + request.referrerPolicy = init.referrerPolicy + } + + // 16. Let mode be init["mode"] if it exists, and fallbackMode otherwise. + let mode + if (init.mode !== undefined) { + mode = init.mode + } else { + mode = fallbackMode + } + + // 17. If mode is "navigate", then throw a TypeError. + if (mode === 'navigate') { + throw webidl.errors.exception({ + header: 'Request constructor', + message: 'invalid request mode navigate.' + }) + } + + // 18. If mode is non-null, set request’s mode to mode. + if (mode != null) { + request.mode = mode + } + + // 19. If init["credentials"] exists, then set request’s credentials mode + // to it. + if (init.credentials !== undefined) { + request.credentials = init.credentials + } + + // 18. If init["cache"] exists, then set request’s cache mode to it. + if (init.cache !== undefined) { + request.cache = init.cache + } + + // 21. If request’s cache mode is "only-if-cached" and request’s mode is + // not "same-origin", then throw a TypeError. + if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') { + throw new TypeError( + "'only-if-cached' can be set only with 'same-origin' mode" + ) + } + + // 22. If init["redirect"] exists, then set request’s redirect mode to it. + if (init.redirect !== undefined) { + request.redirect = init.redirect + } + + // 23. If init["integrity"] exists, then set request’s integrity metadata to it. + if (init.integrity !== undefined && init.integrity != null) { + request.integrity = String(init.integrity) + } + + // 24. If init["keepalive"] exists, then set request’s keepalive to it. + if (init.keepalive !== undefined) { + request.keepalive = Boolean(init.keepalive) + } + + // 25. If init["method"] exists, then: + if (init.method !== undefined) { + // 1. Let method be init["method"]. + let method = init.method + + // 2. If method is not a method or method is a forbidden method, then + // throw a TypeError. + if (!isValidHTTPToken(init.method)) { + throw TypeError(`'${init.method}' is not a valid HTTP method.`) + } + + if (forbiddenMethods.indexOf(method.toUpperCase()) !== -1) { + throw TypeError(`'${init.method}' HTTP method is unsupported.`) + } + + // 3. Normalize method. + method = normalizeMethod(init.method) + + // 4. Set request’s method to method. + request.method = method + } + + // 26. If init["signal"] exists, then set signal to it. + if (init.signal !== undefined) { + signal = init.signal + } + + // 27. Set this’s request to request. + this[kState] = request + + // 28. Set this’s signal to a new AbortSignal object with this’s relevant + // Realm. + // TODO: could this be simplified with AbortSignal.any + // (https://dom.spec.whatwg.org/#dom-abortsignal-any) + const ac = new AbortController() + this[kSignal] = ac.signal + this[kSignal][kRealm] = this[kRealm] + + // 29. If signal is not null, then make this’s signal follow signal. + if (signal != null) { + if ( + !signal || + typeof signal.aborted !== 'boolean' || + typeof signal.addEventListener !== 'function' + ) { + throw new TypeError( + "Failed to construct 'Request': member signal is not of type AbortSignal." + ) + } + + if (signal.aborted) { + ac.abort(signal.reason) + } else { + // Keep a strong ref to ac while request object + // is alive. This is needed to prevent AbortController + // from being prematurely garbage collected. + // See, https://github.com/nodejs/undici/issues/1926. + this[kAbortController] = ac + + const acRef = new WeakRef(ac) + const abort = function () { + const ac = acRef.deref() + if (ac !== undefined) { + ac.abort(this.reason) + } + } + + // Third-party AbortControllers may not work with these. + // See, https://github.com/nodejs/undici/pull/1910#issuecomment-1464495619. + try { + // If the max amount of listeners is equal to the default, increase it + // This is only available in node >= v19.9.0 + if (typeof getMaxListeners === 'function' && getMaxListeners(signal) === defaultMaxListeners) { + setMaxListeners(100, signal) + } else if (getEventListeners(signal, 'abort').length >= defaultMaxListeners) { + setMaxListeners(100, signal) + } + } catch {} + + util.addAbortListener(signal, abort) + requestFinalizer.register(ac, { signal, abort }) + } + } + + // 30. Set this’s headers to a new Headers object with this’s relevant + // Realm, whose header list is request’s header list and guard is + // "request". + this[kHeaders] = new Headers() + this[kHeaders][kHeadersList] = request.headersList + this[kHeaders][kGuard] = 'request' + this[kHeaders][kRealm] = this[kRealm] + + // 31. If this’s request’s mode is "no-cors", then: + if (mode === 'no-cors') { + // 1. If this’s request’s method is not a CORS-safelisted method, + // then throw a TypeError. + if (!corsSafeListedMethods.includes(request.method)) { + throw new TypeError( + `'${request.method} is unsupported in no-cors mode.` + ) + } + + // 2. Set this’s headers’s guard to "request-no-cors". + this[kHeaders][kGuard] = 'request-no-cors' + } + + // 32. If init is not empty, then: + if (Object.keys(init).length !== 0) { + // 1. Let headers be a copy of this’s headers and its associated header + // list. + let headers = new Headers(this[kHeaders]) + + // 2. If init["headers"] exists, then set headers to init["headers"]. + if (init.headers !== undefined) { + headers = init.headers + } + + // 3. Empty this’s headers’s header list. + this[kHeaders][kHeadersList].clear() + + // 4. If headers is a Headers object, then for each header in its header + // list, append header’s name/header’s value to this’s headers. + if (headers.constructor.name === 'Headers') { + for (const [key, val] of headers) { + this[kHeaders].append(key, val) + } + } else { + // 5. Otherwise, fill this’s headers with headers. + fillHeaders(this[kHeaders], headers) + } + } + + // 33. Let inputBody be input’s request’s body if input is a Request + // object; otherwise null. + const inputBody = input instanceof Request ? input[kState].body : null + + // 34. If either init["body"] exists and is non-null or inputBody is + // non-null, and request’s method is `GET` or `HEAD`, then throw a + // TypeError. + if ( + (init.body != null || inputBody != null) && + (request.method === 'GET' || request.method === 'HEAD') + ) { + throw new TypeError('Request with GET/HEAD method cannot have body.') + } + + // 35. Let initBody be null. + let initBody = null + + // 36. If init["body"] exists and is non-null, then: + if (init.body != null) { + // 1. Let Content-Type be null. + // 2. Set initBody and Content-Type to the result of extracting + // init["body"], with keepalive set to request’s keepalive. + const [extractedBody, contentType] = extractBody( + init.body, + request.keepalive + ) + initBody = extractedBody + + // 3, If Content-Type is non-null and this’s headers’s header list does + // not contain `Content-Type`, then append `Content-Type`/Content-Type to + // this’s headers. + if (contentType && !this[kHeaders][kHeadersList].contains('content-type')) { + this[kHeaders].append('content-type', contentType) + } + } + + // 37. Let inputOrInitBody be initBody if it is non-null; otherwise + // inputBody. + const inputOrInitBody = initBody ?? inputBody + + // 38. If inputOrInitBody is non-null and inputOrInitBody’s source is + // null, then: + if (inputOrInitBody != null && inputOrInitBody.source == null) { + // 1. If initBody is non-null and init["duplex"] does not exist, + // then throw a TypeError. + if (initBody != null && init.duplex == null) { + throw new TypeError('RequestInit: duplex option is required when sending a body.') + } + + // 2. If this’s request’s mode is neither "same-origin" nor "cors", + // then throw a TypeError. + if (request.mode !== 'same-origin' && request.mode !== 'cors') { + throw new TypeError( + 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' + ) + } + + // 3. Set this’s request’s use-CORS-preflight flag. + request.useCORSPreflightFlag = true + } + + // 39. Let finalBody be inputOrInitBody. + let finalBody = inputOrInitBody + + // 40. If initBody is null and inputBody is non-null, then: + if (initBody == null && inputBody != null) { + // 1. If input is unusable, then throw a TypeError. + if (util.isDisturbed(inputBody.stream) || inputBody.stream.locked) { + throw new TypeError( + 'Cannot construct a Request with a Request object that has already been used.' + ) + } + + // 2. Set finalBody to the result of creating a proxy for inputBody. + if (!TransformStream) { + TransformStream = (__nccwpck_require__(5356).TransformStream) + } + + // https://streams.spec.whatwg.org/#readablestream-create-a-proxy + const identityTransform = new TransformStream() + inputBody.stream.pipeThrough(identityTransform) + finalBody = { + source: inputBody.source, + length: inputBody.length, + stream: identityTransform.readable + } + } + + // 41. Set this’s request’s body to finalBody. + this[kState].body = finalBody + } + + // Returns request’s HTTP method, which is "GET" by default. + get method () { + webidl.brandCheck(this, Request) + + // The method getter steps are to return this’s request’s method. + return this[kState].method + } + + // Returns the URL of request as a string. + get url () { + webidl.brandCheck(this, Request) + + // The url getter steps are to return this’s request’s URL, serialized. + return URLSerializer(this[kState].url) + } + + // Returns a Headers object consisting of the headers associated with request. + // Note that headers added in the network layer by the user agent will not + // be accounted for in this object, e.g., the "Host" header. + get headers () { + webidl.brandCheck(this, Request) + + // The headers getter steps are to return this’s headers. + return this[kHeaders] + } + + // Returns the kind of resource requested by request, e.g., "document" + // or "script". + get destination () { + webidl.brandCheck(this, Request) + + // The destination getter are to return this’s request’s destination. + return this[kState].destination + } + + // Returns the referrer of request. Its value can be a same-origin URL if + // explicitly set in init, the empty string to indicate no referrer, and + // "about:client" when defaulting to the global’s default. This is used + // during fetching to determine the value of the `Referer` header of the + // request being made. + get referrer () { + webidl.brandCheck(this, Request) + + // 1. If this’s request’s referrer is "no-referrer", then return the + // empty string. + if (this[kState].referrer === 'no-referrer') { + return '' + } + + // 2. If this’s request’s referrer is "client", then return + // "about:client". + if (this[kState].referrer === 'client') { + return 'about:client' + } + + // Return this’s request’s referrer, serialized. + return this[kState].referrer.toString() + } + + // Returns the referrer policy associated with request. + // This is used during fetching to compute the value of the request’s + // referrer. + get referrerPolicy () { + webidl.brandCheck(this, Request) + + // The referrerPolicy getter steps are to return this’s request’s referrer policy. + return this[kState].referrerPolicy + } + + // Returns the mode associated with request, which is a string indicating + // whether the request will use CORS, or will be restricted to same-origin + // URLs. + get mode () { + webidl.brandCheck(this, Request) + + // The mode getter steps are to return this’s request’s mode. + return this[kState].mode + } + + // Returns the credentials mode associated with request, + // which is a string indicating whether credentials will be sent with the + // request always, never, or only when sent to a same-origin URL. + get credentials () { + // The credentials getter steps are to return this’s request’s credentials mode. + return this[kState].credentials + } + + // Returns the cache mode associated with request, + // which is a string indicating how the request will + // interact with the browser’s cache when fetching. + get cache () { + webidl.brandCheck(this, Request) + + // The cache getter steps are to return this’s request’s cache mode. + return this[kState].cache + } + + // Returns the redirect mode associated with request, + // which is a string indicating how redirects for the + // request will be handled during fetching. A request + // will follow redirects by default. + get redirect () { + webidl.brandCheck(this, Request) + + // The redirect getter steps are to return this’s request’s redirect mode. + return this[kState].redirect + } + + // Returns request’s subresource integrity metadata, which is a + // cryptographic hash of the resource being fetched. Its value + // consists of multiple hashes separated by whitespace. [SRI] + get integrity () { + webidl.brandCheck(this, Request) + + // The integrity getter steps are to return this’s request’s integrity + // metadata. + return this[kState].integrity + } + + // Returns a boolean indicating whether or not request can outlive the + // global in which it was created. + get keepalive () { + webidl.brandCheck(this, Request) + + // The keepalive getter steps are to return this’s request’s keepalive. + return this[kState].keepalive + } + + // Returns a boolean indicating whether or not request is for a reload + // navigation. + get isReloadNavigation () { + webidl.brandCheck(this, Request) + + // The isReloadNavigation getter steps are to return true if this’s + // request’s reload-navigation flag is set; otherwise false. + return this[kState].reloadNavigation + } + + // Returns a boolean indicating whether or not request is for a history + // navigation (a.k.a. back-foward navigation). + get isHistoryNavigation () { + webidl.brandCheck(this, Request) + + // The isHistoryNavigation getter steps are to return true if this’s request’s + // history-navigation flag is set; otherwise false. + return this[kState].historyNavigation + } + + // Returns the signal associated with request, which is an AbortSignal + // object indicating whether or not request has been aborted, and its + // abort event handler. + get signal () { + webidl.brandCheck(this, Request) + + // The signal getter steps are to return this’s signal. + return this[kSignal] + } + + get body () { + webidl.brandCheck(this, Request) + + return this[kState].body ? this[kState].body.stream : null + } + + get bodyUsed () { + webidl.brandCheck(this, Request) + + return !!this[kState].body && util.isDisturbed(this[kState].body.stream) + } + + get duplex () { + webidl.brandCheck(this, Request) + + return 'half' + } + + // Returns a clone of request. + clone () { + webidl.brandCheck(this, Request) + + // 1. If this is unusable, then throw a TypeError. + if (this.bodyUsed || this.body?.locked) { + throw new TypeError('unusable') + } + + // 2. Let clonedRequest be the result of cloning this’s request. + const clonedRequest = cloneRequest(this[kState]) + + // 3. Let clonedRequestObject be the result of creating a Request object, + // given clonedRequest, this’s headers’s guard, and this’s relevant Realm. + const clonedRequestObject = new Request(kInit) + clonedRequestObject[kState] = clonedRequest + clonedRequestObject[kRealm] = this[kRealm] + clonedRequestObject[kHeaders] = new Headers() + clonedRequestObject[kHeaders][kHeadersList] = clonedRequest.headersList + clonedRequestObject[kHeaders][kGuard] = this[kHeaders][kGuard] + clonedRequestObject[kHeaders][kRealm] = this[kHeaders][kRealm] + + // 4. Make clonedRequestObject’s signal follow this’s signal. + const ac = new AbortController() + if (this.signal.aborted) { + ac.abort(this.signal.reason) + } else { + util.addAbortListener( + this.signal, + () => { + ac.abort(this.signal.reason) + } + ) + } + clonedRequestObject[kSignal] = ac.signal + + // 4. Return clonedRequestObject. + return clonedRequestObject + } +} + +mixinBody(Request) + +function makeRequest (init) { + // https://fetch.spec.whatwg.org/#requests + const request = { + method: 'GET', + localURLsOnly: false, + unsafeRequest: false, + body: null, + client: null, + reservedClient: null, + replacesClientId: '', + window: 'client', + keepalive: false, + serviceWorkers: 'all', + initiator: '', + destination: '', + priority: null, + origin: 'client', + policyContainer: 'client', + referrer: 'client', + referrerPolicy: '', + mode: 'no-cors', + useCORSPreflightFlag: false, + credentials: 'same-origin', + useCredentials: false, + cache: 'default', + redirect: 'follow', + integrity: '', + cryptoGraphicsNonceMetadata: '', + parserMetadata: '', + reloadNavigation: false, + historyNavigation: false, + userActivation: false, + taintedOrigin: false, + redirectCount: 0, + responseTainting: 'basic', + preventNoCacheCacheControlHeaderModification: false, + done: false, + timingAllowFailed: false, + ...init, + headersList: init.headersList + ? new HeadersList(init.headersList) + : new HeadersList() + } + request.url = request.urlList[0] + return request +} + +// https://fetch.spec.whatwg.org/#concept-request-clone +function cloneRequest (request) { + // To clone a request request, run these steps: + + // 1. Let newRequest be a copy of request, except for its body. + const newRequest = makeRequest({ ...request, body: null }) + + // 2. If request’s body is non-null, set newRequest’s body to the + // result of cloning request’s body. + if (request.body != null) { + newRequest.body = cloneBody(request.body) + } + + // 3. Return newRequest. + return newRequest +} + +Object.defineProperties(Request.prototype, { + method: kEnumerableProperty, + url: kEnumerableProperty, + headers: kEnumerableProperty, + redirect: kEnumerableProperty, + clone: kEnumerableProperty, + signal: kEnumerableProperty, + duplex: kEnumerableProperty, + destination: kEnumerableProperty, + body: kEnumerableProperty, + bodyUsed: kEnumerableProperty, + isHistoryNavigation: kEnumerableProperty, + isReloadNavigation: kEnumerableProperty, + keepalive: kEnumerableProperty, + integrity: kEnumerableProperty, + cache: kEnumerableProperty, + credentials: kEnumerableProperty, + attribute: kEnumerableProperty, + referrerPolicy: kEnumerableProperty, + referrer: kEnumerableProperty, + mode: kEnumerableProperty, + [Symbol.toStringTag]: { + value: 'Request', + configurable: true + } +}) + +webidl.converters.Request = webidl.interfaceConverter( + Request +) + +// https://fetch.spec.whatwg.org/#requestinfo +webidl.converters.RequestInfo = function (V) { + if (typeof V === 'string') { + return webidl.converters.USVString(V) + } + + if (V instanceof Request) { + return webidl.converters.Request(V) + } + + return webidl.converters.USVString(V) +} + +webidl.converters.AbortSignal = webidl.interfaceConverter( + AbortSignal +) + +// https://fetch.spec.whatwg.org/#requestinit +webidl.converters.RequestInit = webidl.dictionaryConverter([ + { + key: 'method', + converter: webidl.converters.ByteString + }, + { + key: 'headers', + converter: webidl.converters.HeadersInit + }, + { + key: 'body', + converter: webidl.nullableConverter( + webidl.converters.BodyInit + ) + }, + { + key: 'referrer', + converter: webidl.converters.USVString + }, + { + key: 'referrerPolicy', + converter: webidl.converters.DOMString, + // https://w3c.github.io/webappsec-referrer-policy/#referrer-policy + allowedValues: referrerPolicy + }, + { + key: 'mode', + converter: webidl.converters.DOMString, + // https://fetch.spec.whatwg.org/#concept-request-mode + allowedValues: requestMode + }, + { + key: 'credentials', + converter: webidl.converters.DOMString, + // https://fetch.spec.whatwg.org/#requestcredentials + allowedValues: requestCredentials + }, + { + key: 'cache', + converter: webidl.converters.DOMString, + // https://fetch.spec.whatwg.org/#requestcache + allowedValues: requestCache + }, + { + key: 'redirect', + converter: webidl.converters.DOMString, + // https://fetch.spec.whatwg.org/#requestredirect + allowedValues: requestRedirect + }, + { + key: 'integrity', + converter: webidl.converters.DOMString + }, + { + key: 'keepalive', + converter: webidl.converters.boolean + }, + { + key: 'signal', + converter: webidl.nullableConverter( + (signal) => webidl.converters.AbortSignal( + signal, + { strict: false } + ) + ) + }, + { + key: 'window', + converter: webidl.converters.any + }, + { + key: 'duplex', + converter: webidl.converters.DOMString, + allowedValues: requestDuplex + } +]) + +module.exports = { Request, makeRequest } + + +/***/ }), + +/***/ 7823: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { Headers, HeadersList, fill } = __nccwpck_require__(554) +const { extractBody, cloneBody, mixinBody } = __nccwpck_require__(9990) +const util = __nccwpck_require__(3983) +const { kEnumerableProperty } = util +const { + isValidReasonPhrase, + isCancelled, + isAborted, + isBlobLike, + serializeJavascriptValueToJSONString, + isErrorLike, + isomorphicEncode +} = __nccwpck_require__(2538) +const { + redirectStatus, + nullBodyStatus, + DOMException +} = __nccwpck_require__(1037) +const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(5861) +const { webidl } = __nccwpck_require__(1744) +const { FormData } = __nccwpck_require__(2015) +const { getGlobalOrigin } = __nccwpck_require__(1246) +const { URLSerializer } = __nccwpck_require__(685) +const { kHeadersList } = __nccwpck_require__(2785) +const assert = __nccwpck_require__(9491) +const { types } = __nccwpck_require__(3837) + +const ReadableStream = globalThis.ReadableStream || (__nccwpck_require__(5356).ReadableStream) + +// https://fetch.spec.whatwg.org/#response-class +class Response { + // Creates network error Response. + static error () { + // TODO + const relevantRealm = { settingsObject: {} } + + // The static error() method steps are to return the result of creating a + // Response object, given a new network error, "immutable", and this’s + // relevant Realm. + const responseObject = new Response() + responseObject[kState] = makeNetworkError() + responseObject[kRealm] = relevantRealm + responseObject[kHeaders][kHeadersList] = responseObject[kState].headersList + responseObject[kHeaders][kGuard] = 'immutable' + responseObject[kHeaders][kRealm] = relevantRealm + return responseObject + } + + // https://fetch.spec.whatwg.org/#dom-response-json + static json (data, init = {}) { + webidl.argumentLengthCheck(arguments, 1, { header: 'Response.json' }) + + if (init !== null) { + init = webidl.converters.ResponseInit(init) + } + + // 1. Let bytes the result of running serialize a JavaScript value to JSON bytes on data. + const bytes = new TextEncoder('utf-8').encode( + serializeJavascriptValueToJSONString(data) + ) + + // 2. Let body be the result of extracting bytes. + const body = extractBody(bytes) + + // 3. Let responseObject be the result of creating a Response object, given a new response, + // "response", and this’s relevant Realm. + const relevantRealm = { settingsObject: {} } + const responseObject = new Response() + responseObject[kRealm] = relevantRealm + responseObject[kHeaders][kGuard] = 'response' + responseObject[kHeaders][kRealm] = relevantRealm + + // 4. Perform initialize a response given responseObject, init, and (body, "application/json"). + initializeResponse(responseObject, init, { body: body[0], type: 'application/json' }) + + // 5. Return responseObject. + return responseObject + } + + // Creates a redirect Response that redirects to url with status status. + static redirect (url, status = 302) { + const relevantRealm = { settingsObject: {} } + + webidl.argumentLengthCheck(arguments, 1, { header: 'Response.redirect' }) + + url = webidl.converters.USVString(url) + status = webidl.converters['unsigned short'](status) + + // 1. Let parsedURL be the result of parsing url with current settings + // object’s API base URL. + // 2. If parsedURL is failure, then throw a TypeError. + // TODO: base-URL? + let parsedURL + try { + parsedURL = new URL(url, getGlobalOrigin()) + } catch (err) { + throw Object.assign(new TypeError('Failed to parse URL from ' + url), { + cause: err + }) + } + + // 3. If status is not a redirect status, then throw a RangeError. + if (!redirectStatus.includes(status)) { + throw new RangeError('Invalid status code ' + status) + } + + // 4. Let responseObject be the result of creating a Response object, + // given a new response, "immutable", and this’s relevant Realm. + const responseObject = new Response() + responseObject[kRealm] = relevantRealm + responseObject[kHeaders][kGuard] = 'immutable' + responseObject[kHeaders][kRealm] = relevantRealm + + // 5. Set responseObject’s response’s status to status. + responseObject[kState].status = status + + // 6. Let value be parsedURL, serialized and isomorphic encoded. + const value = isomorphicEncode(URLSerializer(parsedURL)) + + // 7. Append `Location`/value to responseObject’s response’s header list. + responseObject[kState].headersList.append('location', value) + + // 8. Return responseObject. + return responseObject + } + + // https://fetch.spec.whatwg.org/#dom-response + constructor (body = null, init = {}) { + if (body !== null) { + body = webidl.converters.BodyInit(body) + } + + init = webidl.converters.ResponseInit(init) + + // TODO + this[kRealm] = { settingsObject: {} } + + // 1. Set this’s response to a new response. + this[kState] = makeResponse({}) + + // 2. Set this’s headers to a new Headers object with this’s relevant + // Realm, whose header list is this’s response’s header list and guard + // is "response". + this[kHeaders] = new Headers() + this[kHeaders][kGuard] = 'response' + this[kHeaders][kHeadersList] = this[kState].headersList + this[kHeaders][kRealm] = this[kRealm] + + // 3. Let bodyWithType be null. + let bodyWithType = null + + // 4. If body is non-null, then set bodyWithType to the result of extracting body. + if (body != null) { + const [extractedBody, type] = extractBody(body) + bodyWithType = { body: extractedBody, type } + } + + // 5. Perform initialize a response given this, init, and bodyWithType. + initializeResponse(this, init, bodyWithType) + } + + // Returns response’s type, e.g., "cors". + get type () { + webidl.brandCheck(this, Response) + + // The type getter steps are to return this’s response’s type. + return this[kState].type + } + + // Returns response’s URL, if it has one; otherwise the empty string. + get url () { + webidl.brandCheck(this, Response) + + const urlList = this[kState].urlList + + // The url getter steps are to return the empty string if this’s + // response’s URL is null; otherwise this’s response’s URL, + // serialized with exclude fragment set to true. + const url = urlList[urlList.length - 1] ?? null + + if (url === null) { + return '' + } + + return URLSerializer(url, true) + } + + // Returns whether response was obtained through a redirect. + get redirected () { + webidl.brandCheck(this, Response) + + // The redirected getter steps are to return true if this’s response’s URL + // list has more than one item; otherwise false. + return this[kState].urlList.length > 1 + } + + // Returns response’s status. + get status () { + webidl.brandCheck(this, Response) + + // The status getter steps are to return this’s response’s status. + return this[kState].status + } + + // Returns whether response’s status is an ok status. + get ok () { + webidl.brandCheck(this, Response) + + // The ok getter steps are to return true if this’s response’s status is an + // ok status; otherwise false. + return this[kState].status >= 200 && this[kState].status <= 299 + } + + // Returns response’s status message. + get statusText () { + webidl.brandCheck(this, Response) + + // The statusText getter steps are to return this’s response’s status + // message. + return this[kState].statusText + } + + // Returns response’s headers as Headers. + get headers () { + webidl.brandCheck(this, Response) + + // The headers getter steps are to return this’s headers. + return this[kHeaders] + } + + get body () { + webidl.brandCheck(this, Response) + + return this[kState].body ? this[kState].body.stream : null + } + + get bodyUsed () { + webidl.brandCheck(this, Response) + + return !!this[kState].body && util.isDisturbed(this[kState].body.stream) + } + + // Returns a clone of response. + clone () { + webidl.brandCheck(this, Response) + + // 1. If this is unusable, then throw a TypeError. + if (this.bodyUsed || (this.body && this.body.locked)) { + throw webidl.errors.exception({ + header: 'Response.clone', + message: 'Body has already been consumed.' + }) + } + + // 2. Let clonedResponse be the result of cloning this’s response. + const clonedResponse = cloneResponse(this[kState]) + + // 3. Return the result of creating a Response object, given + // clonedResponse, this’s headers’s guard, and this’s relevant Realm. + const clonedResponseObject = new Response() + clonedResponseObject[kState] = clonedResponse + clonedResponseObject[kRealm] = this[kRealm] + clonedResponseObject[kHeaders][kHeadersList] = clonedResponse.headersList + clonedResponseObject[kHeaders][kGuard] = this[kHeaders][kGuard] + clonedResponseObject[kHeaders][kRealm] = this[kHeaders][kRealm] + + return clonedResponseObject + } +} + +mixinBody(Response) + +Object.defineProperties(Response.prototype, { + type: kEnumerableProperty, + url: kEnumerableProperty, + status: kEnumerableProperty, + ok: kEnumerableProperty, + redirected: kEnumerableProperty, + statusText: kEnumerableProperty, + headers: kEnumerableProperty, + clone: kEnumerableProperty, + body: kEnumerableProperty, + bodyUsed: kEnumerableProperty, + [Symbol.toStringTag]: { + value: 'Response', + configurable: true + } +}) + +Object.defineProperties(Response, { + json: kEnumerableProperty, + redirect: kEnumerableProperty, + error: kEnumerableProperty +}) + +// https://fetch.spec.whatwg.org/#concept-response-clone +function cloneResponse (response) { + // To clone a response response, run these steps: + + // 1. If response is a filtered response, then return a new identical + // filtered response whose internal response is a clone of response’s + // internal response. + if (response.internalResponse) { + return filterResponse( + cloneResponse(response.internalResponse), + response.type + ) + } + + // 2. Let newResponse be a copy of response, except for its body. + const newResponse = makeResponse({ ...response, body: null }) + + // 3. If response’s body is non-null, then set newResponse’s body to the + // result of cloning response’s body. + if (response.body != null) { + newResponse.body = cloneBody(response.body) + } + + // 4. Return newResponse. + return newResponse +} + +function makeResponse (init) { + return { + aborted: false, + rangeRequested: false, + timingAllowPassed: false, + requestIncludesCredentials: false, + type: 'default', + status: 200, + timingInfo: null, + cacheState: '', + statusText: '', + ...init, + headersList: init.headersList + ? new HeadersList(init.headersList) + : new HeadersList(), + urlList: init.urlList ? [...init.urlList] : [] + } +} + +function makeNetworkError (reason) { + const isError = isErrorLike(reason) + return makeResponse({ + type: 'error', + status: 0, + error: isError + ? reason + : new Error(reason ? String(reason) : reason), + aborted: reason && reason.name === 'AbortError' + }) +} + +function makeFilteredResponse (response, state) { + state = { + internalResponse: response, + ...state + } + + return new Proxy(response, { + get (target, p) { + return p in state ? state[p] : target[p] + }, + set (target, p, value) { + assert(!(p in state)) + target[p] = value + return true + } + }) +} + +// https://fetch.spec.whatwg.org/#concept-filtered-response +function filterResponse (response, type) { + // Set response to the following filtered response with response as its + // internal response, depending on request’s response tainting: + if (type === 'basic') { + // A basic filtered response is a filtered response whose type is "basic" + // and header list excludes any headers in internal response’s header list + // whose name is a forbidden response-header name. + + // Note: undici does not implement forbidden response-header names + return makeFilteredResponse(response, { + type: 'basic', + headersList: response.headersList + }) + } else if (type === 'cors') { + // A CORS filtered response is a filtered response whose type is "cors" + // and header list excludes any headers in internal response’s header + // list whose name is not a CORS-safelisted response-header name, given + // internal response’s CORS-exposed header-name list. + + // Note: undici does not implement CORS-safelisted response-header names + return makeFilteredResponse(response, { + type: 'cors', + headersList: response.headersList + }) + } else if (type === 'opaque') { + // An opaque filtered response is a filtered response whose type is + // "opaque", URL list is the empty list, status is 0, status message + // is the empty byte sequence, header list is empty, and body is null. + + return makeFilteredResponse(response, { + type: 'opaque', + urlList: Object.freeze([]), + status: 0, + statusText: '', + body: null + }) + } else if (type === 'opaqueredirect') { + // An opaque-redirect filtered response is a filtered response whose type + // is "opaqueredirect", status is 0, status message is the empty byte + // sequence, header list is empty, and body is null. + + return makeFilteredResponse(response, { + type: 'opaqueredirect', + status: 0, + statusText: '', + headersList: [], + body: null + }) + } else { + assert(false) + } +} + +// https://fetch.spec.whatwg.org/#appropriate-network-error +function makeAppropriateNetworkError (fetchParams, err = null) { + // 1. Assert: fetchParams is canceled. + assert(isCancelled(fetchParams)) + + // 2. Return an aborted network error if fetchParams is aborted; + // otherwise return a network error. + return isAborted(fetchParams) + ? makeNetworkError(Object.assign(new DOMException('The operation was aborted.', 'AbortError'), { cause: err })) + : makeNetworkError(Object.assign(new DOMException('Request was cancelled.'), { cause: err })) +} + +// https://whatpr.org/fetch/1392.html#initialize-a-response +function initializeResponse (response, init, body) { + // 1. If init["status"] is not in the range 200 to 599, inclusive, then + // throw a RangeError. + if (init.status !== null && (init.status < 200 || init.status > 599)) { + throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.') + } + + // 2. If init["statusText"] does not match the reason-phrase token production, + // then throw a TypeError. + if ('statusText' in init && init.statusText != null) { + // See, https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2: + // reason-phrase = *( HTAB / SP / VCHAR / obs-text ) + if (!isValidReasonPhrase(String(init.statusText))) { + throw new TypeError('Invalid statusText') + } + } + + // 3. Set response’s response’s status to init["status"]. + if ('status' in init && init.status != null) { + response[kState].status = init.status + } + + // 4. Set response’s response’s status message to init["statusText"]. + if ('statusText' in init && init.statusText != null) { + response[kState].statusText = init.statusText + } + + // 5. If init["headers"] exists, then fill response’s headers with init["headers"]. + if ('headers' in init && init.headers != null) { + fill(response[kHeaders], init.headers) + } + + // 6. If body was given, then: + if (body) { + // 1. If response's status is a null body status, then throw a TypeError. + if (nullBodyStatus.includes(response.status)) { + throw webidl.errors.exception({ + header: 'Response constructor', + message: 'Invalid response status code ' + response.status + }) + } + + // 2. Set response's body to body's body. + response[kState].body = body.body + + // 3. If body's type is non-null and response's header list does not contain + // `Content-Type`, then append (`Content-Type`, body's type) to response's header list. + if (body.type != null && !response[kState].headersList.contains('Content-Type')) { + response[kState].headersList.append('content-type', body.type) + } + } +} + +webidl.converters.ReadableStream = webidl.interfaceConverter( + ReadableStream +) + +webidl.converters.FormData = webidl.interfaceConverter( + FormData +) + +webidl.converters.URLSearchParams = webidl.interfaceConverter( + URLSearchParams +) + +// https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit +webidl.converters.XMLHttpRequestBodyInit = function (V) { + if (typeof V === 'string') { + return webidl.converters.USVString(V) + } + + if (isBlobLike(V)) { + return webidl.converters.Blob(V, { strict: false }) + } + + if ( + types.isAnyArrayBuffer(V) || + types.isTypedArray(V) || + types.isDataView(V) + ) { + return webidl.converters.BufferSource(V) + } + + if (util.isFormDataLike(V)) { + return webidl.converters.FormData(V, { strict: false }) + } + + if (V instanceof URLSearchParams) { + return webidl.converters.URLSearchParams(V) + } + + return webidl.converters.DOMString(V) +} + +// https://fetch.spec.whatwg.org/#bodyinit +webidl.converters.BodyInit = function (V) { + if (V instanceof ReadableStream) { + return webidl.converters.ReadableStream(V) + } + + // Note: the spec doesn't include async iterables, + // this is an undici extension. + if (V?.[Symbol.asyncIterator]) { + return V + } + + return webidl.converters.XMLHttpRequestBodyInit(V) +} + +webidl.converters.ResponseInit = webidl.dictionaryConverter([ + { + key: 'status', + converter: webidl.converters['unsigned short'], + defaultValue: 200 + }, + { + key: 'statusText', + converter: webidl.converters.ByteString, + defaultValue: '' + }, + { + key: 'headers', + converter: webidl.converters.HeadersInit + } +]) + +module.exports = { + makeNetworkError, + makeResponse, + makeAppropriateNetworkError, + filterResponse, + Response, + cloneResponse +} + + +/***/ }), + +/***/ 5861: +/***/ ((module) => { + +"use strict"; + + +module.exports = { + kUrl: Symbol('url'), + kHeaders: Symbol('headers'), + kSignal: Symbol('signal'), + kState: Symbol('state'), + kGuard: Symbol('guard'), + kRealm: Symbol('realm') +} + + +/***/ }), + +/***/ 2538: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { redirectStatus, badPorts, referrerPolicy: referrerPolicyTokens } = __nccwpck_require__(1037) +const { getGlobalOrigin } = __nccwpck_require__(1246) +const { performance } = __nccwpck_require__(4074) +const { isBlobLike, toUSVString, ReadableStreamFrom } = __nccwpck_require__(3983) +const assert = __nccwpck_require__(9491) +const { isUint8Array } = __nccwpck_require__(4978) + +// https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable +/** @type {import('crypto')|undefined} */ +let crypto + +try { + crypto = __nccwpck_require__(6113) +} catch { + +} + +function responseURL (response) { + // https://fetch.spec.whatwg.org/#responses + // A response has an associated URL. It is a pointer to the last URL + // in response’s URL list and null if response’s URL list is empty. + const urlList = response.urlList + const length = urlList.length + return length === 0 ? null : urlList[length - 1].toString() +} + +// https://fetch.spec.whatwg.org/#concept-response-location-url +function responseLocationURL (response, requestFragment) { + // 1. If response’s status is not a redirect status, then return null. + if (!redirectStatus.includes(response.status)) { + return null + } + + // 2. Let location be the result of extracting header list values given + // `Location` and response’s header list. + let location = response.headersList.get('location') + + // 3. If location is a header value, then set location to the result of + // parsing location with response’s URL. + if (location !== null && isValidHeaderValue(location)) { + location = new URL(location, responseURL(response)) + } + + // 4. If location is a URL whose fragment is null, then set location’s + // fragment to requestFragment. + if (location && !location.hash) { + location.hash = requestFragment + } + + // 5. Return location. + return location +} + +/** @returns {URL} */ +function requestCurrentURL (request) { + return request.urlList[request.urlList.length - 1] +} + +function requestBadPort (request) { + // 1. Let url be request’s current URL. + const url = requestCurrentURL(request) + + // 2. If url’s scheme is an HTTP(S) scheme and url’s port is a bad port, + // then return blocked. + if (urlIsHttpHttpsScheme(url) && badPorts.includes(url.port)) { + return 'blocked' + } + + // 3. Return allowed. + return 'allowed' +} + +function isErrorLike (object) { + return object instanceof Error || ( + object?.constructor?.name === 'Error' || + object?.constructor?.name === 'DOMException' + ) +} + +// Check whether |statusText| is a ByteString and +// matches the Reason-Phrase token production. +// RFC 2616: https://tools.ietf.org/html/rfc2616 +// RFC 7230: https://tools.ietf.org/html/rfc7230 +// "reason-phrase = *( HTAB / SP / VCHAR / obs-text )" +// https://github.com/chromium/chromium/blob/94.0.4604.1/third_party/blink/renderer/core/fetch/response.cc#L116 +function isValidReasonPhrase (statusText) { + for (let i = 0; i < statusText.length; ++i) { + const c = statusText.charCodeAt(i) + if ( + !( + ( + c === 0x09 || // HTAB + (c >= 0x20 && c <= 0x7e) || // SP / VCHAR + (c >= 0x80 && c <= 0xff) + ) // obs-text + ) + ) { + return false + } + } + return true +} + +function isTokenChar (c) { + return !( + c >= 0x7f || + c <= 0x20 || + c === '(' || + c === ')' || + c === '<' || + c === '>' || + c === '@' || + c === ',' || + c === ';' || + c === ':' || + c === '\\' || + c === '"' || + c === '/' || + c === '[' || + c === ']' || + c === '?' || + c === '=' || + c === '{' || + c === '}' + ) +} + +// See RFC 7230, Section 3.2.6. +// https://github.com/chromium/chromium/blob/d7da0240cae77824d1eda25745c4022757499131/third_party/blink/renderer/platform/network/http_parsers.cc#L321 +function isValidHTTPToken (characters) { + if (!characters || typeof characters !== 'string') { + return false + } + for (let i = 0; i < characters.length; ++i) { + const c = characters.charCodeAt(i) + if (c > 0x7f || !isTokenChar(c)) { + return false + } + } + return true +} + +// https://fetch.spec.whatwg.org/#header-name +// https://github.com/chromium/chromium/blob/b3d37e6f94f87d59e44662d6078f6a12de845d17/net/http/http_util.cc#L342 +function isValidHeaderName (potentialValue) { + if (potentialValue.length === 0) { + return false + } + + return isValidHTTPToken(potentialValue) +} + +/** + * @see https://fetch.spec.whatwg.org/#header-value + * @param {string} potentialValue + */ +function isValidHeaderValue (potentialValue) { + // - Has no leading or trailing HTTP tab or space bytes. + // - Contains no 0x00 (NUL) or HTTP newline bytes. + if ( + potentialValue.startsWith('\t') || + potentialValue.startsWith(' ') || + potentialValue.endsWith('\t') || + potentialValue.endsWith(' ') + ) { + return false + } + + if ( + potentialValue.includes('\0') || + potentialValue.includes('\r') || + potentialValue.includes('\n') + ) { + return false + } + + return true +} + +// https://w3c.github.io/webappsec-referrer-policy/#set-requests-referrer-policy-on-redirect +function setRequestReferrerPolicyOnRedirect (request, actualResponse) { + // Given a request request and a response actualResponse, this algorithm + // updates request’s referrer policy according to the Referrer-Policy + // header (if any) in actualResponse. + + // 1. Let policy be the result of executing § 8.1 Parse a referrer policy + // from a Referrer-Policy header on actualResponse. + + // 8.1 Parse a referrer policy from a Referrer-Policy header + // 1. Let policy-tokens be the result of extracting header list values given `Referrer-Policy` and response’s header list. + const { headersList } = actualResponse + // 2. Let policy be the empty string. + // 3. For each token in policy-tokens, if token is a referrer policy and token is not the empty string, then set policy to token. + // 4. Return policy. + const policyHeader = (headersList.get('referrer-policy') ?? '').split(',') + + // Note: As the referrer-policy can contain multiple policies + // separated by comma, we need to loop through all of them + // and pick the first valid one. + // Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy#specify_a_fallback_policy + let policy = '' + if (policyHeader.length > 0) { + // The right-most policy takes precedence. + // The left-most policy is the fallback. + for (let i = policyHeader.length; i !== 0; i--) { + const token = policyHeader[i - 1].trim() + if (referrerPolicyTokens.includes(token)) { + policy = token + break + } + } + } + + // 2. If policy is not the empty string, then set request’s referrer policy to policy. + if (policy !== '') { + request.referrerPolicy = policy + } +} + +// https://fetch.spec.whatwg.org/#cross-origin-resource-policy-check +function crossOriginResourcePolicyCheck () { + // TODO + return 'allowed' +} + +// https://fetch.spec.whatwg.org/#concept-cors-check +function corsCheck () { + // TODO + return 'success' +} + +// https://fetch.spec.whatwg.org/#concept-tao-check +function TAOCheck () { + // TODO + return 'success' +} + +function appendFetchMetadata (httpRequest) { + // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-dest-header + // TODO + + // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-mode-header + + // 1. Assert: r’s url is a potentially trustworthy URL. + // TODO + + // 2. Let header be a Structured Header whose value is a token. + let header = null + + // 3. Set header’s value to r’s mode. + header = httpRequest.mode + + // 4. Set a structured field value `Sec-Fetch-Mode`/header in r’s header list. + httpRequest.headersList.set('sec-fetch-mode', header) + + // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-site-header + // TODO + + // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-user-header + // TODO +} + +// https://fetch.spec.whatwg.org/#append-a-request-origin-header +function appendRequestOriginHeader (request) { + // 1. Let serializedOrigin be the result of byte-serializing a request origin with request. + let serializedOrigin = request.origin + + // 2. If request’s response tainting is "cors" or request’s mode is "websocket", then append (`Origin`, serializedOrigin) to request’s header list. + if (request.responseTainting === 'cors' || request.mode === 'websocket') { + if (serializedOrigin) { + request.headersList.append('origin', serializedOrigin) + } + + // 3. Otherwise, if request’s method is neither `GET` nor `HEAD`, then: + } else if (request.method !== 'GET' && request.method !== 'HEAD') { + // 1. Switch on request’s referrer policy: + switch (request.referrerPolicy) { + case 'no-referrer': + // Set serializedOrigin to `null`. + serializedOrigin = null + break + case 'no-referrer-when-downgrade': + case 'strict-origin': + case 'strict-origin-when-cross-origin': + // If request’s origin is a tuple origin, its scheme is "https", and request’s current URL’s scheme is not "https", then set serializedOrigin to `null`. + if (request.origin && urlHasHttpsScheme(request.origin) && !urlHasHttpsScheme(requestCurrentURL(request))) { + serializedOrigin = null + } + break + case 'same-origin': + // If request’s origin is not same origin with request’s current URL’s origin, then set serializedOrigin to `null`. + if (!sameOrigin(request, requestCurrentURL(request))) { + serializedOrigin = null + } + break + default: + // Do nothing. + } + + if (serializedOrigin) { + // 2. Append (`Origin`, serializedOrigin) to request’s header list. + request.headersList.append('origin', serializedOrigin) + } + } +} + +function coarsenedSharedCurrentTime (crossOriginIsolatedCapability) { + // TODO + return performance.now() +} + +// https://fetch.spec.whatwg.org/#create-an-opaque-timing-info +function createOpaqueTimingInfo (timingInfo) { + return { + startTime: timingInfo.startTime ?? 0, + redirectStartTime: 0, + redirectEndTime: 0, + postRedirectStartTime: timingInfo.startTime ?? 0, + finalServiceWorkerStartTime: 0, + finalNetworkResponseStartTime: 0, + finalNetworkRequestStartTime: 0, + endTime: 0, + encodedBodySize: 0, + decodedBodySize: 0, + finalConnectionTimingInfo: null + } +} + +// https://html.spec.whatwg.org/multipage/origin.html#policy-container +function makePolicyContainer () { + // Note: the fetch spec doesn't make use of embedder policy or CSP list + return { + referrerPolicy: 'strict-origin-when-cross-origin' + } +} + +// https://html.spec.whatwg.org/multipage/origin.html#clone-a-policy-container +function clonePolicyContainer (policyContainer) { + return { + referrerPolicy: policyContainer.referrerPolicy + } +} + +// https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer +function determineRequestsReferrer (request) { + // 1. Let policy be request's referrer policy. + const policy = request.referrerPolicy + + // Note: policy cannot (shouldn't) be null or an empty string. + assert(policy) + + // 2. Let environment be request’s client. + + let referrerSource = null + + // 3. Switch on request’s referrer: + if (request.referrer === 'client') { + // Note: node isn't a browser and doesn't implement document/iframes, + // so we bypass this step and replace it with our own. + + const globalOrigin = getGlobalOrigin() + + if (!globalOrigin || globalOrigin.origin === 'null') { + return 'no-referrer' + } + + // note: we need to clone it as it's mutated + referrerSource = new URL(globalOrigin) + } else if (request.referrer instanceof URL) { + // Let referrerSource be request’s referrer. + referrerSource = request.referrer + } + + // 4. Let request’s referrerURL be the result of stripping referrerSource for + // use as a referrer. + let referrerURL = stripURLForReferrer(referrerSource) + + // 5. Let referrerOrigin be the result of stripping referrerSource for use as + // a referrer, with the origin-only flag set to true. + const referrerOrigin = stripURLForReferrer(referrerSource, true) + + // 6. If the result of serializing referrerURL is a string whose length is + // greater than 4096, set referrerURL to referrerOrigin. + if (referrerURL.toString().length > 4096) { + referrerURL = referrerOrigin + } + + const areSameOrigin = sameOrigin(request, referrerURL) + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && + !isURLPotentiallyTrustworthy(request.url) + + // 8. Execute the switch statements corresponding to the value of policy: + switch (policy) { + case 'origin': return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true) + case 'unsafe-url': return referrerURL + case 'same-origin': + return areSameOrigin ? referrerOrigin : 'no-referrer' + case 'origin-when-cross-origin': + return areSameOrigin ? referrerURL : referrerOrigin + case 'strict-origin-when-cross-origin': { + const currentURL = requestCurrentURL(request) + + // 1. If the origin of referrerURL and the origin of request’s current + // URL are the same, then return referrerURL. + if (sameOrigin(referrerURL, currentURL)) { + return referrerURL + } + + // 2. If referrerURL is a potentially trustworthy URL and request’s + // current URL is not a potentially trustworthy URL, then return no + // referrer. + if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { + return 'no-referrer' + } + + // 3. Return referrerOrigin. + return referrerOrigin + } + case 'strict-origin': // eslint-disable-line + /** + * 1. If referrerURL is a potentially trustworthy URL and + * request’s current URL is not a potentially trustworthy URL, + * then return no referrer. + * 2. Return referrerOrigin + */ + case 'no-referrer-when-downgrade': // eslint-disable-line + /** + * 1. If referrerURL is a potentially trustworthy URL and + * request’s current URL is not a potentially trustworthy URL, + * then return no referrer. + * 2. Return referrerOrigin + */ + + default: // eslint-disable-line + return isNonPotentiallyTrustWorthy ? 'no-referrer' : referrerOrigin + } +} + +/** + * @see https://w3c.github.io/webappsec-referrer-policy/#strip-url + * @param {URL} url + * @param {boolean|undefined} originOnly + */ +function stripURLForReferrer (url, originOnly) { + // 1. Assert: url is a URL. + assert(url instanceof URL) + + // 2. If url’s scheme is a local scheme, then return no referrer. + if (url.protocol === 'file:' || url.protocol === 'about:' || url.protocol === 'blank:') { + return 'no-referrer' + } + + // 3. Set url’s username to the empty string. + url.username = '' + + // 4. Set url’s password to the empty string. + url.password = '' + + // 5. Set url’s fragment to null. + url.hash = '' + + // 6. If the origin-only flag is true, then: + if (originOnly) { + // 1. Set url’s path to « the empty string ». + url.pathname = '' + + // 2. Set url’s query to null. + url.search = '' + } + + // 7. Return url. + return url +} + +function isURLPotentiallyTrustworthy (url) { + if (!(url instanceof URL)) { + return false + } + + // If child of about, return true + if (url.href === 'about:blank' || url.href === 'about:srcdoc') { + return true + } + + // If scheme is data, return true + if (url.protocol === 'data:') return true + + // If file, return true + if (url.protocol === 'file:') return true + + return isOriginPotentiallyTrustworthy(url.origin) + + function isOriginPotentiallyTrustworthy (origin) { + // If origin is explicitly null, return false + if (origin == null || origin === 'null') return false + + const originAsURL = new URL(origin) + + // If secure, return true + if (originAsURL.protocol === 'https:' || originAsURL.protocol === 'wss:') { + return true + } + + // If localhost or variants, return true + if (/^127(?:\.[0-9]+){0,2}\.[0-9]+$|^\[(?:0*:)*?:?0*1\]$/.test(originAsURL.hostname) || + (originAsURL.hostname === 'localhost' || originAsURL.hostname.includes('localhost.')) || + (originAsURL.hostname.endsWith('.localhost'))) { + return true + } + + // If any other, return false + return false + } +} + +/** + * @see https://w3c.github.io/webappsec-subresource-integrity/#does-response-match-metadatalist + * @param {Uint8Array} bytes + * @param {string} metadataList + */ +function bytesMatch (bytes, metadataList) { + // If node is not built with OpenSSL support, we cannot check + // a request's integrity, so allow it by default (the spec will + // allow requests if an invalid hash is given, as precedence). + /* istanbul ignore if: only if node is built with --without-ssl */ + if (crypto === undefined) { + return true + } + + // 1. Let parsedMetadata be the result of parsing metadataList. + const parsedMetadata = parseMetadata(metadataList) + + // 2. If parsedMetadata is no metadata, return true. + if (parsedMetadata === 'no metadata') { + return true + } + + // 3. If parsedMetadata is the empty set, return true. + if (parsedMetadata.length === 0) { + return true + } + + // 4. Let metadata be the result of getting the strongest + // metadata from parsedMetadata. + const list = parsedMetadata.sort((c, d) => d.algo.localeCompare(c.algo)) + // get the strongest algorithm + const strongest = list[0].algo + // get all entries that use the strongest algorithm; ignore weaker + const metadata = list.filter((item) => item.algo === strongest) + + // 5. For each item in metadata: + for (const item of metadata) { + // 1. Let algorithm be the alg component of item. + const algorithm = item.algo + + // 2. Let expectedValue be the val component of item. + let expectedValue = item.hash + + // See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e + // "be liberal with padding". This is annoying, and it's not even in the spec. + + if (expectedValue.endsWith('==')) { + expectedValue = expectedValue.slice(0, -2) + } + + // 3. Let actualValue be the result of applying algorithm to bytes. + let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64') + + if (actualValue.endsWith('==')) { + actualValue = actualValue.slice(0, -2) + } + + // 4. If actualValue is a case-sensitive match for expectedValue, + // return true. + if (actualValue === expectedValue) { + return true + } + + let actualBase64URL = crypto.createHash(algorithm).update(bytes).digest('base64url') + + if (actualBase64URL.endsWith('==')) { + actualBase64URL = actualBase64URL.slice(0, -2) + } + + if (actualBase64URL === expectedValue) { + return true + } + } + + // 6. Return false. + return false +} + +// https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options +// https://www.w3.org/TR/CSP2/#source-list-syntax +// https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1 +const parseHashWithOptions = /((?sha256|sha384|sha512)-(?[A-z0-9+/]{1}.*={0,2}))( +[\x21-\x7e]?)?/i + +/** + * @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata + * @param {string} metadata + */ +function parseMetadata (metadata) { + // 1. Let result be the empty set. + /** @type {{ algo: string, hash: string }[]} */ + const result = [] + + // 2. Let empty be equal to true. + let empty = true + + const supportedHashes = crypto.getHashes() + + // 3. For each token returned by splitting metadata on spaces: + for (const token of metadata.split(' ')) { + // 1. Set empty to false. + empty = false + + // 2. Parse token as a hash-with-options. + const parsedToken = parseHashWithOptions.exec(token) + + // 3. If token does not parse, continue to the next token. + if (parsedToken === null || parsedToken.groups === undefined) { + // Note: Chromium blocks the request at this point, but Firefox + // gives a warning that an invalid integrity was given. The + // correct behavior is to ignore these, and subsequently not + // check the integrity of the resource. + continue + } + + // 4. Let algorithm be the hash-algo component of token. + const algorithm = parsedToken.groups.algo + + // 5. If algorithm is a hash function recognized by the user + // agent, add the parsed token to result. + if (supportedHashes.includes(algorithm.toLowerCase())) { + result.push(parsedToken.groups) + } + } + + // 4. Return no metadata if empty is true, otherwise return result. + if (empty === true) { + return 'no metadata' + } + + return result +} + +// https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request +function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) { + // TODO +} + +/** + * @link {https://html.spec.whatwg.org/multipage/origin.html#same-origin} + * @param {URL} A + * @param {URL} B + */ +function sameOrigin (A, B) { + // 1. If A and B are the same opaque origin, then return true. + if (A.origin === B.origin && A.origin === 'null') { + return true + } + + // 2. If A and B are both tuple origins and their schemes, + // hosts, and port are identical, then return true. + if (A.protocol === B.protocol && A.hostname === B.hostname && A.port === B.port) { + return true + } + + // 3. Return false. + return false +} + +function createDeferredPromise () { + let res + let rej + const promise = new Promise((resolve, reject) => { + res = resolve + rej = reject + }) + + return { promise, resolve: res, reject: rej } +} + +function isAborted (fetchParams) { + return fetchParams.controller.state === 'aborted' +} + +function isCancelled (fetchParams) { + return fetchParams.controller.state === 'aborted' || + fetchParams.controller.state === 'terminated' +} + +// https://fetch.spec.whatwg.org/#concept-method-normalize +function normalizeMethod (method) { + return /^(DELETE|GET|HEAD|OPTIONS|POST|PUT)$/i.test(method) + ? method.toUpperCase() + : method +} + +// https://infra.spec.whatwg.org/#serialize-a-javascript-value-to-a-json-string +function serializeJavascriptValueToJSONString (value) { + // 1. Let result be ? Call(%JSON.stringify%, undefined, « value »). + const result = JSON.stringify(value) + + // 2. If result is undefined, then throw a TypeError. + if (result === undefined) { + throw new TypeError('Value is not JSON serializable') + } + + // 3. Assert: result is a string. + assert(typeof result === 'string') + + // 4. Return result. + return result +} + +// https://tc39.es/ecma262/#sec-%25iteratorprototype%25-object +const esIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())) + +/** + * @see https://webidl.spec.whatwg.org/#dfn-iterator-prototype-object + * @param {() => unknown[]} iterator + * @param {string} name name of the instance + * @param {'key'|'value'|'key+value'} kind + */ +function makeIterator (iterator, name, kind) { + const object = { + index: 0, + kind, + target: iterator + } + + const i = { + next () { + // 1. Let interface be the interface for which the iterator prototype object exists. + + // 2. Let thisValue be the this value. + + // 3. Let object be ? ToObject(thisValue). + + // 4. If object is a platform object, then perform a security + // check, passing: + + // 5. If object is not a default iterator object for interface, + // then throw a TypeError. + if (Object.getPrototypeOf(this) !== i) { + throw new TypeError( + `'next' called on an object that does not implement interface ${name} Iterator.` + ) + } + + // 6. Let index be object’s index. + // 7. Let kind be object’s kind. + // 8. Let values be object’s target's value pairs to iterate over. + const { index, kind, target } = object + const values = target() + + // 9. Let len be the length of values. + const len = values.length + + // 10. If index is greater than or equal to len, then return + // CreateIterResultObject(undefined, true). + if (index >= len) { + return { value: undefined, done: true } + } + + // 11. Let pair be the entry in values at index index. + const pair = values[index] + + // 12. Set object’s index to index + 1. + object.index = index + 1 + + // 13. Return the iterator result for pair and kind. + return iteratorResult(pair, kind) + }, + // The class string of an iterator prototype object for a given interface is the + // result of concatenating the identifier of the interface and the string " Iterator". + [Symbol.toStringTag]: `${name} Iterator` + } + + // The [[Prototype]] internal slot of an iterator prototype object must be %IteratorPrototype%. + Object.setPrototypeOf(i, esIteratorPrototype) + // esIteratorPrototype needs to be the prototype of i + // which is the prototype of an empty object. Yes, it's confusing. + return Object.setPrototypeOf({}, i) +} + +// https://webidl.spec.whatwg.org/#iterator-result +function iteratorResult (pair, kind) { + let result + + // 1. Let result be a value determined by the value of kind: + switch (kind) { + case 'key': { + // 1. Let idlKey be pair’s key. + // 2. Let key be the result of converting idlKey to an + // ECMAScript value. + // 3. result is key. + result = pair[0] + break + } + case 'value': { + // 1. Let idlValue be pair’s value. + // 2. Let value be the result of converting idlValue to + // an ECMAScript value. + // 3. result is value. + result = pair[1] + break + } + case 'key+value': { + // 1. Let idlKey be pair’s key. + // 2. Let idlValue be pair’s value. + // 3. Let key be the result of converting idlKey to an + // ECMAScript value. + // 4. Let value be the result of converting idlValue to + // an ECMAScript value. + // 5. Let array be ! ArrayCreate(2). + // 6. Call ! CreateDataProperty(array, "0", key). + // 7. Call ! CreateDataProperty(array, "1", value). + // 8. result is array. + result = pair + break + } + } + + // 2. Return CreateIterResultObject(result, false). + return { value: result, done: false } +} + +/** + * @see https://fetch.spec.whatwg.org/#body-fully-read + */ +async function fullyReadBody (body, processBody, processBodyError) { + // 1. If taskDestination is null, then set taskDestination to + // the result of starting a new parallel queue. + + // 2. Let successSteps given a byte sequence bytes be to queue a + // fetch task to run processBody given bytes, with taskDestination. + const successSteps = processBody + + // 3. Let errorSteps be to queue a fetch task to run processBodyError, + // with taskDestination. + const errorSteps = processBodyError + + // 4. Let reader be the result of getting a reader for body’s stream. + // If that threw an exception, then run errorSteps with that + // exception and return. + let reader + + try { + reader = body.stream.getReader() + } catch (e) { + errorSteps(e) + return + } + + // 5. Read all bytes from reader, given successSteps and errorSteps. + try { + const result = await readAllBytes(reader) + successSteps(result) + } catch (e) { + errorSteps(e) + } +} + +/** @type {ReadableStream} */ +let ReadableStream = globalThis.ReadableStream + +function isReadableStreamLike (stream) { + if (!ReadableStream) { + ReadableStream = (__nccwpck_require__(5356).ReadableStream) + } + + return stream instanceof ReadableStream || ( + stream[Symbol.toStringTag] === 'ReadableStream' && + typeof stream.tee === 'function' + ) +} + +const MAXIMUM_ARGUMENT_LENGTH = 65535 + +/** + * @see https://infra.spec.whatwg.org/#isomorphic-decode + * @param {number[]|Uint8Array} input + */ +function isomorphicDecode (input) { + // 1. To isomorphic decode a byte sequence input, return a string whose code point + // length is equal to input’s length and whose code points have the same values + // as the values of input’s bytes, in the same order. + + if (input.length < MAXIMUM_ARGUMENT_LENGTH) { + return String.fromCharCode(...input) + } + + return input.reduce((previous, current) => previous + String.fromCharCode(current), '') +} + +/** + * @param {ReadableStreamController} controller + */ +function readableStreamClose (controller) { + try { + controller.close() + } catch (err) { + // TODO: add comment explaining why this error occurs. + if (!err.message.includes('Controller is already closed')) { + throw err + } + } +} + +/** + * @see https://infra.spec.whatwg.org/#isomorphic-encode + * @param {string} input + */ +function isomorphicEncode (input) { + // 1. Assert: input contains no code points greater than U+00FF. + for (let i = 0; i < input.length; i++) { + assert(input.charCodeAt(i) <= 0xFF) + } + + // 2. Return a byte sequence whose length is equal to input’s code + // point length and whose bytes have the same values as the + // values of input’s code points, in the same order + return input +} + +/** + * @see https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes + * @see https://streams.spec.whatwg.org/#read-loop + * @param {ReadableStreamDefaultReader} reader + */ +async function readAllBytes (reader) { + const bytes = [] + let byteLength = 0 + + while (true) { + const { done, value: chunk } = await reader.read() + + if (done) { + // 1. Call successSteps with bytes. + return Buffer.concat(bytes, byteLength) + } + + // 1. If chunk is not a Uint8Array object, call failureSteps + // with a TypeError and abort these steps. + if (!isUint8Array(chunk)) { + throw new TypeError('Received non-Uint8Array chunk') + } + + // 2. Append the bytes represented by chunk to bytes. + bytes.push(chunk) + byteLength += chunk.length + + // 3. Read-loop given reader, bytes, successSteps, and failureSteps. + } +} + +/** + * @see https://fetch.spec.whatwg.org/#is-local + * @param {URL} url + */ +function urlIsLocal (url) { + assert('protocol' in url) // ensure it's a url object + + const protocol = url.protocol + + return protocol === 'about:' || protocol === 'blob:' || protocol === 'data:' +} + +/** + * @param {string|URL} url + */ +function urlHasHttpsScheme (url) { + if (typeof url === 'string') { + return url.startsWith('https:') + } + + return url.protocol === 'https:' +} + +/** + * @see https://fetch.spec.whatwg.org/#http-scheme + * @param {URL} url + */ +function urlIsHttpHttpsScheme (url) { + assert('protocol' in url) // ensure it's a url object + + const protocol = url.protocol + + return protocol === 'http:' || protocol === 'https:' +} + +/** + * Fetch supports node >= 16.8.0, but Object.hasOwn was added in v16.9.0. + */ +const hasOwn = Object.hasOwn || ((dict, key) => Object.prototype.hasOwnProperty.call(dict, key)) + +module.exports = { + isAborted, + isCancelled, + createDeferredPromise, + ReadableStreamFrom, + toUSVString, + tryUpgradeRequestToAPotentiallyTrustworthyURL, + coarsenedSharedCurrentTime, + determineRequestsReferrer, + makePolicyContainer, + clonePolicyContainer, + appendFetchMetadata, + appendRequestOriginHeader, + TAOCheck, + corsCheck, + crossOriginResourcePolicyCheck, + createOpaqueTimingInfo, + setRequestReferrerPolicyOnRedirect, + isValidHTTPToken, + requestBadPort, + requestCurrentURL, + responseURL, + responseLocationURL, + isBlobLike, + isURLPotentiallyTrustworthy, + isValidReasonPhrase, + sameOrigin, + normalizeMethod, + serializeJavascriptValueToJSONString, + makeIterator, + isValidHeaderName, + isValidHeaderValue, + hasOwn, + isErrorLike, + fullyReadBody, + bytesMatch, + isReadableStreamLike, + readableStreamClose, + isomorphicEncode, + isomorphicDecode, + urlIsLocal, + urlHasHttpsScheme, + urlIsHttpHttpsScheme, + readAllBytes +} + + +/***/ }), + +/***/ 1744: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { types } = __nccwpck_require__(3837) +const { hasOwn, toUSVString } = __nccwpck_require__(2538) + +/** @type {import('../../types/webidl').Webidl} */ +const webidl = {} +webidl.converters = {} +webidl.util = {} +webidl.errors = {} + +webidl.errors.exception = function (message) { + return new TypeError(`${message.header}: ${message.message}`) +} + +webidl.errors.conversionFailed = function (context) { + const plural = context.types.length === 1 ? '' : ' one of' + const message = + `${context.argument} could not be converted to` + + `${plural}: ${context.types.join(', ')}.` + + return webidl.errors.exception({ + header: context.prefix, + message + }) +} + +webidl.errors.invalidArgument = function (context) { + return webidl.errors.exception({ + header: context.prefix, + message: `"${context.value}" is an invalid ${context.type}.` + }) +} + +// https://webidl.spec.whatwg.org/#implements +webidl.brandCheck = function (V, I, opts = undefined) { + if (opts?.strict !== false && !(V instanceof I)) { + throw new TypeError('Illegal invocation') + } else { + return V?.[Symbol.toStringTag] === I.prototype[Symbol.toStringTag] + } +} + +webidl.argumentLengthCheck = function ({ length }, min, ctx) { + if (length < min) { + throw webidl.errors.exception({ + message: `${min} argument${min !== 1 ? 's' : ''} required, ` + + `but${length ? ' only' : ''} ${length} found.`, + ...ctx + }) + } +} + +webidl.illegalConstructor = function () { + throw webidl.errors.exception({ + header: 'TypeError', + message: 'Illegal constructor' + }) +} + +// https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values +webidl.util.Type = function (V) { + switch (typeof V) { + case 'undefined': return 'Undefined' + case 'boolean': return 'Boolean' + case 'string': return 'String' + case 'symbol': return 'Symbol' + case 'number': return 'Number' + case 'bigint': return 'BigInt' + case 'function': + case 'object': { + if (V === null) { + return 'Null' + } + + return 'Object' + } + } +} + +// https://webidl.spec.whatwg.org/#abstract-opdef-converttoint +webidl.util.ConvertToInt = function (V, bitLength, signedness, opts = {}) { + let upperBound + let lowerBound + + // 1. If bitLength is 64, then: + if (bitLength === 64) { + // 1. Let upperBound be 2^53 − 1. + upperBound = Math.pow(2, 53) - 1 + + // 2. If signedness is "unsigned", then let lowerBound be 0. + if (signedness === 'unsigned') { + lowerBound = 0 + } else { + // 3. Otherwise let lowerBound be −2^53 + 1. + lowerBound = Math.pow(-2, 53) + 1 + } + } else if (signedness === 'unsigned') { + // 2. Otherwise, if signedness is "unsigned", then: + + // 1. Let lowerBound be 0. + lowerBound = 0 + + // 2. Let upperBound be 2^bitLength − 1. + upperBound = Math.pow(2, bitLength) - 1 + } else { + // 3. Otherwise: + + // 1. Let lowerBound be -2^bitLength − 1. + lowerBound = Math.pow(-2, bitLength) - 1 + + // 2. Let upperBound be 2^bitLength − 1 − 1. + upperBound = Math.pow(2, bitLength - 1) - 1 + } + + // 4. Let x be ? ToNumber(V). + let x = Number(V) + + // 5. If x is −0, then set x to +0. + if (x === 0) { + x = 0 + } + + // 6. If the conversion is to an IDL type associated + // with the [EnforceRange] extended attribute, then: + if (opts.enforceRange === true) { + // 1. If x is NaN, +∞, or −∞, then throw a TypeError. + if ( + Number.isNaN(x) || + x === Number.POSITIVE_INFINITY || + x === Number.NEGATIVE_INFINITY + ) { + throw webidl.errors.exception({ + header: 'Integer conversion', + message: `Could not convert ${V} to an integer.` + }) + } + + // 2. Set x to IntegerPart(x). + x = webidl.util.IntegerPart(x) + + // 3. If x < lowerBound or x > upperBound, then + // throw a TypeError. + if (x < lowerBound || x > upperBound) { + throw webidl.errors.exception({ + header: 'Integer conversion', + message: `Value must be between ${lowerBound}-${upperBound}, got ${x}.` + }) + } + + // 4. Return x. + return x + } + + // 7. If x is not NaN and the conversion is to an IDL + // type associated with the [Clamp] extended + // attribute, then: + if (!Number.isNaN(x) && opts.clamp === true) { + // 1. Set x to min(max(x, lowerBound), upperBound). + x = Math.min(Math.max(x, lowerBound), upperBound) + + // 2. Round x to the nearest integer, choosing the + // even integer if it lies halfway between two, + // and choosing +0 rather than −0. + if (Math.floor(x) % 2 === 0) { + x = Math.floor(x) + } else { + x = Math.ceil(x) + } + + // 3. Return x. + return x + } + + // 8. If x is NaN, +0, +∞, or −∞, then return +0. + if ( + Number.isNaN(x) || + (x === 0 && Object.is(0, x)) || + x === Number.POSITIVE_INFINITY || + x === Number.NEGATIVE_INFINITY + ) { + return 0 + } + + // 9. Set x to IntegerPart(x). + x = webidl.util.IntegerPart(x) + + // 10. Set x to x modulo 2^bitLength. + x = x % Math.pow(2, bitLength) + + // 11. If signedness is "signed" and x ≥ 2^bitLength − 1, + // then return x − 2^bitLength. + if (signedness === 'signed' && x >= Math.pow(2, bitLength) - 1) { + return x - Math.pow(2, bitLength) + } + + // 12. Otherwise, return x. + return x +} + +// https://webidl.spec.whatwg.org/#abstract-opdef-integerpart +webidl.util.IntegerPart = function (n) { + // 1. Let r be floor(abs(n)). + const r = Math.floor(Math.abs(n)) + + // 2. If n < 0, then return -1 × r. + if (n < 0) { + return -1 * r + } + + // 3. Otherwise, return r. + return r +} + +// https://webidl.spec.whatwg.org/#es-sequence +webidl.sequenceConverter = function (converter) { + return (V) => { + // 1. If Type(V) is not Object, throw a TypeError. + if (webidl.util.Type(V) !== 'Object') { + throw webidl.errors.exception({ + header: 'Sequence', + message: `Value of type ${webidl.util.Type(V)} is not an Object.` + }) + } + + // 2. Let method be ? GetMethod(V, @@iterator). + /** @type {Generator} */ + const method = V?.[Symbol.iterator]?.() + const seq = [] + + // 3. If method is undefined, throw a TypeError. + if ( + method === undefined || + typeof method.next !== 'function' + ) { + throw webidl.errors.exception({ + header: 'Sequence', + message: 'Object is not an iterator.' + }) + } + + // https://webidl.spec.whatwg.org/#create-sequence-from-iterable + while (true) { + const { done, value } = method.next() + + if (done) { + break + } + + seq.push(converter(value)) + } + + return seq + } +} + +// https://webidl.spec.whatwg.org/#es-to-record +webidl.recordConverter = function (keyConverter, valueConverter) { + return (O) => { + // 1. If Type(O) is not Object, throw a TypeError. + if (webidl.util.Type(O) !== 'Object') { + throw webidl.errors.exception({ + header: 'Record', + message: `Value of type ${webidl.util.Type(O)} is not an Object.` + }) + } + + // 2. Let result be a new empty instance of record. + const result = {} + + if (!types.isProxy(O)) { + // Object.keys only returns enumerable properties + const keys = Object.keys(O) + + for (const key of keys) { + // 1. Let typedKey be key converted to an IDL value of type K. + const typedKey = keyConverter(key) + + // 2. Let value be ? Get(O, key). + // 3. Let typedValue be value converted to an IDL value of type V. + const typedValue = valueConverter(O[key]) + + // 4. Set result[typedKey] to typedValue. + result[typedKey] = typedValue + } + + // 5. Return result. + return result + } + + // 3. Let keys be ? O.[[OwnPropertyKeys]](). + const keys = Reflect.ownKeys(O) + + // 4. For each key of keys. + for (const key of keys) { + // 1. Let desc be ? O.[[GetOwnProperty]](key). + const desc = Reflect.getOwnPropertyDescriptor(O, key) + + // 2. If desc is not undefined and desc.[[Enumerable]] is true: + if (desc?.enumerable) { + // 1. Let typedKey be key converted to an IDL value of type K. + const typedKey = keyConverter(key) + + // 2. Let value be ? Get(O, key). + // 3. Let typedValue be value converted to an IDL value of type V. + const typedValue = valueConverter(O[key]) + + // 4. Set result[typedKey] to typedValue. + result[typedKey] = typedValue + } + } + + // 5. Return result. + return result + } +} + +webidl.interfaceConverter = function (i) { + return (V, opts = {}) => { + if (opts.strict !== false && !(V instanceof i)) { + throw webidl.errors.exception({ + header: i.name, + message: `Expected ${V} to be an instance of ${i.name}.` + }) + } + + return V + } +} + +webidl.dictionaryConverter = function (converters) { + return (dictionary) => { + const type = webidl.util.Type(dictionary) + const dict = {} + + if (type === 'Null' || type === 'Undefined') { + return dict + } else if (type !== 'Object') { + throw webidl.errors.exception({ + header: 'Dictionary', + message: `Expected ${dictionary} to be one of: Null, Undefined, Object.` + }) + } + + for (const options of converters) { + const { key, defaultValue, required, converter } = options + + if (required === true) { + if (!hasOwn(dictionary, key)) { + throw webidl.errors.exception({ + header: 'Dictionary', + message: `Missing required key "${key}".` + }) + } + } + + let value = dictionary[key] + const hasDefault = hasOwn(options, 'defaultValue') + + // Only use defaultValue if value is undefined and + // a defaultValue options was provided. + if (hasDefault && value !== null) { + value = value ?? defaultValue + } + + // A key can be optional and have no default value. + // When this happens, do not perform a conversion, + // and do not assign the key a value. + if (required || hasDefault || value !== undefined) { + value = converter(value) + + if ( + options.allowedValues && + !options.allowedValues.includes(value) + ) { + throw webidl.errors.exception({ + header: 'Dictionary', + message: `${value} is not an accepted type. Expected one of ${options.allowedValues.join(', ')}.` + }) + } + + dict[key] = value + } + } + + return dict + } +} + +webidl.nullableConverter = function (converter) { + return (V) => { + if (V === null) { + return V + } + + return converter(V) + } +} + +// https://webidl.spec.whatwg.org/#es-DOMString +webidl.converters.DOMString = function (V, opts = {}) { + // 1. If V is null and the conversion is to an IDL type + // associated with the [LegacyNullToEmptyString] + // extended attribute, then return the DOMString value + // that represents the empty string. + if (V === null && opts.legacyNullToEmptyString) { + return '' + } + + // 2. Let x be ? ToString(V). + if (typeof V === 'symbol') { + throw new TypeError('Could not convert argument of type symbol to string.') + } + + // 3. Return the IDL DOMString value that represents the + // same sequence of code units as the one the + // ECMAScript String value x represents. + return String(V) +} + +// https://webidl.spec.whatwg.org/#es-ByteString +webidl.converters.ByteString = function (V) { + // 1. Let x be ? ToString(V). + // Note: DOMString converter perform ? ToString(V) + const x = webidl.converters.DOMString(V) + + // 2. If the value of any element of x is greater than + // 255, then throw a TypeError. + for (let index = 0; index < x.length; index++) { + const charCode = x.charCodeAt(index) + + if (charCode > 255) { + throw new TypeError( + 'Cannot convert argument to a ByteString because the character at ' + + `index ${index} has a value of ${charCode} which is greater than 255.` + ) + } + } + + // 3. Return an IDL ByteString value whose length is the + // length of x, and where the value of each element is + // the value of the corresponding element of x. + return x +} + +// https://webidl.spec.whatwg.org/#es-USVString +webidl.converters.USVString = toUSVString + +// https://webidl.spec.whatwg.org/#es-boolean +webidl.converters.boolean = function (V) { + // 1. Let x be the result of computing ToBoolean(V). + const x = Boolean(V) + + // 2. Return the IDL boolean value that is the one that represents + // the same truth value as the ECMAScript Boolean value x. + return x +} + +// https://webidl.spec.whatwg.org/#es-any +webidl.converters.any = function (V) { + return V +} + +// https://webidl.spec.whatwg.org/#es-long-long +webidl.converters['long long'] = function (V) { + // 1. Let x be ? ConvertToInt(V, 64, "signed"). + const x = webidl.util.ConvertToInt(V, 64, 'signed') + + // 2. Return the IDL long long value that represents + // the same numeric value as x. + return x +} + +// https://webidl.spec.whatwg.org/#es-unsigned-long-long +webidl.converters['unsigned long long'] = function (V) { + // 1. Let x be ? ConvertToInt(V, 64, "unsigned"). + const x = webidl.util.ConvertToInt(V, 64, 'unsigned') + + // 2. Return the IDL unsigned long long value that + // represents the same numeric value as x. + return x +} + +// https://webidl.spec.whatwg.org/#es-unsigned-long +webidl.converters['unsigned long'] = function (V) { + // 1. Let x be ? ConvertToInt(V, 32, "unsigned"). + const x = webidl.util.ConvertToInt(V, 32, 'unsigned') + + // 2. Return the IDL unsigned long value that + // represents the same numeric value as x. + return x +} + +// https://webidl.spec.whatwg.org/#es-unsigned-short +webidl.converters['unsigned short'] = function (V, opts) { + // 1. Let x be ? ConvertToInt(V, 16, "unsigned"). + const x = webidl.util.ConvertToInt(V, 16, 'unsigned', opts) + + // 2. Return the IDL unsigned short value that represents + // the same numeric value as x. + return x +} + +// https://webidl.spec.whatwg.org/#idl-ArrayBuffer +webidl.converters.ArrayBuffer = function (V, opts = {}) { + // 1. If Type(V) is not Object, or V does not have an + // [[ArrayBufferData]] internal slot, then throw a + // TypeError. + // see: https://tc39.es/ecma262/#sec-properties-of-the-arraybuffer-instances + // see: https://tc39.es/ecma262/#sec-properties-of-the-sharedarraybuffer-instances + if ( + webidl.util.Type(V) !== 'Object' || + !types.isAnyArrayBuffer(V) + ) { + throw webidl.errors.conversionFailed({ + prefix: `${V}`, + argument: `${V}`, + types: ['ArrayBuffer'] + }) + } + + // 2. If the conversion is not to an IDL type associated + // with the [AllowShared] extended attribute, and + // IsSharedArrayBuffer(V) is true, then throw a + // TypeError. + if (opts.allowShared === false && types.isSharedArrayBuffer(V)) { + throw webidl.errors.exception({ + header: 'ArrayBuffer', + message: 'SharedArrayBuffer is not allowed.' + }) + } + + // 3. If the conversion is not to an IDL type associated + // with the [AllowResizable] extended attribute, and + // IsResizableArrayBuffer(V) is true, then throw a + // TypeError. + // Note: resizable ArrayBuffers are currently a proposal. + + // 4. Return the IDL ArrayBuffer value that is a + // reference to the same object as V. + return V +} + +webidl.converters.TypedArray = function (V, T, opts = {}) { + // 1. Let T be the IDL type V is being converted to. + + // 2. If Type(V) is not Object, or V does not have a + // [[TypedArrayName]] internal slot with a value + // equal to T’s name, then throw a TypeError. + if ( + webidl.util.Type(V) !== 'Object' || + !types.isTypedArray(V) || + V.constructor.name !== T.name + ) { + throw webidl.errors.conversionFailed({ + prefix: `${T.name}`, + argument: `${V}`, + types: [T.name] + }) + } + + // 3. If the conversion is not to an IDL type associated + // with the [AllowShared] extended attribute, and + // IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is + // true, then throw a TypeError. + if (opts.allowShared === false && types.isSharedArrayBuffer(V.buffer)) { + throw webidl.errors.exception({ + header: 'ArrayBuffer', + message: 'SharedArrayBuffer is not allowed.' + }) + } + + // 4. If the conversion is not to an IDL type associated + // with the [AllowResizable] extended attribute, and + // IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is + // true, then throw a TypeError. + // Note: resizable array buffers are currently a proposal + + // 5. Return the IDL value of type T that is a reference + // to the same object as V. + return V +} + +webidl.converters.DataView = function (V, opts = {}) { + // 1. If Type(V) is not Object, or V does not have a + // [[DataView]] internal slot, then throw a TypeError. + if (webidl.util.Type(V) !== 'Object' || !types.isDataView(V)) { + throw webidl.errors.exception({ + header: 'DataView', + message: 'Object is not a DataView.' + }) + } + + // 2. If the conversion is not to an IDL type associated + // with the [AllowShared] extended attribute, and + // IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is true, + // then throw a TypeError. + if (opts.allowShared === false && types.isSharedArrayBuffer(V.buffer)) { + throw webidl.errors.exception({ + header: 'ArrayBuffer', + message: 'SharedArrayBuffer is not allowed.' + }) + } + + // 3. If the conversion is not to an IDL type associated + // with the [AllowResizable] extended attribute, and + // IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is + // true, then throw a TypeError. + // Note: resizable ArrayBuffers are currently a proposal + + // 4. Return the IDL DataView value that is a reference + // to the same object as V. + return V +} + +// https://webidl.spec.whatwg.org/#BufferSource +webidl.converters.BufferSource = function (V, opts = {}) { + if (types.isAnyArrayBuffer(V)) { + return webidl.converters.ArrayBuffer(V, opts) + } + + if (types.isTypedArray(V)) { + return webidl.converters.TypedArray(V, V.constructor) + } + + if (types.isDataView(V)) { + return webidl.converters.DataView(V, opts) + } + + throw new TypeError(`Could not convert ${V} to a BufferSource.`) +} + +webidl.converters['sequence'] = webidl.sequenceConverter( + webidl.converters.ByteString +) + +webidl.converters['sequence>'] = webidl.sequenceConverter( + webidl.converters['sequence'] +) + +webidl.converters['record'] = webidl.recordConverter( + webidl.converters.ByteString, + webidl.converters.ByteString +) + +module.exports = { + webidl +} + + +/***/ }), + +/***/ 4854: +/***/ ((module) => { + +"use strict"; + + +/** + * @see https://encoding.spec.whatwg.org/#concept-encoding-get + * @param {string|undefined} label + */ +function getEncoding (label) { + if (!label) { + return 'failure' + } + + // 1. Remove any leading and trailing ASCII whitespace from label. + // 2. If label is an ASCII case-insensitive match for any of the + // labels listed in the table below, then return the + // corresponding encoding; otherwise return failure. + switch (label.trim().toLowerCase()) { + case 'unicode-1-1-utf-8': + case 'unicode11utf8': + case 'unicode20utf8': + case 'utf-8': + case 'utf8': + case 'x-unicode20utf8': + return 'UTF-8' + case '866': + case 'cp866': + case 'csibm866': + case 'ibm866': + return 'IBM866' + case 'csisolatin2': + case 'iso-8859-2': + case 'iso-ir-101': + case 'iso8859-2': + case 'iso88592': + case 'iso_8859-2': + case 'iso_8859-2:1987': + case 'l2': + case 'latin2': + return 'ISO-8859-2' + case 'csisolatin3': + case 'iso-8859-3': + case 'iso-ir-109': + case 'iso8859-3': + case 'iso88593': + case 'iso_8859-3': + case 'iso_8859-3:1988': + case 'l3': + case 'latin3': + return 'ISO-8859-3' + case 'csisolatin4': + case 'iso-8859-4': + case 'iso-ir-110': + case 'iso8859-4': + case 'iso88594': + case 'iso_8859-4': + case 'iso_8859-4:1988': + case 'l4': + case 'latin4': + return 'ISO-8859-4' + case 'csisolatincyrillic': + case 'cyrillic': + case 'iso-8859-5': + case 'iso-ir-144': + case 'iso8859-5': + case 'iso88595': + case 'iso_8859-5': + case 'iso_8859-5:1988': + return 'ISO-8859-5' + case 'arabic': + case 'asmo-708': + case 'csiso88596e': + case 'csiso88596i': + case 'csisolatinarabic': + case 'ecma-114': + case 'iso-8859-6': + case 'iso-8859-6-e': + case 'iso-8859-6-i': + case 'iso-ir-127': + case 'iso8859-6': + case 'iso88596': + case 'iso_8859-6': + case 'iso_8859-6:1987': + return 'ISO-8859-6' + case 'csisolatingreek': + case 'ecma-118': + case 'elot_928': + case 'greek': + case 'greek8': + case 'iso-8859-7': + case 'iso-ir-126': + case 'iso8859-7': + case 'iso88597': + case 'iso_8859-7': + case 'iso_8859-7:1987': + case 'sun_eu_greek': + return 'ISO-8859-7' + case 'csiso88598e': + case 'csisolatinhebrew': + case 'hebrew': + case 'iso-8859-8': + case 'iso-8859-8-e': + case 'iso-ir-138': + case 'iso8859-8': + case 'iso88598': + case 'iso_8859-8': + case 'iso_8859-8:1988': + case 'visual': + return 'ISO-8859-8' + case 'csiso88598i': + case 'iso-8859-8-i': + case 'logical': + return 'ISO-8859-8-I' + case 'csisolatin6': + case 'iso-8859-10': + case 'iso-ir-157': + case 'iso8859-10': + case 'iso885910': + case 'l6': + case 'latin6': + return 'ISO-8859-10' + case 'iso-8859-13': + case 'iso8859-13': + case 'iso885913': + return 'ISO-8859-13' + case 'iso-8859-14': + case 'iso8859-14': + case 'iso885914': + return 'ISO-8859-14' + case 'csisolatin9': + case 'iso-8859-15': + case 'iso8859-15': + case 'iso885915': + case 'iso_8859-15': + case 'l9': + return 'ISO-8859-15' + case 'iso-8859-16': + return 'ISO-8859-16' + case 'cskoi8r': + case 'koi': + case 'koi8': + case 'koi8-r': + case 'koi8_r': + return 'KOI8-R' + case 'koi8-ru': + case 'koi8-u': + return 'KOI8-U' + case 'csmacintosh': + case 'mac': + case 'macintosh': + case 'x-mac-roman': + return 'macintosh' + case 'iso-8859-11': + case 'iso8859-11': + case 'iso885911': + case 'tis-620': + case 'windows-874': + return 'windows-874' + case 'cp1250': + case 'windows-1250': + case 'x-cp1250': + return 'windows-1250' + case 'cp1251': + case 'windows-1251': + case 'x-cp1251': + return 'windows-1251' + case 'ansi_x3.4-1968': + case 'ascii': + case 'cp1252': + case 'cp819': + case 'csisolatin1': + case 'ibm819': + case 'iso-8859-1': + case 'iso-ir-100': + case 'iso8859-1': + case 'iso88591': + case 'iso_8859-1': + case 'iso_8859-1:1987': + case 'l1': + case 'latin1': + case 'us-ascii': + case 'windows-1252': + case 'x-cp1252': + return 'windows-1252' + case 'cp1253': + case 'windows-1253': + case 'x-cp1253': + return 'windows-1253' + case 'cp1254': + case 'csisolatin5': + case 'iso-8859-9': + case 'iso-ir-148': + case 'iso8859-9': + case 'iso88599': + case 'iso_8859-9': + case 'iso_8859-9:1989': + case 'l5': + case 'latin5': + case 'windows-1254': + case 'x-cp1254': + return 'windows-1254' + case 'cp1255': + case 'windows-1255': + case 'x-cp1255': + return 'windows-1255' + case 'cp1256': + case 'windows-1256': + case 'x-cp1256': + return 'windows-1256' + case 'cp1257': + case 'windows-1257': + case 'x-cp1257': + return 'windows-1257' + case 'cp1258': + case 'windows-1258': + case 'x-cp1258': + return 'windows-1258' + case 'x-mac-cyrillic': + case 'x-mac-ukrainian': + return 'x-mac-cyrillic' + case 'chinese': + case 'csgb2312': + case 'csiso58gb231280': + case 'gb2312': + case 'gb_2312': + case 'gb_2312-80': + case 'gbk': + case 'iso-ir-58': + case 'x-gbk': + return 'GBK' + case 'gb18030': + return 'gb18030' + case 'big5': + case 'big5-hkscs': + case 'cn-big5': + case 'csbig5': + case 'x-x-big5': + return 'Big5' + case 'cseucpkdfmtjapanese': + case 'euc-jp': + case 'x-euc-jp': + return 'EUC-JP' + case 'csiso2022jp': + case 'iso-2022-jp': + return 'ISO-2022-JP' + case 'csshiftjis': + case 'ms932': + case 'ms_kanji': + case 'shift-jis': + case 'shift_jis': + case 'sjis': + case 'windows-31j': + case 'x-sjis': + return 'Shift_JIS' + case 'cseuckr': + case 'csksc56011987': + case 'euc-kr': + case 'iso-ir-149': + case 'korean': + case 'ks_c_5601-1987': + case 'ks_c_5601-1989': + case 'ksc5601': + case 'ksc_5601': + case 'windows-949': + return 'EUC-KR' + case 'csiso2022kr': + case 'hz-gb-2312': + case 'iso-2022-cn': + case 'iso-2022-cn-ext': + case 'iso-2022-kr': + case 'replacement': + return 'replacement' + case 'unicodefffe': + case 'utf-16be': + return 'UTF-16BE' + case 'csunicode': + case 'iso-10646-ucs-2': + case 'ucs-2': + case 'unicode': + case 'unicodefeff': + case 'utf-16': + case 'utf-16le': + return 'UTF-16LE' + case 'x-user-defined': + return 'x-user-defined' + default: return 'failure' + } +} + +module.exports = { + getEncoding +} + + +/***/ }), + +/***/ 1446: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { + staticPropertyDescriptors, + readOperation, + fireAProgressEvent +} = __nccwpck_require__(7530) +const { + kState, + kError, + kResult, + kEvents, + kAborted +} = __nccwpck_require__(9054) +const { webidl } = __nccwpck_require__(1744) +const { kEnumerableProperty } = __nccwpck_require__(3983) + +class FileReader extends EventTarget { + constructor () { + super() + + this[kState] = 'empty' + this[kResult] = null + this[kError] = null + this[kEvents] = { + loadend: null, + error: null, + abort: null, + load: null, + progress: null, + loadstart: null + } + } + + /** + * @see https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer + * @param {import('buffer').Blob} blob + */ + readAsArrayBuffer (blob) { + webidl.brandCheck(this, FileReader) + + webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsArrayBuffer' }) + + blob = webidl.converters.Blob(blob, { strict: false }) + + // The readAsArrayBuffer(blob) method, when invoked, + // must initiate a read operation for blob with ArrayBuffer. + readOperation(this, blob, 'ArrayBuffer') + } + + /** + * @see https://w3c.github.io/FileAPI/#readAsBinaryString + * @param {import('buffer').Blob} blob + */ + readAsBinaryString (blob) { + webidl.brandCheck(this, FileReader) + + webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsBinaryString' }) + + blob = webidl.converters.Blob(blob, { strict: false }) + + // The readAsBinaryString(blob) method, when invoked, + // must initiate a read operation for blob with BinaryString. + readOperation(this, blob, 'BinaryString') + } + + /** + * @see https://w3c.github.io/FileAPI/#readAsDataText + * @param {import('buffer').Blob} blob + * @param {string?} encoding + */ + readAsText (blob, encoding = undefined) { + webidl.brandCheck(this, FileReader) + + webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsText' }) + + blob = webidl.converters.Blob(blob, { strict: false }) + + if (encoding !== undefined) { + encoding = webidl.converters.DOMString(encoding) + } + + // The readAsText(blob, encoding) method, when invoked, + // must initiate a read operation for blob with Text and encoding. + readOperation(this, blob, 'Text', encoding) + } + + /** + * @see https://w3c.github.io/FileAPI/#dfn-readAsDataURL + * @param {import('buffer').Blob} blob + */ + readAsDataURL (blob) { + webidl.brandCheck(this, FileReader) + + webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsDataURL' }) + + blob = webidl.converters.Blob(blob, { strict: false }) + + // The readAsDataURL(blob) method, when invoked, must + // initiate a read operation for blob with DataURL. + readOperation(this, blob, 'DataURL') + } + + /** + * @see https://w3c.github.io/FileAPI/#dfn-abort + */ + abort () { + // 1. If this's state is "empty" or if this's state is + // "done" set this's result to null and terminate + // this algorithm. + if (this[kState] === 'empty' || this[kState] === 'done') { + this[kResult] = null + return + } + + // 2. If this's state is "loading" set this's state to + // "done" and set this's result to null. + if (this[kState] === 'loading') { + this[kState] = 'done' + this[kResult] = null + } + + // 3. If there are any tasks from this on the file reading + // task source in an affiliated task queue, then remove + // those tasks from that task queue. + this[kAborted] = true + + // 4. Terminate the algorithm for the read method being processed. + // TODO + + // 5. Fire a progress event called abort at this. + fireAProgressEvent('abort', this) + + // 6. If this's state is not "loading", fire a progress + // event called loadend at this. + if (this[kState] !== 'loading') { + fireAProgressEvent('loadend', this) + } + } + + /** + * @see https://w3c.github.io/FileAPI/#dom-filereader-readystate + */ + get readyState () { + webidl.brandCheck(this, FileReader) + + switch (this[kState]) { + case 'empty': return this.EMPTY + case 'loading': return this.LOADING + case 'done': return this.DONE + } + } + + /** + * @see https://w3c.github.io/FileAPI/#dom-filereader-result + */ + get result () { + webidl.brandCheck(this, FileReader) + + // The result attribute’s getter, when invoked, must return + // this's result. + return this[kResult] + } + + /** + * @see https://w3c.github.io/FileAPI/#dom-filereader-error + */ + get error () { + webidl.brandCheck(this, FileReader) + + // The error attribute’s getter, when invoked, must return + // this's error. + return this[kError] + } + + get onloadend () { + webidl.brandCheck(this, FileReader) + + return this[kEvents].loadend + } + + set onloadend (fn) { + webidl.brandCheck(this, FileReader) + + if (this[kEvents].loadend) { + this.removeEventListener('loadend', this[kEvents].loadend) + } + + if (typeof fn === 'function') { + this[kEvents].loadend = fn + this.addEventListener('loadend', fn) + } else { + this[kEvents].loadend = null + } + } + + get onerror () { + webidl.brandCheck(this, FileReader) + + return this[kEvents].error + } + + set onerror (fn) { + webidl.brandCheck(this, FileReader) + + if (this[kEvents].error) { + this.removeEventListener('error', this[kEvents].error) + } + + if (typeof fn === 'function') { + this[kEvents].error = fn + this.addEventListener('error', fn) + } else { + this[kEvents].error = null + } + } + + get onloadstart () { + webidl.brandCheck(this, FileReader) + + return this[kEvents].loadstart + } + + set onloadstart (fn) { + webidl.brandCheck(this, FileReader) + + if (this[kEvents].loadstart) { + this.removeEventListener('loadstart', this[kEvents].loadstart) + } + + if (typeof fn === 'function') { + this[kEvents].loadstart = fn + this.addEventListener('loadstart', fn) + } else { + this[kEvents].loadstart = null + } + } + + get onprogress () { + webidl.brandCheck(this, FileReader) + + return this[kEvents].progress + } + + set onprogress (fn) { + webidl.brandCheck(this, FileReader) + + if (this[kEvents].progress) { + this.removeEventListener('progress', this[kEvents].progress) + } + + if (typeof fn === 'function') { + this[kEvents].progress = fn + this.addEventListener('progress', fn) + } else { + this[kEvents].progress = null + } + } + + get onload () { + webidl.brandCheck(this, FileReader) + + return this[kEvents].load + } + + set onload (fn) { + webidl.brandCheck(this, FileReader) + + if (this[kEvents].load) { + this.removeEventListener('load', this[kEvents].load) + } + + if (typeof fn === 'function') { + this[kEvents].load = fn + this.addEventListener('load', fn) + } else { + this[kEvents].load = null + } + } + + get onabort () { + webidl.brandCheck(this, FileReader) + + return this[kEvents].abort + } + + set onabort (fn) { + webidl.brandCheck(this, FileReader) + + if (this[kEvents].abort) { + this.removeEventListener('abort', this[kEvents].abort) + } + + if (typeof fn === 'function') { + this[kEvents].abort = fn + this.addEventListener('abort', fn) + } else { + this[kEvents].abort = null + } + } +} + +// https://w3c.github.io/FileAPI/#dom-filereader-empty +FileReader.EMPTY = FileReader.prototype.EMPTY = 0 +// https://w3c.github.io/FileAPI/#dom-filereader-loading +FileReader.LOADING = FileReader.prototype.LOADING = 1 +// https://w3c.github.io/FileAPI/#dom-filereader-done +FileReader.DONE = FileReader.prototype.DONE = 2 + +Object.defineProperties(FileReader.prototype, { + EMPTY: staticPropertyDescriptors, + LOADING: staticPropertyDescriptors, + DONE: staticPropertyDescriptors, + readAsArrayBuffer: kEnumerableProperty, + readAsBinaryString: kEnumerableProperty, + readAsText: kEnumerableProperty, + readAsDataURL: kEnumerableProperty, + abort: kEnumerableProperty, + readyState: kEnumerableProperty, + result: kEnumerableProperty, + error: kEnumerableProperty, + onloadstart: kEnumerableProperty, + onprogress: kEnumerableProperty, + onload: kEnumerableProperty, + onabort: kEnumerableProperty, + onerror: kEnumerableProperty, + onloadend: kEnumerableProperty, + [Symbol.toStringTag]: { + value: 'FileReader', + writable: false, + enumerable: false, + configurable: true + } +}) + +Object.defineProperties(FileReader, { + EMPTY: staticPropertyDescriptors, + LOADING: staticPropertyDescriptors, + DONE: staticPropertyDescriptors +}) + +module.exports = { + FileReader +} + + +/***/ }), + +/***/ 5504: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { webidl } = __nccwpck_require__(1744) + +const kState = Symbol('ProgressEvent state') + +/** + * @see https://xhr.spec.whatwg.org/#progressevent + */ +class ProgressEvent extends Event { + constructor (type, eventInitDict = {}) { + type = webidl.converters.DOMString(type) + eventInitDict = webidl.converters.ProgressEventInit(eventInitDict ?? {}) + + super(type, eventInitDict) + + this[kState] = { + lengthComputable: eventInitDict.lengthComputable, + loaded: eventInitDict.loaded, + total: eventInitDict.total + } + } + + get lengthComputable () { + webidl.brandCheck(this, ProgressEvent) + + return this[kState].lengthComputable + } + + get loaded () { + webidl.brandCheck(this, ProgressEvent) + + return this[kState].loaded + } + + get total () { + webidl.brandCheck(this, ProgressEvent) + + return this[kState].total + } +} + +webidl.converters.ProgressEventInit = webidl.dictionaryConverter([ + { + key: 'lengthComputable', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'loaded', + converter: webidl.converters['unsigned long long'], + defaultValue: 0 + }, + { + key: 'total', + converter: webidl.converters['unsigned long long'], + defaultValue: 0 + }, + { + key: 'bubbles', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'cancelable', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'composed', + converter: webidl.converters.boolean, + defaultValue: false + } +]) + +module.exports = { + ProgressEvent +} + + +/***/ }), + +/***/ 9054: +/***/ ((module) => { + +"use strict"; + + +module.exports = { + kState: Symbol('FileReader state'), + kResult: Symbol('FileReader result'), + kError: Symbol('FileReader error'), + kLastProgressEventFired: Symbol('FileReader last progress event fired timestamp'), + kEvents: Symbol('FileReader events'), + kAborted: Symbol('FileReader aborted') +} + + +/***/ }), + +/***/ 7530: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { + kState, + kError, + kResult, + kAborted, + kLastProgressEventFired +} = __nccwpck_require__(9054) +const { ProgressEvent } = __nccwpck_require__(5504) +const { getEncoding } = __nccwpck_require__(4854) +const { DOMException } = __nccwpck_require__(1037) +const { serializeAMimeType, parseMIMEType } = __nccwpck_require__(685) +const { types } = __nccwpck_require__(3837) +const { StringDecoder } = __nccwpck_require__(1576) +const { btoa } = __nccwpck_require__(4300) + +/** @type {PropertyDescriptor} */ +const staticPropertyDescriptors = { + enumerable: true, + writable: false, + configurable: false +} + +/** + * @see https://w3c.github.io/FileAPI/#readOperation + * @param {import('./filereader').FileReader} fr + * @param {import('buffer').Blob} blob + * @param {string} type + * @param {string?} encodingName + */ +function readOperation (fr, blob, type, encodingName) { + // 1. If fr’s state is "loading", throw an InvalidStateError + // DOMException. + if (fr[kState] === 'loading') { + throw new DOMException('Invalid state', 'InvalidStateError') + } + + // 2. Set fr’s state to "loading". + fr[kState] = 'loading' + + // 3. Set fr’s result to null. + fr[kResult] = null + + // 4. Set fr’s error to null. + fr[kError] = null + + // 5. Let stream be the result of calling get stream on blob. + /** @type {import('stream/web').ReadableStream} */ + const stream = blob.stream() + + // 6. Let reader be the result of getting a reader from stream. + const reader = stream.getReader() + + // 7. Let bytes be an empty byte sequence. + /** @type {Uint8Array[]} */ + const bytes = [] + + // 8. Let chunkPromise be the result of reading a chunk from + // stream with reader. + let chunkPromise = reader.read() + + // 9. Let isFirstChunk be true. + let isFirstChunk = true + + // 10. In parallel, while true: + // Note: "In parallel" just means non-blocking + // Note 2: readOperation itself cannot be async as double + // reading the body would then reject the promise, instead + // of throwing an error. + ;(async () => { + while (!fr[kAborted]) { + // 1. Wait for chunkPromise to be fulfilled or rejected. + try { + const { done, value } = await chunkPromise + + // 2. If chunkPromise is fulfilled, and isFirstChunk is + // true, queue a task to fire a progress event called + // loadstart at fr. + if (isFirstChunk && !fr[kAborted]) { + queueMicrotask(() => { + fireAProgressEvent('loadstart', fr) + }) + } + + // 3. Set isFirstChunk to false. + isFirstChunk = false + + // 4. If chunkPromise is fulfilled with an object whose + // done property is false and whose value property is + // a Uint8Array object, run these steps: + if (!done && types.isUint8Array(value)) { + // 1. Let bs be the byte sequence represented by the + // Uint8Array object. + + // 2. Append bs to bytes. + bytes.push(value) + + // 3. If roughly 50ms have passed since these steps + // were last invoked, queue a task to fire a + // progress event called progress at fr. + if ( + ( + fr[kLastProgressEventFired] === undefined || + Date.now() - fr[kLastProgressEventFired] >= 50 + ) && + !fr[kAborted] + ) { + fr[kLastProgressEventFired] = Date.now() + queueMicrotask(() => { + fireAProgressEvent('progress', fr) + }) + } + + // 4. Set chunkPromise to the result of reading a + // chunk from stream with reader. + chunkPromise = reader.read() + } else if (done) { + // 5. Otherwise, if chunkPromise is fulfilled with an + // object whose done property is true, queue a task + // to run the following steps and abort this algorithm: + queueMicrotask(() => { + // 1. Set fr’s state to "done". + fr[kState] = 'done' + + // 2. Let result be the result of package data given + // bytes, type, blob’s type, and encodingName. + try { + const result = packageData(bytes, type, blob.type, encodingName) + + // 4. Else: + + if (fr[kAborted]) { + return + } + + // 1. Set fr’s result to result. + fr[kResult] = result + + // 2. Fire a progress event called load at the fr. + fireAProgressEvent('load', fr) + } catch (error) { + // 3. If package data threw an exception error: + + // 1. Set fr’s error to error. + fr[kError] = error + + // 2. Fire a progress event called error at fr. + fireAProgressEvent('error', fr) + } + + // 5. If fr’s state is not "loading", fire a progress + // event called loadend at the fr. + if (fr[kState] !== 'loading') { + fireAProgressEvent('loadend', fr) + } + }) + + break + } + } catch (error) { + if (fr[kAborted]) { + return + } + + // 6. Otherwise, if chunkPromise is rejected with an + // error error, queue a task to run the following + // steps and abort this algorithm: + queueMicrotask(() => { + // 1. Set fr’s state to "done". + fr[kState] = 'done' + + // 2. Set fr’s error to error. + fr[kError] = error + + // 3. Fire a progress event called error at fr. + fireAProgressEvent('error', fr) + + // 4. If fr’s state is not "loading", fire a progress + // event called loadend at fr. + if (fr[kState] !== 'loading') { + fireAProgressEvent('loadend', fr) + } + }) + + break + } + } + })() +} + +/** + * @see https://w3c.github.io/FileAPI/#fire-a-progress-event + * @see https://dom.spec.whatwg.org/#concept-event-fire + * @param {string} e The name of the event + * @param {import('./filereader').FileReader} reader + */ +function fireAProgressEvent (e, reader) { + // The progress event e does not bubble. e.bubbles must be false + // The progress event e is NOT cancelable. e.cancelable must be false + const event = new ProgressEvent(e, { + bubbles: false, + cancelable: false + }) + + reader.dispatchEvent(event) +} + +/** + * @see https://w3c.github.io/FileAPI/#blob-package-data + * @param {Uint8Array[]} bytes + * @param {string} type + * @param {string?} mimeType + * @param {string?} encodingName + */ +function packageData (bytes, type, mimeType, encodingName) { + // 1. A Blob has an associated package data algorithm, given + // bytes, a type, a optional mimeType, and a optional + // encodingName, which switches on type and runs the + // associated steps: + + switch (type) { + case 'DataURL': { + // 1. Return bytes as a DataURL [RFC2397] subject to + // the considerations below: + // * Use mimeType as part of the Data URL if it is + // available in keeping with the Data URL + // specification [RFC2397]. + // * If mimeType is not available return a Data URL + // without a media-type. [RFC2397]. + + // https://datatracker.ietf.org/doc/html/rfc2397#section-3 + // dataurl := "data:" [ mediatype ] [ ";base64" ] "," data + // mediatype := [ type "/" subtype ] *( ";" parameter ) + // data := *urlchar + // parameter := attribute "=" value + let dataURL = 'data:' + + const parsed = parseMIMEType(mimeType || 'application/octet-stream') + + if (parsed !== 'failure') { + dataURL += serializeAMimeType(parsed) + } + + dataURL += ';base64,' + + const decoder = new StringDecoder('latin1') + + for (const chunk of bytes) { + dataURL += btoa(decoder.write(chunk)) + } + + dataURL += btoa(decoder.end()) + + return dataURL + } + case 'Text': { + // 1. Let encoding be failure + let encoding = 'failure' + + // 2. If the encodingName is present, set encoding to the + // result of getting an encoding from encodingName. + if (encodingName) { + encoding = getEncoding(encodingName) + } + + // 3. If encoding is failure, and mimeType is present: + if (encoding === 'failure' && mimeType) { + // 1. Let type be the result of parse a MIME type + // given mimeType. + const type = parseMIMEType(mimeType) + + // 2. If type is not failure, set encoding to the result + // of getting an encoding from type’s parameters["charset"]. + if (type !== 'failure') { + encoding = getEncoding(type.parameters.get('charset')) + } + } + + // 4. If encoding is failure, then set encoding to UTF-8. + if (encoding === 'failure') { + encoding = 'UTF-8' + } + + // 5. Decode bytes using fallback encoding encoding, and + // return the result. + return decode(bytes, encoding) + } + case 'ArrayBuffer': { + // Return a new ArrayBuffer whose contents are bytes. + const sequence = combineByteSequences(bytes) + + return sequence.buffer + } + case 'BinaryString': { + // Return bytes as a binary string, in which every byte + // is represented by a code unit of equal value [0..255]. + let binaryString = '' + + const decoder = new StringDecoder('latin1') + + for (const chunk of bytes) { + binaryString += decoder.write(chunk) + } + + binaryString += decoder.end() + + return binaryString + } + } +} + +/** + * @see https://encoding.spec.whatwg.org/#decode + * @param {Uint8Array[]} ioQueue + * @param {string} encoding + */ +function decode (ioQueue, encoding) { + const bytes = combineByteSequences(ioQueue) + + // 1. Let BOMEncoding be the result of BOM sniffing ioQueue. + const BOMEncoding = BOMSniffing(bytes) + + let slice = 0 + + // 2. If BOMEncoding is non-null: + if (BOMEncoding !== null) { + // 1. Set encoding to BOMEncoding. + encoding = BOMEncoding + + // 2. Read three bytes from ioQueue, if BOMEncoding is + // UTF-8; otherwise read two bytes. + // (Do nothing with those bytes.) + slice = BOMEncoding === 'UTF-8' ? 3 : 2 + } + + // 3. Process a queue with an instance of encoding’s + // decoder, ioQueue, output, and "replacement". + + // 4. Return output. + + const sliced = bytes.slice(slice) + return new TextDecoder(encoding).decode(sliced) +} + +/** + * @see https://encoding.spec.whatwg.org/#bom-sniff + * @param {Uint8Array} ioQueue + */ +function BOMSniffing (ioQueue) { + // 1. Let BOM be the result of peeking 3 bytes from ioQueue, + // converted to a byte sequence. + const [a, b, c] = ioQueue + + // 2. For each of the rows in the table below, starting with + // the first one and going down, if BOM starts with the + // bytes given in the first column, then return the + // encoding given in the cell in the second column of that + // row. Otherwise, return null. + if (a === 0xEF && b === 0xBB && c === 0xBF) { + return 'UTF-8' + } else if (a === 0xFE && b === 0xFF) { + return 'UTF-16BE' + } else if (a === 0xFF && b === 0xFE) { + return 'UTF-16LE' + } + + return null +} + +/** + * @param {Uint8Array[]} sequences + */ +function combineByteSequences (sequences) { + const size = sequences.reduce((a, b) => { + return a + b.byteLength + }, 0) + + let offset = 0 + + return sequences.reduce((a, b) => { + a.set(b, offset) + offset += b.byteLength + return a + }, new Uint8Array(size)) +} + +module.exports = { + staticPropertyDescriptors, + readOperation, + fireAProgressEvent +} + + +/***/ }), + +/***/ 1892: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +// We include a version number for the Dispatcher API. In case of breaking changes, +// this version number must be increased to avoid conflicts. +const globalDispatcher = Symbol.for('undici.globalDispatcher.1') +const { InvalidArgumentError } = __nccwpck_require__(8045) +const Agent = __nccwpck_require__(7890) + +if (getGlobalDispatcher() === undefined) { + setGlobalDispatcher(new Agent()) +} + +function setGlobalDispatcher (agent) { + if (!agent || typeof agent.dispatch !== 'function') { + throw new InvalidArgumentError('Argument agent must implement Agent') + } + Object.defineProperty(globalThis, globalDispatcher, { + value: agent, + writable: true, + enumerable: false, + configurable: false + }) +} + +function getGlobalDispatcher () { + return globalThis[globalDispatcher] +} + +module.exports = { + setGlobalDispatcher, + getGlobalDispatcher +} + + +/***/ }), + +/***/ 6930: +/***/ ((module) => { + +"use strict"; + + +module.exports = class DecoratorHandler { + constructor (handler) { + this.handler = handler + } + + onConnect (...args) { + return this.handler.onConnect(...args) + } + + onError (...args) { + return this.handler.onError(...args) + } + + onUpgrade (...args) { + return this.handler.onUpgrade(...args) + } + onHeaders (...args) { + return this.handler.onHeaders(...args) + } -/***/ }), + onData (...args) { + return this.handler.onData(...args) + } -/***/ 1532: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + onComplete (...args) { + return this.handler.onComplete(...args) + } -const ANY = Symbol('SemVer ANY') -// hoisted class for cyclic dependency -class Comparator { - static get ANY () { - return ANY + onBodySent (...args) { + return this.handler.onBodySent(...args) } +} - constructor (comp, options) { - options = parseOptions(options) - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp - } else { - comp = comp.value - } - } +/***/ }), - comp = comp.trim().split(/\s+/).join(' ') - debug('comparator', comp, options) - this.options = options - this.loose = !!options.loose - this.parse(comp) +/***/ 2860: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (this.semver === ANY) { - this.value = '' - } else { - this.value = this.operator + this.semver.version - } +"use strict"; - debug('comp', this) - } - parse (comp) { - const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] - const m = comp.match(r) +const util = __nccwpck_require__(3983) +const { kBodyUsed } = __nccwpck_require__(2785) +const assert = __nccwpck_require__(9491) +const { InvalidArgumentError } = __nccwpck_require__(8045) +const EE = __nccwpck_require__(2361) - if (!m) { - throw new TypeError(`Invalid comparator: ${comp}`) - } +const redirectableStatusCodes = [300, 301, 302, 303, 307, 308] - this.operator = m[1] !== undefined ? m[1] : '' - if (this.operator === '=') { - this.operator = '' - } +const kBody = Symbol('body') - // if it literally is just '>' or '' then allow anything. - if (!m[2]) { - this.semver = ANY - } else { - this.semver = new SemVer(m[2], this.options.loose) - } +class BodyAsyncIterable { + constructor (body) { + this[kBody] = body + this[kBodyUsed] = false } - toString () { - return this.value + async * [Symbol.asyncIterator] () { + assert(!this[kBodyUsed], 'disturbed') + this[kBodyUsed] = true + yield * this[kBody] } +} - test (version) { - debug('Comparator.test', version, this.options.loose) - - if (this.semver === ANY || version === ANY) { - return true +class RedirectHandler { + constructor (dispatch, maxRedirections, opts, handler) { + if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) { + throw new InvalidArgumentError('maxRedirections must be a positive number') } - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false + util.validateHandler(handler, opts.method, opts.upgrade) + + this.dispatch = dispatch + this.location = null + this.abort = null + this.opts = { ...opts, maxRedirections: 0 } // opts must be a copy + this.maxRedirections = maxRedirections + this.handler = handler + this.history = [] + + if (util.isStream(this.opts.body)) { + // TODO (fix): Provide some way for the user to cache the file to e.g. /tmp + // so that it can be dispatched again? + // TODO (fix): Do we need 100-expect support to provide a way to do this properly? + if (util.bodyLength(this.opts.body) === 0) { + this.opts.body + .on('data', function () { + assert(false) + }) + } + + if (typeof this.opts.body.readableDidRead !== 'boolean') { + this.opts.body[kBodyUsed] = false + EE.prototype.on.call(this.opts.body, 'data', function () { + this[kBodyUsed] = true + }) } + } else if (this.opts.body && typeof this.opts.body.pipeTo === 'function') { + // TODO (fix): We can't access ReadableStream internal state + // to determine whether or not it has been disturbed. This is just + // a workaround. + this.opts.body = new BodyAsyncIterable(this.opts.body) + } else if ( + this.opts.body && + typeof this.opts.body !== 'string' && + !ArrayBuffer.isView(this.opts.body) && + util.isIterable(this.opts.body) + ) { + // TODO: Should we allow re-using iterable if !this.opts.idempotent + // or through some other flag? + this.opts.body = new BodyAsyncIterable(this.opts.body) } + } - return cmp(version, this.operator, this.semver, this.options) + onConnect (abort) { + this.abort = abort + this.handler.onConnect(abort, { history: this.history }) } - intersects (comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required') - } + onUpgrade (statusCode, headers, socket) { + this.handler.onUpgrade(statusCode, headers, socket) + } - if (this.operator === '') { - if (this.value === '') { - return true - } - return new Range(comp.value, options).test(this.value) - } else if (comp.operator === '') { - if (comp.value === '') { - return true - } - return new Range(this.value, options).test(comp.semver) - } + onError (error) { + this.handler.onError(error) + } - options = parseOptions(options) + onHeaders (statusCode, headers, resume, statusText) { + this.location = this.history.length >= this.maxRedirections || util.isDisturbed(this.opts.body) + ? null + : parseLocation(statusCode, headers) - // Special cases where nothing can possibly be lower - if (options.includePrerelease && - (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) { - return false - } - if (!options.includePrerelease && - (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) { - return false + if (this.opts.origin) { + this.history.push(new URL(this.opts.path, this.opts.origin)) } - // Same direction increasing (> or >=) - if (this.operator.startsWith('>') && comp.operator.startsWith('>')) { - return true - } - // Same direction decreasing (< or <=) - if (this.operator.startsWith('<') && comp.operator.startsWith('<')) { - return true - } - // same SemVer and both sides are inclusive (<= or >=) - if ( - (this.semver.version === comp.semver.version) && - this.operator.includes('=') && comp.operator.includes('=')) { - return true - } - // opposite directions less than - if (cmp(this.semver, '<', comp.semver, options) && - this.operator.startsWith('>') && comp.operator.startsWith('<')) { - return true - } - // opposite directions greater than - if (cmp(this.semver, '>', comp.semver, options) && - this.operator.startsWith('<') && comp.operator.startsWith('>')) { - return true + if (!this.location) { + return this.handler.onHeaders(statusCode, headers, resume, statusText) } - return false - } -} -module.exports = Comparator + const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin))) + const path = search ? `${pathname}${search}` : pathname -const parseOptions = __nccwpck_require__(785) -const { safeRe: re, t } = __nccwpck_require__(9523) -const cmp = __nccwpck_require__(5098) -const debug = __nccwpck_require__(106) -const SemVer = __nccwpck_require__(8088) -const Range = __nccwpck_require__(9828) + // Remove headers referring to the original URL. + // By default it is Host only, unless it's a 303 (see below), which removes also all Content-* headers. + // https://tools.ietf.org/html/rfc7231#section-6.4 + this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin) + this.opts.path = path + this.opts.origin = origin + this.opts.maxRedirections = 0 + this.opts.query = null + // https://tools.ietf.org/html/rfc7231#section-6.4.4 + // In case of HTTP 303, always replace method to be either HEAD or GET + if (statusCode === 303 && this.opts.method !== 'HEAD') { + this.opts.method = 'GET' + this.opts.body = null + } + } -/***/ }), + onData (chunk) { + if (this.location) { + /* + https://tools.ietf.org/html/rfc7231#section-6.4 -/***/ 9828: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + TLDR: undici always ignores 3xx response bodies. -// hoisted class for cyclic dependency -class Range { - constructor (range, options) { - options = parseOptions(options) + Redirection is used to serve the requested resource from another URL, so it is assumes that + no body is generated (and thus can be ignored). Even though generating a body is not prohibited. - if (range instanceof Range) { - if ( - range.loose === !!options.loose && - range.includePrerelease === !!options.includePrerelease - ) { - return range - } else { - return new Range(range.raw, options) - } - } + For status 301, 302, 303, 307 and 308 (the latter from RFC 7238), the specs mention that the body usually + (which means it's optional and not mandated) contain just an hyperlink to the value of + the Location response header, so the body can be ignored safely. - if (range instanceof Comparator) { - // just put it in the set and return - this.raw = range.value - this.set = [[range]] - this.format() - return this + For status 300, which is "Multiple Choices", the spec mentions both generating a Location + response header AND a response body with the other possible location to follow. + Since the spec explicitily chooses not to specify a format for such body and leave it to + servers and browsers implementors, we ignore the body as there is no specified way to eventually parse it. + */ + } else { + return this.handler.onData(chunk) } + } - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease + onComplete (trailers) { + if (this.location) { + /* + https://tools.ietf.org/html/rfc7231#section-6.4 - // First reduce all whitespace as much as possible so we do not have to rely - // on potentially slow regexes like \s*. This is then stored and used for - // future error messages as well. - this.raw = range - .trim() - .split(/\s+/) - .join(' ') + TLDR: undici always ignores 3xx response trailers as they are not expected in case of redirections + and neither are useful if present. - // First, split on || - this.set = this.raw - .split('||') - // map the range to a 2d array of comparators - .map(r => this.parseRange(r.trim())) - // throw out any comparator lists that are empty - // this generally means that it was not a valid range, which is allowed - // in loose mode, but will still throw if the WHOLE range is invalid. - .filter(c => c.length) + See comment on onData method above for more detailed informations. + */ - if (!this.set.length) { - throw new TypeError(`Invalid SemVer Range: ${this.raw}`) - } + this.location = null + this.abort = null - // if we have any that are not the null set, throw out null sets. - if (this.set.length > 1) { - // keep the first one, in case they're all null sets - const first = this.set[0] - this.set = this.set.filter(c => !isNullSet(c[0])) - if (this.set.length === 0) { - this.set = [first] - } else if (this.set.length > 1) { - // if we have any that are *, then the range is just * - for (const c of this.set) { - if (c.length === 1 && isAny(c[0])) { - this.set = [c] - break - } - } - } + this.dispatch(this.opts, this) + } else { + this.handler.onComplete(trailers) } + } - this.format() + onBodySent (chunk) { + if (this.handler.onBodySent) { + this.handler.onBodySent(chunk) + } } +} - format () { - this.range = this.set - .map((comps) => comps.join(' ').trim()) - .join('||') - .trim() - return this.range +function parseLocation (statusCode, headers) { + if (redirectableStatusCodes.indexOf(statusCode) === -1) { + return null } - toString () { - return this.range + for (let i = 0; i < headers.length; i += 2) { + if (headers[i].toString().toLowerCase() === 'location') { + return headers[i + 1] + } } +} - parseRange (range) { - // memoize range parsing for performance. - // this is a very hot path, and fully deterministic. - const memoOpts = - (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | - (this.options.loose && FLAG_LOOSE) - const memoKey = memoOpts + ':' + range - const cached = cache.get(memoKey) - if (cached) { - return cached +// https://tools.ietf.org/html/rfc7231#section-6.4.4 +function shouldRemoveHeader (header, removeContent, unknownOrigin) { + return ( + (header.length === 4 && header.toString().toLowerCase() === 'host') || + (removeContent && header.toString().toLowerCase().indexOf('content-') === 0) || + (unknownOrigin && header.length === 13 && header.toString().toLowerCase() === 'authorization') || + (unknownOrigin && header.length === 6 && header.toString().toLowerCase() === 'cookie') + ) +} + +// https://tools.ietf.org/html/rfc7231#section-6.4 +function cleanRequestHeaders (headers, removeContent, unknownOrigin) { + const ret = [] + if (Array.isArray(headers)) { + for (let i = 0; i < headers.length; i += 2) { + if (!shouldRemoveHeader(headers[i], removeContent, unknownOrigin)) { + ret.push(headers[i], headers[i + 1]) + } } + } else if (headers && typeof headers === 'object') { + for (const key of Object.keys(headers)) { + if (!shouldRemoveHeader(key, removeContent, unknownOrigin)) { + ret.push(key, headers[key]) + } + } + } else { + assert(headers == null, 'headers must be an object or an array') + } + return ret +} - const loose = this.options.loose - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] - range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) - debug('hyphen replace', range) +module.exports = RedirectHandler - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range) - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[t.TILDETRIM], tildeTrimReplace) - debug('tilde trim', range) +/***/ }), - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[t.CARETTRIM], caretTrimReplace) - debug('caret trim', range) +/***/ 8861: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // At this point, the range is completely trimmed and - // ready to be split into comparators. +"use strict"; - let rangeList = range - .split(' ') - .map(comp => parseComparator(comp, this.options)) - .join(' ') - .split(/\s+/) - // >=0.0.0 is equivalent to * - .map(comp => replaceGTE0(comp, this.options)) - if (loose) { - // in loose mode, throw out any that are not valid comparators - rangeList = rangeList.filter(comp => { - debug('loose invalid filter', comp, this.options) - return !!comp.match(re[t.COMPARATORLOOSE]) - }) - } - debug('range list', rangeList) +const RedirectHandler = __nccwpck_require__(2860) - // if any comparators are the null set, then replace with JUST null set - // if more than one comparator, remove any * comparators - // also, don't include the same comparator more than once - const rangeMap = new Map() - const comparators = rangeList.map(comp => new Comparator(comp, this.options)) - for (const comp of comparators) { - if (isNullSet(comp)) { - return [comp] +function createRedirectInterceptor ({ maxRedirections: defaultMaxRedirections }) { + return (dispatch) => { + return function Intercept (opts, handler) { + const { maxRedirections = defaultMaxRedirections } = opts + + if (!maxRedirections) { + return dispatch(opts, handler) } - rangeMap.set(comp.value, comp) - } - if (rangeMap.size > 1 && rangeMap.has('')) { - rangeMap.delete('') - } - const result = [...rangeMap.values()] - cache.set(memoKey, result) - return result + const redirectHandler = new RedirectHandler(dispatch, maxRedirections, opts, handler) + opts = { ...opts, maxRedirections: 0 } // Stop sub dispatcher from also redirecting. + return dispatch(opts, redirectHandler) + } } +} - intersects (range, options) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required') - } +module.exports = createRedirectInterceptor - return this.set.some((thisComparators) => { - return ( - isSatisfiable(thisComparators, options) && - range.set.some((rangeComparators) => { - return ( - isSatisfiable(rangeComparators, options) && - thisComparators.every((thisComparator) => { - return rangeComparators.every((rangeComparator) => { - return thisComparator.intersects(rangeComparator, options) - }) - }) - ) - }) - ) - }) - } - // if ANY of the sets match ALL of its comparators, then pass - test (version) { - if (!version) { - return false - } +/***/ }), - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } - } +/***/ 953: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - for (let i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true - } +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SPECIAL_HEADERS = exports.HEADER_STATE = exports.MINOR = exports.MAJOR = exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS = exports.TOKEN = exports.STRICT_TOKEN = exports.HEX = exports.URL_CHAR = exports.STRICT_URL_CHAR = exports.USERINFO_CHARS = exports.MARK = exports.ALPHANUM = exports.NUM = exports.HEX_MAP = exports.NUM_MAP = exports.ALPHA = exports.FINISH = exports.H_METHOD_MAP = exports.METHOD_MAP = exports.METHODS_RTSP = exports.METHODS_ICE = exports.METHODS_HTTP = exports.METHODS = exports.LENIENT_FLAGS = exports.FLAGS = exports.TYPE = exports.ERROR = void 0; +const utils_1 = __nccwpck_require__(1891); +// C headers +var ERROR; +(function (ERROR) { + ERROR[ERROR["OK"] = 0] = "OK"; + ERROR[ERROR["INTERNAL"] = 1] = "INTERNAL"; + ERROR[ERROR["STRICT"] = 2] = "STRICT"; + ERROR[ERROR["LF_EXPECTED"] = 3] = "LF_EXPECTED"; + ERROR[ERROR["UNEXPECTED_CONTENT_LENGTH"] = 4] = "UNEXPECTED_CONTENT_LENGTH"; + ERROR[ERROR["CLOSED_CONNECTION"] = 5] = "CLOSED_CONNECTION"; + ERROR[ERROR["INVALID_METHOD"] = 6] = "INVALID_METHOD"; + ERROR[ERROR["INVALID_URL"] = 7] = "INVALID_URL"; + ERROR[ERROR["INVALID_CONSTANT"] = 8] = "INVALID_CONSTANT"; + ERROR[ERROR["INVALID_VERSION"] = 9] = "INVALID_VERSION"; + ERROR[ERROR["INVALID_HEADER_TOKEN"] = 10] = "INVALID_HEADER_TOKEN"; + ERROR[ERROR["INVALID_CONTENT_LENGTH"] = 11] = "INVALID_CONTENT_LENGTH"; + ERROR[ERROR["INVALID_CHUNK_SIZE"] = 12] = "INVALID_CHUNK_SIZE"; + ERROR[ERROR["INVALID_STATUS"] = 13] = "INVALID_STATUS"; + ERROR[ERROR["INVALID_EOF_STATE"] = 14] = "INVALID_EOF_STATE"; + ERROR[ERROR["INVALID_TRANSFER_ENCODING"] = 15] = "INVALID_TRANSFER_ENCODING"; + ERROR[ERROR["CB_MESSAGE_BEGIN"] = 16] = "CB_MESSAGE_BEGIN"; + ERROR[ERROR["CB_HEADERS_COMPLETE"] = 17] = "CB_HEADERS_COMPLETE"; + ERROR[ERROR["CB_MESSAGE_COMPLETE"] = 18] = "CB_MESSAGE_COMPLETE"; + ERROR[ERROR["CB_CHUNK_HEADER"] = 19] = "CB_CHUNK_HEADER"; + ERROR[ERROR["CB_CHUNK_COMPLETE"] = 20] = "CB_CHUNK_COMPLETE"; + ERROR[ERROR["PAUSED"] = 21] = "PAUSED"; + ERROR[ERROR["PAUSED_UPGRADE"] = 22] = "PAUSED_UPGRADE"; + ERROR[ERROR["PAUSED_H2_UPGRADE"] = 23] = "PAUSED_H2_UPGRADE"; + ERROR[ERROR["USER"] = 24] = "USER"; +})(ERROR = exports.ERROR || (exports.ERROR = {})); +var TYPE; +(function (TYPE) { + TYPE[TYPE["BOTH"] = 0] = "BOTH"; + TYPE[TYPE["REQUEST"] = 1] = "REQUEST"; + TYPE[TYPE["RESPONSE"] = 2] = "RESPONSE"; +})(TYPE = exports.TYPE || (exports.TYPE = {})); +var FLAGS; +(function (FLAGS) { + FLAGS[FLAGS["CONNECTION_KEEP_ALIVE"] = 1] = "CONNECTION_KEEP_ALIVE"; + FLAGS[FLAGS["CONNECTION_CLOSE"] = 2] = "CONNECTION_CLOSE"; + FLAGS[FLAGS["CONNECTION_UPGRADE"] = 4] = "CONNECTION_UPGRADE"; + FLAGS[FLAGS["CHUNKED"] = 8] = "CHUNKED"; + FLAGS[FLAGS["UPGRADE"] = 16] = "UPGRADE"; + FLAGS[FLAGS["CONTENT_LENGTH"] = 32] = "CONTENT_LENGTH"; + FLAGS[FLAGS["SKIPBODY"] = 64] = "SKIPBODY"; + FLAGS[FLAGS["TRAILING"] = 128] = "TRAILING"; + // 1 << 8 is unused + FLAGS[FLAGS["TRANSFER_ENCODING"] = 512] = "TRANSFER_ENCODING"; +})(FLAGS = exports.FLAGS || (exports.FLAGS = {})); +var LENIENT_FLAGS; +(function (LENIENT_FLAGS) { + LENIENT_FLAGS[LENIENT_FLAGS["HEADERS"] = 1] = "HEADERS"; + LENIENT_FLAGS[LENIENT_FLAGS["CHUNKED_LENGTH"] = 2] = "CHUNKED_LENGTH"; + LENIENT_FLAGS[LENIENT_FLAGS["KEEP_ALIVE"] = 4] = "KEEP_ALIVE"; +})(LENIENT_FLAGS = exports.LENIENT_FLAGS || (exports.LENIENT_FLAGS = {})); +var METHODS; +(function (METHODS) { + METHODS[METHODS["DELETE"] = 0] = "DELETE"; + METHODS[METHODS["GET"] = 1] = "GET"; + METHODS[METHODS["HEAD"] = 2] = "HEAD"; + METHODS[METHODS["POST"] = 3] = "POST"; + METHODS[METHODS["PUT"] = 4] = "PUT"; + /* pathological */ + METHODS[METHODS["CONNECT"] = 5] = "CONNECT"; + METHODS[METHODS["OPTIONS"] = 6] = "OPTIONS"; + METHODS[METHODS["TRACE"] = 7] = "TRACE"; + /* WebDAV */ + METHODS[METHODS["COPY"] = 8] = "COPY"; + METHODS[METHODS["LOCK"] = 9] = "LOCK"; + METHODS[METHODS["MKCOL"] = 10] = "MKCOL"; + METHODS[METHODS["MOVE"] = 11] = "MOVE"; + METHODS[METHODS["PROPFIND"] = 12] = "PROPFIND"; + METHODS[METHODS["PROPPATCH"] = 13] = "PROPPATCH"; + METHODS[METHODS["SEARCH"] = 14] = "SEARCH"; + METHODS[METHODS["UNLOCK"] = 15] = "UNLOCK"; + METHODS[METHODS["BIND"] = 16] = "BIND"; + METHODS[METHODS["REBIND"] = 17] = "REBIND"; + METHODS[METHODS["UNBIND"] = 18] = "UNBIND"; + METHODS[METHODS["ACL"] = 19] = "ACL"; + /* subversion */ + METHODS[METHODS["REPORT"] = 20] = "REPORT"; + METHODS[METHODS["MKACTIVITY"] = 21] = "MKACTIVITY"; + METHODS[METHODS["CHECKOUT"] = 22] = "CHECKOUT"; + METHODS[METHODS["MERGE"] = 23] = "MERGE"; + /* upnp */ + METHODS[METHODS["M-SEARCH"] = 24] = "M-SEARCH"; + METHODS[METHODS["NOTIFY"] = 25] = "NOTIFY"; + METHODS[METHODS["SUBSCRIBE"] = 26] = "SUBSCRIBE"; + METHODS[METHODS["UNSUBSCRIBE"] = 27] = "UNSUBSCRIBE"; + /* RFC-5789 */ + METHODS[METHODS["PATCH"] = 28] = "PATCH"; + METHODS[METHODS["PURGE"] = 29] = "PURGE"; + /* CalDAV */ + METHODS[METHODS["MKCALENDAR"] = 30] = "MKCALENDAR"; + /* RFC-2068, section 19.6.1.2 */ + METHODS[METHODS["LINK"] = 31] = "LINK"; + METHODS[METHODS["UNLINK"] = 32] = "UNLINK"; + /* icecast */ + METHODS[METHODS["SOURCE"] = 33] = "SOURCE"; + /* RFC-7540, section 11.6 */ + METHODS[METHODS["PRI"] = 34] = "PRI"; + /* RFC-2326 RTSP */ + METHODS[METHODS["DESCRIBE"] = 35] = "DESCRIBE"; + METHODS[METHODS["ANNOUNCE"] = 36] = "ANNOUNCE"; + METHODS[METHODS["SETUP"] = 37] = "SETUP"; + METHODS[METHODS["PLAY"] = 38] = "PLAY"; + METHODS[METHODS["PAUSE"] = 39] = "PAUSE"; + METHODS[METHODS["TEARDOWN"] = 40] = "TEARDOWN"; + METHODS[METHODS["GET_PARAMETER"] = 41] = "GET_PARAMETER"; + METHODS[METHODS["SET_PARAMETER"] = 42] = "SET_PARAMETER"; + METHODS[METHODS["REDIRECT"] = 43] = "REDIRECT"; + METHODS[METHODS["RECORD"] = 44] = "RECORD"; + /* RAOP */ + METHODS[METHODS["FLUSH"] = 45] = "FLUSH"; +})(METHODS = exports.METHODS || (exports.METHODS = {})); +exports.METHODS_HTTP = [ + METHODS.DELETE, + METHODS.GET, + METHODS.HEAD, + METHODS.POST, + METHODS.PUT, + METHODS.CONNECT, + METHODS.OPTIONS, + METHODS.TRACE, + METHODS.COPY, + METHODS.LOCK, + METHODS.MKCOL, + METHODS.MOVE, + METHODS.PROPFIND, + METHODS.PROPPATCH, + METHODS.SEARCH, + METHODS.UNLOCK, + METHODS.BIND, + METHODS.REBIND, + METHODS.UNBIND, + METHODS.ACL, + METHODS.REPORT, + METHODS.MKACTIVITY, + METHODS.CHECKOUT, + METHODS.MERGE, + METHODS['M-SEARCH'], + METHODS.NOTIFY, + METHODS.SUBSCRIBE, + METHODS.UNSUBSCRIBE, + METHODS.PATCH, + METHODS.PURGE, + METHODS.MKCALENDAR, + METHODS.LINK, + METHODS.UNLINK, + METHODS.PRI, + // TODO(indutny): should we allow it with HTTP? + METHODS.SOURCE, +]; +exports.METHODS_ICE = [ + METHODS.SOURCE, +]; +exports.METHODS_RTSP = [ + METHODS.OPTIONS, + METHODS.DESCRIBE, + METHODS.ANNOUNCE, + METHODS.SETUP, + METHODS.PLAY, + METHODS.PAUSE, + METHODS.TEARDOWN, + METHODS.GET_PARAMETER, + METHODS.SET_PARAMETER, + METHODS.REDIRECT, + METHODS.RECORD, + METHODS.FLUSH, + // For AirPlay + METHODS.GET, + METHODS.POST, +]; +exports.METHOD_MAP = utils_1.enumToMap(METHODS); +exports.H_METHOD_MAP = {}; +Object.keys(exports.METHOD_MAP).forEach((key) => { + if (/^H/.test(key)) { + exports.H_METHOD_MAP[key] = exports.METHOD_MAP[key]; } - return false - } -} +}); +var FINISH; +(function (FINISH) { + FINISH[FINISH["SAFE"] = 0] = "SAFE"; + FINISH[FINISH["SAFE_WITH_CB"] = 1] = "SAFE_WITH_CB"; + FINISH[FINISH["UNSAFE"] = 2] = "UNSAFE"; +})(FINISH = exports.FINISH || (exports.FINISH = {})); +exports.ALPHA = []; +for (let i = 'A'.charCodeAt(0); i <= 'Z'.charCodeAt(0); i++) { + // Upper case + exports.ALPHA.push(String.fromCharCode(i)); + // Lower case + exports.ALPHA.push(String.fromCharCode(i + 0x20)); +} +exports.NUM_MAP = { + 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, + 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, +}; +exports.HEX_MAP = { + 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, + 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, + A: 0XA, B: 0XB, C: 0XC, D: 0XD, E: 0XE, F: 0XF, + a: 0xa, b: 0xb, c: 0xc, d: 0xd, e: 0xe, f: 0xf, +}; +exports.NUM = [ + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', +]; +exports.ALPHANUM = exports.ALPHA.concat(exports.NUM); +exports.MARK = ['-', '_', '.', '!', '~', '*', '\'', '(', ')']; +exports.USERINFO_CHARS = exports.ALPHANUM + .concat(exports.MARK) + .concat(['%', ';', ':', '&', '=', '+', '$', ',']); +// TODO(indutny): use RFC +exports.STRICT_URL_CHAR = [ + '!', '"', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + ':', ';', '<', '=', '>', + '@', '[', '\\', ']', '^', '_', + '`', + '{', '|', '}', '~', +].concat(exports.ALPHANUM); +exports.URL_CHAR = exports.STRICT_URL_CHAR + .concat(['\t', '\f']); +// All characters with 0x80 bit set to 1 +for (let i = 0x80; i <= 0xff; i++) { + exports.URL_CHAR.push(i); +} +exports.HEX = exports.NUM.concat(['a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F']); +/* Tokens as defined by rfc 2616. Also lowercases them. + * token = 1* + * separators = "(" | ")" | "<" | ">" | "@" + * | "," | ";" | ":" | "\" | <"> + * | "/" | "[" | "]" | "?" | "=" + * | "{" | "}" | SP | HT + */ +exports.STRICT_TOKEN = [ + '!', '#', '$', '%', '&', '\'', + '*', '+', '-', '.', + '^', '_', '`', + '|', '~', +].concat(exports.ALPHANUM); +exports.TOKEN = exports.STRICT_TOKEN.concat([' ']); +/* + * Verify that a char is a valid visible (printable) US-ASCII + * character or %x80-FF + */ +exports.HEADER_CHARS = ['\t']; +for (let i = 32; i <= 255; i++) { + if (i !== 127) { + exports.HEADER_CHARS.push(i); + } +} +// ',' = \x44 +exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS.filter((c) => c !== 44); +exports.MAJOR = exports.NUM_MAP; +exports.MINOR = exports.MAJOR; +var HEADER_STATE; +(function (HEADER_STATE) { + HEADER_STATE[HEADER_STATE["GENERAL"] = 0] = "GENERAL"; + HEADER_STATE[HEADER_STATE["CONNECTION"] = 1] = "CONNECTION"; + HEADER_STATE[HEADER_STATE["CONTENT_LENGTH"] = 2] = "CONTENT_LENGTH"; + HEADER_STATE[HEADER_STATE["TRANSFER_ENCODING"] = 3] = "TRANSFER_ENCODING"; + HEADER_STATE[HEADER_STATE["UPGRADE"] = 4] = "UPGRADE"; + HEADER_STATE[HEADER_STATE["CONNECTION_KEEP_ALIVE"] = 5] = "CONNECTION_KEEP_ALIVE"; + HEADER_STATE[HEADER_STATE["CONNECTION_CLOSE"] = 6] = "CONNECTION_CLOSE"; + HEADER_STATE[HEADER_STATE["CONNECTION_UPGRADE"] = 7] = "CONNECTION_UPGRADE"; + HEADER_STATE[HEADER_STATE["TRANSFER_ENCODING_CHUNKED"] = 8] = "TRANSFER_ENCODING_CHUNKED"; +})(HEADER_STATE = exports.HEADER_STATE || (exports.HEADER_STATE = {})); +exports.SPECIAL_HEADERS = { + 'connection': HEADER_STATE.CONNECTION, + 'content-length': HEADER_STATE.CONTENT_LENGTH, + 'proxy-connection': HEADER_STATE.CONNECTION, + 'transfer-encoding': HEADER_STATE.TRANSFER_ENCODING, + 'upgrade': HEADER_STATE.UPGRADE, +}; +//# sourceMappingURL=constants.js.map -module.exports = Range +/***/ }), -const LRU = __nccwpck_require__(7129) -const cache = new LRU({ max: 1000 }) +/***/ 1145: +/***/ ((module) => { -const parseOptions = __nccwpck_require__(785) -const Comparator = __nccwpck_require__(1532) -const debug = __nccwpck_require__(106) -const SemVer = __nccwpck_require__(8088) -const { - safeRe: re, - t, - comparatorTrimReplace, - tildeTrimReplace, - caretTrimReplace, -} = __nccwpck_require__(9523) -const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = __nccwpck_require__(2293) +module.exports = 'AGFzbQEAAAABMAhgAX8Bf2ADf39/AX9gBH9/f38Bf2AAAGADf39/AGABfwBgAn9/AGAGf39/f39/AALLAQgDZW52GHdhc21fb25faGVhZGVyc19jb21wbGV0ZQACA2VudhV3YXNtX29uX21lc3NhZ2VfYmVnaW4AAANlbnYLd2FzbV9vbl91cmwAAQNlbnYOd2FzbV9vbl9zdGF0dXMAAQNlbnYUd2FzbV9vbl9oZWFkZXJfZmllbGQAAQNlbnYUd2FzbV9vbl9oZWFkZXJfdmFsdWUAAQNlbnYMd2FzbV9vbl9ib2R5AAEDZW52GHdhc21fb25fbWVzc2FnZV9jb21wbGV0ZQAAA0ZFAwMEAAAFAAAAAAAABQEFAAUFBQAABgAAAAAGBgYGAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAAABAQcAAAUFAwABBAUBcAESEgUDAQACBggBfwFBgNQECwfRBSIGbWVtb3J5AgALX2luaXRpYWxpemUACRlfX2luZGlyZWN0X2Z1bmN0aW9uX3RhYmxlAQALbGxodHRwX2luaXQAChhsbGh0dHBfc2hvdWxkX2tlZXBfYWxpdmUAQQxsbGh0dHBfYWxsb2MADAZtYWxsb2MARgtsbGh0dHBfZnJlZQANBGZyZWUASA9sbGh0dHBfZ2V0X3R5cGUADhVsbGh0dHBfZ2V0X2h0dHBfbWFqb3IADxVsbGh0dHBfZ2V0X2h0dHBfbWlub3IAEBFsbGh0dHBfZ2V0X21ldGhvZAARFmxsaHR0cF9nZXRfc3RhdHVzX2NvZGUAEhJsbGh0dHBfZ2V0X3VwZ3JhZGUAEwxsbGh0dHBfcmVzZXQAFA5sbGh0dHBfZXhlY3V0ZQAVFGxsaHR0cF9zZXR0aW5nc19pbml0ABYNbGxodHRwX2ZpbmlzaAAXDGxsaHR0cF9wYXVzZQAYDWxsaHR0cF9yZXN1bWUAGRtsbGh0dHBfcmVzdW1lX2FmdGVyX3VwZ3JhZGUAGhBsbGh0dHBfZ2V0X2Vycm5vABsXbGxodHRwX2dldF9lcnJvcl9yZWFzb24AHBdsbGh0dHBfc2V0X2Vycm9yX3JlYXNvbgAdFGxsaHR0cF9nZXRfZXJyb3JfcG9zAB4RbGxodHRwX2Vycm5vX25hbWUAHxJsbGh0dHBfbWV0aG9kX25hbWUAIBJsbGh0dHBfc3RhdHVzX25hbWUAIRpsbGh0dHBfc2V0X2xlbmllbnRfaGVhZGVycwAiIWxsaHR0cF9zZXRfbGVuaWVudF9jaHVua2VkX2xlbmd0aAAjHWxsaHR0cF9zZXRfbGVuaWVudF9rZWVwX2FsaXZlACQkbGxodHRwX3NldF9sZW5pZW50X3RyYW5zZmVyX2VuY29kaW5nACUYbGxodHRwX21lc3NhZ2VfbmVlZHNfZW9mAD8JFwEAQQELEQECAwQFCwYHNTk3MS8tJyspCsLgAkUCAAsIABCIgICAAAsZACAAEMKAgIAAGiAAIAI2AjggACABOgAoCxwAIAAgAC8BMiAALQAuIAAQwYCAgAAQgICAgAALKgEBf0HAABDGgICAACIBEMKAgIAAGiABQYCIgIAANgI4IAEgADoAKCABCwoAIAAQyICAgAALBwAgAC0AKAsHACAALQAqCwcAIAAtACsLBwAgAC0AKQsHACAALwEyCwcAIAAtAC4LRQEEfyAAKAIYIQEgAC0ALSECIAAtACghAyAAKAI4IQQgABDCgICAABogACAENgI4IAAgAzoAKCAAIAI6AC0gACABNgIYCxEAIAAgASABIAJqEMOAgIAACxAAIABBAEHcABDMgICAABoLZwEBf0EAIQECQCAAKAIMDQACQAJAAkACQCAALQAvDgMBAAMCCyAAKAI4IgFFDQAgASgCLCIBRQ0AIAAgARGAgICAAAAiAQ0DC0EADwsQyoCAgAAACyAAQcOWgIAANgIQQQ4hAQsgAQseAAJAIAAoAgwNACAAQdGbgIAANgIQIABBFTYCDAsLFgACQCAAKAIMQRVHDQAgAEEANgIMCwsWAAJAIAAoAgxBFkcNACAAQQA2AgwLCwcAIAAoAgwLBwAgACgCEAsJACAAIAE2AhALBwAgACgCFAsiAAJAIABBJEkNABDKgICAAAALIABBAnRBoLOAgABqKAIACyIAAkAgAEEuSQ0AEMqAgIAAAAsgAEECdEGwtICAAGooAgAL7gsBAX9B66iAgAAhAQJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIABBnH9qDvQDY2IAAWFhYWFhYQIDBAVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhBgcICQoLDA0OD2FhYWFhEGFhYWFhYWFhYWFhEWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYRITFBUWFxgZGhthYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2YTc4OTphYWFhYWFhYTthYWE8YWFhYT0+P2FhYWFhYWFhQGFhQWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYUJDREVGR0hJSktMTU5PUFFSU2FhYWFhYWFhVFVWV1hZWlthXF1hYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFeYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhX2BhC0Hhp4CAAA8LQaShgIAADwtBy6yAgAAPC0H+sYCAAA8LQcCkgIAADwtBq6SAgAAPC0GNqICAAA8LQeKmgIAADwtBgLCAgAAPC0G5r4CAAA8LQdekgIAADwtB75+AgAAPC0Hhn4CAAA8LQfqfgIAADwtB8qCAgAAPC0Gor4CAAA8LQa6ygIAADwtBiLCAgAAPC0Hsp4CAAA8LQYKigIAADwtBjp2AgAAPC0HQroCAAA8LQcqjgIAADwtBxbKAgAAPC0HfnICAAA8LQdKcgIAADwtBxKCAgAAPC0HXoICAAA8LQaKfgIAADwtB7a6AgAAPC0GrsICAAA8LQdSlgIAADwtBzK6AgAAPC0H6roCAAA8LQfyrgIAADwtB0rCAgAAPC0HxnYCAAA8LQbuggIAADwtB96uAgAAPC0GQsYCAAA8LQdexgIAADwtBoq2AgAAPC0HUp4CAAA8LQeCrgIAADwtBn6yAgAAPC0HrsYCAAA8LQdWfgIAADwtByrGAgAAPC0HepYCAAA8LQdSegIAADwtB9JyAgAAPC0GnsoCAAA8LQbGdgIAADwtBoJ2AgAAPC0G5sYCAAA8LQbywgIAADwtBkqGAgAAPC0GzpoCAAA8LQemsgIAADwtBrJ6AgAAPC0HUq4CAAA8LQfemgIAADwtBgKaAgAAPC0GwoYCAAA8LQf6egIAADwtBjaOAgAAPC0GJrYCAAA8LQfeigIAADwtBoLGAgAAPC0Gun4CAAA8LQcalgIAADwtB6J6AgAAPC0GTooCAAA8LQcKvgIAADwtBw52AgAAPC0GLrICAAA8LQeGdgIAADwtBja+AgAAPC0HqoYCAAA8LQbStgIAADwtB0q+AgAAPC0HfsoCAAA8LQdKygIAADwtB8LCAgAAPC0GpooCAAA8LQfmjgIAADwtBmZ6AgAAPC0G1rICAAA8LQZuwgIAADwtBkrKAgAAPC0G2q4CAAA8LQcKigIAADwtB+LKAgAAPC0GepYCAAA8LQdCigIAADwtBup6AgAAPC0GBnoCAAA8LEMqAgIAAAAtB1qGAgAAhAQsgAQsWACAAIAAtAC1B/gFxIAFBAEdyOgAtCxkAIAAgAC0ALUH9AXEgAUEAR0EBdHI6AC0LGQAgACAALQAtQfsBcSABQQBHQQJ0cjoALQsZACAAIAAtAC1B9wFxIAFBAEdBA3RyOgAtCy4BAn9BACEDAkAgACgCOCIERQ0AIAQoAgAiBEUNACAAIAQRgICAgAAAIQMLIAMLSQECf0EAIQMCQCAAKAI4IgRFDQAgBCgCBCIERQ0AIAAgASACIAFrIAQRgYCAgAAAIgNBf0cNACAAQcaRgIAANgIQQRghAwsgAwsuAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAIwIgRFDQAgACAEEYCAgIAAACEDCyADC0kBAn9BACEDAkAgACgCOCIERQ0AIAQoAggiBEUNACAAIAEgAiABayAEEYGAgIAAACIDQX9HDQAgAEH2ioCAADYCEEEYIQMLIAMLLgECf0EAIQMCQCAAKAI4IgRFDQAgBCgCNCIERQ0AIAAgBBGAgICAAAAhAwsgAwtJAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAIMIgRFDQAgACABIAIgAWsgBBGBgICAAAAiA0F/Rw0AIABB7ZqAgAA2AhBBGCEDCyADCy4BAn9BACEDAkAgACgCOCIERQ0AIAQoAjgiBEUNACAAIAQRgICAgAAAIQMLIAMLSQECf0EAIQMCQCAAKAI4IgRFDQAgBCgCECIERQ0AIAAgASACIAFrIAQRgYCAgAAAIgNBf0cNACAAQZWQgIAANgIQQRghAwsgAwsuAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAI8IgRFDQAgACAEEYCAgIAAACEDCyADC0kBAn9BACEDAkAgACgCOCIERQ0AIAQoAhQiBEUNACAAIAEgAiABayAEEYGAgIAAACIDQX9HDQAgAEGqm4CAADYCEEEYIQMLIAMLLgECf0EAIQMCQCAAKAI4IgRFDQAgBCgCQCIERQ0AIAAgBBGAgICAAAAhAwsgAwtJAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAIYIgRFDQAgACABIAIgAWsgBBGBgICAAAAiA0F/Rw0AIABB7ZOAgAA2AhBBGCEDCyADCy4BAn9BACEDAkAgACgCOCIERQ0AIAQoAkQiBEUNACAAIAQRgICAgAAAIQMLIAMLLgECf0EAIQMCQCAAKAI4IgRFDQAgBCgCJCIERQ0AIAAgBBGAgICAAAAhAwsgAwsuAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAIsIgRFDQAgACAEEYCAgIAAACEDCyADC0kBAn9BACEDAkAgACgCOCIERQ0AIAQoAigiBEUNACAAIAEgAiABayAEEYGAgIAAACIDQX9HDQAgAEH2iICAADYCEEEYIQMLIAMLLgECf0EAIQMCQCAAKAI4IgRFDQAgBCgCUCIERQ0AIAAgBBGAgICAAAAhAwsgAwtJAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAIcIgRFDQAgACABIAIgAWsgBBGBgICAAAAiA0F/Rw0AIABBwpmAgAA2AhBBGCEDCyADCy4BAn9BACEDAkAgACgCOCIERQ0AIAQoAkgiBEUNACAAIAQRgICAgAAAIQMLIAMLSQECf0EAIQMCQCAAKAI4IgRFDQAgBCgCICIERQ0AIAAgASACIAFrIAQRgYCAgAAAIgNBf0cNACAAQZSUgIAANgIQQRghAwsgAwsuAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAJMIgRFDQAgACAEEYCAgIAAACEDCyADCy4BAn9BACEDAkAgACgCOCIERQ0AIAQoAlQiBEUNACAAIAQRgICAgAAAIQMLIAMLLgECf0EAIQMCQCAAKAI4IgRFDQAgBCgCWCIERQ0AIAAgBBGAgICAAAAhAwsgAwtFAQF/AkACQCAALwEwQRRxQRRHDQBBASEDIAAtAChBAUYNASAALwEyQeUARiEDDAELIAAtAClBBUYhAwsgACADOgAuQQAL/gEBA39BASEDAkAgAC8BMCIEQQhxDQAgACkDIEIAUiEDCwJAAkAgAC0ALkUNAEEBIQUgAC0AKUEFRg0BQQEhBSAEQcAAcUUgA3FBAUcNAQtBACEFIARBwABxDQBBAiEFIARB//8DcSIDQQhxDQACQCADQYAEcUUNAAJAIAAtAChBAUcNACAALQAtQQpxDQBBBQ8LQQQPCwJAIANBIHENAAJAIAAtAChBAUYNACAALwEyQf//A3EiAEGcf2pB5ABJDQAgAEHMAUYNACAAQbACRg0AQQQhBSAEQShxRQ0CIANBiARxQYAERg0CC0EADwtBAEEDIAApAyBQGyEFCyAFC2IBAn9BACEBAkAgAC0AKEEBRg0AIAAvATJB//8DcSICQZx/akHkAEkNACACQcwBRg0AIAJBsAJGDQAgAC8BMCIAQcAAcQ0AQQEhASAAQYgEcUGABEYNACAAQShxRSEBCyABC6cBAQN/AkACQAJAIAAtACpFDQAgAC0AK0UNAEEAIQMgAC8BMCIEQQJxRQ0BDAILQQAhAyAALwEwIgRBAXFFDQELQQEhAyAALQAoQQFGDQAgAC8BMkH//wNxIgVBnH9qQeQASQ0AIAVBzAFGDQAgBUGwAkYNACAEQcAAcQ0AQQAhAyAEQYgEcUGABEYNACAEQShxQQBHIQMLIABBADsBMCAAQQA6AC8gAwuZAQECfwJAAkACQCAALQAqRQ0AIAAtACtFDQBBACEBIAAvATAiAkECcUUNAQwCC0EAIQEgAC8BMCICQQFxRQ0BC0EBIQEgAC0AKEEBRg0AIAAvATJB//8DcSIAQZx/akHkAEkNACAAQcwBRg0AIABBsAJGDQAgAkHAAHENAEEAIQEgAkGIBHFBgARGDQAgAkEocUEARyEBCyABC1kAIABBGGpCADcDACAAQgA3AwAgAEE4akIANwMAIABBMGpCADcDACAAQShqQgA3AwAgAEEgakIANwMAIABBEGpCADcDACAAQQhqQgA3AwAgAEHdATYCHEEAC3sBAX8CQCAAKAIMIgMNAAJAIAAoAgRFDQAgACABNgIECwJAIAAgASACEMSAgIAAIgMNACAAKAIMDwsgACADNgIcQQAhAyAAKAIEIgFFDQAgACABIAIgACgCCBGBgICAAAAiAUUNACAAIAI2AhQgACABNgIMIAEhAwsgAwvk8wEDDn8DfgR/I4CAgIAAQRBrIgMkgICAgAAgASEEIAEhBSABIQYgASEHIAEhCCABIQkgASEKIAEhCyABIQwgASENIAEhDiABIQ8CQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgACgCHCIQQX9qDt0B2gEB2QECAwQFBgcICQoLDA0O2AEPENcBERLWARMUFRYXGBkaG+AB3wEcHR7VAR8gISIjJCXUASYnKCkqKyzTAdIBLS7RAdABLzAxMjM0NTY3ODk6Ozw9Pj9AQUJDREVG2wFHSElKzwHOAUvNAUzMAU1OT1BRUlNUVVZXWFlaW1xdXl9gYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXp7fH1+f4ABgQGCAYMBhAGFAYYBhwGIAYkBigGLAYwBjQGOAY8BkAGRAZIBkwGUAZUBlgGXAZgBmQGaAZsBnAGdAZ4BnwGgAaEBogGjAaQBpQGmAacBqAGpAaoBqwGsAa0BrgGvAbABsQGyAbMBtAG1AbYBtwHLAcoBuAHJAbkByAG6AbsBvAG9Ab4BvwHAAcEBwgHDAcQBxQHGAQDcAQtBACEQDMYBC0EOIRAMxQELQQ0hEAzEAQtBDyEQDMMBC0EQIRAMwgELQRMhEAzBAQtBFCEQDMABC0EVIRAMvwELQRYhEAy+AQtBFyEQDL0BC0EYIRAMvAELQRkhEAy7AQtBGiEQDLoBC0EbIRAMuQELQRwhEAy4AQtBCCEQDLcBC0EdIRAMtgELQSAhEAy1AQtBHyEQDLQBC0EHIRAMswELQSEhEAyyAQtBIiEQDLEBC0EeIRAMsAELQSMhEAyvAQtBEiEQDK4BC0ERIRAMrQELQSQhEAysAQtBJSEQDKsBC0EmIRAMqgELQSchEAypAQtBwwEhEAyoAQtBKSEQDKcBC0ErIRAMpgELQSwhEAylAQtBLSEQDKQBC0EuIRAMowELQS8hEAyiAQtBxAEhEAyhAQtBMCEQDKABC0E0IRAMnwELQQwhEAyeAQtBMSEQDJ0BC0EyIRAMnAELQTMhEAybAQtBOSEQDJoBC0E1IRAMmQELQcUBIRAMmAELQQshEAyXAQtBOiEQDJYBC0E2IRAMlQELQQohEAyUAQtBNyEQDJMBC0E4IRAMkgELQTwhEAyRAQtBOyEQDJABC0E9IRAMjwELQQkhEAyOAQtBKCEQDI0BC0E+IRAMjAELQT8hEAyLAQtBwAAhEAyKAQtBwQAhEAyJAQtBwgAhEAyIAQtBwwAhEAyHAQtBxAAhEAyGAQtBxQAhEAyFAQtBxgAhEAyEAQtBKiEQDIMBC0HHACEQDIIBC0HIACEQDIEBC0HJACEQDIABC0HKACEQDH8LQcsAIRAMfgtBzQAhEAx9C0HMACEQDHwLQc4AIRAMewtBzwAhEAx6C0HQACEQDHkLQdEAIRAMeAtB0gAhEAx3C0HTACEQDHYLQdQAIRAMdQtB1gAhEAx0C0HVACEQDHMLQQYhEAxyC0HXACEQDHELQQUhEAxwC0HYACEQDG8LQQQhEAxuC0HZACEQDG0LQdoAIRAMbAtB2wAhEAxrC0HcACEQDGoLQQMhEAxpC0HdACEQDGgLQd4AIRAMZwtB3wAhEAxmC0HhACEQDGULQeAAIRAMZAtB4gAhEAxjC0HjACEQDGILQQIhEAxhC0HkACEQDGALQeUAIRAMXwtB5gAhEAxeC0HnACEQDF0LQegAIRAMXAtB6QAhEAxbC0HqACEQDFoLQesAIRAMWQtB7AAhEAxYC0HtACEQDFcLQe4AIRAMVgtB7wAhEAxVC0HwACEQDFQLQfEAIRAMUwtB8gAhEAxSC0HzACEQDFELQfQAIRAMUAtB9QAhEAxPC0H2ACEQDE4LQfcAIRAMTQtB+AAhEAxMC0H5ACEQDEsLQfoAIRAMSgtB+wAhEAxJC0H8ACEQDEgLQf0AIRAMRwtB/gAhEAxGC0H/ACEQDEULQYABIRAMRAtBgQEhEAxDC0GCASEQDEILQYMBIRAMQQtBhAEhEAxAC0GFASEQDD8LQYYBIRAMPgtBhwEhEAw9C0GIASEQDDwLQYkBIRAMOwtBigEhEAw6C0GLASEQDDkLQYwBIRAMOAtBjQEhEAw3C0GOASEQDDYLQY8BIRAMNQtBkAEhEAw0C0GRASEQDDMLQZIBIRAMMgtBkwEhEAwxC0GUASEQDDALQZUBIRAMLwtBlgEhEAwuC0GXASEQDC0LQZgBIRAMLAtBmQEhEAwrC0GaASEQDCoLQZsBIRAMKQtBnAEhEAwoC0GdASEQDCcLQZ4BIRAMJgtBnwEhEAwlC0GgASEQDCQLQaEBIRAMIwtBogEhEAwiC0GjASEQDCELQaQBIRAMIAtBpQEhEAwfC0GmASEQDB4LQacBIRAMHQtBqAEhEAwcC0GpASEQDBsLQaoBIRAMGgtBqwEhEAwZC0GsASEQDBgLQa0BIRAMFwtBrgEhEAwWC0EBIRAMFQtBrwEhEAwUC0GwASEQDBMLQbEBIRAMEgtBswEhEAwRC0GyASEQDBALQbQBIRAMDwtBtQEhEAwOC0G2ASEQDA0LQbcBIRAMDAtBuAEhEAwLC0G5ASEQDAoLQboBIRAMCQtBuwEhEAwIC0HGASEQDAcLQbwBIRAMBgtBvQEhEAwFC0G+ASEQDAQLQb8BIRAMAwtBwAEhEAwCC0HCASEQDAELQcEBIRALA0ACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCAQDscBAAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxweHyAhIyUoP0BBREVGR0hJSktMTU9QUVJT3gNXWVtcXWBiZWZnaGlqa2xtb3BxcnN0dXZ3eHl6e3x9foABggGFAYYBhwGJAYsBjAGNAY4BjwGQAZEBlAGVAZYBlwGYAZkBmgGbAZwBnQGeAZ8BoAGhAaIBowGkAaUBpgGnAagBqQGqAasBrAGtAa4BrwGwAbEBsgGzAbQBtQG2AbcBuAG5AboBuwG8Ab0BvgG/AcABwQHCAcMBxAHFAcYBxwHIAckBygHLAcwBzQHOAc8B0AHRAdIB0wHUAdUB1gHXAdgB2QHaAdsB3AHdAd4B4AHhAeIB4wHkAeUB5gHnAegB6QHqAesB7AHtAe4B7wHwAfEB8gHzAZkCpAKwAv4C/gILIAEiBCACRw3zAUHdASEQDP8DCyABIhAgAkcN3QFBwwEhEAz+AwsgASIBIAJHDZABQfcAIRAM/QMLIAEiASACRw2GAUHvACEQDPwDCyABIgEgAkcNf0HqACEQDPsDCyABIgEgAkcNe0HoACEQDPoDCyABIgEgAkcNeEHmACEQDPkDCyABIgEgAkcNGkEYIRAM+AMLIAEiASACRw0UQRIhEAz3AwsgASIBIAJHDVlBxQAhEAz2AwsgASIBIAJHDUpBPyEQDPUDCyABIgEgAkcNSEE8IRAM9AMLIAEiASACRw1BQTEhEAzzAwsgAC0ALkEBRg3rAwyHAgsgACABIgEgAhDAgICAAEEBRw3mASAAQgA3AyAM5wELIAAgASIBIAIQtICAgAAiEA3nASABIQEM9QILAkAgASIBIAJHDQBBBiEQDPADCyAAIAFBAWoiASACELuAgIAAIhAN6AEgASEBDDELIABCADcDIEESIRAM1QMLIAEiECACRw0rQR0hEAztAwsCQCABIgEgAkYNACABQQFqIQFBECEQDNQDC0EHIRAM7AMLIABCACAAKQMgIhEgAiABIhBrrSISfSITIBMgEVYbNwMgIBEgElYiFEUN5QFBCCEQDOsDCwJAIAEiASACRg0AIABBiYCAgAA2AgggACABNgIEIAEhAUEUIRAM0gMLQQkhEAzqAwsgASEBIAApAyBQDeQBIAEhAQzyAgsCQCABIgEgAkcNAEELIRAM6QMLIAAgAUEBaiIBIAIQtoCAgAAiEA3lASABIQEM8gILIAAgASIBIAIQuICAgAAiEA3lASABIQEM8gILIAAgASIBIAIQuICAgAAiEA3mASABIQEMDQsgACABIgEgAhC6gICAACIQDecBIAEhAQzwAgsCQCABIgEgAkcNAEEPIRAM5QMLIAEtAAAiEEE7Rg0IIBBBDUcN6AEgAUEBaiEBDO8CCyAAIAEiASACELqAgIAAIhAN6AEgASEBDPICCwNAAkAgAS0AAEHwtYCAAGotAAAiEEEBRg0AIBBBAkcN6wEgACgCBCEQIABBADYCBCAAIBAgAUEBaiIBELmAgIAAIhAN6gEgASEBDPQCCyABQQFqIgEgAkcNAAtBEiEQDOIDCyAAIAEiASACELqAgIAAIhAN6QEgASEBDAoLIAEiASACRw0GQRshEAzgAwsCQCABIgEgAkcNAEEWIRAM4AMLIABBioCAgAA2AgggACABNgIEIAAgASACELiAgIAAIhAN6gEgASEBQSAhEAzGAwsCQCABIgEgAkYNAANAAkAgAS0AAEHwt4CAAGotAAAiEEECRg0AAkAgEEF/ag4E5QHsAQDrAewBCyABQQFqIQFBCCEQDMgDCyABQQFqIgEgAkcNAAtBFSEQDN8DC0EVIRAM3gMLA0ACQCABLQAAQfC5gIAAai0AACIQQQJGDQAgEEF/ag4E3gHsAeAB6wHsAQsgAUEBaiIBIAJHDQALQRghEAzdAwsCQCABIgEgAkYNACAAQYuAgIAANgIIIAAgATYCBCABIQFBByEQDMQDC0EZIRAM3AMLIAFBAWohAQwCCwJAIAEiFCACRw0AQRohEAzbAwsgFCEBAkAgFC0AAEFzag4U3QLuAu4C7gLuAu4C7gLuAu4C7gLuAu4C7gLuAu4C7gLuAu4C7gIA7gILQQAhECAAQQA2AhwgAEGvi4CAADYCECAAQQI2AgwgACAUQQFqNgIUDNoDCwJAIAEtAAAiEEE7Rg0AIBBBDUcN6AEgAUEBaiEBDOUCCyABQQFqIQELQSIhEAy/AwsCQCABIhAgAkcNAEEcIRAM2AMLQgAhESAQIQEgEC0AAEFQag435wHmAQECAwQFBgcIAAAAAAAAAAkKCwwNDgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADxAREhMUAAtBHiEQDL0DC0ICIREM5QELQgMhEQzkAQtCBCERDOMBC0IFIREM4gELQgYhEQzhAQtCByERDOABC0IIIREM3wELQgkhEQzeAQtCCiERDN0BC0ILIREM3AELQgwhEQzbAQtCDSERDNoBC0IOIREM2QELQg8hEQzYAQtCCiERDNcBC0ILIREM1gELQgwhEQzVAQtCDSERDNQBC0IOIREM0wELQg8hEQzSAQtCACERAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCAQLQAAQVBqDjflAeQBAAECAwQFBgfmAeYB5gHmAeYB5gHmAQgJCgsMDeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gEODxAREhPmAQtCAiERDOQBC0IDIREM4wELQgQhEQziAQtCBSERDOEBC0IGIREM4AELQgchEQzfAQtCCCERDN4BC0IJIREM3QELQgohEQzcAQtCCyERDNsBC0IMIREM2gELQg0hEQzZAQtCDiERDNgBC0IPIREM1wELQgohEQzWAQtCCyERDNUBC0IMIREM1AELQg0hEQzTAQtCDiERDNIBC0IPIREM0QELIABCACAAKQMgIhEgAiABIhBrrSISfSITIBMgEVYbNwMgIBEgElYiFEUN0gFBHyEQDMADCwJAIAEiASACRg0AIABBiYCAgAA2AgggACABNgIEIAEhAUEkIRAMpwMLQSAhEAy/AwsgACABIhAgAhC+gICAAEF/ag4FtgEAxQIB0QHSAQtBESEQDKQDCyAAQQE6AC8gECEBDLsDCyABIgEgAkcN0gFBJCEQDLsDCyABIg0gAkcNHkHGACEQDLoDCyAAIAEiASACELKAgIAAIhAN1AEgASEBDLUBCyABIhAgAkcNJkHQACEQDLgDCwJAIAEiASACRw0AQSghEAy4AwsgAEEANgIEIABBjICAgAA2AgggACABIAEQsYCAgAAiEA3TASABIQEM2AELAkAgASIQIAJHDQBBKSEQDLcDCyAQLQAAIgFBIEYNFCABQQlHDdMBIBBBAWohAQwVCwJAIAEiASACRg0AIAFBAWohAQwXC0EqIRAMtQMLAkAgASIQIAJHDQBBKyEQDLUDCwJAIBAtAAAiAUEJRg0AIAFBIEcN1QELIAAtACxBCEYN0wEgECEBDJEDCwJAIAEiASACRw0AQSwhEAy0AwsgAS0AAEEKRw3VASABQQFqIQEMyQILIAEiDiACRw3VAUEvIRAMsgMLA0ACQCABLQAAIhBBIEYNAAJAIBBBdmoOBADcAdwBANoBCyABIQEM4AELIAFBAWoiASACRw0AC0ExIRAMsQMLQTIhECABIhQgAkYNsAMgAiAUayAAKAIAIgFqIRUgFCABa0EDaiEWAkADQCAULQAAIhdBIHIgFyAXQb9/akH/AXFBGkkbQf8BcSABQfC7gIAAai0AAEcNAQJAIAFBA0cNAEEGIQEMlgMLIAFBAWohASAUQQFqIhQgAkcNAAsgACAVNgIADLEDCyAAQQA2AgAgFCEBDNkBC0EzIRAgASIUIAJGDa8DIAIgFGsgACgCACIBaiEVIBQgAWtBCGohFgJAA0AgFC0AACIXQSByIBcgF0G/f2pB/wFxQRpJG0H/AXEgAUH0u4CAAGotAABHDQECQCABQQhHDQBBBSEBDJUDCyABQQFqIQEgFEEBaiIUIAJHDQALIAAgFTYCAAywAwsgAEEANgIAIBQhAQzYAQtBNCEQIAEiFCACRg2uAyACIBRrIAAoAgAiAWohFSAUIAFrQQVqIRYCQANAIBQtAAAiF0EgciAXIBdBv39qQf8BcUEaSRtB/wFxIAFB0MKAgABqLQAARw0BAkAgAUEFRw0AQQchAQyUAwsgAUEBaiEBIBRBAWoiFCACRw0ACyAAIBU2AgAMrwMLIABBADYCACAUIQEM1wELAkAgASIBIAJGDQADQAJAIAEtAABBgL6AgABqLQAAIhBBAUYNACAQQQJGDQogASEBDN0BCyABQQFqIgEgAkcNAAtBMCEQDK4DC0EwIRAMrQMLAkAgASIBIAJGDQADQAJAIAEtAAAiEEEgRg0AIBBBdmoOBNkB2gHaAdkB2gELIAFBAWoiASACRw0AC0E4IRAMrQMLQTghEAysAwsDQAJAIAEtAAAiEEEgRg0AIBBBCUcNAwsgAUEBaiIBIAJHDQALQTwhEAyrAwsDQAJAIAEtAAAiEEEgRg0AAkACQCAQQXZqDgTaAQEB2gEACyAQQSxGDdsBCyABIQEMBAsgAUEBaiIBIAJHDQALQT8hEAyqAwsgASEBDNsBC0HAACEQIAEiFCACRg2oAyACIBRrIAAoAgAiAWohFiAUIAFrQQZqIRcCQANAIBQtAABBIHIgAUGAwICAAGotAABHDQEgAUEGRg2OAyABQQFqIQEgFEEBaiIUIAJHDQALIAAgFjYCAAypAwsgAEEANgIAIBQhAQtBNiEQDI4DCwJAIAEiDyACRw0AQcEAIRAMpwMLIABBjICAgAA2AgggACAPNgIEIA8hASAALQAsQX9qDgTNAdUB1wHZAYcDCyABQQFqIQEMzAELAkAgASIBIAJGDQADQAJAIAEtAAAiEEEgciAQIBBBv39qQf8BcUEaSRtB/wFxIhBBCUYNACAQQSBGDQACQAJAAkACQCAQQZ1/ag4TAAMDAwMDAwMBAwMDAwMDAwMDAgMLIAFBAWohAUExIRAMkQMLIAFBAWohAUEyIRAMkAMLIAFBAWohAUEzIRAMjwMLIAEhAQzQAQsgAUEBaiIBIAJHDQALQTUhEAylAwtBNSEQDKQDCwJAIAEiASACRg0AA0ACQCABLQAAQYC8gIAAai0AAEEBRg0AIAEhAQzTAQsgAUEBaiIBIAJHDQALQT0hEAykAwtBPSEQDKMDCyAAIAEiASACELCAgIAAIhAN1gEgASEBDAELIBBBAWohAQtBPCEQDIcDCwJAIAEiASACRw0AQcIAIRAMoAMLAkADQAJAIAEtAABBd2oOGAAC/gL+AoQD/gL+Av4C/gL+Av4C/gL+Av4C/gL+Av4C/gL+Av4C/gL+Av4CAP4CCyABQQFqIgEgAkcNAAtBwgAhEAygAwsgAUEBaiEBIAAtAC1BAXFFDb0BIAEhAQtBLCEQDIUDCyABIgEgAkcN0wFBxAAhEAydAwsDQAJAIAEtAABBkMCAgABqLQAAQQFGDQAgASEBDLcCCyABQQFqIgEgAkcNAAtBxQAhEAycAwsgDS0AACIQQSBGDbMBIBBBOkcNgQMgACgCBCEBIABBADYCBCAAIAEgDRCvgICAACIBDdABIA1BAWohAQyzAgtBxwAhECABIg0gAkYNmgMgAiANayAAKAIAIgFqIRYgDSABa0EFaiEXA0AgDS0AACIUQSByIBQgFEG/f2pB/wFxQRpJG0H/AXEgAUGQwoCAAGotAABHDYADIAFBBUYN9AIgAUEBaiEBIA1BAWoiDSACRw0ACyAAIBY2AgAMmgMLQcgAIRAgASINIAJGDZkDIAIgDWsgACgCACIBaiEWIA0gAWtBCWohFwNAIA0tAAAiFEEgciAUIBRBv39qQf8BcUEaSRtB/wFxIAFBlsKAgABqLQAARw3/AgJAIAFBCUcNAEECIQEM9QILIAFBAWohASANQQFqIg0gAkcNAAsgACAWNgIADJkDCwJAIAEiDSACRw0AQckAIRAMmQMLAkACQCANLQAAIgFBIHIgASABQb9/akH/AXFBGkkbQf8BcUGSf2oOBwCAA4ADgAOAA4ADAYADCyANQQFqIQFBPiEQDIADCyANQQFqIQFBPyEQDP8CC0HKACEQIAEiDSACRg2XAyACIA1rIAAoAgAiAWohFiANIAFrQQFqIRcDQCANLQAAIhRBIHIgFCAUQb9/akH/AXFBGkkbQf8BcSABQaDCgIAAai0AAEcN/QIgAUEBRg3wAiABQQFqIQEgDUEBaiINIAJHDQALIAAgFjYCAAyXAwtBywAhECABIg0gAkYNlgMgAiANayAAKAIAIgFqIRYgDSABa0EOaiEXA0AgDS0AACIUQSByIBQgFEG/f2pB/wFxQRpJG0H/AXEgAUGiwoCAAGotAABHDfwCIAFBDkYN8AIgAUEBaiEBIA1BAWoiDSACRw0ACyAAIBY2AgAMlgMLQcwAIRAgASINIAJGDZUDIAIgDWsgACgCACIBaiEWIA0gAWtBD2ohFwNAIA0tAAAiFEEgciAUIBRBv39qQf8BcUEaSRtB/wFxIAFBwMKAgABqLQAARw37AgJAIAFBD0cNAEEDIQEM8QILIAFBAWohASANQQFqIg0gAkcNAAsgACAWNgIADJUDC0HNACEQIAEiDSACRg2UAyACIA1rIAAoAgAiAWohFiANIAFrQQVqIRcDQCANLQAAIhRBIHIgFCAUQb9/akH/AXFBGkkbQf8BcSABQdDCgIAAai0AAEcN+gICQCABQQVHDQBBBCEBDPACCyABQQFqIQEgDUEBaiINIAJHDQALIAAgFjYCAAyUAwsCQCABIg0gAkcNAEHOACEQDJQDCwJAAkACQAJAIA0tAAAiAUEgciABIAFBv39qQf8BcUEaSRtB/wFxQZ1/ag4TAP0C/QL9Av0C/QL9Av0C/QL9Av0C/QL9AgH9Av0C/QICA/0CCyANQQFqIQFBwQAhEAz9AgsgDUEBaiEBQcIAIRAM/AILIA1BAWohAUHDACEQDPsCCyANQQFqIQFBxAAhEAz6AgsCQCABIgEgAkYNACAAQY2AgIAANgIIIAAgATYCBCABIQFBxQAhEAz6AgtBzwAhEAySAwsgECEBAkACQCAQLQAAQXZqDgQBqAKoAgCoAgsgEEEBaiEBC0EnIRAM+AILAkAgASIBIAJHDQBB0QAhEAyRAwsCQCABLQAAQSBGDQAgASEBDI0BCyABQQFqIQEgAC0ALUEBcUUNxwEgASEBDIwBCyABIhcgAkcNyAFB0gAhEAyPAwtB0wAhECABIhQgAkYNjgMgAiAUayAAKAIAIgFqIRYgFCABa0EBaiEXA0AgFC0AACABQdbCgIAAai0AAEcNzAEgAUEBRg3HASABQQFqIQEgFEEBaiIUIAJHDQALIAAgFjYCAAyOAwsCQCABIgEgAkcNAEHVACEQDI4DCyABLQAAQQpHDcwBIAFBAWohAQzHAQsCQCABIgEgAkcNAEHWACEQDI0DCwJAAkAgAS0AAEF2ag4EAM0BzQEBzQELIAFBAWohAQzHAQsgAUEBaiEBQcoAIRAM8wILIAAgASIBIAIQroCAgAAiEA3LASABIQFBzQAhEAzyAgsgAC0AKUEiRg2FAwymAgsCQCABIgEgAkcNAEHbACEQDIoDC0EAIRRBASEXQQEhFkEAIRACQAJAAkACQAJAAkACQAJAAkAgAS0AAEFQag4K1AHTAQABAgMEBQYI1QELQQIhEAwGC0EDIRAMBQtBBCEQDAQLQQUhEAwDC0EGIRAMAgtBByEQDAELQQghEAtBACEXQQAhFkEAIRQMzAELQQkhEEEBIRRBACEXQQAhFgzLAQsCQCABIgEgAkcNAEHdACEQDIkDCyABLQAAQS5HDcwBIAFBAWohAQymAgsgASIBIAJHDcwBQd8AIRAMhwMLAkAgASIBIAJGDQAgAEGOgICAADYCCCAAIAE2AgQgASEBQdAAIRAM7gILQeAAIRAMhgMLQeEAIRAgASIBIAJGDYUDIAIgAWsgACgCACIUaiEWIAEgFGtBA2ohFwNAIAEtAAAgFEHiwoCAAGotAABHDc0BIBRBA0YNzAEgFEEBaiEUIAFBAWoiASACRw0ACyAAIBY2AgAMhQMLQeIAIRAgASIBIAJGDYQDIAIgAWsgACgCACIUaiEWIAEgFGtBAmohFwNAIAEtAAAgFEHmwoCAAGotAABHDcwBIBRBAkYNzgEgFEEBaiEUIAFBAWoiASACRw0ACyAAIBY2AgAMhAMLQeMAIRAgASIBIAJGDYMDIAIgAWsgACgCACIUaiEWIAEgFGtBA2ohFwNAIAEtAAAgFEHpwoCAAGotAABHDcsBIBRBA0YNzgEgFEEBaiEUIAFBAWoiASACRw0ACyAAIBY2AgAMgwMLAkAgASIBIAJHDQBB5QAhEAyDAwsgACABQQFqIgEgAhCogICAACIQDc0BIAEhAUHWACEQDOkCCwJAIAEiASACRg0AA0ACQCABLQAAIhBBIEYNAAJAAkACQCAQQbh/ag4LAAHPAc8BzwHPAc8BzwHPAc8BAs8BCyABQQFqIQFB0gAhEAztAgsgAUEBaiEBQdMAIRAM7AILIAFBAWohAUHUACEQDOsCCyABQQFqIgEgAkcNAAtB5AAhEAyCAwtB5AAhEAyBAwsDQAJAIAEtAABB8MKAgABqLQAAIhBBAUYNACAQQX5qDgPPAdAB0QHSAQsgAUEBaiIBIAJHDQALQeYAIRAMgAMLAkAgASIBIAJGDQAgAUEBaiEBDAMLQecAIRAM/wILA0ACQCABLQAAQfDEgIAAai0AACIQQQFGDQACQCAQQX5qDgTSAdMB1AEA1QELIAEhAUHXACEQDOcCCyABQQFqIgEgAkcNAAtB6AAhEAz+AgsCQCABIgEgAkcNAEHpACEQDP4CCwJAIAEtAAAiEEF2ag4augHVAdUBvAHVAdUB1QHVAdUB1QHVAdUB1QHVAdUB1QHVAdUB1QHVAdUB1QHKAdUB1QEA0wELIAFBAWohAQtBBiEQDOMCCwNAAkAgAS0AAEHwxoCAAGotAABBAUYNACABIQEMngILIAFBAWoiASACRw0AC0HqACEQDPsCCwJAIAEiASACRg0AIAFBAWohAQwDC0HrACEQDPoCCwJAIAEiASACRw0AQewAIRAM+gILIAFBAWohAQwBCwJAIAEiASACRw0AQe0AIRAM+QILIAFBAWohAQtBBCEQDN4CCwJAIAEiFCACRw0AQe4AIRAM9wILIBQhAQJAAkACQCAULQAAQfDIgIAAai0AAEF/ag4H1AHVAdYBAJwCAQLXAQsgFEEBaiEBDAoLIBRBAWohAQzNAQtBACEQIABBADYCHCAAQZuSgIAANgIQIABBBzYCDCAAIBRBAWo2AhQM9gILAkADQAJAIAEtAABB8MiAgABqLQAAIhBBBEYNAAJAAkAgEEF/ag4H0gHTAdQB2QEABAHZAQsgASEBQdoAIRAM4AILIAFBAWohAUHcACEQDN8CCyABQQFqIgEgAkcNAAtB7wAhEAz2AgsgAUEBaiEBDMsBCwJAIAEiFCACRw0AQfAAIRAM9QILIBQtAABBL0cN1AEgFEEBaiEBDAYLAkAgASIUIAJHDQBB8QAhEAz0AgsCQCAULQAAIgFBL0cNACAUQQFqIQFB3QAhEAzbAgsgAUF2aiIEQRZLDdMBQQEgBHRBiYCAAnFFDdMBDMoCCwJAIAEiASACRg0AIAFBAWohAUHeACEQDNoCC0HyACEQDPICCwJAIAEiFCACRw0AQfQAIRAM8gILIBQhAQJAIBQtAABB8MyAgABqLQAAQX9qDgPJApQCANQBC0HhACEQDNgCCwJAIAEiFCACRg0AA0ACQCAULQAAQfDKgIAAai0AACIBQQNGDQACQCABQX9qDgLLAgDVAQsgFCEBQd8AIRAM2gILIBRBAWoiFCACRw0AC0HzACEQDPECC0HzACEQDPACCwJAIAEiASACRg0AIABBj4CAgAA2AgggACABNgIEIAEhAUHgACEQDNcCC0H1ACEQDO8CCwJAIAEiASACRw0AQfYAIRAM7wILIABBj4CAgAA2AgggACABNgIEIAEhAQtBAyEQDNQCCwNAIAEtAABBIEcNwwIgAUEBaiIBIAJHDQALQfcAIRAM7AILAkAgASIBIAJHDQBB+AAhEAzsAgsgAS0AAEEgRw3OASABQQFqIQEM7wELIAAgASIBIAIQrICAgAAiEA3OASABIQEMjgILAkAgASIEIAJHDQBB+gAhEAzqAgsgBC0AAEHMAEcN0QEgBEEBaiEBQRMhEAzPAQsCQCABIgQgAkcNAEH7ACEQDOkCCyACIARrIAAoAgAiAWohFCAEIAFrQQVqIRADQCAELQAAIAFB8M6AgABqLQAARw3QASABQQVGDc4BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQfsAIRAM6AILAkAgASIEIAJHDQBB/AAhEAzoAgsCQAJAIAQtAABBvX9qDgwA0QHRAdEB0QHRAdEB0QHRAdEB0QEB0QELIARBAWohAUHmACEQDM8CCyAEQQFqIQFB5wAhEAzOAgsCQCABIgQgAkcNAEH9ACEQDOcCCyACIARrIAAoAgAiAWohFCAEIAFrQQJqIRACQANAIAQtAAAgAUHtz4CAAGotAABHDc8BIAFBAkYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEH9ACEQDOcCCyAAQQA2AgAgEEEBaiEBQRAhEAzMAQsCQCABIgQgAkcNAEH+ACEQDOYCCyACIARrIAAoAgAiAWohFCAEIAFrQQVqIRACQANAIAQtAAAgAUH2zoCAAGotAABHDc4BIAFBBUYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEH+ACEQDOYCCyAAQQA2AgAgEEEBaiEBQRYhEAzLAQsCQCABIgQgAkcNAEH/ACEQDOUCCyACIARrIAAoAgAiAWohFCAEIAFrQQNqIRACQANAIAQtAAAgAUH8zoCAAGotAABHDc0BIAFBA0YNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEH/ACEQDOUCCyAAQQA2AgAgEEEBaiEBQQUhEAzKAQsCQCABIgQgAkcNAEGAASEQDOQCCyAELQAAQdkARw3LASAEQQFqIQFBCCEQDMkBCwJAIAEiBCACRw0AQYEBIRAM4wILAkACQCAELQAAQbJ/ag4DAMwBAcwBCyAEQQFqIQFB6wAhEAzKAgsgBEEBaiEBQewAIRAMyQILAkAgASIEIAJHDQBBggEhEAziAgsCQAJAIAQtAABBuH9qDggAywHLAcsBywHLAcsBAcsBCyAEQQFqIQFB6gAhEAzJAgsgBEEBaiEBQe0AIRAMyAILAkAgASIEIAJHDQBBgwEhEAzhAgsgAiAEayAAKAIAIgFqIRAgBCABa0ECaiEUAkADQCAELQAAIAFBgM+AgABqLQAARw3JASABQQJGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBA2AgBBgwEhEAzhAgtBACEQIABBADYCACAUQQFqIQEMxgELAkAgASIEIAJHDQBBhAEhEAzgAgsgAiAEayAAKAIAIgFqIRQgBCABa0EEaiEQAkADQCAELQAAIAFBg8+AgABqLQAARw3IASABQQRGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBhAEhEAzgAgsgAEEANgIAIBBBAWohAUEjIRAMxQELAkAgASIEIAJHDQBBhQEhEAzfAgsCQAJAIAQtAABBtH9qDggAyAHIAcgByAHIAcgBAcgBCyAEQQFqIQFB7wAhEAzGAgsgBEEBaiEBQfAAIRAMxQILAkAgASIEIAJHDQBBhgEhEAzeAgsgBC0AAEHFAEcNxQEgBEEBaiEBDIMCCwJAIAEiBCACRw0AQYcBIRAM3QILIAIgBGsgACgCACIBaiEUIAQgAWtBA2ohEAJAA0AgBC0AACABQYjPgIAAai0AAEcNxQEgAUEDRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQYcBIRAM3QILIABBADYCACAQQQFqIQFBLSEQDMIBCwJAIAEiBCACRw0AQYgBIRAM3AILIAIgBGsgACgCACIBaiEUIAQgAWtBCGohEAJAA0AgBC0AACABQdDPgIAAai0AAEcNxAEgAUEIRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQYgBIRAM3AILIABBADYCACAQQQFqIQFBKSEQDMEBCwJAIAEiASACRw0AQYkBIRAM2wILQQEhECABLQAAQd8ARw3AASABQQFqIQEMgQILAkAgASIEIAJHDQBBigEhEAzaAgsgAiAEayAAKAIAIgFqIRQgBCABa0EBaiEQA0AgBC0AACABQYzPgIAAai0AAEcNwQEgAUEBRg2vAiABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGKASEQDNkCCwJAIAEiBCACRw0AQYsBIRAM2QILIAIgBGsgACgCACIBaiEUIAQgAWtBAmohEAJAA0AgBC0AACABQY7PgIAAai0AAEcNwQEgAUECRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQYsBIRAM2QILIABBADYCACAQQQFqIQFBAiEQDL4BCwJAIAEiBCACRw0AQYwBIRAM2AILIAIgBGsgACgCACIBaiEUIAQgAWtBAWohEAJAA0AgBC0AACABQfDPgIAAai0AAEcNwAEgAUEBRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQYwBIRAM2AILIABBADYCACAQQQFqIQFBHyEQDL0BCwJAIAEiBCACRw0AQY0BIRAM1wILIAIgBGsgACgCACIBaiEUIAQgAWtBAWohEAJAA0AgBC0AACABQfLPgIAAai0AAEcNvwEgAUEBRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQY0BIRAM1wILIABBADYCACAQQQFqIQFBCSEQDLwBCwJAIAEiBCACRw0AQY4BIRAM1gILAkACQCAELQAAQbd/ag4HAL8BvwG/Ab8BvwEBvwELIARBAWohAUH4ACEQDL0CCyAEQQFqIQFB+QAhEAy8AgsCQCABIgQgAkcNAEGPASEQDNUCCyACIARrIAAoAgAiAWohFCAEIAFrQQVqIRACQANAIAQtAAAgAUGRz4CAAGotAABHDb0BIAFBBUYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGPASEQDNUCCyAAQQA2AgAgEEEBaiEBQRghEAy6AQsCQCABIgQgAkcNAEGQASEQDNQCCyACIARrIAAoAgAiAWohFCAEIAFrQQJqIRACQANAIAQtAAAgAUGXz4CAAGotAABHDbwBIAFBAkYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGQASEQDNQCCyAAQQA2AgAgEEEBaiEBQRchEAy5AQsCQCABIgQgAkcNAEGRASEQDNMCCyACIARrIAAoAgAiAWohFCAEIAFrQQZqIRACQANAIAQtAAAgAUGaz4CAAGotAABHDbsBIAFBBkYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGRASEQDNMCCyAAQQA2AgAgEEEBaiEBQRUhEAy4AQsCQCABIgQgAkcNAEGSASEQDNICCyACIARrIAAoAgAiAWohFCAEIAFrQQVqIRACQANAIAQtAAAgAUGhz4CAAGotAABHDboBIAFBBUYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGSASEQDNICCyAAQQA2AgAgEEEBaiEBQR4hEAy3AQsCQCABIgQgAkcNAEGTASEQDNECCyAELQAAQcwARw24ASAEQQFqIQFBCiEQDLYBCwJAIAQgAkcNAEGUASEQDNACCwJAAkAgBC0AAEG/f2oODwC5AbkBuQG5AbkBuQG5AbkBuQG5AbkBuQG5AQG5AQsgBEEBaiEBQf4AIRAMtwILIARBAWohAUH/ACEQDLYCCwJAIAQgAkcNAEGVASEQDM8CCwJAAkAgBC0AAEG/f2oOAwC4AQG4AQsgBEEBaiEBQf0AIRAMtgILIARBAWohBEGAASEQDLUCCwJAIAQgAkcNAEGWASEQDM4CCyACIARrIAAoAgAiAWohFCAEIAFrQQFqIRACQANAIAQtAAAgAUGnz4CAAGotAABHDbYBIAFBAUYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGWASEQDM4CCyAAQQA2AgAgEEEBaiEBQQshEAyzAQsCQCAEIAJHDQBBlwEhEAzNAgsCQAJAAkACQCAELQAAQVNqDiMAuAG4AbgBuAG4AbgBuAG4AbgBuAG4AbgBuAG4AbgBuAG4AbgBuAG4AbgBuAG4AQG4AbgBuAG4AbgBArgBuAG4AQO4AQsgBEEBaiEBQfsAIRAMtgILIARBAWohAUH8ACEQDLUCCyAEQQFqIQRBgQEhEAy0AgsgBEEBaiEEQYIBIRAMswILAkAgBCACRw0AQZgBIRAMzAILIAIgBGsgACgCACIBaiEUIAQgAWtBBGohEAJAA0AgBC0AACABQanPgIAAai0AAEcNtAEgAUEERg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQZgBIRAMzAILIABBADYCACAQQQFqIQFBGSEQDLEBCwJAIAQgAkcNAEGZASEQDMsCCyACIARrIAAoAgAiAWohFCAEIAFrQQVqIRACQANAIAQtAAAgAUGuz4CAAGotAABHDbMBIAFBBUYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGZASEQDMsCCyAAQQA2AgAgEEEBaiEBQQYhEAywAQsCQCAEIAJHDQBBmgEhEAzKAgsgAiAEayAAKAIAIgFqIRQgBCABa0EBaiEQAkADQCAELQAAIAFBtM+AgABqLQAARw2yASABQQFGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBmgEhEAzKAgsgAEEANgIAIBBBAWohAUEcIRAMrwELAkAgBCACRw0AQZsBIRAMyQILIAIgBGsgACgCACIBaiEUIAQgAWtBAWohEAJAA0AgBC0AACABQbbPgIAAai0AAEcNsQEgAUEBRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQZsBIRAMyQILIABBADYCACAQQQFqIQFBJyEQDK4BCwJAIAQgAkcNAEGcASEQDMgCCwJAAkAgBC0AAEGsf2oOAgABsQELIARBAWohBEGGASEQDK8CCyAEQQFqIQRBhwEhEAyuAgsCQCAEIAJHDQBBnQEhEAzHAgsgAiAEayAAKAIAIgFqIRQgBCABa0EBaiEQAkADQCAELQAAIAFBuM+AgABqLQAARw2vASABQQFGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBnQEhEAzHAgsgAEEANgIAIBBBAWohAUEmIRAMrAELAkAgBCACRw0AQZ4BIRAMxgILIAIgBGsgACgCACIBaiEUIAQgAWtBAWohEAJAA0AgBC0AACABQbrPgIAAai0AAEcNrgEgAUEBRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQZ4BIRAMxgILIABBADYCACAQQQFqIQFBAyEQDKsBCwJAIAQgAkcNAEGfASEQDMUCCyACIARrIAAoAgAiAWohFCAEIAFrQQJqIRACQANAIAQtAAAgAUHtz4CAAGotAABHDa0BIAFBAkYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGfASEQDMUCCyAAQQA2AgAgEEEBaiEBQQwhEAyqAQsCQCAEIAJHDQBBoAEhEAzEAgsgAiAEayAAKAIAIgFqIRQgBCABa0EDaiEQAkADQCAELQAAIAFBvM+AgABqLQAARw2sASABQQNGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBoAEhEAzEAgsgAEEANgIAIBBBAWohAUENIRAMqQELAkAgBCACRw0AQaEBIRAMwwILAkACQCAELQAAQbp/ag4LAKwBrAGsAawBrAGsAawBrAGsAQGsAQsgBEEBaiEEQYsBIRAMqgILIARBAWohBEGMASEQDKkCCwJAIAQgAkcNAEGiASEQDMICCyAELQAAQdAARw2pASAEQQFqIQQM6QELAkAgBCACRw0AQaMBIRAMwQILAkACQCAELQAAQbd/ag4HAaoBqgGqAaoBqgEAqgELIARBAWohBEGOASEQDKgCCyAEQQFqIQFBIiEQDKYBCwJAIAQgAkcNAEGkASEQDMACCyACIARrIAAoAgAiAWohFCAEIAFrQQFqIRACQANAIAQtAAAgAUHAz4CAAGotAABHDagBIAFBAUYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGkASEQDMACCyAAQQA2AgAgEEEBaiEBQR0hEAylAQsCQCAEIAJHDQBBpQEhEAy/AgsCQAJAIAQtAABBrn9qDgMAqAEBqAELIARBAWohBEGQASEQDKYCCyAEQQFqIQFBBCEQDKQBCwJAIAQgAkcNAEGmASEQDL4CCwJAAkACQAJAAkAgBC0AAEG/f2oOFQCqAaoBqgGqAaoBqgGqAaoBqgGqAQGqAaoBAqoBqgEDqgGqAQSqAQsgBEEBaiEEQYgBIRAMqAILIARBAWohBEGJASEQDKcCCyAEQQFqIQRBigEhEAymAgsgBEEBaiEEQY8BIRAMpQILIARBAWohBEGRASEQDKQCCwJAIAQgAkcNAEGnASEQDL0CCyACIARrIAAoAgAiAWohFCAEIAFrQQJqIRACQANAIAQtAAAgAUHtz4CAAGotAABHDaUBIAFBAkYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGnASEQDL0CCyAAQQA2AgAgEEEBaiEBQREhEAyiAQsCQCAEIAJHDQBBqAEhEAy8AgsgAiAEayAAKAIAIgFqIRQgBCABa0ECaiEQAkADQCAELQAAIAFBws+AgABqLQAARw2kASABQQJGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBqAEhEAy8AgsgAEEANgIAIBBBAWohAUEsIRAMoQELAkAgBCACRw0AQakBIRAMuwILIAIgBGsgACgCACIBaiEUIAQgAWtBBGohEAJAA0AgBC0AACABQcXPgIAAai0AAEcNowEgAUEERg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQakBIRAMuwILIABBADYCACAQQQFqIQFBKyEQDKABCwJAIAQgAkcNAEGqASEQDLoCCyACIARrIAAoAgAiAWohFCAEIAFrQQJqIRACQANAIAQtAAAgAUHKz4CAAGotAABHDaIBIAFBAkYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGqASEQDLoCCyAAQQA2AgAgEEEBaiEBQRQhEAyfAQsCQCAEIAJHDQBBqwEhEAy5AgsCQAJAAkACQCAELQAAQb5/ag4PAAECpAGkAaQBpAGkAaQBpAGkAaQBpAGkAQOkAQsgBEEBaiEEQZMBIRAMogILIARBAWohBEGUASEQDKECCyAEQQFqIQRBlQEhEAygAgsgBEEBaiEEQZYBIRAMnwILAkAgBCACRw0AQawBIRAMuAILIAQtAABBxQBHDZ8BIARBAWohBAzgAQsCQCAEIAJHDQBBrQEhEAy3AgsgAiAEayAAKAIAIgFqIRQgBCABa0ECaiEQAkADQCAELQAAIAFBzc+AgABqLQAARw2fASABQQJGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBrQEhEAy3AgsgAEEANgIAIBBBAWohAUEOIRAMnAELAkAgBCACRw0AQa4BIRAMtgILIAQtAABB0ABHDZ0BIARBAWohAUElIRAMmwELAkAgBCACRw0AQa8BIRAMtQILIAIgBGsgACgCACIBaiEUIAQgAWtBCGohEAJAA0AgBC0AACABQdDPgIAAai0AAEcNnQEgAUEIRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQa8BIRAMtQILIABBADYCACAQQQFqIQFBKiEQDJoBCwJAIAQgAkcNAEGwASEQDLQCCwJAAkAgBC0AAEGrf2oOCwCdAZ0BnQGdAZ0BnQGdAZ0BnQEBnQELIARBAWohBEGaASEQDJsCCyAEQQFqIQRBmwEhEAyaAgsCQCAEIAJHDQBBsQEhEAyzAgsCQAJAIAQtAABBv39qDhQAnAGcAZwBnAGcAZwBnAGcAZwBnAGcAZwBnAGcAZwBnAGcAZwBAZwBCyAEQQFqIQRBmQEhEAyaAgsgBEEBaiEEQZwBIRAMmQILAkAgBCACRw0AQbIBIRAMsgILIAIgBGsgACgCACIBaiEUIAQgAWtBA2ohEAJAA0AgBC0AACABQdnPgIAAai0AAEcNmgEgAUEDRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQbIBIRAMsgILIABBADYCACAQQQFqIQFBISEQDJcBCwJAIAQgAkcNAEGzASEQDLECCyACIARrIAAoAgAiAWohFCAEIAFrQQZqIRACQANAIAQtAAAgAUHdz4CAAGotAABHDZkBIAFBBkYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGzASEQDLECCyAAQQA2AgAgEEEBaiEBQRohEAyWAQsCQCAEIAJHDQBBtAEhEAywAgsCQAJAAkAgBC0AAEG7f2oOEQCaAZoBmgGaAZoBmgGaAZoBmgEBmgGaAZoBmgGaAQKaAQsgBEEBaiEEQZ0BIRAMmAILIARBAWohBEGeASEQDJcCCyAEQQFqIQRBnwEhEAyWAgsCQCAEIAJHDQBBtQEhEAyvAgsgAiAEayAAKAIAIgFqIRQgBCABa0EFaiEQAkADQCAELQAAIAFB5M+AgABqLQAARw2XASABQQVGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBtQEhEAyvAgsgAEEANgIAIBBBAWohAUEoIRAMlAELAkAgBCACRw0AQbYBIRAMrgILIAIgBGsgACgCACIBaiEUIAQgAWtBAmohEAJAA0AgBC0AACABQerPgIAAai0AAEcNlgEgAUECRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQbYBIRAMrgILIABBADYCACAQQQFqIQFBByEQDJMBCwJAIAQgAkcNAEG3ASEQDK0CCwJAAkAgBC0AAEG7f2oODgCWAZYBlgGWAZYBlgGWAZYBlgGWAZYBlgEBlgELIARBAWohBEGhASEQDJQCCyAEQQFqIQRBogEhEAyTAgsCQCAEIAJHDQBBuAEhEAysAgsgAiAEayAAKAIAIgFqIRQgBCABa0ECaiEQAkADQCAELQAAIAFB7c+AgABqLQAARw2UASABQQJGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBuAEhEAysAgsgAEEANgIAIBBBAWohAUESIRAMkQELAkAgBCACRw0AQbkBIRAMqwILIAIgBGsgACgCACIBaiEUIAQgAWtBAWohEAJAA0AgBC0AACABQfDPgIAAai0AAEcNkwEgAUEBRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQbkBIRAMqwILIABBADYCACAQQQFqIQFBICEQDJABCwJAIAQgAkcNAEG6ASEQDKoCCyACIARrIAAoAgAiAWohFCAEIAFrQQFqIRACQANAIAQtAAAgAUHyz4CAAGotAABHDZIBIAFBAUYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEG6ASEQDKoCCyAAQQA2AgAgEEEBaiEBQQ8hEAyPAQsCQCAEIAJHDQBBuwEhEAypAgsCQAJAIAQtAABBt39qDgcAkgGSAZIBkgGSAQGSAQsgBEEBaiEEQaUBIRAMkAILIARBAWohBEGmASEQDI8CCwJAIAQgAkcNAEG8ASEQDKgCCyACIARrIAAoAgAiAWohFCAEIAFrQQdqIRACQANAIAQtAAAgAUH0z4CAAGotAABHDZABIAFBB0YNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEG8ASEQDKgCCyAAQQA2AgAgEEEBaiEBQRshEAyNAQsCQCAEIAJHDQBBvQEhEAynAgsCQAJAAkAgBC0AAEG+f2oOEgCRAZEBkQGRAZEBkQGRAZEBkQEBkQGRAZEBkQGRAZEBApEBCyAEQQFqIQRBpAEhEAyPAgsgBEEBaiEEQacBIRAMjgILIARBAWohBEGoASEQDI0CCwJAIAQgAkcNAEG+ASEQDKYCCyAELQAAQc4ARw2NASAEQQFqIQQMzwELAkAgBCACRw0AQb8BIRAMpQILAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgBC0AAEG/f2oOFQABAgOcAQQFBpwBnAGcAQcICQoLnAEMDQ4PnAELIARBAWohAUHoACEQDJoCCyAEQQFqIQFB6QAhEAyZAgsgBEEBaiEBQe4AIRAMmAILIARBAWohAUHyACEQDJcCCyAEQQFqIQFB8wAhEAyWAgsgBEEBaiEBQfYAIRAMlQILIARBAWohAUH3ACEQDJQCCyAEQQFqIQFB+gAhEAyTAgsgBEEBaiEEQYMBIRAMkgILIARBAWohBEGEASEQDJECCyAEQQFqIQRBhQEhEAyQAgsgBEEBaiEEQZIBIRAMjwILIARBAWohBEGYASEQDI4CCyAEQQFqIQRBoAEhEAyNAgsgBEEBaiEEQaMBIRAMjAILIARBAWohBEGqASEQDIsCCwJAIAQgAkYNACAAQZCAgIAANgIIIAAgBDYCBEGrASEQDIsCC0HAASEQDKMCCyAAIAUgAhCqgICAACIBDYsBIAUhAQxcCwJAIAYgAkYNACAGQQFqIQUMjQELQcIBIRAMoQILA0ACQCAQLQAAQXZqDgSMAQAAjwEACyAQQQFqIhAgAkcNAAtBwwEhEAygAgsCQCAHIAJGDQAgAEGRgICAADYCCCAAIAc2AgQgByEBQQEhEAyHAgtBxAEhEAyfAgsCQCAHIAJHDQBBxQEhEAyfAgsCQAJAIActAABBdmoOBAHOAc4BAM4BCyAHQQFqIQYMjQELIAdBAWohBQyJAQsCQCAHIAJHDQBBxgEhEAyeAgsCQAJAIActAABBdmoOFwGPAY8BAY8BjwGPAY8BjwGPAY8BjwGPAY8BjwGPAY8BjwGPAY8BjwGPAQCPAQsgB0EBaiEHC0GwASEQDIQCCwJAIAggAkcNAEHIASEQDJ0CCyAILQAAQSBHDY0BIABBADsBMiAIQQFqIQFBswEhEAyDAgsgASEXAkADQCAXIgcgAkYNASAHLQAAQVBqQf8BcSIQQQpPDcwBAkAgAC8BMiIUQZkzSw0AIAAgFEEKbCIUOwEyIBBB//8DcyAUQf7/A3FJDQAgB0EBaiEXIAAgFCAQaiIQOwEyIBBB//8DcUHoB0kNAQsLQQAhECAAQQA2AhwgAEHBiYCAADYCECAAQQ02AgwgACAHQQFqNgIUDJwCC0HHASEQDJsCCyAAIAggAhCugICAACIQRQ3KASAQQRVHDYwBIABByAE2AhwgACAINgIUIABByZeAgAA2AhAgAEEVNgIMQQAhEAyaAgsCQCAJIAJHDQBBzAEhEAyaAgtBACEUQQEhF0EBIRZBACEQAkACQAJAAkACQAJAAkACQAJAIAktAABBUGoOCpYBlQEAAQIDBAUGCJcBC0ECIRAMBgtBAyEQDAULQQQhEAwEC0EFIRAMAwtBBiEQDAILQQchEAwBC0EIIRALQQAhF0EAIRZBACEUDI4BC0EJIRBBASEUQQAhF0EAIRYMjQELAkAgCiACRw0AQc4BIRAMmQILIAotAABBLkcNjgEgCkEBaiEJDMoBCyALIAJHDY4BQdABIRAMlwILAkAgCyACRg0AIABBjoCAgAA2AgggACALNgIEQbcBIRAM/gELQdEBIRAMlgILAkAgBCACRw0AQdIBIRAMlgILIAIgBGsgACgCACIQaiEUIAQgEGtBBGohCwNAIAQtAAAgEEH8z4CAAGotAABHDY4BIBBBBEYN6QEgEEEBaiEQIARBAWoiBCACRw0ACyAAIBQ2AgBB0gEhEAyVAgsgACAMIAIQrICAgAAiAQ2NASAMIQEMuAELAkAgBCACRw0AQdQBIRAMlAILIAIgBGsgACgCACIQaiEUIAQgEGtBAWohDANAIAQtAAAgEEGB0ICAAGotAABHDY8BIBBBAUYNjgEgEEEBaiEQIARBAWoiBCACRw0ACyAAIBQ2AgBB1AEhEAyTAgsCQCAEIAJHDQBB1gEhEAyTAgsgAiAEayAAKAIAIhBqIRQgBCAQa0ECaiELA0AgBC0AACAQQYPQgIAAai0AAEcNjgEgEEECRg2QASAQQQFqIRAgBEEBaiIEIAJHDQALIAAgFDYCAEHWASEQDJICCwJAIAQgAkcNAEHXASEQDJICCwJAAkAgBC0AAEG7f2oOEACPAY8BjwGPAY8BjwGPAY8BjwGPAY8BjwGPAY8BAY8BCyAEQQFqIQRBuwEhEAz5AQsgBEEBaiEEQbwBIRAM+AELAkAgBCACRw0AQdgBIRAMkQILIAQtAABByABHDYwBIARBAWohBAzEAQsCQCAEIAJGDQAgAEGQgICAADYCCCAAIAQ2AgRBvgEhEAz3AQtB2QEhEAyPAgsCQCAEIAJHDQBB2gEhEAyPAgsgBC0AAEHIAEYNwwEgAEEBOgAoDLkBCyAAQQI6AC8gACAEIAIQpoCAgAAiEA2NAUHCASEQDPQBCyAALQAoQX9qDgK3AbkBuAELA0ACQCAELQAAQXZqDgQAjgGOAQCOAQsgBEEBaiIEIAJHDQALQd0BIRAMiwILIABBADoALyAALQAtQQRxRQ2EAgsgAEEAOgAvIABBAToANCABIQEMjAELIBBBFUYN2gEgAEEANgIcIAAgATYCFCAAQaeOgIAANgIQIABBEjYCDEEAIRAMiAILAkAgACAQIAIQtICAgAAiBA0AIBAhAQyBAgsCQCAEQRVHDQAgAEEDNgIcIAAgEDYCFCAAQbCYgIAANgIQIABBFTYCDEEAIRAMiAILIABBADYCHCAAIBA2AhQgAEGnjoCAADYCECAAQRI2AgxBACEQDIcCCyAQQRVGDdYBIABBADYCHCAAIAE2AhQgAEHajYCAADYCECAAQRQ2AgxBACEQDIYCCyAAKAIEIRcgAEEANgIEIBAgEadqIhYhASAAIBcgECAWIBQbIhAQtYCAgAAiFEUNjQEgAEEHNgIcIAAgEDYCFCAAIBQ2AgxBACEQDIUCCyAAIAAvATBBgAFyOwEwIAEhAQtBKiEQDOoBCyAQQRVGDdEBIABBADYCHCAAIAE2AhQgAEGDjICAADYCECAAQRM2AgxBACEQDIICCyAQQRVGDc8BIABBADYCHCAAIAE2AhQgAEGaj4CAADYCECAAQSI2AgxBACEQDIECCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQt4CAgAAiEA0AIAFBAWohAQyNAQsgAEEMNgIcIAAgEDYCDCAAIAFBAWo2AhRBACEQDIACCyAQQRVGDcwBIABBADYCHCAAIAE2AhQgAEGaj4CAADYCECAAQSI2AgxBACEQDP8BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQt4CAgAAiEA0AIAFBAWohAQyMAQsgAEENNgIcIAAgEDYCDCAAIAFBAWo2AhRBACEQDP4BCyAQQRVGDckBIABBADYCHCAAIAE2AhQgAEHGjICAADYCECAAQSM2AgxBACEQDP0BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQuYCAgAAiEA0AIAFBAWohAQyLAQsgAEEONgIcIAAgEDYCDCAAIAFBAWo2AhRBACEQDPwBCyAAQQA2AhwgACABNgIUIABBwJWAgAA2AhAgAEECNgIMQQAhEAz7AQsgEEEVRg3FASAAQQA2AhwgACABNgIUIABBxoyAgAA2AhAgAEEjNgIMQQAhEAz6AQsgAEEQNgIcIAAgATYCFCAAIBA2AgxBACEQDPkBCyAAKAIEIQQgAEEANgIEAkAgACAEIAEQuYCAgAAiBA0AIAFBAWohAQzxAQsgAEERNgIcIAAgBDYCDCAAIAFBAWo2AhRBACEQDPgBCyAQQRVGDcEBIABBADYCHCAAIAE2AhQgAEHGjICAADYCECAAQSM2AgxBACEQDPcBCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQuYCAgAAiEA0AIAFBAWohAQyIAQsgAEETNgIcIAAgEDYCDCAAIAFBAWo2AhRBACEQDPYBCyAAKAIEIQQgAEEANgIEAkAgACAEIAEQuYCAgAAiBA0AIAFBAWohAQztAQsgAEEUNgIcIAAgBDYCDCAAIAFBAWo2AhRBACEQDPUBCyAQQRVGDb0BIABBADYCHCAAIAE2AhQgAEGaj4CAADYCECAAQSI2AgxBACEQDPQBCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQt4CAgAAiEA0AIAFBAWohAQyGAQsgAEEWNgIcIAAgEDYCDCAAIAFBAWo2AhRBACEQDPMBCyAAKAIEIQQgAEEANgIEAkAgACAEIAEQt4CAgAAiBA0AIAFBAWohAQzpAQsgAEEXNgIcIAAgBDYCDCAAIAFBAWo2AhRBACEQDPIBCyAAQQA2AhwgACABNgIUIABBzZOAgAA2AhAgAEEMNgIMQQAhEAzxAQtCASERCyAQQQFqIQECQCAAKQMgIhJC//////////8PVg0AIAAgEkIEhiARhDcDICABIQEMhAELIABBADYCHCAAIAE2AhQgAEGtiYCAADYCECAAQQw2AgxBACEQDO8BCyAAQQA2AhwgACAQNgIUIABBzZOAgAA2AhAgAEEMNgIMQQAhEAzuAQsgACgCBCEXIABBADYCBCAQIBGnaiIWIQEgACAXIBAgFiAUGyIQELWAgIAAIhRFDXMgAEEFNgIcIAAgEDYCFCAAIBQ2AgxBACEQDO0BCyAAQQA2AhwgACAQNgIUIABBqpyAgAA2AhAgAEEPNgIMQQAhEAzsAQsgACAQIAIQtICAgAAiAQ0BIBAhAQtBDiEQDNEBCwJAIAFBFUcNACAAQQI2AhwgACAQNgIUIABBsJiAgAA2AhAgAEEVNgIMQQAhEAzqAQsgAEEANgIcIAAgEDYCFCAAQaeOgIAANgIQIABBEjYCDEEAIRAM6QELIAFBAWohEAJAIAAvATAiAUGAAXFFDQACQCAAIBAgAhC7gICAACIBDQAgECEBDHALIAFBFUcNugEgAEEFNgIcIAAgEDYCFCAAQfmXgIAANgIQIABBFTYCDEEAIRAM6QELAkAgAUGgBHFBoARHDQAgAC0ALUECcQ0AIABBADYCHCAAIBA2AhQgAEGWk4CAADYCECAAQQQ2AgxBACEQDOkBCyAAIBAgAhC9gICAABogECEBAkACQAJAAkACQCAAIBAgAhCzgICAAA4WAgEABAQEBAQEBAQEBAQEBAQEBAQEAwQLIABBAToALgsgACAALwEwQcAAcjsBMCAQIQELQSYhEAzRAQsgAEEjNgIcIAAgEDYCFCAAQaWWgIAANgIQIABBFTYCDEEAIRAM6QELIABBADYCHCAAIBA2AhQgAEHVi4CAADYCECAAQRE2AgxBACEQDOgBCyAALQAtQQFxRQ0BQcMBIRAMzgELAkAgDSACRg0AA0ACQCANLQAAQSBGDQAgDSEBDMQBCyANQQFqIg0gAkcNAAtBJSEQDOcBC0ElIRAM5gELIAAoAgQhBCAAQQA2AgQgACAEIA0Qr4CAgAAiBEUNrQEgAEEmNgIcIAAgBDYCDCAAIA1BAWo2AhRBACEQDOUBCyAQQRVGDasBIABBADYCHCAAIAE2AhQgAEH9jYCAADYCECAAQR02AgxBACEQDOQBCyAAQSc2AhwgACABNgIUIAAgEDYCDEEAIRAM4wELIBAhAUEBIRQCQAJAAkACQAJAAkACQCAALQAsQX5qDgcGBQUDAQIABQsgACAALwEwQQhyOwEwDAMLQQIhFAwBC0EEIRQLIABBAToALCAAIAAvATAgFHI7ATALIBAhAQtBKyEQDMoBCyAAQQA2AhwgACAQNgIUIABBq5KAgAA2AhAgAEELNgIMQQAhEAziAQsgAEEANgIcIAAgATYCFCAAQeGPgIAANgIQIABBCjYCDEEAIRAM4QELIABBADoALCAQIQEMvQELIBAhAUEBIRQCQAJAAkACQAJAIAAtACxBe2oOBAMBAgAFCyAAIAAvATBBCHI7ATAMAwtBAiEUDAELQQQhFAsgAEEBOgAsIAAgAC8BMCAUcjsBMAsgECEBC0EpIRAMxQELIABBADYCHCAAIAE2AhQgAEHwlICAADYCECAAQQM2AgxBACEQDN0BCwJAIA4tAABBDUcNACAAKAIEIQEgAEEANgIEAkAgACABIA4QsYCAgAAiAQ0AIA5BAWohAQx1CyAAQSw2AhwgACABNgIMIAAgDkEBajYCFEEAIRAM3QELIAAtAC1BAXFFDQFBxAEhEAzDAQsCQCAOIAJHDQBBLSEQDNwBCwJAAkADQAJAIA4tAABBdmoOBAIAAAMACyAOQQFqIg4gAkcNAAtBLSEQDN0BCyAAKAIEIQEgAEEANgIEAkAgACABIA4QsYCAgAAiAQ0AIA4hAQx0CyAAQSw2AhwgACAONgIUIAAgATYCDEEAIRAM3AELIAAoAgQhASAAQQA2AgQCQCAAIAEgDhCxgICAACIBDQAgDkEBaiEBDHMLIABBLDYCHCAAIAE2AgwgACAOQQFqNgIUQQAhEAzbAQsgACgCBCEEIABBADYCBCAAIAQgDhCxgICAACIEDaABIA4hAQzOAQsgEEEsRw0BIAFBAWohEEEBIQECQAJAAkACQAJAIAAtACxBe2oOBAMBAgQACyAQIQEMBAtBAiEBDAELQQQhAQsgAEEBOgAsIAAgAC8BMCABcjsBMCAQIQEMAQsgACAALwEwQQhyOwEwIBAhAQtBOSEQDL8BCyAAQQA6ACwgASEBC0E0IRAMvQELIAAgAC8BMEEgcjsBMCABIQEMAgsgACgCBCEEIABBADYCBAJAIAAgBCABELGAgIAAIgQNACABIQEMxwELIABBNzYCHCAAIAE2AhQgACAENgIMQQAhEAzUAQsgAEEIOgAsIAEhAQtBMCEQDLkBCwJAIAAtAChBAUYNACABIQEMBAsgAC0ALUEIcUUNkwEgASEBDAMLIAAtADBBIHENlAFBxQEhEAy3AQsCQCAPIAJGDQACQANAAkAgDy0AAEFQaiIBQf8BcUEKSQ0AIA8hAUE1IRAMugELIAApAyAiEUKZs+bMmbPmzBlWDQEgACARQgp+IhE3AyAgESABrUL/AYMiEkJ/hVYNASAAIBEgEnw3AyAgD0EBaiIPIAJHDQALQTkhEAzRAQsgACgCBCECIABBADYCBCAAIAIgD0EBaiIEELGAgIAAIgINlQEgBCEBDMMBC0E5IRAMzwELAkAgAC8BMCIBQQhxRQ0AIAAtAChBAUcNACAALQAtQQhxRQ2QAQsgACABQff7A3FBgARyOwEwIA8hAQtBNyEQDLQBCyAAIAAvATBBEHI7ATAMqwELIBBBFUYNiwEgAEEANgIcIAAgATYCFCAAQfCOgIAANgIQIABBHDYCDEEAIRAMywELIABBwwA2AhwgACABNgIMIAAgDUEBajYCFEEAIRAMygELAkAgAS0AAEE6Rw0AIAAoAgQhECAAQQA2AgQCQCAAIBAgARCvgICAACIQDQAgAUEBaiEBDGMLIABBwwA2AhwgACAQNgIMIAAgAUEBajYCFEEAIRAMygELIABBADYCHCAAIAE2AhQgAEGxkYCAADYCECAAQQo2AgxBACEQDMkBCyAAQQA2AhwgACABNgIUIABBoJmAgAA2AhAgAEEeNgIMQQAhEAzIAQsgAEEANgIACyAAQYASOwEqIAAgF0EBaiIBIAIQqICAgAAiEA0BIAEhAQtBxwAhEAysAQsgEEEVRw2DASAAQdEANgIcIAAgATYCFCAAQeOXgIAANgIQIABBFTYCDEEAIRAMxAELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDF4LIABB0gA2AhwgACABNgIUIAAgEDYCDEEAIRAMwwELIABBADYCHCAAIBQ2AhQgAEHBqICAADYCECAAQQc2AgwgAEEANgIAQQAhEAzCAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMXQsgAEHTADYCHCAAIAE2AhQgACAQNgIMQQAhEAzBAQtBACEQIABBADYCHCAAIAE2AhQgAEGAkYCAADYCECAAQQk2AgwMwAELIBBBFUYNfSAAQQA2AhwgACABNgIUIABBlI2AgAA2AhAgAEEhNgIMQQAhEAy/AQtBASEWQQAhF0EAIRRBASEQCyAAIBA6ACsgAUEBaiEBAkACQCAALQAtQRBxDQACQAJAAkAgAC0AKg4DAQACBAsgFkUNAwwCCyAUDQEMAgsgF0UNAQsgACgCBCEQIABBADYCBAJAIAAgECABEK2AgIAAIhANACABIQEMXAsgAEHYADYCHCAAIAE2AhQgACAQNgIMQQAhEAy+AQsgACgCBCEEIABBADYCBAJAIAAgBCABEK2AgIAAIgQNACABIQEMrQELIABB2QA2AhwgACABNgIUIAAgBDYCDEEAIRAMvQELIAAoAgQhBCAAQQA2AgQCQCAAIAQgARCtgICAACIEDQAgASEBDKsBCyAAQdoANgIcIAAgATYCFCAAIAQ2AgxBACEQDLwBCyAAKAIEIQQgAEEANgIEAkAgACAEIAEQrYCAgAAiBA0AIAEhAQypAQsgAEHcADYCHCAAIAE2AhQgACAENgIMQQAhEAy7AQsCQCABLQAAQVBqIhBB/wFxQQpPDQAgACAQOgAqIAFBAWohAUHPACEQDKIBCyAAKAIEIQQgAEEANgIEAkAgACAEIAEQrYCAgAAiBA0AIAEhAQynAQsgAEHeADYCHCAAIAE2AhQgACAENgIMQQAhEAy6AQsgAEEANgIAIBdBAWohAQJAIAAtAClBI08NACABIQEMWQsgAEEANgIcIAAgATYCFCAAQdOJgIAANgIQIABBCDYCDEEAIRAMuQELIABBADYCAAtBACEQIABBADYCHCAAIAE2AhQgAEGQs4CAADYCECAAQQg2AgwMtwELIABBADYCACAXQQFqIQECQCAALQApQSFHDQAgASEBDFYLIABBADYCHCAAIAE2AhQgAEGbioCAADYCECAAQQg2AgxBACEQDLYBCyAAQQA2AgAgF0EBaiEBAkAgAC0AKSIQQV1qQQtPDQAgASEBDFULAkAgEEEGSw0AQQEgEHRBygBxRQ0AIAEhAQxVC0EAIRAgAEEANgIcIAAgATYCFCAAQfeJgIAANgIQIABBCDYCDAy1AQsgEEEVRg1xIABBADYCHCAAIAE2AhQgAEG5jYCAADYCECAAQRo2AgxBACEQDLQBCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxUCyAAQeUANgIcIAAgATYCFCAAIBA2AgxBACEQDLMBCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxNCyAAQdIANgIcIAAgATYCFCAAIBA2AgxBACEQDLIBCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxNCyAAQdMANgIcIAAgATYCFCAAIBA2AgxBACEQDLEBCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxRCyAAQeUANgIcIAAgATYCFCAAIBA2AgxBACEQDLABCyAAQQA2AhwgACABNgIUIABBxoqAgAA2AhAgAEEHNgIMQQAhEAyvAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMSQsgAEHSADYCHCAAIAE2AhQgACAQNgIMQQAhEAyuAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMSQsgAEHTADYCHCAAIAE2AhQgACAQNgIMQQAhEAytAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMTQsgAEHlADYCHCAAIAE2AhQgACAQNgIMQQAhEAysAQsgAEEANgIcIAAgATYCFCAAQdyIgIAANgIQIABBBzYCDEEAIRAMqwELIBBBP0cNASABQQFqIQELQQUhEAyQAQtBACEQIABBADYCHCAAIAE2AhQgAEH9koCAADYCECAAQQc2AgwMqAELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDEILIABB0gA2AhwgACABNgIUIAAgEDYCDEEAIRAMpwELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDEILIABB0wA2AhwgACABNgIUIAAgEDYCDEEAIRAMpgELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDEYLIABB5QA2AhwgACABNgIUIAAgEDYCDEEAIRAMpQELIAAoAgQhASAAQQA2AgQCQCAAIAEgFBCngICAACIBDQAgFCEBDD8LIABB0gA2AhwgACAUNgIUIAAgATYCDEEAIRAMpAELIAAoAgQhASAAQQA2AgQCQCAAIAEgFBCngICAACIBDQAgFCEBDD8LIABB0wA2AhwgACAUNgIUIAAgATYCDEEAIRAMowELIAAoAgQhASAAQQA2AgQCQCAAIAEgFBCngICAACIBDQAgFCEBDEMLIABB5QA2AhwgACAUNgIUIAAgATYCDEEAIRAMogELIABBADYCHCAAIBQ2AhQgAEHDj4CAADYCECAAQQc2AgxBACEQDKEBCyAAQQA2AhwgACABNgIUIABBw4+AgAA2AhAgAEEHNgIMQQAhEAygAQtBACEQIABBADYCHCAAIBQ2AhQgAEGMnICAADYCECAAQQc2AgwMnwELIABBADYCHCAAIBQ2AhQgAEGMnICAADYCECAAQQc2AgxBACEQDJ4BCyAAQQA2AhwgACAUNgIUIABB/pGAgAA2AhAgAEEHNgIMQQAhEAydAQsgAEEANgIcIAAgATYCFCAAQY6bgIAANgIQIABBBjYCDEEAIRAMnAELIBBBFUYNVyAAQQA2AhwgACABNgIUIABBzI6AgAA2AhAgAEEgNgIMQQAhEAybAQsgAEEANgIAIBBBAWohAUEkIRALIAAgEDoAKSAAKAIEIRAgAEEANgIEIAAgECABEKuAgIAAIhANVCABIQEMPgsgAEEANgIAC0EAIRAgAEEANgIcIAAgBDYCFCAAQfGbgIAANgIQIABBBjYCDAyXAQsgAUEVRg1QIABBADYCHCAAIAU2AhQgAEHwjICAADYCECAAQRs2AgxBACEQDJYBCyAAKAIEIQUgAEEANgIEIAAgBSAQEKmAgIAAIgUNASAQQQFqIQULQa0BIRAMewsgAEHBATYCHCAAIAU2AgwgACAQQQFqNgIUQQAhEAyTAQsgACgCBCEGIABBADYCBCAAIAYgEBCpgICAACIGDQEgEEEBaiEGC0GuASEQDHgLIABBwgE2AhwgACAGNgIMIAAgEEEBajYCFEEAIRAMkAELIABBADYCHCAAIAc2AhQgAEGXi4CAADYCECAAQQ02AgxBACEQDI8BCyAAQQA2AhwgACAINgIUIABB45CAgAA2AhAgAEEJNgIMQQAhEAyOAQsgAEEANgIcIAAgCDYCFCAAQZSNgIAANgIQIABBITYCDEEAIRAMjQELQQEhFkEAIRdBACEUQQEhEAsgACAQOgArIAlBAWohCAJAAkAgAC0ALUEQcQ0AAkACQAJAIAAtACoOAwEAAgQLIBZFDQMMAgsgFA0BDAILIBdFDQELIAAoAgQhECAAQQA2AgQgACAQIAgQrYCAgAAiEEUNPSAAQckBNgIcIAAgCDYCFCAAIBA2AgxBACEQDIwBCyAAKAIEIQQgAEEANgIEIAAgBCAIEK2AgIAAIgRFDXYgAEHKATYCHCAAIAg2AhQgACAENgIMQQAhEAyLAQsgACgCBCEEIABBADYCBCAAIAQgCRCtgICAACIERQ10IABBywE2AhwgACAJNgIUIAAgBDYCDEEAIRAMigELIAAoAgQhBCAAQQA2AgQgACAEIAoQrYCAgAAiBEUNciAAQc0BNgIcIAAgCjYCFCAAIAQ2AgxBACEQDIkBCwJAIAstAABBUGoiEEH/AXFBCk8NACAAIBA6ACogC0EBaiEKQbYBIRAMcAsgACgCBCEEIABBADYCBCAAIAQgCxCtgICAACIERQ1wIABBzwE2AhwgACALNgIUIAAgBDYCDEEAIRAMiAELIABBADYCHCAAIAQ2AhQgAEGQs4CAADYCECAAQQg2AgwgAEEANgIAQQAhEAyHAQsgAUEVRg0/IABBADYCHCAAIAw2AhQgAEHMjoCAADYCECAAQSA2AgxBACEQDIYBCyAAQYEEOwEoIAAoAgQhECAAQgA3AwAgACAQIAxBAWoiDBCrgICAACIQRQ04IABB0wE2AhwgACAMNgIUIAAgEDYCDEEAIRAMhQELIABBADYCAAtBACEQIABBADYCHCAAIAQ2AhQgAEHYm4CAADYCECAAQQg2AgwMgwELIAAoAgQhECAAQgA3AwAgACAQIAtBAWoiCxCrgICAACIQDQFBxgEhEAxpCyAAQQI6ACgMVQsgAEHVATYCHCAAIAs2AhQgACAQNgIMQQAhEAyAAQsgEEEVRg03IABBADYCHCAAIAQ2AhQgAEGkjICAADYCECAAQRA2AgxBACEQDH8LIAAtADRBAUcNNCAAIAQgAhC8gICAACIQRQ00IBBBFUcNNSAAQdwBNgIcIAAgBDYCFCAAQdWWgIAANgIQIABBFTYCDEEAIRAMfgtBACEQIABBADYCHCAAQa+LgIAANgIQIABBAjYCDCAAIBRBAWo2AhQMfQtBACEQDGMLQQIhEAxiC0ENIRAMYQtBDyEQDGALQSUhEAxfC0ETIRAMXgtBFSEQDF0LQRYhEAxcC0EXIRAMWwtBGCEQDFoLQRkhEAxZC0EaIRAMWAtBGyEQDFcLQRwhEAxWC0EdIRAMVQtBHyEQDFQLQSEhEAxTC0EjIRAMUgtBxgAhEAxRC0EuIRAMUAtBLyEQDE8LQTshEAxOC0E9IRAMTQtByAAhEAxMC0HJACEQDEsLQcsAIRAMSgtBzAAhEAxJC0HOACEQDEgLQdEAIRAMRwtB1QAhEAxGC0HYACEQDEULQdkAIRAMRAtB2wAhEAxDC0HkACEQDEILQeUAIRAMQQtB8QAhEAxAC0H0ACEQDD8LQY0BIRAMPgtBlwEhEAw9C0GpASEQDDwLQawBIRAMOwtBwAEhEAw6C0G5ASEQDDkLQa8BIRAMOAtBsQEhEAw3C0GyASEQDDYLQbQBIRAMNQtBtQEhEAw0C0G6ASEQDDMLQb0BIRAMMgtBvwEhEAwxC0HBASEQDDALIABBADYCHCAAIAQ2AhQgAEHpi4CAADYCECAAQR82AgxBACEQDEgLIABB2wE2AhwgACAENgIUIABB+paAgAA2AhAgAEEVNgIMQQAhEAxHCyAAQfgANgIcIAAgDDYCFCAAQcqYgIAANgIQIABBFTYCDEEAIRAMRgsgAEHRADYCHCAAIAU2AhQgAEGwl4CAADYCECAAQRU2AgxBACEQDEULIABB+QA2AhwgACABNgIUIAAgEDYCDEEAIRAMRAsgAEH4ADYCHCAAIAE2AhQgAEHKmICAADYCECAAQRU2AgxBACEQDEMLIABB5AA2AhwgACABNgIUIABB45eAgAA2AhAgAEEVNgIMQQAhEAxCCyAAQdcANgIcIAAgATYCFCAAQcmXgIAANgIQIABBFTYCDEEAIRAMQQsgAEEANgIcIAAgATYCFCAAQbmNgIAANgIQIABBGjYCDEEAIRAMQAsgAEHCADYCHCAAIAE2AhQgAEHjmICAADYCECAAQRU2AgxBACEQDD8LIABBADYCBCAAIA8gDxCxgICAACIERQ0BIABBOjYCHCAAIAQ2AgwgACAPQQFqNgIUQQAhEAw+CyAAKAIEIQQgAEEANgIEAkAgACAEIAEQsYCAgAAiBEUNACAAQTs2AhwgACAENgIMIAAgAUEBajYCFEEAIRAMPgsgAUEBaiEBDC0LIA9BAWohAQwtCyAAQQA2AhwgACAPNgIUIABB5JKAgAA2AhAgAEEENgIMQQAhEAw7CyAAQTY2AhwgACAENgIUIAAgAjYCDEEAIRAMOgsgAEEuNgIcIAAgDjYCFCAAIAQ2AgxBACEQDDkLIABB0AA2AhwgACABNgIUIABBkZiAgAA2AhAgAEEVNgIMQQAhEAw4CyANQQFqIQEMLAsgAEEVNgIcIAAgATYCFCAAQYKZgIAANgIQIABBFTYCDEEAIRAMNgsgAEEbNgIcIAAgATYCFCAAQZGXgIAANgIQIABBFTYCDEEAIRAMNQsgAEEPNgIcIAAgATYCFCAAQZGXgIAANgIQIABBFTYCDEEAIRAMNAsgAEELNgIcIAAgATYCFCAAQZGXgIAANgIQIABBFTYCDEEAIRAMMwsgAEEaNgIcIAAgATYCFCAAQYKZgIAANgIQIABBFTYCDEEAIRAMMgsgAEELNgIcIAAgATYCFCAAQYKZgIAANgIQIABBFTYCDEEAIRAMMQsgAEEKNgIcIAAgATYCFCAAQeSWgIAANgIQIABBFTYCDEEAIRAMMAsgAEEeNgIcIAAgATYCFCAAQfmXgIAANgIQIABBFTYCDEEAIRAMLwsgAEEANgIcIAAgEDYCFCAAQdqNgIAANgIQIABBFDYCDEEAIRAMLgsgAEEENgIcIAAgATYCFCAAQbCYgIAANgIQIABBFTYCDEEAIRAMLQsgAEEANgIAIAtBAWohCwtBuAEhEAwSCyAAQQA2AgAgEEEBaiEBQfUAIRAMEQsgASEBAkAgAC0AKUEFRw0AQeMAIRAMEQtB4gAhEAwQC0EAIRAgAEEANgIcIABB5JGAgAA2AhAgAEEHNgIMIAAgFEEBajYCFAwoCyAAQQA2AgAgF0EBaiEBQcAAIRAMDgtBASEBCyAAIAE6ACwgAEEANgIAIBdBAWohAQtBKCEQDAsLIAEhAQtBOCEQDAkLAkAgASIPIAJGDQADQAJAIA8tAABBgL6AgABqLQAAIgFBAUYNACABQQJHDQMgD0EBaiEBDAQLIA9BAWoiDyACRw0AC0E+IRAMIgtBPiEQDCELIABBADoALCAPIQEMAQtBCyEQDAYLQTohEAwFCyABQQFqIQFBLSEQDAQLIAAgAToALCAAQQA2AgAgFkEBaiEBQQwhEAwDCyAAQQA2AgAgF0EBaiEBQQohEAwCCyAAQQA2AgALIABBADoALCANIQFBCSEQDAALC0EAIRAgAEEANgIcIAAgCzYCFCAAQc2QgIAANgIQIABBCTYCDAwXC0EAIRAgAEEANgIcIAAgCjYCFCAAQemKgIAANgIQIABBCTYCDAwWC0EAIRAgAEEANgIcIAAgCTYCFCAAQbeQgIAANgIQIABBCTYCDAwVC0EAIRAgAEEANgIcIAAgCDYCFCAAQZyRgIAANgIQIABBCTYCDAwUC0EAIRAgAEEANgIcIAAgATYCFCAAQc2QgIAANgIQIABBCTYCDAwTC0EAIRAgAEEANgIcIAAgATYCFCAAQemKgIAANgIQIABBCTYCDAwSC0EAIRAgAEEANgIcIAAgATYCFCAAQbeQgIAANgIQIABBCTYCDAwRC0EAIRAgAEEANgIcIAAgATYCFCAAQZyRgIAANgIQIABBCTYCDAwQC0EAIRAgAEEANgIcIAAgATYCFCAAQZeVgIAANgIQIABBDzYCDAwPC0EAIRAgAEEANgIcIAAgATYCFCAAQZeVgIAANgIQIABBDzYCDAwOC0EAIRAgAEEANgIcIAAgATYCFCAAQcCSgIAANgIQIABBCzYCDAwNC0EAIRAgAEEANgIcIAAgATYCFCAAQZWJgIAANgIQIABBCzYCDAwMC0EAIRAgAEEANgIcIAAgATYCFCAAQeGPgIAANgIQIABBCjYCDAwLC0EAIRAgAEEANgIcIAAgATYCFCAAQfuPgIAANgIQIABBCjYCDAwKC0EAIRAgAEEANgIcIAAgATYCFCAAQfGZgIAANgIQIABBAjYCDAwJC0EAIRAgAEEANgIcIAAgATYCFCAAQcSUgIAANgIQIABBAjYCDAwIC0EAIRAgAEEANgIcIAAgATYCFCAAQfKVgIAANgIQIABBAjYCDAwHCyAAQQI2AhwgACABNgIUIABBnJqAgAA2AhAgAEEWNgIMQQAhEAwGC0EBIRAMBQtB1AAhECABIgQgAkYNBCADQQhqIAAgBCACQdjCgIAAQQoQxYCAgAAgAygCDCEEIAMoAggOAwEEAgALEMqAgIAAAAsgAEEANgIcIABBtZqAgAA2AhAgAEEXNgIMIAAgBEEBajYCFEEAIRAMAgsgAEEANgIcIAAgBDYCFCAAQcqagIAANgIQIABBCTYCDEEAIRAMAQsCQCABIgQgAkcNAEEiIRAMAQsgAEGJgICAADYCCCAAIAQ2AgRBISEQCyADQRBqJICAgIAAIBALrwEBAn8gASgCACEGAkACQCACIANGDQAgBCAGaiEEIAYgA2ogAmshByACIAZBf3MgBWoiBmohBQNAAkAgAi0AACAELQAARg0AQQIhBAwDCwJAIAYNAEEAIQQgBSECDAMLIAZBf2ohBiAEQQFqIQQgAkEBaiICIANHDQALIAchBiADIQILIABBATYCACABIAY2AgAgACACNgIEDwsgAUEANgIAIAAgBDYCACAAIAI2AgQLCgAgABDHgICAAAvyNgELfyOAgICAAEEQayIBJICAgIAAAkBBACgCoNCAgAANAEEAEMuAgIAAQYDUhIAAayICQdkASQ0AQQAhAwJAQQAoAuDTgIAAIgQNAEEAQn83AuzTgIAAQQBCgICEgICAwAA3AuTTgIAAQQAgAUEIakFwcUHYqtWqBXMiBDYC4NOAgABBAEEANgL004CAAEEAQQA2AsTTgIAAC0EAIAI2AszTgIAAQQBBgNSEgAA2AsjTgIAAQQBBgNSEgAA2ApjQgIAAQQAgBDYCrNCAgABBAEF/NgKo0ICAAANAIANBxNCAgABqIANBuNCAgABqIgQ2AgAgBCADQbDQgIAAaiIFNgIAIANBvNCAgABqIAU2AgAgA0HM0ICAAGogA0HA0ICAAGoiBTYCACAFIAQ2AgAgA0HU0ICAAGogA0HI0ICAAGoiBDYCACAEIAU2AgAgA0HQ0ICAAGogBDYCACADQSBqIgNBgAJHDQALQYDUhIAAQXhBgNSEgABrQQ9xQQBBgNSEgABBCGpBD3EbIgNqIgRBBGogAkFIaiIFIANrIgNBAXI2AgBBAEEAKALw04CAADYCpNCAgABBACADNgKU0ICAAEEAIAQ2AqDQgIAAQYDUhIAAIAVqQTg2AgQLAkACQAJAAkACQAJAAkACQAJAAkACQAJAIABB7AFLDQACQEEAKAKI0ICAACIGQRAgAEETakFwcSAAQQtJGyICQQN2IgR2IgNBA3FFDQACQAJAIANBAXEgBHJBAXMiBUEDdCIEQbDQgIAAaiIDIARBuNCAgABqKAIAIgQoAggiAkcNAEEAIAZBfiAFd3E2AojQgIAADAELIAMgAjYCCCACIAM2AgwLIARBCGohAyAEIAVBA3QiBUEDcjYCBCAEIAVqIgQgBCgCBEEBcjYCBAwMCyACQQAoApDQgIAAIgdNDQECQCADRQ0AAkACQCADIAR0QQIgBHQiA0EAIANrcnEiA0EAIANrcUF/aiIDIANBDHZBEHEiA3YiBEEFdkEIcSIFIANyIAQgBXYiA0ECdkEEcSIEciADIAR2IgNBAXZBAnEiBHIgAyAEdiIDQQF2QQFxIgRyIAMgBHZqIgRBA3QiA0Gw0ICAAGoiBSADQbjQgIAAaigCACIDKAIIIgBHDQBBACAGQX4gBHdxIgY2AojQgIAADAELIAUgADYCCCAAIAU2AgwLIAMgAkEDcjYCBCADIARBA3QiBGogBCACayIFNgIAIAMgAmoiACAFQQFyNgIEAkAgB0UNACAHQXhxQbDQgIAAaiECQQAoApzQgIAAIQQCQAJAIAZBASAHQQN2dCIIcQ0AQQAgBiAIcjYCiNCAgAAgAiEIDAELIAIoAgghCAsgCCAENgIMIAIgBDYCCCAEIAI2AgwgBCAINgIICyADQQhqIQNBACAANgKc0ICAAEEAIAU2ApDQgIAADAwLQQAoAozQgIAAIglFDQEgCUEAIAlrcUF/aiIDIANBDHZBEHEiA3YiBEEFdkEIcSIFIANyIAQgBXYiA0ECdkEEcSIEciADIAR2IgNBAXZBAnEiBHIgAyAEdiIDQQF2QQFxIgRyIAMgBHZqQQJ0QbjSgIAAaigCACIAKAIEQXhxIAJrIQQgACEFAkADQAJAIAUoAhAiAw0AIAVBFGooAgAiA0UNAgsgAygCBEF4cSACayIFIAQgBSAESSIFGyEEIAMgACAFGyEAIAMhBQwACwsgACgCGCEKAkAgACgCDCIIIABGDQAgACgCCCIDQQAoApjQgIAASRogCCADNgIIIAMgCDYCDAwLCwJAIABBFGoiBSgCACIDDQAgACgCECIDRQ0DIABBEGohBQsDQCAFIQsgAyIIQRRqIgUoAgAiAw0AIAhBEGohBSAIKAIQIgMNAAsgC0EANgIADAoLQX8hAiAAQb9/Sw0AIABBE2oiA0FwcSECQQAoAozQgIAAIgdFDQBBACELAkAgAkGAAkkNAEEfIQsgAkH///8HSw0AIANBCHYiAyADQYD+P2pBEHZBCHEiA3QiBCAEQYDgH2pBEHZBBHEiBHQiBSAFQYCAD2pBEHZBAnEiBXRBD3YgAyAEciAFcmsiA0EBdCACIANBFWp2QQFxckEcaiELC0EAIAJrIQQCQAJAAkACQCALQQJ0QbjSgIAAaigCACIFDQBBACEDQQAhCAwBC0EAIQMgAkEAQRkgC0EBdmsgC0EfRht0IQBBACEIA0ACQCAFKAIEQXhxIAJrIgYgBE8NACAGIQQgBSEIIAYNAEEAIQQgBSEIIAUhAwwDCyADIAVBFGooAgAiBiAGIAUgAEEddkEEcWpBEGooAgAiBUYbIAMgBhshAyAAQQF0IQAgBQ0ACwsCQCADIAhyDQBBACEIQQIgC3QiA0EAIANrciAHcSIDRQ0DIANBACADa3FBf2oiAyADQQx2QRBxIgN2IgVBBXZBCHEiACADciAFIAB2IgNBAnZBBHEiBXIgAyAFdiIDQQF2QQJxIgVyIAMgBXYiA0EBdkEBcSIFciADIAV2akECdEG40oCAAGooAgAhAwsgA0UNAQsDQCADKAIEQXhxIAJrIgYgBEkhAAJAIAMoAhAiBQ0AIANBFGooAgAhBQsgBiAEIAAbIQQgAyAIIAAbIQggBSEDIAUNAAsLIAhFDQAgBEEAKAKQ0ICAACACa08NACAIKAIYIQsCQCAIKAIMIgAgCEYNACAIKAIIIgNBACgCmNCAgABJGiAAIAM2AgggAyAANgIMDAkLAkAgCEEUaiIFKAIAIgMNACAIKAIQIgNFDQMgCEEQaiEFCwNAIAUhBiADIgBBFGoiBSgCACIDDQAgAEEQaiEFIAAoAhAiAw0ACyAGQQA2AgAMCAsCQEEAKAKQ0ICAACIDIAJJDQBBACgCnNCAgAAhBAJAAkAgAyACayIFQRBJDQAgBCACaiIAIAVBAXI2AgRBACAFNgKQ0ICAAEEAIAA2ApzQgIAAIAQgA2ogBTYCACAEIAJBA3I2AgQMAQsgBCADQQNyNgIEIAQgA2oiAyADKAIEQQFyNgIEQQBBADYCnNCAgABBAEEANgKQ0ICAAAsgBEEIaiEDDAoLAkBBACgClNCAgAAiACACTQ0AQQAoAqDQgIAAIgMgAmoiBCAAIAJrIgVBAXI2AgRBACAFNgKU0ICAAEEAIAQ2AqDQgIAAIAMgAkEDcjYCBCADQQhqIQMMCgsCQAJAQQAoAuDTgIAARQ0AQQAoAujTgIAAIQQMAQtBAEJ/NwLs04CAAEEAQoCAhICAgMAANwLk04CAAEEAIAFBDGpBcHFB2KrVqgVzNgLg04CAAEEAQQA2AvTTgIAAQQBBADYCxNOAgABBgIAEIQQLQQAhAwJAIAQgAkHHAGoiB2oiBkEAIARrIgtxIgggAksNAEEAQTA2AvjTgIAADAoLAkBBACgCwNOAgAAiA0UNAAJAQQAoArjTgIAAIgQgCGoiBSAETQ0AIAUgA00NAQtBACEDQQBBMDYC+NOAgAAMCgtBAC0AxNOAgABBBHENBAJAAkACQEEAKAKg0ICAACIERQ0AQcjTgIAAIQMDQAJAIAMoAgAiBSAESw0AIAUgAygCBGogBEsNAwsgAygCCCIDDQALC0EAEMuAgIAAIgBBf0YNBSAIIQYCQEEAKALk04CAACIDQX9qIgQgAHFFDQAgCCAAayAEIABqQQAgA2txaiEGCyAGIAJNDQUgBkH+////B0sNBQJAQQAoAsDTgIAAIgNFDQBBACgCuNOAgAAiBCAGaiIFIARNDQYgBSADSw0GCyAGEMuAgIAAIgMgAEcNAQwHCyAGIABrIAtxIgZB/v///wdLDQQgBhDLgICAACIAIAMoAgAgAygCBGpGDQMgACEDCwJAIANBf0YNACACQcgAaiAGTQ0AAkAgByAGa0EAKALo04CAACIEakEAIARrcSIEQf7///8HTQ0AIAMhAAwHCwJAIAQQy4CAgABBf0YNACAEIAZqIQYgAyEADAcLQQAgBmsQy4CAgAAaDAQLIAMhACADQX9HDQUMAwtBACEIDAcLQQAhAAwFCyAAQX9HDQILQQBBACgCxNOAgABBBHI2AsTTgIAACyAIQf7///8HSw0BIAgQy4CAgAAhAEEAEMuAgIAAIQMgAEF/Rg0BIANBf0YNASAAIANPDQEgAyAAayIGIAJBOGpNDQELQQBBACgCuNOAgAAgBmoiAzYCuNOAgAACQCADQQAoArzTgIAATQ0AQQAgAzYCvNOAgAALAkACQAJAAkBBACgCoNCAgAAiBEUNAEHI04CAACEDA0AgACADKAIAIgUgAygCBCIIakYNAiADKAIIIgMNAAwDCwsCQAJAQQAoApjQgIAAIgNFDQAgACADTw0BC0EAIAA2ApjQgIAAC0EAIQNBACAGNgLM04CAAEEAIAA2AsjTgIAAQQBBfzYCqNCAgABBAEEAKALg04CAADYCrNCAgABBAEEANgLU04CAAANAIANBxNCAgABqIANBuNCAgABqIgQ2AgAgBCADQbDQgIAAaiIFNgIAIANBvNCAgABqIAU2AgAgA0HM0ICAAGogA0HA0ICAAGoiBTYCACAFIAQ2AgAgA0HU0ICAAGogA0HI0ICAAGoiBDYCACAEIAU2AgAgA0HQ0ICAAGogBDYCACADQSBqIgNBgAJHDQALIABBeCAAa0EPcUEAIABBCGpBD3EbIgNqIgQgBkFIaiIFIANrIgNBAXI2AgRBAEEAKALw04CAADYCpNCAgABBACADNgKU0ICAAEEAIAQ2AqDQgIAAIAAgBWpBODYCBAwCCyADLQAMQQhxDQAgBCAFSQ0AIAQgAE8NACAEQXggBGtBD3FBACAEQQhqQQ9xGyIFaiIAQQAoApTQgIAAIAZqIgsgBWsiBUEBcjYCBCADIAggBmo2AgRBAEEAKALw04CAADYCpNCAgABBACAFNgKU0ICAAEEAIAA2AqDQgIAAIAQgC2pBODYCBAwBCwJAIABBACgCmNCAgAAiCE8NAEEAIAA2ApjQgIAAIAAhCAsgACAGaiEFQcjTgIAAIQMCQAJAAkACQAJAAkACQANAIAMoAgAgBUYNASADKAIIIgMNAAwCCwsgAy0ADEEIcUUNAQtByNOAgAAhAwNAAkAgAygCACIFIARLDQAgBSADKAIEaiIFIARLDQMLIAMoAgghAwwACwsgAyAANgIAIAMgAygCBCAGajYCBCAAQXggAGtBD3FBACAAQQhqQQ9xG2oiCyACQQNyNgIEIAVBeCAFa0EPcUEAIAVBCGpBD3EbaiIGIAsgAmoiAmshAwJAIAYgBEcNAEEAIAI2AqDQgIAAQQBBACgClNCAgAAgA2oiAzYClNCAgAAgAiADQQFyNgIEDAMLAkAgBkEAKAKc0ICAAEcNAEEAIAI2ApzQgIAAQQBBACgCkNCAgAAgA2oiAzYCkNCAgAAgAiADQQFyNgIEIAIgA2ogAzYCAAwDCwJAIAYoAgQiBEEDcUEBRw0AIARBeHEhBwJAAkAgBEH/AUsNACAGKAIIIgUgBEEDdiIIQQN0QbDQgIAAaiIARhoCQCAGKAIMIgQgBUcNAEEAQQAoAojQgIAAQX4gCHdxNgKI0ICAAAwCCyAEIABGGiAEIAU2AgggBSAENgIMDAELIAYoAhghCQJAAkAgBigCDCIAIAZGDQAgBigCCCIEIAhJGiAAIAQ2AgggBCAANgIMDAELAkAgBkEUaiIEKAIAIgUNACAGQRBqIgQoAgAiBQ0AQQAhAAwBCwNAIAQhCCAFIgBBFGoiBCgCACIFDQAgAEEQaiEEIAAoAhAiBQ0ACyAIQQA2AgALIAlFDQACQAJAIAYgBigCHCIFQQJ0QbjSgIAAaiIEKAIARw0AIAQgADYCACAADQFBAEEAKAKM0ICAAEF+IAV3cTYCjNCAgAAMAgsgCUEQQRQgCSgCECAGRhtqIAA2AgAgAEUNAQsgACAJNgIYAkAgBigCECIERQ0AIAAgBDYCECAEIAA2AhgLIAYoAhQiBEUNACAAQRRqIAQ2AgAgBCAANgIYCyAHIANqIQMgBiAHaiIGKAIEIQQLIAYgBEF+cTYCBCACIANqIAM2AgAgAiADQQFyNgIEAkAgA0H/AUsNACADQXhxQbDQgIAAaiEEAkACQEEAKAKI0ICAACIFQQEgA0EDdnQiA3ENAEEAIAUgA3I2AojQgIAAIAQhAwwBCyAEKAIIIQMLIAMgAjYCDCAEIAI2AgggAiAENgIMIAIgAzYCCAwDC0EfIQQCQCADQf///wdLDQAgA0EIdiIEIARBgP4/akEQdkEIcSIEdCIFIAVBgOAfakEQdkEEcSIFdCIAIABBgIAPakEQdkECcSIAdEEPdiAEIAVyIAByayIEQQF0IAMgBEEVanZBAXFyQRxqIQQLIAIgBDYCHCACQgA3AhAgBEECdEG40oCAAGohBQJAQQAoAozQgIAAIgBBASAEdCIIcQ0AIAUgAjYCAEEAIAAgCHI2AozQgIAAIAIgBTYCGCACIAI2AgggAiACNgIMDAMLIANBAEEZIARBAXZrIARBH0YbdCEEIAUoAgAhAANAIAAiBSgCBEF4cSADRg0CIARBHXYhACAEQQF0IQQgBSAAQQRxakEQaiIIKAIAIgANAAsgCCACNgIAIAIgBTYCGCACIAI2AgwgAiACNgIIDAILIABBeCAAa0EPcUEAIABBCGpBD3EbIgNqIgsgBkFIaiIIIANrIgNBAXI2AgQgACAIakE4NgIEIAQgBUE3IAVrQQ9xQQAgBUFJakEPcRtqQUFqIgggCCAEQRBqSRsiCEEjNgIEQQBBACgC8NOAgAA2AqTQgIAAQQAgAzYClNCAgABBACALNgKg0ICAACAIQRBqQQApAtDTgIAANwIAIAhBACkCyNOAgAA3AghBACAIQQhqNgLQ04CAAEEAIAY2AszTgIAAQQAgADYCyNOAgABBAEEANgLU04CAACAIQSRqIQMDQCADQQc2AgAgA0EEaiIDIAVJDQALIAggBEYNAyAIIAgoAgRBfnE2AgQgCCAIIARrIgA2AgAgBCAAQQFyNgIEAkAgAEH/AUsNACAAQXhxQbDQgIAAaiEDAkACQEEAKAKI0ICAACIFQQEgAEEDdnQiAHENAEEAIAUgAHI2AojQgIAAIAMhBQwBCyADKAIIIQULIAUgBDYCDCADIAQ2AgggBCADNgIMIAQgBTYCCAwEC0EfIQMCQCAAQf///wdLDQAgAEEIdiIDIANBgP4/akEQdkEIcSIDdCIFIAVBgOAfakEQdkEEcSIFdCIIIAhBgIAPakEQdkECcSIIdEEPdiADIAVyIAhyayIDQQF0IAAgA0EVanZBAXFyQRxqIQMLIAQgAzYCHCAEQgA3AhAgA0ECdEG40oCAAGohBQJAQQAoAozQgIAAIghBASADdCIGcQ0AIAUgBDYCAEEAIAggBnI2AozQgIAAIAQgBTYCGCAEIAQ2AgggBCAENgIMDAQLIABBAEEZIANBAXZrIANBH0YbdCEDIAUoAgAhCANAIAgiBSgCBEF4cSAARg0DIANBHXYhCCADQQF0IQMgBSAIQQRxakEQaiIGKAIAIggNAAsgBiAENgIAIAQgBTYCGCAEIAQ2AgwgBCAENgIIDAMLIAUoAggiAyACNgIMIAUgAjYCCCACQQA2AhggAiAFNgIMIAIgAzYCCAsgC0EIaiEDDAULIAUoAggiAyAENgIMIAUgBDYCCCAEQQA2AhggBCAFNgIMIAQgAzYCCAtBACgClNCAgAAiAyACTQ0AQQAoAqDQgIAAIgQgAmoiBSADIAJrIgNBAXI2AgRBACADNgKU0ICAAEEAIAU2AqDQgIAAIAQgAkEDcjYCBCAEQQhqIQMMAwtBACEDQQBBMDYC+NOAgAAMAgsCQCALRQ0AAkACQCAIIAgoAhwiBUECdEG40oCAAGoiAygCAEcNACADIAA2AgAgAA0BQQAgB0F+IAV3cSIHNgKM0ICAAAwCCyALQRBBFCALKAIQIAhGG2ogADYCACAARQ0BCyAAIAs2AhgCQCAIKAIQIgNFDQAgACADNgIQIAMgADYCGAsgCEEUaigCACIDRQ0AIABBFGogAzYCACADIAA2AhgLAkACQCAEQQ9LDQAgCCAEIAJqIgNBA3I2AgQgCCADaiIDIAMoAgRBAXI2AgQMAQsgCCACaiIAIARBAXI2AgQgCCACQQNyNgIEIAAgBGogBDYCAAJAIARB/wFLDQAgBEF4cUGw0ICAAGohAwJAAkBBACgCiNCAgAAiBUEBIARBA3Z0IgRxDQBBACAFIARyNgKI0ICAACADIQQMAQsgAygCCCEECyAEIAA2AgwgAyAANgIIIAAgAzYCDCAAIAQ2AggMAQtBHyEDAkAgBEH///8HSw0AIARBCHYiAyADQYD+P2pBEHZBCHEiA3QiBSAFQYDgH2pBEHZBBHEiBXQiAiACQYCAD2pBEHZBAnEiAnRBD3YgAyAFciACcmsiA0EBdCAEIANBFWp2QQFxckEcaiEDCyAAIAM2AhwgAEIANwIQIANBAnRBuNKAgABqIQUCQCAHQQEgA3QiAnENACAFIAA2AgBBACAHIAJyNgKM0ICAACAAIAU2AhggACAANgIIIAAgADYCDAwBCyAEQQBBGSADQQF2ayADQR9GG3QhAyAFKAIAIQICQANAIAIiBSgCBEF4cSAERg0BIANBHXYhAiADQQF0IQMgBSACQQRxakEQaiIGKAIAIgINAAsgBiAANgIAIAAgBTYCGCAAIAA2AgwgACAANgIIDAELIAUoAggiAyAANgIMIAUgADYCCCAAQQA2AhggACAFNgIMIAAgAzYCCAsgCEEIaiEDDAELAkAgCkUNAAJAAkAgACAAKAIcIgVBAnRBuNKAgABqIgMoAgBHDQAgAyAINgIAIAgNAUEAIAlBfiAFd3E2AozQgIAADAILIApBEEEUIAooAhAgAEYbaiAINgIAIAhFDQELIAggCjYCGAJAIAAoAhAiA0UNACAIIAM2AhAgAyAINgIYCyAAQRRqKAIAIgNFDQAgCEEUaiADNgIAIAMgCDYCGAsCQAJAIARBD0sNACAAIAQgAmoiA0EDcjYCBCAAIANqIgMgAygCBEEBcjYCBAwBCyAAIAJqIgUgBEEBcjYCBCAAIAJBA3I2AgQgBSAEaiAENgIAAkAgB0UNACAHQXhxQbDQgIAAaiECQQAoApzQgIAAIQMCQAJAQQEgB0EDdnQiCCAGcQ0AQQAgCCAGcjYCiNCAgAAgAiEIDAELIAIoAgghCAsgCCADNgIMIAIgAzYCCCADIAI2AgwgAyAINgIIC0EAIAU2ApzQgIAAQQAgBDYCkNCAgAALIABBCGohAwsgAUEQaiSAgICAACADCwoAIAAQyYCAgAAL4g0BB38CQCAARQ0AIABBeGoiASAAQXxqKAIAIgJBeHEiAGohAwJAIAJBAXENACACQQNxRQ0BIAEgASgCACICayIBQQAoApjQgIAAIgRJDQEgAiAAaiEAAkAgAUEAKAKc0ICAAEYNAAJAIAJB/wFLDQAgASgCCCIEIAJBA3YiBUEDdEGw0ICAAGoiBkYaAkAgASgCDCICIARHDQBBAEEAKAKI0ICAAEF+IAV3cTYCiNCAgAAMAwsgAiAGRhogAiAENgIIIAQgAjYCDAwCCyABKAIYIQcCQAJAIAEoAgwiBiABRg0AIAEoAggiAiAESRogBiACNgIIIAIgBjYCDAwBCwJAIAFBFGoiAigCACIEDQAgAUEQaiICKAIAIgQNAEEAIQYMAQsDQCACIQUgBCIGQRRqIgIoAgAiBA0AIAZBEGohAiAGKAIQIgQNAAsgBUEANgIACyAHRQ0BAkACQCABIAEoAhwiBEECdEG40oCAAGoiAigCAEcNACACIAY2AgAgBg0BQQBBACgCjNCAgABBfiAEd3E2AozQgIAADAMLIAdBEEEUIAcoAhAgAUYbaiAGNgIAIAZFDQILIAYgBzYCGAJAIAEoAhAiAkUNACAGIAI2AhAgAiAGNgIYCyABKAIUIgJFDQEgBkEUaiACNgIAIAIgBjYCGAwBCyADKAIEIgJBA3FBA0cNACADIAJBfnE2AgRBACAANgKQ0ICAACABIABqIAA2AgAgASAAQQFyNgIEDwsgASADTw0AIAMoAgQiAkEBcUUNAAJAAkAgAkECcQ0AAkAgA0EAKAKg0ICAAEcNAEEAIAE2AqDQgIAAQQBBACgClNCAgAAgAGoiADYClNCAgAAgASAAQQFyNgIEIAFBACgCnNCAgABHDQNBAEEANgKQ0ICAAEEAQQA2ApzQgIAADwsCQCADQQAoApzQgIAARw0AQQAgATYCnNCAgABBAEEAKAKQ0ICAACAAaiIANgKQ0ICAACABIABBAXI2AgQgASAAaiAANgIADwsgAkF4cSAAaiEAAkACQCACQf8BSw0AIAMoAggiBCACQQN2IgVBA3RBsNCAgABqIgZGGgJAIAMoAgwiAiAERw0AQQBBACgCiNCAgABBfiAFd3E2AojQgIAADAILIAIgBkYaIAIgBDYCCCAEIAI2AgwMAQsgAygCGCEHAkACQCADKAIMIgYgA0YNACADKAIIIgJBACgCmNCAgABJGiAGIAI2AgggAiAGNgIMDAELAkAgA0EUaiICKAIAIgQNACADQRBqIgIoAgAiBA0AQQAhBgwBCwNAIAIhBSAEIgZBFGoiAigCACIEDQAgBkEQaiECIAYoAhAiBA0ACyAFQQA2AgALIAdFDQACQAJAIAMgAygCHCIEQQJ0QbjSgIAAaiICKAIARw0AIAIgBjYCACAGDQFBAEEAKAKM0ICAAEF+IAR3cTYCjNCAgAAMAgsgB0EQQRQgBygCECADRhtqIAY2AgAgBkUNAQsgBiAHNgIYAkAgAygCECICRQ0AIAYgAjYCECACIAY2AhgLIAMoAhQiAkUNACAGQRRqIAI2AgAgAiAGNgIYCyABIABqIAA2AgAgASAAQQFyNgIEIAFBACgCnNCAgABHDQFBACAANgKQ0ICAAA8LIAMgAkF+cTYCBCABIABqIAA2AgAgASAAQQFyNgIECwJAIABB/wFLDQAgAEF4cUGw0ICAAGohAgJAAkBBACgCiNCAgAAiBEEBIABBA3Z0IgBxDQBBACAEIAByNgKI0ICAACACIQAMAQsgAigCCCEACyAAIAE2AgwgAiABNgIIIAEgAjYCDCABIAA2AggPC0EfIQICQCAAQf///wdLDQAgAEEIdiICIAJBgP4/akEQdkEIcSICdCIEIARBgOAfakEQdkEEcSIEdCIGIAZBgIAPakEQdkECcSIGdEEPdiACIARyIAZyayICQQF0IAAgAkEVanZBAXFyQRxqIQILIAEgAjYCHCABQgA3AhAgAkECdEG40oCAAGohBAJAAkBBACgCjNCAgAAiBkEBIAJ0IgNxDQAgBCABNgIAQQAgBiADcjYCjNCAgAAgASAENgIYIAEgATYCCCABIAE2AgwMAQsgAEEAQRkgAkEBdmsgAkEfRht0IQIgBCgCACEGAkADQCAGIgQoAgRBeHEgAEYNASACQR12IQYgAkEBdCECIAQgBkEEcWpBEGoiAygCACIGDQALIAMgATYCACABIAQ2AhggASABNgIMIAEgATYCCAwBCyAEKAIIIgAgATYCDCAEIAE2AgggAUEANgIYIAEgBDYCDCABIAA2AggLQQBBACgCqNCAgABBf2oiAUF/IAEbNgKo0ICAAAsLBAAAAAtOAAJAIAANAD8AQRB0DwsCQCAAQf//A3ENACAAQX9MDQACQCAAQRB2QAAiAEF/Rw0AQQBBMDYC+NOAgABBfw8LIABBEHQPCxDKgICAAAAL8gICA38BfgJAIAJFDQAgACABOgAAIAIgAGoiA0F/aiABOgAAIAJBA0kNACAAIAE6AAIgACABOgABIANBfWogAToAACADQX5qIAE6AAAgAkEHSQ0AIAAgAToAAyADQXxqIAE6AAAgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIFayICQSBJDQAgAa1CgYCAgBB+IQYgAyAFaiEBA0AgASAGNwMYIAEgBjcDECABIAY3AwggASAGNwMAIAFBIGohASACQWBqIgJBH0sNAAsLIAALC45IAQBBgAgLhkgBAAAAAgAAAAMAAAAAAAAAAAAAAAQAAAAFAAAAAAAAAAAAAAAGAAAABwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEludmFsaWQgY2hhciBpbiB1cmwgcXVlcnkAU3BhbiBjYWxsYmFjayBlcnJvciBpbiBvbl9ib2R5AENvbnRlbnQtTGVuZ3RoIG92ZXJmbG93AENodW5rIHNpemUgb3ZlcmZsb3cAUmVzcG9uc2Ugb3ZlcmZsb3cASW52YWxpZCBtZXRob2QgZm9yIEhUVFAveC54IHJlcXVlc3QASW52YWxpZCBtZXRob2QgZm9yIFJUU1AveC54IHJlcXVlc3QARXhwZWN0ZWQgU09VUkNFIG1ldGhvZCBmb3IgSUNFL3gueCByZXF1ZXN0AEludmFsaWQgY2hhciBpbiB1cmwgZnJhZ21lbnQgc3RhcnQARXhwZWN0ZWQgZG90AFNwYW4gY2FsbGJhY2sgZXJyb3IgaW4gb25fc3RhdHVzAEludmFsaWQgcmVzcG9uc2Ugc3RhdHVzAEludmFsaWQgY2hhcmFjdGVyIGluIGNodW5rIGV4dGVuc2lvbnMAVXNlciBjYWxsYmFjayBlcnJvcgBgb25fcmVzZXRgIGNhbGxiYWNrIGVycm9yAGBvbl9jaHVua19oZWFkZXJgIGNhbGxiYWNrIGVycm9yAGBvbl9tZXNzYWdlX2JlZ2luYCBjYWxsYmFjayBlcnJvcgBgb25fY2h1bmtfZXh0ZW5zaW9uX3ZhbHVlYCBjYWxsYmFjayBlcnJvcgBgb25fc3RhdHVzX2NvbXBsZXRlYCBjYWxsYmFjayBlcnJvcgBgb25fdmVyc2lvbl9jb21wbGV0ZWAgY2FsbGJhY2sgZXJyb3IAYG9uX3VybF9jb21wbGV0ZWAgY2FsbGJhY2sgZXJyb3IAYG9uX2NodW5rX2NvbXBsZXRlYCBjYWxsYmFjayBlcnJvcgBgb25faGVhZGVyX3ZhbHVlX2NvbXBsZXRlYCBjYWxsYmFjayBlcnJvcgBgb25fbWVzc2FnZV9jb21wbGV0ZWAgY2FsbGJhY2sgZXJyb3IAYG9uX21ldGhvZF9jb21wbGV0ZWAgY2FsbGJhY2sgZXJyb3IAYG9uX2hlYWRlcl9maWVsZF9jb21wbGV0ZWAgY2FsbGJhY2sgZXJyb3IAYG9uX2NodW5rX2V4dGVuc2lvbl9uYW1lYCBjYWxsYmFjayBlcnJvcgBVbmV4cGVjdGVkIGNoYXIgaW4gdXJsIHNlcnZlcgBJbnZhbGlkIGhlYWRlciB2YWx1ZSBjaGFyAEludmFsaWQgaGVhZGVyIGZpZWxkIGNoYXIAU3BhbiBjYWxsYmFjayBlcnJvciBpbiBvbl92ZXJzaW9uAEludmFsaWQgbWlub3IgdmVyc2lvbgBJbnZhbGlkIG1ham9yIHZlcnNpb24ARXhwZWN0ZWQgc3BhY2UgYWZ0ZXIgdmVyc2lvbgBFeHBlY3RlZCBDUkxGIGFmdGVyIHZlcnNpb24ASW52YWxpZCBIVFRQIHZlcnNpb24ASW52YWxpZCBoZWFkZXIgdG9rZW4AU3BhbiBjYWxsYmFjayBlcnJvciBpbiBvbl91cmwASW52YWxpZCBjaGFyYWN0ZXJzIGluIHVybABVbmV4cGVjdGVkIHN0YXJ0IGNoYXIgaW4gdXJsAERvdWJsZSBAIGluIHVybABFbXB0eSBDb250ZW50LUxlbmd0aABJbnZhbGlkIGNoYXJhY3RlciBpbiBDb250ZW50LUxlbmd0aABEdXBsaWNhdGUgQ29udGVudC1MZW5ndGgASW52YWxpZCBjaGFyIGluIHVybCBwYXRoAENvbnRlbnQtTGVuZ3RoIGNhbid0IGJlIHByZXNlbnQgd2l0aCBUcmFuc2Zlci1FbmNvZGluZwBJbnZhbGlkIGNoYXJhY3RlciBpbiBjaHVuayBzaXplAFNwYW4gY2FsbGJhY2sgZXJyb3IgaW4gb25faGVhZGVyX3ZhbHVlAFNwYW4gY2FsbGJhY2sgZXJyb3IgaW4gb25fY2h1bmtfZXh0ZW5zaW9uX3ZhbHVlAEludmFsaWQgY2hhcmFjdGVyIGluIGNodW5rIGV4dGVuc2lvbnMgdmFsdWUATWlzc2luZyBleHBlY3RlZCBMRiBhZnRlciBoZWFkZXIgdmFsdWUASW52YWxpZCBgVHJhbnNmZXItRW5jb2RpbmdgIGhlYWRlciB2YWx1ZQBJbnZhbGlkIGNoYXJhY3RlciBpbiBjaHVuayBleHRlbnNpb25zIHF1b3RlIHZhbHVlAEludmFsaWQgY2hhcmFjdGVyIGluIGNodW5rIGV4dGVuc2lvbnMgcXVvdGVkIHZhbHVlAFBhdXNlZCBieSBvbl9oZWFkZXJzX2NvbXBsZXRlAEludmFsaWQgRU9GIHN0YXRlAG9uX3Jlc2V0IHBhdXNlAG9uX2NodW5rX2hlYWRlciBwYXVzZQBvbl9tZXNzYWdlX2JlZ2luIHBhdXNlAG9uX2NodW5rX2V4dGVuc2lvbl92YWx1ZSBwYXVzZQBvbl9zdGF0dXNfY29tcGxldGUgcGF1c2UAb25fdmVyc2lvbl9jb21wbGV0ZSBwYXVzZQBvbl91cmxfY29tcGxldGUgcGF1c2UAb25fY2h1bmtfY29tcGxldGUgcGF1c2UAb25faGVhZGVyX3ZhbHVlX2NvbXBsZXRlIHBhdXNlAG9uX21lc3NhZ2VfY29tcGxldGUgcGF1c2UAb25fbWV0aG9kX2NvbXBsZXRlIHBhdXNlAG9uX2hlYWRlcl9maWVsZF9jb21wbGV0ZSBwYXVzZQBvbl9jaHVua19leHRlbnNpb25fbmFtZSBwYXVzZQBVbmV4cGVjdGVkIHNwYWNlIGFmdGVyIHN0YXJ0IGxpbmUAU3BhbiBjYWxsYmFjayBlcnJvciBpbiBvbl9jaHVua19leHRlbnNpb25fbmFtZQBJbnZhbGlkIGNoYXJhY3RlciBpbiBjaHVuayBleHRlbnNpb25zIG5hbWUAUGF1c2Ugb24gQ09OTkVDVC9VcGdyYWRlAFBhdXNlIG9uIFBSSS9VcGdyYWRlAEV4cGVjdGVkIEhUVFAvMiBDb25uZWN0aW9uIFByZWZhY2UAU3BhbiBjYWxsYmFjayBlcnJvciBpbiBvbl9tZXRob2QARXhwZWN0ZWQgc3BhY2UgYWZ0ZXIgbWV0aG9kAFNwYW4gY2FsbGJhY2sgZXJyb3IgaW4gb25faGVhZGVyX2ZpZWxkAFBhdXNlZABJbnZhbGlkIHdvcmQgZW5jb3VudGVyZWQASW52YWxpZCBtZXRob2QgZW5jb3VudGVyZWQAVW5leHBlY3RlZCBjaGFyIGluIHVybCBzY2hlbWEAUmVxdWVzdCBoYXMgaW52YWxpZCBgVHJhbnNmZXItRW5jb2RpbmdgAFNXSVRDSF9QUk9YWQBVU0VfUFJPWFkATUtBQ1RJVklUWQBVTlBST0NFU1NBQkxFX0VOVElUWQBDT1BZAE1PVkVEX1BFUk1BTkVOVExZAFRPT19FQVJMWQBOT1RJRlkARkFJTEVEX0RFUEVOREVOQ1kAQkFEX0dBVEVXQVkAUExBWQBQVVQAQ0hFQ0tPVVQAR0FURVdBWV9USU1FT1VUAFJFUVVFU1RfVElNRU9VVABORVRXT1JLX0NPTk5FQ1RfVElNRU9VVABDT05ORUNUSU9OX1RJTUVPVVQATE9HSU5fVElNRU9VVABORVRXT1JLX1JFQURfVElNRU9VVABQT1NUAE1JU0RJUkVDVEVEX1JFUVVFU1QAQ0xJRU5UX0NMT1NFRF9SRVFVRVNUAENMSUVOVF9DTE9TRURfTE9BRF9CQUxBTkNFRF9SRVFVRVNUAEJBRF9SRVFVRVNUAEhUVFBfUkVRVUVTVF9TRU5UX1RPX0hUVFBTX1BPUlQAUkVQT1JUAElNX0FfVEVBUE9UAFJFU0VUX0NPTlRFTlQATk9fQ09OVEVOVABQQVJUSUFMX0NPTlRFTlQASFBFX0lOVkFMSURfQ09OU1RBTlQASFBFX0NCX1JFU0VUAEdFVABIUEVfU1RSSUNUAENPTkZMSUNUAFRFTVBPUkFSWV9SRURJUkVDVABQRVJNQU5FTlRfUkVESVJFQ1QAQ09OTkVDVABNVUxUSV9TVEFUVVMASFBFX0lOVkFMSURfU1RBVFVTAFRPT19NQU5ZX1JFUVVFU1RTAEVBUkxZX0hJTlRTAFVOQVZBSUxBQkxFX0ZPUl9MRUdBTF9SRUFTT05TAE9QVElPTlMAU1dJVENISU5HX1BST1RPQ09MUwBWQVJJQU5UX0FMU09fTkVHT1RJQVRFUwBNVUxUSVBMRV9DSE9JQ0VTAElOVEVSTkFMX1NFUlZFUl9FUlJPUgBXRUJfU0VSVkVSX1VOS05PV05fRVJST1IAUkFJTEdVTl9FUlJPUgBJREVOVElUWV9QUk9WSURFUl9BVVRIRU5USUNBVElPTl9FUlJPUgBTU0xfQ0VSVElGSUNBVEVfRVJST1IASU5WQUxJRF9YX0ZPUldBUkRFRF9GT1IAU0VUX1BBUkFNRVRFUgBHRVRfUEFSQU1FVEVSAEhQRV9VU0VSAFNFRV9PVEhFUgBIUEVfQ0JfQ0hVTktfSEVBREVSAE1LQ0FMRU5EQVIAU0VUVVAAV0VCX1NFUlZFUl9JU19ET1dOAFRFQVJET1dOAEhQRV9DTE9TRURfQ09OTkVDVElPTgBIRVVSSVNUSUNfRVhQSVJBVElPTgBESVNDT05ORUNURURfT1BFUkFUSU9OAE5PTl9BVVRIT1JJVEFUSVZFX0lORk9STUFUSU9OAEhQRV9JTlZBTElEX1ZFUlNJT04ASFBFX0NCX01FU1NBR0VfQkVHSU4AU0lURV9JU19GUk9aRU4ASFBFX0lOVkFMSURfSEVBREVSX1RPS0VOAElOVkFMSURfVE9LRU4ARk9SQklEREVOAEVOSEFOQ0VfWU9VUl9DQUxNAEhQRV9JTlZBTElEX1VSTABCTE9DS0VEX0JZX1BBUkVOVEFMX0NPTlRST0wATUtDT0wAQUNMAEhQRV9JTlRFUk5BTABSRVFVRVNUX0hFQURFUl9GSUVMRFNfVE9PX0xBUkdFX1VOT0ZGSUNJQUwASFBFX09LAFVOTElOSwBVTkxPQ0sAUFJJAFJFVFJZX1dJVEgASFBFX0lOVkFMSURfQ09OVEVOVF9MRU5HVEgASFBFX1VORVhQRUNURURfQ09OVEVOVF9MRU5HVEgARkxVU0gAUFJPUFBBVENIAE0tU0VBUkNIAFVSSV9UT09fTE9ORwBQUk9DRVNTSU5HAE1JU0NFTExBTkVPVVNfUEVSU0lTVEVOVF9XQVJOSU5HAE1JU0NFTExBTkVPVVNfV0FSTklORwBIUEVfSU5WQUxJRF9UUkFOU0ZFUl9FTkNPRElORwBFeHBlY3RlZCBDUkxGAEhQRV9JTlZBTElEX0NIVU5LX1NJWkUATU9WRQBDT05USU5VRQBIUEVfQ0JfU1RBVFVTX0NPTVBMRVRFAEhQRV9DQl9IRUFERVJTX0NPTVBMRVRFAEhQRV9DQl9WRVJTSU9OX0NPTVBMRVRFAEhQRV9DQl9VUkxfQ09NUExFVEUASFBFX0NCX0NIVU5LX0NPTVBMRVRFAEhQRV9DQl9IRUFERVJfVkFMVUVfQ09NUExFVEUASFBFX0NCX0NIVU5LX0VYVEVOU0lPTl9WQUxVRV9DT01QTEVURQBIUEVfQ0JfQ0hVTktfRVhURU5TSU9OX05BTUVfQ09NUExFVEUASFBFX0NCX01FU1NBR0VfQ09NUExFVEUASFBFX0NCX01FVEhPRF9DT01QTEVURQBIUEVfQ0JfSEVBREVSX0ZJRUxEX0NPTVBMRVRFAERFTEVURQBIUEVfSU5WQUxJRF9FT0ZfU1RBVEUASU5WQUxJRF9TU0xfQ0VSVElGSUNBVEUAUEFVU0UATk9fUkVTUE9OU0UAVU5TVVBQT1JURURfTUVESUFfVFlQRQBHT05FAE5PVF9BQ0NFUFRBQkxFAFNFUlZJQ0VfVU5BVkFJTEFCTEUAUkFOR0VfTk9UX1NBVElTRklBQkxFAE9SSUdJTl9JU19VTlJFQUNIQUJMRQBSRVNQT05TRV9JU19TVEFMRQBQVVJHRQBNRVJHRQBSRVFVRVNUX0hFQURFUl9GSUVMRFNfVE9PX0xBUkdFAFJFUVVFU1RfSEVBREVSX1RPT19MQVJHRQBQQVlMT0FEX1RPT19MQVJHRQBJTlNVRkZJQ0lFTlRfU1RPUkFHRQBIUEVfUEFVU0VEX1VQR1JBREUASFBFX1BBVVNFRF9IMl9VUEdSQURFAFNPVVJDRQBBTk5PVU5DRQBUUkFDRQBIUEVfVU5FWFBFQ1RFRF9TUEFDRQBERVNDUklCRQBVTlNVQlNDUklCRQBSRUNPUkQASFBFX0lOVkFMSURfTUVUSE9EAE5PVF9GT1VORABQUk9QRklORABVTkJJTkQAUkVCSU5EAFVOQVVUSE9SSVpFRABNRVRIT0RfTk9UX0FMTE9XRUQASFRUUF9WRVJTSU9OX05PVF9TVVBQT1JURUQAQUxSRUFEWV9SRVBPUlRFRABBQ0NFUFRFRABOT1RfSU1QTEVNRU5URUQATE9PUF9ERVRFQ1RFRABIUEVfQ1JfRVhQRUNURUQASFBFX0xGX0VYUEVDVEVEAENSRUFURUQASU1fVVNFRABIUEVfUEFVU0VEAFRJTUVPVVRfT0NDVVJFRABQQVlNRU5UX1JFUVVJUkVEAFBSRUNPTkRJVElPTl9SRVFVSVJFRABQUk9YWV9BVVRIRU5USUNBVElPTl9SRVFVSVJFRABORVRXT1JLX0FVVEhFTlRJQ0FUSU9OX1JFUVVJUkVEAExFTkdUSF9SRVFVSVJFRABTU0xfQ0VSVElGSUNBVEVfUkVRVUlSRUQAVVBHUkFERV9SRVFVSVJFRABQQUdFX0VYUElSRUQAUFJFQ09ORElUSU9OX0ZBSUxFRABFWFBFQ1RBVElPTl9GQUlMRUQAUkVWQUxJREFUSU9OX0ZBSUxFRABTU0xfSEFORFNIQUtFX0ZBSUxFRABMT0NLRUQAVFJBTlNGT1JNQVRJT05fQVBQTElFRABOT1RfTU9ESUZJRUQATk9UX0VYVEVOREVEAEJBTkRXSURUSF9MSU1JVF9FWENFRURFRABTSVRFX0lTX09WRVJMT0FERUQASEVBRABFeHBlY3RlZCBIVFRQLwAAXhMAACYTAAAwEAAA8BcAAJ0TAAAVEgAAORcAAPASAAAKEAAAdRIAAK0SAACCEwAATxQAAH8QAACgFQAAIxQAAIkSAACLFAAATRUAANQRAADPFAAAEBgAAMkWAADcFgAAwREAAOAXAAC7FAAAdBQAAHwVAADlFAAACBcAAB8QAABlFQAAoxQAACgVAAACFQAAmRUAACwQAACLGQAATw8AANQOAABqEAAAzhAAAAIXAACJDgAAbhMAABwTAABmFAAAVhcAAMETAADNEwAAbBMAAGgXAABmFwAAXxcAACITAADODwAAaQ4AANgOAABjFgAAyxMAAKoOAAAoFwAAJhcAAMUTAABdFgAA6BEAAGcTAABlEwAA8hYAAHMTAAAdFwAA+RYAAPMRAADPDgAAzhUAAAwSAACzEQAApREAAGEQAAAyFwAAuxMAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQIBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIDAgICAgIAAAICAAICAAICAgICAgICAgIABAAAAAAAAgICAgICAgICAgICAgICAgICAgICAgICAgIAAAACAgICAgICAgICAgICAgICAgICAgICAgICAgICAgACAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAACAAICAgICAAACAgACAgACAgICAgICAgICAAMABAAAAAICAgICAgICAgICAgICAgICAgICAgICAgICAAAAAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAAgACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbG9zZWVlcC1hbGl2ZQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQEBAQEBAQEBAQIBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBY2h1bmtlZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAQEBAQEAAAEBAAEBAAEBAQEBAQEBAQEAAAAAAAAAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAAABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABlY3Rpb25lbnQtbGVuZ3Rob25yb3h5LWNvbm5lY3Rpb24AAAAAAAAAAAAAAAAAAAByYW5zZmVyLWVuY29kaW5ncGdyYWRlDQoNCg0KU00NCg0KVFRQL0NFL1RTUC8AAAAAAAAAAAAAAAABAgABAwAAAAAAAAAAAAAAAAAAAAAAAAQBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAAAAAAAAAAAAQIAAQMAAAAAAAAAAAAAAAAAAAAAAAAEAQEFAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQAAAAAAAAAAAAEAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAAAAAAAAAAAAAQAAAgAAAAAAAAAAAAAAAAAAAAAAAAMEAAAEBAQEBAQEBAQEBAUEBAQEBAQEBAQEBAQABAAGBwQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAEAAQABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwAAAAAAAAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAIAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAAAAAAAADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABOT1VOQ0VFQ0tPVVRORUNURVRFQ1JJQkVMVVNIRVRFQURTRUFSQ0hSR0VDVElWSVRZTEVOREFSVkVPVElGWVBUSU9OU0NIU0VBWVNUQVRDSEdFT1JESVJFQ1RPUlRSQ0hQQVJBTUVURVJVUkNFQlNDUklCRUFSRE9XTkFDRUlORE5LQ0tVQlNDUklCRUhUVFAvQURUUC8=' -const isNullSet = c => c.value === '<0.0.0-0' -const isAny = c => c.value === '' -// take a set of comparators and determine whether there -// exists a version which can satisfy it -const isSatisfiable = (comparators, options) => { - let result = true - const remainingComparators = comparators.slice() - let testComparator = remainingComparators.pop() +/***/ }), - while (result && remainingComparators.length) { - result = remainingComparators.every((otherComparator) => { - return testComparator.intersects(otherComparator, options) - }) +/***/ 5627: +/***/ ((module) => { - testComparator = remainingComparators.pop() - } +module.exports = 'AGFzbQEAAAABMAhgAX8Bf2ADf39/AX9gBH9/f38Bf2AAAGADf39/AGABfwBgAn9/AGAGf39/f39/AALLAQgDZW52GHdhc21fb25faGVhZGVyc19jb21wbGV0ZQACA2VudhV3YXNtX29uX21lc3NhZ2VfYmVnaW4AAANlbnYLd2FzbV9vbl91cmwAAQNlbnYOd2FzbV9vbl9zdGF0dXMAAQNlbnYUd2FzbV9vbl9oZWFkZXJfZmllbGQAAQNlbnYUd2FzbV9vbl9oZWFkZXJfdmFsdWUAAQNlbnYMd2FzbV9vbl9ib2R5AAEDZW52GHdhc21fb25fbWVzc2FnZV9jb21wbGV0ZQAAA0ZFAwMEAAAFAAAAAAAABQEFAAUFBQAABgAAAAAGBgYGAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAAABAQcAAAUFAwABBAUBcAESEgUDAQACBggBfwFBgNQECwfRBSIGbWVtb3J5AgALX2luaXRpYWxpemUACRlfX2luZGlyZWN0X2Z1bmN0aW9uX3RhYmxlAQALbGxodHRwX2luaXQAChhsbGh0dHBfc2hvdWxkX2tlZXBfYWxpdmUAQQxsbGh0dHBfYWxsb2MADAZtYWxsb2MARgtsbGh0dHBfZnJlZQANBGZyZWUASA9sbGh0dHBfZ2V0X3R5cGUADhVsbGh0dHBfZ2V0X2h0dHBfbWFqb3IADxVsbGh0dHBfZ2V0X2h0dHBfbWlub3IAEBFsbGh0dHBfZ2V0X21ldGhvZAARFmxsaHR0cF9nZXRfc3RhdHVzX2NvZGUAEhJsbGh0dHBfZ2V0X3VwZ3JhZGUAEwxsbGh0dHBfcmVzZXQAFA5sbGh0dHBfZXhlY3V0ZQAVFGxsaHR0cF9zZXR0aW5nc19pbml0ABYNbGxodHRwX2ZpbmlzaAAXDGxsaHR0cF9wYXVzZQAYDWxsaHR0cF9yZXN1bWUAGRtsbGh0dHBfcmVzdW1lX2FmdGVyX3VwZ3JhZGUAGhBsbGh0dHBfZ2V0X2Vycm5vABsXbGxodHRwX2dldF9lcnJvcl9yZWFzb24AHBdsbGh0dHBfc2V0X2Vycm9yX3JlYXNvbgAdFGxsaHR0cF9nZXRfZXJyb3JfcG9zAB4RbGxodHRwX2Vycm5vX25hbWUAHxJsbGh0dHBfbWV0aG9kX25hbWUAIBJsbGh0dHBfc3RhdHVzX25hbWUAIRpsbGh0dHBfc2V0X2xlbmllbnRfaGVhZGVycwAiIWxsaHR0cF9zZXRfbGVuaWVudF9jaHVua2VkX2xlbmd0aAAjHWxsaHR0cF9zZXRfbGVuaWVudF9rZWVwX2FsaXZlACQkbGxodHRwX3NldF9sZW5pZW50X3RyYW5zZmVyX2VuY29kaW5nACUYbGxodHRwX21lc3NhZ2VfbmVlZHNfZW9mAD8JFwEAQQELEQECAwQFCwYHNTk3MS8tJyspCrLgAkUCAAsIABCIgICAAAsZACAAEMKAgIAAGiAAIAI2AjggACABOgAoCxwAIAAgAC8BMiAALQAuIAAQwYCAgAAQgICAgAALKgEBf0HAABDGgICAACIBEMKAgIAAGiABQYCIgIAANgI4IAEgADoAKCABCwoAIAAQyICAgAALBwAgAC0AKAsHACAALQAqCwcAIAAtACsLBwAgAC0AKQsHACAALwEyCwcAIAAtAC4LRQEEfyAAKAIYIQEgAC0ALSECIAAtACghAyAAKAI4IQQgABDCgICAABogACAENgI4IAAgAzoAKCAAIAI6AC0gACABNgIYCxEAIAAgASABIAJqEMOAgIAACxAAIABBAEHcABDMgICAABoLZwEBf0EAIQECQCAAKAIMDQACQAJAAkACQCAALQAvDgMBAAMCCyAAKAI4IgFFDQAgASgCLCIBRQ0AIAAgARGAgICAAAAiAQ0DC0EADwsQyoCAgAAACyAAQcOWgIAANgIQQQ4hAQsgAQseAAJAIAAoAgwNACAAQdGbgIAANgIQIABBFTYCDAsLFgACQCAAKAIMQRVHDQAgAEEANgIMCwsWAAJAIAAoAgxBFkcNACAAQQA2AgwLCwcAIAAoAgwLBwAgACgCEAsJACAAIAE2AhALBwAgACgCFAsiAAJAIABBJEkNABDKgICAAAALIABBAnRBoLOAgABqKAIACyIAAkAgAEEuSQ0AEMqAgIAAAAsgAEECdEGwtICAAGooAgAL7gsBAX9B66iAgAAhAQJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIABBnH9qDvQDY2IAAWFhYWFhYQIDBAVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhBgcICQoLDA0OD2FhYWFhEGFhYWFhYWFhYWFhEWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYRITFBUWFxgZGhthYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2YTc4OTphYWFhYWFhYTthYWE8YWFhYT0+P2FhYWFhYWFhQGFhQWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYUJDREVGR0hJSktMTU5PUFFSU2FhYWFhYWFhVFVWV1hZWlthXF1hYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFeYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhX2BhC0Hhp4CAAA8LQaShgIAADwtBy6yAgAAPC0H+sYCAAA8LQcCkgIAADwtBq6SAgAAPC0GNqICAAA8LQeKmgIAADwtBgLCAgAAPC0G5r4CAAA8LQdekgIAADwtB75+AgAAPC0Hhn4CAAA8LQfqfgIAADwtB8qCAgAAPC0Gor4CAAA8LQa6ygIAADwtBiLCAgAAPC0Hsp4CAAA8LQYKigIAADwtBjp2AgAAPC0HQroCAAA8LQcqjgIAADwtBxbKAgAAPC0HfnICAAA8LQdKcgIAADwtBxKCAgAAPC0HXoICAAA8LQaKfgIAADwtB7a6AgAAPC0GrsICAAA8LQdSlgIAADwtBzK6AgAAPC0H6roCAAA8LQfyrgIAADwtB0rCAgAAPC0HxnYCAAA8LQbuggIAADwtB96uAgAAPC0GQsYCAAA8LQdexgIAADwtBoq2AgAAPC0HUp4CAAA8LQeCrgIAADwtBn6yAgAAPC0HrsYCAAA8LQdWfgIAADwtByrGAgAAPC0HepYCAAA8LQdSegIAADwtB9JyAgAAPC0GnsoCAAA8LQbGdgIAADwtBoJ2AgAAPC0G5sYCAAA8LQbywgIAADwtBkqGAgAAPC0GzpoCAAA8LQemsgIAADwtBrJ6AgAAPC0HUq4CAAA8LQfemgIAADwtBgKaAgAAPC0GwoYCAAA8LQf6egIAADwtBjaOAgAAPC0GJrYCAAA8LQfeigIAADwtBoLGAgAAPC0Gun4CAAA8LQcalgIAADwtB6J6AgAAPC0GTooCAAA8LQcKvgIAADwtBw52AgAAPC0GLrICAAA8LQeGdgIAADwtBja+AgAAPC0HqoYCAAA8LQbStgIAADwtB0q+AgAAPC0HfsoCAAA8LQdKygIAADwtB8LCAgAAPC0GpooCAAA8LQfmjgIAADwtBmZ6AgAAPC0G1rICAAA8LQZuwgIAADwtBkrKAgAAPC0G2q4CAAA8LQcKigIAADwtB+LKAgAAPC0GepYCAAA8LQdCigIAADwtBup6AgAAPC0GBnoCAAA8LEMqAgIAAAAtB1qGAgAAhAQsgAQsWACAAIAAtAC1B/gFxIAFBAEdyOgAtCxkAIAAgAC0ALUH9AXEgAUEAR0EBdHI6AC0LGQAgACAALQAtQfsBcSABQQBHQQJ0cjoALQsZACAAIAAtAC1B9wFxIAFBAEdBA3RyOgAtCy4BAn9BACEDAkAgACgCOCIERQ0AIAQoAgAiBEUNACAAIAQRgICAgAAAIQMLIAMLSQECf0EAIQMCQCAAKAI4IgRFDQAgBCgCBCIERQ0AIAAgASACIAFrIAQRgYCAgAAAIgNBf0cNACAAQcaRgIAANgIQQRghAwsgAwsuAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAIwIgRFDQAgACAEEYCAgIAAACEDCyADC0kBAn9BACEDAkAgACgCOCIERQ0AIAQoAggiBEUNACAAIAEgAiABayAEEYGAgIAAACIDQX9HDQAgAEH2ioCAADYCEEEYIQMLIAMLLgECf0EAIQMCQCAAKAI4IgRFDQAgBCgCNCIERQ0AIAAgBBGAgICAAAAhAwsgAwtJAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAIMIgRFDQAgACABIAIgAWsgBBGBgICAAAAiA0F/Rw0AIABB7ZqAgAA2AhBBGCEDCyADCy4BAn9BACEDAkAgACgCOCIERQ0AIAQoAjgiBEUNACAAIAQRgICAgAAAIQMLIAMLSQECf0EAIQMCQCAAKAI4IgRFDQAgBCgCECIERQ0AIAAgASACIAFrIAQRgYCAgAAAIgNBf0cNACAAQZWQgIAANgIQQRghAwsgAwsuAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAI8IgRFDQAgACAEEYCAgIAAACEDCyADC0kBAn9BACEDAkAgACgCOCIERQ0AIAQoAhQiBEUNACAAIAEgAiABayAEEYGAgIAAACIDQX9HDQAgAEGqm4CAADYCEEEYIQMLIAMLLgECf0EAIQMCQCAAKAI4IgRFDQAgBCgCQCIERQ0AIAAgBBGAgICAAAAhAwsgAwtJAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAIYIgRFDQAgACABIAIgAWsgBBGBgICAAAAiA0F/Rw0AIABB7ZOAgAA2AhBBGCEDCyADCy4BAn9BACEDAkAgACgCOCIERQ0AIAQoAkQiBEUNACAAIAQRgICAgAAAIQMLIAMLLgECf0EAIQMCQCAAKAI4IgRFDQAgBCgCJCIERQ0AIAAgBBGAgICAAAAhAwsgAwsuAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAIsIgRFDQAgACAEEYCAgIAAACEDCyADC0kBAn9BACEDAkAgACgCOCIERQ0AIAQoAigiBEUNACAAIAEgAiABayAEEYGAgIAAACIDQX9HDQAgAEH2iICAADYCEEEYIQMLIAMLLgECf0EAIQMCQCAAKAI4IgRFDQAgBCgCUCIERQ0AIAAgBBGAgICAAAAhAwsgAwtJAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAIcIgRFDQAgACABIAIgAWsgBBGBgICAAAAiA0F/Rw0AIABBwpmAgAA2AhBBGCEDCyADCy4BAn9BACEDAkAgACgCOCIERQ0AIAQoAkgiBEUNACAAIAQRgICAgAAAIQMLIAMLSQECf0EAIQMCQCAAKAI4IgRFDQAgBCgCICIERQ0AIAAgASACIAFrIAQRgYCAgAAAIgNBf0cNACAAQZSUgIAANgIQQRghAwsgAwsuAQJ/QQAhAwJAIAAoAjgiBEUNACAEKAJMIgRFDQAgACAEEYCAgIAAACEDCyADCy4BAn9BACEDAkAgACgCOCIERQ0AIAQoAlQiBEUNACAAIAQRgICAgAAAIQMLIAMLLgECf0EAIQMCQCAAKAI4IgRFDQAgBCgCWCIERQ0AIAAgBBGAgICAAAAhAwsgAwtFAQF/AkACQCAALwEwQRRxQRRHDQBBASEDIAAtAChBAUYNASAALwEyQeUARiEDDAELIAAtAClBBUYhAwsgACADOgAuQQAL/gEBA39BASEDAkAgAC8BMCIEQQhxDQAgACkDIEIAUiEDCwJAAkAgAC0ALkUNAEEBIQUgAC0AKUEFRg0BQQEhBSAEQcAAcUUgA3FBAUcNAQtBACEFIARBwABxDQBBAiEFIARB//8DcSIDQQhxDQACQCADQYAEcUUNAAJAIAAtAChBAUcNACAALQAtQQpxDQBBBQ8LQQQPCwJAIANBIHENAAJAIAAtAChBAUYNACAALwEyQf//A3EiAEGcf2pB5ABJDQAgAEHMAUYNACAAQbACRg0AQQQhBSAEQShxRQ0CIANBiARxQYAERg0CC0EADwtBAEEDIAApAyBQGyEFCyAFC2IBAn9BACEBAkAgAC0AKEEBRg0AIAAvATJB//8DcSICQZx/akHkAEkNACACQcwBRg0AIAJBsAJGDQAgAC8BMCIAQcAAcQ0AQQEhASAAQYgEcUGABEYNACAAQShxRSEBCyABC6cBAQN/AkACQAJAIAAtACpFDQAgAC0AK0UNAEEAIQMgAC8BMCIEQQJxRQ0BDAILQQAhAyAALwEwIgRBAXFFDQELQQEhAyAALQAoQQFGDQAgAC8BMkH//wNxIgVBnH9qQeQASQ0AIAVBzAFGDQAgBUGwAkYNACAEQcAAcQ0AQQAhAyAEQYgEcUGABEYNACAEQShxQQBHIQMLIABBADsBMCAAQQA6AC8gAwuZAQECfwJAAkACQCAALQAqRQ0AIAAtACtFDQBBACEBIAAvATAiAkECcUUNAQwCC0EAIQEgAC8BMCICQQFxRQ0BC0EBIQEgAC0AKEEBRg0AIAAvATJB//8DcSIAQZx/akHkAEkNACAAQcwBRg0AIABBsAJGDQAgAkHAAHENAEEAIQEgAkGIBHFBgARGDQAgAkEocUEARyEBCyABC0kBAXsgAEEQav0MAAAAAAAAAAAAAAAAAAAAACIB/QsDACAAIAH9CwMAIABBMGogAf0LAwAgAEEgaiAB/QsDACAAQd0BNgIcQQALewEBfwJAIAAoAgwiAw0AAkAgACgCBEUNACAAIAE2AgQLAkAgACABIAIQxICAgAAiAw0AIAAoAgwPCyAAIAM2AhxBACEDIAAoAgQiAUUNACAAIAEgAiAAKAIIEYGAgIAAACIBRQ0AIAAgAjYCFCAAIAE2AgwgASEDCyADC+TzAQMOfwN+BH8jgICAgABBEGsiAySAgICAACABIQQgASEFIAEhBiABIQcgASEIIAEhCSABIQogASELIAEhDCABIQ0gASEOIAEhDwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCAAKAIcIhBBf2oO3QHaAQHZAQIDBAUGBwgJCgsMDQ7YAQ8Q1wEREtYBExQVFhcYGRob4AHfARwdHtUBHyAhIiMkJdQBJicoKSorLNMB0gEtLtEB0AEvMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUbbAUdISUrPAc4BS80BTMwBTU5PUFFSU1RVVldYWVpbXF1eX2BhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ent8fX5/gAGBAYIBgwGEAYUBhgGHAYgBiQGKAYsBjAGNAY4BjwGQAZEBkgGTAZQBlQGWAZcBmAGZAZoBmwGcAZ0BngGfAaABoQGiAaMBpAGlAaYBpwGoAakBqgGrAawBrQGuAa8BsAGxAbIBswG0AbUBtgG3AcsBygG4AckBuQHIAboBuwG8Ab0BvgG/AcABwQHCAcMBxAHFAcYBANwBC0EAIRAMxgELQQ4hEAzFAQtBDSEQDMQBC0EPIRAMwwELQRAhEAzCAQtBEyEQDMEBC0EUIRAMwAELQRUhEAy/AQtBFiEQDL4BC0EXIRAMvQELQRghEAy8AQtBGSEQDLsBC0EaIRAMugELQRshEAy5AQtBHCEQDLgBC0EIIRAMtwELQR0hEAy2AQtBICEQDLUBC0EfIRAMtAELQQchEAyzAQtBISEQDLIBC0EiIRAMsQELQR4hEAywAQtBIyEQDK8BC0ESIRAMrgELQREhEAytAQtBJCEQDKwBC0ElIRAMqwELQSYhEAyqAQtBJyEQDKkBC0HDASEQDKgBC0EpIRAMpwELQSshEAymAQtBLCEQDKUBC0EtIRAMpAELQS4hEAyjAQtBLyEQDKIBC0HEASEQDKEBC0EwIRAMoAELQTQhEAyfAQtBDCEQDJ4BC0ExIRAMnQELQTIhEAycAQtBMyEQDJsBC0E5IRAMmgELQTUhEAyZAQtBxQEhEAyYAQtBCyEQDJcBC0E6IRAMlgELQTYhEAyVAQtBCiEQDJQBC0E3IRAMkwELQTghEAySAQtBPCEQDJEBC0E7IRAMkAELQT0hEAyPAQtBCSEQDI4BC0EoIRAMjQELQT4hEAyMAQtBPyEQDIsBC0HAACEQDIoBC0HBACEQDIkBC0HCACEQDIgBC0HDACEQDIcBC0HEACEQDIYBC0HFACEQDIUBC0HGACEQDIQBC0EqIRAMgwELQccAIRAMggELQcgAIRAMgQELQckAIRAMgAELQcoAIRAMfwtBywAhEAx+C0HNACEQDH0LQcwAIRAMfAtBzgAhEAx7C0HPACEQDHoLQdAAIRAMeQtB0QAhEAx4C0HSACEQDHcLQdMAIRAMdgtB1AAhEAx1C0HWACEQDHQLQdUAIRAMcwtBBiEQDHILQdcAIRAMcQtBBSEQDHALQdgAIRAMbwtBBCEQDG4LQdkAIRAMbQtB2gAhEAxsC0HbACEQDGsLQdwAIRAMagtBAyEQDGkLQd0AIRAMaAtB3gAhEAxnC0HfACEQDGYLQeEAIRAMZQtB4AAhEAxkC0HiACEQDGMLQeMAIRAMYgtBAiEQDGELQeQAIRAMYAtB5QAhEAxfC0HmACEQDF4LQecAIRAMXQtB6AAhEAxcC0HpACEQDFsLQeoAIRAMWgtB6wAhEAxZC0HsACEQDFgLQe0AIRAMVwtB7gAhEAxWC0HvACEQDFULQfAAIRAMVAtB8QAhEAxTC0HyACEQDFILQfMAIRAMUQtB9AAhEAxQC0H1ACEQDE8LQfYAIRAMTgtB9wAhEAxNC0H4ACEQDEwLQfkAIRAMSwtB+gAhEAxKC0H7ACEQDEkLQfwAIRAMSAtB/QAhEAxHC0H+ACEQDEYLQf8AIRAMRQtBgAEhEAxEC0GBASEQDEMLQYIBIRAMQgtBgwEhEAxBC0GEASEQDEALQYUBIRAMPwtBhgEhEAw+C0GHASEQDD0LQYgBIRAMPAtBiQEhEAw7C0GKASEQDDoLQYsBIRAMOQtBjAEhEAw4C0GNASEQDDcLQY4BIRAMNgtBjwEhEAw1C0GQASEQDDQLQZEBIRAMMwtBkgEhEAwyC0GTASEQDDELQZQBIRAMMAtBlQEhEAwvC0GWASEQDC4LQZcBIRAMLQtBmAEhEAwsC0GZASEQDCsLQZoBIRAMKgtBmwEhEAwpC0GcASEQDCgLQZ0BIRAMJwtBngEhEAwmC0GfASEQDCULQaABIRAMJAtBoQEhEAwjC0GiASEQDCILQaMBIRAMIQtBpAEhEAwgC0GlASEQDB8LQaYBIRAMHgtBpwEhEAwdC0GoASEQDBwLQakBIRAMGwtBqgEhEAwaC0GrASEQDBkLQawBIRAMGAtBrQEhEAwXC0GuASEQDBYLQQEhEAwVC0GvASEQDBQLQbABIRAMEwtBsQEhEAwSC0GzASEQDBELQbIBIRAMEAtBtAEhEAwPC0G1ASEQDA4LQbYBIRAMDQtBtwEhEAwMC0G4ASEQDAsLQbkBIRAMCgtBugEhEAwJC0G7ASEQDAgLQcYBIRAMBwtBvAEhEAwGC0G9ASEQDAULQb4BIRAMBAtBvwEhEAwDC0HAASEQDAILQcIBIRAMAQtBwQEhEAsDQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIBAOxwEAAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB4fICEjJSg/QEFERUZHSElKS0xNT1BRUlPeA1dZW1xdYGJlZmdoaWprbG1vcHFyc3R1dnd4eXp7fH1+gAGCAYUBhgGHAYkBiwGMAY0BjgGPAZABkQGUAZUBlgGXAZgBmQGaAZsBnAGdAZ4BnwGgAaEBogGjAaQBpQGmAacBqAGpAaoBqwGsAa0BrgGvAbABsQGyAbMBtAG1AbYBtwG4AbkBugG7AbwBvQG+Ab8BwAHBAcIBwwHEAcUBxgHHAcgByQHKAcsBzAHNAc4BzwHQAdEB0gHTAdQB1QHWAdcB2AHZAdoB2wHcAd0B3gHgAeEB4gHjAeQB5QHmAecB6AHpAeoB6wHsAe0B7gHvAfAB8QHyAfMBmQKkArAC/gL+AgsgASIEIAJHDfMBQd0BIRAM/wMLIAEiECACRw3dAUHDASEQDP4DCyABIgEgAkcNkAFB9wAhEAz9AwsgASIBIAJHDYYBQe8AIRAM/AMLIAEiASACRw1/QeoAIRAM+wMLIAEiASACRw17QegAIRAM+gMLIAEiASACRw14QeYAIRAM+QMLIAEiASACRw0aQRghEAz4AwsgASIBIAJHDRRBEiEQDPcDCyABIgEgAkcNWUHFACEQDPYDCyABIgEgAkcNSkE/IRAM9QMLIAEiASACRw1IQTwhEAz0AwsgASIBIAJHDUFBMSEQDPMDCyAALQAuQQFGDesDDIcCCyAAIAEiASACEMCAgIAAQQFHDeYBIABCADcDIAznAQsgACABIgEgAhC0gICAACIQDecBIAEhAQz1AgsCQCABIgEgAkcNAEEGIRAM8AMLIAAgAUEBaiIBIAIQu4CAgAAiEA3oASABIQEMMQsgAEIANwMgQRIhEAzVAwsgASIQIAJHDStBHSEQDO0DCwJAIAEiASACRg0AIAFBAWohAUEQIRAM1AMLQQchEAzsAwsgAEIAIAApAyAiESACIAEiEGutIhJ9IhMgEyARVhs3AyAgESASViIURQ3lAUEIIRAM6wMLAkAgASIBIAJGDQAgAEGJgICAADYCCCAAIAE2AgQgASEBQRQhEAzSAwtBCSEQDOoDCyABIQEgACkDIFAN5AEgASEBDPICCwJAIAEiASACRw0AQQshEAzpAwsgACABQQFqIgEgAhC2gICAACIQDeUBIAEhAQzyAgsgACABIgEgAhC4gICAACIQDeUBIAEhAQzyAgsgACABIgEgAhC4gICAACIQDeYBIAEhAQwNCyAAIAEiASACELqAgIAAIhAN5wEgASEBDPACCwJAIAEiASACRw0AQQ8hEAzlAwsgAS0AACIQQTtGDQggEEENRw3oASABQQFqIQEM7wILIAAgASIBIAIQuoCAgAAiEA3oASABIQEM8gILA0ACQCABLQAAQfC1gIAAai0AACIQQQFGDQAgEEECRw3rASAAKAIEIRAgAEEANgIEIAAgECABQQFqIgEQuYCAgAAiEA3qASABIQEM9AILIAFBAWoiASACRw0AC0ESIRAM4gMLIAAgASIBIAIQuoCAgAAiEA3pASABIQEMCgsgASIBIAJHDQZBGyEQDOADCwJAIAEiASACRw0AQRYhEAzgAwsgAEGKgICAADYCCCAAIAE2AgQgACABIAIQuICAgAAiEA3qASABIQFBICEQDMYDCwJAIAEiASACRg0AA0ACQCABLQAAQfC3gIAAai0AACIQQQJGDQACQCAQQX9qDgTlAewBAOsB7AELIAFBAWohAUEIIRAMyAMLIAFBAWoiASACRw0AC0EVIRAM3wMLQRUhEAzeAwsDQAJAIAEtAABB8LmAgABqLQAAIhBBAkYNACAQQX9qDgTeAewB4AHrAewBCyABQQFqIgEgAkcNAAtBGCEQDN0DCwJAIAEiASACRg0AIABBi4CAgAA2AgggACABNgIEIAEhAUEHIRAMxAMLQRkhEAzcAwsgAUEBaiEBDAILAkAgASIUIAJHDQBBGiEQDNsDCyAUIQECQCAULQAAQXNqDhTdAu4C7gLuAu4C7gLuAu4C7gLuAu4C7gLuAu4C7gLuAu4C7gLuAgDuAgtBACEQIABBADYCHCAAQa+LgIAANgIQIABBAjYCDCAAIBRBAWo2AhQM2gMLAkAgAS0AACIQQTtGDQAgEEENRw3oASABQQFqIQEM5QILIAFBAWohAQtBIiEQDL8DCwJAIAEiECACRw0AQRwhEAzYAwtCACERIBAhASAQLQAAQVBqDjfnAeYBAQIDBAUGBwgAAAAAAAAACQoLDA0OAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPEBESExQAC0EeIRAMvQMLQgIhEQzlAQtCAyERDOQBC0IEIREM4wELQgUhEQziAQtCBiERDOEBC0IHIREM4AELQgghEQzfAQtCCSERDN4BC0IKIREM3QELQgshEQzcAQtCDCERDNsBC0INIREM2gELQg4hEQzZAQtCDyERDNgBC0IKIREM1wELQgshEQzWAQtCDCERDNUBC0INIREM1AELQg4hEQzTAQtCDyERDNIBC0IAIRECQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIBAtAABBUGoON+UB5AEAAQIDBAUGB+YB5gHmAeYB5gHmAeYBCAkKCwwN5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAQ4PEBESE+YBC0ICIREM5AELQgMhEQzjAQtCBCERDOIBC0IFIREM4QELQgYhEQzgAQtCByERDN8BC0IIIREM3gELQgkhEQzdAQtCCiERDNwBC0ILIREM2wELQgwhEQzaAQtCDSERDNkBC0IOIREM2AELQg8hEQzXAQtCCiERDNYBC0ILIREM1QELQgwhEQzUAQtCDSERDNMBC0IOIREM0gELQg8hEQzRAQsgAEIAIAApAyAiESACIAEiEGutIhJ9IhMgEyARVhs3AyAgESASViIURQ3SAUEfIRAMwAMLAkAgASIBIAJGDQAgAEGJgICAADYCCCAAIAE2AgQgASEBQSQhEAynAwtBICEQDL8DCyAAIAEiECACEL6AgIAAQX9qDgW2AQDFAgHRAdIBC0ERIRAMpAMLIABBAToALyAQIQEMuwMLIAEiASACRw3SAUEkIRAMuwMLIAEiDSACRw0eQcYAIRAMugMLIAAgASIBIAIQsoCAgAAiEA3UASABIQEMtQELIAEiECACRw0mQdAAIRAMuAMLAkAgASIBIAJHDQBBKCEQDLgDCyAAQQA2AgQgAEGMgICAADYCCCAAIAEgARCxgICAACIQDdMBIAEhAQzYAQsCQCABIhAgAkcNAEEpIRAMtwMLIBAtAAAiAUEgRg0UIAFBCUcN0wEgEEEBaiEBDBULAkAgASIBIAJGDQAgAUEBaiEBDBcLQSohEAy1AwsCQCABIhAgAkcNAEErIRAMtQMLAkAgEC0AACIBQQlGDQAgAUEgRw3VAQsgAC0ALEEIRg3TASAQIQEMkQMLAkAgASIBIAJHDQBBLCEQDLQDCyABLQAAQQpHDdUBIAFBAWohAQzJAgsgASIOIAJHDdUBQS8hEAyyAwsDQAJAIAEtAAAiEEEgRg0AAkAgEEF2ag4EANwB3AEA2gELIAEhAQzgAQsgAUEBaiIBIAJHDQALQTEhEAyxAwtBMiEQIAEiFCACRg2wAyACIBRrIAAoAgAiAWohFSAUIAFrQQNqIRYCQANAIBQtAAAiF0EgciAXIBdBv39qQf8BcUEaSRtB/wFxIAFB8LuAgABqLQAARw0BAkAgAUEDRw0AQQYhAQyWAwsgAUEBaiEBIBRBAWoiFCACRw0ACyAAIBU2AgAMsQMLIABBADYCACAUIQEM2QELQTMhECABIhQgAkYNrwMgAiAUayAAKAIAIgFqIRUgFCABa0EIaiEWAkADQCAULQAAIhdBIHIgFyAXQb9/akH/AXFBGkkbQf8BcSABQfS7gIAAai0AAEcNAQJAIAFBCEcNAEEFIQEMlQMLIAFBAWohASAUQQFqIhQgAkcNAAsgACAVNgIADLADCyAAQQA2AgAgFCEBDNgBC0E0IRAgASIUIAJGDa4DIAIgFGsgACgCACIBaiEVIBQgAWtBBWohFgJAA0AgFC0AACIXQSByIBcgF0G/f2pB/wFxQRpJG0H/AXEgAUHQwoCAAGotAABHDQECQCABQQVHDQBBByEBDJQDCyABQQFqIQEgFEEBaiIUIAJHDQALIAAgFTYCAAyvAwsgAEEANgIAIBQhAQzXAQsCQCABIgEgAkYNAANAAkAgAS0AAEGAvoCAAGotAAAiEEEBRg0AIBBBAkYNCiABIQEM3QELIAFBAWoiASACRw0AC0EwIRAMrgMLQTAhEAytAwsCQCABIgEgAkYNAANAAkAgAS0AACIQQSBGDQAgEEF2ag4E2QHaAdoB2QHaAQsgAUEBaiIBIAJHDQALQTghEAytAwtBOCEQDKwDCwNAAkAgAS0AACIQQSBGDQAgEEEJRw0DCyABQQFqIgEgAkcNAAtBPCEQDKsDCwNAAkAgAS0AACIQQSBGDQACQAJAIBBBdmoOBNoBAQHaAQALIBBBLEYN2wELIAEhAQwECyABQQFqIgEgAkcNAAtBPyEQDKoDCyABIQEM2wELQcAAIRAgASIUIAJGDagDIAIgFGsgACgCACIBaiEWIBQgAWtBBmohFwJAA0AgFC0AAEEgciABQYDAgIAAai0AAEcNASABQQZGDY4DIAFBAWohASAUQQFqIhQgAkcNAAsgACAWNgIADKkDCyAAQQA2AgAgFCEBC0E2IRAMjgMLAkAgASIPIAJHDQBBwQAhEAynAwsgAEGMgICAADYCCCAAIA82AgQgDyEBIAAtACxBf2oOBM0B1QHXAdkBhwMLIAFBAWohAQzMAQsCQCABIgEgAkYNAANAAkAgAS0AACIQQSByIBAgEEG/f2pB/wFxQRpJG0H/AXEiEEEJRg0AIBBBIEYNAAJAAkACQAJAIBBBnX9qDhMAAwMDAwMDAwEDAwMDAwMDAwMCAwsgAUEBaiEBQTEhEAyRAwsgAUEBaiEBQTIhEAyQAwsgAUEBaiEBQTMhEAyPAwsgASEBDNABCyABQQFqIgEgAkcNAAtBNSEQDKUDC0E1IRAMpAMLAkAgASIBIAJGDQADQAJAIAEtAABBgLyAgABqLQAAQQFGDQAgASEBDNMBCyABQQFqIgEgAkcNAAtBPSEQDKQDC0E9IRAMowMLIAAgASIBIAIQsICAgAAiEA3WASABIQEMAQsgEEEBaiEBC0E8IRAMhwMLAkAgASIBIAJHDQBBwgAhEAygAwsCQANAAkAgAS0AAEF3ag4YAAL+Av4ChAP+Av4C/gL+Av4C/gL+Av4C/gL+Av4C/gL+Av4C/gL+Av4C/gIA/gILIAFBAWoiASACRw0AC0HCACEQDKADCyABQQFqIQEgAC0ALUEBcUUNvQEgASEBC0EsIRAMhQMLIAEiASACRw3TAUHEACEQDJ0DCwNAAkAgAS0AAEGQwICAAGotAABBAUYNACABIQEMtwILIAFBAWoiASACRw0AC0HFACEQDJwDCyANLQAAIhBBIEYNswEgEEE6Rw2BAyAAKAIEIQEgAEEANgIEIAAgASANEK+AgIAAIgEN0AEgDUEBaiEBDLMCC0HHACEQIAEiDSACRg2aAyACIA1rIAAoAgAiAWohFiANIAFrQQVqIRcDQCANLQAAIhRBIHIgFCAUQb9/akH/AXFBGkkbQf8BcSABQZDCgIAAai0AAEcNgAMgAUEFRg30AiABQQFqIQEgDUEBaiINIAJHDQALIAAgFjYCAAyaAwtByAAhECABIg0gAkYNmQMgAiANayAAKAIAIgFqIRYgDSABa0EJaiEXA0AgDS0AACIUQSByIBQgFEG/f2pB/wFxQRpJG0H/AXEgAUGWwoCAAGotAABHDf8CAkAgAUEJRw0AQQIhAQz1AgsgAUEBaiEBIA1BAWoiDSACRw0ACyAAIBY2AgAMmQMLAkAgASINIAJHDQBByQAhEAyZAwsCQAJAIA0tAAAiAUEgciABIAFBv39qQf8BcUEaSRtB/wFxQZJ/ag4HAIADgAOAA4ADgAMBgAMLIA1BAWohAUE+IRAMgAMLIA1BAWohAUE/IRAM/wILQcoAIRAgASINIAJGDZcDIAIgDWsgACgCACIBaiEWIA0gAWtBAWohFwNAIA0tAAAiFEEgciAUIBRBv39qQf8BcUEaSRtB/wFxIAFBoMKAgABqLQAARw39AiABQQFGDfACIAFBAWohASANQQFqIg0gAkcNAAsgACAWNgIADJcDC0HLACEQIAEiDSACRg2WAyACIA1rIAAoAgAiAWohFiANIAFrQQ5qIRcDQCANLQAAIhRBIHIgFCAUQb9/akH/AXFBGkkbQf8BcSABQaLCgIAAai0AAEcN/AIgAUEORg3wAiABQQFqIQEgDUEBaiINIAJHDQALIAAgFjYCAAyWAwtBzAAhECABIg0gAkYNlQMgAiANayAAKAIAIgFqIRYgDSABa0EPaiEXA0AgDS0AACIUQSByIBQgFEG/f2pB/wFxQRpJG0H/AXEgAUHAwoCAAGotAABHDfsCAkAgAUEPRw0AQQMhAQzxAgsgAUEBaiEBIA1BAWoiDSACRw0ACyAAIBY2AgAMlQMLQc0AIRAgASINIAJGDZQDIAIgDWsgACgCACIBaiEWIA0gAWtBBWohFwNAIA0tAAAiFEEgciAUIBRBv39qQf8BcUEaSRtB/wFxIAFB0MKAgABqLQAARw36AgJAIAFBBUcNAEEEIQEM8AILIAFBAWohASANQQFqIg0gAkcNAAsgACAWNgIADJQDCwJAIAEiDSACRw0AQc4AIRAMlAMLAkACQAJAAkAgDS0AACIBQSByIAEgAUG/f2pB/wFxQRpJG0H/AXFBnX9qDhMA/QL9Av0C/QL9Av0C/QL9Av0C/QL9Av0CAf0C/QL9AgID/QILIA1BAWohAUHBACEQDP0CCyANQQFqIQFBwgAhEAz8AgsgDUEBaiEBQcMAIRAM+wILIA1BAWohAUHEACEQDPoCCwJAIAEiASACRg0AIABBjYCAgAA2AgggACABNgIEIAEhAUHFACEQDPoCC0HPACEQDJIDCyAQIQECQAJAIBAtAABBdmoOBAGoAqgCAKgCCyAQQQFqIQELQSchEAz4AgsCQCABIgEgAkcNAEHRACEQDJEDCwJAIAEtAABBIEYNACABIQEMjQELIAFBAWohASAALQAtQQFxRQ3HASABIQEMjAELIAEiFyACRw3IAUHSACEQDI8DC0HTACEQIAEiFCACRg2OAyACIBRrIAAoAgAiAWohFiAUIAFrQQFqIRcDQCAULQAAIAFB1sKAgABqLQAARw3MASABQQFGDccBIAFBAWohASAUQQFqIhQgAkcNAAsgACAWNgIADI4DCwJAIAEiASACRw0AQdUAIRAMjgMLIAEtAABBCkcNzAEgAUEBaiEBDMcBCwJAIAEiASACRw0AQdYAIRAMjQMLAkACQCABLQAAQXZqDgQAzQHNAQHNAQsgAUEBaiEBDMcBCyABQQFqIQFBygAhEAzzAgsgACABIgEgAhCugICAACIQDcsBIAEhAUHNACEQDPICCyAALQApQSJGDYUDDKYCCwJAIAEiASACRw0AQdsAIRAMigMLQQAhFEEBIRdBASEWQQAhEAJAAkACQAJAAkACQAJAAkACQCABLQAAQVBqDgrUAdMBAAECAwQFBgjVAQtBAiEQDAYLQQMhEAwFC0EEIRAMBAtBBSEQDAMLQQYhEAwCC0EHIRAMAQtBCCEQC0EAIRdBACEWQQAhFAzMAQtBCSEQQQEhFEEAIRdBACEWDMsBCwJAIAEiASACRw0AQd0AIRAMiQMLIAEtAABBLkcNzAEgAUEBaiEBDKYCCyABIgEgAkcNzAFB3wAhEAyHAwsCQCABIgEgAkYNACAAQY6AgIAANgIIIAAgATYCBCABIQFB0AAhEAzuAgtB4AAhEAyGAwtB4QAhECABIgEgAkYNhQMgAiABayAAKAIAIhRqIRYgASAUa0EDaiEXA0AgAS0AACAUQeLCgIAAai0AAEcNzQEgFEEDRg3MASAUQQFqIRQgAUEBaiIBIAJHDQALIAAgFjYCAAyFAwtB4gAhECABIgEgAkYNhAMgAiABayAAKAIAIhRqIRYgASAUa0ECaiEXA0AgAS0AACAUQebCgIAAai0AAEcNzAEgFEECRg3OASAUQQFqIRQgAUEBaiIBIAJHDQALIAAgFjYCAAyEAwtB4wAhECABIgEgAkYNgwMgAiABayAAKAIAIhRqIRYgASAUa0EDaiEXA0AgAS0AACAUQenCgIAAai0AAEcNywEgFEEDRg3OASAUQQFqIRQgAUEBaiIBIAJHDQALIAAgFjYCAAyDAwsCQCABIgEgAkcNAEHlACEQDIMDCyAAIAFBAWoiASACEKiAgIAAIhANzQEgASEBQdYAIRAM6QILAkAgASIBIAJGDQADQAJAIAEtAAAiEEEgRg0AAkACQAJAIBBBuH9qDgsAAc8BzwHPAc8BzwHPAc8BzwECzwELIAFBAWohAUHSACEQDO0CCyABQQFqIQFB0wAhEAzsAgsgAUEBaiEBQdQAIRAM6wILIAFBAWoiASACRw0AC0HkACEQDIIDC0HkACEQDIEDCwNAAkAgAS0AAEHwwoCAAGotAAAiEEEBRg0AIBBBfmoOA88B0AHRAdIBCyABQQFqIgEgAkcNAAtB5gAhEAyAAwsCQCABIgEgAkYNACABQQFqIQEMAwtB5wAhEAz/AgsDQAJAIAEtAABB8MSAgABqLQAAIhBBAUYNAAJAIBBBfmoOBNIB0wHUAQDVAQsgASEBQdcAIRAM5wILIAFBAWoiASACRw0AC0HoACEQDP4CCwJAIAEiASACRw0AQekAIRAM/gILAkAgAS0AACIQQXZqDhq6AdUB1QG8AdUB1QHVAdUB1QHVAdUB1QHVAdUB1QHVAdUB1QHVAdUB1QHVAcoB1QHVAQDTAQsgAUEBaiEBC0EGIRAM4wILA0ACQCABLQAAQfDGgIAAai0AAEEBRg0AIAEhAQyeAgsgAUEBaiIBIAJHDQALQeoAIRAM+wILAkAgASIBIAJGDQAgAUEBaiEBDAMLQesAIRAM+gILAkAgASIBIAJHDQBB7AAhEAz6AgsgAUEBaiEBDAELAkAgASIBIAJHDQBB7QAhEAz5AgsgAUEBaiEBC0EEIRAM3gILAkAgASIUIAJHDQBB7gAhEAz3AgsgFCEBAkACQAJAIBQtAABB8MiAgABqLQAAQX9qDgfUAdUB1gEAnAIBAtcBCyAUQQFqIQEMCgsgFEEBaiEBDM0BC0EAIRAgAEEANgIcIABBm5KAgAA2AhAgAEEHNgIMIAAgFEEBajYCFAz2AgsCQANAAkAgAS0AAEHwyICAAGotAAAiEEEERg0AAkACQCAQQX9qDgfSAdMB1AHZAQAEAdkBCyABIQFB2gAhEAzgAgsgAUEBaiEBQdwAIRAM3wILIAFBAWoiASACRw0AC0HvACEQDPYCCyABQQFqIQEMywELAkAgASIUIAJHDQBB8AAhEAz1AgsgFC0AAEEvRw3UASAUQQFqIQEMBgsCQCABIhQgAkcNAEHxACEQDPQCCwJAIBQtAAAiAUEvRw0AIBRBAWohAUHdACEQDNsCCyABQXZqIgRBFksN0wFBASAEdEGJgIACcUUN0wEMygILAkAgASIBIAJGDQAgAUEBaiEBQd4AIRAM2gILQfIAIRAM8gILAkAgASIUIAJHDQBB9AAhEAzyAgsgFCEBAkAgFC0AAEHwzICAAGotAABBf2oOA8kClAIA1AELQeEAIRAM2AILAkAgASIUIAJGDQADQAJAIBQtAABB8MqAgABqLQAAIgFBA0YNAAJAIAFBf2oOAssCANUBCyAUIQFB3wAhEAzaAgsgFEEBaiIUIAJHDQALQfMAIRAM8QILQfMAIRAM8AILAkAgASIBIAJGDQAgAEGPgICAADYCCCAAIAE2AgQgASEBQeAAIRAM1wILQfUAIRAM7wILAkAgASIBIAJHDQBB9gAhEAzvAgsgAEGPgICAADYCCCAAIAE2AgQgASEBC0EDIRAM1AILA0AgAS0AAEEgRw3DAiABQQFqIgEgAkcNAAtB9wAhEAzsAgsCQCABIgEgAkcNAEH4ACEQDOwCCyABLQAAQSBHDc4BIAFBAWohAQzvAQsgACABIgEgAhCsgICAACIQDc4BIAEhAQyOAgsCQCABIgQgAkcNAEH6ACEQDOoCCyAELQAAQcwARw3RASAEQQFqIQFBEyEQDM8BCwJAIAEiBCACRw0AQfsAIRAM6QILIAIgBGsgACgCACIBaiEUIAQgAWtBBWohEANAIAQtAAAgAUHwzoCAAGotAABHDdABIAFBBUYNzgEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBB+wAhEAzoAgsCQCABIgQgAkcNAEH8ACEQDOgCCwJAAkAgBC0AAEG9f2oODADRAdEB0QHRAdEB0QHRAdEB0QHRAQHRAQsgBEEBaiEBQeYAIRAMzwILIARBAWohAUHnACEQDM4CCwJAIAEiBCACRw0AQf0AIRAM5wILIAIgBGsgACgCACIBaiEUIAQgAWtBAmohEAJAA0AgBC0AACABQe3PgIAAai0AAEcNzwEgAUECRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQf0AIRAM5wILIABBADYCACAQQQFqIQFBECEQDMwBCwJAIAEiBCACRw0AQf4AIRAM5gILIAIgBGsgACgCACIBaiEUIAQgAWtBBWohEAJAA0AgBC0AACABQfbOgIAAai0AAEcNzgEgAUEFRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQf4AIRAM5gILIABBADYCACAQQQFqIQFBFiEQDMsBCwJAIAEiBCACRw0AQf8AIRAM5QILIAIgBGsgACgCACIBaiEUIAQgAWtBA2ohEAJAA0AgBC0AACABQfzOgIAAai0AAEcNzQEgAUEDRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQf8AIRAM5QILIABBADYCACAQQQFqIQFBBSEQDMoBCwJAIAEiBCACRw0AQYABIRAM5AILIAQtAABB2QBHDcsBIARBAWohAUEIIRAMyQELAkAgASIEIAJHDQBBgQEhEAzjAgsCQAJAIAQtAABBsn9qDgMAzAEBzAELIARBAWohAUHrACEQDMoCCyAEQQFqIQFB7AAhEAzJAgsCQCABIgQgAkcNAEGCASEQDOICCwJAAkAgBC0AAEG4f2oOCADLAcsBywHLAcsBywEBywELIARBAWohAUHqACEQDMkCCyAEQQFqIQFB7QAhEAzIAgsCQCABIgQgAkcNAEGDASEQDOECCyACIARrIAAoAgAiAWohECAEIAFrQQJqIRQCQANAIAQtAAAgAUGAz4CAAGotAABHDckBIAFBAkYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgEDYCAEGDASEQDOECC0EAIRAgAEEANgIAIBRBAWohAQzGAQsCQCABIgQgAkcNAEGEASEQDOACCyACIARrIAAoAgAiAWohFCAEIAFrQQRqIRACQANAIAQtAAAgAUGDz4CAAGotAABHDcgBIAFBBEYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGEASEQDOACCyAAQQA2AgAgEEEBaiEBQSMhEAzFAQsCQCABIgQgAkcNAEGFASEQDN8CCwJAAkAgBC0AAEG0f2oOCADIAcgByAHIAcgByAEByAELIARBAWohAUHvACEQDMYCCyAEQQFqIQFB8AAhEAzFAgsCQCABIgQgAkcNAEGGASEQDN4CCyAELQAAQcUARw3FASAEQQFqIQEMgwILAkAgASIEIAJHDQBBhwEhEAzdAgsgAiAEayAAKAIAIgFqIRQgBCABa0EDaiEQAkADQCAELQAAIAFBiM+AgABqLQAARw3FASABQQNGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBhwEhEAzdAgsgAEEANgIAIBBBAWohAUEtIRAMwgELAkAgASIEIAJHDQBBiAEhEAzcAgsgAiAEayAAKAIAIgFqIRQgBCABa0EIaiEQAkADQCAELQAAIAFB0M+AgABqLQAARw3EASABQQhGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBiAEhEAzcAgsgAEEANgIAIBBBAWohAUEpIRAMwQELAkAgASIBIAJHDQBBiQEhEAzbAgtBASEQIAEtAABB3wBHDcABIAFBAWohAQyBAgsCQCABIgQgAkcNAEGKASEQDNoCCyACIARrIAAoAgAiAWohFCAEIAFrQQFqIRADQCAELQAAIAFBjM+AgABqLQAARw3BASABQQFGDa8CIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQYoBIRAM2QILAkAgASIEIAJHDQBBiwEhEAzZAgsgAiAEayAAKAIAIgFqIRQgBCABa0ECaiEQAkADQCAELQAAIAFBjs+AgABqLQAARw3BASABQQJGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBiwEhEAzZAgsgAEEANgIAIBBBAWohAUECIRAMvgELAkAgASIEIAJHDQBBjAEhEAzYAgsgAiAEayAAKAIAIgFqIRQgBCABa0EBaiEQAkADQCAELQAAIAFB8M+AgABqLQAARw3AASABQQFGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBjAEhEAzYAgsgAEEANgIAIBBBAWohAUEfIRAMvQELAkAgASIEIAJHDQBBjQEhEAzXAgsgAiAEayAAKAIAIgFqIRQgBCABa0EBaiEQAkADQCAELQAAIAFB8s+AgABqLQAARw2/ASABQQFGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBjQEhEAzXAgsgAEEANgIAIBBBAWohAUEJIRAMvAELAkAgASIEIAJHDQBBjgEhEAzWAgsCQAJAIAQtAABBt39qDgcAvwG/Ab8BvwG/AQG/AQsgBEEBaiEBQfgAIRAMvQILIARBAWohAUH5ACEQDLwCCwJAIAEiBCACRw0AQY8BIRAM1QILIAIgBGsgACgCACIBaiEUIAQgAWtBBWohEAJAA0AgBC0AACABQZHPgIAAai0AAEcNvQEgAUEFRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQY8BIRAM1QILIABBADYCACAQQQFqIQFBGCEQDLoBCwJAIAEiBCACRw0AQZABIRAM1AILIAIgBGsgACgCACIBaiEUIAQgAWtBAmohEAJAA0AgBC0AACABQZfPgIAAai0AAEcNvAEgAUECRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQZABIRAM1AILIABBADYCACAQQQFqIQFBFyEQDLkBCwJAIAEiBCACRw0AQZEBIRAM0wILIAIgBGsgACgCACIBaiEUIAQgAWtBBmohEAJAA0AgBC0AACABQZrPgIAAai0AAEcNuwEgAUEGRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQZEBIRAM0wILIABBADYCACAQQQFqIQFBFSEQDLgBCwJAIAEiBCACRw0AQZIBIRAM0gILIAIgBGsgACgCACIBaiEUIAQgAWtBBWohEAJAA0AgBC0AACABQaHPgIAAai0AAEcNugEgAUEFRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQZIBIRAM0gILIABBADYCACAQQQFqIQFBHiEQDLcBCwJAIAEiBCACRw0AQZMBIRAM0QILIAQtAABBzABHDbgBIARBAWohAUEKIRAMtgELAkAgBCACRw0AQZQBIRAM0AILAkACQCAELQAAQb9/ag4PALkBuQG5AbkBuQG5AbkBuQG5AbkBuQG5AbkBAbkBCyAEQQFqIQFB/gAhEAy3AgsgBEEBaiEBQf8AIRAMtgILAkAgBCACRw0AQZUBIRAMzwILAkACQCAELQAAQb9/ag4DALgBAbgBCyAEQQFqIQFB/QAhEAy2AgsgBEEBaiEEQYABIRAMtQILAkAgBCACRw0AQZYBIRAMzgILIAIgBGsgACgCACIBaiEUIAQgAWtBAWohEAJAA0AgBC0AACABQafPgIAAai0AAEcNtgEgAUEBRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQZYBIRAMzgILIABBADYCACAQQQFqIQFBCyEQDLMBCwJAIAQgAkcNAEGXASEQDM0CCwJAAkACQAJAIAQtAABBU2oOIwC4AbgBuAG4AbgBuAG4AbgBuAG4AbgBuAG4AbgBuAG4AbgBuAG4AbgBuAG4AbgBAbgBuAG4AbgBuAECuAG4AbgBA7gBCyAEQQFqIQFB+wAhEAy2AgsgBEEBaiEBQfwAIRAMtQILIARBAWohBEGBASEQDLQCCyAEQQFqIQRBggEhEAyzAgsCQCAEIAJHDQBBmAEhEAzMAgsgAiAEayAAKAIAIgFqIRQgBCABa0EEaiEQAkADQCAELQAAIAFBqc+AgABqLQAARw20ASABQQRGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBmAEhEAzMAgsgAEEANgIAIBBBAWohAUEZIRAMsQELAkAgBCACRw0AQZkBIRAMywILIAIgBGsgACgCACIBaiEUIAQgAWtBBWohEAJAA0AgBC0AACABQa7PgIAAai0AAEcNswEgAUEFRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQZkBIRAMywILIABBADYCACAQQQFqIQFBBiEQDLABCwJAIAQgAkcNAEGaASEQDMoCCyACIARrIAAoAgAiAWohFCAEIAFrQQFqIRACQANAIAQtAAAgAUG0z4CAAGotAABHDbIBIAFBAUYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGaASEQDMoCCyAAQQA2AgAgEEEBaiEBQRwhEAyvAQsCQCAEIAJHDQBBmwEhEAzJAgsgAiAEayAAKAIAIgFqIRQgBCABa0EBaiEQAkADQCAELQAAIAFBts+AgABqLQAARw2xASABQQFGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBmwEhEAzJAgsgAEEANgIAIBBBAWohAUEnIRAMrgELAkAgBCACRw0AQZwBIRAMyAILAkACQCAELQAAQax/ag4CAAGxAQsgBEEBaiEEQYYBIRAMrwILIARBAWohBEGHASEQDK4CCwJAIAQgAkcNAEGdASEQDMcCCyACIARrIAAoAgAiAWohFCAEIAFrQQFqIRACQANAIAQtAAAgAUG4z4CAAGotAABHDa8BIAFBAUYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGdASEQDMcCCyAAQQA2AgAgEEEBaiEBQSYhEAysAQsCQCAEIAJHDQBBngEhEAzGAgsgAiAEayAAKAIAIgFqIRQgBCABa0EBaiEQAkADQCAELQAAIAFBus+AgABqLQAARw2uASABQQFGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBngEhEAzGAgsgAEEANgIAIBBBAWohAUEDIRAMqwELAkAgBCACRw0AQZ8BIRAMxQILIAIgBGsgACgCACIBaiEUIAQgAWtBAmohEAJAA0AgBC0AACABQe3PgIAAai0AAEcNrQEgAUECRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQZ8BIRAMxQILIABBADYCACAQQQFqIQFBDCEQDKoBCwJAIAQgAkcNAEGgASEQDMQCCyACIARrIAAoAgAiAWohFCAEIAFrQQNqIRACQANAIAQtAAAgAUG8z4CAAGotAABHDawBIAFBA0YNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGgASEQDMQCCyAAQQA2AgAgEEEBaiEBQQ0hEAypAQsCQCAEIAJHDQBBoQEhEAzDAgsCQAJAIAQtAABBun9qDgsArAGsAawBrAGsAawBrAGsAawBAawBCyAEQQFqIQRBiwEhEAyqAgsgBEEBaiEEQYwBIRAMqQILAkAgBCACRw0AQaIBIRAMwgILIAQtAABB0ABHDakBIARBAWohBAzpAQsCQCAEIAJHDQBBowEhEAzBAgsCQAJAIAQtAABBt39qDgcBqgGqAaoBqgGqAQCqAQsgBEEBaiEEQY4BIRAMqAILIARBAWohAUEiIRAMpgELAkAgBCACRw0AQaQBIRAMwAILIAIgBGsgACgCACIBaiEUIAQgAWtBAWohEAJAA0AgBC0AACABQcDPgIAAai0AAEcNqAEgAUEBRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQaQBIRAMwAILIABBADYCACAQQQFqIQFBHSEQDKUBCwJAIAQgAkcNAEGlASEQDL8CCwJAAkAgBC0AAEGuf2oOAwCoAQGoAQsgBEEBaiEEQZABIRAMpgILIARBAWohAUEEIRAMpAELAkAgBCACRw0AQaYBIRAMvgILAkACQAJAAkACQCAELQAAQb9/ag4VAKoBqgGqAaoBqgGqAaoBqgGqAaoBAaoBqgECqgGqAQOqAaoBBKoBCyAEQQFqIQRBiAEhEAyoAgsgBEEBaiEEQYkBIRAMpwILIARBAWohBEGKASEQDKYCCyAEQQFqIQRBjwEhEAylAgsgBEEBaiEEQZEBIRAMpAILAkAgBCACRw0AQacBIRAMvQILIAIgBGsgACgCACIBaiEUIAQgAWtBAmohEAJAA0AgBC0AACABQe3PgIAAai0AAEcNpQEgAUECRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQacBIRAMvQILIABBADYCACAQQQFqIQFBESEQDKIBCwJAIAQgAkcNAEGoASEQDLwCCyACIARrIAAoAgAiAWohFCAEIAFrQQJqIRACQANAIAQtAAAgAUHCz4CAAGotAABHDaQBIAFBAkYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGoASEQDLwCCyAAQQA2AgAgEEEBaiEBQSwhEAyhAQsCQCAEIAJHDQBBqQEhEAy7AgsgAiAEayAAKAIAIgFqIRQgBCABa0EEaiEQAkADQCAELQAAIAFBxc+AgABqLQAARw2jASABQQRGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBqQEhEAy7AgsgAEEANgIAIBBBAWohAUErIRAMoAELAkAgBCACRw0AQaoBIRAMugILIAIgBGsgACgCACIBaiEUIAQgAWtBAmohEAJAA0AgBC0AACABQcrPgIAAai0AAEcNogEgAUECRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQaoBIRAMugILIABBADYCACAQQQFqIQFBFCEQDJ8BCwJAIAQgAkcNAEGrASEQDLkCCwJAAkACQAJAIAQtAABBvn9qDg8AAQKkAaQBpAGkAaQBpAGkAaQBpAGkAaQBA6QBCyAEQQFqIQRBkwEhEAyiAgsgBEEBaiEEQZQBIRAMoQILIARBAWohBEGVASEQDKACCyAEQQFqIQRBlgEhEAyfAgsCQCAEIAJHDQBBrAEhEAy4AgsgBC0AAEHFAEcNnwEgBEEBaiEEDOABCwJAIAQgAkcNAEGtASEQDLcCCyACIARrIAAoAgAiAWohFCAEIAFrQQJqIRACQANAIAQtAAAgAUHNz4CAAGotAABHDZ8BIAFBAkYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEGtASEQDLcCCyAAQQA2AgAgEEEBaiEBQQ4hEAycAQsCQCAEIAJHDQBBrgEhEAy2AgsgBC0AAEHQAEcNnQEgBEEBaiEBQSUhEAybAQsCQCAEIAJHDQBBrwEhEAy1AgsgAiAEayAAKAIAIgFqIRQgBCABa0EIaiEQAkADQCAELQAAIAFB0M+AgABqLQAARw2dASABQQhGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBrwEhEAy1AgsgAEEANgIAIBBBAWohAUEqIRAMmgELAkAgBCACRw0AQbABIRAMtAILAkACQCAELQAAQat/ag4LAJ0BnQGdAZ0BnQGdAZ0BnQGdAQGdAQsgBEEBaiEEQZoBIRAMmwILIARBAWohBEGbASEQDJoCCwJAIAQgAkcNAEGxASEQDLMCCwJAAkAgBC0AAEG/f2oOFACcAZwBnAGcAZwBnAGcAZwBnAGcAZwBnAGcAZwBnAGcAZwBnAEBnAELIARBAWohBEGZASEQDJoCCyAEQQFqIQRBnAEhEAyZAgsCQCAEIAJHDQBBsgEhEAyyAgsgAiAEayAAKAIAIgFqIRQgBCABa0EDaiEQAkADQCAELQAAIAFB2c+AgABqLQAARw2aASABQQNGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBsgEhEAyyAgsgAEEANgIAIBBBAWohAUEhIRAMlwELAkAgBCACRw0AQbMBIRAMsQILIAIgBGsgACgCACIBaiEUIAQgAWtBBmohEAJAA0AgBC0AACABQd3PgIAAai0AAEcNmQEgAUEGRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQbMBIRAMsQILIABBADYCACAQQQFqIQFBGiEQDJYBCwJAIAQgAkcNAEG0ASEQDLACCwJAAkACQCAELQAAQbt/ag4RAJoBmgGaAZoBmgGaAZoBmgGaAQGaAZoBmgGaAZoBApoBCyAEQQFqIQRBnQEhEAyYAgsgBEEBaiEEQZ4BIRAMlwILIARBAWohBEGfASEQDJYCCwJAIAQgAkcNAEG1ASEQDK8CCyACIARrIAAoAgAiAWohFCAEIAFrQQVqIRACQANAIAQtAAAgAUHkz4CAAGotAABHDZcBIAFBBUYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEG1ASEQDK8CCyAAQQA2AgAgEEEBaiEBQSghEAyUAQsCQCAEIAJHDQBBtgEhEAyuAgsgAiAEayAAKAIAIgFqIRQgBCABa0ECaiEQAkADQCAELQAAIAFB6s+AgABqLQAARw2WASABQQJGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBtgEhEAyuAgsgAEEANgIAIBBBAWohAUEHIRAMkwELAkAgBCACRw0AQbcBIRAMrQILAkACQCAELQAAQbt/ag4OAJYBlgGWAZYBlgGWAZYBlgGWAZYBlgGWAQGWAQsgBEEBaiEEQaEBIRAMlAILIARBAWohBEGiASEQDJMCCwJAIAQgAkcNAEG4ASEQDKwCCyACIARrIAAoAgAiAWohFCAEIAFrQQJqIRACQANAIAQtAAAgAUHtz4CAAGotAABHDZQBIAFBAkYNASABQQFqIQEgBEEBaiIEIAJHDQALIAAgFDYCAEG4ASEQDKwCCyAAQQA2AgAgEEEBaiEBQRIhEAyRAQsCQCAEIAJHDQBBuQEhEAyrAgsgAiAEayAAKAIAIgFqIRQgBCABa0EBaiEQAkADQCAELQAAIAFB8M+AgABqLQAARw2TASABQQFGDQEgAUEBaiEBIARBAWoiBCACRw0ACyAAIBQ2AgBBuQEhEAyrAgsgAEEANgIAIBBBAWohAUEgIRAMkAELAkAgBCACRw0AQboBIRAMqgILIAIgBGsgACgCACIBaiEUIAQgAWtBAWohEAJAA0AgBC0AACABQfLPgIAAai0AAEcNkgEgAUEBRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQboBIRAMqgILIABBADYCACAQQQFqIQFBDyEQDI8BCwJAIAQgAkcNAEG7ASEQDKkCCwJAAkAgBC0AAEG3f2oOBwCSAZIBkgGSAZIBAZIBCyAEQQFqIQRBpQEhEAyQAgsgBEEBaiEEQaYBIRAMjwILAkAgBCACRw0AQbwBIRAMqAILIAIgBGsgACgCACIBaiEUIAQgAWtBB2ohEAJAA0AgBC0AACABQfTPgIAAai0AAEcNkAEgAUEHRg0BIAFBAWohASAEQQFqIgQgAkcNAAsgACAUNgIAQbwBIRAMqAILIABBADYCACAQQQFqIQFBGyEQDI0BCwJAIAQgAkcNAEG9ASEQDKcCCwJAAkACQCAELQAAQb5/ag4SAJEBkQGRAZEBkQGRAZEBkQGRAQGRAZEBkQGRAZEBkQECkQELIARBAWohBEGkASEQDI8CCyAEQQFqIQRBpwEhEAyOAgsgBEEBaiEEQagBIRAMjQILAkAgBCACRw0AQb4BIRAMpgILIAQtAABBzgBHDY0BIARBAWohBAzPAQsCQCAEIAJHDQBBvwEhEAylAgsCQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCAELQAAQb9/ag4VAAECA5wBBAUGnAGcAZwBBwgJCgucAQwNDg+cAQsgBEEBaiEBQegAIRAMmgILIARBAWohAUHpACEQDJkCCyAEQQFqIQFB7gAhEAyYAgsgBEEBaiEBQfIAIRAMlwILIARBAWohAUHzACEQDJYCCyAEQQFqIQFB9gAhEAyVAgsgBEEBaiEBQfcAIRAMlAILIARBAWohAUH6ACEQDJMCCyAEQQFqIQRBgwEhEAySAgsgBEEBaiEEQYQBIRAMkQILIARBAWohBEGFASEQDJACCyAEQQFqIQRBkgEhEAyPAgsgBEEBaiEEQZgBIRAMjgILIARBAWohBEGgASEQDI0CCyAEQQFqIQRBowEhEAyMAgsgBEEBaiEEQaoBIRAMiwILAkAgBCACRg0AIABBkICAgAA2AgggACAENgIEQasBIRAMiwILQcABIRAMowILIAAgBSACEKqAgIAAIgENiwEgBSEBDFwLAkAgBiACRg0AIAZBAWohBQyNAQtBwgEhEAyhAgsDQAJAIBAtAABBdmoOBIwBAACPAQALIBBBAWoiECACRw0AC0HDASEQDKACCwJAIAcgAkYNACAAQZGAgIAANgIIIAAgBzYCBCAHIQFBASEQDIcCC0HEASEQDJ8CCwJAIAcgAkcNAEHFASEQDJ8CCwJAAkAgBy0AAEF2ag4EAc4BzgEAzgELIAdBAWohBgyNAQsgB0EBaiEFDIkBCwJAIAcgAkcNAEHGASEQDJ4CCwJAAkAgBy0AAEF2ag4XAY8BjwEBjwGPAY8BjwGPAY8BjwGPAY8BjwGPAY8BjwGPAY8BjwGPAY8BAI8BCyAHQQFqIQcLQbABIRAMhAILAkAgCCACRw0AQcgBIRAMnQILIAgtAABBIEcNjQEgAEEAOwEyIAhBAWohAUGzASEQDIMCCyABIRcCQANAIBciByACRg0BIActAABBUGpB/wFxIhBBCk8NzAECQCAALwEyIhRBmTNLDQAgACAUQQpsIhQ7ATIgEEH//wNzIBRB/v8DcUkNACAHQQFqIRcgACAUIBBqIhA7ATIgEEH//wNxQegHSQ0BCwtBACEQIABBADYCHCAAQcGJgIAANgIQIABBDTYCDCAAIAdBAWo2AhQMnAILQccBIRAMmwILIAAgCCACEK6AgIAAIhBFDcoBIBBBFUcNjAEgAEHIATYCHCAAIAg2AhQgAEHJl4CAADYCECAAQRU2AgxBACEQDJoCCwJAIAkgAkcNAEHMASEQDJoCC0EAIRRBASEXQQEhFkEAIRACQAJAAkACQAJAAkACQAJAAkAgCS0AAEFQag4KlgGVAQABAgMEBQYIlwELQQIhEAwGC0EDIRAMBQtBBCEQDAQLQQUhEAwDC0EGIRAMAgtBByEQDAELQQghEAtBACEXQQAhFkEAIRQMjgELQQkhEEEBIRRBACEXQQAhFgyNAQsCQCAKIAJHDQBBzgEhEAyZAgsgCi0AAEEuRw2OASAKQQFqIQkMygELIAsgAkcNjgFB0AEhEAyXAgsCQCALIAJGDQAgAEGOgICAADYCCCAAIAs2AgRBtwEhEAz+AQtB0QEhEAyWAgsCQCAEIAJHDQBB0gEhEAyWAgsgAiAEayAAKAIAIhBqIRQgBCAQa0EEaiELA0AgBC0AACAQQfzPgIAAai0AAEcNjgEgEEEERg3pASAQQQFqIRAgBEEBaiIEIAJHDQALIAAgFDYCAEHSASEQDJUCCyAAIAwgAhCsgICAACIBDY0BIAwhAQy4AQsCQCAEIAJHDQBB1AEhEAyUAgsgAiAEayAAKAIAIhBqIRQgBCAQa0EBaiEMA0AgBC0AACAQQYHQgIAAai0AAEcNjwEgEEEBRg2OASAQQQFqIRAgBEEBaiIEIAJHDQALIAAgFDYCAEHUASEQDJMCCwJAIAQgAkcNAEHWASEQDJMCCyACIARrIAAoAgAiEGohFCAEIBBrQQJqIQsDQCAELQAAIBBBg9CAgABqLQAARw2OASAQQQJGDZABIBBBAWohECAEQQFqIgQgAkcNAAsgACAUNgIAQdYBIRAMkgILAkAgBCACRw0AQdcBIRAMkgILAkACQCAELQAAQbt/ag4QAI8BjwGPAY8BjwGPAY8BjwGPAY8BjwGPAY8BjwEBjwELIARBAWohBEG7ASEQDPkBCyAEQQFqIQRBvAEhEAz4AQsCQCAEIAJHDQBB2AEhEAyRAgsgBC0AAEHIAEcNjAEgBEEBaiEEDMQBCwJAIAQgAkYNACAAQZCAgIAANgIIIAAgBDYCBEG+ASEQDPcBC0HZASEQDI8CCwJAIAQgAkcNAEHaASEQDI8CCyAELQAAQcgARg3DASAAQQE6ACgMuQELIABBAjoALyAAIAQgAhCmgICAACIQDY0BQcIBIRAM9AELIAAtAChBf2oOArcBuQG4AQsDQAJAIAQtAABBdmoOBACOAY4BAI4BCyAEQQFqIgQgAkcNAAtB3QEhEAyLAgsgAEEAOgAvIAAtAC1BBHFFDYQCCyAAQQA6AC8gAEEBOgA0IAEhAQyMAQsgEEEVRg3aASAAQQA2AhwgACABNgIUIABBp46AgAA2AhAgAEESNgIMQQAhEAyIAgsCQCAAIBAgAhC0gICAACIEDQAgECEBDIECCwJAIARBFUcNACAAQQM2AhwgACAQNgIUIABBsJiAgAA2AhAgAEEVNgIMQQAhEAyIAgsgAEEANgIcIAAgEDYCFCAAQaeOgIAANgIQIABBEjYCDEEAIRAMhwILIBBBFUYN1gEgAEEANgIcIAAgATYCFCAAQdqNgIAANgIQIABBFDYCDEEAIRAMhgILIAAoAgQhFyAAQQA2AgQgECARp2oiFiEBIAAgFyAQIBYgFBsiEBC1gICAACIURQ2NASAAQQc2AhwgACAQNgIUIAAgFDYCDEEAIRAMhQILIAAgAC8BMEGAAXI7ATAgASEBC0EqIRAM6gELIBBBFUYN0QEgAEEANgIcIAAgATYCFCAAQYOMgIAANgIQIABBEzYCDEEAIRAMggILIBBBFUYNzwEgAEEANgIcIAAgATYCFCAAQZqPgIAANgIQIABBIjYCDEEAIRAMgQILIAAoAgQhECAAQQA2AgQCQCAAIBAgARC3gICAACIQDQAgAUEBaiEBDI0BCyAAQQw2AhwgACAQNgIMIAAgAUEBajYCFEEAIRAMgAILIBBBFUYNzAEgAEEANgIcIAAgATYCFCAAQZqPgIAANgIQIABBIjYCDEEAIRAM/wELIAAoAgQhECAAQQA2AgQCQCAAIBAgARC3gICAACIQDQAgAUEBaiEBDIwBCyAAQQ02AhwgACAQNgIMIAAgAUEBajYCFEEAIRAM/gELIBBBFUYNyQEgAEEANgIcIAAgATYCFCAAQcaMgIAANgIQIABBIzYCDEEAIRAM/QELIAAoAgQhECAAQQA2AgQCQCAAIBAgARC5gICAACIQDQAgAUEBaiEBDIsBCyAAQQ42AhwgACAQNgIMIAAgAUEBajYCFEEAIRAM/AELIABBADYCHCAAIAE2AhQgAEHAlYCAADYCECAAQQI2AgxBACEQDPsBCyAQQRVGDcUBIABBADYCHCAAIAE2AhQgAEHGjICAADYCECAAQSM2AgxBACEQDPoBCyAAQRA2AhwgACABNgIUIAAgEDYCDEEAIRAM+QELIAAoAgQhBCAAQQA2AgQCQCAAIAQgARC5gICAACIEDQAgAUEBaiEBDPEBCyAAQRE2AhwgACAENgIMIAAgAUEBajYCFEEAIRAM+AELIBBBFUYNwQEgAEEANgIcIAAgATYCFCAAQcaMgIAANgIQIABBIzYCDEEAIRAM9wELIAAoAgQhECAAQQA2AgQCQCAAIBAgARC5gICAACIQDQAgAUEBaiEBDIgBCyAAQRM2AhwgACAQNgIMIAAgAUEBajYCFEEAIRAM9gELIAAoAgQhBCAAQQA2AgQCQCAAIAQgARC5gICAACIEDQAgAUEBaiEBDO0BCyAAQRQ2AhwgACAENgIMIAAgAUEBajYCFEEAIRAM9QELIBBBFUYNvQEgAEEANgIcIAAgATYCFCAAQZqPgIAANgIQIABBIjYCDEEAIRAM9AELIAAoAgQhECAAQQA2AgQCQCAAIBAgARC3gICAACIQDQAgAUEBaiEBDIYBCyAAQRY2AhwgACAQNgIMIAAgAUEBajYCFEEAIRAM8wELIAAoAgQhBCAAQQA2AgQCQCAAIAQgARC3gICAACIEDQAgAUEBaiEBDOkBCyAAQRc2AhwgACAENgIMIAAgAUEBajYCFEEAIRAM8gELIABBADYCHCAAIAE2AhQgAEHNk4CAADYCECAAQQw2AgxBACEQDPEBC0IBIRELIBBBAWohAQJAIAApAyAiEkL//////////w9WDQAgACASQgSGIBGENwMgIAEhAQyEAQsgAEEANgIcIAAgATYCFCAAQa2JgIAANgIQIABBDDYCDEEAIRAM7wELIABBADYCHCAAIBA2AhQgAEHNk4CAADYCECAAQQw2AgxBACEQDO4BCyAAKAIEIRcgAEEANgIEIBAgEadqIhYhASAAIBcgECAWIBQbIhAQtYCAgAAiFEUNcyAAQQU2AhwgACAQNgIUIAAgFDYCDEEAIRAM7QELIABBADYCHCAAIBA2AhQgAEGqnICAADYCECAAQQ82AgxBACEQDOwBCyAAIBAgAhC0gICAACIBDQEgECEBC0EOIRAM0QELAkAgAUEVRw0AIABBAjYCHCAAIBA2AhQgAEGwmICAADYCECAAQRU2AgxBACEQDOoBCyAAQQA2AhwgACAQNgIUIABBp46AgAA2AhAgAEESNgIMQQAhEAzpAQsgAUEBaiEQAkAgAC8BMCIBQYABcUUNAAJAIAAgECACELuAgIAAIgENACAQIQEMcAsgAUEVRw26ASAAQQU2AhwgACAQNgIUIABB+ZeAgAA2AhAgAEEVNgIMQQAhEAzpAQsCQCABQaAEcUGgBEcNACAALQAtQQJxDQAgAEEANgIcIAAgEDYCFCAAQZaTgIAANgIQIABBBDYCDEEAIRAM6QELIAAgECACEL2AgIAAGiAQIQECQAJAAkACQAJAIAAgECACELOAgIAADhYCAQAEBAQEBAQEBAQEBAQEBAQEBAQDBAsgAEEBOgAuCyAAIAAvATBBwAByOwEwIBAhAQtBJiEQDNEBCyAAQSM2AhwgACAQNgIUIABBpZaAgAA2AhAgAEEVNgIMQQAhEAzpAQsgAEEANgIcIAAgEDYCFCAAQdWLgIAANgIQIABBETYCDEEAIRAM6AELIAAtAC1BAXFFDQFBwwEhEAzOAQsCQCANIAJGDQADQAJAIA0tAABBIEYNACANIQEMxAELIA1BAWoiDSACRw0AC0ElIRAM5wELQSUhEAzmAQsgACgCBCEEIABBADYCBCAAIAQgDRCvgICAACIERQ2tASAAQSY2AhwgACAENgIMIAAgDUEBajYCFEEAIRAM5QELIBBBFUYNqwEgAEEANgIcIAAgATYCFCAAQf2NgIAANgIQIABBHTYCDEEAIRAM5AELIABBJzYCHCAAIAE2AhQgACAQNgIMQQAhEAzjAQsgECEBQQEhFAJAAkACQAJAAkACQAJAIAAtACxBfmoOBwYFBQMBAgAFCyAAIAAvATBBCHI7ATAMAwtBAiEUDAELQQQhFAsgAEEBOgAsIAAgAC8BMCAUcjsBMAsgECEBC0ErIRAMygELIABBADYCHCAAIBA2AhQgAEGrkoCAADYCECAAQQs2AgxBACEQDOIBCyAAQQA2AhwgACABNgIUIABB4Y+AgAA2AhAgAEEKNgIMQQAhEAzhAQsgAEEAOgAsIBAhAQy9AQsgECEBQQEhFAJAAkACQAJAAkAgAC0ALEF7ag4EAwECAAULIAAgAC8BMEEIcjsBMAwDC0ECIRQMAQtBBCEUCyAAQQE6ACwgACAALwEwIBRyOwEwCyAQIQELQSkhEAzFAQsgAEEANgIcIAAgATYCFCAAQfCUgIAANgIQIABBAzYCDEEAIRAM3QELAkAgDi0AAEENRw0AIAAoAgQhASAAQQA2AgQCQCAAIAEgDhCxgICAACIBDQAgDkEBaiEBDHULIABBLDYCHCAAIAE2AgwgACAOQQFqNgIUQQAhEAzdAQsgAC0ALUEBcUUNAUHEASEQDMMBCwJAIA4gAkcNAEEtIRAM3AELAkACQANAAkAgDi0AAEF2ag4EAgAAAwALIA5BAWoiDiACRw0AC0EtIRAM3QELIAAoAgQhASAAQQA2AgQCQCAAIAEgDhCxgICAACIBDQAgDiEBDHQLIABBLDYCHCAAIA42AhQgACABNgIMQQAhEAzcAQsgACgCBCEBIABBADYCBAJAIAAgASAOELGAgIAAIgENACAOQQFqIQEMcwsgAEEsNgIcIAAgATYCDCAAIA5BAWo2AhRBACEQDNsBCyAAKAIEIQQgAEEANgIEIAAgBCAOELGAgIAAIgQNoAEgDiEBDM4BCyAQQSxHDQEgAUEBaiEQQQEhAQJAAkACQAJAAkAgAC0ALEF7ag4EAwECBAALIBAhAQwEC0ECIQEMAQtBBCEBCyAAQQE6ACwgACAALwEwIAFyOwEwIBAhAQwBCyAAIAAvATBBCHI7ATAgECEBC0E5IRAMvwELIABBADoALCABIQELQTQhEAy9AQsgACAALwEwQSByOwEwIAEhAQwCCyAAKAIEIQQgAEEANgIEAkAgACAEIAEQsYCAgAAiBA0AIAEhAQzHAQsgAEE3NgIcIAAgATYCFCAAIAQ2AgxBACEQDNQBCyAAQQg6ACwgASEBC0EwIRAMuQELAkAgAC0AKEEBRg0AIAEhAQwECyAALQAtQQhxRQ2TASABIQEMAwsgAC0AMEEgcQ2UAUHFASEQDLcBCwJAIA8gAkYNAAJAA0ACQCAPLQAAQVBqIgFB/wFxQQpJDQAgDyEBQTUhEAy6AQsgACkDICIRQpmz5syZs+bMGVYNASAAIBFCCn4iETcDICARIAGtQv8BgyISQn+FVg0BIAAgESASfDcDICAPQQFqIg8gAkcNAAtBOSEQDNEBCyAAKAIEIQIgAEEANgIEIAAgAiAPQQFqIgQQsYCAgAAiAg2VASAEIQEMwwELQTkhEAzPAQsCQCAALwEwIgFBCHFFDQAgAC0AKEEBRw0AIAAtAC1BCHFFDZABCyAAIAFB9/sDcUGABHI7ATAgDyEBC0E3IRAMtAELIAAgAC8BMEEQcjsBMAyrAQsgEEEVRg2LASAAQQA2AhwgACABNgIUIABB8I6AgAA2AhAgAEEcNgIMQQAhEAzLAQsgAEHDADYCHCAAIAE2AgwgACANQQFqNgIUQQAhEAzKAQsCQCABLQAAQTpHDQAgACgCBCEQIABBADYCBAJAIAAgECABEK+AgIAAIhANACABQQFqIQEMYwsgAEHDADYCHCAAIBA2AgwgACABQQFqNgIUQQAhEAzKAQsgAEEANgIcIAAgATYCFCAAQbGRgIAANgIQIABBCjYCDEEAIRAMyQELIABBADYCHCAAIAE2AhQgAEGgmYCAADYCECAAQR42AgxBACEQDMgBCyAAQQA2AgALIABBgBI7ASogACAXQQFqIgEgAhCogICAACIQDQEgASEBC0HHACEQDKwBCyAQQRVHDYMBIABB0QA2AhwgACABNgIUIABB45eAgAA2AhAgAEEVNgIMQQAhEAzEAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMXgsgAEHSADYCHCAAIAE2AhQgACAQNgIMQQAhEAzDAQsgAEEANgIcIAAgFDYCFCAAQcGogIAANgIQIABBBzYCDCAAQQA2AgBBACEQDMIBCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxdCyAAQdMANgIcIAAgATYCFCAAIBA2AgxBACEQDMEBC0EAIRAgAEEANgIcIAAgATYCFCAAQYCRgIAANgIQIABBCTYCDAzAAQsgEEEVRg19IABBADYCHCAAIAE2AhQgAEGUjYCAADYCECAAQSE2AgxBACEQDL8BC0EBIRZBACEXQQAhFEEBIRALIAAgEDoAKyABQQFqIQECQAJAIAAtAC1BEHENAAJAAkACQCAALQAqDgMBAAIECyAWRQ0DDAILIBQNAQwCCyAXRQ0BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQrYCAgAAiEA0AIAEhAQxcCyAAQdgANgIcIAAgATYCFCAAIBA2AgxBACEQDL4BCyAAKAIEIQQgAEEANgIEAkAgACAEIAEQrYCAgAAiBA0AIAEhAQytAQsgAEHZADYCHCAAIAE2AhQgACAENgIMQQAhEAy9AQsgACgCBCEEIABBADYCBAJAIAAgBCABEK2AgIAAIgQNACABIQEMqwELIABB2gA2AhwgACABNgIUIAAgBDYCDEEAIRAMvAELIAAoAgQhBCAAQQA2AgQCQCAAIAQgARCtgICAACIEDQAgASEBDKkBCyAAQdwANgIcIAAgATYCFCAAIAQ2AgxBACEQDLsBCwJAIAEtAABBUGoiEEH/AXFBCk8NACAAIBA6ACogAUEBaiEBQc8AIRAMogELIAAoAgQhBCAAQQA2AgQCQCAAIAQgARCtgICAACIEDQAgASEBDKcBCyAAQd4ANgIcIAAgATYCFCAAIAQ2AgxBACEQDLoBCyAAQQA2AgAgF0EBaiEBAkAgAC0AKUEjTw0AIAEhAQxZCyAAQQA2AhwgACABNgIUIABB04mAgAA2AhAgAEEINgIMQQAhEAy5AQsgAEEANgIAC0EAIRAgAEEANgIcIAAgATYCFCAAQZCzgIAANgIQIABBCDYCDAy3AQsgAEEANgIAIBdBAWohAQJAIAAtAClBIUcNACABIQEMVgsgAEEANgIcIAAgATYCFCAAQZuKgIAANgIQIABBCDYCDEEAIRAMtgELIABBADYCACAXQQFqIQECQCAALQApIhBBXWpBC08NACABIQEMVQsCQCAQQQZLDQBBASAQdEHKAHFFDQAgASEBDFULQQAhECAAQQA2AhwgACABNgIUIABB94mAgAA2AhAgAEEINgIMDLUBCyAQQRVGDXEgAEEANgIcIAAgATYCFCAAQbmNgIAANgIQIABBGjYCDEEAIRAMtAELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDFQLIABB5QA2AhwgACABNgIUIAAgEDYCDEEAIRAMswELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDE0LIABB0gA2AhwgACABNgIUIAAgEDYCDEEAIRAMsgELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDE0LIABB0wA2AhwgACABNgIUIAAgEDYCDEEAIRAMsQELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDFELIABB5QA2AhwgACABNgIUIAAgEDYCDEEAIRAMsAELIABBADYCHCAAIAE2AhQgAEHGioCAADYCECAAQQc2AgxBACEQDK8BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxJCyAAQdIANgIcIAAgATYCFCAAIBA2AgxBACEQDK4BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxJCyAAQdMANgIcIAAgATYCFCAAIBA2AgxBACEQDK0BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxNCyAAQeUANgIcIAAgATYCFCAAIBA2AgxBACEQDKwBCyAAQQA2AhwgACABNgIUIABB3IiAgAA2AhAgAEEHNgIMQQAhEAyrAQsgEEE/Rw0BIAFBAWohAQtBBSEQDJABC0EAIRAgAEEANgIcIAAgATYCFCAAQf2SgIAANgIQIABBBzYCDAyoAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMQgsgAEHSADYCHCAAIAE2AhQgACAQNgIMQQAhEAynAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMQgsgAEHTADYCHCAAIAE2AhQgACAQNgIMQQAhEAymAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMRgsgAEHlADYCHCAAIAE2AhQgACAQNgIMQQAhEAylAQsgACgCBCEBIABBADYCBAJAIAAgASAUEKeAgIAAIgENACAUIQEMPwsgAEHSADYCHCAAIBQ2AhQgACABNgIMQQAhEAykAQsgACgCBCEBIABBADYCBAJAIAAgASAUEKeAgIAAIgENACAUIQEMPwsgAEHTADYCHCAAIBQ2AhQgACABNgIMQQAhEAyjAQsgACgCBCEBIABBADYCBAJAIAAgASAUEKeAgIAAIgENACAUIQEMQwsgAEHlADYCHCAAIBQ2AhQgACABNgIMQQAhEAyiAQsgAEEANgIcIAAgFDYCFCAAQcOPgIAANgIQIABBBzYCDEEAIRAMoQELIABBADYCHCAAIAE2AhQgAEHDj4CAADYCECAAQQc2AgxBACEQDKABC0EAIRAgAEEANgIcIAAgFDYCFCAAQYycgIAANgIQIABBBzYCDAyfAQsgAEEANgIcIAAgFDYCFCAAQYycgIAANgIQIABBBzYCDEEAIRAMngELIABBADYCHCAAIBQ2AhQgAEH+kYCAADYCECAAQQc2AgxBACEQDJ0BCyAAQQA2AhwgACABNgIUIABBjpuAgAA2AhAgAEEGNgIMQQAhEAycAQsgEEEVRg1XIABBADYCHCAAIAE2AhQgAEHMjoCAADYCECAAQSA2AgxBACEQDJsBCyAAQQA2AgAgEEEBaiEBQSQhEAsgACAQOgApIAAoAgQhECAAQQA2AgQgACAQIAEQq4CAgAAiEA1UIAEhAQw+CyAAQQA2AgALQQAhECAAQQA2AhwgACAENgIUIABB8ZuAgAA2AhAgAEEGNgIMDJcBCyABQRVGDVAgAEEANgIcIAAgBTYCFCAAQfCMgIAANgIQIABBGzYCDEEAIRAMlgELIAAoAgQhBSAAQQA2AgQgACAFIBAQqYCAgAAiBQ0BIBBBAWohBQtBrQEhEAx7CyAAQcEBNgIcIAAgBTYCDCAAIBBBAWo2AhRBACEQDJMBCyAAKAIEIQYgAEEANgIEIAAgBiAQEKmAgIAAIgYNASAQQQFqIQYLQa4BIRAMeAsgAEHCATYCHCAAIAY2AgwgACAQQQFqNgIUQQAhEAyQAQsgAEEANgIcIAAgBzYCFCAAQZeLgIAANgIQIABBDTYCDEEAIRAMjwELIABBADYCHCAAIAg2AhQgAEHjkICAADYCECAAQQk2AgxBACEQDI4BCyAAQQA2AhwgACAINgIUIABBlI2AgAA2AhAgAEEhNgIMQQAhEAyNAQtBASEWQQAhF0EAIRRBASEQCyAAIBA6ACsgCUEBaiEIAkACQCAALQAtQRBxDQACQAJAAkAgAC0AKg4DAQACBAsgFkUNAwwCCyAUDQEMAgsgF0UNAQsgACgCBCEQIABBADYCBCAAIBAgCBCtgICAACIQRQ09IABByQE2AhwgACAINgIUIAAgEDYCDEEAIRAMjAELIAAoAgQhBCAAQQA2AgQgACAEIAgQrYCAgAAiBEUNdiAAQcoBNgIcIAAgCDYCFCAAIAQ2AgxBACEQDIsBCyAAKAIEIQQgAEEANgIEIAAgBCAJEK2AgIAAIgRFDXQgAEHLATYCHCAAIAk2AhQgACAENgIMQQAhEAyKAQsgACgCBCEEIABBADYCBCAAIAQgChCtgICAACIERQ1yIABBzQE2AhwgACAKNgIUIAAgBDYCDEEAIRAMiQELAkAgCy0AAEFQaiIQQf8BcUEKTw0AIAAgEDoAKiALQQFqIQpBtgEhEAxwCyAAKAIEIQQgAEEANgIEIAAgBCALEK2AgIAAIgRFDXAgAEHPATYCHCAAIAs2AhQgACAENgIMQQAhEAyIAQsgAEEANgIcIAAgBDYCFCAAQZCzgIAANgIQIABBCDYCDCAAQQA2AgBBACEQDIcBCyABQRVGDT8gAEEANgIcIAAgDDYCFCAAQcyOgIAANgIQIABBIDYCDEEAIRAMhgELIABBgQQ7ASggACgCBCEQIABCADcDACAAIBAgDEEBaiIMEKuAgIAAIhBFDTggAEHTATYCHCAAIAw2AhQgACAQNgIMQQAhEAyFAQsgAEEANgIAC0EAIRAgAEEANgIcIAAgBDYCFCAAQdibgIAANgIQIABBCDYCDAyDAQsgACgCBCEQIABCADcDACAAIBAgC0EBaiILEKuAgIAAIhANAUHGASEQDGkLIABBAjoAKAxVCyAAQdUBNgIcIAAgCzYCFCAAIBA2AgxBACEQDIABCyAQQRVGDTcgAEEANgIcIAAgBDYCFCAAQaSMgIAANgIQIABBEDYCDEEAIRAMfwsgAC0ANEEBRw00IAAgBCACELyAgIAAIhBFDTQgEEEVRw01IABB3AE2AhwgACAENgIUIABB1ZaAgAA2AhAgAEEVNgIMQQAhEAx+C0EAIRAgAEEANgIcIABBr4uAgAA2AhAgAEECNgIMIAAgFEEBajYCFAx9C0EAIRAMYwtBAiEQDGILQQ0hEAxhC0EPIRAMYAtBJSEQDF8LQRMhEAxeC0EVIRAMXQtBFiEQDFwLQRchEAxbC0EYIRAMWgtBGSEQDFkLQRohEAxYC0EbIRAMVwtBHCEQDFYLQR0hEAxVC0EfIRAMVAtBISEQDFMLQSMhEAxSC0HGACEQDFELQS4hEAxQC0EvIRAMTwtBOyEQDE4LQT0hEAxNC0HIACEQDEwLQckAIRAMSwtBywAhEAxKC0HMACEQDEkLQc4AIRAMSAtB0QAhEAxHC0HVACEQDEYLQdgAIRAMRQtB2QAhEAxEC0HbACEQDEMLQeQAIRAMQgtB5QAhEAxBC0HxACEQDEALQfQAIRAMPwtBjQEhEAw+C0GXASEQDD0LQakBIRAMPAtBrAEhEAw7C0HAASEQDDoLQbkBIRAMOQtBrwEhEAw4C0GxASEQDDcLQbIBIRAMNgtBtAEhEAw1C0G1ASEQDDQLQboBIRAMMwtBvQEhEAwyC0G/ASEQDDELQcEBIRAMMAsgAEEANgIcIAAgBDYCFCAAQemLgIAANgIQIABBHzYCDEEAIRAMSAsgAEHbATYCHCAAIAQ2AhQgAEH6loCAADYCECAAQRU2AgxBACEQDEcLIABB+AA2AhwgACAMNgIUIABBypiAgAA2AhAgAEEVNgIMQQAhEAxGCyAAQdEANgIcIAAgBTYCFCAAQbCXgIAANgIQIABBFTYCDEEAIRAMRQsgAEH5ADYCHCAAIAE2AhQgACAQNgIMQQAhEAxECyAAQfgANgIcIAAgATYCFCAAQcqYgIAANgIQIABBFTYCDEEAIRAMQwsgAEHkADYCHCAAIAE2AhQgAEHjl4CAADYCECAAQRU2AgxBACEQDEILIABB1wA2AhwgACABNgIUIABByZeAgAA2AhAgAEEVNgIMQQAhEAxBCyAAQQA2AhwgACABNgIUIABBuY2AgAA2AhAgAEEaNgIMQQAhEAxACyAAQcIANgIcIAAgATYCFCAAQeOYgIAANgIQIABBFTYCDEEAIRAMPwsgAEEANgIEIAAgDyAPELGAgIAAIgRFDQEgAEE6NgIcIAAgBDYCDCAAIA9BAWo2AhRBACEQDD4LIAAoAgQhBCAAQQA2AgQCQCAAIAQgARCxgICAACIERQ0AIABBOzYCHCAAIAQ2AgwgACABQQFqNgIUQQAhEAw+CyABQQFqIQEMLQsgD0EBaiEBDC0LIABBADYCHCAAIA82AhQgAEHkkoCAADYCECAAQQQ2AgxBACEQDDsLIABBNjYCHCAAIAQ2AhQgACACNgIMQQAhEAw6CyAAQS42AhwgACAONgIUIAAgBDYCDEEAIRAMOQsgAEHQADYCHCAAIAE2AhQgAEGRmICAADYCECAAQRU2AgxBACEQDDgLIA1BAWohAQwsCyAAQRU2AhwgACABNgIUIABBgpmAgAA2AhAgAEEVNgIMQQAhEAw2CyAAQRs2AhwgACABNgIUIABBkZeAgAA2AhAgAEEVNgIMQQAhEAw1CyAAQQ82AhwgACABNgIUIABBkZeAgAA2AhAgAEEVNgIMQQAhEAw0CyAAQQs2AhwgACABNgIUIABBkZeAgAA2AhAgAEEVNgIMQQAhEAwzCyAAQRo2AhwgACABNgIUIABBgpmAgAA2AhAgAEEVNgIMQQAhEAwyCyAAQQs2AhwgACABNgIUIABBgpmAgAA2AhAgAEEVNgIMQQAhEAwxCyAAQQo2AhwgACABNgIUIABB5JaAgAA2AhAgAEEVNgIMQQAhEAwwCyAAQR42AhwgACABNgIUIABB+ZeAgAA2AhAgAEEVNgIMQQAhEAwvCyAAQQA2AhwgACAQNgIUIABB2o2AgAA2AhAgAEEUNgIMQQAhEAwuCyAAQQQ2AhwgACABNgIUIABBsJiAgAA2AhAgAEEVNgIMQQAhEAwtCyAAQQA2AgAgC0EBaiELC0G4ASEQDBILIABBADYCACAQQQFqIQFB9QAhEAwRCyABIQECQCAALQApQQVHDQBB4wAhEAwRC0HiACEQDBALQQAhECAAQQA2AhwgAEHkkYCAADYCECAAQQc2AgwgACAUQQFqNgIUDCgLIABBADYCACAXQQFqIQFBwAAhEAwOC0EBIQELIAAgAToALCAAQQA2AgAgF0EBaiEBC0EoIRAMCwsgASEBC0E4IRAMCQsCQCABIg8gAkYNAANAAkAgDy0AAEGAvoCAAGotAAAiAUEBRg0AIAFBAkcNAyAPQQFqIQEMBAsgD0EBaiIPIAJHDQALQT4hEAwiC0E+IRAMIQsgAEEAOgAsIA8hAQwBC0ELIRAMBgtBOiEQDAULIAFBAWohAUEtIRAMBAsgACABOgAsIABBADYCACAWQQFqIQFBDCEQDAMLIABBADYCACAXQQFqIQFBCiEQDAILIABBADYCAAsgAEEAOgAsIA0hAUEJIRAMAAsLQQAhECAAQQA2AhwgACALNgIUIABBzZCAgAA2AhAgAEEJNgIMDBcLQQAhECAAQQA2AhwgACAKNgIUIABB6YqAgAA2AhAgAEEJNgIMDBYLQQAhECAAQQA2AhwgACAJNgIUIABBt5CAgAA2AhAgAEEJNgIMDBULQQAhECAAQQA2AhwgACAINgIUIABBnJGAgAA2AhAgAEEJNgIMDBQLQQAhECAAQQA2AhwgACABNgIUIABBzZCAgAA2AhAgAEEJNgIMDBMLQQAhECAAQQA2AhwgACABNgIUIABB6YqAgAA2AhAgAEEJNgIMDBILQQAhECAAQQA2AhwgACABNgIUIABBt5CAgAA2AhAgAEEJNgIMDBELQQAhECAAQQA2AhwgACABNgIUIABBnJGAgAA2AhAgAEEJNgIMDBALQQAhECAAQQA2AhwgACABNgIUIABBl5WAgAA2AhAgAEEPNgIMDA8LQQAhECAAQQA2AhwgACABNgIUIABBl5WAgAA2AhAgAEEPNgIMDA4LQQAhECAAQQA2AhwgACABNgIUIABBwJKAgAA2AhAgAEELNgIMDA0LQQAhECAAQQA2AhwgACABNgIUIABBlYmAgAA2AhAgAEELNgIMDAwLQQAhECAAQQA2AhwgACABNgIUIABB4Y+AgAA2AhAgAEEKNgIMDAsLQQAhECAAQQA2AhwgACABNgIUIABB+4+AgAA2AhAgAEEKNgIMDAoLQQAhECAAQQA2AhwgACABNgIUIABB8ZmAgAA2AhAgAEECNgIMDAkLQQAhECAAQQA2AhwgACABNgIUIABBxJSAgAA2AhAgAEECNgIMDAgLQQAhECAAQQA2AhwgACABNgIUIABB8pWAgAA2AhAgAEECNgIMDAcLIABBAjYCHCAAIAE2AhQgAEGcmoCAADYCECAAQRY2AgxBACEQDAYLQQEhEAwFC0HUACEQIAEiBCACRg0EIANBCGogACAEIAJB2MKAgABBChDFgICAACADKAIMIQQgAygCCA4DAQQCAAsQyoCAgAAACyAAQQA2AhwgAEG1moCAADYCECAAQRc2AgwgACAEQQFqNgIUQQAhEAwCCyAAQQA2AhwgACAENgIUIABBypqAgAA2AhAgAEEJNgIMQQAhEAwBCwJAIAEiBCACRw0AQSIhEAwBCyAAQYmAgIAANgIIIAAgBDYCBEEhIRALIANBEGokgICAgAAgEAuvAQECfyABKAIAIQYCQAJAIAIgA0YNACAEIAZqIQQgBiADaiACayEHIAIgBkF/cyAFaiIGaiEFA0ACQCACLQAAIAQtAABGDQBBAiEEDAMLAkAgBg0AQQAhBCAFIQIMAwsgBkF/aiEGIARBAWohBCACQQFqIgIgA0cNAAsgByEGIAMhAgsgAEEBNgIAIAEgBjYCACAAIAI2AgQPCyABQQA2AgAgACAENgIAIAAgAjYCBAsKACAAEMeAgIAAC/I2AQt/I4CAgIAAQRBrIgEkgICAgAACQEEAKAKg0ICAAA0AQQAQy4CAgABBgNSEgABrIgJB2QBJDQBBACEDAkBBACgC4NOAgAAiBA0AQQBCfzcC7NOAgABBAEKAgISAgIDAADcC5NOAgABBACABQQhqQXBxQdiq1aoFcyIENgLg04CAAEEAQQA2AvTTgIAAQQBBADYCxNOAgAALQQAgAjYCzNOAgABBAEGA1ISAADYCyNOAgABBAEGA1ISAADYCmNCAgABBACAENgKs0ICAAEEAQX82AqjQgIAAA0AgA0HE0ICAAGogA0G40ICAAGoiBDYCACAEIANBsNCAgABqIgU2AgAgA0G80ICAAGogBTYCACADQczQgIAAaiADQcDQgIAAaiIFNgIAIAUgBDYCACADQdTQgIAAaiADQcjQgIAAaiIENgIAIAQgBTYCACADQdDQgIAAaiAENgIAIANBIGoiA0GAAkcNAAtBgNSEgABBeEGA1ISAAGtBD3FBAEGA1ISAAEEIakEPcRsiA2oiBEEEaiACQUhqIgUgA2siA0EBcjYCAEEAQQAoAvDTgIAANgKk0ICAAEEAIAM2ApTQgIAAQQAgBDYCoNCAgABBgNSEgAAgBWpBODYCBAsCQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAEHsAUsNAAJAQQAoAojQgIAAIgZBECAAQRNqQXBxIABBC0kbIgJBA3YiBHYiA0EDcUUNAAJAAkAgA0EBcSAEckEBcyIFQQN0IgRBsNCAgABqIgMgBEG40ICAAGooAgAiBCgCCCICRw0AQQAgBkF+IAV3cTYCiNCAgAAMAQsgAyACNgIIIAIgAzYCDAsgBEEIaiEDIAQgBUEDdCIFQQNyNgIEIAQgBWoiBCAEKAIEQQFyNgIEDAwLIAJBACgCkNCAgAAiB00NAQJAIANFDQACQAJAIAMgBHRBAiAEdCIDQQAgA2tycSIDQQAgA2txQX9qIgMgA0EMdkEQcSIDdiIEQQV2QQhxIgUgA3IgBCAFdiIDQQJ2QQRxIgRyIAMgBHYiA0EBdkECcSIEciADIAR2IgNBAXZBAXEiBHIgAyAEdmoiBEEDdCIDQbDQgIAAaiIFIANBuNCAgABqKAIAIgMoAggiAEcNAEEAIAZBfiAEd3EiBjYCiNCAgAAMAQsgBSAANgIIIAAgBTYCDAsgAyACQQNyNgIEIAMgBEEDdCIEaiAEIAJrIgU2AgAgAyACaiIAIAVBAXI2AgQCQCAHRQ0AIAdBeHFBsNCAgABqIQJBACgCnNCAgAAhBAJAAkAgBkEBIAdBA3Z0IghxDQBBACAGIAhyNgKI0ICAACACIQgMAQsgAigCCCEICyAIIAQ2AgwgAiAENgIIIAQgAjYCDCAEIAg2AggLIANBCGohA0EAIAA2ApzQgIAAQQAgBTYCkNCAgAAMDAtBACgCjNCAgAAiCUUNASAJQQAgCWtxQX9qIgMgA0EMdkEQcSIDdiIEQQV2QQhxIgUgA3IgBCAFdiIDQQJ2QQRxIgRyIAMgBHYiA0EBdkECcSIEciADIAR2IgNBAXZBAXEiBHIgAyAEdmpBAnRBuNKAgABqKAIAIgAoAgRBeHEgAmshBCAAIQUCQANAAkAgBSgCECIDDQAgBUEUaigCACIDRQ0CCyADKAIEQXhxIAJrIgUgBCAFIARJIgUbIQQgAyAAIAUbIQAgAyEFDAALCyAAKAIYIQoCQCAAKAIMIgggAEYNACAAKAIIIgNBACgCmNCAgABJGiAIIAM2AgggAyAINgIMDAsLAkAgAEEUaiIFKAIAIgMNACAAKAIQIgNFDQMgAEEQaiEFCwNAIAUhCyADIghBFGoiBSgCACIDDQAgCEEQaiEFIAgoAhAiAw0ACyALQQA2AgAMCgtBfyECIABBv39LDQAgAEETaiIDQXBxIQJBACgCjNCAgAAiB0UNAEEAIQsCQCACQYACSQ0AQR8hCyACQf///wdLDQAgA0EIdiIDIANBgP4/akEQdkEIcSIDdCIEIARBgOAfakEQdkEEcSIEdCIFIAVBgIAPakEQdkECcSIFdEEPdiADIARyIAVyayIDQQF0IAIgA0EVanZBAXFyQRxqIQsLQQAgAmshBAJAAkACQAJAIAtBAnRBuNKAgABqKAIAIgUNAEEAIQNBACEIDAELQQAhAyACQQBBGSALQQF2ayALQR9GG3QhAEEAIQgDQAJAIAUoAgRBeHEgAmsiBiAETw0AIAYhBCAFIQggBg0AQQAhBCAFIQggBSEDDAMLIAMgBUEUaigCACIGIAYgBSAAQR12QQRxakEQaigCACIFRhsgAyAGGyEDIABBAXQhACAFDQALCwJAIAMgCHINAEEAIQhBAiALdCIDQQAgA2tyIAdxIgNFDQMgA0EAIANrcUF/aiIDIANBDHZBEHEiA3YiBUEFdkEIcSIAIANyIAUgAHYiA0ECdkEEcSIFciADIAV2IgNBAXZBAnEiBXIgAyAFdiIDQQF2QQFxIgVyIAMgBXZqQQJ0QbjSgIAAaigCACEDCyADRQ0BCwNAIAMoAgRBeHEgAmsiBiAESSEAAkAgAygCECIFDQAgA0EUaigCACEFCyAGIAQgABshBCADIAggABshCCAFIQMgBQ0ACwsgCEUNACAEQQAoApDQgIAAIAJrTw0AIAgoAhghCwJAIAgoAgwiACAIRg0AIAgoAggiA0EAKAKY0ICAAEkaIAAgAzYCCCADIAA2AgwMCQsCQCAIQRRqIgUoAgAiAw0AIAgoAhAiA0UNAyAIQRBqIQULA0AgBSEGIAMiAEEUaiIFKAIAIgMNACAAQRBqIQUgACgCECIDDQALIAZBADYCAAwICwJAQQAoApDQgIAAIgMgAkkNAEEAKAKc0ICAACEEAkACQCADIAJrIgVBEEkNACAEIAJqIgAgBUEBcjYCBEEAIAU2ApDQgIAAQQAgADYCnNCAgAAgBCADaiAFNgIAIAQgAkEDcjYCBAwBCyAEIANBA3I2AgQgBCADaiIDIAMoAgRBAXI2AgRBAEEANgKc0ICAAEEAQQA2ApDQgIAACyAEQQhqIQMMCgsCQEEAKAKU0ICAACIAIAJNDQBBACgCoNCAgAAiAyACaiIEIAAgAmsiBUEBcjYCBEEAIAU2ApTQgIAAQQAgBDYCoNCAgAAgAyACQQNyNgIEIANBCGohAwwKCwJAAkBBACgC4NOAgABFDQBBACgC6NOAgAAhBAwBC0EAQn83AuzTgIAAQQBCgICEgICAwAA3AuTTgIAAQQAgAUEMakFwcUHYqtWqBXM2AuDTgIAAQQBBADYC9NOAgABBAEEANgLE04CAAEGAgAQhBAtBACEDAkAgBCACQccAaiIHaiIGQQAgBGsiC3EiCCACSw0AQQBBMDYC+NOAgAAMCgsCQEEAKALA04CAACIDRQ0AAkBBACgCuNOAgAAiBCAIaiIFIARNDQAgBSADTQ0BC0EAIQNBAEEwNgL404CAAAwKC0EALQDE04CAAEEEcQ0EAkACQAJAQQAoAqDQgIAAIgRFDQBByNOAgAAhAwNAAkAgAygCACIFIARLDQAgBSADKAIEaiAESw0DCyADKAIIIgMNAAsLQQAQy4CAgAAiAEF/Rg0FIAghBgJAQQAoAuTTgIAAIgNBf2oiBCAAcUUNACAIIABrIAQgAGpBACADa3FqIQYLIAYgAk0NBSAGQf7///8HSw0FAkBBACgCwNOAgAAiA0UNAEEAKAK404CAACIEIAZqIgUgBE0NBiAFIANLDQYLIAYQy4CAgAAiAyAARw0BDAcLIAYgAGsgC3EiBkH+////B0sNBCAGEMuAgIAAIgAgAygCACADKAIEakYNAyAAIQMLAkAgA0F/Rg0AIAJByABqIAZNDQACQCAHIAZrQQAoAujTgIAAIgRqQQAgBGtxIgRB/v///wdNDQAgAyEADAcLAkAgBBDLgICAAEF/Rg0AIAQgBmohBiADIQAMBwtBACAGaxDLgICAABoMBAsgAyEAIANBf0cNBQwDC0EAIQgMBwtBACEADAULIABBf0cNAgtBAEEAKALE04CAAEEEcjYCxNOAgAALIAhB/v///wdLDQEgCBDLgICAACEAQQAQy4CAgAAhAyAAQX9GDQEgA0F/Rg0BIAAgA08NASADIABrIgYgAkE4ak0NAQtBAEEAKAK404CAACAGaiIDNgK404CAAAJAIANBACgCvNOAgABNDQBBACADNgK804CAAAsCQAJAAkACQEEAKAKg0ICAACIERQ0AQcjTgIAAIQMDQCAAIAMoAgAiBSADKAIEIghqRg0CIAMoAggiAw0ADAMLCwJAAkBBACgCmNCAgAAiA0UNACAAIANPDQELQQAgADYCmNCAgAALQQAhA0EAIAY2AszTgIAAQQAgADYCyNOAgABBAEF/NgKo0ICAAEEAQQAoAuDTgIAANgKs0ICAAEEAQQA2AtTTgIAAA0AgA0HE0ICAAGogA0G40ICAAGoiBDYCACAEIANBsNCAgABqIgU2AgAgA0G80ICAAGogBTYCACADQczQgIAAaiADQcDQgIAAaiIFNgIAIAUgBDYCACADQdTQgIAAaiADQcjQgIAAaiIENgIAIAQgBTYCACADQdDQgIAAaiAENgIAIANBIGoiA0GAAkcNAAsgAEF4IABrQQ9xQQAgAEEIakEPcRsiA2oiBCAGQUhqIgUgA2siA0EBcjYCBEEAQQAoAvDTgIAANgKk0ICAAEEAIAM2ApTQgIAAQQAgBDYCoNCAgAAgACAFakE4NgIEDAILIAMtAAxBCHENACAEIAVJDQAgBCAATw0AIARBeCAEa0EPcUEAIARBCGpBD3EbIgVqIgBBACgClNCAgAAgBmoiCyAFayIFQQFyNgIEIAMgCCAGajYCBEEAQQAoAvDTgIAANgKk0ICAAEEAIAU2ApTQgIAAQQAgADYCoNCAgAAgBCALakE4NgIEDAELAkAgAEEAKAKY0ICAACIITw0AQQAgADYCmNCAgAAgACEICyAAIAZqIQVByNOAgAAhAwJAAkACQAJAAkACQAJAA0AgAygCACAFRg0BIAMoAggiAw0ADAILCyADLQAMQQhxRQ0BC0HI04CAACEDA0ACQCADKAIAIgUgBEsNACAFIAMoAgRqIgUgBEsNAwsgAygCCCEDDAALCyADIAA2AgAgAyADKAIEIAZqNgIEIABBeCAAa0EPcUEAIABBCGpBD3EbaiILIAJBA3I2AgQgBUF4IAVrQQ9xQQAgBUEIakEPcRtqIgYgCyACaiICayEDAkAgBiAERw0AQQAgAjYCoNCAgABBAEEAKAKU0ICAACADaiIDNgKU0ICAACACIANBAXI2AgQMAwsCQCAGQQAoApzQgIAARw0AQQAgAjYCnNCAgABBAEEAKAKQ0ICAACADaiIDNgKQ0ICAACACIANBAXI2AgQgAiADaiADNgIADAMLAkAgBigCBCIEQQNxQQFHDQAgBEF4cSEHAkACQCAEQf8BSw0AIAYoAggiBSAEQQN2IghBA3RBsNCAgABqIgBGGgJAIAYoAgwiBCAFRw0AQQBBACgCiNCAgABBfiAId3E2AojQgIAADAILIAQgAEYaIAQgBTYCCCAFIAQ2AgwMAQsgBigCGCEJAkACQCAGKAIMIgAgBkYNACAGKAIIIgQgCEkaIAAgBDYCCCAEIAA2AgwMAQsCQCAGQRRqIgQoAgAiBQ0AIAZBEGoiBCgCACIFDQBBACEADAELA0AgBCEIIAUiAEEUaiIEKAIAIgUNACAAQRBqIQQgACgCECIFDQALIAhBADYCAAsgCUUNAAJAAkAgBiAGKAIcIgVBAnRBuNKAgABqIgQoAgBHDQAgBCAANgIAIAANAUEAQQAoAozQgIAAQX4gBXdxNgKM0ICAAAwCCyAJQRBBFCAJKAIQIAZGG2ogADYCACAARQ0BCyAAIAk2AhgCQCAGKAIQIgRFDQAgACAENgIQIAQgADYCGAsgBigCFCIERQ0AIABBFGogBDYCACAEIAA2AhgLIAcgA2ohAyAGIAdqIgYoAgQhBAsgBiAEQX5xNgIEIAIgA2ogAzYCACACIANBAXI2AgQCQCADQf8BSw0AIANBeHFBsNCAgABqIQQCQAJAQQAoAojQgIAAIgVBASADQQN2dCIDcQ0AQQAgBSADcjYCiNCAgAAgBCEDDAELIAQoAgghAwsgAyACNgIMIAQgAjYCCCACIAQ2AgwgAiADNgIIDAMLQR8hBAJAIANB////B0sNACADQQh2IgQgBEGA/j9qQRB2QQhxIgR0IgUgBUGA4B9qQRB2QQRxIgV0IgAgAEGAgA9qQRB2QQJxIgB0QQ92IAQgBXIgAHJrIgRBAXQgAyAEQRVqdkEBcXJBHGohBAsgAiAENgIcIAJCADcCECAEQQJ0QbjSgIAAaiEFAkBBACgCjNCAgAAiAEEBIAR0IghxDQAgBSACNgIAQQAgACAIcjYCjNCAgAAgAiAFNgIYIAIgAjYCCCACIAI2AgwMAwsgA0EAQRkgBEEBdmsgBEEfRht0IQQgBSgCACEAA0AgACIFKAIEQXhxIANGDQIgBEEddiEAIARBAXQhBCAFIABBBHFqQRBqIggoAgAiAA0ACyAIIAI2AgAgAiAFNgIYIAIgAjYCDCACIAI2AggMAgsgAEF4IABrQQ9xQQAgAEEIakEPcRsiA2oiCyAGQUhqIgggA2siA0EBcjYCBCAAIAhqQTg2AgQgBCAFQTcgBWtBD3FBACAFQUlqQQ9xG2pBQWoiCCAIIARBEGpJGyIIQSM2AgRBAEEAKALw04CAADYCpNCAgABBACADNgKU0ICAAEEAIAs2AqDQgIAAIAhBEGpBACkC0NOAgAA3AgAgCEEAKQLI04CAADcCCEEAIAhBCGo2AtDTgIAAQQAgBjYCzNOAgABBACAANgLI04CAAEEAQQA2AtTTgIAAIAhBJGohAwNAIANBBzYCACADQQRqIgMgBUkNAAsgCCAERg0DIAggCCgCBEF+cTYCBCAIIAggBGsiADYCACAEIABBAXI2AgQCQCAAQf8BSw0AIABBeHFBsNCAgABqIQMCQAJAQQAoAojQgIAAIgVBASAAQQN2dCIAcQ0AQQAgBSAAcjYCiNCAgAAgAyEFDAELIAMoAgghBQsgBSAENgIMIAMgBDYCCCAEIAM2AgwgBCAFNgIIDAQLQR8hAwJAIABB////B0sNACAAQQh2IgMgA0GA/j9qQRB2QQhxIgN0IgUgBUGA4B9qQRB2QQRxIgV0IgggCEGAgA9qQRB2QQJxIgh0QQ92IAMgBXIgCHJrIgNBAXQgACADQRVqdkEBcXJBHGohAwsgBCADNgIcIARCADcCECADQQJ0QbjSgIAAaiEFAkBBACgCjNCAgAAiCEEBIAN0IgZxDQAgBSAENgIAQQAgCCAGcjYCjNCAgAAgBCAFNgIYIAQgBDYCCCAEIAQ2AgwMBAsgAEEAQRkgA0EBdmsgA0EfRht0IQMgBSgCACEIA0AgCCIFKAIEQXhxIABGDQMgA0EddiEIIANBAXQhAyAFIAhBBHFqQRBqIgYoAgAiCA0ACyAGIAQ2AgAgBCAFNgIYIAQgBDYCDCAEIAQ2AggMAwsgBSgCCCIDIAI2AgwgBSACNgIIIAJBADYCGCACIAU2AgwgAiADNgIICyALQQhqIQMMBQsgBSgCCCIDIAQ2AgwgBSAENgIIIARBADYCGCAEIAU2AgwgBCADNgIIC0EAKAKU0ICAACIDIAJNDQBBACgCoNCAgAAiBCACaiIFIAMgAmsiA0EBcjYCBEEAIAM2ApTQgIAAQQAgBTYCoNCAgAAgBCACQQNyNgIEIARBCGohAwwDC0EAIQNBAEEwNgL404CAAAwCCwJAIAtFDQACQAJAIAggCCgCHCIFQQJ0QbjSgIAAaiIDKAIARw0AIAMgADYCACAADQFBACAHQX4gBXdxIgc2AozQgIAADAILIAtBEEEUIAsoAhAgCEYbaiAANgIAIABFDQELIAAgCzYCGAJAIAgoAhAiA0UNACAAIAM2AhAgAyAANgIYCyAIQRRqKAIAIgNFDQAgAEEUaiADNgIAIAMgADYCGAsCQAJAIARBD0sNACAIIAQgAmoiA0EDcjYCBCAIIANqIgMgAygCBEEBcjYCBAwBCyAIIAJqIgAgBEEBcjYCBCAIIAJBA3I2AgQgACAEaiAENgIAAkAgBEH/AUsNACAEQXhxQbDQgIAAaiEDAkACQEEAKAKI0ICAACIFQQEgBEEDdnQiBHENAEEAIAUgBHI2AojQgIAAIAMhBAwBCyADKAIIIQQLIAQgADYCDCADIAA2AgggACADNgIMIAAgBDYCCAwBC0EfIQMCQCAEQf///wdLDQAgBEEIdiIDIANBgP4/akEQdkEIcSIDdCIFIAVBgOAfakEQdkEEcSIFdCICIAJBgIAPakEQdkECcSICdEEPdiADIAVyIAJyayIDQQF0IAQgA0EVanZBAXFyQRxqIQMLIAAgAzYCHCAAQgA3AhAgA0ECdEG40oCAAGohBQJAIAdBASADdCICcQ0AIAUgADYCAEEAIAcgAnI2AozQgIAAIAAgBTYCGCAAIAA2AgggACAANgIMDAELIARBAEEZIANBAXZrIANBH0YbdCEDIAUoAgAhAgJAA0AgAiIFKAIEQXhxIARGDQEgA0EddiECIANBAXQhAyAFIAJBBHFqQRBqIgYoAgAiAg0ACyAGIAA2AgAgACAFNgIYIAAgADYCDCAAIAA2AggMAQsgBSgCCCIDIAA2AgwgBSAANgIIIABBADYCGCAAIAU2AgwgACADNgIICyAIQQhqIQMMAQsCQCAKRQ0AAkACQCAAIAAoAhwiBUECdEG40oCAAGoiAygCAEcNACADIAg2AgAgCA0BQQAgCUF+IAV3cTYCjNCAgAAMAgsgCkEQQRQgCigCECAARhtqIAg2AgAgCEUNAQsgCCAKNgIYAkAgACgCECIDRQ0AIAggAzYCECADIAg2AhgLIABBFGooAgAiA0UNACAIQRRqIAM2AgAgAyAINgIYCwJAAkAgBEEPSw0AIAAgBCACaiIDQQNyNgIEIAAgA2oiAyADKAIEQQFyNgIEDAELIAAgAmoiBSAEQQFyNgIEIAAgAkEDcjYCBCAFIARqIAQ2AgACQCAHRQ0AIAdBeHFBsNCAgABqIQJBACgCnNCAgAAhAwJAAkBBASAHQQN2dCIIIAZxDQBBACAIIAZyNgKI0ICAACACIQgMAQsgAigCCCEICyAIIAM2AgwgAiADNgIIIAMgAjYCDCADIAg2AggLQQAgBTYCnNCAgABBACAENgKQ0ICAAAsgAEEIaiEDCyABQRBqJICAgIAAIAMLCgAgABDJgICAAAviDQEHfwJAIABFDQAgAEF4aiIBIABBfGooAgAiAkF4cSIAaiEDAkAgAkEBcQ0AIAJBA3FFDQEgASABKAIAIgJrIgFBACgCmNCAgAAiBEkNASACIABqIQACQCABQQAoApzQgIAARg0AAkAgAkH/AUsNACABKAIIIgQgAkEDdiIFQQN0QbDQgIAAaiIGRhoCQCABKAIMIgIgBEcNAEEAQQAoAojQgIAAQX4gBXdxNgKI0ICAAAwDCyACIAZGGiACIAQ2AgggBCACNgIMDAILIAEoAhghBwJAAkAgASgCDCIGIAFGDQAgASgCCCICIARJGiAGIAI2AgggAiAGNgIMDAELAkAgAUEUaiICKAIAIgQNACABQRBqIgIoAgAiBA0AQQAhBgwBCwNAIAIhBSAEIgZBFGoiAigCACIEDQAgBkEQaiECIAYoAhAiBA0ACyAFQQA2AgALIAdFDQECQAJAIAEgASgCHCIEQQJ0QbjSgIAAaiICKAIARw0AIAIgBjYCACAGDQFBAEEAKAKM0ICAAEF+IAR3cTYCjNCAgAAMAwsgB0EQQRQgBygCECABRhtqIAY2AgAgBkUNAgsgBiAHNgIYAkAgASgCECICRQ0AIAYgAjYCECACIAY2AhgLIAEoAhQiAkUNASAGQRRqIAI2AgAgAiAGNgIYDAELIAMoAgQiAkEDcUEDRw0AIAMgAkF+cTYCBEEAIAA2ApDQgIAAIAEgAGogADYCACABIABBAXI2AgQPCyABIANPDQAgAygCBCICQQFxRQ0AAkACQCACQQJxDQACQCADQQAoAqDQgIAARw0AQQAgATYCoNCAgABBAEEAKAKU0ICAACAAaiIANgKU0ICAACABIABBAXI2AgQgAUEAKAKc0ICAAEcNA0EAQQA2ApDQgIAAQQBBADYCnNCAgAAPCwJAIANBACgCnNCAgABHDQBBACABNgKc0ICAAEEAQQAoApDQgIAAIABqIgA2ApDQgIAAIAEgAEEBcjYCBCABIABqIAA2AgAPCyACQXhxIABqIQACQAJAIAJB/wFLDQAgAygCCCIEIAJBA3YiBUEDdEGw0ICAAGoiBkYaAkAgAygCDCICIARHDQBBAEEAKAKI0ICAAEF+IAV3cTYCiNCAgAAMAgsgAiAGRhogAiAENgIIIAQgAjYCDAwBCyADKAIYIQcCQAJAIAMoAgwiBiADRg0AIAMoAggiAkEAKAKY0ICAAEkaIAYgAjYCCCACIAY2AgwMAQsCQCADQRRqIgIoAgAiBA0AIANBEGoiAigCACIEDQBBACEGDAELA0AgAiEFIAQiBkEUaiICKAIAIgQNACAGQRBqIQIgBigCECIEDQALIAVBADYCAAsgB0UNAAJAAkAgAyADKAIcIgRBAnRBuNKAgABqIgIoAgBHDQAgAiAGNgIAIAYNAUEAQQAoAozQgIAAQX4gBHdxNgKM0ICAAAwCCyAHQRBBFCAHKAIQIANGG2ogBjYCACAGRQ0BCyAGIAc2AhgCQCADKAIQIgJFDQAgBiACNgIQIAIgBjYCGAsgAygCFCICRQ0AIAZBFGogAjYCACACIAY2AhgLIAEgAGogADYCACABIABBAXI2AgQgAUEAKAKc0ICAAEcNAUEAIAA2ApDQgIAADwsgAyACQX5xNgIEIAEgAGogADYCACABIABBAXI2AgQLAkAgAEH/AUsNACAAQXhxQbDQgIAAaiECAkACQEEAKAKI0ICAACIEQQEgAEEDdnQiAHENAEEAIAQgAHI2AojQgIAAIAIhAAwBCyACKAIIIQALIAAgATYCDCACIAE2AgggASACNgIMIAEgADYCCA8LQR8hAgJAIABB////B0sNACAAQQh2IgIgAkGA/j9qQRB2QQhxIgJ0IgQgBEGA4B9qQRB2QQRxIgR0IgYgBkGAgA9qQRB2QQJxIgZ0QQ92IAIgBHIgBnJrIgJBAXQgACACQRVqdkEBcXJBHGohAgsgASACNgIcIAFCADcCECACQQJ0QbjSgIAAaiEEAkACQEEAKAKM0ICAACIGQQEgAnQiA3ENACAEIAE2AgBBACAGIANyNgKM0ICAACABIAQ2AhggASABNgIIIAEgATYCDAwBCyAAQQBBGSACQQF2ayACQR9GG3QhAiAEKAIAIQYCQANAIAYiBCgCBEF4cSAARg0BIAJBHXYhBiACQQF0IQIgBCAGQQRxakEQaiIDKAIAIgYNAAsgAyABNgIAIAEgBDYCGCABIAE2AgwgASABNgIIDAELIAQoAggiACABNgIMIAQgATYCCCABQQA2AhggASAENgIMIAEgADYCCAtBAEEAKAKo0ICAAEF/aiIBQX8gARs2AqjQgIAACwsEAAAAC04AAkAgAA0APwBBEHQPCwJAIABB//8DcQ0AIABBf0wNAAJAIABBEHZAACIAQX9HDQBBAEEwNgL404CAAEF/DwsgAEEQdA8LEMqAgIAAAAvyAgIDfwF+AkAgAkUNACAAIAE6AAAgAiAAaiIDQX9qIAE6AAAgAkEDSQ0AIAAgAToAAiAAIAE6AAEgA0F9aiABOgAAIANBfmogAToAACACQQdJDQAgACABOgADIANBfGogAToAACACQQlJDQAgAEEAIABrQQNxIgRqIgMgAUH/AXFBgYKECGwiATYCACADIAIgBGtBfHEiBGoiAkF8aiABNgIAIARBCUkNACADIAE2AgggAyABNgIEIAJBeGogATYCACACQXRqIAE2AgAgBEEZSQ0AIAMgATYCGCADIAE2AhQgAyABNgIQIAMgATYCDCACQXBqIAE2AgAgAkFsaiABNgIAIAJBaGogATYCACACQWRqIAE2AgAgBCADQQRxQRhyIgVrIgJBIEkNACABrUKBgICAEH4hBiADIAVqIQEDQCABIAY3AxggASAGNwMQIAEgBjcDCCABIAY3AwAgAUEgaiEBIAJBYGoiAkEfSw0ACwsgAAsLjkgBAEGACAuGSAEAAAACAAAAAwAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAYAAAAHAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASW52YWxpZCBjaGFyIGluIHVybCBxdWVyeQBTcGFuIGNhbGxiYWNrIGVycm9yIGluIG9uX2JvZHkAQ29udGVudC1MZW5ndGggb3ZlcmZsb3cAQ2h1bmsgc2l6ZSBvdmVyZmxvdwBSZXNwb25zZSBvdmVyZmxvdwBJbnZhbGlkIG1ldGhvZCBmb3IgSFRUUC94LnggcmVxdWVzdABJbnZhbGlkIG1ldGhvZCBmb3IgUlRTUC94LnggcmVxdWVzdABFeHBlY3RlZCBTT1VSQ0UgbWV0aG9kIGZvciBJQ0UveC54IHJlcXVlc3QASW52YWxpZCBjaGFyIGluIHVybCBmcmFnbWVudCBzdGFydABFeHBlY3RlZCBkb3QAU3BhbiBjYWxsYmFjayBlcnJvciBpbiBvbl9zdGF0dXMASW52YWxpZCByZXNwb25zZSBzdGF0dXMASW52YWxpZCBjaGFyYWN0ZXIgaW4gY2h1bmsgZXh0ZW5zaW9ucwBVc2VyIGNhbGxiYWNrIGVycm9yAGBvbl9yZXNldGAgY2FsbGJhY2sgZXJyb3IAYG9uX2NodW5rX2hlYWRlcmAgY2FsbGJhY2sgZXJyb3IAYG9uX21lc3NhZ2VfYmVnaW5gIGNhbGxiYWNrIGVycm9yAGBvbl9jaHVua19leHRlbnNpb25fdmFsdWVgIGNhbGxiYWNrIGVycm9yAGBvbl9zdGF0dXNfY29tcGxldGVgIGNhbGxiYWNrIGVycm9yAGBvbl92ZXJzaW9uX2NvbXBsZXRlYCBjYWxsYmFjayBlcnJvcgBgb25fdXJsX2NvbXBsZXRlYCBjYWxsYmFjayBlcnJvcgBgb25fY2h1bmtfY29tcGxldGVgIGNhbGxiYWNrIGVycm9yAGBvbl9oZWFkZXJfdmFsdWVfY29tcGxldGVgIGNhbGxiYWNrIGVycm9yAGBvbl9tZXNzYWdlX2NvbXBsZXRlYCBjYWxsYmFjayBlcnJvcgBgb25fbWV0aG9kX2NvbXBsZXRlYCBjYWxsYmFjayBlcnJvcgBgb25faGVhZGVyX2ZpZWxkX2NvbXBsZXRlYCBjYWxsYmFjayBlcnJvcgBgb25fY2h1bmtfZXh0ZW5zaW9uX25hbWVgIGNhbGxiYWNrIGVycm9yAFVuZXhwZWN0ZWQgY2hhciBpbiB1cmwgc2VydmVyAEludmFsaWQgaGVhZGVyIHZhbHVlIGNoYXIASW52YWxpZCBoZWFkZXIgZmllbGQgY2hhcgBTcGFuIGNhbGxiYWNrIGVycm9yIGluIG9uX3ZlcnNpb24ASW52YWxpZCBtaW5vciB2ZXJzaW9uAEludmFsaWQgbWFqb3IgdmVyc2lvbgBFeHBlY3RlZCBzcGFjZSBhZnRlciB2ZXJzaW9uAEV4cGVjdGVkIENSTEYgYWZ0ZXIgdmVyc2lvbgBJbnZhbGlkIEhUVFAgdmVyc2lvbgBJbnZhbGlkIGhlYWRlciB0b2tlbgBTcGFuIGNhbGxiYWNrIGVycm9yIGluIG9uX3VybABJbnZhbGlkIGNoYXJhY3RlcnMgaW4gdXJsAFVuZXhwZWN0ZWQgc3RhcnQgY2hhciBpbiB1cmwARG91YmxlIEAgaW4gdXJsAEVtcHR5IENvbnRlbnQtTGVuZ3RoAEludmFsaWQgY2hhcmFjdGVyIGluIENvbnRlbnQtTGVuZ3RoAER1cGxpY2F0ZSBDb250ZW50LUxlbmd0aABJbnZhbGlkIGNoYXIgaW4gdXJsIHBhdGgAQ29udGVudC1MZW5ndGggY2FuJ3QgYmUgcHJlc2VudCB3aXRoIFRyYW5zZmVyLUVuY29kaW5nAEludmFsaWQgY2hhcmFjdGVyIGluIGNodW5rIHNpemUAU3BhbiBjYWxsYmFjayBlcnJvciBpbiBvbl9oZWFkZXJfdmFsdWUAU3BhbiBjYWxsYmFjayBlcnJvciBpbiBvbl9jaHVua19leHRlbnNpb25fdmFsdWUASW52YWxpZCBjaGFyYWN0ZXIgaW4gY2h1bmsgZXh0ZW5zaW9ucyB2YWx1ZQBNaXNzaW5nIGV4cGVjdGVkIExGIGFmdGVyIGhlYWRlciB2YWx1ZQBJbnZhbGlkIGBUcmFuc2Zlci1FbmNvZGluZ2AgaGVhZGVyIHZhbHVlAEludmFsaWQgY2hhcmFjdGVyIGluIGNodW5rIGV4dGVuc2lvbnMgcXVvdGUgdmFsdWUASW52YWxpZCBjaGFyYWN0ZXIgaW4gY2h1bmsgZXh0ZW5zaW9ucyBxdW90ZWQgdmFsdWUAUGF1c2VkIGJ5IG9uX2hlYWRlcnNfY29tcGxldGUASW52YWxpZCBFT0Ygc3RhdGUAb25fcmVzZXQgcGF1c2UAb25fY2h1bmtfaGVhZGVyIHBhdXNlAG9uX21lc3NhZ2VfYmVnaW4gcGF1c2UAb25fY2h1bmtfZXh0ZW5zaW9uX3ZhbHVlIHBhdXNlAG9uX3N0YXR1c19jb21wbGV0ZSBwYXVzZQBvbl92ZXJzaW9uX2NvbXBsZXRlIHBhdXNlAG9uX3VybF9jb21wbGV0ZSBwYXVzZQBvbl9jaHVua19jb21wbGV0ZSBwYXVzZQBvbl9oZWFkZXJfdmFsdWVfY29tcGxldGUgcGF1c2UAb25fbWVzc2FnZV9jb21wbGV0ZSBwYXVzZQBvbl9tZXRob2RfY29tcGxldGUgcGF1c2UAb25faGVhZGVyX2ZpZWxkX2NvbXBsZXRlIHBhdXNlAG9uX2NodW5rX2V4dGVuc2lvbl9uYW1lIHBhdXNlAFVuZXhwZWN0ZWQgc3BhY2UgYWZ0ZXIgc3RhcnQgbGluZQBTcGFuIGNhbGxiYWNrIGVycm9yIGluIG9uX2NodW5rX2V4dGVuc2lvbl9uYW1lAEludmFsaWQgY2hhcmFjdGVyIGluIGNodW5rIGV4dGVuc2lvbnMgbmFtZQBQYXVzZSBvbiBDT05ORUNUL1VwZ3JhZGUAUGF1c2Ugb24gUFJJL1VwZ3JhZGUARXhwZWN0ZWQgSFRUUC8yIENvbm5lY3Rpb24gUHJlZmFjZQBTcGFuIGNhbGxiYWNrIGVycm9yIGluIG9uX21ldGhvZABFeHBlY3RlZCBzcGFjZSBhZnRlciBtZXRob2QAU3BhbiBjYWxsYmFjayBlcnJvciBpbiBvbl9oZWFkZXJfZmllbGQAUGF1c2VkAEludmFsaWQgd29yZCBlbmNvdW50ZXJlZABJbnZhbGlkIG1ldGhvZCBlbmNvdW50ZXJlZABVbmV4cGVjdGVkIGNoYXIgaW4gdXJsIHNjaGVtYQBSZXF1ZXN0IGhhcyBpbnZhbGlkIGBUcmFuc2Zlci1FbmNvZGluZ2AAU1dJVENIX1BST1hZAFVTRV9QUk9YWQBNS0FDVElWSVRZAFVOUFJPQ0VTU0FCTEVfRU5USVRZAENPUFkATU9WRURfUEVSTUFORU5UTFkAVE9PX0VBUkxZAE5PVElGWQBGQUlMRURfREVQRU5ERU5DWQBCQURfR0FURVdBWQBQTEFZAFBVVABDSEVDS09VVABHQVRFV0FZX1RJTUVPVVQAUkVRVUVTVF9USU1FT1VUAE5FVFdPUktfQ09OTkVDVF9USU1FT1VUAENPTk5FQ1RJT05fVElNRU9VVABMT0dJTl9USU1FT1VUAE5FVFdPUktfUkVBRF9USU1FT1VUAFBPU1QATUlTRElSRUNURURfUkVRVUVTVABDTElFTlRfQ0xPU0VEX1JFUVVFU1QAQ0xJRU5UX0NMT1NFRF9MT0FEX0JBTEFOQ0VEX1JFUVVFU1QAQkFEX1JFUVVFU1QASFRUUF9SRVFVRVNUX1NFTlRfVE9fSFRUUFNfUE9SVABSRVBPUlQASU1fQV9URUFQT1QAUkVTRVRfQ09OVEVOVABOT19DT05URU5UAFBBUlRJQUxfQ09OVEVOVABIUEVfSU5WQUxJRF9DT05TVEFOVABIUEVfQ0JfUkVTRVQAR0VUAEhQRV9TVFJJQ1QAQ09ORkxJQ1QAVEVNUE9SQVJZX1JFRElSRUNUAFBFUk1BTkVOVF9SRURJUkVDVABDT05ORUNUAE1VTFRJX1NUQVRVUwBIUEVfSU5WQUxJRF9TVEFUVVMAVE9PX01BTllfUkVRVUVTVFMARUFSTFlfSElOVFMAVU5BVkFJTEFCTEVfRk9SX0xFR0FMX1JFQVNPTlMAT1BUSU9OUwBTV0lUQ0hJTkdfUFJPVE9DT0xTAFZBUklBTlRfQUxTT19ORUdPVElBVEVTAE1VTFRJUExFX0NIT0lDRVMASU5URVJOQUxfU0VSVkVSX0VSUk9SAFdFQl9TRVJWRVJfVU5LTk9XTl9FUlJPUgBSQUlMR1VOX0VSUk9SAElERU5USVRZX1BST1ZJREVSX0FVVEhFTlRJQ0FUSU9OX0VSUk9SAFNTTF9DRVJUSUZJQ0FURV9FUlJPUgBJTlZBTElEX1hfRk9SV0FSREVEX0ZPUgBTRVRfUEFSQU1FVEVSAEdFVF9QQVJBTUVURVIASFBFX1VTRVIAU0VFX09USEVSAEhQRV9DQl9DSFVOS19IRUFERVIATUtDQUxFTkRBUgBTRVRVUABXRUJfU0VSVkVSX0lTX0RPV04AVEVBUkRPV04ASFBFX0NMT1NFRF9DT05ORUNUSU9OAEhFVVJJU1RJQ19FWFBJUkFUSU9OAERJU0NPTk5FQ1RFRF9PUEVSQVRJT04ATk9OX0FVVEhPUklUQVRJVkVfSU5GT1JNQVRJT04ASFBFX0lOVkFMSURfVkVSU0lPTgBIUEVfQ0JfTUVTU0FHRV9CRUdJTgBTSVRFX0lTX0ZST1pFTgBIUEVfSU5WQUxJRF9IRUFERVJfVE9LRU4ASU5WQUxJRF9UT0tFTgBGT1JCSURERU4ARU5IQU5DRV9ZT1VSX0NBTE0ASFBFX0lOVkFMSURfVVJMAEJMT0NLRURfQllfUEFSRU5UQUxfQ09OVFJPTABNS0NPTABBQ0wASFBFX0lOVEVSTkFMAFJFUVVFU1RfSEVBREVSX0ZJRUxEU19UT09fTEFSR0VfVU5PRkZJQ0lBTABIUEVfT0sAVU5MSU5LAFVOTE9DSwBQUkkAUkVUUllfV0lUSABIUEVfSU5WQUxJRF9DT05URU5UX0xFTkdUSABIUEVfVU5FWFBFQ1RFRF9DT05URU5UX0xFTkdUSABGTFVTSABQUk9QUEFUQ0gATS1TRUFSQ0gAVVJJX1RPT19MT05HAFBST0NFU1NJTkcATUlTQ0VMTEFORU9VU19QRVJTSVNURU5UX1dBUk5JTkcATUlTQ0VMTEFORU9VU19XQVJOSU5HAEhQRV9JTlZBTElEX1RSQU5TRkVSX0VOQ09ESU5HAEV4cGVjdGVkIENSTEYASFBFX0lOVkFMSURfQ0hVTktfU0laRQBNT1ZFAENPTlRJTlVFAEhQRV9DQl9TVEFUVVNfQ09NUExFVEUASFBFX0NCX0hFQURFUlNfQ09NUExFVEUASFBFX0NCX1ZFUlNJT05fQ09NUExFVEUASFBFX0NCX1VSTF9DT01QTEVURQBIUEVfQ0JfQ0hVTktfQ09NUExFVEUASFBFX0NCX0hFQURFUl9WQUxVRV9DT01QTEVURQBIUEVfQ0JfQ0hVTktfRVhURU5TSU9OX1ZBTFVFX0NPTVBMRVRFAEhQRV9DQl9DSFVOS19FWFRFTlNJT05fTkFNRV9DT01QTEVURQBIUEVfQ0JfTUVTU0FHRV9DT01QTEVURQBIUEVfQ0JfTUVUSE9EX0NPTVBMRVRFAEhQRV9DQl9IRUFERVJfRklFTERfQ09NUExFVEUAREVMRVRFAEhQRV9JTlZBTElEX0VPRl9TVEFURQBJTlZBTElEX1NTTF9DRVJUSUZJQ0FURQBQQVVTRQBOT19SRVNQT05TRQBVTlNVUFBPUlRFRF9NRURJQV9UWVBFAEdPTkUATk9UX0FDQ0VQVEFCTEUAU0VSVklDRV9VTkFWQUlMQUJMRQBSQU5HRV9OT1RfU0FUSVNGSUFCTEUAT1JJR0lOX0lTX1VOUkVBQ0hBQkxFAFJFU1BPTlNFX0lTX1NUQUxFAFBVUkdFAE1FUkdFAFJFUVVFU1RfSEVBREVSX0ZJRUxEU19UT09fTEFSR0UAUkVRVUVTVF9IRUFERVJfVE9PX0xBUkdFAFBBWUxPQURfVE9PX0xBUkdFAElOU1VGRklDSUVOVF9TVE9SQUdFAEhQRV9QQVVTRURfVVBHUkFERQBIUEVfUEFVU0VEX0gyX1VQR1JBREUAU09VUkNFAEFOTk9VTkNFAFRSQUNFAEhQRV9VTkVYUEVDVEVEX1NQQUNFAERFU0NSSUJFAFVOU1VCU0NSSUJFAFJFQ09SRABIUEVfSU5WQUxJRF9NRVRIT0QATk9UX0ZPVU5EAFBST1BGSU5EAFVOQklORABSRUJJTkQAVU5BVVRIT1JJWkVEAE1FVEhPRF9OT1RfQUxMT1dFRABIVFRQX1ZFUlNJT05fTk9UX1NVUFBPUlRFRABBTFJFQURZX1JFUE9SVEVEAEFDQ0VQVEVEAE5PVF9JTVBMRU1FTlRFRABMT09QX0RFVEVDVEVEAEhQRV9DUl9FWFBFQ1RFRABIUEVfTEZfRVhQRUNURUQAQ1JFQVRFRABJTV9VU0VEAEhQRV9QQVVTRUQAVElNRU9VVF9PQ0NVUkVEAFBBWU1FTlRfUkVRVUlSRUQAUFJFQ09ORElUSU9OX1JFUVVJUkVEAFBST1hZX0FVVEhFTlRJQ0FUSU9OX1JFUVVJUkVEAE5FVFdPUktfQVVUSEVOVElDQVRJT05fUkVRVUlSRUQATEVOR1RIX1JFUVVJUkVEAFNTTF9DRVJUSUZJQ0FURV9SRVFVSVJFRABVUEdSQURFX1JFUVVJUkVEAFBBR0VfRVhQSVJFRABQUkVDT05ESVRJT05fRkFJTEVEAEVYUEVDVEFUSU9OX0ZBSUxFRABSRVZBTElEQVRJT05fRkFJTEVEAFNTTF9IQU5EU0hBS0VfRkFJTEVEAExPQ0tFRABUUkFOU0ZPUk1BVElPTl9BUFBMSUVEAE5PVF9NT0RJRklFRABOT1RfRVhURU5ERUQAQkFORFdJRFRIX0xJTUlUX0VYQ0VFREVEAFNJVEVfSVNfT1ZFUkxPQURFRABIRUFEAEV4cGVjdGVkIEhUVFAvAABeEwAAJhMAADAQAADwFwAAnRMAABUSAAA5FwAA8BIAAAoQAAB1EgAArRIAAIITAABPFAAAfxAAAKAVAAAjFAAAiRIAAIsUAABNFQAA1BEAAM8UAAAQGAAAyRYAANwWAADBEQAA4BcAALsUAAB0FAAAfBUAAOUUAAAIFwAAHxAAAGUVAACjFAAAKBUAAAIVAACZFQAALBAAAIsZAABPDwAA1A4AAGoQAADOEAAAAhcAAIkOAABuEwAAHBMAAGYUAABWFwAAwRMAAM0TAABsEwAAaBcAAGYXAABfFwAAIhMAAM4PAABpDgAA2A4AAGMWAADLEwAAqg4AACgXAAAmFwAAxRMAAF0WAADoEQAAZxMAAGUTAADyFgAAcxMAAB0XAAD5FgAA8xEAAM8OAADOFQAADBIAALMRAAClEQAAYRAAADIXAAC7EwAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAgEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgMCAgICAgAAAgIAAgIAAgICAgICAgICAgAEAAAAAAACAgICAgICAgICAgICAgICAgICAgICAgICAgAAAAICAgICAgICAgICAgICAgICAgICAgICAgICAgICAAIAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAgICAgIAAAICAAICAAICAgICAgICAgIAAwAEAAAAAgICAgICAgICAgICAgICAgICAgICAgICAgIAAAACAgICAgICAgICAgICAgICAgICAgICAgICAgICAgACAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABsb3NlZWVwLWFsaXZlAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAQEBAQEBAQEBAgEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQFjaHVua2VkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQABAQEBAQAAAQEAAQEAAQEBAQEBAQEBAQAAAAAAAAABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQAAAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGVjdGlvbmVudC1sZW5ndGhvbnJveHktY29ubmVjdGlvbgAAAAAAAAAAAAAAAAAAAHJhbnNmZXItZW5jb2RpbmdwZ3JhZGUNCg0KDQpTTQ0KDQpUVFAvQ0UvVFNQLwAAAAAAAAAAAAAAAAECAAEDAAAAAAAAAAAAAAAAAAAAAAAABAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAAAAAAAAAAABAgABAwAAAAAAAAAAAAAAAAAAAAAAAAQBAQUBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAAAAAAAAAAAAQAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQAAAAAAAAAAAAABAAACAAAAAAAAAAAAAAAAAAAAAAAAAwQAAAQEBAQEBAQEBAQEBQQEBAQEBAQEBAQEBAAEAAYHBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAQABAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAQAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAAAAAAAAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAgAAAAACAAAAAAAAAAAAAAAAAAAAAAADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwAAAAAAAAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE5PVU5DRUVDS09VVE5FQ1RFVEVDUklCRUxVU0hFVEVBRFNFQVJDSFJHRUNUSVZJVFlMRU5EQVJWRU9USUZZUFRJT05TQ0hTRUFZU1RBVENIR0VPUkRJUkVDVE9SVFJDSFBBUkFNRVRFUlVSQ0VCU0NSSUJFQVJET1dOQUNFSU5ETktDS1VCU0NSSUJFSFRUUC9BRFRQLw==' - return result -} -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -const parseComparator = (comp, options) => { - debug('comp', comp, options) - comp = replaceCarets(comp, options) - debug('caret', comp) - comp = replaceTildes(comp, options) - debug('tildes', comp) - comp = replaceXRanges(comp, options) - debug('xrange', comp) - comp = replaceStars(comp, options) - debug('stars', comp) - return comp +/***/ }), + +/***/ 1891: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.enumToMap = void 0; +function enumToMap(obj) { + const res = {}; + Object.keys(obj).forEach((key) => { + const value = obj[key]; + if (typeof value === 'number') { + res[key] = value; + } + }); + return res; } +exports.enumToMap = enumToMap; +//# sourceMappingURL=utils.js.map -const isX = id => !id || id.toLowerCase() === 'x' || id === '*' +/***/ }), -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 -// ~0.0.1 --> >=0.0.1 <0.1.0-0 -const replaceTildes = (comp, options) => { - return comp - .trim() - .split(/\s+/) - .map((c) => replaceTilde(c, options)) - .join(' ') +/***/ 6771: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { kClients } = __nccwpck_require__(2785) +const Agent = __nccwpck_require__(7890) +const { + kAgent, + kMockAgentSet, + kMockAgentGet, + kDispatches, + kIsMockActive, + kNetConnect, + kGetNetConnect, + kOptions, + kFactory +} = __nccwpck_require__(4347) +const MockClient = __nccwpck_require__(8687) +const MockPool = __nccwpck_require__(6193) +const { matchValue, buildMockOptions } = __nccwpck_require__(9323) +const { InvalidArgumentError, UndiciError } = __nccwpck_require__(8045) +const Dispatcher = __nccwpck_require__(412) +const Pluralizer = __nccwpck_require__(8891) +const PendingInterceptorsFormatter = __nccwpck_require__(6823) + +class FakeWeakRef { + constructor (value) { + this.value = value + } + + deref () { + return this.value + } } -const replaceTilde = (comp, options) => { - const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] - return comp.replace(r, (_, M, m, p, pr) => { - debug('tilde', comp, _, M, m, p, pr) - let ret +class MockAgent extends Dispatcher { + constructor (opts) { + super(opts) - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = `>=${M}.0.0 <${+M + 1}.0.0-0` - } else if (isX(p)) { - // ~1.2 == >=1.2.0 <1.3.0-0 - ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` - } else if (pr) { - debug('replaceTilde pr', pr) - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${+m + 1}.0-0` - } else { - // ~1.2.3 == >=1.2.3 <1.3.0-0 - ret = `>=${M}.${m}.${p - } <${M}.${+m + 1}.0-0` + this[kNetConnect] = true + this[kIsMockActive] = true + + // Instantiate Agent and encapsulate + if ((opts && opts.agent && typeof opts.agent.dispatch !== 'function')) { + throw new InvalidArgumentError('Argument opts.agent must implement Agent') } + const agent = opts && opts.agent ? opts.agent : new Agent(opts) + this[kAgent] = agent - debug('tilde return', ret) - return ret - }) -} + this[kClients] = agent[kClients] + this[kOptions] = buildMockOptions(opts) + } -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 -// ^1.2.3 --> >=1.2.3 <2.0.0-0 -// ^1.2.0 --> >=1.2.0 <2.0.0-0 -// ^0.0.1 --> >=0.0.1 <0.0.2-0 -// ^0.1.0 --> >=0.1.0 <0.2.0-0 -const replaceCarets = (comp, options) => { - return comp - .trim() - .split(/\s+/) - .map((c) => replaceCaret(c, options)) - .join(' ') -} + get (origin) { + let dispatcher = this[kMockAgentGet](origin) -const replaceCaret = (comp, options) => { - debug('caret', comp, options) - const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] - const z = options.includePrerelease ? '-0' : '' - return comp.replace(r, (_, M, m, p, pr) => { - debug('caret', comp, _, M, m, p, pr) - let ret + if (!dispatcher) { + dispatcher = this[kFactory](origin) + this[kMockAgentSet](origin, dispatcher) + } + return dispatcher + } - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` - } else if (isX(p)) { - if (M === '0') { - ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` - } else { - ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` - } - } else if (pr) { - debug('replaceCaret pr', pr) - if (M === '0') { - if (m === '0') { - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${m}.${+p + 1}-0` - } else { - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${+m + 1}.0-0` - } - } else { - ret = `>=${M}.${m}.${p}-${pr - } <${+M + 1}.0.0-0` - } - } else { - debug('no pr') - if (M === '0') { - if (m === '0') { - ret = `>=${M}.${m}.${p - }${z} <${M}.${m}.${+p + 1}-0` - } else { - ret = `>=${M}.${m}.${p - }${z} <${M}.${+m + 1}.0-0` - } + dispatch (opts, handler) { + // Call MockAgent.get to perform additional setup before dispatching as normal + this.get(opts.origin) + return this[kAgent].dispatch(opts, handler) + } + + async close () { + await this[kAgent].close() + this[kClients].clear() + } + + deactivate () { + this[kIsMockActive] = false + } + + activate () { + this[kIsMockActive] = true + } + + enableNetConnect (matcher) { + if (typeof matcher === 'string' || typeof matcher === 'function' || matcher instanceof RegExp) { + if (Array.isArray(this[kNetConnect])) { + this[kNetConnect].push(matcher) } else { - ret = `>=${M}.${m}.${p - } <${+M + 1}.0.0-0` + this[kNetConnect] = [matcher] } + } else if (typeof matcher === 'undefined') { + this[kNetConnect] = true + } else { + throw new InvalidArgumentError('Unsupported matcher. Must be one of String|Function|RegExp.') } + } - debug('caret return', ret) - return ret - }) -} + disableNetConnect () { + this[kNetConnect] = false + } -const replaceXRanges = (comp, options) => { - debug('replaceXRanges', comp, options) - return comp - .split(/\s+/) - .map((c) => replaceXRange(c, options)) - .join(' ') -} + // This is required to bypass issues caused by using global symbols - see: + // https://github.com/nodejs/undici/issues/1447 + get isMockActive () { + return this[kIsMockActive] + } -const replaceXRange = (comp, options) => { - comp = comp.trim() - const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] - return comp.replace(r, (ret, gtlt, M, m, p, pr) => { - debug('xRange', comp, ret, gtlt, M, m, p, pr) - const xM = isX(M) - const xm = xM || isX(m) - const xp = xm || isX(p) - const anyX = xp + [kMockAgentSet] (origin, dispatcher) { + this[kClients].set(origin, new FakeWeakRef(dispatcher)) + } - if (gtlt === '=' && anyX) { - gtlt = '' + [kFactory] (origin) { + const mockOptions = Object.assign({ agent: this }, this[kOptions]) + return this[kOptions] && this[kOptions].connections === 1 + ? new MockClient(origin, mockOptions) + : new MockPool(origin, mockOptions) + } + + [kMockAgentGet] (origin) { + // First check if we can immediately find it + const ref = this[kClients].get(origin) + if (ref) { + return ref.deref() } - // if we're including prereleases in the match, then we need - // to fix this to -0, the lowest possible prerelease value - pr = options.includePrerelease ? '-0' : '' + // If the origin is not a string create a dummy parent pool and return to user + if (typeof origin !== 'string') { + const dispatcher = this[kFactory]('http://localhost:9999') + this[kMockAgentSet](origin, dispatcher) + return dispatcher + } - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0-0' - } else { - // nothing is forbidden - ret = '*' - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0 + // If we match, create a pool and assign the same dispatches + for (const [keyMatcher, nonExplicitRef] of Array.from(this[kClients])) { + const nonExplicitDispatcher = nonExplicitRef.deref() + if (nonExplicitDispatcher && typeof keyMatcher !== 'string' && matchValue(keyMatcher, origin)) { + const dispatcher = this[kFactory](origin) + this[kMockAgentSet](origin, dispatcher) + dispatcher[kDispatches] = nonExplicitDispatcher[kDispatches] + return dispatcher } - p = 0 + } + } - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - gtlt = '>=' - if (xm) { - M = +M + 1 - m = 0 - p = 0 - } else { - m = +m + 1 - p = 0 - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<' - if (xm) { - M = +M + 1 - } else { - m = +m + 1 - } - } + [kGetNetConnect] () { + return this[kNetConnect] + } - if (gtlt === '<') { - pr = '-0' - } + pendingInterceptors () { + const mockAgentClients = this[kClients] - ret = `${gtlt + M}.${m}.${p}${pr}` - } else if (xm) { - ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` - } else if (xp) { - ret = `>=${M}.${m}.0${pr - } <${M}.${+m + 1}.0-0` + return Array.from(mockAgentClients.entries()) + .flatMap(([origin, scope]) => scope.deref()[kDispatches].map(dispatch => ({ ...dispatch, origin }))) + .filter(({ pending }) => pending) + } + + assertNoPendingInterceptors ({ pendingInterceptorsFormatter = new PendingInterceptorsFormatter() } = {}) { + const pending = this.pendingInterceptors() + + if (pending.length === 0) { + return } - debug('xRange return', ret) + const pluralizer = new Pluralizer('interceptor', 'interceptors').pluralize(pending.length) - return ret - }) -} + throw new UndiciError(` +${pluralizer.count} ${pluralizer.noun} ${pluralizer.is} pending: -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -const replaceStars = (comp, options) => { - debug('replaceStars', comp, options) - // Looseness is ignored here. star is always as loose as it gets! - return comp - .trim() - .replace(re[t.STAR], '') +${pendingInterceptorsFormatter.format(pending)} +`.trim()) + } } -const replaceGTE0 = (comp, options) => { - debug('replaceGTE0', comp, options) - return comp - .trim() - .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') -} +module.exports = MockAgent -// This function is passed to string.replace(re[t.HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 -const hyphenReplace = incPr => ($0, - from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr, tb) => { - if (isX(fM)) { - from = '' - } else if (isX(fm)) { - from = `>=${fM}.0.0${incPr ? '-0' : ''}` - } else if (isX(fp)) { - from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` - } else if (fpr) { - from = `>=${from}` - } else { - from = `>=${from}${incPr ? '-0' : ''}` + +/***/ }), + +/***/ 8687: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { promisify } = __nccwpck_require__(3837) +const Client = __nccwpck_require__(3598) +const { buildMockDispatch } = __nccwpck_require__(9323) +const { + kDispatches, + kMockAgent, + kClose, + kOriginalClose, + kOrigin, + kOriginalDispatch, + kConnected +} = __nccwpck_require__(4347) +const { MockInterceptor } = __nccwpck_require__(410) +const Symbols = __nccwpck_require__(2785) +const { InvalidArgumentError } = __nccwpck_require__(8045) + +/** + * MockClient provides an API that extends the Client to influence the mockDispatches. + */ +class MockClient extends Client { + constructor (origin, opts) { + super(origin, opts) + + if (!opts || !opts.agent || typeof opts.agent.dispatch !== 'function') { + throw new InvalidArgumentError('Argument opts.agent must implement Agent') + } + + this[kMockAgent] = opts.agent + this[kOrigin] = origin + this[kDispatches] = [] + this[kConnected] = 1 + this[kOriginalDispatch] = this.dispatch + this[kOriginalClose] = this.close.bind(this) + + this.dispatch = buildMockDispatch.call(this) + this.close = this[kClose] } - if (isX(tM)) { - to = '' - } else if (isX(tm)) { - to = `<${+tM + 1}.0.0-0` - } else if (isX(tp)) { - to = `<${tM}.${+tm + 1}.0-0` - } else if (tpr) { - to = `<=${tM}.${tm}.${tp}-${tpr}` - } else if (incPr) { - to = `<${tM}.${tm}.${+tp + 1}-0` - } else { - to = `<=${to}` + get [Symbols.kConnected] () { + return this[kConnected] } - return `${from} ${to}`.trim() -} + /** + * Sets up the base interceptor for mocking replies from undici. + */ + intercept (opts) { + return new MockInterceptor(opts, this[kDispatches]) + } -const testSet = (set, version, options) => { - for (let i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false - } + async [kClose] () { + await promisify(this[kOriginalClose])() + this[kConnected] = 0 + this[kMockAgent][Symbols.kClients].delete(this[kOrigin]) } +} - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (let i = 0; i < set.length; i++) { - debug(set[i].semver) - if (set[i].semver === Comparator.ANY) { - continue - } +module.exports = MockClient - if (set[i].semver.prerelease.length > 0) { - const allowed = set[i].semver - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) { - return true - } - } - } - // Version has a -pre, but it's not one of the ones we like. - return false +/***/ }), + +/***/ 888: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { UndiciError } = __nccwpck_require__(8045) + +class MockNotMatchedError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, MockNotMatchedError) + this.name = 'MockNotMatchedError' + this.message = message || 'The request does not match any registered mock dispatches' + this.code = 'UND_MOCK_ERR_MOCK_NOT_MATCHED' } +} - return true +module.exports = { + MockNotMatchedError } /***/ }), -/***/ 8088: +/***/ 410: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const debug = __nccwpck_require__(106) -const { MAX_LENGTH, MAX_SAFE_INTEGER } = __nccwpck_require__(2293) -const { safeRe: re, t } = __nccwpck_require__(9523) +"use strict"; -const parseOptions = __nccwpck_require__(785) -const { compareIdentifiers } = __nccwpck_require__(2463) -class SemVer { - constructor (version, options) { - options = parseOptions(options) - if (version instanceof SemVer) { - if (version.loose === !!options.loose && - version.includePrerelease === !!options.includePrerelease) { - return version +const { getResponseData, buildKey, addMockDispatch } = __nccwpck_require__(9323) +const { + kDispatches, + kDispatchKey, + kDefaultHeaders, + kDefaultTrailers, + kContentLength, + kMockDispatch +} = __nccwpck_require__(4347) +const { InvalidArgumentError } = __nccwpck_require__(8045) +const { buildURL } = __nccwpck_require__(3983) + +/** + * Defines the scope API for an interceptor reply + */ +class MockScope { + constructor (mockDispatch) { + this[kMockDispatch] = mockDispatch + } + + /** + * Delay a reply by a set amount in ms. + */ + delay (waitInMs) { + if (typeof waitInMs !== 'number' || !Number.isInteger(waitInMs) || waitInMs <= 0) { + throw new InvalidArgumentError('waitInMs must be a valid integer > 0') + } + + this[kMockDispatch].delay = waitInMs + return this + } + + /** + * For a defined reply, never mark as consumed. + */ + persist () { + this[kMockDispatch].persist = true + return this + } + + /** + * Allow one to define a reply for a set amount of matching requests. + */ + times (repeatTimes) { + if (typeof repeatTimes !== 'number' || !Number.isInteger(repeatTimes) || repeatTimes <= 0) { + throw new InvalidArgumentError('repeatTimes must be a valid integer > 0') + } + + this[kMockDispatch].times = repeatTimes + return this + } +} + +/** + * Defines an interceptor for a Mock + */ +class MockInterceptor { + constructor (opts, mockDispatches) { + if (typeof opts !== 'object') { + throw new InvalidArgumentError('opts must be an object') + } + if (typeof opts.path === 'undefined') { + throw new InvalidArgumentError('opts.path must be defined') + } + if (typeof opts.method === 'undefined') { + opts.method = 'GET' + } + // See https://github.com/nodejs/undici/issues/1245 + // As per RFC 3986, clients are not supposed to send URI + // fragments to servers when they retrieve a document, + if (typeof opts.path === 'string') { + if (opts.query) { + opts.path = buildURL(opts.path, opts.query) } else { - version = version.version + // Matches https://github.com/nodejs/undici/blob/main/lib/fetch/index.js#L1811 + const parsedURL = new URL(opts.path, 'data://') + opts.path = parsedURL.pathname + parsedURL.search } - } else if (typeof version !== 'string') { - throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`) } - - if (version.length > MAX_LENGTH) { - throw new TypeError( - `version is longer than ${MAX_LENGTH} characters` - ) + if (typeof opts.method === 'string') { + opts.method = opts.method.toUpperCase() } - debug('SemVer', version, options) - this.options = options - this.loose = !!options.loose - // this isn't actually relevant for versions, but keep it so that we - // don't run into trouble passing this.options around. - this.includePrerelease = !!options.includePrerelease + this[kDispatchKey] = buildKey(opts) + this[kDispatches] = mockDispatches + this[kDefaultHeaders] = {} + this[kDefaultTrailers] = {} + this[kContentLength] = false + } - const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + createMockScopeDispatchData (statusCode, data, responseOptions = {}) { + const responseData = getResponseData(data) + const contentLength = this[kContentLength] ? { 'content-length': responseData.length } : {} + const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers } + const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers } - if (!m) { - throw new TypeError(`Invalid Version: ${version}`) + return { statusCode, data, headers, trailers } + } + + validateReplyParameters (statusCode, data, responseOptions) { + if (typeof statusCode === 'undefined') { + throw new InvalidArgumentError('statusCode must be defined') + } + if (typeof data === 'undefined') { + throw new InvalidArgumentError('data must be defined') + } + if (typeof responseOptions !== 'object') { + throw new InvalidArgumentError('responseOptions must be an object') } + } - this.raw = version + /** + * Mock an undici request with a defined reply. + */ + reply (replyData) { + // Values of reply aren't available right now as they + // can only be available when the reply callback is invoked. + if (typeof replyData === 'function') { + // We'll first wrap the provided callback in another function, + // this function will properly resolve the data from the callback + // when invoked. + const wrappedDefaultsCallback = (opts) => { + // Our reply options callback contains the parameter for statusCode, data and options. + const resolvedData = replyData(opts) - // these are actually numbers - this.major = +m[1] - this.minor = +m[2] - this.patch = +m[3] + // Check if it is in the right format + if (typeof resolvedData !== 'object') { + throw new InvalidArgumentError('reply options callback must return an object') + } - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError('Invalid major version') - } + const { statusCode, data = '', responseOptions = {} } = resolvedData + this.validateReplyParameters(statusCode, data, responseOptions) + // Since the values can be obtained immediately we return them + // from this higher order function that will be resolved later. + return { + ...this.createMockScopeDispatchData(statusCode, data, responseOptions) + } + } - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version') + // Add usual dispatch data, but this time set the data parameter to function that will eventually provide data. + const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], wrappedDefaultsCallback) + return new MockScope(newMockDispatch) } - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version') + // We can have either one or three parameters, if we get here, + // we should have 1-3 parameters. So we spread the arguments of + // this function to obtain the parameters, since replyData will always + // just be the statusCode. + const [statusCode, data = '', responseOptions = {}] = [...arguments] + this.validateReplyParameters(statusCode, data, responseOptions) + + // Send in-already provided data like usual + const dispatchData = this.createMockScopeDispatchData(statusCode, data, responseOptions) + const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], dispatchData) + return new MockScope(newMockDispatch) + } + + /** + * Mock an undici request with a defined error. + */ + replyWithError (error) { + if (typeof error === 'undefined') { + throw new InvalidArgumentError('error must be defined') } - // numberify any prerelease numeric ids - if (!m[4]) { - this.prerelease = [] - } else { - this.prerelease = m[4].split('.').map((id) => { - if (/^[0-9]+$/.test(id)) { - const num = +id - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num - } - } - return id - }) + const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], { error }) + return new MockScope(newMockDispatch) + } + + /** + * Set default reply headers on the interceptor for subsequent replies + */ + defaultReplyHeaders (headers) { + if (typeof headers === 'undefined') { + throw new InvalidArgumentError('headers must be defined') } - this.build = m[5] ? m[5].split('.') : [] - this.format() + this[kDefaultHeaders] = headers + return this } - format () { - this.version = `${this.major}.${this.minor}.${this.patch}` - if (this.prerelease.length) { - this.version += `-${this.prerelease.join('.')}` + /** + * Set default reply trailers on the interceptor for subsequent replies + */ + defaultReplyTrailers (trailers) { + if (typeof trailers === 'undefined') { + throw new InvalidArgumentError('trailers must be defined') } - return this.version + + this[kDefaultTrailers] = trailers + return this } - toString () { - return this.version + /** + * Set reply content length header for replies on the interceptor + */ + replyContentLength () { + this[kContentLength] = true + return this } +} - compare (other) { - debug('SemVer.compare', this.version, this.options, other) - if (!(other instanceof SemVer)) { - if (typeof other === 'string' && other === this.version) { - return 0 - } - other = new SemVer(other, this.options) - } +module.exports.MockInterceptor = MockInterceptor +module.exports.MockScope = MockScope - if (other.version === this.version) { - return 0 + +/***/ }), + +/***/ 6193: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { promisify } = __nccwpck_require__(3837) +const Pool = __nccwpck_require__(4634) +const { buildMockDispatch } = __nccwpck_require__(9323) +const { + kDispatches, + kMockAgent, + kClose, + kOriginalClose, + kOrigin, + kOriginalDispatch, + kConnected +} = __nccwpck_require__(4347) +const { MockInterceptor } = __nccwpck_require__(410) +const Symbols = __nccwpck_require__(2785) +const { InvalidArgumentError } = __nccwpck_require__(8045) + +/** + * MockPool provides an API that extends the Pool to influence the mockDispatches. + */ +class MockPool extends Pool { + constructor (origin, opts) { + super(origin, opts) + + if (!opts || !opts.agent || typeof opts.agent.dispatch !== 'function') { + throw new InvalidArgumentError('Argument opts.agent must implement Agent') } - return this.compareMain(other) || this.comparePre(other) + this[kMockAgent] = opts.agent + this[kOrigin] = origin + this[kDispatches] = [] + this[kConnected] = 1 + this[kOriginalDispatch] = this.dispatch + this[kOriginalClose] = this.close.bind(this) + + this.dispatch = buildMockDispatch.call(this) + this.close = this[kClose] } - compareMain (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) + get [Symbols.kConnected] () { + return this[kConnected] + } + + /** + * Sets up the base interceptor for mocking replies from undici. + */ + intercept (opts) { + return new MockInterceptor(opts, this[kDispatches]) + } + + async [kClose] () { + await promisify(this[kOriginalClose])() + this[kConnected] = 0 + this[kMockAgent][Symbols.kClients].delete(this[kOrigin]) + } +} + +module.exports = MockPool + + +/***/ }), + +/***/ 4347: +/***/ ((module) => { + +"use strict"; + + +module.exports = { + kAgent: Symbol('agent'), + kOptions: Symbol('options'), + kFactory: Symbol('factory'), + kDispatches: Symbol('dispatches'), + kDispatchKey: Symbol('dispatch key'), + kDefaultHeaders: Symbol('default headers'), + kDefaultTrailers: Symbol('default trailers'), + kContentLength: Symbol('content length'), + kMockAgent: Symbol('mock agent'), + kMockAgentSet: Symbol('mock agent set'), + kMockAgentGet: Symbol('mock agent get'), + kMockDispatch: Symbol('mock dispatch'), + kClose: Symbol('close'), + kOriginalClose: Symbol('original agent close'), + kOrigin: Symbol('origin'), + kIsMockActive: Symbol('is mock active'), + kNetConnect: Symbol('net connect'), + kGetNetConnect: Symbol('get net connect'), + kConnected: Symbol('connected') +} + + +/***/ }), + +/***/ 9323: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { MockNotMatchedError } = __nccwpck_require__(888) +const { + kDispatches, + kMockAgent, + kOriginalDispatch, + kOrigin, + kGetNetConnect +} = __nccwpck_require__(4347) +const { buildURL, nop } = __nccwpck_require__(3983) +const { STATUS_CODES } = __nccwpck_require__(3685) +const { + types: { + isPromise + } +} = __nccwpck_require__(3837) + +function matchValue (match, value) { + if (typeof match === 'string') { + return match === value + } + if (match instanceof RegExp) { + return match.test(value) + } + if (typeof match === 'function') { + return match(value) === true + } + return false +} + +function lowerCaseEntries (headers) { + return Object.fromEntries( + Object.entries(headers).map(([headerName, headerValue]) => { + return [headerName.toLocaleLowerCase(), headerValue] + }) + ) +} + +/** + * @param {import('../../index').Headers|string[]|Record} headers + * @param {string} key + */ +function getHeaderByName (headers, key) { + if (Array.isArray(headers)) { + for (let i = 0; i < headers.length; i += 2) { + if (headers[i].toLocaleLowerCase() === key.toLocaleLowerCase()) { + return headers[i + 1] + } } - return ( - compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch) - ) + return undefined + } else if (typeof headers.get === 'function') { + return headers.get(key) + } else { + return lowerCaseEntries(headers)[key.toLocaleLowerCase()] } +} - comparePre (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) +/** @param {string[]} headers */ +function buildHeadersFromArray (headers) { // fetch HeadersList + const clone = headers.slice() + const entries = [] + for (let index = 0; index < clone.length; index += 2) { + entries.push([clone[index], clone[index + 1]]) + } + return Object.fromEntries(entries) +} + +function matchHeaders (mockDispatch, headers) { + if (typeof mockDispatch.headers === 'function') { + if (Array.isArray(headers)) { // fetch HeadersList + headers = buildHeadersFromArray(headers) } + return mockDispatch.headers(headers ? lowerCaseEntries(headers) : {}) + } + if (typeof mockDispatch.headers === 'undefined') { + return true + } + if (typeof headers !== 'object' || typeof mockDispatch.headers !== 'object') { + return false + } - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) { - return -1 - } else if (!this.prerelease.length && other.prerelease.length) { - return 1 - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0 + for (const [matchHeaderName, matchHeaderValue] of Object.entries(mockDispatch.headers)) { + const headerValue = getHeaderByName(headers, matchHeaderName) + + if (!matchValue(matchHeaderValue, headerValue)) { + return false } + } + return true +} - let i = 0 - do { - const a = this.prerelease[i] - const b = other.prerelease[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) +function safeUrl (path) { + if (typeof path !== 'string') { + return path } - compareBuild (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } + const pathSegments = path.split('?') - let i = 0 - do { - const a = this.build[i] - const b = other.build[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) + if (pathSegments.length !== 2) { + return path } - // preminor will bump the version up to the next minor release, and immediately - // down to pre-release. premajor and prepatch work the same way. - inc (release, identifier, identifierBase) { - switch (release) { - case 'premajor': - this.prerelease.length = 0 - this.patch = 0 - this.minor = 0 - this.major++ - this.inc('pre', identifier, identifierBase) - break - case 'preminor': - this.prerelease.length = 0 - this.patch = 0 - this.minor++ - this.inc('pre', identifier, identifierBase) - break - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0 - this.inc('patch', identifier, identifierBase) - this.inc('pre', identifier, identifierBase) - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier, identifierBase) - } - this.inc('pre', identifier, identifierBase) - break + const qp = new URLSearchParams(pathSegments.pop()) + qp.sort() + return [...pathSegments, qp.toString()].join('?') +} + +function matchKey (mockDispatch, { path, method, body, headers }) { + const pathMatch = matchValue(mockDispatch.path, path) + const methodMatch = matchValue(mockDispatch.method, method) + const bodyMatch = typeof mockDispatch.body !== 'undefined' ? matchValue(mockDispatch.body, body) : true + const headersMatch = matchHeaders(mockDispatch, headers) + return pathMatch && methodMatch && bodyMatch && headersMatch +} + +function getResponseData (data) { + if (Buffer.isBuffer(data)) { + return data + } else if (typeof data === 'object') { + return JSON.stringify(data) + } else { + return data.toString() + } +} + +function getMockDispatch (mockDispatches, key) { + const basePath = key.query ? buildURL(key.path, key.query) : key.path + const resolvedPath = typeof basePath === 'string' ? safeUrl(basePath) : basePath + + // Match path + let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path }) => matchValue(safeUrl(path), resolvedPath)) + if (matchedMockDispatches.length === 0) { + throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`) + } + + // Match method + matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue(method, key.method)) + if (matchedMockDispatches.length === 0) { + throw new MockNotMatchedError(`Mock dispatch not matched for method '${key.method}'`) + } + + // Match body + matchedMockDispatches = matchedMockDispatches.filter(({ body }) => typeof body !== 'undefined' ? matchValue(body, key.body) : true) + if (matchedMockDispatches.length === 0) { + throw new MockNotMatchedError(`Mock dispatch not matched for body '${key.body}'`) + } + + // Match headers + matchedMockDispatches = matchedMockDispatches.filter((mockDispatch) => matchHeaders(mockDispatch, key.headers)) + if (matchedMockDispatches.length === 0) { + throw new MockNotMatchedError(`Mock dispatch not matched for headers '${typeof key.headers === 'object' ? JSON.stringify(key.headers) : key.headers}'`) + } + + return matchedMockDispatches[0] +} + +function addMockDispatch (mockDispatches, key, data) { + const baseData = { timesInvoked: 0, times: 1, persist: false, consumed: false } + const replyData = typeof data === 'function' ? { callback: data } : { ...data } + const newMockDispatch = { ...baseData, ...key, pending: true, data: { error: null, ...replyData } } + mockDispatches.push(newMockDispatch) + return newMockDispatch +} + +function deleteMockDispatch (mockDispatches, key) { + const index = mockDispatches.findIndex(dispatch => { + if (!dispatch.consumed) { + return false + } + return matchKey(dispatch, key) + }) + if (index !== -1) { + mockDispatches.splice(index, 1) + } +} + +function buildKey (opts) { + const { path, method, body, headers, query } = opts + return { + path, + method, + body, + headers, + query + } +} - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if ( - this.minor !== 0 || - this.patch !== 0 || - this.prerelease.length === 0 - ) { - this.major++ - } - this.minor = 0 - this.patch = 0 - this.prerelease = [] - break - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++ - } - this.patch = 0 - this.prerelease = [] - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++ - } - this.prerelease = [] - break - // This probably shouldn't be used publicly. - // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. - case 'pre': { - const base = Number(identifierBase) ? 1 : 0 +function generateKeyValues (data) { + return Object.entries(data).reduce((keyValuePairs, [key, value]) => [ + ...keyValuePairs, + Buffer.from(`${key}`), + Array.isArray(value) ? value.map(x => Buffer.from(`${x}`)) : Buffer.from(`${value}`) + ], []) +} - if (!identifier && identifierBase === false) { - throw new Error('invalid increment argument: identifier is empty') - } +/** + * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status + * @param {number} statusCode + */ +function getStatusText (statusCode) { + return STATUS_CODES[statusCode] || 'unknown' +} - if (this.prerelease.length === 0) { - this.prerelease = [base] - } else { - let i = this.prerelease.length - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++ - i = -2 - } - } - if (i === -1) { - // didn't increment anything - if (identifier === this.prerelease.join('.') && identifierBase === false) { - throw new Error('invalid increment argument: identifier already exists') - } - this.prerelease.push(base) - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - let prerelease = [identifier, base] - if (identifierBase === false) { - prerelease = [identifier] +async function getResponse (body) { + const buffers = [] + for await (const data of body) { + buffers.push(data) + } + return Buffer.concat(buffers).toString('utf8') +} + +/** + * Mock dispatch function used to simulate undici dispatches + */ +function mockDispatch (opts, handler) { + // Get mock dispatch from built key + const key = buildKey(opts) + const mockDispatch = getMockDispatch(this[kDispatches], key) + + mockDispatch.timesInvoked++ + + // Here's where we resolve a callback if a callback is present for the dispatch data. + if (mockDispatch.data.callback) { + mockDispatch.data = { ...mockDispatch.data, ...mockDispatch.data.callback(opts) } + } + + // Parse mockDispatch data + const { data: { statusCode, data, headers, trailers, error }, delay, persist } = mockDispatch + const { timesInvoked, times } = mockDispatch + + // If it's used up and not persistent, mark as consumed + mockDispatch.consumed = !persist && timesInvoked >= times + mockDispatch.pending = timesInvoked < times + + // If specified, trigger dispatch error + if (error !== null) { + deleteMockDispatch(this[kDispatches], key) + handler.onError(error) + return true + } + + // Handle the request with a delay if necessary + if (typeof delay === 'number' && delay > 0) { + setTimeout(() => { + handleReply(this[kDispatches]) + }, delay) + } else { + handleReply(this[kDispatches]) + } + + function handleReply (mockDispatches, _data = data) { + // fetch's HeadersList is a 1D string array + const optsHeaders = Array.isArray(opts.headers) + ? buildHeadersFromArray(opts.headers) + : opts.headers + const body = typeof _data === 'function' + ? _data({ ...opts, headers: optsHeaders }) + : _data + + // util.types.isPromise is likely needed for jest. + if (isPromise(body)) { + // If handleReply is asynchronous, throwing an error + // in the callback will reject the promise, rather than + // synchronously throw the error, which breaks some tests. + // Rather, we wait for the callback to resolve if it is a + // promise, and then re-run handleReply with the new body. + body.then((newData) => handleReply(mockDispatches, newData)) + return + } + + const responseData = getResponseData(body) + const responseHeaders = generateKeyValues(headers) + const responseTrailers = generateKeyValues(trailers) + + handler.abort = nop + handler.onHeaders(statusCode, responseHeaders, resume, getStatusText(statusCode)) + handler.onData(Buffer.from(responseData)) + handler.onComplete(responseTrailers) + deleteMockDispatch(mockDispatches, key) + } + + function resume () {} + + return true +} + +function buildMockDispatch () { + const agent = this[kMockAgent] + const origin = this[kOrigin] + const originalDispatch = this[kOriginalDispatch] + + return function dispatch (opts, handler) { + if (agent.isMockActive) { + try { + mockDispatch.call(this, opts, handler) + } catch (error) { + if (error instanceof MockNotMatchedError) { + const netConnect = agent[kGetNetConnect]() + if (netConnect === false) { + throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)`) } - if (compareIdentifiers(this.prerelease[0], identifier) === 0) { - if (isNaN(this.prerelease[1])) { - this.prerelease = prerelease - } + if (checkNetConnect(netConnect, origin)) { + originalDispatch.call(this, opts, handler) } else { - this.prerelease = prerelease + throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect is not enabled for this origin)`) } + } else { + throw error } - break } - default: - throw new Error(`invalid increment argument: ${release}`) - } - this.raw = this.format() - if (this.build.length) { - this.raw += `+${this.build.join('.')}` + } else { + originalDispatch.call(this, opts, handler) } - return this } } -module.exports = SemVer - - -/***/ }), +function checkNetConnect (netConnect, origin) { + const url = new URL(origin) + if (netConnect === true) { + return true + } else if (Array.isArray(netConnect) && netConnect.some((matcher) => matchValue(matcher, url.host))) { + return true + } + return false +} -/***/ 8848: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +function buildMockOptions (opts) { + if (opts) { + const { agent, ...mockOptions } = opts + return mockOptions + } +} -const parse = __nccwpck_require__(5925) -const clean = (version, options) => { - const s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null +module.exports = { + getResponseData, + getMockDispatch, + addMockDispatch, + deleteMockDispatch, + buildKey, + generateKeyValues, + matchValue, + getResponse, + getStatusText, + mockDispatch, + buildMockDispatch, + checkNetConnect, + buildMockOptions, + getHeaderByName } -module.exports = clean /***/ }), -/***/ 5098: +/***/ 6823: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const eq = __nccwpck_require__(1898) -const neq = __nccwpck_require__(6017) -const gt = __nccwpck_require__(4123) -const gte = __nccwpck_require__(5522) -const lt = __nccwpck_require__(194) -const lte = __nccwpck_require__(7520) +"use strict"; -const cmp = (a, op, b, loose) => { - switch (op) { - case '===': - if (typeof a === 'object') { - a = a.version - } - if (typeof b === 'object') { - b = b.version - } - return a === b - case '!==': - if (typeof a === 'object') { - a = a.version +const { Transform } = __nccwpck_require__(2781) +const { Console } = __nccwpck_require__(6206) + +/** + * Gets the output of `console.table(…)` as a string. + */ +module.exports = class PendingInterceptorsFormatter { + constructor ({ disableColors } = {}) { + this.transform = new Transform({ + transform (chunk, _enc, cb) { + cb(null, chunk) } - if (typeof b === 'object') { - b = b.version + }) + + this.logger = new Console({ + stdout: this.transform, + inspectOptions: { + colors: !disableColors && !process.env.CI } - return a !== b + }) + } - case '': - case '=': - case '==': - return eq(a, b, loose) + format (pendingInterceptors) { + const withPrettyHeaders = pendingInterceptors.map( + ({ method, path, data: { statusCode }, persist, times, timesInvoked, origin }) => ({ + Method: method, + Origin: origin, + Path: path, + 'Status code': statusCode, + Persistent: persist ? '✅' : '❌', + Invocations: timesInvoked, + Remaining: persist ? Infinity : times - timesInvoked + })) - case '!=': - return neq(a, b, loose) + this.logger.table(withPrettyHeaders) + return this.transform.read().toString() + } +} - case '>': - return gt(a, b, loose) - case '>=': - return gte(a, b, loose) +/***/ }), - case '<': - return lt(a, b, loose) +/***/ 8891: +/***/ ((module) => { - case '<=': - return lte(a, b, loose) +"use strict"; - default: - throw new TypeError(`Invalid operator: ${op}`) + +const singulars = { + pronoun: 'it', + is: 'is', + was: 'was', + this: 'this' +} + +const plurals = { + pronoun: 'they', + is: 'are', + was: 'were', + this: 'these' +} + +module.exports = class Pluralizer { + constructor (singular, plural) { + this.singular = singular + this.plural = plural + } + + pluralize (count) { + const one = count === 1 + const keys = one ? singulars : plurals + const noun = one ? this.singular : this.plural + return { ...keys, count, noun } } } -module.exports = cmp /***/ }), -/***/ 3466: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 8266: +/***/ ((module) => { -const SemVer = __nccwpck_require__(8088) -const parse = __nccwpck_require__(5925) -const { safeRe: re, t } = __nccwpck_require__(9523) +"use strict"; +/* eslint-disable */ -const coerce = (version, options) => { - if (version instanceof SemVer) { - return version + + +// Extracted from node/lib/internal/fixed_queue.js + +// Currently optimal queue size, tested on V8 6.0 - 6.6. Must be power of two. +const kSize = 2048; +const kMask = kSize - 1; + +// The FixedQueue is implemented as a singly-linked list of fixed-size +// circular buffers. It looks something like this: +// +// head tail +// | | +// v v +// +-----------+ <-----\ +-----------+ <------\ +-----------+ +// | [null] | \----- | next | \------- | next | +// +-----------+ +-----------+ +-----------+ +// | item | <-- bottom | item | <-- bottom | [empty] | +// | item | | item | | [empty] | +// | item | | item | | [empty] | +// | item | | item | | [empty] | +// | item | | item | bottom --> | item | +// | item | | item | | item | +// | ... | | ... | | ... | +// | item | | item | | item | +// | item | | item | | item | +// | [empty] | <-- top | item | | item | +// | [empty] | | item | | item | +// | [empty] | | [empty] | <-- top top --> | [empty] | +// +-----------+ +-----------+ +-----------+ +// +// Or, if there is only one circular buffer, it looks something +// like either of these: +// +// head tail head tail +// | | | | +// v v v v +// +-----------+ +-----------+ +// | [null] | | [null] | +// +-----------+ +-----------+ +// | [empty] | | item | +// | [empty] | | item | +// | item | <-- bottom top --> | [empty] | +// | item | | [empty] | +// | [empty] | <-- top bottom --> | item | +// | [empty] | | item | +// +-----------+ +-----------+ +// +// Adding a value means moving `top` forward by one, removing means +// moving `bottom` forward by one. After reaching the end, the queue +// wraps around. +// +// When `top === bottom` the current queue is empty and when +// `top + 1 === bottom` it's full. This wastes a single space of storage +// but allows much quicker checks. + +class FixedCircularBuffer { + constructor() { + this.bottom = 0; + this.top = 0; + this.list = new Array(kSize); + this.next = null; } - if (typeof version === 'number') { - version = String(version) + isEmpty() { + return this.top === this.bottom; } - if (typeof version !== 'string') { - return null + isFull() { + return ((this.top + 1) & kMask) === this.bottom; } - options = options || {} + push(data) { + this.list[this.top] = data; + this.top = (this.top + 1) & kMask; + } - let match = null - if (!options.rtl) { - match = version.match(re[t.COERCE]) - } else { - // Find the right-most coercible string that does not share - // a terminus with a more left-ward coercible string. - // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' - // - // Walk through the string checking with a /g regexp - // Manually set the index so as to pick up overlapping matches. - // Stop when we get a match that ends at the string end, since no - // coercible string can be more right-ward without the same terminus. - let next - while ((next = re[t.COERCERTL].exec(version)) && - (!match || match.index + match[0].length !== version.length) - ) { - if (!match || - next.index + next[0].length !== match.index + match[0].length) { - match = next - } - re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length - } - // leave it in a clean state - re[t.COERCERTL].lastIndex = -1 + shift() { + const nextItem = this.list[this.bottom]; + if (nextItem === undefined) + return null; + this.list[this.bottom] = undefined; + this.bottom = (this.bottom + 1) & kMask; + return nextItem; } +} - if (match === null) { - return null +module.exports = class FixedQueue { + constructor() { + this.head = this.tail = new FixedCircularBuffer(); } - return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options) -} -module.exports = coerce + isEmpty() { + return this.head.isEmpty(); + } + + push(data) { + if (this.head.isFull()) { + // Head is full: Creates a new queue, sets the old queue's `.next` to it, + // and sets it as the new main queue. + this.head = this.head.next = new FixedCircularBuffer(); + } + this.head.push(data); + } + + shift() { + const tail = this.tail; + const next = tail.shift(); + if (tail.isEmpty() && tail.next !== null) { + // If there is another queue, it forms the new tail. + this.tail = tail.next; + } + return next; + } +}; /***/ }), -/***/ 2156: +/***/ 3198: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(8088) -const compareBuild = (a, b, loose) => { - const versionA = new SemVer(a, loose) - const versionB = new SemVer(b, loose) - return versionA.compare(versionB) || versionA.compareBuild(versionB) -} -module.exports = compareBuild +"use strict"; -/***/ }), +const DispatcherBase = __nccwpck_require__(4839) +const FixedQueue = __nccwpck_require__(8266) +const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy, kDispatch } = __nccwpck_require__(2785) +const PoolStats = __nccwpck_require__(9689) -/***/ 2804: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +const kClients = Symbol('clients') +const kNeedDrain = Symbol('needDrain') +const kQueue = Symbol('queue') +const kClosedResolve = Symbol('closed resolve') +const kOnDrain = Symbol('onDrain') +const kOnConnect = Symbol('onConnect') +const kOnDisconnect = Symbol('onDisconnect') +const kOnConnectionError = Symbol('onConnectionError') +const kGetDispatcher = Symbol('get dispatcher') +const kAddClient = Symbol('add client') +const kRemoveClient = Symbol('remove client') +const kStats = Symbol('stats') -const compare = __nccwpck_require__(4309) -const compareLoose = (a, b) => compare(a, b, true) -module.exports = compareLoose +class PoolBase extends DispatcherBase { + constructor () { + super() + this[kQueue] = new FixedQueue() + this[kClients] = [] + this[kQueued] = 0 -/***/ }), + const pool = this -/***/ 4309: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + this[kOnDrain] = function onDrain (origin, targets) { + const queue = pool[kQueue] -const SemVer = __nccwpck_require__(8088) -const compare = (a, b, loose) => - new SemVer(a, loose).compare(new SemVer(b, loose)) + let needDrain = false -module.exports = compare + while (!needDrain) { + const item = queue.shift() + if (!item) { + break + } + pool[kQueued]-- + needDrain = !this.dispatch(item.opts, item.handler) + } + this[kNeedDrain] = needDrain -/***/ }), + if (!this[kNeedDrain] && pool[kNeedDrain]) { + pool[kNeedDrain] = false + pool.emit('drain', origin, [pool, ...targets]) + } -/***/ 4297: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (pool[kClosedResolve] && queue.isEmpty()) { + Promise + .all(pool[kClients].map(c => c.close())) + .then(pool[kClosedResolve]) + } + } -const parse = __nccwpck_require__(5925) + this[kOnConnect] = (origin, targets) => { + pool.emit('connect', origin, [pool, ...targets]) + } -const diff = (version1, version2) => { - const v1 = parse(version1, null, true) - const v2 = parse(version2, null, true) - const comparison = v1.compare(v2) + this[kOnDisconnect] = (origin, targets, err) => { + pool.emit('disconnect', origin, [pool, ...targets], err) + } - if (comparison === 0) { - return null + this[kOnConnectionError] = (origin, targets, err) => { + pool.emit('connectionError', origin, [pool, ...targets], err) + } + + this[kStats] = new PoolStats(this) } - const v1Higher = comparison > 0 - const highVersion = v1Higher ? v1 : v2 - const lowVersion = v1Higher ? v2 : v1 - const highHasPre = !!highVersion.prerelease.length - const lowHasPre = !!lowVersion.prerelease.length + get [kBusy] () { + return this[kNeedDrain] + } - if (lowHasPre && !highHasPre) { - // Going from prerelease -> no prerelease requires some special casing + get [kConnected] () { + return this[kClients].filter(client => client[kConnected]).length + } - // If the low version has only a major, then it will always be a major - // Some examples: - // 1.0.0-1 -> 1.0.0 - // 1.0.0-1 -> 1.1.1 - // 1.0.0-1 -> 2.0.0 - if (!lowVersion.patch && !lowVersion.minor) { - return 'major' - } + get [kFree] () { + return this[kClients].filter(client => client[kConnected] && !client[kNeedDrain]).length + } - // Otherwise it can be determined by checking the high version + get [kPending] () { + let ret = this[kQueued] + for (const { [kPending]: pending } of this[kClients]) { + ret += pending + } + return ret + } - if (highVersion.patch) { - // anything higher than a patch bump would result in the wrong version - return 'patch' + get [kRunning] () { + let ret = 0 + for (const { [kRunning]: running } of this[kClients]) { + ret += running } + return ret + } - if (highVersion.minor) { - // anything higher than a minor bump would result in the wrong version - return 'minor' + get [kSize] () { + let ret = this[kQueued] + for (const { [kSize]: size } of this[kClients]) { + ret += size } + return ret + } - // bumping major/minor/patch all have same result - return 'major' + get stats () { + return this[kStats] } - // add the `pre` prefix if we are going to a prerelease version - const prefix = highHasPre ? 'pre' : '' + async [kClose] () { + if (this[kQueue].isEmpty()) { + return Promise.all(this[kClients].map(c => c.close())) + } else { + return new Promise((resolve) => { + this[kClosedResolve] = resolve + }) + } + } - if (v1.major !== v2.major) { - return prefix + 'major' + async [kDestroy] (err) { + while (true) { + const item = this[kQueue].shift() + if (!item) { + break + } + item.handler.onError(err) + } + + return Promise.all(this[kClients].map(c => c.destroy(err))) } - if (v1.minor !== v2.minor) { - return prefix + 'minor' + [kDispatch] (opts, handler) { + const dispatcher = this[kGetDispatcher]() + + if (!dispatcher) { + this[kNeedDrain] = true + this[kQueue].push({ opts, handler }) + this[kQueued]++ + } else if (!dispatcher.dispatch(opts, handler)) { + dispatcher[kNeedDrain] = true + this[kNeedDrain] = !this[kGetDispatcher]() + } + + return !this[kNeedDrain] } - if (v1.patch !== v2.patch) { - return prefix + 'patch' + [kAddClient] (client) { + client + .on('drain', this[kOnDrain]) + .on('connect', this[kOnConnect]) + .on('disconnect', this[kOnDisconnect]) + .on('connectionError', this[kOnConnectionError]) + + this[kClients].push(client) + + if (this[kNeedDrain]) { + process.nextTick(() => { + if (this[kNeedDrain]) { + this[kOnDrain](client[kUrl], [this, client]) + } + }) + } + + return this } - // high and low are preleases - return 'prerelease' + [kRemoveClient] (client) { + client.close(() => { + const idx = this[kClients].indexOf(client) + if (idx !== -1) { + this[kClients].splice(idx, 1) + } + }) + + this[kNeedDrain] = this[kClients].some(dispatcher => ( + !dispatcher[kNeedDrain] && + dispatcher.closed !== true && + dispatcher.destroyed !== true + )) + } } -module.exports = diff +module.exports = { + PoolBase, + kClients, + kNeedDrain, + kAddClient, + kRemoveClient, + kGetDispatcher +} /***/ }), -/***/ 1898: +/***/ 9689: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const compare = __nccwpck_require__(4309) -const eq = (a, b, loose) => compare(a, b, loose) === 0 -module.exports = eq +const { kFree, kConnected, kPending, kQueued, kRunning, kSize } = __nccwpck_require__(2785) +const kPool = Symbol('pool') +class PoolStats { + constructor (pool) { + this[kPool] = pool + } -/***/ }), + get connected () { + return this[kPool][kConnected] + } -/***/ 4123: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + get free () { + return this[kPool][kFree] + } -const compare = __nccwpck_require__(4309) -const gt = (a, b, loose) => compare(a, b, loose) > 0 -module.exports = gt + get pending () { + return this[kPool][kPending] + } + get queued () { + return this[kPool][kQueued] + } -/***/ }), + get running () { + return this[kPool][kRunning] + } -/***/ 5522: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + get size () { + return this[kPool][kSize] + } +} -const compare = __nccwpck_require__(4309) -const gte = (a, b, loose) => compare(a, b, loose) >= 0 -module.exports = gte +module.exports = PoolStats /***/ }), -/***/ 900: +/***/ 4634: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(8088) +"use strict"; -const inc = (version, release, options, identifier, identifierBase) => { - if (typeof (options) === 'string') { - identifierBase = identifier - identifier = options - options = undefined + +const { + PoolBase, + kClients, + kNeedDrain, + kAddClient, + kGetDispatcher +} = __nccwpck_require__(3198) +const Client = __nccwpck_require__(3598) +const { + InvalidArgumentError +} = __nccwpck_require__(8045) +const util = __nccwpck_require__(3983) +const { kUrl, kInterceptors } = __nccwpck_require__(2785) +const buildConnector = __nccwpck_require__(2067) + +const kOptions = Symbol('options') +const kConnections = Symbol('connections') +const kFactory = Symbol('factory') + +function defaultFactory (origin, opts) { + return new Client(origin, opts) +} + +class Pool extends PoolBase { + constructor (origin, { + connections, + factory = defaultFactory, + connect, + connectTimeout, + tls, + maxCachedSessions, + socketPath, + autoSelectFamily, + autoSelectFamilyAttemptTimeout, + allowH2, + ...options + } = {}) { + super() + + if (connections != null && (!Number.isFinite(connections) || connections < 0)) { + throw new InvalidArgumentError('invalid connections') + } + + if (typeof factory !== 'function') { + throw new InvalidArgumentError('factory must be a function.') + } + + if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') { + throw new InvalidArgumentError('connect must be a function or an object') + } + + if (typeof connect !== 'function') { + connect = buildConnector({ + ...tls, + maxCachedSessions, + allowH2, + socketPath, + timeout: connectTimeout == null ? 10e3 : connectTimeout, + ...(util.nodeHasAutoSelectFamily && autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : undefined), + ...connect + }) + } + + this[kInterceptors] = options.interceptors && options.interceptors.Pool && Array.isArray(options.interceptors.Pool) + ? options.interceptors.Pool + : [] + this[kConnections] = connections || null + this[kUrl] = util.parseOrigin(origin) + this[kOptions] = { ...util.deepClone(options), connect, allowH2 } + this[kOptions].interceptors = options.interceptors + ? { ...options.interceptors } + : undefined + this[kFactory] = factory } - try { - return new SemVer( - version instanceof SemVer ? version.version : version, - options - ).inc(release, identifier, identifierBase).version - } catch (er) { - return null + [kGetDispatcher] () { + let dispatcher = this[kClients].find(dispatcher => !dispatcher[kNeedDrain]) + + if (dispatcher) { + return dispatcher + } + + if (!this[kConnections] || this[kClients].length < this[kConnections]) { + dispatcher = this[kFactory](this[kUrl], this[kOptions]) + this[kAddClient](dispatcher) + } + + return dispatcher } } -module.exports = inc + +module.exports = Pool /***/ }), -/***/ 194: +/***/ 7858: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const compare = __nccwpck_require__(4309) -const lt = (a, b, loose) => compare(a, b, loose) < 0 -module.exports = lt +"use strict"; -/***/ }), +const { kProxy, kClose, kDestroy, kInterceptors } = __nccwpck_require__(2785) +const { URL } = __nccwpck_require__(7310) +const Agent = __nccwpck_require__(7890) +const Pool = __nccwpck_require__(4634) +const DispatcherBase = __nccwpck_require__(4839) +const { InvalidArgumentError, RequestAbortedError } = __nccwpck_require__(8045) +const buildConnector = __nccwpck_require__(2067) -/***/ 7520: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +const kAgent = Symbol('proxy agent') +const kClient = Symbol('proxy client') +const kProxyHeaders = Symbol('proxy headers') +const kRequestTls = Symbol('request tls settings') +const kProxyTls = Symbol('proxy tls settings') +const kConnectEndpoint = Symbol('connect endpoint function') -const compare = __nccwpck_require__(4309) -const lte = (a, b, loose) => compare(a, b, loose) <= 0 -module.exports = lte +function defaultProtocolPort (protocol) { + return protocol === 'https:' ? 443 : 80 +} +function buildProxyOptions (opts) { + if (typeof opts === 'string') { + opts = { uri: opts } + } -/***/ }), + if (!opts || !opts.uri) { + throw new InvalidArgumentError('Proxy opts.uri is mandatory') + } -/***/ 6688: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + return { + uri: opts.uri, + protocol: opts.protocol || 'https' + } +} -const SemVer = __nccwpck_require__(8088) -const major = (a, loose) => new SemVer(a, loose).major -module.exports = major +function defaultFactory (origin, opts) { + return new Pool(origin, opts) +} +class ProxyAgent extends DispatcherBase { + constructor (opts) { + super(opts) + this[kProxy] = buildProxyOptions(opts) + this[kAgent] = new Agent(opts) + this[kInterceptors] = opts.interceptors && opts.interceptors.ProxyAgent && Array.isArray(opts.interceptors.ProxyAgent) + ? opts.interceptors.ProxyAgent + : [] -/***/ }), + if (typeof opts === 'string') { + opts = { uri: opts } + } -/***/ 8447: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (!opts || !opts.uri) { + throw new InvalidArgumentError('Proxy opts.uri is mandatory') + } -const SemVer = __nccwpck_require__(8088) -const minor = (a, loose) => new SemVer(a, loose).minor -module.exports = minor + const { clientFactory = defaultFactory } = opts + if (typeof clientFactory !== 'function') { + throw new InvalidArgumentError('Proxy opts.clientFactory must be a function.') + } -/***/ }), + this[kRequestTls] = opts.requestTls + this[kProxyTls] = opts.proxyTls + this[kProxyHeaders] = opts.headers || {} -/***/ 6017: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (opts.auth && opts.token) { + throw new InvalidArgumentError('opts.auth cannot be used in combination with opts.token') + } else if (opts.auth) { + /* @deprecated in favour of opts.token */ + this[kProxyHeaders]['proxy-authorization'] = `Basic ${opts.auth}` + } else if (opts.token) { + this[kProxyHeaders]['proxy-authorization'] = opts.token + } -const compare = __nccwpck_require__(4309) -const neq = (a, b, loose) => compare(a, b, loose) !== 0 -module.exports = neq + const resolvedUrl = new URL(opts.uri) + const { origin, port, host } = resolvedUrl + const connect = buildConnector({ ...opts.proxyTls }) + this[kConnectEndpoint] = buildConnector({ ...opts.requestTls }) + this[kClient] = clientFactory(resolvedUrl, { connect }) + this[kAgent] = new Agent({ + ...opts, + connect: async (opts, callback) => { + let requestedHost = opts.host + if (!opts.port) { + requestedHost += `:${defaultProtocolPort(opts.protocol)}` + } + try { + const { socket, statusCode } = await this[kClient].connect({ + origin, + port, + path: requestedHost, + signal: opts.signal, + headers: { + ...this[kProxyHeaders], + host + } + }) + if (statusCode !== 200) { + socket.on('error', () => {}).destroy() + callback(new RequestAbortedError('Proxy response !== 200 when HTTP Tunneling')) + } + if (opts.protocol !== 'https:') { + callback(null, socket) + return + } + let servername + if (this[kRequestTls]) { + servername = this[kRequestTls].servername + } else { + servername = opts.servername + } + this[kConnectEndpoint]({ ...opts, servername, httpSocket: socket }, callback) + } catch (err) { + callback(err) + } + } + }) + } -/***/ }), + dispatch (opts, handler) { + const { host } = new URL(opts.origin) + const headers = buildHeaders(opts.headers) + throwIfProxyAuthIsSent(headers) + return this[kAgent].dispatch( + { + ...opts, + headers: { + ...headers, + host + } + }, + handler + ) + } -/***/ 5925: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + async [kClose] () { + await this[kAgent].close() + await this[kClient].close() + } -const SemVer = __nccwpck_require__(8088) -const parse = (version, options, throwErrors = false) => { - if (version instanceof SemVer) { - return version + async [kDestroy] () { + await this[kAgent].destroy() + await this[kClient].destroy() } - try { - return new SemVer(version, options) - } catch (er) { - if (!throwErrors) { - return null +} + +/** + * @param {string[] | Record} headers + * @returns {Record} + */ +function buildHeaders (headers) { + // When using undici.fetch, the headers list is stored + // as an array. + if (Array.isArray(headers)) { + /** @type {Record} */ + const headersPair = {} + + for (let i = 0; i < headers.length; i += 2) { + headersPair[headers[i]] = headers[i + 1] } - throw er + + return headersPair + } + + return headers +} + +/** + * @param {Record} headers + * + * Previous versions of ProxyAgent suggests the Proxy-Authorization in request headers + * Nevertheless, it was changed and to avoid a security vulnerability by end users + * this check was created. + * It should be removed in the next major version for performance reasons + */ +function throwIfProxyAuthIsSent (headers) { + const existProxyAuth = headers && Object.keys(headers) + .find((key) => key.toLowerCase() === 'proxy-authorization') + if (existProxyAuth) { + throw new InvalidArgumentError('Proxy-Authorization should be sent in ProxyAgent constructor') } } -module.exports = parse +module.exports = ProxyAgent + + +/***/ }), + +/***/ 9459: +/***/ ((module) => { + +"use strict"; -/***/ }), +let fastNow = Date.now() +let fastNowTimeout -/***/ 2866: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +const fastTimers = [] -const SemVer = __nccwpck_require__(8088) -const patch = (a, loose) => new SemVer(a, loose).patch -module.exports = patch +function onTimeout () { + fastNow = Date.now() + let len = fastTimers.length + let idx = 0 + while (idx < len) { + const timer = fastTimers[idx] -/***/ }), + if (timer.state === 0) { + timer.state = fastNow + timer.delay + } else if (timer.state > 0 && fastNow >= timer.state) { + timer.state = -1 + timer.callback(timer.opaque) + } -/***/ 4016: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (timer.state === -1) { + timer.state = -2 + if (idx !== len - 1) { + fastTimers[idx] = fastTimers.pop() + } else { + fastTimers.pop() + } + len -= 1 + } else { + idx += 1 + } + } -const parse = __nccwpck_require__(5925) -const prerelease = (version, options) => { - const parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null + if (fastTimers.length > 0) { + refreshTimeout() + } } -module.exports = prerelease +function refreshTimeout () { + if (fastNowTimeout && fastNowTimeout.refresh) { + fastNowTimeout.refresh() + } else { + clearTimeout(fastNowTimeout) + fastNowTimeout = setTimeout(onTimeout, 1e3) + if (fastNowTimeout.unref) { + fastNowTimeout.unref() + } + } +} -/***/ }), +class Timeout { + constructor (callback, delay, opaque) { + this.callback = callback + this.delay = delay + this.opaque = opaque -/***/ 6417: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // -2 not in timer list + // -1 in timer list but inactive + // 0 in timer list waiting for time + // > 0 in timer list waiting for time to expire + this.state = -2 -const compare = __nccwpck_require__(4309) -const rcompare = (a, b, loose) => compare(b, a, loose) -module.exports = rcompare + this.refresh() + } + refresh () { + if (this.state === -2) { + fastTimers.push(this) + if (!fastNowTimeout || fastTimers.length === 1) { + refreshTimeout() + } + } -/***/ }), + this.state = 0 + } -/***/ 8701: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + clear () { + this.state = -1 + } +} -const compareBuild = __nccwpck_require__(2156) -const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) -module.exports = rsort +module.exports = { + setTimeout (callback, delay, opaque) { + return delay < 1e3 + ? setTimeout(callback, delay, opaque) + : new Timeout(callback, delay, opaque) + }, + clearTimeout (timeout) { + if (timeout instanceof Timeout) { + timeout.clear() + } else { + clearTimeout(timeout) + } + } +} /***/ }), -/***/ 6055: +/***/ 5354: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const Range = __nccwpck_require__(9828) -const satisfies = (version, range, options) => { - try { - range = new Range(range, options) - } catch (er) { - return false - } - return range.test(version) +"use strict"; + + +const diagnosticsChannel = __nccwpck_require__(7643) +const { uid, states } = __nccwpck_require__(9188) +const { + kReadyState, + kSentClose, + kByteParser, + kReceivedClose +} = __nccwpck_require__(7578) +const { fireEvent, failWebsocketConnection } = __nccwpck_require__(5515) +const { CloseEvent } = __nccwpck_require__(2611) +const { makeRequest } = __nccwpck_require__(8359) +const { fetching } = __nccwpck_require__(4881) +const { Headers } = __nccwpck_require__(554) +const { getGlobalDispatcher } = __nccwpck_require__(1892) +const { kHeadersList } = __nccwpck_require__(2785) + +const channels = {} +channels.open = diagnosticsChannel.channel('undici:websocket:open') +channels.close = diagnosticsChannel.channel('undici:websocket:close') +channels.socketError = diagnosticsChannel.channel('undici:websocket:socket_error') + +/** @type {import('crypto')} */ +let crypto +try { + crypto = __nccwpck_require__(6113) +} catch { + } -module.exports = satisfies +/** + * @see https://websockets.spec.whatwg.org/#concept-websocket-establish + * @param {URL} url + * @param {string|string[]} protocols + * @param {import('./websocket').WebSocket} ws + * @param {(response: any) => void} onEstablish + * @param {Partial} options + */ +function establishWebSocketConnection (url, protocols, ws, onEstablish, options) { + // 1. Let requestURL be a copy of url, with its scheme set to "http", if url’s + // scheme is "ws", and to "https" otherwise. + const requestURL = url + + requestURL.protocol = url.protocol === 'ws:' ? 'http:' : 'https:' + + // 2. Let request be a new request, whose URL is requestURL, client is client, + // service-workers mode is "none", referrer is "no-referrer", mode is + // "websocket", credentials mode is "include", cache mode is "no-store" , + // and redirect mode is "error". + const request = makeRequest({ + urlList: [requestURL], + serviceWorkers: 'none', + referrer: 'no-referrer', + mode: 'websocket', + credentials: 'include', + cache: 'no-store', + redirect: 'error' + }) -/***/ }), + // Note: undici extension, allow setting custom headers. + if (options.headers) { + const headersList = new Headers(options.headers)[kHeadersList] + + request.headersList = headersList + } + + // 3. Append (`Upgrade`, `websocket`) to request’s header list. + // 4. Append (`Connection`, `Upgrade`) to request’s header list. + // Note: both of these are handled by undici currently. + // https://github.com/nodejs/undici/blob/68c269c4144c446f3f1220951338daef4a6b5ec4/lib/client.js#L1397 + + // 5. Let keyValue be a nonce consisting of a randomly selected + // 16-byte value that has been forgiving-base64-encoded and + // isomorphic encoded. + const keyValue = crypto.randomBytes(16).toString('base64') + + // 6. Append (`Sec-WebSocket-Key`, keyValue) to request’s + // header list. + request.headersList.append('sec-websocket-key', keyValue) + + // 7. Append (`Sec-WebSocket-Version`, `13`) to request’s + // header list. + request.headersList.append('sec-websocket-version', '13') + + // 8. For each protocol in protocols, combine + // (`Sec-WebSocket-Protocol`, protocol) in request’s header + // list. + for (const protocol of protocols) { + request.headersList.append('sec-websocket-protocol', protocol) + } + + // 9. Let permessageDeflate be a user-agent defined + // "permessage-deflate" extension header value. + // https://github.com/mozilla/gecko-dev/blob/ce78234f5e653a5d3916813ff990f053510227bc/netwerk/protocol/websocket/WebSocketChannel.cpp#L2673 + // TODO: enable once permessage-deflate is supported + const permessageDeflate = '' // 'permessage-deflate; 15' + + // 10. Append (`Sec-WebSocket-Extensions`, permessageDeflate) to + // request’s header list. + // request.headersList.append('sec-websocket-extensions', permessageDeflate) + + // 11. Fetch request with useParallelQueue set to true, and + // processResponse given response being these steps: + const controller = fetching({ + request, + useParallelQueue: true, + dispatcher: options.dispatcher ?? getGlobalDispatcher(), + processResponse (response) { + // 1. If response is a network error or its status is not 101, + // fail the WebSocket connection. + if (response.type === 'error' || response.status !== 101) { + failWebsocketConnection(ws, 'Received network error or non-101 status code.') + return + } -/***/ 1426: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 2. If protocols is not the empty list and extracting header + // list values given `Sec-WebSocket-Protocol` and response’s + // header list results in null, failure, or the empty byte + // sequence, then fail the WebSocket connection. + if (protocols.length !== 0 && !response.headersList.get('Sec-WebSocket-Protocol')) { + failWebsocketConnection(ws, 'Server did not respond with sent protocols.') + return + } -const compareBuild = __nccwpck_require__(2156) -const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) -module.exports = sort + // 3. Follow the requirements stated step 2 to step 6, inclusive, + // of the last set of steps in section 4.1 of The WebSocket + // Protocol to validate response. This either results in fail + // the WebSocket connection or the WebSocket connection is + // established. + + // 2. If the response lacks an |Upgrade| header field or the |Upgrade| + // header field contains a value that is not an ASCII case- + // insensitive match for the value "websocket", the client MUST + // _Fail the WebSocket Connection_. + if (response.headersList.get('Upgrade')?.toLowerCase() !== 'websocket') { + failWebsocketConnection(ws, 'Server did not set Upgrade header to "websocket".') + return + } + // 3. If the response lacks a |Connection| header field or the + // |Connection| header field doesn't contain a token that is an + // ASCII case-insensitive match for the value "Upgrade", the client + // MUST _Fail the WebSocket Connection_. + if (response.headersList.get('Connection')?.toLowerCase() !== 'upgrade') { + failWebsocketConnection(ws, 'Server did not set Connection header to "upgrade".') + return + } -/***/ }), + // 4. If the response lacks a |Sec-WebSocket-Accept| header field or + // the |Sec-WebSocket-Accept| contains a value other than the + // base64-encoded SHA-1 of the concatenation of the |Sec-WebSocket- + // Key| (as a string, not base64-decoded) with the string "258EAFA5- + // E914-47DA-95CA-C5AB0DC85B11" but ignoring any leading and + // trailing whitespace, the client MUST _Fail the WebSocket + // Connection_. + const secWSAccept = response.headersList.get('Sec-WebSocket-Accept') + const digest = crypto.createHash('sha1').update(keyValue + uid).digest('base64') + if (secWSAccept !== digest) { + failWebsocketConnection(ws, 'Incorrect hash received in Sec-WebSocket-Accept header.') + return + } -/***/ 9601: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 5. If the response includes a |Sec-WebSocket-Extensions| header + // field and this header field indicates the use of an extension + // that was not present in the client's handshake (the server has + // indicated an extension not requested by the client), the client + // MUST _Fail the WebSocket Connection_. (The parsing of this + // header field to determine which extensions are requested is + // discussed in Section 9.1.) + const secExtension = response.headersList.get('Sec-WebSocket-Extensions') + + if (secExtension !== null && secExtension !== permessageDeflate) { + failWebsocketConnection(ws, 'Received different permessage-deflate than the one set.') + return + } -const parse = __nccwpck_require__(5925) -const valid = (version, options) => { - const v = parse(version, options) - return v ? v.version : null -} -module.exports = valid + // 6. If the response includes a |Sec-WebSocket-Protocol| header field + // and this header field indicates the use of a subprotocol that was + // not present in the client's handshake (the server has indicated a + // subprotocol not requested by the client), the client MUST _Fail + // the WebSocket Connection_. + const secProtocol = response.headersList.get('Sec-WebSocket-Protocol') + if (secProtocol !== null && secProtocol !== request.headersList.get('Sec-WebSocket-Protocol')) { + failWebsocketConnection(ws, 'Protocol was not set in the opening handshake.') + return + } -/***/ }), + response.socket.on('data', onSocketData) + response.socket.on('close', onSocketClose) + response.socket.on('error', onSocketError) -/***/ 1383: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (channels.open.hasSubscribers) { + channels.open.publish({ + address: response.socket.address(), + protocol: secProtocol, + extensions: secExtension + }) + } -// just pre-load all the stuff that index.js lazily exports -const internalRe = __nccwpck_require__(9523) -const constants = __nccwpck_require__(2293) -const SemVer = __nccwpck_require__(8088) -const identifiers = __nccwpck_require__(2463) -const parse = __nccwpck_require__(5925) -const valid = __nccwpck_require__(9601) -const clean = __nccwpck_require__(8848) -const inc = __nccwpck_require__(900) -const diff = __nccwpck_require__(4297) -const major = __nccwpck_require__(6688) -const minor = __nccwpck_require__(8447) -const patch = __nccwpck_require__(2866) -const prerelease = __nccwpck_require__(4016) -const compare = __nccwpck_require__(4309) -const rcompare = __nccwpck_require__(6417) -const compareLoose = __nccwpck_require__(2804) -const compareBuild = __nccwpck_require__(2156) -const sort = __nccwpck_require__(1426) -const rsort = __nccwpck_require__(8701) -const gt = __nccwpck_require__(4123) -const lt = __nccwpck_require__(194) -const eq = __nccwpck_require__(1898) -const neq = __nccwpck_require__(6017) -const gte = __nccwpck_require__(5522) -const lte = __nccwpck_require__(7520) -const cmp = __nccwpck_require__(5098) -const coerce = __nccwpck_require__(3466) -const Comparator = __nccwpck_require__(1532) -const Range = __nccwpck_require__(9828) -const satisfies = __nccwpck_require__(6055) -const toComparators = __nccwpck_require__(2706) -const maxSatisfying = __nccwpck_require__(579) -const minSatisfying = __nccwpck_require__(832) -const minVersion = __nccwpck_require__(4179) -const validRange = __nccwpck_require__(2098) -const outside = __nccwpck_require__(420) -const gtr = __nccwpck_require__(9380) -const ltr = __nccwpck_require__(3323) -const intersects = __nccwpck_require__(7008) -const simplifyRange = __nccwpck_require__(5297) -const subset = __nccwpck_require__(7863) -module.exports = { - parse, - valid, - clean, - inc, - diff, - major, - minor, - patch, - prerelease, - compare, - rcompare, - compareLoose, - compareBuild, - sort, - rsort, - gt, - lt, - eq, - neq, - gte, - lte, - cmp, - coerce, - Comparator, - Range, - satisfies, - toComparators, - maxSatisfying, - minSatisfying, - minVersion, - validRange, - outside, - gtr, - ltr, - intersects, - simplifyRange, - subset, - SemVer, - re: internalRe.re, - src: internalRe.src, - tokens: internalRe.t, - SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, - RELEASE_TYPES: constants.RELEASE_TYPES, - compareIdentifiers: identifiers.compareIdentifiers, - rcompareIdentifiers: identifiers.rcompareIdentifiers, -} + onEstablish(response) + } + }) + return controller +} -/***/ }), +/** + * @param {Buffer} chunk + */ +function onSocketData (chunk) { + if (!this.ws[kByteParser].write(chunk)) { + this.pause() + } +} -/***/ 2293: -/***/ ((module) => { +/** + * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol + * @see https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.4 + */ +function onSocketClose () { + const { ws } = this + + // If the TCP connection was closed after the + // WebSocket closing handshake was completed, the WebSocket connection + // is said to have been closed _cleanly_. + const wasClean = ws[kSentClose] && ws[kReceivedClose] + + let code = 1005 + let reason = '' + + const result = ws[kByteParser].closingInfo + + if (result) { + code = result.code ?? 1005 + reason = result.reason + } else if (!ws[kSentClose]) { + // If _The WebSocket + // Connection is Closed_ and no Close control frame was received by the + // endpoint (such as could occur if the underlying transport connection + // is lost), _The WebSocket Connection Close Code_ is considered to be + // 1006. + code = 1006 + } + + // 1. Change the ready state to CLOSED (3). + ws[kReadyState] = states.CLOSED + + // 2. If the user agent was required to fail the WebSocket + // connection, or if the WebSocket connection was closed + // after being flagged as full, fire an event named error + // at the WebSocket object. + // TODO + + // 3. Fire an event named close at the WebSocket object, + // using CloseEvent, with the wasClean attribute + // initialized to true if the connection closed cleanly + // and false otherwise, the code attribute initialized to + // the WebSocket connection close code, and the reason + // attribute initialized to the result of applying UTF-8 + // decode without BOM to the WebSocket connection close + // reason. + fireEvent('close', ws, CloseEvent, { + wasClean, code, reason + }) -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -const SEMVER_SPEC_VERSION = '2.0.0' + if (channels.close.hasSubscribers) { + channels.close.publish({ + websocket: ws, + code, + reason + }) + } +} -const MAX_LENGTH = 256 -const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || -/* istanbul ignore next */ 9007199254740991 +function onSocketError (error) { + const { ws } = this -// Max safe segment length for coercion. -const MAX_SAFE_COMPONENT_LENGTH = 16 + ws[kReadyState] = states.CLOSING -// Max safe length for a build identifier. The max length minus 6 characters for -// the shortest version with a build 0.0.0+BUILD. -const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + if (channels.socketError.hasSubscribers) { + channels.socketError.publish(error) + } -const RELEASE_TYPES = [ - 'major', - 'premajor', - 'minor', - 'preminor', - 'patch', - 'prepatch', - 'prerelease', -] + this.destroy() +} module.exports = { - MAX_LENGTH, - MAX_SAFE_COMPONENT_LENGTH, - MAX_SAFE_BUILD_LENGTH, - MAX_SAFE_INTEGER, - RELEASE_TYPES, - SEMVER_SPEC_VERSION, - FLAG_INCLUDE_PRERELEASE: 0b001, - FLAG_LOOSE: 0b010, + establishWebSocketConnection } /***/ }), -/***/ 106: +/***/ 9188: /***/ ((module) => { -const debug = ( - typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG) -) ? (...args) => console.error('SEMVER', ...args) - : () => {} +"use strict"; -module.exports = debug +// This is a Globally Unique Identifier unique used +// to validate that the endpoint accepts websocket +// connections. +// See https://www.rfc-editor.org/rfc/rfc6455.html#section-1.3 +const uid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11' -/***/ }), +/** @type {PropertyDescriptor} */ +const staticPropertyDescriptors = { + enumerable: true, + writable: false, + configurable: false +} -/***/ 2463: -/***/ ((module) => { +const states = { + CONNECTING: 0, + OPEN: 1, + CLOSING: 2, + CLOSED: 3 +} -const numeric = /^[0-9]+$/ -const compareIdentifiers = (a, b) => { - const anum = numeric.test(a) - const bnum = numeric.test(b) +const opcodes = { + CONTINUATION: 0x0, + TEXT: 0x1, + BINARY: 0x2, + CLOSE: 0x8, + PING: 0x9, + PONG: 0xA +} - if (anum && bnum) { - a = +a - b = +b - } +const maxUnsigned16Bit = 2 ** 16 - 1 // 65535 - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 +const parserStates = { + INFO: 0, + PAYLOADLENGTH_16: 2, + PAYLOADLENGTH_64: 3, + READ_DATA: 4 } -const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) +const emptyBuffer = Buffer.allocUnsafe(0) module.exports = { - compareIdentifiers, - rcompareIdentifiers, + uid, + staticPropertyDescriptors, + states, + opcodes, + maxUnsigned16Bit, + parserStates, + emptyBuffer } /***/ }), -/***/ 785: -/***/ ((module) => { +/***/ 2611: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -// parse out just the options we care about -const looseOption = Object.freeze({ loose: true }) -const emptyOpts = Object.freeze({ }) -const parseOptions = options => { - if (!options) { - return emptyOpts - } +"use strict"; - if (typeof options !== 'object') { - return looseOption - } - return options -} -module.exports = parseOptions +const { webidl } = __nccwpck_require__(1744) +const { kEnumerableProperty } = __nccwpck_require__(3983) +const { MessagePort } = __nccwpck_require__(1267) +/** + * @see https://html.spec.whatwg.org/multipage/comms.html#messageevent + */ +class MessageEvent extends Event { + #eventInit -/***/ }), + constructor (type, eventInitDict = {}) { + webidl.argumentLengthCheck(arguments, 1, { header: 'MessageEvent constructor' }) -/***/ 9523: -/***/ ((module, exports, __nccwpck_require__) => { + type = webidl.converters.DOMString(type) + eventInitDict = webidl.converters.MessageEventInit(eventInitDict) -const { - MAX_SAFE_COMPONENT_LENGTH, - MAX_SAFE_BUILD_LENGTH, - MAX_LENGTH, -} = __nccwpck_require__(2293) -const debug = __nccwpck_require__(106) -exports = module.exports = {} + super(type, eventInitDict) -// The actual regexps go on exports.re -const re = exports.re = [] -const safeRe = exports.safeRe = [] -const src = exports.src = [] -const t = exports.t = {} -let R = 0 + this.#eventInit = eventInitDict + } -const LETTERDASHNUMBER = '[a-zA-Z0-9-]' + get data () { + webidl.brandCheck(this, MessageEvent) -// Replace some greedy regex tokens to prevent regex dos issues. These regex are -// used internally via the safeRe object since all inputs in this library get -// normalized first to trim and collapse all extra whitespace. The original -// regexes are exported for userland consumption and lower level usage. A -// future breaking change could export the safer regex only with a note that -// all input should have extra whitespace removed. -const safeRegexReplacements = [ - ['\\s', 1], - ['\\d', MAX_LENGTH], - [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], -] + return this.#eventInit.data + } -const makeSafeRegex = (value) => { - for (const [token, max] of safeRegexReplacements) { - value = value - .split(`${token}*`).join(`${token}{0,${max}}`) - .split(`${token}+`).join(`${token}{1,${max}}`) + get origin () { + webidl.brandCheck(this, MessageEvent) + + return this.#eventInit.origin } - return value -} -const createToken = (name, value, isGlobal) => { - const safe = makeSafeRegex(value) - const index = R++ - debug(name, index, value) - t[name] = index - src[index] = value - re[index] = new RegExp(value, isGlobal ? 'g' : undefined) - safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined) -} + get lastEventId () { + webidl.brandCheck(this, MessageEvent) -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. + return this.#eventInit.lastEventId + } -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. + get source () { + webidl.brandCheck(this, MessageEvent) -createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') -createToken('NUMERICIDENTIFIERLOOSE', '\\d+') + return this.#eventInit.source + } -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. + get ports () { + webidl.brandCheck(this, MessageEvent) -createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`) + if (!Object.isFrozen(this.#eventInit.ports)) { + Object.freeze(this.#eventInit.ports) + } -// ## Main Version -// Three dot-separated numeric identifiers. + return this.#eventInit.ports + } -createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})`) + initMessageEvent ( + type, + bubbles = false, + cancelable = false, + data = null, + origin = '', + lastEventId = '', + source = null, + ports = [] + ) { + webidl.brandCheck(this, MessageEvent) -createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})`) + webidl.argumentLengthCheck(arguments, 1, { header: 'MessageEvent.initMessageEvent' }) -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. + return new MessageEvent(type, { + bubbles, cancelable, data, origin, lastEventId, source, ports + }) + } +} -createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] -}|${src[t.NONNUMERICIDENTIFIER]})`) +/** + * @see https://websockets.spec.whatwg.org/#the-closeevent-interface + */ +class CloseEvent extends Event { + #eventInit -createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] -}|${src[t.NONNUMERICIDENTIFIER]})`) + constructor (type, eventInitDict = {}) { + webidl.argumentLengthCheck(arguments, 1, { header: 'CloseEvent constructor' }) -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. + type = webidl.converters.DOMString(type) + eventInitDict = webidl.converters.CloseEventInit(eventInitDict) -createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] -}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) + super(type, eventInitDict) -createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] -}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) + this.#eventInit = eventInitDict + } -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. + get wasClean () { + webidl.brandCheck(this, CloseEvent) -createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`) + return this.#eventInit.wasClean + } -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. + get code () { + webidl.brandCheck(this, CloseEvent) -createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] -}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) + return this.#eventInit.code + } -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. + get reason () { + webidl.brandCheck(this, CloseEvent) -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. + return this.#eventInit.reason + } +} -createToken('FULLPLAIN', `v?${src[t.MAINVERSION] -}${src[t.PRERELEASE]}?${ - src[t.BUILD]}?`) +// https://html.spec.whatwg.org/multipage/webappapis.html#the-errorevent-interface +class ErrorEvent extends Event { + #eventInit -createToken('FULL', `^${src[t.FULLPLAIN]}$`) + constructor (type, eventInitDict) { + webidl.argumentLengthCheck(arguments, 1, { header: 'ErrorEvent constructor' }) -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] -}${src[t.PRERELEASELOOSE]}?${ - src[t.BUILD]}?`) + super(type, eventInitDict) -createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) + type = webidl.converters.DOMString(type) + eventInitDict = webidl.converters.ErrorEventInit(eventInitDict ?? {}) -createToken('GTLT', '((?:<|>)?=?)') + this.#eventInit = eventInitDict + } -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) -createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) + get message () { + webidl.brandCheck(this, ErrorEvent) -createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + - `(?:${src[t.PRERELEASE]})?${ - src[t.BUILD]}?` + - `)?)?`) + return this.#eventInit.message + } -createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:${src[t.PRERELEASELOOSE]})?${ - src[t.BUILD]}?` + - `)?)?`) + get filename () { + webidl.brandCheck(this, ErrorEvent) -createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) -createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) + return this.#eventInit.filename + } -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -createToken('COERCE', `${'(^|[^\\d])' + - '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + - `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + - `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + - `(?:$|[^\\d])`) -createToken('COERCERTL', src[t.COERCE], true) + get lineno () { + webidl.brandCheck(this, ErrorEvent) -// Tilde ranges. -// Meaning is "reasonably at or greater than" -createToken('LONETILDE', '(?:~>?)') + return this.#eventInit.lineno + } -createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) -exports.tildeTrimReplace = '$1~' + get colno () { + webidl.brandCheck(this, ErrorEvent) -createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) -createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) + return this.#eventInit.colno + } -// Caret ranges. -// Meaning is "at least and backwards compatible with" -createToken('LONECARET', '(?:\\^)') + get error () { + webidl.brandCheck(this, ErrorEvent) -createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) -exports.caretTrimReplace = '$1^' + return this.#eventInit.error + } +} -createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) -createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) +Object.defineProperties(MessageEvent.prototype, { + [Symbol.toStringTag]: { + value: 'MessageEvent', + configurable: true + }, + data: kEnumerableProperty, + origin: kEnumerableProperty, + lastEventId: kEnumerableProperty, + source: kEnumerableProperty, + ports: kEnumerableProperty, + initMessageEvent: kEnumerableProperty +}) + +Object.defineProperties(CloseEvent.prototype, { + [Symbol.toStringTag]: { + value: 'CloseEvent', + configurable: true + }, + reason: kEnumerableProperty, + code: kEnumerableProperty, + wasClean: kEnumerableProperty +}) + +Object.defineProperties(ErrorEvent.prototype, { + [Symbol.toStringTag]: { + value: 'ErrorEvent', + configurable: true + }, + message: kEnumerableProperty, + filename: kEnumerableProperty, + lineno: kEnumerableProperty, + colno: kEnumerableProperty, + error: kEnumerableProperty +}) -// A simple gt/lt/eq thing, or just "" to indicate "any version" -createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) -createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) +webidl.converters.MessagePort = webidl.interfaceConverter(MessagePort) -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] -}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) -exports.comparatorTrimReplace = '$1$2$3' +webidl.converters['sequence'] = webidl.sequenceConverter( + webidl.converters.MessagePort +) -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAIN]})` + - `\\s*$`) +const eventInit = [ + { + key: 'bubbles', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'cancelable', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'composed', + converter: webidl.converters.boolean, + defaultValue: false + } +] -createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAINLOOSE]})` + - `\\s*$`) +webidl.converters.MessageEventInit = webidl.dictionaryConverter([ + ...eventInit, + { + key: 'data', + converter: webidl.converters.any, + defaultValue: null + }, + { + key: 'origin', + converter: webidl.converters.USVString, + defaultValue: '' + }, + { + key: 'lastEventId', + converter: webidl.converters.DOMString, + defaultValue: '' + }, + { + key: 'source', + // Node doesn't implement WindowProxy or ServiceWorker, so the only + // valid value for source is a MessagePort. + converter: webidl.nullableConverter(webidl.converters.MessagePort), + defaultValue: null + }, + { + key: 'ports', + converter: webidl.converters['sequence'], + get defaultValue () { + return [] + } + } +]) + +webidl.converters.CloseEventInit = webidl.dictionaryConverter([ + ...eventInit, + { + key: 'wasClean', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'code', + converter: webidl.converters['unsigned short'], + defaultValue: 0 + }, + { + key: 'reason', + converter: webidl.converters.USVString, + defaultValue: '' + } +]) + +webidl.converters.ErrorEventInit = webidl.dictionaryConverter([ + ...eventInit, + { + key: 'message', + converter: webidl.converters.DOMString, + defaultValue: '' + }, + { + key: 'filename', + converter: webidl.converters.USVString, + defaultValue: '' + }, + { + key: 'lineno', + converter: webidl.converters['unsigned long'], + defaultValue: 0 + }, + { + key: 'colno', + converter: webidl.converters['unsigned long'], + defaultValue: 0 + }, + { + key: 'error', + converter: webidl.converters.any + } +]) -// Star ranges basically just allow anything at all. -createToken('STAR', '(<|>)?=?\\s*\\*') -// >=0.0.0 is like a star -createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$') -createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$') +module.exports = { + MessageEvent, + CloseEvent, + ErrorEvent +} /***/ }), -/***/ 9380: +/***/ 5444: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -// Determine if version is greater than all the versions possible in the range. -const outside = __nccwpck_require__(420) -const gtr = (version, range, options) => outside(version, range, '>', options) -module.exports = gtr +"use strict"; -/***/ }), +const { maxUnsigned16Bit } = __nccwpck_require__(9188) -/***/ 7008: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/** @type {import('crypto')} */ +let crypto +try { + crypto = __nccwpck_require__(6113) +} catch { -const Range = __nccwpck_require__(9828) -const intersects = (r1, r2, options) => { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2, options) } -module.exports = intersects +class WebsocketFrameSend { + /** + * @param {Buffer|undefined} data + */ + constructor (data) { + this.frameData = data + this.maskKey = crypto.randomBytes(4) + } -/***/ }), + createFrame (opcode) { + const bodyLength = this.frameData?.byteLength ?? 0 -/***/ 3323: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + /** @type {number} */ + let payloadLength = bodyLength // 0-125 + let offset = 6 -const outside = __nccwpck_require__(420) -// Determine if version is less than all the versions possible in the range -const ltr = (version, range, options) => outside(version, range, '<', options) -module.exports = ltr + if (bodyLength > maxUnsigned16Bit) { + offset += 8 // payload length is next 8 bytes + payloadLength = 127 + } else if (bodyLength > 125) { + offset += 2 // payload length is next 2 bytes + payloadLength = 126 + } + const buffer = Buffer.allocUnsafe(bodyLength + offset) -/***/ }), + // Clear first 2 bytes, everything else is overwritten + buffer[0] = buffer[1] = 0 + buffer[0] |= 0x80 // FIN + buffer[0] = (buffer[0] & 0xF0) + opcode // opcode -/***/ 579: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + /*! ws. MIT License. Einar Otto Stangvik */ + buffer[offset - 4] = this.maskKey[0] + buffer[offset - 3] = this.maskKey[1] + buffer[offset - 2] = this.maskKey[2] + buffer[offset - 1] = this.maskKey[3] -const SemVer = __nccwpck_require__(8088) -const Range = __nccwpck_require__(9828) + buffer[1] = payloadLength -const maxSatisfying = (versions, range, options) => { - let max = null - let maxSV = null - let rangeObj = null - try { - rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach((v) => { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) - } + if (payloadLength === 126) { + buffer.writeUInt16BE(bodyLength, 2) + } else if (payloadLength === 127) { + // Clear extended payload length + buffer[2] = buffer[3] = 0 + buffer.writeUIntBE(bodyLength, 4, 6) } - }) - return max -} -module.exports = maxSatisfying - -/***/ }), + buffer[1] |= 0x80 // MASK -/***/ 832: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // mask body + for (let i = 0; i < bodyLength; i++) { + buffer[offset + i] = this.frameData[i] ^ this.maskKey[i % 4] + } -const SemVer = __nccwpck_require__(8088) -const Range = __nccwpck_require__(9828) -const minSatisfying = (versions, range, options) => { - let min = null - let minSV = null - let rangeObj = null - try { - rangeObj = new Range(range, options) - } catch (er) { - return null + return buffer } - versions.forEach((v) => { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } - } - }) - return min } -module.exports = minSatisfying + +module.exports = { + WebsocketFrameSend +} /***/ }), -/***/ 4179: +/***/ 1688: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(8088) -const Range = __nccwpck_require__(9828) -const gt = __nccwpck_require__(4123) +"use strict"; -const minVersion = (range, loose) => { - range = new Range(range, loose) - let minver = new SemVer('0.0.0') - if (range.test(minver)) { - return minver +const { Writable } = __nccwpck_require__(2781) +const diagnosticsChannel = __nccwpck_require__(7643) +const { parserStates, opcodes, states, emptyBuffer } = __nccwpck_require__(9188) +const { kReadyState, kSentClose, kResponse, kReceivedClose } = __nccwpck_require__(7578) +const { isValidStatusCode, failWebsocketConnection, websocketMessageReceived } = __nccwpck_require__(5515) +const { WebsocketFrameSend } = __nccwpck_require__(5444) + +// This code was influenced by ws released under the MIT license. +// Copyright (c) 2011 Einar Otto Stangvik +// Copyright (c) 2013 Arnout Kazemier and contributors +// Copyright (c) 2016 Luigi Pinca and contributors + +const channels = {} +channels.ping = diagnosticsChannel.channel('undici:websocket:ping') +channels.pong = diagnosticsChannel.channel('undici:websocket:pong') + +class ByteParser extends Writable { + #buffers = [] + #byteOffset = 0 + + #state = parserStates.INFO + + #info = {} + #fragments = [] + + constructor (ws) { + super() + + this.ws = ws } - minver = new SemVer('0.0.0-0') - if (range.test(minver)) { - return minver + /** + * @param {Buffer} chunk + * @param {() => void} callback + */ + _write (chunk, _, callback) { + this.#buffers.push(chunk) + this.#byteOffset += chunk.length + + this.run(callback) } - minver = null - for (let i = 0; i < range.set.length; ++i) { - const comparators = range.set[i] + /** + * Runs whenever a new chunk is received. + * Callback is called whenever there are no more chunks buffering, + * or not enough bytes are buffered to parse. + */ + run (callback) { + while (true) { + if (this.#state === parserStates.INFO) { + // If there aren't enough bytes to parse the payload length, etc. + if (this.#byteOffset < 2) { + return callback() + } - let setMin = null - comparators.forEach((comparator) => { - // Clone to avoid manipulating the comparator's semver object. - const compver = new SemVer(comparator.semver.version) - switch (comparator.operator) { - case '>': - if (compver.prerelease.length === 0) { - compver.patch++ - } else { - compver.prerelease.push(0) - } - compver.raw = compver.format() - /* fallthrough */ - case '': - case '>=': - if (!setMin || gt(compver, setMin)) { - setMin = compver + const buffer = this.consume(2) + + this.#info.fin = (buffer[0] & 0x80) !== 0 + this.#info.opcode = buffer[0] & 0x0F + + // If we receive a fragmented message, we use the type of the first + // frame to parse the full message as binary/text, when it's terminated + this.#info.originalOpcode ??= this.#info.opcode + + this.#info.fragmented = !this.#info.fin && this.#info.opcode !== opcodes.CONTINUATION + + if (this.#info.fragmented && this.#info.opcode !== opcodes.BINARY && this.#info.opcode !== opcodes.TEXT) { + // Only text and binary frames can be fragmented + failWebsocketConnection(this.ws, 'Invalid frame type was fragmented.') + return + } + + const payloadLength = buffer[1] & 0x7F + + if (payloadLength <= 125) { + this.#info.payloadLength = payloadLength + this.#state = parserStates.READ_DATA + } else if (payloadLength === 126) { + this.#state = parserStates.PAYLOADLENGTH_16 + } else if (payloadLength === 127) { + this.#state = parserStates.PAYLOADLENGTH_64 + } + + if (this.#info.fragmented && payloadLength > 125) { + // A fragmented frame can't be fragmented itself + failWebsocketConnection(this.ws, 'Fragmented frame exceeded 125 bytes.') + return + } else if ( + (this.#info.opcode === opcodes.PING || + this.#info.opcode === opcodes.PONG || + this.#info.opcode === opcodes.CLOSE) && + payloadLength > 125 + ) { + // Control frames can have a payload length of 125 bytes MAX + failWebsocketConnection(this.ws, 'Payload length for control frame exceeded 125 bytes.') + return + } else if (this.#info.opcode === opcodes.CLOSE) { + if (payloadLength === 1) { + failWebsocketConnection(this.ws, 'Received close frame with a 1-byte body.') + return } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - default: - throw new Error(`Unexpected operation: ${comparator.operator}`) - } - }) - if (setMin && (!minver || gt(minver, setMin))) { - minver = setMin - } - } - if (minver && range.test(minver)) { - return minver - } + const body = this.consume(payloadLength) - return null -} -module.exports = minVersion + this.#info.closeInfo = this.parseCloseBody(false, body) + if (!this.ws[kSentClose]) { + // If an endpoint receives a Close frame and did not previously send a + // Close frame, the endpoint MUST send a Close frame in response. (When + // sending a Close frame in response, the endpoint typically echos the + // status code it received.) + const body = Buffer.allocUnsafe(2) + body.writeUInt16BE(this.#info.closeInfo.code, 0) + const closeFrame = new WebsocketFrameSend(body) -/***/ }), + this.ws[kResponse].socket.write( + closeFrame.createFrame(opcodes.CLOSE), + (err) => { + if (!err) { + this.ws[kSentClose] = true + } + } + ) + } -/***/ 420: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // Upon either sending or receiving a Close control frame, it is said + // that _The WebSocket Closing Handshake is Started_ and that the + // WebSocket connection is in the CLOSING state. + this.ws[kReadyState] = states.CLOSING + this.ws[kReceivedClose] = true -const SemVer = __nccwpck_require__(8088) -const Comparator = __nccwpck_require__(1532) -const { ANY } = Comparator -const Range = __nccwpck_require__(9828) -const satisfies = __nccwpck_require__(6055) -const gt = __nccwpck_require__(4123) -const lt = __nccwpck_require__(194) -const lte = __nccwpck_require__(7520) -const gte = __nccwpck_require__(5522) + this.end() -const outside = (version, range, hilo, options) => { - version = new SemVer(version, options) - range = new Range(range, options) + return + } else if (this.#info.opcode === opcodes.PING) { + // Upon receipt of a Ping frame, an endpoint MUST send a Pong frame in + // response, unless it already received a Close frame. + // A Pong frame sent in response to a Ping frame must have identical + // "Application data" - let gtfn, ltefn, ltfn, comp, ecomp - switch (hilo) { - case '>': - gtfn = gt - ltefn = lte - ltfn = lt - comp = '>' - ecomp = '>=' - break - case '<': - gtfn = lt - ltefn = gte - ltfn = gt - comp = '<' - ecomp = '<=' - break - default: - throw new TypeError('Must provide a hilo val of "<" or ">"') - } + const body = this.consume(payloadLength) - // If it satisfies the range it is not outside - if (satisfies(version, range, options)) { - return false - } + if (!this.ws[kReceivedClose]) { + const frame = new WebsocketFrameSend(body) - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. + this.ws[kResponse].socket.write(frame.createFrame(opcodes.PONG)) - for (let i = 0; i < range.set.length; ++i) { - const comparators = range.set[i] + if (channels.ping.hasSubscribers) { + channels.ping.publish({ + payload: body + }) + } + } - let high = null - let low = null + this.#state = parserStates.INFO - comparators.forEach((comparator) => { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') - } - high = high || comparator - low = low || comparator - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator - } - }) + if (this.#byteOffset > 0) { + continue + } else { + callback() + return + } + } else if (this.#info.opcode === opcodes.PONG) { + // A Pong frame MAY be sent unsolicited. This serves as a + // unidirectional heartbeat. A response to an unsolicited Pong frame is + // not expected. - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false - } + const body = this.consume(payloadLength) - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false - } - } - return true -} + if (channels.pong.hasSubscribers) { + channels.pong.publish({ + payload: body + }) + } -module.exports = outside + if (this.#byteOffset > 0) { + continue + } else { + callback() + return + } + } + } else if (this.#state === parserStates.PAYLOADLENGTH_16) { + if (this.#byteOffset < 2) { + return callback() + } + const buffer = this.consume(2) -/***/ }), + this.#info.payloadLength = buffer.readUInt16BE(0) + this.#state = parserStates.READ_DATA + } else if (this.#state === parserStates.PAYLOADLENGTH_64) { + if (this.#byteOffset < 8) { + return callback() + } -/***/ 5297: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + const buffer = this.consume(8) + const upper = buffer.readUInt32BE(0) -// given a set of versions and a range, create a "simplified" range -// that includes the same versions that the original range does -// If the original range is shorter than the simplified one, return that. -const satisfies = __nccwpck_require__(6055) -const compare = __nccwpck_require__(4309) -module.exports = (versions, range, options) => { - const set = [] - let first = null - let prev = null - const v = versions.sort((a, b) => compare(a, b, options)) - for (const version of v) { - const included = satisfies(version, range, options) - if (included) { - prev = version - if (!first) { - first = version - } - } else { - if (prev) { - set.push([first, prev]) - } - prev = null - first = null - } - } - if (first) { - set.push([first, null]) - } + // 2^31 is the maxinimum bytes an arraybuffer can contain + // on 32-bit systems. Although, on 64-bit systems, this is + // 2^53-1 bytes. + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_array_length + // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/common/globals.h;drc=1946212ac0100668f14eb9e2843bdd846e510a1e;bpv=1;bpt=1;l=1275 + // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/objects/js-array-buffer.h;l=34;drc=1946212ac0100668f14eb9e2843bdd846e510a1e + if (upper > 2 ** 31 - 1) { + failWebsocketConnection(this.ws, 'Received payload length > 2^31 bytes.') + return + } - const ranges = [] - for (const [min, max] of set) { - if (min === max) { - ranges.push(min) - } else if (!max && min === v[0]) { - ranges.push('*') - } else if (!max) { - ranges.push(`>=${min}`) - } else if (min === v[0]) { - ranges.push(`<=${max}`) - } else { - ranges.push(`${min} - ${max}`) - } - } - const simplified = ranges.join(' || ') - const original = typeof range.raw === 'string' ? range.raw : String(range) - return simplified.length < original.length ? simplified : range -} + const lower = buffer.readUInt32BE(4) + this.#info.payloadLength = (upper << 8) + lower + this.#state = parserStates.READ_DATA + } else if (this.#state === parserStates.READ_DATA) { + if (this.#byteOffset < this.#info.payloadLength) { + // If there is still more data in this chunk that needs to be read + return callback() + } else if (this.#byteOffset >= this.#info.payloadLength) { + // If the server sent multiple frames in a single chunk -/***/ }), + const body = this.consume(this.#info.payloadLength) -/***/ 7863: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + this.#fragments.push(body) -const Range = __nccwpck_require__(9828) -const Comparator = __nccwpck_require__(1532) -const { ANY } = Comparator -const satisfies = __nccwpck_require__(6055) -const compare = __nccwpck_require__(4309) + // If the frame is unfragmented, or a fragmented frame was terminated, + // a message was received + if (!this.#info.fragmented || (this.#info.fin && this.#info.opcode === opcodes.CONTINUATION)) { + const fullMessage = Buffer.concat(this.#fragments) -// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: -// - Every simple range `r1, r2, ...` is a null set, OR -// - Every simple range `r1, r2, ...` which is not a null set is a subset of -// some `R1, R2, ...` -// -// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: -// - If c is only the ANY comparator -// - If C is only the ANY comparator, return true -// - Else if in prerelease mode, return false -// - else replace c with `[>=0.0.0]` -// - If C is only the ANY comparator -// - if in prerelease mode, return true -// - else replace C with `[>=0.0.0]` -// - Let EQ be the set of = comparators in c -// - If EQ is more than one, return true (null set) -// - Let GT be the highest > or >= comparator in c -// - Let LT be the lowest < or <= comparator in c -// - If GT and LT, and GT.semver > LT.semver, return true (null set) -// - If any C is a = range, and GT or LT are set, return false -// - If EQ -// - If GT, and EQ does not satisfy GT, return true (null set) -// - If LT, and EQ does not satisfy LT, return true (null set) -// - If EQ satisfies every C, return true -// - Else return false -// - If GT -// - If GT.semver is lower than any > or >= comp in C, return false -// - If GT is >=, and GT.semver does not satisfy every C, return false -// - If GT.semver has a prerelease, and not in prerelease mode -// - If no C has a prerelease and the GT.semver tuple, return false -// - If LT -// - If LT.semver is greater than any < or <= comp in C, return false -// - If LT is <=, and LT.semver does not satisfy every C, return false -// - If GT.semver has a prerelease, and not in prerelease mode -// - If no C has a prerelease and the LT.semver tuple, return false -// - Else return true + websocketMessageReceived(this.ws, this.#info.originalOpcode, fullMessage) -const subset = (sub, dom, options = {}) => { - if (sub === dom) { - return true - } + this.#info = {} + this.#fragments.length = 0 + } - sub = new Range(sub, options) - dom = new Range(dom, options) - let sawNonNull = false + this.#state = parserStates.INFO + } + } - OUTER: for (const simpleSub of sub.set) { - for (const simpleDom of dom.set) { - const isSub = simpleSubset(simpleSub, simpleDom, options) - sawNonNull = sawNonNull || isSub !== null - if (isSub) { - continue OUTER + if (this.#byteOffset > 0) { + continue + } else { + callback() + break } } - // the null set is a subset of everything, but null simple ranges in - // a complex range should be ignored. so if we saw a non-null range, - // then we know this isn't a subset, but if EVERY simple range was null, - // then it is a subset. - if (sawNonNull) { - return false - } } - return true -} - -const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')] -const minimumVersion = [new Comparator('>=0.0.0')] -const simpleSubset = (sub, dom, options) => { - if (sub === dom) { - return true - } + /** + * Take n bytes from the buffered Buffers + * @param {number} n + * @returns {Buffer|null} + */ + consume (n) { + if (n > this.#byteOffset) { + return null + } else if (n === 0) { + return emptyBuffer + } - if (sub.length === 1 && sub[0].semver === ANY) { - if (dom.length === 1 && dom[0].semver === ANY) { - return true - } else if (options.includePrerelease) { - sub = minimumVersionWithPreRelease - } else { - sub = minimumVersion + if (this.#buffers[0].length === n) { + this.#byteOffset -= this.#buffers[0].length + return this.#buffers.shift() } - } - if (dom.length === 1 && dom[0].semver === ANY) { - if (options.includePrerelease) { - return true - } else { - dom = minimumVersion + const buffer = Buffer.allocUnsafe(n) + let offset = 0 + + while (offset !== n) { + const next = this.#buffers[0] + const { length } = next + + if (length + offset === n) { + buffer.set(this.#buffers.shift(), offset) + break + } else if (length + offset > n) { + buffer.set(next.subarray(0, n - offset), offset) + this.#buffers[0] = next.subarray(n - offset) + break + } else { + buffer.set(this.#buffers.shift(), offset) + offset += next.length + } } + + this.#byteOffset -= n + + return buffer } - const eqSet = new Set() - let gt, lt - for (const c of sub) { - if (c.operator === '>' || c.operator === '>=') { - gt = higherGT(gt, c, options) - } else if (c.operator === '<' || c.operator === '<=') { - lt = lowerLT(lt, c, options) - } else { - eqSet.add(c.semver) + parseCloseBody (onlyCode, data) { + // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5 + /** @type {number|undefined} */ + let code + + if (data.length >= 2) { + // _The WebSocket Connection Close Code_ is + // defined as the status code (Section 7.4) contained in the first Close + // control frame received by the application + code = data.readUInt16BE(0) } - } - if (eqSet.size > 1) { - return null - } + if (onlyCode) { + if (!isValidStatusCode(code)) { + return null + } - let gtltComp - if (gt && lt) { - gtltComp = compare(gt.semver, lt.semver, options) - if (gtltComp > 0) { - return null - } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { - return null + return { code } } - } - // will iterate one or zero times - for (const eq of eqSet) { - if (gt && !satisfies(eq, String(gt), options)) { - return null + // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.6 + /** @type {Buffer} */ + let reason = data.subarray(2) + + // Remove BOM + if (reason[0] === 0xEF && reason[1] === 0xBB && reason[2] === 0xBF) { + reason = reason.subarray(3) } - if (lt && !satisfies(eq, String(lt), options)) { + if (code !== undefined && !isValidStatusCode(code)) { return null } - for (const c of dom) { - if (!satisfies(eq, String(c), options)) { - return false - } + try { + // TODO: optimize this + reason = new TextDecoder('utf-8', { fatal: true }).decode(reason) + } catch { + return null } - return true + return { code, reason } } - let higher, lower - let hasDomLT, hasDomGT - // if the subset has a prerelease, we need a comparator in the superset - // with the same tuple and a prerelease, or it's not a subset - let needDomLTPre = lt && - !options.includePrerelease && - lt.semver.prerelease.length ? lt.semver : false - let needDomGTPre = gt && - !options.includePrerelease && - gt.semver.prerelease.length ? gt.semver : false - // exception: <1.2.3-0 is the same as <1.2.3 - if (needDomLTPre && needDomLTPre.prerelease.length === 1 && - lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { - needDomLTPre = false + get closingInfo () { + return this.#info.closeInfo } +} - for (const c of dom) { - hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' - hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' - if (gt) { - if (needDomGTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && - c.semver.major === needDomGTPre.major && - c.semver.minor === needDomGTPre.minor && - c.semver.patch === needDomGTPre.patch) { - needDomGTPre = false - } - } - if (c.operator === '>' || c.operator === '>=') { - higher = higherGT(gt, c, options) - if (higher === c && higher !== gt) { - return false - } - } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { - return false - } - } - if (lt) { - if (needDomLTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && - c.semver.major === needDomLTPre.major && - c.semver.minor === needDomLTPre.minor && - c.semver.patch === needDomLTPre.patch) { - needDomLTPre = false - } - } - if (c.operator === '<' || c.operator === '<=') { - lower = lowerLT(lt, c, options) - if (lower === c && lower !== lt) { - return false - } - } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) { - return false - } +module.exports = { + ByteParser +} + + +/***/ }), + +/***/ 7578: +/***/ ((module) => { + +"use strict"; + + +module.exports = { + kWebSocketURL: Symbol('url'), + kReadyState: Symbol('ready state'), + kController: Symbol('controller'), + kResponse: Symbol('response'), + kBinaryType: Symbol('binary type'), + kSentClose: Symbol('sent close'), + kReceivedClose: Symbol('received close'), + kByteParser: Symbol('byte parser') +} + + +/***/ }), + +/***/ 5515: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { kReadyState, kController, kResponse, kBinaryType, kWebSocketURL } = __nccwpck_require__(7578) +const { states, opcodes } = __nccwpck_require__(9188) +const { MessageEvent, ErrorEvent } = __nccwpck_require__(2611) + +/* globals Blob */ + +/** + * @param {import('./websocket').WebSocket} ws + */ +function isEstablished (ws) { + // If the server's response is validated as provided for above, it is + // said that _The WebSocket Connection is Established_ and that the + // WebSocket Connection is in the OPEN state. + return ws[kReadyState] === states.OPEN +} + +/** + * @param {import('./websocket').WebSocket} ws + */ +function isClosing (ws) { + // Upon either sending or receiving a Close control frame, it is said + // that _The WebSocket Closing Handshake is Started_ and that the + // WebSocket connection is in the CLOSING state. + return ws[kReadyState] === states.CLOSING +} + +/** + * @param {import('./websocket').WebSocket} ws + */ +function isClosed (ws) { + return ws[kReadyState] === states.CLOSED +} + +/** + * @see https://dom.spec.whatwg.org/#concept-event-fire + * @param {string} e + * @param {EventTarget} target + * @param {EventInit | undefined} eventInitDict + */ +function fireEvent (e, target, eventConstructor = Event, eventInitDict) { + // 1. If eventConstructor is not given, then let eventConstructor be Event. + + // 2. Let event be the result of creating an event given eventConstructor, + // in the relevant realm of target. + // 3. Initialize event’s type attribute to e. + const event = new eventConstructor(e, eventInitDict) // eslint-disable-line new-cap + + // 4. Initialize any other IDL attributes of event as described in the + // invocation of this algorithm. + + // 5. Return the result of dispatching event at target, with legacy target + // override flag set if set. + target.dispatchEvent(event) +} + +/** + * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol + * @param {import('./websocket').WebSocket} ws + * @param {number} type Opcode + * @param {Buffer} data application data + */ +function websocketMessageReceived (ws, type, data) { + // 1. If ready state is not OPEN (1), then return. + if (ws[kReadyState] !== states.OPEN) { + return + } + + // 2. Let dataForEvent be determined by switching on type and binary type: + let dataForEvent + + if (type === opcodes.TEXT) { + // -> type indicates that the data is Text + // a new DOMString containing data + try { + dataForEvent = new TextDecoder('utf-8', { fatal: true }).decode(data) + } catch { + failWebsocketConnection(ws, 'Received invalid UTF-8 in text frame.') + return } - if (!c.operator && (lt || gt) && gtltComp !== 0) { - return false + } else if (type === opcodes.BINARY) { + if (ws[kBinaryType] === 'blob') { + // -> type indicates that the data is Binary and binary type is "blob" + // a new Blob object, created in the relevant Realm of the WebSocket + // object, that represents data as its raw data + dataForEvent = new Blob([data]) + } else { + // -> type indicates that the data is Binary and binary type is "arraybuffer" + // a new ArrayBuffer object, created in the relevant Realm of the + // WebSocket object, whose contents are data + dataForEvent = new Uint8Array(data).buffer } } - // if there was a < or >, and nothing in the dom, then must be false - // UNLESS it was limited by another range in the other direction. - // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 - if (gt && hasDomLT && !lt && gtltComp !== 0) { - return false - } + // 3. Fire an event named message at the WebSocket object, using MessageEvent, + // with the origin attribute initialized to the serialization of the WebSocket + // object’s url's origin, and the data attribute initialized to dataForEvent. + fireEvent('message', ws, MessageEvent, { + origin: ws[kWebSocketURL].origin, + data: dataForEvent + }) +} - if (lt && hasDomGT && !gt && gtltComp !== 0) { +/** + * @see https://datatracker.ietf.org/doc/html/rfc6455 + * @see https://datatracker.ietf.org/doc/html/rfc2616 + * @see https://bugs.chromium.org/p/chromium/issues/detail?id=398407 + * @param {string} protocol + */ +function isValidSubprotocol (protocol) { + // If present, this value indicates one + // or more comma-separated subprotocol the client wishes to speak, + // ordered by preference. The elements that comprise this value + // MUST be non-empty strings with characters in the range U+0021 to + // U+007E not including separator characters as defined in + // [RFC2616] and MUST all be unique strings. + if (protocol.length === 0) { return false } - // we needed a prerelease range in a specific tuple, but didn't get one - // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, - // because it includes prereleases in the 1.2.3 tuple - if (needDomGTPre || needDomLTPre) { - return false + for (const char of protocol) { + const code = char.charCodeAt(0) + + if ( + code < 0x21 || + code > 0x7E || + char === '(' || + char === ')' || + char === '<' || + char === '>' || + char === '@' || + char === ',' || + char === ';' || + char === ':' || + char === '\\' || + char === '"' || + char === '/' || + char === '[' || + char === ']' || + char === '?' || + char === '=' || + char === '{' || + char === '}' || + code === 32 || // SP + code === 9 // HT + ) { + return false + } } return true } -// >=1.2.3 is lower than >1.2.3 -const higherGT = (a, b, options) => { - if (!a) { - return b +/** + * @see https://datatracker.ietf.org/doc/html/rfc6455#section-7-4 + * @param {number} code + */ +function isValidStatusCode (code) { + if (code >= 1000 && code < 1015) { + return ( + code !== 1004 && // reserved + code !== 1005 && // "MUST NOT be set as a status code" + code !== 1006 // "MUST NOT be set as a status code" + ) } - const comp = compare(a.semver, b.semver, options) - return comp > 0 ? a - : comp < 0 ? b - : b.operator === '>' && a.operator === '>=' ? b - : a + + return code >= 3000 && code <= 4999 } -// <=1.2.3 is higher than <1.2.3 -const lowerLT = (a, b, options) => { - if (!a) { - return b +/** + * @param {import('./websocket').WebSocket} ws + * @param {string|undefined} reason + */ +function failWebsocketConnection (ws, reason) { + const { [kController]: controller, [kResponse]: response } = ws + + controller.abort() + + if (response?.socket && !response.socket.destroyed) { + response.socket.destroy() + } + + if (reason) { + fireEvent('error', ws, ErrorEvent, { + error: new Error(reason) + }) } - const comp = compare(a.semver, b.semver, options) - return comp < 0 ? a - : comp > 0 ? b - : b.operator === '<' && a.operator === '<=' ? b - : a } -module.exports = subset +module.exports = { + isEstablished, + isClosing, + isClosed, + fireEvent, + isValidSubprotocol, + isValidStatusCode, + failWebsocketConnection, + websocketMessageReceived +} /***/ }), -/***/ 2706: +/***/ 4284: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const Range = __nccwpck_require__(9828) +"use strict"; -// Mostly just for testing and legacy API reasons -const toComparators = (range, options) => - new Range(range, options).set - .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) -module.exports = toComparators +const { webidl } = __nccwpck_require__(1744) +const { DOMException } = __nccwpck_require__(1037) +const { URLSerializer } = __nccwpck_require__(685) +const { getGlobalOrigin } = __nccwpck_require__(1246) +const { staticPropertyDescriptors, states, opcodes, emptyBuffer } = __nccwpck_require__(9188) +const { + kWebSocketURL, + kReadyState, + kController, + kBinaryType, + kResponse, + kSentClose, + kByteParser +} = __nccwpck_require__(7578) +const { isEstablished, isClosing, isValidSubprotocol, failWebsocketConnection, fireEvent } = __nccwpck_require__(5515) +const { establishWebSocketConnection } = __nccwpck_require__(5354) +const { WebsocketFrameSend } = __nccwpck_require__(5444) +const { ByteParser } = __nccwpck_require__(1688) +const { kEnumerableProperty, isBlobLike } = __nccwpck_require__(3983) +const { getGlobalDispatcher } = __nccwpck_require__(1892) +const { types } = __nccwpck_require__(3837) + +let experimentalWarned = false + +// https://websockets.spec.whatwg.org/#interface-definition +class WebSocket extends EventTarget { + #events = { + open: null, + error: null, + close: null, + message: null + } + + #bufferedAmount = 0 + #protocol = '' + #extensions = '' + + /** + * @param {string} url + * @param {string|string[]} protocols + */ + constructor (url, protocols = []) { + super() + + webidl.argumentLengthCheck(arguments, 1, { header: 'WebSocket constructor' }) + + if (!experimentalWarned) { + experimentalWarned = true + process.emitWarning('WebSockets are experimental, expect them to change at any time.', { + code: 'UNDICI-WS' + }) + } + const options = webidl.converters['DOMString or sequence or WebSocketInit'](protocols) -/***/ }), + url = webidl.converters.USVString(url) + protocols = options.protocols -/***/ 2098: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 1. Let baseURL be this's relevant settings object's API base URL. + const baseURL = getGlobalOrigin() -const Range = __nccwpck_require__(9828) -const validRange = (range, options) => { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null - } -} -module.exports = validRange + // 1. Let urlRecord be the result of applying the URL parser to url with baseURL. + let urlRecord + try { + urlRecord = new URL(url, baseURL) + } catch (e) { + // 3. If urlRecord is failure, then throw a "SyntaxError" DOMException. + throw new DOMException(e, 'SyntaxError') + } -/***/ }), + // 4. If urlRecord’s scheme is "http", then set urlRecord’s scheme to "ws". + if (urlRecord.protocol === 'http:') { + urlRecord.protocol = 'ws:' + } else if (urlRecord.protocol === 'https:') { + // 5. Otherwise, if urlRecord’s scheme is "https", set urlRecord’s scheme to "wss". + urlRecord.protocol = 'wss:' + } -/***/ 4294: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 6. If urlRecord’s scheme is not "ws" or "wss", then throw a "SyntaxError" DOMException. + if (urlRecord.protocol !== 'ws:' && urlRecord.protocol !== 'wss:') { + throw new DOMException( + `Expected a ws: or wss: protocol, got ${urlRecord.protocol}`, + 'SyntaxError' + ) + } -module.exports = __nccwpck_require__(4219); + // 7. If urlRecord’s fragment is non-null, then throw a "SyntaxError" + // DOMException. + if (urlRecord.hash || urlRecord.href.endsWith('#')) { + throw new DOMException('Got fragment', 'SyntaxError') + } + + // 8. If protocols is a string, set protocols to a sequence consisting + // of just that string. + if (typeof protocols === 'string') { + protocols = [protocols] + } + // 9. If any of the values in protocols occur more than once or otherwise + // fail to match the requirements for elements that comprise the value + // of `Sec-WebSocket-Protocol` fields as defined by The WebSocket + // protocol, then throw a "SyntaxError" DOMException. + if (protocols.length !== new Set(protocols.map(p => p.toLowerCase())).size) { + throw new DOMException('Invalid Sec-WebSocket-Protocol value', 'SyntaxError') + } -/***/ }), + if (protocols.length > 0 && !protocols.every(p => isValidSubprotocol(p))) { + throw new DOMException('Invalid Sec-WebSocket-Protocol value', 'SyntaxError') + } -/***/ 4219: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + // 10. Set this's url to urlRecord. + this[kWebSocketURL] = new URL(urlRecord.href) -"use strict"; + // 11. Let client be this's relevant settings object. + // 12. Run this step in parallel: -var net = __nccwpck_require__(1808); -var tls = __nccwpck_require__(4404); -var http = __nccwpck_require__(3685); -var https = __nccwpck_require__(5687); -var events = __nccwpck_require__(2361); -var assert = __nccwpck_require__(9491); -var util = __nccwpck_require__(3837); + // 1. Establish a WebSocket connection given urlRecord, protocols, + // and client. + this[kController] = establishWebSocketConnection( + urlRecord, + protocols, + this, + (response) => this.#onConnectionEstablished(response), + options + ) + // Each WebSocket object has an associated ready state, which is a + // number representing the state of the connection. Initially it must + // be CONNECTING (0). + this[kReadyState] = WebSocket.CONNECTING -exports.httpOverHttp = httpOverHttp; -exports.httpsOverHttp = httpsOverHttp; -exports.httpOverHttps = httpOverHttps; -exports.httpsOverHttps = httpsOverHttps; + // The extensions attribute must initially return the empty string. + // The protocol attribute must initially return the empty string. -function httpOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - return agent; -} + // Each WebSocket object has an associated binary type, which is a + // BinaryType. Initially it must be "blob". + this[kBinaryType] = 'blob' + } -function httpsOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - agent.createSocket = createSecureSocket; - agent.defaultPort = 443; - return agent; -} + /** + * @see https://websockets.spec.whatwg.org/#dom-websocket-close + * @param {number|undefined} code + * @param {string|undefined} reason + */ + close (code = undefined, reason = undefined) { + webidl.brandCheck(this, WebSocket) -function httpOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - return agent; -} + if (code !== undefined) { + code = webidl.converters['unsigned short'](code, { clamp: true }) + } -function httpsOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - agent.createSocket = createSecureSocket; - agent.defaultPort = 443; - return agent; -} + if (reason !== undefined) { + reason = webidl.converters.USVString(reason) + } + // 1. If code is present, but is neither an integer equal to 1000 nor an + // integer in the range 3000 to 4999, inclusive, throw an + // "InvalidAccessError" DOMException. + if (code !== undefined) { + if (code !== 1000 && (code < 3000 || code > 4999)) { + throw new DOMException('invalid code', 'InvalidAccessError') + } + } -function TunnelingAgent(options) { - var self = this; - self.options = options || {}; - self.proxyOptions = self.options.proxy || {}; - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; - self.requests = []; - self.sockets = []; + let reasonByteLength = 0 - self.on('free', function onFree(socket, host, port, localAddress) { - var options = toOptions(host, port, localAddress); - for (var i = 0, len = self.requests.length; i < len; ++i) { - var pending = self.requests[i]; - if (pending.host === options.host && pending.port === options.port) { - // Detect the request to connect same origin server, - // reuse the connection. - self.requests.splice(i, 1); - pending.request.onSocket(socket); - return; + // 2. If reason is present, then run these substeps: + if (reason !== undefined) { + // 1. Let reasonBytes be the result of encoding reason. + // 2. If reasonBytes is longer than 123 bytes, then throw a + // "SyntaxError" DOMException. + reasonByteLength = Buffer.byteLength(reason) + + if (reasonByteLength > 123) { + throw new DOMException( + `Reason must be less than 123 bytes; received ${reasonByteLength}`, + 'SyntaxError' + ) } } - socket.destroy(); - self.removeSocket(socket); - }); -} -util.inherits(TunnelingAgent, events.EventEmitter); -TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { - var self = this; - var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); + // 3. Run the first matching steps from the following list: + if (this[kReadyState] === WebSocket.CLOSING || this[kReadyState] === WebSocket.CLOSED) { + // If this's ready state is CLOSING (2) or CLOSED (3) + // Do nothing. + } else if (!isEstablished(this)) { + // If the WebSocket connection is not yet established + // Fail the WebSocket connection and set this's ready state + // to CLOSING (2). + failWebsocketConnection(this, 'Connection was closed before it was established.') + this[kReadyState] = WebSocket.CLOSING + } else if (!isClosing(this)) { + // If the WebSocket closing handshake has not yet been started + // Start the WebSocket closing handshake and set this's ready + // state to CLOSING (2). + // - If neither code nor reason is present, the WebSocket Close + // message must not have a body. + // - If code is present, then the status code to use in the + // WebSocket Close message must be the integer given by code. + // - If reason is also present, then reasonBytes must be + // provided in the Close message after the status code. + + const frame = new WebsocketFrameSend() + + // If neither code nor reason is present, the WebSocket Close + // message must not have a body. + + // If code is present, then the status code to use in the + // WebSocket Close message must be the integer given by code. + if (code !== undefined && reason === undefined) { + frame.frameData = Buffer.allocUnsafe(2) + frame.frameData.writeUInt16BE(code, 0) + } else if (code !== undefined && reason !== undefined) { + // If reason is also present, then reasonBytes must be + // provided in the Close message after the status code. + frame.frameData = Buffer.allocUnsafe(2 + reasonByteLength) + frame.frameData.writeUInt16BE(code, 0) + // the body MAY contain UTF-8-encoded data with value /reason/ + frame.frameData.write(reason, 2, 'utf-8') + } else { + frame.frameData = emptyBuffer + } - if (self.sockets.length >= this.maxSockets) { - // We are over limit so we'll add it to the queue. - self.requests.push(options); - return; + /** @type {import('stream').Duplex} */ + const socket = this[kResponse].socket + + socket.write(frame.createFrame(opcodes.CLOSE), (err) => { + if (!err) { + this[kSentClose] = true + } + }) + + // Upon either sending or receiving a Close control frame, it is said + // that _The WebSocket Closing Handshake is Started_ and that the + // WebSocket connection is in the CLOSING state. + this[kReadyState] = states.CLOSING + } else { + // Otherwise + // Set this's ready state to CLOSING (2). + this[kReadyState] = WebSocket.CLOSING + } } - // If we are under maxSockets create a new one. - self.createSocket(options, function(socket) { - socket.on('free', onFree); - socket.on('close', onCloseOrRemove); - socket.on('agentRemove', onCloseOrRemove); - req.onSocket(socket); + /** + * @see https://websockets.spec.whatwg.org/#dom-websocket-send + * @param {NodeJS.TypedArray|ArrayBuffer|Blob|string} data + */ + send (data) { + webidl.brandCheck(this, WebSocket) - function onFree() { - self.emit('free', socket, options); + webidl.argumentLengthCheck(arguments, 1, { header: 'WebSocket.send' }) + + data = webidl.converters.WebSocketSendData(data) + + // 1. If this's ready state is CONNECTING, then throw an + // "InvalidStateError" DOMException. + if (this[kReadyState] === WebSocket.CONNECTING) { + throw new DOMException('Sent before connected.', 'InvalidStateError') } - function onCloseOrRemove(err) { - self.removeSocket(socket); - socket.removeListener('free', onFree); - socket.removeListener('close', onCloseOrRemove); - socket.removeListener('agentRemove', onCloseOrRemove); + // 2. Run the appropriate set of steps from the following list: + // https://datatracker.ietf.org/doc/html/rfc6455#section-6.1 + // https://datatracker.ietf.org/doc/html/rfc6455#section-5.2 + + if (!isEstablished(this) || isClosing(this)) { + return } - }); -}; -TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { - var self = this; - var placeholder = {}; - self.sockets.push(placeholder); + /** @type {import('stream').Duplex} */ + const socket = this[kResponse].socket + + // If data is a string + if (typeof data === 'string') { + // If the WebSocket connection is established and the WebSocket + // closing handshake has not yet started, then the user agent + // must send a WebSocket Message comprised of the data argument + // using a text frame opcode; if the data cannot be sent, e.g. + // because it would need to be buffered but the buffer is full, + // the user agent must flag the WebSocket as full and then close + // the WebSocket connection. Any invocation of this method with a + // string argument that does not throw an exception must increase + // the bufferedAmount attribute by the number of bytes needed to + // express the argument as UTF-8. + + const value = Buffer.from(data) + const frame = new WebsocketFrameSend(value) + const buffer = frame.createFrame(opcodes.TEXT) + + this.#bufferedAmount += value.byteLength + socket.write(buffer, () => { + this.#bufferedAmount -= value.byteLength + }) + } else if (types.isArrayBuffer(data)) { + // If the WebSocket connection is established, and the WebSocket + // closing handshake has not yet started, then the user agent must + // send a WebSocket Message comprised of data using a binary frame + // opcode; if the data cannot be sent, e.g. because it would need + // to be buffered but the buffer is full, the user agent must flag + // the WebSocket as full and then close the WebSocket connection. + // The data to be sent is the data stored in the buffer described + // by the ArrayBuffer object. Any invocation of this method with an + // ArrayBuffer argument that does not throw an exception must + // increase the bufferedAmount attribute by the length of the + // ArrayBuffer in bytes. + + const value = Buffer.from(data) + const frame = new WebsocketFrameSend(value) + const buffer = frame.createFrame(opcodes.BINARY) + + this.#bufferedAmount += value.byteLength + socket.write(buffer, () => { + this.#bufferedAmount -= value.byteLength + }) + } else if (ArrayBuffer.isView(data)) { + // If the WebSocket connection is established, and the WebSocket + // closing handshake has not yet started, then the user agent must + // send a WebSocket Message comprised of data using a binary frame + // opcode; if the data cannot be sent, e.g. because it would need to + // be buffered but the buffer is full, the user agent must flag the + // WebSocket as full and then close the WebSocket connection. The + // data to be sent is the data stored in the section of the buffer + // described by the ArrayBuffer object that data references. Any + // invocation of this method with this kind of argument that does + // not throw an exception must increase the bufferedAmount attribute + // by the length of data’s buffer in bytes. + + const ab = Buffer.from(data, data.byteOffset, data.byteLength) + + const frame = new WebsocketFrameSend(ab) + const buffer = frame.createFrame(opcodes.BINARY) + + this.#bufferedAmount += ab.byteLength + socket.write(buffer, () => { + this.#bufferedAmount -= ab.byteLength + }) + } else if (isBlobLike(data)) { + // If the WebSocket connection is established, and the WebSocket + // closing handshake has not yet started, then the user agent must + // send a WebSocket Message comprised of data using a binary frame + // opcode; if the data cannot be sent, e.g. because it would need to + // be buffered but the buffer is full, the user agent must flag the + // WebSocket as full and then close the WebSocket connection. The data + // to be sent is the raw data represented by the Blob object. Any + // invocation of this method with a Blob argument that does not throw + // an exception must increase the bufferedAmount attribute by the size + // of the Blob object’s raw data, in bytes. + + const frame = new WebsocketFrameSend() + + data.arrayBuffer().then((ab) => { + const value = Buffer.from(ab) + frame.frameData = value + const buffer = frame.createFrame(opcodes.BINARY) + + this.#bufferedAmount += value.byteLength + socket.write(buffer, () => { + this.#bufferedAmount -= value.byteLength + }) + }) + } + } - var connectOptions = mergeOptions({}, self.proxyOptions, { - method: 'CONNECT', - path: options.host + ':' + options.port, - agent: false, - headers: { - host: options.host + ':' + options.port + get readyState () { + webidl.brandCheck(this, WebSocket) + + // The readyState getter steps are to return this's ready state. + return this[kReadyState] + } + + get bufferedAmount () { + webidl.brandCheck(this, WebSocket) + + return this.#bufferedAmount + } + + get url () { + webidl.brandCheck(this, WebSocket) + + // The url getter steps are to return this's url, serialized. + return URLSerializer(this[kWebSocketURL]) + } + + get extensions () { + webidl.brandCheck(this, WebSocket) + + return this.#extensions + } + + get protocol () { + webidl.brandCheck(this, WebSocket) + + return this.#protocol + } + + get onopen () { + webidl.brandCheck(this, WebSocket) + + return this.#events.open + } + + set onopen (fn) { + webidl.brandCheck(this, WebSocket) + + if (this.#events.open) { + this.removeEventListener('open', this.#events.open) + } + + if (typeof fn === 'function') { + this.#events.open = fn + this.addEventListener('open', fn) + } else { + this.#events.open = null } - }); - if (options.localAddress) { - connectOptions.localAddress = options.localAddress; } - if (connectOptions.proxyAuth) { - connectOptions.headers = connectOptions.headers || {}; - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + - new Buffer(connectOptions.proxyAuth).toString('base64'); + + get onerror () { + webidl.brandCheck(this, WebSocket) + + return this.#events.error } - debug('making CONNECT request'); - var connectReq = self.request(connectOptions); - connectReq.useChunkedEncodingByDefault = false; // for v0.6 - connectReq.once('response', onResponse); // for v0.6 - connectReq.once('upgrade', onUpgrade); // for v0.6 - connectReq.once('connect', onConnect); // for v0.7 or later - connectReq.once('error', onError); - connectReq.end(); + set onerror (fn) { + webidl.brandCheck(this, WebSocket) - function onResponse(res) { - // Very hacky. This is necessary to avoid http-parser leaks. - res.upgrade = true; + if (this.#events.error) { + this.removeEventListener('error', this.#events.error) + } + + if (typeof fn === 'function') { + this.#events.error = fn + this.addEventListener('error', fn) + } else { + this.#events.error = null + } } - function onUpgrade(res, socket, head) { - // Hacky. - process.nextTick(function() { - onConnect(res, socket, head); - }); + get onclose () { + webidl.brandCheck(this, WebSocket) + + return this.#events.close } - function onConnect(res, socket, head) { - connectReq.removeAllListeners(); - socket.removeAllListeners(); + set onclose (fn) { + webidl.brandCheck(this, WebSocket) - if (res.statusCode !== 200) { - debug('tunneling socket could not be established, statusCode=%d', - res.statusCode); - socket.destroy(); - var error = new Error('tunneling socket could not be established, ' + - 'statusCode=' + res.statusCode); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - return; + if (this.#events.close) { + this.removeEventListener('close', this.#events.close) } - if (head.length > 0) { - debug('got illegal response body from proxy'); - socket.destroy(); - var error = new Error('got illegal response body from proxy'); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - return; + + if (typeof fn === 'function') { + this.#events.close = fn + this.addEventListener('close', fn) + } else { + this.#events.close = null } - debug('tunneling connection has established'); - self.sockets[self.sockets.indexOf(placeholder)] = socket; - return cb(socket); } - function onError(cause) { - connectReq.removeAllListeners(); + get onmessage () { + webidl.brandCheck(this, WebSocket) - debug('tunneling socket could not be established, cause=%s\n', - cause.message, cause.stack); - var error = new Error('tunneling socket could not be established, ' + - 'cause=' + cause.message); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); + return this.#events.message } -}; -TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos = this.sockets.indexOf(socket) - if (pos === -1) { - return; + set onmessage (fn) { + webidl.brandCheck(this, WebSocket) + + if (this.#events.message) { + this.removeEventListener('message', this.#events.message) + } + + if (typeof fn === 'function') { + this.#events.message = fn + this.addEventListener('message', fn) + } else { + this.#events.message = null + } } - this.sockets.splice(pos, 1); - var pending = this.requests.shift(); - if (pending) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(pending, function(socket) { - pending.request.onSocket(socket); - }); + get binaryType () { + webidl.brandCheck(this, WebSocket) + + return this[kBinaryType] } -}; -function createSecureSocket(options, cb) { - var self = this; - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { - var hostHeader = options.request.getHeader('host'); - var tlsOptions = mergeOptions({}, self.options, { - socket: socket, - servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host - }); + set binaryType (type) { + webidl.brandCheck(this, WebSocket) - // 0 is dummy port for v0.6 - var secureSocket = tls.connect(0, tlsOptions); - self.sockets[self.sockets.indexOf(socket)] = secureSocket; - cb(secureSocket); - }); + if (type !== 'blob' && type !== 'arraybuffer') { + this[kBinaryType] = 'blob' + } else { + this[kBinaryType] = type + } + } + + /** + * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol + */ + #onConnectionEstablished (response) { + // processResponse is called when the "response’s header list has been received and initialized." + // once this happens, the connection is open + this[kResponse] = response + + const parser = new ByteParser(this) + parser.on('drain', function onParserDrain () { + this.ws[kResponse].socket.resume() + }) + + response.socket.ws = this + this[kByteParser] = parser + + // 1. Change the ready state to OPEN (1). + this[kReadyState] = states.OPEN + + // 2. Change the extensions attribute’s value to the extensions in use, if + // it is not the null value. + // https://datatracker.ietf.org/doc/html/rfc6455#section-9.1 + const extensions = response.headersList.get('sec-websocket-extensions') + + if (extensions !== null) { + this.#extensions = extensions + } + + // 3. Change the protocol attribute’s value to the subprotocol in use, if + // it is not the null value. + // https://datatracker.ietf.org/doc/html/rfc6455#section-1.9 + const protocol = response.headersList.get('sec-websocket-protocol') + + if (protocol !== null) { + this.#protocol = protocol + } + + // 4. Fire an event named open at the WebSocket object. + fireEvent('open', this) + } } +// https://websockets.spec.whatwg.org/#dom-websocket-connecting +WebSocket.CONNECTING = WebSocket.prototype.CONNECTING = states.CONNECTING +// https://websockets.spec.whatwg.org/#dom-websocket-open +WebSocket.OPEN = WebSocket.prototype.OPEN = states.OPEN +// https://websockets.spec.whatwg.org/#dom-websocket-closing +WebSocket.CLOSING = WebSocket.prototype.CLOSING = states.CLOSING +// https://websockets.spec.whatwg.org/#dom-websocket-closed +WebSocket.CLOSED = WebSocket.prototype.CLOSED = states.CLOSED -function toOptions(host, port, localAddress) { - if (typeof host === 'string') { // since v0.10 - return { - host: host, - port: port, - localAddress: localAddress - }; +Object.defineProperties(WebSocket.prototype, { + CONNECTING: staticPropertyDescriptors, + OPEN: staticPropertyDescriptors, + CLOSING: staticPropertyDescriptors, + CLOSED: staticPropertyDescriptors, + url: kEnumerableProperty, + readyState: kEnumerableProperty, + bufferedAmount: kEnumerableProperty, + onopen: kEnumerableProperty, + onerror: kEnumerableProperty, + onclose: kEnumerableProperty, + close: kEnumerableProperty, + onmessage: kEnumerableProperty, + binaryType: kEnumerableProperty, + send: kEnumerableProperty, + extensions: kEnumerableProperty, + protocol: kEnumerableProperty, + [Symbol.toStringTag]: { + value: 'WebSocket', + writable: false, + enumerable: false, + configurable: true } - return host; // for v0.11 or later +}) + +Object.defineProperties(WebSocket, { + CONNECTING: staticPropertyDescriptors, + OPEN: staticPropertyDescriptors, + CLOSING: staticPropertyDescriptors, + CLOSED: staticPropertyDescriptors +}) + +webidl.converters['sequence'] = webidl.sequenceConverter( + webidl.converters.DOMString +) + +webidl.converters['DOMString or sequence'] = function (V) { + if (webidl.util.Type(V) === 'Object' && Symbol.iterator in V) { + return webidl.converters['sequence'](V) + } + + return webidl.converters.DOMString(V) } -function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i]; - if (typeof overrides === 'object') { - var keys = Object.keys(overrides); - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j]; - if (overrides[k] !== undefined) { - target[k] = overrides[k]; - } - } +// This implements the propsal made in https://github.com/whatwg/websockets/issues/42 +webidl.converters.WebSocketInit = webidl.dictionaryConverter([ + { + key: 'protocols', + converter: webidl.converters['DOMString or sequence'], + get defaultValue () { + return [] + } + }, + { + key: 'dispatcher', + converter: (V) => V, + get defaultValue () { + return getGlobalDispatcher() } + }, + { + key: 'headers', + converter: webidl.nullableConverter(webidl.converters.HeadersInit) } - return target; +]) + +webidl.converters['DOMString or sequence or WebSocketInit'] = function (V) { + if (webidl.util.Type(V) === 'Object' && !(Symbol.iterator in V)) { + return webidl.converters.WebSocketInit(V) + } + + return { protocols: webidl.converters['DOMString or sequence'](V) } } +webidl.converters.WebSocketSendData = function (V) { + if (webidl.util.Type(V) === 'Object') { + if (isBlobLike(V)) { + return webidl.converters.Blob(V, { strict: false }) + } -var debug; -if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { - var args = Array.prototype.slice.call(arguments); - if (typeof args[0] === 'string') { - args[0] = 'TUNNEL: ' + args[0]; - } else { - args.unshift('TUNNEL:'); + if (ArrayBuffer.isView(V) || types.isAnyArrayBuffer(V)) { + return webidl.converters.BufferSource(V) } - console.error.apply(console, args); } -} else { - debug = function() {}; + + return webidl.converters.USVString(V) +} + +module.exports = { + WebSocket } -exports.debug = debug; // for test /***/ }), @@ -62089,7 +85141,7 @@ module.exports = v4; /***/ }), -/***/ 333: +/***/ 8186: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 @@ -63207,7 +86259,7 @@ module.exports = v4; XMLElement = __nccwpck_require__(9437); - XMLCData = __nccwpck_require__(333); + XMLCData = __nccwpck_require__(8186); XMLComment = __nccwpck_require__(4407); @@ -64182,7 +87234,7 @@ module.exports = v4; this.baseURI = null; if (!XMLElement) { XMLElement = __nccwpck_require__(9437); - XMLCData = __nccwpck_require__(333); + XMLCData = __nccwpck_require__(8186); XMLComment = __nccwpck_require__(4407); XMLDeclaration = __nccwpck_require__(6364); XMLDocType = __nccwpck_require__(1801); @@ -65623,7 +88675,7 @@ module.exports = v4; XMLDocType = __nccwpck_require__(1801); - XMLCData = __nccwpck_require__(333); + XMLCData = __nccwpck_require__(8186); XMLComment = __nccwpck_require__(4407); @@ -67177,6 +90229,14 @@ exports.getGitHubHttpHeaders = getGitHubHttpHeaders; module.exports = eval("require")("encoding"); +/***/ }), + +/***/ 4978: +/***/ ((module) => { + +module.exports = eval("require")("util/types"); + + /***/ }), /***/ 9491: @@ -67187,6 +90247,14 @@ module.exports = require("assert"); /***/ }), +/***/ 852: +/***/ ((module) => { + +"use strict"; +module.exports = require("async_hooks"); + +/***/ }), + /***/ 4300: /***/ ((module) => { @@ -67203,6 +90271,14 @@ module.exports = require("child_process"); /***/ }), +/***/ 6206: +/***/ ((module) => { + +"use strict"; +module.exports = require("console"); + +/***/ }), + /***/ 6113: /***/ ((module) => { @@ -67211,6 +90287,14 @@ module.exports = require("crypto"); /***/ }), +/***/ 7643: +/***/ ((module) => { + +"use strict"; +module.exports = require("diagnostics_channel"); + +/***/ }), + /***/ 2361: /***/ ((module) => { @@ -67235,6 +90319,14 @@ module.exports = require("http"); /***/ }), +/***/ 5158: +/***/ ((module) => { + +"use strict"; +module.exports = require("http2"); + +/***/ }), + /***/ 5687: /***/ ((module) => { @@ -67251,6 +90343,30 @@ module.exports = require("net"); /***/ }), +/***/ 5673: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:events"); + +/***/ }), + +/***/ 4492: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:stream"); + +/***/ }), + +/***/ 7261: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:util"); + +/***/ }), + /***/ 2037: /***/ ((module) => { @@ -67267,6 +90383,14 @@ module.exports = require("path"); /***/ }), +/***/ 4074: +/***/ ((module) => { + +"use strict"; +module.exports = require("perf_hooks"); + +/***/ }), + /***/ 5477: /***/ ((module) => { @@ -67275,6 +90399,14 @@ module.exports = require("punycode"); /***/ }), +/***/ 3477: +/***/ ((module) => { + +"use strict"; +module.exports = require("querystring"); + +/***/ }), + /***/ 2781: /***/ ((module) => { @@ -67283,6 +90415,14 @@ module.exports = require("stream"); /***/ }), +/***/ 5356: +/***/ ((module) => { + +"use strict"; +module.exports = require("stream/web"); + +/***/ }), + /***/ 1576: /***/ ((module) => { @@ -67323,6 +90463,14 @@ module.exports = require("util"); /***/ }), +/***/ 1267: +/***/ ((module) => { + +"use strict"; +module.exports = require("worker_threads"); + +/***/ }), + /***/ 9796: /***/ ((module) => { diff --git a/dist/setup/index.js b/dist/setup/index.js index 4e99c8ed4..a81030cf1 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -1,11 +1,34 @@ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ 7799: +/***/ 27799: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -15,19 +38,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -const core = __importStar(__nccwpck_require__(2186)); -const path = __importStar(__nccwpck_require__(1017)); -const utils = __importStar(__nccwpck_require__(1518)); -const cacheHttpClient = __importStar(__nccwpck_require__(7244)); -const tar_1 = __nccwpck_require__(6490); +exports.saveCache = exports.restoreCache = exports.isFeatureAvailable = exports.ReserveCacheError = exports.ValidationError = void 0; +const core = __importStar(__nccwpck_require__(42186)); +const path = __importStar(__nccwpck_require__(71017)); +const utils = __importStar(__nccwpck_require__(91518)); +const cacheHttpClient = __importStar(__nccwpck_require__(98245)); +const tar_1 = __nccwpck_require__(56490); class ValidationError extends Error { constructor(message) { super(message); @@ -74,9 +91,10 @@ exports.isFeatureAvailable = isFeatureAvailable; * @param primaryKey an explicit key for restoring the cache * @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key * @param downloadOptions cache download options + * @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform * @returns string returns the key for the cache hit, otherwise returns undefined */ -function restoreCache(paths, primaryKey, restoreKeys, options) { +function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) { return __awaiter(this, void 0, void 0, function* () { checkPaths(paths); restoreKeys = restoreKeys || []; @@ -94,22 +112,27 @@ function restoreCache(paths, primaryKey, restoreKeys, options) { try { // path are needed to compute version const cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, { - compressionMethod + compressionMethod, + enableCrossOsArchive }); if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) { // Cache not found return undefined; } + if (options === null || options === void 0 ? void 0 : options.lookupOnly) { + core.info('Lookup only - skipping download'); + return cacheEntry.cacheKey; + } archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); core.debug(`Archive Path: ${archivePath}`); // Download the cache from the cache entry yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options); if (core.isDebug()) { - yield tar_1.listTar(archivePath, compressionMethod); + yield (0, tar_1.listTar)(archivePath, compressionMethod); } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`); - yield tar_1.extractTar(archivePath, compressionMethod); + yield (0, tar_1.extractTar)(archivePath, compressionMethod); core.info('Cache restored successfully'); return cacheEntry.cacheKey; } @@ -141,10 +164,11 @@ exports.restoreCache = restoreCache; * * @param paths a list of file paths to be cached * @param key an explicit key for restoring the cache + * @param enableCrossOsArchive an optional boolean enabled to save cache on windows which could be restored on any platform * @param options cache upload options * @returns number returns cacheId if the cache was saved successfully and throws an error if save fails */ -function saveCache(paths, key, options) { +function saveCache(paths, key, options, enableCrossOsArchive = false) { var _a, _b, _c, _d, _e; return __awaiter(this, void 0, void 0, function* () { checkPaths(paths); @@ -161,9 +185,9 @@ function saveCache(paths, key, options) { const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod)); core.debug(`Archive Path: ${archivePath}`); try { - yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod); + yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod); if (core.isDebug()) { - yield tar_1.listTar(archivePath, compressionMethod); + yield (0, tar_1.listTar)(archivePath, compressionMethod); } const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); @@ -175,6 +199,7 @@ function saveCache(paths, key, options) { core.debug('Reserving Cache'); const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, { compressionMethod, + enableCrossOsArchive, cacheSize: archiveFileSize }); if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) { @@ -218,11 +243,34 @@ exports.saveCache = saveCache; /***/ }), -/***/ 7244: +/***/ 98245: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -232,25 +280,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -const core = __importStar(__nccwpck_require__(2186)); -const http_client_1 = __nccwpck_require__(1825); -const auth_1 = __nccwpck_require__(2001); +exports.saveCache = exports.reserveCache = exports.downloadCache = exports.getCacheEntry = exports.getCacheVersion = void 0; +const core = __importStar(__nccwpck_require__(42186)); +const http_client_1 = __nccwpck_require__(21825); +const auth_1 = __nccwpck_require__(32001); const crypto = __importStar(__nccwpck_require__(6113)); -const fs = __importStar(__nccwpck_require__(7147)); -const url_1 = __nccwpck_require__(7310); -const utils = __importStar(__nccwpck_require__(1518)); -const constants_1 = __nccwpck_require__(8840); -const downloadUtils_1 = __nccwpck_require__(5500); -const options_1 = __nccwpck_require__(6215); -const requestUtils_1 = __nccwpck_require__(3981); +const fs = __importStar(__nccwpck_require__(57147)); +const url_1 = __nccwpck_require__(57310); +const utils = __importStar(__nccwpck_require__(91518)); +const downloadUtils_1 = __nccwpck_require__(55500); +const options_1 = __nccwpck_require__(76215); +const requestUtils_1 = __nccwpck_require__(13981); const versionSalt = '1.0'; function getCacheApiUrl(resource) { const baseUrl = process.env['ACTIONS_CACHE_URL'] || ''; @@ -277,33 +318,43 @@ function createHttpClient() { const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token); return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions()); } -function getCacheVersion(paths, compressionMethod) { - const components = paths.concat(!compressionMethod || compressionMethod === constants_1.CompressionMethod.Gzip - ? [] - : [compressionMethod]); +function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) { + const components = paths; + // Add compression method to cache version to restore + // compressed cache as per compression method + if (compressionMethod) { + components.push(compressionMethod); + } + // Only check for windows platforms if enableCrossOsArchive is false + if (process.platform === 'win32' && !enableCrossOsArchive) { + components.push('windows-only'); + } // Add salt to cache version to support breaking changes in cache entry components.push(versionSalt); - return crypto - .createHash('sha256') - .update(components.join('|')) - .digest('hex'); + return crypto.createHash('sha256').update(components.join('|')).digest('hex'); } exports.getCacheVersion = getCacheVersion; function getCacheEntry(keys, paths, options) { return __awaiter(this, void 0, void 0, function* () { const httpClient = createHttpClient(); - const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod); + const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive); const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`; - const response = yield requestUtils_1.retryTypedResponse('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); })); + const response = yield (0, requestUtils_1.retryTypedResponse)('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); })); + // Cache not found if (response.statusCode === 204) { + // List cache for primary key only if cache miss occurs + if (core.isDebug()) { + yield printCachesListForDiagnostics(keys[0], httpClient, version); + } return null; } - if (!requestUtils_1.isSuccessStatusCode(response.statusCode)) { + if (!(0, requestUtils_1.isSuccessStatusCode)(response.statusCode)) { throw new Error(`Cache service responded with ${response.statusCode}`); } const cacheResult = response.result; const cacheDownloadUrl = cacheResult === null || cacheResult === void 0 ? void 0 : cacheResult.archiveLocation; if (!cacheDownloadUrl) { + // Cache achiveLocation not found. This should never happen, and hence bail out. throw new Error('Cache not found.'); } core.setSecret(cacheDownloadUrl); @@ -313,18 +364,42 @@ function getCacheEntry(keys, paths, options) { }); } exports.getCacheEntry = getCacheEntry; +function printCachesListForDiagnostics(key, httpClient, version) { + return __awaiter(this, void 0, void 0, function* () { + const resource = `caches?key=${encodeURIComponent(key)}`; + const response = yield (0, requestUtils_1.retryTypedResponse)('listCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); })); + if (response.statusCode === 200) { + const cacheListResult = response.result; + const totalCount = cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.totalCount; + if (totalCount && totalCount > 0) { + core.debug(`No matching cache found for cache key '${key}', version '${version} and scope ${process.env['GITHUB_REF']}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key \nOther caches with similar key:`); + for (const cacheEntry of (cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.artifactCaches) || []) { + core.debug(`Cache Key: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheKey}, Cache Version: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheVersion}, Cache Scope: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.scope}, Cache Created: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.creationTime}`); + } + } + } + }); +} function downloadCache(archiveLocation, archivePath, options) { return __awaiter(this, void 0, void 0, function* () { const archiveUrl = new url_1.URL(archiveLocation); - const downloadOptions = options_1.getDownloadOptions(options); - if (downloadOptions.useAzureSdk && - archiveUrl.hostname.endsWith('.blob.core.windows.net')) { - // Use Azure storage SDK to download caches hosted on Azure to improve speed and reliability. - yield downloadUtils_1.downloadCacheStorageSDK(archiveLocation, archivePath, downloadOptions); + const downloadOptions = (0, options_1.getDownloadOptions)(options); + if (archiveUrl.hostname.endsWith('.blob.core.windows.net')) { + if (downloadOptions.useAzureSdk) { + // Use Azure storage SDK to download caches hosted on Azure to improve speed and reliability. + yield (0, downloadUtils_1.downloadCacheStorageSDK)(archiveLocation, archivePath, downloadOptions); + } + else if (downloadOptions.concurrentBlobDownloads) { + // Use concurrent implementation with HttpClient to work around blob SDK issue + yield (0, downloadUtils_1.downloadCacheHttpClientConcurrent)(archiveLocation, archivePath, downloadOptions); + } + else { + // Otherwise, download using the Actions http-client. + yield (0, downloadUtils_1.downloadCacheHttpClient)(archiveLocation, archivePath); + } } else { - // Otherwise, download using the Actions http-client. - yield downloadUtils_1.downloadCacheHttpClient(archiveLocation, archivePath); + yield (0, downloadUtils_1.downloadCacheHttpClient)(archiveLocation, archivePath); } }); } @@ -333,13 +408,13 @@ exports.downloadCache = downloadCache; function reserveCache(key, paths, options) { return __awaiter(this, void 0, void 0, function* () { const httpClient = createHttpClient(); - const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod); + const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive); const reserveCacheRequest = { key, version, cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize }; - const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () { + const response = yield (0, requestUtils_1.retryTypedResponse)('reserveCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest); })); return response; @@ -356,17 +431,15 @@ function getContentRange(start, end) { } function uploadChunk(httpClient, resourceUrl, openStream, start, end) { return __awaiter(this, void 0, void 0, function* () { - core.debug(`Uploading chunk of size ${end - - start + - 1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`); + core.debug(`Uploading chunk of size ${end - start + 1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`); const additionalHeaders = { 'Content-Type': 'application/octet-stream', 'Content-Range': getContentRange(start, end) }; - const uploadChunkResponse = yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () { + const uploadChunkResponse = yield (0, requestUtils_1.retryHttpClientResponse)(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () { return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders); })); - if (!requestUtils_1.isSuccessStatusCode(uploadChunkResponse.message.statusCode)) { + if (!(0, requestUtils_1.isSuccessStatusCode)(uploadChunkResponse.message.statusCode)) { throw new Error(`Cache service responded with ${uploadChunkResponse.message.statusCode} during upload chunk.`); } }); @@ -377,7 +450,7 @@ function uploadFile(httpClient, cacheId, archivePath, options) { const fileSize = utils.getArchiveFileSizeInBytes(archivePath); const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`); const fd = fs.openSync(archivePath, 'r'); - const uploadOptions = options_1.getUploadOptions(options); + const uploadOptions = (0, options_1.getUploadOptions)(options); const concurrency = utils.assertDefined('uploadConcurrency', uploadOptions.uploadConcurrency); const maxChunkSize = utils.assertDefined('uploadChunkSize', uploadOptions.uploadChunkSize); const parallelUploads = [...new Array(concurrency).keys()]; @@ -412,7 +485,7 @@ function uploadFile(httpClient, cacheId, archivePath, options) { function commitCache(httpClient, cacheId, filesize) { return __awaiter(this, void 0, void 0, function* () { const commitCacheRequest = { size: filesize }; - return yield requestUtils_1.retryTypedResponse('commitCache', () => __awaiter(this, void 0, void 0, function* () { + return yield (0, requestUtils_1.retryTypedResponse)('commitCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest); })); }); @@ -427,7 +500,7 @@ function saveCache(cacheId, archivePath, options) { const cacheSize = utils.getArchiveFileSizeInBytes(archivePath); core.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`); const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize); - if (!requestUtils_1.isSuccessStatusCode(commitCacheResponse.statusCode)) { + if (!(0, requestUtils_1.isSuccessStatusCode)(commitCacheResponse.statusCode)) { throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`); } core.info('Cache saved successfully'); @@ -438,11 +511,34 @@ exports.saveCache = saveCache; /***/ }), -/***/ 1518: +/***/ 91518: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -459,24 +555,18 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -const core = __importStar(__nccwpck_require__(2186)); -const exec = __importStar(__nccwpck_require__(1514)); -const glob = __importStar(__nccwpck_require__(1597)); -const io = __importStar(__nccwpck_require__(7436)); -const fs = __importStar(__nccwpck_require__(7147)); -const path = __importStar(__nccwpck_require__(1017)); +exports.isGhes = exports.assertDefined = exports.getGnuTarPathOnWindows = exports.getCacheFileName = exports.getCompressionMethod = exports.unlinkFile = exports.resolvePaths = exports.getArchiveFileSizeInBytes = exports.createTempDirectory = void 0; +const core = __importStar(__nccwpck_require__(42186)); +const exec = __importStar(__nccwpck_require__(71514)); +const glob = __importStar(__nccwpck_require__(31597)); +const io = __importStar(__nccwpck_require__(47351)); +const fs = __importStar(__nccwpck_require__(57147)); +const path = __importStar(__nccwpck_require__(71017)); const semver = __importStar(__nccwpck_require__(3771)); -const util = __importStar(__nccwpck_require__(3837)); +const util = __importStar(__nccwpck_require__(73837)); const uuid_1 = __nccwpck_require__(2155); -const constants_1 = __nccwpck_require__(8840); +const constants_1 = __nccwpck_require__(88840); // From https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L23 function createTempDirectory() { return __awaiter(this, void 0, void 0, function* () { @@ -498,7 +588,7 @@ function createTempDirectory() { } tempDirectory = path.join(baseLocation, 'actions', 'temp'); } - const dest = path.join(tempDirectory, uuid_1.v4()); + const dest = path.join(tempDirectory, (0, uuid_1.v4)()); yield io.mkdirP(dest); return dest; }); @@ -509,35 +599,42 @@ function getArchiveFileSizeInBytes(filePath) { } exports.getArchiveFileSizeInBytes = getArchiveFileSizeInBytes; function resolvePaths(patterns) { - var e_1, _a; - var _b; + var _a, e_1, _b, _c; + var _d; return __awaiter(this, void 0, void 0, function* () { const paths = []; - const workspace = (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd(); + const workspace = (_d = process.env['GITHUB_WORKSPACE']) !== null && _d !== void 0 ? _d : process.cwd(); const globber = yield glob.create(patterns.join('\n'), { implicitDescendants: false }); try { - for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) { - const file = _d.value; - const relativeFile = path - .relative(workspace, file) - .replace(new RegExp(`\\${path.sep}`, 'g'), '/'); - core.debug(`Matched: ${relativeFile}`); - // Paths are made relative so the tar entries are all relative to the root of the workspace. - if (relativeFile === '') { - // path.relative returns empty string if workspace and file are equal - paths.push('.'); + for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a;) { + _c = _g.value; + _e = false; + try { + const file = _c; + const relativeFile = path + .relative(workspace, file) + .replace(new RegExp(`\\${path.sep}`, 'g'), '/'); + core.debug(`Matched: ${relativeFile}`); + // Paths are made relative so the tar entries are all relative to the root of the workspace. + if (relativeFile === '') { + // path.relative returns empty string if workspace and file are equal + paths.push('.'); + } + else { + paths.push(`${relativeFile}`); + } } - else { - paths.push(`${relativeFile}`); + finally { + _e = true; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { - if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c); + if (!_e && !_a && (_b = _f.return)) yield _b.call(_f); } finally { if (e_1) throw e_1.error; } } @@ -551,12 +648,13 @@ function unlinkFile(filePath) { }); } exports.unlinkFile = unlinkFile; -function getVersion(app) { +function getVersion(app, additionalArgs = []) { return __awaiter(this, void 0, void 0, function* () { - core.debug(`Checking ${app} --version`); let versionOutput = ''; + additionalArgs.push('--version'); + core.debug(`Checking ${app} ${additionalArgs.join(' ')}`); try { - yield exec.exec(`${app} --version`, [], { + yield exec.exec(`${app}`, additionalArgs, { ignoreReturnCode: true, silent: true, listeners: { @@ -576,23 +674,14 @@ function getVersion(app) { // Use zstandard if possible to maximize cache performance function getCompressionMethod() { return __awaiter(this, void 0, void 0, function* () { - if (process.platform === 'win32' && !(yield isGnuTarInstalled())) { - // Disable zstd due to bug https://github.com/actions/cache/issues/301 - return constants_1.CompressionMethod.Gzip; - } - const versionOutput = yield getVersion('zstd'); + const versionOutput = yield getVersion('zstd', ['--quiet']); const version = semver.clean(versionOutput); - if (!versionOutput.toLowerCase().includes('zstd command line interface')) { - // zstd is not installed + core.debug(`zstd version: ${version}`); + if (versionOutput === '') { return constants_1.CompressionMethod.Gzip; } - else if (!version || semver.lt(version, 'v1.3.2')) { - // zstd is installed but using a version earlier than v1.3.2 - // v1.3.2 is required to use the `--long` options in zstd - return constants_1.CompressionMethod.ZstdWithoutLong; - } else { - return constants_1.CompressionMethod.Zstd; + return constants_1.CompressionMethod.ZstdWithoutLong; } }); } @@ -603,13 +692,16 @@ function getCacheFileName(compressionMethod) { : constants_1.CacheFilename.Zstd; } exports.getCacheFileName = getCacheFileName; -function isGnuTarInstalled() { +function getGnuTarPathOnWindows() { return __awaiter(this, void 0, void 0, function* () { + if (fs.existsSync(constants_1.GnuTarPathOnWindows)) { + return constants_1.GnuTarPathOnWindows; + } const versionOutput = yield getVersion('tar'); - return versionOutput.toLowerCase().includes('gnu tar'); + return versionOutput.toLowerCase().includes('gnu tar') ? io.which('tar') : ''; }); } -exports.isGnuTarInstalled = isGnuTarInstalled; +exports.getGnuTarPathOnWindows = getGnuTarPathOnWindows; function assertDefined(name, value) { if (value === undefined) { throw Error(`Expected ${name} but value was undefiend`); @@ -626,12 +718,13 @@ exports.isGhes = isGhes; /***/ }), -/***/ 8840: +/***/ 88840: /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ManifestFilename = exports.TarFilename = exports.SystemTarPathOnWindows = exports.GnuTarPathOnWindows = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.ArchiveToolType = exports.CompressionMethod = exports.CacheFilename = void 0; var CacheFilename; (function (CacheFilename) { CacheFilename["Gzip"] = "cache.tgz"; @@ -645,6 +738,11 @@ var CompressionMethod; CompressionMethod["ZstdWithoutLong"] = "zstd-without-long"; CompressionMethod["Zstd"] = "zstd"; })(CompressionMethod = exports.CompressionMethod || (exports.CompressionMethod = {})); +var ArchiveToolType; +(function (ArchiveToolType) { + ArchiveToolType["GNU"] = "gnu"; + ArchiveToolType["BSD"] = "bsd"; +})(ArchiveToolType = exports.ArchiveToolType || (exports.ArchiveToolType = {})); // The default number of retry attempts. exports.DefaultRetryAttempts = 2; // The default delay in milliseconds between retry attempts. @@ -653,15 +751,44 @@ exports.DefaultRetryDelay = 5000; // over the socket during this period, the socket is destroyed and the download // is aborted. exports.SocketTimeout = 5000; +// The default path of GNUtar on hosted Windows runners +exports.GnuTarPathOnWindows = `${process.env['PROGRAMFILES']}\\Git\\usr\\bin\\tar.exe`; +// The default path of BSDtar on hosted Windows runners +exports.SystemTarPathOnWindows = `${process.env['SYSTEMDRIVE']}\\Windows\\System32\\tar.exe`; +exports.TarFilename = 'cache.tar'; +exports.ManifestFilename = 'manifest.txt'; //# sourceMappingURL=constants.js.map /***/ }), -/***/ 5500: +/***/ 55500: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -671,25 +798,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -const core = __importStar(__nccwpck_require__(2186)); -const http_client_1 = __nccwpck_require__(1825); -const storage_blob_1 = __nccwpck_require__(4100); -const buffer = __importStar(__nccwpck_require__(4300)); -const fs = __importStar(__nccwpck_require__(7147)); -const stream = __importStar(__nccwpck_require__(2781)); -const util = __importStar(__nccwpck_require__(3837)); -const utils = __importStar(__nccwpck_require__(1518)); -const constants_1 = __nccwpck_require__(8840); -const requestUtils_1 = __nccwpck_require__(3981); -const abort_controller_1 = __nccwpck_require__(2557); +exports.downloadCacheStorageSDK = exports.downloadCacheHttpClientConcurrent = exports.downloadCacheHttpClient = exports.DownloadProgress = void 0; +const core = __importStar(__nccwpck_require__(42186)); +const http_client_1 = __nccwpck_require__(21825); +const storage_blob_1 = __nccwpck_require__(84100); +const buffer = __importStar(__nccwpck_require__(14300)); +const fs = __importStar(__nccwpck_require__(57147)); +const stream = __importStar(__nccwpck_require__(12781)); +const util = __importStar(__nccwpck_require__(73837)); +const utils = __importStar(__nccwpck_require__(91518)); +const constants_1 = __nccwpck_require__(88840); +const requestUtils_1 = __nccwpck_require__(13981); +const abort_controller_1 = __nccwpck_require__(52557); /** * Pipes the body of a HTTP response to a stream * @@ -813,7 +934,7 @@ function downloadCacheHttpClient(archiveLocation, archivePath) { return __awaiter(this, void 0, void 0, function* () { const writeStream = fs.createWriteStream(archivePath); const httpClient = new http_client_1.HttpClient('actions/cache'); - const downloadResponse = yield requestUtils_1.retryHttpClientResponse('downloadCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); })); + const downloadResponse = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); })); // Abort download if no traffic received over the socket. downloadResponse.message.socket.setTimeout(constants_1.SocketTimeout, () => { downloadResponse.message.destroy(); @@ -835,6 +956,115 @@ function downloadCacheHttpClient(archiveLocation, archivePath) { }); } exports.downloadCacheHttpClient = downloadCacheHttpClient; +/** + * Download the cache using the Actions toolkit http-client concurrently + * + * @param archiveLocation the URL for the cache + * @param archivePath the local path where the cache is saved + */ +function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + const archiveDescriptor = yield fs.promises.open(archivePath, 'w'); + const httpClient = new http_client_1.HttpClient('actions/cache', undefined, { + socketTimeout: options.timeoutInMs, + keepAlive: true + }); + try { + const res = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCacheMetadata', () => __awaiter(this, void 0, void 0, function* () { return yield httpClient.request('HEAD', archiveLocation, null, {}); })); + const lengthHeader = res.message.headers['content-length']; + if (lengthHeader === undefined || lengthHeader === null) { + throw new Error('Content-Length not found on blob response'); + } + const length = parseInt(lengthHeader); + if (Number.isNaN(length)) { + throw new Error(`Could not interpret Content-Length: ${length}`); + } + const downloads = []; + const blockSize = 4 * 1024 * 1024; + for (let offset = 0; offset < length; offset += blockSize) { + const count = Math.min(blockSize, length - offset); + downloads.push({ + offset, + promiseGetter: () => __awaiter(this, void 0, void 0, function* () { + return yield downloadSegmentRetry(httpClient, archiveLocation, offset, count); + }) + }); + } + // reverse to use .pop instead of .shift + downloads.reverse(); + let actives = 0; + let bytesDownloaded = 0; + const progress = new DownloadProgress(length); + progress.startDisplayTimer(); + const progressFn = progress.onProgress(); + const activeDownloads = []; + let nextDownload; + const waitAndWrite = () => __awaiter(this, void 0, void 0, function* () { + const segment = yield Promise.race(Object.values(activeDownloads)); + yield archiveDescriptor.write(segment.buffer, 0, segment.count, segment.offset); + actives--; + delete activeDownloads[segment.offset]; + bytesDownloaded += segment.count; + progressFn({ loadedBytes: bytesDownloaded }); + }); + while ((nextDownload = downloads.pop())) { + activeDownloads[nextDownload.offset] = nextDownload.promiseGetter(); + actives++; + if (actives >= ((_a = options.downloadConcurrency) !== null && _a !== void 0 ? _a : 10)) { + yield waitAndWrite(); + } + } + while (actives > 0) { + yield waitAndWrite(); + } + } + finally { + httpClient.dispose(); + yield archiveDescriptor.close(); + } + }); +} +exports.downloadCacheHttpClientConcurrent = downloadCacheHttpClientConcurrent; +function downloadSegmentRetry(httpClient, archiveLocation, offset, count) { + return __awaiter(this, void 0, void 0, function* () { + const retries = 5; + let failures = 0; + while (true) { + try { + const timeout = 30000; + const result = yield promiseWithTimeout(timeout, downloadSegment(httpClient, archiveLocation, offset, count)); + if (typeof result === 'string') { + throw new Error('downloadSegmentRetry failed due to timeout'); + } + return result; + } + catch (err) { + if (failures >= retries) { + throw err; + } + failures++; + } + } + }); +} +function downloadSegment(httpClient, archiveLocation, offset, count) { + return __awaiter(this, void 0, void 0, function* () { + const partRes = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCachePart', () => __awaiter(this, void 0, void 0, function* () { + return yield httpClient.get(archiveLocation, { + Range: `bytes=${offset}-${offset + count - 1}` + }); + })); + if (!partRes.readBodyBuffer) { + throw new Error('Expected HttpClientResponse to implement readBodyBuffer'); + } + return { + offset, + count, + buffer: yield partRes.readBodyBuffer() + }; + }); +} /** * Download the cache using the Azure Storage SDK. Only call this method if the * URL points to an Azure Storage endpoint. @@ -868,7 +1098,8 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) { // If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB // on 64-bit systems), split the download into multiple segments // ~2 GB = 2147483647, beyond this, we start getting out of range error. So, capping it accordingly. - const maxSegmentSize = Math.min(2147483647, buffer.constants.MAX_LENGTH); + // Updated segment size to 128MB = 134217728 bytes, to complete a segment faster and fail fast + const maxSegmentSize = Math.min(134217728, buffer.constants.MAX_LENGTH); const downloadProgress = new DownloadProgress(contentLength); const fd = fs.openSync(archivePath, 'w'); try { @@ -915,11 +1146,34 @@ const promiseWithTimeout = (timeoutMs, promise) => __awaiter(void 0, void 0, voi /***/ }), -/***/ 3981: +/***/ 13981: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -929,17 +1183,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -const core = __importStar(__nccwpck_require__(2186)); -const http_client_1 = __nccwpck_require__(1825); -const constants_1 = __nccwpck_require__(8840); +exports.retryHttpClientResponse = exports.retryTypedResponse = exports.retry = exports.isRetryableStatusCode = exports.isServerErrorStatusCode = exports.isSuccessStatusCode = void 0; +const core = __importStar(__nccwpck_require__(42186)); +const http_client_1 = __nccwpck_require__(21825); +const constants_1 = __nccwpck_require__(88840); function isSuccessStatusCode(statusCode) { if (!statusCode) { return false; @@ -1042,11 +1290,34 @@ exports.retryHttpClientResponse = retryHttpClientResponse; /***/ }), -/***/ 6490: +/***/ 56490: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -1056,36 +1327,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -const exec_1 = __nccwpck_require__(1514); -const io = __importStar(__nccwpck_require__(7436)); -const fs_1 = __nccwpck_require__(7147); -const path = __importStar(__nccwpck_require__(1017)); -const utils = __importStar(__nccwpck_require__(1518)); -const constants_1 = __nccwpck_require__(8840); +exports.createTar = exports.extractTar = exports.listTar = void 0; +const exec_1 = __nccwpck_require__(71514); +const io = __importStar(__nccwpck_require__(47351)); +const fs_1 = __nccwpck_require__(57147); +const path = __importStar(__nccwpck_require__(71017)); +const utils = __importStar(__nccwpck_require__(91518)); +const constants_1 = __nccwpck_require__(88840); const IS_WINDOWS = process.platform === 'win32'; -function getTarPath(args, compressionMethod) { +// Returns tar path and type: BSD or GNU +function getTarPath() { return __awaiter(this, void 0, void 0, function* () { switch (process.platform) { case 'win32': { - const systemTar = `${process.env['windir']}\\System32\\tar.exe`; - if (compressionMethod !== constants_1.CompressionMethod.Gzip) { - // We only use zstandard compression on windows when gnu tar is installed due to - // a bug with compressing large files with bsdtar + zstd - args.push('--force-local'); + const gnuTar = yield utils.getGnuTarPathOnWindows(); + const systemTar = constants_1.SystemTarPathOnWindows; + if (gnuTar) { + // Use GNUtar as default on windows + return { path: gnuTar, type: constants_1.ArchiveToolType.GNU }; } - else if (fs_1.existsSync(systemTar)) { - return systemTar; - } - else if (yield utils.isGnuTarInstalled()) { - args.push('--force-local'); + else if ((0, fs_1.existsSync)(systemTar)) { + return { path: systemTar, type: constants_1.ArchiveToolType.BSD }; } break; } @@ -1093,25 +1356,92 @@ function getTarPath(args, compressionMethod) { const gnuTar = yield io.which('gtar', false); if (gnuTar) { // fix permission denied errors when extracting BSD tar archive with GNU tar - https://github.com/actions/cache/issues/527 - args.push('--delay-directory-restore'); - return gnuTar; + return { path: gnuTar, type: constants_1.ArchiveToolType.GNU }; + } + else { + return { + path: yield io.which('tar', true), + type: constants_1.ArchiveToolType.BSD + }; } - break; } default: break; } - return yield io.which('tar', true); + // Default assumption is GNU tar is present in path + return { + path: yield io.which('tar', true), + type: constants_1.ArchiveToolType.GNU + }; }); } -function execTar(args, compressionMethod, cwd) { +// Return arguments for tar as per tarPath, compressionMethod, method type and os +function getTarArgs(tarPath, compressionMethod, type, archivePath = '') { return __awaiter(this, void 0, void 0, function* () { - try { - yield exec_1.exec(`"${yield getTarPath(args, compressionMethod)}"`, args, { cwd }); + const args = [`"${tarPath.path}"`]; + const cacheFileName = utils.getCacheFileName(compressionMethod); + const tarFile = 'cache.tar'; + const workingDirectory = getWorkingDirectory(); + // Speficic args for BSD tar on windows for workaround + const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD && + compressionMethod !== constants_1.CompressionMethod.Gzip && + IS_WINDOWS; + // Method specific args + switch (type) { + case 'create': + args.push('--posix', '-cf', BSD_TAR_ZSTD + ? tarFile + : cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '--exclude', BSD_TAR_ZSTD + ? tarFile + : cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P', '-C', workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '--files-from', constants_1.ManifestFilename); + break; + case 'extract': + args.push('-xf', BSD_TAR_ZSTD + ? tarFile + : archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P', '-C', workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/')); + break; + case 'list': + args.push('-tf', BSD_TAR_ZSTD + ? tarFile + : archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P'); + break; } - catch (error) { - throw new Error(`Tar failed with error: ${error === null || error === void 0 ? void 0 : error.message}`); + // Platform specific args + if (tarPath.type === constants_1.ArchiveToolType.GNU) { + switch (process.platform) { + case 'win32': + args.push('--force-local'); + break; + case 'darwin': + args.push('--delay-directory-restore'); + break; + } } + return args; + }); +} +// Returns commands to run tar and compression program +function getCommands(compressionMethod, type, archivePath = '') { + return __awaiter(this, void 0, void 0, function* () { + let args; + const tarPath = yield getTarPath(); + const tarArgs = yield getTarArgs(tarPath, compressionMethod, type, archivePath); + const compressionArgs = type !== 'create' + ? yield getDecompressionProgram(tarPath, compressionMethod, archivePath) + : yield getCompressionProgram(tarPath, compressionMethod); + const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD && + compressionMethod !== constants_1.CompressionMethod.Gzip && + IS_WINDOWS; + if (BSD_TAR_ZSTD && type !== 'create') { + args = [[...compressionArgs].join(' '), [...tarArgs].join(' ')]; + } + else { + args = [[...tarArgs].join(' '), [...compressionArgs].join(' ')]; + } + if (BSD_TAR_ZSTD) { + return args; + } + return [args.join(' ')]; }); } function getWorkingDirectory() { @@ -1119,91 +1449,119 @@ function getWorkingDirectory() { return (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : process.cwd(); } // Common function for extractTar and listTar to get the compression method -function getCompressionProgram(compressionMethod) { - // -d: Decompress. - // unzstd is equivalent to 'zstd -d' - // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. - // Using 30 here because we also support 32-bit self-hosted runners. - switch (compressionMethod) { - case constants_1.CompressionMethod.Zstd: - return [ - '--use-compress-program', - IS_WINDOWS ? 'zstd -d --long=30' : 'unzstd --long=30' - ]; - case constants_1.CompressionMethod.ZstdWithoutLong: - return ['--use-compress-program', IS_WINDOWS ? 'zstd -d' : 'unzstd']; - default: - return ['-z']; - } +function getDecompressionProgram(tarPath, compressionMethod, archivePath) { + return __awaiter(this, void 0, void 0, function* () { + // -d: Decompress. + // unzstd is equivalent to 'zstd -d' + // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. + // Using 30 here because we also support 32-bit self-hosted runners. + const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD && + compressionMethod !== constants_1.CompressionMethod.Gzip && + IS_WINDOWS; + switch (compressionMethod) { + case constants_1.CompressionMethod.Zstd: + return BSD_TAR_ZSTD + ? [ + 'zstd -d --long=30 --force -o', + constants_1.TarFilename, + archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/') + ] + : [ + '--use-compress-program', + IS_WINDOWS ? '"zstd -d --long=30"' : 'unzstd --long=30' + ]; + case constants_1.CompressionMethod.ZstdWithoutLong: + return BSD_TAR_ZSTD + ? [ + 'zstd -d --force -o', + constants_1.TarFilename, + archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/') + ] + : ['--use-compress-program', IS_WINDOWS ? '"zstd -d"' : 'unzstd']; + default: + return ['-z']; + } + }); +} +// Used for creating the archive +// -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores. +// zstdmt is equivalent to 'zstd -T0' +// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. +// Using 30 here because we also support 32-bit self-hosted runners. +// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd. +function getCompressionProgram(tarPath, compressionMethod) { + return __awaiter(this, void 0, void 0, function* () { + const cacheFileName = utils.getCacheFileName(compressionMethod); + const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD && + compressionMethod !== constants_1.CompressionMethod.Gzip && + IS_WINDOWS; + switch (compressionMethod) { + case constants_1.CompressionMethod.Zstd: + return BSD_TAR_ZSTD + ? [ + 'zstd -T0 --long=30 --force -o', + cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), + constants_1.TarFilename + ] + : [ + '--use-compress-program', + IS_WINDOWS ? '"zstd -T0 --long=30"' : 'zstdmt --long=30' + ]; + case constants_1.CompressionMethod.ZstdWithoutLong: + return BSD_TAR_ZSTD + ? [ + 'zstd -T0 --force -o', + cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), + constants_1.TarFilename + ] + : ['--use-compress-program', IS_WINDOWS ? '"zstd -T0"' : 'zstdmt']; + default: + return ['-z']; + } + }); } +// Executes all commands as separate processes +function execCommands(commands, cwd) { + return __awaiter(this, void 0, void 0, function* () { + for (const command of commands) { + try { + yield (0, exec_1.exec)(command, undefined, { + cwd, + env: Object.assign(Object.assign({}, process.env), { MSYS: 'winsymlinks:nativestrict' }) + }); + } + catch (error) { + throw new Error(`${command.split(' ')[0]} failed with error: ${error === null || error === void 0 ? void 0 : error.message}`); + } + } + }); +} +// List the contents of a tar function listTar(archivePath, compressionMethod) { return __awaiter(this, void 0, void 0, function* () { - const args = [ - ...getCompressionProgram(compressionMethod), - '-tf', - archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), - '-P' - ]; - yield execTar(args, compressionMethod); + const commands = yield getCommands(compressionMethod, 'list', archivePath); + yield execCommands(commands); }); } exports.listTar = listTar; +// Extract a tar function extractTar(archivePath, compressionMethod) { return __awaiter(this, void 0, void 0, function* () { // Create directory to extract tar into const workingDirectory = getWorkingDirectory(); yield io.mkdirP(workingDirectory); - const args = [ - ...getCompressionProgram(compressionMethod), - '-xf', - archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), - '-P', - '-C', - workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/') - ]; - yield execTar(args, compressionMethod); + const commands = yield getCommands(compressionMethod, 'extract', archivePath); + yield execCommands(commands); }); } exports.extractTar = extractTar; +// Create a tar function createTar(archiveFolder, sourceDirectories, compressionMethod) { return __awaiter(this, void 0, void 0, function* () { // Write source directories to manifest.txt to avoid command length limits - const manifestFilename = 'manifest.txt'; - const cacheFileName = utils.getCacheFileName(compressionMethod); - fs_1.writeFileSync(path.join(archiveFolder, manifestFilename), sourceDirectories.join('\n')); - const workingDirectory = getWorkingDirectory(); - // -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores. - // zstdmt is equivalent to 'zstd -T0' - // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. - // Using 30 here because we also support 32-bit self-hosted runners. - // Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd. - function getCompressionProgram() { - switch (compressionMethod) { - case constants_1.CompressionMethod.Zstd: - return [ - '--use-compress-program', - IS_WINDOWS ? 'zstd -T0 --long=30' : 'zstdmt --long=30' - ]; - case constants_1.CompressionMethod.ZstdWithoutLong: - return ['--use-compress-program', IS_WINDOWS ? 'zstd -T0' : 'zstdmt']; - default: - return ['-z']; - } - } - const args = [ - '--posix', - ...getCompressionProgram(), - '-cf', - cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), - '--exclude', - cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), - '-P', - '-C', - workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), - '--files-from', - manifestFilename - ]; - yield execTar(args, compressionMethod, archiveFolder); + (0, fs_1.writeFileSync)(path.join(archiveFolder, constants_1.ManifestFilename), sourceDirectories.join('\n')); + const commands = yield getCommands(compressionMethod, 'create'); + yield execCommands(commands, archiveFolder); }); } exports.createTar = createTar; @@ -1211,20 +1569,37 @@ exports.createTar = createTar; /***/ }), -/***/ 6215: +/***/ 76215: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const core = __importStar(__nccwpck_require__(2186)); +exports.getDownloadOptions = exports.getUploadOptions = void 0; +const core = __importStar(__nccwpck_require__(42186)); /** * Returns a copy of the upload options with defaults filled in. * @@ -1255,15 +1630,20 @@ exports.getUploadOptions = getUploadOptions; */ function getDownloadOptions(copy) { const result = { - useAzureSdk: true, + useAzureSdk: false, + concurrentBlobDownloads: true, downloadConcurrency: 8, timeoutInMs: 30000, - segmentTimeoutInMs: 3600000 + segmentTimeoutInMs: 600000, + lookupOnly: false }; if (copy) { if (typeof copy.useAzureSdk === 'boolean') { result.useAzureSdk = copy.useAzureSdk; } + if (typeof copy.concurrentBlobDownloads === 'boolean') { + result.concurrentBlobDownloads = copy.concurrentBlobDownloads; + } if (typeof copy.downloadConcurrency === 'number') { result.downloadConcurrency = copy.downloadConcurrency; } @@ -1273,6 +1653,9 @@ function getDownloadOptions(copy) { if (typeof copy.segmentTimeoutInMs === 'number') { result.segmentTimeoutInMs = copy.segmentTimeoutInMs; } + if (typeof copy.lookupOnly === 'boolean') { + result.lookupOnly = copy.lookupOnly; + } } const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']; if (segmentDownloadTimeoutMins && @@ -1285,6 +1668,7 @@ function getDownloadOptions(copy) { core.debug(`Request timeout (ms): ${result.timeoutInMs}`); core.debug(`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`); core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`); + core.debug(`Lookup only: ${result.lookupOnly}`); return result; } exports.getDownloadOptions = getDownloadOptions; @@ -1292,7 +1676,7 @@ exports.getDownloadOptions = getDownloadOptions; /***/ }), -/***/ 1597: +/***/ 31597: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1308,7 +1692,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.create = void 0; -const internal_globber_1 = __nccwpck_require__(7341); +const internal_globber_1 = __nccwpck_require__(27341); /** * Constructs a globber * @@ -1325,7 +1709,7 @@ exports.create = create; /***/ }), -/***/ 9350: +/***/ 99350: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1351,7 +1735,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getOptions = void 0; -const core = __importStar(__nccwpck_require__(2186)); +const core = __importStar(__nccwpck_require__(42186)); /** * Returns a copy with defaults filled in. */ @@ -1382,7 +1766,7 @@ exports.getOptions = getOptions; /***/ }), -/***/ 7341: +/***/ 27341: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1436,14 +1820,14 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DefaultGlobber = void 0; -const core = __importStar(__nccwpck_require__(2186)); -const fs = __importStar(__nccwpck_require__(7147)); -const globOptionsHelper = __importStar(__nccwpck_require__(9350)); -const path = __importStar(__nccwpck_require__(1017)); -const patternHelper = __importStar(__nccwpck_require__(5186)); -const internal_match_kind_1 = __nccwpck_require__(836); -const internal_pattern_1 = __nccwpck_require__(5343); -const internal_search_state_1 = __nccwpck_require__(8530); +const core = __importStar(__nccwpck_require__(42186)); +const fs = __importStar(__nccwpck_require__(57147)); +const globOptionsHelper = __importStar(__nccwpck_require__(99350)); +const path = __importStar(__nccwpck_require__(71017)); +const patternHelper = __importStar(__nccwpck_require__(95186)); +const internal_match_kind_1 = __nccwpck_require__(80836); +const internal_pattern_1 = __nccwpck_require__(35343); +const internal_search_state_1 = __nccwpck_require__(28530); const IS_WINDOWS = process.platform === 'win32'; class DefaultGlobber { constructor(options) { @@ -1624,7 +2008,7 @@ exports.DefaultGlobber = DefaultGlobber; /***/ }), -/***/ 836: +/***/ 80836: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -1649,7 +2033,7 @@ var MatchKind; /***/ }), -/***/ 1859: +/***/ 20022: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1678,8 +2062,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.safeTrimTrailingSeparator = exports.normalizeSeparators = exports.hasRoot = exports.hasAbsoluteRoot = exports.ensureAbsoluteRoot = exports.dirname = void 0; -const path = __importStar(__nccwpck_require__(1017)); -const assert_1 = __importDefault(__nccwpck_require__(9491)); +const path = __importStar(__nccwpck_require__(71017)); +const assert_1 = __importDefault(__nccwpck_require__(39491)); const IS_WINDOWS = process.platform === 'win32'; /** * Similar to path.dirname except normalizes the path separators and slightly better handling for Windows UNC paths. @@ -1854,7 +2238,7 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator; /***/ }), -/***/ 9413: +/***/ 19413: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1883,9 +2267,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Path = void 0; -const path = __importStar(__nccwpck_require__(1017)); -const pathHelper = __importStar(__nccwpck_require__(1859)); -const assert_1 = __importDefault(__nccwpck_require__(9491)); +const path = __importStar(__nccwpck_require__(71017)); +const pathHelper = __importStar(__nccwpck_require__(20022)); +const assert_1 = __importDefault(__nccwpck_require__(39491)); const IS_WINDOWS = process.platform === 'win32'; /** * Helper class for parsing paths into segments @@ -1974,7 +2358,7 @@ exports.Path = Path; /***/ }), -/***/ 5186: +/***/ 95186: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -2000,8 +2384,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.partialMatch = exports.match = exports.getSearchPaths = void 0; -const pathHelper = __importStar(__nccwpck_require__(1859)); -const internal_match_kind_1 = __nccwpck_require__(836); +const pathHelper = __importStar(__nccwpck_require__(20022)); +const internal_match_kind_1 = __nccwpck_require__(80836); const IS_WINDOWS = process.platform === 'win32'; /** * Given an array of patterns, returns an array of paths to search. @@ -2075,7 +2459,7 @@ exports.partialMatch = partialMatch; /***/ }), -/***/ 5343: +/***/ 35343: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -2104,13 +2488,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Pattern = void 0; -const os = __importStar(__nccwpck_require__(2037)); -const path = __importStar(__nccwpck_require__(1017)); -const pathHelper = __importStar(__nccwpck_require__(1859)); -const assert_1 = __importDefault(__nccwpck_require__(9491)); -const minimatch_1 = __nccwpck_require__(8085); -const internal_match_kind_1 = __nccwpck_require__(836); -const internal_path_1 = __nccwpck_require__(9413); +const os = __importStar(__nccwpck_require__(22037)); +const path = __importStar(__nccwpck_require__(71017)); +const pathHelper = __importStar(__nccwpck_require__(20022)); +const assert_1 = __importDefault(__nccwpck_require__(39491)); +const minimatch_1 = __nccwpck_require__(83973); +const internal_match_kind_1 = __nccwpck_require__(80836); +const internal_path_1 = __nccwpck_require__(19413); const IS_WINDOWS = process.platform === 'win32'; class Pattern { constructor(patternOrNegate, isImplicitPattern = false, segments, homedir) { @@ -2337,7 +2721,7 @@ exports.Pattern = Pattern; /***/ }), -/***/ 8530: +/***/ 28530: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -2355,7 +2739,7 @@ exports.SearchState = SearchState; /***/ }), -/***/ 2001: +/***/ 32001: /***/ (function(__unused_webpack_module, exports) { "use strict"; @@ -2443,7 +2827,7 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand /***/ }), -/***/ 1825: +/***/ 21825: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -2451,7 +2835,11 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand /* eslint-disable @typescript-eslint/no-explicit-any */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -2464,7 +2852,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -2479,10 +2867,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; -const http = __importStar(__nccwpck_require__(3685)); -const https = __importStar(__nccwpck_require__(5687)); +const http = __importStar(__nccwpck_require__(13685)); +const https = __importStar(__nccwpck_require__(95687)); const pm = __importStar(__nccwpck_require__(4977)); -const tunnel = __importStar(__nccwpck_require__(4294)); +const tunnel = __importStar(__nccwpck_require__(74294)); +const undici_1 = __nccwpck_require__(41773); var HttpCodes; (function (HttpCodes) { HttpCodes[HttpCodes["OK"] = 200] = "OK"; @@ -2512,16 +2901,16 @@ var HttpCodes; HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; -})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); +})(HttpCodes || (exports.HttpCodes = HttpCodes = {})); var Headers; (function (Headers) { Headers["Accept"] = "accept"; Headers["ContentType"] = "content-type"; -})(Headers = exports.Headers || (exports.Headers = {})); +})(Headers || (exports.Headers = Headers = {})); var MediaTypes; (function (MediaTypes) { MediaTypes["ApplicationJson"] = "application/json"; -})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); +})(MediaTypes || (exports.MediaTypes = MediaTypes = {})); /** * Returns the proxy URL, depending upon the supplied url and proxy environment variables. * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com @@ -2572,6 +2961,19 @@ class HttpClientResponse { })); }); } + readBodyBuffer() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { + const chunks = []; + this.message.on('data', (chunk) => { + chunks.push(chunk); + }); + this.message.on('end', () => { + resolve(Buffer.concat(chunks)); + }); + })); + }); + } } exports.HttpClientResponse = HttpClientResponse; function isHttps(requestUrl) { @@ -2877,6 +3279,15 @@ class HttpClient { const parsedUrl = new URL(serverUrl); return this._getAgent(parsedUrl); } + getAgentDispatcher(serverUrl) { + const parsedUrl = new URL(serverUrl); + const proxyUrl = pm.getProxyUrl(parsedUrl); + const useProxy = proxyUrl && proxyUrl.hostname; + if (!useProxy) { + return; + } + return this._getProxyAgentDispatcher(parsedUrl, proxyUrl); + } _prepareRequest(method, requestUrl, headers) { const info = {}; info.parsedUrl = requestUrl; @@ -2976,6 +3387,30 @@ class HttpClient { } return agent; } + _getProxyAgentDispatcher(parsedUrl, proxyUrl) { + let proxyAgent; + if (this._keepAlive) { + proxyAgent = this._proxyAgentDispatcher; + } + // if agent is already assigned use that agent. + if (proxyAgent) { + return proxyAgent; + } + const usingSsl = parsedUrl.protocol === 'https:'; + proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl.href, pipelining: !this._keepAlive ? 0 : 1 }, ((proxyUrl.username || proxyUrl.password) && { + token: `${proxyUrl.username}:${proxyUrl.password}` + }))); + this._proxyAgentDispatcher = proxyAgent; + if (usingSsl && this._ignoreSslError) { + // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process + // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options + // we have to cast it to any and change it directly + proxyAgent.options = Object.assign(proxyAgent.options.requestTls || {}, { + rejectUnauthorized: false + }); + } + return proxyAgent; + } _performExponentialBackoff(retryNumber) { return __awaiter(this, void 0, void 0, function* () { retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); @@ -3076,7 +3511,13 @@ function getProxyUrl(reqUrl) { } })(); if (proxyVar) { - return new URL(proxyVar); + try { + return new URL(proxyVar); + } + catch (_a) { + if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://')) + return new URL(`http://${proxyVar}`); + } } else { return undefined; @@ -3087,6 +3528,10 @@ function checkBypass(reqUrl) { if (!reqUrl.hostname) { return false; } + const reqHost = reqUrl.hostname; + if (isLoopbackAddress(reqHost)) { + return true; + } const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; if (!noProxy) { return false; @@ -3112,13 +3557,24 @@ function checkBypass(reqUrl) { .split(',') .map(x => x.trim().toUpperCase()) .filter(x => x)) { - if (upperReqHosts.some(x => x === upperNoProxyItem)) { + if (upperNoProxyItem === '*' || + upperReqHosts.some(x => x === upperNoProxyItem || + x.endsWith(`.${upperNoProxyItem}`) || + (upperNoProxyItem.startsWith('.') && + x.endsWith(`${upperNoProxyItem}`)))) { return true; } } return false; } exports.checkBypass = checkBypass; +function isLoopbackAddress(host) { + const hostLower = host.toLowerCase(); + return (hostLower === 'localhost' || + hostLower.startsWith('127.') || + hostLower.startsWith('[::1]') || + hostLower.startsWith('[0:0:0:0:0:0:0:1]')); +} //# sourceMappingURL=proxy.js.map /***/ }), @@ -3154,8 +3610,11 @@ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || // Max safe segment length for coercion. var MAX_SAFE_COMPONENT_LENGTH = 16 +var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + // The actual regexps go on exports.re var re = exports.re = [] +var safeRe = exports.safeRe = [] var src = exports.src = [] var t = exports.tokens = {} var R = 0 @@ -3164,6 +3623,31 @@ function tok (n) { t[n] = R++ } +var LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +var safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +function makeSafeRe (value) { + for (var i = 0; i < safeRegexReplacements.length; i++) { + var token = safeRegexReplacements[i][0] + var max = safeRegexReplacements[i][1] + value = value + .split(token + '*').join(token + '{0,' + max + '}') + .split(token + '+').join(token + '{1,' + max + '}') + } + return value +} + // The following Regular Expressions can be used for tokenizing, // validating, and parsing SemVer version strings. @@ -3173,14 +3657,14 @@ function tok (n) { tok('NUMERICIDENTIFIER') src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*' tok('NUMERICIDENTIFIERLOOSE') -src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+' +src[t.NUMERICIDENTIFIERLOOSE] = '\\d+' // ## Non-numeric Identifier // Zero or more digits, followed by a letter or hyphen, and then zero or // more letters, digits, or hyphens. tok('NONNUMERICIDENTIFIER') -src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' +src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*' // ## Main Version // Three dot-separated numeric identifiers. @@ -3222,7 +3706,7 @@ src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + // Any combination of digits, letters, or hyphens. tok('BUILDIDENTIFIER') -src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+' +src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+' // ## Build Metadata // Plus sign, followed by one or more period-separated build metadata @@ -3302,6 +3786,7 @@ src[t.COERCE] = '(^|[^\\d])' + '(?:$|[^\\d])' tok('COERCERTL') re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g') +safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g') // Tilde ranges. // Meaning is "reasonably at or greater than" @@ -3311,6 +3796,7 @@ src[t.LONETILDE] = '(?:~>?)' tok('TILDETRIM') src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+' re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g') +safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g') var tildeTrimReplace = '$1~' tok('TILDE') @@ -3326,6 +3812,7 @@ src[t.LONECARET] = '(?:\\^)' tok('CARETTRIM') src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+' re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g') +safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g') var caretTrimReplace = '$1^' tok('CARET') @@ -3347,6 +3834,7 @@ src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + // this one has to use the /g flag re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g') +safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g') var comparatorTrimReplace = '$1$2$3' // Something like `1.2.3 - 1.2.4` @@ -3375,6 +3863,14 @@ for (var i = 0; i < R; i++) { debug(i, src[i]) if (!re[i]) { re[i] = new RegExp(src[i]) + + // Replace all greedy whitespace to prevent regex dos issues. These regex are + // used internally via the safeRe object since all inputs in this library get + // normalized first to trim and collapse all extra whitespace. The original + // regexes are exported for userland consumption and lower level usage. A + // future breaking change could export the safer regex only with a note that + // all input should have extra whitespace removed. + safeRe[i] = new RegExp(makeSafeRe(src[i])) } } @@ -3399,7 +3895,7 @@ function parse (version, options) { return null } - var r = options.loose ? re[t.LOOSE] : re[t.FULL] + var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL] if (!r.test(version)) { return null } @@ -3454,7 +3950,7 @@ function SemVer (version, options) { this.options = options this.loose = !!options.loose - var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]) if (!m) { throw new TypeError('Invalid Version: ' + version) @@ -3899,6 +4395,7 @@ function Comparator (comp, options) { return new Comparator(comp, options) } + comp = comp.trim().split(/\s+/).join(' ') debug('comparator', comp, options) this.options = options this.loose = !!options.loose @@ -3915,7 +4412,7 @@ function Comparator (comp, options) { var ANY = {} Comparator.prototype.parse = function (comp) { - var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] var m = comp.match(r) if (!m) { @@ -4039,9 +4536,16 @@ function Range (range, options) { this.loose = !!options.loose this.includePrerelease = !!options.includePrerelease - // First, split based on boolean or || + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. this.raw = range - this.set = range.split(/\s*\|\|\s*/).map(function (range) { + .trim() + .split(/\s+/) + .join(' ') + + // First, split based on boolean or || + this.set = this.raw.split('||').map(function (range) { return this.parseRange(range.trim()) }, this).filter(function (c) { // throw out any that are not relevant for whatever reason @@ -4049,7 +4553,7 @@ function Range (range, options) { }) if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range) + throw new TypeError('Invalid SemVer Range: ' + this.raw) } this.format() @@ -4068,20 +4572,19 @@ Range.prototype.toString = function () { Range.prototype.parseRange = function (range) { var loose = this.options.loose - range = range.trim() // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE] range = range.replace(hr, hyphenReplace) debug('hyphen replace', range) // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[t.COMPARATORTRIM]) + range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, safeRe[t.COMPARATORTRIM]) // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace) // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[t.CARETTRIM], caretTrimReplace) + range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace) // normalize spaces range = range.split(/\s+/).join(' ') @@ -4089,7 +4592,7 @@ Range.prototype.parseRange = function (range) { // At this point, the range is completely trimmed and // ready to be split into comparators. - var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] var set = range.split(' ').map(function (comp) { return parseComparator(comp, this.options) }, this).join(' ').split(/\s+/) @@ -4189,7 +4692,7 @@ function replaceTildes (comp, options) { } function replaceTilde (comp, options) { - var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE] return comp.replace(r, function (_, M, m, p, pr) { debug('tilde', comp, _, M, m, p, pr) var ret @@ -4230,7 +4733,7 @@ function replaceCarets (comp, options) { function replaceCaret (comp, options) { debug('caret', comp, options) - var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET] return comp.replace(r, function (_, M, m, p, pr) { debug('caret', comp, _, M, m, p, pr) var ret @@ -4289,7 +4792,7 @@ function replaceXRanges (comp, options) { function replaceXRange (comp, options) { comp = comp.trim() - var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE] return comp.replace(r, function (ret, gtlt, M, m, p, pr) { debug('xRange', comp, ret, gtlt, M, m, p, pr) var xM = isX(M) @@ -4364,7 +4867,7 @@ function replaceXRange (comp, options) { function replaceStars (comp, options) { debug('replaceStars', comp, options) // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[t.STAR], '') + return comp.trim().replace(safeRe[t.STAR], '') } // This function is passed to string.replace(re[t.HYPHENRANGE]) @@ -4690,7 +5193,7 @@ function coerce (version, options) { var match = null if (!options.rtl) { - match = version.match(re[t.COERCE]) + match = version.match(safeRe[t.COERCE]) } else { // Find the right-most coercible string that does not share // a terminus with a more left-ward coercible string. @@ -4701,17 +5204,17 @@ function coerce (version, options) { // Stop when we get a match that ends at the string end, since no // coercible string can be more right-ward without the same terminus. var next - while ((next = re[t.COERCERTL].exec(version)) && + while ((next = safeRe[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length) ) { if (!match || next.index + next[0].length !== match.index + match[0].length) { match = next } - re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length } // leave it in a clean state - re[t.COERCERTL].lastIndex = -1 + safeRe[t.COERCERTL].lastIndex = -1 } if (match === null) { @@ -4726,7 +5229,7 @@ function coerce (version, options) { /***/ }), -/***/ 7351: +/***/ 87351: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -4752,7 +5255,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.issue = exports.issueCommand = void 0; -const os = __importStar(__nccwpck_require__(2037)); +const os = __importStar(__nccwpck_require__(22037)); const utils_1 = __nccwpck_require__(5278); /** * Commands @@ -4825,7 +5328,7 @@ function escapeProperty(s) { /***/ }), -/***/ 2186: +/***/ 42186: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -4860,12 +5363,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; -const command_1 = __nccwpck_require__(7351); +const command_1 = __nccwpck_require__(87351); const file_command_1 = __nccwpck_require__(717); const utils_1 = __nccwpck_require__(5278); -const os = __importStar(__nccwpck_require__(2037)); -const path = __importStar(__nccwpck_require__(1017)); -const oidc_utils_1 = __nccwpck_require__(8041); +const os = __importStar(__nccwpck_require__(22037)); +const path = __importStar(__nccwpck_require__(71017)); +const oidc_utils_1 = __nccwpck_require__(98041); /** * The code to exit an action */ @@ -5150,12 +5653,12 @@ exports.getIDToken = getIDToken; /** * Summary exports */ -var summary_1 = __nccwpck_require__(1327); +var summary_1 = __nccwpck_require__(81327); Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); /** * @deprecated use core.summary */ -var summary_2 = __nccwpck_require__(1327); +var summary_2 = __nccwpck_require__(81327); Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); /** * Path exports @@ -5197,9 +5700,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; // We use any as a valid input type /* eslint-disable @typescript-eslint/no-explicit-any */ -const fs = __importStar(__nccwpck_require__(7147)); -const os = __importStar(__nccwpck_require__(2037)); -const uuid_1 = __nccwpck_require__(8974); +const fs = __importStar(__nccwpck_require__(57147)); +const os = __importStar(__nccwpck_require__(22037)); +const uuid_1 = __nccwpck_require__(78974); const utils_1 = __nccwpck_require__(5278); function issueFileCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; @@ -5233,7 +5736,7 @@ exports.prepareKeyValueMessage = prepareKeyValueMessage; /***/ }), -/***/ 8041: +/***/ 98041: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -5249,9 +5752,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.OidcClient = void 0; -const http_client_1 = __nccwpck_require__(1404); -const auth_1 = __nccwpck_require__(6758); -const core_1 = __nccwpck_require__(2186); +const http_client_1 = __nccwpck_require__(11404); +const auth_1 = __nccwpck_require__(36758); +const core_1 = __nccwpck_require__(42186); class OidcClient { static createHttpClient(allowRetry = true, maxRetry = 10) { const requestOptions = { @@ -5343,7 +5846,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0; -const path = __importStar(__nccwpck_require__(1017)); +const path = __importStar(__nccwpck_require__(71017)); /** * toPosixPath converts the given path to the posix form. On Windows, \\ will be * replaced with /. @@ -5382,7 +5885,7 @@ exports.toPlatformPath = toPlatformPath; /***/ }), -/***/ 1327: +/***/ 81327: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -5398,8 +5901,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; -const os_1 = __nccwpck_require__(2037); -const fs_1 = __nccwpck_require__(7147); +const os_1 = __nccwpck_require__(22037); +const fs_1 = __nccwpck_require__(57147); const { access, appendFile, writeFile } = fs_1.promises; exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; @@ -5719,7 +6222,7 @@ exports.toCommandProperties = toCommandProperties; /***/ }), -/***/ 6758: +/***/ 36758: /***/ (function(__unused_webpack_module, exports) { "use strict"; @@ -5807,7 +6310,7 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand /***/ }), -/***/ 1404: +/***/ 11404: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -5843,10 +6346,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; -const http = __importStar(__nccwpck_require__(3685)); -const https = __importStar(__nccwpck_require__(5687)); -const pm = __importStar(__nccwpck_require__(2843)); -const tunnel = __importStar(__nccwpck_require__(4294)); +const http = __importStar(__nccwpck_require__(13685)); +const https = __importStar(__nccwpck_require__(95687)); +const pm = __importStar(__nccwpck_require__(72843)); +const tunnel = __importStar(__nccwpck_require__(74294)); var HttpCodes; (function (HttpCodes) { HttpCodes[HttpCodes["OK"] = 200] = "OK"; @@ -6419,7 +6922,7 @@ const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCa /***/ }), -/***/ 2843: +/***/ 72843: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -6487,7 +6990,7 @@ exports.checkBypass = checkBypass; /***/ }), -/***/ 8974: +/***/ 78974: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -6551,23 +7054,23 @@ Object.defineProperty(exports, "parse", ({ } })); -var _v = _interopRequireDefault(__nccwpck_require__(1595)); +var _v = _interopRequireDefault(__nccwpck_require__(81595)); -var _v2 = _interopRequireDefault(__nccwpck_require__(6993)); +var _v2 = _interopRequireDefault(__nccwpck_require__(26993)); -var _v3 = _interopRequireDefault(__nccwpck_require__(1472)); +var _v3 = _interopRequireDefault(__nccwpck_require__(51472)); -var _v4 = _interopRequireDefault(__nccwpck_require__(6217)); +var _v4 = _interopRequireDefault(__nccwpck_require__(16217)); -var _nil = _interopRequireDefault(__nccwpck_require__(2381)); +var _nil = _interopRequireDefault(__nccwpck_require__(32381)); -var _version = _interopRequireDefault(__nccwpck_require__(427)); +var _version = _interopRequireDefault(__nccwpck_require__(40427)); -var _validate = _interopRequireDefault(__nccwpck_require__(2609)); +var _validate = _interopRequireDefault(__nccwpck_require__(92609)); -var _stringify = _interopRequireDefault(__nccwpck_require__(1458)); +var _stringify = _interopRequireDefault(__nccwpck_require__(61458)); -var _parse = _interopRequireDefault(__nccwpck_require__(6385)); +var _parse = _interopRequireDefault(__nccwpck_require__(26385)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6603,7 +7106,7 @@ exports["default"] = _default; /***/ }), -/***/ 2381: +/***/ 32381: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -6618,7 +7121,7 @@ exports["default"] = _default; /***/ }), -/***/ 6385: +/***/ 26385: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -6629,7 +7132,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(2609)); +var _validate = _interopRequireDefault(__nccwpck_require__(92609)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6670,7 +7173,7 @@ exports["default"] = _default; /***/ }), -/***/ 6230: +/***/ 86230: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -6716,7 +7219,7 @@ function rng() { /***/ }), -/***/ 8844: +/***/ 38844: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -6746,7 +7249,7 @@ exports["default"] = _default; /***/ }), -/***/ 1458: +/***/ 61458: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -6757,7 +7260,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(2609)); +var _validate = _interopRequireDefault(__nccwpck_require__(92609)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6792,7 +7295,7 @@ exports["default"] = _default; /***/ }), -/***/ 1595: +/***/ 81595: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -6805,7 +7308,7 @@ exports["default"] = void 0; var _rng = _interopRequireDefault(__nccwpck_require__(9784)); -var _stringify = _interopRequireDefault(__nccwpck_require__(1458)); +var _stringify = _interopRequireDefault(__nccwpck_require__(61458)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6906,7 +7409,7 @@ exports["default"] = _default; /***/ }), -/***/ 6993: +/***/ 26993: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -6917,7 +7420,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(5920)); +var _v = _interopRequireDefault(__nccwpck_require__(65920)); var _md = _interopRequireDefault(__nccwpck_require__(5842)); @@ -6929,7 +7432,7 @@ exports["default"] = _default; /***/ }), -/***/ 5920: +/***/ 65920: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -6941,9 +7444,9 @@ Object.defineProperty(exports, "__esModule", ({ exports["default"] = _default; exports.URL = exports.DNS = void 0; -var _stringify = _interopRequireDefault(__nccwpck_require__(1458)); +var _stringify = _interopRequireDefault(__nccwpck_require__(61458)); -var _parse = _interopRequireDefault(__nccwpck_require__(6385)); +var _parse = _interopRequireDefault(__nccwpck_require__(26385)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -7014,7 +7517,7 @@ function _default(name, version, hashfunc) { /***/ }), -/***/ 1472: +/***/ 51472: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -7027,7 +7530,7 @@ exports["default"] = void 0; var _rng = _interopRequireDefault(__nccwpck_require__(9784)); -var _stringify = _interopRequireDefault(__nccwpck_require__(1458)); +var _stringify = _interopRequireDefault(__nccwpck_require__(61458)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -7058,7 +7561,7 @@ exports["default"] = _default; /***/ }), -/***/ 6217: +/***/ 16217: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -7069,9 +7572,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(5920)); +var _v = _interopRequireDefault(__nccwpck_require__(65920)); -var _sha = _interopRequireDefault(__nccwpck_require__(8844)); +var _sha = _interopRequireDefault(__nccwpck_require__(38844)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -7081,7 +7584,7 @@ exports["default"] = _default; /***/ }), -/***/ 2609: +/***/ 92609: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -7092,7 +7595,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _regex = _interopRequireDefault(__nccwpck_require__(6230)); +var _regex = _interopRequireDefault(__nccwpck_require__(86230)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -7105,7 +7608,7 @@ exports["default"] = _default; /***/ }), -/***/ 427: +/***/ 40427: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -7116,7 +7619,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(2609)); +var _validate = _interopRequireDefault(__nccwpck_require__(92609)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -7133,7 +7636,7 @@ exports["default"] = _default; /***/ }), -/***/ 1514: +/***/ 71514: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -7155,7 +7658,7 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const tr = __importStar(__nccwpck_require__(8159)); +const tr = __importStar(__nccwpck_require__(88159)); /** * Exec a command. * Output will be streamed to the live console. @@ -7184,7 +7687,7 @@ exports.exec = exec; /***/ }), -/***/ 8159: +/***/ 88159: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -7206,12 +7709,12 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const os = __importStar(__nccwpck_require__(2037)); -const events = __importStar(__nccwpck_require__(2361)); -const child = __importStar(__nccwpck_require__(2081)); -const path = __importStar(__nccwpck_require__(1017)); -const io = __importStar(__nccwpck_require__(7436)); -const ioUtil = __importStar(__nccwpck_require__(1962)); +const os = __importStar(__nccwpck_require__(22037)); +const events = __importStar(__nccwpck_require__(82361)); +const child = __importStar(__nccwpck_require__(32081)); +const path = __importStar(__nccwpck_require__(71017)); +const io = __importStar(__nccwpck_require__(47351)); +const ioUtil = __importStar(__nccwpck_require__(81962)); /* eslint-disable @typescript-eslint/unbound-method */ const IS_WINDOWS = process.platform === 'win32'; /* @@ -7791,7 +8294,7 @@ class ExecState extends events.EventEmitter { /***/ }), -/***/ 8090: +/***/ 28090: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -7807,7 +8310,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.hashFiles = exports.create = void 0; -const internal_globber_1 = __nccwpck_require__(8298); +const internal_globber_1 = __nccwpck_require__(28298); const internal_hash_files_1 = __nccwpck_require__(2448); /** * Constructs a globber @@ -7842,7 +8345,7 @@ exports.hashFiles = hashFiles; /***/ }), -/***/ 1026: +/***/ 51026: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -7868,7 +8371,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getOptions = void 0; -const core = __importStar(__nccwpck_require__(2186)); +const core = __importStar(__nccwpck_require__(42186)); /** * Returns a copy with defaults filled in. */ @@ -7904,7 +8407,7 @@ exports.getOptions = getOptions; /***/ }), -/***/ 8298: +/***/ 28298: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -7958,14 +8461,14 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DefaultGlobber = void 0; -const core = __importStar(__nccwpck_require__(2186)); -const fs = __importStar(__nccwpck_require__(7147)); -const globOptionsHelper = __importStar(__nccwpck_require__(1026)); -const path = __importStar(__nccwpck_require__(1017)); -const patternHelper = __importStar(__nccwpck_require__(9005)); -const internal_match_kind_1 = __nccwpck_require__(1063); -const internal_pattern_1 = __nccwpck_require__(4536); -const internal_search_state_1 = __nccwpck_require__(9117); +const core = __importStar(__nccwpck_require__(42186)); +const fs = __importStar(__nccwpck_require__(57147)); +const globOptionsHelper = __importStar(__nccwpck_require__(51026)); +const path = __importStar(__nccwpck_require__(71017)); +const patternHelper = __importStar(__nccwpck_require__(29005)); +const internal_match_kind_1 = __nccwpck_require__(81063); +const internal_pattern_1 = __nccwpck_require__(64536); +const internal_search_state_1 = __nccwpck_require__(89117); const IS_WINDOWS = process.platform === 'win32'; class DefaultGlobber { constructor(options) { @@ -8189,11 +8692,11 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.hashFiles = void 0; const crypto = __importStar(__nccwpck_require__(6113)); -const core = __importStar(__nccwpck_require__(2186)); -const fs = __importStar(__nccwpck_require__(7147)); -const stream = __importStar(__nccwpck_require__(2781)); -const util = __importStar(__nccwpck_require__(3837)); -const path = __importStar(__nccwpck_require__(1017)); +const core = __importStar(__nccwpck_require__(42186)); +const fs = __importStar(__nccwpck_require__(57147)); +const stream = __importStar(__nccwpck_require__(12781)); +const util = __importStar(__nccwpck_require__(73837)); +const path = __importStar(__nccwpck_require__(71017)); function hashFiles(globber) { var e_1, _a; var _b; @@ -8247,7 +8750,7 @@ exports.hashFiles = hashFiles; /***/ }), -/***/ 1063: +/***/ 81063: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -8272,7 +8775,7 @@ var MatchKind; /***/ }), -/***/ 1934: +/***/ 1849: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -8301,8 +8804,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.safeTrimTrailingSeparator = exports.normalizeSeparators = exports.hasRoot = exports.hasAbsoluteRoot = exports.ensureAbsoluteRoot = exports.dirname = void 0; -const path = __importStar(__nccwpck_require__(1017)); -const assert_1 = __importDefault(__nccwpck_require__(9491)); +const path = __importStar(__nccwpck_require__(71017)); +const assert_1 = __importDefault(__nccwpck_require__(39491)); const IS_WINDOWS = process.platform === 'win32'; /** * Similar to path.dirname except normalizes the path separators and slightly better handling for Windows UNC paths. @@ -8477,7 +8980,7 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator; /***/ }), -/***/ 6836: +/***/ 96836: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -8506,9 +9009,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Path = void 0; -const path = __importStar(__nccwpck_require__(1017)); -const pathHelper = __importStar(__nccwpck_require__(1934)); -const assert_1 = __importDefault(__nccwpck_require__(9491)); +const path = __importStar(__nccwpck_require__(71017)); +const pathHelper = __importStar(__nccwpck_require__(1849)); +const assert_1 = __importDefault(__nccwpck_require__(39491)); const IS_WINDOWS = process.platform === 'win32'; /** * Helper class for parsing paths into segments @@ -8597,7 +9100,7 @@ exports.Path = Path; /***/ }), -/***/ 9005: +/***/ 29005: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -8623,8 +9126,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.partialMatch = exports.match = exports.getSearchPaths = void 0; -const pathHelper = __importStar(__nccwpck_require__(1934)); -const internal_match_kind_1 = __nccwpck_require__(1063); +const pathHelper = __importStar(__nccwpck_require__(1849)); +const internal_match_kind_1 = __nccwpck_require__(81063); const IS_WINDOWS = process.platform === 'win32'; /** * Given an array of patterns, returns an array of paths to search. @@ -8698,7 +9201,7 @@ exports.partialMatch = partialMatch; /***/ }), -/***/ 4536: +/***/ 64536: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -8727,13 +9230,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Pattern = void 0; -const os = __importStar(__nccwpck_require__(2037)); -const path = __importStar(__nccwpck_require__(1017)); -const pathHelper = __importStar(__nccwpck_require__(1934)); -const assert_1 = __importDefault(__nccwpck_require__(9491)); -const minimatch_1 = __nccwpck_require__(8085); -const internal_match_kind_1 = __nccwpck_require__(1063); -const internal_path_1 = __nccwpck_require__(6836); +const os = __importStar(__nccwpck_require__(22037)); +const path = __importStar(__nccwpck_require__(71017)); +const pathHelper = __importStar(__nccwpck_require__(1849)); +const assert_1 = __importDefault(__nccwpck_require__(39491)); +const minimatch_1 = __nccwpck_require__(83973); +const internal_match_kind_1 = __nccwpck_require__(81063); +const internal_path_1 = __nccwpck_require__(96836); const IS_WINDOWS = process.platform === 'win32'; class Pattern { constructor(patternOrNegate, isImplicitPattern = false, segments, homedir) { @@ -8960,7 +9463,7 @@ exports.Pattern = Pattern; /***/ }), -/***/ 9117: +/***/ 89117: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -8978,15 +9481,15 @@ exports.SearchState = SearchState; /***/ }), -/***/ 9925: +/***/ 39925: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -const http = __nccwpck_require__(3685); -const https = __nccwpck_require__(5687); -const pm = __nccwpck_require__(6443); +const http = __nccwpck_require__(13685); +const https = __nccwpck_require__(95687); +const pm = __nccwpck_require__(16443); let tunnel; var HttpCodes; (function (HttpCodes) { @@ -9405,7 +9908,7 @@ class HttpClient { if (useProxy) { // If using proxy, need tunnel if (!tunnel) { - tunnel = __nccwpck_require__(4294); + tunnel = __nccwpck_require__(74294); } const agentOptions = { maxSockets: maxSockets, @@ -9523,7 +10026,7 @@ exports.HttpClient = HttpClient; /***/ }), -/***/ 6443: +/***/ 16443: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -9588,7 +10091,7 @@ exports.checkBypass = checkBypass; /***/ }), -/***/ 1962: +/***/ 81962: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -9604,9 +10107,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; var _a; Object.defineProperty(exports, "__esModule", ({ value: true })); -const assert_1 = __nccwpck_require__(9491); -const fs = __nccwpck_require__(7147); -const path = __nccwpck_require__(1017); +const assert_1 = __nccwpck_require__(39491); +const fs = __nccwpck_require__(57147); +const path = __nccwpck_require__(71017); _a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; exports.IS_WINDOWS = process.platform === 'win32'; function exists(fsPath) { @@ -9790,7 +10293,7 @@ function isUnixExecutable(stats) { /***/ }), -/***/ 7436: +/***/ 47351: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -9805,10 +10308,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const childProcess = __nccwpck_require__(2081); -const path = __nccwpck_require__(1017); -const util_1 = __nccwpck_require__(3837); -const ioUtil = __nccwpck_require__(1962); +const childProcess = __nccwpck_require__(32081); +const path = __nccwpck_require__(71017); +const util_1 = __nccwpck_require__(73837); +const ioUtil = __nccwpck_require__(81962); const exec = util_1.promisify(childProcess.exec); /** * Copies a file or folder. @@ -10087,7 +10590,7 @@ function copyFile(srcFile, destFile, force) { /***/ }), -/***/ 2473: +/***/ 32473: /***/ (function(module, exports, __nccwpck_require__) { "use strict"; @@ -10109,13 +10612,13 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const semver = __importStar(__nccwpck_require__(562)); -const core_1 = __nccwpck_require__(2186); +const semver = __importStar(__nccwpck_require__(70562)); +const core_1 = __nccwpck_require__(42186); // needs to be require for core node modules to be mocked /* eslint @typescript-eslint/no-require-imports: 0 */ -const os = __nccwpck_require__(2037); -const cp = __nccwpck_require__(2081); -const fs = __nccwpck_require__(7147); +const os = __nccwpck_require__(22037); +const cp = __nccwpck_require__(32081); +const fs = __nccwpck_require__(57147); function _findMatch(versionSpec, stable, candidates, archFilter) { return __awaiter(this, void 0, void 0, function* () { const platFilter = os.platform(); @@ -10200,7 +10703,7 @@ exports._readLinuxVersionFile = _readLinuxVersionFile; /***/ }), -/***/ 8279: +/***/ 38279: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -10222,7 +10725,7 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const core = __importStar(__nccwpck_require__(2186)); +const core = __importStar(__nccwpck_require__(42186)); /** * Internal class for retries */ @@ -10277,7 +10780,7 @@ exports.RetryHelper = RetryHelper; /***/ }), -/***/ 7784: +/***/ 27784: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -10302,20 +10805,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const core = __importStar(__nccwpck_require__(2186)); -const io = __importStar(__nccwpck_require__(7436)); -const fs = __importStar(__nccwpck_require__(7147)); -const mm = __importStar(__nccwpck_require__(2473)); -const os = __importStar(__nccwpck_require__(2037)); -const path = __importStar(__nccwpck_require__(1017)); -const httpm = __importStar(__nccwpck_require__(9925)); -const semver = __importStar(__nccwpck_require__(562)); -const stream = __importStar(__nccwpck_require__(2781)); -const util = __importStar(__nccwpck_require__(3837)); -const v4_1 = __importDefault(__nccwpck_require__(824)); -const exec_1 = __nccwpck_require__(1514); -const assert_1 = __nccwpck_require__(9491); -const retry_helper_1 = __nccwpck_require__(8279); +const core = __importStar(__nccwpck_require__(42186)); +const io = __importStar(__nccwpck_require__(47351)); +const fs = __importStar(__nccwpck_require__(57147)); +const mm = __importStar(__nccwpck_require__(32473)); +const os = __importStar(__nccwpck_require__(22037)); +const path = __importStar(__nccwpck_require__(71017)); +const httpm = __importStar(__nccwpck_require__(39925)); +const semver = __importStar(__nccwpck_require__(70562)); +const stream = __importStar(__nccwpck_require__(12781)); +const util = __importStar(__nccwpck_require__(73837)); +const v4_1 = __importDefault(__nccwpck_require__(80824)); +const exec_1 = __nccwpck_require__(71514); +const assert_1 = __nccwpck_require__(39491); +const retry_helper_1 = __nccwpck_require__(38279); class HTTPError extends Error { constructor(httpStatusCode) { super(`Unexpected HTTP response: ${httpStatusCode}`); @@ -10890,7 +11393,7 @@ function _unique(values) { /***/ }), -/***/ 562: +/***/ 70562: /***/ ((module, exports) => { exports = module.exports = SemVer @@ -10921,8 +11424,11 @@ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || // Max safe segment length for coercion. var MAX_SAFE_COMPONENT_LENGTH = 16 +var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + // The actual regexps go on exports.re var re = exports.re = [] +var safeRe = exports.safeRe = [] var src = exports.src = [] var t = exports.tokens = {} var R = 0 @@ -10931,6 +11437,31 @@ function tok (n) { t[n] = R++ } +var LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +var safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +function makeSafeRe (value) { + for (var i = 0; i < safeRegexReplacements.length; i++) { + var token = safeRegexReplacements[i][0] + var max = safeRegexReplacements[i][1] + value = value + .split(token + '*').join(token + '{0,' + max + '}') + .split(token + '+').join(token + '{1,' + max + '}') + } + return value +} + // The following Regular Expressions can be used for tokenizing, // validating, and parsing SemVer version strings. @@ -10940,14 +11471,14 @@ function tok (n) { tok('NUMERICIDENTIFIER') src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*' tok('NUMERICIDENTIFIERLOOSE') -src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+' +src[t.NUMERICIDENTIFIERLOOSE] = '\\d+' // ## Non-numeric Identifier // Zero or more digits, followed by a letter or hyphen, and then zero or // more letters, digits, or hyphens. tok('NONNUMERICIDENTIFIER') -src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' +src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*' // ## Main Version // Three dot-separated numeric identifiers. @@ -10989,7 +11520,7 @@ src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + // Any combination of digits, letters, or hyphens. tok('BUILDIDENTIFIER') -src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+' +src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+' // ## Build Metadata // Plus sign, followed by one or more period-separated build metadata @@ -11069,6 +11600,7 @@ src[t.COERCE] = '(^|[^\\d])' + '(?:$|[^\\d])' tok('COERCERTL') re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g') +safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g') // Tilde ranges. // Meaning is "reasonably at or greater than" @@ -11078,6 +11610,7 @@ src[t.LONETILDE] = '(?:~>?)' tok('TILDETRIM') src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+' re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g') +safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g') var tildeTrimReplace = '$1~' tok('TILDE') @@ -11093,6 +11626,7 @@ src[t.LONECARET] = '(?:\\^)' tok('CARETTRIM') src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+' re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g') +safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g') var caretTrimReplace = '$1^' tok('CARET') @@ -11114,6 +11648,7 @@ src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + // this one has to use the /g flag re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g') +safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g') var comparatorTrimReplace = '$1$2$3' // Something like `1.2.3 - 1.2.4` @@ -11142,6 +11677,14 @@ for (var i = 0; i < R; i++) { debug(i, src[i]) if (!re[i]) { re[i] = new RegExp(src[i]) + + // Replace all greedy whitespace to prevent regex dos issues. These regex are + // used internally via the safeRe object since all inputs in this library get + // normalized first to trim and collapse all extra whitespace. The original + // regexes are exported for userland consumption and lower level usage. A + // future breaking change could export the safer regex only with a note that + // all input should have extra whitespace removed. + safeRe[i] = new RegExp(makeSafeRe(src[i])) } } @@ -11166,7 +11709,7 @@ function parse (version, options) { return null } - var r = options.loose ? re[t.LOOSE] : re[t.FULL] + var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL] if (!r.test(version)) { return null } @@ -11221,7 +11764,7 @@ function SemVer (version, options) { this.options = options this.loose = !!options.loose - var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]) if (!m) { throw new TypeError('Invalid Version: ' + version) @@ -11666,6 +12209,7 @@ function Comparator (comp, options) { return new Comparator(comp, options) } + comp = comp.trim().split(/\s+/).join(' ') debug('comparator', comp, options) this.options = options this.loose = !!options.loose @@ -11682,7 +12226,7 @@ function Comparator (comp, options) { var ANY = {} Comparator.prototype.parse = function (comp) { - var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] var m = comp.match(r) if (!m) { @@ -11806,9 +12350,16 @@ function Range (range, options) { this.loose = !!options.loose this.includePrerelease = !!options.includePrerelease - // First, split based on boolean or || + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. this.raw = range - this.set = range.split(/\s*\|\|\s*/).map(function (range) { + .trim() + .split(/\s+/) + .join(' ') + + // First, split based on boolean or || + this.set = this.raw.split('||').map(function (range) { return this.parseRange(range.trim()) }, this).filter(function (c) { // throw out any that are not relevant for whatever reason @@ -11816,7 +12367,7 @@ function Range (range, options) { }) if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range) + throw new TypeError('Invalid SemVer Range: ' + this.raw) } this.format() @@ -11835,20 +12386,19 @@ Range.prototype.toString = function () { Range.prototype.parseRange = function (range) { var loose = this.options.loose - range = range.trim() // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE] range = range.replace(hr, hyphenReplace) debug('hyphen replace', range) // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[t.COMPARATORTRIM]) + range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, safeRe[t.COMPARATORTRIM]) // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace) // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[t.CARETTRIM], caretTrimReplace) + range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace) // normalize spaces range = range.split(/\s+/).join(' ') @@ -11856,7 +12406,7 @@ Range.prototype.parseRange = function (range) { // At this point, the range is completely trimmed and // ready to be split into comparators. - var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] var set = range.split(' ').map(function (comp) { return parseComparator(comp, this.options) }, this).join(' ').split(/\s+/) @@ -11956,7 +12506,7 @@ function replaceTildes (comp, options) { } function replaceTilde (comp, options) { - var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE] return comp.replace(r, function (_, M, m, p, pr) { debug('tilde', comp, _, M, m, p, pr) var ret @@ -11997,7 +12547,7 @@ function replaceCarets (comp, options) { function replaceCaret (comp, options) { debug('caret', comp, options) - var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET] return comp.replace(r, function (_, M, m, p, pr) { debug('caret', comp, _, M, m, p, pr) var ret @@ -12056,7 +12606,7 @@ function replaceXRanges (comp, options) { function replaceXRange (comp, options) { comp = comp.trim() - var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE] return comp.replace(r, function (ret, gtlt, M, m, p, pr) { debug('xRange', comp, ret, gtlt, M, m, p, pr) var xM = isX(M) @@ -12131,7 +12681,7 @@ function replaceXRange (comp, options) { function replaceStars (comp, options) { debug('replaceStars', comp, options) // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[t.STAR], '') + return comp.trim().replace(safeRe[t.STAR], '') } // This function is passed to string.replace(re[t.HYPHENRANGE]) @@ -12457,7 +13007,7 @@ function coerce (version, options) { var match = null if (!options.rtl) { - match = version.match(re[t.COERCE]) + match = version.match(safeRe[t.COERCE]) } else { // Find the right-most coercible string that does not share // a terminus with a more left-ward coercible string. @@ -12468,17 +13018,17 @@ function coerce (version, options) { // Stop when we get a match that ends at the string end, since no // coercible string can be more right-ward without the same terminus. var next - while ((next = re[t.COERCERTL].exec(version)) && + while ((next = safeRe[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length) ) { if (!match || next.index + next[0].length !== match.index + match[0].length) { match = next } - re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length } // leave it in a clean state - re[t.COERCERTL].lastIndex = -1 + safeRe[t.COERCERTL].lastIndex = -1 } if (match === null) { @@ -12493,20 +13043,19 @@ function coerce (version, options) { /***/ }), -/***/ 2557: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 52557: +/***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var tslib = __nccwpck_require__(9268); - // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -var listenersMap = new WeakMap(); -var abortedMap = new WeakMap(); +/// +const listenersMap = new WeakMap(); +const abortedMap = new WeakMap(); /** * An aborter instance implements AbortSignal interface, can abort HTTP requests. * @@ -12520,8 +13069,8 @@ var abortedMap = new WeakMap(); * await doAsyncWork(AbortSignal.none); * ``` */ -var AbortSignal = /** @class */ (function () { - function AbortSignal() { +class AbortSignal { + constructor() { /** * onabort event listener. */ @@ -12529,74 +13078,65 @@ var AbortSignal = /** @class */ (function () { listenersMap.set(this, []); abortedMap.set(this, false); } - Object.defineProperty(AbortSignal.prototype, "aborted", { - /** - * Status of whether aborted or not. - * - * @readonly - */ - get: function () { - if (!abortedMap.has(this)) { - throw new TypeError("Expected `this` to be an instance of AbortSignal."); - } - return abortedMap.get(this); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AbortSignal, "none", { - /** - * Creates a new AbortSignal instance that will never be aborted. - * - * @readonly - */ - get: function () { - return new AbortSignal(); - }, - enumerable: false, - configurable: true - }); + /** + * Status of whether aborted or not. + * + * @readonly + */ + get aborted() { + if (!abortedMap.has(this)) { + throw new TypeError("Expected `this` to be an instance of AbortSignal."); + } + return abortedMap.get(this); + } + /** + * Creates a new AbortSignal instance that will never be aborted. + * + * @readonly + */ + static get none() { + return new AbortSignal(); + } /** * Added new "abort" event listener, only support "abort" event. * * @param _type - Only support "abort" event * @param listener - The listener to be added */ - AbortSignal.prototype.addEventListener = function ( + addEventListener( // tslint:disable-next-line:variable-name _type, listener) { if (!listenersMap.has(this)) { throw new TypeError("Expected `this` to be an instance of AbortSignal."); } - var listeners = listenersMap.get(this); + const listeners = listenersMap.get(this); listeners.push(listener); - }; + } /** * Remove "abort" event listener, only support "abort" event. * * @param _type - Only support "abort" event * @param listener - The listener to be removed */ - AbortSignal.prototype.removeEventListener = function ( + removeEventListener( // tslint:disable-next-line:variable-name _type, listener) { if (!listenersMap.has(this)) { throw new TypeError("Expected `this` to be an instance of AbortSignal."); } - var listeners = listenersMap.get(this); - var index = listeners.indexOf(listener); + const listeners = listenersMap.get(this); + const index = listeners.indexOf(listener); if (index > -1) { listeners.splice(index, 1); } - }; + } /** * Dispatches a synthetic event to the AbortSignal. */ - AbortSignal.prototype.dispatchEvent = function (_event) { + dispatchEvent(_event) { throw new Error("This is a stub dispatchEvent implementation that should not be used. It only exists for type-checking purposes."); - }; - return AbortSignal; -}()); + } +} /** * Helper to trigger an abort event immediately, the onabort and all abort event listeners will be triggered. * Will try to trigger abort event for all linked AbortSignal nodes. @@ -12614,12 +13154,12 @@ function abortSignal(signal) { if (signal.onabort) { signal.onabort.call(signal); } - var listeners = listenersMap.get(signal); + const listeners = listenersMap.get(signal); if (listeners) { // Create a copy of listeners so mutations to the array // (e.g. via removeListener calls) don't affect the listeners // we invoke. - listeners.slice().forEach(function (listener) { + listeners.slice().forEach((listener) => { listener.call(signal, { type: "abort" }); }); } @@ -12645,15 +13185,12 @@ function abortSignal(signal) { * } * ``` */ -var AbortError = /** @class */ (function (_super) { - tslib.__extends(AbortError, _super); - function AbortError(message) { - var _this = _super.call(this, message) || this; - _this.name = "AbortError"; - return _this; +class AbortError extends Error { + constructor(message) { + super(message); + this.name = "AbortError"; } - return AbortError; -}(Error)); +} /** * An AbortController provides an AbortSignal and the associated controls to signal * that an asynchronous operation should be aborted. @@ -12688,10 +13225,9 @@ var AbortError = /** @class */ (function (_super) { * await doAsyncWork(aborter.withTimeout(25 * 1000)); * ``` */ -var AbortController = /** @class */ (function () { +class AbortController { // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - function AbortController(parentSignals) { - var _this = this; + constructor(parentSignals) { this._signal = new AbortSignal(); if (!parentSignals) { return; @@ -12701,8 +13237,7 @@ var AbortController = /** @class */ (function () { // eslint-disable-next-line prefer-rest-params parentSignals = arguments; } - for (var _i = 0, parentSignals_1 = parentSignals; _i < parentSignals_1.length; _i++) { - var parentSignal = parentSignals_1[_i]; + for (const parentSignal of parentSignals) { // if the parent signal has already had abort() called, // then call abort on this signal as well. if (parentSignal.aborted) { @@ -12710,47 +13245,42 @@ var AbortController = /** @class */ (function () { } else { // when the parent signal aborts, this signal should as well. - parentSignal.addEventListener("abort", function () { - _this.abort(); + parentSignal.addEventListener("abort", () => { + this.abort(); }); } } } - Object.defineProperty(AbortController.prototype, "signal", { - /** - * The AbortSignal associated with this controller that will signal aborted - * when the abort method is called on this controller. - * - * @readonly - */ - get: function () { - return this._signal; - }, - enumerable: false, - configurable: true - }); + /** + * The AbortSignal associated with this controller that will signal aborted + * when the abort method is called on this controller. + * + * @readonly + */ + get signal() { + return this._signal; + } /** * Signal that any operations passed this controller's associated abort signal * to cancel any remaining work and throw an `AbortError`. */ - AbortController.prototype.abort = function () { + abort() { abortSignal(this._signal); - }; + } /** * Creates a new AbortSignal instance that will abort after the provided ms. * @param ms - Elapsed time in milliseconds to trigger an abort. */ - AbortController.timeout = function (ms) { - var signal = new AbortSignal(); - var timer = setTimeout(abortSignal, ms, signal); + static timeout(ms) { + const signal = new AbortSignal(); + const timer = setTimeout(abortSignal, ms, signal); // Prevent the active Timer from keeping the Node.js event loop active. if (typeof timer.unref === "function") { timer.unref(); } return signal; - }; - return AbortController; -}()); + } +} exports.AbortController = AbortController; exports.AbortError = AbortError; @@ -12758,319 +13288,6 @@ exports.AbortSignal = AbortSignal; //# sourceMappingURL=index.js.map -/***/ }), - -/***/ 9268: -/***/ ((module) => { - -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if ( true && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); -}); - - /***/ }), /***/ 2356: @@ -13087,7 +13304,7 @@ if (typeof Symbol === undefined || !Symbol.asyncIterator) { /***/ }), -/***/ 9645: +/***/ 39645: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -13310,7 +13527,7 @@ exports.isTokenCredential = isTokenCredential; /***/ }), -/***/ 4607: +/***/ 24607: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -13318,22 +13535,22 @@ exports.isTokenCredential = isTokenCredential; Object.defineProperty(exports, "__esModule", ({ value: true })); -var uuid = __nccwpck_require__(3415); -var util = __nccwpck_require__(3837); -var tslib = __nccwpck_require__(2107); -var xml2js = __nccwpck_require__(6189); -var coreUtil = __nccwpck_require__(1333); +var uuid = __nccwpck_require__(43415); +var util = __nccwpck_require__(73837); +var tslib = __nccwpck_require__(82107); +var xml2js = __nccwpck_require__(66189); +var coreUtil = __nccwpck_require__(51333); var logger$1 = __nccwpck_require__(3233); -var coreAuth = __nccwpck_require__(9645); -var os = __nccwpck_require__(2037); -var http = __nccwpck_require__(3685); -var https = __nccwpck_require__(5687); -var abortController = __nccwpck_require__(2557); -var tunnel = __nccwpck_require__(4294); -var stream = __nccwpck_require__(2781); -var FormData = __nccwpck_require__(6279); -var node_fetch = __nccwpck_require__(467); -var coreTracing = __nccwpck_require__(4175); +var coreAuth = __nccwpck_require__(39645); +var os = __nccwpck_require__(22037); +var http = __nccwpck_require__(13685); +var https = __nccwpck_require__(95687); +var abortController = __nccwpck_require__(52557); +var tunnel = __nccwpck_require__(74294); +var stream = __nccwpck_require__(12781); +var FormData = __nccwpck_require__(46279); +var node_fetch = __nccwpck_require__(80467); +var coreTracing = __nccwpck_require__(94175); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } @@ -18790,20 +19007,20 @@ exports.userAgentPolicy = userAgentPolicy; /***/ }), -/***/ 6279: +/***/ 46279: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var CombinedStream = __nccwpck_require__(5443); -var util = __nccwpck_require__(3837); -var path = __nccwpck_require__(1017); -var http = __nccwpck_require__(3685); -var https = __nccwpck_require__(5687); -var parseUrl = (__nccwpck_require__(7310).parse); -var fs = __nccwpck_require__(7147); -var Stream = (__nccwpck_require__(2781).Stream); -var mime = __nccwpck_require__(3583); -var asynckit = __nccwpck_require__(4812); -var populate = __nccwpck_require__(3971); +var CombinedStream = __nccwpck_require__(85443); +var util = __nccwpck_require__(73837); +var path = __nccwpck_require__(71017); +var http = __nccwpck_require__(13685); +var https = __nccwpck_require__(95687); +var parseUrl = (__nccwpck_require__(57310).parse); +var fs = __nccwpck_require__(57147); +var Stream = (__nccwpck_require__(12781).Stream); +var mime = __nccwpck_require__(43583); +var asynckit = __nccwpck_require__(14812); +var populate = __nccwpck_require__(63971); // Public API module.exports = FormData; @@ -19298,7 +19515,7 @@ FormData.prototype.toString = function () { /***/ }), -/***/ 3971: +/***/ 63971: /***/ ((module) => { // populates missing values @@ -19315,384 +19532,384 @@ module.exports = function(dst, src) { /***/ }), -/***/ 2107: +/***/ 82107: /***/ ((module) => { -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __esDecorate; -var __runInitializers; -var __propKey; -var __setFunctionName; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __classPrivateFieldIn; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if ( true && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for (var i = decorators.length - 1; i >= 0; i--) { - var context = {}; - for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; - for (var p in contextIn.access) context.access[p] = contextIn.access[p]; - context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; - var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.push(_); - } - else if (_ = accept(result)) { - if (kind === "field") initializers.push(_); - else descriptor[key] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; - }; - - __runInitializers = function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; - }; - - __propKey = function (x) { - return typeof x === "symbol" ? x : "".concat(x); - }; - - __setFunctionName = function (f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; - - __classPrivateFieldIn = function (state, receiver) { - if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__esDecorate", __esDecorate); - exporter("__runInitializers", __runInitializers); - exporter("__propKey", __propKey); - exporter("__setFunctionName", __setFunctionName); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); - exporter("__classPrivateFieldIn", __classPrivateFieldIn); -}); - - -/***/ }), - -/***/ 3415: +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __esDecorate; +var __runInitializers; +var __propKey; +var __setFunctionName; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __classPrivateFieldIn; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.push(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.push(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; + }; + + __runInitializers = function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; + }; + + __propKey = function (x) { + return typeof x === "symbol" ? x : "".concat(x); + }; + + __setFunctionName = function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + + __classPrivateFieldIn = function (state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__esDecorate", __esDecorate); + exporter("__runInitializers", __runInitializers); + exporter("__propKey", __propKey); + exporter("__setFunctionName", __setFunctionName); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); + exporter("__classPrivateFieldIn", __classPrivateFieldIn); +}); + + +/***/ }), + +/***/ 43415: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -19756,29 +19973,29 @@ Object.defineProperty(exports, "parse", ({ } })); -var _v = _interopRequireDefault(__nccwpck_require__(4757)); +var _v = _interopRequireDefault(__nccwpck_require__(14757)); -var _v2 = _interopRequireDefault(__nccwpck_require__(9982)); +var _v2 = _interopRequireDefault(__nccwpck_require__(19982)); -var _v3 = _interopRequireDefault(__nccwpck_require__(5393)); +var _v3 = _interopRequireDefault(__nccwpck_require__(85393)); -var _v4 = _interopRequireDefault(__nccwpck_require__(8788)); +var _v4 = _interopRequireDefault(__nccwpck_require__(48788)); var _nil = _interopRequireDefault(__nccwpck_require__(657)); -var _version = _interopRequireDefault(__nccwpck_require__(7909)); +var _version = _interopRequireDefault(__nccwpck_require__(37909)); -var _validate = _interopRequireDefault(__nccwpck_require__(4418)); +var _validate = _interopRequireDefault(__nccwpck_require__(64418)); -var _stringify = _interopRequireDefault(__nccwpck_require__(4794)); +var _stringify = _interopRequireDefault(__nccwpck_require__(74794)); -var _parse = _interopRequireDefault(__nccwpck_require__(7079)); +var _parse = _interopRequireDefault(__nccwpck_require__(67079)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), -/***/ 4153: +/***/ 64153: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -19823,7 +20040,7 @@ exports["default"] = _default; /***/ }), -/***/ 7079: +/***/ 67079: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -19834,7 +20051,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(4418)); +var _validate = _interopRequireDefault(__nccwpck_require__(64418)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -19875,7 +20092,7 @@ exports["default"] = _default; /***/ }), -/***/ 690: +/***/ 90690: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -19890,7 +20107,7 @@ exports["default"] = _default; /***/ }), -/***/ 979: +/***/ 10979: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -19921,7 +20138,7 @@ function rng() { /***/ }), -/***/ 6631: +/***/ 36631: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -19951,7 +20168,7 @@ exports["default"] = _default; /***/ }), -/***/ 4794: +/***/ 74794: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -19962,7 +20179,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(4418)); +var _validate = _interopRequireDefault(__nccwpck_require__(64418)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -19997,7 +20214,7 @@ exports["default"] = _default; /***/ }), -/***/ 4757: +/***/ 14757: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -20008,9 +20225,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _rng = _interopRequireDefault(__nccwpck_require__(979)); +var _rng = _interopRequireDefault(__nccwpck_require__(10979)); -var _stringify = _interopRequireDefault(__nccwpck_require__(4794)); +var _stringify = _interopRequireDefault(__nccwpck_require__(74794)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -20111,7 +20328,7 @@ exports["default"] = _default; /***/ }), -/***/ 9982: +/***/ 19982: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -20122,9 +20339,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(4085)); +var _v = _interopRequireDefault(__nccwpck_require__(44085)); -var _md = _interopRequireDefault(__nccwpck_require__(4153)); +var _md = _interopRequireDefault(__nccwpck_require__(64153)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -20134,7 +20351,7 @@ exports["default"] = _default; /***/ }), -/***/ 4085: +/***/ 44085: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -20146,9 +20363,9 @@ Object.defineProperty(exports, "__esModule", ({ exports["default"] = _default; exports.URL = exports.DNS = void 0; -var _stringify = _interopRequireDefault(__nccwpck_require__(4794)); +var _stringify = _interopRequireDefault(__nccwpck_require__(74794)); -var _parse = _interopRequireDefault(__nccwpck_require__(7079)); +var _parse = _interopRequireDefault(__nccwpck_require__(67079)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -20219,7 +20436,7 @@ function _default(name, version, hashfunc) { /***/ }), -/***/ 5393: +/***/ 85393: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -20230,9 +20447,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _rng = _interopRequireDefault(__nccwpck_require__(979)); +var _rng = _interopRequireDefault(__nccwpck_require__(10979)); -var _stringify = _interopRequireDefault(__nccwpck_require__(4794)); +var _stringify = _interopRequireDefault(__nccwpck_require__(74794)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -20263,7 +20480,7 @@ exports["default"] = _default; /***/ }), -/***/ 8788: +/***/ 48788: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -20274,9 +20491,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(4085)); +var _v = _interopRequireDefault(__nccwpck_require__(44085)); -var _sha = _interopRequireDefault(__nccwpck_require__(6631)); +var _sha = _interopRequireDefault(__nccwpck_require__(36631)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -20286,7 +20503,7 @@ exports["default"] = _default; /***/ }), -/***/ 4418: +/***/ 64418: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -20297,7 +20514,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _regex = _interopRequireDefault(__nccwpck_require__(690)); +var _regex = _interopRequireDefault(__nccwpck_require__(90690)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -20310,7 +20527,7 @@ exports["default"] = _default; /***/ }), -/***/ 7909: +/***/ 37909: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -20321,7 +20538,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(4418)); +var _validate = _interopRequireDefault(__nccwpck_require__(64418)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -20338,7 +20555,7 @@ exports["default"] = _default; /***/ }), -/***/ 7094: +/***/ 27094: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -21097,7 +21314,7 @@ exports.PollerStoppedError = PollerStoppedError; /***/ }), -/***/ 4559: +/***/ 74559: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -21106,7 +21323,7 @@ exports.PollerStoppedError = PollerStoppedError; Object.defineProperty(exports, "__esModule", ({ value: true })); __nccwpck_require__(2356); -var tslib = __nccwpck_require__(6429); +var tslib = __nccwpck_require__(26429); // Copyright (c) Microsoft Corporation. /** @@ -21179,320 +21396,320 @@ exports.getPagedAsyncIterator = getPagedAsyncIterator; /***/ }), -/***/ 6429: +/***/ 26429: /***/ ((module) => { -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if ( true && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); -}); - - -/***/ }), - -/***/ 4175: +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); +}); + + +/***/ }), + +/***/ 94175: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -21500,7 +21717,7 @@ var __createBinding; Object.defineProperty(exports, "__esModule", ({ value: true })); -var api = __nccwpck_require__(5163); +var api = __nccwpck_require__(65163); // Copyright (c) Microsoft Corporation. (function (SpanKind) { @@ -21719,7 +21936,7 @@ exports.setSpanContext = setSpanContext; /***/ }), -/***/ 1333: +/***/ 51333: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -21727,7 +21944,7 @@ exports.setSpanContext = setSpanContext; Object.defineProperty(exports, "__esModule", ({ value: true })); -var abortController = __nccwpck_require__(2557); +var abortController = __nccwpck_require__(52557); var crypto = __nccwpck_require__(6113); // Copyright (c) Microsoft Corporation. @@ -21971,8 +22188,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var util = _interopDefault(__nccwpck_require__(3837)); -var os = __nccwpck_require__(2037); +var util = _interopDefault(__nccwpck_require__(73837)); +var os = __nccwpck_require__(22037); // Copyright (c) Microsoft Corporation. function log(message, ...args) { @@ -22179,7 +22396,7 @@ exports.setLogLevel = setLogLevel; /***/ }), -/***/ 4100: +/***/ 84100: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -22187,19 +22404,19 @@ exports.setLogLevel = setLogLevel; Object.defineProperty(exports, "__esModule", ({ value: true })); -var coreHttp = __nccwpck_require__(4607); -var tslib = __nccwpck_require__(679); -var coreTracing = __nccwpck_require__(4175); +var coreHttp = __nccwpck_require__(24607); +var tslib = __nccwpck_require__(70679); +var coreTracing = __nccwpck_require__(94175); var logger$1 = __nccwpck_require__(3233); -var abortController = __nccwpck_require__(2557); -var os = __nccwpck_require__(2037); +var abortController = __nccwpck_require__(52557); +var os = __nccwpck_require__(22037); var crypto = __nccwpck_require__(6113); -var stream = __nccwpck_require__(2781); -__nccwpck_require__(4559); -var coreLro = __nccwpck_require__(7094); -var events = __nccwpck_require__(2361); -var fs = __nccwpck_require__(7147); -var util = __nccwpck_require__(3837); +var stream = __nccwpck_require__(12781); +__nccwpck_require__(74559); +var coreLro = __nccwpck_require__(27094); +var events = __nccwpck_require__(82361); +var fs = __nccwpck_require__(57147); +var util = __nccwpck_require__(73837); function _interopNamespace(e) { if (e && e.__esModule) return e; @@ -40965,7 +41182,7 @@ class BuffersStream extends stream.Readable { * maxBufferLength is max size of each buffer in the pooled buffers. */ // Can't use import as Typescript doesn't recognize "buffer". -const maxBufferLength = (__nccwpck_require__(4300).constants.MAX_LENGTH); +const maxBufferLength = (__nccwpck_require__(14300).constants.MAX_LENGTH); /** * This class provides a buffer container which conceptually has no hard size limit. * It accepts a capacity, an array of input buffers and the total length of input data. @@ -47308,1091 +47525,1742 @@ exports.newPipeline = newPipeline; /***/ }), -/***/ 679: +/***/ 70679: /***/ ((module) => { -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if ( true && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); -}); - - -/***/ }), - -/***/ 2206: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; -"use strict"; + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } + return t; }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var EventAlgorithm_1 = __nccwpck_require__(8217); -/** - * Adds an algorithm to the given abort signal. - * - * @param algorithm - an algorithm - * @param signal - abort signal - */ -function abort_add(algorithm, signal) { - /** - * 1. If signal’s aborted flag is set, then return. - * 2. Append algorithm to signal’s abort algorithms. - */ - if (signal._abortedFlag) - return; - signal._abortAlgorithms.add(algorithm); -} -exports.abort_add = abort_add; -/** - * Removes an algorithm from the given abort signal. - * - * @param algorithm - an algorithm - * @param signal - abort signal - */ -function abort_remove(algorithm, signal) { - /** - * To remove an algorithm algorithm from an AbortSignal signal, remove - * algorithm from signal’s abort algorithms. - */ - signal._abortAlgorithms.delete(algorithm); -} -exports.abort_remove = abort_remove; -/** - * Signals abort on the given abort signal. - * - * @param signal - abort signal - */ -function abort_signalAbort(signal) { - var e_1, _a; - /** - * 1. If signal’s aborted flag is set, then return. - * 2. Set signal’s aborted flag. - * 3. For each algorithm in signal’s abort algorithms: run algorithm. - * 4. Empty signal’s abort algorithms. - * 5. Fire an event named abort at signal. - */ - if (signal._abortedFlag) - return; - signal._abortedFlag = true; - try { - for (var _b = __values(signal._abortAlgorithms), _c = _b.next(); !_c.done; _c = _b.next()) { - var algorithm = _c.value; - algorithm.call(signal); + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } - finally { if (e_1) throw e_1.error; } - } - signal._abortAlgorithms.clear(); - EventAlgorithm_1.event_fireAnEvent("abort", signal); -} -exports.abort_signalAbort = abort_signalAbort; -//# sourceMappingURL=AbortAlgorithm.js.map + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; -/***/ }), + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; -/***/ 4309: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; -"use strict"; + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); +}); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var ElementAlgorithm_1 = __nccwpck_require__(1849); -/** - * Changes the value of an existing attribute. - * - * @param attribute - an attribute node - * @param value - attribute value - */ -function attr_setAnExistingAttributeValue(attribute, value) { - /** - * 1. If attribute’s element is null, then set attribute’s value to value. - * 2. Otherwise, change attribute from attribute’s element to value. - */ - if (attribute._element === null) { - attribute._value = value; - } - else { - ElementAlgorithm_1.element_change(attribute, attribute._element, value); - } -} -exports.attr_setAnExistingAttributeValue = attr_setAnExistingAttributeValue; -//# sourceMappingURL=AttrAlgorithm.js.map /***/ }), -/***/ 1054: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 2856: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var TreeAlgorithm_1 = __nccwpck_require__(6620); -/** - * Defines the position of a boundary point relative to another. - * - * @param bp - a boundary point - * @param relativeTo - a boundary point to compare to - */ -function boundaryPoint_position(bp, relativeTo) { - var nodeA = bp[0]; - var offsetA = bp[1]; - var nodeB = relativeTo[0]; - var offsetB = relativeTo[1]; - /** - * 1. Assert: nodeA and nodeB have the same root. - */ - console.assert(TreeAlgorithm_1.tree_rootNode(nodeA) === TreeAlgorithm_1.tree_rootNode(nodeB), "Boundary points must share the same root node."); - /** - * 2. If nodeA is nodeB, then return equal if offsetA is offsetB, before - * if offsetA is less than offsetB, and after if offsetA is greater than - * offsetB. - */ - if (nodeA === nodeB) { - if (offsetA === offsetB) { - return interfaces_1.BoundaryPosition.Equal; - } - else if (offsetA < offsetB) { - return interfaces_1.BoundaryPosition.Before; - } - else { - return interfaces_1.BoundaryPosition.After; - } - } - /** - * 3. If nodeA is following nodeB, then if the position of (nodeB, offsetB) - * relative to (nodeA, offsetA) is before, return after, and if it is after, - * return before. - */ - if (TreeAlgorithm_1.tree_isFollowing(nodeB, nodeA)) { - var pos = boundaryPoint_position([nodeB, offsetB], [nodeA, offsetA]); - if (pos === interfaces_1.BoundaryPosition.Before) { - return interfaces_1.BoundaryPosition.After; - } - else if (pos === interfaces_1.BoundaryPosition.After) { - return interfaces_1.BoundaryPosition.Before; + +const WritableStream = (__nccwpck_require__(84492).Writable) +const inherits = (__nccwpck_require__(47261).inherits) + +const StreamSearch = __nccwpck_require__(88534) + +const PartStream = __nccwpck_require__(38710) +const HeaderParser = __nccwpck_require__(90333) + +const DASH = 45 +const B_ONEDASH = Buffer.from('-') +const B_CRLF = Buffer.from('\r\n') +const EMPTY_FN = function () {} + +function Dicer (cfg) { + if (!(this instanceof Dicer)) { return new Dicer(cfg) } + WritableStream.call(this, cfg) + + if (!cfg || (!cfg.headerFirst && typeof cfg.boundary !== 'string')) { throw new TypeError('Boundary required') } + + if (typeof cfg.boundary === 'string') { this.setBoundary(cfg.boundary) } else { this._bparser = undefined } + + this._headerFirst = cfg.headerFirst + + this._dashes = 0 + this._parts = 0 + this._finished = false + this._realFinish = false + this._isPreamble = true + this._justMatched = false + this._firstWrite = true + this._inHeader = true + this._part = undefined + this._cb = undefined + this._ignoreData = false + this._partOpts = { highWaterMark: cfg.partHwm } + this._pause = false + + const self = this + this._hparser = new HeaderParser(cfg) + this._hparser.on('header', function (header) { + self._inHeader = false + self._part.emit('header', header) + }) +} +inherits(Dicer, WritableStream) + +Dicer.prototype.emit = function (ev) { + if (ev === 'finish' && !this._realFinish) { + if (!this._finished) { + const self = this + process.nextTick(function () { + self.emit('error', new Error('Unexpected end of multipart data')) + if (self._part && !self._ignoreData) { + const type = (self._isPreamble ? 'Preamble' : 'Part') + self._part.emit('error', new Error(type + ' terminated early due to unexpected end of multipart data')) + self._part.push(null) + process.nextTick(function () { + self._realFinish = true + self.emit('finish') + self._realFinish = false + }) + return } + self._realFinish = true + self.emit('finish') + self._realFinish = false + }) } - /** - * 4. If nodeA is an ancestor of nodeB: - */ - if (TreeAlgorithm_1.tree_isAncestorOf(nodeB, nodeA)) { - /** - * 4.1. Let child be nodeB. - * 4.2. While child is not a child of nodeA, set child to its parent. - * 4.3. If child’s index is less than offsetA, then return after. - */ - var child = nodeB; - while (!TreeAlgorithm_1.tree_isChildOf(nodeA, child)) { - /* istanbul ignore else */ - if (child._parent !== null) { - child = child._parent; - } - } - if (TreeAlgorithm_1.tree_index(child) < offsetA) { - return interfaces_1.BoundaryPosition.After; - } + } else { WritableStream.prototype.emit.apply(this, arguments) } +} + +Dicer.prototype._write = function (data, encoding, cb) { + // ignore unexpected data (e.g. extra trailer data after finished) + if (!this._hparser && !this._bparser) { return cb() } + + if (this._headerFirst && this._isPreamble) { + if (!this._part) { + this._part = new PartStream(this._partOpts) + if (this._events.preamble) { this.emit('preamble', this._part) } else { this._ignore() } } - /** - * 5. Return before. - */ - return interfaces_1.BoundaryPosition.Before; + const r = this._hparser.push(data) + if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r) } else { return cb() } + } + + // allows for "easier" testing + if (this._firstWrite) { + this._bparser.push(B_CRLF) + this._firstWrite = false + } + + this._bparser.push(data) + + if (this._pause) { this._cb = cb } else { cb() } } -exports.boundaryPoint_position = boundaryPoint_position; -//# sourceMappingURL=BoundaryPointAlgorithm.js.map -/***/ }), +Dicer.prototype.reset = function () { + this._part = undefined + this._bparser = undefined + this._hparser = undefined +} -/***/ 9461: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +Dicer.prototype.setBoundary = function (boundary) { + const self = this + this._bparser = new StreamSearch('\r\n--' + boundary) + this._bparser.on('info', function (isMatch, data, start, end) { + self._oninfo(isMatch, data, start, end) + }) +} -"use strict"; +Dicer.prototype._ignore = function () { + if (this._part && !this._ignoreData) { + this._ignoreData = true + this._part.on('error', EMPTY_FN) + // we must perform some kind of read on the stream even though we are + // ignoring the data, otherwise node's Readable stream will not emit 'end' + // after pushing null to the stream + this._part.resume() + } +} -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var util_1 = __nccwpck_require__(5282); -var DOMException_1 = __nccwpck_require__(3166); -var TreeAlgorithm_1 = __nccwpck_require__(6620); -var MutationObserverAlgorithm_1 = __nccwpck_require__(8157); -var DOMAlgorithm_1 = __nccwpck_require__(9628); -/** - * Replaces character data. - * - * @param node - a character data node - * @param offset - start offset - * @param count - count of characters to replace - * @param data - new data - */ -function characterData_replaceData(node, offset, count, data) { - var e_1, _a; - /** - * 1. Let length be node’s length. - * 2. If offset is greater than length, then throw an "IndexSizeError" - * DOMException. - * 3. If offset plus count is greater than length, then set count to length - * minus offset. - */ - var length = TreeAlgorithm_1.tree_nodeLength(node); - if (offset > length) { - throw new DOMException_1.IndexSizeError("Offset exceeds character data length. Offset: " + offset + ", Length: " + length + ", Node is " + node.nodeName + "."); - } - if (offset + count > length) { - count = length - offset; +Dicer.prototype._oninfo = function (isMatch, data, start, end) { + let buf; const self = this; let i = 0; let r; let shouldWriteMore = true + + if (!this._part && this._justMatched && data) { + while (this._dashes < 2 && (start + i) < end) { + if (data[start + i] === DASH) { + ++i + ++this._dashes + } else { + if (this._dashes) { buf = B_ONEDASH } + this._dashes = 0 + break + } } - /** - * 4. Queue a mutation record of "characterData" for node with null, null, - * node’s data, « », « », null, and null. - */ - if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueMutationRecord("characterData", node, null, null, node._data, [], [], null, null); + if (this._dashes === 2) { + if ((start + i) < end && this._events.trailer) { this.emit('trailer', data.slice(start + i, end)) } + this.reset() + this._finished = true + // no more parts will be added + if (self._parts === 0) { + self._realFinish = true + self.emit('finish') + self._realFinish = false + } } - /** - * 5. Insert data into node’s data after offset code units. - * 6. Let delete offset be offset + data’s length. - * 7. Starting from delete offset code units, remove count code units from - * node’s data. - */ - var newData = node._data.substring(0, offset) + data + - node._data.substring(offset + count); - node._data = newData; - try { - /** - * 8. For each live range whose start node is node and start offset is - * greater than offset but less than or equal to offset plus count, set its - * start offset to offset. - * 9. For each live range whose end node is node and end offset is greater - * than offset but less than or equal to offset plus count, set its end - * offset to offset. - * 10. For each live range whose start node is node and start offset is - * greater than offset plus count, increase its start offset by data’s - * length and decrease it by count. - * 11. For each live range whose end node is node and end offset is greater - * than offset plus count, increase its end offset by data’s length and - * decrease it by count. - */ - for (var _b = __values(DOMImpl_1.dom.rangeList), _c = _b.next(); !_c.done; _c = _b.next()) { - var range = _c.value; - if (range._start[0] === node && range._start[1] > offset && range._start[1] <= offset + count) { - range._start[1] = offset; - } - if (range._end[0] === node && range._end[1] > offset && range._end[1] <= offset + count) { - range._end[1] = offset; - } - if (range._start[0] === node && range._start[1] > offset + count) { - range._start[1] += data.length - count; - } - if (range._end[0] === node && range._end[1] > offset + count) { - range._end[1] += data.length - count; + if (this._dashes) { return } + } + if (this._justMatched) { this._justMatched = false } + if (!this._part) { + this._part = new PartStream(this._partOpts) + this._part._read = function (n) { + self._unpause() + } + if (this._isPreamble && this._events.preamble) { this.emit('preamble', this._part) } else if (this._isPreamble !== true && this._events.part) { this.emit('part', this._part) } else { this._ignore() } + if (!this._isPreamble) { this._inHeader = true } + } + if (data && start < end && !this._ignoreData) { + if (this._isPreamble || !this._inHeader) { + if (buf) { shouldWriteMore = this._part.push(buf) } + shouldWriteMore = this._part.push(data.slice(start, end)) + if (!shouldWriteMore) { this._pause = true } + } else if (!this._isPreamble && this._inHeader) { + if (buf) { this._hparser.push(buf) } + r = this._hparser.push(data.slice(start, end)) + if (!this._inHeader && r !== undefined && r < end) { this._oninfo(false, data, start + r, end) } + } + } + if (isMatch) { + this._hparser.reset() + if (this._isPreamble) { this._isPreamble = false } else { + if (start !== end) { + ++this._parts + this._part.on('end', function () { + if (--self._parts === 0) { + if (self._finished) { + self._realFinish = true + self.emit('finish') + self._realFinish = false + } else { + self._unpause() } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - /** - * 12. If node is a Text node and its parent is not null, run the child - * text content change steps for node’s parent. - */ - if (DOMImpl_1.dom.features.steps) { - if (util_1.Guard.isTextNode(node) && node._parent !== null) { - DOMAlgorithm_1.dom_runChildTextContentChangeSteps(node._parent); - } + } + }) + } } + this._part.push(null) + this._part = undefined + this._ignoreData = false + this._justMatched = true + this._dashes = 0 + } } -exports.characterData_replaceData = characterData_replaceData; -/** - * Returns `count` number of characters from `node`'s data starting at - * the given `offset`. - * - * @param node - a character data node - * @param offset - start offset - * @param count - count of characters to return - */ -function characterData_substringData(node, offset, count) { - /** - * 1. Let length be node’s length. - * 2. If offset is greater than length, then throw an "IndexSizeError" - * DOMException. - * 3. If offset plus count is greater than length, return a string whose - * value is the code units from the offsetth code unit to the end of node’s - * data, and then return. - * 4. Return a string whose value is the code units from the offsetth code - * unit to the offset+countth code unit in node’s data. - */ - var length = TreeAlgorithm_1.tree_nodeLength(node); - if (offset > length) { - throw new DOMException_1.IndexSizeError("Offset exceeds character data length. Offset: " + offset + ", Length: " + length + ", Node is " + node.nodeName + "."); - } - if (offset + count > length) { - return node._data.substr(offset); - } - else { - return node._data.substr(offset, count); - } + +Dicer.prototype._unpause = function () { + if (!this._pause) { return } + + this._pause = false + if (this._cb) { + const cb = this._cb + this._cb = undefined + cb() + } } -exports.characterData_substringData = characterData_substringData; -//# sourceMappingURL=CharacterDataAlgorithm.js.map + +module.exports = Dicer + /***/ }), -/***/ 7339: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 90333: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImplementationImpl_1 = __nccwpck_require__(2197); -var WindowImpl_1 = __nccwpck_require__(9067); -var XMLDocumentImpl_1 = __nccwpck_require__(1685); -var DocumentImpl_1 = __nccwpck_require__(4333); -var AbortControllerImpl_1 = __nccwpck_require__(6461); -var AbortSignalImpl_1 = __nccwpck_require__(22); -var DocumentTypeImpl_1 = __nccwpck_require__(3173); -var ElementImpl_1 = __nccwpck_require__(5975); -var DocumentFragmentImpl_1 = __nccwpck_require__(2585); -var ShadowRootImpl_1 = __nccwpck_require__(1911); -var AttrImpl_1 = __nccwpck_require__(3717); -var TextImpl_1 = __nccwpck_require__(2191); -var CDATASectionImpl_1 = __nccwpck_require__(3977); -var CommentImpl_1 = __nccwpck_require__(930); -var ProcessingInstructionImpl_1 = __nccwpck_require__(9430); -var HTMLCollectionImpl_1 = __nccwpck_require__(3969); -var NodeListImpl_1 = __nccwpck_require__(3728); -var NodeListStaticImpl_1 = __nccwpck_require__(5306); -var NamedNodeMapImpl_1 = __nccwpck_require__(7206); -var RangeImpl_1 = __nccwpck_require__(166); -var NodeIteratorImpl_1 = __nccwpck_require__(1997); -var TreeWalkerImpl_1 = __nccwpck_require__(9261); -var NodeFilterImpl_1 = __nccwpck_require__(2355); -var MutationRecordImpl_1 = __nccwpck_require__(6219); -var DOMTokenListImpl_1 = __nccwpck_require__(5096); -/** - * Creates a `DOMImplementation`. - * - * @param document - associated document - */ -function create_domImplementation(document) { - return DOMImplementationImpl_1.DOMImplementationImpl._create(document); + +const EventEmitter = (__nccwpck_require__(15673).EventEmitter) +const inherits = (__nccwpck_require__(47261).inherits) +const getLimit = __nccwpck_require__(49692) + +const StreamSearch = __nccwpck_require__(88534) + +const B_DCRLF = Buffer.from('\r\n\r\n') +const RE_CRLF = /\r\n/g +const RE_HDR = /^([^:]+):[ \t]?([\x00-\xFF]+)?$/ // eslint-disable-line no-control-regex + +function HeaderParser (cfg) { + EventEmitter.call(this) + + cfg = cfg || {} + const self = this + this.nread = 0 + this.maxed = false + this.npairs = 0 + this.maxHeaderPairs = getLimit(cfg, 'maxHeaderPairs', 2000) + this.maxHeaderSize = getLimit(cfg, 'maxHeaderSize', 80 * 1024) + this.buffer = '' + this.header = {} + this.finished = false + this.ss = new StreamSearch(B_DCRLF) + this.ss.on('info', function (isMatch, data, start, end) { + if (data && !self.maxed) { + if (self.nread + end - start >= self.maxHeaderSize) { + end = self.maxHeaderSize - self.nread + start + self.nread = self.maxHeaderSize + self.maxed = true + } else { self.nread += (end - start) } + + self.buffer += data.toString('binary', start, end) + } + if (isMatch) { self._finish() } + }) } -exports.create_domImplementation = create_domImplementation; -/** - * Creates a `Window` node. - */ -function create_window() { - return WindowImpl_1.WindowImpl._create(); +inherits(HeaderParser, EventEmitter) + +HeaderParser.prototype.push = function (data) { + const r = this.ss.push(data) + if (this.finished) { return r } } -exports.create_window = create_window; -/** - * Creates an `XMLDocument` node. - */ -function create_xmlDocument() { - return new XMLDocumentImpl_1.XMLDocumentImpl(); + +HeaderParser.prototype.reset = function () { + this.finished = false + this.buffer = '' + this.header = {} + this.ss.reset() } -exports.create_xmlDocument = create_xmlDocument; -/** - * Creates a `Document` node. - */ -function create_document() { - return new DocumentImpl_1.DocumentImpl(); + +HeaderParser.prototype._finish = function () { + if (this.buffer) { this._parseHeader() } + this.ss.matches = this.ss.maxMatches + const header = this.header + this.header = {} + this.buffer = '' + this.finished = true + this.nread = this.npairs = 0 + this.maxed = false + this.emit('header', header) } -exports.create_document = create_document; -/** - * Creates an `AbortController`. - */ -function create_abortController() { - return new AbortControllerImpl_1.AbortControllerImpl(); + +HeaderParser.prototype._parseHeader = function () { + if (this.npairs === this.maxHeaderPairs) { return } + + const lines = this.buffer.split(RE_CRLF) + const len = lines.length + let m, h + + for (var i = 0; i < len; ++i) { // eslint-disable-line no-var + if (lines[i].length === 0) { continue } + if (lines[i][0] === '\t' || lines[i][0] === ' ') { + // folded header content + // RFC2822 says to just remove the CRLF and not the whitespace following + // it, so we follow the RFC and include the leading whitespace ... + if (h) { + this.header[h][this.header[h].length - 1] += lines[i] + continue + } + } + + const posColon = lines[i].indexOf(':') + if ( + posColon === -1 || + posColon === 0 + ) { + return + } + m = RE_HDR.exec(lines[i]) + h = m[1].toLowerCase() + this.header[h] = this.header[h] || [] + this.header[h].push((m[2] || '')) + if (++this.npairs === this.maxHeaderPairs) { break } + } } -exports.create_abortController = create_abortController; -/** - * Creates an `AbortSignal`. - */ -function create_abortSignal() { - return AbortSignalImpl_1.AbortSignalImpl._create(); + +module.exports = HeaderParser + + +/***/ }), + +/***/ 38710: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const inherits = (__nccwpck_require__(47261).inherits) +const ReadableStream = (__nccwpck_require__(84492).Readable) + +function PartStream (opts) { + ReadableStream.call(this, opts) } -exports.create_abortSignal = create_abortSignal; +inherits(PartStream, ReadableStream) + +PartStream.prototype._read = function (n) {} + +module.exports = PartStream + + +/***/ }), + +/***/ 88534: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + /** - * Creates a `DocumentType` node. + * Copyright Brian White. All rights reserved. * - * @param document - owner document - * @param name - name of the node - * @param publicId - `PUBLIC` identifier - * @param systemId - `SYSTEM` identifier - */ -function create_documentType(document, name, publicId, systemId) { - return DocumentTypeImpl_1.DocumentTypeImpl._create(document, name, publicId, systemId); -} -exports.create_documentType = create_documentType; -/** - * Creates a new `Element` node. + * @see https://github.com/mscdex/streamsearch * - * @param document - owner document - * @param localName - local name - * @param namespace - namespace - * @param prefix - namespace prefix - */ -function create_element(document, localName, namespace, prefix) { - return ElementImpl_1.ElementImpl._create(document, localName, namespace, prefix); -} -exports.create_element = create_element; -/** - * Creates a new `HTMLElement` node. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * @param document - owner document - * @param localName - local name - * @param namespace - namespace - * @param prefix - namespace prefix - */ -function create_htmlElement(document, localName, namespace, prefix) { - // TODO: Implement in HTML DOM - return ElementImpl_1.ElementImpl._create(document, localName, namespace, prefix); -} -exports.create_htmlElement = create_htmlElement; -/** - * Creates a new `HTMLUnknownElement` node. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * @param document - owner document - * @param localName - local name - * @param namespace - namespace - * @param prefix - namespace prefix - */ -function create_htmlUnknownElement(document, localName, namespace, prefix) { - // TODO: Implement in HTML DOM - return ElementImpl_1.ElementImpl._create(document, localName, namespace, prefix); -} -exports.create_htmlUnknownElement = create_htmlUnknownElement; -/** - * Creates a new `DocumentFragment` node. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. * - * @param document - owner document + * Based heavily on the Streaming Boyer-Moore-Horspool C++ implementation + * by Hongli Lai at: https://github.com/FooBarWidget/boyer-moore-horspool */ -function create_documentFragment(document) { - return DocumentFragmentImpl_1.DocumentFragmentImpl._create(document); +const EventEmitter = (__nccwpck_require__(15673).EventEmitter) +const inherits = (__nccwpck_require__(47261).inherits) + +function SBMH (needle) { + if (typeof needle === 'string') { + needle = Buffer.from(needle) + } + + if (!Buffer.isBuffer(needle)) { + throw new TypeError('The needle has to be a String or a Buffer.') + } + + const needleLength = needle.length + + if (needleLength === 0) { + throw new Error('The needle cannot be an empty String/Buffer.') + } + + if (needleLength > 256) { + throw new Error('The needle cannot have a length bigger than 256.') + } + + this.maxMatches = Infinity + this.matches = 0 + + this._occ = new Array(256) + .fill(needleLength) // Initialize occurrence table. + this._lookbehind_size = 0 + this._needle = needle + this._bufpos = 0 + + this._lookbehind = Buffer.alloc(needleLength) + + // Populate occurrence table with analysis of the needle, + // ignoring last letter. + for (var i = 0; i < needleLength - 1; ++i) { // eslint-disable-line no-var + this._occ[needle[i]] = needleLength - 1 - i + } } -exports.create_documentFragment = create_documentFragment; -/** - * Creates a new `ShadowRoot` node. - * - * @param document - owner document - * @param host - shadow root's host element node - */ -function create_shadowRoot(document, host) { - return ShadowRootImpl_1.ShadowRootImpl._create(document, host); +inherits(SBMH, EventEmitter) + +SBMH.prototype.reset = function () { + this._lookbehind_size = 0 + this.matches = 0 + this._bufpos = 0 } -exports.create_shadowRoot = create_shadowRoot; -/** - * Creates a new `Attr` node. - * - * @param document - owner document - * @param localName - local name - */ -function create_attr(document, localName) { - return AttrImpl_1.AttrImpl._create(document, localName); + +SBMH.prototype.push = function (chunk, pos) { + if (!Buffer.isBuffer(chunk)) { + chunk = Buffer.from(chunk, 'binary') + } + const chlen = chunk.length + this._bufpos = pos || 0 + let r + while (r !== chlen && this.matches < this.maxMatches) { r = this._sbmh_feed(chunk) } + return r } -exports.create_attr = create_attr; -/** - * Creates a new `Text` node. - * - * @param document - owner document - * @param data - node contents - */ -function create_text(document, data) { - return TextImpl_1.TextImpl._create(document, data); + +SBMH.prototype._sbmh_feed = function (data) { + const len = data.length + const needle = this._needle + const needleLength = needle.length + const lastNeedleChar = needle[needleLength - 1] + + // Positive: points to a position in `data` + // pos == 3 points to data[3] + // Negative: points to a position in the lookbehind buffer + // pos == -2 points to lookbehind[lookbehind_size - 2] + let pos = -this._lookbehind_size + let ch + + if (pos < 0) { + // Lookbehind buffer is not empty. Perform Boyer-Moore-Horspool + // search with character lookup code that considers both the + // lookbehind buffer and the current round's haystack data. + // + // Loop until + // there is a match. + // or until + // we've moved past the position that requires the + // lookbehind buffer. In this case we switch to the + // optimized loop. + // or until + // the character to look at lies outside the haystack. + while (pos < 0 && pos <= len - needleLength) { + ch = this._sbmh_lookup_char(data, pos + needleLength - 1) + + if ( + ch === lastNeedleChar && + this._sbmh_memcmp(data, pos, needleLength - 1) + ) { + this._lookbehind_size = 0 + ++this.matches + this.emit('info', true) + + return (this._bufpos = pos + needleLength) + } + pos += this._occ[ch] + } + + // No match. + + if (pos < 0) { + // There's too few data for Boyer-Moore-Horspool to run, + // so let's use a different algorithm to skip as much as + // we can. + // Forward pos until + // the trailing part of lookbehind + data + // looks like the beginning of the needle + // or until + // pos == 0 + while (pos < 0 && !this._sbmh_memcmp(data, pos, len - pos)) { ++pos } + } + + if (pos >= 0) { + // Discard lookbehind buffer. + this.emit('info', false, this._lookbehind, 0, this._lookbehind_size) + this._lookbehind_size = 0 + } else { + // Cut off part of the lookbehind buffer that has + // been processed and append the entire haystack + // into it. + const bytesToCutOff = this._lookbehind_size + pos + if (bytesToCutOff > 0) { + // The cut off data is guaranteed not to contain the needle. + this.emit('info', false, this._lookbehind, 0, bytesToCutOff) + } + + this._lookbehind.copy(this._lookbehind, 0, bytesToCutOff, + this._lookbehind_size - bytesToCutOff) + this._lookbehind_size -= bytesToCutOff + + data.copy(this._lookbehind, this._lookbehind_size) + this._lookbehind_size += len + + this._bufpos = len + return len + } + } + + pos += (pos >= 0) * this._bufpos + + // Lookbehind buffer is now empty. We only need to check if the + // needle is in the haystack. + if (data.indexOf(needle, pos) !== -1) { + pos = data.indexOf(needle, pos) + ++this.matches + if (pos > 0) { this.emit('info', true, data, this._bufpos, pos) } else { this.emit('info', true) } + + return (this._bufpos = pos + needleLength) + } else { + pos = len - needleLength + } + + // There was no match. If there's trailing haystack data that we cannot + // match yet using the Boyer-Moore-Horspool algorithm (because the trailing + // data is less than the needle size) then match using a modified + // algorithm that starts matching from the beginning instead of the end. + // Whatever trailing data is left after running this algorithm is added to + // the lookbehind buffer. + while ( + pos < len && + ( + data[pos] !== needle[0] || + ( + (Buffer.compare( + data.subarray(pos, pos + len - pos), + needle.subarray(0, len - pos) + ) !== 0) + ) + ) + ) { + ++pos + } + if (pos < len) { + data.copy(this._lookbehind, 0, pos, pos + (len - pos)) + this._lookbehind_size = len - pos + } + + // Everything until pos is guaranteed not to contain needle data. + if (pos > 0) { this.emit('info', false, data, this._bufpos, pos < len ? pos : len) } + + this._bufpos = len + return len } -exports.create_text = create_text; -/** - * Creates a new `CDATASection` node. - * - * @param document - owner document - * @param data - node contents - */ -function create_cdataSection(document, data) { - return CDATASectionImpl_1.CDATASectionImpl._create(document, data); + +SBMH.prototype._sbmh_lookup_char = function (data, pos) { + return (pos < 0) + ? this._lookbehind[this._lookbehind_size + pos] + : data[pos] } -exports.create_cdataSection = create_cdataSection; -/** - * Creates a new `Comment` node. - * - * @param document - owner document - * @param data - node contents - */ -function create_comment(document, data) { - return CommentImpl_1.CommentImpl._create(document, data); + +SBMH.prototype._sbmh_memcmp = function (data, pos, len) { + for (var i = 0; i < len; ++i) { // eslint-disable-line no-var + if (this._sbmh_lookup_char(data, pos + i) !== this._needle[i]) { return false } + } + return true } -exports.create_comment = create_comment; -/** - * Creates a new `ProcessingInstruction` node. - * - * @param document - owner document - * @param target - instruction target - * @param data - node contents - */ -function create_processingInstruction(document, target, data) { - return ProcessingInstructionImpl_1.ProcessingInstructionImpl._create(document, target, data); + +module.exports = SBMH + + +/***/ }), + +/***/ 33438: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const WritableStream = (__nccwpck_require__(84492).Writable) +const { inherits } = __nccwpck_require__(47261) +const Dicer = __nccwpck_require__(2856) + +const MultipartParser = __nccwpck_require__(90415) +const UrlencodedParser = __nccwpck_require__(16780) +const parseParams = __nccwpck_require__(34426) + +function Busboy (opts) { + if (!(this instanceof Busboy)) { return new Busboy(opts) } + + if (typeof opts !== 'object') { + throw new TypeError('Busboy expected an options-Object.') + } + if (typeof opts.headers !== 'object') { + throw new TypeError('Busboy expected an options-Object with headers-attribute.') + } + if (typeof opts.headers['content-type'] !== 'string') { + throw new TypeError('Missing Content-Type-header.') + } + + const { + headers, + ...streamOptions + } = opts + + this.opts = { + autoDestroy: false, + ...streamOptions + } + WritableStream.call(this, this.opts) + + this._done = false + this._parser = this.getParserByHeaders(headers) + this._finished = false } -exports.create_processingInstruction = create_processingInstruction; -/** - * Creates a new `HTMLCollection`. - * - * @param root - root node - * @param filter - node filter - */ -function create_htmlCollection(root, filter) { - if (filter === void 0) { filter = (function () { return true; }); } - return HTMLCollectionImpl_1.HTMLCollectionImpl._create(root, filter); +inherits(Busboy, WritableStream) + +Busboy.prototype.emit = function (ev) { + if (ev === 'finish') { + if (!this._done) { + this._parser?.end() + return + } else if (this._finished) { + return + } + this._finished = true + } + WritableStream.prototype.emit.apply(this, arguments) } -exports.create_htmlCollection = create_htmlCollection; -/** - * Creates a new live `NodeList`. - * - * @param root - root node - */ -function create_nodeList(root) { - return NodeListImpl_1.NodeListImpl._create(root); + +Busboy.prototype.getParserByHeaders = function (headers) { + const parsed = parseParams(headers['content-type']) + + const cfg = { + defCharset: this.opts.defCharset, + fileHwm: this.opts.fileHwm, + headers, + highWaterMark: this.opts.highWaterMark, + isPartAFile: this.opts.isPartAFile, + limits: this.opts.limits, + parsedConType: parsed, + preservePath: this.opts.preservePath + } + + if (MultipartParser.detect.test(parsed[0])) { + return new MultipartParser(this, cfg) + } + if (UrlencodedParser.detect.test(parsed[0])) { + return new UrlencodedParser(this, cfg) + } + throw new Error('Unsupported Content-Type.') } -exports.create_nodeList = create_nodeList; -/** - * Creates a new static `NodeList`. - * - * @param root - root node - * @param items - a list of items to initialize the list - */ -function create_nodeListStatic(root, items) { - return NodeListStaticImpl_1.NodeListStaticImpl._create(root, items); + +Busboy.prototype._write = function (chunk, encoding, cb) { + this._parser.write(chunk, cb) } -exports.create_nodeListStatic = create_nodeListStatic; -/** - * Creates a new `NamedNodeMap`. - * - * @param element - parent element - */ -function create_namedNodeMap(element) { - return NamedNodeMapImpl_1.NamedNodeMapImpl._create(element); + +module.exports = Busboy +module.exports["default"] = Busboy +module.exports.Busboy = Busboy + +module.exports.Dicer = Dicer + + +/***/ }), + +/***/ 90415: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +// TODO: +// * support 1 nested multipart level +// (see second multipart example here: +// http://www.w3.org/TR/html401/interact/forms.html#didx-multipartform-data) +// * support limits.fieldNameSize +// -- this will require modifications to utils.parseParams + +const { Readable } = __nccwpck_require__(84492) +const { inherits } = __nccwpck_require__(47261) + +const Dicer = __nccwpck_require__(2856) + +const parseParams = __nccwpck_require__(34426) +const decodeText = __nccwpck_require__(99136) +const basename = __nccwpck_require__(60496) +const getLimit = __nccwpck_require__(49692) + +const RE_BOUNDARY = /^boundary$/i +const RE_FIELD = /^form-data$/i +const RE_CHARSET = /^charset$/i +const RE_FILENAME = /^filename$/i +const RE_NAME = /^name$/i + +Multipart.detect = /^multipart\/form-data/i +function Multipart (boy, cfg) { + let i + let len + const self = this + let boundary + const limits = cfg.limits + const isPartAFile = cfg.isPartAFile || ((fieldName, contentType, fileName) => (contentType === 'application/octet-stream' || fileName !== undefined)) + const parsedConType = cfg.parsedConType || [] + const defCharset = cfg.defCharset || 'utf8' + const preservePath = cfg.preservePath + const fileOpts = { highWaterMark: cfg.fileHwm } + + for (i = 0, len = parsedConType.length; i < len; ++i) { + if (Array.isArray(parsedConType[i]) && + RE_BOUNDARY.test(parsedConType[i][0])) { + boundary = parsedConType[i][1] + break + } + } + + function checkFinished () { + if (nends === 0 && finished && !boy._done) { + finished = false + self.end() + } + } + + if (typeof boundary !== 'string') { throw new Error('Multipart: Boundary not found') } + + const fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024) + const fileSizeLimit = getLimit(limits, 'fileSize', Infinity) + const filesLimit = getLimit(limits, 'files', Infinity) + const fieldsLimit = getLimit(limits, 'fields', Infinity) + const partsLimit = getLimit(limits, 'parts', Infinity) + const headerPairsLimit = getLimit(limits, 'headerPairs', 2000) + const headerSizeLimit = getLimit(limits, 'headerSize', 80 * 1024) + + let nfiles = 0 + let nfields = 0 + let nends = 0 + let curFile + let curField + let finished = false + + this._needDrain = false + this._pause = false + this._cb = undefined + this._nparts = 0 + this._boy = boy + + const parserCfg = { + boundary, + maxHeaderPairs: headerPairsLimit, + maxHeaderSize: headerSizeLimit, + partHwm: fileOpts.highWaterMark, + highWaterMark: cfg.highWaterMark + } + + this.parser = new Dicer(parserCfg) + this.parser.on('drain', function () { + self._needDrain = false + if (self._cb && !self._pause) { + const cb = self._cb + self._cb = undefined + cb() + } + }).on('part', function onPart (part) { + if (++self._nparts > partsLimit) { + self.parser.removeListener('part', onPart) + self.parser.on('part', skipPart) + boy.hitPartsLimit = true + boy.emit('partsLimit') + return skipPart(part) + } + + // hack because streams2 _always_ doesn't emit 'end' until nextTick, so let + // us emit 'end' early since we know the part has ended if we are already + // seeing the next part + if (curField) { + const field = curField + field.emit('end') + field.removeAllListeners('end') + } + + part.on('header', function (header) { + let contype + let fieldname + let parsed + let charset + let encoding + let filename + let nsize = 0 + + if (header['content-type']) { + parsed = parseParams(header['content-type'][0]) + if (parsed[0]) { + contype = parsed[0].toLowerCase() + for (i = 0, len = parsed.length; i < len; ++i) { + if (RE_CHARSET.test(parsed[i][0])) { + charset = parsed[i][1].toLowerCase() + break + } + } + } + } + + if (contype === undefined) { contype = 'text/plain' } + if (charset === undefined) { charset = defCharset } + + if (header['content-disposition']) { + parsed = parseParams(header['content-disposition'][0]) + if (!RE_FIELD.test(parsed[0])) { return skipPart(part) } + for (i = 0, len = parsed.length; i < len; ++i) { + if (RE_NAME.test(parsed[i][0])) { + fieldname = parsed[i][1] + } else if (RE_FILENAME.test(parsed[i][0])) { + filename = parsed[i][1] + if (!preservePath) { filename = basename(filename) } + } + } + } else { return skipPart(part) } + + if (header['content-transfer-encoding']) { encoding = header['content-transfer-encoding'][0].toLowerCase() } else { encoding = '7bit' } + + let onData, + onEnd + + if (isPartAFile(fieldname, contype, filename)) { + // file/binary field + if (nfiles === filesLimit) { + if (!boy.hitFilesLimit) { + boy.hitFilesLimit = true + boy.emit('filesLimit') + } + return skipPart(part) + } + + ++nfiles + + if (!boy._events.file) { + self.parser._ignore() + return + } + + ++nends + const file = new FileStream(fileOpts) + curFile = file + file.on('end', function () { + --nends + self._pause = false + checkFinished() + if (self._cb && !self._needDrain) { + const cb = self._cb + self._cb = undefined + cb() + } + }) + file._read = function (n) { + if (!self._pause) { return } + self._pause = false + if (self._cb && !self._needDrain) { + const cb = self._cb + self._cb = undefined + cb() + } + } + boy.emit('file', fieldname, file, filename, encoding, contype) + + onData = function (data) { + if ((nsize += data.length) > fileSizeLimit) { + const extralen = fileSizeLimit - nsize + data.length + if (extralen > 0) { file.push(data.slice(0, extralen)) } + file.truncated = true + file.bytesRead = fileSizeLimit + part.removeAllListeners('data') + file.emit('limit') + return + } else if (!file.push(data)) { self._pause = true } + + file.bytesRead = nsize + } + + onEnd = function () { + curFile = undefined + file.push(null) + } + } else { + // non-file field + if (nfields === fieldsLimit) { + if (!boy.hitFieldsLimit) { + boy.hitFieldsLimit = true + boy.emit('fieldsLimit') + } + return skipPart(part) + } + + ++nfields + ++nends + let buffer = '' + let truncated = false + curField = part + + onData = function (data) { + if ((nsize += data.length) > fieldSizeLimit) { + const extralen = (fieldSizeLimit - (nsize - data.length)) + buffer += data.toString('binary', 0, extralen) + truncated = true + part.removeAllListeners('data') + } else { buffer += data.toString('binary') } + } + + onEnd = function () { + curField = undefined + if (buffer.length) { buffer = decodeText(buffer, 'binary', charset) } + boy.emit('field', fieldname, buffer, false, truncated, encoding, contype) + --nends + checkFinished() + } + } + + /* As of node@2efe4ab761666 (v0.10.29+/v0.11.14+), busboy had become + broken. Streams2/streams3 is a huge black box of confusion, but + somehow overriding the sync state seems to fix things again (and still + seems to work for previous node versions). + */ + part._readableState.sync = false + + part.on('data', onData) + part.on('end', onEnd) + }).on('error', function (err) { + if (curFile) { curFile.emit('error', err) } + }) + }).on('error', function (err) { + boy.emit('error', err) + }).on('finish', function () { + finished = true + checkFinished() + }) } -exports.create_namedNodeMap = create_namedNodeMap; -/** - * Creates a new `Range`. - * - * @param start - start point - * @param end - end point - */ -function create_range(start, end) { - return RangeImpl_1.RangeImpl._create(start, end); + +Multipart.prototype.write = function (chunk, cb) { + const r = this.parser.write(chunk) + if (r && !this._pause) { + cb() + } else { + this._needDrain = !r + this._cb = cb + } } -exports.create_range = create_range; -/** - * Creates a new `NodeIterator`. - * - * @param root - iterator's root node - * @param reference - reference node - * @param pointerBeforeReference - whether the iterator is before or after the - * reference node - */ -function create_nodeIterator(root, reference, pointerBeforeReference) { - return NodeIteratorImpl_1.NodeIteratorImpl._create(root, reference, pointerBeforeReference); + +Multipart.prototype.end = function () { + const self = this + + if (self.parser.writable) { + self.parser.end() + } else if (!self._boy._done) { + process.nextTick(function () { + self._boy._done = true + self._boy.emit('finish') + }) + } } -exports.create_nodeIterator = create_nodeIterator; -/** - * Creates a new `TreeWalker`. - * - * @param root - iterator's root node - * @param current - current node - */ -function create_treeWalker(root, current) { - return TreeWalkerImpl_1.TreeWalkerImpl._create(root, current); + +function skipPart (part) { + part.resume() } -exports.create_treeWalker = create_treeWalker; -/** - * Creates a new `NodeFilter`. - */ -function create_nodeFilter() { - return NodeFilterImpl_1.NodeFilterImpl._create(); + +function FileStream (opts) { + Readable.call(this, opts) + + this.bytesRead = 0 + + this.truncated = false } -exports.create_nodeFilter = create_nodeFilter; -/** - * Creates a new `MutationRecord`. - * - * @param type - type of mutation: `"attributes"` for an attribute - * mutation, `"characterData"` for a mutation to a CharacterData node - * and `"childList"` for a mutation to the tree of nodes. - * @param target - node affected by the mutation. - * @param addedNodes - list of added nodes. - * @param removedNodes - list of removed nodes. - * @param previousSibling - previous sibling of added or removed nodes. - * @param nextSibling - next sibling of added or removed nodes. - * @param attributeName - local name of the changed attribute, - * and `null` otherwise. - * @param attributeNamespace - namespace of the changed attribute, - * and `null` otherwise. - * @param oldValue - value before mutation: attribute value for an attribute - * mutation, node `data` for a mutation to a CharacterData node and `null` - * for a mutation to the tree of nodes. - */ -function create_mutationRecord(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { - return MutationRecordImpl_1.MutationRecordImpl._create(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue); + +inherits(FileStream, Readable) + +FileStream.prototype._read = function (n) {} + +module.exports = Multipart + + +/***/ }), + +/***/ 16780: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Decoder = __nccwpck_require__(89730) +const decodeText = __nccwpck_require__(99136) +const getLimit = __nccwpck_require__(49692) + +const RE_CHARSET = /^charset$/i + +UrlEncoded.detect = /^application\/x-www-form-urlencoded/i +function UrlEncoded (boy, cfg) { + const limits = cfg.limits + const parsedConType = cfg.parsedConType + this.boy = boy + + this.fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024) + this.fieldNameSizeLimit = getLimit(limits, 'fieldNameSize', 100) + this.fieldsLimit = getLimit(limits, 'fields', Infinity) + + let charset + for (var i = 0, len = parsedConType.length; i < len; ++i) { // eslint-disable-line no-var + if (Array.isArray(parsedConType[i]) && + RE_CHARSET.test(parsedConType[i][0])) { + charset = parsedConType[i][1].toLowerCase() + break + } + } + + if (charset === undefined) { charset = cfg.defCharset || 'utf8' } + + this.decoder = new Decoder() + this.charset = charset + this._fields = 0 + this._state = 'key' + this._checkingBytes = true + this._bytesKey = 0 + this._bytesVal = 0 + this._key = '' + this._val = '' + this._keyTrunc = false + this._valTrunc = false + this._hitLimit = false } -exports.create_mutationRecord = create_mutationRecord; -/** - * Creates a new `DOMTokenList`. - * - * @param element - associated element - * @param attribute - associated attribute - */ -function create_domTokenList(element, attribute) { - return DOMTokenListImpl_1.DOMTokenListImpl._create(element, attribute); + +UrlEncoded.prototype.write = function (data, cb) { + if (this._fields === this.fieldsLimit) { + if (!this.boy.hitFieldsLimit) { + this.boy.hitFieldsLimit = true + this.boy.emit('fieldsLimit') + } + return cb() + } + + let idxeq; let idxamp; let i; let p = 0; const len = data.length + + while (p < len) { + if (this._state === 'key') { + idxeq = idxamp = undefined + for (i = p; i < len; ++i) { + if (!this._checkingBytes) { ++p } + if (data[i] === 0x3D/* = */) { + idxeq = i + break + } else if (data[i] === 0x26/* & */) { + idxamp = i + break + } + if (this._checkingBytes && this._bytesKey === this.fieldNameSizeLimit) { + this._hitLimit = true + break + } else if (this._checkingBytes) { ++this._bytesKey } + } + + if (idxeq !== undefined) { + // key with assignment + if (idxeq > p) { this._key += this.decoder.write(data.toString('binary', p, idxeq)) } + this._state = 'val' + + this._hitLimit = false + this._checkingBytes = true + this._val = '' + this._bytesVal = 0 + this._valTrunc = false + this.decoder.reset() + + p = idxeq + 1 + } else if (idxamp !== undefined) { + // key with no assignment + ++this._fields + let key; const keyTrunc = this._keyTrunc + if (idxamp > p) { key = (this._key += this.decoder.write(data.toString('binary', p, idxamp))) } else { key = this._key } + + this._hitLimit = false + this._checkingBytes = true + this._key = '' + this._bytesKey = 0 + this._keyTrunc = false + this.decoder.reset() + + if (key.length) { + this.boy.emit('field', decodeText(key, 'binary', this.charset), + '', + keyTrunc, + false) + } + + p = idxamp + 1 + if (this._fields === this.fieldsLimit) { return cb() } + } else if (this._hitLimit) { + // we may not have hit the actual limit if there are encoded bytes... + if (i > p) { this._key += this.decoder.write(data.toString('binary', p, i)) } + p = i + if ((this._bytesKey = this._key.length) === this.fieldNameSizeLimit) { + // yep, we actually did hit the limit + this._checkingBytes = false + this._keyTrunc = true + } + } else { + if (p < len) { this._key += this.decoder.write(data.toString('binary', p)) } + p = len + } + } else { + idxamp = undefined + for (i = p; i < len; ++i) { + if (!this._checkingBytes) { ++p } + if (data[i] === 0x26/* & */) { + idxamp = i + break + } + if (this._checkingBytes && this._bytesVal === this.fieldSizeLimit) { + this._hitLimit = true + break + } else if (this._checkingBytes) { ++this._bytesVal } + } + + if (idxamp !== undefined) { + ++this._fields + if (idxamp > p) { this._val += this.decoder.write(data.toString('binary', p, idxamp)) } + this.boy.emit('field', decodeText(this._key, 'binary', this.charset), + decodeText(this._val, 'binary', this.charset), + this._keyTrunc, + this._valTrunc) + this._state = 'key' + + this._hitLimit = false + this._checkingBytes = true + this._key = '' + this._bytesKey = 0 + this._keyTrunc = false + this.decoder.reset() + + p = idxamp + 1 + if (this._fields === this.fieldsLimit) { return cb() } + } else if (this._hitLimit) { + // we may not have hit the actual limit if there are encoded bytes... + if (i > p) { this._val += this.decoder.write(data.toString('binary', p, i)) } + p = i + if ((this._val === '' && this.fieldSizeLimit === 0) || + (this._bytesVal = this._val.length) === this.fieldSizeLimit) { + // yep, we actually did hit the limit + this._checkingBytes = false + this._valTrunc = true + } + } else { + if (p < len) { this._val += this.decoder.write(data.toString('binary', p)) } + p = len + } + } + } + cb() +} + +UrlEncoded.prototype.end = function () { + if (this.boy._done) { return } + + if (this._state === 'key' && this._key.length > 0) { + this.boy.emit('field', decodeText(this._key, 'binary', this.charset), + '', + this._keyTrunc, + false) + } else if (this._state === 'val') { + this.boy.emit('field', decodeText(this._key, 'binary', this.charset), + decodeText(this._val, 'binary', this.charset), + this._keyTrunc, + this._valTrunc) + } + this.boy._done = true + this.boy.emit('finish') } -exports.create_domTokenList = create_domTokenList; -//# sourceMappingURL=CreateAlgorithm.js.map + +module.exports = UrlEncoded + /***/ }), -/***/ 5648: -/***/ ((__unused_webpack_module, exports) => { +/***/ 89730: +/***/ ((module) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var PotentialCustomElementName = /[a-z]([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*-([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*/; -var NamesWithHyphen = new Set(['annotation-xml', 'color-profile', - 'font-face', 'font-face-src', 'font-face-uri', 'font-face-format', - 'font-face-name', 'missing-glyph']); -var ElementNames = new Set(['article', 'aside', 'blockquote', - 'body', 'div', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', - 'header', 'main', 'nav', 'p', 'section', 'span']); -var VoidElementNames = new Set(['area', 'base', 'basefont', - 'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen', - 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']); -var ShadowHostNames = new Set(['article', 'aside', 'blockquote', 'body', - 'div', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'main', - 'nav', 'p', 'section', 'span']); -/** - * Determines if the given string is a valid custom element name. - * - * @param name - a name string - */ -function customElement_isValidCustomElementName(name) { - if (!PotentialCustomElementName.test(name)) - return false; - if (NamesWithHyphen.has(name)) - return false; - return true; + +const RE_PLUS = /\+/g + +const HEX = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +] + +function Decoder () { + this.buffer = undefined +} +Decoder.prototype.write = function (str) { + // Replace '+' with ' ' before decoding + str = str.replace(RE_PLUS, ' ') + let res = '' + let i = 0; let p = 0; const len = str.length + for (; i < len; ++i) { + if (this.buffer !== undefined) { + if (!HEX[str.charCodeAt(i)]) { + res += '%' + this.buffer + this.buffer = undefined + --i // retry character + } else { + this.buffer += str[i] + ++p + if (this.buffer.length === 2) { + res += String.fromCharCode(parseInt(this.buffer, 16)) + this.buffer = undefined + } + } + } else if (str[i] === '%') { + if (i > p) { + res += str.substring(p, i) + p = i + } + this.buffer = '' + ++p + } + } + if (p < len && this.buffer === undefined) { res += str.substring(p) } + return res } -exports.customElement_isValidCustomElementName = customElement_isValidCustomElementName; -/** - * Determines if the given string is a valid element name. - * - * @param name - a name string - */ -function customElement_isValidElementName(name) { - return (ElementNames.has(name)); +Decoder.prototype.reset = function () { + this.buffer = undefined } -exports.customElement_isValidElementName = customElement_isValidElementName; -/** - * Determines if the given string is a void element name. - * - * @param name - a name string - */ -function customElement_isVoidElementName(name) { - return (VoidElementNames.has(name)); -} -exports.customElement_isVoidElementName = customElement_isVoidElementName; -/** - * Determines if the given string is a valid shadow host element name. - * - * @param name - a name string - */ -function customElement_isValidShadowHostName(name) { - return (ShadowHostNames.has(name)); -} -exports.customElement_isValidShadowHostName = customElement_isValidShadowHostName; -/** - * Enqueues an upgrade reaction for a custom element. - * - * @param element - a custom element - * @param definition - a custom element definition - */ -function customElement_enqueueACustomElementUpgradeReaction(element, definition) { - // TODO: Implement in HTML DOM + +module.exports = Decoder + + +/***/ }), + +/***/ 60496: +/***/ ((module) => { + +"use strict"; + + +module.exports = function basename (path) { + if (typeof path !== 'string') { return '' } + for (var i = path.length - 1; i >= 0; --i) { // eslint-disable-line no-var + switch (path.charCodeAt(i)) { + case 0x2F: // '/' + case 0x5C: // '\' + path = path.slice(i + 1) + return (path === '..' || path === '.' ? '' : path) + } + } + return (path === '..' || path === '.' ? '' : path) } -exports.customElement_enqueueACustomElementUpgradeReaction = customElement_enqueueACustomElementUpgradeReaction; -/** - * Enqueues a callback reaction for a custom element. - * - * @param element - a custom element - * @param callbackName - name of the callback - * @param args - callback arguments - */ -function customElement_enqueueACustomElementCallbackReaction(element, callbackName, args) { - // TODO: Implement in HTML DOM + + +/***/ }), + +/***/ 99136: +/***/ ((module) => { + +"use strict"; + + +// Node has always utf-8 +const utf8Decoder = new TextDecoder('utf-8') +const textDecoders = new Map([ + ['utf-8', utf8Decoder], + ['utf8', utf8Decoder] +]) + +function decodeText (text, textEncoding, destEncoding) { + if (text) { + if (textDecoders.has(destEncoding)) { + try { + return textDecoders.get(destEncoding).decode(Buffer.from(text, textEncoding)) + } catch (e) { } + } else { + try { + textDecoders.set(destEncoding, new TextDecoder(destEncoding)) + return textDecoders.get(destEncoding).decode(Buffer.from(text, textEncoding)) + } catch (e) { } + } + } + return text } -exports.customElement_enqueueACustomElementCallbackReaction = customElement_enqueueACustomElementCallbackReaction; -/** - * Upgrade a custom element. - * - * @param element - a custom element - */ -function customElement_upgrade(definition, element) { - // TODO: Implement in HTML DOM + +module.exports = decodeText + + +/***/ }), + +/***/ 49692: +/***/ ((module) => { + +"use strict"; + + +module.exports = function getLimit (limits, name, defaultLimit) { + if ( + !limits || + limits[name] === undefined || + limits[name] === null + ) { return defaultLimit } + + if ( + typeof limits[name] !== 'number' || + isNaN(limits[name]) + ) { throw new TypeError('Limit ' + name + ' is not a valid number') } + + return limits[name] } -exports.customElement_upgrade = customElement_upgrade; -/** - * Tries to upgrade a custom element. - * - * @param element - a custom element - */ -function customElement_tryToUpgrade(element) { - // TODO: Implement in HTML DOM + + +/***/ }), + +/***/ 34426: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const decodeText = __nccwpck_require__(99136) + +const RE_ENCODED = /%([a-fA-F0-9]{2})/g + +function encodedReplacer (match, byte) { + return String.fromCharCode(parseInt(byte, 16)) } -exports.customElement_tryToUpgrade = customElement_tryToUpgrade; -/** - * Looks up a custom element definition. - * - * @param document - a document - * @param namespace - element namespace - * @param localName - element local name - * @param is - an `is` value - */ -function customElement_lookUpACustomElementDefinition(document, namespace, localName, is) { - // TODO: Implement in HTML DOM - return null; + +function parseParams (str) { + const res = [] + let state = 'key' + let charset = '' + let inquote = false + let escaping = false + let p = 0 + let tmp = '' + + for (var i = 0, len = str.length; i < len; ++i) { // eslint-disable-line no-var + const char = str[i] + if (char === '\\' && inquote) { + if (escaping) { escaping = false } else { + escaping = true + continue + } + } else if (char === '"') { + if (!escaping) { + if (inquote) { + inquote = false + state = 'key' + } else { inquote = true } + continue + } else { escaping = false } + } else { + if (escaping && inquote) { tmp += '\\' } + escaping = false + if ((state === 'charset' || state === 'lang') && char === "'") { + if (state === 'charset') { + state = 'lang' + charset = tmp.substring(1) + } else { state = 'value' } + tmp = '' + continue + } else if (state === 'key' && + (char === '*' || char === '=') && + res.length) { + if (char === '*') { state = 'charset' } else { state = 'value' } + res[p] = [tmp, undefined] + tmp = '' + continue + } else if (!inquote && char === ';') { + state = 'key' + if (charset) { + if (tmp.length) { + tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), + 'binary', + charset) + } + charset = '' + } else if (tmp.length) { + tmp = decodeText(tmp, 'binary', 'utf8') + } + if (res[p] === undefined) { res[p] = tmp } else { res[p][1] = tmp } + tmp = '' + ++p + continue + } else if (!inquote && (char === ' ' || char === '\t')) { continue } + } + tmp += char + } + if (charset && tmp.length) { + tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), + 'binary', + charset) + } else if (tmp) { + tmp = decodeText(tmp, 'binary', 'utf8') + } + + if (res[p] === undefined) { + if (tmp) { res[p] = tmp } + } else { res[p][1] = tmp } + + return res } -exports.customElement_lookUpACustomElementDefinition = customElement_lookUpACustomElementDefinition; -//# sourceMappingURL=CustomElementAlgorithm.js.map + +module.exports = parseParams + /***/ }), -/***/ 9628: +/***/ 32206: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -48409,65 +49277,58 @@ var __values = (this && this.__values) || function(o) { throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var TreeAlgorithm_1 = __nccwpck_require__(6620); -var util_1 = __nccwpck_require__(5282); -var ShadowTreeAlgorithm_1 = __nccwpck_require__(8733); -var supportedTokens = new Map(); -/** - * Runs removing steps for node. - * - * @param removedNode - removed node - * @param oldParent - old parent node - */ -function dom_runRemovingSteps(removedNode, oldParent) { - // No steps defined -} -exports.dom_runRemovingSteps = dom_runRemovingSteps; +var EventAlgorithm_1 = __nccwpck_require__(28217); /** - * Runs cloning steps for node. + * Adds an algorithm to the given abort signal. * - * @param copy - node clone - * @param node - node - * @param document - document to own the cloned node - * @param cloneChildrenFlag - whether child nodes are cloned + * @param algorithm - an algorithm + * @param signal - abort signal */ -function dom_runCloningSteps(copy, node, document, cloneChildrenFlag) { - // No steps defined +function abort_add(algorithm, signal) { + /** + * 1. If signal’s aborted flag is set, then return. + * 2. Append algorithm to signal’s abort algorithms. + */ + if (signal._abortedFlag) + return; + signal._abortAlgorithms.add(algorithm); } -exports.dom_runCloningSteps = dom_runCloningSteps; +exports.abort_add = abort_add; /** - * Runs adopting steps for node. + * Removes an algorithm from the given abort signal. * - * @param node - node - * @param oldDocument - old document + * @param algorithm - an algorithm + * @param signal - abort signal */ -function dom_runAdoptingSteps(node, oldDocument) { - // No steps defined +function abort_remove(algorithm, signal) { + /** + * To remove an algorithm algorithm from an AbortSignal signal, remove + * algorithm from signal’s abort algorithms. + */ + signal._abortAlgorithms.delete(algorithm); } -exports.dom_runAdoptingSteps = dom_runAdoptingSteps; +exports.abort_remove = abort_remove; /** - * Runs attribute change steps for an element node. + * Signals abort on the given abort signal. * - * @param element - element node owning the attribute - * @param localName - attribute's local name - * @param oldValue - attribute's old value - * @param value - attribute's new value - * @param namespace - attribute's namespace + * @param signal - abort signal */ -function dom_runAttributeChangeSteps(element, localName, oldValue, value, namespace) { +function abort_signalAbort(signal) { var e_1, _a; - // run default steps - if (DOMImpl_1.dom.features.slots) { - updateASlotablesName.call(element, element, localName, oldValue, value, namespace); - updateASlotsName.call(element, element, localName, oldValue, value, namespace); - } - updateAnElementID.call(element, element, localName, value, namespace); + /** + * 1. If signal’s aborted flag is set, then return. + * 2. Set signal’s aborted flag. + * 3. For each algorithm in signal’s abort algorithms: run algorithm. + * 4. Empty signal’s abort algorithms. + * 5. Fire an event named abort at signal. + */ + if (signal._abortedFlag) + return; + signal._abortedFlag = true; try { - // run custom steps - for (var _b = __values(element._attributeChangeSteps), _c = _b.next(); !_c.done; _c = _b.next()) { - var step = _c.value; - step.call(element, element, localName, oldValue, value, namespace); + for (var _b = __values(signal._abortAlgorithms), _c = _b.next(); !_c.done; _c = _b.next()) { + var algorithm = _c.value; + algorithm.call(signal); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } @@ -48477,2070 +49338,700 @@ function dom_runAttributeChangeSteps(element, localName, oldValue, value, namesp } finally { if (e_1) throw e_1.error; } } + signal._abortAlgorithms.clear(); + EventAlgorithm_1.event_fireAnEvent("abort", signal); } -exports.dom_runAttributeChangeSteps = dom_runAttributeChangeSteps; -/** - * Runs insertion steps for a node. - * - * @param insertedNode - inserted node - */ -function dom_runInsertionSteps(insertedNode) { - // No steps defined -} -exports.dom_runInsertionSteps = dom_runInsertionSteps; -/** - * Runs pre-removing steps for a node iterator and node. - * - * @param nodeIterator - a node iterator - * @param toBeRemoved - node to be removed - */ -function dom_runNodeIteratorPreRemovingSteps(nodeIterator, toBeRemoved) { - removeNodeIterator.call(nodeIterator, nodeIterator, toBeRemoved); -} -exports.dom_runNodeIteratorPreRemovingSteps = dom_runNodeIteratorPreRemovingSteps; -/** - * Determines if there are any supported tokens defined for the given - * attribute name. - * - * @param attributeName - an attribute name - */ -function dom_hasSupportedTokens(attributeName) { - return supportedTokens.has(attributeName); -} -exports.dom_hasSupportedTokens = dom_hasSupportedTokens; -/** - * Returns the set of supported tokens defined for the given attribute name. - * - * @param attributeName - an attribute name - */ -function dom_getSupportedTokens(attributeName) { - return supportedTokens.get(attributeName) || new Set(); -} -exports.dom_getSupportedTokens = dom_getSupportedTokens; +exports.abort_signalAbort = abort_signalAbort; +//# sourceMappingURL=AbortAlgorithm.js.map + +/***/ }), + +/***/ 84309: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var ElementAlgorithm_1 = __nccwpck_require__(51849); /** - * Runs event construction steps. + * Changes the value of an existing attribute. * - * @param event - an event + * @param attribute - an attribute node + * @param value - attribute value */ -function dom_runEventConstructingSteps(event) { - // No steps defined +function attr_setAnExistingAttributeValue(attribute, value) { + /** + * 1. If attribute’s element is null, then set attribute’s value to value. + * 2. Otherwise, change attribute from attribute’s element to value. + */ + if (attribute._element === null) { + attribute._value = value; + } + else { + ElementAlgorithm_1.element_change(attribute, attribute._element, value); + } } -exports.dom_runEventConstructingSteps = dom_runEventConstructingSteps; +exports.attr_setAnExistingAttributeValue = attr_setAnExistingAttributeValue; +//# sourceMappingURL=AttrAlgorithm.js.map + +/***/ }), + +/***/ 81054: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var interfaces_1 = __nccwpck_require__(27305); +var TreeAlgorithm_1 = __nccwpck_require__(16620); /** - * Runs child text content change steps for a parent node. + * Defines the position of a boundary point relative to another. * - * @param parent - parent node with text node child nodes - */ -function dom_runChildTextContentChangeSteps(parent) { - // No steps defined -} -exports.dom_runChildTextContentChangeSteps = dom_runChildTextContentChangeSteps; -/** - * Defines pre-removing steps for a node iterator. + * @param bp - a boundary point + * @param relativeTo - a boundary point to compare to */ -function removeNodeIterator(nodeIterator, toBeRemovedNode) { +function boundaryPoint_position(bp, relativeTo) { + var nodeA = bp[0]; + var offsetA = bp[1]; + var nodeB = relativeTo[0]; + var offsetB = relativeTo[1]; /** - * 1. If toBeRemovedNode is not an inclusive ancestor of nodeIterator’s - * reference, or toBeRemovedNode is nodeIterator’s root, then return. + * 1. Assert: nodeA and nodeB have the same root. */ - if (toBeRemovedNode === nodeIterator._root || - !TreeAlgorithm_1.tree_isAncestorOf(nodeIterator._reference, toBeRemovedNode, true)) { - return; - } + console.assert(TreeAlgorithm_1.tree_rootNode(nodeA) === TreeAlgorithm_1.tree_rootNode(nodeB), "Boundary points must share the same root node."); /** - * 2. If nodeIterator’s pointer before reference is true, then: + * 2. If nodeA is nodeB, then return equal if offsetA is offsetB, before + * if offsetA is less than offsetB, and after if offsetA is greater than + * offsetB. */ - if (nodeIterator._pointerBeforeReference) { - /** - * 2.1. Let next be toBeRemovedNode’s first following node that is an - * inclusive descendant of nodeIterator’s root and is not an inclusive - * descendant of toBeRemovedNode, and null if there is no such node. - */ - while (true) { - var nextNode = TreeAlgorithm_1.tree_getFollowingNode(nodeIterator._root, toBeRemovedNode); - if (nextNode !== null && - TreeAlgorithm_1.tree_isDescendantOf(nodeIterator._root, nextNode, true) && - !TreeAlgorithm_1.tree_isDescendantOf(toBeRemovedNode, nextNode, true)) { - /** - * 2.2. If next is non-null, then set nodeIterator’s reference to next - * and return. - */ - nodeIterator._reference = nextNode; - return; - } - else if (nextNode === null) { - /** - * 2.3. Otherwise, set nodeIterator’s pointer before reference to false. - */ - nodeIterator._pointerBeforeReference = false; - return; - } + if (nodeA === nodeB) { + if (offsetA === offsetB) { + return interfaces_1.BoundaryPosition.Equal; } - } - /** - * 3. Set nodeIterator’s reference to toBeRemovedNode’s parent, if - * toBeRemovedNode’s previous sibling is null, and to the inclusive - * descendant of toBeRemovedNode’s previous sibling that appears last in - * tree order otherwise. - */ - if (toBeRemovedNode._previousSibling === null) { - if (toBeRemovedNode._parent !== null) { - nodeIterator._reference = toBeRemovedNode._parent; + else if (offsetA < offsetB) { + return interfaces_1.BoundaryPosition.Before; } - } - else { - var referenceNode = toBeRemovedNode._previousSibling; - var childNode = TreeAlgorithm_1.tree_getFirstDescendantNode(toBeRemovedNode._previousSibling, true, false); - while (childNode !== null) { - if (childNode !== null) { - referenceNode = childNode; - } - // loop through to get the last descendant node - childNode = TreeAlgorithm_1.tree_getNextDescendantNode(toBeRemovedNode._previousSibling, childNode, true, false); + else { + return interfaces_1.BoundaryPosition.After; } - nodeIterator._reference = referenceNode; } -} -/** - * Defines attribute change steps to update a slot’s name. - */ -function updateASlotsName(element, localName, oldValue, value, namespace) { /** - * 1. If element is a slot, localName is name, and namespace is null, then: - * 1.1. If value is oldValue, then return. - * 1.2. If value is null and oldValue is the empty string, then return. - * 1.3. If value is the empty string and oldValue is null, then return. - * 1.4. If value is null or the empty string, then set element’s name to the - * empty string. - * 1.5. Otherwise, set element’s name to value. - * 1.6. Run assign slotables for a tree with element’s root. + * 3. If nodeA is following nodeB, then if the position of (nodeB, offsetB) + * relative to (nodeA, offsetA) is before, return after, and if it is after, + * return before. */ - if (util_1.Guard.isSlot(element) && localName === "name" && namespace === null) { - if (value === oldValue) - return; - if (value === null && oldValue === '') - return; - if (value === '' && oldValue === null) - return; - if ((value === null || value === '')) { - element._name = ''; + if (TreeAlgorithm_1.tree_isFollowing(nodeB, nodeA)) { + var pos = boundaryPoint_position([nodeB, offsetB], [nodeA, offsetA]); + if (pos === interfaces_1.BoundaryPosition.Before) { + return interfaces_1.BoundaryPosition.After; } - else { - element._name = value; + else if (pos === interfaces_1.BoundaryPosition.After) { + return interfaces_1.BoundaryPosition.Before; } - ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(element)); } -} -/** - * Defines attribute change steps to update a slotable’s name. - */ -function updateASlotablesName(element, localName, oldValue, value, namespace) { /** - * 1. If localName is slot and namespace is null, then: - * 1.1. If value is oldValue, then return. - * 1.2. If value is null and oldValue is the empty string, then return. - * 1.3. If value is the empty string and oldValue is null, then return. - * 1.4. If value is null or the empty string, then set element’s name to - * the empty string. - * 1.5. Otherwise, set element’s name to value. - * 1.6. If element is assigned, then run assign slotables for element’s - * assigned slot. - * 1.7. Run assign a slot for element. + * 4. If nodeA is an ancestor of nodeB: */ - if (util_1.Guard.isSlotable(element) && localName === "slot" && namespace === null) { - if (value === oldValue) - return; - if (value === null && oldValue === '') - return; - if (value === '' && oldValue === null) - return; - if ((value === null || value === '')) { - element._name = ''; - } - else { - element._name = value; + if (TreeAlgorithm_1.tree_isAncestorOf(nodeB, nodeA)) { + /** + * 4.1. Let child be nodeB. + * 4.2. While child is not a child of nodeA, set child to its parent. + * 4.3. If child’s index is less than offsetA, then return after. + */ + var child = nodeB; + while (!TreeAlgorithm_1.tree_isChildOf(nodeA, child)) { + /* istanbul ignore else */ + if (child._parent !== null) { + child = child._parent; + } } - if (ShadowTreeAlgorithm_1.shadowTree_isAssigned(element)) { - ShadowTreeAlgorithm_1.shadowTree_assignSlotables(element._assignedSlot); + if (TreeAlgorithm_1.tree_index(child) < offsetA) { + return interfaces_1.BoundaryPosition.After; } - ShadowTreeAlgorithm_1.shadowTree_assignASlot(element); } -} -/** - * Defines attribute change steps to update an element's ID. - */ -function updateAnElementID(element, localName, value, namespace) { /** - * 1. If localName is id, namespace is null, and value is null or the empty - * string, then unset element’s ID. - * 2. Otherwise, if localName is id, namespace is null, then set element’s - * ID to value. + * 5. Return before. */ - if (localName === "id" && namespace === null) { - if (!value) - element._uniqueIdentifier = undefined; - else - element._uniqueIdentifier = value; - } + return interfaces_1.BoundaryPosition.Before; } -//# sourceMappingURL=DOMAlgorithm.js.map +exports.boundaryPoint_position = boundaryPoint_position; +//# sourceMappingURL=BoundaryPointAlgorithm.js.map /***/ }), -/***/ 3261: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 19461: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var OrderedSetAlgorithm_1 = __nccwpck_require__(3670); +var DOMImpl_1 = __nccwpck_require__(14177); +var util_1 = __nccwpck_require__(65282); +var DOMException_1 = __nccwpck_require__(13166); +var TreeAlgorithm_1 = __nccwpck_require__(16620); +var MutationObserverAlgorithm_1 = __nccwpck_require__(78157); var DOMAlgorithm_1 = __nccwpck_require__(9628); -var ElementAlgorithm_1 = __nccwpck_require__(1849); /** - * Validates a given token against the supported tokens defined for the given - * token lists' associated attribute. + * Replaces character data. * - * @param tokenList - a token list - * @param token - a token + * @param node - a character data node + * @param offset - start offset + * @param count - count of characters to replace + * @param data - new data */ -function tokenList_validationSteps(tokenList, token) { +function characterData_replaceData(node, offset, count, data) { + var e_1, _a; /** - * 1. If the associated attribute’s local name does not define supported - * tokens, throw a TypeError. - * 2. Let lowercase token be a copy of token, in ASCII lowercase. - * 3. If lowercase token is present in supported tokens, return true. - * 4. Return false. - */ - if (!DOMAlgorithm_1.dom_hasSupportedTokens(tokenList._attribute._localName)) { - throw new TypeError("There are no supported tokens defined for attribute name: '" + tokenList._attribute._localName + "'."); + * 1. Let length be node’s length. + * 2. If offset is greater than length, then throw an "IndexSizeError" + * DOMException. + * 3. If offset plus count is greater than length, then set count to length + * minus offset. + */ + var length = TreeAlgorithm_1.tree_nodeLength(node); + if (offset > length) { + throw new DOMException_1.IndexSizeError("Offset exceeds character data length. Offset: " + offset + ", Length: " + length + ", Node is " + node.nodeName + "."); + } + if (offset + count > length) { + count = length - offset; } - return DOMAlgorithm_1.dom_getSupportedTokens(tokenList._attribute._localName).has(token.toLowerCase()); -} -exports.tokenList_validationSteps = tokenList_validationSteps; -/** - * Updates the value of the token lists' associated attribute. - * - * @param tokenList - a token list - */ -function tokenList_updateSteps(tokenList) { /** - * 1. If the associated element does not have an associated attribute and - * token set is empty, then return. - * 2. Set an attribute value for the associated element using associated - * attribute’s local name and the result of running the ordered set - * serializer for token set. + * 4. Queue a mutation record of "characterData" for node with null, null, + * node’s data, « », « », null, and null. */ - if (!tokenList._element.hasAttribute(tokenList._attribute._localName) && - tokenList._tokenSet.size === 0) { - return; + if (DOMImpl_1.dom.features.mutationObservers) { + MutationObserverAlgorithm_1.observer_queueMutationRecord("characterData", node, null, null, node._data, [], [], null, null); } - ElementAlgorithm_1.element_setAnAttributeValue(tokenList._element, tokenList._attribute._localName, OrderedSetAlgorithm_1.orderedSet_serialize(tokenList._tokenSet)); -} -exports.tokenList_updateSteps = tokenList_updateSteps; -/** - * Gets the value of the token lists' associated attribute. - * - * @param tokenList - a token list - */ -function tokenList_serializeSteps(tokenList) { /** - * A DOMTokenList object’s serialize steps are to return the result of - * running get an attribute value given the associated element and the - * associated attribute’s local name. + * 5. Insert data into node’s data after offset code units. + * 6. Let delete offset be offset + data’s length. + * 7. Starting from delete offset code units, remove count code units from + * node’s data. */ - return ElementAlgorithm_1.element_getAnAttributeValue(tokenList._element, tokenList._attribute._localName); -} -exports.tokenList_serializeSteps = tokenList_serializeSteps; -//# sourceMappingURL=DOMTokenListAlgorithm.js.map - -/***/ }), - -/***/ 2793: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; + var newData = node._data.substring(0, offset) + data + + node._data.substring(offset + count); + node._data = newData; try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + /** + * 8. For each live range whose start node is node and start offset is + * greater than offset but less than or equal to offset plus count, set its + * start offset to offset. + * 9. For each live range whose end node is node and end offset is greater + * than offset but less than or equal to offset plus count, set its end + * offset to offset. + * 10. For each live range whose start node is node and start offset is + * greater than offset plus count, increase its start offset by data’s + * length and decrease it by count. + * 11. For each live range whose end node is node and end offset is greater + * than offset plus count, increase its end offset by data’s length and + * decrease it by count. + */ + for (var _b = __values(DOMImpl_1.dom.rangeList), _c = _b.next(); !_c.done; _c = _b.next()) { + var range = _c.value; + if (range._start[0] === node && range._start[1] > offset && range._start[1] <= offset + count) { + range._start[1] = offset; + } + if (range._end[0] === node && range._end[1] > offset && range._end[1] <= offset + count) { + range._end[1] = offset; + } + if (range._start[0] === node && range._start[1] > offset + count) { + range._start[1] += data.length - count; + } + if (range._end[0] === node && range._end[1] > offset + count) { + range._end[1] += data.length - count; + } + } } - catch (error) { e = { error: error }; } + catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { - if (r && !r.done && (m = i["return"])) m.call(i); + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } - finally { if (e) throw e.error; } + finally { if (e_1) throw e_1.error; } } - return ar; -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var util_1 = __nccwpck_require__(5282); -var util_2 = __nccwpck_require__(6195); -var ElementImpl_1 = __nccwpck_require__(5975); -var CustomElementAlgorithm_1 = __nccwpck_require__(5648); -var TreeAlgorithm_1 = __nccwpck_require__(6620); -var NamespaceAlgorithm_1 = __nccwpck_require__(5856); -var DOMAlgorithm_1 = __nccwpck_require__(9628); -var ElementAlgorithm_1 = __nccwpck_require__(1849); -var MutationAlgorithm_1 = __nccwpck_require__(5463); -/** - * Returns an element interface for the given name and namespace. - * - * @param name - element name - * @param namespace - namespace - */ -function document_elementInterface(name, namespace) { - return ElementImpl_1.ElementImpl; -} -exports.document_elementInterface = document_elementInterface; -/** - * Creates a new element node. - * See: https://dom.spec.whatwg.org/#internal-createelementns-steps - * - * @param document - owner document - * @param namespace - element namespace - * @param qualifiedName - qualified name - * @param options - element options - */ -function document_internalCreateElementNS(document, namespace, qualifiedName, options) { /** - * 1. Let namespace, prefix, and localName be the result of passing - * namespace and qualifiedName to validate and extract. - * 2. Let is be null. - * 3. If options is a dictionary and options’s is is present, then set - * is to it. - * 4. Return the result of creating an element given document, localName, - * namespace, prefix, is, and with the synchronous custom elements flag set. + * 12. If node is a Text node and its parent is not null, run the child + * text content change steps for node’s parent. */ - var _a = __read(NamespaceAlgorithm_1.namespace_validateAndExtract(namespace, qualifiedName), 3), ns = _a[0], prefix = _a[1], localName = _a[2]; - var is = null; - if (options !== undefined) { - if (util_2.isString(options)) { - is = options; - } - else { - is = options.is; + if (DOMImpl_1.dom.features.steps) { + if (util_1.Guard.isTextNode(node) && node._parent !== null) { + DOMAlgorithm_1.dom_runChildTextContentChangeSteps(node._parent); } } - return ElementAlgorithm_1.element_createAnElement(document, localName, ns, prefix, is, true); } -exports.document_internalCreateElementNS = document_internalCreateElementNS; +exports.characterData_replaceData = characterData_replaceData; /** - * Removes `node` and its subtree from its document and changes - * its owner document to `document` so that it can be inserted - * into `document`. + * Returns `count` number of characters from `node`'s data starting at + * the given `offset`. * - * @param node - the node to move - * @param document - document to receive the node and its subtree + * @param node - a character data node + * @param offset - start offset + * @param count - count of characters to return */ -function document_adopt(node, document) { - var e_1, _a; - // Optimize for common case of inserting a fresh node - if (node._nodeDocument === document && node._parent === null) { - return; - } - /** - * 1. Let oldDocument be node’s node document. - * 2. If node’s parent is not null, remove node from its parent. - */ - var oldDocument = node._nodeDocument; - if (node._parent) - MutationAlgorithm_1.mutation_remove(node, node._parent); +function characterData_substringData(node, offset, count) { /** - * 3. If document is not oldDocument, then: + * 1. Let length be node’s length. + * 2. If offset is greater than length, then throw an "IndexSizeError" + * DOMException. + * 3. If offset plus count is greater than length, return a string whose + * value is the code units from the offsetth code unit to the end of node’s + * data, and then return. + * 4. Return a string whose value is the code units from the offsetth code + * unit to the offset+countth code unit in node’s data. */ - if (document !== oldDocument) { - /** - * 3.1. For each inclusiveDescendant in node’s shadow-including inclusive - * descendants: - */ - var inclusiveDescendant = TreeAlgorithm_1.tree_getFirstDescendantNode(node, true, true); - while (inclusiveDescendant !== null) { - /** - * 3.1.1. Set inclusiveDescendant’s node document to document. - * 3.1.2. If inclusiveDescendant is an element, then set the node - * document of each attribute in inclusiveDescendant’s attribute list - * to document. - */ - inclusiveDescendant._nodeDocument = document; - if (util_1.Guard.isElementNode(inclusiveDescendant)) { - try { - for (var _b = (e_1 = void 0, __values(inclusiveDescendant._attributeList._asArray())), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - attr._nodeDocument = document; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - } - /** - * 3.2. For each inclusiveDescendant in node's shadow-including - * inclusive descendants that is custom, enqueue a custom - * element callback reaction with inclusiveDescendant, - * callback name "adoptedCallback", and an argument list - * containing oldDocument and document. - */ - if (DOMImpl_1.dom.features.customElements) { - if (util_1.Guard.isElementNode(inclusiveDescendant) && - inclusiveDescendant._customElementState === "custom") { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(inclusiveDescendant, "adoptedCallback", [oldDocument, document]); - } - } - /** - * 3.3. For each inclusiveDescendant in node’s shadow-including - * inclusive descendants, in shadow-including tree order, run the - * adopting steps with inclusiveDescendant and oldDocument. - */ - if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runAdoptingSteps(inclusiveDescendant, oldDocument); - } - inclusiveDescendant = TreeAlgorithm_1.tree_getNextDescendantNode(node, inclusiveDescendant, true, true); - } + var length = TreeAlgorithm_1.tree_nodeLength(node); + if (offset > length) { + throw new DOMException_1.IndexSizeError("Offset exceeds character data length. Offset: " + offset + ", Length: " + length + ", Node is " + node.nodeName + "."); + } + if (offset + count > length) { + return node._data.substr(offset); + } + else { + return node._data.substr(offset, count); } } -exports.document_adopt = document_adopt; -//# sourceMappingURL=DocumentAlgorithm.js.map +exports.characterData_substringData = characterData_substringData; +//# sourceMappingURL=CharacterDataAlgorithm.js.map /***/ }), -/***/ 1849: +/***/ 57339: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var infra_1 = __nccwpck_require__(4251); -var util_1 = __nccwpck_require__(5282); -var DOMException_1 = __nccwpck_require__(3166); -var CreateAlgorithm_1 = __nccwpck_require__(7339); -var CustomElementAlgorithm_1 = __nccwpck_require__(5648); -var MutationObserverAlgorithm_1 = __nccwpck_require__(8157); -var DOMAlgorithm_1 = __nccwpck_require__(9628); -var MutationAlgorithm_1 = __nccwpck_require__(5463); -var DocumentAlgorithm_1 = __nccwpck_require__(2793); +var DOMImplementationImpl_1 = __nccwpck_require__(42197); +var WindowImpl_1 = __nccwpck_require__(69067); +var XMLDocumentImpl_1 = __nccwpck_require__(21685); +var DocumentImpl_1 = __nccwpck_require__(14333); +var AbortControllerImpl_1 = __nccwpck_require__(66461); +var AbortSignalImpl_1 = __nccwpck_require__(10022); +var DocumentTypeImpl_1 = __nccwpck_require__(3173); +var ElementImpl_1 = __nccwpck_require__(35975); +var DocumentFragmentImpl_1 = __nccwpck_require__(12585); +var ShadowRootImpl_1 = __nccwpck_require__(61911); +var AttrImpl_1 = __nccwpck_require__(13717); +var TextImpl_1 = __nccwpck_require__(42191); +var CDATASectionImpl_1 = __nccwpck_require__(23977); +var CommentImpl_1 = __nccwpck_require__(20930); +var ProcessingInstructionImpl_1 = __nccwpck_require__(99430); +var HTMLCollectionImpl_1 = __nccwpck_require__(93969); +var NodeListImpl_1 = __nccwpck_require__(43728); +var NodeListStaticImpl_1 = __nccwpck_require__(65306); +var NamedNodeMapImpl_1 = __nccwpck_require__(57206); +var RangeImpl_1 = __nccwpck_require__(50166); +var NodeIteratorImpl_1 = __nccwpck_require__(61997); +var TreeWalkerImpl_1 = __nccwpck_require__(89261); +var NodeFilterImpl_1 = __nccwpck_require__(12355); +var MutationRecordImpl_1 = __nccwpck_require__(6219); +var DOMTokenListImpl_1 = __nccwpck_require__(65096); /** - * Determines whether the element's attribute list contains the given - * attribute. + * Creates a `DOMImplementation`. * - * @param attribute - an attribute node - * @param element - an element node + * @param document - associated document */ -function element_has(attribute, element) { - /** - * An element has an attribute A if its attribute list contains A. - */ - return element._attributeList._asArray().indexOf(attribute) !== -1; +function create_domImplementation(document) { + return DOMImplementationImpl_1.DOMImplementationImpl._create(document); } -exports.element_has = element_has; +exports.create_domImplementation = create_domImplementation; /** - * Changes the value of an attribute node. - * - * @param attribute - an attribute node - * @param element - an element node - * @param value - attribute value + * Creates a `Window` node. */ -function element_change(attribute, element, value) { - /** - * 1. Queue an attribute mutation record for element with attribute’s - * local name, attribute’s namespace, and attribute’s value. - */ - if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, attribute._localName, attribute._namespace, attribute._value); - } - /** - * 2. If element is custom, then enqueue a custom element callback reaction - * with element, callback name "attributeChangedCallback", and an argument - * list containing attribute’s local name, attribute’s value, value, and - * attribute’s namespace. - */ - if (DOMImpl_1.dom.features.customElements) { - if (util_1.Guard.isCustomElementNode(element)) { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [attribute._localName, attribute._value, value, attribute._namespace]); - } - } - /** - * 3. Run the attribute change steps with element, attribute’s local name, - * attribute’s value, value, and attribute’s namespace. - * 4. Set attribute’s value to value. - */ - if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runAttributeChangeSteps(element, attribute._localName, attribute._value, value, attribute._namespace); - } - attribute._value = value; +function create_window() { + return WindowImpl_1.WindowImpl._create(); } -exports.element_change = element_change; +exports.create_window = create_window; /** - * Appends an attribute to an element node. - * - * @param attribute - an attribute - * @param element - an element to receive the attribute + * Creates an `XMLDocument` node. */ -function element_append(attribute, element) { - /** - * 1. Queue an attribute mutation record for element with attribute’s - * local name, attribute’s namespace, and null. - */ - if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, attribute._localName, attribute._namespace, null); - } - /** - * 2. If element is custom, then enqueue a custom element callback reaction - * with element, callback name "attributeChangedCallback", and an argument - * list containing attribute’s local name, null, attribute’s value, and - * attribute’s namespace. - */ - if (DOMImpl_1.dom.features.customElements) { - if (util_1.Guard.isCustomElementNode(element)) { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [attribute._localName, null, attribute._value, attribute._namespace]); - } - } - /** - * 3. Run the attribute change steps with element, attribute’s local name, - * null, attribute’s value, and attribute’s namespace. - */ - if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runAttributeChangeSteps(element, attribute._localName, null, attribute._value, attribute._namespace); - } - /** - * 4. Append attribute to element’s attribute list. - * 5. Set attribute’s element to element. - */ - element._attributeList._asArray().push(attribute); - attribute._element = element; - // mark that the document has namespaces - if (!element._nodeDocument._hasNamespaces && (attribute._namespace !== null || - attribute._namespacePrefix !== null || attribute._localName === "xmlns")) { - element._nodeDocument._hasNamespaces = true; - } +function create_xmlDocument() { + return new XMLDocumentImpl_1.XMLDocumentImpl(); } -exports.element_append = element_append; +exports.create_xmlDocument = create_xmlDocument; /** - * Removes an attribute from an element node. - * - * @param attribute - an attribute - * @param element - an element to receive the attribute + * Creates a `Document` node. */ -function element_remove(attribute, element) { - /** - * 1. Queue an attribute mutation record for element with attribute’s - * local name, attribute’s namespace, and attribute’s value. - */ - if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, attribute._localName, attribute._namespace, attribute._value); - } - /** - * 2. If element is custom, then enqueue a custom element callback reaction - * with element, callback name "attributeChangedCallback", and an argument - * list containing attribute’s local name, attribute’s value, null, - * and attribute’s namespace. - */ - if (DOMImpl_1.dom.features.customElements) { - if (util_1.Guard.isCustomElementNode(element)) { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [attribute._localName, attribute._value, null, attribute._namespace]); - } - } - /** - * 3. Run the attribute change steps with element, attribute’s local name, - * attribute’s value, null, and attribute’s namespace. - */ - if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runAttributeChangeSteps(element, attribute._localName, attribute._value, null, attribute._namespace); - } - /** - * 3. Remove attribute from element’s attribute list. - * 5. Set attribute’s element to null. - */ - var index = element._attributeList._asArray().indexOf(attribute); - element._attributeList._asArray().splice(index, 1); - attribute._element = null; +function create_document() { + return new DocumentImpl_1.DocumentImpl(); } -exports.element_remove = element_remove; +exports.create_document = create_document; /** - * Replaces an attribute with another of an element node. - * - * @param oldAttr - old attribute - * @param newAttr - new attribute - * @param element - an element to receive the attribute + * Creates an `AbortController`. */ -function element_replace(oldAttr, newAttr, element) { - /** - * 1. Queue an attribute mutation record for element with oldAttr’s - * local name, oldAttr’s namespace, and oldAttr’s value. - */ - if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, oldAttr._localName, oldAttr._namespace, oldAttr._value); - } - /** - * 2. If element is custom, then enqueue a custom element callback reaction - * with element, callback name "attributeChangedCallback", and an argument - * list containing oldAttr’s local name, oldAttr’s value, newAttr’s value, - * and oldAttr’s namespace. - */ - if (DOMImpl_1.dom.features.customElements) { - if (util_1.Guard.isCustomElementNode(element)) { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [oldAttr._localName, oldAttr._value, newAttr._value, oldAttr._namespace]); - } - } - /** - * 3. Run the attribute change steps with element, oldAttr’s local name, - * oldAttr’s value, newAttr’s value, and oldAttr’s namespace. - */ - if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runAttributeChangeSteps(element, oldAttr._localName, oldAttr._value, newAttr._value, oldAttr._namespace); - } - /** - * 4. Replace oldAttr by newAttr in element’s attribute list. - * 5. Set oldAttr’s element to null. - * 6. Set newAttr’s element to element. - */ - var index = element._attributeList._asArray().indexOf(oldAttr); - if (index !== -1) { - element._attributeList._asArray()[index] = newAttr; - } - oldAttr._element = null; - newAttr._element = element; - // mark that the document has namespaces - if (!element._nodeDocument._hasNamespaces && (newAttr._namespace !== null || - newAttr._namespacePrefix !== null || newAttr._localName === "xmlns")) { - element._nodeDocument._hasNamespaces = true; - } +function create_abortController() { + return new AbortControllerImpl_1.AbortControllerImpl(); } -exports.element_replace = element_replace; +exports.create_abortController = create_abortController; /** - * Retrieves an attribute with the given name from an element node. - * - * @param qualifiedName - an attribute name - * @param element - an element to receive the attribute + * Creates an `AbortSignal`. */ -function element_getAnAttributeByName(qualifiedName, element) { - /** - * 1. If element is in the HTML namespace and its node document is an HTML - * document, then set qualifiedName to qualifiedName in ASCII lowercase. - * 2. Return the first attribute in element’s attribute list whose qualified - * name is qualifiedName, and null otherwise. - */ - if (element._namespace === infra_1.namespace.HTML && element._nodeDocument._type === "html") { - qualifiedName = qualifiedName.toLowerCase(); - } - return element._attributeList._asArray().find(function (attr) { return attr._qualifiedName === qualifiedName; }) || null; +function create_abortSignal() { + return AbortSignalImpl_1.AbortSignalImpl._create(); } -exports.element_getAnAttributeByName = element_getAnAttributeByName; +exports.create_abortSignal = create_abortSignal; /** - * Retrieves an attribute with the given namespace and local name from an - * element node. + * Creates a `DocumentType` node. * - * @param namespace - an attribute namespace - * @param localName - an attribute local name - * @param element - an element to receive the attribute + * @param document - owner document + * @param name - name of the node + * @param publicId - `PUBLIC` identifier + * @param systemId - `SYSTEM` identifier */ -function element_getAnAttributeByNamespaceAndLocalName(namespace, localName, element) { - /** - * 1. If namespace is the empty string, set it to null. - * 2. Return the attribute in element’s attribute list whose namespace is - * namespace and local name is localName, if any, and null otherwise. - */ - var ns = namespace || null; - return element._attributeList._asArray().find(function (attr) { return attr._namespace === ns && attr._localName === localName; }) || null; +function create_documentType(document, name, publicId, systemId) { + return DocumentTypeImpl_1.DocumentTypeImpl._create(document, name, publicId, systemId); } -exports.element_getAnAttributeByNamespaceAndLocalName = element_getAnAttributeByNamespaceAndLocalName; +exports.create_documentType = create_documentType; /** - * Retrieves an attribute's value with the given name namespace and local - * name from an element node. + * Creates a new `Element` node. * - * @param element - an element to receive the attribute - * @param localName - an attribute local name - * @param namespace - an attribute namespace + * @param document - owner document + * @param localName - local name + * @param namespace - namespace + * @param prefix - namespace prefix */ -function element_getAnAttributeValue(element, localName, namespace) { - if (namespace === void 0) { namespace = ''; } - /** - * 1. Let attr be the result of getting an attribute given namespace, - * localName, and element. - * 2. If attr is null, then return the empty string. - * 3. Return attr’s value. - */ - var attr = element_getAnAttributeByNamespaceAndLocalName(namespace, localName, element); - if (attr === null) - return ''; - else - return attr._value; +function create_element(document, localName, namespace, prefix) { + return ElementImpl_1.ElementImpl._create(document, localName, namespace, prefix); } -exports.element_getAnAttributeValue = element_getAnAttributeValue; +exports.create_element = create_element; /** - * Sets an attribute of an element node. + * Creates a new `HTMLElement` node. * - * @param attr - an attribute - * @param element - an element to receive the attribute + * @param document - owner document + * @param localName - local name + * @param namespace - namespace + * @param prefix - namespace prefix */ -function element_setAnAttribute(attr, element) { - /** - * 1. If attr’s element is neither null nor element, throw an - * "InUseAttributeError" DOMException. - * 2. Let oldAttr be the result of getting an attribute given attr’s - * namespace, attr’s local name, and element. - * 3. If oldAttr is attr, return attr. - * 4. If oldAttr is non-null, replace it by attr in element. - * 5. Otherwise, append attr to element. - * 6. Return oldAttr. - */ - if (attr._element !== null && attr._element !== element) - throw new DOMException_1.InUseAttributeError("This attribute already exists in the document: " + attr._qualifiedName + " as a child of " + attr._element._qualifiedName + "."); - var oldAttr = element_getAnAttributeByNamespaceAndLocalName(attr._namespace || '', attr._localName, element); - if (oldAttr === attr) - return attr; - if (oldAttr !== null) { - element_replace(oldAttr, attr, element); - } - else { - element_append(attr, element); - } - return oldAttr; +function create_htmlElement(document, localName, namespace, prefix) { + // TODO: Implement in HTML DOM + return ElementImpl_1.ElementImpl._create(document, localName, namespace, prefix); } -exports.element_setAnAttribute = element_setAnAttribute; +exports.create_htmlElement = create_htmlElement; /** - * Sets an attribute's value of an element node. + * Creates a new `HTMLUnknownElement` node. * - * @param element - an element to receive the attribute - * @param localName - an attribute local name - * @param value - an attribute value - * @param prefix - an attribute prefix - * @param namespace - an attribute namespace + * @param document - owner document + * @param localName - local name + * @param namespace - namespace + * @param prefix - namespace prefix */ -function element_setAnAttributeValue(element, localName, value, prefix, namespace) { - if (prefix === void 0) { prefix = null; } - if (namespace === void 0) { namespace = null; } - /** - * 1. If prefix is not given, set it to null. - * 2. If namespace is not given, set it to null. - * 3. Let attribute be the result of getting an attribute given namespace, - * localName, and element. - * 4. If attribute is null, create an attribute whose namespace is - * namespace, namespace prefix is prefix, local name is localName, value - * is value, and node document is element’s node document, then append this - * attribute to element, and then return. - * 5. Change attribute from element to value. - */ - var attribute = element_getAnAttributeByNamespaceAndLocalName(namespace || '', localName, element); - if (attribute === null) { - var newAttr = CreateAlgorithm_1.create_attr(element._nodeDocument, localName); - newAttr._namespace = namespace; - newAttr._namespacePrefix = prefix; - newAttr._value = value; - element_append(newAttr, element); - return; - } - element_change(attribute, element, value); +function create_htmlUnknownElement(document, localName, namespace, prefix) { + // TODO: Implement in HTML DOM + return ElementImpl_1.ElementImpl._create(document, localName, namespace, prefix); } -exports.element_setAnAttributeValue = element_setAnAttributeValue; +exports.create_htmlUnknownElement = create_htmlUnknownElement; /** - * Removes an attribute with the given name from an element node. + * Creates a new `DocumentFragment` node. * - * @param qualifiedName - an attribute name - * @param element - an element to receive the attribute + * @param document - owner document */ -function element_removeAnAttributeByName(qualifiedName, element) { - /** - * 1. Let attr be the result of getting an attribute given qualifiedName - * and element. - * 2. If attr is non-null, remove it from element. - * 3. Return attr. - */ - var attr = element_getAnAttributeByName(qualifiedName, element); - if (attr !== null) { - element_remove(attr, element); - } - return attr; +function create_documentFragment(document) { + return DocumentFragmentImpl_1.DocumentFragmentImpl._create(document); } -exports.element_removeAnAttributeByName = element_removeAnAttributeByName; +exports.create_documentFragment = create_documentFragment; /** - * Removes an attribute with the given namespace and local name from an - * element node. + * Creates a new `ShadowRoot` node. * - * @param namespace - an attribute namespace - * @param localName - an attribute local name - * @param element - an element to receive the attribute + * @param document - owner document + * @param host - shadow root's host element node */ -function element_removeAnAttributeByNamespaceAndLocalName(namespace, localName, element) { - /** - * 1. Let attr be the result of getting an attribute given namespace, localName, and element. - * 2. If attr is non-null, remove it from element. - * 3. Return attr. - */ - var attr = element_getAnAttributeByNamespaceAndLocalName(namespace, localName, element); - if (attr !== null) { - element_remove(attr, element); - } - return attr; +function create_shadowRoot(document, host) { + return ShadowRootImpl_1.ShadowRootImpl._create(document, host); } -exports.element_removeAnAttributeByNamespaceAndLocalName = element_removeAnAttributeByNamespaceAndLocalName; +exports.create_shadowRoot = create_shadowRoot; /** - * Creates an element node. - * See: https://dom.spec.whatwg.org/#concept-create-element. + * Creates a new `Attr` node. * - * @param document - the document owning the element + * @param document - owner document * @param localName - local name - * @param namespace - element namespace - * @param prefix - namespace prefix - * @param is - the "is" value - * @param synchronousCustomElementsFlag - synchronous custom elements flag */ -function element_createAnElement(document, localName, namespace, prefix, is, synchronousCustomElementsFlag) { - if (prefix === void 0) { prefix = null; } - if (is === void 0) { is = null; } - if (synchronousCustomElementsFlag === void 0) { synchronousCustomElementsFlag = false; } - /** - * 1. If prefix was not given, let prefix be null. - * 2. If is was not given, let is be null. - * 3. Let result be null. - */ - var result = null; - if (!DOMImpl_1.dom.features.customElements) { - result = CreateAlgorithm_1.create_element(document, localName, namespace, prefix); - result._customElementState = "uncustomized"; - result._customElementDefinition = null; - result._is = is; - return result; - } - /** - * 4. Let definition be the result of looking up a custom element definition - * given document, namespace, localName, and is. - */ - var definition = CustomElementAlgorithm_1.customElement_lookUpACustomElementDefinition(document, namespace, localName, is); - if (definition !== null && definition.name !== definition.localName) { - /** - * 5. If definition is non-null, and definition’s name is not equal to - * its local name (i.e., definition represents a customized built-in - * element), then: - * 5.1. Let interface be the element interface for localName and the HTML - * namespace. - * 5.2. Set result to a new element that implements interface, with no - * attributes, namespace set to the HTML namespace, namespace prefix - * set to prefix, local name set to localName, custom element state set - * to "undefined", custom element definition set to null, is value set - * to is, and node document set to document. - * 5.3. If the synchronous custom elements flag is set, upgrade element - * using definition. - * 5.4. Otherwise, enqueue a custom element upgrade reaction given result - * and definition. - */ - var elemenInterface = DocumentAlgorithm_1.document_elementInterface(localName, infra_1.namespace.HTML); - result = new elemenInterface(); - result._localName = localName; - result._namespace = infra_1.namespace.HTML; - result._namespacePrefix = prefix; - result._customElementState = "undefined"; - result._customElementDefinition = null; - result._is = is; - result._nodeDocument = document; - if (synchronousCustomElementsFlag) { - CustomElementAlgorithm_1.customElement_upgrade(definition, result); - } - else { - CustomElementAlgorithm_1.customElement_enqueueACustomElementUpgradeReaction(result, definition); - } - } - else if (definition !== null) { - /** - * 6. Otherwise, if definition is non-null, then: - */ - if (synchronousCustomElementsFlag) { - /** - * 6.1. If the synchronous custom elements flag is set, then run these - * steps while catching any exceptions: - */ - try { - /** - * 6.1.1. Let C be definition’s constructor. - * 6.1.2. Set result to the result of constructing C, with no arguments. - * 6.1.3. Assert: result’s custom element state and custom element definition - * are initialized. - * 6.1.4. Assert: result’s namespace is the HTML namespace. - * _Note:_ IDL enforces that result is an HTMLElement object, which all - * use the HTML namespace. - */ - var C = definition.constructor; - var result_1 = new C(); - console.assert(result_1._customElementState !== undefined); - console.assert(result_1._customElementDefinition !== undefined); - console.assert(result_1._namespace === infra_1.namespace.HTML); - /** - * 6.1.5. If result’s attribute list is not empty, then throw a - * "NotSupportedError" DOMException. - * 6.1.6. If result has children, then throw a "NotSupportedError" - * DOMException. - * 6.1.7. If result’s parent is not null, then throw a - * "NotSupportedError" DOMException. - * 6.1.8. If result’s node document is not document, then throw a - * "NotSupportedError" DOMException. - * 6.1.9. If result’s local name is not equal to localName, then throw - * a "NotSupportedError" DOMException. - */ - if (result_1._attributeList.length !== 0) - throw new DOMException_1.NotSupportedError("Custom element already has attributes."); - if (result_1._children.size !== 0) - throw new DOMException_1.NotSupportedError("Custom element already has child nodes."); - if (result_1._parent !== null) - throw new DOMException_1.NotSupportedError("Custom element already has a parent node."); - if (result_1._nodeDocument !== document) - throw new DOMException_1.NotSupportedError("Custom element is already in a document."); - if (result_1._localName !== localName) - throw new DOMException_1.NotSupportedError("Custom element has a different local name."); - /** - * 6.1.10. Set result’s namespace prefix to prefix. - * 6.1.11. Set result’s is value to null. - */ - result_1._namespacePrefix = prefix; - result_1._is = null; - } - catch (e) { - /** - * If any of these steps threw an exception, then: - * - Report the exception. - * - Set result to a new element that implements the HTMLUnknownElement - * interface, with no attributes, namespace set to the HTML namespace, - * namespace prefix set to prefix, local name set to localName, custom - * element state set to "failed", custom element definition set to null, - * is value set to null, and node document set to document. - */ - // TODO: Report the exception - result = CreateAlgorithm_1.create_htmlUnknownElement(document, localName, infra_1.namespace.HTML, prefix); - result._customElementState = "failed"; - result._customElementDefinition = null; - result._is = null; - } - } - else { - /** - * 6.2. Otherwise: - * 6.2.1. Set result to a new element that implements the HTMLElement - * interface, with no attributes, namespace set to the HTML namespace, - * namespace prefix set to prefix, local name set to localName, custom - * element state set to "undefined", custom element definition set to - * null, is value set to null, and node document set to document. - * 6.2.2. Enqueue a custom element upgrade reaction given result and - * definition. - */ - result = CreateAlgorithm_1.create_htmlElement(document, localName, infra_1.namespace.HTML, prefix); - result._customElementState = "undefined"; - result._customElementDefinition = null; - result._is = null; - CustomElementAlgorithm_1.customElement_enqueueACustomElementUpgradeReaction(result, definition); - } - } - else { - /** - * 7. Otherwise: - * 7.1. Let interface be the element interface for localName and - * namespace. - * 7.2. Set result to a new element that implements interface, with no - * attributes, namespace set to namespace, namespace prefix set to prefix, - * local name set to localName, custom element state set to - * "uncustomized", custom element definition set to null, is value set to - * is, and node document set to document. - */ - var elementInterface = DocumentAlgorithm_1.document_elementInterface(localName, namespace); - result = new elementInterface(); - result._localName = localName; - result._namespace = namespace; - result._namespacePrefix = prefix; - result._customElementState = "uncustomized"; - result._customElementDefinition = null; - result._is = is; - result._nodeDocument = document; - /** - * 7.3. If namespace is the HTML namespace, and either localName is a - * valid custom element name or is is non-null, then set result’s - * custom element state to "undefined". - */ - if (namespace === infra_1.namespace.HTML && (is !== null || - CustomElementAlgorithm_1.customElement_isValidCustomElementName(localName))) { - result._customElementState = "undefined"; - } - } - /* istanbul ignore next */ - if (result === null) { - throw new Error("Unable to create element."); - } - /** - * 8. Returns result - */ - return result; +function create_attr(document, localName) { + return AttrImpl_1.AttrImpl._create(document, localName); } -exports.element_createAnElement = element_createAnElement; +exports.create_attr = create_attr; /** - * Inserts a new node adjacent to this element. + * Creates a new `Text` node. * - * @param element - a reference element - * @param where - a string defining where to insert the element node. - * - `beforebegin` before this element itself. - * - `afterbegin` before the first child. - * - `beforeend` after the last child. - * - `afterend` after this element itself. - * @param node - node to insert + * @param document - owner document + * @param data - node contents */ -function element_insertAdjacent(element, where, node) { - /** - * - "beforebegin" - * If element’s parent is null, return null. - * Return the result of pre-inserting node into element’s parent before - * element. - * - "afterbegin" - * Return the result of pre-inserting node into element before element’s - * first child. - * - "beforeend" - * Return the result of pre-inserting node into element before null. - * - "afterend" - * If element’s parent is null, return null. - * Return the result of pre-inserting node into element’s parent before element’s next sibling. - * - Otherwise - * Throw a "SyntaxError" DOMException. - */ - switch (where.toLowerCase()) { - case 'beforebegin': - if (element._parent === null) - return null; - return MutationAlgorithm_1.mutation_preInsert(node, element._parent, element); - case 'afterbegin': - return MutationAlgorithm_1.mutation_preInsert(node, element, element._firstChild); - case 'beforeend': - return MutationAlgorithm_1.mutation_preInsert(node, element, null); - case 'afterend': - if (element._parent === null) - return null; - return MutationAlgorithm_1.mutation_preInsert(node, element._parent, element._nextSibling); - default: - throw new DOMException_1.SyntaxError("Invalid 'where' argument. \"beforebegin\", \"afterbegin\", \"beforeend\" or \"afterend\" expected"); - } +function create_text(document, data) { + return TextImpl_1.TextImpl._create(document, data); } -exports.element_insertAdjacent = element_insertAdjacent; -//# sourceMappingURL=ElementAlgorithm.js.map - -/***/ }), - -/***/ 8217: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var interfaces_1 = __nccwpck_require__(7305); -var util_1 = __nccwpck_require__(5282); -var CustomEventImpl_1 = __nccwpck_require__(9857); -var EventImpl_1 = __nccwpck_require__(8245); -var DOMException_1 = __nccwpck_require__(3166); -var TreeAlgorithm_1 = __nccwpck_require__(6620); -var ShadowTreeAlgorithm_1 = __nccwpck_require__(8733); -var DOMAlgorithm_1 = __nccwpck_require__(9628); +exports.create_text = create_text; /** - * Sets the canceled flag of an event. + * Creates a new `CDATASection` node. * - * @param event - an event + * @param document - owner document + * @param data - node contents */ -function event_setTheCanceledFlag(event) { - if (event._cancelable && !event._inPassiveListenerFlag) { - event._canceledFlag = true; - } +function create_cdataSection(document, data) { + return CDATASectionImpl_1.CDATASectionImpl._create(document, data); } -exports.event_setTheCanceledFlag = event_setTheCanceledFlag; +exports.create_cdataSection = create_cdataSection; /** - * Initializes the value of an event. + * Creates a new `Comment` node. * - * @param event - an event to initialize - * @param type - the type of event - * @param bubbles - whether the event propagates in reverse - * @param cancelable - whether the event can be cancelled + * @param document - owner document + * @param data - node contents */ -function event_initialize(event, type, bubbles, cancelable) { - event._initializedFlag = true; - event._stopPropagationFlag = false; - event._stopImmediatePropagationFlag = false; - event._canceledFlag = false; - event._isTrusted = false; - event._target = null; - event._type = type; - event._bubbles = bubbles; - event._cancelable = cancelable; +function create_comment(document, data) { + return CommentImpl_1.CommentImpl._create(document, data); } -exports.event_initialize = event_initialize; +exports.create_comment = create_comment; /** - * Creates a new event. + * Creates a new `ProcessingInstruction` node. * - * @param eventInterface - event interface - * @param realm - realm + * @param document - owner document + * @param target - instruction target + * @param data - node contents */ -function event_createAnEvent(eventInterface, realm) { - if (realm === void 0) { realm = undefined; } - /** - * 1. If realm is not given, then set it to null. - * 2. Let dictionary be the result of converting the JavaScript value - * undefined to the dictionary type accepted by eventInterface’s - * constructor. (This dictionary type will either be EventInit or a - * dictionary that inherits from it.) - * 3. Let event be the result of running the inner event creation steps with - * eventInterface, realm, the time of the occurrence that the event is - * signaling, and dictionary. - * 4. Initialize event’s isTrusted attribute to true. - * 5. Return event. - */ - if (realm === undefined) - realm = null; - var dictionary = {}; - var event = event_innerEventCreationSteps(eventInterface, realm, new Date(), dictionary); - event._isTrusted = true; - return event; +function create_processingInstruction(document, target, data) { + return ProcessingInstructionImpl_1.ProcessingInstructionImpl._create(document, target, data); } -exports.event_createAnEvent = event_createAnEvent; +exports.create_processingInstruction = create_processingInstruction; /** - * Performs event creation steps. + * Creates a new `HTMLCollection`. * - * @param eventInterface - event interface - * @param realm - realm - * @param time - time of occurrance - * @param dictionary - event attributes + * @param root - root node + * @param filter - node filter + */ +function create_htmlCollection(root, filter) { + if (filter === void 0) { filter = (function () { return true; }); } + return HTMLCollectionImpl_1.HTMLCollectionImpl._create(root, filter); +} +exports.create_htmlCollection = create_htmlCollection; +/** + * Creates a new live `NodeList`. * + * @param root - root node */ -function event_innerEventCreationSteps(eventInterface, realm, time, dictionary) { - /** - * 1. Let event be the result of creating a new object using eventInterface. - * TODO: Implement realms - * If realm is non-null, then use that Realm; otherwise, use the default - * behavior defined in Web IDL. - */ - var event = new eventInterface(""); - /** - * 2. Set event’s initialized flag. - * 3. Initialize event’s timeStamp attribute to a DOMHighResTimeStamp - * representing the high resolution time from the time origin to time. - * 4. For each member → value in dictionary, if event has an attribute - * whose identifier is member, then initialize that attribute to value. - * 5. Run the event constructing steps with event. - * 6. Return event. - */ - event._initializedFlag = true; - event._timeStamp = time.getTime(); - Object.assign(event, dictionary); - if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runEventConstructingSteps(event); - } - return event; +function create_nodeList(root) { + return NodeListImpl_1.NodeListImpl._create(root); } -exports.event_innerEventCreationSteps = event_innerEventCreationSteps; +exports.create_nodeList = create_nodeList; /** - * Dispatches an event to an event target. + * Creates a new static `NodeList`. * - * @param event - the event to dispatch - * @param target - event target - * @param legacyTargetOverrideFlag - legacy target override flag - * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns - * whether the event listener's callback threw an exception + * @param root - root node + * @param items - a list of items to initialize the list */ -function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDidListenersThrowFlag) { - var e_1, _a, e_2, _b; - if (legacyTargetOverrideFlag === void 0) { legacyTargetOverrideFlag = false; } - if (legacyOutputDidListenersThrowFlag === void 0) { legacyOutputDidListenersThrowFlag = { value: false }; } - var clearTargets = false; - /** - * 1. Set event's dispatch flag. - */ - event._dispatchFlag = true; - /** - * 2. Let targetOverride be target, if legacy target override flag is not - * given, and target's associated Document otherwise. - * - * _Note:_ legacy target override flag is only used by HTML and only when - * target is a Window object. - */ - var targetOverride = target; - if (legacyTargetOverrideFlag) { - var doc = target._associatedDocument; - if (util_1.Guard.isDocumentNode(doc)) { - targetOverride = doc; - } - } - /** - * 3. Let activationTarget be null. - * 4. Let relatedTarget be the result of retargeting event's relatedTarget - * against target. - * 5. If target is not relatedTarget or target is event's relatedTarget, - * then: - */ - var activationTarget = null; - var relatedTarget = TreeAlgorithm_1.tree_retarget(event._relatedTarget, target); - if (target !== relatedTarget || target === event._relatedTarget) { - /** - * 5.1. Let touchTargets be a new list. - * 5.2. For each touchTarget of event's touch target list, append the - * result of retargeting touchTarget against target to touchTargets. - * 5.3. Append to an event path with event, target, targetOverride, - * relatedTarget, touchTargets, and false. - * 5.4. Let isActivationEvent be true, if event is a MouseEvent object - * and event's type attribute is "click", and false otherwise. - * 5.5. If isActivationEvent is true and target has activation behavior, - * then set activationTarget to target. - * 5.6. Let slotable be target, if target is a slotable and is assigned, - * and null otherwise. - * 5.7. Let slot-in-closed-tree be false. - * 5.8. Let parent be the result of invoking target's get the parent with - * event. - */ - var touchTargets = []; - try { - for (var _c = __values(event._touchTargetList), _d = _c.next(); !_d.done; _d = _c.next()) { - var touchTarget = _d.value; - touchTargets.push(TreeAlgorithm_1.tree_retarget(touchTarget, target)); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); - } - finally { if (e_1) throw e_1.error; } - } - event_appendToAnEventPath(event, target, targetOverride, relatedTarget, touchTargets, false); - var isActivationEvent = (util_1.Guard.isMouseEvent(event) && event._type === "click"); - if (isActivationEvent && target._activationBehavior !== undefined) { - activationTarget = target; - } - var slotable = (util_1.Guard.isSlotable(target) && ShadowTreeAlgorithm_1.shadowTree_isAssigned(target)) ? - target : null; - var slotInClosedTree = false; - var parent = target._getTheParent(event); - /** - * 5.9. While parent is non-null: - */ - while (parent !== null && util_1.Guard.isNode(parent)) { - /** - * 5.9.1 If slotable is non-null: - * 5.9.1.1. Assert: parent is a slot. - * 5.9.1.2. Set slotable to null. - * 5.9.1.3. If parent's root is a shadow root whose mode is "closed", - * then set slot-in-closed-tree to true. - */ - if (slotable !== null) { - if (!util_1.Guard.isSlot(parent)) { - throw new Error("Parent node of a slotable should be a slot."); - } - slotable = null; - var root = TreeAlgorithm_1.tree_rootNode(parent, true); - if (util_1.Guard.isShadowRoot(root) && root._mode === "closed") { - slotInClosedTree = true; - } - } - /** - * 5.9.2 If parent is a slotable and is assigned, then set slotable to - * parent. - * 5.9.3. Let relatedTarget be the result of retargeting event's - * relatedTarget against parent. - * 5.9.4. Let touchTargets be a new list. - * 5.9.4. For each touchTarget of event's touch target list, append the - * result of retargeting touchTarget against parent to touchTargets. - */ - if (util_1.Guard.isSlotable(parent) && ShadowTreeAlgorithm_1.shadowTree_isAssigned(parent)) { - slotable = parent; - } - relatedTarget = TreeAlgorithm_1.tree_retarget(event._relatedTarget, parent); - touchTargets = []; - try { - for (var _e = (e_2 = void 0, __values(event._touchTargetList)), _f = _e.next(); !_f.done; _f = _e.next()) { - var touchTarget = _f.value; - touchTargets.push(TreeAlgorithm_1.tree_retarget(touchTarget, parent)); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_f && !_f.done && (_b = _e.return)) _b.call(_e); - } - finally { if (e_2) throw e_2.error; } - } - /** - * 5.9.6. If parent is a Window object, or parent is a node and target's - * root is a shadow-including inclusive ancestor of parent, then: - */ - if (util_1.Guard.isWindow(parent) || (util_1.Guard.isNode(parent) && util_1.Guard.isNode(target) && - TreeAlgorithm_1.tree_isAncestorOf(TreeAlgorithm_1.tree_rootNode(target, true), parent, true, true))) { - /** - * 5.9.6.1. If isActivationEvent is true, event's bubbles attribute - * is true, activationTarget is null, and parent has activation - * behavior, then set activationTarget to parent. - * 5.9.6.2. Append to an event path with event, parent, null, - * relatedTarget, touchTargets, and slot-in-closed-tree. - */ - if (isActivationEvent && event._bubbles && activationTarget === null && - parent._activationBehavior) { - activationTarget = parent; - } - event_appendToAnEventPath(event, parent, null, relatedTarget, touchTargets, slotInClosedTree); - } - else if (parent === relatedTarget) { - /** - * 5.9.7. Otherwise, if parent is relatedTarget, - * then set parent to null. - */ - parent = null; - } - else { - /** - * 5.9.8. Otherwise, set target to parent and then: - * 5.9.8.1. If isActivationEvent is true, activationTarget is null, - * and target has activation behavior, then set activationTarget - * to target. - * 5.9.8.2. Append to an event path with event, parent, target, - * relatedTarget, touchTargets, and slot-in-closed-tree. - */ - target = parent; - if (isActivationEvent && activationTarget === null && - target._activationBehavior) { - activationTarget = target; - } - event_appendToAnEventPath(event, parent, target, relatedTarget, touchTargets, slotInClosedTree); - } - /** - * 5.9.9. If parent is non-null, then set parent to the result of - * invoking parent's get the parent with event. - * 5.9.10. Set slot-in-closed-tree to false. - */ - if (parent !== null) { - parent = parent._getTheParent(event); - } - slotInClosedTree = false; - } - /** - * 5.10. Let clearTargetsStruct be the last struct in event's path whose - * shadow-adjusted target is non-null. - */ - var clearTargetsStruct = null; - var path = event._path; - for (var i = path.length - 1; i >= 0; i--) { - var struct = path[i]; - if (struct.shadowAdjustedTarget !== null) { - clearTargetsStruct = struct; - break; - } - } - /** - * 5.11. Let clearTargets be true if clearTargetsStruct's shadow-adjusted - * target, clearTargetsStruct's relatedTarget, or an EventTarget object - * in clearTargetsStruct's touch target list is a node and its root is - * a shadow root, and false otherwise. - */ - if (clearTargetsStruct !== null) { - if (util_1.Guard.isNode(clearTargetsStruct.shadowAdjustedTarget) && - util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(clearTargetsStruct.shadowAdjustedTarget, true))) { - clearTargets = true; - } - else if (util_1.Guard.isNode(clearTargetsStruct.relatedTarget) && - util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(clearTargetsStruct.relatedTarget, true))) { - clearTargets = true; - } - else { - for (var j = 0; j < clearTargetsStruct.touchTargetList.length; j++) { - var struct = clearTargetsStruct.touchTargetList[j]; - if (util_1.Guard.isNode(struct) && - util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(struct, true))) { - clearTargets = true; - break; - } - } - } - } - /** - * 5.12. If activationTarget is non-null and activationTarget has - * legacy-pre-activation behavior, then run activationTarget's - * legacy-pre-activation behavior. - */ - if (activationTarget !== null && - activationTarget._legacyPreActivationBehavior !== undefined) { - activationTarget._legacyPreActivationBehavior(event); - } - /** - * 5.13. For each struct in event's path, in reverse order: - */ - for (var i = path.length - 1; i >= 0; i--) { - var struct = path[i]; - /** - * 5.13.1. If struct's shadow-adjusted target is non-null, then set - * event's eventPhase attribute to AT_TARGET. - * 5.13.2. Otherwise, set event's eventPhase attribute to - * CAPTURING_PHASE. - * 5.13.3. Invoke with struct, event, "capturing", and - * legacyOutputDidListenersThrowFlag if given. - */ - if (struct.shadowAdjustedTarget !== null) { - event._eventPhase = interfaces_1.EventPhase.AtTarget; - } - else { - event._eventPhase = interfaces_1.EventPhase.Capturing; - } - event_invoke(struct, event, "capturing", legacyOutputDidListenersThrowFlag); - } - /** - * 5.14. For each struct in event's path - */ - for (var i = 0; i < path.length; i++) { - var struct = path[i]; - /** - * 5.14.1. If struct's shadow-adjusted target is non-null, then set - * event's eventPhase attribute to AT_TARGET. - * 5.14.2. Otherwise: - * 5.14.2.1. If event's bubbles attribute is false, then continue. - * 5.14.2.2. Set event's eventPhase attribute to BUBBLING_PHASE. - * 5.14.3. Invoke with struct, event, "bubbling", and - * legacyOutputDidListenersThrowFlag if given. - */ - if (struct.shadowAdjustedTarget !== null) { - event._eventPhase = interfaces_1.EventPhase.AtTarget; - } - else { - if (!event._bubbles) - continue; - event._eventPhase = interfaces_1.EventPhase.Bubbling; - } - event_invoke(struct, event, "bubbling", legacyOutputDidListenersThrowFlag); - } - } - /** - * 6. Set event's eventPhase attribute to NONE. - * 7. Set event's currentTarget attribute to null. - * 8. Set event's path to the empty list. - * 9. Unset event's dispatch flag, stop propagation flag, and stop - * immediate propagation flag. - */ - event._eventPhase = interfaces_1.EventPhase.None; - event._currentTarget = null; - event._path = []; - event._dispatchFlag = false; - event._stopPropagationFlag = false; - event._stopImmediatePropagationFlag = false; - /** - * 10. If clearTargets, then: - * 10.1. Set event's target to null. - * 10.2. Set event's relatedTarget to null. - * 10.3. Set event's touch target list to the empty list. - */ - if (clearTargets) { - event._target = null; - event._relatedTarget = null; - event._touchTargetList = []; - } - /** - * 11. If activationTarget is non-null, then: - * 11.1. If event's canceled flag is unset, then run activationTarget's - * activation behavior with event. - * 11.2. Otherwise, if activationTarget has legacy-canceled-activation - * behavior, then run activationTarget's legacy-canceled-activation - * behavior. - */ - if (activationTarget !== null) { - if (!event._canceledFlag && activationTarget._activationBehavior !== undefined) { - activationTarget._activationBehavior(event); - } - else if (activationTarget._legacyCanceledActivationBehavior !== undefined) { - activationTarget._legacyCanceledActivationBehavior(event); - } - } - /** - * 12. Return false if event's canceled flag is set, and true otherwise. - */ - return !event._canceledFlag; +function create_nodeListStatic(root, items) { + return NodeListStaticImpl_1.NodeListStaticImpl._create(root, items); } -exports.event_dispatch = event_dispatch; +exports.create_nodeListStatic = create_nodeListStatic; /** - * Appends a new struct to an event's path. + * Creates a new `NamedNodeMap`. * - * @param event - an event - * @param invocationTarget - the target of the invocation - * @param shadowAdjustedTarget - shadow-root adjusted event target - * @param relatedTarget - related event target - * @param touchTargets - a list of touch targets - * @param slotInClosedTree - if the target's parent is a closed shadow root + * @param element - parent element */ -function event_appendToAnEventPath(event, invocationTarget, shadowAdjustedTarget, relatedTarget, touchTargets, slotInClosedTree) { - /** - * 1. Let invocationTargetInShadowTree be false. - * 2. If invocationTarget is a node and its root is a shadow root, then - * set invocationTargetInShadowTree to true. - */ - var invocationTargetInShadowTree = false; - if (util_1.Guard.isNode(invocationTarget) && - util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(invocationTarget))) { - invocationTargetInShadowTree = true; - } - /** - * 3. Let root-of-closed-tree be false. - * 4. If invocationTarget is a shadow root whose mode is "closed", then - * set root-of-closed-tree to true. - */ - var rootOfClosedTree = false; - if (util_1.Guard.isShadowRoot(invocationTarget) && - invocationTarget._mode === "closed") { - rootOfClosedTree = true; - } - /** - * 5. Append a new struct to event's path whose invocation target is - * invocationTarget, invocation-target-in-shadow-tree is - * invocationTargetInShadowTree, shadow-adjusted target is - * shadowAdjustedTarget, relatedTarget is relatedTarget, - * touch target list is touchTargets, root-of-closed-tree is - * root-of-closed-tree, and slot-in-closed-tree is slot-in-closed-tree. - */ - event._path.push({ - invocationTarget: invocationTarget, - invocationTargetInShadowTree: invocationTargetInShadowTree, - shadowAdjustedTarget: shadowAdjustedTarget, - relatedTarget: relatedTarget, - touchTargetList: touchTargets, - rootOfClosedTree: rootOfClosedTree, - slotInClosedTree: slotInClosedTree - }); +function create_namedNodeMap(element) { + return NamedNodeMapImpl_1.NamedNodeMapImpl._create(element); } -exports.event_appendToAnEventPath = event_appendToAnEventPath; +exports.create_namedNodeMap = create_namedNodeMap; /** - * Invokes an event. + * Creates a new `Range`. * - * @param struct - a struct defining event's path - * @param event - the event to invoke - * @param phase - event phase - * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns - * whether the event listener's callback threw an exception + * @param start - start point + * @param end - end point */ -function event_invoke(struct, event, phase, legacyOutputDidListenersThrowFlag) { - if (legacyOutputDidListenersThrowFlag === void 0) { legacyOutputDidListenersThrowFlag = { value: false }; } - /** - * 1. Set event's target to the shadow-adjusted target of the last struct - * in event's path, that is either struct or preceding struct, whose - * shadow-adjusted target is non-null. - */ - var path = event._path; - var index = -1; - for (var i = 0; i < path.length; i++) { - if (path[i] === struct) { - index = i; - break; - } - } - if (index !== -1) { - var item = path[index]; - if (item.shadowAdjustedTarget !== null) { - event._target = item.shadowAdjustedTarget; - } - else if (index > 0) { - item = path[index - 1]; - if (item.shadowAdjustedTarget !== null) { - event._target = item.shadowAdjustedTarget; - } - } - } - /** - * 2. Set event's relatedTarget to struct's relatedTarget. - * 3. Set event's touch target list to struct's touch target list. - * 4. If event's stop propagation flag is set, then return. - * 5. Initialize event's currentTarget attribute to struct's invocation - * target. - * 6. Let listeners be a clone of event's currentTarget attribute value's - * event listener list. - * - * _Note:_ This avoids event listeners added after this point from being - * run. Note that removal still has an effect due to the removed field. - */ - event._relatedTarget = struct.relatedTarget; - event._touchTargetList = struct.touchTargetList; - if (event._stopPropagationFlag) - return; - event._currentTarget = struct.invocationTarget; - var currentTarget = event._currentTarget; - var targetListeners = currentTarget._eventListenerList; - var listeners = new (Array.bind.apply(Array, __spread([void 0], targetListeners)))(); - /** - * 7. Let found be the result of running inner invoke with event, listeners, - * phase, and legacyOutputDidListenersThrowFlag if given. - */ - var found = event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListenersThrowFlag); - /** - * 8. If found is false and event's isTrusted attribute is true, then: - */ - if (!found && event._isTrusted) { - /** - * 8.1. Let originalEventType be event's type attribute value. - * 8.2. If event's type attribute value is a match for any of the strings - * in the first column in the following table, set event's type attribute - * value to the string in the second column on the same row as the matching - * string, and return otherwise. - * - * Event type | Legacy event type - * ------------------------------------------------- - * "animationend" | "webkitAnimationEnd" - * "animationiteration" | "webkitAnimationIteration" - * "animationstart" | "webkitAnimationStart" - * "transitionend" | "webkitTransitionEnd" - */ - var originalEventType = event._type; - if (originalEventType === "animationend") { - event._type = "webkitAnimationEnd"; - } - else if (originalEventType === "animationiteration") { - event._type = "webkitAnimationIteration"; - } - else if (originalEventType === "animationstart") { - event._type = "webkitAnimationStart"; - } - else if (originalEventType === "transitionend") { - event._type = "webkitTransitionEnd"; - } - /** - * 8.3. Inner invoke with event, listeners, phase, and - * legacyOutputDidListenersThrowFlag if given. - * 8.4. Set event's type attribute value to originalEventType. - */ - event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListenersThrowFlag); - event._type = originalEventType; - } +function create_range(start, end) { + return RangeImpl_1.RangeImpl._create(start, end); } -exports.event_invoke = event_invoke; +exports.create_range = create_range; /** - * Invokes an event. + * Creates a new `NodeIterator`. * - * @param event - the event to invoke - * @param listeners - event listeners - * @param phase - event phase - * @param struct - a struct defining event's path - * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns - * whether the event listener's callback threw an exception + * @param root - iterator's root node + * @param reference - reference node + * @param pointerBeforeReference - whether the iterator is before or after the + * reference node */ -function event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListenersThrowFlag) { - if (legacyOutputDidListenersThrowFlag === void 0) { legacyOutputDidListenersThrowFlag = { value: false }; } - /** - * 1. Let found be false. - * 2. For each listener in listeners, whose removed is false: - */ - var found = false; - for (var i = 0; i < listeners.length; i++) { - var listener = listeners[i]; - if (!listener.removed) { - /** - * 2.1. If event's type attribute value is not listener's type, then - * continue. - * 2.2. Set found to true. - * 2.3. If phase is "capturing" and listener's capture is false, then - * continue. - * 2.4. If phase is "bubbling" and listener's capture is true, then - * continue. - */ - if (event._type !== listener.type) - continue; - found = true; - if (phase === "capturing" && !listener.capture) - continue; - if (phase === "bubbling" && listener.capture) - continue; - /** - * 2.5. If listener's once is true, then remove listener from event's - * currentTarget attribute value's event listener list. - */ - if (listener.once && event._currentTarget !== null) { - var impl = event._currentTarget; - var index = -1; - for (var i_1 = 0; i_1 < impl._eventListenerList.length; i_1++) { - if (impl._eventListenerList[i_1] === listener) { - index = i_1; - break; - } - } - if (index !== -1) { - impl._eventListenerList.splice(index, 1); - } - } - /** - * TODO: Implement realms - * - * 2.6. Let global be listener callback's associated Realm's global - * object. - */ - var globalObject = undefined; - /** - * 2.7. Let currentEvent be undefined. - * 2.8. If global is a Window object, then: - * 2.8.1. Set currentEvent to global's current event. - * 2.8.2. If struct's invocation-target-in-shadow-tree is false, then - * set global's current event to event. - */ - var currentEvent = undefined; - if (util_1.Guard.isWindow(globalObject)) { - currentEvent = globalObject._currentEvent; - if (struct.invocationTargetInShadowTree === false) { - globalObject._currentEvent = event; - } - } - /** - * 2.9. If listener's passive is true, then set event's in passive - * listener flag. - * 2.10. Call a user object's operation with listener's callback, - * "handleEvent", « event », and event's currentTarget attribute value. - */ - if (listener.passive) - event._inPassiveListenerFlag = true; - try { - listener.callback.handleEvent.call(event._currentTarget, event); - } - catch (err) { - /** - * If this throws an exception, then: - * 2.10.1. Report the exception. - * 2.10.2. Set legacyOutputDidListenersThrowFlag if given. - * - * _Note:_ The legacyOutputDidListenersThrowFlag is only used by - * Indexed Database API. - * TODO: Report the exception - * See: https://html.spec.whatwg.org/multipage/webappapis.html#runtime-script-errors-in-documents - */ - legacyOutputDidListenersThrowFlag.value = true; - } - /** - * 2.11. Unset event's in passive listener flag. - */ - if (listener.passive) - event._inPassiveListenerFlag = false; - /** - * 2.12. If global is a Window object, then set global's current event - * to currentEvent. - */ - if (util_1.Guard.isWindow(globalObject)) { - globalObject._currentEvent = currentEvent; - } - /** - * 2.13. If event's stop immediate propagation flag is set, then return - * found. - */ - if (event._stopImmediatePropagationFlag) - return found; - } - } - /** - * 3. Return found. - */ - return found; +function create_nodeIterator(root, reference, pointerBeforeReference) { + return NodeIteratorImpl_1.NodeIteratorImpl._create(root, reference, pointerBeforeReference); } -exports.event_innerInvoke = event_innerInvoke; +exports.create_nodeIterator = create_nodeIterator; /** - * Fires an event at target. - * @param e - event name - * @param target - event target - * @param eventConstructor - an event constructor, with a description of how - * IDL attributes are to be initialized - * @param idlAttributes - a dictionary describing how IDL attributes are - * to be initialized - * @param legacyTargetOverrideFlag - legacy target override flag + * Creates a new `TreeWalker`. + * + * @param root - iterator's root node + * @param current - current node */ -function event_fireAnEvent(e, target, eventConstructor, idlAttributes, legacyTargetOverrideFlag) { - /** - * 1. If eventConstructor is not given, then let eventConstructor be Event. - */ - if (eventConstructor === undefined) { - eventConstructor = EventImpl_1.EventImpl; - } - /** - * 2. Let event be the result of creating an event given eventConstructor, - * in the relevant Realm of target. - */ - var event = event_createAnEvent(eventConstructor); - /** - * 3. Initialize event’s type attribute to e. - */ - event._type = e; - /** - * 4. Initialize any other IDL attributes of event as described in the - * invocation of this algorithm. - * _Note:_ This also allows for the isTrusted attribute to be set to false. - */ - if (idlAttributes) { - for (var key in idlAttributes) { - var idlObj = event; - idlObj[key] = idlAttributes[key]; - } - } - /** - * 5. Return the result of dispatching event at target, with legacy target - * override flag set if set. - */ - return event_dispatch(event, target, legacyTargetOverrideFlag); +function create_treeWalker(root, current) { + return TreeWalkerImpl_1.TreeWalkerImpl._create(root, current); } -exports.event_fireAnEvent = event_fireAnEvent; +exports.create_treeWalker = create_treeWalker; /** - * Creates an event. + * Creates a new `NodeFilter`. + */ +function create_nodeFilter() { + return NodeFilterImpl_1.NodeFilterImpl._create(); +} +exports.create_nodeFilter = create_nodeFilter; +/** + * Creates a new `MutationRecord`. * - * @param eventInterface - the name of the event interface + * @param type - type of mutation: `"attributes"` for an attribute + * mutation, `"characterData"` for a mutation to a CharacterData node + * and `"childList"` for a mutation to the tree of nodes. + * @param target - node affected by the mutation. + * @param addedNodes - list of added nodes. + * @param removedNodes - list of removed nodes. + * @param previousSibling - previous sibling of added or removed nodes. + * @param nextSibling - next sibling of added or removed nodes. + * @param attributeName - local name of the changed attribute, + * and `null` otherwise. + * @param attributeNamespace - namespace of the changed attribute, + * and `null` otherwise. + * @param oldValue - value before mutation: attribute value for an attribute + * mutation, node `data` for a mutation to a CharacterData node and `null` + * for a mutation to the tree of nodes. */ -function event_createLegacyEvent(eventInterface) { - /** - * 1. Let constructor be null. - */ - var constructor = null; - /** - * TODO: Implement in HTML DOM - * 2. If interface is an ASCII case-insensitive match for any of the strings - * in the first column in the following table, then set constructor to the - * interface in the second column on the same row as the matching string: - * - * String | Interface - * -------|---------- - * "beforeunloadevent" | BeforeUnloadEvent - * "compositionevent" | CompositionEvent - * "customevent" | CustomEvent - * "devicemotionevent" | DeviceMotionEvent - * "deviceorientationevent" | DeviceOrientationEvent - * "dragevent" | DragEvent - * "event" | Event - * "events" | Event - * "focusevent" | FocusEvent - * "hashchangeevent" | HashChangeEvent - * "htmlevents" | Event - * "keyboardevent" | KeyboardEvent - * "messageevent" | MessageEvent - * "mouseevent" | MouseEvent - * "mouseevents" | - * "storageevent" | StorageEvent - * "svgevents" | Event - * "textevent" | CompositionEvent - * "touchevent" | TouchEvent - * "uievent" | UIEvent - * "uievents" | UIEvent - */ - switch (eventInterface.toLowerCase()) { - case "beforeunloadevent": - break; - case "compositionevent": - break; - case "customevent": - constructor = CustomEventImpl_1.CustomEventImpl; - break; - case "devicemotionevent": - break; - case "deviceorientationevent": - break; - case "dragevent": - break; - case "event": - case "events": - constructor = EventImpl_1.EventImpl; - break; - case "focusevent": - break; - case "hashchangeevent": - break; - case "htmlevents": - break; - case "keyboardevent": - break; - case "messageevent": - break; - case "mouseevent": - break; - case "mouseevents": - break; - case "storageevent": - break; - case "svgevents": - break; - case "textevent": - break; - case "touchevent": - break; - case "uievent": - break; - case "uievents": - break; - } - /** - * 3. If constructor is null, then throw a "NotSupportedError" DOMException. - */ - if (constructor === null) { - throw new DOMException_1.NotSupportedError("Event constructor not found for interface " + eventInterface + "."); - } - /** - * 4. If the interface indicated by constructor is not exposed on the - * relevant global object of the context object, then throw a - * "NotSupportedError" DOMException. - * _Note:_ Typically user agents disable support for touch events in some - * configurations, in which case this clause would be triggered for the - * interface TouchEvent. - */ - // TODO: Implement realms - /** - * 5. Let event be the result of creating an event given constructor. - * 6. Initialize event’s type attribute to the empty string. - * 7. Initialize event’s timeStamp attribute to a DOMHighResTimeStamp - * representing the high resolution time from the time origin to now. - * 8. Initialize event’s isTrusted attribute to false. - * 9. Unset event’s initialized flag. - */ - var event = new constructor(""); - event._type = ""; - event._timeStamp = new Date().getTime(); - event._isTrusted = false; - event._initializedFlag = false; - /** - * 10. Return event. - */ - return event; +function create_mutationRecord(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { + return MutationRecordImpl_1.MutationRecordImpl._create(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue); } -exports.event_createLegacyEvent = event_createLegacyEvent; +exports.create_mutationRecord = create_mutationRecord; /** - * Getter of an event handler IDL attribute. + * Creates a new `DOMTokenList`. * - * @param eventTarget - event target - * @param name - event name + * @param element - associated element + * @param attribute - associated attribute */ -function event_getterEventHandlerIDLAttribute(thisObj, name) { - /** - * 1. Let eventTarget be the result of determining the target of an event - * handler given this object and name. - * 2. If eventTarget is null, then return null. - * 3. Return the result of getting the current value of the event handler - * given eventTarget and name. - */ - var eventTarget = event_determineTheTargetOfAnEventHandler(thisObj, name); - if (eventTarget === null) - return null; - return event_getTheCurrentValueOfAnEventHandler(eventTarget, name); +function create_domTokenList(element, attribute) { + return DOMTokenListImpl_1.DOMTokenListImpl._create(element, attribute); } -exports.event_getterEventHandlerIDLAttribute = event_getterEventHandlerIDLAttribute; +exports.create_domTokenList = create_domTokenList; +//# sourceMappingURL=CreateAlgorithm.js.map + +/***/ }), + +/***/ 35648: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var PotentialCustomElementName = /[a-z]([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*-([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*/; +var NamesWithHyphen = new Set(['annotation-xml', 'color-profile', + 'font-face', 'font-face-src', 'font-face-uri', 'font-face-format', + 'font-face-name', 'missing-glyph']); +var ElementNames = new Set(['article', 'aside', 'blockquote', + 'body', 'div', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', + 'header', 'main', 'nav', 'p', 'section', 'span']); +var VoidElementNames = new Set(['area', 'base', 'basefont', + 'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen', + 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']); +var ShadowHostNames = new Set(['article', 'aside', 'blockquote', 'body', + 'div', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'main', + 'nav', 'p', 'section', 'span']); /** - * Setter of an event handler IDL attribute. + * Determines if the given string is a valid custom element name. * - * @param eventTarget - event target - * @param name - event name - * @param value - event handler + * @param name - a name string */ -function event_setterEventHandlerIDLAttribute(thisObj, name, value) { - /** - * 1. Let eventTarget be the result of determining the target of an event - * handler given this object and name. - * 2. If eventTarget is null, then return. - * 3. If the given value is null, then deactivate an event handler given - * eventTarget and name. - * 4. Otherwise: - * 4.1. Let handlerMap be eventTarget's event handler map. - * 4.2. Let eventHandler be handlerMap[name]. - * 4.3. Set eventHandler's value to the given value. - * 4.4. Activate an event handler given eventTarget and name. - */ - var eventTarget = event_determineTheTargetOfAnEventHandler(thisObj, name); - if (eventTarget === null) - return; - if (value === null) { - event_deactivateAnEventHandler(eventTarget, name); - } - else { - var handlerMap = eventTarget._eventHandlerMap; - var eventHandler = handlerMap["onabort"]; - if (eventHandler !== undefined) { - eventHandler.value = value; - } - event_activateAnEventHandler(eventTarget, name); - } +function customElement_isValidCustomElementName(name) { + if (!PotentialCustomElementName.test(name)) + return false; + if (NamesWithHyphen.has(name)) + return false; + return true; } -exports.event_setterEventHandlerIDLAttribute = event_setterEventHandlerIDLAttribute; +exports.customElement_isValidCustomElementName = customElement_isValidCustomElementName; /** - * Determines the target of an event handler. + * Determines if the given string is a valid element name. * - * @param eventTarget - event target - * @param name - event name + * @param name - a name string */ -function event_determineTheTargetOfAnEventHandler(eventTarget, name) { +function customElement_isValidElementName(name) { + return (ElementNames.has(name)); +} +exports.customElement_isValidElementName = customElement_isValidElementName; +/** + * Determines if the given string is a void element name. + * + * @param name - a name string + */ +function customElement_isVoidElementName(name) { + return (VoidElementNames.has(name)); +} +exports.customElement_isVoidElementName = customElement_isVoidElementName; +/** + * Determines if the given string is a valid shadow host element name. + * + * @param name - a name string + */ +function customElement_isValidShadowHostName(name) { + return (ShadowHostNames.has(name)); +} +exports.customElement_isValidShadowHostName = customElement_isValidShadowHostName; +/** + * Enqueues an upgrade reaction for a custom element. + * + * @param element - a custom element + * @param definition - a custom element definition + */ +function customElement_enqueueACustomElementUpgradeReaction(element, definition) { // TODO: Implement in HTML DOM - return null; } -exports.event_determineTheTargetOfAnEventHandler = event_determineTheTargetOfAnEventHandler; +exports.customElement_enqueueACustomElementUpgradeReaction = customElement_enqueueACustomElementUpgradeReaction; /** - * Gets the current value of an event handler. + * Enqueues a callback reaction for a custom element. * - * @param eventTarget - event target - * @param name - event name + * @param element - a custom element + * @param callbackName - name of the callback + * @param args - callback arguments */ -function event_getTheCurrentValueOfAnEventHandler(eventTarget, name) { +function customElement_enqueueACustomElementCallbackReaction(element, callbackName, args) { // TODO: Implement in HTML DOM - return null; } -exports.event_getTheCurrentValueOfAnEventHandler = event_getTheCurrentValueOfAnEventHandler; +exports.customElement_enqueueACustomElementCallbackReaction = customElement_enqueueACustomElementCallbackReaction; /** - * Activates an event handler. + * Upgrade a custom element. * - * @param eventTarget - event target - * @param name - event name + * @param element - a custom element */ -function event_activateAnEventHandler(eventTarget, name) { +function customElement_upgrade(definition, element) { // TODO: Implement in HTML DOM } -exports.event_activateAnEventHandler = event_activateAnEventHandler; +exports.customElement_upgrade = customElement_upgrade; /** - * Deactivates an event handler. + * Tries to upgrade a custom element. * - * @param eventTarget - event target - * @param name - event name + * @param element - a custom element */ -function event_deactivateAnEventHandler(eventTarget, name) { +function customElement_tryToUpgrade(element) { // TODO: Implement in HTML DOM } -exports.event_deactivateAnEventHandler = event_deactivateAnEventHandler; -//# sourceMappingURL=EventAlgorithm.js.map +exports.customElement_tryToUpgrade = customElement_tryToUpgrade; +/** + * Looks up a custom element definition. + * + * @param document - a document + * @param namespace - element namespace + * @param localName - element local name + * @param is - an `is` value + */ +function customElement_lookUpACustomElementDefinition(document, namespace, localName, is) { + // TODO: Implement in HTML DOM + return null; +} +exports.customElement_lookUpACustomElementDefinition = customElement_lookUpACustomElementDefinition; +//# sourceMappingURL=CustomElementAlgorithm.js.map /***/ }), -/***/ 1312: +/***/ 9628: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -50557,154 +50048,357 @@ var __values = (this && this.__values) || function(o) { throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(6195); +var DOMImpl_1 = __nccwpck_require__(14177); +var TreeAlgorithm_1 = __nccwpck_require__(16620); +var util_1 = __nccwpck_require__(65282); +var ShadowTreeAlgorithm_1 = __nccwpck_require__(68733); +var supportedTokens = new Map(); /** - * Flattens the given options argument. + * Runs removing steps for node. * - * @param options - options argument + * @param removedNode - removed node + * @param oldParent - old parent node */ -function eventTarget_flatten(options) { - /** - * 1. If options is a boolean, then return options. - * 2. Return options’s capture. - */ - if (util_1.isBoolean(options)) { - return options; - } - else { - return options.capture || false; - } +function dom_runRemovingSteps(removedNode, oldParent) { + // No steps defined } -exports.eventTarget_flatten = eventTarget_flatten; +exports.dom_runRemovingSteps = dom_runRemovingSteps; /** - * Flattens the given options argument. + * Runs cloning steps for node. * - * @param options - options argument + * @param copy - node clone + * @param node - node + * @param document - document to own the cloned node + * @param cloneChildrenFlag - whether child nodes are cloned */ -function eventTarget_flattenMore(options) { - /** - * 1. Let capture be the result of flattening options. - * 2. Let once and passive be false. - * 3. If options is a dictionary, then set passive to options’s passive and - * once to options’s once. - * 4. Return capture, passive, and once. - */ - var capture = eventTarget_flatten(options); - var once = false; - var passive = false; - if (!util_1.isBoolean(options)) { - once = options.once || false; - passive = options.passive || false; - } - return [capture, passive, once]; +function dom_runCloningSteps(copy, node, document, cloneChildrenFlag) { + // No steps defined } -exports.eventTarget_flattenMore = eventTarget_flattenMore; +exports.dom_runCloningSteps = dom_runCloningSteps; /** - * Adds a new event listener. + * Runs adopting steps for node. * - * @param eventTarget - event target - * @param listener - event listener + * @param node - node + * @param oldDocument - old document */ -function eventTarget_addEventListener(eventTarget, listener) { +function dom_runAdoptingSteps(node, oldDocument) { + // No steps defined +} +exports.dom_runAdoptingSteps = dom_runAdoptingSteps; +/** + * Runs attribute change steps for an element node. + * + * @param element - element node owning the attribute + * @param localName - attribute's local name + * @param oldValue - attribute's old value + * @param value - attribute's new value + * @param namespace - attribute's namespace + */ +function dom_runAttributeChangeSteps(element, localName, oldValue, value, namespace) { + var e_1, _a; + // run default steps + if (DOMImpl_1.dom.features.slots) { + updateASlotablesName.call(element, element, localName, oldValue, value, namespace); + updateASlotsName.call(element, element, localName, oldValue, value, namespace); + } + updateAnElementID.call(element, element, localName, value, namespace); + try { + // run custom steps + for (var _b = __values(element._attributeChangeSteps), _c = _b.next(); !_c.done; _c = _b.next()) { + var step = _c.value; + step.call(element, element, localName, oldValue, value, namespace); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } +} +exports.dom_runAttributeChangeSteps = dom_runAttributeChangeSteps; +/** + * Runs insertion steps for a node. + * + * @param insertedNode - inserted node + */ +function dom_runInsertionSteps(insertedNode) { + // No steps defined +} +exports.dom_runInsertionSteps = dom_runInsertionSteps; +/** + * Runs pre-removing steps for a node iterator and node. + * + * @param nodeIterator - a node iterator + * @param toBeRemoved - node to be removed + */ +function dom_runNodeIteratorPreRemovingSteps(nodeIterator, toBeRemoved) { + removeNodeIterator.call(nodeIterator, nodeIterator, toBeRemoved); +} +exports.dom_runNodeIteratorPreRemovingSteps = dom_runNodeIteratorPreRemovingSteps; +/** + * Determines if there are any supported tokens defined for the given + * attribute name. + * + * @param attributeName - an attribute name + */ +function dom_hasSupportedTokens(attributeName) { + return supportedTokens.has(attributeName); +} +exports.dom_hasSupportedTokens = dom_hasSupportedTokens; +/** + * Returns the set of supported tokens defined for the given attribute name. + * + * @param attributeName - an attribute name + */ +function dom_getSupportedTokens(attributeName) { + return supportedTokens.get(attributeName) || new Set(); +} +exports.dom_getSupportedTokens = dom_getSupportedTokens; +/** + * Runs event construction steps. + * + * @param event - an event + */ +function dom_runEventConstructingSteps(event) { + // No steps defined +} +exports.dom_runEventConstructingSteps = dom_runEventConstructingSteps; +/** + * Runs child text content change steps for a parent node. + * + * @param parent - parent node with text node child nodes + */ +function dom_runChildTextContentChangeSteps(parent) { + // No steps defined +} +exports.dom_runChildTextContentChangeSteps = dom_runChildTextContentChangeSteps; +/** + * Defines pre-removing steps for a node iterator. + */ +function removeNodeIterator(nodeIterator, toBeRemovedNode) { /** - * 1. If eventTarget is a ServiceWorkerGlobalScope object, its service - * worker’s script resource’s has ever been evaluated flag is set, and - * listener’s type matches the type attribute value of any of the service - * worker events, then report a warning to the console that this might not - * give the expected results. [SERVICE-WORKERS] + * 1. If toBeRemovedNode is not an inclusive ancestor of nodeIterator’s + * reference, or toBeRemovedNode is nodeIterator’s root, then return. */ - // TODO: service worker + if (toBeRemovedNode === nodeIterator._root || + !TreeAlgorithm_1.tree_isAncestorOf(nodeIterator._reference, toBeRemovedNode, true)) { + return; + } /** - * 2. If listener’s callback is null, then return. + * 2. If nodeIterator’s pointer before reference is true, then: */ - if (listener.callback === null) - return; + if (nodeIterator._pointerBeforeReference) { + /** + * 2.1. Let next be toBeRemovedNode’s first following node that is an + * inclusive descendant of nodeIterator’s root and is not an inclusive + * descendant of toBeRemovedNode, and null if there is no such node. + */ + while (true) { + var nextNode = TreeAlgorithm_1.tree_getFollowingNode(nodeIterator._root, toBeRemovedNode); + if (nextNode !== null && + TreeAlgorithm_1.tree_isDescendantOf(nodeIterator._root, nextNode, true) && + !TreeAlgorithm_1.tree_isDescendantOf(toBeRemovedNode, nextNode, true)) { + /** + * 2.2. If next is non-null, then set nodeIterator’s reference to next + * and return. + */ + nodeIterator._reference = nextNode; + return; + } + else if (nextNode === null) { + /** + * 2.3. Otherwise, set nodeIterator’s pointer before reference to false. + */ + nodeIterator._pointerBeforeReference = false; + return; + } + } + } /** - * 3. If eventTarget’s event listener list does not contain an event listener - * whose type is listener’s type, callback is listener’s callback, and capture - * is listener’s capture, then append listener to eventTarget’s event listener - * list. + * 3. Set nodeIterator’s reference to toBeRemovedNode’s parent, if + * toBeRemovedNode’s previous sibling is null, and to the inclusive + * descendant of toBeRemovedNode’s previous sibling that appears last in + * tree order otherwise. */ - for (var i = 0; i < eventTarget._eventListenerList.length; i++) { - var entry = eventTarget._eventListenerList[i]; - if (entry.type === listener.type && entry.callback.handleEvent === listener.callback.handleEvent - && entry.capture === listener.capture) { + if (toBeRemovedNode._previousSibling === null) { + if (toBeRemovedNode._parent !== null) { + nodeIterator._reference = toBeRemovedNode._parent; + } + } + else { + var referenceNode = toBeRemovedNode._previousSibling; + var childNode = TreeAlgorithm_1.tree_getFirstDescendantNode(toBeRemovedNode._previousSibling, true, false); + while (childNode !== null) { + if (childNode !== null) { + referenceNode = childNode; + } + // loop through to get the last descendant node + childNode = TreeAlgorithm_1.tree_getNextDescendantNode(toBeRemovedNode._previousSibling, childNode, true, false); + } + nodeIterator._reference = referenceNode; + } +} +/** + * Defines attribute change steps to update a slot’s name. + */ +function updateASlotsName(element, localName, oldValue, value, namespace) { + /** + * 1. If element is a slot, localName is name, and namespace is null, then: + * 1.1. If value is oldValue, then return. + * 1.2. If value is null and oldValue is the empty string, then return. + * 1.3. If value is the empty string and oldValue is null, then return. + * 1.4. If value is null or the empty string, then set element’s name to the + * empty string. + * 1.5. Otherwise, set element’s name to value. + * 1.6. Run assign slotables for a tree with element’s root. + */ + if (util_1.Guard.isSlot(element) && localName === "name" && namespace === null) { + if (value === oldValue) + return; + if (value === null && oldValue === '') return; + if (value === '' && oldValue === null) + return; + if ((value === null || value === '')) { + element._name = ''; } + else { + element._name = value; + } + ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(element)); } - eventTarget._eventListenerList.push(listener); } -exports.eventTarget_addEventListener = eventTarget_addEventListener; /** - * Removes an event listener. - * - * @param eventTarget - event target - * @param listener - event listener + * Defines attribute change steps to update a slotable’s name. */ -function eventTarget_removeEventListener(eventTarget, listener, index) { +function updateASlotablesName(element, localName, oldValue, value, namespace) { /** - * 1. If eventTarget is a ServiceWorkerGlobalScope object and its service - * worker’s set of event types to handle contains type, then report a - * warning to the console that this might not give the expected results. - * [SERVICE-WORKERS] + * 1. If localName is slot and namespace is null, then: + * 1.1. If value is oldValue, then return. + * 1.2. If value is null and oldValue is the empty string, then return. + * 1.3. If value is the empty string and oldValue is null, then return. + * 1.4. If value is null or the empty string, then set element’s name to + * the empty string. + * 1.5. Otherwise, set element’s name to value. + * 1.6. If element is assigned, then run assign slotables for element’s + * assigned slot. + * 1.7. Run assign a slot for element. */ - // TODO: service worker + if (util_1.Guard.isSlotable(element) && localName === "slot" && namespace === null) { + if (value === oldValue) + return; + if (value === null && oldValue === '') + return; + if (value === '' && oldValue === null) + return; + if ((value === null || value === '')) { + element._name = ''; + } + else { + element._name = value; + } + if (ShadowTreeAlgorithm_1.shadowTree_isAssigned(element)) { + ShadowTreeAlgorithm_1.shadowTree_assignSlotables(element._assignedSlot); + } + ShadowTreeAlgorithm_1.shadowTree_assignASlot(element); + } +} +/** + * Defines attribute change steps to update an element's ID. + */ +function updateAnElementID(element, localName, value, namespace) { /** - * 2. Set listener’s removed to true and remove listener from eventTarget’s - * event listener list. + * 1. If localName is id, namespace is null, and value is null or the empty + * string, then unset element’s ID. + * 2. Otherwise, if localName is id, namespace is null, then set element’s + * ID to value. */ - listener.removed = true; - eventTarget._eventListenerList.splice(index, 1); + if (localName === "id" && namespace === null) { + if (!value) + element._uniqueIdentifier = undefined; + else + element._uniqueIdentifier = value; + } } -exports.eventTarget_removeEventListener = eventTarget_removeEventListener; +//# sourceMappingURL=DOMAlgorithm.js.map + +/***/ }), + +/***/ 93261: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var OrderedSetAlgorithm_1 = __nccwpck_require__(53670); +var DOMAlgorithm_1 = __nccwpck_require__(9628); +var ElementAlgorithm_1 = __nccwpck_require__(51849); /** - * Removes all event listeners. + * Validates a given token against the supported tokens defined for the given + * token lists' associated attribute. * - * @param eventTarget - event target + * @param tokenList - a token list + * @param token - a token */ -function eventTarget_removeAllEventListeners(eventTarget) { +function tokenList_validationSteps(tokenList, token) { /** - * To remove all event listeners, given an EventTarget object eventTarget, - * for each listener of eventTarget’s event listener list, remove an event - * listener with eventTarget and listener. + * 1. If the associated attribute’s local name does not define supported + * tokens, throw a TypeError. + * 2. Let lowercase token be a copy of token, in ASCII lowercase. + * 3. If lowercase token is present in supported tokens, return true. + * 4. Return false. */ - var e_1, _a; - try { - for (var _b = __values(eventTarget._eventListenerList), _c = _b.next(); !_c.done; _c = _b.next()) { - var e = _c.value; - e.removed = true; - } + if (!DOMAlgorithm_1.dom_hasSupportedTokens(tokenList._attribute._localName)) { + throw new TypeError("There are no supported tokens defined for attribute name: '" + tokenList._attribute._localName + "'."); } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + return DOMAlgorithm_1.dom_getSupportedTokens(tokenList._attribute._localName).has(token.toLowerCase()); +} +exports.tokenList_validationSteps = tokenList_validationSteps; +/** + * Updates the value of the token lists' associated attribute. + * + * @param tokenList - a token list + */ +function tokenList_updateSteps(tokenList) { + /** + * 1. If the associated element does not have an associated attribute and + * token set is empty, then return. + * 2. Set an attribute value for the associated element using associated + * attribute’s local name and the result of running the ordered set + * serializer for token set. + */ + if (!tokenList._element.hasAttribute(tokenList._attribute._localName) && + tokenList._tokenSet.size === 0) { + return; } - eventTarget._eventListenerList.length = 0; + ElementAlgorithm_1.element_setAnAttributeValue(tokenList._element, tokenList._attribute._localName, OrderedSetAlgorithm_1.orderedSet_serialize(tokenList._tokenSet)); } -exports.eventTarget_removeAllEventListeners = eventTarget_removeAllEventListeners; -//# sourceMappingURL=EventTargetAlgorithm.js.map +exports.tokenList_updateSteps = tokenList_updateSteps; +/** + * Gets the value of the token lists' associated attribute. + * + * @param tokenList - a token list + */ +function tokenList_serializeSteps(tokenList) { + /** + * A DOMTokenList object’s serialize steps are to return the result of + * running get an attribute value given the associated element and the + * associated attribute’s local name. + */ + return ElementAlgorithm_1.element_getAnAttributeValue(tokenList._element, tokenList._attribute._localName); +} +exports.tokenList_serializeSteps = tokenList_serializeSteps; +//# sourceMappingURL=DOMTokenListAlgorithm.js.map /***/ }), -/***/ 5463: +/***/ 12793: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; @@ -50721,1155 +50415,769 @@ var __read = (this && this.__read) || function (o, n) { } return ar; }; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var DOMException_1 = __nccwpck_require__(3166); -var interfaces_1 = __nccwpck_require__(7305); -var util_1 = __nccwpck_require__(5282); -var util_2 = __nccwpck_require__(6195); -var infra_1 = __nccwpck_require__(4251); -var CustomElementAlgorithm_1 = __nccwpck_require__(5648); -var TreeAlgorithm_1 = __nccwpck_require__(6620); -var NodeIteratorAlgorithm_1 = __nccwpck_require__(3973); -var ShadowTreeAlgorithm_1 = __nccwpck_require__(8733); -var MutationObserverAlgorithm_1 = __nccwpck_require__(8157); +var DOMImpl_1 = __nccwpck_require__(14177); +var util_1 = __nccwpck_require__(65282); +var util_2 = __nccwpck_require__(76195); +var ElementImpl_1 = __nccwpck_require__(35975); +var CustomElementAlgorithm_1 = __nccwpck_require__(35648); +var TreeAlgorithm_1 = __nccwpck_require__(16620); +var NamespaceAlgorithm_1 = __nccwpck_require__(35856); var DOMAlgorithm_1 = __nccwpck_require__(9628); -var DocumentAlgorithm_1 = __nccwpck_require__(2793); +var ElementAlgorithm_1 = __nccwpck_require__(51849); +var MutationAlgorithm_1 = __nccwpck_require__(45463); /** - * Ensures pre-insertion validity of a node into a parent before a - * child. + * Returns an element interface for the given name and namespace. * - * @param node - node to insert - * @param parent - parent node to receive node - * @param child - child node to insert node before + * @param name - element name + * @param namespace - namespace */ -function mutation_ensurePreInsertionValidity(node, parent, child) { - var e_1, _a, e_2, _b, e_3, _c, e_4, _d; - var parentNodeType = parent._nodeType; - var nodeNodeType = node._nodeType; - var childNodeType = child ? child._nodeType : null; - /** - * 1. If parent is not a Document, DocumentFragment, or Element node, - * throw a "HierarchyRequestError" DOMException. - */ - if (parentNodeType !== interfaces_1.NodeType.Document && - parentNodeType !== interfaces_1.NodeType.DocumentFragment && - parentNodeType !== interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is " + parent.nodeName + "."); - /** - * 2. If node is a host-including inclusive ancestor of parent, throw a - * "HierarchyRequestError" DOMException. - */ - if (TreeAlgorithm_1.tree_isHostIncludingAncestorOf(parent, node, true)) - throw new DOMException_1.HierarchyRequestError("The node to be inserted cannot be an inclusive ancestor of parent node. Node is " + node.nodeName + ", parent node is " + parent.nodeName + "."); - /** - * 3. If child is not null and its parent is not parent, then throw a - * "NotFoundError" DOMException. - */ - if (child !== null && child._parent !== parent) - throw new DOMException_1.NotFoundError("The reference child node cannot be found under parent node. Child node is " + child.nodeName + ", parent node is " + parent.nodeName + "."); +function document_elementInterface(name, namespace) { + return ElementImpl_1.ElementImpl; +} +exports.document_elementInterface = document_elementInterface; +/** + * Creates a new element node. + * See: https://dom.spec.whatwg.org/#internal-createelementns-steps + * + * @param document - owner document + * @param namespace - element namespace + * @param qualifiedName - qualified name + * @param options - element options + */ +function document_internalCreateElementNS(document, namespace, qualifiedName, options) { /** - * 4. If node is not a DocumentFragment, DocumentType, Element, Text, - * ProcessingInstruction, or Comment node, throw a "HierarchyRequestError" - * DOMException. + * 1. Let namespace, prefix, and localName be the result of passing + * namespace and qualifiedName to validate and extract. + * 2. Let is be null. + * 3. If options is a dictionary and options’s is is present, then set + * is to it. + * 4. Return the result of creating an element given document, localName, + * namespace, prefix, is, and with the synchronous custom elements flag set. */ - if (nodeNodeType !== interfaces_1.NodeType.DocumentFragment && - nodeNodeType !== interfaces_1.NodeType.DocumentType && - nodeNodeType !== interfaces_1.NodeType.Element && - nodeNodeType !== interfaces_1.NodeType.Text && - nodeNodeType !== interfaces_1.NodeType.ProcessingInstruction && - nodeNodeType !== interfaces_1.NodeType.CData && - nodeNodeType !== interfaces_1.NodeType.Comment) - throw new DOMException_1.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is " + node.nodeName + "."); + var _a = __read(NamespaceAlgorithm_1.namespace_validateAndExtract(namespace, qualifiedName), 3), ns = _a[0], prefix = _a[1], localName = _a[2]; + var is = null; + if (options !== undefined) { + if (util_2.isString(options)) { + is = options; + } + else { + is = options.is; + } + } + return ElementAlgorithm_1.element_createAnElement(document, localName, ns, prefix, is, true); +} +exports.document_internalCreateElementNS = document_internalCreateElementNS; +/** + * Removes `node` and its subtree from its document and changes + * its owner document to `document` so that it can be inserted + * into `document`. + * + * @param node - the node to move + * @param document - document to receive the node and its subtree + */ +function document_adopt(node, document) { + var e_1, _a; + // Optimize for common case of inserting a fresh node + if (node._nodeDocument === document && node._parent === null) { + return; + } /** - * 5. If either node is a Text node and parent is a document, or node is a - * doctype and parent is not a document, throw a "HierarchyRequestError" - * DOMException. + * 1. Let oldDocument be node’s node document. + * 2. If node’s parent is not null, remove node from its parent. */ - if (nodeNodeType === interfaces_1.NodeType.Text && - parentNodeType === interfaces_1.NodeType.Document) - throw new DOMException_1.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is " + node.nodeName + "."); - if (nodeNodeType === interfaces_1.NodeType.DocumentType && - parentNodeType !== interfaces_1.NodeType.Document) - throw new DOMException_1.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is " + parent.nodeName + "."); + var oldDocument = node._nodeDocument; + if (node._parent) + MutationAlgorithm_1.mutation_remove(node, node._parent); /** - * 6. If parent is a document, and any of the statements below, switched on - * node, are true, throw a "HierarchyRequestError" DOMException. - * - DocumentFragment node - * If node has more than one element child or has a Text node child. - * Otherwise, if node has one element child and either parent has an element - * child, child is a doctype, or child is not null and a doctype is - * following child. - * - element - * parent has an element child, child is a doctype, or child is not null and - * a doctype is following child. - * - doctype - * parent has a doctype child, child is non-null and an element is preceding - * child, or child is null and parent has an element child. + * 3. If document is not oldDocument, then: */ - if (parentNodeType === interfaces_1.NodeType.Document) { - if (nodeNodeType === interfaces_1.NodeType.DocumentFragment) { - var eleCount = 0; - try { - for (var _e = __values(node._children), _f = _e.next(); !_f.done; _f = _e.next()) { - var childNode = _f.value; - if (childNode._nodeType === interfaces_1.NodeType.Element) - eleCount++; - else if (childNode._nodeType === interfaces_1.NodeType.Text) - throw new DOMException_1.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is " + childNode.nodeName + "."); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_f && !_f.done && (_a = _e.return)) _a.call(_e); - } - finally { if (e_1) throw e_1.error; } - } - if (eleCount > 1) { - throw new DOMException_1.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has " + eleCount + " element nodes."); - } - else if (eleCount === 1) { + if (document !== oldDocument) { + /** + * 3.1. For each inclusiveDescendant in node’s shadow-including inclusive + * descendants: + */ + var inclusiveDescendant = TreeAlgorithm_1.tree_getFirstDescendantNode(node, true, true); + while (inclusiveDescendant !== null) { + /** + * 3.1.1. Set inclusiveDescendant’s node document to document. + * 3.1.2. If inclusiveDescendant is an element, then set the node + * document of each attribute in inclusiveDescendant’s attribute list + * to document. + */ + inclusiveDescendant._nodeDocument = document; + if (util_1.Guard.isElementNode(inclusiveDescendant)) { try { - for (var _g = __values(parent._children), _h = _g.next(); !_h.done; _h = _g.next()) { - var ele = _h.value; - if (ele._nodeType === interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("The document node already has a document element node."); + for (var _b = (e_1 = void 0, __values(inclusiveDescendant._attributeList._asArray())), _c = _b.next(); !_c.done; _c = _b.next()) { + var attr = _c.value; + attr._nodeDocument = document; } } - catch (e_2_1) { e_2 = { error: e_2_1 }; } + catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { - if (_h && !_h.done && (_b = _g.return)) _b.call(_g); - } - finally { if (e_2) throw e_2.error; } - } - if (child) { - if (childNodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node."); - var doctypeChild = child._nextSibling; - while (doctypeChild) { - if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node."); - doctypeChild = doctypeChild._nextSibling; + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } + finally { if (e_1) throw e_1.error; } } } - } - else if (nodeNodeType === interfaces_1.NodeType.Element) { - try { - for (var _j = __values(parent._children), _k = _j.next(); !_k.done; _k = _j.next()) { - var ele = _k.value; - if (ele._nodeType === interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("Document already has a document element node. Node is " + node.nodeName + "."); - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_k && !_k.done && (_c = _j.return)) _c.call(_j); - } - finally { if (e_3) throw e_3.error; } - } - if (child) { - if (childNodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node. Node is " + node.nodeName + "."); - var doctypeChild = child._nextSibling; - while (doctypeChild) { - if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node. Node is " + node.nodeName + "."); - doctypeChild = doctypeChild._nextSibling; - } - } - } - else if (nodeNodeType === interfaces_1.NodeType.DocumentType) { - try { - for (var _l = __values(parent._children), _m = _l.next(); !_m.done; _m = _l.next()) { - var ele = _m.value; - if (ele._nodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Document already has a document type node. Node is " + node.nodeName + "."); - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (_m && !_m.done && (_d = _l.return)) _d.call(_l); - } - finally { if (e_4) throw e_4.error; } - } - if (child) { - var elementChild = child._previousSibling; - while (elementChild) { - if (elementChild._nodeType === interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("Cannot insert a document type node before an element node. Node is " + node.nodeName + "."); - elementChild = elementChild._previousSibling; + /** + * 3.2. For each inclusiveDescendant in node's shadow-including + * inclusive descendants that is custom, enqueue a custom + * element callback reaction with inclusiveDescendant, + * callback name "adoptedCallback", and an argument list + * containing oldDocument and document. + */ + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isElementNode(inclusiveDescendant) && + inclusiveDescendant._customElementState === "custom") { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(inclusiveDescendant, "adoptedCallback", [oldDocument, document]); } } - else { - var elementChild = parent._firstChild; - while (elementChild) { - if (elementChild._nodeType === interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("Cannot insert a document type node before an element node. Node is " + node.nodeName + "."); - elementChild = elementChild._nextSibling; - } + /** + * 3.3. For each inclusiveDescendant in node’s shadow-including + * inclusive descendants, in shadow-including tree order, run the + * adopting steps with inclusiveDescendant and oldDocument. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runAdoptingSteps(inclusiveDescendant, oldDocument); } + inclusiveDescendant = TreeAlgorithm_1.tree_getNextDescendantNode(node, inclusiveDescendant, true, true); } } } -exports.mutation_ensurePreInsertionValidity = mutation_ensurePreInsertionValidity; +exports.document_adopt = document_adopt; +//# sourceMappingURL=DocumentAlgorithm.js.map + +/***/ }), + +/***/ 51849: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var DOMImpl_1 = __nccwpck_require__(14177); +var infra_1 = __nccwpck_require__(84251); +var util_1 = __nccwpck_require__(65282); +var DOMException_1 = __nccwpck_require__(13166); +var CreateAlgorithm_1 = __nccwpck_require__(57339); +var CustomElementAlgorithm_1 = __nccwpck_require__(35648); +var MutationObserverAlgorithm_1 = __nccwpck_require__(78157); +var DOMAlgorithm_1 = __nccwpck_require__(9628); +var MutationAlgorithm_1 = __nccwpck_require__(45463); +var DocumentAlgorithm_1 = __nccwpck_require__(12793); /** - * Ensures pre-insertion validity of a node into a parent before a - * child, then adopts the node to the tree and inserts it. + * Determines whether the element's attribute list contains the given + * attribute. * - * @param node - node to insert - * @param parent - parent node to receive node - * @param child - child node to insert node before + * @param attribute - an attribute node + * @param element - an element node */ -function mutation_preInsert(node, parent, child) { +function element_has(attribute, element) { /** - * 1. Ensure pre-insertion validity of node into parent before child. - * 2. Let reference child be child. - * 3. If reference child is node, set it to node’s next sibling. - * 4. Adopt node into parent’s node document. - * 5. Insert node into parent before reference child. - * 6. Return node. + * An element has an attribute A if its attribute list contains A. */ - mutation_ensurePreInsertionValidity(node, parent, child); - var referenceChild = child; - if (referenceChild === node) - referenceChild = node._nextSibling; - DocumentAlgorithm_1.document_adopt(node, parent._nodeDocument); - mutation_insert(node, parent, referenceChild); - return node; + return element._attributeList._asArray().indexOf(attribute) !== -1; } -exports.mutation_preInsert = mutation_preInsert; +exports.element_has = element_has; /** - * Inserts a node into a parent node before the given child node. + * Changes the value of an attribute node. * - * @param node - node to insert - * @param parent - parent node to receive node - * @param child - child node to insert node before - * @param suppressObservers - whether to notify observers + * @param attribute - an attribute node + * @param element - an element node + * @param value - attribute value */ -function mutation_insert(node, parent, child, suppressObservers) { - var e_5, _a; - // Optimized common case - if (child === null && node._nodeType !== interfaces_1.NodeType.DocumentFragment) { - mutation_insert_single(node, parent, suppressObservers); - return; - } - /** - * 1. Let count be the number of children of node if it is a - * DocumentFragment node, and one otherwise. - */ - var count = (node._nodeType === interfaces_1.NodeType.DocumentFragment ? - node._children.size : 1); - /** - * 2. If child is non-null, then: - */ - if (child !== null) { - /** - * 2.1. For each live range whose start node is parent and start - * offset is greater than child's index, increase its start - * offset by count. - * 2.2. For each live range whose end node is parent and end - * offset is greater than child's index, increase its end - * offset by count. - */ - if (DOMImpl_1.dom.rangeList.size !== 0) { - var index_1 = TreeAlgorithm_1.tree_index(child); - try { - for (var _b = __values(DOMImpl_1.dom.rangeList), _c = _b.next(); !_c.done; _c = _b.next()) { - var range = _c.value; - if (range._start[0] === parent && range._start[1] > index_1) { - range._start[1] += count; - } - if (range._end[0] === parent && range._end[1] > index_1) { - range._end[1] += count; - } - } - } - catch (e_5_1) { e_5 = { error: e_5_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_5) throw e_5.error; } - } - } - } - /** - * 3. Let nodes be node’s children, if node is a DocumentFragment node; - * otherwise « node ». - */ - var nodes = node._nodeType === interfaces_1.NodeType.DocumentFragment ? new (Array.bind.apply(Array, __spread([void 0], node._children)))() : [node]; - /** - * 4. If node is a DocumentFragment node, remove its children with the - * suppress observers flag set. - */ - if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { - while (node._firstChild) { - mutation_remove(node._firstChild, node, true); - } - } +function element_change(attribute, element, value) { /** - * 5. If node is a DocumentFragment node, then queue a tree mutation record - * for node with « », nodes, null, and null. + * 1. Queue an attribute mutation record for element with attribute’s + * local name, attribute’s namespace, and attribute’s value. */ if (DOMImpl_1.dom.features.mutationObservers) { - if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { - MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(node, [], nodes, null, null); - } + MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, attribute._localName, attribute._namespace, attribute._value); } /** - * 6. Let previousSibling be child’s previous sibling or parent’s last - * child if child is null. - */ - var previousSibling = (child ? child._previousSibling : parent._lastChild); - var index = child === null ? -1 : TreeAlgorithm_1.tree_index(child); - /** - * 7. For each node in nodes, in tree order: + * 2. If element is custom, then enqueue a custom element callback reaction + * with element, callback name "attributeChangedCallback", and an argument + * list containing attribute’s local name, attribute’s value, value, and + * attribute’s namespace. */ - for (var i = 0; i < nodes.length; i++) { - var node_1 = nodes[i]; - if (util_1.Guard.isElementNode(node_1)) { - // set document element node - if (util_1.Guard.isDocumentNode(parent)) { - parent._documentElement = node_1; - } - // mark that the document has namespaces - if (!node_1._nodeDocument._hasNamespaces && (node_1._namespace !== null || - node_1._namespacePrefix !== null)) { - node_1._nodeDocument._hasNamespaces = true; - } - } - /** - * 7.1. If child is null, then append node to parent’s children. - * 7.2. Otherwise, insert node into parent’s children before child’s - * index. - */ - node_1._parent = parent; - if (child === null) { - infra_1.set.append(parent._children, node_1); - } - else { - infra_1.set.insert(parent._children, node_1, index); - index++; - } - // assign siblings and children for quick lookups - if (parent._firstChild === null) { - node_1._previousSibling = null; - node_1._nextSibling = null; - parent._firstChild = node_1; - parent._lastChild = node_1; - } - else { - var prev = (child ? child._previousSibling : parent._lastChild); - var next = (child ? child : null); - node_1._previousSibling = prev; - node_1._nextSibling = next; - if (prev) - prev._nextSibling = node_1; - if (next) - next._previousSibling = node_1; - if (!prev) - parent._firstChild = node_1; - if (!next) - parent._lastChild = node_1; - } - /** - * 7.3. If parent is a shadow host and node is a slotable, then - * assign a slot for node. - */ - if (DOMImpl_1.dom.features.slots) { - if (parent._shadowRoot !== null && util_1.Guard.isSlotable(node_1)) { - ShadowTreeAlgorithm_1.shadowTree_assignASlot(node_1); - } - } - /** - * 7.4. If node is a Text node, run the child text content change - * steps for parent. - */ - if (DOMImpl_1.dom.features.steps) { - if (util_1.Guard.isTextNode(node_1)) { - DOMAlgorithm_1.dom_runChildTextContentChangeSteps(parent); - } - } - /** - * 7.5. If parent's root is a shadow root, and parent is a slot - * whose assigned nodes is the empty list, then run signal - * a slot change for parent. - */ - if (DOMImpl_1.dom.features.slots) { - if (util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(parent)) && - util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { - ShadowTreeAlgorithm_1.shadowTree_signalASlotChange(parent); - } - } - /** - * 7.6. Run assign slotables for a tree with node's root. - */ - if (DOMImpl_1.dom.features.slots) { - ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(node_1)); - } - /** - * 7.7. For each shadow-including inclusive descendant - * inclusiveDescendant of node, in shadow-including tree - * order: - */ - var inclusiveDescendant = TreeAlgorithm_1.tree_getFirstDescendantNode(node_1, true, true); - while (inclusiveDescendant !== null) { - /** - * 7.7.1. Run the insertion steps with inclusiveDescendant. - */ - if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runInsertionSteps(inclusiveDescendant); - } - if (DOMImpl_1.dom.features.customElements) { - /** - * 7.7.2. If inclusiveDescendant is connected, then: - */ - if (util_1.Guard.isElementNode(inclusiveDescendant) && - ShadowTreeAlgorithm_1.shadowTree_isConnected(inclusiveDescendant)) { - if (util_1.Guard.isCustomElementNode(inclusiveDescendant)) { - /** - * 7.7.2.1. If inclusiveDescendant is custom, then enqueue a custom - * element callback reaction with inclusiveDescendant, callback name - * "connectedCallback", and an empty argument list. - */ - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(inclusiveDescendant, "connectedCallback", []); - } - else { - /** - * 7.7.2.2. Otherwise, try to upgrade inclusiveDescendant. - */ - CustomElementAlgorithm_1.customElement_tryToUpgrade(inclusiveDescendant); - } - } - } - inclusiveDescendant = TreeAlgorithm_1.tree_getNextDescendantNode(node_1, inclusiveDescendant, true, true); + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isCustomElementNode(element)) { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [attribute._localName, attribute._value, value, attribute._namespace]); } } /** - * 8. If suppress observers flag is unset, then queue a tree mutation record - * for parent with nodes, « », previousSibling, and child. + * 3. Run the attribute change steps with element, attribute’s local name, + * attribute’s value, value, and attribute’s namespace. + * 4. Set attribute’s value to value. */ - if (DOMImpl_1.dom.features.mutationObservers) { - if (!suppressObservers) { - MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, nodes, [], previousSibling, child); - } + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runAttributeChangeSteps(element, attribute._localName, attribute._value, value, attribute._namespace); } + attribute._value = value; } -exports.mutation_insert = mutation_insert; +exports.element_change = element_change; /** - * Inserts a node into a parent node. Optimized routine for the common case where - * node is not a document fragment node and it has no child nodes. + * Appends an attribute to an element node. * - * @param node - node to insert - * @param parent - parent node to receive node - * @param suppressObservers - whether to notify observers + * @param attribute - an attribute + * @param element - an element to receive the attribute */ -function mutation_insert_single(node, parent, suppressObservers) { +function element_append(attribute, element) { /** - * 1. Let count be the number of children of node if it is a - * DocumentFragment node, and one otherwise. - * 2. If child is non-null, then: - * 2.1. For each live range whose start node is parent and start - * offset is greater than child's index, increase its start - * offset by count. - * 2.2. For each live range whose end node is parent and end - * offset is greater than child's index, increase its end - * offset by count. - * 3. Let nodes be node’s children, if node is a DocumentFragment node; - * otherwise « node ». - * 4. If node is a DocumentFragment node, remove its children with the - * suppress observers flag set. - * 5. If node is a DocumentFragment node, then queue a tree mutation record - * for node with « », nodes, null, and null. + * 1. Queue an attribute mutation record for element with attribute’s + * local name, attribute’s namespace, and null. */ + if (DOMImpl_1.dom.features.mutationObservers) { + MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, attribute._localName, attribute._namespace, null); + } /** - * 6. Let previousSibling be child’s previous sibling or parent’s last - * child if child is null. + * 2. If element is custom, then enqueue a custom element callback reaction + * with element, callback name "attributeChangedCallback", and an argument + * list containing attribute’s local name, null, attribute’s value, and + * attribute’s namespace. */ - var previousSibling = parent._lastChild; - // set document element node - if (util_1.Guard.isElementNode(node)) { - // set document element node - if (util_1.Guard.isDocumentNode(parent)) { - parent._documentElement = node; - } - // mark that the document has namespaces - if (!node._nodeDocument._hasNamespaces && (node._namespace !== null || - node._namespacePrefix !== null)) { - node._nodeDocument._hasNamespaces = true; + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isCustomElementNode(element)) { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [attribute._localName, null, attribute._value, attribute._namespace]); } } /** - * 7. For each node in nodes, in tree order: - * 7.1. If child is null, then append node to parent’s children. - * 7.2. Otherwise, insert node into parent’s children before child’s - * index. + * 3. Run the attribute change steps with element, attribute’s local name, + * null, attribute’s value, and attribute’s namespace. */ - node._parent = parent; - parent._children.add(node); - // assign siblings and children for quick lookups - if (parent._firstChild === null) { - node._previousSibling = null; - node._nextSibling = null; - parent._firstChild = node; - parent._lastChild = node; - } - else { - var prev = parent._lastChild; - node._previousSibling = prev; - node._nextSibling = null; - if (prev) - prev._nextSibling = node; - if (!prev) - parent._firstChild = node; - parent._lastChild = node; + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runAttributeChangeSteps(element, attribute._localName, null, attribute._value, attribute._namespace); } /** - * 7.3. If parent is a shadow host and node is a slotable, then - * assign a slot for node. + * 4. Append attribute to element’s attribute list. + * 5. Set attribute’s element to element. */ - if (DOMImpl_1.dom.features.slots) { - if (parent._shadowRoot !== null && util_1.Guard.isSlotable(node)) { - ShadowTreeAlgorithm_1.shadowTree_assignASlot(node); - } + element._attributeList._asArray().push(attribute); + attribute._element = element; + // mark that the document has namespaces + if (!element._nodeDocument._hasNamespaces && (attribute._namespace !== null || + attribute._namespacePrefix !== null || attribute._localName === "xmlns")) { + element._nodeDocument._hasNamespaces = true; } +} +exports.element_append = element_append; +/** + * Removes an attribute from an element node. + * + * @param attribute - an attribute + * @param element - an element to receive the attribute + */ +function element_remove(attribute, element) { /** - * 7.4. If node is a Text node, run the child text content change - * steps for parent. + * 1. Queue an attribute mutation record for element with attribute’s + * local name, attribute’s namespace, and attribute’s value. */ - if (DOMImpl_1.dom.features.steps) { - if (util_1.Guard.isTextNode(node)) { - DOMAlgorithm_1.dom_runChildTextContentChangeSteps(parent); - } + if (DOMImpl_1.dom.features.mutationObservers) { + MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, attribute._localName, attribute._namespace, attribute._value); } /** - * 7.5. If parent's root is a shadow root, and parent is a slot - * whose assigned nodes is the empty list, then run signal - * a slot change for parent. + * 2. If element is custom, then enqueue a custom element callback reaction + * with element, callback name "attributeChangedCallback", and an argument + * list containing attribute’s local name, attribute’s value, null, + * and attribute’s namespace. */ - if (DOMImpl_1.dom.features.slots) { - if (util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(parent)) && - util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { - ShadowTreeAlgorithm_1.shadowTree_signalASlotChange(parent); + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isCustomElementNode(element)) { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [attribute._localName, attribute._value, null, attribute._namespace]); } } /** - * 7.6. Run assign slotables for a tree with node's root. + * 3. Run the attribute change steps with element, attribute’s local name, + * attribute’s value, null, and attribute’s namespace. */ - if (DOMImpl_1.dom.features.slots) { - ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(node)); + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runAttributeChangeSteps(element, attribute._localName, attribute._value, null, attribute._namespace); } /** - * 7.7. For each shadow-including inclusive descendant - * inclusiveDescendant of node, in shadow-including tree - * order: - * 7.7.1. Run the insertion steps with inclusiveDescendant. - */ - if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runInsertionSteps(node); - } - if (DOMImpl_1.dom.features.customElements) { - /** - * 7.7.2. If inclusiveDescendant is connected, then: - */ - if (util_1.Guard.isElementNode(node) && - ShadowTreeAlgorithm_1.shadowTree_isConnected(node)) { - if (util_1.Guard.isCustomElementNode(node)) { - /** - * 7.7.2.1. If inclusiveDescendant is custom, then enqueue a custom - * element callback reaction with inclusiveDescendant, callback name - * "connectedCallback", and an empty argument list. - */ - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(node, "connectedCallback", []); - } - else { - /** - * 7.7.2.2. Otherwise, try to upgrade inclusiveDescendant. - */ - CustomElementAlgorithm_1.customElement_tryToUpgrade(node); - } - } - } - /** - * 8. If suppress observers flag is unset, then queue a tree mutation record - * for parent with nodes, « », previousSibling, and child. - */ - if (DOMImpl_1.dom.features.mutationObservers) { - if (!suppressObservers) { - MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, [node], [], previousSibling, null); - } - } -} -/** - * Appends a node to the children of a parent node. - * - * @param node - a node - * @param parent - the parent to receive node - */ -function mutation_append(node, parent) { - /** - * To append a node to a parent, pre-insert node into parent before null. + * 3. Remove attribute from element’s attribute list. + * 5. Set attribute’s element to null. */ - return mutation_preInsert(node, parent, null); + var index = element._attributeList._asArray().indexOf(attribute); + element._attributeList._asArray().splice(index, 1); + attribute._element = null; } -exports.mutation_append = mutation_append; +exports.element_remove = element_remove; /** - * Replaces a node with another node. + * Replaces an attribute with another of an element node. * - * @param child - child node to remove - * @param node - node to insert - * @param parent - parent node to receive node + * @param oldAttr - old attribute + * @param newAttr - new attribute + * @param element - an element to receive the attribute */ -function mutation_replace(child, node, parent) { - var e_6, _a, e_7, _b, e_8, _c, e_9, _d; - /** - * 1. If parent is not a Document, DocumentFragment, or Element node, - * throw a "HierarchyRequestError" DOMException. - */ - if (parent._nodeType !== interfaces_1.NodeType.Document && - parent._nodeType !== interfaces_1.NodeType.DocumentFragment && - parent._nodeType !== interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is " + parent.nodeName + "."); - /** - * 2. If node is a host-including inclusive ancestor of parent, throw a - * "HierarchyRequestError" DOMException. - */ - if (TreeAlgorithm_1.tree_isHostIncludingAncestorOf(parent, node, true)) - throw new DOMException_1.HierarchyRequestError("The node to be inserted cannot be an ancestor of parent node. Node is " + node.nodeName + ", parent node is " + parent.nodeName + "."); - /** - * 3. If child’s parent is not parent, then throw a "NotFoundError" - * DOMException. - */ - if (child._parent !== parent) - throw new DOMException_1.NotFoundError("The reference child node cannot be found under parent node. Child node is " + child.nodeName + ", parent node is " + parent.nodeName + "."); - /** - * 4. If node is not a DocumentFragment, DocumentType, Element, Text, - * ProcessingInstruction, or Comment node, throw a "HierarchyRequestError" - * DOMException. - */ - if (node._nodeType !== interfaces_1.NodeType.DocumentFragment && - node._nodeType !== interfaces_1.NodeType.DocumentType && - node._nodeType !== interfaces_1.NodeType.Element && - node._nodeType !== interfaces_1.NodeType.Text && - node._nodeType !== interfaces_1.NodeType.ProcessingInstruction && - node._nodeType !== interfaces_1.NodeType.CData && - node._nodeType !== interfaces_1.NodeType.Comment) - throw new DOMException_1.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is " + node.nodeName + "."); +function element_replace(oldAttr, newAttr, element) { /** - * 5. If either node is a Text node and parent is a document, or node is a - * doctype and parent is not a document, throw a "HierarchyRequestError" - * DOMException. + * 1. Queue an attribute mutation record for element with oldAttr’s + * local name, oldAttr’s namespace, and oldAttr’s value. */ - if (node._nodeType === interfaces_1.NodeType.Text && - parent._nodeType === interfaces_1.NodeType.Document) - throw new DOMException_1.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is " + node.nodeName + "."); - if (node._nodeType === interfaces_1.NodeType.DocumentType && - parent._nodeType !== interfaces_1.NodeType.Document) - throw new DOMException_1.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is " + parent.nodeName + "."); + if (DOMImpl_1.dom.features.mutationObservers) { + MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, oldAttr._localName, oldAttr._namespace, oldAttr._value); + } /** - * 6. If parent is a document, and any of the statements below, switched on - * node, are true, throw a "HierarchyRequestError" DOMException. - * - DocumentFragment node - * If node has more than one element child or has a Text node child. - * Otherwise, if node has one element child and either parent has an element - * child that is not child or a doctype is following child. - * - element - * parent has an element child that is not child or a doctype is - * following child. - * - doctype - * parent has a doctype child that is not child, or an element is - * preceding child. + * 2. If element is custom, then enqueue a custom element callback reaction + * with element, callback name "attributeChangedCallback", and an argument + * list containing oldAttr’s local name, oldAttr’s value, newAttr’s value, + * and oldAttr’s namespace. */ - if (parent._nodeType === interfaces_1.NodeType.Document) { - if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { - var eleCount = 0; - try { - for (var _e = __values(node._children), _f = _e.next(); !_f.done; _f = _e.next()) { - var childNode = _f.value; - if (childNode._nodeType === interfaces_1.NodeType.Element) - eleCount++; - else if (childNode._nodeType === interfaces_1.NodeType.Text) - throw new DOMException_1.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is " + childNode.nodeName + "."); - } - } - catch (e_6_1) { e_6 = { error: e_6_1 }; } - finally { - try { - if (_f && !_f.done && (_a = _e.return)) _a.call(_e); - } - finally { if (e_6) throw e_6.error; } - } - if (eleCount > 1) { - throw new DOMException_1.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has " + eleCount + " element nodes."); - } - else if (eleCount === 1) { - try { - for (var _g = __values(parent._children), _h = _g.next(); !_h.done; _h = _g.next()) { - var ele = _h.value; - if (ele._nodeType === interfaces_1.NodeType.Element && ele !== child) - throw new DOMException_1.HierarchyRequestError("The document node already has a document element node."); - } - } - catch (e_7_1) { e_7 = { error: e_7_1 }; } - finally { - try { - if (_h && !_h.done && (_b = _g.return)) _b.call(_g); - } - finally { if (e_7) throw e_7.error; } - } - var doctypeChild = child._nextSibling; - while (doctypeChild) { - if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node."); - doctypeChild = doctypeChild._nextSibling; - } - } - } - else if (node._nodeType === interfaces_1.NodeType.Element) { - try { - for (var _j = __values(parent._children), _k = _j.next(); !_k.done; _k = _j.next()) { - var ele = _k.value; - if (ele._nodeType === interfaces_1.NodeType.Element && ele !== child) - throw new DOMException_1.HierarchyRequestError("Document already has a document element node. Node is " + node.nodeName + "."); - } - } - catch (e_8_1) { e_8 = { error: e_8_1 }; } - finally { - try { - if (_k && !_k.done && (_c = _j.return)) _c.call(_j); - } - finally { if (e_8) throw e_8.error; } - } - var doctypeChild = child._nextSibling; - while (doctypeChild) { - if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node. Node is " + node.nodeName + "."); - doctypeChild = doctypeChild._nextSibling; - } - } - else if (node._nodeType === interfaces_1.NodeType.DocumentType) { - try { - for (var _l = __values(parent._children), _m = _l.next(); !_m.done; _m = _l.next()) { - var ele = _m.value; - if (ele._nodeType === interfaces_1.NodeType.DocumentType && ele !== child) - throw new DOMException_1.HierarchyRequestError("Document already has a document type node. Node is " + node.nodeName + "."); - } - } - catch (e_9_1) { e_9 = { error: e_9_1 }; } - finally { - try { - if (_m && !_m.done && (_d = _l.return)) _d.call(_l); - } - finally { if (e_9) throw e_9.error; } - } - var elementChild = child._previousSibling; - while (elementChild) { - if (elementChild._nodeType === interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("Cannot insert a document type node before an element node. Node is " + node.nodeName + "."); - elementChild = elementChild._previousSibling; - } + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isCustomElementNode(element)) { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [oldAttr._localName, oldAttr._value, newAttr._value, oldAttr._namespace]); } } /** - * 7. Let reference child be child’s next sibling. - * 8. If reference child is node, set it to node’s next sibling. - * 8. Let previousSibling be child’s previous sibling. - */ - var referenceChild = child._nextSibling; - if (referenceChild === node) - referenceChild = node._nextSibling; - var previousSibling = child._previousSibling; - /** - * 10. Adopt node into parent’s node document. - * 11. Let removedNodes be the empty list. - */ - DocumentAlgorithm_1.document_adopt(node, parent._nodeDocument); - var removedNodes = []; - /** - * 12. If child’s parent is not null, then: + * 3. Run the attribute change steps with element, oldAttr’s local name, + * oldAttr’s value, newAttr’s value, and oldAttr’s namespace. */ - if (child._parent !== null) { - /** - * 12.1. Set removedNodes to [child]. - * 12.2. Remove child from its parent with the suppress observers flag - * set. - */ - removedNodes.push(child); - mutation_remove(child, child._parent, true); + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runAttributeChangeSteps(element, oldAttr._localName, oldAttr._value, newAttr._value, oldAttr._namespace); } /** - * 13. Let nodes be node’s children if node is a DocumentFragment node; - * otherwise [node]. + * 4. Replace oldAttr by newAttr in element’s attribute list. + * 5. Set oldAttr’s element to null. + * 6. Set newAttr’s element to element. */ - var nodes = []; - if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { - nodes = Array.from(node._children); + var index = element._attributeList._asArray().indexOf(oldAttr); + if (index !== -1) { + element._attributeList._asArray()[index] = newAttr; } - else { - nodes.push(node); + oldAttr._element = null; + newAttr._element = element; + // mark that the document has namespaces + if (!element._nodeDocument._hasNamespaces && (newAttr._namespace !== null || + newAttr._namespacePrefix !== null || newAttr._localName === "xmlns")) { + element._nodeDocument._hasNamespaces = true; } +} +exports.element_replace = element_replace; +/** + * Retrieves an attribute with the given name from an element node. + * + * @param qualifiedName - an attribute name + * @param element - an element to receive the attribute + */ +function element_getAnAttributeByName(qualifiedName, element) { /** - * 14. Insert node into parent before reference child with the suppress - * observers flag set. - */ - mutation_insert(node, parent, referenceChild, true); - /** - * 15. Queue a tree mutation record for parent with nodes, removedNodes, - * previousSibling, and reference child. + * 1. If element is in the HTML namespace and its node document is an HTML + * document, then set qualifiedName to qualifiedName in ASCII lowercase. + * 2. Return the first attribute in element’s attribute list whose qualified + * name is qualifiedName, and null otherwise. */ - if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, nodes, removedNodes, previousSibling, referenceChild); + if (element._namespace === infra_1.namespace.HTML && element._nodeDocument._type === "html") { + qualifiedName = qualifiedName.toLowerCase(); } - /** - * 16. Return child. - */ - return child; + return element._attributeList._asArray().find(function (attr) { return attr._qualifiedName === qualifiedName; }) || null; } -exports.mutation_replace = mutation_replace; +exports.element_getAnAttributeByName = element_getAnAttributeByName; /** - * Replaces all nodes of a parent with the given node. + * Retrieves an attribute with the given namespace and local name from an + * element node. * - * @param node - node to insert - * @param parent - parent node to receive node + * @param namespace - an attribute namespace + * @param localName - an attribute local name + * @param element - an element to receive the attribute */ -function mutation_replaceAll(node, parent) { - var e_10, _a; +function element_getAnAttributeByNamespaceAndLocalName(namespace, localName, element) { /** - * 1. If node is not null, adopt node into parent’s node document. + * 1. If namespace is the empty string, set it to null. + * 2. Return the attribute in element’s attribute list whose namespace is + * namespace and local name is localName, if any, and null otherwise. */ - if (node !== null) { - DocumentAlgorithm_1.document_adopt(node, parent._nodeDocument); - } + var ns = namespace || null; + return element._attributeList._asArray().find(function (attr) { return attr._namespace === ns && attr._localName === localName; }) || null; +} +exports.element_getAnAttributeByNamespaceAndLocalName = element_getAnAttributeByNamespaceAndLocalName; +/** + * Retrieves an attribute's value with the given name namespace and local + * name from an element node. + * + * @param element - an element to receive the attribute + * @param localName - an attribute local name + * @param namespace - an attribute namespace + */ +function element_getAnAttributeValue(element, localName, namespace) { + if (namespace === void 0) { namespace = ''; } /** - * 2. Let removedNodes be parent’s children. + * 1. Let attr be the result of getting an attribute given namespace, + * localName, and element. + * 2. If attr is null, then return the empty string. + * 3. Return attr’s value. */ - var removedNodes = Array.from(parent._children); + var attr = element_getAnAttributeByNamespaceAndLocalName(namespace, localName, element); + if (attr === null) + return ''; + else + return attr._value; +} +exports.element_getAnAttributeValue = element_getAnAttributeValue; +/** + * Sets an attribute of an element node. + * + * @param attr - an attribute + * @param element - an element to receive the attribute + */ +function element_setAnAttribute(attr, element) { /** - * 3. Let addedNodes be the empty list. - * 4. If node is DocumentFragment node, then set addedNodes to node’s - * children. - * 5. Otherwise, if node is non-null, set addedNodes to [node]. + * 1. If attr’s element is neither null nor element, throw an + * "InUseAttributeError" DOMException. + * 2. Let oldAttr be the result of getting an attribute given attr’s + * namespace, attr’s local name, and element. + * 3. If oldAttr is attr, return attr. + * 4. If oldAttr is non-null, replace it by attr in element. + * 5. Otherwise, append attr to element. + * 6. Return oldAttr. */ - var addedNodes = []; - if (node && node._nodeType === interfaces_1.NodeType.DocumentFragment) { - addedNodes = Array.from(node._children); - } - else if (node !== null) { - addedNodes.push(node); - } - try { - /** - * 6. Remove all parent’s children, in tree order, with the suppress - * observers flag set. - */ - for (var removedNodes_1 = __values(removedNodes), removedNodes_1_1 = removedNodes_1.next(); !removedNodes_1_1.done; removedNodes_1_1 = removedNodes_1.next()) { - var childNode = removedNodes_1_1.value; - mutation_remove(childNode, parent, true); - } + if (attr._element !== null && attr._element !== element) + throw new DOMException_1.InUseAttributeError("This attribute already exists in the document: " + attr._qualifiedName + " as a child of " + attr._element._qualifiedName + "."); + var oldAttr = element_getAnAttributeByNamespaceAndLocalName(attr._namespace || '', attr._localName, element); + if (oldAttr === attr) + return attr; + if (oldAttr !== null) { + element_replace(oldAttr, attr, element); } - catch (e_10_1) { e_10 = { error: e_10_1 }; } - finally { - try { - if (removedNodes_1_1 && !removedNodes_1_1.done && (_a = removedNodes_1.return)) _a.call(removedNodes_1); - } - finally { if (e_10) throw e_10.error; } + else { + element_append(attr, element); } + return oldAttr; +} +exports.element_setAnAttribute = element_setAnAttribute; +/** + * Sets an attribute's value of an element node. + * + * @param element - an element to receive the attribute + * @param localName - an attribute local name + * @param value - an attribute value + * @param prefix - an attribute prefix + * @param namespace - an attribute namespace + */ +function element_setAnAttributeValue(element, localName, value, prefix, namespace) { + if (prefix === void 0) { prefix = null; } + if (namespace === void 0) { namespace = null; } /** - * 7. If node is not null, then insert node into parent before null with the - * suppress observers flag set. + * 1. If prefix is not given, set it to null. + * 2. If namespace is not given, set it to null. + * 3. Let attribute be the result of getting an attribute given namespace, + * localName, and element. + * 4. If attribute is null, create an attribute whose namespace is + * namespace, namespace prefix is prefix, local name is localName, value + * is value, and node document is element’s node document, then append this + * attribute to element, and then return. + * 5. Change attribute from element to value. */ - if (node !== null) { - mutation_insert(node, parent, null, true); + var attribute = element_getAnAttributeByNamespaceAndLocalName(namespace || '', localName, element); + if (attribute === null) { + var newAttr = CreateAlgorithm_1.create_attr(element._nodeDocument, localName); + newAttr._namespace = namespace; + newAttr._namespacePrefix = prefix; + newAttr._value = value; + element_append(newAttr, element); + return; } + element_change(attribute, element, value); +} +exports.element_setAnAttributeValue = element_setAnAttributeValue; +/** + * Removes an attribute with the given name from an element node. + * + * @param qualifiedName - an attribute name + * @param element - an element to receive the attribute + */ +function element_removeAnAttributeByName(qualifiedName, element) { /** - * 8. Queue a tree mutation record for parent with addedNodes, removedNodes, - * null, and null. + * 1. Let attr be the result of getting an attribute given qualifiedName + * and element. + * 2. If attr is non-null, remove it from element. + * 3. Return attr. */ - if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, addedNodes, removedNodes, null, null); + var attr = element_getAnAttributeByName(qualifiedName, element); + if (attr !== null) { + element_remove(attr, element); } + return attr; } -exports.mutation_replaceAll = mutation_replaceAll; +exports.element_removeAnAttributeByName = element_removeAnAttributeByName; /** - * Ensures pre-removal validity of a child node from a parent, then - * removes it. + * Removes an attribute with the given namespace and local name from an + * element node. * - * @param child - child node to remove - * @param parent - parent node + * @param namespace - an attribute namespace + * @param localName - an attribute local name + * @param element - an element to receive the attribute */ -function mutation_preRemove(child, parent) { +function element_removeAnAttributeByNamespaceAndLocalName(namespace, localName, element) { /** - * 1. If child’s parent is not parent, then throw a "NotFoundError" - * DOMException. - * 2. Remove child from parent. - * 3. Return child. + * 1. Let attr be the result of getting an attribute given namespace, localName, and element. + * 2. If attr is non-null, remove it from element. + * 3. Return attr. */ - if (child._parent !== parent) - throw new DOMException_1.NotFoundError("The child node cannot be found under parent node. Child node is " + child.nodeName + ", parent node is " + parent.nodeName + "."); - mutation_remove(child, parent); - return child; + var attr = element_getAnAttributeByNamespaceAndLocalName(namespace, localName, element); + if (attr !== null) { + element_remove(attr, element); + } + return attr; } -exports.mutation_preRemove = mutation_preRemove; +exports.element_removeAnAttributeByNamespaceAndLocalName = element_removeAnAttributeByNamespaceAndLocalName; /** - * Removes a child node from its parent. + * Creates an element node. + * See: https://dom.spec.whatwg.org/#concept-create-element. * - * @param node - node to remove - * @param parent - parent node - * @param suppressObservers - whether to notify observers + * @param document - the document owning the element + * @param localName - local name + * @param namespace - element namespace + * @param prefix - namespace prefix + * @param is - the "is" value + * @param synchronousCustomElementsFlag - synchronous custom elements flag */ -function mutation_remove(node, parent, suppressObservers) { - var e_11, _a, e_12, _b, e_13, _c, e_14, _d; - if (DOMImpl_1.dom.rangeList.size !== 0) { - /** - * 1. Let index be node’s index. - */ - var index = TreeAlgorithm_1.tree_index(node); - try { - /** - * 2. For each live range whose start node is an inclusive descendant of - * node, set its start to (parent, index). - * 3. For each live range whose end node is an inclusive descendant of - * node, set its end to (parent, index). - */ - for (var _e = __values(DOMImpl_1.dom.rangeList), _f = _e.next(); !_f.done; _f = _e.next()) { - var range = _f.value; - if (TreeAlgorithm_1.tree_isDescendantOf(node, range._start[0], true)) { - range._start = [parent, index]; - } - if (TreeAlgorithm_1.tree_isDescendantOf(node, range._end[0], true)) { - range._end = [parent, index]; - } - if (range._start[0] === parent && range._start[1] > index) { - range._start[1]--; - } - if (range._end[0] === parent && range._end[1] > index) { - range._end[1]--; - } - } - } - catch (e_11_1) { e_11 = { error: e_11_1 }; } - finally { - try { - if (_f && !_f.done && (_a = _e.return)) _a.call(_e); - } - finally { if (e_11) throw e_11.error; } - } - try { - /** - * 4. For each live range whose start node is parent and start offset is - * greater than index, decrease its start offset by 1. - * 5. For each live range whose end node is parent and end offset is greater - * than index, decrease its end offset by 1. - */ - for (var _g = __values(DOMImpl_1.dom.rangeList), _h = _g.next(); !_h.done; _h = _g.next()) { - var range = _h.value; - if (range._start[0] === parent && range._start[1] > index) { - range._start[1] -= 1; - } - if (range._end[0] === parent && range._end[1] > index) { - range._end[1] -= 1; - } - } - } - catch (e_12_1) { e_12 = { error: e_12_1 }; } - finally { - try { - if (_h && !_h.done && (_b = _g.return)) _b.call(_g); - } - finally { if (e_12) throw e_12.error; } - } - } - /** - * 6. For each NodeIterator object iterator whose root’s node document is - * node’s node document, run the NodeIterator pre-removing steps given node - * and iterator. - */ - if (DOMImpl_1.dom.features.steps) { - try { - for (var _j = __values(NodeIteratorAlgorithm_1.nodeIterator_iteratorList()), _k = _j.next(); !_k.done; _k = _j.next()) { - var iterator = _k.value; - if (iterator._root._nodeDocument === node._nodeDocument) { - DOMAlgorithm_1.dom_runNodeIteratorPreRemovingSteps(iterator, node); - } - } - } - catch (e_13_1) { e_13 = { error: e_13_1 }; } - finally { - try { - if (_k && !_k.done && (_c = _j.return)) _c.call(_j); - } - finally { if (e_13) throw e_13.error; } - } - } +function element_createAnElement(document, localName, namespace, prefix, is, synchronousCustomElementsFlag) { + if (prefix === void 0) { prefix = null; } + if (is === void 0) { is = null; } + if (synchronousCustomElementsFlag === void 0) { synchronousCustomElementsFlag = false; } /** - * 7. Let oldPreviousSibling be node’s previous sibling. - * 8. Let oldNextSibling be node’s next sibling. + * 1. If prefix was not given, let prefix be null. + * 2. If is was not given, let is be null. + * 3. Let result be null. */ - var oldPreviousSibling = node._previousSibling; - var oldNextSibling = node._nextSibling; - // set document element node - if (util_1.Guard.isDocumentNode(parent) && util_1.Guard.isElementNode(node)) { - parent._documentElement = null; + var result = null; + if (!DOMImpl_1.dom.features.customElements) { + result = CreateAlgorithm_1.create_element(document, localName, namespace, prefix); + result._customElementState = "uncustomized"; + result._customElementDefinition = null; + result._is = is; + return result; } /** - * 9. Remove node from its parent’s children. - */ - node._parent = null; - parent._children.delete(node); - // assign siblings and children for quick lookups - var prev = node._previousSibling; - var next = node._nextSibling; - node._previousSibling = null; - node._nextSibling = null; - if (prev) - prev._nextSibling = next; - if (next) - next._previousSibling = prev; - if (!prev) - parent._firstChild = next; - if (!next) - parent._lastChild = prev; - /** - * 10. If node is assigned, then run assign slotables for node’s assigned - * slot. + * 4. Let definition be the result of looking up a custom element definition + * given document, namespace, localName, and is. */ - if (DOMImpl_1.dom.features.slots) { - if (util_1.Guard.isSlotable(node) && node._assignedSlot !== null && ShadowTreeAlgorithm_1.shadowTree_isAssigned(node)) { - ShadowTreeAlgorithm_1.shadowTree_assignSlotables(node._assignedSlot); + var definition = CustomElementAlgorithm_1.customElement_lookUpACustomElementDefinition(document, namespace, localName, is); + if (definition !== null && definition.name !== definition.localName) { + /** + * 5. If definition is non-null, and definition’s name is not equal to + * its local name (i.e., definition represents a customized built-in + * element), then: + * 5.1. Let interface be the element interface for localName and the HTML + * namespace. + * 5.2. Set result to a new element that implements interface, with no + * attributes, namespace set to the HTML namespace, namespace prefix + * set to prefix, local name set to localName, custom element state set + * to "undefined", custom element definition set to null, is value set + * to is, and node document set to document. + * 5.3. If the synchronous custom elements flag is set, upgrade element + * using definition. + * 5.4. Otherwise, enqueue a custom element upgrade reaction given result + * and definition. + */ + var elemenInterface = DocumentAlgorithm_1.document_elementInterface(localName, infra_1.namespace.HTML); + result = new elemenInterface(); + result._localName = localName; + result._namespace = infra_1.namespace.HTML; + result._namespacePrefix = prefix; + result._customElementState = "undefined"; + result._customElementDefinition = null; + result._is = is; + result._nodeDocument = document; + if (synchronousCustomElementsFlag) { + CustomElementAlgorithm_1.customElement_upgrade(definition, result); } - } - /** - * 11. If parent’s root is a shadow root, and parent is a slot whose - * assigned nodes is the empty list, then run signal a slot change for - * parent. - */ - if (DOMImpl_1.dom.features.slots) { - if (util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(parent)) && - util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { - ShadowTreeAlgorithm_1.shadowTree_signalASlotChange(parent); + else { + CustomElementAlgorithm_1.customElement_enqueueACustomElementUpgradeReaction(result, definition); } } - /** - * 12. If node has an inclusive descendant that is a slot, then: - * 12.1. Run assign slotables for a tree with parent's root. - * 12.2. Run assign slotables for a tree with node. - */ - if (DOMImpl_1.dom.features.slots) { - var descendant_1 = TreeAlgorithm_1.tree_getFirstDescendantNode(node, true, false, function (e) { return util_1.Guard.isSlot(e); }); - if (descendant_1 !== null) { - ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(parent)); - ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(node); + else if (definition !== null) { + /** + * 6. Otherwise, if definition is non-null, then: + */ + if (synchronousCustomElementsFlag) { + /** + * 6.1. If the synchronous custom elements flag is set, then run these + * steps while catching any exceptions: + */ + try { + /** + * 6.1.1. Let C be definition’s constructor. + * 6.1.2. Set result to the result of constructing C, with no arguments. + * 6.1.3. Assert: result’s custom element state and custom element definition + * are initialized. + * 6.1.4. Assert: result’s namespace is the HTML namespace. + * _Note:_ IDL enforces that result is an HTMLElement object, which all + * use the HTML namespace. + */ + var C = definition.constructor; + var result_1 = new C(); + console.assert(result_1._customElementState !== undefined); + console.assert(result_1._customElementDefinition !== undefined); + console.assert(result_1._namespace === infra_1.namespace.HTML); + /** + * 6.1.5. If result’s attribute list is not empty, then throw a + * "NotSupportedError" DOMException. + * 6.1.6. If result has children, then throw a "NotSupportedError" + * DOMException. + * 6.1.7. If result’s parent is not null, then throw a + * "NotSupportedError" DOMException. + * 6.1.8. If result’s node document is not document, then throw a + * "NotSupportedError" DOMException. + * 6.1.9. If result’s local name is not equal to localName, then throw + * a "NotSupportedError" DOMException. + */ + if (result_1._attributeList.length !== 0) + throw new DOMException_1.NotSupportedError("Custom element already has attributes."); + if (result_1._children.size !== 0) + throw new DOMException_1.NotSupportedError("Custom element already has child nodes."); + if (result_1._parent !== null) + throw new DOMException_1.NotSupportedError("Custom element already has a parent node."); + if (result_1._nodeDocument !== document) + throw new DOMException_1.NotSupportedError("Custom element is already in a document."); + if (result_1._localName !== localName) + throw new DOMException_1.NotSupportedError("Custom element has a different local name."); + /** + * 6.1.10. Set result’s namespace prefix to prefix. + * 6.1.11. Set result’s is value to null. + */ + result_1._namespacePrefix = prefix; + result_1._is = null; + } + catch (e) { + /** + * If any of these steps threw an exception, then: + * - Report the exception. + * - Set result to a new element that implements the HTMLUnknownElement + * interface, with no attributes, namespace set to the HTML namespace, + * namespace prefix set to prefix, local name set to localName, custom + * element state set to "failed", custom element definition set to null, + * is value set to null, and node document set to document. + */ + // TODO: Report the exception + result = CreateAlgorithm_1.create_htmlUnknownElement(document, localName, infra_1.namespace.HTML, prefix); + result._customElementState = "failed"; + result._customElementDefinition = null; + result._is = null; + } } - } - /** - * 13. Run the removing steps with node and parent. - */ - if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runRemovingSteps(node, parent); - } - /** - * 14. If node is custom, then enqueue a custom element callback - * reaction with node, callback name "disconnectedCallback", - * and an empty argument list. - */ - if (DOMImpl_1.dom.features.customElements) { - if (util_1.Guard.isCustomElementNode(node)) { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(node, "disconnectedCallback", []); + else { + /** + * 6.2. Otherwise: + * 6.2.1. Set result to a new element that implements the HTMLElement + * interface, with no attributes, namespace set to the HTML namespace, + * namespace prefix set to prefix, local name set to localName, custom + * element state set to "undefined", custom element definition set to + * null, is value set to null, and node document set to document. + * 6.2.2. Enqueue a custom element upgrade reaction given result and + * definition. + */ + result = CreateAlgorithm_1.create_htmlElement(document, localName, infra_1.namespace.HTML, prefix); + result._customElementState = "undefined"; + result._customElementDefinition = null; + result._is = null; + CustomElementAlgorithm_1.customElement_enqueueACustomElementUpgradeReaction(result, definition); } } - /** - * 15. For each shadow-including descendant descendant of node, - * in shadow-including tree order, then: - */ - var descendant = TreeAlgorithm_1.tree_getFirstDescendantNode(node, false, true); - while (descendant !== null) { + else { /** - * 15.1. Run the removing steps with descendant. + * 7. Otherwise: + * 7.1. Let interface be the element interface for localName and + * namespace. + * 7.2. Set result to a new element that implements interface, with no + * attributes, namespace set to namespace, namespace prefix set to prefix, + * local name set to localName, custom element state set to + * "uncustomized", custom element definition set to null, is value set to + * is, and node document set to document. */ - if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runRemovingSteps(descendant, node); - } + var elementInterface = DocumentAlgorithm_1.document_elementInterface(localName, namespace); + result = new elementInterface(); + result._localName = localName; + result._namespace = namespace; + result._namespacePrefix = prefix; + result._customElementState = "uncustomized"; + result._customElementDefinition = null; + result._is = is; + result._nodeDocument = document; /** - * 15.2. If descendant is custom, then enqueue a custom element - * callback reaction with descendant, callback name - * "disconnectedCallback", and an empty argument list. + * 7.3. If namespace is the HTML namespace, and either localName is a + * valid custom element name or is is non-null, then set result’s + * custom element state to "undefined". */ - if (DOMImpl_1.dom.features.customElements) { - if (util_1.Guard.isCustomElementNode(descendant)) { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(descendant, "disconnectedCallback", []); - } + if (namespace === infra_1.namespace.HTML && (is !== null || + CustomElementAlgorithm_1.customElement_isValidCustomElementName(localName))) { + result._customElementState = "undefined"; } - descendant = TreeAlgorithm_1.tree_getNextDescendantNode(node, descendant, false, true); } - /** - * 16. For each inclusive ancestor inclusiveAncestor of parent, and - * then for each registered of inclusiveAncestor's registered - * observer list, if registered's options's subtree is true, - * then append a new transient registered observer whose - * observer is registered's observer, options is registered's - * options, and source is registered to node's registered - * observer list. - */ - if (DOMImpl_1.dom.features.mutationObservers) { - var inclusiveAncestor = TreeAlgorithm_1.tree_getFirstAncestorNode(parent, true); - while (inclusiveAncestor !== null) { - try { - for (var _l = (e_14 = void 0, __values(inclusiveAncestor._registeredObserverList)), _m = _l.next(); !_m.done; _m = _l.next()) { - var registered = _m.value; - if (registered.options.subtree) { - node._registeredObserverList.push({ - observer: registered.observer, - options: registered.options, - source: registered - }); - } - } - } - catch (e_14_1) { e_14 = { error: e_14_1 }; } - finally { - try { - if (_m && !_m.done && (_d = _l.return)) _d.call(_l); - } - finally { if (e_14) throw e_14.error; } - } - inclusiveAncestor = TreeAlgorithm_1.tree_getNextAncestorNode(parent, inclusiveAncestor, true); - } + /* istanbul ignore next */ + if (result === null) { + throw new Error("Unable to create element."); } /** - * 17. If suppress observers flag is unset, then queue a tree mutation - * record for parent with « », « node », oldPreviousSibling, and - * oldNextSibling. + * 8. Returns result */ - if (DOMImpl_1.dom.features.mutationObservers) { - if (!suppressObservers) { - MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, [], [node], oldPreviousSibling, oldNextSibling); - } - } + return result; +} +exports.element_createAnElement = element_createAnElement; +/** + * Inserts a new node adjacent to this element. + * + * @param element - a reference element + * @param where - a string defining where to insert the element node. + * - `beforebegin` before this element itself. + * - `afterbegin` before the first child. + * - `beforeend` after the last child. + * - `afterend` after this element itself. + * @param node - node to insert + */ +function element_insertAdjacent(element, where, node) { /** - * 18. If node is a Text node, then run the child text content change steps - * for parent. + * - "beforebegin" + * If element’s parent is null, return null. + * Return the result of pre-inserting node into element’s parent before + * element. + * - "afterbegin" + * Return the result of pre-inserting node into element before element’s + * first child. + * - "beforeend" + * Return the result of pre-inserting node into element before null. + * - "afterend" + * If element’s parent is null, return null. + * Return the result of pre-inserting node into element’s parent before element’s next sibling. + * - Otherwise + * Throw a "SyntaxError" DOMException. */ - if (DOMImpl_1.dom.features.steps) { - if (util_1.Guard.isTextNode(node)) { - DOMAlgorithm_1.dom_runChildTextContentChangeSteps(parent); - } + switch (where.toLowerCase()) { + case 'beforebegin': + if (element._parent === null) + return null; + return MutationAlgorithm_1.mutation_preInsert(node, element._parent, element); + case 'afterbegin': + return MutationAlgorithm_1.mutation_preInsert(node, element, element._firstChild); + case 'beforeend': + return MutationAlgorithm_1.mutation_preInsert(node, element, null); + case 'afterend': + if (element._parent === null) + return null; + return MutationAlgorithm_1.mutation_preInsert(node, element._parent, element._nextSibling); + default: + throw new DOMException_1.SyntaxError("Invalid 'where' argument. \"beforebegin\", \"afterbegin\", \"beforeend\" or \"afterend\" expected"); } } -exports.mutation_remove = mutation_remove; -//# sourceMappingURL=MutationAlgorithm.js.map +exports.element_insertAdjacent = element_insertAdjacent; +//# sourceMappingURL=ElementAlgorithm.js.map /***/ }), -/***/ 8157: +/***/ 28217: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -51901,1220 +51209,1126 @@ var __read = (this && this.__read) || function (o, n) { } return ar; }; +var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var util_1 = __nccwpck_require__(5282); -var infra_1 = __nccwpck_require__(4251); -var CreateAlgorithm_1 = __nccwpck_require__(7339); -var TreeAlgorithm_1 = __nccwpck_require__(6620); -var EventAlgorithm_1 = __nccwpck_require__(8217); +var DOMImpl_1 = __nccwpck_require__(14177); +var interfaces_1 = __nccwpck_require__(27305); +var util_1 = __nccwpck_require__(65282); +var CustomEventImpl_1 = __nccwpck_require__(59857); +var EventImpl_1 = __nccwpck_require__(38245); +var DOMException_1 = __nccwpck_require__(13166); +var TreeAlgorithm_1 = __nccwpck_require__(16620); +var ShadowTreeAlgorithm_1 = __nccwpck_require__(68733); +var DOMAlgorithm_1 = __nccwpck_require__(9628); /** - * Queues a mutation observer microtask to the surrounding agent’s mutation - * observers. + * Sets the canceled flag of an event. + * + * @param event - an event */ -function observer_queueAMutationObserverMicrotask() { +function event_setTheCanceledFlag(event) { + if (event._cancelable && !event._inPassiveListenerFlag) { + event._canceledFlag = true; + } +} +exports.event_setTheCanceledFlag = event_setTheCanceledFlag; +/** + * Initializes the value of an event. + * + * @param event - an event to initialize + * @param type - the type of event + * @param bubbles - whether the event propagates in reverse + * @param cancelable - whether the event can be cancelled + */ +function event_initialize(event, type, bubbles, cancelable) { + event._initializedFlag = true; + event._stopPropagationFlag = false; + event._stopImmediatePropagationFlag = false; + event._canceledFlag = false; + event._isTrusted = false; + event._target = null; + event._type = type; + event._bubbles = bubbles; + event._cancelable = cancelable; +} +exports.event_initialize = event_initialize; +/** + * Creates a new event. + * + * @param eventInterface - event interface + * @param realm - realm + */ +function event_createAnEvent(eventInterface, realm) { + if (realm === void 0) { realm = undefined; } /** - * 1. If the surrounding agent’s mutation observer microtask queued is true, - * then return. - * 2. Set the surrounding agent’s mutation observer microtask queued to true. - * 3. Queue a microtask to notify mutation observers. + * 1. If realm is not given, then set it to null. + * 2. Let dictionary be the result of converting the JavaScript value + * undefined to the dictionary type accepted by eventInterface’s + * constructor. (This dictionary type will either be EventInit or a + * dictionary that inherits from it.) + * 3. Let event be the result of running the inner event creation steps with + * eventInterface, realm, the time of the occurrence that the event is + * signaling, and dictionary. + * 4. Initialize event’s isTrusted attribute to true. + * 5. Return event. */ - var window = DOMImpl_1.dom.window; - if (window._mutationObserverMicrotaskQueued) - return; - window._mutationObserverMicrotaskQueued = true; - Promise.resolve().then(function () { observer_notifyMutationObservers(); }); + if (realm === undefined) + realm = null; + var dictionary = {}; + var event = event_innerEventCreationSteps(eventInterface, realm, new Date(), dictionary); + event._isTrusted = true; + return event; } -exports.observer_queueAMutationObserverMicrotask = observer_queueAMutationObserverMicrotask; +exports.event_createAnEvent = event_createAnEvent; /** - * Notifies the surrounding agent’s mutation observers. + * Performs event creation steps. + * + * @param eventInterface - event interface + * @param realm - realm + * @param time - time of occurrance + * @param dictionary - event attributes + * */ -function observer_notifyMutationObservers() { - var e_1, _a, e_2, _b; +function event_innerEventCreationSteps(eventInterface, realm, time, dictionary) { /** - * 1. Set the surrounding agent’s mutation observer microtask queued to false. - * 2. Let notifySet be a clone of the surrounding agent’s mutation observers. - * 3. Let signalSet be a clone of the surrounding agent’s signal slots. - * 4. Empty the surrounding agent’s signal slots. + * 1. Let event be the result of creating a new object using eventInterface. + * TODO: Implement realms + * If realm is non-null, then use that Realm; otherwise, use the default + * behavior defined in Web IDL. */ - var window = DOMImpl_1.dom.window; - window._mutationObserverMicrotaskQueued = false; - var notifySet = infra_1.set.clone(window._mutationObservers); - var signalSet = infra_1.set.clone(window._signalSlots); - infra_1.set.empty(window._signalSlots); - var _loop_1 = function (mo) { - /** - * 5.1. Let records be a clone of mo’s record queue. - * 5.2. Empty mo’s record queue. - */ - var records = infra_1.list.clone(mo._recordQueue); - infra_1.list.empty(mo._recordQueue); - /** - * 5.3. For each node of mo’s node list, remove all transient registered - * observers whose observer is mo from node’s registered observer list. + var event = new eventInterface(""); + /** + * 2. Set event’s initialized flag. + * 3. Initialize event’s timeStamp attribute to a DOMHighResTimeStamp + * representing the high resolution time from the time origin to time. + * 4. For each member → value in dictionary, if event has an attribute + * whose identifier is member, then initialize that attribute to value. + * 5. Run the event constructing steps with event. + * 6. Return event. + */ + event._initializedFlag = true; + event._timeStamp = time.getTime(); + Object.assign(event, dictionary); + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runEventConstructingSteps(event); + } + return event; +} +exports.event_innerEventCreationSteps = event_innerEventCreationSteps; +/** + * Dispatches an event to an event target. + * + * @param event - the event to dispatch + * @param target - event target + * @param legacyTargetOverrideFlag - legacy target override flag + * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns + * whether the event listener's callback threw an exception + */ +function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDidListenersThrowFlag) { + var e_1, _a, e_2, _b; + if (legacyTargetOverrideFlag === void 0) { legacyTargetOverrideFlag = false; } + if (legacyOutputDidListenersThrowFlag === void 0) { legacyOutputDidListenersThrowFlag = { value: false }; } + var clearTargets = false; + /** + * 1. Set event's dispatch flag. + */ + event._dispatchFlag = true; + /** + * 2. Let targetOverride be target, if legacy target override flag is not + * given, and target's associated Document otherwise. + * + * _Note:_ legacy target override flag is only used by HTML and only when + * target is a Window object. + */ + var targetOverride = target; + if (legacyTargetOverrideFlag) { + var doc = target._associatedDocument; + if (util_1.Guard.isDocumentNode(doc)) { + targetOverride = doc; + } + } + /** + * 3. Let activationTarget be null. + * 4. Let relatedTarget be the result of retargeting event's relatedTarget + * against target. + * 5. If target is not relatedTarget or target is event's relatedTarget, + * then: + */ + var activationTarget = null; + var relatedTarget = TreeAlgorithm_1.tree_retarget(event._relatedTarget, target); + if (target !== relatedTarget || target === event._relatedTarget) { + /** + * 5.1. Let touchTargets be a new list. + * 5.2. For each touchTarget of event's touch target list, append the + * result of retargeting touchTarget against target to touchTargets. + * 5.3. Append to an event path with event, target, targetOverride, + * relatedTarget, touchTargets, and false. + * 5.4. Let isActivationEvent be true, if event is a MouseEvent object + * and event's type attribute is "click", and false otherwise. + * 5.5. If isActivationEvent is true and target has activation behavior, + * then set activationTarget to target. + * 5.6. Let slotable be target, if target is a slotable and is assigned, + * and null otherwise. + * 5.7. Let slot-in-closed-tree be false. + * 5.8. Let parent be the result of invoking target's get the parent with + * event. */ - for (var i = 0; i < mo._nodeList.length; i++) { - var node = mo._nodeList[i]; - infra_1.list.remove(node._registeredObserverList, function (observer) { - return util_1.Guard.isTransientRegisteredObserver(observer) && observer.observer === mo; - }); + var touchTargets = []; + try { + for (var _c = __values(event._touchTargetList), _d = _c.next(); !_d.done; _d = _c.next()) { + var touchTarget = _d.value; + touchTargets.push(TreeAlgorithm_1.tree_retarget(touchTarget, target)); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + } + finally { if (e_1) throw e_1.error; } + } + event_appendToAnEventPath(event, target, targetOverride, relatedTarget, touchTargets, false); + var isActivationEvent = (util_1.Guard.isMouseEvent(event) && event._type === "click"); + if (isActivationEvent && target._activationBehavior !== undefined) { + activationTarget = target; } + var slotable = (util_1.Guard.isSlotable(target) && ShadowTreeAlgorithm_1.shadowTree_isAssigned(target)) ? + target : null; + var slotInClosedTree = false; + var parent = target._getTheParent(event); /** - * 5.4. If records is not empty, then invoke mo’s callback with « records, - * mo », and mo. If this throws an exception, then report the exception. + * 5.9. While parent is non-null: */ - if (!infra_1.list.isEmpty(records)) { + while (parent !== null && util_1.Guard.isNode(parent)) { + /** + * 5.9.1 If slotable is non-null: + * 5.9.1.1. Assert: parent is a slot. + * 5.9.1.2. Set slotable to null. + * 5.9.1.3. If parent's root is a shadow root whose mode is "closed", + * then set slot-in-closed-tree to true. + */ + if (slotable !== null) { + if (!util_1.Guard.isSlot(parent)) { + throw new Error("Parent node of a slotable should be a slot."); + } + slotable = null; + var root = TreeAlgorithm_1.tree_rootNode(parent, true); + if (util_1.Guard.isShadowRoot(root) && root._mode === "closed") { + slotInClosedTree = true; + } + } + /** + * 5.9.2 If parent is a slotable and is assigned, then set slotable to + * parent. + * 5.9.3. Let relatedTarget be the result of retargeting event's + * relatedTarget against parent. + * 5.9.4. Let touchTargets be a new list. + * 5.9.4. For each touchTarget of event's touch target list, append the + * result of retargeting touchTarget against parent to touchTargets. + */ + if (util_1.Guard.isSlotable(parent) && ShadowTreeAlgorithm_1.shadowTree_isAssigned(parent)) { + slotable = parent; + } + relatedTarget = TreeAlgorithm_1.tree_retarget(event._relatedTarget, parent); + touchTargets = []; try { - mo._callback.call(mo, records, mo); + for (var _e = (e_2 = void 0, __values(event._touchTargetList)), _f = _e.next(); !_f.done; _f = _e.next()) { + var touchTarget = _f.value; + touchTargets.push(TreeAlgorithm_1.tree_retarget(touchTarget, parent)); + } } - catch (err) { - // TODO: Report the exception + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_f && !_f.done && (_b = _e.return)) _b.call(_e); + } + finally { if (e_2) throw e_2.error; } + } + /** + * 5.9.6. If parent is a Window object, or parent is a node and target's + * root is a shadow-including inclusive ancestor of parent, then: + */ + if (util_1.Guard.isWindow(parent) || (util_1.Guard.isNode(parent) && util_1.Guard.isNode(target) && + TreeAlgorithm_1.tree_isAncestorOf(TreeAlgorithm_1.tree_rootNode(target, true), parent, true, true))) { + /** + * 5.9.6.1. If isActivationEvent is true, event's bubbles attribute + * is true, activationTarget is null, and parent has activation + * behavior, then set activationTarget to parent. + * 5.9.6.2. Append to an event path with event, parent, null, + * relatedTarget, touchTargets, and slot-in-closed-tree. + */ + if (isActivationEvent && event._bubbles && activationTarget === null && + parent._activationBehavior) { + activationTarget = parent; + } + event_appendToAnEventPath(event, parent, null, relatedTarget, touchTargets, slotInClosedTree); + } + else if (parent === relatedTarget) { + /** + * 5.9.7. Otherwise, if parent is relatedTarget, + * then set parent to null. + */ + parent = null; + } + else { + /** + * 5.9.8. Otherwise, set target to parent and then: + * 5.9.8.1. If isActivationEvent is true, activationTarget is null, + * and target has activation behavior, then set activationTarget + * to target. + * 5.9.8.2. Append to an event path with event, parent, target, + * relatedTarget, touchTargets, and slot-in-closed-tree. + */ + target = parent; + if (isActivationEvent && activationTarget === null && + target._activationBehavior) { + activationTarget = target; + } + event_appendToAnEventPath(event, parent, target, relatedTarget, touchTargets, slotInClosedTree); + } + /** + * 5.9.9. If parent is non-null, then set parent to the result of + * invoking parent's get the parent with event. + * 5.9.10. Set slot-in-closed-tree to false. + */ + if (parent !== null) { + parent = parent._getTheParent(event); } + slotInClosedTree = false; } - }; - try { /** - * 5. For each mo of notifySet: + * 5.10. Let clearTargetsStruct be the last struct in event's path whose + * shadow-adjusted target is non-null. */ - for (var notifySet_1 = __values(notifySet), notifySet_1_1 = notifySet_1.next(); !notifySet_1_1.done; notifySet_1_1 = notifySet_1.next()) { - var mo = notifySet_1_1.value; - _loop_1(mo); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (notifySet_1_1 && !notifySet_1_1.done && (_a = notifySet_1.return)) _a.call(notifySet_1); - } - finally { if (e_1) throw e_1.error; } - } - /** - * 6. For each slot of signalSet, fire an event named slotchange, with its - * bubbles attribute set to true, at slot. - */ - if (DOMImpl_1.dom.features.slots) { - try { - for (var signalSet_1 = __values(signalSet), signalSet_1_1 = signalSet_1.next(); !signalSet_1_1.done; signalSet_1_1 = signalSet_1.next()) { - var slot = signalSet_1_1.value; - EventAlgorithm_1.event_fireAnEvent("slotchange", slot, undefined, { bubbles: true }); + var clearTargetsStruct = null; + var path = event._path; + for (var i = path.length - 1; i >= 0; i--) { + var struct = path[i]; + if (struct.shadowAdjustedTarget !== null) { + clearTargetsStruct = struct; + break; } } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (signalSet_1_1 && !signalSet_1_1.done && (_b = signalSet_1.return)) _b.call(signalSet_1); + /** + * 5.11. Let clearTargets be true if clearTargetsStruct's shadow-adjusted + * target, clearTargetsStruct's relatedTarget, or an EventTarget object + * in clearTargetsStruct's touch target list is a node and its root is + * a shadow root, and false otherwise. + */ + if (clearTargetsStruct !== null) { + if (util_1.Guard.isNode(clearTargetsStruct.shadowAdjustedTarget) && + util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(clearTargetsStruct.shadowAdjustedTarget, true))) { + clearTargets = true; + } + else if (util_1.Guard.isNode(clearTargetsStruct.relatedTarget) && + util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(clearTargetsStruct.relatedTarget, true))) { + clearTargets = true; + } + else { + for (var j = 0; j < clearTargetsStruct.touchTargetList.length; j++) { + var struct = clearTargetsStruct.touchTargetList[j]; + if (util_1.Guard.isNode(struct) && + util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(struct, true))) { + clearTargets = true; + break; + } + } } - finally { if (e_2) throw e_2.error; } } - } -} -exports.observer_notifyMutationObservers = observer_notifyMutationObservers; -/** - * Queues a mutation record of the given type for target. - * - * @param type - mutation record type - * @param target - target node - * @param name - name before mutation - * @param namespace - namespace before mutation - * @param oldValue - attribute value before mutation - * @param addedNodes - a list od added nodes - * @param removedNodes - a list of removed nodes - * @param previousSibling - previous sibling of target before mutation - * @param nextSibling - next sibling of target before mutation - */ -function observer_queueMutationRecord(type, target, name, namespace, oldValue, addedNodes, removedNodes, previousSibling, nextSibling) { - var e_3, _a; - /** - * 1. Let interestedObservers be an empty map. - * 2. Let nodes be the inclusive ancestors of target. - * 3. For each node in nodes, and then for each registered of node’s - * registered observer list: - */ - var interestedObservers = new Map(); - var node = TreeAlgorithm_1.tree_getFirstAncestorNode(target, true); - while (node !== null) { - for (var i = 0; i < node._registeredObserverList.length; i++) { - var registered = node._registeredObserverList[i]; - /** - * 3.1. Let options be registered’s options. - * 3.2. If none of the following are true - * - node is not target and options’s subtree is false - * - type is "attributes" and options’s attributes is not true - * - type is "attributes", options’s attributeFilter is present, and - * options’s attributeFilter does not contain name or namespace is - * non-null - * - type is "characterData" and options’s characterData is not true - * - type is "childList" and options’s childList is false - */ - var options = registered.options; - if (node !== target && !options.subtree) - continue; - if (type === "attributes" && !options.attributes) - continue; - if (type === "attributes" && options.attributeFilter && - (!options.attributeFilter.indexOf(name || '') || namespace !== null)) - continue; - if (type === "characterData" && !options.characterData) - continue; - if (type === "childList" && !options.childList) - continue; + /** + * 5.12. If activationTarget is non-null and activationTarget has + * legacy-pre-activation behavior, then run activationTarget's + * legacy-pre-activation behavior. + */ + if (activationTarget !== null && + activationTarget._legacyPreActivationBehavior !== undefined) { + activationTarget._legacyPreActivationBehavior(event); + } + /** + * 5.13. For each struct in event's path, in reverse order: + */ + for (var i = path.length - 1; i >= 0; i--) { + var struct = path[i]; /** - * then: - * 3.2.1. Let mo be registered’s observer. - * 3.2.2. If interestedObservers[mo] does not exist, then set - * interestedObservers[mo] to null. - * 3.2.3. If either type is "attributes" and options’s attributeOldValue - * is true, or type is "characterData" and options’s - * characterDataOldValue is true, then set interestedObservers[mo] - * to oldValue. + * 5.13.1. If struct's shadow-adjusted target is non-null, then set + * event's eventPhase attribute to AT_TARGET. + * 5.13.2. Otherwise, set event's eventPhase attribute to + * CAPTURING_PHASE. + * 5.13.3. Invoke with struct, event, "capturing", and + * legacyOutputDidListenersThrowFlag if given. */ - var mo = registered.observer; - if (!interestedObservers.has(mo)) { - interestedObservers.set(mo, null); + if (struct.shadowAdjustedTarget !== null) { + event._eventPhase = interfaces_1.EventPhase.AtTarget; } - if ((type === "attributes" && options.attributeOldValue) || - (type === "characterData" && options.characterDataOldValue)) { - interestedObservers.set(mo, oldValue); + else { + event._eventPhase = interfaces_1.EventPhase.Capturing; } + event_invoke(struct, event, "capturing", legacyOutputDidListenersThrowFlag); } - node = TreeAlgorithm_1.tree_getNextAncestorNode(target, node, true); - } - try { /** - * 4. For each observer → mappedOldValue of interestedObservers: + * 5.14. For each struct in event's path */ - for (var interestedObservers_1 = __values(interestedObservers), interestedObservers_1_1 = interestedObservers_1.next(); !interestedObservers_1_1.done; interestedObservers_1_1 = interestedObservers_1.next()) { - var _b = __read(interestedObservers_1_1.value, 2), observer = _b[0], mappedOldValue = _b[1]; + for (var i = 0; i < path.length; i++) { + var struct = path[i]; /** - * 4.1. Let record be a new MutationRecord object with its type set to - * type, target set to target, attributeName set to name, - * attributeNamespace set to namespace, oldValue set to mappedOldValue, - * addedNodes set to addedNodes, removedNodes set to removedNodes, - * previousSibling set to previousSibling, and nextSibling set to - * nextSibling. - * 4.2. Enqueue record to observer’s record queue. + * 5.14.1. If struct's shadow-adjusted target is non-null, then set + * event's eventPhase attribute to AT_TARGET. + * 5.14.2. Otherwise: + * 5.14.2.1. If event's bubbles attribute is false, then continue. + * 5.14.2.2. Set event's eventPhase attribute to BUBBLING_PHASE. + * 5.14.3. Invoke with struct, event, "bubbling", and + * legacyOutputDidListenersThrowFlag if given. */ - var record = CreateAlgorithm_1.create_mutationRecord(type, target, CreateAlgorithm_1.create_nodeListStatic(target, addedNodes), CreateAlgorithm_1.create_nodeListStatic(target, removedNodes), previousSibling, nextSibling, name, namespace, mappedOldValue); - var queue = observer._recordQueue; - queue.push(record); + if (struct.shadowAdjustedTarget !== null) { + event._eventPhase = interfaces_1.EventPhase.AtTarget; + } + else { + if (!event._bubbles) + continue; + event._eventPhase = interfaces_1.EventPhase.Bubbling; + } + event_invoke(struct, event, "bubbling", legacyOutputDidListenersThrowFlag); } } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (interestedObservers_1_1 && !interestedObservers_1_1.done && (_a = interestedObservers_1.return)) _a.call(interestedObservers_1); + /** + * 6. Set event's eventPhase attribute to NONE. + * 7. Set event's currentTarget attribute to null. + * 8. Set event's path to the empty list. + * 9. Unset event's dispatch flag, stop propagation flag, and stop + * immediate propagation flag. + */ + event._eventPhase = interfaces_1.EventPhase.None; + event._currentTarget = null; + event._path = []; + event._dispatchFlag = false; + event._stopPropagationFlag = false; + event._stopImmediatePropagationFlag = false; + /** + * 10. If clearTargets, then: + * 10.1. Set event's target to null. + * 10.2. Set event's relatedTarget to null. + * 10.3. Set event's touch target list to the empty list. + */ + if (clearTargets) { + event._target = null; + event._relatedTarget = null; + event._touchTargetList = []; + } + /** + * 11. If activationTarget is non-null, then: + * 11.1. If event's canceled flag is unset, then run activationTarget's + * activation behavior with event. + * 11.2. Otherwise, if activationTarget has legacy-canceled-activation + * behavior, then run activationTarget's legacy-canceled-activation + * behavior. + */ + if (activationTarget !== null) { + if (!event._canceledFlag && activationTarget._activationBehavior !== undefined) { + activationTarget._activationBehavior(event); + } + else if (activationTarget._legacyCanceledActivationBehavior !== undefined) { + activationTarget._legacyCanceledActivationBehavior(event); } - finally { if (e_3) throw e_3.error; } } /** - * 5. Queue a mutation observer microtask. + * 12. Return false if event's canceled flag is set, and true otherwise. */ - observer_queueAMutationObserverMicrotask(); + return !event._canceledFlag; } -exports.observer_queueMutationRecord = observer_queueMutationRecord; +exports.event_dispatch = event_dispatch; /** - * Queues a tree mutation record for target. + * Appends a new struct to an event's path. * - * @param target - target node - * @param addedNodes - a list od added nodes - * @param removedNodes - a list of removed nodes - * @param previousSibling - previous sibling of target before mutation - * @param nextSibling - next sibling of target before mutation + * @param event - an event + * @param invocationTarget - the target of the invocation + * @param shadowAdjustedTarget - shadow-root adjusted event target + * @param relatedTarget - related event target + * @param touchTargets - a list of touch targets + * @param slotInClosedTree - if the target's parent is a closed shadow root */ -function observer_queueTreeMutationRecord(target, addedNodes, removedNodes, previousSibling, nextSibling) { +function event_appendToAnEventPath(event, invocationTarget, shadowAdjustedTarget, relatedTarget, touchTargets, slotInClosedTree) { /** - * To queue a tree mutation record for target with addedNodes, removedNodes, - * previousSibling, and nextSibling, queue a mutation record of "childList" - * for target with null, null, null, addedNodes, removedNodes, - * previousSibling, and nextSibling. + * 1. Let invocationTargetInShadowTree be false. + * 2. If invocationTarget is a node and its root is a shadow root, then + * set invocationTargetInShadowTree to true. */ - observer_queueMutationRecord("childList", target, null, null, null, addedNodes, removedNodes, previousSibling, nextSibling); + var invocationTargetInShadowTree = false; + if (util_1.Guard.isNode(invocationTarget) && + util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(invocationTarget))) { + invocationTargetInShadowTree = true; + } + /** + * 3. Let root-of-closed-tree be false. + * 4. If invocationTarget is a shadow root whose mode is "closed", then + * set root-of-closed-tree to true. + */ + var rootOfClosedTree = false; + if (util_1.Guard.isShadowRoot(invocationTarget) && + invocationTarget._mode === "closed") { + rootOfClosedTree = true; + } + /** + * 5. Append a new struct to event's path whose invocation target is + * invocationTarget, invocation-target-in-shadow-tree is + * invocationTargetInShadowTree, shadow-adjusted target is + * shadowAdjustedTarget, relatedTarget is relatedTarget, + * touch target list is touchTargets, root-of-closed-tree is + * root-of-closed-tree, and slot-in-closed-tree is slot-in-closed-tree. + */ + event._path.push({ + invocationTarget: invocationTarget, + invocationTargetInShadowTree: invocationTargetInShadowTree, + shadowAdjustedTarget: shadowAdjustedTarget, + relatedTarget: relatedTarget, + touchTargetList: touchTargets, + rootOfClosedTree: rootOfClosedTree, + slotInClosedTree: slotInClosedTree + }); } -exports.observer_queueTreeMutationRecord = observer_queueTreeMutationRecord; +exports.event_appendToAnEventPath = event_appendToAnEventPath; /** - * Queues an attribute mutation record for target. + * Invokes an event. * - * @param target - target node - * @param name - name before mutation - * @param namespace - namespace before mutation - * @param oldValue - attribute value before mutation + * @param struct - a struct defining event's path + * @param event - the event to invoke + * @param phase - event phase + * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns + * whether the event listener's callback threw an exception */ -function observer_queueAttributeMutationRecord(target, name, namespace, oldValue) { +function event_invoke(struct, event, phase, legacyOutputDidListenersThrowFlag) { + if (legacyOutputDidListenersThrowFlag === void 0) { legacyOutputDidListenersThrowFlag = { value: false }; } /** - * To queue an attribute mutation record for target with name, namespace, - * and oldValue, queue a mutation record of "attributes" for target with - * name, namespace, oldValue, « », « », null, and null. + * 1. Set event's target to the shadow-adjusted target of the last struct + * in event's path, that is either struct or preceding struct, whose + * shadow-adjusted target is non-null. */ - observer_queueMutationRecord("attributes", target, name, namespace, oldValue, [], [], null, null); -} -exports.observer_queueAttributeMutationRecord = observer_queueAttributeMutationRecord; -//# sourceMappingURL=MutationObserverAlgorithm.js.map - -/***/ }), - -/***/ 5856: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMException_1 = __nccwpck_require__(3166); -var infra_1 = __nccwpck_require__(4251); -var XMLAlgorithm_1 = __nccwpck_require__(7030); -/** - * Validates the given qualified name. - * - * @param qualifiedName - qualified name - */ -function namespace_validate(qualifiedName) { + var path = event._path; + var index = -1; + for (var i = 0; i < path.length; i++) { + if (path[i] === struct) { + index = i; + break; + } + } + if (index !== -1) { + var item = path[index]; + if (item.shadowAdjustedTarget !== null) { + event._target = item.shadowAdjustedTarget; + } + else if (index > 0) { + item = path[index - 1]; + if (item.shadowAdjustedTarget !== null) { + event._target = item.shadowAdjustedTarget; + } + } + } /** - * To validate a qualifiedName, throw an "InvalidCharacterError" - * DOMException if qualifiedName does not match the Name or QName - * production. + * 2. Set event's relatedTarget to struct's relatedTarget. + * 3. Set event's touch target list to struct's touch target list. + * 4. If event's stop propagation flag is set, then return. + * 5. Initialize event's currentTarget attribute to struct's invocation + * target. + * 6. Let listeners be a clone of event's currentTarget attribute value's + * event listener list. + * + * _Note:_ This avoids event listeners added after this point from being + * run. Note that removal still has an effect due to the removed field. */ - if (!XMLAlgorithm_1.xml_isName(qualifiedName)) - throw new DOMException_1.InvalidCharacterError("Invalid XML name: " + qualifiedName); - if (!XMLAlgorithm_1.xml_isQName(qualifiedName)) - throw new DOMException_1.InvalidCharacterError("Invalid XML qualified name: " + qualifiedName + "."); -} -exports.namespace_validate = namespace_validate; -/** - * Validates and extracts a namespace, prefix and localName from the - * given namespace and qualified name. - * See: https://dom.spec.whatwg.org/#validate-and-extract. - * - * @param namespace - namespace - * @param qualifiedName - qualified name - * - * @returns a tuple with `namespace`, `prefix` and `localName`. - */ -function namespace_validateAndExtract(namespace, qualifiedName) { + event._relatedTarget = struct.relatedTarget; + event._touchTargetList = struct.touchTargetList; + if (event._stopPropagationFlag) + return; + event._currentTarget = struct.invocationTarget; + var currentTarget = event._currentTarget; + var targetListeners = currentTarget._eventListenerList; + var listeners = new (Array.bind.apply(Array, __spread([void 0], targetListeners)))(); /** - * 1. If namespace is the empty string, set it to null. - * 2. Validate qualifiedName. - * 3. Let prefix be null. - * 4. Let localName be qualifiedName. - * 5. If qualifiedName contains a ":" (U+003E), then split the string on it - * and set prefix to the part before and localName to the part after. - * 6. If prefix is non-null and namespace is null, then throw a - * "NamespaceError" DOMException. - * 7. If prefix is "xml" and namespace is not the XML namespace, then throw - * a "NamespaceError" DOMException. - * 8. If either qualifiedName or prefix is "xmlns" and namespace is not the - * XMLNS namespace, then throw a "NamespaceError" DOMException. - * 9. If namespace is the XMLNS namespace and neither qualifiedName nor - * prefix is "xmlns", then throw a "NamespaceError" DOMException. - * 10. Return namespace, prefix, and localName. + * 7. Let found be the result of running inner invoke with event, listeners, + * phase, and legacyOutputDidListenersThrowFlag if given. */ - if (!namespace) - namespace = null; - namespace_validate(qualifiedName); - var parts = qualifiedName.split(':'); - var prefix = (parts.length === 2 ? parts[0] : null); - var localName = (parts.length === 2 ? parts[1] : qualifiedName); - if (prefix && namespace === null) - throw new DOMException_1.NamespaceError("Qualified name includes a prefix but the namespace is null."); - if (prefix === "xml" && namespace !== infra_1.namespace.XML) - throw new DOMException_1.NamespaceError("Qualified name includes the \"xml\" prefix but the namespace is not the XML namespace."); - if (namespace !== infra_1.namespace.XMLNS && - (prefix === "xmlns" || qualifiedName === "xmlns")) - throw new DOMException_1.NamespaceError("Qualified name includes the \"xmlns\" prefix but the namespace is not the XMLNS namespace."); - if (namespace === infra_1.namespace.XMLNS && - (prefix !== "xmlns" && qualifiedName !== "xmlns")) - throw new DOMException_1.NamespaceError("Qualified name does not include the \"xmlns\" prefix but the namespace is the XMLNS namespace."); - return [namespace, prefix, localName]; -} -exports.namespace_validateAndExtract = namespace_validateAndExtract; -/** - * Extracts a prefix and localName from the given qualified name. - * - * @param qualifiedName - qualified name - * - * @returns an tuple with `prefix` and `localName`. - */ -function namespace_extractQName(qualifiedName) { - namespace_validate(qualifiedName); - var parts = qualifiedName.split(':'); - var prefix = (parts.length === 2 ? parts[0] : null); - var localName = (parts.length === 2 ? parts[1] : qualifiedName); - return [prefix, localName]; -} -exports.namespace_extractQName = namespace_extractQName; -//# sourceMappingURL=NamespaceAlgorithm.js.map - -/***/ }), - -/***/ 4924: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var util_1 = __nccwpck_require__(5282); -var infra_1 = __nccwpck_require__(4251); -var CreateAlgorithm_1 = __nccwpck_require__(7339); -var OrderedSetAlgorithm_1 = __nccwpck_require__(3670); -var DOMAlgorithm_1 = __nccwpck_require__(9628); -var MutationAlgorithm_1 = __nccwpck_require__(5463); -var ElementAlgorithm_1 = __nccwpck_require__(1849); -/** - * Replaces the contents of the given node with a single text node. - * - * @param string - node contents - * @param parent - a node - */ -function node_stringReplaceAll(str, parent) { + var found = event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListenersThrowFlag); /** - * 1. Let node be null. - * 2. If string is not the empty string, then set node to a new Text node - * whose data is string and node document is parent’s node document. - * 3. Replace all with node within parent. + * 8. If found is false and event's isTrusted attribute is true, then: */ - var node = null; - if (str !== '') { - node = CreateAlgorithm_1.create_text(parent._nodeDocument, str); + if (!found && event._isTrusted) { + /** + * 8.1. Let originalEventType be event's type attribute value. + * 8.2. If event's type attribute value is a match for any of the strings + * in the first column in the following table, set event's type attribute + * value to the string in the second column on the same row as the matching + * string, and return otherwise. + * + * Event type | Legacy event type + * ------------------------------------------------- + * "animationend" | "webkitAnimationEnd" + * "animationiteration" | "webkitAnimationIteration" + * "animationstart" | "webkitAnimationStart" + * "transitionend" | "webkitTransitionEnd" + */ + var originalEventType = event._type; + if (originalEventType === "animationend") { + event._type = "webkitAnimationEnd"; + } + else if (originalEventType === "animationiteration") { + event._type = "webkitAnimationIteration"; + } + else if (originalEventType === "animationstart") { + event._type = "webkitAnimationStart"; + } + else if (originalEventType === "transitionend") { + event._type = "webkitTransitionEnd"; + } + /** + * 8.3. Inner invoke with event, listeners, phase, and + * legacyOutputDidListenersThrowFlag if given. + * 8.4. Set event's type attribute value to originalEventType. + */ + event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListenersThrowFlag); + event._type = originalEventType; } - MutationAlgorithm_1.mutation_replaceAll(node, parent); } -exports.node_stringReplaceAll = node_stringReplaceAll; +exports.event_invoke = event_invoke; /** - * Clones a node. + * Invokes an event. * - * @param node - a node to clone - * @param document - the document to own the cloned node - * @param cloneChildrenFlag - whether to clone node's children + * @param event - the event to invoke + * @param listeners - event listeners + * @param phase - event phase + * @param struct - a struct defining event's path + * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns + * whether the event listener's callback threw an exception */ -function node_clone(node, document, cloneChildrenFlag) { - var e_1, _a, e_2, _b; - if (document === void 0) { document = null; } - if (cloneChildrenFlag === void 0) { cloneChildrenFlag = false; } +function event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListenersThrowFlag) { + if (legacyOutputDidListenersThrowFlag === void 0) { legacyOutputDidListenersThrowFlag = { value: false }; } /** - * 1. If document is not given, let document be node’s node document. + * 1. Let found be false. + * 2. For each listener in listeners, whose removed is false: */ - if (document === null) - document = node._nodeDocument; - var copy; - if (util_1.Guard.isElementNode(node)) { - /** - * 2. If node is an element, then: - * 2.1. Let copy be the result of creating an element, given document, - * node’s local name, node’s namespace, node’s namespace prefix, - * and node’s is value, with the synchronous custom elements flag unset. - * 2.2. For each attribute in node’s attribute list: - * 2.2.1. Let copyAttribute be a clone of attribute. - * 2.2.2. Append copyAttribute to copy. - */ - copy = ElementAlgorithm_1.element_createAnElement(document, node._localName, node._namespace, node._namespacePrefix, node._is, false); - try { - for (var _c = __values(node._attributeList), _d = _c.next(); !_d.done; _d = _c.next()) { - var attribute = _d.value; - var copyAttribute = node_clone(attribute, document); - ElementAlgorithm_1.element_append(copyAttribute, copy); + var found = false; + for (var i = 0; i < listeners.length; i++) { + var listener = listeners[i]; + if (!listener.removed) { + /** + * 2.1. If event's type attribute value is not listener's type, then + * continue. + * 2.2. Set found to true. + * 2.3. If phase is "capturing" and listener's capture is false, then + * continue. + * 2.4. If phase is "bubbling" and listener's capture is true, then + * continue. + */ + if (event._type !== listener.type) + continue; + found = true; + if (phase === "capturing" && !listener.capture) + continue; + if (phase === "bubbling" && listener.capture) + continue; + /** + * 2.5. If listener's once is true, then remove listener from event's + * currentTarget attribute value's event listener list. + */ + if (listener.once && event._currentTarget !== null) { + var impl = event._currentTarget; + var index = -1; + for (var i_1 = 0; i_1 < impl._eventListenerList.length; i_1++) { + if (impl._eventListenerList[i_1] === listener) { + index = i_1; + break; + } + } + if (index !== -1) { + impl._eventListenerList.splice(index, 1); + } } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { + /** + * TODO: Implement realms + * + * 2.6. Let global be listener callback's associated Realm's global + * object. + */ + var globalObject = undefined; + /** + * 2.7. Let currentEvent be undefined. + * 2.8. If global is a Window object, then: + * 2.8.1. Set currentEvent to global's current event. + * 2.8.2. If struct's invocation-target-in-shadow-tree is false, then + * set global's current event to event. + */ + var currentEvent = undefined; + if (util_1.Guard.isWindow(globalObject)) { + currentEvent = globalObject._currentEvent; + if (struct.invocationTargetInShadowTree === false) { + globalObject._currentEvent = event; + } + } + /** + * 2.9. If listener's passive is true, then set event's in passive + * listener flag. + * 2.10. Call a user object's operation with listener's callback, + * "handleEvent", « event », and event's currentTarget attribute value. + */ + if (listener.passive) + event._inPassiveListenerFlag = true; try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + listener.callback.handleEvent.call(event._currentTarget, event); } - finally { if (e_1) throw e_1.error; } - } - } - else { - /** - * 3. Otherwise, let copy be a node that implements the same interfaces as - * node, and fulfills these additional requirements, switching on node: - * - Document - * Set copy’s encoding, content type, URL, origin, type, and mode, to those - * of node. - * - DocumentType - * Set copy’s name, public ID, and system ID, to those of node. - * - Attr - * Set copy’s namespace, namespace prefix, local name, and value, to - * those of node. - * - Text - * - Comment - * Set copy’s data, to that of node. - * - ProcessingInstruction - * Set copy’s target and data to those of node. - * - Any other node - */ - if (util_1.Guard.isDocumentNode(node)) { - var doc = CreateAlgorithm_1.create_document(); - doc._encoding = node._encoding; - doc._contentType = node._contentType; - doc._URL = node._URL; - doc._origin = node._origin; - doc._type = node._type; - doc._mode = node._mode; - copy = doc; - } - else if (util_1.Guard.isDocumentTypeNode(node)) { - var doctype = CreateAlgorithm_1.create_documentType(document, node._name, node._publicId, node._systemId); - copy = doctype; - } - else if (util_1.Guard.isAttrNode(node)) { - var attr = CreateAlgorithm_1.create_attr(document, node.localName); - attr._namespace = node._namespace; - attr._namespacePrefix = node._namespacePrefix; - attr._value = node._value; - copy = attr; - } - else if (util_1.Guard.isExclusiveTextNode(node)) { - copy = CreateAlgorithm_1.create_text(document, node._data); - } - else if (util_1.Guard.isCDATASectionNode(node)) { - copy = CreateAlgorithm_1.create_cdataSection(document, node._data); - } - else if (util_1.Guard.isCommentNode(node)) { - copy = CreateAlgorithm_1.create_comment(document, node._data); - } - else if (util_1.Guard.isProcessingInstructionNode(node)) { - copy = CreateAlgorithm_1.create_processingInstruction(document, node._target, node._data); - } - else if (util_1.Guard.isDocumentFragmentNode(node)) { - copy = CreateAlgorithm_1.create_documentFragment(document); - } - else { - copy = Object.create(node); + catch (err) { + /** + * If this throws an exception, then: + * 2.10.1. Report the exception. + * 2.10.2. Set legacyOutputDidListenersThrowFlag if given. + * + * _Note:_ The legacyOutputDidListenersThrowFlag is only used by + * Indexed Database API. + * TODO: Report the exception + * See: https://html.spec.whatwg.org/multipage/webappapis.html#runtime-script-errors-in-documents + */ + legacyOutputDidListenersThrowFlag.value = true; + } + /** + * 2.11. Unset event's in passive listener flag. + */ + if (listener.passive) + event._inPassiveListenerFlag = false; + /** + * 2.12. If global is a Window object, then set global's current event + * to currentEvent. + */ + if (util_1.Guard.isWindow(globalObject)) { + globalObject._currentEvent = currentEvent; + } + /** + * 2.13. If event's stop immediate propagation flag is set, then return + * found. + */ + if (event._stopImmediatePropagationFlag) + return found; } } /** - * 4. Set copy’s node document and document to copy, if copy is a document, - * and set copy’s node document to document otherwise. + * 3. Return found. */ - if (util_1.Guard.isDocumentNode(copy)) { - copy._nodeDocument = copy; - document = copy; - } - else { - copy._nodeDocument = document; - } + return found; +} +exports.event_innerInvoke = event_innerInvoke; +/** + * Fires an event at target. + * @param e - event name + * @param target - event target + * @param eventConstructor - an event constructor, with a description of how + * IDL attributes are to be initialized + * @param idlAttributes - a dictionary describing how IDL attributes are + * to be initialized + * @param legacyTargetOverrideFlag - legacy target override flag + */ +function event_fireAnEvent(e, target, eventConstructor, idlAttributes, legacyTargetOverrideFlag) { /** - * 5. Run any cloning steps defined for node in other applicable - * specifications and pass copy, node, document and the clone children flag - * if set, as parameters. + * 1. If eventConstructor is not given, then let eventConstructor be Event. */ - if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runCloningSteps(copy, node, document, cloneChildrenFlag); + if (eventConstructor === undefined) { + eventConstructor = EventImpl_1.EventImpl; } /** - * 6. If the clone children flag is set, clone all the children of node and - * append them to copy, with document as specified and the clone children - * flag being set. + * 2. Let event be the result of creating an event given eventConstructor, + * in the relevant Realm of target. */ - if (cloneChildrenFlag) { - try { - for (var _e = __values(node._children), _f = _e.next(); !_f.done; _f = _e.next()) { - var child = _f.value; - var childCopy = node_clone(child, document, true); - MutationAlgorithm_1.mutation_append(childCopy, copy); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_f && !_f.done && (_b = _e.return)) _b.call(_e); - } - finally { if (e_2) throw e_2.error; } + var event = event_createAnEvent(eventConstructor); + /** + * 3. Initialize event’s type attribute to e. + */ + event._type = e; + /** + * 4. Initialize any other IDL attributes of event as described in the + * invocation of this algorithm. + * _Note:_ This also allows for the isTrusted attribute to be set to false. + */ + if (idlAttributes) { + for (var key in idlAttributes) { + var idlObj = event; + idlObj[key] = idlAttributes[key]; } } /** - * 7. Return copy. + * 5. Return the result of dispatching event at target, with legacy target + * override flag set if set. */ - return copy; + return event_dispatch(event, target, legacyTargetOverrideFlag); } -exports.node_clone = node_clone; +exports.event_fireAnEvent = event_fireAnEvent; /** - * Determines if two nodes can be considered equal. + * Creates an event. * - * @param a - node to compare - * @param b - node to compare + * @param eventInterface - the name of the event interface */ -function node_equals(a, b) { - var e_3, _a, e_4, _b; +function event_createLegacyEvent(eventInterface) { /** - * 1. A and B’s nodeType attribute value is identical. + * 1. Let constructor be null. */ - if (a._nodeType !== b._nodeType) - return false; + var constructor = null; /** - * 2. The following are also equal, depending on A: - * - DocumentType - * Its name, public ID, and system ID. - * - Element - * Its namespace, namespace prefix, local name, and its attribute list’s size. - * - Attr - * Its namespace, local name, and value. - * - ProcessingInstruction - * Its target and data. - * - Text - * - Comment - * Its data. - */ - if (util_1.Guard.isDocumentTypeNode(a) && util_1.Guard.isDocumentTypeNode(b)) { - if (a._name !== b._name || a._publicId !== b._publicId || - a._systemId !== b._systemId) - return false; - } - else if (util_1.Guard.isElementNode(a) && util_1.Guard.isElementNode(b)) { - if (a._namespace !== b._namespace || a._namespacePrefix !== b._namespacePrefix || - a._localName !== b._localName || - a._attributeList.length !== b._attributeList.length) - return false; - } - else if (util_1.Guard.isAttrNode(a) && util_1.Guard.isAttrNode(b)) { - if (a._namespace !== b._namespace || a._localName !== b._localName || - a._value !== b._value) - return false; - } - else if (util_1.Guard.isProcessingInstructionNode(a) && util_1.Guard.isProcessingInstructionNode(b)) { - if (a._target !== b._target || a._data !== b._data) - return false; - } - else if (util_1.Guard.isCharacterDataNode(a) && util_1.Guard.isCharacterDataNode(b)) { - if (a._data !== b._data) - return false; + * TODO: Implement in HTML DOM + * 2. If interface is an ASCII case-insensitive match for any of the strings + * in the first column in the following table, then set constructor to the + * interface in the second column on the same row as the matching string: + * + * String | Interface + * -------|---------- + * "beforeunloadevent" | BeforeUnloadEvent + * "compositionevent" | CompositionEvent + * "customevent" | CustomEvent + * "devicemotionevent" | DeviceMotionEvent + * "deviceorientationevent" | DeviceOrientationEvent + * "dragevent" | DragEvent + * "event" | Event + * "events" | Event + * "focusevent" | FocusEvent + * "hashchangeevent" | HashChangeEvent + * "htmlevents" | Event + * "keyboardevent" | KeyboardEvent + * "messageevent" | MessageEvent + * "mouseevent" | MouseEvent + * "mouseevents" | + * "storageevent" | StorageEvent + * "svgevents" | Event + * "textevent" | CompositionEvent + * "touchevent" | TouchEvent + * "uievent" | UIEvent + * "uievents" | UIEvent + */ + switch (eventInterface.toLowerCase()) { + case "beforeunloadevent": + break; + case "compositionevent": + break; + case "customevent": + constructor = CustomEventImpl_1.CustomEventImpl; + break; + case "devicemotionevent": + break; + case "deviceorientationevent": + break; + case "dragevent": + break; + case "event": + case "events": + constructor = EventImpl_1.EventImpl; + break; + case "focusevent": + break; + case "hashchangeevent": + break; + case "htmlevents": + break; + case "keyboardevent": + break; + case "messageevent": + break; + case "mouseevent": + break; + case "mouseevents": + break; + case "storageevent": + break; + case "svgevents": + break; + case "textevent": + break; + case "touchevent": + break; + case "uievent": + break; + case "uievents": + break; } /** - * 3. If A is an element, each attribute in its attribute list has an attribute - * that equals an attribute in B’s attribute list. + * 3. If constructor is null, then throw a "NotSupportedError" DOMException. */ - if (util_1.Guard.isElementNode(a) && util_1.Guard.isElementNode(b)) { - var attrMap = {}; - try { - for (var _c = __values(a._attributeList), _d = _c.next(); !_d.done; _d = _c.next()) { - var attrA = _d.value; - attrMap[attrA._localName] = attrA; - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); - } - finally { if (e_3) throw e_3.error; } - } - try { - for (var _e = __values(b._attributeList), _f = _e.next(); !_f.done; _f = _e.next()) { - var attrB = _f.value; - var attrA = attrMap[attrB._localName]; - if (!attrA) - return false; - if (!node_equals(attrA, attrB)) - return false; - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (_f && !_f.done && (_b = _e.return)) _b.call(_e); - } - finally { if (e_4) throw e_4.error; } - } + if (constructor === null) { + throw new DOMException_1.NotSupportedError("Event constructor not found for interface " + eventInterface + "."); } /** - * 4. A and B have the same number of children. - * 5. Each child of A equals the child of B at the identical index. + * 4. If the interface indicated by constructor is not exposed on the + * relevant global object of the context object, then throw a + * "NotSupportedError" DOMException. + * _Note:_ Typically user agents disable support for touch events in some + * configurations, in which case this clause would be triggered for the + * interface TouchEvent. */ - if (a._children.size !== b._children.size) - return false; - var itA = a._children[Symbol.iterator](); - var itB = b._children[Symbol.iterator](); - var resultA = itA.next(); - var resultB = itB.next(); - while (!resultA.done && !resultB.done) { - var child1 = resultA.value; - var child2 = resultB.value; - if (!node_equals(child1, child2)) - return false; - resultA = itA.next(); - resultB = itB.next(); - } - return true; + // TODO: Implement realms + /** + * 5. Let event be the result of creating an event given constructor. + * 6. Initialize event’s type attribute to the empty string. + * 7. Initialize event’s timeStamp attribute to a DOMHighResTimeStamp + * representing the high resolution time from the time origin to now. + * 8. Initialize event’s isTrusted attribute to false. + * 9. Unset event’s initialized flag. + */ + var event = new constructor(""); + event._type = ""; + event._timeStamp = new Date().getTime(); + event._isTrusted = false; + event._initializedFlag = false; + /** + * 10. Return event. + */ + return event; } -exports.node_equals = node_equals; +exports.event_createLegacyEvent = event_createLegacyEvent; /** - * Returns a collection of elements with the given qualified name which are - * descendants of the given root node. - * See: https://dom.spec.whatwg.org/#concept-getelementsbytagname + * Getter of an event handler IDL attribute. * - * @param qualifiedName - qualified name - * @param root - root node + * @param eventTarget - event target + * @param name - event name */ -function node_listOfElementsWithQualifiedName(qualifiedName, root) { +function event_getterEventHandlerIDLAttribute(thisObj, name) { /** - * 1. If qualifiedName is "*" (U+002A), return a HTMLCollection rooted at - * root, whose filter matches only descendant elements. - * 2. Otherwise, if root’s node document is an HTML document, return a - * HTMLCollection rooted at root, whose filter matches the following - * descendant elements: - * 2.1. Whose namespace is the HTML namespace and whose qualified name is - * qualifiedName, in ASCII lowercase. - * 2.2. Whose namespace is not the HTML namespace and whose qualified name - * is qualifiedName. - * 3. Otherwise, return a HTMLCollection rooted at root, whose filter - * matches descendant elements whose qualified name is qualifiedName. + * 1. Let eventTarget be the result of determining the target of an event + * handler given this object and name. + * 2. If eventTarget is null, then return null. + * 3. Return the result of getting the current value of the event handler + * given eventTarget and name. */ - if (qualifiedName === "*") { - return CreateAlgorithm_1.create_htmlCollection(root); - } - else if (root._nodeDocument._type === "html") { - return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { - if (ele._namespace === infra_1.namespace.HTML && - ele._qualifiedName === qualifiedName.toLowerCase()) { - return true; - } - else if (ele._namespace !== infra_1.namespace.HTML && - ele._qualifiedName === qualifiedName) { - return true; - } - else { - return false; - } - }); + var eventTarget = event_determineTheTargetOfAnEventHandler(thisObj, name); + if (eventTarget === null) + return null; + return event_getTheCurrentValueOfAnEventHandler(eventTarget, name); +} +exports.event_getterEventHandlerIDLAttribute = event_getterEventHandlerIDLAttribute; +/** + * Setter of an event handler IDL attribute. + * + * @param eventTarget - event target + * @param name - event name + * @param value - event handler + */ +function event_setterEventHandlerIDLAttribute(thisObj, name, value) { + /** + * 1. Let eventTarget be the result of determining the target of an event + * handler given this object and name. + * 2. If eventTarget is null, then return. + * 3. If the given value is null, then deactivate an event handler given + * eventTarget and name. + * 4. Otherwise: + * 4.1. Let handlerMap be eventTarget's event handler map. + * 4.2. Let eventHandler be handlerMap[name]. + * 4.3. Set eventHandler's value to the given value. + * 4.4. Activate an event handler given eventTarget and name. + */ + var eventTarget = event_determineTheTargetOfAnEventHandler(thisObj, name); + if (eventTarget === null) + return; + if (value === null) { + event_deactivateAnEventHandler(eventTarget, name); } else { - return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { - return (ele._qualifiedName === qualifiedName); - }); + var handlerMap = eventTarget._eventHandlerMap; + var eventHandler = handlerMap["onabort"]; + if (eventHandler !== undefined) { + eventHandler.value = value; + } + event_activateAnEventHandler(eventTarget, name); } } -exports.node_listOfElementsWithQualifiedName = node_listOfElementsWithQualifiedName; +exports.event_setterEventHandlerIDLAttribute = event_setterEventHandlerIDLAttribute; /** - * Returns a collection of elements with the given namespace which are - * descendants of the given root node. - * See: https://dom.spec.whatwg.org/#concept-getelementsbytagnamens + * Determines the target of an event handler. * - * @param namespace - element namespace - * @param localName - local name - * @param root - root node + * @param eventTarget - event target + * @param name - event name */ -function node_listOfElementsWithNamespace(namespace, localName, root) { +function event_determineTheTargetOfAnEventHandler(eventTarget, name) { + // TODO: Implement in HTML DOM + return null; +} +exports.event_determineTheTargetOfAnEventHandler = event_determineTheTargetOfAnEventHandler; +/** + * Gets the current value of an event handler. + * + * @param eventTarget - event target + * @param name - event name + */ +function event_getTheCurrentValueOfAnEventHandler(eventTarget, name) { + // TODO: Implement in HTML DOM + return null; +} +exports.event_getTheCurrentValueOfAnEventHandler = event_getTheCurrentValueOfAnEventHandler; +/** + * Activates an event handler. + * + * @param eventTarget - event target + * @param name - event name + */ +function event_activateAnEventHandler(eventTarget, name) { + // TODO: Implement in HTML DOM +} +exports.event_activateAnEventHandler = event_activateAnEventHandler; +/** + * Deactivates an event handler. + * + * @param eventTarget - event target + * @param name - event name + */ +function event_deactivateAnEventHandler(eventTarget, name) { + // TODO: Implement in HTML DOM +} +exports.event_deactivateAnEventHandler = event_deactivateAnEventHandler; +//# sourceMappingURL=EventAlgorithm.js.map + +/***/ }), + +/***/ 21312: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var util_1 = __nccwpck_require__(76195); +/** + * Flattens the given options argument. + * + * @param options - options argument + */ +function eventTarget_flatten(options) { /** - * 1. If namespace is the empty string, set it to null. - * 2. If both namespace and localName are "*" (U+002A), return a - * HTMLCollection rooted at root, whose filter matches descendant elements. - * 3. Otherwise, if namespace is "*" (U+002A), return a HTMLCollection - * rooted at root, whose filter matches descendant elements whose local - * name is localName. - * 4. Otherwise, if localName is "*" (U+002A), return a HTMLCollection - * rooted at root, whose filter matches descendant elements whose - * namespace is namespace. - * 5. Otherwise, return a HTMLCollection rooted at root, whose filter - * matches descendant elements whose namespace is namespace and local - * name is localName. + * 1. If options is a boolean, then return options. + * 2. Return options’s capture. */ - if (namespace === '') - namespace = null; - if (namespace === "*" && localName === "*") { - return CreateAlgorithm_1.create_htmlCollection(root); - } - else if (namespace === "*") { - return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { - return (ele._localName === localName); - }); - } - else if (localName === "*") { - return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { - return (ele._namespace === namespace); - }); + if (util_1.isBoolean(options)) { + return options; } else { - return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { - return (ele._localName === localName && ele._namespace === namespace); - }); + return options.capture || false; } } -exports.node_listOfElementsWithNamespace = node_listOfElementsWithNamespace; +exports.eventTarget_flatten = eventTarget_flatten; /** - * Returns a collection of elements with the given class names which are - * descendants of the given root node. - * See: https://dom.spec.whatwg.org/#concept-getelementsbyclassname + * Flattens the given options argument. * - * @param namespace - element namespace - * @param localName - local name - * @param root - root node + * @param options - options argument */ -function node_listOfElementsWithClassNames(classNames, root) { +function eventTarget_flattenMore(options) { /** - * 1. Let classes be the result of running the ordered set parser - * on classNames. - * 2. If classes is the empty set, return an empty HTMLCollection. - * 3. Return a HTMLCollection rooted at root, whose filter matches - * descendant elements that have all their classes in classes. - * The comparisons for the classes must be done in an ASCII case-insensitive - * manner if root’s node document’s mode is "quirks", and in a - * case-sensitive manner otherwise. + * 1. Let capture be the result of flattening options. + * 2. Let once and passive be false. + * 3. If options is a dictionary, then set passive to options’s passive and + * once to options’s once. + * 4. Return capture, passive, and once. */ - var classes = OrderedSetAlgorithm_1.orderedSet_parse(classNames); - if (classes.size === 0) { - return CreateAlgorithm_1.create_htmlCollection(root, function () { return false; }); + var capture = eventTarget_flatten(options); + var once = false; + var passive = false; + if (!util_1.isBoolean(options)) { + once = options.once || false; + passive = options.passive || false; } - var caseSensitive = (root._nodeDocument._mode !== "quirks"); - return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { - var eleClasses = ele.classList; - return OrderedSetAlgorithm_1.orderedSet_contains(eleClasses._tokenSet, classes, caseSensitive); - }); + return [capture, passive, once]; } -exports.node_listOfElementsWithClassNames = node_listOfElementsWithClassNames; +exports.eventTarget_flattenMore = eventTarget_flattenMore; /** - * Searches for a namespace prefix associated with the given namespace - * starting from the given element through its ancestors. + * Adds a new event listener. * - * @param element - an element node to start searching at - * @param namespace - namespace to search for + * @param eventTarget - event target + * @param listener - event listener */ -function node_locateANamespacePrefix(element, namespace) { +function eventTarget_addEventListener(eventTarget, listener) { /** - * 1. If element’s namespace is namespace and its namespace prefix is not - * null, then return its namespace prefix. + * 1. If eventTarget is a ServiceWorkerGlobalScope object, its service + * worker’s script resource’s has ever been evaluated flag is set, and + * listener’s type matches the type attribute value of any of the service + * worker events, then report a warning to the console that this might not + * give the expected results. [SERVICE-WORKERS] */ - if (element._namespace === namespace && element._namespacePrefix !== null) { - return element._namespacePrefix; - } + // TODO: service worker /** - * 2. If element has an attribute whose namespace prefix is "xmlns" and - * value is namespace, then return element’s first such attribute’s - * local name. + * 2. If listener’s callback is null, then return. */ - for (var i = 0; i < element._attributeList.length; i++) { - var attr = element._attributeList[i]; - if (attr._namespacePrefix === "xmlns" && attr._value === namespace) { - return attr._localName; + if (listener.callback === null) + return; + /** + * 3. If eventTarget’s event listener list does not contain an event listener + * whose type is listener’s type, callback is listener’s callback, and capture + * is listener’s capture, then append listener to eventTarget’s event listener + * list. + */ + for (var i = 0; i < eventTarget._eventListenerList.length; i++) { + var entry = eventTarget._eventListenerList[i]; + if (entry.type === listener.type && entry.callback.handleEvent === listener.callback.handleEvent + && entry.capture === listener.capture) { + return; } } + eventTarget._eventListenerList.push(listener); +} +exports.eventTarget_addEventListener = eventTarget_addEventListener; +/** + * Removes an event listener. + * + * @param eventTarget - event target + * @param listener - event listener + */ +function eventTarget_removeEventListener(eventTarget, listener, index) { /** - * 3. If element’s parent element is not null, then return the result of - * running locate a namespace prefix on that element using namespace. + * 1. If eventTarget is a ServiceWorkerGlobalScope object and its service + * worker’s set of event types to handle contains type, then report a + * warning to the console that this might not give the expected results. + * [SERVICE-WORKERS] */ - if (element._parent && util_1.Guard.isElementNode(element._parent)) { - return node_locateANamespacePrefix(element._parent, namespace); - } + // TODO: service worker /** - * 4. Return null. + * 2. Set listener’s removed to true and remove listener from eventTarget’s + * event listener list. */ - return null; + listener.removed = true; + eventTarget._eventListenerList.splice(index, 1); } -exports.node_locateANamespacePrefix = node_locateANamespacePrefix; +exports.eventTarget_removeEventListener = eventTarget_removeEventListener; /** - * Searches for a namespace associated with the given namespace prefix - * starting from the given node through its ancestors. + * Removes all event listeners. * - * @param node - a node to start searching at - * @param prefix - namespace prefix to search for + * @param eventTarget - event target */ -function node_locateANamespace(node, prefix) { - if (util_1.Guard.isElementNode(node)) { - /** - * 1. If its namespace is not null and its namespace prefix is prefix, - * then return namespace. - */ - if (node._namespace !== null && node._namespacePrefix === prefix) { - return node._namespace; - } - /** - * 2. If it has an attribute whose namespace is the XMLNS namespace, - * namespace prefix is "xmlns", and local name is prefix, or if prefix - * is null and it has an attribute whose namespace is the XMLNS namespace, - * namespace prefix is null, and local name is "xmlns", then return its - * value if it is not the empty string, and null otherwise. - */ - for (var i = 0; i < node._attributeList.length; i++) { - var attr = node._attributeList[i]; - if (attr._namespace === infra_1.namespace.XMLNS && - attr._namespacePrefix === "xmlns" && - attr._localName === prefix) { - return attr._value || null; - } - if (prefix === null && attr._namespace === infra_1.namespace.XMLNS && - attr._namespacePrefix === null && attr._localName === "xmlns") { - return attr._value || null; - } - } - /** - * 3. If its parent element is null, then return null. - */ - if (node.parentElement === null) - return null; - /** - * 4. Return the result of running locate a namespace on its parent - * element using prefix. - */ - return node_locateANamespace(node.parentElement, prefix); - } - else if (util_1.Guard.isDocumentNode(node)) { - /** - * 1. If its document element is null, then return null. - * 2. Return the result of running locate a namespace on its document - * element using prefix. - */ - if (node.documentElement === null) - return null; - return node_locateANamespace(node.documentElement, prefix); - } - else if (util_1.Guard.isDocumentTypeNode(node) || util_1.Guard.isDocumentFragmentNode(node)) { - return null; - } - else if (util_1.Guard.isAttrNode(node)) { - /** - * 1. If its element is null, then return null. - * 2. Return the result of running locate a namespace on its element - * using prefix. - */ - if (node._element === null) - return null; - return node_locateANamespace(node._element, prefix); - } - else { - /** - * 1. If its parent element is null, then return null. - * 2. Return the result of running locate a namespace on its parent - * element using prefix. - */ - if (!node._parent || !util_1.Guard.isElementNode(node._parent)) - return null; - return node_locateANamespace(node._parent, prefix); - } -} -exports.node_locateANamespace = node_locateANamespace; -//# sourceMappingURL=NodeAlgorithm.js.map - -/***/ }), - -/***/ 3973: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var interfaces_1 = __nccwpck_require__(7305); -var TraversalAlgorithm_1 = __nccwpck_require__(998); -var TreeAlgorithm_1 = __nccwpck_require__(6620); -/** - * Returns the next or previous node in the subtree, or `null` if - * there are none. - * - * @param iterator - the `NodeIterator` instance - * @param forward- `true` to return the next node, or `false` to - * return the previous node. - */ -function nodeIterator_traverse(iterator, forward) { - /** - * 1. Let node be iterator’s reference. - * 2. Let beforeNode be iterator’s pointer before reference. - */ - var node = iterator._reference; - var beforeNode = iterator._pointerBeforeReference; - /** - * 3. While true: - */ - while (true) { - /** - * 3.1. Branch on direction: - */ - if (forward) { - /** - * - next - */ - if (!beforeNode) { - /** - * If beforeNode is false, then set node to the first node following - * node in iterator’s iterator collection. If there is no such node, - * then return null. - */ - var nextNode = TreeAlgorithm_1.tree_getFollowingNode(iterator._root, node); - if (nextNode) { - node = nextNode; - } - else { - return null; - } - } - else { - /** - * If beforeNode is true, then set it to false. - */ - beforeNode = false; - } - } - else { - /** - * - previous - */ - if (beforeNode) { - /** - * If beforeNode is true, then set node to the first node preceding - * node in iterator’s iterator collection. If there is no such node, - * then return null. - */ - var prevNode = TreeAlgorithm_1.tree_getPrecedingNode(iterator.root, node); - if (prevNode) { - node = prevNode; - } - else { - return null; - } - } - else { - /** - * If beforeNode is false, then set it to true. - */ - beforeNode = true; - } - } - /** - * 3.2. Let result be the result of filtering node within iterator. - * 3.3. If result is FILTER_ACCEPT, then break. - */ - var result = TraversalAlgorithm_1.traversal_filter(iterator, node); - if (result === interfaces_1.FilterResult.Accept) { - break; - } - } - /** - * 4. Set iterator’s reference to node. - * 5. Set iterator’s pointer before reference to beforeNode. - * 6. Return node. - */ - iterator._reference = node; - iterator._pointerBeforeReference = beforeNode; - return node; -} -exports.nodeIterator_traverse = nodeIterator_traverse; -/** - * Gets the global iterator list. - */ -function nodeIterator_iteratorList() { - return DOMImpl_1.dom.window._iteratorList; -} -exports.nodeIterator_iteratorList = nodeIterator_iteratorList; -//# sourceMappingURL=NodeIteratorAlgorithm.js.map - -/***/ }), - -/***/ 3670: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var infra_1 = __nccwpck_require__(4251); -/** - * Converts a whitespace separated string into an array of tokens. - * - * @param value - a string of whitespace separated tokens - */ -function orderedSet_parse(value) { - /** - * 1. Let inputTokens be the result of splitting input on ASCII whitespace. - * 2. Let tokens be a new ordered set. - * 3. For each token in inputTokens, append token to tokens. - * 4. Return tokens. - */ - var inputTokens = infra_1.string.splitAStringOnASCIIWhitespace(value); - return new Set(inputTokens); -} -exports.orderedSet_parse = orderedSet_parse; -/** - * Converts an array of tokens into a space separated string. - * - * @param tokens - an array of token strings - */ -function orderedSet_serialize(tokens) { - /** - * The ordered set serializer takes a set and returns the concatenation of - * set using U+0020 SPACE. - */ - return __spread(tokens).join(' '); -} -exports.orderedSet_serialize = orderedSet_serialize; -/** - * Removes duplicate tokens and convert all whitespace characters - * to space. - * - * @param value - a string of whitespace separated tokens - */ -function orderedSet_sanitize(value) { - return orderedSet_serialize(orderedSet_parse(value)); -} -exports.orderedSet_sanitize = orderedSet_sanitize; -/** - * Determines whether a set contains the other. - * - * @param set1 - a set - * @param set1 - a set that is contained in set1 - * @param caseSensitive - whether matches are case-sensitive - */ -function orderedSet_contains(set1, set2, caseSensitive) { - var e_1, _a, e_2, _b; - try { - for (var set2_1 = __values(set2), set2_1_1 = set2_1.next(); !set2_1_1.done; set2_1_1 = set2_1.next()) { - var val2 = set2_1_1.value; - var found = false; - try { - for (var set1_1 = (e_2 = void 0, __values(set1)), set1_1_1 = set1_1.next(); !set1_1_1.done; set1_1_1 = set1_1.next()) { - var val1 = set1_1_1.value; - if (caseSensitive) { - if (val1 === val2) { - found = true; - break; - } - } - else { - if (val1.toUpperCase() === val2.toUpperCase()) { - found = true; - break; - } - } - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (set1_1_1 && !set1_1_1.done && (_b = set1_1.return)) _b.call(set1_1); - } - finally { if (e_2) throw e_2.error; } - } - if (!found) - return false; +function eventTarget_removeAllEventListeners(eventTarget) { + /** + * To remove all event listeners, given an EventTarget object eventTarget, + * for each listener of eventTarget’s event listener list, remove an event + * listener with eventTarget and listener. + */ + var e_1, _a; + try { + for (var _b = __values(eventTarget._eventListenerList), _c = _b.next(); !_c.done; _c = _b.next()) { + var e = _c.value; + e.removed = true; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { - if (set2_1_1 && !set2_1_1.done && (_a = set2_1.return)) _a.call(set2_1); + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } - return true; -} -exports.orderedSet_contains = orderedSet_contains; -//# sourceMappingURL=OrderedSetAlgorithm.js.map - -/***/ }), - -/***/ 2328: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(6195); -var CreateAlgorithm_1 = __nccwpck_require__(7339); -/** - * Converts the given nodes or strings into a node (if `nodes` has - * only one element) or a document fragment. - * - * @param nodes - the array of nodes or strings, - * @param document - owner document - */ -function parentNode_convertNodesIntoANode(nodes, document) { - var e_1, _a; - /** - * 1. Let node be null. - * 2. Replace each string in nodes with a new Text node whose data is the - * string and node document is document. - */ - var node = null; - for (var i = 0; i < nodes.length; i++) { - var item = nodes[i]; - if (util_1.isString(item)) { - var text = CreateAlgorithm_1.create_text(document, item); - nodes[i] = text; - } - } - /** - * 3. If nodes contains one node, set node to that node. - * 4. Otherwise, set node to a new DocumentFragment whose node document is - * document, and then append each node in nodes, if any, to it. - */ - if (nodes.length === 1) { - node = nodes[0]; - } - else { - node = CreateAlgorithm_1.create_documentFragment(document); - var ns = node; - try { - for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) { - var item = nodes_1_1.value; - ns.appendChild(item); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1); - } - finally { if (e_1) throw e_1.error; } - } - } - /** - * 5. Return node. - */ - return node; + eventTarget._eventListenerList.length = 0; } -exports.parentNode_convertNodesIntoANode = parentNode_convertNodesIntoANode; -//# sourceMappingURL=ParentNodeAlgorithm.js.map +exports.eventTarget_removeAllEventListeners = eventTarget_removeAllEventListeners; +//# sourceMappingURL=EventTargetAlgorithm.js.map /***/ }), -/***/ 457: +/***/ 45463: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -53151,1157 +52365,1150 @@ var __spread = (this && this.__spread) || function () { return ar; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var DOMException_1 = __nccwpck_require__(3166); -var util_1 = __nccwpck_require__(5282); -var CreateAlgorithm_1 = __nccwpck_require__(7339); -var TreeAlgorithm_1 = __nccwpck_require__(6620); -var BoundaryPointAlgorithm_1 = __nccwpck_require__(1054); -var CharacterDataAlgorithm_1 = __nccwpck_require__(9461); -var NodeAlgorithm_1 = __nccwpck_require__(4924); -var MutationAlgorithm_1 = __nccwpck_require__(5463); -var TextAlgorithm_1 = __nccwpck_require__(3512); +var DOMImpl_1 = __nccwpck_require__(14177); +var DOMException_1 = __nccwpck_require__(13166); +var interfaces_1 = __nccwpck_require__(27305); +var util_1 = __nccwpck_require__(65282); +var util_2 = __nccwpck_require__(76195); +var infra_1 = __nccwpck_require__(84251); +var CustomElementAlgorithm_1 = __nccwpck_require__(35648); +var TreeAlgorithm_1 = __nccwpck_require__(16620); +var NodeIteratorAlgorithm_1 = __nccwpck_require__(3973); +var ShadowTreeAlgorithm_1 = __nccwpck_require__(68733); +var MutationObserverAlgorithm_1 = __nccwpck_require__(78157); +var DOMAlgorithm_1 = __nccwpck_require__(9628); +var DocumentAlgorithm_1 = __nccwpck_require__(12793); /** - * Determines if the node's start boundary point is at its end boundary - * point. + * Ensures pre-insertion validity of a node into a parent before a + * child. * - * @param range - a range + * @param node - node to insert + * @param parent - parent node to receive node + * @param child - child node to insert node before */ -function range_collapsed(range) { +function mutation_ensurePreInsertionValidity(node, parent, child) { + var e_1, _a, e_2, _b, e_3, _c, e_4, _d; + var parentNodeType = parent._nodeType; + var nodeNodeType = node._nodeType; + var childNodeType = child ? child._nodeType : null; /** - * A range is collapsed if its start node is its end node and its start offset is its end offset. + * 1. If parent is not a Document, DocumentFragment, or Element node, + * throw a "HierarchyRequestError" DOMException. */ - return (range._startNode === range._endNode && range._startOffset === range._endOffset); -} -exports.range_collapsed = range_collapsed; -/** - * Gets the root node of a range. - * - * @param range - a range - */ -function range_root(range) { + if (parentNodeType !== interfaces_1.NodeType.Document && + parentNodeType !== interfaces_1.NodeType.DocumentFragment && + parentNodeType !== interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is " + parent.nodeName + "."); /** - * The root of a live range is the root of its start node. + * 2. If node is a host-including inclusive ancestor of parent, throw a + * "HierarchyRequestError" DOMException. */ - return TreeAlgorithm_1.tree_rootNode(range._startNode); -} -exports.range_root = range_root; -/** - * Determines if a node is fully contained in a range. - * - * @param node - a node - * @param range - a range - */ -function range_isContained(node, range) { + if (TreeAlgorithm_1.tree_isHostIncludingAncestorOf(parent, node, true)) + throw new DOMException_1.HierarchyRequestError("The node to be inserted cannot be an inclusive ancestor of parent node. Node is " + node.nodeName + ", parent node is " + parent.nodeName + "."); /** - * A node node is contained in a live range range if node’s root is range’s - * root, and (node, 0) is after range’s start, and (node, node’s length) is - * before range’s end. + * 3. If child is not null and its parent is not parent, then throw a + * "NotFoundError" DOMException. */ - return (TreeAlgorithm_1.tree_rootNode(node) === range_root(range) && - BoundaryPointAlgorithm_1.boundaryPoint_position([node, 0], range._start) === interfaces_1.BoundaryPosition.After && - BoundaryPointAlgorithm_1.boundaryPoint_position([node, TreeAlgorithm_1.tree_nodeLength(node)], range._end) === interfaces_1.BoundaryPosition.Before); -} -exports.range_isContained = range_isContained; -/** - * Determines if a node is partially contained in a range. - * - * @param node - a node - * @param range - a range - */ -function range_isPartiallyContained(node, range) { + if (child !== null && child._parent !== parent) + throw new DOMException_1.NotFoundError("The reference child node cannot be found under parent node. Child node is " + child.nodeName + ", parent node is " + parent.nodeName + "."); /** - * A node is partially contained in a live range if it’s an inclusive - * ancestor of the live range’s start node but not its end node, - * or vice versa. + * 4. If node is not a DocumentFragment, DocumentType, Element, Text, + * ProcessingInstruction, or Comment node, throw a "HierarchyRequestError" + * DOMException. */ - var startCheck = TreeAlgorithm_1.tree_isAncestorOf(range._startNode, node, true); - var endCheck = TreeAlgorithm_1.tree_isAncestorOf(range._endNode, node, true); - return (startCheck && !endCheck) || (!startCheck && endCheck); -} -exports.range_isPartiallyContained = range_isPartiallyContained; -/** - * Sets the start boundary point of a range. - * - * @param range - a range - * @param node - a node - * @param offset - an offset into node - */ -function range_setTheStart(range, node, offset) { + if (nodeNodeType !== interfaces_1.NodeType.DocumentFragment && + nodeNodeType !== interfaces_1.NodeType.DocumentType && + nodeNodeType !== interfaces_1.NodeType.Element && + nodeNodeType !== interfaces_1.NodeType.Text && + nodeNodeType !== interfaces_1.NodeType.ProcessingInstruction && + nodeNodeType !== interfaces_1.NodeType.CData && + nodeNodeType !== interfaces_1.NodeType.Comment) + throw new DOMException_1.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is " + node.nodeName + "."); /** - * 1. If node is a doctype, then throw an "InvalidNodeTypeError" DOMException. - * 2. If offset is greater than node’s length, then throw an "IndexSizeError" + * 5. If either node is a Text node and parent is a document, or node is a + * doctype and parent is not a document, throw a "HierarchyRequestError" * DOMException. - * 3. Let bp be the boundary point (node, offset). - * 4. If these steps were invoked as "set the start" - * 4.1. If bp is after the range’s end, or if range’s root is not equal to - * node’s root, set range’s end to bp. - * 4.2. Set range’s start to bp. */ - if (util_1.Guard.isDocumentTypeNode(node)) { - throw new DOMException_1.InvalidNodeTypeError(); - } - if (offset > TreeAlgorithm_1.tree_nodeLength(node)) { - throw new DOMException_1.IndexSizeError(); - } - var bp = [node, offset]; - if (range_root(range) !== TreeAlgorithm_1.tree_rootNode(node) || - BoundaryPointAlgorithm_1.boundaryPoint_position(bp, range._end) === interfaces_1.BoundaryPosition.After) { - range._end = bp; - } - range._start = bp; -} -exports.range_setTheStart = range_setTheStart; -/** - * Sets the end boundary point of a range. - * - * @param range - a range - * @param node - a node - * @param offset - an offset into node - */ -function range_setTheEnd(range, node, offset) { + if (nodeNodeType === interfaces_1.NodeType.Text && + parentNodeType === interfaces_1.NodeType.Document) + throw new DOMException_1.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is " + node.nodeName + "."); + if (nodeNodeType === interfaces_1.NodeType.DocumentType && + parentNodeType !== interfaces_1.NodeType.Document) + throw new DOMException_1.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is " + parent.nodeName + "."); /** - * 1. If node is a doctype, then throw an "InvalidNodeTypeError" DOMException. - * 2. If offset is greater than node’s length, then throw an "IndexSizeError" - * DOMException. - * 3. Let bp be the boundary point (node, offset). - * 4. If these steps were invoked as "set the end" - * 4.1. If bp is before the range’s start, or if range’s root is not equal - * to node’s root, set range’s start to bp. - * 4.2. Set range’s end to bp. + * 6. If parent is a document, and any of the statements below, switched on + * node, are true, throw a "HierarchyRequestError" DOMException. + * - DocumentFragment node + * If node has more than one element child or has a Text node child. + * Otherwise, if node has one element child and either parent has an element + * child, child is a doctype, or child is not null and a doctype is + * following child. + * - element + * parent has an element child, child is a doctype, or child is not null and + * a doctype is following child. + * - doctype + * parent has a doctype child, child is non-null and an element is preceding + * child, or child is null and parent has an element child. */ - if (util_1.Guard.isDocumentTypeNode(node)) { - throw new DOMException_1.InvalidNodeTypeError(); - } - if (offset > TreeAlgorithm_1.tree_nodeLength(node)) { - throw new DOMException_1.IndexSizeError(); - } - var bp = [node, offset]; - if (range_root(range) !== TreeAlgorithm_1.tree_rootNode(node) || - BoundaryPointAlgorithm_1.boundaryPoint_position(bp, range._start) === interfaces_1.BoundaryPosition.Before) { - range._start = bp; + if (parentNodeType === interfaces_1.NodeType.Document) { + if (nodeNodeType === interfaces_1.NodeType.DocumentFragment) { + var eleCount = 0; + try { + for (var _e = __values(node._children), _f = _e.next(); !_f.done; _f = _e.next()) { + var childNode = _f.value; + if (childNode._nodeType === interfaces_1.NodeType.Element) + eleCount++; + else if (childNode._nodeType === interfaces_1.NodeType.Text) + throw new DOMException_1.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is " + childNode.nodeName + "."); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_f && !_f.done && (_a = _e.return)) _a.call(_e); + } + finally { if (e_1) throw e_1.error; } + } + if (eleCount > 1) { + throw new DOMException_1.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has " + eleCount + " element nodes."); + } + else if (eleCount === 1) { + try { + for (var _g = __values(parent._children), _h = _g.next(); !_h.done; _h = _g.next()) { + var ele = _h.value; + if (ele._nodeType === interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("The document node already has a document element node."); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_h && !_h.done && (_b = _g.return)) _b.call(_g); + } + finally { if (e_2) throw e_2.error; } + } + if (child) { + if (childNodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node."); + var doctypeChild = child._nextSibling; + while (doctypeChild) { + if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node."); + doctypeChild = doctypeChild._nextSibling; + } + } + } + } + else if (nodeNodeType === interfaces_1.NodeType.Element) { + try { + for (var _j = __values(parent._children), _k = _j.next(); !_k.done; _k = _j.next()) { + var ele = _k.value; + if (ele._nodeType === interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("Document already has a document element node. Node is " + node.nodeName + "."); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_k && !_k.done && (_c = _j.return)) _c.call(_j); + } + finally { if (e_3) throw e_3.error; } + } + if (child) { + if (childNodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node. Node is " + node.nodeName + "."); + var doctypeChild = child._nextSibling; + while (doctypeChild) { + if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node. Node is " + node.nodeName + "."); + doctypeChild = doctypeChild._nextSibling; + } + } + } + else if (nodeNodeType === interfaces_1.NodeType.DocumentType) { + try { + for (var _l = __values(parent._children), _m = _l.next(); !_m.done; _m = _l.next()) { + var ele = _m.value; + if (ele._nodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Document already has a document type node. Node is " + node.nodeName + "."); + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (_m && !_m.done && (_d = _l.return)) _d.call(_l); + } + finally { if (e_4) throw e_4.error; } + } + if (child) { + var elementChild = child._previousSibling; + while (elementChild) { + if (elementChild._nodeType === interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("Cannot insert a document type node before an element node. Node is " + node.nodeName + "."); + elementChild = elementChild._previousSibling; + } + } + else { + var elementChild = parent._firstChild; + while (elementChild) { + if (elementChild._nodeType === interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("Cannot insert a document type node before an element node. Node is " + node.nodeName + "."); + elementChild = elementChild._nextSibling; + } + } + } } - range._end = bp; } -exports.range_setTheEnd = range_setTheEnd; +exports.mutation_ensurePreInsertionValidity = mutation_ensurePreInsertionValidity; /** - * Selects a node. + * Ensures pre-insertion validity of a node into a parent before a + * child, then adopts the node to the tree and inserts it. * - * @param range - a range - * @param node - a node + * @param node - node to insert + * @param parent - parent node to receive node + * @param child - child node to insert node before */ -function range_select(node, range) { - /** - * 1. Let parent be node’s parent. - * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. - */ - var parent = node._parent; - if (parent === null) - throw new DOMException_1.InvalidNodeTypeError(); +function mutation_preInsert(node, parent, child) { /** - * 3. Let index be node’s index. - * 4. Set range’s start to boundary point (parent, index). - * 5. Set range’s end to boundary point (parent, index plus 1). + * 1. Ensure pre-insertion validity of node into parent before child. + * 2. Let reference child be child. + * 3. If reference child is node, set it to node’s next sibling. + * 4. Adopt node into parent’s node document. + * 5. Insert node into parent before reference child. + * 6. Return node. */ - var index = TreeAlgorithm_1.tree_index(node); - range._start = [parent, index]; - range._end = [parent, index + 1]; + mutation_ensurePreInsertionValidity(node, parent, child); + var referenceChild = child; + if (referenceChild === node) + referenceChild = node._nextSibling; + DocumentAlgorithm_1.document_adopt(node, parent._nodeDocument); + mutation_insert(node, parent, referenceChild); + return node; } -exports.range_select = range_select; +exports.mutation_preInsert = mutation_preInsert; /** - * EXtracts the contents of range as a document fragment. + * Inserts a node into a parent node before the given child node. * - * @param range - a range + * @param node - node to insert + * @param parent - parent node to receive node + * @param child - child node to insert node before + * @param suppressObservers - whether to notify observers */ -function range_extract(range) { - var e_1, _a, e_2, _b, e_3, _c; +function mutation_insert(node, parent, child, suppressObservers) { + var e_5, _a; + // Optimized common case + if (child === null && node._nodeType !== interfaces_1.NodeType.DocumentFragment) { + mutation_insert_single(node, parent, suppressObservers); + return; + } /** - * 1. Let fragment be a new DocumentFragment node whose node document is - * range’s start node’s node document. - * 2. If range is collapsed, then return fragment. + * 1. Let count be the number of children of node if it is a + * DocumentFragment node, and one otherwise. */ - var fragment = CreateAlgorithm_1.create_documentFragment(range._startNode._nodeDocument); - if (range_collapsed(range)) - return fragment; + var count = (node._nodeType === interfaces_1.NodeType.DocumentFragment ? + node._children.size : 1); /** - * 3. Let original start node, original start offset, original end node, - * and original end offset be range’s start node, start offset, end node, - * and end offset, respectively. + * 2. If child is non-null, then: */ - var originalStartNode = range._startNode; - var originalStartOffset = range._startOffset; - var originalEndNode = range._endNode; - var originalEndOffset = range._endOffset; + if (child !== null) { + /** + * 2.1. For each live range whose start node is parent and start + * offset is greater than child's index, increase its start + * offset by count. + * 2.2. For each live range whose end node is parent and end + * offset is greater than child's index, increase its end + * offset by count. + */ + if (DOMImpl_1.dom.rangeList.size !== 0) { + var index_1 = TreeAlgorithm_1.tree_index(child); + try { + for (var _b = __values(DOMImpl_1.dom.rangeList), _c = _b.next(); !_c.done; _c = _b.next()) { + var range = _c.value; + if (range._start[0] === parent && range._start[1] > index_1) { + range._start[1] += count; + } + if (range._end[0] === parent && range._end[1] > index_1) { + range._end[1] += count; + } + } + } + catch (e_5_1) { e_5 = { error: e_5_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_5) throw e_5.error; } + } + } + } /** - * 4. If original start node is original end node, and they are a Text, - * ProcessingInstruction, or Comment node: - * 4.1. Let clone be a clone of original start node. - * 4.2. Set the data of clone to the result of substringing data with node - * original start node, offset original start offset, and count original end - * offset minus original start offset. - * 4.3. Append clone to fragment. - * 4.4. Replace data with node original start node, offset original start - * offset, count original end offset minus original start offset, and data - * the empty string. - * 4.5. Return fragment. + * 3. Let nodes be node’s children, if node is a DocumentFragment node; + * otherwise « node ». */ - if (originalStartNode === originalEndNode && - util_1.Guard.isCharacterDataNode(originalStartNode)) { - var clone = NodeAlgorithm_1.node_clone(originalStartNode); - clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset); - MutationAlgorithm_1.mutation_append(clone, fragment); - CharacterDataAlgorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset, ''); - return fragment; - } + var nodes = node._nodeType === interfaces_1.NodeType.DocumentFragment ? new (Array.bind.apply(Array, __spread([void 0], node._children)))() : [node]; /** - * 5. Let common ancestor be original start node. - * 6. While common ancestor is not an inclusive ancestor of original end - * node, set common ancestor to its own parent. + * 4. If node is a DocumentFragment node, remove its children with the + * suppress observers flag set. */ - var commonAncestor = originalStartNode; - while (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, commonAncestor, true)) { - if (commonAncestor._parent === null) { - throw new Error("Parent node is null."); + if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { + while (node._firstChild) { + mutation_remove(node._firstChild, node, true); } - commonAncestor = commonAncestor._parent; } /** - * 7. Let first partially contained child be null. - * 8. If original start node is not an inclusive ancestor of original end - * node, set first partially contained child to the first child of common - * ancestor that is partially contained in range. + * 5. If node is a DocumentFragment node, then queue a tree mutation record + * for node with « », nodes, null, and null. */ - var firstPartiallyContainedChild = null; - if (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { - try { - for (var _d = __values(commonAncestor._children), _e = _d.next(); !_e.done; _e = _d.next()) { - var node = _e.value; - if (range_isPartiallyContained(node, range)) { - firstPartiallyContainedChild = node; - break; - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_e && !_e.done && (_a = _d.return)) _a.call(_d); - } - finally { if (e_1) throw e_1.error; } + if (DOMImpl_1.dom.features.mutationObservers) { + if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { + MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(node, [], nodes, null, null); } } /** - * 9. Let last partially contained child be null. - * 10. If original end node is not an inclusive ancestor of original start - * node, set last partially contained child to the last child of common - * ancestor that is partially contained in range. + * 6. Let previousSibling be child’s previous sibling or parent’s last + * child if child is null. */ - var lastPartiallyContainedChild = null; - if (!TreeAlgorithm_1.tree_isAncestorOf(originalStartNode, originalEndNode, true)) { - var children = __spread(commonAncestor._children); - for (var i = children.length - 1; i > 0; i--) { - var node = children[i]; - if (range_isPartiallyContained(node, range)) { - lastPartiallyContainedChild = node; - break; - } - } - } + var previousSibling = (child ? child._previousSibling : parent._lastChild); + var index = child === null ? -1 : TreeAlgorithm_1.tree_index(child); /** - * 11. Let contained children be a list of all children of common ancestor - * that are contained in range, in tree order. - * 12. If any member of contained children is a doctype, then throw a - * "HierarchyRequestError" DOMException. + * 7. For each node in nodes, in tree order: */ - var containedChildren = []; - try { - for (var _f = __values(commonAncestor._children), _g = _f.next(); !_g.done; _g = _f.next()) { - var child = _g.value; - if (range_isContained(child, range)) { - if (util_1.Guard.isDocumentTypeNode(child)) { - throw new DOMException_1.HierarchyRequestError(); - } - containedChildren.push(child); + for (var i = 0; i < nodes.length; i++) { + var node_1 = nodes[i]; + if (util_1.Guard.isElementNode(node_1)) { + // set document element node + if (util_1.Guard.isDocumentNode(parent)) { + parent._documentElement = node_1; + } + // mark that the document has namespaces + if (!node_1._nodeDocument._hasNamespaces && (node_1._namespace !== null || + node_1._namespacePrefix !== null)) { + node_1._nodeDocument._hasNamespaces = true; } } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_g && !_g.done && (_b = _f.return)) _b.call(_f); - } - finally { if (e_2) throw e_2.error; } - } - var newNode; - var newOffset; - if (TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { /** - * 13. If original start node is an inclusive ancestor of original end node, - * set new node to original start node and new offset to original start - * offset. + * 7.1. If child is null, then append node to parent’s children. + * 7.2. Otherwise, insert node into parent’s children before child’s + * index. */ - newNode = originalStartNode; - newOffset = originalStartOffset; - } - else { + node_1._parent = parent; + if (child === null) { + infra_1.set.append(parent._children, node_1); + } + else { + infra_1.set.insert(parent._children, node_1, index); + index++; + } + // assign siblings and children for quick lookups + if (parent._firstChild === null) { + node_1._previousSibling = null; + node_1._nextSibling = null; + parent._firstChild = node_1; + parent._lastChild = node_1; + } + else { + var prev = (child ? child._previousSibling : parent._lastChild); + var next = (child ? child : null); + node_1._previousSibling = prev; + node_1._nextSibling = next; + if (prev) + prev._nextSibling = node_1; + if (next) + next._previousSibling = node_1; + if (!prev) + parent._firstChild = node_1; + if (!next) + parent._lastChild = node_1; + } /** - * 14. Otherwise: - * 14.1. Let reference node equal original start node. - * 14.2. While reference node’s parent is not null and is not an inclusive - * ancestor of original end node, set reference node to its parent. - * 14.3. Set new node to the parent of reference node, and new offset to - * one plus reference node’s index. + * 7.3. If parent is a shadow host and node is a slotable, then + * assign a slot for node. */ - var referenceNode = originalStartNode; - while (referenceNode._parent !== null && - !TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, referenceNode._parent)) { - referenceNode = referenceNode._parent; + if (DOMImpl_1.dom.features.slots) { + if (parent._shadowRoot !== null && util_1.Guard.isSlotable(node_1)) { + ShadowTreeAlgorithm_1.shadowTree_assignASlot(node_1); + } } - /* istanbul ignore next */ - if (referenceNode._parent === null) { - /** - * If reference node’s parent is null, it would be the root of range, - * so would be an inclusive ancestor of original end node, and we could - * not reach this point. - */ - throw new Error("Parent node is null."); + /** + * 7.4. If node is a Text node, run the child text content change + * steps for parent. + */ + if (DOMImpl_1.dom.features.steps) { + if (util_1.Guard.isTextNode(node_1)) { + DOMAlgorithm_1.dom_runChildTextContentChangeSteps(parent); + } } - newNode = referenceNode._parent; - newOffset = 1 + TreeAlgorithm_1.tree_index(referenceNode); - } - if (util_1.Guard.isCharacterDataNode(firstPartiallyContainedChild)) { /** - * 15. If first partially contained child is a Text, ProcessingInstruction, - * or Comment node: - * 15.1. Let clone be a clone of original start node. - * 15.2. Set the data of clone to the result of substringing data with - * node original start node, offset original start offset, and count - * original start node’s length minus original start offset. - * 15.3. Append clone to fragment. - * 15.4. Replace data with node original start node, offset original - * start offset, count original start node’s length minus original start - * offset, and data the empty string. + * 7.5. If parent's root is a shadow root, and parent is a slot + * whose assigned nodes is the empty list, then run signal + * a slot change for parent. */ - var clone = NodeAlgorithm_1.node_clone(originalStartNode); - clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, TreeAlgorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset); - MutationAlgorithm_1.mutation_append(clone, fragment); - CharacterDataAlgorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, TreeAlgorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset, ''); - } - else if (firstPartiallyContainedChild !== null) { + if (DOMImpl_1.dom.features.slots) { + if (util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(parent)) && + util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { + ShadowTreeAlgorithm_1.shadowTree_signalASlotChange(parent); + } + } /** - * 16. Otherwise, if first partially contained child is not null: - * 16.1. Let clone be a clone of first partially contained child. - * 16.2. Append clone to fragment. - * 16.3. Let subrange be a new live range whose start is (original start - * node, original start offset) and whose end is (first partially - * contained child, first partially contained child’s length). - * 16.4. Let subfragment be the result of extracting subrange. - * 16.5. Append subfragment to clone. + * 7.6. Run assign slotables for a tree with node's root. */ - var clone = NodeAlgorithm_1.node_clone(firstPartiallyContainedChild); - MutationAlgorithm_1.mutation_append(clone, fragment); - var subrange = CreateAlgorithm_1.create_range([originalStartNode, originalStartOffset], [firstPartiallyContainedChild, TreeAlgorithm_1.tree_nodeLength(firstPartiallyContainedChild)]); - var subfragment = range_extract(subrange); - MutationAlgorithm_1.mutation_append(subfragment, clone); - } - try { + if (DOMImpl_1.dom.features.slots) { + ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(node_1)); + } /** - * 17. For each contained child in contained children, append contained - * child to fragment. + * 7.7. For each shadow-including inclusive descendant + * inclusiveDescendant of node, in shadow-including tree + * order: */ - for (var containedChildren_1 = __values(containedChildren), containedChildren_1_1 = containedChildren_1.next(); !containedChildren_1_1.done; containedChildren_1_1 = containedChildren_1.next()) { - var child = containedChildren_1_1.value; - MutationAlgorithm_1.mutation_append(child, fragment); + var inclusiveDescendant = TreeAlgorithm_1.tree_getFirstDescendantNode(node_1, true, true); + while (inclusiveDescendant !== null) { + /** + * 7.7.1. Run the insertion steps with inclusiveDescendant. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runInsertionSteps(inclusiveDescendant); + } + if (DOMImpl_1.dom.features.customElements) { + /** + * 7.7.2. If inclusiveDescendant is connected, then: + */ + if (util_1.Guard.isElementNode(inclusiveDescendant) && + ShadowTreeAlgorithm_1.shadowTree_isConnected(inclusiveDescendant)) { + if (util_1.Guard.isCustomElementNode(inclusiveDescendant)) { + /** + * 7.7.2.1. If inclusiveDescendant is custom, then enqueue a custom + * element callback reaction with inclusiveDescendant, callback name + * "connectedCallback", and an empty argument list. + */ + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(inclusiveDescendant, "connectedCallback", []); + } + else { + /** + * 7.7.2.2. Otherwise, try to upgrade inclusiveDescendant. + */ + CustomElementAlgorithm_1.customElement_tryToUpgrade(inclusiveDescendant); + } + } + } + inclusiveDescendant = TreeAlgorithm_1.tree_getNextDescendantNode(node_1, inclusiveDescendant, true, true); } } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (containedChildren_1_1 && !containedChildren_1_1.done && (_c = containedChildren_1.return)) _c.call(containedChildren_1); + /** + * 8. If suppress observers flag is unset, then queue a tree mutation record + * for parent with nodes, « », previousSibling, and child. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + if (!suppressObservers) { + MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, nodes, [], previousSibling, child); } - finally { if (e_3) throw e_3.error; } } - if (util_1.Guard.isCharacterDataNode(lastPartiallyContainedChild)) { - /** - * 18. If last partially contained child is a Text, ProcessingInstruction, - * or Comment node: - * 18.1. Let clone be a clone of original end node. - * 18.2. Set the data of clone to the result of substringing data with - * node original end node, offset 0, and count original end offset. - * 18.3. Append clone to fragment. - * 18.4. Replace data with node original end node, offset 0, count - * original end offset, and data the empty string. - */ - var clone = NodeAlgorithm_1.node_clone(originalEndNode); - clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalEndNode, 0, originalEndOffset); - MutationAlgorithm_1.mutation_append(clone, fragment); - CharacterDataAlgorithm_1.characterData_replaceData(originalEndNode, 0, originalEndOffset, ''); - } - else if (lastPartiallyContainedChild !== null) { - /** - * 19. Otherwise, if last partially contained child is not null: - * 19.1. Let clone be a clone of last partially contained child. - * 19.2. Append clone to fragment. - * 19.3. Let subrange be a new live range whose start is (last partially - * contained child, 0) and whose end is (original end node, original - * end offset). - * 19.4. Let subfragment be the result of extracting subrange. - * 19.5. Append subfragment to clone. - */ - var clone = NodeAlgorithm_1.node_clone(lastPartiallyContainedChild); - MutationAlgorithm_1.mutation_append(clone, fragment); - var subrange = CreateAlgorithm_1.create_range([lastPartiallyContainedChild, 0], [originalEndNode, originalEndOffset]); - var subfragment = range_extract(subrange); - MutationAlgorithm_1.mutation_append(subfragment, clone); - } - /** - * 20. Set range’s start and end to (new node, new offset). - */ - range._start = [newNode, newOffset]; - range._end = [newNode, newOffset]; - /** - * 21. Return fragment. - */ - return fragment; } -exports.range_extract = range_extract; +exports.mutation_insert = mutation_insert; /** - * Clones the contents of range as a document fragment. + * Inserts a node into a parent node. Optimized routine for the common case where + * node is not a document fragment node and it has no child nodes. * - * @param range - a range + * @param node - node to insert + * @param parent - parent node to receive node + * @param suppressObservers - whether to notify observers */ -function range_cloneTheContents(range) { - var e_4, _a, e_5, _b, e_6, _c; +function mutation_insert_single(node, parent, suppressObservers) { /** - * 1. Let fragment be a new DocumentFragment node whose node document - * is range’s start node’s node document. - * 2. If range is collapsed, then return fragment. + * 1. Let count be the number of children of node if it is a + * DocumentFragment node, and one otherwise. + * 2. If child is non-null, then: + * 2.1. For each live range whose start node is parent and start + * offset is greater than child's index, increase its start + * offset by count. + * 2.2. For each live range whose end node is parent and end + * offset is greater than child's index, increase its end + * offset by count. + * 3. Let nodes be node’s children, if node is a DocumentFragment node; + * otherwise « node ». + * 4. If node is a DocumentFragment node, remove its children with the + * suppress observers flag set. + * 5. If node is a DocumentFragment node, then queue a tree mutation record + * for node with « », nodes, null, and null. */ - var fragment = CreateAlgorithm_1.create_documentFragment(range._startNode._nodeDocument); - if (range_collapsed(range)) - return fragment; /** - * 3. Let original start node, original start offset, original end node, - * and original end offset be range’s start node, start offset, end node, - * and end offset, respectively. - * 4. If original start node is original end node, and they are a Text, - * ProcessingInstruction, or Comment node: - * 4.1. Let clone be a clone of original start node. - * 4.2. Set the data of clone to the result of substringing data with node - * original start node, offset original start offset, and count original end - * offset minus original start offset. - * 4.3. Append clone to fragment. - * 4.5. Return fragment. + * 6. Let previousSibling be child’s previous sibling or parent’s last + * child if child is null. */ - var originalStartNode = range._startNode; - var originalStartOffset = range._startOffset; - var originalEndNode = range._endNode; - var originalEndOffset = range._endOffset; - if (originalStartNode === originalEndNode && - util_1.Guard.isCharacterDataNode(originalStartNode)) { - var clone = NodeAlgorithm_1.node_clone(originalStartNode); - clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset); - MutationAlgorithm_1.mutation_append(clone, fragment); + var previousSibling = parent._lastChild; + // set document element node + if (util_1.Guard.isElementNode(node)) { + // set document element node + if (util_1.Guard.isDocumentNode(parent)) { + parent._documentElement = node; + } + // mark that the document has namespaces + if (!node._nodeDocument._hasNamespaces && (node._namespace !== null || + node._namespacePrefix !== null)) { + node._nodeDocument._hasNamespaces = true; + } } /** - * 5. Let common ancestor be original start node. - * 6. While common ancestor is not an inclusive ancestor of original end - * node, set common ancestor to its own parent. + * 7. For each node in nodes, in tree order: + * 7.1. If child is null, then append node to parent’s children. + * 7.2. Otherwise, insert node into parent’s children before child’s + * index. */ - var commonAncestor = originalStartNode; - while (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, commonAncestor, true)) { - if (commonAncestor._parent === null) { - throw new Error("Parent node is null."); - } - commonAncestor = commonAncestor._parent; + node._parent = parent; + parent._children.add(node); + // assign siblings and children for quick lookups + if (parent._firstChild === null) { + node._previousSibling = null; + node._nextSibling = null; + parent._firstChild = node; + parent._lastChild = node; + } + else { + var prev = parent._lastChild; + node._previousSibling = prev; + node._nextSibling = null; + if (prev) + prev._nextSibling = node; + if (!prev) + parent._firstChild = node; + parent._lastChild = node; } /** - * 7. Let first partially contained child be null. - * 8. If original start node is not an inclusive ancestor of original end - * node, set first partially contained child to the first child of common - * ancestor that is partially contained in range. + * 7.3. If parent is a shadow host and node is a slotable, then + * assign a slot for node. */ - var firstPartiallyContainedChild = null; - if (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { - try { - for (var _d = __values(commonAncestor._children), _e = _d.next(); !_e.done; _e = _d.next()) { - var node = _e.value; - if (range_isPartiallyContained(node, range)) { - firstPartiallyContainedChild = node; - break; - } - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (_e && !_e.done && (_a = _d.return)) _a.call(_d); - } - finally { if (e_4) throw e_4.error; } + if (DOMImpl_1.dom.features.slots) { + if (parent._shadowRoot !== null && util_1.Guard.isSlotable(node)) { + ShadowTreeAlgorithm_1.shadowTree_assignASlot(node); } } /** - * 9. Let last partially contained child be null. - * 10. If original end node is not an inclusive ancestor of original start - * node, set last partially contained child to the last child of common - * ancestor that is partially contained in range. + * 7.4. If node is a Text node, run the child text content change + * steps for parent. */ - var lastPartiallyContainedChild = null; - if (!TreeAlgorithm_1.tree_isAncestorOf(originalStartNode, originalEndNode, true)) { - var children = __spread(commonAncestor._children); - for (var i = children.length - 1; i > 0; i--) { - var node = children[i]; - if (range_isPartiallyContained(node, range)) { - lastPartiallyContainedChild = node; - break; - } + if (DOMImpl_1.dom.features.steps) { + if (util_1.Guard.isTextNode(node)) { + DOMAlgorithm_1.dom_runChildTextContentChangeSteps(parent); } } /** - * 11. Let contained children be a list of all children of common ancestor - * that are contained in range, in tree order. - * 12. If any member of contained children is a doctype, then throw a - * "HierarchyRequestError" DOMException. + * 7.5. If parent's root is a shadow root, and parent is a slot + * whose assigned nodes is the empty list, then run signal + * a slot change for parent. */ - var containedChildren = []; - try { - for (var _f = __values(commonAncestor._children), _g = _f.next(); !_g.done; _g = _f.next()) { - var child = _g.value; - if (range_isContained(child, range)) { - if (util_1.Guard.isDocumentTypeNode(child)) { - throw new DOMException_1.HierarchyRequestError(); - } - containedChildren.push(child); - } - } - } - catch (e_5_1) { e_5 = { error: e_5_1 }; } - finally { - try { - if (_g && !_g.done && (_b = _f.return)) _b.call(_f); - } - finally { if (e_5) throw e_5.error; } - } - if (util_1.Guard.isCharacterDataNode(firstPartiallyContainedChild)) { - /** - * 13. If first partially contained child is a Text, ProcessingInstruction, - * or Comment node: - * 13.1. Let clone be a clone of original start node. - * 13.2. Set the data of clone to the result of substringing data with - * node original start node, offset original start offset, and count - * original start node’s length minus original start offset. - * 13.3. Append clone to fragment. - */ - var clone = NodeAlgorithm_1.node_clone(originalStartNode); - clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, TreeAlgorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset); - MutationAlgorithm_1.mutation_append(clone, fragment); - } - else if (firstPartiallyContainedChild !== null) { - /** - * 14. Otherwise, if first partially contained child is not null: - * 14.1. Let clone be a clone of first partially contained child. - * 14.2. Append clone to fragment. - * 14.3. Let subrange be a new live range whose start is (original start - * node, original start offset) and whose end is (first partially - * contained child, first partially contained child’s length). - * 14.4. Let subfragment be the result of cloning the contents of - * subrange. - * 14.5. Append subfragment to clone. - */ - var clone = NodeAlgorithm_1.node_clone(firstPartiallyContainedChild); - MutationAlgorithm_1.mutation_append(clone, fragment); - var subrange = CreateAlgorithm_1.create_range([originalStartNode, originalStartOffset], [firstPartiallyContainedChild, TreeAlgorithm_1.tree_nodeLength(firstPartiallyContainedChild)]); - var subfragment = range_cloneTheContents(subrange); - MutationAlgorithm_1.mutation_append(subfragment, clone); - } - try { - /** - * 15. For each contained child in contained children, append contained - * child to fragment. - * 15.1. Let clone be a clone of contained child with the clone children - * flag set. - * 15.2. Append clone to fragment. - */ - for (var containedChildren_2 = __values(containedChildren), containedChildren_2_1 = containedChildren_2.next(); !containedChildren_2_1.done; containedChildren_2_1 = containedChildren_2.next()) { - var child = containedChildren_2_1.value; - var clone = NodeAlgorithm_1.node_clone(child); - MutationAlgorithm_1.mutation_append(clone, fragment); - } - } - catch (e_6_1) { e_6 = { error: e_6_1 }; } - finally { - try { - if (containedChildren_2_1 && !containedChildren_2_1.done && (_c = containedChildren_2.return)) _c.call(containedChildren_2); + if (DOMImpl_1.dom.features.slots) { + if (util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(parent)) && + util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { + ShadowTreeAlgorithm_1.shadowTree_signalASlotChange(parent); } - finally { if (e_6) throw e_6.error; } - } - if (util_1.Guard.isCharacterDataNode(lastPartiallyContainedChild)) { - /** - * 16. If last partially contained child is a Text, ProcessingInstruction, - * or Comment node: - * 16.1. Let clone be a clone of original end node. - * 16.2. Set the data of clone to the result of substringing data with - * node original end node, offset 0, and count original end offset. - * 16.3. Append clone to fragment. - */ - var clone = NodeAlgorithm_1.node_clone(originalEndNode); - clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalEndNode, 0, originalEndOffset); - MutationAlgorithm_1.mutation_append(clone, fragment); - } - else if (lastPartiallyContainedChild !== null) { - /** - * 17. Otherwise, if last partially contained child is not null: - * 17.1. Let clone be a clone of last partially contained child. - * 17.2. Append clone to fragment. - * 17.3. Let subrange be a new live range whose start is (last partially - * contained child, 0) and whose end is (original end node, original - * end offset). - * 17.4. Let subfragment be the result of cloning the contents of subrange. - * 17.5. Append subfragment to clone. - */ - var clone = NodeAlgorithm_1.node_clone(lastPartiallyContainedChild); - fragment.append(clone); - var subrange = CreateAlgorithm_1.create_range([lastPartiallyContainedChild, 0], [originalEndNode, originalEndOffset]); - var subfragment = range_extract(subrange); - MutationAlgorithm_1.mutation_append(subfragment, clone); } /** - * 18. Return fragment. - */ - return fragment; -} -exports.range_cloneTheContents = range_cloneTheContents; -/** - * Inserts a node into a range at the start boundary point. - * - * @param node - node to insert - * @param range - a range - */ -function range_insert(node, range) { - var e_7, _a; - /** - * 1. If range’s start node is a ProcessingInstruction or Comment node, is a - * Text node whose parent is null, or is node, then throw a - * "HierarchyRequestError" DOMException. + * 7.6. Run assign slotables for a tree with node's root. */ - if (util_1.Guard.isProcessingInstructionNode(range._startNode) || - util_1.Guard.isCommentNode(range._startNode) || - (util_1.Guard.isTextNode(range._startNode) && range._startNode._parent === null) || - range._startNode === node) { - throw new DOMException_1.HierarchyRequestError(); + if (DOMImpl_1.dom.features.slots) { + ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(node)); } /** - * 2. Let referenceNode be null. - * 3. If range’s start node is a Text node, set referenceNode to that Text - * node. - * 4. Otherwise, set referenceNode to the child of start node whose index is - * start offset, and null if there is no such child. + * 7.7. For each shadow-including inclusive descendant + * inclusiveDescendant of node, in shadow-including tree + * order: + * 7.7.1. Run the insertion steps with inclusiveDescendant. */ - var referenceNode = null; - if (util_1.Guard.isTextNode(range._startNode)) { - referenceNode = range._startNode; + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runInsertionSteps(node); } - else { - var index = 0; - try { - for (var _b = __values(range._startNode._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var child = _c.value; - if (index === range._startOffset) { - referenceNode = child; - break; - } - index++; + if (DOMImpl_1.dom.features.customElements) { + /** + * 7.7.2. If inclusiveDescendant is connected, then: + */ + if (util_1.Guard.isElementNode(node) && + ShadowTreeAlgorithm_1.shadowTree_isConnected(node)) { + if (util_1.Guard.isCustomElementNode(node)) { + /** + * 7.7.2.1. If inclusiveDescendant is custom, then enqueue a custom + * element callback reaction with inclusiveDescendant, callback name + * "connectedCallback", and an empty argument list. + */ + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(node, "connectedCallback", []); } - } - catch (e_7_1) { e_7 = { error: e_7_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + else { + /** + * 7.7.2.2. Otherwise, try to upgrade inclusiveDescendant. + */ + CustomElementAlgorithm_1.customElement_tryToUpgrade(node); } - finally { if (e_7) throw e_7.error; } } } /** - * 5. Let parent be range’s start node if referenceNode is null, and - * referenceNode’s parent otherwise. + * 8. If suppress observers flag is unset, then queue a tree mutation record + * for parent with nodes, « », previousSibling, and child. */ - var parent; - if (referenceNode === null) { - parent = range._startNode; - } - else { - if (referenceNode._parent === null) { - throw new Error("Parent node is null."); + if (DOMImpl_1.dom.features.mutationObservers) { + if (!suppressObservers) { + MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, [node], [], previousSibling, null); } - parent = referenceNode._parent; } +} +/** + * Appends a node to the children of a parent node. + * + * @param node - a node + * @param parent - the parent to receive node + */ +function mutation_append(node, parent) { /** - * 6. Ensure pre-insertion validity of node into parent before referenceNode. - */ - MutationAlgorithm_1.mutation_ensurePreInsertionValidity(node, parent, referenceNode); - /** - * 7. If range’s start node is a Text node, set referenceNode to the result - * of splitting it with offset range’s start offset. + * To append a node to a parent, pre-insert node into parent before null. */ - if (util_1.Guard.isTextNode(range._startNode)) { - referenceNode = TextAlgorithm_1.text_split(range._startNode, range._startOffset); - } + return mutation_preInsert(node, parent, null); +} +exports.mutation_append = mutation_append; +/** + * Replaces a node with another node. + * + * @param child - child node to remove + * @param node - node to insert + * @param parent - parent node to receive node + */ +function mutation_replace(child, node, parent) { + var e_6, _a, e_7, _b, e_8, _c, e_9, _d; /** - * 8. If node is referenceNode, set referenceNode to its next sibling. + * 1. If parent is not a Document, DocumentFragment, or Element node, + * throw a "HierarchyRequestError" DOMException. */ - if (node === referenceNode) { - referenceNode = node._nextSibling; - } + if (parent._nodeType !== interfaces_1.NodeType.Document && + parent._nodeType !== interfaces_1.NodeType.DocumentFragment && + parent._nodeType !== interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is " + parent.nodeName + "."); /** - * 9. If node’s parent is not null, remove node from its parent. + * 2. If node is a host-including inclusive ancestor of parent, throw a + * "HierarchyRequestError" DOMException. */ - if (node._parent !== null) { - MutationAlgorithm_1.mutation_remove(node, node._parent); - } + if (TreeAlgorithm_1.tree_isHostIncludingAncestorOf(parent, node, true)) + throw new DOMException_1.HierarchyRequestError("The node to be inserted cannot be an ancestor of parent node. Node is " + node.nodeName + ", parent node is " + parent.nodeName + "."); /** - * 10. Let newOffset be parent’s length if referenceNode is null, and - * referenceNode’s index otherwise. + * 3. If child’s parent is not parent, then throw a "NotFoundError" + * DOMException. */ - var newOffset = (referenceNode === null ? - TreeAlgorithm_1.tree_nodeLength(parent) : TreeAlgorithm_1.tree_index(referenceNode)); + if (child._parent !== parent) + throw new DOMException_1.NotFoundError("The reference child node cannot be found under parent node. Child node is " + child.nodeName + ", parent node is " + parent.nodeName + "."); /** - * 11. Increase newOffset by node’s length if node is a DocumentFragment - * node, and one otherwise. + * 4. If node is not a DocumentFragment, DocumentType, Element, Text, + * ProcessingInstruction, or Comment node, throw a "HierarchyRequestError" + * DOMException. */ - if (util_1.Guard.isDocumentFragmentNode(node)) { - newOffset += TreeAlgorithm_1.tree_nodeLength(node); - } - else { - newOffset++; - } + if (node._nodeType !== interfaces_1.NodeType.DocumentFragment && + node._nodeType !== interfaces_1.NodeType.DocumentType && + node._nodeType !== interfaces_1.NodeType.Element && + node._nodeType !== interfaces_1.NodeType.Text && + node._nodeType !== interfaces_1.NodeType.ProcessingInstruction && + node._nodeType !== interfaces_1.NodeType.CData && + node._nodeType !== interfaces_1.NodeType.Comment) + throw new DOMException_1.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is " + node.nodeName + "."); /** - * 12. Pre-insert node into parent before referenceNode. + * 5. If either node is a Text node and parent is a document, or node is a + * doctype and parent is not a document, throw a "HierarchyRequestError" + * DOMException. */ - MutationAlgorithm_1.mutation_preInsert(node, parent, referenceNode); + if (node._nodeType === interfaces_1.NodeType.Text && + parent._nodeType === interfaces_1.NodeType.Document) + throw new DOMException_1.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is " + node.nodeName + "."); + if (node._nodeType === interfaces_1.NodeType.DocumentType && + parent._nodeType !== interfaces_1.NodeType.Document) + throw new DOMException_1.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is " + parent.nodeName + "."); /** - * 13. If range is collapsed, then set range’s end to (parent, newOffset). + * 6. If parent is a document, and any of the statements below, switched on + * node, are true, throw a "HierarchyRequestError" DOMException. + * - DocumentFragment node + * If node has more than one element child or has a Text node child. + * Otherwise, if node has one element child and either parent has an element + * child that is not child or a doctype is following child. + * - element + * parent has an element child that is not child or a doctype is + * following child. + * - doctype + * parent has a doctype child that is not child, or an element is + * preceding child. */ - if (range_collapsed(range)) { - range._end = [parent, newOffset]; - } -} -exports.range_insert = range_insert; -/** - * Traverses through all contained nodes of a range. - * - * @param range - a range - */ -function range_getContainedNodes(range) { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var container = range.commonAncestorContainer; - var currentNode = TreeAlgorithm_1.tree_getFirstDescendantNode(container); - return { - next: function () { - while (currentNode && !range_isContained(currentNode, range)) { - currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); - } - if (currentNode === null) { - return { done: true, value: null }; - } - else { - var result = { done: false, value: currentNode }; - currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); - return result; - } - } - }; - }, - _a; -} -exports.range_getContainedNodes = range_getContainedNodes; -/** - * Traverses through all partially contained nodes of a range. - * - * @param range - a range - */ -function range_getPartiallyContainedNodes(range) { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var container = range.commonAncestorContainer; - var currentNode = TreeAlgorithm_1.tree_getFirstDescendantNode(container); - return { - next: function () { - while (currentNode && !range_isPartiallyContained(currentNode, range)) { - currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); - } - if (currentNode === null) { - return { done: true, value: null }; + if (parent._nodeType === interfaces_1.NodeType.Document) { + if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { + var eleCount = 0; + try { + for (var _e = __values(node._children), _f = _e.next(); !_f.done; _f = _e.next()) { + var childNode = _f.value; + if (childNode._nodeType === interfaces_1.NodeType.Element) + eleCount++; + else if (childNode._nodeType === interfaces_1.NodeType.Text) + throw new DOMException_1.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is " + childNode.nodeName + "."); + } + } + catch (e_6_1) { e_6 = { error: e_6_1 }; } + finally { + try { + if (_f && !_f.done && (_a = _e.return)) _a.call(_e); + } + finally { if (e_6) throw e_6.error; } + } + if (eleCount > 1) { + throw new DOMException_1.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has " + eleCount + " element nodes."); + } + else if (eleCount === 1) { + try { + for (var _g = __values(parent._children), _h = _g.next(); !_h.done; _h = _g.next()) { + var ele = _h.value; + if (ele._nodeType === interfaces_1.NodeType.Element && ele !== child) + throw new DOMException_1.HierarchyRequestError("The document node already has a document element node."); } - else { - var result = { done: false, value: currentNode }; - currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); - return result; + } + catch (e_7_1) { e_7 = { error: e_7_1 }; } + finally { + try { + if (_h && !_h.done && (_b = _g.return)) _b.call(_g); } + finally { if (e_7) throw e_7.error; } } - }; - }, - _a; -} -exports.range_getPartiallyContainedNodes = range_getPartiallyContainedNodes; -//# sourceMappingURL=RangeAlgorithm.js.map - -/***/ }), - -/***/ 1853: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMException_1 = __nccwpck_require__(3166); -/** - * Matches elements with the given selectors. - * - * @param selectors - selectors - * @param node - the node to match against - */ -function selectors_scopeMatchASelectorsString(selectors, node) { + var doctypeChild = child._nextSibling; + while (doctypeChild) { + if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node."); + doctypeChild = doctypeChild._nextSibling; + } + } + } + else if (node._nodeType === interfaces_1.NodeType.Element) { + try { + for (var _j = __values(parent._children), _k = _j.next(); !_k.done; _k = _j.next()) { + var ele = _k.value; + if (ele._nodeType === interfaces_1.NodeType.Element && ele !== child) + throw new DOMException_1.HierarchyRequestError("Document already has a document element node. Node is " + node.nodeName + "."); + } + } + catch (e_8_1) { e_8 = { error: e_8_1 }; } + finally { + try { + if (_k && !_k.done && (_c = _j.return)) _c.call(_j); + } + finally { if (e_8) throw e_8.error; } + } + var doctypeChild = child._nextSibling; + while (doctypeChild) { + if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node. Node is " + node.nodeName + "."); + doctypeChild = doctypeChild._nextSibling; + } + } + else if (node._nodeType === interfaces_1.NodeType.DocumentType) { + try { + for (var _l = __values(parent._children), _m = _l.next(); !_m.done; _m = _l.next()) { + var ele = _m.value; + if (ele._nodeType === interfaces_1.NodeType.DocumentType && ele !== child) + throw new DOMException_1.HierarchyRequestError("Document already has a document type node. Node is " + node.nodeName + "."); + } + } + catch (e_9_1) { e_9 = { error: e_9_1 }; } + finally { + try { + if (_m && !_m.done && (_d = _l.return)) _d.call(_l); + } + finally { if (e_9) throw e_9.error; } + } + var elementChild = child._previousSibling; + while (elementChild) { + if (elementChild._nodeType === interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("Cannot insert a document type node before an element node. Node is " + node.nodeName + "."); + elementChild = elementChild._previousSibling; + } + } + } /** - * TODO: Selectors - * 1. Let s be the result of parse a selector selectors. [SELECTORS4] - * 2. If s is failure, then throw a "SyntaxError" DOMException. - * 3. Return the result of match a selector against a tree with s and node’s - * root using scoping root node. [SELECTORS4]. + * 7. Let reference child be child’s next sibling. + * 8. If reference child is node, set it to node’s next sibling. + * 8. Let previousSibling be child’s previous sibling. */ - throw new DOMException_1.NotSupportedError(); -} -exports.selectors_scopeMatchASelectorsString = selectors_scopeMatchASelectorsString; -//# sourceMappingURL=SelectorsAlgorithm.js.map - -/***/ }), - -/***/ 8733: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + var referenceChild = child._nextSibling; + if (referenceChild === node) + referenceChild = node._nextSibling; + var previousSibling = child._previousSibling; + /** + * 10. Adopt node into parent’s node document. + * 11. Let removedNodes be the empty list. + */ + DocumentAlgorithm_1.document_adopt(node, parent._nodeDocument); + var removedNodes = []; + /** + * 12. If child’s parent is not null, then: + */ + if (child._parent !== null) { + /** + * 12.1. Set removedNodes to [child]. + * 12.2. Remove child from its parent with the suppress observers flag + * set. + */ + removedNodes.push(child); + mutation_remove(child, child._parent, true); } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } + /** + * 13. Let nodes be node’s children if node is a DocumentFragment node; + * otherwise [node]. + */ + var nodes = []; + if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { + nodes = Array.from(node._children); + } + else { + nodes.push(node); } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var util_1 = __nccwpck_require__(5282); -var util_2 = __nccwpck_require__(6195); -var TreeAlgorithm_1 = __nccwpck_require__(6620); -var MutationObserverAlgorithm_1 = __nccwpck_require__(8157); -/** - * Signals a slot change to the given slot. - * - * @param slot - a slot - */ -function shadowTree_signalASlotChange(slot) { /** - * 1. Append slot to slot’s relevant agent’s signal slots. - * 2. Queue a mutation observer microtask. + * 14. Insert node into parent before reference child with the suppress + * observers flag set. */ - var window = DOMImpl_1.dom.window; - window._signalSlots.add(slot); - MutationObserverAlgorithm_1.observer_queueAMutationObserverMicrotask(); -} -exports.shadowTree_signalASlotChange = shadowTree_signalASlotChange; -/** - * Determines whether a the shadow tree of the given element node is - * connected to a document node. - * - * @param element - an element node of the shadow tree - */ -function shadowTree_isConnected(element) { + mutation_insert(node, parent, referenceChild, true); /** - * An element is connected if its shadow-including root is a document. + * 15. Queue a tree mutation record for parent with nodes, removedNodes, + * previousSibling, and reference child. */ - return util_1.Guard.isDocumentNode(TreeAlgorithm_1.tree_rootNode(element, true)); -} -exports.shadowTree_isConnected = shadowTree_isConnected; -/** - * Determines whether a slotable is assigned. - * - * @param slotable - a slotable - */ -function shadowTree_isAssigned(slotable) { + if (DOMImpl_1.dom.features.mutationObservers) { + MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, nodes, removedNodes, previousSibling, referenceChild); + } /** - * A slotable is assigned if its assigned slot is non-null. + * 16. Return child. */ - return (slotable._assignedSlot !== null); + return child; } -exports.shadowTree_isAssigned = shadowTree_isAssigned; +exports.mutation_replace = mutation_replace; /** - * Finds a slot for the given slotable. + * Replaces all nodes of a parent with the given node. * - * @param slotable - a slotable - * @param openFlag - `true` to search open shadow tree's only + * @param node - node to insert + * @param parent - parent node to receive node */ -function shadowTree_findASlot(slotable, openFlag) { - if (openFlag === void 0) { openFlag = false; } +function mutation_replaceAll(node, parent) { + var e_10, _a; /** - * 1. If slotable’s parent is null, then return null. - * 2. Let shadow be slotable’s parent’s shadow root. - * 3. If shadow is null, then return null. - * 4. If the open flag is set and shadow’s mode is not "open", then - * return null. - * 5. Return the first slot in tree order in shadow’s descendants whose name - * is slotable’s name, if any, and null otherwise. + * 1. If node is not null, adopt node into parent’s node document. */ - var node = util_1.Cast.asNode(slotable); - var parent = node._parent; - if (parent === null) - return null; - var shadow = parent._shadowRoot || null; - if (shadow === null) - return null; - if (openFlag && shadow._mode !== "open") - return null; - var child = TreeAlgorithm_1.tree_getFirstDescendantNode(shadow, false, true, function (e) { return util_1.Guard.isSlot(e); }); - while (child !== null) { - if (child._name === slotable._name) - return child; - child = TreeAlgorithm_1.tree_getNextDescendantNode(shadow, child, false, true, function (e) { return util_1.Guard.isSlot(e); }); + if (node !== null) { + DocumentAlgorithm_1.document_adopt(node, parent._nodeDocument); } - return null; -} -exports.shadowTree_findASlot = shadowTree_findASlot; -/** - * Finds slotables for the given slot. - * - * @param slot - a slot - */ -function shadowTree_findSlotables(slot) { - var e_1, _a; /** - * 1. Let result be an empty list. - * 2. If slot’s root is not a shadow root, then return result. + * 2. Let removedNodes be parent’s children. */ - var result = []; - var root = TreeAlgorithm_1.tree_rootNode(slot); - if (!util_1.Guard.isShadowRoot(root)) - return result; + var removedNodes = Array.from(parent._children); /** - * 3. Let host be slot’s root’s host. - * 4. For each slotable child of host, slotable, in tree order: + * 3. Let addedNodes be the empty list. + * 4. If node is DocumentFragment node, then set addedNodes to node’s + * children. + * 5. Otherwise, if node is non-null, set addedNodes to [node]. */ - var host = root._host; + var addedNodes = []; + if (node && node._nodeType === interfaces_1.NodeType.DocumentFragment) { + addedNodes = Array.from(node._children); + } + else if (node !== null) { + addedNodes.push(node); + } try { - for (var _b = __values(host._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var slotable = _c.value; - if (util_1.Guard.isSlotable(slotable)) { - /** - * 4.1. Let foundSlot be the result of finding a slot given slotable. - * 4.2. If foundSlot is slot, then append slotable to result. - */ - var foundSlot = shadowTree_findASlot(slotable); - if (foundSlot === slot) { - result.push(slotable); - } - } + /** + * 6. Remove all parent’s children, in tree order, with the suppress + * observers flag set. + */ + for (var removedNodes_1 = __values(removedNodes), removedNodes_1_1 = removedNodes_1.next(); !removedNodes_1_1.done; removedNodes_1_1 = removedNodes_1.next()) { + var childNode = removedNodes_1_1.value; + mutation_remove(childNode, parent, true); } } - catch (e_1_1) { e_1 = { error: e_1_1 }; } + catch (e_10_1) { e_10 = { error: e_10_1 }; } finally { try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + if (removedNodes_1_1 && !removedNodes_1_1.done && (_a = removedNodes_1.return)) _a.call(removedNodes_1); } - finally { if (e_1) throw e_1.error; } + finally { if (e_10) throw e_10.error; } } /** - * 5. Return result. + * 7. If node is not null, then insert node into parent before null with the + * suppress observers flag set. */ - return result; + if (node !== null) { + mutation_insert(node, parent, null, true); + } + /** + * 8. Queue a tree mutation record for parent with addedNodes, removedNodes, + * null, and null. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, addedNodes, removedNodes, null, null); + } } -exports.shadowTree_findSlotables = shadowTree_findSlotables; +exports.mutation_replaceAll = mutation_replaceAll; /** - * Finds slotables for the given slot. + * Ensures pre-removal validity of a child node from a parent, then + * removes it. * - * @param slot - a slot + * @param child - child node to remove + * @param parent - parent node */ -function shadowTree_findFlattenedSlotables(slot) { - var e_2, _a, e_3, _b; - /** - * 1. Let result be an empty list. - * 2. If slot’s root is not a shadow root, then return result. - */ - var result = []; - var root = TreeAlgorithm_1.tree_rootNode(slot); - if (!util_1.Guard.isShadowRoot(root)) - return result; +function mutation_preRemove(child, parent) { /** - * 3. Let slotables be the result of finding slotables given slot. - * 4. If slotables is the empty list, then append each slotable child of - * slot, in tree order, to slotables. + * 1. If child’s parent is not parent, then throw a "NotFoundError" + * DOMException. + * 2. Remove child from parent. + * 3. Return child. */ - var slotables = shadowTree_findSlotables(slot); - if (util_2.isEmpty(slotables)) { + if (child._parent !== parent) + throw new DOMException_1.NotFoundError("The child node cannot be found under parent node. Child node is " + child.nodeName + ", parent node is " + parent.nodeName + "."); + mutation_remove(child, parent); + return child; +} +exports.mutation_preRemove = mutation_preRemove; +/** + * Removes a child node from its parent. + * + * @param node - node to remove + * @param parent - parent node + * @param suppressObservers - whether to notify observers + */ +function mutation_remove(node, parent, suppressObservers) { + var e_11, _a, e_12, _b, e_13, _c, e_14, _d; + if (DOMImpl_1.dom.rangeList.size !== 0) { + /** + * 1. Let index be node’s index. + */ + var index = TreeAlgorithm_1.tree_index(node); try { - for (var _c = __values(slot._children), _d = _c.next(); !_d.done; _d = _c.next()) { - var slotable = _d.value; - if (util_1.Guard.isSlotable(slotable)) { - slotables.push(slotable); + /** + * 2. For each live range whose start node is an inclusive descendant of + * node, set its start to (parent, index). + * 3. For each live range whose end node is an inclusive descendant of + * node, set its end to (parent, index). + */ + for (var _e = __values(DOMImpl_1.dom.rangeList), _f = _e.next(); !_f.done; _f = _e.next()) { + var range = _f.value; + if (TreeAlgorithm_1.tree_isDescendantOf(node, range._start[0], true)) { + range._start = [parent, index]; + } + if (TreeAlgorithm_1.tree_isDescendantOf(node, range._end[0], true)) { + range._end = [parent, index]; + } + if (range._start[0] === parent && range._start[1] > index) { + range._start[1]--; + } + if (range._end[0] === parent && range._end[1] > index) { + range._end[1]--; } } } - catch (e_2_1) { e_2 = { error: e_2_1 }; } + catch (e_11_1) { e_11 = { error: e_11_1 }; } finally { try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + if (_f && !_f.done && (_a = _e.return)) _a.call(_e); } - finally { if (e_2) throw e_2.error; } + finally { if (e_11) throw e_11.error; } } - } - try { - /** - * 5. For each node in slotables: - */ - for (var slotables_1 = __values(slotables), slotables_1_1 = slotables_1.next(); !slotables_1_1.done; slotables_1_1 = slotables_1.next()) { - var node = slotables_1_1.value; + try { /** - * 5.1. If node is a slot whose root is a shadow root, then: + * 4. For each live range whose start node is parent and start offset is + * greater than index, decrease its start offset by 1. + * 5. For each live range whose end node is parent and end offset is greater + * than index, decrease its end offset by 1. */ - if (util_1.Guard.isSlot(node) && util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(node))) { - /** - * 5.1.1. Let temporaryResult be the result of finding flattened slotables given node. - * 5.1.2. Append each slotable in temporaryResult, in order, to result. - */ - var temporaryResult = shadowTree_findFlattenedSlotables(node); - result.push.apply(result, __spread(temporaryResult)); + for (var _g = __values(DOMImpl_1.dom.rangeList), _h = _g.next(); !_h.done; _h = _g.next()) { + var range = _h.value; + if (range._start[0] === parent && range._start[1] > index) { + range._start[1] -= 1; + } + if (range._end[0] === parent && range._end[1] > index) { + range._end[1] -= 1; + } } - else { - /** - * 5.2. Otherwise, append node to result. - */ - result.push(node); + } + catch (e_12_1) { e_12 = { error: e_12_1 }; } + finally { + try { + if (_h && !_h.done && (_b = _g.return)) _b.call(_g); } + finally { if (e_12) throw e_12.error; } } } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { + /** + * 6. For each NodeIterator object iterator whose root’s node document is + * node’s node document, run the NodeIterator pre-removing steps given node + * and iterator. + */ + if (DOMImpl_1.dom.features.steps) { try { - if (slotables_1_1 && !slotables_1_1.done && (_b = slotables_1.return)) _b.call(slotables_1); + for (var _j = __values(NodeIteratorAlgorithm_1.nodeIterator_iteratorList()), _k = _j.next(); !_k.done; _k = _j.next()) { + var iterator = _k.value; + if (iterator._root._nodeDocument === node._nodeDocument) { + DOMAlgorithm_1.dom_runNodeIteratorPreRemovingSteps(iterator, node); + } + } + } + catch (e_13_1) { e_13 = { error: e_13_1 }; } + finally { + try { + if (_k && !_k.done && (_c = _j.return)) _c.call(_j); + } + finally { if (e_13) throw e_13.error; } } - finally { if (e_3) throw e_3.error; } } /** - * 6. Return result. + * 7. Let oldPreviousSibling be node’s previous sibling. + * 8. Let oldNextSibling be node’s next sibling. */ - return result; -} -exports.shadowTree_findFlattenedSlotables = shadowTree_findFlattenedSlotables; -/** - * Assigns slotables to the given slot. - * - * @param slot - a slot - */ -function shadowTree_assignSlotables(slot) { - var e_4, _a; - /** - * 1. Let slotables be the result of finding slotables for slot. - * 2. If slotables and slot’s assigned nodes are not identical, then run - * signal a slot change for slot. + var oldPreviousSibling = node._previousSibling; + var oldNextSibling = node._nextSibling; + // set document element node + if (util_1.Guard.isDocumentNode(parent) && util_1.Guard.isElementNode(node)) { + parent._documentElement = null; + } + /** + * 9. Remove node from its parent’s children. */ - var slotables = shadowTree_findSlotables(slot); - if (slotables.length === slot._assignedNodes.length) { - var nodesIdentical = true; - for (var i = 0; i < slotables.length; i++) { - if (slotables[i] !== slot._assignedNodes[i]) { - nodesIdentical = false; - break; - } + node._parent = null; + parent._children.delete(node); + // assign siblings and children for quick lookups + var prev = node._previousSibling; + var next = node._nextSibling; + node._previousSibling = null; + node._nextSibling = null; + if (prev) + prev._nextSibling = next; + if (next) + next._previousSibling = prev; + if (!prev) + parent._firstChild = next; + if (!next) + parent._lastChild = prev; + /** + * 10. If node is assigned, then run assign slotables for node’s assigned + * slot. + */ + if (DOMImpl_1.dom.features.slots) { + if (util_1.Guard.isSlotable(node) && node._assignedSlot !== null && ShadowTreeAlgorithm_1.shadowTree_isAssigned(node)) { + ShadowTreeAlgorithm_1.shadowTree_assignSlotables(node._assignedSlot); } - if (!nodesIdentical) { - shadowTree_signalASlotChange(slot); + } + /** + * 11. If parent’s root is a shadow root, and parent is a slot whose + * assigned nodes is the empty list, then run signal a slot change for + * parent. + */ + if (DOMImpl_1.dom.features.slots) { + if (util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(parent)) && + util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { + ShadowTreeAlgorithm_1.shadowTree_signalASlotChange(parent); } } /** - * 3. Set slot’s assigned nodes to slotables. - * 4. For each slotable in slotables, set slotable’s assigned slot to slot. + * 12. If node has an inclusive descendant that is a slot, then: + * 12.1. Run assign slotables for a tree with parent's root. + * 12.2. Run assign slotables for a tree with node. */ - slot._assignedNodes = slotables; - try { - for (var slotables_2 = __values(slotables), slotables_2_1 = slotables_2.next(); !slotables_2_1.done; slotables_2_1 = slotables_2.next()) { - var slotable = slotables_2_1.value; - slotable._assignedSlot = slot; + if (DOMImpl_1.dom.features.slots) { + var descendant_1 = TreeAlgorithm_1.tree_getFirstDescendantNode(node, true, false, function (e) { return util_1.Guard.isSlot(e); }); + if (descendant_1 !== null) { + ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(parent)); + ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(node); } } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (slotables_2_1 && !slotables_2_1.done && (_a = slotables_2.return)) _a.call(slotables_2); + /** + * 13. Run the removing steps with node and parent. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runRemovingSteps(node, parent); + } + /** + * 14. If node is custom, then enqueue a custom element callback + * reaction with node, callback name "disconnectedCallback", + * and an empty argument list. + */ + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isCustomElementNode(node)) { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(node, "disconnectedCallback", []); } - finally { if (e_4) throw e_4.error; } } -} -exports.shadowTree_assignSlotables = shadowTree_assignSlotables; -/** - * Assigns slotables to all nodes of a tree. - * - * @param root - root node - */ -function shadowTree_assignSlotablesForATree(root) { /** - * To assign slotables for a tree, given a node root, run assign slotables - * for each slot slot in root’s inclusive descendants, in tree order. + * 15. For each shadow-including descendant descendant of node, + * in shadow-including tree order, then: */ - var descendant = TreeAlgorithm_1.tree_getFirstDescendantNode(root, true, false, function (e) { return util_1.Guard.isSlot(e); }); + var descendant = TreeAlgorithm_1.tree_getFirstDescendantNode(node, false, true); while (descendant !== null) { - shadowTree_assignSlotables(descendant); - descendant = TreeAlgorithm_1.tree_getNextDescendantNode(root, descendant, true, false, function (e) { return util_1.Guard.isSlot(e); }); + /** + * 15.1. Run the removing steps with descendant. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runRemovingSteps(descendant, node); + } + /** + * 15.2. If descendant is custom, then enqueue a custom element + * callback reaction with descendant, callback name + * "disconnectedCallback", and an empty argument list. + */ + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isCustomElementNode(descendant)) { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(descendant, "disconnectedCallback", []); + } + } + descendant = TreeAlgorithm_1.tree_getNextDescendantNode(node, descendant, false, true); } -} -exports.shadowTree_assignSlotablesForATree = shadowTree_assignSlotablesForATree; -/** - * Assigns a slot to a slotables. - * - * @param slotable - a slotable - */ -function shadowTree_assignASlot(slotable) { /** - * 1. Let slot be the result of finding a slot with slotable. - * 2. If slot is non-null, then run assign slotables for slot. + * 16. For each inclusive ancestor inclusiveAncestor of parent, and + * then for each registered of inclusiveAncestor's registered + * observer list, if registered's options's subtree is true, + * then append a new transient registered observer whose + * observer is registered's observer, options is registered's + * options, and source is registered to node's registered + * observer list. */ - var slot = shadowTree_findASlot(slotable); - if (slot !== null) { - shadowTree_assignSlotables(slot); + if (DOMImpl_1.dom.features.mutationObservers) { + var inclusiveAncestor = TreeAlgorithm_1.tree_getFirstAncestorNode(parent, true); + while (inclusiveAncestor !== null) { + try { + for (var _l = (e_14 = void 0, __values(inclusiveAncestor._registeredObserverList)), _m = _l.next(); !_m.done; _m = _l.next()) { + var registered = _m.value; + if (registered.options.subtree) { + node._registeredObserverList.push({ + observer: registered.observer, + options: registered.options, + source: registered + }); + } + } + } + catch (e_14_1) { e_14 = { error: e_14_1 }; } + finally { + try { + if (_m && !_m.done && (_d = _l.return)) _d.call(_l); + } + finally { if (e_14) throw e_14.error; } + } + inclusiveAncestor = TreeAlgorithm_1.tree_getNextAncestorNode(parent, inclusiveAncestor, true); + } + } + /** + * 17. If suppress observers flag is unset, then queue a tree mutation + * record for parent with « », « node », oldPreviousSibling, and + * oldNextSibling. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + if (!suppressObservers) { + MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, [], [node], oldPreviousSibling, oldNextSibling); + } + } + /** + * 18. If node is a Text node, then run the child text content change steps + * for parent. + */ + if (DOMImpl_1.dom.features.steps) { + if (util_1.Guard.isTextNode(node)) { + DOMAlgorithm_1.dom_runChildTextContentChangeSteps(parent); + } } } -exports.shadowTree_assignASlot = shadowTree_assignASlot; -//# sourceMappingURL=ShadowTreeAlgorithm.js.map +exports.mutation_remove = mutation_remove; +//# sourceMappingURL=MutationAlgorithm.js.map /***/ }), -/***/ 3512: +/***/ 78157: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -54317,293 +53524,366 @@ var __values = (this && this.__values) || function(o) { }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var util_1 = __nccwpck_require__(5282); -var DOMException_1 = __nccwpck_require__(3166); -var CreateAlgorithm_1 = __nccwpck_require__(7339); -var TreeAlgorithm_1 = __nccwpck_require__(6620); -var CharacterDataAlgorithm_1 = __nccwpck_require__(9461); -var MutationAlgorithm_1 = __nccwpck_require__(5463); +var DOMImpl_1 = __nccwpck_require__(14177); +var util_1 = __nccwpck_require__(65282); +var infra_1 = __nccwpck_require__(84251); +var CreateAlgorithm_1 = __nccwpck_require__(57339); +var TreeAlgorithm_1 = __nccwpck_require__(16620); +var EventAlgorithm_1 = __nccwpck_require__(28217); /** - * Returns node with its adjacent text and cdata node siblings. - * - * @param node - a node - * @param self - whether to include node itself + * Queues a mutation observer microtask to the surrounding agent’s mutation + * observers. */ -function text_contiguousTextNodes(node, self) { - var _a; - if (self === void 0) { self = false; } +function observer_queueAMutationObserverMicrotask() { /** - * The contiguous Text nodes of a node node are node, node’s previous - * sibling Text node, if any, and its contiguous Text nodes, and node’s next - * sibling Text node, if any, and its contiguous Text nodes, avoiding any - * duplicates. + * 1. If the surrounding agent’s mutation observer microtask queued is true, + * then return. + * 2. Set the surrounding agent’s mutation observer microtask queued to true. + * 3. Queue a microtask to notify mutation observers. */ - return _a = {}, - _a[Symbol.iterator] = function () { - var currentNode = node; - while (currentNode && util_1.Guard.isTextNode(currentNode._previousSibling)) { - currentNode = currentNode._previousSibling; - } - return { - next: function () { - if (currentNode && (!self && currentNode === node)) { - if (util_1.Guard.isTextNode(currentNode._nextSibling)) { - currentNode = currentNode._nextSibling; - } - else { - currentNode = null; - } - } - if (currentNode === null) { - return { done: true, value: null }; - } - else { - var result = { done: false, value: currentNode }; - if (util_1.Guard.isTextNode(currentNode._nextSibling)) { - currentNode = currentNode._nextSibling; - } - else { - currentNode = null; - } - return result; - } - } - }; - }, - _a; + var window = DOMImpl_1.dom.window; + if (window._mutationObserverMicrotaskQueued) + return; + window._mutationObserverMicrotaskQueued = true; + Promise.resolve().then(function () { observer_notifyMutationObservers(); }); } -exports.text_contiguousTextNodes = text_contiguousTextNodes; +exports.observer_queueAMutationObserverMicrotask = observer_queueAMutationObserverMicrotask; /** - * Returns node with its adjacent text node siblings. - * - * @param node - a node - * @param self - whether to include node itself + * Notifies the surrounding agent’s mutation observers. */ -function text_contiguousExclusiveTextNodes(node, self) { - var _a; - if (self === void 0) { self = false; } +function observer_notifyMutationObservers() { + var e_1, _a, e_2, _b; /** - * The contiguous exclusive Text nodes of a node node are node, node’s - * previous sibling exclusive Text node, if any, and its contiguous - * exclusive Text nodes, and node’s next sibling exclusive Text node, - * if any, and its contiguous exclusive Text nodes, avoiding any duplicates. + * 1. Set the surrounding agent’s mutation observer microtask queued to false. + * 2. Let notifySet be a clone of the surrounding agent’s mutation observers. + * 3. Let signalSet be a clone of the surrounding agent’s signal slots. + * 4. Empty the surrounding agent’s signal slots. */ - return _a = {}, - _a[Symbol.iterator] = function () { - var currentNode = node; - while (currentNode && util_1.Guard.isExclusiveTextNode(currentNode._previousSibling)) { - currentNode = currentNode._previousSibling; + var window = DOMImpl_1.dom.window; + window._mutationObserverMicrotaskQueued = false; + var notifySet = infra_1.set.clone(window._mutationObservers); + var signalSet = infra_1.set.clone(window._signalSlots); + infra_1.set.empty(window._signalSlots); + var _loop_1 = function (mo) { + /** + * 5.1. Let records be a clone of mo’s record queue. + * 5.2. Empty mo’s record queue. + */ + var records = infra_1.list.clone(mo._recordQueue); + infra_1.list.empty(mo._recordQueue); + /** + * 5.3. For each node of mo’s node list, remove all transient registered + * observers whose observer is mo from node’s registered observer list. + */ + for (var i = 0; i < mo._nodeList.length; i++) { + var node = mo._nodeList[i]; + infra_1.list.remove(node._registeredObserverList, function (observer) { + return util_1.Guard.isTransientRegisteredObserver(observer) && observer.observer === mo; + }); + } + /** + * 5.4. If records is not empty, then invoke mo’s callback with « records, + * mo », and mo. If this throws an exception, then report the exception. + */ + if (!infra_1.list.isEmpty(records)) { + try { + mo._callback.call(mo, records, mo); } - return { - next: function () { - if (currentNode && (!self && currentNode === node)) { - if (util_1.Guard.isExclusiveTextNode(currentNode._nextSibling)) { - currentNode = currentNode._nextSibling; - } - else { - currentNode = null; - } - } - if (currentNode === null) { - return { done: true, value: null }; - } - else { - var result = { done: false, value: currentNode }; - if (util_1.Guard.isExclusiveTextNode(currentNode._nextSibling)) { - currentNode = currentNode._nextSibling; - } - else { - currentNode = null; - } - return result; - } - } - }; - }, - _a; -} -exports.text_contiguousExclusiveTextNodes = text_contiguousExclusiveTextNodes; -/** - * Returns the concatenation of the data of all the Text node descendants of - * node, in tree order. - * - * @param node - a node - */ -function text_descendantTextContent(node) { - /** - * The descendant text content of a node node is the concatenation of the - * data of all the Text node descendants of node, in tree order. - */ - var contents = ''; - var text = TreeAlgorithm_1.tree_getFirstDescendantNode(node, false, false, function (e) { return util_1.Guard.isTextNode(e); }); - while (text !== null) { - contents += text._data; - text = TreeAlgorithm_1.tree_getNextDescendantNode(node, text, false, false, function (e) { return util_1.Guard.isTextNode(e); }); + catch (err) { + // TODO: Report the exception + } + } + }; + try { + /** + * 5. For each mo of notifySet: + */ + for (var notifySet_1 = __values(notifySet), notifySet_1_1 = notifySet_1.next(); !notifySet_1_1.done; notifySet_1_1 = notifySet_1.next()) { + var mo = notifySet_1_1.value; + _loop_1(mo); + } } - return contents; -} -exports.text_descendantTextContent = text_descendantTextContent; -/** - * Splits data at the given offset and returns the remainder as a text - * node. - * - * @param node - a text node - * @param offset - the offset at which to split the nodes. - */ -function text_split(node, offset) { - var e_1, _a; - /** - * 1. Let length be node’s length. - * 2. If offset is greater than length, then throw an "IndexSizeError" - * DOMException. - */ - var length = node._data.length; - if (offset > length) { - throw new DOMException_1.IndexSizeError(); + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (notifySet_1_1 && !notifySet_1_1.done && (_a = notifySet_1.return)) _a.call(notifySet_1); + } + finally { if (e_1) throw e_1.error; } } /** - * 3. Let count be length minus offset. - * 4. Let new data be the result of substringing data with node node, - * offset offset, and count count. - * 5. Let new node be a new Text node, with the same node document as node. - * Set new node’s data to new data. - * 6. Let parent be node’s parent. - * 7. If parent is not null, then: + * 6. For each slot of signalSet, fire an event named slotchange, with its + * bubbles attribute set to true, at slot. */ - var count = length - offset; - var newData = CharacterDataAlgorithm_1.characterData_substringData(node, offset, count); - var newNode = CreateAlgorithm_1.create_text(node._nodeDocument, newData); - var parent = node._parent; - if (parent !== null) { - /** - * 7.1. Insert new node into parent before node’s next sibling. - */ - MutationAlgorithm_1.mutation_insert(newNode, parent, node._nextSibling); + if (DOMImpl_1.dom.features.slots) { try { - /** - * 7.2. For each live range whose start node is node and start offset is - * greater than offset, set its start node to new node and decrease its - * start offset by offset. - * 7.3. For each live range whose end node is node and end offset is greater - * than offset, set its end node to new node and decrease its end offset - * by offset. - * 7.4. For each live range whose start node is parent and start offset is - * equal to the index of node plus 1, increase its start offset by 1. - * 7.5. For each live range whose end node is parent and end offset is equal - * to the index of node plus 1, increase its end offset by 1. - */ - for (var _b = __values(DOMImpl_1.dom.rangeList), _c = _b.next(); !_c.done; _c = _b.next()) { - var range = _c.value; - if (range._start[0] === node && range._start[1] > offset) { - range._start[0] = newNode; - range._start[1] -= offset; - } - if (range._end[0] === node && range._end[1] > offset) { - range._end[0] = newNode; - range._end[1] -= offset; - } - var index = TreeAlgorithm_1.tree_index(node); - if (range._start[0] === parent && range._start[1] === index + 1) { - range._start[1]++; - } - if (range._end[0] === parent && range._end[1] === index + 1) { - range._end[1]++; - } + for (var signalSet_1 = __values(signalSet), signalSet_1_1 = signalSet_1.next(); !signalSet_1_1.done; signalSet_1_1 = signalSet_1.next()) { + var slot = signalSet_1_1.value; + EventAlgorithm_1.event_fireAnEvent("slotchange", slot, undefined, { bubbles: true }); } } - catch (e_1_1) { e_1 = { error: e_1_1 }; } + catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + if (signalSet_1_1 && !signalSet_1_1.done && (_b = signalSet_1.return)) _b.call(signalSet_1); } - finally { if (e_1) throw e_1.error; } + finally { if (e_2) throw e_2.error; } } } - /** - * 8. Replace data with node node, offset offset, count count, and data - * the empty string. - * 9. Return new node. - */ - CharacterDataAlgorithm_1.characterData_replaceData(node, offset, count, ''); - return newNode; } -exports.text_split = text_split; -//# sourceMappingURL=TextAlgorithm.js.map - -/***/ }), - -/***/ 998: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var DOMException_1 = __nccwpck_require__(3166); +exports.observer_notifyMutationObservers = observer_notifyMutationObservers; /** - * Applies the filter to the given node and returns the result. + * Queues a mutation record of the given type for target. * - * @param traverser - the `NodeIterator` or `TreeWalker` instance - * @param node - the node to filter + * @param type - mutation record type + * @param target - target node + * @param name - name before mutation + * @param namespace - namespace before mutation + * @param oldValue - attribute value before mutation + * @param addedNodes - a list od added nodes + * @param removedNodes - a list of removed nodes + * @param previousSibling - previous sibling of target before mutation + * @param nextSibling - next sibling of target before mutation */ -function traversal_filter(traverser, node) { - /** - * 1. If traverser’s active flag is set, then throw an "InvalidStateError" - * DOMException. - */ - if (traverser._activeFlag) { - throw new DOMException_1.InvalidStateError(); - } - /** - * 2. Let n be node’s nodeType attribute value − 1. - */ - var n = node._nodeType - 1; - /** - * 3. If the nth bit (where 0 is the least significant bit) of traverser’s - * whatToShow is not set, then return FILTER_SKIP. - */ - var mask = 1 << n; - if ((traverser.whatToShow & mask) === 0) { - return interfaces_1.FilterResult.Skip; - } +function observer_queueMutationRecord(type, target, name, namespace, oldValue, addedNodes, removedNodes, previousSibling, nextSibling) { + var e_3, _a; /** - * 4. If traverser’s filter is null, then return FILTER_ACCEPT. + * 1. Let interestedObservers be an empty map. + * 2. Let nodes be the inclusive ancestors of target. + * 3. For each node in nodes, and then for each registered of node’s + * registered observer list: */ - if (!traverser.filter) { - return interfaces_1.FilterResult.Accept; + var interestedObservers = new Map(); + var node = TreeAlgorithm_1.tree_getFirstAncestorNode(target, true); + while (node !== null) { + for (var i = 0; i < node._registeredObserverList.length; i++) { + var registered = node._registeredObserverList[i]; + /** + * 3.1. Let options be registered’s options. + * 3.2. If none of the following are true + * - node is not target and options’s subtree is false + * - type is "attributes" and options’s attributes is not true + * - type is "attributes", options’s attributeFilter is present, and + * options’s attributeFilter does not contain name or namespace is + * non-null + * - type is "characterData" and options’s characterData is not true + * - type is "childList" and options’s childList is false + */ + var options = registered.options; + if (node !== target && !options.subtree) + continue; + if (type === "attributes" && !options.attributes) + continue; + if (type === "attributes" && options.attributeFilter && + (!options.attributeFilter.indexOf(name || '') || namespace !== null)) + continue; + if (type === "characterData" && !options.characterData) + continue; + if (type === "childList" && !options.childList) + continue; + /** + * then: + * 3.2.1. Let mo be registered’s observer. + * 3.2.2. If interestedObservers[mo] does not exist, then set + * interestedObservers[mo] to null. + * 3.2.3. If either type is "attributes" and options’s attributeOldValue + * is true, or type is "characterData" and options’s + * characterDataOldValue is true, then set interestedObservers[mo] + * to oldValue. + */ + var mo = registered.observer; + if (!interestedObservers.has(mo)) { + interestedObservers.set(mo, null); + } + if ((type === "attributes" && options.attributeOldValue) || + (type === "characterData" && options.characterDataOldValue)) { + interestedObservers.set(mo, oldValue); + } + } + node = TreeAlgorithm_1.tree_getNextAncestorNode(target, node, true); + } + try { + /** + * 4. For each observer → mappedOldValue of interestedObservers: + */ + for (var interestedObservers_1 = __values(interestedObservers), interestedObservers_1_1 = interestedObservers_1.next(); !interestedObservers_1_1.done; interestedObservers_1_1 = interestedObservers_1.next()) { + var _b = __read(interestedObservers_1_1.value, 2), observer = _b[0], mappedOldValue = _b[1]; + /** + * 4.1. Let record be a new MutationRecord object with its type set to + * type, target set to target, attributeName set to name, + * attributeNamespace set to namespace, oldValue set to mappedOldValue, + * addedNodes set to addedNodes, removedNodes set to removedNodes, + * previousSibling set to previousSibling, and nextSibling set to + * nextSibling. + * 4.2. Enqueue record to observer’s record queue. + */ + var record = CreateAlgorithm_1.create_mutationRecord(type, target, CreateAlgorithm_1.create_nodeListStatic(target, addedNodes), CreateAlgorithm_1.create_nodeListStatic(target, removedNodes), previousSibling, nextSibling, name, namespace, mappedOldValue); + var queue = observer._recordQueue; + queue.push(record); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (interestedObservers_1_1 && !interestedObservers_1_1.done && (_a = interestedObservers_1.return)) _a.call(interestedObservers_1); + } + finally { if (e_3) throw e_3.error; } } /** - * 5. Set traverser’s active flag. + * 5. Queue a mutation observer microtask. */ - traverser._activeFlag = true; + observer_queueAMutationObserverMicrotask(); +} +exports.observer_queueMutationRecord = observer_queueMutationRecord; +/** + * Queues a tree mutation record for target. + * + * @param target - target node + * @param addedNodes - a list od added nodes + * @param removedNodes - a list of removed nodes + * @param previousSibling - previous sibling of target before mutation + * @param nextSibling - next sibling of target before mutation + */ +function observer_queueTreeMutationRecord(target, addedNodes, removedNodes, previousSibling, nextSibling) { /** - * 6. Let result be the return value of call a user object’s operation with - * traverser’s filter, "acceptNode", and « node ». If this throws an - * exception, then unset traverser’s active flag and rethrow the exception. + * To queue a tree mutation record for target with addedNodes, removedNodes, + * previousSibling, and nextSibling, queue a mutation record of "childList" + * for target with null, null, null, addedNodes, removedNodes, + * previousSibling, and nextSibling. */ - var result = interfaces_1.FilterResult.Reject; - try { - result = traverser.filter.acceptNode(node); - } - catch (err) { - traverser._activeFlag = false; - throw err; - } + observer_queueMutationRecord("childList", target, null, null, null, addedNodes, removedNodes, previousSibling, nextSibling); +} +exports.observer_queueTreeMutationRecord = observer_queueTreeMutationRecord; +/** + * Queues an attribute mutation record for target. + * + * @param target - target node + * @param name - name before mutation + * @param namespace - namespace before mutation + * @param oldValue - attribute value before mutation + */ +function observer_queueAttributeMutationRecord(target, name, namespace, oldValue) { /** - * 7. Unset traverser’s active flag. - * 8. Return result. + * To queue an attribute mutation record for target with name, namespace, + * and oldValue, queue a mutation record of "attributes" for target with + * name, namespace, oldValue, « », « », null, and null. */ - traverser._activeFlag = false; - return result; + observer_queueMutationRecord("attributes", target, name, namespace, oldValue, [], [], null, null); } -exports.traversal_filter = traversal_filter; -//# sourceMappingURL=TraversalAlgorithm.js.map +exports.observer_queueAttributeMutationRecord = observer_queueAttributeMutationRecord; +//# sourceMappingURL=MutationObserverAlgorithm.js.map + +/***/ }), + +/***/ 35856: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var DOMException_1 = __nccwpck_require__(13166); +var infra_1 = __nccwpck_require__(84251); +var XMLAlgorithm_1 = __nccwpck_require__(57030); +/** + * Validates the given qualified name. + * + * @param qualifiedName - qualified name + */ +function namespace_validate(qualifiedName) { + /** + * To validate a qualifiedName, throw an "InvalidCharacterError" + * DOMException if qualifiedName does not match the Name or QName + * production. + */ + if (!XMLAlgorithm_1.xml_isName(qualifiedName)) + throw new DOMException_1.InvalidCharacterError("Invalid XML name: " + qualifiedName); + if (!XMLAlgorithm_1.xml_isQName(qualifiedName)) + throw new DOMException_1.InvalidCharacterError("Invalid XML qualified name: " + qualifiedName + "."); +} +exports.namespace_validate = namespace_validate; +/** + * Validates and extracts a namespace, prefix and localName from the + * given namespace and qualified name. + * See: https://dom.spec.whatwg.org/#validate-and-extract. + * + * @param namespace - namespace + * @param qualifiedName - qualified name + * + * @returns a tuple with `namespace`, `prefix` and `localName`. + */ +function namespace_validateAndExtract(namespace, qualifiedName) { + /** + * 1. If namespace is the empty string, set it to null. + * 2. Validate qualifiedName. + * 3. Let prefix be null. + * 4. Let localName be qualifiedName. + * 5. If qualifiedName contains a ":" (U+003E), then split the string on it + * and set prefix to the part before and localName to the part after. + * 6. If prefix is non-null and namespace is null, then throw a + * "NamespaceError" DOMException. + * 7. If prefix is "xml" and namespace is not the XML namespace, then throw + * a "NamespaceError" DOMException. + * 8. If either qualifiedName or prefix is "xmlns" and namespace is not the + * XMLNS namespace, then throw a "NamespaceError" DOMException. + * 9. If namespace is the XMLNS namespace and neither qualifiedName nor + * prefix is "xmlns", then throw a "NamespaceError" DOMException. + * 10. Return namespace, prefix, and localName. + */ + if (!namespace) + namespace = null; + namespace_validate(qualifiedName); + var parts = qualifiedName.split(':'); + var prefix = (parts.length === 2 ? parts[0] : null); + var localName = (parts.length === 2 ? parts[1] : qualifiedName); + if (prefix && namespace === null) + throw new DOMException_1.NamespaceError("Qualified name includes a prefix but the namespace is null."); + if (prefix === "xml" && namespace !== infra_1.namespace.XML) + throw new DOMException_1.NamespaceError("Qualified name includes the \"xml\" prefix but the namespace is not the XML namespace."); + if (namespace !== infra_1.namespace.XMLNS && + (prefix === "xmlns" || qualifiedName === "xmlns")) + throw new DOMException_1.NamespaceError("Qualified name includes the \"xmlns\" prefix but the namespace is not the XMLNS namespace."); + if (namespace === infra_1.namespace.XMLNS && + (prefix !== "xmlns" && qualifiedName !== "xmlns")) + throw new DOMException_1.NamespaceError("Qualified name does not include the \"xmlns\" prefix but the namespace is the XMLNS namespace."); + return [namespace, prefix, localName]; +} +exports.namespace_validateAndExtract = namespace_validateAndExtract; +/** + * Extracts a prefix and localName from the given qualified name. + * + * @param qualifiedName - qualified name + * + * @returns an tuple with `prefix` and `localName`. + */ +function namespace_extractQName(qualifiedName) { + namespace_validate(qualifiedName); + var parts = qualifiedName.split(':'); + var prefix = (parts.length === 2 ? parts[0] : null); + var localName = (parts.length === 2 ? parts[1] : qualifiedName); + return [prefix, localName]; +} +exports.namespace_extractQName = namespace_extractQName; +//# sourceMappingURL=NamespaceAlgorithm.js.map /***/ }), -/***/ 6620: +/***/ 74924: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -54620,2975 +53900,3635 @@ var __values = (this && this.__values) || function(o) { throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(5282); -var interfaces_1 = __nccwpck_require__(7305); +var DOMImpl_1 = __nccwpck_require__(14177); +var util_1 = __nccwpck_require__(65282); +var infra_1 = __nccwpck_require__(84251); +var CreateAlgorithm_1 = __nccwpck_require__(57339); +var OrderedSetAlgorithm_1 = __nccwpck_require__(53670); +var DOMAlgorithm_1 = __nccwpck_require__(9628); +var MutationAlgorithm_1 = __nccwpck_require__(45463); +var ElementAlgorithm_1 = __nccwpck_require__(51849); /** - * Gets the next descendant of the given node of the tree rooted at `root` - * in depth-first pre-order. + * Replaces the contents of the given node with a single text node. * - * @param root - root node of the tree - * @param node - a node - * @param shadow - whether to visit shadow tree nodes + * @param string - node contents + * @param parent - a node */ -function _getNextDescendantNode(root, node, shadow) { - if (shadow === void 0) { shadow = false; } - // traverse shadow tree - if (shadow && util_1.Guard.isElementNode(node) && util_1.Guard.isShadowRoot(node.shadowRoot)) { - if (node.shadowRoot._firstChild) - return node.shadowRoot._firstChild; - } - // traverse child nodes - if (node._firstChild) - return node._firstChild; - if (node === root) - return null; - // traverse siblings - if (node._nextSibling) - return node._nextSibling; - // traverse parent's next sibling - var parent = node._parent; - while (parent && parent !== root) { - if (parent._nextSibling) - return parent._nextSibling; - parent = parent._parent; +function node_stringReplaceAll(str, parent) { + /** + * 1. Let node be null. + * 2. If string is not the empty string, then set node to a new Text node + * whose data is string and node document is parent’s node document. + * 3. Replace all with node within parent. + */ + var node = null; + if (str !== '') { + node = CreateAlgorithm_1.create_text(parent._nodeDocument, str); } - return null; -} -function _emptyIterator() { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - return { - next: function () { - return { done: true, value: null }; - } - }; - }, - _a; + MutationAlgorithm_1.mutation_replaceAll(node, parent); } +exports.node_stringReplaceAll = node_stringReplaceAll; /** - * Returns the first descendant node of the tree rooted at `node` in - * depth-first pre-order. + * Clones a node. * - * @param node - root node of the tree - * @param self - whether to include `node` in traversal - * @param shadow - whether to visit shadow tree nodes - * @param filter - a function to filter nodes + * @param node - a node to clone + * @param document - the document to own the cloned node + * @param cloneChildrenFlag - whether to clone node's children */ -function tree_getFirstDescendantNode(node, self, shadow, filter) { - if (self === void 0) { self = false; } - if (shadow === void 0) { shadow = false; } - var firstNode = (self ? node : _getNextDescendantNode(node, node, shadow)); - while (firstNode && filter && !filter(firstNode)) { - firstNode = _getNextDescendantNode(node, firstNode, shadow); +function node_clone(node, document, cloneChildrenFlag) { + var e_1, _a, e_2, _b; + if (document === void 0) { document = null; } + if (cloneChildrenFlag === void 0) { cloneChildrenFlag = false; } + /** + * 1. If document is not given, let document be node’s node document. + */ + if (document === null) + document = node._nodeDocument; + var copy; + if (util_1.Guard.isElementNode(node)) { + /** + * 2. If node is an element, then: + * 2.1. Let copy be the result of creating an element, given document, + * node’s local name, node’s namespace, node’s namespace prefix, + * and node’s is value, with the synchronous custom elements flag unset. + * 2.2. For each attribute in node’s attribute list: + * 2.2.1. Let copyAttribute be a clone of attribute. + * 2.2.2. Append copyAttribute to copy. + */ + copy = ElementAlgorithm_1.element_createAnElement(document, node._localName, node._namespace, node._namespacePrefix, node._is, false); + try { + for (var _c = __values(node._attributeList), _d = _c.next(); !_d.done; _d = _c.next()) { + var attribute = _d.value; + var copyAttribute = node_clone(attribute, document); + ElementAlgorithm_1.element_append(copyAttribute, copy); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + } + finally { if (e_1) throw e_1.error; } + } } - return firstNode; -} -exports.tree_getFirstDescendantNode = tree_getFirstDescendantNode; -/** - * Returns the next descendant node of the tree rooted at `node` in - * depth-first pre-order. - * - * @param node - root node of the tree - * @param currentNode - current descendant node - * @param self - whether to include `node` in traversal - * @param shadow - whether to visit shadow tree nodes - * @param filter - a function to filter nodes - */ -function tree_getNextDescendantNode(node, currentNode, self, shadow, filter) { - if (self === void 0) { self = false; } - if (shadow === void 0) { shadow = false; } - var nextNode = _getNextDescendantNode(node, currentNode, shadow); - while (nextNode && filter && !filter(nextNode)) { - nextNode = _getNextDescendantNode(node, nextNode, shadow); + else { + /** + * 3. Otherwise, let copy be a node that implements the same interfaces as + * node, and fulfills these additional requirements, switching on node: + * - Document + * Set copy’s encoding, content type, URL, origin, type, and mode, to those + * of node. + * - DocumentType + * Set copy’s name, public ID, and system ID, to those of node. + * - Attr + * Set copy’s namespace, namespace prefix, local name, and value, to + * those of node. + * - Text + * - Comment + * Set copy’s data, to that of node. + * - ProcessingInstruction + * Set copy’s target and data to those of node. + * - Any other node + */ + if (util_1.Guard.isDocumentNode(node)) { + var doc = CreateAlgorithm_1.create_document(); + doc._encoding = node._encoding; + doc._contentType = node._contentType; + doc._URL = node._URL; + doc._origin = node._origin; + doc._type = node._type; + doc._mode = node._mode; + copy = doc; + } + else if (util_1.Guard.isDocumentTypeNode(node)) { + var doctype = CreateAlgorithm_1.create_documentType(document, node._name, node._publicId, node._systemId); + copy = doctype; + } + else if (util_1.Guard.isAttrNode(node)) { + var attr = CreateAlgorithm_1.create_attr(document, node.localName); + attr._namespace = node._namespace; + attr._namespacePrefix = node._namespacePrefix; + attr._value = node._value; + copy = attr; + } + else if (util_1.Guard.isExclusiveTextNode(node)) { + copy = CreateAlgorithm_1.create_text(document, node._data); + } + else if (util_1.Guard.isCDATASectionNode(node)) { + copy = CreateAlgorithm_1.create_cdataSection(document, node._data); + } + else if (util_1.Guard.isCommentNode(node)) { + copy = CreateAlgorithm_1.create_comment(document, node._data); + } + else if (util_1.Guard.isProcessingInstructionNode(node)) { + copy = CreateAlgorithm_1.create_processingInstruction(document, node._target, node._data); + } + else if (util_1.Guard.isDocumentFragmentNode(node)) { + copy = CreateAlgorithm_1.create_documentFragment(document); + } + else { + copy = Object.create(node); + } } - return nextNode; -} -exports.tree_getNextDescendantNode = tree_getNextDescendantNode; -/** - * Traverses through all descendant nodes of the tree rooted at - * `node` in depth-first pre-order. - * - * @param node - root node of the tree - * @param self - whether to include `node` in traversal - * @param shadow - whether to visit shadow tree nodes - * @param filter - a function to filter nodes - */ -function tree_getDescendantNodes(node, self, shadow, filter) { - var _a; - if (self === void 0) { self = false; } - if (shadow === void 0) { shadow = false; } - if (!self && node._children.size === 0) { - return _emptyIterator(); + /** + * 4. Set copy’s node document and document to copy, if copy is a document, + * and set copy’s node document to document otherwise. + */ + if (util_1.Guard.isDocumentNode(copy)) { + copy._nodeDocument = copy; + document = copy; } - return _a = {}, - _a[Symbol.iterator] = function () { - var currentNode = (self ? node : _getNextDescendantNode(node, node, shadow)); - return { - next: function () { - while (currentNode && filter && !filter(currentNode)) { - currentNode = _getNextDescendantNode(node, currentNode, shadow); - } - if (currentNode === null) { - return { done: true, value: null }; - } - else { - var result = { done: false, value: currentNode }; - currentNode = _getNextDescendantNode(node, currentNode, shadow); - return result; - } - } - }; - }, - _a; + else { + copy._nodeDocument = document; + } + /** + * 5. Run any cloning steps defined for node in other applicable + * specifications and pass copy, node, document and the clone children flag + * if set, as parameters. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runCloningSteps(copy, node, document, cloneChildrenFlag); + } + /** + * 6. If the clone children flag is set, clone all the children of node and + * append them to copy, with document as specified and the clone children + * flag being set. + */ + if (cloneChildrenFlag) { + try { + for (var _e = __values(node._children), _f = _e.next(); !_f.done; _f = _e.next()) { + var child = _f.value; + var childCopy = node_clone(child, document, true); + MutationAlgorithm_1.mutation_append(childCopy, copy); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_f && !_f.done && (_b = _e.return)) _b.call(_e); + } + finally { if (e_2) throw e_2.error; } + } + } + /** + * 7. Return copy. + */ + return copy; } -exports.tree_getDescendantNodes = tree_getDescendantNodes; +exports.node_clone = node_clone; /** - * Traverses through all descendant element nodes of the tree rooted at - * `node` in depth-first preorder. + * Determines if two nodes can be considered equal. * - * @param node - root node of the tree - * @param self - whether to include `node` in traversal - * @param shadow - whether to visit shadow tree nodes - * @param filter - a function to filter nodes + * @param a - node to compare + * @param b - node to compare */ -function tree_getDescendantElements(node, self, shadow, filter) { - var _a; - if (self === void 0) { self = false; } - if (shadow === void 0) { shadow = false; } - if (!self && node._children.size === 0) { - return _emptyIterator(); - } - return _a = {}, - _a[Symbol.iterator] = function () { - var it = tree_getDescendantNodes(node, self, shadow, function (e) { return util_1.Guard.isElementNode(e); })[Symbol.iterator](); - var currentNode = it.next().value; - return { - next: function () { - while (currentNode && filter && !filter(currentNode)) { - currentNode = it.next().value; - } - if (currentNode === null) { - return { done: true, value: null }; - } - else { - var result = { done: false, value: currentNode }; - currentNode = it.next().value; - return result; - } - } - }; - }, - _a; -} -exports.tree_getDescendantElements = tree_getDescendantElements; -/** - * Traverses through all sibling nodes of `node`. - * - * @param node - root node of the tree - * @param self - whether to include `node` in traversal - * @param filter - a function to filter nodes - */ -function tree_getSiblingNodes(node, self, filter) { - var _a; - if (self === void 0) { self = false; } - if (!node._parent || node._parent._children.size === 0) { - return _emptyIterator(); +function node_equals(a, b) { + var e_3, _a, e_4, _b; + /** + * 1. A and B’s nodeType attribute value is identical. + */ + if (a._nodeType !== b._nodeType) + return false; + /** + * 2. The following are also equal, depending on A: + * - DocumentType + * Its name, public ID, and system ID. + * - Element + * Its namespace, namespace prefix, local name, and its attribute list’s size. + * - Attr + * Its namespace, local name, and value. + * - ProcessingInstruction + * Its target and data. + * - Text + * - Comment + * Its data. + */ + if (util_1.Guard.isDocumentTypeNode(a) && util_1.Guard.isDocumentTypeNode(b)) { + if (a._name !== b._name || a._publicId !== b._publicId || + a._systemId !== b._systemId) + return false; } - return _a = {}, - _a[Symbol.iterator] = function () { - var currentNode = node._parent ? node._parent._firstChild : null; - return { - next: function () { - while (currentNode && (filter && !filter(currentNode) || (!self && currentNode === node))) { - currentNode = currentNode._nextSibling; - } - if (currentNode === null) { - return { done: true, value: null }; - } - else { - var result = { done: false, value: currentNode }; - currentNode = currentNode._nextSibling; - return result; - } - } - }; - }, - _a; + else if (util_1.Guard.isElementNode(a) && util_1.Guard.isElementNode(b)) { + if (a._namespace !== b._namespace || a._namespacePrefix !== b._namespacePrefix || + a._localName !== b._localName || + a._attributeList.length !== b._attributeList.length) + return false; + } + else if (util_1.Guard.isAttrNode(a) && util_1.Guard.isAttrNode(b)) { + if (a._namespace !== b._namespace || a._localName !== b._localName || + a._value !== b._value) + return false; + } + else if (util_1.Guard.isProcessingInstructionNode(a) && util_1.Guard.isProcessingInstructionNode(b)) { + if (a._target !== b._target || a._data !== b._data) + return false; + } + else if (util_1.Guard.isCharacterDataNode(a) && util_1.Guard.isCharacterDataNode(b)) { + if (a._data !== b._data) + return false; + } + /** + * 3. If A is an element, each attribute in its attribute list has an attribute + * that equals an attribute in B’s attribute list. + */ + if (util_1.Guard.isElementNode(a) && util_1.Guard.isElementNode(b)) { + var attrMap = {}; + try { + for (var _c = __values(a._attributeList), _d = _c.next(); !_d.done; _d = _c.next()) { + var attrA = _d.value; + attrMap[attrA._localName] = attrA; + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + } + finally { if (e_3) throw e_3.error; } + } + try { + for (var _e = __values(b._attributeList), _f = _e.next(); !_f.done; _f = _e.next()) { + var attrB = _f.value; + var attrA = attrMap[attrB._localName]; + if (!attrA) + return false; + if (!node_equals(attrA, attrB)) + return false; + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (_f && !_f.done && (_b = _e.return)) _b.call(_e); + } + finally { if (e_4) throw e_4.error; } + } + } + /** + * 4. A and B have the same number of children. + * 5. Each child of A equals the child of B at the identical index. + */ + if (a._children.size !== b._children.size) + return false; + var itA = a._children[Symbol.iterator](); + var itB = b._children[Symbol.iterator](); + var resultA = itA.next(); + var resultB = itB.next(); + while (!resultA.done && !resultB.done) { + var child1 = resultA.value; + var child2 = resultB.value; + if (!node_equals(child1, child2)) + return false; + resultA = itA.next(); + resultB = itB.next(); + } + return true; } -exports.tree_getSiblingNodes = tree_getSiblingNodes; +exports.node_equals = node_equals; /** - * Gets the first ancestor of `node` in reverse tree order. + * Returns a collection of elements with the given qualified name which are + * descendants of the given root node. + * See: https://dom.spec.whatwg.org/#concept-getelementsbytagname * - * @param node - root node of the tree - * @param self - whether to include `node` in traversal - * @param filter - a function to filter nodes + * @param qualifiedName - qualified name + * @param root - root node */ -function tree_getFirstAncestorNode(node, self, filter) { - if (self === void 0) { self = false; } - var firstNode = self ? node : node._parent; - while (firstNode && filter && !filter(firstNode)) { - firstNode = firstNode._parent; +function node_listOfElementsWithQualifiedName(qualifiedName, root) { + /** + * 1. If qualifiedName is "*" (U+002A), return a HTMLCollection rooted at + * root, whose filter matches only descendant elements. + * 2. Otherwise, if root’s node document is an HTML document, return a + * HTMLCollection rooted at root, whose filter matches the following + * descendant elements: + * 2.1. Whose namespace is the HTML namespace and whose qualified name is + * qualifiedName, in ASCII lowercase. + * 2.2. Whose namespace is not the HTML namespace and whose qualified name + * is qualifiedName. + * 3. Otherwise, return a HTMLCollection rooted at root, whose filter + * matches descendant elements whose qualified name is qualifiedName. + */ + if (qualifiedName === "*") { + return CreateAlgorithm_1.create_htmlCollection(root); + } + else if (root._nodeDocument._type === "html") { + return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + if (ele._namespace === infra_1.namespace.HTML && + ele._qualifiedName === qualifiedName.toLowerCase()) { + return true; + } + else if (ele._namespace !== infra_1.namespace.HTML && + ele._qualifiedName === qualifiedName) { + return true; + } + else { + return false; + } + }); + } + else { + return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + return (ele._qualifiedName === qualifiedName); + }); } - return firstNode; } -exports.tree_getFirstAncestorNode = tree_getFirstAncestorNode; +exports.node_listOfElementsWithQualifiedName = node_listOfElementsWithQualifiedName; /** - * Gets the first ancestor of `node` in reverse tree order. + * Returns a collection of elements with the given namespace which are + * descendants of the given root node. + * See: https://dom.spec.whatwg.org/#concept-getelementsbytagnamens * - * @param node - root node of the tree - * @param self - whether to include `node` in traversal - * @param filter - a function to filter nodes + * @param namespace - element namespace + * @param localName - local name + * @param root - root node */ -function tree_getNextAncestorNode(node, currentNode, self, filter) { - if (self === void 0) { self = false; } - var nextNode = currentNode._parent; - while (nextNode && filter && !filter(nextNode)) { - nextNode = nextNode._parent; +function node_listOfElementsWithNamespace(namespace, localName, root) { + /** + * 1. If namespace is the empty string, set it to null. + * 2. If both namespace and localName are "*" (U+002A), return a + * HTMLCollection rooted at root, whose filter matches descendant elements. + * 3. Otherwise, if namespace is "*" (U+002A), return a HTMLCollection + * rooted at root, whose filter matches descendant elements whose local + * name is localName. + * 4. Otherwise, if localName is "*" (U+002A), return a HTMLCollection + * rooted at root, whose filter matches descendant elements whose + * namespace is namespace. + * 5. Otherwise, return a HTMLCollection rooted at root, whose filter + * matches descendant elements whose namespace is namespace and local + * name is localName. + */ + if (namespace === '') + namespace = null; + if (namespace === "*" && localName === "*") { + return CreateAlgorithm_1.create_htmlCollection(root); + } + else if (namespace === "*") { + return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + return (ele._localName === localName); + }); + } + else if (localName === "*") { + return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + return (ele._namespace === namespace); + }); + } + else { + return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + return (ele._localName === localName && ele._namespace === namespace); + }); } - return nextNode; } -exports.tree_getNextAncestorNode = tree_getNextAncestorNode; +exports.node_listOfElementsWithNamespace = node_listOfElementsWithNamespace; /** - * Traverses through all ancestor nodes `node` in reverse tree order. + * Returns a collection of elements with the given class names which are + * descendants of the given root node. + * See: https://dom.spec.whatwg.org/#concept-getelementsbyclassname * - * @param node - root node of the tree - * @param self - whether to include `node` in traversal - * @param filter - a function to filter nodes + * @param namespace - element namespace + * @param localName - local name + * @param root - root node */ -function tree_getAncestorNodes(node, self, filter) { - var _a; - if (self === void 0) { self = false; } - if (!self && !node._parent) { - return _emptyIterator(); +function node_listOfElementsWithClassNames(classNames, root) { + /** + * 1. Let classes be the result of running the ordered set parser + * on classNames. + * 2. If classes is the empty set, return an empty HTMLCollection. + * 3. Return a HTMLCollection rooted at root, whose filter matches + * descendant elements that have all their classes in classes. + * The comparisons for the classes must be done in an ASCII case-insensitive + * manner if root’s node document’s mode is "quirks", and in a + * case-sensitive manner otherwise. + */ + var classes = OrderedSetAlgorithm_1.orderedSet_parse(classNames); + if (classes.size === 0) { + return CreateAlgorithm_1.create_htmlCollection(root, function () { return false; }); } - return _a = {}, - _a[Symbol.iterator] = function () { - var currentNode = tree_getFirstAncestorNode(node, self, filter); - return { - next: function () { - if (currentNode === null) { - return { done: true, value: null }; - } - else { - var result = { done: false, value: currentNode }; - currentNode = tree_getNextAncestorNode(node, currentNode, self, filter); - return result; - } - } - }; - }, - _a; + var caseSensitive = (root._nodeDocument._mode !== "quirks"); + return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + var eleClasses = ele.classList; + return OrderedSetAlgorithm_1.orderedSet_contains(eleClasses._tokenSet, classes, caseSensitive); + }); } -exports.tree_getAncestorNodes = tree_getAncestorNodes; +exports.node_listOfElementsWithClassNames = node_listOfElementsWithClassNames; /** - * Returns the common ancestor of the given nodes. + * Searches for a namespace prefix associated with the given namespace + * starting from the given element through its ancestors. * - * @param nodeA - a node - * @param nodeB - a node + * @param element - an element node to start searching at + * @param namespace - namespace to search for */ -function tree_getCommonAncestor(nodeA, nodeB) { - if (nodeA === nodeB) { - return nodeA._parent; - } - // lists of parent nodes - var parentsA = []; - var parentsB = []; - var pA = tree_getFirstAncestorNode(nodeA, true); - while (pA !== null) { - parentsA.push(pA); - pA = tree_getNextAncestorNode(nodeA, pA, true); - } - var pB = tree_getFirstAncestorNode(nodeB, true); - while (pB !== null) { - parentsB.push(pB); - pB = tree_getNextAncestorNode(nodeB, pB, true); +function node_locateANamespacePrefix(element, namespace) { + /** + * 1. If element’s namespace is namespace and its namespace prefix is not + * null, then return its namespace prefix. + */ + if (element._namespace === namespace && element._namespacePrefix !== null) { + return element._namespacePrefix; } - // walk through parents backwards until they differ - var pos1 = parentsA.length; - var pos2 = parentsB.length; - var parent = null; - for (var i = Math.min(pos1, pos2); i > 0; i--) { - var parent1 = parentsA[--pos1]; - var parent2 = parentsB[--pos2]; - if (parent1 !== parent2) { - break; + /** + * 2. If element has an attribute whose namespace prefix is "xmlns" and + * value is namespace, then return element’s first such attribute’s + * local name. + */ + for (var i = 0; i < element._attributeList.length; i++) { + var attr = element._attributeList[i]; + if (attr._namespacePrefix === "xmlns" && attr._value === namespace) { + return attr._localName; } - parent = parent1; } - return parent; + /** + * 3. If element’s parent element is not null, then return the result of + * running locate a namespace prefix on that element using namespace. + */ + if (element._parent && util_1.Guard.isElementNode(element._parent)) { + return node_locateANamespacePrefix(element._parent, namespace); + } + /** + * 4. Return null. + */ + return null; } -exports.tree_getCommonAncestor = tree_getCommonAncestor; +exports.node_locateANamespacePrefix = node_locateANamespacePrefix; /** - * Returns the node following `node` in depth-first preorder. + * Searches for a namespace associated with the given namespace prefix + * starting from the given node through its ancestors. * - * @param root - root of the subtree - * @param node - a node + * @param node - a node to start searching at + * @param prefix - namespace prefix to search for */ -function tree_getFollowingNode(root, node) { - if (node._firstChild) { - return node._firstChild; - } - else if (node._nextSibling) { - return node._nextSibling; - } - else { - while (true) { - var parent = node._parent; - if (parent === null || parent === root) { - return null; - } - else if (parent._nextSibling) { - return parent._nextSibling; +function node_locateANamespace(node, prefix) { + if (util_1.Guard.isElementNode(node)) { + /** + * 1. If its namespace is not null and its namespace prefix is prefix, + * then return namespace. + */ + if (node._namespace !== null && node._namespacePrefix === prefix) { + return node._namespace; + } + /** + * 2. If it has an attribute whose namespace is the XMLNS namespace, + * namespace prefix is "xmlns", and local name is prefix, or if prefix + * is null and it has an attribute whose namespace is the XMLNS namespace, + * namespace prefix is null, and local name is "xmlns", then return its + * value if it is not the empty string, and null otherwise. + */ + for (var i = 0; i < node._attributeList.length; i++) { + var attr = node._attributeList[i]; + if (attr._namespace === infra_1.namespace.XMLNS && + attr._namespacePrefix === "xmlns" && + attr._localName === prefix) { + return attr._value || null; } - else { - node = parent; + if (prefix === null && attr._namespace === infra_1.namespace.XMLNS && + attr._namespacePrefix === null && attr._localName === "xmlns") { + return attr._value || null; } } + /** + * 3. If its parent element is null, then return null. + */ + if (node.parentElement === null) + return null; + /** + * 4. Return the result of running locate a namespace on its parent + * element using prefix. + */ + return node_locateANamespace(node.parentElement, prefix); } -} -exports.tree_getFollowingNode = tree_getFollowingNode; -/** - * Returns the node preceding `node` in depth-first preorder. - * - * @param root - root of the subtree - * @param node - a node - */ -function tree_getPrecedingNode(root, node) { - if (node === root) { + else if (util_1.Guard.isDocumentNode(node)) { + /** + * 1. If its document element is null, then return null. + * 2. Return the result of running locate a namespace on its document + * element using prefix. + */ + if (node.documentElement === null) + return null; + return node_locateANamespace(node.documentElement, prefix); + } + else if (util_1.Guard.isDocumentTypeNode(node) || util_1.Guard.isDocumentFragmentNode(node)) { return null; } - if (node._previousSibling) { - node = node._previousSibling; - if (node._lastChild) { - return node._lastChild; - } - else { - return node; - } + else if (util_1.Guard.isAttrNode(node)) { + /** + * 1. If its element is null, then return null. + * 2. Return the result of running locate a namespace on its element + * using prefix. + */ + if (node._element === null) + return null; + return node_locateANamespace(node._element, prefix); } else { - return node._parent; + /** + * 1. If its parent element is null, then return null. + * 2. Return the result of running locate a namespace on its parent + * element using prefix. + */ + if (!node._parent || !util_1.Guard.isElementNode(node._parent)) + return null; + return node_locateANamespace(node._parent, prefix); } } -exports.tree_getPrecedingNode = tree_getPrecedingNode; +exports.node_locateANamespace = node_locateANamespace; +//# sourceMappingURL=NodeAlgorithm.js.map + +/***/ }), + +/***/ 3973: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var DOMImpl_1 = __nccwpck_require__(14177); +var interfaces_1 = __nccwpck_require__(27305); +var TraversalAlgorithm_1 = __nccwpck_require__(80998); +var TreeAlgorithm_1 = __nccwpck_require__(16620); /** - * Determines if the node tree is constrained. A node tree is - * constrained as follows, expressed as a relationship between the - * type of node and its allowed children: - * - Document (In tree order) - * * Zero or more nodes each of which is ProcessingInstruction - * or Comment. - * * Optionally one DocumentType node. - * * Zero or more nodes each of which is ProcessingInstruction - * or Comment. - * * Optionally one Element node. - * * Zero or more nodes each of which is ProcessingInstruction - * or Comment. - * - DocumentFragment, Element - * * Zero or more nodes each of which is Element, Text, - * ProcessingInstruction, or Comment. - * - DocumentType, Text, ProcessingInstruction, Comment - * * None. + * Returns the next or previous node in the subtree, or `null` if + * there are none. * - * @param node - the root of the tree + * @param iterator - the `NodeIterator` instance + * @param forward- `true` to return the next node, or `false` to + * return the previous node. */ -function tree_isConstrained(node) { - var e_1, _a, e_2, _b, e_3, _c; - switch (node._nodeType) { - case interfaces_1.NodeType.Document: - var hasDocType = false; - var hasElement = false; - try { - for (var _d = __values(node._children), _e = _d.next(); !_e.done; _e = _d.next()) { - var childNode = _e.value; - switch (childNode._nodeType) { - case interfaces_1.NodeType.ProcessingInstruction: - case interfaces_1.NodeType.Comment: - break; - case interfaces_1.NodeType.DocumentType: - if (hasDocType || hasElement) - return false; - hasDocType = true; - break; - case interfaces_1.NodeType.Element: - if (hasElement) - return false; - hasElement = true; - break; - default: - return false; - } +function nodeIterator_traverse(iterator, forward) { + /** + * 1. Let node be iterator’s reference. + * 2. Let beforeNode be iterator’s pointer before reference. + */ + var node = iterator._reference; + var beforeNode = iterator._pointerBeforeReference; + /** + * 3. While true: + */ + while (true) { + /** + * 3.1. Branch on direction: + */ + if (forward) { + /** + * - next + */ + if (!beforeNode) { + /** + * If beforeNode is false, then set node to the first node following + * node in iterator’s iterator collection. If there is no such node, + * then return null. + */ + var nextNode = TreeAlgorithm_1.tree_getFollowingNode(iterator._root, node); + if (nextNode) { + node = nextNode; + } + else { + return null; } } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_e && !_e.done && (_a = _d.return)) _a.call(_d); + else { + /** + * If beforeNode is true, then set it to false. + */ + beforeNode = false; + } + } + else { + /** + * - previous + */ + if (beforeNode) { + /** + * If beforeNode is true, then set node to the first node preceding + * node in iterator’s iterator collection. If there is no such node, + * then return null. + */ + var prevNode = TreeAlgorithm_1.tree_getPrecedingNode(iterator.root, node); + if (prevNode) { + node = prevNode; + } + else { + return null; } - finally { if (e_1) throw e_1.error; } } + else { + /** + * If beforeNode is false, then set it to true. + */ + beforeNode = true; + } + } + /** + * 3.2. Let result be the result of filtering node within iterator. + * 3.3. If result is FILTER_ACCEPT, then break. + */ + var result = TraversalAlgorithm_1.traversal_filter(iterator, node); + if (result === interfaces_1.FilterResult.Accept) { break; - case interfaces_1.NodeType.DocumentFragment: - case interfaces_1.NodeType.Element: + } + } + /** + * 4. Set iterator’s reference to node. + * 5. Set iterator’s pointer before reference to beforeNode. + * 6. Return node. + */ + iterator._reference = node; + iterator._pointerBeforeReference = beforeNode; + return node; +} +exports.nodeIterator_traverse = nodeIterator_traverse; +/** + * Gets the global iterator list. + */ +function nodeIterator_iteratorList() { + return DOMImpl_1.dom.window._iteratorList; +} +exports.nodeIterator_iteratorList = nodeIterator_iteratorList; +//# sourceMappingURL=NodeIteratorAlgorithm.js.map + +/***/ }), + +/***/ 53670: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var infra_1 = __nccwpck_require__(84251); +/** + * Converts a whitespace separated string into an array of tokens. + * + * @param value - a string of whitespace separated tokens + */ +function orderedSet_parse(value) { + /** + * 1. Let inputTokens be the result of splitting input on ASCII whitespace. + * 2. Let tokens be a new ordered set. + * 3. For each token in inputTokens, append token to tokens. + * 4. Return tokens. + */ + var inputTokens = infra_1.string.splitAStringOnASCIIWhitespace(value); + return new Set(inputTokens); +} +exports.orderedSet_parse = orderedSet_parse; +/** + * Converts an array of tokens into a space separated string. + * + * @param tokens - an array of token strings + */ +function orderedSet_serialize(tokens) { + /** + * The ordered set serializer takes a set and returns the concatenation of + * set using U+0020 SPACE. + */ + return __spread(tokens).join(' '); +} +exports.orderedSet_serialize = orderedSet_serialize; +/** + * Removes duplicate tokens and convert all whitespace characters + * to space. + * + * @param value - a string of whitespace separated tokens + */ +function orderedSet_sanitize(value) { + return orderedSet_serialize(orderedSet_parse(value)); +} +exports.orderedSet_sanitize = orderedSet_sanitize; +/** + * Determines whether a set contains the other. + * + * @param set1 - a set + * @param set1 - a set that is contained in set1 + * @param caseSensitive - whether matches are case-sensitive + */ +function orderedSet_contains(set1, set2, caseSensitive) { + var e_1, _a, e_2, _b; + try { + for (var set2_1 = __values(set2), set2_1_1 = set2_1.next(); !set2_1_1.done; set2_1_1 = set2_1.next()) { + var val2 = set2_1_1.value; + var found = false; try { - for (var _f = __values(node._children), _g = _f.next(); !_g.done; _g = _f.next()) { - var childNode = _g.value; - switch (childNode._nodeType) { - case interfaces_1.NodeType.Element: - case interfaces_1.NodeType.Text: - case interfaces_1.NodeType.ProcessingInstruction: - case interfaces_1.NodeType.CData: - case interfaces_1.NodeType.Comment: + for (var set1_1 = (e_2 = void 0, __values(set1)), set1_1_1 = set1_1.next(); !set1_1_1.done; set1_1_1 = set1_1.next()) { + var val1 = set1_1_1.value; + if (caseSensitive) { + if (val1 === val2) { + found = true; break; - default: - return false; + } + } + else { + if (val1.toUpperCase() === val2.toUpperCase()) { + found = true; + break; + } } } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { - if (_g && !_g.done && (_b = _f.return)) _b.call(_f); + if (set1_1_1 && !set1_1_1.done && (_b = set1_1.return)) _b.call(set1_1); } finally { if (e_2) throw e_2.error; } } - break; - case interfaces_1.NodeType.DocumentType: - case interfaces_1.NodeType.Text: - case interfaces_1.NodeType.ProcessingInstruction: - case interfaces_1.NodeType.CData: - case interfaces_1.NodeType.Comment: - return (!node.hasChildNodes()); - } - try { - for (var _h = __values(node._children), _j = _h.next(); !_j.done; _j = _h.next()) { - var childNode = _j.value; - // recursively check child nodes - if (!tree_isConstrained(childNode)) + if (!found) return false; } } - catch (e_3_1) { e_3 = { error: e_3_1 }; } + catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { - if (_j && !_j.done && (_c = _h.return)) _c.call(_h); + if (set2_1_1 && !set2_1_1.done && (_a = set2_1.return)) _a.call(set2_1); } - finally { if (e_3) throw e_3.error; } + finally { if (e_1) throw e_1.error; } } return true; } -exports.tree_isConstrained = tree_isConstrained; +exports.orderedSet_contains = orderedSet_contains; +//# sourceMappingURL=OrderedSetAlgorithm.js.map + +/***/ }), + +/***/ 2328: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var util_1 = __nccwpck_require__(76195); +var CreateAlgorithm_1 = __nccwpck_require__(57339); /** - * Returns the length of a node. + * Converts the given nodes or strings into a node (if `nodes` has + * only one element) or a document fragment. * - * @param node - a node to check + * @param nodes - the array of nodes or strings, + * @param document - owner document */ -function tree_nodeLength(node) { +function parentNode_convertNodesIntoANode(nodes, document) { + var e_1, _a; /** - * To determine the length of a node node, switch on node: - * - DocumentType - * Zero. - * - Text - * - ProcessingInstruction - * - Comment - * Its data’s length. - * - Any other node - * Its number of children. - */ - if (util_1.Guard.isDocumentTypeNode(node)) { - return 0; + * 1. Let node be null. + * 2. Replace each string in nodes with a new Text node whose data is the + * string and node document is document. + */ + var node = null; + for (var i = 0; i < nodes.length; i++) { + var item = nodes[i]; + if (util_1.isString(item)) { + var text = CreateAlgorithm_1.create_text(document, item); + nodes[i] = text; + } } - else if (util_1.Guard.isCharacterDataNode(node)) { - return node._data.length; + /** + * 3. If nodes contains one node, set node to that node. + * 4. Otherwise, set node to a new DocumentFragment whose node document is + * document, and then append each node in nodes, if any, to it. + */ + if (nodes.length === 1) { + node = nodes[0]; } else { - return node._children.size; + node = CreateAlgorithm_1.create_documentFragment(document); + var ns = node; + try { + for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) { + var item = nodes_1_1.value; + ns.appendChild(item); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1); + } + finally { if (e_1) throw e_1.error; } + } } + /** + * 5. Return node. + */ + return node; } -exports.tree_nodeLength = tree_nodeLength; +exports.parentNode_convertNodesIntoANode = parentNode_convertNodesIntoANode; +//# sourceMappingURL=ParentNodeAlgorithm.js.map + +/***/ }), + +/***/ 30457: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var interfaces_1 = __nccwpck_require__(27305); +var DOMException_1 = __nccwpck_require__(13166); +var util_1 = __nccwpck_require__(65282); +var CreateAlgorithm_1 = __nccwpck_require__(57339); +var TreeAlgorithm_1 = __nccwpck_require__(16620); +var BoundaryPointAlgorithm_1 = __nccwpck_require__(81054); +var CharacterDataAlgorithm_1 = __nccwpck_require__(19461); +var NodeAlgorithm_1 = __nccwpck_require__(74924); +var MutationAlgorithm_1 = __nccwpck_require__(45463); +var TextAlgorithm_1 = __nccwpck_require__(13512); /** - * Determines if a node is empty. + * Determines if the node's start boundary point is at its end boundary + * point. * - * @param node - a node to check + * @param range - a range */ -function tree_isEmpty(node) { +function range_collapsed(range) { /** - * A node is considered empty if its length is zero. - */ - return (tree_nodeLength(node) === 0); + * A range is collapsed if its start node is its end node and its start offset is its end offset. + */ + return (range._startNode === range._endNode && range._startOffset === range._endOffset); } -exports.tree_isEmpty = tree_isEmpty; +exports.range_collapsed = range_collapsed; /** - * Returns the root node of a tree. The root of an object is itself, - * if its parent is `null`, or else it is the root of its parent. - * The root of a tree is any object participating in that tree - * whose parent is `null`. + * Gets the root node of a range. * - * @param node - a node of the tree - * @param shadow - `true` to return shadow-including root, otherwise - * `false` + * @param range - a range */ -function tree_rootNode(node, shadow) { - if (shadow === void 0) { shadow = false; } +function range_root(range) { /** - * The root of an object is itself, if its parent is null, or else it is the - * root of its parent. The root of a tree is any object participating in - * that tree whose parent is null. - */ - if (shadow) { - var root = tree_rootNode(node, false); - if (util_1.Guard.isShadowRoot(root)) - return tree_rootNode(root._host, true); - else - return root; - } - else { - if (!node._parent) - return node; - else - return tree_rootNode(node._parent); - } + * The root of a live range is the root of its start node. + */ + return TreeAlgorithm_1.tree_rootNode(range._startNode); } -exports.tree_rootNode = tree_rootNode; +exports.range_root = range_root; /** - * Determines whether `other` is a descendant of `node`. An object - * A is called a descendant of an object B, if either A is a child - * of B or A is a child of an object C that is a descendant of B. + * Determines if a node is fully contained in a range. * * @param node - a node - * @param other - the node to check - * @param self - if `true`, traversal includes `node` itself - * @param shadow - if `true`, traversal includes the - * node's and its descendant's shadow trees as well. + * @param range - a range */ -function tree_isDescendantOf(node, other, self, shadow) { - if (self === void 0) { self = false; } - if (shadow === void 0) { shadow = false; } +function range_isContained(node, range) { /** - * An object A is called a descendant of an object B, if either A is a - * child of B or A is a child of an object C that is a descendant of B. - * - * An inclusive descendant is an object or one of its descendants. - */ - var child = tree_getFirstDescendantNode(node, self, shadow); - while (child !== null) { - if (child === other) { - return true; - } - child = tree_getNextDescendantNode(node, child, self, shadow); - } - return false; + * A node node is contained in a live range range if node’s root is range’s + * root, and (node, 0) is after range’s start, and (node, node’s length) is + * before range’s end. + */ + return (TreeAlgorithm_1.tree_rootNode(node) === range_root(range) && + BoundaryPointAlgorithm_1.boundaryPoint_position([node, 0], range._start) === interfaces_1.BoundaryPosition.After && + BoundaryPointAlgorithm_1.boundaryPoint_position([node, TreeAlgorithm_1.tree_nodeLength(node)], range._end) === interfaces_1.BoundaryPosition.Before); } -exports.tree_isDescendantOf = tree_isDescendantOf; +exports.range_isContained = range_isContained; /** - * Determines whether `other` is an ancestor of `node`. An object A - * is called an ancestor of an object B if and only if B is a - * descendant of A. + * Determines if a node is partially contained in a range. * * @param node - a node - * @param other - the node to check - * @param self - if `true`, traversal includes `node` itself - * @param shadow - if `true`, traversal includes the - * node's and its descendant's shadow trees as well. + * @param range - a range */ -function tree_isAncestorOf(node, other, self, shadow) { - if (self === void 0) { self = false; } - if (shadow === void 0) { shadow = false; } - var ancestor = self ? node : shadow && util_1.Guard.isShadowRoot(node) ? - node._host : node._parent; - while (ancestor !== null) { - if (ancestor === other) - return true; - ancestor = shadow && util_1.Guard.isShadowRoot(ancestor) ? - ancestor._host : ancestor._parent; - } - return false; +function range_isPartiallyContained(node, range) { + /** + * A node is partially contained in a live range if it’s an inclusive + * ancestor of the live range’s start node but not its end node, + * or vice versa. + */ + var startCheck = TreeAlgorithm_1.tree_isAncestorOf(range._startNode, node, true); + var endCheck = TreeAlgorithm_1.tree_isAncestorOf(range._endNode, node, true); + return (startCheck && !endCheck) || (!startCheck && endCheck); } -exports.tree_isAncestorOf = tree_isAncestorOf; +exports.range_isPartiallyContained = range_isPartiallyContained; /** - * Determines whether `other` is a host-including ancestor of `node`. An - * object A is a host-including inclusive ancestor of an object B, if either - * A is an inclusive ancestor of B, or if B’s root has a non-null host and - * A is a host-including inclusive ancestor of B’s root’s host. + * Sets the start boundary point of a range. * + * @param range - a range * @param node - a node - * @param other - the node to check - * @param self - if `true`, traversal includes `node` itself + * @param offset - an offset into node */ -function tree_isHostIncludingAncestorOf(node, other, self) { - if (self === void 0) { self = false; } - if (tree_isAncestorOf(node, other, self)) - return true; - var root = tree_rootNode(node); - if (util_1.Guard.isDocumentFragmentNode(root) && root._host !== null && - tree_isHostIncludingAncestorOf(root._host, other, self)) - return true; - return false; -} -exports.tree_isHostIncludingAncestorOf = tree_isHostIncludingAncestorOf; -/** - * Determines whether `other` is a sibling of `node`. An object A is - * called a sibling of an object B, if and only if B and A share - * the same non-null parent. - * - * @param node - a node - * @param other - the node to check - * @param self - if `true`, traversal includes `node` itself - */ -function tree_isSiblingOf(node, other, self) { - if (self === void 0) { self = false; } +function range_setTheStart(range, node, offset) { /** - * An object A is called a sibling of an object B, if and only if B and A - * share the same non-null parent. - * - * An inclusive sibling is an object or one of its siblings. - */ - if (node === other) { - if (self) - return true; + * 1. If node is a doctype, then throw an "InvalidNodeTypeError" DOMException. + * 2. If offset is greater than node’s length, then throw an "IndexSizeError" + * DOMException. + * 3. Let bp be the boundary point (node, offset). + * 4. If these steps were invoked as "set the start" + * 4.1. If bp is after the range’s end, or if range’s root is not equal to + * node’s root, set range’s end to bp. + * 4.2. Set range’s start to bp. + */ + if (util_1.Guard.isDocumentTypeNode(node)) { + throw new DOMException_1.InvalidNodeTypeError(); } - else { - return (node._parent !== null && node._parent === other._parent); + if (offset > TreeAlgorithm_1.tree_nodeLength(node)) { + throw new DOMException_1.IndexSizeError(); } - return false; -} -exports.tree_isSiblingOf = tree_isSiblingOf; -/** - * Determines whether `other` is preceding `node`. An object A is - * preceding an object B if A and B are in the same tree and A comes - * before B in tree order. - * - * @param node - a node - * @param other - the node to check - */ -function tree_isPreceding(node, other) { - /** - * An object A is preceding an object B if A and B are in the same tree and - * A comes before B in tree order. - */ - var nodePos = tree_treePosition(node); - var otherPos = tree_treePosition(other); - if (nodePos === -1 || otherPos === -1) - return false; - else if (tree_rootNode(node) !== tree_rootNode(other)) - return false; - else - return otherPos < nodePos; -} -exports.tree_isPreceding = tree_isPreceding; -/** - * Determines whether `other` is following `node`. An object A is - * following an object B if A and B are in the same tree and A comes - * after B in tree order. - * - * @param node - a node - * @param other - the node to check - */ -function tree_isFollowing(node, other) { - /** - * An object A is following an object B if A and B are in the same tree and - * A comes after B in tree order. - */ - var nodePos = tree_treePosition(node); - var otherPos = tree_treePosition(other); - if (nodePos === -1 || otherPos === -1) - return false; - else if (tree_rootNode(node) !== tree_rootNode(other)) - return false; - else - return otherPos > nodePos; + var bp = [node, offset]; + if (range_root(range) !== TreeAlgorithm_1.tree_rootNode(node) || + BoundaryPointAlgorithm_1.boundaryPoint_position(bp, range._end) === interfaces_1.BoundaryPosition.After) { + range._end = bp; + } + range._start = bp; } -exports.tree_isFollowing = tree_isFollowing; +exports.range_setTheStart = range_setTheStart; /** - * Determines whether `other` is the parent node of `node`. + * Sets the end boundary point of a range. * + * @param range - a range * @param node - a node - * @param other - the node to check + * @param offset - an offset into node */ -function tree_isParentOf(node, other) { +function range_setTheEnd(range, node, offset) { /** - * An object that participates in a tree has a parent, which is either - * null or an object, and has children, which is an ordered set of objects. - * An object A whose parent is object B is a child of B. - */ - return (node._parent === other); + * 1. If node is a doctype, then throw an "InvalidNodeTypeError" DOMException. + * 2. If offset is greater than node’s length, then throw an "IndexSizeError" + * DOMException. + * 3. Let bp be the boundary point (node, offset). + * 4. If these steps were invoked as "set the end" + * 4.1. If bp is before the range’s start, or if range’s root is not equal + * to node’s root, set range’s start to bp. + * 4.2. Set range’s end to bp. + */ + if (util_1.Guard.isDocumentTypeNode(node)) { + throw new DOMException_1.InvalidNodeTypeError(); + } + if (offset > TreeAlgorithm_1.tree_nodeLength(node)) { + throw new DOMException_1.IndexSizeError(); + } + var bp = [node, offset]; + if (range_root(range) !== TreeAlgorithm_1.tree_rootNode(node) || + BoundaryPointAlgorithm_1.boundaryPoint_position(bp, range._start) === interfaces_1.BoundaryPosition.Before) { + range._start = bp; + } + range._end = bp; } -exports.tree_isParentOf = tree_isParentOf; +exports.range_setTheEnd = range_setTheEnd; /** - * Determines whether `other` is a child node of `node`. + * Selects a node. * + * @param range - a range * @param node - a node - * @param other - the node to check - */ -function tree_isChildOf(node, other) { - /** - * An object that participates in a tree has a parent, which is either - * null or an object, and has children, which is an ordered set of objects. - * An object A whose parent is object B is a child of B. - */ - return (other._parent === node); -} -exports.tree_isChildOf = tree_isChildOf; -/** - * Returns the previous sibling node of `node` or null if it has no - * preceding sibling. - * - * @param node */ -function tree_previousSibling(node) { +function range_select(node, range) { /** - * The previous sibling of an object is its first preceding sibling or null - * if it has no preceding sibling. - */ - return node._previousSibling; -} -exports.tree_previousSibling = tree_previousSibling; -/** - * Returns the next sibling node of `node` or null if it has no - * following sibling. - * - * @param node - */ -function tree_nextSibling(node) { + * 1. Let parent be node’s parent. + * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. + */ + var parent = node._parent; + if (parent === null) + throw new DOMException_1.InvalidNodeTypeError(); /** - * The next sibling of an object is its first following sibling or null - * if it has no following sibling. - */ - return node._nextSibling; + * 3. Let index be node’s index. + * 4. Set range’s start to boundary point (parent, index). + * 5. Set range’s end to boundary point (parent, index plus 1). + */ + var index = TreeAlgorithm_1.tree_index(node); + range._start = [parent, index]; + range._end = [parent, index + 1]; } -exports.tree_nextSibling = tree_nextSibling; +exports.range_select = range_select; /** - * Returns the first child node of `node` or null if it has no - * children. + * EXtracts the contents of range as a document fragment. * - * @param node + * @param range - a range */ -function tree_firstChild(node) { +function range_extract(range) { + var e_1, _a, e_2, _b, e_3, _c; /** - * The first child of an object is its first child or null if it has no - * children. - */ - return node._firstChild; -} -exports.tree_firstChild = tree_firstChild; -/** - * Returns the last child node of `node` or null if it has no - * children. - * - * @param node - */ -function tree_lastChild(node) { + * 1. Let fragment be a new DocumentFragment node whose node document is + * range’s start node’s node document. + * 2. If range is collapsed, then return fragment. + */ + var fragment = CreateAlgorithm_1.create_documentFragment(range._startNode._nodeDocument); + if (range_collapsed(range)) + return fragment; /** - * The last child of an object is its last child or null if it has no - * children. - */ - return node._lastChild; -} -exports.tree_lastChild = tree_lastChild; -/** - * Returns the zero-based index of `node` when counted preorder in - * the tree rooted at `root`. Returns `-1` if `node` is not in - * the tree. - * - * @param node - the node to get the index of - */ -function tree_treePosition(node) { - var root = tree_rootNode(node); - var pos = 0; - var childNode = tree_getFirstDescendantNode(root); - while (childNode !== null) { - pos++; - if (childNode === node) - return pos; - childNode = tree_getNextDescendantNode(root, childNode); - } - return -1; -} -exports.tree_treePosition = tree_treePosition; -/** - * Determines the index of `node`. The index of an object is its number of - * preceding siblings, or 0 if it has none. - * - * @param node - a node - * @param other - the node to check - */ -function tree_index(node) { + * 3. Let original start node, original start offset, original end node, + * and original end offset be range’s start node, start offset, end node, + * and end offset, respectively. + */ + var originalStartNode = range._startNode; + var originalStartOffset = range._startOffset; + var originalEndNode = range._endNode; + var originalEndOffset = range._endOffset; /** - * The index of an object is its number of preceding siblings, or 0 if it - * has none. - */ - var n = 0; - while (node._previousSibling !== null) { - n++; - node = node._previousSibling; + * 4. If original start node is original end node, and they are a Text, + * ProcessingInstruction, or Comment node: + * 4.1. Let clone be a clone of original start node. + * 4.2. Set the data of clone to the result of substringing data with node + * original start node, offset original start offset, and count original end + * offset minus original start offset. + * 4.3. Append clone to fragment. + * 4.4. Replace data with node original start node, offset original start + * offset, count original end offset minus original start offset, and data + * the empty string. + * 4.5. Return fragment. + */ + if (originalStartNode === originalEndNode && + util_1.Guard.isCharacterDataNode(originalStartNode)) { + var clone = NodeAlgorithm_1.node_clone(originalStartNode); + clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset); + MutationAlgorithm_1.mutation_append(clone, fragment); + CharacterDataAlgorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset, ''); + return fragment; } - return n; -} -exports.tree_index = tree_index; -/** - * Retargets an object against another object. - * - * @param a - an object to retarget - * @param b - an object to retarget against - */ -function tree_retarget(a, b) { /** - * To retarget an object A against an object B, repeat these steps until - * they return an object: - * 1. If one of the following is true - * - A is not a node - * - A's root is not a shadow root - * - B is a node and A's root is a shadow-including inclusive ancestor - * of B - * then return A. - * 2. Set A to A's root's host. - */ - while (true) { - if (!a || !util_1.Guard.isNode(a)) { - return a; - } - var rootOfA = tree_rootNode(a); - if (!util_1.Guard.isShadowRoot(rootOfA)) { - return a; - } - if (b && util_1.Guard.isNode(b) && tree_isAncestorOf(rootOfA, b, true, true)) { - return a; + * 5. Let common ancestor be original start node. + * 6. While common ancestor is not an inclusive ancestor of original end + * node, set common ancestor to its own parent. + */ + var commonAncestor = originalStartNode; + while (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, commonAncestor, true)) { + if (commonAncestor._parent === null) { + throw new Error("Parent node is null."); } - a = rootOfA.host; + commonAncestor = commonAncestor._parent; } -} -exports.tree_retarget = tree_retarget; -//# sourceMappingURL=TreeAlgorithm.js.map - -/***/ }), - -/***/ 4962: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var TraversalAlgorithm_1 = __nccwpck_require__(998); -/** - * Returns the first or last child node, or `null` if there are none. - * - * @param walker - the `TreeWalker` instance - * @param first - `true` to return the first child node, or `false` to - * return the last child node. - */ -function treeWalker_traverseChildren(walker, first) { /** - * 1. Let node be walker’s current. - * 2. Set node to node’s first child if type is first, and node’s last child - * if type is last. - * 3. While node is non-null: + * 7. Let first partially contained child be null. + * 8. If original start node is not an inclusive ancestor of original end + * node, set first partially contained child to the first child of common + * ancestor that is partially contained in range. */ - var node = (first ? walker._current._firstChild : walker._current._lastChild); - while (node !== null) { - /** - * 3.1. Let result be the result of filtering node within walker. - */ - var result = TraversalAlgorithm_1.traversal_filter(walker, node); - if (result === interfaces_1.FilterResult.Accept) { - /** - * 3.2. If result is FILTER_ACCEPT, then set walker’s current to node and - * return node. - */ - walker._current = node; - return node; - } - else if (result === interfaces_1.FilterResult.Skip) { - /** - * 3.3. If result is FILTER_SKIP, then: - * 3.3.1. Let child be node’s first child if type is first, and node’s - * last child if type is last. - * 3.3.2. If child is non-null, then set node to child and continue. - */ - var child = (first ? node._firstChild : node._lastChild); - if (child !== null) { - node = child; - continue; + var firstPartiallyContainedChild = null; + if (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { + try { + for (var _d = __values(commonAncestor._children), _e = _d.next(); !_e.done; _e = _d.next()) { + var node = _e.value; + if (range_isPartiallyContained(node, range)) { + firstPartiallyContainedChild = node; + break; + } } } - /** - * 3.4. While node is non-null: - */ - while (node !== null) { - /** - * 3.4.1. Let sibling be node’s next sibling if type is first, and - * node’s previous sibling if type is last. - * 3.4.2. If sibling is non-null, then set node to sibling and break. - */ - var sibling = (first ? node._nextSibling : node._previousSibling); - if (sibling !== null) { - node = sibling; - break; - } - /** - * 3.4.3. Let parent be node’s parent. - * 3.4.4. If parent is null, walker’s root, or walker’s current, then - * return null. - */ - var parent = node._parent; - if (parent === null || parent === walker._root || parent === walker._current) { - return null; + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_e && !_e.done && (_a = _d.return)) _a.call(_d); } - /** - * 3.4.5. Set node to parent. - */ - node = parent; + finally { if (e_1) throw e_1.error; } } } /** - * 5. Return null + * 9. Let last partially contained child be null. + * 10. If original end node is not an inclusive ancestor of original start + * node, set last partially contained child to the last child of common + * ancestor that is partially contained in range. */ - return null; -} -exports.treeWalker_traverseChildren = treeWalker_traverseChildren; -/** - * Returns the next or previous sibling node, or `null` if there are none. - * - * @param walker - the `TreeWalker` instance - * @param next - `true` to return the next sibling node, or `false` to - * return the previous sibling node. - */ -function treeWalker_traverseSiblings(walker, next) { + var lastPartiallyContainedChild = null; + if (!TreeAlgorithm_1.tree_isAncestorOf(originalStartNode, originalEndNode, true)) { + var children = __spread(commonAncestor._children); + for (var i = children.length - 1; i > 0; i--) { + var node = children[i]; + if (range_isPartiallyContained(node, range)) { + lastPartiallyContainedChild = node; + break; + } + } + } /** - * 1. Let node be walker’s current. - * 2. If node is root, then return null. - * 3. While node is non-null: + * 11. Let contained children be a list of all children of common ancestor + * that are contained in range, in tree order. + * 12. If any member of contained children is a doctype, then throw a + * "HierarchyRequestError" DOMException. */ - var node = walker._current; - if (node === walker._root) - return null; - while (true) { - /** - * 3.1. Let sibling be node’s next sibling if type is next, and node’s - * previous sibling if type is previous. - * 3.2. While sibling is non-null: - */ - var sibling = (next ? node._nextSibling : node._previousSibling); - while (sibling !== null) { - /** - * 3.2.1. Set node to sibling. - * 3.2.2. Let result be the result of filtering node within walker. - * 3.2.3. If result is FILTER_ACCEPT, then set walker’s current to node - * and return node. - */ - node = sibling; - var result = TraversalAlgorithm_1.traversal_filter(walker, node); - if (result === interfaces_1.FilterResult.Accept) { - walker._current = node; - return node; - } - /** - * 3.2.4. Set sibling to node’s first child if type is next, and node’s - * last child if type is previous. - * 3.2.5. If result is FILTER_REJECT or sibling is null, then set - * sibling to node’s next sibling if type is next, and node’s previous - * sibling if type is previous. - */ - sibling = (next ? node._firstChild : node._lastChild); - if (result === interfaces_1.FilterResult.Reject || sibling === null) { - sibling = (next ? node._nextSibling : node._previousSibling); + var containedChildren = []; + try { + for (var _f = __values(commonAncestor._children), _g = _f.next(); !_g.done; _g = _f.next()) { + var child = _g.value; + if (range_isContained(child, range)) { + if (util_1.Guard.isDocumentTypeNode(child)) { + throw new DOMException_1.HierarchyRequestError(); + } + containedChildren.push(child); } } - /** - * 3.3. Set node to node’s parent. - * 3.4. If node is null or walker’s root, then return null. - */ - node = node._parent; - if (node === null || node === walker._root) { - return null; + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_g && !_g.done && (_b = _f.return)) _b.call(_f); } + finally { if (e_2) throw e_2.error; } + } + var newNode; + var newOffset; + if (TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { /** - * 3.5. If the return value of filtering node within walker is FILTER_ACCEPT, - * then return null. + * 13. If original start node is an inclusive ancestor of original end node, + * set new node to original start node and new offset to original start + * offset. */ - if (TraversalAlgorithm_1.traversal_filter(walker, node) === interfaces_1.FilterResult.Accept) { - return null; - } + newNode = originalStartNode; + newOffset = originalStartOffset; } -} -exports.treeWalker_traverseSiblings = treeWalker_traverseSiblings; -//# sourceMappingURL=TreeWalkerAlgorithm.js.map - -/***/ }), - -/***/ 5457: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -/** - * Defines a WebIDL `Const` property on the given object. - * - * @param o - object on which to add the property - * @param name - property name - * @param value - property value - */ -function idl_defineConst(o, name, value) { - Object.defineProperty(o, name, { writable: false, enumerable: true, configurable: false, value: value }); -} -exports.idl_defineConst = idl_defineConst; -//# sourceMappingURL=WebIDLAlgorithm.js.map - -/***/ }), - -/***/ 7030: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -/** - * Determines if the given string is valid for a `"Name"` construct. - * - * @param name - name string to test - */ -function xml_isName(name) { - for (var i = 0; i < name.length; i++) { - var n = name.charCodeAt(i); - // NameStartChar - if ((n >= 97 && n <= 122) || // [a-z] - (n >= 65 && n <= 90) || // [A-Z] - n === 58 || n === 95 || // ':' or '_' - (n >= 0xC0 && n <= 0xD6) || - (n >= 0xD8 && n <= 0xF6) || - (n >= 0xF8 && n <= 0x2FF) || - (n >= 0x370 && n <= 0x37D) || - (n >= 0x37F && n <= 0x1FFF) || - (n >= 0x200C && n <= 0x200D) || - (n >= 0x2070 && n <= 0x218F) || - (n >= 0x2C00 && n <= 0x2FEF) || - (n >= 0x3001 && n <= 0xD7FF) || - (n >= 0xF900 && n <= 0xFDCF) || - (n >= 0xFDF0 && n <= 0xFFFD)) { - continue; + else { + /** + * 14. Otherwise: + * 14.1. Let reference node equal original start node. + * 14.2. While reference node’s parent is not null and is not an inclusive + * ancestor of original end node, set reference node to its parent. + * 14.3. Set new node to the parent of reference node, and new offset to + * one plus reference node’s index. + */ + var referenceNode = originalStartNode; + while (referenceNode._parent !== null && + !TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, referenceNode._parent)) { + referenceNode = referenceNode._parent; } - else if (i !== 0 && - (n === 45 || n === 46 || // '-' or '.' - (n >= 48 && n <= 57) || // [0-9] - (n === 0xB7) || - (n >= 0x0300 && n <= 0x036F) || - (n >= 0x203F && n <= 0x2040))) { - continue; + /* istanbul ignore next */ + if (referenceNode._parent === null) { + /** + * If reference node’s parent is null, it would be the root of range, + * so would be an inclusive ancestor of original end node, and we could + * not reach this point. + */ + throw new Error("Parent node is null."); } - if (n >= 0xD800 && n <= 0xDBFF && i < name.length - 1) { - var n2 = name.charCodeAt(i + 1); - if (n2 >= 0xDC00 && n2 <= 0xDFFF) { - n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; - i++; - if (n >= 0x10000 && n <= 0xEFFFF) { - continue; - } - } + newNode = referenceNode._parent; + newOffset = 1 + TreeAlgorithm_1.tree_index(referenceNode); + } + if (util_1.Guard.isCharacterDataNode(firstPartiallyContainedChild)) { + /** + * 15. If first partially contained child is a Text, ProcessingInstruction, + * or Comment node: + * 15.1. Let clone be a clone of original start node. + * 15.2. Set the data of clone to the result of substringing data with + * node original start node, offset original start offset, and count + * original start node’s length minus original start offset. + * 15.3. Append clone to fragment. + * 15.4. Replace data with node original start node, offset original + * start offset, count original start node’s length minus original start + * offset, and data the empty string. + */ + var clone = NodeAlgorithm_1.node_clone(originalStartNode); + clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, TreeAlgorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset); + MutationAlgorithm_1.mutation_append(clone, fragment); + CharacterDataAlgorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, TreeAlgorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset, ''); + } + else if (firstPartiallyContainedChild !== null) { + /** + * 16. Otherwise, if first partially contained child is not null: + * 16.1. Let clone be a clone of first partially contained child. + * 16.2. Append clone to fragment. + * 16.3. Let subrange be a new live range whose start is (original start + * node, original start offset) and whose end is (first partially + * contained child, first partially contained child’s length). + * 16.4. Let subfragment be the result of extracting subrange. + * 16.5. Append subfragment to clone. + */ + var clone = NodeAlgorithm_1.node_clone(firstPartiallyContainedChild); + MutationAlgorithm_1.mutation_append(clone, fragment); + var subrange = CreateAlgorithm_1.create_range([originalStartNode, originalStartOffset], [firstPartiallyContainedChild, TreeAlgorithm_1.tree_nodeLength(firstPartiallyContainedChild)]); + var subfragment = range_extract(subrange); + MutationAlgorithm_1.mutation_append(subfragment, clone); + } + try { + /** + * 17. For each contained child in contained children, append contained + * child to fragment. + */ + for (var containedChildren_1 = __values(containedChildren), containedChildren_1_1 = containedChildren_1.next(); !containedChildren_1_1.done; containedChildren_1_1 = containedChildren_1.next()) { + var child = containedChildren_1_1.value; + MutationAlgorithm_1.mutation_append(child, fragment); } - return false; } - return true; + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (containedChildren_1_1 && !containedChildren_1_1.done && (_c = containedChildren_1.return)) _c.call(containedChildren_1); + } + finally { if (e_3) throw e_3.error; } + } + if (util_1.Guard.isCharacterDataNode(lastPartiallyContainedChild)) { + /** + * 18. If last partially contained child is a Text, ProcessingInstruction, + * or Comment node: + * 18.1. Let clone be a clone of original end node. + * 18.2. Set the data of clone to the result of substringing data with + * node original end node, offset 0, and count original end offset. + * 18.3. Append clone to fragment. + * 18.4. Replace data with node original end node, offset 0, count + * original end offset, and data the empty string. + */ + var clone = NodeAlgorithm_1.node_clone(originalEndNode); + clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalEndNode, 0, originalEndOffset); + MutationAlgorithm_1.mutation_append(clone, fragment); + CharacterDataAlgorithm_1.characterData_replaceData(originalEndNode, 0, originalEndOffset, ''); + } + else if (lastPartiallyContainedChild !== null) { + /** + * 19. Otherwise, if last partially contained child is not null: + * 19.1. Let clone be a clone of last partially contained child. + * 19.2. Append clone to fragment. + * 19.3. Let subrange be a new live range whose start is (last partially + * contained child, 0) and whose end is (original end node, original + * end offset). + * 19.4. Let subfragment be the result of extracting subrange. + * 19.5. Append subfragment to clone. + */ + var clone = NodeAlgorithm_1.node_clone(lastPartiallyContainedChild); + MutationAlgorithm_1.mutation_append(clone, fragment); + var subrange = CreateAlgorithm_1.create_range([lastPartiallyContainedChild, 0], [originalEndNode, originalEndOffset]); + var subfragment = range_extract(subrange); + MutationAlgorithm_1.mutation_append(subfragment, clone); + } + /** + * 20. Set range’s start and end to (new node, new offset). + */ + range._start = [newNode, newOffset]; + range._end = [newNode, newOffset]; + /** + * 21. Return fragment. + */ + return fragment; } -exports.xml_isName = xml_isName; +exports.range_extract = range_extract; /** - * Determines if the given string is valid for a `"QName"` construct. + * Clones the contents of range as a document fragment. * - * @param name - name string to test + * @param range - a range */ -function xml_isQName(name) { - var colonFound = false; - for (var i = 0; i < name.length; i++) { - var n = name.charCodeAt(i); - // NameStartChar - if ((n >= 97 && n <= 122) || // [a-z] - (n >= 65 && n <= 90) || // [A-Z] - n === 95 || // '_' - (n >= 0xC0 && n <= 0xD6) || - (n >= 0xD8 && n <= 0xF6) || - (n >= 0xF8 && n <= 0x2FF) || - (n >= 0x370 && n <= 0x37D) || - (n >= 0x37F && n <= 0x1FFF) || - (n >= 0x200C && n <= 0x200D) || - (n >= 0x2070 && n <= 0x218F) || - (n >= 0x2C00 && n <= 0x2FEF) || - (n >= 0x3001 && n <= 0xD7FF) || - (n >= 0xF900 && n <= 0xFDCF) || - (n >= 0xFDF0 && n <= 0xFFFD)) { - continue; - } - else if (i !== 0 && - (n === 45 || n === 46 || // '-' or '.' - (n >= 48 && n <= 57) || // [0-9] - (n === 0xB7) || - (n >= 0x0300 && n <= 0x036F) || - (n >= 0x203F && n <= 0x2040))) { - continue; - } - else if (i !== 0 && n === 58) { // : - if (colonFound) - return false; // multiple colons in qname - if (i === name.length - 1) - return false; // colon at the end of qname - colonFound = true; - continue; +function range_cloneTheContents(range) { + var e_4, _a, e_5, _b, e_6, _c; + /** + * 1. Let fragment be a new DocumentFragment node whose node document + * is range’s start node’s node document. + * 2. If range is collapsed, then return fragment. + */ + var fragment = CreateAlgorithm_1.create_documentFragment(range._startNode._nodeDocument); + if (range_collapsed(range)) + return fragment; + /** + * 3. Let original start node, original start offset, original end node, + * and original end offset be range’s start node, start offset, end node, + * and end offset, respectively. + * 4. If original start node is original end node, and they are a Text, + * ProcessingInstruction, or Comment node: + * 4.1. Let clone be a clone of original start node. + * 4.2. Set the data of clone to the result of substringing data with node + * original start node, offset original start offset, and count original end + * offset minus original start offset. + * 4.3. Append clone to fragment. + * 4.5. Return fragment. + */ + var originalStartNode = range._startNode; + var originalStartOffset = range._startOffset; + var originalEndNode = range._endNode; + var originalEndOffset = range._endOffset; + if (originalStartNode === originalEndNode && + util_1.Guard.isCharacterDataNode(originalStartNode)) { + var clone = NodeAlgorithm_1.node_clone(originalStartNode); + clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset); + MutationAlgorithm_1.mutation_append(clone, fragment); + } + /** + * 5. Let common ancestor be original start node. + * 6. While common ancestor is not an inclusive ancestor of original end + * node, set common ancestor to its own parent. + */ + var commonAncestor = originalStartNode; + while (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, commonAncestor, true)) { + if (commonAncestor._parent === null) { + throw new Error("Parent node is null."); } - if (n >= 0xD800 && n <= 0xDBFF && i < name.length - 1) { - var n2 = name.charCodeAt(i + 1); - if (n2 >= 0xDC00 && n2 <= 0xDFFF) { - n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; - i++; - if (n >= 0x10000 && n <= 0xEFFFF) { - continue; + commonAncestor = commonAncestor._parent; + } + /** + * 7. Let first partially contained child be null. + * 8. If original start node is not an inclusive ancestor of original end + * node, set first partially contained child to the first child of common + * ancestor that is partially contained in range. + */ + var firstPartiallyContainedChild = null; + if (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { + try { + for (var _d = __values(commonAncestor._children), _e = _d.next(); !_e.done; _e = _d.next()) { + var node = _e.value; + if (range_isPartiallyContained(node, range)) { + firstPartiallyContainedChild = node; + break; } } } - return false; + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (_e && !_e.done && (_a = _d.return)) _a.call(_d); + } + finally { if (e_4) throw e_4.error; } + } } - return true; -} -exports.xml_isQName = xml_isQName; -/** - * Determines if the given string contains legal characters. - * - * @param chars - sequence of characters to test - */ -function xml_isLegalChar(chars) { - for (var i = 0; i < chars.length; i++) { - var n = chars.charCodeAt(i); - // #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] - if (n === 0x9 || n === 0xA || n === 0xD || - (n >= 0x20 && n <= 0xD7FF) || - (n >= 0xE000 && n <= 0xFFFD)) { - continue; + /** + * 9. Let last partially contained child be null. + * 10. If original end node is not an inclusive ancestor of original start + * node, set last partially contained child to the last child of common + * ancestor that is partially contained in range. + */ + var lastPartiallyContainedChild = null; + if (!TreeAlgorithm_1.tree_isAncestorOf(originalStartNode, originalEndNode, true)) { + var children = __spread(commonAncestor._children); + for (var i = children.length - 1; i > 0; i--) { + var node = children[i]; + if (range_isPartiallyContained(node, range)) { + lastPartiallyContainedChild = node; + break; + } } - if (n >= 0xD800 && n <= 0xDBFF && i < chars.length - 1) { - var n2 = chars.charCodeAt(i + 1); - if (n2 >= 0xDC00 && n2 <= 0xDFFF) { - n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; - i++; - if (n >= 0x10000 && n <= 0x10FFFF) { - continue; + } + /** + * 11. Let contained children be a list of all children of common ancestor + * that are contained in range, in tree order. + * 12. If any member of contained children is a doctype, then throw a + * "HierarchyRequestError" DOMException. + */ + var containedChildren = []; + try { + for (var _f = __values(commonAncestor._children), _g = _f.next(); !_g.done; _g = _f.next()) { + var child = _g.value; + if (range_isContained(child, range)) { + if (util_1.Guard.isDocumentTypeNode(child)) { + throw new DOMException_1.HierarchyRequestError(); } + containedChildren.push(child); } } - return false; } - return true; -} -exports.xml_isLegalChar = xml_isLegalChar; -/** - * Determines if the given string contains legal characters for a public - * identifier. - * - * @param chars - sequence of characters to test - */ -function xml_isPubidChar(chars) { - for (var i = 0; i < chars.length; i++) { - // PubId chars are all in the ASCII range, no need to check surrogates - var n = chars.charCodeAt(i); - // #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] - if ((n >= 97 && n <= 122) || // [a-z] - (n >= 65 && n <= 90) || // [A-Z] - (n >= 39 && n <= 59) || // ['()*+,-./] | [0-9] | [:;] - n === 0x20 || n === 0xD || n === 0xA || // #x20 | #xD | #xA - (n >= 35 && n <= 37) || // [#$%] - n === 33 || // ! - n === 61 || n === 63 || n === 64 || n === 95) { // [=?@_] - continue; + catch (e_5_1) { e_5 = { error: e_5_1 }; } + finally { + try { + if (_g && !_g.done && (_b = _f.return)) _b.call(_f); } - else { - return false; + finally { if (e_5) throw e_5.error; } + } + if (util_1.Guard.isCharacterDataNode(firstPartiallyContainedChild)) { + /** + * 13. If first partially contained child is a Text, ProcessingInstruction, + * or Comment node: + * 13.1. Let clone be a clone of original start node. + * 13.2. Set the data of clone to the result of substringing data with + * node original start node, offset original start offset, and count + * original start node’s length minus original start offset. + * 13.3. Append clone to fragment. + */ + var clone = NodeAlgorithm_1.node_clone(originalStartNode); + clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, TreeAlgorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset); + MutationAlgorithm_1.mutation_append(clone, fragment); + } + else if (firstPartiallyContainedChild !== null) { + /** + * 14. Otherwise, if first partially contained child is not null: + * 14.1. Let clone be a clone of first partially contained child. + * 14.2. Append clone to fragment. + * 14.3. Let subrange be a new live range whose start is (original start + * node, original start offset) and whose end is (first partially + * contained child, first partially contained child’s length). + * 14.4. Let subfragment be the result of cloning the contents of + * subrange. + * 14.5. Append subfragment to clone. + */ + var clone = NodeAlgorithm_1.node_clone(firstPartiallyContainedChild); + MutationAlgorithm_1.mutation_append(clone, fragment); + var subrange = CreateAlgorithm_1.create_range([originalStartNode, originalStartOffset], [firstPartiallyContainedChild, TreeAlgorithm_1.tree_nodeLength(firstPartiallyContainedChild)]); + var subfragment = range_cloneTheContents(subrange); + MutationAlgorithm_1.mutation_append(subfragment, clone); + } + try { + /** + * 15. For each contained child in contained children, append contained + * child to fragment. + * 15.1. Let clone be a clone of contained child with the clone children + * flag set. + * 15.2. Append clone to fragment. + */ + for (var containedChildren_2 = __values(containedChildren), containedChildren_2_1 = containedChildren_2.next(); !containedChildren_2_1.done; containedChildren_2_1 = containedChildren_2.next()) { + var child = containedChildren_2_1.value; + var clone = NodeAlgorithm_1.node_clone(child); + MutationAlgorithm_1.mutation_append(clone, fragment); } } - return true; -} -exports.xml_isPubidChar = xml_isPubidChar; -//# sourceMappingURL=XMLAlgorithm.js.map - -/***/ }), - -/***/ 61: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + catch (e_6_1) { e_6 = { error: e_6_1 }; } + finally { + try { + if (containedChildren_2_1 && !containedChildren_2_1.done && (_c = containedChildren_2.return)) _c.call(containedChildren_2); + } + finally { if (e_6) throw e_6.error; } + } + if (util_1.Guard.isCharacterDataNode(lastPartiallyContainedChild)) { + /** + * 16. If last partially contained child is a Text, ProcessingInstruction, + * or Comment node: + * 16.1. Let clone be a clone of original end node. + * 16.2. Set the data of clone to the result of substringing data with + * node original end node, offset 0, and count original end offset. + * 16.3. Append clone to fragment. + */ + var clone = NodeAlgorithm_1.node_clone(originalEndNode); + clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalEndNode, 0, originalEndOffset); + MutationAlgorithm_1.mutation_append(clone, fragment); + } + else if (lastPartiallyContainedChild !== null) { + /** + * 17. Otherwise, if last partially contained child is not null: + * 17.1. Let clone be a clone of last partially contained child. + * 17.2. Append clone to fragment. + * 17.3. Let subrange be a new live range whose start is (last partially + * contained child, 0) and whose end is (original end node, original + * end offset). + * 17.4. Let subfragment be the result of cloning the contents of subrange. + * 17.5. Append subfragment to clone. + */ + var clone = NodeAlgorithm_1.node_clone(lastPartiallyContainedChild); + fragment.append(clone); + var subrange = CreateAlgorithm_1.create_range([lastPartiallyContainedChild, 0], [originalEndNode, originalEndOffset]); + var subfragment = range_extract(subrange); + MutationAlgorithm_1.mutation_append(subfragment, clone); + } + /** + * 18. Return fragment. + */ + return fragment; } -Object.defineProperty(exports, "__esModule", ({ value: true })); -__export(__nccwpck_require__(2206)); -__export(__nccwpck_require__(4309)); -__export(__nccwpck_require__(1054)); -__export(__nccwpck_require__(9461)); -__export(__nccwpck_require__(7339)); -__export(__nccwpck_require__(5648)); -__export(__nccwpck_require__(2793)); -__export(__nccwpck_require__(9628)); -__export(__nccwpck_require__(3261)); -__export(__nccwpck_require__(1849)); -__export(__nccwpck_require__(8217)); -__export(__nccwpck_require__(1312)); -__export(__nccwpck_require__(5463)); -__export(__nccwpck_require__(8157)); -__export(__nccwpck_require__(5856)); -__export(__nccwpck_require__(4924)); -__export(__nccwpck_require__(3973)); -__export(__nccwpck_require__(3670)); -__export(__nccwpck_require__(2328)); -__export(__nccwpck_require__(457)); -__export(__nccwpck_require__(1853)); -__export(__nccwpck_require__(8733)); -__export(__nccwpck_require__(3512)); -__export(__nccwpck_require__(998)); -__export(__nccwpck_require__(6620)); -__export(__nccwpck_require__(4962)); -__export(__nccwpck_require__(5457)); -__export(__nccwpck_require__(7030)); -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ 6461: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var algorithm_1 = __nccwpck_require__(61); +exports.range_cloneTheContents = range_cloneTheContents; /** - * Represents a controller that allows to abort DOM requests. + * Inserts a node into a range at the start boundary point. + * + * @param node - node to insert + * @param range - a range */ -var AbortControllerImpl = /** @class */ (function () { +function range_insert(node, range) { + var e_7, _a; /** - * Initializes a new instance of `AbortController`. + * 1. If range’s start node is a ProcessingInstruction or Comment node, is a + * Text node whose parent is null, or is node, then throw a + * "HierarchyRequestError" DOMException. */ - function AbortControllerImpl() { - /** - * 1. Let signal be a new AbortSignal object. - * 2. Let controller be a new AbortController object whose signal is signal. - * 3. Return controller. - */ - this._signal = algorithm_1.create_abortSignal(); + if (util_1.Guard.isProcessingInstructionNode(range._startNode) || + util_1.Guard.isCommentNode(range._startNode) || + (util_1.Guard.isTextNode(range._startNode) && range._startNode._parent === null) || + range._startNode === node) { + throw new DOMException_1.HierarchyRequestError(); } - Object.defineProperty(AbortControllerImpl.prototype, "signal", { - /** @inheritdoc */ - get: function () { return this._signal; }, - enumerable: true, - configurable: true - }); - /** @inheritdoc */ - AbortControllerImpl.prototype.abort = function () { - algorithm_1.abort_signalAbort(this._signal); - }; - return AbortControllerImpl; -}()); -exports.AbortControllerImpl = AbortControllerImpl; -//# sourceMappingURL=AbortControllerImpl.js.map - -/***/ }), - -/***/ 22: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var EventTargetImpl_1 = __nccwpck_require__(9968); -var algorithm_1 = __nccwpck_require__(61); -/** - * Represents a signal object that communicates with a DOM request and abort - * it through an AbortController. - */ -var AbortSignalImpl = /** @class */ (function (_super) { - __extends(AbortSignalImpl, _super); /** - * Initializes a new instance of `AbortSignal`. + * 2. Let referenceNode be null. + * 3. If range’s start node is a Text node, set referenceNode to that Text + * node. + * 4. Otherwise, set referenceNode to the child of start node whose index is + * start offset, and null if there is no such child. */ - function AbortSignalImpl() { - var _this = _super.call(this) || this; - _this._abortedFlag = false; - _this._abortAlgorithms = new Set(); - return _this; + var referenceNode = null; + if (util_1.Guard.isTextNode(range._startNode)) { + referenceNode = range._startNode; + } + else { + var index = 0; + try { + for (var _b = __values(range._startNode._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var child = _c.value; + if (index === range._startOffset) { + referenceNode = child; + break; + } + index++; + } + } + catch (e_7_1) { e_7 = { error: e_7_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_7) throw e_7.error; } + } } - Object.defineProperty(AbortSignalImpl.prototype, "aborted", { - /** @inheritdoc */ - get: function () { return this._abortedFlag; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbortSignalImpl.prototype, "onabort", { - /** @inheritdoc */ - get: function () { - return algorithm_1.event_getterEventHandlerIDLAttribute(this, "onabort"); - }, - set: function (val) { - algorithm_1.event_setterEventHandlerIDLAttribute(this, "onabort", val); - }, - enumerable: true, - configurable: true - }); /** - * Creates a new `AbortSignal`. + * 5. Let parent be range’s start node if referenceNode is null, and + * referenceNode’s parent otherwise. */ - AbortSignalImpl._create = function () { - return new AbortSignalImpl(); - }; - return AbortSignalImpl; -}(EventTargetImpl_1.EventTargetImpl)); -exports.AbortSignalImpl = AbortSignalImpl; -//# sourceMappingURL=AbortSignalImpl.js.map - -/***/ }), - -/***/ 7126: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + var parent; + if (referenceNode === null) { + parent = range._startNode; + } + else { + if (referenceNode._parent === null) { + throw new Error("Parent node is null."); + } + parent = referenceNode._parent; + } + /** + * 6. Ensure pre-insertion validity of node into parent before referenceNode. + */ + MutationAlgorithm_1.mutation_ensurePreInsertionValidity(node, parent, referenceNode); + /** + * 7. If range’s start node is a Text node, set referenceNode to the result + * of splitting it with offset range’s start offset. + */ + if (util_1.Guard.isTextNode(range._startNode)) { + referenceNode = TextAlgorithm_1.text_split(range._startNode, range._startOffset); + } + /** + * 8. If node is referenceNode, set referenceNode to its next sibling. + */ + if (node === referenceNode) { + referenceNode = node._nextSibling; + } + /** + * 9. If node’s parent is not null, remove node from its parent. + */ + if (node._parent !== null) { + MutationAlgorithm_1.mutation_remove(node, node._parent); + } + /** + * 10. Let newOffset be parent’s length if referenceNode is null, and + * referenceNode’s index otherwise. + */ + var newOffset = (referenceNode === null ? + TreeAlgorithm_1.tree_nodeLength(parent) : TreeAlgorithm_1.tree_index(referenceNode)); + /** + * 11. Increase newOffset by node’s length if node is a DocumentFragment + * node, and one otherwise. + */ + if (util_1.Guard.isDocumentFragmentNode(node)) { + newOffset += TreeAlgorithm_1.tree_nodeLength(node); + } + else { + newOffset++; + } + /** + * 12. Pre-insert node into parent before referenceNode. + */ + MutationAlgorithm_1.mutation_preInsert(node, parent, referenceNode); + /** + * 13. If range is collapsed, then set range’s end to (parent, newOffset). + */ + if (range_collapsed(range)) { + range._end = [parent, newOffset]; + } +} +exports.range_insert = range_insert; /** - * Represents an abstract range with a start and end boundary point. + * Traverses through all contained nodes of a range. + * + * @param range - a range */ -var AbstractRangeImpl = /** @class */ (function () { - function AbstractRangeImpl() { - } - Object.defineProperty(AbstractRangeImpl.prototype, "_startNode", { - get: function () { return this._start[0]; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "_startOffset", { - get: function () { return this._start[1]; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "_endNode", { - get: function () { return this._end[0]; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "_endOffset", { - get: function () { return this._end[1]; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "_collapsed", { - get: function () { - return (this._start[0] === this._end[0] && - this._start[1] === this._end[1]); +function range_getContainedNodes(range) { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var container = range.commonAncestorContainer; + var currentNode = TreeAlgorithm_1.tree_getFirstDescendantNode(container); + return { + next: function () { + while (currentNode && !range_isContained(currentNode, range)) { + currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); + return result; + } + } + }; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "startContainer", { - /** @inheritdoc */ - get: function () { return this._startNode; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "startOffset", { - /** @inheritdoc */ - get: function () { return this._startOffset; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "endContainer", { - /** @inheritdoc */ - get: function () { return this._endNode; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "endOffset", { - /** @inheritdoc */ - get: function () { return this._endOffset; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "collapsed", { - /** @inheritdoc */ - get: function () { return this._collapsed; }, - enumerable: true, - configurable: true - }); - return AbstractRangeImpl; -}()); -exports.AbstractRangeImpl = AbstractRangeImpl; -//# sourceMappingURL=AbstractRangeImpl.js.map + _a; +} +exports.range_getContainedNodes = range_getContainedNodes; +/** + * Traverses through all partially contained nodes of a range. + * + * @param range - a range + */ +function range_getPartiallyContainedNodes(range) { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var container = range.commonAncestorContainer; + var currentNode = TreeAlgorithm_1.tree_getFirstDescendantNode(container); + return { + next: function () { + while (currentNode && !range_isPartiallyContained(currentNode, range)) { + currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); + return result; + } + } + }; + }, + _a; +} +exports.range_getPartiallyContainedNodes = range_getPartiallyContainedNodes; +//# sourceMappingURL=RangeAlgorithm.js.map /***/ }), -/***/ 3717: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 41853: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var NodeImpl_1 = __nccwpck_require__(1745); -var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); +var DOMException_1 = __nccwpck_require__(13166); /** - * Represents an attribute of an element node. + * Matches elements with the given selectors. + * + * @param selectors - selectors + * @param node - the node to match against */ -var AttrImpl = /** @class */ (function (_super) { - __extends(AttrImpl, _super); - /** - * Initializes a new instance of `Attr`. - * - * @param localName - local name - */ - function AttrImpl(localName) { - var _this = _super.call(this) || this; - _this._namespace = null; - _this._namespacePrefix = null; - _this._element = null; - _this._value = ''; - _this._localName = localName; - return _this; - } - Object.defineProperty(AttrImpl.prototype, "ownerElement", { - /** @inheritdoc */ - get: function () { return this._element; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AttrImpl.prototype, "namespaceURI", { - /** @inheritdoc */ - get: function () { return this._namespace; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AttrImpl.prototype, "prefix", { - /** @inheritdoc */ - get: function () { return this._namespacePrefix; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AttrImpl.prototype, "localName", { - /** @inheritdoc */ - get: function () { return this._localName; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AttrImpl.prototype, "name", { - /** @inheritdoc */ - get: function () { return this._qualifiedName; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AttrImpl.prototype, "value", { - /** @inheritdoc */ - get: function () { return this._value; }, - set: function (value) { - /** - * The value attribute’s setter must set an existing attribute value with - * context object and the given value. - */ - algorithm_1.attr_setAnExistingAttributeValue(this, value); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AttrImpl.prototype, "_qualifiedName", { - /** - * Returns the qualified name. - */ - get: function () { - /** - * An attribute’s qualified name is its local name if its namespace prefix - * is null, and its namespace prefix, followed by ":", followed by its - * local name, otherwise. - */ - return (this._namespacePrefix !== null ? - this._namespacePrefix + ':' + this._localName : - this._localName); - }, - enumerable: true, - configurable: true - }); +function selectors_scopeMatchASelectorsString(selectors, node) { /** - * Creates an `Attr`. - * - * @param document - owner document - * @param localName - local name + * TODO: Selectors + * 1. Let s be the result of parse a selector selectors. [SELECTORS4] + * 2. If s is failure, then throw a "SyntaxError" DOMException. + * 3. Return the result of match a selector against a tree with s and node’s + * root using scoping root node. [SELECTORS4]. */ - AttrImpl._create = function (document, localName) { - var node = new AttrImpl(localName); - node._nodeDocument = document; - return node; - }; - return AttrImpl; -}(NodeImpl_1.NodeImpl)); -exports.AttrImpl = AttrImpl; -/** - * Initialize prototype properties - */ -WebIDLAlgorithm_1.idl_defineConst(AttrImpl.prototype, "_nodeType", interfaces_1.NodeType.Attribute); -WebIDLAlgorithm_1.idl_defineConst(AttrImpl.prototype, "specified", true); -//# sourceMappingURL=AttrImpl.js.map + throw new DOMException_1.NotSupportedError(); +} +exports.selectors_scopeMatchASelectorsString = selectors_scopeMatchASelectorsString; +//# sourceMappingURL=SelectorsAlgorithm.js.map /***/ }), -/***/ 3977: +/***/ 68733: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } }; -})(); + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var TextImpl_1 = __nccwpck_require__(2191); -var interfaces_1 = __nccwpck_require__(7305); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); +var DOMImpl_1 = __nccwpck_require__(14177); +var util_1 = __nccwpck_require__(65282); +var util_2 = __nccwpck_require__(76195); +var TreeAlgorithm_1 = __nccwpck_require__(16620); +var MutationObserverAlgorithm_1 = __nccwpck_require__(78157); /** - * Represents a CDATA node. + * Signals a slot change to the given slot. + * + * @param slot - a slot */ -var CDATASectionImpl = /** @class */ (function (_super) { - __extends(CDATASectionImpl, _super); +function shadowTree_signalASlotChange(slot) { /** - * Initializes a new instance of `CDATASection`. - * - * @param data - node contents + * 1. Append slot to slot’s relevant agent’s signal slots. + * 2. Queue a mutation observer microtask. */ - function CDATASectionImpl(data) { - return _super.call(this, data) || this; - } + var window = DOMImpl_1.dom.window; + window._signalSlots.add(slot); + MutationObserverAlgorithm_1.observer_queueAMutationObserverMicrotask(); +} +exports.shadowTree_signalASlotChange = shadowTree_signalASlotChange; +/** + * Determines whether a the shadow tree of the given element node is + * connected to a document node. + * + * @param element - an element node of the shadow tree + */ +function shadowTree_isConnected(element) { /** - * Creates a new `CDATASection`. - * - * @param document - owner document - * @param data - node contents + * An element is connected if its shadow-including root is a document. */ - CDATASectionImpl._create = function (document, data) { - if (data === void 0) { data = ''; } - var node = new CDATASectionImpl(data); - node._nodeDocument = document; - return node; - }; - return CDATASectionImpl; -}(TextImpl_1.TextImpl)); -exports.CDATASectionImpl = CDATASectionImpl; + return util_1.Guard.isDocumentNode(TreeAlgorithm_1.tree_rootNode(element, true)); +} +exports.shadowTree_isConnected = shadowTree_isConnected; /** - * Initialize prototype properties + * Determines whether a slotable is assigned. + * + * @param slotable - a slotable */ -WebIDLAlgorithm_1.idl_defineConst(CDATASectionImpl.prototype, "_nodeType", interfaces_1.NodeType.CData); -//# sourceMappingURL=CDATASectionImpl.js.map - -/***/ }), - -/***/ 5330: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var NodeImpl_1 = __nccwpck_require__(1745); -var algorithm_1 = __nccwpck_require__(61); +function shadowTree_isAssigned(slotable) { + /** + * A slotable is assigned if its assigned slot is non-null. + */ + return (slotable._assignedSlot !== null); +} +exports.shadowTree_isAssigned = shadowTree_isAssigned; /** - * Represents a generic text node. + * Finds a slot for the given slotable. + * + * @param slotable - a slotable + * @param openFlag - `true` to search open shadow tree's only */ -var CharacterDataImpl = /** @class */ (function (_super) { - __extends(CharacterDataImpl, _super); +function shadowTree_findASlot(slotable, openFlag) { + if (openFlag === void 0) { openFlag = false; } /** - * Initializes a new instance of `CharacterData`. - * - * @param data - the text content + * 1. If slotable’s parent is null, then return null. + * 2. Let shadow be slotable’s parent’s shadow root. + * 3. If shadow is null, then return null. + * 4. If the open flag is set and shadow’s mode is not "open", then + * return null. + * 5. Return the first slot in tree order in shadow’s descendants whose name + * is slotable’s name, if any, and null otherwise. */ - function CharacterDataImpl(data) { - var _this = _super.call(this) || this; - _this._data = data; - return _this; + var node = util_1.Cast.asNode(slotable); + var parent = node._parent; + if (parent === null) + return null; + var shadow = parent._shadowRoot || null; + if (shadow === null) + return null; + if (openFlag && shadow._mode !== "open") + return null; + var child = TreeAlgorithm_1.tree_getFirstDescendantNode(shadow, false, true, function (e) { return util_1.Guard.isSlot(e); }); + while (child !== null) { + if (child._name === slotable._name) + return child; + child = TreeAlgorithm_1.tree_getNextDescendantNode(shadow, child, false, true, function (e) { return util_1.Guard.isSlot(e); }); } - Object.defineProperty(CharacterDataImpl.prototype, "data", { - /** @inheritdoc */ - get: function () { return this._data; }, - set: function (value) { - algorithm_1.characterData_replaceData(this, 0, this._data.length, value); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CharacterDataImpl.prototype, "length", { - /** @inheritdoc */ - get: function () { return this._data.length; }, - enumerable: true, - configurable: true - }); - /** @inheritdoc */ - CharacterDataImpl.prototype.substringData = function (offset, count) { - /** - * The substringData(offset, count) method, when invoked, must return the - * result of running substring data with node context object, offset offset, and count count. - */ - return algorithm_1.characterData_substringData(this, offset, count); - }; - /** @inheritdoc */ - CharacterDataImpl.prototype.appendData = function (data) { - /** - * The appendData(data) method, when invoked, must replace data with node - * context object, offset context object’s length, count 0, and data data. - */ - return algorithm_1.characterData_replaceData(this, this._data.length, 0, data); - }; - /** @inheritdoc */ - CharacterDataImpl.prototype.insertData = function (offset, data) { - /** - * The insertData(offset, data) method, when invoked, must replace data with - * node context object, offset offset, count 0, and data data. - */ - algorithm_1.characterData_replaceData(this, offset, 0, data); - }; - /** @inheritdoc */ - CharacterDataImpl.prototype.deleteData = function (offset, count) { - /** - * The deleteData(offset, count) method, when invoked, must replace data - * with node context object, offset offset, count count, and data the - * empty string. - */ - algorithm_1.characterData_replaceData(this, offset, count, ''); - }; - /** @inheritdoc */ - CharacterDataImpl.prototype.replaceData = function (offset, count, data) { - /** - * The replaceData(offset, count, data) method, when invoked, must replace - * data with node context object, offset offset, count count, and data data. - */ - algorithm_1.characterData_replaceData(this, offset, count, data); - }; - Object.defineProperty(CharacterDataImpl.prototype, "previousElementSibling", { - // MIXIN: NonDocumentTypeChildNode - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CharacterDataImpl.prototype, "nextElementSibling", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, - enumerable: true, - configurable: true - }); - // MIXIN: ChildNode - /* istanbul ignore next */ - CharacterDataImpl.prototype.before = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; - /* istanbul ignore next */ - CharacterDataImpl.prototype.after = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; - /* istanbul ignore next */ - CharacterDataImpl.prototype.replaceWith = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; - /* istanbul ignore next */ - CharacterDataImpl.prototype.remove = function () { throw new Error("Mixin: ChildNode not implemented."); }; - return CharacterDataImpl; -}(NodeImpl_1.NodeImpl)); -exports.CharacterDataImpl = CharacterDataImpl; -//# sourceMappingURL=CharacterDataImpl.js.map - -/***/ }), - -/***/ 8264: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(5282); -var algorithm_1 = __nccwpck_require__(61); + return null; +} +exports.shadowTree_findASlot = shadowTree_findASlot; /** - * Represents a mixin that extends child nodes that can have siblings - * including doctypes. This mixin is implemented by {@link Element}, - * {@link CharacterData} and {@link DocumentType}. + * Finds slotables for the given slot. + * + * @param slot - a slot */ -var ChildNodeImpl = /** @class */ (function () { - function ChildNodeImpl() { - } - /** @inheritdoc */ - ChildNodeImpl.prototype.before = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - /** - * 1. Let parent be context object’s parent. - * 2. If parent is null, then return. - */ - var context = util_1.Cast.asNode(this); - var parent = context._parent; - if (parent === null) - return; - /** - * 3. Let viablePreviousSibling be context object’s first preceding - * sibling not in nodes, and null otherwise. - */ - var viablePreviousSibling = context._previousSibling; - var flag = true; - while (flag && viablePreviousSibling) { - flag = false; - for (var i = 0; i < nodes.length; i++) { - var child = nodes[i]; - if (child === viablePreviousSibling) { - viablePreviousSibling = viablePreviousSibling._previousSibling; - flag = true; - break; +function shadowTree_findSlotables(slot) { + var e_1, _a; + /** + * 1. Let result be an empty list. + * 2. If slot’s root is not a shadow root, then return result. + */ + var result = []; + var root = TreeAlgorithm_1.tree_rootNode(slot); + if (!util_1.Guard.isShadowRoot(root)) + return result; + /** + * 3. Let host be slot’s root’s host. + * 4. For each slotable child of host, slotable, in tree order: + */ + var host = root._host; + try { + for (var _b = __values(host._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var slotable = _c.value; + if (util_1.Guard.isSlotable(slotable)) { + /** + * 4.1. Let foundSlot be the result of finding a slot given slotable. + * 4.2. If foundSlot is slot, then append slotable to result. + */ + var foundSlot = shadowTree_findASlot(slotable); + if (foundSlot === slot) { + result.push(slotable); } } } - /** - * 4. Let node be the result of converting nodes into a node, given nodes - * and context object’s node document. - */ - var node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument); - /** - * 5. If viablePreviousSibling is null, set it to parent’s first child, - * and to viablePreviousSibling’s next sibling otherwise. - */ - if (viablePreviousSibling === null) - viablePreviousSibling = parent._firstChild; - else - viablePreviousSibling = viablePreviousSibling._nextSibling; - /** - * 6. Pre-insert node into parent before viablePreviousSibling. - */ - algorithm_1.mutation_preInsert(node, parent, viablePreviousSibling); - }; - /** @inheritdoc */ - ChildNodeImpl.prototype.after = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } - /** - * 1. Let parent be context object’s parent. - * 2. If parent is null, then return. - */ - var context = util_1.Cast.asNode(this); - var parent = context._parent; - if (!parent) - return; - /** - * 3. Let viableNextSibling be context object’s first following sibling not - * in nodes, and null otherwise. - */ - var viableNextSibling = context._nextSibling; - var flag = true; - while (flag && viableNextSibling) { - flag = false; - for (var i = 0; i < nodes.length; i++) { - var child = nodes[i]; - if (child === viableNextSibling) { - viableNextSibling = viableNextSibling._nextSibling; - flag = true; - break; + finally { if (e_1) throw e_1.error; } + } + /** + * 5. Return result. + */ + return result; +} +exports.shadowTree_findSlotables = shadowTree_findSlotables; +/** + * Finds slotables for the given slot. + * + * @param slot - a slot + */ +function shadowTree_findFlattenedSlotables(slot) { + var e_2, _a, e_3, _b; + /** + * 1. Let result be an empty list. + * 2. If slot’s root is not a shadow root, then return result. + */ + var result = []; + var root = TreeAlgorithm_1.tree_rootNode(slot); + if (!util_1.Guard.isShadowRoot(root)) + return result; + /** + * 3. Let slotables be the result of finding slotables given slot. + * 4. If slotables is the empty list, then append each slotable child of + * slot, in tree order, to slotables. + */ + var slotables = shadowTree_findSlotables(slot); + if (util_2.isEmpty(slotables)) { + try { + for (var _c = __values(slot._children), _d = _c.next(); !_d.done; _d = _c.next()) { + var slotable = _d.value; + if (util_1.Guard.isSlotable(slotable)) { + slotables.push(slotable); } } } - /** - * 4. Let node be the result of converting nodes into a node, given nodes - * and context object’s node document. - */ - var node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument); - /** - * 5. Pre-insert node into parent before viableNextSibling. - */ - algorithm_1.mutation_preInsert(node, parent, viableNextSibling); - }; - /** @inheritdoc */ - ChildNodeImpl.prototype.replaceWith = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + } + finally { if (e_2) throw e_2.error; } } + } + try { /** - * 1. Let parent be context object’s parent. - * 2. If parent is null, then return. - */ - var context = util_1.Cast.asNode(this); - var parent = context._parent; - if (!parent) - return; - /** - * 3. Let viableNextSibling be context object’s first following sibling not - * in nodes, and null otherwise. + * 5. For each node in slotables: */ - var viableNextSibling = context._nextSibling; - var flag = true; - while (flag && viableNextSibling) { - flag = false; - for (var i = 0; i < nodes.length; i++) { - var child = nodes[i]; - if (child === viableNextSibling) { - viableNextSibling = viableNextSibling._nextSibling; - flag = true; - break; - } + for (var slotables_1 = __values(slotables), slotables_1_1 = slotables_1.next(); !slotables_1_1.done; slotables_1_1 = slotables_1.next()) { + var node = slotables_1_1.value; + /** + * 5.1. If node is a slot whose root is a shadow root, then: + */ + if (util_1.Guard.isSlot(node) && util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(node))) { + /** + * 5.1.1. Let temporaryResult be the result of finding flattened slotables given node. + * 5.1.2. Append each slotable in temporaryResult, in order, to result. + */ + var temporaryResult = shadowTree_findFlattenedSlotables(node); + result.push.apply(result, __spread(temporaryResult)); + } + else { + /** + * 5.2. Otherwise, append node to result. + */ + result.push(node); } } - /** - * 4. Let node be the result of converting nodes into a node, given nodes - * and context object’s node document. - */ - var node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument); - /** - * 5. If context object’s parent is parent, replace the context object with - * node within parent. - * _Note:_ Context object could have been inserted into node. - * 6. Otherwise, pre-insert node into parent before viableNextSibling. - */ - if (context._parent === parent) - algorithm_1.mutation_replace(context, node, parent); - else - algorithm_1.mutation_preInsert(node, parent, viableNextSibling); - }; - /** @inheritdoc */ - ChildNodeImpl.prototype.remove = function () { - /** - * 1. If context object’s parent is null, then return. - * 2. Remove the context object from context object’s parent. - */ - var context = util_1.Cast.asNode(this); - var parent = context._parent; - if (!parent) - return; - algorithm_1.mutation_remove(context, parent); - }; - return ChildNodeImpl; -}()); -exports.ChildNodeImpl = ChildNodeImpl; -//# sourceMappingURL=ChildNodeImpl.js.map - -/***/ }), - -/***/ 930: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var CharacterDataImpl_1 = __nccwpck_require__(5330); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (slotables_1_1 && !slotables_1_1.done && (_b = slotables_1.return)) _b.call(slotables_1); + } + finally { if (e_3) throw e_3.error; } + } + /** + * 6. Return result. + */ + return result; +} +exports.shadowTree_findFlattenedSlotables = shadowTree_findFlattenedSlotables; /** - * Represents a comment node. + * Assigns slotables to the given slot. + * + * @param slot - a slot */ -var CommentImpl = /** @class */ (function (_super) { - __extends(CommentImpl, _super); +function shadowTree_assignSlotables(slot) { + var e_4, _a; /** - * Initializes a new instance of `Comment`. - * - * @param data - the text content + * 1. Let slotables be the result of finding slotables for slot. + * 2. If slotables and slot’s assigned nodes are not identical, then run + * signal a slot change for slot. */ - function CommentImpl(data) { - if (data === void 0) { data = ''; } - return _super.call(this, data) || this; + var slotables = shadowTree_findSlotables(slot); + if (slotables.length === slot._assignedNodes.length) { + var nodesIdentical = true; + for (var i = 0; i < slotables.length; i++) { + if (slotables[i] !== slot._assignedNodes[i]) { + nodesIdentical = false; + break; + } + } + if (!nodesIdentical) { + shadowTree_signalASlotChange(slot); + } } /** - * Creates a new `Comment`. - * - * @param document - owner document - * @param data - node contents + * 3. Set slot’s assigned nodes to slotables. + * 4. For each slotable in slotables, set slotable’s assigned slot to slot. */ - CommentImpl._create = function (document, data) { - if (data === void 0) { data = ''; } - var node = new CommentImpl(data); - node._nodeDocument = document; - return node; - }; - return CommentImpl; -}(CharacterDataImpl_1.CharacterDataImpl)); -exports.CommentImpl = CommentImpl; -/** - * Initialize prototype properties + slot._assignedNodes = slotables; + try { + for (var slotables_2 = __values(slotables), slotables_2_1 = slotables_2.next(); !slotables_2_1.done; slotables_2_1 = slotables_2.next()) { + var slotable = slotables_2_1.value; + slotable._assignedSlot = slot; + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (slotables_2_1 && !slotables_2_1.done && (_a = slotables_2.return)) _a.call(slotables_2); + } + finally { if (e_4) throw e_4.error; } + } +} +exports.shadowTree_assignSlotables = shadowTree_assignSlotables; +/** + * Assigns slotables to all nodes of a tree. + * + * @param root - root node */ -WebIDLAlgorithm_1.idl_defineConst(CommentImpl.prototype, "_nodeType", interfaces_1.NodeType.Comment); -//# sourceMappingURL=CommentImpl.js.map +function shadowTree_assignSlotablesForATree(root) { + /** + * To assign slotables for a tree, given a node root, run assign slotables + * for each slot slot in root’s inclusive descendants, in tree order. + */ + var descendant = TreeAlgorithm_1.tree_getFirstDescendantNode(root, true, false, function (e) { return util_1.Guard.isSlot(e); }); + while (descendant !== null) { + shadowTree_assignSlotables(descendant); + descendant = TreeAlgorithm_1.tree_getNextDescendantNode(root, descendant, true, false, function (e) { return util_1.Guard.isSlot(e); }); + } +} +exports.shadowTree_assignSlotablesForATree = shadowTree_assignSlotablesForATree; +/** + * Assigns a slot to a slotables. + * + * @param slotable - a slotable + */ +function shadowTree_assignASlot(slotable) { + /** + * 1. Let slot be the result of finding a slot with slotable. + * 2. If slot is non-null, then run assign slotables for slot. + */ + var slot = shadowTree_findASlot(slotable); + if (slot !== null) { + shadowTree_assignSlotables(slot); + } +} +exports.shadowTree_assignASlot = shadowTree_assignASlot; +//# sourceMappingURL=ShadowTreeAlgorithm.js.map /***/ }), -/***/ 9857: +/***/ 13512: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } }; -})(); + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var EventImpl_1 = __nccwpck_require__(8245); -var algorithm_1 = __nccwpck_require__(61); +var DOMImpl_1 = __nccwpck_require__(14177); +var util_1 = __nccwpck_require__(65282); +var DOMException_1 = __nccwpck_require__(13166); +var CreateAlgorithm_1 = __nccwpck_require__(57339); +var TreeAlgorithm_1 = __nccwpck_require__(16620); +var CharacterDataAlgorithm_1 = __nccwpck_require__(19461); +var MutationAlgorithm_1 = __nccwpck_require__(45463); /** - * Represents and event that carries custom data. + * Returns node with its adjacent text and cdata node siblings. + * + * @param node - a node + * @param self - whether to include node itself */ -var CustomEventImpl = /** @class */ (function (_super) { - __extends(CustomEventImpl, _super); +function text_contiguousTextNodes(node, self) { + var _a; + if (self === void 0) { self = false; } /** - * Initializes a new instance of `CustomEvent`. + * The contiguous Text nodes of a node node are node, node’s previous + * sibling Text node, if any, and its contiguous Text nodes, and node’s next + * sibling Text node, if any, and its contiguous Text nodes, avoiding any + * duplicates. */ - function CustomEventImpl(type, eventInit) { - var _this = _super.call(this, type, eventInit) || this; - _this._detail = null; - _this._detail = (eventInit && eventInit.detail) || null; - return _this; + return _a = {}, + _a[Symbol.iterator] = function () { + var currentNode = node; + while (currentNode && util_1.Guard.isTextNode(currentNode._previousSibling)) { + currentNode = currentNode._previousSibling; + } + return { + next: function () { + if (currentNode && (!self && currentNode === node)) { + if (util_1.Guard.isTextNode(currentNode._nextSibling)) { + currentNode = currentNode._nextSibling; + } + else { + currentNode = null; + } + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + if (util_1.Guard.isTextNode(currentNode._nextSibling)) { + currentNode = currentNode._nextSibling; + } + else { + currentNode = null; + } + return result; + } + } + }; + }, + _a; +} +exports.text_contiguousTextNodes = text_contiguousTextNodes; +/** + * Returns node with its adjacent text node siblings. + * + * @param node - a node + * @param self - whether to include node itself + */ +function text_contiguousExclusiveTextNodes(node, self) { + var _a; + if (self === void 0) { self = false; } + /** + * The contiguous exclusive Text nodes of a node node are node, node’s + * previous sibling exclusive Text node, if any, and its contiguous + * exclusive Text nodes, and node’s next sibling exclusive Text node, + * if any, and its contiguous exclusive Text nodes, avoiding any duplicates. + */ + return _a = {}, + _a[Symbol.iterator] = function () { + var currentNode = node; + while (currentNode && util_1.Guard.isExclusiveTextNode(currentNode._previousSibling)) { + currentNode = currentNode._previousSibling; + } + return { + next: function () { + if (currentNode && (!self && currentNode === node)) { + if (util_1.Guard.isExclusiveTextNode(currentNode._nextSibling)) { + currentNode = currentNode._nextSibling; + } + else { + currentNode = null; + } + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + if (util_1.Guard.isExclusiveTextNode(currentNode._nextSibling)) { + currentNode = currentNode._nextSibling; + } + else { + currentNode = null; + } + return result; + } + } + }; + }, + _a; +} +exports.text_contiguousExclusiveTextNodes = text_contiguousExclusiveTextNodes; +/** + * Returns the concatenation of the data of all the Text node descendants of + * node, in tree order. + * + * @param node - a node + */ +function text_descendantTextContent(node) { + /** + * The descendant text content of a node node is the concatenation of the + * data of all the Text node descendants of node, in tree order. + */ + var contents = ''; + var text = TreeAlgorithm_1.tree_getFirstDescendantNode(node, false, false, function (e) { return util_1.Guard.isTextNode(e); }); + while (text !== null) { + contents += text._data; + text = TreeAlgorithm_1.tree_getNextDescendantNode(node, text, false, false, function (e) { return util_1.Guard.isTextNode(e); }); } - Object.defineProperty(CustomEventImpl.prototype, "detail", { - /** @inheritdoc */ - get: function () { return this._detail; }, - enumerable: true, - configurable: true - }); - /** @inheritdoc */ - CustomEventImpl.prototype.initCustomEvent = function (type, bubbles, cancelable, detail) { - if (bubbles === void 0) { bubbles = false; } - if (cancelable === void 0) { cancelable = false; } - if (detail === void 0) { detail = null; } - /** - * 1. If the context object’s dispatch flag is set, then return. - */ - if (this._dispatchFlag) - return; - /** - * 2. Initialize the context object with type, bubbles, and cancelable. - */ - algorithm_1.event_initialize(this, type, bubbles, cancelable); + return contents; +} +exports.text_descendantTextContent = text_descendantTextContent; +/** + * Splits data at the given offset and returns the remainder as a text + * node. + * + * @param node - a text node + * @param offset - the offset at which to split the nodes. + */ +function text_split(node, offset) { + var e_1, _a; + /** + * 1. Let length be node’s length. + * 2. If offset is greater than length, then throw an "IndexSizeError" + * DOMException. + */ + var length = node._data.length; + if (offset > length) { + throw new DOMException_1.IndexSizeError(); + } + /** + * 3. Let count be length minus offset. + * 4. Let new data be the result of substringing data with node node, + * offset offset, and count count. + * 5. Let new node be a new Text node, with the same node document as node. + * Set new node’s data to new data. + * 6. Let parent be node’s parent. + * 7. If parent is not null, then: + */ + var count = length - offset; + var newData = CharacterDataAlgorithm_1.characterData_substringData(node, offset, count); + var newNode = CreateAlgorithm_1.create_text(node._nodeDocument, newData); + var parent = node._parent; + if (parent !== null) { /** - * 3. Set the context object’s detail attribute to detail. + * 7.1. Insert new node into parent before node’s next sibling. */ - this._detail = detail; - }; - return CustomEventImpl; -}(EventImpl_1.EventImpl)); -exports.CustomEventImpl = CustomEventImpl; -//# sourceMappingURL=CustomEventImpl.js.map + MutationAlgorithm_1.mutation_insert(newNode, parent, node._nextSibling); + try { + /** + * 7.2. For each live range whose start node is node and start offset is + * greater than offset, set its start node to new node and decrease its + * start offset by offset. + * 7.3. For each live range whose end node is node and end offset is greater + * than offset, set its end node to new node and decrease its end offset + * by offset. + * 7.4. For each live range whose start node is parent and start offset is + * equal to the index of node plus 1, increase its start offset by 1. + * 7.5. For each live range whose end node is parent and end offset is equal + * to the index of node plus 1, increase its end offset by 1. + */ + for (var _b = __values(DOMImpl_1.dom.rangeList), _c = _b.next(); !_c.done; _c = _b.next()) { + var range = _c.value; + if (range._start[0] === node && range._start[1] > offset) { + range._start[0] = newNode; + range._start[1] -= offset; + } + if (range._end[0] === node && range._end[1] > offset) { + range._end[0] = newNode; + range._end[1] -= offset; + } + var index = TreeAlgorithm_1.tree_index(node); + if (range._start[0] === parent && range._start[1] === index + 1) { + range._start[1]++; + } + if (range._end[0] === parent && range._end[1] === index + 1) { + range._end[1]++; + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + } + /** + * 8. Replace data with node node, offset offset, count count, and data + * the empty string. + * 9. Return new node. + */ + CharacterDataAlgorithm_1.characterData_replaceData(node, offset, count, ''); + return newNode; +} +exports.text_split = text_split; +//# sourceMappingURL=TextAlgorithm.js.map /***/ }), -/***/ 3166: -/***/ (function(__unused_webpack_module, exports) { +/***/ 80998: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); +var interfaces_1 = __nccwpck_require__(27305); +var DOMException_1 = __nccwpck_require__(13166); /** - * Represents the base class of `Error` objects used by this module. + * Applies the filter to the given node and returns the result. + * + * @param traverser - the `NodeIterator` or `TreeWalker` instance + * @param node - the node to filter */ -var DOMException = /** @class */ (function (_super) { - __extends(DOMException, _super); +function traversal_filter(traverser, node) { /** - * - * @param name - message name - * @param message - error message + * 1. If traverser’s active flag is set, then throw an "InvalidStateError" + * DOMException. */ - function DOMException(name, message) { - if (message === void 0) { message = ""; } - var _this = _super.call(this, message) || this; - _this.name = name; - return _this; + if (traverser._activeFlag) { + throw new DOMException_1.InvalidStateError(); } - return DOMException; -}(Error)); -exports.DOMException = DOMException; -var DOMStringSizeError = /** @class */ (function (_super) { - __extends(DOMStringSizeError, _super); /** - * @param message - error message - */ - function DOMStringSizeError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "DOMStringSizeError", message) || this; - } - return DOMStringSizeError; -}(DOMException)); -exports.DOMStringSizeError = DOMStringSizeError; -var WrongDocumentError = /** @class */ (function (_super) { - __extends(WrongDocumentError, _super); + * 2. Let n be node’s nodeType attribute value − 1. + */ + var n = node._nodeType - 1; /** - * @param message - error message - */ - function WrongDocumentError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "WrongDocumentError", "The object is in the wrong document. " + message) || this; + * 3. If the nth bit (where 0 is the least significant bit) of traverser’s + * whatToShow is not set, then return FILTER_SKIP. + */ + var mask = 1 << n; + if ((traverser.whatToShow & mask) === 0) { + return interfaces_1.FilterResult.Skip; } - return WrongDocumentError; -}(DOMException)); -exports.WrongDocumentError = WrongDocumentError; -var NoDataAllowedError = /** @class */ (function (_super) { - __extends(NoDataAllowedError, _super); /** - * @param message - error message - */ - function NoDataAllowedError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NoDataAllowedError", message) || this; + * 4. If traverser’s filter is null, then return FILTER_ACCEPT. + */ + if (!traverser.filter) { + return interfaces_1.FilterResult.Accept; } - return NoDataAllowedError; -}(DOMException)); -exports.NoDataAllowedError = NoDataAllowedError; -var NoModificationAllowedError = /** @class */ (function (_super) { - __extends(NoModificationAllowedError, _super); /** - * @param message - error message - */ - function NoModificationAllowedError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NoModificationAllowedError", "The object can not be modified. " + message) || this; - } - return NoModificationAllowedError; -}(DOMException)); -exports.NoModificationAllowedError = NoModificationAllowedError; -var NotSupportedError = /** @class */ (function (_super) { - __extends(NotSupportedError, _super); + * 5. Set traverser’s active flag. + */ + traverser._activeFlag = true; /** - * @param message - error message - */ - function NotSupportedError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NotSupportedError", "The operation is not supported. " + message) || this; + * 6. Let result be the return value of call a user object’s operation with + * traverser’s filter, "acceptNode", and « node ». If this throws an + * exception, then unset traverser’s active flag and rethrow the exception. + */ + var result = interfaces_1.FilterResult.Reject; + try { + result = traverser.filter.acceptNode(node); } - return NotSupportedError; -}(DOMException)); -exports.NotSupportedError = NotSupportedError; -var InUseAttributeError = /** @class */ (function (_super) { - __extends(InUseAttributeError, _super); - /** - * @param message - error message - */ - function InUseAttributeError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "InUseAttributeError", message) || this; + catch (err) { + traverser._activeFlag = false; + throw err; } - return InUseAttributeError; -}(DOMException)); -exports.InUseAttributeError = InUseAttributeError; -var InvalidStateError = /** @class */ (function (_super) { - __extends(InvalidStateError, _super); /** - * @param message - error message - */ - function InvalidStateError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "InvalidStateError", "The object is in an invalid state. " + message) || this; + * 7. Unset traverser’s active flag. + * 8. Return result. + */ + traverser._activeFlag = false; + return result; +} +exports.traversal_filter = traversal_filter; +//# sourceMappingURL=TraversalAlgorithm.js.map + +/***/ }), + +/***/ 16620: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var util_1 = __nccwpck_require__(65282); +var interfaces_1 = __nccwpck_require__(27305); +/** + * Gets the next descendant of the given node of the tree rooted at `root` + * in depth-first pre-order. + * + * @param root - root node of the tree + * @param node - a node + * @param shadow - whether to visit shadow tree nodes + */ +function _getNextDescendantNode(root, node, shadow) { + if (shadow === void 0) { shadow = false; } + // traverse shadow tree + if (shadow && util_1.Guard.isElementNode(node) && util_1.Guard.isShadowRoot(node.shadowRoot)) { + if (node.shadowRoot._firstChild) + return node.shadowRoot._firstChild; } - return InvalidStateError; -}(DOMException)); -exports.InvalidStateError = InvalidStateError; -var InvalidModificationError = /** @class */ (function (_super) { - __extends(InvalidModificationError, _super); - /** - * @param message - error message - */ - function InvalidModificationError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "InvalidModificationError", "The object can not be modified in this way. " + message) || this; + // traverse child nodes + if (node._firstChild) + return node._firstChild; + if (node === root) + return null; + // traverse siblings + if (node._nextSibling) + return node._nextSibling; + // traverse parent's next sibling + var parent = node._parent; + while (parent && parent !== root) { + if (parent._nextSibling) + return parent._nextSibling; + parent = parent._parent; } - return InvalidModificationError; -}(DOMException)); -exports.InvalidModificationError = InvalidModificationError; -var NamespaceError = /** @class */ (function (_super) { - __extends(NamespaceError, _super); - /** - * @param message - error message - */ - function NamespaceError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NamespaceError", "The operation is not allowed by Namespaces in XML. [XMLNS] " + message) || this; + return null; +} +function _emptyIterator() { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + return { + next: function () { + return { done: true, value: null }; + } + }; + }, + _a; +} +/** + * Returns the first descendant node of the tree rooted at `node` in + * depth-first pre-order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param shadow - whether to visit shadow tree nodes + * @param filter - a function to filter nodes + */ +function tree_getFirstDescendantNode(node, self, shadow, filter) { + if (self === void 0) { self = false; } + if (shadow === void 0) { shadow = false; } + var firstNode = (self ? node : _getNextDescendantNode(node, node, shadow)); + while (firstNode && filter && !filter(firstNode)) { + firstNode = _getNextDescendantNode(node, firstNode, shadow); } - return NamespaceError; -}(DOMException)); -exports.NamespaceError = NamespaceError; -var InvalidAccessError = /** @class */ (function (_super) { - __extends(InvalidAccessError, _super); - /** - * @param message - error message - */ - function InvalidAccessError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "InvalidAccessError", "The object does not support the operation or argument. " + message) || this; + return firstNode; +} +exports.tree_getFirstDescendantNode = tree_getFirstDescendantNode; +/** + * Returns the next descendant node of the tree rooted at `node` in + * depth-first pre-order. + * + * @param node - root node of the tree + * @param currentNode - current descendant node + * @param self - whether to include `node` in traversal + * @param shadow - whether to visit shadow tree nodes + * @param filter - a function to filter nodes + */ +function tree_getNextDescendantNode(node, currentNode, self, shadow, filter) { + if (self === void 0) { self = false; } + if (shadow === void 0) { shadow = false; } + var nextNode = _getNextDescendantNode(node, currentNode, shadow); + while (nextNode && filter && !filter(nextNode)) { + nextNode = _getNextDescendantNode(node, nextNode, shadow); } - return InvalidAccessError; -}(DOMException)); -exports.InvalidAccessError = InvalidAccessError; -var ValidationError = /** @class */ (function (_super) { - __extends(ValidationError, _super); - /** - * @param message - error message - */ - function ValidationError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "ValidationError", message) || this; + return nextNode; +} +exports.tree_getNextDescendantNode = tree_getNextDescendantNode; +/** + * Traverses through all descendant nodes of the tree rooted at + * `node` in depth-first pre-order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param shadow - whether to visit shadow tree nodes + * @param filter - a function to filter nodes + */ +function tree_getDescendantNodes(node, self, shadow, filter) { + var _a; + if (self === void 0) { self = false; } + if (shadow === void 0) { shadow = false; } + if (!self && node._children.size === 0) { + return _emptyIterator(); } - return ValidationError; -}(DOMException)); -exports.ValidationError = ValidationError; -var TypeMismatchError = /** @class */ (function (_super) { - __extends(TypeMismatchError, _super); - /** - * @param message - error message - */ - function TypeMismatchError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "TypeMismatchError", message) || this; + return _a = {}, + _a[Symbol.iterator] = function () { + var currentNode = (self ? node : _getNextDescendantNode(node, node, shadow)); + return { + next: function () { + while (currentNode && filter && !filter(currentNode)) { + currentNode = _getNextDescendantNode(node, currentNode, shadow); + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = _getNextDescendantNode(node, currentNode, shadow); + return result; + } + } + }; + }, + _a; +} +exports.tree_getDescendantNodes = tree_getDescendantNodes; +/** + * Traverses through all descendant element nodes of the tree rooted at + * `node` in depth-first preorder. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param shadow - whether to visit shadow tree nodes + * @param filter - a function to filter nodes + */ +function tree_getDescendantElements(node, self, shadow, filter) { + var _a; + if (self === void 0) { self = false; } + if (shadow === void 0) { shadow = false; } + if (!self && node._children.size === 0) { + return _emptyIterator(); } - return TypeMismatchError; -}(DOMException)); -exports.TypeMismatchError = TypeMismatchError; -var SecurityError = /** @class */ (function (_super) { - __extends(SecurityError, _super); - /** - * @param message - error message - */ - function SecurityError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "SecurityError", "The operation is insecure. " + message) || this; + return _a = {}, + _a[Symbol.iterator] = function () { + var it = tree_getDescendantNodes(node, self, shadow, function (e) { return util_1.Guard.isElementNode(e); })[Symbol.iterator](); + var currentNode = it.next().value; + return { + next: function () { + while (currentNode && filter && !filter(currentNode)) { + currentNode = it.next().value; + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = it.next().value; + return result; + } + } + }; + }, + _a; +} +exports.tree_getDescendantElements = tree_getDescendantElements; +/** + * Traverses through all sibling nodes of `node`. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param filter - a function to filter nodes + */ +function tree_getSiblingNodes(node, self, filter) { + var _a; + if (self === void 0) { self = false; } + if (!node._parent || node._parent._children.size === 0) { + return _emptyIterator(); } - return SecurityError; -}(DOMException)); -exports.SecurityError = SecurityError; -var NetworkError = /** @class */ (function (_super) { - __extends(NetworkError, _super); - /** - * @param message - error message - */ - function NetworkError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NetworkError", "A network error occurred. " + message) || this; + return _a = {}, + _a[Symbol.iterator] = function () { + var currentNode = node._parent ? node._parent._firstChild : null; + return { + next: function () { + while (currentNode && (filter && !filter(currentNode) || (!self && currentNode === node))) { + currentNode = currentNode._nextSibling; + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = currentNode._nextSibling; + return result; + } + } + }; + }, + _a; +} +exports.tree_getSiblingNodes = tree_getSiblingNodes; +/** + * Gets the first ancestor of `node` in reverse tree order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param filter - a function to filter nodes + */ +function tree_getFirstAncestorNode(node, self, filter) { + if (self === void 0) { self = false; } + var firstNode = self ? node : node._parent; + while (firstNode && filter && !filter(firstNode)) { + firstNode = firstNode._parent; } - return NetworkError; -}(DOMException)); -exports.NetworkError = NetworkError; -var AbortError = /** @class */ (function (_super) { - __extends(AbortError, _super); - /** - * @param message - error message - */ - function AbortError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "AbortError", "The operation was aborted. " + message) || this; + return firstNode; +} +exports.tree_getFirstAncestorNode = tree_getFirstAncestorNode; +/** + * Gets the first ancestor of `node` in reverse tree order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param filter - a function to filter nodes + */ +function tree_getNextAncestorNode(node, currentNode, self, filter) { + if (self === void 0) { self = false; } + var nextNode = currentNode._parent; + while (nextNode && filter && !filter(nextNode)) { + nextNode = nextNode._parent; } - return AbortError; -}(DOMException)); -exports.AbortError = AbortError; -var URLMismatchError = /** @class */ (function (_super) { - __extends(URLMismatchError, _super); - /** - * @param message - error message - */ - function URLMismatchError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "URLMismatchError", "The given URL does not match another URL. " + message) || this; + return nextNode; +} +exports.tree_getNextAncestorNode = tree_getNextAncestorNode; +/** + * Traverses through all ancestor nodes `node` in reverse tree order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param filter - a function to filter nodes + */ +function tree_getAncestorNodes(node, self, filter) { + var _a; + if (self === void 0) { self = false; } + if (!self && !node._parent) { + return _emptyIterator(); } - return URLMismatchError; -}(DOMException)); -exports.URLMismatchError = URLMismatchError; -var QuotaExceededError = /** @class */ (function (_super) { - __extends(QuotaExceededError, _super); - /** - * @param message - error message - */ - function QuotaExceededError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "QuotaExceededError", "The quota has been exceeded. " + message) || this; + return _a = {}, + _a[Symbol.iterator] = function () { + var currentNode = tree_getFirstAncestorNode(node, self, filter); + return { + next: function () { + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = tree_getNextAncestorNode(node, currentNode, self, filter); + return result; + } + } + }; + }, + _a; +} +exports.tree_getAncestorNodes = tree_getAncestorNodes; +/** + * Returns the common ancestor of the given nodes. + * + * @param nodeA - a node + * @param nodeB - a node + */ +function tree_getCommonAncestor(nodeA, nodeB) { + if (nodeA === nodeB) { + return nodeA._parent; } - return QuotaExceededError; -}(DOMException)); -exports.QuotaExceededError = QuotaExceededError; -var TimeoutError = /** @class */ (function (_super) { - __extends(TimeoutError, _super); - /** - * @param message - error message - */ - function TimeoutError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "TimeoutError", "The operation timed out. " + message) || this; + // lists of parent nodes + var parentsA = []; + var parentsB = []; + var pA = tree_getFirstAncestorNode(nodeA, true); + while (pA !== null) { + parentsA.push(pA); + pA = tree_getNextAncestorNode(nodeA, pA, true); } - return TimeoutError; -}(DOMException)); -exports.TimeoutError = TimeoutError; -var InvalidNodeTypeError = /** @class */ (function (_super) { - __extends(InvalidNodeTypeError, _super); - /** - * @param message - error message - */ - function InvalidNodeTypeError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "InvalidNodeTypeError", "The supplied node is incorrect or has an incorrect ancestor for this operation. " + message) || this; + var pB = tree_getFirstAncestorNode(nodeB, true); + while (pB !== null) { + parentsB.push(pB); + pB = tree_getNextAncestorNode(nodeB, pB, true); } - return InvalidNodeTypeError; -}(DOMException)); -exports.InvalidNodeTypeError = InvalidNodeTypeError; -var DataCloneError = /** @class */ (function (_super) { - __extends(DataCloneError, _super); - /** - * @param message - error message - */ - function DataCloneError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "DataCloneError", "The object can not be cloned. " + message) || this; + // walk through parents backwards until they differ + var pos1 = parentsA.length; + var pos2 = parentsB.length; + var parent = null; + for (var i = Math.min(pos1, pos2); i > 0; i--) { + var parent1 = parentsA[--pos1]; + var parent2 = parentsB[--pos2]; + if (parent1 !== parent2) { + break; + } + parent = parent1; } - return DataCloneError; -}(DOMException)); -exports.DataCloneError = DataCloneError; -var NotImplementedError = /** @class */ (function (_super) { - __extends(NotImplementedError, _super); - /** - * @param message - error message - */ - function NotImplementedError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NotImplementedError", "The DOM method is not implemented by this module. " + message) || this; + return parent; +} +exports.tree_getCommonAncestor = tree_getCommonAncestor; +/** + * Returns the node following `node` in depth-first preorder. + * + * @param root - root of the subtree + * @param node - a node + */ +function tree_getFollowingNode(root, node) { + if (node._firstChild) { + return node._firstChild; } - return NotImplementedError; -}(DOMException)); -exports.NotImplementedError = NotImplementedError; -var HierarchyRequestError = /** @class */ (function (_super) { - __extends(HierarchyRequestError, _super); - /** - * @param message - error message - */ - function HierarchyRequestError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "HierarchyRequestError", "The operation would yield an incorrect node tree. " + message) || this; + else if (node._nextSibling) { + return node._nextSibling; } - return HierarchyRequestError; -}(DOMException)); -exports.HierarchyRequestError = HierarchyRequestError; -var NotFoundError = /** @class */ (function (_super) { - __extends(NotFoundError, _super); - /** - * @param message - error message - */ - function NotFoundError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NotFoundError", "The object can not be found here. " + message) || this; + else { + while (true) { + var parent = node._parent; + if (parent === null || parent === root) { + return null; + } + else if (parent._nextSibling) { + return parent._nextSibling; + } + else { + node = parent; + } + } } - return NotFoundError; -}(DOMException)); -exports.NotFoundError = NotFoundError; -var IndexSizeError = /** @class */ (function (_super) { - __extends(IndexSizeError, _super); - /** - * @param message - error message - */ - function IndexSizeError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "IndexSizeError", "The index is not in the allowed range. " + message) || this; +} +exports.tree_getFollowingNode = tree_getFollowingNode; +/** + * Returns the node preceding `node` in depth-first preorder. + * + * @param root - root of the subtree + * @param node - a node + */ +function tree_getPrecedingNode(root, node) { + if (node === root) { + return null; } - return IndexSizeError; -}(DOMException)); -exports.IndexSizeError = IndexSizeError; -var SyntaxError = /** @class */ (function (_super) { - __extends(SyntaxError, _super); - /** - * @param message - error message - */ - function SyntaxError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "SyntaxError", "The string did not match the expected pattern. " + message) || this; + if (node._previousSibling) { + node = node._previousSibling; + if (node._lastChild) { + return node._lastChild; + } + else { + return node; + } } - return SyntaxError; -}(DOMException)); -exports.SyntaxError = SyntaxError; -var InvalidCharacterError = /** @class */ (function (_super) { - __extends(InvalidCharacterError, _super); - /** - * @param message - error message - */ - function InvalidCharacterError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "InvalidCharacterError", "The string contains invalid characters. " + message) || this; + else { + return node._parent; } - return InvalidCharacterError; -}(DOMException)); -exports.InvalidCharacterError = InvalidCharacterError; -//# sourceMappingURL=DOMException.js.map - -/***/ }), - -/***/ 4177: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(6195); -var CreateAlgorithm_1 = __nccwpck_require__(7339); +} +exports.tree_getPrecedingNode = tree_getPrecedingNode; /** - * Represents an object implementing DOM algorithms. - */ -var DOMImpl = /** @class */ (function () { - /** - * Initializes a new instance of `DOM`. - */ - function DOMImpl() { - this._features = { - mutationObservers: true, - customElements: true, - slots: true, - steps: true - }; - this._window = null; - this._compareCache = new util_1.CompareCache(); - this._rangeList = new util_1.FixedSizeSet(); - } - /** - * Sets DOM algorithm features. - * - * @param features - DOM features supported by algorithms. All features are - * enabled by default unless explicity disabled. - */ - DOMImpl.prototype.setFeatures = function (features) { - if (features === undefined) - features = true; - if (util_1.isObject(features)) { - for (var key in features) { - this._features[key] = features[key] || false; + * Determines if the node tree is constrained. A node tree is + * constrained as follows, expressed as a relationship between the + * type of node and its allowed children: + * - Document (In tree order) + * * Zero or more nodes each of which is ProcessingInstruction + * or Comment. + * * Optionally one DocumentType node. + * * Zero or more nodes each of which is ProcessingInstruction + * or Comment. + * * Optionally one Element node. + * * Zero or more nodes each of which is ProcessingInstruction + * or Comment. + * - DocumentFragment, Element + * * Zero or more nodes each of which is Element, Text, + * ProcessingInstruction, or Comment. + * - DocumentType, Text, ProcessingInstruction, Comment + * * None. + * + * @param node - the root of the tree + */ +function tree_isConstrained(node) { + var e_1, _a, e_2, _b, e_3, _c; + switch (node._nodeType) { + case interfaces_1.NodeType.Document: + var hasDocType = false; + var hasElement = false; + try { + for (var _d = __values(node._children), _e = _d.next(); !_e.done; _e = _d.next()) { + var childNode = _e.value; + switch (childNode._nodeType) { + case interfaces_1.NodeType.ProcessingInstruction: + case interfaces_1.NodeType.Comment: + break; + case interfaces_1.NodeType.DocumentType: + if (hasDocType || hasElement) + return false; + hasDocType = true; + break; + case interfaces_1.NodeType.Element: + if (hasElement) + return false; + hasElement = true; + break; + default: + return false; + } + } } - } - else { - // enable/disable all features - for (var key in this._features) { - this._features[key] = features; + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_e && !_e.done && (_a = _d.return)) _a.call(_d); + } + finally { if (e_1) throw e_1.error; } } - } - }; - Object.defineProperty(DOMImpl.prototype, "features", { - /** - * Gets DOM algorithm features. - */ - get: function () { return this._features; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DOMImpl.prototype, "window", { - /** - * Gets the DOM window. - */ - get: function () { - if (this._window === null) { - this._window = CreateAlgorithm_1.create_window(); + break; + case interfaces_1.NodeType.DocumentFragment: + case interfaces_1.NodeType.Element: + try { + for (var _f = __values(node._children), _g = _f.next(); !_g.done; _g = _f.next()) { + var childNode = _g.value; + switch (childNode._nodeType) { + case interfaces_1.NodeType.Element: + case interfaces_1.NodeType.Text: + case interfaces_1.NodeType.ProcessingInstruction: + case interfaces_1.NodeType.CData: + case interfaces_1.NodeType.Comment: + break; + default: + return false; + } + } } - return this._window; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DOMImpl.prototype, "compareCache", { - /** - * Gets the global node compare cache. - */ - get: function () { return this._compareCache; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DOMImpl.prototype, "rangeList", { - /** - * Gets the global range list. - */ - get: function () { return this._rangeList; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DOMImpl, "instance", { - /** - * Returns the instance of `DOM`. - */ - get: function () { - if (!DOMImpl._instance) { - DOMImpl._instance = new DOMImpl(); + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_g && !_g.done && (_b = _f.return)) _b.call(_f); + } + finally { if (e_2) throw e_2.error; } } - return DOMImpl._instance; - }, - enumerable: true, - configurable: true - }); - return DOMImpl; -}()); + break; + case interfaces_1.NodeType.DocumentType: + case interfaces_1.NodeType.Text: + case interfaces_1.NodeType.ProcessingInstruction: + case interfaces_1.NodeType.CData: + case interfaces_1.NodeType.Comment: + return (!node.hasChildNodes()); + } + try { + for (var _h = __values(node._children), _j = _h.next(); !_j.done; _j = _h.next()) { + var childNode = _j.value; + // recursively check child nodes + if (!tree_isConstrained(childNode)) + return false; + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_j && !_j.done && (_c = _h.return)) _c.call(_h); + } + finally { if (e_3) throw e_3.error; } + } + return true; +} +exports.tree_isConstrained = tree_isConstrained; /** - * Represents an object implementing DOM algorithms. + * Returns the length of a node. + * + * @param node - a node to check */ -exports.dom = DOMImpl.instance; -//# sourceMappingURL=DOMImpl.js.map - -/***/ }), - -/***/ 2197: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var infra_1 = __nccwpck_require__(4251); -var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); +function tree_nodeLength(node) { + /** + * To determine the length of a node node, switch on node: + * - DocumentType + * Zero. + * - Text + * - ProcessingInstruction + * - Comment + * Its data’s length. + * - Any other node + * Its number of children. + */ + if (util_1.Guard.isDocumentTypeNode(node)) { + return 0; + } + else if (util_1.Guard.isCharacterDataNode(node)) { + return node._data.length; + } + else { + return node._children.size; + } +} +exports.tree_nodeLength = tree_nodeLength; /** - * Represents an object providing methods which are not dependent on - * any particular document. + * Determines if a node is empty. + * + * @param node - a node to check */ -var DOMImplementationImpl = /** @class */ (function () { +function tree_isEmpty(node) { /** - * Initializes a new instance of `DOMImplementation`. - * - * @param document - the associated document - */ - function DOMImplementationImpl(document) { - this._associatedDocument = document || DOMImpl_1.dom.window.document; + * A node is considered empty if its length is zero. + */ + return (tree_nodeLength(node) === 0); +} +exports.tree_isEmpty = tree_isEmpty; +/** + * Returns the root node of a tree. The root of an object is itself, + * if its parent is `null`, or else it is the root of its parent. + * The root of a tree is any object participating in that tree + * whose parent is `null`. + * + * @param node - a node of the tree + * @param shadow - `true` to return shadow-including root, otherwise + * `false` + */ +function tree_rootNode(node, shadow) { + if (shadow === void 0) { shadow = false; } + /** + * The root of an object is itself, if its parent is null, or else it is the + * root of its parent. The root of a tree is any object participating in + * that tree whose parent is null. + */ + if (shadow) { + var root = tree_rootNode(node, false); + if (util_1.Guard.isShadowRoot(root)) + return tree_rootNode(root._host, true); + else + return root; } - /** @inheritdoc */ - DOMImplementationImpl.prototype.createDocumentType = function (qualifiedName, publicId, systemId) { - /** - * 1. Validate qualifiedName. - * 2. Return a new doctype, with qualifiedName as its name, publicId as its - * public ID, and systemId as its system ID, and with its node document set - * to the associated document of the context object. - */ - algorithm_1.namespace_validate(qualifiedName); - return algorithm_1.create_documentType(this._associatedDocument, qualifiedName, publicId, systemId); - }; - /** @inheritdoc */ - DOMImplementationImpl.prototype.createDocument = function (namespace, qualifiedName, doctype) { - if (doctype === void 0) { doctype = null; } - /** - * 1. Let document be a new XMLDocument. - */ - var document = algorithm_1.create_xmlDocument(); - /** - * 2. Let element be null. - * 3. If qualifiedName is not the empty string, then set element to - * the result of running the internal createElementNS steps, given document, - * namespace, qualifiedName, and an empty dictionary. - */ - var element = null; - if (qualifiedName) { - element = algorithm_1.document_internalCreateElementNS(document, namespace, qualifiedName); - } - /** - * 4. If doctype is non-null, append doctype to document. - * 5. If element is non-null, append element to document. - */ - if (doctype) - document.appendChild(doctype); - if (element) - document.appendChild(element); - /** - * 6. document’s origin is context object’s associated document’s origin. - */ - document._origin = this._associatedDocument._origin; - /** - * 7. document’s content type is determined by namespace: - * - HTML namespace - * application/xhtml+xml - * - SVG namespace - * image/svg+xml - * - Any other namespace - * application/xml - */ - if (namespace === infra_1.namespace.HTML) - document._contentType = "application/xhtml+xml"; - else if (namespace === infra_1.namespace.SVG) - document._contentType = "image/svg+xml"; + else { + if (!node._parent) + return node; else - document._contentType = "application/xml"; - /** - * 8. Return document. - */ - return document; - }; - /** @inheritdoc */ - DOMImplementationImpl.prototype.createHTMLDocument = function (title) { - /** - * 1. Let doc be a new document that is an HTML document. - * 2. Set doc’s content type to "text/html". - */ - var doc = algorithm_1.create_document(); - doc._type = "html"; - doc._contentType = "text/html"; - /** - * 3. Append a new doctype, with "html" as its name and with its node - * document set to doc, to doc. - */ - doc.appendChild(algorithm_1.create_documentType(doc, "html", "", "")); - /** - * 4. Append the result of creating an element given doc, html, and the - * HTML namespace, to doc. - */ - var htmlElement = algorithm_1.element_createAnElement(doc, "html", infra_1.namespace.HTML); - doc.appendChild(htmlElement); - /** - * 5. Append the result of creating an element given doc, head, and the - * HTML namespace, to the html element created earlier. - */ - var headElement = algorithm_1.element_createAnElement(doc, "head", infra_1.namespace.HTML); - htmlElement.appendChild(headElement); - /** - * 6. If title is given: - * 6.1. Append the result of creating an element given doc, title, and - * the HTML namespace, to the head element created earlier. - * 6.2. Append a new Text node, with its data set to title (which could - * be the empty string) and its node document set to doc, to the title - * element created earlier. - */ - if (title !== undefined) { - var titleElement = algorithm_1.element_createAnElement(doc, "title", infra_1.namespace.HTML); - headElement.appendChild(titleElement); - var textElement = algorithm_1.create_text(doc, title); - titleElement.appendChild(textElement); - } - /** - * 7. Append the result of creating an element given doc, body, and the - * HTML namespace, to the html element created earlier. - */ - var bodyElement = algorithm_1.element_createAnElement(doc, "body", infra_1.namespace.HTML); - htmlElement.appendChild(bodyElement); - /** - * 8. doc’s origin is context object’s associated document’s origin. - */ - doc._origin = this._associatedDocument._origin; - /** - * 9. Return doc. - */ - return doc; - }; - /** @inheritdoc */ - DOMImplementationImpl.prototype.hasFeature = function () { return true; }; - /** - * Creates a new `DOMImplementation`. - * - * @param document - owner document - */ - DOMImplementationImpl._create = function (document) { - return new DOMImplementationImpl(document); - }; - return DOMImplementationImpl; -}()); -exports.DOMImplementationImpl = DOMImplementationImpl; -WebIDLAlgorithm_1.idl_defineConst(DOMImplementationImpl.prototype, "_ID", "@oozcitak/dom"); -//# sourceMappingURL=DOMImplementationImpl.js.map - -/***/ }), - -/***/ 5096: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var DOMException_1 = __nccwpck_require__(3166); -var infra_1 = __nccwpck_require__(4251); -var algorithm_1 = __nccwpck_require__(61); + return tree_rootNode(node._parent); + } +} +exports.tree_rootNode = tree_rootNode; /** - * Represents a token set. + * Determines whether `other` is a descendant of `node`. An object + * A is called a descendant of an object B, if either A is a child + * of B or A is a child of an object C that is a descendant of B. + * + * @param node - a node + * @param other - the node to check + * @param self - if `true`, traversal includes `node` itself + * @param shadow - if `true`, traversal includes the + * node's and its descendant's shadow trees as well. */ -var DOMTokenListImpl = /** @class */ (function () { +function tree_isDescendantOf(node, other, self, shadow) { + if (self === void 0) { self = false; } + if (shadow === void 0) { shadow = false; } /** - * Initializes a new instance of `DOMTokenList`. - * - * @param element - associated element - * @param attribute - associated attribute - */ - function DOMTokenListImpl(element, attribute) { - /** - * 1. Let element be associated element. - * 2. Let localName be associated attribute’s local name. - * 3. Let value be the result of getting an attribute value given element - * and localName. - * 4. Run the attribute change steps for element, localName, value, value, - * and null. - */ - this._element = element; - this._attribute = attribute; - this._tokenSet = new Set(); - var localName = attribute._localName; - var value = algorithm_1.element_getAnAttributeValue(element, localName); - // define a closure to be called when the associated attribute's value changes - var thisObj = this; - function updateTokenSet(element, localName, oldValue, value, namespace) { - /** - * 1. If localName is associated attribute’s local name, namespace is null, - * and value is null, then empty token set. - * 2. Otherwise, if localName is associated attribute’s local name, - * namespace is null, then set token set to value, parsed. - */ - if (localName === thisObj._attribute._localName && namespace === null) { - if (!value) - thisObj._tokenSet.clear(); - else - thisObj._tokenSet = algorithm_1.orderedSet_parse(value); - } - } - // add the closure to the associated element's attribute change steps - this._element._attributeChangeSteps.push(updateTokenSet); - if (DOMImpl_1.dom.features.steps) { - algorithm_1.dom_runAttributeChangeSteps(element, localName, value, value, null); + * An object A is called a descendant of an object B, if either A is a + * child of B or A is a child of an object C that is a descendant of B. + * + * An inclusive descendant is an object or one of its descendants. + */ + var child = tree_getFirstDescendantNode(node, self, shadow); + while (child !== null) { + if (child === other) { + return true; } + child = tree_getNextDescendantNode(node, child, self, shadow); } - Object.defineProperty(DOMTokenListImpl.prototype, "length", { - /** @inheritdoc */ - get: function () { - /** - * The length attribute' getter must return context object’s token set’s - * size. - */ - return this._tokenSet.size; - }, - enumerable: true, - configurable: true - }); - /** @inheritdoc */ - DOMTokenListImpl.prototype.item = function (index) { - var e_1, _a; - /** - * 1. If index is equal to or greater than context object’s token set’s - * size, then return null. - * 2. Return context object’s token set[index]. - */ - var i = 0; - try { - for (var _b = __values(this._tokenSet), _c = _b.next(); !_c.done; _c = _b.next()) { - var token = _c.value; - if (i === index) - return token; - i++; - } + return false; +} +exports.tree_isDescendantOf = tree_isDescendantOf; +/** + * Determines whether `other` is an ancestor of `node`. An object A + * is called an ancestor of an object B if and only if B is a + * descendant of A. + * + * @param node - a node + * @param other - the node to check + * @param self - if `true`, traversal includes `node` itself + * @param shadow - if `true`, traversal includes the + * node's and its descendant's shadow trees as well. + */ +function tree_isAncestorOf(node, other, self, shadow) { + if (self === void 0) { self = false; } + if (shadow === void 0) { shadow = false; } + var ancestor = self ? node : shadow && util_1.Guard.isShadowRoot(node) ? + node._host : node._parent; + while (ancestor !== null) { + if (ancestor === other) + return true; + ancestor = shadow && util_1.Guard.isShadowRoot(ancestor) ? + ancestor._host : ancestor._parent; + } + return false; +} +exports.tree_isAncestorOf = tree_isAncestorOf; +/** + * Determines whether `other` is a host-including ancestor of `node`. An + * object A is a host-including inclusive ancestor of an object B, if either + * A is an inclusive ancestor of B, or if B’s root has a non-null host and + * A is a host-including inclusive ancestor of B’s root’s host. + * + * @param node - a node + * @param other - the node to check + * @param self - if `true`, traversal includes `node` itself + */ +function tree_isHostIncludingAncestorOf(node, other, self) { + if (self === void 0) { self = false; } + if (tree_isAncestorOf(node, other, self)) + return true; + var root = tree_rootNode(node); + if (util_1.Guard.isDocumentFragmentNode(root) && root._host !== null && + tree_isHostIncludingAncestorOf(root._host, other, self)) + return true; + return false; +} +exports.tree_isHostIncludingAncestorOf = tree_isHostIncludingAncestorOf; +/** + * Determines whether `other` is a sibling of `node`. An object A is + * called a sibling of an object B, if and only if B and A share + * the same non-null parent. + * + * @param node - a node + * @param other - the node to check + * @param self - if `true`, traversal includes `node` itself + */ +function tree_isSiblingOf(node, other, self) { + if (self === void 0) { self = false; } + /** + * An object A is called a sibling of an object B, if and only if B and A + * share the same non-null parent. + * + * An inclusive sibling is an object or one of its siblings. + */ + if (node === other) { + if (self) + return true; + } + else { + return (node._parent !== null && node._parent === other._parent); + } + return false; +} +exports.tree_isSiblingOf = tree_isSiblingOf; +/** + * Determines whether `other` is preceding `node`. An object A is + * preceding an object B if A and B are in the same tree and A comes + * before B in tree order. + * + * @param node - a node + * @param other - the node to check + */ +function tree_isPreceding(node, other) { + /** + * An object A is preceding an object B if A and B are in the same tree and + * A comes before B in tree order. + */ + var nodePos = tree_treePosition(node); + var otherPos = tree_treePosition(other); + if (nodePos === -1 || otherPos === -1) + return false; + else if (tree_rootNode(node) !== tree_rootNode(other)) + return false; + else + return otherPos < nodePos; +} +exports.tree_isPreceding = tree_isPreceding; +/** + * Determines whether `other` is following `node`. An object A is + * following an object B if A and B are in the same tree and A comes + * after B in tree order. + * + * @param node - a node + * @param other - the node to check + */ +function tree_isFollowing(node, other) { + /** + * An object A is following an object B if A and B are in the same tree and + * A comes after B in tree order. + */ + var nodePos = tree_treePosition(node); + var otherPos = tree_treePosition(other); + if (nodePos === -1 || otherPos === -1) + return false; + else if (tree_rootNode(node) !== tree_rootNode(other)) + return false; + else + return otherPos > nodePos; +} +exports.tree_isFollowing = tree_isFollowing; +/** + * Determines whether `other` is the parent node of `node`. + * + * @param node - a node + * @param other - the node to check + */ +function tree_isParentOf(node, other) { + /** + * An object that participates in a tree has a parent, which is either + * null or an object, and has children, which is an ordered set of objects. + * An object A whose parent is object B is a child of B. + */ + return (node._parent === other); +} +exports.tree_isParentOf = tree_isParentOf; +/** + * Determines whether `other` is a child node of `node`. + * + * @param node - a node + * @param other - the node to check + */ +function tree_isChildOf(node, other) { + /** + * An object that participates in a tree has a parent, which is either + * null or an object, and has children, which is an ordered set of objects. + * An object A whose parent is object B is a child of B. + */ + return (other._parent === node); +} +exports.tree_isChildOf = tree_isChildOf; +/** + * Returns the previous sibling node of `node` or null if it has no + * preceding sibling. + * + * @param node + */ +function tree_previousSibling(node) { + /** + * The previous sibling of an object is its first preceding sibling or null + * if it has no preceding sibling. + */ + return node._previousSibling; +} +exports.tree_previousSibling = tree_previousSibling; +/** + * Returns the next sibling node of `node` or null if it has no + * following sibling. + * + * @param node + */ +function tree_nextSibling(node) { + /** + * The next sibling of an object is its first following sibling or null + * if it has no following sibling. + */ + return node._nextSibling; +} +exports.tree_nextSibling = tree_nextSibling; +/** + * Returns the first child node of `node` or null if it has no + * children. + * + * @param node + */ +function tree_firstChild(node) { + /** + * The first child of an object is its first child or null if it has no + * children. + */ + return node._firstChild; +} +exports.tree_firstChild = tree_firstChild; +/** + * Returns the last child node of `node` or null if it has no + * children. + * + * @param node + */ +function tree_lastChild(node) { + /** + * The last child of an object is its last child or null if it has no + * children. + */ + return node._lastChild; +} +exports.tree_lastChild = tree_lastChild; +/** + * Returns the zero-based index of `node` when counted preorder in + * the tree rooted at `root`. Returns `-1` if `node` is not in + * the tree. + * + * @param node - the node to get the index of + */ +function tree_treePosition(node) { + var root = tree_rootNode(node); + var pos = 0; + var childNode = tree_getFirstDescendantNode(root); + while (childNode !== null) { + pos++; + if (childNode === node) + return pos; + childNode = tree_getNextDescendantNode(root, childNode); + } + return -1; +} +exports.tree_treePosition = tree_treePosition; +/** + * Determines the index of `node`. The index of an object is its number of + * preceding siblings, or 0 if it has none. + * + * @param node - a node + * @param other - the node to check + */ +function tree_index(node) { + /** + * The index of an object is its number of preceding siblings, or 0 if it + * has none. + */ + var n = 0; + while (node._previousSibling !== null) { + n++; + node = node._previousSibling; + } + return n; +} +exports.tree_index = tree_index; +/** + * Retargets an object against another object. + * + * @param a - an object to retarget + * @param b - an object to retarget against + */ +function tree_retarget(a, b) { + /** + * To retarget an object A against an object B, repeat these steps until + * they return an object: + * 1. If one of the following is true + * - A is not a node + * - A's root is not a shadow root + * - B is a node and A's root is a shadow-including inclusive ancestor + * of B + * then return A. + * 2. Set A to A's root's host. + */ + while (true) { + if (!a || !util_1.Guard.isNode(a)) { + return a; } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + var rootOfA = tree_rootNode(a); + if (!util_1.Guard.isShadowRoot(rootOfA)) { + return a; } - return null; - }; - /** @inheritdoc */ - DOMTokenListImpl.prototype.contains = function (token) { + if (b && util_1.Guard.isNode(b) && tree_isAncestorOf(rootOfA, b, true, true)) { + return a; + } + a = rootOfA.host; + } +} +exports.tree_retarget = tree_retarget; +//# sourceMappingURL=TreeAlgorithm.js.map + +/***/ }), + +/***/ 94962: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var interfaces_1 = __nccwpck_require__(27305); +var TraversalAlgorithm_1 = __nccwpck_require__(80998); +/** + * Returns the first or last child node, or `null` if there are none. + * + * @param walker - the `TreeWalker` instance + * @param first - `true` to return the first child node, or `false` to + * return the last child node. + */ +function treeWalker_traverseChildren(walker, first) { + /** + * 1. Let node be walker’s current. + * 2. Set node to node’s first child if type is first, and node’s last child + * if type is last. + * 3. While node is non-null: + */ + var node = (first ? walker._current._firstChild : walker._current._lastChild); + while (node !== null) { /** - * The contains(token) method, when invoked, must return true if context - * object’s token set[token] exists, and false otherwise. + * 3.1. Let result be the result of filtering node within walker. */ - return this._tokenSet.has(token); - }; - /** @inheritdoc */ - DOMTokenListImpl.prototype.add = function () { - var e_2, _a; - var tokens = []; - for (var _i = 0; _i < arguments.length; _i++) { - tokens[_i] = arguments[_i]; - } - try { + var result = TraversalAlgorithm_1.traversal_filter(walker, node); + if (result === interfaces_1.FilterResult.Accept) { /** - * 1. For each token in tokens: - * 1.1. If token is the empty string, then throw a "SyntaxError" - * DOMException. - * 1.2. If token contains any ASCII whitespace, then throw an - * "InvalidCharacterError" DOMException. - * 2. For each token in tokens, append token to context object’s token set. - * 3. Run the update steps. + * 3.2. If result is FILTER_ACCEPT, then set walker’s current to node and + * return node. */ - for (var tokens_1 = __values(tokens), tokens_1_1 = tokens_1.next(); !tokens_1_1.done; tokens_1_1 = tokens_1.next()) { - var token = tokens_1_1.value; - if (token === '') { - throw new DOMException_1.SyntaxError("Cannot add an empty token."); - } - else if (infra_1.codePoint.ASCIIWhiteSpace.test(token)) { - throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); - } - else { - this._tokenSet.add(token); - } - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (tokens_1_1 && !tokens_1_1.done && (_a = tokens_1.return)) _a.call(tokens_1); - } - finally { if (e_2) throw e_2.error; } - } - algorithm_1.tokenList_updateSteps(this); - }; - /** @inheritdoc */ - DOMTokenListImpl.prototype.remove = function () { - var e_3, _a; - var tokens = []; - for (var _i = 0; _i < arguments.length; _i++) { - tokens[_i] = arguments[_i]; + walker._current = node; + return node; } - try { + else if (result === interfaces_1.FilterResult.Skip) { /** - * 1. For each token in tokens: - * 1.1. If token is the empty string, then throw a "SyntaxError" - * DOMException. - * 1.2. If token contains any ASCII whitespace, then throw an - * "InvalidCharacterError" DOMException. - * 2. For each token in tokens, remove token from context object’s token set. - * 3. Run the update steps. + * 3.3. If result is FILTER_SKIP, then: + * 3.3.1. Let child be node’s first child if type is first, and node’s + * last child if type is last. + * 3.3.2. If child is non-null, then set node to child and continue. */ - for (var tokens_2 = __values(tokens), tokens_2_1 = tokens_2.next(); !tokens_2_1.done; tokens_2_1 = tokens_2.next()) { - var token = tokens_2_1.value; - if (token === '') { - throw new DOMException_1.SyntaxError("Cannot remove an empty token."); - } - else if (infra_1.codePoint.ASCIIWhiteSpace.test(token)) { - throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); - } - else { - this._tokenSet.delete(token); - } - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (tokens_2_1 && !tokens_2_1.done && (_a = tokens_2.return)) _a.call(tokens_2); + var child = (first ? node._firstChild : node._lastChild); + if (child !== null) { + node = child; + continue; } - finally { if (e_3) throw e_3.error; } } - algorithm_1.tokenList_updateSteps(this); - }; - /** @inheritdoc */ - DOMTokenListImpl.prototype.toggle = function (token, force) { - if (force === void 0) { force = undefined; } /** - * 1. If token is the empty string, then throw a "SyntaxError" DOMException. - * 2. If token contains any ASCII whitespace, then throw an - * "InvalidCharacterError" DOMException. + * 3.4. While node is non-null: */ - if (token === '') { - throw new DOMException_1.SyntaxError("Cannot toggle an empty token."); - } - else if (infra_1.codePoint.ASCIIWhiteSpace.test(token)) { - throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); + while (node !== null) { + /** + * 3.4.1. Let sibling be node’s next sibling if type is first, and + * node’s previous sibling if type is last. + * 3.4.2. If sibling is non-null, then set node to sibling and break. + */ + var sibling = (first ? node._nextSibling : node._previousSibling); + if (sibling !== null) { + node = sibling; + break; + } + /** + * 3.4.3. Let parent be node’s parent. + * 3.4.4. If parent is null, walker’s root, or walker’s current, then + * return null. + */ + var parent = node._parent; + if (parent === null || parent === walker._root || parent === walker._current) { + return null; + } + /** + * 3.4.5. Set node to parent. + */ + node = parent; } + } + /** + * 5. Return null + */ + return null; +} +exports.treeWalker_traverseChildren = treeWalker_traverseChildren; +/** + * Returns the next or previous sibling node, or `null` if there are none. + * + * @param walker - the `TreeWalker` instance + * @param next - `true` to return the next sibling node, or `false` to + * return the previous sibling node. + */ +function treeWalker_traverseSiblings(walker, next) { + /** + * 1. Let node be walker’s current. + * 2. If node is root, then return null. + * 3. While node is non-null: + */ + var node = walker._current; + if (node === walker._root) + return null; + while (true) { /** - * 3. If context object’s token set[token] exists, then: + * 3.1. Let sibling be node’s next sibling if type is next, and node’s + * previous sibling if type is previous. + * 3.2. While sibling is non-null: */ - if (this._tokenSet.has(token)) { + var sibling = (next ? node._nextSibling : node._previousSibling); + while (sibling !== null) { /** - * 3.1. If force is either not given or is false, then remove token from - * context object’s token set, run the update steps and return false. - * 3.2. Return true. + * 3.2.1. Set node to sibling. + * 3.2.2. Let result be the result of filtering node within walker. + * 3.2.3. If result is FILTER_ACCEPT, then set walker’s current to node + * and return node. */ - if (force === undefined || force === false) { - this._tokenSet.delete(token); - algorithm_1.tokenList_updateSteps(this); - return false; + node = sibling; + var result = TraversalAlgorithm_1.traversal_filter(walker, node); + if (result === interfaces_1.FilterResult.Accept) { + walker._current = node; + return node; + } + /** + * 3.2.4. Set sibling to node’s first child if type is next, and node’s + * last child if type is previous. + * 3.2.5. If result is FILTER_REJECT or sibling is null, then set + * sibling to node’s next sibling if type is next, and node’s previous + * sibling if type is previous. + */ + sibling = (next ? node._firstChild : node._lastChild); + if (result === interfaces_1.FilterResult.Reject || sibling === null) { + sibling = (next ? node._nextSibling : node._previousSibling); } - return true; } /** - * 4. Otherwise, if force not given or is true, append token to context - * object’s token set, run the update steps, and return true. + * 3.3. Set node to node’s parent. + * 3.4. If node is null or walker’s root, then return null. */ - if (force === undefined || force === true) { - this._tokenSet.add(token); - algorithm_1.tokenList_updateSteps(this); - return true; + node = node._parent; + if (node === null || node === walker._root) { + return null; } /** - * 5. Return false. + * 3.5. If the return value of filtering node within walker is FILTER_ACCEPT, + * then return null. */ + if (TraversalAlgorithm_1.traversal_filter(walker, node) === interfaces_1.FilterResult.Accept) { + return null; + } + } +} +exports.treeWalker_traverseSiblings = treeWalker_traverseSiblings; +//# sourceMappingURL=TreeWalkerAlgorithm.js.map + +/***/ }), + +/***/ 45457: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Defines a WebIDL `Const` property on the given object. + * + * @param o - object on which to add the property + * @param name - property name + * @param value - property value + */ +function idl_defineConst(o, name, value) { + Object.defineProperty(o, name, { writable: false, enumerable: true, configurable: false, value: value }); +} +exports.idl_defineConst = idl_defineConst; +//# sourceMappingURL=WebIDLAlgorithm.js.map + +/***/ }), + +/***/ 57030: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Determines if the given string is valid for a `"Name"` construct. + * + * @param name - name string to test + */ +function xml_isName(name) { + for (var i = 0; i < name.length; i++) { + var n = name.charCodeAt(i); + // NameStartChar + if ((n >= 97 && n <= 122) || // [a-z] + (n >= 65 && n <= 90) || // [A-Z] + n === 58 || n === 95 || // ':' or '_' + (n >= 0xC0 && n <= 0xD6) || + (n >= 0xD8 && n <= 0xF6) || + (n >= 0xF8 && n <= 0x2FF) || + (n >= 0x370 && n <= 0x37D) || + (n >= 0x37F && n <= 0x1FFF) || + (n >= 0x200C && n <= 0x200D) || + (n >= 0x2070 && n <= 0x218F) || + (n >= 0x2C00 && n <= 0x2FEF) || + (n >= 0x3001 && n <= 0xD7FF) || + (n >= 0xF900 && n <= 0xFDCF) || + (n >= 0xFDF0 && n <= 0xFFFD)) { + continue; + } + else if (i !== 0 && + (n === 45 || n === 46 || // '-' or '.' + (n >= 48 && n <= 57) || // [0-9] + (n === 0xB7) || + (n >= 0x0300 && n <= 0x036F) || + (n >= 0x203F && n <= 0x2040))) { + continue; + } + if (n >= 0xD800 && n <= 0xDBFF && i < name.length - 1) { + var n2 = name.charCodeAt(i + 1); + if (n2 >= 0xDC00 && n2 <= 0xDFFF) { + n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; + i++; + if (n >= 0x10000 && n <= 0xEFFFF) { + continue; + } + } + } return false; - }; - /** @inheritdoc */ - DOMTokenListImpl.prototype.replace = function (token, newToken) { - /** - * 1. If either token or newToken is the empty string, then throw a - * "SyntaxError" DOMException. - * 2. If either token or newToken contains any ASCII whitespace, then throw - * an "InvalidCharacterError" DOMException. - */ - if (token === '' || newToken === '') { - throw new DOMException_1.SyntaxError("Cannot replace an empty token."); + } + return true; +} +exports.xml_isName = xml_isName; +/** + * Determines if the given string is valid for a `"QName"` construct. + * + * @param name - name string to test + */ +function xml_isQName(name) { + var colonFound = false; + for (var i = 0; i < name.length; i++) { + var n = name.charCodeAt(i); + // NameStartChar + if ((n >= 97 && n <= 122) || // [a-z] + (n >= 65 && n <= 90) || // [A-Z] + n === 95 || // '_' + (n >= 0xC0 && n <= 0xD6) || + (n >= 0xD8 && n <= 0xF6) || + (n >= 0xF8 && n <= 0x2FF) || + (n >= 0x370 && n <= 0x37D) || + (n >= 0x37F && n <= 0x1FFF) || + (n >= 0x200C && n <= 0x200D) || + (n >= 0x2070 && n <= 0x218F) || + (n >= 0x2C00 && n <= 0x2FEF) || + (n >= 0x3001 && n <= 0xD7FF) || + (n >= 0xF900 && n <= 0xFDCF) || + (n >= 0xFDF0 && n <= 0xFFFD)) { + continue; } - else if (infra_1.codePoint.ASCIIWhiteSpace.test(token) || infra_1.codePoint.ASCIIWhiteSpace.test(newToken)) { - throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); + else if (i !== 0 && + (n === 45 || n === 46 || // '-' or '.' + (n >= 48 && n <= 57) || // [0-9] + (n === 0xB7) || + (n >= 0x0300 && n <= 0x036F) || + (n >= 0x203F && n <= 0x2040))) { + continue; } - /** - * 3. If context object’s token set does not contain token, then return - * false. - */ - if (!this._tokenSet.has(token)) + else if (i !== 0 && n === 58) { // : + if (colonFound) + return false; // multiple colons in qname + if (i === name.length - 1) + return false; // colon at the end of qname + colonFound = true; + continue; + } + if (n >= 0xD800 && n <= 0xDBFF && i < name.length - 1) { + var n2 = name.charCodeAt(i + 1); + if (n2 >= 0xDC00 && n2 <= 0xDFFF) { + n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; + i++; + if (n >= 0x10000 && n <= 0xEFFFF) { + continue; + } + } + } + return false; + } + return true; +} +exports.xml_isQName = xml_isQName; +/** + * Determines if the given string contains legal characters. + * + * @param chars - sequence of characters to test + */ +function xml_isLegalChar(chars) { + for (var i = 0; i < chars.length; i++) { + var n = chars.charCodeAt(i); + // #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] + if (n === 0x9 || n === 0xA || n === 0xD || + (n >= 0x20 && n <= 0xD7FF) || + (n >= 0xE000 && n <= 0xFFFD)) { + continue; + } + if (n >= 0xD800 && n <= 0xDBFF && i < chars.length - 1) { + var n2 = chars.charCodeAt(i + 1); + if (n2 >= 0xDC00 && n2 <= 0xDFFF) { + n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; + i++; + if (n >= 0x10000 && n <= 0x10FFFF) { + continue; + } + } + } + return false; + } + return true; +} +exports.xml_isLegalChar = xml_isLegalChar; +/** + * Determines if the given string contains legal characters for a public + * identifier. + * + * @param chars - sequence of characters to test + */ +function xml_isPubidChar(chars) { + for (var i = 0; i < chars.length; i++) { + // PubId chars are all in the ASCII range, no need to check surrogates + var n = chars.charCodeAt(i); + // #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] + if ((n >= 97 && n <= 122) || // [a-z] + (n >= 65 && n <= 90) || // [A-Z] + (n >= 39 && n <= 59) || // ['()*+,-./] | [0-9] | [:;] + n === 0x20 || n === 0xD || n === 0xA || // #x20 | #xD | #xA + (n >= 35 && n <= 37) || // [#$%] + n === 33 || // ! + n === 61 || n === 63 || n === 64 || n === 95) { // [=?@_] + continue; + } + else { return false; + } + } + return true; +} +exports.xml_isPubidChar = xml_isPubidChar; +//# sourceMappingURL=XMLAlgorithm.js.map + +/***/ }), + +/***/ 61: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", ({ value: true })); +__export(__nccwpck_require__(32206)); +__export(__nccwpck_require__(84309)); +__export(__nccwpck_require__(81054)); +__export(__nccwpck_require__(19461)); +__export(__nccwpck_require__(57339)); +__export(__nccwpck_require__(35648)); +__export(__nccwpck_require__(12793)); +__export(__nccwpck_require__(9628)); +__export(__nccwpck_require__(93261)); +__export(__nccwpck_require__(51849)); +__export(__nccwpck_require__(28217)); +__export(__nccwpck_require__(21312)); +__export(__nccwpck_require__(45463)); +__export(__nccwpck_require__(78157)); +__export(__nccwpck_require__(35856)); +__export(__nccwpck_require__(74924)); +__export(__nccwpck_require__(3973)); +__export(__nccwpck_require__(53670)); +__export(__nccwpck_require__(2328)); +__export(__nccwpck_require__(30457)); +__export(__nccwpck_require__(41853)); +__export(__nccwpck_require__(68733)); +__export(__nccwpck_require__(13512)); +__export(__nccwpck_require__(80998)); +__export(__nccwpck_require__(16620)); +__export(__nccwpck_require__(94962)); +__export(__nccwpck_require__(45457)); +__export(__nccwpck_require__(57030)); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 66461: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var algorithm_1 = __nccwpck_require__(61); +/** + * Represents a controller that allows to abort DOM requests. + */ +var AbortControllerImpl = /** @class */ (function () { + /** + * Initializes a new instance of `AbortController`. + */ + function AbortControllerImpl() { /** - * 4. Replace token in context object’s token set with newToken. - * 5. Run the update steps. - * 6. Return true. - */ - infra_1.set.replace(this._tokenSet, token, newToken); - algorithm_1.tokenList_updateSteps(this); - return true; - }; - /** @inheritdoc */ - DOMTokenListImpl.prototype.supports = function (token) { - /** - * 1. Let result be the return value of validation steps called with token. - * 2. Return result. + * 1. Let signal be a new AbortSignal object. + * 2. Let controller be a new AbortController object whose signal is signal. + * 3. Return controller. */ - return algorithm_1.tokenList_validationSteps(this, token); - }; - Object.defineProperty(DOMTokenListImpl.prototype, "value", { + this._signal = algorithm_1.create_abortSignal(); + } + Object.defineProperty(AbortControllerImpl.prototype, "signal", { /** @inheritdoc */ - get: function () { - /** - * The value attribute must return the result of running context object’s - * serialize steps. - */ - return algorithm_1.tokenList_serializeSteps(this); - }, - set: function (value) { - /** - * Setting the value attribute must set an attribute value for the - * associated element using associated attribute’s local name and the given - * value. - */ - algorithm_1.element_setAnAttributeValue(this._element, this._attribute._localName, value); - }, + get: function () { return this._signal; }, enumerable: true, configurable: true }); - /** - * Returns an iterator for the token set. - */ - DOMTokenListImpl.prototype[Symbol.iterator] = function () { - var it = this._tokenSet[Symbol.iterator](); - return { - next: function () { - return it.next(); - } - }; - }; - /** - * Creates a new `DOMTokenList`. - * - * @param element - associated element - * @param attribute - associated attribute - */ - DOMTokenListImpl._create = function (element, attribute) { - return new DOMTokenListImpl(element, attribute); + /** @inheritdoc */ + AbortControllerImpl.prototype.abort = function () { + algorithm_1.abort_signalAbort(this._signal); }; - return DOMTokenListImpl; + return AbortControllerImpl; }()); -exports.DOMTokenListImpl = DOMTokenListImpl; -//# sourceMappingURL=DOMTokenListImpl.js.map +exports.AbortControllerImpl = AbortControllerImpl; +//# sourceMappingURL=AbortControllerImpl.js.map /***/ }), -/***/ 2585: +/***/ 10022: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -57607,98 +57547,131 @@ var __extends = (this && this.__extends) || (function () { }; })(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var NodeImpl_1 = __nccwpck_require__(1745); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); +var EventTargetImpl_1 = __nccwpck_require__(69968); +var algorithm_1 = __nccwpck_require__(61); /** - * Represents a document fragment in the XML tree. + * Represents a signal object that communicates with a DOM request and abort + * it through an AbortController. */ -var DocumentFragmentImpl = /** @class */ (function (_super) { - __extends(DocumentFragmentImpl, _super); +var AbortSignalImpl = /** @class */ (function (_super) { + __extends(AbortSignalImpl, _super); /** - * Initializes a new instance of `DocumentFragment`. - * - * @param host - shadow root's host element + * Initializes a new instance of `AbortSignal`. */ - function DocumentFragmentImpl(host) { - if (host === void 0) { host = null; } + function AbortSignalImpl() { var _this = _super.call(this) || this; - _this._children = new Set(); - _this._host = host; + _this._abortedFlag = false; + _this._abortAlgorithms = new Set(); return _this; } - // MIXIN: NonElementParentNode - /* istanbul ignore next */ - DocumentFragmentImpl.prototype.getElementById = function (elementId) { throw new Error("Mixin: NonElementParentNode not implemented."); }; - Object.defineProperty(DocumentFragmentImpl.prototype, "children", { - // MIXIN: ParentNode - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + Object.defineProperty(AbortSignalImpl.prototype, "aborted", { + /** @inheritdoc */ + get: function () { return this._abortedFlag; }, enumerable: true, configurable: true }); - Object.defineProperty(DocumentFragmentImpl.prototype, "firstElementChild", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + Object.defineProperty(AbortSignalImpl.prototype, "onabort", { + /** @inheritdoc */ + get: function () { + return algorithm_1.event_getterEventHandlerIDLAttribute(this, "onabort"); + }, + set: function (val) { + algorithm_1.event_setterEventHandlerIDLAttribute(this, "onabort", val); + }, enumerable: true, configurable: true }); - Object.defineProperty(DocumentFragmentImpl.prototype, "lastElementChild", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + /** + * Creates a new `AbortSignal`. + */ + AbortSignalImpl._create = function () { + return new AbortSignalImpl(); + }; + return AbortSignalImpl; +}(EventTargetImpl_1.EventTargetImpl)); +exports.AbortSignalImpl = AbortSignalImpl; +//# sourceMappingURL=AbortSignalImpl.js.map + +/***/ }), + +/***/ 57126: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Represents an abstract range with a start and end boundary point. + */ +var AbstractRangeImpl = /** @class */ (function () { + function AbstractRangeImpl() { + } + Object.defineProperty(AbstractRangeImpl.prototype, "_startNode", { + get: function () { return this._start[0]; }, enumerable: true, configurable: true }); - Object.defineProperty(DocumentFragmentImpl.prototype, "childElementCount", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + Object.defineProperty(AbstractRangeImpl.prototype, "_startOffset", { + get: function () { return this._start[1]; }, enumerable: true, configurable: true }); - /* istanbul ignore next */ - DocumentFragmentImpl.prototype.prepend = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ParentNode not implemented."); - }; - /* istanbul ignore next */ - DocumentFragmentImpl.prototype.append = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ParentNode not implemented."); - }; - /* istanbul ignore next */ - DocumentFragmentImpl.prototype.querySelector = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; - /* istanbul ignore next */ - DocumentFragmentImpl.prototype.querySelectorAll = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; - /** - * Creates a new `DocumentFragment`. - * - * @param document - owner document - * @param host - shadow root's host element - */ - DocumentFragmentImpl._create = function (document, host) { - if (host === void 0) { host = null; } - var node = new DocumentFragmentImpl(host); - node._nodeDocument = document; - return node; - }; - return DocumentFragmentImpl; -}(NodeImpl_1.NodeImpl)); -exports.DocumentFragmentImpl = DocumentFragmentImpl; -/** - * Initialize prototype properties - */ -WebIDLAlgorithm_1.idl_defineConst(DocumentFragmentImpl.prototype, "_nodeType", interfaces_1.NodeType.DocumentFragment); -//# sourceMappingURL=DocumentFragmentImpl.js.map + Object.defineProperty(AbstractRangeImpl.prototype, "_endNode", { + get: function () { return this._end[0]; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "_endOffset", { + get: function () { return this._end[1]; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "_collapsed", { + get: function () { + return (this._start[0] === this._end[0] && + this._start[1] === this._end[1]); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "startContainer", { + /** @inheritdoc */ + get: function () { return this._startNode; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "startOffset", { + /** @inheritdoc */ + get: function () { return this._startOffset; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "endContainer", { + /** @inheritdoc */ + get: function () { return this._endNode; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "endOffset", { + /** @inheritdoc */ + get: function () { return this._endOffset; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "collapsed", { + /** @inheritdoc */ + get: function () { return this._collapsed; }, + enumerable: true, + configurable: true + }); + return AbstractRangeImpl; +}()); +exports.AbstractRangeImpl = AbstractRangeImpl; +//# sourceMappingURL=AbstractRangeImpl.js.map /***/ }), -/***/ 4333: +/***/ 13717: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -57716,565 +57689,483 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var interfaces_1 = __nccwpck_require__(7305); -var DOMException_1 = __nccwpck_require__(3166); -var NodeImpl_1 = __nccwpck_require__(1745); -var util_1 = __nccwpck_require__(5282); -var util_2 = __nccwpck_require__(6195); -var infra_1 = __nccwpck_require__(4251); -var URLAlgorithm_1 = __nccwpck_require__(3568); +var interfaces_1 = __nccwpck_require__(27305); +var NodeImpl_1 = __nccwpck_require__(91745); var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** - * Represents a document node. + * Represents an attribute of an element node. */ -var DocumentImpl = /** @class */ (function (_super) { - __extends(DocumentImpl, _super); +var AttrImpl = /** @class */ (function (_super) { + __extends(AttrImpl, _super); /** - * Initializes a new instance of `Document`. + * Initializes a new instance of `Attr`. + * + * @param localName - local name */ - function DocumentImpl() { + function AttrImpl(localName) { var _this = _super.call(this) || this; - _this._children = new Set(); - _this._encoding = { - name: "UTF-8", - labels: ["unicode-1-1-utf-8", "utf-8", "utf8"] - }; - _this._contentType = 'application/xml'; - _this._URL = { - scheme: "about", - username: "", - password: "", - host: null, - port: null, - path: ["blank"], - query: null, - fragment: null, - _cannotBeABaseURLFlag: true, - _blobURLEntry: null - }; - _this._origin = null; - _this._type = "xml"; - _this._mode = "no-quirks"; - _this._documentElement = null; - _this._hasNamespaces = false; - _this._nodeDocumentOverwrite = null; + _this._namespace = null; + _this._namespacePrefix = null; + _this._element = null; + _this._value = ''; + _this._localName = localName; return _this; } - Object.defineProperty(DocumentImpl.prototype, "_nodeDocument", { - get: function () { return this._nodeDocumentOverwrite || this; }, - set: function (val) { this._nodeDocumentOverwrite = val; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "implementation", { + Object.defineProperty(AttrImpl.prototype, "ownerElement", { /** @inheritdoc */ - get: function () { - /** - * The implementation attribute’s getter must return the DOMImplementation - * object that is associated with the document. - */ - return this._implementation || (this._implementation = algorithm_1.create_domImplementation(this)); - }, + get: function () { return this._element; }, enumerable: true, configurable: true }); - Object.defineProperty(DocumentImpl.prototype, "URL", { + Object.defineProperty(AttrImpl.prototype, "namespaceURI", { /** @inheritdoc */ - get: function () { - /** - * The URL attribute’s getter and documentURI attribute’s getter must return - * the URL, serialized. - * See: https://url.spec.whatwg.org/#concept-url-serializer - */ - return URLAlgorithm_1.urlSerializer(this._URL); - }, + get: function () { return this._namespace; }, enumerable: true, configurable: true }); - Object.defineProperty(DocumentImpl.prototype, "documentURI", { + Object.defineProperty(AttrImpl.prototype, "prefix", { /** @inheritdoc */ - get: function () { return this.URL; }, + get: function () { return this._namespacePrefix; }, enumerable: true, configurable: true }); - Object.defineProperty(DocumentImpl.prototype, "origin", { + Object.defineProperty(AttrImpl.prototype, "localName", { /** @inheritdoc */ - get: function () { - return "null"; - }, + get: function () { return this._localName; }, enumerable: true, configurable: true }); - Object.defineProperty(DocumentImpl.prototype, "compatMode", { + Object.defineProperty(AttrImpl.prototype, "name", { /** @inheritdoc */ - get: function () { - /** - * The compatMode attribute’s getter must return "BackCompat" if context - * object’s mode is "quirks", and "CSS1Compat" otherwise. - */ - return this._mode === "quirks" ? "BackCompat" : "CSS1Compat"; - }, + get: function () { return this._qualifiedName; }, enumerable: true, configurable: true }); - Object.defineProperty(DocumentImpl.prototype, "characterSet", { + Object.defineProperty(AttrImpl.prototype, "value", { /** @inheritdoc */ - get: function () { + get: function () { return this._value; }, + set: function (value) { /** - * The characterSet attribute’s getter, charset attribute’s getter, and - * inputEncoding attribute’s getter, must return context object’s - * encoding’s name. + * The value attribute’s setter must set an existing attribute value with + * context object and the given value. */ - return this._encoding.name; + algorithm_1.attr_setAnExistingAttributeValue(this, value); }, enumerable: true, configurable: true }); - Object.defineProperty(DocumentImpl.prototype, "charset", { - /** @inheritdoc */ - get: function () { return this._encoding.name; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "inputEncoding", { - /** @inheritdoc */ - get: function () { return this._encoding.name; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "contentType", { - /** @inheritdoc */ + Object.defineProperty(AttrImpl.prototype, "_qualifiedName", { + /** + * Returns the qualified name. + */ get: function () { /** - * The contentType attribute’s getter must return the content type. + * An attribute’s qualified name is its local name if its namespace prefix + * is null, and its namespace prefix, followed by ":", followed by its + * local name, otherwise. */ - return this._contentType; + return (this._namespacePrefix !== null ? + this._namespacePrefix + ':' + this._localName : + this._localName); }, enumerable: true, configurable: true }); - Object.defineProperty(DocumentImpl.prototype, "doctype", { + /** + * Creates an `Attr`. + * + * @param document - owner document + * @param localName - local name + */ + AttrImpl._create = function (document, localName) { + var node = new AttrImpl(localName); + node._nodeDocument = document; + return node; + }; + return AttrImpl; +}(NodeImpl_1.NodeImpl)); +exports.AttrImpl = AttrImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(AttrImpl.prototype, "_nodeType", interfaces_1.NodeType.Attribute); +WebIDLAlgorithm_1.idl_defineConst(AttrImpl.prototype, "specified", true); +//# sourceMappingURL=AttrImpl.js.map + +/***/ }), + +/***/ 23977: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var TextImpl_1 = __nccwpck_require__(42191); +var interfaces_1 = __nccwpck_require__(27305); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +/** + * Represents a CDATA node. + */ +var CDATASectionImpl = /** @class */ (function (_super) { + __extends(CDATASectionImpl, _super); + /** + * Initializes a new instance of `CDATASection`. + * + * @param data - node contents + */ + function CDATASectionImpl(data) { + return _super.call(this, data) || this; + } + /** + * Creates a new `CDATASection`. + * + * @param document - owner document + * @param data - node contents + */ + CDATASectionImpl._create = function (document, data) { + if (data === void 0) { data = ''; } + var node = new CDATASectionImpl(data); + node._nodeDocument = document; + return node; + }; + return CDATASectionImpl; +}(TextImpl_1.TextImpl)); +exports.CDATASectionImpl = CDATASectionImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(CDATASectionImpl.prototype, "_nodeType", interfaces_1.NodeType.CData); +//# sourceMappingURL=CDATASectionImpl.js.map + +/***/ }), + +/***/ 65330: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var NodeImpl_1 = __nccwpck_require__(91745); +var algorithm_1 = __nccwpck_require__(61); +/** + * Represents a generic text node. + */ +var CharacterDataImpl = /** @class */ (function (_super) { + __extends(CharacterDataImpl, _super); + /** + * Initializes a new instance of `CharacterData`. + * + * @param data - the text content + */ + function CharacterDataImpl(data) { + var _this = _super.call(this) || this; + _this._data = data; + return _this; + } + Object.defineProperty(CharacterDataImpl.prototype, "data", { /** @inheritdoc */ - get: function () { - var e_1, _a; - try { - /** - * The doctype attribute’s getter must return the child of the document - * that is a doctype, and null otherwise. - */ - for (var _b = __values(this._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var child = _c.value; - if (util_1.Guard.isDocumentTypeNode(child)) - return child; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - return null; + get: function () { return this._data; }, + set: function (value) { + algorithm_1.characterData_replaceData(this, 0, this._data.length, value); }, enumerable: true, configurable: true }); - Object.defineProperty(DocumentImpl.prototype, "documentElement", { + Object.defineProperty(CharacterDataImpl.prototype, "length", { /** @inheritdoc */ - get: function () { - /** - * The documentElement attribute’s getter must return the document element. - */ - return this._documentElement; - }, + get: function () { return this._data.length; }, enumerable: true, configurable: true }); /** @inheritdoc */ - DocumentImpl.prototype.getElementsByTagName = function (qualifiedName) { + CharacterDataImpl.prototype.substringData = function (offset, count) { /** - * The getElementsByTagName(qualifiedName) method, when invoked, must return - * the list of elements with qualified name qualifiedName for the context object. + * The substringData(offset, count) method, when invoked, must return the + * result of running substring data with node context object, offset offset, and count count. */ - return algorithm_1.node_listOfElementsWithQualifiedName(qualifiedName, this); + return algorithm_1.characterData_substringData(this, offset, count); }; /** @inheritdoc */ - DocumentImpl.prototype.getElementsByTagNameNS = function (namespace, localName) { + CharacterDataImpl.prototype.appendData = function (data) { /** - * The getElementsByTagNameNS(namespace, localName) method, when invoked, - * must return the list of elements with namespace namespace and local name - * localName for the context object. + * The appendData(data) method, when invoked, must replace data with node + * context object, offset context object’s length, count 0, and data data. */ - return algorithm_1.node_listOfElementsWithNamespace(namespace, localName, this); + return algorithm_1.characterData_replaceData(this, this._data.length, 0, data); }; /** @inheritdoc */ - DocumentImpl.prototype.getElementsByClassName = function (classNames) { + CharacterDataImpl.prototype.insertData = function (offset, data) { /** - * The getElementsByClassName(classNames) method, when invoked, must return - * the list of elements with class names classNames for the context object. + * The insertData(offset, data) method, when invoked, must replace data with + * node context object, offset offset, count 0, and data data. */ - return algorithm_1.node_listOfElementsWithClassNames(classNames, this); + algorithm_1.characterData_replaceData(this, offset, 0, data); }; /** @inheritdoc */ - DocumentImpl.prototype.createElement = function (localName, options) { + CharacterDataImpl.prototype.deleteData = function (offset, count) { /** - * 1. If localName does not match the Name production, then throw an - * "InvalidCharacterError" DOMException. - * 2. If the context object is an HTML document, then set localName to - * localName in ASCII lowercase. - * 3. Let is be null. - * 4. If options is a dictionary and options’s is is present, then set is - * to it. - * 5. Let namespace be the HTML namespace, if the context object is an - * HTML document or context object’s content type is - * "application/xhtml+xml", and null otherwise. - * 6. Return the result of creating an element given the context object, - * localName, namespace, null, is, and with the synchronous custom elements - * flag set. + * The deleteData(offset, count) method, when invoked, must replace data + * with node context object, offset offset, count count, and data the + * empty string. */ - if (!algorithm_1.xml_isName(localName)) - throw new DOMException_1.InvalidCharacterError(); - if (this._type === "html") - localName = localName.toLowerCase(); - var is = null; - if (options !== undefined) { - if (util_2.isString(options)) { - is = options; - } - else { - is = options.is; - } - } - var namespace = (this._type === "html" || this._contentType === "application/xhtml+xml") ? - infra_1.namespace.HTML : null; - return algorithm_1.element_createAnElement(this, localName, namespace, null, is, true); + algorithm_1.characterData_replaceData(this, offset, count, ''); }; /** @inheritdoc */ - DocumentImpl.prototype.createElementNS = function (namespace, qualifiedName, options) { + CharacterDataImpl.prototype.replaceData = function (offset, count, data) { /** - * The createElementNS(namespace, qualifiedName, options) method, when - * invoked, must return the result of running the internal createElementNS - * steps, given context object, namespace, qualifiedName, and options. + * The replaceData(offset, count, data) method, when invoked, must replace + * data with node context object, offset offset, count count, and data data. */ - return algorithm_1.document_internalCreateElementNS(this, namespace, qualifiedName, options); + algorithm_1.characterData_replaceData(this, offset, count, data); }; - /** @inheritdoc */ - DocumentImpl.prototype.createDocumentFragment = function () { - /** - * The createDocumentFragment() method, when invoked, must return a new - * DocumentFragment node with its node document set to the context object. - */ - return algorithm_1.create_documentFragment(this); + Object.defineProperty(CharacterDataImpl.prototype, "previousElementSibling", { + // MIXIN: NonDocumentTypeChildNode + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CharacterDataImpl.prototype, "nextElementSibling", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, + enumerable: true, + configurable: true + }); + // MIXIN: ChildNode + /* istanbul ignore next */ + CharacterDataImpl.prototype.before = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); }; - /** @inheritdoc */ - DocumentImpl.prototype.createTextNode = function (data) { - /** - * The createTextNode(data) method, when invoked, must return a new Text - * node with its data set to data and node document set to the context object. - */ - return algorithm_1.create_text(this, data); + /* istanbul ignore next */ + CharacterDataImpl.prototype.after = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); + }; + /* istanbul ignore next */ + CharacterDataImpl.prototype.replaceWith = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); }; + /* istanbul ignore next */ + CharacterDataImpl.prototype.remove = function () { throw new Error("Mixin: ChildNode not implemented."); }; + return CharacterDataImpl; +}(NodeImpl_1.NodeImpl)); +exports.CharacterDataImpl = CharacterDataImpl; +//# sourceMappingURL=CharacterDataImpl.js.map + +/***/ }), + +/***/ 88264: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var util_1 = __nccwpck_require__(65282); +var algorithm_1 = __nccwpck_require__(61); +/** + * Represents a mixin that extends child nodes that can have siblings + * including doctypes. This mixin is implemented by {@link Element}, + * {@link CharacterData} and {@link DocumentType}. + */ +var ChildNodeImpl = /** @class */ (function () { + function ChildNodeImpl() { + } /** @inheritdoc */ - DocumentImpl.prototype.createCDATASection = function (data) { + ChildNodeImpl.prototype.before = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } /** - * 1. If context object is an HTML document, then throw a - * "NotSupportedError" DOMException. - * 2. If data contains the string "]]>", then throw an - * "InvalidCharacterError" DOMException. - * 3. Return a new CDATASection node with its data set to data and node - * document set to the context object. + * 1. Let parent be context object’s parent. + * 2. If parent is null, then return. */ - if (this._type === "html") - throw new DOMException_1.NotSupportedError(); - if (data.indexOf(']]>') !== -1) - throw new DOMException_1.InvalidCharacterError(); - return algorithm_1.create_cdataSection(this, data); - }; - /** @inheritdoc */ - DocumentImpl.prototype.createComment = function (data) { + var context = util_1.Cast.asNode(this); + var parent = context._parent; + if (parent === null) + return; /** - * The createComment(data) method, when invoked, must return a new Comment - * node with its data set to data and node document set to the context object. + * 3. Let viablePreviousSibling be context object’s first preceding + * sibling not in nodes, and null otherwise. */ - return algorithm_1.create_comment(this, data); - }; - /** @inheritdoc */ - DocumentImpl.prototype.createProcessingInstruction = function (target, data) { + var viablePreviousSibling = context._previousSibling; + var flag = true; + while (flag && viablePreviousSibling) { + flag = false; + for (var i = 0; i < nodes.length; i++) { + var child = nodes[i]; + if (child === viablePreviousSibling) { + viablePreviousSibling = viablePreviousSibling._previousSibling; + flag = true; + break; + } + } + } /** - * 1. If target does not match the Name production, then throw an - * "InvalidCharacterError" DOMException. - * 2. If data contains the string "?>", then throw an - * "InvalidCharacterError" DOMException. - * 3. Return a new ProcessingInstruction node, with target set to target, - * data set to data, and node document set to the context object. + * 4. Let node be the result of converting nodes into a node, given nodes + * and context object’s node document. */ - if (!algorithm_1.xml_isName(target)) - throw new DOMException_1.InvalidCharacterError(); - if (data.indexOf("?>") !== -1) - throw new DOMException_1.InvalidCharacterError(); - return algorithm_1.create_processingInstruction(this, target, data); - }; - /** @inheritdoc */ - DocumentImpl.prototype.importNode = function (node, deep) { - if (deep === void 0) { deep = false; } + var node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument); /** - * 1. If node is a document or shadow root, then throw a "NotSupportedError" DOMException. + * 5. If viablePreviousSibling is null, set it to parent’s first child, + * and to viablePreviousSibling’s next sibling otherwise. */ - if (util_1.Guard.isDocumentNode(node) || util_1.Guard.isShadowRoot(node)) - throw new DOMException_1.NotSupportedError(); + if (viablePreviousSibling === null) + viablePreviousSibling = parent._firstChild; + else + viablePreviousSibling = viablePreviousSibling._nextSibling; /** - * 2. Return a clone of node, with context object and the clone children flag set if deep is true. + * 6. Pre-insert node into parent before viablePreviousSibling. */ - return algorithm_1.node_clone(node, this, deep); + algorithm_1.mutation_preInsert(node, parent, viablePreviousSibling); }; /** @inheritdoc */ - DocumentImpl.prototype.adoptNode = function (node) { - /** - * 1. If node is a document, then throw a "NotSupportedError" DOMException. - */ - if (util_1.Guard.isDocumentNode(node)) - throw new DOMException_1.NotSupportedError(); + ChildNodeImpl.prototype.after = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } /** - * 2. If node is a shadow root, then throw a "HierarchyRequestError" DOMException. + * 1. Let parent be context object’s parent. + * 2. If parent is null, then return. */ - if (util_1.Guard.isShadowRoot(node)) - throw new DOMException_1.HierarchyRequestError(); + var context = util_1.Cast.asNode(this); + var parent = context._parent; + if (!parent) + return; /** - * 3. Adopt node into the context object. - * 4. Return node. + * 3. Let viableNextSibling be context object’s first following sibling not + * in nodes, and null otherwise. */ - algorithm_1.document_adopt(node, this); - return node; - }; - /** @inheritdoc */ - DocumentImpl.prototype.createAttribute = function (localName) { + var viableNextSibling = context._nextSibling; + var flag = true; + while (flag && viableNextSibling) { + flag = false; + for (var i = 0; i < nodes.length; i++) { + var child = nodes[i]; + if (child === viableNextSibling) { + viableNextSibling = viableNextSibling._nextSibling; + flag = true; + break; + } + } + } /** - * 1. If localName does not match the Name production in XML, then throw - * an "InvalidCharacterError" DOMException. - * 2. If the context object is an HTML document, then set localName to - * localName in ASCII lowercase. - * 3. Return a new attribute whose local name is localName and node document - * is context object. + * 4. Let node be the result of converting nodes into a node, given nodes + * and context object’s node document. */ - if (!algorithm_1.xml_isName(localName)) - throw new DOMException_1.InvalidCharacterError(); - if (this._type === "html") { - localName = localName.toLowerCase(); - } - var attr = algorithm_1.create_attr(this, localName); - return attr; - }; - /** @inheritdoc */ - DocumentImpl.prototype.createAttributeNS = function (namespace, qualifiedName) { + var node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument); /** - * 1. Let namespace, prefix, and localName be the result of passing - * namespace and qualifiedName to validate and extract. - * 2. Return a new attribute whose namespace is namespace, namespace prefix - * is prefix, local name is localName, and node document is context object. + * 5. Pre-insert node into parent before viableNextSibling. */ - var _a = __read(algorithm_1.namespace_validateAndExtract(namespace, qualifiedName), 3), ns = _a[0], prefix = _a[1], localName = _a[2]; - var attr = algorithm_1.create_attr(this, localName); - attr._namespace = ns; - attr._namespacePrefix = prefix; - return attr; - }; - /** @inheritdoc */ - DocumentImpl.prototype.createEvent = function (eventInterface) { - return algorithm_1.event_createLegacyEvent(eventInterface); + algorithm_1.mutation_preInsert(node, parent, viableNextSibling); }; /** @inheritdoc */ - DocumentImpl.prototype.createRange = function () { + ChildNodeImpl.prototype.replaceWith = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } /** - * The createRange() method, when invoked, must return a new live range - * with (context object, 0) as its start and end. + * 1. Let parent be context object’s parent. + * 2. If parent is null, then return. */ - var range = algorithm_1.create_range(); - range._start = [this, 0]; - range._end = [this, 0]; - return range; - }; - /** @inheritdoc */ - DocumentImpl.prototype.createNodeIterator = function (root, whatToShow, filter) { - if (whatToShow === void 0) { whatToShow = interfaces_1.WhatToShow.All; } - if (filter === void 0) { filter = null; } + var context = util_1.Cast.asNode(this); + var parent = context._parent; + if (!parent) + return; /** - * 1. Let iterator be a new NodeIterator object. - * 2. Set iterator’s root and iterator’s reference to root. - * 3. Set iterator’s pointer before reference to true. - * 4. Set iterator’s whatToShow to whatToShow. - * 5. Set iterator’s filter to filter. - * 6. Return iterator. + * 3. Let viableNextSibling be context object’s first following sibling not + * in nodes, and null otherwise. */ - var iterator = algorithm_1.create_nodeIterator(root, root, true); - iterator._whatToShow = whatToShow; - iterator._iteratorCollection = algorithm_1.create_nodeList(root); - if (util_2.isFunction(filter)) { - iterator._filter = algorithm_1.create_nodeFilter(); - iterator._filter.acceptNode = filter; - } - else { - iterator._filter = filter; + var viableNextSibling = context._nextSibling; + var flag = true; + while (flag && viableNextSibling) { + flag = false; + for (var i = 0; i < nodes.length; i++) { + var child = nodes[i]; + if (child === viableNextSibling) { + viableNextSibling = viableNextSibling._nextSibling; + flag = true; + break; + } + } } - return iterator; - }; - /** @inheritdoc */ - DocumentImpl.prototype.createTreeWalker = function (root, whatToShow, filter) { - if (whatToShow === void 0) { whatToShow = interfaces_1.WhatToShow.All; } - if (filter === void 0) { filter = null; } /** - * 1. Let walker be a new TreeWalker object. - * 2. Set walker’s root and walker’s current to root. - * 3. Set walker’s whatToShow to whatToShow. - * 4. Set walker’s filter to filter. - * 5. Return walker. + * 4. Let node be the result of converting nodes into a node, given nodes + * and context object’s node document. */ - var walker = algorithm_1.create_treeWalker(root, root); - walker._whatToShow = whatToShow; - if (util_2.isFunction(filter)) { - walker._filter = algorithm_1.create_nodeFilter(); - walker._filter.acceptNode = filter; - } - else { - walker._filter = filter; - } - return walker; - }; - /** - * Gets the parent event target for the given event. - * - * @param event - an event - */ - DocumentImpl.prototype._getTheParent = function (event) { + var node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument); /** - * TODO: Implement realms - * A document’s get the parent algorithm, given an event, returns null if - * event’s type attribute value is "load" or document does not have a - * browsing context, and the document’s relevant global object otherwise. + * 5. If context object’s parent is parent, replace the context object with + * node within parent. + * _Note:_ Context object could have been inserted into node. + * 6. Otherwise, pre-insert node into parent before viableNextSibling. */ - if (event._type === "load") { - return null; - } - else { - return DOMImpl_1.dom.window; - } - }; - // MIXIN: NonElementParentNode - /* istanbul ignore next */ - DocumentImpl.prototype.getElementById = function (elementId) { throw new Error("Mixin: NonElementParentNode not implemented."); }; - Object.defineProperty(DocumentImpl.prototype, "children", { - // MIXIN: DocumentOrShadowRoot - // No elements - // MIXIN: ParentNode - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "firstElementChild", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "lastElementChild", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "childElementCount", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - /* istanbul ignore next */ - DocumentImpl.prototype.prepend = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ParentNode not implemented."); + if (context._parent === parent) + algorithm_1.mutation_replace(context, node, parent); + else + algorithm_1.mutation_preInsert(node, parent, viableNextSibling); }; - /* istanbul ignore next */ - DocumentImpl.prototype.append = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ParentNode not implemented."); + /** @inheritdoc */ + ChildNodeImpl.prototype.remove = function () { + /** + * 1. If context object’s parent is null, then return. + * 2. Remove the context object from context object’s parent. + */ + var context = util_1.Cast.asNode(this); + var parent = context._parent; + if (!parent) + return; + algorithm_1.mutation_remove(context, parent); }; - /* istanbul ignore next */ - DocumentImpl.prototype.querySelector = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; - /* istanbul ignore next */ - DocumentImpl.prototype.querySelectorAll = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; - return DocumentImpl; -}(NodeImpl_1.NodeImpl)); -exports.DocumentImpl = DocumentImpl; -/** - * Initialize prototype properties - */ -WebIDLAlgorithm_1.idl_defineConst(DocumentImpl.prototype, "_nodeType", interfaces_1.NodeType.Document); -//# sourceMappingURL=DocumentImpl.js.map - -/***/ }), - -/***/ 5274: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -/** - * Represents a mixin for an interface to be used to share APIs between - * documents and shadow roots. This mixin is implemented by - * {@link Document} and {@link ShadowRoot}. - * - * _Note:_ The DocumentOrShadowRoot mixin is expected to be used by other - * standards that want to define APIs shared between documents and shadow roots. - */ -var DocumentOrShadowRootImpl = /** @class */ (function () { - function DocumentOrShadowRootImpl() { - } - return DocumentOrShadowRootImpl; + return ChildNodeImpl; }()); -exports.DocumentOrShadowRootImpl = DocumentOrShadowRootImpl; -//# sourceMappingURL=DocumentOrShadowRootImpl.js.map +exports.ChildNodeImpl = ChildNodeImpl; +//# sourceMappingURL=ChildNodeImpl.js.map /***/ }), -/***/ 3173: +/***/ 20930: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -58293,104 +58184,47 @@ var __extends = (this && this.__extends) || (function () { }; })(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var NodeImpl_1 = __nccwpck_require__(1745); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); +var interfaces_1 = __nccwpck_require__(27305); +var CharacterDataImpl_1 = __nccwpck_require__(65330); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** - * Represents an object providing methods which are not dependent on - * any particular document + * Represents a comment node. */ -var DocumentTypeImpl = /** @class */ (function (_super) { - __extends(DocumentTypeImpl, _super); +var CommentImpl = /** @class */ (function (_super) { + __extends(CommentImpl, _super); /** - * Initializes a new instance of `DocumentType`. + * Initializes a new instance of `Comment`. * - * @param name - name of the node - * @param publicId - `PUBLIC` identifier - * @param systemId - `SYSTEM` identifier + * @param data - the text content */ - function DocumentTypeImpl(name, publicId, systemId) { - var _this = _super.call(this) || this; - _this._name = ''; - _this._publicId = ''; - _this._systemId = ''; - _this._name = name; - _this._publicId = publicId; - _this._systemId = systemId; - return _this; + function CommentImpl(data) { + if (data === void 0) { data = ''; } + return _super.call(this, data) || this; } - Object.defineProperty(DocumentTypeImpl.prototype, "name", { - /** @inheritdoc */ - get: function () { return this._name; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentTypeImpl.prototype, "publicId", { - /** @inheritdoc */ - get: function () { return this._publicId; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentTypeImpl.prototype, "systemId", { - /** @inheritdoc */ - get: function () { return this._systemId; }, - enumerable: true, - configurable: true - }); - // MIXIN: ChildNode - /* istanbul ignore next */ - DocumentTypeImpl.prototype.before = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; - /* istanbul ignore next */ - DocumentTypeImpl.prototype.after = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; - /* istanbul ignore next */ - DocumentTypeImpl.prototype.replaceWith = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; - /* istanbul ignore next */ - DocumentTypeImpl.prototype.remove = function () { throw new Error("Mixin: ChildNode not implemented."); }; /** - * Creates a new `DocumentType`. + * Creates a new `Comment`. * * @param document - owner document - * @param name - name of the node - * @param publicId - `PUBLIC` identifier - * @param systemId - `SYSTEM` identifier + * @param data - node contents */ - DocumentTypeImpl._create = function (document, name, publicId, systemId) { - if (publicId === void 0) { publicId = ''; } - if (systemId === void 0) { systemId = ''; } - var node = new DocumentTypeImpl(name, publicId, systemId); + CommentImpl._create = function (document, data) { + if (data === void 0) { data = ''; } + var node = new CommentImpl(data); node._nodeDocument = document; return node; }; - return DocumentTypeImpl; -}(NodeImpl_1.NodeImpl)); -exports.DocumentTypeImpl = DocumentTypeImpl; + return CommentImpl; +}(CharacterDataImpl_1.CharacterDataImpl)); +exports.CommentImpl = CommentImpl; /** * Initialize prototype properties */ -WebIDLAlgorithm_1.idl_defineConst(DocumentTypeImpl.prototype, "_nodeType", interfaces_1.NodeType.DocumentType); -//# sourceMappingURL=DocumentTypeImpl.js.map +WebIDLAlgorithm_1.idl_defineConst(CommentImpl.prototype, "_nodeType", interfaces_1.NodeType.Comment); +//# sourceMappingURL=CommentImpl.js.map /***/ }), -/***/ 5975: +/***/ 59857: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -58408,615 +58242,1060 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var NodeImpl_1 = __nccwpck_require__(1745); -var DOMException_1 = __nccwpck_require__(3166); -var infra_1 = __nccwpck_require__(4251); +var EventImpl_1 = __nccwpck_require__(38245); var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); /** - * Represents an element node. + * Represents and event that carries custom data. */ -var ElementImpl = /** @class */ (function (_super) { - __extends(ElementImpl, _super); +var CustomEventImpl = /** @class */ (function (_super) { + __extends(CustomEventImpl, _super); /** - * Initializes a new instance of `Element`. + * Initializes a new instance of `CustomEvent`. */ - function ElementImpl() { - var _this = _super.call(this) || this; - _this._children = new Set(); - _this._namespace = null; - _this._namespacePrefix = null; - _this._localName = ""; - _this._customElementState = "undefined"; - _this._customElementDefinition = null; - _this._is = null; - _this._shadowRoot = null; - _this._attributeList = algorithm_1.create_namedNodeMap(_this); - _this._attributeChangeSteps = []; - _this._name = ''; - _this._assignedSlot = null; + function CustomEventImpl(type, eventInit) { + var _this = _super.call(this, type, eventInit) || this; + _this._detail = null; + _this._detail = (eventInit && eventInit.detail) || null; return _this; } - Object.defineProperty(ElementImpl.prototype, "namespaceURI", { - /** @inheritdoc */ - get: function () { return this._namespace; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "prefix", { - /** @inheritdoc */ - get: function () { return this._namespacePrefix; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "localName", { - /** @inheritdoc */ - get: function () { return this._localName; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "tagName", { - /** @inheritdoc */ - get: function () { return this._htmlUppercasedQualifiedName; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "id", { - /** @inheritdoc */ - get: function () { - return algorithm_1.element_getAnAttributeValue(this, "id"); - }, - set: function (value) { - algorithm_1.element_setAnAttributeValue(this, "id", value); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "className", { - /** @inheritdoc */ - get: function () { - return algorithm_1.element_getAnAttributeValue(this, "class"); - }, - set: function (value) { - algorithm_1.element_setAnAttributeValue(this, "class", value); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "classList", { - /** @inheritdoc */ - get: function () { - var attr = algorithm_1.element_getAnAttributeByName("class", this); - if (attr === null) { - attr = algorithm_1.create_attr(this._nodeDocument, "class"); - } - return algorithm_1.create_domTokenList(this, attr); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "slot", { - /** @inheritdoc */ - get: function () { - return algorithm_1.element_getAnAttributeValue(this, "slot"); - }, - set: function (value) { - algorithm_1.element_setAnAttributeValue(this, "slot", value); - }, - enumerable: true, - configurable: true - }); - /** @inheritdoc */ - ElementImpl.prototype.hasAttributes = function () { - return this._attributeList.length !== 0; - }; - Object.defineProperty(ElementImpl.prototype, "attributes", { + Object.defineProperty(CustomEventImpl.prototype, "detail", { /** @inheritdoc */ - get: function () { return this._attributeList; }, + get: function () { return this._detail; }, enumerable: true, configurable: true }); /** @inheritdoc */ - ElementImpl.prototype.getAttributeNames = function () { - var e_1, _a; + CustomEventImpl.prototype.initCustomEvent = function (type, bubbles, cancelable, detail) { + if (bubbles === void 0) { bubbles = false; } + if (cancelable === void 0) { cancelable = false; } + if (detail === void 0) { detail = null; } /** - * The getAttributeNames() method, when invoked, must return the qualified - * names of the attributes in context object’s attribute list, in order, - * and a new list otherwise. + * 1. If the context object’s dispatch flag is set, then return. */ - var names = []; - try { - for (var _b = __values(this._attributeList), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - names.push(attr._qualifiedName); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - return names; - }; - /** @inheritdoc */ - ElementImpl.prototype.getAttribute = function (qualifiedName) { + if (this._dispatchFlag) + return; /** - * 1. Let attr be the result of getting an attribute given qualifiedName - * and the context object. - * 2. If attr is null, return null. - * 3. Return attr’s value. + * 2. Initialize the context object with type, bubbles, and cancelable. */ - var attr = algorithm_1.element_getAnAttributeByName(qualifiedName, this); - return (attr ? attr._value : null); - }; - /** @inheritdoc */ - ElementImpl.prototype.getAttributeNS = function (namespace, localName) { + algorithm_1.event_initialize(this, type, bubbles, cancelable); /** - * 1. Let attr be the result of getting an attribute given namespace, - * localName, and the context object. - * 2. If attr is null, return null. - * 3. Return attr’s value. + * 3. Set the context object’s detail attribute to detail. */ - var attr = algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace, localName, this); - return (attr ? attr._value : null); + this._detail = detail; }; - /** @inheritdoc */ - ElementImpl.prototype.setAttribute = function (qualifiedName, value) { - /** - * 1. If qualifiedName does not match the Name production in XML, then - * throw an "InvalidCharacterError" DOMException. - */ - if (!algorithm_1.xml_isName(qualifiedName)) - throw new DOMException_1.InvalidCharacterError(); - /** - * 2. If the context object is in the HTML namespace and its node document - * is an HTML document, then set qualifiedName to qualifiedName in ASCII - * lowercase. - */ - if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { - qualifiedName = qualifiedName.toLowerCase(); - } - /** - * 3. Let attribute be the first attribute in context object’s attribute - * list whose qualified name is qualifiedName, and null otherwise. - */ - var attribute = null; - for (var i = 0; i < this._attributeList.length; i++) { - var attr = this._attributeList[i]; - if (attr._qualifiedName === qualifiedName) { - attribute = attr; - break; + return CustomEventImpl; +}(EventImpl_1.EventImpl)); +exports.CustomEventImpl = CustomEventImpl; +//# sourceMappingURL=CustomEventImpl.js.map + +/***/ }), + +/***/ 13166: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Represents the base class of `Error` objects used by this module. + */ +var DOMException = /** @class */ (function (_super) { + __extends(DOMException, _super); + /** + * + * @param name - message name + * @param message - error message + */ + function DOMException(name, message) { + if (message === void 0) { message = ""; } + var _this = _super.call(this, message) || this; + _this.name = name; + return _this; + } + return DOMException; +}(Error)); +exports.DOMException = DOMException; +var DOMStringSizeError = /** @class */ (function (_super) { + __extends(DOMStringSizeError, _super); + /** + * @param message - error message + */ + function DOMStringSizeError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "DOMStringSizeError", message) || this; + } + return DOMStringSizeError; +}(DOMException)); +exports.DOMStringSizeError = DOMStringSizeError; +var WrongDocumentError = /** @class */ (function (_super) { + __extends(WrongDocumentError, _super); + /** + * @param message - error message + */ + function WrongDocumentError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "WrongDocumentError", "The object is in the wrong document. " + message) || this; + } + return WrongDocumentError; +}(DOMException)); +exports.WrongDocumentError = WrongDocumentError; +var NoDataAllowedError = /** @class */ (function (_super) { + __extends(NoDataAllowedError, _super); + /** + * @param message - error message + */ + function NoDataAllowedError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NoDataAllowedError", message) || this; + } + return NoDataAllowedError; +}(DOMException)); +exports.NoDataAllowedError = NoDataAllowedError; +var NoModificationAllowedError = /** @class */ (function (_super) { + __extends(NoModificationAllowedError, _super); + /** + * @param message - error message + */ + function NoModificationAllowedError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NoModificationAllowedError", "The object can not be modified. " + message) || this; + } + return NoModificationAllowedError; +}(DOMException)); +exports.NoModificationAllowedError = NoModificationAllowedError; +var NotSupportedError = /** @class */ (function (_super) { + __extends(NotSupportedError, _super); + /** + * @param message - error message + */ + function NotSupportedError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NotSupportedError", "The operation is not supported. " + message) || this; + } + return NotSupportedError; +}(DOMException)); +exports.NotSupportedError = NotSupportedError; +var InUseAttributeError = /** @class */ (function (_super) { + __extends(InUseAttributeError, _super); + /** + * @param message - error message + */ + function InUseAttributeError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "InUseAttributeError", message) || this; + } + return InUseAttributeError; +}(DOMException)); +exports.InUseAttributeError = InUseAttributeError; +var InvalidStateError = /** @class */ (function (_super) { + __extends(InvalidStateError, _super); + /** + * @param message - error message + */ + function InvalidStateError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "InvalidStateError", "The object is in an invalid state. " + message) || this; + } + return InvalidStateError; +}(DOMException)); +exports.InvalidStateError = InvalidStateError; +var InvalidModificationError = /** @class */ (function (_super) { + __extends(InvalidModificationError, _super); + /** + * @param message - error message + */ + function InvalidModificationError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "InvalidModificationError", "The object can not be modified in this way. " + message) || this; + } + return InvalidModificationError; +}(DOMException)); +exports.InvalidModificationError = InvalidModificationError; +var NamespaceError = /** @class */ (function (_super) { + __extends(NamespaceError, _super); + /** + * @param message - error message + */ + function NamespaceError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NamespaceError", "The operation is not allowed by Namespaces in XML. [XMLNS] " + message) || this; + } + return NamespaceError; +}(DOMException)); +exports.NamespaceError = NamespaceError; +var InvalidAccessError = /** @class */ (function (_super) { + __extends(InvalidAccessError, _super); + /** + * @param message - error message + */ + function InvalidAccessError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "InvalidAccessError", "The object does not support the operation or argument. " + message) || this; + } + return InvalidAccessError; +}(DOMException)); +exports.InvalidAccessError = InvalidAccessError; +var ValidationError = /** @class */ (function (_super) { + __extends(ValidationError, _super); + /** + * @param message - error message + */ + function ValidationError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "ValidationError", message) || this; + } + return ValidationError; +}(DOMException)); +exports.ValidationError = ValidationError; +var TypeMismatchError = /** @class */ (function (_super) { + __extends(TypeMismatchError, _super); + /** + * @param message - error message + */ + function TypeMismatchError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "TypeMismatchError", message) || this; + } + return TypeMismatchError; +}(DOMException)); +exports.TypeMismatchError = TypeMismatchError; +var SecurityError = /** @class */ (function (_super) { + __extends(SecurityError, _super); + /** + * @param message - error message + */ + function SecurityError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "SecurityError", "The operation is insecure. " + message) || this; + } + return SecurityError; +}(DOMException)); +exports.SecurityError = SecurityError; +var NetworkError = /** @class */ (function (_super) { + __extends(NetworkError, _super); + /** + * @param message - error message + */ + function NetworkError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NetworkError", "A network error occurred. " + message) || this; + } + return NetworkError; +}(DOMException)); +exports.NetworkError = NetworkError; +var AbortError = /** @class */ (function (_super) { + __extends(AbortError, _super); + /** + * @param message - error message + */ + function AbortError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "AbortError", "The operation was aborted. " + message) || this; + } + return AbortError; +}(DOMException)); +exports.AbortError = AbortError; +var URLMismatchError = /** @class */ (function (_super) { + __extends(URLMismatchError, _super); + /** + * @param message - error message + */ + function URLMismatchError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "URLMismatchError", "The given URL does not match another URL. " + message) || this; + } + return URLMismatchError; +}(DOMException)); +exports.URLMismatchError = URLMismatchError; +var QuotaExceededError = /** @class */ (function (_super) { + __extends(QuotaExceededError, _super); + /** + * @param message - error message + */ + function QuotaExceededError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "QuotaExceededError", "The quota has been exceeded. " + message) || this; + } + return QuotaExceededError; +}(DOMException)); +exports.QuotaExceededError = QuotaExceededError; +var TimeoutError = /** @class */ (function (_super) { + __extends(TimeoutError, _super); + /** + * @param message - error message + */ + function TimeoutError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "TimeoutError", "The operation timed out. " + message) || this; + } + return TimeoutError; +}(DOMException)); +exports.TimeoutError = TimeoutError; +var InvalidNodeTypeError = /** @class */ (function (_super) { + __extends(InvalidNodeTypeError, _super); + /** + * @param message - error message + */ + function InvalidNodeTypeError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "InvalidNodeTypeError", "The supplied node is incorrect or has an incorrect ancestor for this operation. " + message) || this; + } + return InvalidNodeTypeError; +}(DOMException)); +exports.InvalidNodeTypeError = InvalidNodeTypeError; +var DataCloneError = /** @class */ (function (_super) { + __extends(DataCloneError, _super); + /** + * @param message - error message + */ + function DataCloneError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "DataCloneError", "The object can not be cloned. " + message) || this; + } + return DataCloneError; +}(DOMException)); +exports.DataCloneError = DataCloneError; +var NotImplementedError = /** @class */ (function (_super) { + __extends(NotImplementedError, _super); + /** + * @param message - error message + */ + function NotImplementedError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NotImplementedError", "The DOM method is not implemented by this module. " + message) || this; + } + return NotImplementedError; +}(DOMException)); +exports.NotImplementedError = NotImplementedError; +var HierarchyRequestError = /** @class */ (function (_super) { + __extends(HierarchyRequestError, _super); + /** + * @param message - error message + */ + function HierarchyRequestError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "HierarchyRequestError", "The operation would yield an incorrect node tree. " + message) || this; + } + return HierarchyRequestError; +}(DOMException)); +exports.HierarchyRequestError = HierarchyRequestError; +var NotFoundError = /** @class */ (function (_super) { + __extends(NotFoundError, _super); + /** + * @param message - error message + */ + function NotFoundError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NotFoundError", "The object can not be found here. " + message) || this; + } + return NotFoundError; +}(DOMException)); +exports.NotFoundError = NotFoundError; +var IndexSizeError = /** @class */ (function (_super) { + __extends(IndexSizeError, _super); + /** + * @param message - error message + */ + function IndexSizeError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "IndexSizeError", "The index is not in the allowed range. " + message) || this; + } + return IndexSizeError; +}(DOMException)); +exports.IndexSizeError = IndexSizeError; +var SyntaxError = /** @class */ (function (_super) { + __extends(SyntaxError, _super); + /** + * @param message - error message + */ + function SyntaxError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "SyntaxError", "The string did not match the expected pattern. " + message) || this; + } + return SyntaxError; +}(DOMException)); +exports.SyntaxError = SyntaxError; +var InvalidCharacterError = /** @class */ (function (_super) { + __extends(InvalidCharacterError, _super); + /** + * @param message - error message + */ + function InvalidCharacterError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "InvalidCharacterError", "The string contains invalid characters. " + message) || this; + } + return InvalidCharacterError; +}(DOMException)); +exports.InvalidCharacterError = InvalidCharacterError; +//# sourceMappingURL=DOMException.js.map + +/***/ }), + +/***/ 14177: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var util_1 = __nccwpck_require__(76195); +var CreateAlgorithm_1 = __nccwpck_require__(57339); +/** + * Represents an object implementing DOM algorithms. + */ +var DOMImpl = /** @class */ (function () { + /** + * Initializes a new instance of `DOM`. + */ + function DOMImpl() { + this._features = { + mutationObservers: true, + customElements: true, + slots: true, + steps: true + }; + this._window = null; + this._compareCache = new util_1.CompareCache(); + this._rangeList = new util_1.FixedSizeSet(); + } + /** + * Sets DOM algorithm features. + * + * @param features - DOM features supported by algorithms. All features are + * enabled by default unless explicity disabled. + */ + DOMImpl.prototype.setFeatures = function (features) { + if (features === undefined) + features = true; + if (util_1.isObject(features)) { + for (var key in features) { + this._features[key] = features[key] || false; } } - /** - * 4. If attribute is null, create an attribute whose local name is - * qualifiedName, value is value, and node document is context object’s - * node document, then append this attribute to context object, and - * then return. - */ - if (attribute === null) { - attribute = algorithm_1.create_attr(this._nodeDocument, qualifiedName); - attribute._value = value; - algorithm_1.element_append(attribute, this); - return; + else { + // enable/disable all features + for (var key in this._features) { + this._features[key] = features; + } } + }; + Object.defineProperty(DOMImpl.prototype, "features", { /** - * 5. Change attribute from context object to value. + * Gets DOM algorithm features. */ - algorithm_1.element_change(attribute, this, value); - }; - /** @inheritdoc */ - ElementImpl.prototype.setAttributeNS = function (namespace, qualifiedName, value) { + get: function () { return this._features; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DOMImpl.prototype, "window", { /** - * 1. Let namespace, prefix, and localName be the result of passing - * namespace and qualifiedName to validate and extract. - * 2. Set an attribute value for the context object using localName, value, - * and also prefix and namespace. + * Gets the DOM window. */ - var _a = __read(algorithm_1.namespace_validateAndExtract(namespace, qualifiedName), 3), ns = _a[0], prefix = _a[1], localName = _a[2]; - algorithm_1.element_setAnAttributeValue(this, localName, value, prefix, ns); - }; - /** @inheritdoc */ - ElementImpl.prototype.removeAttribute = function (qualifiedName) { + get: function () { + if (this._window === null) { + this._window = CreateAlgorithm_1.create_window(); + } + return this._window; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DOMImpl.prototype, "compareCache", { /** - * The removeAttribute(qualifiedName) method, when invoked, must remove an - * attribute given qualifiedName and the context object, and then return - * undefined. + * Gets the global node compare cache. */ - algorithm_1.element_removeAnAttributeByName(qualifiedName, this); - }; - /** @inheritdoc */ - ElementImpl.prototype.removeAttributeNS = function (namespace, localName) { + get: function () { return this._compareCache; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DOMImpl.prototype, "rangeList", { /** - * The removeAttributeNS(namespace, localName) method, when invoked, must - * remove an attribute given namespace, localName, and context object, and - * then return undefined. + * Gets the global range list. */ - algorithm_1.element_removeAnAttributeByNamespaceAndLocalName(namespace, localName, this); - }; - /** @inheritdoc */ - ElementImpl.prototype.hasAttribute = function (qualifiedName) { + get: function () { return this._rangeList; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DOMImpl, "instance", { /** - * 1. If the context object is in the HTML namespace and its node document - * is an HTML document, then set qualifiedName to qualifiedName in ASCII - * lowercase. - * 2. Return true if the context object has an attribute whose qualified - * name is qualifiedName, and false otherwise. + * Returns the instance of `DOM`. */ - if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { - qualifiedName = qualifiedName.toLowerCase(); - } - for (var i = 0; i < this._attributeList.length; i++) { - var attr = this._attributeList[i]; - if (attr._qualifiedName === qualifiedName) { - return true; + get: function () { + if (!DOMImpl._instance) { + DOMImpl._instance = new DOMImpl(); } - } - return false; - }; + return DOMImpl._instance; + }, + enumerable: true, + configurable: true + }); + return DOMImpl; +}()); +/** + * Represents an object implementing DOM algorithms. + */ +exports.dom = DOMImpl.instance; +//# sourceMappingURL=DOMImpl.js.map + +/***/ }), + +/***/ 42197: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var DOMImpl_1 = __nccwpck_require__(14177); +var infra_1 = __nccwpck_require__(84251); +var algorithm_1 = __nccwpck_require__(61); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +/** + * Represents an object providing methods which are not dependent on + * any particular document. + */ +var DOMImplementationImpl = /** @class */ (function () { + /** + * Initializes a new instance of `DOMImplementation`. + * + * @param document - the associated document + */ + function DOMImplementationImpl(document) { + this._associatedDocument = document || DOMImpl_1.dom.window.document; + } /** @inheritdoc */ - ElementImpl.prototype.toggleAttribute = function (qualifiedName, force) { + DOMImplementationImpl.prototype.createDocumentType = function (qualifiedName, publicId, systemId) { /** - * 1. If qualifiedName does not match the Name production in XML, then - * throw an "InvalidCharacterError" DOMException. + * 1. Validate qualifiedName. + * 2. Return a new doctype, with qualifiedName as its name, publicId as its + * public ID, and systemId as its system ID, and with its node document set + * to the associated document of the context object. */ - if (!algorithm_1.xml_isName(qualifiedName)) - throw new DOMException_1.InvalidCharacterError(); + algorithm_1.namespace_validate(qualifiedName); + return algorithm_1.create_documentType(this._associatedDocument, qualifiedName, publicId, systemId); + }; + /** @inheritdoc */ + DOMImplementationImpl.prototype.createDocument = function (namespace, qualifiedName, doctype) { + if (doctype === void 0) { doctype = null; } /** - * 2. If the context object is in the HTML namespace and its node document - * is an HTML document, then set qualifiedName to qualifiedName in ASCII - * lowercase. + * 1. Let document be a new XMLDocument. */ - if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { - qualifiedName = qualifiedName.toLowerCase(); - } + var document = algorithm_1.create_xmlDocument(); /** - * 3. Let attribute be the first attribute in the context object’s attribute - * list whose qualified name is qualifiedName, and null otherwise. + * 2. Let element be null. + * 3. If qualifiedName is not the empty string, then set element to + * the result of running the internal createElementNS steps, given document, + * namespace, qualifiedName, and an empty dictionary. */ - var attribute = null; - for (var i = 0; i < this._attributeList.length; i++) { - var attr = this._attributeList[i]; - if (attr._qualifiedName === qualifiedName) { - attribute = attr; - break; - } - } - if (attribute === null) { - /** - * 4. If attribute is null, then: - * 4.1. If force is not given or is true, create an attribute whose local - * name is qualifiedName, value is the empty string, and node document is - * the context object’s node document, then append this attribute to the - * context object, and then return true. - * 4.2. Return false. - */ - if (force === undefined || force === true) { - attribute = algorithm_1.create_attr(this._nodeDocument, qualifiedName); - attribute._value = ''; - algorithm_1.element_append(attribute, this); - return true; - } - return false; - } - else if (force === undefined || force === false) { - /** - * 5. Otherwise, if force is not given or is false, remove an attribute - * given qualifiedName and the context object, and then return false. - */ - algorithm_1.element_removeAnAttributeByName(qualifiedName, this); - return false; + var element = null; + if (qualifiedName) { + element = algorithm_1.document_internalCreateElementNS(document, namespace, qualifiedName); } /** - * 6. Return true. + * 4. If doctype is non-null, append doctype to document. + * 5. If element is non-null, append element to document. */ - return true; - }; - /** @inheritdoc */ - ElementImpl.prototype.hasAttributeNS = function (namespace, localName) { + if (doctype) + document.appendChild(doctype); + if (element) + document.appendChild(element); /** - * 1. If namespace is the empty string, set it to null. - * 2. Return true if the context object has an attribute whose namespace is - * namespace and local name is localName, and false otherwise. + * 6. document’s origin is context object’s associated document’s origin. */ - var ns = namespace || null; - for (var i = 0; i < this._attributeList.length; i++) { - var attr = this._attributeList[i]; - if (attr._namespace === ns && attr._localName === localName) { - return true; - } - } - return false; - }; - /** @inheritdoc */ - ElementImpl.prototype.getAttributeNode = function (qualifiedName) { + document._origin = this._associatedDocument._origin; /** - * The getAttributeNode(qualifiedName) method, when invoked, must return the - * result of getting an attribute given qualifiedName and context object. + * 7. document’s content type is determined by namespace: + * - HTML namespace + * application/xhtml+xml + * - SVG namespace + * image/svg+xml + * - Any other namespace + * application/xml */ - return algorithm_1.element_getAnAttributeByName(qualifiedName, this); - }; - /** @inheritdoc */ - ElementImpl.prototype.getAttributeNodeNS = function (namespace, localName) { + if (namespace === infra_1.namespace.HTML) + document._contentType = "application/xhtml+xml"; + else if (namespace === infra_1.namespace.SVG) + document._contentType = "image/svg+xml"; + else + document._contentType = "application/xml"; /** - * The getAttributeNodeNS(namespace, localName) method, when invoked, must - * return the result of getting an attribute given namespace, localName, and - * the context object. + * 8. Return document. */ - return algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace, localName, this); + return document; }; /** @inheritdoc */ - ElementImpl.prototype.setAttributeNode = function (attr) { + DOMImplementationImpl.prototype.createHTMLDocument = function (title) { /** - * The setAttributeNode(attr) and setAttributeNodeNS(attr) methods, when - * invoked, must return the result of setting an attribute given attr and - * the context object. + * 1. Let doc be a new document that is an HTML document. + * 2. Set doc’s content type to "text/html". */ - return algorithm_1.element_setAnAttribute(attr, this); - }; - /** @inheritdoc */ - ElementImpl.prototype.setAttributeNodeNS = function (attr) { - return algorithm_1.element_setAnAttribute(attr, this); - }; - /** @inheritdoc */ - ElementImpl.prototype.removeAttributeNode = function (attr) { + var doc = algorithm_1.create_document(); + doc._type = "html"; + doc._contentType = "text/html"; /** - * 1. If context object’s attribute list does not contain attr, then throw - * a "NotFoundError" DOMException. - * 2. Remove attr from context object. - * 3. Return attr. + * 3. Append a new doctype, with "html" as its name and with its node + * document set to doc, to doc. */ - var found = false; - for (var i = 0; i < this._attributeList.length; i++) { - var attribute = this._attributeList[i]; - if (attribute === attr) { - found = true; - break; - } - } - if (!found) - throw new DOMException_1.NotFoundError(); - algorithm_1.element_remove(attr, this); - return attr; - }; - /** @inheritdoc */ - ElementImpl.prototype.attachShadow = function (init) { + doc.appendChild(algorithm_1.create_documentType(doc, "html", "", "")); /** - * 1. If context object’s namespace is not the HTML namespace, then throw a - * "NotSupportedError" DOMException. + * 4. Append the result of creating an element given doc, html, and the + * HTML namespace, to doc. */ - if (this._namespace !== infra_1.namespace.HTML) - throw new DOMException_1.NotSupportedError(); + var htmlElement = algorithm_1.element_createAnElement(doc, "html", infra_1.namespace.HTML); + doc.appendChild(htmlElement); /** - * 2. If context object’s local name is not a valid custom element name, - * "article", "aside", "blockquote", "body", "div", "footer", "h1", "h2", - * "h3", "h4", "h5", "h6", "header", "main" "nav", "p", "section", - * or "span", then throw a "NotSupportedError" DOMException. + * 5. Append the result of creating an element given doc, head, and the + * HTML namespace, to the html element created earlier. */ - if (!algorithm_1.customElement_isValidCustomElementName(this._localName) && - !algorithm_1.customElement_isValidShadowHostName(this._localName)) - throw new DOMException_1.NotSupportedError(); + var headElement = algorithm_1.element_createAnElement(doc, "head", infra_1.namespace.HTML); + htmlElement.appendChild(headElement); /** - * 3. If context object’s local name is a valid custom element name, - * or context object’s is value is not null, then: - * 3.1. Let definition be the result of looking up a custom element - * definition given context object’s node document, its namespace, its - * local name, and its is value. - * 3.2. If definition is not null and definition’s disable shadow is true, - * then throw a "NotSupportedError" DOMException. + * 6. If title is given: + * 6.1. Append the result of creating an element given doc, title, and + * the HTML namespace, to the head element created earlier. + * 6.2. Append a new Text node, with its data set to title (which could + * be the empty string) and its node document set to doc, to the title + * element created earlier. */ - if (algorithm_1.customElement_isValidCustomElementName(this._localName) || this._is !== null) { - var definition = algorithm_1.customElement_lookUpACustomElementDefinition(this._nodeDocument, this._namespace, this._localName, this._is); - if (definition !== null && definition.disableShadow === true) { - throw new DOMException_1.NotSupportedError(); - } + if (title !== undefined) { + var titleElement = algorithm_1.element_createAnElement(doc, "title", infra_1.namespace.HTML); + headElement.appendChild(titleElement); + var textElement = algorithm_1.create_text(doc, title); + titleElement.appendChild(textElement); } /** - * 4. If context object is a shadow host, then throw an "NotSupportedError" - * DOMException. + * 7. Append the result of creating an element given doc, body, and the + * HTML namespace, to the html element created earlier. */ - if (this._shadowRoot !== null) - throw new DOMException_1.NotSupportedError(); + var bodyElement = algorithm_1.element_createAnElement(doc, "body", infra_1.namespace.HTML); + htmlElement.appendChild(bodyElement); /** - * 5. Let shadow be a new shadow root whose node document is context - * object’s node document, host is context object, and mode is init’s mode. - * 6. Set context object’s shadow root to shadow. - * 7. Return shadow. + * 8. doc’s origin is context object’s associated document’s origin. */ - var shadow = algorithm_1.create_shadowRoot(this._nodeDocument, this); - shadow._mode = init.mode; - this._shadowRoot = shadow; - return shadow; + doc._origin = this._associatedDocument._origin; + /** + * 9. Return doc. + */ + return doc; }; - Object.defineProperty(ElementImpl.prototype, "shadowRoot", { + /** @inheritdoc */ + DOMImplementationImpl.prototype.hasFeature = function () { return true; }; + /** + * Creates a new `DOMImplementation`. + * + * @param document - owner document + */ + DOMImplementationImpl._create = function (document) { + return new DOMImplementationImpl(document); + }; + return DOMImplementationImpl; +}()); +exports.DOMImplementationImpl = DOMImplementationImpl; +WebIDLAlgorithm_1.idl_defineConst(DOMImplementationImpl.prototype, "_ID", "@oozcitak/dom"); +//# sourceMappingURL=DOMImplementationImpl.js.map + +/***/ }), + +/***/ 65096: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var DOMImpl_1 = __nccwpck_require__(14177); +var DOMException_1 = __nccwpck_require__(13166); +var infra_1 = __nccwpck_require__(84251); +var algorithm_1 = __nccwpck_require__(61); +/** + * Represents a token set. + */ +var DOMTokenListImpl = /** @class */ (function () { + /** + * Initializes a new instance of `DOMTokenList`. + * + * @param element - associated element + * @param attribute - associated attribute + */ + function DOMTokenListImpl(element, attribute) { + /** + * 1. Let element be associated element. + * 2. Let localName be associated attribute’s local name. + * 3. Let value be the result of getting an attribute value given element + * and localName. + * 4. Run the attribute change steps for element, localName, value, value, + * and null. + */ + this._element = element; + this._attribute = attribute; + this._tokenSet = new Set(); + var localName = attribute._localName; + var value = algorithm_1.element_getAnAttributeValue(element, localName); + // define a closure to be called when the associated attribute's value changes + var thisObj = this; + function updateTokenSet(element, localName, oldValue, value, namespace) { + /** + * 1. If localName is associated attribute’s local name, namespace is null, + * and value is null, then empty token set. + * 2. Otherwise, if localName is associated attribute’s local name, + * namespace is null, then set token set to value, parsed. + */ + if (localName === thisObj._attribute._localName && namespace === null) { + if (!value) + thisObj._tokenSet.clear(); + else + thisObj._tokenSet = algorithm_1.orderedSet_parse(value); + } + } + // add the closure to the associated element's attribute change steps + this._element._attributeChangeSteps.push(updateTokenSet); + if (DOMImpl_1.dom.features.steps) { + algorithm_1.dom_runAttributeChangeSteps(element, localName, value, value, null); + } + } + Object.defineProperty(DOMTokenListImpl.prototype, "length", { /** @inheritdoc */ get: function () { /** - * 1. Let shadow be context object’s shadow root. - * 2. If shadow is null or its mode is "closed", then return null. - * 3. Return shadow. + * The length attribute' getter must return context object’s token set’s + * size. */ - var shadow = this._shadowRoot; - if (shadow === null || shadow.mode === "closed") - return null; - else - return shadow; + return this._tokenSet.size; }, enumerable: true, configurable: true }); /** @inheritdoc */ - ElementImpl.prototype.closest = function (selectors) { + DOMTokenListImpl.prototype.item = function (index) { + var e_1, _a; /** - * TODO: Selectors - * 1. Let s be the result of parse a selector from selectors. [SELECTORS4] - * 2. If s is failure, throw a "SyntaxError" DOMException. - * 3. Let elements be context object’s inclusive ancestors that are - * elements, in reverse tree order. - * 4. For each element in elements, if match a selector against an element, - * using s, element, and :scope element context object, returns success, - * return element. [SELECTORS4] - * 5. Return null. + * 1. If index is equal to or greater than context object’s token set’s + * size, then return null. + * 2. Return context object’s token set[index]. */ - throw new DOMException_1.NotImplementedError(); + var i = 0; + try { + for (var _b = __values(this._tokenSet), _c = _b.next(); !_c.done; _c = _b.next()) { + var token = _c.value; + if (i === index) + return token; + i++; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + return null; }; /** @inheritdoc */ - ElementImpl.prototype.matches = function (selectors) { + DOMTokenListImpl.prototype.contains = function (token) { /** - * TODO: Selectors - * 1. Let s be the result of parse a selector from selectors. [SELECTORS4] - * 2. If s is failure, throw a "SyntaxError" DOMException. - * 3. Return true if the result of match a selector against an element, - * using s, element, and :scope element context object, returns success, - * and false otherwise. [SELECTORS4] + * The contains(token) method, when invoked, must return true if context + * object’s token set[token] exists, and false otherwise. */ - throw new DOMException_1.NotImplementedError(); + return this._tokenSet.has(token); }; /** @inheritdoc */ - ElementImpl.prototype.webkitMatchesSelector = function (selectors) { - return this.matches(selectors); + DOMTokenListImpl.prototype.add = function () { + var e_2, _a; + var tokens = []; + for (var _i = 0; _i < arguments.length; _i++) { + tokens[_i] = arguments[_i]; + } + try { + /** + * 1. For each token in tokens: + * 1.1. If token is the empty string, then throw a "SyntaxError" + * DOMException. + * 1.2. If token contains any ASCII whitespace, then throw an + * "InvalidCharacterError" DOMException. + * 2. For each token in tokens, append token to context object’s token set. + * 3. Run the update steps. + */ + for (var tokens_1 = __values(tokens), tokens_1_1 = tokens_1.next(); !tokens_1_1.done; tokens_1_1 = tokens_1.next()) { + var token = tokens_1_1.value; + if (token === '') { + throw new DOMException_1.SyntaxError("Cannot add an empty token."); + } + else if (infra_1.codePoint.ASCIIWhiteSpace.test(token)) { + throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); + } + else { + this._tokenSet.add(token); + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (tokens_1_1 && !tokens_1_1.done && (_a = tokens_1.return)) _a.call(tokens_1); + } + finally { if (e_2) throw e_2.error; } + } + algorithm_1.tokenList_updateSteps(this); }; /** @inheritdoc */ - ElementImpl.prototype.getElementsByTagName = function (qualifiedName) { - /** - * The getElementsByTagName(qualifiedName) method, when invoked, must return - * the list of elements with qualified name qualifiedName for context - * object. - */ - return algorithm_1.node_listOfElementsWithQualifiedName(qualifiedName, this); + DOMTokenListImpl.prototype.remove = function () { + var e_3, _a; + var tokens = []; + for (var _i = 0; _i < arguments.length; _i++) { + tokens[_i] = arguments[_i]; + } + try { + /** + * 1. For each token in tokens: + * 1.1. If token is the empty string, then throw a "SyntaxError" + * DOMException. + * 1.2. If token contains any ASCII whitespace, then throw an + * "InvalidCharacterError" DOMException. + * 2. For each token in tokens, remove token from context object’s token set. + * 3. Run the update steps. + */ + for (var tokens_2 = __values(tokens), tokens_2_1 = tokens_2.next(); !tokens_2_1.done; tokens_2_1 = tokens_2.next()) { + var token = tokens_2_1.value; + if (token === '') { + throw new DOMException_1.SyntaxError("Cannot remove an empty token."); + } + else if (infra_1.codePoint.ASCIIWhiteSpace.test(token)) { + throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); + } + else { + this._tokenSet.delete(token); + } + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (tokens_2_1 && !tokens_2_1.done && (_a = tokens_2.return)) _a.call(tokens_2); + } + finally { if (e_3) throw e_3.error; } + } + algorithm_1.tokenList_updateSteps(this); }; /** @inheritdoc */ - ElementImpl.prototype.getElementsByTagNameNS = function (namespace, localName) { + DOMTokenListImpl.prototype.toggle = function (token, force) { + if (force === void 0) { force = undefined; } /** - * The getElementsByTagNameNS(namespace, localName) method, when invoked, - * must return the list of elements with namespace namespace and local name - * localName for context object. + * 1. If token is the empty string, then throw a "SyntaxError" DOMException. + * 2. If token contains any ASCII whitespace, then throw an + * "InvalidCharacterError" DOMException. */ - return algorithm_1.node_listOfElementsWithNamespace(namespace, localName, this); - }; - /** @inheritdoc */ - ElementImpl.prototype.getElementsByClassName = function (classNames) { + if (token === '') { + throw new DOMException_1.SyntaxError("Cannot toggle an empty token."); + } + else if (infra_1.codePoint.ASCIIWhiteSpace.test(token)) { + throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); + } /** - * The getElementsByClassName(classNames) method, when invoked, must return - * the list of elements with class names classNames for context object. + * 3. If context object’s token set[token] exists, then: */ - return algorithm_1.node_listOfElementsWithClassNames(classNames, this); - }; - /** @inheritdoc */ - ElementImpl.prototype.insertAdjacentElement = function (where, element) { - /** - * The insertAdjacentElement(where, element) method, when invoked, must - * return the result of running insert adjacent, given context object, - * where, and element. + if (this._tokenSet.has(token)) { + /** + * 3.1. If force is either not given or is false, then remove token from + * context object’s token set, run the update steps and return false. + * 3.2. Return true. + */ + if (force === undefined || force === false) { + this._tokenSet.delete(token); + algorithm_1.tokenList_updateSteps(this); + return false; + } + return true; + } + /** + * 4. Otherwise, if force not given or is true, append token to context + * object’s token set, run the update steps, and return true. */ - return algorithm_1.element_insertAdjacent(this, where, element); + if (force === undefined || force === true) { + this._tokenSet.add(token); + algorithm_1.tokenList_updateSteps(this); + return true; + } + /** + * 5. Return false. + */ + return false; }; /** @inheritdoc */ - ElementImpl.prototype.insertAdjacentText = function (where, data) { + DOMTokenListImpl.prototype.replace = function (token, newToken) { /** - * 1. Let text be a new Text node whose data is data and node document is - * context object’s node document. - * 2. Run insert adjacent, given context object, where, and text. + * 1. If either token or newToken is the empty string, then throw a + * "SyntaxError" DOMException. + * 2. If either token or newToken contains any ASCII whitespace, then throw + * an "InvalidCharacterError" DOMException. */ - var text = algorithm_1.create_text(this._nodeDocument, data); - algorithm_1.element_insertAdjacent(this, where, text); + if (token === '' || newToken === '') { + throw new DOMException_1.SyntaxError("Cannot replace an empty token."); + } + else if (infra_1.codePoint.ASCIIWhiteSpace.test(token) || infra_1.codePoint.ASCIIWhiteSpace.test(newToken)) { + throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); + } + /** + * 3. If context object’s token set does not contain token, then return + * false. + */ + if (!this._tokenSet.has(token)) + return false; + /** + * 4. Replace token in context object’s token set with newToken. + * 5. Run the update steps. + * 6. Return true. + */ + infra_1.set.replace(this._tokenSet, token, newToken); + algorithm_1.tokenList_updateSteps(this); + return true; }; - Object.defineProperty(ElementImpl.prototype, "_qualifiedName", { + /** @inheritdoc */ + DOMTokenListImpl.prototype.supports = function (token) { /** - * Returns the qualified name. + * 1. Let result be the return value of validation steps called with token. + * 2. Return result. */ + return algorithm_1.tokenList_validationSteps(this, token); + }; + Object.defineProperty(DOMTokenListImpl.prototype, "value", { + /** @inheritdoc */ get: function () { /** - * An element’s qualified name is its local name if its namespace prefix is - * null, and its namespace prefix, followed by ":", followed by its - * local name, otherwise. + * The value attribute must return the result of running context object’s + * serialize steps. */ - return (this._namespacePrefix ? - this._namespacePrefix + ':' + this._localName : - this._localName); + return algorithm_1.tokenList_serializeSteps(this); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "_htmlUppercasedQualifiedName", { - /** - * Returns the upper-cased qualified name for a html element. - */ - get: function () { + set: function (value) { /** - * 1. Let qualifiedName be context object’s qualified name. - * 2. If the context object is in the HTML namespace and its node document - * is an HTML document, then set qualifiedName to qualifiedName in ASCII - * uppercase. - * 3. Return qualifiedName. + * Setting the value attribute must set an attribute value for the + * associated element using associated attribute’s local name and the given + * value. */ - var qualifiedName = this._qualifiedName; - if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { - qualifiedName = qualifiedName.toUpperCase(); - } - return qualifiedName; + algorithm_1.element_setAnAttributeValue(this._element, this._attribute._localName, value); }, enumerable: true, configurable: true }); - Object.defineProperty(ElementImpl.prototype, "children", { + /** + * Returns an iterator for the token set. + */ + DOMTokenListImpl.prototype[Symbol.iterator] = function () { + var it = this._tokenSet[Symbol.iterator](); + return { + next: function () { + return it.next(); + } + }; + }; + /** + * Creates a new `DOMTokenList`. + * + * @param element - associated element + * @param attribute - associated attribute + */ + DOMTokenListImpl._create = function (element, attribute) { + return new DOMTokenListImpl(element, attribute); + }; + return DOMTokenListImpl; +}()); +exports.DOMTokenListImpl = DOMTokenListImpl; +//# sourceMappingURL=DOMTokenListImpl.js.map + +/***/ }), + +/***/ 12585: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var interfaces_1 = __nccwpck_require__(27305); +var NodeImpl_1 = __nccwpck_require__(91745); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +/** + * Represents a document fragment in the XML tree. + */ +var DocumentFragmentImpl = /** @class */ (function (_super) { + __extends(DocumentFragmentImpl, _super); + /** + * Initializes a new instance of `DocumentFragment`. + * + * @param host - shadow root's host element + */ + function DocumentFragmentImpl(host) { + if (host === void 0) { host = null; } + var _this = _super.call(this) || this; + _this._children = new Set(); + _this._host = host; + return _this; + } + // MIXIN: NonElementParentNode + /* istanbul ignore next */ + DocumentFragmentImpl.prototype.getElementById = function (elementId) { throw new Error("Mixin: NonElementParentNode not implemented."); }; + Object.defineProperty(DocumentFragmentImpl.prototype, "children", { // MIXIN: ParentNode /* istanbul ignore next */ get: function () { throw new Error("Mixin: ParentNode not implemented."); }, enumerable: true, configurable: true }); - Object.defineProperty(ElementImpl.prototype, "firstElementChild", { + Object.defineProperty(DocumentFragmentImpl.prototype, "firstElementChild", { /* istanbul ignore next */ get: function () { throw new Error("Mixin: ParentNode not implemented."); }, enumerable: true, configurable: true }); - Object.defineProperty(ElementImpl.prototype, "lastElementChild", { + Object.defineProperty(DocumentFragmentImpl.prototype, "lastElementChild", { /* istanbul ignore next */ get: function () { throw new Error("Mixin: ParentNode not implemented."); }, enumerable: true, configurable: true }); - Object.defineProperty(ElementImpl.prototype, "childElementCount", { + Object.defineProperty(DocumentFragmentImpl.prototype, "childElementCount", { /* istanbul ignore next */ get: function () { throw new Error("Mixin: ParentNode not implemented."); }, enumerable: true, configurable: true }); /* istanbul ignore next */ - ElementImpl.prototype.prepend = function () { + DocumentFragmentImpl.prototype.prepend = function () { var nodes = []; for (var _i = 0; _i < arguments.length; _i++) { nodes[_i] = arguments[_i]; @@ -59024,7 +59303,7 @@ var ElementImpl = /** @class */ (function (_super) { throw new Error("Mixin: ParentNode not implemented."); }; /* istanbul ignore next */ - ElementImpl.prototype.append = function () { + DocumentFragmentImpl.prototype.append = function () { var nodes = []; for (var _i = 0; _i < arguments.length; _i++) { nodes[_i] = arguments[_i]; @@ -59032,1024 +59311,609 @@ var ElementImpl = /** @class */ (function (_super) { throw new Error("Mixin: ParentNode not implemented."); }; /* istanbul ignore next */ - ElementImpl.prototype.querySelector = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; - /* istanbul ignore next */ - ElementImpl.prototype.querySelectorAll = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; - Object.defineProperty(ElementImpl.prototype, "previousElementSibling", { - // MIXIN: NonDocumentTypeChildNode - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "nextElementSibling", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, - enumerable: true, - configurable: true - }); - // MIXIN: ChildNode - /* istanbul ignore next */ - ElementImpl.prototype.before = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; - /* istanbul ignore next */ - ElementImpl.prototype.after = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; - /* istanbul ignore next */ - ElementImpl.prototype.replaceWith = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; + DocumentFragmentImpl.prototype.querySelector = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; /* istanbul ignore next */ - ElementImpl.prototype.remove = function () { throw new Error("Mixin: ChildNode not implemented."); }; - Object.defineProperty(ElementImpl.prototype, "assignedSlot", { - // MIXIN: Slotable - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: Slotable not implemented."); }, - enumerable: true, - configurable: true - }); + DocumentFragmentImpl.prototype.querySelectorAll = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; /** - * Creates a new `Element`. + * Creates a new `DocumentFragment`. * * @param document - owner document - * @param localName - local name - * @param namespace - namespace - * @param prefix - namespace prefix + * @param host - shadow root's host element */ - ElementImpl._create = function (document, localName, namespace, namespacePrefix) { - if (namespace === void 0) { namespace = null; } - if (namespacePrefix === void 0) { namespacePrefix = null; } - var node = new ElementImpl(); - node._localName = localName; - node._namespace = namespace; - node._namespacePrefix = namespacePrefix; + DocumentFragmentImpl._create = function (document, host) { + if (host === void 0) { host = null; } + var node = new DocumentFragmentImpl(host); node._nodeDocument = document; return node; }; - return ElementImpl; + return DocumentFragmentImpl; }(NodeImpl_1.NodeImpl)); -exports.ElementImpl = ElementImpl; +exports.DocumentFragmentImpl = DocumentFragmentImpl; /** * Initialize prototype properties */ -WebIDLAlgorithm_1.idl_defineConst(ElementImpl.prototype, "_nodeType", interfaces_1.NodeType.Element); -//# sourceMappingURL=ElementImpl.js.map +WebIDLAlgorithm_1.idl_defineConst(DocumentFragmentImpl.prototype, "_nodeType", interfaces_1.NodeType.DocumentFragment); +//# sourceMappingURL=DocumentFragmentImpl.js.map /***/ }), -/***/ 8245: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 14333: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); +var DOMImpl_1 = __nccwpck_require__(14177); +var interfaces_1 = __nccwpck_require__(27305); +var DOMException_1 = __nccwpck_require__(13166); +var NodeImpl_1 = __nccwpck_require__(91745); +var util_1 = __nccwpck_require__(65282); +var util_2 = __nccwpck_require__(76195); +var infra_1 = __nccwpck_require__(84251); +var URLAlgorithm_1 = __nccwpck_require__(53568); var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** - * Represents a DOM event. + * Represents a document node. */ -var EventImpl = /** @class */ (function () { +var DocumentImpl = /** @class */ (function (_super) { + __extends(DocumentImpl, _super); /** - * Initializes a new instance of `Event`. + * Initializes a new instance of `Document`. */ - function EventImpl(type, eventInit) { - this._target = null; - this._relatedTarget = null; - this._touchTargetList = []; - this._path = []; - this._currentTarget = null; - this._eventPhase = interfaces_1.EventPhase.None; - this._stopPropagationFlag = false; - this._stopImmediatePropagationFlag = false; - this._canceledFlag = false; - this._inPassiveListenerFlag = false; - this._composedFlag = false; - this._initializedFlag = false; - this._dispatchFlag = false; - this._isTrusted = false; - this._bubbles = false; - this._cancelable = false; - /** - * When a constructor of the Event interface, or of an interface that - * inherits from the Event interface, is invoked, these steps must be run, - * given the arguments type and eventInitDict: - * 1. Let event be the result of running the inner event creation steps with - * this interface, null, now, and eventInitDict. - * 2. Initialize event’s type attribute to type. - * 3. Return event. - */ - this._type = type; - if (eventInit) { - this._bubbles = eventInit.bubbles || false; - this._cancelable = eventInit.cancelable || false; - this._composedFlag = eventInit.composed || false; - } - this._initializedFlag = true; - this._timeStamp = new Date().getTime(); + function DocumentImpl() { + var _this = _super.call(this) || this; + _this._children = new Set(); + _this._encoding = { + name: "UTF-8", + labels: ["unicode-1-1-utf-8", "utf-8", "utf8"] + }; + _this._contentType = 'application/xml'; + _this._URL = { + scheme: "about", + username: "", + password: "", + host: null, + port: null, + path: ["blank"], + query: null, + fragment: null, + _cannotBeABaseURLFlag: true, + _blobURLEntry: null + }; + _this._origin = null; + _this._type = "xml"; + _this._mode = "no-quirks"; + _this._documentElement = null; + _this._hasNamespaces = false; + _this._nodeDocumentOverwrite = null; + return _this; } - Object.defineProperty(EventImpl.prototype, "type", { + Object.defineProperty(DocumentImpl.prototype, "_nodeDocument", { + get: function () { return this._nodeDocumentOverwrite || this; }, + set: function (val) { this._nodeDocumentOverwrite = val; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "implementation", { /** @inheritdoc */ - get: function () { return this._type; }, + get: function () { + /** + * The implementation attribute’s getter must return the DOMImplementation + * object that is associated with the document. + */ + return this._implementation || (this._implementation = algorithm_1.create_domImplementation(this)); + }, enumerable: true, configurable: true }); - Object.defineProperty(EventImpl.prototype, "target", { + Object.defineProperty(DocumentImpl.prototype, "URL", { /** @inheritdoc */ - get: function () { return this._target; }, + get: function () { + /** + * The URL attribute’s getter and documentURI attribute’s getter must return + * the URL, serialized. + * See: https://url.spec.whatwg.org/#concept-url-serializer + */ + return URLAlgorithm_1.urlSerializer(this._URL); + }, enumerable: true, configurable: true }); - Object.defineProperty(EventImpl.prototype, "srcElement", { + Object.defineProperty(DocumentImpl.prototype, "documentURI", { /** @inheritdoc */ - get: function () { return this._target; }, + get: function () { return this.URL; }, enumerable: true, configurable: true }); - Object.defineProperty(EventImpl.prototype, "currentTarget", { + Object.defineProperty(DocumentImpl.prototype, "origin", { /** @inheritdoc */ - get: function () { return this._currentTarget; }, + get: function () { + return "null"; + }, enumerable: true, configurable: true }); - /** @inheritdoc */ - EventImpl.prototype.composedPath = function () { - /** - * 1. Let composedPath be an empty list. - * 2. Let path be the context object’s path. - * 3. If path is empty, then return composedPath. - * 4. Let currentTarget be the context object’s currentTarget attribute - * value. - * 5. Append currentTarget to composedPath. - * 6. Let currentTargetIndex be 0. - * 7. Let currentTargetHiddenSubtreeLevel be 0. - */ - var composedPath = []; - var path = this._path; - if (path.length === 0) - return composedPath; - var currentTarget = this._currentTarget; - if (currentTarget === null) { - throw new Error("Event currentTarget is null."); - } - composedPath.push(currentTarget); - var currentTargetIndex = 0; - var currentTargetHiddenSubtreeLevel = 0; - /** - * 8. Let index be path’s size − 1. - * 9. While index is greater than or equal to 0: - */ - var index = path.length - 1; - while (index >= 0) { + Object.defineProperty(DocumentImpl.prototype, "compatMode", { + /** @inheritdoc */ + get: function () { /** - * 9.1. If path[index]'s root-of-closed-tree is true, then increase - * currentTargetHiddenSubtreeLevel by 1. - * 9.2. If path[index]'s invocation target is currentTarget, then set - * currentTargetIndex to index and break. - * 9.3. If path[index]'s slot-in-closed-tree is true, then decrease - * currentTargetHiddenSubtreeLevel by 1. - * 9.4. Decrease index by 1. + * The compatMode attribute’s getter must return "BackCompat" if context + * object’s mode is "quirks", and "CSS1Compat" otherwise. */ - if (path[index].rootOfClosedTree) { - currentTargetHiddenSubtreeLevel++; - } - if (path[index].invocationTarget === currentTarget) { - currentTargetIndex = index; - break; - } - if (path[index].slotInClosedTree) { - currentTargetHiddenSubtreeLevel--; - } - index--; - } - /** - * 10. Let currentHiddenLevel and maxHiddenLevel be - * currentTargetHiddenSubtreeLevel. - */ - var currentHiddenLevel = currentTargetHiddenSubtreeLevel; - var maxHiddenLevel = currentTargetHiddenSubtreeLevel; - /** - * 11. Set index to currentTargetIndex − 1. - * 12. While index is greater than or equal to 0: - */ - index = currentTargetIndex - 1; - while (index >= 0) { + return this._mode === "quirks" ? "BackCompat" : "CSS1Compat"; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "characterSet", { + /** @inheritdoc */ + get: function () { /** - * 12.1. If path[index]'s root-of-closed-tree is true, then increase - * currentHiddenLevel by 1. - * 12.2. If currentHiddenLevel is less than or equal to maxHiddenLevel, - * then prepend path[index]'s invocation target to composedPath. + * The characterSet attribute’s getter, charset attribute’s getter, and + * inputEncoding attribute’s getter, must return context object’s + * encoding’s name. */ - if (path[index].rootOfClosedTree) { - currentHiddenLevel++; - } - if (currentHiddenLevel <= maxHiddenLevel) { - composedPath.unshift(path[index].invocationTarget); - } + return this._encoding.name; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "charset", { + /** @inheritdoc */ + get: function () { return this._encoding.name; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "inputEncoding", { + /** @inheritdoc */ + get: function () { return this._encoding.name; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "contentType", { + /** @inheritdoc */ + get: function () { /** - * 12.3. If path[index]'s slot-in-closed-tree is true, then: + * The contentType attribute’s getter must return the content type. */ - if (path[index].slotInClosedTree) { - /** - * 12.3.1. Decrease currentHiddenLevel by 1. - * 12.3.2. If currentHiddenLevel is less than maxHiddenLevel, then set - * maxHiddenLevel to currentHiddenLevel. + return this._contentType; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "doctype", { + /** @inheritdoc */ + get: function () { + var e_1, _a; + try { + /** + * The doctype attribute’s getter must return the child of the document + * that is a doctype, and null otherwise. */ - currentHiddenLevel--; - if (currentHiddenLevel < maxHiddenLevel) { - maxHiddenLevel = currentHiddenLevel; + for (var _b = __values(this._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var child = _c.value; + if (util_1.Guard.isDocumentTypeNode(child)) + return child; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } + finally { if (e_1) throw e_1.error; } } + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "documentElement", { + /** @inheritdoc */ + get: function () { /** - * 12.4. Decrease index by 1. + * The documentElement attribute’s getter must return the document element. */ - index--; - } + return this._documentElement; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + DocumentImpl.prototype.getElementsByTagName = function (qualifiedName) { /** - * 13. Set currentHiddenLevel and maxHiddenLevel to - * currentTargetHiddenSubtreeLevel. + * The getElementsByTagName(qualifiedName) method, when invoked, must return + * the list of elements with qualified name qualifiedName for the context object. */ - currentHiddenLevel = currentTargetHiddenSubtreeLevel; - maxHiddenLevel = currentTargetHiddenSubtreeLevel; + return algorithm_1.node_listOfElementsWithQualifiedName(qualifiedName, this); + }; + /** @inheritdoc */ + DocumentImpl.prototype.getElementsByTagNameNS = function (namespace, localName) { /** - * 14. Set index to currentTargetIndex + 1. - * 15. While index is less than path’s size: + * The getElementsByTagNameNS(namespace, localName) method, when invoked, + * must return the list of elements with namespace namespace and local name + * localName for the context object. */ - index = currentTargetIndex + 1; - while (index < path.length) { - /** - * 15.1. If path[index]'s slot-in-closed-tree is true, then increase - * currentHiddenLevel by 1. - * 15.2. If currentHiddenLevel is less than or equal to maxHiddenLevel, - * then append path[index]'s invocation target to composedPath. - */ - if (path[index].slotInClosedTree) { - currentHiddenLevel++; - } - if (currentHiddenLevel <= maxHiddenLevel) { - composedPath.push(path[index].invocationTarget); + return algorithm_1.node_listOfElementsWithNamespace(namespace, localName, this); + }; + /** @inheritdoc */ + DocumentImpl.prototype.getElementsByClassName = function (classNames) { + /** + * The getElementsByClassName(classNames) method, when invoked, must return + * the list of elements with class names classNames for the context object. + */ + return algorithm_1.node_listOfElementsWithClassNames(classNames, this); + }; + /** @inheritdoc */ + DocumentImpl.prototype.createElement = function (localName, options) { + /** + * 1. If localName does not match the Name production, then throw an + * "InvalidCharacterError" DOMException. + * 2. If the context object is an HTML document, then set localName to + * localName in ASCII lowercase. + * 3. Let is be null. + * 4. If options is a dictionary and options’s is is present, then set is + * to it. + * 5. Let namespace be the HTML namespace, if the context object is an + * HTML document or context object’s content type is + * "application/xhtml+xml", and null otherwise. + * 6. Return the result of creating an element given the context object, + * localName, namespace, null, is, and with the synchronous custom elements + * flag set. + */ + if (!algorithm_1.xml_isName(localName)) + throw new DOMException_1.InvalidCharacterError(); + if (this._type === "html") + localName = localName.toLowerCase(); + var is = null; + if (options !== undefined) { + if (util_2.isString(options)) { + is = options; } - /** - * 15.3. If path[index]'s root-of-closed-tree is true, then: - */ - if (path[index].rootOfClosedTree) { - /** - * 15.3.1. Decrease currentHiddenLevel by 1. - * 15.3.2. If currentHiddenLevel is less than maxHiddenLevel, then set - * maxHiddenLevel to currentHiddenLevel. - */ - currentHiddenLevel--; - if (currentHiddenLevel < maxHiddenLevel) { - maxHiddenLevel = currentHiddenLevel; - } + else { + is = options.is; } - /** - * 15.4. Increase index by 1. - */ - index++; } + var namespace = (this._type === "html" || this._contentType === "application/xhtml+xml") ? + infra_1.namespace.HTML : null; + return algorithm_1.element_createAnElement(this, localName, namespace, null, is, true); + }; + /** @inheritdoc */ + DocumentImpl.prototype.createElementNS = function (namespace, qualifiedName, options) { /** - * 16. Return composedPath. + * The createElementNS(namespace, qualifiedName, options) method, when + * invoked, must return the result of running the internal createElementNS + * steps, given context object, namespace, qualifiedName, and options. */ - return composedPath; + return algorithm_1.document_internalCreateElementNS(this, namespace, qualifiedName, options); }; - Object.defineProperty(EventImpl.prototype, "eventPhase", { - /** @inheritdoc */ - get: function () { return this._eventPhase; }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - EventImpl.prototype.stopPropagation = function () { this._stopPropagationFlag = true; }; - Object.defineProperty(EventImpl.prototype, "cancelBubble", { - /** @inheritdoc */ - get: function () { return this._stopPropagationFlag; }, - set: function (value) { if (value) - this.stopPropagation(); }, - enumerable: true, - configurable: true - }); + DocumentImpl.prototype.createDocumentFragment = function () { + /** + * The createDocumentFragment() method, when invoked, must return a new + * DocumentFragment node with its node document set to the context object. + */ + return algorithm_1.create_documentFragment(this); + }; /** @inheritdoc */ - EventImpl.prototype.stopImmediatePropagation = function () { - this._stopPropagationFlag = true; - this._stopImmediatePropagationFlag = true; + DocumentImpl.prototype.createTextNode = function (data) { + /** + * The createTextNode(data) method, when invoked, must return a new Text + * node with its data set to data and node document set to the context object. + */ + return algorithm_1.create_text(this, data); }; - Object.defineProperty(EventImpl.prototype, "bubbles", { - /** @inheritdoc */ - get: function () { return this._bubbles; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventImpl.prototype, "cancelable", { - /** @inheritdoc */ - get: function () { return this._cancelable; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventImpl.prototype, "returnValue", { - /** @inheritdoc */ - get: function () { return !this._canceledFlag; }, - set: function (value) { - if (!value) { - algorithm_1.event_setTheCanceledFlag(this); - } - }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - EventImpl.prototype.preventDefault = function () { - algorithm_1.event_setTheCanceledFlag(this); + DocumentImpl.prototype.createCDATASection = function (data) { + /** + * 1. If context object is an HTML document, then throw a + * "NotSupportedError" DOMException. + * 2. If data contains the string "]]>", then throw an + * "InvalidCharacterError" DOMException. + * 3. Return a new CDATASection node with its data set to data and node + * document set to the context object. + */ + if (this._type === "html") + throw new DOMException_1.NotSupportedError(); + if (data.indexOf(']]>') !== -1) + throw new DOMException_1.InvalidCharacterError(); + return algorithm_1.create_cdataSection(this, data); }; - Object.defineProperty(EventImpl.prototype, "defaultPrevented", { - /** @inheritdoc */ - get: function () { return this._canceledFlag; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventImpl.prototype, "composed", { - /** @inheritdoc */ - get: function () { return this._composedFlag; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventImpl.prototype, "isTrusted", { - /** @inheritdoc */ - get: function () { return this._isTrusted; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventImpl.prototype, "timeStamp", { - /** @inheritdoc */ - get: function () { return this._timeStamp; }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - EventImpl.prototype.initEvent = function (type, bubbles, cancelable) { - if (bubbles === void 0) { bubbles = false; } - if (cancelable === void 0) { cancelable = false; } + DocumentImpl.prototype.createComment = function (data) { /** - * 1. If the context object’s dispatch flag is set, then return. + * The createComment(data) method, when invoked, must return a new Comment + * node with its data set to data and node document set to the context object. */ - if (this._dispatchFlag) - return; + return algorithm_1.create_comment(this, data); + }; + /** @inheritdoc */ + DocumentImpl.prototype.createProcessingInstruction = function (target, data) { /** - * 2. Initialize the context object with type, bubbles, and cancelable. + * 1. If target does not match the Name production, then throw an + * "InvalidCharacterError" DOMException. + * 2. If data contains the string "?>", then throw an + * "InvalidCharacterError" DOMException. + * 3. Return a new ProcessingInstruction node, with target set to target, + * data set to data, and node document set to the context object. */ - algorithm_1.event_initialize(this, type, bubbles, cancelable); + if (!algorithm_1.xml_isName(target)) + throw new DOMException_1.InvalidCharacterError(); + if (data.indexOf("?>") !== -1) + throw new DOMException_1.InvalidCharacterError(); + return algorithm_1.create_processingInstruction(this, target, data); }; - EventImpl.NONE = 0; - EventImpl.CAPTURING_PHASE = 1; - EventImpl.AT_TARGET = 2; - EventImpl.BUBBLING_PHASE = 3; - return EventImpl; -}()); -exports.EventImpl = EventImpl; -/** - * Define constants on prototype. - */ -WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "NONE", 0); -WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "CAPTURING_PHASE", 1); -WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "AT_TARGET", 2); -WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "BUBBLING_PHASE", 3); -//# sourceMappingURL=EventImpl.js.map - -/***/ }), - -/***/ 9968: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMException_1 = __nccwpck_require__(3166); -var util_1 = __nccwpck_require__(5282); -var algorithm_1 = __nccwpck_require__(61); -/** - * Represents a target to which an event can be dispatched. - */ -var EventTargetImpl = /** @class */ (function () { - /** - * Initializes a new instance of `EventTarget`. - */ - function EventTargetImpl() { - } - Object.defineProperty(EventTargetImpl.prototype, "_eventListenerList", { - get: function () { - return this.__eventListenerList || (this.__eventListenerList = []); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventTargetImpl.prototype, "_eventHandlerMap", { - get: function () { - return this.__eventHandlerMap || (this.__eventHandlerMap = {}); - }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - EventTargetImpl.prototype.addEventListener = function (type, callback, options) { - if (options === void 0) { options = { passive: false, once: false, capture: false }; } + DocumentImpl.prototype.importNode = function (node, deep) { + if (deep === void 0) { deep = false; } /** - * 1. Let capture, passive, and once be the result of flattening more options. + * 1. If node is a document or shadow root, then throw a "NotSupportedError" DOMException. */ - var _a = __read(algorithm_1.eventTarget_flattenMore(options), 3), capture = _a[0], passive = _a[1], once = _a[2]; - // convert callback function to EventListener, return if null - var listenerCallback; - if (!callback) { - return; - } - else if (util_1.Guard.isEventListener(callback)) { - listenerCallback = callback; - } - else { - listenerCallback = { handleEvent: callback }; - } + if (util_1.Guard.isDocumentNode(node) || util_1.Guard.isShadowRoot(node)) + throw new DOMException_1.NotSupportedError(); /** - * 2. Add an event listener with the context object and an event listener - * whose type is type, callback is callback, capture is capture, passive is - * passive, and once is once. + * 2. Return a clone of node, with context object and the clone children flag set if deep is true. */ - algorithm_1.eventTarget_addEventListener(this, { - type: type, - callback: listenerCallback, - capture: capture, - passive: passive, - once: once, - removed: false - }); + return algorithm_1.node_clone(node, this, deep); }; /** @inheritdoc */ - EventTargetImpl.prototype.removeEventListener = function (type, callback, options) { + DocumentImpl.prototype.adoptNode = function (node) { /** - * TODO: Implement realms - * 1. If the context object’s relevant global object is a - * ServiceWorkerGlobalScope object and its associated service worker’s - * script resource’s has ever been evaluated flag is set, then throw - * a TypeError. [SERVICE-WORKERS] + * 1. If node is a document, then throw a "NotSupportedError" DOMException. */ - if (options === void 0) { options = { capture: false }; } + if (util_1.Guard.isDocumentNode(node)) + throw new DOMException_1.NotSupportedError(); /** - * 2. Let capture be the result of flattening options. + * 2. If node is a shadow root, then throw a "HierarchyRequestError" DOMException. */ - var capture = algorithm_1.eventTarget_flatten(options); - if (!callback) - return; + if (util_1.Guard.isShadowRoot(node)) + throw new DOMException_1.HierarchyRequestError(); /** - * 3. If the context object’s event listener list contains an event listener - * whose type is type, callback is callback, and capture is capture, then - * remove an event listener with the context object and that event listener. + * 3. Adopt node into the context object. + * 4. Return node. */ - for (var i = 0; i < this._eventListenerList.length; i++) { - var entry = this._eventListenerList[i]; - if (entry.type !== type || entry.capture !== capture) - continue; - if (util_1.Guard.isEventListener(callback) && entry.callback === callback) { - algorithm_1.eventTarget_removeEventListener(this, entry, i); - break; - } - else if (callback && entry.callback.handleEvent === callback) { - algorithm_1.eventTarget_removeEventListener(this, entry, i); - break; - } - } + algorithm_1.document_adopt(node, this); + return node; }; /** @inheritdoc */ - EventTargetImpl.prototype.dispatchEvent = function (event) { + DocumentImpl.prototype.createAttribute = function (localName) { /** - * 1. If event’s dispatch flag is set, or if its initialized flag is not - * set, then throw an "InvalidStateError" DOMException. - * 2. Initialize event’s isTrusted attribute to false. - * 3. Return the result of dispatching event to the context object. + * 1. If localName does not match the Name production in XML, then throw + * an "InvalidCharacterError" DOMException. + * 2. If the context object is an HTML document, then set localName to + * localName in ASCII lowercase. + * 3. Return a new attribute whose local name is localName and node document + * is context object. */ - if (event._dispatchFlag || !event._initializedFlag) { - throw new DOMException_1.InvalidStateError(); + if (!algorithm_1.xml_isName(localName)) + throw new DOMException_1.InvalidCharacterError(); + if (this._type === "html") { + localName = localName.toLowerCase(); } - event._isTrusted = false; - return algorithm_1.event_dispatch(event, this); + var attr = algorithm_1.create_attr(this, localName); + return attr; }; /** @inheritdoc */ - EventTargetImpl.prototype._getTheParent = function (event) { - return null; + DocumentImpl.prototype.createAttributeNS = function (namespace, qualifiedName) { + /** + * 1. Let namespace, prefix, and localName be the result of passing + * namespace and qualifiedName to validate and extract. + * 2. Return a new attribute whose namespace is namespace, namespace prefix + * is prefix, local name is localName, and node document is context object. + */ + var _a = __read(algorithm_1.namespace_validateAndExtract(namespace, qualifiedName), 3), ns = _a[0], prefix = _a[1], localName = _a[2]; + var attr = algorithm_1.create_attr(this, localName); + attr._namespace = ns; + attr._namespacePrefix = prefix; + return attr; }; - return EventTargetImpl; -}()); -exports.EventTargetImpl = EventTargetImpl; -//# sourceMappingURL=EventTargetImpl.js.map - -/***/ }), - -/***/ 3969: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var infra_1 = __nccwpck_require__(4251); -var algorithm_1 = __nccwpck_require__(61); -var util_1 = __nccwpck_require__(5282); -var util_2 = __nccwpck_require__(6195); -/** - * Represents a collection of elements. - */ -var HTMLCollectionImpl = /** @class */ (function () { - /** - * Initializes a new instance of `HTMLCollection`. - * - * @param root - root node - * @param filter - node filter - */ - function HTMLCollectionImpl(root, filter) { - this._live = true; - this._root = root; - this._filter = filter; - return new Proxy(this, this); - } - Object.defineProperty(HTMLCollectionImpl.prototype, "length", { - /** @inheritdoc */ - get: function () { - var _this = this; - /** - * The length attribute’s getter must return the number of nodes - * represented by the collection. - */ - var count = 0; - var node = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); - while (node !== null) { - count++; - node = algorithm_1.tree_getNextDescendantNode(this._root, node, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); - } - return count; - }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - HTMLCollectionImpl.prototype.item = function (index) { - var _this = this; + DocumentImpl.prototype.createEvent = function (eventInterface) { + return algorithm_1.event_createLegacyEvent(eventInterface); + }; + /** @inheritdoc */ + DocumentImpl.prototype.createRange = function () { /** - * The item(index) method, when invoked, must return the indexth element - * in the collection. If there is no indexth element in the collection, - * then the method must return null. + * The createRange() method, when invoked, must return a new live range + * with (context object, 0) as its start and end. */ - var i = 0; - var node = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); - while (node !== null) { - if (i === index) - return node; - else - i++; - node = algorithm_1.tree_getNextDescendantNode(this._root, node, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); - } - return null; + var range = algorithm_1.create_range(); + range._start = [this, 0]; + range._end = [this, 0]; + return range; }; /** @inheritdoc */ - HTMLCollectionImpl.prototype.namedItem = function (key) { - var _this = this; + DocumentImpl.prototype.createNodeIterator = function (root, whatToShow, filter) { + if (whatToShow === void 0) { whatToShow = interfaces_1.WhatToShow.All; } + if (filter === void 0) { filter = null; } /** - * 1. If key is the empty string, return null. - * 2. Return the first element in the collection for which at least one of - * the following is true: - * - it has an ID which is key; - * - it is in the HTML namespace and has a name attribute whose value is key; - * or null if there is no such element. + * 1. Let iterator be a new NodeIterator object. + * 2. Set iterator’s root and iterator’s reference to root. + * 3. Set iterator’s pointer before reference to true. + * 4. Set iterator’s whatToShow to whatToShow. + * 5. Set iterator’s filter to filter. + * 6. Return iterator. */ - if (key === '') - return null; - var ele = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); - while (ele != null) { - if (ele._uniqueIdentifier === key) { - return ele; - } - else if (ele._namespace === infra_1.namespace.HTML) { - for (var i = 0; i < ele._attributeList.length; i++) { - var attr = ele._attributeList[i]; - if (attr._localName === "name" && attr._namespace === null && - attr._namespacePrefix === null && attr._value === key) - return ele; - } - } - ele = algorithm_1.tree_getNextDescendantNode(this._root, ele, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); - } - return null; - }; - /** @inheritdoc */ - HTMLCollectionImpl.prototype[Symbol.iterator] = function () { - var root = this._root; - var filter = this._filter; - var currentNode = algorithm_1.tree_getFirstDescendantNode(root, false, false, function (e) { return util_1.Guard.isElementNode(e) && filter(e); }); - return { - next: function () { - if (currentNode === null) { - return { done: true, value: null }; - } - else { - var result = { done: false, value: currentNode }; - currentNode = algorithm_1.tree_getNextDescendantNode(root, currentNode, false, false, function (e) { return util_1.Guard.isElementNode(e) && filter(e); }); - return result; - } - } - }; - }; - /** - * Implements a proxy get trap to provide array-like access. - */ - HTMLCollectionImpl.prototype.get = function (target, key, receiver) { - if (!util_2.isString(key) || HTMLCollectionImpl.reservedNames.indexOf(key) !== -1) { - return Reflect.get(target, key, receiver); - } - var index = Number(key); - if (isNaN(index)) { - return target.namedItem(key) || undefined; + var iterator = algorithm_1.create_nodeIterator(root, root, true); + iterator._whatToShow = whatToShow; + iterator._iteratorCollection = algorithm_1.create_nodeList(root); + if (util_2.isFunction(filter)) { + iterator._filter = algorithm_1.create_nodeFilter(); + iterator._filter.acceptNode = filter; } else { - return target.item(index) || undefined; + iterator._filter = filter; } + return iterator; }; - /** - * Implements a proxy set trap to provide array-like access. - */ - HTMLCollectionImpl.prototype.set = function (target, key, value, receiver) { - if (!util_2.isString(key) || HTMLCollectionImpl.reservedNames.indexOf(key) !== -1) { - return Reflect.set(target, key, value, receiver); - } - var index = Number(key); - var node = isNaN(index) ? - target.namedItem(key) || undefined : target.item(index) || undefined; - if (node && node._parent) { - algorithm_1.mutation_replace(node, value, node._parent); - return true; + /** @inheritdoc */ + DocumentImpl.prototype.createTreeWalker = function (root, whatToShow, filter) { + if (whatToShow === void 0) { whatToShow = interfaces_1.WhatToShow.All; } + if (filter === void 0) { filter = null; } + /** + * 1. Let walker be a new TreeWalker object. + * 2. Set walker’s root and walker’s current to root. + * 3. Set walker’s whatToShow to whatToShow. + * 4. Set walker’s filter to filter. + * 5. Return walker. + */ + var walker = algorithm_1.create_treeWalker(root, root); + walker._whatToShow = whatToShow; + if (util_2.isFunction(filter)) { + walker._filter = algorithm_1.create_nodeFilter(); + walker._filter.acceptNode = filter; } else { - return false; - } - }; - /** - * Creates a new `HTMLCollection`. - * - * @param root - root node - * @param filter - node filter - */ - HTMLCollectionImpl._create = function (root, filter) { - if (filter === void 0) { filter = (function () { return true; }); } - return new HTMLCollectionImpl(root, filter); - }; - HTMLCollectionImpl.reservedNames = ['_root', '_live', '_filter', 'length', - 'item', 'namedItem', 'get', 'set']; - return HTMLCollectionImpl; -}()); -exports.HTMLCollectionImpl = HTMLCollectionImpl; -//# sourceMappingURL=HTMLCollectionImpl.js.map - -/***/ }), - -/***/ 9616: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; + walker._filter = filter; } + return walker; }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var util_1 = __nccwpck_require__(5282); -var infra_1 = __nccwpck_require__(4251); -/** - * Represents an object that can be used to observe mutations to the tree of - * nodes. - */ -var MutationObserverImpl = /** @class */ (function () { /** - * Initializes a new instance of `MutationObserver`. + * Gets the parent event target for the given event. * - * @param callback - the callback function + * @param event - an event */ - function MutationObserverImpl(callback) { - this._nodeList = []; - this._recordQueue = []; - /** - * 1. Let mo be a new MutationObserver object whose callback is callback. - * 2. Append mo to mo’s relevant agent’s mutation observers. - * 3. Return mo. - */ - this._callback = callback; - var window = DOMImpl_1.dom.window; - infra_1.set.append(window._mutationObservers, this); - } - /** @inheritdoc */ - MutationObserverImpl.prototype.observe = function (target, options) { - var e_1, _a; - options = options || { - childList: false, - subtree: false - }; - /** - * 1. If either options’s attributeOldValue or attributeFilter is present - * and options’s attributes is omitted, then set options’s attributes - * to true. - * 2. If options’s characterDataOldValue is present and options’s - * characterData is omitted, then set options’s characterData to true. - * 3. If none of options’s childList, attributes, and characterData is - * true, then throw a TypeError. - * 4. If options’s attributeOldValue is true and options’s attributes is - * false, then throw a TypeError. - * 5. If options’s attributeFilter is present and options’s attributes is - * false, then throw a TypeError. - * 6. If options’s characterDataOldValue is true and options’s characterData - * is false, then throw a TypeError. - */ - if ((options.attributeOldValue !== undefined || options.attributeFilter !== undefined) && - options.attributes === undefined) { - options.attributes = true; - } - if (options.characterDataOldValue !== undefined && options.characterData === undefined) { - options.characterData = true; - } - if (!options.childList && !options.attributes && !options.characterData) { - throw new TypeError(); - } - if (options.attributeOldValue && !options.attributes) { - throw new TypeError(); - } - if (options.attributeFilter !== undefined && !options.attributes) { - throw new TypeError(); - } - if (options.characterDataOldValue && !options.characterData) { - throw new TypeError(); - } + DocumentImpl.prototype._getTheParent = function (event) { /** - * 7. For each registered of target’s registered observer list, if - * registered’s observer is the context object: + * TODO: Implement realms + * A document’s get the parent algorithm, given an event, returns null if + * event’s type attribute value is "load" or document does not have a + * browsing context, and the document’s relevant global object otherwise. */ - var isRegistered = false; - var coptions = options; - var _loop_1 = function (registered) { - var e_2, _a; - if (registered.observer === this_1) { - isRegistered = true; - try { - /** - * 7.1. For each node of the context object’s node list, remove all - * transient registered observers whose source is registered from node’s - * registered observer list. - */ - for (var _b = (e_2 = void 0, __values(this_1._nodeList)), _c = _b.next(); !_c.done; _c = _b.next()) { - var node = _c.value; - infra_1.list.remove(node._registeredObserverList, function (ob) { - return util_1.Guard.isTransientRegisteredObserver(ob) && ob.source === registered; - }); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_2) throw e_2.error; } - } - /** - * 7.2. Set registered’s options to options. - */ - registered.options = coptions; - } - }; - var this_1 = this; - try { - for (var _b = __values(target._registeredObserverList), _c = _b.next(); !_c.done; _c = _b.next()) { - var registered = _c.value; - _loop_1(registered); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + if (event._type === "load") { + return null; } - /** - * 8. Otherwise: - * 8.1. Append a new registered observer whose observer is the context - * object and options is options to target’s registered observer list. - * 8.2. Append target to the context object’s node list. - */ - if (!isRegistered) { - target._registeredObserverList.push({ observer: this, options: options }); - this._nodeList.push(target); + else { + return DOMImpl_1.dom.window; } }; - /** @inheritdoc */ - MutationObserverImpl.prototype.disconnect = function () { - var e_3, _a; - var _this = this; - try { - /** - * 1. For each node of the context object’s node list, remove any - * registered observer from node’s registered observer list for which the - * context object is the observer. - */ - for (var _b = __values(this._nodeList), _c = _b.next(); !_c.done; _c = _b.next()) { - var node = _c.value; - infra_1.list.remove((node)._registeredObserverList, function (ob) { - return ob.observer === _this; - }); - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_3) throw e_3.error; } + // MIXIN: NonElementParentNode + /* istanbul ignore next */ + DocumentImpl.prototype.getElementById = function (elementId) { throw new Error("Mixin: NonElementParentNode not implemented."); }; + Object.defineProperty(DocumentImpl.prototype, "children", { + // MIXIN: DocumentOrShadowRoot + // No elements + // MIXIN: ParentNode + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "firstElementChild", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "lastElementChild", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "childElementCount", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + /* istanbul ignore next */ + DocumentImpl.prototype.prepend = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; } - /** - * 2. Empty the context object’s record queue. - */ - this._recordQueue = []; + throw new Error("Mixin: ParentNode not implemented."); }; - /** @inheritdoc */ - MutationObserverImpl.prototype.takeRecords = function () { - /** - * 1. Let records be a clone of the context object’s record queue. - * 2. Empty the context object’s record queue. - * 3. Return records. - */ - var records = this._recordQueue; - this._recordQueue = []; - return records; + /* istanbul ignore next */ + DocumentImpl.prototype.append = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ParentNode not implemented."); }; - return MutationObserverImpl; -}()); -exports.MutationObserverImpl = MutationObserverImpl; -//# sourceMappingURL=MutationObserverImpl.js.map + /* istanbul ignore next */ + DocumentImpl.prototype.querySelector = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + /* istanbul ignore next */ + DocumentImpl.prototype.querySelectorAll = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + return DocumentImpl; +}(NodeImpl_1.NodeImpl)); +exports.DocumentImpl = DocumentImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(DocumentImpl.prototype, "_nodeType", interfaces_1.NodeType.Document); +//# sourceMappingURL=DocumentImpl.js.map /***/ }), -/***/ 6219: +/***/ 65274: /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); /** - * Represents a mutation record. + * Represents a mixin for an interface to be used to share APIs between + * documents and shadow roots. This mixin is implemented by + * {@link Document} and {@link ShadowRoot}. + * + * _Note:_ The DocumentOrShadowRoot mixin is expected to be used by other + * standards that want to define APIs shared between documents and shadow roots. */ -var MutationRecordImpl = /** @class */ (function () { - /** - * Initializes a new instance of `MutationRecord`. - * - * @param type - type of mutation: `"attributes"` for an attribute - * mutation, `"characterData"` for a mutation to a CharacterData node - * and `"childList"` for a mutation to the tree of nodes. - * @param target - node affected by the mutation. - * @param addedNodes - list of added nodes. - * @param removedNodes - list of removed nodes. - * @param previousSibling - previous sibling of added or removed nodes. - * @param nextSibling - next sibling of added or removed nodes. - * @param attributeName - local name of the changed attribute, - * and `null` otherwise. - * @param attributeNamespace - namespace of the changed attribute, - * and `null` otherwise. - * @param oldValue - value before mutation: attribute value for an attribute - * mutation, node `data` for a mutation to a CharacterData node and `null` - * for a mutation to the tree of nodes. - */ - function MutationRecordImpl(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { - this._type = type; - this._target = target; - this._addedNodes = addedNodes; - this._removedNodes = removedNodes; - this._previousSibling = previousSibling; - this._nextSibling = nextSibling; - this._attributeName = attributeName; - this._attributeNamespace = attributeNamespace; - this._oldValue = oldValue; +var DocumentOrShadowRootImpl = /** @class */ (function () { + function DocumentOrShadowRootImpl() { } - Object.defineProperty(MutationRecordImpl.prototype, "type", { - /** @inheritdoc */ - get: function () { return this._type; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "target", { - /** @inheritdoc */ - get: function () { return this._target; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "addedNodes", { - /** @inheritdoc */ - get: function () { return this._addedNodes; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "removedNodes", { - /** @inheritdoc */ - get: function () { return this._removedNodes; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "previousSibling", { - /** @inheritdoc */ - get: function () { return this._previousSibling; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "nextSibling", { - /** @inheritdoc */ - get: function () { return this._nextSibling; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "attributeName", { - /** @inheritdoc */ - get: function () { return this._attributeName; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "attributeNamespace", { - /** @inheritdoc */ - get: function () { return this._attributeNamespace; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "oldValue", { - /** @inheritdoc */ - get: function () { return this._oldValue; }, - enumerable: true, - configurable: true - }); - /** - * Creates a new `MutationRecord`. - * - * @param type - type of mutation: `"attributes"` for an attribute - * mutation, `"characterData"` for a mutation to a CharacterData node - * and `"childList"` for a mutation to the tree of nodes. - * @param target - node affected by the mutation. - * @param addedNodes - list of added nodes. - * @param removedNodes - list of removed nodes. - * @param previousSibling - previous sibling of added or removed nodes. - * @param nextSibling - next sibling of added or removed nodes. - * @param attributeName - local name of the changed attribute, - * and `null` otherwise. - * @param attributeNamespace - namespace of the changed attribute, - * and `null` otherwise. - * @param oldValue - value before mutation: attribute value for an attribute - * mutation, node `data` for a mutation to a CharacterData node and `null` - * for a mutation to the tree of nodes. - */ - MutationRecordImpl._create = function (type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { - return new MutationRecordImpl(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue); - }; - return MutationRecordImpl; + return DocumentOrShadowRootImpl; }()); -exports.MutationRecordImpl = MutationRecordImpl; -//# sourceMappingURL=MutationRecordImpl.js.map +exports.DocumentOrShadowRootImpl = DocumentOrShadowRootImpl; +//# sourceMappingURL=DocumentOrShadowRootImpl.js.map /***/ }), -/***/ 7206: +/***/ 3173: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -60068,178 +59932,104 @@ var __extends = (this && this.__extends) || (function () { }; })(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMException_1 = __nccwpck_require__(3166); -var algorithm_1 = __nccwpck_require__(61); +var interfaces_1 = __nccwpck_require__(27305); +var NodeImpl_1 = __nccwpck_require__(91745); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** - * Represents a collection of attributes. + * Represents an object providing methods which are not dependent on + * any particular document */ -var NamedNodeMapImpl = /** @class */ (function (_super) { - __extends(NamedNodeMapImpl, _super); +var DocumentTypeImpl = /** @class */ (function (_super) { + __extends(DocumentTypeImpl, _super); /** - * Initializes a new instance of `NamedNodeMap`. + * Initializes a new instance of `DocumentType`. * - * @param element - parent element + * @param name - name of the node + * @param publicId - `PUBLIC` identifier + * @param systemId - `SYSTEM` identifier */ - function NamedNodeMapImpl(element) { + function DocumentTypeImpl(name, publicId, systemId) { var _this = _super.call(this) || this; - _this._element = element; - // TODO: This workaround is needed to extend Array in ES5 - Object.setPrototypeOf(_this, NamedNodeMapImpl.prototype); + _this._name = ''; + _this._publicId = ''; + _this._systemId = ''; + _this._name = name; + _this._publicId = publicId; + _this._systemId = systemId; return _this; } - NamedNodeMapImpl.prototype._asArray = function () { return this; }; - /** @inheritdoc */ - NamedNodeMapImpl.prototype.item = function (index) { - /** - * 1. If index is equal to or greater than context object’s attribute list’s - * size, then return null. - * 2. Otherwise, return context object’s attribute list[index]. - * - */ - return this[index] || null; - }; - /** @inheritdoc */ - NamedNodeMapImpl.prototype.getNamedItem = function (qualifiedName) { - /** - * The getNamedItem(qualifiedName) method, when invoked, must return the - * result of getting an attribute given qualifiedName and element. - */ - return algorithm_1.element_getAnAttributeByName(qualifiedName, this._element); - }; - /** @inheritdoc */ - NamedNodeMapImpl.prototype.getNamedItemNS = function (namespace, localName) { - /** - * The getNamedItemNS(namespace, localName) method, when invoked, must - * return the result of getting an attribute given namespace, localName, - * and element. - */ - return algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace || '', localName, this._element); - }; - /** @inheritdoc */ - NamedNodeMapImpl.prototype.setNamedItem = function (attr) { - /** - * The setNamedItem(attr) and setNamedItemNS(attr) methods, when invoked, - * must return the result of setting an attribute given attr and element. - */ - return algorithm_1.element_setAnAttribute(attr, this._element); - }; - /** @inheritdoc */ - NamedNodeMapImpl.prototype.setNamedItemNS = function (attr) { - return algorithm_1.element_setAnAttribute(attr, this._element); + Object.defineProperty(DocumentTypeImpl.prototype, "name", { + /** @inheritdoc */ + get: function () { return this._name; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentTypeImpl.prototype, "publicId", { + /** @inheritdoc */ + get: function () { return this._publicId; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentTypeImpl.prototype, "systemId", { + /** @inheritdoc */ + get: function () { return this._systemId; }, + enumerable: true, + configurable: true + }); + // MIXIN: ChildNode + /* istanbul ignore next */ + DocumentTypeImpl.prototype.before = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); }; - /** @inheritdoc */ - NamedNodeMapImpl.prototype.removeNamedItem = function (qualifiedName) { - /** - * 1. Let attr be the result of removing an attribute given qualifiedName - * and element. - * 2. If attr is null, then throw a "NotFoundError" DOMException. - * 3. Return attr. - */ - var attr = algorithm_1.element_removeAnAttributeByName(qualifiedName, this._element); - if (attr === null) - throw new DOMException_1.NotFoundError(); - return attr; + /* istanbul ignore next */ + DocumentTypeImpl.prototype.after = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); }; - /** @inheritdoc */ - NamedNodeMapImpl.prototype.removeNamedItemNS = function (namespace, localName) { - /** - * 1. Let attr be the result of removing an attribute given namespace, - * localName, and element. - * 2. If attr is null, then throw a "NotFoundError" DOMException. - * 3. Return attr. - */ - var attr = algorithm_1.element_removeAnAttributeByNamespaceAndLocalName(namespace || '', localName, this._element); - if (attr === null) - throw new DOMException_1.NotFoundError(); - return attr; + /* istanbul ignore next */ + DocumentTypeImpl.prototype.replaceWith = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); }; + /* istanbul ignore next */ + DocumentTypeImpl.prototype.remove = function () { throw new Error("Mixin: ChildNode not implemented."); }; /** - * Creates a new `NamedNodeMap`. + * Creates a new `DocumentType`. * - * @param element - parent element - */ - NamedNodeMapImpl._create = function (element) { - return new NamedNodeMapImpl(element); - }; - return NamedNodeMapImpl; -}(Array)); -exports.NamedNodeMapImpl = NamedNodeMapImpl; -//# sourceMappingURL=NamedNodeMapImpl.js.map - -/***/ }), - -/***/ 2355: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); -/** - * Represents a node filter. - */ -var NodeFilterImpl = /** @class */ (function () { - /** - * Initializes a new instance of `NodeFilter`. - */ - function NodeFilterImpl() { - } - /** - * Callback function. - */ - NodeFilterImpl.prototype.acceptNode = function (node) { - return interfaces_1.FilterResult.Accept; - }; - /** - * Creates a new `NodeFilter`. + * @param document - owner document + * @param name - name of the node + * @param publicId - `PUBLIC` identifier + * @param systemId - `SYSTEM` identifier */ - NodeFilterImpl._create = function () { - return new NodeFilterImpl(); + DocumentTypeImpl._create = function (document, name, publicId, systemId) { + if (publicId === void 0) { publicId = ''; } + if (systemId === void 0) { systemId = ''; } + var node = new DocumentTypeImpl(name, publicId, systemId); + node._nodeDocument = document; + return node; }; - NodeFilterImpl.FILTER_ACCEPT = 1; - NodeFilterImpl.FILTER_REJECT = 2; - NodeFilterImpl.FILTER_SKIP = 3; - NodeFilterImpl.SHOW_ALL = 0xffffffff; - NodeFilterImpl.SHOW_ELEMENT = 0x1; - NodeFilterImpl.SHOW_ATTRIBUTE = 0x2; - NodeFilterImpl.SHOW_TEXT = 0x4; - NodeFilterImpl.SHOW_CDATA_SECTION = 0x8; - NodeFilterImpl.SHOW_ENTITY_REFERENCE = 0x10; - NodeFilterImpl.SHOW_ENTITY = 0x20; - NodeFilterImpl.SHOW_PROCESSING_INSTRUCTION = 0x40; - NodeFilterImpl.SHOW_COMMENT = 0x80; - NodeFilterImpl.SHOW_DOCUMENT = 0x100; - NodeFilterImpl.SHOW_DOCUMENT_TYPE = 0x200; - NodeFilterImpl.SHOW_DOCUMENT_FRAGMENT = 0x400; - NodeFilterImpl.SHOW_NOTATION = 0x800; - return NodeFilterImpl; -}()); -exports.NodeFilterImpl = NodeFilterImpl; + return DocumentTypeImpl; +}(NodeImpl_1.NodeImpl)); +exports.DocumentTypeImpl = DocumentTypeImpl; /** - * Define constants on prototype. + * Initialize prototype properties */ -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "FILTER_ACCEPT", 1); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "FILTER_REJECT", 2); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "FILTER_SKIP", 3); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ALL", 0xffffffff); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ELEMENT", 0x1); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ATTRIBUTE", 0x2); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_TEXT", 0x4); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_CDATA_SECTION", 0x8); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ENTITY_REFERENCE", 0x10); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ENTITY", 0x20); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_PROCESSING_INSTRUCTION", 0x40); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_COMMENT", 0x80); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_DOCUMENT", 0x100); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_DOCUMENT_TYPE", 0x200); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_DOCUMENT_FRAGMENT", 0x400); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_NOTATION", 0x800); -//# sourceMappingURL=NodeFilterImpl.js.map +WebIDLAlgorithm_1.idl_defineConst(DocumentTypeImpl.prototype, "_nodeType", interfaces_1.NodeType.DocumentType); +//# sourceMappingURL=DocumentTypeImpl.js.map /***/ }), -/***/ 1745: +/***/ 35975: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -60268,1151 +60058,1296 @@ var __values = (this && this.__values) || function(o) { }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var interfaces_1 = __nccwpck_require__(7305); -var EventTargetImpl_1 = __nccwpck_require__(9968); -var util_1 = __nccwpck_require__(5282); -var DOMException_1 = __nccwpck_require__(3166); +var interfaces_1 = __nccwpck_require__(27305); +var NodeImpl_1 = __nccwpck_require__(91745); +var DOMException_1 = __nccwpck_require__(13166); +var infra_1 = __nccwpck_require__(84251); var algorithm_1 = __nccwpck_require__(61); -var URLAlgorithm_1 = __nccwpck_require__(3568); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** - * Represents a generic XML node. + * Represents an element node. */ -var NodeImpl = /** @class */ (function (_super) { - __extends(NodeImpl, _super); +var ElementImpl = /** @class */ (function (_super) { + __extends(ElementImpl, _super); /** - * Initializes a new instance of `Node`. + * Initializes a new instance of `Element`. */ - function NodeImpl() { + function ElementImpl() { var _this = _super.call(this) || this; - _this._parent = null; - _this._firstChild = null; - _this._lastChild = null; - _this._previousSibling = null; - _this._nextSibling = null; + _this._children = new Set(); + _this._namespace = null; + _this._namespacePrefix = null; + _this._localName = ""; + _this._customElementState = "undefined"; + _this._customElementDefinition = null; + _this._is = null; + _this._shadowRoot = null; + _this._attributeList = algorithm_1.create_namedNodeMap(_this); + _this._attributeChangeSteps = []; + _this._name = ''; + _this._assignedSlot = null; return _this; } - Object.defineProperty(NodeImpl.prototype, "_childNodes", { - get: function () { - return this.__childNodes || (this.__childNodes = algorithm_1.create_nodeList(this)); - }, + Object.defineProperty(ElementImpl.prototype, "namespaceURI", { + /** @inheritdoc */ + get: function () { return this._namespace; }, enumerable: true, configurable: true }); - Object.defineProperty(NodeImpl.prototype, "_nodeDocument", { - get: function () { return this._nodeDocumentOverride || DOMImpl_1.dom.window._associatedDocument; }, - set: function (val) { this._nodeDocumentOverride = val; }, + Object.defineProperty(ElementImpl.prototype, "prefix", { + /** @inheritdoc */ + get: function () { return this._namespacePrefix; }, enumerable: true, configurable: true }); - Object.defineProperty(NodeImpl.prototype, "_registeredObserverList", { - get: function () { - return this.__registeredObserverList || (this.__registeredObserverList = []); - }, + Object.defineProperty(ElementImpl.prototype, "localName", { + /** @inheritdoc */ + get: function () { return this._localName; }, enumerable: true, configurable: true }); - Object.defineProperty(NodeImpl.prototype, "nodeType", { + Object.defineProperty(ElementImpl.prototype, "tagName", { /** @inheritdoc */ - get: function () { return this._nodeType; }, + get: function () { return this._htmlUppercasedQualifiedName; }, enumerable: true, configurable: true }); - Object.defineProperty(NodeImpl.prototype, "nodeName", { - /** - * Returns a string appropriate for the type of node. - */ + Object.defineProperty(ElementImpl.prototype, "id", { + /** @inheritdoc */ get: function () { - if (util_1.Guard.isElementNode(this)) { - return this._htmlUppercasedQualifiedName; - } - else if (util_1.Guard.isAttrNode(this)) { - return this._qualifiedName; - } - else if (util_1.Guard.isExclusiveTextNode(this)) { - return "#text"; - } - else if (util_1.Guard.isCDATASectionNode(this)) { - return "#cdata-section"; - } - else if (util_1.Guard.isProcessingInstructionNode(this)) { - return this._target; - } - else if (util_1.Guard.isCommentNode(this)) { - return "#comment"; - } - else if (util_1.Guard.isDocumentNode(this)) { - return "#document"; - } - else if (util_1.Guard.isDocumentTypeNode(this)) { - return this._name; - } - else if (util_1.Guard.isDocumentFragmentNode(this)) { - return "#document-fragment"; - } - else { - return ""; - } + return algorithm_1.element_getAnAttributeValue(this, "id"); + }, + set: function (value) { + algorithm_1.element_setAnAttributeValue(this, "id", value); }, enumerable: true, configurable: true }); - Object.defineProperty(NodeImpl.prototype, "baseURI", { - /** - * Gets the absolute base URL of the node. - */ + Object.defineProperty(ElementImpl.prototype, "className", { + /** @inheritdoc */ get: function () { - /** - * The baseURI attribute’s getter must return node document’s document - * base URL, serialized. - * TODO: Implement in HTML DOM - * https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url - */ - return URLAlgorithm_1.urlSerializer(this._nodeDocument._URL); + return algorithm_1.element_getAnAttributeValue(this, "class"); + }, + set: function (value) { + algorithm_1.element_setAnAttributeValue(this, "class", value); }, enumerable: true, configurable: true }); - Object.defineProperty(NodeImpl.prototype, "isConnected", { - /** - * Returns whether the node is rooted to a document node. - */ + Object.defineProperty(ElementImpl.prototype, "classList", { + /** @inheritdoc */ get: function () { - /** - * The isConnected attribute’s getter must return true, if context object - * is connected, and false otherwise. - */ - return util_1.Guard.isElementNode(this) && algorithm_1.shadowTree_isConnected(this); + var attr = algorithm_1.element_getAnAttributeByName("class", this); + if (attr === null) { + attr = algorithm_1.create_attr(this._nodeDocument, "class"); + } + return algorithm_1.create_domTokenList(this, attr); }, enumerable: true, configurable: true }); - Object.defineProperty(NodeImpl.prototype, "ownerDocument", { - /** - * Returns the parent document. - */ + Object.defineProperty(ElementImpl.prototype, "slot", { + /** @inheritdoc */ get: function () { - /** - * The ownerDocument attribute’s getter must return null, if the context - * object is a document, and the context object’s node document otherwise. - * _Note:_ The node document of a document is that document itself. All - * nodes have a node document at all times. - */ - if (this._nodeType === interfaces_1.NodeType.Document) - return null; - else - return this._nodeDocument; + return algorithm_1.element_getAnAttributeValue(this, "slot"); + }, + set: function (value) { + algorithm_1.element_setAnAttributeValue(this, "slot", value); }, enumerable: true, configurable: true }); - /** - * Returns the root node. - * - * @param options - if options has `composed = true` this function - * returns the node's shadow-including root, otherwise it returns - * the node's root node. - */ - NodeImpl.prototype.getRootNode = function (options) { - /** - * The getRootNode(options) method, when invoked, must return context - * object’s shadow-including root if options’s composed is true, - * and context object’s root otherwise. - */ - return algorithm_1.tree_rootNode(this, !!options && options.composed); + /** @inheritdoc */ + ElementImpl.prototype.hasAttributes = function () { + return this._attributeList.length !== 0; }; - Object.defineProperty(NodeImpl.prototype, "parentNode", { - /** - * Returns the parent node. - */ - get: function () { - /** - * The parentNode attribute’s getter must return the context object’s parent. - * _Note:_ An Attr node has no parent. - */ - if (this._nodeType === interfaces_1.NodeType.Attribute) { - return null; - } - else { - return this._parent; - } - }, + Object.defineProperty(ElementImpl.prototype, "attributes", { + /** @inheritdoc */ + get: function () { return this._attributeList; }, enumerable: true, configurable: true }); - Object.defineProperty(NodeImpl.prototype, "parentElement", { + /** @inheritdoc */ + ElementImpl.prototype.getAttributeNames = function () { + var e_1, _a; /** - * Returns the parent element. + * The getAttributeNames() method, when invoked, must return the qualified + * names of the attributes in context object’s attribute list, in order, + * and a new list otherwise. */ - get: function () { - /** - * The parentElement attribute’s getter must return the context object’s - * parent element. - */ - if (this._parent && util_1.Guard.isElementNode(this._parent)) { - return this._parent; + var names = []; + try { + for (var _b = __values(this._attributeList), _c = _b.next(); !_c.done; _c = _b.next()) { + var attr = _c.value; + names.push(attr._qualifiedName); } - else { - return null; + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } - }, - enumerable: true, - configurable: true - }); - /** - * Determines whether a node has any children. - */ - NodeImpl.prototype.hasChildNodes = function () { - /** - * The hasChildNodes() method, when invoked, must return true if the context - * object has children, and false otherwise. - */ - return (this._firstChild !== null); + finally { if (e_1) throw e_1.error; } + } + return names; }; - Object.defineProperty(NodeImpl.prototype, "childNodes", { + /** @inheritdoc */ + ElementImpl.prototype.getAttribute = function (qualifiedName) { /** - * Returns a {@link NodeList} of child nodes. + * 1. Let attr be the result of getting an attribute given qualifiedName + * and the context object. + * 2. If attr is null, return null. + * 3. Return attr’s value. */ - get: function () { - /** - * The childNodes attribute’s getter must return a NodeList rooted at the - * context object matching only children. - */ - return this._childNodes; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "firstChild", { + var attr = algorithm_1.element_getAnAttributeByName(qualifiedName, this); + return (attr ? attr._value : null); + }; + /** @inheritdoc */ + ElementImpl.prototype.getAttributeNS = function (namespace, localName) { /** - * Returns the first child node. + * 1. Let attr be the result of getting an attribute given namespace, + * localName, and the context object. + * 2. If attr is null, return null. + * 3. Return attr’s value. */ - get: function () { - /** - * The firstChild attribute’s getter must return the context object’s first - * child. - */ - return this._firstChild; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "lastChild", { + var attr = algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace, localName, this); + return (attr ? attr._value : null); + }; + /** @inheritdoc */ + ElementImpl.prototype.setAttribute = function (qualifiedName, value) { /** - * Returns the last child node. + * 1. If qualifiedName does not match the Name production in XML, then + * throw an "InvalidCharacterError" DOMException. */ - get: function () { - /** - * The lastChild attribute’s getter must return the context object’s last - * child. - */ - return this._lastChild; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "previousSibling", { + if (!algorithm_1.xml_isName(qualifiedName)) + throw new DOMException_1.InvalidCharacterError(); /** - * Returns the previous sibling node. + * 2. If the context object is in the HTML namespace and its node document + * is an HTML document, then set qualifiedName to qualifiedName in ASCII + * lowercase. */ - get: function () { - /** - * The previousSibling attribute’s getter must return the context object’s - * previous sibling. - * _Note:_ An Attr node has no siblings. - */ - return this._previousSibling; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "nextSibling", { + if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { + qualifiedName = qualifiedName.toLowerCase(); + } /** - * Returns the next sibling node. + * 3. Let attribute be the first attribute in context object’s attribute + * list whose qualified name is qualifiedName, and null otherwise. */ - get: function () { - /** - * The nextSibling attribute’s getter must return the context object’s - * next sibling. - */ - return this._nextSibling; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "nodeValue", { + var attribute = null; + for (var i = 0; i < this._attributeList.length; i++) { + var attr = this._attributeList[i]; + if (attr._qualifiedName === qualifiedName) { + attribute = attr; + break; + } + } /** - * Gets or sets the data associated with a {@link CharacterData} node or the - * value of an {@link @Attr} node. For other node types returns `null`. + * 4. If attribute is null, create an attribute whose local name is + * qualifiedName, value is value, and node document is context object’s + * node document, then append this attribute to context object, and + * then return. */ - get: function () { - if (util_1.Guard.isAttrNode(this)) { - return this._value; - } - else if (util_1.Guard.isCharacterDataNode(this)) { - return this._data; - } - else { - return null; - } - }, - set: function (value) { - if (value === null) { - value = ''; - } - if (util_1.Guard.isAttrNode(this)) { - algorithm_1.attr_setAnExistingAttributeValue(this, value); - } - else if (util_1.Guard.isCharacterDataNode(this)) { - algorithm_1.characterData_replaceData(this, 0, this._data.length, value); - } - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "textContent", { + if (attribute === null) { + attribute = algorithm_1.create_attr(this._nodeDocument, qualifiedName); + attribute._value = value; + algorithm_1.element_append(attribute, this); + return; + } /** - * Returns the concatenation of data of all the {@link Text} - * node descendants in tree order. When set, replaces the text - * contents of the node with the given value. + * 5. Change attribute from context object to value. */ - get: function () { - if (util_1.Guard.isDocumentFragmentNode(this) || util_1.Guard.isElementNode(this)) { - return algorithm_1.text_descendantTextContent(this); - } - else if (util_1.Guard.isAttrNode(this)) { - return this._value; - } - else if (util_1.Guard.isCharacterDataNode(this)) { - return this._data; - } - else { - return null; - } - }, - set: function (value) { - if (value === null) { - value = ''; - } - if (util_1.Guard.isDocumentFragmentNode(this) || util_1.Guard.isElementNode(this)) { - algorithm_1.node_stringReplaceAll(value, this); - } - else if (util_1.Guard.isAttrNode(this)) { - algorithm_1.attr_setAnExistingAttributeValue(this, value); - } - else if (util_1.Guard.isCharacterDataNode(this)) { - algorithm_1.characterData_replaceData(this, 0, algorithm_1.tree_nodeLength(this), value); - } - }, - enumerable: true, - configurable: true - }); - /** - * Puts all {@link Text} nodes in the full depth of the sub-tree - * underneath this node into a "normal" form where only markup - * (e.g., tags, comments, processing instructions, CDATA sections, - * and entity references) separates {@link Text} nodes, i.e., there - * are no adjacent Text nodes. - */ - NodeImpl.prototype.normalize = function () { - var e_1, _a, e_2, _b; + algorithm_1.element_change(attribute, this, value); + }; + /** @inheritdoc */ + ElementImpl.prototype.setAttributeNS = function (namespace, qualifiedName, value) { /** - * The normalize() method, when invoked, must run these steps for each - * descendant exclusive Text node node of context object: + * 1. Let namespace, prefix, and localName be the result of passing + * namespace and qualifiedName to validate and extract. + * 2. Set an attribute value for the context object using localName, value, + * and also prefix and namespace. */ - var descendantNodes = []; - var node = algorithm_1.tree_getFirstDescendantNode(this, false, false, function (e) { return util_1.Guard.isExclusiveTextNode(e); }); - while (node !== null) { - descendantNodes.push(node); - node = algorithm_1.tree_getNextDescendantNode(this, node, false, false, function (e) { return util_1.Guard.isExclusiveTextNode(e); }); - } - for (var i = 0; i < descendantNodes.length; i++) { - var node_1 = descendantNodes[i]; - if (node_1._parent === null) - continue; - /** - * 1. Let length be node’s length. - * 2. If length is zero, then remove node and continue with the next - * exclusive Text node, if any. - */ - var length = algorithm_1.tree_nodeLength(node_1); - if (length === 0) { - algorithm_1.mutation_remove(node_1, node_1._parent); - continue; - } - /** - * 3. Let data be the concatenation of the data of node’s contiguous - * exclusive Text nodes (excluding itself), in tree order. - */ - var textSiblings = []; - var data = ''; - try { - for (var _c = (e_1 = void 0, __values(algorithm_1.text_contiguousExclusiveTextNodes(node_1))), _d = _c.next(); !_d.done; _d = _c.next()) { - var sibling = _d.value; - textSiblings.push(sibling); - data += sibling._data; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); - } - finally { if (e_1) throw e_1.error; } - } - /** - * 4. Replace data with node node, offset length, count 0, and data data. - */ - algorithm_1.characterData_replaceData(node_1, length, 0, data); - /** - * 5. Let currentNode be node’s next sibling. - * 6. While currentNode is an exclusive Text node: - */ - if (DOMImpl_1.dom.rangeList.size !== 0) { - var currentNode = node_1._nextSibling; - while (currentNode !== null && util_1.Guard.isExclusiveTextNode(currentNode)) { - /** - * 6.1. For each live range whose start node is currentNode, add length - * to its start offset and set its start node to node. - * 6.2. For each live range whose end node is currentNode, add length to - * its end offset and set its end node to node. - * 6.3. For each live range whose start node is currentNode’s parent and - * start offset is currentNode’s index, set its start node to node and - * its start offset to length. - * 6.4. For each live range whose end node is currentNode’s parent and - * end offset is currentNode’s index, set its end node to node and its - * end offset to length. - */ - var cn = currentNode; - var index = algorithm_1.tree_index(cn); - try { - for (var _e = (e_2 = void 0, __values(DOMImpl_1.dom.rangeList)), _f = _e.next(); !_f.done; _f = _e.next()) { - var range = _f.value; - if (range._start[0] === cn) { - range._start[0] = node_1; - range._start[1] += length; - } - if (range._end[0] === cn) { - range._end[0] = node_1; - range._end[1] += length; - } - if (range._start[0] === cn._parent && range._start[1] === index) { - range._start[0] = node_1; - range._start[1] = length; - } - if (range._end[0] === cn._parent && range._end[1] === index) { - range._end[0] = node_1; - range._end[1] = length; - } - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_f && !_f.done && (_b = _e.return)) _b.call(_e); - } - finally { if (e_2) throw e_2.error; } - } - /** - * 6.5. Add currentNode’s length to length. - * 6.6. Set currentNode to its next sibling. - */ - length += algorithm_1.tree_nodeLength(currentNode); - currentNode = currentNode._nextSibling; - } - } - /** - * 7. Remove node’s contiguous exclusive Text nodes (excluding itself), - * in tree order. - */ - for (var i_1 = 0; i_1 < textSiblings.length; i_1++) { - var sibling = textSiblings[i_1]; - if (sibling._parent === null) - continue; - algorithm_1.mutation_remove(sibling, sibling._parent); - } - } + var _a = __read(algorithm_1.namespace_validateAndExtract(namespace, qualifiedName), 3), ns = _a[0], prefix = _a[1], localName = _a[2]; + algorithm_1.element_setAnAttributeValue(this, localName, value, prefix, ns); }; - /** - * Returns a duplicate of this node, i.e., serves as a generic copy - * constructor for nodes. The duplicate node has no parent - * ({@link parentNode} returns `null`). - * - * @param deep - if `true`, recursively clone the subtree under the - * specified node. If `false`, clone only the node itself (and its - * attributes, if it is an {@link Element}). - */ - NodeImpl.prototype.cloneNode = function (deep) { - if (deep === void 0) { deep = false; } + /** @inheritdoc */ + ElementImpl.prototype.removeAttribute = function (qualifiedName) { /** - * 1. If context object is a shadow root, then throw a "NotSupportedError" - * DOMException. - * 2. Return a clone of the context object, with the clone children flag set - * if deep is true. + * The removeAttribute(qualifiedName) method, when invoked, must remove an + * attribute given qualifiedName and the context object, and then return + * undefined. */ - if (util_1.Guard.isShadowRoot(this)) - throw new DOMException_1.NotSupportedError(); - return algorithm_1.node_clone(this, null, deep); + algorithm_1.element_removeAnAttributeByName(qualifiedName, this); }; - /** - * Determines if the given node is equal to this one. - * - * @param node - the node to compare with - */ - NodeImpl.prototype.isEqualNode = function (node) { - if (node === void 0) { node = null; } + /** @inheritdoc */ + ElementImpl.prototype.removeAttributeNS = function (namespace, localName) { /** - * The isEqualNode(otherNode) method, when invoked, must return true if - * otherNode is non-null and context object equals otherNode, and false - * otherwise. + * The removeAttributeNS(namespace, localName) method, when invoked, must + * remove an attribute given namespace, localName, and context object, and + * then return undefined. */ - return (node !== null && algorithm_1.node_equals(this, node)); + algorithm_1.element_removeAnAttributeByNamespaceAndLocalName(namespace, localName, this); }; - /** - * Determines if the given node is reference equal to this one. - * - * @param node - the node to compare with - */ - NodeImpl.prototype.isSameNode = function (node) { - if (node === void 0) { node = null; } + /** @inheritdoc */ + ElementImpl.prototype.hasAttribute = function (qualifiedName) { /** - * The isSameNode(otherNode) method, when invoked, must return true if - * otherNode is context object, and false otherwise. + * 1. If the context object is in the HTML namespace and its node document + * is an HTML document, then set qualifiedName to qualifiedName in ASCII + * lowercase. + * 2. Return true if the context object has an attribute whose qualified + * name is qualifiedName, and false otherwise. */ - return (this === node); + if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { + qualifiedName = qualifiedName.toLowerCase(); + } + for (var i = 0; i < this._attributeList.length; i++) { + var attr = this._attributeList[i]; + if (attr._qualifiedName === qualifiedName) { + return true; + } + } + return false; }; - /** - * Returns a bitmask indicating the position of the given `node` - * relative to this node. - */ - NodeImpl.prototype.compareDocumentPosition = function (other) { + /** @inheritdoc */ + ElementImpl.prototype.toggleAttribute = function (qualifiedName, force) { /** - * 1. If context object is other, then return zero. - * 2. Let node1 be other and node2 be context object. - * 3. Let attr1 and attr2 be null. - * attr1’s element. + * 1. If qualifiedName does not match the Name production in XML, then + * throw an "InvalidCharacterError" DOMException. */ - if (other === this) - return 0; - var node1 = other; - var node2 = this; - var attr1 = null; - var attr2 = null; + if (!algorithm_1.xml_isName(qualifiedName)) + throw new DOMException_1.InvalidCharacterError(); /** - * 4. If node1 is an attribute, then set attr1 to node1 and node1 to - * attr1’s element. + * 2. If the context object is in the HTML namespace and its node document + * is an HTML document, then set qualifiedName to qualifiedName in ASCII + * lowercase. */ - if (util_1.Guard.isAttrNode(node1)) { - attr1 = node1; - node1 = attr1._element; + if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { + qualifiedName = qualifiedName.toLowerCase(); } /** - * 5. If node2 is an attribute, then: + * 3. Let attribute be the first attribute in the context object’s attribute + * list whose qualified name is qualifiedName, and null otherwise. */ - if (util_1.Guard.isAttrNode(node2)) { - /** - * 5.1. Set attr2 to node2 and node2 to attr2’s element. - */ - attr2 = node2; - node2 = attr2._element; + var attribute = null; + for (var i = 0; i < this._attributeList.length; i++) { + var attr = this._attributeList[i]; + if (attr._qualifiedName === qualifiedName) { + attribute = attr; + break; + } + } + if (attribute === null) { /** - * 5.2. If attr1 and node1 are non-null, and node2 is node1, then: + * 4. If attribute is null, then: + * 4.1. If force is not given or is true, create an attribute whose local + * name is qualifiedName, value is the empty string, and node document is + * the context object’s node document, then append this attribute to the + * context object, and then return true. + * 4.2. Return false. */ - if (attr1 && node1 && (node1 === node2)) { - /** - * 5.2. For each attr in node2’s attribute list: - */ - for (var i = 0; i < node2._attributeList.length; i++) { - var attr = node2._attributeList[i]; - /** - * 5.2.1. If attr equals attr1, then return the result of adding - * DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and - * DOCUMENT_POSITION_PRECEDING. - * 5.2.2. If attr equals attr2, then return the result of adding - * DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and - * DOCUMENT_POSITION_FOLLOWING. - */ - if (algorithm_1.node_equals(attr, attr1)) { - return interfaces_1.Position.ImplementationSpecific | interfaces_1.Position.Preceding; - } - else if (algorithm_1.node_equals(attr, attr2)) { - return interfaces_1.Position.ImplementationSpecific | interfaces_1.Position.Following; - } - } + if (force === undefined || force === true) { + attribute = algorithm_1.create_attr(this._nodeDocument, qualifiedName); + attribute._value = ''; + algorithm_1.element_append(attribute, this); + return true; } + return false; } - /** - * 6. If node1 or node2 is null, or node1’s root is not node2’s root, then - * return the result of adding DOCUMENT_POSITION_DISCONNECTED, - * DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, and either - * DOCUMENT_POSITION_PRECEDING or DOCUMENT_POSITION_FOLLOWING, - * with the constraint that this is to be consistent, together. - */ - if (node1 === null || node2 === null || - algorithm_1.tree_rootNode(node1) !== algorithm_1.tree_rootNode(node2)) { - // nodes are disconnected - // return a random result but cache the value for consistency - return interfaces_1.Position.Disconnected | interfaces_1.Position.ImplementationSpecific | - (DOMImpl_1.dom.compareCache.check(this, other) ? interfaces_1.Position.Preceding : interfaces_1.Position.Following); + else if (force === undefined || force === false) { + /** + * 5. Otherwise, if force is not given or is false, remove an attribute + * given qualifiedName and the context object, and then return false. + */ + algorithm_1.element_removeAnAttributeByName(qualifiedName, this); + return false; } /** - * 7. If node1 is an ancestor of node2 and attr1 is null, or node1 is node2 - * and attr2 is non-null, then return the result of adding - * DOCUMENT_POSITION_CONTAINS to DOCUMENT_POSITION_PRECEDING. + * 6. Return true. */ - if ((!attr1 && algorithm_1.tree_isAncestorOf(node2, node1)) || - (attr2 && (node1 === node2))) { - return interfaces_1.Position.Contains | interfaces_1.Position.Preceding; - } + return true; + }; + /** @inheritdoc */ + ElementImpl.prototype.hasAttributeNS = function (namespace, localName) { /** - * 8. If node1 is a descendant of node2 and attr2 is null, or node1 is node2 - * and attr1 is non-null, then return the result of adding - * DOCUMENT_POSITION_CONTAINED_BY to DOCUMENT_POSITION_FOLLOWING. + * 1. If namespace is the empty string, set it to null. + * 2. Return true if the context object has an attribute whose namespace is + * namespace and local name is localName, and false otherwise. */ - if ((!attr2 && algorithm_1.tree_isDescendantOf(node2, node1)) || - (attr1 && (node1 === node2))) { - return interfaces_1.Position.ContainedBy | interfaces_1.Position.Following; + var ns = namespace || null; + for (var i = 0; i < this._attributeList.length; i++) { + var attr = this._attributeList[i]; + if (attr._namespace === ns && attr._localName === localName) { + return true; + } } + return false; + }; + /** @inheritdoc */ + ElementImpl.prototype.getAttributeNode = function (qualifiedName) { /** - * 9. If node1 is preceding node2, then return DOCUMENT_POSITION_PRECEDING. + * The getAttributeNode(qualifiedName) method, when invoked, must return the + * result of getting an attribute given qualifiedName and context object. */ - if (algorithm_1.tree_isPreceding(node2, node1)) - return interfaces_1.Position.Preceding; + return algorithm_1.element_getAnAttributeByName(qualifiedName, this); + }; + /** @inheritdoc */ + ElementImpl.prototype.getAttributeNodeNS = function (namespace, localName) { /** - * 10. Return DOCUMENT_POSITION_FOLLOWING. + * The getAttributeNodeNS(namespace, localName) method, when invoked, must + * return the result of getting an attribute given namespace, localName, and + * the context object. */ - return interfaces_1.Position.Following; + return algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace, localName, this); }; - /** - * Returns `true` if given node is an inclusive descendant of this - * node, and `false` otherwise (including when other node is `null`). - * - * @param other - the node to check - */ - NodeImpl.prototype.contains = function (other) { + /** @inheritdoc */ + ElementImpl.prototype.setAttributeNode = function (attr) { /** - * The contains(other) method, when invoked, must return true if other is an - * inclusive descendant of context object, and false otherwise (including - * when other is null). + * The setAttributeNode(attr) and setAttributeNodeNS(attr) methods, when + * invoked, must return the result of setting an attribute given attr and + * the context object. */ - if (other === null) - return false; - return algorithm_1.tree_isDescendantOf(this, other, true); + return algorithm_1.element_setAnAttribute(attr, this); }; - /** - * Returns the prefix for a given namespace URI, if present, and - * `null` if not. - * - * @param namespace - the namespace to search - */ - NodeImpl.prototype.lookupPrefix = function (namespace) { + /** @inheritdoc */ + ElementImpl.prototype.setAttributeNodeNS = function (attr) { + return algorithm_1.element_setAnAttribute(attr, this); + }; + /** @inheritdoc */ + ElementImpl.prototype.removeAttributeNode = function (attr) { /** - * 1. If namespace is null or the empty string, then return null. - * 2. Switch on the context object: + * 1. If context object’s attribute list does not contain attr, then throw + * a "NotFoundError" DOMException. + * 2. Remove attr from context object. + * 3. Return attr. */ - if (!namespace) - return null; - if (util_1.Guard.isElementNode(this)) { - /** - * Return the result of locating a namespace prefix for it using - * namespace. - */ - return algorithm_1.node_locateANamespacePrefix(this, namespace); - } - else if (util_1.Guard.isDocumentNode(this)) { - /** - * Return the result of locating a namespace prefix for its document - * element, if its document element is non-null, and null otherwise. - */ - if (this.documentElement === null) { - return null; - } - else { - return algorithm_1.node_locateANamespacePrefix(this.documentElement, namespace); + var found = false; + for (var i = 0; i < this._attributeList.length; i++) { + var attribute = this._attributeList[i]; + if (attribute === attr) { + found = true; + break; } } - else if (util_1.Guard.isDocumentTypeNode(this) || util_1.Guard.isDocumentFragmentNode(this)) { - return null; - } - else if (util_1.Guard.isAttrNode(this)) { - /** - * Return the result of locating a namespace prefix for its element, - * if its element is non-null, and null otherwise. - */ - if (this._element === null) { - return null; - } - else { - return algorithm_1.node_locateANamespacePrefix(this._element, namespace); + if (!found) + throw new DOMException_1.NotFoundError(); + algorithm_1.element_remove(attr, this); + return attr; + }; + /** @inheritdoc */ + ElementImpl.prototype.attachShadow = function (init) { + /** + * 1. If context object’s namespace is not the HTML namespace, then throw a + * "NotSupportedError" DOMException. + */ + if (this._namespace !== infra_1.namespace.HTML) + throw new DOMException_1.NotSupportedError(); + /** + * 2. If context object’s local name is not a valid custom element name, + * "article", "aside", "blockquote", "body", "div", "footer", "h1", "h2", + * "h3", "h4", "h5", "h6", "header", "main" "nav", "p", "section", + * or "span", then throw a "NotSupportedError" DOMException. + */ + if (!algorithm_1.customElement_isValidCustomElementName(this._localName) && + !algorithm_1.customElement_isValidShadowHostName(this._localName)) + throw new DOMException_1.NotSupportedError(); + /** + * 3. If context object’s local name is a valid custom element name, + * or context object’s is value is not null, then: + * 3.1. Let definition be the result of looking up a custom element + * definition given context object’s node document, its namespace, its + * local name, and its is value. + * 3.2. If definition is not null and definition’s disable shadow is true, + * then throw a "NotSupportedError" DOMException. + */ + if (algorithm_1.customElement_isValidCustomElementName(this._localName) || this._is !== null) { + var definition = algorithm_1.customElement_lookUpACustomElementDefinition(this._nodeDocument, this._namespace, this._localName, this._is); + if (definition !== null && definition.disableShadow === true) { + throw new DOMException_1.NotSupportedError(); } } - else { + /** + * 4. If context object is a shadow host, then throw an "NotSupportedError" + * DOMException. + */ + if (this._shadowRoot !== null) + throw new DOMException_1.NotSupportedError(); + /** + * 5. Let shadow be a new shadow root whose node document is context + * object’s node document, host is context object, and mode is init’s mode. + * 6. Set context object’s shadow root to shadow. + * 7. Return shadow. + */ + var shadow = algorithm_1.create_shadowRoot(this._nodeDocument, this); + shadow._mode = init.mode; + this._shadowRoot = shadow; + return shadow; + }; + Object.defineProperty(ElementImpl.prototype, "shadowRoot", { + /** @inheritdoc */ + get: function () { /** - * Return the result of locating a namespace prefix for its parent - * element, if its parent element is non-null, and null otherwise. + * 1. Let shadow be context object’s shadow root. + * 2. If shadow is null or its mode is "closed", then return null. + * 3. Return shadow. */ - if (this._parent !== null && util_1.Guard.isElementNode(this._parent)) { - return algorithm_1.node_locateANamespacePrefix(this._parent, namespace); - } - else { + var shadow = this._shadowRoot; + if (shadow === null || shadow.mode === "closed") return null; - } - } + else + return shadow; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + ElementImpl.prototype.closest = function (selectors) { + /** + * TODO: Selectors + * 1. Let s be the result of parse a selector from selectors. [SELECTORS4] + * 2. If s is failure, throw a "SyntaxError" DOMException. + * 3. Let elements be context object’s inclusive ancestors that are + * elements, in reverse tree order. + * 4. For each element in elements, if match a selector against an element, + * using s, element, and :scope element context object, returns success, + * return element. [SELECTORS4] + * 5. Return null. + */ + throw new DOMException_1.NotImplementedError(); }; - /** - * Returns the namespace URI for a given prefix if present, and `null` - * if not. - * - * @param prefix - the prefix to search - */ - NodeImpl.prototype.lookupNamespaceURI = function (prefix) { + /** @inheritdoc */ + ElementImpl.prototype.matches = function (selectors) { /** - * 1. If prefix is the empty string, then set it to null. - * 2. Return the result of running locate a namespace for the context object - * using prefix. + * TODO: Selectors + * 1. Let s be the result of parse a selector from selectors. [SELECTORS4] + * 2. If s is failure, throw a "SyntaxError" DOMException. + * 3. Return true if the result of match a selector against an element, + * using s, element, and :scope element context object, returns success, + * and false otherwise. [SELECTORS4] */ - return algorithm_1.node_locateANamespace(this, prefix || null); + throw new DOMException_1.NotImplementedError(); }; - /** - * Returns `true` if the namespace is the default namespace on this - * node or `false` if not. - * - * @param namespace - the namespace to check - */ - NodeImpl.prototype.isDefaultNamespace = function (namespace) { + /** @inheritdoc */ + ElementImpl.prototype.webkitMatchesSelector = function (selectors) { + return this.matches(selectors); + }; + /** @inheritdoc */ + ElementImpl.prototype.getElementsByTagName = function (qualifiedName) { /** - * 1. If namespace is the empty string, then set it to null. - * 2. Let defaultNamespace be the result of running locate a namespace for - * context object using null. - * 3. Return true if defaultNamespace is the same as namespace, and false otherwise. + * The getElementsByTagName(qualifiedName) method, when invoked, must return + * the list of elements with qualified name qualifiedName for context + * object. */ - if (!namespace) - namespace = null; - var defaultNamespace = algorithm_1.node_locateANamespace(this, null); - return (defaultNamespace === namespace); + return algorithm_1.node_listOfElementsWithQualifiedName(qualifiedName, this); }; - /** - * Inserts the node `newChild` before the existing child node - * `refChild`. If `refChild` is `null`, inserts `newChild` at the end - * of the list of children. - * - * If `newChild` is a {@link DocumentFragment} object, all of its - * children are inserted, in the same order, before `refChild`. - * - * If `newChild` is already in the tree, it is first removed. - * - * @param newChild - the node to insert - * @param refChild - the node before which the new node must be - * inserted - * - * @returns the newly inserted child node - */ - NodeImpl.prototype.insertBefore = function (newChild, refChild) { + /** @inheritdoc */ + ElementImpl.prototype.getElementsByTagNameNS = function (namespace, localName) { /** - * The insertBefore(node, child) method, when invoked, must return the - * result of pre-inserting node into context object before child. + * The getElementsByTagNameNS(namespace, localName) method, when invoked, + * must return the list of elements with namespace namespace and local name + * localName for context object. */ - return algorithm_1.mutation_preInsert(newChild, this, refChild); + return algorithm_1.node_listOfElementsWithNamespace(namespace, localName, this); }; - /** - * Adds the node `newChild` to the end of the list of children of this - * node, and returns it. If `newChild` is already in the tree, it is - * first removed. - * - * If `newChild` is a {@link DocumentFragment} object, the entire - * contents of the document fragment are moved into the child list of - * this node. - * - * @param newChild - the node to add - * - * @returns the newly inserted child node - */ - NodeImpl.prototype.appendChild = function (newChild) { + /** @inheritdoc */ + ElementImpl.prototype.getElementsByClassName = function (classNames) { /** - * The appendChild(node) method, when invoked, must return the result of - * appending node to context object. + * The getElementsByClassName(classNames) method, when invoked, must return + * the list of elements with class names classNames for context object. */ - return algorithm_1.mutation_append(newChild, this); + return algorithm_1.node_listOfElementsWithClassNames(classNames, this); }; - /** - * Replaces the child node `oldChild` with `newChild` in the list of - * children, and returns the `oldChild` node. If `newChild` is already - * in the tree, it is first removed. - * - * @param newChild - the new node to put in the child list - * @param oldChild - the node being replaced in the list - * - * @returns the removed child node - */ - NodeImpl.prototype.replaceChild = function (newChild, oldChild) { + /** @inheritdoc */ + ElementImpl.prototype.insertAdjacentElement = function (where, element) { /** - * The replaceChild(node, child) method, when invoked, must return the - * result of replacing child with node within context object. + * The insertAdjacentElement(where, element) method, when invoked, must + * return the result of running insert adjacent, given context object, + * where, and element. */ - return algorithm_1.mutation_replace(oldChild, newChild, this); + return algorithm_1.element_insertAdjacent(this, where, element); }; - /** - * Removes the child node indicated by `oldChild` from the list of - * children, and returns it. - * - * @param oldChild - the node being removed from the list - * - * @returns the removed child node - */ - NodeImpl.prototype.removeChild = function (oldChild) { + /** @inheritdoc */ + ElementImpl.prototype.insertAdjacentText = function (where, data) { /** - * The removeChild(child) method, when invoked, must return the result of - * pre-removing child from context object. + * 1. Let text be a new Text node whose data is data and node document is + * context object’s node document. + * 2. Run insert adjacent, given context object, where, and text. */ - return algorithm_1.mutation_preRemove(oldChild, this); + var text = algorithm_1.create_text(this._nodeDocument, data); + algorithm_1.element_insertAdjacent(this, where, text); }; - /** - * Gets the parent event target for the given event. - * - * @param event - an event - */ - NodeImpl.prototype._getTheParent = function (event) { + Object.defineProperty(ElementImpl.prototype, "_qualifiedName", { /** - * A node’s get the parent algorithm, given an event, returns the node’s - * assigned slot, if node is assigned, and node’s parent otherwise. + * Returns the qualified name. */ - if (util_1.Guard.isSlotable(this) && algorithm_1.shadowTree_isAssigned(this)) { - return this._assignedSlot; + get: function () { + /** + * An element’s qualified name is its local name if its namespace prefix is + * null, and its namespace prefix, followed by ":", followed by its + * local name, otherwise. + */ + return (this._namespacePrefix ? + this._namespacePrefix + ':' + this._localName : + this._localName); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "_htmlUppercasedQualifiedName", { + /** + * Returns the upper-cased qualified name for a html element. + */ + get: function () { + /** + * 1. Let qualifiedName be context object’s qualified name. + * 2. If the context object is in the HTML namespace and its node document + * is an HTML document, then set qualifiedName to qualifiedName in ASCII + * uppercase. + * 3. Return qualifiedName. + */ + var qualifiedName = this._qualifiedName; + if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { + qualifiedName = qualifiedName.toUpperCase(); + } + return qualifiedName; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "children", { + // MIXIN: ParentNode + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "firstElementChild", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "lastElementChild", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "childElementCount", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + /* istanbul ignore next */ + ElementImpl.prototype.prepend = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; } - else { - return this._parent; + throw new Error("Mixin: ParentNode not implemented."); + }; + /* istanbul ignore next */ + ElementImpl.prototype.append = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; } + throw new Error("Mixin: ParentNode not implemented."); }; - NodeImpl.ELEMENT_NODE = 1; - NodeImpl.ATTRIBUTE_NODE = 2; - NodeImpl.TEXT_NODE = 3; - NodeImpl.CDATA_SECTION_NODE = 4; - NodeImpl.ENTITY_REFERENCE_NODE = 5; - NodeImpl.ENTITY_NODE = 6; - NodeImpl.PROCESSING_INSTRUCTION_NODE = 7; - NodeImpl.COMMENT_NODE = 8; - NodeImpl.DOCUMENT_NODE = 9; - NodeImpl.DOCUMENT_TYPE_NODE = 10; - NodeImpl.DOCUMENT_FRAGMENT_NODE = 11; - NodeImpl.NOTATION_NODE = 12; - NodeImpl.DOCUMENT_POSITION_DISCONNECTED = 0x01; - NodeImpl.DOCUMENT_POSITION_PRECEDING = 0x02; - NodeImpl.DOCUMENT_POSITION_FOLLOWING = 0x04; - NodeImpl.DOCUMENT_POSITION_CONTAINS = 0x08; - NodeImpl.DOCUMENT_POSITION_CONTAINED_BY = 0x10; - NodeImpl.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; - return NodeImpl; -}(EventTargetImpl_1.EventTargetImpl)); -exports.NodeImpl = NodeImpl; -/** - * A performance tweak to share an empty set between all node classes. This will - * be overwritten by element, document and document fragment nodes to supply an - * actual set of nodes. - */ -NodeImpl.prototype._children = new util_1.EmptySet(); + /* istanbul ignore next */ + ElementImpl.prototype.querySelector = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + /* istanbul ignore next */ + ElementImpl.prototype.querySelectorAll = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + Object.defineProperty(ElementImpl.prototype, "previousElementSibling", { + // MIXIN: NonDocumentTypeChildNode + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "nextElementSibling", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, + enumerable: true, + configurable: true + }); + // MIXIN: ChildNode + /* istanbul ignore next */ + ElementImpl.prototype.before = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); + }; + /* istanbul ignore next */ + ElementImpl.prototype.after = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); + }; + /* istanbul ignore next */ + ElementImpl.prototype.replaceWith = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); + }; + /* istanbul ignore next */ + ElementImpl.prototype.remove = function () { throw new Error("Mixin: ChildNode not implemented."); }; + Object.defineProperty(ElementImpl.prototype, "assignedSlot", { + // MIXIN: Slotable + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: Slotable not implemented."); }, + enumerable: true, + configurable: true + }); + /** + * Creates a new `Element`. + * + * @param document - owner document + * @param localName - local name + * @param namespace - namespace + * @param prefix - namespace prefix + */ + ElementImpl._create = function (document, localName, namespace, namespacePrefix) { + if (namespace === void 0) { namespace = null; } + if (namespacePrefix === void 0) { namespacePrefix = null; } + var node = new ElementImpl(); + node._localName = localName; + node._namespace = namespace; + node._namespacePrefix = namespacePrefix; + node._nodeDocument = document; + return node; + }; + return ElementImpl; +}(NodeImpl_1.NodeImpl)); +exports.ElementImpl = ElementImpl; /** - * Define constants on prototype. + * Initialize prototype properties */ -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ELEMENT_NODE", 1); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ATTRIBUTE_NODE", 2); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "TEXT_NODE", 3); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "CDATA_SECTION_NODE", 4); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ENTITY_REFERENCE_NODE", 5); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ENTITY_NODE", 6); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "PROCESSING_INSTRUCTION_NODE", 7); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "COMMENT_NODE", 8); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_NODE", 9); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_TYPE_NODE", 10); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_FRAGMENT_NODE", 11); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "NOTATION_NODE", 12); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_DISCONNECTED", 0x01); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_PRECEDING", 0x02); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_FOLLOWING", 0x04); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_CONTAINS", 0x08); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_CONTAINED_BY", 0x10); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", 0x20); -//# sourceMappingURL=NodeImpl.js.map +WebIDLAlgorithm_1.idl_defineConst(ElementImpl.prototype, "_nodeType", interfaces_1.NodeType.Element); +//# sourceMappingURL=ElementImpl.js.map /***/ }), -/***/ 1997: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 38245: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var TraverserImpl_1 = __nccwpck_require__(9782); +var interfaces_1 = __nccwpck_require__(27305); var algorithm_1 = __nccwpck_require__(61); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** - * Represents an object which can be used to iterate through the nodes - * of a subtree. + * Represents a DOM event. */ -var NodeIteratorImpl = /** @class */ (function (_super) { - __extends(NodeIteratorImpl, _super); +var EventImpl = /** @class */ (function () { /** - * Initializes a new instance of `NodeIterator`. + * Initializes a new instance of `Event`. */ - function NodeIteratorImpl(root, reference, pointerBeforeReference) { - var _this = _super.call(this, root) || this; - _this._iteratorCollection = undefined; - _this._reference = reference; - _this._pointerBeforeReference = pointerBeforeReference; - algorithm_1.nodeIterator_iteratorList().add(_this); - return _this; + function EventImpl(type, eventInit) { + this._target = null; + this._relatedTarget = null; + this._touchTargetList = []; + this._path = []; + this._currentTarget = null; + this._eventPhase = interfaces_1.EventPhase.None; + this._stopPropagationFlag = false; + this._stopImmediatePropagationFlag = false; + this._canceledFlag = false; + this._inPassiveListenerFlag = false; + this._composedFlag = false; + this._initializedFlag = false; + this._dispatchFlag = false; + this._isTrusted = false; + this._bubbles = false; + this._cancelable = false; + /** + * When a constructor of the Event interface, or of an interface that + * inherits from the Event interface, is invoked, these steps must be run, + * given the arguments type and eventInitDict: + * 1. Let event be the result of running the inner event creation steps with + * this interface, null, now, and eventInitDict. + * 2. Initialize event’s type attribute to type. + * 3. Return event. + */ + this._type = type; + if (eventInit) { + this._bubbles = eventInit.bubbles || false; + this._cancelable = eventInit.cancelable || false; + this._composedFlag = eventInit.composed || false; + } + this._initializedFlag = true; + this._timeStamp = new Date().getTime(); } - Object.defineProperty(NodeIteratorImpl.prototype, "referenceNode", { + Object.defineProperty(EventImpl.prototype, "type", { /** @inheritdoc */ - get: function () { return this._reference; }, + get: function () { return this._type; }, enumerable: true, configurable: true }); - Object.defineProperty(NodeIteratorImpl.prototype, "pointerBeforeReferenceNode", { + Object.defineProperty(EventImpl.prototype, "target", { /** @inheritdoc */ - get: function () { return this._pointerBeforeReference; }, + get: function () { return this._target; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "srcElement", { + /** @inheritdoc */ + get: function () { return this._target; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "currentTarget", { + /** @inheritdoc */ + get: function () { return this._currentTarget; }, enumerable: true, configurable: true }); /** @inheritdoc */ - NodeIteratorImpl.prototype.nextNode = function () { - /** - * The nextNode() method, when invoked, must return the result of - * traversing with the context object and next. - */ - return algorithm_1.nodeIterator_traverse(this, true); - }; - /** @inheritdoc */ - NodeIteratorImpl.prototype.previousNode = function () { + EventImpl.prototype.composedPath = function () { /** - * The previousNode() method, when invoked, must return the result of - * traversing with the context object and previous. + * 1. Let composedPath be an empty list. + * 2. Let path be the context object’s path. + * 3. If path is empty, then return composedPath. + * 4. Let currentTarget be the context object’s currentTarget attribute + * value. + * 5. Append currentTarget to composedPath. + * 6. Let currentTargetIndex be 0. + * 7. Let currentTargetHiddenSubtreeLevel be 0. */ - return algorithm_1.nodeIterator_traverse(this, false); + var composedPath = []; + var path = this._path; + if (path.length === 0) + return composedPath; + var currentTarget = this._currentTarget; + if (currentTarget === null) { + throw new Error("Event currentTarget is null."); + } + composedPath.push(currentTarget); + var currentTargetIndex = 0; + var currentTargetHiddenSubtreeLevel = 0; + /** + * 8. Let index be path’s size − 1. + * 9. While index is greater than or equal to 0: + */ + var index = path.length - 1; + while (index >= 0) { + /** + * 9.1. If path[index]'s root-of-closed-tree is true, then increase + * currentTargetHiddenSubtreeLevel by 1. + * 9.2. If path[index]'s invocation target is currentTarget, then set + * currentTargetIndex to index and break. + * 9.3. If path[index]'s slot-in-closed-tree is true, then decrease + * currentTargetHiddenSubtreeLevel by 1. + * 9.4. Decrease index by 1. + */ + if (path[index].rootOfClosedTree) { + currentTargetHiddenSubtreeLevel++; + } + if (path[index].invocationTarget === currentTarget) { + currentTargetIndex = index; + break; + } + if (path[index].slotInClosedTree) { + currentTargetHiddenSubtreeLevel--; + } + index--; + } + /** + * 10. Let currentHiddenLevel and maxHiddenLevel be + * currentTargetHiddenSubtreeLevel. + */ + var currentHiddenLevel = currentTargetHiddenSubtreeLevel; + var maxHiddenLevel = currentTargetHiddenSubtreeLevel; + /** + * 11. Set index to currentTargetIndex − 1. + * 12. While index is greater than or equal to 0: + */ + index = currentTargetIndex - 1; + while (index >= 0) { + /** + * 12.1. If path[index]'s root-of-closed-tree is true, then increase + * currentHiddenLevel by 1. + * 12.2. If currentHiddenLevel is less than or equal to maxHiddenLevel, + * then prepend path[index]'s invocation target to composedPath. + */ + if (path[index].rootOfClosedTree) { + currentHiddenLevel++; + } + if (currentHiddenLevel <= maxHiddenLevel) { + composedPath.unshift(path[index].invocationTarget); + } + /** + * 12.3. If path[index]'s slot-in-closed-tree is true, then: + */ + if (path[index].slotInClosedTree) { + /** + * 12.3.1. Decrease currentHiddenLevel by 1. + * 12.3.2. If currentHiddenLevel is less than maxHiddenLevel, then set + * maxHiddenLevel to currentHiddenLevel. + */ + currentHiddenLevel--; + if (currentHiddenLevel < maxHiddenLevel) { + maxHiddenLevel = currentHiddenLevel; + } + } + /** + * 12.4. Decrease index by 1. + */ + index--; + } + /** + * 13. Set currentHiddenLevel and maxHiddenLevel to + * currentTargetHiddenSubtreeLevel. + */ + currentHiddenLevel = currentTargetHiddenSubtreeLevel; + maxHiddenLevel = currentTargetHiddenSubtreeLevel; + /** + * 14. Set index to currentTargetIndex + 1. + * 15. While index is less than path’s size: + */ + index = currentTargetIndex + 1; + while (index < path.length) { + /** + * 15.1. If path[index]'s slot-in-closed-tree is true, then increase + * currentHiddenLevel by 1. + * 15.2. If currentHiddenLevel is less than or equal to maxHiddenLevel, + * then append path[index]'s invocation target to composedPath. + */ + if (path[index].slotInClosedTree) { + currentHiddenLevel++; + } + if (currentHiddenLevel <= maxHiddenLevel) { + composedPath.push(path[index].invocationTarget); + } + /** + * 15.3. If path[index]'s root-of-closed-tree is true, then: + */ + if (path[index].rootOfClosedTree) { + /** + * 15.3.1. Decrease currentHiddenLevel by 1. + * 15.3.2. If currentHiddenLevel is less than maxHiddenLevel, then set + * maxHiddenLevel to currentHiddenLevel. + */ + currentHiddenLevel--; + if (currentHiddenLevel < maxHiddenLevel) { + maxHiddenLevel = currentHiddenLevel; + } + } + /** + * 15.4. Increase index by 1. + */ + index++; + } + /** + * 16. Return composedPath. + */ + return composedPath; }; + Object.defineProperty(EventImpl.prototype, "eventPhase", { + /** @inheritdoc */ + get: function () { return this._eventPhase; }, + enumerable: true, + configurable: true + }); /** @inheritdoc */ - NodeIteratorImpl.prototype.detach = function () { + EventImpl.prototype.stopPropagation = function () { this._stopPropagationFlag = true; }; + Object.defineProperty(EventImpl.prototype, "cancelBubble", { + /** @inheritdoc */ + get: function () { return this._stopPropagationFlag; }, + set: function (value) { if (value) + this.stopPropagation(); }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + EventImpl.prototype.stopImmediatePropagation = function () { + this._stopPropagationFlag = true; + this._stopImmediatePropagationFlag = true; + }; + Object.defineProperty(EventImpl.prototype, "bubbles", { + /** @inheritdoc */ + get: function () { return this._bubbles; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "cancelable", { + /** @inheritdoc */ + get: function () { return this._cancelable; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "returnValue", { + /** @inheritdoc */ + get: function () { return !this._canceledFlag; }, + set: function (value) { + if (!value) { + algorithm_1.event_setTheCanceledFlag(this); + } + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + EventImpl.prototype.preventDefault = function () { + algorithm_1.event_setTheCanceledFlag(this); + }; + Object.defineProperty(EventImpl.prototype, "defaultPrevented", { + /** @inheritdoc */ + get: function () { return this._canceledFlag; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "composed", { + /** @inheritdoc */ + get: function () { return this._composedFlag; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "isTrusted", { + /** @inheritdoc */ + get: function () { return this._isTrusted; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "timeStamp", { + /** @inheritdoc */ + get: function () { return this._timeStamp; }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + EventImpl.prototype.initEvent = function (type, bubbles, cancelable) { + if (bubbles === void 0) { bubbles = false; } + if (cancelable === void 0) { cancelable = false; } /** - * The detach() method, when invoked, must do nothing. - * - * since JS lacks weak references, we still use detach + * 1. If the context object’s dispatch flag is set, then return. */ - algorithm_1.nodeIterator_iteratorList().delete(this); - }; - /** - * Creates a new `NodeIterator`. - * - * @param root - iterator's root node - * @param reference - reference node - * @param pointerBeforeReference - whether the iterator is before or after the - * reference node - */ - NodeIteratorImpl._create = function (root, reference, pointerBeforeReference) { - return new NodeIteratorImpl(root, reference, pointerBeforeReference); + if (this._dispatchFlag) + return; + /** + * 2. Initialize the context object with type, bubbles, and cancelable. + */ + algorithm_1.event_initialize(this, type, bubbles, cancelable); }; - return NodeIteratorImpl; -}(TraverserImpl_1.TraverserImpl)); -exports.NodeIteratorImpl = NodeIteratorImpl; -//# sourceMappingURL=NodeIteratorImpl.js.map + EventImpl.NONE = 0; + EventImpl.CAPTURING_PHASE = 1; + EventImpl.AT_TARGET = 2; + EventImpl.BUBBLING_PHASE = 3; + return EventImpl; +}()); +exports.EventImpl = EventImpl; +/** + * Define constants on prototype. + */ +WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "NONE", 0); +WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "CAPTURING_PHASE", 1); +WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "AT_TARGET", 2); +WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "BUBBLING_PHASE", 3); +//# sourceMappingURL=EventImpl.js.map /***/ }), -/***/ 3728: +/***/ 69968: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + finally { if (e) throw e.error; } + } + return ar; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var util_1 = __nccwpck_require__(6195); +var DOMException_1 = __nccwpck_require__(13166); +var util_1 = __nccwpck_require__(65282); var algorithm_1 = __nccwpck_require__(61); /** - * Represents an ordered set of nodes. + * Represents a target to which an event can be dispatched. */ -var NodeListImpl = /** @class */ (function () { +var EventTargetImpl = /** @class */ (function () { /** - * Initializes a new instance of `NodeList`. + * Initializes a new instance of `EventTarget`. + */ + function EventTargetImpl() { + } + Object.defineProperty(EventTargetImpl.prototype, "_eventListenerList", { + get: function () { + return this.__eventListenerList || (this.__eventListenerList = []); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventTargetImpl.prototype, "_eventHandlerMap", { + get: function () { + return this.__eventHandlerMap || (this.__eventHandlerMap = {}); + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + EventTargetImpl.prototype.addEventListener = function (type, callback, options) { + if (options === void 0) { options = { passive: false, once: false, capture: false }; } + /** + * 1. Let capture, passive, and once be the result of flattening more options. + */ + var _a = __read(algorithm_1.eventTarget_flattenMore(options), 3), capture = _a[0], passive = _a[1], once = _a[2]; + // convert callback function to EventListener, return if null + var listenerCallback; + if (!callback) { + return; + } + else if (util_1.Guard.isEventListener(callback)) { + listenerCallback = callback; + } + else { + listenerCallback = { handleEvent: callback }; + } + /** + * 2. Add an event listener with the context object and an event listener + * whose type is type, callback is callback, capture is capture, passive is + * passive, and once is once. + */ + algorithm_1.eventTarget_addEventListener(this, { + type: type, + callback: listenerCallback, + capture: capture, + passive: passive, + once: once, + removed: false + }); + }; + /** @inheritdoc */ + EventTargetImpl.prototype.removeEventListener = function (type, callback, options) { + /** + * TODO: Implement realms + * 1. If the context object’s relevant global object is a + * ServiceWorkerGlobalScope object and its associated service worker’s + * script resource’s has ever been evaluated flag is set, then throw + * a TypeError. [SERVICE-WORKERS] + */ + if (options === void 0) { options = { capture: false }; } + /** + * 2. Let capture be the result of flattening options. + */ + var capture = algorithm_1.eventTarget_flatten(options); + if (!callback) + return; + /** + * 3. If the context object’s event listener list contains an event listener + * whose type is type, callback is callback, and capture is capture, then + * remove an event listener with the context object and that event listener. + */ + for (var i = 0; i < this._eventListenerList.length; i++) { + var entry = this._eventListenerList[i]; + if (entry.type !== type || entry.capture !== capture) + continue; + if (util_1.Guard.isEventListener(callback) && entry.callback === callback) { + algorithm_1.eventTarget_removeEventListener(this, entry, i); + break; + } + else if (callback && entry.callback.handleEvent === callback) { + algorithm_1.eventTarget_removeEventListener(this, entry, i); + break; + } + } + }; + /** @inheritdoc */ + EventTargetImpl.prototype.dispatchEvent = function (event) { + /** + * 1. If event’s dispatch flag is set, or if its initialized flag is not + * set, then throw an "InvalidStateError" DOMException. + * 2. Initialize event’s isTrusted attribute to false. + * 3. Return the result of dispatching event to the context object. + */ + if (event._dispatchFlag || !event._initializedFlag) { + throw new DOMException_1.InvalidStateError(); + } + event._isTrusted = false; + return algorithm_1.event_dispatch(event, this); + }; + /** @inheritdoc */ + EventTargetImpl.prototype._getTheParent = function (event) { + return null; + }; + return EventTargetImpl; +}()); +exports.EventTargetImpl = EventTargetImpl; +//# sourceMappingURL=EventTargetImpl.js.map + +/***/ }), + +/***/ 93969: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var infra_1 = __nccwpck_require__(84251); +var algorithm_1 = __nccwpck_require__(61); +var util_1 = __nccwpck_require__(65282); +var util_2 = __nccwpck_require__(76195); +/** + * Represents a collection of elements. + */ +var HTMLCollectionImpl = /** @class */ (function () { + /** + * Initializes a new instance of `HTMLCollection`. * * @param root - root node + * @param filter - node filter */ - function NodeListImpl(root) { + function HTMLCollectionImpl(root, filter) { this._live = true; - this._filter = null; - this._length = 0; this._root = root; + this._filter = filter; return new Proxy(this, this); } - Object.defineProperty(NodeListImpl.prototype, "length", { + Object.defineProperty(HTMLCollectionImpl.prototype, "length", { /** @inheritdoc */ get: function () { + var _this = this; /** - * The length attribute must return the number of nodes represented - * by the collection. + * The length attribute’s getter must return the number of nodes + * represented by the collection. */ - return this._root._children.size; + var count = 0; + var node = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + while (node !== null) { + count++; + node = algorithm_1.tree_getNextDescendantNode(this._root, node, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + } + return count; }, enumerable: true, configurable: true }); /** @inheritdoc */ - NodeListImpl.prototype.item = function (index) { + HTMLCollectionImpl.prototype.item = function (index) { + var _this = this; /** - * The item(index) method must return the indexth node in the collection. - * If there is no indexth node in the collection, then the method must - * return null. + * The item(index) method, when invoked, must return the indexth element + * in the collection. If there is no indexth element in the collection, + * then the method must return null. */ - if (index < 0 || index > this.length - 1) - return null; - if (index < this.length / 2) { - var i = 0; - var node = this._root._firstChild; - while (node !== null && i !== index) { - node = node._nextSibling; + var i = 0; + var node = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + while (node !== null) { + if (i === index) + return node; + else i++; - } - return node; + node = algorithm_1.tree_getNextDescendantNode(this._root, node, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); } - else { - var i = this.length - 1; - var node = this._root._lastChild; - while (node !== null && i !== index) { - node = node._previousSibling; - i--; + return null; + }; + /** @inheritdoc */ + HTMLCollectionImpl.prototype.namedItem = function (key) { + var _this = this; + /** + * 1. If key is the empty string, return null. + * 2. Return the first element in the collection for which at least one of + * the following is true: + * - it has an ID which is key; + * - it is in the HTML namespace and has a name attribute whose value is key; + * or null if there is no such element. + */ + if (key === '') + return null; + var ele = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + while (ele != null) { + if (ele._uniqueIdentifier === key) { + return ele; } - return node; + else if (ele._namespace === infra_1.namespace.HTML) { + for (var i = 0; i < ele._attributeList.length; i++) { + var attr = ele._attributeList[i]; + if (attr._localName === "name" && attr._namespace === null && + attr._namespacePrefix === null && attr._value === key) + return ele; + } + } + ele = algorithm_1.tree_getNextDescendantNode(this._root, ele, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); } + return null; }; /** @inheritdoc */ - NodeListImpl.prototype.keys = function () { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var index = 0; - return { - next: function () { - if (index === this.length) { - return { done: true, value: null }; - } - else { - return { done: false, value: index++ }; - } - }.bind(this) - }; - }.bind(this), - _a; - }; - /** @inheritdoc */ - NodeListImpl.prototype.values = function () { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var it = this[Symbol.iterator](); - return { - next: function () { - return it.next(); - } - }; - }.bind(this), - _a; - }; - /** @inheritdoc */ - NodeListImpl.prototype.entries = function () { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var it = this[Symbol.iterator](); - var index = 0; - return { - next: function () { - var itResult = it.next(); - if (itResult.done) { - return { done: true, value: null }; - } - else { - return { done: false, value: [index++, itResult.value] }; - } - } - }; - }.bind(this), - _a; - }; - /** @inheritdoc */ - NodeListImpl.prototype[Symbol.iterator] = function () { - return this._root._children[Symbol.iterator](); - }; - /** @inheritdoc */ - NodeListImpl.prototype.forEach = function (callback, thisArg) { - var e_1, _a; - if (thisArg === undefined) { - thisArg = DOMImpl_1.dom.window; - } - var index = 0; - try { - for (var _b = __values(this._root._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var node = _c.value; - callback.call(thisArg, node, index++, this); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + HTMLCollectionImpl.prototype[Symbol.iterator] = function () { + var root = this._root; + var filter = this._filter; + var currentNode = algorithm_1.tree_getFirstDescendantNode(root, false, false, function (e) { return util_1.Guard.isElementNode(e) && filter(e); }); + return { + next: function () { + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = algorithm_1.tree_getNextDescendantNode(root, currentNode, false, false, function (e) { return util_1.Guard.isElementNode(e) && filter(e); }); + return result; + } } - finally { if (e_1) throw e_1.error; } - } + }; }; /** * Implements a proxy get trap to provide array-like access. */ - NodeListImpl.prototype.get = function (target, key, receiver) { - if (!util_1.isString(key)) { + HTMLCollectionImpl.prototype.get = function (target, key, receiver) { + if (!util_2.isString(key) || HTMLCollectionImpl.reservedNames.indexOf(key) !== -1) { return Reflect.get(target, key, receiver); } var index = Number(key); if (isNaN(index)) { - return Reflect.get(target, key, receiver); + return target.namedItem(key) || undefined; + } + else { + return target.item(index) || undefined; } - return target.item(index) || undefined; }; /** * Implements a proxy set trap to provide array-like access. */ - NodeListImpl.prototype.set = function (target, key, value, receiver) { - if (!util_1.isString(key)) { + HTMLCollectionImpl.prototype.set = function (target, key, value, receiver) { + if (!util_2.isString(key) || HTMLCollectionImpl.reservedNames.indexOf(key) !== -1) { return Reflect.set(target, key, value, receiver); } var index = Number(key); - if (isNaN(index)) { - return Reflect.set(target, key, value, receiver); - } - var node = target.item(index) || undefined; - if (!node) - return false; - if (node._parent) { + var node = isNaN(index) ? + target.namedItem(key) || undefined : target.item(index) || undefined; + if (node && node._parent) { algorithm_1.mutation_replace(node, value, node._parent); return true; } @@ -61421,21 +61356,25 @@ var NodeListImpl = /** @class */ (function () { } }; /** - * Creates a new `NodeList`. + * Creates a new `HTMLCollection`. * * @param root - root node + * @param filter - node filter */ - NodeListImpl._create = function (root) { - return new NodeListImpl(root); + HTMLCollectionImpl._create = function (root, filter) { + if (filter === void 0) { filter = (function () { return true; }); } + return new HTMLCollectionImpl(root, filter); }; - return NodeListImpl; + HTMLCollectionImpl.reservedNames = ['_root', '_live', '_filter', 'length', + 'item', 'namedItem', 'get', 'set']; + return HTMLCollectionImpl; }()); -exports.NodeListImpl = NodeListImpl; -//# sourceMappingURL=NodeListImpl.js.map +exports.HTMLCollectionImpl = HTMLCollectionImpl; +//# sourceMappingURL=HTMLCollectionImpl.js.map /***/ }), -/***/ 5306: +/***/ 89616: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -61452,124 +61391,113 @@ var __values = (this && this.__values) || function(o) { throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var util_1 = __nccwpck_require__(6195); +var DOMImpl_1 = __nccwpck_require__(14177); +var util_1 = __nccwpck_require__(65282); +var infra_1 = __nccwpck_require__(84251); /** - * Represents an ordered list of nodes. - * This is a static implementation of `NodeList`. + * Represents an object that can be used to observe mutations to the tree of + * nodes. */ -var NodeListStaticImpl = /** @class */ (function () { +var MutationObserverImpl = /** @class */ (function () { /** - * Initializes a new instance of `NodeList`. + * Initializes a new instance of `MutationObserver`. * - * @param root - root node + * @param callback - the callback function */ - function NodeListStaticImpl(root) { - this._live = false; - this._items = []; - this._length = 0; - this._root = root; - this._items = []; - this._filter = function (node) { return true; }; - return new Proxy(this, this); + function MutationObserverImpl(callback) { + this._nodeList = []; + this._recordQueue = []; + /** + * 1. Let mo be a new MutationObserver object whose callback is callback. + * 2. Append mo to mo’s relevant agent’s mutation observers. + * 3. Return mo. + */ + this._callback = callback; + var window = DOMImpl_1.dom.window; + infra_1.set.append(window._mutationObservers, this); } - Object.defineProperty(NodeListStaticImpl.prototype, "length", { - /** @inheritdoc */ - get: function () { - /** - * The length attribute must return the number of nodes represented by - * the collection. - */ - return this._items.length; - }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - NodeListStaticImpl.prototype.item = function (index) { + MutationObserverImpl.prototype.observe = function (target, options) { + var e_1, _a; + options = options || { + childList: false, + subtree: false + }; /** - * The item(index) method must return the indexth node in the collection. - * If there is no indexth node in the collection, then the method must - * return null. + * 1. If either options’s attributeOldValue or attributeFilter is present + * and options’s attributes is omitted, then set options’s attributes + * to true. + * 2. If options’s characterDataOldValue is present and options’s + * characterData is omitted, then set options’s characterData to true. + * 3. If none of options’s childList, attributes, and characterData is + * true, then throw a TypeError. + * 4. If options’s attributeOldValue is true and options’s attributes is + * false, then throw a TypeError. + * 5. If options’s attributeFilter is present and options’s attributes is + * false, then throw a TypeError. + * 6. If options’s characterDataOldValue is true and options’s characterData + * is false, then throw a TypeError. */ - if (index < 0 || index > this.length - 1) - return null; - return this._items[index]; - }; - /** @inheritdoc */ - NodeListStaticImpl.prototype.keys = function () { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var index = 0; - return { - next: function () { - if (index === this.length) { - return { done: true, value: null }; - } - else { - return { done: false, value: index++ }; - } - }.bind(this) - }; - }.bind(this), - _a; - }; - /** @inheritdoc */ - NodeListStaticImpl.prototype.values = function () { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var it = this[Symbol.iterator](); - return { - next: function () { - return it.next(); + if ((options.attributeOldValue !== undefined || options.attributeFilter !== undefined) && + options.attributes === undefined) { + options.attributes = true; + } + if (options.characterDataOldValue !== undefined && options.characterData === undefined) { + options.characterData = true; + } + if (!options.childList && !options.attributes && !options.characterData) { + throw new TypeError(); + } + if (options.attributeOldValue && !options.attributes) { + throw new TypeError(); + } + if (options.attributeFilter !== undefined && !options.attributes) { + throw new TypeError(); + } + if (options.characterDataOldValue && !options.characterData) { + throw new TypeError(); + } + /** + * 7. For each registered of target’s registered observer list, if + * registered’s observer is the context object: + */ + var isRegistered = false; + var coptions = options; + var _loop_1 = function (registered) { + var e_2, _a; + if (registered.observer === this_1) { + isRegistered = true; + try { + /** + * 7.1. For each node of the context object’s node list, remove all + * transient registered observers whose source is registered from node’s + * registered observer list. + */ + for (var _b = (e_2 = void 0, __values(this_1._nodeList)), _c = _b.next(); !_c.done; _c = _b.next()) { + var node = _c.value; + infra_1.list.remove(node._registeredObserverList, function (ob) { + return util_1.Guard.isTransientRegisteredObserver(ob) && ob.source === registered; + }); } - }; - }.bind(this), - _a; - }; - /** @inheritdoc */ - NodeListStaticImpl.prototype.entries = function () { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var it = this[Symbol.iterator](); - var index = 0; - return { - next: function () { - var itResult = it.next(); - if (itResult.done) { - return { done: true, value: null }; - } - else { - return { done: false, value: [index++, itResult.value] }; - } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } - }; - }.bind(this), - _a; - }; - /** @inheritdoc */ - NodeListStaticImpl.prototype[Symbol.iterator] = function () { - var it = this._items[Symbol.iterator](); - return { - next: function () { - return it.next(); + finally { if (e_2) throw e_2.error; } + } + /** + * 7.2. Set registered’s options to options. + */ + registered.options = coptions; } }; - }; - /** @inheritdoc */ - NodeListStaticImpl.prototype.forEach = function (callback, thisArg) { - var e_1, _a; - if (thisArg === undefined) { - thisArg = DOMImpl_1.dom.window; - } - var index = 0; + var this_1 = this; try { - for (var _b = __values(this._items), _c = _b.next(); !_c.done; _c = _b.next()) { - var node = _c.value; - callback.call(thisArg, node, index++, this); + for (var _b = __values(target._registeredObserverList), _c = _b.next(); !_c.done; _c = _b.next()) { + var registered = _c.value; + _loop_1(registered); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } @@ -61579,321 +61507,188 @@ var NodeListStaticImpl = /** @class */ (function () { } finally { if (e_1) throw e_1.error; } } - }; - /** - * Implements a proxy get trap to provide array-like access. - */ - NodeListStaticImpl.prototype.get = function (target, key, receiver) { - if (!util_1.isString(key)) { - return Reflect.get(target, key, receiver); - } - var index = Number(key); - if (isNaN(index)) { - return Reflect.get(target, key, receiver); + /** + * 8. Otherwise: + * 8.1. Append a new registered observer whose observer is the context + * object and options is options to target’s registered observer list. + * 8.2. Append target to the context object’s node list. + */ + if (!isRegistered) { + target._registeredObserverList.push({ observer: this, options: options }); + this._nodeList.push(target); } - return target._items[index] || undefined; }; - /** - * Implements a proxy set trap to provide array-like access. - */ - NodeListStaticImpl.prototype.set = function (target, key, value, receiver) { - if (!util_1.isString(key)) { - return Reflect.set(target, key, value, receiver); - } - var index = Number(key); - if (isNaN(index)) { - return Reflect.set(target, key, value, receiver); - } - if (index >= 0 && index < target._items.length) { - target._items[index] = value; - return true; + /** @inheritdoc */ + MutationObserverImpl.prototype.disconnect = function () { + var e_3, _a; + var _this = this; + try { + /** + * 1. For each node of the context object’s node list, remove any + * registered observer from node’s registered observer list for which the + * context object is the observer. + */ + for (var _b = __values(this._nodeList), _c = _b.next(); !_c.done; _c = _b.next()) { + var node = _c.value; + infra_1.list.remove((node)._registeredObserverList, function (ob) { + return ob.observer === _this; + }); + } } - else { - return false; + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_3) throw e_3.error; } } + /** + * 2. Empty the context object’s record queue. + */ + this._recordQueue = []; }; - /** - * Creates a new `NodeList`. - * - * @param root - root node - * @param items - a list of items to initialize the list - */ - NodeListStaticImpl._create = function (root, items) { - var list = new NodeListStaticImpl(root); - list._items = items; - return list; + /** @inheritdoc */ + MutationObserverImpl.prototype.takeRecords = function () { + /** + * 1. Let records be a clone of the context object’s record queue. + * 2. Empty the context object’s record queue. + * 3. Return records. + */ + var records = this._recordQueue; + this._recordQueue = []; + return records; }; - return NodeListStaticImpl; + return MutationObserverImpl; }()); -exports.NodeListStaticImpl = NodeListStaticImpl; -//# sourceMappingURL=NodeListStaticImpl.js.map +exports.MutationObserverImpl = MutationObserverImpl; +//# sourceMappingURL=MutationObserverImpl.js.map /***/ }), -/***/ 1032: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 6219: +/***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(5282); /** - * Represents a mixin that extends child nodes that can have siblings - * other than doctypes. This mixin is implemented by {@link Element} and - * {@link CharacterData}. + * Represents a mutation record. */ -var NonDocumentTypeChildNodeImpl = /** @class */ (function () { - function NonDocumentTypeChildNodeImpl() { +var MutationRecordImpl = /** @class */ (function () { + /** + * Initializes a new instance of `MutationRecord`. + * + * @param type - type of mutation: `"attributes"` for an attribute + * mutation, `"characterData"` for a mutation to a CharacterData node + * and `"childList"` for a mutation to the tree of nodes. + * @param target - node affected by the mutation. + * @param addedNodes - list of added nodes. + * @param removedNodes - list of removed nodes. + * @param previousSibling - previous sibling of added or removed nodes. + * @param nextSibling - next sibling of added or removed nodes. + * @param attributeName - local name of the changed attribute, + * and `null` otherwise. + * @param attributeNamespace - namespace of the changed attribute, + * and `null` otherwise. + * @param oldValue - value before mutation: attribute value for an attribute + * mutation, node `data` for a mutation to a CharacterData node and `null` + * for a mutation to the tree of nodes. + */ + function MutationRecordImpl(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { + this._type = type; + this._target = target; + this._addedNodes = addedNodes; + this._removedNodes = removedNodes; + this._previousSibling = previousSibling; + this._nextSibling = nextSibling; + this._attributeName = attributeName; + this._attributeNamespace = attributeNamespace; + this._oldValue = oldValue; } - Object.defineProperty(NonDocumentTypeChildNodeImpl.prototype, "previousElementSibling", { + Object.defineProperty(MutationRecordImpl.prototype, "type", { /** @inheritdoc */ - get: function () { - /** - * The previousElementSibling attribute’s getter must return the first - * preceding sibling that is an element, and null otherwise. - */ - var node = util_1.Cast.asNode(this)._previousSibling; - while (node) { - if (util_1.Guard.isElementNode(node)) - return node; - else - node = node._previousSibling; - } - return null; - }, + get: function () { return this._type; }, enumerable: true, configurable: true }); - Object.defineProperty(NonDocumentTypeChildNodeImpl.prototype, "nextElementSibling", { + Object.defineProperty(MutationRecordImpl.prototype, "target", { /** @inheritdoc */ - get: function () { - /** - * The nextElementSibling attribute’s getter must return the first - * following sibling that is an element, and null otherwise. - */ - var node = util_1.Cast.asNode(this)._nextSibling; - while (node) { - if (util_1.Guard.isElementNode(node)) - return node; - else - node = node._nextSibling; - } - return null; - }, + get: function () { return this._target; }, enumerable: true, configurable: true }); - return NonDocumentTypeChildNodeImpl; -}()); -exports.NonDocumentTypeChildNodeImpl = NonDocumentTypeChildNodeImpl; -//# sourceMappingURL=NonDocumentTypeChildNodeImpl.js.map - -/***/ }), - -/***/ 733: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(5282); -var algorithm_1 = __nccwpck_require__(61); -/** - * Represents a mixin that extends non-element parent nodes. This mixin - * is implemented by {@link Document} and {@link DocumentFragment}. - */ -var NonElementParentNodeImpl = /** @class */ (function () { - function NonElementParentNodeImpl() { - } - /** @inheritdoc */ - NonElementParentNodeImpl.prototype.getElementById = function (id) { - /** - * The getElementById(elementId) method, when invoked, must return the first - * element, in tree order, within the context object’s descendants, - * whose ID is elementId, and null if there is no such element otherwise. - */ - var ele = algorithm_1.tree_getFirstDescendantNode(util_1.Cast.asNode(this), false, false, function (e) { return util_1.Guard.isElementNode(e); }); - while (ele !== null) { - if (ele._uniqueIdentifier === id) { - return ele; - } - ele = algorithm_1.tree_getNextDescendantNode(util_1.Cast.asNode(this), ele, false, false, function (e) { return util_1.Guard.isElementNode(e); }); - } - return null; - }; - return NonElementParentNodeImpl; -}()); -exports.NonElementParentNodeImpl = NonElementParentNodeImpl; -//# sourceMappingURL=NonElementParentNodeImpl.js.map - -/***/ }), - -/***/ 5988: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(5282); -var algorithm_1 = __nccwpck_require__(61); -/** - * Represents a mixin that extends parent nodes that can have children. - * This mixin is implemented by {@link Element}, {@link Document} and - * {@link DocumentFragment}. - */ -var ParentNodeImpl = /** @class */ (function () { - function ParentNodeImpl() { - } - Object.defineProperty(ParentNodeImpl.prototype, "children", { + Object.defineProperty(MutationRecordImpl.prototype, "addedNodes", { /** @inheritdoc */ - get: function () { - /** - * The children attribute’s getter must return an HTMLCollection collection - * rooted at context object matching only element children. - */ - return algorithm_1.create_htmlCollection(util_1.Cast.asNode(this)); - }, + get: function () { return this._addedNodes; }, enumerable: true, configurable: true }); - Object.defineProperty(ParentNodeImpl.prototype, "firstElementChild", { + Object.defineProperty(MutationRecordImpl.prototype, "removedNodes", { /** @inheritdoc */ - get: function () { - /** - * The firstElementChild attribute’s getter must return the first child - * that is an element, and null otherwise. - */ - var node = util_1.Cast.asNode(this)._firstChild; - while (node) { - if (util_1.Guard.isElementNode(node)) - return node; - else - node = node._nextSibling; - } - return null; - }, + get: function () { return this._removedNodes; }, enumerable: true, configurable: true }); - Object.defineProperty(ParentNodeImpl.prototype, "lastElementChild", { + Object.defineProperty(MutationRecordImpl.prototype, "previousSibling", { /** @inheritdoc */ - get: function () { - /** - * The lastElementChild attribute’s getter must return the last child that - * is an element, and null otherwise. - */ - var node = util_1.Cast.asNode(this)._lastChild; - while (node) { - if (util_1.Guard.isElementNode(node)) - return node; - else - node = node._previousSibling; - } - return null; - }, + get: function () { return this._previousSibling; }, enumerable: true, configurable: true }); - Object.defineProperty(ParentNodeImpl.prototype, "childElementCount", { + Object.defineProperty(MutationRecordImpl.prototype, "nextSibling", { /** @inheritdoc */ - get: function () { - var e_1, _a; - /** - * The childElementCount attribute’s getter must return the number of - * children of context object that are elements. - */ - var count = 0; - try { - for (var _b = __values(util_1.Cast.asNode(this)._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - if (util_1.Guard.isElementNode(childNode)) - count++; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - return count; - }, + get: function () { return this._nextSibling; }, enumerable: true, configurable: true }); - /** @inheritdoc */ - ParentNodeImpl.prototype.prepend = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - /** - * 1. Let node be the result of converting nodes into a node given nodes - * and context object’s node document. - * 2. Pre-insert node into context object before the context object’s first - * child. - */ - var node = util_1.Cast.asNode(this); - var childNode = algorithm_1.parentNode_convertNodesIntoANode(nodes, node._nodeDocument); - algorithm_1.mutation_preInsert(childNode, node, node._firstChild); - }; - /** @inheritdoc */ - ParentNodeImpl.prototype.append = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - /** - * 1. Let node be the result of converting nodes into a node given nodes - * and context object’s node document. - * 2. Append node to context object. - */ - var node = util_1.Cast.asNode(this); - var childNode = algorithm_1.parentNode_convertNodesIntoANode(nodes, node._nodeDocument); - algorithm_1.mutation_append(childNode, node); - }; - /** @inheritdoc */ - ParentNodeImpl.prototype.querySelector = function (selectors) { - /** - * The querySelector(selectors) method, when invoked, must return the first - * result of running scope-match a selectors string selectors against - * context object, if the result is not an empty list, and null otherwise. - */ - var node = util_1.Cast.asNode(this); - var result = algorithm_1.selectors_scopeMatchASelectorsString(selectors, node); - return (result.length === 0 ? null : result[0]); - }; - /** @inheritdoc */ - ParentNodeImpl.prototype.querySelectorAll = function (selectors) { - /** - * The querySelectorAll(selectors) method, when invoked, must return the - * static result of running scope-match a selectors string selectors against - * context object. - */ - var node = util_1.Cast.asNode(this); - var result = algorithm_1.selectors_scopeMatchASelectorsString(selectors, node); - return algorithm_1.create_nodeListStatic(node, result); + Object.defineProperty(MutationRecordImpl.prototype, "attributeName", { + /** @inheritdoc */ + get: function () { return this._attributeName; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MutationRecordImpl.prototype, "attributeNamespace", { + /** @inheritdoc */ + get: function () { return this._attributeNamespace; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MutationRecordImpl.prototype, "oldValue", { + /** @inheritdoc */ + get: function () { return this._oldValue; }, + enumerable: true, + configurable: true + }); + /** + * Creates a new `MutationRecord`. + * + * @param type - type of mutation: `"attributes"` for an attribute + * mutation, `"characterData"` for a mutation to a CharacterData node + * and `"childList"` for a mutation to the tree of nodes. + * @param target - node affected by the mutation. + * @param addedNodes - list of added nodes. + * @param removedNodes - list of removed nodes. + * @param previousSibling - previous sibling of added or removed nodes. + * @param nextSibling - next sibling of added or removed nodes. + * @param attributeName - local name of the changed attribute, + * and `null` otherwise. + * @param attributeNamespace - namespace of the changed attribute, + * and `null` otherwise. + * @param oldValue - value before mutation: attribute value for an attribute + * mutation, node `data` for a mutation to a CharacterData node and `null` + * for a mutation to the tree of nodes. + */ + MutationRecordImpl._create = function (type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { + return new MutationRecordImpl(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue); }; - return ParentNodeImpl; + return MutationRecordImpl; }()); -exports.ParentNodeImpl = ParentNodeImpl; -//# sourceMappingURL=ParentNodeImpl.js.map +exports.MutationRecordImpl = MutationRecordImpl; +//# sourceMappingURL=MutationRecordImpl.js.map /***/ }), -/***/ 9430: +/***/ 57206: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -61912,54 +61707,178 @@ var __extends = (this && this.__extends) || (function () { }; })(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var CharacterDataImpl_1 = __nccwpck_require__(5330); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); +var DOMException_1 = __nccwpck_require__(13166); +var algorithm_1 = __nccwpck_require__(61); /** - * Represents a processing instruction node. + * Represents a collection of attributes. */ -var ProcessingInstructionImpl = /** @class */ (function (_super) { - __extends(ProcessingInstructionImpl, _super); +var NamedNodeMapImpl = /** @class */ (function (_super) { + __extends(NamedNodeMapImpl, _super); /** - * Initializes a new instance of `ProcessingInstruction`. + * Initializes a new instance of `NamedNodeMap`. + * + * @param element - parent element */ - function ProcessingInstructionImpl(target, data) { - var _this = _super.call(this, data) || this; - _this._target = target; + function NamedNodeMapImpl(element) { + var _this = _super.call(this) || this; + _this._element = element; + // TODO: This workaround is needed to extend Array in ES5 + Object.setPrototypeOf(_this, NamedNodeMapImpl.prototype); return _this; } - Object.defineProperty(ProcessingInstructionImpl.prototype, "target", { + NamedNodeMapImpl.prototype._asArray = function () { return this; }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.item = function (index) { /** - * Gets the target of the {@link ProcessingInstruction} node. + * 1. If index is equal to or greater than context object’s attribute list’s + * size, then return null. + * 2. Otherwise, return context object’s attribute list[index]. + * */ - get: function () { return this._target; }, - enumerable: true, - configurable: true - }); + return this[index] || null; + }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.getNamedItem = function (qualifiedName) { + /** + * The getNamedItem(qualifiedName) method, when invoked, must return the + * result of getting an attribute given qualifiedName and element. + */ + return algorithm_1.element_getAnAttributeByName(qualifiedName, this._element); + }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.getNamedItemNS = function (namespace, localName) { + /** + * The getNamedItemNS(namespace, localName) method, when invoked, must + * return the result of getting an attribute given namespace, localName, + * and element. + */ + return algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace || '', localName, this._element); + }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.setNamedItem = function (attr) { + /** + * The setNamedItem(attr) and setNamedItemNS(attr) methods, when invoked, + * must return the result of setting an attribute given attr and element. + */ + return algorithm_1.element_setAnAttribute(attr, this._element); + }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.setNamedItemNS = function (attr) { + return algorithm_1.element_setAnAttribute(attr, this._element); + }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.removeNamedItem = function (qualifiedName) { + /** + * 1. Let attr be the result of removing an attribute given qualifiedName + * and element. + * 2. If attr is null, then throw a "NotFoundError" DOMException. + * 3. Return attr. + */ + var attr = algorithm_1.element_removeAnAttributeByName(qualifiedName, this._element); + if (attr === null) + throw new DOMException_1.NotFoundError(); + return attr; + }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.removeNamedItemNS = function (namespace, localName) { + /** + * 1. Let attr be the result of removing an attribute given namespace, + * localName, and element. + * 2. If attr is null, then throw a "NotFoundError" DOMException. + * 3. Return attr. + */ + var attr = algorithm_1.element_removeAnAttributeByNamespaceAndLocalName(namespace || '', localName, this._element); + if (attr === null) + throw new DOMException_1.NotFoundError(); + return attr; + }; /** - * Creates a new `ProcessingInstruction`. + * Creates a new `NamedNodeMap`. * - * @param document - owner document - * @param target - instruction target - * @param data - node contents + * @param element - parent element */ - ProcessingInstructionImpl._create = function (document, target, data) { - var node = new ProcessingInstructionImpl(target, data); - node._nodeDocument = document; - return node; + NamedNodeMapImpl._create = function (element) { + return new NamedNodeMapImpl(element); }; - return ProcessingInstructionImpl; -}(CharacterDataImpl_1.CharacterDataImpl)); -exports.ProcessingInstructionImpl = ProcessingInstructionImpl; + return NamedNodeMapImpl; +}(Array)); +exports.NamedNodeMapImpl = NamedNodeMapImpl; +//# sourceMappingURL=NamedNodeMapImpl.js.map + +/***/ }), + +/***/ 12355: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var interfaces_1 = __nccwpck_require__(27305); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** - * Initialize prototype properties + * Represents a node filter. */ -WebIDLAlgorithm_1.idl_defineConst(ProcessingInstructionImpl.prototype, "_nodeType", interfaces_1.NodeType.ProcessingInstruction); -//# sourceMappingURL=ProcessingInstructionImpl.js.map +var NodeFilterImpl = /** @class */ (function () { + /** + * Initializes a new instance of `NodeFilter`. + */ + function NodeFilterImpl() { + } + /** + * Callback function. + */ + NodeFilterImpl.prototype.acceptNode = function (node) { + return interfaces_1.FilterResult.Accept; + }; + /** + * Creates a new `NodeFilter`. + */ + NodeFilterImpl._create = function () { + return new NodeFilterImpl(); + }; + NodeFilterImpl.FILTER_ACCEPT = 1; + NodeFilterImpl.FILTER_REJECT = 2; + NodeFilterImpl.FILTER_SKIP = 3; + NodeFilterImpl.SHOW_ALL = 0xffffffff; + NodeFilterImpl.SHOW_ELEMENT = 0x1; + NodeFilterImpl.SHOW_ATTRIBUTE = 0x2; + NodeFilterImpl.SHOW_TEXT = 0x4; + NodeFilterImpl.SHOW_CDATA_SECTION = 0x8; + NodeFilterImpl.SHOW_ENTITY_REFERENCE = 0x10; + NodeFilterImpl.SHOW_ENTITY = 0x20; + NodeFilterImpl.SHOW_PROCESSING_INSTRUCTION = 0x40; + NodeFilterImpl.SHOW_COMMENT = 0x80; + NodeFilterImpl.SHOW_DOCUMENT = 0x100; + NodeFilterImpl.SHOW_DOCUMENT_TYPE = 0x200; + NodeFilterImpl.SHOW_DOCUMENT_FRAGMENT = 0x400; + NodeFilterImpl.SHOW_NOTATION = 0x800; + return NodeFilterImpl; +}()); +exports.NodeFilterImpl = NodeFilterImpl; +/** + * Define constants on prototype. + */ +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "FILTER_ACCEPT", 1); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "FILTER_REJECT", 2); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "FILTER_SKIP", 3); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ALL", 0xffffffff); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ELEMENT", 0x1); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ATTRIBUTE", 0x2); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_TEXT", 0x4); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_CDATA_SECTION", 0x8); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ENTITY_REFERENCE", 0x10); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ENTITY", 0x20); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_PROCESSING_INSTRUCTION", 0x40); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_COMMENT", 0x80); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_DOCUMENT", 0x100); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_DOCUMENT_TYPE", 0x200); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_DOCUMENT_FRAGMENT", 0x400); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_NOTATION", 0x800); +//# sourceMappingURL=NodeFilterImpl.js.map /***/ }), -/***/ 166: +/***/ 91745: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -61989,764 +61908,875 @@ var __values = (this && this.__values) || function(o) { throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(4177); -var interfaces_1 = __nccwpck_require__(7305); -var AbstractRangeImpl_1 = __nccwpck_require__(7126); -var DOMException_1 = __nccwpck_require__(3166); +var DOMImpl_1 = __nccwpck_require__(14177); +var interfaces_1 = __nccwpck_require__(27305); +var EventTargetImpl_1 = __nccwpck_require__(69968); +var util_1 = __nccwpck_require__(65282); +var DOMException_1 = __nccwpck_require__(13166); var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); -var util_1 = __nccwpck_require__(5282); +var URLAlgorithm_1 = __nccwpck_require__(53568); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** - * Represents a live range. + * Represents a generic XML node. */ -var RangeImpl = /** @class */ (function (_super) { - __extends(RangeImpl, _super); +var NodeImpl = /** @class */ (function (_super) { + __extends(NodeImpl, _super); /** - * Initializes a new instance of `Range`. + * Initializes a new instance of `Node`. */ - function RangeImpl() { + function NodeImpl() { var _this = _super.call(this) || this; - /** - * The Range() constructor, when invoked, must return a new live range with - * (current global object’s associated Document, 0) as its start and end. - */ - var doc = DOMImpl_1.dom.window._associatedDocument; - _this._start = [doc, 0]; - _this._end = [doc, 0]; - DOMImpl_1.dom.rangeList.add(_this); + _this._parent = null; + _this._firstChild = null; + _this._lastChild = null; + _this._previousSibling = null; + _this._nextSibling = null; return _this; } - Object.defineProperty(RangeImpl.prototype, "commonAncestorContainer", { + Object.defineProperty(NodeImpl.prototype, "_childNodes", { + get: function () { + return this.__childNodes || (this.__childNodes = algorithm_1.create_nodeList(this)); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "_nodeDocument", { + get: function () { return this._nodeDocumentOverride || DOMImpl_1.dom.window._associatedDocument; }, + set: function (val) { this._nodeDocumentOverride = val; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "_registeredObserverList", { + get: function () { + return this.__registeredObserverList || (this.__registeredObserverList = []); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "nodeType", { /** @inheritdoc */ + get: function () { return this._nodeType; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "nodeName", { + /** + * Returns a string appropriate for the type of node. + */ get: function () { - /** - * 1. Let container be start node. - * 2. While container is not an inclusive ancestor of end node, let - * container be container’s parent. - * 3. Return container. - */ - var container = this._start[0]; - while (!algorithm_1.tree_isAncestorOf(this._end[0], container, true)) { - if (container._parent === null) { - throw new Error("Parent node is null."); - } - container = container._parent; + if (util_1.Guard.isElementNode(this)) { + return this._htmlUppercasedQualifiedName; + } + else if (util_1.Guard.isAttrNode(this)) { + return this._qualifiedName; + } + else if (util_1.Guard.isExclusiveTextNode(this)) { + return "#text"; + } + else if (util_1.Guard.isCDATASectionNode(this)) { + return "#cdata-section"; + } + else if (util_1.Guard.isProcessingInstructionNode(this)) { + return this._target; + } + else if (util_1.Guard.isCommentNode(this)) { + return "#comment"; + } + else if (util_1.Guard.isDocumentNode(this)) { + return "#document"; + } + else if (util_1.Guard.isDocumentTypeNode(this)) { + return this._name; + } + else if (util_1.Guard.isDocumentFragmentNode(this)) { + return "#document-fragment"; + } + else { + return ""; } - return container; }, enumerable: true, configurable: true }); - /** @inheritdoc */ - RangeImpl.prototype.setStart = function (node, offset) { + Object.defineProperty(NodeImpl.prototype, "baseURI", { /** - * The setStart(node, offset) method, when invoked, must set the start of - * context object to boundary point (node, offset). + * Gets the absolute base URL of the node. */ - algorithm_1.range_setTheStart(this, node, offset); - }; - /** @inheritdoc */ - RangeImpl.prototype.setEnd = function (node, offset) { + get: function () { + /** + * The baseURI attribute’s getter must return node document’s document + * base URL, serialized. + * TODO: Implement in HTML DOM + * https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url + */ + return URLAlgorithm_1.urlSerializer(this._nodeDocument._URL); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "isConnected", { /** - * The setEnd(node, offset) method, when invoked, must set the end of - * context object to boundary point (node, offset). + * Returns whether the node is rooted to a document node. */ - algorithm_1.range_setTheEnd(this, node, offset); - }; - /** @inheritdoc */ - RangeImpl.prototype.setStartBefore = function (node) { + get: function () { + /** + * The isConnected attribute’s getter must return true, if context object + * is connected, and false otherwise. + */ + return util_1.Guard.isElementNode(this) && algorithm_1.shadowTree_isConnected(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "ownerDocument", { /** - * 1. Let parent be node’s parent. - * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. - * 3. Set the start of the context object to boundary point - * (parent, node’s index). - */ - var parent = node._parent; - if (parent === null) - throw new DOMException_1.InvalidNodeTypeError(); - algorithm_1.range_setTheStart(this, parent, algorithm_1.tree_index(node)); - }; - /** @inheritdoc */ - RangeImpl.prototype.setStartAfter = function (node) { - /** - * 1. Let parent be node’s parent. - * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. - * 3. Set the start of the context object to boundary point - * (parent, node’s index plus 1). - */ - var parent = node._parent; - if (parent === null) - throw new DOMException_1.InvalidNodeTypeError(); - algorithm_1.range_setTheStart(this, parent, algorithm_1.tree_index(node) + 1); - }; - /** @inheritdoc */ - RangeImpl.prototype.setEndBefore = function (node) { - /** - * 1. Let parent be node’s parent. - * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. - * 3. Set the end of the context object to boundary point - * (parent, node’s index). + * Returns the parent document. */ - var parent = node._parent; - if (parent === null) - throw new DOMException_1.InvalidNodeTypeError(); - algorithm_1.range_setTheEnd(this, parent, algorithm_1.tree_index(node)); - }; - /** @inheritdoc */ - RangeImpl.prototype.setEndAfter = function (node) { + get: function () { + /** + * The ownerDocument attribute’s getter must return null, if the context + * object is a document, and the context object’s node document otherwise. + * _Note:_ The node document of a document is that document itself. All + * nodes have a node document at all times. + */ + if (this._nodeType === interfaces_1.NodeType.Document) + return null; + else + return this._nodeDocument; + }, + enumerable: true, + configurable: true + }); + /** + * Returns the root node. + * + * @param options - if options has `composed = true` this function + * returns the node's shadow-including root, otherwise it returns + * the node's root node. + */ + NodeImpl.prototype.getRootNode = function (options) { /** - * 1. Let parent be node’s parent. - * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. - * 3. Set the end of the context object to boundary point - * (parent, node’s index plus 1). + * The getRootNode(options) method, when invoked, must return context + * object’s shadow-including root if options’s composed is true, + * and context object’s root otherwise. */ - var parent = node._parent; - if (parent === null) - throw new DOMException_1.InvalidNodeTypeError(); - algorithm_1.range_setTheEnd(this, parent, algorithm_1.tree_index(node) + 1); + return algorithm_1.tree_rootNode(this, !!options && options.composed); }; - /** @inheritdoc */ - RangeImpl.prototype.collapse = function (toStart) { + Object.defineProperty(NodeImpl.prototype, "parentNode", { /** - * The collapse(toStart) method, when invoked, must if toStart is true, - * set end to start, and set start to end otherwise. + * Returns the parent node. */ - if (toStart) { - this._end = this._start; - } - else { - this._start = this._end; - } - }; - /** @inheritdoc */ - RangeImpl.prototype.selectNode = function (node) { + get: function () { + /** + * The parentNode attribute’s getter must return the context object’s parent. + * _Note:_ An Attr node has no parent. + */ + if (this._nodeType === interfaces_1.NodeType.Attribute) { + return null; + } + else { + return this._parent; + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "parentElement", { /** - * The selectNode(node) method, when invoked, must select node within - * context object. + * Returns the parent element. */ - algorithm_1.range_select(node, this); - }; - /** @inheritdoc */ - RangeImpl.prototype.selectNodeContents = function (node) { + get: function () { + /** + * The parentElement attribute’s getter must return the context object’s + * parent element. + */ + if (this._parent && util_1.Guard.isElementNode(this._parent)) { + return this._parent; + } + else { + return null; + } + }, + enumerable: true, + configurable: true + }); + /** + * Determines whether a node has any children. + */ + NodeImpl.prototype.hasChildNodes = function () { /** - * 1. If node is a doctype, throw an "InvalidNodeTypeError" DOMException. - * 2. Let length be the length of node. - * 3. Set start to the boundary point (node, 0). - * 4. Set end to the boundary point (node, length). + * The hasChildNodes() method, when invoked, must return true if the context + * object has children, and false otherwise. */ - if (util_1.Guard.isDocumentTypeNode(node)) - throw new DOMException_1.InvalidNodeTypeError(); - var length = algorithm_1.tree_nodeLength(node); - this._start = [node, 0]; - this._end = [node, length]; + return (this._firstChild !== null); }; - /** @inheritdoc */ - RangeImpl.prototype.compareBoundaryPoints = function (how, sourceRange) { + Object.defineProperty(NodeImpl.prototype, "childNodes", { /** - * 1. If how is not one of - * - START_TO_START, - * - START_TO_END, - * - END_TO_END, and - * - END_TO_START, - * then throw a "NotSupportedError" DOMException. + * Returns a {@link NodeList} of child nodes. */ - if (how !== interfaces_1.HowToCompare.StartToStart && how !== interfaces_1.HowToCompare.StartToEnd && - how !== interfaces_1.HowToCompare.EndToEnd && how !== interfaces_1.HowToCompare.EndToStart) - throw new DOMException_1.NotSupportedError(); + get: function () { + /** + * The childNodes attribute’s getter must return a NodeList rooted at the + * context object matching only children. + */ + return this._childNodes; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "firstChild", { /** - * 2. If context object’s root is not the same as sourceRange’s root, - * then throw a "WrongDocumentError" DOMException. + * Returns the first child node. */ - if (algorithm_1.range_root(this) !== algorithm_1.range_root(sourceRange)) - throw new DOMException_1.WrongDocumentError(); + get: function () { + /** + * The firstChild attribute’s getter must return the context object’s first + * child. + */ + return this._firstChild; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "lastChild", { /** - * 3. If how is: - * - START_TO_START: - * Let this point be the context object’s start. Let other point be - * sourceRange’s start. - * - START_TO_END: - * Let this point be the context object’s end. Let other point be - * sourceRange’s start. - * - END_TO_END: - * Let this point be the context object’s end. Let other point be - * sourceRange’s end. - * - END_TO_START: - * Let this point be the context object’s start. Let other point be - * sourceRange’s end. + * Returns the last child node. */ - var thisPoint; - var otherPoint; - switch (how) { - case interfaces_1.HowToCompare.StartToStart: - thisPoint = this._start; - otherPoint = sourceRange._start; - break; - case interfaces_1.HowToCompare.StartToEnd: - thisPoint = this._end; - otherPoint = sourceRange._start; - break; - case interfaces_1.HowToCompare.EndToEnd: - thisPoint = this._end; - otherPoint = sourceRange._end; - break; - case interfaces_1.HowToCompare.EndToStart: - thisPoint = this._start; - otherPoint = sourceRange._end; - break; - /* istanbul ignore next */ - default: - throw new DOMException_1.NotSupportedError(); - } + get: function () { + /** + * The lastChild attribute’s getter must return the context object’s last + * child. + */ + return this._lastChild; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "previousSibling", { /** - * 4. If the position of this point relative to other point is - * - before - * Return −1. - * - equal - * Return 0. - * - after - * Return 1. + * Returns the previous sibling node. */ - var position = algorithm_1.boundaryPoint_position(thisPoint, otherPoint); - if (position === interfaces_1.BoundaryPosition.Before) { - return -1; - } - else if (position === interfaces_1.BoundaryPosition.After) { - return 1; - } - else { - return 0; - } - }; - /** @inheritdoc */ - RangeImpl.prototype.deleteContents = function () { - var e_1, _a, e_2, _b; + get: function () { + /** + * The previousSibling attribute’s getter must return the context object’s + * previous sibling. + * _Note:_ An Attr node has no siblings. + */ + return this._previousSibling; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "nextSibling", { /** - * 1. If the context object is collapsed, then return. - * 2. Let original start node, original start offset, original end node, - * and original end offset be the context object’s start node, - * start offset, end node, and end offset, respectively. + * Returns the next sibling node. */ - if (algorithm_1.range_collapsed(this)) - return; - var originalStartNode = this._startNode; - var originalStartOffset = this._startOffset; - var originalEndNode = this._endNode; - var originalEndOffset = this._endOffset; + get: function () { + /** + * The nextSibling attribute’s getter must return the context object’s + * next sibling. + */ + return this._nextSibling; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "nodeValue", { /** - * 3. If original start node and original end node are the same, and they - * are a Text, ProcessingInstruction, or Comment node, replace data with - * node original start node, offset original start offset, count original - * end offset minus original start offset, and data the empty string, - * and then return. + * Gets or sets the data associated with a {@link CharacterData} node or the + * value of an {@link @Attr} node. For other node types returns `null`. */ - if (originalStartNode === originalEndNode && - util_1.Guard.isCharacterDataNode(originalStartNode)) { - algorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset, ''); - return; - } + get: function () { + if (util_1.Guard.isAttrNode(this)) { + return this._value; + } + else if (util_1.Guard.isCharacterDataNode(this)) { + return this._data; + } + else { + return null; + } + }, + set: function (value) { + if (value === null) { + value = ''; + } + if (util_1.Guard.isAttrNode(this)) { + algorithm_1.attr_setAnExistingAttributeValue(this, value); + } + else if (util_1.Guard.isCharacterDataNode(this)) { + algorithm_1.characterData_replaceData(this, 0, this._data.length, value); + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "textContent", { /** - * 4. Let nodes to remove be a list of all the nodes that are contained in - * the context object, in tree order, omitting any node whose parent is also - * contained in the context object. + * Returns the concatenation of data of all the {@link Text} + * node descendants in tree order. When set, replaces the text + * contents of the node with the given value. */ - var nodesToRemove = []; - try { - for (var _c = __values(algorithm_1.range_getContainedNodes(this)), _d = _c.next(); !_d.done; _d = _c.next()) { - var node = _d.value; - var parent = node._parent; - if (parent !== null && algorithm_1.range_isContained(parent, this)) { - continue; - } - nodesToRemove.push(node); + get: function () { + if (util_1.Guard.isDocumentFragmentNode(this) || util_1.Guard.isElementNode(this)) { + return algorithm_1.text_descendantTextContent(this); } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + else if (util_1.Guard.isAttrNode(this)) { + return this._value; } - finally { if (e_1) throw e_1.error; } - } - var newNode; - var newOffset; - if (algorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { - /** - * 5. If original start node is an inclusive ancestor of original end - * node, set new node to original start node and new offset to original - * start offset. - */ - newNode = originalStartNode; - newOffset = originalStartOffset; - } - else { - /** - * 6. Otherwise: - * 6.1. Let reference node equal original start node. - * 6.2. While reference node’s parent is not null and is not an inclusive - * ancestor of original end node, set reference node to its parent. - * 6.3. Set new node to the parent of reference node, and new offset to - * one plus the index of reference node. - */ - var referenceNode = originalStartNode; - while (referenceNode._parent !== null && - !algorithm_1.tree_isAncestorOf(originalEndNode, referenceNode._parent, true)) { - referenceNode = referenceNode._parent; + else if (util_1.Guard.isCharacterDataNode(this)) { + return this._data; } - /* istanbul ignore next */ - if (referenceNode._parent === null) { - throw new Error("Parent node is null."); + else { + return null; } - newNode = referenceNode._parent; - newOffset = algorithm_1.tree_index(referenceNode) + 1; - } + }, + set: function (value) { + if (value === null) { + value = ''; + } + if (util_1.Guard.isDocumentFragmentNode(this) || util_1.Guard.isElementNode(this)) { + algorithm_1.node_stringReplaceAll(value, this); + } + else if (util_1.Guard.isAttrNode(this)) { + algorithm_1.attr_setAnExistingAttributeValue(this, value); + } + else if (util_1.Guard.isCharacterDataNode(this)) { + algorithm_1.characterData_replaceData(this, 0, algorithm_1.tree_nodeLength(this), value); + } + }, + enumerable: true, + configurable: true + }); + /** + * Puts all {@link Text} nodes in the full depth of the sub-tree + * underneath this node into a "normal" form where only markup + * (e.g., tags, comments, processing instructions, CDATA sections, + * and entity references) separates {@link Text} nodes, i.e., there + * are no adjacent Text nodes. + */ + NodeImpl.prototype.normalize = function () { + var e_1, _a, e_2, _b; /** - * 7. If original start node is a Text, ProcessingInstruction, or Comment - * node, replace data with node original start node, offset original start - * offset, count original start node’s length minus original start offset, - * data the empty string. + * The normalize() method, when invoked, must run these steps for each + * descendant exclusive Text node node of context object: */ - if (util_1.Guard.isCharacterDataNode(originalStartNode)) { - algorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, algorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset, ''); + var descendantNodes = []; + var node = algorithm_1.tree_getFirstDescendantNode(this, false, false, function (e) { return util_1.Guard.isExclusiveTextNode(e); }); + while (node !== null) { + descendantNodes.push(node); + node = algorithm_1.tree_getNextDescendantNode(this, node, false, false, function (e) { return util_1.Guard.isExclusiveTextNode(e); }); } - try { + for (var i = 0; i < descendantNodes.length; i++) { + var node_1 = descendantNodes[i]; + if (node_1._parent === null) + continue; /** - * 8. For each node in nodes to remove, in tree order, remove node from its - * parent. + * 1. Let length be node’s length. + * 2. If length is zero, then remove node and continue with the next + * exclusive Text node, if any. */ - for (var nodesToRemove_1 = __values(nodesToRemove), nodesToRemove_1_1 = nodesToRemove_1.next(); !nodesToRemove_1_1.done; nodesToRemove_1_1 = nodesToRemove_1.next()) { - var node = nodesToRemove_1_1.value; - /* istanbul ignore else */ - if (node._parent) { - algorithm_1.mutation_remove(node, node._parent); - } - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (nodesToRemove_1_1 && !nodesToRemove_1_1.done && (_b = nodesToRemove_1.return)) _b.call(nodesToRemove_1); + var length = algorithm_1.tree_nodeLength(node_1); + if (length === 0) { + algorithm_1.mutation_remove(node_1, node_1._parent); + continue; } - finally { if (e_2) throw e_2.error; } - } - /** - * 9. If original end node is a Text, ProcessingInstruction, or Comment - * node, replace data with node original end node, offset 0, count original - * end offset and data the empty string. - */ - if (util_1.Guard.isCharacterDataNode(originalEndNode)) { - algorithm_1.characterData_replaceData(originalEndNode, 0, originalEndOffset, ''); - } - /** - * 10. Set start and end to (new node, new offset). - */ - this._start = [newNode, newOffset]; - this._end = [newNode, newOffset]; - }; - /** @inheritdoc */ - RangeImpl.prototype.extractContents = function () { - /** - * The extractContents() method, when invoked, must return the result of - * extracting the context object. - */ - return algorithm_1.range_extract(this); - }; - /** @inheritdoc */ - RangeImpl.prototype.cloneContents = function () { - /** - * The cloneContents() method, when invoked, must return the result of - * cloning the contents of the context object. - */ - return algorithm_1.range_cloneTheContents(this); - }; - /** @inheritdoc */ - RangeImpl.prototype.insertNode = function (node) { - /** - * The insertNode(node) method, when invoked, must insert node into the - * context object. - */ - return algorithm_1.range_insert(node, this); - }; - /** @inheritdoc */ - RangeImpl.prototype.surroundContents = function (newParent) { - var e_3, _a; - try { /** - * 1. If a non-Text node is partially contained in the context object, then - * throw an "InvalidStateError" DOMException. + * 3. Let data be the concatenation of the data of node’s contiguous + * exclusive Text nodes (excluding itself), in tree order. */ - for (var _b = __values(algorithm_1.range_getPartiallyContainedNodes(this)), _c = _b.next(); !_c.done; _c = _b.next()) { - var node = _c.value; - if (!util_1.Guard.isTextNode(node)) { - throw new DOMException_1.InvalidStateError(); + var textSiblings = []; + var data = ''; + try { + for (var _c = (e_1 = void 0, __values(algorithm_1.text_contiguousExclusiveTextNodes(node_1))), _d = _c.next(); !_d.done; _d = _c.next()) { + var sibling = _d.value; + textSiblings.push(sibling); + data += sibling._data; } } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + } + finally { if (e_1) throw e_1.error; } + } + /** + * 4. Replace data with node node, offset length, count 0, and data data. + */ + algorithm_1.characterData_replaceData(node_1, length, 0, data); + /** + * 5. Let currentNode be node’s next sibling. + * 6. While currentNode is an exclusive Text node: + */ + if (DOMImpl_1.dom.rangeList.size !== 0) { + var currentNode = node_1._nextSibling; + while (currentNode !== null && util_1.Guard.isExclusiveTextNode(currentNode)) { + /** + * 6.1. For each live range whose start node is currentNode, add length + * to its start offset and set its start node to node. + * 6.2. For each live range whose end node is currentNode, add length to + * its end offset and set its end node to node. + * 6.3. For each live range whose start node is currentNode’s parent and + * start offset is currentNode’s index, set its start node to node and + * its start offset to length. + * 6.4. For each live range whose end node is currentNode’s parent and + * end offset is currentNode’s index, set its end node to node and its + * end offset to length. + */ + var cn = currentNode; + var index = algorithm_1.tree_index(cn); + try { + for (var _e = (e_2 = void 0, __values(DOMImpl_1.dom.rangeList)), _f = _e.next(); !_f.done; _f = _e.next()) { + var range = _f.value; + if (range._start[0] === cn) { + range._start[0] = node_1; + range._start[1] += length; + } + if (range._end[0] === cn) { + range._end[0] = node_1; + range._end[1] += length; + } + if (range._start[0] === cn._parent && range._start[1] === index) { + range._start[0] = node_1; + range._start[1] = length; + } + if (range._end[0] === cn._parent && range._end[1] === index) { + range._end[0] = node_1; + range._end[1] = length; + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_f && !_f.done && (_b = _e.return)) _b.call(_e); + } + finally { if (e_2) throw e_2.error; } + } + /** + * 6.5. Add currentNode’s length to length. + * 6.6. Set currentNode to its next sibling. + */ + length += algorithm_1.tree_nodeLength(currentNode); + currentNode = currentNode._nextSibling; + } + } + /** + * 7. Remove node’s contiguous exclusive Text nodes (excluding itself), + * in tree order. + */ + for (var i_1 = 0; i_1 < textSiblings.length; i_1++) { + var sibling = textSiblings[i_1]; + if (sibling._parent === null) + continue; + algorithm_1.mutation_remove(sibling, sibling._parent); } - finally { if (e_3) throw e_3.error; } - } - /** - * 2. If newParent is a Document, DocumentType, or DocumentFragment node, - * then throw an "InvalidNodeTypeError" DOMException. - */ - if (util_1.Guard.isDocumentNode(newParent) || - util_1.Guard.isDocumentTypeNode(newParent) || - util_1.Guard.isDocumentFragmentNode(newParent)) { - throw new DOMException_1.InvalidNodeTypeError(); - } - /** - * 3. Let fragment be the result of extracting the context object. - */ - var fragment = algorithm_1.range_extract(this); - /** - * 4. If newParent has children, then replace all with null within newParent. - */ - if ((newParent)._children.size !== 0) { - algorithm_1.mutation_replaceAll(null, newParent); } - /** - * 5. Insert newParent into the context object. - * 6. Append fragment to newParent. - */ - algorithm_1.range_insert(newParent, this); - algorithm_1.mutation_append(fragment, newParent); - /** - * 7. Select newParent within the context object. - */ - algorithm_1.range_select(newParent, this); }; - /** @inheritdoc */ - RangeImpl.prototype.cloneRange = function () { + /** + * Returns a duplicate of this node, i.e., serves as a generic copy + * constructor for nodes. The duplicate node has no parent + * ({@link parentNode} returns `null`). + * + * @param deep - if `true`, recursively clone the subtree under the + * specified node. If `false`, clone only the node itself (and its + * attributes, if it is an {@link Element}). + */ + NodeImpl.prototype.cloneNode = function (deep) { + if (deep === void 0) { deep = false; } /** - * The cloneRange() method, when invoked, must return a new live range with - * the same start and end as the context object. + * 1. If context object is a shadow root, then throw a "NotSupportedError" + * DOMException. + * 2. Return a clone of the context object, with the clone children flag set + * if deep is true. */ - return algorithm_1.create_range(this._start, this._end); + if (util_1.Guard.isShadowRoot(this)) + throw new DOMException_1.NotSupportedError(); + return algorithm_1.node_clone(this, null, deep); }; - /** @inheritdoc */ - RangeImpl.prototype.detach = function () { + /** + * Determines if the given node is equal to this one. + * + * @param node - the node to compare with + */ + NodeImpl.prototype.isEqualNode = function (node) { + if (node === void 0) { node = null; } /** - * The detach() method, when invoked, must do nothing. - * - * since JS lacks weak references, we still use detach + * The isEqualNode(otherNode) method, when invoked, must return true if + * otherNode is non-null and context object equals otherNode, and false + * otherwise. */ - DOMImpl_1.dom.rangeList.delete(this); + return (node !== null && algorithm_1.node_equals(this, node)); }; - /** @inheritdoc */ - RangeImpl.prototype.isPointInRange = function (node, offset) { - /** - * 1. If node’s root is different from the context object’s root, return false. - */ - if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) { - return false; - } - /** - * 2. If node is a doctype, then throw an "InvalidNodeTypeError" DOMException. - * 3. If offset is greater than node’s length, then throw an - * "IndexSizeError" DOMException. - */ - if (util_1.Guard.isDocumentTypeNode(node)) - throw new DOMException_1.InvalidNodeTypeError(); - if (offset > algorithm_1.tree_nodeLength(node)) - throw new DOMException_1.IndexSizeError(); - /** - * 4. If (node, offset) is before start or after end, return false. - */ - var bp = [node, offset]; - if (algorithm_1.boundaryPoint_position(bp, this._start) === interfaces_1.BoundaryPosition.Before || - algorithm_1.boundaryPoint_position(bp, this._end) === interfaces_1.BoundaryPosition.After) { - return false; - } + /** + * Determines if the given node is reference equal to this one. + * + * @param node - the node to compare with + */ + NodeImpl.prototype.isSameNode = function (node) { + if (node === void 0) { node = null; } /** - * 5. Return true. + * The isSameNode(otherNode) method, when invoked, must return true if + * otherNode is context object, and false otherwise. */ - return true; + return (this === node); }; - /** @inheritdoc */ - RangeImpl.prototype.comparePoint = function (node, offset) { + /** + * Returns a bitmask indicating the position of the given `node` + * relative to this node. + */ + NodeImpl.prototype.compareDocumentPosition = function (other) { /** - * 1. If node’s root is different from the context object’s root, then throw - * a "WrongDocumentError" DOMException. - * 2. If node is a doctype, then throw an "InvalidNodeTypeError" DOMException. - * 3. If offset is greater than node’s length, then throw an - * "IndexSizeError" DOMException. + * 1. If context object is other, then return zero. + * 2. Let node1 be other and node2 be context object. + * 3. Let attr1 and attr2 be null. + * attr1’s element. */ - if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) - throw new DOMException_1.WrongDocumentError(); - if (util_1.Guard.isDocumentTypeNode(node)) - throw new DOMException_1.InvalidNodeTypeError(); - if (offset > algorithm_1.tree_nodeLength(node)) - throw new DOMException_1.IndexSizeError(); + if (other === this) + return 0; + var node1 = other; + var node2 = this; + var attr1 = null; + var attr2 = null; /** - * 4. If (node, offset) is before start, return −1. - * 5. If (node, offset) is after end, return 1. - * 6. Return 0. + * 4. If node1 is an attribute, then set attr1 to node1 and node1 to + * attr1’s element. */ - var bp = [node, offset]; - if (algorithm_1.boundaryPoint_position(bp, this._start) === interfaces_1.BoundaryPosition.Before) { - return -1; - } - else if (algorithm_1.boundaryPoint_position(bp, this._end) === interfaces_1.BoundaryPosition.After) { - return 1; - } - else { - return 0; + if (util_1.Guard.isAttrNode(node1)) { + attr1 = node1; + node1 = attr1._element; } - }; - /** @inheritdoc */ - RangeImpl.prototype.intersectsNode = function (node) { /** - * 1. If node’s root is different from the context object’s root, return false. + * 5. If node2 is an attribute, then: */ - if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) { - return false; + if (util_1.Guard.isAttrNode(node2)) { + /** + * 5.1. Set attr2 to node2 and node2 to attr2’s element. + */ + attr2 = node2; + node2 = attr2._element; + /** + * 5.2. If attr1 and node1 are non-null, and node2 is node1, then: + */ + if (attr1 && node1 && (node1 === node2)) { + /** + * 5.2. For each attr in node2’s attribute list: + */ + for (var i = 0; i < node2._attributeList.length; i++) { + var attr = node2._attributeList[i]; + /** + * 5.2.1. If attr equals attr1, then return the result of adding + * DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and + * DOCUMENT_POSITION_PRECEDING. + * 5.2.2. If attr equals attr2, then return the result of adding + * DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and + * DOCUMENT_POSITION_FOLLOWING. + */ + if (algorithm_1.node_equals(attr, attr1)) { + return interfaces_1.Position.ImplementationSpecific | interfaces_1.Position.Preceding; + } + else if (algorithm_1.node_equals(attr, attr2)) { + return interfaces_1.Position.ImplementationSpecific | interfaces_1.Position.Following; + } + } + } } /** - * 2. Let parent be node’s parent. - * 3. If parent is null, return true. + * 6. If node1 or node2 is null, or node1’s root is not node2’s root, then + * return the result of adding DOCUMENT_POSITION_DISCONNECTED, + * DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, and either + * DOCUMENT_POSITION_PRECEDING or DOCUMENT_POSITION_FOLLOWING, + * with the constraint that this is to be consistent, together. */ - var parent = node._parent; - if (parent === null) - return true; + if (node1 === null || node2 === null || + algorithm_1.tree_rootNode(node1) !== algorithm_1.tree_rootNode(node2)) { + // nodes are disconnected + // return a random result but cache the value for consistency + return interfaces_1.Position.Disconnected | interfaces_1.Position.ImplementationSpecific | + (DOMImpl_1.dom.compareCache.check(this, other) ? interfaces_1.Position.Preceding : interfaces_1.Position.Following); + } /** - * 4. Let offset be node’s index. + * 7. If node1 is an ancestor of node2 and attr1 is null, or node1 is node2 + * and attr2 is non-null, then return the result of adding + * DOCUMENT_POSITION_CONTAINS to DOCUMENT_POSITION_PRECEDING. */ - var offset = algorithm_1.tree_index(node); + if ((!attr1 && algorithm_1.tree_isAncestorOf(node2, node1)) || + (attr2 && (node1 === node2))) { + return interfaces_1.Position.Contains | interfaces_1.Position.Preceding; + } /** - * 5. If (parent, offset) is before end and (parent, offset plus 1) is - * after start, return true. + * 8. If node1 is a descendant of node2 and attr2 is null, or node1 is node2 + * and attr1 is non-null, then return the result of adding + * DOCUMENT_POSITION_CONTAINED_BY to DOCUMENT_POSITION_FOLLOWING. */ - if (algorithm_1.boundaryPoint_position([parent, offset], this._end) === interfaces_1.BoundaryPosition.Before && - algorithm_1.boundaryPoint_position([parent, offset + 1], this._start) === interfaces_1.BoundaryPosition.After) { - return true; + if ((!attr2 && algorithm_1.tree_isDescendantOf(node2, node1)) || + (attr1 && (node1 === node2))) { + return interfaces_1.Position.ContainedBy | interfaces_1.Position.Following; } /** - * 6. Return false. + * 9. If node1 is preceding node2, then return DOCUMENT_POSITION_PRECEDING. */ - return false; - }; - RangeImpl.prototype.toString = function () { - var e_4, _a; + if (algorithm_1.tree_isPreceding(node2, node1)) + return interfaces_1.Position.Preceding; /** - * 1. Let s be the empty string. + * 10. Return DOCUMENT_POSITION_FOLLOWING. */ - var s = ''; + return interfaces_1.Position.Following; + }; + /** + * Returns `true` if given node is an inclusive descendant of this + * node, and `false` otherwise (including when other node is `null`). + * + * @param other - the node to check + */ + NodeImpl.prototype.contains = function (other) { /** - * 2. If the context object’s start node is the context object’s end node - * and it is a Text node, then return the substring of that Text node’s data - * beginning at the context object’s start offset and ending at the context - * object’s end offset. + * The contains(other) method, when invoked, must return true if other is an + * inclusive descendant of context object, and false otherwise (including + * when other is null). */ - if (this._startNode === this._endNode && util_1.Guard.isTextNode(this._startNode)) { - return this._startNode._data.substring(this._startOffset, this._endOffset); - } + if (other === null) + return false; + return algorithm_1.tree_isDescendantOf(this, other, true); + }; + /** + * Returns the prefix for a given namespace URI, if present, and + * `null` if not. + * + * @param namespace - the namespace to search + */ + NodeImpl.prototype.lookupPrefix = function (namespace) { /** - * 3. If the context object’s start node is a Text node, then append the - * substring of that node’s data from the context object’s start offset - * until the end to s. + * 1. If namespace is null or the empty string, then return null. + * 2. Switch on the context object: */ - if (util_1.Guard.isTextNode(this._startNode)) { - s += this._startNode._data.substring(this._startOffset); + if (!namespace) + return null; + if (util_1.Guard.isElementNode(this)) { + /** + * Return the result of locating a namespace prefix for it using + * namespace. + */ + return algorithm_1.node_locateANamespacePrefix(this, namespace); } - try { + else if (util_1.Guard.isDocumentNode(this)) { /** - * 4. Append the concatenation of the data of all Text nodes that are - * contained in the context object, in tree order, to s. + * Return the result of locating a namespace prefix for its document + * element, if its document element is non-null, and null otherwise. */ - for (var _b = __values(algorithm_1.range_getContainedNodes(this)), _c = _b.next(); !_c.done; _c = _b.next()) { - var child = _c.value; - if (util_1.Guard.isTextNode(child)) { - s += child._data; - } + if (this.documentElement === null) { + return null; + } + else { + return algorithm_1.node_locateANamespacePrefix(this.documentElement, namespace); } } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + else if (util_1.Guard.isDocumentTypeNode(this) || util_1.Guard.isDocumentFragmentNode(this)) { + return null; + } + else if (util_1.Guard.isAttrNode(this)) { + /** + * Return the result of locating a namespace prefix for its element, + * if its element is non-null, and null otherwise. + */ + if (this._element === null) { + return null; + } + else { + return algorithm_1.node_locateANamespacePrefix(this._element, namespace); } - finally { if (e_4) throw e_4.error; } } - /** - * 5. If the context object’s end node is a Text node, then append the - * substring of that node’s data from its start until the context object’s - * end offset to s. - */ - if (util_1.Guard.isTextNode(this._endNode)) { - s += this._endNode._data.substring(0, this._endOffset); + else { + /** + * Return the result of locating a namespace prefix for its parent + * element, if its parent element is non-null, and null otherwise. + */ + if (this._parent !== null && util_1.Guard.isElementNode(this._parent)) { + return algorithm_1.node_locateANamespacePrefix(this._parent, namespace); + } + else { + return null; + } } + }; + /** + * Returns the namespace URI for a given prefix if present, and `null` + * if not. + * + * @param prefix - the prefix to search + */ + NodeImpl.prototype.lookupNamespaceURI = function (prefix) { /** - * 6. Return s. + * 1. If prefix is the empty string, then set it to null. + * 2. Return the result of running locate a namespace for the context object + * using prefix. */ - return s; + return algorithm_1.node_locateANamespace(this, prefix || null); }; /** - * Creates a new `Range`. + * Returns `true` if the namespace is the default namespace on this + * node or `false` if not. * - * @param start - start point - * @param end - end point + * @param namespace - the namespace to check */ - RangeImpl._create = function (start, end) { - var range = new RangeImpl(); - if (start) - range._start = start; - if (end) - range._end = end; - return range; - }; - RangeImpl.START_TO_START = 0; - RangeImpl.START_TO_END = 1; - RangeImpl.END_TO_END = 2; - RangeImpl.END_TO_START = 3; - return RangeImpl; -}(AbstractRangeImpl_1.AbstractRangeImpl)); -exports.RangeImpl = RangeImpl; -/** - * Define constants on prototype. - */ -WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "START_TO_START", 0); -WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "START_TO_END", 1); -WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "END_TO_END", 2); -WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "END_TO_START", 3); -//# sourceMappingURL=RangeImpl.js.map - -/***/ }), - -/***/ 1911: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + NodeImpl.prototype.isDefaultNamespace = function (namespace) { + /** + * 1. If namespace is the empty string, then set it to null. + * 2. Let defaultNamespace be the result of running locate a namespace for + * context object using null. + * 3. Return true if defaultNamespace is the same as namespace, and false otherwise. + */ + if (!namespace) + namespace = null; + var defaultNamespace = algorithm_1.node_locateANamespace(this, null); + return (defaultNamespace === namespace); }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var DocumentFragmentImpl_1 = __nccwpck_require__(2585); -var util_1 = __nccwpck_require__(6195); -var algorithm_1 = __nccwpck_require__(61); -/** - * Represents a shadow root. - */ -var ShadowRootImpl = /** @class */ (function (_super) { - __extends(ShadowRootImpl, _super); /** - * Initializes a new instance of `ShadowRoot`. + * Inserts the node `newChild` before the existing child node + * `refChild`. If `refChild` is `null`, inserts `newChild` at the end + * of the list of children. * - * @param host - shadow root's host element - * @param mode - shadow root's mode + * If `newChild` is a {@link DocumentFragment} object, all of its + * children are inserted, in the same order, before `refChild`. + * + * If `newChild` is already in the tree, it is first removed. + * + * @param newChild - the node to insert + * @param refChild - the node before which the new node must be + * inserted + * + * @returns the newly inserted child node */ - function ShadowRootImpl(host, mode) { - var _this = _super.call(this) || this; - _this._host = host; - _this._mode = mode; - return _this; - } - Object.defineProperty(ShadowRootImpl.prototype, "mode", { - /** @inheritdoc */ - get: function () { return this._mode; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ShadowRootImpl.prototype, "host", { - /** @inheritdoc */ - get: function () { return this._host; }, - enumerable: true, - configurable: true - }); + NodeImpl.prototype.insertBefore = function (newChild, refChild) { + /** + * The insertBefore(node, child) method, when invoked, must return the + * result of pre-inserting node into context object before child. + */ + return algorithm_1.mutation_preInsert(newChild, this, refChild); + }; + /** + * Adds the node `newChild` to the end of the list of children of this + * node, and returns it. If `newChild` is already in the tree, it is + * first removed. + * + * If `newChild` is a {@link DocumentFragment} object, the entire + * contents of the document fragment are moved into the child list of + * this node. + * + * @param newChild - the node to add + * + * @returns the newly inserted child node + */ + NodeImpl.prototype.appendChild = function (newChild) { + /** + * The appendChild(node) method, when invoked, must return the result of + * appending node to context object. + */ + return algorithm_1.mutation_append(newChild, this); + }; + /** + * Replaces the child node `oldChild` with `newChild` in the list of + * children, and returns the `oldChild` node. If `newChild` is already + * in the tree, it is first removed. + * + * @param newChild - the new node to put in the child list + * @param oldChild - the node being replaced in the list + * + * @returns the removed child node + */ + NodeImpl.prototype.replaceChild = function (newChild, oldChild) { + /** + * The replaceChild(node, child) method, when invoked, must return the + * result of replacing child with node within context object. + */ + return algorithm_1.mutation_replace(oldChild, newChild, this); + }; + /** + * Removes the child node indicated by `oldChild` from the list of + * children, and returns it. + * + * @param oldChild - the node being removed from the list + * + * @returns the removed child node + */ + NodeImpl.prototype.removeChild = function (oldChild) { + /** + * The removeChild(child) method, when invoked, must return the result of + * pre-removing child from context object. + */ + return algorithm_1.mutation_preRemove(oldChild, this); + }; /** * Gets the parent event target for the given event. * * @param event - an event */ - ShadowRootImpl.prototype._getTheParent = function (event) { + NodeImpl.prototype._getTheParent = function (event) { /** - * A shadow root’s get the parent algorithm, given an event, returns null - * if event’s composed flag is unset and shadow root is the root of - * event’s path’s first struct’s invocation target, and shadow root’s host - * otherwise. + * A node’s get the parent algorithm, given an event, returns the node’s + * assigned slot, if node is assigned, and node’s parent otherwise. */ - if (!event._composedFlag && !util_1.isEmpty(event._path) && - algorithm_1.tree_rootNode(event._path[0].invocationTarget) === this) { - return null; + if (util_1.Guard.isSlotable(this) && algorithm_1.shadowTree_isAssigned(this)) { + return this._assignedSlot; } else { - return this._host; + return this._parent; } }; - // MIXIN: DocumentOrShadowRoot - // No elements - /** - * Creates a new `ShadowRoot`. - * - * @param document - owner document - * @param host - shadow root's host element - */ - ShadowRootImpl._create = function (document, host) { - return new ShadowRootImpl(host, "closed"); - }; - return ShadowRootImpl; -}(DocumentFragmentImpl_1.DocumentFragmentImpl)); -exports.ShadowRootImpl = ShadowRootImpl; -//# sourceMappingURL=ShadowRootImpl.js.map - -/***/ }), - -/***/ 1964: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var algorithm_1 = __nccwpck_require__(61); + NodeImpl.ELEMENT_NODE = 1; + NodeImpl.ATTRIBUTE_NODE = 2; + NodeImpl.TEXT_NODE = 3; + NodeImpl.CDATA_SECTION_NODE = 4; + NodeImpl.ENTITY_REFERENCE_NODE = 5; + NodeImpl.ENTITY_NODE = 6; + NodeImpl.PROCESSING_INSTRUCTION_NODE = 7; + NodeImpl.COMMENT_NODE = 8; + NodeImpl.DOCUMENT_NODE = 9; + NodeImpl.DOCUMENT_TYPE_NODE = 10; + NodeImpl.DOCUMENT_FRAGMENT_NODE = 11; + NodeImpl.NOTATION_NODE = 12; + NodeImpl.DOCUMENT_POSITION_DISCONNECTED = 0x01; + NodeImpl.DOCUMENT_POSITION_PRECEDING = 0x02; + NodeImpl.DOCUMENT_POSITION_FOLLOWING = 0x04; + NodeImpl.DOCUMENT_POSITION_CONTAINS = 0x08; + NodeImpl.DOCUMENT_POSITION_CONTAINED_BY = 0x10; + NodeImpl.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; + return NodeImpl; +}(EventTargetImpl_1.EventTargetImpl)); +exports.NodeImpl = NodeImpl; /** - * Represents a mixin that allows nodes to become the contents of - * a element. This mixin is implemented by {@link Element} and - * {@link Text}. + * A performance tweak to share an empty set between all node classes. This will + * be overwritten by element, document and document fragment nodes to supply an + * actual set of nodes. */ -var SlotableImpl = /** @class */ (function () { - function SlotableImpl() { - } - Object.defineProperty(SlotableImpl.prototype, "_name", { - get: function () { return this.__name || ''; }, - set: function (val) { this.__name = val; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SlotableImpl.prototype, "_assignedSlot", { - get: function () { return this.__assignedSlot || null; }, - set: function (val) { this.__assignedSlot = val; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SlotableImpl.prototype, "assignedSlot", { - /** @inheritdoc */ - get: function () { - return algorithm_1.shadowTree_findASlot(this, true); - }, - enumerable: true, - configurable: true - }); - return SlotableImpl; -}()); -exports.SlotableImpl = SlotableImpl; -//# sourceMappingURL=SlotableImpl.js.map +NodeImpl.prototype._children = new util_1.EmptySet(); +/** + * Define constants on prototype. + */ +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ELEMENT_NODE", 1); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ATTRIBUTE_NODE", 2); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "TEXT_NODE", 3); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "CDATA_SECTION_NODE", 4); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ENTITY_REFERENCE_NODE", 5); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ENTITY_NODE", 6); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "PROCESSING_INSTRUCTION_NODE", 7); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "COMMENT_NODE", 8); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_NODE", 9); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_TYPE_NODE", 10); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_FRAGMENT_NODE", 11); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "NOTATION_NODE", 12); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_DISCONNECTED", 0x01); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_PRECEDING", 0x02); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_FOLLOWING", 0x04); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_CONTAINS", 0x08); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_CONTAINED_BY", 0x10); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", 0x20); +//# sourceMappingURL=NodeImpl.js.map /***/ }), -/***/ 6357: +/***/ 61997: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -62765,60 +62795,85 @@ var __extends = (this && this.__extends) || (function () { }; })(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var AbstractRangeImpl_1 = __nccwpck_require__(7126); -var DOMException_1 = __nccwpck_require__(3166); -var util_1 = __nccwpck_require__(5282); +var TraverserImpl_1 = __nccwpck_require__(39782); +var algorithm_1 = __nccwpck_require__(61); /** - * Represents a static range. + * Represents an object which can be used to iterate through the nodes + * of a subtree. */ -var StaticRangeImpl = /** @class */ (function (_super) { - __extends(StaticRangeImpl, _super); +var NodeIteratorImpl = /** @class */ (function (_super) { + __extends(NodeIteratorImpl, _super); /** - * Initializes a new instance of `StaticRange`. + * Initializes a new instance of `NodeIterator`. */ - function StaticRangeImpl(init) { - var _this = _super.call(this) || this; - /** - * 1. If init’s startContainer or endContainer is a DocumentType or Attr - * node, then throw an "InvalidNodeTypeError" DOMException. - * 2. Let staticRange be a new StaticRange object. - * 3. Set staticRange’s start to (init’s startContainer, init’s startOffset) - * and end to (init’s endContainer, init’s endOffset). - * 4. Return staticRange. - */ - if (util_1.Guard.isDocumentTypeNode(init.startContainer) || util_1.Guard.isAttrNode(init.startContainer) || - util_1.Guard.isDocumentTypeNode(init.endContainer) || util_1.Guard.isAttrNode(init.endContainer)) { - throw new DOMException_1.InvalidNodeTypeError(); - } - _this._start = [init.startContainer, init.startOffset]; - _this._end = [init.endContainer, init.endOffset]; + function NodeIteratorImpl(root, reference, pointerBeforeReference) { + var _this = _super.call(this, root) || this; + _this._iteratorCollection = undefined; + _this._reference = reference; + _this._pointerBeforeReference = pointerBeforeReference; + algorithm_1.nodeIterator_iteratorList().add(_this); return _this; } - return StaticRangeImpl; -}(AbstractRangeImpl_1.AbstractRangeImpl)); -exports.StaticRangeImpl = StaticRangeImpl; -//# sourceMappingURL=StaticRangeImpl.js.map + Object.defineProperty(NodeIteratorImpl.prototype, "referenceNode", { + /** @inheritdoc */ + get: function () { return this._reference; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeIteratorImpl.prototype, "pointerBeforeReferenceNode", { + /** @inheritdoc */ + get: function () { return this._pointerBeforeReference; }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + NodeIteratorImpl.prototype.nextNode = function () { + /** + * The nextNode() method, when invoked, must return the result of + * traversing with the context object and next. + */ + return algorithm_1.nodeIterator_traverse(this, true); + }; + /** @inheritdoc */ + NodeIteratorImpl.prototype.previousNode = function () { + /** + * The previousNode() method, when invoked, must return the result of + * traversing with the context object and previous. + */ + return algorithm_1.nodeIterator_traverse(this, false); + }; + /** @inheritdoc */ + NodeIteratorImpl.prototype.detach = function () { + /** + * The detach() method, when invoked, must do nothing. + * + * since JS lacks weak references, we still use detach + */ + algorithm_1.nodeIterator_iteratorList().delete(this); + }; + /** + * Creates a new `NodeIterator`. + * + * @param root - iterator's root node + * @param reference - reference node + * @param pointerBeforeReference - whether the iterator is before or after the + * reference node + */ + NodeIteratorImpl._create = function (root, reference, pointerBeforeReference) { + return new NodeIteratorImpl(root, reference, pointerBeforeReference); + }; + return NodeIteratorImpl; +}(TraverserImpl_1.TraverserImpl)); +exports.NodeIteratorImpl = NodeIteratorImpl; +//# sourceMappingURL=NodeIteratorImpl.js.map /***/ }), -/***/ 2191: +/***/ 43728: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); var __values = (this && this.__values) || function(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); @@ -62831,788 +62886,736 @@ var __values = (this && this.__values) || function(o) { throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var CharacterDataImpl_1 = __nccwpck_require__(5330); +var DOMImpl_1 = __nccwpck_require__(14177); +var util_1 = __nccwpck_require__(76195); var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(5457); /** - * Represents a text node. + * Represents an ordered set of nodes. */ -var TextImpl = /** @class */ (function (_super) { - __extends(TextImpl, _super); +var NodeListImpl = /** @class */ (function () { /** - * Initializes a new instance of `Text`. + * Initializes a new instance of `NodeList`. * - * @param data - the text content + * @param root - root node */ - function TextImpl(data) { - if (data === void 0) { data = ''; } - var _this = _super.call(this, data) || this; - _this._name = ''; - _this._assignedSlot = null; - return _this; + function NodeListImpl(root) { + this._live = true; + this._filter = null; + this._length = 0; + this._root = root; + return new Proxy(this, this); } - Object.defineProperty(TextImpl.prototype, "wholeText", { + Object.defineProperty(NodeListImpl.prototype, "length", { /** @inheritdoc */ get: function () { - var e_1, _a; /** - * The wholeText attribute’s getter must return the concatenation of the - * data of the contiguous Text nodes of the context object, in tree order. + * The length attribute must return the number of nodes represented + * by the collection. */ - var text = ''; - try { - for (var _b = __values(algorithm_1.text_contiguousTextNodes(this, true)), _c = _b.next(); !_c.done; _c = _b.next()) { - var node = _c.value; - text = text + node._data; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - return text; + return this._root._children.size; }, enumerable: true, configurable: true }); /** @inheritdoc */ - TextImpl.prototype.splitText = function (offset) { + NodeListImpl.prototype.item = function (index) { /** - * The splitText(offset) method, when invoked, must split context object - * with offset offset. + * The item(index) method must return the indexth node in the collection. + * If there is no indexth node in the collection, then the method must + * return null. */ - return algorithm_1.text_split(this, offset); + if (index < 0 || index > this.length - 1) + return null; + if (index < this.length / 2) { + var i = 0; + var node = this._root._firstChild; + while (node !== null && i !== index) { + node = node._nextSibling; + i++; + } + return node; + } + else { + var i = this.length - 1; + var node = this._root._lastChild; + while (node !== null && i !== index) { + node = node._previousSibling; + i--; + } + return node; + } + }; + /** @inheritdoc */ + NodeListImpl.prototype.keys = function () { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var index = 0; + return { + next: function () { + if (index === this.length) { + return { done: true, value: null }; + } + else { + return { done: false, value: index++ }; + } + }.bind(this) + }; + }.bind(this), + _a; + }; + /** @inheritdoc */ + NodeListImpl.prototype.values = function () { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var it = this[Symbol.iterator](); + return { + next: function () { + return it.next(); + } + }; + }.bind(this), + _a; + }; + /** @inheritdoc */ + NodeListImpl.prototype.entries = function () { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var it = this[Symbol.iterator](); + var index = 0; + return { + next: function () { + var itResult = it.next(); + if (itResult.done) { + return { done: true, value: null }; + } + else { + return { done: false, value: [index++, itResult.value] }; + } + } + }; + }.bind(this), + _a; + }; + /** @inheritdoc */ + NodeListImpl.prototype[Symbol.iterator] = function () { + return this._root._children[Symbol.iterator](); + }; + /** @inheritdoc */ + NodeListImpl.prototype.forEach = function (callback, thisArg) { + var e_1, _a; + if (thisArg === undefined) { + thisArg = DOMImpl_1.dom.window; + } + var index = 0; + try { + for (var _b = __values(this._root._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var node = _c.value; + callback.call(thisArg, node, index++, this); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } }; - Object.defineProperty(TextImpl.prototype, "assignedSlot", { - // MIXIN: Slotable - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: Slotable not implemented."); }, - enumerable: true, - configurable: true - }); /** - * Creates a `Text`. + * Implements a proxy get trap to provide array-like access. + */ + NodeListImpl.prototype.get = function (target, key, receiver) { + if (!util_1.isString(key)) { + return Reflect.get(target, key, receiver); + } + var index = Number(key); + if (isNaN(index)) { + return Reflect.get(target, key, receiver); + } + return target.item(index) || undefined; + }; + /** + * Implements a proxy set trap to provide array-like access. + */ + NodeListImpl.prototype.set = function (target, key, value, receiver) { + if (!util_1.isString(key)) { + return Reflect.set(target, key, value, receiver); + } + var index = Number(key); + if (isNaN(index)) { + return Reflect.set(target, key, value, receiver); + } + var node = target.item(index) || undefined; + if (!node) + return false; + if (node._parent) { + algorithm_1.mutation_replace(node, value, node._parent); + return true; + } + else { + return false; + } + }; + /** + * Creates a new `NodeList`. * - * @param document - owner document - * @param data - the text content + * @param root - root node */ - TextImpl._create = function (document, data) { - if (data === void 0) { data = ''; } - var node = new TextImpl(data); - node._nodeDocument = document; - return node; + NodeListImpl._create = function (root) { + return new NodeListImpl(root); }; - return TextImpl; -}(CharacterDataImpl_1.CharacterDataImpl)); -exports.TextImpl = TextImpl; -/** - * Initialize prototype properties - */ -WebIDLAlgorithm_1.idl_defineConst(TextImpl.prototype, "_nodeType", interfaces_1.NodeType.Text); -//# sourceMappingURL=TextImpl.js.map + return NodeListImpl; +}()); +exports.NodeListImpl = NodeListImpl; +//# sourceMappingURL=NodeListImpl.js.map /***/ }), -/***/ 9782: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 65306: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); +var DOMImpl_1 = __nccwpck_require__(14177); +var util_1 = __nccwpck_require__(76195); /** - * Represents an object which can be used to iterate through the nodes - * of a subtree. + * Represents an ordered list of nodes. + * This is a static implementation of `NodeList`. */ -var TraverserImpl = /** @class */ (function () { +var NodeListStaticImpl = /** @class */ (function () { /** - * Initializes a new instance of `Traverser`. + * Initializes a new instance of `NodeList`. * * @param root - root node */ - function TraverserImpl(root) { - this._activeFlag = false; + function NodeListStaticImpl(root) { + this._live = false; + this._items = []; + this._length = 0; this._root = root; - this._whatToShow = interfaces_1.WhatToShow.All; - this._filter = null; - } - Object.defineProperty(TraverserImpl.prototype, "root", { - /** @inheritdoc */ - get: function () { return this._root; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TraverserImpl.prototype, "whatToShow", { - /** @inheritdoc */ - get: function () { return this._whatToShow; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TraverserImpl.prototype, "filter", { - /** @inheritdoc */ - get: function () { return this._filter; }, - enumerable: true, - configurable: true - }); - return TraverserImpl; -}()); -exports.TraverserImpl = TraverserImpl; -//# sourceMappingURL=TraverserImpl.js.map - -/***/ }), - -/***/ 9261: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var TraverserImpl_1 = __nccwpck_require__(9782); -var algorithm_1 = __nccwpck_require__(61); -/** - * Represents the nodes of a subtree and a position within them. - */ -var TreeWalkerImpl = /** @class */ (function (_super) { - __extends(TreeWalkerImpl, _super); - /** - * Initializes a new instance of `TreeWalker`. - */ - function TreeWalkerImpl(root, current) { - var _this = _super.call(this, root) || this; - _this._current = current; - return _this; + this._items = []; + this._filter = function (node) { return true; }; + return new Proxy(this, this); } - Object.defineProperty(TreeWalkerImpl.prototype, "currentNode", { + Object.defineProperty(NodeListStaticImpl.prototype, "length", { /** @inheritdoc */ - get: function () { return this._current; }, - set: function (value) { this._current = value; }, + get: function () { + /** + * The length attribute must return the number of nodes represented by + * the collection. + */ + return this._items.length; + }, enumerable: true, configurable: true }); /** @inheritdoc */ - TreeWalkerImpl.prototype.parentNode = function () { - /** - * 1. Let node be the context object’s current. - * 2. While node is non-null and is not the context object’s root: - */ - var node = this._current; - while (node !== null && node !== this._root) { - /** - * 2.1. Set node to node’s parent. - * 2.2. If node is non-null and filtering node within the context object - * returns FILTER_ACCEPT, then set the context object’s current to node - * and return node. - */ - node = node._parent; - if (node !== null && - algorithm_1.traversal_filter(this, node) === interfaces_1.FilterResult.Accept) { - this._current = node; - return node; - } - } + NodeListStaticImpl.prototype.item = function (index) { /** - * 3. Return null. + * The item(index) method must return the indexth node in the collection. + * If there is no indexth node in the collection, then the method must + * return null. */ - return null; + if (index < 0 || index > this.length - 1) + return null; + return this._items[index]; }; /** @inheritdoc */ - TreeWalkerImpl.prototype.firstChild = function () { - /** - * The firstChild() method, when invoked, must traverse children with the - * context object and first. - */ - return algorithm_1.treeWalker_traverseChildren(this, true); + NodeListStaticImpl.prototype.keys = function () { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var index = 0; + return { + next: function () { + if (index === this.length) { + return { done: true, value: null }; + } + else { + return { done: false, value: index++ }; + } + }.bind(this) + }; + }.bind(this), + _a; }; /** @inheritdoc */ - TreeWalkerImpl.prototype.lastChild = function () { - /** - * The lastChild() method, when invoked, must traverse children with the - * context object and last. - */ - return algorithm_1.treeWalker_traverseChildren(this, false); + NodeListStaticImpl.prototype.values = function () { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var it = this[Symbol.iterator](); + return { + next: function () { + return it.next(); + } + }; + }.bind(this), + _a; }; /** @inheritdoc */ - TreeWalkerImpl.prototype.nextSibling = function () { - /** - * The nextSibling() method, when invoked, must traverse siblings with the - * context object and next. - */ - return algorithm_1.treeWalker_traverseSiblings(this, true); + NodeListStaticImpl.prototype.entries = function () { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var it = this[Symbol.iterator](); + var index = 0; + return { + next: function () { + var itResult = it.next(); + if (itResult.done) { + return { done: true, value: null }; + } + else { + return { done: false, value: [index++, itResult.value] }; + } + } + }; + }.bind(this), + _a; }; /** @inheritdoc */ - TreeWalkerImpl.prototype.previousNode = function () { - /** - * 1. Let node be the context object’s current. - * 2. While node is not the context object’s root: - */ - var node = this._current; - while (node !== this._root) { - /** - * 2.1. Let sibling be node’s previous sibling. - * 2.2. While sibling is non-null: - */ - var sibling = node._previousSibling; - while (sibling) { - /** - * 2.2.1. Set node to sibling. - * 2.2.2. Let result be the result of filtering node within the context - * object. - */ - node = sibling; - var result = algorithm_1.traversal_filter(this, node); - /** - * 2.2.3. While result is not FILTER_REJECT and node has a child: - */ - while (result !== interfaces_1.FilterResult.Reject && node._lastChild) { - /** - * 2.2.3.1. Set node to node’s last child. - * 2.2.3.2. Set result to the result of filtering node within the - * context object. - */ - node = node._lastChild; - result = algorithm_1.traversal_filter(this, node); - } - /** - * 2.2.4. If result is FILTER_ACCEPT, then set the context object’s - * current to node and return node. - */ - if (result === interfaces_1.FilterResult.Accept) { - this._current = node; - return node; - } - /** - * 2.2.5. Set sibling to node’s previous sibling. - */ - sibling = node._previousSibling; + NodeListStaticImpl.prototype[Symbol.iterator] = function () { + var it = this._items[Symbol.iterator](); + return { + next: function () { + return it.next(); } - /** - * 2.3. If node is the context object’s root or node’s parent is null, - * then return null. - */ - if (node === this._root || node._parent === null) { - return null; + }; + }; + /** @inheritdoc */ + NodeListStaticImpl.prototype.forEach = function (callback, thisArg) { + var e_1, _a; + if (thisArg === undefined) { + thisArg = DOMImpl_1.dom.window; + } + var index = 0; + try { + for (var _b = __values(this._items), _c = _b.next(); !_c.done; _c = _b.next()) { + var node = _c.value; + callback.call(thisArg, node, index++, this); } - /** - * 2.4. Set node to node’s parent. - */ - node = node._parent; - /** - * 2.5. If the return value of filtering node within the context object is - * FILTER_ACCEPT, then set the context object’s current to node and - * return node. - */ - if (algorithm_1.traversal_filter(this, node) === interfaces_1.FilterResult.Accept) { - this._current = node; - return node; + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } + finally { if (e_1) throw e_1.error; } } - /** - * 3. Return null. - */ - return null; }; - /** @inheritdoc */ - TreeWalkerImpl.prototype.previousSibling = function () { - /** - * The previousSibling() method, when invoked, must traverse siblings with - * the context object and previous. - */ - return algorithm_1.treeWalker_traverseSiblings(this, false); + /** + * Implements a proxy get trap to provide array-like access. + */ + NodeListStaticImpl.prototype.get = function (target, key, receiver) { + if (!util_1.isString(key)) { + return Reflect.get(target, key, receiver); + } + var index = Number(key); + if (isNaN(index)) { + return Reflect.get(target, key, receiver); + } + return target._items[index] || undefined; }; - /** @inheritdoc */ - TreeWalkerImpl.prototype.nextNode = function () { - /** - * 1. Let node be the context object’s current. - * 2. Let result be FILTER_ACCEPT. - * 3. While true: - */ - var node = this._current; - var result = interfaces_1.FilterResult.Accept; - while (true) { - /** - * 3.1. While result is not FILTER_REJECT and node has a child: - */ - while (result !== interfaces_1.FilterResult.Reject && node._firstChild) { - /** - * 3.1.1. Set node to its first child. - * 3.1.2. Set result to the result of filtering node within the context - * object. - * 3.1.3. If result is FILTER_ACCEPT, then set the context object’s - * current to node and return node. - */ - node = node._firstChild; - result = algorithm_1.traversal_filter(this, node); - if (result === interfaces_1.FilterResult.Accept) { - this._current = node; - return node; - } - } - /** - * 3.2. Let sibling be null. - * 3.3. Let temporary be node. - * 3.4. While temporary is non-null: - */ - var sibling = null; - var temporary = node; - while (temporary !== null) { - /** - * 3.4.1. If temporary is the context object’s root, then return null. - */ - if (temporary === this._root) { - return null; - } - /** - * 3.4.2. Set sibling to temporary’s next sibling. - * 3.4.3. If sibling is non-null, then break. - */ - sibling = temporary._nextSibling; - if (sibling !== null) { - node = sibling; - break; - } - /** - * 3.4.4. Set temporary to temporary’s parent. - */ - temporary = temporary._parent; - } - /** - * 3.5. Set result to the result of filtering node within the context object. - * 3.6. If result is FILTER_ACCEPT, then set the context object’s current - * to node and return node. - */ - result = algorithm_1.traversal_filter(this, node); - if (result === interfaces_1.FilterResult.Accept) { - this._current = node; - return node; - } + /** + * Implements a proxy set trap to provide array-like access. + */ + NodeListStaticImpl.prototype.set = function (target, key, value, receiver) { + if (!util_1.isString(key)) { + return Reflect.set(target, key, value, receiver); + } + var index = Number(key); + if (isNaN(index)) { + return Reflect.set(target, key, value, receiver); + } + if (index >= 0 && index < target._items.length) { + target._items[index] = value; + return true; + } + else { + return false; } }; /** - * Creates a new `TreeWalker`. + * Creates a new `NodeList`. * - * @param root - iterator's root node - * @param current - current node + * @param root - root node + * @param items - a list of items to initialize the list */ - TreeWalkerImpl._create = function (root, current) { - return new TreeWalkerImpl(root, current); + NodeListStaticImpl._create = function (root, items) { + var list = new NodeListStaticImpl(root); + list._items = items; + return list; }; - return TreeWalkerImpl; -}(TraverserImpl_1.TraverserImpl)); -exports.TreeWalkerImpl = TreeWalkerImpl; -//# sourceMappingURL=TreeWalkerImpl.js.map + return NodeListStaticImpl; +}()); +exports.NodeListStaticImpl = NodeListStaticImpl; +//# sourceMappingURL=NodeListStaticImpl.js.map /***/ }), -/***/ 9067: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 71032: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var EventTargetImpl_1 = __nccwpck_require__(9968); -var util_1 = __nccwpck_require__(6195); -var algorithm_1 = __nccwpck_require__(61); +var util_1 = __nccwpck_require__(65282); /** - * Represents a window containing a DOM document. + * Represents a mixin that extends child nodes that can have siblings + * other than doctypes. This mixin is implemented by {@link Element} and + * {@link CharacterData}. */ -var WindowImpl = /** @class */ (function (_super) { - __extends(WindowImpl, _super); - /** - * Initializes a new instance of `Window`. - */ - function WindowImpl() { - var _this = _super.call(this) || this; - _this._signalSlots = new Set(); - _this._mutationObserverMicrotaskQueued = false; - _this._mutationObservers = new Set(); - _this._iteratorList = new util_1.FixedSizeSet(); - _this._associatedDocument = algorithm_1.create_document(); - return _this; +var NonDocumentTypeChildNodeImpl = /** @class */ (function () { + function NonDocumentTypeChildNodeImpl() { } - Object.defineProperty(WindowImpl.prototype, "document", { + Object.defineProperty(NonDocumentTypeChildNodeImpl.prototype, "previousElementSibling", { /** @inheritdoc */ - get: function () { return this._associatedDocument; }, + get: function () { + /** + * The previousElementSibling attribute’s getter must return the first + * preceding sibling that is an element, and null otherwise. + */ + var node = util_1.Cast.asNode(this)._previousSibling; + while (node) { + if (util_1.Guard.isElementNode(node)) + return node; + else + node = node._previousSibling; + } + return null; + }, enumerable: true, configurable: true }); - Object.defineProperty(WindowImpl.prototype, "event", { + Object.defineProperty(NonDocumentTypeChildNodeImpl.prototype, "nextElementSibling", { /** @inheritdoc */ - get: function () { return this._currentEvent; }, + get: function () { + /** + * The nextElementSibling attribute’s getter must return the first + * following sibling that is an element, and null otherwise. + */ + var node = util_1.Cast.asNode(this)._nextSibling; + while (node) { + if (util_1.Guard.isElementNode(node)) + return node; + else + node = node._nextSibling; + } + return null; + }, enumerable: true, configurable: true }); - /** - * Creates a new window with a blank document. - */ - WindowImpl._create = function () { - return new WindowImpl(); - }; - return WindowImpl; -}(EventTargetImpl_1.EventTargetImpl)); -exports.WindowImpl = WindowImpl; -//# sourceMappingURL=WindowImpl.js.map + return NonDocumentTypeChildNodeImpl; +}()); +exports.NonDocumentTypeChildNodeImpl = NonDocumentTypeChildNodeImpl; +//# sourceMappingURL=NonDocumentTypeChildNodeImpl.js.map /***/ }), -/***/ 1685: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 90733: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var DocumentImpl_1 = __nccwpck_require__(4333); +var util_1 = __nccwpck_require__(65282); +var algorithm_1 = __nccwpck_require__(61); /** - * Represents an XML document. + * Represents a mixin that extends non-element parent nodes. This mixin + * is implemented by {@link Document} and {@link DocumentFragment}. */ -var XMLDocumentImpl = /** @class */ (function (_super) { - __extends(XMLDocumentImpl, _super); - /** - * Initializes a new instance of `XMLDocument`. - */ - function XMLDocumentImpl() { - return _super.call(this) || this; +var NonElementParentNodeImpl = /** @class */ (function () { + function NonElementParentNodeImpl() { } - return XMLDocumentImpl; -}(DocumentImpl_1.DocumentImpl)); -exports.XMLDocumentImpl = XMLDocumentImpl; -//# sourceMappingURL=XMLDocumentImpl.js.map - -/***/ }), - -/***/ 633: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(6195); -// Import implementation classes -var AbortControllerImpl_1 = __nccwpck_require__(6461); -exports.AbortController = AbortControllerImpl_1.AbortControllerImpl; -var AbortSignalImpl_1 = __nccwpck_require__(22); -exports.AbortSignal = AbortSignalImpl_1.AbortSignalImpl; -var AbstractRangeImpl_1 = __nccwpck_require__(7126); -exports.AbstractRange = AbstractRangeImpl_1.AbstractRangeImpl; -var AttrImpl_1 = __nccwpck_require__(3717); -exports.Attr = AttrImpl_1.AttrImpl; -var CDATASectionImpl_1 = __nccwpck_require__(3977); -exports.CDATASection = CDATASectionImpl_1.CDATASectionImpl; -var CharacterDataImpl_1 = __nccwpck_require__(5330); -exports.CharacterData = CharacterDataImpl_1.CharacterDataImpl; -var ChildNodeImpl_1 = __nccwpck_require__(8264); -var CommentImpl_1 = __nccwpck_require__(930); -exports.Comment = CommentImpl_1.CommentImpl; -var CustomEventImpl_1 = __nccwpck_require__(9857); -exports.CustomEvent = CustomEventImpl_1.CustomEventImpl; -var DocumentFragmentImpl_1 = __nccwpck_require__(2585); -exports.DocumentFragment = DocumentFragmentImpl_1.DocumentFragmentImpl; -var DocumentImpl_1 = __nccwpck_require__(4333); -exports.Document = DocumentImpl_1.DocumentImpl; -var DocumentOrShadowRootImpl_1 = __nccwpck_require__(5274); -var DocumentTypeImpl_1 = __nccwpck_require__(3173); -exports.DocumentType = DocumentTypeImpl_1.DocumentTypeImpl; -var DOMImpl_1 = __nccwpck_require__(4177); -exports.dom = DOMImpl_1.dom; -var DOMImplementationImpl_1 = __nccwpck_require__(2197); -exports.DOMImplementation = DOMImplementationImpl_1.DOMImplementationImpl; -var DOMTokenListImpl_1 = __nccwpck_require__(5096); -exports.DOMTokenList = DOMTokenListImpl_1.DOMTokenListImpl; -var ElementImpl_1 = __nccwpck_require__(5975); -exports.Element = ElementImpl_1.ElementImpl; -var EventImpl_1 = __nccwpck_require__(8245); -exports.Event = EventImpl_1.EventImpl; -var EventTargetImpl_1 = __nccwpck_require__(9968); -exports.EventTarget = EventTargetImpl_1.EventTargetImpl; -var HTMLCollectionImpl_1 = __nccwpck_require__(3969); -exports.HTMLCollection = HTMLCollectionImpl_1.HTMLCollectionImpl; -var MutationObserverImpl_1 = __nccwpck_require__(9616); -exports.MutationObserver = MutationObserverImpl_1.MutationObserverImpl; -var MutationRecordImpl_1 = __nccwpck_require__(6219); -exports.MutationRecord = MutationRecordImpl_1.MutationRecordImpl; -var NamedNodeMapImpl_1 = __nccwpck_require__(7206); -exports.NamedNodeMap = NamedNodeMapImpl_1.NamedNodeMapImpl; -var NodeFilterImpl_1 = __nccwpck_require__(2355); -exports.NodeFilter = NodeFilterImpl_1.NodeFilterImpl; -var NodeImpl_1 = __nccwpck_require__(1745); -exports.Node = NodeImpl_1.NodeImpl; -var NodeIteratorImpl_1 = __nccwpck_require__(1997); -exports.NodeIterator = NodeIteratorImpl_1.NodeIteratorImpl; -var NodeListImpl_1 = __nccwpck_require__(3728); -exports.NodeList = NodeListImpl_1.NodeListImpl; -var NodeListStaticImpl_1 = __nccwpck_require__(5306); -exports.NodeListStatic = NodeListStaticImpl_1.NodeListStaticImpl; -var NonDocumentTypeChildNodeImpl_1 = __nccwpck_require__(1032); -var NonElementParentNodeImpl_1 = __nccwpck_require__(733); -var ParentNodeImpl_1 = __nccwpck_require__(5988); -var ProcessingInstructionImpl_1 = __nccwpck_require__(9430); -exports.ProcessingInstruction = ProcessingInstructionImpl_1.ProcessingInstructionImpl; -var RangeImpl_1 = __nccwpck_require__(166); -exports.Range = RangeImpl_1.RangeImpl; -var ShadowRootImpl_1 = __nccwpck_require__(1911); -exports.ShadowRoot = ShadowRootImpl_1.ShadowRootImpl; -var SlotableImpl_1 = __nccwpck_require__(1964); -var StaticRangeImpl_1 = __nccwpck_require__(6357); -exports.StaticRange = StaticRangeImpl_1.StaticRangeImpl; -var TextImpl_1 = __nccwpck_require__(2191); -exports.Text = TextImpl_1.TextImpl; -var TraverserImpl_1 = __nccwpck_require__(9782); -exports.Traverser = TraverserImpl_1.TraverserImpl; -var TreeWalkerImpl_1 = __nccwpck_require__(9261); -exports.TreeWalker = TreeWalkerImpl_1.TreeWalkerImpl; -var WindowImpl_1 = __nccwpck_require__(9067); -exports.Window = WindowImpl_1.WindowImpl; -var XMLDocumentImpl_1 = __nccwpck_require__(1685); -exports.XMLDocument = XMLDocumentImpl_1.XMLDocumentImpl; -// Apply mixins -// ChildNode -util_1.applyMixin(ElementImpl_1.ElementImpl, ChildNodeImpl_1.ChildNodeImpl); -util_1.applyMixin(CharacterDataImpl_1.CharacterDataImpl, ChildNodeImpl_1.ChildNodeImpl); -util_1.applyMixin(DocumentTypeImpl_1.DocumentTypeImpl, ChildNodeImpl_1.ChildNodeImpl); -// DocumentOrShadowRoot -util_1.applyMixin(DocumentImpl_1.DocumentImpl, DocumentOrShadowRootImpl_1.DocumentOrShadowRootImpl); -util_1.applyMixin(ShadowRootImpl_1.ShadowRootImpl, DocumentOrShadowRootImpl_1.DocumentOrShadowRootImpl); -// NonDocumentTypeChildNode -util_1.applyMixin(ElementImpl_1.ElementImpl, NonDocumentTypeChildNodeImpl_1.NonDocumentTypeChildNodeImpl); -util_1.applyMixin(CharacterDataImpl_1.CharacterDataImpl, NonDocumentTypeChildNodeImpl_1.NonDocumentTypeChildNodeImpl); -// NonElementParentNode -util_1.applyMixin(DocumentImpl_1.DocumentImpl, NonElementParentNodeImpl_1.NonElementParentNodeImpl); -util_1.applyMixin(DocumentFragmentImpl_1.DocumentFragmentImpl, NonElementParentNodeImpl_1.NonElementParentNodeImpl); -// ParentNode -util_1.applyMixin(DocumentImpl_1.DocumentImpl, ParentNodeImpl_1.ParentNodeImpl); -util_1.applyMixin(DocumentFragmentImpl_1.DocumentFragmentImpl, ParentNodeImpl_1.ParentNodeImpl); -util_1.applyMixin(ElementImpl_1.ElementImpl, ParentNodeImpl_1.ParentNodeImpl); -// Slotable -util_1.applyMixin(TextImpl_1.TextImpl, SlotableImpl_1.SlotableImpl); -util_1.applyMixin(ElementImpl_1.ElementImpl, SlotableImpl_1.SlotableImpl); -//# sourceMappingURL=index.js.map + /** @inheritdoc */ + NonElementParentNodeImpl.prototype.getElementById = function (id) { + /** + * The getElementById(elementId) method, when invoked, must return the first + * element, in tree order, within the context object’s descendants, + * whose ID is elementId, and null if there is no such element otherwise. + */ + var ele = algorithm_1.tree_getFirstDescendantNode(util_1.Cast.asNode(this), false, false, function (e) { return util_1.Guard.isElementNode(e); }); + while (ele !== null) { + if (ele._uniqueIdentifier === id) { + return ele; + } + ele = algorithm_1.tree_getNextDescendantNode(util_1.Cast.asNode(this), ele, false, false, function (e) { return util_1.Guard.isElementNode(e); }); + } + return null; + }; + return NonElementParentNodeImpl; +}()); +exports.NonElementParentNodeImpl = NonElementParentNodeImpl; +//# sourceMappingURL=NonElementParentNodeImpl.js.map /***/ }), -/***/ 7305: -/***/ ((__unused_webpack_module, exports) => { +/***/ 85988: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; Object.defineProperty(exports, "__esModule", ({ value: true })); +var util_1 = __nccwpck_require__(65282); +var algorithm_1 = __nccwpck_require__(61); /** - * Defines the position of a boundary point relative to another. - */ -var BoundaryPosition; -(function (BoundaryPosition) { - BoundaryPosition[BoundaryPosition["Before"] = 0] = "Before"; - BoundaryPosition[BoundaryPosition["Equal"] = 1] = "Equal"; - BoundaryPosition[BoundaryPosition["After"] = 2] = "After"; -})(BoundaryPosition = exports.BoundaryPosition || (exports.BoundaryPosition = {})); -/** - * Defines the event phase. - */ -var EventPhase; -(function (EventPhase) { - EventPhase[EventPhase["None"] = 0] = "None"; - EventPhase[EventPhase["Capturing"] = 1] = "Capturing"; - EventPhase[EventPhase["AtTarget"] = 2] = "AtTarget"; - EventPhase[EventPhase["Bubbling"] = 3] = "Bubbling"; -})(EventPhase = exports.EventPhase || (exports.EventPhase = {})); -/** - * Defines the type of a node object. - */ -var NodeType; -(function (NodeType) { - NodeType[NodeType["Element"] = 1] = "Element"; - NodeType[NodeType["Attribute"] = 2] = "Attribute"; - NodeType[NodeType["Text"] = 3] = "Text"; - NodeType[NodeType["CData"] = 4] = "CData"; - NodeType[NodeType["EntityReference"] = 5] = "EntityReference"; - NodeType[NodeType["Entity"] = 6] = "Entity"; - NodeType[NodeType["ProcessingInstruction"] = 7] = "ProcessingInstruction"; - NodeType[NodeType["Comment"] = 8] = "Comment"; - NodeType[NodeType["Document"] = 9] = "Document"; - NodeType[NodeType["DocumentType"] = 10] = "DocumentType"; - NodeType[NodeType["DocumentFragment"] = 11] = "DocumentFragment"; - NodeType[NodeType["Notation"] = 12] = "Notation"; // historical -})(NodeType = exports.NodeType || (exports.NodeType = {})); -/** - * Defines the position of a node in the document relative to another - * node. - */ -var Position; -(function (Position) { - Position[Position["Disconnected"] = 1] = "Disconnected"; - Position[Position["Preceding"] = 2] = "Preceding"; - Position[Position["Following"] = 4] = "Following"; - Position[Position["Contains"] = 8] = "Contains"; - Position[Position["ContainedBy"] = 16] = "ContainedBy"; - Position[Position["ImplementationSpecific"] = 32] = "ImplementationSpecific"; -})(Position = exports.Position || (exports.Position = {})); -/** - * Defines the return value of a filter callback. - */ -var FilterResult; -(function (FilterResult) { - FilterResult[FilterResult["Accept"] = 1] = "Accept"; - FilterResult[FilterResult["Reject"] = 2] = "Reject"; - FilterResult[FilterResult["Skip"] = 3] = "Skip"; -})(FilterResult = exports.FilterResult || (exports.FilterResult = {})); -/** - * Defines what to show in node filter. - */ -var WhatToShow; -(function (WhatToShow) { - WhatToShow[WhatToShow["All"] = 4294967295] = "All"; - WhatToShow[WhatToShow["Element"] = 1] = "Element"; - WhatToShow[WhatToShow["Attribute"] = 2] = "Attribute"; - WhatToShow[WhatToShow["Text"] = 4] = "Text"; - WhatToShow[WhatToShow["CDataSection"] = 8] = "CDataSection"; - WhatToShow[WhatToShow["EntityReference"] = 16] = "EntityReference"; - WhatToShow[WhatToShow["Entity"] = 32] = "Entity"; - WhatToShow[WhatToShow["ProcessingInstruction"] = 64] = "ProcessingInstruction"; - WhatToShow[WhatToShow["Comment"] = 128] = "Comment"; - WhatToShow[WhatToShow["Document"] = 256] = "Document"; - WhatToShow[WhatToShow["DocumentType"] = 512] = "DocumentType"; - WhatToShow[WhatToShow["DocumentFragment"] = 1024] = "DocumentFragment"; - WhatToShow[WhatToShow["Notation"] = 2048] = "Notation"; -})(WhatToShow = exports.WhatToShow || (exports.WhatToShow = {})); -/** - * Defines how boundary points are compared. + * Represents a mixin that extends parent nodes that can have children. + * This mixin is implemented by {@link Element}, {@link Document} and + * {@link DocumentFragment}. */ -var HowToCompare; -(function (HowToCompare) { - HowToCompare[HowToCompare["StartToStart"] = 0] = "StartToStart"; - HowToCompare[HowToCompare["StartToEnd"] = 1] = "StartToEnd"; - HowToCompare[HowToCompare["EndToEnd"] = 2] = "EndToEnd"; - HowToCompare[HowToCompare["EndToStart"] = 3] = "EndToStart"; -})(HowToCompare = exports.HowToCompare || (exports.HowToCompare = {})); -//# sourceMappingURL=interfaces.js.map - -/***/ }), - -/***/ 4646: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var dom_1 = __nccwpck_require__(633); -dom_1.dom.setFeatures(true); -var dom_2 = __nccwpck_require__(633); -exports.DOMImplementation = dom_2.DOMImplementation; -var parser_1 = __nccwpck_require__(6216); -exports.DOMParser = parser_1.DOMParser; -var serializer_1 = __nccwpck_require__(7119); -exports.XMLSerializer = serializer_1.XMLSerializer; -//# sourceMappingURL=index.js.map +var ParentNodeImpl = /** @class */ (function () { + function ParentNodeImpl() { + } + Object.defineProperty(ParentNodeImpl.prototype, "children", { + /** @inheritdoc */ + get: function () { + /** + * The children attribute’s getter must return an HTMLCollection collection + * rooted at context object matching only element children. + */ + return algorithm_1.create_htmlCollection(util_1.Cast.asNode(this)); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ParentNodeImpl.prototype, "firstElementChild", { + /** @inheritdoc */ + get: function () { + /** + * The firstElementChild attribute’s getter must return the first child + * that is an element, and null otherwise. + */ + var node = util_1.Cast.asNode(this)._firstChild; + while (node) { + if (util_1.Guard.isElementNode(node)) + return node; + else + node = node._nextSibling; + } + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ParentNodeImpl.prototype, "lastElementChild", { + /** @inheritdoc */ + get: function () { + /** + * The lastElementChild attribute’s getter must return the last child that + * is an element, and null otherwise. + */ + var node = util_1.Cast.asNode(this)._lastChild; + while (node) { + if (util_1.Guard.isElementNode(node)) + return node; + else + node = node._previousSibling; + } + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ParentNodeImpl.prototype, "childElementCount", { + /** @inheritdoc */ + get: function () { + var e_1, _a; + /** + * The childElementCount attribute’s getter must return the number of + * children of context object that are elements. + */ + var count = 0; + try { + for (var _b = __values(util_1.Cast.asNode(this)._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + if (util_1.Guard.isElementNode(childNode)) + count++; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + return count; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + ParentNodeImpl.prototype.prepend = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + /** + * 1. Let node be the result of converting nodes into a node given nodes + * and context object’s node document. + * 2. Pre-insert node into context object before the context object’s first + * child. + */ + var node = util_1.Cast.asNode(this); + var childNode = algorithm_1.parentNode_convertNodesIntoANode(nodes, node._nodeDocument); + algorithm_1.mutation_preInsert(childNode, node, node._firstChild); + }; + /** @inheritdoc */ + ParentNodeImpl.prototype.append = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + /** + * 1. Let node be the result of converting nodes into a node given nodes + * and context object’s node document. + * 2. Append node to context object. + */ + var node = util_1.Cast.asNode(this); + var childNode = algorithm_1.parentNode_convertNodesIntoANode(nodes, node._nodeDocument); + algorithm_1.mutation_append(childNode, node); + }; + /** @inheritdoc */ + ParentNodeImpl.prototype.querySelector = function (selectors) { + /** + * The querySelector(selectors) method, when invoked, must return the first + * result of running scope-match a selectors string selectors against + * context object, if the result is not an empty list, and null otherwise. + */ + var node = util_1.Cast.asNode(this); + var result = algorithm_1.selectors_scopeMatchASelectorsString(selectors, node); + return (result.length === 0 ? null : result[0]); + }; + /** @inheritdoc */ + ParentNodeImpl.prototype.querySelectorAll = function (selectors) { + /** + * The querySelectorAll(selectors) method, when invoked, must return the + * static result of running scope-match a selectors string selectors against + * context object. + */ + var node = util_1.Cast.asNode(this); + var result = algorithm_1.selectors_scopeMatchASelectorsString(selectors, node); + return algorithm_1.create_nodeListStatic(node, result); + }; + return ParentNodeImpl; +}()); +exports.ParentNodeImpl = ParentNodeImpl; +//# sourceMappingURL=ParentNodeImpl.js.map /***/ }), -/***/ 8845: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 99430: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var algorithm_1 = __nccwpck_require__(61); -var XMLParserImpl_1 = __nccwpck_require__(4126); +var interfaces_1 = __nccwpck_require__(27305); +var CharacterDataImpl_1 = __nccwpck_require__(65330); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** - * Represents a parser for XML and HTML content. - * - * See: https://w3c.github.io/DOM-Parsing/#the-domparser-interface + * Represents a processing instruction node. */ -var DOMParserImpl = /** @class */ (function () { - function DOMParserImpl() { +var ProcessingInstructionImpl = /** @class */ (function (_super) { + __extends(ProcessingInstructionImpl, _super); + /** + * Initializes a new instance of `ProcessingInstruction`. + */ + function ProcessingInstructionImpl(target, data) { + var _this = _super.call(this, data) || this; + _this._target = target; + return _this; } - /** @inheritdoc */ - DOMParserImpl.prototype.parseFromString = function (source, mimeType) { - if (mimeType === "text/html") - throw new Error('HTML parser not implemented.'); - try { - var parser = new XMLParserImpl_1.XMLParserImpl(); - var doc = parser.parse(source); - doc._contentType = mimeType; - return doc; - } - catch (e) { - var errorNS = "http://www.mozilla.org/newlayout/xml/parsererror.xml"; - var doc = algorithm_1.create_xmlDocument(); - var root = doc.createElementNS(errorNS, "parsererror"); - var ele = doc.createElementNS(errorNS, "error"); - ele.setAttribute("message", e.message); - root.appendChild(ele); - doc.appendChild(root); - return doc; - } + Object.defineProperty(ProcessingInstructionImpl.prototype, "target", { + /** + * Gets the target of the {@link ProcessingInstruction} node. + */ + get: function () { return this._target; }, + enumerable: true, + configurable: true + }); + /** + * Creates a new `ProcessingInstruction`. + * + * @param document - owner document + * @param target - instruction target + * @param data - node contents + */ + ProcessingInstructionImpl._create = function (document, target, data) { + var node = new ProcessingInstructionImpl(target, data); + node._nodeDocument = document; + return node; }; - return DOMParserImpl; -}()); -exports.DOMParserImpl = DOMParserImpl; -//# sourceMappingURL=DOMParserImpl.js.map + return ProcessingInstructionImpl; +}(CharacterDataImpl_1.CharacterDataImpl)); +exports.ProcessingInstructionImpl = ProcessingInstructionImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(ProcessingInstructionImpl.prototype, "_nodeType", interfaces_1.NodeType.ProcessingInstruction); +//# sourceMappingURL=ProcessingInstructionImpl.js.map /***/ }), -/***/ 4126: +/***/ 50166: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var __values = (this && this.__values) || function(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); @@ -63625,983 +63628,836 @@ var __values = (this && this.__values) || function(o) { throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -var XMLStringLexer_1 = __nccwpck_require__(7061); -var interfaces_1 = __nccwpck_require__(7707); -var infra_1 = __nccwpck_require__(4251); +var DOMImpl_1 = __nccwpck_require__(14177); +var interfaces_1 = __nccwpck_require__(27305); +var AbstractRangeImpl_1 = __nccwpck_require__(57126); +var DOMException_1 = __nccwpck_require__(13166); var algorithm_1 = __nccwpck_require__(61); -var LocalNameSet_1 = __nccwpck_require__(9049); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +var util_1 = __nccwpck_require__(65282); /** - * Represents a parser for XML content. - * - * See: https://html.spec.whatwg.org/#xml-parser + * Represents a live range. */ -var XMLParserImpl = /** @class */ (function () { - function XMLParserImpl() { - } +var RangeImpl = /** @class */ (function (_super) { + __extends(RangeImpl, _super); /** - * Parses XML content. - * - * @param source - a string containing XML content + * Initializes a new instance of `Range`. */ - XMLParserImpl.prototype.parse = function (source) { - var e_1, _a, e_2, _b; - var lexer = new XMLStringLexer_1.XMLStringLexer(source, { skipWhitespaceOnlyText: true }); - var doc = algorithm_1.create_document(); - var context = doc; - var token = lexer.nextToken(); - while (token.type !== interfaces_1.TokenType.EOF) { - switch (token.type) { - case interfaces_1.TokenType.Declaration: - var declaration = token; - if (declaration.version !== "1.0") { - throw new Error("Invalid xml version: " + declaration.version); - } - break; - case interfaces_1.TokenType.DocType: - var doctype = token; - if (!algorithm_1.xml_isPubidChar(doctype.pubId)) { - throw new Error("DocType public identifier does not match PubidChar construct."); - } - if (!algorithm_1.xml_isLegalChar(doctype.sysId) || - (doctype.sysId.indexOf('"') !== -1 && doctype.sysId.indexOf("'") !== -1)) { - throw new Error("DocType system identifier contains invalid characters."); - } - context.appendChild(doc.implementation.createDocumentType(doctype.name, doctype.pubId, doctype.sysId)); - break; - case interfaces_1.TokenType.CDATA: - var cdata = token; - if (!algorithm_1.xml_isLegalChar(cdata.data) || - cdata.data.indexOf("]]>") !== -1) { - throw new Error("CDATA contains invalid characters."); - } - context.appendChild(doc.createCDATASection(cdata.data)); - break; - case interfaces_1.TokenType.Comment: - var comment = token; - if (!algorithm_1.xml_isLegalChar(comment.data) || - comment.data.indexOf("--") !== -1 || comment.data.endsWith("-")) { - throw new Error("Comment data contains invalid characters."); - } - context.appendChild(doc.createComment(comment.data)); - break; - case interfaces_1.TokenType.PI: - var pi = token; - if (pi.target.indexOf(":") !== -1 || (/^xml$/i).test(pi.target)) { - throw new Error("Processing instruction target contains invalid characters."); - } - if (!algorithm_1.xml_isLegalChar(pi.data) || pi.data.indexOf("?>") !== -1) { - throw new Error("Processing instruction data contains invalid characters."); - } - context.appendChild(doc.createProcessingInstruction(pi.target, pi.data)); - break; - case interfaces_1.TokenType.Text: - var text = token; - if (!algorithm_1.xml_isLegalChar(text.data)) { - throw new Error("Text data contains invalid characters."); - } - context.appendChild(doc.createTextNode(text.data)); - break; - case interfaces_1.TokenType.Element: - var element = token; - // inherit namespace from parent - var _c = __read(algorithm_1.namespace_extractQName(element.name), 2), prefix = _c[0], localName = _c[1]; - if (localName.indexOf(":") !== -1 || !algorithm_1.xml_isName(localName)) { - throw new Error("Node local name contains invalid characters."); - } - if (prefix === "xmlns") { - throw new Error("An element cannot have the 'xmlns' prefix."); - } - var namespace = context.lookupNamespaceURI(prefix); - // override namespace if there is a namespace declaration - // attribute - // also lookup namespace declaration attributes - var nsDeclarations = {}; - try { - for (var _d = (e_1 = void 0, __values(element.attributes)), _e = _d.next(); !_e.done; _e = _d.next()) { - var _f = __read(_e.value, 2), attName = _f[0], attValue = _f[1]; - if (attName === "xmlns") { - namespace = attValue; - } - else { - var _g = __read(algorithm_1.namespace_extractQName(attName), 2), attPrefix = _g[0], attLocalName = _g[1]; - if (attPrefix === "xmlns") { - if (attLocalName === prefix) { - namespace = attValue; - } - nsDeclarations[attLocalName] = attValue; - } - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_e && !_e.done && (_a = _d.return)) _a.call(_d); - } - finally { if (e_1) throw e_1.error; } - } - // create the DOM element node - var elementNode = (namespace !== null ? - doc.createElementNS(namespace, element.name) : - doc.createElement(element.name)); - context.appendChild(elementNode); - // assign attributes - var localNameSet = new LocalNameSet_1.LocalNameSet(); - try { - for (var _h = (e_2 = void 0, __values(element.attributes)), _j = _h.next(); !_j.done; _j = _h.next()) { - var _k = __read(_j.value, 2), attName = _k[0], attValue = _k[1]; - var _l = __read(algorithm_1.namespace_extractQName(attName), 2), attPrefix = _l[0], attLocalName = _l[1]; - var attNamespace = null; - if (attPrefix === "xmlns" || (attPrefix === null && attLocalName === "xmlns")) { - // namespace declaration attribute - attNamespace = infra_1.namespace.XMLNS; - } - else { - attNamespace = elementNode.lookupNamespaceURI(attPrefix); - if (attNamespace !== null && elementNode.isDefaultNamespace(attNamespace)) { - attNamespace = null; - } - else if (attNamespace === null && attPrefix !== null) { - attNamespace = nsDeclarations[attPrefix] || null; - } - } - if (localNameSet.has(attNamespace, attLocalName)) { - throw new Error("Element contains duplicate attributes."); - } - localNameSet.set(attNamespace, attLocalName); - if (attNamespace === infra_1.namespace.XMLNS) { - if (attValue === infra_1.namespace.XMLNS) { - throw new Error("XMLNS namespace is reserved."); - } - } - if (attLocalName.indexOf(":") !== -1 || !algorithm_1.xml_isName(attLocalName)) { - throw new Error("Attribute local name contains invalid characters."); - } - if (attPrefix === "xmlns" && attValue === "") { - throw new Error("Empty XML namespace is not allowed."); - } - if (attNamespace !== null) - elementNode.setAttributeNS(attNamespace, attName, attValue); - else - elementNode.setAttribute(attName, attValue); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_j && !_j.done && (_b = _h.return)) _b.call(_h); - } - finally { if (e_2) throw e_2.error; } - } - if (!element.selfClosing) { - context = elementNode; - } - break; - case interfaces_1.TokenType.ClosingTag: - var closingTag = token; - if (closingTag.name !== context.nodeName) { - throw new Error('Closing tag name does not match opening tag name.'); - } - /* istanbul ignore else */ - if (context._parent) { - context = context._parent; - } - break; + function RangeImpl() { + var _this = _super.call(this) || this; + /** + * The Range() constructor, when invoked, must return a new live range with + * (current global object’s associated Document, 0) as its start and end. + */ + var doc = DOMImpl_1.dom.window._associatedDocument; + _this._start = [doc, 0]; + _this._end = [doc, 0]; + DOMImpl_1.dom.rangeList.add(_this); + return _this; + } + Object.defineProperty(RangeImpl.prototype, "commonAncestorContainer", { + /** @inheritdoc */ + get: function () { + /** + * 1. Let container be start node. + * 2. While container is not an inclusive ancestor of end node, let + * container be container’s parent. + * 3. Return container. + */ + var container = this._start[0]; + while (!algorithm_1.tree_isAncestorOf(this._end[0], container, true)) { + if (container._parent === null) { + throw new Error("Parent node is null."); + } + container = container._parent; } - token = lexer.nextToken(); + return container; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + RangeImpl.prototype.setStart = function (node, offset) { + /** + * The setStart(node, offset) method, when invoked, must set the start of + * context object to boundary point (node, offset). + */ + algorithm_1.range_setTheStart(this, node, offset); + }; + /** @inheritdoc */ + RangeImpl.prototype.setEnd = function (node, offset) { + /** + * The setEnd(node, offset) method, when invoked, must set the end of + * context object to boundary point (node, offset). + */ + algorithm_1.range_setTheEnd(this, node, offset); + }; + /** @inheritdoc */ + RangeImpl.prototype.setStartBefore = function (node) { + /** + * 1. Let parent be node’s parent. + * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. + * 3. Set the start of the context object to boundary point + * (parent, node’s index). + */ + var parent = node._parent; + if (parent === null) + throw new DOMException_1.InvalidNodeTypeError(); + algorithm_1.range_setTheStart(this, parent, algorithm_1.tree_index(node)); + }; + /** @inheritdoc */ + RangeImpl.prototype.setStartAfter = function (node) { + /** + * 1. Let parent be node’s parent. + * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. + * 3. Set the start of the context object to boundary point + * (parent, node’s index plus 1). + */ + var parent = node._parent; + if (parent === null) + throw new DOMException_1.InvalidNodeTypeError(); + algorithm_1.range_setTheStart(this, parent, algorithm_1.tree_index(node) + 1); + }; + /** @inheritdoc */ + RangeImpl.prototype.setEndBefore = function (node) { + /** + * 1. Let parent be node’s parent. + * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. + * 3. Set the end of the context object to boundary point + * (parent, node’s index). + */ + var parent = node._parent; + if (parent === null) + throw new DOMException_1.InvalidNodeTypeError(); + algorithm_1.range_setTheEnd(this, parent, algorithm_1.tree_index(node)); + }; + /** @inheritdoc */ + RangeImpl.prototype.setEndAfter = function (node) { + /** + * 1. Let parent be node’s parent. + * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. + * 3. Set the end of the context object to boundary point + * (parent, node’s index plus 1). + */ + var parent = node._parent; + if (parent === null) + throw new DOMException_1.InvalidNodeTypeError(); + algorithm_1.range_setTheEnd(this, parent, algorithm_1.tree_index(node) + 1); + }; + /** @inheritdoc */ + RangeImpl.prototype.collapse = function (toStart) { + /** + * The collapse(toStart) method, when invoked, must if toStart is true, + * set end to start, and set start to end otherwise. + */ + if (toStart) { + this._end = this._start; + } + else { + this._start = this._end; } - return doc; }; - return XMLParserImpl; -}()); -exports.XMLParserImpl = XMLParserImpl; -//# sourceMappingURL=XMLParserImpl.js.map - -/***/ }), - -/***/ 7061: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); + /** @inheritdoc */ + RangeImpl.prototype.selectNode = function (node) { + /** + * The selectNode(node) method, when invoked, must select node within + * context object. + */ + algorithm_1.range_select(node, this); + }; + /** @inheritdoc */ + RangeImpl.prototype.selectNodeContents = function (node) { + /** + * 1. If node is a doctype, throw an "InvalidNodeTypeError" DOMException. + * 2. Let length be the length of node. + * 3. Set start to the boundary point (node, 0). + * 4. Set end to the boundary point (node, length). + */ + if (util_1.Guard.isDocumentTypeNode(node)) + throw new DOMException_1.InvalidNodeTypeError(); + var length = algorithm_1.tree_nodeLength(node); + this._start = [node, 0]; + this._end = [node, length]; + }; + /** @inheritdoc */ + RangeImpl.prototype.compareBoundaryPoints = function (how, sourceRange) { + /** + * 1. If how is not one of + * - START_TO_START, + * - START_TO_END, + * - END_TO_END, and + * - END_TO_START, + * then throw a "NotSupportedError" DOMException. + */ + if (how !== interfaces_1.HowToCompare.StartToStart && how !== interfaces_1.HowToCompare.StartToEnd && + how !== interfaces_1.HowToCompare.EndToEnd && how !== interfaces_1.HowToCompare.EndToStart) + throw new DOMException_1.NotSupportedError(); + /** + * 2. If context object’s root is not the same as sourceRange’s root, + * then throw a "WrongDocumentError" DOMException. + */ + if (algorithm_1.range_root(this) !== algorithm_1.range_root(sourceRange)) + throw new DOMException_1.WrongDocumentError(); + /** + * 3. If how is: + * - START_TO_START: + * Let this point be the context object’s start. Let other point be + * sourceRange’s start. + * - START_TO_END: + * Let this point be the context object’s end. Let other point be + * sourceRange’s start. + * - END_TO_END: + * Let this point be the context object’s end. Let other point be + * sourceRange’s end. + * - END_TO_START: + * Let this point be the context object’s start. Let other point be + * sourceRange’s end. + */ + var thisPoint; + var otherPoint; + switch (how) { + case interfaces_1.HowToCompare.StartToStart: + thisPoint = this._start; + otherPoint = sourceRange._start; + break; + case interfaces_1.HowToCompare.StartToEnd: + thisPoint = this._end; + otherPoint = sourceRange._start; + break; + case interfaces_1.HowToCompare.EndToEnd: + thisPoint = this._end; + otherPoint = sourceRange._end; + break; + case interfaces_1.HowToCompare.EndToStart: + thisPoint = this._start; + otherPoint = sourceRange._end; + break; + /* istanbul ignore next */ + default: + throw new DOMException_1.NotSupportedError(); } - finally { if (e) throw e.error; } - } - return ar; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7707); -/** - * Represents a lexer for XML content in a string. - */ -var XMLStringLexer = /** @class */ (function () { - /** - * Initializes a new instance of `XMLStringLexer`. - * - * @param str - the string to tokenize and lex - * @param options - lexer options - */ - function XMLStringLexer(str, options) { - this._options = { - skipWhitespaceOnlyText: false - }; - this.err = { line: -1, col: -1, index: -1, str: "" }; - this._str = str; - this._index = 0; - this._length = str.length; - if (options) { - this._options.skipWhitespaceOnlyText = options.skipWhitespaceOnlyText || false; + /** + * 4. If the position of this point relative to other point is + * - before + * Return −1. + * - equal + * Return 0. + * - after + * Return 1. + */ + var position = algorithm_1.boundaryPoint_position(thisPoint, otherPoint); + if (position === interfaces_1.BoundaryPosition.Before) { + return -1; } - } - /** - * Returns the next token. - */ - XMLStringLexer.prototype.nextToken = function () { - if (this.eof()) { - return { type: interfaces_1.TokenType.EOF }; + else if (position === interfaces_1.BoundaryPosition.After) { + return 1; } - var token = (this.skipIfStartsWith('<') ? this.openBracket() : this.text()); - if (this._options.skipWhitespaceOnlyText) { - if (token.type === interfaces_1.TokenType.Text && - XMLStringLexer.isWhiteSpaceToken(token)) { - token = this.nextToken(); - } + else { + return 0; } - return token; }; - /** - * Branches from an opening bracket (`<`). - */ - XMLStringLexer.prototype.openBracket = function () { - if (this.skipIfStartsWith('?')) { - if (this.skipIfStartsWith('xml')) { - if (XMLStringLexer.isSpace(this._str[this._index])) { - return this.declaration(); - } - else { - // a processing instruction starting with xml. e.g. - this.seek(-3); - return this.pi(); + /** @inheritdoc */ + RangeImpl.prototype.deleteContents = function () { + var e_1, _a, e_2, _b; + /** + * 1. If the context object is collapsed, then return. + * 2. Let original start node, original start offset, original end node, + * and original end offset be the context object’s start node, + * start offset, end node, and end offset, respectively. + */ + if (algorithm_1.range_collapsed(this)) + return; + var originalStartNode = this._startNode; + var originalStartOffset = this._startOffset; + var originalEndNode = this._endNode; + var originalEndOffset = this._endOffset; + /** + * 3. If original start node and original end node are the same, and they + * are a Text, ProcessingInstruction, or Comment node, replace data with + * node original start node, offset original start offset, count original + * end offset minus original start offset, and data the empty string, + * and then return. + */ + if (originalStartNode === originalEndNode && + util_1.Guard.isCharacterDataNode(originalStartNode)) { + algorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset, ''); + return; + } + /** + * 4. Let nodes to remove be a list of all the nodes that are contained in + * the context object, in tree order, omitting any node whose parent is also + * contained in the context object. + */ + var nodesToRemove = []; + try { + for (var _c = __values(algorithm_1.range_getContainedNodes(this)), _d = _c.next(); !_d.done; _d = _c.next()) { + var node = _d.value; + var parent = node._parent; + if (parent !== null && algorithm_1.range_isContained(parent, this)) { + continue; } - } - else { - return this.pi(); + nodesToRemove.push(node); } } - else if (this.skipIfStartsWith('!')) { - if (this.skipIfStartsWith('--')) { - return this.comment(); - } - else if (this.skipIfStartsWith('[CDATA[')) { - return this.cdata(); - } - else if (this.skipIfStartsWith('DOCTYPE')) { - return this.doctype(); - } - else { - this.throwError("Invalid '!' in opening tag."); + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_d && !_d.done && (_a = _c.return)) _a.call(_c); } + finally { if (e_1) throw e_1.error; } } - else if (this.skipIfStartsWith('/')) { - return this.closeTag(); + var newNode; + var newOffset; + if (algorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { + /** + * 5. If original start node is an inclusive ancestor of original end + * node, set new node to original start node and new offset to original + * start offset. + */ + newNode = originalStartNode; + newOffset = originalStartOffset; } else { - return this.openTag(); - } - }; - /** - * Produces an XML declaration token. - */ - XMLStringLexer.prototype.declaration = function () { - var version = ''; - var encoding = ''; - var standalone = ''; - while (!this.eof()) { - this.skipSpace(); - if (this.skipIfStartsWith('?>')) { - return { type: interfaces_1.TokenType.Declaration, version: version, encoding: encoding, standalone: standalone }; + /** + * 6. Otherwise: + * 6.1. Let reference node equal original start node. + * 6.2. While reference node’s parent is not null and is not an inclusive + * ancestor of original end node, set reference node to its parent. + * 6.3. Set new node to the parent of reference node, and new offset to + * one plus the index of reference node. + */ + var referenceNode = originalStartNode; + while (referenceNode._parent !== null && + !algorithm_1.tree_isAncestorOf(originalEndNode, referenceNode._parent, true)) { + referenceNode = referenceNode._parent; } - else { - // attribute name - var _a = __read(this.attribute(), 2), attName = _a[0], attValue = _a[1]; - if (attName === 'version') - version = attValue; - else if (attName === 'encoding') - encoding = attValue; - else if (attName === 'standalone') - standalone = attValue; - else - this.throwError('Invalid attribute name: ' + attName); + /* istanbul ignore next */ + if (referenceNode._parent === null) { + throw new Error("Parent node is null."); } + newNode = referenceNode._parent; + newOffset = algorithm_1.tree_index(referenceNode) + 1; } - this.throwError('Missing declaration end symbol `?>`'); - }; - /** - * Produces a doc type token. - */ - XMLStringLexer.prototype.doctype = function () { - var pubId = ''; - var sysId = ''; - // name - this.skipSpace(); - var name = this.takeUntil2('[', '>', true); - this.skipSpace(); - if (this.skipIfStartsWith('PUBLIC')) { - pubId = this.quotedString(); - sysId = this.quotedString(); + /** + * 7. If original start node is a Text, ProcessingInstruction, or Comment + * node, replace data with node original start node, offset original start + * offset, count original start node’s length minus original start offset, + * data the empty string. + */ + if (util_1.Guard.isCharacterDataNode(originalStartNode)) { + algorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, algorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset, ''); } - else if (this.skipIfStartsWith('SYSTEM')) { - sysId = this.quotedString(); + try { + /** + * 8. For each node in nodes to remove, in tree order, remove node from its + * parent. + */ + for (var nodesToRemove_1 = __values(nodesToRemove), nodesToRemove_1_1 = nodesToRemove_1.next(); !nodesToRemove_1_1.done; nodesToRemove_1_1 = nodesToRemove_1.next()) { + var node = nodesToRemove_1_1.value; + /* istanbul ignore else */ + if (node._parent) { + algorithm_1.mutation_remove(node, node._parent); + } + } } - // skip internal subset - this.skipSpace(); - if (this.skipIfStartsWith('[')) { - // skip internal subset nodes - this.skipUntil(']'); - if (!this.skipIfStartsWith(']')) { - this.throwError('Missing end bracket of DTD internal subset'); + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (nodesToRemove_1_1 && !nodesToRemove_1_1.done && (_b = nodesToRemove_1.return)) _b.call(nodesToRemove_1); } + finally { if (e_2) throw e_2.error; } } - this.skipSpace(); - if (!this.skipIfStartsWith('>')) { - this.throwError('Missing doctype end symbol `>`'); + /** + * 9. If original end node is a Text, ProcessingInstruction, or Comment + * node, replace data with node original end node, offset 0, count original + * end offset and data the empty string. + */ + if (util_1.Guard.isCharacterDataNode(originalEndNode)) { + algorithm_1.characterData_replaceData(originalEndNode, 0, originalEndOffset, ''); } - return { type: interfaces_1.TokenType.DocType, name: name, pubId: pubId, sysId: sysId }; + /** + * 10. Set start and end to (new node, new offset). + */ + this._start = [newNode, newOffset]; + this._end = [newNode, newOffset]; }; - /** - * Produces a processing instruction token. - */ - XMLStringLexer.prototype.pi = function () { - var target = this.takeUntilStartsWith('?>', true); - if (this.eof()) { - this.throwError('Missing processing instruction end symbol `?>`'); + /** @inheritdoc */ + RangeImpl.prototype.extractContents = function () { + /** + * The extractContents() method, when invoked, must return the result of + * extracting the context object. + */ + return algorithm_1.range_extract(this); + }; + /** @inheritdoc */ + RangeImpl.prototype.cloneContents = function () { + /** + * The cloneContents() method, when invoked, must return the result of + * cloning the contents of the context object. + */ + return algorithm_1.range_cloneTheContents(this); + }; + /** @inheritdoc */ + RangeImpl.prototype.insertNode = function (node) { + /** + * The insertNode(node) method, when invoked, must insert node into the + * context object. + */ + return algorithm_1.range_insert(node, this); + }; + /** @inheritdoc */ + RangeImpl.prototype.surroundContents = function (newParent) { + var e_3, _a; + try { + /** + * 1. If a non-Text node is partially contained in the context object, then + * throw an "InvalidStateError" DOMException. + */ + for (var _b = __values(algorithm_1.range_getPartiallyContainedNodes(this)), _c = _b.next(); !_c.done; _c = _b.next()) { + var node = _c.value; + if (!util_1.Guard.isTextNode(node)) { + throw new DOMException_1.InvalidStateError(); + } + } } - this.skipSpace(); - if (this.skipIfStartsWith('?>')) { - return { type: interfaces_1.TokenType.PI, target: target, data: '' }; + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_3) throw e_3.error; } } - var data = this.takeUntilStartsWith('?>'); - if (this.eof()) { - this.throwError('Missing processing instruction end symbol `?>`'); + /** + * 2. If newParent is a Document, DocumentType, or DocumentFragment node, + * then throw an "InvalidNodeTypeError" DOMException. + */ + if (util_1.Guard.isDocumentNode(newParent) || + util_1.Guard.isDocumentTypeNode(newParent) || + util_1.Guard.isDocumentFragmentNode(newParent)) { + throw new DOMException_1.InvalidNodeTypeError(); } - this.seek(2); - return { type: interfaces_1.TokenType.PI, target: target, data: data }; + /** + * 3. Let fragment be the result of extracting the context object. + */ + var fragment = algorithm_1.range_extract(this); + /** + * 4. If newParent has children, then replace all with null within newParent. + */ + if ((newParent)._children.size !== 0) { + algorithm_1.mutation_replaceAll(null, newParent); + } + /** + * 5. Insert newParent into the context object. + * 6. Append fragment to newParent. + */ + algorithm_1.range_insert(newParent, this); + algorithm_1.mutation_append(fragment, newParent); + /** + * 7. Select newParent within the context object. + */ + algorithm_1.range_select(newParent, this); }; - /** - * Produces a text token. - * - */ - XMLStringLexer.prototype.text = function () { - var data = this.takeUntil('<'); - return { type: interfaces_1.TokenType.Text, data: data }; + /** @inheritdoc */ + RangeImpl.prototype.cloneRange = function () { + /** + * The cloneRange() method, when invoked, must return a new live range with + * the same start and end as the context object. + */ + return algorithm_1.create_range(this._start, this._end); }; - /** - * Produces a comment token. - * - */ - XMLStringLexer.prototype.comment = function () { - var data = this.takeUntilStartsWith('-->'); - if (this.eof()) { - this.throwError('Missing comment end symbol `-->`'); - } - this.seek(3); - return { type: interfaces_1.TokenType.Comment, data: data }; + /** @inheritdoc */ + RangeImpl.prototype.detach = function () { + /** + * The detach() method, when invoked, must do nothing. + * + * since JS lacks weak references, we still use detach + */ + DOMImpl_1.dom.rangeList.delete(this); }; - /** - * Produces a CDATA token. - * - */ - XMLStringLexer.prototype.cdata = function () { - var data = this.takeUntilStartsWith(']]>'); - if (this.eof()) { - this.throwError('Missing CDATA end symbol `]>`'); + /** @inheritdoc */ + RangeImpl.prototype.isPointInRange = function (node, offset) { + /** + * 1. If node’s root is different from the context object’s root, return false. + */ + if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) { + return false; } - this.seek(3); - return { type: interfaces_1.TokenType.CDATA, data: data }; + /** + * 2. If node is a doctype, then throw an "InvalidNodeTypeError" DOMException. + * 3. If offset is greater than node’s length, then throw an + * "IndexSizeError" DOMException. + */ + if (util_1.Guard.isDocumentTypeNode(node)) + throw new DOMException_1.InvalidNodeTypeError(); + if (offset > algorithm_1.tree_nodeLength(node)) + throw new DOMException_1.IndexSizeError(); + /** + * 4. If (node, offset) is before start or after end, return false. + */ + var bp = [node, offset]; + if (algorithm_1.boundaryPoint_position(bp, this._start) === interfaces_1.BoundaryPosition.Before || + algorithm_1.boundaryPoint_position(bp, this._end) === interfaces_1.BoundaryPosition.After) { + return false; + } + /** + * 5. Return true. + */ + return true; }; - /** - * Produces an element token. - */ - XMLStringLexer.prototype.openTag = function () { - // element name - this.skipSpace(); - var name = this.takeUntil2('>', '/', true); - this.skipSpace(); - if (this.skipIfStartsWith('>')) { - return { type: interfaces_1.TokenType.Element, name: name, attributes: [], selfClosing: false }; + /** @inheritdoc */ + RangeImpl.prototype.comparePoint = function (node, offset) { + /** + * 1. If node’s root is different from the context object’s root, then throw + * a "WrongDocumentError" DOMException. + * 2. If node is a doctype, then throw an "InvalidNodeTypeError" DOMException. + * 3. If offset is greater than node’s length, then throw an + * "IndexSizeError" DOMException. + */ + if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) + throw new DOMException_1.WrongDocumentError(); + if (util_1.Guard.isDocumentTypeNode(node)) + throw new DOMException_1.InvalidNodeTypeError(); + if (offset > algorithm_1.tree_nodeLength(node)) + throw new DOMException_1.IndexSizeError(); + /** + * 4. If (node, offset) is before start, return −1. + * 5. If (node, offset) is after end, return 1. + * 6. Return 0. + */ + var bp = [node, offset]; + if (algorithm_1.boundaryPoint_position(bp, this._start) === interfaces_1.BoundaryPosition.Before) { + return -1; } - else if (this.skipIfStartsWith('/>')) { - return { type: interfaces_1.TokenType.Element, name: name, attributes: [], selfClosing: true }; + else if (algorithm_1.boundaryPoint_position(bp, this._end) === interfaces_1.BoundaryPosition.After) { + return 1; } - // attributes - var attributes = []; - while (!this.eof()) { - // end tag - this.skipSpace(); - if (this.skipIfStartsWith('>')) { - return { type: interfaces_1.TokenType.Element, name: name, attributes: attributes, selfClosing: false }; - } - else if (this.skipIfStartsWith('/>')) { - return { type: interfaces_1.TokenType.Element, name: name, attributes: attributes, selfClosing: true }; - } - var attr = this.attribute(); - attributes.push(attr); + else { + return 0; } - this.throwError('Missing opening element tag end symbol `>`'); }; - /** - * Produces a closing tag token. - * - */ - XMLStringLexer.prototype.closeTag = function () { - this.skipSpace(); - var name = this.takeUntil('>', true); - this.skipSpace(); - if (!this.skipIfStartsWith('>')) { - this.throwError('Missing closing element tag end symbol `>`'); + /** @inheritdoc */ + RangeImpl.prototype.intersectsNode = function (node) { + /** + * 1. If node’s root is different from the context object’s root, return false. + */ + if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) { + return false; } - return { type: interfaces_1.TokenType.ClosingTag, name: name }; - }; - /** - * Reads an attribute name, value pair - */ - XMLStringLexer.prototype.attribute = function () { - // attribute name - this.skipSpace(); - var name = this.takeUntil('=', true); - this.skipSpace(); - if (!this.skipIfStartsWith('=')) { - this.throwError('Missing equals sign before attribute value'); + /** + * 2. Let parent be node’s parent. + * 3. If parent is null, return true. + */ + var parent = node._parent; + if (parent === null) + return true; + /** + * 4. Let offset be node’s index. + */ + var offset = algorithm_1.tree_index(node); + /** + * 5. If (parent, offset) is before end and (parent, offset plus 1) is + * after start, return true. + */ + if (algorithm_1.boundaryPoint_position([parent, offset], this._end) === interfaces_1.BoundaryPosition.Before && + algorithm_1.boundaryPoint_position([parent, offset + 1], this._start) === interfaces_1.BoundaryPosition.After) { + return true; } - // attribute value - var value = this.quotedString(); - return [name, value]; + /** + * 6. Return false. + */ + return false; }; - /** - * Reads a string between double or single quotes. - */ - XMLStringLexer.prototype.quotedString = function () { - this.skipSpace(); - var startQuote = this.take(1); - if (!XMLStringLexer.isQuote(startQuote)) { - this.throwError('Missing start quote character before quoted value'); + RangeImpl.prototype.toString = function () { + var e_4, _a; + /** + * 1. Let s be the empty string. + */ + var s = ''; + /** + * 2. If the context object’s start node is the context object’s end node + * and it is a Text node, then return the substring of that Text node’s data + * beginning at the context object’s start offset and ending at the context + * object’s end offset. + */ + if (this._startNode === this._endNode && util_1.Guard.isTextNode(this._startNode)) { + return this._startNode._data.substring(this._startOffset, this._endOffset); } - var value = this.takeUntil(startQuote); - if (!this.skipIfStartsWith(startQuote)) { - this.throwError('Missing end quote character after quoted value'); + /** + * 3. If the context object’s start node is a Text node, then append the + * substring of that node’s data from the context object’s start offset + * until the end to s. + */ + if (util_1.Guard.isTextNode(this._startNode)) { + s += this._startNode._data.substring(this._startOffset); } - return value; - }; - /** - * Determines if the current index is at or past the end of input string. - */ - XMLStringLexer.prototype.eof = function () { return this._index >= this._length; }; - /** - * Skips the length of the given string if the string from current position - * starts with the given string. - * - * @param str - the string to match - */ - XMLStringLexer.prototype.skipIfStartsWith = function (str) { - var strLength = str.length; - if (strLength === 1) { - if (this._str[this._index] === str) { - this._index++; - return true; + try { + /** + * 4. Append the concatenation of the data of all Text nodes that are + * contained in the context object, in tree order, to s. + */ + for (var _b = __values(algorithm_1.range_getContainedNodes(this)), _c = _b.next(); !_c.done; _c = _b.next()) { + var child = _c.value; + if (util_1.Guard.isTextNode(child)) { + s += child._data; + } } - else { - return false; + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } + finally { if (e_4) throw e_4.error; } } - for (var i = 0; i < strLength; i++) { - if (this._str[this._index + i] !== str[i]) - return false; + /** + * 5. If the context object’s end node is a Text node, then append the + * substring of that node’s data from its start until the context object’s + * end offset to s. + */ + if (util_1.Guard.isTextNode(this._endNode)) { + s += this._endNode._data.substring(0, this._endOffset); } - this._index += strLength; - return true; + /** + * 6. Return s. + */ + return s; }; /** - * Seeks a number of character codes. + * Creates a new `Range`. * - * @param count - number of characters to skip + * @param start - start point + * @param end - end point */ - XMLStringLexer.prototype.seek = function (count) { - this._index += count; - if (this._index < 0) - this._index = 0; - if (this._index > this._length) - this._index = this._length; + RangeImpl._create = function (start, end) { + var range = new RangeImpl(); + if (start) + range._start = start; + if (end) + range._end = end; + return range; }; - /** - * Skips space characters. - */ - XMLStringLexer.prototype.skipSpace = function () { - while (!this.eof() && (XMLStringLexer.isSpace(this._str[this._index]))) { - this._index++; - } + RangeImpl.START_TO_START = 0; + RangeImpl.START_TO_END = 1; + RangeImpl.END_TO_END = 2; + RangeImpl.END_TO_START = 3; + return RangeImpl; +}(AbstractRangeImpl_1.AbstractRangeImpl)); +exports.RangeImpl = RangeImpl; +/** + * Define constants on prototype. + */ +WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "START_TO_START", 0); +WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "START_TO_END", 1); +WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "END_TO_END", 2); +WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "END_TO_START", 3); +//# sourceMappingURL=RangeImpl.js.map + +/***/ }), + +/***/ 61911: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); }; - /** - * Takes a given number of characters. - * - * @param count - character count - */ - XMLStringLexer.prototype.take = function (count) { - if (count === 1) { - return this._str[this._index++]; - } - var startIndex = this._index; - this.seek(count); - return this._str.slice(startIndex, this._index); + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var DocumentFragmentImpl_1 = __nccwpck_require__(12585); +var util_1 = __nccwpck_require__(76195); +var algorithm_1 = __nccwpck_require__(61); +/** + * Represents a shadow root. + */ +var ShadowRootImpl = /** @class */ (function (_super) { + __extends(ShadowRootImpl, _super); /** - * Takes characters until the next character matches `char`. + * Initializes a new instance of `ShadowRoot`. * - * @param char - a character to match - * @param space - whether a space character stops iteration + * @param host - shadow root's host element + * @param mode - shadow root's mode */ - XMLStringLexer.prototype.takeUntil = function (char, space) { - if (space === void 0) { space = false; } - var startIndex = this._index; - while (this._index < this._length) { - var c = this._str[this._index]; - if (c !== char && (!space || !XMLStringLexer.isSpace(c))) { - this._index++; - } - else { - break; - } - } - return this._str.slice(startIndex, this._index); - }; - /** - * Takes characters until the next character matches `char1` or `char1`. - * - * @param char1 - a character to match - * @param char2 - a character to match - * @param space - whether a space character stops iteration - */ - XMLStringLexer.prototype.takeUntil2 = function (char1, char2, space) { - if (space === void 0) { space = false; } - var startIndex = this._index; - while (this._index < this._length) { - var c = this._str[this._index]; - if (c !== char1 && c !== char2 && (!space || !XMLStringLexer.isSpace(c))) { - this._index++; - } - else { - break; - } - } - return this._str.slice(startIndex, this._index); - }; - /** - * Takes characters until the next characters matches `str`. - * - * @param str - a string to match - * @param space - whether a space character stops iteration - */ - XMLStringLexer.prototype.takeUntilStartsWith = function (str, space) { - if (space === void 0) { space = false; } - var startIndex = this._index; - var strLength = str.length; - while (this._index < this._length) { - var match = true; - for (var i = 0; i < strLength; i++) { - var c = this._str[this._index + i]; - var char = str[i]; - if (space && XMLStringLexer.isSpace(c)) { - return this._str.slice(startIndex, this._index); - } - else if (c !== char) { - this._index++; - match = false; - break; - } - } - if (match) - return this._str.slice(startIndex, this._index); - } - this._index = this._length; - return this._str.slice(startIndex); - }; + function ShadowRootImpl(host, mode) { + var _this = _super.call(this) || this; + _this._host = host; + _this._mode = mode; + return _this; + } + Object.defineProperty(ShadowRootImpl.prototype, "mode", { + /** @inheritdoc */ + get: function () { return this._mode; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ShadowRootImpl.prototype, "host", { + /** @inheritdoc */ + get: function () { return this._host; }, + enumerable: true, + configurable: true + }); /** - * Skips characters until the next character matches `char`. + * Gets the parent event target for the given event. * - * @param char - a character to match + * @param event - an event */ - XMLStringLexer.prototype.skipUntil = function (char) { - while (this._index < this._length) { - var c = this._str[this._index]; - if (c !== char) { - this._index++; - } - else { - break; - } + ShadowRootImpl.prototype._getTheParent = function (event) { + /** + * A shadow root’s get the parent algorithm, given an event, returns null + * if event’s composed flag is unset and shadow root is the root of + * event’s path’s first struct’s invocation target, and shadow root’s host + * otherwise. + */ + if (!event._composedFlag && !util_1.isEmpty(event._path) && + algorithm_1.tree_rootNode(event._path[0].invocationTarget) === this) { + return null; } - }; - /** - * Determines if the given token is entirely whitespace. - * - * @param token - the token to check - */ - XMLStringLexer.isWhiteSpaceToken = function (token) { - var str = token.data; - for (var i = 0; i < str.length; i++) { - var c = str[i]; - if (c !== ' ' && c !== '\n' && c !== '\r' && c !== '\t' && c !== '\f') - return false; + else { + return this._host; } - return true; - }; - /** - * Determines if the given character is whitespace. - * - * @param char - the character to check - */ - XMLStringLexer.isSpace = function (char) { - return char === ' ' || char === '\n' || char === '\r' || char === '\t'; - }; - /** - * Determines if the given character is a quote character. - * - * @param char - the character to check - */ - XMLStringLexer.isQuote = function (char) { - return (char === '"' || char === '\''); }; + // MIXIN: DocumentOrShadowRoot + // No elements /** - * Throws a parser error and records the line and column numbers in the parsed - * string. + * Creates a new `ShadowRoot`. * - * @param msg - error message - */ - XMLStringLexer.prototype.throwError = function (msg) { - var regexp = /\r\n|\r|\n/g; - var match = null; - var line = 0; - var firstNewLineIndex = 0; - var lastNewlineIndex = this._str.length; - while ((match = regexp.exec(this._str)) !== null) { - if (match === null) - break; - line++; - if (match.index < this._index) - firstNewLineIndex = regexp.lastIndex; - if (match.index > this._index) { - lastNewlineIndex = match.index; - break; - } - } - this.err = { - line: line, - col: this._index - firstNewLineIndex, - index: this._index, - str: this._str.substring(firstNewLineIndex, lastNewlineIndex) - }; - throw new Error(msg + "\nIndex: " + this.err.index + - "\nLn: " + this.err.line + ", Col: " + this.err.col + - "\nInput: " + this.err.str); - }; - /** - * Returns an iterator for the lexer. + * @param document - owner document + * @param host - shadow root's host element */ - XMLStringLexer.prototype[Symbol.iterator] = function () { - this._index = 0; - return { - next: function () { - var token = this.nextToken(); - if (token.type === interfaces_1.TokenType.EOF) { - return { done: true, value: null }; - } - else { - return { done: false, value: token }; - } - }.bind(this) - }; + ShadowRootImpl._create = function (document, host) { + return new ShadowRootImpl(host, "closed"); }; - return XMLStringLexer; -}()); -exports.XMLStringLexer = XMLStringLexer; -//# sourceMappingURL=XMLStringLexer.js.map + return ShadowRootImpl; +}(DocumentFragmentImpl_1.DocumentFragmentImpl)); +exports.ShadowRootImpl = ShadowRootImpl; +//# sourceMappingURL=ShadowRootImpl.js.map /***/ }), -/***/ 6216: +/***/ 21964: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -// Export classes -var DOMParserImpl_1 = __nccwpck_require__(8845); -exports.DOMParser = DOMParserImpl_1.DOMParserImpl; -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ 7707: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -/** - * Defines the type of a token. - */ -var TokenType; -(function (TokenType) { - TokenType[TokenType["EOF"] = 0] = "EOF"; - TokenType[TokenType["Declaration"] = 1] = "Declaration"; - TokenType[TokenType["DocType"] = 2] = "DocType"; - TokenType[TokenType["Element"] = 3] = "Element"; - TokenType[TokenType["Text"] = 4] = "Text"; - TokenType[TokenType["CDATA"] = 5] = "CDATA"; - TokenType[TokenType["PI"] = 6] = "PI"; - TokenType[TokenType["Comment"] = 7] = "Comment"; - TokenType[TokenType["ClosingTag"] = 8] = "ClosingTag"; -})(TokenType = exports.TokenType || (exports.TokenType = {})); -//# sourceMappingURL=interfaces.js.map - -/***/ }), - -/***/ 9049: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); +var algorithm_1 = __nccwpck_require__(61); /** - * Represents a set of unique attribute namespaceURI and localName pairs. - * This set will contain tuples of unique attribute namespaceURI and - * localName pairs, and is populated as each attr is processed. This set is - * used to [optionally] enforce the well-formed constraint that an element - * cannot have two attributes with the same namespaceURI and localName. - * This can occur when two otherwise identical attributes on the same - * element differ only by their prefix values. + * Represents a mixin that allows nodes to become the contents of + * a element. This mixin is implemented by {@link Element} and + * {@link Text}. */ -var LocalNameSet = /** @class */ (function () { - function LocalNameSet() { - // tuple storage - this._items = {}; - this._nullItems = {}; +var SlotableImpl = /** @class */ (function () { + function SlotableImpl() { } - /** - * Adds or replaces a tuple. - * - * @param ns - namespace URI - * @param localName - attribute local name - */ - LocalNameSet.prototype.set = function (ns, localName) { - if (ns === null) { - this._nullItems[localName] = true; - } - else if (this._items[ns]) { - this._items[ns][localName] = true; - } - else { - this._items[ns] = {}; - this._items[ns][localName] = true; - } - }; - /** - * Determines if the given tuple exists in the set. - * - * @param ns - namespace URI - * @param localName - attribute local name - */ - LocalNameSet.prototype.has = function (ns, localName) { - if (ns === null) { - return this._nullItems[localName] === true; - } - else if (this._items[ns]) { - return this._items[ns][localName] === true; - } - else { - return false; - } - }; - return LocalNameSet; + Object.defineProperty(SlotableImpl.prototype, "_name", { + get: function () { return this.__name || ''; }, + set: function (val) { this.__name = val; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SlotableImpl.prototype, "_assignedSlot", { + get: function () { return this.__assignedSlot || null; }, + set: function (val) { this.__assignedSlot = val; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SlotableImpl.prototype, "assignedSlot", { + /** @inheritdoc */ + get: function () { + return algorithm_1.shadowTree_findASlot(this, true); + }, + enumerable: true, + configurable: true + }); + return SlotableImpl; }()); -exports.LocalNameSet = LocalNameSet; -//# sourceMappingURL=LocalNameSet.js.map +exports.SlotableImpl = SlotableImpl; +//# sourceMappingURL=SlotableImpl.js.map /***/ }), -/***/ 283: -/***/ ((__unused_webpack_module, exports) => { +/***/ 86357: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); Object.defineProperty(exports, "__esModule", ({ value: true })); +var AbstractRangeImpl_1 = __nccwpck_require__(57126); +var DOMException_1 = __nccwpck_require__(13166); +var util_1 = __nccwpck_require__(65282); /** - * A namespace prefix map is a map that associates namespaceURI and namespace - * prefix lists, where namespaceURI values are the map's unique keys (which can - * include the null value representing no namespace), and ordered lists of - * associated prefix values are the map's key values. The namespace prefix map - * will be populated by previously seen namespaceURIs and all their previously - * encountered prefix associations for a given node and its ancestors. - * - * _Note:_ The last seen prefix for a given namespaceURI is at the end of its - * respective list. The list is searched to find potentially matching prefixes, - * and if no matches are found for the given namespaceURI, then the last prefix - * in the list is used. See copy a namespace prefix map and retrieve a preferred - * prefix string for additional details. - * - * See: https://w3c.github.io/DOM-Parsing/#the-namespace-prefix-map + * Represents a static range. */ -var NamespacePrefixMap = /** @class */ (function () { - function NamespacePrefixMap() { - this._items = {}; - this._nullItems = []; - } - /** - * Creates a copy of the map. - */ - NamespacePrefixMap.prototype.copy = function () { - /** - * To copy a namespace prefix map map means to copy the map's keys into a - * new empty namespace prefix map, and to copy each of the values in the - * namespace prefix list associated with each keys' value into a new list - * which should be associated with the respective key in the new map. - */ - var mapCopy = new NamespacePrefixMap(); - for (var key in this._items) { - mapCopy._items[key] = this._items[key].slice(0); - } - mapCopy._nullItems = this._nullItems.slice(0); - return mapCopy; - }; - /** - * Retrieves a preferred prefix string from the namespace prefix map. - * - * @param preferredPrefix - preferred prefix string - * @param ns - namespace - */ - NamespacePrefixMap.prototype.get = function (preferredPrefix, ns) { - /** - * 1. Let candidates list be the result of retrieving a list from map where - * there exists a key in map that matches the value of ns or if there is no - * such key, then stop running these steps, and return the null value. - */ - var candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); - if (candidatesList === null) { - return null; - } - /** - * 2. Otherwise, for each prefix value prefix in candidates list, iterating - * from beginning to end: - * - * _Note:_ There will always be at least one prefix value in the list. - */ - var prefix = null; - for (var i = 0; i < candidatesList.length; i++) { - prefix = candidatesList[i]; - /** - * 2.1. If prefix matches preferred prefix, then stop running these steps - * and return prefix. - */ - if (prefix === preferredPrefix) { - return prefix; - } - } - /** - * 2.2. If prefix is the last item in the candidates list, then stop - * running these steps and return prefix. - */ - return prefix; - }; - /** - * Checks if a prefix string is found in the namespace prefix map associated - * with the given namespace. - * - * @param prefix - prefix string - * @param ns - namespace - */ - NamespacePrefixMap.prototype.has = function (prefix, ns) { - /** - * 1. Let candidates list be the result of retrieving a list from map where - * there exists a key in map that matches the value of ns or if there is - * no such key, then stop running these steps, and return false. - */ - var candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); - if (candidatesList === null) { - return false; - } - /** - * 2. If the value of prefix occurs at least once in candidates list, - * return true, otherwise return false. - */ - return (candidatesList.indexOf(prefix) !== -1); - }; - /** - * Checks if a prefix string is found in the namespace prefix map. - * - * @param prefix - prefix string - */ - NamespacePrefixMap.prototype.hasPrefix = function (prefix) { - if (this._nullItems.indexOf(prefix) !== -1) - return true; - for (var key in this._items) { - if (this._items[key].indexOf(prefix) !== -1) - return true; - } - return false; - }; +var StaticRangeImpl = /** @class */ (function (_super) { + __extends(StaticRangeImpl, _super); /** - * Adds a prefix string associated with a namespace to the prefix map. - * - * @param prefix - prefix string - * @param ns - namespace + * Initializes a new instance of `StaticRange`. */ - NamespacePrefixMap.prototype.set = function (prefix, ns) { - /** - * 1. Let candidates list be the result of retrieving a list from map where - * there exists a key in map that matches the value of ns or if there is - * no such key, then let candidates list be null. - */ - var candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); + function StaticRangeImpl(init) { + var _this = _super.call(this) || this; /** - * 2. If candidates list is null, then create a new list with prefix as the - * only item in the list, and associate that list with a new key ns in map. - * 3. Otherwise, append prefix to the end of candidates list. - * - * _Note:_ The steps in retrieve a preferred prefix string use the list to - * track the most recently used (MRU) prefix associated with a given - * namespace, which will be the prefix at the end of the list. This list - * may contain duplicates of the same prefix value seen earlier - * (and that's OK). + * 1. If init’s startContainer or endContainer is a DocumentType or Attr + * node, then throw an "InvalidNodeTypeError" DOMException. + * 2. Let staticRange be a new StaticRange object. + * 3. Set staticRange’s start to (init’s startContainer, init’s startOffset) + * and end to (init’s endContainer, init’s endOffset). + * 4. Return staticRange. */ - if (ns !== null && candidatesList === null) { - this._items[ns] = [prefix]; - } - else { - candidatesList.push(prefix); + if (util_1.Guard.isDocumentTypeNode(init.startContainer) || util_1.Guard.isAttrNode(init.startContainer) || + util_1.Guard.isDocumentTypeNode(init.endContainer) || util_1.Guard.isAttrNode(init.endContainer)) { + throw new DOMException_1.InvalidNodeTypeError(); } - }; - return NamespacePrefixMap; -}()); -exports.NamespacePrefixMap = NamespacePrefixMap; -//# sourceMappingURL=NamespacePrefixMap.js.map + _this._start = [init.startContainer, init.startOffset]; + _this._end = [init.endContainer, init.endOffset]; + return _this; + } + return StaticRangeImpl; +}(AbstractRangeImpl_1.AbstractRangeImpl)); +exports.StaticRangeImpl = StaticRangeImpl; +//# sourceMappingURL=StaticRangeImpl.js.map /***/ }), -/***/ 5039: +/***/ 42191: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var __values = (this && this.__values) || function(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); @@ -64614,2186 +64470,1773 @@ var __values = (this && this.__values) || function(o) { throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -var LocalNameSet_1 = __nccwpck_require__(9049); -var NamespacePrefixMap_1 = __nccwpck_require__(283); -var DOMException_1 = __nccwpck_require__(3166); -var infra_1 = __nccwpck_require__(4251); +var interfaces_1 = __nccwpck_require__(27305); +var CharacterDataImpl_1 = __nccwpck_require__(65330); var algorithm_1 = __nccwpck_require__(61); +var WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** - * Represents an XML serializer. - * - * Implements: https://www.w3.org/TR/DOM-Parsing/#serializing + * Represents a text node. */ -var XMLSerializerImpl = /** @class */ (function () { - function XMLSerializerImpl() { - } - /** @inheritdoc */ - XMLSerializerImpl.prototype.serializeToString = function (root) { - /** - * The serializeToString(root) method must produce an XML serialization - * of root passing a value of false for the require well-formed parameter, - * and return the result. - */ - return this._xmlSerialization(root, false); - }; +var TextImpl = /** @class */ (function (_super) { + __extends(TextImpl, _super); /** - * Produces an XML serialization of the given node. + * Initializes a new instance of `Text`. * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance + * @param data - the text content */ - XMLSerializerImpl.prototype._xmlSerialization = function (node, requireWellFormed) { - // To increase performance, use a namespace-aware serializer only if the - // document has namespaced elements - if (node._nodeDocument === undefined || node._nodeDocument._hasNamespaces) { - /** From: https://w3c.github.io/DOM-Parsing/#xml-serialization - * - * 1. Let namespace be a context namespace with value null. - * The context namespace tracks the XML serialization algorithm's current - * default namespace. The context namespace is changed when either an Element - * Node has a default namespace declaration, or the algorithm generates a - * default namespace declaration for the Element Node to match its own - * namespace. The algorithm assumes no namespace (null) to start. - * 2. Let prefix map be a new namespace prefix map. - * 3. Add the XML namespace with prefix value "xml" to prefix map. - * 4. Let prefix index be a generated namespace prefix index with value 1. - * The generated namespace prefix index is used to generate a new unique - * prefix value when no suitable existing namespace prefix is available to - * serialize a node's namespaceURI (or the namespaceURI of one of node's - * attributes). See the generate a prefix algorithm. - */ - var namespace = null; - var prefixMap = new NamespacePrefixMap_1.NamespacePrefixMap(); - prefixMap.set("xml", infra_1.namespace.XML); - var prefixIndex = { value: 1 }; + function TextImpl(data) { + if (data === void 0) { data = ''; } + var _this = _super.call(this, data) || this; + _this._name = ''; + _this._assignedSlot = null; + return _this; + } + Object.defineProperty(TextImpl.prototype, "wholeText", { + /** @inheritdoc */ + get: function () { + var e_1, _a; /** - * 5. Return the result of running the XML serialization algorithm on node - * passing the context namespace namespace, namespace prefix map prefix map, - * generated namespace prefix index reference to prefix index, and the - * flag require well-formed. If an exception occurs during the execution - * of the algorithm, then catch that exception and throw an - * "InvalidStateError" DOMException. + * The wholeText attribute’s getter must return the concatenation of the + * data of the contiguous Text nodes of the context object, in tree order. */ + var text = ''; try { - return this._serializeNodeNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); - } - catch (_a) { - throw new DOMException_1.InvalidStateError(); - } - } - else { - try { - return this._serializeNode(node, requireWellFormed); + for (var _b = __values(algorithm_1.text_contiguousTextNodes(this, true)), _c = _b.next(); !_c.done; _c = _b.next()) { + var node = _c.value; + text = text + node._data; + } } - catch (_b) { - throw new DOMException_1.InvalidStateError(); + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } } - } + return text; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + TextImpl.prototype.splitText = function (offset) { + /** + * The splitText(offset) method, when invoked, must split context object + * with offset offset. + */ + return algorithm_1.text_split(this, offset); }; + Object.defineProperty(TextImpl.prototype, "assignedSlot", { + // MIXIN: Slotable + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: Slotable not implemented."); }, + enumerable: true, + configurable: true + }); /** - * Produces an XML serialization of a node. + * Creates a `Text`. * - * @param node - node to serialize - * @param namespace - context namespace - * @param prefixMap - namespace prefix map - * @param prefixIndex - generated namespace prefix index - * @param requireWellFormed - whether to check conformance + * @param document - owner document + * @param data - the text content */ - XMLSerializerImpl.prototype._serializeNodeNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { - switch (node.nodeType) { - case interfaces_1.NodeType.Element: - return this._serializeElementNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); - case interfaces_1.NodeType.Document: - return this._serializeDocumentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); - case interfaces_1.NodeType.Comment: - return this._serializeComment(node, requireWellFormed); - case interfaces_1.NodeType.Text: - return this._serializeText(node, requireWellFormed); - case interfaces_1.NodeType.DocumentFragment: - return this._serializeDocumentFragmentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); - case interfaces_1.NodeType.DocumentType: - return this._serializeDocumentType(node, requireWellFormed); - case interfaces_1.NodeType.ProcessingInstruction: - return this._serializeProcessingInstruction(node, requireWellFormed); - case interfaces_1.NodeType.CData: - return this._serializeCData(node, requireWellFormed); - default: - throw new Error("Unknown node type: " + node.nodeType); - } + TextImpl._create = function (document, data) { + if (data === void 0) { data = ''; } + var node = new TextImpl(data); + node._nodeDocument = document; + return node; }; + return TextImpl; +}(CharacterDataImpl_1.CharacterDataImpl)); +exports.TextImpl = TextImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(TextImpl.prototype, "_nodeType", interfaces_1.NodeType.Text); +//# sourceMappingURL=TextImpl.js.map + +/***/ }), + +/***/ 39782: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var interfaces_1 = __nccwpck_require__(27305); +/** + * Represents an object which can be used to iterate through the nodes + * of a subtree. + */ +var TraverserImpl = /** @class */ (function () { /** - * Produces an XML serialization of a node. + * Initializes a new instance of `Traverser`. * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance + * @param root - root node */ - XMLSerializerImpl.prototype._serializeNode = function (node, requireWellFormed) { - switch (node.nodeType) { - case interfaces_1.NodeType.Element: - return this._serializeElement(node, requireWellFormed); - case interfaces_1.NodeType.Document: - return this._serializeDocument(node, requireWellFormed); - case interfaces_1.NodeType.Comment: - return this._serializeComment(node, requireWellFormed); - case interfaces_1.NodeType.Text: - return this._serializeText(node, requireWellFormed); - case interfaces_1.NodeType.DocumentFragment: - return this._serializeDocumentFragment(node, requireWellFormed); - case interfaces_1.NodeType.DocumentType: - return this._serializeDocumentType(node, requireWellFormed); - case interfaces_1.NodeType.ProcessingInstruction: - return this._serializeProcessingInstruction(node, requireWellFormed); - case interfaces_1.NodeType.CData: - return this._serializeCData(node, requireWellFormed); - default: - throw new Error("Unknown node type: " + node.nodeType); - } + function TraverserImpl(root) { + this._activeFlag = false; + this._root = root; + this._whatToShow = interfaces_1.WhatToShow.All; + this._filter = null; + } + Object.defineProperty(TraverserImpl.prototype, "root", { + /** @inheritdoc */ + get: function () { return this._root; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(TraverserImpl.prototype, "whatToShow", { + /** @inheritdoc */ + get: function () { return this._whatToShow; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(TraverserImpl.prototype, "filter", { + /** @inheritdoc */ + get: function () { return this._filter; }, + enumerable: true, + configurable: true + }); + return TraverserImpl; +}()); +exports.TraverserImpl = TraverserImpl; +//# sourceMappingURL=TraverserImpl.js.map + +/***/ }), + +/***/ 89261: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var interfaces_1 = __nccwpck_require__(27305); +var TraverserImpl_1 = __nccwpck_require__(39782); +var algorithm_1 = __nccwpck_require__(61); +/** + * Represents the nodes of a subtree and a position within them. + */ +var TreeWalkerImpl = /** @class */ (function (_super) { + __extends(TreeWalkerImpl, _super); /** - * Produces an XML serialization of an element node. - * - * @param node - node to serialize - * @param namespace - context namespace - * @param prefixMap - namespace prefix map - * @param prefixIndex - generated namespace prefix index - * @param requireWellFormed - whether to check conformance + * Initializes a new instance of `TreeWalker`. */ - XMLSerializerImpl.prototype._serializeElementNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { - var e_1, _a; + function TreeWalkerImpl(root, current) { + var _this = _super.call(this, root) || this; + _this._current = current; + return _this; + } + Object.defineProperty(TreeWalkerImpl.prototype, "currentNode", { + /** @inheritdoc */ + get: function () { return this._current; }, + set: function (value) { this._current = value; }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + TreeWalkerImpl.prototype.parentNode = function () { /** - * From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node - * - * 1. If the require well-formed flag is set (its value is true), and this - * node's localName attribute contains the character ":" (U+003A COLON) or - * does not match the XML Name production, then throw an exception; the - * serialization of this node would not be a well-formed element. + * 1. Let node be the context object’s current. + * 2. While node is non-null and is not the context object’s root: */ - if (requireWellFormed && (node.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(node.localName))) { - throw new Error("Node local name contains invalid characters (well-formed required)."); + var node = this._current; + while (node !== null && node !== this._root) { + /** + * 2.1. Set node to node’s parent. + * 2.2. If node is non-null and filtering node within the context object + * returns FILTER_ACCEPT, then set the context object’s current to node + * and return node. + */ + node = node._parent; + if (node !== null && + algorithm_1.traversal_filter(this, node) === interfaces_1.FilterResult.Accept) { + this._current = node; + return node; + } } /** - * 2. Let markup be the string "<" (U+003C LESS-THAN SIGN). - * 3. Let qualified name be an empty string. - * 4. Let skip end tag be a boolean flag with value false. - * 5. Let ignore namespace definition attribute be a boolean flag with value - * false. - * 6. Given prefix map, copy a namespace prefix map and let map be the - * result. - * 7. Let local prefixes map be an empty map. The map has unique Node prefix - * strings as its keys, with corresponding namespaceURI Node values as the - * map's key values (in this map, the null namespace is represented by the - * empty string). - * - * _Note:_ This map is local to each element. It is used to ensure there - * are no conflicting prefixes should a new namespace prefix attribute need - * to be generated. It is also used to enable skipping of duplicate prefix - * definitions when writing an element's attributes: the map allows the - * algorithm to distinguish between a prefix in the namespace prefix map - * that might be locally-defined (to the current Element) and one that is - * not. - * 8. Let local default namespace be the result of recording the namespace - * information for node given map and local prefixes map. - * - * _Note:_ The above step will update map with any found namespace prefix - * definitions, add the found prefix definitions to the local prefixes map - * and return a local default namespace value defined by a default namespace - * attribute if one exists. Otherwise it returns null. - * 9. Let inherited ns be a copy of namespace. - * 10. Let ns be the value of node's namespaceURI attribute. + * 3. Return null. */ - var markup = "<"; - var qualifiedName = ''; - var skipEndTag = false; - var ignoreNamespaceDefinitionAttribute = false; - var map = prefixMap.copy(); - var localPrefixesMap = {}; - var localDefaultNamespace = this._recordNamespaceInformation(node, map, localPrefixesMap); - var inheritedNS = namespace; - var ns = node.namespaceURI; - /** 11. If inherited ns is equal to ns, then: */ - if (inheritedNS === ns) { + return null; + }; + /** @inheritdoc */ + TreeWalkerImpl.prototype.firstChild = function () { + /** + * The firstChild() method, when invoked, must traverse children with the + * context object and first. + */ + return algorithm_1.treeWalker_traverseChildren(this, true); + }; + /** @inheritdoc */ + TreeWalkerImpl.prototype.lastChild = function () { + /** + * The lastChild() method, when invoked, must traverse children with the + * context object and last. + */ + return algorithm_1.treeWalker_traverseChildren(this, false); + }; + /** @inheritdoc */ + TreeWalkerImpl.prototype.nextSibling = function () { + /** + * The nextSibling() method, when invoked, must traverse siblings with the + * context object and next. + */ + return algorithm_1.treeWalker_traverseSiblings(this, true); + }; + /** @inheritdoc */ + TreeWalkerImpl.prototype.previousNode = function () { + /** + * 1. Let node be the context object’s current. + * 2. While node is not the context object’s root: + */ + var node = this._current; + while (node !== this._root) { /** - * 11.1. If local default namespace is not null, then set ignore - * namespace definition attribute to true. + * 2.1. Let sibling be node’s previous sibling. + * 2.2. While sibling is non-null: */ - if (localDefaultNamespace !== null) { - ignoreNamespaceDefinitionAttribute = true; + var sibling = node._previousSibling; + while (sibling) { + /** + * 2.2.1. Set node to sibling. + * 2.2.2. Let result be the result of filtering node within the context + * object. + */ + node = sibling; + var result = algorithm_1.traversal_filter(this, node); + /** + * 2.2.3. While result is not FILTER_REJECT and node has a child: + */ + while (result !== interfaces_1.FilterResult.Reject && node._lastChild) { + /** + * 2.2.3.1. Set node to node’s last child. + * 2.2.3.2. Set result to the result of filtering node within the + * context object. + */ + node = node._lastChild; + result = algorithm_1.traversal_filter(this, node); + } + /** + * 2.2.4. If result is FILTER_ACCEPT, then set the context object’s + * current to node and return node. + */ + if (result === interfaces_1.FilterResult.Accept) { + this._current = node; + return node; + } + /** + * 2.2.5. Set sibling to node’s previous sibling. + */ + sibling = node._previousSibling; } /** - * 11.2. If ns is the XML namespace, then append to qualified name the - * concatenation of the string "xml:" and the value of node's localName. - * 11.3. Otherwise, append to qualified name the value of node's - * localName. The node's prefix if it exists, is dropped. + * 2.3. If node is the context object’s root or node’s parent is null, + * then return null. */ - if (ns === infra_1.namespace.XML) { - qualifiedName = 'xml:' + node.localName; - } - else { - qualifiedName = node.localName; + if (node === this._root || node._parent === null) { + return null; } - /** 11.4. Append the value of qualified name to markup. */ - markup += qualifiedName; - } - else { /** - * 12. Otherwise, inherited ns is not equal to ns (the node's own - * namespace is different from the context namespace of its parent). - * Run these sub-steps: - * - * 12.1. Let prefix be the value of node's prefix attribute. - * 12.2. Let candidate prefix be the result of retrieving a preferred - * prefix string prefix from map given namespace ns. The above may return - * null if no namespace key ns exists in map. + * 2.4. Set node to node’s parent. */ - var prefix = node.prefix; + node = node._parent; /** - * We don't need to run "retrieving a preferred prefix string" algorithm if - * the element has no prefix and its namespace matches to the default - * namespace. - * See: https://github.com/web-platform-tests/wpt/pull/16703 + * 2.5. If the return value of filtering node within the context object is + * FILTER_ACCEPT, then set the context object’s current to node and + * return node. */ - var candidatePrefix = null; - if (prefix !== null || ns !== localDefaultNamespace) { - candidatePrefix = map.get(prefix, ns); + if (algorithm_1.traversal_filter(this, node) === interfaces_1.FilterResult.Accept) { + this._current = node; + return node; + } + } + /** + * 3. Return null. + */ + return null; + }; + /** @inheritdoc */ + TreeWalkerImpl.prototype.previousSibling = function () { + /** + * The previousSibling() method, when invoked, must traverse siblings with + * the context object and previous. + */ + return algorithm_1.treeWalker_traverseSiblings(this, false); + }; + /** @inheritdoc */ + TreeWalkerImpl.prototype.nextNode = function () { + /** + * 1. Let node be the context object’s current. + * 2. Let result be FILTER_ACCEPT. + * 3. While true: + */ + var node = this._current; + var result = interfaces_1.FilterResult.Accept; + while (true) { + /** + * 3.1. While result is not FILTER_REJECT and node has a child: + */ + while (result !== interfaces_1.FilterResult.Reject && node._firstChild) { + /** + * 3.1.1. Set node to its first child. + * 3.1.2. Set result to the result of filtering node within the context + * object. + * 3.1.3. If result is FILTER_ACCEPT, then set the context object’s + * current to node and return node. + */ + node = node._firstChild; + result = algorithm_1.traversal_filter(this, node); + if (result === interfaces_1.FilterResult.Accept) { + this._current = node; + return node; + } } /** - * 12.3. If the value of prefix matches "xmlns", then run the following - * steps: + * 3.2. Let sibling be null. + * 3.3. Let temporary be node. + * 3.4. While temporary is non-null: */ - if (prefix === "xmlns") { + var sibling = null; + var temporary = node; + while (temporary !== null) { /** - * 12.3.1. If the require well-formed flag is set, then throw an error. - * An Element with prefix "xmlns" will not legally round-trip in a - * conforming XML parser. + * 3.4.1. If temporary is the context object’s root, then return null. */ - if (requireWellFormed) { - throw new Error("An element cannot have the 'xmlns' prefix (well-formed required)."); + if (temporary === this._root) { + return null; } /** - * 12.3.2. Let candidate prefix be the value of prefix. + * 3.4.2. Set sibling to temporary’s next sibling. + * 3.4.3. If sibling is non-null, then break. */ - candidatePrefix = prefix; + sibling = temporary._nextSibling; + if (sibling !== null) { + node = sibling; + break; + } + /** + * 3.4.4. Set temporary to temporary’s parent. + */ + temporary = temporary._parent; } /** - * 12.4.Found a suitable namespace prefix: if candidate prefix is not - * null (a namespace prefix is defined which maps to ns), then: + * 3.5. Set result to the result of filtering node within the context object. + * 3.6. If result is FILTER_ACCEPT, then set the context object’s current + * to node and return node. */ - if (candidatePrefix !== null) { - /** - * The following may serialize a different prefix than the Element's - * existing prefix if it already had one. However, the retrieving a - * preferred prefix string algorithm already tried to match the - * existing prefix if possible. - * - * 12.4.1. Append to qualified name the concatenation of candidate - * prefix, ":" (U+003A COLON), and node's localName. There exists on - * this node or the node's ancestry a namespace prefix definition that - * defines the node's namespace. - * 12.4.2. If the local default namespace is not null (there exists a - * locally-defined default namespace declaration attribute) and its - * value is not the XML namespace, then let inherited ns get the value - * of local default namespace unless the local default namespace is the - * empty string in which case let it get null (the context namespace - * is changed to the declared default, rather than this node's own - * namespace). - * - * _Note:_ Any default namespace definitions or namespace prefixes that - * define the XML namespace are omitted when serializing this node's - * attributes. - */ - qualifiedName = candidatePrefix + ':' + node.localName; - if (localDefaultNamespace !== null && localDefaultNamespace !== infra_1.namespace.XML) { - inheritedNS = localDefaultNamespace || null; - } - /** - * 12.4.3. Append the value of qualified name to markup. - */ - markup += qualifiedName; - /** 12.5. Otherwise, if prefix is not null, then: */ - } - else if (prefix !== null) { - /** - * _Note:_ By this step, there is no namespace or prefix mapping - * declaration in this node (or any parent node visited by this - * algorithm) that defines prefix otherwise the step labelled Found - * a suitable namespace prefix would have been followed. The sub-steps - * that follow will create a new namespace prefix declaration for prefix - * and ensure that prefix does not conflict with an existing namespace - * prefix declaration of the same localName in node's attribute list. - * - * 12.5.1. If the local prefixes map contains a key matching prefix, - * then let prefix be the result of generating a prefix providing as - * input map, ns, and prefix index. - */ - if (prefix in localPrefixesMap) { - prefix = this._generatePrefix(ns, map, prefixIndex); - } - /** - * 12.5.2. Add prefix to map given namespace ns. - * 12.5.3. Append to qualified name the concatenation of prefix, ":" - * (U+003A COLON), and node's localName. - * 12.5.4. Append the value of qualified name to markup. - */ - map.set(prefix, ns); - qualifiedName += prefix + ':' + node.localName; - markup += qualifiedName; - /** - * 12.5.5. Append the following to markup, in the order listed: - * - * _Note:_ The following serializes a namespace prefix declaration for - * prefix which was just added to the map. - * - * 12.5.5.1. " " (U+0020 SPACE); - * 12.5.5.2. The string "xmlns:"; - * 12.5.5.3. The value of prefix; - * 12.5.5.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); - * 12.5.5.5. The result of serializing an attribute value given ns and - * the require well-formed flag as input; - * 12.5.5.6. """ (U+0022 QUOTATION MARK). - */ - markup += " xmlns:" + prefix + "=\"" + - this._serializeAttributeValue(ns, requireWellFormed) + "\""; - /** - * 12.5.5.7. If local default namespace is not null (there exists a - * locally-defined default namespace declaration attribute), then - * let inherited ns get the value of local default namespace unless the - * local default namespace is the empty string in which case let it get - * null. - */ - if (localDefaultNamespace !== null) { - inheritedNS = localDefaultNamespace || null; - } - /** - * 12.6. Otherwise, if local default namespace is null, or local - * default namespace is not null and its value is not equal to ns, then: - */ - } - else if (localDefaultNamespace === null || - (localDefaultNamespace !== null && localDefaultNamespace !== ns)) { - /** - * _Note:_ At this point, the namespace for this node still needs to be - * serialized, but there's no prefix (or candidate prefix) available; the - * following uses the default namespace declaration to define the - * namespace--optionally replacing an existing default declaration - * if present. - * - * 12.6.1. Set the ignore namespace definition attribute flag to true. - * 12.6.2. Append to qualified name the value of node's localName. - * 12.6.3. Let the value of inherited ns be ns. - * - * _Note:_ The new default namespace will be used in the serialization - * to define this node's namespace and act as the context namespace for - * its children. - */ - ignoreNamespaceDefinitionAttribute = true; - qualifiedName += node.localName; - inheritedNS = ns; - /** - * 12.6.4. Append the value of qualified name to markup. - */ - markup += qualifiedName; - /** - * 12.6.5. Append the following to markup, in the order listed: - * - * _Note:_ The following serializes the new (or replacement) default - * namespace definition. - * - * 12.6.5.1. " " (U+0020 SPACE); - * 12.6.5.2. The string "xmlns"; - * 12.6.5.3. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); - * 12.6.5.4. The result of serializing an attribute value given ns - * and the require well-formed flag as input; - * 12.6.5.5. """ (U+0022 QUOTATION MARK). - */ - markup += " xmlns" + "=\"" + - this._serializeAttributeValue(ns, requireWellFormed) + "\""; - /** - * 12.7. Otherwise, the node has a local default namespace that matches - * ns. Append to qualified name the value of node's localName, let the - * value of inherited ns be ns, and append the value of qualified name - * to markup. - */ - } - else { - qualifiedName += node.localName; - inheritedNS = ns; - markup += qualifiedName; - } - } - /** - * 13. Append to markup the result of the XML serialization of node's - * attributes given map, prefix index, local prefixes map, ignore namespace - * definition attribute flag, and require well-formed flag. - */ - markup += this._serializeAttributesNS(node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed); - /** - * 14. If ns is the HTML namespace, and the node's list of children is - * empty, and the node's localName matches any one of the following void - * elements: "area", "base", "basefont", "bgsound", "br", "col", "embed", - * "frame", "hr", "img", "input", "keygen", "link", "menuitem", "meta", - * "param", "source", "track", "wbr"; then append the following to markup, - * in the order listed: - * 14.1. " " (U+0020 SPACE); - * 14.2. "/" (U+002F SOLIDUS). - * and set the skip end tag flag to true. - * 15. If ns is not the HTML namespace, and the node's list of children is - * empty, then append "/" (U+002F SOLIDUS) to markup and set the skip end - * tag flag to true. - * 16. Append ">" (U+003E GREATER-THAN SIGN) to markup. - */ - var isHTML = (ns === infra_1.namespace.HTML); - if (isHTML && node.childNodes.length === 0 && - XMLSerializerImpl._VoidElementNames.has(node.localName)) { - markup += " /"; - skipEndTag = true; - } - else if (!isHTML && node.childNodes.length === 0) { - markup += "/"; - skipEndTag = true; - } - markup += ">"; - /** - * 17. If the value of skip end tag is true, then return the value of markup - * and skip the remaining steps. The node is a leaf-node. - */ - if (skipEndTag) - return markup; - /** - * 18. If ns is the HTML namespace, and the node's localName matches the - * string "template", then this is a template element. Append to markup the - * result of XML serializing a DocumentFragment node given the template - * element's template contents (a DocumentFragment), providing inherited - * ns, map, prefix index, and the require well-formed flag. - * - * _Note:_ This allows template content to round-trip, given the rules for - * parsing XHTML documents. - * - * 19. Otherwise, append to markup the result of running the XML - * serialization algorithm on each of node's children, in tree order, - * providing inherited ns, map, prefix index, and the require well-formed - * flag. - */ - if (isHTML && node.localName === "template") { - // TODO: serialize template contents - } - else { - try { - for (var _b = __values(node._children || node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - markup += this._serializeNodeNS(childNode, inheritedNS, map, prefixIndex, requireWellFormed); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + result = algorithm_1.traversal_filter(this, node); + if (result === interfaces_1.FilterResult.Accept) { + this._current = node; + return node; } } - /** - * 20. Append the following to markup, in the order listed: - * 20.1. "" (U+003E GREATER-THAN SIGN). - */ - markup += ""; - /** - * 21. Return the value of markup. - */ - return markup; }; /** - * Produces an XML serialization of a document node. + * Creates a new `TreeWalker`. * - * @param node - node to serialize - * @param namespace - context namespace - * @param prefixMap - namespace prefix map - * @param prefixIndex - generated namespace prefix index - * @param requireWellFormed - whether to check conformance + * @param root - iterator's root node + * @param current - current node */ - XMLSerializerImpl.prototype._serializeDocumentNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { - var e_2, _a; - /** - * If the require well-formed flag is set (its value is true), and this node - * has no documentElement (the documentElement attribute's value is null), - * then throw an exception; the serialization of this node would not be a - * well-formed document. - */ - if (requireWellFormed && node.documentElement === null) { - throw new Error("Missing document element (well-formed required)."); - } - /** - * Otherwise, run the following steps: - * 1. Let serialized document be an empty string. - * 2. For each child child of node, in tree order, run the XML - * serialization algorithm on the child passing along the provided - * arguments, and append the result to serialized document. - * - * _Note:_ This will serialize any number of ProcessingInstruction and - * Comment nodes both before and after the Document's documentElement node, - * including at most one DocumentType node. (Text nodes are not allowed as - * children of the Document.) - * - * 3. Return the value of serialized document. - */ - var serializedDocument = ""; - try { - for (var _b = __values(node._children || node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - serializedDocument += this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_2) throw e_2.error; } - } - return serializedDocument; + TreeWalkerImpl._create = function (root, current) { + return new TreeWalkerImpl(root, current); }; - /** - * Produces an XML serialization of a comment node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - */ - XMLSerializerImpl.prototype._serializeComment = function (node, requireWellFormed) { - /** - * If the require well-formed flag is set (its value is true), and node's - * data contains characters that are not matched by the XML Char production - * or contains "--" (two adjacent U+002D HYPHEN-MINUS characters) or that - * ends with a "-" (U+002D HYPHEN-MINUS) character, then throw an exception; - * the serialization of this node's data would not be well-formed. - */ - if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data) || - node.data.indexOf("--") !== -1 || node.data.endsWith("-"))) { - throw new Error("Comment data contains invalid characters (well-formed required)."); - } - /** - * Otherwise, return the concatenation of "". - */ - return ""; + return TreeWalkerImpl; +}(TraverserImpl_1.TraverserImpl)); +exports.TreeWalkerImpl = TreeWalkerImpl; +//# sourceMappingURL=TreeWalkerImpl.js.map + +/***/ }), + +/***/ 69067: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var EventTargetImpl_1 = __nccwpck_require__(69968); +var util_1 = __nccwpck_require__(76195); +var algorithm_1 = __nccwpck_require__(61); +/** + * Represents a window containing a DOM document. + */ +var WindowImpl = /** @class */ (function (_super) { + __extends(WindowImpl, _super); /** - * Produces an XML serialization of a text node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - * @param level - current depth of the XML tree + * Initializes a new instance of `Window`. */ - XMLSerializerImpl.prototype._serializeText = function (node, requireWellFormed) { - /** - * 1. If the require well-formed flag is set (its value is true), and - * node's data contains characters that are not matched by the XML Char - * production, then throw an exception; the serialization of this node's - * data would not be well-formed. - */ - if (requireWellFormed && !algorithm_1.xml_isLegalChar(node.data)) { - throw new Error("Text data contains invalid characters (well-formed required)."); - } - /** - * 2. Let markup be the value of node's data. - * 3. Replace any occurrences of "&" in markup by "&". - * 4. Replace any occurrences of "<" in markup by "<". - * 5. Replace any occurrences of ">" in markup by ">". - * 6. Return the value of markup. - */ - var result = ""; - for (var i = 0; i < node.data.length; i++) { - var c = node.data[i]; - if (c === "&") - result += "&"; - else if (c === "<") - result += "<"; - else if (c === ">") - result += ">"; - else - result += c; - } - return result; - }; + function WindowImpl() { + var _this = _super.call(this) || this; + _this._signalSlots = new Set(); + _this._mutationObserverMicrotaskQueued = false; + _this._mutationObservers = new Set(); + _this._iteratorList = new util_1.FixedSizeSet(); + _this._associatedDocument = algorithm_1.create_document(); + return _this; + } + Object.defineProperty(WindowImpl.prototype, "document", { + /** @inheritdoc */ + get: function () { return this._associatedDocument; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WindowImpl.prototype, "event", { + /** @inheritdoc */ + get: function () { return this._currentEvent; }, + enumerable: true, + configurable: true + }); /** - * Produces an XML serialization of a document fragment node. - * - * @param node - node to serialize - * @param namespace - context namespace - * @param prefixMap - namespace prefix map - * @param prefixIndex - generated namespace prefix index - * @param requireWellFormed - whether to check conformance + * Creates a new window with a blank document. */ - XMLSerializerImpl.prototype._serializeDocumentFragmentNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { - var e_3, _a; - /** - * 1. Let markup the empty string. - * 2. For each child child of node, in tree order, run the XML serialization - * algorithm on the child given namespace, prefix map, a reference to prefix - * index, and flag require well-formed. Concatenate the result to markup. - * 3. Return the value of markup. - */ - var markup = ""; - try { - for (var _b = __values(node._children || node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - markup += this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_3) throw e_3.error; } - } - return markup; + WindowImpl._create = function () { + return new WindowImpl(); + }; + return WindowImpl; +}(EventTargetImpl_1.EventTargetImpl)); +exports.WindowImpl = WindowImpl; +//# sourceMappingURL=WindowImpl.js.map + +/***/ }), + +/***/ 21685: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var DocumentImpl_1 = __nccwpck_require__(14333); +/** + * Represents an XML document. + */ +var XMLDocumentImpl = /** @class */ (function (_super) { + __extends(XMLDocumentImpl, _super); /** - * Produces an XML serialization of a document type node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance + * Initializes a new instance of `XMLDocument`. */ - XMLSerializerImpl.prototype._serializeDocumentType = function (node, requireWellFormed) { - /** - * 1. If the require well-formed flag is true and the node's publicId - * attribute contains characters that are not matched by the XML PubidChar - * production, then throw an exception; the serialization of this node - * would not be a well-formed document type declaration. - */ - if (requireWellFormed && !algorithm_1.xml_isPubidChar(node.publicId)) { - throw new Error("DocType public identifier does not match PubidChar construct (well-formed required)."); - } - /** - * 2. If the require well-formed flag is true and the node's systemId - * attribute contains characters that are not matched by the XML Char - * production or that contains both a """ (U+0022 QUOTATION MARK) and a - * "'" (U+0027 APOSTROPHE), then throw an exception; the serialization - * of this node would not be a well-formed document type declaration. - */ - if (requireWellFormed && - (!algorithm_1.xml_isLegalChar(node.systemId) || - (node.systemId.indexOf('"') !== -1 && node.systemId.indexOf("'") !== -1))) { - throw new Error("DocType system identifier contains invalid characters (well-formed required)."); - } - /** - * 3. Let markup be an empty string. - * 4. Append the string "" (U+003E GREATER-THAN SIGN) to markup. - * 11. Return the value of markup. - */ - return node.publicId && node.systemId ? - "" - : node.publicId ? - "" - : node.systemId ? - "" - : - ""; + function XMLDocumentImpl() { + return _super.call(this) || this; + } + return XMLDocumentImpl; +}(DocumentImpl_1.DocumentImpl)); +exports.XMLDocumentImpl = XMLDocumentImpl; +//# sourceMappingURL=XMLDocumentImpl.js.map + +/***/ }), + +/***/ 50633: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var util_1 = __nccwpck_require__(76195); +// Import implementation classes +var AbortControllerImpl_1 = __nccwpck_require__(66461); +exports.AbortController = AbortControllerImpl_1.AbortControllerImpl; +var AbortSignalImpl_1 = __nccwpck_require__(10022); +exports.AbortSignal = AbortSignalImpl_1.AbortSignalImpl; +var AbstractRangeImpl_1 = __nccwpck_require__(57126); +exports.AbstractRange = AbstractRangeImpl_1.AbstractRangeImpl; +var AttrImpl_1 = __nccwpck_require__(13717); +exports.Attr = AttrImpl_1.AttrImpl; +var CDATASectionImpl_1 = __nccwpck_require__(23977); +exports.CDATASection = CDATASectionImpl_1.CDATASectionImpl; +var CharacterDataImpl_1 = __nccwpck_require__(65330); +exports.CharacterData = CharacterDataImpl_1.CharacterDataImpl; +var ChildNodeImpl_1 = __nccwpck_require__(88264); +var CommentImpl_1 = __nccwpck_require__(20930); +exports.Comment = CommentImpl_1.CommentImpl; +var CustomEventImpl_1 = __nccwpck_require__(59857); +exports.CustomEvent = CustomEventImpl_1.CustomEventImpl; +var DocumentFragmentImpl_1 = __nccwpck_require__(12585); +exports.DocumentFragment = DocumentFragmentImpl_1.DocumentFragmentImpl; +var DocumentImpl_1 = __nccwpck_require__(14333); +exports.Document = DocumentImpl_1.DocumentImpl; +var DocumentOrShadowRootImpl_1 = __nccwpck_require__(65274); +var DocumentTypeImpl_1 = __nccwpck_require__(3173); +exports.DocumentType = DocumentTypeImpl_1.DocumentTypeImpl; +var DOMImpl_1 = __nccwpck_require__(14177); +exports.dom = DOMImpl_1.dom; +var DOMImplementationImpl_1 = __nccwpck_require__(42197); +exports.DOMImplementation = DOMImplementationImpl_1.DOMImplementationImpl; +var DOMTokenListImpl_1 = __nccwpck_require__(65096); +exports.DOMTokenList = DOMTokenListImpl_1.DOMTokenListImpl; +var ElementImpl_1 = __nccwpck_require__(35975); +exports.Element = ElementImpl_1.ElementImpl; +var EventImpl_1 = __nccwpck_require__(38245); +exports.Event = EventImpl_1.EventImpl; +var EventTargetImpl_1 = __nccwpck_require__(69968); +exports.EventTarget = EventTargetImpl_1.EventTargetImpl; +var HTMLCollectionImpl_1 = __nccwpck_require__(93969); +exports.HTMLCollection = HTMLCollectionImpl_1.HTMLCollectionImpl; +var MutationObserverImpl_1 = __nccwpck_require__(89616); +exports.MutationObserver = MutationObserverImpl_1.MutationObserverImpl; +var MutationRecordImpl_1 = __nccwpck_require__(6219); +exports.MutationRecord = MutationRecordImpl_1.MutationRecordImpl; +var NamedNodeMapImpl_1 = __nccwpck_require__(57206); +exports.NamedNodeMap = NamedNodeMapImpl_1.NamedNodeMapImpl; +var NodeFilterImpl_1 = __nccwpck_require__(12355); +exports.NodeFilter = NodeFilterImpl_1.NodeFilterImpl; +var NodeImpl_1 = __nccwpck_require__(91745); +exports.Node = NodeImpl_1.NodeImpl; +var NodeIteratorImpl_1 = __nccwpck_require__(61997); +exports.NodeIterator = NodeIteratorImpl_1.NodeIteratorImpl; +var NodeListImpl_1 = __nccwpck_require__(43728); +exports.NodeList = NodeListImpl_1.NodeListImpl; +var NodeListStaticImpl_1 = __nccwpck_require__(65306); +exports.NodeListStatic = NodeListStaticImpl_1.NodeListStaticImpl; +var NonDocumentTypeChildNodeImpl_1 = __nccwpck_require__(71032); +var NonElementParentNodeImpl_1 = __nccwpck_require__(90733); +var ParentNodeImpl_1 = __nccwpck_require__(85988); +var ProcessingInstructionImpl_1 = __nccwpck_require__(99430); +exports.ProcessingInstruction = ProcessingInstructionImpl_1.ProcessingInstructionImpl; +var RangeImpl_1 = __nccwpck_require__(50166); +exports.Range = RangeImpl_1.RangeImpl; +var ShadowRootImpl_1 = __nccwpck_require__(61911); +exports.ShadowRoot = ShadowRootImpl_1.ShadowRootImpl; +var SlotableImpl_1 = __nccwpck_require__(21964); +var StaticRangeImpl_1 = __nccwpck_require__(86357); +exports.StaticRange = StaticRangeImpl_1.StaticRangeImpl; +var TextImpl_1 = __nccwpck_require__(42191); +exports.Text = TextImpl_1.TextImpl; +var TraverserImpl_1 = __nccwpck_require__(39782); +exports.Traverser = TraverserImpl_1.TraverserImpl; +var TreeWalkerImpl_1 = __nccwpck_require__(89261); +exports.TreeWalker = TreeWalkerImpl_1.TreeWalkerImpl; +var WindowImpl_1 = __nccwpck_require__(69067); +exports.Window = WindowImpl_1.WindowImpl; +var XMLDocumentImpl_1 = __nccwpck_require__(21685); +exports.XMLDocument = XMLDocumentImpl_1.XMLDocumentImpl; +// Apply mixins +// ChildNode +util_1.applyMixin(ElementImpl_1.ElementImpl, ChildNodeImpl_1.ChildNodeImpl); +util_1.applyMixin(CharacterDataImpl_1.CharacterDataImpl, ChildNodeImpl_1.ChildNodeImpl); +util_1.applyMixin(DocumentTypeImpl_1.DocumentTypeImpl, ChildNodeImpl_1.ChildNodeImpl); +// DocumentOrShadowRoot +util_1.applyMixin(DocumentImpl_1.DocumentImpl, DocumentOrShadowRootImpl_1.DocumentOrShadowRootImpl); +util_1.applyMixin(ShadowRootImpl_1.ShadowRootImpl, DocumentOrShadowRootImpl_1.DocumentOrShadowRootImpl); +// NonDocumentTypeChildNode +util_1.applyMixin(ElementImpl_1.ElementImpl, NonDocumentTypeChildNodeImpl_1.NonDocumentTypeChildNodeImpl); +util_1.applyMixin(CharacterDataImpl_1.CharacterDataImpl, NonDocumentTypeChildNodeImpl_1.NonDocumentTypeChildNodeImpl); +// NonElementParentNode +util_1.applyMixin(DocumentImpl_1.DocumentImpl, NonElementParentNodeImpl_1.NonElementParentNodeImpl); +util_1.applyMixin(DocumentFragmentImpl_1.DocumentFragmentImpl, NonElementParentNodeImpl_1.NonElementParentNodeImpl); +// ParentNode +util_1.applyMixin(DocumentImpl_1.DocumentImpl, ParentNodeImpl_1.ParentNodeImpl); +util_1.applyMixin(DocumentFragmentImpl_1.DocumentFragmentImpl, ParentNodeImpl_1.ParentNodeImpl); +util_1.applyMixin(ElementImpl_1.ElementImpl, ParentNodeImpl_1.ParentNodeImpl); +// Slotable +util_1.applyMixin(TextImpl_1.TextImpl, SlotableImpl_1.SlotableImpl); +util_1.applyMixin(ElementImpl_1.ElementImpl, SlotableImpl_1.SlotableImpl); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 27305: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Defines the position of a boundary point relative to another. + */ +var BoundaryPosition; +(function (BoundaryPosition) { + BoundaryPosition[BoundaryPosition["Before"] = 0] = "Before"; + BoundaryPosition[BoundaryPosition["Equal"] = 1] = "Equal"; + BoundaryPosition[BoundaryPosition["After"] = 2] = "After"; +})(BoundaryPosition = exports.BoundaryPosition || (exports.BoundaryPosition = {})); +/** + * Defines the event phase. + */ +var EventPhase; +(function (EventPhase) { + EventPhase[EventPhase["None"] = 0] = "None"; + EventPhase[EventPhase["Capturing"] = 1] = "Capturing"; + EventPhase[EventPhase["AtTarget"] = 2] = "AtTarget"; + EventPhase[EventPhase["Bubbling"] = 3] = "Bubbling"; +})(EventPhase = exports.EventPhase || (exports.EventPhase = {})); +/** + * Defines the type of a node object. + */ +var NodeType; +(function (NodeType) { + NodeType[NodeType["Element"] = 1] = "Element"; + NodeType[NodeType["Attribute"] = 2] = "Attribute"; + NodeType[NodeType["Text"] = 3] = "Text"; + NodeType[NodeType["CData"] = 4] = "CData"; + NodeType[NodeType["EntityReference"] = 5] = "EntityReference"; + NodeType[NodeType["Entity"] = 6] = "Entity"; + NodeType[NodeType["ProcessingInstruction"] = 7] = "ProcessingInstruction"; + NodeType[NodeType["Comment"] = 8] = "Comment"; + NodeType[NodeType["Document"] = 9] = "Document"; + NodeType[NodeType["DocumentType"] = 10] = "DocumentType"; + NodeType[NodeType["DocumentFragment"] = 11] = "DocumentFragment"; + NodeType[NodeType["Notation"] = 12] = "Notation"; // historical +})(NodeType = exports.NodeType || (exports.NodeType = {})); +/** + * Defines the position of a node in the document relative to another + * node. + */ +var Position; +(function (Position) { + Position[Position["Disconnected"] = 1] = "Disconnected"; + Position[Position["Preceding"] = 2] = "Preceding"; + Position[Position["Following"] = 4] = "Following"; + Position[Position["Contains"] = 8] = "Contains"; + Position[Position["ContainedBy"] = 16] = "ContainedBy"; + Position[Position["ImplementationSpecific"] = 32] = "ImplementationSpecific"; +})(Position = exports.Position || (exports.Position = {})); +/** + * Defines the return value of a filter callback. + */ +var FilterResult; +(function (FilterResult) { + FilterResult[FilterResult["Accept"] = 1] = "Accept"; + FilterResult[FilterResult["Reject"] = 2] = "Reject"; + FilterResult[FilterResult["Skip"] = 3] = "Skip"; +})(FilterResult = exports.FilterResult || (exports.FilterResult = {})); +/** + * Defines what to show in node filter. + */ +var WhatToShow; +(function (WhatToShow) { + WhatToShow[WhatToShow["All"] = 4294967295] = "All"; + WhatToShow[WhatToShow["Element"] = 1] = "Element"; + WhatToShow[WhatToShow["Attribute"] = 2] = "Attribute"; + WhatToShow[WhatToShow["Text"] = 4] = "Text"; + WhatToShow[WhatToShow["CDataSection"] = 8] = "CDataSection"; + WhatToShow[WhatToShow["EntityReference"] = 16] = "EntityReference"; + WhatToShow[WhatToShow["Entity"] = 32] = "Entity"; + WhatToShow[WhatToShow["ProcessingInstruction"] = 64] = "ProcessingInstruction"; + WhatToShow[WhatToShow["Comment"] = 128] = "Comment"; + WhatToShow[WhatToShow["Document"] = 256] = "Document"; + WhatToShow[WhatToShow["DocumentType"] = 512] = "DocumentType"; + WhatToShow[WhatToShow["DocumentFragment"] = 1024] = "DocumentFragment"; + WhatToShow[WhatToShow["Notation"] = 2048] = "Notation"; +})(WhatToShow = exports.WhatToShow || (exports.WhatToShow = {})); +/** + * Defines how boundary points are compared. + */ +var HowToCompare; +(function (HowToCompare) { + HowToCompare[HowToCompare["StartToStart"] = 0] = "StartToStart"; + HowToCompare[HowToCompare["StartToEnd"] = 1] = "StartToEnd"; + HowToCompare[HowToCompare["EndToEnd"] = 2] = "EndToEnd"; + HowToCompare[HowToCompare["EndToStart"] = 3] = "EndToStart"; +})(HowToCompare = exports.HowToCompare || (exports.HowToCompare = {})); +//# sourceMappingURL=interfaces.js.map + +/***/ }), + +/***/ 54646: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var dom_1 = __nccwpck_require__(50633); +dom_1.dom.setFeatures(true); +var dom_2 = __nccwpck_require__(50633); +exports.DOMImplementation = dom_2.DOMImplementation; +var parser_1 = __nccwpck_require__(36216); +exports.DOMParser = parser_1.DOMParser; +var serializer_1 = __nccwpck_require__(87119); +exports.XMLSerializer = serializer_1.XMLSerializer; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 98845: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var algorithm_1 = __nccwpck_require__(61); +var XMLParserImpl_1 = __nccwpck_require__(64126); +/** + * Represents a parser for XML and HTML content. + * + * See: https://w3c.github.io/DOM-Parsing/#the-domparser-interface + */ +var DOMParserImpl = /** @class */ (function () { + function DOMParserImpl() { + } + /** @inheritdoc */ + DOMParserImpl.prototype.parseFromString = function (source, mimeType) { + if (mimeType === "text/html") + throw new Error('HTML parser not implemented.'); + try { + var parser = new XMLParserImpl_1.XMLParserImpl(); + var doc = parser.parse(source); + doc._contentType = mimeType; + return doc; + } + catch (e) { + var errorNS = "http://www.mozilla.org/newlayout/xml/parsererror.xml"; + var doc = algorithm_1.create_xmlDocument(); + var root = doc.createElementNS(errorNS, "parsererror"); + var ele = doc.createElementNS(errorNS, "error"); + ele.setAttribute("message", e.message); + root.appendChild(ele); + doc.appendChild(root); + return doc; + } }; - /** - * Produces an XML serialization of a processing instruction node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - */ - XMLSerializerImpl.prototype._serializeProcessingInstruction = function (node, requireWellFormed) { - /** - * 1. If the require well-formed flag is set (its value is true), and node's - * target contains a ":" (U+003A COLON) character or is an ASCII - * case-insensitive match for the string "xml", then throw an exception; - * the serialization of this node's target would not be well-formed. - */ - if (requireWellFormed && (node.target.indexOf(":") !== -1 || (/^xml$/i).test(node.target))) { - throw new Error("Processing instruction target contains invalid characters (well-formed required)."); + return DOMParserImpl; +}()); +exports.DOMParserImpl = DOMParserImpl; +//# sourceMappingURL=DOMParserImpl.js.map + +/***/ }), + +/***/ 64126: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); } - /** - * 2. If the require well-formed flag is set (its value is true), and node's - * data contains characters that are not matched by the XML Char production - * or contains the string "?>" (U+003F QUESTION MARK, - * U+003E GREATER-THAN SIGN), then throw an exception; the serialization of - * this node's data would not be well-formed. - */ - if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data) || - node.data.indexOf("?>") !== -1)) { - throw new Error("Processing instruction data contains invalid characters (well-formed required)."); + finally { if (e) throw e.error; } + } + return ar; +}; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; } - /** - * 3. Let markup be the concatenation of the following, in the order listed: - * 3.1. "" (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN). - * 4. Return the value of markup. - */ - return ""; }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var XMLStringLexer_1 = __nccwpck_require__(47061); +var interfaces_1 = __nccwpck_require__(97707); +var infra_1 = __nccwpck_require__(84251); +var algorithm_1 = __nccwpck_require__(61); +var LocalNameSet_1 = __nccwpck_require__(19049); +/** + * Represents a parser for XML content. + * + * See: https://html.spec.whatwg.org/#xml-parser + */ +var XMLParserImpl = /** @class */ (function () { + function XMLParserImpl() { + } /** - * Produces an XML serialization of a CDATA node. + * Parses XML content. * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance + * @param source - a string containing XML content */ - XMLSerializerImpl.prototype._serializeCData = function (node, requireWellFormed) { - if (requireWellFormed && (node.data.indexOf("]]>") !== -1)) { - throw new Error("CDATA contains invalid characters (well-formed required)."); + XMLParserImpl.prototype.parse = function (source) { + var e_1, _a, e_2, _b; + var lexer = new XMLStringLexer_1.XMLStringLexer(source, { skipWhitespaceOnlyText: true }); + var doc = algorithm_1.create_document(); + var context = doc; + var token = lexer.nextToken(); + while (token.type !== interfaces_1.TokenType.EOF) { + switch (token.type) { + case interfaces_1.TokenType.Declaration: + var declaration = token; + if (declaration.version !== "1.0") { + throw new Error("Invalid xml version: " + declaration.version); + } + break; + case interfaces_1.TokenType.DocType: + var doctype = token; + if (!algorithm_1.xml_isPubidChar(doctype.pubId)) { + throw new Error("DocType public identifier does not match PubidChar construct."); + } + if (!algorithm_1.xml_isLegalChar(doctype.sysId) || + (doctype.sysId.indexOf('"') !== -1 && doctype.sysId.indexOf("'") !== -1)) { + throw new Error("DocType system identifier contains invalid characters."); + } + context.appendChild(doc.implementation.createDocumentType(doctype.name, doctype.pubId, doctype.sysId)); + break; + case interfaces_1.TokenType.CDATA: + var cdata = token; + if (!algorithm_1.xml_isLegalChar(cdata.data) || + cdata.data.indexOf("]]>") !== -1) { + throw new Error("CDATA contains invalid characters."); + } + context.appendChild(doc.createCDATASection(cdata.data)); + break; + case interfaces_1.TokenType.Comment: + var comment = token; + if (!algorithm_1.xml_isLegalChar(comment.data) || + comment.data.indexOf("--") !== -1 || comment.data.endsWith("-")) { + throw new Error("Comment data contains invalid characters."); + } + context.appendChild(doc.createComment(comment.data)); + break; + case interfaces_1.TokenType.PI: + var pi = token; + if (pi.target.indexOf(":") !== -1 || (/^xml$/i).test(pi.target)) { + throw new Error("Processing instruction target contains invalid characters."); + } + if (!algorithm_1.xml_isLegalChar(pi.data) || pi.data.indexOf("?>") !== -1) { + throw new Error("Processing instruction data contains invalid characters."); + } + context.appendChild(doc.createProcessingInstruction(pi.target, pi.data)); + break; + case interfaces_1.TokenType.Text: + var text = token; + if (!algorithm_1.xml_isLegalChar(text.data)) { + throw new Error("Text data contains invalid characters."); + } + context.appendChild(doc.createTextNode(text.data)); + break; + case interfaces_1.TokenType.Element: + var element = token; + // inherit namespace from parent + var _c = __read(algorithm_1.namespace_extractQName(element.name), 2), prefix = _c[0], localName = _c[1]; + if (localName.indexOf(":") !== -1 || !algorithm_1.xml_isName(localName)) { + throw new Error("Node local name contains invalid characters."); + } + if (prefix === "xmlns") { + throw new Error("An element cannot have the 'xmlns' prefix."); + } + var namespace = context.lookupNamespaceURI(prefix); + // override namespace if there is a namespace declaration + // attribute + // also lookup namespace declaration attributes + var nsDeclarations = {}; + try { + for (var _d = (e_1 = void 0, __values(element.attributes)), _e = _d.next(); !_e.done; _e = _d.next()) { + var _f = __read(_e.value, 2), attName = _f[0], attValue = _f[1]; + if (attName === "xmlns") { + namespace = attValue; + } + else { + var _g = __read(algorithm_1.namespace_extractQName(attName), 2), attPrefix = _g[0], attLocalName = _g[1]; + if (attPrefix === "xmlns") { + if (attLocalName === prefix) { + namespace = attValue; + } + nsDeclarations[attLocalName] = attValue; + } + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_e && !_e.done && (_a = _d.return)) _a.call(_d); + } + finally { if (e_1) throw e_1.error; } + } + // create the DOM element node + var elementNode = (namespace !== null ? + doc.createElementNS(namespace, element.name) : + doc.createElement(element.name)); + context.appendChild(elementNode); + // assign attributes + var localNameSet = new LocalNameSet_1.LocalNameSet(); + try { + for (var _h = (e_2 = void 0, __values(element.attributes)), _j = _h.next(); !_j.done; _j = _h.next()) { + var _k = __read(_j.value, 2), attName = _k[0], attValue = _k[1]; + var _l = __read(algorithm_1.namespace_extractQName(attName), 2), attPrefix = _l[0], attLocalName = _l[1]; + var attNamespace = null; + if (attPrefix === "xmlns" || (attPrefix === null && attLocalName === "xmlns")) { + // namespace declaration attribute + attNamespace = infra_1.namespace.XMLNS; + } + else { + attNamespace = elementNode.lookupNamespaceURI(attPrefix); + if (attNamespace !== null && elementNode.isDefaultNamespace(attNamespace)) { + attNamespace = null; + } + else if (attNamespace === null && attPrefix !== null) { + attNamespace = nsDeclarations[attPrefix] || null; + } + } + if (localNameSet.has(attNamespace, attLocalName)) { + throw new Error("Element contains duplicate attributes."); + } + localNameSet.set(attNamespace, attLocalName); + if (attNamespace === infra_1.namespace.XMLNS) { + if (attValue === infra_1.namespace.XMLNS) { + throw new Error("XMLNS namespace is reserved."); + } + } + if (attLocalName.indexOf(":") !== -1 || !algorithm_1.xml_isName(attLocalName)) { + throw new Error("Attribute local name contains invalid characters."); + } + if (attPrefix === "xmlns" && attValue === "") { + throw new Error("Empty XML namespace is not allowed."); + } + if (attNamespace !== null) + elementNode.setAttributeNS(attNamespace, attName, attValue); + else + elementNode.setAttribute(attName, attValue); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_j && !_j.done && (_b = _h.return)) _b.call(_h); + } + finally { if (e_2) throw e_2.error; } + } + if (!element.selfClosing) { + context = elementNode; + } + break; + case interfaces_1.TokenType.ClosingTag: + var closingTag = token; + if (closingTag.name !== context.nodeName) { + throw new Error('Closing tag name does not match opening tag name.'); + } + /* istanbul ignore else */ + if (context._parent) { + context = context._parent; + } + break; + } + token = lexer.nextToken(); } - return ""; + return doc; }; + return XMLParserImpl; +}()); +exports.XMLParserImpl = XMLParserImpl; +//# sourceMappingURL=XMLParserImpl.js.map + +/***/ }), + +/***/ 47061: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var interfaces_1 = __nccwpck_require__(97707); +/** + * Represents a lexer for XML content in a string. + */ +var XMLStringLexer = /** @class */ (function () { /** - * Produces an XML serialization of the attributes of an element node. - * - * @param node - node to serialize - * @param map - namespace prefix map - * @param prefixIndex - generated namespace prefix index - * @param localPrefixesMap - local prefixes map - * @param ignoreNamespaceDefinitionAttribute - whether to ignore namespace - * attributes - * @param requireWellFormed - whether to check conformance - */ - XMLSerializerImpl.prototype._serializeAttributesNS = function (node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed) { - var e_4, _a; - /** - * 1. Let result be the empty string. - * 2. Let localname set be a new empty namespace localname set. This - * localname set will contain tuples of unique attribute namespaceURI and - * localName pairs, and is populated as each attr is processed. This set is - * used to [optionally] enforce the well-formed constraint that an element - * cannot have two attributes with the same namespaceURI and localName. - * This can occur when two otherwise identical attributes on the same - * element differ only by their prefix values. - */ - var result = ""; - var localNameSet = requireWellFormed ? new LocalNameSet_1.LocalNameSet() : undefined; - try { - /** - * 3. Loop: For each attribute attr in element's attributes, in the order - * they are specified in the element's attribute list: - */ - for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - // Optimize common case - if (!ignoreNamespaceDefinitionAttribute && !requireWellFormed && attr.namespaceURI === null) { - result += " " + attr.localName + "=\"" + - this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; - continue; - } - /** - * 3.1. If the require well-formed flag is set (its value is true), and the - * localname set contains a tuple whose values match those of a new tuple - * consisting of attr's namespaceURI attribute and localName attribute, - * then throw an exception; the serialization of this attr would fail to - * produce a well-formed element serialization. - */ - if (requireWellFormed && localNameSet && localNameSet.has(attr.namespaceURI, attr.localName)) { - throw new Error("Element contains duplicate attributes (well-formed required)."); - } - /** - * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and - * localName attribute, and add it to the localname set. - * 3.3. Let attribute namespace be the value of attr's namespaceURI value. - * 3.4. Let candidate prefix be null. - */ - if (requireWellFormed && localNameSet) - localNameSet.set(attr.namespaceURI, attr.localName); - var attributeNamespace = attr.namespaceURI; - var candidatePrefix = null; - /** 3.5. If attribute namespace is not null, then run these sub-steps: */ - if (attributeNamespace !== null) { - /** - * 3.5.1. Let candidate prefix be the result of retrieving a preferred - * prefix string from map given namespace attribute namespace with - * preferred prefix being attr's prefix value. - */ - candidatePrefix = map.get(attr.prefix, attributeNamespace); - /** - * 3.5.2. If the value of attribute namespace is the XMLNS namespace, - * then run these steps: - */ - if (attributeNamespace === infra_1.namespace.XMLNS) { - /** - * 3.5.2.1. If any of the following are true, then stop running these - * steps and goto Loop to visit the next attribute: - * - the attr's value is the XML namespace; - * _Note:_ The XML namespace cannot be redeclared and survive - * round-tripping (unless it defines the prefix "xml"). To avoid this - * problem, this algorithm always prefixes elements in the XML - * namespace with "xml" and drops any related definitions as seen - * in the above condition. - * - the attr's prefix is null and the ignore namespace definition - * attribute flag is true (the Element's default namespace attribute - * should be skipped); - * - the attr's prefix is not null and either - * * the attr's localName is not a key contained in the local - * prefixes map, or - * * the attr's localName is present in the local prefixes map but - * the value of the key does not match attr's value - * and furthermore that the attr's localName (as the prefix to find) - * is found in the namespace prefix map given the namespace consisting - * of the attr's value (the current namespace prefix definition was - * exactly defined previously--on an ancestor element not the current - * element whose attributes are being processed). - */ - if (attr.value === infra_1.namespace.XML || - (attr.prefix === null && ignoreNamespaceDefinitionAttribute) || - (attr.prefix !== null && (!(attr.localName in localPrefixesMap) || - localPrefixesMap[attr.localName] !== attr.value) && - map.has(attr.localName, attr.value))) - continue; - /** - * 3.5.2.2. If the require well-formed flag is set (its value is true), - * and the value of attr's value attribute matches the XMLNS - * namespace, then throw an exception; the serialization of this - * attribute would produce invalid XML because the XMLNS namespace - * is reserved and cannot be applied as an element's namespace via - * XML parsing. - * - * _Note:_ DOM APIs do allow creation of elements in the XMLNS - * namespace but with strict qualifications. - */ - if (requireWellFormed && attr.value === infra_1.namespace.XMLNS) { - throw new Error("XMLNS namespace is reserved (well-formed required)."); - } - /** - * 3.5.2.3. If the require well-formed flag is set (its value is true), - * and the value of attr's value attribute is the empty string, then - * throw an exception; namespace prefix declarations cannot be used - * to undeclare a namespace (use a default namespace declaration - * instead). - */ - if (requireWellFormed && attr.value === '') { - throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."); - } - /** - * 3.5.2.4. the attr's prefix matches the string "xmlns", then let - * candidate prefix be the string "xmlns". - */ - if (attr.prefix === 'xmlns') - candidatePrefix = 'xmlns'; - /** - * 3.5.3. Otherwise, the attribute namespace is not the XMLNS namespace. - * Run these steps: - * - * _Note:_ The (candidatePrefix === null) check is not in the spec. - * We deviate from the spec here. Otherwise a prefix is generated for - * all attributes with namespaces. - */ - } - else if (candidatePrefix === null) { - if (attr.prefix !== null && - (!map.hasPrefix(attr.prefix) || - map.has(attr.prefix, attributeNamespace))) { - /** - * Check if we can use the attribute's own prefix. - * We deviate from the spec here. - * TODO: This is not an efficient way of searching for prefixes. - * Follow developments to the spec. - */ - candidatePrefix = attr.prefix; - } - else { - /** - * 3.5.3.1. Let candidate prefix be the result of generating a prefix - * providing map, attribute namespace, and prefix index as input. - */ - candidatePrefix = this._generatePrefix(attributeNamespace, map, prefixIndex); - } - /** - * 3.5.3.2. Append the following to result, in the order listed: - * 3.5.3.2.1. " " (U+0020 SPACE); - * 3.5.3.2.2. The string "xmlns:"; - * 3.5.3.2.3. The value of candidate prefix; - * 3.5.3.2.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); - * 3.5.3.2.5. The result of serializing an attribute value given - * attribute namespace and the require well-formed flag as input; - * 3.5.3.2.6. """ (U+0022 QUOTATION MARK). - */ - result += " xmlns:" + candidatePrefix + "=\"" + - this._serializeAttributeValue(attributeNamespace, requireWellFormed) + "\""; - } - } - /** - * 3.6. Append a " " (U+0020 SPACE) to result. - * 3.7. If candidate prefix is not null, then append to result the - * concatenation of candidate prefix with ":" (U+003A COLON). - */ - result += " "; - if (candidatePrefix !== null) { - result += candidatePrefix + ':'; - } - /** - * 3.8. If the require well-formed flag is set (its value is true), and - * this attr's localName attribute contains the character - * ":" (U+003A COLON) or does not match the XML Name production or - * equals "xmlns" and attribute namespace is null, then throw an - * exception; the serialization of this attr would not be a - * well-formed attribute. - */ - if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(attr.localName) || - (attr.localName === "xmlns" && attributeNamespace === null))) { - throw new Error("Attribute local name contains invalid characters (well-formed required)."); - } - /** - * 3.9. Append the following strings to result, in the order listed: - * 3.9.1. The value of attr's localName; - * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); - * 3.9.3. The result of serializing an attribute value given attr's value - * attribute and the require well-formed flag as input; - * 3.9.4. """ (U+0022 QUOTATION MARK). - */ - result += attr.localName + "=\"" + - this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; - } + * Initializes a new instance of `XMLStringLexer`. + * + * @param str - the string to tokenize and lex + * @param options - lexer options + */ + function XMLStringLexer(str, options) { + this._options = { + skipWhitespaceOnlyText: false + }; + this.err = { line: -1, col: -1, index: -1, str: "" }; + this._str = str; + this._index = 0; + this._length = str.length; + if (options) { + this._options.skipWhitespaceOnlyText = options.skipWhitespaceOnlyText || false; } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + /** + * Returns the next token. + */ + XMLStringLexer.prototype.nextToken = function () { + if (this.eof()) { + return { type: interfaces_1.TokenType.EOF }; + } + var token = (this.skipIfStartsWith('<') ? this.openBracket() : this.text()); + if (this._options.skipWhitespaceOnlyText) { + if (token.type === interfaces_1.TokenType.Text && + XMLStringLexer.isWhiteSpaceToken(token)) { + token = this.nextToken(); } - finally { if (e_4) throw e_4.error; } } - /** - * 4. Return the value of result. - */ - return result; + return token; }; /** - * Records namespace information for the given element and returns the - * default namespace attribute value. - * - * @param node - element node to process - * @param map - namespace prefix map - * @param localPrefixesMap - local prefixes map - */ - XMLSerializerImpl.prototype._recordNamespaceInformation = function (node, map, localPrefixesMap) { - var e_5, _a; - /** - * 1. Let default namespace attr value be null. - */ - var defaultNamespaceAttrValue = null; - try { - /** - * 2. Main: For each attribute attr in element's attributes, in the order - * they are specified in the element's attribute list: - */ - for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - /** - * _Note:_ The following conditional steps find namespace prefixes. Only - * attributes in the XMLNS namespace are considered (e.g., attributes made - * to look like namespace declarations via - * setAttribute("xmlns:pretend-prefix", "pretend-namespace") are not - * included). - */ - /** 2.1. Let attribute namespace be the value of attr's namespaceURI value. */ - var attributeNamespace = attr.namespaceURI; - /** 2.2. Let attribute prefix be the value of attr's prefix. */ - var attributePrefix = attr.prefix; - /** 2.3. If the attribute namespace is the XMLNS namespace, then: */ - if (attributeNamespace === infra_1.namespace.XMLNS) { - /** - * 2.3.1. If attribute prefix is null, then attr is a default namespace - * declaration. Set the default namespace attr value to attr's value and - * stop running these steps, returning to Main to visit the next - * attribute. - */ - if (attributePrefix === null) { - defaultNamespaceAttrValue = attr.value; - continue; - /** - * 2.3.2. Otherwise, the attribute prefix is not null and attr is a - * namespace prefix definition. Run the following steps: - */ - } - else { - /** 2.3.2.1. Let prefix definition be the value of attr's localName. */ - var prefixDefinition = attr.localName; - /** 2.3.2.2. Let namespace definition be the value of attr's value. */ - var namespaceDefinition = attr.value; - /** - * 2.3.2.3. If namespace definition is the XML namespace, then stop - * running these steps, and return to Main to visit the next - * attribute. - * - * _Note:_ XML namespace definitions in prefixes are completely - * ignored (in order to avoid unnecessary work when there might be - * prefix conflicts). XML namespaced elements are always handled - * uniformly by prefixing (and overriding if necessary) the element's - * localname with the reserved "xml" prefix. - */ - if (namespaceDefinition === infra_1.namespace.XML) { - continue; - } - /** - * 2.3.2.4. If namespace definition is the empty string (the - * declarative form of having no namespace), then let namespace - * definition be null instead. - */ - if (namespaceDefinition === '') { - namespaceDefinition = null; - } - /** - * 2.3.2.5. If prefix definition is found in map given the namespace - * namespace definition, then stop running these steps, and return to - * Main to visit the next attribute. - * - * _Note:_ This step avoids adding duplicate prefix definitions for - * the same namespace in the map. This has the side-effect of avoiding - * later serialization of duplicate namespace prefix declarations in - * any descendant nodes. - */ - if (map.has(prefixDefinition, namespaceDefinition)) { - continue; - } - /** - * 2.3.2.6. Add the prefix prefix definition to map given namespace - * namespace definition. - */ - map.set(prefixDefinition, namespaceDefinition); - /** - * 2.3.2.7. Add the value of prefix definition as a new key to the - * local prefixes map, with the namespace definition as the key's - * value replacing the value of null with the empty string if - * applicable. - */ - localPrefixesMap[prefixDefinition] = namespaceDefinition || ''; - } + * Branches from an opening bracket (`<`). + */ + XMLStringLexer.prototype.openBracket = function () { + if (this.skipIfStartsWith('?')) { + if (this.skipIfStartsWith('xml')) { + if (XMLStringLexer.isSpace(this._str[this._index])) { + return this.declaration(); + } + else { + // a processing instruction starting with xml. e.g. + this.seek(-3); + return this.pi(); } } + else { + return this.pi(); + } } - catch (e_5_1) { e_5 = { error: e_5_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + else if (this.skipIfStartsWith('!')) { + if (this.skipIfStartsWith('--')) { + return this.comment(); + } + else if (this.skipIfStartsWith('[CDATA[')) { + return this.cdata(); + } + else if (this.skipIfStartsWith('DOCTYPE')) { + return this.doctype(); + } + else { + this.throwError("Invalid '!' in opening tag."); } - finally { if (e_5) throw e_5.error; } } - /** - * 3. Return the value of default namespace attr value. - * - * _Note:_ The empty string is a legitimate return value and is not - * converted to null. - */ - return defaultNamespaceAttrValue; + else if (this.skipIfStartsWith('/')) { + return this.closeTag(); + } + else { + return this.openTag(); + } }; /** - * Generates a new prefix for the given namespace. - * - * @param newNamespace - a namespace to generate prefix for - * @param prefixMap - namespace prefix map - * @param prefixIndex - generated namespace prefix index - */ - XMLSerializerImpl.prototype._generatePrefix = function (newNamespace, prefixMap, prefixIndex) { - /** - * 1. Let generated prefix be the concatenation of the string "ns" and the - * current numerical value of prefix index. - * 2. Let the value of prefix index be incremented by one. - * 3. Add to map the generated prefix given the new namespace namespace. - * 4. Return the value of generated prefix. - */ - var generatedPrefix = "ns" + prefixIndex.value; - prefixIndex.value++; - prefixMap.set(generatedPrefix, newNamespace); - return generatedPrefix; + * Produces an XML declaration token. + */ + XMLStringLexer.prototype.declaration = function () { + var version = ''; + var encoding = ''; + var standalone = ''; + while (!this.eof()) { + this.skipSpace(); + if (this.skipIfStartsWith('?>')) { + return { type: interfaces_1.TokenType.Declaration, version: version, encoding: encoding, standalone: standalone }; + } + else { + // attribute name + var _a = __read(this.attribute(), 2), attName = _a[0], attValue = _a[1]; + if (attName === 'version') + version = attValue; + else if (attName === 'encoding') + encoding = attValue; + else if (attName === 'standalone') + standalone = attValue; + else + this.throwError('Invalid attribute name: ' + attName); + } + } + this.throwError('Missing declaration end symbol `?>`'); }; /** - * Produces an XML serialization of an attribute value. - * - * @param value - attribute value - * @param requireWellFormed - whether to check conformance + * Produces a doc type token. */ - XMLSerializerImpl.prototype._serializeAttributeValue = function (value, requireWellFormed) { - /** - * From: https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value - * - * 1. If the require well-formed flag is set (its value is true), and - * attribute value contains characters that are not matched by the XML Char - * production, then throw an exception; the serialization of this attribute - * value would fail to produce a well-formed element serialization. - */ - if (requireWellFormed && value !== null && !algorithm_1.xml_isLegalChar(value)) { - throw new Error("Invalid characters in attribute value."); + XMLStringLexer.prototype.doctype = function () { + var pubId = ''; + var sysId = ''; + // name + this.skipSpace(); + var name = this.takeUntil2('[', '>', true); + this.skipSpace(); + if (this.skipIfStartsWith('PUBLIC')) { + pubId = this.quotedString(); + sysId = this.quotedString(); } - /** - * 2. If attribute value is null, then return the empty string. - */ - if (value === null) - return ""; - /** - * 3. Otherwise, attribute value is a string. Return the value of attribute - * value, first replacing any occurrences of the following: - * - "&" with "&" - * - """ with """ - * - "<" with "<" - * - ">" with ">" - * NOTE - * This matches behavior present in browsers, and goes above and beyond the - * grammar requirement in the XML specification's AttValue production by - * also replacing ">" characters. - */ - var result = ""; - for (var i = 0; i < value.length; i++) { - var c = value[i]; - if (c === "\"") - result += """; - else if (c === "&") - result += "&"; - else if (c === "<") - result += "<"; - else if (c === ">") - result += ">"; - else - result += c; + else if (this.skipIfStartsWith('SYSTEM')) { + sysId = this.quotedString(); } - return result; + // skip internal subset + this.skipSpace(); + if (this.skipIfStartsWith('[')) { + // skip internal subset nodes + this.skipUntil(']'); + if (!this.skipIfStartsWith(']')) { + this.throwError('Missing end bracket of DTD internal subset'); + } + } + this.skipSpace(); + if (!this.skipIfStartsWith('>')) { + this.throwError('Missing doctype end symbol `>`'); + } + return { type: interfaces_1.TokenType.DocType, name: name, pubId: pubId, sysId: sysId }; }; /** - * Produces an XML serialization of an element node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance + * Produces a processing instruction token. */ - XMLSerializerImpl.prototype._serializeElement = function (node, requireWellFormed) { - var e_6, _a; - /** - * From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node - * - * 1. If the require well-formed flag is set (its value is true), and this - * node's localName attribute contains the character ":" (U+003A COLON) or - * does not match the XML Name production, then throw an exception; the - * serialization of this node would not be a well-formed element. - */ - if (requireWellFormed && (node.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(node.localName))) { - throw new Error("Node local name contains invalid characters (well-formed required)."); - } - /** - * 2. Let markup be the string "<" (U+003C LESS-THAN SIGN). - * 3. Let qualified name be an empty string. - * 4. Let skip end tag be a boolean flag with value false. - * 5. Let ignore namespace definition attribute be a boolean flag with value - * false. - * 6. Given prefix map, copy a namespace prefix map and let map be the - * result. - * 7. Let local prefixes map be an empty map. The map has unique Node prefix - * strings as its keys, with corresponding namespaceURI Node values as the - * map's key values (in this map, the null namespace is represented by the - * empty string). - * - * _Note:_ This map is local to each element. It is used to ensure there - * are no conflicting prefixes should a new namespace prefix attribute need - * to be generated. It is also used to enable skipping of duplicate prefix - * definitions when writing an element's attributes: the map allows the - * algorithm to distinguish between a prefix in the namespace prefix map - * that might be locally-defined (to the current Element) and one that is - * not. - * 8. Let local default namespace be the result of recording the namespace - * information for node given map and local prefixes map. - * - * _Note:_ The above step will update map with any found namespace prefix - * definitions, add the found prefix definitions to the local prefixes map - * and return a local default namespace value defined by a default namespace - * attribute if one exists. Otherwise it returns null. - * 9. Let inherited ns be a copy of namespace. - * 10. Let ns be the value of node's namespaceURI attribute. - */ - var skipEndTag = false; - /** 11. If inherited ns is equal to ns, then: */ - /** - * 11.1. If local default namespace is not null, then set ignore - * namespace definition attribute to true. - * 11.2. If ns is the XML namespace, then append to qualified name the - * concatenation of the string "xml:" and the value of node's localName. - * 11.3. Otherwise, append to qualified name the value of node's - * localName. The node's prefix if it exists, is dropped. - */ - var qualifiedName = node.localName; - /** 11.4. Append the value of qualified name to markup. */ - var markup = "<" + qualifiedName; - /** - * 13. Append to markup the result of the XML serialization of node's - * attributes given map, prefix index, local prefixes map, ignore namespace - * definition attribute flag, and require well-formed flag. - */ - markup += this._serializeAttributes(node, requireWellFormed); - /** - * 14. If ns is the HTML namespace, and the node's list of children is - * empty, and the node's localName matches any one of the following void - * elements: "area", "base", "basefont", "bgsound", "br", "col", "embed", - * "frame", "hr", "img", "input", "keygen", "link", "menuitem", "meta", - * "param", "source", "track", "wbr"; then append the following to markup, - * in the order listed: - * 14.1. " " (U+0020 SPACE); - * 14.2. "/" (U+002F SOLIDUS). - * and set the skip end tag flag to true. - * 15. If ns is not the HTML namespace, and the node's list of children is - * empty, then append "/" (U+002F SOLIDUS) to markup and set the skip end - * tag flag to true. - * 16. Append ">" (U+003E GREATER-THAN SIGN) to markup. - */ - if (node._children.size === 0) { - markup += "/"; - skipEndTag = true; + XMLStringLexer.prototype.pi = function () { + var target = this.takeUntilStartsWith('?>', true); + if (this.eof()) { + this.throwError('Missing processing instruction end symbol `?>`'); } - markup += ">"; - /** - * 17. If the value of skip end tag is true, then return the value of markup - * and skip the remaining steps. The node is a leaf-node. - */ - if (skipEndTag) - return markup; - try { - /** - * 18. If ns is the HTML namespace, and the node's localName matches the - * string "template", then this is a template element. Append to markup the - * result of XML serializing a DocumentFragment node given the template - * element's template contents (a DocumentFragment), providing inherited - * ns, map, prefix index, and the require well-formed flag. - * - * _Note:_ This allows template content to round-trip, given the rules for - * parsing XHTML documents. - * - * 19. Otherwise, append to markup the result of running the XML - * serialization algorithm on each of node's children, in tree order, - * providing inherited ns, map, prefix index, and the require well-formed - * flag. - */ - for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - markup += this._serializeNode(childNode, requireWellFormed); - } + this.skipSpace(); + if (this.skipIfStartsWith('?>')) { + return { type: interfaces_1.TokenType.PI, target: target, data: '' }; } - catch (e_6_1) { e_6 = { error: e_6_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_6) throw e_6.error; } + var data = this.takeUntilStartsWith('?>'); + if (this.eof()) { + this.throwError('Missing processing instruction end symbol `?>`'); } - /** - * 20. Append the following to markup, in the order listed: - * 20.1. "" (U+003E GREATER-THAN SIGN). - */ - markup += ""; - /** - * 21. Return the value of markup. - */ - return markup; + this.seek(2); + return { type: interfaces_1.TokenType.PI, target: target, data: data }; }; /** - * Produces an XML serialization of a document node. + * Produces a text token. * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeDocument = function (node, requireWellFormed) { - var e_7, _a; - /** - * If the require well-formed flag is set (its value is true), and this node - * has no documentElement (the documentElement attribute's value is null), - * then throw an exception; the serialization of this node would not be a - * well-formed document. - */ - if (requireWellFormed && node.documentElement === null) { - throw new Error("Missing document element (well-formed required)."); - } - /** - * Otherwise, run the following steps: - * 1. Let serialized document be an empty string. - * 2. For each child child of node, in tree order, run the XML - * serialization algorithm on the child passing along the provided - * arguments, and append the result to serialized document. - * - * _Note:_ This will serialize any number of ProcessingInstruction and - * Comment nodes both before and after the Document's documentElement node, - * including at most one DocumentType node. (Text nodes are not allowed as - * children of the Document.) - * - * 3. Return the value of serialized document. - */ - var serializedDocument = ""; - try { - for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - serializedDocument += this._serializeNode(childNode, requireWellFormed); - } - } - catch (e_7_1) { e_7 = { error: e_7_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_7) throw e_7.error; } - } - return serializedDocument; + XMLStringLexer.prototype.text = function () { + var data = this.takeUntil('<'); + return { type: interfaces_1.TokenType.Text, data: data }; }; /** - * Produces an XML serialization of a document fragment node. + * Produces a comment token. * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeDocumentFragment = function (node, requireWellFormed) { - var e_8, _a; - /** - * 1. Let markup the empty string. - * 2. For each child child of node, in tree order, run the XML serialization - * algorithm on the child given namespace, prefix map, a reference to prefix - * index, and flag require well-formed. Concatenate the result to markup. - * 3. Return the value of markup. - */ - var markup = ""; - try { - for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - markup += this._serializeNode(childNode, requireWellFormed); - } - } - catch (e_8_1) { e_8 = { error: e_8_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_8) throw e_8.error; } + XMLStringLexer.prototype.comment = function () { + var data = this.takeUntilStartsWith('-->'); + if (this.eof()) { + this.throwError('Missing comment end symbol `-->`'); } - return markup; + this.seek(3); + return { type: interfaces_1.TokenType.Comment, data: data }; }; /** - * Produces an XML serialization of the attributes of an element node. + * Produces a CDATA token. * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeAttributes = function (node, requireWellFormed) { - var e_9, _a; - /** - * 1. Let result be the empty string. - * 2. Let localname set be a new empty namespace localname set. This - * localname set will contain tuples of unique attribute namespaceURI and - * localName pairs, and is populated as each attr is processed. This set is - * used to [optionally] enforce the well-formed constraint that an element - * cannot have two attributes with the same namespaceURI and localName. - * This can occur when two otherwise identical attributes on the same - * element differ only by their prefix values. - */ - var result = ""; - var localNameSet = requireWellFormed ? {} : undefined; - try { - /** - * 3. Loop: For each attribute attr in element's attributes, in the order - * they are specified in the element's attribute list: - */ - for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - /** - * 3.1. If the require well-formed flag is set (its value is true), and the - * localname set contains a tuple whose values match those of a new tuple - * consisting of attr's namespaceURI attribute and localName attribute, - * then throw an exception; the serialization of this attr would fail to - * produce a well-formed element serialization. - */ - if (requireWellFormed && localNameSet && (attr.localName in localNameSet)) { - throw new Error("Element contains duplicate attributes (well-formed required)."); - } - /** - * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and - * localName attribute, and add it to the localname set. - * 3.3. Let attribute namespace be the value of attr's namespaceURI value. - * 3.4. Let candidate prefix be null. - */ - if (requireWellFormed && localNameSet) - localNameSet[attr.localName] = true; - /** 3.5. If attribute namespace is not null, then run these sub-steps: */ - /** - * 3.6. Append a " " (U+0020 SPACE) to result. - * 3.7. If candidate prefix is not null, then append to result the - * concatenation of candidate prefix with ":" (U+003A COLON). - */ - /** - * 3.8. If the require well-formed flag is set (its value is true), and - * this attr's localName attribute contains the character - * ":" (U+003A COLON) or does not match the XML Name production or - * equals "xmlns" and attribute namespace is null, then throw an - * exception; the serialization of this attr would not be a - * well-formed attribute. - */ - if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(attr.localName))) { - throw new Error("Attribute local name contains invalid characters (well-formed required)."); - } - /** - * 3.9. Append the following strings to result, in the order listed: - * 3.9.1. The value of attr's localName; - * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); - * 3.9.3. The result of serializing an attribute value given attr's value - * attribute and the require well-formed flag as input; - * 3.9.4. """ (U+0022 QUOTATION MARK). - */ - result += " " + attr.localName + "=\"" + - this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; - } - } - catch (e_9_1) { e_9 = { error: e_9_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_9) throw e_9.error; } + XMLStringLexer.prototype.cdata = function () { + var data = this.takeUntilStartsWith(']]>'); + if (this.eof()) { + this.throwError('Missing CDATA end symbol `]>`'); } - /** - * 4. Return the value of result. - */ - return result; + this.seek(3); + return { type: interfaces_1.TokenType.CDATA, data: data }; }; - XMLSerializerImpl._VoidElementNames = new Set(['area', 'base', 'basefont', - 'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen', - 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']); - return XMLSerializerImpl; -}()); -exports.XMLSerializerImpl = XMLSerializerImpl; -//# sourceMappingURL=XMLSerializerImpl.js.map - -/***/ }), - -/***/ 7119: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -// Export classes -var XMLSerializerImpl_1 = __nccwpck_require__(5039); -exports.XMLSerializer = XMLSerializerImpl_1.XMLSerializerImpl; -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ 5483: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var Guard_1 = __nccwpck_require__(6862); -/** - * Contains type casts for DOM objects. - */ -var Cast = /** @class */ (function () { - function Cast() { - } /** - * Casts the given object to a `Node`. - * - * @param a - the object to cast + * Produces an element token. */ - Cast.asNode = function (a) { - if (Guard_1.Guard.isNode(a)) { - return a; + XMLStringLexer.prototype.openTag = function () { + // element name + this.skipSpace(); + var name = this.takeUntil2('>', '/', true); + this.skipSpace(); + if (this.skipIfStartsWith('>')) { + return { type: interfaces_1.TokenType.Element, name: name, attributes: [], selfClosing: false }; } - else { - throw new Error("Invalid object. Node expected."); + else if (this.skipIfStartsWith('/>')) { + return { type: interfaces_1.TokenType.Element, name: name, attributes: [], selfClosing: true }; } + // attributes + var attributes = []; + while (!this.eof()) { + // end tag + this.skipSpace(); + if (this.skipIfStartsWith('>')) { + return { type: interfaces_1.TokenType.Element, name: name, attributes: attributes, selfClosing: false }; + } + else if (this.skipIfStartsWith('/>')) { + return { type: interfaces_1.TokenType.Element, name: name, attributes: attributes, selfClosing: true }; + } + var attr = this.attribute(); + attributes.push(attr); + } + this.throwError('Missing opening element tag end symbol `>`'); }; - return Cast; -}()); -exports.Cast = Cast; -//# sourceMappingURL=Cast.js.map - -/***/ }), - -/***/ 8392: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var EmptySet = /** @class */ (function () { - function EmptySet() { - } - Object.defineProperty(EmptySet.prototype, "size", { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }); - EmptySet.prototype.add = function (value) { - throw new Error("Cannot add to an empty set."); - }; - EmptySet.prototype.clear = function () { - // no-op - }; - EmptySet.prototype.delete = function (value) { - return false; - }; - EmptySet.prototype.forEach = function (callbackfn, thisArg) { - // no-op - }; - EmptySet.prototype.has = function (value) { - return false; - }; - EmptySet.prototype[Symbol.iterator] = function () { - return new EmptySetIterator(); - }; - EmptySet.prototype.entries = function () { - return new EmptySetIterator(); - }; - EmptySet.prototype.keys = function () { - return new EmptySetIterator(); - }; - EmptySet.prototype.values = function () { - return new EmptySetIterator(); - }; - Object.defineProperty(EmptySet.prototype, Symbol.toStringTag, { - get: function () { - return "EmptySet"; - }, - enumerable: true, - configurable: true - }); - return EmptySet; -}()); -exports.EmptySet = EmptySet; -var EmptySetIterator = /** @class */ (function () { - function EmptySetIterator() { - } - EmptySetIterator.prototype[Symbol.iterator] = function () { - return this; - }; - EmptySetIterator.prototype.next = function () { - return { done: true, value: null }; - }; - return EmptySetIterator; -}()); -//# sourceMappingURL=EmptySet.js.map - -/***/ }), - -/***/ 6862: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(7305); -/** - * Contains user-defined type guards for DOM objects. - */ -var Guard = /** @class */ (function () { - function Guard() { - } /** - * Determines if the given object is a `Node`. + * Produces a closing tag token. * - * @param a - the object to check */ - Guard.isNode = function (a) { - return (!!a && a._nodeType !== undefined); + XMLStringLexer.prototype.closeTag = function () { + this.skipSpace(); + var name = this.takeUntil('>', true); + this.skipSpace(); + if (!this.skipIfStartsWith('>')) { + this.throwError('Missing closing element tag end symbol `>`'); + } + return { type: interfaces_1.TokenType.ClosingTag, name: name }; }; /** - * Determines if the given object is a `Document`. - * - * @param a - the object to check + * Reads an attribute name, value pair */ - Guard.isDocumentNode = function (a) { - return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Document); + XMLStringLexer.prototype.attribute = function () { + // attribute name + this.skipSpace(); + var name = this.takeUntil('=', true); + this.skipSpace(); + if (!this.skipIfStartsWith('=')) { + this.throwError('Missing equals sign before attribute value'); + } + // attribute value + var value = this.quotedString(); + return [name, value]; }; /** - * Determines if the given object is a `DocumentType`. - * - * @param a - the object to check + * Reads a string between double or single quotes. */ - Guard.isDocumentTypeNode = function (a) { - return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.DocumentType); + XMLStringLexer.prototype.quotedString = function () { + this.skipSpace(); + var startQuote = this.take(1); + if (!XMLStringLexer.isQuote(startQuote)) { + this.throwError('Missing start quote character before quoted value'); + } + var value = this.takeUntil(startQuote); + if (!this.skipIfStartsWith(startQuote)) { + this.throwError('Missing end quote character after quoted value'); + } + return value; }; /** - * Determines if the given object is a `DocumentFragment`. - * - * @param a - the object to check + * Determines if the current index is at or past the end of input string. */ - Guard.isDocumentFragmentNode = function (a) { - return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.DocumentFragment); - }; + XMLStringLexer.prototype.eof = function () { return this._index >= this._length; }; /** - * Determines if the given object is a `Attr`. + * Skips the length of the given string if the string from current position + * starts with the given string. * - * @param a - the object to check + * @param str - the string to match */ - Guard.isAttrNode = function (a) { - return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Attribute); - }; - /** - * Determines if the given node is a `CharacterData` node. - * - * @param a - the object to check - */ - Guard.isCharacterDataNode = function (a) { - if (!Guard.isNode(a)) - return false; - var type = a._nodeType; - return (type === interfaces_1.NodeType.Text || - type === interfaces_1.NodeType.ProcessingInstruction || - type === interfaces_1.NodeType.Comment || - type === interfaces_1.NodeType.CData); - }; - /** - * Determines if the given object is a `Text` or a `CDATASection`. - * - * @param a - the object to check - */ - Guard.isTextNode = function (a) { - return (Guard.isNode(a) && (a._nodeType === interfaces_1.NodeType.Text || a._nodeType === interfaces_1.NodeType.CData)); - }; - /** - * Determines if the given object is a `Text`. - * - * @param a - the object to check - */ - Guard.isExclusiveTextNode = function (a) { - return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Text); + XMLStringLexer.prototype.skipIfStartsWith = function (str) { + var strLength = str.length; + if (strLength === 1) { + if (this._str[this._index] === str) { + this._index++; + return true; + } + else { + return false; + } + } + for (var i = 0; i < strLength; i++) { + if (this._str[this._index + i] !== str[i]) + return false; + } + this._index += strLength; + return true; }; /** - * Determines if the given object is a `CDATASection`. + * Seeks a number of character codes. * - * @param a - the object to check + * @param count - number of characters to skip */ - Guard.isCDATASectionNode = function (a) { - return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.CData); + XMLStringLexer.prototype.seek = function (count) { + this._index += count; + if (this._index < 0) + this._index = 0; + if (this._index > this._length) + this._index = this._length; }; /** - * Determines if the given object is a `Comment`. - * - * @param a - the object to check + * Skips space characters. */ - Guard.isCommentNode = function (a) { - return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Comment); + XMLStringLexer.prototype.skipSpace = function () { + while (!this.eof() && (XMLStringLexer.isSpace(this._str[this._index]))) { + this._index++; + } }; /** - * Determines if the given object is a `ProcessingInstruction`. + * Takes a given number of characters. * - * @param a - the object to check + * @param count - character count */ - Guard.isProcessingInstructionNode = function (a) { - return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.ProcessingInstruction); + XMLStringLexer.prototype.take = function (count) { + if (count === 1) { + return this._str[this._index++]; + } + var startIndex = this._index; + this.seek(count); + return this._str.slice(startIndex, this._index); }; /** - * Determines if the given object is an `Element`. + * Takes characters until the next character matches `char`. * - * @param a - the object to check + * @param char - a character to match + * @param space - whether a space character stops iteration */ - Guard.isElementNode = function (a) { - return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Element); + XMLStringLexer.prototype.takeUntil = function (char, space) { + if (space === void 0) { space = false; } + var startIndex = this._index; + while (this._index < this._length) { + var c = this._str[this._index]; + if (c !== char && (!space || !XMLStringLexer.isSpace(c))) { + this._index++; + } + else { + break; + } + } + return this._str.slice(startIndex, this._index); }; /** - * Determines if the given object is a custom `Element`. + * Takes characters until the next character matches `char1` or `char1`. * - * @param a - the object to check + * @param char1 - a character to match + * @param char2 - a character to match + * @param space - whether a space character stops iteration */ - Guard.isCustomElementNode = function (a) { - return (Guard.isElementNode(a) && a._customElementState === "custom"); + XMLStringLexer.prototype.takeUntil2 = function (char1, char2, space) { + if (space === void 0) { space = false; } + var startIndex = this._index; + while (this._index < this._length) { + var c = this._str[this._index]; + if (c !== char1 && c !== char2 && (!space || !XMLStringLexer.isSpace(c))) { + this._index++; + } + else { + break; + } + } + return this._str.slice(startIndex, this._index); }; /** - * Determines if the given object is a `ShadowRoot`. + * Takes characters until the next characters matches `str`. * - * @param a - the object to check + * @param str - a string to match + * @param space - whether a space character stops iteration */ - Guard.isShadowRoot = function (a) { - return (!!a && a.host !== undefined); + XMLStringLexer.prototype.takeUntilStartsWith = function (str, space) { + if (space === void 0) { space = false; } + var startIndex = this._index; + var strLength = str.length; + while (this._index < this._length) { + var match = true; + for (var i = 0; i < strLength; i++) { + var c = this._str[this._index + i]; + var char = str[i]; + if (space && XMLStringLexer.isSpace(c)) { + return this._str.slice(startIndex, this._index); + } + else if (c !== char) { + this._index++; + match = false; + break; + } + } + if (match) + return this._str.slice(startIndex, this._index); + } + this._index = this._length; + return this._str.slice(startIndex); }; /** - * Determines if the given object is a `MouseEvent`. + * Skips characters until the next character matches `char`. * - * @param a - the object to check + * @param char - a character to match */ - Guard.isMouseEvent = function (a) { - return (!!a && a.screenX !== undefined && a.screenY != undefined); + XMLStringLexer.prototype.skipUntil = function (char) { + while (this._index < this._length) { + var c = this._str[this._index]; + if (c !== char) { + this._index++; + } + else { + break; + } + } }; /** - * Determines if the given object is a slotable. - * - * Element and Text nodes are slotables. A slotable has an associated name - * (a string). + * Determines if the given token is entirely whitespace. * - * @param a - the object to check + * @param token - the token to check */ - Guard.isSlotable = function (a) { - return (!!a && a._name !== undefined && a._assignedSlot !== undefined && - (Guard.isTextNode(a) || Guard.isElementNode(a))); + XMLStringLexer.isWhiteSpaceToken = function (token) { + var str = token.data; + for (var i = 0; i < str.length; i++) { + var c = str[i]; + if (c !== ' ' && c !== '\n' && c !== '\r' && c !== '\t' && c !== '\f') + return false; + } + return true; }; /** - * Determines if the given object is a slot. + * Determines if the given character is whitespace. * - * @param a - the object to check + * @param char - the character to check */ - Guard.isSlot = function (a) { - return (!!a && a._name !== undefined && a._assignedNodes !== undefined && - Guard.isElementNode(a)); + XMLStringLexer.isSpace = function (char) { + return char === ' ' || char === '\n' || char === '\r' || char === '\t'; }; /** - * Determines if the given object is a `Window`. + * Determines if the given character is a quote character. * - * @param a - the object to check + * @param char - the character to check */ - Guard.isWindow = function (a) { - return (!!a && a.navigator !== undefined); + XMLStringLexer.isQuote = function (char) { + return (char === '"' || char === '\''); }; /** - * Determines if the given object is an `EventListener`. + * Throws a parser error and records the line and column numbers in the parsed + * string. * - * @param a - the object to check + * @param msg - error message */ - Guard.isEventListener = function (a) { - return (!!a && a.handleEvent !== undefined); + XMLStringLexer.prototype.throwError = function (msg) { + var regexp = /\r\n|\r|\n/g; + var match = null; + var line = 0; + var firstNewLineIndex = 0; + var lastNewlineIndex = this._str.length; + while ((match = regexp.exec(this._str)) !== null) { + if (match === null) + break; + line++; + if (match.index < this._index) + firstNewLineIndex = regexp.lastIndex; + if (match.index > this._index) { + lastNewlineIndex = match.index; + break; + } + } + this.err = { + line: line, + col: this._index - firstNewLineIndex, + index: this._index, + str: this._str.substring(firstNewLineIndex, lastNewlineIndex) + }; + throw new Error(msg + "\nIndex: " + this.err.index + + "\nLn: " + this.err.line + ", Col: " + this.err.col + + "\nInput: " + this.err.str); }; /** - * Determines if the given object is a `RegisteredObserver`. - * - * @param a - the object to check + * Returns an iterator for the lexer. */ - Guard.isRegisteredObserver = function (a) { - return (!!a && a.observer !== undefined && a.options !== undefined); - }; - /** - * Determines if the given object is a `TransientRegisteredObserver`. - * - * @param a - the object to check - */ - Guard.isTransientRegisteredObserver = function (a) { - return (!!a && a.source !== undefined && Guard.isRegisteredObserver(a)); + XMLStringLexer.prototype[Symbol.iterator] = function () { + this._index = 0; + return { + next: function () { + var token = this.nextToken(); + if (token.type === interfaces_1.TokenType.EOF) { + return { done: true, value: null }; + } + else { + return { done: false, value: token }; + } + }.bind(this) + }; }; - return Guard; + return XMLStringLexer; }()); -exports.Guard = Guard; -//# sourceMappingURL=Guard.js.map +exports.XMLStringLexer = XMLStringLexer; +//# sourceMappingURL=XMLStringLexer.js.map /***/ }), -/***/ 5282: +/***/ 36216: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var Cast_1 = __nccwpck_require__(5483); -exports.Cast = Cast_1.Cast; -var Guard_1 = __nccwpck_require__(6862); -exports.Guard = Guard_1.Guard; -var EmptySet_1 = __nccwpck_require__(8392); -exports.EmptySet = EmptySet_1.EmptySet; +// Export classes +var DOMParserImpl_1 = __nccwpck_require__(98845); +exports.DOMParser = DOMParserImpl_1.DOMParserImpl; //# sourceMappingURL=index.js.map /***/ }), -/***/ 8585: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 97707: +/***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var CodePoints_1 = __nccwpck_require__(8548); -/** - * Base-64 encodes the given string. - * - * @param input - a string - */ -function forgivingBase64Encode(input) { - /** - * To forgiving-base64 encode given a byte sequence data, apply the base64 - * algorithm defined in section 4 of RFC 4648 to data and return the result. - * [RFC4648] - */ - return Buffer.from(input).toString('base64'); -} -exports.forgivingBase64Encode = forgivingBase64Encode; /** - * Decodes a base-64 string. - * - * @param input - a string + * Defines the type of a token. */ -function forgivingBase64Decode(input) { - if (input === "") - return ""; - /** - * 1. Remove all ASCII whitespace from data. - */ - input = input.replace(CodePoints_1.ASCIIWhiteSpace, ''); - /** - * 2. If data’s length divides by 4 leaving no remainder, then: - * 2.1. If data ends with one or two U+003D (=) code points, then remove them from data. - */ - if (input.length % 4 === 0) { - if (input.endsWith("==")) { - input = input.substr(0, input.length - 2); - } - else if (input.endsWith("=")) { - input = input.substr(0, input.length - 1); - } - } - /** - * 3. If data’s length divides by 4 leaving a remainder of 1, then return failure. - */ - if (input.length % 4 === 1) - return null; - /** - * 4. If data contains a code point that is not one of - * - U+002B (+) - * - U+002F (/) - * - ASCII alphanumeric - * then return failure. - */ - if (!/[0-9A-Za-z+/]/.test(input)) - return null; - /** - * 5. Let output be an empty byte sequence. - * 6. Let buffer be an empty buffer that can have bits appended to it. - * 7. Let position be a position variable for data, initially pointing at the - * start of data. - * 8. While position does not point past the end of data: - * 8.1. Find the code point pointed to by position in the second column of - * Table 1: The Base 64 Alphabet of RFC 4648. Let n be the number given in the - * first cell of the same row. [RFC4648] - * 8.2. Append the six bits corresponding to n, most significant bit first, - * to buffer. - * 8.3. If buffer has accumulated 24 bits, interpret them as three 8-bit - * big-endian numbers. Append three bytes with values equal to those numbers - * to output, in the same order, and then empty buffer. - * 8.4. Advance position by 1. - * 9. If buffer is not empty, it contains either 12 or 18 bits. If it contains - * 12 bits, then discard the last four and interpret the remaining eight as an - * 8-bit big-endian number. If it contains 18 bits, then discard the last two - * and interpret the remaining 16 as two 8-bit big-endian numbers. Append the - * one or two bytes with values equal to those one or two numbers to output, - * in the same order. - * 10. Return output. - */ - return Buffer.from(input, 'base64').toString('utf8'); -} -exports.forgivingBase64Decode = forgivingBase64Decode; -//# sourceMappingURL=Base64.js.map +var TokenType; +(function (TokenType) { + TokenType[TokenType["EOF"] = 0] = "EOF"; + TokenType[TokenType["Declaration"] = 1] = "Declaration"; + TokenType[TokenType["DocType"] = 2] = "DocType"; + TokenType[TokenType["Element"] = 3] = "Element"; + TokenType[TokenType["Text"] = 4] = "Text"; + TokenType[TokenType["CDATA"] = 5] = "CDATA"; + TokenType[TokenType["PI"] = 6] = "PI"; + TokenType[TokenType["Comment"] = 7] = "Comment"; + TokenType[TokenType["ClosingTag"] = 8] = "ClosingTag"; +})(TokenType = exports.TokenType || (exports.TokenType = {})); +//# sourceMappingURL=interfaces.js.map /***/ }), -/***/ 2460: +/***/ 19049: /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); /** - * Determines if the given number is an ASCII byte. - * - * @param byte - a byte + * Represents a set of unique attribute namespaceURI and localName pairs. + * This set will contain tuples of unique attribute namespaceURI and + * localName pairs, and is populated as each attr is processed. This set is + * used to [optionally] enforce the well-formed constraint that an element + * cannot have two attributes with the same namespaceURI and localName. + * This can occur when two otherwise identical attributes on the same + * element differ only by their prefix values. */ -function isASCIIByte(byte) { +var LocalNameSet = /** @class */ (function () { + function LocalNameSet() { + // tuple storage + this._items = {}; + this._nullItems = {}; + } /** - * An ASCII byte is a byte in the range 0x00 (NUL) to 0x7F (DEL), inclusive. + * Adds or replaces a tuple. + * + * @param ns - namespace URI + * @param localName - attribute local name */ - return byte >= 0x00 && byte <= 0x7F; -} -exports.isASCIIByte = isASCIIByte; -//# sourceMappingURL=Byte.js.map + LocalNameSet.prototype.set = function (ns, localName) { + if (ns === null) { + this._nullItems[localName] = true; + } + else if (this._items[ns]) { + this._items[ns][localName] = true; + } + else { + this._items[ns] = {}; + this._items[ns][localName] = true; + } + }; + /** + * Determines if the given tuple exists in the set. + * + * @param ns - namespace URI + * @param localName - attribute local name + */ + LocalNameSet.prototype.has = function (ns, localName) { + if (ns === null) { + return this._nullItems[localName] === true; + } + else if (this._items[ns]) { + return this._items[ns][localName] === true; + } + else { + return false; + } + }; + return LocalNameSet; +}()); +exports.LocalNameSet = LocalNameSet; +//# sourceMappingURL=LocalNameSet.js.map /***/ }), -/***/ 1627: -/***/ (function(__unused_webpack_module, exports) { +/***/ 90283: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); /** - * Returns the count of bytes in a sequence. + * A namespace prefix map is a map that associates namespaceURI and namespace + * prefix lists, where namespaceURI values are the map's unique keys (which can + * include the null value representing no namespace), and ordered lists of + * associated prefix values are the map's key values. The namespace prefix map + * will be populated by previously seen namespaceURIs and all their previously + * encountered prefix associations for a given node and its ancestors. * - * @param list - a byte sequence - */ -function length(list) { - /** - * A byte sequence’s length is the number of bytes it contains. - */ - return list.length; -} -exports.length = length; -/** - * Converts each byte to lowercase. + * _Note:_ The last seen prefix for a given namespaceURI is at the end of its + * respective list. The list is searched to find potentially matching prefixes, + * and if no matches are found for the given namespaceURI, then the last prefix + * in the list is used. See copy a namespace prefix map and retrieve a preferred + * prefix string for additional details. * - * @param list - a byte sequence + * See: https://w3c.github.io/DOM-Parsing/#the-namespace-prefix-map */ -function byteLowercase(list) { +var NamespacePrefixMap = /** @class */ (function () { + function NamespacePrefixMap() { + this._items = {}; + this._nullItems = []; + } /** - * To byte-lowercase a byte sequence, increase each byte it contains, in the - * range 0x41 (A) to 0x5A (Z), inclusive, by 0x20. + * Creates a copy of the map. */ - for (var i = 0; i < list.length; i++) { - var c = list[i]; - if (c >= 0x41 && c <= 0x5A) { - list[i] = c + 0x20; + NamespacePrefixMap.prototype.copy = function () { + /** + * To copy a namespace prefix map map means to copy the map's keys into a + * new empty namespace prefix map, and to copy each of the values in the + * namespace prefix list associated with each keys' value into a new list + * which should be associated with the respective key in the new map. + */ + var mapCopy = new NamespacePrefixMap(); + for (var key in this._items) { + mapCopy._items[key] = this._items[key].slice(0); } - } -} -exports.byteLowercase = byteLowercase; -/** - * Converts each byte to uppercase. - * - * @param list - a byte sequence - */ -function byteUppercase(list) { + mapCopy._nullItems = this._nullItems.slice(0); + return mapCopy; + }; /** - * To byte-uppercase a byte sequence, subtract each byte it contains, in the - * range 0x61 (a) to 0x7A (z), inclusive, by 0x20. + * Retrieves a preferred prefix string from the namespace prefix map. + * + * @param preferredPrefix - preferred prefix string + * @param ns - namespace */ - for (var i = 0; i < list.length; i++) { - var c = list[i]; - if (c >= 0x61 && c <= 0x7A) { - list[i] = c - 0x20; + NamespacePrefixMap.prototype.get = function (preferredPrefix, ns) { + /** + * 1. Let candidates list be the result of retrieving a list from map where + * there exists a key in map that matches the value of ns or if there is no + * such key, then stop running these steps, and return the null value. + */ + var candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); + if (candidatesList === null) { + return null; } - } -} -exports.byteUppercase = byteUppercase; -/** - * Compares two byte sequences. - * - * @param listA - a byte sequence - * @param listB - a byte sequence - */ -function byteCaseInsensitiveMatch(listA, listB) { - /** - * A byte sequence A is a byte-case-insensitive match for a byte sequence B, - * if the byte-lowercase of A is the byte-lowercase of B. - */ - if (listA.length !== listB.length) - return false; - for (var i = 0; i < listA.length; i++) { - var a = listA[i]; - var b = listB[i]; - if (a >= 0x41 && a <= 0x5A) - a += 0x20; - if (b >= 0x41 && b <= 0x5A) - b += 0x20; - if (a !== b) - return false; - } - return true; -} -exports.byteCaseInsensitiveMatch = byteCaseInsensitiveMatch; -/** - * Determines if `listA` starts with `listB`. - * - * @param listA - a byte sequence - * @param listB - a byte sequence - */ -function startsWith(listA, listB) { + /** + * 2. Otherwise, for each prefix value prefix in candidates list, iterating + * from beginning to end: + * + * _Note:_ There will always be at least one prefix value in the list. + */ + var prefix = null; + for (var i = 0; i < candidatesList.length; i++) { + prefix = candidatesList[i]; + /** + * 2.1. If prefix matches preferred prefix, then stop running these steps + * and return prefix. + */ + if (prefix === preferredPrefix) { + return prefix; + } + } + /** + * 2.2. If prefix is the last item in the candidates list, then stop + * running these steps and return prefix. + */ + return prefix; + }; /** - * 1. Let i be 0. - * 2. While true: - * 2.1. Let aByte be the ith byte of a if i is less than a’s length; otherwise null. - * 2.3. Let bByte be the ith byte of b if i is less than b’s length; otherwise null. - * 2.4. If bByte is null, then return true. - * 2.5. Return false if aByte is not bByte. - * 2.6. Set i to i + 1. + * Checks if a prefix string is found in the namespace prefix map associated + * with the given namespace. + * + * @param prefix - prefix string + * @param ns - namespace */ - var i = 0; - while (true) { - if (i >= listA.length) - return false; - if (i >= listB.length) - return true; - if (listA[i] !== listB[i]) + NamespacePrefixMap.prototype.has = function (prefix, ns) { + /** + * 1. Let candidates list be the result of retrieving a list from map where + * there exists a key in map that matches the value of ns or if there is + * no such key, then stop running these steps, and return false. + */ + var candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); + if (candidatesList === null) { return false; - i++; - } -} -exports.startsWith = startsWith; -/** - * Determines if `listA` is less than `listB`. - * - * @param listA - a byte sequence - * @param listB - a byte sequence - */ -function byteLessThan(listA, listB) { + } + /** + * 2. If the value of prefix occurs at least once in candidates list, + * return true, otherwise return false. + */ + return (candidatesList.indexOf(prefix) !== -1); + }; /** - * 1. If b starts with a, then return false. - * 2. If a starts with b, then return true. - * 3. Let n be the smallest index such that the nth byte of a is different - * from the nth byte of b. (There has to be such an index, since neither byte - * sequence starts with the other.) - * 4. If the nth byte of a is less than the nth byte of b, then return true. - * 5. Return false. + * Checks if a prefix string is found in the namespace prefix map. + * + * @param prefix - prefix string */ - var i = 0; - while (true) { - if (i >= listA.length) - return false; - if (i >= listB.length) - return true; - var a = listA[i]; - var b = listB[i]; - if (a < b) + NamespacePrefixMap.prototype.hasPrefix = function (prefix) { + if (this._nullItems.indexOf(prefix) !== -1) return true; - else if (a > b) - return false; - i++; - } -} -exports.byteLessThan = byteLessThan; -/** - * Decodes a byte sequence into a string. - * - * @param list - a byte sequence - */ -function isomorphicDecode(list) { + for (var key in this._items) { + if (this._items[key].indexOf(prefix) !== -1) + return true; + } + return false; + }; /** - * To isomorphic decode a byte sequence input, return a string whose length is - * equal to input’s length and whose code points have the same values as - * input’s bytes, in the same order. + * Adds a prefix string associated with a namespace to the prefix map. + * + * @param prefix - prefix string + * @param ns - namespace */ - return String.fromCodePoint.apply(String, __spread(list)); -} -exports.isomorphicDecode = isomorphicDecode; -//# sourceMappingURL=ByteSequence.js.map - -/***/ }), - -/***/ 8548: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -/** - * A surrogate is a code point that is in the range U+D800 to U+DFFF, inclusive. - */ -exports.Surrogate = /[\uD800-\uDFFF]/; -/** - * A scalar value is a code point that is not a surrogate. - */ -exports.ScalarValue = /[\uD800-\uDFFF]/; -/** - * A noncharacter is a code point that is in the range U+FDD0 to U+FDEF, - * inclusive, or U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, U+2FFFE, U+2FFFF, U+3FFFE, - * U+3FFFF, U+4FFFE, U+4FFFF, U+5FFFE, U+5FFFF, U+6FFFE, U+6FFFF, U+7FFFE, - * U+7FFFF, U+8FFFE, U+8FFFF, U+9FFFE, U+9FFFF, U+AFFFE, U+AFFFF, U+BFFFE, - * U+BFFFF, U+CFFFE, U+CFFFF, U+DFFFE, U+DFFFF, U+EFFFE, U+EFFFF, U+FFFFE, - * U+FFFFF, U+10FFFE, or U+10FFFF. - */ -exports.NonCharacter = /[\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]/; -/** - * An ASCII code point is a code point in the range U+0000 NULL to U+007F - * DELETE, inclusive. - */ -exports.ASCIICodePoint = /[\u0000-\u007F]/; -/** - * An ASCII tab or newline is U+0009 TAB, U+000A LF, or U+000D CR. - */ -exports.ASCIITabOrNewLine = /[\t\n\r]/; -/** - * ASCII whitespace is U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or - * U+0020 SPACE. - */ -exports.ASCIIWhiteSpace = /[\t\n\f\r ]/; -/** - * A C0 control is a code point in the range U+0000 NULL to U+001F - * INFORMATION SEPARATOR ONE, inclusive. - */ -exports.C0Control = /[\u0000-\u001F]/; -/** - * A C0 control or space is a C0 control or U+0020 SPACE. - */ -exports.C0ControlOrSpace = /[\u0000-\u001F ]/; -/** - * A control is a C0 control or a code point in the range U+007F DELETE to - * U+009F APPLICATION PROGRAM COMMAND, inclusive. - */ -exports.Control = /[\u0000-\u001F\u007F-\u009F]/; -/** - * An ASCII digit is a code point in the range U+0030 (0) to U+0039 (9), - * inclusive. - */ -exports.ASCIIDigit = /[0-9]/; -/** - * An ASCII upper hex digit is an ASCII digit or a code point in the range - * U+0041 (A) to U+0046 (F), inclusive. - */ -exports.ASCIIUpperHexDigit = /[0-9A-F]/; -/** - * An ASCII lower hex digit is an ASCII digit or a code point in the range - * U+0061 (a) to U+0066 (f), inclusive. - */ -exports.ASCIILowerHexDigit = /[0-9a-f]/; -/** - * An ASCII hex digit is an ASCII upper hex digit or ASCII lower hex digit. - */ -exports.ASCIIHexDigit = /[0-9A-Fa-f]/; -/** - * An ASCII upper alpha is a code point in the range U+0041 (A) to U+005A (Z), - * inclusive. - */ -exports.ASCIIUpperAlpha = /[A-Z]/; -/** - * An ASCII lower alpha is a code point in the range U+0061 (a) to U+007A (z), - * inclusive. - */ -exports.ASCIILowerAlpha = /[a-z]/; -/** - * An ASCII alpha is an ASCII upper alpha or ASCII lower alpha. - */ -exports.ASCIIAlpha = /[A-Za-z]/; -/** - * An ASCII alphanumeric is an ASCII digit or ASCII alpha. - */ -exports.ASCIIAlphanumeric = /[0-9A-Za-z]/; -//# sourceMappingURL=CodePoints.js.map + NamespacePrefixMap.prototype.set = function (prefix, ns) { + /** + * 1. Let candidates list be the result of retrieving a list from map where + * there exists a key in map that matches the value of ns or if there is + * no such key, then let candidates list be null. + */ + var candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); + /** + * 2. If candidates list is null, then create a new list with prefix as the + * only item in the list, and associate that list with a new key ns in map. + * 3. Otherwise, append prefix to the end of candidates list. + * + * _Note:_ The steps in retrieve a preferred prefix string use the list to + * track the most recently used (MRU) prefix associated with a given + * namespace, which will be the prefix at the end of the list. This list + * may contain duplicates of the same prefix value seen earlier + * (and that's OK). + */ + if (ns !== null && candidatesList === null) { + this._items[ns] = [prefix]; + } + else { + candidatesList.push(prefix); + } + }; + return NamespacePrefixMap; +}()); +exports.NamespacePrefixMap = NamespacePrefixMap; +//# sourceMappingURL=NamespacePrefixMap.js.map /***/ }), -/***/ 9387: +/***/ 85039: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -66810,23105 +66253,46714 @@ var __values = (this && this.__values) || function(o) { throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(6195); -/** - * Parses the given byte sequence representing a JSON string into an object. - * - * @param bytes - a byte sequence - */ -function parseJSONFromBytes(bytes) { - /** - * 1. Let jsonText be the result of running UTF-8 decode on bytes. [ENCODING] - * 2. Return ? Call(%JSONParse%, undefined, « jsonText »). - */ - var jsonText = util_1.utf8Decode(bytes); - return JSON.parse.call(undefined, jsonText); -} -exports.parseJSONFromBytes = parseJSONFromBytes; +var interfaces_1 = __nccwpck_require__(27305); +var LocalNameSet_1 = __nccwpck_require__(19049); +var NamespacePrefixMap_1 = __nccwpck_require__(90283); +var DOMException_1 = __nccwpck_require__(13166); +var infra_1 = __nccwpck_require__(84251); +var algorithm_1 = __nccwpck_require__(61); /** - * Serialize the given JavaScript value into a byte sequence. + * Represents an XML serializer. * - * @param value - a JavaScript value + * Implements: https://www.w3.org/TR/DOM-Parsing/#serializing */ -function serializeJSONToBytes(value) { +var XMLSerializerImpl = /** @class */ (function () { + function XMLSerializerImpl() { + } + /** @inheritdoc */ + XMLSerializerImpl.prototype.serializeToString = function (root) { + /** + * The serializeToString(root) method must produce an XML serialization + * of root passing a value of false for the require well-formed parameter, + * and return the result. + */ + return this._xmlSerialization(root, false); + }; /** - * 1. Let jsonString be ? Call(%JSONStringify%, undefined, « value »). - * 2. Return the result of running UTF-8 encode on jsonString. [ENCODING] + * Produces an XML serialization of the given node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance */ - var jsonString = JSON.stringify.call(undefined, value); - return util_1.utf8Encode(jsonString); -} -exports.serializeJSONToBytes = serializeJSONToBytes; -/** - * Parses the given JSON string into a Realm-independent JavaScript value. - * - * @param jsonText - a JSON string - */ -function parseJSONIntoInfraValues(jsonText) { + XMLSerializerImpl.prototype._xmlSerialization = function (node, requireWellFormed) { + // To increase performance, use a namespace-aware serializer only if the + // document has namespaced elements + if (node._nodeDocument === undefined || node._nodeDocument._hasNamespaces) { + /** From: https://w3c.github.io/DOM-Parsing/#xml-serialization + * + * 1. Let namespace be a context namespace with value null. + * The context namespace tracks the XML serialization algorithm's current + * default namespace. The context namespace is changed when either an Element + * Node has a default namespace declaration, or the algorithm generates a + * default namespace declaration for the Element Node to match its own + * namespace. The algorithm assumes no namespace (null) to start. + * 2. Let prefix map be a new namespace prefix map. + * 3. Add the XML namespace with prefix value "xml" to prefix map. + * 4. Let prefix index be a generated namespace prefix index with value 1. + * The generated namespace prefix index is used to generate a new unique + * prefix value when no suitable existing namespace prefix is available to + * serialize a node's namespaceURI (or the namespaceURI of one of node's + * attributes). See the generate a prefix algorithm. + */ + var namespace = null; + var prefixMap = new NamespacePrefixMap_1.NamespacePrefixMap(); + prefixMap.set("xml", infra_1.namespace.XML); + var prefixIndex = { value: 1 }; + /** + * 5. Return the result of running the XML serialization algorithm on node + * passing the context namespace namespace, namespace prefix map prefix map, + * generated namespace prefix index reference to prefix index, and the + * flag require well-formed. If an exception occurs during the execution + * of the algorithm, then catch that exception and throw an + * "InvalidStateError" DOMException. + */ + try { + return this._serializeNodeNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); + } + catch (_a) { + throw new DOMException_1.InvalidStateError(); + } + } + else { + try { + return this._serializeNode(node, requireWellFormed); + } + catch (_b) { + throw new DOMException_1.InvalidStateError(); + } + } + }; /** - * 1. Let jsValue be ? Call(%JSONParse%, undefined, « jsonText »). - * 2. Return the result of converting a JSON-derived JavaScript value to an - * Infra value, given jsValue. + * Produces an XML serialization of a node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance */ - var jsValue = JSON.parse.call(undefined, jsonText); - return convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValue); -} -exports.parseJSONIntoInfraValues = parseJSONIntoInfraValues; -/** - * Parses the value into a Realm-independent JavaScript value. - * - * @param jsValue - a JavaScript value - */ -function convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValue) { - var e_1, _a; + XMLSerializerImpl.prototype._serializeNodeNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { + switch (node.nodeType) { + case interfaces_1.NodeType.Element: + return this._serializeElementNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); + case interfaces_1.NodeType.Document: + return this._serializeDocumentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); + case interfaces_1.NodeType.Comment: + return this._serializeComment(node, requireWellFormed); + case interfaces_1.NodeType.Text: + return this._serializeText(node, requireWellFormed); + case interfaces_1.NodeType.DocumentFragment: + return this._serializeDocumentFragmentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); + case interfaces_1.NodeType.DocumentType: + return this._serializeDocumentType(node, requireWellFormed); + case interfaces_1.NodeType.ProcessingInstruction: + return this._serializeProcessingInstruction(node, requireWellFormed); + case interfaces_1.NodeType.CData: + return this._serializeCData(node, requireWellFormed); + default: + throw new Error("Unknown node type: " + node.nodeType); + } + }; /** - * 1. If Type(jsValue) is Null, String, or Number, then return jsValue. + * Produces an XML serialization of a node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance */ - if (jsValue === null || util_1.isString(jsValue) || util_1.isNumber(jsValue)) - return jsValue; + XMLSerializerImpl.prototype._serializeNode = function (node, requireWellFormed) { + switch (node.nodeType) { + case interfaces_1.NodeType.Element: + return this._serializeElement(node, requireWellFormed); + case interfaces_1.NodeType.Document: + return this._serializeDocument(node, requireWellFormed); + case interfaces_1.NodeType.Comment: + return this._serializeComment(node, requireWellFormed); + case interfaces_1.NodeType.Text: + return this._serializeText(node, requireWellFormed); + case interfaces_1.NodeType.DocumentFragment: + return this._serializeDocumentFragment(node, requireWellFormed); + case interfaces_1.NodeType.DocumentType: + return this._serializeDocumentType(node, requireWellFormed); + case interfaces_1.NodeType.ProcessingInstruction: + return this._serializeProcessingInstruction(node, requireWellFormed); + case interfaces_1.NodeType.CData: + return this._serializeCData(node, requireWellFormed); + default: + throw new Error("Unknown node type: " + node.nodeType); + } + }; /** - * 2. If IsArray(jsValue) is true, then: - * 2.1. Let result be an empty list. - * 2.2. Let length be ! ToLength(! Get(jsValue, "length")). - * 2.3. For each index of the range 0 to length − 1, inclusive: - * 2.3.1. Let indexName be ! ToString(index). - * 2.3.2. Let jsValueAtIndex be ! Get(jsValue, indexName). - * 2.3.3. Let infraValueAtIndex be the result of converting a JSON-derived - * JavaScript value to an Infra value, given jsValueAtIndex. - * 2.3.4. Append infraValueAtIndex to result. - * 2.8. Return result. + * Produces an XML serialization of an element node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance */ - if (util_1.isArray(jsValue)) { - var result = new Array(); - try { - for (var jsValue_1 = __values(jsValue), jsValue_1_1 = jsValue_1.next(); !jsValue_1_1.done; jsValue_1_1 = jsValue_1.next()) { - var jsValueAtIndex = jsValue_1_1.value; - result.push(convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValueAtIndex)); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (jsValue_1_1 && !jsValue_1_1.done && (_a = jsValue_1.return)) _a.call(jsValue_1); - } - finally { if (e_1) throw e_1.error; } - } - return result; - } - else if (util_1.isObject(jsValue)) { + XMLSerializerImpl.prototype._serializeElementNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { + var e_1, _a; /** - * 3. Let result be an empty ordered map. - * 4. For each key of ! jsValue.[[OwnPropertyKeys]](): - * 4.1. Let jsValueAtKey be ! Get(jsValue, key). - * 4.2. Let infraValueAtKey be the result of converting a JSON-derived - * JavaScript value to an Infra value, given jsValueAtKey. - * 4.3. Set result[key] to infraValueAtKey. - * 5. Return result. + * From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node + * + * 1. If the require well-formed flag is set (its value is true), and this + * node's localName attribute contains the character ":" (U+003A COLON) or + * does not match the XML Name production, then throw an exception; the + * serialization of this node would not be a well-formed element. */ - var result = new Map(); - for (var key in jsValue) { - /* istanbul ignore else */ - if (jsValue.hasOwnProperty(key)) { - var jsValueAtKey = jsValue[key]; - result.set(key, convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValueAtKey)); - } + if (requireWellFormed && (node.localName.indexOf(":") !== -1 || + !algorithm_1.xml_isName(node.localName))) { + throw new Error("Node local name contains invalid characters (well-formed required)."); } - return result; - } - /* istanbul ignore next */ - return jsValue; -} -exports.convertAJSONDerivedJavaScriptValueToAnInfraValue = convertAJSONDerivedJavaScriptValueToAnInfraValue; -//# sourceMappingURL=JSON.js.map - -/***/ }), - -/***/ 340: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; + /** + * 2. Let markup be the string "<" (U+003C LESS-THAN SIGN). + * 3. Let qualified name be an empty string. + * 4. Let skip end tag be a boolean flag with value false. + * 5. Let ignore namespace definition attribute be a boolean flag with value + * false. + * 6. Given prefix map, copy a namespace prefix map and let map be the + * result. + * 7. Let local prefixes map be an empty map. The map has unique Node prefix + * strings as its keys, with corresponding namespaceURI Node values as the + * map's key values (in this map, the null namespace is represented by the + * empty string). + * + * _Note:_ This map is local to each element. It is used to ensure there + * are no conflicting prefixes should a new namespace prefix attribute need + * to be generated. It is also used to enable skipping of duplicate prefix + * definitions when writing an element's attributes: the map allows the + * algorithm to distinguish between a prefix in the namespace prefix map + * that might be locally-defined (to the current Element) and one that is + * not. + * 8. Let local default namespace be the result of recording the namespace + * information for node given map and local prefixes map. + * + * _Note:_ The above step will update map with any found namespace prefix + * definitions, add the found prefix definitions to the local prefixes map + * and return a local default namespace value defined by a default namespace + * attribute if one exists. Otherwise it returns null. + * 9. Let inherited ns be a copy of namespace. + * 10. Let ns be the value of node's namespaceURI attribute. + */ + var markup = "<"; + var qualifiedName = ''; + var skipEndTag = false; + var ignoreNamespaceDefinitionAttribute = false; + var map = prefixMap.copy(); + var localPrefixesMap = {}; + var localDefaultNamespace = this._recordNamespaceInformation(node, map, localPrefixesMap); + var inheritedNS = namespace; + var ns = node.namespaceURI; + /** 11. If inherited ns is equal to ns, then: */ + if (inheritedNS === ns) { + /** + * 11.1. If local default namespace is not null, then set ignore + * namespace definition attribute to true. + */ + if (localDefaultNamespace !== null) { + ignoreNamespaceDefinitionAttribute = true; } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; + /** + * 11.2. If ns is the XML namespace, then append to qualified name the + * concatenation of the string "xml:" and the value of node's localName. + * 11.3. Otherwise, append to qualified name the value of node's + * localName. The node's prefix if it exists, is dropped. + */ + if (ns === infra_1.namespace.XML) { + qualifiedName = 'xml:' + node.localName; + } + else { + qualifiedName = node.localName; + } + /** 11.4. Append the value of qualified name to markup. */ + markup += qualifiedName; } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(6195); -/** - * Adds the given item to the end of the list. - * - * @param list - a list - * @param item - an item - */ -function append(list, item) { - list.push(item); -} -exports.append = append; -/** - * Extends a list by appending all items from another list. - * - * @param listA - a list to extend - * @param listB - a list containing items to append to `listA` - */ -function extend(listA, listB) { - listA.push.apply(listA, __spread(listB)); -} -exports.extend = extend; -/** - * Inserts the given item to the start of the list. - * - * @param list - a list - * @param item - an item - */ -function prepend(list, item) { - list.unshift(item); -} -exports.prepend = prepend; -/** - * Replaces the given item or all items matching condition with a new item. - * - * @param list - a list - * @param conditionOrItem - an item to replace or a condition matching items - * to replace - * @param item - an item - */ -function replace(list, conditionOrItem, newItem) { - var e_1, _a; - var i = 0; - try { - for (var list_1 = __values(list), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) { - var oldItem = list_1_1.value; - if (util_1.isFunction(conditionOrItem)) { - if (!!conditionOrItem.call(null, oldItem)) { - list[i] = newItem; + else { + /** + * 12. Otherwise, inherited ns is not equal to ns (the node's own + * namespace is different from the context namespace of its parent). + * Run these sub-steps: + * + * 12.1. Let prefix be the value of node's prefix attribute. + * 12.2. Let candidate prefix be the result of retrieving a preferred + * prefix string prefix from map given namespace ns. The above may return + * null if no namespace key ns exists in map. + */ + var prefix = node.prefix; + /** + * We don't need to run "retrieving a preferred prefix string" algorithm if + * the element has no prefix and its namespace matches to the default + * namespace. + * See: https://github.com/web-platform-tests/wpt/pull/16703 + */ + var candidatePrefix = null; + if (prefix !== null || ns !== localDefaultNamespace) { + candidatePrefix = map.get(prefix, ns); + } + /** + * 12.3. If the value of prefix matches "xmlns", then run the following + * steps: + */ + if (prefix === "xmlns") { + /** + * 12.3.1. If the require well-formed flag is set, then throw an error. + * An Element with prefix "xmlns" will not legally round-trip in a + * conforming XML parser. + */ + if (requireWellFormed) { + throw new Error("An element cannot have the 'xmlns' prefix (well-formed required)."); } + /** + * 12.3.2. Let candidate prefix be the value of prefix. + */ + candidatePrefix = prefix; } - else if (oldItem === conditionOrItem) { - list[i] = newItem; - return; + /** + * 12.4.Found a suitable namespace prefix: if candidate prefix is not + * null (a namespace prefix is defined which maps to ns), then: + */ + if (candidatePrefix !== null) { + /** + * The following may serialize a different prefix than the Element's + * existing prefix if it already had one. However, the retrieving a + * preferred prefix string algorithm already tried to match the + * existing prefix if possible. + * + * 12.4.1. Append to qualified name the concatenation of candidate + * prefix, ":" (U+003A COLON), and node's localName. There exists on + * this node or the node's ancestry a namespace prefix definition that + * defines the node's namespace. + * 12.4.2. If the local default namespace is not null (there exists a + * locally-defined default namespace declaration attribute) and its + * value is not the XML namespace, then let inherited ns get the value + * of local default namespace unless the local default namespace is the + * empty string in which case let it get null (the context namespace + * is changed to the declared default, rather than this node's own + * namespace). + * + * _Note:_ Any default namespace definitions or namespace prefixes that + * define the XML namespace are omitted when serializing this node's + * attributes. + */ + qualifiedName = candidatePrefix + ':' + node.localName; + if (localDefaultNamespace !== null && localDefaultNamespace !== infra_1.namespace.XML) { + inheritedNS = localDefaultNamespace || null; + } + /** + * 12.4.3. Append the value of qualified name to markup. + */ + markup += qualifiedName; + /** 12.5. Otherwise, if prefix is not null, then: */ + } + else if (prefix !== null) { + /** + * _Note:_ By this step, there is no namespace or prefix mapping + * declaration in this node (or any parent node visited by this + * algorithm) that defines prefix otherwise the step labelled Found + * a suitable namespace prefix would have been followed. The sub-steps + * that follow will create a new namespace prefix declaration for prefix + * and ensure that prefix does not conflict with an existing namespace + * prefix declaration of the same localName in node's attribute list. + * + * 12.5.1. If the local prefixes map contains a key matching prefix, + * then let prefix be the result of generating a prefix providing as + * input map, ns, and prefix index. + */ + if (prefix in localPrefixesMap) { + prefix = this._generatePrefix(ns, map, prefixIndex); + } + /** + * 12.5.2. Add prefix to map given namespace ns. + * 12.5.3. Append to qualified name the concatenation of prefix, ":" + * (U+003A COLON), and node's localName. + * 12.5.4. Append the value of qualified name to markup. + */ + map.set(prefix, ns); + qualifiedName += prefix + ':' + node.localName; + markup += qualifiedName; + /** + * 12.5.5. Append the following to markup, in the order listed: + * + * _Note:_ The following serializes a namespace prefix declaration for + * prefix which was just added to the map. + * + * 12.5.5.1. " " (U+0020 SPACE); + * 12.5.5.2. The string "xmlns:"; + * 12.5.5.3. The value of prefix; + * 12.5.5.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 12.5.5.5. The result of serializing an attribute value given ns and + * the require well-formed flag as input; + * 12.5.5.6. """ (U+0022 QUOTATION MARK). + */ + markup += " xmlns:" + prefix + "=\"" + + this._serializeAttributeValue(ns, requireWellFormed) + "\""; + /** + * 12.5.5.7. If local default namespace is not null (there exists a + * locally-defined default namespace declaration attribute), then + * let inherited ns get the value of local default namespace unless the + * local default namespace is the empty string in which case let it get + * null. + */ + if (localDefaultNamespace !== null) { + inheritedNS = localDefaultNamespace || null; + } + /** + * 12.6. Otherwise, if local default namespace is null, or local + * default namespace is not null and its value is not equal to ns, then: + */ + } + else if (localDefaultNamespace === null || + (localDefaultNamespace !== null && localDefaultNamespace !== ns)) { + /** + * _Note:_ At this point, the namespace for this node still needs to be + * serialized, but there's no prefix (or candidate prefix) available; the + * following uses the default namespace declaration to define the + * namespace--optionally replacing an existing default declaration + * if present. + * + * 12.6.1. Set the ignore namespace definition attribute flag to true. + * 12.6.2. Append to qualified name the value of node's localName. + * 12.6.3. Let the value of inherited ns be ns. + * + * _Note:_ The new default namespace will be used in the serialization + * to define this node's namespace and act as the context namespace for + * its children. + */ + ignoreNamespaceDefinitionAttribute = true; + qualifiedName += node.localName; + inheritedNS = ns; + /** + * 12.6.4. Append the value of qualified name to markup. + */ + markup += qualifiedName; + /** + * 12.6.5. Append the following to markup, in the order listed: + * + * _Note:_ The following serializes the new (or replacement) default + * namespace definition. + * + * 12.6.5.1. " " (U+0020 SPACE); + * 12.6.5.2. The string "xmlns"; + * 12.6.5.3. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 12.6.5.4. The result of serializing an attribute value given ns + * and the require well-formed flag as input; + * 12.6.5.5. """ (U+0022 QUOTATION MARK). + */ + markup += " xmlns" + "=\"" + + this._serializeAttributeValue(ns, requireWellFormed) + "\""; + /** + * 12.7. Otherwise, the node has a local default namespace that matches + * ns. Append to qualified name the value of node's localName, let the + * value of inherited ns be ns, and append the value of qualified name + * to markup. + */ + } + else { + qualifiedName += node.localName; + inheritedNS = ns; + markup += qualifiedName; } - i++; } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (list_1_1 && !list_1_1.done && (_a = list_1.return)) _a.call(list_1); + /** + * 13. Append to markup the result of the XML serialization of node's + * attributes given map, prefix index, local prefixes map, ignore namespace + * definition attribute flag, and require well-formed flag. + */ + markup += this._serializeAttributesNS(node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed); + /** + * 14. If ns is the HTML namespace, and the node's list of children is + * empty, and the node's localName matches any one of the following void + * elements: "area", "base", "basefont", "bgsound", "br", "col", "embed", + * "frame", "hr", "img", "input", "keygen", "link", "menuitem", "meta", + * "param", "source", "track", "wbr"; then append the following to markup, + * in the order listed: + * 14.1. " " (U+0020 SPACE); + * 14.2. "/" (U+002F SOLIDUS). + * and set the skip end tag flag to true. + * 15. If ns is not the HTML namespace, and the node's list of children is + * empty, then append "/" (U+002F SOLIDUS) to markup and set the skip end + * tag flag to true. + * 16. Append ">" (U+003E GREATER-THAN SIGN) to markup. + */ + var isHTML = (ns === infra_1.namespace.HTML); + if (isHTML && node.childNodes.length === 0 && + XMLSerializerImpl._VoidElementNames.has(node.localName)) { + markup += " /"; + skipEndTag = true; } - finally { if (e_1) throw e_1.error; } - } -} -exports.replace = replace; -/** - * Inserts the given item before the given index. - * - * @param list - a list - * @param item - an item - */ -function insert(list, item, index) { - list.splice(index, 0, item); -} -exports.insert = insert; -/** - * Removes the given item or all items matching condition. - * - * @param list - a list - * @param conditionOrItem - an item to remove or a condition matching items - * to remove - */ -function remove(list, conditionOrItem) { - var i = list.length; - while (i--) { - var oldItem = list[i]; - if (util_1.isFunction(conditionOrItem)) { - if (!!conditionOrItem.call(null, oldItem)) { - list.splice(i, 1); - } + else if (!isHTML && node.childNodes.length === 0) { + markup += "/"; + skipEndTag = true; } - else if (oldItem === conditionOrItem) { - list.splice(i, 1); - return; + markup += ">"; + /** + * 17. If the value of skip end tag is true, then return the value of markup + * and skip the remaining steps. The node is a leaf-node. + */ + if (skipEndTag) + return markup; + /** + * 18. If ns is the HTML namespace, and the node's localName matches the + * string "template", then this is a template element. Append to markup the + * result of XML serializing a DocumentFragment node given the template + * element's template contents (a DocumentFragment), providing inherited + * ns, map, prefix index, and the require well-formed flag. + * + * _Note:_ This allows template content to round-trip, given the rules for + * parsing XHTML documents. + * + * 19. Otherwise, append to markup the result of running the XML + * serialization algorithm on each of node's children, in tree order, + * providing inherited ns, map, prefix index, and the require well-formed + * flag. + */ + if (isHTML && node.localName === "template") { + // TODO: serialize template contents } - } -} -exports.remove = remove; -/** - * Removes all items from the list. - */ -function empty(list) { - list.length = 0; -} -exports.empty = empty; -/** - * Determines if the list contains the given item or any items matching - * condition. - * - * @param list - a list - * @param conditionOrItem - an item to a condition to match - */ -function contains(list, conditionOrItem) { - var e_2, _a; - try { - for (var list_2 = __values(list), list_2_1 = list_2.next(); !list_2_1.done; list_2_1 = list_2.next()) { - var oldItem = list_2_1.value; - if (util_1.isFunction(conditionOrItem)) { - if (!!conditionOrItem.call(null, oldItem)) { - return true; + else { + try { + for (var _b = __values(node._children || node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + markup += this._serializeNodeNS(childNode, inheritedNS, map, prefixIndex, requireWellFormed); } } - else if (oldItem === conditionOrItem) { - return true; + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } } } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (list_2_1 && !list_2_1.done && (_a = list_2.return)) _a.call(list_2); - } - finally { if (e_2) throw e_2.error; } - } - return false; -} -exports.contains = contains; -/** - * Returns the count of items in the list matching the given condition. - * - * @param list - a list - * @param condition - an optional condition to match - */ -function size(list, condition) { - var e_3, _a; - if (condition === undefined) { - return list.length; - } - else { - var count = 0; - try { - for (var list_3 = __values(list), list_3_1 = list_3.next(); !list_3_1.done; list_3_1 = list_3.next()) { - var item = list_3_1.value; - if (!!condition.call(null, item)) { - count++; - } - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (list_3_1 && !list_3_1.done && (_a = list_3.return)) _a.call(list_3); - } - finally { if (e_3) throw e_3.error; } - } - return count; - } -} -exports.size = size; -/** - * Determines if the list is empty. - * - * @param list - a list - */ -function isEmpty(list) { - return list.length === 0; -} -exports.isEmpty = isEmpty; -/** - * Returns an iterator for the items of the list. - * - * @param list - a list - * @param condition - an optional condition to match - */ -function forEach(list, condition) { - var list_4, list_4_1, item, e_4_1; - var e_4, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!(condition === undefined)) return [3 /*break*/, 2]; - return [5 /*yield**/, __values(list)]; - case 1: - _b.sent(); - return [3 /*break*/, 9]; - case 2: - _b.trys.push([2, 7, 8, 9]); - list_4 = __values(list), list_4_1 = list_4.next(); - _b.label = 3; - case 3: - if (!!list_4_1.done) return [3 /*break*/, 6]; - item = list_4_1.value; - if (!!!condition.call(null, item)) return [3 /*break*/, 5]; - return [4 /*yield*/, item]; - case 4: - _b.sent(); - _b.label = 5; - case 5: - list_4_1 = list_4.next(); - return [3 /*break*/, 3]; - case 6: return [3 /*break*/, 9]; - case 7: - e_4_1 = _b.sent(); - e_4 = { error: e_4_1 }; - return [3 /*break*/, 9]; - case 8: - try { - if (list_4_1 && !list_4_1.done && (_a = list_4.return)) _a.call(list_4); - } - finally { if (e_4) throw e_4.error; } - return [7 /*endfinally*/]; - case 9: return [2 /*return*/]; - } - }); -} -exports.forEach = forEach; -/** - * Creates and returns a shallow clone of list. - * - * @param list - a list - */ -function clone(list) { - return new (Array.bind.apply(Array, __spread([void 0], list)))(); -} -exports.clone = clone; -/** - * Returns a new list containing items from the list sorted in ascending - * order. - * - * @param list - a list - * @param lessThanAlgo - a function that returns `true` if its first argument - * is less than its second argument, and `false` otherwise. - */ -function sortInAscendingOrder(list, lessThanAlgo) { - return list.sort(function (itemA, itemB) { - return lessThanAlgo.call(null, itemA, itemB) ? -1 : 1; - }); -} -exports.sortInAscendingOrder = sortInAscendingOrder; -/** - * Returns a new list containing items from the list sorted in descending - * order. - * - * @param list - a list - * @param lessThanAlgo - a function that returns `true` if its first argument - * is less than its second argument, and `false` otherwise. - */ -function sortInDescendingOrder(list, lessThanAlgo) { - return list.sort(function (itemA, itemB) { - return lessThanAlgo.call(null, itemA, itemB) ? 1 : -1; - }); -} -exports.sortInDescendingOrder = sortInDescendingOrder; -//# sourceMappingURL=List.js.map - -/***/ }), - -/***/ 2298: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } + /** + * 20. Append the following to markup, in the order listed: + * 20.1. "" (U+003E GREATER-THAN SIGN). + */ + markup += ""; + /** + * 21. Return the value of markup. + */ + return markup; }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(6195); -/** - * Gets the value corresponding to the given key. - * - * @param map - a map - * @param key - a key - */ -function get(map, key) { - return map.get(key); -} -exports.get = get; -/** - * Sets the value corresponding to the given key. - * - * @param map - a map - * @param key - a key - * @param val - a value - */ -function set(map, key, val) { - map.set(key, val); -} -exports.set = set; -/** - * Removes the item with the given key or all items matching condition. - * - * @param map - a map - * @param conditionOrItem - the key of an item to remove or a condition matching - * items to remove - */ -function remove(map, conditionOrItem) { - var e_1, _a, e_2, _b; - if (!util_1.isFunction(conditionOrItem)) { - map.delete(conditionOrItem); - } - else { - var toRemove = []; - try { - for (var map_1 = __values(map), map_1_1 = map_1.next(); !map_1_1.done; map_1_1 = map_1.next()) { - var item = map_1_1.value; - if (!!conditionOrItem.call(null, item)) { - toRemove.push(item[0]); - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (map_1_1 && !map_1_1.done && (_a = map_1.return)) _a.call(map_1); - } - finally { if (e_1) throw e_1.error; } + /** + * Produces an XML serialization of a document node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeDocumentNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { + var e_2, _a; + /** + * If the require well-formed flag is set (its value is true), and this node + * has no documentElement (the documentElement attribute's value is null), + * then throw an exception; the serialization of this node would not be a + * well-formed document. + */ + if (requireWellFormed && node.documentElement === null) { + throw new Error("Missing document element (well-formed required)."); } + /** + * Otherwise, run the following steps: + * 1. Let serialized document be an empty string. + * 2. For each child child of node, in tree order, run the XML + * serialization algorithm on the child passing along the provided + * arguments, and append the result to serialized document. + * + * _Note:_ This will serialize any number of ProcessingInstruction and + * Comment nodes both before and after the Document's documentElement node, + * including at most one DocumentType node. (Text nodes are not allowed as + * children of the Document.) + * + * 3. Return the value of serialized document. + */ + var serializedDocument = ""; try { - for (var toRemove_1 = __values(toRemove), toRemove_1_1 = toRemove_1.next(); !toRemove_1_1.done; toRemove_1_1 = toRemove_1.next()) { - var key = toRemove_1_1.value; - map.delete(key); + for (var _b = __values(node._children || node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + serializedDocument += this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { - if (toRemove_1_1 && !toRemove_1_1.done && (_b = toRemove_1.return)) _b.call(toRemove_1); + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_2) throw e_2.error; } } - } -} -exports.remove = remove; -/** - * Determines if the map contains a value with the given key. - * - * @param map - a map - * @param conditionOrItem - the key of an item to match or a condition matching - * items - */ -function contains(map, conditionOrItem) { - var e_3, _a; - if (!util_1.isFunction(conditionOrItem)) { - return map.has(conditionOrItem); - } - else { + return serializedDocument; + }; + /** + * Produces an XML serialization of a comment node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeComment = function (node, requireWellFormed) { + /** + * If the require well-formed flag is set (its value is true), and node's + * data contains characters that are not matched by the XML Char production + * or contains "--" (two adjacent U+002D HYPHEN-MINUS characters) or that + * ends with a "-" (U+002D HYPHEN-MINUS) character, then throw an exception; + * the serialization of this node's data would not be well-formed. + */ + if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data) || + node.data.indexOf("--") !== -1 || node.data.endsWith("-"))) { + throw new Error("Comment data contains invalid characters (well-formed required)."); + } + /** + * Otherwise, return the concatenation of "". + */ + return ""; + }; + /** + * Produces an XML serialization of a text node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + * @param level - current depth of the XML tree + */ + XMLSerializerImpl.prototype._serializeText = function (node, requireWellFormed) { + /** + * 1. If the require well-formed flag is set (its value is true), and + * node's data contains characters that are not matched by the XML Char + * production, then throw an exception; the serialization of this node's + * data would not be well-formed. + */ + if (requireWellFormed && !algorithm_1.xml_isLegalChar(node.data)) { + throw new Error("Text data contains invalid characters (well-formed required)."); + } + /** + * 2. Let markup be the value of node's data. + * 3. Replace any occurrences of "&" in markup by "&". + * 4. Replace any occurrences of "<" in markup by "<". + * 5. Replace any occurrences of ">" in markup by ">". + * 6. Return the value of markup. + */ + var result = ""; + for (var i = 0; i < node.data.length; i++) { + var c = node.data[i]; + if (c === "&") + result += "&"; + else if (c === "<") + result += "<"; + else if (c === ">") + result += ">"; + else + result += c; + } + return result; + }; + /** + * Produces an XML serialization of a document fragment node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeDocumentFragmentNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { + var e_3, _a; + /** + * 1. Let markup the empty string. + * 2. For each child child of node, in tree order, run the XML serialization + * algorithm on the child given namespace, prefix map, a reference to prefix + * index, and flag require well-formed. Concatenate the result to markup. + * 3. Return the value of markup. + */ + var markup = ""; try { - for (var map_2 = __values(map), map_2_1 = map_2.next(); !map_2_1.done; map_2_1 = map_2.next()) { - var item = map_2_1.value; - if (!!conditionOrItem.call(null, item)) { - return true; - } + for (var _b = __values(node._children || node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + markup += this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { - if (map_2_1 && !map_2_1.done && (_a = map_2.return)) _a.call(map_2); + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_3) throw e_3.error; } } - return false; - } -} -exports.contains = contains; -/** - * Gets the keys of the map. - * - * @param map - a map - */ -function keys(map) { - return new Set(map.keys()); -} -exports.keys = keys; -/** - * Gets the values of the map. - * - * @param map - a map - */ -function values(map) { - return __spread(map.values()); -} -exports.values = values; -/** - * Gets the size of the map. - * - * @param map - a map - * @param condition - an optional condition to match - */ -function size(map, condition) { - var e_4, _a; - if (condition === undefined) { - return map.size; - } - else { - var count = 0; - try { - for (var map_3 = __values(map), map_3_1 = map_3.next(); !map_3_1.done; map_3_1 = map_3.next()) { - var item = map_3_1.value; - if (!!condition.call(null, item)) { - count++; - } - } + return markup; + }; + /** + * Produces an XML serialization of a document type node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeDocumentType = function (node, requireWellFormed) { + /** + * 1. If the require well-formed flag is true and the node's publicId + * attribute contains characters that are not matched by the XML PubidChar + * production, then throw an exception; the serialization of this node + * would not be a well-formed document type declaration. + */ + if (requireWellFormed && !algorithm_1.xml_isPubidChar(node.publicId)) { + throw new Error("DocType public identifier does not match PubidChar construct (well-formed required)."); } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (map_3_1 && !map_3_1.done && (_a = map_3.return)) _a.call(map_3); - } - finally { if (e_4) throw e_4.error; } - } - return count; - } -} -exports.size = size; -/** - * Determines if the map is empty. - * - * @param map - a map - */ -function isEmpty(map) { - return map.size === 0; -} -exports.isEmpty = isEmpty; -/** - * Returns an iterator for the items of the map. - * - * @param map - a map - * @param condition - an optional condition to match - */ -function forEach(map, condition) { - var map_4, map_4_1, item, e_5_1; - var e_5, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!(condition === undefined)) return [3 /*break*/, 2]; - return [5 /*yield**/, __values(map)]; - case 1: - _b.sent(); - return [3 /*break*/, 9]; - case 2: - _b.trys.push([2, 7, 8, 9]); - map_4 = __values(map), map_4_1 = map_4.next(); - _b.label = 3; - case 3: - if (!!map_4_1.done) return [3 /*break*/, 6]; - item = map_4_1.value; - if (!!!condition.call(null, item)) return [3 /*break*/, 5]; - return [4 /*yield*/, item]; - case 4: - _b.sent(); - _b.label = 5; - case 5: - map_4_1 = map_4.next(); - return [3 /*break*/, 3]; - case 6: return [3 /*break*/, 9]; - case 7: - e_5_1 = _b.sent(); - e_5 = { error: e_5_1 }; - return [3 /*break*/, 9]; - case 8: - try { - if (map_4_1 && !map_4_1.done && (_a = map_4.return)) _a.call(map_4); - } - finally { if (e_5) throw e_5.error; } - return [7 /*endfinally*/]; - case 9: return [2 /*return*/]; - } - }); -} -exports.forEach = forEach; -/** - * Creates and returns a shallow clone of map. - * - * @param map - a map - */ -function clone(map) { - return new Map(map); -} -exports.clone = clone; -/** - * Returns a new map containing items from the map sorted in ascending - * order. - * - * @param map - a map - * @param lessThanAlgo - a function that returns `true` if its first argument - * is less than its second argument, and `false` otherwise. - */ -function sortInAscendingOrder(map, lessThanAlgo) { - var list = new (Array.bind.apply(Array, __spread([void 0], map)))(); - list.sort(function (itemA, itemB) { - return lessThanAlgo.call(null, itemA, itemB) ? -1 : 1; - }); - return new Map(list); -} -exports.sortInAscendingOrder = sortInAscendingOrder; -/** - * Returns a new map containing items from the map sorted in descending - * order. - * - * @param map - a map - * @param lessThanAlgo - a function that returns `true` if its first argument - * is less than its second argument, and `false` otherwise. - */ -function sortInDescendingOrder(map, lessThanAlgo) { - var list = new (Array.bind.apply(Array, __spread([void 0], map)))(); - list.sort(function (itemA, itemB) { - return lessThanAlgo.call(null, itemA, itemB) ? 1 : -1; - }); - return new Map(list); -} -exports.sortInDescendingOrder = sortInDescendingOrder; -//# sourceMappingURL=Map.js.map - -/***/ }), - -/***/ 3764: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.HTML = "http://www.w3.org/1999/xhtml"; -exports.XML = "http://www.w3.org/XML/1998/namespace"; -exports.XMLNS = "http://www.w3.org/2000/xmlns/"; -exports.MathML = "http://www.w3.org/1998/Math/MathML"; -exports.SVG = "http://www.w3.org/2000/svg"; -exports.XLink = "http://www.w3.org/1999/xlink"; -//# sourceMappingURL=Namespace.js.map - -/***/ }), - -/***/ 9201: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -/** - * Appends the given item to the queue. - * - * @param list - a list - * @param item - an item - */ -function enqueue(list, item) { - list.push(item); -} -exports.enqueue = enqueue; -/** - * Removes and returns an item from the queue. - * - * @param list - a list - */ -function dequeue(list) { - return list.shift() || null; -} -exports.dequeue = dequeue; -//# sourceMappingURL=Queue.js.map - -/***/ }), - -/***/ 5931: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; + /** + * 2. If the require well-formed flag is true and the node's systemId + * attribute contains characters that are not matched by the XML Char + * production or that contains both a """ (U+0022 QUOTATION MARK) and a + * "'" (U+0027 APOSTROPHE), then throw an exception; the serialization + * of this node would not be a well-formed document type declaration. + */ + if (requireWellFormed && + (!algorithm_1.xml_isLegalChar(node.systemId) || + (node.systemId.indexOf('"') !== -1 && node.systemId.indexOf("'") !== -1))) { + throw new Error("DocType system identifier contains invalid characters (well-formed required)."); } + /** + * 3. Let markup be an empty string. + * 4. Append the string "" (U+003E GREATER-THAN SIGN) to markup. + * 11. Return the value of markup. + */ + return node.publicId && node.systemId ? + "" + : node.publicId ? + "" + : node.systemId ? + "" + : + ""; }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(6195); -/** - * Adds the given item to the end of the set. - * - * @param set - a set - * @param item - an item - */ -function append(set, item) { - set.add(item); -} -exports.append = append; -/** - * Extends a set by appending all items from another set. - * - * @param setA - a list to extend - * @param setB - a list containing items to append to `setA` - */ -function extend(setA, setB) { - setB.forEach(setA.add, setA); -} -exports.extend = extend; -/** - * Inserts the given item to the start of the set. - * - * @param set - a set - * @param item - an item - */ -function prepend(set, item) { - var cloned = new Set(set); - set.clear(); - set.add(item); - cloned.forEach(set.add, set); -} -exports.prepend = prepend; -/** - * Replaces the given item or all items matching condition with a new item. - * - * @param set - a set - * @param conditionOrItem - an item to replace or a condition matching items - * to replace - * @param item - an item - */ -function replace(set, conditionOrItem, newItem) { - var e_1, _a; - var newSet = new Set(); - try { - for (var set_1 = __values(set), set_1_1 = set_1.next(); !set_1_1.done; set_1_1 = set_1.next()) { - var oldItem = set_1_1.value; - if (util_1.isFunction(conditionOrItem)) { - if (!!conditionOrItem.call(null, oldItem)) { - newSet.add(newItem); - } - else { - newSet.add(oldItem); - } - } - else if (oldItem === conditionOrItem) { - newSet.add(newItem); - } - else { - newSet.add(oldItem); - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (set_1_1 && !set_1_1.done && (_a = set_1.return)) _a.call(set_1); - } - finally { if (e_1) throw e_1.error; } - } - set.clear(); - newSet.forEach(set.add, set); -} -exports.replace = replace; -/** - * Inserts the given item before the given index. - * - * @param set - a set - * @param item - an item - */ -function insert(set, item, index) { - var e_2, _a; - var newSet = new Set(); - var i = 0; - try { - for (var set_2 = __values(set), set_2_1 = set_2.next(); !set_2_1.done; set_2_1 = set_2.next()) { - var oldItem = set_2_1.value; - if (i === index) - newSet.add(item); - newSet.add(oldItem); - i++; - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (set_2_1 && !set_2_1.done && (_a = set_2.return)) _a.call(set_2); - } - finally { if (e_2) throw e_2.error; } - } - set.clear(); - newSet.forEach(set.add, set); -} -exports.insert = insert; -/** - * Removes the given item or all items matching condition. - * - * @param set - a set - * @param conditionOrItem - an item to remove or a condition matching items - * to remove - */ -function remove(set, conditionOrItem) { - var e_3, _a, e_4, _b; - if (!util_1.isFunction(conditionOrItem)) { - set.delete(conditionOrItem); - } - else { - var toRemove = []; - try { - for (var set_3 = __values(set), set_3_1 = set_3.next(); !set_3_1.done; set_3_1 = set_3.next()) { - var item = set_3_1.value; - if (!!conditionOrItem.call(null, item)) { - toRemove.push(item); - } - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (set_3_1 && !set_3_1.done && (_a = set_3.return)) _a.call(set_3); - } - finally { if (e_3) throw e_3.error; } + /** + * Produces an XML serialization of a processing instruction node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeProcessingInstruction = function (node, requireWellFormed) { + /** + * 1. If the require well-formed flag is set (its value is true), and node's + * target contains a ":" (U+003A COLON) character or is an ASCII + * case-insensitive match for the string "xml", then throw an exception; + * the serialization of this node's target would not be well-formed. + */ + if (requireWellFormed && (node.target.indexOf(":") !== -1 || (/^xml$/i).test(node.target))) { + throw new Error("Processing instruction target contains invalid characters (well-formed required)."); } - try { - for (var toRemove_1 = __values(toRemove), toRemove_1_1 = toRemove_1.next(); !toRemove_1_1.done; toRemove_1_1 = toRemove_1.next()) { - var oldItem = toRemove_1_1.value; - set.delete(oldItem); - } + /** + * 2. If the require well-formed flag is set (its value is true), and node's + * data contains characters that are not matched by the XML Char production + * or contains the string "?>" (U+003F QUESTION MARK, + * U+003E GREATER-THAN SIGN), then throw an exception; the serialization of + * this node's data would not be well-formed. + */ + if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data) || + node.data.indexOf("?>") !== -1)) { + throw new Error("Processing instruction data contains invalid characters (well-formed required)."); } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (toRemove_1_1 && !toRemove_1_1.done && (_b = toRemove_1.return)) _b.call(toRemove_1); - } - finally { if (e_4) throw e_4.error; } + /** + * 3. Let markup be the concatenation of the following, in the order listed: + * 3.1. "" (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN). + * 4. Return the value of markup. + */ + return ""; + }; + /** + * Produces an XML serialization of a CDATA node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeCData = function (node, requireWellFormed) { + if (requireWellFormed && (node.data.indexOf("]]>") !== -1)) { + throw new Error("CDATA contains invalid characters (well-formed required)."); } - } -} -exports.remove = remove; -/** - * Removes all items from the set. - */ -function empty(set) { - set.clear(); -} -exports.empty = empty; -/** - * Determines if the set contains the given item or any items matching - * condition. - * - * @param set - a set - * @param conditionOrItem - an item to a condition to match - */ -function contains(set, conditionOrItem) { - var e_5, _a; - if (!util_1.isFunction(conditionOrItem)) { - return set.has(conditionOrItem); - } - else { + return ""; + }; + /** + * Produces an XML serialization of the attributes of an element node. + * + * @param node - node to serialize + * @param map - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param localPrefixesMap - local prefixes map + * @param ignoreNamespaceDefinitionAttribute - whether to ignore namespace + * attributes + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeAttributesNS = function (node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed) { + var e_4, _a; + /** + * 1. Let result be the empty string. + * 2. Let localname set be a new empty namespace localname set. This + * localname set will contain tuples of unique attribute namespaceURI and + * localName pairs, and is populated as each attr is processed. This set is + * used to [optionally] enforce the well-formed constraint that an element + * cannot have two attributes with the same namespaceURI and localName. + * This can occur when two otherwise identical attributes on the same + * element differ only by their prefix values. + */ + var result = ""; + var localNameSet = requireWellFormed ? new LocalNameSet_1.LocalNameSet() : undefined; try { - for (var set_4 = __values(set), set_4_1 = set_4.next(); !set_4_1.done; set_4_1 = set_4.next()) { - var oldItem = set_4_1.value; - if (!!conditionOrItem.call(null, oldItem)) { - return true; + /** + * 3. Loop: For each attribute attr in element's attributes, in the order + * they are specified in the element's attribute list: + */ + for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { + var attr = _c.value; + // Optimize common case + if (!ignoreNamespaceDefinitionAttribute && !requireWellFormed && attr.namespaceURI === null) { + result += " " + attr.localName + "=\"" + + this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; + continue; } - } - } - catch (e_5_1) { e_5 = { error: e_5_1 }; } - finally { - try { - if (set_4_1 && !set_4_1.done && (_a = set_4.return)) _a.call(set_4); - } - finally { if (e_5) throw e_5.error; } - } - } - return false; -} -exports.contains = contains; -/** - * Returns the count of items in the set matching the given condition. - * - * @param set - a set - * @param condition - an optional condition to match - */ -function size(set, condition) { - var e_6, _a; - if (condition === undefined) { - return set.size; - } - else { - var count = 0; - try { - for (var set_5 = __values(set), set_5_1 = set_5.next(); !set_5_1.done; set_5_1 = set_5.next()) { - var item = set_5_1.value; - if (!!condition.call(null, item)) { - count++; + /** + * 3.1. If the require well-formed flag is set (its value is true), and the + * localname set contains a tuple whose values match those of a new tuple + * consisting of attr's namespaceURI attribute and localName attribute, + * then throw an exception; the serialization of this attr would fail to + * produce a well-formed element serialization. + */ + if (requireWellFormed && localNameSet && localNameSet.has(attr.namespaceURI, attr.localName)) { + throw new Error("Element contains duplicate attributes (well-formed required)."); } - } - } - catch (e_6_1) { e_6 = { error: e_6_1 }; } - finally { - try { - if (set_5_1 && !set_5_1.done && (_a = set_5.return)) _a.call(set_5); - } - finally { if (e_6) throw e_6.error; } - } - return count; - } -} -exports.size = size; -/** - * Determines if the set is empty. - * - * @param set - a set - */ -function isEmpty(set) { - return set.size === 0; -} -exports.isEmpty = isEmpty; -/** - * Returns an iterator for the items of the set. - * - * @param set - a set - * @param condition - an optional condition to match - */ -function forEach(set, condition) { - var set_6, set_6_1, item, e_7_1; - var e_7, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!(condition === undefined)) return [3 /*break*/, 2]; - return [5 /*yield**/, __values(set)]; - case 1: - _b.sent(); - return [3 /*break*/, 9]; - case 2: - _b.trys.push([2, 7, 8, 9]); - set_6 = __values(set), set_6_1 = set_6.next(); - _b.label = 3; - case 3: - if (!!set_6_1.done) return [3 /*break*/, 6]; - item = set_6_1.value; - if (!!!condition.call(null, item)) return [3 /*break*/, 5]; - return [4 /*yield*/, item]; - case 4: - _b.sent(); - _b.label = 5; - case 5: - set_6_1 = set_6.next(); - return [3 /*break*/, 3]; - case 6: return [3 /*break*/, 9]; - case 7: - e_7_1 = _b.sent(); - e_7 = { error: e_7_1 }; - return [3 /*break*/, 9]; - case 8: - try { - if (set_6_1 && !set_6_1.done && (_a = set_6.return)) _a.call(set_6); + /** + * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and + * localName attribute, and add it to the localname set. + * 3.3. Let attribute namespace be the value of attr's namespaceURI value. + * 3.4. Let candidate prefix be null. + */ + if (requireWellFormed && localNameSet) + localNameSet.set(attr.namespaceURI, attr.localName); + var attributeNamespace = attr.namespaceURI; + var candidatePrefix = null; + /** 3.5. If attribute namespace is not null, then run these sub-steps: */ + if (attributeNamespace !== null) { + /** + * 3.5.1. Let candidate prefix be the result of retrieving a preferred + * prefix string from map given namespace attribute namespace with + * preferred prefix being attr's prefix value. + */ + candidatePrefix = map.get(attr.prefix, attributeNamespace); + /** + * 3.5.2. If the value of attribute namespace is the XMLNS namespace, + * then run these steps: + */ + if (attributeNamespace === infra_1.namespace.XMLNS) { + /** + * 3.5.2.1. If any of the following are true, then stop running these + * steps and goto Loop to visit the next attribute: + * - the attr's value is the XML namespace; + * _Note:_ The XML namespace cannot be redeclared and survive + * round-tripping (unless it defines the prefix "xml"). To avoid this + * problem, this algorithm always prefixes elements in the XML + * namespace with "xml" and drops any related definitions as seen + * in the above condition. + * - the attr's prefix is null and the ignore namespace definition + * attribute flag is true (the Element's default namespace attribute + * should be skipped); + * - the attr's prefix is not null and either + * * the attr's localName is not a key contained in the local + * prefixes map, or + * * the attr's localName is present in the local prefixes map but + * the value of the key does not match attr's value + * and furthermore that the attr's localName (as the prefix to find) + * is found in the namespace prefix map given the namespace consisting + * of the attr's value (the current namespace prefix definition was + * exactly defined previously--on an ancestor element not the current + * element whose attributes are being processed). + */ + if (attr.value === infra_1.namespace.XML || + (attr.prefix === null && ignoreNamespaceDefinitionAttribute) || + (attr.prefix !== null && (!(attr.localName in localPrefixesMap) || + localPrefixesMap[attr.localName] !== attr.value) && + map.has(attr.localName, attr.value))) + continue; + /** + * 3.5.2.2. If the require well-formed flag is set (its value is true), + * and the value of attr's value attribute matches the XMLNS + * namespace, then throw an exception; the serialization of this + * attribute would produce invalid XML because the XMLNS namespace + * is reserved and cannot be applied as an element's namespace via + * XML parsing. + * + * _Note:_ DOM APIs do allow creation of elements in the XMLNS + * namespace but with strict qualifications. + */ + if (requireWellFormed && attr.value === infra_1.namespace.XMLNS) { + throw new Error("XMLNS namespace is reserved (well-formed required)."); + } + /** + * 3.5.2.3. If the require well-formed flag is set (its value is true), + * and the value of attr's value attribute is the empty string, then + * throw an exception; namespace prefix declarations cannot be used + * to undeclare a namespace (use a default namespace declaration + * instead). + */ + if (requireWellFormed && attr.value === '') { + throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."); + } + /** + * 3.5.2.4. the attr's prefix matches the string "xmlns", then let + * candidate prefix be the string "xmlns". + */ + if (attr.prefix === 'xmlns') + candidatePrefix = 'xmlns'; + /** + * 3.5.3. Otherwise, the attribute namespace is not the XMLNS namespace. + * Run these steps: + * + * _Note:_ The (candidatePrefix === null) check is not in the spec. + * We deviate from the spec here. Otherwise a prefix is generated for + * all attributes with namespaces. + */ + } + else if (candidatePrefix === null) { + if (attr.prefix !== null && + (!map.hasPrefix(attr.prefix) || + map.has(attr.prefix, attributeNamespace))) { + /** + * Check if we can use the attribute's own prefix. + * We deviate from the spec here. + * TODO: This is not an efficient way of searching for prefixes. + * Follow developments to the spec. + */ + candidatePrefix = attr.prefix; + } + else { + /** + * 3.5.3.1. Let candidate prefix be the result of generating a prefix + * providing map, attribute namespace, and prefix index as input. + */ + candidatePrefix = this._generatePrefix(attributeNamespace, map, prefixIndex); + } + /** + * 3.5.3.2. Append the following to result, in the order listed: + * 3.5.3.2.1. " " (U+0020 SPACE); + * 3.5.3.2.2. The string "xmlns:"; + * 3.5.3.2.3. The value of candidate prefix; + * 3.5.3.2.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 3.5.3.2.5. The result of serializing an attribute value given + * attribute namespace and the require well-formed flag as input; + * 3.5.3.2.6. """ (U+0022 QUOTATION MARK). + */ + result += " xmlns:" + candidatePrefix + "=\"" + + this._serializeAttributeValue(attributeNamespace, requireWellFormed) + "\""; + } } - finally { if (e_7) throw e_7.error; } - return [7 /*endfinally*/]; - case 9: return [2 /*return*/]; - } - }); -} -exports.forEach = forEach; -/** - * Creates and returns a shallow clone of set. - * - * @param set - a set - */ -function clone(set) { - return new Set(set); -} -exports.clone = clone; -/** - * Returns a new set containing items from the set sorted in ascending - * order. - * - * @param set - a set - * @param lessThanAlgo - a function that returns `true` if its first argument - * is less than its second argument, and `false` otherwise. - */ -function sortInAscendingOrder(set, lessThanAlgo) { - var list = new (Array.bind.apply(Array, __spread([void 0], set)))(); - list.sort(function (itemA, itemB) { - return lessThanAlgo.call(null, itemA, itemB) ? -1 : 1; - }); - return new Set(list); -} -exports.sortInAscendingOrder = sortInAscendingOrder; -/** - * Returns a new set containing items from the set sorted in descending - * order. - * - * @param set - a set - * @param lessThanAlgo - a function that returns `true` if its first argument - * is less than its second argument, and `false` otherwise. - */ -function sortInDescendingOrder(set, lessThanAlgo) { - var list = new (Array.bind.apply(Array, __spread([void 0], set)))(); - list.sort(function (itemA, itemB) { - return lessThanAlgo.call(null, itemA, itemB) ? 1 : -1; - }); - return new Set(list); -} -exports.sortInDescendingOrder = sortInDescendingOrder; -/** - * Determines if a set is a subset of another set. - * - * @param subset - a set - * @param superset - a superset possibly containing all items from `subset`. - */ -function isSubsetOf(subset, superset) { - var e_8, _a; - try { - for (var subset_1 = __values(subset), subset_1_1 = subset_1.next(); !subset_1_1.done; subset_1_1 = subset_1.next()) { - var item = subset_1_1.value; - if (!superset.has(item)) - return false; - } - } - catch (e_8_1) { e_8 = { error: e_8_1 }; } - finally { - try { - if (subset_1_1 && !subset_1_1.done && (_a = subset_1.return)) _a.call(subset_1); + /** + * 3.6. Append a " " (U+0020 SPACE) to result. + * 3.7. If candidate prefix is not null, then append to result the + * concatenation of candidate prefix with ":" (U+003A COLON). + */ + result += " "; + if (candidatePrefix !== null) { + result += candidatePrefix + ':'; + } + /** + * 3.8. If the require well-formed flag is set (its value is true), and + * this attr's localName attribute contains the character + * ":" (U+003A COLON) or does not match the XML Name production or + * equals "xmlns" and attribute namespace is null, then throw an + * exception; the serialization of this attr would not be a + * well-formed attribute. + */ + if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || + !algorithm_1.xml_isName(attr.localName) || + (attr.localName === "xmlns" && attributeNamespace === null))) { + throw new Error("Attribute local name contains invalid characters (well-formed required)."); + } + /** + * 3.9. Append the following strings to result, in the order listed: + * 3.9.1. The value of attr's localName; + * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 3.9.3. The result of serializing an attribute value given attr's value + * attribute and the require well-formed flag as input; + * 3.9.4. """ (U+0022 QUOTATION MARK). + */ + result += attr.localName + "=\"" + + this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; + } } - finally { if (e_8) throw e_8.error; } - } - return true; -} -exports.isSubsetOf = isSubsetOf; -/** - * Determines if a set is a superset of another set. - * - * @param superset - a set - * @param subset - a subset possibly contained within `superset`. - */ -function isSupersetOf(superset, subset) { - return isSubsetOf(subset, superset); -} -exports.isSupersetOf = isSupersetOf; -/** - * Returns a new set with items that are contained in both sets. - * - * @param setA - a set - * @param setB - a set - */ -function intersection(setA, setB) { - var e_9, _a; - var newSet = new Set(); - try { - for (var setA_1 = __values(setA), setA_1_1 = setA_1.next(); !setA_1_1.done; setA_1_1 = setA_1.next()) { - var item = setA_1_1.value; - if (setB.has(item)) - newSet.add(item); + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_4) throw e_4.error; } } - } - catch (e_9_1) { e_9 = { error: e_9_1 }; } - finally { + /** + * 4. Return the value of result. + */ + return result; + }; + /** + * Records namespace information for the given element and returns the + * default namespace attribute value. + * + * @param node - element node to process + * @param map - namespace prefix map + * @param localPrefixesMap - local prefixes map + */ + XMLSerializerImpl.prototype._recordNamespaceInformation = function (node, map, localPrefixesMap) { + var e_5, _a; + /** + * 1. Let default namespace attr value be null. + */ + var defaultNamespaceAttrValue = null; try { - if (setA_1_1 && !setA_1_1.done && (_a = setA_1.return)) _a.call(setA_1); + /** + * 2. Main: For each attribute attr in element's attributes, in the order + * they are specified in the element's attribute list: + */ + for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { + var attr = _c.value; + /** + * _Note:_ The following conditional steps find namespace prefixes. Only + * attributes in the XMLNS namespace are considered (e.g., attributes made + * to look like namespace declarations via + * setAttribute("xmlns:pretend-prefix", "pretend-namespace") are not + * included). + */ + /** 2.1. Let attribute namespace be the value of attr's namespaceURI value. */ + var attributeNamespace = attr.namespaceURI; + /** 2.2. Let attribute prefix be the value of attr's prefix. */ + var attributePrefix = attr.prefix; + /** 2.3. If the attribute namespace is the XMLNS namespace, then: */ + if (attributeNamespace === infra_1.namespace.XMLNS) { + /** + * 2.3.1. If attribute prefix is null, then attr is a default namespace + * declaration. Set the default namespace attr value to attr's value and + * stop running these steps, returning to Main to visit the next + * attribute. + */ + if (attributePrefix === null) { + defaultNamespaceAttrValue = attr.value; + continue; + /** + * 2.3.2. Otherwise, the attribute prefix is not null and attr is a + * namespace prefix definition. Run the following steps: + */ + } + else { + /** 2.3.2.1. Let prefix definition be the value of attr's localName. */ + var prefixDefinition = attr.localName; + /** 2.3.2.2. Let namespace definition be the value of attr's value. */ + var namespaceDefinition = attr.value; + /** + * 2.3.2.3. If namespace definition is the XML namespace, then stop + * running these steps, and return to Main to visit the next + * attribute. + * + * _Note:_ XML namespace definitions in prefixes are completely + * ignored (in order to avoid unnecessary work when there might be + * prefix conflicts). XML namespaced elements are always handled + * uniformly by prefixing (and overriding if necessary) the element's + * localname with the reserved "xml" prefix. + */ + if (namespaceDefinition === infra_1.namespace.XML) { + continue; + } + /** + * 2.3.2.4. If namespace definition is the empty string (the + * declarative form of having no namespace), then let namespace + * definition be null instead. + */ + if (namespaceDefinition === '') { + namespaceDefinition = null; + } + /** + * 2.3.2.5. If prefix definition is found in map given the namespace + * namespace definition, then stop running these steps, and return to + * Main to visit the next attribute. + * + * _Note:_ This step avoids adding duplicate prefix definitions for + * the same namespace in the map. This has the side-effect of avoiding + * later serialization of duplicate namespace prefix declarations in + * any descendant nodes. + */ + if (map.has(prefixDefinition, namespaceDefinition)) { + continue; + } + /** + * 2.3.2.6. Add the prefix prefix definition to map given namespace + * namespace definition. + */ + map.set(prefixDefinition, namespaceDefinition); + /** + * 2.3.2.7. Add the value of prefix definition as a new key to the + * local prefixes map, with the namespace definition as the key's + * value replacing the value of null with the empty string if + * applicable. + */ + localPrefixesMap[prefixDefinition] = namespaceDefinition || ''; + } + } + } } - finally { if (e_9) throw e_9.error; } - } - return newSet; -} -exports.intersection = intersection; -/** - * Returns a new set with items from both sets. - * - * @param setA - a set - * @param setB - a set - */ -function union(setA, setB) { - var newSet = new Set(setA); - setB.forEach(newSet.add, newSet); - return newSet; -} -exports.union = union; -/** - * Returns a set of integers from `n` to `m` inclusive. - * - * @param n - starting number - * @param m - ending number - */ -function range(n, m) { - var newSet = new Set(); - for (var i = n; i <= m; i++) { - newSet.add(i); - } - return newSet; -} -exports.range = range; -//# sourceMappingURL=Set.js.map - -/***/ }), - -/***/ 8784: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -/** - * Pushes the given item to the stack. - * - * @param list - a list - * @param item - an item - */ -function push(list, item) { - list.push(item); -} -exports.push = push; -/** - * Pops and returns an item from the stack. - * - * @param list - a list - */ -function pop(list) { - return list.pop() || null; -} -exports.pop = pop; -//# sourceMappingURL=Stack.js.map - -/***/ }), - -/***/ 3203: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; + catch (e_5_1) { e_5 = { error: e_5_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_5) throw e_5.error; } } + /** + * 3. Return the value of default namespace attr value. + * + * _Note:_ The empty string is a legitimate return value and is not + * converted to null. + */ + return defaultNamespaceAttrValue; }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var CodePoints_1 = __nccwpck_require__(8548); -var ByteSequence_1 = __nccwpck_require__(1627); -var Byte_1 = __nccwpck_require__(2460); -var util_1 = __nccwpck_require__(6195); -/** - * Determines if the string `a` is a code unit prefix of string `b`. - * - * @param a - a string - * @param b - a string - */ -function isCodeUnitPrefix(a, b) { - /** - * 1. Let i be 0. - * 2. While true: - * 2.1. Let aCodeUnit be the ith code unit of a if i is less than a’s length; - * otherwise null. - * 2.2. Let bCodeUnit be the ith code unit of b if i is less than b’s length; - * otherwise null. - * 2.3. If bCodeUnit is null, then return true. - * 2.4. Return false if aCodeUnit is different from bCodeUnit. - * 2.5. Set i to i + 1. - */ - var i = 0; - while (true) { - var aCodeUnit = i < a.length ? a.charCodeAt(i) : null; - var bCodeUnit = i < b.length ? b.charCodeAt(i) : null; - if (aCodeUnit === null) - return true; - if (aCodeUnit !== bCodeUnit) - return false; - i++; - } -} -exports.isCodeUnitPrefix = isCodeUnitPrefix; -/** - * Determines if the string `a` is a code unit less than string `b`. - * - * @param a - a string - * @param b - a string - */ -function isCodeUnitLessThan(a, b) { /** - * 1. If b is a code unit prefix of a, then return false. - * 2. If a is a code unit prefix of b, then return true. - * 3. Let n be the smallest index such that the nth code unit of a is - * different from the nth code unit of b. (There has to be such an index, - * since neither string is a prefix of the other.) - * 4. If the nth code unit of a is less than the nth code unit of b, then - * return true. - * 5. Return false. - */ - if (isCodeUnitPrefix(b, a)) - return false; - if (isCodeUnitPrefix(a, b)) - return true; - for (var i = 0; i < Math.min(a.length, b.length); i++) { - var aCodeUnit = a.charCodeAt(i); - var bCodeUnit = b.charCodeAt(i); - if (aCodeUnit === bCodeUnit) - continue; - return (aCodeUnit < bCodeUnit); - } - /* istanbul ignore next */ - return false; -} -exports.isCodeUnitLessThan = isCodeUnitLessThan; -/** - * Isomorphic encodes the given string. - * - * @param str - a string - */ -function isomorphicEncode(str) { - var e_1, _a; + * Generates a new prefix for the given namespace. + * + * @param newNamespace - a namespace to generate prefix for + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + */ + XMLSerializerImpl.prototype._generatePrefix = function (newNamespace, prefixMap, prefixIndex) { + /** + * 1. Let generated prefix be the concatenation of the string "ns" and the + * current numerical value of prefix index. + * 2. Let the value of prefix index be incremented by one. + * 3. Add to map the generated prefix given the new namespace namespace. + * 4. Return the value of generated prefix. + */ + var generatedPrefix = "ns" + prefixIndex.value; + prefixIndex.value++; + prefixMap.set(generatedPrefix, newNamespace); + return generatedPrefix; + }; /** - * 1. Assert: input contains no code points greater than U+00FF. - * 2. Return a byte sequence whose length is equal to input’s length and whose - * bytes have the same values as input’s code points, in the same order. + * Produces an XML serialization of an attribute value. + * + * @param value - attribute value + * @param requireWellFormed - whether to check conformance */ - var codePoints = Array.from(str); - var bytes = new Uint8Array(codePoints.length); - var i = 0; - try { - for (var str_1 = __values(str), str_1_1 = str_1.next(); !str_1_1.done; str_1_1 = str_1.next()) { - var codePoint = str_1_1.value; - var byte = codePoint.codePointAt(0); - console.assert(byte !== undefined && byte <= 0x00FF, "isomorphicEncode requires string bytes to be less than or equal to 0x00FF."); - if (byte !== undefined && byte <= 0x00FF) { - bytes[i++] = byte; - } + XMLSerializerImpl.prototype._serializeAttributeValue = function (value, requireWellFormed) { + /** + * From: https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value + * + * 1. If the require well-formed flag is set (its value is true), and + * attribute value contains characters that are not matched by the XML Char + * production, then throw an exception; the serialization of this attribute + * value would fail to produce a well-formed element serialization. + */ + if (requireWellFormed && value !== null && !algorithm_1.xml_isLegalChar(value)) { + throw new Error("Invalid characters in attribute value."); } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (str_1_1 && !str_1_1.done && (_a = str_1.return)) _a.call(str_1); + /** + * 2. If attribute value is null, then return the empty string. + */ + if (value === null) + return ""; + /** + * 3. Otherwise, attribute value is a string. Return the value of attribute + * value, first replacing any occurrences of the following: + * - "&" with "&" + * - """ with """ + * - "<" with "<" + * - ">" with ">" + * NOTE + * This matches behavior present in browsers, and goes above and beyond the + * grammar requirement in the XML specification's AttValue production by + * also replacing ">" characters. + */ + var result = ""; + for (var i = 0; i < value.length; i++) { + var c = value[i]; + if (c === "\"") + result += """; + else if (c === "&") + result += "&"; + else if (c === "<") + result += "<"; + else if (c === ">") + result += ">"; + else + result += c; } - finally { if (e_1) throw e_1.error; } - } - return bytes; -} -exports.isomorphicEncode = isomorphicEncode; -/** - * Determines if the given string is An ASCII string. - * - * @param str - a string - */ -function isASCIIString(str) { - /** - * An ASCII string is a string whose code points are all ASCII code points. - */ - return /^[\u0000-\u007F]*$/.test(str); -} -exports.isASCIIString = isASCIIString; -/** - * Converts all uppercase ASCII code points to lowercase. - * - * @param str - a string - */ -function asciiLowercase(str) { - var e_2, _a; + return result; + }; /** - * To ASCII lowercase a string, replace all ASCII upper alphas in the string - * with their corresponding code point in ASCII lower alpha. + * Produces an XML serialization of an element node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance */ - var result = ""; - try { - for (var str_2 = __values(str), str_2_1 = str_2.next(); !str_2_1.done; str_2_1 = str_2.next()) { - var c = str_2_1.value; - var code = c.codePointAt(0); - if (code !== undefined && code >= 0x41 && code <= 0x5A) { - result += String.fromCodePoint(code + 0x20); - } - else { - result += c; - } + XMLSerializerImpl.prototype._serializeElement = function (node, requireWellFormed) { + var e_6, _a; + /** + * From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node + * + * 1. If the require well-formed flag is set (its value is true), and this + * node's localName attribute contains the character ":" (U+003A COLON) or + * does not match the XML Name production, then throw an exception; the + * serialization of this node would not be a well-formed element. + */ + if (requireWellFormed && (node.localName.indexOf(":") !== -1 || + !algorithm_1.xml_isName(node.localName))) { + throw new Error("Node local name contains invalid characters (well-formed required)."); } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (str_2_1 && !str_2_1.done && (_a = str_2.return)) _a.call(str_2); + /** + * 2. Let markup be the string "<" (U+003C LESS-THAN SIGN). + * 3. Let qualified name be an empty string. + * 4. Let skip end tag be a boolean flag with value false. + * 5. Let ignore namespace definition attribute be a boolean flag with value + * false. + * 6. Given prefix map, copy a namespace prefix map and let map be the + * result. + * 7. Let local prefixes map be an empty map. The map has unique Node prefix + * strings as its keys, with corresponding namespaceURI Node values as the + * map's key values (in this map, the null namespace is represented by the + * empty string). + * + * _Note:_ This map is local to each element. It is used to ensure there + * are no conflicting prefixes should a new namespace prefix attribute need + * to be generated. It is also used to enable skipping of duplicate prefix + * definitions when writing an element's attributes: the map allows the + * algorithm to distinguish between a prefix in the namespace prefix map + * that might be locally-defined (to the current Element) and one that is + * not. + * 8. Let local default namespace be the result of recording the namespace + * information for node given map and local prefixes map. + * + * _Note:_ The above step will update map with any found namespace prefix + * definitions, add the found prefix definitions to the local prefixes map + * and return a local default namespace value defined by a default namespace + * attribute if one exists. Otherwise it returns null. + * 9. Let inherited ns be a copy of namespace. + * 10. Let ns be the value of node's namespaceURI attribute. + */ + var skipEndTag = false; + /** 11. If inherited ns is equal to ns, then: */ + /** + * 11.1. If local default namespace is not null, then set ignore + * namespace definition attribute to true. + * 11.2. If ns is the XML namespace, then append to qualified name the + * concatenation of the string "xml:" and the value of node's localName. + * 11.3. Otherwise, append to qualified name the value of node's + * localName. The node's prefix if it exists, is dropped. + */ + var qualifiedName = node.localName; + /** 11.4. Append the value of qualified name to markup. */ + var markup = "<" + qualifiedName; + /** + * 13. Append to markup the result of the XML serialization of node's + * attributes given map, prefix index, local prefixes map, ignore namespace + * definition attribute flag, and require well-formed flag. + */ + markup += this._serializeAttributes(node, requireWellFormed); + /** + * 14. If ns is the HTML namespace, and the node's list of children is + * empty, and the node's localName matches any one of the following void + * elements: "area", "base", "basefont", "bgsound", "br", "col", "embed", + * "frame", "hr", "img", "input", "keygen", "link", "menuitem", "meta", + * "param", "source", "track", "wbr"; then append the following to markup, + * in the order listed: + * 14.1. " " (U+0020 SPACE); + * 14.2. "/" (U+002F SOLIDUS). + * and set the skip end tag flag to true. + * 15. If ns is not the HTML namespace, and the node's list of children is + * empty, then append "/" (U+002F SOLIDUS) to markup and set the skip end + * tag flag to true. + * 16. Append ">" (U+003E GREATER-THAN SIGN) to markup. + */ + if (node._children.size === 0) { + markup += "/"; + skipEndTag = true; } - finally { if (e_2) throw e_2.error; } - } - return result; -} -exports.asciiLowercase = asciiLowercase; -/** - * Converts all uppercase ASCII code points to uppercase. - * - * @param str - a string - */ -function asciiUppercase(str) { - var e_3, _a; - /** - * To ASCII uppercase a string, replace all ASCII lower alphas in the string - * with their corresponding code point in ASCII upper alpha. - */ - var result = ""; - try { - for (var str_3 = __values(str), str_3_1 = str_3.next(); !str_3_1.done; str_3_1 = str_3.next()) { - var c = str_3_1.value; - var code = c.codePointAt(0); - if (code !== undefined && code >= 0x61 && code <= 0x7A) { - result += String.fromCodePoint(code - 0x20); - } - else { - result += c; + markup += ">"; + /** + * 17. If the value of skip end tag is true, then return the value of markup + * and skip the remaining steps. The node is a leaf-node. + */ + if (skipEndTag) + return markup; + try { + /** + * 18. If ns is the HTML namespace, and the node's localName matches the + * string "template", then this is a template element. Append to markup the + * result of XML serializing a DocumentFragment node given the template + * element's template contents (a DocumentFragment), providing inherited + * ns, map, prefix index, and the require well-formed flag. + * + * _Note:_ This allows template content to round-trip, given the rules for + * parsing XHTML documents. + * + * 19. Otherwise, append to markup the result of running the XML + * serialization algorithm on each of node's children, in tree order, + * providing inherited ns, map, prefix index, and the require well-formed + * flag. + */ + for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + markup += this._serializeNode(childNode, requireWellFormed); } } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (str_3_1 && !str_3_1.done && (_a = str_3.return)) _a.call(str_3); + catch (e_6_1) { e_6 = { error: e_6_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_6) throw e_6.error; } } - finally { if (e_3) throw e_3.error; } - } - return result; -} -exports.asciiUppercase = asciiUppercase; -/** - * Compares two ASCII strings case-insensitively. - * - * @param a - a string - * @param b - a string - */ -function asciiCaseInsensitiveMatch(a, b) { - /** - * A string A is an ASCII case-insensitive match for a string B, if the ASCII - * lowercase of A is the ASCII lowercase of B. - */ - return asciiLowercase(a) === asciiLowercase(b); -} -exports.asciiCaseInsensitiveMatch = asciiCaseInsensitiveMatch; -/** - * ASCII encodes a string. - * - * @param str - a string - */ -function asciiEncode(str) { + /** + * 20. Append the following to markup, in the order listed: + * 20.1. "" (U+003E GREATER-THAN SIGN). + */ + markup += ""; + /** + * 21. Return the value of markup. + */ + return markup; + }; /** - * 1. Assert: input is an ASCII string. - * 2. Return the isomorphic encoding of input. + * Produces an XML serialization of a document node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance */ - console.assert(isASCIIString(str), "asciiEncode requires an ASCII string."); - return isomorphicEncode(str); -} -exports.asciiEncode = asciiEncode; -/** - * ASCII decodes a byte sequence. - * - * @param bytes - a byte sequence - */ -function asciiDecode(bytes) { - var e_4, _a; - try { + XMLSerializerImpl.prototype._serializeDocument = function (node, requireWellFormed) { + var e_7, _a; /** - * 1. Assert: All bytes in input are ASCII bytes. - * 2. Return the isomorphic decoding of input. + * If the require well-formed flag is set (its value is true), and this node + * has no documentElement (the documentElement attribute's value is null), + * then throw an exception; the serialization of this node would not be a + * well-formed document. */ - for (var bytes_1 = __values(bytes), bytes_1_1 = bytes_1.next(); !bytes_1_1.done; bytes_1_1 = bytes_1.next()) { - var byte = bytes_1_1.value; - console.assert(Byte_1.isASCIIByte(byte), "asciiDecode requires an ASCII byte sequence."); + if (requireWellFormed && node.documentElement === null) { + throw new Error("Missing document element (well-formed required)."); } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { + /** + * Otherwise, run the following steps: + * 1. Let serialized document be an empty string. + * 2. For each child child of node, in tree order, run the XML + * serialization algorithm on the child passing along the provided + * arguments, and append the result to serialized document. + * + * _Note:_ This will serialize any number of ProcessingInstruction and + * Comment nodes both before and after the Document's documentElement node, + * including at most one DocumentType node. (Text nodes are not allowed as + * children of the Document.) + * + * 3. Return the value of serialized document. + */ + var serializedDocument = ""; try { - if (bytes_1_1 && !bytes_1_1.done && (_a = bytes_1.return)) _a.call(bytes_1); + for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + serializedDocument += this._serializeNode(childNode, requireWellFormed); + } } - finally { if (e_4) throw e_4.error; } - } - return ByteSequence_1.isomorphicDecode(bytes); -} -exports.asciiDecode = asciiDecode; -/** - * Strips newline characters from a string. - * - * @param str - a string - */ -function stripNewlines(str) { + catch (e_7_1) { e_7 = { error: e_7_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_7) throw e_7.error; } + } + return serializedDocument; + }; /** - * To strip newlines from a string, remove any U+000A LF and U+000D CR code - * points from the string. + * Produces an XML serialization of a document fragment node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance */ - return str.replace(/[\n\r]/g, ""); -} -exports.stripNewlines = stripNewlines; -/** - * Normalizes newline characters in a string by converting consecutive - * carriage-return newline characters and also single carriage return characters - * into a single newline. - * - * @param str - a string - */ -function normalizeNewlines(str) { + XMLSerializerImpl.prototype._serializeDocumentFragment = function (node, requireWellFormed) { + var e_8, _a; + /** + * 1. Let markup the empty string. + * 2. For each child child of node, in tree order, run the XML serialization + * algorithm on the child given namespace, prefix map, a reference to prefix + * index, and flag require well-formed. Concatenate the result to markup. + * 3. Return the value of markup. + */ + var markup = ""; + try { + for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + markup += this._serializeNode(childNode, requireWellFormed); + } + } + catch (e_8_1) { e_8 = { error: e_8_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_8) throw e_8.error; } + } + return markup; + }; /** - * To normalize newlines in a string, replace every U+000D CR U+000A LF code - * point pair with a single U+000A LF code point, and then replace every - * remaining U+000D CR code point with a U+000A LF code point. + * Produces an XML serialization of the attributes of an element node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance */ - return str.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); -} -exports.normalizeNewlines = normalizeNewlines; -/** - * Removes leading and trailing whitespace characters from a string. - * - * @param str - a string - */ -function stripLeadingAndTrailingASCIIWhitespace(str) { - /** - * To strip leading and trailing ASCII whitespace from a string, remove all - * ASCII whitespace that are at the start or the end of the string. - */ - return str.replace(/^[\t\n\f\r ]+/, "").replace(/[\t\n\f\r ]+$/, ""); -} -exports.stripLeadingAndTrailingASCIIWhitespace = stripLeadingAndTrailingASCIIWhitespace; -/** - * Removes consecutive newline characters from a string. - * - * @param str - a string - */ -function stripAndCollapseASCIIWhitespace(str) { - /** - * To strip and collapse ASCII whitespace in a string, replace any sequence of - * one or more consecutive code points that are ASCII whitespace in the string - * with a single U+0020 SPACE code point, and then remove any leading and - * trailing ASCII whitespace from that string. - */ - return stripLeadingAndTrailingASCIIWhitespace(str.replace(/[\t\n\f\r ]{2,}/g, " ")); -} -exports.stripAndCollapseASCIIWhitespace = stripAndCollapseASCIIWhitespace; -/** - * Collects a sequence of code points matching a given condition from the input - * string. - * - * @param condition - a condition to match - * @param input - a string - * @param options - starting position - */ -function collectASequenceOfCodePoints(condition, input, options) { - /** - * 1. Let result be the empty string. - * 2. While position doesn’t point past the end of input and the code point at - * position within input meets the condition condition: - * 2.1. Append that code point to the end of result. - * 2.2. Advance position by 1. - * 3. Return result. - */ - if (!util_1.isArray(input)) - return collectASequenceOfCodePoints(condition, Array.from(input), options); - var result = ""; - while (options.position < input.length && !!condition.call(null, input[options.position])) { - result += input[options.position]; - options.position++; - } - return result; -} -exports.collectASequenceOfCodePoints = collectASequenceOfCodePoints; -/** - * Skips over ASCII whitespace. - * - * @param input - input string - * @param options - starting position - */ -function skipASCIIWhitespace(input, options) { - /** - * To skip ASCII whitespace within a string input given a position variable - * position, collect a sequence of code points that are ASCII whitespace from - * input given position. The collected code points are not used, but position - * is still updated. - */ - collectASequenceOfCodePoints(function (str) { return CodePoints_1.ASCIIWhiteSpace.test(str); }, input, options); -} -exports.skipASCIIWhitespace = skipASCIIWhitespace; -/** - * Solits a string at the given delimiter. - * - * @param input - input string - * @param delimiter - a delimiter string - */ -function strictlySplit(input, delimiter) { - /** - * 1. Let position be a position variable for input, initially pointing at the - * start of input. - * 2. Let tokens be a list of strings, initially empty. - * 3. Let token be the result of collecting a sequence of code points that are - * not equal to delimiter from input, given position. - * 4. Append token to tokens. - * 5. While position is not past the end of input: - * 5.1. Assert: the code point at position within input is delimiter. - * 5.2. Advance position by 1. - * 5.3. Let token be the result of collecting a sequence of code points that - * are not equal to delimiter from input, given position. - * 5.4. Append token to tokens. - * 6. Return tokens. - */ - if (!util_1.isArray(input)) - return strictlySplit(Array.from(input), delimiter); - var options = { position: 0 }; - var tokens = []; - var token = collectASequenceOfCodePoints(function (str) { return delimiter !== str; }, input, options); - tokens.push(token); - while (options.position < input.length) { - console.assert(input[options.position] === delimiter, "strictlySplit found no delimiter in input string."); - options.position++; - token = collectASequenceOfCodePoints(function (str) { return delimiter !== str; }, input, options); - tokens.push(token); - } - return tokens; -} -exports.strictlySplit = strictlySplit; -/** - * Splits a string on ASCII whitespace. - * - * @param input - a string - */ -function splitAStringOnASCIIWhitespace(input) { - /** - * 1. Let position be a position variable for input, initially pointing at the - * start of input. - * 2. Let tokens be a list of strings, initially empty. - * 3. Skip ASCII whitespace within input given position. - * 4. While position is not past the end of input: - * 4.1. Let token be the result of collecting a sequence of code points that - * are not ASCII whitespace from input, given position. - * 4.2. Append token to tokens. - * 4.3. Skip ASCII whitespace within input given position. - * 5. Return tokens. - */ - if (!util_1.isArray(input)) - return splitAStringOnASCIIWhitespace(Array.from(input)); - var options = { position: 0 }; - var tokens = []; - skipASCIIWhitespace(input, options); - while (options.position < input.length) { - var token = collectASequenceOfCodePoints(function (str) { return !CodePoints_1.ASCIIWhiteSpace.test(str); }, input, options); - tokens.push(token); - skipASCIIWhitespace(input, options); - } - return tokens; -} -exports.splitAStringOnASCIIWhitespace = splitAStringOnASCIIWhitespace; -/** - * Splits a string on commas. - * - * @param input - a string - */ -function splitAStringOnCommas(input) { - /** - * 1. Let position be a position variable for input, initially pointing at the - * start of input. - * 2. Let tokens be a list of strings, initially empty. - * 3. While position is not past the end of input: - * 3.1. Let token be the result of collecting a sequence of code points that - * are not U+002C (,) from input, given position. - * 3.2. Strip leading and trailing ASCII whitespace from token. - * 3.3. Append token to tokens. - * 3.4. If position is not past the end of input, then: - * 3.4.1. Assert: the code point at position within input is U+002C (,). - * 3.4.2. Advance position by 1. - * 4. Return tokens. - */ - if (!util_1.isArray(input)) - return splitAStringOnCommas(Array.from(input)); - var options = { position: 0 }; - var tokens = []; - while (options.position < input.length) { - var token = collectASequenceOfCodePoints(function (str) { return str !== ','; }, input, options); - tokens.push(stripLeadingAndTrailingASCIIWhitespace(token)); - if (options.position < input.length) { - console.assert(input[options.position] === ',', "splitAStringOnCommas found no delimiter in input string."); - options.position++; + XMLSerializerImpl.prototype._serializeAttributes = function (node, requireWellFormed) { + var e_9, _a; + /** + * 1. Let result be the empty string. + * 2. Let localname set be a new empty namespace localname set. This + * localname set will contain tuples of unique attribute namespaceURI and + * localName pairs, and is populated as each attr is processed. This set is + * used to [optionally] enforce the well-formed constraint that an element + * cannot have two attributes with the same namespaceURI and localName. + * This can occur when two otherwise identical attributes on the same + * element differ only by their prefix values. + */ + var result = ""; + var localNameSet = requireWellFormed ? {} : undefined; + try { + /** + * 3. Loop: For each attribute attr in element's attributes, in the order + * they are specified in the element's attribute list: + */ + for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { + var attr = _c.value; + /** + * 3.1. If the require well-formed flag is set (its value is true), and the + * localname set contains a tuple whose values match those of a new tuple + * consisting of attr's namespaceURI attribute and localName attribute, + * then throw an exception; the serialization of this attr would fail to + * produce a well-formed element serialization. + */ + if (requireWellFormed && localNameSet && (attr.localName in localNameSet)) { + throw new Error("Element contains duplicate attributes (well-formed required)."); + } + /** + * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and + * localName attribute, and add it to the localname set. + * 3.3. Let attribute namespace be the value of attr's namespaceURI value. + * 3.4. Let candidate prefix be null. + */ + if (requireWellFormed && localNameSet) + localNameSet[attr.localName] = true; + /** 3.5. If attribute namespace is not null, then run these sub-steps: */ + /** + * 3.6. Append a " " (U+0020 SPACE) to result. + * 3.7. If candidate prefix is not null, then append to result the + * concatenation of candidate prefix with ":" (U+003A COLON). + */ + /** + * 3.8. If the require well-formed flag is set (its value is true), and + * this attr's localName attribute contains the character + * ":" (U+003A COLON) or does not match the XML Name production or + * equals "xmlns" and attribute namespace is null, then throw an + * exception; the serialization of this attr would not be a + * well-formed attribute. + */ + if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || + !algorithm_1.xml_isName(attr.localName))) { + throw new Error("Attribute local name contains invalid characters (well-formed required)."); + } + /** + * 3.9. Append the following strings to result, in the order listed: + * 3.9.1. The value of attr's localName; + * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 3.9.3. The result of serializing an attribute value given attr's value + * attribute and the require well-formed flag as input; + * 3.9.4. """ (U+0022 QUOTATION MARK). + */ + result += " " + attr.localName + "=\"" + + this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; + } } - } - return tokens; -} -exports.splitAStringOnCommas = splitAStringOnCommas; -/** - * Concatenates a list of strings with the given separator. - * - * @param list - a list of strings - * @param separator - a separator string - */ -function concatenate(list, separator) { - if (separator === void 0) { separator = ""; } - /** - * 1. If list is empty, then return the empty string. - * 2. If separator is not given, then set separator to the empty string. - * 3. Return a string whose contents are list’s items, in order, separated - * from each other by separator. - */ - if (list.length === 0) - return ""; - return list.join(separator); -} -exports.concatenate = concatenate; -//# sourceMappingURL=String.js.map + catch (e_9_1) { e_9 = { error: e_9_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_9) throw e_9.error; } + } + /** + * 4. Return the value of result. + */ + return result; + }; + XMLSerializerImpl._VoidElementNames = new Set(['area', 'base', 'basefont', + 'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen', + 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']); + return XMLSerializerImpl; +}()); +exports.XMLSerializerImpl = XMLSerializerImpl; +//# sourceMappingURL=XMLSerializerImpl.js.map /***/ }), -/***/ 4251: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 87119: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var base64 = __importStar(__nccwpck_require__(8585)); -exports.base64 = base64; -var byte = __importStar(__nccwpck_require__(2460)); -exports.byte = byte; -var byteSequence = __importStar(__nccwpck_require__(1627)); -exports.byteSequence = byteSequence; -var codePoint = __importStar(__nccwpck_require__(8548)); -exports.codePoint = codePoint; -var json = __importStar(__nccwpck_require__(9387)); -exports.json = json; -var list = __importStar(__nccwpck_require__(340)); -exports.list = list; -var map = __importStar(__nccwpck_require__(2298)); -exports.map = map; -var namespace = __importStar(__nccwpck_require__(3764)); -exports.namespace = namespace; -var queue = __importStar(__nccwpck_require__(9201)); -exports.queue = queue; -var set = __importStar(__nccwpck_require__(5931)); -exports.set = set; -var stack = __importStar(__nccwpck_require__(8784)); -exports.stack = stack; -var string = __importStar(__nccwpck_require__(3203)); -exports.string = string; +// Export classes +var XMLSerializerImpl_1 = __nccwpck_require__(85039); +exports.XMLSerializer = XMLSerializerImpl_1.XMLSerializerImpl; //# sourceMappingURL=index.js.map /***/ }), -/***/ 3568: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 75483: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var Guard_1 = __nccwpck_require__(66862); +/** + * Contains type casts for DOM objects. + */ +var Cast = /** @class */ (function () { + function Cast() { + } + /** + * Casts the given object to a `Node`. + * + * @param a - the object to cast + */ + Cast.asNode = function (a) { + if (Guard_1.Guard.isNode(a)) { + return a; + } + else { + throw new Error("Invalid object. Node expected."); } }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + return Cast; +}()); +exports.Cast = Cast; +//# sourceMappingURL=Cast.js.map + +/***/ }), + +/***/ 88392: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var EmptySet = /** @class */ (function () { + function EmptySet() { } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } + Object.defineProperty(EmptySet.prototype, "size", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + EmptySet.prototype.add = function (value) { + throw new Error("Cannot add to an empty set."); + }; + EmptySet.prototype.clear = function () { + // no-op + }; + EmptySet.prototype.delete = function (value) { + return false; + }; + EmptySet.prototype.forEach = function (callbackfn, thisArg) { + // no-op + }; + EmptySet.prototype.has = function (value) { + return false; + }; + EmptySet.prototype[Symbol.iterator] = function () { + return new EmptySetIterator(); + }; + EmptySet.prototype.entries = function () { + return new EmptySetIterator(); + }; + EmptySet.prototype.keys = function () { + return new EmptySetIterator(); + }; + EmptySet.prototype.values = function () { + return new EmptySetIterator(); + }; + Object.defineProperty(EmptySet.prototype, Symbol.toStringTag, { + get: function () { + return "EmptySet"; + }, + enumerable: true, + configurable: true + }); + return EmptySet; +}()); +exports.EmptySet = EmptySet; +var EmptySetIterator = /** @class */ (function () { + function EmptySetIterator() { } - return ar; -}; + EmptySetIterator.prototype[Symbol.iterator] = function () { + return this; + }; + EmptySetIterator.prototype.next = function () { + return { done: true, value: null }; + }; + return EmptySetIterator; +}()); +//# sourceMappingURL=EmptySet.js.map + +/***/ }), + +/***/ 66862: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(6195); -var interfaces_1 = __nccwpck_require__(1752); -var infra_1 = __nccwpck_require__(4251); -var url_1 = __nccwpck_require__(7310); -var _validationErrorCallback; -/** - * Default ports for a special URL scheme. - */ -var _defaultPorts = { - "ftp": 21, - "file": null, - "http": 80, - "https": 443, - "ws": 80, - "wss": 443 -}; -/** - * The C0 control percent-encode set are the C0 controls and all code points - * greater than U+007E (~). - */ -var _c0ControlPercentEncodeSet = /[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -/** - * The fragment percent-encode set is the C0 control percent-encode set and - * U+0020 SPACE, U+0022 ("), U+003C (<), U+003E (>), and U+0060 (`). - */ -var _fragmentPercentEncodeSet = /[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -/** - * The path percent-encode set is the fragment percent-encode set and - * U+0023 (#), U+003F (?), U+007B ({), and U+007D (}). - */ -var _pathPercentEncodeSet = /[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -/** - * The userinfo percent-encode set is the path percent-encode set and - * U+002F (/), U+003A (:), U+003B (;), U+003D (=), U+0040 (@), U+005B ([), - * U+005C (\), U+005D (]), U+005E (^), and U+007C (|). - */ -var _userInfoPercentEncodeSet = /[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -/** - * The URL code points are ASCII alphanumeric, U+0021 (!), U+0024 ($), - * U+0026 (&), U+0027 ('), U+0028 LEFT PARENTHESIS, U+0029 RIGHT PARENTHESIS, - * U+002A (*), U+002B (+), U+002C (,), U+002D (-), U+002E (.), U+002F (/), - * U+003A (:), U+003B (;), U+003D (=), U+003F (?), U+0040 (@), U+005F (_), - * U+007E (~), and code points in the range U+00A0 to U+10FFFD, inclusive, - * excluding surrogates and noncharacters. - */ -var _urlCodePoints = /[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/; -/** - * A forbidden host code point is U+0000 NULL, U+0009 TAB, U+000A LF, - * U+000D CR, U+0020 SPACE, U+0023 (#), U+0025 (%), U+002F (/), U+003A (:), - * U+003F (?), U+0040 (@), U+005B ([), U+005C (\), or U+005D (]). - */ -var _forbiddenHostCodePoint = /[\0\t\f\r #%/:?@\[\\\]]/; -/** - * Sets the callback function for validation errors. - * - * @param validationErrorCallback - a callback function to be called when a - * validation error occurs - */ -function setValidationErrorCallback(validationErrorCallback) { - _validationErrorCallback = validationErrorCallback; -} -exports.setValidationErrorCallback = setValidationErrorCallback; +var interfaces_1 = __nccwpck_require__(27305); /** - * Generates a validation error. - * - * @param message - error message + * Contains user-defined type guards for DOM objects. */ -function validationError(message) { - if (_validationErrorCallback !== undefined) { - _validationErrorCallback.call(null, "Validation Error: " + message); +var Guard = /** @class */ (function () { + function Guard() { } -} -/** - * Creates a new URL. - */ -function newURL() { - return { - scheme: '', - username: '', - password: '', - host: null, - port: null, - path: [], - query: null, - fragment: null, - _cannotBeABaseURLFlag: false, - _blobURLEntry: null + /** + * Determines if the given object is a `Node`. + * + * @param a - the object to check + */ + Guard.isNode = function (a) { + return (!!a && a._nodeType !== undefined); }; -} -exports.newURL = newURL; -/** - * Determines if the scheme is a special scheme. - * - * @param scheme - a scheme - */ -function isSpecialScheme(scheme) { - return (scheme in _defaultPorts); -} -exports.isSpecialScheme = isSpecialScheme; -/** - * Determines if the URL has a special scheme. - * - * @param url - an URL - */ -function isSpecial(url) { - return isSpecialScheme(url.scheme); -} -exports.isSpecial = isSpecial; -/** - * Returns the default port for a special scheme. - * - * @param scheme - a scheme - */ -function defaultPort(scheme) { - return _defaultPorts[scheme] || null; -} -exports.defaultPort = defaultPort; -/** - * Determines if the URL has credentials. - * - * @param url - an URL - */ -function includesCredentials(url) { - return url.username !== '' || url.password !== ''; -} -exports.includesCredentials = includesCredentials; + /** + * Determines if the given object is a `Document`. + * + * @param a - the object to check + */ + Guard.isDocumentNode = function (a) { + return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Document); + }; + /** + * Determines if the given object is a `DocumentType`. + * + * @param a - the object to check + */ + Guard.isDocumentTypeNode = function (a) { + return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.DocumentType); + }; + /** + * Determines if the given object is a `DocumentFragment`. + * + * @param a - the object to check + */ + Guard.isDocumentFragmentNode = function (a) { + return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.DocumentFragment); + }; + /** + * Determines if the given object is a `Attr`. + * + * @param a - the object to check + */ + Guard.isAttrNode = function (a) { + return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Attribute); + }; + /** + * Determines if the given node is a `CharacterData` node. + * + * @param a - the object to check + */ + Guard.isCharacterDataNode = function (a) { + if (!Guard.isNode(a)) + return false; + var type = a._nodeType; + return (type === interfaces_1.NodeType.Text || + type === interfaces_1.NodeType.ProcessingInstruction || + type === interfaces_1.NodeType.Comment || + type === interfaces_1.NodeType.CData); + }; + /** + * Determines if the given object is a `Text` or a `CDATASection`. + * + * @param a - the object to check + */ + Guard.isTextNode = function (a) { + return (Guard.isNode(a) && (a._nodeType === interfaces_1.NodeType.Text || a._nodeType === interfaces_1.NodeType.CData)); + }; + /** + * Determines if the given object is a `Text`. + * + * @param a - the object to check + */ + Guard.isExclusiveTextNode = function (a) { + return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Text); + }; + /** + * Determines if the given object is a `CDATASection`. + * + * @param a - the object to check + */ + Guard.isCDATASectionNode = function (a) { + return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.CData); + }; + /** + * Determines if the given object is a `Comment`. + * + * @param a - the object to check + */ + Guard.isCommentNode = function (a) { + return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Comment); + }; + /** + * Determines if the given object is a `ProcessingInstruction`. + * + * @param a - the object to check + */ + Guard.isProcessingInstructionNode = function (a) { + return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.ProcessingInstruction); + }; + /** + * Determines if the given object is an `Element`. + * + * @param a - the object to check + */ + Guard.isElementNode = function (a) { + return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Element); + }; + /** + * Determines if the given object is a custom `Element`. + * + * @param a - the object to check + */ + Guard.isCustomElementNode = function (a) { + return (Guard.isElementNode(a) && a._customElementState === "custom"); + }; + /** + * Determines if the given object is a `ShadowRoot`. + * + * @param a - the object to check + */ + Guard.isShadowRoot = function (a) { + return (!!a && a.host !== undefined); + }; + /** + * Determines if the given object is a `MouseEvent`. + * + * @param a - the object to check + */ + Guard.isMouseEvent = function (a) { + return (!!a && a.screenX !== undefined && a.screenY != undefined); + }; + /** + * Determines if the given object is a slotable. + * + * Element and Text nodes are slotables. A slotable has an associated name + * (a string). + * + * @param a - the object to check + */ + Guard.isSlotable = function (a) { + return (!!a && a._name !== undefined && a._assignedSlot !== undefined && + (Guard.isTextNode(a) || Guard.isElementNode(a))); + }; + /** + * Determines if the given object is a slot. + * + * @param a - the object to check + */ + Guard.isSlot = function (a) { + return (!!a && a._name !== undefined && a._assignedNodes !== undefined && + Guard.isElementNode(a)); + }; + /** + * Determines if the given object is a `Window`. + * + * @param a - the object to check + */ + Guard.isWindow = function (a) { + return (!!a && a.navigator !== undefined); + }; + /** + * Determines if the given object is an `EventListener`. + * + * @param a - the object to check + */ + Guard.isEventListener = function (a) { + return (!!a && a.handleEvent !== undefined); + }; + /** + * Determines if the given object is a `RegisteredObserver`. + * + * @param a - the object to check + */ + Guard.isRegisteredObserver = function (a) { + return (!!a && a.observer !== undefined && a.options !== undefined); + }; + /** + * Determines if the given object is a `TransientRegisteredObserver`. + * + * @param a - the object to check + */ + Guard.isTransientRegisteredObserver = function (a) { + return (!!a && a.source !== undefined && Guard.isRegisteredObserver(a)); + }; + return Guard; +}()); +exports.Guard = Guard; +//# sourceMappingURL=Guard.js.map + +/***/ }), + +/***/ 65282: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var Cast_1 = __nccwpck_require__(75483); +exports.Cast = Cast_1.Cast; +var Guard_1 = __nccwpck_require__(66862); +exports.Guard = Guard_1.Guard; +var EmptySet_1 = __nccwpck_require__(88392); +exports.EmptySet = EmptySet_1.EmptySet; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 28585: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var CodePoints_1 = __nccwpck_require__(28548); /** - * Determines if an URL cannot have credentials. + * Base-64 encodes the given string. * - * @param url - an URL + * @param input - a string */ -function cannotHaveAUsernamePasswordPort(url) { +function forgivingBase64Encode(input) { /** - * A URL cannot have a username/password/port if its host is null or the - * empty string, its cannot-be-a-base-URL flag is set, or its scheme is - * "file". + * To forgiving-base64 encode given a byte sequence data, apply the base64 + * algorithm defined in section 4 of RFC 4648 to data and return the result. + * [RFC4648] */ - return (url.host === null || url.host === "" || url._cannotBeABaseURLFlag || - url.scheme === "file"); + return Buffer.from(input).toString('base64'); } -exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; +exports.forgivingBase64Encode = forgivingBase64Encode; /** - * Serializes an URL into a string. + * Decodes a base-64 string. * - * @param url - an URL + * @param input - a string */ -function urlSerializer(url, excludeFragmentFlag) { - var e_1, _a; - if (excludeFragmentFlag === void 0) { excludeFragmentFlag = false; } +function forgivingBase64Decode(input) { + if (input === "") + return ""; /** - * 1. Let output be url’s scheme and U+003A (:) concatenated. + * 1. Remove all ASCII whitespace from data. */ - var output = url.scheme + ':'; + input = input.replace(CodePoints_1.ASCIIWhiteSpace, ''); /** - * 2. If url’s host is non-null: + * 2. If data’s length divides by 4 leaving no remainder, then: + * 2.1. If data ends with one or two U+003D (=) code points, then remove them from data. */ - if (url.host !== null) { - /** - * 2.1. Append "//" to output. - */ - output += '//'; - /** - * 2.2. If url includes credentials, then: - */ - if (includesCredentials(url)) { - /** - * 2.2.1. Append url’s username to output. - * 2.2.2. If url’s password is not the empty string, then append U+003A (:), - * followed by url’s password, to output. - * 2.2.3. Append U+0040 (@) to output. - */ - output += url.username; - if (url.password !== '') { - output += ':' + url.password; - } - output += '@'; + if (input.length % 4 === 0) { + if (input.endsWith("==")) { + input = input.substr(0, input.length - 2); } - /** - * 2.3. Append url’s host, serialized, to output. - * 2.4. If url’s port is non-null, append U+003A (:) followed by url’s port, - * serialized, to output. - */ - output += hostSerializer(url.host); - if (url.port !== null) { - output += ':' + url.port; + else if (input.endsWith("=")) { + input = input.substr(0, input.length - 1); } } - else if (url.host === null && url.scheme === "file") { - /** - * 3. Otherwise, if url’s host is null and url’s scheme is "file", append "//" to output. - */ - output += '//'; - } /** - * 4. If url’s cannot-be-a-base-URL flag is set, append url’s path[0] to - * output. - * 5. Otherwise, then for each string in url’s path, append U+002F (/) - * followed by the string to output. + * 3. If data’s length divides by 4 leaving a remainder of 1, then return failure. */ - if (url._cannotBeABaseURLFlag) { - output += url.path[0]; + if (input.length % 4 === 1) + return null; + /** + * 4. If data contains a code point that is not one of + * - U+002B (+) + * - U+002F (/) + * - ASCII alphanumeric + * then return failure. + */ + if (!/[0-9A-Za-z+/]/.test(input)) + return null; + /** + * 5. Let output be an empty byte sequence. + * 6. Let buffer be an empty buffer that can have bits appended to it. + * 7. Let position be a position variable for data, initially pointing at the + * start of data. + * 8. While position does not point past the end of data: + * 8.1. Find the code point pointed to by position in the second column of + * Table 1: The Base 64 Alphabet of RFC 4648. Let n be the number given in the + * first cell of the same row. [RFC4648] + * 8.2. Append the six bits corresponding to n, most significant bit first, + * to buffer. + * 8.3. If buffer has accumulated 24 bits, interpret them as three 8-bit + * big-endian numbers. Append three bytes with values equal to those numbers + * to output, in the same order, and then empty buffer. + * 8.4. Advance position by 1. + * 9. If buffer is not empty, it contains either 12 or 18 bits. If it contains + * 12 bits, then discard the last four and interpret the remaining eight as an + * 8-bit big-endian number. If it contains 18 bits, then discard the last two + * and interpret the remaining 16 as two 8-bit big-endian numbers. Append the + * one or two bytes with values equal to those one or two numbers to output, + * in the same order. + * 10. Return output. + */ + return Buffer.from(input, 'base64').toString('utf8'); +} +exports.forgivingBase64Decode = forgivingBase64Decode; +//# sourceMappingURL=Base64.js.map + +/***/ }), + +/***/ 42460: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Determines if the given number is an ASCII byte. + * + * @param byte - a byte + */ +function isASCIIByte(byte) { + /** + * An ASCII byte is a byte in the range 0x00 (NUL) to 0x7F (DEL), inclusive. + */ + return byte >= 0x00 && byte <= 0x7F; +} +exports.isASCIIByte = isASCIIByte; +//# sourceMappingURL=Byte.js.map + +/***/ }), + +/***/ 71627: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } - else { + catch (error) { e = { error: error }; } + finally { try { - for (var _b = __values(url.path), _c = _b.next(); !_c.done; _c = _b.next()) { - var str = _c.value; - output += '/' + str; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + if (r && !r.done && (m = i["return"])) m.call(i); } + finally { if (e) throw e.error; } } + return ar; +}; +var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Returns the count of bytes in a sequence. + * + * @param list - a byte sequence + */ +function length(list) { /** - * 6. If url’s query is non-null, append U+003F (?), followed by url’s - * query, to output. - * 7. If the exclude fragment flag is unset and url’s fragment is non-null, - * append U+0023 (#), followed by url’s fragment, to output. - * 8. Return output. + * A byte sequence’s length is the number of bytes it contains. */ - if (url.query !== null) { - output += '?' + url.query; - } - if (!excludeFragmentFlag && url.fragment !== null) { - output += '#' + url.fragment; - } - return output; + return list.length; } -exports.urlSerializer = urlSerializer; +exports.length = length; /** - * Serializes a host into a string. + * Converts each byte to lowercase. * - * @param host - a host + * @param list - a byte sequence */ -function hostSerializer(host) { +function byteLowercase(list) { /** - * 1. If host is an IPv4 address, return the result of running the IPv4 - * serializer on host. - * 2. Otherwise, if host is an IPv6 address, return U+005B ([), followed - * by the result of running the IPv6 serializer on host, followed by - * U+005D (]). - * 3. Otherwise, host is a domain, opaque host, or empty host, return host. + * To byte-lowercase a byte sequence, increase each byte it contains, in the + * range 0x41 (A) to 0x5A (Z), inclusive, by 0x20. */ - if (util_1.isNumber(host)) { - return iPv4Serializer(host); - } - else if (util_1.isArray(host)) { - return '[' + iPv6Serializer(host) + ']'; - } - else { - return host; + for (var i = 0; i < list.length; i++) { + var c = list[i]; + if (c >= 0x41 && c <= 0x5A) { + list[i] = c + 0x20; + } } } -exports.hostSerializer = hostSerializer; +exports.byteLowercase = byteLowercase; /** - * Serializes an IPv4 address into a string. + * Converts each byte to uppercase. * - * @param address - an IPv4 address + * @param list - a byte sequence */ -function iPv4Serializer(address) { +function byteUppercase(list) { /** - * 1. Let output be the empty string. - * 2. Let n be the value of address. - * 3. For each i in the range 1 to 4, inclusive: - * 3.1. Prepend n % 256, serialized, to output. - * 3.2. If i is not 4, then prepend U+002E (.) to output. - * 3.3. Set n to floor(n / 256). - * 4. Return output. + * To byte-uppercase a byte sequence, subtract each byte it contains, in the + * range 0x61 (a) to 0x7A (z), inclusive, by 0x20. */ - var output = ""; - var n = address; - for (var i = 1; i <= 4; i++) { - output = (n % 256).toString() + output; - if (i !== 4) { - output = '.' + output; + for (var i = 0; i < list.length; i++) { + var c = list[i]; + if (c >= 0x61 && c <= 0x7A) { + list[i] = c - 0x20; } - n = Math.floor(n / 256); } - return output; } -exports.iPv4Serializer = iPv4Serializer; +exports.byteUppercase = byteUppercase; /** - * Serializes an IPv6 address into a string. + * Compares two byte sequences. * - * @param address - an IPv6 address represented as a list of eight numbers + * @param listA - a byte sequence + * @param listB - a byte sequence */ -function iPv6Serializer(address) { +function byteCaseInsensitiveMatch(listA, listB) { /** - * 1. Let output be the empty string. - * 2. Let compress be an index to the first IPv6 piece in the first longest - * sequences of address’s IPv6 pieces that are 0. - * In 0:f:0:0:f:f:0:0 it would point to the second 0. - * 3. If there is no sequence of address’s IPv6 pieces that are 0 that is - * longer than 1, then set compress to null. + * A byte sequence A is a byte-case-insensitive match for a byte sequence B, + * if the byte-lowercase of A is the byte-lowercase of B. */ - var output = ""; - var compress = null; - var lastIndex = -1; - var count = 0; - var lastCount = 0; - for (var i = 0; i < 8; i++) { - if (address[i] !== 0) - continue; - count = 1; - for (var j = i + 1; j < 8; j++) { - if (address[j] !== 0) - break; - count++; - continue; - } - if (count > lastCount) { - lastCount = count; - lastIndex = i; - } + if (listA.length !== listB.length) + return false; + for (var i = 0; i < listA.length; i++) { + var a = listA[i]; + var b = listB[i]; + if (a >= 0x41 && a <= 0x5A) + a += 0x20; + if (b >= 0x41 && b <= 0x5A) + b += 0x20; + if (a !== b) + return false; } - if (lastCount > 1) - compress = lastIndex; + return true; +} +exports.byteCaseInsensitiveMatch = byteCaseInsensitiveMatch; +/** + * Determines if `listA` starts with `listB`. + * + * @param listA - a byte sequence + * @param listB - a byte sequence + */ +function startsWith(listA, listB) { /** - * 4. Let ignore0 be false. - * 5. For each pieceIndex in the range 0 to 7, inclusive: + * 1. Let i be 0. + * 2. While true: + * 2.1. Let aByte be the ith byte of a if i is less than a’s length; otherwise null. + * 2.3. Let bByte be the ith byte of b if i is less than b’s length; otherwise null. + * 2.4. If bByte is null, then return true. + * 2.5. Return false if aByte is not bByte. + * 2.6. Set i to i + 1. */ - var ignore0 = false; - for (var pieceIndex = 0; pieceIndex < 8; pieceIndex++) { - /** - * 5.1. If ignore0 is true and address[pieceIndex] is 0, then continue. - * 5.2. Otherwise, if ignore0 is true, set ignore0 to false. - * 5.3. If compress is pieceIndex, then: - */ - if (ignore0 && address[pieceIndex] === 0) - continue; - if (ignore0) - ignore0 = false; - if (compress === pieceIndex) { - /** - * 5.3.1. Let separator be "::" if pieceIndex is 0, and U+003A (:) otherwise. - * 5.3.2. Append separator to output. - * 5.3.3. Set ignore0 to true and continue. - */ - output += (pieceIndex === 0 ? '::' : ':'); - ignore0 = true; - continue; - } - /** - * 5.4. Append address[pieceIndex], represented as the shortest possible - * lowercase hexadecimal number, to output. - * 5.5. If pieceIndex is not 7, then append U+003A (:) to output. - */ - output += address[pieceIndex].toString(16); - if (pieceIndex !== 7) - output += ':'; + var i = 0; + while (true) { + if (i >= listA.length) + return false; + if (i >= listB.length) + return true; + if (listA[i] !== listB[i]) + return false; + i++; } - /** - * 6. Return output. - */ - return output; } -exports.iPv6Serializer = iPv6Serializer; +exports.startsWith = startsWith; /** - * Parses an URL string. + * Determines if `listA` is less than `listB`. * - * @param input - input string - * @param baseURL - base URL - * @param encodingOverride - encoding override + * @param listA - a byte sequence + * @param listB - a byte sequence */ -function urlParser(input, baseURL, encodingOverride) { +function byteLessThan(listA, listB) { /** - * 1. Let url be the result of running the basic URL parser on input with - * base, and encoding override as provided. - * 2. If url is failure, return failure. - * 3. If url’s scheme is not "blob", return url. - * 4. Set url’s blob URL entry to the result of resolving the blob URL url, - * if that did not return failure, and null otherwise. - * 5. Return url. + * 1. If b starts with a, then return false. + * 2. If a starts with b, then return true. + * 3. Let n be the smallest index such that the nth byte of a is different + * from the nth byte of b. (There has to be such an index, since neither byte + * sequence starts with the other.) + * 4. If the nth byte of a is less than the nth byte of b, then return true. + * 5. Return false. */ - var url = basicURLParser(input, baseURL, encodingOverride); - if (url === null) - return null; - if (url.scheme !== "blob") - return url; - var entry = resolveABlobURL(url); - if (entry !== null) { - url._blobURLEntry = entry; - } - else { - url._blobURLEntry = null; + var i = 0; + while (true) { + if (i >= listA.length) + return false; + if (i >= listB.length) + return true; + var a = listA[i]; + var b = listB[i]; + if (a < b) + return true; + else if (a > b) + return false; + i++; } - return url; } -exports.urlParser = urlParser; +exports.byteLessThan = byteLessThan; /** - * Parses an URL string. + * Decodes a byte sequence into a string. * - * @param input - input string - * @param baseURL - base URL - * @param encodingOverride - encoding override + * @param list - a byte sequence */ -function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { - var e_2, _a, e_3, _b; +function isomorphicDecode(list) { /** - * 1. If url is not given: - * 1.1. Set url to a new URL. - * 1.2. If input contains any leading or trailing C0 control or space, - * validation error. - * 1.3. Remove any leading and trailing C0 control or space from input. + * To isomorphic decode a byte sequence input, return a string whose length is + * equal to input’s length and whose code points have the same values as + * input’s bytes, in the same order. */ - if (url === undefined) { - url = newURL(); - // leading - var leadingControlOrSpace = /^[\u0000-\u001F\u0020]+/; - var trailingControlOrSpace = /[\u0000-\u001F\u0020]+$/; - if (leadingControlOrSpace.test(input) || trailingControlOrSpace.test(input)) { - validationError("Input string contains leading or trailing control characters or space."); + return String.fromCodePoint.apply(String, __spread(list)); +} +exports.isomorphicDecode = isomorphicDecode; +//# sourceMappingURL=ByteSequence.js.map + +/***/ }), + +/***/ 28548: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * A surrogate is a code point that is in the range U+D800 to U+DFFF, inclusive. + */ +exports.Surrogate = /[\uD800-\uDFFF]/; +/** + * A scalar value is a code point that is not a surrogate. + */ +exports.ScalarValue = /[\uD800-\uDFFF]/; +/** + * A noncharacter is a code point that is in the range U+FDD0 to U+FDEF, + * inclusive, or U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, U+2FFFE, U+2FFFF, U+3FFFE, + * U+3FFFF, U+4FFFE, U+4FFFF, U+5FFFE, U+5FFFF, U+6FFFE, U+6FFFF, U+7FFFE, + * U+7FFFF, U+8FFFE, U+8FFFF, U+9FFFE, U+9FFFF, U+AFFFE, U+AFFFF, U+BFFFE, + * U+BFFFF, U+CFFFE, U+CFFFF, U+DFFFE, U+DFFFF, U+EFFFE, U+EFFFF, U+FFFFE, + * U+FFFFF, U+10FFFE, or U+10FFFF. + */ +exports.NonCharacter = /[\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]/; +/** + * An ASCII code point is a code point in the range U+0000 NULL to U+007F + * DELETE, inclusive. + */ +exports.ASCIICodePoint = /[\u0000-\u007F]/; +/** + * An ASCII tab or newline is U+0009 TAB, U+000A LF, or U+000D CR. + */ +exports.ASCIITabOrNewLine = /[\t\n\r]/; +/** + * ASCII whitespace is U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or + * U+0020 SPACE. + */ +exports.ASCIIWhiteSpace = /[\t\n\f\r ]/; +/** + * A C0 control is a code point in the range U+0000 NULL to U+001F + * INFORMATION SEPARATOR ONE, inclusive. + */ +exports.C0Control = /[\u0000-\u001F]/; +/** + * A C0 control or space is a C0 control or U+0020 SPACE. + */ +exports.C0ControlOrSpace = /[\u0000-\u001F ]/; +/** + * A control is a C0 control or a code point in the range U+007F DELETE to + * U+009F APPLICATION PROGRAM COMMAND, inclusive. + */ +exports.Control = /[\u0000-\u001F\u007F-\u009F]/; +/** + * An ASCII digit is a code point in the range U+0030 (0) to U+0039 (9), + * inclusive. + */ +exports.ASCIIDigit = /[0-9]/; +/** + * An ASCII upper hex digit is an ASCII digit or a code point in the range + * U+0041 (A) to U+0046 (F), inclusive. + */ +exports.ASCIIUpperHexDigit = /[0-9A-F]/; +/** + * An ASCII lower hex digit is an ASCII digit or a code point in the range + * U+0061 (a) to U+0066 (f), inclusive. + */ +exports.ASCIILowerHexDigit = /[0-9a-f]/; +/** + * An ASCII hex digit is an ASCII upper hex digit or ASCII lower hex digit. + */ +exports.ASCIIHexDigit = /[0-9A-Fa-f]/; +/** + * An ASCII upper alpha is a code point in the range U+0041 (A) to U+005A (Z), + * inclusive. + */ +exports.ASCIIUpperAlpha = /[A-Z]/; +/** + * An ASCII lower alpha is a code point in the range U+0061 (a) to U+007A (z), + * inclusive. + */ +exports.ASCIILowerAlpha = /[a-z]/; +/** + * An ASCII alpha is an ASCII upper alpha or ASCII lower alpha. + */ +exports.ASCIIAlpha = /[A-Za-z]/; +/** + * An ASCII alphanumeric is an ASCII digit or ASCII alpha. + */ +exports.ASCIIAlphanumeric = /[0-9A-Za-z]/; +//# sourceMappingURL=CodePoints.js.map + +/***/ }), + +/***/ 99387: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; } - input = input.replace(leadingControlOrSpace, ''); - input = input.replace(trailingControlOrSpace, ''); - } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var util_1 = __nccwpck_require__(76195); +/** + * Parses the given byte sequence representing a JSON string into an object. + * + * @param bytes - a byte sequence + */ +function parseJSONFromBytes(bytes) { /** - * 2. If input contains any ASCII tab or newline, validation error. - * 3. Remove all ASCII tab or newline from input. + * 1. Let jsonText be the result of running UTF-8 decode on bytes. [ENCODING] + * 2. Return ? Call(%JSONParse%, undefined, « jsonText »). */ - var tabOrNewline = /[\u0009\u000A\u000D]/g; - if (tabOrNewline.test(input)) { - validationError("Input string contains tab or newline characters."); - } - input = input.replace(tabOrNewline, ''); + var jsonText = util_1.utf8Decode(bytes); + return JSON.parse.call(undefined, jsonText); +} +exports.parseJSONFromBytes = parseJSONFromBytes; +/** + * Serialize the given JavaScript value into a byte sequence. + * + * @param value - a JavaScript value + */ +function serializeJSONToBytes(value) { /** - * 4. Let state be state override if given, or scheme start state otherwise. - * 5. If base is not given, set it to null. - * 6. Let encoding be UTF-8. - * 7. If encoding override is given, set encoding to the result of getting - * an output encoding from encoding override. + * 1. Let jsonString be ? Call(%JSONStringify%, undefined, « value »). + * 2. Return the result of running UTF-8 encode on jsonString. [ENCODING] */ - var state = (stateOverride === undefined ? interfaces_1.ParserState.SchemeStart : stateOverride); - if (baseURL === undefined) - baseURL = null; - var encoding = (encodingOverride === undefined || - encodingOverride === "replacement" || encodingOverride === "UTF-16BE" || - encodingOverride === "UTF-16LE" ? "UTF-8" : encodingOverride); + var jsonString = JSON.stringify.call(undefined, value); + return util_1.utf8Encode(jsonString); +} +exports.serializeJSONToBytes = serializeJSONToBytes; +/** + * Parses the given JSON string into a Realm-independent JavaScript value. + * + * @param jsonText - a JSON string + */ +function parseJSONIntoInfraValues(jsonText) { /** - * 8. Let buffer be the empty string. - * 9. Let the @ flag, [] flag, and passwordTokenSeenFlag be unset. - * 10. Let pointer be a pointer to first code point in input. + * 1. Let jsValue be ? Call(%JSONParse%, undefined, « jsonText »). + * 2. Return the result of converting a JSON-derived JavaScript value to an + * Infra value, given jsValue. */ - var buffer = ""; - var atFlag = false; - var arrayFlag = false; - var passwordTokenSeenFlag = false; - var EOF = ""; - var walker = new util_1.StringWalker(input); + var jsValue = JSON.parse.call(undefined, jsonText); + return convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValue); +} +exports.parseJSONIntoInfraValues = parseJSONIntoInfraValues; +/** + * Parses the value into a Realm-independent JavaScript value. + * + * @param jsValue - a JavaScript value + */ +function convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValue) { + var e_1, _a; /** - * 11. Keep running the following state machine by switching on state. If - * after a run pointer points to the EOF code point, go to the next step. - * Otherwise, increase pointer by one and continue with the state machine. + * 1. If Type(jsValue) is Null, String, or Number, then return jsValue. */ - while (true) { - switch (state) { - case interfaces_1.ParserState.SchemeStart: - /** - * 1. If c is an ASCII alpha, append c, lowercased, to buffer, and set - * state to scheme state. - * 2. Otherwise, if state override is not given, set state to no scheme - * state, and decrease pointer by one. - * 3. Otherwise, validation error, return failure. - */ - if (infra_1.codePoint.ASCIIAlpha.test(walker.c())) { - buffer += walker.c().toLowerCase(); - state = interfaces_1.ParserState.Scheme; - } - else if (stateOverride === undefined) { - state = interfaces_1.ParserState.NoScheme; - walker.pointer--; - } - else { - validationError("Invalid scheme start character."); - return null; - } - break; - case interfaces_1.ParserState.Scheme: - /** - * 1. If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E - * (.), append c, lowercased, to buffer. - */ - if (infra_1.codePoint.ASCIIAlphanumeric.test(walker.c()) || - walker.c() === '+' || walker.c() === '-' || walker.c() === '.') { - buffer += walker.c().toLowerCase(); - } - else if (walker.c() === ':') { - /** - * 2. Otherwise, if c is U+003A (:), then: - * 2.1. If state override is given, then: - * 2.1.1. If url’s scheme is a special scheme and buffer is not a - * special scheme, then return. - * 2.1.2. If url’s scheme is not a special scheme and buffer is a - * special scheme, then return. - * 2.1.3. If url includes credentials or has a non-null port, and - * buffer is "file", then return. - * 2.1.4. If url’s scheme is "file" and its host is an empty host or - * null, then return. - */ - if (stateOverride !== undefined) { - if (isSpecialScheme(url.scheme) && !isSpecialScheme(buffer)) - return url; - if (!isSpecialScheme(url.scheme) && isSpecialScheme(buffer)) - return url; - if ((includesCredentials(url) || url.port !== null) && buffer === "file") - return url; - if (url.scheme === "file" && (url.host === "" || url.host === null)) - return url; - } - /** - * 2.2. Set url’s scheme to buffer. - */ - url.scheme = buffer; - /** - * 2.3. If state override is given, then: - * 2.3.1. If url’s port is url’s scheme’s default port, then set - * url’s port to null. - * 2.3.2. Return. - */ - if (stateOverride !== undefined) { - if (url.port === defaultPort(url.scheme)) { - url.port = null; - } - return url; - } - /** - * 2.4. Set buffer to the empty string. - */ - buffer = ""; - if (url.scheme === "file") { - /** - * 2.5. If url’s scheme is "file", then: - * 2.5.1. If remaining does not start with "//", validation error. - * 2.5.2. Set state to file state. - */ - if (!walker.remaining().startsWith("//")) { - validationError("Invalid file URL scheme, '//' expected."); - } - state = interfaces_1.ParserState.File; - } - else if (isSpecial(url) && baseURL !== null && baseURL.scheme === url.scheme) { - /** - * 2.6. Otherwise, if url is special, base is non-null, and base’s - * scheme is equal to url’s scheme, set state to special relative - * or authority state. - */ - state = interfaces_1.ParserState.SpecialRelativeOrAuthority; - } - else if (isSpecial(url)) { - /** - * 2.7. Otherwise, if url is special, set state to special - * authority slashes state. - */ - state = interfaces_1.ParserState.SpecialAuthoritySlashes; - } - else if (walker.remaining().startsWith("/")) { - /** - * 2.8. Otherwise, if remaining starts with an U+002F (/), set state - * to path or authority state and increase pointer by one. - */ - state = interfaces_1.ParserState.PathOrAuthority; - walker.pointer++; - } - else { - /** - * 2.9. Otherwise, set url’s cannot-be-a-base-URL flag, append an - * empty string to url’s path, and set state to - * cannot-be-a-base-URL path state. - */ - url._cannotBeABaseURLFlag = true; - url.path.push(""); - state = interfaces_1.ParserState.CannotBeABaseURLPath; - } - } - else if (stateOverride === undefined) { - /** - * 3. Otherwise, if state override is not given, set buffer to the - * empty string, state to no scheme state, and start over (from the - * first code point in input). - */ - buffer = ""; - state = interfaces_1.ParserState.NoScheme; - walker.pointer = 0; - continue; - } - else { - /** - * 4. Otherwise, validation error, return failure. - */ - validationError("Invalid input string."); - return null; - } - break; - case interfaces_1.ParserState.NoScheme: - /** - * 1. If base is null, or base’s cannot-be-a-base-URL flag is set - * and c is not U+0023 (#), validation error, return failure. - * 2. Otherwise, if base’s cannot-be-a-base-URL flag is set and - * c is U+0023 (#), set url’s scheme to base’s scheme, url’s path to - * a copy of base’s path, url’s query to base’s query, url’s - * fragment to the empty string, set url’s cannot-be-a-base-URL - * flag, and set state to fragment state. - * 3. Otherwise, if base’s scheme is not "file", set state to - * relative state and decrease pointer by one. - * 4. Otherwise, set state to file state and decrease pointer by one. - */ - if (baseURL === null || (baseURL._cannotBeABaseURLFlag && walker.c() !== '#')) { - validationError("Invalid input string."); - return null; - } - else if (baseURL._cannotBeABaseURLFlag && walker.c() === '#') { - url.scheme = baseURL.scheme; - url.path = infra_1.list.clone(baseURL.path); - url.query = baseURL.query; - url.fragment = ""; - url._cannotBeABaseURLFlag = true; - state = interfaces_1.ParserState.Fragment; - } - else if (baseURL.scheme !== "file") { - state = interfaces_1.ParserState.Relative; - walker.pointer--; - } - else { - state = interfaces_1.ParserState.File; - walker.pointer--; - } - break; - case interfaces_1.ParserState.SpecialRelativeOrAuthority: - /** - * If c is U+002F (/) and remaining starts with U+002F (/), then set - * state to special authority ignore slashes state and increase - * pointer by one. - * Otherwise, validation error, set state to relative state and - * decrease pointer by one. - */ - if (walker.c() === '/' && walker.remaining().startsWith('/')) { - state = interfaces_1.ParserState.SpecialAuthorityIgnoreSlashes; - walker.pointer++; - } - else { - validationError("Invalid input string."); - state = interfaces_1.ParserState.Relative; - walker.pointer--; - } - break; - case interfaces_1.ParserState.PathOrAuthority: - /** - * If c is U+002F (/), then set state to authority state. - * Otherwise, set state to path state, and decrease pointer by one. - */ - if (walker.c() === '/') { - state = interfaces_1.ParserState.Authority; - } - else { - state = interfaces_1.ParserState.Path; - walker.pointer--; - } - break; - case interfaces_1.ParserState.Relative: - /** - * Set url’s scheme to base’s scheme, and then, switching on c: - */ - if (baseURL === null) { - throw new Error("Invalid parser state. Base URL is null."); - } - url.scheme = baseURL.scheme; - switch (walker.c()) { - case EOF: // EOF - /** - * Set url’s username to base’s username, url’s password to base’s - * password, url’s host to base’s host, url’s port to base’s port, - * url’s path to a copy of base’s path, and url’s query to base’s - * query. - */ - url.username = baseURL.username; - url.password = baseURL.password; - url.host = baseURL.host; - url.port = baseURL.port; - url.path = infra_1.list.clone(baseURL.path); - url.query = baseURL.query; - break; - case '/': - /** - * Set state to relative slash state. - */ - state = interfaces_1.ParserState.RelativeSlash; - break; - case '?': - /** - * Set url’s username to base’s username, url’s password to base’s - * password, url’s host to base’s host, url’s port to base’s port, - * url’s path to a copy of base’s path, url’s query to the empty - * string, and state to query state. - */ - url.username = baseURL.username; - url.password = baseURL.password; - url.host = baseURL.host; - url.port = baseURL.port; - url.path = infra_1.list.clone(baseURL.path); - url.query = ""; - state = interfaces_1.ParserState.Query; - break; - case '#': - /** - * Set url’s username to base’s username, url’s password to base’s - * password, url’s host to base’s host, url’s port to base’s port, - * url’s path to a copy of base’s path, url’s query to base’s - * query, url’s fragment to the empty string, and state to - * fragment state. - */ - url.username = baseURL.username; - url.password = baseURL.password; - url.host = baseURL.host; - url.port = baseURL.port; - url.path = infra_1.list.clone(baseURL.path); - url.query = baseURL.query; - url.fragment = ""; - state = interfaces_1.ParserState.Fragment; - break; - default: - /** - * If url is special and c is U+005C (\), validation error, - * set state to relative slash state. - * Otherwise, run these steps: - * 1. Set url’s username to base’s username, url’s password to - * base’s password, url’s host to base’s host, url’s port to - * base’s port, url’s path to a copy of base’s path, and then - * remove url’s path’s last item, if any. - * 2. Set state to path state, and decrease pointer by one. - */ - if (isSpecial(url) && walker.c() === '\\') { - validationError("Invalid input string."); - state = interfaces_1.ParserState.RelativeSlash; - } - else { - url.username = baseURL.username; - url.password = baseURL.password; - url.host = baseURL.host; - url.port = baseURL.port; - url.path = infra_1.list.clone(baseURL.path); - if (url.path.length !== 0) - url.path.splice(url.path.length - 1, 1); - state = interfaces_1.ParserState.Path; - walker.pointer--; - } - break; - } - break; - case interfaces_1.ParserState.RelativeSlash: - /** - * 1. If url is special and c is U+002F (/) or U+005C (\), then: - * 1.1. If c is U+005C (\), validation error. - * 1.2. Set state to special authority ignore slashes state. - * 2. Otherwise, if c is U+002F (/), then set state to authority state. - * 3. Otherwise, set url’s username to base’s username, url’s password - * to base’s password, url’s host to base’s host, url’s port to base’s - * port, state to path state, and then, decrease pointer by one. - */ - if (isSpecial(url) && (walker.c() === '/' || walker.c() === '\\')) { - if (walker.c() === '\\') { - validationError("Invalid input string."); - } - state = interfaces_1.ParserState.SpecialAuthorityIgnoreSlashes; - } - else if (walker.c() === '/') { - state = interfaces_1.ParserState.Authority; + if (jsValue === null || util_1.isString(jsValue) || util_1.isNumber(jsValue)) + return jsValue; + /** + * 2. If IsArray(jsValue) is true, then: + * 2.1. Let result be an empty list. + * 2.2. Let length be ! ToLength(! Get(jsValue, "length")). + * 2.3. For each index of the range 0 to length − 1, inclusive: + * 2.3.1. Let indexName be ! ToString(index). + * 2.3.2. Let jsValueAtIndex be ! Get(jsValue, indexName). + * 2.3.3. Let infraValueAtIndex be the result of converting a JSON-derived + * JavaScript value to an Infra value, given jsValueAtIndex. + * 2.3.4. Append infraValueAtIndex to result. + * 2.8. Return result. + */ + if (util_1.isArray(jsValue)) { + var result = new Array(); + try { + for (var jsValue_1 = __values(jsValue), jsValue_1_1 = jsValue_1.next(); !jsValue_1_1.done; jsValue_1_1 = jsValue_1.next()) { + var jsValueAtIndex = jsValue_1_1.value; + result.push(convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValueAtIndex)); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (jsValue_1_1 && !jsValue_1_1.done && (_a = jsValue_1.return)) _a.call(jsValue_1); + } + finally { if (e_1) throw e_1.error; } + } + return result; + } + else if (util_1.isObject(jsValue)) { + /** + * 3. Let result be an empty ordered map. + * 4. For each key of ! jsValue.[[OwnPropertyKeys]](): + * 4.1. Let jsValueAtKey be ! Get(jsValue, key). + * 4.2. Let infraValueAtKey be the result of converting a JSON-derived + * JavaScript value to an Infra value, given jsValueAtKey. + * 4.3. Set result[key] to infraValueAtKey. + * 5. Return result. + */ + var result = new Map(); + for (var key in jsValue) { + /* istanbul ignore else */ + if (jsValue.hasOwnProperty(key)) { + var jsValueAtKey = jsValue[key]; + result.set(key, convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValueAtKey)); + } + } + return result; + } + /* istanbul ignore next */ + return jsValue; +} +exports.convertAJSONDerivedJavaScriptValueToAnInfraValue = convertAJSONDerivedJavaScriptValueToAnInfraValue; +//# sourceMappingURL=JSON.js.map + +/***/ }), + +/***/ 20340: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var util_1 = __nccwpck_require__(76195); +/** + * Adds the given item to the end of the list. + * + * @param list - a list + * @param item - an item + */ +function append(list, item) { + list.push(item); +} +exports.append = append; +/** + * Extends a list by appending all items from another list. + * + * @param listA - a list to extend + * @param listB - a list containing items to append to `listA` + */ +function extend(listA, listB) { + listA.push.apply(listA, __spread(listB)); +} +exports.extend = extend; +/** + * Inserts the given item to the start of the list. + * + * @param list - a list + * @param item - an item + */ +function prepend(list, item) { + list.unshift(item); +} +exports.prepend = prepend; +/** + * Replaces the given item or all items matching condition with a new item. + * + * @param list - a list + * @param conditionOrItem - an item to replace or a condition matching items + * to replace + * @param item - an item + */ +function replace(list, conditionOrItem, newItem) { + var e_1, _a; + var i = 0; + try { + for (var list_1 = __values(list), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) { + var oldItem = list_1_1.value; + if (util_1.isFunction(conditionOrItem)) { + if (!!conditionOrItem.call(null, oldItem)) { + list[i] = newItem; } - else { - if (baseURL === null) { - throw new Error("Invalid parser state. Base URL is null."); - } - url.username = baseURL.username; - url.password = baseURL.password; - url.host = baseURL.host; - url.port = baseURL.port; - state = interfaces_1.ParserState.Path; - walker.pointer--; + } + else if (oldItem === conditionOrItem) { + list[i] = newItem; + return; + } + i++; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (list_1_1 && !list_1_1.done && (_a = list_1.return)) _a.call(list_1); + } + finally { if (e_1) throw e_1.error; } + } +} +exports.replace = replace; +/** + * Inserts the given item before the given index. + * + * @param list - a list + * @param item - an item + */ +function insert(list, item, index) { + list.splice(index, 0, item); +} +exports.insert = insert; +/** + * Removes the given item or all items matching condition. + * + * @param list - a list + * @param conditionOrItem - an item to remove or a condition matching items + * to remove + */ +function remove(list, conditionOrItem) { + var i = list.length; + while (i--) { + var oldItem = list[i]; + if (util_1.isFunction(conditionOrItem)) { + if (!!conditionOrItem.call(null, oldItem)) { + list.splice(i, 1); + } + } + else if (oldItem === conditionOrItem) { + list.splice(i, 1); + return; + } + } +} +exports.remove = remove; +/** + * Removes all items from the list. + */ +function empty(list) { + list.length = 0; +} +exports.empty = empty; +/** + * Determines if the list contains the given item or any items matching + * condition. + * + * @param list - a list + * @param conditionOrItem - an item to a condition to match + */ +function contains(list, conditionOrItem) { + var e_2, _a; + try { + for (var list_2 = __values(list), list_2_1 = list_2.next(); !list_2_1.done; list_2_1 = list_2.next()) { + var oldItem = list_2_1.value; + if (util_1.isFunction(conditionOrItem)) { + if (!!conditionOrItem.call(null, oldItem)) { + return true; } - break; - case interfaces_1.ParserState.SpecialAuthoritySlashes: - /** - * If c is U+002F (/) and remaining starts with U+002F (/), then set - * state to special authority ignore slashes state and increase - * pointer by one. - * Otherwise, validation error, set state to special authority ignore - * slashes state, and decrease pointer by one. - */ - if (walker.c() === '/' && walker.remaining().startsWith('/')) { - state = interfaces_1.ParserState.SpecialAuthorityIgnoreSlashes; - walker.pointer++; + } + else if (oldItem === conditionOrItem) { + return true; + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (list_2_1 && !list_2_1.done && (_a = list_2.return)) _a.call(list_2); + } + finally { if (e_2) throw e_2.error; } + } + return false; +} +exports.contains = contains; +/** + * Returns the count of items in the list matching the given condition. + * + * @param list - a list + * @param condition - an optional condition to match + */ +function size(list, condition) { + var e_3, _a; + if (condition === undefined) { + return list.length; + } + else { + var count = 0; + try { + for (var list_3 = __values(list), list_3_1 = list_3.next(); !list_3_1.done; list_3_1 = list_3.next()) { + var item = list_3_1.value; + if (!!condition.call(null, item)) { + count++; } - else { - validationError("Expected '//'."); - state = interfaces_1.ParserState.SpecialAuthorityIgnoreSlashes; - walker.pointer--; + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (list_3_1 && !list_3_1.done && (_a = list_3.return)) _a.call(list_3); + } + finally { if (e_3) throw e_3.error; } + } + return count; + } +} +exports.size = size; +/** + * Determines if the list is empty. + * + * @param list - a list + */ +function isEmpty(list) { + return list.length === 0; +} +exports.isEmpty = isEmpty; +/** + * Returns an iterator for the items of the list. + * + * @param list - a list + * @param condition - an optional condition to match + */ +function forEach(list, condition) { + var list_4, list_4_1, item, e_4_1; + var e_4, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!(condition === undefined)) return [3 /*break*/, 2]; + return [5 /*yield**/, __values(list)]; + case 1: + _b.sent(); + return [3 /*break*/, 9]; + case 2: + _b.trys.push([2, 7, 8, 9]); + list_4 = __values(list), list_4_1 = list_4.next(); + _b.label = 3; + case 3: + if (!!list_4_1.done) return [3 /*break*/, 6]; + item = list_4_1.value; + if (!!!condition.call(null, item)) return [3 /*break*/, 5]; + return [4 /*yield*/, item]; + case 4: + _b.sent(); + _b.label = 5; + case 5: + list_4_1 = list_4.next(); + return [3 /*break*/, 3]; + case 6: return [3 /*break*/, 9]; + case 7: + e_4_1 = _b.sent(); + e_4 = { error: e_4_1 }; + return [3 /*break*/, 9]; + case 8: + try { + if (list_4_1 && !list_4_1.done && (_a = list_4.return)) _a.call(list_4); } - break; - case interfaces_1.ParserState.SpecialAuthorityIgnoreSlashes: - /** - * If c is neither U+002F (/) nor U+005C (\), then set state to - * authority state and decrease pointer by one. - * Otherwise, validation error. - */ - if (walker.c() !== '/' && walker.c() !== '\\') { - state = interfaces_1.ParserState.Authority; - walker.pointer--; - } - else { - validationError("Unexpected '/' or '\\'."); - } - break; - case interfaces_1.ParserState.Authority: - /** - * 1. If c is U+0040 (@), then: - */ - if (walker.c() === '@') { - /** - * 1.1. Validation error. - * 1.2. If the @ flag is set, prepend "%40" to buffer. - * 1.3. Set the @ flag. - * 1.4. For each codePoint in buffer: - */ - validationError("Unexpected '@'."); - if (atFlag) - buffer = '%40' + buffer; - atFlag = true; - try { - for (var buffer_1 = (e_2 = void 0, __values(buffer)), buffer_1_1 = buffer_1.next(); !buffer_1_1.done; buffer_1_1 = buffer_1.next()) { - var codePoint = buffer_1_1.value; - /** - * 1.4.1. If codePoint is U+003A (:) and passwordTokenSeenFlag is - * unset, then set passwordTokenSeenFlag and continue. - * 1.4.2. Let encodedCodePoints be the result of running UTF-8 - * percent encode codePoint using the userinfo percent-encode set. - * 1.4.3. If passwordTokenSeenFlag is set, then append - * encodedCodePoints to url’s password. - * 1.4.4. Otherwise, append encodedCodePoints to url’s username. - */ - if (codePoint === ':' && !passwordTokenSeenFlag) { - passwordTokenSeenFlag = true; - continue; - } - var encodedCodePoints = utf8PercentEncode(codePoint, _userInfoPercentEncodeSet); - if (passwordTokenSeenFlag) { - url.password += encodedCodePoints; - } - else { - url.username += encodedCodePoints; - } - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (buffer_1_1 && !buffer_1_1.done && (_a = buffer_1.return)) _a.call(buffer_1); - } - finally { if (e_2) throw e_2.error; } - } - /** - * 1.5. Set buffer to the empty string. - */ - buffer = ""; - } - else if (walker.c() === EOF || walker.c() === '/' || walker.c() === '?' || walker.c() === '#' || - (isSpecial(url) && walker.c() === '\\')) { - /** - * 2. Otherwise, if one of the following is true - * - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#) - * - url is special and c is U+005C (\) - * then: - * 2.1. If @ flag is set and buffer is the empty string, validation - * error, return failure. - * 2.2. Decrease pointer by the number of code points in buffer plus - * one, set buffer to the empty string, and set state to host state. - */ - if (atFlag && buffer === "") { - validationError("Invalid input string."); - return null; - } - walker.pointer -= (buffer.length + 1); - buffer = ""; - state = interfaces_1.ParserState.Host; - } - else { - /** - * 3. Otherwise, append c to buffer. - */ - buffer += walker.c(); - } - break; - case interfaces_1.ParserState.Host: - case interfaces_1.ParserState.Hostname: - if (stateOverride !== undefined && url.scheme === "file") { - /** - * 1. If state override is given and url’s scheme is "file", then - * decrease pointer by one and set state to file host state. - */ - walker.pointer--; - state = interfaces_1.ParserState.FileHost; - } - else if (walker.c() === ':' && !arrayFlag) { - /** - * 2. Otherwise, if c is U+003A (:) and the [] flag is unset, then: - * 2.1. If buffer is the empty string, validation error, return - * failure. - * 2.2. Let host be the result of host parsing buffer with url is - * not special. - * 2.3. If host is failure, then return failure. - * 2.4. Set url’s host to host, buffer to the empty string, and - * state to port state. - * 2.5. If state override is given and state override is hostname - * state, then return. - */ - if (buffer === "") { - validationError("Invalid input string."); - return null; - } - var host = hostParser(buffer, !isSpecial(url)); - if (host === null) - return null; - url.host = host; - buffer = ""; - state = interfaces_1.ParserState.Port; - if (stateOverride === interfaces_1.ParserState.Hostname) - return url; + finally { if (e_4) throw e_4.error; } + return [7 /*endfinally*/]; + case 9: return [2 /*return*/]; + } + }); +} +exports.forEach = forEach; +/** + * Creates and returns a shallow clone of list. + * + * @param list - a list + */ +function clone(list) { + return new (Array.bind.apply(Array, __spread([void 0], list)))(); +} +exports.clone = clone; +/** + * Returns a new list containing items from the list sorted in ascending + * order. + * + * @param list - a list + * @param lessThanAlgo - a function that returns `true` if its first argument + * is less than its second argument, and `false` otherwise. + */ +function sortInAscendingOrder(list, lessThanAlgo) { + return list.sort(function (itemA, itemB) { + return lessThanAlgo.call(null, itemA, itemB) ? -1 : 1; + }); +} +exports.sortInAscendingOrder = sortInAscendingOrder; +/** + * Returns a new list containing items from the list sorted in descending + * order. + * + * @param list - a list + * @param lessThanAlgo - a function that returns `true` if its first argument + * is less than its second argument, and `false` otherwise. + */ +function sortInDescendingOrder(list, lessThanAlgo) { + return list.sort(function (itemA, itemB) { + return lessThanAlgo.call(null, itemA, itemB) ? 1 : -1; + }); +} +exports.sortInDescendingOrder = sortInDescendingOrder; +//# sourceMappingURL=List.js.map + +/***/ }), + +/***/ 22298: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var util_1 = __nccwpck_require__(76195); +/** + * Gets the value corresponding to the given key. + * + * @param map - a map + * @param key - a key + */ +function get(map, key) { + return map.get(key); +} +exports.get = get; +/** + * Sets the value corresponding to the given key. + * + * @param map - a map + * @param key - a key + * @param val - a value + */ +function set(map, key, val) { + map.set(key, val); +} +exports.set = set; +/** + * Removes the item with the given key or all items matching condition. + * + * @param map - a map + * @param conditionOrItem - the key of an item to remove or a condition matching + * items to remove + */ +function remove(map, conditionOrItem) { + var e_1, _a, e_2, _b; + if (!util_1.isFunction(conditionOrItem)) { + map.delete(conditionOrItem); + } + else { + var toRemove = []; + try { + for (var map_1 = __values(map), map_1_1 = map_1.next(); !map_1_1.done; map_1_1 = map_1.next()) { + var item = map_1_1.value; + if (!!conditionOrItem.call(null, item)) { + toRemove.push(item[0]); } - else if (walker.c() === EOF || walker.c() === '/' || walker.c() === '?' || walker.c() === '#' || - (isSpecial(url) && walker.c() === '\\')) { - /** - * 3. Otherwise, if one of the following is true - * - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#) - * - url is special and c is U+005C (\) - * then decrease pointer by one, and then: - * 3.1. If url is special and buffer is the empty string, validation - * error, return failure. - * 3.2. Otherwise, if state override is given, buffer is the empty - * string, and either url includes credentials or url’s port is - * non-null, validation error, return. - * 3.3. Let host be the result of host parsing buffer with url is - * not special. - * 3.4. If host is failure, then return failure. - * 3.5. Set url’s host to host, buffer to the empty string, and - * state to path start state. - * 3.6. If state override is given, then return. - */ - walker.pointer--; - if (isSpecial(url) && buffer === "") { - validationError("Invalid input string."); - return null; - } - else if (stateOverride !== undefined && buffer === "" && - (includesCredentials(url) || url.port !== null)) { - validationError("Invalid input string."); - return url; - } - var host = hostParser(buffer, !isSpecial(url)); - if (host === null) - return null; - url.host = host; - buffer = ""; - state = interfaces_1.ParserState.PathStart; - if (stateOverride !== undefined) - return url; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (map_1_1 && !map_1_1.done && (_a = map_1.return)) _a.call(map_1); + } + finally { if (e_1) throw e_1.error; } + } + try { + for (var toRemove_1 = __values(toRemove), toRemove_1_1 = toRemove_1.next(); !toRemove_1_1.done; toRemove_1_1 = toRemove_1.next()) { + var key = toRemove_1_1.value; + map.delete(key); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (toRemove_1_1 && !toRemove_1_1.done && (_b = toRemove_1.return)) _b.call(toRemove_1); + } + finally { if (e_2) throw e_2.error; } + } + } +} +exports.remove = remove; +/** + * Determines if the map contains a value with the given key. + * + * @param map - a map + * @param conditionOrItem - the key of an item to match or a condition matching + * items + */ +function contains(map, conditionOrItem) { + var e_3, _a; + if (!util_1.isFunction(conditionOrItem)) { + return map.has(conditionOrItem); + } + else { + try { + for (var map_2 = __values(map), map_2_1 = map_2.next(); !map_2_1.done; map_2_1 = map_2.next()) { + var item = map_2_1.value; + if (!!conditionOrItem.call(null, item)) { + return true; } - else { - /** - * 4. Otherwise: - * 4.1. If c is U+005B ([), then set the [] flag. - * 4.2. If c is U+005D (]), then unset the [] flag. - * 4.3. Append c to buffer. - */ - if (walker.c() === '[') - arrayFlag = true; - if (walker.c() === ']') - arrayFlag = false; - buffer += walker.c(); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (map_2_1 && !map_2_1.done && (_a = map_2.return)) _a.call(map_2); + } + finally { if (e_3) throw e_3.error; } + } + return false; + } +} +exports.contains = contains; +/** + * Gets the keys of the map. + * + * @param map - a map + */ +function keys(map) { + return new Set(map.keys()); +} +exports.keys = keys; +/** + * Gets the values of the map. + * + * @param map - a map + */ +function values(map) { + return __spread(map.values()); +} +exports.values = values; +/** + * Gets the size of the map. + * + * @param map - a map + * @param condition - an optional condition to match + */ +function size(map, condition) { + var e_4, _a; + if (condition === undefined) { + return map.size; + } + else { + var count = 0; + try { + for (var map_3 = __values(map), map_3_1 = map_3.next(); !map_3_1.done; map_3_1 = map_3.next()) { + var item = map_3_1.value; + if (!!condition.call(null, item)) { + count++; } - break; - case interfaces_1.ParserState.Port: - if (infra_1.codePoint.ASCIIDigit.test(walker.c())) { - /** - * 1. If c is an ASCII digit, append c to buffer. - */ - buffer += walker.c(); + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (map_3_1 && !map_3_1.done && (_a = map_3.return)) _a.call(map_3); + } + finally { if (e_4) throw e_4.error; } + } + return count; + } +} +exports.size = size; +/** + * Determines if the map is empty. + * + * @param map - a map + */ +function isEmpty(map) { + return map.size === 0; +} +exports.isEmpty = isEmpty; +/** + * Returns an iterator for the items of the map. + * + * @param map - a map + * @param condition - an optional condition to match + */ +function forEach(map, condition) { + var map_4, map_4_1, item, e_5_1; + var e_5, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!(condition === undefined)) return [3 /*break*/, 2]; + return [5 /*yield**/, __values(map)]; + case 1: + _b.sent(); + return [3 /*break*/, 9]; + case 2: + _b.trys.push([2, 7, 8, 9]); + map_4 = __values(map), map_4_1 = map_4.next(); + _b.label = 3; + case 3: + if (!!map_4_1.done) return [3 /*break*/, 6]; + item = map_4_1.value; + if (!!!condition.call(null, item)) return [3 /*break*/, 5]; + return [4 /*yield*/, item]; + case 4: + _b.sent(); + _b.label = 5; + case 5: + map_4_1 = map_4.next(); + return [3 /*break*/, 3]; + case 6: return [3 /*break*/, 9]; + case 7: + e_5_1 = _b.sent(); + e_5 = { error: e_5_1 }; + return [3 /*break*/, 9]; + case 8: + try { + if (map_4_1 && !map_4_1.done && (_a = map_4.return)) _a.call(map_4); } - else if (walker.c() === EOF || walker.c() === '/' || walker.c() === '?' || walker.c() === '#' || - (isSpecial(url) && walker.c() === '\\') || stateOverride) { - /** - * 2. Otherwise, if one of the following is true - * - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#) - * - url is special and c is U+005C (\) - * - state override is given - * then: - */ - if (buffer !== "") { - /** - * 2.1. If buffer is not the empty string, then: - * 2.1.1. Let port be the mathematical integer value that is - * represented by buffer in radix-10 using ASCII digits for digits - * with values 0 through 9. - * 2.1.2. If port is greater than 2**16 − 1, validation error, - * return failure. - * 2.1.3. Set url’s port to null, if port is url’s scheme’s default - * port, and to port otherwise. - * 2.1.4. Set buffer to the empty string. - */ - if (buffer !== "") { - var port = parseInt(buffer, 10); - if (port > Math.pow(2, 16) - 1) { - validationError("Invalid port number."); - return null; - } - url.port = (port === defaultPort(url.scheme) ? null : port); - buffer = ""; - } - } - /** - * 2.2. If state override is given, then return. - * 2.3. Set state to path start state, and decrease pointer by one. - */ - if (stateOverride !== undefined) { - return url; - } - state = interfaces_1.ParserState.PathStart; - walker.pointer--; + finally { if (e_5) throw e_5.error; } + return [7 /*endfinally*/]; + case 9: return [2 /*return*/]; + } + }); +} +exports.forEach = forEach; +/** + * Creates and returns a shallow clone of map. + * + * @param map - a map + */ +function clone(map) { + return new Map(map); +} +exports.clone = clone; +/** + * Returns a new map containing items from the map sorted in ascending + * order. + * + * @param map - a map + * @param lessThanAlgo - a function that returns `true` if its first argument + * is less than its second argument, and `false` otherwise. + */ +function sortInAscendingOrder(map, lessThanAlgo) { + var list = new (Array.bind.apply(Array, __spread([void 0], map)))(); + list.sort(function (itemA, itemB) { + return lessThanAlgo.call(null, itemA, itemB) ? -1 : 1; + }); + return new Map(list); +} +exports.sortInAscendingOrder = sortInAscendingOrder; +/** + * Returns a new map containing items from the map sorted in descending + * order. + * + * @param map - a map + * @param lessThanAlgo - a function that returns `true` if its first argument + * is less than its second argument, and `false` otherwise. + */ +function sortInDescendingOrder(map, lessThanAlgo) { + var list = new (Array.bind.apply(Array, __spread([void 0], map)))(); + list.sort(function (itemA, itemB) { + return lessThanAlgo.call(null, itemA, itemB) ? 1 : -1; + }); + return new Map(list); +} +exports.sortInDescendingOrder = sortInDescendingOrder; +//# sourceMappingURL=Map.js.map + +/***/ }), + +/***/ 93764: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.HTML = "http://www.w3.org/1999/xhtml"; +exports.XML = "http://www.w3.org/XML/1998/namespace"; +exports.XMLNS = "http://www.w3.org/2000/xmlns/"; +exports.MathML = "http://www.w3.org/1998/Math/MathML"; +exports.SVG = "http://www.w3.org/2000/svg"; +exports.XLink = "http://www.w3.org/1999/xlink"; +//# sourceMappingURL=Namespace.js.map + +/***/ }), + +/***/ 39201: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Appends the given item to the queue. + * + * @param list - a list + * @param item - an item + */ +function enqueue(list, item) { + list.push(item); +} +exports.enqueue = enqueue; +/** + * Removes and returns an item from the queue. + * + * @param list - a list + */ +function dequeue(list) { + return list.shift() || null; +} +exports.dequeue = dequeue; +//# sourceMappingURL=Queue.js.map + +/***/ }), + +/***/ 35931: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var util_1 = __nccwpck_require__(76195); +/** + * Adds the given item to the end of the set. + * + * @param set - a set + * @param item - an item + */ +function append(set, item) { + set.add(item); +} +exports.append = append; +/** + * Extends a set by appending all items from another set. + * + * @param setA - a list to extend + * @param setB - a list containing items to append to `setA` + */ +function extend(setA, setB) { + setB.forEach(setA.add, setA); +} +exports.extend = extend; +/** + * Inserts the given item to the start of the set. + * + * @param set - a set + * @param item - an item + */ +function prepend(set, item) { + var cloned = new Set(set); + set.clear(); + set.add(item); + cloned.forEach(set.add, set); +} +exports.prepend = prepend; +/** + * Replaces the given item or all items matching condition with a new item. + * + * @param set - a set + * @param conditionOrItem - an item to replace or a condition matching items + * to replace + * @param item - an item + */ +function replace(set, conditionOrItem, newItem) { + var e_1, _a; + var newSet = new Set(); + try { + for (var set_1 = __values(set), set_1_1 = set_1.next(); !set_1_1.done; set_1_1 = set_1.next()) { + var oldItem = set_1_1.value; + if (util_1.isFunction(conditionOrItem)) { + if (!!conditionOrItem.call(null, oldItem)) { + newSet.add(newItem); } else { - /** - * 3. Otherwise, validation error, return failure. - */ - validationError("Invalid input string."); - return null; - } - break; - case interfaces_1.ParserState.File: - /** - * 1. Set url’s scheme to "file". - */ - url.scheme = "file"; - if (walker.c() === '/' || walker.c() === '\\') { - /** - * 2. If c is U+002F (/) or U+005C (\), then: - * 2.1. If c is U+005C (\), validation error. - * 2.2. Set state to file slash state. - */ - if (walker.c() === '\\') { - validationError("Invalid input string."); - } - state = interfaces_1.ParserState.FileSlash; - } - else if (baseURL !== null && baseURL.scheme === "file") { - /** - * 3. Otherwise, if base is non-null and base’s scheme is "file", - * switch on c: - */ - switch (walker.c()) { - case EOF: - /** - * Set url’s host to base’s host, url’s path to a copy of base’s - * path, and url’s query to base’s query. - */ - url.host = baseURL.host; - url.path = infra_1.list.clone(baseURL.path); - url.query = baseURL.query; - break; - case '?': - /** - * Set url’s host to base’s host, url’s path to a copy of base’s - * path, url’s query to the empty string, and state to query - * state. - */ - url.host = baseURL.host; - url.path = infra_1.list.clone(baseURL.path); - url.query = ""; - state = interfaces_1.ParserState.Query; - break; - case '#': - /** - * Set url’s host to base’s host, url’s path to a copy of base’s - * path, url’s query to base’s query, url’s fragment to the - * empty string, and state to fragment state. - */ - url.host = baseURL.host; - url.path = infra_1.list.clone(baseURL.path); - url.query = baseURL.query; - url.fragment = ""; - state = interfaces_1.ParserState.Fragment; - break; - default: - /** - * 1. If the substring from pointer in input does not start - * with a Windows drive letter, then set url’s host to base’s - * host, url’s path to a copy of base’s path, and then shorten - * url’s path. - * _Note:_ is a (platform-independent) Windows drive letter - * quirk. - * 2. Otherwise, validation error. - * 3. Set state to path state, and decrease pointer by one. - */ - if (!startsWithAWindowsDriveLetter(walker.substring())) { - url.host = baseURL.host; - url.path = infra_1.list.clone(baseURL.path); - shorten(url); - } - else { - validationError("Unexpected windows drive letter in input string."); - } - state = interfaces_1.ParserState.Path; - walker.pointer--; - break; - } + newSet.add(oldItem); } - else { - /** - * 4. Otherwise, set state to path state, and decrease pointer by - * one. - */ - state = interfaces_1.ParserState.Path; - walker.pointer--; + } + else if (oldItem === conditionOrItem) { + newSet.add(newItem); + } + else { + newSet.add(oldItem); + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (set_1_1 && !set_1_1.done && (_a = set_1.return)) _a.call(set_1); + } + finally { if (e_1) throw e_1.error; } + } + set.clear(); + newSet.forEach(set.add, set); +} +exports.replace = replace; +/** + * Inserts the given item before the given index. + * + * @param set - a set + * @param item - an item + */ +function insert(set, item, index) { + var e_2, _a; + var newSet = new Set(); + var i = 0; + try { + for (var set_2 = __values(set), set_2_1 = set_2.next(); !set_2_1.done; set_2_1 = set_2.next()) { + var oldItem = set_2_1.value; + if (i === index) + newSet.add(item); + newSet.add(oldItem); + i++; + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (set_2_1 && !set_2_1.done && (_a = set_2.return)) _a.call(set_2); + } + finally { if (e_2) throw e_2.error; } + } + set.clear(); + newSet.forEach(set.add, set); +} +exports.insert = insert; +/** + * Removes the given item or all items matching condition. + * + * @param set - a set + * @param conditionOrItem - an item to remove or a condition matching items + * to remove + */ +function remove(set, conditionOrItem) { + var e_3, _a, e_4, _b; + if (!util_1.isFunction(conditionOrItem)) { + set.delete(conditionOrItem); + } + else { + var toRemove = []; + try { + for (var set_3 = __values(set), set_3_1 = set_3.next(); !set_3_1.done; set_3_1 = set_3.next()) { + var item = set_3_1.value; + if (!!conditionOrItem.call(null, item)) { + toRemove.push(item); } - break; - case interfaces_1.ParserState.FileSlash: - if (walker.c() === '/' || walker.c() === '\\') { - /** - * 1. If c is U+002F (/) or U+005C (\), then: - * 1.1. If c is U+005C (\), validation error. - * 1.2. Set state to file host state. - */ - if (walker.c() === '\\') { - validationError("Invalid input string."); - } - state = interfaces_1.ParserState.FileHost; + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (set_3_1 && !set_3_1.done && (_a = set_3.return)) _a.call(set_3); + } + finally { if (e_3) throw e_3.error; } + } + try { + for (var toRemove_1 = __values(toRemove), toRemove_1_1 = toRemove_1.next(); !toRemove_1_1.done; toRemove_1_1 = toRemove_1.next()) { + var oldItem = toRemove_1_1.value; + set.delete(oldItem); + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (toRemove_1_1 && !toRemove_1_1.done && (_b = toRemove_1.return)) _b.call(toRemove_1); + } + finally { if (e_4) throw e_4.error; } + } + } +} +exports.remove = remove; +/** + * Removes all items from the set. + */ +function empty(set) { + set.clear(); +} +exports.empty = empty; +/** + * Determines if the set contains the given item or any items matching + * condition. + * + * @param set - a set + * @param conditionOrItem - an item to a condition to match + */ +function contains(set, conditionOrItem) { + var e_5, _a; + if (!util_1.isFunction(conditionOrItem)) { + return set.has(conditionOrItem); + } + else { + try { + for (var set_4 = __values(set), set_4_1 = set_4.next(); !set_4_1.done; set_4_1 = set_4.next()) { + var oldItem = set_4_1.value; + if (!!conditionOrItem.call(null, oldItem)) { + return true; } - else { - /** - * 2. Otherwise: - * 2.1. If base is non-null, base’s scheme is "file", and the - * substring from pointer in input does not start with a Windows - * drive letter, then: - * 2.1.1. If base’s path[0] is a normalized Windows drive letter, - * then append base’s path[0] to url’s path. - * _Note:_ is a (platform-independent) Windows drive letter - * quirk. Both url’s and base’s host are null under these conditions - * and therefore not copied. - * 2.1.2. Otherwise, set url’s host to base’s host. - * 2.2. Set state to path state, and decrease pointer by one. - */ - if (baseURL !== null && baseURL.scheme === "file" && - !startsWithAWindowsDriveLetter(walker.substring())) { - if (isNormalizedWindowsDriveLetter(baseURL.path[0])) { - url.path.push(baseURL.path[0]); - } - else { - url.host = baseURL.host; - } - } - state = interfaces_1.ParserState.Path; - walker.pointer--; + } + } + catch (e_5_1) { e_5 = { error: e_5_1 }; } + finally { + try { + if (set_4_1 && !set_4_1.done && (_a = set_4.return)) _a.call(set_4); + } + finally { if (e_5) throw e_5.error; } + } + } + return false; +} +exports.contains = contains; +/** + * Returns the count of items in the set matching the given condition. + * + * @param set - a set + * @param condition - an optional condition to match + */ +function size(set, condition) { + var e_6, _a; + if (condition === undefined) { + return set.size; + } + else { + var count = 0; + try { + for (var set_5 = __values(set), set_5_1 = set_5.next(); !set_5_1.done; set_5_1 = set_5.next()) { + var item = set_5_1.value; + if (!!condition.call(null, item)) { + count++; } - break; - case interfaces_1.ParserState.FileHost: - if (walker.c() === EOF || walker.c() === '/' || walker.c() === '\\' || - walker.c() === '?' || walker.c() === '#') { - /** - * 1. If c is the EOF code point, U+002F (/), U+005C (\), U+003F (?), - * or U+0023 (#), then decrease pointer by one and then: - */ - walker.pointer--; - if (stateOverride === undefined && isWindowsDriveLetter(buffer)) { - /** - * 1.1. If state override is not given and buffer is a Windows drive - * letter, validation error, set state to path state. - * _Note:_ is a (platform-independent) Windows drive letter - * quirk. buffer is not reset here and instead used in the path state. - */ - validationError("Unexpected windows drive letter in input string."); - state = interfaces_1.ParserState.Path; - } - else if (buffer === "") { - /** - * 1.2. Otherwise, if buffer is the empty string, then: - * 1.2.1. Set url’s host to the empty string. - * 1.2.2. If state override is given, then return. - * 1.2.3. Set state to path start state. - */ - url.host = ""; - if (stateOverride !== undefined) - return url; - state = interfaces_1.ParserState.PathStart; - } - else { - /** - * 1.3. Otherwise, run these steps: - * 1.3.1. Let host be the result of host parsing buffer with url - * is not special. - * 1.3.2. If host is failure, then return failure. - * 1.3.3. If host is "localhost", then set host to the empty - * string. - * 1.3.4. Set url’s host to host. - * 1.3.5. If state override is given, then return. - * 1.3.6. Set buffer to the empty string and state to path start - * state. - */ - var host = hostParser(buffer, !isSpecial(url)); - if (host === null) - return null; - if (host === "localhost") - host = ""; - url.host = host; - if (stateOverride !== undefined) - return url; - buffer = ""; - state = interfaces_1.ParserState.PathStart; - } - } - else { - /** - * 2. Otherwise, append c to buffer. - */ - buffer += walker.c(); - } - break; - case interfaces_1.ParserState.PathStart: - if (isSpecial(url)) { - /** - * 1. If url is special, then: - * 1.1. If c is U+005C (\), validation error. - * 1.2. Set state to path state. - * 1.3. If c is neither U+002F (/) nor U+005C (\), then decrease - * pointer by one. - */ - if (walker.c() === '\\') { - validationError("Invalid input string."); - } - state = interfaces_1.ParserState.Path; - if (walker.c() !== '/' && walker.c() !== '\\') - walker.pointer--; - } - else if (stateOverride === undefined && walker.c() === '?') { - /** - * 2. Otherwise, if state override is not given and c is U+003F (?), - * set url’s query to the empty string and state to query state. - */ - url.query = ""; - state = interfaces_1.ParserState.Query; - } - else if (stateOverride === undefined && walker.c() === '#') { - /** - * 3. Otherwise, if state override is not given and c is U+0023 (#), - * set url’s fragment to the empty string and state to fragment - * state. - */ - url.fragment = ""; - state = interfaces_1.ParserState.Fragment; - } - else if (walker.c() !== EOF) { - /** - * 4. Otherwise, if c is not the EOF code point: - * 4.1. Set state to path state. - * 4.2. If c is not U+002F (/), then decrease pointer by one. - */ - state = interfaces_1.ParserState.Path; - if (walker.c() !== '/') - walker.pointer--; - } - break; - case interfaces_1.ParserState.Path: - if ((walker.c() === EOF || walker.c() === '/') || - (isSpecial(url) && walker.c() === '\\') || - (stateOverride === undefined && (walker.c() === '?' || walker.c() === '#'))) { - /** - * 1. If one of the following is true - * - c is the EOF code point or U+002F (/) - * - url is special and c is U+005C (\) - * - state override is not given and c is U+003F (?) or U+0023 (#) - * then: - */ - if (isSpecial(url) && walker.c() === '\\') { - /** - * 1.1 If url is special and c is U+005C (\), validation error. - */ - validationError("Invalid input string."); - } - if (isDoubleDotPathSegment(buffer)) { - /** - * 1.2. If buffer is a double-dot path segment, shorten url’s path, - * and then if neither c is U+002F (/), nor url is special and c is - * U+005C (\), append the empty string to url’s path. - */ - shorten(url); - if (walker.c() !== '/' && !(isSpecial(url) && walker.c() === '\\')) { - url.path.push(""); - } - } - else if (isSingleDotPathSegment(buffer) && walker.c() !== '/' && - !(isSpecial(url) && walker.c() === '\\')) { - /** - * 1.3. Otherwise, if buffer is a single-dot path segment and if - * neither c is U+002F (/), nor url is special and c is U+005C (\), - * append the empty string to url’s path. - */ - url.path.push(""); - } - else if (!isSingleDotPathSegment(buffer)) { - /** - * 1.4. Otherwise, if buffer is not a single-dot path segment, then: - */ - if (url.scheme === "file" && url.path.length === 0 && - isWindowsDriveLetter(buffer)) { - /** - * 1.4.1. If url’s scheme is "file", url’s path is empty, and - * buffer is a Windows drive letter, then: - * 1.4.1.1. If url’s host is neither the empty string nor null, - * validation error, set url’s host to the empty string. - * 1.4.1.2. Replace the second code point in buffer with U+003A (:). - * _Note:_ is a (platform-independent) Windows drive letter quirk. - */ - if (url.host !== null && url.host !== "") { - validationError("Invalid input string."); - url.host = ""; - } - var bufferCodePoints = Array.from(buffer); - buffer = bufferCodePoints.slice(0, 1) + ':' + bufferCodePoints.slice(2); - } - /** - * 1.4.2. Append buffer to url’s path. - */ - url.path.push(buffer); - } - /** - * 1.5. Set buffer to the empty string. - */ - buffer = ""; - /** - * 1.6. If url’s scheme is "file" and c is the EOF code point, - * U+003F (?), or U+0023 (#), then while url’s path’s size is - * greater than 1 and url’s path[0] is the empty string, validation - * error, remove the first item from url’s path. - */ - if (url.scheme === "file" && (walker.c() === EOF || walker.c() === '?' || walker.c() === '#')) { - while (url.path.length > 1 && url.path[0] === "") { - validationError("Invalid input string."); - url.path.splice(0, 1); - } - } - /** - * 1.7. If c is U+003F (?), then set url’s query to the empty string - * and state to query state. - * 1.8. If c is U+0023 (#), then set url’s fragment to the empty - * string and state to fragment state. - */ - if (walker.c() === '?') { - url.query = ""; - state = interfaces_1.ParserState.Query; - } - if (walker.c() === '#') { - url.fragment = ""; - state = interfaces_1.ParserState.Fragment; - } - } - else { - /** - * 2. Otherwise, run these steps: - * 2.1. If c is not a URL code point and not U+0025 (%), validation - * error. - * 2.2. If c is U+0025 (%) and remaining does not start with two - * ASCII hex digits, validation error. - * 2.3. UTF-8 percent encode c using the path percent-encode set, - * and append the result to buffer. - */ - if (!_urlCodePoints.test(walker.c()) && walker.c() !== '%') { - validationError("Character is not a URL code point or a percent encoded character."); - } - if (walker.c() === '%' && !/^[0-9a-fA-F][0-9a-fA-F]/.test(walker.remaining())) { - validationError("Percent encoded character must be followed by two hex digits."); - } - buffer += utf8PercentEncode(walker.c(), _pathPercentEncodeSet); - } - break; - case interfaces_1.ParserState.CannotBeABaseURLPath: - /** - * 1. If c is U+003F (?), then set url’s query to the empty string and - * state to query state. - * 2. Otherwise, if c is U+0023 (#), then set url’s fragment to the - * empty string and state to fragment state. - * 3. Otherwise: - * 3.1. If c is not the EOF code point, not a URL code point, and not - * U+0025 (%), validation error. - * 3.2. If c is U+0025 (%) and remaining does not start with two ASCII - * hex digits, validation error. - * 3.3. If c is not the EOF code point, UTF-8 percent encode c using - * the C0 control percent-encode set, and append the result to url’s - * path[0]. - */ - if (walker.c() === '?') { - url.query = ""; - state = interfaces_1.ParserState.Query; - } - else if (walker.c() === '#') { - url.fragment = ""; - state = interfaces_1.ParserState.Fragment; - } - else { - if (walker.c() !== EOF && !_urlCodePoints.test(walker.c()) && walker.c() !== '%') { - validationError("Character is not a URL code point or a percent encoded character."); - } - if (walker.c() === '%' && !/^[0-9a-fA-F][0-9a-fA-F]/.test(walker.remaining())) { - validationError("Percent encoded character must be followed by two hex digits."); - } - if (walker.c() !== EOF) { - url.path[0] += utf8PercentEncode(walker.c(), _c0ControlPercentEncodeSet); - } - } - break; - case interfaces_1.ParserState.Query: - /** - * 1. If encoding is not UTF-8 and one of the following is true - * - url is not special - * - url’s scheme is "ws" or "wss" - * then set encoding to UTF-8. - */ - if (encoding !== "UTF-8" && (!isSpecial(url) || - url.scheme === "ws" || url.scheme === "wss")) { - encoding = "UTF-8"; - } - if (stateOverride === undefined && walker.c() === '#') { - /** - * 2. If state override is not given and c is U+0023 (#), then set - * url’s fragment to the empty string and state to fragment state. - */ - url.fragment = ""; - state = interfaces_1.ParserState.Fragment; - } - else if (walker.c() !== EOF) { - /** - * 3. Otherwise, if c is not the EOF code point: - * 3.1. If c is not a URL code point and not U+0025 (%), validation - * error. - */ - if (!_urlCodePoints.test(walker.c()) && walker.c() !== '%') { - validationError("Character is not a URL code point or a percent encoded character."); - } - /** - * 3.2. If c is U+0025 (%) and remaining does not start with two - * ASCII hex digits, validation error. - */ - if (walker.c() === '%' && !/^[0-9a-fA-F][0-9a-fA-F]/.test(walker.remaining())) { - validationError("Percent encoded character must be followed by two hex digits."); - } - /** - * 3.3. Let bytes be the result of encoding c using encoding. - */ - if (encoding.toUpperCase() !== "UTF-8") { - throw new Error("Only UTF-8 encoding is supported."); - } - var bytes = util_1.utf8Encode(walker.c()); - /** - * 3.4. If bytes starts with `&#` and ends with 0x3B (;), then: - */ - if (bytes.length >= 3 && bytes[0] === 38 && bytes[1] === 35 && - bytes[bytes.length - 1] === 59) { - /** - * 3.4.1. Replace `&#` at the start of bytes with `%26%23`. - * 3.4.2. Replace 0x3B (;) at the end of bytes with `%3B`. - * 3.4.4. Append bytes, isomorphic decoded, to url’s query. - * _Note:_ can happen when encoding code points using a - * non-UTF-8 encoding. - */ - bytes = bytes.subarray(2, bytes.length - 1); - url.query += "%26%23" + infra_1.byteSequence.isomorphicDecode(bytes) + "%3B"; - } - else { - try { - /** - * 3.5. Otherwise, for each byte in bytes: - * 3.5.1. If one of the following is true - * - byte is less than 0x21 (!) - * - byte is greater than 0x7E (~) - * - byte is 0x22 ("), 0x23 (#), 0x3C (<), or 0x3E (>) - * - byte is 0x27 (') and url is special - * then append byte, percent encoded, to url’s query. - * 3.5.2. Otherwise, append a code point whose value is byte to - * url’s query. - */ - for (var bytes_1 = (e_3 = void 0, __values(bytes)), bytes_1_1 = bytes_1.next(); !bytes_1_1.done; bytes_1_1 = bytes_1.next()) { - var byte = bytes_1_1.value; - if (byte < 0x21 || byte > 0x7E || byte === 0x22 || - byte === 0x23 || byte === 0x3C || byte === 0x3E || - (byte === 0x27 && isSpecial(url))) { - url.query += percentEncode(byte); - } - else { - url.query += String.fromCharCode(byte); - } - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (bytes_1_1 && !bytes_1_1.done && (_b = bytes_1.return)) _b.call(bytes_1); - } - finally { if (e_3) throw e_3.error; } - } - } - } - break; - case interfaces_1.ParserState.Fragment: - /** - * Switching on c: - * - The EOF code point - * Do nothing. - * - U+0000 NULL - * Validation error. - * - Otherwise - * 1. If c is not a URL code point and not U+0025 (%), validation - * error. - * 2. If c is U+0025 (%) and remaining does not start with two ASCII - * hex digits, validation error. - * 3. UTF-8 percent encode c using the fragment percent-encode set and - * append the result to url’s fragment. - */ - if (walker.c() === EOF) { - // - } - else if (walker.c() === "\u0000") { - validationError("NULL character in input string."); - } - else { - if (!_urlCodePoints.test(walker.c()) && walker.c() !== '%') { - validationError("Unexpected character in fragment string."); - } - if (walker.c() === '%' && !/^[A-Za-z0-9][A-Za-z0-9]/.test(walker.remaining())) { - validationError("Unexpected character in fragment string."); - } - url.fragment += utf8PercentEncode(walker.c(), _fragmentPercentEncodeSet); - } - break; + } } - if (walker.eof) - break; - else - walker.pointer++; + catch (e_6_1) { e_6 = { error: e_6_1 }; } + finally { + try { + if (set_5_1 && !set_5_1.done && (_a = set_5.return)) _a.call(set_5); + } + finally { if (e_6) throw e_6.error; } + } + return count; } - /** - * 12. Return url. - */ - return url; } -exports.basicURLParser = basicURLParser; +exports.size = size; /** - * Sets a URL's username. + * Determines if the set is empty. * - * @param url - a URL - * @param username - username string + * @param set - a set */ -function setTheUsername(url, username) { - var e_4, _a; - /** - * 1. Set url’s username to the empty string. - * 2. For each code point in username, UTF-8 percent encode it using the - * userinfo percent-encode set, and append the result to url’s username. - */ - var result = ""; +function isEmpty(set) { + return set.size === 0; +} +exports.isEmpty = isEmpty; +/** + * Returns an iterator for the items of the set. + * + * @param set - a set + * @param condition - an optional condition to match + */ +function forEach(set, condition) { + var set_6, set_6_1, item, e_7_1; + var e_7, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!(condition === undefined)) return [3 /*break*/, 2]; + return [5 /*yield**/, __values(set)]; + case 1: + _b.sent(); + return [3 /*break*/, 9]; + case 2: + _b.trys.push([2, 7, 8, 9]); + set_6 = __values(set), set_6_1 = set_6.next(); + _b.label = 3; + case 3: + if (!!set_6_1.done) return [3 /*break*/, 6]; + item = set_6_1.value; + if (!!!condition.call(null, item)) return [3 /*break*/, 5]; + return [4 /*yield*/, item]; + case 4: + _b.sent(); + _b.label = 5; + case 5: + set_6_1 = set_6.next(); + return [3 /*break*/, 3]; + case 6: return [3 /*break*/, 9]; + case 7: + e_7_1 = _b.sent(); + e_7 = { error: e_7_1 }; + return [3 /*break*/, 9]; + case 8: + try { + if (set_6_1 && !set_6_1.done && (_a = set_6.return)) _a.call(set_6); + } + finally { if (e_7) throw e_7.error; } + return [7 /*endfinally*/]; + case 9: return [2 /*return*/]; + } + }); +} +exports.forEach = forEach; +/** + * Creates and returns a shallow clone of set. + * + * @param set - a set + */ +function clone(set) { + return new Set(set); +} +exports.clone = clone; +/** + * Returns a new set containing items from the set sorted in ascending + * order. + * + * @param set - a set + * @param lessThanAlgo - a function that returns `true` if its first argument + * is less than its second argument, and `false` otherwise. + */ +function sortInAscendingOrder(set, lessThanAlgo) { + var list = new (Array.bind.apply(Array, __spread([void 0], set)))(); + list.sort(function (itemA, itemB) { + return lessThanAlgo.call(null, itemA, itemB) ? -1 : 1; + }); + return new Set(list); +} +exports.sortInAscendingOrder = sortInAscendingOrder; +/** + * Returns a new set containing items from the set sorted in descending + * order. + * + * @param set - a set + * @param lessThanAlgo - a function that returns `true` if its first argument + * is less than its second argument, and `false` otherwise. + */ +function sortInDescendingOrder(set, lessThanAlgo) { + var list = new (Array.bind.apply(Array, __spread([void 0], set)))(); + list.sort(function (itemA, itemB) { + return lessThanAlgo.call(null, itemA, itemB) ? 1 : -1; + }); + return new Set(list); +} +exports.sortInDescendingOrder = sortInDescendingOrder; +/** + * Determines if a set is a subset of another set. + * + * @param subset - a set + * @param superset - a superset possibly containing all items from `subset`. + */ +function isSubsetOf(subset, superset) { + var e_8, _a; try { - for (var username_1 = __values(username), username_1_1 = username_1.next(); !username_1_1.done; username_1_1 = username_1.next()) { - var codePoint = username_1_1.value; - result += utf8PercentEncode(codePoint, _userInfoPercentEncodeSet); + for (var subset_1 = __values(subset), subset_1_1 = subset_1.next(); !subset_1_1.done; subset_1_1 = subset_1.next()) { + var item = subset_1_1.value; + if (!superset.has(item)) + return false; + } + } + catch (e_8_1) { e_8 = { error: e_8_1 }; } + finally { + try { + if (subset_1_1 && !subset_1_1.done && (_a = subset_1.return)) _a.call(subset_1); + } + finally { if (e_8) throw e_8.error; } + } + return true; +} +exports.isSubsetOf = isSubsetOf; +/** + * Determines if a set is a superset of another set. + * + * @param superset - a set + * @param subset - a subset possibly contained within `superset`. + */ +function isSupersetOf(superset, subset) { + return isSubsetOf(subset, superset); +} +exports.isSupersetOf = isSupersetOf; +/** + * Returns a new set with items that are contained in both sets. + * + * @param setA - a set + * @param setB - a set + */ +function intersection(setA, setB) { + var e_9, _a; + var newSet = new Set(); + try { + for (var setA_1 = __values(setA), setA_1_1 = setA_1.next(); !setA_1_1.done; setA_1_1 = setA_1.next()) { + var item = setA_1_1.value; + if (setB.has(item)) + newSet.add(item); + } + } + catch (e_9_1) { e_9 = { error: e_9_1 }; } + finally { + try { + if (setA_1_1 && !setA_1_1.done && (_a = setA_1.return)) _a.call(setA_1); + } + finally { if (e_9) throw e_9.error; } + } + return newSet; +} +exports.intersection = intersection; +/** + * Returns a new set with items from both sets. + * + * @param setA - a set + * @param setB - a set + */ +function union(setA, setB) { + var newSet = new Set(setA); + setB.forEach(newSet.add, newSet); + return newSet; +} +exports.union = union; +/** + * Returns a set of integers from `n` to `m` inclusive. + * + * @param n - starting number + * @param m - ending number + */ +function range(n, m) { + var newSet = new Set(); + for (var i = n; i <= m; i++) { + newSet.add(i); + } + return newSet; +} +exports.range = range; +//# sourceMappingURL=Set.js.map + +/***/ }), + +/***/ 38784: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Pushes the given item to the stack. + * + * @param list - a list + * @param item - an item + */ +function push(list, item) { + list.push(item); +} +exports.push = push; +/** + * Pops and returns an item from the stack. + * + * @param list - a list + */ +function pop(list) { + return list.pop() || null; +} +exports.pop = pop; +//# sourceMappingURL=Stack.js.map + +/***/ }), + +/***/ 13203: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var CodePoints_1 = __nccwpck_require__(28548); +var ByteSequence_1 = __nccwpck_require__(71627); +var Byte_1 = __nccwpck_require__(42460); +var util_1 = __nccwpck_require__(76195); +/** + * Determines if the string `a` is a code unit prefix of string `b`. + * + * @param a - a string + * @param b - a string + */ +function isCodeUnitPrefix(a, b) { + /** + * 1. Let i be 0. + * 2. While true: + * 2.1. Let aCodeUnit be the ith code unit of a if i is less than a’s length; + * otherwise null. + * 2.2. Let bCodeUnit be the ith code unit of b if i is less than b’s length; + * otherwise null. + * 2.3. If bCodeUnit is null, then return true. + * 2.4. Return false if aCodeUnit is different from bCodeUnit. + * 2.5. Set i to i + 1. + */ + var i = 0; + while (true) { + var aCodeUnit = i < a.length ? a.charCodeAt(i) : null; + var bCodeUnit = i < b.length ? b.charCodeAt(i) : null; + if (aCodeUnit === null) + return true; + if (aCodeUnit !== bCodeUnit) + return false; + i++; + } +} +exports.isCodeUnitPrefix = isCodeUnitPrefix; +/** + * Determines if the string `a` is a code unit less than string `b`. + * + * @param a - a string + * @param b - a string + */ +function isCodeUnitLessThan(a, b) { + /** + * 1. If b is a code unit prefix of a, then return false. + * 2. If a is a code unit prefix of b, then return true. + * 3. Let n be the smallest index such that the nth code unit of a is + * different from the nth code unit of b. (There has to be such an index, + * since neither string is a prefix of the other.) + * 4. If the nth code unit of a is less than the nth code unit of b, then + * return true. + * 5. Return false. + */ + if (isCodeUnitPrefix(b, a)) + return false; + if (isCodeUnitPrefix(a, b)) + return true; + for (var i = 0; i < Math.min(a.length, b.length); i++) { + var aCodeUnit = a.charCodeAt(i); + var bCodeUnit = b.charCodeAt(i); + if (aCodeUnit === bCodeUnit) + continue; + return (aCodeUnit < bCodeUnit); + } + /* istanbul ignore next */ + return false; +} +exports.isCodeUnitLessThan = isCodeUnitLessThan; +/** + * Isomorphic encodes the given string. + * + * @param str - a string + */ +function isomorphicEncode(str) { + var e_1, _a; + /** + * 1. Assert: input contains no code points greater than U+00FF. + * 2. Return a byte sequence whose length is equal to input’s length and whose + * bytes have the same values as input’s code points, in the same order. + */ + var codePoints = Array.from(str); + var bytes = new Uint8Array(codePoints.length); + var i = 0; + try { + for (var str_1 = __values(str), str_1_1 = str_1.next(); !str_1_1.done; str_1_1 = str_1.next()) { + var codePoint = str_1_1.value; + var byte = codePoint.codePointAt(0); + console.assert(byte !== undefined && byte <= 0x00FF, "isomorphicEncode requires string bytes to be less than or equal to 0x00FF."); + if (byte !== undefined && byte <= 0x00FF) { + bytes[i++] = byte; + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (str_1_1 && !str_1_1.done && (_a = str_1.return)) _a.call(str_1); + } + finally { if (e_1) throw e_1.error; } + } + return bytes; +} +exports.isomorphicEncode = isomorphicEncode; +/** + * Determines if the given string is An ASCII string. + * + * @param str - a string + */ +function isASCIIString(str) { + /** + * An ASCII string is a string whose code points are all ASCII code points. + */ + return /^[\u0000-\u007F]*$/.test(str); +} +exports.isASCIIString = isASCIIString; +/** + * Converts all uppercase ASCII code points to lowercase. + * + * @param str - a string + */ +function asciiLowercase(str) { + var e_2, _a; + /** + * To ASCII lowercase a string, replace all ASCII upper alphas in the string + * with their corresponding code point in ASCII lower alpha. + */ + var result = ""; + try { + for (var str_2 = __values(str), str_2_1 = str_2.next(); !str_2_1.done; str_2_1 = str_2.next()) { + var c = str_2_1.value; + var code = c.codePointAt(0); + if (code !== undefined && code >= 0x41 && code <= 0x5A) { + result += String.fromCodePoint(code + 0x20); + } + else { + result += c; + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (str_2_1 && !str_2_1.done && (_a = str_2.return)) _a.call(str_2); + } + finally { if (e_2) throw e_2.error; } + } + return result; +} +exports.asciiLowercase = asciiLowercase; +/** + * Converts all uppercase ASCII code points to uppercase. + * + * @param str - a string + */ +function asciiUppercase(str) { + var e_3, _a; + /** + * To ASCII uppercase a string, replace all ASCII lower alphas in the string + * with their corresponding code point in ASCII upper alpha. + */ + var result = ""; + try { + for (var str_3 = __values(str), str_3_1 = str_3.next(); !str_3_1.done; str_3_1 = str_3.next()) { + var c = str_3_1.value; + var code = c.codePointAt(0); + if (code !== undefined && code >= 0x61 && code <= 0x7A) { + result += String.fromCodePoint(code - 0x20); + } + else { + result += c; + } + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (str_3_1 && !str_3_1.done && (_a = str_3.return)) _a.call(str_3); + } + finally { if (e_3) throw e_3.error; } + } + return result; +} +exports.asciiUppercase = asciiUppercase; +/** + * Compares two ASCII strings case-insensitively. + * + * @param a - a string + * @param b - a string + */ +function asciiCaseInsensitiveMatch(a, b) { + /** + * A string A is an ASCII case-insensitive match for a string B, if the ASCII + * lowercase of A is the ASCII lowercase of B. + */ + return asciiLowercase(a) === asciiLowercase(b); +} +exports.asciiCaseInsensitiveMatch = asciiCaseInsensitiveMatch; +/** + * ASCII encodes a string. + * + * @param str - a string + */ +function asciiEncode(str) { + /** + * 1. Assert: input is an ASCII string. + * 2. Return the isomorphic encoding of input. + */ + console.assert(isASCIIString(str), "asciiEncode requires an ASCII string."); + return isomorphicEncode(str); +} +exports.asciiEncode = asciiEncode; +/** + * ASCII decodes a byte sequence. + * + * @param bytes - a byte sequence + */ +function asciiDecode(bytes) { + var e_4, _a; + try { + /** + * 1. Assert: All bytes in input are ASCII bytes. + * 2. Return the isomorphic decoding of input. + */ + for (var bytes_1 = __values(bytes), bytes_1_1 = bytes_1.next(); !bytes_1_1.done; bytes_1_1 = bytes_1.next()) { + var byte = bytes_1_1.value; + console.assert(Byte_1.isASCIIByte(byte), "asciiDecode requires an ASCII byte sequence."); + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (bytes_1_1 && !bytes_1_1.done && (_a = bytes_1.return)) _a.call(bytes_1); + } + finally { if (e_4) throw e_4.error; } + } + return ByteSequence_1.isomorphicDecode(bytes); +} +exports.asciiDecode = asciiDecode; +/** + * Strips newline characters from a string. + * + * @param str - a string + */ +function stripNewlines(str) { + /** + * To strip newlines from a string, remove any U+000A LF and U+000D CR code + * points from the string. + */ + return str.replace(/[\n\r]/g, ""); +} +exports.stripNewlines = stripNewlines; +/** + * Normalizes newline characters in a string by converting consecutive + * carriage-return newline characters and also single carriage return characters + * into a single newline. + * + * @param str - a string + */ +function normalizeNewlines(str) { + /** + * To normalize newlines in a string, replace every U+000D CR U+000A LF code + * point pair with a single U+000A LF code point, and then replace every + * remaining U+000D CR code point with a U+000A LF code point. + */ + return str.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); +} +exports.normalizeNewlines = normalizeNewlines; +/** + * Removes leading and trailing whitespace characters from a string. + * + * @param str - a string + */ +function stripLeadingAndTrailingASCIIWhitespace(str) { + /** + * To strip leading and trailing ASCII whitespace from a string, remove all + * ASCII whitespace that are at the start or the end of the string. + */ + return str.replace(/^[\t\n\f\r ]+/, "").replace(/[\t\n\f\r ]+$/, ""); +} +exports.stripLeadingAndTrailingASCIIWhitespace = stripLeadingAndTrailingASCIIWhitespace; +/** + * Removes consecutive newline characters from a string. + * + * @param str - a string + */ +function stripAndCollapseASCIIWhitespace(str) { + /** + * To strip and collapse ASCII whitespace in a string, replace any sequence of + * one or more consecutive code points that are ASCII whitespace in the string + * with a single U+0020 SPACE code point, and then remove any leading and + * trailing ASCII whitespace from that string. + */ + return stripLeadingAndTrailingASCIIWhitespace(str.replace(/[\t\n\f\r ]{2,}/g, " ")); +} +exports.stripAndCollapseASCIIWhitespace = stripAndCollapseASCIIWhitespace; +/** + * Collects a sequence of code points matching a given condition from the input + * string. + * + * @param condition - a condition to match + * @param input - a string + * @param options - starting position + */ +function collectASequenceOfCodePoints(condition, input, options) { + /** + * 1. Let result be the empty string. + * 2. While position doesn’t point past the end of input and the code point at + * position within input meets the condition condition: + * 2.1. Append that code point to the end of result. + * 2.2. Advance position by 1. + * 3. Return result. + */ + if (!util_1.isArray(input)) + return collectASequenceOfCodePoints(condition, Array.from(input), options); + var result = ""; + while (options.position < input.length && !!condition.call(null, input[options.position])) { + result += input[options.position]; + options.position++; + } + return result; +} +exports.collectASequenceOfCodePoints = collectASequenceOfCodePoints; +/** + * Skips over ASCII whitespace. + * + * @param input - input string + * @param options - starting position + */ +function skipASCIIWhitespace(input, options) { + /** + * To skip ASCII whitespace within a string input given a position variable + * position, collect a sequence of code points that are ASCII whitespace from + * input given position. The collected code points are not used, but position + * is still updated. + */ + collectASequenceOfCodePoints(function (str) { return CodePoints_1.ASCIIWhiteSpace.test(str); }, input, options); +} +exports.skipASCIIWhitespace = skipASCIIWhitespace; +/** + * Solits a string at the given delimiter. + * + * @param input - input string + * @param delimiter - a delimiter string + */ +function strictlySplit(input, delimiter) { + /** + * 1. Let position be a position variable for input, initially pointing at the + * start of input. + * 2. Let tokens be a list of strings, initially empty. + * 3. Let token be the result of collecting a sequence of code points that are + * not equal to delimiter from input, given position. + * 4. Append token to tokens. + * 5. While position is not past the end of input: + * 5.1. Assert: the code point at position within input is delimiter. + * 5.2. Advance position by 1. + * 5.3. Let token be the result of collecting a sequence of code points that + * are not equal to delimiter from input, given position. + * 5.4. Append token to tokens. + * 6. Return tokens. + */ + if (!util_1.isArray(input)) + return strictlySplit(Array.from(input), delimiter); + var options = { position: 0 }; + var tokens = []; + var token = collectASequenceOfCodePoints(function (str) { return delimiter !== str; }, input, options); + tokens.push(token); + while (options.position < input.length) { + console.assert(input[options.position] === delimiter, "strictlySplit found no delimiter in input string."); + options.position++; + token = collectASequenceOfCodePoints(function (str) { return delimiter !== str; }, input, options); + tokens.push(token); + } + return tokens; +} +exports.strictlySplit = strictlySplit; +/** + * Splits a string on ASCII whitespace. + * + * @param input - a string + */ +function splitAStringOnASCIIWhitespace(input) { + /** + * 1. Let position be a position variable for input, initially pointing at the + * start of input. + * 2. Let tokens be a list of strings, initially empty. + * 3. Skip ASCII whitespace within input given position. + * 4. While position is not past the end of input: + * 4.1. Let token be the result of collecting a sequence of code points that + * are not ASCII whitespace from input, given position. + * 4.2. Append token to tokens. + * 4.3. Skip ASCII whitespace within input given position. + * 5. Return tokens. + */ + if (!util_1.isArray(input)) + return splitAStringOnASCIIWhitespace(Array.from(input)); + var options = { position: 0 }; + var tokens = []; + skipASCIIWhitespace(input, options); + while (options.position < input.length) { + var token = collectASequenceOfCodePoints(function (str) { return !CodePoints_1.ASCIIWhiteSpace.test(str); }, input, options); + tokens.push(token); + skipASCIIWhitespace(input, options); + } + return tokens; +} +exports.splitAStringOnASCIIWhitespace = splitAStringOnASCIIWhitespace; +/** + * Splits a string on commas. + * + * @param input - a string + */ +function splitAStringOnCommas(input) { + /** + * 1. Let position be a position variable for input, initially pointing at the + * start of input. + * 2. Let tokens be a list of strings, initially empty. + * 3. While position is not past the end of input: + * 3.1. Let token be the result of collecting a sequence of code points that + * are not U+002C (,) from input, given position. + * 3.2. Strip leading and trailing ASCII whitespace from token. + * 3.3. Append token to tokens. + * 3.4. If position is not past the end of input, then: + * 3.4.1. Assert: the code point at position within input is U+002C (,). + * 3.4.2. Advance position by 1. + * 4. Return tokens. + */ + if (!util_1.isArray(input)) + return splitAStringOnCommas(Array.from(input)); + var options = { position: 0 }; + var tokens = []; + while (options.position < input.length) { + var token = collectASequenceOfCodePoints(function (str) { return str !== ','; }, input, options); + tokens.push(stripLeadingAndTrailingASCIIWhitespace(token)); + if (options.position < input.length) { + console.assert(input[options.position] === ',', "splitAStringOnCommas found no delimiter in input string."); + options.position++; + } + } + return tokens; +} +exports.splitAStringOnCommas = splitAStringOnCommas; +/** + * Concatenates a list of strings with the given separator. + * + * @param list - a list of strings + * @param separator - a separator string + */ +function concatenate(list, separator) { + if (separator === void 0) { separator = ""; } + /** + * 1. If list is empty, then return the empty string. + * 2. If separator is not given, then set separator to the empty string. + * 3. Return a string whose contents are list’s items, in order, separated + * from each other by separator. + */ + if (list.length === 0) + return ""; + return list.join(separator); +} +exports.concatenate = concatenate; +//# sourceMappingURL=String.js.map + +/***/ }), + +/***/ 84251: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var base64 = __importStar(__nccwpck_require__(28585)); +exports.base64 = base64; +var byte = __importStar(__nccwpck_require__(42460)); +exports.byte = byte; +var byteSequence = __importStar(__nccwpck_require__(71627)); +exports.byteSequence = byteSequence; +var codePoint = __importStar(__nccwpck_require__(28548)); +exports.codePoint = codePoint; +var json = __importStar(__nccwpck_require__(99387)); +exports.json = json; +var list = __importStar(__nccwpck_require__(20340)); +exports.list = list; +var map = __importStar(__nccwpck_require__(22298)); +exports.map = map; +var namespace = __importStar(__nccwpck_require__(93764)); +exports.namespace = namespace; +var queue = __importStar(__nccwpck_require__(39201)); +exports.queue = queue; +var set = __importStar(__nccwpck_require__(35931)); +exports.set = set; +var stack = __importStar(__nccwpck_require__(38784)); +exports.stack = stack; +var string = __importStar(__nccwpck_require__(13203)); +exports.string = string; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 53568: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var util_1 = __nccwpck_require__(76195); +var interfaces_1 = __nccwpck_require__(31752); +var infra_1 = __nccwpck_require__(84251); +var url_1 = __nccwpck_require__(57310); +var _validationErrorCallback; +/** + * Default ports for a special URL scheme. + */ +var _defaultPorts = { + "ftp": 21, + "file": null, + "http": 80, + "https": 443, + "ws": 80, + "wss": 443 +}; +/** + * The C0 control percent-encode set are the C0 controls and all code points + * greater than U+007E (~). + */ +var _c0ControlPercentEncodeSet = /[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +/** + * The fragment percent-encode set is the C0 control percent-encode set and + * U+0020 SPACE, U+0022 ("), U+003C (<), U+003E (>), and U+0060 (`). + */ +var _fragmentPercentEncodeSet = /[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +/** + * The path percent-encode set is the fragment percent-encode set and + * U+0023 (#), U+003F (?), U+007B ({), and U+007D (}). + */ +var _pathPercentEncodeSet = /[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +/** + * The userinfo percent-encode set is the path percent-encode set and + * U+002F (/), U+003A (:), U+003B (;), U+003D (=), U+0040 (@), U+005B ([), + * U+005C (\), U+005D (]), U+005E (^), and U+007C (|). + */ +var _userInfoPercentEncodeSet = /[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +/** + * The URL code points are ASCII alphanumeric, U+0021 (!), U+0024 ($), + * U+0026 (&), U+0027 ('), U+0028 LEFT PARENTHESIS, U+0029 RIGHT PARENTHESIS, + * U+002A (*), U+002B (+), U+002C (,), U+002D (-), U+002E (.), U+002F (/), + * U+003A (:), U+003B (;), U+003D (=), U+003F (?), U+0040 (@), U+005F (_), + * U+007E (~), and code points in the range U+00A0 to U+10FFFD, inclusive, + * excluding surrogates and noncharacters. + */ +var _urlCodePoints = /[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/; +/** + * A forbidden host code point is U+0000 NULL, U+0009 TAB, U+000A LF, + * U+000D CR, U+0020 SPACE, U+0023 (#), U+0025 (%), U+002F (/), U+003A (:), + * U+003F (?), U+0040 (@), U+005B ([), U+005C (\), or U+005D (]). + */ +var _forbiddenHostCodePoint = /[\0\t\f\r #%/:?@\[\\\]]/; +/** + * Sets the callback function for validation errors. + * + * @param validationErrorCallback - a callback function to be called when a + * validation error occurs + */ +function setValidationErrorCallback(validationErrorCallback) { + _validationErrorCallback = validationErrorCallback; +} +exports.setValidationErrorCallback = setValidationErrorCallback; +/** + * Generates a validation error. + * + * @param message - error message + */ +function validationError(message) { + if (_validationErrorCallback !== undefined) { + _validationErrorCallback.call(null, "Validation Error: " + message); + } +} +/** + * Creates a new URL. + */ +function newURL() { + return { + scheme: '', + username: '', + password: '', + host: null, + port: null, + path: [], + query: null, + fragment: null, + _cannotBeABaseURLFlag: false, + _blobURLEntry: null + }; +} +exports.newURL = newURL; +/** + * Determines if the scheme is a special scheme. + * + * @param scheme - a scheme + */ +function isSpecialScheme(scheme) { + return (scheme in _defaultPorts); +} +exports.isSpecialScheme = isSpecialScheme; +/** + * Determines if the URL has a special scheme. + * + * @param url - an URL + */ +function isSpecial(url) { + return isSpecialScheme(url.scheme); +} +exports.isSpecial = isSpecial; +/** + * Returns the default port for a special scheme. + * + * @param scheme - a scheme + */ +function defaultPort(scheme) { + return _defaultPorts[scheme] || null; +} +exports.defaultPort = defaultPort; +/** + * Determines if the URL has credentials. + * + * @param url - an URL + */ +function includesCredentials(url) { + return url.username !== '' || url.password !== ''; +} +exports.includesCredentials = includesCredentials; +/** + * Determines if an URL cannot have credentials. + * + * @param url - an URL + */ +function cannotHaveAUsernamePasswordPort(url) { + /** + * A URL cannot have a username/password/port if its host is null or the + * empty string, its cannot-be-a-base-URL flag is set, or its scheme is + * "file". + */ + return (url.host === null || url.host === "" || url._cannotBeABaseURLFlag || + url.scheme === "file"); +} +exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; +/** + * Serializes an URL into a string. + * + * @param url - an URL + */ +function urlSerializer(url, excludeFragmentFlag) { + var e_1, _a; + if (excludeFragmentFlag === void 0) { excludeFragmentFlag = false; } + /** + * 1. Let output be url’s scheme and U+003A (:) concatenated. + */ + var output = url.scheme + ':'; + /** + * 2. If url’s host is non-null: + */ + if (url.host !== null) { + /** + * 2.1. Append "//" to output. + */ + output += '//'; + /** + * 2.2. If url includes credentials, then: + */ + if (includesCredentials(url)) { + /** + * 2.2.1. Append url’s username to output. + * 2.2.2. If url’s password is not the empty string, then append U+003A (:), + * followed by url’s password, to output. + * 2.2.3. Append U+0040 (@) to output. + */ + output += url.username; + if (url.password !== '') { + output += ':' + url.password; + } + output += '@'; + } + /** + * 2.3. Append url’s host, serialized, to output. + * 2.4. If url’s port is non-null, append U+003A (:) followed by url’s port, + * serialized, to output. + */ + output += hostSerializer(url.host); + if (url.port !== null) { + output += ':' + url.port; + } + } + else if (url.host === null && url.scheme === "file") { + /** + * 3. Otherwise, if url’s host is null and url’s scheme is "file", append "//" to output. + */ + output += '//'; + } + /** + * 4. If url’s cannot-be-a-base-URL flag is set, append url’s path[0] to + * output. + * 5. Otherwise, then for each string in url’s path, append U+002F (/) + * followed by the string to output. + */ + if (url._cannotBeABaseURLFlag) { + output += url.path[0]; + } + else { + try { + for (var _b = __values(url.path), _c = _b.next(); !_c.done; _c = _b.next()) { + var str = _c.value; + output += '/' + str; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + } + /** + * 6. If url’s query is non-null, append U+003F (?), followed by url’s + * query, to output. + * 7. If the exclude fragment flag is unset and url’s fragment is non-null, + * append U+0023 (#), followed by url’s fragment, to output. + * 8. Return output. + */ + if (url.query !== null) { + output += '?' + url.query; + } + if (!excludeFragmentFlag && url.fragment !== null) { + output += '#' + url.fragment; + } + return output; +} +exports.urlSerializer = urlSerializer; +/** + * Serializes a host into a string. + * + * @param host - a host + */ +function hostSerializer(host) { + /** + * 1. If host is an IPv4 address, return the result of running the IPv4 + * serializer on host. + * 2. Otherwise, if host is an IPv6 address, return U+005B ([), followed + * by the result of running the IPv6 serializer on host, followed by + * U+005D (]). + * 3. Otherwise, host is a domain, opaque host, or empty host, return host. + */ + if (util_1.isNumber(host)) { + return iPv4Serializer(host); + } + else if (util_1.isArray(host)) { + return '[' + iPv6Serializer(host) + ']'; + } + else { + return host; + } +} +exports.hostSerializer = hostSerializer; +/** + * Serializes an IPv4 address into a string. + * + * @param address - an IPv4 address + */ +function iPv4Serializer(address) { + /** + * 1. Let output be the empty string. + * 2. Let n be the value of address. + * 3. For each i in the range 1 to 4, inclusive: + * 3.1. Prepend n % 256, serialized, to output. + * 3.2. If i is not 4, then prepend U+002E (.) to output. + * 3.3. Set n to floor(n / 256). + * 4. Return output. + */ + var output = ""; + var n = address; + for (var i = 1; i <= 4; i++) { + output = (n % 256).toString() + output; + if (i !== 4) { + output = '.' + output; + } + n = Math.floor(n / 256); + } + return output; +} +exports.iPv4Serializer = iPv4Serializer; +/** + * Serializes an IPv6 address into a string. + * + * @param address - an IPv6 address represented as a list of eight numbers + */ +function iPv6Serializer(address) { + /** + * 1. Let output be the empty string. + * 2. Let compress be an index to the first IPv6 piece in the first longest + * sequences of address’s IPv6 pieces that are 0. + * In 0:f:0:0:f:f:0:0 it would point to the second 0. + * 3. If there is no sequence of address’s IPv6 pieces that are 0 that is + * longer than 1, then set compress to null. + */ + var output = ""; + var compress = null; + var lastIndex = -1; + var count = 0; + var lastCount = 0; + for (var i = 0; i < 8; i++) { + if (address[i] !== 0) + continue; + count = 1; + for (var j = i + 1; j < 8; j++) { + if (address[j] !== 0) + break; + count++; + continue; + } + if (count > lastCount) { + lastCount = count; + lastIndex = i; + } + } + if (lastCount > 1) + compress = lastIndex; + /** + * 4. Let ignore0 be false. + * 5. For each pieceIndex in the range 0 to 7, inclusive: + */ + var ignore0 = false; + for (var pieceIndex = 0; pieceIndex < 8; pieceIndex++) { + /** + * 5.1. If ignore0 is true and address[pieceIndex] is 0, then continue. + * 5.2. Otherwise, if ignore0 is true, set ignore0 to false. + * 5.3. If compress is pieceIndex, then: + */ + if (ignore0 && address[pieceIndex] === 0) + continue; + if (ignore0) + ignore0 = false; + if (compress === pieceIndex) { + /** + * 5.3.1. Let separator be "::" if pieceIndex is 0, and U+003A (:) otherwise. + * 5.3.2. Append separator to output. + * 5.3.3. Set ignore0 to true and continue. + */ + output += (pieceIndex === 0 ? '::' : ':'); + ignore0 = true; + continue; + } + /** + * 5.4. Append address[pieceIndex], represented as the shortest possible + * lowercase hexadecimal number, to output. + * 5.5. If pieceIndex is not 7, then append U+003A (:) to output. + */ + output += address[pieceIndex].toString(16); + if (pieceIndex !== 7) + output += ':'; + } + /** + * 6. Return output. + */ + return output; +} +exports.iPv6Serializer = iPv6Serializer; +/** + * Parses an URL string. + * + * @param input - input string + * @param baseURL - base URL + * @param encodingOverride - encoding override + */ +function urlParser(input, baseURL, encodingOverride) { + /** + * 1. Let url be the result of running the basic URL parser on input with + * base, and encoding override as provided. + * 2. If url is failure, return failure. + * 3. If url’s scheme is not "blob", return url. + * 4. Set url’s blob URL entry to the result of resolving the blob URL url, + * if that did not return failure, and null otherwise. + * 5. Return url. + */ + var url = basicURLParser(input, baseURL, encodingOverride); + if (url === null) + return null; + if (url.scheme !== "blob") + return url; + var entry = resolveABlobURL(url); + if (entry !== null) { + url._blobURLEntry = entry; + } + else { + url._blobURLEntry = null; + } + return url; +} +exports.urlParser = urlParser; +/** + * Parses an URL string. + * + * @param input - input string + * @param baseURL - base URL + * @param encodingOverride - encoding override + */ +function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { + var e_2, _a, e_3, _b; + /** + * 1. If url is not given: + * 1.1. Set url to a new URL. + * 1.2. If input contains any leading or trailing C0 control or space, + * validation error. + * 1.3. Remove any leading and trailing C0 control or space from input. + */ + if (url === undefined) { + url = newURL(); + // leading + var leadingControlOrSpace = /^[\u0000-\u001F\u0020]+/; + var trailingControlOrSpace = /[\u0000-\u001F\u0020]+$/; + if (leadingControlOrSpace.test(input) || trailingControlOrSpace.test(input)) { + validationError("Input string contains leading or trailing control characters or space."); + } + input = input.replace(leadingControlOrSpace, ''); + input = input.replace(trailingControlOrSpace, ''); + } + /** + * 2. If input contains any ASCII tab or newline, validation error. + * 3. Remove all ASCII tab or newline from input. + */ + var tabOrNewline = /[\u0009\u000A\u000D]/g; + if (tabOrNewline.test(input)) { + validationError("Input string contains tab or newline characters."); + } + input = input.replace(tabOrNewline, ''); + /** + * 4. Let state be state override if given, or scheme start state otherwise. + * 5. If base is not given, set it to null. + * 6. Let encoding be UTF-8. + * 7. If encoding override is given, set encoding to the result of getting + * an output encoding from encoding override. + */ + var state = (stateOverride === undefined ? interfaces_1.ParserState.SchemeStart : stateOverride); + if (baseURL === undefined) + baseURL = null; + var encoding = (encodingOverride === undefined || + encodingOverride === "replacement" || encodingOverride === "UTF-16BE" || + encodingOverride === "UTF-16LE" ? "UTF-8" : encodingOverride); + /** + * 8. Let buffer be the empty string. + * 9. Let the @ flag, [] flag, and passwordTokenSeenFlag be unset. + * 10. Let pointer be a pointer to first code point in input. + */ + var buffer = ""; + var atFlag = false; + var arrayFlag = false; + var passwordTokenSeenFlag = false; + var EOF = ""; + var walker = new util_1.StringWalker(input); + /** + * 11. Keep running the following state machine by switching on state. If + * after a run pointer points to the EOF code point, go to the next step. + * Otherwise, increase pointer by one and continue with the state machine. + */ + while (true) { + switch (state) { + case interfaces_1.ParserState.SchemeStart: + /** + * 1. If c is an ASCII alpha, append c, lowercased, to buffer, and set + * state to scheme state. + * 2. Otherwise, if state override is not given, set state to no scheme + * state, and decrease pointer by one. + * 3. Otherwise, validation error, return failure. + */ + if (infra_1.codePoint.ASCIIAlpha.test(walker.c())) { + buffer += walker.c().toLowerCase(); + state = interfaces_1.ParserState.Scheme; + } + else if (stateOverride === undefined) { + state = interfaces_1.ParserState.NoScheme; + walker.pointer--; + } + else { + validationError("Invalid scheme start character."); + return null; + } + break; + case interfaces_1.ParserState.Scheme: + /** + * 1. If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E + * (.), append c, lowercased, to buffer. + */ + if (infra_1.codePoint.ASCIIAlphanumeric.test(walker.c()) || + walker.c() === '+' || walker.c() === '-' || walker.c() === '.') { + buffer += walker.c().toLowerCase(); + } + else if (walker.c() === ':') { + /** + * 2. Otherwise, if c is U+003A (:), then: + * 2.1. If state override is given, then: + * 2.1.1. If url’s scheme is a special scheme and buffer is not a + * special scheme, then return. + * 2.1.2. If url’s scheme is not a special scheme and buffer is a + * special scheme, then return. + * 2.1.3. If url includes credentials or has a non-null port, and + * buffer is "file", then return. + * 2.1.4. If url’s scheme is "file" and its host is an empty host or + * null, then return. + */ + if (stateOverride !== undefined) { + if (isSpecialScheme(url.scheme) && !isSpecialScheme(buffer)) + return url; + if (!isSpecialScheme(url.scheme) && isSpecialScheme(buffer)) + return url; + if ((includesCredentials(url) || url.port !== null) && buffer === "file") + return url; + if (url.scheme === "file" && (url.host === "" || url.host === null)) + return url; + } + /** + * 2.2. Set url’s scheme to buffer. + */ + url.scheme = buffer; + /** + * 2.3. If state override is given, then: + * 2.3.1. If url’s port is url’s scheme’s default port, then set + * url’s port to null. + * 2.3.2. Return. + */ + if (stateOverride !== undefined) { + if (url.port === defaultPort(url.scheme)) { + url.port = null; + } + return url; + } + /** + * 2.4. Set buffer to the empty string. + */ + buffer = ""; + if (url.scheme === "file") { + /** + * 2.5. If url’s scheme is "file", then: + * 2.5.1. If remaining does not start with "//", validation error. + * 2.5.2. Set state to file state. + */ + if (!walker.remaining().startsWith("//")) { + validationError("Invalid file URL scheme, '//' expected."); + } + state = interfaces_1.ParserState.File; + } + else if (isSpecial(url) && baseURL !== null && baseURL.scheme === url.scheme) { + /** + * 2.6. Otherwise, if url is special, base is non-null, and base’s + * scheme is equal to url’s scheme, set state to special relative + * or authority state. + */ + state = interfaces_1.ParserState.SpecialRelativeOrAuthority; + } + else if (isSpecial(url)) { + /** + * 2.7. Otherwise, if url is special, set state to special + * authority slashes state. + */ + state = interfaces_1.ParserState.SpecialAuthoritySlashes; + } + else if (walker.remaining().startsWith("/")) { + /** + * 2.8. Otherwise, if remaining starts with an U+002F (/), set state + * to path or authority state and increase pointer by one. + */ + state = interfaces_1.ParserState.PathOrAuthority; + walker.pointer++; + } + else { + /** + * 2.9. Otherwise, set url’s cannot-be-a-base-URL flag, append an + * empty string to url’s path, and set state to + * cannot-be-a-base-URL path state. + */ + url._cannotBeABaseURLFlag = true; + url.path.push(""); + state = interfaces_1.ParserState.CannotBeABaseURLPath; + } + } + else if (stateOverride === undefined) { + /** + * 3. Otherwise, if state override is not given, set buffer to the + * empty string, state to no scheme state, and start over (from the + * first code point in input). + */ + buffer = ""; + state = interfaces_1.ParserState.NoScheme; + walker.pointer = 0; + continue; + } + else { + /** + * 4. Otherwise, validation error, return failure. + */ + validationError("Invalid input string."); + return null; + } + break; + case interfaces_1.ParserState.NoScheme: + /** + * 1. If base is null, or base’s cannot-be-a-base-URL flag is set + * and c is not U+0023 (#), validation error, return failure. + * 2. Otherwise, if base’s cannot-be-a-base-URL flag is set and + * c is U+0023 (#), set url’s scheme to base’s scheme, url’s path to + * a copy of base’s path, url’s query to base’s query, url’s + * fragment to the empty string, set url’s cannot-be-a-base-URL + * flag, and set state to fragment state. + * 3. Otherwise, if base’s scheme is not "file", set state to + * relative state and decrease pointer by one. + * 4. Otherwise, set state to file state and decrease pointer by one. + */ + if (baseURL === null || (baseURL._cannotBeABaseURLFlag && walker.c() !== '#')) { + validationError("Invalid input string."); + return null; + } + else if (baseURL._cannotBeABaseURLFlag && walker.c() === '#') { + url.scheme = baseURL.scheme; + url.path = infra_1.list.clone(baseURL.path); + url.query = baseURL.query; + url.fragment = ""; + url._cannotBeABaseURLFlag = true; + state = interfaces_1.ParserState.Fragment; + } + else if (baseURL.scheme !== "file") { + state = interfaces_1.ParserState.Relative; + walker.pointer--; + } + else { + state = interfaces_1.ParserState.File; + walker.pointer--; + } + break; + case interfaces_1.ParserState.SpecialRelativeOrAuthority: + /** + * If c is U+002F (/) and remaining starts with U+002F (/), then set + * state to special authority ignore slashes state and increase + * pointer by one. + * Otherwise, validation error, set state to relative state and + * decrease pointer by one. + */ + if (walker.c() === '/' && walker.remaining().startsWith('/')) { + state = interfaces_1.ParserState.SpecialAuthorityIgnoreSlashes; + walker.pointer++; + } + else { + validationError("Invalid input string."); + state = interfaces_1.ParserState.Relative; + walker.pointer--; + } + break; + case interfaces_1.ParserState.PathOrAuthority: + /** + * If c is U+002F (/), then set state to authority state. + * Otherwise, set state to path state, and decrease pointer by one. + */ + if (walker.c() === '/') { + state = interfaces_1.ParserState.Authority; + } + else { + state = interfaces_1.ParserState.Path; + walker.pointer--; + } + break; + case interfaces_1.ParserState.Relative: + /** + * Set url’s scheme to base’s scheme, and then, switching on c: + */ + if (baseURL === null) { + throw new Error("Invalid parser state. Base URL is null."); + } + url.scheme = baseURL.scheme; + switch (walker.c()) { + case EOF: // EOF + /** + * Set url’s username to base’s username, url’s password to base’s + * password, url’s host to base’s host, url’s port to base’s port, + * url’s path to a copy of base’s path, and url’s query to base’s + * query. + */ + url.username = baseURL.username; + url.password = baseURL.password; + url.host = baseURL.host; + url.port = baseURL.port; + url.path = infra_1.list.clone(baseURL.path); + url.query = baseURL.query; + break; + case '/': + /** + * Set state to relative slash state. + */ + state = interfaces_1.ParserState.RelativeSlash; + break; + case '?': + /** + * Set url’s username to base’s username, url’s password to base’s + * password, url’s host to base’s host, url’s port to base’s port, + * url’s path to a copy of base’s path, url’s query to the empty + * string, and state to query state. + */ + url.username = baseURL.username; + url.password = baseURL.password; + url.host = baseURL.host; + url.port = baseURL.port; + url.path = infra_1.list.clone(baseURL.path); + url.query = ""; + state = interfaces_1.ParserState.Query; + break; + case '#': + /** + * Set url’s username to base’s username, url’s password to base’s + * password, url’s host to base’s host, url’s port to base’s port, + * url’s path to a copy of base’s path, url’s query to base’s + * query, url’s fragment to the empty string, and state to + * fragment state. + */ + url.username = baseURL.username; + url.password = baseURL.password; + url.host = baseURL.host; + url.port = baseURL.port; + url.path = infra_1.list.clone(baseURL.path); + url.query = baseURL.query; + url.fragment = ""; + state = interfaces_1.ParserState.Fragment; + break; + default: + /** + * If url is special and c is U+005C (\), validation error, + * set state to relative slash state. + * Otherwise, run these steps: + * 1. Set url’s username to base’s username, url’s password to + * base’s password, url’s host to base’s host, url’s port to + * base’s port, url’s path to a copy of base’s path, and then + * remove url’s path’s last item, if any. + * 2. Set state to path state, and decrease pointer by one. + */ + if (isSpecial(url) && walker.c() === '\\') { + validationError("Invalid input string."); + state = interfaces_1.ParserState.RelativeSlash; + } + else { + url.username = baseURL.username; + url.password = baseURL.password; + url.host = baseURL.host; + url.port = baseURL.port; + url.path = infra_1.list.clone(baseURL.path); + if (url.path.length !== 0) + url.path.splice(url.path.length - 1, 1); + state = interfaces_1.ParserState.Path; + walker.pointer--; + } + break; + } + break; + case interfaces_1.ParserState.RelativeSlash: + /** + * 1. If url is special and c is U+002F (/) or U+005C (\), then: + * 1.1. If c is U+005C (\), validation error. + * 1.2. Set state to special authority ignore slashes state. + * 2. Otherwise, if c is U+002F (/), then set state to authority state. + * 3. Otherwise, set url’s username to base’s username, url’s password + * to base’s password, url’s host to base’s host, url’s port to base’s + * port, state to path state, and then, decrease pointer by one. + */ + if (isSpecial(url) && (walker.c() === '/' || walker.c() === '\\')) { + if (walker.c() === '\\') { + validationError("Invalid input string."); + } + state = interfaces_1.ParserState.SpecialAuthorityIgnoreSlashes; + } + else if (walker.c() === '/') { + state = interfaces_1.ParserState.Authority; + } + else { + if (baseURL === null) { + throw new Error("Invalid parser state. Base URL is null."); + } + url.username = baseURL.username; + url.password = baseURL.password; + url.host = baseURL.host; + url.port = baseURL.port; + state = interfaces_1.ParserState.Path; + walker.pointer--; + } + break; + case interfaces_1.ParserState.SpecialAuthoritySlashes: + /** + * If c is U+002F (/) and remaining starts with U+002F (/), then set + * state to special authority ignore slashes state and increase + * pointer by one. + * Otherwise, validation error, set state to special authority ignore + * slashes state, and decrease pointer by one. + */ + if (walker.c() === '/' && walker.remaining().startsWith('/')) { + state = interfaces_1.ParserState.SpecialAuthorityIgnoreSlashes; + walker.pointer++; + } + else { + validationError("Expected '//'."); + state = interfaces_1.ParserState.SpecialAuthorityIgnoreSlashes; + walker.pointer--; + } + break; + case interfaces_1.ParserState.SpecialAuthorityIgnoreSlashes: + /** + * If c is neither U+002F (/) nor U+005C (\), then set state to + * authority state and decrease pointer by one. + * Otherwise, validation error. + */ + if (walker.c() !== '/' && walker.c() !== '\\') { + state = interfaces_1.ParserState.Authority; + walker.pointer--; + } + else { + validationError("Unexpected '/' or '\\'."); + } + break; + case interfaces_1.ParserState.Authority: + /** + * 1. If c is U+0040 (@), then: + */ + if (walker.c() === '@') { + /** + * 1.1. Validation error. + * 1.2. If the @ flag is set, prepend "%40" to buffer. + * 1.3. Set the @ flag. + * 1.4. For each codePoint in buffer: + */ + validationError("Unexpected '@'."); + if (atFlag) + buffer = '%40' + buffer; + atFlag = true; + try { + for (var buffer_1 = (e_2 = void 0, __values(buffer)), buffer_1_1 = buffer_1.next(); !buffer_1_1.done; buffer_1_1 = buffer_1.next()) { + var codePoint = buffer_1_1.value; + /** + * 1.4.1. If codePoint is U+003A (:) and passwordTokenSeenFlag is + * unset, then set passwordTokenSeenFlag and continue. + * 1.4.2. Let encodedCodePoints be the result of running UTF-8 + * percent encode codePoint using the userinfo percent-encode set. + * 1.4.3. If passwordTokenSeenFlag is set, then append + * encodedCodePoints to url’s password. + * 1.4.4. Otherwise, append encodedCodePoints to url’s username. + */ + if (codePoint === ':' && !passwordTokenSeenFlag) { + passwordTokenSeenFlag = true; + continue; + } + var encodedCodePoints = utf8PercentEncode(codePoint, _userInfoPercentEncodeSet); + if (passwordTokenSeenFlag) { + url.password += encodedCodePoints; + } + else { + url.username += encodedCodePoints; + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (buffer_1_1 && !buffer_1_1.done && (_a = buffer_1.return)) _a.call(buffer_1); + } + finally { if (e_2) throw e_2.error; } + } + /** + * 1.5. Set buffer to the empty string. + */ + buffer = ""; + } + else if (walker.c() === EOF || walker.c() === '/' || walker.c() === '?' || walker.c() === '#' || + (isSpecial(url) && walker.c() === '\\')) { + /** + * 2. Otherwise, if one of the following is true + * - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#) + * - url is special and c is U+005C (\) + * then: + * 2.1. If @ flag is set and buffer is the empty string, validation + * error, return failure. + * 2.2. Decrease pointer by the number of code points in buffer plus + * one, set buffer to the empty string, and set state to host state. + */ + if (atFlag && buffer === "") { + validationError("Invalid input string."); + return null; + } + walker.pointer -= (buffer.length + 1); + buffer = ""; + state = interfaces_1.ParserState.Host; + } + else { + /** + * 3. Otherwise, append c to buffer. + */ + buffer += walker.c(); + } + break; + case interfaces_1.ParserState.Host: + case interfaces_1.ParserState.Hostname: + if (stateOverride !== undefined && url.scheme === "file") { + /** + * 1. If state override is given and url’s scheme is "file", then + * decrease pointer by one and set state to file host state. + */ + walker.pointer--; + state = interfaces_1.ParserState.FileHost; + } + else if (walker.c() === ':' && !arrayFlag) { + /** + * 2. Otherwise, if c is U+003A (:) and the [] flag is unset, then: + * 2.1. If buffer is the empty string, validation error, return + * failure. + * 2.2. Let host be the result of host parsing buffer with url is + * not special. + * 2.3. If host is failure, then return failure. + * 2.4. Set url’s host to host, buffer to the empty string, and + * state to port state. + * 2.5. If state override is given and state override is hostname + * state, then return. + */ + if (buffer === "") { + validationError("Invalid input string."); + return null; + } + var host = hostParser(buffer, !isSpecial(url)); + if (host === null) + return null; + url.host = host; + buffer = ""; + state = interfaces_1.ParserState.Port; + if (stateOverride === interfaces_1.ParserState.Hostname) + return url; + } + else if (walker.c() === EOF || walker.c() === '/' || walker.c() === '?' || walker.c() === '#' || + (isSpecial(url) && walker.c() === '\\')) { + /** + * 3. Otherwise, if one of the following is true + * - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#) + * - url is special and c is U+005C (\) + * then decrease pointer by one, and then: + * 3.1. If url is special and buffer is the empty string, validation + * error, return failure. + * 3.2. Otherwise, if state override is given, buffer is the empty + * string, and either url includes credentials or url’s port is + * non-null, validation error, return. + * 3.3. Let host be the result of host parsing buffer with url is + * not special. + * 3.4. If host is failure, then return failure. + * 3.5. Set url’s host to host, buffer to the empty string, and + * state to path start state. + * 3.6. If state override is given, then return. + */ + walker.pointer--; + if (isSpecial(url) && buffer === "") { + validationError("Invalid input string."); + return null; + } + else if (stateOverride !== undefined && buffer === "" && + (includesCredentials(url) || url.port !== null)) { + validationError("Invalid input string."); + return url; + } + var host = hostParser(buffer, !isSpecial(url)); + if (host === null) + return null; + url.host = host; + buffer = ""; + state = interfaces_1.ParserState.PathStart; + if (stateOverride !== undefined) + return url; + } + else { + /** + * 4. Otherwise: + * 4.1. If c is U+005B ([), then set the [] flag. + * 4.2. If c is U+005D (]), then unset the [] flag. + * 4.3. Append c to buffer. + */ + if (walker.c() === '[') + arrayFlag = true; + if (walker.c() === ']') + arrayFlag = false; + buffer += walker.c(); + } + break; + case interfaces_1.ParserState.Port: + if (infra_1.codePoint.ASCIIDigit.test(walker.c())) { + /** + * 1. If c is an ASCII digit, append c to buffer. + */ + buffer += walker.c(); + } + else if (walker.c() === EOF || walker.c() === '/' || walker.c() === '?' || walker.c() === '#' || + (isSpecial(url) && walker.c() === '\\') || stateOverride) { + /** + * 2. Otherwise, if one of the following is true + * - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#) + * - url is special and c is U+005C (\) + * - state override is given + * then: + */ + if (buffer !== "") { + /** + * 2.1. If buffer is not the empty string, then: + * 2.1.1. Let port be the mathematical integer value that is + * represented by buffer in radix-10 using ASCII digits for digits + * with values 0 through 9. + * 2.1.2. If port is greater than 2**16 − 1, validation error, + * return failure. + * 2.1.3. Set url’s port to null, if port is url’s scheme’s default + * port, and to port otherwise. + * 2.1.4. Set buffer to the empty string. + */ + if (buffer !== "") { + var port = parseInt(buffer, 10); + if (port > Math.pow(2, 16) - 1) { + validationError("Invalid port number."); + return null; + } + url.port = (port === defaultPort(url.scheme) ? null : port); + buffer = ""; + } + } + /** + * 2.2. If state override is given, then return. + * 2.3. Set state to path start state, and decrease pointer by one. + */ + if (stateOverride !== undefined) { + return url; + } + state = interfaces_1.ParserState.PathStart; + walker.pointer--; + } + else { + /** + * 3. Otherwise, validation error, return failure. + */ + validationError("Invalid input string."); + return null; + } + break; + case interfaces_1.ParserState.File: + /** + * 1. Set url’s scheme to "file". + */ + url.scheme = "file"; + if (walker.c() === '/' || walker.c() === '\\') { + /** + * 2. If c is U+002F (/) or U+005C (\), then: + * 2.1. If c is U+005C (\), validation error. + * 2.2. Set state to file slash state. + */ + if (walker.c() === '\\') { + validationError("Invalid input string."); + } + state = interfaces_1.ParserState.FileSlash; + } + else if (baseURL !== null && baseURL.scheme === "file") { + /** + * 3. Otherwise, if base is non-null and base’s scheme is "file", + * switch on c: + */ + switch (walker.c()) { + case EOF: + /** + * Set url’s host to base’s host, url’s path to a copy of base’s + * path, and url’s query to base’s query. + */ + url.host = baseURL.host; + url.path = infra_1.list.clone(baseURL.path); + url.query = baseURL.query; + break; + case '?': + /** + * Set url’s host to base’s host, url’s path to a copy of base’s + * path, url’s query to the empty string, and state to query + * state. + */ + url.host = baseURL.host; + url.path = infra_1.list.clone(baseURL.path); + url.query = ""; + state = interfaces_1.ParserState.Query; + break; + case '#': + /** + * Set url’s host to base’s host, url’s path to a copy of base’s + * path, url’s query to base’s query, url’s fragment to the + * empty string, and state to fragment state. + */ + url.host = baseURL.host; + url.path = infra_1.list.clone(baseURL.path); + url.query = baseURL.query; + url.fragment = ""; + state = interfaces_1.ParserState.Fragment; + break; + default: + /** + * 1. If the substring from pointer in input does not start + * with a Windows drive letter, then set url’s host to base’s + * host, url’s path to a copy of base’s path, and then shorten + * url’s path. + * _Note:_ is a (platform-independent) Windows drive letter + * quirk. + * 2. Otherwise, validation error. + * 3. Set state to path state, and decrease pointer by one. + */ + if (!startsWithAWindowsDriveLetter(walker.substring())) { + url.host = baseURL.host; + url.path = infra_1.list.clone(baseURL.path); + shorten(url); + } + else { + validationError("Unexpected windows drive letter in input string."); + } + state = interfaces_1.ParserState.Path; + walker.pointer--; + break; + } + } + else { + /** + * 4. Otherwise, set state to path state, and decrease pointer by + * one. + */ + state = interfaces_1.ParserState.Path; + walker.pointer--; + } + break; + case interfaces_1.ParserState.FileSlash: + if (walker.c() === '/' || walker.c() === '\\') { + /** + * 1. If c is U+002F (/) or U+005C (\), then: + * 1.1. If c is U+005C (\), validation error. + * 1.2. Set state to file host state. + */ + if (walker.c() === '\\') { + validationError("Invalid input string."); + } + state = interfaces_1.ParserState.FileHost; + } + else { + /** + * 2. Otherwise: + * 2.1. If base is non-null, base’s scheme is "file", and the + * substring from pointer in input does not start with a Windows + * drive letter, then: + * 2.1.1. If base’s path[0] is a normalized Windows drive letter, + * then append base’s path[0] to url’s path. + * _Note:_ is a (platform-independent) Windows drive letter + * quirk. Both url’s and base’s host are null under these conditions + * and therefore not copied. + * 2.1.2. Otherwise, set url’s host to base’s host. + * 2.2. Set state to path state, and decrease pointer by one. + */ + if (baseURL !== null && baseURL.scheme === "file" && + !startsWithAWindowsDriveLetter(walker.substring())) { + if (isNormalizedWindowsDriveLetter(baseURL.path[0])) { + url.path.push(baseURL.path[0]); + } + else { + url.host = baseURL.host; + } + } + state = interfaces_1.ParserState.Path; + walker.pointer--; + } + break; + case interfaces_1.ParserState.FileHost: + if (walker.c() === EOF || walker.c() === '/' || walker.c() === '\\' || + walker.c() === '?' || walker.c() === '#') { + /** + * 1. If c is the EOF code point, U+002F (/), U+005C (\), U+003F (?), + * or U+0023 (#), then decrease pointer by one and then: + */ + walker.pointer--; + if (stateOverride === undefined && isWindowsDriveLetter(buffer)) { + /** + * 1.1. If state override is not given and buffer is a Windows drive + * letter, validation error, set state to path state. + * _Note:_ is a (platform-independent) Windows drive letter + * quirk. buffer is not reset here and instead used in the path state. + */ + validationError("Unexpected windows drive letter in input string."); + state = interfaces_1.ParserState.Path; + } + else if (buffer === "") { + /** + * 1.2. Otherwise, if buffer is the empty string, then: + * 1.2.1. Set url’s host to the empty string. + * 1.2.2. If state override is given, then return. + * 1.2.3. Set state to path start state. + */ + url.host = ""; + if (stateOverride !== undefined) + return url; + state = interfaces_1.ParserState.PathStart; + } + else { + /** + * 1.3. Otherwise, run these steps: + * 1.3.1. Let host be the result of host parsing buffer with url + * is not special. + * 1.3.2. If host is failure, then return failure. + * 1.3.3. If host is "localhost", then set host to the empty + * string. + * 1.3.4. Set url’s host to host. + * 1.3.5. If state override is given, then return. + * 1.3.6. Set buffer to the empty string and state to path start + * state. + */ + var host = hostParser(buffer, !isSpecial(url)); + if (host === null) + return null; + if (host === "localhost") + host = ""; + url.host = host; + if (stateOverride !== undefined) + return url; + buffer = ""; + state = interfaces_1.ParserState.PathStart; + } + } + else { + /** + * 2. Otherwise, append c to buffer. + */ + buffer += walker.c(); + } + break; + case interfaces_1.ParserState.PathStart: + if (isSpecial(url)) { + /** + * 1. If url is special, then: + * 1.1. If c is U+005C (\), validation error. + * 1.2. Set state to path state. + * 1.3. If c is neither U+002F (/) nor U+005C (\), then decrease + * pointer by one. + */ + if (walker.c() === '\\') { + validationError("Invalid input string."); + } + state = interfaces_1.ParserState.Path; + if (walker.c() !== '/' && walker.c() !== '\\') + walker.pointer--; + } + else if (stateOverride === undefined && walker.c() === '?') { + /** + * 2. Otherwise, if state override is not given and c is U+003F (?), + * set url’s query to the empty string and state to query state. + */ + url.query = ""; + state = interfaces_1.ParserState.Query; + } + else if (stateOverride === undefined && walker.c() === '#') { + /** + * 3. Otherwise, if state override is not given and c is U+0023 (#), + * set url’s fragment to the empty string and state to fragment + * state. + */ + url.fragment = ""; + state = interfaces_1.ParserState.Fragment; + } + else if (walker.c() !== EOF) { + /** + * 4. Otherwise, if c is not the EOF code point: + * 4.1. Set state to path state. + * 4.2. If c is not U+002F (/), then decrease pointer by one. + */ + state = interfaces_1.ParserState.Path; + if (walker.c() !== '/') + walker.pointer--; + } + break; + case interfaces_1.ParserState.Path: + if ((walker.c() === EOF || walker.c() === '/') || + (isSpecial(url) && walker.c() === '\\') || + (stateOverride === undefined && (walker.c() === '?' || walker.c() === '#'))) { + /** + * 1. If one of the following is true + * - c is the EOF code point or U+002F (/) + * - url is special and c is U+005C (\) + * - state override is not given and c is U+003F (?) or U+0023 (#) + * then: + */ + if (isSpecial(url) && walker.c() === '\\') { + /** + * 1.1 If url is special and c is U+005C (\), validation error. + */ + validationError("Invalid input string."); + } + if (isDoubleDotPathSegment(buffer)) { + /** + * 1.2. If buffer is a double-dot path segment, shorten url’s path, + * and then if neither c is U+002F (/), nor url is special and c is + * U+005C (\), append the empty string to url’s path. + */ + shorten(url); + if (walker.c() !== '/' && !(isSpecial(url) && walker.c() === '\\')) { + url.path.push(""); + } + } + else if (isSingleDotPathSegment(buffer) && walker.c() !== '/' && + !(isSpecial(url) && walker.c() === '\\')) { + /** + * 1.3. Otherwise, if buffer is a single-dot path segment and if + * neither c is U+002F (/), nor url is special and c is U+005C (\), + * append the empty string to url’s path. + */ + url.path.push(""); + } + else if (!isSingleDotPathSegment(buffer)) { + /** + * 1.4. Otherwise, if buffer is not a single-dot path segment, then: + */ + if (url.scheme === "file" && url.path.length === 0 && + isWindowsDriveLetter(buffer)) { + /** + * 1.4.1. If url’s scheme is "file", url’s path is empty, and + * buffer is a Windows drive letter, then: + * 1.4.1.1. If url’s host is neither the empty string nor null, + * validation error, set url’s host to the empty string. + * 1.4.1.2. Replace the second code point in buffer with U+003A (:). + * _Note:_ is a (platform-independent) Windows drive letter quirk. + */ + if (url.host !== null && url.host !== "") { + validationError("Invalid input string."); + url.host = ""; + } + var bufferCodePoints = Array.from(buffer); + buffer = bufferCodePoints.slice(0, 1) + ':' + bufferCodePoints.slice(2); + } + /** + * 1.4.2. Append buffer to url’s path. + */ + url.path.push(buffer); + } + /** + * 1.5. Set buffer to the empty string. + */ + buffer = ""; + /** + * 1.6. If url’s scheme is "file" and c is the EOF code point, + * U+003F (?), or U+0023 (#), then while url’s path’s size is + * greater than 1 and url’s path[0] is the empty string, validation + * error, remove the first item from url’s path. + */ + if (url.scheme === "file" && (walker.c() === EOF || walker.c() === '?' || walker.c() === '#')) { + while (url.path.length > 1 && url.path[0] === "") { + validationError("Invalid input string."); + url.path.splice(0, 1); + } + } + /** + * 1.7. If c is U+003F (?), then set url’s query to the empty string + * and state to query state. + * 1.8. If c is U+0023 (#), then set url’s fragment to the empty + * string and state to fragment state. + */ + if (walker.c() === '?') { + url.query = ""; + state = interfaces_1.ParserState.Query; + } + if (walker.c() === '#') { + url.fragment = ""; + state = interfaces_1.ParserState.Fragment; + } + } + else { + /** + * 2. Otherwise, run these steps: + * 2.1. If c is not a URL code point and not U+0025 (%), validation + * error. + * 2.2. If c is U+0025 (%) and remaining does not start with two + * ASCII hex digits, validation error. + * 2.3. UTF-8 percent encode c using the path percent-encode set, + * and append the result to buffer. + */ + if (!_urlCodePoints.test(walker.c()) && walker.c() !== '%') { + validationError("Character is not a URL code point or a percent encoded character."); + } + if (walker.c() === '%' && !/^[0-9a-fA-F][0-9a-fA-F]/.test(walker.remaining())) { + validationError("Percent encoded character must be followed by two hex digits."); + } + buffer += utf8PercentEncode(walker.c(), _pathPercentEncodeSet); + } + break; + case interfaces_1.ParserState.CannotBeABaseURLPath: + /** + * 1. If c is U+003F (?), then set url’s query to the empty string and + * state to query state. + * 2. Otherwise, if c is U+0023 (#), then set url’s fragment to the + * empty string and state to fragment state. + * 3. Otherwise: + * 3.1. If c is not the EOF code point, not a URL code point, and not + * U+0025 (%), validation error. + * 3.2. If c is U+0025 (%) and remaining does not start with two ASCII + * hex digits, validation error. + * 3.3. If c is not the EOF code point, UTF-8 percent encode c using + * the C0 control percent-encode set, and append the result to url’s + * path[0]. + */ + if (walker.c() === '?') { + url.query = ""; + state = interfaces_1.ParserState.Query; + } + else if (walker.c() === '#') { + url.fragment = ""; + state = interfaces_1.ParserState.Fragment; + } + else { + if (walker.c() !== EOF && !_urlCodePoints.test(walker.c()) && walker.c() !== '%') { + validationError("Character is not a URL code point or a percent encoded character."); + } + if (walker.c() === '%' && !/^[0-9a-fA-F][0-9a-fA-F]/.test(walker.remaining())) { + validationError("Percent encoded character must be followed by two hex digits."); + } + if (walker.c() !== EOF) { + url.path[0] += utf8PercentEncode(walker.c(), _c0ControlPercentEncodeSet); + } + } + break; + case interfaces_1.ParserState.Query: + /** + * 1. If encoding is not UTF-8 and one of the following is true + * - url is not special + * - url’s scheme is "ws" or "wss" + * then set encoding to UTF-8. + */ + if (encoding !== "UTF-8" && (!isSpecial(url) || + url.scheme === "ws" || url.scheme === "wss")) { + encoding = "UTF-8"; + } + if (stateOverride === undefined && walker.c() === '#') { + /** + * 2. If state override is not given and c is U+0023 (#), then set + * url’s fragment to the empty string and state to fragment state. + */ + url.fragment = ""; + state = interfaces_1.ParserState.Fragment; + } + else if (walker.c() !== EOF) { + /** + * 3. Otherwise, if c is not the EOF code point: + * 3.1. If c is not a URL code point and not U+0025 (%), validation + * error. + */ + if (!_urlCodePoints.test(walker.c()) && walker.c() !== '%') { + validationError("Character is not a URL code point or a percent encoded character."); + } + /** + * 3.2. If c is U+0025 (%) and remaining does not start with two + * ASCII hex digits, validation error. + */ + if (walker.c() === '%' && !/^[0-9a-fA-F][0-9a-fA-F]/.test(walker.remaining())) { + validationError("Percent encoded character must be followed by two hex digits."); + } + /** + * 3.3. Let bytes be the result of encoding c using encoding. + */ + if (encoding.toUpperCase() !== "UTF-8") { + throw new Error("Only UTF-8 encoding is supported."); + } + var bytes = util_1.utf8Encode(walker.c()); + /** + * 3.4. If bytes starts with `&#` and ends with 0x3B (;), then: + */ + if (bytes.length >= 3 && bytes[0] === 38 && bytes[1] === 35 && + bytes[bytes.length - 1] === 59) { + /** + * 3.4.1. Replace `&#` at the start of bytes with `%26%23`. + * 3.4.2. Replace 0x3B (;) at the end of bytes with `%3B`. + * 3.4.4. Append bytes, isomorphic decoded, to url’s query. + * _Note:_ can happen when encoding code points using a + * non-UTF-8 encoding. + */ + bytes = bytes.subarray(2, bytes.length - 1); + url.query += "%26%23" + infra_1.byteSequence.isomorphicDecode(bytes) + "%3B"; + } + else { + try { + /** + * 3.5. Otherwise, for each byte in bytes: + * 3.5.1. If one of the following is true + * - byte is less than 0x21 (!) + * - byte is greater than 0x7E (~) + * - byte is 0x22 ("), 0x23 (#), 0x3C (<), or 0x3E (>) + * - byte is 0x27 (') and url is special + * then append byte, percent encoded, to url’s query. + * 3.5.2. Otherwise, append a code point whose value is byte to + * url’s query. + */ + for (var bytes_1 = (e_3 = void 0, __values(bytes)), bytes_1_1 = bytes_1.next(); !bytes_1_1.done; bytes_1_1 = bytes_1.next()) { + var byte = bytes_1_1.value; + if (byte < 0x21 || byte > 0x7E || byte === 0x22 || + byte === 0x23 || byte === 0x3C || byte === 0x3E || + (byte === 0x27 && isSpecial(url))) { + url.query += percentEncode(byte); + } + else { + url.query += String.fromCharCode(byte); + } + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (bytes_1_1 && !bytes_1_1.done && (_b = bytes_1.return)) _b.call(bytes_1); + } + finally { if (e_3) throw e_3.error; } + } + } + } + break; + case interfaces_1.ParserState.Fragment: + /** + * Switching on c: + * - The EOF code point + * Do nothing. + * - U+0000 NULL + * Validation error. + * - Otherwise + * 1. If c is not a URL code point and not U+0025 (%), validation + * error. + * 2. If c is U+0025 (%) and remaining does not start with two ASCII + * hex digits, validation error. + * 3. UTF-8 percent encode c using the fragment percent-encode set and + * append the result to url’s fragment. + */ + if (walker.c() === EOF) { + // + } + else if (walker.c() === "\u0000") { + validationError("NULL character in input string."); + } + else { + if (!_urlCodePoints.test(walker.c()) && walker.c() !== '%') { + validationError("Unexpected character in fragment string."); + } + if (walker.c() === '%' && !/^[A-Za-z0-9][A-Za-z0-9]/.test(walker.remaining())) { + validationError("Unexpected character in fragment string."); + } + url.fragment += utf8PercentEncode(walker.c(), _fragmentPercentEncodeSet); + } + break; + } + if (walker.eof) + break; + else + walker.pointer++; + } + /** + * 12. Return url. + */ + return url; +} +exports.basicURLParser = basicURLParser; +/** + * Sets a URL's username. + * + * @param url - a URL + * @param username - username string + */ +function setTheUsername(url, username) { + var e_4, _a; + /** + * 1. Set url’s username to the empty string. + * 2. For each code point in username, UTF-8 percent encode it using the + * userinfo percent-encode set, and append the result to url’s username. + */ + var result = ""; + try { + for (var username_1 = __values(username), username_1_1 = username_1.next(); !username_1_1.done; username_1_1 = username_1.next()) { + var codePoint = username_1_1.value; + result += utf8PercentEncode(codePoint, _userInfoPercentEncodeSet); + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (username_1_1 && !username_1_1.done && (_a = username_1.return)) _a.call(username_1); + } + finally { if (e_4) throw e_4.error; } + } + url.username = result; +} +exports.setTheUsername = setTheUsername; +/** + * Sets a URL's password. + * + * @param url - a URL + * @param username - password string + */ +function setThePassword(url, password) { + var e_5, _a; + /** + * 1. Set url’s password to the empty string. + * 2. For each code point in password, UTF-8 percent encode it using the + * userinfo percent-encode set, and append the result to url’s password. + */ + var result = ""; + try { + for (var password_1 = __values(password), password_1_1 = password_1.next(); !password_1_1.done; password_1_1 = password_1.next()) { + var codePoint = password_1_1.value; + result += utf8PercentEncode(codePoint, _userInfoPercentEncodeSet); + } + } + catch (e_5_1) { e_5 = { error: e_5_1 }; } + finally { + try { + if (password_1_1 && !password_1_1.done && (_a = password_1.return)) _a.call(password_1); + } + finally { if (e_5) throw e_5.error; } + } + url.password = result; +} +exports.setThePassword = setThePassword; +/** + * Determines if the string represents a single dot path. + * + * @param str - a string + */ +function isSingleDotPathSegment(str) { + return str === '.' || str.toLowerCase() === "%2e"; +} +exports.isSingleDotPathSegment = isSingleDotPathSegment; +/** + * Determines if the string represents a double dot path. + * + * @param str - a string + */ +function isDoubleDotPathSegment(str) { + var lowerStr = str.toLowerCase(); + return lowerStr === ".." || lowerStr === ".%2e" || + lowerStr === "%2e." || lowerStr === "%2e%2e"; +} +exports.isDoubleDotPathSegment = isDoubleDotPathSegment; +/** + * Shorten's URL's path. + * + * @param url - an URL + */ +function shorten(url) { + /** + * 1. Let path be url’s path. + * 2. If path is empty, then return. + * 3. If url’s scheme is "file", path’s size is 1, and path[0] is a + * normalized Windows drive letter, then return. + * 4. Remove path’s last item. + */ + var path = url.path; + if (path.length === 0) + return; + if (url.scheme === "file" && path.length === 1 && + isNormalizedWindowsDriveLetter(path[0])) + return; + url.path.splice(url.path.length - 1, 1); +} +exports.shorten = shorten; +/** + * Determines if a string is a normalized Windows drive letter. + * + * @param str - a string + */ +function isNormalizedWindowsDriveLetter(str) { + /** + * A normalized Windows drive letter is a Windows drive letter of which the + * second code point is U+003A (:). + */ + return str.length >= 2 && infra_1.codePoint.ASCIIAlpha.test(str[0]) && + str[1] === ':'; +} +exports.isNormalizedWindowsDriveLetter = isNormalizedWindowsDriveLetter; +/** + * Determines if a string is a Windows drive letter. + * + * @param str - a string + */ +function isWindowsDriveLetter(str) { + /** + * A Windows drive letter is two code points, of which the first is an ASCII + * alpha and the second is either U+003A (:) or U+007C (|). + */ + return str.length >= 2 && infra_1.codePoint.ASCIIAlpha.test(str[0]) && + (str[1] === ':' || str[1] === '|'); +} +exports.isWindowsDriveLetter = isWindowsDriveLetter; +/** + * Determines if a string starts with a Windows drive letter. + * + * @param str - a string + */ +function startsWithAWindowsDriveLetter(str) { + /** + * A string starts with a Windows drive letter if all of the following are + * true: + * - its length is greater than or equal to 2 + * - its first two code points are a Windows drive letter + * - its length is 2 or its third code point is U+002F (/), U+005C (\), + * U+003F (?), or U+0023 (#). + */ + return str.length >= 2 && isWindowsDriveLetter(str) && + (str.length === 2 || (str[2] === '/' || str[2] === '\\' || + str[2] === '?' || str[2] === '#')); +} +exports.startsWithAWindowsDriveLetter = startsWithAWindowsDriveLetter; +/** + * Parses a host string. + * + * @param input - input string + * @param isNotSpecial - `true` if the source URL is not special; otherwise + * `false`. + */ +function hostParser(input, isNotSpecial) { + if (isNotSpecial === void 0) { isNotSpecial = false; } + /** + * 1. If isNotSpecial is not given, then set isNotSpecial to false. + * 2. If input starts with U+005B ([), then: + * 2.1. If input does not end with U+005D (]), validation error, return + * failure. + * 2.2. Return the result of IPv6 parsing input with its leading U+005B ([) + * and trailing U+005D (]) removed. + */ + if (input.startsWith('[')) { + if (!input.endsWith(']')) { + validationError("Expected ']' after '['."); + return null; + } + return iPv6Parser(input.substring(1, input.length - 1)); + } + /** + * 3. If isNotSpecial is true, then return the result of opaque-host parsing + * input. + */ + if (isNotSpecial) { + return opaqueHostParser(input); + } + /** + * 4. Let domain be the result of running UTF-8 decode without BOM on the + * string percent decoding of input. + * _Note:_ Alternatively UTF-8 decode without BOM or fail can be used, + * coupled with an early return for failure, as domain to ASCII fails + * on U+FFFD REPLACEMENT CHARACTER. + */ + var domain = util_1.utf8Decode(stringPercentDecode(input)); + /** + * 5. Let asciiDomain be the result of running domain to ASCII on domain. + * 6. If asciiDomain is failure, validation error, return failure. + * 7. If asciiDomain contains a forbidden host code point, validation error, + * return failure. + */ + var asciiDomain = domainToASCII(domain); + if (asciiDomain === null) { + validationError("Invalid domain."); + return null; + } + if (_forbiddenHostCodePoint.test(asciiDomain)) { + validationError("Invalid domain."); + return null; + } + /** + * 8. Let ipv4Host be the result of IPv4 parsing asciiDomain. + * 9. If ipv4Host is an IPv4 address or failure, return ipv4Host. + * 10. Return asciiDomain. + */ + var ipv4Host = iPv4Parser(asciiDomain); + if (ipv4Host === null || util_1.isNumber(ipv4Host)) + return ipv4Host; + return asciiDomain; +} +exports.hostParser = hostParser; +/** + * Parses a string containing an IP v4 address. + * + * @param input - input string + * @param isNotSpecial - `true` if the source URL is not special; otherwise + * `false`. + */ +function iPv4NumberParser(input, validationErrorFlag) { + if (validationErrorFlag === void 0) { validationErrorFlag = { value: false }; } + /** + * 1. Let R be 10. + */ + var R = 10; + if (input.startsWith("0x") || input.startsWith("0X")) { + /** + * 2. If input contains at least two code points and the first two code + * points are either "0x" or "0X", then: + * 2.1. Set validationErrorFlag. + * 2.2. Remove the first two code points from input. + * 2.3. Set R to 16. + */ + validationErrorFlag.value = true; + input = input.substr(2); + R = 16; + } + else if (input.length >= 2 && input[0] === '0') { + /** + * 3. Otherwise, if input contains at least two code points and the first + * code point is U+0030 (0), then: + * 3.1. Set validationErrorFlag. + * 3.2. Remove the first code point from input. + * 3.3. Set R to 8. + */ + validationErrorFlag.value = true; + input = input.substr(1); + R = 8; + } + /** + * 4. If input is the empty string, then return zero. + * 5. If input contains a code point that is not a radix-R digit, then + * return failure. + */ + if (input === "") + return 0; + var radixRDigits = (R === 10 ? /^[0-9]+$/ : (R === 16 ? /^[0-9A-Fa-f]+$/ : /^[0-7]+$/)); + if (!radixRDigits.test(input)) + return null; + /** + * 6. Return the mathematical integer value that is represented by input in + * radix-R notation, using ASCII hex digits for digits with values + * 0 through 15. + */ + return parseInt(input, R); +} +exports.iPv4NumberParser = iPv4NumberParser; +/** + * Parses a string containing an IP v4 address. + * + * @param input - input string + */ +function iPv4Parser(input) { + var e_6, _a, e_7, _b; + /** + * 1. Let validationErrorFlag be unset. + * 2. Let parts be input split on U+002E (.). + */ + var validationErrorFlag = { value: false }; + var parts = input.split('.'); + /** + * 3. If the last item in parts is the empty string, then: + * 3.1. Set validationErrorFlag. + * 3.2. If parts has more than one item, then remove the last item from + * parts. + */ + if (parts[parts.length - 1] === "") { + validationErrorFlag.value = true; + if (parts.length > 1) + parts.pop(); + } + /** + * 4. If parts has more than four items, return input. + */ + if (parts.length > 4) + return input; + /** + * 5. Let numbers be the empty list. + * 6. For each part in parts: + * 6.1. If part is the empty string, return input. + * 6.2. Let n be the result of parsing part using validationErrorFlag. + * 6.3. If n is failure, return input. + * 6.4. Append n to numbers. + */ + var numbers = []; + try { + for (var parts_1 = __values(parts), parts_1_1 = parts_1.next(); !parts_1_1.done; parts_1_1 = parts_1.next()) { + var part = parts_1_1.value; + if (part === "") + return input; + var n = iPv4NumberParser(part, validationErrorFlag); + if (n === null) + return input; + numbers.push(n); + } + } + catch (e_6_1) { e_6 = { error: e_6_1 }; } + finally { + try { + if (parts_1_1 && !parts_1_1.done && (_a = parts_1.return)) _a.call(parts_1); + } + finally { if (e_6) throw e_6.error; } + } + /** + * 7. If validationErrorFlag is set, validation error. + * 8. If any item in numbers is greater than 255, validation error. + * 9. If any but the last item in numbers is greater than 255, return + * failure. + * 10. If the last item in numbers is greater than or equal to + * 256**(5 − the number of items in numbers), validation error, return failure. + */ + if (validationErrorFlag.value) + validationError("Invalid IP v4 address."); + for (var i = 0; i < numbers.length; i++) { + var item = numbers[i]; + if (item > 255) { + validationError("Invalid IP v4 address."); + if (i < numbers.length - 1) + return null; + } + } + if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { + validationError("Invalid IP v4 address."); + return null; + } + /** + * 11. Let ipv4 be the last item in numbers. + * 12. Remove the last item from numbers. + */ + var ipv4 = numbers[numbers.length - 1]; + numbers.pop(); + /** + * 13. Let counter be zero. + * 14. For each n in numbers: + * 14.2. Increment ipv4 by n × 256**(3 − counter). + * 14.2. Increment counter by 1. + */ + var counter = 0; + try { + for (var numbers_1 = __values(numbers), numbers_1_1 = numbers_1.next(); !numbers_1_1.done; numbers_1_1 = numbers_1.next()) { + var n = numbers_1_1.value; + ipv4 += n * Math.pow(256, 3 - counter); + counter++; + } + } + catch (e_7_1) { e_7 = { error: e_7_1 }; } + finally { + try { + if (numbers_1_1 && !numbers_1_1.done && (_b = numbers_1.return)) _b.call(numbers_1); + } + finally { if (e_7) throw e_7.error; } + } + /** + * 15. Return ipv4. + */ + return ipv4; +} +exports.iPv4Parser = iPv4Parser; +/** + * Parses a string containing an IP v6 address. + * + * @param input - input string + */ +function iPv6Parser(input) { + var _a; + /** + * 1. Let address be a new IPv6 address whose IPv6 pieces are all 0. + * 2. Let pieceIndex be 0. + * 3. Let compress be null. + * 4. Let pointer be a pointer into input, initially 0 (pointing to the + * first code point). + */ + var EOF = ""; + var address = [0, 0, 0, 0, 0, 0, 0, 0]; + var pieceIndex = 0; + var compress = null; + var walker = new util_1.StringWalker(input); + /** + * 5. If c is U+003A (:), then: + * 5.1. If remaining does not start with U+003A (:), validation error, + * return failure. + * 5.2. Increase pointer by 2. + * 5.3. Increase pieceIndex by 1 and then set compress to pieceIndex. + */ + if (walker.c() === ':') { + if (!walker.remaining().startsWith(':')) { + validationError("Invalid IP v6 address."); + return null; + } + walker.pointer += 2; + pieceIndex += 1; + compress = pieceIndex; + } + /** + * 6. While c is not the EOF code point: + */ + while (walker.c() !== EOF) { + /** + * 6.1. If pieceIndex is 8, validation error, return failure. + */ + if (pieceIndex === 8) { + validationError("Invalid IP v6 address."); + return null; + } + /** + * 6.2. If c is U+003A (:), then: + * 6.2.1. If compress is non-null, validation error, return failure. + * 6.2.2. Increase pointer and pieceIndex by 1, set compress to pieceIndex, + * and then continue. + */ + if (walker.c() === ':') { + if (compress !== null) { + validationError("Invalid IP v6 address."); + return null; + } + walker.pointer++; + pieceIndex++; + compress = pieceIndex; + continue; + } + /** + * 6.3. Let value and length be 0. + * 6.4. While length is less than 4 and c is an ASCII hex digit, set value + * to value × 0x10 + c interpreted as hexadecimal number, and increase + * pointer and length by 1. + */ + var value = 0; + var length = 0; + while (length < 4 && infra_1.codePoint.ASCIIHexDigit.test(walker.c())) { + value = value * 0x10 + parseInt(walker.c(), 16); + walker.pointer++; + length++; + } + /** + * 6.5. If c is U+002E (.), then: + */ + if (walker.c() === '.') { + /** + * 6.5.1. If length is 0, validation error, return failure. + * 6.5.2. Decrease pointer by length. + * 6.5.3. If pieceIndex is greater than 6, validation error, return + * failure. + * 6.5.4. Let numbersSeen be 0. + */ + if (length === 0) { + validationError("Invalid IP v6 address."); + return null; + } + walker.pointer -= length; + if (pieceIndex > 6) { + validationError("Invalid IP v6 address."); + return null; + } + var numbersSeen = 0; + /** + * 6.5.5. While c is not the EOF code point: + */ + while (walker.c() !== EOF) { + /** + * 6.5.5.1. Let ipv4Piece be null. + */ + var ipv4Piece = null; + /** + * 6.5.5.2. If numbersSeen is greater than 0, then: + * 6.5.5.2.1. If c is a U+002E (.) and numbersSeen is less than 4, then + * increase pointer by 1. + * 6.5.5.2.1. Otherwise, validation error, return failure. + */ + if (numbersSeen > 0) { + if (walker.c() === '.' && numbersSeen < 4) { + walker.pointer++; + } + else { + validationError("Invalid IP v6 address."); + return null; + } + } + /** + * 6.5.5.3. If c is not an ASCII digit, validation error, return + * failure. + */ + if (!infra_1.codePoint.ASCIIDigit.test(walker.c())) { + validationError("Invalid IP v6 address."); + return null; + } + /** + * 6.5.5.4. While c is an ASCII digit: + */ + while (infra_1.codePoint.ASCIIDigit.test(walker.c())) { + /** + * 6.5.5.4.1. Let number be c interpreted as decimal number. + */ + var number = parseInt(walker.c(), 10); + /** + * 6.5.5.4.2. If ipv4Piece is null, then set ipv4Piece to number. + * Otherwise, if ipv4Piece is 0, validation error, return failure. + * Otherwise, set ipv4Piece to ipv4Piece × 10 + number. + */ + if (ipv4Piece === null) { + ipv4Piece = number; + } + else if (ipv4Piece === 0) { + validationError("Invalid IP v6 address."); + return null; + } + else { + ipv4Piece = ipv4Piece * 10 + number; + } + /** + * 6.5.5.4.3. If ipv4Piece is greater than 255, validation error, return failure. + * 6.5.5.4.4. Increase pointer by 1. + */ + if (ipv4Piece > 255) { + validationError("Invalid IP v6 address."); + return null; + } + walker.pointer++; + } + /** + * 6.5.5.5. Set address[pieceIndex] to address[pieceIndex] × 0x100 + ipv4Piece. + * 6.5.5.6. Increase numbersSeen by 1. + * 6.5.5.7. If numbersSeen is 2 or 4, then increase pieceIndex by 1. + */ + if (ipv4Piece === null) { + validationError("Invalid IP v6 address."); + return null; + } + address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; + numbersSeen++; + if (numbersSeen === 2 || numbersSeen === 4) + pieceIndex++; + } + /** + * 6.5.6. If numbersSeen is not 4, validation error, return failure. + */ + if (numbersSeen !== 4) { + validationError("Invalid IP v6 address."); + return null; + } + /** + * 6.5.7. Break. + */ + break; + } + else if (walker.c() === ':') { + /** + * 6.6. Otherwise, if c is U+003A (:): + * 6.6.1. Increase pointer by 1. + * 6.6.2. If c is the EOF code point, validation error, return failure. + */ + walker.pointer++; + if (walker.c() === EOF) { + validationError("Invalid IP v6 address."); + return null; + } + } + else if (walker.c() !== EOF) { + /** + * 6.7. Otherwise, if c is not the EOF code point, validation error, + * return failure. + */ + validationError("Invalid IP v6 address."); + return null; + } + /** + * 6.8. Set address[pieceIndex] to value. + * 6.9. Increase pieceIndex by 1. + */ + address[pieceIndex] = value; + pieceIndex++; + } + /** + * 7. If compress is non-null, then: + * 7.1. Let swaps be pieceIndex − compress. + * 7.2. Set pieceIndex to 7. + * 7.3. While pieceIndex is not 0 and swaps is greater than 0, swap + * address[pieceIndex] with address[compress + swaps − 1], and then decrease + * both pieceIndex and swaps by 1. + */ + if (compress !== null) { + var swaps = pieceIndex - compress; + pieceIndex = 7; + while (pieceIndex !== 0 && swaps > 0) { + _a = __read([address[compress + swaps - 1], address[pieceIndex]], 2), address[pieceIndex] = _a[0], address[compress + swaps - 1] = _a[1]; + pieceIndex--; + swaps--; + } + } + else if (compress === null && pieceIndex !== 8) { + /** + * 8. Otherwise, if compress is null and pieceIndex is not 8, + * validation error, return failure. + */ + validationError("Invalid IP v6 address."); + return null; + } + /** + * 9. Return address. + */ + return address; +} +exports.iPv6Parser = iPv6Parser; +/** + * Parses an opaque host string. + * + * @param input - a string + */ +function opaqueHostParser(input) { + var e_8, _a; + /** + * 1. If input contains a forbidden host code point excluding U+0025 (%), + * validation error, return failure. + * 2. Let output be the empty string. + * 3. For each code point in input, UTF-8 percent encode it using the C0 + * control percent-encode set, and append the result to output. + * 4. Return output. + */ + var forbiddenChars = /[\x00\t\f\r #/:?@\[\\\]]/; + if (forbiddenChars.test(input)) { + validationError("Invalid host string."); + return null; + } + var output = ""; + try { + for (var input_1 = __values(input), input_1_1 = input_1.next(); !input_1_1.done; input_1_1 = input_1.next()) { + var codePoint = input_1_1.value; + output += utf8PercentEncode(codePoint, _c0ControlPercentEncodeSet); + } + } + catch (e_8_1) { e_8 = { error: e_8_1 }; } + finally { + try { + if (input_1_1 && !input_1_1.done && (_a = input_1.return)) _a.call(input_1); + } + finally { if (e_8) throw e_8.error; } + } + return output; +} +exports.opaqueHostParser = opaqueHostParser; +/** + * Resolves a Blob URL from the user agent's Blob URL store. + * function is not implemented. + * See: https://w3c.github.io/FileAPI/#blob-url-resolve + * + * @param url - an url + */ +function resolveABlobURL(url) { + return null; +} +exports.resolveABlobURL = resolveABlobURL; +/** + * Percent encodes a byte. + * + * @param value - a byte + */ +function percentEncode(value) { + /** + * To percent encode a byte into a percent-encoded byte, return a string + * consisting of U+0025 (%), followed by two ASCII upper hex digits + * representing byte. + */ + return '%' + ('00' + value.toString(16).toUpperCase()).slice(-2); +} +exports.percentEncode = percentEncode; +/** + * Percent decodes a byte sequence input. + * + * @param input - a byte sequence + */ +function percentDecode(input) { + var isHexDigit = function (byte) { + return (byte >= 0x30 && byte <= 0x39) || (byte >= 0x41 && byte <= 0x46) || + (byte >= 0x61 && byte <= 0x66); + }; + /** + * 1. Let output be an empty byte sequence. + * 2. For each byte byte in input: + */ + var output = new Uint8Array(input.length); + var n = 0; + for (var i = 0; i < input.length; i++) { + var byte = input[i]; + /** + * 2.1. If byte is not 0x25 (%), then append byte to output. + * 2.2. Otherwise, if byte is 0x25 (%) and the next two bytes after byte + * in input are not in the ranges 0x30 (0) to 0x39 (9), 0x41 (A) + * to 0x46 (F), and 0x61 (a) to 0x66 (f), all inclusive, append byte + * to output. + * 2.3. Otherwise: + * 2.3.1. Let bytePoint be the two bytes after byte in input, decoded, + * and then interpreted as hexadecimal number. + * 2.3.2. Append a byte whose value is bytePoint to output. + * 2.3.3. Skip the next two bytes in input. + */ + if (byte !== 0x25) { + output[n] = byte; + n++; + } + else if (byte === 0x25 && i >= input.length - 2) { + output[n] = byte; + n++; + } + else if (byte === 0x25 && (!isHexDigit(input[i + 1]) || !isHexDigit(input[i + 2]))) { + output[n] = byte; + n++; + } + else { + var bytePoint = parseInt(util_1.utf8Decode(Uint8Array.of(input[i + 1], input[i + 2])), 16); + output[n] = bytePoint; + n++; + i += 2; + } + } + return output.subarray(0, n); +} +exports.percentDecode = percentDecode; +/** + * String percent decodes a string. + * + * @param input - a string + */ +function stringPercentDecode(input) { + /** + * 1. Let bytes be the UTF-8 encoding of input. + * 2. Return the percent decoding of bytes. + */ + return percentDecode(util_1.utf8Encode(input)); +} +exports.stringPercentDecode = stringPercentDecode; +/** + * UTF-8 percent encodes a code point, using a percent encode set. + * + * @param codePoint - a code point + * @param percentEncodeSet - a percent encode set + */ +function utf8PercentEncode(codePoint, percentEncodeSet) { + var e_9, _a; + /** + * 1. If codePoint is not in percentEncodeSet, then return codePoint. + * 2. Let bytes be the result of running UTF-8 encode on codePoint. + * 3. Percent encode each byte in bytes, and then return the results + * concatenated, in the same order. + */ + if (!percentEncodeSet.test(codePoint)) + return codePoint; + var bytes = util_1.utf8Encode(codePoint); + var result = ""; + try { + for (var bytes_2 = __values(bytes), bytes_2_1 = bytes_2.next(); !bytes_2_1.done; bytes_2_1 = bytes_2.next()) { + var byte = bytes_2_1.value; + result += percentEncode(byte); + } + } + catch (e_9_1) { e_9 = { error: e_9_1 }; } + finally { + try { + if (bytes_2_1 && !bytes_2_1.done && (_a = bytes_2.return)) _a.call(bytes_2); + } + finally { if (e_9) throw e_9.error; } + } + return result; +} +exports.utf8PercentEncode = utf8PercentEncode; +/** + * Determines if two hosts are considered equal. + * + * @param hostA - a host + * @param hostB - a host + */ +function hostEquals(hostA, hostB) { + return hostA === hostB; +} +exports.hostEquals = hostEquals; +/** + * Determines if two URLs are considered equal. + * + * @param urlA - a URL + * @param urlB - a URL + * @param excludeFragmentsFlag - whether to ignore fragments while comparing + */ +function urlEquals(urlA, urlB, excludeFragmentsFlag) { + if (excludeFragmentsFlag === void 0) { excludeFragmentsFlag = false; } + /** + * 1. Let serializedA be the result of serializing A, with the exclude + * fragment flag set if the exclude fragments flag is set. + * 2. Let serializedB be the result of serializing B, with the exclude + * fragment flag set if the exclude fragments flag is set. + * 3. Return true if serializedA is serializedB, and false otherwise. + */ + return urlSerializer(urlA, excludeFragmentsFlag) === + urlSerializer(urlB, excludeFragmentsFlag); +} +exports.urlEquals = urlEquals; +/** + * Parses an `application/x-www-form-urlencoded` string. + * + * @param input - a string + */ +function urlEncodedStringParser(input) { + /** + * The application/x-www-form-urlencoded string parser takes a string input, + * UTF-8 encodes it, and then returns the result of + * application/x-www-form-urlencoded parsing it. + */ + return urlEncodedParser(util_1.utf8Encode(input)); +} +exports.urlEncodedStringParser = urlEncodedStringParser; +/** + * Parses `application/x-www-form-urlencoded` bytes. + * + * @param input - a byte sequence + */ +function urlEncodedParser(input) { + var e_10, _a, e_11, _b; + /** + * 1. Let sequences be the result of splitting input on 0x26 (&). + */ + var sequences = []; + var currentSequence = []; + try { + for (var input_2 = __values(input), input_2_1 = input_2.next(); !input_2_1.done; input_2_1 = input_2.next()) { + var byte = input_2_1.value; + if (byte === 0x26) { + sequences.push(Uint8Array.from(currentSequence)); + currentSequence = []; + } + else { + currentSequence.push(byte); + } + } + } + catch (e_10_1) { e_10 = { error: e_10_1 }; } + finally { + try { + if (input_2_1 && !input_2_1.done && (_a = input_2.return)) _a.call(input_2); + } + finally { if (e_10) throw e_10.error; } + } + if (currentSequence.length !== 0) { + sequences.push(Uint8Array.from(currentSequence)); + } + /** + * 2. Let output be an initially empty list of name-value tuples where both name and value hold a string. + */ + var output = []; + try { + /** + * 3. For each byte sequence bytes in sequences: + */ + for (var sequences_1 = __values(sequences), sequences_1_1 = sequences_1.next(); !sequences_1_1.done; sequences_1_1 = sequences_1.next()) { + var bytes = sequences_1_1.value; + /** + * 3.1. If bytes is the empty byte sequence, then continue. + */ + if (bytes.length === 0) + continue; + /** + * 3.2. If bytes contains a 0x3D (=), then let name be the bytes from the + * start of bytes up to but excluding its first 0x3D (=), and let value be + * the bytes, if any, after the first 0x3D (=) up to the end of bytes. + * If 0x3D (=) is the first byte, then name will be the empty byte + * sequence. If it is the last, then value will be the empty byte sequence. + * 3.3. Otherwise, let name have the value of bytes and let value be the + * empty byte sequence. + */ + var index = bytes.indexOf(0x3D); + var name = (index !== -1 ? bytes.slice(0, index) : bytes); + var value = (index !== -1 ? bytes.slice(index + 1) : new Uint8Array()); + /** + * 3.4. Replace any 0x2B (+) in name and value with 0x20 (SP). + */ + for (var i = 0; i < name.length; i++) + if (name[i] === 0x2B) + name[i] = 0x20; + for (var i = 0; i < value.length; i++) + if (value[i] === 0x2B) + value[i] = 0x20; + /** + * 3.5. Let nameString and valueString be the result of running UTF-8 + * decode without BOM on the percent decoding of name and value, + * respectively. + */ + var nameString = util_1.utf8Decode(name); + var valueString = util_1.utf8Decode(value); + /** + * 3.6. Append (nameString, valueString) to output. + */ + output.push([nameString, valueString]); + } + } + catch (e_11_1) { e_11 = { error: e_11_1 }; } + finally { + try { + if (sequences_1_1 && !sequences_1_1.done && (_b = sequences_1.return)) _b.call(sequences_1); + } + finally { if (e_11) throw e_11.error; } + } + /** + * 4. Return output. + */ + return output; +} +exports.urlEncodedParser = urlEncodedParser; +/** + * Serializes `application/x-www-form-urlencoded` bytes. + * + * @param input - a byte sequence + */ +function urlEncodedByteSerializer(input) { + var e_12, _a; + /** + * 1. Let output be the empty string. + * 2. For each byte in input, depending on byte: + * 0x20 (SP) + * Append U+002B (+) to output. + * + * 0x2A (*) + * 0x2D (-) + * 0x2E (.) + * 0x30 (0) to 0x39 (9) + * 0x41 (A) to 0x5A (Z) + * 0x5F (_) + * 0x61 (a) to 0x7A (z) + * Append a code point whose value is byte to output. + * + * Otherwise + * Append byte, percent encoded, to output. + * 3. Return output. + */ + var output = ""; + try { + for (var input_3 = __values(input), input_3_1 = input_3.next(); !input_3_1.done; input_3_1 = input_3.next()) { + var byte = input_3_1.value; + if (byte === 0x20) { + output += '+'; + } + else if (byte === 0x2A || byte === 0x2D || byte === 0x2E || + (byte >= 0x30 && byte <= 0x39) || (byte >= 0x41 && byte <= 0x5A) || + byte === 0x5F || (byte >= 0x61 && byte <= 0x7A)) { + output += String.fromCodePoint(byte); + } + else { + output += percentEncode(byte); + } + } + } + catch (e_12_1) { e_12 = { error: e_12_1 }; } + finally { + try { + if (input_3_1 && !input_3_1.done && (_a = input_3.return)) _a.call(input_3); + } + finally { if (e_12) throw e_12.error; } + } + return output; +} +exports.urlEncodedByteSerializer = urlEncodedByteSerializer; +/** + * Serializes `application/x-www-form-urlencoded` tuples. + * + * @param input - input tuple of name/value pairs + * @param encodingOverride: encoding override + */ +function urlEncodedSerializer(tuples, encodingOverride) { + var e_13, _a; + /** + * 1. Let encoding be UTF-8. + * 2. If encoding override is given, set encoding to the result of getting + * an output encoding from encoding override. + */ + var encoding = (encodingOverride === undefined || + encodingOverride === "replacement" || encodingOverride === "UTF-16BE" || + encodingOverride === "UTF-16LE" ? "UTF-8" : encodingOverride); + if (encoding.toUpperCase() !== "UTF-8") { + throw new Error("Only UTF-8 encoding is supported."); + } + /** + * 3. Let output be the empty string. + */ + var output = ""; + try { + /** + * 4. For each tuple in tuples: + */ + for (var tuples_1 = __values(tuples), tuples_1_1 = tuples_1.next(); !tuples_1_1.done; tuples_1_1 = tuples_1.next()) { + var tuple = tuples_1_1.value; + /** + * 4.1. Let name be the result of serializing the result of encoding + * tuple’s name, using encoding. + */ + var name = urlEncodedByteSerializer(util_1.utf8Encode(tuple[0])); + /** + * 4.2. Let value be tuple’s value. + */ + var value = tuple[1]; + /** + * TODO: + * 4.3. If value is a file, then set value to value’s filename. + */ + /** + * 4.4. Set value to the result of serializing the result of encoding + * value, using encoding. + */ + value = urlEncodedByteSerializer(util_1.utf8Encode(value)); + /** + * 4.5. If tuple is not the first pair in tuples, then append U+0026 (&) + * to output. + */ + if (output !== "") + output += '&'; + /** + * 4.6. Append name, followed by U+003D (=), followed by value, to output. + */ + output += name + '=' + value; + } + } + catch (e_13_1) { e_13 = { error: e_13_1 }; } + finally { + try { + if (tuples_1_1 && !tuples_1_1.done && (_a = tuples_1.return)) _a.call(tuples_1); + } + finally { if (e_13) throw e_13.error; } + } + /** + * 5. Return output. + */ + return output; +} +exports.urlEncodedSerializer = urlEncodedSerializer; +/** + * Returns a URL's origin. + * + * @param url - a URL + */ +function origin(url) { + /** + * A URL’s origin is the origin returned by running these steps, switching + * on URL’s scheme: + * "blob" + * 1. If URL’s blob URL entry is non-null, then return URL’s blob URL + * entry’s environment’s origin. + * 2. Let url be the result of parsing URL’s path[0]. + * 3. Return a new opaque origin, if url is failure, and url’s origin + * otherwise. + * "ftp" + * "http" + * "https" + * "ws" + * "wss" + * Return a tuple consisting of URL’s scheme, URL’s host, URL’s port, and + * null. + * "file" + * Unfortunate as it is, is left as an exercise to the reader. When in + * doubt, return a new opaque origin. + * Otherwise + * Return a new opaque origin. + */ + switch (url.scheme) { + case "blob": + if (url._blobURLEntry !== null) { + // TODO: return URL’s blob URL entry’s environment’s origin. + } + var parsedURL = basicURLParser(url.path[0]); + if (parsedURL === null) + return interfaces_1.OpaqueOrigin; + else + return origin(parsedURL); + case "ftp": + case "http": + case "https": + case "ws": + case "wss": + return [url.scheme, url.host === null ? "" : url.host, url.port, null]; + case "file": + return interfaces_1.OpaqueOrigin; + default: + return interfaces_1.OpaqueOrigin; + } +} +exports.origin = origin; +/** + * Converts a domain string to ASCII. + * + * @param domain - a domain string + */ +function domainToASCII(domain, beStrict) { + if (beStrict === void 0) { beStrict = false; } + /** + * 1. If beStrict is not given, set it to false. + * 2. Let result be the result of running Unicode ToASCII with domain_name + * set to domain, UseSTD3ASCIIRules set to beStrict, CheckHyphens set to + * false, CheckBidi set to true, CheckJoiners set to true, + * Transitional_Processing set to false, and VerifyDnsLength set to beStrict. + * 3. If result is a failure value, validation error, return failure. + * 4. Return result. + */ + // Use node.js function + var result = url_1.domainToASCII(domain); + if (result === "") { + validationError("Invalid domain name."); + return null; + } + return result; +} +exports.domainToASCII = domainToASCII; +/** + * Converts a domain string to Unicode. + * + * @param domain - a domain string + */ +function domainToUnicode(domain, beStrict) { + if (beStrict === void 0) { beStrict = false; } + /** + * 1. Let result be the result of running Unicode ToUnicode with domain_name + * set to domain, CheckHyphens set to false, CheckBidi set to true, + * CheckJoiners set to true, UseSTD3ASCIIRules set to false, and + * Transitional_Processing set to false. + * 2. Signify validation errors for any returned errors, and then, + * return result. + */ + // Use node.js function + var result = url_1.domainToUnicode(domain); + if (result === "") { + validationError("Invalid domain name."); + } + return result; +} +exports.domainToUnicode = domainToUnicode; +/** + * Serializes an origin. + * function is from the HTML spec: + * https://html.spec.whatwg.org/#ascii-serialisation-of-an-origin + * + * @param origin - an origin + */ +function asciiSerializationOfAnOrigin(origin) { + /** + * 1. If origin is an opaque origin, then return "null". + * 2. Otherwise, let result be origin's scheme. + * 3. Append "://" to result. + * 4. Append origin's host, serialized, to result. + * 5. If origin's port is non-null, append a U+003A COLON character (:), + * and origin's port, serialized, to result. + * 6. Return result. + */ + if (origin[0] === "" && origin[1] === "" && origin[2] === null && origin[3] === null) { + return "null"; + } + var result = origin[0] + "://" + hostSerializer(origin[1]); + if (origin[2] !== null) + result += ":" + origin[2].toString(); + return result; +} +exports.asciiSerializationOfAnOrigin = asciiSerializationOfAnOrigin; +//# sourceMappingURL=URLAlgorithm.js.map + +/***/ }), + +/***/ 31752: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Represents the state of the URL parser. + */ +var ParserState; +(function (ParserState) { + ParserState[ParserState["SchemeStart"] = 0] = "SchemeStart"; + ParserState[ParserState["Scheme"] = 1] = "Scheme"; + ParserState[ParserState["NoScheme"] = 2] = "NoScheme"; + ParserState[ParserState["SpecialRelativeOrAuthority"] = 3] = "SpecialRelativeOrAuthority"; + ParserState[ParserState["PathOrAuthority"] = 4] = "PathOrAuthority"; + ParserState[ParserState["Relative"] = 5] = "Relative"; + ParserState[ParserState["RelativeSlash"] = 6] = "RelativeSlash"; + ParserState[ParserState["SpecialAuthoritySlashes"] = 7] = "SpecialAuthoritySlashes"; + ParserState[ParserState["SpecialAuthorityIgnoreSlashes"] = 8] = "SpecialAuthorityIgnoreSlashes"; + ParserState[ParserState["Authority"] = 9] = "Authority"; + ParserState[ParserState["Host"] = 10] = "Host"; + ParserState[ParserState["Hostname"] = 11] = "Hostname"; + ParserState[ParserState["Port"] = 12] = "Port"; + ParserState[ParserState["File"] = 13] = "File"; + ParserState[ParserState["FileSlash"] = 14] = "FileSlash"; + ParserState[ParserState["FileHost"] = 15] = "FileHost"; + ParserState[ParserState["PathStart"] = 16] = "PathStart"; + ParserState[ParserState["Path"] = 17] = "Path"; + ParserState[ParserState["CannotBeABaseURLPath"] = 18] = "CannotBeABaseURLPath"; + ParserState[ParserState["Query"] = 19] = "Query"; + ParserState[ParserState["Fragment"] = 20] = "Fragment"; +})(ParserState = exports.ParserState || (exports.ParserState = {})); +exports.OpaqueOrigin = ["", "", null, null]; +//# sourceMappingURL=interfaces.js.map + +/***/ }), + +/***/ 27561: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Represents a cache for storing order between equal objects. + * + * This cache is used when an algorithm compares two objects and finds them to + * be equal but still needs to establish an order between those two objects. + * When two such objects `a` and `b` are passed to the `check` method, a random + * number is generated with `Math.random()`. If the random number is less than + * `0.5` it is assumed that `a < b` otherwise `a > b`. The random number along + * with `a` and `b` is stored in the cache, so that subsequent checks result + * in the same consistent result. + * + * The cache has a size limit which is defined on initialization. + */ +var CompareCache = /** @class */ (function () { + /** + * Initializes a new instance of `CompareCache`. + * + * @param limit - maximum number of items to keep in the cache. When the limit + * is exceeded the first item is removed from the cache. + */ + function CompareCache(limit) { + if (limit === void 0) { limit = 1000; } + this._items = new Map(); + this._limit = limit; + } + /** + * Compares and caches the given objects. Returns `true` if `objA < objB` and + * `false` otherwise. + * + * @param objA - an item to compare + * @param objB - an item to compare + */ + CompareCache.prototype.check = function (objA, objB) { + if (this._items.get(objA) === objB) + return true; + else if (this._items.get(objB) === objA) + return false; + var result = (Math.random() < 0.5); + if (result) { + this._items.set(objA, objB); + } + else { + this._items.set(objB, objA); + } + if (this._items.size > this._limit) { + var it_1 = this._items.keys().next(); + /* istanbul ignore else */ + if (!it_1.done) { + this._items.delete(it_1.value); + } + } + return result; + }; + return CompareCache; +}()); +exports.CompareCache = CompareCache; +//# sourceMappingURL=CompareCache.js.map + +/***/ }), + +/***/ 16006: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Represents a set of objects with a size limit. + */ +var FixedSizeSet = /** @class */ (function () { + /** + * Initializes a new instance of `FixedSizeSet`. + * + * @param limit - maximum number of items to keep in the set. When the limit + * is exceeded the first item is removed from the set. + */ + function FixedSizeSet(limit) { + if (limit === void 0) { limit = 1000; } + this._items = new Set(); + this._limit = limit; + } + /** + * Adds a new item to the set. + * + * @param item - an item + */ + FixedSizeSet.prototype.add = function (item) { + this._items.add(item); + if (this._items.size > this._limit) { + var it_1 = this._items.values().next(); + /* istanbul ignore else */ + if (!it_1.done) { + this._items.delete(it_1.value); + } + } + return this; + }; + /** + * Removes an item from the set. + * + * @param item - an item + */ + FixedSizeSet.prototype.delete = function (item) { + return this._items.delete(item); + }; + /** + * Determines if an item is in the set. + * + * @param item - an item + */ + FixedSizeSet.prototype.has = function (item) { + return this._items.has(item); + }; + /** + * Removes all items from the set. + */ + FixedSizeSet.prototype.clear = function () { + this._items.clear(); + }; + Object.defineProperty(FixedSizeSet.prototype, "size", { + /** + * Gets the number of items in the set. + */ + get: function () { return this._items.size; }, + enumerable: true, + configurable: true + }); + /** + * Applies the given callback function to all elements of the set. + */ + FixedSizeSet.prototype.forEach = function (callback, thisArg) { + var _this = this; + this._items.forEach(function (e) { return callback.call(thisArg, e, e, _this); }); + }; + /** + * Iterates through the items in the set. + */ + FixedSizeSet.prototype.keys = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(this._items.keys())]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + /** + * Iterates through the items in the set. + */ + FixedSizeSet.prototype.values = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(this._items.values())]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + /** + * Iterates through the items in the set. + */ + FixedSizeSet.prototype.entries = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(this._items.entries())]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + /** + * Iterates through the items in the set. + */ + FixedSizeSet.prototype[Symbol.iterator] = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(this._items)]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + Object.defineProperty(FixedSizeSet.prototype, Symbol.toStringTag, { + /** + * Returns the string tag of the set. + */ + get: function () { + return "FixedSizeSet"; + }, + enumerable: true, + configurable: true + }); + return FixedSizeSet; +}()); +exports.FixedSizeSet = FixedSizeSet; +//# sourceMappingURL=FixedSizeSet.js.map + +/***/ }), + +/***/ 11857: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Represents an object with lazy initialization. + */ +var Lazy = /** @class */ (function () { + /** + * Initializes a new instance of `Lazy`. + * + * @param initFunc - initializer function + */ + function Lazy(initFunc) { + this._initialized = false; + this._value = undefined; + this._initFunc = initFunc; + } + Object.defineProperty(Lazy.prototype, "value", { + /** + * Gets the value of the object. + */ + get: function () { + if (!this._initialized) { + this._value = this._initFunc(); + this._initialized = true; + } + return this._value; + }, + enumerable: true, + configurable: true + }); + return Lazy; +}()); +exports.Lazy = Lazy; +//# sourceMappingURL=Lazy.js.map + +/***/ }), + +/***/ 25798: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Represents a cache of objects with a size limit. + */ +var ObjectCache = /** @class */ (function () { + /** + * Initializes a new instance of `ObjectCache`. + * + * @param limit - maximum number of items to keep in the cache. When the limit + * is exceeded the first item is removed from the cache. + */ + function ObjectCache(limit) { + if (limit === void 0) { limit = 1000; } + this._items = new Map(); + this._limit = limit; + } + /** + * Gets an item from the cache. + * + * @param key - object key + */ + ObjectCache.prototype.get = function (key) { + return this._items.get(key); + }; + /** + * Adds a new item to the cache. + * + * @param key - object key + * @param value - object value + */ + ObjectCache.prototype.set = function (key, value) { + this._items.set(key, value); + if (this._items.size > this._limit) { + var it_1 = this._items.keys().next(); + /* istanbul ignore else */ + if (!it_1.done) { + this._items.delete(it_1.value); + } + } + }; + /** + * Removes an item from the cache. + * + * @param item - an item + */ + ObjectCache.prototype.delete = function (key) { + return this._items.delete(key); + }; + /** + * Determines if an item is in the cache. + * + * @param item - an item + */ + ObjectCache.prototype.has = function (key) { + return this._items.has(key); + }; + /** + * Removes all items from the cache. + */ + ObjectCache.prototype.clear = function () { + this._items.clear(); + }; + Object.defineProperty(ObjectCache.prototype, "size", { + /** + * Gets the number of items in the cache. + */ + get: function () { return this._items.size; }, + enumerable: true, + configurable: true + }); + /** + * Applies the given callback function to all elements of the cache. + */ + ObjectCache.prototype.forEach = function (callback, thisArg) { + this._items.forEach(function (v, k) { return callback.call(thisArg, k, v); }); + }; + /** + * Iterates through the items in the set. + */ + ObjectCache.prototype.keys = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(this._items.keys())]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + /** + * Iterates through the items in the set. + */ + ObjectCache.prototype.values = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(this._items.values())]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + /** + * Iterates through the items in the set. + */ + ObjectCache.prototype.entries = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(this._items.entries())]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + /** + * Iterates through the items in the set. + */ + ObjectCache.prototype[Symbol.iterator] = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(this._items)]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + Object.defineProperty(ObjectCache.prototype, Symbol.toStringTag, { + /** + * Returns the string tag of the cache. + */ + get: function () { + return "ObjectCache"; + }, + enumerable: true, + configurable: true + }); + return ObjectCache; +}()); +exports.ObjectCache = ObjectCache; +//# sourceMappingURL=ObjectCache.js.map + +/***/ }), + +/***/ 34145: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Walks through the code points of a string. + */ +var StringWalker = /** @class */ (function () { + /** + * Initializes a new `StringWalker`. + * + * @param input - input string + */ + function StringWalker(input) { + this._pointer = 0; + this._chars = Array.from(input); + this._length = this._chars.length; + } + Object.defineProperty(StringWalker.prototype, "eof", { + /** + * Determines if the current position is beyond the end of string. + */ + get: function () { return this._pointer >= this._length; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(StringWalker.prototype, "length", { + /** + * Returns the number of code points in the input string. + */ + get: function () { return this._length; }, + enumerable: true, + configurable: true + }); + /** + * Returns the current code point. Returns `-1` if the position is beyond + * the end of string. + */ + StringWalker.prototype.codePoint = function () { + if (this._codePoint === undefined) { + if (this.eof) { + this._codePoint = -1; + } + else { + var cp = this._chars[this._pointer].codePointAt(0); + /* istanbul ignore else */ + if (cp !== undefined) { + this._codePoint = cp; + } + else { + this._codePoint = -1; + } + } + } + return this._codePoint; + }; + /** + * Returns the current character. Returns an empty string if the position is + * beyond the end of string. + */ + StringWalker.prototype.c = function () { + if (this._c === undefined) { + this._c = (this.eof ? "" : this._chars[this._pointer]); + } + return this._c; + }; + /** + * Returns the remaining string. + */ + StringWalker.prototype.remaining = function () { + if (this._remaining === undefined) { + this._remaining = (this.eof ? + "" : this._chars.slice(this._pointer + 1).join('')); + } + return this._remaining; + }; + /** + * Returns the substring from the current character to the end of string. + */ + StringWalker.prototype.substring = function () { + if (this._substring === undefined) { + this._substring = (this.eof ? + "" : this._chars.slice(this._pointer).join('')); + } + return this._substring; + }; + Object.defineProperty(StringWalker.prototype, "pointer", { + /** + * Gets or sets the current position. + */ + get: function () { return this._pointer; }, + set: function (val) { + if (val === this._pointer) + return; + this._pointer = val; + this._codePoint = undefined; + this._c = undefined; + this._remaining = undefined; + this._substring = undefined; + }, + enumerable: true, + configurable: true + }); + return StringWalker; +}()); +exports.StringWalker = StringWalker; +//# sourceMappingURL=StringWalker.js.map + +/***/ }), + +/***/ 76195: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var FixedSizeSet_1 = __nccwpck_require__(16006); +exports.FixedSizeSet = FixedSizeSet_1.FixedSizeSet; +var ObjectCache_1 = __nccwpck_require__(25798); +exports.ObjectCache = ObjectCache_1.ObjectCache; +var CompareCache_1 = __nccwpck_require__(27561); +exports.CompareCache = CompareCache_1.CompareCache; +var Lazy_1 = __nccwpck_require__(11857); +exports.Lazy = Lazy_1.Lazy; +var StringWalker_1 = __nccwpck_require__(34145); +exports.StringWalker = StringWalker_1.StringWalker; +/** + * Applies the mixin to a given class. + * + * @param baseClass - class to receive the mixin + * @param mixinClass - mixin class + * @param overrides - an array with names of function overrides. Base class + * functions whose names are in this array will be kept by prepending an + * underscore to their names. + */ +function applyMixin(baseClass, mixinClass) { + var overrides = []; + for (var _i = 2; _i < arguments.length; _i++) { + overrides[_i - 2] = arguments[_i]; + } + Object.getOwnPropertyNames(mixinClass.prototype).forEach(function (name) { + if (name !== "constructor") { + if (overrides.indexOf(name) !== -1) { + var orgPropDesc = Object.getOwnPropertyDescriptor(baseClass.prototype, name); + /* istanbul ignore else */ + if (orgPropDesc) { + Object.defineProperty(baseClass.prototype, "_" + name, orgPropDesc); + } + } + var propDesc = Object.getOwnPropertyDescriptor(mixinClass.prototype, name); + /* istanbul ignore else */ + if (propDesc) { + Object.defineProperty(baseClass.prototype, name, propDesc); + } + } + }); +} +exports.applyMixin = applyMixin; +/** + * Applies default values to the given object. + * + * @param obj - an object + * @param defaults - an object with default values + * @param overwrite - if set to `true` defaults object always overwrites object + * values, whether they are `undefined` or not. + */ +function applyDefaults(obj, defaults, overwrite) { + if (overwrite === void 0) { overwrite = false; } + var result = clone(obj || {}); + forEachObject(defaults, function (key, val) { + if (isPlainObject(val)) { + result[key] = applyDefaults(result[key], val, overwrite); + } + else if (overwrite || result[key] === undefined) { + result[key] = val; + } + }); + return result; +} +exports.applyDefaults = applyDefaults; +/** + * Iterates over items of an array or set. + * + * @param arr - array or set to iterate + * @param callback - a callback function which receives each array item as its + * single argument + * @param thisArg - the value of this inside callback + */ +function forEachArray(arr, callback, thisArg) { + arr.forEach(callback, thisArg); +} +exports.forEachArray = forEachArray; +/** + * Iterates over key/value pairs of a map or object. + * + * @param obj - map or object to iterate + * @param callback - a callback function which receives object key as its first + * argument and object value as its second argument + * @param thisArg - the value of this inside callback + */ +function forEachObject(obj, callback, thisArg) { + if (isMap(obj)) { + obj.forEach(function (value, key) { return callback.call(thisArg, key, value); }); + } + else { + for (var key in obj) { + /* istanbul ignore else */ + if (obj.hasOwnProperty(key)) { + callback.call(thisArg, key, obj[key]); + } + } + } +} +exports.forEachObject = forEachObject; +/** + * Returns the number of entries in an array or set. + * + * @param arr - array or set + */ +function arrayLength(obj) { + if (isSet(obj)) { + return obj.size; + } + else { + return obj.length; + } +} +exports.arrayLength = arrayLength; +/** + * Returns the number of entries in a map or object. + * + * @param obj - map or object + */ +function objectLength(obj) { + if (isMap(obj)) { + return obj.size; + } + else { + return Object.keys(obj).length; + } +} +exports.objectLength = objectLength; +/** + * Gets the value of a key from a map or object. + * + * @param obj - map or object + * @param key - the key to retrieve + */ +function getObjectValue(obj, key) { + if (isMap(obj)) { + return obj.get(key); + } + else { + return obj[key]; + } +} +exports.getObjectValue = getObjectValue; +/** + * Removes a property from a map or object. + * + * @param obj - map or object + * @param key - the key to remove + */ +function removeObjectValue(obj, key) { + if (isMap(obj)) { + obj.delete(key); + } + else { + delete obj[key]; + } +} +exports.removeObjectValue = removeObjectValue; +/** + * Deep clones the given object. + * + * @param obj - an object + */ +function clone(obj) { + var e_1, _a; + if (isFunction(obj)) { + return obj; + } + else if (isArray(obj)) { + var result = []; + try { + for (var obj_1 = __values(obj), obj_1_1 = obj_1.next(); !obj_1_1.done; obj_1_1 = obj_1.next()) { + var item = obj_1_1.value; + result.push(clone(item)); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (obj_1_1 && !obj_1_1.done && (_a = obj_1.return)) _a.call(obj_1); + } + finally { if (e_1) throw e_1.error; } + } + return result; + } + else if (isObject(obj)) { + var result = {}; + for (var key in obj) { + /* istanbul ignore next */ + if (obj.hasOwnProperty(key)) { + var val = obj[key]; + result[key] = clone(val); + } + } + return result; + } + else { + return obj; + } +} +exports.clone = clone; +/** + * Type guard for boolean types + * + * @param x - a variable to type check + */ +function isBoolean(x) { + return typeof x === "boolean"; +} +exports.isBoolean = isBoolean; +/** + * Type guard for numeric types + * + * @param x - a variable to type check + */ +function isNumber(x) { + return typeof x === "number"; +} +exports.isNumber = isNumber; +/** + * Type guard for strings + * + * @param x - a variable to type check + */ +function isString(x) { + return typeof x === "string"; +} +exports.isString = isString; +/** + * Type guard for function objects + * + * @param x - a variable to type check + */ +function isFunction(x) { + return !!x && Object.prototype.toString.call(x) === '[object Function]'; +} +exports.isFunction = isFunction; +/** + * Type guard for JS objects + * + * _Note:_ Functions are objects too + * + * @param x - a variable to type check + */ +function isObject(x) { + var type = typeof x; + return !!x && (type === 'function' || type === 'object'); +} +exports.isObject = isObject; +/** + * Type guard for arrays + * + * @param x - a variable to type check + */ +function isArray(x) { + return Array.isArray(x); +} +exports.isArray = isArray; +/** + * Type guard for sets. + * + * @param x - a variable to check + */ +function isSet(x) { + return x instanceof Set; +} +exports.isSet = isSet; +/** + * Type guard for maps. + * + * @param x - a variable to check + */ +function isMap(x) { + return x instanceof Map; +} +exports.isMap = isMap; +/** + * Determines if `x` is an empty Array or an Object with no own properties. + * + * @param x - a variable to check + */ +function isEmpty(x) { + if (isArray(x)) { + return !x.length; + } + else if (isSet(x)) { + return !x.size; + } + else if (isMap(x)) { + return !x.size; + } + else if (isObject(x)) { + for (var key in x) { + if (x.hasOwnProperty(key)) { + return false; + } + } + return true; + } + return false; +} +exports.isEmpty = isEmpty; +/** + * Determines if `x` is a plain Object. + * + * @param x - a variable to check + */ +function isPlainObject(x) { + if (isObject(x)) { + var proto = Object.getPrototypeOf(x); + var ctor = proto.constructor; + return proto && ctor && + (typeof ctor === 'function') && (ctor instanceof ctor) && + (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object)); + } + return false; +} +exports.isPlainObject = isPlainObject; +/** + * Determines if `x` is an iterable Object. + * + * @param x - a variable to check + */ +function isIterable(x) { + return x && (typeof x[Symbol.iterator] === 'function'); +} +exports.isIterable = isIterable; +/** + * Gets the primitive value of an object. + */ +function getValue(obj) { + if (isFunction(obj.valueOf)) { + return obj.valueOf(); + } + else { + return obj; + } +} +exports.getValue = getValue; +/** + * UTF-8 encodes the given string. + * + * @param input - a string + */ +function utf8Encode(input) { + var bytes = new Uint8Array(input.length * 4); + var byteIndex = 0; + for (var i = 0; i < input.length; i++) { + var char = input.charCodeAt(i); + if (char < 128) { + bytes[byteIndex++] = char; + continue; + } + else if (char < 2048) { + bytes[byteIndex++] = char >> 6 | 192; + } + else { + if (char > 0xd7ff && char < 0xdc00) { + if (++i >= input.length) { + throw new Error("Incomplete surrogate pair."); + } + var c2 = input.charCodeAt(i); + if (c2 < 0xdc00 || c2 > 0xdfff) { + throw new Error("Invalid surrogate character."); + } + char = 0x10000 + ((char & 0x03ff) << 10) + (c2 & 0x03ff); + bytes[byteIndex++] = char >> 18 | 240; + bytes[byteIndex++] = char >> 12 & 63 | 128; + } + else { + bytes[byteIndex++] = char >> 12 | 224; + } + bytes[byteIndex++] = char >> 6 & 63 | 128; + } + bytes[byteIndex++] = char & 63 | 128; + } + return bytes.subarray(0, byteIndex); +} +exports.utf8Encode = utf8Encode; +/** + * UTF-8 decodes the given byte sequence into a string. + * + * @param bytes - a byte sequence + */ +function utf8Decode(bytes) { + var result = ""; + var i = 0; + while (i < bytes.length) { + var c = bytes[i++]; + if (c > 127) { + if (c > 191 && c < 224) { + if (i >= bytes.length) { + throw new Error("Incomplete 2-byte sequence."); + } + c = (c & 31) << 6 | bytes[i++] & 63; + } + else if (c > 223 && c < 240) { + if (i + 1 >= bytes.length) { + throw new Error("Incomplete 3-byte sequence."); + } + c = (c & 15) << 12 | (bytes[i++] & 63) << 6 | bytes[i++] & 63; + } + else if (c > 239 && c < 248) { + if (i + 2 >= bytes.length) { + throw new Error("Incomplete 4-byte sequence."); + } + c = (c & 7) << 18 | (bytes[i++] & 63) << 12 | (bytes[i++] & 63) << 6 | bytes[i++] & 63; + } + else { + throw new Error("Unknown multi-byte start."); + } + } + if (c <= 0xffff) { + result += String.fromCharCode(c); + } + else if (c <= 0x10ffff) { + c -= 0x10000; + result += String.fromCharCode(c >> 10 | 0xd800); + result += String.fromCharCode(c & 0x3FF | 0xdc00); + } + else { + throw new Error("Code point exceeds UTF-16 limit."); + } + } + return result; +} +exports.utf8Decode = utf8Decode; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 57171: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __spreadArray = (this && this.__spreadArray) || function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ContextAPI = void 0; +var NoopContextManager_1 = __nccwpck_require__(54118); +var global_utils_1 = __nccwpck_require__(85135); +var diag_1 = __nccwpck_require__(11877); +var API_NAME = 'context'; +var NOOP_CONTEXT_MANAGER = new NoopContextManager_1.NoopContextManager(); +/** + * Singleton object which represents the entry point to the OpenTelemetry Context API + */ +var ContextAPI = /** @class */ (function () { + /** Empty private constructor prevents end users from constructing a new instance of the API */ + function ContextAPI() { + } + /** Get the singleton instance of the Context API */ + ContextAPI.getInstance = function () { + if (!this._instance) { + this._instance = new ContextAPI(); + } + return this._instance; + }; + /** + * Set the current context manager. + * + * @returns true if the context manager was successfully registered, else false + */ + ContextAPI.prototype.setGlobalContextManager = function (contextManager) { + return global_utils_1.registerGlobal(API_NAME, contextManager, diag_1.DiagAPI.instance()); + }; + /** + * Get the currently active context + */ + ContextAPI.prototype.active = function () { + return this._getContextManager().active(); + }; + /** + * Execute a function with an active context + * + * @param context context to be active during function execution + * @param fn function to execute in a context + * @param thisArg optional receiver to be used for calling fn + * @param args optional arguments forwarded to fn + */ + ContextAPI.prototype.with = function (context, fn, thisArg) { + var _a; + var args = []; + for (var _i = 3; _i < arguments.length; _i++) { + args[_i - 3] = arguments[_i]; + } + return (_a = this._getContextManager()).with.apply(_a, __spreadArray([context, fn, thisArg], args)); + }; + /** + * Bind a context to a target function or event emitter + * + * @param context context to bind to the event emitter or function. Defaults to the currently active context + * @param target function or event emitter to bind + */ + ContextAPI.prototype.bind = function (context, target) { + return this._getContextManager().bind(context, target); + }; + ContextAPI.prototype._getContextManager = function () { + return global_utils_1.getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER; + }; + /** Disable and remove the global context manager */ + ContextAPI.prototype.disable = function () { + this._getContextManager().disable(); + global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance()); + }; + return ContextAPI; +}()); +exports.ContextAPI = ContextAPI; +//# sourceMappingURL=context.js.map + +/***/ }), + +/***/ 11877: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DiagAPI = void 0; +var ComponentLogger_1 = __nccwpck_require__(17978); +var logLevelLogger_1 = __nccwpck_require__(99639); +var types_1 = __nccwpck_require__(78077); +var global_utils_1 = __nccwpck_require__(85135); +var API_NAME = 'diag'; +/** + * Singleton object which represents the entry point to the OpenTelemetry internal + * diagnostic API + */ +var DiagAPI = /** @class */ (function () { + /** + * Private internal constructor + * @private + */ + function DiagAPI() { + function _logProxy(funcName) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var logger = global_utils_1.getGlobal('diag'); + // shortcut if logger not set + if (!logger) + return; + return logger[funcName].apply(logger, args); + }; + } + // Using self local variable for minification purposes as 'this' cannot be minified + var self = this; + // DiagAPI specific functions + self.setLogger = function (logger, logLevel) { + var _a, _b; + if (logLevel === void 0) { logLevel = types_1.DiagLogLevel.INFO; } + if (logger === self) { + // There isn't much we can do here. + // Logging to the console might break the user application. + // Try to log to self. If a logger was previously registered it will receive the log. + var err = new Error('Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation'); + self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message); + return false; + } + var oldLogger = global_utils_1.getGlobal('diag'); + var newLogger = logLevelLogger_1.createLogLevelDiagLogger(logLevel, logger); + // There already is an logger registered. We'll let it know before overwriting it. + if (oldLogger) { + var stack = (_b = new Error().stack) !== null && _b !== void 0 ? _b : ''; + oldLogger.warn("Current logger will be overwritten from " + stack); + newLogger.warn("Current logger will overwrite one already registered from " + stack); + } + return global_utils_1.registerGlobal('diag', newLogger, self, true); + }; + self.disable = function () { + global_utils_1.unregisterGlobal(API_NAME, self); + }; + self.createComponentLogger = function (options) { + return new ComponentLogger_1.DiagComponentLogger(options); + }; + self.verbose = _logProxy('verbose'); + self.debug = _logProxy('debug'); + self.info = _logProxy('info'); + self.warn = _logProxy('warn'); + self.error = _logProxy('error'); + } + /** Get the singleton instance of the DiagAPI API */ + DiagAPI.instance = function () { + if (!this._instance) { + this._instance = new DiagAPI(); + } + return this._instance; + }; + return DiagAPI; +}()); +exports.DiagAPI = DiagAPI; +//# sourceMappingURL=diag.js.map + +/***/ }), + +/***/ 89909: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PropagationAPI = void 0; +var global_utils_1 = __nccwpck_require__(85135); +var NoopTextMapPropagator_1 = __nccwpck_require__(72368); +var TextMapPropagator_1 = __nccwpck_require__(80865); +var context_helpers_1 = __nccwpck_require__(37682); +var utils_1 = __nccwpck_require__(28136); +var diag_1 = __nccwpck_require__(11877); +var API_NAME = 'propagation'; +var NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator_1.NoopTextMapPropagator(); +/** + * Singleton object which represents the entry point to the OpenTelemetry Propagation API + */ +var PropagationAPI = /** @class */ (function () { + /** Empty private constructor prevents end users from constructing a new instance of the API */ + function PropagationAPI() { + this.createBaggage = utils_1.createBaggage; + this.getBaggage = context_helpers_1.getBaggage; + this.setBaggage = context_helpers_1.setBaggage; + this.deleteBaggage = context_helpers_1.deleteBaggage; + } + /** Get the singleton instance of the Propagator API */ + PropagationAPI.getInstance = function () { + if (!this._instance) { + this._instance = new PropagationAPI(); + } + return this._instance; + }; + /** + * Set the current propagator. + * + * @returns true if the propagator was successfully registered, else false + */ + PropagationAPI.prototype.setGlobalPropagator = function (propagator) { + return global_utils_1.registerGlobal(API_NAME, propagator, diag_1.DiagAPI.instance()); + }; + /** + * Inject context into a carrier to be propagated inter-process + * + * @param context Context carrying tracing data to inject + * @param carrier carrier to inject context into + * @param setter Function used to set values on the carrier + */ + PropagationAPI.prototype.inject = function (context, carrier, setter) { + if (setter === void 0) { setter = TextMapPropagator_1.defaultTextMapSetter; } + return this._getGlobalPropagator().inject(context, carrier, setter); + }; + /** + * Extract context from a carrier + * + * @param context Context which the newly created context will inherit from + * @param carrier Carrier to extract context from + * @param getter Function used to extract keys from a carrier + */ + PropagationAPI.prototype.extract = function (context, carrier, getter) { + if (getter === void 0) { getter = TextMapPropagator_1.defaultTextMapGetter; } + return this._getGlobalPropagator().extract(context, carrier, getter); + }; + /** + * Return a list of all fields which may be used by the propagator. + */ + PropagationAPI.prototype.fields = function () { + return this._getGlobalPropagator().fields(); + }; + /** Remove the global propagator */ + PropagationAPI.prototype.disable = function () { + global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance()); + }; + PropagationAPI.prototype._getGlobalPropagator = function () { + return global_utils_1.getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR; + }; + return PropagationAPI; +}()); +exports.PropagationAPI = PropagationAPI; +//# sourceMappingURL=propagation.js.map + +/***/ }), + +/***/ 81539: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TraceAPI = void 0; +var global_utils_1 = __nccwpck_require__(85135); +var ProxyTracerProvider_1 = __nccwpck_require__(2285); +var spancontext_utils_1 = __nccwpck_require__(49745); +var context_utils_1 = __nccwpck_require__(23326); +var diag_1 = __nccwpck_require__(11877); +var API_NAME = 'trace'; +/** + * Singleton object which represents the entry point to the OpenTelemetry Tracing API + */ +var TraceAPI = /** @class */ (function () { + /** Empty private constructor prevents end users from constructing a new instance of the API */ + function TraceAPI() { + this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider(); + this.wrapSpanContext = spancontext_utils_1.wrapSpanContext; + this.isSpanContextValid = spancontext_utils_1.isSpanContextValid; + this.deleteSpan = context_utils_1.deleteSpan; + this.getSpan = context_utils_1.getSpan; + this.getSpanContext = context_utils_1.getSpanContext; + this.setSpan = context_utils_1.setSpan; + this.setSpanContext = context_utils_1.setSpanContext; + } + /** Get the singleton instance of the Trace API */ + TraceAPI.getInstance = function () { + if (!this._instance) { + this._instance = new TraceAPI(); + } + return this._instance; + }; + /** + * Set the current global tracer. + * + * @returns true if the tracer provider was successfully registered, else false + */ + TraceAPI.prototype.setGlobalTracerProvider = function (provider) { + var success = global_utils_1.registerGlobal(API_NAME, this._proxyTracerProvider, diag_1.DiagAPI.instance()); + if (success) { + this._proxyTracerProvider.setDelegate(provider); + } + return success; + }; + /** + * Returns the global tracer provider. + */ + TraceAPI.prototype.getTracerProvider = function () { + return global_utils_1.getGlobal(API_NAME) || this._proxyTracerProvider; + }; + /** + * Returns a tracer from the global tracer provider. + */ + TraceAPI.prototype.getTracer = function (name, version) { + return this.getTracerProvider().getTracer(name, version); + }; + /** Remove the global tracer provider */ + TraceAPI.prototype.disable = function () { + global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance()); + this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider(); + }; + return TraceAPI; +}()); +exports.TraceAPI = TraceAPI; +//# sourceMappingURL=trace.js.map + +/***/ }), + +/***/ 37682: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.deleteBaggage = exports.setBaggage = exports.getBaggage = void 0; +var context_1 = __nccwpck_require__(78242); +/** + * Baggage key + */ +var BAGGAGE_KEY = context_1.createContextKey('OpenTelemetry Baggage Key'); +/** + * Retrieve the current baggage from the given context + * + * @param {Context} Context that manage all context values + * @returns {Baggage} Extracted baggage from the context + */ +function getBaggage(context) { + return context.getValue(BAGGAGE_KEY) || undefined; +} +exports.getBaggage = getBaggage; +/** + * Store a baggage in the given context + * + * @param {Context} Context that manage all context values + * @param {Baggage} baggage that will be set in the actual context + */ +function setBaggage(context, baggage) { + return context.setValue(BAGGAGE_KEY, baggage); +} +exports.setBaggage = setBaggage; +/** + * Delete the baggage stored in the given context + * + * @param {Context} Context that manage all context values + */ +function deleteBaggage(context) { + return context.deleteValue(BAGGAGE_KEY); +} +exports.deleteBaggage = deleteBaggage; +//# sourceMappingURL=context-helpers.js.map + +/***/ }), + +/***/ 84811: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BaggageImpl = void 0; +var BaggageImpl = /** @class */ (function () { + function BaggageImpl(entries) { + this._entries = entries ? new Map(entries) : new Map(); + } + BaggageImpl.prototype.getEntry = function (key) { + var entry = this._entries.get(key); + if (!entry) { + return undefined; + } + return Object.assign({}, entry); + }; + BaggageImpl.prototype.getAllEntries = function () { + return Array.from(this._entries.entries()).map(function (_a) { + var k = _a[0], v = _a[1]; + return [k, v]; + }); + }; + BaggageImpl.prototype.setEntry = function (key, entry) { + var newBaggage = new BaggageImpl(this._entries); + newBaggage._entries.set(key, entry); + return newBaggage; + }; + BaggageImpl.prototype.removeEntry = function (key) { + var newBaggage = new BaggageImpl(this._entries); + newBaggage._entries.delete(key); + return newBaggage; + }; + BaggageImpl.prototype.removeEntries = function () { + var keys = []; + for (var _i = 0; _i < arguments.length; _i++) { + keys[_i] = arguments[_i]; + } + var newBaggage = new BaggageImpl(this._entries); + for (var _a = 0, keys_1 = keys; _a < keys_1.length; _a++) { + var key = keys_1[_a]; + newBaggage._entries.delete(key); + } + return newBaggage; + }; + BaggageImpl.prototype.clear = function () { + return new BaggageImpl(); + }; + return BaggageImpl; +}()); +exports.BaggageImpl = BaggageImpl; +//# sourceMappingURL=baggage-impl.js.map + +/***/ }), + +/***/ 23542: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.baggageEntryMetadataSymbol = void 0; +/** + * Symbol used to make BaggageEntryMetadata an opaque type + */ +exports.baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata'); +//# sourceMappingURL=symbol.js.map + +/***/ }), + +/***/ 91508: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=types.js.map + +/***/ }), + +/***/ 28136: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.baggageEntryMetadataFromString = exports.createBaggage = void 0; +var diag_1 = __nccwpck_require__(11877); +var baggage_impl_1 = __nccwpck_require__(84811); +var symbol_1 = __nccwpck_require__(23542); +var diag = diag_1.DiagAPI.instance(); +/** + * Create a new Baggage with optional entries + * + * @param entries An array of baggage entries the new baggage should contain + */ +function createBaggage(entries) { + if (entries === void 0) { entries = {}; } + return new baggage_impl_1.BaggageImpl(new Map(Object.entries(entries))); +} +exports.createBaggage = createBaggage; +/** + * Create a serializable BaggageEntryMetadata object from a string. + * + * @param str string metadata. Format is currently not defined by the spec and has no special meaning. + * + */ +function baggageEntryMetadataFromString(str) { + if (typeof str !== 'string') { + diag.error("Cannot create baggage metadata from unknown type: " + typeof str); + str = ''; + } + return { + __TYPE__: symbol_1.baggageEntryMetadataSymbol, + toString: function () { + return str; + }, + }; +} +exports.baggageEntryMetadataFromString = baggageEntryMetadataFromString; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 14447: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=Exception.js.map + +/***/ }), + +/***/ 92358: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=Time.js.map + +/***/ }), + +/***/ 54118: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __spreadArray = (this && this.__spreadArray) || function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.NoopContextManager = void 0; +var context_1 = __nccwpck_require__(78242); +var NoopContextManager = /** @class */ (function () { + function NoopContextManager() { + } + NoopContextManager.prototype.active = function () { + return context_1.ROOT_CONTEXT; + }; + NoopContextManager.prototype.with = function (_context, fn, thisArg) { + var args = []; + for (var _i = 3; _i < arguments.length; _i++) { + args[_i - 3] = arguments[_i]; + } + return fn.call.apply(fn, __spreadArray([thisArg], args)); + }; + NoopContextManager.prototype.bind = function (_context, target) { + return target; + }; + NoopContextManager.prototype.enable = function () { + return this; + }; + NoopContextManager.prototype.disable = function () { + return this; + }; + return NoopContextManager; +}()); +exports.NoopContextManager = NoopContextManager; +//# sourceMappingURL=NoopContextManager.js.map + +/***/ }), + +/***/ 78242: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ROOT_CONTEXT = exports.createContextKey = void 0; +/** Get a key to uniquely identify a context value */ +function createContextKey(description) { + // The specification states that for the same input, multiple calls should + // return different keys. Due to the nature of the JS dependency management + // system, this creates problems where multiple versions of some package + // could hold different keys for the same property. + // + // Therefore, we use Symbol.for which returns the same key for the same input. + return Symbol.for(description); +} +exports.createContextKey = createContextKey; +var BaseContext = /** @class */ (function () { + /** + * Construct a new context which inherits values from an optional parent context. + * + * @param parentContext a context from which to inherit values + */ + function BaseContext(parentContext) { + // for minification + var self = this; + self._currentContext = parentContext ? new Map(parentContext) : new Map(); + self.getValue = function (key) { return self._currentContext.get(key); }; + self.setValue = function (key, value) { + var context = new BaseContext(self._currentContext); + context._currentContext.set(key, value); + return context; + }; + self.deleteValue = function (key) { + var context = new BaseContext(self._currentContext); + context._currentContext.delete(key); + return context; + }; + } + return BaseContext; +}()); +/** The root context is used as the default parent context when there is no active context */ +exports.ROOT_CONTEXT = new BaseContext(); +//# sourceMappingURL=context.js.map + +/***/ }), + +/***/ 36504: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=types.js.map + +/***/ }), + +/***/ 17978: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DiagComponentLogger = void 0; +var global_utils_1 = __nccwpck_require__(85135); +/** + * Component Logger which is meant to be used as part of any component which + * will add automatically additional namespace in front of the log message. + * It will then forward all message to global diag logger + * @example + * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' }); + * cLogger.debug('test'); + * // @opentelemetry/instrumentation-http test + */ +var DiagComponentLogger = /** @class */ (function () { + function DiagComponentLogger(props) { + this._namespace = props.namespace || 'DiagComponentLogger'; + } + DiagComponentLogger.prototype.debug = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return logProxy('debug', this._namespace, args); + }; + DiagComponentLogger.prototype.error = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return logProxy('error', this._namespace, args); + }; + DiagComponentLogger.prototype.info = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return logProxy('info', this._namespace, args); + }; + DiagComponentLogger.prototype.warn = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return logProxy('warn', this._namespace, args); + }; + DiagComponentLogger.prototype.verbose = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return logProxy('verbose', this._namespace, args); + }; + return DiagComponentLogger; +}()); +exports.DiagComponentLogger = DiagComponentLogger; +function logProxy(funcName, namespace, args) { + var logger = global_utils_1.getGlobal('diag'); + // shortcut if logger not set + if (!logger) { + return; + } + args.unshift(namespace); + return logger[funcName].apply(logger, args); +} +//# sourceMappingURL=ComponentLogger.js.map + +/***/ }), + +/***/ 3041: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DiagConsoleLogger = void 0; +var consoleMap = [ + { n: 'error', c: 'error' }, + { n: 'warn', c: 'warn' }, + { n: 'info', c: 'info' }, + { n: 'debug', c: 'debug' }, + { n: 'verbose', c: 'trace' }, +]; +/** + * A simple Immutable Console based diagnostic logger which will output any messages to the Console. + * If you want to limit the amount of logging to a specific level or lower use the + * {@link createLogLevelDiagLogger} + */ +var DiagConsoleLogger = /** @class */ (function () { + function DiagConsoleLogger() { + function _consoleFunc(funcName) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (console) { + // Some environments only expose the console when the F12 developer console is open + // eslint-disable-next-line no-console + var theFunc = console[funcName]; + if (typeof theFunc !== 'function') { + // Not all environments support all functions + // eslint-disable-next-line no-console + theFunc = console.log; + } + // One last final check + if (typeof theFunc === 'function') { + return theFunc.apply(console, args); + } + } + }; + } + for (var i = 0; i < consoleMap.length; i++) { + this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c); + } + } + return DiagConsoleLogger; +}()); +exports.DiagConsoleLogger = DiagConsoleLogger; +//# sourceMappingURL=consoleLogger.js.map + +/***/ }), + +/***/ 31634: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(3041), exports); +__exportStar(__nccwpck_require__(78077), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 99639: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createLogLevelDiagLogger = void 0; +var types_1 = __nccwpck_require__(78077); +function createLogLevelDiagLogger(maxLevel, logger) { + if (maxLevel < types_1.DiagLogLevel.NONE) { + maxLevel = types_1.DiagLogLevel.NONE; + } + else if (maxLevel > types_1.DiagLogLevel.ALL) { + maxLevel = types_1.DiagLogLevel.ALL; + } + // In case the logger is null or undefined + logger = logger || {}; + function _filterFunc(funcName, theLevel) { + var theFunc = logger[funcName]; + if (typeof theFunc === 'function' && maxLevel >= theLevel) { + return theFunc.bind(logger); + } + return function () { }; + } + return { + error: _filterFunc('error', types_1.DiagLogLevel.ERROR), + warn: _filterFunc('warn', types_1.DiagLogLevel.WARN), + info: _filterFunc('info', types_1.DiagLogLevel.INFO), + debug: _filterFunc('debug', types_1.DiagLogLevel.DEBUG), + verbose: _filterFunc('verbose', types_1.DiagLogLevel.VERBOSE), + }; +} +exports.createLogLevelDiagLogger = createLogLevelDiagLogger; +//# sourceMappingURL=logLevelLogger.js.map + +/***/ }), + +/***/ 78077: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DiagLogLevel = void 0; +/** + * Defines the available internal logging levels for the diagnostic logger, the numeric values + * of the levels are defined to match the original values from the initial LogLevel to avoid + * compatibility/migration issues for any implementation that assume the numeric ordering. + */ +var DiagLogLevel; +(function (DiagLogLevel) { + /** Diagnostic Logging level setting to disable all logging (except and forced logs) */ + DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE"; + /** Identifies an error scenario */ + DiagLogLevel[DiagLogLevel["ERROR"] = 30] = "ERROR"; + /** Identifies a warning scenario */ + DiagLogLevel[DiagLogLevel["WARN"] = 50] = "WARN"; + /** General informational log message */ + DiagLogLevel[DiagLogLevel["INFO"] = 60] = "INFO"; + /** General debug log message */ + DiagLogLevel[DiagLogLevel["DEBUG"] = 70] = "DEBUG"; + /** + * Detailed trace level logging should only be used for development, should only be set + * in a development environment. + */ + DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE"; + /** Used to set the logging level to include all logging */ + DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL"; +})(DiagLogLevel = exports.DiagLogLevel || (exports.DiagLogLevel = {})); +//# sourceMappingURL=types.js.map + +/***/ }), + +/***/ 65163: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.diag = exports.propagation = exports.trace = exports.context = exports.INVALID_SPAN_CONTEXT = exports.INVALID_TRACEID = exports.INVALID_SPANID = exports.isValidSpanId = exports.isValidTraceId = exports.isSpanContextValid = exports.baggageEntryMetadataFromString = void 0; +__exportStar(__nccwpck_require__(91508), exports); +var utils_1 = __nccwpck_require__(28136); +Object.defineProperty(exports, "baggageEntryMetadataFromString", ({ enumerable: true, get: function () { return utils_1.baggageEntryMetadataFromString; } })); +__exportStar(__nccwpck_require__(14447), exports); +__exportStar(__nccwpck_require__(92358), exports); +__exportStar(__nccwpck_require__(31634), exports); +__exportStar(__nccwpck_require__(80865), exports); +__exportStar(__nccwpck_require__(57492), exports); +__exportStar(__nccwpck_require__(44023), exports); +__exportStar(__nccwpck_require__(43503), exports); +__exportStar(__nccwpck_require__(2285), exports); +__exportStar(__nccwpck_require__(19671), exports); +__exportStar(__nccwpck_require__(33209), exports); +__exportStar(__nccwpck_require__(15769), exports); +__exportStar(__nccwpck_require__(31424), exports); +__exportStar(__nccwpck_require__(4416), exports); +__exportStar(__nccwpck_require__(20955), exports); +__exportStar(__nccwpck_require__(48845), exports); +__exportStar(__nccwpck_require__(26905), exports); +__exportStar(__nccwpck_require__(88384), exports); +__exportStar(__nccwpck_require__(30891), exports); +__exportStar(__nccwpck_require__(33168), exports); +var spancontext_utils_1 = __nccwpck_require__(49745); +Object.defineProperty(exports, "isSpanContextValid", ({ enumerable: true, get: function () { return spancontext_utils_1.isSpanContextValid; } })); +Object.defineProperty(exports, "isValidTraceId", ({ enumerable: true, get: function () { return spancontext_utils_1.isValidTraceId; } })); +Object.defineProperty(exports, "isValidSpanId", ({ enumerable: true, get: function () { return spancontext_utils_1.isValidSpanId; } })); +var invalid_span_constants_1 = __nccwpck_require__(91760); +Object.defineProperty(exports, "INVALID_SPANID", ({ enumerable: true, get: function () { return invalid_span_constants_1.INVALID_SPANID; } })); +Object.defineProperty(exports, "INVALID_TRACEID", ({ enumerable: true, get: function () { return invalid_span_constants_1.INVALID_TRACEID; } })); +Object.defineProperty(exports, "INVALID_SPAN_CONTEXT", ({ enumerable: true, get: function () { return invalid_span_constants_1.INVALID_SPAN_CONTEXT; } })); +__exportStar(__nccwpck_require__(78242), exports); +__exportStar(__nccwpck_require__(36504), exports); +var context_1 = __nccwpck_require__(57171); +/** Entrypoint for context API */ +exports.context = context_1.ContextAPI.getInstance(); +var trace_1 = __nccwpck_require__(81539); +/** Entrypoint for trace API */ +exports.trace = trace_1.TraceAPI.getInstance(); +var propagation_1 = __nccwpck_require__(89909); +/** Entrypoint for propagation API */ +exports.propagation = propagation_1.PropagationAPI.getInstance(); +var diag_1 = __nccwpck_require__(11877); +/** + * Entrypoint for Diag API. + * Defines Diagnostic handler used for internal diagnostic logging operations. + * The default provides a Noop DiagLogger implementation which may be changed via the + * diag.setLogger(logger: DiagLogger) function. + */ +exports.diag = diag_1.DiagAPI.instance(); +exports["default"] = { + trace: exports.trace, + context: exports.context, + propagation: exports.propagation, + diag: exports.diag, +}; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 85135: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.unregisterGlobal = exports.getGlobal = exports.registerGlobal = void 0; +var platform_1 = __nccwpck_require__(99957); +var version_1 = __nccwpck_require__(98996); +var semver_1 = __nccwpck_require__(81522); +var major = version_1.VERSION.split('.')[0]; +var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major); +var _global = platform_1._globalThis; +function registerGlobal(type, instance, diag, allowOverride) { + var _a; + if (allowOverride === void 0) { allowOverride = false; } + var api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : { + version: version_1.VERSION, + }); + if (!allowOverride && api[type]) { + // already registered an API of this type + var err = new Error("@opentelemetry/api: Attempted duplicate registration of API: " + type); + diag.error(err.stack || err.message); + return false; + } + if (api.version !== version_1.VERSION) { + // All registered APIs must be of the same version exactly + var err = new Error('@opentelemetry/api: All API registration versions must match'); + diag.error(err.stack || err.message); + return false; + } + api[type] = instance; + diag.debug("@opentelemetry/api: Registered a global for " + type + " v" + version_1.VERSION + "."); + return true; +} +exports.registerGlobal = registerGlobal; +function getGlobal(type) { + var _a, _b; + var globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version; + if (!globalVersion || !semver_1.isCompatible(globalVersion)) { + return; + } + return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type]; +} +exports.getGlobal = getGlobal; +function unregisterGlobal(type, diag) { + diag.debug("@opentelemetry/api: Unregistering a global for " + type + " v" + version_1.VERSION + "."); + var api = _global[GLOBAL_OPENTELEMETRY_API_KEY]; + if (api) { + delete api[type]; + } +} +exports.unregisterGlobal = unregisterGlobal; +//# sourceMappingURL=global-utils.js.map + +/***/ }), + +/***/ 81522: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isCompatible = exports._makeCompatibilityCheck = void 0; +var version_1 = __nccwpck_require__(98996); +var re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/; +/** + * Create a function to test an API version to see if it is compatible with the provided ownVersion. + * + * The returned function has the following semantics: + * - Exact match is always compatible + * - Major versions must match exactly + * - 1.x package cannot use global 2.x package + * - 2.x package cannot use global 1.x package + * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API + * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects + * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 + * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor + * - Patch and build tag differences are not considered at this time + * + * @param ownVersion version which should be checked against + */ +function _makeCompatibilityCheck(ownVersion) { + var acceptedVersions = new Set([ownVersion]); + var rejectedVersions = new Set(); + var myVersionMatch = ownVersion.match(re); + if (!myVersionMatch) { + // we cannot guarantee compatibility so we always return noop + return function () { return false; }; + } + var ownVersionParsed = { + major: +myVersionMatch[1], + minor: +myVersionMatch[2], + patch: +myVersionMatch[3], + prerelease: myVersionMatch[4], + }; + // if ownVersion has a prerelease tag, versions must match exactly + if (ownVersionParsed.prerelease != null) { + return function isExactmatch(globalVersion) { + return globalVersion === ownVersion; + }; + } + function _reject(v) { + rejectedVersions.add(v); + return false; + } + function _accept(v) { + acceptedVersions.add(v); + return true; + } + return function isCompatible(globalVersion) { + if (acceptedVersions.has(globalVersion)) { + return true; + } + if (rejectedVersions.has(globalVersion)) { + return false; + } + var globalVersionMatch = globalVersion.match(re); + if (!globalVersionMatch) { + // cannot parse other version + // we cannot guarantee compatibility so we always noop + return _reject(globalVersion); + } + var globalVersionParsed = { + major: +globalVersionMatch[1], + minor: +globalVersionMatch[2], + patch: +globalVersionMatch[3], + prerelease: globalVersionMatch[4], + }; + // if globalVersion has a prerelease tag, versions must match exactly + if (globalVersionParsed.prerelease != null) { + return _reject(globalVersion); + } + // major versions must match + if (ownVersionParsed.major !== globalVersionParsed.major) { + return _reject(globalVersion); + } + if (ownVersionParsed.major === 0) { + if (ownVersionParsed.minor === globalVersionParsed.minor && + ownVersionParsed.patch <= globalVersionParsed.patch) { + return _accept(globalVersion); + } + return _reject(globalVersion); + } + if (ownVersionParsed.minor <= globalVersionParsed.minor) { + return _accept(globalVersion); + } + return _reject(globalVersion); + }; +} +exports._makeCompatibilityCheck = _makeCompatibilityCheck; +/** + * Test an API version to see if it is compatible with this API. + * + * - Exact match is always compatible + * - Major versions must match exactly + * - 1.x package cannot use global 2.x package + * - 2.x package cannot use global 1.x package + * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API + * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects + * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 + * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor + * - Patch and build tag differences are not considered at this time + * + * @param version version of the API requesting an instance of the global API + */ +exports.isCompatible = _makeCompatibilityCheck(version_1.VERSION); +//# sourceMappingURL=semver.js.map + +/***/ }), + +/***/ 99957: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(87200), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 89406: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports._globalThis = void 0; +/** only globals that common to node and browsers are allowed */ +// eslint-disable-next-line node/no-unsupported-features/es-builtins +exports._globalThis = typeof globalThis === 'object' ? globalThis : global; +//# sourceMappingURL=globalThis.js.map + +/***/ }), + +/***/ 87200: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(89406), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 72368: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.NoopTextMapPropagator = void 0; +/** + * No-op implementations of {@link TextMapPropagator}. + */ +var NoopTextMapPropagator = /** @class */ (function () { + function NoopTextMapPropagator() { + } + /** Noop inject function does nothing */ + NoopTextMapPropagator.prototype.inject = function (_context, _carrier) { }; + /** Noop extract function does nothing and returns the input context */ + NoopTextMapPropagator.prototype.extract = function (context, _carrier) { + return context; + }; + NoopTextMapPropagator.prototype.fields = function () { + return []; + }; + return NoopTextMapPropagator; +}()); +exports.NoopTextMapPropagator = NoopTextMapPropagator; +//# sourceMappingURL=NoopTextMapPropagator.js.map + +/***/ }), + +/***/ 80865: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.defaultTextMapSetter = exports.defaultTextMapGetter = void 0; +exports.defaultTextMapGetter = { + get: function (carrier, key) { + if (carrier == null) { + return undefined; + } + return carrier[key]; + }, + keys: function (carrier) { + if (carrier == null) { + return []; + } + return Object.keys(carrier); + }, +}; +exports.defaultTextMapSetter = { + set: function (carrier, key, value) { + if (carrier == null) { + return; + } + carrier[key] = value; + }, +}; +//# sourceMappingURL=TextMapPropagator.js.map + +/***/ }), + +/***/ 81462: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.NonRecordingSpan = void 0; +var invalid_span_constants_1 = __nccwpck_require__(91760); +/** + * The NonRecordingSpan is the default {@link Span} that is used when no Span + * implementation is available. All operations are no-op including context + * propagation. + */ +var NonRecordingSpan = /** @class */ (function () { + function NonRecordingSpan(_spanContext) { + if (_spanContext === void 0) { _spanContext = invalid_span_constants_1.INVALID_SPAN_CONTEXT; } + this._spanContext = _spanContext; + } + // Returns a SpanContext. + NonRecordingSpan.prototype.spanContext = function () { + return this._spanContext; + }; + // By default does nothing + NonRecordingSpan.prototype.setAttribute = function (_key, _value) { + return this; + }; + // By default does nothing + NonRecordingSpan.prototype.setAttributes = function (_attributes) { + return this; + }; + // By default does nothing + NonRecordingSpan.prototype.addEvent = function (_name, _attributes) { + return this; + }; + // By default does nothing + NonRecordingSpan.prototype.setStatus = function (_status) { + return this; + }; + // By default does nothing + NonRecordingSpan.prototype.updateName = function (_name) { + return this; + }; + // By default does nothing + NonRecordingSpan.prototype.end = function (_endTime) { }; + // isRecording always returns false for NonRecordingSpan. + NonRecordingSpan.prototype.isRecording = function () { + return false; + }; + // By default does nothing + NonRecordingSpan.prototype.recordException = function (_exception, _time) { }; + return NonRecordingSpan; +}()); +exports.NonRecordingSpan = NonRecordingSpan; +//# sourceMappingURL=NonRecordingSpan.js.map + +/***/ }), + +/***/ 17606: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.NoopTracer = void 0; +var context_1 = __nccwpck_require__(57171); +var context_utils_1 = __nccwpck_require__(23326); +var NonRecordingSpan_1 = __nccwpck_require__(81462); +var spancontext_utils_1 = __nccwpck_require__(49745); +var context = context_1.ContextAPI.getInstance(); +/** + * No-op implementations of {@link Tracer}. + */ +var NoopTracer = /** @class */ (function () { + function NoopTracer() { + } + // startSpan starts a noop span. + NoopTracer.prototype.startSpan = function (name, options, context) { + var root = Boolean(options === null || options === void 0 ? void 0 : options.root); + if (root) { + return new NonRecordingSpan_1.NonRecordingSpan(); + } + var parentFromContext = context && context_utils_1.getSpanContext(context); + if (isSpanContext(parentFromContext) && + spancontext_utils_1.isSpanContextValid(parentFromContext)) { + return new NonRecordingSpan_1.NonRecordingSpan(parentFromContext); + } + else { + return new NonRecordingSpan_1.NonRecordingSpan(); + } + }; + NoopTracer.prototype.startActiveSpan = function (name, arg2, arg3, arg4) { + var opts; + var ctx; + var fn; + if (arguments.length < 2) { + return; + } + else if (arguments.length === 2) { + fn = arg2; + } + else if (arguments.length === 3) { + opts = arg2; + fn = arg3; + } + else { + opts = arg2; + ctx = arg3; + fn = arg4; + } + var parentContext = ctx !== null && ctx !== void 0 ? ctx : context.active(); + var span = this.startSpan(name, opts, parentContext); + var contextWithSpanSet = context_utils_1.setSpan(parentContext, span); + return context.with(contextWithSpanSet, fn, undefined, span); + }; + return NoopTracer; +}()); +exports.NoopTracer = NoopTracer; +function isSpanContext(spanContext) { + return (typeof spanContext === 'object' && + typeof spanContext['spanId'] === 'string' && + typeof spanContext['traceId'] === 'string' && + typeof spanContext['traceFlags'] === 'number'); +} +//# sourceMappingURL=NoopTracer.js.map + +/***/ }), + +/***/ 23259: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.NoopTracerProvider = void 0; +var NoopTracer_1 = __nccwpck_require__(17606); +/** + * An implementation of the {@link TracerProvider} which returns an impotent + * Tracer for all calls to `getTracer`. + * + * All operations are no-op. + */ +var NoopTracerProvider = /** @class */ (function () { + function NoopTracerProvider() { + } + NoopTracerProvider.prototype.getTracer = function (_name, _version) { + return new NoopTracer_1.NoopTracer(); + }; + return NoopTracerProvider; +}()); +exports.NoopTracerProvider = NoopTracerProvider; +//# sourceMappingURL=NoopTracerProvider.js.map + +/***/ }), + +/***/ 43503: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ProxyTracer = void 0; +var NoopTracer_1 = __nccwpck_require__(17606); +var NOOP_TRACER = new NoopTracer_1.NoopTracer(); +/** + * Proxy tracer provided by the proxy tracer provider + */ +var ProxyTracer = /** @class */ (function () { + function ProxyTracer(_provider, name, version) { + this._provider = _provider; + this.name = name; + this.version = version; + } + ProxyTracer.prototype.startSpan = function (name, options, context) { + return this._getTracer().startSpan(name, options, context); + }; + ProxyTracer.prototype.startActiveSpan = function (_name, _options, _context, _fn) { + var tracer = this._getTracer(); + return Reflect.apply(tracer.startActiveSpan, tracer, arguments); + }; + /** + * Try to get a tracer from the proxy tracer provider. + * If the proxy tracer provider has no delegate, return a noop tracer. + */ + ProxyTracer.prototype._getTracer = function () { + if (this._delegate) { + return this._delegate; + } + var tracer = this._provider.getDelegateTracer(this.name, this.version); + if (!tracer) { + return NOOP_TRACER; + } + this._delegate = tracer; + return this._delegate; + }; + return ProxyTracer; +}()); +exports.ProxyTracer = ProxyTracer; +//# sourceMappingURL=ProxyTracer.js.map + +/***/ }), + +/***/ 2285: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ProxyTracerProvider = void 0; +var ProxyTracer_1 = __nccwpck_require__(43503); +var NoopTracerProvider_1 = __nccwpck_require__(23259); +var NOOP_TRACER_PROVIDER = new NoopTracerProvider_1.NoopTracerProvider(); +/** + * Tracer provider which provides {@link ProxyTracer}s. + * + * Before a delegate is set, tracers provided are NoOp. + * When a delegate is set, traces are provided from the delegate. + * When a delegate is set after tracers have already been provided, + * all tracers already provided will use the provided delegate implementation. + */ +var ProxyTracerProvider = /** @class */ (function () { + function ProxyTracerProvider() { + } + /** + * Get a {@link ProxyTracer} + */ + ProxyTracerProvider.prototype.getTracer = function (name, version) { + var _a; + return ((_a = this.getDelegateTracer(name, version)) !== null && _a !== void 0 ? _a : new ProxyTracer_1.ProxyTracer(this, name, version)); + }; + ProxyTracerProvider.prototype.getDelegate = function () { + var _a; + return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER; + }; + /** + * Set the delegate tracer provider + */ + ProxyTracerProvider.prototype.setDelegate = function (delegate) { + this._delegate = delegate; + }; + ProxyTracerProvider.prototype.getDelegateTracer = function (name, version) { + var _a; + return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version); + }; + return ProxyTracerProvider; +}()); +exports.ProxyTracerProvider = ProxyTracerProvider; +//# sourceMappingURL=ProxyTracerProvider.js.map + +/***/ }), + +/***/ 19671: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=Sampler.js.map + +/***/ }), + +/***/ 33209: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SamplingDecision = void 0; +/** + * A sampling decision that determines how a {@link Span} will be recorded + * and collected. + */ +var SamplingDecision; +(function (SamplingDecision) { + /** + * `Span.isRecording() === false`, span will not be recorded and all events + * and attributes will be dropped. + */ + SamplingDecision[SamplingDecision["NOT_RECORD"] = 0] = "NOT_RECORD"; + /** + * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags} + * MUST NOT be set. + */ + SamplingDecision[SamplingDecision["RECORD"] = 1] = "RECORD"; + /** + * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags} + * MUST be set. + */ + SamplingDecision[SamplingDecision["RECORD_AND_SAMPLED"] = 2] = "RECORD_AND_SAMPLED"; +})(SamplingDecision = exports.SamplingDecision || (exports.SamplingDecision = {})); +//# sourceMappingURL=SamplingResult.js.map + +/***/ }), + +/***/ 20955: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=SpanOptions.js.map + +/***/ }), + +/***/ 57492: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=attributes.js.map + +/***/ }), + +/***/ 23326: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getSpanContext = exports.setSpanContext = exports.deleteSpan = exports.setSpan = exports.getSpan = void 0; +var context_1 = __nccwpck_require__(78242); +var NonRecordingSpan_1 = __nccwpck_require__(81462); +/** + * span key + */ +var SPAN_KEY = context_1.createContextKey('OpenTelemetry Context Key SPAN'); +/** + * Return the span if one exists + * + * @param context context to get span from + */ +function getSpan(context) { + return context.getValue(SPAN_KEY) || undefined; +} +exports.getSpan = getSpan; +/** + * Set the span on a context + * + * @param context context to use as parent + * @param span span to set active + */ +function setSpan(context, span) { + return context.setValue(SPAN_KEY, span); +} +exports.setSpan = setSpan; +/** + * Remove current span stored in the context + * + * @param context context to delete span from + */ +function deleteSpan(context) { + return context.deleteValue(SPAN_KEY); +} +exports.deleteSpan = deleteSpan; +/** + * Wrap span context in a NoopSpan and set as span in a new + * context + * + * @param context context to set active span on + * @param spanContext span context to be wrapped + */ +function setSpanContext(context, spanContext) { + return setSpan(context, new NonRecordingSpan_1.NonRecordingSpan(spanContext)); +} +exports.setSpanContext = setSpanContext; +/** + * Get the span context of the span if it exists. + * + * @param context context to get values from + */ +function getSpanContext(context) { + var _a; + return (_a = getSpan(context)) === null || _a === void 0 ? void 0 : _a.spanContext(); +} +exports.getSpanContext = getSpanContext; +//# sourceMappingURL=context-utils.js.map + +/***/ }), + +/***/ 91760: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.INVALID_SPAN_CONTEXT = exports.INVALID_TRACEID = exports.INVALID_SPANID = void 0; +var trace_flags_1 = __nccwpck_require__(26905); +exports.INVALID_SPANID = '0000000000000000'; +exports.INVALID_TRACEID = '00000000000000000000000000000000'; +exports.INVALID_SPAN_CONTEXT = { + traceId: exports.INVALID_TRACEID, + spanId: exports.INVALID_SPANID, + traceFlags: trace_flags_1.TraceFlags.NONE, +}; +//# sourceMappingURL=invalid-span-constants.js.map + +/***/ }), + +/***/ 44023: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=link.js.map + +/***/ }), + +/***/ 4416: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=span.js.map + +/***/ }), + +/***/ 15769: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=span_context.js.map + +/***/ }), + +/***/ 31424: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SpanKind = void 0; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var SpanKind; +(function (SpanKind) { + /** Default value. Indicates that the span is used internally. */ + SpanKind[SpanKind["INTERNAL"] = 0] = "INTERNAL"; + /** + * Indicates that the span covers server-side handling of an RPC or other + * remote request. + */ + SpanKind[SpanKind["SERVER"] = 1] = "SERVER"; + /** + * Indicates that the span covers the client-side wrapper around an RPC or + * other remote request. + */ + SpanKind[SpanKind["CLIENT"] = 2] = "CLIENT"; + /** + * Indicates that the span describes producer sending a message to a + * broker. Unlike client and server, there is no direct critical path latency + * relationship between producer and consumer spans. + */ + SpanKind[SpanKind["PRODUCER"] = 3] = "PRODUCER"; + /** + * Indicates that the span describes consumer receiving a message from a + * broker. Unlike client and server, there is no direct critical path latency + * relationship between producer and consumer spans. + */ + SpanKind[SpanKind["CONSUMER"] = 4] = "CONSUMER"; +})(SpanKind = exports.SpanKind || (exports.SpanKind = {})); +//# sourceMappingURL=span_kind.js.map + +/***/ }), + +/***/ 49745: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.wrapSpanContext = exports.isSpanContextValid = exports.isValidSpanId = exports.isValidTraceId = void 0; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var invalid_span_constants_1 = __nccwpck_require__(91760); +var NonRecordingSpan_1 = __nccwpck_require__(81462); +var VALID_TRACEID_REGEX = /^([0-9a-f]{32})$/i; +var VALID_SPANID_REGEX = /^[0-9a-f]{16}$/i; +function isValidTraceId(traceId) { + return VALID_TRACEID_REGEX.test(traceId) && traceId !== invalid_span_constants_1.INVALID_TRACEID; +} +exports.isValidTraceId = isValidTraceId; +function isValidSpanId(spanId) { + return VALID_SPANID_REGEX.test(spanId) && spanId !== invalid_span_constants_1.INVALID_SPANID; +} +exports.isValidSpanId = isValidSpanId; +/** + * Returns true if this {@link SpanContext} is valid. + * @return true if this {@link SpanContext} is valid. + */ +function isSpanContextValid(spanContext) { + return (isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId)); +} +exports.isSpanContextValid = isSpanContextValid; +/** + * Wrap the given {@link SpanContext} in a new non-recording {@link Span} + * + * @param spanContext span context to be wrapped + * @returns a new non-recording {@link Span} with the provided context + */ +function wrapSpanContext(spanContext) { + return new NonRecordingSpan_1.NonRecordingSpan(spanContext); +} +exports.wrapSpanContext = wrapSpanContext; +//# sourceMappingURL=spancontext-utils.js.map + +/***/ }), + +/***/ 48845: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SpanStatusCode = void 0; +/** + * An enumeration of status codes. + */ +var SpanStatusCode; +(function (SpanStatusCode) { + /** + * The default status. + */ + SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET"; + /** + * The operation has been validated by an Application developer or + * Operator to have completed successfully. + */ + SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK"; + /** + * The operation contains an error. + */ + SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR"; +})(SpanStatusCode = exports.SpanStatusCode || (exports.SpanStatusCode = {})); +//# sourceMappingURL=status.js.map + +/***/ }), + +/***/ 26905: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TraceFlags = void 0; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var TraceFlags; +(function (TraceFlags) { + /** Represents no flag set. */ + TraceFlags[TraceFlags["NONE"] = 0] = "NONE"; + /** Bit to represent whether trace is sampled in trace flags. */ + TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED"; +})(TraceFlags = exports.TraceFlags || (exports.TraceFlags = {})); +//# sourceMappingURL=trace_flags.js.map + +/***/ }), + +/***/ 88384: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=trace_state.js.map + +/***/ }), + +/***/ 33168: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=tracer.js.map + +/***/ }), + +/***/ 30891: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=tracer_provider.js.map + +/***/ }), + +/***/ 98996: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.VERSION = void 0; +// this is autogenerated file, see scripts/version-update.js +exports.VERSION = '1.0.4'; +//# sourceMappingURL=version.js.map + +/***/ }), + +/***/ 14812: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = +{ + parallel : __nccwpck_require__(8210), + serial : __nccwpck_require__(50445), + serialOrdered : __nccwpck_require__(3578) +}; + + +/***/ }), + +/***/ 1700: +/***/ ((module) => { + +// API +module.exports = abort; + +/** + * Aborts leftover active jobs + * + * @param {object} state - current state object + */ +function abort(state) +{ + Object.keys(state.jobs).forEach(clean.bind(state)); + + // reset leftover jobs + state.jobs = {}; +} + +/** + * Cleans up leftover job by invoking abort function for the provided job id + * + * @this state + * @param {string|number} key - job id to abort + */ +function clean(key) +{ + if (typeof this.jobs[key] == 'function') + { + this.jobs[key](); + } +} + + +/***/ }), + +/***/ 72794: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var defer = __nccwpck_require__(15295); + +// API +module.exports = async; + +/** + * Runs provided callback asynchronously + * even if callback itself is not + * + * @param {function} callback - callback to invoke + * @returns {function} - augmented callback + */ +function async(callback) +{ + var isAsync = false; + + // check if async happened + defer(function() { isAsync = true; }); + + return function async_callback(err, result) + { + if (isAsync) + { + callback(err, result); + } + else + { + defer(function nextTick_callback() + { + callback(err, result); + }); + } + }; +} + + +/***/ }), + +/***/ 15295: +/***/ ((module) => { + +module.exports = defer; + +/** + * Runs provided function on next iteration of the event loop + * + * @param {function} fn - function to run + */ +function defer(fn) +{ + var nextTick = typeof setImmediate == 'function' + ? setImmediate + : ( + typeof process == 'object' && typeof process.nextTick == 'function' + ? process.nextTick + : null + ); + + if (nextTick) + { + nextTick(fn); + } + else + { + setTimeout(fn, 0); + } +} + + +/***/ }), + +/***/ 9023: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var async = __nccwpck_require__(72794) + , abort = __nccwpck_require__(1700) + ; + +// API +module.exports = iterate; + +/** + * Iterates over each job object + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {object} state - current job status + * @param {function} callback - invoked when all elements processed + */ +function iterate(list, iterator, state, callback) +{ + // store current index + var key = state['keyedList'] ? state['keyedList'][state.index] : state.index; + + state.jobs[key] = runJob(iterator, key, list[key], function(error, output) + { + // don't repeat yourself + // skip secondary callbacks + if (!(key in state.jobs)) + { + return; + } + + // clean up jobs + delete state.jobs[key]; + + if (error) + { + // don't process rest of the results + // stop still active jobs + // and reset the list + abort(state); + } + else + { + state.results[key] = output; + } + + // return salvaged results + callback(error, state.results); + }); +} + +/** + * Runs iterator over provided job element + * + * @param {function} iterator - iterator to invoke + * @param {string|number} key - key/index of the element in the list of jobs + * @param {mixed} item - job description + * @param {function} callback - invoked after iterator is done with the job + * @returns {function|mixed} - job abort function or something else + */ +function runJob(iterator, key, item, callback) +{ + var aborter; + + // allow shortcut if iterator expects only two arguments + if (iterator.length == 2) + { + aborter = iterator(item, async(callback)); + } + // otherwise go with full three arguments + else + { + aborter = iterator(item, key, async(callback)); + } + + return aborter; +} + + +/***/ }), + +/***/ 42474: +/***/ ((module) => { + +// API +module.exports = state; + +/** + * Creates initial state object + * for iteration over list + * + * @param {array|object} list - list to iterate over + * @param {function|null} sortMethod - function to use for keys sort, + * or `null` to keep them as is + * @returns {object} - initial state object + */ +function state(list, sortMethod) +{ + var isNamedList = !Array.isArray(list) + , initState = + { + index : 0, + keyedList: isNamedList || sortMethod ? Object.keys(list) : null, + jobs : {}, + results : isNamedList ? {} : [], + size : isNamedList ? Object.keys(list).length : list.length + } + ; + + if (sortMethod) + { + // sort array keys based on it's values + // sort object's keys just on own merit + initState.keyedList.sort(isNamedList ? sortMethod : function(a, b) + { + return sortMethod(list[a], list[b]); + }); + } + + return initState; +} + + +/***/ }), + +/***/ 37942: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var abort = __nccwpck_require__(1700) + , async = __nccwpck_require__(72794) + ; + +// API +module.exports = terminator; + +/** + * Terminates jobs in the attached state context + * + * @this AsyncKitState# + * @param {function} callback - final callback to invoke after termination + */ +function terminator(callback) +{ + if (!Object.keys(this.jobs).length) + { + return; + } + + // fast forward iteration index + this.index = this.size; + + // abort jobs + abort(this); + + // send back results we have so far + async(callback)(null, this.results); +} + + +/***/ }), + +/***/ 8210: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var iterate = __nccwpck_require__(9023) + , initState = __nccwpck_require__(42474) + , terminator = __nccwpck_require__(37942) + ; + +// Public API +module.exports = parallel; + +/** + * Runs iterator over provided array elements in parallel + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function parallel(list, iterator, callback) +{ + var state = initState(list); + + while (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, function(error, result) + { + if (error) + { + callback(error, result); + return; + } + + // looks like it's the last one + if (Object.keys(state.jobs).length === 0) + { + callback(null, state.results); + return; + } + }); + + state.index++; + } + + return terminator.bind(state, callback); +} + + +/***/ }), + +/***/ 50445: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var serialOrdered = __nccwpck_require__(3578); + +// Public API +module.exports = serial; + +/** + * Runs iterator over provided array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serial(list, iterator, callback) +{ + return serialOrdered(list, iterator, null, callback); +} + + +/***/ }), + +/***/ 3578: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var iterate = __nccwpck_require__(9023) + , initState = __nccwpck_require__(42474) + , terminator = __nccwpck_require__(37942) + ; + +// Public API +module.exports = serialOrdered; +// sorting helpers +module.exports.ascending = ascending; +module.exports.descending = descending; + +/** + * Runs iterator over provided sorted array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} sortMethod - custom sort function + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serialOrdered(list, iterator, sortMethod, callback) +{ + var state = initState(list, sortMethod); + + iterate(list, iterator, state, function iteratorHandler(error, result) + { + if (error) + { + callback(error, result); + return; + } + + state.index++; + + // are we there yet? + if (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, iteratorHandler); + return; + } + + // done here + callback(null, state.results); + }); + + return terminator.bind(state, callback); +} + +/* + * -- Sort methods + */ + +/** + * sort helper to sort array elements in ascending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function ascending(a, b) +{ + return a < b ? -1 : a > b ? 1 : 0; +} + +/** + * sort helper to sort array elements in descending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function descending(a, b) +{ + return -1 * ascending(a, b); +} + + +/***/ }), + +/***/ 9417: +/***/ ((module) => { + +"use strict"; + +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} + + +/***/ }), + +/***/ 33717: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var concatMap = __nccwpck_require__(86891); +var balanced = __nccwpck_require__(9417); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + + + +/***/ }), + +/***/ 85443: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var util = __nccwpck_require__(73837); +var Stream = (__nccwpck_require__(12781).Stream); +var DelayedStream = __nccwpck_require__(18611); + +module.exports = CombinedStream; +function CombinedStream() { + this.writable = false; + this.readable = true; + this.dataSize = 0; + this.maxDataSize = 2 * 1024 * 1024; + this.pauseStreams = true; + + this._released = false; + this._streams = []; + this._currentStream = null; + this._insideLoop = false; + this._pendingNext = false; +} +util.inherits(CombinedStream, Stream); + +CombinedStream.create = function(options) { + var combinedStream = new this(); + + options = options || {}; + for (var option in options) { + combinedStream[option] = options[option]; + } + + return combinedStream; +}; + +CombinedStream.isStreamLike = function(stream) { + return (typeof stream !== 'function') + && (typeof stream !== 'string') + && (typeof stream !== 'boolean') + && (typeof stream !== 'number') + && (!Buffer.isBuffer(stream)); +}; + +CombinedStream.prototype.append = function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + + if (isStreamLike) { + if (!(stream instanceof DelayedStream)) { + var newStream = DelayedStream.create(stream, { + maxDataSize: Infinity, + pauseStream: this.pauseStreams, + }); + stream.on('data', this._checkDataSize.bind(this)); + stream = newStream; + } + + this._handleErrors(stream); + + if (this.pauseStreams) { + stream.pause(); + } + } + + this._streams.push(stream); + return this; +}; + +CombinedStream.prototype.pipe = function(dest, options) { + Stream.prototype.pipe.call(this, dest, options); + this.resume(); + return dest; +}; + +CombinedStream.prototype._getNext = function() { + this._currentStream = null; + + if (this._insideLoop) { + this._pendingNext = true; + return; // defer call + } + + this._insideLoop = true; + try { + do { + this._pendingNext = false; + this._realGetNext(); + } while (this._pendingNext); + } finally { + this._insideLoop = false; + } +}; + +CombinedStream.prototype._realGetNext = function() { + var stream = this._streams.shift(); + + + if (typeof stream == 'undefined') { + this.end(); + return; + } + + if (typeof stream !== 'function') { + this._pipeNext(stream); + return; + } + + var getStream = stream; + getStream(function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('data', this._checkDataSize.bind(this)); + this._handleErrors(stream); + } + + this._pipeNext(stream); + }.bind(this)); +}; + +CombinedStream.prototype._pipeNext = function(stream) { + this._currentStream = stream; + + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('end', this._getNext.bind(this)); + stream.pipe(this, {end: false}); + return; + } + + var value = stream; + this.write(value); + this._getNext(); +}; + +CombinedStream.prototype._handleErrors = function(stream) { + var self = this; + stream.on('error', function(err) { + self._emitError(err); + }); +}; + +CombinedStream.prototype.write = function(data) { + this.emit('data', data); +}; + +CombinedStream.prototype.pause = function() { + if (!this.pauseStreams) { + return; + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause(); + this.emit('pause'); +}; + +CombinedStream.prototype.resume = function() { + if (!this._released) { + this._released = true; + this.writable = true; + this._getNext(); + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume(); + this.emit('resume'); +}; + +CombinedStream.prototype.end = function() { + this._reset(); + this.emit('end'); +}; + +CombinedStream.prototype.destroy = function() { + this._reset(); + this.emit('close'); +}; + +CombinedStream.prototype._reset = function() { + this.writable = false; + this._streams = []; + this._currentStream = null; +}; + +CombinedStream.prototype._checkDataSize = function() { + this._updateDataSize(); + if (this.dataSize <= this.maxDataSize) { + return; + } + + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'; + this._emitError(new Error(message)); +}; + +CombinedStream.prototype._updateDataSize = function() { + this.dataSize = 0; + + var self = this; + this._streams.forEach(function(stream) { + if (!stream.dataSize) { + return; + } + + self.dataSize += stream.dataSize; + }); + + if (this._currentStream && this._currentStream.dataSize) { + this.dataSize += this._currentStream.dataSize; + } +}; + +CombinedStream.prototype._emitError = function(err) { + this._reset(); + this.emit('error', err); +}; + + +/***/ }), + +/***/ 86891: +/***/ ((module) => { + +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + + +/***/ }), + +/***/ 18611: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var Stream = (__nccwpck_require__(12781).Stream); +var util = __nccwpck_require__(73837); + +module.exports = DelayedStream; +function DelayedStream() { + this.source = null; + this.dataSize = 0; + this.maxDataSize = 1024 * 1024; + this.pauseStream = true; + + this._maxDataSizeExceeded = false; + this._released = false; + this._bufferedEvents = []; +} +util.inherits(DelayedStream, Stream); + +DelayedStream.create = function(source, options) { + var delayedStream = new this(); + + options = options || {}; + for (var option in options) { + delayedStream[option] = options[option]; + } + + delayedStream.source = source; + + var realEmit = source.emit; + source.emit = function() { + delayedStream._handleEmit(arguments); + return realEmit.apply(source, arguments); + }; + + source.on('error', function() {}); + if (delayedStream.pauseStream) { + source.pause(); + } + + return delayedStream; +}; + +Object.defineProperty(DelayedStream.prototype, 'readable', { + configurable: true, + enumerable: true, + get: function() { + return this.source.readable; + } +}); + +DelayedStream.prototype.setEncoding = function() { + return this.source.setEncoding.apply(this.source, arguments); +}; + +DelayedStream.prototype.resume = function() { + if (!this._released) { + this.release(); + } + + this.source.resume(); +}; + +DelayedStream.prototype.pause = function() { + this.source.pause(); +}; + +DelayedStream.prototype.release = function() { + this._released = true; + + this._bufferedEvents.forEach(function(args) { + this.emit.apply(this, args); + }.bind(this)); + this._bufferedEvents = []; +}; + +DelayedStream.prototype.pipe = function() { + var r = Stream.prototype.pipe.apply(this, arguments); + this.resume(); + return r; +}; + +DelayedStream.prototype._handleEmit = function(args) { + if (this._released) { + this.emit.apply(this, args); + return; + } + + if (args[0] === 'data') { + this.dataSize += args[1].length; + this._checkIfMaxDataSizeExceeded(); + } + + this._bufferedEvents.push(args); +}; + +DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { + if (this._maxDataSizeExceeded) { + return; + } + + if (this.dataSize <= this.maxDataSize) { + return; + } + + this._maxDataSizeExceeded = true; + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' + this.emit('error', new Error(message)); +}; + + +/***/ }), + +/***/ 21917: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + + +var yaml = __nccwpck_require__(40916); + + +module.exports = yaml; + + +/***/ }), + +/***/ 40916: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + + +var loader = __nccwpck_require__(45190); +var dumper = __nccwpck_require__(73034); + + +function deprecated(name) { + return function () { + throw new Error('Function ' + name + ' is deprecated and cannot be used.'); + }; +} + + +module.exports.Type = __nccwpck_require__(30967); +module.exports.Schema = __nccwpck_require__(66514); +module.exports.FAILSAFE_SCHEMA = __nccwpck_require__(66037); +module.exports.JSON_SCHEMA = __nccwpck_require__(1571); +module.exports.CORE_SCHEMA = __nccwpck_require__(92183); +module.exports.DEFAULT_SAFE_SCHEMA = __nccwpck_require__(48949); +module.exports.DEFAULT_FULL_SCHEMA = __nccwpck_require__(56874); +module.exports.load = loader.load; +module.exports.loadAll = loader.loadAll; +module.exports.safeLoad = loader.safeLoad; +module.exports.safeLoadAll = loader.safeLoadAll; +module.exports.dump = dumper.dump; +module.exports.safeDump = dumper.safeDump; +module.exports.YAMLException = __nccwpck_require__(65199); + +// Deprecated schema names from JS-YAML 2.0.x +module.exports.MINIMAL_SCHEMA = __nccwpck_require__(66037); +module.exports.SAFE_SCHEMA = __nccwpck_require__(48949); +module.exports.DEFAULT_SCHEMA = __nccwpck_require__(56874); + +// Deprecated functions from JS-YAML 1.x.x +module.exports.scan = deprecated('scan'); +module.exports.parse = deprecated('parse'); +module.exports.compose = deprecated('compose'); +module.exports.addConstructor = deprecated('addConstructor'); + + +/***/ }), + +/***/ 59136: +/***/ ((module) => { + +"use strict"; + + + +function isNothing(subject) { + return (typeof subject === 'undefined') || (subject === null); +} + + +function isObject(subject) { + return (typeof subject === 'object') && (subject !== null); +} + + +function toArray(sequence) { + if (Array.isArray(sequence)) return sequence; + else if (isNothing(sequence)) return []; + + return [ sequence ]; +} + + +function extend(target, source) { + var index, length, key, sourceKeys; + + if (source) { + sourceKeys = Object.keys(source); + + for (index = 0, length = sourceKeys.length; index < length; index += 1) { + key = sourceKeys[index]; + target[key] = source[key]; + } + } + + return target; +} + + +function repeat(string, count) { + var result = '', cycle; + + for (cycle = 0; cycle < count; cycle += 1) { + result += string; + } + + return result; +} + + +function isNegativeZero(number) { + return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); +} + + +module.exports.isNothing = isNothing; +module.exports.isObject = isObject; +module.exports.toArray = toArray; +module.exports.repeat = repeat; +module.exports.isNegativeZero = isNegativeZero; +module.exports.extend = extend; + + +/***/ }), + +/***/ 73034: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +/*eslint-disable no-use-before-define*/ + +var common = __nccwpck_require__(59136); +var YAMLException = __nccwpck_require__(65199); +var DEFAULT_FULL_SCHEMA = __nccwpck_require__(56874); +var DEFAULT_SAFE_SCHEMA = __nccwpck_require__(48949); + +var _toString = Object.prototype.toString; +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +var CHAR_TAB = 0x09; /* Tab */ +var CHAR_LINE_FEED = 0x0A; /* LF */ +var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ +var CHAR_SPACE = 0x20; /* Space */ +var CHAR_EXCLAMATION = 0x21; /* ! */ +var CHAR_DOUBLE_QUOTE = 0x22; /* " */ +var CHAR_SHARP = 0x23; /* # */ +var CHAR_PERCENT = 0x25; /* % */ +var CHAR_AMPERSAND = 0x26; /* & */ +var CHAR_SINGLE_QUOTE = 0x27; /* ' */ +var CHAR_ASTERISK = 0x2A; /* * */ +var CHAR_COMMA = 0x2C; /* , */ +var CHAR_MINUS = 0x2D; /* - */ +var CHAR_COLON = 0x3A; /* : */ +var CHAR_EQUALS = 0x3D; /* = */ +var CHAR_GREATER_THAN = 0x3E; /* > */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + +var ESCAPE_SEQUENCES = {}; + +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; + +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; + +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (map === null) return {}; + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; +} + +function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; +} + +function State(options) { + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.indent = Math.max(1, (options['indent'] || 2)); + this.noArrayIndent = options['noArrayIndent'] || false; + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; + this.condenseFlow = options['condenseFlow'] || false; + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; +} + +// Indents every line in a string. Empty lines (\n only) are not indented. +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; + + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + + if (line.length && line !== '\n') result += ind; + + result += line; + } + + return result; +} + +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} + +function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; +} + +// [33] s-white ::= s-space | s-tab +function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; +} + +// Returns true if the character can be printed without escaping. +// From YAML 1.2: "any allowed characters known to be non-printable +// should also be escaped. [However,] This isn’t mandatory" +// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. +function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) + || (0x10000 <= c && c <= 0x10FFFF); +} + +// [34] ns-char ::= nb-char - s-white +// [27] nb-char ::= c-printable - b-char - c-byte-order-mark +// [26] b-char ::= b-line-feed | b-carriage-return +// [24] b-line-feed ::= #xA /* LF */ +// [25] b-carriage-return ::= #xD /* CR */ +// [3] c-byte-order-mark ::= #xFEFF +function isNsChar(c) { + return isPrintable(c) && !isWhitespace(c) + // byte-order-mark + && c !== 0xFEFF + // b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; +} + +// Simplified test for values allowed after the first character in plain style. +function isPlainSafe(c, prev) { + // Uses a subset of nb-char - c-flow-indicator - ":" - "#" + // where nb-char ::= c-printable - b-char - c-byte-order-mark. + return isPrintable(c) && c !== 0xFEFF + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // - ":" - "#" + // /* An ns-char preceding */ "#" + && c !== CHAR_COLON + && ((c !== CHAR_SHARP) || (prev && isNsChar(prev))); +} + +// Simplified test for values allowed as the first character in plain style. +function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + return isPrintable(c) && c !== 0xFEFF + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE + // | “%” | “@” | “`”) + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; +} + +// Determines whether block indentation indicator is required. +function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); +} + +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; + +// Determines which scalar styles are possible and returns the preferred style. +// lineWidth = -1 => no limit. +// Pre-conditions: str.length > 0. +// Post-conditions: +// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. +// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). +// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). +function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { + var i; + var char, prev_char; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(string.charCodeAt(0)) + && !isWhitespace(string.charCodeAt(string.length - 1)); + + if (singleLineOnly) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + for (i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + prev_char = i > 0 ? string.charCodeAt(i - 1) : null; + plain = plain && isPlainSafe(char, prev_char); + } + } else { + // Case: block styles permitted. + for (i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' '); + previousLineBreak = i; + } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + prev_char = i > 0 ? string.charCodeAt(i - 1) : null; + plain = plain && isPlainSafe(char, prev_char); + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); + } + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + return plain && !testAmbiguousType(string) + ? STYLE_PLAIN : STYLE_SINGLE; + } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; +} + +// Note: line breaking/folding is implemented for only the folded style. +// NB. We drop the last trailing newline (if any) of a returned block scalar +// since the dumper adds its own newline. This always works: +// • No ending newline => unaffected; already using strip "-" chomping. +// • Ending newline => removed then restored. +// Importantly, this keeps the "+" chomp indicator from gaining an extra line. +function writeScalar(state, string, level, iskey) { + state.dump = (function () { + if (string.length === 0) { + return "''"; + } + if (!state.noCompatMode && + DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { + return "'" + string + "'"; + } + + var indent = state.indent * Math.max(1, level); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } + + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string, lineWidth) + '"'; + default: + throw new YAMLException('impossible error: invalid scalar style'); + } + }()); +} + +// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + + // note the special case: the string '\n' counts as a "trailing" empty line. + var clip = string[string.length - 1] === '\n'; + var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); + var chomp = keep ? '+' : (clip ? '' : '-'); + + return indentIndicator + chomp + '\n'; +} + +// (See the note for writeScalar.) +function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; +} + +// Note: a long line without a suitable break point will exceed the width limit. +// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. +function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; + + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; + + // rest of the lines + var match; + while ((match = lineRe.exec(string))) { + var prefix = match[1], line = match[2]; + moreIndented = (line[0] === ' '); + result += prefix + + (!prevMoreIndented && !moreIndented && line !== '' + ? '\n' : '') + + foldLine(line, width); + prevMoreIndented = moreIndented; + } + + return result; +} + +// Greedy line breaking. +// Picks the longest line under the limit each time, +// otherwise settles for the shortest line over the limit. +// NB. More-indented lines *cannot* be folded, as that would add an extra \n. +function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; + + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; + + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; + } + + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); + } + + return result.slice(1); // drop extra \n joiner +} + +// Escapes a double-quoted string. +function escapeString(string) { + var result = ''; + var char, nextChar; + var escapeSeq; + + for (var i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). + if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { + nextChar = string.charCodeAt(i + 1); + if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { + // Combine the surrogate pair and store it escaped. + result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); + // Advance index one extra since we already used that char here. + i++; continue; + } + } + escapeSeq = ESCAPE_SEQUENCES[char]; + result += !escapeSeq && isPrintable(char) + ? string[i] + : escapeSeq || encodeHex(char); + } + + return result; +} + +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level, object[index], false, false)) { + if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; +} + +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level + 1, object[index], true, true)) { + if (!compact || index !== 0) { + _result += generateNextLine(state, level); + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; + } + + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. +} + +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + + pairBuffer = ''; + if (index !== 0) pairBuffer += ', '; + + if (state.condenseFlow) pairBuffer += '"'; + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) pairBuffer += '? '; + + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = '{' + _result + '}'; +} + +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new YAMLException('sortKeys must be a boolean or a function'); + } + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (!compact || index !== 0) { + pairBuffer += generateNextLine(state, level); + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } + + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} + +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + state.tag = explicit ? type.tag : '?'; + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + if (_toString.call(type.represent) === '[object Function]') { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; +} + +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact, iskey) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString.call(state.dump); + + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); + } + + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; + } + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === '[object Object]') { + if (block && (Object.keys(state.dump).length !== 0)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object Array]') { + var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level; + if (block && (state.dump.length !== 0)) { + writeBlockSequence(state, arrayLevel, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, arrayLevel, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object String]') { + if (state.tag !== '?') { + writeScalar(state, state.dump, level, iskey); + } + } else { + if (state.skipInvalid) return false; + throw new YAMLException('unacceptable kind of an object to dump ' + type); + } + + if (state.tag !== null && state.tag !== '?') { + state.dump = '!<' + state.tag + '> ' + state.dump; + } + } + + return true; +} + +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); +} + +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; + + if (object !== null && typeof object === 'object') { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } +} + +function dump(input, options) { + options = options || {}; + + var state = new State(options); + + if (!state.noRefs) getDuplicateReferences(input, state); + + if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; + + return ''; +} + +function safeDump(input, options) { + return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + +module.exports.dump = dump; +module.exports.safeDump = safeDump; + + +/***/ }), + +/***/ 65199: +/***/ ((module) => { + +"use strict"; +// YAML error class. http://stackoverflow.com/questions/8458984 +// + + +function YAMLException(reason, mark) { + // Super constructor + Error.call(this); + + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); + + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; + } +} + + +// Inherit from Error +YAMLException.prototype = Object.create(Error.prototype); +YAMLException.prototype.constructor = YAMLException; + + +YAMLException.prototype.toString = function toString(compact) { + var result = this.name + ': '; + + result += this.reason || '(unknown reason)'; + + if (!compact && this.mark) { + result += ' ' + this.mark.toString(); + } + + return result; +}; + + +module.exports = YAMLException; + + +/***/ }), + +/***/ 45190: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +/*eslint-disable max-len,no-use-before-define*/ + +var common = __nccwpck_require__(59136); +var YAMLException = __nccwpck_require__(65199); +var Mark = __nccwpck_require__(55426); +var DEFAULT_SAFE_SCHEMA = __nccwpck_require__(48949); +var DEFAULT_FULL_SCHEMA = __nccwpck_require__(56874); + + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + + +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; + + +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; + + +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + +function _class(obj) { return Object.prototype.toString.call(obj); } + +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} + +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} + +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} + +function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; +} + +function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; +} + +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} + +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; +} + +function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); +} + +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} + + +function State(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.onWarning = options['onWarning'] || null; + this.legacy = options['legacy'] || false; + this.json = options['json'] || false; + this.listener = options['listener'] || null; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + +} + + +function generateError(state, message) { + return new YAMLException( + message, + new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); +} + +function throwError(state, message) { + throw generateError(state, message); +} + +function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); + } +} + + +var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); + } + + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + state.tagMap[handle] = prefix; + } +}; + + +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } + + state.result += _result; + } +} + +function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty.call(destination, key)) { + destination[key] = source[key]; + overridableKeys[key] = true; + } + } +} + +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { + var index, quantity; + + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, 'nested arrays are not supported inside keys'); + } + + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; + } + } + } + + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; + } + + + keyNode = String(keyNode); + + if (_result === null) { + _result = {}; + } + + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && + !_hasOwnProperty.call(overridableKeys, keyNode) && + _hasOwnProperty.call(_result, keyNode)) { + state.line = startLine || state.line; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); + } + _result[keyNode] = valueNode; + delete overridableKeys[keyNode]; + } + + return _result; +} + +function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; +} + +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; +} + +function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; +} + +function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} + + +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } + + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; +} + +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x27/* ' */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} + +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x22/* " */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} + +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = {}, + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); +} + +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } + + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } + + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; +} + +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + + if (ch !== 0x2D/* - */) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; +} + +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _pos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = {}, + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + _pos = state.position; + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else { + break; // Reading is done. Go to the epilogue. + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if (state.lineIndent > nodeIndent && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; +} + +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x21/* ! */) return false; + + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if (tagHandle === '!') { + state.tag = '!' + tagName; + + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; +} + +function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x26/* & */) return false; + + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; +} + +function readAlias(state) { + var _position, alias, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x2A/* * */) return false; + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!state.anchorMap.hasOwnProperty(alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} + +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (state.tag === null) { + state.tag = '?'; + } + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (state.tag !== null && state.tag !== '!') { + if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } + + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } + } + + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; +} + +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = {}; + state.anchorMap = {}; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) break; + + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (ch !== 0) readLineBreak(state); + + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} + + +function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State(input, options); + + var nullpos = input.indexOf('\0'); + + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); + } + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; +} + + +function loadAll(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + var documents = loadDocuments(input, options); + + if (typeof iterator !== 'function') { + return documents; + } + + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} + + +function load(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; + } + throw new YAMLException('expected a single document in the stream, but found more'); +} + + +function safeLoadAll(input, iterator, options) { + if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +function safeLoad(input, options) { + return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +module.exports.loadAll = loadAll; +module.exports.load = load; +module.exports.safeLoadAll = safeLoadAll; +module.exports.safeLoad = safeLoad; + + +/***/ }), + +/***/ 55426: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + + +var common = __nccwpck_require__(59136); + + +function Mark(name, buffer, position, line, column) { + this.name = name; + this.buffer = buffer; + this.position = position; + this.line = line; + this.column = column; +} + + +Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { + var head, start, tail, end, snippet; + + if (!this.buffer) return null; + + indent = indent || 4; + maxLength = maxLength || 75; + + head = ''; + start = this.position; + + while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { + start -= 1; + if (this.position - start > (maxLength / 2 - 1)) { + head = ' ... '; + start += 5; + break; + } + } + + tail = ''; + end = this.position; + + while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { + end += 1; + if (end - this.position > (maxLength / 2 - 1)) { + tail = ' ... '; + end -= 5; + break; + } + } + + snippet = this.buffer.slice(start, end); + + return common.repeat(' ', indent) + head + snippet + tail + '\n' + + common.repeat(' ', indent + this.position - start + head.length) + '^'; +}; + + +Mark.prototype.toString = function toString(compact) { + var snippet, where = ''; + + if (this.name) { + where += 'in "' + this.name + '" '; + } + + where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); + + if (!compact) { + snippet = this.getSnippet(); + + if (snippet) { + where += ':\n' + snippet; + } + } + + return where; +}; + + +module.exports = Mark; + + +/***/ }), + +/***/ 66514: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +/*eslint-disable max-len*/ + +var common = __nccwpck_require__(59136); +var YAMLException = __nccwpck_require__(65199); +var Type = __nccwpck_require__(30967); + + +function compileList(schema, name, result) { + var exclude = []; + + schema.include.forEach(function (includedSchema) { + result = compileList(includedSchema, name, result); + }); + + schema[name].forEach(function (currentType) { + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { + exclude.push(previousIndex); + } + }); + + result.push(currentType); + }); + + return result.filter(function (type, index) { + return exclude.indexOf(index) === -1; + }); +} + + +function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {} + }, index, length; + + function collectType(type) { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; +} + + +function Schema(definition) { + this.include = definition.include || []; + this.implicit = definition.implicit || []; + this.explicit = definition.explicit || []; + + this.implicit.forEach(function (type) { + if (type.loadKind && type.loadKind !== 'scalar') { + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + }); + + this.compiledImplicit = compileList(this, 'implicit', []); + this.compiledExplicit = compileList(this, 'explicit', []); + this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); +} + + +Schema.DEFAULT = null; + + +Schema.create = function createSchema() { + var schemas, types; + + switch (arguments.length) { + case 1: + schemas = Schema.DEFAULT; + types = arguments[0]; + break; + + case 2: + schemas = arguments[0]; + types = arguments[1]; + break; + + default: + throw new YAMLException('Wrong number of arguments for Schema.create function'); + } + + schemas = common.toArray(schemas); + types = common.toArray(types); + + if (!schemas.every(function (schema) { return schema instanceof Schema; })) { + throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); + } + + if (!types.every(function (type) { return type instanceof Type; })) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + return new Schema({ + include: schemas, + explicit: types + }); +}; + + +module.exports = Schema; + + +/***/ }), + +/***/ 92183: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. + + + + + +var Schema = __nccwpck_require__(66514); + + +module.exports = new Schema({ + include: [ + __nccwpck_require__(1571) + ] +}); + + +/***/ }), + +/***/ 56874: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// JS-YAML's default schema for `load` function. +// It is not described in the YAML specification. +// +// This schema is based on JS-YAML's default safe schema and includes +// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. +// +// Also this schema is used as default base schema at `Schema.create` function. + + + + + +var Schema = __nccwpck_require__(66514); + + +module.exports = Schema.DEFAULT = new Schema({ + include: [ + __nccwpck_require__(48949) + ], + explicit: [ + __nccwpck_require__(25914), + __nccwpck_require__(69242), + __nccwpck_require__(27278) + ] +}); + + +/***/ }), + +/***/ 48949: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) + + + + + +var Schema = __nccwpck_require__(66514); + + +module.exports = new Schema({ + include: [ + __nccwpck_require__(92183) + ], + implicit: [ + __nccwpck_require__(83714), + __nccwpck_require__(81393) + ], + explicit: [ + __nccwpck_require__(32551), + __nccwpck_require__(96668), + __nccwpck_require__(76039), + __nccwpck_require__(69237) + ] +}); + + +/***/ }), + +/***/ 66037: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 + + + + + +var Schema = __nccwpck_require__(66514); + + +module.exports = new Schema({ + explicit: [ + __nccwpck_require__(52672), + __nccwpck_require__(5490), + __nccwpck_require__(31173) + ] +}); + + +/***/ }), + +/***/ 1571: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. + + + + + +var Schema = __nccwpck_require__(66514); + + +module.exports = new Schema({ + include: [ + __nccwpck_require__(66037) + ], + implicit: [ + __nccwpck_require__(22671), + __nccwpck_require__(94675), + __nccwpck_require__(89963), + __nccwpck_require__(15564) + ] +}); + + +/***/ }), + +/***/ 30967: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var YAMLException = __nccwpck_require__(65199); + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; +} + +function Type(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} + +module.exports = Type; + + +/***/ }), + +/***/ 32551: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +/*eslint-disable no-bitwise*/ + +var NodeBuffer; + +try { + // A trick for browserified version, to not include `Buffer` shim + var _require = require; + NodeBuffer = _require('buffer').Buffer; +} catch (__) {} + +var Type = __nccwpck_require__(30967); + + +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + +function resolveYamlBinary(data) { + if (data === null) return false; + + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) continue; + + // Fail on illegal characters + if (code < 0) return false; + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} + +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + // Wrap into Buffer for NodeJS and leave Array for browser + if (NodeBuffer) { + // Support node 6.+ Buffer API when available + return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); + } + + return result; +} + +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; +} + +function isBinary(object) { + return NodeBuffer && NodeBuffer.isBuffer(object); +} + +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); + + +/***/ }), + +/***/ 94675: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Type = __nccwpck_require__(30967); + +function resolveYamlBoolean(data) { + if (data === null) return false; + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} + +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} + +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} + +module.exports = new Type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); + + +/***/ }), + +/***/ 15564: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var common = __nccwpck_require__(59136); +var Type = __nccwpck_require__(30967); + +var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // 20:59 + '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); + +function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; + } + + return true; +} + +function constructYamlFloat(data) { + var value, sign, base, digits; + + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + digits = []; + + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); + } + + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; + + } else if (value.indexOf(':') >= 0) { + value.split(':').forEach(function (v) { + digits.unshift(parseFloat(v, 10)); + }); + + value = 0.0; + base = 1; + + digits.forEach(function (d) { + value += d * base; + base *= 60; + }); + + return sign * value; + + } + return sign * parseFloat(value, 10); +} + + +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + +function representYamlFloat(object, style) { + var res; + + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + + res = object.toString(10); + + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack + + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; +} + +function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); + + +/***/ }), + +/***/ 89963: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var common = __nccwpck_require__(59136); +var Type = __nccwpck_require__(30967); + +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} + +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} + +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} + +function resolveYamlInteger(data) { + if (data === null) return false; + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) return false; + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + // base 8 + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + // base 10 (except 0) or base 60 + + // value should not start with `_`; + if (ch === '_') return false; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch === ':') break; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + // if !base60 - done; + if (ch !== ':') return true; + + // base60 almost not used, no needs to optimize + return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); +} + +function constructYamlInteger(data) { + var value = data, sign = 1, ch, base, digits = []; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } + + if (value === '0') return 0; + + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value, 16); + return sign * parseInt(value, 8); + } + + if (value.indexOf(':') !== -1) { + value.split(':').forEach(function (v) { + digits.unshift(parseInt(v, 10)); + }); + + value = 0; + base = 1; + + digits.forEach(function (d) { + value += (d * base); + base *= 60; + }); + + return sign * value; + + } + + return sign * parseInt(value, 10); +} + +function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); + + +/***/ }), + +/***/ 27278: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var esprima; + +// Browserified version does not have esprima +// +// 1. For node.js just require module as deps +// 2. For browser try to require mudule via external AMD system. +// If not found - try to fallback to window.esprima. If not +// found too - then fail to parse. +// +try { + // workaround to exclude package from browserify list. + var _require = require; + esprima = _require('esprima'); +} catch (_) { + /* eslint-disable no-redeclare */ + /* global window */ + if (typeof window !== 'undefined') esprima = window.esprima; +} + +var Type = __nccwpck_require__(30967); + +function resolveJavascriptFunction(data) { + if (data === null) return false; + + try { + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }); + + if (ast.type !== 'Program' || + ast.body.length !== 1 || + ast.body[0].type !== 'ExpressionStatement' || + (ast.body[0].expression.type !== 'ArrowFunctionExpression' && + ast.body[0].expression.type !== 'FunctionExpression')) { + return false; + } + + return true; + } catch (err) { + return false; + } +} + +function constructJavascriptFunction(data) { + /*jslint evil:true*/ + + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }), + params = [], + body; + + if (ast.type !== 'Program' || + ast.body.length !== 1 || + ast.body[0].type !== 'ExpressionStatement' || + (ast.body[0].expression.type !== 'ArrowFunctionExpression' && + ast.body[0].expression.type !== 'FunctionExpression')) { + throw new Error('Failed to resolve function'); + } + + ast.body[0].expression.params.forEach(function (param) { + params.push(param.name); + }); + + body = ast.body[0].expression.body.range; + + // Esprima's ranges include the first '{' and the last '}' characters on + // function expressions. So cut them out. + if (ast.body[0].expression.body.type === 'BlockStatement') { + /*eslint-disable no-new-func*/ + return new Function(params, source.slice(body[0] + 1, body[1] - 1)); + } + // ES6 arrow functions can omit the BlockStatement. In that case, just return + // the body. + /*eslint-disable no-new-func*/ + return new Function(params, 'return ' + source.slice(body[0], body[1])); +} + +function representJavascriptFunction(object /*, style*/) { + return object.toString(); +} + +function isFunction(object) { + return Object.prototype.toString.call(object) === '[object Function]'; +} + +module.exports = new Type('tag:yaml.org,2002:js/function', { + kind: 'scalar', + resolve: resolveJavascriptFunction, + construct: constructJavascriptFunction, + predicate: isFunction, + represent: representJavascriptFunction +}); + + +/***/ }), + +/***/ 69242: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Type = __nccwpck_require__(30967); + +function resolveJavascriptRegExp(data) { + if (data === null) return false; + if (data.length === 0) return false; + + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // if regexp starts with '/' it can have modifiers and must be properly closed + // `/foo/gim` - modifiers tail can be maximum 3 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + + if (modifiers.length > 3) return false; + // if expression starts with /, is should be properly terminated + if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; + } + + return true; +} + +function constructJavascriptRegExp(data) { + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // `/foo/gim` - tail can be maximum 4 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + } + + return new RegExp(regexp, modifiers); +} + +function representJavascriptRegExp(object /*, style*/) { + var result = '/' + object.source + '/'; + + if (object.global) result += 'g'; + if (object.multiline) result += 'm'; + if (object.ignoreCase) result += 'i'; + + return result; +} + +function isRegExp(object) { + return Object.prototype.toString.call(object) === '[object RegExp]'; +} + +module.exports = new Type('tag:yaml.org,2002:js/regexp', { + kind: 'scalar', + resolve: resolveJavascriptRegExp, + construct: constructJavascriptRegExp, + predicate: isRegExp, + represent: representJavascriptRegExp +}); + + +/***/ }), + +/***/ 25914: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Type = __nccwpck_require__(30967); + +function resolveJavascriptUndefined() { + return true; +} + +function constructJavascriptUndefined() { + /*eslint-disable no-undefined*/ + return undefined; +} + +function representJavascriptUndefined() { + return ''; +} + +function isUndefined(object) { + return typeof object === 'undefined'; +} + +module.exports = new Type('tag:yaml.org,2002:js/undefined', { + kind: 'scalar', + resolve: resolveJavascriptUndefined, + construct: constructJavascriptUndefined, + predicate: isUndefined, + represent: representJavascriptUndefined +}); + + +/***/ }), + +/***/ 31173: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Type = __nccwpck_require__(30967); + +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); + + +/***/ }), + +/***/ 81393: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Type = __nccwpck_require__(30967); + +function resolveYamlMerge(data) { + return data === '<<' || data === null; +} + +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); + + +/***/ }), + +/***/ 22671: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Type = __nccwpck_require__(30967); + +function resolveYamlNull(data) { + if (data === null) return true; + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} + +function constructYamlNull() { + return null; +} + +function isNull(object) { + return object === null; +} + +module.exports = new Type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; } + }, + defaultStyle: 'lowercase' +}); + + +/***/ }), + +/***/ 96668: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Type = __nccwpck_require__(30967); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; + +function resolveYamlOmap(data) { + if (data === null) return true; + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if (_toString.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + + return true; +} + +function constructYamlOmap(data) { + return data !== null ? data : []; +} + +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); + + +/***/ }), + +/***/ 76039: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Type = __nccwpck_require__(30967); + +var _toString = Object.prototype.toString; + +function resolveYamlPairs(data) { + if (data === null) return true; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; +} + +function constructYamlPairs(data) { + if (data === null) return []; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; +} + +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); + + +/***/ }), + +/***/ 5490: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Type = __nccwpck_require__(30967); + +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } +}); + + +/***/ }), + +/***/ 69237: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Type = __nccwpck_require__(30967); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +function resolveYamlSet(data) { + if (data === null) return true; + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (object[key] !== null) return false; + } + } + + return true; +} + +function constructYamlSet(data) { + return data !== null ? data : {}; +} + +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); + + +/***/ }), + +/***/ 52672: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Type = __nccwpck_require__(30967); + +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } +}); + + +/***/ }), + +/***/ 83714: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Type = __nccwpck_require__(30967); + +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day + +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + +function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; +} + +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (match === null) throw new Error('Date resolve error'); + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) date.setTime(date.getTime() - delta); + + return date; +} + +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} + +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); + + +/***/ }), + +/***/ 7129: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +// A linked list to keep track of recently-used-ness +const Yallist = __nccwpck_require__(40665) + +const MAX = Symbol('max') +const LENGTH = Symbol('length') +const LENGTH_CALCULATOR = Symbol('lengthCalculator') +const ALLOW_STALE = Symbol('allowStale') +const MAX_AGE = Symbol('maxAge') +const DISPOSE = Symbol('dispose') +const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet') +const LRU_LIST = Symbol('lruList') +const CACHE = Symbol('cache') +const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet') + +const naiveLength = () => 1 + +// lruList is a yallist where the head is the youngest +// item, and the tail is the oldest. the list contains the Hit +// objects as the entries. +// Each Hit object has a reference to its Yallist.Node. This +// never changes. +// +// cache is a Map (or PseudoMap) that matches the keys to +// the Yallist.Node object. +class LRUCache { + constructor (options) { + if (typeof options === 'number') + options = { max: options } + + if (!options) + options = {} + + if (options.max && (typeof options.max !== 'number' || options.max < 0)) + throw new TypeError('max must be a non-negative number') + // Kind of weird to have a default max of Infinity, but oh well. + const max = this[MAX] = options.max || Infinity + + const lc = options.length || naiveLength + this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc + this[ALLOW_STALE] = options.stale || false + if (options.maxAge && typeof options.maxAge !== 'number') + throw new TypeError('maxAge must be a number') + this[MAX_AGE] = options.maxAge || 0 + this[DISPOSE] = options.dispose + this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false + this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false + this.reset() + } + + // resize the cache when the max changes. + set max (mL) { + if (typeof mL !== 'number' || mL < 0) + throw new TypeError('max must be a non-negative number') + + this[MAX] = mL || Infinity + trim(this) + } + get max () { + return this[MAX] + } + + set allowStale (allowStale) { + this[ALLOW_STALE] = !!allowStale + } + get allowStale () { + return this[ALLOW_STALE] + } + + set maxAge (mA) { + if (typeof mA !== 'number') + throw new TypeError('maxAge must be a non-negative number') + + this[MAX_AGE] = mA + trim(this) + } + get maxAge () { + return this[MAX_AGE] + } + + // resize the cache when the lengthCalculator changes. + set lengthCalculator (lC) { + if (typeof lC !== 'function') + lC = naiveLength + + if (lC !== this[LENGTH_CALCULATOR]) { + this[LENGTH_CALCULATOR] = lC + this[LENGTH] = 0 + this[LRU_LIST].forEach(hit => { + hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key) + this[LENGTH] += hit.length + }) + } + trim(this) + } + get lengthCalculator () { return this[LENGTH_CALCULATOR] } + + get length () { return this[LENGTH] } + get itemCount () { return this[LRU_LIST].length } + + rforEach (fn, thisp) { + thisp = thisp || this + for (let walker = this[LRU_LIST].tail; walker !== null;) { + const prev = walker.prev + forEachStep(this, fn, walker, thisp) + walker = prev + } + } + + forEach (fn, thisp) { + thisp = thisp || this + for (let walker = this[LRU_LIST].head; walker !== null;) { + const next = walker.next + forEachStep(this, fn, walker, thisp) + walker = next + } + } + + keys () { + return this[LRU_LIST].toArray().map(k => k.key) + } + + values () { + return this[LRU_LIST].toArray().map(k => k.value) + } + + reset () { + if (this[DISPOSE] && + this[LRU_LIST] && + this[LRU_LIST].length) { + this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value)) + } + + this[CACHE] = new Map() // hash of items by key + this[LRU_LIST] = new Yallist() // list of items in order of use recency + this[LENGTH] = 0 // length of items in the list + } + + dump () { + return this[LRU_LIST].map(hit => + isStale(this, hit) ? false : { + k: hit.key, + v: hit.value, + e: hit.now + (hit.maxAge || 0) + }).toArray().filter(h => h) + } + + dumpLru () { + return this[LRU_LIST] + } + + set (key, value, maxAge) { + maxAge = maxAge || this[MAX_AGE] + + if (maxAge && typeof maxAge !== 'number') + throw new TypeError('maxAge must be a number') + + const now = maxAge ? Date.now() : 0 + const len = this[LENGTH_CALCULATOR](value, key) + + if (this[CACHE].has(key)) { + if (len > this[MAX]) { + del(this, this[CACHE].get(key)) + return false + } + + const node = this[CACHE].get(key) + const item = node.value + + // dispose of the old one before overwriting + // split out into 2 ifs for better coverage tracking + if (this[DISPOSE]) { + if (!this[NO_DISPOSE_ON_SET]) + this[DISPOSE](key, item.value) + } + + item.now = now + item.maxAge = maxAge + item.value = value + this[LENGTH] += len - item.length + item.length = len + this.get(key) + trim(this) + return true + } + + const hit = new Entry(key, value, len, now, maxAge) + + // oversized objects fall out of cache automatically. + if (hit.length > this[MAX]) { + if (this[DISPOSE]) + this[DISPOSE](key, value) + + return false + } + + this[LENGTH] += hit.length + this[LRU_LIST].unshift(hit) + this[CACHE].set(key, this[LRU_LIST].head) + trim(this) + return true + } + + has (key) { + if (!this[CACHE].has(key)) return false + const hit = this[CACHE].get(key).value + return !isStale(this, hit) + } + + get (key) { + return get(this, key, true) + } + + peek (key) { + return get(this, key, false) + } + + pop () { + const node = this[LRU_LIST].tail + if (!node) + return null + + del(this, node) + return node.value + } + + del (key) { + del(this, this[CACHE].get(key)) + } + + load (arr) { + // reset the cache + this.reset() + + const now = Date.now() + // A previous serialized cache has the most recent items first + for (let l = arr.length - 1; l >= 0; l--) { + const hit = arr[l] + const expiresAt = hit.e || 0 + if (expiresAt === 0) + // the item was created without expiration in a non aged cache + this.set(hit.k, hit.v) + else { + const maxAge = expiresAt - now + // dont add already expired items + if (maxAge > 0) { + this.set(hit.k, hit.v, maxAge) + } + } + } + } + + prune () { + this[CACHE].forEach((value, key) => get(this, key, false)) + } +} + +const get = (self, key, doUse) => { + const node = self[CACHE].get(key) + if (node) { + const hit = node.value + if (isStale(self, hit)) { + del(self, node) + if (!self[ALLOW_STALE]) + return undefined + } else { + if (doUse) { + if (self[UPDATE_AGE_ON_GET]) + node.value.now = Date.now() + self[LRU_LIST].unshiftNode(node) + } + } + return hit.value + } +} + +const isStale = (self, hit) => { + if (!hit || (!hit.maxAge && !self[MAX_AGE])) + return false + + const diff = Date.now() - hit.now + return hit.maxAge ? diff > hit.maxAge + : self[MAX_AGE] && (diff > self[MAX_AGE]) +} + +const trim = self => { + if (self[LENGTH] > self[MAX]) { + for (let walker = self[LRU_LIST].tail; + self[LENGTH] > self[MAX] && walker !== null;) { + // We know that we're about to delete this one, and also + // what the next least recently used key will be, so just + // go ahead and set it now. + const prev = walker.prev + del(self, walker) + walker = prev + } + } +} + +const del = (self, node) => { + if (node) { + const hit = node.value + if (self[DISPOSE]) + self[DISPOSE](hit.key, hit.value) + + self[LENGTH] -= hit.length + self[CACHE].delete(hit.key) + self[LRU_LIST].removeNode(node) + } +} + +class Entry { + constructor (key, value, length, now, maxAge) { + this.key = key + this.value = value + this.length = length + this.now = now + this.maxAge = maxAge || 0 + } +} + +const forEachStep = (self, fn, node, thisp) => { + let hit = node.value + if (isStale(self, hit)) { + del(self, node) + if (!self[ALLOW_STALE]) + hit = undefined + } + if (hit) + fn.call(thisp, hit.value, hit.key, self) +} + +module.exports = LRUCache + + +/***/ }), + +/***/ 47426: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/*! + * mime-db + * Copyright(c) 2014 Jonathan Ong + * MIT Licensed + */ + +/** + * Module exports. + */ + +module.exports = __nccwpck_require__(53765) + + +/***/ }), + +/***/ 43583: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; +/*! + * mime-types + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module dependencies. + * @private + */ + +var db = __nccwpck_require__(47426) +var extname = (__nccwpck_require__(71017).extname) + +/** + * Module variables. + * @private + */ + +var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/ +var TEXT_TYPE_REGEXP = /^text\//i + +/** + * Module exports. + * @public + */ + +exports.charset = charset +exports.charsets = { lookup: charset } +exports.contentType = contentType +exports.extension = extension +exports.extensions = Object.create(null) +exports.lookup = lookup +exports.types = Object.create(null) + +// Populate the extensions/types maps +populateMaps(exports.extensions, exports.types) + +/** + * Get the default charset for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ + +function charset (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + var mime = match && db[match[1].toLowerCase()] + + if (mime && mime.charset) { + return mime.charset + } + + // default text/* to utf-8 + if (match && TEXT_TYPE_REGEXP.test(match[1])) { + return 'UTF-8' + } + + return false +} + +/** + * Create a full Content-Type header given a MIME type or extension. + * + * @param {string} str + * @return {boolean|string} + */ + +function contentType (str) { + // TODO: should this even be in this module? + if (!str || typeof str !== 'string') { + return false + } + + var mime = str.indexOf('/') === -1 + ? exports.lookup(str) + : str + + if (!mime) { + return false + } + + // TODO: use content-type or other module + if (mime.indexOf('charset') === -1) { + var charset = exports.charset(mime) + if (charset) mime += '; charset=' + charset.toLowerCase() + } + + return mime +} + +/** + * Get the default extension for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ + +function extension (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + + // get extensions + var exts = match && exports.extensions[match[1].toLowerCase()] + + if (!exts || !exts.length) { + return false + } + + return exts[0] +} + +/** + * Lookup the MIME type for a file path/extension. + * + * @param {string} path + * @return {boolean|string} + */ + +function lookup (path) { + if (!path || typeof path !== 'string') { + return false + } + + // get the extension ("ext" or ".ext" or full path) + var extension = extname('x.' + path) + .toLowerCase() + .substr(1) + + if (!extension) { + return false + } + + return exports.types[extension] || false +} + +/** + * Populate the extensions and types maps. + * @private + */ + +function populateMaps (extensions, types) { + // source preference (least -> most) + var preference = ['nginx', 'apache', undefined, 'iana'] + + Object.keys(db).forEach(function forEachMimeType (type) { + var mime = db[type] + var exts = mime.extensions + + if (!exts || !exts.length) { + return + } + + // mime -> extensions + extensions[type] = exts + + // extension -> mime + for (var i = 0; i < exts.length; i++) { + var extension = exts[i] + + if (types[extension]) { + var from = preference.indexOf(db[types[extension]].source) + var to = preference.indexOf(mime.source) + + if (types[extension] !== 'application/octet-stream' && + (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) { + // skip the remapping + continue + } + } + + // set the extension -> mime + types[extension] = type + } + }) +} + + +/***/ }), + +/***/ 83973: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = (function () { try { return __nccwpck_require__(71017) } catch (e) {}}()) || { + sep: '/' +} +minimatch.sep = path.sep + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = __nccwpck_require__(33717) + +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + b = b || {} + var t = {} + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || typeof def !== 'object' || !Object.keys(def).length) { + return minimatch + } + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + m.Minimatch.defaults = function defaults (options) { + return orig.defaults(ext(def, options)).Minimatch + } + + m.filter = function filter (pattern, options) { + return orig.filter(pattern, ext(def, options)) + } + + m.defaults = function defaults (options) { + return orig.defaults(ext(def, options)) + } + + m.makeRe = function makeRe (pattern, options) { + return orig.makeRe(pattern, ext(def, options)) + } + + m.braceExpand = function braceExpand (pattern, options) { + return orig.braceExpand(pattern, ext(def, options)) + } + + m.match = function (list, pattern, options) { + return orig.match(list, pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + assertValidPattern(pattern) + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + assertValidPattern(pattern) + + if (!options) options = {} + + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (!options.allowWindowsEscape && path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + this.partial = !!options.partial + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) } + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + assertValidPattern(pattern) + + // Thanks to Yeting Li for + // improving this regexp to avoid a ReDOS vulnerability. + if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +var MAX_PATTERN_LENGTH = 1024 * 64 +var assertValidPattern = function (pattern) { + if (typeof pattern !== 'string') { + throw new TypeError('invalid pattern') + } + + if (pattern.length > MAX_PATTERN_LENGTH) { + throw new TypeError('pattern is too long') + } +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + assertValidPattern(pattern) + + var options = this.options + + // shortcuts + if (pattern === '**') { + if (!options.noglobstar) + return GLOBSTAR + else + pattern = '*' + } + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + /* istanbul ignore next */ + case '/': { + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + } + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '[': case '.': case '(': addPatternStart = true + } + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] + + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) + + nlLast += nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } + + if (addPatternStart) { + re = patternStart + re + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) /* istanbul ignore next - should be impossible */ { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) /* istanbul ignore next - should be impossible */ { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = function match (f, partial) { + if (typeof partial === 'undefined') partial = this.partial + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + /* istanbul ignore if */ + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + /* istanbul ignore if */ + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + hit = f === p + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else /* istanbul ignore else */ if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + return (fi === fl - 1) && (file[fi] === '') + } + + // should be unreachable. + /* istanbul ignore next */ + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} + + +/***/ }), + +/***/ 80467: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var Stream = _interopDefault(__nccwpck_require__(12781)); +var http = _interopDefault(__nccwpck_require__(13685)); +var Url = _interopDefault(__nccwpck_require__(57310)); +var whatwgUrl = _interopDefault(__nccwpck_require__(73323)); +var https = _interopDefault(__nccwpck_require__(95687)); +var zlib = _interopDefault(__nccwpck_require__(59796)); + +// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js + +// fix for "Readable" isn't a named export issue +const Readable = Stream.Readable; + +const BUFFER = Symbol('buffer'); +const TYPE = Symbol('type'); + +class Blob { + constructor() { + this[TYPE] = ''; + + const blobParts = arguments[0]; + const options = arguments[1]; + + const buffers = []; + let size = 0; + + if (blobParts) { + const a = blobParts; + const length = Number(a.length); + for (let i = 0; i < length; i++) { + const element = a[i]; + let buffer; + if (element instanceof Buffer) { + buffer = element; + } else if (ArrayBuffer.isView(element)) { + buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); + } else if (element instanceof ArrayBuffer) { + buffer = Buffer.from(element); + } else if (element instanceof Blob) { + buffer = element[BUFFER]; + } else { + buffer = Buffer.from(typeof element === 'string' ? element : String(element)); + } + size += buffer.length; + buffers.push(buffer); + } + } + + this[BUFFER] = Buffer.concat(buffers); + + let type = options && options.type !== undefined && String(options.type).toLowerCase(); + if (type && !/[^\u0020-\u007E]/.test(type)) { + this[TYPE] = type; + } + } + get size() { + return this[BUFFER].length; + } + get type() { + return this[TYPE]; + } + text() { + return Promise.resolve(this[BUFFER].toString()); + } + arrayBuffer() { + const buf = this[BUFFER]; + const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + return Promise.resolve(ab); + } + stream() { + const readable = new Readable(); + readable._read = function () {}; + readable.push(this[BUFFER]); + readable.push(null); + return readable; + } + toString() { + return '[object Blob]'; + } + slice() { + const size = this.size; + + const start = arguments[0]; + const end = arguments[1]; + let relativeStart, relativeEnd; + if (start === undefined) { + relativeStart = 0; + } else if (start < 0) { + relativeStart = Math.max(size + start, 0); + } else { + relativeStart = Math.min(start, size); + } + if (end === undefined) { + relativeEnd = size; + } else if (end < 0) { + relativeEnd = Math.max(size + end, 0); + } else { + relativeEnd = Math.min(end, size); + } + const span = Math.max(relativeEnd - relativeStart, 0); + + const buffer = this[BUFFER]; + const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); + const blob = new Blob([], { type: arguments[2] }); + blob[BUFFER] = slicedBuffer; + return blob; + } +} + +Object.defineProperties(Blob.prototype, { + size: { enumerable: true }, + type: { enumerable: true }, + slice: { enumerable: true } +}); + +Object.defineProperty(Blob.prototype, Symbol.toStringTag, { + value: 'Blob', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * fetch-error.js + * + * FetchError interface for operational errors + */ + +/** + * Create FetchError instance + * + * @param String message Error message for human + * @param String type Error type for machine + * @param String systemError For Node.js system error + * @return FetchError + */ +function FetchError(message, type, systemError) { + Error.call(this, message); + + this.message = message; + this.type = type; + + // when err.type is `system`, err.code contains system error code + if (systemError) { + this.code = this.errno = systemError.code; + } + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +FetchError.prototype = Object.create(Error.prototype); +FetchError.prototype.constructor = FetchError; +FetchError.prototype.name = 'FetchError'; + +let convert; +try { + convert = (__nccwpck_require__(22877).convert); +} catch (e) {} + +const INTERNALS = Symbol('Body internals'); + +// fix an issue where "PassThrough" isn't a named export for node <10 +const PassThrough = Stream.PassThrough; + +/** + * Body mixin + * + * Ref: https://fetch.spec.whatwg.org/#body + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +function Body(body) { + var _this = this; + + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref$size = _ref.size; + + let size = _ref$size === undefined ? 0 : _ref$size; + var _ref$timeout = _ref.timeout; + let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; + + if (body == null) { + // body is undefined or null + body = null; + } else if (isURLSearchParams(body)) { + // body is a URLSearchParams + body = Buffer.from(body.toString()); + } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { + // body is ArrayBuffer + body = Buffer.from(body); + } else if (ArrayBuffer.isView(body)) { + // body is ArrayBufferView + body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); + } else if (body instanceof Stream) ; else { + // none of the above + // coerce to string then buffer + body = Buffer.from(String(body)); + } + this[INTERNALS] = { + body, + disturbed: false, + error: null + }; + this.size = size; + this.timeout = timeout; + + if (body instanceof Stream) { + body.on('error', function (err) { + const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); + _this[INTERNALS].error = error; + }); + } +} + +Body.prototype = { + get body() { + return this[INTERNALS].body; + }, + + get bodyUsed() { + return this[INTERNALS].disturbed; + }, + + /** + * Decode response as ArrayBuffer + * + * @return Promise + */ + arrayBuffer() { + return consumeBody.call(this).then(function (buf) { + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + }); + }, + + /** + * Return raw response as Blob + * + * @return Promise + */ + blob() { + let ct = this.headers && this.headers.get('content-type') || ''; + return consumeBody.call(this).then(function (buf) { + return Object.assign( + // Prevent copying + new Blob([], { + type: ct.toLowerCase() + }), { + [BUFFER]: buf + }); + }); + }, + + /** + * Decode response as json + * + * @return Promise + */ + json() { + var _this2 = this; + + return consumeBody.call(this).then(function (buffer) { + try { + return JSON.parse(buffer.toString()); + } catch (err) { + return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); + } + }); + }, + + /** + * Decode response as text + * + * @return Promise + */ + text() { + return consumeBody.call(this).then(function (buffer) { + return buffer.toString(); + }); + }, + + /** + * Decode response as buffer (non-spec api) + * + * @return Promise + */ + buffer() { + return consumeBody.call(this); + }, + + /** + * Decode response as text, while automatically detecting the encoding and + * trying to decode to UTF-8 (non-spec api) + * + * @return Promise + */ + textConverted() { + var _this3 = this; + + return consumeBody.call(this).then(function (buffer) { + return convertBody(buffer, _this3.headers); + }); + } +}; + +// In browsers, all properties are enumerable. +Object.defineProperties(Body.prototype, { + body: { enumerable: true }, + bodyUsed: { enumerable: true }, + arrayBuffer: { enumerable: true }, + blob: { enumerable: true }, + json: { enumerable: true }, + text: { enumerable: true } +}); + +Body.mixIn = function (proto) { + for (const name of Object.getOwnPropertyNames(Body.prototype)) { + // istanbul ignore else: future proof + if (!(name in proto)) { + const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); + Object.defineProperty(proto, name, desc); + } + } +}; + +/** + * Consume and convert an entire Body to a Buffer. + * + * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body + * + * @return Promise + */ +function consumeBody() { + var _this4 = this; + + if (this[INTERNALS].disturbed) { + return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); + } + + this[INTERNALS].disturbed = true; + + if (this[INTERNALS].error) { + return Body.Promise.reject(this[INTERNALS].error); + } + + let body = this.body; + + // body is null + if (body === null) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is blob + if (isBlob(body)) { + body = body.stream(); + } + + // body is buffer + if (Buffer.isBuffer(body)) { + return Body.Promise.resolve(body); + } + + // istanbul ignore if: should never happen + if (!(body instanceof Stream)) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is stream + // get ready to actually consume the body + let accum = []; + let accumBytes = 0; + let abort = false; + + return new Body.Promise(function (resolve, reject) { + let resTimeout; + + // allow timeout on slow response body + if (_this4.timeout) { + resTimeout = setTimeout(function () { + abort = true; + reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); + }, _this4.timeout); + } + + // handle stream errors + body.on('error', function (err) { + if (err.name === 'AbortError') { + // if the request was aborted, reject with this Error + abort = true; + reject(err); + } else { + // other errors, such as incorrect content-encoding + reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + + body.on('data', function (chunk) { + if (abort || chunk === null) { + return; + } + + if (_this4.size && accumBytes + chunk.length > _this4.size) { + abort = true; + reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); + return; + } + + accumBytes += chunk.length; + accum.push(chunk); + }); + + body.on('end', function () { + if (abort) { + return; + } + + clearTimeout(resTimeout); + + try { + resolve(Buffer.concat(accum, accumBytes)); + } catch (err) { + // handle streams that have accumulated too much data (issue #414) + reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + }); +} + +/** + * Detect buffer encoding and convert to target encoding + * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding + * + * @param Buffer buffer Incoming buffer + * @param String encoding Target encoding + * @return String + */ +function convertBody(buffer, headers) { + if (typeof convert !== 'function') { + throw new Error('The package `encoding` must be installed to use the textConverted() function'); + } + + const ct = headers.get('content-type'); + let charset = 'utf-8'; + let res, str; + + // header + if (ct) { + res = /charset=([^;]*)/i.exec(ct); + } + + // no charset in content type, peek at response body for at most 1024 bytes + str = buffer.slice(0, 1024).toString(); + + // html5 + if (!res && str) { + res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; + + this[MAP] = Object.create(null); + + if (init instanceof Headers) { + const rawHeaders = init.raw(); + const headerNames = Object.keys(rawHeaders); + + for (const headerName of headerNames) { + for (const value of rawHeaders[headerName]) { + this.append(headerName, value); + } + } + + return; + } + + // We don't worry about converting prop to ByteString here as append() + // will handle it. + if (init == null) ; else if (typeof init === 'object') { + const method = init[Symbol.iterator]; + if (method != null) { + if (typeof method !== 'function') { + throw new TypeError('Header pairs must be iterable'); + } + + // sequence> + // Note: per spec we have to first exhaust the lists then process them + const pairs = []; + for (const pair of init) { + if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { + throw new TypeError('Each header pair must be iterable'); + } + pairs.push(Array.from(pair)); + } + + for (const pair of pairs) { + if (pair.length !== 2) { + throw new TypeError('Each header pair must be a name/value tuple'); + } + this.append(pair[0], pair[1]); + } + } else { + // record + for (const key of Object.keys(init)) { + const value = init[key]; + this.append(key, value); + } + } + } else { + throw new TypeError('Provided initializer must be an object'); + } + } + + /** + * Return combined header value given name + * + * @param String name Header name + * @return Mixed + */ + get(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key === undefined) { + return null; + } + + return this[MAP][key].join(', '); + } + + /** + * Iterate over all headers + * + * @param Function callback Executed for each item with parameters (value, name, thisArg) + * @param Boolean thisArg `this` context for callback function + * @return Void + */ + forEach(callback) { + let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; + + let pairs = getHeaders(this); + let i = 0; + while (i < pairs.length) { + var _pairs$i = pairs[i]; + const name = _pairs$i[0], + value = _pairs$i[1]; + + callback.call(thisArg, value, name, this); + pairs = getHeaders(this); + i++; + } + } + + /** + * Overwrite header values given name + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + set(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + this[MAP][key !== undefined ? key : name] = [value]; + } + + /** + * Append a value onto existing header + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + append(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + if (key !== undefined) { + this[MAP][key].push(value); + } else { + this[MAP][name] = [value]; + } + } + + /** + * Check for header name existence + * + * @param String name Header name + * @return Boolean + */ + has(name) { + name = `${name}`; + validateName(name); + return find(this[MAP], name) !== undefined; + } + + /** + * Delete all header values given name + * + * @param String name Header name + * @return Void + */ + delete(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key !== undefined) { + delete this[MAP][key]; + } + } + + /** + * Return raw headers (non-spec api) + * + * @return Object + */ + raw() { + return this[MAP]; + } + + /** + * Get an iterator on keys. + * + * @return Iterator + */ + keys() { + return createHeadersIterator(this, 'key'); + } + + /** + * Get an iterator on values. + * + * @return Iterator + */ + values() { + return createHeadersIterator(this, 'value'); + } + + /** + * Get an iterator on entries. + * + * This is the default iterator of the Headers object. + * + * @return Iterator + */ + [Symbol.iterator]() { + return createHeadersIterator(this, 'key+value'); + } +} +Headers.prototype.entries = Headers.prototype[Symbol.iterator]; + +Object.defineProperty(Headers.prototype, Symbol.toStringTag, { + value: 'Headers', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Headers.prototype, { + get: { enumerable: true }, + forEach: { enumerable: true }, + set: { enumerable: true }, + append: { enumerable: true }, + has: { enumerable: true }, + delete: { enumerable: true }, + keys: { enumerable: true }, + values: { enumerable: true }, + entries: { enumerable: true } +}); + +function getHeaders(headers) { + let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; + + const keys = Object.keys(headers[MAP]).sort(); + return keys.map(kind === 'key' ? function (k) { + return k.toLowerCase(); + } : kind === 'value' ? function (k) { + return headers[MAP][k].join(', '); + } : function (k) { + return [k.toLowerCase(), headers[MAP][k].join(', ')]; + }); +} + +const INTERNAL = Symbol('internal'); + +function createHeadersIterator(target, kind) { + const iterator = Object.create(HeadersIteratorPrototype); + iterator[INTERNAL] = { + target, + kind, + index: 0 + }; + return iterator; +} + +const HeadersIteratorPrototype = Object.setPrototypeOf({ + next() { + // istanbul ignore if + if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { + throw new TypeError('Value of `this` is not a HeadersIterator'); + } + + var _INTERNAL = this[INTERNAL]; + const target = _INTERNAL.target, + kind = _INTERNAL.kind, + index = _INTERNAL.index; + + const values = getHeaders(target, kind); + const len = values.length; + if (index >= len) { + return { + value: undefined, + done: true + }; + } + + this[INTERNAL].index = index + 1; + + return { + value: values[index], + done: false + }; + } +}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); + +Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { + value: 'HeadersIterator', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * Export the Headers object in a form that Node.js can consume. + * + * @param Headers headers + * @return Object + */ +function exportNodeCompatibleHeaders(headers) { + const obj = Object.assign({ __proto__: null }, headers[MAP]); + + // http.request() only supports string as Host header. This hack makes + // specifying custom Host header possible. + const hostHeaderKey = find(headers[MAP], 'Host'); + if (hostHeaderKey !== undefined) { + obj[hostHeaderKey] = obj[hostHeaderKey][0]; + } + + return obj; +} + +/** + * Create a Headers object from an object of headers, ignoring those that do + * not conform to HTTP grammar productions. + * + * @param Object obj Object of headers + * @return Headers + */ +function createHeadersLenient(obj) { + const headers = new Headers(); + for (const name of Object.keys(obj)) { + if (invalidTokenRegex.test(name)) { + continue; + } + if (Array.isArray(obj[name])) { + for (const val of obj[name]) { + if (invalidHeaderCharRegex.test(val)) { + continue; + } + if (headers[MAP][name] === undefined) { + headers[MAP][name] = [val]; + } else { + headers[MAP][name].push(val); + } + } + } else if (!invalidHeaderCharRegex.test(obj[name])) { + headers[MAP][name] = [obj[name]]; + } + } + return headers; +} + +const INTERNALS$1 = Symbol('Response internals'); + +// fix an issue where "STATUS_CODES" aren't a named export for node <10 +const STATUS_CODES = http.STATUS_CODES; + +/** + * Response class + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +class Response { + constructor() { + let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + Body.call(this, body, opts); + + const status = opts.status || 200; + const headers = new Headers(opts.headers); + + if (body != null && !headers.has('Content-Type')) { + const contentType = extractContentType(body); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + this[INTERNALS$1] = { + url: opts.url, + status, + statusText: opts.statusText || STATUS_CODES[status], + headers, + counter: opts.counter + }; + } + + get url() { + return this[INTERNALS$1].url || ''; + } + + get status() { + return this[INTERNALS$1].status; + } + + /** + * Convenience property representing if the request ended normally + */ + get ok() { + return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; + } + + get redirected() { + return this[INTERNALS$1].counter > 0; + } + + get statusText() { + return this[INTERNALS$1].statusText; + } + + get headers() { + return this[INTERNALS$1].headers; + } + + /** + * Clone this response + * + * @return Response + */ + clone() { + return new Response(clone(this), { + url: this.url, + status: this.status, + statusText: this.statusText, + headers: this.headers, + ok: this.ok, + redirected: this.redirected + }); + } +} + +Body.mixIn(Response.prototype); + +Object.defineProperties(Response.prototype, { + url: { enumerable: true }, + status: { enumerable: true }, + ok: { enumerable: true }, + redirected: { enumerable: true }, + statusText: { enumerable: true }, + headers: { enumerable: true }, + clone: { enumerable: true } +}); + +Object.defineProperty(Response.prototype, Symbol.toStringTag, { + value: 'Response', + writable: false, + enumerable: false, + configurable: true +}); + +const INTERNALS$2 = Symbol('Request internals'); +const URL = Url.URL || whatwgUrl.URL; + +// fix an issue where "format", "parse" aren't a named export for node <10 +const parse_url = Url.parse; +const format_url = Url.format; + +/** + * Wrapper around `new URL` to handle arbitrary URLs + * + * @param {string} urlStr + * @return {void} + */ +function parseURL(urlStr) { + /* + Check whether the URL is absolute or not + Scheme: https://tools.ietf.org/html/rfc3986#section-3.1 + Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3 + */ + if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) { + urlStr = new URL(urlStr).toString(); + } + + // Fallback to old implementation for arbitrary URLs + return parse_url(urlStr); +} + +const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; + +/** + * Check if a value is an instance of Request. + * + * @param Mixed input + * @return Boolean + */ +function isRequest(input) { + return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; +} + +function isAbortSignal(signal) { + const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); + return !!(proto && proto.constructor.name === 'AbortSignal'); +} + +/** + * Request class + * + * @param Mixed input Url or Request instance + * @param Object init Custom options + * @return Void + */ +class Request { + constructor(input) { + let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + let parsedURL; + + // normalize input + if (!isRequest(input)) { + if (input && input.href) { + // in order to support Node.js' Url objects; though WHATWG's URL objects + // will fall into this branch also (since their `toString()` will return + // `href` property anyway) + parsedURL = parseURL(input.href); + } else { + // coerce input to a string before attempting to parse + parsedURL = parseURL(`${input}`); + } + input = {}; + } else { + parsedURL = parseURL(input.url); + } + + let method = init.method || input.method || 'GET'; + method = method.toUpperCase(); + + if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { + throw new TypeError('Request with GET/HEAD method cannot have body'); + } + + let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; + + Body.call(this, inputBody, { + timeout: init.timeout || input.timeout || 0, + size: init.size || input.size || 0 + }); + + const headers = new Headers(init.headers || input.headers || {}); + + if (inputBody != null && !headers.has('Content-Type')) { + const contentType = extractContentType(inputBody); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + let signal = isRequest(input) ? input.signal : null; + if ('signal' in init) signal = init.signal; + + if (signal != null && !isAbortSignal(signal)) { + throw new TypeError('Expected signal to be an instanceof AbortSignal'); + } + + this[INTERNALS$2] = { + method, + redirect: init.redirect || input.redirect || 'follow', + headers, + parsedURL, + signal + }; + + // node-fetch-only options + this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; + this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; + this.counter = init.counter || input.counter || 0; + this.agent = init.agent || input.agent; + } + + get method() { + return this[INTERNALS$2].method; + } + + get url() { + return format_url(this[INTERNALS$2].parsedURL); + } + + get headers() { + return this[INTERNALS$2].headers; + } + + get redirect() { + return this[INTERNALS$2].redirect; + } + + get signal() { + return this[INTERNALS$2].signal; + } + + /** + * Clone this request + * + * @return Request + */ + clone() { + return new Request(this); + } +} + +Body.mixIn(Request.prototype); + +Object.defineProperty(Request.prototype, Symbol.toStringTag, { + value: 'Request', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Request.prototype, { + method: { enumerable: true }, + url: { enumerable: true }, + headers: { enumerable: true }, + redirect: { enumerable: true }, + clone: { enumerable: true }, + signal: { enumerable: true } +}); + +/** + * Convert a Request to Node.js http request options. + * + * @param Request A Request instance + * @return Object The options object to be passed to http.request + */ +function getNodeRequestOptions(request) { + const parsedURL = request[INTERNALS$2].parsedURL; + const headers = new Headers(request[INTERNALS$2].headers); + + // fetch step 1.3 + if (!headers.has('Accept')) { + headers.set('Accept', '*/*'); + } + + // Basic fetch + if (!parsedURL.protocol || !parsedURL.hostname) { + throw new TypeError('Only absolute URLs are supported'); + } + + if (!/^https?:$/.test(parsedURL.protocol)) { + throw new TypeError('Only HTTP(S) protocols are supported'); + } + + if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { + throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); + } + + // HTTP-network-or-cache fetch steps 2.4-2.7 + let contentLengthValue = null; + if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { + contentLengthValue = '0'; + } + if (request.body != null) { + const totalBytes = getTotalBytes(request); + if (typeof totalBytes === 'number') { + contentLengthValue = String(totalBytes); + } + } + if (contentLengthValue) { + headers.set('Content-Length', contentLengthValue); + } + + // HTTP-network-or-cache fetch step 2.11 + if (!headers.has('User-Agent')) { + headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); + } + + // HTTP-network-or-cache fetch step 2.15 + if (request.compress && !headers.has('Accept-Encoding')) { + headers.set('Accept-Encoding', 'gzip,deflate'); + } + + let agent = request.agent; + if (typeof agent === 'function') { + agent = agent(parsedURL); + } + + if (!headers.has('Connection') && !agent) { + headers.set('Connection', 'close'); + } + + // HTTP-network fetch step 4.2 + // chunked encoding is handled by Node.js + + return Object.assign({}, parsedURL, { + method: request.method, + headers: exportNodeCompatibleHeaders(headers), + agent + }); +} + +/** + * abort-error.js + * + * AbortError interface for cancelled requests + */ + +/** + * Create AbortError instance + * + * @param String message Error message for human + * @return AbortError + */ +function AbortError(message) { + Error.call(this, message); + + this.type = 'aborted'; + this.message = message; + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +AbortError.prototype = Object.create(Error.prototype); +AbortError.prototype.constructor = AbortError; +AbortError.prototype.name = 'AbortError'; + +const URL$1 = Url.URL || whatwgUrl.URL; + +// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 +const PassThrough$1 = Stream.PassThrough; + +const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) { + const orig = new URL$1(original).hostname; + const dest = new URL$1(destination).hostname; + + return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest); +}; + +/** + * Fetch function + * + * @param Mixed url Absolute url or Request instance + * @param Object opts Fetch options + * @return Promise + */ +function fetch(url, opts) { + + // allow custom promise + if (!fetch.Promise) { + throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); + } + + Body.Promise = fetch.Promise; + + // wrap http.request into fetch + return new fetch.Promise(function (resolve, reject) { + // build request object + const request = new Request(url, opts); + const options = getNodeRequestOptions(request); + + const send = (options.protocol === 'https:' ? https : http).request; + const signal = request.signal; + + let response = null; + + const abort = function abort() { + let error = new AbortError('The user aborted a request.'); + reject(error); + if (request.body && request.body instanceof Stream.Readable) { + request.body.destroy(error); + } + if (!response || !response.body) return; + response.body.emit('error', error); + }; + + if (signal && signal.aborted) { + abort(); + return; + } + + const abortAndFinalize = function abortAndFinalize() { + abort(); + finalize(); + }; + + // send request + const req = send(options); + let reqTimeout; + + if (signal) { + signal.addEventListener('abort', abortAndFinalize); + } + + function finalize() { + req.abort(); + if (signal) signal.removeEventListener('abort', abortAndFinalize); + clearTimeout(reqTimeout); + } + + if (request.timeout) { + req.once('socket', function (socket) { + reqTimeout = setTimeout(function () { + reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); + finalize(); + }, request.timeout); + }); + } + + req.on('error', function (err) { + reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); + finalize(); + }); + + req.on('response', function (res) { + clearTimeout(reqTimeout); + + const headers = createHeadersLenient(res.headers); + + // HTTP fetch step 5 + if (fetch.isRedirect(res.statusCode)) { + // HTTP fetch step 5.2 + const location = headers.get('Location'); + + // HTTP fetch step 5.3 + let locationURL = null; + try { + locationURL = location === null ? null : new URL$1(location, request.url).toString(); + } catch (err) { + // error here can only be invalid URL in Location: header + // do not throw when options.redirect == manual + // let the user extract the errorneous redirect URL + if (request.redirect !== 'manual') { + reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect')); + finalize(); + return; + } + } + + // HTTP fetch step 5.5 + switch (request.redirect) { + case 'error': + reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); + finalize(); + return; + case 'manual': + // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. + if (locationURL !== null) { + // handle corrupted header + try { + headers.set('Location', locationURL); + } catch (err) { + // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request + reject(err); + } + } + break; + case 'follow': + // HTTP-redirect fetch step 2 + if (locationURL === null) { + break; + } + + // HTTP-redirect fetch step 5 + if (request.counter >= request.follow) { + reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 6 (counter increment) + // Create a new Request object. + const requestOpts = { + headers: new Headers(request.headers), + follow: request.follow, + counter: request.counter + 1, + agent: request.agent, + compress: request.compress, + method: request.method, + body: request.body, + signal: request.signal, + timeout: request.timeout, + size: request.size + }; + + if (!isDomainOrSubdomain(request.url, locationURL)) { + for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) { + requestOpts.headers.delete(name); + } + } + + // HTTP-redirect fetch step 9 + if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { + reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 11 + if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { + requestOpts.method = 'GET'; + requestOpts.body = undefined; + requestOpts.headers.delete('content-length'); + } + + // HTTP-redirect fetch step 15 + resolve(fetch(new Request(locationURL, requestOpts))); + finalize(); + return; + } + } + + // prepare response + res.once('end', function () { + if (signal) signal.removeEventListener('abort', abortAndFinalize); + }); + let body = res.pipe(new PassThrough$1()); + + const response_options = { + url: request.url, + status: res.statusCode, + statusText: res.statusMessage, + headers: headers, + size: request.size, + timeout: request.timeout, + counter: request.counter + }; + + // HTTP-network fetch step 12.1.1.3 + const codings = headers.get('Content-Encoding'); + + // HTTP-network fetch step 12.1.1.4: handle content codings + + // in following scenarios we ignore compression support + // 1. compression support is disabled + // 2. HEAD request + // 3. no Content-Encoding header + // 4. no content response (204) + // 5. content not modified response (304) + if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { + response = new Response(body, response_options); + resolve(response); + return; + } + + // For Node v6+ + // Be less strict when decoding compressed responses, since sometimes + // servers send slightly invalid responses that are still accepted + // by common browsers. + // Always using Z_SYNC_FLUSH is what cURL does. + const zlibOptions = { + flush: zlib.Z_SYNC_FLUSH, + finishFlush: zlib.Z_SYNC_FLUSH + }; + + // for gzip + if (codings == 'gzip' || codings == 'x-gzip') { + body = body.pipe(zlib.createGunzip(zlibOptions)); + response = new Response(body, response_options); + resolve(response); + return; + } + + // for deflate + if (codings == 'deflate' || codings == 'x-deflate') { + // handle the infamous raw deflate response from old servers + // a hack for old IIS and Apache servers + const raw = res.pipe(new PassThrough$1()); + raw.once('data', function (chunk) { + // see http://stackoverflow.com/questions/37519828 + if ((chunk[0] & 0x0F) === 0x08) { + body = body.pipe(zlib.createInflate()); + } else { + body = body.pipe(zlib.createInflateRaw()); + } + response = new Response(body, response_options); + resolve(response); + }); + return; + } + + // for br + if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { + body = body.pipe(zlib.createBrotliDecompress()); + response = new Response(body, response_options); + resolve(response); + return; + } + + // otherwise, use response as-is + response = new Response(body, response_options); + resolve(response); + }); + + writeToStream(req, request); + }); +} +/** + * Redirect code matching + * + * @param Number code Status code + * @return Boolean + */ +fetch.isRedirect = function (code) { + return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; +}; + +// expose Promise +fetch.Promise = global.Promise; + +module.exports = exports = fetch; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports["default"] = exports; +exports.Headers = Headers; +exports.Request = Request; +exports.Response = Response; +exports.FetchError = FetchError; + + +/***/ }), + +/***/ 42299: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var punycode = __nccwpck_require__(85477); +var mappingTable = __nccwpck_require__(1907); + +var PROCESSING_OPTIONS = { + TRANSITIONAL: 0, + NONTRANSITIONAL: 1 +}; + +function normalize(str) { // fix bug in v8 + return str.split('\u0000').map(function (s) { return s.normalize('NFC'); }).join('\u0000'); +} + +function findStatus(val) { + var start = 0; + var end = mappingTable.length - 1; + + while (start <= end) { + var mid = Math.floor((start + end) / 2); + + var target = mappingTable[mid]; + if (target[0][0] <= val && target[0][1] >= val) { + return target; + } else if (target[0][0] > val) { + end = mid - 1; + } else { + start = mid + 1; + } + } + + return null; +} + +var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; + +function countSymbols(string) { + return string + // replace every surrogate pair with a BMP symbol + .replace(regexAstralSymbols, '_') + // then get the length + .length; +} + +function mapChars(domain_name, useSTD3, processing_option) { + var hasError = false; + var processed = ""; + + var len = countSymbols(domain_name); + for (var i = 0; i < len; ++i) { + var codePoint = domain_name.codePointAt(i); + var status = findStatus(codePoint); + + switch (status[1]) { + case "disallowed": + hasError = true; + processed += String.fromCodePoint(codePoint); + break; + case "ignored": + break; + case "mapped": + processed += String.fromCodePoint.apply(String, status[2]); + break; + case "deviation": + if (processing_option === PROCESSING_OPTIONS.TRANSITIONAL) { + processed += String.fromCodePoint.apply(String, status[2]); + } else { + processed += String.fromCodePoint(codePoint); + } + break; + case "valid": + processed += String.fromCodePoint(codePoint); + break; + case "disallowed_STD3_mapped": + if (useSTD3) { + hasError = true; + processed += String.fromCodePoint(codePoint); + } else { + processed += String.fromCodePoint.apply(String, status[2]); + } + break; + case "disallowed_STD3_valid": + if (useSTD3) { + hasError = true; + } + + processed += String.fromCodePoint(codePoint); + break; + } + } + + return { + string: processed, + error: hasError + }; +} + +var combiningMarksRegex = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/; + +function validateLabel(label, processing_option) { + if (label.substr(0, 4) === "xn--") { + label = punycode.toUnicode(label); + processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL; + } + + var error = false; + + if (normalize(label) !== label || + (label[3] === "-" && label[4] === "-") || + label[0] === "-" || label[label.length - 1] === "-" || + label.indexOf(".") !== -1 || + label.search(combiningMarksRegex) === 0) { + error = true; + } + + var len = countSymbols(label); + for (var i = 0; i < len; ++i) { + var status = findStatus(label.codePointAt(i)); + if ((processing === PROCESSING_OPTIONS.TRANSITIONAL && status[1] !== "valid") || + (processing === PROCESSING_OPTIONS.NONTRANSITIONAL && + status[1] !== "valid" && status[1] !== "deviation")) { + error = true; + break; + } + } + + return { + label: label, + error: error + }; +} + +function processing(domain_name, useSTD3, processing_option) { + var result = mapChars(domain_name, useSTD3, processing_option); + result.string = normalize(result.string); + + var labels = result.string.split("."); + for (var i = 0; i < labels.length; ++i) { + try { + var validation = validateLabel(labels[i]); + labels[i] = validation.label; + result.error = result.error || validation.error; + } catch(e) { + result.error = true; + } + } + + return { + string: labels.join("."), + error: result.error + }; +} + +module.exports.toASCII = function(domain_name, useSTD3, processing_option, verifyDnsLength) { + var result = processing(domain_name, useSTD3, processing_option); + var labels = result.string.split("."); + labels = labels.map(function(l) { + try { + return punycode.toASCII(l); + } catch(e) { + result.error = true; + return l; + } + }); + + if (verifyDnsLength) { + var total = labels.slice(0, labels.length - 1).join(".").length; + if (total.length > 253 || total.length === 0) { + result.error = true; + } + + for (var i=0; i < labels.length; ++i) { + if (labels.length > 63 || labels.length === 0) { + result.error = true; + break; + } + } + } + + if (result.error) return null; + return labels.join("."); +}; + +module.exports.toUnicode = function(domain_name, useSTD3) { + var result = processing(domain_name, useSTD3, PROCESSING_OPTIONS.NONTRANSITIONAL); + + return { + domain: result.string, + error: result.error + }; +}; + +module.exports.PROCESSING_OPTIONS = PROCESSING_OPTIONS; + + +/***/ }), + +/***/ 15871: +/***/ ((module) => { + +"use strict"; + + +var conversions = {}; +module.exports = conversions; + +function sign(x) { + return x < 0 ? -1 : 1; +} + +function evenRound(x) { + // Round x to the nearest integer, choosing the even integer if it lies halfway between two. + if ((x % 1) === 0.5 && (x & 1) === 0) { // [even number].5; round down (i.e. floor) + return Math.floor(x); + } else { + return Math.round(x); + } +} + +function createNumberConversion(bitLength, typeOpts) { + if (!typeOpts.unsigned) { + --bitLength; + } + const lowerBound = typeOpts.unsigned ? 0 : -Math.pow(2, bitLength); + const upperBound = Math.pow(2, bitLength) - 1; + + const moduloVal = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength) : Math.pow(2, bitLength); + const moduloBound = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength - 1) : Math.pow(2, bitLength - 1); + + return function(V, opts) { + if (!opts) opts = {}; + + let x = +V; + + if (opts.enforceRange) { + if (!Number.isFinite(x)) { + throw new TypeError("Argument is not a finite number"); + } + + x = sign(x) * Math.floor(Math.abs(x)); + if (x < lowerBound || x > upperBound) { + throw new TypeError("Argument is not in byte range"); + } + + return x; + } + + if (!isNaN(x) && opts.clamp) { + x = evenRound(x); + + if (x < lowerBound) x = lowerBound; + if (x > upperBound) x = upperBound; + return x; + } + + if (!Number.isFinite(x) || x === 0) { + return 0; + } + + x = sign(x) * Math.floor(Math.abs(x)); + x = x % moduloVal; + + if (!typeOpts.unsigned && x >= moduloBound) { + return x - moduloVal; + } else if (typeOpts.unsigned) { + if (x < 0) { + x += moduloVal; + } else if (x === -0) { // don't return negative zero + return 0; + } + } + + return x; + } +} + +conversions["void"] = function () { + return undefined; +}; + +conversions["boolean"] = function (val) { + return !!val; +}; + +conversions["byte"] = createNumberConversion(8, { unsigned: false }); +conversions["octet"] = createNumberConversion(8, { unsigned: true }); + +conversions["short"] = createNumberConversion(16, { unsigned: false }); +conversions["unsigned short"] = createNumberConversion(16, { unsigned: true }); + +conversions["long"] = createNumberConversion(32, { unsigned: false }); +conversions["unsigned long"] = createNumberConversion(32, { unsigned: true }); + +conversions["long long"] = createNumberConversion(32, { unsigned: false, moduloBitLength: 64 }); +conversions["unsigned long long"] = createNumberConversion(32, { unsigned: true, moduloBitLength: 64 }); + +conversions["double"] = function (V) { + const x = +V; + + if (!Number.isFinite(x)) { + throw new TypeError("Argument is not a finite floating-point value"); + } + + return x; +}; + +conversions["unrestricted double"] = function (V) { + const x = +V; + + if (isNaN(x)) { + throw new TypeError("Argument is NaN"); + } + + return x; +}; + +// not quite valid, but good enough for JS +conversions["float"] = conversions["double"]; +conversions["unrestricted float"] = conversions["unrestricted double"]; + +conversions["DOMString"] = function (V, opts) { + if (!opts) opts = {}; + + if (opts.treatNullAsEmptyString && V === null) { + return ""; + } + + return String(V); +}; + +conversions["ByteString"] = function (V, opts) { + const x = String(V); + let c = undefined; + for (let i = 0; (c = x.codePointAt(i)) !== undefined; ++i) { + if (c > 255) { + throw new TypeError("Argument is not a valid bytestring"); + } + } + + return x; +}; + +conversions["USVString"] = function (V) { + const S = String(V); + const n = S.length; + const U = []; + for (let i = 0; i < n; ++i) { + const c = S.charCodeAt(i); + if (c < 0xD800 || c > 0xDFFF) { + U.push(String.fromCodePoint(c)); + } else if (0xDC00 <= c && c <= 0xDFFF) { + U.push(String.fromCodePoint(0xFFFD)); + } else { + if (i === n - 1) { + U.push(String.fromCodePoint(0xFFFD)); + } else { + const d = S.charCodeAt(i + 1); + if (0xDC00 <= d && d <= 0xDFFF) { + const a = c & 0x3FF; + const b = d & 0x3FF; + U.push(String.fromCodePoint((2 << 15) + (2 << 9) * a + b)); + ++i; + } else { + U.push(String.fromCodePoint(0xFFFD)); + } + } + } + } + + return U.join(''); +}; + +conversions["Date"] = function (V, opts) { + if (!(V instanceof Date)) { + throw new TypeError("Argument is not a Date object"); + } + if (isNaN(V)) { + return undefined; + } + + return V; +}; + +conversions["RegExp"] = function (V, opts) { + if (!(V instanceof RegExp)) { + V = new RegExp(V); + } + + return V; +}; + + +/***/ }), + +/***/ 58262: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +const usm = __nccwpck_require__(40033); + +exports.implementation = class URLImpl { + constructor(constructorArgs) { + const url = constructorArgs[0]; + const base = constructorArgs[1]; + + let parsedBase = null; + if (base !== undefined) { + parsedBase = usm.basicURLParse(base); + if (parsedBase === "failure") { + throw new TypeError("Invalid base URL"); + } + } + + const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase }); + if (parsedURL === "failure") { + throw new TypeError("Invalid URL"); + } + + this._url = parsedURL; + + // TODO: query stuff + } + + get href() { + return usm.serializeURL(this._url); + } + + set href(v) { + const parsedURL = usm.basicURLParse(v); + if (parsedURL === "failure") { + throw new TypeError("Invalid URL"); + } + + this._url = parsedURL; + } + + get origin() { + return usm.serializeURLOrigin(this._url); + } + + get protocol() { + return this._url.scheme + ":"; + } + + set protocol(v) { + usm.basicURLParse(v + ":", { url: this._url, stateOverride: "scheme start" }); + } + + get username() { + return this._url.username; + } + + set username(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } + + usm.setTheUsername(this._url, v); + } + + get password() { + return this._url.password; + } + + set password(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } + + usm.setThePassword(this._url, v); + } + + get host() { + const url = this._url; + + if (url.host === null) { + return ""; + } + + if (url.port === null) { + return usm.serializeHost(url.host); + } + + return usm.serializeHost(url.host) + ":" + usm.serializeInteger(url.port); + } + + set host(v) { + if (this._url.cannotBeABaseURL) { + return; + } + + usm.basicURLParse(v, { url: this._url, stateOverride: "host" }); + } + + get hostname() { + if (this._url.host === null) { + return ""; + } + + return usm.serializeHost(this._url.host); + } + + set hostname(v) { + if (this._url.cannotBeABaseURL) { + return; + } + + usm.basicURLParse(v, { url: this._url, stateOverride: "hostname" }); + } + + get port() { + if (this._url.port === null) { + return ""; + } + + return usm.serializeInteger(this._url.port); + } + + set port(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } + + if (v === "") { + this._url.port = null; + } else { + usm.basicURLParse(v, { url: this._url, stateOverride: "port" }); + } + } + + get pathname() { + if (this._url.cannotBeABaseURL) { + return this._url.path[0]; + } + + if (this._url.path.length === 0) { + return ""; + } + + return "/" + this._url.path.join("/"); + } + + set pathname(v) { + if (this._url.cannotBeABaseURL) { + return; + } + + this._url.path = []; + usm.basicURLParse(v, { url: this._url, stateOverride: "path start" }); + } + + get search() { + if (this._url.query === null || this._url.query === "") { + return ""; + } + + return "?" + this._url.query; + } + + set search(v) { + // TODO: query stuff + + const url = this._url; + + if (v === "") { + url.query = null; + return; + } + + const input = v[0] === "?" ? v.substring(1) : v; + url.query = ""; + usm.basicURLParse(input, { url, stateOverride: "query" }); + } + + get hash() { + if (this._url.fragment === null || this._url.fragment === "") { + return ""; + } + + return "#" + this._url.fragment; + } + + set hash(v) { + if (v === "") { + this._url.fragment = null; + return; + } + + const input = v[0] === "#" ? v.substring(1) : v; + this._url.fragment = ""; + usm.basicURLParse(input, { url: this._url, stateOverride: "fragment" }); + } + + toJSON() { + return this.href; + } +}; + + +/***/ }), + +/***/ 80653: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const conversions = __nccwpck_require__(15871); +const utils = __nccwpck_require__(60276); +const Impl = __nccwpck_require__(58262); + +const impl = utils.implSymbol; + +function URL(url) { + if (!this || this[impl] || !(this instanceof URL)) { + throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function."); + } + if (arguments.length < 1) { + throw new TypeError("Failed to construct 'URL': 1 argument required, but only " + arguments.length + " present."); + } + const args = []; + for (let i = 0; i < arguments.length && i < 2; ++i) { + args[i] = arguments[i]; + } + args[0] = conversions["USVString"](args[0]); + if (args[1] !== undefined) { + args[1] = conversions["USVString"](args[1]); + } + + module.exports.setup(this, args); +} + +URL.prototype.toJSON = function toJSON() { + if (!this || !module.exports.is(this)) { + throw new TypeError("Illegal invocation"); + } + const args = []; + for (let i = 0; i < arguments.length && i < 0; ++i) { + args[i] = arguments[i]; + } + return this[impl].toJSON.apply(this[impl], args); +}; +Object.defineProperty(URL.prototype, "href", { + get() { + return this[impl].href; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].href = V; + }, + enumerable: true, + configurable: true +}); + +URL.prototype.toString = function () { + if (!this || !module.exports.is(this)) { + throw new TypeError("Illegal invocation"); + } + return this.href; +}; + +Object.defineProperty(URL.prototype, "origin", { + get() { + return this[impl].origin; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "protocol", { + get() { + return this[impl].protocol; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].protocol = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "username", { + get() { + return this[impl].username; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].username = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "password", { + get() { + return this[impl].password; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].password = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "host", { + get() { + return this[impl].host; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].host = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "hostname", { + get() { + return this[impl].hostname; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].hostname = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "port", { + get() { + return this[impl].port; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].port = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "pathname", { + get() { + return this[impl].pathname; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].pathname = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "search", { + get() { + return this[impl].search; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].search = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "hash", { + get() { + return this[impl].hash; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].hash = V; + }, + enumerable: true, + configurable: true +}); + + +module.exports = { + is(obj) { + return !!obj && obj[impl] instanceof Impl.implementation; + }, + create(constructorArgs, privateData) { + let obj = Object.create(URL.prototype); + this.setup(obj, constructorArgs, privateData); + return obj; + }, + setup(obj, constructorArgs, privateData) { + if (!privateData) privateData = {}; + privateData.wrapper = obj; + + obj[impl] = new Impl.implementation(constructorArgs, privateData); + obj[impl][utils.wrapperSymbol] = obj; + }, + interface: URL, + expose: { + Window: { URL: URL }, + Worker: { URL: URL } + } +}; + + + +/***/ }), + +/***/ 73323: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +exports.URL = __nccwpck_require__(80653)["interface"]; +exports.serializeURL = __nccwpck_require__(40033).serializeURL; +exports.serializeURLOrigin = __nccwpck_require__(40033).serializeURLOrigin; +exports.basicURLParse = __nccwpck_require__(40033).basicURLParse; +exports.setTheUsername = __nccwpck_require__(40033).setTheUsername; +exports.setThePassword = __nccwpck_require__(40033).setThePassword; +exports.serializeHost = __nccwpck_require__(40033).serializeHost; +exports.serializeInteger = __nccwpck_require__(40033).serializeInteger; +exports.parseURL = __nccwpck_require__(40033).parseURL; + + +/***/ }), + +/***/ 40033: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const punycode = __nccwpck_require__(85477); +const tr46 = __nccwpck_require__(42299); + +const specialSchemes = { + ftp: 21, + file: null, + gopher: 70, + http: 80, + https: 443, + ws: 80, + wss: 443 +}; + +const failure = Symbol("failure"); + +function countSymbols(str) { + return punycode.ucs2.decode(str).length; +} + +function at(input, idx) { + const c = input[idx]; + return isNaN(c) ? undefined : String.fromCodePoint(c); +} + +function isASCIIDigit(c) { + return c >= 0x30 && c <= 0x39; +} + +function isASCIIAlpha(c) { + return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A); +} + +function isASCIIAlphanumeric(c) { + return isASCIIAlpha(c) || isASCIIDigit(c); +} + +function isASCIIHex(c) { + return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66); +} + +function isSingleDot(buffer) { + return buffer === "." || buffer.toLowerCase() === "%2e"; +} + +function isDoubleDot(buffer) { + buffer = buffer.toLowerCase(); + return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; +} + +function isWindowsDriveLetterCodePoints(cp1, cp2) { + return isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124); +} + +function isWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|"); +} + +function isNormalizedWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && string[1] === ":"; +} + +function containsForbiddenHostCodePoint(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function containsForbiddenHostCodePointExcludingPercent(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function isSpecialScheme(scheme) { + return specialSchemes[scheme] !== undefined; +} + +function isSpecial(url) { + return isSpecialScheme(url.scheme); +} + +function defaultPort(scheme) { + return specialSchemes[scheme]; +} + +function percentEncode(c) { + let hex = c.toString(16).toUpperCase(); + if (hex.length === 1) { + hex = "0" + hex; + } + + return "%" + hex; +} + +function utf8PercentEncode(c) { + const buf = new Buffer(c); + + let str = ""; + + for (let i = 0; i < buf.length; ++i) { + str += percentEncode(buf[i]); + } + + return str; +} + +function utf8PercentDecode(str) { + const input = new Buffer(str); + const output = []; + for (let i = 0; i < input.length; ++i) { + if (input[i] !== 37) { + output.push(input[i]); + } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { + output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); + i += 2; + } else { + output.push(input[i]); + } + } + return new Buffer(output).toString(); +} + +function isC0ControlPercentEncode(c) { + return c <= 0x1F || c > 0x7E; +} + +const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); +function isPathPercentEncode(c) { + return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); +} + +const extraUserinfoPercentEncodeSet = + new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); +function isUserinfoPercentEncode(c) { + return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); +} + +function percentEncodeChar(c, encodeSetPredicate) { + const cStr = String.fromCodePoint(c); + + if (encodeSetPredicate(c)) { + return utf8PercentEncode(cStr); + } + + return cStr; +} + +function parseIPv4Number(input) { + let R = 10; + + if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { + input = input.substring(2); + R = 16; + } else if (input.length >= 2 && input.charAt(0) === "0") { + input = input.substring(1); + R = 8; + } + + if (input === "") { + return 0; + } + + const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); + if (regex.test(input)) { + return failure; + } + + return parseInt(input, R); +} + +function parseIPv4(input) { + const parts = input.split("."); + if (parts[parts.length - 1] === "") { + if (parts.length > 1) { + parts.pop(); + } + } + + if (parts.length > 4) { + return input; + } + + const numbers = []; + for (const part of parts) { + if (part === "") { + return input; + } + const n = parseIPv4Number(part); + if (n === failure) { + return input; + } + + numbers.push(n); + } + + for (let i = 0; i < numbers.length - 1; ++i) { + if (numbers[i] > 255) { + return failure; + } + } + if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { + return failure; + } + + let ipv4 = numbers.pop(); + let counter = 0; + + for (const n of numbers) { + ipv4 += n * Math.pow(256, 3 - counter); + ++counter; + } + + return ipv4; +} + +function serializeIPv4(address) { + let output = ""; + let n = address; + + for (let i = 1; i <= 4; ++i) { + output = String(n % 256) + output; + if (i !== 4) { + output = "." + output; + } + n = Math.floor(n / 256); + } + + return output; +} + +function parseIPv6(input) { + const address = [0, 0, 0, 0, 0, 0, 0, 0]; + let pieceIndex = 0; + let compress = null; + let pointer = 0; + + input = punycode.ucs2.decode(input); + + if (input[pointer] === 58) { + if (input[pointer + 1] !== 58) { + return failure; + } + + pointer += 2; + ++pieceIndex; + compress = pieceIndex; + } + + while (pointer < input.length) { + if (pieceIndex === 8) { + return failure; + } + + if (input[pointer] === 58) { + if (compress !== null) { + return failure; + } + ++pointer; + ++pieceIndex; + compress = pieceIndex; + continue; + } + + let value = 0; + let length = 0; + + while (length < 4 && isASCIIHex(input[pointer])) { + value = value * 0x10 + parseInt(at(input, pointer), 16); + ++pointer; + ++length; + } + + if (input[pointer] === 46) { + if (length === 0) { + return failure; + } + + pointer -= length; + + if (pieceIndex > 6) { + return failure; + } + + let numbersSeen = 0; + + while (input[pointer] !== undefined) { + let ipv4Piece = null; + + if (numbersSeen > 0) { + if (input[pointer] === 46 && numbersSeen < 4) { + ++pointer; + } else { + return failure; + } + } + + if (!isASCIIDigit(input[pointer])) { + return failure; + } + + while (isASCIIDigit(input[pointer])) { + const number = parseInt(at(input, pointer)); + if (ipv4Piece === null) { + ipv4Piece = number; + } else if (ipv4Piece === 0) { + return failure; + } else { + ipv4Piece = ipv4Piece * 10 + number; + } + if (ipv4Piece > 255) { + return failure; + } + ++pointer; + } + + address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; + + ++numbersSeen; + + if (numbersSeen === 2 || numbersSeen === 4) { + ++pieceIndex; + } + } + + if (numbersSeen !== 4) { + return failure; + } + + break; + } else if (input[pointer] === 58) { + ++pointer; + if (input[pointer] === undefined) { + return failure; + } + } else if (input[pointer] !== undefined) { + return failure; + } + + address[pieceIndex] = value; + ++pieceIndex; + } + + if (compress !== null) { + let swaps = pieceIndex - compress; + pieceIndex = 7; + while (pieceIndex !== 0 && swaps > 0) { + const temp = address[compress + swaps - 1]; + address[compress + swaps - 1] = address[pieceIndex]; + address[pieceIndex] = temp; + --pieceIndex; + --swaps; + } + } else if (compress === null && pieceIndex !== 8) { + return failure; + } + + return address; +} + +function serializeIPv6(address) { + let output = ""; + const seqResult = findLongestZeroSequence(address); + const compress = seqResult.idx; + let ignore0 = false; + + for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { + if (ignore0 && address[pieceIndex] === 0) { + continue; + } else if (ignore0) { + ignore0 = false; + } + + if (compress === pieceIndex) { + const separator = pieceIndex === 0 ? "::" : ":"; + output += separator; + ignore0 = true; + continue; + } + + output += address[pieceIndex].toString(16); + + if (pieceIndex !== 7) { + output += ":"; + } + } + + return output; +} + +function parseHost(input, isSpecialArg) { + if (input[0] === "[") { + if (input[input.length - 1] !== "]") { + return failure; + } + + return parseIPv6(input.substring(1, input.length - 1)); + } + + if (!isSpecialArg) { + return parseOpaqueHost(input); + } + + const domain = utf8PercentDecode(input); + const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); + if (asciiDomain === null) { + return failure; + } + + if (containsForbiddenHostCodePoint(asciiDomain)) { + return failure; + } + + const ipv4Host = parseIPv4(asciiDomain); + if (typeof ipv4Host === "number" || ipv4Host === failure) { + return ipv4Host; + } + + return asciiDomain; +} + +function parseOpaqueHost(input) { + if (containsForbiddenHostCodePointExcludingPercent(input)) { + return failure; + } + + let output = ""; + const decoded = punycode.ucs2.decode(input); + for (let i = 0; i < decoded.length; ++i) { + output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); + } + return output; +} + +function findLongestZeroSequence(arr) { + let maxIdx = null; + let maxLen = 1; // only find elements > 1 + let currStart = null; + let currLen = 0; + + for (let i = 0; i < arr.length; ++i) { + if (arr[i] !== 0) { + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + currStart = null; + currLen = 0; + } else { + if (currStart === null) { + currStart = i; + } + ++currLen; + } + } + + // if trailing zeros + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + return { + idx: maxIdx, + len: maxLen + }; +} + +function serializeHost(host) { + if (typeof host === "number") { + return serializeIPv4(host); + } + + // IPv6 serializer + if (host instanceof Array) { + return "[" + serializeIPv6(host) + "]"; + } + + return host; +} + +function trimControlChars(url) { + return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); +} + +function trimTabAndNewline(url) { + return url.replace(/\u0009|\u000A|\u000D/g, ""); +} + +function shortenPath(url) { + const path = url.path; + if (path.length === 0) { + return; + } + if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { + return; + } + + path.pop(); +} + +function includesCredentials(url) { + return url.username !== "" || url.password !== ""; +} + +function cannotHaveAUsernamePasswordPort(url) { + return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; +} + +function isNormalizedWindowsDriveLetter(string) { + return /^[A-Za-z]:$/.test(string); +} + +function URLStateMachine(input, base, encodingOverride, url, stateOverride) { + this.pointer = 0; + this.input = input; + this.base = base || null; + this.encodingOverride = encodingOverride || "utf-8"; + this.stateOverride = stateOverride; + this.url = url; + this.failure = false; + this.parseError = false; + + if (!this.url) { + this.url = { + scheme: "", + username: "", + password: "", + host: null, + port: null, + path: [], + query: null, + fragment: null, + + cannotBeABaseURL: false + }; + + const res = trimControlChars(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + } + + const res = trimTabAndNewline(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + + this.state = stateOverride || "scheme start"; + + this.buffer = ""; + this.atFlag = false; + this.arrFlag = false; + this.passwordTokenSeenFlag = false; + + this.input = punycode.ucs2.decode(this.input); + + for (; this.pointer <= this.input.length; ++this.pointer) { + const c = this.input[this.pointer]; + const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); + + // exec state machine + const ret = this["parse " + this.state](c, cStr); + if (!ret) { + break; // terminate algorithm + } else if (ret === failure) { + this.failure = true; + break; + } + } +} + +URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { + if (isASCIIAlpha(c)) { + this.buffer += cStr.toLowerCase(); + this.state = "scheme"; + } else if (!this.stateOverride) { + this.state = "no scheme"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { + if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { + this.buffer += cStr.toLowerCase(); + } else if (c === 58) { + if (this.stateOverride) { + if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { + return false; + } + + if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { + return false; + } + + if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { + return false; + } + + if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { + return false; + } + } + this.url.scheme = this.buffer; + this.buffer = ""; + if (this.stateOverride) { + return false; + } + if (this.url.scheme === "file") { + if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { + this.parseError = true; + } + this.state = "file"; + } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { + this.state = "special relative or authority"; + } else if (isSpecial(this.url)) { + this.state = "special authority slashes"; + } else if (this.input[this.pointer + 1] === 47) { + this.state = "path or authority"; + ++this.pointer; + } else { + this.url.cannotBeABaseURL = true; + this.url.path.push(""); + this.state = "cannot-be-a-base-URL path"; + } + } else if (!this.stateOverride) { + this.buffer = ""; + this.state = "no scheme"; + this.pointer = -1; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { + if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { + return failure; + } else if (this.base.cannotBeABaseURL && c === 35) { + this.url.scheme = this.base.scheme; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.url.cannotBeABaseURL = true; + this.state = "fragment"; + } else if (this.base.scheme === "file") { + this.state = "file"; + --this.pointer; + } else { + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { + if (c === 47) { + this.state = "authority"; + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative"] = function parseRelative(c) { + this.url.scheme = this.base.scheme; + if (isNaN(c)) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 47) { + this.state = "relative slash"; + } else if (c === 63) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else if (isSpecial(this.url) && c === 92) { + this.parseError = true; + this.state = "relative slash"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(0, this.base.path.length - 1); + + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { + if (isSpecial(this.url) && (c === 47 || c === 92)) { + if (c === 92) { + this.parseError = true; + } + this.state = "special authority ignore slashes"; + } else if (c === 47) { + this.state = "authority"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "special authority ignore slashes"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { + if (c !== 47 && c !== 92) { + this.state = "authority"; + --this.pointer; + } else { + this.parseError = true; + } + + return true; +}; + +URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { + if (c === 64) { + this.parseError = true; + if (this.atFlag) { + this.buffer = "%40" + this.buffer; + } + this.atFlag = true; + + // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars + const len = countSymbols(this.buffer); + for (let pointer = 0; pointer < len; ++pointer) { + const codePoint = this.buffer.codePointAt(pointer); + + if (codePoint === 58 && !this.passwordTokenSeenFlag) { + this.passwordTokenSeenFlag = true; + continue; + } + const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); + if (this.passwordTokenSeenFlag) { + this.url.password += encodedCodePoints; + } else { + this.url.username += encodedCodePoints; + } + } + this.buffer = ""; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + if (this.atFlag && this.buffer === "") { + this.parseError = true; + return failure; + } + this.pointer -= countSymbols(this.buffer) + 1; + this.buffer = ""; + this.state = "host"; + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse hostname"] = +URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { + if (this.stateOverride && this.url.scheme === "file") { + --this.pointer; + this.state = "file host"; + } else if (c === 58 && !this.arrFlag) { + if (this.buffer === "") { + this.parseError = true; + return failure; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "port"; + if (this.stateOverride === "hostname") { + return false; + } + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + --this.pointer; + if (isSpecial(this.url) && this.buffer === "") { + this.parseError = true; + return failure; + } else if (this.stateOverride && this.buffer === "" && + (includesCredentials(this.url) || this.url.port !== null)) { + this.parseError = true; + return false; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "path start"; + if (this.stateOverride) { + return false; + } + } else { + if (c === 91) { + this.arrFlag = true; + } else if (c === 93) { + this.arrFlag = false; + } + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { + if (isASCIIDigit(c)) { + this.buffer += cStr; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92) || + this.stateOverride) { + if (this.buffer !== "") { + const port = parseInt(this.buffer); + if (port > Math.pow(2, 16) - 1) { + this.parseError = true; + return failure; + } + this.url.port = port === defaultPort(this.url.scheme) ? null : port; + this.buffer = ""; + } + if (this.stateOverride) { + return false; + } + this.state = "path start"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); + +URLStateMachine.prototype["parse file"] = function parseFile(c) { + this.url.scheme = "file"; + + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file slash"; + } else if (this.base !== null && this.base.scheme === "file") { + if (isNaN(c)) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 63) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else { + if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points + !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || + (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points + !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + shortenPath(this.url); + } else { + this.parseError = true; + } + + this.state = "path"; + --this.pointer; + } + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file host"; + } else { + if (this.base !== null && this.base.scheme === "file") { + if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { + this.url.path.push(this.base.path[0]); + } else { + this.url.host = this.base.host; + } + } + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { + if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { + --this.pointer; + if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { + this.parseError = true; + this.state = "path"; + } else if (this.buffer === "") { + this.url.host = ""; + if (this.stateOverride) { + return false; + } + this.state = "path start"; + } else { + let host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + if (host === "localhost") { + host = ""; + } + this.url.host = host; + + if (this.stateOverride) { + return false; + } + + this.buffer = ""; + this.state = "path start"; + } + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { + if (isSpecial(this.url)) { + if (c === 92) { + this.parseError = true; + } + this.state = "path"; + + if (c !== 47 && c !== 92) { + --this.pointer; + } + } else if (!this.stateOverride && c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (!this.stateOverride && c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else if (c !== undefined) { + this.state = "path"; + if (c !== 47) { + --this.pointer; + } + } + + return true; +}; + +URLStateMachine.prototype["parse path"] = function parsePath(c) { + if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || + (!this.stateOverride && (c === 63 || c === 35))) { + if (isSpecial(this.url) && c === 92) { + this.parseError = true; + } + + if (isDoubleDot(this.buffer)) { + shortenPath(this.url); + if (c !== 47 && !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } + } else if (isSingleDot(this.buffer) && c !== 47 && + !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } else if (!isSingleDot(this.buffer)) { + if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { + if (this.url.host !== "" && this.url.host !== null) { + this.parseError = true; + this.url.host = ""; + } + this.buffer = this.buffer[0] + ":"; + } + this.url.path.push(this.buffer); + } + this.buffer = ""; + if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { + while (this.url.path.length > 1 && this.url.path[0] === "") { + this.parseError = true; + this.url.path.shift(); + } + } + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += percentEncodeChar(c, isPathPercentEncode); + } + + return true; +}; + +URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else { + // TODO: Add: not a URL code point + if (!isNaN(c) && c !== 37) { + this.parseError = true; + } + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + if (!isNaN(c)) { + this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); + } + } + + return true; +}; + +URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { + if (isNaN(c) || (!this.stateOverride && c === 35)) { + if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { + this.encodingOverride = "utf-8"; + } + + const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead + for (let i = 0; i < buffer.length; ++i) { + if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || + buffer[i] === 0x3C || buffer[i] === 0x3E) { + this.url.query += percentEncode(buffer[i]); + } else { + this.url.query += String.fromCodePoint(buffer[i]); + } + } + + this.buffer = ""; + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { + if (isNaN(c)) { // do nothing + } else if (c === 0x0) { + this.parseError = true; + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); + } + + return true; +}; + +function serializeURL(url, excludeFragment) { + let output = url.scheme + ":"; + if (url.host !== null) { + output += "//"; + + if (url.username !== "" || url.password !== "") { + output += url.username; + if (url.password !== "") { + output += ":" + url.password; + } + output += "@"; + } + + output += serializeHost(url.host); + + if (url.port !== null) { + output += ":" + url.port; + } + } else if (url.host === null && url.scheme === "file") { + output += "//"; + } + + if (url.cannotBeABaseURL) { + output += url.path[0]; + } else { + for (const string of url.path) { + output += "/" + string; + } + } + + if (url.query !== null) { + output += "?" + url.query; + } + + if (!excludeFragment && url.fragment !== null) { + output += "#" + url.fragment; + } + + return output; +} + +function serializeOrigin(tuple) { + let result = tuple.scheme + "://"; + result += serializeHost(tuple.host); + + if (tuple.port !== null) { + result += ":" + tuple.port; + } + + return result; +} + +module.exports.serializeURL = serializeURL; + +module.exports.serializeURLOrigin = function (url) { + // https://url.spec.whatwg.org/#concept-url-origin + switch (url.scheme) { + case "blob": + try { + return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); + } catch (e) { + // serializing an opaque origin returns "null" + return "null"; + } + case "ftp": + case "gopher": + case "http": + case "https": + case "ws": + case "wss": + return serializeOrigin({ + scheme: url.scheme, + host: url.host, + port: url.port + }); + case "file": + // spec says "exercise to the reader", chrome says "file://" + return "file://"; + default: + // serializing an opaque origin returns "null" + return "null"; + } +}; + +module.exports.basicURLParse = function (input, options) { + if (options === undefined) { + options = {}; + } + + const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); + if (usm.failure) { + return "failure"; + } + + return usm.url; +}; + +module.exports.setTheUsername = function (url, username) { + url.username = ""; + const decoded = punycode.ucs2.decode(username); + for (let i = 0; i < decoded.length; ++i) { + url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.setThePassword = function (url, password) { + url.password = ""; + const decoded = punycode.ucs2.decode(password); + for (let i = 0; i < decoded.length; ++i) { + url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.serializeHost = serializeHost; + +module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; + +module.exports.serializeInteger = function (integer) { + return String(integer); +}; + +module.exports.parseURL = function (input, options) { + if (options === undefined) { + options = {}; + } + + // We don't handle blobs, so this just delegates: + return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); +}; + + +/***/ }), + +/***/ 60276: +/***/ ((module) => { + +"use strict"; + + +module.exports.mixin = function mixin(target, source) { + const keys = Object.getOwnPropertyNames(source); + for (let i = 0; i < keys.length; ++i) { + Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i])); + } +}; + +module.exports.wrapperSymbol = Symbol("wrapper"); +module.exports.implSymbol = Symbol("impl"); + +module.exports.wrapperForImpl = function (impl) { + return impl[module.exports.wrapperSymbol]; +}; + +module.exports.implForWrapper = function (wrapper) { + return wrapper[module.exports.implSymbol]; +}; + + + +/***/ }), + +/***/ 72043: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +;(function (sax) { // wrapper for non-node envs + sax.parser = function (strict, opt) { return new SAXParser(strict, opt) } + sax.SAXParser = SAXParser + sax.SAXStream = SAXStream + sax.createStream = createStream + + // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns. + // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)), + // since that's the earliest that a buffer overrun could occur. This way, checks are + // as rare as required, but as often as necessary to ensure never crossing this bound. + // Furthermore, buffers are only tested at most once per write(), so passing a very + // large string into write() might have undesirable effects, but this is manageable by + // the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme + // edge case, result in creating at most one complete copy of the string passed in. + // Set to Infinity to have unlimited buffers. + sax.MAX_BUFFER_LENGTH = 64 * 1024 + + var buffers = [ + 'comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype', + 'procInstName', 'procInstBody', 'entity', 'attribName', + 'attribValue', 'cdata', 'script' + ] + + sax.EVENTS = [ + 'text', + 'processinginstruction', + 'sgmldeclaration', + 'doctype', + 'comment', + 'opentagstart', + 'attribute', + 'opentag', + 'closetag', + 'opencdata', + 'cdata', + 'closecdata', + 'error', + 'end', + 'ready', + 'script', + 'opennamespace', + 'closenamespace' + ] + + function SAXParser (strict, opt) { + if (!(this instanceof SAXParser)) { + return new SAXParser(strict, opt) + } + + var parser = this + clearBuffers(parser) + parser.q = parser.c = '' + parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH + parser.opt = opt || {} + parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags + parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase' + parser.tags = [] + parser.closed = parser.closedRoot = parser.sawRoot = false + parser.tag = parser.error = null + parser.strict = !!strict + parser.noscript = !!(strict || parser.opt.noscript) + parser.state = S.BEGIN + parser.strictEntities = parser.opt.strictEntities + parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES) + parser.attribList = [] + + // namespaces form a prototype chain. + // it always points at the current tag, + // which protos to its parent tag. + if (parser.opt.xmlns) { + parser.ns = Object.create(rootNS) + } + + // mostly just for error reporting + parser.trackPosition = parser.opt.position !== false + if (parser.trackPosition) { + parser.position = parser.line = parser.column = 0 + } + emit(parser, 'onready') + } + + if (!Object.create) { + Object.create = function (o) { + function F () {} + F.prototype = o + var newf = new F() + return newf + } + } + + if (!Object.keys) { + Object.keys = function (o) { + var a = [] + for (var i in o) if (o.hasOwnProperty(i)) a.push(i) + return a + } + } + + function checkBufferLength (parser) { + var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10) + var maxActual = 0 + for (var i = 0, l = buffers.length; i < l; i++) { + var len = parser[buffers[i]].length + if (len > maxAllowed) { + // Text/cdata nodes can get big, and since they're buffered, + // we can get here under normal conditions. + // Avoid issues by emitting the text node now, + // so at least it won't get any bigger. + switch (buffers[i]) { + case 'textNode': + closeText(parser) + break + + case 'cdata': + emitNode(parser, 'oncdata', parser.cdata) + parser.cdata = '' + break + + case 'script': + emitNode(parser, 'onscript', parser.script) + parser.script = '' + break + + default: + error(parser, 'Max buffer length exceeded: ' + buffers[i]) + } + } + maxActual = Math.max(maxActual, len) + } + // schedule the next check for the earliest possible buffer overrun. + var m = sax.MAX_BUFFER_LENGTH - maxActual + parser.bufferCheckPosition = m + parser.position + } + + function clearBuffers (parser) { + for (var i = 0, l = buffers.length; i < l; i++) { + parser[buffers[i]] = '' + } + } + + function flushBuffers (parser) { + closeText(parser) + if (parser.cdata !== '') { + emitNode(parser, 'oncdata', parser.cdata) + parser.cdata = '' + } + if (parser.script !== '') { + emitNode(parser, 'onscript', parser.script) + parser.script = '' + } + } + + SAXParser.prototype = { + end: function () { end(this) }, + write: write, + resume: function () { this.error = null; return this }, + close: function () { return this.write(null) }, + flush: function () { flushBuffers(this) } + } + + var Stream + try { + Stream = (__nccwpck_require__(12781).Stream) + } catch (ex) { + Stream = function () {} + } + + var streamWraps = sax.EVENTS.filter(function (ev) { + return ev !== 'error' && ev !== 'end' + }) + + function createStream (strict, opt) { + return new SAXStream(strict, opt) + } + + function SAXStream (strict, opt) { + if (!(this instanceof SAXStream)) { + return new SAXStream(strict, opt) + } + + Stream.apply(this) + + this._parser = new SAXParser(strict, opt) + this.writable = true + this.readable = true + + var me = this + + this._parser.onend = function () { + me.emit('end') + } + + this._parser.onerror = function (er) { + me.emit('error', er) + + // if didn't throw, then means error was handled. + // go ahead and clear error, so we can write again. + me._parser.error = null + } + + this._decoder = null + + streamWraps.forEach(function (ev) { + Object.defineProperty(me, 'on' + ev, { + get: function () { + return me._parser['on' + ev] + }, + set: function (h) { + if (!h) { + me.removeAllListeners(ev) + me._parser['on' + ev] = h + return h + } + me.on(ev, h) + }, + enumerable: true, + configurable: false + }) + }) + } + + SAXStream.prototype = Object.create(Stream.prototype, { + constructor: { + value: SAXStream + } + }) + + SAXStream.prototype.write = function (data) { + if (typeof Buffer === 'function' && + typeof Buffer.isBuffer === 'function' && + Buffer.isBuffer(data)) { + if (!this._decoder) { + var SD = (__nccwpck_require__(71576).StringDecoder) + this._decoder = new SD('utf8') + } + data = this._decoder.write(data) + } + + this._parser.write(data.toString()) + this.emit('data', data) + return true + } + + SAXStream.prototype.end = function (chunk) { + if (chunk && chunk.length) { + this.write(chunk) + } + this._parser.end() + return true + } + + SAXStream.prototype.on = function (ev, handler) { + var me = this + if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) { + me._parser['on' + ev] = function () { + var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments) + args.splice(0, 0, ev) + me.emit.apply(me, args) + } + } + + return Stream.prototype.on.call(me, ev, handler) + } + + // this really needs to be replaced with character classes. + // XML allows all manner of ridiculous numbers and digits. + var CDATA = '[CDATA[' + var DOCTYPE = 'DOCTYPE' + var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace' + var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/' + var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE } + + // http://www.w3.org/TR/REC-xml/#NT-NameStartChar + // This implementation works on strings, a single character at a time + // as such, it cannot ever support astral-plane characters (10000-EFFFF) + // without a significant breaking change to either this parser, or the + // JavaScript language. Implementation of an emoji-capable xml parser + // is left as an exercise for the reader. + var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/ + + var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/ + + var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/ + var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/ + + function isWhitespace (c) { + return c === ' ' || c === '\n' || c === '\r' || c === '\t' + } + + function isQuote (c) { + return c === '"' || c === '\'' + } + + function isAttribEnd (c) { + return c === '>' || isWhitespace(c) + } + + function isMatch (regex, c) { + return regex.test(c) + } + + function notMatch (regex, c) { + return !isMatch(regex, c) + } + + var S = 0 + sax.STATE = { + BEGIN: S++, // leading byte order mark or whitespace + BEGIN_WHITESPACE: S++, // leading whitespace + TEXT: S++, // general stuff + TEXT_ENTITY: S++, // & and such. + OPEN_WAKA: S++, // < + SGML_DECL: S++, // + SCRIPT: S++, //