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,WACN,IAAK,WACL,OAAQ","file":"/npm/fetch-headers@3.0.1/headers.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/fetch-headers@3.0.1/headers.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*! fetch-headers. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */\n\n/** @param {Headers} instance */\nfunction assert (instance, argsCount = 0, requiredArgs = 0, method = '') {\n  if (!(instance instanceof Headers)) {\n    throw new TypeError('Illegal invocation')\n  }\n  if (argsCount < requiredArgs) {\n    throw new TypeError(`\"Failed to execute '${method}' on 'Headers'\" requires at least ${requiredArgs} argument, but only ${argsCount} were provided.`)\n  }\n  return /** @type {Bag} */ (wm.get(instance))\n}\n\n/**\n * @typedef Bag\n * @property {Object<string, string>} items\n * @property {Array<string>} cookies\n * @property {string} guard\n */\n\n/**\n * @param {Bag} bag\n * @param {HeadersInit} object\n */\nfunction fillHeaders (bag, object) {\n  if (object === null) throw new TypeError(\"HeadersInit can't be null.\")\n\n  const iterable = object[Symbol.iterator]\n\n  if (iterable) {\n    // @ts-ignore\n    for (let header of object) {\n      if (typeof header === 'string') {\n        throw new TypeError('The provided value cannot be converted to a sequence.')\n      }\n\n      if (header[Symbol.iterator] && !Array.isArray(header)) {\n        header = [...header]\n      }\n\n      if (header.length !== 2) {\n        throw new TypeError(`Invalid header. Length must be 2, but is ${header.length}`)\n      }\n\n      appendHeader(bag, header[0], header[1])\n    }\n  } else {\n    for (const key of Reflect.ownKeys(object)) {\n      const x = Reflect.getOwnPropertyDescriptor(object, key)\n      if (x === undefined || !x.enumerable) continue\n\n      if (typeof key === 'symbol') {\n        throw new TypeError('Invalid header. Symbol key is not supported.')\n      }\n\n      if (!HTTP_TOKEN_CODE_POINT_RE.test(key)) {\n        throw new TypeError('Header name is not valid.')\n      }\n\n      appendHeader(bag, key, Reflect.get(object, key))\n    }\n  }\n}\n\nconst ILLEGAL_VALUE_CHARS = /[\\x00\\x0A\\x0D]/g\nconst IS_BYTE_STRING = /^[\\x00-\\xFF]*$/\nconst HTTP_TOKEN_CODE_POINT_RE = /^[\\u0021\\u0023\\u0024\\u0025\\u0026\\u0027\\u002a\\u002b\\u002d\\u002e\\u005e\\u005f\\u0060\\u007c\\u007e\\u0030-\\u0039\\u0041-\\u005a\\u0061-\\u007a]+$/\nconst HTTP_BETWEEN_WHITESPACE = /^[\\u000a\\u000d\\u0009\\u0020]*(.*?)[\\u000a\\u000d\\u0009\\u0020]*$/\n\n/** @param {string} char */\nfunction isHttpWhitespace (char) {\n  switch (char) {\n    case '\\u0009':\n    case '\\u000A':\n    case '\\u000D':\n    case '\\u0020':\n      return true\n  }\n\n  return false\n}\n\n/** @param {string} s */\nfunction httpTrim (s) {\n  if (!isHttpWhitespace(s[0]) && !isHttpWhitespace(s[s.length - 1])) {\n    return s\n  }\n\n  const match = HTTP_BETWEEN_WHITESPACE.exec(s)\n  return match && match[1]\n}\n\n/**\n * https://fetch.spec.whatwg.org/#concept-headers-append\n * @param {Bag} bag\n * @param {string} name\n * @param {string} value\n */\nfunction appendHeader (bag, name, value) {\n  value = httpTrim(`${value}`) || ''\n\n  if (!HTTP_TOKEN_CODE_POINT_RE.test(name)) {\n    throw new TypeError('Header name is not valid.')\n  }\n\n  if (ILLEGAL_VALUE_CHARS.test(value) || !IS_BYTE_STRING.test(value)) {\n    throw new TypeError(`Header value ${JSON.stringify(value)} is not valid.`)\n  }\n\n  if (bag.guard === 'immutable') {\n    throw new TypeError('Headers are immutable.')\n  }\n\n  name = String(name).toLocaleLowerCase()\n\n  bag.items[name] = name in bag.items ? `${bag.items[name]}, ${value}` : value\n\n  if (name === 'set-cookie') {\n    bag.cookies.push(value)\n  }\n}\n\n/** @param {string} name */\nfunction normalizeName (name) {\n  name = `${name}`.toLowerCase()\n  if (!HTTP_TOKEN_CODE_POINT_RE.test(name)) throw new TypeError('Header name is not valid.')\n  return name\n}\n\n/** @type {WeakMap<Headers, Bag>} */\nconst wm = new WeakMap()\n\nexport class Headers {\n  /** @param {HeadersInit} [init] */\n  constructor (init = undefined) {\n    const bag = {\n      items: Object.create(null),\n      cookies: [],\n      guard: 'mutable'\n    }\n\n    wm.set(this, bag)\n\n    if (init !== undefined) {\n      fillHeaders(bag, init)\n    }\n  }\n\n  append (name, value) {\n    const bag = assert(this, arguments.length, 2, 'append')\n    appendHeader(bag, name, value)\n  }\n\n  delete (name) {\n    const bag = assert(this, arguments.length, 1, 'delete')\n    name = normalizeName(name)\n    delete bag.items[name]\n    if (name === 'set-cookie') bag.cookies.length = 0\n  }\n\n  get (name) {\n    const bag = assert(this, arguments.length, 1, 'get')\n    name = normalizeName(name)\n    return name in bag.items ? bag.items[name] : null\n  }\n\n  has (name) {\n    const bag = assert(this, arguments.length, 1, 'has')\n    return normalizeName(name) in bag.items\n  }\n\n  set (name, value) {\n    const bag = assert(this, arguments.length, 2, 'set')\n    this.delete(name)\n    appendHeader(bag, name, value)\n  }\n\n  forEach (callback, thisArg = globalThis) {\n    const bag = assert(this, arguments.length, 1, 'forEach')\n    if (typeof callback !== 'function') {\n      throw new TypeError(\n        \"Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'.\"\n      )\n    }\n\n    for (const x of this) {\n      callback.call(thisArg, x[1], x[0], this)\n    }\n  }\n\n  toString () {\n    return '[object Headers]'\n  }\n\n  getSetCookie () {\n    const bag = assert(this, 0, 0, '')\n    return bag.cookies.slice(0)\n  }\n\n  keys () {\n    assert(this, 0, 0, '')\n    return [...this].map(x => x[0]).values()\n  }\n\n  values () {\n    assert(this, 0, 0, '')\n    return [...this].map(x => x[1]).values()\n  }\n\n  entries () {\n    const bag = assert(this, 0, 0, '')\n    /** @type {Array<[string, string]>} */\n    const result = []\n\n    const entries = [\n      ...Object.entries(bag.items).sort((a, b) => a[0] > b[0] ? 1 : -1)\n    ]\n\n    for (const [name, value] of entries) {\n      if (name === 'set-cookie') {\n        for (const cookie of bag.cookies) {\n          result.push([name, cookie])\n        }\n      } else result.push([name, value])\n    }\n\n    return result.values()\n  }\n\n  [Symbol.iterator] () {\n    return this.entries()\n  }\n\n  [Symbol.for('nodejs.util.inspect.custom')] () {\n    const bag = assert(this, 0, 0, '')\n    class Headers extends URLSearchParams { }\n    return new Headers(bag.items)\n  }\n}\n\nexport const bag = wm\n\nconst enumerable = { enumerable: true }\n\nObject.defineProperties(Headers.prototype, {\n  append: enumerable,\n  delete: enumerable,\n  entries: enumerable,\n  forEach: enumerable,\n  get: enumerable,\n  getSetCookie: enumerable,\n  has: enumerable,\n  keys: enumerable,\n  set: enumerable,\n  values: enumerable\n})\n"]}