{"version":3,"file":"index.mjs","sources":["../../../../lib/web/webidl/index.js"],"sourcesContent":["'use strict'\n\nconst assert = require('node:assert')\nconst { types, inspect } = require('node:util')\nconst { markAsUncloneable } = require('node:worker_threads')\n\nconst UNDEFINED = 1\nconst BOOLEAN = 2\nconst STRING = 3\nconst SYMBOL = 4\nconst NUMBER = 5\nconst BIGINT = 6\nconst NULL = 7\nconst OBJECT = 8 // function and object\n\nconst FunctionPrototypeSymbolHasInstance = Function.call.bind(Function.prototype[Symbol.hasInstance])\n\n/** @type {import('../../../types/webidl').Webidl} */\nconst webidl = {\n  converters: {},\n  util: {},\n  errors: {},\n  is: {}\n}\n\n/**\n * @description Instantiate an error.\n *\n * @param {Object} opts\n * @param {string} opts.header\n * @param {string} opts.message\n * @returns {TypeError}\n */\nwebidl.errors.exception = function (message) {\n  return new TypeError(`${message.header}: ${message.message}`)\n}\n\n/**\n * @description Instantiate an error when conversion from one type to another has failed.\n *\n * @param {Object} opts\n * @param {string} opts.prefix\n * @param {string} opts.argument\n * @param {string[]} opts.types\n * @returns {TypeError}\n */\nwebidl.errors.conversionFailed = function (opts) {\n  const plural = opts.types.length === 1 ? '' : ' one of'\n  const message =\n    `${opts.argument} could not be converted to` +\n    `${plural}: ${opts.types.join(', ')}.`\n\n  return webidl.errors.exception({\n    header: opts.prefix,\n    message\n  })\n}\n\n/**\n * @description Instantiate an error when an invalid argument is provided\n *\n * @param {Object} context\n * @param {string} context.prefix\n * @param {string} context.value\n * @param {string} context.type\n * @returns {TypeError}\n */\nwebidl.errors.invalidArgument = function (context) {\n  return webidl.errors.exception({\n    header: context.prefix,\n    message: `\"${context.value}\" is an invalid ${context.type}.`\n  })\n}\n\n// https://webidl.spec.whatwg.org/#implements\nwebidl.brandCheck = function (V, I) {\n  if (!FunctionPrototypeSymbolHasInstance(I, V)) {\n    const err = new TypeError('Illegal invocation')\n    err.code = 'ERR_INVALID_THIS' // node compat.\n    throw err\n  }\n}\n\nwebidl.brandCheckMultiple = function (List) {\n  const prototypes = List.map((c) => webidl.util.MakeTypeAssertion(c))\n\n  return (V) => {\n    if (prototypes.every(typeCheck => !typeCheck(V))) {\n      const err = new TypeError('Illegal invocation')\n      err.code = 'ERR_INVALID_THIS' // node compat.\n      throw err\n    }\n  }\n}\n\nwebidl.argumentLengthCheck = function ({ length }, min, ctx) {\n  if (length < min) {\n    throw webidl.errors.exception({\n      message: `${min} argument${min !== 1 ? 's' : ''} required, ` +\n               `but${length ? ' only' : ''} ${length} found.`,\n      header: ctx\n    })\n  }\n}\n\nwebidl.illegalConstructor = function () {\n  throw webidl.errors.exception({\n    header: 'TypeError',\n    message: 'Illegal constructor'\n  })\n}\n\nwebidl.util.MakeTypeAssertion = function (I) {\n  return (O) => FunctionPrototypeSymbolHasInstance(I, O)\n}\n\n// https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values\nwebidl.util.Type = function (V) {\n  switch (typeof V) {\n    case 'undefined': return UNDEFINED\n    case 'boolean': return BOOLEAN\n    case 'string': return STRING\n    case 'symbol': return SYMBOL\n    case 'number': return NUMBER\n    case 'bigint': return BIGINT\n    case 'function':\n    case 'object': {\n      if (V === null) {\n        return NULL\n      }\n\n      return OBJECT\n    }\n  }\n}\n\nwebidl.util.Types = {\n  UNDEFINED,\n  BOOLEAN,\n  STRING,\n  SYMBOL,\n  NUMBER,\n  BIGINT,\n  NULL,\n  OBJECT\n}\n\nwebidl.util.TypeValueToString = function (o) {\n  switch (webidl.util.Type(o)) {\n    case UNDEFINED: return 'Undefined'\n    case BOOLEAN: return 'Boolean'\n    case STRING: return 'String'\n    case SYMBOL: return 'Symbol'\n    case NUMBER: return 'Number'\n    case BIGINT: return 'BigInt'\n    case NULL: return 'Null'\n    case OBJECT: return 'Object'\n  }\n}\n\nwebidl.util.markAsUncloneable = markAsUncloneable\n\n// https://webidl.spec.whatwg.org/#abstract-opdef-converttoint\nwebidl.util.ConvertToInt = function (V, bitLength, signedness, flags) {\n  let upperBound\n  let lowerBound\n\n  // 1. If bitLength is 64, then:\n  if (bitLength === 64) {\n    // 1. Let upperBound be 2^53 − 1.\n    upperBound = Math.pow(2, 53) - 1\n\n    // 2. If signedness is \"unsigned\", then let lowerBound be 0.\n    if (signedness === 'unsigned') {\n      lowerBound = 0\n    } else {\n      // 3. Otherwise let lowerBound be −2^53 + 1.\n      lowerBound = Math.pow(-2, 53) + 1\n    }\n  } else if (signedness === 'unsigned') {\n    // 2. Otherwise, if signedness is \"unsigned\", then:\n\n    // 1. Let lowerBound be 0.\n    lowerBound = 0\n\n    // 2. Let upperBound be 2^bitLength − 1.\n    upperBound = Math.pow(2, bitLength) - 1\n  } else {\n    // 3. Otherwise:\n\n    // 1. Let lowerBound be -2^(bitLength − 1).\n    lowerBound = -Math.pow(2, bitLength - 1)\n\n    // 2. Let upperBound be 2^(bitLength − 1) − 1.\n    upperBound = Math.pow(2, bitLength - 1) - 1\n  }\n\n  // 4. Let x be ? ToNumber(V).\n  let x = Number(V)\n\n  // 5. If x is −0, then set x to +0.\n  if (x === 0) {\n    x = 0\n  }\n\n  // 6. If the conversion is to an IDL type associated\n  //    with the [EnforceRange] extended attribute, then:\n  if (webidl.util.HasFlag(flags, webidl.attributes.EnforceRange)) {\n    // 1. If x is NaN, +∞, or −∞, then throw a TypeError.\n    if (\n      Number.isNaN(x) ||\n      x === Number.POSITIVE_INFINITY ||\n      x === Number.NEGATIVE_INFINITY\n    ) {\n      throw webidl.errors.exception({\n        header: 'Integer conversion',\n        message: `Could not convert ${webidl.util.Stringify(V)} to an integer.`\n      })\n    }\n\n    // 2. Set x to IntegerPart(x).\n    x = webidl.util.IntegerPart(x)\n\n    // 3. If x < lowerBound or x > upperBound, then\n    //    throw a TypeError.\n    if (x < lowerBound || x > upperBound) {\n      throw webidl.errors.exception({\n        header: 'Integer conversion',\n        message: `Value must be between ${lowerBound}-${upperBound}, got ${x}.`\n      })\n    }\n\n    // 4. Return x.\n    return x\n  }\n\n  // 7. If x is not NaN and the conversion is to an IDL\n  //    type associated with the [Clamp] extended\n  //    attribute, then:\n  if (!Number.isNaN(x) && webidl.util.HasFlag(flags, webidl.attributes.Clamp)) {\n    // 1. Set x to min(max(x, lowerBound), upperBound).\n    x = Math.min(Math.max(x, lowerBound), upperBound)\n\n    // 2. Round x to the nearest integer, choosing the\n    //    even integer if it lies halfway between two,\n    //    and choosing +0 rather than −0.\n    if (Math.floor(x) % 2 === 0) {\n      x = Math.floor(x)\n    } else {\n      x = Math.ceil(x)\n    }\n\n    // 3. Return x.\n    return x\n  }\n\n  // 8. If x is NaN, +0, +∞, or −∞, then return +0.\n  if (\n    Number.isNaN(x) ||\n    (x === 0 && Object.is(0, x)) ||\n    x === Number.POSITIVE_INFINITY ||\n    x === Number.NEGATIVE_INFINITY\n  ) {\n    return 0\n  }\n\n  // 9. Set x to IntegerPart(x).\n  x = webidl.util.IntegerPart(x)\n\n  // 10. Set x to x modulo 2^bitLength.\n  x = x % Math.pow(2, bitLength)\n\n  // 11. If signedness is \"signed\" and x ≥ 2^(bitLength − 1),\n  //    then return x − 2^bitLength.\n  if (signedness === 'signed' && x >= Math.pow(2, bitLength - 1)) {\n    return x - Math.pow(2, bitLength)\n  }\n\n  // 12. Otherwise, return x.\n  return x\n}\n\n// https://webidl.spec.whatwg.org/#abstract-opdef-integerpart\nwebidl.util.IntegerPart = function (n) {\n  // 1. Let r be floor(abs(n)).\n  const r = Math.floor(Math.abs(n))\n\n  // 2. If n < 0, then return -1 × r.\n  if (n < 0) {\n    return -1 * r\n  }\n\n  // 3. Otherwise, return r.\n  return r\n}\n\nwebidl.util.Stringify = function (V) {\n  const type = webidl.util.Type(V)\n\n  switch (type) {\n    case SYMBOL:\n      return `Symbol(${V.description})`\n    case OBJECT:\n      return inspect(V)\n    case STRING:\n      return `\"${V}\"`\n    case BIGINT:\n      return `${V}n`\n    default:\n      return `${V}`\n  }\n}\n\nwebidl.util.IsResizableArrayBuffer = function (V) {\n  if (types.isArrayBuffer(V)) {\n    return V.resizable\n  }\n\n  if (types.isSharedArrayBuffer(V)) {\n    return V.growable\n  }\n\n  throw webidl.errors.exception({\n    header: 'IsResizableArrayBuffer',\n    message: `\"${webidl.util.Stringify(V)}\" is not an array buffer.`\n  })\n}\n\nwebidl.util.HasFlag = function (flags, attributes) {\n  return typeof flags === 'number' && (flags & attributes) === attributes\n}\n\n// https://webidl.spec.whatwg.org/#es-sequence\nwebidl.sequenceConverter = function (converter) {\n  return (V, prefix, argument, Iterable) => {\n    // 1. If Type(V) is not Object, throw a TypeError.\n    if (webidl.util.Type(V) !== OBJECT) {\n      throw webidl.errors.exception({\n        header: prefix,\n        message: `${argument} (${webidl.util.Stringify(V)}) is not iterable.`\n      })\n    }\n\n    // 2. Let method be ? GetMethod(V, @@iterator).\n    /** @type {Generator} */\n    const method = typeof Iterable === 'function' ? Iterable() : V?.[Symbol.iterator]?.()\n    const seq = []\n    let index = 0\n\n    // 3. If method is undefined, throw a TypeError.\n    if (\n      method === undefined ||\n      typeof method.next !== 'function'\n    ) {\n      throw webidl.errors.exception({\n        header: prefix,\n        message: `${argument} is not iterable.`\n      })\n    }\n\n    // https://webidl.spec.whatwg.org/#create-sequence-from-iterable\n    while (true) {\n      const { done, value } = method.next()\n\n      if (done) {\n        break\n      }\n\n      seq.push(converter(value, prefix, `${argument}[${index++}]`))\n    }\n\n    return seq\n  }\n}\n\n// https://webidl.spec.whatwg.org/#es-to-record\nwebidl.recordConverter = function (keyConverter, valueConverter) {\n  return (O, prefix, argument) => {\n    // 1. If Type(O) is not Object, throw a TypeError.\n    if (webidl.util.Type(O) !== OBJECT) {\n      throw webidl.errors.exception({\n        header: prefix,\n        message: `${argument} (\"${webidl.util.TypeValueToString(O)}\") is not an Object.`\n      })\n    }\n\n    // 2. Let result be a new empty instance of record<K, V>.\n    const result = {}\n\n    if (!types.isProxy(O)) {\n      // 1. Let desc be ? O.[[GetOwnProperty]](key).\n      const keys = [...Object.getOwnPropertyNames(O), ...Object.getOwnPropertySymbols(O)]\n\n      for (const key of keys) {\n        const keyName = webidl.util.Stringify(key)\n\n        // 1. Let typedKey be key converted to an IDL value of type K.\n        const typedKey = keyConverter(key, prefix, `Key ${keyName} in ${argument}`)\n\n        // 2. Let value be ? Get(O, key).\n        // 3. Let typedValue be value converted to an IDL value of type V.\n        const typedValue = valueConverter(O[key], prefix, `${argument}[${keyName}]`)\n\n        // 4. Set result[typedKey] to typedValue.\n        result[typedKey] = typedValue\n      }\n\n      // 5. Return result.\n      return result\n    }\n\n    // 3. Let keys be ? O.[[OwnPropertyKeys]]().\n    const keys = Reflect.ownKeys(O)\n\n    // 4. For each key of keys.\n    for (const key of keys) {\n      // 1. Let desc be ? O.[[GetOwnProperty]](key).\n      const desc = Reflect.getOwnPropertyDescriptor(O, key)\n\n      // 2. If desc is not undefined and desc.[[Enumerable]] is true:\n      if (desc?.enumerable) {\n        // 1. Let typedKey be key converted to an IDL value of type K.\n        const typedKey = keyConverter(key, prefix, argument)\n\n        // 2. Let value be ? Get(O, key).\n        // 3. Let typedValue be value converted to an IDL value of type V.\n        const typedValue = valueConverter(O[key], prefix, argument)\n\n        // 4. Set result[typedKey] to typedValue.\n        result[typedKey] = typedValue\n      }\n    }\n\n    // 5. Return result.\n    return result\n  }\n}\n\nwebidl.interfaceConverter = function (TypeCheck, name) {\n  return (V, prefix, argument) => {\n    if (!TypeCheck(V)) {\n      throw webidl.errors.exception({\n        header: prefix,\n        message: `Expected ${argument} (\"${webidl.util.Stringify(V)}\") to be an instance of ${name}.`\n      })\n    }\n\n    return V\n  }\n}\n\nwebidl.dictionaryConverter = function (converters) {\n  // \"For each dictionary member member declared on dictionary, in lexicographical order:\"\n  converters.sort((a, b) => (a.key > b.key) - (a.key < b.key))\n\n  return (dictionary, prefix, argument) => {\n    const dict = {}\n\n    if (dictionary != null && webidl.util.Type(dictionary) !== OBJECT) {\n      throw webidl.errors.exception({\n        header: prefix,\n        message: `Expected ${dictionary} to be one of: Null, Undefined, Object.`\n      })\n    }\n\n    for (const options of converters) {\n      const { key, defaultValue, required, converter } = options\n\n      if (required === true) {\n        if (dictionary == null || !Object.hasOwn(dictionary, key)) {\n          throw webidl.errors.exception({\n            header: prefix,\n            message: `Missing required key \"${key}\".`\n          })\n        }\n      }\n\n      let value = dictionary?.[key]\n      const hasDefault = defaultValue !== undefined\n\n      // Only use defaultValue if value is undefined and\n      // a defaultValue options was provided.\n      if (hasDefault && value === undefined) {\n        value = defaultValue()\n      }\n\n      // A key can be optional and have no default value.\n      // When this happens, do not perform a conversion,\n      // and do not assign the key a value.\n      if (required || hasDefault || value !== undefined) {\n        value = converter(value, prefix, `${argument}.${key}`)\n\n        if (\n          options.allowedValues &&\n          !options.allowedValues.includes(value)\n        ) {\n          throw webidl.errors.exception({\n            header: prefix,\n            message: `${value} is not an accepted type. Expected one of ${options.allowedValues.join(', ')}.`\n          })\n        }\n\n        dict[key] = value\n      }\n    }\n\n    return dict\n  }\n}\n\nwebidl.nullableConverter = function (converter) {\n  return (V, prefix, argument) => {\n    if (V === null) {\n      return V\n    }\n\n    return converter(V, prefix, argument)\n  }\n}\n\n/**\n * @param {*} value\n * @returns {boolean}\n */\nwebidl.is.USVString = function (value) {\n  return (\n    typeof value === 'string' &&\n    value.isWellFormed()\n  )\n}\n\nwebidl.is.ReadableStream = webidl.util.MakeTypeAssertion(ReadableStream)\nwebidl.is.Blob = webidl.util.MakeTypeAssertion(Blob)\nwebidl.is.URLSearchParams = webidl.util.MakeTypeAssertion(URLSearchParams)\nwebidl.is.File = webidl.util.MakeTypeAssertion(File)\nwebidl.is.URL = webidl.util.MakeTypeAssertion(URL)\nwebidl.is.AbortSignal = webidl.util.MakeTypeAssertion(AbortSignal)\nwebidl.is.MessagePort = webidl.util.MakeTypeAssertion(MessagePort)\n\nwebidl.is.BufferSource = function (V) {\n  return types.isArrayBuffer(V) || (\n    ArrayBuffer.isView(V) &&\n    types.isArrayBuffer(V.buffer)\n  )\n}\n\n// https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy\nwebidl.util.getCopyOfBytesHeldByBufferSource = function (bufferSource) {\n  // 1. Let jsBufferSource be the result of converting bufferSource to a JavaScript value.\n  const jsBufferSource = bufferSource\n\n  // 2. Let jsArrayBuffer be jsBufferSource.\n  let jsArrayBuffer = jsBufferSource\n\n  // 3. Let offset be 0.\n  let offset = 0\n\n  // 4. Let length be 0.\n  let length = 0\n\n  // 5. If jsBufferSource has a [[ViewedArrayBuffer]] internal slot, then:\n  if (types.isTypedArray(jsBufferSource) || types.isDataView(jsBufferSource)) {\n    // 5.1. Set jsArrayBuffer to jsBufferSource.[[ViewedArrayBuffer]].\n    jsArrayBuffer = jsBufferSource.buffer\n\n    // 5.2. Set offset to jsBufferSource.[[ByteOffset]].\n    offset = jsBufferSource.byteOffset\n\n    // 5.3. Set length to jsBufferSource.[[ByteLength]].\n    length = jsBufferSource.byteLength\n  } else {\n    // 6. Otherwise:\n\n    // 6.1. Assert: jsBufferSource is an ArrayBuffer or SharedArrayBuffer object.\n    assert(types.isAnyArrayBuffer(jsBufferSource))\n\n    // 6.2. Set length to jsBufferSource.[[ArrayBufferByteLength]].\n    length = jsBufferSource.byteLength\n  }\n\n  // 7. If IsDetachedBuffer(jsArrayBuffer) is true, then return the empty byte sequence.\n  if (jsArrayBuffer.detached) {\n    return new Uint8Array(0)\n  }\n\n  // 8. Let bytes be a new byte sequence of length equal to length.\n  const bytes = new Uint8Array(length)\n\n  // 9. For i in the range offset to offset + length − 1, inclusive,\n  //    set bytes[i − offset] to GetValueFromBuffer(jsArrayBuffer, i, Uint8, true, Unordered).\n  const view = new Uint8Array(jsArrayBuffer, offset, length)\n  bytes.set(view)\n\n  // 10. Return bytes.\n  return bytes\n}\n\n// https://webidl.spec.whatwg.org/#es-DOMString\nwebidl.converters.DOMString = function (V, prefix, argument, flags) {\n  // 1. If V is null and the conversion is to an IDL type\n  //    associated with the [LegacyNullToEmptyString]\n  //    extended attribute, then return the DOMString value\n  //    that represents the empty string.\n  if (V === null && webidl.util.HasFlag(flags, webidl.attributes.LegacyNullToEmptyString)) {\n    return ''\n  }\n\n  // 2. Let x be ? ToString(V).\n  if (typeof V === 'symbol') {\n    throw webidl.errors.exception({\n      header: prefix,\n      message: `${argument} is a symbol, which cannot be converted to a DOMString.`\n    })\n  }\n\n  // 3. Return the IDL DOMString value that represents the\n  //    same sequence of code units as the one the\n  //    ECMAScript String value x represents.\n  return String(V)\n}\n\n// https://webidl.spec.whatwg.org/#es-ByteString\nwebidl.converters.ByteString = function (V, prefix, argument) {\n  // 1. Let x be ? ToString(V).\n  if (typeof V === 'symbol') {\n    throw webidl.errors.exception({\n      header: prefix,\n      message: `${argument} is a symbol, which cannot be converted to a ByteString.`\n    })\n  }\n\n  const x = String(V)\n\n  // 2. If the value of any element of x is greater than\n  //    255, then throw a TypeError.\n  for (let index = 0; index < x.length; index++) {\n    if (x.charCodeAt(index) > 255) {\n      throw new TypeError(\n        'Cannot convert argument to a ByteString because the character at ' +\n        `index ${index} has a value of ${x.charCodeAt(index)} which is greater than 255.`\n      )\n    }\n  }\n\n  // 3. Return an IDL ByteString value whose length is the\n  //    length of x, and where the value of each element is\n  //    the value of the corresponding element of x.\n  return x\n}\n\n/**\n * @param {unknown} value\n * @returns {string}\n * @see https://webidl.spec.whatwg.org/#es-USVString\n */\nwebidl.converters.USVString = function (value) {\n  // TODO: rewrite this so we can control the errors thrown\n  if (typeof value === 'string') {\n    return value.toWellFormed()\n  }\n  return `${value}`.toWellFormed()\n}\n\n// https://webidl.spec.whatwg.org/#es-boolean\nwebidl.converters.boolean = function (V) {\n  // 1. Let x be the result of computing ToBoolean(V).\n  // https://262.ecma-international.org/10.0/index.html#table-10\n  const x = Boolean(V)\n\n  // 2. Return the IDL boolean value that is the one that represents\n  //    the same truth value as the ECMAScript Boolean value x.\n  return x\n}\n\n// https://webidl.spec.whatwg.org/#es-any\nwebidl.converters.any = function (V) {\n  return V\n}\n\n// https://webidl.spec.whatwg.org/#es-long-long\nwebidl.converters['long long'] = function (V, prefix, argument) {\n  // 1. Let x be ? ConvertToInt(V, 64, \"signed\").\n  const x = webidl.util.ConvertToInt(V, 64, 'signed', 0, prefix, argument)\n\n  // 2. Return the IDL long long value that represents\n  //    the same numeric value as x.\n  return x\n}\n\n// https://webidl.spec.whatwg.org/#es-unsigned-long-long\nwebidl.converters['unsigned long long'] = function (V, prefix, argument) {\n  // 1. Let x be ? ConvertToInt(V, 64, \"unsigned\").\n  const x = webidl.util.ConvertToInt(V, 64, 'unsigned', 0, prefix, argument)\n\n  // 2. Return the IDL unsigned long long value that\n  //    represents the same numeric value as x.\n  return x\n}\n\n// https://webidl.spec.whatwg.org/#es-unsigned-long\nwebidl.converters['unsigned long'] = function (V, prefix, argument) {\n  // 1. Let x be ? ConvertToInt(V, 32, \"unsigned\").\n  const x = webidl.util.ConvertToInt(V, 32, 'unsigned', 0, prefix, argument)\n\n  // 2. Return the IDL unsigned long value that\n  //    represents the same numeric value as x.\n  return x\n}\n\n// https://webidl.spec.whatwg.org/#es-unsigned-short\nwebidl.converters['unsigned short'] = function (V, prefix, argument, flags) {\n  // 1. Let x be ? ConvertToInt(V, 16, \"unsigned\").\n  const x = webidl.util.ConvertToInt(V, 16, 'unsigned', flags, prefix, argument)\n\n  // 2. Return the IDL unsigned short value that represents\n  //    the same numeric value as x.\n  return x\n}\n\n// https://webidl.spec.whatwg.org/#idl-ArrayBuffer\nwebidl.converters.ArrayBuffer = function (V, prefix, argument, flags) {\n  // 1. If V is not an Object, or V does not have an\n  //    [[ArrayBufferData]] internal slot, then throw a\n  //    TypeError.\n  // 2. If IsSharedArrayBuffer(V) is true, then throw a\n  //    TypeError.\n  // see: https://tc39.es/ecma262/#sec-properties-of-the-arraybuffer-instances\n  if (\n    webidl.util.Type(V) !== OBJECT ||\n    !types.isArrayBuffer(V)\n  ) {\n    throw webidl.errors.conversionFailed({\n      prefix,\n      argument: `${argument} (\"${webidl.util.Stringify(V)}\")`,\n      types: ['ArrayBuffer']\n    })\n  }\n\n  // 3. If the conversion is not to an IDL type associated\n  //    with the [AllowResizable] extended attribute, and\n  //    IsResizableArrayBuffer(V) is true, then throw a\n  //    TypeError.\n  if (!webidl.util.HasFlag(flags, webidl.attributes.AllowResizable) && webidl.util.IsResizableArrayBuffer(V)) {\n    throw webidl.errors.exception({\n      header: prefix,\n      message: `${argument} cannot be a resizable ArrayBuffer.`\n    })\n  }\n\n  // 4. Return the IDL ArrayBuffer value that is a\n  //    reference to the same object as V.\n  return V\n}\n\n// https://webidl.spec.whatwg.org/#idl-SharedArrayBuffer\nwebidl.converters.SharedArrayBuffer = function (V, prefix, argument, flags) {\n  // 1. If V is not an Object, or V does not have an\n  //    [[ArrayBufferData]] internal slot, then throw a\n  //    TypeError.\n  // 2. If IsSharedArrayBuffer(V) is false, then throw a\n  //    TypeError.\n  // see: https://tc39.es/ecma262/#sec-properties-of-the-sharedarraybuffer-instances\n  if (\n    webidl.util.Type(V) !== OBJECT ||\n    !types.isSharedArrayBuffer(V)\n  ) {\n    throw webidl.errors.conversionFailed({\n      prefix,\n      argument: `${argument} (\"${webidl.util.Stringify(V)}\")`,\n      types: ['SharedArrayBuffer']\n    })\n  }\n\n  // 3. If the conversion is not to an IDL type associated\n  //    with the [AllowResizable] extended attribute, and\n  //    IsResizableArrayBuffer(V) is true, then throw a\n  //    TypeError.\n  if (!webidl.util.HasFlag(flags, webidl.attributes.AllowResizable) && webidl.util.IsResizableArrayBuffer(V)) {\n    throw webidl.errors.exception({\n      header: prefix,\n      message: `${argument} cannot be a resizable SharedArrayBuffer.`\n    })\n  }\n\n  // 4. Return the IDL SharedArrayBuffer value that is a\n  //    reference to the same object as V.\n  return V\n}\n\n// https://webidl.spec.whatwg.org/#dfn-typed-array-type\nwebidl.converters.TypedArray = function (V, T, prefix, argument, flags) {\n  // 1. Let T be the IDL type V is being converted to.\n\n  // 2. If Type(V) is not Object, or V does not have a\n  //    [[TypedArrayName]] internal slot with a value\n  //    equal to T’s name, then throw a TypeError.\n  if (\n    webidl.util.Type(V) !== OBJECT ||\n    !types.isTypedArray(V) ||\n    V.constructor.name !== T.name\n  ) {\n    throw webidl.errors.conversionFailed({\n      prefix,\n      argument: `${argument} (\"${webidl.util.Stringify(V)}\")`,\n      types: [T.name]\n    })\n  }\n\n  // 3. If the conversion is not to an IDL type associated\n  //    with the [AllowShared] extended attribute, and\n  //    IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is\n  //    true, then throw a TypeError.\n  if (!webidl.util.HasFlag(flags, webidl.attributes.AllowShared) && types.isSharedArrayBuffer(V.buffer)) {\n    throw webidl.errors.exception({\n      header: prefix,\n      message: `${argument} cannot be a view on a shared array buffer.`\n    })\n  }\n\n  // 4. If the conversion is not to an IDL type associated\n  //    with the [AllowResizable] extended attribute, and\n  //    IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is\n  //    true, then throw a TypeError.\n  if (!webidl.util.HasFlag(flags, webidl.attributes.AllowResizable) && webidl.util.IsResizableArrayBuffer(V.buffer)) {\n    throw webidl.errors.exception({\n      header: prefix,\n      message: `${argument} cannot be a view on a resizable array buffer.`\n    })\n  }\n\n  // 5. Return the IDL value of type T that is a reference\n  //    to the same object as V.\n  return V\n}\n\n// https://webidl.spec.whatwg.org/#idl-DataView\nwebidl.converters.DataView = function (V, prefix, argument, flags) {\n  // 1. If Type(V) is not Object, or V does not have a\n  //    [[DataView]] internal slot, then throw a TypeError.\n  if (webidl.util.Type(V) !== OBJECT || !types.isDataView(V)) {\n    throw webidl.errors.conversionFailed({\n      prefix,\n      argument: `${argument} (\"${webidl.util.Stringify(V)}\")`,\n      types: ['DataView']\n    })\n  }\n\n  // 2. If the conversion is not to an IDL type associated\n  //    with the [AllowShared] extended attribute, and\n  //    IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is true,\n  //    then throw a TypeError.\n  if (!webidl.util.HasFlag(flags, webidl.attributes.AllowShared) && types.isSharedArrayBuffer(V.buffer)) {\n    throw webidl.errors.exception({\n      header: prefix,\n      message: `${argument} cannot be a view on a shared array buffer.`\n    })\n  }\n\n  // 3. If the conversion is not to an IDL type associated\n  //    with the [AllowResizable] extended attribute, and\n  //    IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is\n  //    true, then throw a TypeError.\n  if (!webidl.util.HasFlag(flags, webidl.attributes.AllowResizable) && webidl.util.IsResizableArrayBuffer(V.buffer)) {\n    throw webidl.errors.exception({\n      header: prefix,\n      message: `${argument} cannot be a view on a resizable array buffer.`\n    })\n  }\n\n  // 4. Return the IDL DataView value that is a reference\n  //    to the same object as V.\n  return V\n}\n\n// https://webidl.spec.whatwg.org/#ArrayBufferView\nwebidl.converters.ArrayBufferView = function (V, prefix, argument, flags) {\n  if (\n    webidl.util.Type(V) !== OBJECT ||\n    !types.isArrayBufferView(V)\n  ) {\n    throw webidl.errors.conversionFailed({\n      prefix,\n      argument: `${argument} (\"${webidl.util.Stringify(V)}\")`,\n      types: ['ArrayBufferView']\n    })\n  }\n\n  if (!webidl.util.HasFlag(flags, webidl.attributes.AllowShared) && types.isSharedArrayBuffer(V.buffer)) {\n    throw webidl.errors.exception({\n      header: prefix,\n      message: `${argument} cannot be a view on a shared array buffer.`\n    })\n  }\n\n  if (!webidl.util.HasFlag(flags, webidl.attributes.AllowResizable) && webidl.util.IsResizableArrayBuffer(V.buffer)) {\n    throw webidl.errors.exception({\n      header: prefix,\n      message: `${argument} cannot be a view on a resizable array buffer.`\n    })\n  }\n\n  return V\n}\n\n// https://webidl.spec.whatwg.org/#BufferSource\nwebidl.converters.BufferSource = function (V, prefix, argument, flags) {\n  if (types.isArrayBuffer(V)) {\n    return webidl.converters.ArrayBuffer(V, prefix, argument, flags)\n  }\n\n  if (types.isArrayBufferView(V)) {\n    flags &= ~webidl.attributes.AllowShared\n\n    return webidl.converters.ArrayBufferView(V, prefix, argument, flags)\n  }\n\n  // Make this explicit for easier debugging\n  if (types.isSharedArrayBuffer(V)) {\n    throw webidl.errors.exception({\n      header: prefix,\n      message: `${argument} cannot be a SharedArrayBuffer.`\n    })\n  }\n\n  throw webidl.errors.conversionFailed({\n    prefix,\n    argument: `${argument} (\"${webidl.util.Stringify(V)}\")`,\n    types: ['ArrayBuffer', 'ArrayBufferView']\n  })\n}\n\n// https://webidl.spec.whatwg.org/#AllowSharedBufferSource\nwebidl.converters.AllowSharedBufferSource = function (V, prefix, argument, flags) {\n  if (types.isArrayBuffer(V)) {\n    return webidl.converters.ArrayBuffer(V, prefix, argument, flags)\n  }\n\n  if (types.isSharedArrayBuffer(V)) {\n    return webidl.converters.SharedArrayBuffer(V, prefix, argument, flags)\n  }\n\n  if (types.isArrayBufferView(V)) {\n    flags |= webidl.attributes.AllowShared\n    return webidl.converters.ArrayBufferView(V, prefix, argument, flags)\n  }\n\n  throw webidl.errors.conversionFailed({\n    prefix,\n    argument: `${argument} (\"${webidl.util.Stringify(V)}\")`,\n    types: ['ArrayBuffer', 'SharedArrayBuffer', 'ArrayBufferView']\n  })\n}\n\nwebidl.converters['sequence<ByteString>'] = webidl.sequenceConverter(\n  webidl.converters.ByteString\n)\n\nwebidl.converters['sequence<sequence<ByteString>>'] = webidl.sequenceConverter(\n  webidl.converters['sequence<ByteString>']\n)\n\nwebidl.converters['record<ByteString, ByteString>'] = webidl.recordConverter(\n  webidl.converters.ByteString,\n  webidl.converters.ByteString\n)\n\nwebidl.converters.Blob = webidl.interfaceConverter(webidl.is.Blob, 'Blob')\n\nwebidl.converters.AbortSignal = webidl.interfaceConverter(\n  webidl.is.AbortSignal,\n  'AbortSignal'\n)\n\n/**\n * [LegacyTreatNonObjectAsNull]\n * callback EventHandlerNonNull = any (Event event);\n * typedef EventHandlerNonNull? EventHandler;\n * @param {*} V\n */\nwebidl.converters.EventHandlerNonNull = function (V) {\n  if (webidl.util.Type(V) !== OBJECT) {\n    return null\n  }\n\n  // [I]f the value is not an object, it will be converted to null, and if the value is not callable,\n  // it will be converted to a callback function value that does nothing when called.\n  if (typeof V === 'function') {\n    return V\n  }\n\n  return () => {}\n}\n\nwebidl.attributes = {\n  Clamp: 1 << 0,\n  EnforceRange: 1 << 1,\n  AllowShared: 1 << 2,\n  AllowResizable: 1 << 3,\n  LegacyNullToEmptyString: 1 << 4\n}\n\nmodule.exports = {\n  webidl\n}\n"],"names":["assert","require$$0","types","inspect","require$$1","markAsUncloneable","require$$2","FunctionPrototypeSymbolHasInstance","Function","call","bind","prototype","Symbol","hasInstance","webidl","converters","util","errors","is","exception","message","TypeError","header","conversionFailed","opts","plural","length","argument","join","prefix","invalidArgument","context","value","type","brandCheck","V","I","err","code","brandCheckMultiple","List","prototypes","map","c","MakeTypeAssertion","every","typeCheck","argumentLengthCheck","min","ctx","illegalConstructor","O","Type","Types","UNDEFINED","BOOLEAN","STRING","SYMBOL","NUMBER","BIGINT","NULL","OBJECT","TypeValueToString","o","ConvertToInt","bitLength","signedness","flags","upperBound","lowerBound","Math","pow","x","Number","HasFlag","attributes","EnforceRange","isNaN","POSITIVE_INFINITY","NEGATIVE_INFINITY","Stringify","IntegerPart","Clamp","max","floor","ceil","Object","n","r","abs","description","IsResizableArrayBuffer","isArrayBuffer","resizable","isSharedArrayBuffer","growable","sequenceConverter","converter","Iterable","method","iterator","seq","index","undefined","next","done","push","recordConverter","keyConverter","valueConverter","result","isProxy","keys","getOwnPropertyNames","getOwnPropertySymbols","key","keyName","typedKey","typedValue","Reflect","ownKeys","desc","getOwnPropertyDescriptor","enumerable","interfaceConverter","TypeCheck","name","dictionaryConverter","sort","a","b","dictionary","dict","options","defaultValue","required","hasOwn","hasDefault","allowedValues","includes","nullableConverter","USVString","isWellFormed","ReadableStream","Blob","URLSearchParams","File","URL","AbortSignal","MessagePort","BufferSource","ArrayBuffer","isView","buffer","getCopyOfBytesHeldByBufferSource","bufferSource","jsBufferSource","jsArrayBuffer","offset","isTypedArray","isDataView","byteOffset","byteLength","isAnyArrayBuffer","detached","Uint8Array","bytes","view","set","DOMString","LegacyNullToEmptyString","String","ByteString","charCodeAt","toWellFormed","boolean","Boolean","any","AllowResizable","SharedArrayBuffer","TypedArray","T","constructor","AllowShared","DataView","ArrayBufferView","isArrayBufferView","All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