import { __exportAll as e } from "../rolldown-runtime.mjs"; import t from "node:fs"; import n from "node:fs/promises"; import r from "node:stream"; import i, { basename as a, join as o, posix as s, win32 as c } from "node:path"; import l, { EventEmitter as u } from "events"; import d from "fs"; import { EventEmitter as f } from "node:events"; import { StringDecoder as ee } from "node:string_decoder"; import p, { dirname as m, parse as te } from "path"; import ne from "assert"; import { Buffer as re } from "buffer"; import * as ie from "zlib"; import ae from "zlib"; import oe from "node:assert"; import { randomBytes as se } from "node:crypto"; var ce = e({ Header: () => I, Pack: () => li, PackJob: () => Ur, PackSync: () => ui, Parser: () => tr, Pax: () => yn, ReadEntry: () => Cn, Unpack: () => wa, UnpackSync: () => Ea, WriteEntry: () => Pr, WriteEntrySync: () => Fr, WriteEntryTar: () => Ir, c: () => hi, create: () => hi, extract: () => Da, filesFilter: () => ir, list: () => ar, r: () => Na, replace: () => Na, t: () => ar, types: () => Xt, x: () => Da }), le = Object.defineProperty, ue = (e, t) => { for (var n in t) le(e, n, { get: t[n], enumerable: !0 }); }, de = typeof process == `object` && process ? process : { stdout: null, stderr: null }, fe = (e) => !!e && typeof e == `object` && (e instanceof Ue || e instanceof r || pe(e) || me(e)), pe = (e) => !!e && typeof e == `object` && e instanceof f && typeof e.pipe == `function` && e.pipe !== r.Writable.prototype.pipe, me = (e) => !!e && typeof e == `object` && e instanceof f && typeof e.write == `function` && typeof e.end == `function`, h = Symbol(`EOF`), g = Symbol(`maybeEmitEnd`), _ = Symbol(`emittedEnd`), he = Symbol(`emittingEnd`), ge = Symbol(`emittedError`), _e = Symbol(`closed`), ve = Symbol(`read`), ye = Symbol(`flush`), be = Symbol(`flushChunk`), v = Symbol(`encoding`), xe = Symbol(`decoder`), y = Symbol(`flowing`), Se = Symbol(`paused`), Ce = Symbol(`resume`), b = Symbol(`buffer`), x = Symbol(`pipes`), S = Symbol(`bufferLength`), we = Symbol(`bufferPush`), Te = Symbol(`bufferShift`), C = Symbol(`objectMode`), w = Symbol(`destroyed`), Ee = Symbol(`error`), De = Symbol(`emitData`), Oe = Symbol(`emitEnd`), ke = Symbol(`emitEnd2`), T = Symbol(`async`), Ae = Symbol(`abort`), je = Symbol(`aborted`), Me = Symbol(`signal`), Ne = Symbol(`dataListeners`), E = Symbol(`discarded`), Pe = (e) => Promise.resolve().then(e), Fe = (e) => e(), Ie = (e) => e === `end` || e === `finish` || e === `prefinish`, Le = (e) => e instanceof ArrayBuffer || !!e && typeof e == `object` && e.constructor && e.constructor.name === `ArrayBuffer` && e.byteLength >= 0, Re = (e) => !Buffer.isBuffer(e) && ArrayBuffer.isView(e), ze = class { src; dest; opts; ondrain; constructor(e, t, n) { this.src = e, this.dest = t, this.opts = n, this.ondrain = () => e[Ce](), this.dest.on(`drain`, this.ondrain); } unpipe() { this.dest.removeListener(`drain`, this.ondrain); } proxyErrors(e) {} end() { this.unpipe(), this.opts.end && this.dest.end(); } }, Be = class extends ze { 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); } }, Ve = (e) => !!e.objectMode, He = (e) => !e.objectMode && !!e.encoding && e.encoding !== `buffer`, Ue = class extends f { [y] = !1; [Se] = !1; [x] = []; [b] = []; [C]; [v]; [T]; [xe]; [h] = !1; [_] = !1; [he] = !1; [_e] = !1; [ge] = null; [S] = 0; [w] = !1; [Me]; [je] = !1; [Ne] = 0; [E] = !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`); Ve(t) ? (this[C] = !0, this[v] = null) : He(t) ? (this[v] = t.encoding, this[C] = !1) : (this[C] = !1, this[v] = null), this[T] = !!t.async, this[xe] = this[v] ? new ee(this[v]) : null, t && t.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[b] }), t && t.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[x] }); let { signal: n } = t; n && (this[Me] = n, n.aborted ? this[Ae]() : n.addEventListener(`abort`, () => this[Ae]())); } get bufferLength() { return this[S]; } get encoding() { return this[v]; } 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[C]; } set objectMode(e) { throw Error(`objectMode must be set at instantiation time`); } get async() { return this[T]; } set async(e) { this[T] = this[T] || !!e; } [Ae]() { this[je] = !0, this.emit(`abort`, this[Me]?.reason), this.destroy(this[Me]?.reason); } get aborted() { return this[je]; } set aborted(e) {} write(e, t, n) { if (this[je]) return !1; if (this[h]) throw Error(`write after end`); if (this[w]) return this.emit(`error`, Object.assign(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[T] ? Pe : Fe; if (!this[C] && !Buffer.isBuffer(e)) { if (Re(e)) e = Buffer.from(e.buffer, e.byteOffset, e.byteLength); else if (Le(e)) e = Buffer.from(e); else if (typeof e != `string`) throw Error(`Non-contiguous data written to non-objectMode stream`); } return this[C] ? (this[y] && this[S] !== 0 && this[ye](!0), this[y] ? this.emit(`data`, e) : this[we](e), this[S] !== 0 && this.emit(`readable`), n && r(n), this[y]) : e.length ? (typeof e == `string` && !(t === this[v] && !this[xe]?.lastNeed) && (e = Buffer.from(e, t)), Buffer.isBuffer(e) && this[v] && (e = this[xe].write(e)), this[y] && this[S] !== 0 && this[ye](!0), this[y] ? this.emit(`data`, e) : this[we](e), this[S] !== 0 && this.emit(`readable`), n && r(n), this[y]) : (this[S] !== 0 && this.emit(`readable`), n && r(n), this[y]); } read(e) { if (this[w]) return null; if (this[E] = !1, this[S] === 0 || e === 0 || e && e > this[S]) return this[g](), null; this[C] && (e = null), this[b].length > 1 && !this[C] && (this[b] = [this[v] ? this[b].join(``) : Buffer.concat(this[b], this[S])]); let t = this[ve](e || null, this[b][0]); return this[g](), t; } [ve](e, t) { if (this[C]) this[Te](); else { let n = t; e === n.length || e === null ? this[Te]() : typeof n == `string` ? (this[b][0] = n.slice(e), t = n.slice(0, e), this[S] -= e) : (this[b][0] = n.subarray(e), t = n.subarray(0, e), this[S] -= e); } return this.emit(`data`, t), !this[b].length && !this[h] && 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[h] = !0, this.writable = !1, (this[y] || !this[Se]) && this[g](), this; } [Ce]() { this[w] || (!this[Ne] && !this[x].length && (this[E] = !0), this[Se] = !1, this[y] = !0, this.emit(`resume`), this[b].length ? this[ye]() : this[h] ? this[g]() : this.emit(`drain`)); } resume() { return this[Ce](); } pause() { this[y] = !1, this[Se] = !0, this[E] = !1; } get destroyed() { return this[w]; } get flowing() { return this[y]; } get paused() { return this[Se]; } [we](e) { this[C] ? this[S] += 1 : this[S] += e.length, this[b].push(e); } [Te]() { return this[C] ? --this[S] : this[S] -= this[b][0].length, this[b].shift(); } [ye](e = !1) { do ; while (this[be](this[Te]()) && this[b].length); !e && !this[b].length && !this[h] && this.emit(`drain`); } [be](e) { return this.emit(`data`, e), this[y]; } pipe(e, t) { if (this[w]) return e; this[E] = !1; let n = this[_]; return t ||= {}, e === de.stdout || e === de.stderr ? t.end = !1 : t.end = t.end !== !1, t.proxyErrors = !!t.proxyErrors, n ? t.end && e.end() : (this[x].push(t.proxyErrors ? new Be(this, e, t) : new ze(this, e, t)), this[T] ? Pe(() => this[Ce]()) : this[Ce]()), e; } unpipe(e) { let t = this[x].find((t) => t.dest === e); t && (this[x].length === 1 ? (this[y] && this[Ne] === 0 && (this[y] = !1), this[x] = []) : this[x].splice(this[x].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[E] = !1, this[Ne]++, !this[x].length && !this[y] && this[Ce](); else if (e === `readable` && this[S] !== 0) super.emit(`readable`); else if (Ie(e) && this[_]) super.emit(e), this.removeAllListeners(e); else if (e === `error` && this[ge]) { let e = t; this[T] ? Pe(() => e.call(this, this[ge])) : e.call(this, this[ge]); } return n; } removeListener(e, t) { return this.off(e, t); } off(e, t) { let n = super.off(e, t); return e === `data` && (this[Ne] = this.listeners(`data`).length, this[Ne] === 0 && !this[E] && !this[x].length && (this[y] = !1)), n; } removeAllListeners(e) { let t = super.removeAllListeners(e); return (e === `data` || e === void 0) && (this[Ne] = 0, !this[E] && !this[x].length && (this[y] = !1)), t; } get emittedEnd() { return this[_]; } [g]() { !this[he] && !this[_] && !this[w] && this[b].length === 0 && this[h] && (this[he] = !0, this.emit(`end`), this.emit(`prefinish`), this.emit(`finish`), this[_e] && this.emit(`close`), this[he] = !1); } emit(e, ...t) { let n = t[0]; if (e !== `error` && e !== `close` && e !== w && this[w]) return !1; if (e === `data`) return !this[C] && !n ? !1 : this[T] ? (Pe(() => this[De](n)), !0) : this[De](n); if (e === `end`) return this[Oe](); if (e === `close`) { if (this[_e] = !0, !this[_] && !this[w]) return !1; let e = super.emit(`close`); return this.removeAllListeners(`close`), e; } else if (e === `error`) { this[ge] = n, super.emit(Ee, n); let e = !this[Me] || this.listeners(`error`).length ? super.emit(`error`, n) : !1; return this[g](), e; } else if (e === `resume`) { let e = super.emit(`resume`); return this[g](), e; } else if (e === `finish` || e === `prefinish`) { let t = super.emit(e); return this.removeAllListeners(e), t; } let r = super.emit(e, ...t); return this[g](), r; } [De](e) { for (let t of this[x]) t.dest.write(e) === !1 && this.pause(); let t = !this[E] && super.emit(`data`, e); return this[g](), t; } [Oe]() { return this[_] ? !1 : (this[_] = !0, this.readable = !1, this[T] ? (Pe(() => this[ke]()), !0) : this[ke]()); } [ke]() { if (this[xe]) { let e = this[xe].end(); if (e) { for (let t of this[x]) t.dest.write(e); this[E] || super.emit(`data`, e); } } for (let e of this[x]) e.end(); let e = super.emit(`end`); return this.removeAllListeners(`end`), e; } async collect() { let e = Object.assign([], { dataLength: 0 }); this[C] || (e.dataLength = 0); let t = this.promise(); return this.on(`data`, (t) => { e.push(t), this[C] || (e.dataLength += t.length); }), await t, e; } async concat() { if (this[C]) throw Error(`cannot concat in objectMode`); let e = await this.collect(); return this[v] ? e.join(``) : Buffer.concat(e, e.dataLength); } async promise() { return new Promise((e, t) => { this.on(w, () => t(Error(`stream destroyed`))), this.on(`error`, (e) => t(e)), this.on(`end`, () => e()); }); } [Symbol.asyncIterator]() { this[E] = !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[h]) return t(); let r, i, a = (e) => { this.off(`data`, o), this.off(`end`, s), this.off(w, c), t(), i(e); }, o = (e) => { this.off(`error`, a), this.off(`end`, s), this.off(w, c), this.pause(), r({ value: e, done: !!this[h] }); }, s = () => { this.off(`error`, a), this.off(`data`, o), this.off(w, c), t(), r({ done: !0, value: void 0 }); }, c = () => a(Error(`stream destroyed`)); return new Promise((e, t) => { i = t, r = e, this.once(w, c), this.once(`error`, a), this.once(`end`, s), this.once(`data`, o); }); }, throw: t, return: t, [Symbol.asyncIterator]() { return this; }, [Symbol.asyncDispose]: async () => {} }; } [Symbol.iterator]() { this[E] = !1; let e = !1, t = () => (this.pause(), this.off(Ee, t), this.off(w, t), this.off(`end`, t), e = !0, { done: !0, value: void 0 }); return this.once(`end`, t), this.once(Ee, t), this.once(w, 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[w]) return e ? this.emit(`error`, e) : this.emit(w), this; this[w] = !0, this[E] = !0, this[b].length = 0, this[S] = 0; let t = this; return typeof t.close == `function` && !this[_e] && t.close(), e ? this.emit(`error`, e) : this.emit(w), this; } static get isStream() { return fe; } }, We = d.writev, D = Symbol(`_autoClose`), O = Symbol(`_close`), Ge = Symbol(`_ended`), k = Symbol(`_fd`), Ke = Symbol(`_finished`), A = Symbol(`_flags`), qe = Symbol(`_flush`), Je = Symbol(`_handleChunk`), Ye = Symbol(`_makeBuf`), Xe = Symbol(`_mode`), Ze = Symbol(`_needDrain`), Qe = Symbol(`_onerror`), $e = Symbol(`_onopen`), et = Symbol(`_onread`), tt = Symbol(`_onwrite`), nt = Symbol(`_open`), j = Symbol(`_path`), M = Symbol(`_pos`), N = Symbol(`_queue`), rt = Symbol(`_read`), it = Symbol(`_readSize`), P = Symbol(`_reading`), at = Symbol(`_remain`), ot = Symbol(`_size`), st = Symbol(`_write`), ct = Symbol(`_writing`), lt = Symbol(`_defaultFlag`), ut = Symbol(`_errored`), dt = class extends Ue { [ut] = !1; [k]; [j]; [it]; [P] = !1; [ot]; [at]; [D]; constructor(e, t) { if (t ||= {}, super(t), this.readable = !0, this.writable = !1, typeof e != `string`) throw TypeError(`path must be a string`); this[ut] = !1, this[k] = typeof t.fd == `number` ? t.fd : void 0, this[j] = e, this[it] = t.readSize || 16 * 1024 * 1024, this[P] = !1, this[ot] = typeof t.size == `number` ? t.size : Infinity, this[at] = this[ot], this[D] = typeof t.autoClose != `boolean` || t.autoClose, typeof this[k] == `number` ? this[rt]() : this[nt](); } get fd() { return this[k]; } get path() { return this[j]; } write() { throw TypeError(`this is a readable stream`); } end() { throw TypeError(`this is a readable stream`); } [nt]() { d.open(this[j], `r`, (e, t) => this[$e](e, t)); } [$e](e, t) { e ? this[Qe](e) : (this[k] = t, this.emit(`open`, t), this[rt]()); } [Ye]() { return Buffer.allocUnsafe(Math.min(this[it], this[at])); } [rt]() { if (!this[P]) { this[P] = !0; let e = this[Ye](); if (e.length === 0) return process.nextTick(() => this[et](null, 0, e)); d.read(this[k], e, 0, e.length, null, (e, t, n) => this[et](e, t, n)); } } [et](e, t, n) { this[P] = !1, e ? this[Qe](e) : this[Je](t, n) && this[rt](); } [O]() { if (this[D] && typeof this[k] == `number`) { let e = this[k]; this[k] = void 0, d.close(e, (e) => e ? this.emit(`error`, e) : this.emit(`close`)); } } [Qe](e) { this[P] = !0, this[O](), this.emit(`error`, e); } [Je](e, t) { let n = !1; return this[at] -= e, e > 0 && (n = super.write(e < t.length ? t.subarray(0, e) : t)), (e === 0 || this[at] <= 0) && (n = !1, this[O](), super.end()), n; } emit(e, ...t) { switch (e) { case `prefinish`: case `finish`: return !1; case `drain`: return typeof this[k] == `number` && this[rt](), !1; case `error`: return this[ut] ? !1 : (this[ut] = !0, super.emit(e, ...t)); default: return super.emit(e, ...t); } } }, ft = class extends dt { [nt]() { let e = !0; try { this[$e](null, d.openSync(this[j], `r`)), e = !1; } finally { e && this[O](); } } [rt]() { let e = !0; try { if (!this[P]) { this[P] = !0; do { let e = this[Ye](), t = e.length === 0 ? 0 : d.readSync(this[k], e, 0, e.length, null); if (!this[Je](t, e)) break; } while (!0); this[P] = !1; } e = !1; } finally { e && this[O](); } } [O]() { if (this[D] && typeof this[k] == `number`) { let e = this[k]; this[k] = void 0, d.closeSync(e), this.emit(`close`); } } }, pt = class extends l { readable = !1; writable = !0; [ut] = !1; [ct] = !1; [Ge] = !1; [N] = []; [Ze] = !1; [j]; [Xe]; [D]; [k]; [lt]; [A]; [Ke] = !1; [M]; constructor(e, t) { t ||= {}, super(t), this[j] = e, this[k] = typeof t.fd == `number` ? t.fd : void 0, this[Xe] = t.mode === void 0 ? 438 : t.mode, this[M] = typeof t.start == `number` ? t.start : void 0, this[D] = typeof t.autoClose != `boolean` || t.autoClose; let n = this[M] === void 0 ? `w` : `r+`; this[lt] = t.flags === void 0, this[A] = t.flags === void 0 ? n : t.flags, this[k] === void 0 && this[nt](); } emit(e, ...t) { if (e === `error`) { if (this[ut]) return !1; this[ut] = !0; } return super.emit(e, ...t); } get fd() { return this[k]; } get path() { return this[j]; } [Qe](e) { this[O](), this[ct] = !0, this.emit(`error`, e); } [nt]() { d.open(this[j], this[A], this[Xe], (e, t) => this[$e](e, t)); } [$e](e, t) { this[lt] && this[A] === `r+` && e && e.code === `ENOENT` ? (this[A] = `w`, this[nt]()) : e ? this[Qe](e) : (this[k] = t, this.emit(`open`, t), this[ct] || this[qe]()); } end(e, t) { return e && this.write(e, t), this[Ge] = !0, !this[ct] && !this[N].length && typeof this[k] == `number` && this[tt](null, 0), this; } write(e, t) { return typeof e == `string` && (e = Buffer.from(e, t)), this[Ge] ? (this.emit(`error`, Error(`write() after end()`)), !1) : this[k] === void 0 || this[ct] || this[N].length ? (this[N].push(e), this[Ze] = !0, !1) : (this[ct] = !0, this[st](e), !0); } [st](e) { d.write(this[k], e, 0, e.length, this[M], (e, t) => this[tt](e, t)); } [tt](e, t) { e ? this[Qe](e) : (this[M] !== void 0 && typeof t == `number` && (this[M] += t), this[N].length ? this[qe]() : (this[ct] = !1, this[Ge] && !this[Ke] ? (this[Ke] = !0, this[O](), this.emit(`finish`)) : this[Ze] && (this[Ze] = !1, this.emit(`drain`)))); } [qe]() { if (this[N].length === 0) this[Ge] && this[tt](null, 0); else if (this[N].length === 1) this[st](this[N].pop()); else { let e = this[N]; this[N] = [], We(this[k], e, this[M], (e, t) => this[tt](e, t)); } } [O]() { if (this[D] && typeof this[k] == `number`) { let e = this[k]; this[k] = void 0, d.close(e, (e) => e ? this.emit(`error`, e) : this.emit(`close`)); } } }, mt = class extends pt { [nt]() { let e; if (this[lt] && this[A] === `r+`) try { e = d.openSync(this[j], this[A], this[Xe]); } catch (e) { if (e?.code === `ENOENT`) return this[A] = `w`, this[nt](); throw e; } else e = d.openSync(this[j], this[A], this[Xe]); this[$e](null, e); } [O]() { if (this[D] && typeof this[k] == `number`) { let e = this[k]; this[k] = void 0, d.closeSync(e), this.emit(`close`); } } [st](e) { let t = !0; try { this[tt](null, d.writeSync(this[k], e, 0, e.length, this[M])), t = !1; } finally { if (t) try { this[O](); } catch {} } } }, ht = /* @__PURE__ */ new Map([ [`C`, `cwd`], [`f`, `file`], [`z`, `gzip`], [`P`, `preservePaths`], [`U`, `unlink`], [`strip-components`, `strip`], [`stripComponents`, `strip`], [`keep-newer`, `newer`], [`keepNewer`, `newer`], [`keep-newer-files`, `newer`], [`keepNewerFiles`, `newer`], [`k`, `keep`], [`keep-existing`, `keep`], [`keepExisting`, `keep`], [`m`, `noMtime`], [`no-mtime`, `noMtime`], [`p`, `preserveOwner`], [`L`, `follow`], [`h`, `follow`], [`onentry`, `onReadEntry`] ]), gt = (e) => !!e.sync && !!e.file, _t = (e) => !e.sync && !!e.file, vt = (e) => !!e.sync && !e.file, yt = (e) => !e.sync && !e.file, bt = (e) => !!e.file, xt = (e) => ht.get(e) || e, St = (e = {}) => { if (!e) return {}; let t = {}; for (let [n, r] of Object.entries(e)) { let e = xt(n); t[e] = r; } return t.chmod === void 0 && t.noChmod === !1 && (t.chmod = !0), delete t.noChmod, t; }, Ct = (e, t, n, r, i) => Object.assign((a = [], o, s) => { Array.isArray(a) && (o = a, a = {}), typeof o == `function` && (s = o, o = void 0), o = o ? Array.from(o) : []; let c = St(a); if (i?.(c, o), gt(c)) { if (typeof s == `function`) throw TypeError(`callback not supported for sync tar functions`); return e(c, o); } else if (_t(c)) { let e = t(c, o); return s ? e.then(() => s(), s) : e; } else if (vt(c)) { if (typeof s == `function`) throw TypeError(`callback not supported for sync tar functions`); return n(c, o); } else if (yt(c)) { if (typeof s == `function`) throw TypeError(`callback only supported with file option`); return r(c, o); } throw Error(`impossible options??`); }, { syncFile: e, asyncFile: t, syncNoFile: n, asyncNoFile: r, validate: i }), wt = ae.constants || { ZLIB_VERNUM: 4736 }, F = 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 }, wt)), Tt = re.concat, Et = Object.getOwnPropertyDescriptor(re, `concat`), Dt = (e) => e, Ot = Et?.writable === !0 || Et?.set !== void 0 ? (e) => { re.concat = e ? Dt : Tt; } : (e) => {}, kt = Symbol(`_superWrite`), At = 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`; } }, jt = Symbol(`flushFlag`), Mt = class extends Ue { #t = !1; #i = !1; #s; #n; #r; #e; #o; get sawError() { return this.#t; } get handle() { return this.#e; } get flushFlag() { return this.#s; } constructor(e, t) { if (!e || typeof e != `object`) throw TypeError(`invalid options for ZlibBase constructor`); if (super(e), this.#s = e.flush ?? 0, this.#n = e.finishFlush ?? 0, this.#r = e.fullFlushFlag ?? 0, typeof ie[t] != `function`) throw TypeError(`Compression method not supported: ` + t); try { this.#e = new ie[t](e); } catch (e) { throw new At(e, this.constructor); } this.#o = (e) => { this.#t || (this.#t = !0, this.close(), this.emit(`error`, e)); }, this.#e?.on(`error`, (e) => this.#o(new At(e))), this.once(`end`, () => this.close); } close() { this.#e && (this.#e.close(), this.#e = void 0, this.emit(`close`)); } reset() { if (!this.#t) return ne(this.#e, `zlib binding closed`), this.#e.reset?.(); } flush(e) { this.ended || (typeof e != `number` && (e = this.#r), this.write(Object.assign(re.alloc(0), { [jt]: 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.#n), this.#i = !0, super.end(n); } get ended() { return this.#i; } [kt](e) { return super.write(e); } write(e, t, n) { if (typeof t == `function` && (n = t, t = `utf8`), typeof e == `string` && (e = re.from(e, t)), this.#t) return; ne(this.#e, `zlib binding closed`); let r = this.#e._handle, i = r.close; r.close = () => {}; let a = this.#e.close; this.#e.close = () => {}, Ot(!0); let o; try { let t = typeof e[jt] == `number` ? e[jt] : this.#s; o = this.#e._processChunk(e, t), Ot(!1); } catch (e) { Ot(!1), this.#o(new At(e, this.write)); } finally { this.#e && (this.#e._handle = r, r.close = i, this.#e.close = a, this.#e.removeAllListeners(`error`)); } this.#e && this.#e.on(`error`, (e) => this.#o(new At(e, this.write))); let s; if (o) if (Array.isArray(o) && o.length > 0) { let e = o[0]; s = this[kt](re.from(e)); for (let e = 1; e < o.length; e++) s = this[kt](o[e]); } else s = this[kt](re.from(o)); return n && n(), s; } }, Nt = class extends Mt { #t; #i; constructor(e, t) { e ||= {}, e.flush = e.flush || F.Z_NO_FLUSH, e.finishFlush = e.finishFlush || F.Z_FINISH, e.fullFlushFlag = F.Z_FULL_FLUSH, super(e, t), this.#t = e.level, this.#i = e.strategy; } params(e, t) { if (!this.sawError) { if (!this.handle) throw Error(`cannot switch params when binding is closed`); if (!this.handle.params) throw Error(`not supported in this implementation`); if (this.#t !== e || this.#i !== t) { this.flush(F.Z_SYNC_FLUSH), ne(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; } this.handle && (this.#t = e, this.#i = t); } } } }, Pt = class extends Nt { #t; constructor(e) { super(e, `Gzip`), this.#t = e && !!e.portable; } [kt](e) { return this.#t ? (this.#t = !1, e[9] = 255, super[kt](e)) : super[kt](e); } }, Ft = class extends Nt { constructor(e) { super(e, `Unzip`); } }, It = class extends Mt { constructor(e, t) { e ||= {}, e.flush = e.flush || F.BROTLI_OPERATION_PROCESS, e.finishFlush = e.finishFlush || F.BROTLI_OPERATION_FINISH, e.fullFlushFlag = F.BROTLI_OPERATION_FLUSH, super(e, t); } }, Lt = class extends It { constructor(e) { super(e, `BrotliCompress`); } }, Rt = class extends It { constructor(e) { super(e, `BrotliDecompress`); } }, zt = class extends Mt { constructor(e, t) { e ||= {}, e.flush = e.flush || F.ZSTD_e_continue, e.finishFlush = e.finishFlush || F.ZSTD_e_end, e.fullFlushFlag = F.ZSTD_e_flush, super(e, t); } }, Bt = class extends zt { constructor(e) { super(e, `ZstdCompress`); } }, Vt = class extends zt { constructor(e) { super(e, `ZstdDecompress`); } }, Ht = (e, t) => { if (Number.isSafeInteger(e)) e < 0 ? Wt(e, t) : Ut(e, t); else throw Error(`cannot encode number outside of javascript safe integer range`); return t; }, Ut = (e, t) => { t[0] = 128; for (var n = t.length; n > 1; n--) t[n - 1] = e & 255, e = Math.floor(e / 256); }, Wt = (e, t) => { t[0] = 255; var n = !1; e *= -1; for (var r = t.length; r > 1; r--) { var i = e & 255; e = Math.floor(e / 256), n ? t[r - 1] = Jt(i) : i === 0 ? t[r - 1] = 0 : (n = !0, t[r - 1] = Yt(i)); } }, Gt = (e) => { let t = e[0], n = t === 128 ? qt(e.subarray(1, e.length)) : t === 255 ? Kt(e) : null; if (n === null) throw Error(`invalid base256 encoding`); if (!Number.isSafeInteger(n)) throw Error(`parsed number outside of javascript safe integer range`); return n; }, Kt = (e) => { for (var t = e.length, n = 0, r = !1, i = t - 1; i > -1; i--) { var a = Number(e[i]), o; r ? o = Jt(a) : a === 0 ? o = a : (r = !0, o = Yt(a)), o !== 0 && (n -= o * 256 ** (t - i - 1)); } return n; }, qt = (e) => { for (var t = e.length, n = 0, r = t - 1; r > -1; r--) { var i = Number(e[r]); i !== 0 && (n += i * 256 ** (t - r - 1)); } return n; }, Jt = (e) => (255 ^ e) & 255, Yt = (e) => (255 ^ e) + 1 & 255, Xt = {}; ue(Xt, { code: () => tn, isCode: () => Zt, isName: () => Qt, name: () => en, normalFsTypes: () => $t }); var Zt = (e) => en.has(e), Qt = (e) => tn.has(e), $t = /* @__PURE__ */ new Set([ `0`, ``, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `D` ]), en = /* @__PURE__ */ new Map([ [`0`, `File`], [``, `OldFile`], [`1`, `Link`], [`2`, `SymbolicLink`], [`3`, `CharacterDevice`], [`4`, `BlockDevice`], [`5`, `Directory`], [`6`, `FIFO`], [`7`, `ContiguousFile`], [`g`, `GlobalExtendedHeader`], [`x`, `ExtendedHeader`], [`A`, `SolarisACL`], [`D`, `GNUDumpDir`], [`I`, `Inode`], [`K`, `NextFileHasLongLinkpath`], [`L`, `NextFileHasLongPath`], [`M`, `ContinuationFile`], [`N`, `OldGnuLongPath`], [`S`, `SparseFile`], [`V`, `TapeVolumeHeader`], [`X`, `OldExtendedHeader`] ]), tn = new Map(Array.from(en).map((e) => [e[1], e[0]])), nn = (e) => e === void 0 || e < 0 ? void 0 : e, I = class { cksumValid = !1; needPax = !1; nullBlock = !1; block; path; mode; uid; gid; size; cksum; #t = `Unsupported`; linkpath; uname; gname; devmaj = 0; devmin = 0; atime; ctime; mtime; charset; comment; constructor(e, t = 0, n, r) { Buffer.isBuffer(e) ? this.decode(e, t || 0, n, r) : e && this.#i(e); } decode(e, t, n, r) { if (t ||= 0, !e || !(e.length >= t + 512)) throw Error(`need 512 bytes for header`); let i = an(e, t + 156, 1), a = $t.has(i), o = a ? n : void 0, s = a ? r : void 0; if (this.path = o?.path ?? an(e, t, 100), this.mode = o?.mode ?? s?.mode ?? cn(e, t + 100, 8), this.uid = o?.uid ?? s?.uid ?? cn(e, t + 108, 8), this.gid = o?.gid ?? s?.gid ?? cn(e, t + 116, 8), this.size = nn(o?.size ?? s?.size ?? cn(e, t + 124, 12)), this.mtime = o?.mtime ?? s?.mtime ?? on(e, t + 136, 12), this.cksum = cn(e, t + 148, 12), s && this.#i(s, !0), o && this.#i(o), Zt(i) && (this.#t = i || `0`), this.#t === `0` && this.path.slice(-1) === `/` && (this.#t = `5`), this.#t === `5` && (this.size = 0), this.linkpath = an(e, t + 157, 100), e.subarray(t + 257, t + 265).toString() === `ustar\x0000`) if (this.uname = o?.uname ?? s?.uname ?? an(e, t + 265, 32), this.gname = o?.gname ?? s?.gname ?? an(e, t + 297, 32), this.devmaj = o?.devmaj ?? s?.devmaj ?? cn(e, t + 329, 8) ?? 0, this.devmin = o?.devmin ?? s?.devmin ?? cn(e, t + 337, 8) ?? 0, e[t + 475] !== 0) { let n = an(e, t + 345, 155); this.path = n + `/` + this.path; } else { let i = an(e, t + 345, 130); i && (this.path = i + `/` + this.path), this.atime = n?.atime ?? r?.atime ?? on(e, t + 476, 12), this.ctime = n?.ctime ?? r?.ctime ?? on(e, t + 488, 12); } let c = 256; for (let n = t; n < t + 148; n++) c += e[n]; for (let n = t + 156; n < t + 512; n++) c += e[n]; this.cksumValid = c === this.cksum, this.cksum === void 0 && c === 256 && (this.nullBlock = !0); } #i(e, t = !1) { Object.assign(this, Object.fromEntries(Object.entries(e).filter(([e, n]) => !(n == null || e === `size` && Number(n) < 0 || e === `path` && t || e === `linkpath` && t || e === `global`)))); } encode(e, t = 0) { if (e ||= this.block = Buffer.alloc(512), this.#t === `Unsupported` && (this.#t = `0`), !(e.length >= t + 512)) throw Error(`need 512 bytes for header`); let n = this.ctime || this.atime ? 130 : 155, r = rn(this.path || ``, n), i = r[0], a = r[1]; this.needPax = !!r[2], this.needPax = vn(e, t, 100, i) || this.needPax, this.needPax = fn(e, t + 100, 8, this.mode) || this.needPax, this.needPax = fn(e, t + 108, 8, this.uid) || this.needPax, this.needPax = fn(e, t + 116, 8, this.gid) || this.needPax, this.needPax = fn(e, t + 124, 12, this.size) || this.needPax, this.needPax = gn(e, t + 136, 12, this.mtime) || this.needPax, e[t + 156] = Number(this.#t.codePointAt(0)), this.needPax = vn(e, t + 157, 100, this.linkpath) || this.needPax, e.write(`ustar\x0000`, t + 257, 8), this.needPax = vn(e, t + 265, 32, this.uname) || this.needPax, this.needPax = vn(e, t + 297, 32, this.gname) || this.needPax, this.needPax = fn(e, t + 329, 8, this.devmaj) || this.needPax, this.needPax = fn(e, t + 337, 8, this.devmin) || this.needPax, this.needPax = vn(e, t + 345, n, a) || this.needPax, e[t + 475] === 0 ? (this.needPax = vn(e, t + 345, 130, a) || this.needPax, this.needPax = gn(e, t + 476, 12, this.atime) || this.needPax, this.needPax = gn(e, t + 488, 12, this.ctime) || this.needPax) : this.needPax = vn(e, t + 345, 155, a) || this.needPax; let o = 256; for (let n = t; n < t + 148; n++) o += e[n]; for (let n = t + 156; n < t + 512; n++) o += e[n]; return this.cksum = o, fn(e, t + 148, 8, this.cksum), this.cksumValid = !0, this.needPax; } get type() { return this.#t === `Unsupported` ? this.#t : en.get(this.#t); } get typeKey() { return this.#t; } set type(e) { let t = String(tn.get(e)); if (Zt(t) || t === `Unsupported`) this.#t = t; else if (Zt(e)) this.#t = e; else throw TypeError(`invalid entry type: ` + e); } }, rn = (e, t) => { let n = e, r = ``, i, a = s.parse(e).root || `.`; if (Buffer.byteLength(n) < 100) i = [ n, r, !1 ]; else { r = s.dirname(n), n = s.basename(n); do Buffer.byteLength(n) <= 100 && Buffer.byteLength(r) <= t ? i = [ n, r, !1 ] : Buffer.byteLength(n) > 100 && Buffer.byteLength(r) <= t ? i = [ n.slice(0, 99), r, !0 ] : (n = s.join(s.basename(r), n), r = s.dirname(r)); while (r !== a && i === void 0); i ||= [ e.slice(0, 99), ``, !0 ]; } return i; }, an = (e, t, n) => e.subarray(t, t + n).toString(`utf8`).replace(/\0.*/, ``), on = (e, t, n) => sn(cn(e, t, n)), sn = (e) => e === void 0 ? void 0 : /* @__PURE__ */ new Date(e * 1e3), cn = (e, t, n) => Number(e[t]) & 128 ? Gt(e.subarray(t, t + n)) : un(e, t, n), ln = (e) => isNaN(e) ? void 0 : e, un = (e, t, n) => ln(parseInt(e.subarray(t, t + n).toString(`utf8`).replace(/\0.*$/, ``).trim(), 8)), dn = { 12: 8589934591, 8: 2097151 }, fn = (e, t, n, r) => r === void 0 ? !1 : r > dn[n] || r < 0 ? (Ht(r, e.subarray(t, t + n)), !0) : (pn(e, t, n, r), !1), pn = (e, t, n, r) => e.write(mn(r, n), t, n, `ascii`), mn = (e, t) => hn(Math.floor(e).toString(8), t), hn = (e, t) => (e.length === t - 1 ? e : Array(t - e.length - 1).join(`0`) + e + ` `) + `\0`, gn = (e, t, n, r) => r !== void 0 && fn(e, t, n, r.getTime() / 1e3), _n = Array(156).join(`\0`), vn = (e, t, n, r) => r === void 0 ? !1 : (e.write(r + _n, t, n, `utf8`), r.length !== Buffer.byteLength(r) || r.length > n), yn = class e { atime; mtime; ctime; charset; comment; gid; uid; gname; uname; linkpath; dev; ino; nlink; path; size; mode; global; constructor(e, t = !1) { this.atime = e.atime, this.charset = e.charset, this.comment = e.comment, this.ctime = e.ctime, this.dev = e.dev, this.gid = e.gid, this.global = t, this.gname = e.gname, this.ino = e.ino, this.linkpath = e.linkpath, this.mtime = e.mtime, this.nlink = e.nlink, this.path = e.path, this.size = e.size, this.uid = e.uid, this.uname = e.uname; } encode() { let e = this.encodeBody(); if (e === ``) return Buffer.allocUnsafe(0); let t = Buffer.byteLength(e), n = 512 * Math.ceil(1 + t / 512), r = Buffer.allocUnsafe(n); for (let e = 0; e < 512; e++) r[e] = 0; new I({ path: (`PaxHeader/` + a(this.path ?? ``)).slice(0, 99), mode: this.mode || 420, uid: this.uid, gid: this.gid, size: t, mtime: this.mtime, type: this.global ? `GlobalExtendedHeader` : `ExtendedHeader`, linkpath: ``, uname: this.uname || ``, gname: this.gname || ``, devmaj: 0, devmin: 0, atime: this.atime, ctime: this.ctime }).encode(r), r.write(e, 512, t, `utf8`); for (let e = t + 512; e < r.length; e++) r[e] = 0; return r; } encodeBody() { return this.encodeField(`path`) + this.encodeField(`ctime`) + this.encodeField(`atime`) + this.encodeField(`dev`) + this.encodeField(`ino`) + this.encodeField(`nlink`) + this.encodeField(`charset`) + this.encodeField(`comment`) + this.encodeField(`gid`) + this.encodeField(`gname`) + this.encodeField(`linkpath`) + this.encodeField(`mtime`) + this.encodeField(`size`) + this.encodeField(`uid`) + this.encodeField(`uname`); } encodeField(e) { if (this[e] === void 0) return ``; let t = this[e], n = t instanceof Date ? t.getTime() / 1e3 : t, r = ` ` + (e === `dev` || e === `ino` || e === `nlink` ? `SCHILY.` : ``) + e + `=` + n + ` `, i = Buffer.byteLength(r), a = Math.floor(Math.log(i) / Math.log(10)) + 1; return i + a >= 10 ** a && (a += 1), a + i + r; } static parse(t, n, r = !1) { return new e(bn(xn(t), n), r); } }, bn = (e, t) => t ? Object.assign({}, t, e) : e, xn = (e) => e.replace(/\n$/, ``).split(` `).reduce(Sn, Object.create(null)), Sn = (e, t) => { let n = parseInt(t, 10); if (n !== Buffer.byteLength(t) + 1) return e; t = t.slice((n + ` `).length); let r = t.split(`=`), i = r.shift(); if (!i) return e; let a = i.replace(/^SCHILY\.(dev|ino|nlink)/, `$1`), o = r.join(`=`).replace(/\0.*/, ``); switch (a) { case `path`: case `linkpath`: case `type`: case `charset`: case `comment`: case `gname`: case `uname`: e[a] = o; break; case `ctime`: case `atime`: case `mtime`: e[a] = /* @__PURE__ */ new Date(Number(o) * 1e3); break; case `size`: let t = +o; t >= 0 && (e[a] = t); break; case `gid`: case `uid`: case `dev`: case `ino`: case `nlink`: case `mode`: e[a] = +o; break; } return e; }, L = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === `win32` ? (e) => String(e).replaceAll(/\\/g, `/`) : (e) => String(e), Cn = class extends Ue { extended; globalExtended; header; startBlockSize; blockRemain; remain; type; meta = !1; ignore = !1; path; mode; uid; gid; uname; gname; size = 0; mtime; atime; ctime; linkpath; dev; ino; nlink; invalid = !1; absolute; unsupported = !1; constructor(e, t, n) { switch (super({}), this.pause(), this.extended = t, this.globalExtended = n, this.header = e, this.remain = e.size ?? 0, this.startBlockSize = 512 * Math.ceil(this.remain / 512), this.blockRemain = this.startBlockSize, this.type = e.type, this.type) { case `File`: case `OldFile`: case `Link`: case `SymbolicLink`: case `CharacterDevice`: case `BlockDevice`: case `Directory`: case `FIFO`: case `ContiguousFile`: case `GNUDumpDir`: break; case `NextFileHasLongLinkpath`: case `NextFileHasLongPath`: case `OldGnuLongPath`: case `GlobalExtendedHeader`: case `ExtendedHeader`: case `OldExtendedHeader`: this.meta = !0; break; default: this.ignore = !0; } if (!e.path) throw Error(`no path provided for tar.ReadEntry`); this.path = L(e.path), this.mode = e.mode, this.mode && (this.mode &= 4095), this.uid = e.uid, this.gid = e.gid, this.uname = e.uname, this.gname = e.gname, this.size = this.remain, this.mtime = e.mtime, this.atime = e.atime, this.ctime = e.ctime, this.linkpath = e.linkpath ? L(e.linkpath) : void 0, this.uname = e.uname, this.gname = e.gname, t && this.#t(t), n && this.#t(n, !0); } write(e) { let t = e.length; if (t > this.blockRemain) throw Error(`writing more to entry than is appropriate`); let n = this.remain, r = this.blockRemain; return this.remain = Math.max(0, n - t), this.blockRemain = Math.max(0, r - t), this.ignore ? !0 : n >= t ? super.write(e) : super.write(e.subarray(0, n)); } #t(e, t = !1) { e.path &&= L(e.path), e.linkpath &&= L(e.linkpath), Object.assign(this, Object.fromEntries(Object.entries(e).filter(([e, n]) => !(n == null || e === `path` && t)))); } }, wn = (e, t, n, r = {}) => { e.file && (r.file = e.file), e.cwd && (r.cwd = e.cwd), r.code = n instanceof Error && n.code || t, r.tarCode = t, !e.strict && r.recoverable !== !1 ? (n instanceof Error && (r = Object.assign(n, r), n = n.message), e.emit(`warn`, t, n, r)) : n instanceof Error ? e.emit(`error`, Object.assign(n, r)) : e.emit(`error`, Object.assign(Error(`${t}: ${n}`), r)); }, Tn = 1024 * 1024, En = Buffer.from([31, 139]), Dn = Buffer.from([ 40, 181, 47, 253 ]), On = Math.max(En.length, Dn.length), R = Symbol(`state`), kn = Symbol(`writeEntry`), z = Symbol(`readEntry`), An = Symbol(`nextEntry`), jn = Symbol(`processEntry`), B = Symbol(`extendedHeader`), Mn = Symbol(`globalExtendedHeader`), V = Symbol(`meta`), Nn = Symbol(`emitMeta`), H = Symbol(`buffer`), U = Symbol(`queue`), W = Symbol(`ended`), Pn = Symbol(`emittedEnd`), Fn = Symbol(`emit`), G = Symbol(`unzip`), In = Symbol(`consumeChunk`), Ln = Symbol(`consumeChunkSub`), Rn = Symbol(`consumeBody`), zn = Symbol(`consumeMeta`), Bn = Symbol(`consumeHeader`), Vn = Symbol(`consuming`), Hn = Symbol(`bufferConcat`), Un = Symbol(`maybeEnd`), Wn = Symbol(`writing`), K = Symbol(`aborted`), Gn = Symbol(`onDone`), Kn = Symbol(`sawValidEntry`), qn = Symbol(`sawNullBlock`), Jn = Symbol(`sawEOF`), Yn = Symbol(`closeStream`), Xn = 1e3, Zn = Symbol(`compressedBytesRead`), Qn = Symbol(`decompressedBytesRead`), $n = Symbol(`checkDecompressionRatio`), er = () => !0, tr = class extends u { file; strict; maxMetaEntrySize; filter; brotli; zstd; maxDecompressionRatio; writable = !0; readable = !1; [U] = []; [H]; [z]; [kn]; [R] = `begin`; [V] = ``; [B]; [Mn]; [W] = !1; [G]; [K] = !1; [Kn]; [qn] = !1; [Jn] = !1; [Wn] = !1; [Vn] = !1; [Pn] = !1; [Zn] = 0; [Qn] = 0; constructor(e = {}) { super(), this.file = e.file || ``, this.on(Gn, () => { (this[R] === `begin` || this[Kn] === !1) && this.warn(`TAR_BAD_ARCHIVE`, `Unrecognized archive format`); }), e.ondone ? this.on(Gn, e.ondone) : this.on(Gn, () => { this.emit(`prefinish`), this.emit(`finish`), this.emit(`end`); }), this.strict = !!e.strict, this.maxDecompressionRatio = typeof e.maxDecompressionRatio == `number` ? e.maxDecompressionRatio : Xn, this.maxMetaEntrySize = e.maxMetaEntrySize || Tn, this.filter = typeof e.filter == `function` ? e.filter : er; let t = e.file && (e.file.endsWith(`.tar.br`) || e.file.endsWith(`.tbr`)); this.brotli = !(e.gzip || e.zstd) && e.brotli !== void 0 ? e.brotli : t ? void 0 : !1; let n = e.file && (e.file.endsWith(`.tar.zst`) || e.file.endsWith(`.tzst`)); this.zstd = !(e.gzip || e.brotli) && e.zstd !== void 0 ? e.zstd : n ? !0 : void 0, this.on(`end`, () => this[Yn]()), typeof e.onwarn == `function` && this.on(`warn`, e.onwarn), typeof e.onReadEntry == `function` && this.on(`entry`, e.onReadEntry); } warn(e, t, n = {}) { wn(this, e, t, n); } [Bn](e, t) { this[Kn] === void 0 && (this[Kn] = !1); let n; try { n = new I(e, t, this[B], this[Mn]); } catch (e) { return this.warn(`TAR_ENTRY_INVALID`, e); } if (n.nullBlock) this[qn] ? (this[Jn] = !0, this[R] === `begin` && (this[R] = `header`), this[Fn](`eof`)) : (this[qn] = !0, this[Fn](`nullBlock`)); else if (this[qn] = !1, !n.cksumValid) this.warn(`TAR_ENTRY_INVALID`, `checksum failure`, { header: n }); else if (!n.path) this.warn(`TAR_ENTRY_INVALID`, `path is required`, { header: n }); else { let e = n.type; if (/^(Symbolic)?Link$/.test(e) && !n.linkpath) this.warn(`TAR_ENTRY_INVALID`, `linkpath required`, { header: n }); else if (!/^(Symbolic)?Link$/.test(e) && !/^(Global)?ExtendedHeader$/.test(e) && n.linkpath) this.warn(`TAR_ENTRY_INVALID`, `linkpath forbidden`, { header: n }); else { let e = this[kn] = new Cn(n, this[B], this[Mn]); this[Kn] || (e.remain ? e.on(`end`, () => { e.invalid || (this[Kn] = !0); }) : this[Kn] = !0), e.meta ? e.size > this.maxMetaEntrySize ? (e.ignore = !0, this[Fn](`ignoredEntry`, e), this[R] = `ignore`, e.resume()) : e.size > 0 && (this[V] = ``, e.on(`data`, (e) => this[V] += e), this[R] = `meta`) : (this[B] = void 0, e.ignore = e.ignore || !this.filter(e.path, e), e.ignore ? (this[Fn](`ignoredEntry`, e), this[R] = e.remain ? `ignore` : `header`, e.resume()) : (e.remain ? this[R] = `body` : (this[R] = `header`, e.end()), this[z] ? this[U].push(e) : (this[U].push(e), this[An]()))); } } } [Yn]() { queueMicrotask(() => this.emit(`close`)); } [jn](e) { let t = !0; if (!e) this[z] = void 0, t = !1; else if (Array.isArray(e)) { let [t, ...n] = e; this.emit(t, ...n); } else this[z] = e, this.emit(`entry`, e), e.emittedEnd || (e.on(`end`, () => this[An]()), t = !1); return t; } [An]() { do ; while (this[jn](this[U].shift())); if (this[U].length === 0) { let e = this[z]; !e || e.flowing || e.size === e.remain ? this[Wn] || this.emit(`drain`) : e.once(`drain`, () => this.emit(`drain`)); } } [Rn](e, t) { let n = this[kn]; if (!n) throw Error(`attempt to consume body without entry??`); let r = n.blockRemain ?? 0, i = r >= e.length && t === 0 ? e : e.subarray(t, t + r); return n.write(i), n.blockRemain || (this[R] = `header`, this[kn] = void 0, n.end()), i.length; } [zn](e, t) { let n = this[kn], r = this[Rn](e, t); return !this[kn] && n && this[Nn](n), r; } [Fn](e, t, n) { this[U].length === 0 && !this[z] ? this.emit(e, t, n) : this[U].push([ e, t, n ]); } [Nn](e) { switch (this[Fn](`meta`, this[V]), e.type) { case `ExtendedHeader`: case `OldExtendedHeader`: this[B] = yn.parse(this[V], this[B], !1); break; case `GlobalExtendedHeader`: this[Mn] = yn.parse(this[V], this[Mn], !0); break; case `NextFileHasLongPath`: case `OldGnuLongPath`: { let e = this[B] ?? Object.create(null); this[B] = e, e.path = this[V].replace(/\0.*/, ``); break; } case `NextFileHasLongLinkpath`: { let e = this[B] || Object.create(null); this[B] = e, e.linkpath = this[V].replace(/\0.*/, ``); break; } default: throw Error(`unknown meta: ` + e.type); } } abort(e) { if (!this[K]) { if (this[G]) { let e = this[G]; e.write = () => !0, e.end = () => e, e.emit = () => !1, e.destroy?.(); } this[K] = !0, this.emit(`abort`, e), this.warn(`TAR_ABORT`, e, { recoverable: !1 }); } } [$n](e) { this[Qn] += e.length; let t = this[Qn] / this[Zn]; return t > this.maxDecompressionRatio ? (this.abort(Error(`max decompression ratio exceeded: ${t.toFixed(2)} > ${this.maxDecompressionRatio}`)), !1) : !0; } write(e, t, n) { if (typeof t == `function` && (n = t, t = void 0), typeof e == `string` && (e = Buffer.from(e, typeof t == `string` ? t : `utf8`)), this[K]) return n?.(), !1; if ((this[G] === void 0 || this.brotli === void 0 && this[G] === !1) && e) { if (this[H] && (e = Buffer.concat([this[H], e]), this[H] = void 0), e.length < On) return this[H] = e, n?.(), !0; for (let t = 0; this[G] === void 0 && t < En.length; t++) e[t] !== En[t] && (this[G] = !1); let t = !1; if (this[G] === !1 && this.zstd !== !1) { t = !0; for (let n = 0; n < Dn.length; n++) if (e[n] !== Dn[n]) { t = !1; break; } } let r = this.brotli === void 0 && !t; if (this[G] === !1 && r) if (e.length < 512) if (this[W]) this.brotli = !0; else return this[H] = e, n?.(), !0; else try { new I(e.subarray(0, 512)), this.brotli = !1; } catch { this.brotli = !0; } if (this[G] === void 0 || this[G] === !1 && (this.brotli || t)) { let r = this[W]; this[W] = !1, this[G] = this[G] === void 0 ? new Ft({}) : t ? new Vt({}) : new Rt({}), this[G].on(`data`, (e) => { this[$n](e) && this[In](e); }), this[G].on(`error`, (e) => { this[K] || this.abort(e); }), this[G].on(`end`, () => { this[W] = !0, this[In](); }), this[Wn] = !0, this[Zn] += e.length; let i = !!this[G][r ? `end` : `write`](e); return this[Wn] = !1, n?.(), i; } } this[Wn] = !0, this[G] ? (this[Zn] += e.length, this[G].write(e)) : this[In](e), this[Wn] = !1; let r = this[U].length > 0 ? !1 : !this[z] || this[z].flowing; return !r && this[U].length === 0 && this[z]?.once(`drain`, () => this.emit(`drain`)), n?.(), r; } [Hn](e) { e && !this[K] && (this[H] = this[H] ? Buffer.concat([this[H], e]) : e); } [Un]() { if (this[W] && !this[Pn] && !this[K] && !this[Vn]) { this[Pn] = !0; let e = this[kn]; if (e?.blockRemain) { let t = this[H] ? this[H].length : 0; this.warn(`TAR_BAD_ARCHIVE`, `Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`, { entry: e }), this[H] && e.write(this[H]), e.end(); } this[Fn](Gn); } } [In](e) { if (this[Vn] && e) this[Hn](e); else if (!e && !this[H]) this[Un](); else if (e) { if (this[Vn] = !0, this[H]) { this[Hn](e); let t = this[H]; this[H] = void 0, this[Ln](t); } else this[Ln](e); for (; this[H] && this[H]?.length >= 512 && !this[K] && !this[Jn];) { let e = this[H]; this[H] = void 0, this[Ln](e); } this[Vn] = !1; } (!this[H] || this[W]) && this[Un](); } [Ln](e) { let t = 0, n = e.length; for (; t + 512 <= n && !this[K] && !this[Jn];) switch (this[R]) { case `begin`: case `header`: this[Bn](e, t), t += 512; break; case `ignore`: case `body`: t += this[Rn](e, t); break; case `meta`: t += this[zn](e, t); break; default: throw Error(`invalid state: ` + this[R]); } t < n && (this[H] = this[H] ? Buffer.concat([e.subarray(t), this[H]]) : e.subarray(t)); } end(e, t, n) { return typeof e == `function` && (n = e, t = void 0, e = void 0), typeof t == `function` && (n = t, t = void 0), typeof e == `string` && (e = Buffer.from(e, t)), n && this.once(`finish`, n), this[K] || (this[G] ? (e && (this[Zn] += e.length, this[G].write(e)), this[G].end()) : (this[W] = !0, (this.brotli === void 0 || this.zstd === void 0) && (e ||= Buffer.alloc(0)), e && this.write(e), this[Un]())), this; } }, nr = (e) => { let t = e.length - 1, n = -1; for (; t > -1 && e.charAt(t) === `/`;) n = t, t--; return n === -1 ? e : e.slice(0, n); }, rr = (e) => { let t = e.onReadEntry; e.onReadEntry = t ? (e) => { t(e), e.resume(); } : (e) => e.resume(); }, ir = (e, t) => { let n = new Map(t.map((e) => [nr(e), !0])), r = e.filter, i = (e, t = ``, r = 0) => { if (r >= 100) return n.set(e, !1), !1; let a = t || te(e).root || `.`, o; if (e === a) o = !1; else { let t = n.get(e); o = t === void 0 ? i(m(e), a, r + 1) : t; } return n.set(e, o), o; }; e.filter = r ? (e, t) => r(e, t) && i(nr(e)) : (e) => i(nr(e)); }, ar = Ct((e) => { let n = new tr(e), r = e.file, i; try { i = t.openSync(r, `r`); let a = t.fstatSync(i), o = e.maxReadSize || 16 * 1024 * 1024; if (a.size < o) { let e = Buffer.allocUnsafe(a.size), r = t.readSync(i, e, 0, a.size, 0); n.end(r === e.byteLength ? e : e.subarray(0, r)); } else { let e = 0, r = Buffer.allocUnsafe(o); for (; e < a.size;) { let a = t.readSync(i, r, 0, o, e); if (a === 0) break; e += a, n.write(r.subarray(0, a)); } n.end(); } } finally { if (typeof i == `number`) try { t.closeSync(i); } catch {} } }, (e, n) => { let r = new tr(e), i = e.maxReadSize || 16 * 1024 * 1024, a = e.file; return new Promise((e, n) => { r.on(`error`, n), r.on(`end`, e), t.stat(a, (e, t) => { if (e) n(e); else { let e = new dt(a, { readSize: i, size: t.size }); e.on(`error`, n), e.pipe(r); } }); }); }, (e) => new tr(e), (e) => new tr(e), (e, t) => { t?.length && ir(e, t), e.noResume || rr(e); }), or = (e, t, n) => (e &= 4095, n && (e = (e | 384) & -19), t && (e & 256 && (e |= 64), e & 32 && (e |= 8), e & 4 && (e |= 1)), e), { isAbsolute: sr, parse: cr } = c, lr = (e) => { let t = ``, n = cr(e); for (; sr(e) || n.root;) { let r = e.charAt(0) === `/` && e.slice(0, 4) !== `//?/` ? `/` : n.root; e = e.slice(r.length), t += r, n = cr(e); } return [t, e]; }, ur = [ `|`, `<`, `>`, `?`, `:` ], dr = ur.map((e) => String.fromCodePoint(61440 + Number(e.codePointAt(0)))), fr = new Map(ur.map((e, t) => [e, dr[t]])), pr = new Map(dr.map((e, t) => [e, ur[t]])), mr = (e) => ur.reduce((e, t) => e.split(t).join(fr.get(t)), e), hr = (e) => dr.reduce((e, t) => e.split(t).join(pr.get(t)), e), gr = (e, t) => t ? (e = L(e).replace(/^\.(\/|$)/, ``), nr(t) + `/` + e) : L(e), _r = 16 * 1024 * 1024, vr = Symbol(`process`), yr = Symbol(`file`), br = Symbol(`directory`), xr = Symbol(`symlink`), Sr = Symbol(`hardlink`), Cr = Symbol(`header`), wr = Symbol(`read`), Tr = Symbol(`lstat`), Er = Symbol(`onlstat`), Dr = Symbol(`onread`), Or = Symbol(`onreadlink`), kr = Symbol(`openfile`), Ar = Symbol(`onopenfile`), q = Symbol(`close`), jr = Symbol(`mode`), Mr = Symbol(`awaitDrain`), Nr = Symbol(`ondrain`), J = Symbol(`prefix`), Pr = class extends Ue { path; portable; myuid = process.getuid && process.getuid() || 0; myuser = process.env.USER || ``; maxReadSize; linkCache; statCache; preservePaths; cwd; strict; mtime; noPax; noMtime; prefix; fd; blockLen = 0; blockRemain = 0; buf; pos = 0; remain = 0; length = 0; offset = 0; win32; absolute; header; type; linkpath; stat; onWriteEntry; #t = !1; constructor(e, t = {}) { let n = St(t); super(), this.path = L(e), this.portable = !!n.portable, this.maxReadSize = n.maxReadSize || _r, this.linkCache = n.linkCache || /* @__PURE__ */ new Map(), this.statCache = n.statCache || /* @__PURE__ */ new Map(), this.preservePaths = !!n.preservePaths, this.cwd = L(n.cwd || process.cwd()), this.strict = !!n.strict, this.noPax = !!n.noPax, this.noMtime = !!n.noMtime, this.mtime = n.mtime, this.prefix = n.prefix ? L(n.prefix) : void 0, this.onWriteEntry = n.onWriteEntry, typeof n.onwarn == `function` && this.on(`warn`, n.onwarn); let r = !1; if (!this.preservePaths) { let [e, t] = lr(this.path); e && typeof t == `string` && (this.path = t, r = e); } this.win32 = !!n.win32 || process.platform === `win32`, this.win32 && (this.path = hr(this.path.replaceAll(/\\/g, `/`)), e = e.replaceAll(/\\/g, `/`)), this.absolute = L(n.absolute || p.resolve(this.cwd, e)), this.path === `` && (this.path = `./`), r && this.warn(`TAR_ENTRY_INFO`, `stripping ${r} from absolute path`, { entry: this, path: r + this.path }); let i = this.statCache.get(this.absolute); i ? this[Er](i) : this[Tr](); } warn(e, t, n = {}) { return wn(this, e, t, n); } emit(e, ...t) { return e === `error` && (this.#t = !0), super.emit(e, ...t); } [Tr]() { d.lstat(this.absolute, (e, t) => { if (e) return this.emit(`error`, e); this[Er](t); }); } [Er](e) { this.statCache.set(this.absolute, e), this.stat = e, e.isFile() || (e.size = 0), this.type = Lr(e), this.emit(`stat`, e), this[vr](); } [vr]() { switch (this.type) { case `File`: return this[yr](); case `Directory`: return this[br](); case `SymbolicLink`: return this[xr](); default: return this.end(); } } [jr](e) { return or(e, this.type === `Directory`, this.portable); } [J](e) { return gr(e, this.prefix); } [Cr]() { if (!this.stat) throw Error(`cannot write header before stat`); this.type === `Directory` && this.portable && (this.noMtime = !0), this.onWriteEntry?.(this), this.header = new I({ path: this[J](this.path), linkpath: this.type === `Link` && this.linkpath !== void 0 ? this[J](this.linkpath) : this.linkpath, mode: this[jr](this.stat.mode), uid: this.portable ? void 0 : this.stat.uid, gid: this.portable ? void 0 : this.stat.gid, size: this.stat.size, mtime: this.noMtime ? void 0 : this.mtime || this.stat.mtime, type: this.type === `Unsupported` ? void 0 : this.type, uname: this.portable ? void 0 : this.stat.uid === this.myuid ? this.myuser : ``, atime: this.portable ? void 0 : this.stat.atime, ctime: this.portable ? void 0 : this.stat.ctime }), this.header.encode() && !this.noPax && super.write(new yn({ atime: this.portable ? void 0 : this.header.atime, ctime: this.portable ? void 0 : this.header.ctime, gid: this.portable ? void 0 : this.header.gid, mtime: this.noMtime ? void 0 : this.mtime || this.header.mtime, path: this[J](this.path), linkpath: this.type === `Link` && this.linkpath !== void 0 ? this[J](this.linkpath) : this.linkpath, size: this.header.size, uid: this.portable ? void 0 : this.header.uid, uname: this.portable ? void 0 : this.header.uname, dev: this.portable ? void 0 : this.stat.dev, ino: this.portable ? void 0 : this.stat.ino, nlink: this.portable ? void 0 : this.stat.nlink }).encode()); let e = this.header?.block; if (!e) throw Error(`failed to encode header`); super.write(e); } [br]() { if (!this.stat) throw Error(`cannot create directory entry without stat`); this.path.slice(-1) !== `/` && (this.path += `/`), this.stat.size = 0, this[Cr](), this.end(); } [xr]() { d.readlink(this.absolute, (e, t) => { if (e) return this.emit(`error`, e); this[Or](t); }); } [Or](e) { this.linkpath = L(e), this[Cr](), this.end(); } [Sr](e) { if (!this.stat) throw Error(`cannot create link entry without stat`); this.type = `Link`, this.linkpath = L(p.relative(this.cwd, e)), this.stat.size = 0, this[Cr](), this.end(); } [yr]() { if (!this.stat) throw Error(`cannot create file entry without stat`); if (this.stat.nlink > 1) { let e = `${this.stat.dev}:${this.stat.ino}`, t = this.linkCache.get(e); if (t?.indexOf(this.cwd) === 0) return this[Sr](t); this.linkCache.set(e, this.absolute); } if (this[Cr](), this.stat.size === 0) return this.end(); this[kr](); } [kr]() { d.open(this.absolute, `r`, (e, t) => { if (e) return this.emit(`error`, e); this[Ar](t); }); } [Ar](e) { if (this.fd = e, this.#t) return this[q](); if (!this.stat) throw Error(`should stat before calling onopenfile`); this.blockLen = 512 * Math.ceil(this.stat.size / 512), this.blockRemain = this.blockLen; let t = Math.min(this.blockLen, this.maxReadSize); this.buf = Buffer.allocUnsafe(t), this.offset = 0, this.pos = 0, this.remain = this.stat.size, this.length = this.buf.length, this[wr](); } [wr]() { let { fd: e, buf: t, offset: n, length: r, pos: i } = this; if (e === void 0 || t === void 0) throw Error(`cannot read file without first opening`); d.read(e, t, n, r, i, (e, t) => { if (e) return this[q](() => this.emit(`error`, e)); this[Dr](t); }); } [q](e = () => {}) { this.fd !== void 0 && d.close(this.fd, e); } [Dr](e) { if (e <= 0 && this.remain > 0) { let e = Object.assign(Error(`encountered unexpected EOF`), { path: this.absolute, syscall: `read`, code: `EOF` }); return this[q](() => this.emit(`error`, e)); } if (e > this.remain) { let e = Object.assign(Error(`did not encounter expected EOF`), { path: this.absolute, syscall: `read`, code: `EOF` }); return this[q](() => this.emit(`error`, e)); } if (!this.buf) throw Error(`should have created buffer prior to reading`); if (e === this.remain) for (let t = e; t < this.length && e < this.blockRemain; t++) this.buf[t + this.offset] = 0, e++, this.remain++; let t = this.offset === 0 && e === this.buf.length ? this.buf : this.buf.subarray(this.offset, this.offset + e); this.write(t) ? this[Nr]() : this[Mr](() => this[Nr]()); } [Mr](e) { this.once(`drain`, e); } write(e, t, n) { if (typeof t == `function` && (n = t, t = void 0), typeof e == `string` && (e = Buffer.from(e, typeof t == `string` ? t : `utf8`)), this.blockRemain < e.length) { let e = Object.assign(Error(`writing more data than expected`), { path: this.absolute }); return this.emit(`error`, e); } return this.remain -= e.length, this.blockRemain -= e.length, this.pos += e.length, this.offset += e.length, super.write(e, null, n); } [Nr]() { if (!this.remain) return this.blockRemain && super.write(Buffer.alloc(this.blockRemain)), this[q]((e) => e ? this.emit(`error`, e) : this.end()); if (!this.buf) throw Error(`buffer lost somehow in ONDRAIN`); this.offset >= this.length && (this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length)), this.offset = 0), this.length = this.buf.length - this.offset, this[wr](); } }, Fr = class extends Pr { sync = !0; [Tr]() { this[Er](d.lstatSync(this.absolute)); } [xr]() { this[Or](d.readlinkSync(this.absolute)); } [kr]() { this[Ar](d.openSync(this.absolute, `r`)); } [wr]() { let e = !0; try { let { fd: t, buf: n, offset: r, length: i, pos: a } = this; if (t === void 0 || n === void 0) throw Error(`fd and buf must be set in READ method`); let o = d.readSync(t, n, r, i, a); this[Dr](o), e = !1; } finally { if (e) try { this[q](() => {}); } catch {} } } [Mr](e) { e(); } [q](e = () => {}) { this.fd !== void 0 && d.closeSync(this.fd), e(); } }, Ir = class extends Ue { blockLen = 0; blockRemain = 0; buf = 0; pos = 0; remain = 0; length = 0; preservePaths; portable; strict; noPax; noMtime; readEntry; type; prefix; path; mode; uid; gid; uname; gname; header; mtime; atime; ctime; linkpath; size; onWriteEntry; warn(e, t, n = {}) { return wn(this, e, t, n); } constructor(e, t = {}) { let n = St(t); super(), this.preservePaths = !!n.preservePaths, this.portable = !!n.portable, this.strict = !!n.strict, this.noPax = !!n.noPax, this.noMtime = !!n.noMtime, this.onWriteEntry = n.onWriteEntry, this.readEntry = e; let { type: r } = e; if (r === `Unsupported`) throw Error(`writing entry that should be ignored`); this.type = r, this.type === `Directory` && this.portable && (this.noMtime = !0), this.prefix = n.prefix, this.path = L(e.path), this.mode = e.mode === void 0 ? void 0 : this[jr](e.mode), this.uid = this.portable ? void 0 : e.uid, this.gid = this.portable ? void 0 : e.gid, this.uname = this.portable ? void 0 : e.uname, this.gname = this.portable ? void 0 : e.gname, this.size = e.size, this.mtime = this.noMtime ? void 0 : n.mtime || e.mtime, this.atime = this.portable ? void 0 : e.atime, this.ctime = this.portable ? void 0 : e.ctime, this.linkpath = e.linkpath === void 0 ? void 0 : L(e.linkpath), typeof n.onwarn == `function` && this.on(`warn`, n.onwarn); let i = !1; if (!this.preservePaths) { let [e, t] = lr(this.path); e && typeof t == `string` && (this.path = t, i = e); } this.remain = e.size, this.blockRemain = e.startBlockSize, this.onWriteEntry?.(this), this.header = new I({ path: this[J](this.path), linkpath: this.type === `Link` && this.linkpath !== void 0 ? this[J](this.linkpath) : this.linkpath, mode: this.mode, uid: this.portable ? void 0 : this.uid, gid: this.portable ? void 0 : this.gid, size: this.size, mtime: this.noMtime ? void 0 : this.mtime, type: this.type, uname: this.portable ? void 0 : this.uname, atime: this.portable ? void 0 : this.atime, ctime: this.portable ? void 0 : this.ctime }), i && this.warn(`TAR_ENTRY_INFO`, `stripping ${i} from absolute path`, { entry: this, path: i + this.path }), this.header.encode() && !this.noPax && super.write(new yn({ atime: this.portable ? void 0 : this.atime, ctime: this.portable ? void 0 : this.ctime, gid: this.portable ? void 0 : this.gid, mtime: this.noMtime ? void 0 : this.mtime, path: this[J](this.path), linkpath: this.type === `Link` && this.linkpath !== void 0 ? this[J](this.linkpath) : this.linkpath, size: this.size, uid: this.portable ? void 0 : this.uid, uname: this.portable ? void 0 : this.uname, dev: this.portable ? void 0 : this.readEntry.dev, ino: this.portable ? void 0 : this.readEntry.ino, nlink: this.portable ? void 0 : this.readEntry.nlink }).encode()); let a = this.header?.block; if (!a) throw Error(`failed to encode header`); super.write(a), e.pipe(this); } [J](e) { return gr(e, this.prefix); } [jr](e) { return or(e, this.type === `Directory`, this.portable); } write(e, t, n) { typeof t == `function` && (n = t, t = void 0), typeof e == `string` && (e = Buffer.from(e, typeof t == `string` ? t : `utf8`)); let r = e.length; if (r > this.blockRemain) throw Error(`writing more to entry than is appropriate`); return this.blockRemain -= r, super.write(e, n); } end(e, t, n) { return this.blockRemain && super.write(Buffer.alloc(this.blockRemain)), typeof e == `function` && (n = e, t = void 0, e = void 0), typeof t == `function` && (n = t, t = void 0), typeof e == `string` && (e = Buffer.from(e, t ?? `utf8`)), n && this.once(`finish`, n), e ? super.end(e, n) : super.end(n), this; } }, Lr = (e) => e.isFile() ? `File` : e.isDirectory() ? `Directory` : e.isSymbolicLink() ? `SymbolicLink` : `Unsupported`, Rr = class e { tail; head; length = 0; static create(t = []) { return new e(t); } constructor(e = []) { for (let t of e) this.push(t); } *[Symbol.iterator]() { for (let e = this.head; e; e = e.next) yield e.value; } removeNode(e) { if (e.list !== this) throw Error(`removing node which does not belong to this list`); let t = e.next, n = e.prev; return t && (t.prev = n), n && (n.next = t), e === this.head && (this.head = t), e === this.tail && (this.tail = n), this.length--, e.next = void 0, e.prev = void 0, e.list = void 0, t; } unshiftNode(e) { if (e === this.head) return; e.list && e.list.removeNode(e); let t = this.head; e.list = this, e.next = t, t && (t.prev = e), this.head = e, this.tail ||= e, this.length++; } pushNode(e) { if (e === this.tail) return; e.list && e.list.removeNode(e); let t = this.tail; e.list = this, e.prev = t, t && (t.next = e), this.tail = e, this.head ||= e, this.length++; } push(...e) { for (let t = 0, n = e.length; t < n; t++) Br(this, e[t]); return this.length; } unshift(...e) { for (var t = 0, n = e.length; t < n; t++) Vr(this, e[t]); return this.length; } pop() { if (!this.tail) return; let e = this.tail.value, t = this.tail; return this.tail = this.tail.prev, this.tail ? this.tail.next = void 0 : this.head = void 0, t.list = void 0, this.length--, e; } shift() { if (!this.head) return; let e = this.head.value, t = this.head; return this.head = this.head.next, this.head ? this.head.prev = void 0 : this.tail = void 0, t.list = void 0, this.length--, e; } forEach(e, t) { t ||= this; for (let n = this.head, r = 0; n; r++) e.call(t, n.value, r, this), n = n.next; } forEachReverse(e, t) { t ||= this; for (let n = this.tail, r = this.length - 1; n; r--) e.call(t, n.value, r, this), n = n.prev; } get(e) { let t = 0, n = this.head; for (; n && t < e; t++) n = n.next; if (t === e && n) return n.value; } getReverse(e) { let t = 0, n = this.tail; for (; n && t < e; t++) n = n.prev; if (t === e && n) return n.value; } map(t, n) { n ||= this; let r = new e(); for (let e = this.head; e;) r.push(t.call(n, e.value, this)), e = e.next; return r; } mapReverse(t, n) { n ||= this; var r = new e(); for (let e = this.tail; e;) r.push(t.call(n, e.value, this)), e = e.prev; return r; } reduce(e, t) { let n, r = this.head; if (arguments.length > 1) n = t; else if (this.head) r = this.head.next, n = this.head.value; else throw TypeError(`Reduce of empty list with no initial value`); for (var i = 0; r; i++) n = e(n, r.value, i), r = r.next; return n; } reduceReverse(e, t) { let n, r = this.tail; if (arguments.length > 1) n = t; else if (this.tail) r = this.tail.prev, n = this.tail.value; else throw TypeError(`Reduce of empty list with no initial value`); for (let t = this.length - 1; r; t--) n = e(n, r.value, t), r = r.prev; return n; } toArray() { let e = Array(this.length); for (let t = 0, n = this.head; n; t++) e[t] = n.value, n = n.next; return e; } toArrayReverse() { let e = Array(this.length); for (let t = 0, n = this.tail; n; t++) e[t] = n.value, n = n.prev; return e; } slice(t = 0, n = this.length) { n < 0 && (n += this.length), t < 0 && (t += this.length); let r = new e(); if (n < t || n < 0) return r; t < 0 && (t = 0), n > this.length && (n = this.length); let i = this.head, a = 0; for (a = 0; i && a < t; a++) i = i.next; for (; i && a < n; a++, i = i.next) r.push(i.value); return r; } sliceReverse(t = 0, n = this.length) { n < 0 && (n += this.length), t < 0 && (t += this.length); let r = new e(); if (n < t || n < 0) return r; t < 0 && (t = 0), n > this.length && (n = this.length); let i = this.length, a = this.tail; for (; a && i > n; i--) a = a.prev; for (; a && i > t; i--, a = a.prev) r.push(a.value); return r; } splice(e, t = 0, ...n) { e > this.length && (e = this.length - 1), e < 0 && (e = this.length + e); let r = this.head; for (let t = 0; r && t < e; t++) r = r.next; let i = []; for (let e = 0; r && e < t; e++) i.push(r.value), r = this.removeNode(r); r ? r !== this.tail && (r = r.prev) : r = this.tail; for (let e of n) r = zr(this, r, e); return i; } reverse() { let e = this.head, t = this.tail; for (let t = e; t; t = t.prev) { let e = t.prev; t.prev = t.next, t.next = e; } return this.head = t, this.tail = e, this; } }; function zr(e, t, n) { let r = new Hr(n, t, t ? t.next : e.head, e); return r.next === void 0 && (e.tail = r), r.prev === void 0 && (e.head = r), e.length++, r; } function Br(e, t) { e.tail = new Hr(t, e.tail, void 0, e), e.head ||= e.tail, e.length++; } function Vr(e, t) { e.head = new Hr(t, void 0, e.head, e), e.tail ||= e.head, e.length++; } var Hr = class { list; next; prev; value; constructor(e, t, n, r) { this.list = r, this.value = e, t ? (t.next = this, this.prev = t) : this.prev = void 0, n ? (n.prev = this, this.next = n) : this.next = void 0; } }, Ur = class { path; absolute; entry; stat; readdir; pending = !1; pendingLink = !1; ignore = !1; piped = !1; constructor(e, t) { this.path = e || `./`, this.absolute = t; } }, Wr = Buffer.alloc(1024), Gr = Symbol(`onStat`), Kr = Symbol(`ended`), Y = Symbol(`queue`), qr = Symbol(`pendingLinks`), X = Symbol(`current`), Jr = Symbol(`process`), Yr = Symbol(`processing`), Xr = Symbol(`processJob`), Z = Symbol(`jobs`), Zr = Symbol(`jobDone`), Qr = Symbol(`addFSEntry`), $r = Symbol(`addTarEntry`), ei = Symbol(`stat`), ti = Symbol(`readdir`), ni = Symbol(`onreaddir`), ri = Symbol(`pipe`), ii = Symbol(`entry`), ai = Symbol(`entryOpt`), oi = Symbol(`writeEntryClass`), si = Symbol(`write`), ci = Symbol(`ondrain`), li = class extends Ue { sync = !1; opt; cwd; maxReadSize; preservePaths; strict; noPax; prefix; linkCache; statCache; file; portable; zip; readdirCache; noDirRecurse; follow; noMtime; mtime; filter; jobs; [oi]; onWriteEntry; [Y]; [qr] = /* @__PURE__ */ new Map(); [Z] = 0; [Yr] = !1; [Kr] = !1; constructor(e = {}) { if (super(), this.opt = e, this.file = e.file || ``, this.cwd = e.cwd || process.cwd(), this.maxReadSize = e.maxReadSize, this.preservePaths = !!e.preservePaths, this.strict = !!e.strict, this.noPax = !!e.noPax, this.prefix = L(e.prefix || ``), this.linkCache = e.linkCache || /* @__PURE__ */ new Map(), this.statCache = e.statCache || /* @__PURE__ */ new Map(), this.readdirCache = e.readdirCache || /* @__PURE__ */ new Map(), this.onWriteEntry = e.onWriteEntry, this[oi] = Pr, typeof e.onwarn == `function` && this.on(`warn`, e.onwarn), this.portable = !!e.portable, e.gzip || e.brotli || e.zstd) { if (+!!e.gzip + +!!e.brotli + +!!e.zstd > 1) throw TypeError(`gzip, brotli, zstd are mutually exclusive`); if (e.gzip && (typeof e.gzip != `object` && (e.gzip = {}), this.portable && (e.gzip.portable = !0), this.zip = new Pt(e.gzip)), e.brotli && (typeof e.brotli != `object` && (e.brotli = {}), this.zip = new Lt(e.brotli)), e.zstd && (typeof e.zstd != `object` && (e.zstd = {}), this.zip = new Bt(e.zstd)), !this.zip) throw Error(`impossible`); let t = this.zip; t.on(`data`, (e) => super.write(e)), t.on(`end`, () => super.end()), t.on(`drain`, () => this[ci]()), this.on(`resume`, () => t.resume()); } else this.on(`drain`, this[ci]); this.noDirRecurse = !!e.noDirRecurse, this.follow = !!e.follow, this.noMtime = !!e.noMtime, e.mtime && (this.mtime = e.mtime), this.filter = typeof e.filter == `function` ? e.filter : () => !0, this[Y] = new Rr(), this[Z] = 0, this.jobs = Number(e.jobs) || 4, this[Yr] = !1, this[Kr] = !1; } [si](e) { return super.write(e); } add(e) { return this.write(e), this; } end(e, t, n) { return typeof e == `function` && (n = e, e = void 0), typeof t == `function` && (n = t, t = void 0), e && this.add(e), this[Kr] = !0, this[Jr](), n && n(), this; } write(e) { if (this[Kr]) throw Error(`write after end`); return typeof e == `string` ? this[Qr](e) : this[$r](e), this.flowing; } [$r](e) { let t = L(p.resolve(this.cwd, e.path)); if (!this.filter(e.path, e)) e.resume(); else { let n = new Ur(e.path, t); n.entry = new Ir(e, this[ai](n)), n.entry.on(`end`, () => this[Zr](n)), this[Z] += 1, this[Y].push(n); } this[Jr](); } [Qr](e) { let t = L(p.resolve(this.cwd, e)); this[Y].push(new Ur(e, t)), this[Jr](); } [ei](e) { e.pending = !0, this[Z] += 1, d[this.follow ? `stat` : `lstat`](e.absolute, (t, n) => { e.pending = !1, --this[Z], t ? this.emit(`error`, t) : this[Gr](e, n); }); } [Gr](e, t) { if (this.statCache.set(e.absolute, t), e.stat = t, !this.filter(e.path, t)) e.ignore = !0; else if (t.isFile() && t.nlink > 1 && !this.linkCache.get(`${t.dev}:${t.ino}`) && !this.sync) if (e === this[X]) this[Xr](e); else { let n = `${t.dev}:${t.ino}`, r = this[qr].get(n); r ? r.push(e) : this[qr].set(n, [e]), e.pendingLink = !0, e.pending = !0; } this[Jr](); } [ti](e) { e.pending = !0, this[Z] += 1, d.readdir(e.absolute, (t, n) => { if (e.pending = !1, --this[Z], t) return this.emit(`error`, t); this[ni](e, n); }); } [ni](e, t) { this.readdirCache.set(e.absolute, t), e.readdir = t, this[Jr](); } [Jr]() { if (!this[Yr]) { this[Yr] = !0; for (let e = this[Y].head; e && this[Z] < this.jobs; e = e.next) if (this[Xr](e.value), e.value.ignore) { let t = e.next; this[Y].removeNode(e), e.next = t; } this[Yr] = !1, this[Kr] && this[Y].length === 0 && this[Z] === 0 && (this.zip ? this.zip.end(Wr) : (super.write(Wr), super.end())); } } get [X]() { return this[Y] && this[Y].head && this[Y].head.value; } [Zr](e) { this[Y].shift(), --this[Z]; let { stat: t } = e; if (t && t.isFile() && t.nlink > 1) { let e = `${t.dev}:${t.ino}`, n = this[qr].get(e); if (n) { this[qr].delete(e); for (let e of n) e.pending = !1, this[Xr](e); } } this[Jr](); } [Xr](e) { if (e.pending && e.pendingLink && e === this[X] && (e.pending = !1, e.pendingLink = !1), !e.pending) { if (e.entry) { e === this[X] && !e.piped && this[ri](e); return; } if (!e.stat) { let t = this.statCache.get(e.absolute); t ? this[Gr](e, t) : this[ei](e); } if (e.stat && !e.ignore) { if (!this.noDirRecurse && e.stat.isDirectory() && !e.readdir) { let t = this.readdirCache.get(e.absolute); if (t ? this[ni](e, t) : this[ti](e), !e.readdir) return; } if (e.entry = this[ii](e), !e.entry) { e.ignore = !0; return; } e === this[X] && !e.piped && this[ri](e); } } } [ai](e) { return { onwarn: (e, t, n) => this.warn(e, t, n), noPax: this.noPax, cwd: this.cwd, absolute: e.absolute, preservePaths: this.preservePaths, maxReadSize: this.maxReadSize, strict: this.strict, portable: this.portable, linkCache: this.linkCache, statCache: this.statCache, noMtime: this.noMtime, mtime: this.mtime, prefix: this.prefix, onWriteEntry: this.onWriteEntry }; } [ii](e) { this[Z] += 1; try { return new this[oi](e.path, this[ai](e)).on(`end`, () => this[Zr](e)).on(`error`, (e) => this.emit(`error`, e)); } catch (e) { this.emit(`error`, e); } } [ci]() { this[X] && this[X].entry && this[X].entry.resume(); } [ri](e) { e.piped = !0, e.readdir && e.readdir.forEach((t) => { let n = e.path, r = n === `./` ? `` : n.replace(/\/*$/, `/`); this[Qr](r + t); }); let t = e.entry, n = this.zip; if (!t) throw Error(`cannot pipe without source`); n ? t.on(`data`, (e) => { n.write(e) || t.pause(); }) : t.on(`data`, (e) => { super.write(e) || t.pause(); }); } pause() { return this.zip && this.zip.pause(), super.pause(); } warn(e, t, n = {}) { wn(this, e, t, n); } }, ui = class extends li { sync = !0; constructor(e) { super(e), this[oi] = Fr; } pause() {} resume() {} [ei](e) { let t = this.follow ? `statSync` : `lstatSync`; this[Gr](e, d[t](e.absolute)); } [ti](e) { this[ni](e, d.readdirSync(e.absolute)); } [ri](e) { let t = e.entry, n = this.zip; if (e.readdir && e.readdir.forEach((t) => { let n = e.path, r = n === `./` ? `` : n.replace(/\/*$/, `/`); this[Qr](r + t); }), !t) throw Error(`Cannot pipe without source`); n ? t.on(`data`, (e) => { n.write(e); }) : t.on(`data`, (e) => { super[si](e); }); } }, di = (e, t) => { let n = new ui(e), r = new mt(e.file, { mode: e.mode || 438 }); n.pipe(r), pi(n, t); }, fi = (e, t) => { let n = new li(e), r = new pt(e.file, { mode: e.mode || 438 }); n.pipe(r); let i = new Promise((e, t) => { r.on(`error`, t), r.on(`close`, e), n.on(`error`, t); }); return mi(n, t).catch((e) => n.emit(`error`, e)), i; }, pi = (e, t) => { t.forEach((t) => { t.charAt(0) === `@` ? ar({ file: i.resolve(e.cwd, t.slice(1)), sync: !0, noResume: !0, onReadEntry: (t) => e.add(t) }) : e.add(t); }), e.end(); }, mi = async (e, t) => { for (let n of t) n.charAt(0) === `@` ? await ar({ file: i.resolve(String(e.cwd), n.slice(1)), noResume: !0, onReadEntry: (t) => { e.add(t); } }) : e.add(n); e.end(); }, hi = Ct(di, fi, (e, t) => { let n = new ui(e); return pi(n, t), n; }, (e, t) => { let n = new li(e); return mi(n, t).catch((e) => n.emit(`error`, e)), n; }, (e, t) => { if (!t?.length) throw TypeError(`no paths specified to add to archive`); }), gi = (process.env.__FAKE_PLATFORM__ || process.platform) === `win32`, { O_CREAT: _i, O_NOFOLLOW: vi, O_TRUNC: yi, O_WRONLY: bi } = d.constants, xi = Number(process.env.__FAKE_FS_O_FILENAME__) || d.constants.UV_FS_O_FILEMAP || 0, Si = gi && !!xi, Ci = 512 * 1024, wi = xi | yi | _i | bi, Ti = !gi && typeof vi == `number` ? vi | yi | _i | bi : null, Ei = Ti === null ? Si ? (e) => e < Ci ? wi : `w` : () => `w` : () => Ti, Di = (e, n, r) => { try { return t.lchownSync(e, n, r); } catch (e) { if (e?.code !== `ENOENT`) throw e; } }, Oi = (e, n, r, i) => { t.lchown(e, n, r, (e) => { i(e && e?.code !== `ENOENT` ? e : null); }); }, ki = (e, t, n, r, a) => { t.isDirectory() ? Ai(i.resolve(e, t.name), n, r, (o) => { if (o) return a(o); Oi(i.resolve(e, t.name), n, r, a); }) : Oi(i.resolve(e, t.name), n, r, a); }, Ai = (e, n, r, i) => { t.readdir(e, { withFileTypes: !0 }, (t, a) => { if (t) { if (t.code === `ENOENT`) return i(); if (t.code !== `ENOTDIR` && t.code !== `ENOTSUP`) return i(t); } if (t || !a.length) return Oi(e, n, r, i); let o = a.length, s = null, c = (t) => { if (!s) { if (t) return i(s = t); if (--o === 0) return Oi(e, n, r, i); } }; for (let t of a) ki(e, t, n, r, c); }); }, ji = (e, t, n, r) => { t.isDirectory() && Mi(i.resolve(e, t.name), n, r), Di(i.resolve(e, t.name), n, r); }, Mi = (e, n, r) => { let i; try { i = t.readdirSync(e, { withFileTypes: !0 }); } catch (t) { let i = t; if (i?.code === `ENOENT`) return; if (i?.code === `ENOTDIR` || i?.code === `ENOTSUP`) return Di(e, n, r); throw i; } for (let t of i) ji(e, t, n, r); return Di(e, n, r); }, Ni = class extends Error { path; code; syscall = `chdir`; constructor(e, t) { super(`${t}: Cannot cd into '${e}'`), this.path = e, this.code = t; } get name() { return `CwdError`; } }, Pi = class extends Error { path; symlink; syscall = `symlink`; code = `TAR_SYMLINK_ERROR`; constructor(e, t) { super(`TAR_SYMLINK_ERROR: Cannot extract through symbolic link`), this.symlink = e, this.path = t; } get name() { return `SymlinkError`; } }, Fi = (e, n) => { t.stat(e, (t, r) => { (t || !r.isDirectory()) && (t = new Ni(e, t?.code || `ENOTDIR`)), n(t); }); }, Ii = (e, r, a) => { e = L(e); let o = r.umask ?? 18, s = r.mode | 448, c = (s & o) !== 0, l = r.uid, u = r.gid, d = typeof l == `number` && typeof u == `number` && (l !== r.processUid || u !== r.processGid), f = r.preserve, ee = r.unlink, p = L(r.cwd), m = (n, r) => { n ? a(n) : r && d ? Ai(r, l, u, (e) => m(e)) : c ? t.chmod(e, s, a) : a(); }; if (e === p) return Fi(e, m); if (f) return n.mkdir(e, { mode: s, recursive: !0 }).then((e) => m(null, e ?? void 0), m); Li(p, L(i.relative(p, e)).split(`/`), s, ee, p, void 0, m); }, Li = (e, n, r, a, o, s, c) => { if (n.length === 0) return c(null, s); let l = n.shift(), u = L(i.resolve(e + `/` + l)); t.mkdir(u, r, Ri(u, n, r, a, o, s, c)); }, Ri = (e, n, r, i, a, o, s) => (c) => { c ? t.lstat(e, (l, u) => { if (l) l.path = l.path && L(l.path), s(l); else if (u.isDirectory()) Li(e, n, r, i, a, o, s); else if (i) t.unlink(e, (c) => { if (c) return s(c); t.mkdir(e, r, Ri(e, n, r, i, a, o, s)); }); else { if (u.isSymbolicLink()) return s(new Pi(e, e + `/` + n.join(`/`))); s(c); } }) : (o ||= e, Li(e, n, r, i, a, o, s)); }, zi = (e) => { let n = !1, r; try { n = t.statSync(e).isDirectory(); } catch (e) { r = e?.code; } finally { if (!n) throw new Ni(e, r ?? `ENOTDIR`); } }, Bi = (e, n) => { e = L(e); let r = n.umask ?? 18, a = n.mode | 448, o = (a & r) !== 0, s = n.uid, c = n.gid, l = typeof s == `number` && typeof c == `number` && (s !== n.processUid || c !== n.processGid), u = n.preserve, d = n.unlink, f = L(n.cwd), ee = (n) => { n && l && Mi(n, s, c), o && t.chmodSync(e, a); }; if (e === f) return zi(f), ee(); if (u) return ee(t.mkdirSync(e, { mode: a, recursive: !0 }) ?? void 0); let p = L(i.relative(f, e)).split(`/`), m; for (let e = p.shift(), n = f; e && (n += `/` + e); e = p.shift()) { n = L(i.resolve(n)); try { t.mkdirSync(n, a), m ||= n; } catch { let e = t.lstatSync(n); if (e.isDirectory()) continue; if (d) { t.unlinkSync(n), t.mkdirSync(n, a), m ||= n; continue; } else if (e.isSymbolicLink()) return new Pi(n, n + `/` + p.join(`/`)); } } return ee(m); }, Vi = Object.create(null), Hi = 1e4, Ui = /* @__PURE__ */ new Set(), Wi = (e) => { Ui.has(e) ? Ui.delete(e) : Vi[e] = e.normalize(`NFD`).toLocaleLowerCase(`en`).toLocaleUpperCase(`en`), Ui.add(e); let t = Vi[e], n = Ui.size - Hi; if (n > Hi / 10) { for (let e of Ui) if (Ui.delete(e), delete Vi[e], --n <= 0) break; } return t; }, Gi = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === `win32`, Ki = (e) => e.split(`/`).slice(0, -1).reduce((e, t) => { let n = e.at(-1); return n !== void 0 && (t = o(n, t)), e.push(t || `/`), e; }, []), qi = class { #t = /* @__PURE__ */ new Map(); #i = /* @__PURE__ */ new Map(); #s = /* @__PURE__ */ new Set(); reserve(e, t) { e = Gi ? [`win32 parallelization disabled`] : e.map((e) => nr(o(Wi(e)))); let n = new Set(e.map((e) => Ki(e)).reduce((e, t) => e.concat(t))); this.#i.set(t, { dirs: n, paths: e }); for (let n of e) { let e = this.#t.get(n); e ? e.push(t) : this.#t.set(n, [t]); } for (let e of n) { let n = this.#t.get(e); if (!n) this.#t.set(e, [/* @__PURE__ */ new Set([t])]); else { let e = n.at(-1); e instanceof Set ? e.add(t) : n.push(/* @__PURE__ */ new Set([t])); } } return this.#r(t); } #n(e) { let t = this.#i.get(e); if (!t) throw Error(`function does not have any path reservations`); return { paths: t.paths.map((e) => this.#t.get(e)), dirs: [...t.dirs].map((e) => this.#t.get(e)) }; } check(e) { let { paths: t, dirs: n } = this.#n(e); return t.every((t) => t && t[0] === e) && n.every((t) => t && t[0] instanceof Set && t[0].has(e)); } #r(e) { return this.#s.has(e) || !this.check(e) ? !1 : (this.#s.add(e), e(() => this.#e(e)), !0); } #e(e) { if (!this.#s.has(e)) return !1; let t = this.#i.get(e); if (!t) throw Error(`invalid reservation`); let { paths: n, dirs: r } = t, i = /* @__PURE__ */ new Set(); for (let t of n) { let n = this.#t.get(t); if (!n || n?.[0] !== e) continue; let r = n[1]; if (!r) { this.#t.delete(t); continue; } if (n.shift(), typeof r == `function`) i.add(r); else for (let e of r) i.add(e); } for (let t of r) { let n = this.#t.get(t), r = n?.[0]; if (!(!n || !(r instanceof Set))) if (r.size === 1 && n.length === 1) { this.#t.delete(t); continue; } else if (r.size === 1) { n.shift(); let e = n[0]; typeof e == `function` && i.add(e); } else r.delete(e); } return this.#s.delete(e), i.forEach((e) => this.#r(e)), !0; } }, Ji = () => process.umask(), Yi = Symbol(`onEntry`), Xi = Symbol(`checkFs`), Zi = Symbol(`checkFs2`), Qi = Symbol(`isReusable`), Q = Symbol(`makeFs`), $i = Symbol(`file`), ea = Symbol(`directory`), ta = Symbol(`link`), na = Symbol(`symlink`), ra = Symbol(`hardlink`), ia = Symbol(`ensureNoSymlink`), aa = Symbol(`unsupported`), oa = Symbol(`checkPath`), sa = Symbol(`stripAbsolutePath`), ca = Symbol(`mkdir`), $ = Symbol(`onError`), la = Symbol(`pending`), ua = Symbol(`pend`), da = Symbol(`unpend`), fa = Symbol(`ended`), pa = Symbol(`maybeClose`), ma = Symbol(`skip`), ha = Symbol(`doChown`), ga = Symbol(`uid`), _a = Symbol(`gid`), va = Symbol(`checkedCwd`), ya = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === `win32`, ba = 1024, xa = (e, n) => { if (!ya) return t.unlink(e, n); let r = e + `.DELETE.` + se(16).toString(`hex`); t.rename(e, r, (e) => { if (e) return n(e); t.unlink(r, n); }); }, Sa = (e) => { if (!ya) return t.unlinkSync(e); let n = e + `.DELETE.` + se(16).toString(`hex`); t.renameSync(e, n), t.unlinkSync(n); }, Ca = (e, t, n) => e !== void 0 && e === e >>> 0 ? e : t !== void 0 && t === t >>> 0 ? t : n, wa = class extends tr { [fa] = !1; [va] = !1; [la] = 0; reservations = new qi(); transform; writable = !0; readable = !1; uid; gid; setOwner; preserveOwner; processGid; processUid; maxDepth; forceChown; win32; newer; keep; noMtime; preservePaths; unlink; cwd; strip; processUmask; umask; dmode; fmode; chmod; constructor(e = {}) { if (e.ondone = () => { this[fa] = !0, this[pa](); }, super(e), this.transform = e.transform, this.chmod = !!e.chmod, typeof e.uid == `number` || typeof e.gid == `number`) { if (typeof e.uid != `number` || typeof e.gid != `number`) throw TypeError(`cannot set owner without number uid and gid`); if (e.preserveOwner) throw TypeError(`cannot preserve owner in archive and also set owner explicitly`); this.uid = e.uid, this.gid = e.gid, this.setOwner = !0; } else this.uid = void 0, this.gid = void 0, this.setOwner = !1; this.preserveOwner = e.preserveOwner === void 0 && typeof e.uid != `number` ? process.getuid?.() === 0 : !!e.preserveOwner, this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? process.getuid() : void 0, this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? process.getgid() : void 0, this.maxDepth = typeof e.maxDepth == `number` ? e.maxDepth : ba, this.forceChown = e.forceChown === !0, this.win32 = !!e.win32 || ya, this.newer = !!e.newer, this.keep = !!e.keep, this.noMtime = !!e.noMtime, this.preservePaths = !!e.preservePaths, this.unlink = !!e.unlink, this.cwd = L(i.resolve(e.cwd || process.cwd())), this.strip = Number(e.strip) || 0, this.processUmask = this.chmod ? typeof e.processUmask == `number` ? e.processUmask : Ji() : 0, this.umask = typeof e.umask == `number` ? e.umask : this.processUmask, this.dmode = e.dmode || 511 & ~this.umask, this.fmode = e.fmode || 438 & ~this.umask, this.on(`entry`, (e) => this[Yi](e)); } warn(e, t, n = {}) { return (e === `TAR_BAD_ARCHIVE` || e === `TAR_ABORT`) && (n.recoverable = !1), super.warn(e, t, n); } [pa]() { this[fa] && this[la] === 0 && (this.emit(`prefinish`), this.emit(`finish`), this.emit(`end`)); } [sa](e, t) { let n = e[t], { type: r } = e; if (!n || this.preservePaths) return !0; let [a, o] = lr(n), s = o.replaceAll(/\\/g, `/`).split(`/`); if (s.includes(`..`) || ya && /^[a-z]:\.\.$/i.test(s[0] ?? ``)) { if (t === `path` || r === `Link`) return this.warn(`TAR_ENTRY_ERROR`, `${t} contains '..'`, { entry: e, [t]: n }), !1; let a = i.posix.dirname(e.path), o = i.posix.normalize(i.posix.join(a, s.join(`/`))); if (o.startsWith(`../`) || o === `..`) return this.warn(`TAR_ENTRY_ERROR`, `${t} escapes extraction directory`, { entry: e, [t]: n }), !1; } return a && (e[t] = String(o), this.warn(`TAR_ENTRY_INFO`, `stripping ${a} from absolute ${t}`, { entry: e, [t]: n })), !0; } [oa](e) { let t = L(e.path), n = t.split(`/`); if (this.strip) { if (n.length < this.strip) return !1; if (e.type === `Link`) { let t = L(String(e.linkpath)).split(`/`); if (t.length >= this.strip) e.linkpath = t.slice(this.strip).join(`/`); else return !1; } n.splice(0, this.strip), e.path = n.join(`/`); } if (isFinite(this.maxDepth) && n.length > this.maxDepth) return this.warn(`TAR_ENTRY_ERROR`, `path excessively deep`, { entry: e, path: t, depth: n.length, maxDepth: this.maxDepth }), !1; if (!this[sa](e, `path`) || !this[sa](e, `linkpath`)) return !1; if (e.absolute = i.isAbsolute(e.path) ? L(i.resolve(e.path)) : L(i.resolve(this.cwd, e.path)), !this.preservePaths && typeof e.absolute == `string` && e.absolute.indexOf(this.cwd + `/`) !== 0 && e.absolute !== this.cwd) return this.warn(`TAR_ENTRY_ERROR`, `path escaped extraction target`, { entry: e, path: L(e.path), resolvedPath: e.absolute, cwd: this.cwd }), !1; if (e.absolute === this.cwd && e.type !== `Directory` && e.type !== `GNUDumpDir`) return !1; if (this.win32) { let { root: t } = i.win32.parse(String(e.absolute)); e.absolute = t + mr(String(e.absolute).slice(t.length)); let { root: n } = i.win32.parse(e.path); e.path = n + mr(e.path.slice(n.length)); } return !0; } [Yi](e) { if (!this[oa](e)) return e.resume(); switch (oe.equal(typeof e.absolute, `string`), e.type) { case `Directory`: case `GNUDumpDir`: e.mode && (e.mode |= 448); case `File`: case `OldFile`: case `ContiguousFile`: case `Link`: case `SymbolicLink`: return this[Xi](e); default: return this[aa](e); } } [$](e, t) { e.name === `CwdError` ? this.emit(`error`, e) : (this.warn(`TAR_ENTRY_ERROR`, e, { entry: t }), this[da](), t.resume()); } [ca](e, t, n) { Ii(L(e), { uid: this.uid, gid: this.gid, processUid: this.processUid, processGid: this.processGid, umask: this.processUmask, preserve: this.preservePaths, unlink: this.unlink, cwd: this.cwd, mode: t }, n); } [ha](e) { return this.forceChown || this.preserveOwner && (typeof e.uid == `number` && e.uid !== this.processUid || typeof e.gid == `number` && e.gid !== this.processGid) || typeof this.uid == `number` && this.uid !== this.processUid || typeof this.gid == `number` && this.gid !== this.processGid; } [ga](e) { return Ca(this.uid, e.uid, this.processUid); } [_a](e) { return Ca(this.gid, e.gid, this.processGid); } [$i](e, n) { let r = typeof e.mode == `number` ? e.mode & 4095 : this.fmode, i = new pt(String(e.absolute), { flags: Ei(e.size), mode: r, autoClose: !1 }); i.on(`error`, (r) => { i.fd && t.close(i.fd, () => {}), i.write = () => !0, this[$](r, e), n(); }); let a = 1, o = (r) => { if (r) { i.fd && t.close(i.fd, () => {}), this[$](r, e), n(); return; } --a === 0 && i.fd !== void 0 && t.close(i.fd, (t) => { t ? this[$](t, e) : this[da](), n(); }); }; i.on(`finish`, () => { let n = String(e.absolute), r = i.fd; if (typeof r == `number` && e.mtime && !this.noMtime) { a++; let i = e.atime || /* @__PURE__ */ new Date(), s = e.mtime; t.futimes(r, i, s, (e) => e ? t.utimes(n, i, s, (t) => o(t && e)) : o()); } if (typeof r == `number` && this[ha](e)) { a++; let i = this[ga](e), s = this[_a](e); typeof i == `number` && typeof s == `number` && t.fchown(r, i, s, (e) => e ? t.chown(n, i, s, (t) => o(t && e)) : o()); } o(); }); let s = this.transform && this.transform(e) || e; s !== e && (s.on(`error`, (t) => { this[$](t, e), n(); }), e.pipe(s)), s.pipe(i); } [ea](e, n) { let r = typeof e.mode == `number` ? e.mode & 4095 : this.dmode; this[ca](String(e.absolute), r, (r) => { if (r) { this[$](r, e), n(); return; } let i = 1, a = () => { --i === 0 && (n(), this[da](), e.resume()); }; e.mtime && !this.noMtime && (i++, t.utimes(String(e.absolute), e.atime || /* @__PURE__ */ new Date(), e.mtime, a)), this[ha](e) && (i++, t.chown(String(e.absolute), Number(this[ga](e)), Number(this[_a](e)), a)), a(); }); } [aa](e) { e.unsupported = !0, this.warn(`TAR_ENTRY_UNSUPPORTED`, `unsupported entry type: ${e.type}`, { entry: e }), e.resume(); } [na](e, t) { let n = L(i.relative(this.cwd, i.resolve(i.dirname(String(e.absolute)), String(e.linkpath)))).split(`/`); this[ia](e, this.cwd, n, () => this[ta](e, String(e.linkpath), `symlink`, t), (n) => { this[$](n, e), t(); }); } [ra](e, t) { let n = L(i.resolve(this.cwd, String(e.linkpath))), r = L(String(e.linkpath)).split(`/`); this[ia](e, this.cwd, r, () => this[ta](e, n, `link`, t), (n) => { this[$](n, e), t(); }); } [ia](e, n, r, a, o) { let s = r.shift(); if (this.preservePaths || s === void 0) return a(); let c = i.resolve(n, s); t.lstat(c, (t, n) => { if (t) return a(); if (n?.isSymbolicLink()) return o(new Pi(c, i.resolve(c, r.join(`/`)))); this[ia](e, c, r, a, o); }); } [ua]() { this[la]++; } [da]() { this[la]--, this[pa](); } [ma](e) { this[da](), e.resume(); } [Qi](e, t) { return e.type === `File` && !this.unlink && t.isFile() && t.nlink <= 1 && !ya; } [Xi](e) { this[ua](); let t = [e.path]; e.linkpath && t.push(e.linkpath), this.reservations.reserve(t, (t) => this[Zi](e, t)); } [Zi](e, n) { let r = (e) => { n(e); }, a = () => { this[ca](this.cwd, this.dmode, (t) => { if (t) { this[$](t, e), r(); return; } this[va] = !0, o(); }); }, o = () => { if (e.absolute !== this.cwd) { let t = L(i.dirname(String(e.absolute))); if (t !== this.cwd) return this[ca](t, this.dmode, (t) => { if (t) { this[$](t, e), r(); return; } s(); }); } s(); }, s = () => { t.lstat(String(e.absolute), (n, i) => { if (i && (this.keep || this.newer && i.mtime > (e.mtime ?? i.mtime))) { this[ma](e), r(); return; } if (n || this[Qi](e, i)) return this[Q](null, e, r); if (i.isDirectory()) { if (e.type === `Directory`) { let n = this.chmod && e.mode && (i.mode & 4095) !== e.mode, a = (t) => this[Q](t ?? null, e, r); return n ? t.chmod(String(e.absolute), Number(e.mode), a) : a(); } if (e.absolute !== this.cwd) return t.rmdir(String(e.absolute), (t) => this[Q](t ?? null, e, r)); } if (e.absolute === this.cwd) return this[Q](null, e, r); xa(String(e.absolute), (t) => this[Q](t ?? null, e, r)); }); }; this[va] ? o() : a(); } [Q](e, t, n) { if (e) { this[$](e, t), n(); return; } switch (t.type) { case `File`: case `OldFile`: case `ContiguousFile`: return this[$i](t, n); case `Link`: return this[ra](t, n); case `SymbolicLink`: return this[na](t, n); case `Directory`: case `GNUDumpDir`: return this[ea](t, n); } } [ta](e, n, r, i) { t[r](n, String(e.absolute), (t) => { t ? this[$](t, e) : (this[da](), e.resume()), i(); }); } }, Ta = (e) => { try { return [null, e()]; } catch (e) { return [e, null]; } }, Ea = class extends wa { sync = !0; [Q](e, t) { return super[Q](e, t, () => {}); } [Xi](e) { if (!this[va]) { let t = this[ca](this.cwd, this.dmode); if (t) return this[$](t, e); this[va] = !0; } if (e.absolute !== this.cwd) { let t = L(i.dirname(String(e.absolute))); if (t !== this.cwd) { let n = this[ca](t, this.dmode); if (n) return this[$](n, e); } } let [n, r] = Ta(() => t.lstatSync(String(e.absolute))); if (r && (this.keep || this.newer && r.mtime > (e.mtime ?? r.mtime))) return this[ma](e); if (n || this[Qi](e, r)) return this[Q](null, e); if (r.isDirectory()) { if (e.type === `Directory`) { let [n] = this.chmod && e.mode && (r.mode & 4095) !== e.mode ? Ta(() => { t.chmodSync(String(e.absolute), Number(e.mode)); }) : []; return this[Q](n, e); } let [n] = Ta(() => t.rmdirSync(String(e.absolute))); this[Q](n, e); } let [a] = e.absolute === this.cwd ? [] : Ta(() => Sa(String(e.absolute))); this[Q](a, e); } [$i](e, n) { let r = typeof e.mode == `number` ? e.mode & 4095 : this.fmode, i = (r) => { let i; try { t.closeSync(a); } catch (e) { i = e; } (r || i) && this[$](r || i, e), n(); }, a; try { a = t.openSync(String(e.absolute), Ei(e.size), r); } catch (e) { return i(e); } let o = this.transform && this.transform(e) || e; o !== e && (o.on(`error`, (t) => this[$](t, e)), e.pipe(o)), o.on(`data`, (e) => { try { t.writeSync(a, e, 0, e.length); } catch (e) { i(e); } }), o.on(`end`, () => { let n = null; if (e.mtime && !this.noMtime) { let r = e.atime || /* @__PURE__ */ new Date(), i = e.mtime; try { t.futimesSync(a, r, i); } catch (a) { try { t.utimesSync(String(e.absolute), r, i); } catch { n = a; } } } if (this[ha](e)) { let r = this[ga](e), i = this[_a](e); try { t.fchownSync(a, Number(r), Number(i)); } catch (a) { try { t.chownSync(String(e.absolute), Number(r), Number(i)); } catch { n ||= a; } } } i(n); }); } [ea](e, n) { let r = typeof e.mode == `number` ? e.mode & 4095 : this.dmode, i = this[ca](String(e.absolute), r); if (i) { this[$](i, e), n(); return; } if (e.mtime && !this.noMtime) try { t.utimesSync(String(e.absolute), e.atime || /* @__PURE__ */ new Date(), e.mtime); } catch {} if (this[ha](e)) try { t.chownSync(String(e.absolute), Number(this[ga](e)), Number(this[_a](e))); } catch {} n(), e.resume(); } [ca](e, t) { try { return Bi(L(e), { uid: this.uid, gid: this.gid, processUid: this.processUid, processGid: this.processGid, umask: this.processUmask, preserve: this.preservePaths, unlink: this.unlink, cwd: this.cwd, mode: t }); } catch (e) { return e; } } [ia](e, n, r, a, o) { if (this.preservePaths || r.length === 0) return a(); let s = n; for (let e of r) { s = i.resolve(s, e); let [c, l] = Ta(() => t.lstatSync(s)); if (c) return a(); if (l.isSymbolicLink()) return o(new Pi(s, i.resolve(n, r.join(`/`)))); } a(); } [ta](e, n, r, i) { let a = `${r}Sync`; try { t[a](n, String(e.absolute)), i(), e.resume(); } catch (t) { return this[$](t, e); } } }, Da = Ct((e) => { let n = new Ea(e), r = e.file, i = t.statSync(r); new ft(r, { readSize: e.maxReadSize || 16 * 1024 * 1024, size: i.size }).pipe(n); }, (e, n) => { let r = new wa(e), i = e.maxReadSize || 16 * 1024 * 1024, a = e.file; return new Promise((e, n) => { r.on(`error`, n), r.on(`close`, e), t.stat(a, (e, t) => { if (e) n(e); else { let e = new dt(a, { readSize: i, size: t.size }); e.on(`error`, n), e.pipe(r); } }); }); }, (e) => new Ea(e), (e) => new wa(e), (e, t) => { t?.length && ir(e, t); }), Oa = (e, n) => { let r = new ui(e), i = !0, a, o; try { try { a = t.openSync(e.file, `r+`); } catch (n) { if (n?.code === `ENOENT`) a = t.openSync(e.file, `w+`); else throw n; } let s = t.fstatSync(a), c = Buffer.alloc(512); t: for (o = 0; o < s.size; o += 512) { for (let e = 0, n = 0; e < 512; e += n) { if (n = t.readSync(a, c, e, c.length - e, o + e), o === 0 && c[0] === 31 && c[1] === 139) throw Error(`cannot append to compressed archives`); if (!n) break t; } let n = new I(c); if (!n.cksumValid) break; let r = 512 * Math.ceil((n.size || 0) / 512); if (o + r + 512 > s.size) break; o += r, e.mtimeCache && n.mtime && e.mtimeCache.set(String(n.path), n.mtime); } i = !1, ka(e, r, o, a, n); } finally { if (i) try { t.closeSync(a); } catch {} } }, ka = (e, t, n, r, i) => { let a = new mt(e.file, { fd: r, start: n }); t.pipe(a), ja(t, i); }, Aa = (e, n) => { n = Array.from(n); let r = new li(e), i = (n, r, i) => { let a = (e, r) => { e ? t.close(n, (t) => i(e)) : i(null, r); }, o = 0; if (r === 0) return a(null, 0); let s = 0, c = Buffer.alloc(512), l = (i, u) => { if (i || u === void 0) return a(i); if (s += u, s < 512 && u) return t.read(n, c, s, c.length - s, o + s, l); if (o === 0 && c[0] === 31 && c[1] === 139) return a(Error(`cannot append to compressed archives`)); if (s < 512) return a(null, o); let d = new I(c); if (!d.cksumValid) return a(null, o); let f = 512 * Math.ceil((d.size ?? 0) / 512); if (o + f + 512 > r || (o += f + 512, o >= r)) return a(null, o); e.mtimeCache && d.mtime && e.mtimeCache.set(String(d.path), d.mtime), s = 0, t.read(n, c, 0, 512, o, l); }; t.read(n, c, 0, 512, o, l); }; return new Promise((a, o) => { r.on(`error`, o); let s = `r+`, c = (l, u) => { if (l && l.code === `ENOENT` && s === `r+`) return s = `w+`, t.open(e.file, s, c); if (l || !u) return o(l); t.fstat(u, (s, c) => { if (s) return t.close(u, () => o(s)); i(u, c.size, (t, i) => { if (t) return o(t); let s = new pt(e.file, { fd: u, start: i }); r.pipe(s), s.on(`error`, o), s.on(`close`, a), Ma(r, n); }); }); }; t.open(e.file, s, c); }); }, ja = (e, t) => { t.forEach((t) => { t.charAt(0) === `@` ? ar({ file: i.resolve(e.cwd, t.slice(1)), sync: !0, noResume: !0, onReadEntry: (t) => e.add(t) }) : e.add(t); }), e.end(); }, Ma = async (e, t) => { for (let n of t) n.charAt(0) === `@` ? await ar({ file: i.resolve(String(e.cwd), n.slice(1)), noResume: !0, onReadEntry: (t) => e.add(t) }) : e.add(n); e.end(); }, Na = Ct(Oa, Aa, () => { throw TypeError(`file is required`); }, () => { throw TypeError(`file is required`); }, (e, t) => { if (!bt(e)) throw TypeError(`file is required`); if (e.gzip || e.brotli || e.zstd || e.file.endsWith(`.br`) || e.file.endsWith(`.tbr`)) throw TypeError(`cannot append to compressed archives`); if (!t?.length) throw TypeError(`no paths specified to add/replace`); }); Ct(Na.syncFile, Na.asyncFile, Na.syncNoFile, Na.asyncNoFile, (e, t = []) => { Na.validate?.(e, t), Pa(e); }); var Pa = (e) => { let t = e.filter; e.mtimeCache ||= /* @__PURE__ */ new Map(), e.filter = t ? (n, r) => t(n, r) && !((e.mtimeCache?.get(n) ?? r.mtime ?? 0) > (r.mtime ?? 0)) : (t, n) => !((e.mtimeCache?.get(t) ?? n.mtime ?? 0) > (n.mtime ?? 0)); }; export { ce as index_min_exports };