typeson-registry
Version:
The type registry for typeson
1 lines • 138 kB
Source Map (JSON)
{"version":3,"file":"createObjectURL.umd.cjs","sources":["../node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/URL.js","../node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/URLSearchParams.js","../node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/url-state-machine.js","../node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/percent-encoding.js","../node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/index.js","../node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/webidl2js-wrapper.js","../node_modules/.pnpm/jsdom@26.1.0_canvas@3.2.0/node_modules/jsdom/lib/jsdom/living/generated/utils.js","createObjectURL.js","../utils/generateUUID.js"],"sourcesContent":["\"use strict\";\n\nconst conversions = require(\"webidl-conversions\");\nconst utils = require(\"./utils.js\");\n\nconst implSymbol = utils.implSymbol;\nconst ctorRegistrySymbol = utils.ctorRegistrySymbol;\n\nconst interfaceName = \"URL\";\n\nexports.is = value => {\n return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation;\n};\nexports.isImpl = value => {\n return utils.isObject(value) && value instanceof Impl.implementation;\n};\nexports.convert = (globalObject, value, { context = \"The provided value\" } = {}) => {\n if (exports.is(value)) {\n return utils.implForWrapper(value);\n }\n throw new globalObject.TypeError(`${context} is not of type 'URL'.`);\n};\n\nfunction makeWrapper(globalObject, newTarget) {\n let proto;\n if (newTarget !== undefined) {\n proto = newTarget.prototype;\n }\n\n if (!utils.isObject(proto)) {\n proto = globalObject[ctorRegistrySymbol][\"URL\"].prototype;\n }\n\n return Object.create(proto);\n}\n\nexports.create = (globalObject, constructorArgs, privateData) => {\n const wrapper = makeWrapper(globalObject);\n return exports.setup(wrapper, globalObject, constructorArgs, privateData);\n};\n\nexports.createImpl = (globalObject, constructorArgs, privateData) => {\n const wrapper = exports.create(globalObject, constructorArgs, privateData);\n return utils.implForWrapper(wrapper);\n};\n\nexports._internalSetup = (wrapper, globalObject) => {};\n\nexports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => {\n privateData.wrapper = wrapper;\n\n exports._internalSetup(wrapper, globalObject);\n Object.defineProperty(wrapper, implSymbol, {\n value: new Impl.implementation(globalObject, constructorArgs, privateData),\n configurable: true\n });\n\n wrapper[implSymbol][utils.wrapperSymbol] = wrapper;\n if (Impl.init) {\n Impl.init(wrapper[implSymbol]);\n }\n return wrapper;\n};\n\nexports.new = (globalObject, newTarget) => {\n const wrapper = makeWrapper(globalObject, newTarget);\n\n exports._internalSetup(wrapper, globalObject);\n Object.defineProperty(wrapper, implSymbol, {\n value: Object.create(Impl.implementation.prototype),\n configurable: true\n });\n\n wrapper[implSymbol][utils.wrapperSymbol] = wrapper;\n if (Impl.init) {\n Impl.init(wrapper[implSymbol]);\n }\n return wrapper[implSymbol];\n};\n\nconst exposed = new Set([\"Window\", \"Worker\"]);\n\nexports.install = (globalObject, globalNames) => {\n if (!globalNames.some(globalName => exposed.has(globalName))) {\n return;\n }\n\n const ctorRegistry = utils.initCtorRegistry(globalObject);\n class URL {\n constructor(url) {\n if (arguments.length < 1) {\n throw new globalObject.TypeError(\n `Failed to construct 'URL': 1 argument required, but only ${arguments.length} present.`\n );\n }\n const args = [];\n {\n let curArg = arguments[0];\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to construct 'URL': parameter 1\",\n globals: globalObject\n });\n args.push(curArg);\n }\n {\n let curArg = arguments[1];\n if (curArg !== undefined) {\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to construct 'URL': parameter 2\",\n globals: globalObject\n });\n }\n args.push(curArg);\n }\n return exports.setup(Object.create(new.target.prototype), globalObject, args);\n }\n\n toJSON() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'toJSON' called on an object that is not a valid instance of URL.\");\n }\n\n return esValue[implSymbol].toJSON();\n }\n\n get href() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'get href' called on an object that is not a valid instance of URL.\");\n }\n\n return esValue[implSymbol][\"href\"];\n }\n\n set href(V) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'set href' called on an object that is not a valid instance of URL.\");\n }\n\n V = conversions[\"USVString\"](V, {\n context: \"Failed to set the 'href' property on 'URL': The provided value\",\n globals: globalObject\n });\n\n esValue[implSymbol][\"href\"] = V;\n }\n\n toString() {\n const esValue = this;\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'toString' called on an object that is not a valid instance of URL.\");\n }\n\n return esValue[implSymbol][\"href\"];\n }\n\n get origin() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'get origin' called on an object that is not a valid instance of URL.\");\n }\n\n return esValue[implSymbol][\"origin\"];\n }\n\n get protocol() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'get protocol' called on an object that is not a valid instance of URL.\");\n }\n\n return esValue[implSymbol][\"protocol\"];\n }\n\n set protocol(V) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'set protocol' called on an object that is not a valid instance of URL.\");\n }\n\n V = conversions[\"USVString\"](V, {\n context: \"Failed to set the 'protocol' property on 'URL': The provided value\",\n globals: globalObject\n });\n\n esValue[implSymbol][\"protocol\"] = V;\n }\n\n get username() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'get username' called on an object that is not a valid instance of URL.\");\n }\n\n return esValue[implSymbol][\"username\"];\n }\n\n set username(V) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'set username' called on an object that is not a valid instance of URL.\");\n }\n\n V = conversions[\"USVString\"](V, {\n context: \"Failed to set the 'username' property on 'URL': The provided value\",\n globals: globalObject\n });\n\n esValue[implSymbol][\"username\"] = V;\n }\n\n get password() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'get password' called on an object that is not a valid instance of URL.\");\n }\n\n return esValue[implSymbol][\"password\"];\n }\n\n set password(V) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'set password' called on an object that is not a valid instance of URL.\");\n }\n\n V = conversions[\"USVString\"](V, {\n context: \"Failed to set the 'password' property on 'URL': The provided value\",\n globals: globalObject\n });\n\n esValue[implSymbol][\"password\"] = V;\n }\n\n get host() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'get host' called on an object that is not a valid instance of URL.\");\n }\n\n return esValue[implSymbol][\"host\"];\n }\n\n set host(V) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'set host' called on an object that is not a valid instance of URL.\");\n }\n\n V = conversions[\"USVString\"](V, {\n context: \"Failed to set the 'host' property on 'URL': The provided value\",\n globals: globalObject\n });\n\n esValue[implSymbol][\"host\"] = V;\n }\n\n get hostname() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'get hostname' called on an object that is not a valid instance of URL.\");\n }\n\n return esValue[implSymbol][\"hostname\"];\n }\n\n set hostname(V) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'set hostname' called on an object that is not a valid instance of URL.\");\n }\n\n V = conversions[\"USVString\"](V, {\n context: \"Failed to set the 'hostname' property on 'URL': The provided value\",\n globals: globalObject\n });\n\n esValue[implSymbol][\"hostname\"] = V;\n }\n\n get port() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'get port' called on an object that is not a valid instance of URL.\");\n }\n\n return esValue[implSymbol][\"port\"];\n }\n\n set port(V) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'set port' called on an object that is not a valid instance of URL.\");\n }\n\n V = conversions[\"USVString\"](V, {\n context: \"Failed to set the 'port' property on 'URL': The provided value\",\n globals: globalObject\n });\n\n esValue[implSymbol][\"port\"] = V;\n }\n\n get pathname() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'get pathname' called on an object that is not a valid instance of URL.\");\n }\n\n return esValue[implSymbol][\"pathname\"];\n }\n\n set pathname(V) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'set pathname' called on an object that is not a valid instance of URL.\");\n }\n\n V = conversions[\"USVString\"](V, {\n context: \"Failed to set the 'pathname' property on 'URL': The provided value\",\n globals: globalObject\n });\n\n esValue[implSymbol][\"pathname\"] = V;\n }\n\n get search() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'get search' called on an object that is not a valid instance of URL.\");\n }\n\n return esValue[implSymbol][\"search\"];\n }\n\n set search(V) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'set search' called on an object that is not a valid instance of URL.\");\n }\n\n V = conversions[\"USVString\"](V, {\n context: \"Failed to set the 'search' property on 'URL': The provided value\",\n globals: globalObject\n });\n\n esValue[implSymbol][\"search\"] = V;\n }\n\n get searchParams() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'get searchParams' called on an object that is not a valid instance of URL.\");\n }\n\n return utils.getSameObject(this, \"searchParams\", () => {\n return utils.tryWrapperForImpl(esValue[implSymbol][\"searchParams\"]);\n });\n }\n\n get hash() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'get hash' called on an object that is not a valid instance of URL.\");\n }\n\n return esValue[implSymbol][\"hash\"];\n }\n\n set hash(V) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'set hash' called on an object that is not a valid instance of URL.\");\n }\n\n V = conversions[\"USVString\"](V, {\n context: \"Failed to set the 'hash' property on 'URL': The provided value\",\n globals: globalObject\n });\n\n esValue[implSymbol][\"hash\"] = V;\n }\n\n static parse(url) {\n if (arguments.length < 1) {\n throw new globalObject.TypeError(\n `Failed to execute 'parse' on 'URL': 1 argument required, but only ${arguments.length} present.`\n );\n }\n const args = [];\n {\n let curArg = arguments[0];\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'parse' on 'URL': parameter 1\",\n globals: globalObject\n });\n args.push(curArg);\n }\n {\n let curArg = arguments[1];\n if (curArg !== undefined) {\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'parse' on 'URL': parameter 2\",\n globals: globalObject\n });\n }\n args.push(curArg);\n }\n return utils.tryWrapperForImpl(Impl.implementation.parse(globalObject, ...args));\n }\n\n static canParse(url) {\n if (arguments.length < 1) {\n throw new globalObject.TypeError(\n `Failed to execute 'canParse' on 'URL': 1 argument required, but only ${arguments.length} present.`\n );\n }\n const args = [];\n {\n let curArg = arguments[0];\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'canParse' on 'URL': parameter 1\",\n globals: globalObject\n });\n args.push(curArg);\n }\n {\n let curArg = arguments[1];\n if (curArg !== undefined) {\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'canParse' on 'URL': parameter 2\",\n globals: globalObject\n });\n }\n args.push(curArg);\n }\n return Impl.implementation.canParse(...args);\n }\n }\n Object.defineProperties(URL.prototype, {\n toJSON: { enumerable: true },\n href: { enumerable: true },\n toString: { enumerable: true },\n origin: { enumerable: true },\n protocol: { enumerable: true },\n username: { enumerable: true },\n password: { enumerable: true },\n host: { enumerable: true },\n hostname: { enumerable: true },\n port: { enumerable: true },\n pathname: { enumerable: true },\n search: { enumerable: true },\n searchParams: { enumerable: true },\n hash: { enumerable: true },\n [Symbol.toStringTag]: { value: \"URL\", configurable: true }\n });\n Object.defineProperties(URL, { parse: { enumerable: true }, canParse: { enumerable: true } });\n ctorRegistry[interfaceName] = URL;\n\n Object.defineProperty(globalObject, interfaceName, {\n configurable: true,\n writable: true,\n value: URL\n });\n\n if (globalNames.includes(\"Window\")) {\n Object.defineProperty(globalObject, \"webkitURL\", {\n configurable: true,\n writable: true,\n value: URL\n });\n }\n};\n\nconst Impl = require(\"./URL-impl.js\");\n","\"use strict\";\n\nconst conversions = require(\"webidl-conversions\");\nconst utils = require(\"./utils.js\");\n\nconst Function = require(\"./Function.js\");\nconst newObjectInRealm = utils.newObjectInRealm;\nconst implSymbol = utils.implSymbol;\nconst ctorRegistrySymbol = utils.ctorRegistrySymbol;\n\nconst interfaceName = \"URLSearchParams\";\n\nexports.is = value => {\n return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation;\n};\nexports.isImpl = value => {\n return utils.isObject(value) && value instanceof Impl.implementation;\n};\nexports.convert = (globalObject, value, { context = \"The provided value\" } = {}) => {\n if (exports.is(value)) {\n return utils.implForWrapper(value);\n }\n throw new globalObject.TypeError(`${context} is not of type 'URLSearchParams'.`);\n};\n\nexports.createDefaultIterator = (globalObject, target, kind) => {\n const ctorRegistry = globalObject[ctorRegistrySymbol];\n const iteratorPrototype = ctorRegistry[\"URLSearchParams Iterator\"];\n const iterator = Object.create(iteratorPrototype);\n Object.defineProperty(iterator, utils.iterInternalSymbol, {\n value: { target, kind, index: 0 },\n configurable: true\n });\n return iterator;\n};\n\nfunction makeWrapper(globalObject, newTarget) {\n let proto;\n if (newTarget !== undefined) {\n proto = newTarget.prototype;\n }\n\n if (!utils.isObject(proto)) {\n proto = globalObject[ctorRegistrySymbol][\"URLSearchParams\"].prototype;\n }\n\n return Object.create(proto);\n}\n\nexports.create = (globalObject, constructorArgs, privateData) => {\n const wrapper = makeWrapper(globalObject);\n return exports.setup(wrapper, globalObject, constructorArgs, privateData);\n};\n\nexports.createImpl = (globalObject, constructorArgs, privateData) => {\n const wrapper = exports.create(globalObject, constructorArgs, privateData);\n return utils.implForWrapper(wrapper);\n};\n\nexports._internalSetup = (wrapper, globalObject) => {};\n\nexports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => {\n privateData.wrapper = wrapper;\n\n exports._internalSetup(wrapper, globalObject);\n Object.defineProperty(wrapper, implSymbol, {\n value: new Impl.implementation(globalObject, constructorArgs, privateData),\n configurable: true\n });\n\n wrapper[implSymbol][utils.wrapperSymbol] = wrapper;\n if (Impl.init) {\n Impl.init(wrapper[implSymbol]);\n }\n return wrapper;\n};\n\nexports.new = (globalObject, newTarget) => {\n const wrapper = makeWrapper(globalObject, newTarget);\n\n exports._internalSetup(wrapper, globalObject);\n Object.defineProperty(wrapper, implSymbol, {\n value: Object.create(Impl.implementation.prototype),\n configurable: true\n });\n\n wrapper[implSymbol][utils.wrapperSymbol] = wrapper;\n if (Impl.init) {\n Impl.init(wrapper[implSymbol]);\n }\n return wrapper[implSymbol];\n};\n\nconst exposed = new Set([\"Window\", \"Worker\"]);\n\nexports.install = (globalObject, globalNames) => {\n if (!globalNames.some(globalName => exposed.has(globalName))) {\n return;\n }\n\n const ctorRegistry = utils.initCtorRegistry(globalObject);\n class URLSearchParams {\n constructor() {\n const args = [];\n {\n let curArg = arguments[0];\n if (curArg !== undefined) {\n if (utils.isObject(curArg)) {\n if (curArg[Symbol.iterator] !== undefined) {\n if (!utils.isObject(curArg)) {\n throw new globalObject.TypeError(\n \"Failed to construct 'URLSearchParams': parameter 1\" + \" sequence\" + \" is not an iterable object.\"\n );\n } else {\n const V = [];\n const tmp = curArg;\n for (let nextItem of tmp) {\n if (!utils.isObject(nextItem)) {\n throw new globalObject.TypeError(\n \"Failed to construct 'URLSearchParams': parameter 1\" +\n \" sequence\" +\n \"'s element\" +\n \" is not an iterable object.\"\n );\n } else {\n const V = [];\n const tmp = nextItem;\n for (let nextItem of tmp) {\n nextItem = conversions[\"USVString\"](nextItem, {\n context:\n \"Failed to construct 'URLSearchParams': parameter 1\" +\n \" sequence\" +\n \"'s element\" +\n \"'s element\",\n globals: globalObject\n });\n\n V.push(nextItem);\n }\n nextItem = V;\n }\n\n V.push(nextItem);\n }\n curArg = V;\n }\n } else {\n if (!utils.isObject(curArg)) {\n throw new globalObject.TypeError(\n \"Failed to construct 'URLSearchParams': parameter 1\" + \" record\" + \" is not an object.\"\n );\n } else {\n const result = Object.create(null);\n for (const key of Reflect.ownKeys(curArg)) {\n const desc = Object.getOwnPropertyDescriptor(curArg, key);\n if (desc && desc.enumerable) {\n let typedKey = key;\n\n typedKey = conversions[\"USVString\"](typedKey, {\n context: \"Failed to construct 'URLSearchParams': parameter 1\" + \" record\" + \"'s key\",\n globals: globalObject\n });\n\n let typedValue = curArg[key];\n\n typedValue = conversions[\"USVString\"](typedValue, {\n context: \"Failed to construct 'URLSearchParams': parameter 1\" + \" record\" + \"'s value\",\n globals: globalObject\n });\n\n result[typedKey] = typedValue;\n }\n }\n curArg = result;\n }\n }\n } else {\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to construct 'URLSearchParams': parameter 1\",\n globals: globalObject\n });\n }\n } else {\n curArg = \"\";\n }\n args.push(curArg);\n }\n return exports.setup(Object.create(new.target.prototype), globalObject, args);\n }\n\n append(name, value) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\n \"'append' called on an object that is not a valid instance of URLSearchParams.\"\n );\n }\n\n if (arguments.length < 2) {\n throw new globalObject.TypeError(\n `Failed to execute 'append' on 'URLSearchParams': 2 arguments required, but only ${arguments.length} present.`\n );\n }\n const args = [];\n {\n let curArg = arguments[0];\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'append' on 'URLSearchParams': parameter 1\",\n globals: globalObject\n });\n args.push(curArg);\n }\n {\n let curArg = arguments[1];\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'append' on 'URLSearchParams': parameter 2\",\n globals: globalObject\n });\n args.push(curArg);\n }\n return utils.tryWrapperForImpl(esValue[implSymbol].append(...args));\n }\n\n delete(name) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\n \"'delete' called on an object that is not a valid instance of URLSearchParams.\"\n );\n }\n\n if (arguments.length < 1) {\n throw new globalObject.TypeError(\n `Failed to execute 'delete' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`\n );\n }\n const args = [];\n {\n let curArg = arguments[0];\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'delete' on 'URLSearchParams': parameter 1\",\n globals: globalObject\n });\n args.push(curArg);\n }\n {\n let curArg = arguments[1];\n if (curArg !== undefined) {\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'delete' on 'URLSearchParams': parameter 2\",\n globals: globalObject\n });\n }\n args.push(curArg);\n }\n return utils.tryWrapperForImpl(esValue[implSymbol].delete(...args));\n }\n\n get(name) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'get' called on an object that is not a valid instance of URLSearchParams.\");\n }\n\n if (arguments.length < 1) {\n throw new globalObject.TypeError(\n `Failed to execute 'get' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`\n );\n }\n const args = [];\n {\n let curArg = arguments[0];\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'get' on 'URLSearchParams': parameter 1\",\n globals: globalObject\n });\n args.push(curArg);\n }\n return esValue[implSymbol].get(...args);\n }\n\n getAll(name) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\n \"'getAll' called on an object that is not a valid instance of URLSearchParams.\"\n );\n }\n\n if (arguments.length < 1) {\n throw new globalObject.TypeError(\n `Failed to execute 'getAll' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`\n );\n }\n const args = [];\n {\n let curArg = arguments[0];\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'getAll' on 'URLSearchParams': parameter 1\",\n globals: globalObject\n });\n args.push(curArg);\n }\n return utils.tryWrapperForImpl(esValue[implSymbol].getAll(...args));\n }\n\n has(name) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'has' called on an object that is not a valid instance of URLSearchParams.\");\n }\n\n if (arguments.length < 1) {\n throw new globalObject.TypeError(\n `Failed to execute 'has' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`\n );\n }\n const args = [];\n {\n let curArg = arguments[0];\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'has' on 'URLSearchParams': parameter 1\",\n globals: globalObject\n });\n args.push(curArg);\n }\n {\n let curArg = arguments[1];\n if (curArg !== undefined) {\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'has' on 'URLSearchParams': parameter 2\",\n globals: globalObject\n });\n }\n args.push(curArg);\n }\n return esValue[implSymbol].has(...args);\n }\n\n set(name, value) {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'set' called on an object that is not a valid instance of URLSearchParams.\");\n }\n\n if (arguments.length < 2) {\n throw new globalObject.TypeError(\n `Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only ${arguments.length} present.`\n );\n }\n const args = [];\n {\n let curArg = arguments[0];\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'set' on 'URLSearchParams': parameter 1\",\n globals: globalObject\n });\n args.push(curArg);\n }\n {\n let curArg = arguments[1];\n curArg = conversions[\"USVString\"](curArg, {\n context: \"Failed to execute 'set' on 'URLSearchParams': parameter 2\",\n globals: globalObject\n });\n args.push(curArg);\n }\n return utils.tryWrapperForImpl(esValue[implSymbol].set(...args));\n }\n\n sort() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\"'sort' called on an object that is not a valid instance of URLSearchParams.\");\n }\n\n return utils.tryWrapperForImpl(esValue[implSymbol].sort());\n }\n\n toString() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\n \"'toString' called on an object that is not a valid instance of URLSearchParams.\"\n );\n }\n\n return esValue[implSymbol].toString();\n }\n\n keys() {\n if (!exports.is(this)) {\n throw new globalObject.TypeError(\"'keys' called on an object that is not a valid instance of URLSearchParams.\");\n }\n return exports.createDefaultIterator(globalObject, this, \"key\");\n }\n\n values() {\n if (!exports.is(this)) {\n throw new globalObject.TypeError(\n \"'values' called on an object that is not a valid instance of URLSearchParams.\"\n );\n }\n return exports.createDefaultIterator(globalObject, this, \"value\");\n }\n\n entries() {\n if (!exports.is(this)) {\n throw new globalObject.TypeError(\n \"'entries' called on an object that is not a valid instance of URLSearchParams.\"\n );\n }\n return exports.createDefaultIterator(globalObject, this, \"key+value\");\n }\n\n forEach(callback) {\n if (!exports.is(this)) {\n throw new globalObject.TypeError(\n \"'forEach' called on an object that is not a valid instance of URLSearchParams.\"\n );\n }\n if (arguments.length < 1) {\n throw new globalObject.TypeError(\n \"Failed to execute 'forEach' on 'iterable': 1 argument required, but only 0 present.\"\n );\n }\n callback = Function.convert(globalObject, callback, {\n context: \"Failed to execute 'forEach' on 'iterable': The callback provided as parameter 1\"\n });\n const thisArg = arguments[1];\n let pairs = Array.from(this[implSymbol]);\n let i = 0;\n while (i < pairs.length) {\n const [key, value] = pairs[i].map(utils.tryWrapperForImpl);\n callback.call(thisArg, value, key, this);\n pairs = Array.from(this[implSymbol]);\n i++;\n }\n }\n\n get size() {\n const esValue = this !== null && this !== undefined ? this : globalObject;\n\n if (!exports.is(esValue)) {\n throw new globalObject.TypeError(\n \"'get size' called on an object that is not a valid instance of URLSearchParams.\"\n );\n }\n\n return esValue[implSymbol][\"size\"];\n }\n }\n Object.defineProperties(URLSearchParams.prototype, {\n append: { enumerable: true },\n delete: { enumerable: true },\n get: { enumerable: true },\n getAll: { enumerable: true },\n has: { enumerable: true },\n set: { enumerable: true },\n sort: { enumerable: true },\n toString: { enumerable: true },\n keys: { enumerable: true },\n values: { enumerable: true },\n entries: { enumerable: true },\n forEach: { enumerable: true },\n size: { enumerable: true },\n [Symbol.toStringTag]: { value: \"URLSearchParams\", configurable: true },\n [Symbol.iterator]: { value: URLSearchParams.prototype.entries, configurable: true, writable: true }\n });\n ctorRegistry[interfaceName] = URLSearchParams;\n\n ctorRegistry[\"URLSearchParams Iterator\"] = Object.create(ctorRegistry[\"%IteratorPrototype%\"], {\n [Symbol.toStringTag]: {\n configurable: true,\n value: \"URLSearchParams Iterator\"\n }\n });\n utils.define(ctorRegistry[\"URLSearchParams Iterator\"], {\n next() {\n const internal = this && this[utils.iterInternalSymbol];\n if (!internal) {\n throw new globalObject.TypeError(\"next() called on a value that is not a URLSearchParams iterator object\");\n }\n\n const { target, kind, index } = internal;\n const values = Array.from(target[implSymbol]);\n const len = values.length;\n if (index >= len) {\n return newObjectInRealm(globalObject, { value: undefined, done: true });\n }\n\n const pair = values[index];\n internal.index = index + 1;\n return newObjectInRealm(globalObject, utils.iteratorResult(pair.map(utils.tryWrapperForImpl), kind));\n }\n });\n\n Object.defineProperty(globalObject, interfaceName, {\n configurable: true,\n writable: true,\n value: URLSearchParams\n });\n};\n\nconst Impl = require(\"./URLSearchParams-impl.js\");\n","\"use strict\";\nconst tr46 = require(\"tr46\");\n\nconst infra = require(\"./infra\");\nconst { utf8DecodeWithoutBOM } = require(\"./encoding\");\nconst { percentDecodeString, utf8PercentEncodeCodePoint, utf8PercentEncodeString, isC0ControlPercentEncode,\n isFragmentPercentEncode, isQueryPercentEncode, isSpecialQueryPercentEncode, isPathPercentEncode,\n isUserinfoPercentEncode } = require(\"./percent-encoding\");\n\nfunction p(char) {\n return char.codePointAt(0);\n}\n\nconst specialSchemes = {\n ftp: 21,\n file: null,\n http: 80,\n https: 443,\n ws: 80,\n wss: 443\n};\n\nconst failure = Symbol(\"failure\");\n\nfunction countSymbols(str) {\n return [...str].length;\n}\n\nfunction at(input, idx) {\n const c = input[idx];\n return isNaN(c) ? undefined : String.fromCodePoint(c);\n}\n\nfunction isSingleDot(buffer) {\n return buffer === \".\" || buffer.toLowerCase() === \"%2e\";\n}\n\nfunction isDoubleDot(buffer) {\n buffer = buffer.toLowerCase();\n return buffer === \"..\" || buffer === \"%2e.\" || buffer === \".%2e\" || buffer === \"%2e%2e\";\n}\n\nfunction isWindowsDriveLetterCodePoints(cp1, cp2) {\n return infra.isASCIIAlpha(cp1) && (cp2 === p(\":\") || cp2 === p(\"|\"));\n}\n\nfunction isWindowsDriveLetterString(string) {\n return string.length === 2 && infra.isASCIIAlpha(string.codePointAt(0)) && (string[1] === \":\" || string[1] === \"|\");\n}\n\nfunction isNormalizedWindowsDriveLetterString(string) {\n return string.length === 2 && infra.isASCIIAlpha(string.codePointAt(0)) && string[1] === \":\";\n}\n\nfunction containsForbiddenHostCodePoint(string) {\n return string.search(/\\u0000|\\u0009|\\u000A|\\u000D|\\u0020|#|\\/|:|<|>|\\?|@|\\[|\\\\|\\]|\\^|\\|/u) !== -1;\n}\n\nfunction containsForbiddenDomainCodePoint(string) {\n return containsForbiddenHostCodePoint(string) || string.search(/[\\u0000-\\u001F]|%|\\u007F/u) !== -1;\n}\n\nfunction isSpecialScheme(scheme) {\n return specialSchemes[scheme] !== undefined;\n}\n\nfunction isSpecial(url) {\n return isSpecialScheme(url.scheme);\n}\n\nfunction isNotSpecial(url) {\n return !isSpecialScheme(url.scheme);\n}\n\nfunction defaultPort(scheme) {\n return specialSchemes[scheme];\n}\n\nfunction parseIPv4Number(input) {\n if (input === \"\") {\n return failure;\n }\n\n let R = 10;\n\n if (input.length >= 2 && input.charAt(0) === \"0\" && input.charAt(1).toLowerCase() === \"x\") {\n input = input.substring(2);\n R = 16;\n } else if (input.length >= 2 && input.charAt(0) === \"0\") {\n input = input.substring(1);\n R = 8;\n }\n\n if (input === \"\") {\n return 0;\n }\n\n let regex = /[^0-7]/u;\n if (R === 10) {\n regex = /[^0-9]/u;\n }\n if (R === 16) {\n regex = /[^0-9A-Fa-f]/u;\n }\n\n if (regex.test(input)) {\n return failure;\n }\n\n return parseInt(input, R);\n}\n\nfunction parseIPv4(input) {\n const parts = input.split(\".\");\n if (parts[parts.length - 1] === \"\") {\n if (parts.length > 1) {\n parts.pop();\n }\n }\n\n if (parts.length > 4) {\n return failure;\n }\n\n const numbers = [];\n for (const part of parts) {\n const n = parseIPv4Number(part);\n if (n === failure) {\n return failure;\n }\n\n numbers.push(n);\n }\n\n for (let i = 0; i < numbers.length - 1; ++i) {\n if (numbers[i] > 255) {\n return failure;\n }\n }\n if (numbers[numbers.length - 1] >= 256 ** (5 - numbers.length)) {\n return failure;\n }\n\n let ipv4 = numbers.pop();\n let counter = 0;\n\n for (const n of numbers) {\n ipv4 += n * 256 ** (3 - counter);\n ++counter;\n }\n\n return ipv4;\n}\n\nfunction serializeIPv4(address) {\n let output = \"\";\n let n = address;\n\n for (let i = 1; i <= 4; ++i) {\n output = String(n % 256) + output;\n if (i !== 4) {\n output = `.${output}`;\n }\n n = Math.floor(n / 256);\n }\n\n return output;\n}\n\nfunction parseIPv6(input) {\n const address = [0, 0, 0, 0, 0, 0, 0, 0];\n let pieceIndex = 0;\n let compress = null;\n let pointer = 0;\n\n input = Array.from(input, c => c.codePointAt(0));\n\n if (input[pointer] === p(\":\")) {\n if (input[pointer + 1] !== p(\":\")) {\n return failure;\n }\n\n pointer += 2;\n ++pieceIndex;\n compress = pieceIndex;\n }\n\n while (pointer < input.length) {\n if (pieceIndex === 8) {\n return failure;\n }\n\n if (input[pointer] === p(\":\")) {\n if (compress !== null) {\n return failure;\n }\n ++pointer;\n ++pieceIndex;\n compress = pieceIndex;\n continue;\n }\n\n let value = 0;\n let length = 0;\n\n while (length < 4 && infra.isASCIIHex(input[pointer])) {\n value = value * 0x10 + parseInt(at(input, pointer), 16);\n ++pointer;\n ++length;\n }\n\n if (input[pointer] === p(\".\")) {\n if (length === 0) {\n return failure;\n }\n\n pointer -= length;\n\n if (pieceIndex > 6) {\n return failure;\n }\n\n let numbersSeen = 0;\n\n while (input[pointer] !== undefined) {\n let ipv4Piece = null;\n\n if (numbersSeen > 0) {\n if (input[pointer] === p(\".\") && numbersSeen < 4) {\n ++pointer;\n } else {\n return failure;\n }\n }\n\n if (!infra.isASCIIDigit(input[pointer])) {\n return failure;\n }\n\n while (infra.isASCIIDigit(input[pointer])) {\n const number = parseInt(at(input, pointer));\n if (ipv4Piece === null) {\n ipv4Piece = number;\n } else if (ipv4Piece === 0) {\n return failure;\n } else {\n ipv4Piece = ipv4Piece * 10 + number;\n }\n if (ipv4Piece > 255) {\n return failure;\n }\n ++pointer;\n }\n\n address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece;\n\n ++numbersSeen;\n\n if (numbersSeen === 2 || numbersSeen === 4) {\n ++pieceIndex;\n }\n }\n\n if (numbersSeen !== 4) {\n return failure;\n }\n\n break;\n } else if (input[pointer] === p(\":\")) {\n ++pointer;\n if (input[pointer] === undefined) {\n return failure;\n }\n } else if (input[pointer] !== undefined) {\n return failure;\n }\n\n address[pieceIndex] = value;\n ++pieceIndex;\n }\n\n if (compress !== null) {\n let swaps = pieceIndex - compress;\n pieceIndex = 7;\n while (pieceIndex !== 0 && swaps > 0) {\n const temp = address[compress + swaps - 1];\n address[compress + swaps - 1] = address[pieceIndex];\n address[pieceIndex] = temp;\n --pieceIndex;\n --swaps;\n }\n } else if (compress === null && pieceIndex !== 8) {\n return failure;\n }\n\n return address;\n}\n\nfunction serializeIPv6(address) {\n let output = \"\";\n const compress = findTheIPv6AddressCompressedPieceIndex(address);\n let ignore0 = false;\n\n for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) {\n if (ignore0 && address[pieceIndex] === 0) {\n continue;\n } else if (ignore0) {\n ignore0 = false;\n }\n\n if (compress === pieceIndex) {\n const separator = pieceIndex === 0 ? \"::\" : \":\";\n output += separator;\n ignore0 = true;\n continue;\n }\n\n output += address[pieceIndex].toString(16);\n\n if (pieceIndex !== 7) {\n output += \":\";\n }\n }\n\n return output;\n}\n\nfunction parseHost(input, isOpaque = false) {\n if (input[0] === \"[\") {\n if (input[input.length - 1] !== \"]\") {\n return failure;\n }\n\n return parseIPv6(input.substring(1, input.length - 1));\n }\n\n if (isOpaque) {\n return parseOpaqueHost(input);\n }\n\n const domain = utf8DecodeWithoutBOM(percentDecodeString(input));\n const asciiDomain = domainToASCII(domain);\n if (asciiDomain === failure) {\n return failure;\n }\n\n if (endsInANumber(asciiDomain)) {\n return parseIPv4(asciiDomain);\n }\n\n return asciiDomain;\n}\n\nfunction endsInANumber(input) {\n const parts = input.split(\".\");\n if (parts[parts.length - 1] === \"\") {\n if (parts.length === 1) {\n return false;\n }\n parts.pop();\n }\n\n const last = parts[parts.length - 1];\n if (parseIPv4Number(last) !== failure) {\n return true;\n }\n\n if (/^[0-9]+$/u.test(last)) {\n return true;\n }\n\n return false;\n}\n\nfunction parseOpaqueHost(input) {\n if (containsForbiddenHostCodePoint(input)) {\n return failure;\n }\n\n return utf8PercentEncodeString(input, isC0ControlPercentEncode);\n}\n\nfunction findTheIPv6AddressCompressedPieceIndex(address) {\n let longestIndex = null;\n let longestSize = 1; // only find elements > 1\n let foundIndex = null;\n let foundSize = 0;\n\n for (let pieceIndex = 0; pieceIndex < address.length; ++pieceIndex) {\n if (address[pieceIndex] !== 0) {\n if (foundSize > longestSize) {\n longestIndex = foundIndex;\n longestSize = foundSize;\n }\n\n foundIndex = null;\n foundSize = 0;\n } else {\n if (foundIndex === null) {\n foundIndex = pieceIndex;\n }\n ++foundSize;\n }\n }\n\n if (foundSize > longestSize) {\n return foundIndex;\n }\n\n return longestIndex;\n}\n\nfunction serializeHost(host) {\n if (typeof host === \"number\") {\n return serializeIPv4(host);\n }\n\n // IPv6 serializer\n if (host instanceof Array) {\n return `[${serializeIPv6(host)}]`;\n }\n\n return host;\n}\n\nfunction domainToASCII(domain, beStrict = false) {\n const result = tr46.toASCII(domain, {\n checkHyphens: beStrict,\n checkBidi: true,\n checkJoiners: true,\n useSTD3ASCIIRules: beStrict,\n transitionalProcessing: false,\n verifyDNSLength: beStrict,\n ignoreInvalidPunycode: false\n });\n if (result === null) {\n return failure;\n }\n\n if (!beStrict) {\n if (result === \"\") {\n return failure;\n }\n if (containsForbiddenDomainCodePoint(result)) {\n return failure;\n }\n }\n return result;\n}\n\nfunction trimControlChars(string) {\n // Avoid using regexp because of this V8 bug: https://issues.chromium.org/issues/42204424\n\n let start = 0;\n let end = string.length;\n for (; start < end; ++start) {\n if (string.charCodeAt(start) > 0x20) {\n break;\n }\n }\n for (; end > start; --end) {\n if (string.charCodeAt(end - 1) > 0x20) {\n break;\n }\n }\n return string.substring(start, end);\n}\n\nfunction trimTabAndNewline(url) {\n return url.replace(/\\u0009|\\u000A|\\u000D/ug, \"\");\n}\n\nfunction shortenPath(url) {\n const { path } = url;\n if (path.length === 0) {\n return;\n }\n if (url.scheme === \"file\" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) {\n return;\n }\n\n path.pop();\n}\n\nfunction includesCredentials(url) {\n return url.username !== \"\" || url.password !== \"\";\n}\n\nfunction cannotHaveAUsernamePasswordPort(url) {\n return url.host === null || url.host === \"\" || url.scheme === \"file\";\n}\n\nfunction hasAnOpaquePath(url) {\n return typeof url.path === \"string\";\n}\n\nfunction isNormalizedWindowsDriveLetter(string) {\n return /^[A-Za-z]:$/u.test(string);\n}\n\nfunction URLStateMachine(input, base, encodingOverride, url, stateOverride) {\n this.pointer = 0;\n this.input = input;\n this.base = base || null;\n this.encodingOverride = encodingOverride || \"utf-8\";\n this.stateOverride = stateOverride;\n this.url = url;\n this.failure = false;\n this.parseError = false;\n\n if (!this.url) {\n this.url = {\n scheme: \"\",\n username: \"\",\n password: \"\",\n host: null,\n port: null,\n path: [],\n query: null,\n fragment: null\n };\n\n const res = trimControlChars(this.input);\n if (res !== this.input) {\n this.parseError = true;\n }\n this.input = res;\n }\n\n const res = trimTabAndNewline(this.input);\n if (res !== this.input) {\n this.parseError = true;\n }\n this.input = res;\n\n this.state = stateOverride || \"scheme start\";\n\n this.buffer = \"\";\n this.atFlag = false;\n this.arrFlag = false;\n this.passwordTokenSeenFlag = false;\n\n this.input = Array.from(this.input, c => c.codePointAt(0));\n\n for (; this.pointer <= this.input.length; ++this.pointer) {\n const c = this.input[this.pointer];\n const cStr = isNaN(c) ? undefined : String.fromCodePoint(c);\n\n // exec state machine\n const ret = this[`parse ${this.state}`](c, cStr);\n if (!ret) {\n break; // terminate algorithm\n } else if (ret === failure) {\n this.failure = true;\n break;\n }\n }\n}\n\nURLStateMachine.prototype[\"parse scheme start\"] = function parseSchemeStart(c, cStr) {\n if (infra.isASCIIAlpha(c)) {\n this.buffer += cStr.toLowerCase();\n this.state = \"scheme\";\n } else if (!this.stateOverride) {\n this.state = \"no scheme\";\n --this.pointer;\n } else {\n this.parseError = true;\n return failure;\n }\n\n return true;\n};\n\nURLStateMachine.prototype[\"parse scheme\"] = function parseScheme(c, cStr) {\n if (infra.isASCIIAlphanumeric(c) || c === p(\"+\") || c === p(\"-\") || c === p(\".\")) {\n this.buffer += cStr.toLowerCase();\n } else if (c === p(\":\")) {\n if (this.stateOverride) {\n if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) {\n return false;\n }\n\n if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) {\n return false;\n }\n\n if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === \"file\") {\n return false;\n }\n\n if (this.url.scheme === \"file\" && this.url.host === \"\") {\n return false;\n }\n }\n this.url.scheme = this.buffer;\n if (this.stateOverride) {\n if (this.url.port === defaultPort(this.url.scheme)) {\n this.url.port = null;\n }\n return false;\n }\n this.buffer = \"\";\n if (this.url.scheme === \"file\") {\n if (this.input[this.pointer + 1] !== p(\"/\") || this.input[this.pointer + 2] !== p(\"/\")) {\n this.parseError = true;\n }\n this.state = \"file\";\n } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) {\n this.state = \"special relative or authority\";\n } else if (isSpecial(this.url)) {\n this.state = \"special authority slashes\";\n } else if (this.input[this.pointer + 1] === p(\"/\")) {\n this.state = \"path or authority\";\n ++this.pointer;\n } else {\n this.url.path = \"\";\n this.state = \"opaque path\";\n }\n } else if (!this.stateOverride) {\n this.buffer = \"\";\n this.state = \"no scheme\";\n this.pointer = -1;\n } else {\n this.parseError = true;\n return failure;\n }\n\n return true;\n};\n\nURLStateMachine.prototype[\"parse no scheme\"] = function parseNoScheme(c) {\n if (this.base === null || (hasAnOpaquePath(this.base) && c !== p(\"#\"))) {\n return failure;\n } else if (hasAnOpaquePath(this.base) && c === p(\"#\")) {\n this.url.scheme = this.base.scheme;\n this.url.path = this.base.path;\n this.url.query = this.base.query;\n this.url.fragment = \"\";\n this.state = \"fragment\";\n } else if (this.base.scheme === \"file\") {\n this.state = \"file\";\n --this.pointer;\