{"version":3,"sources":["jsdelivr-header.js","/npm/@discordjs/util@1.2.0/src/index.ts","/npm/@discordjs/util@1.2.0/src/functions/lazy.ts","/npm/@discordjs/util@1.2.0/src/functions/range.ts","/npm/@discordjs/util@1.2.0/src/functions/calculateShardId.ts","/npm/@discordjs/util@1.2.0/src/functions/runtime.ts","/npm/@discordjs/util@1.2.0/src/functions/userAgentAppendix.ts","/npm/@discordjs/util@1.2.0/src/functions/polyfillDispose.ts","/npm/@discordjs/util@1.2.0/src/JSONEncodable.ts","/npm/@discordjs/util@1.2.0/src/Equatable.ts","/npm/@discordjs/util@1.2.0/src/gatewayRateLimitError.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,0mBCNA,cAAA,GCaO,SAAS,KAAY,GAC3B,IAAI,EAEJ,MAAO,IAAO,IAAiB,GAChC,CC2BO,SAAU,MAAM,GACtB,IAAI,EACA,EAAQ,EACR,EAAO,EAEU,iBAAV,EACV,EAAW,GAEX,EAAQ,EAAM,MACd,EAAW,EAAM,IACjB,EAAO,EAAM,MAAQ,GAGtB,QAAS,EAAQ,EAAO,EAAQ,EAAU,GAAS,QAC5C,CAER,CCtDO,SAAS,iBAAiB,EAAiB,GACjD,OAAO,OAAO,OAAO,IAAY,KAAO,CACzC,CCNO,SAAS,mCAEf,YAAkC,IAAvB,WAAW,QACd,UAAW,YAAc,cAAe,WAG5C,aAAc,WAAW,UACrB,SAAU,WAAW,QAAQ,UAAY,QAAS,WAAW,QAAQ,SAI9E,CCRO,SAAS,uBAGf,QAAsC,IAA3B,WAAW,YACrB,MAAO,wBAIR,QAA6B,IAAlB,WAAW,SAA0D,IAA7B,WAAW,cAE7D,MAAO,qBAKR,QAAkC,IAAvB,WAAW,QACrB,MAAO,yBAIR,GAAkC,iBAAvB,WAAW,QAErB,MAAoC,iBAAzB,WAAW,UAEd,WAAW,UAAU,UAGtB,qBAGR,GAAI,aAAc,WAAW,QAAS,CACrC,GAAI,SAAU,WAAW,QAAQ,SAChC,MAAO,QAAQ,WAAW,QAAQ,SAAS,OAG5C,GAAI,QAAS,WAAW,QAAQ,SAC/B,MAAO,OAAO,WAAW,QAAQ,SAAS,MAG3C,GAAI,SAAU,WAAW,QAAQ,SAChC,MAAO,WAAW,WAAW,QAAQ,SAAS,MAEhD,CAEA,MAAO,oBACR,CC7CO,SAAS,kBAKf,OAAO,UAAY,OAAO,kBAE1B,OAAO,eAAiB,OAAO,sBAChC,CCIO,SAAS,gBAAgB,GAC/B,OAA0B,OAAnB,GAAqD,iBAAnB,GAA+B,WAAY,CACrF,CCDO,SAAS,YAAY,GAC3B,OAA0B,OAAnB,GAAqD,iBAAnB,GAA+B,WAAY,CACrF,CRpBA,SAAA,cAAA,CAAA,sBAAA,IAAA,sBAAA,iBAAA,IAAA,iBAAA,qBAAA,IAAA,qBAAA,YAAA,IAAA,YAAA,gBAAA,IAAA,gBAAA,KAAA,IAAA,KAAA,gBAAA,IAAA,gBAAA,MAAA,IAAA,MAAA,iCAAA,IAAA,iCAAA,QAAA,IAAA,UAAA,OAAA,QAAA,aAAA,eCagB,OAAA,KAAA,QC+BC,OAAA,MAAA,SCtCD,OAAA,iBAAA,oBCJA,OAAA,iCAAA,oCCGA,OAAA,qBAAA,wBCAA,OAAA,gBAAA,mBCYA,OAAA,gBAAA,mBCCA,OAAA,YAAA,eCbT,IAAM,sBAAN,MAAM,UAA8B,MAGnC,WAAA,CAIU,EAQA,GAEhB,MAAM,uBAAuB,EAAK,wCAAwC,EAAK,wBAV/D,KAAA,OAQA,KAAA,SAGjB,QAlBgD,OAAA,KAAA,yBACvB,KAAO,EAAsB,MTM1C,QAAU","file":"/npm/@discordjs/util@1.2.0/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@discordjs/util@1.2.0/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","export * from './types.js';\nexport * from './functions/index.js';\nexport * from './JSONEncodable.js';\nexport * from './Equatable.js';\nexport * from './gatewayRateLimitError.js';\n\n/**\n * The {@link https://github.com/discordjs/discord.js/blob/main/packages/util#readme | @discordjs/util} version\n * that you are currently using.\n *\n * @privateRemarks This needs to explicitly be `string` so it is not typed as a \"const string\" that gets injected by esbuild.\n */\nexport const version = '1.2.0' as string;\n","/**\n * Lazy is a wrapper around a value that is computed lazily. It is useful for\n * cases where the value is expensive to compute and the computation may not\n * be needed at all.\n *\n * @param cb - The callback to lazily evaluate\n * @typeParam Value - The type of the value\n * @example\n * ```ts\n * const value = lazy(() => computeExpensiveValue());\n * ```\n */\n// eslint-disable-next-line promise/prefer-await-to-callbacks\nexport function lazy<Value>(cb: () => Value): () => Value {\n\tlet defaultValue: Value;\n\t// eslint-disable-next-line promise/prefer-await-to-callbacks\n\treturn () => (defaultValue ??= cb());\n}\n","/**\n * Options for creating a range\n */\nexport interface RangeOptions {\n\t/**\n\t * The end of the range (exclusive)\n\t */\n\tend: number;\n\t/**\n\t * The start of the range (inclusive)\n\t */\n\tstart: number;\n\t/**\n\t * The amount to increment by\n\t *\n\t * @defaultValue `1`\n\t */\n\tstep?: number;\n}\n\n/**\n * A generator to yield numbers in a given range\n *\n * @remarks\n * This method is end-exclusive, for example the last number yielded by `range(5)` is 4. If you\n * prefer for the end to be included add 1 to the range or `end` option.\n * @param range - A number representing the range to yield (exclusive) or an object with start, end and step\n * @example\n * Basic range\n * ```ts\n * for (const number of range(5)) {\n *  console.log(number);\n * }\n * // Prints 0, 1, 2, 3, 4\n * ```\n * @example\n * Range with a step\n * ```ts\n * for (const number of range({ start: 3, end: 10, step: 2 })) {\n * \tconsole.log(number);\n * }\n * // Prints 3, 5, 7, 9\n * ```\n */\nexport function* range(range: RangeOptions | number) {\n\tlet rangeEnd: number;\n\tlet start = 0;\n\tlet step = 1;\n\n\tif (typeof range === 'number') {\n\t\trangeEnd = range;\n\t} else {\n\t\tstart = range.start;\n\t\trangeEnd = range.end;\n\t\tstep = range.step ?? 1;\n\t}\n\n\tfor (let index = start; index < rangeEnd; index += step) {\n\t\tyield index;\n\t}\n}\n","/**\n * Calculates the shard id for a given guild id.\n *\n * @param guildId - The guild id to calculate the shard id for\n * @param shardCount - The total number of shards\n */\nexport function calculateShardId(guildId: string, shardCount: number) {\n\treturn Number(BigInt(guildId) >> 22n) % shardCount;\n}\n","/* eslint-disable n/prefer-global/process */\n\nexport function shouldUseGlobalFetchAndWebSocket() {\n\t// Browser env and deno when ran directly\n\tif (typeof globalThis.process === 'undefined') {\n\t\treturn 'fetch' in globalThis && 'WebSocket' in globalThis;\n\t}\n\n\tif ('versions' in globalThis.process) {\n\t\treturn 'deno' in globalThis.process.versions || 'bun' in globalThis.process.versions;\n\t}\n\n\treturn false;\n}\n","/* eslint-disable n/prefer-global/process */\n\n/**\n * Resolves the user agent appendix string for the current environment.\n */\nexport function getUserAgentAppendix(): string {\n\t// https://vercel.com/docs/concepts/functions/edge-functions/edge-runtime#check-if-you're-running-on-the-edge-runtime\n\t// @ts-expect-error Vercel Edge functions\n\tif (typeof globalThis.EdgeRuntime !== 'undefined') {\n\t\treturn 'Vercel-Edge-Functions';\n\t}\n\n\t// @ts-expect-error Cloudflare Workers\n\tif (typeof globalThis.R2 !== 'undefined' && typeof globalThis.WebSocketPair !== 'undefined') {\n\t\t// https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent\n\t\treturn 'Cloudflare-Workers';\n\t}\n\n\t// https://docs.netlify.com/edge-functions/api/#netlify-global-object\n\t// @ts-expect-error Netlify Edge functions\n\tif (typeof globalThis.Netlify !== 'undefined') {\n\t\treturn 'Netlify-Edge-Functions';\n\t}\n\n\t// Most (if not all) edge environments will have `process` defined. Within a web browser we'll extract it using `navigator.userAgent`.\n\tif (typeof globalThis.process !== 'object') {\n\t\t// @ts-expect-error web env\n\t\tif (typeof globalThis.navigator === 'object') {\n\t\t\t// @ts-expect-error web env\n\t\t\treturn globalThis.navigator.userAgent;\n\t\t}\n\n\t\treturn 'UnknownEnvironment';\n\t}\n\n\tif ('versions' in globalThis.process) {\n\t\tif ('deno' in globalThis.process.versions) {\n\t\t\treturn `Deno/${globalThis.process.versions.deno}`;\n\t\t}\n\n\t\tif ('bun' in globalThis.process.versions) {\n\t\t\treturn `Bun/${globalThis.process.versions.bun}`;\n\t\t}\n\n\t\tif ('node' in globalThis.process.versions) {\n\t\t\treturn `Node.js/${globalThis.process.versions.node}`;\n\t\t}\n\t}\n\n\treturn 'UnknownEnvironment';\n}\n","/**\n * Polyfill for `Symbol.dispose` and `Symbol.asyncDispose` which is used as a part of\n * {@link https://github.com/tc39/proposal-explicit-resource-management}. Node versions below 18.x\n * don't have these symbols by default, so we need to polyfill them.\n */\nexport function polyfillDispose() {\n\t// Polyfill for `Symbol.dispose` and `Symbol.asyncDispose` if not available.\n\t// Taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management\n\n\t// @ts-expect-error This is a polyfill, so it's fine to write\n\tSymbol.dispose ??= Symbol('Symbol.dispose');\n\t// @ts-expect-error Same as above\n\tSymbol.asyncDispose ??= Symbol('Symbol.asyncDispose');\n}\n","/**\n * Represents an object capable of representing itself as a JSON object\n *\n * @typeParam Value - The JSON type corresponding to {@link JSONEncodable.toJSON} outputs.\n */\nexport interface JSONEncodable<Value> {\n\t/**\n\t * Transforms this object to its JSON format\n\t */\n\ttoJSON(): Value;\n}\n\n/**\n * Indicates if an object is encodable or not.\n *\n * @param maybeEncodable - The object to check against\n */\nexport function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown> {\n\treturn maybeEncodable !== null && typeof maybeEncodable === 'object' && 'toJSON' in maybeEncodable;\n}\n","/**\n * Represents a structure that can be checked against another\n * given structure for equality\n *\n * @typeParam Value - The type of object to compare the current object to\n */\nexport interface Equatable<Value> {\n\t/**\n\t * Whether or not this is equal to another structure\n\t */\n\tequals(other: Value): boolean;\n}\n\n/**\n * Indicates if an object is equatable or not.\n *\n * @param maybeEquatable - The object to check against\n */\nexport function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatable<unknown> {\n\treturn maybeEquatable !== null && typeof maybeEquatable === 'object' && 'equals' in maybeEquatable;\n}\n","import type { GatewayOpcodeRateLimitMetadataMap, GatewayRateLimitedDispatchData } from 'discord-api-types/v10';\n\n/**\n * Represents the error thrown when the gateway emits a `RATE_LIMITED` event after a certain request.\n */\nexport class GatewayRateLimitError extends Error {\n\tpublic override readonly name = GatewayRateLimitError.name;\n\n\tpublic constructor(\n\t\t/**\n\t\t * The data associated with the rate limit event\n\t\t */\n\t\tpublic readonly data: GatewayRateLimitedDispatchData<keyof GatewayOpcodeRateLimitMetadataMap>,\n\t\t/**\n\t\t * The payload data that lead to this rate limit\n\t\t *\n\t\t * @privateRemarks\n\t\t * Too complicated to type properly here (i.e. extract the ['data']\n\t\t * of event payloads that have t = keyof GatewayOpcodeRateLimitMetadataMap)\n\t\t */\n\t\tpublic readonly payload: unknown,\n\t) {\n\t\tsuper(`Request with opcode ${data.opcode} was rate limited. Retry after ${data.retry_after} seconds.`);\n\t}\n}\n"]}