@cmflow/source-pack 0.0.0-stage → 3.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +183 -2
  2. package/dist/GitRepository-VTAWT6j4.mjs +151 -0
  3. package/dist/GitRepository-VTAWT6j4.mjs.map +1 -0
  4. package/dist/bin/source-pack.d.mts +1 -0
  5. package/dist/bin/source-pack.mjs +3038 -0
  6. package/dist/bin/source-pack.mjs.map +1 -0
  7. package/dist/buildSourcePack-CaaMZ_tw.mjs +11280 -0
  8. package/dist/buildSourcePack-CaaMZ_tw.mjs.map +1 -0
  9. package/dist/buildSourcePack-DIp8G_uL.mjs +3 -0
  10. package/dist/constants-DkiLCuIK.mjs +25 -0
  11. package/dist/constants-DkiLCuIK.mjs.map +1 -0
  12. package/dist/defaults-BJs7a37e.mjs +52 -0
  13. package/dist/defaults-BJs7a37e.mjs.map +1 -0
  14. package/dist/index.d.mts +397 -0
  15. package/dist/index.mjs +73 -0
  16. package/dist/index.mjs.map +1 -0
  17. package/dist/initConfig-ByGsbShR.mjs +185 -0
  18. package/dist/initConfig-ByGsbShR.mjs.map +1 -0
  19. package/dist/loadConfig-CNrL90dq.mjs +224 -0
  20. package/dist/loadConfig-CNrL90dq.mjs.map +1 -0
  21. package/dist/logger-D1XGzzjT.mjs +15 -0
  22. package/dist/logger-D1XGzzjT.mjs.map +1 -0
  23. package/dist/packageVersion-B0749hF6.mjs +4646 -0
  24. package/dist/packageVersion-B0749hF6.mjs.map +1 -0
  25. package/dist/projectIdentity-F97vs1H-.mjs +3331 -0
  26. package/dist/projectIdentity-F97vs1H-.mjs.map +1 -0
  27. package/dist/publishSourcePack-Dj1cdWfT.mjs +3 -0
  28. package/dist/publishSourcePack-xNr9RBgv.mjs +296 -0
  29. package/dist/publishSourcePack-xNr9RBgv.mjs.map +1 -0
  30. package/dist/token-DMtao22Y.mjs +59 -0
  31. package/dist/token-DMtao22Y.mjs.map +1 -0
  32. package/dist/token-util-C3JYrW4-.mjs +498 -0
  33. package/dist/token-util-C3JYrW4-.mjs.map +1 -0
  34. package/dist/token-util-CbjlbIno.mjs +5 -0
  35. package/package.json +44 -3
  36. package/templates/circleci-job.yml +39 -0
  37. package/templates/gitlab-ci.yml +30 -0
@@ -0,0 +1,3331 @@
1
+ import { EventEmitter } from "node:events";
2
+ import path, { basename, join, posix, win32 } from "node:path";
3
+ import fs from "node:fs";
4
+ import ro from "node:fs/promises";
5
+ import Qr, { EventEmitter as EventEmitter$1 } from "events";
6
+ import I from "fs";
7
+ import Cs from "node:stream";
8
+ import { StringDecoder } from "node:string_decoder";
9
+ import ar, { dirname, parse } from "path";
10
+ import zi from "assert";
11
+ import { Buffer as Buffer$1 } from "buffer";
12
+ import * as Ps from "zlib";
13
+ import en from "zlib";
14
+ import co from "node:assert";
15
+ import { randomBytes } from "node:crypto";
16
+
17
+ //#region ../../node_modules/tar/dist/esm/index.min.js
18
+ var zr = Object.defineProperty;
19
+ var Ur = (s, t) => {
20
+ for (var e in t) zr(s, e, {
21
+ get: t[e],
22
+ enumerable: !0
23
+ });
24
+ };
25
+ var Ds = typeof process == "object" && process ? process : {
26
+ stdout: null,
27
+ stderr: null
28
+ };
29
+ var Wr = (s) => !!s && typeof s == "object" && (s instanceof A || s instanceof Cs || Gr(s) || Zr(s));
30
+ var Gr = (s) => !!s && typeof s == "object" && s instanceof EventEmitter && typeof s.pipe == "function" && s.pipe !== Cs.Writable.prototype.pipe;
31
+ var Zr = (s) => !!s && typeof s == "object" && s instanceof EventEmitter && typeof s.write == "function" && typeof s.end == "function";
32
+ var Q = Symbol("EOF");
33
+ var J = Symbol("maybeEmitEnd");
34
+ var nt = Symbol("emittedEnd");
35
+ var De = Symbol("emittingEnd");
36
+ var qt = Symbol("emittedError");
37
+ var Ne = Symbol("closed");
38
+ var Ns = Symbol("read");
39
+ var Ae = Symbol("flush");
40
+ var As = Symbol("flushChunk");
41
+ var z = Symbol("encoding");
42
+ var Mt = Symbol("decoder");
43
+ var g = Symbol("flowing");
44
+ var Qt = Symbol("paused");
45
+ var Bt = Symbol("resume");
46
+ var b = Symbol("buffer");
47
+ var N = Symbol("pipes");
48
+ var _ = Symbol("bufferLength");
49
+ var bi = Symbol("bufferPush");
50
+ var Ie = Symbol("bufferShift");
51
+ var L = Symbol("objectMode");
52
+ var S = Symbol("destroyed");
53
+ var _i = Symbol("error");
54
+ var Oi = Symbol("emitData");
55
+ var Is = Symbol("emitEnd");
56
+ var Ti = Symbol("emitEnd2");
57
+ var Z = Symbol("async");
58
+ var xi = Symbol("abort");
59
+ var Ce = Symbol("aborted");
60
+ var Jt = Symbol("signal");
61
+ var Rt = Symbol("dataListeners");
62
+ var C = Symbol("discarded");
63
+ var jt = (s) => Promise.resolve().then(s);
64
+ var Yr = (s) => s();
65
+ var Kr = (s) => s === "end" || s === "finish" || s === "prefinish";
66
+ var Vr = (s) => s instanceof ArrayBuffer || !!s && typeof s == "object" && s.constructor && s.constructor.name === "ArrayBuffer" && s.byteLength >= 0;
67
+ var $r = (s) => !Buffer.isBuffer(s) && ArrayBuffer.isView(s);
68
+ var Fe = class {
69
+ src;
70
+ dest;
71
+ opts;
72
+ ondrain;
73
+ constructor(t, e, i) {
74
+ this.src = t, this.dest = e, this.opts = i, this.ondrain = () => t[Bt](), this.dest.on("drain", this.ondrain);
75
+ }
76
+ unpipe() {
77
+ this.dest.removeListener("drain", this.ondrain);
78
+ }
79
+ proxyErrors(t) {}
80
+ end() {
81
+ this.unpipe(), this.opts.end && this.dest.end();
82
+ }
83
+ };
84
+ var Li = class extends Fe {
85
+ unpipe() {
86
+ this.src.removeListener("error", this.proxyErrors), super.unpipe();
87
+ }
88
+ constructor(t, e, i) {
89
+ super(t, e, i), this.proxyErrors = (r) => this.dest.emit("error", r), t.on("error", this.proxyErrors);
90
+ }
91
+ };
92
+ var Xr = (s) => !!s.objectMode;
93
+ var qr = (s) => !s.objectMode && !!s.encoding && s.encoding !== "buffer";
94
+ var A = class extends EventEmitter {
95
+ [g] = !1;
96
+ [Qt] = !1;
97
+ [N] = [];
98
+ [b] = [];
99
+ [L];
100
+ [z];
101
+ [Z];
102
+ [Mt];
103
+ [Q] = !1;
104
+ [nt] = !1;
105
+ [De] = !1;
106
+ [Ne] = !1;
107
+ [qt] = null;
108
+ [_] = 0;
109
+ [S] = !1;
110
+ [Jt];
111
+ [Ce] = !1;
112
+ [Rt] = 0;
113
+ [C] = !1;
114
+ writable = !0;
115
+ readable = !0;
116
+ constructor(...t) {
117
+ let e = t[0] || {};
118
+ if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
119
+ Xr(e) ? (this[L] = !0, this[z] = null) : qr(e) ? (this[z] = e.encoding, this[L] = !1) : (this[L] = !1, this[z] = null), this[Z] = !!e.async, this[Mt] = this[z] ? new StringDecoder(this[z]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[b] }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[N] });
120
+ let { signal: i } = e;
121
+ i && (this[Jt] = i, i.aborted ? this[xi]() : i.addEventListener("abort", () => this[xi]()));
122
+ }
123
+ get bufferLength() {
124
+ return this[_];
125
+ }
126
+ get encoding() {
127
+ return this[z];
128
+ }
129
+ set encoding(t) {
130
+ throw new Error("Encoding must be set at instantiation time");
131
+ }
132
+ setEncoding(t) {
133
+ throw new Error("Encoding must be set at instantiation time");
134
+ }
135
+ get objectMode() {
136
+ return this[L];
137
+ }
138
+ set objectMode(t) {
139
+ throw new Error("objectMode must be set at instantiation time");
140
+ }
141
+ get async() {
142
+ return this[Z];
143
+ }
144
+ set async(t) {
145
+ this[Z] = this[Z] || !!t;
146
+ }
147
+ [xi]() {
148
+ this[Ce] = !0, this.emit("abort", this[Jt]?.reason), this.destroy(this[Jt]?.reason);
149
+ }
150
+ get aborted() {
151
+ return this[Ce];
152
+ }
153
+ set aborted(t) {}
154
+ write(t, e, i) {
155
+ if (this[Ce]) return !1;
156
+ if (this[Q]) throw new Error("write after end");
157
+ if (this[S]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), !0;
158
+ typeof e == "function" && (i = e, e = "utf8"), e || (e = "utf8");
159
+ let r = this[Z] ? jt : Yr;
160
+ if (!this[L] && !Buffer.isBuffer(t)) {
161
+ if ($r(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
162
+ else if (Vr(t)) t = Buffer.from(t);
163
+ else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
164
+ }
165
+ return this[L] ? (this[g] && this[_] !== 0 && this[Ae](!0), this[g] ? this.emit("data", t) : this[bi](t), this[_] !== 0 && this.emit("readable"), i && r(i), this[g]) : t.length ? (typeof t == "string" && !(e === this[z] && !this[Mt]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[z] && (t = this[Mt].write(t)), this[g] && this[_] !== 0 && this[Ae](!0), this[g] ? this.emit("data", t) : this[bi](t), this[_] !== 0 && this.emit("readable"), i && r(i), this[g]) : (this[_] !== 0 && this.emit("readable"), i && r(i), this[g]);
166
+ }
167
+ read(t) {
168
+ if (this[S]) return null;
169
+ if (this[C] = !1, this[_] === 0 || t === 0 || t && t > this[_]) return this[J](), null;
170
+ this[L] && (t = null), this[b].length > 1 && !this[L] && (this[b] = [this[z] ? this[b].join("") : Buffer.concat(this[b], this[_])]);
171
+ let e = this[Ns](t || null, this[b][0]);
172
+ return this[J](), e;
173
+ }
174
+ [Ns](t, e) {
175
+ if (this[L]) this[Ie]();
176
+ else {
177
+ let i = e;
178
+ t === i.length || t === null ? this[Ie]() : typeof i == "string" ? (this[b][0] = i.slice(t), e = i.slice(0, t), this[_] -= t) : (this[b][0] = i.subarray(t), e = i.subarray(0, t), this[_] -= t);
179
+ }
180
+ return this.emit("data", e), !this[b].length && !this[Q] && this.emit("drain"), e;
181
+ }
182
+ end(t, e, i) {
183
+ return typeof t == "function" && (i = t, t = void 0), typeof e == "function" && (i = e, e = "utf8"), t !== void 0 && this.write(t, e), i && this.once("end", i), this[Q] = !0, this.writable = !1, (this[g] || !this[Qt]) && this[J](), this;
184
+ }
185
+ [Bt]() {
186
+ this[S] || (!this[Rt] && !this[N].length && (this[C] = !0), this[Qt] = !1, this[g] = !0, this.emit("resume"), this[b].length ? this[Ae]() : this[Q] ? this[J]() : this.emit("drain"));
187
+ }
188
+ resume() {
189
+ return this[Bt]();
190
+ }
191
+ pause() {
192
+ this[g] = !1, this[Qt] = !0, this[C] = !1;
193
+ }
194
+ get destroyed() {
195
+ return this[S];
196
+ }
197
+ get flowing() {
198
+ return this[g];
199
+ }
200
+ get paused() {
201
+ return this[Qt];
202
+ }
203
+ [bi](t) {
204
+ this[L] ? this[_] += 1 : this[_] += t.length, this[b].push(t);
205
+ }
206
+ [Ie]() {
207
+ return this[L] ? this[_] -= 1 : this[_] -= this[b][0].length, this[b].shift();
208
+ }
209
+ [Ae](t = !1) {
210
+ do ;
211
+ while (this[As](this[Ie]()) && this[b].length);
212
+ !t && !this[b].length && !this[Q] && this.emit("drain");
213
+ }
214
+ [As](t) {
215
+ return this.emit("data", t), this[g];
216
+ }
217
+ pipe(t, e) {
218
+ if (this[S]) return t;
219
+ this[C] = !1;
220
+ let i = this[nt];
221
+ return e = e || {}, t === Ds.stdout || t === Ds.stderr ? e.end = !1 : e.end = e.end !== !1, e.proxyErrors = !!e.proxyErrors, i ? e.end && t.end() : (this[N].push(e.proxyErrors ? new Li(this, t, e) : new Fe(this, t, e)), this[Z] ? jt(() => this[Bt]()) : this[Bt]()), t;
222
+ }
223
+ unpipe(t) {
224
+ let e = this[N].find((i) => i.dest === t);
225
+ e && (this[N].length === 1 ? (this[g] && this[Rt] === 0 && (this[g] = !1), this[N] = []) : this[N].splice(this[N].indexOf(e), 1), e.unpipe());
226
+ }
227
+ addListener(t, e) {
228
+ return this.on(t, e);
229
+ }
230
+ on(t, e) {
231
+ let i = super.on(t, e);
232
+ if (t === "data") this[C] = !1, this[Rt]++, !this[N].length && !this[g] && this[Bt]();
233
+ else if (t === "readable" && this[_] !== 0) super.emit("readable");
234
+ else if (Kr(t) && this[nt]) super.emit(t), this.removeAllListeners(t);
235
+ else if (t === "error" && this[qt]) {
236
+ let r = e;
237
+ this[Z] ? jt(() => r.call(this, this[qt])) : r.call(this, this[qt]);
238
+ }
239
+ return i;
240
+ }
241
+ removeListener(t, e) {
242
+ return this.off(t, e);
243
+ }
244
+ off(t, e) {
245
+ let i = super.off(t, e);
246
+ return t === "data" && (this[Rt] = this.listeners("data").length, this[Rt] === 0 && !this[C] && !this[N].length && (this[g] = !1)), i;
247
+ }
248
+ removeAllListeners(t) {
249
+ let e = super.removeAllListeners(t);
250
+ return (t === "data" || t === void 0) && (this[Rt] = 0, !this[C] && !this[N].length && (this[g] = !1)), e;
251
+ }
252
+ get emittedEnd() {
253
+ return this[nt];
254
+ }
255
+ [J]() {
256
+ !this[De] && !this[nt] && !this[S] && this[b].length === 0 && this[Q] && (this[De] = !0, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Ne] && this.emit("close"), this[De] = !1);
257
+ }
258
+ emit(t, ...e) {
259
+ let i = e[0];
260
+ if (t !== "error" && t !== "close" && t !== S && this[S]) return !1;
261
+ if (t === "data") return !this[L] && !i ? !1 : this[Z] ? (jt(() => this[Oi](i)), !0) : this[Oi](i);
262
+ if (t === "end") return this[Is]();
263
+ if (t === "close") {
264
+ if (this[Ne] = !0, !this[nt] && !this[S]) return !1;
265
+ let n = super.emit("close");
266
+ return this.removeAllListeners("close"), n;
267
+ } else if (t === "error") {
268
+ this[qt] = i, super.emit(_i, i);
269
+ let n = !this[Jt] || this.listeners("error").length ? super.emit("error", i) : !1;
270
+ return this[J](), n;
271
+ } else if (t === "resume") {
272
+ let n = super.emit("resume");
273
+ return this[J](), n;
274
+ } else if (t === "finish" || t === "prefinish") {
275
+ let n = super.emit(t);
276
+ return this.removeAllListeners(t), n;
277
+ }
278
+ let r = super.emit(t, ...e);
279
+ return this[J](), r;
280
+ }
281
+ [Oi](t) {
282
+ for (let i of this[N]) i.dest.write(t) === !1 && this.pause();
283
+ let e = this[C] ? !1 : super.emit("data", t);
284
+ return this[J](), e;
285
+ }
286
+ [Is]() {
287
+ return this[nt] ? !1 : (this[nt] = !0, this.readable = !1, this[Z] ? (jt(() => this[Ti]()), !0) : this[Ti]());
288
+ }
289
+ [Ti]() {
290
+ if (this[Mt]) {
291
+ let e = this[Mt].end();
292
+ if (e) {
293
+ for (let i of this[N]) i.dest.write(e);
294
+ this[C] || super.emit("data", e);
295
+ }
296
+ }
297
+ for (let e of this[N]) e.end();
298
+ let t = super.emit("end");
299
+ return this.removeAllListeners("end"), t;
300
+ }
301
+ async collect() {
302
+ let t = Object.assign([], { dataLength: 0 });
303
+ this[L] || (t.dataLength = 0);
304
+ let e = this.promise();
305
+ return this.on("data", (i) => {
306
+ t.push(i), this[L] || (t.dataLength += i.length);
307
+ }), await e, t;
308
+ }
309
+ async concat() {
310
+ if (this[L]) throw new Error("cannot concat in objectMode");
311
+ let t = await this.collect();
312
+ return this[z] ? t.join("") : Buffer.concat(t, t.dataLength);
313
+ }
314
+ async promise() {
315
+ return new Promise((t, e) => {
316
+ this.on(S, () => e(/* @__PURE__ */ new Error("stream destroyed"))), this.on("error", (i) => e(i)), this.on("end", () => t());
317
+ });
318
+ }
319
+ [Symbol.asyncIterator]() {
320
+ this[C] = !1;
321
+ let t = !1, e = async () => (this.pause(), t = !0, {
322
+ value: void 0,
323
+ done: !0
324
+ });
325
+ return {
326
+ next: () => {
327
+ if (t) return e();
328
+ let r = this.read();
329
+ if (r !== null) return Promise.resolve({
330
+ done: !1,
331
+ value: r
332
+ });
333
+ if (this[Q]) return e();
334
+ let n, o, h = (d) => {
335
+ this.off("data", a), this.off("end", l), this.off(S, c), e(), o(d);
336
+ }, a = (d) => {
337
+ this.off("error", h), this.off("end", l), this.off(S, c), this.pause(), n({
338
+ value: d,
339
+ done: !!this[Q]
340
+ });
341
+ }, l = () => {
342
+ this.off("error", h), this.off("data", a), this.off(S, c), e(), n({
343
+ done: !0,
344
+ value: void 0
345
+ });
346
+ }, c = () => h(/* @__PURE__ */ new Error("stream destroyed"));
347
+ return new Promise((d, y) => {
348
+ o = y, n = d, this.once(S, c), this.once("error", h), this.once("end", l), this.once("data", a);
349
+ });
350
+ },
351
+ throw: e,
352
+ return: e,
353
+ [Symbol.asyncIterator]() {
354
+ return this;
355
+ },
356
+ [Symbol.asyncDispose]: async () => {}
357
+ };
358
+ }
359
+ [Symbol.iterator]() {
360
+ this[C] = !1;
361
+ let t = !1, e = () => (this.pause(), this.off(_i, e), this.off(S, e), this.off("end", e), t = !0, {
362
+ done: !0,
363
+ value: void 0
364
+ }), i = () => {
365
+ if (t) return e();
366
+ let r = this.read();
367
+ return r === null ? e() : {
368
+ done: !1,
369
+ value: r
370
+ };
371
+ };
372
+ return this.once("end", e), this.once(_i, e), this.once(S, e), {
373
+ next: i,
374
+ throw: e,
375
+ return: e,
376
+ [Symbol.iterator]() {
377
+ return this;
378
+ },
379
+ [Symbol.dispose]: () => {}
380
+ };
381
+ }
382
+ destroy(t) {
383
+ if (this[S]) return t ? this.emit("error", t) : this.emit(S), this;
384
+ this[S] = !0, this[C] = !0, this[b].length = 0, this[_] = 0;
385
+ let e = this;
386
+ return typeof e.close == "function" && !this[Ne] && e.close(), t ? this.emit("error", t) : this.emit(S), this;
387
+ }
388
+ static get isStream() {
389
+ return Wr;
390
+ }
391
+ };
392
+ var Jr = I.writev;
393
+ var ht = Symbol("_autoClose");
394
+ var H = Symbol("_close");
395
+ var te = Symbol("_ended");
396
+ var m = Symbol("_fd");
397
+ var Ni = Symbol("_finished");
398
+ var tt = Symbol("_flags");
399
+ var Ai = Symbol("_flush");
400
+ var ki = Symbol("_handleChunk");
401
+ var vi = Symbol("_makeBuf");
402
+ var ie = Symbol("_mode");
403
+ var ke = Symbol("_needDrain");
404
+ var Ut = Symbol("_onerror");
405
+ var Ht = Symbol("_onopen");
406
+ var Ii = Symbol("_onread");
407
+ var Pt = Symbol("_onwrite");
408
+ var at = Symbol("_open");
409
+ var U = Symbol("_path");
410
+ var ot = Symbol("_pos");
411
+ var Y = Symbol("_queue");
412
+ var zt = Symbol("_read");
413
+ var Ci = Symbol("_readSize");
414
+ var j = Symbol("_reading");
415
+ var ee = Symbol("_remain");
416
+ var Fi = Symbol("_size");
417
+ var ve = Symbol("_write");
418
+ var gt = Symbol("_writing");
419
+ var Me = Symbol("_defaultFlag");
420
+ var bt = Symbol("_errored");
421
+ var _t = class extends A {
422
+ [bt] = !1;
423
+ [m];
424
+ [U];
425
+ [Ci];
426
+ [j] = !1;
427
+ [Fi];
428
+ [ee];
429
+ [ht];
430
+ constructor(t, e) {
431
+ if (e = e || {}, super(e), this.readable = !0, this.writable = !1, typeof t != "string") throw new TypeError("path must be a string");
432
+ this[bt] = !1, this[m] = typeof e.fd == "number" ? e.fd : void 0, this[U] = t, this[Ci] = e.readSize || 16777216, this[j] = !1, this[Fi] = typeof e.size == "number" ? e.size : 1 / 0, this[ee] = this[Fi], this[ht] = typeof e.autoClose == "boolean" ? e.autoClose : !0, typeof this[m] == "number" ? this[zt]() : this[at]();
433
+ }
434
+ get fd() {
435
+ return this[m];
436
+ }
437
+ get path() {
438
+ return this[U];
439
+ }
440
+ write() {
441
+ throw new TypeError("this is a readable stream");
442
+ }
443
+ end() {
444
+ throw new TypeError("this is a readable stream");
445
+ }
446
+ [at]() {
447
+ I.open(this[U], "r", (t, e) => this[Ht](t, e));
448
+ }
449
+ [Ht](t, e) {
450
+ t ? this[Ut](t) : (this[m] = e, this.emit("open", e), this[zt]());
451
+ }
452
+ [vi]() {
453
+ return Buffer.allocUnsafe(Math.min(this[Ci], this[ee]));
454
+ }
455
+ [zt]() {
456
+ if (!this[j]) {
457
+ this[j] = !0;
458
+ let t = this[vi]();
459
+ if (t.length === 0) return process.nextTick(() => this[Ii](null, 0, t));
460
+ I.read(this[m], t, 0, t.length, null, (e, i, r) => this[Ii](e, i, r));
461
+ }
462
+ }
463
+ [Ii](t, e, i) {
464
+ this[j] = !1, t ? this[Ut](t) : this[ki](e, i) && this[zt]();
465
+ }
466
+ [H]() {
467
+ if (this[ht] && typeof this[m] == "number") {
468
+ let t = this[m];
469
+ this[m] = void 0, I.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
470
+ }
471
+ }
472
+ [Ut](t) {
473
+ this[j] = !0, this[H](), this.emit("error", t);
474
+ }
475
+ [ki](t, e) {
476
+ let i = !1;
477
+ return this[ee] -= t, t > 0 && (i = super.write(t < e.length ? e.subarray(0, t) : e)), (t === 0 || this[ee] <= 0) && (i = !1, this[H](), super.end()), i;
478
+ }
479
+ emit(t, ...e) {
480
+ switch (t) {
481
+ case "prefinish":
482
+ case "finish": return !1;
483
+ case "drain": return typeof this[m] == "number" && this[zt](), !1;
484
+ case "error": return this[bt] ? !1 : (this[bt] = !0, super.emit(t, ...e));
485
+ default: return super.emit(t, ...e);
486
+ }
487
+ }
488
+ };
489
+ var Be = class extends _t {
490
+ [at]() {
491
+ let t = !0;
492
+ try {
493
+ this[Ht](null, I.openSync(this[U], "r")), t = !1;
494
+ } finally {
495
+ t && this[H]();
496
+ }
497
+ }
498
+ [zt]() {
499
+ let t = !0;
500
+ try {
501
+ if (!this[j]) {
502
+ this[j] = !0;
503
+ do {
504
+ let e = this[vi](), i = e.length === 0 ? 0 : I.readSync(this[m], e, 0, e.length, null);
505
+ if (!this[ki](i, e)) break;
506
+ } while (!0);
507
+ this[j] = !1;
508
+ }
509
+ t = !1;
510
+ } finally {
511
+ t && this[H]();
512
+ }
513
+ }
514
+ [H]() {
515
+ if (this[ht] && typeof this[m] == "number") {
516
+ let t = this[m];
517
+ this[m] = void 0, I.closeSync(t), this.emit("close");
518
+ }
519
+ }
520
+ };
521
+ var et = class extends Qr {
522
+ readable = !1;
523
+ writable = !0;
524
+ [bt] = !1;
525
+ [gt] = !1;
526
+ [te] = !1;
527
+ [Y] = [];
528
+ [ke] = !1;
529
+ [U];
530
+ [ie];
531
+ [ht];
532
+ [m];
533
+ [Me];
534
+ [tt];
535
+ [Ni] = !1;
536
+ [ot];
537
+ constructor(t, e) {
538
+ e = e || {}, super(e), this[U] = t, this[m] = typeof e.fd == "number" ? e.fd : void 0, this[ie] = e.mode === void 0 ? 438 : e.mode, this[ot] = typeof e.start == "number" ? e.start : void 0, this[ht] = typeof e.autoClose == "boolean" ? e.autoClose : !0;
539
+ let i = this[ot] !== void 0 ? "r+" : "w";
540
+ this[Me] = e.flags === void 0, this[tt] = e.flags === void 0 ? i : e.flags, this[m] === void 0 && this[at]();
541
+ }
542
+ emit(t, ...e) {
543
+ if (t === "error") {
544
+ if (this[bt]) return !1;
545
+ this[bt] = !0;
546
+ }
547
+ return super.emit(t, ...e);
548
+ }
549
+ get fd() {
550
+ return this[m];
551
+ }
552
+ get path() {
553
+ return this[U];
554
+ }
555
+ [Ut](t) {
556
+ this[H](), this[gt] = !0, this.emit("error", t);
557
+ }
558
+ [at]() {
559
+ I.open(this[U], this[tt], this[ie], (t, e) => this[Ht](t, e));
560
+ }
561
+ [Ht](t, e) {
562
+ this[Me] && this[tt] === "r+" && t && t.code === "ENOENT" ? (this[tt] = "w", this[at]()) : t ? this[Ut](t) : (this[m] = e, this.emit("open", e), this[gt] || this[Ai]());
563
+ }
564
+ end(t, e) {
565
+ return t && this.write(t, e), this[te] = !0, !this[gt] && !this[Y].length && typeof this[m] == "number" && this[Pt](null, 0), this;
566
+ }
567
+ write(t, e) {
568
+ return typeof t == "string" && (t = Buffer.from(t, e)), this[te] ? (this.emit("error", /* @__PURE__ */ new Error("write() after end()")), !1) : this[m] === void 0 || this[gt] || this[Y].length ? (this[Y].push(t), this[ke] = !0, !1) : (this[gt] = !0, this[ve](t), !0);
569
+ }
570
+ [ve](t) {
571
+ I.write(this[m], t, 0, t.length, this[ot], (e, i) => this[Pt](e, i));
572
+ }
573
+ [Pt](t, e) {
574
+ t ? this[Ut](t) : (this[ot] !== void 0 && typeof e == "number" && (this[ot] += e), this[Y].length ? this[Ai]() : (this[gt] = !1, this[te] && !this[Ni] ? (this[Ni] = !0, this[H](), this.emit("finish")) : this[ke] && (this[ke] = !1, this.emit("drain"))));
575
+ }
576
+ [Ai]() {
577
+ if (this[Y].length === 0) this[te] && this[Pt](null, 0);
578
+ else if (this[Y].length === 1) this[ve](this[Y].pop());
579
+ else {
580
+ let t = this[Y];
581
+ this[Y] = [], Jr(this[m], t, this[ot], (e, i) => this[Pt](e, i));
582
+ }
583
+ }
584
+ [H]() {
585
+ if (this[ht] && typeof this[m] == "number") {
586
+ let t = this[m];
587
+ this[m] = void 0, I.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
588
+ }
589
+ }
590
+ };
591
+ var Wt = class extends et {
592
+ [at]() {
593
+ let t;
594
+ if (this[Me] && this[tt] === "r+") try {
595
+ t = I.openSync(this[U], this[tt], this[ie]);
596
+ } catch (e) {
597
+ if (e?.code === "ENOENT") return this[tt] = "w", this[at]();
598
+ throw e;
599
+ }
600
+ else t = I.openSync(this[U], this[tt], this[ie]);
601
+ this[Ht](null, t);
602
+ }
603
+ [H]() {
604
+ if (this[ht] && typeof this[m] == "number") {
605
+ let t = this[m];
606
+ this[m] = void 0, I.closeSync(t), this.emit("close");
607
+ }
608
+ }
609
+ [ve](t) {
610
+ let e = !0;
611
+ try {
612
+ this[Pt](null, I.writeSync(this[m], t, 0, t.length, this[ot])), e = !1;
613
+ } finally {
614
+ if (e) try {
615
+ this[H]();
616
+ } catch {}
617
+ }
618
+ }
619
+ };
620
+ var jr = /* @__PURE__ */ new Map([
621
+ ["C", "cwd"],
622
+ ["f", "file"],
623
+ ["z", "gzip"],
624
+ ["P", "preservePaths"],
625
+ ["U", "unlink"],
626
+ ["strip-components", "strip"],
627
+ ["stripComponents", "strip"],
628
+ ["keep-newer", "newer"],
629
+ ["keepNewer", "newer"],
630
+ ["keep-newer-files", "newer"],
631
+ ["keepNewerFiles", "newer"],
632
+ ["k", "keep"],
633
+ ["keep-existing", "keep"],
634
+ ["keepExisting", "keep"],
635
+ ["m", "noMtime"],
636
+ ["no-mtime", "noMtime"],
637
+ ["p", "preserveOwner"],
638
+ ["L", "follow"],
639
+ ["h", "follow"],
640
+ ["onentry", "onReadEntry"]
641
+ ]);
642
+ var Fs = (s) => !!s.sync && !!s.file;
643
+ var ks = (s) => !s.sync && !!s.file;
644
+ var vs = (s) => !!s.sync && !s.file;
645
+ var Ms = (s) => !s.sync && !s.file;
646
+ var Bs = (s) => !!s.file;
647
+ var tn = (s) => {
648
+ return jr.get(s) || s;
649
+ };
650
+ var se = (s = {}) => {
651
+ if (!s) return {};
652
+ let t = {};
653
+ for (let [e, i] of Object.entries(s)) {
654
+ let r = tn(e);
655
+ t[r] = i;
656
+ }
657
+ return t.chmod === void 0 && t.noChmod === !1 && (t.chmod = !0), delete t.noChmod, t;
658
+ };
659
+ var K = (s, t, e, i, r) => Object.assign((n = [], o, h) => {
660
+ Array.isArray(n) && (o = n, n = {}), typeof o == "function" && (h = o, o = void 0), o = o ? Array.from(o) : [];
661
+ let a = se(n);
662
+ if (r?.(a, o), Fs(a)) {
663
+ if (typeof h == "function") throw new TypeError("callback not supported for sync tar functions");
664
+ return s(a, o);
665
+ } else if (ks(a)) {
666
+ let l = t(a, o);
667
+ return h ? l.then(() => h(), h) : l;
668
+ } else if (vs(a)) {
669
+ if (typeof h == "function") throw new TypeError("callback not supported for sync tar functions");
670
+ return e(a, o);
671
+ } else if (Ms(a)) {
672
+ if (typeof h == "function") throw new TypeError("callback only supported with file option");
673
+ return i(a, o);
674
+ }
675
+ throw new Error("impossible options??");
676
+ }, {
677
+ syncFile: s,
678
+ asyncFile: t,
679
+ syncNoFile: e,
680
+ asyncNoFile: i,
681
+ validate: r
682
+ });
683
+ var sn = en.constants || { ZLIB_VERNUM: 4736 };
684
+ var M = Object.freeze(Object.assign(Object.create(null), {
685
+ Z_NO_FLUSH: 0,
686
+ Z_PARTIAL_FLUSH: 1,
687
+ Z_SYNC_FLUSH: 2,
688
+ Z_FULL_FLUSH: 3,
689
+ Z_FINISH: 4,
690
+ Z_BLOCK: 5,
691
+ Z_OK: 0,
692
+ Z_STREAM_END: 1,
693
+ Z_NEED_DICT: 2,
694
+ Z_ERRNO: -1,
695
+ Z_STREAM_ERROR: -2,
696
+ Z_DATA_ERROR: -3,
697
+ Z_MEM_ERROR: -4,
698
+ Z_BUF_ERROR: -5,
699
+ Z_VERSION_ERROR: -6,
700
+ Z_NO_COMPRESSION: 0,
701
+ Z_BEST_SPEED: 1,
702
+ Z_BEST_COMPRESSION: 9,
703
+ Z_DEFAULT_COMPRESSION: -1,
704
+ Z_FILTERED: 1,
705
+ Z_HUFFMAN_ONLY: 2,
706
+ Z_RLE: 3,
707
+ Z_FIXED: 4,
708
+ Z_DEFAULT_STRATEGY: 0,
709
+ DEFLATE: 1,
710
+ INFLATE: 2,
711
+ GZIP: 3,
712
+ GUNZIP: 4,
713
+ DEFLATERAW: 5,
714
+ INFLATERAW: 6,
715
+ UNZIP: 7,
716
+ BROTLI_DECODE: 8,
717
+ BROTLI_ENCODE: 9,
718
+ Z_MIN_WINDOWBITS: 8,
719
+ Z_MAX_WINDOWBITS: 15,
720
+ Z_DEFAULT_WINDOWBITS: 15,
721
+ Z_MIN_CHUNK: 64,
722
+ Z_MAX_CHUNK: 1 / 0,
723
+ Z_DEFAULT_CHUNK: 16384,
724
+ Z_MIN_MEMLEVEL: 1,
725
+ Z_MAX_MEMLEVEL: 9,
726
+ Z_DEFAULT_MEMLEVEL: 8,
727
+ Z_MIN_LEVEL: -1,
728
+ Z_MAX_LEVEL: 9,
729
+ Z_DEFAULT_LEVEL: -1,
730
+ BROTLI_OPERATION_PROCESS: 0,
731
+ BROTLI_OPERATION_FLUSH: 1,
732
+ BROTLI_OPERATION_FINISH: 2,
733
+ BROTLI_OPERATION_EMIT_METADATA: 3,
734
+ BROTLI_MODE_GENERIC: 0,
735
+ BROTLI_MODE_TEXT: 1,
736
+ BROTLI_MODE_FONT: 2,
737
+ BROTLI_DEFAULT_MODE: 0,
738
+ BROTLI_MIN_QUALITY: 0,
739
+ BROTLI_MAX_QUALITY: 11,
740
+ BROTLI_DEFAULT_QUALITY: 11,
741
+ BROTLI_MIN_WINDOW_BITS: 10,
742
+ BROTLI_MAX_WINDOW_BITS: 24,
743
+ BROTLI_LARGE_MAX_WINDOW_BITS: 30,
744
+ BROTLI_DEFAULT_WINDOW: 22,
745
+ BROTLI_MIN_INPUT_BLOCK_BITS: 16,
746
+ BROTLI_MAX_INPUT_BLOCK_BITS: 24,
747
+ BROTLI_PARAM_MODE: 0,
748
+ BROTLI_PARAM_QUALITY: 1,
749
+ BROTLI_PARAM_LGWIN: 2,
750
+ BROTLI_PARAM_LGBLOCK: 3,
751
+ BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
752
+ BROTLI_PARAM_SIZE_HINT: 5,
753
+ BROTLI_PARAM_LARGE_WINDOW: 6,
754
+ BROTLI_PARAM_NPOSTFIX: 7,
755
+ BROTLI_PARAM_NDIRECT: 8,
756
+ BROTLI_DECODER_RESULT_ERROR: 0,
757
+ BROTLI_DECODER_RESULT_SUCCESS: 1,
758
+ BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
759
+ BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
760
+ BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
761
+ BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
762
+ BROTLI_DECODER_NO_ERROR: 0,
763
+ BROTLI_DECODER_SUCCESS: 1,
764
+ BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
765
+ BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
766
+ BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
767
+ BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
768
+ BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
769
+ BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
770
+ BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
771
+ BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
772
+ BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
773
+ BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
774
+ BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
775
+ BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
776
+ BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
777
+ BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
778
+ BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
779
+ BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
780
+ BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
781
+ BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
782
+ BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
783
+ BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
784
+ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
785
+ BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
786
+ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
787
+ BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
788
+ BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
789
+ BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
790
+ BROTLI_DECODER_ERROR_UNREACHABLE: -31
791
+ }, sn));
792
+ var rn = Buffer$1.concat;
793
+ var zs = Object.getOwnPropertyDescriptor(Buffer$1, "concat");
794
+ var nn = (s) => s;
795
+ var Bi = zs?.writable === !0 || zs?.set !== void 0 ? (s) => {
796
+ Buffer$1.concat = s ? nn : rn;
797
+ } : (s) => {};
798
+ var Tt = Symbol("_superWrite");
799
+ var Gt = class extends Error {
800
+ code;
801
+ errno;
802
+ constructor(t, e) {
803
+ super("zlib: " + t.message, { cause: t }), this.code = t.code, this.errno = t.errno, this.code || (this.code = "ZLIB_ERROR"), this.message = "zlib: " + t.message, Error.captureStackTrace(this, e ?? this.constructor);
804
+ }
805
+ get name() {
806
+ return "ZlibError";
807
+ }
808
+ };
809
+ var Pi = Symbol("flushFlag");
810
+ var re = class extends A {
811
+ #t = !1;
812
+ #i = !1;
813
+ #s;
814
+ #n;
815
+ #r;
816
+ #e;
817
+ #o;
818
+ get sawError() {
819
+ return this.#t;
820
+ }
821
+ get handle() {
822
+ return this.#e;
823
+ }
824
+ get flushFlag() {
825
+ return this.#s;
826
+ }
827
+ constructor(t, e) {
828
+ if (!t || typeof t != "object") throw new TypeError("invalid options for ZlibBase constructor");
829
+ if (super(t), this.#s = t.flush ?? 0, this.#n = t.finishFlush ?? 0, this.#r = t.fullFlushFlag ?? 0, typeof Ps[e] != "function") throw new TypeError("Compression method not supported: " + e);
830
+ try {
831
+ this.#e = new Ps[e](t);
832
+ } catch (i) {
833
+ throw new Gt(i, this.constructor);
834
+ }
835
+ this.#o = (i) => {
836
+ this.#t || (this.#t = !0, this.close(), this.emit("error", i));
837
+ }, this.#e?.on("error", (i) => this.#o(new Gt(i))), this.once("end", () => this.close);
838
+ }
839
+ close() {
840
+ this.#e && (this.#e.close(), this.#e = void 0, this.emit("close"));
841
+ }
842
+ reset() {
843
+ if (!this.#t) return zi(this.#e, "zlib binding closed"), this.#e.reset?.();
844
+ }
845
+ flush(t) {
846
+ this.ended || (typeof t != "number" && (t = this.#r), this.write(Object.assign(Buffer$1.alloc(0), { [Pi]: t })));
847
+ }
848
+ end(t, e, i) {
849
+ return typeof t == "function" && (i = t, e = void 0, t = void 0), typeof e == "function" && (i = e, e = void 0), t && (e ? this.write(t, e) : this.write(t)), this.flush(this.#n), this.#i = !0, super.end(i);
850
+ }
851
+ get ended() {
852
+ return this.#i;
853
+ }
854
+ [Tt](t) {
855
+ return super.write(t);
856
+ }
857
+ write(t, e, i) {
858
+ if (typeof e == "function" && (i = e, e = "utf8"), typeof t == "string" && (t = Buffer$1.from(t, e)), this.#t) return;
859
+ zi(this.#e, "zlib binding closed");
860
+ let r = this.#e._handle, n = r.close;
861
+ r.close = () => {};
862
+ let o = this.#e.close;
863
+ this.#e.close = () => {}, Bi(!0);
864
+ let h;
865
+ try {
866
+ let l = typeof t[Pi] == "number" ? t[Pi] : this.#s;
867
+ h = this.#e._processChunk(t, l), Bi(!1);
868
+ } catch (l) {
869
+ Bi(!1), this.#o(new Gt(l, this.write));
870
+ } finally {
871
+ this.#e && (this.#e._handle = r, r.close = n, this.#e.close = o, this.#e.removeAllListeners("error"));
872
+ }
873
+ this.#e && this.#e.on("error", (l) => this.#o(new Gt(l, this.write)));
874
+ let a;
875
+ if (h) if (Array.isArray(h) && h.length > 0) {
876
+ let l = h[0];
877
+ a = this[Tt](Buffer$1.from(l));
878
+ for (let c = 1; c < h.length; c++) a = this[Tt](h[c]);
879
+ } else a = this[Tt](Buffer$1.from(h));
880
+ return i && i(), a;
881
+ }
882
+ };
883
+ var Pe = class extends re {
884
+ #t;
885
+ #i;
886
+ constructor(t, e) {
887
+ t = t || {}, t.flush = t.flush || M.Z_NO_FLUSH, t.finishFlush = t.finishFlush || M.Z_FINISH, t.fullFlushFlag = M.Z_FULL_FLUSH, super(t, e), this.#t = t.level, this.#i = t.strategy;
888
+ }
889
+ params(t, e) {
890
+ if (!this.sawError) {
891
+ if (!this.handle) throw new Error("cannot switch params when binding is closed");
892
+ if (!this.handle.params) throw new Error("not supported in this implementation");
893
+ if (this.#t !== t || this.#i !== e) {
894
+ this.flush(M.Z_SYNC_FLUSH), zi(this.handle, "zlib binding closed");
895
+ let i = this.handle.flush;
896
+ this.handle.flush = (r, n) => {
897
+ typeof r == "function" && (n = r, r = this.flushFlag), this.flush(r), n?.();
898
+ };
899
+ try {
900
+ this.handle.params(t, e);
901
+ } finally {
902
+ this.handle.flush = i;
903
+ }
904
+ this.handle && (this.#t = t, this.#i = e);
905
+ }
906
+ }
907
+ }
908
+ };
909
+ var ze = class extends Pe {
910
+ #t;
911
+ constructor(t) {
912
+ super(t, "Gzip"), this.#t = t && !!t.portable;
913
+ }
914
+ [Tt](t) {
915
+ return this.#t ? (this.#t = !1, t[9] = 255, super[Tt](t)) : super[Tt](t);
916
+ }
917
+ };
918
+ var Ue = class extends Pe {
919
+ constructor(t) {
920
+ super(t, "Unzip");
921
+ }
922
+ };
923
+ var He = class extends re {
924
+ constructor(t, e) {
925
+ t = t || {}, t.flush = t.flush || M.BROTLI_OPERATION_PROCESS, t.finishFlush = t.finishFlush || M.BROTLI_OPERATION_FINISH, t.fullFlushFlag = M.BROTLI_OPERATION_FLUSH, super(t, e);
926
+ }
927
+ };
928
+ var We = class extends He {
929
+ constructor(t) {
930
+ super(t, "BrotliCompress");
931
+ }
932
+ };
933
+ var Ge = class extends He {
934
+ constructor(t) {
935
+ super(t, "BrotliDecompress");
936
+ }
937
+ };
938
+ var Ze = class extends re {
939
+ constructor(t, e) {
940
+ t = t || {}, t.flush = t.flush || M.ZSTD_e_continue, t.finishFlush = t.finishFlush || M.ZSTD_e_end, t.fullFlushFlag = M.ZSTD_e_flush, super(t, e);
941
+ }
942
+ };
943
+ var Ye = class extends Ze {
944
+ constructor(t) {
945
+ super(t, "ZstdCompress");
946
+ }
947
+ };
948
+ var Ke = class extends Ze {
949
+ constructor(t) {
950
+ super(t, "ZstdDecompress");
951
+ }
952
+ };
953
+ var Us = (s, t) => {
954
+ if (Number.isSafeInteger(s)) s < 0 ? an(s, t) : hn(s, t);
955
+ else throw Error("cannot encode number outside of javascript safe integer range");
956
+ return t;
957
+ };
958
+ var hn = (s, t) => {
959
+ t[0] = 128;
960
+ for (var e = t.length; e > 1; e--) t[e - 1] = s & 255, s = Math.floor(s / 256);
961
+ };
962
+ var an = (s, t) => {
963
+ t[0] = 255;
964
+ var e = !1;
965
+ s = s * -1;
966
+ for (var i = t.length; i > 1; i--) {
967
+ var r = s & 255;
968
+ s = Math.floor(s / 256), e ? t[i - 1] = Ws(r) : r === 0 ? t[i - 1] = 0 : (e = !0, t[i - 1] = Gs(r));
969
+ }
970
+ };
971
+ var Hs = (s) => {
972
+ let t = s[0], e = t === 128 ? cn(s.subarray(1, s.length)) : t === 255 ? ln(s) : null;
973
+ if (e === null) throw Error("invalid base256 encoding");
974
+ if (!Number.isSafeInteger(e)) throw Error("parsed number outside of javascript safe integer range");
975
+ return e;
976
+ };
977
+ var ln = (s) => {
978
+ for (var t = s.length, e = 0, i = !1, r = t - 1; r > -1; r--) {
979
+ var n = Number(s[r]), o;
980
+ i ? o = Ws(n) : n === 0 ? o = n : (i = !0, o = Gs(n)), o !== 0 && (e -= o * Math.pow(256, t - r - 1));
981
+ }
982
+ return e;
983
+ };
984
+ var cn = (s) => {
985
+ for (var t = s.length, e = 0, i = t - 1; i > -1; i--) {
986
+ var r = Number(s[i]);
987
+ r !== 0 && (e += r * Math.pow(256, t - i - 1));
988
+ }
989
+ return e;
990
+ };
991
+ var Ws = (s) => (255 ^ s) & 255;
992
+ var Gs = (s) => (255 ^ s) + 1 & 255;
993
+ var Hi = {};
994
+ Ur(Hi, {
995
+ code: () => Ve,
996
+ isCode: () => ne,
997
+ isName: () => dn,
998
+ name: () => oe,
999
+ normalFsTypes: () => Ui
1000
+ });
1001
+ var ne = (s) => oe.has(s);
1002
+ var dn = (s) => Ve.has(s);
1003
+ var Ui = /* @__PURE__ */ new Set([
1004
+ "0",
1005
+ "",
1006
+ "1",
1007
+ "2",
1008
+ "3",
1009
+ "4",
1010
+ "5",
1011
+ "6",
1012
+ "7",
1013
+ "D"
1014
+ ]);
1015
+ var oe = /* @__PURE__ */ new Map([
1016
+ ["0", "File"],
1017
+ ["", "OldFile"],
1018
+ ["1", "Link"],
1019
+ ["2", "SymbolicLink"],
1020
+ ["3", "CharacterDevice"],
1021
+ ["4", "BlockDevice"],
1022
+ ["5", "Directory"],
1023
+ ["6", "FIFO"],
1024
+ ["7", "ContiguousFile"],
1025
+ ["g", "GlobalExtendedHeader"],
1026
+ ["x", "ExtendedHeader"],
1027
+ ["A", "SolarisACL"],
1028
+ ["D", "GNUDumpDir"],
1029
+ ["I", "Inode"],
1030
+ ["K", "NextFileHasLongLinkpath"],
1031
+ ["L", "NextFileHasLongPath"],
1032
+ ["M", "ContinuationFile"],
1033
+ ["N", "OldGnuLongPath"],
1034
+ ["S", "SparseFile"],
1035
+ ["V", "TapeVolumeHeader"],
1036
+ ["X", "OldExtendedHeader"]
1037
+ ]);
1038
+ var Ve = new Map(Array.from(oe).map((s) => [s[1], s[0]]));
1039
+ var un = (s) => s === void 0 || s < 0 ? void 0 : s;
1040
+ var F = class {
1041
+ cksumValid = !1;
1042
+ needPax = !1;
1043
+ nullBlock = !1;
1044
+ block;
1045
+ path;
1046
+ mode;
1047
+ uid;
1048
+ gid;
1049
+ size;
1050
+ cksum;
1051
+ #t = "Unsupported";
1052
+ linkpath;
1053
+ uname;
1054
+ gname;
1055
+ devmaj = 0;
1056
+ devmin = 0;
1057
+ atime;
1058
+ ctime;
1059
+ mtime;
1060
+ charset;
1061
+ comment;
1062
+ constructor(t, e = 0, i, r) {
1063
+ Buffer.isBuffer(t) ? this.decode(t, e || 0, i, r) : t && this.#i(t);
1064
+ }
1065
+ decode(t, e, i, r) {
1066
+ if (e || (e = 0), !t || !(t.length >= e + 512)) throw new Error("need 512 bytes for header");
1067
+ let n = xt(t, e + 156, 1), o = Ui.has(n), h = o ? i : void 0, a = o ? r : void 0;
1068
+ if (this.path = h?.path ?? xt(t, e, 100), this.mode = h?.mode ?? a?.mode ?? lt(t, e + 100, 8), this.uid = h?.uid ?? a?.uid ?? lt(t, e + 108, 8), this.gid = h?.gid ?? a?.gid ?? lt(t, e + 116, 8), this.size = un(h?.size ?? a?.size ?? lt(t, e + 124, 12)), this.mtime = h?.mtime ?? a?.mtime ?? Wi(t, e + 136, 12), this.cksum = lt(t, e + 148, 12), a && this.#i(a, !0), h && this.#i(h), ne(n) && (this.#t = n || "0"), this.#t === "0" && this.path.slice(-1) === "/" && (this.#t = "5"), this.#t === "5" && (this.size = 0), this.linkpath = xt(t, e + 157, 100), t.subarray(e + 257, e + 265).toString() === "ustar\x0000") if (this.uname = h?.uname ?? a?.uname ?? xt(t, e + 265, 32), this.gname = h?.gname ?? a?.gname ?? xt(t, e + 297, 32), this.devmaj = h?.devmaj ?? a?.devmaj ?? lt(t, e + 329, 8) ?? 0, this.devmin = h?.devmin ?? a?.devmin ?? lt(t, e + 337, 8) ?? 0, t[e + 475] !== 0) {
1069
+ let c = xt(t, e + 345, 155);
1070
+ this.path = c + "/" + this.path;
1071
+ } else {
1072
+ let c = xt(t, e + 345, 130);
1073
+ c && (this.path = c + "/" + this.path), this.atime = i?.atime ?? r?.atime ?? Wi(t, e + 476, 12), this.ctime = i?.ctime ?? r?.ctime ?? Wi(t, e + 488, 12);
1074
+ }
1075
+ let l = 256;
1076
+ for (let c = e; c < e + 148; c++) l += t[c];
1077
+ for (let c = e + 156; c < e + 512; c++) l += t[c];
1078
+ this.cksumValid = l === this.cksum, this.cksum === void 0 && l === 256 && (this.nullBlock = !0);
1079
+ }
1080
+ #i(t, e = !1) {
1081
+ Object.assign(this, Object.fromEntries(Object.entries(t).filter(([i, r]) => !(r == null || i === "size" && Number(r) < 0 || i === "path" && e || i === "linkpath" && e || i === "global"))));
1082
+ }
1083
+ encode(t, e = 0) {
1084
+ if (t || (t = this.block = Buffer.alloc(512)), this.#t === "Unsupported" && (this.#t = "0"), !(t.length >= e + 512)) throw new Error("need 512 bytes for header");
1085
+ let i = this.ctime || this.atime ? 130 : 155, r = mn(this.path || "", i), n = r[0], o = r[1];
1086
+ this.needPax = !!r[2], this.needPax = Lt(t, e, 100, n) || this.needPax, this.needPax = ct(t, e + 100, 8, this.mode) || this.needPax, this.needPax = ct(t, e + 108, 8, this.uid) || this.needPax, this.needPax = ct(t, e + 116, 8, this.gid) || this.needPax, this.needPax = ct(t, e + 124, 12, this.size) || this.needPax, this.needPax = Gi(t, e + 136, 12, this.mtime) || this.needPax, t[e + 156] = Number(this.#t.codePointAt(0)), this.needPax = Lt(t, e + 157, 100, this.linkpath) || this.needPax, t.write("ustar\x0000", e + 257, 8), this.needPax = Lt(t, e + 265, 32, this.uname) || this.needPax, this.needPax = Lt(t, e + 297, 32, this.gname) || this.needPax, this.needPax = ct(t, e + 329, 8, this.devmaj) || this.needPax, this.needPax = ct(t, e + 337, 8, this.devmin) || this.needPax, this.needPax = Lt(t, e + 345, i, o) || this.needPax, t[e + 475] !== 0 ? this.needPax = Lt(t, e + 345, 155, o) || this.needPax : (this.needPax = Lt(t, e + 345, 130, o) || this.needPax, this.needPax = Gi(t, e + 476, 12, this.atime) || this.needPax, this.needPax = Gi(t, e + 488, 12, this.ctime) || this.needPax);
1087
+ let h = 256;
1088
+ for (let a = e; a < e + 148; a++) h += t[a];
1089
+ for (let a = e + 156; a < e + 512; a++) h += t[a];
1090
+ return this.cksum = h, ct(t, e + 148, 8, this.cksum), this.cksumValid = !0, this.needPax;
1091
+ }
1092
+ get type() {
1093
+ return this.#t === "Unsupported" ? this.#t : oe.get(this.#t);
1094
+ }
1095
+ get typeKey() {
1096
+ return this.#t;
1097
+ }
1098
+ set type(t) {
1099
+ let e = String(Ve.get(t));
1100
+ if (ne(e) || e === "Unsupported") this.#t = e;
1101
+ else if (ne(t)) this.#t = t;
1102
+ else throw new TypeError("invalid entry type: " + t);
1103
+ }
1104
+ };
1105
+ var mn = (s, t) => {
1106
+ let i = s, r = "", n, o = posix.parse(s).root || ".";
1107
+ if (Buffer.byteLength(i) < 100) n = [
1108
+ i,
1109
+ r,
1110
+ !1
1111
+ ];
1112
+ else {
1113
+ r = posix.dirname(i), i = posix.basename(i);
1114
+ do
1115
+ Buffer.byteLength(i) <= 100 && Buffer.byteLength(r) <= t ? n = [
1116
+ i,
1117
+ r,
1118
+ !1
1119
+ ] : Buffer.byteLength(i) > 100 && Buffer.byteLength(r) <= t ? n = [
1120
+ i.slice(0, 99),
1121
+ r,
1122
+ !0
1123
+ ] : (i = posix.join(posix.basename(r), i), r = posix.dirname(r));
1124
+ while (r !== o && n === void 0);
1125
+ n || (n = [
1126
+ s.slice(0, 99),
1127
+ "",
1128
+ !0
1129
+ ]);
1130
+ }
1131
+ return n;
1132
+ };
1133
+ var xt = (s, t, e) => s.subarray(t, t + e).toString("utf8").replace(/\0.*/, "");
1134
+ var Wi = (s, t, e) => pn(lt(s, t, e));
1135
+ var pn = (s) => s === void 0 ? void 0 : /* @__PURE__ */ new Date(s * 1e3);
1136
+ var lt = (s, t, e) => Number(s[t]) & 128 ? Hs(s.subarray(t, t + e)) : wn(s, t, e);
1137
+ var En = (s) => isNaN(s) ? void 0 : s;
1138
+ var wn = (s, t, e) => En(parseInt(s.subarray(t, t + e).toString("utf8").replace(/\0.*$/, "").trim(), 8));
1139
+ var Sn = {
1140
+ 12: 8589934591,
1141
+ 8: 2097151
1142
+ };
1143
+ var ct = (s, t, e, i) => i === void 0 ? !1 : i > Sn[e] || i < 0 ? (Us(i, s.subarray(t, t + e)), !0) : (yn(s, t, e, i), !1);
1144
+ var yn = (s, t, e, i) => s.write(Rn(i, e), t, e, "ascii");
1145
+ var Rn = (s, t) => gn(Math.floor(s).toString(8), t);
1146
+ var gn = (s, t) => (s.length === t - 1 ? s : new Array(t - s.length - 1).join("0") + s + " ") + "\0";
1147
+ var Gi = (s, t, e, i) => i === void 0 ? !1 : ct(s, t, e, i.getTime() / 1e3);
1148
+ var bn = new Array(156).join("\0");
1149
+ var Lt = (s, t, e, i) => i === void 0 ? !1 : (s.write(i + bn, t, e, "utf8"), i.length !== Buffer.byteLength(i) || i.length > e);
1150
+ var ft = class s {
1151
+ atime;
1152
+ mtime;
1153
+ ctime;
1154
+ charset;
1155
+ comment;
1156
+ gid;
1157
+ uid;
1158
+ gname;
1159
+ uname;
1160
+ linkpath;
1161
+ dev;
1162
+ ino;
1163
+ nlink;
1164
+ path;
1165
+ size;
1166
+ mode;
1167
+ global;
1168
+ constructor(t, e = !1) {
1169
+ this.atime = t.atime, this.charset = t.charset, this.comment = t.comment, this.ctime = t.ctime, this.dev = t.dev, this.gid = t.gid, this.global = e, this.gname = t.gname, this.ino = t.ino, this.linkpath = t.linkpath, this.mtime = t.mtime, this.nlink = t.nlink, this.path = t.path, this.size = t.size, this.uid = t.uid, this.uname = t.uname;
1170
+ }
1171
+ encode() {
1172
+ let t = this.encodeBody();
1173
+ if (t === "") return Buffer.allocUnsafe(0);
1174
+ let e = Buffer.byteLength(t), i = 512 * Math.ceil(1 + e / 512), r = Buffer.allocUnsafe(i);
1175
+ for (let n = 0; n < 512; n++) r[n] = 0;
1176
+ new F({
1177
+ path: ("PaxHeader/" + basename(this.path ?? "")).slice(0, 99),
1178
+ mode: this.mode || 420,
1179
+ uid: this.uid,
1180
+ gid: this.gid,
1181
+ size: e,
1182
+ mtime: this.mtime,
1183
+ type: this.global ? "GlobalExtendedHeader" : "ExtendedHeader",
1184
+ linkpath: "",
1185
+ uname: this.uname || "",
1186
+ gname: this.gname || "",
1187
+ devmaj: 0,
1188
+ devmin: 0,
1189
+ atime: this.atime,
1190
+ ctime: this.ctime
1191
+ }).encode(r), r.write(t, 512, e, "utf8");
1192
+ for (let n = e + 512; n < r.length; n++) r[n] = 0;
1193
+ return r;
1194
+ }
1195
+ encodeBody() {
1196
+ 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");
1197
+ }
1198
+ encodeField(t) {
1199
+ if (this[t] === void 0) return "";
1200
+ let e = this[t], i = e instanceof Date ? e.getTime() / 1e3 : e, r = " " + (t === "dev" || t === "ino" || t === "nlink" ? "SCHILY." : "") + t + "=" + i + `
1201
+ `, n = Buffer.byteLength(r), o = Math.floor(Math.log(n) / Math.log(10)) + 1;
1202
+ return n + o >= Math.pow(10, o) && (o += 1), o + n + r;
1203
+ }
1204
+ static parse(t, e, i = !1) {
1205
+ return new s(On(Tn(t), e), i);
1206
+ }
1207
+ };
1208
+ var On = (s, t) => t ? Object.assign({}, t, s) : s;
1209
+ var Tn = (s) => s.replace(/\n$/, "").split(`
1210
+ `).reduce(xn, Object.create(null));
1211
+ var xn = (s, t) => {
1212
+ let e = parseInt(t, 10);
1213
+ if (e !== Buffer.byteLength(t) + 1) return s;
1214
+ t = t.slice((e + " ").length);
1215
+ let i = t.split("="), r = i.shift();
1216
+ if (!r) return s;
1217
+ let n = r.replace(/^SCHILY\.(dev|ino|nlink)/, "$1"), o = i.join("=").replace(/\0.*/, "");
1218
+ switch (n) {
1219
+ case "path":
1220
+ case "linkpath":
1221
+ case "type":
1222
+ case "charset":
1223
+ case "comment":
1224
+ case "gname":
1225
+ case "uname":
1226
+ s[n] = o;
1227
+ break;
1228
+ case "ctime":
1229
+ case "atime":
1230
+ case "mtime":
1231
+ s[n] = /* @__PURE__ */ new Date(Number(o) * 1e3);
1232
+ break;
1233
+ case "size":
1234
+ let h = +o;
1235
+ h >= 0 && (s[n] = h);
1236
+ break;
1237
+ case "gid":
1238
+ case "uid":
1239
+ case "dev":
1240
+ case "ino":
1241
+ case "nlink":
1242
+ case "mode": s[n] = +o;
1243
+ }
1244
+ return s;
1245
+ };
1246
+ var f = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) !== "win32" ? (s) => String(s) : (s) => String(s).replaceAll(/\\/g, "/");
1247
+ var $e = class extends A {
1248
+ extended;
1249
+ globalExtended;
1250
+ header;
1251
+ startBlockSize;
1252
+ blockRemain;
1253
+ remain;
1254
+ type;
1255
+ meta = !1;
1256
+ ignore = !1;
1257
+ path;
1258
+ mode;
1259
+ uid;
1260
+ gid;
1261
+ uname;
1262
+ gname;
1263
+ size = 0;
1264
+ mtime;
1265
+ atime;
1266
+ ctime;
1267
+ linkpath;
1268
+ dev;
1269
+ ino;
1270
+ nlink;
1271
+ invalid = !1;
1272
+ absolute;
1273
+ unsupported = !1;
1274
+ constructor(t, e, i) {
1275
+ switch (super({}), this.pause(), this.extended = e, this.globalExtended = i, this.header = t, this.remain = t.size ?? 0, this.startBlockSize = 512 * Math.ceil(this.remain / 512), this.blockRemain = this.startBlockSize, this.type = t.type, this.type) {
1276
+ case "File":
1277
+ case "OldFile":
1278
+ case "Link":
1279
+ case "SymbolicLink":
1280
+ case "CharacterDevice":
1281
+ case "BlockDevice":
1282
+ case "Directory":
1283
+ case "FIFO":
1284
+ case "ContiguousFile":
1285
+ case "GNUDumpDir": break;
1286
+ case "NextFileHasLongLinkpath":
1287
+ case "NextFileHasLongPath":
1288
+ case "OldGnuLongPath":
1289
+ case "GlobalExtendedHeader":
1290
+ case "ExtendedHeader":
1291
+ case "OldExtendedHeader":
1292
+ this.meta = !0;
1293
+ break;
1294
+ default: this.ignore = !0;
1295
+ }
1296
+ if (!t.path) throw new Error("no path provided for tar.ReadEntry");
1297
+ this.path = f(t.path), this.mode = t.mode, this.mode && (this.mode = this.mode & 4095), this.uid = t.uid, this.gid = t.gid, this.uname = t.uname, this.gname = t.gname, this.size = this.remain, this.mtime = t.mtime, this.atime = t.atime, this.ctime = t.ctime, this.linkpath = t.linkpath ? f(t.linkpath) : void 0, this.uname = t.uname, this.gname = t.gname, e && this.#t(e), i && this.#t(i, !0);
1298
+ }
1299
+ write(t) {
1300
+ let e = t.length;
1301
+ if (e > this.blockRemain) throw new Error("writing more to entry than is appropriate");
1302
+ let i = this.remain, r = this.blockRemain;
1303
+ return this.remain = Math.max(0, i - e), this.blockRemain = Math.max(0, r - e), this.ignore ? !0 : i >= e ? super.write(t) : super.write(t.subarray(0, i));
1304
+ }
1305
+ #t(t, e = !1) {
1306
+ t.path && (t.path = f(t.path)), t.linkpath && (t.linkpath = f(t.linkpath)), Object.assign(this, Object.fromEntries(Object.entries(t).filter(([i, r]) => !(r == null || i === "path" && e))));
1307
+ }
1308
+ };
1309
+ var Dt = (s, t, e, i = {}) => {
1310
+ s.file && (i.file = s.file), s.cwd && (i.cwd = s.cwd), i.code = e instanceof Error && e.code || t, i.tarCode = t, !s.strict && i.recoverable !== !1 ? (e instanceof Error && (i = Object.assign(e, i), e = e.message), s.emit("warn", t, e, i)) : e instanceof Error ? s.emit("error", Object.assign(e, i)) : s.emit("error", Object.assign(/* @__PURE__ */ new Error(`${t}: ${e}`), i));
1311
+ };
1312
+ var Nn = 1048576;
1313
+ var Xi = Buffer.from([31, 139]);
1314
+ var qi = Buffer.from([
1315
+ 40,
1316
+ 181,
1317
+ 47,
1318
+ 253
1319
+ ]);
1320
+ var An = Math.max(Xi.length, qi.length);
1321
+ var B = Symbol("state");
1322
+ var Nt = Symbol("writeEntry");
1323
+ var it = Symbol("readEntry");
1324
+ var Zi = Symbol("nextEntry");
1325
+ var Zs = Symbol("processEntry");
1326
+ var V = Symbol("extendedHeader");
1327
+ var he = Symbol("globalExtendedHeader");
1328
+ var dt = Symbol("meta");
1329
+ var Ys = Symbol("emitMeta");
1330
+ var p = Symbol("buffer");
1331
+ var st = Symbol("queue");
1332
+ var ut = Symbol("ended");
1333
+ var Yi = Symbol("emittedEnd");
1334
+ var At = Symbol("emit");
1335
+ var w = Symbol("unzip");
1336
+ var Xe = Symbol("consumeChunk");
1337
+ var qe = Symbol("consumeChunkSub");
1338
+ var Ki = Symbol("consumeBody");
1339
+ var Ks = Symbol("consumeMeta");
1340
+ var Vs = Symbol("consumeHeader");
1341
+ var ae = Symbol("consuming");
1342
+ var Vi = Symbol("bufferConcat");
1343
+ var Qe = Symbol("maybeEnd");
1344
+ var Yt = Symbol("writing");
1345
+ var $ = Symbol("aborted");
1346
+ var Je = Symbol("onDone");
1347
+ var It = Symbol("sawValidEntry");
1348
+ var je = Symbol("sawNullBlock");
1349
+ var ti = Symbol("sawEOF");
1350
+ var $s = Symbol("closeStream");
1351
+ var In = 1e3;
1352
+ var le = Symbol("compressedBytesRead");
1353
+ var $i = Symbol("decompressedBytesRead");
1354
+ var Xs = Symbol("checkDecompressionRatio");
1355
+ var Cn = () => !0;
1356
+ var rt = class extends EventEmitter$1 {
1357
+ file;
1358
+ strict;
1359
+ maxMetaEntrySize;
1360
+ filter;
1361
+ brotli;
1362
+ zstd;
1363
+ maxDecompressionRatio;
1364
+ writable = !0;
1365
+ readable = !1;
1366
+ [st] = [];
1367
+ [p];
1368
+ [it];
1369
+ [Nt];
1370
+ [B] = "begin";
1371
+ [dt] = "";
1372
+ [V];
1373
+ [he];
1374
+ [ut] = !1;
1375
+ [w];
1376
+ [$] = !1;
1377
+ [It];
1378
+ [je] = !1;
1379
+ [ti] = !1;
1380
+ [Yt] = !1;
1381
+ [ae] = !1;
1382
+ [Yi] = !1;
1383
+ [le] = 0;
1384
+ [$i] = 0;
1385
+ constructor(t = {}) {
1386
+ super(), this.file = t.file || "", this.on(Je, () => {
1387
+ (this[B] === "begin" || this[It] === !1) && this.warn("TAR_BAD_ARCHIVE", "Unrecognized archive format");
1388
+ }), t.ondone ? this.on(Je, t.ondone) : this.on(Je, () => {
1389
+ this.emit("prefinish"), this.emit("finish"), this.emit("end");
1390
+ }), this.strict = !!t.strict, this.maxDecompressionRatio = typeof t.maxDecompressionRatio == "number" ? t.maxDecompressionRatio : In, this.maxMetaEntrySize = t.maxMetaEntrySize || Nn, this.filter = typeof t.filter == "function" ? t.filter : Cn;
1391
+ let e = t.file && (t.file.endsWith(".tar.br") || t.file.endsWith(".tbr"));
1392
+ this.brotli = !(t.gzip || t.zstd) && t.brotli !== void 0 ? t.brotli : e ? void 0 : !1;
1393
+ let i = t.file && (t.file.endsWith(".tar.zst") || t.file.endsWith(".tzst"));
1394
+ this.zstd = !(t.gzip || t.brotli) && t.zstd !== void 0 ? t.zstd : i ? !0 : void 0, this.on("end", () => this[$s]()), typeof t.onwarn == "function" && this.on("warn", t.onwarn), typeof t.onReadEntry == "function" && this.on("entry", t.onReadEntry);
1395
+ }
1396
+ warn(t, e, i = {}) {
1397
+ Dt(this, t, e, i);
1398
+ }
1399
+ [Vs](t, e) {
1400
+ this[It] === void 0 && (this[It] = !1);
1401
+ let i;
1402
+ try {
1403
+ i = new F(t, e, this[V], this[he]);
1404
+ } catch (r) {
1405
+ return this.warn("TAR_ENTRY_INVALID", r);
1406
+ }
1407
+ if (i.nullBlock) this[je] ? (this[ti] = !0, this[B] === "begin" && (this[B] = "header"), this[At]("eof")) : (this[je] = !0, this[At]("nullBlock"));
1408
+ else if (this[je] = !1, !i.cksumValid) this.warn("TAR_ENTRY_INVALID", "checksum failure", { header: i });
1409
+ else if (!i.path) this.warn("TAR_ENTRY_INVALID", "path is required", { header: i });
1410
+ else {
1411
+ let r = i.type;
1412
+ if (/^(Symbolic)?Link$/.test(r) && !i.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath required", { header: i });
1413
+ else if (!/^(Symbolic)?Link$/.test(r) && !/^(Global)?ExtendedHeader$/.test(r) && i.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath forbidden", { header: i });
1414
+ else {
1415
+ let n = this[Nt] = new $e(i, this[V], this[he]);
1416
+ if (!this[It]) if (n.remain) {
1417
+ let o = () => {
1418
+ n.invalid || (this[It] = !0);
1419
+ };
1420
+ n.on("end", o);
1421
+ } else this[It] = !0;
1422
+ n.meta ? n.size > this.maxMetaEntrySize ? (n.ignore = !0, this[At]("ignoredEntry", n), this[B] = "ignore", n.resume()) : n.size > 0 && (this[dt] = "", n.on("data", (o) => this[dt] += o), this[B] = "meta") : (this[V] = void 0, n.ignore = n.ignore || !this.filter(n.path, n), n.ignore ? (this[At]("ignoredEntry", n), this[B] = n.remain ? "ignore" : "header", n.resume()) : (n.remain ? this[B] = "body" : (this[B] = "header", n.end()), this[it] ? this[st].push(n) : (this[st].push(n), this[Zi]())));
1423
+ }
1424
+ }
1425
+ }
1426
+ [$s]() {
1427
+ queueMicrotask(() => this.emit("close"));
1428
+ }
1429
+ [Zs](t) {
1430
+ let e = !0;
1431
+ if (!t) this[it] = void 0, e = !1;
1432
+ else if (Array.isArray(t)) {
1433
+ let [i, ...r] = t;
1434
+ this.emit(i, ...r);
1435
+ } else this[it] = t, this.emit("entry", t), t.emittedEnd || (t.on("end", () => this[Zi]()), e = !1);
1436
+ return e;
1437
+ }
1438
+ [Zi]() {
1439
+ do ;
1440
+ while (this[Zs](this[st].shift()));
1441
+ if (this[st].length === 0) {
1442
+ let t = this[it];
1443
+ !t || t.flowing || t.size === t.remain ? this[Yt] || this.emit("drain") : t.once("drain", () => this.emit("drain"));
1444
+ }
1445
+ }
1446
+ [Ki](t, e) {
1447
+ let i = this[Nt];
1448
+ if (!i) throw new Error("attempt to consume body without entry??");
1449
+ let r = i.blockRemain ?? 0, n = r >= t.length && e === 0 ? t : t.subarray(e, e + r);
1450
+ return i.write(n), i.blockRemain || (this[B] = "header", this[Nt] = void 0, i.end()), n.length;
1451
+ }
1452
+ [Ks](t, e) {
1453
+ let i = this[Nt], r = this[Ki](t, e);
1454
+ return !this[Nt] && i && this[Ys](i), r;
1455
+ }
1456
+ [At](t, e, i) {
1457
+ this[st].length === 0 && !this[it] ? this.emit(t, e, i) : this[st].push([
1458
+ t,
1459
+ e,
1460
+ i
1461
+ ]);
1462
+ }
1463
+ [Ys](t) {
1464
+ switch (this[At]("meta", this[dt]), t.type) {
1465
+ case "ExtendedHeader":
1466
+ case "OldExtendedHeader":
1467
+ this[V] = ft.parse(this[dt], this[V], !1);
1468
+ break;
1469
+ case "GlobalExtendedHeader":
1470
+ this[he] = ft.parse(this[dt], this[he], !0);
1471
+ break;
1472
+ case "NextFileHasLongPath":
1473
+ case "OldGnuLongPath": {
1474
+ let e = this[V] ?? Object.create(null);
1475
+ this[V] = e, e.path = this[dt].replace(/\0.*/, "");
1476
+ break;
1477
+ }
1478
+ case "NextFileHasLongLinkpath": {
1479
+ let e = this[V] || Object.create(null);
1480
+ this[V] = e, e.linkpath = this[dt].replace(/\0.*/, "");
1481
+ break;
1482
+ }
1483
+ default: throw new Error("unknown meta: " + t.type);
1484
+ }
1485
+ }
1486
+ abort(t) {
1487
+ if (!this[$]) {
1488
+ if (this[w]) {
1489
+ let e = this[w];
1490
+ e.write = () => !0, e.end = () => e, e.emit = () => !1, e.destroy?.();
1491
+ }
1492
+ this[$] = !0, this.emit("abort", t), this.warn("TAR_ABORT", t, { recoverable: !1 });
1493
+ }
1494
+ }
1495
+ [Xs](t) {
1496
+ this[$i] += t.length;
1497
+ let e = this[$i] / this[le];
1498
+ return e > this.maxDecompressionRatio ? (this.abort(/* @__PURE__ */ new Error(`max decompression ratio exceeded: ${e.toFixed(2)} > ${this.maxDecompressionRatio}`)), !1) : !0;
1499
+ }
1500
+ write(t, e, i) {
1501
+ if (typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, typeof e == "string" ? e : "utf8")), this[$]) return i?.(), !1;
1502
+ if ((this[w] === void 0 || this.brotli === void 0 && this[w] === !1) && t) {
1503
+ if (this[p] && (t = Buffer.concat([this[p], t]), this[p] = void 0), t.length < An) return this[p] = t, i?.(), !0;
1504
+ for (let a = 0; this[w] === void 0 && a < Xi.length; a++) t[a] !== Xi[a] && (this[w] = !1);
1505
+ let o = !1;
1506
+ if (this[w] === !1 && this.zstd !== !1) {
1507
+ o = !0;
1508
+ for (let a = 0; a < qi.length; a++) if (t[a] !== qi[a]) {
1509
+ o = !1;
1510
+ break;
1511
+ }
1512
+ }
1513
+ let h = this.brotli === void 0 && !o;
1514
+ if (this[w] === !1 && h) if (t.length < 512) if (this[ut]) this.brotli = !0;
1515
+ else return this[p] = t, i?.(), !0;
1516
+ else try {
1517
+ new F(t.subarray(0, 512)), this.brotli = !1;
1518
+ } catch {
1519
+ this.brotli = !0;
1520
+ }
1521
+ if (this[w] === void 0 || this[w] === !1 && (this.brotli || o)) {
1522
+ let a = this[ut];
1523
+ this[ut] = !1, this[w] = this[w] === void 0 ? new Ue({}) : o ? new Ke({}) : new Ge({}), this[w].on("data", (c) => {
1524
+ this[Xs](c) && this[Xe](c);
1525
+ }), this[w].on("error", (c) => {
1526
+ this[$] || this.abort(c);
1527
+ }), this[w].on("end", () => {
1528
+ this[ut] = !0, this[Xe]();
1529
+ }), this[Yt] = !0, this[le] += t.length;
1530
+ let l = !!this[w][a ? "end" : "write"](t);
1531
+ return this[Yt] = !1, i?.(), l;
1532
+ }
1533
+ }
1534
+ this[Yt] = !0, this[w] ? (this[le] += t.length, this[w].write(t)) : this[Xe](t), this[Yt] = !1;
1535
+ let n = this[st].length > 0 ? !1 : this[it] ? this[it].flowing : !0;
1536
+ return !n && this[st].length === 0 && this[it]?.once("drain", () => this.emit("drain")), i?.(), n;
1537
+ }
1538
+ [Vi](t) {
1539
+ t && !this[$] && (this[p] = this[p] ? Buffer.concat([this[p], t]) : t);
1540
+ }
1541
+ [Qe]() {
1542
+ if (this[ut] && !this[Yi] && !this[$] && !this[ae]) {
1543
+ this[Yi] = !0;
1544
+ let t = this[Nt];
1545
+ if (t?.blockRemain) {
1546
+ let e = this[p] ? this[p].length : 0;
1547
+ this.warn("TAR_BAD_ARCHIVE", `Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`, { entry: t }), this[p] && t.write(this[p]), t.end();
1548
+ }
1549
+ this[At](Je);
1550
+ }
1551
+ }
1552
+ [Xe](t) {
1553
+ if (this[ae] && t) this[Vi](t);
1554
+ else if (!t && !this[p]) this[Qe]();
1555
+ else if (t) {
1556
+ if (this[ae] = !0, this[p]) {
1557
+ this[Vi](t);
1558
+ let e = this[p];
1559
+ this[p] = void 0, this[qe](e);
1560
+ } else this[qe](t);
1561
+ for (; this[p] && this[p]?.length >= 512 && !this[$] && !this[ti];) {
1562
+ let e = this[p];
1563
+ this[p] = void 0, this[qe](e);
1564
+ }
1565
+ this[ae] = !1;
1566
+ }
1567
+ (!this[p] || this[ut]) && this[Qe]();
1568
+ }
1569
+ [qe](t) {
1570
+ let e = 0, i = t.length;
1571
+ for (; e + 512 <= i && !this[$] && !this[ti];) switch (this[B]) {
1572
+ case "begin":
1573
+ case "header":
1574
+ this[Vs](t, e), e += 512;
1575
+ break;
1576
+ case "ignore":
1577
+ case "body":
1578
+ e += this[Ki](t, e);
1579
+ break;
1580
+ case "meta":
1581
+ e += this[Ks](t, e);
1582
+ break;
1583
+ default: throw new Error("invalid state: " + this[B]);
1584
+ }
1585
+ e < i && (this[p] = this[p] ? Buffer.concat([t.subarray(e), this[p]]) : t.subarray(e));
1586
+ }
1587
+ end(t, e, i) {
1588
+ return typeof t == "function" && (i = t, e = void 0, t = void 0), typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, e)), i && this.once("finish", i), this[$] || (this[w] ? (t && (this[le] += t.length, this[w].write(t)), this[w].end()) : (this[ut] = !0, (this.brotli === void 0 || this.zstd === void 0) && (t = t || Buffer.alloc(0)), t && this.write(t), this[Qe]())), this;
1589
+ }
1590
+ };
1591
+ var mt = (s) => {
1592
+ let t = s.length - 1, e = -1;
1593
+ for (; t > -1 && s.charAt(t) === "/";) e = t, t--;
1594
+ return e === -1 ? s : s.slice(0, e);
1595
+ };
1596
+ var vn = (s) => {
1597
+ let t = s.onReadEntry;
1598
+ s.onReadEntry = t ? (e) => {
1599
+ t(e), e.resume();
1600
+ } : (e) => e.resume();
1601
+ };
1602
+ var Qi = (s, t) => {
1603
+ let e = new Map(t.map((o) => [mt(o), !0])), i = s.filter, r = 100, n = (o, h = "", a = 0) => {
1604
+ if (a >= r) return e.set(o, !1), !1;
1605
+ let l = h || parse(o).root || ".", c;
1606
+ if (o === l) c = !1;
1607
+ else {
1608
+ let d = e.get(o);
1609
+ c = d !== void 0 ? d : n(dirname(o), l, a + 1);
1610
+ }
1611
+ return e.set(o, c), c;
1612
+ };
1613
+ s.filter = i ? (o, h) => i(o, h) && n(mt(o)) : (o) => n(mt(o));
1614
+ };
1615
+ var Mn = (s) => {
1616
+ let t = new rt(s), e = s.file, i;
1617
+ try {
1618
+ i = fs.openSync(e, "r");
1619
+ let r = fs.fstatSync(i), n = s.maxReadSize || 16777216;
1620
+ if (r.size < n) {
1621
+ let o = Buffer.allocUnsafe(r.size), h = fs.readSync(i, o, 0, r.size, 0);
1622
+ t.end(h === o.byteLength ? o : o.subarray(0, h));
1623
+ } else {
1624
+ let o = 0, h = Buffer.allocUnsafe(n);
1625
+ for (; o < r.size;) {
1626
+ let a = fs.readSync(i, h, 0, n, o);
1627
+ if (a === 0) break;
1628
+ o += a, t.write(h.subarray(0, a));
1629
+ }
1630
+ t.end();
1631
+ }
1632
+ } finally {
1633
+ if (typeof i == "number") try {
1634
+ fs.closeSync(i);
1635
+ } catch {}
1636
+ }
1637
+ };
1638
+ var Bn = (s, t) => {
1639
+ let e = new rt(s), i = s.maxReadSize || 16777216, r = s.file;
1640
+ return new Promise((o, h) => {
1641
+ e.on("error", h), e.on("end", o), fs.stat(r, (a, l) => {
1642
+ if (a) h(a);
1643
+ else {
1644
+ let c = new _t(r, {
1645
+ readSize: i,
1646
+ size: l.size
1647
+ });
1648
+ c.on("error", h), c.pipe(e);
1649
+ }
1650
+ });
1651
+ });
1652
+ };
1653
+ var Ct = K(Mn, Bn, (s) => new rt(s), (s) => new rt(s), (s, t) => {
1654
+ t?.length && Qi(s, t), s.noResume || vn(s);
1655
+ });
1656
+ var Ji = (s, t, e) => (s &= 4095, e && (s = (s | 384) & -19), t && (s & 256 && (s |= 64), s & 32 && (s |= 8), s & 4 && (s |= 1)), s);
1657
+ var { isAbsolute: zn, parse: qs } = win32, ce = (s) => {
1658
+ let t = "", e = qs(s);
1659
+ for (; zn(s) || e.root;) {
1660
+ let i = s.charAt(0) === "/" && s.slice(0, 4) !== "//?/" ? "/" : e.root;
1661
+ s = s.slice(i.length), t += i, e = qs(s);
1662
+ }
1663
+ return [t, s];
1664
+ };
1665
+ var ei = [
1666
+ "|",
1667
+ "<",
1668
+ ">",
1669
+ "?",
1670
+ ":"
1671
+ ];
1672
+ var ji = ei.map((s) => String.fromCodePoint(61440 + Number(s.codePointAt(0))));
1673
+ var Un = new Map(ei.map((s, t) => [s, ji[t]]));
1674
+ var Hn = new Map(ji.map((s, t) => [s, ei[t]]));
1675
+ var ts = (s) => ei.reduce((t, e) => t.split(e).join(Un.get(e)), s);
1676
+ var Qs = (s) => ji.reduce((t, e) => t.split(e).join(Hn.get(e)), s);
1677
+ var rr = (s, t) => t ? (s = f(s).replace(/^\.(\/|$)/, ""), mt(t) + "/" + s) : f(s);
1678
+ var Wn = 16777216;
1679
+ var tr = Symbol("process");
1680
+ var er = Symbol("file");
1681
+ var ir = Symbol("directory");
1682
+ var is = Symbol("symlink");
1683
+ var sr = Symbol("hardlink");
1684
+ var fe = Symbol("header");
1685
+ var ii = Symbol("read");
1686
+ var ss = Symbol("lstat");
1687
+ var si = Symbol("onlstat");
1688
+ var rs = Symbol("onread");
1689
+ var ns = Symbol("onreadlink");
1690
+ var os = Symbol("openfile");
1691
+ var hs = Symbol("onopenfile");
1692
+ var pt = Symbol("close");
1693
+ var ri = Symbol("mode");
1694
+ var as = Symbol("awaitDrain");
1695
+ var es = Symbol("ondrain");
1696
+ var q = Symbol("prefix");
1697
+ var de = class extends A {
1698
+ path;
1699
+ portable;
1700
+ myuid = process.getuid && process.getuid() || 0;
1701
+ myuser = process.env.USER || "";
1702
+ maxReadSize;
1703
+ linkCache;
1704
+ statCache;
1705
+ preservePaths;
1706
+ cwd;
1707
+ strict;
1708
+ mtime;
1709
+ noPax;
1710
+ noMtime;
1711
+ prefix;
1712
+ fd;
1713
+ blockLen = 0;
1714
+ blockRemain = 0;
1715
+ buf;
1716
+ pos = 0;
1717
+ remain = 0;
1718
+ length = 0;
1719
+ offset = 0;
1720
+ win32;
1721
+ absolute;
1722
+ header;
1723
+ type;
1724
+ linkpath;
1725
+ stat;
1726
+ onWriteEntry;
1727
+ #t = !1;
1728
+ constructor(t, e = {}) {
1729
+ let i = se(e);
1730
+ super(), this.path = f(t), this.portable = !!i.portable, this.maxReadSize = i.maxReadSize || Wn, this.linkCache = i.linkCache || /* @__PURE__ */ new Map(), this.statCache = i.statCache || /* @__PURE__ */ new Map(), this.preservePaths = !!i.preservePaths, this.cwd = f(i.cwd || process.cwd()), this.strict = !!i.strict, this.noPax = !!i.noPax, this.noMtime = !!i.noMtime, this.mtime = i.mtime, this.prefix = i.prefix ? f(i.prefix) : void 0, this.onWriteEntry = i.onWriteEntry, typeof i.onwarn == "function" && this.on("warn", i.onwarn);
1731
+ let r = !1;
1732
+ if (!this.preservePaths) {
1733
+ let [o, h] = ce(this.path);
1734
+ o && typeof h == "string" && (this.path = h, r = o);
1735
+ }
1736
+ this.win32 = !!i.win32 || process.platform === "win32", this.win32 && (this.path = Qs(this.path.replaceAll(/\\/g, "/")), t = t.replaceAll(/\\/g, "/")), this.absolute = f(i.absolute || ar.resolve(this.cwd, t)), this.path === "" && (this.path = "./"), r && this.warn("TAR_ENTRY_INFO", `stripping ${r} from absolute path`, {
1737
+ entry: this,
1738
+ path: r + this.path
1739
+ });
1740
+ let n = this.statCache.get(this.absolute);
1741
+ n ? this[si](n) : this[ss]();
1742
+ }
1743
+ warn(t, e, i = {}) {
1744
+ return Dt(this, t, e, i);
1745
+ }
1746
+ emit(t, ...e) {
1747
+ return t === "error" && (this.#t = !0), super.emit(t, ...e);
1748
+ }
1749
+ [ss]() {
1750
+ I.lstat(this.absolute, (t, e) => {
1751
+ if (t) return this.emit("error", t);
1752
+ this[si](e);
1753
+ });
1754
+ }
1755
+ [si](t) {
1756
+ this.statCache.set(this.absolute, t), this.stat = t, t.isFile() || (t.size = 0), this.type = Gn(t), this.emit("stat", t), this[tr]();
1757
+ }
1758
+ [tr]() {
1759
+ switch (this.type) {
1760
+ case "File": return this[er]();
1761
+ case "Directory": return this[ir]();
1762
+ case "SymbolicLink": return this[is]();
1763
+ default: return this.end();
1764
+ }
1765
+ }
1766
+ [ri](t) {
1767
+ return Ji(t, this.type === "Directory", this.portable);
1768
+ }
1769
+ [q](t) {
1770
+ return rr(t, this.prefix);
1771
+ }
1772
+ [fe]() {
1773
+ if (!this.stat) throw new Error("cannot write header before stat");
1774
+ this.type === "Directory" && this.portable && (this.noMtime = !0), this.onWriteEntry?.(this), this.header = new F({
1775
+ path: this[q](this.path),
1776
+ linkpath: this.type === "Link" && this.linkpath !== void 0 ? this[q](this.linkpath) : this.linkpath,
1777
+ mode: this[ri](this.stat.mode),
1778
+ uid: this.portable ? void 0 : this.stat.uid,
1779
+ gid: this.portable ? void 0 : this.stat.gid,
1780
+ size: this.stat.size,
1781
+ mtime: this.noMtime ? void 0 : this.mtime || this.stat.mtime,
1782
+ type: this.type === "Unsupported" ? void 0 : this.type,
1783
+ uname: this.portable ? void 0 : this.stat.uid === this.myuid ? this.myuser : "",
1784
+ atime: this.portable ? void 0 : this.stat.atime,
1785
+ ctime: this.portable ? void 0 : this.stat.ctime
1786
+ }), this.header.encode() && !this.noPax && super.write(new ft({
1787
+ atime: this.portable ? void 0 : this.header.atime,
1788
+ ctime: this.portable ? void 0 : this.header.ctime,
1789
+ gid: this.portable ? void 0 : this.header.gid,
1790
+ mtime: this.noMtime ? void 0 : this.mtime || this.header.mtime,
1791
+ path: this[q](this.path),
1792
+ linkpath: this.type === "Link" && this.linkpath !== void 0 ? this[q](this.linkpath) : this.linkpath,
1793
+ size: this.header.size,
1794
+ uid: this.portable ? void 0 : this.header.uid,
1795
+ uname: this.portable ? void 0 : this.header.uname,
1796
+ dev: this.portable ? void 0 : this.stat.dev,
1797
+ ino: this.portable ? void 0 : this.stat.ino,
1798
+ nlink: this.portable ? void 0 : this.stat.nlink
1799
+ }).encode());
1800
+ let t = this.header?.block;
1801
+ if (!t) throw new Error("failed to encode header");
1802
+ super.write(t);
1803
+ }
1804
+ [ir]() {
1805
+ if (!this.stat) throw new Error("cannot create directory entry without stat");
1806
+ this.path.slice(-1) !== "/" && (this.path += "/"), this.stat.size = 0, this[fe](), this.end();
1807
+ }
1808
+ [is]() {
1809
+ I.readlink(this.absolute, (t, e) => {
1810
+ if (t) return this.emit("error", t);
1811
+ this[ns](e);
1812
+ });
1813
+ }
1814
+ [ns](t) {
1815
+ this.linkpath = f(t), this[fe](), this.end();
1816
+ }
1817
+ [sr](t) {
1818
+ if (!this.stat) throw new Error("cannot create link entry without stat");
1819
+ this.type = "Link", this.linkpath = f(ar.relative(this.cwd, t)), this.stat.size = 0, this[fe](), this.end();
1820
+ }
1821
+ [er]() {
1822
+ if (!this.stat) throw new Error("cannot create file entry without stat");
1823
+ if (this.stat.nlink > 1) {
1824
+ let t = `${this.stat.dev}:${this.stat.ino}`, e = this.linkCache.get(t);
1825
+ if (e?.indexOf(this.cwd) === 0) return this[sr](e);
1826
+ this.linkCache.set(t, this.absolute);
1827
+ }
1828
+ if (this[fe](), this.stat.size === 0) return this.end();
1829
+ this[os]();
1830
+ }
1831
+ [os]() {
1832
+ I.open(this.absolute, "r", (t, e) => {
1833
+ if (t) return this.emit("error", t);
1834
+ this[hs](e);
1835
+ });
1836
+ }
1837
+ [hs](t) {
1838
+ if (this.fd = t, this.#t) return this[pt]();
1839
+ if (!this.stat) throw new Error("should stat before calling onopenfile");
1840
+ this.blockLen = 512 * Math.ceil(this.stat.size / 512), this.blockRemain = this.blockLen;
1841
+ let e = Math.min(this.blockLen, this.maxReadSize);
1842
+ this.buf = Buffer.allocUnsafe(e), this.offset = 0, this.pos = 0, this.remain = this.stat.size, this.length = this.buf.length, this[ii]();
1843
+ }
1844
+ [ii]() {
1845
+ let { fd: t, buf: e, offset: i, length: r, pos: n } = this;
1846
+ if (t === void 0 || e === void 0) throw new Error("cannot read file without first opening");
1847
+ I.read(t, e, i, r, n, (o, h) => {
1848
+ if (o) return this[pt](() => this.emit("error", o));
1849
+ this[rs](h);
1850
+ });
1851
+ }
1852
+ [pt](t = () => {}) {
1853
+ this.fd !== void 0 && I.close(this.fd, t);
1854
+ }
1855
+ [rs](t) {
1856
+ if (t <= 0 && this.remain > 0) {
1857
+ let r = Object.assign(/* @__PURE__ */ new Error("encountered unexpected EOF"), {
1858
+ path: this.absolute,
1859
+ syscall: "read",
1860
+ code: "EOF"
1861
+ });
1862
+ return this[pt](() => this.emit("error", r));
1863
+ }
1864
+ if (t > this.remain) {
1865
+ let r = Object.assign(/* @__PURE__ */ new Error("did not encounter expected EOF"), {
1866
+ path: this.absolute,
1867
+ syscall: "read",
1868
+ code: "EOF"
1869
+ });
1870
+ return this[pt](() => this.emit("error", r));
1871
+ }
1872
+ if (!this.buf) throw new Error("should have created buffer prior to reading");
1873
+ if (t === this.remain) for (let r = t; r < this.length && t < this.blockRemain; r++) this.buf[r + this.offset] = 0, t++, this.remain++;
1874
+ let e = this.offset === 0 && t === this.buf.length ? this.buf : this.buf.subarray(this.offset, this.offset + t);
1875
+ this.write(e) ? this[es]() : this[as](() => this[es]());
1876
+ }
1877
+ [as](t) {
1878
+ this.once("drain", t);
1879
+ }
1880
+ write(t, e, i) {
1881
+ if (typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, typeof e == "string" ? e : "utf8")), this.blockRemain < t.length) {
1882
+ let r = Object.assign(/* @__PURE__ */ new Error("writing more data than expected"), { path: this.absolute });
1883
+ return this.emit("error", r);
1884
+ }
1885
+ return this.remain -= t.length, this.blockRemain -= t.length, this.pos += t.length, this.offset += t.length, super.write(t, null, i);
1886
+ }
1887
+ [es]() {
1888
+ if (!this.remain) return this.blockRemain && super.write(Buffer.alloc(this.blockRemain)), this[pt]((t) => t ? this.emit("error", t) : this.end());
1889
+ if (!this.buf) throw new Error("buffer lost somehow in ONDRAIN");
1890
+ 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[ii]();
1891
+ }
1892
+ };
1893
+ var ni = class extends de {
1894
+ sync = !0;
1895
+ [ss]() {
1896
+ this[si](I.lstatSync(this.absolute));
1897
+ }
1898
+ [is]() {
1899
+ this[ns](I.readlinkSync(this.absolute));
1900
+ }
1901
+ [os]() {
1902
+ this[hs](I.openSync(this.absolute, "r"));
1903
+ }
1904
+ [ii]() {
1905
+ let t = !0;
1906
+ try {
1907
+ let { fd: e, buf: i, offset: r, length: n, pos: o } = this;
1908
+ if (e === void 0 || i === void 0) throw new Error("fd and buf must be set in READ method");
1909
+ let h = I.readSync(e, i, r, n, o);
1910
+ this[rs](h), t = !1;
1911
+ } finally {
1912
+ if (t) try {
1913
+ this[pt](() => {});
1914
+ } catch {}
1915
+ }
1916
+ }
1917
+ [as](t) {
1918
+ t();
1919
+ }
1920
+ [pt](t = () => {}) {
1921
+ this.fd !== void 0 && I.closeSync(this.fd), t();
1922
+ }
1923
+ };
1924
+ var oi = class extends A {
1925
+ blockLen = 0;
1926
+ blockRemain = 0;
1927
+ buf = 0;
1928
+ pos = 0;
1929
+ remain = 0;
1930
+ length = 0;
1931
+ preservePaths;
1932
+ portable;
1933
+ strict;
1934
+ noPax;
1935
+ noMtime;
1936
+ readEntry;
1937
+ type;
1938
+ prefix;
1939
+ path;
1940
+ mode;
1941
+ uid;
1942
+ gid;
1943
+ uname;
1944
+ gname;
1945
+ header;
1946
+ mtime;
1947
+ atime;
1948
+ ctime;
1949
+ linkpath;
1950
+ size;
1951
+ onWriteEntry;
1952
+ warn(t, e, i = {}) {
1953
+ return Dt(this, t, e, i);
1954
+ }
1955
+ constructor(t, e = {}) {
1956
+ let i = se(e);
1957
+ super(), this.preservePaths = !!i.preservePaths, this.portable = !!i.portable, this.strict = !!i.strict, this.noPax = !!i.noPax, this.noMtime = !!i.noMtime, this.onWriteEntry = i.onWriteEntry, this.readEntry = t;
1958
+ let { type: r } = t;
1959
+ if (r === "Unsupported") throw new Error("writing entry that should be ignored");
1960
+ this.type = r, this.type === "Directory" && this.portable && (this.noMtime = !0), this.prefix = i.prefix, this.path = f(t.path), this.mode = t.mode !== void 0 ? this[ri](t.mode) : void 0, this.uid = this.portable ? void 0 : t.uid, this.gid = this.portable ? void 0 : t.gid, this.uname = this.portable ? void 0 : t.uname, this.gname = this.portable ? void 0 : t.gname, this.size = t.size, this.mtime = this.noMtime ? void 0 : i.mtime || t.mtime, this.atime = this.portable ? void 0 : t.atime, this.ctime = this.portable ? void 0 : t.ctime, this.linkpath = t.linkpath !== void 0 ? f(t.linkpath) : void 0, typeof i.onwarn == "function" && this.on("warn", i.onwarn);
1961
+ let n = !1;
1962
+ if (!this.preservePaths) {
1963
+ let [h, a] = ce(this.path);
1964
+ h && typeof a == "string" && (this.path = a, n = h);
1965
+ }
1966
+ this.remain = t.size, this.blockRemain = t.startBlockSize, this.onWriteEntry?.(this), this.header = new F({
1967
+ path: this[q](this.path),
1968
+ linkpath: this.type === "Link" && this.linkpath !== void 0 ? this[q](this.linkpath) : this.linkpath,
1969
+ mode: this.mode,
1970
+ uid: this.portable ? void 0 : this.uid,
1971
+ gid: this.portable ? void 0 : this.gid,
1972
+ size: this.size,
1973
+ mtime: this.noMtime ? void 0 : this.mtime,
1974
+ type: this.type,
1975
+ uname: this.portable ? void 0 : this.uname,
1976
+ atime: this.portable ? void 0 : this.atime,
1977
+ ctime: this.portable ? void 0 : this.ctime
1978
+ }), n && this.warn("TAR_ENTRY_INFO", `stripping ${n} from absolute path`, {
1979
+ entry: this,
1980
+ path: n + this.path
1981
+ }), this.header.encode() && !this.noPax && super.write(new ft({
1982
+ atime: this.portable ? void 0 : this.atime,
1983
+ ctime: this.portable ? void 0 : this.ctime,
1984
+ gid: this.portable ? void 0 : this.gid,
1985
+ mtime: this.noMtime ? void 0 : this.mtime,
1986
+ path: this[q](this.path),
1987
+ linkpath: this.type === "Link" && this.linkpath !== void 0 ? this[q](this.linkpath) : this.linkpath,
1988
+ size: this.size,
1989
+ uid: this.portable ? void 0 : this.uid,
1990
+ uname: this.portable ? void 0 : this.uname,
1991
+ dev: this.portable ? void 0 : this.readEntry.dev,
1992
+ ino: this.portable ? void 0 : this.readEntry.ino,
1993
+ nlink: this.portable ? void 0 : this.readEntry.nlink
1994
+ }).encode());
1995
+ let o = this.header?.block;
1996
+ if (!o) throw new Error("failed to encode header");
1997
+ super.write(o), t.pipe(this);
1998
+ }
1999
+ [q](t) {
2000
+ return rr(t, this.prefix);
2001
+ }
2002
+ [ri](t) {
2003
+ return Ji(t, this.type === "Directory", this.portable);
2004
+ }
2005
+ write(t, e, i) {
2006
+ typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, typeof e == "string" ? e : "utf8"));
2007
+ let r = t.length;
2008
+ if (r > this.blockRemain) throw new Error("writing more to entry than is appropriate");
2009
+ return this.blockRemain -= r, super.write(t, i);
2010
+ }
2011
+ end(t, e, i) {
2012
+ return this.blockRemain && super.write(Buffer.alloc(this.blockRemain)), typeof t == "function" && (i = t, e = void 0, t = void 0), typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, e ?? "utf8")), i && this.once("finish", i), t ? super.end(t, i) : super.end(i), this;
2013
+ }
2014
+ };
2015
+ var Gn = (s) => s.isFile() ? "File" : s.isDirectory() ? "Directory" : s.isSymbolicLink() ? "SymbolicLink" : "Unsupported";
2016
+ var hi = class s {
2017
+ tail;
2018
+ head;
2019
+ length = 0;
2020
+ static create(t = []) {
2021
+ return new s(t);
2022
+ }
2023
+ constructor(t = []) {
2024
+ for (let e of t) this.push(e);
2025
+ }
2026
+ *[Symbol.iterator]() {
2027
+ for (let t = this.head; t; t = t.next) yield t.value;
2028
+ }
2029
+ removeNode(t) {
2030
+ if (t.list !== this) throw new Error("removing node which does not belong to this list");
2031
+ let e = t.next, i = t.prev;
2032
+ return e && (e.prev = i), i && (i.next = e), t === this.head && (this.head = e), t === this.tail && (this.tail = i), this.length--, t.next = void 0, t.prev = void 0, t.list = void 0, e;
2033
+ }
2034
+ unshiftNode(t) {
2035
+ if (t === this.head) return;
2036
+ t.list && t.list.removeNode(t);
2037
+ let e = this.head;
2038
+ t.list = this, t.next = e, e && (e.prev = t), this.head = t, this.tail || (this.tail = t), this.length++;
2039
+ }
2040
+ pushNode(t) {
2041
+ if (t === this.tail) return;
2042
+ t.list && t.list.removeNode(t);
2043
+ let e = this.tail;
2044
+ t.list = this, t.prev = e, e && (e.next = t), this.tail = t, this.head || (this.head = t), this.length++;
2045
+ }
2046
+ push(...t) {
2047
+ for (let e = 0, i = t.length; e < i; e++) Yn(this, t[e]);
2048
+ return this.length;
2049
+ }
2050
+ unshift(...t) {
2051
+ for (var e = 0, i = t.length; e < i; e++) Kn(this, t[e]);
2052
+ return this.length;
2053
+ }
2054
+ pop() {
2055
+ if (!this.tail) return;
2056
+ let t = this.tail.value, e = this.tail;
2057
+ return this.tail = this.tail.prev, this.tail ? this.tail.next = void 0 : this.head = void 0, e.list = void 0, this.length--, t;
2058
+ }
2059
+ shift() {
2060
+ if (!this.head) return;
2061
+ let t = this.head.value, e = this.head;
2062
+ return this.head = this.head.next, this.head ? this.head.prev = void 0 : this.tail = void 0, e.list = void 0, this.length--, t;
2063
+ }
2064
+ forEach(t, e) {
2065
+ e = e || this;
2066
+ for (let i = this.head, r = 0; i; r++) t.call(e, i.value, r, this), i = i.next;
2067
+ }
2068
+ forEachReverse(t, e) {
2069
+ e = e || this;
2070
+ for (let i = this.tail, r = this.length - 1; i; r--) t.call(e, i.value, r, this), i = i.prev;
2071
+ }
2072
+ get(t) {
2073
+ let e = 0, i = this.head;
2074
+ for (; i && e < t; e++) i = i.next;
2075
+ if (e === t && i) return i.value;
2076
+ }
2077
+ getReverse(t) {
2078
+ let e = 0, i = this.tail;
2079
+ for (; i && e < t; e++) i = i.prev;
2080
+ if (e === t && i) return i.value;
2081
+ }
2082
+ map(t, e) {
2083
+ e = e || this;
2084
+ let i = new s();
2085
+ for (let r = this.head; r;) i.push(t.call(e, r.value, this)), r = r.next;
2086
+ return i;
2087
+ }
2088
+ mapReverse(t, e) {
2089
+ e = e || this;
2090
+ var i = new s();
2091
+ for (let r = this.tail; r;) i.push(t.call(e, r.value, this)), r = r.prev;
2092
+ return i;
2093
+ }
2094
+ reduce(t, e) {
2095
+ let i, r = this.head;
2096
+ if (arguments.length > 1) i = e;
2097
+ else if (this.head) r = this.head.next, i = this.head.value;
2098
+ else throw new TypeError("Reduce of empty list with no initial value");
2099
+ for (var n = 0; r; n++) i = t(i, r.value, n), r = r.next;
2100
+ return i;
2101
+ }
2102
+ reduceReverse(t, e) {
2103
+ let i, r = this.tail;
2104
+ if (arguments.length > 1) i = e;
2105
+ else if (this.tail) r = this.tail.prev, i = this.tail.value;
2106
+ else throw new TypeError("Reduce of empty list with no initial value");
2107
+ for (let n = this.length - 1; r; n--) i = t(i, r.value, n), r = r.prev;
2108
+ return i;
2109
+ }
2110
+ toArray() {
2111
+ let t = new Array(this.length);
2112
+ for (let e = 0, i = this.head; i; e++) t[e] = i.value, i = i.next;
2113
+ return t;
2114
+ }
2115
+ toArrayReverse() {
2116
+ let t = new Array(this.length);
2117
+ for (let e = 0, i = this.tail; i; e++) t[e] = i.value, i = i.prev;
2118
+ return t;
2119
+ }
2120
+ slice(t = 0, e = this.length) {
2121
+ e < 0 && (e += this.length), t < 0 && (t += this.length);
2122
+ let i = new s();
2123
+ if (e < t || e < 0) return i;
2124
+ t < 0 && (t = 0), e > this.length && (e = this.length);
2125
+ let r = this.head, n = 0;
2126
+ for (n = 0; r && n < t; n++) r = r.next;
2127
+ for (; r && n < e; n++, r = r.next) i.push(r.value);
2128
+ return i;
2129
+ }
2130
+ sliceReverse(t = 0, e = this.length) {
2131
+ e < 0 && (e += this.length), t < 0 && (t += this.length);
2132
+ let i = new s();
2133
+ if (e < t || e < 0) return i;
2134
+ t < 0 && (t = 0), e > this.length && (e = this.length);
2135
+ let r = this.length, n = this.tail;
2136
+ for (; n && r > e; r--) n = n.prev;
2137
+ for (; n && r > t; r--, n = n.prev) i.push(n.value);
2138
+ return i;
2139
+ }
2140
+ splice(t, e = 0, ...i) {
2141
+ t > this.length && (t = this.length - 1), t < 0 && (t = this.length + t);
2142
+ let r = this.head;
2143
+ for (let o = 0; r && o < t; o++) r = r.next;
2144
+ let n = [];
2145
+ for (let o = 0; r && o < e; o++) n.push(r.value), r = this.removeNode(r);
2146
+ r ? r !== this.tail && (r = r.prev) : r = this.tail;
2147
+ for (let o of i) r = Zn(this, r, o);
2148
+ return n;
2149
+ }
2150
+ reverse() {
2151
+ let t = this.head, e = this.tail;
2152
+ for (let i = t; i; i = i.prev) {
2153
+ let r = i.prev;
2154
+ i.prev = i.next, i.next = r;
2155
+ }
2156
+ return this.head = e, this.tail = t, this;
2157
+ }
2158
+ };
2159
+ function Zn(s, t, e) {
2160
+ let n = new ue(e, t, t ? t.next : s.head, s);
2161
+ return n.next === void 0 && (s.tail = n), n.prev === void 0 && (s.head = n), s.length++, n;
2162
+ }
2163
+ function Yn(s, t) {
2164
+ s.tail = new ue(t, s.tail, void 0, s), s.head || (s.head = s.tail), s.length++;
2165
+ }
2166
+ function Kn(s, t) {
2167
+ s.head = new ue(t, void 0, s.head, s), s.tail || (s.tail = s.head), s.length++;
2168
+ }
2169
+ var ue = class {
2170
+ list;
2171
+ next;
2172
+ prev;
2173
+ value;
2174
+ constructor(t, e, i, r) {
2175
+ this.list = r, this.value = t, e ? (e.next = this, this.prev = e) : this.prev = void 0, i ? (i.prev = this, this.next = i) : this.next = void 0;
2176
+ }
2177
+ };
2178
+ var pi = class {
2179
+ path;
2180
+ absolute;
2181
+ entry;
2182
+ stat;
2183
+ readdir;
2184
+ pending = !1;
2185
+ pendingLink = !1;
2186
+ ignore = !1;
2187
+ piped = !1;
2188
+ constructor(t, e) {
2189
+ this.path = t || "./", this.absolute = e;
2190
+ }
2191
+ };
2192
+ var nr = Buffer.alloc(1024);
2193
+ var li = Symbol("onStat");
2194
+ var me = Symbol("ended");
2195
+ var W = Symbol("queue");
2196
+ var pe = Symbol("pendingLinks");
2197
+ var Et = Symbol("current");
2198
+ var Ft = Symbol("process");
2199
+ var Ee = Symbol("processing");
2200
+ var ai = Symbol("processJob");
2201
+ var G = Symbol("jobs");
2202
+ var ls = Symbol("jobDone");
2203
+ var ci = Symbol("addFSEntry");
2204
+ var or = Symbol("addTarEntry");
2205
+ var ds = Symbol("stat");
2206
+ var us = Symbol("readdir");
2207
+ var fi = Symbol("onreaddir");
2208
+ var di = Symbol("pipe");
2209
+ var hr = Symbol("entry");
2210
+ var cs = Symbol("entryOpt");
2211
+ var ui = Symbol("writeEntryClass");
2212
+ var lr = Symbol("write");
2213
+ var fs$1 = Symbol("ondrain");
2214
+ var wt = class extends A {
2215
+ sync = !1;
2216
+ opt;
2217
+ cwd;
2218
+ maxReadSize;
2219
+ preservePaths;
2220
+ strict;
2221
+ noPax;
2222
+ prefix;
2223
+ linkCache;
2224
+ statCache;
2225
+ file;
2226
+ portable;
2227
+ zip;
2228
+ readdirCache;
2229
+ noDirRecurse;
2230
+ follow;
2231
+ noMtime;
2232
+ mtime;
2233
+ filter;
2234
+ jobs;
2235
+ [ui];
2236
+ onWriteEntry;
2237
+ [W];
2238
+ [pe] = /* @__PURE__ */ new Map();
2239
+ [G] = 0;
2240
+ [Ee] = !1;
2241
+ [me] = !1;
2242
+ constructor(t = {}) {
2243
+ if (super(), this.opt = t, this.file = t.file || "", this.cwd = t.cwd || process.cwd(), this.maxReadSize = t.maxReadSize, this.preservePaths = !!t.preservePaths, this.strict = !!t.strict, this.noPax = !!t.noPax, this.prefix = f(t.prefix || ""), this.linkCache = t.linkCache || /* @__PURE__ */ new Map(), this.statCache = t.statCache || /* @__PURE__ */ new Map(), this.readdirCache = t.readdirCache || /* @__PURE__ */ new Map(), this.onWriteEntry = t.onWriteEntry, this[ui] = de, typeof t.onwarn == "function" && this.on("warn", t.onwarn), this.portable = !!t.portable, t.gzip || t.brotli || t.zstd) {
2244
+ if ((t.gzip ? 1 : 0) + (t.brotli ? 1 : 0) + (t.zstd ? 1 : 0) > 1) throw new TypeError("gzip, brotli, zstd are mutually exclusive");
2245
+ if (t.gzip && (typeof t.gzip != "object" && (t.gzip = {}), this.portable && (t.gzip.portable = !0), this.zip = new ze(t.gzip)), t.brotli && (typeof t.brotli != "object" && (t.brotli = {}), this.zip = new We(t.brotli)), t.zstd && (typeof t.zstd != "object" && (t.zstd = {}), this.zip = new Ye(t.zstd)), !this.zip) throw new Error("impossible");
2246
+ let e = this.zip;
2247
+ e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[fs$1]()), this.on("resume", () => e.resume());
2248
+ } else this.on("drain", this[fs$1]);
2249
+ this.noDirRecurse = !!t.noDirRecurse, this.follow = !!t.follow, this.noMtime = !!t.noMtime, t.mtime && (this.mtime = t.mtime), this.filter = typeof t.filter == "function" ? t.filter : () => !0, this[W] = new hi(), this[G] = 0, this.jobs = Number(t.jobs) || 4, this[Ee] = !1, this[me] = !1;
2250
+ }
2251
+ [lr](t) {
2252
+ return super.write(t);
2253
+ }
2254
+ add(t) {
2255
+ return this.write(t), this;
2256
+ }
2257
+ end(t, e, i) {
2258
+ return typeof t == "function" && (i = t, t = void 0), typeof e == "function" && (i = e, e = void 0), t && this.add(t), this[me] = !0, this[Ft](), i && i(), this;
2259
+ }
2260
+ write(t) {
2261
+ if (this[me]) throw new Error("write after end");
2262
+ return typeof t == "string" ? this[ci](t) : this[or](t), this.flowing;
2263
+ }
2264
+ [or](t) {
2265
+ let e = f(ar.resolve(this.cwd, t.path));
2266
+ if (!this.filter(t.path, t)) t.resume();
2267
+ else {
2268
+ let i = new pi(t.path, e);
2269
+ i.entry = new oi(t, this[cs](i)), i.entry.on("end", () => this[ls](i)), this[G] += 1, this[W].push(i);
2270
+ }
2271
+ this[Ft]();
2272
+ }
2273
+ [ci](t) {
2274
+ let e = f(ar.resolve(this.cwd, t));
2275
+ this[W].push(new pi(t, e)), this[Ft]();
2276
+ }
2277
+ [ds](t) {
2278
+ t.pending = !0, this[G] += 1;
2279
+ let e = this.follow ? "stat" : "lstat";
2280
+ I[e](t.absolute, (i, r) => {
2281
+ t.pending = !1, this[G] -= 1, i ? this.emit("error", i) : this[li](t, r);
2282
+ });
2283
+ }
2284
+ [li](t, e) {
2285
+ if (this.statCache.set(t.absolute, e), t.stat = e, !this.filter(t.path, e)) t.ignore = !0;
2286
+ else if (e.isFile() && e.nlink > 1 && !this.linkCache.get(`${e.dev}:${e.ino}`) && !this.sync) if (t === this[Et]) this[ai](t);
2287
+ else {
2288
+ let i = `${e.dev}:${e.ino}`, r = this[pe].get(i);
2289
+ r ? r.push(t) : this[pe].set(i, [t]), t.pendingLink = !0, t.pending = !0;
2290
+ }
2291
+ this[Ft]();
2292
+ }
2293
+ [us](t) {
2294
+ t.pending = !0, this[G] += 1, I.readdir(t.absolute, (e, i) => {
2295
+ if (t.pending = !1, this[G] -= 1, e) return this.emit("error", e);
2296
+ this[fi](t, i);
2297
+ });
2298
+ }
2299
+ [fi](t, e) {
2300
+ this.readdirCache.set(t.absolute, e), t.readdir = e, this[Ft]();
2301
+ }
2302
+ [Ft]() {
2303
+ if (!this[Ee]) {
2304
+ this[Ee] = !0;
2305
+ for (let t = this[W].head; t && this[G] < this.jobs; t = t.next) if (this[ai](t.value), t.value.ignore) {
2306
+ let e = t.next;
2307
+ this[W].removeNode(t), t.next = e;
2308
+ }
2309
+ this[Ee] = !1, this[me] && this[W].length === 0 && this[G] === 0 && (this.zip ? this.zip.end(nr) : (super.write(nr), super.end()));
2310
+ }
2311
+ }
2312
+ get [Et]() {
2313
+ return this[W] && this[W].head && this[W].head.value;
2314
+ }
2315
+ [ls](t) {
2316
+ this[W].shift(), this[G] -= 1;
2317
+ let { stat: e } = t;
2318
+ if (e && e.isFile() && e.nlink > 1) {
2319
+ let i = `${e.dev}:${e.ino}`, r = this[pe].get(i);
2320
+ if (r) {
2321
+ this[pe].delete(i);
2322
+ for (let n of r) n.pending = !1, this[ai](n);
2323
+ }
2324
+ }
2325
+ this[Ft]();
2326
+ }
2327
+ [ai](t) {
2328
+ if (t.pending && t.pendingLink && t === this[Et] && (t.pending = !1, t.pendingLink = !1), !t.pending) {
2329
+ if (t.entry) {
2330
+ t === this[Et] && !t.piped && this[di](t);
2331
+ return;
2332
+ }
2333
+ if (!t.stat) {
2334
+ let e = this.statCache.get(t.absolute);
2335
+ e ? this[li](t, e) : this[ds](t);
2336
+ }
2337
+ if (t.stat && !t.ignore) {
2338
+ if (!this.noDirRecurse && t.stat.isDirectory() && !t.readdir) {
2339
+ let e = this.readdirCache.get(t.absolute);
2340
+ if (e ? this[fi](t, e) : this[us](t), !t.readdir) return;
2341
+ }
2342
+ if (t.entry = this[hr](t), !t.entry) {
2343
+ t.ignore = !0;
2344
+ return;
2345
+ }
2346
+ t === this[Et] && !t.piped && this[di](t);
2347
+ }
2348
+ }
2349
+ }
2350
+ [cs](t) {
2351
+ return {
2352
+ onwarn: (e, i, r) => this.warn(e, i, r),
2353
+ noPax: this.noPax,
2354
+ cwd: this.cwd,
2355
+ absolute: t.absolute,
2356
+ preservePaths: this.preservePaths,
2357
+ maxReadSize: this.maxReadSize,
2358
+ strict: this.strict,
2359
+ portable: this.portable,
2360
+ linkCache: this.linkCache,
2361
+ statCache: this.statCache,
2362
+ noMtime: this.noMtime,
2363
+ mtime: this.mtime,
2364
+ prefix: this.prefix,
2365
+ onWriteEntry: this.onWriteEntry
2366
+ };
2367
+ }
2368
+ [hr](t) {
2369
+ this[G] += 1;
2370
+ try {
2371
+ return new this[ui](t.path, this[cs](t)).on("end", () => this[ls](t)).on("error", (i) => this.emit("error", i));
2372
+ } catch (e) {
2373
+ this.emit("error", e);
2374
+ }
2375
+ }
2376
+ [fs$1]() {
2377
+ this[Et] && this[Et].entry && this[Et].entry.resume();
2378
+ }
2379
+ [di](t) {
2380
+ t.piped = !0, t.readdir && t.readdir.forEach((r) => {
2381
+ let n = t.path, o = n === "./" ? "" : n.replace(/\/*$/, "/");
2382
+ this[ci](o + r);
2383
+ });
2384
+ let e = t.entry, i = this.zip;
2385
+ if (!e) throw new Error("cannot pipe without source");
2386
+ i ? e.on("data", (r) => {
2387
+ i.write(r) || e.pause();
2388
+ }) : e.on("data", (r) => {
2389
+ super.write(r) || e.pause();
2390
+ });
2391
+ }
2392
+ pause() {
2393
+ return this.zip && this.zip.pause(), super.pause();
2394
+ }
2395
+ warn(t, e, i = {}) {
2396
+ Dt(this, t, e, i);
2397
+ }
2398
+ };
2399
+ var kt = class extends wt {
2400
+ sync = !0;
2401
+ constructor(t) {
2402
+ super(t), this[ui] = ni;
2403
+ }
2404
+ pause() {}
2405
+ resume() {}
2406
+ [ds](t) {
2407
+ let e = this.follow ? "statSync" : "lstatSync";
2408
+ this[li](t, I[e](t.absolute));
2409
+ }
2410
+ [us](t) {
2411
+ this[fi](t, I.readdirSync(t.absolute));
2412
+ }
2413
+ [di](t) {
2414
+ let e = t.entry, i = this.zip;
2415
+ if (t.readdir && t.readdir.forEach((r) => {
2416
+ let n = t.path, o = n === "./" ? "" : n.replace(/\/*$/, "/");
2417
+ this[ci](o + r);
2418
+ }), !e) throw new Error("Cannot pipe without source");
2419
+ i ? e.on("data", (r) => {
2420
+ i.write(r);
2421
+ }) : e.on("data", (r) => {
2422
+ super[lr](r);
2423
+ });
2424
+ }
2425
+ };
2426
+ var Vn = (s, t) => {
2427
+ let e = new kt(s), i = new Wt(s.file, { mode: s.mode || 438 });
2428
+ e.pipe(i), fr(e, t);
2429
+ };
2430
+ var $n = (s, t) => {
2431
+ let e = new wt(s), i = new et(s.file, { mode: s.mode || 438 });
2432
+ e.pipe(i);
2433
+ let r = new Promise((n, o) => {
2434
+ i.on("error", o), i.on("close", n), e.on("error", o);
2435
+ });
2436
+ return dr(e, t).catch((n) => e.emit("error", n)), r;
2437
+ };
2438
+ var fr = (s, t) => {
2439
+ t.forEach((e) => {
2440
+ e.charAt(0) === "@" ? Ct({
2441
+ file: path.resolve(s.cwd, e.slice(1)),
2442
+ sync: !0,
2443
+ noResume: !0,
2444
+ onReadEntry: (i) => s.add(i)
2445
+ }) : s.add(e);
2446
+ }), s.end();
2447
+ };
2448
+ var dr = async (s, t) => {
2449
+ for (let e of t) e.charAt(0) === "@" ? await Ct({
2450
+ file: path.resolve(String(s.cwd), e.slice(1)),
2451
+ noResume: !0,
2452
+ onReadEntry: (i) => {
2453
+ s.add(i);
2454
+ }
2455
+ }) : s.add(e);
2456
+ s.end();
2457
+ };
2458
+ var Xn = (s, t) => {
2459
+ let e = new kt(s);
2460
+ return fr(e, t), e;
2461
+ };
2462
+ var qn = (s, t) => {
2463
+ let e = new wt(s);
2464
+ return dr(e, t).catch((i) => e.emit("error", i)), e;
2465
+ };
2466
+ var Qn = K(Vn, $n, Xn, qn, (s, t) => {
2467
+ if (!t?.length) throw new TypeError("no paths specified to add to archive");
2468
+ });
2469
+ var Er = (process.env.__FAKE_PLATFORM__ || process.platform) === "win32", { O_CREAT: wr, O_NOFOLLOW: ur, O_TRUNC: Sr, O_WRONLY: yr } = I.constants, Rr = Number(process.env.__FAKE_FS_O_FILENAME__) || I.constants.UV_FS_O_FILEMAP || 0, jn = Er && !!Rr, to = 524288, eo = Rr | Sr | wr | yr, mr = !Er && typeof ur == "number" ? ur | Sr | wr | yr : null, ms = mr !== null ? () => mr : jn ? (s) => s < to ? eo : "w" : () => "w";
2470
+ var ps = (s, t, e) => {
2471
+ try {
2472
+ return fs.lchownSync(s, t, e);
2473
+ } catch (i) {
2474
+ if (i?.code !== "ENOENT") throw i;
2475
+ }
2476
+ };
2477
+ var Ei = (s, t, e, i) => {
2478
+ fs.lchown(s, t, e, (r) => {
2479
+ i(r && r?.code !== "ENOENT" ? r : null);
2480
+ });
2481
+ };
2482
+ var io = (s, t, e, i, r) => {
2483
+ if (t.isDirectory()) Es(path.resolve(s, t.name), e, i, (n) => {
2484
+ if (n) return r(n);
2485
+ Ei(path.resolve(s, t.name), e, i, r);
2486
+ });
2487
+ else Ei(path.resolve(s, t.name), e, i, r);
2488
+ };
2489
+ var Es = (s, t, e, i) => {
2490
+ fs.readdir(s, { withFileTypes: !0 }, (r, n) => {
2491
+ if (r) {
2492
+ if (r.code === "ENOENT") return i();
2493
+ if (r.code !== "ENOTDIR" && r.code !== "ENOTSUP") return i(r);
2494
+ }
2495
+ if (r || !n.length) return Ei(s, t, e, i);
2496
+ let o = n.length, h = null, a = (l) => {
2497
+ if (!h) {
2498
+ if (l) return i(h = l);
2499
+ if (--o === 0) return Ei(s, t, e, i);
2500
+ }
2501
+ };
2502
+ for (let l of n) io(s, l, t, e, a);
2503
+ });
2504
+ };
2505
+ var so = (s, t, e, i) => {
2506
+ t.isDirectory() && ws(path.resolve(s, t.name), e, i), ps(path.resolve(s, t.name), e, i);
2507
+ };
2508
+ var ws = (s, t, e) => {
2509
+ let i;
2510
+ try {
2511
+ i = fs.readdirSync(s, { withFileTypes: !0 });
2512
+ } catch (r) {
2513
+ let n = r;
2514
+ if (n?.code === "ENOENT") return;
2515
+ if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP") return ps(s, t, e);
2516
+ throw n;
2517
+ }
2518
+ for (let r of i) so(s, r, t, e);
2519
+ return ps(s, t, e);
2520
+ };
2521
+ var Se = class extends Error {
2522
+ path;
2523
+ code;
2524
+ syscall = "chdir";
2525
+ constructor(t, e) {
2526
+ super(`${e}: Cannot cd into '${t}'`), this.path = t, this.code = e;
2527
+ }
2528
+ get name() {
2529
+ return "CwdError";
2530
+ }
2531
+ };
2532
+ var St = class extends Error {
2533
+ path;
2534
+ symlink;
2535
+ syscall = "symlink";
2536
+ code = "TAR_SYMLINK_ERROR";
2537
+ constructor(t, e) {
2538
+ super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"), this.symlink = t, this.path = e;
2539
+ }
2540
+ get name() {
2541
+ return "SymlinkError";
2542
+ }
2543
+ };
2544
+ var no = (s, t) => {
2545
+ fs.stat(s, (e, i) => {
2546
+ (e || !i.isDirectory()) && (e = new Se(s, e?.code || "ENOTDIR")), t(e);
2547
+ });
2548
+ };
2549
+ var gr = (s, t, e) => {
2550
+ s = f(s);
2551
+ let i = t.umask ?? 18, r = t.mode | 448, n = (r & i) !== 0, o = t.uid, h = t.gid, a = typeof o == "number" && typeof h == "number" && (o !== t.processUid || h !== t.processGid), l = t.preserve, c = t.unlink, d = f(t.cwd), y = (E, x) => {
2552
+ E ? e(E) : x && a ? Es(x, o, h, (Le) => y(Le)) : n ? fs.chmod(s, r, e) : e();
2553
+ };
2554
+ if (s === d) return no(s, y);
2555
+ if (l) return ro.mkdir(s, {
2556
+ mode: r,
2557
+ recursive: !0
2558
+ }).then((E) => y(null, E ?? void 0), y);
2559
+ Ss(d, f(path.relative(d, s)).split("/"), r, c, d, void 0, y);
2560
+ };
2561
+ var Ss = (s, t, e, i, r, n, o) => {
2562
+ if (t.length === 0) return o(null, n);
2563
+ let h = t.shift(), a = f(path.resolve(s + "/" + h));
2564
+ fs.mkdir(a, e, br(a, t, e, i, r, n, o));
2565
+ };
2566
+ var br = (s, t, e, i, r, n, o) => (h) => {
2567
+ h ? fs.lstat(s, (a, l) => {
2568
+ if (a) a.path = a.path && f(a.path), o(a);
2569
+ else if (l.isDirectory()) Ss(s, t, e, i, r, n, o);
2570
+ else if (i) fs.unlink(s, (c) => {
2571
+ if (c) return o(c);
2572
+ fs.mkdir(s, e, br(s, t, e, i, r, n, o));
2573
+ });
2574
+ else {
2575
+ if (l.isSymbolicLink()) return o(new St(s, s + "/" + t.join("/")));
2576
+ o(h);
2577
+ }
2578
+ }) : (n = n || s, Ss(s, t, e, i, r, n, o));
2579
+ };
2580
+ var oo = (s) => {
2581
+ let t = !1, e;
2582
+ try {
2583
+ t = fs.statSync(s).isDirectory();
2584
+ } catch (i) {
2585
+ e = i?.code;
2586
+ } finally {
2587
+ if (!t) throw new Se(s, e ?? "ENOTDIR");
2588
+ }
2589
+ };
2590
+ var _r = (s, t) => {
2591
+ s = f(s);
2592
+ let e = t.umask ?? 18, i = t.mode | 448, r = (i & e) !== 0, n = t.uid, o = t.gid, h = typeof n == "number" && typeof o == "number" && (n !== t.processUid || o !== t.processGid), a = t.preserve, l = t.unlink, c = f(t.cwd), d = (E) => {
2593
+ E && h && ws(E, n, o), r && fs.chmodSync(s, i);
2594
+ };
2595
+ if (s === c) return oo(c), d();
2596
+ if (a) return d(fs.mkdirSync(s, {
2597
+ mode: i,
2598
+ recursive: !0
2599
+ }) ?? void 0);
2600
+ let T = f(path.relative(c, s)).split("/"), D;
2601
+ for (let E = T.shift(), x = c; E && (x += "/" + E); E = T.shift()) {
2602
+ x = f(path.resolve(x));
2603
+ try {
2604
+ fs.mkdirSync(x, i), D = D || x;
2605
+ } catch {
2606
+ let Le = fs.lstatSync(x);
2607
+ if (Le.isDirectory()) continue;
2608
+ if (l) {
2609
+ fs.unlinkSync(x), fs.mkdirSync(x, i), D = D || x;
2610
+ continue;
2611
+ } else if (Le.isSymbolicLink()) return new St(x, x + "/" + T.join("/"));
2612
+ }
2613
+ }
2614
+ return d(D);
2615
+ };
2616
+ var ys = Object.create(null);
2617
+ var Or = 1e4;
2618
+ var Vt = /* @__PURE__ */ new Set();
2619
+ var Tr = (s) => {
2620
+ Vt.has(s) ? Vt.delete(s) : ys[s] = s.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"), Vt.add(s);
2621
+ let t = ys[s], e = Vt.size - Or;
2622
+ if (e > Or / 10) {
2623
+ for (let i of Vt) if (Vt.delete(i), delete ys[i], --e <= 0) break;
2624
+ }
2625
+ return t;
2626
+ };
2627
+ var ao = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32";
2628
+ var lo = (s) => s.split("/").slice(0, -1).reduce((e, i) => {
2629
+ let r = e.at(-1);
2630
+ return r !== void 0 && (i = join(r, i)), e.push(i || "/"), e;
2631
+ }, []);
2632
+ var yi = class {
2633
+ #t = /* @__PURE__ */ new Map();
2634
+ #i = /* @__PURE__ */ new Map();
2635
+ #s = /* @__PURE__ */ new Set();
2636
+ reserve(t, e) {
2637
+ t = ao ? ["win32 parallelization disabled"] : t.map((r) => mt(join(Tr(r))));
2638
+ let i = new Set(t.map((r) => lo(r)).reduce((r, n) => r.concat(n)));
2639
+ this.#i.set(e, {
2640
+ dirs: i,
2641
+ paths: t
2642
+ });
2643
+ for (let r of t) {
2644
+ let n = this.#t.get(r);
2645
+ n ? n.push(e) : this.#t.set(r, [e]);
2646
+ }
2647
+ for (let r of i) {
2648
+ let n = this.#t.get(r);
2649
+ if (!n) this.#t.set(r, [/* @__PURE__ */ new Set([e])]);
2650
+ else {
2651
+ let o = n.at(-1);
2652
+ o instanceof Set ? o.add(e) : n.push(/* @__PURE__ */ new Set([e]));
2653
+ }
2654
+ }
2655
+ return this.#r(e);
2656
+ }
2657
+ #n(t) {
2658
+ let e = this.#i.get(t);
2659
+ if (!e) throw new Error("function does not have any path reservations");
2660
+ return {
2661
+ paths: e.paths.map((i) => this.#t.get(i)),
2662
+ dirs: [...e.dirs].map((i) => this.#t.get(i))
2663
+ };
2664
+ }
2665
+ check(t) {
2666
+ let { paths: e, dirs: i } = this.#n(t);
2667
+ return e.every((r) => r && r[0] === t) && i.every((r) => r && r[0] instanceof Set && r[0].has(t));
2668
+ }
2669
+ #r(t) {
2670
+ return this.#s.has(t) || !this.check(t) ? !1 : (this.#s.add(t), t(() => this.#e(t)), !0);
2671
+ }
2672
+ #e(t) {
2673
+ if (!this.#s.has(t)) return !1;
2674
+ let e = this.#i.get(t);
2675
+ if (!e) throw new Error("invalid reservation");
2676
+ let { paths: i, dirs: r } = e, n = /* @__PURE__ */ new Set();
2677
+ for (let o of i) {
2678
+ let h = this.#t.get(o);
2679
+ if (!h || h?.[0] !== t) continue;
2680
+ let a = h[1];
2681
+ if (!a) {
2682
+ this.#t.delete(o);
2683
+ continue;
2684
+ }
2685
+ if (h.shift(), typeof a == "function") n.add(a);
2686
+ else for (let l of a) n.add(l);
2687
+ }
2688
+ for (let o of r) {
2689
+ let h = this.#t.get(o), a = h?.[0];
2690
+ if (!(!h || !(a instanceof Set))) if (a.size === 1 && h.length === 1) {
2691
+ this.#t.delete(o);
2692
+ continue;
2693
+ } else if (a.size === 1) {
2694
+ h.shift();
2695
+ let l = h[0];
2696
+ typeof l == "function" && n.add(l);
2697
+ } else a.delete(t);
2698
+ }
2699
+ return this.#s.delete(t), n.forEach((o) => this.#r(o)), !0;
2700
+ }
2701
+ };
2702
+ var Lr = () => process.umask();
2703
+ var Dr = Symbol("onEntry");
2704
+ var _s = Symbol("checkFs");
2705
+ var Nr = Symbol("checkFs2");
2706
+ var Os = Symbol("isReusable");
2707
+ var P = Symbol("makeFs");
2708
+ var Ts = Symbol("file");
2709
+ var xs = Symbol("directory");
2710
+ var gi = Symbol("link");
2711
+ var Ar = Symbol("symlink");
2712
+ var Ir = Symbol("hardlink");
2713
+ var Re = Symbol("ensureNoSymlink");
2714
+ var Cr = Symbol("unsupported");
2715
+ var Fr = Symbol("checkPath");
2716
+ var Rs = Symbol("stripAbsolutePath");
2717
+ var yt = Symbol("mkdir");
2718
+ var O = Symbol("onError");
2719
+ var Ri = Symbol("pending");
2720
+ var kr = Symbol("pend");
2721
+ var $t = Symbol("unpend");
2722
+ var gs = Symbol("ended");
2723
+ var bs = Symbol("maybeClose");
2724
+ var Ls = Symbol("skip");
2725
+ var ge = Symbol("doChown");
2726
+ var be = Symbol("uid");
2727
+ var _e = Symbol("gid");
2728
+ var Oe = Symbol("checkedCwd");
2729
+ var Te = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32";
2730
+ var uo = 1024;
2731
+ var mo = (s, t) => {
2732
+ if (!Te) return fs.unlink(s, t);
2733
+ let e = s + ".DELETE." + randomBytes(16).toString("hex");
2734
+ fs.rename(s, e, (i) => {
2735
+ if (i) return t(i);
2736
+ fs.unlink(e, t);
2737
+ });
2738
+ };
2739
+ var po = (s) => {
2740
+ if (!Te) return fs.unlinkSync(s);
2741
+ let t = s + ".DELETE." + randomBytes(16).toString("hex");
2742
+ fs.renameSync(s, t), fs.unlinkSync(t);
2743
+ };
2744
+ var vr = (s, t, e) => s !== void 0 && s === s >>> 0 ? s : t !== void 0 && t === t >>> 0 ? t : e;
2745
+ var Xt = class extends rt {
2746
+ [gs] = !1;
2747
+ [Oe] = !1;
2748
+ [Ri] = 0;
2749
+ reservations = new yi();
2750
+ transform;
2751
+ writable = !0;
2752
+ readable = !1;
2753
+ uid;
2754
+ gid;
2755
+ setOwner;
2756
+ preserveOwner;
2757
+ processGid;
2758
+ processUid;
2759
+ maxDepth;
2760
+ forceChown;
2761
+ win32;
2762
+ newer;
2763
+ keep;
2764
+ noMtime;
2765
+ preservePaths;
2766
+ unlink;
2767
+ cwd;
2768
+ strip;
2769
+ processUmask;
2770
+ umask;
2771
+ dmode;
2772
+ fmode;
2773
+ chmod;
2774
+ constructor(t = {}) {
2775
+ if (t.ondone = () => {
2776
+ this[gs] = !0, this[bs]();
2777
+ }, super(t), this.transform = t.transform, this.chmod = !!t.chmod, typeof t.uid == "number" || typeof t.gid == "number") {
2778
+ if (typeof t.uid != "number" || typeof t.gid != "number") throw new TypeError("cannot set owner without number uid and gid");
2779
+ if (t.preserveOwner) throw new TypeError("cannot preserve owner in archive and also set owner explicitly");
2780
+ this.uid = t.uid, this.gid = t.gid, this.setOwner = !0;
2781
+ } else this.uid = void 0, this.gid = void 0, this.setOwner = !1;
2782
+ this.preserveOwner = t.preserveOwner === void 0 && typeof t.uid != "number" ? process.getuid?.() === 0 : !!t.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 t.maxDepth == "number" ? t.maxDepth : uo, this.forceChown = t.forceChown === !0, this.win32 = !!t.win32 || Te, this.newer = !!t.newer, this.keep = !!t.keep, this.noMtime = !!t.noMtime, this.preservePaths = !!t.preservePaths, this.unlink = !!t.unlink, this.cwd = f(path.resolve(t.cwd || process.cwd())), this.strip = Number(t.strip) || 0, this.processUmask = this.chmod ? typeof t.processUmask == "number" ? t.processUmask : Lr() : 0, this.umask = typeof t.umask == "number" ? t.umask : this.processUmask, this.dmode = t.dmode || 511 & ~this.umask, this.fmode = t.fmode || 438 & ~this.umask, this.on("entry", (e) => this[Dr](e));
2783
+ }
2784
+ warn(t, e, i = {}) {
2785
+ return (t === "TAR_BAD_ARCHIVE" || t === "TAR_ABORT") && (i.recoverable = !1), super.warn(t, e, i);
2786
+ }
2787
+ [bs]() {
2788
+ this[gs] && this[Ri] === 0 && (this.emit("prefinish"), this.emit("finish"), this.emit("end"));
2789
+ }
2790
+ [Rs](t, e) {
2791
+ let i = t[e], { type: r } = t;
2792
+ if (!i || this.preservePaths) return !0;
2793
+ let [n, o] = ce(i), h = o.replaceAll(/\\/g, "/").split("/");
2794
+ if (h.includes("..") || Te && /^[a-z]:\.\.$/i.test(h[0] ?? "")) {
2795
+ if (e === "path" || r === "Link") return this.warn("TAR_ENTRY_ERROR", `${e} contains '..'`, {
2796
+ entry: t,
2797
+ [e]: i
2798
+ }), !1;
2799
+ let a = path.posix.dirname(t.path), l = path.posix.normalize(path.posix.join(a, h.join("/")));
2800
+ if (l.startsWith("../") || l === "..") return this.warn("TAR_ENTRY_ERROR", `${e} escapes extraction directory`, {
2801
+ entry: t,
2802
+ [e]: i
2803
+ }), !1;
2804
+ }
2805
+ return n && (t[e] = String(o), this.warn("TAR_ENTRY_INFO", `stripping ${n} from absolute ${e}`, {
2806
+ entry: t,
2807
+ [e]: i
2808
+ })), !0;
2809
+ }
2810
+ [Fr](t) {
2811
+ let e = f(t.path), i = e.split("/");
2812
+ if (this.strip) {
2813
+ if (i.length < this.strip) return !1;
2814
+ if (t.type === "Link") {
2815
+ let r = f(String(t.linkpath)).split("/");
2816
+ if (r.length >= this.strip) t.linkpath = r.slice(this.strip).join("/");
2817
+ else return !1;
2818
+ }
2819
+ i.splice(0, this.strip), t.path = i.join("/");
2820
+ }
2821
+ if (isFinite(this.maxDepth) && i.length > this.maxDepth) return this.warn("TAR_ENTRY_ERROR", "path excessively deep", {
2822
+ entry: t,
2823
+ path: e,
2824
+ depth: i.length,
2825
+ maxDepth: this.maxDepth
2826
+ }), !1;
2827
+ if (!this[Rs](t, "path") || !this[Rs](t, "linkpath")) return !1;
2828
+ if (t.absolute = path.isAbsolute(t.path) ? f(path.resolve(t.path)) : f(path.resolve(this.cwd, t.path)), !this.preservePaths && typeof t.absolute == "string" && t.absolute.indexOf(this.cwd + "/") !== 0 && t.absolute !== this.cwd) return this.warn("TAR_ENTRY_ERROR", "path escaped extraction target", {
2829
+ entry: t,
2830
+ path: f(t.path),
2831
+ resolvedPath: t.absolute,
2832
+ cwd: this.cwd
2833
+ }), !1;
2834
+ if (t.absolute === this.cwd && t.type !== "Directory" && t.type !== "GNUDumpDir") return !1;
2835
+ if (this.win32) {
2836
+ let { root: r } = path.win32.parse(String(t.absolute));
2837
+ t.absolute = r + ts(String(t.absolute).slice(r.length));
2838
+ let { root: n } = path.win32.parse(t.path);
2839
+ t.path = n + ts(t.path.slice(n.length));
2840
+ }
2841
+ return !0;
2842
+ }
2843
+ [Dr](t) {
2844
+ if (!this[Fr](t)) return t.resume();
2845
+ switch (co.equal(typeof t.absolute, "string"), t.type) {
2846
+ case "Directory":
2847
+ case "GNUDumpDir": t.mode && (t.mode = t.mode | 448);
2848
+ case "File":
2849
+ case "OldFile":
2850
+ case "ContiguousFile":
2851
+ case "Link":
2852
+ case "SymbolicLink": return this[_s](t);
2853
+ default: return this[Cr](t);
2854
+ }
2855
+ }
2856
+ [O](t, e) {
2857
+ t.name === "CwdError" ? this.emit("error", t) : (this.warn("TAR_ENTRY_ERROR", t, { entry: e }), this[$t](), e.resume());
2858
+ }
2859
+ [yt](t, e, i) {
2860
+ gr(f(t), {
2861
+ uid: this.uid,
2862
+ gid: this.gid,
2863
+ processUid: this.processUid,
2864
+ processGid: this.processGid,
2865
+ umask: this.processUmask,
2866
+ preserve: this.preservePaths,
2867
+ unlink: this.unlink,
2868
+ cwd: this.cwd,
2869
+ mode: e
2870
+ }, i);
2871
+ }
2872
+ [ge](t) {
2873
+ return this.forceChown || this.preserveOwner && (typeof t.uid == "number" && t.uid !== this.processUid || typeof t.gid == "number" && t.gid !== this.processGid) || typeof this.uid == "number" && this.uid !== this.processUid || typeof this.gid == "number" && this.gid !== this.processGid;
2874
+ }
2875
+ [be](t) {
2876
+ return vr(this.uid, t.uid, this.processUid);
2877
+ }
2878
+ [_e](t) {
2879
+ return vr(this.gid, t.gid, this.processGid);
2880
+ }
2881
+ [Ts](t, e) {
2882
+ let i = typeof t.mode == "number" ? t.mode & 4095 : this.fmode, r = new et(String(t.absolute), {
2883
+ flags: ms(t.size),
2884
+ mode: i,
2885
+ autoClose: !1
2886
+ });
2887
+ r.on("error", (a) => {
2888
+ r.fd && fs.close(r.fd, () => {}), r.write = () => !0, this[O](a, t), e();
2889
+ });
2890
+ let n = 1, o = (a) => {
2891
+ if (a) {
2892
+ r.fd && fs.close(r.fd, () => {}), this[O](a, t), e();
2893
+ return;
2894
+ }
2895
+ --n === 0 && r.fd !== void 0 && fs.close(r.fd, (l) => {
2896
+ l ? this[O](l, t) : this[$t](), e();
2897
+ });
2898
+ };
2899
+ r.on("finish", () => {
2900
+ let a = String(t.absolute), l = r.fd;
2901
+ if (typeof l == "number" && t.mtime && !this.noMtime) {
2902
+ n++;
2903
+ let c = t.atime || /* @__PURE__ */ new Date(), d = t.mtime;
2904
+ fs.futimes(l, c, d, (y) => y ? fs.utimes(a, c, d, (T) => o(T && y)) : o());
2905
+ }
2906
+ if (typeof l == "number" && this[ge](t)) {
2907
+ n++;
2908
+ let c = this[be](t), d = this[_e](t);
2909
+ typeof c == "number" && typeof d == "number" && fs.fchown(l, c, d, (y) => y ? fs.chown(a, c, d, (T) => o(T && y)) : o());
2910
+ }
2911
+ o();
2912
+ });
2913
+ let h = this.transform && this.transform(t) || t;
2914
+ h !== t && (h.on("error", (a) => {
2915
+ this[O](a, t), e();
2916
+ }), t.pipe(h)), h.pipe(r);
2917
+ }
2918
+ [xs](t, e) {
2919
+ let i = typeof t.mode == "number" ? t.mode & 4095 : this.dmode;
2920
+ this[yt](String(t.absolute), i, (r) => {
2921
+ if (r) {
2922
+ this[O](r, t), e();
2923
+ return;
2924
+ }
2925
+ let n = 1, o = () => {
2926
+ --n === 0 && (e(), this[$t](), t.resume());
2927
+ };
2928
+ t.mtime && !this.noMtime && (n++, fs.utimes(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime, o)), this[ge](t) && (n++, fs.chown(String(t.absolute), Number(this[be](t)), Number(this[_e](t)), o)), o();
2929
+ });
2930
+ }
2931
+ [Cr](t) {
2932
+ t.unsupported = !0, this.warn("TAR_ENTRY_UNSUPPORTED", `unsupported entry type: ${t.type}`, { entry: t }), t.resume();
2933
+ }
2934
+ [Ar](t, e) {
2935
+ let i = f(path.relative(this.cwd, path.resolve(path.dirname(String(t.absolute)), String(t.linkpath)))).split("/");
2936
+ this[Re](t, this.cwd, i, () => this[gi](t, String(t.linkpath), "symlink", e), (r) => {
2937
+ this[O](r, t), e();
2938
+ });
2939
+ }
2940
+ [Ir](t, e) {
2941
+ let i = f(path.resolve(this.cwd, String(t.linkpath))), r = f(String(t.linkpath)).split("/");
2942
+ this[Re](t, this.cwd, r, () => this[gi](t, i, "link", e), (n) => {
2943
+ this[O](n, t), e();
2944
+ });
2945
+ }
2946
+ [Re](t, e, i, r, n) {
2947
+ let o = i.shift();
2948
+ if (this.preservePaths || o === void 0) return r();
2949
+ let h = path.resolve(e, o);
2950
+ fs.lstat(h, (a, l) => {
2951
+ if (a) return r();
2952
+ if (l?.isSymbolicLink()) return n(new St(h, path.resolve(h, i.join("/"))));
2953
+ this[Re](t, h, i, r, n);
2954
+ });
2955
+ }
2956
+ [kr]() {
2957
+ this[Ri]++;
2958
+ }
2959
+ [$t]() {
2960
+ this[Ri]--, this[bs]();
2961
+ }
2962
+ [Ls](t) {
2963
+ this[$t](), t.resume();
2964
+ }
2965
+ [Os](t, e) {
2966
+ return t.type === "File" && !this.unlink && e.isFile() && e.nlink <= 1 && !Te;
2967
+ }
2968
+ [_s](t) {
2969
+ this[kr]();
2970
+ let e = [t.path];
2971
+ t.linkpath && e.push(t.linkpath), this.reservations.reserve(e, (i) => this[Nr](t, i));
2972
+ }
2973
+ [Nr](t, e) {
2974
+ let i = (h) => {
2975
+ e(h);
2976
+ }, r = () => {
2977
+ this[yt](this.cwd, this.dmode, (h) => {
2978
+ if (h) {
2979
+ this[O](h, t), i();
2980
+ return;
2981
+ }
2982
+ this[Oe] = !0, n();
2983
+ });
2984
+ }, n = () => {
2985
+ if (t.absolute !== this.cwd) {
2986
+ let h = f(path.dirname(String(t.absolute)));
2987
+ if (h !== this.cwd) return this[yt](h, this.dmode, (a) => {
2988
+ if (a) {
2989
+ this[O](a, t), i();
2990
+ return;
2991
+ }
2992
+ o();
2993
+ });
2994
+ }
2995
+ o();
2996
+ }, o = () => {
2997
+ fs.lstat(String(t.absolute), (h, a) => {
2998
+ if (a && (this.keep || this.newer && a.mtime > (t.mtime ?? a.mtime))) {
2999
+ this[Ls](t), i();
3000
+ return;
3001
+ }
3002
+ if (h || this[Os](t, a)) return this[P](null, t, i);
3003
+ if (a.isDirectory()) {
3004
+ if (t.type === "Directory") {
3005
+ let l = this.chmod && t.mode && (a.mode & 4095) !== t.mode, c = (d) => this[P](d ?? null, t, i);
3006
+ return l ? fs.chmod(String(t.absolute), Number(t.mode), c) : c();
3007
+ }
3008
+ if (t.absolute !== this.cwd) return fs.rmdir(String(t.absolute), (l) => this[P](l ?? null, t, i));
3009
+ }
3010
+ if (t.absolute === this.cwd) return this[P](null, t, i);
3011
+ mo(String(t.absolute), (l) => this[P](l ?? null, t, i));
3012
+ });
3013
+ };
3014
+ this[Oe] ? n() : r();
3015
+ }
3016
+ [P](t, e, i) {
3017
+ if (t) {
3018
+ this[O](t, e), i();
3019
+ return;
3020
+ }
3021
+ switch (e.type) {
3022
+ case "File":
3023
+ case "OldFile":
3024
+ case "ContiguousFile": return this[Ts](e, i);
3025
+ case "Link": return this[Ir](e, i);
3026
+ case "SymbolicLink": return this[Ar](e, i);
3027
+ case "Directory":
3028
+ case "GNUDumpDir": return this[xs](e, i);
3029
+ }
3030
+ }
3031
+ [gi](t, e, i, r) {
3032
+ fs[i](e, String(t.absolute), (n) => {
3033
+ n ? this[O](n, t) : (this[$t](), t.resume()), r();
3034
+ });
3035
+ }
3036
+ };
3037
+ var ye = (s) => {
3038
+ try {
3039
+ return [null, s()];
3040
+ } catch (t) {
3041
+ return [t, null];
3042
+ }
3043
+ };
3044
+ var xe = class extends Xt {
3045
+ sync = !0;
3046
+ [P](t, e) {
3047
+ return super[P](t, e, () => {});
3048
+ }
3049
+ [_s](t) {
3050
+ if (!this[Oe]) {
3051
+ let n = this[yt](this.cwd, this.dmode);
3052
+ if (n) return this[O](n, t);
3053
+ this[Oe] = !0;
3054
+ }
3055
+ if (t.absolute !== this.cwd) {
3056
+ let n = f(path.dirname(String(t.absolute)));
3057
+ if (n !== this.cwd) {
3058
+ let o = this[yt](n, this.dmode);
3059
+ if (o) return this[O](o, t);
3060
+ }
3061
+ }
3062
+ let [e, i] = ye(() => fs.lstatSync(String(t.absolute)));
3063
+ if (i && (this.keep || this.newer && i.mtime > (t.mtime ?? i.mtime))) return this[Ls](t);
3064
+ if (e || this[Os](t, i)) return this[P](null, t);
3065
+ if (i.isDirectory()) {
3066
+ if (t.type === "Directory") {
3067
+ let [h] = this.chmod && t.mode && (i.mode & 4095) !== t.mode ? ye(() => {
3068
+ fs.chmodSync(String(t.absolute), Number(t.mode));
3069
+ }) : [];
3070
+ return this[P](h, t);
3071
+ }
3072
+ let [n] = ye(() => fs.rmdirSync(String(t.absolute)));
3073
+ this[P](n, t);
3074
+ }
3075
+ let [r] = t.absolute === this.cwd ? [] : ye(() => po(String(t.absolute)));
3076
+ this[P](r, t);
3077
+ }
3078
+ [Ts](t, e) {
3079
+ let i = typeof t.mode == "number" ? t.mode & 4095 : this.fmode, r = (h) => {
3080
+ let a;
3081
+ try {
3082
+ fs.closeSync(n);
3083
+ } catch (l) {
3084
+ a = l;
3085
+ }
3086
+ (h || a) && this[O](h || a, t), e();
3087
+ }, n;
3088
+ try {
3089
+ n = fs.openSync(String(t.absolute), ms(t.size), i);
3090
+ } catch (h) {
3091
+ return r(h);
3092
+ }
3093
+ let o = this.transform && this.transform(t) || t;
3094
+ o !== t && (o.on("error", (h) => this[O](h, t)), t.pipe(o)), o.on("data", (h) => {
3095
+ try {
3096
+ fs.writeSync(n, h, 0, h.length);
3097
+ } catch (a) {
3098
+ r(a);
3099
+ }
3100
+ }), o.on("end", () => {
3101
+ let h = null;
3102
+ if (t.mtime && !this.noMtime) {
3103
+ let a = t.atime || /* @__PURE__ */ new Date(), l = t.mtime;
3104
+ try {
3105
+ fs.futimesSync(n, a, l);
3106
+ } catch (c) {
3107
+ try {
3108
+ fs.utimesSync(String(t.absolute), a, l);
3109
+ } catch {
3110
+ h = c;
3111
+ }
3112
+ }
3113
+ }
3114
+ if (this[ge](t)) {
3115
+ let a = this[be](t), l = this[_e](t);
3116
+ try {
3117
+ fs.fchownSync(n, Number(a), Number(l));
3118
+ } catch (c) {
3119
+ try {
3120
+ fs.chownSync(String(t.absolute), Number(a), Number(l));
3121
+ } catch {
3122
+ h = h || c;
3123
+ }
3124
+ }
3125
+ }
3126
+ r(h);
3127
+ });
3128
+ }
3129
+ [xs](t, e) {
3130
+ let i = typeof t.mode == "number" ? t.mode & 4095 : this.dmode, r = this[yt](String(t.absolute), i);
3131
+ if (r) {
3132
+ this[O](r, t), e();
3133
+ return;
3134
+ }
3135
+ if (t.mtime && !this.noMtime) try {
3136
+ fs.utimesSync(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime);
3137
+ } catch {}
3138
+ if (this[ge](t)) try {
3139
+ fs.chownSync(String(t.absolute), Number(this[be](t)), Number(this[_e](t)));
3140
+ } catch {}
3141
+ e(), t.resume();
3142
+ }
3143
+ [yt](t, e) {
3144
+ try {
3145
+ return _r(f(t), {
3146
+ uid: this.uid,
3147
+ gid: this.gid,
3148
+ processUid: this.processUid,
3149
+ processGid: this.processGid,
3150
+ umask: this.processUmask,
3151
+ preserve: this.preservePaths,
3152
+ unlink: this.unlink,
3153
+ cwd: this.cwd,
3154
+ mode: e
3155
+ });
3156
+ } catch (i) {
3157
+ return i;
3158
+ }
3159
+ }
3160
+ [Re](t, e, i, r, n) {
3161
+ if (this.preservePaths || i.length === 0) return r();
3162
+ let o = e;
3163
+ for (let h of i) {
3164
+ o = path.resolve(o, h);
3165
+ let [a, l] = ye(() => fs.lstatSync(o));
3166
+ if (a) return r();
3167
+ if (l.isSymbolicLink()) return n(new St(o, path.resolve(e, i.join("/"))));
3168
+ }
3169
+ r();
3170
+ }
3171
+ [gi](t, e, i, r) {
3172
+ let n = `${i}Sync`;
3173
+ try {
3174
+ fs[n](e, String(t.absolute)), r(), t.resume();
3175
+ } catch (o) {
3176
+ return this[O](o, t);
3177
+ }
3178
+ }
3179
+ };
3180
+ var Eo = (s) => {
3181
+ let t = new xe(s), e = s.file, i = fs.statSync(e);
3182
+ new Be(e, {
3183
+ readSize: s.maxReadSize || 16777216,
3184
+ size: i.size
3185
+ }).pipe(t);
3186
+ };
3187
+ var wo = (s, t) => {
3188
+ let e = new Xt(s), i = s.maxReadSize || 16777216, r = s.file;
3189
+ return new Promise((o, h) => {
3190
+ e.on("error", h), e.on("close", o), fs.stat(r, (a, l) => {
3191
+ if (a) h(a);
3192
+ else {
3193
+ let c = new _t(r, {
3194
+ readSize: i,
3195
+ size: l.size
3196
+ });
3197
+ c.on("error", h), c.pipe(e);
3198
+ }
3199
+ });
3200
+ });
3201
+ };
3202
+ var So = K(Eo, wo, (s) => new xe(s), (s) => new Xt(s), (s, t) => {
3203
+ t?.length && Qi(s, t);
3204
+ });
3205
+ var yo = (s, t) => {
3206
+ let e = new kt(s), i = !0, r, n;
3207
+ try {
3208
+ try {
3209
+ r = fs.openSync(s.file, "r+");
3210
+ } catch (a) {
3211
+ if (a?.code === "ENOENT") r = fs.openSync(s.file, "w+");
3212
+ else throw a;
3213
+ }
3214
+ let o = fs.fstatSync(r), h = Buffer.alloc(512);
3215
+ t: for (n = 0; n < o.size; n += 512) {
3216
+ for (let c = 0, d = 0; c < 512; c += d) {
3217
+ if (d = fs.readSync(r, h, c, h.length - c, n + c), n === 0 && h[0] === 31 && h[1] === 139) throw new Error("cannot append to compressed archives");
3218
+ if (!d) break t;
3219
+ }
3220
+ let a = new F(h);
3221
+ if (!a.cksumValid) break;
3222
+ let l = 512 * Math.ceil((a.size || 0) / 512);
3223
+ if (n + l + 512 > o.size) break;
3224
+ n += l, s.mtimeCache && a.mtime && s.mtimeCache.set(String(a.path), a.mtime);
3225
+ }
3226
+ i = !1, Ro(s, e, n, r, t);
3227
+ } finally {
3228
+ if (i) try {
3229
+ fs.closeSync(r);
3230
+ } catch {}
3231
+ }
3232
+ };
3233
+ var Ro = (s, t, e, i, r) => {
3234
+ let n = new Wt(s.file, {
3235
+ fd: i,
3236
+ start: e
3237
+ });
3238
+ t.pipe(n), bo(t, r);
3239
+ };
3240
+ var go = (s, t) => {
3241
+ t = Array.from(t);
3242
+ let e = new wt(s), i = (n, o, h) => {
3243
+ let a = (T, D) => {
3244
+ T ? fs.close(n, (E) => h(T)) : h(null, D);
3245
+ }, l = 0;
3246
+ if (o === 0) return a(null, 0);
3247
+ let c = 0, d = Buffer.alloc(512), y = (T, D) => {
3248
+ if (T || D === void 0) return a(T);
3249
+ if (c += D, c < 512 && D) return fs.read(n, d, c, d.length - c, l + c, y);
3250
+ if (l === 0 && d[0] === 31 && d[1] === 139) return a(/* @__PURE__ */ new Error("cannot append to compressed archives"));
3251
+ if (c < 512) return a(null, l);
3252
+ let E = new F(d);
3253
+ if (!E.cksumValid) return a(null, l);
3254
+ let x = 512 * Math.ceil((E.size ?? 0) / 512);
3255
+ if (l + x + 512 > o || (l += x + 512, l >= o)) return a(null, l);
3256
+ s.mtimeCache && E.mtime && s.mtimeCache.set(String(E.path), E.mtime), c = 0, fs.read(n, d, 0, 512, l, y);
3257
+ };
3258
+ fs.read(n, d, 0, 512, l, y);
3259
+ };
3260
+ return new Promise((n, o) => {
3261
+ e.on("error", o);
3262
+ let h = "r+", a = (l, c) => {
3263
+ if (l && l.code === "ENOENT" && h === "r+") return h = "w+", fs.open(s.file, h, a);
3264
+ if (l || !c) return o(l);
3265
+ fs.fstat(c, (d, y) => {
3266
+ if (d) return fs.close(c, () => o(d));
3267
+ i(c, y.size, (T, D) => {
3268
+ if (T) return o(T);
3269
+ let E = new et(s.file, {
3270
+ fd: c,
3271
+ start: D
3272
+ });
3273
+ e.pipe(E), E.on("error", o), E.on("close", n), _o(e, t);
3274
+ });
3275
+ });
3276
+ };
3277
+ fs.open(s.file, h, a);
3278
+ });
3279
+ };
3280
+ var bo = (s, t) => {
3281
+ t.forEach((e) => {
3282
+ e.charAt(0) === "@" ? Ct({
3283
+ file: path.resolve(s.cwd, e.slice(1)),
3284
+ sync: !0,
3285
+ noResume: !0,
3286
+ onReadEntry: (i) => s.add(i)
3287
+ }) : s.add(e);
3288
+ }), s.end();
3289
+ };
3290
+ var _o = async (s, t) => {
3291
+ for (let e of t) e.charAt(0) === "@" ? await Ct({
3292
+ file: path.resolve(String(s.cwd), e.slice(1)),
3293
+ noResume: !0,
3294
+ onReadEntry: (i) => s.add(i)
3295
+ }) : s.add(e);
3296
+ s.end();
3297
+ };
3298
+ var vt = K(yo, go, () => {
3299
+ throw new TypeError("file is required");
3300
+ }, () => {
3301
+ throw new TypeError("file is required");
3302
+ }, (s, t) => {
3303
+ if (!Bs(s)) throw new TypeError("file is required");
3304
+ if (s.gzip || s.brotli || s.zstd || s.file.endsWith(".br") || s.file.endsWith(".tbr")) throw new TypeError("cannot append to compressed archives");
3305
+ if (!t?.length) throw new TypeError("no paths specified to add/replace");
3306
+ });
3307
+ var Oo = K(vt.syncFile, vt.asyncFile, vt.syncNoFile, vt.asyncNoFile, (s, t = []) => {
3308
+ vt.validate?.(s, t), To(s);
3309
+ });
3310
+ var To = (s) => {
3311
+ let t = s.filter;
3312
+ s.mtimeCache || (s.mtimeCache = /* @__PURE__ */ new Map()), s.filter = t ? (e, i) => t(e, i) && !((s.mtimeCache?.get(e) ?? i.mtime ?? 0) > (i.mtime ?? 0)) : (e, i) => !((s.mtimeCache?.get(e) ?? i.mtime ?? 0) > (i.mtime ?? 0));
3313
+ };
3314
+
3315
+ //#endregion
3316
+ //#region src/pack/projectIdentity.ts
3317
+ function projectIdentity(repository) {
3318
+ const slug = repository.provider === "gitlab" && repository.projectId ? repository.projectId : `${repository.owner}/${repository.name}`;
3319
+ return {
3320
+ provider: repository.provider,
3321
+ id: `${repository.provider}:${slug}`,
3322
+ owner: repository.owner,
3323
+ name: repository.name,
3324
+ projectId: repository.projectId,
3325
+ apiUrl: repository.apiUrl
3326
+ };
3327
+ }
3328
+
3329
+ //#endregion
3330
+ export { Qn as n, rt as r, projectIdentity as t };
3331
+ //# sourceMappingURL=projectIdentity-F97vs1H-.mjs.map