@vuetify/cli 0.0.14 → 0.1.1

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