npm-check-updates
Version:
Find newer versions of dependencies than what your package.json allows
1,355 lines • 445 kB
JavaScript
import { a as e, i as t, n, o as r, r as i, t as a } from "./rolldown-runtime-CJfroGDQ.js";
import { l as o, p as s, u as c } from "../index.js";
import { once as l } from "events";
import { URL as u } from "url";
import d from "assert";
import * as f from "http";
import * as p from "https";
import { Agent as m } from "https";
import * as h from "dns";
import * as g from "net";
import * as _ from "tls";
//#region node_modules/npm-registry-fetch/lib/errors.js
var v = /* @__PURE__ */ a(((e, n) => {
var { URL: r } = t("node:url");
function i(e) {
try {
let n = new r(e).pathname.slice(1);
if (!n.match(/^-/)) {
n = n.split("/");
var t = n.indexOf("_rewrite");
return t === -1 ? t = n.length - 1 : t++, decodeURIComponent(n[t]);
}
} catch {}
}
var a = class extends Error {
constructor(e, t, n, r) {
super(), this.name = this.constructor.name, this.headers = typeof t.headers?.raw == "function" ? t.headers.raw() : t.headers, this.statusCode = t.status, this.code = `E${t.status}`, this.method = e, this.uri = t.url, this.body = n, this.pkgid = r ? r.toString() : i(t.url), Error.captureStackTrace(this, this.constructor);
}
};
n.exports = {
HttpErrorBase: a,
HttpErrorGeneral: class extends a {
constructor(e, t, n, r) {
super(e, t, n, r);
let i = "";
if (n && typeof n == "object" && !Buffer.isBuffer(n)) {
let e = n.error || n.message || JSON.stringify(n);
e && e !== "{}" && (i = " - " + e);
}
this.message = `${t.status} ${t.statusText} - ${this.method.toUpperCase()} ${this.spec || this.uri}${i}`;
}
},
HttpErrorAuthOTP: class extends a {
constructor(e, t, n, r) {
super(e, t, n, r), this.message = "OTP required for authentication", this.code = "EOTP";
}
},
HttpErrorAuthIPAddress: class extends a {
constructor(e, t, n, r) {
super(e, t, n, r), this.message = "Login is not allowed from your IP address", this.code = "EAUTHIP";
}
},
HttpErrorAuthUnknown: class extends a {
constructor(e, t, n, r) {
super(e, t, n, r), this.message = "Unable to authenticate, need: " + t.headers.get("www-authenticate");
}
}
};
})), y = /* @__PURE__ */ a(((e) => {
var n = e && e.__importDefault || function(e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(e, "__esModule", { value: !0 }), e.Minipass = e.isWritable = e.isReadable = e.isStream = void 0;
var r = typeof process == "object" && process ? process : {
stdout: null,
stderr: null
}, i = t("node:events"), a = n(t("node:stream")), o = t("node:string_decoder");
e.isStream = (t) => !!t && typeof t == "object" && (t instanceof q || t instanceof a.default || (0, e.isReadable)(t) || (0, e.isWritable)(t)), e.isReadable = (e) => !!e && typeof e == "object" && e instanceof i.EventEmitter && typeof e.pipe == "function" && e.pipe !== a.default.Writable.prototype.pipe, e.isWritable = (e) => !!e && typeof e == "object" && e instanceof i.EventEmitter && typeof e.write == "function" && typeof e.end == "function";
var s = Symbol("EOF"), c = Symbol("maybeEmitEnd"), l = Symbol("emittedEnd"), u = Symbol("emittingEnd"), d = Symbol("emittedError"), f = Symbol("closed"), p = Symbol("read"), m = Symbol("flush"), h = Symbol("flushChunk"), g = Symbol("encoding"), _ = Symbol("decoder"), v = Symbol("flowing"), y = Symbol("paused"), b = Symbol("resume"), x = Symbol("buffer"), S = Symbol("pipes"), C = Symbol("bufferLength"), w = Symbol("bufferPush"), T = Symbol("bufferShift"), E = Symbol("objectMode"), D = Symbol("destroyed"), O = Symbol("error"), k = Symbol("emitData"), A = Symbol("emitEnd"), j = Symbol("emitEnd2"), M = Symbol("async"), N = Symbol("abort"), P = Symbol("aborted"), F = Symbol("signal"), I = Symbol("dataListeners"), L = Symbol("discarded"), R = (e) => Promise.resolve().then(e), z = (e) => e(), B = (e) => e === "end" || e === "finish" || e === "prefinish", V = (e) => e instanceof ArrayBuffer || !!e && typeof e == "object" && e.constructor && e.constructor.name === "ArrayBuffer" && e.byteLength >= 0, H = (e) => !Buffer.isBuffer(e) && ArrayBuffer.isView(e), U = class {
src;
dest;
opts;
ondrain;
constructor(e, t, n) {
this.src = e, this.dest = t, this.opts = n, this.ondrain = () => e[b](), this.dest.on("drain", this.ondrain);
}
unpipe() {
this.dest.removeListener("drain", this.ondrain);
}
/* c8 ignore start */
proxyErrors(e) {}
/* c8 ignore stop */
end() {
this.unpipe(), this.opts.end && this.dest.end();
}
}, W = class extends U {
unpipe() {
this.src.removeListener("error", this.proxyErrors), super.unpipe();
}
constructor(e, t, n) {
super(e, t, n), this.proxyErrors = (e) => this.dest.emit("error", e), e.on("error", this.proxyErrors);
}
}, G = (e) => !!e.objectMode, K = (e) => !e.objectMode && !!e.encoding && e.encoding !== "buffer", q = class extends i.EventEmitter {
[v] = !1;
[y] = !1;
[S] = [];
[x] = [];
[E];
[g];
[M];
[_];
[s] = !1;
[l] = !1;
[u] = !1;
[f] = !1;
[d] = null;
[C] = 0;
[D] = !1;
[F];
[P] = !1;
[I] = 0;
[L] = !1;
writable = !0;
readable = !0;
constructor(...e) {
let t = e[0] || {};
if (super(), t.objectMode && typeof t.encoding == "string") throw TypeError("Encoding and objectMode may not be used together");
G(t) ? (this[E] = !0, this[g] = null) : K(t) ? (this[g] = t.encoding, this[E] = !1) : (this[E] = !1, this[g] = null), this[M] = !!t.async, this[_] = this[g] ? new o.StringDecoder(this[g]) : null, t && t.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[x] }), t && t.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[S] });
let { signal: n } = t;
n && (this[F] = n, n.aborted ? this[N]() : n.addEventListener("abort", () => this[N]()));
}
get bufferLength() {
return this[C];
}
get encoding() {
return this[g];
}
set encoding(e) {
throw Error("Encoding must be set at instantiation time");
}
setEncoding(e) {
throw Error("Encoding must be set at instantiation time");
}
get objectMode() {
return this[E];
}
set objectMode(e) {
throw Error("objectMode must be set at instantiation time");
}
get async() {
return this[M];
}
set async(e) {
this[M] = this[M] || !!e;
}
[N]() {
this[P] = !0, this.emit("abort", this[F]?.reason), this.destroy(this[F]?.reason);
}
get aborted() {
return this[P];
}
set aborted(e) {}
write(e, t, n) {
if (this[P]) return !1;
if (this[s]) throw Error("write after end");
if (this[D]) return this.emit("error", Object.assign(/* @__PURE__ */ Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), !0;
typeof t == "function" && (n = t, t = "utf8"), t ||= "utf8";
let r = this[M] ? R : z;
if (!this[E] && !Buffer.isBuffer(e)) {
if (H(e)) e = Buffer.from(e.buffer, e.byteOffset, e.byteLength);
else if (V(e)) e = Buffer.from(e);
else if (typeof e != "string") throw Error("Non-contiguous data written to non-objectMode stream");
}
return this[E] ?
/* c8 ignore start */
(this[v] && this[C] !== 0 && this[m](!0), this[v] ? this.emit("data", e) : this[w](e), this[C] !== 0 && this.emit("readable"), n && r(n), this[v]) : e.length ? (typeof e == "string" && !(t === this[g] && !this[_]?.lastNeed) && (e = Buffer.from(e, t)), Buffer.isBuffer(e) && this[g] && (e = this[_].write(e)), this[v] && this[C] !== 0 && this[m](!0), this[v] ? this.emit("data", e) : this[w](e), this[C] !== 0 && this.emit("readable"), n && r(n), this[v]) : (this[C] !== 0 && this.emit("readable"), n && r(n), this[v]);
}
read(e) {
if (this[D]) return null;
if (this[L] = !1, this[C] === 0 || e === 0 || e && e > this[C]) return this[c](), null;
this[E] && (e = null), this[x].length > 1 && !this[E] && (this[x] = [this[g] ? this[x].join("") : Buffer.concat(this[x], this[C])]);
let t = this[p](e || null, this[x][0]);
return this[c](), t;
}
[p](e, t) {
if (this[E]) this[T]();
else {
let n = t;
e === n.length || e === null ? this[T]() : typeof n == "string" ? (this[x][0] = n.slice(e), t = n.slice(0, e), this[C] -= e) : (this[x][0] = n.subarray(e), t = n.subarray(0, e), this[C] -= e);
}
return this.emit("data", t), !this[x].length && !this[s] && this.emit("drain"), t;
}
end(e, t, n) {
return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = "utf8"), e !== void 0 && this.write(e, t), n && this.once("end", n), this[s] = !0, this.writable = !1, (this[v] || !this[y]) && this[c](), this;
}
[b]() {
this[D] || (!this[I] && !this[S].length && (this[L] = !0), this[y] = !1, this[v] = !0, this.emit("resume"), this[x].length ? this[m]() : this[s] ? this[c]() : this.emit("drain"));
}
resume() {
return this[b]();
}
pause() {
this[v] = !1, this[y] = !0, this[L] = !1;
}
get destroyed() {
return this[D];
}
get flowing() {
return this[v];
}
get paused() {
return this[y];
}
[w](e) {
this[E] ? this[C] += 1 : this[C] += e.length, this[x].push(e);
}
[T]() {
return this[E] ? --this[C] : this[C] -= this[x][0].length, this[x].shift();
}
[m](e = !1) {
do ;
while (this[h](this[T]()) && this[x].length);
!e && !this[x].length && !this[s] && this.emit("drain");
}
[h](e) {
return this.emit("data", e), this[v];
}
pipe(e, t) {
if (this[D]) return e;
this[L] = !1;
let n = this[l];
return t ||= {}, e === r.stdout || e === r.stderr ? t.end = !1 : t.end = t.end !== !1, t.proxyErrors = !!t.proxyErrors, n ? t.end && e.end() : (this[S].push(t.proxyErrors ? new W(this, e, t) : new U(this, e, t)), this[M] ? R(() => this[b]()) : this[b]()), e;
}
unpipe(e) {
let t = this[S].find((t) => t.dest === e);
t && (this[S].length === 1 ? (this[v] && this[I] === 0 && (this[v] = !1), this[S] = []) : this[S].splice(this[S].indexOf(t), 1), t.unpipe());
}
addListener(e, t) {
return this.on(e, t);
}
on(e, t) {
let n = super.on(e, t);
if (e === "data") this[L] = !1, this[I]++, !this[S].length && !this[v] && this[b]();
else if (e === "readable" && this[C] !== 0) super.emit("readable");
else if (B(e) && this[l]) super.emit(e), this.removeAllListeners(e);
else if (e === "error" && this[d]) {
let e = t;
this[M] ? R(() => e.call(this, this[d])) : e.call(this, this[d]);
}
return n;
}
removeListener(e, t) {
return this.off(e, t);
}
off(e, t) {
let n = super.off(e, t);
return e === "data" && (this[I] = this.listeners("data").length, this[I] === 0 && !this[L] && !this[S].length && (this[v] = !1)), n;
}
removeAllListeners(e) {
let t = super.removeAllListeners(e);
return (e === "data" || e === void 0) && (this[I] = 0, !this[L] && !this[S].length && (this[v] = !1)), t;
}
get emittedEnd() {
return this[l];
}
[c]() {
!this[u] && !this[l] && !this[D] && this[x].length === 0 && this[s] && (this[u] = !0, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[f] && this.emit("close"), this[u] = !1);
}
emit(e, ...t) {
let n = t[0];
if (e !== "error" && e !== "close" && e !== D && this[D]) return !1;
if (e === "data") return !this[E] && !n ? !1 : this[M] ? (R(() => this[k](n)), !0) : this[k](n);
if (e === "end") return this[A]();
if (e === "close") {
if (this[f] = !0, !this[l] && !this[D]) return !1;
let e = super.emit("close");
return this.removeAllListeners("close"), e;
}
if (e === "error") {
this[d] = n, super.emit(O, n);
let e = !this[F] || this.listeners("error").length ? super.emit("error", n) : !1;
return this[c](), e;
}
if (e === "resume") {
let e = super.emit("resume");
return this[c](), e;
}
if (e === "finish" || e === "prefinish") {
let t = super.emit(e);
return this.removeAllListeners(e), t;
}
let r = super.emit(e, ...t);
return this[c](), r;
}
[k](e) {
for (let t of this[S]) t.dest.write(e) === !1 && this.pause();
let t = !this[L] && super.emit("data", e);
return this[c](), t;
}
[A]() {
return !this[l] && (this[l] = !0, this.readable = !1, this[M] ? (R(() => this[j]()), !0) : this[j]());
}
[j]() {
if (this[_]) {
let e = this[_].end();
if (e) {
for (let t of this[S]) t.dest.write(e);
this[L] || super.emit("data", e);
}
}
for (let e of this[S]) e.end();
let e = super.emit("end");
return this.removeAllListeners("end"), e;
}
async collect() {
let e = Object.assign([], { dataLength: 0 });
this[E] || (e.dataLength = 0);
let t = this.promise();
return this.on("data", (t) => {
e.push(t), this[E] || (e.dataLength += t.length);
}), await t, e;
}
async concat() {
if (this[E]) throw Error("cannot concat in objectMode");
let e = await this.collect();
return this[g] ? e.join("") : Buffer.concat(e, e.dataLength);
}
async promise() {
return new Promise((e, t) => {
this.on(D, () => t(/* @__PURE__ */ Error("stream destroyed"))), this.on("error", (e) => t(e)), this.on("end", () => e());
});
}
[Symbol.asyncIterator]() {
this[L] = !1;
let e = !1, t = async () => (this.pause(), e = !0, {
value: void 0,
done: !0
});
return {
next: () => {
if (e) return t();
let n = this.read();
if (n !== null) return Promise.resolve({
done: !1,
value: n
});
if (this[s]) return t();
let r, i, a = (e) => {
this.off("data", o), this.off("end", c), this.off(D, l), t(), i(e);
}, o = (e) => {
this.off("error", a), this.off("end", c), this.off(D, l), this.pause(), r({
value: e,
done: !!this[s]
});
}, c = () => {
this.off("error", a), this.off("data", o), this.off(D, l), t(), r({
done: !0,
value: void 0
});
}, l = () => a(/* @__PURE__ */ Error("stream destroyed"));
return new Promise((e, t) => {
i = t, r = e, this.once(D, l), this.once("error", a), this.once("end", c), this.once("data", o);
});
},
throw: t,
return: t,
[Symbol.asyncIterator]() {
return this;
},
[Symbol.asyncDispose]: async () => {}
};
}
[Symbol.iterator]() {
this[L] = !1;
let e = !1, t = () => (this.pause(), this.off(O, t), this.off(D, t), this.off("end", t), e = !0, {
done: !0,
value: void 0
});
return this.once("end", t), this.once(O, t), this.once(D, t), {
next: () => {
if (e) return t();
let n = this.read();
return n === null ? t() : {
done: !1,
value: n
};
},
throw: t,
return: t,
[Symbol.iterator]() {
return this;
},
[Symbol.dispose]: () => {}
};
}
destroy(e) {
if (this[D]) return e ? this.emit("error", e) : this.emit(D), this;
this[D] = !0, this[L] = !0, this[x].length = 0, this[C] = 0;
let t = this;
return typeof t.close == "function" && !this[f] && t.close(), e ? this.emit("error", e) : this.emit(D), this;
}
static get isStream() {
return e.isStream;
}
};
e.Minipass = q;
})), b = /* @__PURE__ */ a(((e) => {
var n = e && e.__importDefault || function(e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(e, "__esModule", { value: !0 }), e.constants = void 0;
/* c8 ignore start */
var r = n(t("zlib")).default.constants || { ZLIB_VERNUM: 4736 };
/* c8 ignore stop */
e.constants = Object.freeze(Object.assign(Object.create(null), {
Z_NO_FLUSH: 0,
Z_PARTIAL_FLUSH: 1,
Z_SYNC_FLUSH: 2,
Z_FULL_FLUSH: 3,
Z_FINISH: 4,
Z_BLOCK: 5,
Z_OK: 0,
Z_STREAM_END: 1,
Z_NEED_DICT: 2,
Z_ERRNO: -1,
Z_STREAM_ERROR: -2,
Z_DATA_ERROR: -3,
Z_MEM_ERROR: -4,
Z_BUF_ERROR: -5,
Z_VERSION_ERROR: -6,
Z_NO_COMPRESSION: 0,
Z_BEST_SPEED: 1,
Z_BEST_COMPRESSION: 9,
Z_DEFAULT_COMPRESSION: -1,
Z_FILTERED: 1,
Z_HUFFMAN_ONLY: 2,
Z_RLE: 3,
Z_FIXED: 4,
Z_DEFAULT_STRATEGY: 0,
DEFLATE: 1,
INFLATE: 2,
GZIP: 3,
GUNZIP: 4,
DEFLATERAW: 5,
INFLATERAW: 6,
UNZIP: 7,
BROTLI_DECODE: 8,
BROTLI_ENCODE: 9,
Z_MIN_WINDOWBITS: 8,
Z_MAX_WINDOWBITS: 15,
Z_DEFAULT_WINDOWBITS: 15,
Z_MIN_CHUNK: 64,
Z_MAX_CHUNK: Infinity,
Z_DEFAULT_CHUNK: 16384,
Z_MIN_MEMLEVEL: 1,
Z_MAX_MEMLEVEL: 9,
Z_DEFAULT_MEMLEVEL: 8,
Z_MIN_LEVEL: -1,
Z_MAX_LEVEL: 9,
Z_DEFAULT_LEVEL: -1,
BROTLI_OPERATION_PROCESS: 0,
BROTLI_OPERATION_FLUSH: 1,
BROTLI_OPERATION_FINISH: 2,
BROTLI_OPERATION_EMIT_METADATA: 3,
BROTLI_MODE_GENERIC: 0,
BROTLI_MODE_TEXT: 1,
BROTLI_MODE_FONT: 2,
BROTLI_DEFAULT_MODE: 0,
BROTLI_MIN_QUALITY: 0,
BROTLI_MAX_QUALITY: 11,
BROTLI_DEFAULT_QUALITY: 11,
BROTLI_MIN_WINDOW_BITS: 10,
BROTLI_MAX_WINDOW_BITS: 24,
BROTLI_LARGE_MAX_WINDOW_BITS: 30,
BROTLI_DEFAULT_WINDOW: 22,
BROTLI_MIN_INPUT_BLOCK_BITS: 16,
BROTLI_MAX_INPUT_BLOCK_BITS: 24,
BROTLI_PARAM_MODE: 0,
BROTLI_PARAM_QUALITY: 1,
BROTLI_PARAM_LGWIN: 2,
BROTLI_PARAM_LGBLOCK: 3,
BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
BROTLI_PARAM_SIZE_HINT: 5,
BROTLI_PARAM_LARGE_WINDOW: 6,
BROTLI_PARAM_NPOSTFIX: 7,
BROTLI_PARAM_NDIRECT: 8,
BROTLI_DECODER_RESULT_ERROR: 0,
BROTLI_DECODER_RESULT_SUCCESS: 1,
BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
BROTLI_DECODER_NO_ERROR: 0,
BROTLI_DECODER_SUCCESS: 1,
BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
BROTLI_DECODER_ERROR_UNREACHABLE: -31
}, r));
})), x = /* @__PURE__ */ a(((e) => {
var n = e && e.__createBinding || (Object.create ? (function(e, t, n, r) {
r === void 0 && (r = n);
var i = Object.getOwnPropertyDescriptor(t, n);
(!i || ("get" in i ? !t.__esModule : i.writable || i.configurable)) && (i = {
enumerable: !0,
get: function() {
return t[n];
}
}), Object.defineProperty(e, r, i);
}) : (function(e, t, n, r) {
r === void 0 && (r = n), e[r] = t[n];
})), r = e && e.__setModuleDefault || (Object.create ? (function(e, t) {
Object.defineProperty(e, "default", {
enumerable: !0,
value: t
});
}) : function(e, t) {
e.default = t;
}), i = e && e.__importStar || (function() {
var e = function(t) {
return e = Object.getOwnPropertyNames || function(e) {
var t = [];
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[t.length] = n);
return t;
}, e(t);
};
return function(t) {
if (t && t.__esModule) return t;
var i = {};
if (t != null) for (var a = e(t), o = 0; o < a.length; o++) a[o] !== "default" && n(i, t, a[o]);
return r(i, t), i;
};
})(), a = e && e.__importDefault || function(e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(e, "__esModule", { value: !0 }), e.ZstdDecompress = e.ZstdCompress = e.BrotliDecompress = e.BrotliCompress = e.Unzip = e.InflateRaw = e.DeflateRaw = e.Gunzip = e.Gzip = e.Inflate = e.Deflate = e.Zlib = e.ZlibError = e.constants = void 0;
var o = a(t("assert")), s = t("buffer"), c = y(), l = i(t("zlib")), u = b(), d = b();
Object.defineProperty(e, "constants", {
enumerable: !0,
get: function() {
return d.constants;
}
});
var f = s.Buffer.concat, p = Object.getOwnPropertyDescriptor(s.Buffer, "concat"), m = (e) => e, h = p?.writable === !0 || p?.set !== void 0 ? (e) => {
s.Buffer.concat = e ? m : f;
} : (e) => {}, g = Symbol("_superWrite"), _ = class extends Error {
code;
errno;
constructor(e, t) {
super("zlib: " + e.message, { cause: e }), this.code = e.code, this.errno = e.errno, this.code ||= "ZLIB_ERROR", this.message = "zlib: " + e.message, Error.captureStackTrace(this, t ?? this.constructor);
}
get name() {
return "ZlibError";
}
};
e.ZlibError = _;
var v = Symbol("flushFlag"), x = class extends c.Minipass {
#e = !1;
#t = !1;
#n;
#r;
#i;
#a;
#o;
get sawError() {
return this.#e;
}
get handle() {
return this.#a;
}
/* c8 ignore start */
get flushFlag() {
return this.#n;
}
/* c8 ignore stop */
constructor(e, t) {
if (!e || typeof e != "object") throw TypeError("invalid options for ZlibBase constructor");
/* c8 ignore stop */
if (super(e), this.#n = e.flush ?? 0, this.#r = e.finishFlush ?? 0, this.#i = e.fullFlushFlag ?? 0, typeof l[t] != "function") throw TypeError("Compression method not supported: " + t);
try {
this.#a = new l[t](e);
} catch (e) {
throw new _(e, this.constructor);
}
this.#o = (e) => {
this.#e || (this.#e = !0, this.close(), this.emit("error", e));
}, this.#a?.on("error", (e) => this.#o(new _(e))), this.once("end", () => this.close);
}
close() {
this.#a && (this.#a.close(), this.#a = void 0, this.emit("close"));
}
reset() {
if (!this.#e) return (0, o.default)(this.#a, "zlib binding closed"), this.#a.reset?.();
}
flush(e) {
this.ended || (typeof e != "number" && (e = this.#i), this.write(Object.assign(s.Buffer.alloc(0), { [v]: e })));
}
end(e, t, n) {
return typeof e == "function" && (n = e, t = void 0, e = void 0), typeof t == "function" && (n = t, t = void 0), e && (t ? this.write(e, t) : this.write(e)), this.flush(this.#r), this.#t = !0, super.end(n);
}
get ended() {
return this.#t;
}
[g](e) {
return super.write(e);
}
write(e, t, n) {
if (typeof t == "function" && (n = t, t = "utf8"), typeof e == "string" && (e = s.Buffer.from(e, t)), this.#e) return;
(0, o.default)(this.#a, "zlib binding closed");
let r = this.#a._handle, i = r.close;
r.close = () => {};
let a = this.#a.close;
this.#a.close = () => {}, h(!0);
let c;
try {
let t = typeof e[v] == "number" ? e[v] : this.#n;
c = this.#a._processChunk(e, t), h(!1);
} catch (e) {
h(!1), this.#o(new _(e, this.write));
} finally {
this.#a && (this.#a._handle = r, r.close = i, this.#a.close = a, this.#a.removeAllListeners("error"));
}
this.#a && this.#a.on("error", (e) => this.#o(new _(e, this.write)));
let l;
if (c) if (Array.isArray(c) && c.length > 0) {
let e = c[0];
l = this[g](s.Buffer.from(e));
for (let e = 1; e < c.length; e++) l = this[g](c[e]);
} else l = this[g](s.Buffer.from(c));
return n && n(), l;
}
}, S = class extends x {
#e;
#t;
constructor(e, t) {
e ||= {}, e.flush = e.flush || u.constants.Z_NO_FLUSH, e.finishFlush = e.finishFlush || u.constants.Z_FINISH, e.fullFlushFlag = u.constants.Z_FULL_FLUSH, super(e, t), this.#e = e.level, this.#t = e.strategy;
}
params(e, t) {
if (!this.sawError) {
if (!this.handle) throw Error("cannot switch params when binding is closed");
/* c8 ignore start */
if (!this.handle.params) throw Error("not supported in this implementation");
/* c8 ignore stop */
if (this.#e !== e || this.#t !== t) {
this.flush(u.constants.Z_SYNC_FLUSH), (0, o.default)(this.handle, "zlib binding closed");
let n = this.handle.flush;
this.handle.flush = (e, t) => {
typeof e == "function" && (t = e, e = this.flushFlag), this.flush(e), t?.();
};
try {
this.handle.params(e, t);
} finally {
this.handle.flush = n;
}
/* c8 ignore start */
this.handle && (this.#e = e, this.#t = t);
}
}
}
};
e.Zlib = S, e.Deflate = class extends S {
constructor(e) {
super(e, "Deflate");
}
}, e.Inflate = class extends S {
constructor(e) {
super(e, "Inflate");
}
}, e.Gzip = class extends S {
#e;
constructor(e) {
super(e, "Gzip"), this.#e = e && !!e.portable;
}
[g](e) {
return this.#e ? (this.#e = !1, e[9] = 255, super[g](e)) : super[g](e);
}
}, e.Gunzip = class extends S {
constructor(e) {
super(e, "Gunzip");
}
}, e.DeflateRaw = class extends S {
constructor(e) {
super(e, "DeflateRaw");
}
}, e.InflateRaw = class extends S {
constructor(e) {
super(e, "InflateRaw");
}
}, e.Unzip = class extends S {
constructor(e) {
super(e, "Unzip");
}
};
var C = class extends x {
constructor(e, t) {
e ||= {}, e.flush = e.flush || u.constants.BROTLI_OPERATION_PROCESS, e.finishFlush = e.finishFlush || u.constants.BROTLI_OPERATION_FINISH, e.fullFlushFlag = u.constants.BROTLI_OPERATION_FLUSH, super(e, t);
}
};
e.BrotliCompress = class extends C {
constructor(e) {
super(e, "BrotliCompress");
}
}, e.BrotliDecompress = class extends C {
constructor(e) {
super(e, "BrotliDecompress");
}
};
var w = class extends x {
constructor(e, t) {
e ||= {}, e.flush = e.flush || u.constants.ZSTD_e_continue, e.finishFlush = e.finishFlush || u.constants.ZSTD_e_end, e.fullFlushFlag = u.constants.ZSTD_e_flush, super(e, t);
}
};
e.ZstdCompress = class extends w {
constructor(e) {
super(e, "ZstdCompress");
}
}, e.ZstdDecompress = class extends w {
constructor(e) {
super(e, "ZstdDecompress");
}
};
})), S = /* @__PURE__ */ a(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.MinipassSized = e.SizeError = void 0;
var t = y(), n = (e) => typeof e == "string", r = class extends Error {
expect;
found;
code = "EBADSIZE";
constructor(e, t, n) {
super(`Bad data size: expected ${t} bytes, but got ${e}`), this.expect = t, this.found = e, Error.captureStackTrace(this, n ?? this.constructor);
}
get name() {
return "SizeError";
}
};
e.SizeError = r, e.MinipassSized = class extends t.Minipass {
found = 0;
expect;
constructor(e) {
let t = e?.size;
if (typeof t != "number" || t > 2 ** 53 - 1 || isNaN(t) || t < 0 || !isFinite(t) || t !== Math.floor(t)) throw Error("invalid expected size: " + t);
if (super(e), e.objectMode) throw TypeError(`${this.constructor.name} streams only work with string and buffer data`);
this.expect = t;
}
write(e, t, i) {
let a = Buffer.isBuffer(e) ? e : typeof e == "string" ? Buffer.from(e, n(t) ? t : "utf8") : e;
return typeof t == "function" && (i = t, t = null), Buffer.isBuffer(a) ? (this.found += a.length, this.found > this.expect && this.emit("error", new r(this.found, this.expect)), super.write(e, t, i)) : (this.emit("error", /* @__PURE__ */ TypeError(`${this.constructor.name} streams only work with string and buffer data`)), !1);
}
emit(e, ...t) {
return e === "end" && this.found !== this.expect && this.emit("error", new r(this.found, this.expect, this.emit)), super.emit(e, ...t);
}
};
})), C = /* @__PURE__ */ a(((e, t) => {
var { Minipass: n } = y(), r = Symbol("type"), i = Symbol("buffer"), a = class e {
constructor(t, n) {
this[r] = "";
let a = [], o = 0;
if (t) {
let n = t, r = Number(n.length);
for (let t = 0; t < r; t++) {
let r = n[t], s = r instanceof Buffer ? r : ArrayBuffer.isView(r) ? Buffer.from(r.buffer, r.byteOffset, r.byteLength) : r instanceof ArrayBuffer ? Buffer.from(r) : r instanceof e ? r[i] : typeof r == "string" ? Buffer.from(r) : Buffer.from(String(r));
o += s.length, a.push(s);
}
}
this[i] = Buffer.concat(a, o);
let s = n && n.type !== void 0 && String(n.type).toLowerCase();
s && !/[^\u0020-\u007E]/.test(s) && (this[r] = s);
}
get size() {
return this[i].length;
}
get type() {
return this[r];
}
text() {
return Promise.resolve(this[i].toString());
}
arrayBuffer() {
let e = this[i], t = e.byteOffset, n = e.byteLength, r = e.buffer.slice(t, t + n);
return Promise.resolve(r);
}
stream() {
return new n().end(this[i]);
}
slice(t, n, r) {
let a = this.size, o = t === void 0 ? 0 : t < 0 ? Math.max(a + t, 0) : Math.min(t, a), s = n === void 0 ? a : n < 0 ? Math.max(a + n, 0) : Math.min(n, a), c = Math.max(s - o, 0), l = this[i].slice(o, o + c), u = new e([], { type: r });
return u[i] = l, u;
}
get [Symbol.toStringTag]() {
return "Blob";
}
static get BUFFER() {
return i;
}
};
Object.defineProperties(a.prototype, {
size: { enumerable: !0 },
type: { enumerable: !0 }
}), t.exports = a;
})), w = /* @__PURE__ */ a(((e, t) => {
t.exports = class extends Error {
constructor(e, t, n) {
super(e), this.code = "FETCH_ERROR", n && Object.assign(this, n), this.errno = this.code, this.type = this.code === "EBADSIZE" && this.found > this.expect ? "max-size" : t, this.message = e, Error.captureStackTrace(this, this.constructor);
}
get name() {
return "FetchError";
}
set name(e) {}
get [Symbol.toStringTag]() {
return "FetchError";
}
};
})), T = /* @__PURE__ */ i({ default: () => E }), E, D = n((() => {
E = {};
})), O = /* @__PURE__ */ a(((t, n) => {
var { Minipass: r } = y(), { MinipassSized: i } = S(), a = C(), { BUFFER: o } = a, s = w(), c;
try {
c = (D(), e(T)).decode;
} catch {}
var l = Symbol("Body internals"), u = Symbol("consumeBody"), d = class {
constructor(e, t = {}) {
let { size: n = 0, timeout: i = 0 } = t, a = e == null ? null : f(e) ? Buffer.from(e.toString()) : p(e) || Buffer.isBuffer(e) ? e : Object.prototype.toString.call(e) === "[object ArrayBuffer]" ? Buffer.from(e) : ArrayBuffer.isView(e) ? Buffer.from(e.buffer, e.byteOffset, e.byteLength) : r.isStream(e) ? e : Buffer.from(String(e));
this[l] = {
body: a,
disturbed: !1,
error: null
}, this.size = n, this.timeout = i, r.isStream(a) && a.on("error", (e) => {
let t = e.name === "AbortError" ? e : new s(`Invalid response while trying to fetch ${this.url}: ${e.message}`, "system", e);
this[l].error = t;
});
}
get body() {
return this[l].body;
}
get bodyUsed() {
return this[l].disturbed;
}
arrayBuffer() {
return this[u]().then((e) => e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength));
}
blob() {
let e = this.headers && this.headers.get("content-type") || "";
return this[u]().then((t) => Object.assign(new a([], { type: e.toLowerCase() }), { [o]: t }));
}
async json() {
let e = await this[u]();
try {
return JSON.parse(e.toString());
} catch (e) {
throw new s(`invalid json response body at ${this.url} reason: ${e.message}`, "invalid-json");
}
}
text() {
return this[u]().then((e) => e.toString());
}
buffer() {
return this[u]();
}
textConverted() {
/* istanbul ignore if */
if (typeof c != "function") throw Error("The package `iconv-lite` must be installed to use the textConverted() function");
return this[u]().then((e) => m(e, this.headers));
}
[u]() {
if (this[l].disturbed) return Promise.reject(/* @__PURE__ */ TypeError(`body used already for: ${this.url}`));
if (this[l].disturbed = !0, this[l].error) return Promise.reject(this[l].error);
if (this.body === null) return Promise.resolve(Buffer.alloc(0));
if (Buffer.isBuffer(this.body)) return Promise.resolve(this.body);
let e = p(this.body) ? this.body.stream() : this.body;
/* istanbul ignore if: should never happen */
if (!r.isStream(e)) return Promise.resolve(Buffer.alloc(0));
let t = this.size && e instanceof i || !this.size && e instanceof r && !(e instanceof i) ? e : this.size ? new i({ size: this.size }) : new r(), n = this.timeout && t.writable ? setTimeout(() => {
t.emit("error", new s(`Response timeout while trying to fetch ${this.url} (over ${this.timeout}ms)`, "body-timeout"));
}, this.timeout) : null;
return n && n.unref && n.unref(), new Promise((n) => {
t !== e && (e.on("error", (e) => t.emit("error", e)), e.pipe(t)), n();
}).then(() => t.concat()).then((e) => (clearTimeout(n), e)).catch((e) => {
throw clearTimeout(n), e.name === "AbortError" || e.name === "FetchError" ? e : e.name === "RangeError" ? new s(`Could not create Buffer from response body for ${this.url}: ${e.message}`, "system", e) : new s(`Invalid response body while trying to fetch ${this.url}: ${e.message}`, "system", e);
});
}
static clone(e) {
if (e.bodyUsed) throw Error("cannot clone body after it is used");
let t = e.body;
if (r.isStream(t) && typeof t.getBoundary != "function") {
let n = new r(), i = new r(), a = new r();
return n.on("error", (e) => {
i.emit("error", e), a.emit("error", e);
}), t.on("error", (e) => n.emit("error", e)), n.pipe(i), n.pipe(a), t.pipe(n), e[l].body = i, a;
}
return e.body;
}
static extractContentType(e) {
return e == null ? null : typeof e == "string" ? "text/plain;charset=UTF-8" : f(e) ? "application/x-www-form-urlencoded;charset=UTF-8" : p(e) ? e.type || null : Buffer.isBuffer(e) || Object.prototype.toString.call(e) === "[object ArrayBuffer]" || ArrayBuffer.isView(e) ? null : typeof e.getBoundary == "function" ? `multipart/form-data;boundary=${e.getBoundary()}` : r.isStream(e) ? null : "text/plain;charset=UTF-8";
}
static getTotalBytes(e) {
let { body: t } = e;
return t == null ? 0 : p(t) ? t.size : Buffer.isBuffer(t) ? t.length : t && typeof t.getLengthSync == "function" && (t._lengthRetrievers &&
/* istanbul ignore next */ t._lengthRetrievers.length === 0 || t.hasKnownLength && t.hasKnownLength()) ? t.getLengthSync() : null;
}
static writeToStream(e, t) {
let { body: n } = t;
return n == null ? e.end() : Buffer.isBuffer(n) || typeof n == "string" ? e.end(n) : (p(n) ? n.stream() : n).on("error", (t) => e.emit("error", t)).pipe(e), e;
}
};
Object.defineProperties(d.prototype, {
body: { enumerable: !0 },
bodyUsed: { enumerable: !0 },
arrayBuffer: { enumerable: !0 },
blob: { enumerable: !0 },
json: { enumerable: !0 },
text: { enumerable: !0 }
});
var f = (e) => typeof e != "object" || typeof e.append != "function" || typeof e.delete != "function" || typeof e.get != "function" || typeof e.getAll != "function" || typeof e.has != "function" || typeof e.set != "function" ? !1 : e.constructor.name === "URLSearchParams" || Object.prototype.toString.call(e) === "[object URLSearchParams]" || typeof e.sort == "function", p = (e) => typeof e == "object" && typeof e.arrayBuffer == "function" && typeof e.type == "string" && typeof e.stream == "function" && typeof e.constructor == "function" && typeof e.constructor.name == "string" && /^(Blob|File)$/.test(e.constructor.name) && /^(Blob|File)$/.test(e[Symbol.toStringTag]), m = (e, t) => {
let n = t && t.get("content-type"), r = "utf-8", i;
n && (i = /charset=([^;]*)/i.exec(n));
let a = e.slice(0, 1024).toString();
if (!i && a && (i = /<meta.+?charset=(['"])(.+?)\1/i.exec(a)), !i && a && (i = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(a), i || (i = /<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(a), i && i.pop()), i &&= /charset=(.*)/i.exec(i.pop())), !i && a && (i = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(a)), i && (r = i.pop(), (r === "gb2312" || r === "gbk") && (r = "gb18030")), r === "UTF-8") return e.toString("UTF-8");
r = r.toString().trim().replace(/^latin[-_]?(\d+)$/i, "ISO-8859-$1").replace(/^win(?:dows)?[-_]?(\d+)$/i, "WINDOWS-$1").replace(/^utf[-_]?(\d+)$/i, "UTF-$1").replace(/^ks_c_5601-1987$/i, "CP949").replace(/^us[-_]?ascii$/i, "ASCII").toUpperCase();
try {
return c(e, r).toString();
} catch {
/* istanbul ignore next */
return e.toString("UTF-8");
}
};
n.exports = d;
})), k = /* @__PURE__ */ a(((e, t) => {
var n = /[^^_`a-zA-Z\-0-9!#$%&'*+.|~]/, r = /[^\t\x20-\x7e\x80-\xff]/, i = (e) => {
if (e = `${e}`, n.test(e) || e === "") throw TypeError(`${e} is not a legal HTTP header name`);
}, a = (e) => {
if (e = `${e}`, r.test(e)) throw TypeError(`${e} is not a legal HTTP header value`);
}, o = (e, t) => {
t = t.toLowerCase();
for (let n in e) if (n.toLowerCase() === t) return n;
}, s = Symbol("map"), c = class e {
constructor(t = void 0) {
if (this[s] = Object.create(null), t instanceof e) {
let e = t.raw(), n = Object.keys(e);
for (let t of n) for (let n of e[t]) this.append(t, n);
return;
}
if (t != null) if (typeof t == "object") {
let e = t[Symbol.iterator];
if (e != null) {
if (typeof e != "function") throw TypeError("Header pairs must be iterable");
let n = [];
for (let e of t) {
if (typeof e != "object" || typeof e[Symbol.iterator] != "function") throw TypeError("Each header pair must be iterable");
let t = Array.from(e);
if (t.length !== 2) throw TypeError("Each header pair must be a name/value tuple");
n.push(t);
}
for (let e of n) this.append(e[0], e[1]);
} else for (let e of Object.keys(t)) this.append(e, t[e]);
} else throw TypeError("Provided initializer must be an object");
}
get(e) {
e = `${e}`, i(e);
let t = o(this[s], e);
return t === void 0 ? null : this[s][t].join(", ");
}
forEach(e, t = void 0) {
let n = l(this);
for (let r = 0; r < n.length; r++) {
let [i, a] = n[r];
e.call(t, a, i, this), n = l(this);
}
}
set(e, t) {
e = `${e}`, t = `${t}`, i(e), a(t);
let n = o(this[s], e);
this[s][n === void 0 ? e : n] = [t];
}
append(e, t) {
e = `${e}`, t = `${t}`, i(e), a(t);
let n = o(this[s], e);
n === void 0 ? this[s][e] = [t] : this[s][n].push(t);
}
has(e) {
return e = `${e}`, i(e), o(this[s], e) !== void 0;
}
delete(e) {
e = `${e}`, i(e);
let t = o(this[s], e);
t !== void 0 && delete this[s][t];
}
raw() {
return this[s];
}
keys() {
return new d(this, "key");
}
values() {
return new d(this, "value");
}
[Symbol.iterator]() {
return new d(this, "key+value");
}
entries() {
return new d(this, "key+value");
}
get [Symbol.toStringTag]() {
return "Headers";
}
static exportNodeCompatibleHeaders(e) {
let t = Object.assign(Object.create(null), e[s]), n = o(e[s], "Host");
return n !== void 0 && (t[n] = t[n][0]), t;
}
static createHeadersLenient(t) {
let i = new e();
for (let e of Object.keys(t)) if (!n.test(e)) if (Array.isArray(t[e])) for (let n of t[e]) r.test(n) || (i[s][e] === void 0 ? i[s][e] = [n] : i[s][e].push(n));
else r.test(t[e]) || (i[s][e] = [t[e]]);
return i;
}
};
Object.defineProperties(c.prototype, {
get: { enumerable: !0 },
forEach: { enumerable: !0 },
set: { enumerable: !0 },
append: { enumerable: !0 },
has: { enumerable: !0 },
delete: { enumerable: !0 },
keys: { enumerable: !0 },
values: { enumerable: !0 },
entries: { enumerable: !0 }
});
var l = (e, t = "key+value") => Object.keys(e[s]).sort().map(t === "key" ? (e) => e.toLowerCase() : t === "value" ? (t) => e[s][t].join(", ") : (t) => [t.toLowerCase(), e[s][t].join(", ")]), u = Symbol("internal"), d = class e {
constructor(e, t) {
this[u] = {
target: e,
kind: t,
index: 0
};
}
get [Symbol.toStringTag]() {
return "HeadersIterator";
}
next() {
/* istanbul ignore if: should be impossible */
if (!this || Object.getPrototypeOf(this) !== e.prototype) throw TypeError("Value of `this` is not a HeadersIterator");
let { target: t, kind: n, index: r } = this[u], i = l(t, n);
return r >= i.length ? {
value: void 0,
done: !0
} : (this[u].index++, {
value: i[r],
done: !1
});
}
};
Object.setPrototypeOf(d.prototype, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))), t.exports = c;
})), A = /* @__PURE__ */ a(((e, n) => {
var { STATUS_CODES: r } = t("http"), i = k(), a = O(), { clone: o, extractContentType: s } = a, c = Symbol("Response internals"), l = class e extends a {
constructor(e = null, t = {}) {
super(e, t);
let n = t.status || 200, a = new i(t.headers);
if (e != null && !a.has("Content-Type")) {
let t = s(e);
t && a.append("Content-Type", t);
}
this[c] = {
url: t.url,
status: n,
statusText: t.statusText || r[n],
headers: a,
counter: t.counter,
trailer: Promise.resolve(t.trailer || new i())
};
}
get trailer() {
return this[c].trailer;
}
get url() {
return this[c].url || "";
}
get status() {
return this[c].status;
}
get ok() {
return this[c].status >= 200 && this[c].status < 300;
}
get redirected() {
return this[c].counter > 0;
}
get statusText() {
return this[c].statusText;
}
get headers() {
return this[c].headers;
}
clone() {
return new e(o(this), {
url: this.url,
status: this.status,
statusText: this.statusText,
headers: this.headers,
ok: this.ok,
redirected: this.redirected,
trailer: this.trailer
});
}
get [Symbol.toStringTag]() {
return "Response";
}
};
n.exports = l, Object.defineProperties(l.prototype, {
url: { enumerable: !0 },
status: { enumerable: !0 },
ok: { enumerable: !0 },
redirected: { enumerable: !0 },
statusText: { enumerable: !0 },
headers: { enumerable: !0 },
clone: { enumerable: !0 }
});
})), j = /* @__PURE__ */ i({
author: () => G,
default: () => q,
dependencies: () => z,
description: () => P,
devDependencies: () => R,
engines: () => W,
files: () => U,
keywords: () => H,
license: () => "MIT",
main: () => F,
name: () => M,
optionalDependencies: () => B,
repository: () => V,
scripts: () => I,
tap: () => L,
templateOSS: () => K,
version: () => N
}), M, N, P, F, I, L, R, z, B, V, H, U, W, G, K, q, ee = n((() => {
M = "minipass-fetch", N = "6.0.0", P = "An implementation of window.fetch in Node.js using Minipass streams", F = "lib/index.js", I = {
"test:tls-fixtures": "./test/fixtures/tls/setup.sh",
test: "tap",
snap: "tap",
lint: "npm run eslint",
postlint: "template-oss-check",
lintfix: "npm run eslint -- --fix",
posttest: "npm run lint",
"template-oss-apply": "template-oss-apply --force",
eslint: "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
}, L = {
"coverage-map": "map.js",
"check-coverage": !0,
"nyc-arg": ["--exclude", "tap-snapshots/**"]
}, R = {
"@npmcli/eslint-config": "^5.0.0",
"@npmcli/template-oss": "5.0.0",
"@ungap/url-search-params": "^0.2.2",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "~1.7.3",
"form-data": "^4.0.0",
"iconv-lite": "^0.7.2",
nock: "^13.2.4",
parted: "^0.1.1",
"string-to-arraybuffer": "^1.0.2",
tap: "^16.0.0"
}, z = {
minipass: "^7.0.3",
"minipass-sized": "^2.0.0",
minizlib: "^3.0.1"
}, B = { "iconv-lite": "^0.7.2" }, V = {
type: "git",
url: "git+https://github.com/npm/minipass-fetch.git"
}, H = [
"fetch",
"minipass",
"node-fetch",
"window.fetch"
], U = ["bin/", "lib/"], W = { node: "^22.22.2 || ^24.15.0 || >=26.0.0" }, G = "GitHub Inc.", K = {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
version: "5.0.0",
publish: "true"
}, q = {
name: M,
version: N,
description: P,
license: "MIT",
main: F,
scripts: I,
tap: L,
devDependencies: R,
dependencies: z,
optionalDependencies: B,
repository: V,
keywords: H,
files: U,
engines: W,
author: G,
templateOSS: K
};
})), J = /* @__PURE__ */ a(((n, r) => {
var { URL: i } = t("url"), { Minipass: a } = y(), o = k(), { exportNodeCompatibleHeaders: s } = o, c = O(), { clone: l, extractContentType: u, getTotalBytes: d } = c, f = `minipass-fetch/${(ee(), e(j).default).version} (+https://github.com/isaacs/minipass-fetch)`, p = Symbol("Request internals"), m = (e) => typeof e == "object" && typeof e[p] == "object", h = (e) => {
let t = e && typeof e == "object" && Object.getPrototypeOf(e);
return !!(t && t.constructor.name === "AbortSignal");
}, g = class e extends c {
constructor(e, t = {}) {
let n = m(e) ? new i(e.url) : e && e.href ? new i(e.href) : new i(`${e}`);
m(e) ? t = {
...e[p],
...t
} : (!e || typeof e == "string") && (e = {});
let r = (t.method || e.method || "GET").toUpperCase(), a = r === "GET" || r === "HEAD";
if ((t.body !== null && t.body !== void 0 || m(e) && e.body !== null) && a) throw TypeError("Request with GET/HEAD method cannot have body");
let s = t.body !== null && t.body !== void 0 ? t.body : m(e) && e.body !== null ? l(e) : null;
super(s, {
timeout: t.timeout || e.timeout || 0,
size: t.size || e.size || 0
});
let c = new o(t.headers || e.headers || {});
if (s != null && !c.has("Content-Type")) {
let e = u(s);
e && c.append("Content-Type", e);
}
let d = "signal" in t ? t.signal : null;
if (d != null && !h(d)) throw TypeError("Expected signal must be an instanceof AbortSignal");
let { ca: f, cert: g, ciphers: _, clientCertEngine: v, crl: y, dhparam: b, ecdhCurve: x, family: S, honorCipherOrder: C, key: w, passphrase: T, pfx: E, rejectUnauthorized: D = process.env.NODE_TLS_REJECT_UNAUTHORIZED !== "0", secureOptions: O, secureProtocol: k, servername: A, sessionIdContext: j } = t;
this[p] = {
method: r,
redirect: t.redirect || e.redirect || "follow",
headers: c,
parsedURL: n,
signal: d,
ca: f,
cert: g,
ciphers: _,
clientCertEngine: v,
crl: y,
dhparam: b,
ecdhCurve: x,
family: S,
honorCipherOrder: C,
key: w,
passphrase: T,
pfx: E,
rejectUnauthorized: D,
secureOptions: O,
secureProtocol: k,
servername: A,
sessionIdContext: j
}, this.follow = t.follow === void 0 ? e.follow === void 0 ? 20 : e.follow : t.follow, this.compress = t.compress === void 0 ? e.compress === void 0 || e.compress : t.compress, this.counter = t.counter || e.counter || 0, this.agent = t.agent || e.agent;
}
get method() {
return this[p].method;
}
get url() {
return this[p].parsedURL.toString();
}
get headers() {
return this[p].headers;
}
get redirect() {
return this[p].redirect;
}
get signal() {
return this[p].signal;
}
clone() {
return new e(this);
}
get [Symbol.toStringTag]() {
return "Request";
}
static getNodeRequestOptions(e) {
let t = e[p].parsedURL, n = new o(e[p].headers);
if (n.has("Accept") || n.set("Accept", "*/*"), !/^https?:$/.test(t.protocol)) throw TypeError("Only HTTP(S) protocols are supported");
if (e.signal && a.isStream(e.body) && typeof e.body.destroy != "function") throw Error("Cancellation of streamed requests with AbortSignal is not supported");
let r = (e.body === null || e.body === void 0) && /^(POST|PUT)$/i.test(e.method) ? "0" : e.body !== null && e.body !== void 0 ? d(e) : null;
r && n.set("Content-Length", r + ""), n.has("User-Agent") || n.set("User-Agent", f), e.compress && !n.has("Accept-Encoding") && n.set("Accept-Encoding", "gzip,deflate");
let i = typeof e.agent == "function" ? e.agent(t) : e.agent;
!n.has("Connection") && !i && n.set("Connection", "close");
let { ca: c, cert: l, ciphers: u, clientCertEngine: m, crl: h, dhparam: g, ecdhCurve: _, family: v, honorCipherOrder: y, key: b, passphrase: x, pfx: S, rejectUnauthorized: C, secureOptions: w, secureProtocol: T, servername: E, sessionIdContext: D } = e[p];
return {
auth: t.username || t.password ? `${t.username}:${t.password}` : "",
host: t.host,
hostname: t.hostname,
path: `${t.pathname}${t.search}`,
port: t.port,
protocol: t.protocol,
method: e.method,
headers: s(n),
agent: i,
ca: c,
cert: l,
ciphers: u,
clientCertEngine: m,
crl: h,
dhparam: g,
ecdhCurve: _,
family: v,
honorCipherOrder: y,
key: b,
passphrase: x,
pfx: S,
rejectUnauthorized: C,
secureOptions: w,
secureProtocol: T,
servername: E,
sessionIdContext: D,
timeout: e.timeout
};
}
};
r.exports = g, Object.defineProperties(g.prototype, {
method: { enumerable: !0 },
url: { enumerable: !0 },
headers: { enumerable: !0 },
redirect: { enumerable: !0 },
clone: { enumerable: !0 },
signal: { enumerable: !0 }
});
})), te = /* @__PURE__ */ a(((e, t) => {
t.exports = class extends Error {
constructor(e) {
super(e), this.code = "FETCH_ABORTED", this.type = "aborted", Error.captureStackTrace(this, this.constructor);
}
get name() {
return "AbortError";
}
set name(e) {}
};
})), Y = /* @__PURE__ */ a(((e, n) => {
var { URL: r } = t("url"), i = t("http"), a = t("https"), o = x(), { Minipass: s } = y(), { writeToStream: c, getTotalBytes: l } = O(), u = A(), d = k(), { createHeadersLenient: f } = d, p = J(), { getNodeRequestOptions: m } = p, h = w(), g = te(), _ = async (e, t) => {
if (/^data:/.test(e)) {
let n = new p(e, t);
return Promise.resolve().then(() => new Promise((t, i) => {
let a, o;
try {
let { pathname: t, search: n } = new r(e), i = t.split(",");
if (i.length < 2) throw Error("invalid data: URI");
let s = i.shift(), c = /;base64$/.test(s);
a = c ? s.slice(0, -7) : s;
let l = decodeURIComponent(i.join(",") + n);
o = c ? Buffer.from(l, "base64") : Buffer.from(l);
} catch (e) {
return i(new h(`[${n.method}] ${n.url} invalid URL, ${e.message}`, "system", e));
}
let { signal: s } = n;
if (s && s.aborted) return i(new g("The user aborted a request."));
let c = { "Content-Length": o.length };
return a && (c["Content-Type"] = a), t(new u(o, { headers: c }))