@darkrymit/crunes-cli 0.11.1 → 0.11.3

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