next
Version:
The React Framework
1,439 lines (1,428 loc) • 363 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
// <define:process>
var env, versions, define_process_default;
var init_define_process = __esm({
"<define:process>"() {
env = {};
versions = { node: "16.6.0" };
define_process_default = { env, versions };
}
});
// ../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/core/symbols.js
var require_symbols = __commonJS({
"../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/core/symbols.js"(exports, module2) {
init_define_process();
module2.exports = {
kClose: Symbol("close"),
kDestroy: Symbol("destroy"),
kDispatch: Symbol("dispatch"),
kUrl: Symbol("url"),
kWriting: Symbol("writing"),
kResuming: Symbol("resuming"),
kQueue: Symbol("queue"),
kConnect: Symbol("connect"),
kConnecting: Symbol("connecting"),
kHeadersList: Symbol("headers list"),
kKeepAliveDefaultTimeout: Symbol("default keep alive timeout"),
kKeepAliveMaxTimeout: Symbol("max keep alive timeout"),
kKeepAliveTimeoutThreshold: Symbol("keep alive timeout threshold"),
kKeepAliveTimeoutValue: Symbol("keep alive timeout"),
kKeepAlive: Symbol("keep alive"),
kHeadersTimeout: Symbol("headers timeout"),
kBodyTimeout: Symbol("body timeout"),
kServerName: Symbol("server name"),
kHost: Symbol("host"),
kNoRef: Symbol("no ref"),
kBodyUsed: Symbol("used"),
kRunning: Symbol("running"),
kBlocking: Symbol("blocking"),
kPending: Symbol("pending"),
kSize: Symbol("size"),
kBusy: Symbol("busy"),
kQueued: Symbol("queued"),
kFree: Symbol("free"),
kConnected: Symbol("connected"),
kClosed: Symbol("closed"),
kNeedDrain: Symbol("need drain"),
kReset: Symbol("reset"),
kDestroyed: Symbol("destroyed"),
kMaxHeadersSize: Symbol("max headers size"),
kRunningIdx: Symbol("running index"),
kPendingIdx: Symbol("pending index"),
kError: Symbol("error"),
kClients: Symbol("clients"),
kClient: Symbol("client"),
kParser: Symbol("parser"),
kOnDestroyed: Symbol("destroy callbacks"),
kPipelining: Symbol("pipelinig"),
kSocket: Symbol("socket"),
kHostHeader: Symbol("host header"),
kConnector: Symbol("connector"),
kStrictContentLength: Symbol("strict content length"),
kMaxRedirections: Symbol("maxRedirections"),
kMaxRequests: Symbol("maxRequestsPerClient"),
kProxy: Symbol("proxy agent options"),
kCounter: Symbol("socket request counter")
};
}
});
// ../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/fetch/symbols.js
var require_symbols2 = __commonJS({
"../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/fetch/symbols.js"(exports, module2) {
"use strict";
init_define_process();
module2.exports = {
kUrl: Symbol("url"),
kHeaders: Symbol("headers"),
kSignal: Symbol("signal"),
kState: Symbol("state"),
kGuard: Symbol("guard"),
kRealm: Symbol("realm")
};
}
});
// src/patches/http.js
var require_http = __commonJS({
"src/patches/http.js"() {
init_define_process();
var http = require_http();
http.validateHeaderName = /* @__PURE__ */ __name(function validateHeaderName(name) {
if (typeof name !== "string" || !name) {
const message = `Header name must be a valid HTTP token ["${name}"]`;
const error = new TypeError(message);
error.code = "ERR_INVALID_HTTP_TOKEN";
throw error;
}
}, "validateHeaderName");
http.validateHeaderValue = /* @__PURE__ */ __name(function validateHeaderValue(value) {
if (value === void 0) {
const message = `Invalid value "${value}" for header "${value}"`;
const error = new TypeError(message);
error.code = "ERR_HTTP_INVALID_HEADER_VALUE";
throw error;
}
}, "validateHeaderValue");
}
});
// ../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/core/errors.js
var require_errors = __commonJS({
"../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/core/errors.js"(exports, module2) {
"use strict";
init_define_process();
var AbortError = class extends Error {
constructor() {
super("The operation was aborted");
this.code = "ABORT_ERR";
this.name = "AbortError";
}
};
__name(AbortError, "AbortError");
var UndiciError = class extends Error {
constructor(message) {
super(message);
this.name = "UndiciError";
this.code = "UND_ERR";
}
};
__name(UndiciError, "UndiciError");
var ConnectTimeoutError = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, ConnectTimeoutError);
this.name = "ConnectTimeoutError";
this.message = message || "Connect Timeout Error";
this.code = "UND_ERR_CONNECT_TIMEOUT";
}
};
__name(ConnectTimeoutError, "ConnectTimeoutError");
var HeadersTimeoutError = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, HeadersTimeoutError);
this.name = "HeadersTimeoutError";
this.message = message || "Headers Timeout Error";
this.code = "UND_ERR_HEADERS_TIMEOUT";
}
};
__name(HeadersTimeoutError, "HeadersTimeoutError");
var HeadersOverflowError = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, HeadersOverflowError);
this.name = "HeadersOverflowError";
this.message = message || "Headers Overflow Error";
this.code = "UND_ERR_HEADERS_OVERFLOW";
}
};
__name(HeadersOverflowError, "HeadersOverflowError");
var BodyTimeoutError = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, BodyTimeoutError);
this.name = "BodyTimeoutError";
this.message = message || "Body Timeout Error";
this.code = "UND_ERR_BODY_TIMEOUT";
}
};
__name(BodyTimeoutError, "BodyTimeoutError");
var ResponseStatusCodeError = class extends UndiciError {
constructor(message, statusCode, headers) {
super(message);
Error.captureStackTrace(this, ResponseStatusCodeError);
this.name = "ResponseStatusCodeError";
this.message = message || "Response Status Code Error";
this.code = "UND_ERR_RESPONSE_STATUS_CODE";
this.status = statusCode;
this.statusCode = statusCode;
this.headers = headers;
}
};
__name(ResponseStatusCodeError, "ResponseStatusCodeError");
var InvalidArgumentError2 = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, InvalidArgumentError2);
this.name = "InvalidArgumentError";
this.message = message || "Invalid Argument Error";
this.code = "UND_ERR_INVALID_ARG";
}
};
__name(InvalidArgumentError2, "InvalidArgumentError");
var InvalidReturnValueError = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, InvalidReturnValueError);
this.name = "InvalidReturnValueError";
this.message = message || "Invalid Return Value Error";
this.code = "UND_ERR_INVALID_RETURN_VALUE";
}
};
__name(InvalidReturnValueError, "InvalidReturnValueError");
var RequestAbortedError = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, RequestAbortedError);
this.name = "AbortError";
this.message = message || "Request aborted";
this.code = "UND_ERR_ABORTED";
}
};
__name(RequestAbortedError, "RequestAbortedError");
var InformationalError = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, InformationalError);
this.name = "InformationalError";
this.message = message || "Request information";
this.code = "UND_ERR_INFO";
}
};
__name(InformationalError, "InformationalError");
var RequestContentLengthMismatchError = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, RequestContentLengthMismatchError);
this.name = "RequestContentLengthMismatchError";
this.message = message || "Request body length does not match content-length header";
this.code = "UND_ERR_REQ_CONTENT_LENGTH_MISMATCH";
}
};
__name(RequestContentLengthMismatchError, "RequestContentLengthMismatchError");
var ResponseContentLengthMismatchError = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, ResponseContentLengthMismatchError);
this.name = "ResponseContentLengthMismatchError";
this.message = message || "Response body length does not match content-length header";
this.code = "UND_ERR_RES_CONTENT_LENGTH_MISMATCH";
}
};
__name(ResponseContentLengthMismatchError, "ResponseContentLengthMismatchError");
var ClientDestroyedError = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, ClientDestroyedError);
this.name = "ClientDestroyedError";
this.message = message || "The client is destroyed";
this.code = "UND_ERR_DESTROYED";
}
};
__name(ClientDestroyedError, "ClientDestroyedError");
var ClientClosedError = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, ClientClosedError);
this.name = "ClientClosedError";
this.message = message || "The client is closed";
this.code = "UND_ERR_CLOSED";
}
};
__name(ClientClosedError, "ClientClosedError");
var SocketError = class extends UndiciError {
constructor(message, socket) {
super(message);
Error.captureStackTrace(this, SocketError);
this.name = "SocketError";
this.message = message || "Socket error";
this.code = "UND_ERR_SOCKET";
this.socket = socket;
}
};
__name(SocketError, "SocketError");
var NotSupportedError = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, NotSupportedError);
this.name = "NotSupportedError";
this.message = message || "Not supported error";
this.code = "UND_ERR_NOT_SUPPORTED";
}
};
__name(NotSupportedError, "NotSupportedError");
var BalancedPoolMissingUpstreamError = class extends UndiciError {
constructor(message) {
super(message);
Error.captureStackTrace(this, NotSupportedError);
this.name = "MissingUpstreamError";
this.message = message || "No upstream has been added to the BalancedPool";
this.code = "UND_ERR_BPL_MISSING_UPSTREAM";
}
};
__name(BalancedPoolMissingUpstreamError, "BalancedPoolMissingUpstreamError");
var HTTPParserError = class extends Error {
constructor(message, code, data) {
super(message);
Error.captureStackTrace(this, HTTPParserError);
this.name = "HTTPParserError";
this.code = code ? `HPE_${code}` : void 0;
this.data = data ? data.toString() : void 0;
}
};
__name(HTTPParserError, "HTTPParserError");
module2.exports = {
AbortError,
HTTPParserError,
UndiciError,
HeadersTimeoutError,
HeadersOverflowError,
BodyTimeoutError,
RequestContentLengthMismatchError,
ConnectTimeoutError,
ResponseStatusCodeError,
InvalidArgumentError: InvalidArgumentError2,
InvalidReturnValueError,
RequestAbortedError,
ClientDestroyedError,
ClientClosedError,
InformationalError,
SocketError,
NotSupportedError,
ResponseContentLengthMismatchError,
BalancedPoolMissingUpstreamError
};
}
});
// src/patches/buffer.js
var require_buffer = __commonJS({
"src/patches/buffer.js"(exports, module2) {
init_define_process();
module2.exports = require_buffer();
module2.exports.Blob = require("./blob").Blob;
}
});
// ../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/core/util.js
var require_util = __commonJS({
"../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/core/util.js"(exports, module2) {
"use strict";
init_define_process();
var assert = require("assert");
var { kDestroyed, kBodyUsed } = require_symbols();
var { IncomingMessage } = require_http();
var stream = require("stream");
var net = require("net");
var { InvalidArgumentError: InvalidArgumentError2 } = require_errors();
var { Blob } = require_buffer();
var nodeUtil = require("util");
function nop() {
}
__name(nop, "nop");
function isStream(obj) {
return obj && typeof obj.pipe === "function";
}
__name(isStream, "isStream");
function isBlobLike(object) {
return Blob && object instanceof Blob || object && typeof object === "object" && (typeof object.stream === "function" || typeof object.arrayBuffer === "function") && /^(Blob|File)$/.test(object[Symbol.toStringTag]);
}
__name(isBlobLike, "isBlobLike");
function isObject(val) {
return val !== null && typeof val === "object";
}
__name(isObject, "isObject");
function encode(val) {
return encodeURIComponent(val);
}
__name(encode, "encode");
function buildURL(url, queryParams) {
if (url.includes("?") || url.includes("#")) {
throw new Error('Query params cannot be passed when url already contains "?" or "#".');
}
if (!isObject(queryParams)) {
throw new Error("Query params must be an object");
}
const parts = [];
for (let [key, val] of Object.entries(queryParams)) {
if (val === null || typeof val === "undefined") {
continue;
}
if (!Array.isArray(val)) {
val = [val];
}
for (const v of val) {
if (isObject(v)) {
throw new Error("Passing object as a query param is not supported, please serialize to string up-front");
}
parts.push(encode(key) + "=" + encode(v));
}
}
const serializedParams = parts.join("&");
if (serializedParams) {
url += "?" + serializedParams;
}
return url;
}
__name(buildURL, "buildURL");
function parseURL(url) {
if (typeof url === "string") {
url = new URL(url);
}
if (!url || typeof url !== "object") {
throw new InvalidArgumentError2("invalid url");
}
if (url.port != null && url.port !== "" && !Number.isFinite(parseInt(url.port))) {
throw new InvalidArgumentError2("invalid port");
}
if (url.path != null && typeof url.path !== "string") {
throw new InvalidArgumentError2("invalid path");
}
if (url.pathname != null && typeof url.pathname !== "string") {
throw new InvalidArgumentError2("invalid pathname");
}
if (url.hostname != null && typeof url.hostname !== "string") {
throw new InvalidArgumentError2("invalid hostname");
}
if (url.origin != null && typeof url.origin !== "string") {
throw new InvalidArgumentError2("invalid origin");
}
if (!/^https?:/.test(url.origin || url.protocol)) {
throw new InvalidArgumentError2("invalid protocol");
}
if (!(url instanceof URL)) {
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
const origin = url.origin != null ? url.origin : `${url.protocol}//${url.hostname}:${port}`;
const path = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
url = new URL(path, origin);
}
return url;
}
__name(parseURL, "parseURL");
function parseOrigin(url) {
url = parseURL(url);
if (url.pathname !== "/" || url.search || url.hash) {
throw new InvalidArgumentError2("invalid url");
}
return url;
}
__name(parseOrigin, "parseOrigin");
function getHostname(host) {
if (host[0] === "[") {
const idx2 = host.indexOf("]");
assert(idx2 !== -1);
return host.substr(1, idx2 - 1);
}
const idx = host.indexOf(":");
if (idx === -1)
return host;
return host.substr(0, idx);
}
__name(getHostname, "getHostname");
function getServerName(host) {
if (!host) {
return null;
}
assert.strictEqual(typeof host, "string");
const servername = getHostname(host);
if (net.isIP(servername)) {
return "";
}
return servername;
}
__name(getServerName, "getServerName");
function deepClone(obj) {
return JSON.parse(JSON.stringify(obj));
}
__name(deepClone, "deepClone");
function isAsyncIterable(obj) {
return !!(obj != null && typeof obj[Symbol.asyncIterator] === "function");
}
__name(isAsyncIterable, "isAsyncIterable");
function isIterable(obj) {
return !!(obj != null && (typeof obj[Symbol.iterator] === "function" || typeof obj[Symbol.asyncIterator] === "function"));
}
__name(isIterable, "isIterable");
function bodyLength(body) {
if (body == null) {
return 0;
} else if (isStream(body)) {
const state = body._readableState;
return state && state.ended === true && Number.isFinite(state.length) ? state.length : null;
} else if (isBlobLike(body)) {
return body.size != null ? body.size : null;
} else if (isBuffer(body)) {
return body.byteLength;
}
return null;
}
__name(bodyLength, "bodyLength");
function isDestroyed(stream2) {
return !stream2 || !!(stream2.destroyed || stream2[kDestroyed]);
}
__name(isDestroyed, "isDestroyed");
function isReadableAborted(stream2) {
const state = stream2 && stream2._readableState;
return isDestroyed(stream2) && state && !state.endEmitted;
}
__name(isReadableAborted, "isReadableAborted");
function destroy(stream2, err) {
if (!isStream(stream2) || isDestroyed(stream2)) {
return;
}
if (typeof stream2.destroy === "function") {
if (Object.getPrototypeOf(stream2).constructor === IncomingMessage) {
stream2.socket = null;
}
stream2.destroy(err);
} else if (err) {
define_process_default.nextTick((stream3, err2) => {
stream3.emit("error", err2);
}, stream2, err);
}
if (stream2.destroyed !== true) {
stream2[kDestroyed] = true;
}
}
__name(destroy, "destroy");
var KEEPALIVE_TIMEOUT_EXPR = /timeout=(\d+)/;
function parseKeepAliveTimeout(val) {
const m = val.toString().match(KEEPALIVE_TIMEOUT_EXPR);
return m ? parseInt(m[1], 10) * 1e3 : null;
}
__name(parseKeepAliveTimeout, "parseKeepAliveTimeout");
function parseHeaders(headers, obj = {}) {
for (let i = 0; i < headers.length; i += 2) {
const key = headers[i].toString().toLowerCase();
let val = obj[key];
if (!val) {
obj[key] = headers[i + 1].toString();
} else {
if (!Array.isArray(val)) {
val = [val];
obj[key] = val;
}
val.push(headers[i + 1].toString());
}
}
return obj;
}
__name(parseHeaders, "parseHeaders");
function parseRawHeaders(headers) {
return headers.map((header) => header.toString());
}
__name(parseRawHeaders, "parseRawHeaders");
function isBuffer(buffer) {
return buffer instanceof Uint8Array || Buffer.isBuffer(buffer);
}
__name(isBuffer, "isBuffer");
function validateHandler(handler, method, upgrade) {
if (!handler || typeof handler !== "object") {
throw new InvalidArgumentError2("handler must be an object");
}
if (typeof handler.onConnect !== "function") {
throw new InvalidArgumentError2("invalid onConnect method");
}
if (typeof handler.onError !== "function") {
throw new InvalidArgumentError2("invalid onError method");
}
if (typeof handler.onBodySent !== "function" && handler.onBodySent !== void 0) {
throw new InvalidArgumentError2("invalid onBodySent method");
}
if (upgrade || method === "CONNECT") {
if (typeof handler.onUpgrade !== "function") {
throw new InvalidArgumentError2("invalid onUpgrade method");
}
} else {
if (typeof handler.onHeaders !== "function") {
throw new InvalidArgumentError2("invalid onHeaders method");
}
if (typeof handler.onData !== "function") {
throw new InvalidArgumentError2("invalid onData method");
}
if (typeof handler.onComplete !== "function") {
throw new InvalidArgumentError2("invalid onComplete method");
}
}
}
__name(validateHandler, "validateHandler");
function isDisturbed(body) {
return !!(body && (stream.isDisturbed ? stream.isDisturbed(body) || body[kBodyUsed] : body[kBodyUsed] || body.readableDidRead || body._readableState && body._readableState.dataEmitted || isReadableAborted(body)));
}
__name(isDisturbed, "isDisturbed");
function isErrored(body) {
return !!(body && (stream.isErrored ? stream.isErrored(body) : /state: 'errored'/.test(nodeUtil.inspect(body))));
}
__name(isErrored, "isErrored");
function isReadable(body) {
return !!(body && (stream.isReadable ? stream.isReadable(body) : /state: 'readable'/.test(nodeUtil.inspect(body))));
}
__name(isReadable, "isReadable");
function getSocketInfo(socket) {
return {
localAddress: socket.localAddress,
localPort: socket.localPort,
remoteAddress: socket.remoteAddress,
remotePort: socket.remotePort,
remoteFamily: socket.remoteFamily,
timeout: socket.timeout,
bytesWritten: socket.bytesWritten,
bytesRead: socket.bytesRead
};
}
__name(getSocketInfo, "getSocketInfo");
var ReadableStream;
function ReadableStreamFrom(iterable) {
if (!ReadableStream) {
ReadableStream = require("./streams").ReadableStream;
}
if (ReadableStream.from) {
return ReadableStream.from(iterable);
}
let iterator;
return new ReadableStream({
async start() {
iterator = iterable[Symbol.asyncIterator]();
},
async pull(controller) {
const { done, value } = await iterator.next();
if (done) {
queueMicrotask(() => {
controller.close();
});
} else {
const buf = Buffer.isBuffer(value) ? value : Buffer.from(value);
controller.enqueue(new Uint8Array(buf));
}
return controller.desiredSize > 0;
},
async cancel(reason) {
await iterator.return();
}
}, 0);
}
__name(ReadableStreamFrom, "ReadableStreamFrom");
function isFormDataLike(chunk) {
return chunk && chunk.constructor && chunk.constructor.name === "FormData";
}
__name(isFormDataLike, "isFormDataLike");
var kEnumerableProperty = /* @__PURE__ */ Object.create(null);
kEnumerableProperty.enumerable = true;
module2.exports = {
kEnumerableProperty,
nop,
isDisturbed,
isErrored,
isReadable,
toUSVString: nodeUtil.toUSVString || ((val) => `${val}`),
isReadableAborted,
isBlobLike,
parseOrigin,
parseURL,
getServerName,
isStream,
isIterable,
isAsyncIterable,
isDestroyed,
parseRawHeaders,
parseHeaders,
parseKeepAliveTimeout,
destroy,
bodyLength,
deepClone,
ReadableStreamFrom,
isBuffer,
validateHandler,
getSocketInfo,
isFormDataLike,
buildURL
};
}
});
// ../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/fetch/constants.js
var require_constants = __commonJS({
"../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/fetch/constants.js"(exports, module2) {
"use strict";
init_define_process();
var corsSafeListedMethods = ["GET", "HEAD", "POST"];
var nullBodyStatus = [101, 204, 205, 304];
var redirectStatus = [301, 302, 303, 307, 308];
var referrerPolicy = [
"",
"no-referrer",
"no-referrer-when-downgrade",
"same-origin",
"origin",
"strict-origin",
"origin-when-cross-origin",
"strict-origin-when-cross-origin",
"unsafe-url"
];
var requestRedirect = ["follow", "manual", "error"];
var safeMethods = ["GET", "HEAD", "OPTIONS", "TRACE"];
var requestMode = ["navigate", "same-origin", "no-cors", "cors"];
var requestCredentials = ["omit", "same-origin", "include"];
var requestCache = [
"default",
"no-store",
"reload",
"no-cache",
"force-cache",
"only-if-cached"
];
var requestBodyHeader = [
"content-encoding",
"content-language",
"content-location",
"content-type"
];
var forbiddenMethods = ["CONNECT", "TRACE", "TRACK"];
var subresource = [
"audio",
"audioworklet",
"font",
"image",
"manifest",
"paintworklet",
"script",
"style",
"track",
"video",
"xslt",
""
];
module2.exports = {
subresource,
forbiddenMethods,
requestBodyHeader,
referrerPolicy,
requestRedirect,
requestMode,
requestCredentials,
requestCache,
redirectStatus,
corsSafeListedMethods,
nullBodyStatus,
safeMethods
};
}
});
// ../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/fetch/file.js
var require_file = __commonJS({
"../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/fetch/file.js"(exports, module2) {
"use strict";
init_define_process();
var { Blob } = require_buffer();
var { kState } = require_symbols2();
var File2 = class extends Blob {
constructor(fileBits, fileName, options = {}) {
var _a2;
const n = fileName;
const t = options.type;
const d = (_a2 = options.lastModified) != null ? _a2 : Date.now();
super(fileBits, { type: t });
this[kState] = {
name: n,
lastModified: d
};
}
get name() {
if (!(this instanceof File2)) {
throw new TypeError("Illegal invocation");
}
return this[kState].name;
}
get lastModified() {
if (!(this instanceof File2)) {
throw new TypeError("Illegal invocation");
}
return this[kState].lastModified;
}
get [Symbol.toStringTag]() {
return this.constructor.name;
}
};
__name(File2, "File");
var FileLike = class {
constructor(blobLike, fileName, options = {}) {
var _a2;
const n = fileName;
const t = options.type;
const d = (_a2 = options.lastModified) != null ? _a2 : Date.now();
this[kState] = {
blobLike,
name: n,
type: t,
lastModified: d
};
}
stream(...args) {
if (!(this instanceof FileLike)) {
throw new TypeError("Illegal invocation");
}
return this[kState].blobLike.stream(...args);
}
arrayBuffer(...args) {
if (!(this instanceof FileLike)) {
throw new TypeError("Illegal invocation");
}
return this[kState].blobLike.arrayBuffer(...args);
}
slice(...args) {
if (!(this instanceof FileLike)) {
throw new TypeError("Illegal invocation");
}
return this[kState].blobLike.slice(...args);
}
text(...args) {
if (!(this instanceof FileLike)) {
throw new TypeError("Illegal invocation");
}
return this[kState].blobLike.text(...args);
}
get size() {
if (!(this instanceof FileLike)) {
throw new TypeError("Illegal invocation");
}
return this[kState].blobLike.size;
}
get type() {
if (!(this instanceof FileLike)) {
throw new TypeError("Illegal invocation");
}
return this[kState].blobLike.type;
}
get name() {
if (!(this instanceof FileLike)) {
throw new TypeError("Illegal invocation");
}
return this[kState].name;
}
get lastModified() {
if (!(this instanceof FileLike)) {
throw new TypeError("Illegal invocation");
}
return this[kState].lastModified;
}
get [Symbol.toStringTag]() {
return "File";
}
};
__name(FileLike, "FileLike");
var _a;
module2.exports = { File: (_a = globalThis.File) != null ? _a : File2, FileLike };
}
});
// ../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/fetch/util.js
var require_util2 = __commonJS({
"../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/fetch/util.js"(exports, module2) {
"use strict";
init_define_process();
var { redirectStatus } = require_constants();
var { performance } = require("perf_hooks");
var { isBlobLike, toUSVString, ReadableStreamFrom } = require_util();
var assert = require("assert");
var File2;
var badPorts = [
"1",
"7",
"9",
"11",
"13",
"15",
"17",
"19",
"20",
"21",
"22",
"23",
"25",
"37",
"42",
"43",
"53",
"69",
"77",
"79",
"87",
"95",
"101",
"102",
"103",
"104",
"109",
"110",
"111",
"113",
"115",
"117",
"119",
"123",
"135",
"137",
"139",
"143",
"161",
"179",
"389",
"427",
"465",
"512",
"513",
"514",
"515",
"526",
"530",
"531",
"532",
"540",
"548",
"554",
"556",
"563",
"587",
"601",
"636",
"989",
"990",
"993",
"995",
"1719",
"1720",
"1723",
"2049",
"3659",
"4045",
"5060",
"5061",
"6000",
"6566",
"6665",
"6666",
"6667",
"6668",
"6669",
"6697",
"10080"
];
function responseURL(response) {
const urlList = response.urlList;
const length = urlList.length;
return length === 0 ? null : urlList[length - 1].toString();
}
__name(responseURL, "responseURL");
function responseLocationURL(response, requestFragment) {
if (!redirectStatus.includes(response.status)) {
return null;
}
let location = response.headersList.get("location");
location = location ? new URL(location, responseURL(response)) : null;
if (location && !location.hash) {
location.hash = requestFragment;
}
return location;
}
__name(responseLocationURL, "responseLocationURL");
function requestCurrentURL(request) {
return request.urlList[request.urlList.length - 1];
}
__name(requestCurrentURL, "requestCurrentURL");
function requestBadPort(request) {
const url = requestCurrentURL(request);
if (/^https?:/.test(url.protocol) && badPorts.includes(url.port)) {
return "blocked";
}
return "allowed";
}
__name(requestBadPort, "requestBadPort");
function isFileLike(object) {
if (!File2) {
File2 = require_file().File;
}
return object instanceof File2 || object && (typeof object.stream === "function" || typeof object.arrayBuffer === "function") && /^(File)$/.test(object[Symbol.toStringTag]);
}
__name(isFileLike, "isFileLike");
function isValidReasonPhrase(statusText) {
for (let i = 0; i < statusText.length; ++i) {
const c = statusText.charCodeAt(i);
if (!(c === 9 || c >= 32 && c <= 126 || c >= 128 && c <= 255)) {
return false;
}
}
return true;
}
__name(isValidReasonPhrase, "isValidReasonPhrase");
function isTokenChar(c) {
return !(c >= 127 || c <= 32 || c === "(" || c === ")" || c === "<" || c === ">" || c === "@" || c === "," || c === ";" || c === ":" || c === "\\" || c === '"' || c === "/" || c === "[" || c === "]" || c === "?" || c === "=" || c === "{" || c === "}");
}
__name(isTokenChar, "isTokenChar");
function isValidHTTPToken(characters) {
if (!characters || typeof characters !== "string") {
return false;
}
for (let i = 0; i < characters.length; ++i) {
const c = characters.charCodeAt(i);
if (c > 127 || !isTokenChar(c)) {
return false;
}
}
return true;
}
__name(isValidHTTPToken, "isValidHTTPToken");
function setRequestReferrerPolicyOnRedirect(request, actualResponse) {
const policy = "";
if (policy !== "") {
request.referrerPolicy = policy;
}
}
__name(setRequestReferrerPolicyOnRedirect, "setRequestReferrerPolicyOnRedirect");
function crossOriginResourcePolicyCheck() {
return "allowed";
}
__name(crossOriginResourcePolicyCheck, "crossOriginResourcePolicyCheck");
function corsCheck() {
return "success";
}
__name(corsCheck, "corsCheck");
function TAOCheck() {
return "success";
}
__name(TAOCheck, "TAOCheck");
function appendFetchMetadata(httpRequest) {
let header = null;
header = httpRequest.mode;
httpRequest.headersList.set("sec-fetch-mode", header);
}
__name(appendFetchMetadata, "appendFetchMetadata");
function appendRequestOriginHeader(request) {
let serializedOrigin = request.origin;
if (request.responseTainting === "cors" || request.mode === "websocket") {
if (serializedOrigin) {
request.headersList.append("Origin", serializedOrigin);
}
} else if (request.method !== "GET" && request.method !== "HEAD") {
switch (request.referrerPolicy) {
case "no-referrer":
serializedOrigin = null;
break;
case "no-referrer-when-downgrade":
case "strict-origin":
case "strict-origin-when-cross-origin":
if (/^https:/.test(request.origin) && !/^https:/.test(requestCurrentURL(request))) {
serializedOrigin = null;
}
break;
case "same-origin":
if (!sameOrigin(request, requestCurrentURL(request))) {
serializedOrigin = null;
}
break;
default:
}
if (serializedOrigin) {
request.headersList.append("Origin", serializedOrigin);
}
}
}
__name(appendRequestOriginHeader, "appendRequestOriginHeader");
function coarsenedSharedCurrentTime(crossOriginIsolatedCapability) {
return performance.now();
}
__name(coarsenedSharedCurrentTime, "coarsenedSharedCurrentTime");
function createOpaqueTimingInfo(timingInfo) {
var _a, _b;
return {
startTime: (_a = timingInfo.startTime) != null ? _a : 0,
redirectStartTime: 0,
redirectEndTime: 0,
postRedirectStartTime: (_b = timingInfo.startTime) != null ? _b : 0,
finalServiceWorkerStartTime: 0,
finalNetworkResponseStartTime: 0,
finalNetworkRequestStartTime: 0,
endTime: 0,
encodedBodySize: 0,
decodedBodySize: 0,
finalConnectionTimingInfo: null
};
}
__name(createOpaqueTimingInfo, "createOpaqueTimingInfo");
function makePolicyContainer() {
return {};
}
__name(makePolicyContainer, "makePolicyContainer");
function clonePolicyContainer() {
return {};
}
__name(clonePolicyContainer, "clonePolicyContainer");
function determineRequestsReferrer(request) {
return "no-referrer";
}
__name(determineRequestsReferrer, "determineRequestsReferrer");
function matchRequestIntegrity(request, bytes) {
return false;
}
__name(matchRequestIntegrity, "matchRequestIntegrity");
function tryUpgradeRequestToAPotentiallyTrustworthyURL(request) {
}
__name(tryUpgradeRequestToAPotentiallyTrustworthyURL, "tryUpgradeRequestToAPotentiallyTrustworthyURL");
function sameOrigin(A, B) {
if (A.protocol === B.protocol && A.hostname === B.hostname && A.port === B.port) {
return true;
}
return false;
}
__name(sameOrigin, "sameOrigin");
function createDeferredPromise() {
let res;
let rej;
const promise = new Promise((resolve, reject) => {
res = resolve;
rej = reject;
});
return { promise, resolve: res, reject: rej };
}
__name(createDeferredPromise, "createDeferredPromise");
function isAborted(fetchParams) {
return fetchParams.controller.state === "aborted";
}
__name(isAborted, "isAborted");
function isCancelled(fetchParams) {
return fetchParams.controller.state === "aborted" || fetchParams.controller.state === "terminated";
}
__name(isCancelled, "isCancelled");
function normalizeMethod(method) {
return /^(DELETE|GET|HEAD|OPTIONS|POST|PUT)$/i.test(method) ? method.toUpperCase() : method;
}
__name(normalizeMethod, "normalizeMethod");
function serializeJavascriptValueToJSONString(value) {
const result = JSON.stringify(value);
if (result === void 0) {
throw new TypeError("Value is not JSON serializable");
}
assert(typeof result === "string");
return result;
}
__name(serializeJavascriptValueToJSONString, "serializeJavascriptValueToJSONString");
var esIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));
function makeIterator(iterator, name) {
const i = {
next() {
if (Object.getPrototypeOf(this) !== i) {
throw new TypeError(`'next' called on an object that does not implement interface ${name} Iterator.`);
}
return iterator.next();
},
[Symbol.toStringTag]: `${name} Iterator`
};
Object.setPrototypeOf(i, esIteratorPrototype);
return Object.setPrototypeOf({}, i);
}
__name(makeIterator, "makeIterator");
module2.exports = {
isAborted,
isCancelled,
createDeferredPromise,
ReadableStreamFrom,
toUSVString,
tryUpgradeRequestToAPotentiallyTrustworthyURL,
coarsenedSharedCurrentTime,
matchRequestIntegrity,
determineRequestsReferrer,
makePolicyContainer,
clonePolicyContainer,
appendFetchMetadata,
appendRequestOriginHeader,
TAOCheck,
corsCheck,
crossOriginResourcePolicyCheck,
createOpaqueTimingInfo,
setRequestReferrerPolicyOnRedirect,
isValidHTTPToken,
requestBadPort,
requestCurrentURL,
responseURL,
responseLocationURL,
isBlobLike,
isFileLike,
isValidReasonPhrase,
sameOrigin,
normalizeMethod,
serializeJavascriptValueToJSONString,
makeIterator
};
}
});
// ../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/fetch/headers.js
var require_headers = __commonJS({
"../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/fetch/headers.js"(exports, module2) {
"use strict";
init_define_process();
var { validateHeaderName, validateHeaderValue } = require_http();
var { kHeadersList: kHeadersList2 } = require_symbols();
var { kGuard: kGuard2 } = require_symbols2();
var { kEnumerableProperty } = require_util();
var { makeIterator } = require_util2();
var kHeadersMap = Symbol("headers map");
var kHeadersSortedMap = Symbol("headers map sorted");
function normalizeAndValidateHeaderName2(name) {
if (name === void 0) {
throw new TypeError(`Header name ${name}`);
}
const normalizedHeaderName = name.toLocaleLowerCase();
validateHeaderName(normalizedHeaderName);
return normalizedHeaderName;
}
__name(normalizeAndValidateHeaderName2, "normalizeAndValidateHeaderName");
function normalizeAndValidateHeaderValue2(name, value) {
if (value === void 0) {
throw new TypeError(value, name);
}
const normalizedHeaderValue = `${value}`.replace(/^[\n\t\r\x20]+|[\n\t\r\x20]+$/g, "");
validateHeaderValue(name, normalizedHeaderValue);
return normalizedHeaderValue;
}
__name(normalizeAndValidateHeaderValue2, "normalizeAndValidateHeaderValue");
function fill(headers, object) {
if (object[Symbol.iterator]) {
for (let header of object) {
if (!header[Symbol.iterator]) {
throw new TypeError();
}
if (typeof header === "string") {
throw new TypeError();
}
if (!Array.isArray(header)) {
header = [...header];
}
if (header.length !== 2) {
throw new TypeError();
}
headers.append(header[0], header[1]);
}
} else if (object && typeof object === "object") {
for (const header of Object.entries(object)) {
headers.append(header[0], header[1]);
}
} else {
throw TypeError();
}
}
__name(fill, "fill");
var HeadersList2 = class {
constructor(init) {
if (init instanceof HeadersList2) {
this[kHeadersMap] = new Map(init[kHeadersMap]);
this[kHeadersSortedMap] = init[kHeadersSortedMap];
} else {
this[kHeadersMap] = new Map(init);
this[kHeadersSortedMap] = null;
}
}
clear() {
this[kHeadersMap].clear();
this[kHeadersSortedMap] = null;
}
append(name, value) {
this[kHeadersSortedMap] = null;
const normalizedName = normalizeAndValidateHeaderName2(name);
const normalizedValue = normalizeAndValidateHeaderValue2(name, value);
const exists = this[kHeadersMap].get(normalizedName);
if (exists) {
this[kHeadersMap].set(normalizedName, `${exists}, ${normalizedValue}`);
} else {
this[kHeadersMap].set(normalizedName, `${normalizedValue}`);
}
}
set(name, value) {
this[kHeadersSortedMap] = null;
const normalizedName = normalizeAndValidateHeaderName2(name);
return this[kHeadersMap].set(normalizedName, value);
}
delete(name) {
this[kHeadersSortedMap] = null;
const normalizedName = normalizeAndValidateHeaderName2(name);
return this[kHeadersMap].delete(normalizedName);
}
get(name) {
var _a;
const normalizedName = normalizeAndValidateHeaderName2(name);
return (_a = this[kHeadersMap].get(normalizedName)) != null ? _a : null;
}
has(name) {
const normalizedName = normalizeAndValidateHeaderName2(name);
return this[kHeadersMap].has(normalizedName);
}
keys() {
return this[kHeadersMap].keys();
}
values() {
return this[kHeadersMap].values();
}
entries() {
return this[kHeadersMap].entries();
}
[Symbol.iterator]() {
return this[kHeadersMap][Symbol.iterator]();
}
};
__name(HeadersList2, "HeadersList");
var Headers3 = class {
constructor(...args) {
var _a;
if (args[0] !== void 0 && !(typeof args[0] === "object" && args[0] != null) && !Array.isArray(args[0])) {
throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(record<ByteString, ByteString> or sequence<sequence<ByteString>>");
}
const init = args.length >= 1 ? (_a = args[0]) != null ? _a : {} : {};
this[kHeadersList2] = new HeadersList2();
this[kGuard2] = "none";
fill(this, init);
}
get [Symbol.toStringTag]() {
return this.constructor.name;
}
append(name, value) {
if (!(this instanceof Headers3)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError(`Failed to execute 'append' on 'Headers': 2 arguments required, but only ${arguments.length} present.`);
}
if (this[kGuard2] === "immutable") {
throw new TypeError("immutable");
} else if (this[kGuard2] === "request-no-cors") {
}
return this[kHeadersList2].append(String(name), String(value));
}
delete(name) {
if (!(this instanceof Headers3)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError(`Failed to execute 'delete' on 'Headers': 1 argument required, but only ${arguments.length} present.`);
}
if (this[kGuard2] === "immutable") {
throw new TypeError("immutable");
} else if (this[kGuard2] === "request-no-cors") {
}
return this[kHeadersList2].delete(String(name));
}
get(name) {
if (!(this instanceof Headers3)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError(`Failed to execute 'get' on 'Headers': 1 argument required, but only ${arguments.length} present.`);
}
return this[kHeadersList2].get(String(name));
}
has(name) {
if (!(this instanceof Headers3)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError(`Failed to execute 'has' on 'Headers': 1 argument required, but only ${arguments.length} present.`);
}
return this[kHeadersList2].has(String(name));
}
set(name, value) {
if (!(this instanceof Headers3)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError(`Failed to execute 'set' on 'Headers': 2 arguments required, but only ${arguments.length} present.`);
}
if (this[kGuard2] === "immutable") {
throw new TypeError("immutable");
} else if (this[kGuard2] === "request-no-cors") {
}
return this[kHeadersList2].set(String(name), String(value));
}
get [kHeadersSortedMap]() {
var _a, _b;
(_b = (_a = this[kHeadersList2])[kHeadersSortedMap]) != null ? _b : _a[kHeadersSortedMap] = new Map([...this[kHeadersList2]].sort((a, b) => a[0] < b[0] ? -1 : 1));
return this[kHeadersList2][kHeadersSor