@drmhse/authos-vue 0.2.4 → 0.2.5

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