nitro-nightly 3.0.1-20260120-020848-6786d069 → 3.0.1-20260120-133205-cbfce96c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/_build/common.mjs +24931 -0
  2. package/dist/_build/rolldown.mjs +6 -11
  3. package/dist/_build/rollup.mjs +201 -0
  4. package/dist/_build/vite.build.mjs +1 -1
  5. package/dist/_chunks/dev.mjs +4 -6
  6. package/dist/_chunks/nitro.mjs +1183 -24
  7. package/dist/_chunks/nitro2.mjs +91 -248
  8. package/dist/_chunks/utils.mjs +254 -0
  9. package/dist/_common.mjs +45 -0
  10. package/dist/_libs/@hiogawa/vite-plugin-fullstack.mjs +652 -0
  11. package/dist/_libs/@jridgewell/gen-mapping.mjs +448 -0
  12. package/dist/_libs/@jridgewell/remapping.mjs +117 -0
  13. package/dist/_libs/@rollup/plugin-alias.mjs +64 -0
  14. package/dist/_libs/@rollup/plugin-commonjs.d.mts +241 -0
  15. package/dist/_libs/@rollup/plugin-commonjs.mjs +1300 -0
  16. package/dist/_libs/{plugin-alias+plugin-inject.mjs → @rollup/plugin-inject.mjs} +2 -65
  17. package/dist/_libs/@rollup/plugin-json.mjs +36 -0
  18. package/dist/_libs/@rollup/plugin-node-resolve.mjs +1972 -0
  19. package/dist/_libs/c12.d.mts +214 -0
  20. package/dist/_libs/{c12+dotenv+rc9.mjs → c12.mjs} +105 -12
  21. package/dist/_libs/{chokidar+readdirp.mjs → chokidar.mjs} +8 -1
  22. package/dist/_libs/compatx.d.mts +47 -0
  23. package/dist/_libs/confbox.mjs +2488 -70
  24. package/dist/_libs/esbuild.d.mts +20 -0
  25. package/dist/_libs/escape-string-regexp.mjs +8 -0
  26. package/dist/_libs/estree-walker.mjs +187 -0
  27. package/dist/_libs/giget.mjs +3550 -0
  28. package/dist/_libs/httpxy.d.mts +79 -0
  29. package/dist/_libs/httpxy.mjs +6 -1
  30. package/dist/_libs/klona.mjs +38 -0
  31. package/dist/_libs/magic-string.d.mts +220 -0
  32. package/dist/_libs/mlly.d.mts +57 -0
  33. package/dist/_libs/pkg-types.d.mts +23 -0
  34. package/dist/_libs/rou3.d.mts +43 -0
  35. package/dist/_libs/rou3.mjs +322 -0
  36. package/dist/_libs/std-env.d.mts +4 -0
  37. package/dist/_libs/tsconfck.mjs +832 -0
  38. package/dist/_libs/ultrahtml.mjs +138 -0
  39. package/dist/_libs/unimport.d.mts +426 -0
  40. package/dist/_libs/unimport.mjs +1781 -5
  41. package/dist/_libs/unwasm.d.mts +29 -0
  42. package/dist/_presets.mjs +3 -8
  43. package/dist/builder.mjs +6 -8
  44. package/dist/cli/_chunks/build.mjs +1 -1
  45. package/dist/cli/_chunks/dev.mjs +2 -3
  46. package/dist/cli/_chunks/list.mjs +1 -1
  47. package/dist/cli/_chunks/prepare.mjs +1 -1
  48. package/dist/cli/_chunks/run.mjs +1 -1
  49. package/dist/cli/_chunks/task.mjs +16 -0
  50. package/dist/cli/index.mjs +1 -1
  51. package/dist/presets/aws-lambda/runtime/_utils.d.mts +0 -5
  52. package/dist/presets/netlify/runtime/netlify-edge.d.mts +0 -1
  53. package/dist/presets/winterjs/runtime/winterjs.d.mts +0 -1
  54. package/dist/runtime/internal/error/dev.d.mts +0 -1
  55. package/dist/runtime/internal/route-rules.d.mts +0 -4
  56. package/dist/runtime/internal/routes/openapi.d.mts +0 -1
  57. package/dist/runtime/internal/routes/scalar.d.mts +0 -1
  58. package/dist/runtime/internal/routes/swagger.d.mts +0 -1
  59. package/dist/runtime/internal/runtime-config.d.mts +0 -1
  60. package/dist/runtime/nitro.d.mts +0 -3
  61. package/dist/runtime/virtual/renderer-template.d.mts +0 -1
  62. package/dist/types/index.d.mts +36 -1405
  63. package/dist/vite.mjs +18 -641
  64. package/package.json +2 -2
  65. package/dist/_chunks/nitro3.mjs +0 -2696
  66. package/dist/_chunks/nitro4.mjs +0 -176
  67. package/dist/_chunks/nitro5.mjs +0 -733
  68. package/dist/_chunks/nitro6.mjs +0 -1458
  69. package/dist/_chunks/nitro7.mjs +0 -7561
  70. package/dist/_chunks/nitro8.mjs +0 -3524
  71. package/dist/_chunks/nitro9.mjs +0 -1729
  72. package/dist/_libs/_.mjs +0 -3
  73. package/dist/_libs/_2.mjs +0 -3
  74. package/dist/_libs/_3.mjs +0 -4
  75. package/dist/_libs/_4.mjs +0 -6
  76. package/dist/_libs/_5.mjs +0 -3
  77. package/dist/_libs/_6.mjs +0 -3
  78. package/dist/_libs/acorn+confbox+js-tokens+magic-string+mlly+pkg-types+sourcemap-codec+strip-literal+unimport.mjs +0 -8900
  79. package/dist/_libs/confbox+exsolve+pkg-types.mjs +0 -1249
  80. package/dist/_libs/confbox2.mjs +0 -786
  81. package/dist/_libs/confbox3.mjs +0 -404
  82. package/dist/_libs/confbox4.mjs +0 -3
  83. package/dist/_libs/estree-walker+unimport.mjs +0 -378
  84. package/dist/_libs/fdir+picomatch+tinyglobby.mjs +0 -2471
  85. package/dist/_libs/gen-mapping+remapping+resolve-uri+trace-mapping+unimport+unplugin+unplugin-utils+webpack-virtual-modules.mjs +0 -2150
  86. package/dist/_libs/giget+node-fetch-native.mjs +0 -2692
  87. package/dist/_libs/local-pkg+quansync+unimport.mjs +0 -1526
  88. package/dist/_libs/nypm+tinyexec.mjs +0 -858
  89. package/dist/_libs/pathe.mjs +0 -164
  90. package/dist/_libs/perfect-debounce.mjs +0 -89
  91. package/dist/_libs/std-env.mjs +0 -158
  92. package/dist/_libs/vite-plugin-fullstack.mjs +0 -26
@@ -0,0 +1,3550 @@
1
+ import { n as __exportAll } from "../_common.mjs";
2
+ import { Y as readPackageJSON, at as join$2, ct as resolve$2, nt as dirname$2, ot as normalize$2, tt as basename$2 } from "../_build/common.mjs";
3
+ import { createRequire } from "node:module";
4
+ import { createWriteStream, existsSync, readdirSync, renameSync } from "node:fs";
5
+ import nativeFs from "fs";
6
+ import path from "path";
7
+ import Ds from "crypto";
8
+ import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
9
+ import { homedir, tmpdir } from "node:os";
10
+ import { delimiter, dirname as dirname$1, normalize as normalize$1, resolve as resolve$1 } from "node:path";
11
+ import { cwd } from "node:process";
12
+ import { promisify } from "node:util";
13
+ import { defu } from "defu";
14
+ import { createRequire as createRequire$1 } from "module";
15
+ import { PassThrough, pipeline } from "node:stream";
16
+ import { spawn } from "node:child_process";
17
+ import j$1 from "assert";
18
+ import nt from "events";
19
+ import ot from "stream";
20
+ import ht from "string_decoder";
21
+ import P from "buffer";
22
+ import O$2 from "zlib";
23
+ import nt$1 from "process";
24
+ import a$a from "util";
25
+ import c from "node:readline";
26
+
27
+ //#region node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.js
28
+ var l$2 = Object.create;
29
+ var u$5 = Object.defineProperty;
30
+ var d = Object.getOwnPropertyDescriptor;
31
+ var f$4 = Object.getOwnPropertyNames;
32
+ var p$1 = Object.getPrototypeOf;
33
+ var m$3 = Object.prototype.hasOwnProperty;
34
+ var h$1 = (e$7, t$7) => () => (t$7 || e$7((t$7 = { exports: {} }).exports, t$7), t$7.exports);
35
+ var g = (e$7, t$7, n$4, r) => {
36
+ if (t$7 && typeof t$7 === "object" || typeof t$7 === "function") for (var i$8 = f$4(t$7), a$11 = 0, o$6 = i$8.length, s$8; a$11 < o$6; a$11++) {
37
+ s$8 = i$8[a$11];
38
+ if (!m$3.call(e$7, s$8) && s$8 !== n$4) u$5(e$7, s$8, {
39
+ get: ((e$8) => t$7[e$8]).bind(null, s$8),
40
+ enumerable: !(r = d(t$7, s$8)) || r.enumerable
41
+ });
42
+ }
43
+ return e$7;
44
+ };
45
+ var _$1 = (e$7, t$7, n$4) => (n$4 = e$7 != null ? l$2(p$1(e$7)) : {}, g(t$7 || !e$7 || !e$7.__esModule ? u$5(n$4, "default", {
46
+ value: e$7,
47
+ enumerable: true
48
+ }) : n$4, e$7));
49
+ var v$2 = /* @__PURE__ */ createRequire$1(import.meta.url);
50
+ const y$3 = /^path$/i;
51
+ const b = {
52
+ key: "PATH",
53
+ value: ""
54
+ };
55
+ function x(e$7) {
56
+ for (const t$7 in e$7) {
57
+ if (!Object.prototype.hasOwnProperty.call(e$7, t$7) || !y$3.test(t$7)) continue;
58
+ const n$4 = e$7[t$7];
59
+ if (!n$4) return b;
60
+ return {
61
+ key: t$7,
62
+ value: n$4
63
+ };
64
+ }
65
+ return b;
66
+ }
67
+ function S$1(e$7, t$7) {
68
+ const i$8 = t$7.value.split(delimiter);
69
+ let o$6 = e$7;
70
+ let s$8;
71
+ do {
72
+ i$8.push(resolve$1(o$6, "node_modules", ".bin"));
73
+ s$8 = o$6;
74
+ o$6 = dirname$1(o$6);
75
+ } while (o$6 !== s$8);
76
+ return {
77
+ key: t$7.key,
78
+ value: i$8.join(delimiter)
79
+ };
80
+ }
81
+ function C$1(e$7, t$7) {
82
+ const n$4 = {
83
+ ...process.env,
84
+ ...t$7
85
+ };
86
+ const r = S$1(e$7, x(n$4));
87
+ n$4[r.key] = r.value;
88
+ return n$4;
89
+ }
90
+ const w$2 = (e$7) => {
91
+ let t$7 = e$7.length;
92
+ const n$4 = new PassThrough();
93
+ const r = () => {
94
+ if (--t$7 === 0) n$4.emit("end");
95
+ };
96
+ for (const t$8 of e$7) {
97
+ t$8.pipe(n$4, { end: false });
98
+ t$8.on("end", r);
99
+ }
100
+ return n$4;
101
+ };
102
+ var T$1 = h$1((exports, t$7) => {
103
+ t$7.exports = a$11;
104
+ a$11.sync = o$6;
105
+ var n$4 = v$2("fs");
106
+ function r(e$7, t$8) {
107
+ var n$5 = t$8.pathExt !== void 0 ? t$8.pathExt : process.env.PATHEXT;
108
+ if (!n$5) return true;
109
+ n$5 = n$5.split(";");
110
+ if (n$5.indexOf("") !== -1) return true;
111
+ for (var r$3 = 0; r$3 < n$5.length; r$3++) {
112
+ var i$9 = n$5[r$3].toLowerCase();
113
+ if (i$9 && e$7.substr(-i$9.length).toLowerCase() === i$9) return true;
114
+ }
115
+ return false;
116
+ }
117
+ function i$8(e$7, t$8, n$5) {
118
+ if (!e$7.isSymbolicLink() && !e$7.isFile()) return false;
119
+ return r(t$8, n$5);
120
+ }
121
+ function a$11(e$7, t$8, r$3) {
122
+ n$4.stat(e$7, function(n$5, a$12) {
123
+ r$3(n$5, n$5 ? false : i$8(a$12, e$7, t$8));
124
+ });
125
+ }
126
+ function o$6(e$7, t$8) {
127
+ return i$8(n$4.statSync(e$7), e$7, t$8);
128
+ }
129
+ });
130
+ var E$1 = h$1((exports, t$7) => {
131
+ t$7.exports = r;
132
+ r.sync = i$8;
133
+ var n$4 = v$2("fs");
134
+ function r(e$7, t$8, r$3) {
135
+ n$4.stat(e$7, function(e$8, n$5) {
136
+ r$3(e$8, e$8 ? false : a$11(n$5, t$8));
137
+ });
138
+ }
139
+ function i$8(e$7, t$8) {
140
+ return a$11(n$4.statSync(e$7), t$8);
141
+ }
142
+ function a$11(e$7, t$8) {
143
+ return e$7.isFile() && o$6(e$7, t$8);
144
+ }
145
+ function o$6(e$7, t$8) {
146
+ var n$5 = e$7.mode;
147
+ var r$3 = e$7.uid;
148
+ var i$9 = e$7.gid;
149
+ var a$12 = t$8.uid !== void 0 ? t$8.uid : process.getuid && process.getuid();
150
+ var o$7 = t$8.gid !== void 0 ? t$8.gid : process.getgid && process.getgid();
151
+ var s$8 = parseInt("100", 8);
152
+ var c$6 = parseInt("010", 8);
153
+ var l$3 = parseInt("001", 8);
154
+ var u$6 = s$8 | c$6;
155
+ return n$5 & l$3 || n$5 & c$6 && i$9 === o$7 || n$5 & s$8 && r$3 === a$12 || n$5 & u$6 && a$12 === 0;
156
+ }
157
+ });
158
+ var D = h$1((exports, t$7) => {
159
+ v$2("fs");
160
+ var r;
161
+ if (process.platform === "win32" || global.TESTING_WINDOWS) r = T$1();
162
+ else r = E$1();
163
+ t$7.exports = i$8;
164
+ i$8.sync = a$11;
165
+ function i$8(e$7, t$8, n$4) {
166
+ if (typeof t$8 === "function") {
167
+ n$4 = t$8;
168
+ t$8 = {};
169
+ }
170
+ if (!n$4) {
171
+ if (typeof Promise !== "function") throw new TypeError("callback not provided");
172
+ return new Promise(function(n$5, r$3) {
173
+ i$8(e$7, t$8 || {}, function(e$8, t$9) {
174
+ if (e$8) r$3(e$8);
175
+ else n$5(t$9);
176
+ });
177
+ });
178
+ }
179
+ r(e$7, t$8 || {}, function(e$8, r$3) {
180
+ if (e$8) {
181
+ if (e$8.code === "EACCES" || t$8 && t$8.ignoreErrors) {
182
+ e$8 = null;
183
+ r$3 = false;
184
+ }
185
+ }
186
+ n$4(e$8, r$3);
187
+ });
188
+ }
189
+ function a$11(e$7, t$8) {
190
+ try {
191
+ return r.sync(e$7, t$8 || {});
192
+ } catch (e$8) {
193
+ if (t$8 && t$8.ignoreErrors || e$8.code === "EACCES") return false;
194
+ else throw e$8;
195
+ }
196
+ }
197
+ });
198
+ var O$3 = h$1((exports, t$7) => {
199
+ const n$4 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
200
+ const r = v$2("path");
201
+ const i$8 = n$4 ? ";" : ":";
202
+ const a$11 = D();
203
+ const o$6 = (e$7) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e$7}`), { code: "ENOENT" });
204
+ const s$8 = (e$7, t$8) => {
205
+ const r$3 = t$8.colon || i$8;
206
+ const a$12 = e$7.match(/\//) || n$4 && e$7.match(/\\/) ? [""] : [...n$4 ? [process.cwd()] : [], ...(t$8.path || process.env.PATH || "").split(r$3)];
207
+ const o$7 = n$4 ? t$8.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
208
+ const s$9 = n$4 ? o$7.split(r$3) : [""];
209
+ if (n$4) {
210
+ if (e$7.indexOf(".") !== -1 && s$9[0] !== "") s$9.unshift("");
211
+ }
212
+ return {
213
+ pathEnv: a$12,
214
+ pathExt: s$9,
215
+ pathExtExe: o$7
216
+ };
217
+ };
218
+ const c$6 = (e$7, t$8, n$5) => {
219
+ if (typeof t$8 === "function") {
220
+ n$5 = t$8;
221
+ t$8 = {};
222
+ }
223
+ if (!t$8) t$8 = {};
224
+ const { pathEnv: i$9, pathExt: c$7, pathExtExe: l$4 } = s$8(e$7, t$8);
225
+ const u$6 = [];
226
+ const d = (n$6) => new Promise((a$12, s$9) => {
227
+ if (n$6 === i$9.length) return t$8.all && u$6.length ? a$12(u$6) : s$9(o$6(e$7));
228
+ const c$8 = i$9[n$6];
229
+ const l$5 = /^".*"$/.test(c$8) ? c$8.slice(1, -1) : c$8;
230
+ const d$1 = r.join(l$5, e$7);
231
+ a$12(f$5(!l$5 && /^\.[\\\/]/.test(e$7) ? e$7.slice(0, 2) + d$1 : d$1, n$6, 0));
232
+ });
233
+ const f$5 = (e$8, n$6, r$3) => new Promise((i$10, o$7) => {
234
+ if (r$3 === c$7.length) return i$10(d(n$6 + 1));
235
+ const s$9 = c$7[r$3];
236
+ a$11(e$8 + s$9, { pathExt: l$4 }, (a$12, o$8) => {
237
+ if (!a$12 && o$8) if (t$8.all) u$6.push(e$8 + s$9);
238
+ else return i$10(e$8 + s$9);
239
+ return i$10(f$5(e$8, n$6, r$3 + 1));
240
+ });
241
+ });
242
+ return n$5 ? d(0).then((e$8) => n$5(null, e$8), n$5) : d(0);
243
+ };
244
+ const l$3 = (e$7, t$8) => {
245
+ t$8 = t$8 || {};
246
+ const { pathEnv: n$5, pathExt: i$9, pathExtExe: c$7 } = s$8(e$7, t$8);
247
+ const l$4 = [];
248
+ for (let o$7 = 0; o$7 < n$5.length; o$7++) {
249
+ const s$9 = n$5[o$7];
250
+ const u$6 = /^".*"$/.test(s$9) ? s$9.slice(1, -1) : s$9;
251
+ const d = r.join(u$6, e$7);
252
+ const f$5 = !u$6 && /^\.[\\\/]/.test(e$7) ? e$7.slice(0, 2) + d : d;
253
+ for (let e$8 = 0; e$8 < i$9.length; e$8++) {
254
+ const n$6 = f$5 + i$9[e$8];
255
+ try {
256
+ if (a$11.sync(n$6, { pathExt: c$7 })) if (t$8.all) l$4.push(n$6);
257
+ else return n$6;
258
+ } catch (e$9) {}
259
+ }
260
+ }
261
+ if (t$8.all && l$4.length) return l$4;
262
+ if (t$8.nothrow) return null;
263
+ throw o$6(e$7);
264
+ };
265
+ t$7.exports = c$6;
266
+ c$6.sync = l$3;
267
+ });
268
+ var k$1 = h$1((exports, t$7) => {
269
+ const n$4 = (e$7 = {}) => {
270
+ const t$8 = e$7.env || process.env;
271
+ if ((e$7.platform || process.platform) !== "win32") return "PATH";
272
+ return Object.keys(t$8).reverse().find((e$8) => e$8.toUpperCase() === "PATH") || "Path";
273
+ };
274
+ t$7.exports = n$4;
275
+ t$7.exports.default = n$4;
276
+ });
277
+ var A = h$1((exports, t$7) => {
278
+ const n$4 = v$2("path");
279
+ const r = O$3();
280
+ const i$8 = k$1();
281
+ function a$11(e$7, t$8) {
282
+ const a$12 = e$7.options.env || process.env;
283
+ const o$7 = process.cwd();
284
+ const s$8 = e$7.options.cwd != null;
285
+ const c$6 = s$8 && process.chdir !== void 0 && !process.chdir.disabled;
286
+ if (c$6) try {
287
+ process.chdir(e$7.options.cwd);
288
+ } catch (e$8) {}
289
+ let l$3;
290
+ try {
291
+ l$3 = r.sync(e$7.command, {
292
+ path: a$12[i$8({ env: a$12 })],
293
+ pathExt: t$8 ? n$4.delimiter : void 0
294
+ });
295
+ } catch (e$8) {} finally {
296
+ if (c$6) process.chdir(o$7);
297
+ }
298
+ if (l$3) l$3 = n$4.resolve(s$8 ? e$7.options.cwd : "", l$3);
299
+ return l$3;
300
+ }
301
+ function o$6(e$7) {
302
+ return a$11(e$7) || a$11(e$7, true);
303
+ }
304
+ t$7.exports = o$6;
305
+ });
306
+ var j$2 = h$1((exports, t$7) => {
307
+ const n$4 = /([()\][%!^"`<>&|;, *?])/g;
308
+ function r(e$7) {
309
+ e$7 = e$7.replace(n$4, "^$1");
310
+ return e$7;
311
+ }
312
+ function i$8(e$7, t$8) {
313
+ e$7 = `${e$7}`;
314
+ e$7 = e$7.replace(/(\\*)"/g, "$1$1\\\"");
315
+ e$7 = e$7.replace(/(\\*)$/, "$1$1");
316
+ e$7 = `"${e$7}"`;
317
+ e$7 = e$7.replace(n$4, "^$1");
318
+ if (t$8) e$7 = e$7.replace(n$4, "^$1");
319
+ return e$7;
320
+ }
321
+ t$7.exports.command = r;
322
+ t$7.exports.argument = i$8;
323
+ });
324
+ var M = h$1((exports, t$7) => {
325
+ t$7.exports = /^#!(.*)/;
326
+ });
327
+ var N = h$1((exports, t$7) => {
328
+ const n$4 = M();
329
+ t$7.exports = (e$7 = "") => {
330
+ const t$8 = e$7.match(n$4);
331
+ if (!t$8) return null;
332
+ const [r, i$8] = t$8[0].replace(/#! ?/, "").split(" ");
333
+ const a$11 = r.split("/").pop();
334
+ if (a$11 === "env") return i$8;
335
+ return i$8 ? `${a$11} ${i$8}` : a$11;
336
+ };
337
+ });
338
+ var P$1 = h$1((exports, t$7) => {
339
+ const n$4 = v$2("fs");
340
+ const r = N();
341
+ function i$8(e$7) {
342
+ const t$8 = 150;
343
+ const i$9 = Buffer.alloc(t$8);
344
+ let a$11;
345
+ try {
346
+ a$11 = n$4.openSync(e$7, "r");
347
+ n$4.readSync(a$11, i$9, 0, t$8, 0);
348
+ n$4.closeSync(a$11);
349
+ } catch (e$8) {}
350
+ return r(i$9.toString());
351
+ }
352
+ t$7.exports = i$8;
353
+ });
354
+ var F$3 = h$1((exports, t$7) => {
355
+ const n$4 = v$2("path");
356
+ const r = A();
357
+ const i$8 = j$2();
358
+ const a$11 = P$1();
359
+ const o$6 = process.platform === "win32";
360
+ const s$8 = /\.(?:com|exe)$/i;
361
+ const c$6 = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
362
+ function l$3(e$7) {
363
+ e$7.file = r(e$7);
364
+ const t$8 = e$7.file && a$11(e$7.file);
365
+ if (t$8) {
366
+ e$7.args.unshift(e$7.file);
367
+ e$7.command = t$8;
368
+ return r(e$7);
369
+ }
370
+ return e$7.file;
371
+ }
372
+ function u$6(e$7) {
373
+ if (!o$6) return e$7;
374
+ const t$8 = l$3(e$7);
375
+ const r$3 = !s$8.test(t$8);
376
+ if (e$7.options.forceShell || r$3) {
377
+ const r$4 = c$6.test(t$8);
378
+ e$7.command = n$4.normalize(e$7.command);
379
+ e$7.command = i$8.command(e$7.command);
380
+ e$7.args = e$7.args.map((e$8) => i$8.argument(e$8, r$4));
381
+ e$7.args = [
382
+ "/d",
383
+ "/s",
384
+ "/c",
385
+ `"${[e$7.command].concat(e$7.args).join(" ")}"`
386
+ ];
387
+ e$7.command = process.env.comspec || "cmd.exe";
388
+ e$7.options.windowsVerbatimArguments = true;
389
+ }
390
+ return e$7;
391
+ }
392
+ function d(e$7, t$8, n$5) {
393
+ if (t$8 && !Array.isArray(t$8)) {
394
+ n$5 = t$8;
395
+ t$8 = null;
396
+ }
397
+ t$8 = t$8 ? t$8.slice(0) : [];
398
+ n$5 = Object.assign({}, n$5);
399
+ const r$3 = {
400
+ command: e$7,
401
+ args: t$8,
402
+ options: n$5,
403
+ file: void 0,
404
+ original: {
405
+ command: e$7,
406
+ args: t$8
407
+ }
408
+ };
409
+ return n$5.shell ? r$3 : u$6(r$3);
410
+ }
411
+ t$7.exports = d;
412
+ });
413
+ var I = h$1((exports, t$7) => {
414
+ const n$4 = process.platform === "win32";
415
+ function r(e$7, t$8) {
416
+ return Object.assign(/* @__PURE__ */ new Error(`${t$8} ${e$7.command} ENOENT`), {
417
+ code: "ENOENT",
418
+ errno: "ENOENT",
419
+ syscall: `${t$8} ${e$7.command}`,
420
+ path: e$7.command,
421
+ spawnargs: e$7.args
422
+ });
423
+ }
424
+ function i$8(e$7, t$8) {
425
+ if (!n$4) return;
426
+ const r$3 = e$7.emit;
427
+ e$7.emit = function(n$5, i$9) {
428
+ if (n$5 === "exit") {
429
+ const n$6 = a$11(i$9, t$8, "spawn");
430
+ if (n$6) return r$3.call(e$7, "error", n$6);
431
+ }
432
+ return r$3.apply(e$7, arguments);
433
+ };
434
+ }
435
+ function a$11(e$7, t$8) {
436
+ if (n$4 && e$7 === 1 && !t$8.file) return r(t$8.original, "spawn");
437
+ return null;
438
+ }
439
+ function o$6(e$7, t$8) {
440
+ if (n$4 && e$7 === 1 && !t$8.file) return r(t$8.original, "spawnSync");
441
+ return null;
442
+ }
443
+ t$7.exports = {
444
+ hookChildProcess: i$8,
445
+ verifyENOENT: a$11,
446
+ verifyENOENTSync: o$6,
447
+ notFoundError: r
448
+ };
449
+ });
450
+ var R$2 = _$1(h$1((exports, t$7) => {
451
+ const n$4 = v$2("child_process");
452
+ const r = F$3();
453
+ const i$8 = I();
454
+ function a$11(e$7, t$8, a$12) {
455
+ const o$7 = r(e$7, t$8, a$12);
456
+ const s$8 = n$4.spawn(o$7.command, o$7.args, o$7.options);
457
+ i$8.hookChildProcess(s$8, o$7);
458
+ return s$8;
459
+ }
460
+ function o$6(e$7, t$8, a$12) {
461
+ const o$7 = r(e$7, t$8, a$12);
462
+ const s$8 = n$4.spawnSync(o$7.command, o$7.args, o$7.options);
463
+ s$8.error = s$8.error || i$8.verifyENOENTSync(s$8.status, o$7);
464
+ return s$8;
465
+ }
466
+ t$7.exports = a$11;
467
+ t$7.exports.spawn = a$11;
468
+ t$7.exports.sync = o$6;
469
+ t$7.exports._parse = r;
470
+ t$7.exports._enoent = i$8;
471
+ })(), 1);
472
+ var z$1 = class extends Error {
473
+ result;
474
+ output;
475
+ get exitCode() {
476
+ if (this.result.exitCode !== null) return this.result.exitCode;
477
+ }
478
+ constructor(e$7, t$7) {
479
+ super(`Process exited with non-zero status (${e$7.exitCode})`);
480
+ this.result = e$7;
481
+ this.output = t$7;
482
+ }
483
+ };
484
+ const B = {
485
+ timeout: void 0,
486
+ persist: false
487
+ };
488
+ const V = { windowsHide: true };
489
+ function H$2(e$7, t$7) {
490
+ return {
491
+ command: normalize$1(e$7),
492
+ args: t$7 ?? []
493
+ };
494
+ }
495
+ function U(e$7) {
496
+ const t$7 = new AbortController();
497
+ for (const n$4 of e$7) {
498
+ if (n$4.aborted) {
499
+ t$7.abort();
500
+ return n$4;
501
+ }
502
+ const e$8 = () => {
503
+ t$7.abort(n$4.reason);
504
+ };
505
+ n$4.addEventListener("abort", e$8, { signal: t$7.signal });
506
+ }
507
+ return t$7.signal;
508
+ }
509
+ async function W(e$7) {
510
+ let t$7 = "";
511
+ for await (const n$4 of e$7) t$7 += n$4.toString();
512
+ return t$7;
513
+ }
514
+ var G$1 = class {
515
+ _process;
516
+ _aborted = false;
517
+ _options;
518
+ _command;
519
+ _args;
520
+ _resolveClose;
521
+ _processClosed;
522
+ _thrownError;
523
+ get process() {
524
+ return this._process;
525
+ }
526
+ get pid() {
527
+ return this._process?.pid;
528
+ }
529
+ get exitCode() {
530
+ if (this._process && this._process.exitCode !== null) return this._process.exitCode;
531
+ }
532
+ constructor(e$7, t$7, n$4) {
533
+ this._options = {
534
+ ...B,
535
+ ...n$4
536
+ };
537
+ this._command = e$7;
538
+ this._args = t$7 ?? [];
539
+ this._processClosed = new Promise((e$8) => {
540
+ this._resolveClose = e$8;
541
+ });
542
+ }
543
+ kill(e$7) {
544
+ return this._process?.kill(e$7) === true;
545
+ }
546
+ get aborted() {
547
+ return this._aborted;
548
+ }
549
+ get killed() {
550
+ return this._process?.killed === true;
551
+ }
552
+ pipe(e$7, t$7, n$4) {
553
+ return q$1(e$7, t$7, {
554
+ ...n$4,
555
+ stdin: this
556
+ });
557
+ }
558
+ async *[Symbol.asyncIterator]() {
559
+ const e$7 = this._process;
560
+ if (!e$7) return;
561
+ const t$7 = [];
562
+ if (this._streamErr) t$7.push(this._streamErr);
563
+ if (this._streamOut) t$7.push(this._streamOut);
564
+ const n$4 = w$2(t$7);
565
+ const r = c.createInterface({ input: n$4 });
566
+ for await (const e$8 of r) yield e$8.toString();
567
+ await this._processClosed;
568
+ e$7.removeAllListeners();
569
+ if (this._thrownError) throw this._thrownError;
570
+ if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z$1(this);
571
+ }
572
+ async _waitForOutput() {
573
+ const e$7 = this._process;
574
+ if (!e$7) throw new Error("No process was started");
575
+ const [t$7, n$4] = await Promise.all([this._streamOut ? W(this._streamOut) : "", this._streamErr ? W(this._streamErr) : ""]);
576
+ await this._processClosed;
577
+ if (this._options?.stdin) await this._options.stdin;
578
+ e$7.removeAllListeners();
579
+ if (this._thrownError) throw this._thrownError;
580
+ const r = {
581
+ stderr: n$4,
582
+ stdout: t$7,
583
+ exitCode: this.exitCode
584
+ };
585
+ if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z$1(this, r);
586
+ return r;
587
+ }
588
+ then(e$7, t$7) {
589
+ return this._waitForOutput().then(e$7, t$7);
590
+ }
591
+ _streamOut;
592
+ _streamErr;
593
+ spawn() {
594
+ const e$7 = cwd();
595
+ const n$4 = this._options;
596
+ const r = {
597
+ ...V,
598
+ ...n$4.nodeOptions
599
+ };
600
+ const i$8 = [];
601
+ this._resetState();
602
+ if (n$4.timeout !== void 0) i$8.push(AbortSignal.timeout(n$4.timeout));
603
+ if (n$4.signal !== void 0) i$8.push(n$4.signal);
604
+ if (n$4.persist === true) r.detached = true;
605
+ if (i$8.length > 0) r.signal = U(i$8);
606
+ r.env = C$1(e$7, r.env);
607
+ const { command: a$11, args: s$8 } = H$2(this._command, this._args);
608
+ const c$6 = (0, R$2._parse)(a$11, s$8, r);
609
+ const l$3 = spawn(c$6.command, c$6.args, c$6.options);
610
+ if (l$3.stderr) this._streamErr = l$3.stderr;
611
+ if (l$3.stdout) this._streamOut = l$3.stdout;
612
+ this._process = l$3;
613
+ l$3.once("error", this._onError);
614
+ l$3.once("close", this._onClose);
615
+ if (n$4.stdin !== void 0 && l$3.stdin && n$4.stdin.process) {
616
+ const { stdout: e$8 } = n$4.stdin.process;
617
+ if (e$8) e$8.pipe(l$3.stdin);
618
+ }
619
+ }
620
+ _resetState() {
621
+ this._aborted = false;
622
+ this._processClosed = new Promise((e$7) => {
623
+ this._resolveClose = e$7;
624
+ });
625
+ this._thrownError = void 0;
626
+ }
627
+ _onError = (e$7) => {
628
+ if (e$7.name === "AbortError" && (!(e$7.cause instanceof Error) || e$7.cause.name !== "TimeoutError")) {
629
+ this._aborted = true;
630
+ return;
631
+ }
632
+ this._thrownError = e$7;
633
+ };
634
+ _onClose = () => {
635
+ if (this._resolveClose) this._resolveClose();
636
+ };
637
+ };
638
+ const K = (e$7, t$7, n$4) => {
639
+ const r = new G$1(e$7, t$7, n$4);
640
+ r.spawn();
641
+ return r;
642
+ };
643
+ const q$1 = K;
644
+
645
+ //#endregion
646
+ //#region node_modules/.pnpm/nypm@0.6.2/node_modules/nypm/dist/shared/nypm.CLjaS_sz.mjs
647
+ async function findup(cwd$1, match, options = {}) {
648
+ const segments = normalize$2(cwd$1).split("/");
649
+ while (segments.length > 0) {
650
+ const result = await match(segments.join("/") || "/");
651
+ if (result || !options.includeParentDirs) return result;
652
+ segments.pop();
653
+ }
654
+ }
655
+ function cached(fn) {
656
+ let v$3;
657
+ return () => {
658
+ if (v$3 === void 0) v$3 = fn().then((r) => {
659
+ v$3 = r;
660
+ return v$3;
661
+ });
662
+ return v$3;
663
+ };
664
+ }
665
+ const hasCorepack = cached(async () => {
666
+ if (globalThis.process?.versions?.webcontainer) return false;
667
+ try {
668
+ const { exitCode } = await K("corepack", ["--version"]);
669
+ return exitCode === 0;
670
+ } catch {
671
+ return false;
672
+ }
673
+ });
674
+ async function executeCommand(command, args, options = {}) {
675
+ const xArgs = command === "npm" || command === "bun" || command === "deno" || !await hasCorepack() ? [command, args] : ["corepack", [command, ...args]];
676
+ const { exitCode, stdout, stderr } = await K(xArgs[0], xArgs[1], { nodeOptions: {
677
+ cwd: resolve$2(options.cwd || process.cwd()),
678
+ env: options.env,
679
+ stdio: options.silent ? "pipe" : "inherit"
680
+ } });
681
+ if (exitCode !== 0) throw new Error(`\`${xArgs.flat().join(" ")}\` failed.${options.silent ? [
682
+ "",
683
+ stdout,
684
+ stderr
685
+ ].join("\n") : ""}`);
686
+ }
687
+ const NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG = "No package manager auto-detected.";
688
+ async function resolveOperationOptions(options = {}) {
689
+ const cwd$1 = options.cwd || process.cwd();
690
+ const env = {
691
+ ...process.env,
692
+ ...options.env
693
+ };
694
+ const packageManager = (typeof options.packageManager === "string" ? packageManagers.find((pm) => pm.name === options.packageManager) : options.packageManager) || await detectPackageManager(options.cwd || process.cwd());
695
+ if (!packageManager) throw new Error(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG);
696
+ return {
697
+ cwd: cwd$1,
698
+ env,
699
+ silent: options.silent ?? false,
700
+ packageManager,
701
+ dev: options.dev ?? false,
702
+ workspace: options.workspace,
703
+ global: options.global ?? false,
704
+ dry: options.dry ?? false
705
+ };
706
+ }
707
+ function getWorkspaceArgs(options) {
708
+ if (!options.workspace) return [];
709
+ const workspacePkg = typeof options.workspace === "string" && options.workspace !== "" ? options.workspace : void 0;
710
+ if (options.packageManager.name === "pnpm") return workspacePkg ? ["--filter", workspacePkg] : ["--workspace-root"];
711
+ if (options.packageManager.name === "npm") return workspacePkg ? ["-w", workspacePkg] : ["--workspaces"];
712
+ if (options.packageManager.name === "yarn") if (!options.packageManager.majorVersion || options.packageManager.majorVersion === "1") return workspacePkg ? ["--cwd", workspacePkg] : ["-W"];
713
+ else return workspacePkg ? ["workspace", workspacePkg] : [];
714
+ return [];
715
+ }
716
+ function parsePackageManagerField(packageManager) {
717
+ const [name, _version] = (packageManager || "").split("@");
718
+ const [version, buildMeta] = _version?.split("+") || [];
719
+ if (name && name !== "-" && /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(name)) return {
720
+ name,
721
+ version,
722
+ buildMeta
723
+ };
724
+ const sanitized = name.replace(/\W+/g, "");
725
+ return {
726
+ name: sanitized,
727
+ version,
728
+ buildMeta,
729
+ warnings: [`Abnormal characters found in \`packageManager\` field, sanitizing from \`${name}\` to \`${sanitized}\``]
730
+ };
731
+ }
732
+ const packageManagers = [
733
+ {
734
+ name: "npm",
735
+ command: "npm",
736
+ lockFile: "package-lock.json"
737
+ },
738
+ {
739
+ name: "pnpm",
740
+ command: "pnpm",
741
+ lockFile: "pnpm-lock.yaml",
742
+ files: ["pnpm-workspace.yaml"]
743
+ },
744
+ {
745
+ name: "bun",
746
+ command: "bun",
747
+ lockFile: ["bun.lockb", "bun.lock"]
748
+ },
749
+ {
750
+ name: "yarn",
751
+ command: "yarn",
752
+ lockFile: "yarn.lock",
753
+ files: [".yarnrc.yml"]
754
+ },
755
+ {
756
+ name: "deno",
757
+ command: "deno",
758
+ lockFile: "deno.lock",
759
+ files: ["deno.json"]
760
+ }
761
+ ];
762
+ async function detectPackageManager(cwd$1, options = {}) {
763
+ const detected = await findup(resolve$2(cwd$1 || "."), async (path$2) => {
764
+ if (!options.ignorePackageJSON) {
765
+ const packageJSONPath = join$2(path$2, "package.json");
766
+ if (existsSync(packageJSONPath)) {
767
+ const packageJSON = JSON.parse(await readFile(packageJSONPath, "utf8"));
768
+ if (packageJSON?.packageManager) {
769
+ const { name, version = "0.0.0", buildMeta, warnings } = parsePackageManagerField(packageJSON.packageManager);
770
+ if (name) {
771
+ const majorVersion = version.split(".")[0];
772
+ const packageManager = packageManagers.find((pm) => pm.name === name && pm.majorVersion === majorVersion) || packageManagers.find((pm) => pm.name === name);
773
+ return {
774
+ name,
775
+ command: name,
776
+ version,
777
+ majorVersion,
778
+ buildMeta,
779
+ warnings,
780
+ files: packageManager?.files,
781
+ lockFile: packageManager?.lockFile
782
+ };
783
+ }
784
+ }
785
+ }
786
+ if (existsSync(join$2(path$2, "deno.json"))) return packageManagers.find((pm) => pm.name === "deno");
787
+ }
788
+ if (!options.ignoreLockFile) {
789
+ for (const packageManager of packageManagers) if ([packageManager.lockFile, packageManager.files].flat().filter(Boolean).some((file) => existsSync(resolve$2(path$2, file)))) return { ...packageManager };
790
+ }
791
+ }, { includeParentDirs: options.includeParentDirs ?? true });
792
+ if (!detected && !options.ignoreArgv) {
793
+ const scriptArg = process.argv[1];
794
+ if (scriptArg) {
795
+ for (const packageManager of packageManagers) if ((/* @__PURE__ */ new RegExp(`[/\\\\]\\.?${packageManager.command}`)).test(scriptArg)) return packageManager;
796
+ }
797
+ }
798
+ return detected;
799
+ }
800
+ async function installDependencies(options = {}) {
801
+ const resolvedOptions = await resolveOperationOptions(options);
802
+ const commandArgs = options.frozenLockFile ? {
803
+ npm: ["ci"],
804
+ yarn: ["install", "--immutable"],
805
+ bun: ["install", "--frozen-lockfile"],
806
+ pnpm: ["install", "--frozen-lockfile"],
807
+ deno: ["install", "--frozen"]
808
+ }[resolvedOptions.packageManager.name] : ["install"];
809
+ if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, commandArgs, {
810
+ cwd: resolvedOptions.cwd,
811
+ silent: resolvedOptions.silent
812
+ });
813
+ return { exec: {
814
+ command: resolvedOptions.packageManager.command,
815
+ args: commandArgs
816
+ } };
817
+ }
818
+ async function addDependency(name, options = {}) {
819
+ const resolvedOptions = await resolveOperationOptions(options);
820
+ const names = Array.isArray(name) ? name : [name];
821
+ if (resolvedOptions.packageManager.name === "deno") {
822
+ for (let i$8 = 0; i$8 < names.length; i$8++) if (!/^(npm|jsr|file):.+$/.test(names[i$8])) names[i$8] = `npm:${names[i$8]}`;
823
+ }
824
+ if (names.length === 0) return {};
825
+ const args = (resolvedOptions.packageManager.name === "yarn" ? [
826
+ ...getWorkspaceArgs(resolvedOptions),
827
+ resolvedOptions.global && resolvedOptions.packageManager.majorVersion === "1" ? "global" : "",
828
+ "add",
829
+ resolvedOptions.dev ? "-D" : "",
830
+ ...names
831
+ ] : [
832
+ resolvedOptions.packageManager.name === "npm" ? "install" : "add",
833
+ ...getWorkspaceArgs(resolvedOptions),
834
+ resolvedOptions.dev ? "-D" : "",
835
+ resolvedOptions.global ? "-g" : "",
836
+ ...names
837
+ ]).filter(Boolean);
838
+ if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, args, {
839
+ cwd: resolvedOptions.cwd,
840
+ silent: resolvedOptions.silent
841
+ });
842
+ if (!resolvedOptions.dry && options.installPeerDependencies) {
843
+ const existingPkg = await readPackageJSON(resolvedOptions.cwd);
844
+ const peerDeps = [];
845
+ const peerDevDeps = [];
846
+ for (const _name of names) {
847
+ const pkgName = _name.match(/^(.[^@]+)/)?.[0];
848
+ const pkg = await readPackageJSON(pkgName, { url: resolvedOptions.cwd }).catch(() => ({}));
849
+ if (!pkg.peerDependencies || pkg.name !== pkgName) continue;
850
+ for (const [peerDependency, version] of Object.entries(pkg.peerDependencies)) {
851
+ if (pkg.peerDependenciesMeta?.[peerDependency]?.optional) continue;
852
+ if (existingPkg.dependencies?.[peerDependency] || existingPkg.devDependencies?.[peerDependency]) continue;
853
+ (pkg.peerDependenciesMeta?.[peerDependency]?.dev ? peerDevDeps : peerDeps).push(`${peerDependency}@${version}`);
854
+ }
855
+ }
856
+ if (peerDeps.length > 0) await addDependency(peerDeps, { ...resolvedOptions });
857
+ if (peerDevDeps.length > 0) await addDevDependency(peerDevDeps, { ...resolvedOptions });
858
+ }
859
+ return { exec: {
860
+ command: resolvedOptions.packageManager.command,
861
+ args
862
+ } };
863
+ }
864
+ async function addDevDependency(name, options = {}) {
865
+ return await addDependency(name, {
866
+ ...options,
867
+ dev: true
868
+ });
869
+ }
870
+
871
+ //#endregion
872
+ //#region node_modules/.pnpm/nypm@0.6.2/node_modules/nypm/dist/index.mjs
873
+ var dist_exports$1 = /* @__PURE__ */ __exportAll({ addDevDependency: () => addDevDependency });
874
+
875
+ //#endregion
876
+ //#region node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/native.mjs
877
+ const e$6 = globalThis.Blob, o$5 = globalThis.File, a$10 = globalThis.FormData, s$7 = globalThis.Headers, t$6 = globalThis.Request, h = globalThis.Response, i$7 = globalThis.AbortController, l$1 = globalThis.fetch || (() => {
878
+ throw new Error("[node-fetch-native] Failed to fetch: `globalThis.fetch` is not available!");
879
+ });
880
+
881
+ //#endregion
882
+ //#region node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs
883
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
884
+ function getDefaultExportFromCjs(x$1) {
885
+ return x$1 && x$1.__esModule && Object.prototype.hasOwnProperty.call(x$1, "default") ? x$1["default"] : x$1;
886
+ }
887
+ var i$6, t$5;
888
+ function s$6() {
889
+ if (t$5) return i$6;
890
+ t$5 = 1;
891
+ const n = new Map([
892
+ ["C", "cwd"],
893
+ ["f", "file"],
894
+ ["z", "gzip"],
895
+ ["P", "preservePaths"],
896
+ ["U", "unlink"],
897
+ ["strip-components", "strip"],
898
+ ["stripComponents", "strip"],
899
+ ["keep-newer", "newer"],
900
+ ["keepNewer", "newer"],
901
+ ["keep-newer-files", "newer"],
902
+ ["keepNewerFiles", "newer"],
903
+ ["k", "keep"],
904
+ ["keep-existing", "keep"],
905
+ ["keepExisting", "keep"],
906
+ ["m", "noMtime"],
907
+ ["no-mtime", "noMtime"],
908
+ ["p", "preserveOwner"],
909
+ ["L", "follow"],
910
+ ["h", "follow"]
911
+ ]);
912
+ return i$6 = (r) => r ? Object.keys(r).map((e) => [n.has(e) ? n.get(e) : e, r[e]]).reduce((e, p) => (e[p[0]] = p[1], e), Object.create(null)) : {}, i$6;
913
+ }
914
+ var e$5, t$4;
915
+ function c$4() {
916
+ return t$4 || (t$4 = 1, e$5 = (o) => class extends o {
917
+ warn(n, i, r = {}) {
918
+ this.file && (r.file = this.file), this.cwd && (r.cwd = this.cwd), r.code = i instanceof Error && i.code || n, r.tarCode = n, !this.strict && r.recoverable !== false ? (i instanceof Error && (r = Object.assign(i, r), i = i.message), this.emit("warn", r.tarCode, i, r)) : i instanceof Error ? this.emit("error", Object.assign(i, r)) : this.emit("error", Object.assign(/* @__PURE__ */ new Error(`${n}: ${i}`), r));
919
+ }
920
+ }), e$5;
921
+ }
922
+ var e$4 = {};
923
+ var a$9;
924
+ function n$3() {
925
+ return a$9 ? e$4 : (a$9 = 1, function(e) {
926
+ e.name = new Map([
927
+ ["0", "File"],
928
+ ["", "OldFile"],
929
+ ["1", "Link"],
930
+ ["2", "SymbolicLink"],
931
+ ["3", "CharacterDevice"],
932
+ ["4", "BlockDevice"],
933
+ ["5", "Directory"],
934
+ ["6", "FIFO"],
935
+ ["7", "ContiguousFile"],
936
+ ["g", "GlobalExtendedHeader"],
937
+ ["x", "ExtendedHeader"],
938
+ ["A", "SolarisACL"],
939
+ ["D", "GNUDumpDir"],
940
+ ["I", "Inode"],
941
+ ["K", "NextFileHasLongLinkpath"],
942
+ ["L", "NextFileHasLongPath"],
943
+ ["M", "ContinuationFile"],
944
+ ["N", "OldGnuLongPath"],
945
+ ["S", "SparseFile"],
946
+ ["V", "TapeVolumeHeader"],
947
+ ["X", "OldExtendedHeader"]
948
+ ]), e.code = new Map(Array.from(e.name).map((i) => [i[1], i[0]]));
949
+ }(e$4), e$4);
950
+ }
951
+ var f$3, i$5;
952
+ function w$1() {
953
+ if (i$5) return f$3;
954
+ i$5 = 1;
955
+ const v = (e, r) => {
956
+ if (Number.isSafeInteger(e)) e < 0 ? g$1(e, r) : p(e, r);
957
+ else throw Error("cannot encode number outside of javascript safe integer range");
958
+ return r;
959
+ }, p = (e, r) => {
960
+ r[0] = 128;
961
+ for (var o = r.length; o > 1; o--) r[o - 1] = e & 255, e = Math.floor(e / 256);
962
+ }, g$1 = (e, r) => {
963
+ r[0] = 255;
964
+ var o = false;
965
+ e = e * -1;
966
+ for (var s = r.length; s > 1; s--) {
967
+ var a = e & 255;
968
+ e = Math.floor(e / 256), o ? r[s - 1] = l(a) : a === 0 ? r[s - 1] = 0 : (o = true, r[s - 1] = c$1(a));
969
+ }
970
+ }, h$2 = (e) => {
971
+ const r = e[0], o = r === 128 ? d$1(e.slice(1, e.length)) : r === 255 ? x$1(e) : null;
972
+ if (o === null) throw Error("invalid base256 encoding");
973
+ if (!Number.isSafeInteger(o)) throw Error("parsed number outside of javascript safe integer range");
974
+ return o;
975
+ }, x$1 = (e) => {
976
+ for (var r = e.length, o = 0, s = false, a = r - 1; a > -1; a--) {
977
+ var n = e[a], t;
978
+ s ? t = l(n) : n === 0 ? t = n : (s = true, t = c$1(n)), t !== 0 && (o -= t * Math.pow(256, r - a - 1));
979
+ }
980
+ return o;
981
+ }, d$1 = (e) => {
982
+ for (var r = e.length, o = 0, s = r - 1; s > -1; s--) {
983
+ var a = e[s];
984
+ a !== 0 && (o += a * Math.pow(256, r - s - 1));
985
+ }
986
+ return o;
987
+ }, l = (e) => (255 ^ e) & 255, c$1 = (e) => (255 ^ e) + 1 & 255;
988
+ return f$3 = {
989
+ encode: v,
990
+ parse: h$2
991
+ }, f$3;
992
+ }
993
+ var k, w;
994
+ function E() {
995
+ if (w) return k;
996
+ w = 1;
997
+ const u = n$3(), x$1 = path.posix, y = w$1(), P$2 = Symbol("slurp"), a = Symbol("type");
998
+ class B$1 {
999
+ constructor(e, t, i, h$2) {
1000
+ this.cksumValid = false, this.needPax = false, this.nullBlock = false, this.block = null, this.path = null, this.mode = null, this.uid = null, this.gid = null, this.size = null, this.mtime = null, this.cksum = null, this[a] = "0", this.linkpath = null, this.uname = null, this.gname = null, this.devmaj = 0, this.devmin = 0, this.atime = null, this.ctime = null, Buffer.isBuffer(e) ? this.decode(e, t || 0, i, h$2) : e && this.set(e);
1001
+ }
1002
+ decode(e, t, i, h$2) {
1003
+ if (t || (t = 0), !e || !(e.length >= t + 512)) throw new Error("need 512 bytes for header");
1004
+ if (this.path = d$1(e, t, 100), this.mode = r(e, t + 100, 8), this.uid = r(e, t + 108, 8), this.gid = r(e, t + 116, 8), this.size = r(e, t + 124, 12), this.mtime = o(e, t + 136, 12), this.cksum = r(e, t + 148, 12), this[P$2](i), this[P$2](h$2, true), this[a] = d$1(e, t + 156, 1), this[a] === "" && (this[a] = "0"), this[a] === "0" && this.path.slice(-1) === "/" && (this[a] = "5"), this[a] === "5" && (this.size = 0), this.linkpath = d$1(e, t + 157, 100), e.slice(t + 257, t + 265).toString() === "ustar\x0000") if (this.uname = d$1(e, t + 265, 32), this.gname = d$1(e, t + 297, 32), this.devmaj = r(e, t + 329, 8), this.devmin = r(e, t + 337, 8), e[t + 475] !== 0) this.path = d$1(e, t + 345, 155) + "/" + this.path;
1005
+ else {
1006
+ const n = d$1(e, t + 345, 130);
1007
+ n && (this.path = n + "/" + this.path), this.atime = o(e, t + 476, 12), this.ctime = o(e, t + 488, 12);
1008
+ }
1009
+ let l = 256;
1010
+ for (let n = t; n < t + 148; n++) l += e[n];
1011
+ for (let n = t + 156; n < t + 512; n++) l += e[n];
1012
+ this.cksumValid = l === this.cksum, this.cksum === null && l === 256 && (this.nullBlock = true);
1013
+ }
1014
+ [P$2](e, t) {
1015
+ for (const i in e) e[i] !== null && e[i] !== void 0 && !(t && i === "path") && (this[i] = e[i]);
1016
+ }
1017
+ encode(e, t) {
1018
+ if (e || (e = this.block = Buffer.alloc(512), t = 0), t || (t = 0), !(e.length >= t + 512)) throw new Error("need 512 bytes for header");
1019
+ const i = this.ctime || this.atime ? 130 : 155, h$2 = L(this.path || "", i), l = h$2[0], n = h$2[1];
1020
+ this.needPax = h$2[2], this.needPax = m(e, t, 100, l) || this.needPax, this.needPax = c$1(e, t + 100, 8, this.mode) || this.needPax, this.needPax = c$1(e, t + 108, 8, this.uid) || this.needPax, this.needPax = c$1(e, t + 116, 8, this.gid) || this.needPax, this.needPax = c$1(e, t + 124, 12, this.size) || this.needPax, this.needPax = g$1(e, t + 136, 12, this.mtime) || this.needPax, e[t + 156] = this[a].charCodeAt(0), this.needPax = m(e, t + 157, 100, this.linkpath) || this.needPax, e.write("ustar\x0000", t + 257, 8), this.needPax = m(e, t + 265, 32, this.uname) || this.needPax, this.needPax = m(e, t + 297, 32, this.gname) || this.needPax, this.needPax = c$1(e, t + 329, 8, this.devmaj) || this.needPax, this.needPax = c$1(e, t + 337, 8, this.devmin) || this.needPax, this.needPax = m(e, t + 345, i, n) || this.needPax, e[t + 475] !== 0 ? this.needPax = m(e, t + 345, 155, n) || this.needPax : (this.needPax = m(e, t + 345, 130, n) || this.needPax, this.needPax = g$1(e, t + 476, 12, this.atime) || this.needPax, this.needPax = g$1(e, t + 488, 12, this.ctime) || this.needPax);
1021
+ let S = 256;
1022
+ for (let p = t; p < t + 148; p++) S += e[p];
1023
+ for (let p = t + 156; p < t + 512; p++) S += e[p];
1024
+ return this.cksum = S, c$1(e, t + 148, 8, this.cksum), this.cksumValid = true, this.needPax;
1025
+ }
1026
+ set(e) {
1027
+ for (const t in e) e[t] !== null && e[t] !== void 0 && (this[t] = e[t]);
1028
+ }
1029
+ get type() {
1030
+ return u.name.get(this[a]) || this[a];
1031
+ }
1032
+ get typeKey() {
1033
+ return this[a];
1034
+ }
1035
+ set type(e) {
1036
+ u.code.has(e) ? this[a] = u.code.get(e) : this[a] = e;
1037
+ }
1038
+ }
1039
+ const L = (s, e) => {
1040
+ let i = s, h$2 = "", l;
1041
+ const n = x$1.parse(s).root || ".";
1042
+ if (Buffer.byteLength(i) < 100) l = [
1043
+ i,
1044
+ h$2,
1045
+ false
1046
+ ];
1047
+ else {
1048
+ h$2 = x$1.dirname(i), i = x$1.basename(i);
1049
+ do
1050
+ Buffer.byteLength(i) <= 100 && Buffer.byteLength(h$2) <= e ? l = [
1051
+ i,
1052
+ h$2,
1053
+ false
1054
+ ] : Buffer.byteLength(i) > 100 && Buffer.byteLength(h$2) <= e ? l = [
1055
+ i.slice(0, 99),
1056
+ h$2,
1057
+ true
1058
+ ] : (i = x$1.join(x$1.basename(h$2), i), h$2 = x$1.dirname(h$2));
1059
+ while (h$2 !== n && !l);
1060
+ l || (l = [
1061
+ s.slice(0, 99),
1062
+ "",
1063
+ true
1064
+ ]);
1065
+ }
1066
+ return l;
1067
+ }, d$1 = (s, e, t) => s.slice(e, e + t).toString("utf8").replace(/\0.*/, ""), o = (s, e, t) => N$1(r(s, e, t)), N$1 = (s) => s === null ? null : /* @__PURE__ */ new Date(s * 1e3), r = (s, e, t) => s[e] & 128 ? y.parse(s.slice(e, e + t)) : j(s, e, t), q = (s) => isNaN(s) ? null : s, j = (s, e, t) => q(parseInt(s.slice(e, e + t).toString("utf8").replace(/\0.*$/, "").trim(), 8)), v = {
1068
+ 12: 8589934591,
1069
+ 8: 2097151
1070
+ }, c$1 = (s, e, t, i) => i === null ? false : i > v[t] || i < 0 ? (y.encode(i, s.slice(e, e + t)), true) : ($(s, e, t, i), false), $ = (s, e, t, i) => s.write(_(i, t), e, t, "ascii"), _ = (s, e) => z(Math.floor(s).toString(8), e), z = (s, e) => (s.length === e - 1 ? s : new Array(e - s.length - 1).join("0") + s + " ") + "\0", g$1 = (s, e, t, i) => i === null ? false : c$1(s, e, t, i.getTime() / 1e3), A$1 = new Array(156).join("\0"), m = (s, e, t, i) => i === null ? false : (s.write(i + A$1, e, t, "utf8"), i.length !== Buffer.byteLength(i) || i.length > t);
1071
+ return k = B$1, k;
1072
+ }
1073
+ var e$3, t$3;
1074
+ function i$4() {
1075
+ return t$3 || (t$3 = 1, e$3 = function(o) {
1076
+ o.prototype[Symbol.iterator] = function* () {
1077
+ for (let r = this.head; r; r = r.next) yield r.value;
1078
+ };
1079
+ }), e$3;
1080
+ }
1081
+ var u$4, a$8;
1082
+ function c$3() {
1083
+ if (a$8) return u$4;
1084
+ a$8 = 1, u$4 = r, r.Node = s, r.create = r;
1085
+ function r(t) {
1086
+ var i = this;
1087
+ if (i instanceof r || (i = new r()), i.tail = null, i.head = null, i.length = 0, t && typeof t.forEach == "function") t.forEach(function(n) {
1088
+ i.push(n);
1089
+ });
1090
+ else if (arguments.length > 0) for (var e = 0, h$2 = arguments.length; e < h$2; e++) i.push(arguments[e]);
1091
+ return i;
1092
+ }
1093
+ r.prototype.removeNode = function(t) {
1094
+ if (t.list !== this) throw new Error("removing node which does not belong to this list");
1095
+ var i = t.next, e = t.prev;
1096
+ return i && (i.prev = e), e && (e.next = i), t === this.head && (this.head = i), t === this.tail && (this.tail = e), t.list.length--, t.next = null, t.prev = null, t.list = null, i;
1097
+ }, r.prototype.unshiftNode = function(t) {
1098
+ if (t !== this.head) {
1099
+ t.list && t.list.removeNode(t);
1100
+ var i = this.head;
1101
+ t.list = this, t.next = i, i && (i.prev = t), this.head = t, this.tail || (this.tail = t), this.length++;
1102
+ }
1103
+ }, r.prototype.pushNode = function(t) {
1104
+ if (t !== this.tail) {
1105
+ t.list && t.list.removeNode(t);
1106
+ var i = this.tail;
1107
+ t.list = this, t.prev = i, i && (i.next = t), this.tail = t, this.head || (this.head = t), this.length++;
1108
+ }
1109
+ }, r.prototype.push = function() {
1110
+ for (var t = 0, i = arguments.length; t < i; t++) f(this, arguments[t]);
1111
+ return this.length;
1112
+ }, r.prototype.unshift = function() {
1113
+ for (var t = 0, i = arguments.length; t < i; t++) o(this, arguments[t]);
1114
+ return this.length;
1115
+ }, r.prototype.pop = function() {
1116
+ if (this.tail) {
1117
+ var t = this.tail.value;
1118
+ return this.tail = this.tail.prev, this.tail ? this.tail.next = null : this.head = null, this.length--, t;
1119
+ }
1120
+ }, r.prototype.shift = function() {
1121
+ if (this.head) {
1122
+ var t = this.head.value;
1123
+ return this.head = this.head.next, this.head ? this.head.prev = null : this.tail = null, this.length--, t;
1124
+ }
1125
+ }, r.prototype.forEach = function(t, i) {
1126
+ i = i || this;
1127
+ for (var e = this.head, h$2 = 0; e !== null; h$2++) t.call(i, e.value, h$2, this), e = e.next;
1128
+ }, r.prototype.forEachReverse = function(t, i) {
1129
+ i = i || this;
1130
+ for (var e = this.tail, h$2 = this.length - 1; e !== null; h$2--) t.call(i, e.value, h$2, this), e = e.prev;
1131
+ }, r.prototype.get = function(t) {
1132
+ for (var i = 0, e = this.head; e !== null && i < t; i++) e = e.next;
1133
+ if (i === t && e !== null) return e.value;
1134
+ }, r.prototype.getReverse = function(t) {
1135
+ for (var i = 0, e = this.tail; e !== null && i < t; i++) e = e.prev;
1136
+ if (i === t && e !== null) return e.value;
1137
+ }, r.prototype.map = function(t, i) {
1138
+ i = i || this;
1139
+ for (var e = new r(), h$2 = this.head; h$2 !== null;) e.push(t.call(i, h$2.value, this)), h$2 = h$2.next;
1140
+ return e;
1141
+ }, r.prototype.mapReverse = function(t, i) {
1142
+ i = i || this;
1143
+ for (var e = new r(), h$2 = this.tail; h$2 !== null;) e.push(t.call(i, h$2.value, this)), h$2 = h$2.prev;
1144
+ return e;
1145
+ }, r.prototype.reduce = function(t, i) {
1146
+ var e, h$2 = this.head;
1147
+ if (arguments.length > 1) e = i;
1148
+ else if (this.head) h$2 = this.head.next, e = this.head.value;
1149
+ else throw new TypeError("Reduce of empty list with no initial value");
1150
+ for (var n = 0; h$2 !== null; n++) e = t(e, h$2.value, n), h$2 = h$2.next;
1151
+ return e;
1152
+ }, r.prototype.reduceReverse = function(t, i) {
1153
+ var e, h$2 = this.tail;
1154
+ if (arguments.length > 1) e = i;
1155
+ else if (this.tail) h$2 = this.tail.prev, e = this.tail.value;
1156
+ else throw new TypeError("Reduce of empty list with no initial value");
1157
+ for (var n = this.length - 1; h$2 !== null; n--) e = t(e, h$2.value, n), h$2 = h$2.prev;
1158
+ return e;
1159
+ }, r.prototype.toArray = function() {
1160
+ for (var t = new Array(this.length), i = 0, e = this.head; e !== null; i++) t[i] = e.value, e = e.next;
1161
+ return t;
1162
+ }, r.prototype.toArrayReverse = function() {
1163
+ for (var t = new Array(this.length), i = 0, e = this.tail; e !== null; i++) t[i] = e.value, e = e.prev;
1164
+ return t;
1165
+ }, r.prototype.slice = function(t, i) {
1166
+ i = i || this.length, i < 0 && (i += this.length), t = t || 0, t < 0 && (t += this.length);
1167
+ var e = new r();
1168
+ if (i < t || i < 0) return e;
1169
+ t < 0 && (t = 0), i > this.length && (i = this.length);
1170
+ for (var h$2 = 0, n = this.head; n !== null && h$2 < t; h$2++) n = n.next;
1171
+ for (; n !== null && h$2 < i; h$2++, n = n.next) e.push(n.value);
1172
+ return e;
1173
+ }, r.prototype.sliceReverse = function(t, i) {
1174
+ i = i || this.length, i < 0 && (i += this.length), t = t || 0, t < 0 && (t += this.length);
1175
+ var e = new r();
1176
+ if (i < t || i < 0) return e;
1177
+ t < 0 && (t = 0), i > this.length && (i = this.length);
1178
+ for (var h$2 = this.length, n = this.tail; n !== null && h$2 > i; h$2--) n = n.prev;
1179
+ for (; n !== null && h$2 > t; h$2--, n = n.prev) e.push(n.value);
1180
+ return e;
1181
+ }, r.prototype.splice = function(t, i, ...e) {
1182
+ t > this.length && (t = this.length - 1), t < 0 && (t = this.length + t);
1183
+ for (var h$2 = 0, n = this.head; n !== null && h$2 < t; h$2++) n = n.next;
1184
+ for (var l = [], h$2 = 0; n && h$2 < i; h$2++) l.push(n.value), n = this.removeNode(n);
1185
+ n === null && (n = this.tail), n !== this.head && n !== this.tail && (n = n.prev);
1186
+ for (var h$2 = 0; h$2 < e.length; h$2++) n = v(this, n, e[h$2]);
1187
+ return l;
1188
+ }, r.prototype.reverse = function() {
1189
+ for (var t = this.head, i = this.tail, e = t; e !== null; e = e.prev) {
1190
+ var h$2 = e.prev;
1191
+ e.prev = e.next, e.next = h$2;
1192
+ }
1193
+ return this.head = i, this.tail = t, this;
1194
+ };
1195
+ function v(t, i, e) {
1196
+ var h$2 = i === t.head ? new s(e, null, i, t) : new s(e, i, i.next, t);
1197
+ return h$2.next === null && (t.tail = h$2), h$2.prev === null && (t.head = h$2), t.length++, h$2;
1198
+ }
1199
+ function f(t, i) {
1200
+ t.tail = new s(i, t.tail, null, t), t.head || (t.head = t.tail), t.length++;
1201
+ }
1202
+ function o(t, i) {
1203
+ t.head = new s(i, null, t.head, t), t.tail || (t.tail = t.head), t.length++;
1204
+ }
1205
+ function s(t, i, e, h$2) {
1206
+ if (!(this instanceof s)) return new s(t, i, e, h$2);
1207
+ this.list = h$2, this.value = t, i ? (i.next = this, this.prev = i) : this.prev = null, e ? (e.prev = this, this.next = e) : this.next = null;
1208
+ }
1209
+ try {
1210
+ i$4()(r);
1211
+ } catch {}
1212
+ return u$4;
1213
+ }
1214
+ var s$5 = {};
1215
+ var X$1;
1216
+ function ft() {
1217
+ if (X$1) return s$5;
1218
+ X$1 = 1;
1219
+ const H = typeof process == "object" && process ? process : {
1220
+ stdout: null,
1221
+ stderr: null
1222
+ }, Z = nt, q = ot, G = ht.StringDecoder, m = Symbol("EOF"), d$1 = Symbol("maybeEmitEnd"), y = Symbol("emittedEnd"), R = Symbol("emittingEnd"), g$1 = Symbol("emittedError"), B$1 = Symbol("closed"), Y = Symbol("read"), T = Symbol("flush"), $ = Symbol("flushChunk"), f = Symbol("encoding"), c$1 = Symbol("decoder"), M$1 = Symbol("flowing"), S = Symbol("paused"), b$1 = Symbol("resume"), i = Symbol("buffer"), a = Symbol("pipes"), n = Symbol("bufferLength"), j = Symbol("bufferPush"), I$1 = Symbol("bufferShift"), o = Symbol("objectMode"), r = Symbol("destroyed"), P$2 = Symbol("error"), x$1 = Symbol("emitData"), V$1 = Symbol("emitEnd"), N$1 = Symbol("emitEnd2"), p = Symbol("async"), _ = Symbol("abort"), O = Symbol("aborted"), E = Symbol("signal"), w = (h$2) => Promise.resolve().then(h$2), J = commonjsGlobal._MP_NO_ITERATOR_SYMBOLS_ !== "1", K$1 = J && Symbol.asyncIterator || Symbol("asyncIterator not implemented"), W$1 = J && Symbol.iterator || Symbol("iterator not implemented"), k = (h$2) => h$2 === "end" || h$2 === "finish" || h$2 === "prefinish", tt = (h$2) => h$2 instanceof ArrayBuffer || typeof h$2 == "object" && h$2.constructor && h$2.constructor.name === "ArrayBuffer" && h$2.byteLength >= 0, et = (h$2) => !Buffer.isBuffer(h$2) && ArrayBuffer.isView(h$2);
1223
+ class z {
1224
+ constructor(t, e, s) {
1225
+ this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[b$1](), e.on("drain", this.ondrain);
1226
+ }
1227
+ unpipe() {
1228
+ this.dest.removeListener("drain", this.ondrain);
1229
+ }
1230
+ proxyErrors() {}
1231
+ end() {
1232
+ this.unpipe(), this.opts.end && this.dest.end();
1233
+ }
1234
+ }
1235
+ class st extends z {
1236
+ unpipe() {
1237
+ this.src.removeListener("error", this.proxyErrors), super.unpipe();
1238
+ }
1239
+ constructor(t, e, s) {
1240
+ super(t, e, s), this.proxyErrors = (l) => e.emit("error", l), t.on("error", this.proxyErrors);
1241
+ }
1242
+ }
1243
+ class F extends q {
1244
+ constructor(t) {
1245
+ super(), this[M$1] = false, this[S] = false, this[a] = [], this[i] = [], this[o] = t && t.objectMode || false, this[o] ? this[f] = null : this[f] = t && t.encoding || null, this[f] === "buffer" && (this[f] = null), this[p] = t && !!t.async || false, this[c$1] = this[f] ? new G(this[f]) : null, this[m] = false, this[y] = false, this[R] = false, this[B$1] = false, this[g$1] = null, this.writable = true, this.readable = true, this[n] = 0, this[r] = false, t && t.debugExposeBuffer === true && Object.defineProperty(this, "buffer", { get: () => this[i] }), t && t.debugExposePipes === true && Object.defineProperty(this, "pipes", { get: () => this[a] }), this[E] = t && t.signal, this[O] = false, this[E] && (this[E].addEventListener("abort", () => this[_]()), this[E].aborted && this[_]());
1246
+ }
1247
+ get bufferLength() {
1248
+ return this[n];
1249
+ }
1250
+ get encoding() {
1251
+ return this[f];
1252
+ }
1253
+ set encoding(t) {
1254
+ if (this[o]) throw new Error("cannot set encoding in objectMode");
1255
+ if (this[f] && t !== this[f] && (this[c$1] && this[c$1].lastNeed || this[n])) throw new Error("cannot change encoding");
1256
+ this[f] !== t && (this[c$1] = t ? new G(t) : null, this[i].length && (this[i] = this[i].map((e) => this[c$1].write(e)))), this[f] = t;
1257
+ }
1258
+ setEncoding(t) {
1259
+ this.encoding = t;
1260
+ }
1261
+ get objectMode() {
1262
+ return this[o];
1263
+ }
1264
+ set objectMode(t) {
1265
+ this[o] = this[o] || !!t;
1266
+ }
1267
+ get async() {
1268
+ return this[p];
1269
+ }
1270
+ set async(t) {
1271
+ this[p] = this[p] || !!t;
1272
+ }
1273
+ [_]() {
1274
+ this[O] = true, this.emit("abort", this[E].reason), this.destroy(this[E].reason);
1275
+ }
1276
+ get aborted() {
1277
+ return this[O];
1278
+ }
1279
+ set aborted(t) {}
1280
+ write(t, e, s) {
1281
+ if (this[O]) return false;
1282
+ if (this[m]) throw new Error("write after end");
1283
+ if (this[r]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
1284
+ typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
1285
+ const l = this[p] ? w : (u) => u();
1286
+ return !this[o] && !Buffer.isBuffer(t) && (et(t) ? t = Buffer.from(t.buffer, t.byteOffset, t.byteLength) : tt(t) ? t = Buffer.from(t) : typeof t != "string" && (this.objectMode = true)), this[o] ? (this.flowing && this[n] !== 0 && this[T](true), this.flowing ? this.emit("data", t) : this[j](t), this[n] !== 0 && this.emit("readable"), s && l(s), this.flowing) : t.length ? (typeof t == "string" && !(e === this[f] && !this[c$1].lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[f] && (t = this[c$1].write(t)), this.flowing && this[n] !== 0 && this[T](true), this.flowing ? this.emit("data", t) : this[j](t), this[n] !== 0 && this.emit("readable"), s && l(s), this.flowing) : (this[n] !== 0 && this.emit("readable"), s && l(s), this.flowing);
1287
+ }
1288
+ read(t) {
1289
+ if (this[r]) return null;
1290
+ if (this[n] === 0 || t === 0 || t > this[n]) return this[d$1](), null;
1291
+ this[o] && (t = null), this[i].length > 1 && !this[o] && (this.encoding ? this[i] = [this[i].join("")] : this[i] = [Buffer.concat(this[i], this[n])]);
1292
+ const e = this[Y](t || null, this[i][0]);
1293
+ return this[d$1](), e;
1294
+ }
1295
+ [Y](t, e) {
1296
+ return t === e.length || t === null ? this[I$1]() : (this[i][0] = e.slice(t), e = e.slice(0, t), this[n] -= t), this.emit("data", e), !this[i].length && !this[m] && this.emit("drain"), e;
1297
+ }
1298
+ end(t, e, s) {
1299
+ return typeof t == "function" && (s = t, t = null), typeof e == "function" && (s = e, e = "utf8"), t && this.write(t, e), s && this.once("end", s), this[m] = true, this.writable = false, (this.flowing || !this[S]) && this[d$1](), this;
1300
+ }
1301
+ [b$1]() {
1302
+ this[r] || (this[S] = false, this[M$1] = true, this.emit("resume"), this[i].length ? this[T]() : this[m] ? this[d$1]() : this.emit("drain"));
1303
+ }
1304
+ resume() {
1305
+ return this[b$1]();
1306
+ }
1307
+ pause() {
1308
+ this[M$1] = false, this[S] = true;
1309
+ }
1310
+ get destroyed() {
1311
+ return this[r];
1312
+ }
1313
+ get flowing() {
1314
+ return this[M$1];
1315
+ }
1316
+ get paused() {
1317
+ return this[S];
1318
+ }
1319
+ [j](t) {
1320
+ this[o] ? this[n] += 1 : this[n] += t.length, this[i].push(t);
1321
+ }
1322
+ [I$1]() {
1323
+ return this[o] ? this[n] -= 1 : this[n] -= this[i][0].length, this[i].shift();
1324
+ }
1325
+ [T](t) {
1326
+ do ;
1327
+ while (this[$](this[I$1]()) && this[i].length);
1328
+ !t && !this[i].length && !this[m] && this.emit("drain");
1329
+ }
1330
+ [$](t) {
1331
+ return this.emit("data", t), this.flowing;
1332
+ }
1333
+ pipe(t, e) {
1334
+ if (this[r]) return;
1335
+ const s = this[y];
1336
+ return e = e || {}, t === H.stdout || t === H.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[a].push(e.proxyErrors ? new st(this, t, e) : new z(this, t, e)), this[p] ? w(() => this[b$1]()) : this[b$1]()), t;
1337
+ }
1338
+ unpipe(t) {
1339
+ const e = this[a].find((s) => s.dest === t);
1340
+ e && (this[a].splice(this[a].indexOf(e), 1), e.unpipe());
1341
+ }
1342
+ addListener(t, e) {
1343
+ return this.on(t, e);
1344
+ }
1345
+ on(t, e) {
1346
+ const s = super.on(t, e);
1347
+ return t === "data" && !this[a].length && !this.flowing ? this[b$1]() : t === "readable" && this[n] !== 0 ? super.emit("readable") : k(t) && this[y] ? (super.emit(t), this.removeAllListeners(t)) : t === "error" && this[g$1] && (this[p] ? w(() => e.call(this, this[g$1])) : e.call(this, this[g$1])), s;
1348
+ }
1349
+ get emittedEnd() {
1350
+ return this[y];
1351
+ }
1352
+ [d$1]() {
1353
+ !this[R] && !this[y] && !this[r] && this[i].length === 0 && this[m] && (this[R] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[B$1] && this.emit("close"), this[R] = false);
1354
+ }
1355
+ emit(t, e, ...s) {
1356
+ if (t !== "error" && t !== "close" && t !== r && this[r]) return;
1357
+ if (t === "data") return !this[o] && !e ? false : this[p] ? w(() => this[x$1](e)) : this[x$1](e);
1358
+ if (t === "end") return this[V$1]();
1359
+ if (t === "close") {
1360
+ if (this[B$1] = true, !this[y] && !this[r]) return;
1361
+ const u = super.emit("close");
1362
+ return this.removeAllListeners("close"), u;
1363
+ } else if (t === "error") {
1364
+ this[g$1] = e, super.emit(P$2, e);
1365
+ const u = !this[E] || this.listeners("error").length ? super.emit("error", e) : false;
1366
+ return this[d$1](), u;
1367
+ } else if (t === "resume") {
1368
+ const u = super.emit("resume");
1369
+ return this[d$1](), u;
1370
+ } else if (t === "finish" || t === "prefinish") {
1371
+ const u = super.emit(t);
1372
+ return this.removeAllListeners(t), u;
1373
+ }
1374
+ const l = super.emit(t, e, ...s);
1375
+ return this[d$1](), l;
1376
+ }
1377
+ [x$1](t) {
1378
+ for (const s of this[a]) s.dest.write(t) === false && this.pause();
1379
+ const e = super.emit("data", t);
1380
+ return this[d$1](), e;
1381
+ }
1382
+ [V$1]() {
1383
+ this[y] || (this[y] = true, this.readable = false, this[p] ? w(() => this[N$1]()) : this[N$1]());
1384
+ }
1385
+ [N$1]() {
1386
+ if (this[c$1]) {
1387
+ const e = this[c$1].end();
1388
+ if (e) {
1389
+ for (const s of this[a]) s.dest.write(e);
1390
+ super.emit("data", e);
1391
+ }
1392
+ }
1393
+ for (const e of this[a]) e.end();
1394
+ const t = super.emit("end");
1395
+ return this.removeAllListeners("end"), t;
1396
+ }
1397
+ collect() {
1398
+ const t = [];
1399
+ this[o] || (t.dataLength = 0);
1400
+ const e = this.promise();
1401
+ return this.on("data", (s) => {
1402
+ t.push(s), this[o] || (t.dataLength += s.length);
1403
+ }), e.then(() => t);
1404
+ }
1405
+ concat() {
1406
+ return this[o] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this.collect().then((t) => this[o] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this[f] ? t.join("") : Buffer.concat(t, t.dataLength));
1407
+ }
1408
+ promise() {
1409
+ return new Promise((t, e) => {
1410
+ this.on(r, () => e(/* @__PURE__ */ new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
1411
+ });
1412
+ }
1413
+ [K$1]() {
1414
+ let t = false;
1415
+ const e = () => (this.pause(), t = true, Promise.resolve({ done: true }));
1416
+ return {
1417
+ next: () => {
1418
+ if (t) return e();
1419
+ const l = this.read();
1420
+ if (l !== null) return Promise.resolve({
1421
+ done: false,
1422
+ value: l
1423
+ });
1424
+ if (this[m]) return e();
1425
+ let u = null, Q = null;
1426
+ const A$1 = (L) => {
1427
+ this.removeListener("data", U$1), this.removeListener("end", C), this.removeListener(r, D$1), e(), Q(L);
1428
+ }, U$1 = (L) => {
1429
+ this.removeListener("error", A$1), this.removeListener("end", C), this.removeListener(r, D$1), this.pause(), u({
1430
+ value: L,
1431
+ done: !!this[m]
1432
+ });
1433
+ }, C = () => {
1434
+ this.removeListener("error", A$1), this.removeListener("data", U$1), this.removeListener(r, D$1), e(), u({ done: true });
1435
+ }, D$1 = () => A$1(/* @__PURE__ */ new Error("stream destroyed"));
1436
+ return new Promise((L, it) => {
1437
+ Q = it, u = L, this.once(r, D$1), this.once("error", A$1), this.once("end", C), this.once("data", U$1);
1438
+ });
1439
+ },
1440
+ throw: e,
1441
+ return: e,
1442
+ [K$1]() {
1443
+ return this;
1444
+ }
1445
+ };
1446
+ }
1447
+ [W$1]() {
1448
+ let t = false;
1449
+ const e = () => (this.pause(), this.removeListener(P$2, e), this.removeListener(r, e), this.removeListener("end", e), t = true, { done: true }), s = () => {
1450
+ if (t) return e();
1451
+ const l = this.read();
1452
+ return l === null ? e() : { value: l };
1453
+ };
1454
+ return this.once("end", e), this.once(P$2, e), this.once(r, e), {
1455
+ next: s,
1456
+ throw: e,
1457
+ return: e,
1458
+ [W$1]() {
1459
+ return this;
1460
+ }
1461
+ };
1462
+ }
1463
+ destroy(t) {
1464
+ return this[r] ? (t ? this.emit("error", t) : this.emit(r), this) : (this[r] = true, this[i].length = 0, this[n] = 0, typeof this.close == "function" && !this[B$1] && this.close(), t ? this.emit("error", t) : this.emit(r), this);
1465
+ }
1466
+ static isStream(t) {
1467
+ return !!t && (t instanceof F || t instanceof q || t instanceof Z && (typeof t.pipe == "function" || typeof t.write == "function" && typeof t.end == "function"));
1468
+ }
1469
+ }
1470
+ return s$5.Minipass = F, s$5;
1471
+ }
1472
+ var e$2, o$4;
1473
+ function a$7() {
1474
+ return o$4 || (o$4 = 1, e$2 = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) !== "win32" ? (r) => r : (r) => r && r.replace(/\\/g, "/")), e$2;
1475
+ }
1476
+ var n$2, a$6;
1477
+ function u$3() {
1478
+ if (a$6) return n$2;
1479
+ a$6 = 1;
1480
+ const { Minipass: o } = ft(), s = a$7(), r = Symbol("slurp");
1481
+ return n$2 = class extends o {
1482
+ constructor(t, e, i) {
1483
+ switch (super(), this.pause(), this.extended = e, this.globalExtended = i, this.header = t, this.startBlockSize = 512 * Math.ceil(t.size / 512), this.blockRemain = this.startBlockSize, this.remain = t.size, this.type = t.type, this.meta = false, this.ignore = false, this.type) {
1484
+ case "File":
1485
+ case "OldFile":
1486
+ case "Link":
1487
+ case "SymbolicLink":
1488
+ case "CharacterDevice":
1489
+ case "BlockDevice":
1490
+ case "Directory":
1491
+ case "FIFO":
1492
+ case "ContiguousFile":
1493
+ case "GNUDumpDir": break;
1494
+ case "NextFileHasLongLinkpath":
1495
+ case "NextFileHasLongPath":
1496
+ case "OldGnuLongPath":
1497
+ case "GlobalExtendedHeader":
1498
+ case "ExtendedHeader":
1499
+ case "OldExtendedHeader":
1500
+ this.meta = true;
1501
+ break;
1502
+ default: this.ignore = true;
1503
+ }
1504
+ this.path = s(t.path), this.mode = t.mode, this.mode && (this.mode = this.mode & 4095), this.uid = t.uid, this.gid = t.gid, this.uname = t.uname, this.gname = t.gname, this.size = t.size, this.mtime = t.mtime, this.atime = t.atime, this.ctime = t.ctime, this.linkpath = s(t.linkpath), this.uname = t.uname, this.gname = t.gname, e && this[r](e), i && this[r](i, true);
1505
+ }
1506
+ write(t) {
1507
+ const e = t.length;
1508
+ if (e > this.blockRemain) throw new Error("writing more to entry than is appropriate");
1509
+ const i = this.remain, c$1 = this.blockRemain;
1510
+ return this.remain = Math.max(0, i - e), this.blockRemain = Math.max(0, c$1 - e), this.ignore ? true : i >= e ? super.write(t) : super.write(t.slice(0, i));
1511
+ }
1512
+ [r](t, e) {
1513
+ for (const i in t) t[i] !== null && t[i] !== void 0 && !(e && i === "path") && (this[i] = i === "path" || i === "linkpath" ? s(t[i]) : t[i]);
1514
+ }
1515
+ }, n$2;
1516
+ }
1517
+ var r$2, a$5;
1518
+ function f$2() {
1519
+ if (a$5) return r$2;
1520
+ a$5 = 1;
1521
+ const c$1 = E(), d$1 = path;
1522
+ class h$2 {
1523
+ constructor(e, n) {
1524
+ this.atime = e.atime || null, this.charset = e.charset || null, this.comment = e.comment || null, this.ctime = e.ctime || null, this.gid = e.gid || null, this.gname = e.gname || null, this.linkpath = e.linkpath || null, this.mtime = e.mtime || null, this.path = e.path || null, this.size = e.size || null, this.uid = e.uid || null, this.uname = e.uname || null, this.dev = e.dev || null, this.ino = e.ino || null, this.nlink = e.nlink || null, this.global = n || false;
1525
+ }
1526
+ encode() {
1527
+ const e = this.encodeBody();
1528
+ if (e === "") return null;
1529
+ const n = Buffer.byteLength(e), l = 512 * Math.ceil(1 + n / 512), i = Buffer.allocUnsafe(l);
1530
+ for (let t = 0; t < 512; t++) i[t] = 0;
1531
+ new c$1({
1532
+ path: ("PaxHeader/" + d$1.basename(this.path)).slice(0, 99),
1533
+ mode: this.mode || 420,
1534
+ uid: this.uid || null,
1535
+ gid: this.gid || null,
1536
+ size: n,
1537
+ mtime: this.mtime || null,
1538
+ type: this.global ? "GlobalExtendedHeader" : "ExtendedHeader",
1539
+ linkpath: "",
1540
+ uname: this.uname || "",
1541
+ gname: this.gname || "",
1542
+ devmaj: 0,
1543
+ devmin: 0,
1544
+ atime: this.atime || null,
1545
+ ctime: this.ctime || null
1546
+ }).encode(i), i.write(e, 512, n, "utf8");
1547
+ for (let t = n + 512; t < i.length; t++) i[t] = 0;
1548
+ return i;
1549
+ }
1550
+ encodeBody() {
1551
+ 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");
1552
+ }
1553
+ encodeField(e) {
1554
+ if (this[e] === null || this[e] === void 0) return "";
1555
+ const n = this[e] instanceof Date ? this[e].getTime() / 1e3 : this[e], l = " " + (e === "dev" || e === "ino" || e === "nlink" ? "SCHILY." : "") + e + "=" + n + `
1556
+ `, i = Buffer.byteLength(l);
1557
+ let t = Math.floor(Math.log(i) / Math.log(10)) + 1;
1558
+ return i + t >= Math.pow(10, t) && (t += 1), t + i + l;
1559
+ }
1560
+ }
1561
+ h$2.parse = (s, e, n) => new h$2(o(u(s), e), n);
1562
+ const o = (s, e) => e ? Object.keys(s).reduce((n, l) => (n[l] = s[l], n), e) : s, u = (s) => s.replace(/\n$/, "").split(`
1563
+ `).reduce(m, Object.create(null)), m = (s, e) => {
1564
+ const n = parseInt(e, 10);
1565
+ if (n !== Buffer.byteLength(e) + 1) return s;
1566
+ e = e.slice((n + " ").length);
1567
+ const l = e.split("="), i = l.shift().replace(/^SCHILY\.(dev|ino|nlink)/, "$1");
1568
+ if (!i) return s;
1569
+ const t = l.join("=");
1570
+ return s[i] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(i) ? /* @__PURE__ */ new Date(t * 1e3) : /^[0-9]+$/.test(t) ? +t : t, s;
1571
+ };
1572
+ return r$2 = h$2, r$2;
1573
+ }
1574
+ var i$3 = {};
1575
+ var _, R$1;
1576
+ function T() {
1577
+ if (R$1) return _;
1578
+ R$1 = 1;
1579
+ const E = O$2.constants || { ZLIB_VERNUM: 4736 };
1580
+ return _ = Object.freeze(Object.assign(Object.create(null), {
1581
+ Z_NO_FLUSH: 0,
1582
+ Z_PARTIAL_FLUSH: 1,
1583
+ Z_SYNC_FLUSH: 2,
1584
+ Z_FULL_FLUSH: 3,
1585
+ Z_FINISH: 4,
1586
+ Z_BLOCK: 5,
1587
+ Z_OK: 0,
1588
+ Z_STREAM_END: 1,
1589
+ Z_NEED_DICT: 2,
1590
+ Z_ERRNO: -1,
1591
+ Z_STREAM_ERROR: -2,
1592
+ Z_DATA_ERROR: -3,
1593
+ Z_MEM_ERROR: -4,
1594
+ Z_BUF_ERROR: -5,
1595
+ Z_VERSION_ERROR: -6,
1596
+ Z_NO_COMPRESSION: 0,
1597
+ Z_BEST_SPEED: 1,
1598
+ Z_BEST_COMPRESSION: 9,
1599
+ Z_DEFAULT_COMPRESSION: -1,
1600
+ Z_FILTERED: 1,
1601
+ Z_HUFFMAN_ONLY: 2,
1602
+ Z_RLE: 3,
1603
+ Z_FIXED: 4,
1604
+ Z_DEFAULT_STRATEGY: 0,
1605
+ DEFLATE: 1,
1606
+ INFLATE: 2,
1607
+ GZIP: 3,
1608
+ GUNZIP: 4,
1609
+ DEFLATERAW: 5,
1610
+ INFLATERAW: 6,
1611
+ UNZIP: 7,
1612
+ BROTLI_DECODE: 8,
1613
+ BROTLI_ENCODE: 9,
1614
+ Z_MIN_WINDOWBITS: 8,
1615
+ Z_MAX_WINDOWBITS: 15,
1616
+ Z_DEFAULT_WINDOWBITS: 15,
1617
+ Z_MIN_CHUNK: 64,
1618
+ Z_MAX_CHUNK: Infinity,
1619
+ Z_DEFAULT_CHUNK: 16384,
1620
+ Z_MIN_MEMLEVEL: 1,
1621
+ Z_MAX_MEMLEVEL: 9,
1622
+ Z_DEFAULT_MEMLEVEL: 8,
1623
+ Z_MIN_LEVEL: -1,
1624
+ Z_MAX_LEVEL: 9,
1625
+ Z_DEFAULT_LEVEL: -1,
1626
+ BROTLI_OPERATION_PROCESS: 0,
1627
+ BROTLI_OPERATION_FLUSH: 1,
1628
+ BROTLI_OPERATION_FINISH: 2,
1629
+ BROTLI_OPERATION_EMIT_METADATA: 3,
1630
+ BROTLI_MODE_GENERIC: 0,
1631
+ BROTLI_MODE_TEXT: 1,
1632
+ BROTLI_MODE_FONT: 2,
1633
+ BROTLI_DEFAULT_MODE: 0,
1634
+ BROTLI_MIN_QUALITY: 0,
1635
+ BROTLI_MAX_QUALITY: 11,
1636
+ BROTLI_DEFAULT_QUALITY: 11,
1637
+ BROTLI_MIN_WINDOW_BITS: 10,
1638
+ BROTLI_MAX_WINDOW_BITS: 24,
1639
+ BROTLI_LARGE_MAX_WINDOW_BITS: 30,
1640
+ BROTLI_DEFAULT_WINDOW: 22,
1641
+ BROTLI_MIN_INPUT_BLOCK_BITS: 16,
1642
+ BROTLI_MAX_INPUT_BLOCK_BITS: 24,
1643
+ BROTLI_PARAM_MODE: 0,
1644
+ BROTLI_PARAM_QUALITY: 1,
1645
+ BROTLI_PARAM_LGWIN: 2,
1646
+ BROTLI_PARAM_LGBLOCK: 3,
1647
+ BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
1648
+ BROTLI_PARAM_SIZE_HINT: 5,
1649
+ BROTLI_PARAM_LARGE_WINDOW: 6,
1650
+ BROTLI_PARAM_NPOSTFIX: 7,
1651
+ BROTLI_PARAM_NDIRECT: 8,
1652
+ BROTLI_DECODER_RESULT_ERROR: 0,
1653
+ BROTLI_DECODER_RESULT_SUCCESS: 1,
1654
+ BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
1655
+ BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
1656
+ BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
1657
+ BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
1658
+ BROTLI_DECODER_NO_ERROR: 0,
1659
+ BROTLI_DECODER_SUCCESS: 1,
1660
+ BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
1661
+ BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
1662
+ BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
1663
+ BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
1664
+ BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
1665
+ BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
1666
+ BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
1667
+ BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
1668
+ BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
1669
+ BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
1670
+ BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
1671
+ BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
1672
+ BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
1673
+ BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
1674
+ BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
1675
+ BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
1676
+ BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
1677
+ BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
1678
+ BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
1679
+ BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
1680
+ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
1681
+ BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
1682
+ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
1683
+ BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
1684
+ BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
1685
+ BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
1686
+ BROTLI_DECODER_ERROR_UNREACHABLE: -31
1687
+ }, E)), _;
1688
+ }
1689
+ var j, H$1;
1690
+ function tt() {
1691
+ if (H$1) return j;
1692
+ H$1 = 1;
1693
+ const I$1 = typeof process == "object" && process ? process : {
1694
+ stdout: null,
1695
+ stderr: null
1696
+ }, Y = nt, x$1 = ot, N$1 = ht.StringDecoder, u = Symbol("EOF"), a = Symbol("maybeEmitEnd"), c$1 = Symbol("emittedEnd"), S = Symbol("emittingEnd"), E = Symbol("emittedError"), w = Symbol("closed"), P$2 = Symbol("read"), L = Symbol("flush"), _ = Symbol("flushChunk"), h$2 = Symbol("encoding"), m = Symbol("decoder"), M$1 = Symbol("flowing"), y = Symbol("paused"), p = Symbol("resume"), s = Symbol("bufferLength"), T = Symbol("bufferPush"), B$1 = Symbol("bufferShift"), r = Symbol("objectMode"), n = Symbol("destroyed"), D$1 = Symbol("emitData"), F = Symbol("emitEnd"), R = Symbol("emitEnd2"), d$1 = Symbol("async"), b$1 = (o) => Promise.resolve().then(o), C = commonjsGlobal._MP_NO_ITERATOR_SYMBOLS_ !== "1", $ = C && Symbol.asyncIterator || Symbol("asyncIterator not implemented"), G = C && Symbol.iterator || Symbol("iterator not implemented"), V$1 = (o) => o === "end" || o === "finish" || o === "prefinish", v = (o) => o instanceof ArrayBuffer || typeof o == "object" && o.constructor && o.constructor.name === "ArrayBuffer" && o.byteLength >= 0, J = (o) => !Buffer.isBuffer(o) && ArrayBuffer.isView(o);
1697
+ class U$1 {
1698
+ constructor(t, e, i) {
1699
+ this.src = t, this.dest = e, this.opts = i, this.ondrain = () => t[p](), e.on("drain", this.ondrain);
1700
+ }
1701
+ unpipe() {
1702
+ this.dest.removeListener("drain", this.ondrain);
1703
+ }
1704
+ proxyErrors() {}
1705
+ end() {
1706
+ this.unpipe(), this.opts.end && this.dest.end();
1707
+ }
1708
+ }
1709
+ class K$1 extends U$1 {
1710
+ unpipe() {
1711
+ this.src.removeListener("error", this.proxyErrors), super.unpipe();
1712
+ }
1713
+ constructor(t, e, i) {
1714
+ super(t, e, i), this.proxyErrors = (l) => e.emit("error", l), t.on("error", this.proxyErrors);
1715
+ }
1716
+ }
1717
+ return j = class q extends x$1 {
1718
+ constructor(t) {
1719
+ super(), this[M$1] = false, this[y] = false, this.pipes = [], this.buffer = [], this[r] = t && t.objectMode || false, this[r] ? this[h$2] = null : this[h$2] = t && t.encoding || null, this[h$2] === "buffer" && (this[h$2] = null), this[d$1] = t && !!t.async || false, this[m] = this[h$2] ? new N$1(this[h$2]) : null, this[u] = false, this[c$1] = false, this[S] = false, this[w] = false, this[E] = null, this.writable = true, this.readable = true, this[s] = 0, this[n] = false;
1720
+ }
1721
+ get bufferLength() {
1722
+ return this[s];
1723
+ }
1724
+ get encoding() {
1725
+ return this[h$2];
1726
+ }
1727
+ set encoding(t) {
1728
+ if (this[r]) throw new Error("cannot set encoding in objectMode");
1729
+ if (this[h$2] && t !== this[h$2] && (this[m] && this[m].lastNeed || this[s])) throw new Error("cannot change encoding");
1730
+ this[h$2] !== t && (this[m] = t ? new N$1(t) : null, this.buffer.length && (this.buffer = this.buffer.map((e) => this[m].write(e)))), this[h$2] = t;
1731
+ }
1732
+ setEncoding(t) {
1733
+ this.encoding = t;
1734
+ }
1735
+ get objectMode() {
1736
+ return this[r];
1737
+ }
1738
+ set objectMode(t) {
1739
+ this[r] = this[r] || !!t;
1740
+ }
1741
+ get async() {
1742
+ return this[d$1];
1743
+ }
1744
+ set async(t) {
1745
+ this[d$1] = this[d$1] || !!t;
1746
+ }
1747
+ write(t, e, i) {
1748
+ if (this[u]) throw new Error("write after end");
1749
+ if (this[n]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
1750
+ typeof e == "function" && (i = e, e = "utf8"), e || (e = "utf8");
1751
+ const l = this[d$1] ? b$1 : (f) => f();
1752
+ return !this[r] && !Buffer.isBuffer(t) && (J(t) ? t = Buffer.from(t.buffer, t.byteOffset, t.byteLength) : v(t) ? t = Buffer.from(t) : typeof t != "string" && (this.objectMode = true)), this[r] ? (this.flowing && this[s] !== 0 && this[L](true), this.flowing ? this.emit("data", t) : this[T](t), this[s] !== 0 && this.emit("readable"), i && l(i), this.flowing) : t.length ? (typeof t == "string" && !(e === this[h$2] && !this[m].lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[h$2] && (t = this[m].write(t)), this.flowing && this[s] !== 0 && this[L](true), this.flowing ? this.emit("data", t) : this[T](t), this[s] !== 0 && this.emit("readable"), i && l(i), this.flowing) : (this[s] !== 0 && this.emit("readable"), i && l(i), this.flowing);
1753
+ }
1754
+ read(t) {
1755
+ if (this[n]) return null;
1756
+ if (this[s] === 0 || t === 0 || t > this[s]) return this[a](), null;
1757
+ this[r] && (t = null), this.buffer.length > 1 && !this[r] && (this.encoding ? this.buffer = [this.buffer.join("")] : this.buffer = [Buffer.concat(this.buffer, this[s])]);
1758
+ const e = this[P$2](t || null, this.buffer[0]);
1759
+ return this[a](), e;
1760
+ }
1761
+ [P$2](t, e) {
1762
+ return t === e.length || t === null ? this[B$1]() : (this.buffer[0] = e.slice(t), e = e.slice(0, t), this[s] -= t), this.emit("data", e), !this.buffer.length && !this[u] && this.emit("drain"), e;
1763
+ }
1764
+ end(t, e, i) {
1765
+ return typeof t == "function" && (i = t, t = null), typeof e == "function" && (i = e, e = "utf8"), t && this.write(t, e), i && this.once("end", i), this[u] = true, this.writable = false, (this.flowing || !this[y]) && this[a](), this;
1766
+ }
1767
+ [p]() {
1768
+ this[n] || (this[y] = false, this[M$1] = true, this.emit("resume"), this.buffer.length ? this[L]() : this[u] ? this[a]() : this.emit("drain"));
1769
+ }
1770
+ resume() {
1771
+ return this[p]();
1772
+ }
1773
+ pause() {
1774
+ this[M$1] = false, this[y] = true;
1775
+ }
1776
+ get destroyed() {
1777
+ return this[n];
1778
+ }
1779
+ get flowing() {
1780
+ return this[M$1];
1781
+ }
1782
+ get paused() {
1783
+ return this[y];
1784
+ }
1785
+ [T](t) {
1786
+ this[r] ? this[s] += 1 : this[s] += t.length, this.buffer.push(t);
1787
+ }
1788
+ [B$1]() {
1789
+ return this.buffer.length && (this[r] ? this[s] -= 1 : this[s] -= this.buffer[0].length), this.buffer.shift();
1790
+ }
1791
+ [L](t) {
1792
+ do ;
1793
+ while (this[_](this[B$1]()));
1794
+ !t && !this.buffer.length && !this[u] && this.emit("drain");
1795
+ }
1796
+ [_](t) {
1797
+ return t ? (this.emit("data", t), this.flowing) : false;
1798
+ }
1799
+ pipe(t, e) {
1800
+ if (this[n]) return;
1801
+ const i = this[c$1];
1802
+ return e = e || {}, t === I$1.stdout || t === I$1.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, i ? e.end && t.end() : (this.pipes.push(e.proxyErrors ? new K$1(this, t, e) : new U$1(this, t, e)), this[d$1] ? b$1(() => this[p]()) : this[p]()), t;
1803
+ }
1804
+ unpipe(t) {
1805
+ const e = this.pipes.find((i) => i.dest === t);
1806
+ e && (this.pipes.splice(this.pipes.indexOf(e), 1), e.unpipe());
1807
+ }
1808
+ addListener(t, e) {
1809
+ return this.on(t, e);
1810
+ }
1811
+ on(t, e) {
1812
+ const i = super.on(t, e);
1813
+ return t === "data" && !this.pipes.length && !this.flowing ? this[p]() : t === "readable" && this[s] !== 0 ? super.emit("readable") : V$1(t) && this[c$1] ? (super.emit(t), this.removeAllListeners(t)) : t === "error" && this[E] && (this[d$1] ? b$1(() => e.call(this, this[E])) : e.call(this, this[E])), i;
1814
+ }
1815
+ get emittedEnd() {
1816
+ return this[c$1];
1817
+ }
1818
+ [a]() {
1819
+ !this[S] && !this[c$1] && !this[n] && this.buffer.length === 0 && this[u] && (this[S] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[w] && this.emit("close"), this[S] = false);
1820
+ }
1821
+ emit(t, e, ...i) {
1822
+ if (t !== "error" && t !== "close" && t !== n && this[n]) return;
1823
+ if (t === "data") return e ? this[d$1] ? b$1(() => this[D$1](e)) : this[D$1](e) : false;
1824
+ if (t === "end") return this[F]();
1825
+ if (t === "close") {
1826
+ if (this[w] = true, !this[c$1] && !this[n]) return;
1827
+ const f = super.emit("close");
1828
+ return this.removeAllListeners("close"), f;
1829
+ } else if (t === "error") {
1830
+ this[E] = e;
1831
+ const f = super.emit("error", e);
1832
+ return this[a](), f;
1833
+ } else if (t === "resume") {
1834
+ const f = super.emit("resume");
1835
+ return this[a](), f;
1836
+ } else if (t === "finish" || t === "prefinish") {
1837
+ const f = super.emit(t);
1838
+ return this.removeAllListeners(t), f;
1839
+ }
1840
+ const l = super.emit(t, e, ...i);
1841
+ return this[a](), l;
1842
+ }
1843
+ [D$1](t) {
1844
+ for (const i of this.pipes) i.dest.write(t) === false && this.pause();
1845
+ const e = super.emit("data", t);
1846
+ return this[a](), e;
1847
+ }
1848
+ [F]() {
1849
+ this[c$1] || (this[c$1] = true, this.readable = false, this[d$1] ? b$1(() => this[R]()) : this[R]());
1850
+ }
1851
+ [R]() {
1852
+ if (this[m]) {
1853
+ const e = this[m].end();
1854
+ if (e) {
1855
+ for (const i of this.pipes) i.dest.write(e);
1856
+ super.emit("data", e);
1857
+ }
1858
+ }
1859
+ for (const e of this.pipes) e.end();
1860
+ const t = super.emit("end");
1861
+ return this.removeAllListeners("end"), t;
1862
+ }
1863
+ collect() {
1864
+ const t = [];
1865
+ this[r] || (t.dataLength = 0);
1866
+ const e = this.promise();
1867
+ return this.on("data", (i) => {
1868
+ t.push(i), this[r] || (t.dataLength += i.length);
1869
+ }), e.then(() => t);
1870
+ }
1871
+ concat() {
1872
+ return this[r] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this.collect().then((t) => this[r] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this[h$2] ? t.join("") : Buffer.concat(t, t.dataLength));
1873
+ }
1874
+ promise() {
1875
+ return new Promise((t, e) => {
1876
+ this.on(n, () => e(/* @__PURE__ */ new Error("stream destroyed"))), this.on("error", (i) => e(i)), this.on("end", () => t());
1877
+ });
1878
+ }
1879
+ [$]() {
1880
+ return { next: () => {
1881
+ const e = this.read();
1882
+ if (e !== null) return Promise.resolve({
1883
+ done: false,
1884
+ value: e
1885
+ });
1886
+ if (this[u]) return Promise.resolve({ done: true });
1887
+ let i = null, l = null;
1888
+ const f = (g$1) => {
1889
+ this.removeListener("data", A$1), this.removeListener("end", O), l(g$1);
1890
+ }, A$1 = (g$1) => {
1891
+ this.removeListener("error", f), this.removeListener("end", O), this.pause(), i({
1892
+ value: g$1,
1893
+ done: !!this[u]
1894
+ });
1895
+ }, O = () => {
1896
+ this.removeListener("error", f), this.removeListener("data", A$1), i({ done: true });
1897
+ }, W$1 = () => f(/* @__PURE__ */ new Error("stream destroyed"));
1898
+ return new Promise((g$1, z) => {
1899
+ l = z, i = g$1, this.once(n, W$1), this.once("error", f), this.once("end", O), this.once("data", A$1);
1900
+ });
1901
+ } };
1902
+ }
1903
+ [G]() {
1904
+ return { next: () => {
1905
+ const e = this.read();
1906
+ return {
1907
+ value: e,
1908
+ done: e === null
1909
+ };
1910
+ } };
1911
+ }
1912
+ destroy(t) {
1913
+ return this[n] ? (t ? this.emit("error", t) : this.emit(n), this) : (this[n] = true, this.buffer.length = 0, this[s] = 0, typeof this.close == "function" && !this[w] && this.close(), t ? this.emit("error", t) : this.emit(n), this);
1914
+ }
1915
+ static isStream(t) {
1916
+ return !!t && (t instanceof q || t instanceof x$1 || t instanceof Y && (typeof t.pipe == "function" || typeof t.write == "function" && typeof t.end == "function"));
1917
+ }
1918
+ }, j;
1919
+ }
1920
+ var C;
1921
+ function J() {
1922
+ if (C) return i$3;
1923
+ C = 1;
1924
+ const w = j$1, n = P.Buffer, z = O$2, u = i$3.constants = T(), L = tt(), E = n.concat, c$1 = Symbol("_superWrite");
1925
+ class d$1 extends Error {
1926
+ constructor(s) {
1927
+ super("zlib: " + s.message), this.code = s.code, this.errno = s.errno, this.code || (this.code = "ZLIB_ERROR"), this.message = "zlib: " + s.message, Error.captureStackTrace(this, this.constructor);
1928
+ }
1929
+ get name() {
1930
+ return "ZlibError";
1931
+ }
1932
+ }
1933
+ const Z = Symbol("opts"), p = Symbol("flushFlag"), I$1 = Symbol("finishFlushFlag"), y = Symbol("fullFlushFlag"), t = Symbol("handle"), _ = Symbol("onError"), f = Symbol("sawError"), F = Symbol("level"), S = Symbol("strategy"), g$1 = Symbol("ended");
1934
+ class x$1 extends L {
1935
+ constructor(s, e) {
1936
+ if (!s || typeof s != "object") throw new TypeError("invalid options for ZlibBase constructor");
1937
+ super(s), this[f] = false, this[g$1] = false, this[Z] = s, this[p] = s.flush, this[I$1] = s.finishFlush;
1938
+ try {
1939
+ this[t] = new z[e](s);
1940
+ } catch (i) {
1941
+ throw new d$1(i);
1942
+ }
1943
+ this[_] = (i) => {
1944
+ this[f] || (this[f] = true, this.close(), this.emit("error", i));
1945
+ }, this[t].on("error", (i) => this[_](new d$1(i))), this.once("end", () => this.close);
1946
+ }
1947
+ close() {
1948
+ this[t] && (this[t].close(), this[t] = null, this.emit("close"));
1949
+ }
1950
+ reset() {
1951
+ if (!this[f]) return w(this[t], "zlib binding closed"), this[t].reset();
1952
+ }
1953
+ flush(s) {
1954
+ this.ended || (typeof s != "number" && (s = this[y]), this.write(Object.assign(n.alloc(0), { [p]: s })));
1955
+ }
1956
+ end(s, e, i) {
1957
+ return s && this.write(s, e), this.flush(this[I$1]), this[g$1] = true, super.end(null, null, i);
1958
+ }
1959
+ get ended() {
1960
+ return this[g$1];
1961
+ }
1962
+ write(s, e, i) {
1963
+ if (typeof e == "function" && (i = e, e = "utf8"), typeof s == "string" && (s = n.from(s, e)), this[f]) return;
1964
+ w(this[t], "zlib binding closed");
1965
+ const m = this[t]._handle, R = m.close;
1966
+ m.close = () => {};
1967
+ const G = this[t].close;
1968
+ this[t].close = () => {}, n.concat = (l) => l;
1969
+ let h$2;
1970
+ try {
1971
+ const l = typeof s[p] == "number" ? s[p] : this[p];
1972
+ h$2 = this[t]._processChunk(s, l), n.concat = E;
1973
+ } catch (l) {
1974
+ n.concat = E, this[_](new d$1(l));
1975
+ } finally {
1976
+ this[t] && (this[t]._handle = m, m.close = R, this[t].close = G, this[t].removeAllListeners("error"));
1977
+ }
1978
+ this[t] && this[t].on("error", (l) => this[_](new d$1(l)));
1979
+ let b$1;
1980
+ if (h$2) if (Array.isArray(h$2) && h$2.length > 0) {
1981
+ b$1 = this[c$1](n.from(h$2[0]));
1982
+ for (let l = 1; l < h$2.length; l++) b$1 = this[c$1](h$2[l]);
1983
+ } else b$1 = this[c$1](n.from(h$2));
1984
+ return i && i(), b$1;
1985
+ }
1986
+ [c$1](s) {
1987
+ return super.write(s);
1988
+ }
1989
+ }
1990
+ class a extends x$1 {
1991
+ constructor(s, e) {
1992
+ s = s || {}, s.flush = s.flush || u.Z_NO_FLUSH, s.finishFlush = s.finishFlush || u.Z_FINISH, super(s, e), this[y] = u.Z_FULL_FLUSH, this[F] = s.level, this[S] = s.strategy;
1993
+ }
1994
+ params(s, e) {
1995
+ if (!this[f]) {
1996
+ if (!this[t]) throw new Error("cannot switch params when binding is closed");
1997
+ if (!this[t].params) throw new Error("not supported in this implementation");
1998
+ if (this[F] !== s || this[S] !== e) {
1999
+ this.flush(u.Z_SYNC_FLUSH), w(this[t], "zlib binding closed");
2000
+ const i = this[t].flush;
2001
+ this[t].flush = (m, R) => {
2002
+ this.flush(m), R();
2003
+ };
2004
+ try {
2005
+ this[t].params(s, e);
2006
+ } finally {
2007
+ this[t].flush = i;
2008
+ }
2009
+ this[t] && (this[F] = s, this[S] = e);
2010
+ }
2011
+ }
2012
+ }
2013
+ }
2014
+ class q extends a {
2015
+ constructor(s) {
2016
+ super(s, "Deflate");
2017
+ }
2018
+ }
2019
+ class D$1 extends a {
2020
+ constructor(s) {
2021
+ super(s, "Inflate");
2022
+ }
2023
+ }
2024
+ const B$1 = Symbol("_portable");
2025
+ class $ extends a {
2026
+ constructor(s) {
2027
+ super(s, "Gzip"), this[B$1] = s && !!s.portable;
2028
+ }
2029
+ [c$1](s) {
2030
+ return this[B$1] ? (this[B$1] = false, s[9] = 255, super[c$1](s)) : super[c$1](s);
2031
+ }
2032
+ }
2033
+ class N$1 extends a {
2034
+ constructor(s) {
2035
+ super(s, "Gunzip");
2036
+ }
2037
+ }
2038
+ class H extends a {
2039
+ constructor(s) {
2040
+ super(s, "DeflateRaw");
2041
+ }
2042
+ }
2043
+ let T$1$1 = class T extends a {
2044
+ constructor(s) {
2045
+ super(s, "InflateRaw");
2046
+ }
2047
+ };
2048
+ class U$1 extends a {
2049
+ constructor(s) {
2050
+ super(s, "Unzip");
2051
+ }
2052
+ }
2053
+ class O extends x$1 {
2054
+ constructor(s, e) {
2055
+ s = s || {}, s.flush = s.flush || u.BROTLI_OPERATION_PROCESS, s.finishFlush = s.finishFlush || u.BROTLI_OPERATION_FINISH, super(s, e), this[y] = u.BROTLI_OPERATION_FLUSH;
2056
+ }
2057
+ }
2058
+ class v extends O {
2059
+ constructor(s) {
2060
+ super(s, "BrotliCompress");
2061
+ }
2062
+ }
2063
+ class A$1 extends O {
2064
+ constructor(s) {
2065
+ super(s, "BrotliDecompress");
2066
+ }
2067
+ }
2068
+ return i$3.Deflate = q, i$3.Inflate = D$1, i$3.Gzip = $, i$3.Gunzip = N$1, i$3.DeflateRaw = H, i$3.InflateRaw = T$1$1, i$3.Unzip = U$1, typeof z.BrotliCompress == "function" ? (i$3.BrotliCompress = v, i$3.BrotliDecompress = A$1) : i$3.BrotliCompress = i$3.BrotliDecompress = class {
2069
+ constructor() {
2070
+ throw new Error("Brotli is not supported in this version of Node.js");
2071
+ }
2072
+ }, i$3;
2073
+ }
2074
+ var O$1, F$2;
2075
+ function rt() {
2076
+ if (F$2) return O$1;
2077
+ F$2 = 1;
2078
+ const P$2 = c$4(), $ = E(), v = nt, W$1 = c$3(), G = 1024 * 1024, k = u$3(), C = f$2(), x$1 = J(), { nextTick: j } = nt$1, B$1 = Buffer.from([31, 139]), h$2 = Symbol("state"), d$1 = Symbol("writeEntry"), a = Symbol("readEntry"), I$1 = Symbol("nextEntry"), U$1 = Symbol("processEntry"), l = Symbol("extendedHeader"), y = Symbol("globalExtendedHeader"), c$1 = Symbol("meta"), H = Symbol("emitMeta"), n = Symbol("buffer"), f = Symbol("queue"), u = Symbol("ended"), L = Symbol("emittedEnd"), b$1 = Symbol("emit"), r = Symbol("unzip"), _ = Symbol("consumeChunk"), g$1 = Symbol("consumeChunkSub"), q = Symbol("consumeBody"), z = Symbol("consumeMeta"), Y = Symbol("consumeHeader"), N$1 = Symbol("consuming"), D$1 = Symbol("bufferConcat"), M$1 = Symbol("maybeEnd"), S = Symbol("writing"), m = Symbol("aborted"), T = Symbol("onDone"), E$1$1 = Symbol("sawValidEntry"), R = Symbol("sawNullBlock"), A$1 = Symbol("sawEOF"), V$1 = Symbol("closeStream"), K$1 = (X) => true;
2079
+ return O$1 = P$2(class extends v {
2080
+ constructor(t) {
2081
+ t = t || {}, super(t), this.file = t.file || "", this[E$1$1] = null, this.on(T, (s) => {
2082
+ (this[h$2] === "begin" || this[E$1$1] === false) && this.warn("TAR_BAD_ARCHIVE", "Unrecognized archive format");
2083
+ }), t.ondone ? this.on(T, t.ondone) : this.on(T, (s) => {
2084
+ this.emit("prefinish"), this.emit("finish"), this.emit("end");
2085
+ }), this.strict = !!t.strict, this.maxMetaEntrySize = t.maxMetaEntrySize || G, this.filter = typeof t.filter == "function" ? t.filter : K$1;
2086
+ const i = t.file && (t.file.endsWith(".tar.br") || t.file.endsWith(".tbr"));
2087
+ this.brotli = !t.gzip && t.brotli !== void 0 ? t.brotli : i ? void 0 : false, this.writable = true, this.readable = false, this[f] = new W$1(), this[n] = null, this[a] = null, this[d$1] = null, this[h$2] = "begin", this[c$1] = "", this[l] = null, this[y] = null, this[u] = false, this[r] = null, this[m] = false, this[R] = false, this[A$1] = false, this.on("end", () => this[V$1]()), typeof t.onwarn == "function" && this.on("warn", t.onwarn), typeof t.onentry == "function" && this.on("entry", t.onentry);
2088
+ }
2089
+ [Y](t, i) {
2090
+ this[E$1$1] === null && (this[E$1$1] = false);
2091
+ let s;
2092
+ try {
2093
+ s = new $(t, i, this[l], this[y]);
2094
+ } catch (o) {
2095
+ return this.warn("TAR_ENTRY_INVALID", o);
2096
+ }
2097
+ if (s.nullBlock) this[R] ? (this[A$1] = true, this[h$2] === "begin" && (this[h$2] = "header"), this[b$1]("eof")) : (this[R] = true, this[b$1]("nullBlock"));
2098
+ else if (this[R] = false, !s.cksumValid) this.warn("TAR_ENTRY_INVALID", "checksum failure", { header: s });
2099
+ else if (!s.path) this.warn("TAR_ENTRY_INVALID", "path is required", { header: s });
2100
+ else {
2101
+ const o = s.type;
2102
+ if (/^(Symbolic)?Link$/.test(o) && !s.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath required", { header: s });
2103
+ else if (!/^(Symbolic)?Link$/.test(o) && s.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath forbidden", { header: s });
2104
+ else {
2105
+ const e = this[d$1] = new k(s, this[l], this[y]);
2106
+ if (!this[E$1$1]) if (e.remain) {
2107
+ const w = () => {
2108
+ e.invalid || (this[E$1$1] = true);
2109
+ };
2110
+ e.on("end", w);
2111
+ } else this[E$1$1] = true;
2112
+ e.meta ? e.size > this.maxMetaEntrySize ? (e.ignore = true, this[b$1]("ignoredEntry", e), this[h$2] = "ignore", e.resume()) : e.size > 0 && (this[c$1] = "", e.on("data", (w) => this[c$1] += w), this[h$2] = "meta") : (this[l] = null, e.ignore = e.ignore || !this.filter(e.path, e), e.ignore ? (this[b$1]("ignoredEntry", e), this[h$2] = e.remain ? "ignore" : "header", e.resume()) : (e.remain ? this[h$2] = "body" : (this[h$2] = "header", e.end()), this[a] ? this[f].push(e) : (this[f].push(e), this[I$1]())));
2113
+ }
2114
+ }
2115
+ }
2116
+ [V$1]() {
2117
+ j(() => this.emit("close"));
2118
+ }
2119
+ [U$1](t) {
2120
+ let i = true;
2121
+ return t ? Array.isArray(t) ? this.emit.apply(this, t) : (this[a] = t, this.emit("entry", t), t.emittedEnd || (t.on("end", (s) => this[I$1]()), i = false)) : (this[a] = null, i = false), i;
2122
+ }
2123
+ [I$1]() {
2124
+ do ;
2125
+ while (this[U$1](this[f].shift()));
2126
+ if (!this[f].length) {
2127
+ const t = this[a];
2128
+ !t || t.flowing || t.size === t.remain ? this[S] || this.emit("drain") : t.once("drain", (s) => this.emit("drain"));
2129
+ }
2130
+ }
2131
+ [q](t, i) {
2132
+ const s = this[d$1], o = s.blockRemain, e = o >= t.length && i === 0 ? t : t.slice(i, i + o);
2133
+ return s.write(e), s.blockRemain || (this[h$2] = "header", this[d$1] = null, s.end()), e.length;
2134
+ }
2135
+ [z](t, i) {
2136
+ const s = this[d$1], o = this[q](t, i);
2137
+ return this[d$1] || this[H](s), o;
2138
+ }
2139
+ [b$1](t, i, s) {
2140
+ !this[f].length && !this[a] ? this.emit(t, i, s) : this[f].push([
2141
+ t,
2142
+ i,
2143
+ s
2144
+ ]);
2145
+ }
2146
+ [H](t) {
2147
+ switch (this[b$1]("meta", this[c$1]), t.type) {
2148
+ case "ExtendedHeader":
2149
+ case "OldExtendedHeader":
2150
+ this[l] = C.parse(this[c$1], this[l], false);
2151
+ break;
2152
+ case "GlobalExtendedHeader":
2153
+ this[y] = C.parse(this[c$1], this[y], true);
2154
+ break;
2155
+ case "NextFileHasLongPath":
2156
+ case "OldGnuLongPath":
2157
+ this[l] = this[l] || Object.create(null), this[l].path = this[c$1].replace(/\0.*/, "");
2158
+ break;
2159
+ case "NextFileHasLongLinkpath":
2160
+ this[l] = this[l] || Object.create(null), this[l].linkpath = this[c$1].replace(/\0.*/, "");
2161
+ break;
2162
+ default: throw new Error("unknown meta: " + t.type);
2163
+ }
2164
+ }
2165
+ abort(t) {
2166
+ this[m] = true, this.emit("abort", t), this.warn("TAR_ABORT", t, { recoverable: false });
2167
+ }
2168
+ write(t) {
2169
+ if (this[m]) return;
2170
+ if ((this[r] === null || this.brotli === void 0 && this[r] === false) && t) {
2171
+ if (this[n] && (t = Buffer.concat([this[n], t]), this[n] = null), t.length < B$1.length) return this[n] = t, true;
2172
+ for (let e = 0; this[r] === null && e < B$1.length; e++) t[e] !== B$1[e] && (this[r] = false);
2173
+ const o = this.brotli === void 0;
2174
+ if (this[r] === false && o) if (t.length < 512) if (this[u]) this.brotli = true;
2175
+ else return this[n] = t, true;
2176
+ else try {
2177
+ new $(t.slice(0, 512)), this.brotli = !1;
2178
+ } catch {
2179
+ this.brotli = true;
2180
+ }
2181
+ if (this[r] === null || this[r] === false && this.brotli) {
2182
+ const e = this[u];
2183
+ this[u] = false, this[r] = this[r] === null ? new x$1.Unzip() : new x$1.BrotliDecompress(), this[r].on("data", (p) => this[_](p)), this[r].on("error", (p) => this.abort(p)), this[r].on("end", (p) => {
2184
+ this[u] = true, this[_]();
2185
+ }), this[S] = true;
2186
+ const w = this[r][e ? "end" : "write"](t);
2187
+ return this[S] = false, w;
2188
+ }
2189
+ }
2190
+ this[S] = true, this[r] ? this[r].write(t) : this[_](t), this[S] = false;
2191
+ const s = this[f].length ? false : this[a] ? this[a].flowing : true;
2192
+ return !s && !this[f].length && this[a].once("drain", (o) => this.emit("drain")), s;
2193
+ }
2194
+ [D$1](t) {
2195
+ t && !this[m] && (this[n] = this[n] ? Buffer.concat([this[n], t]) : t);
2196
+ }
2197
+ [M$1]() {
2198
+ if (this[u] && !this[L] && !this[m] && !this[N$1]) {
2199
+ this[L] = true;
2200
+ const t = this[d$1];
2201
+ if (t && t.blockRemain) {
2202
+ const i = this[n] ? this[n].length : 0;
2203
+ this.warn("TAR_BAD_ARCHIVE", `Truncated input (needed ${t.blockRemain} more bytes, only ${i} available)`, { entry: t }), this[n] && t.write(this[n]), t.end();
2204
+ }
2205
+ this[b$1](T);
2206
+ }
2207
+ }
2208
+ [_](t) {
2209
+ if (this[N$1]) this[D$1](t);
2210
+ else if (!t && !this[n]) this[M$1]();
2211
+ else {
2212
+ if (this[N$1] = true, this[n]) {
2213
+ this[D$1](t);
2214
+ const i = this[n];
2215
+ this[n] = null, this[g$1](i);
2216
+ } else this[g$1](t);
2217
+ for (; this[n] && this[n].length >= 512 && !this[m] && !this[A$1];) {
2218
+ const i = this[n];
2219
+ this[n] = null, this[g$1](i);
2220
+ }
2221
+ this[N$1] = false;
2222
+ }
2223
+ (!this[n] || this[u]) && this[M$1]();
2224
+ }
2225
+ [g$1](t) {
2226
+ let i = 0;
2227
+ const s = t.length;
2228
+ for (; i + 512 <= s && !this[m] && !this[A$1];) switch (this[h$2]) {
2229
+ case "begin":
2230
+ case "header":
2231
+ this[Y](t, i), i += 512;
2232
+ break;
2233
+ case "ignore":
2234
+ case "body":
2235
+ i += this[q](t, i);
2236
+ break;
2237
+ case "meta":
2238
+ i += this[z](t, i);
2239
+ break;
2240
+ default: throw new Error("invalid state: " + this[h$2]);
2241
+ }
2242
+ i < s && (this[n] ? this[n] = Buffer.concat([t.slice(i), this[n]]) : this[n] = t.slice(i));
2243
+ }
2244
+ end(t) {
2245
+ this[m] || (this[r] ? this[r].end(t) : (this[u] = true, this.brotli === void 0 && (t = t || Buffer.alloc(0)), this.write(t)));
2246
+ }
2247
+ }), O$1;
2248
+ }
2249
+ var s$4 = {};
2250
+ var v$1;
2251
+ function X() {
2252
+ if (v$1) return s$4;
2253
+ v$1 = 1;
2254
+ const H = tt(), I$1 = nt.EventEmitter, r = nativeFs;
2255
+ let R = r.writev;
2256
+ if (!R) {
2257
+ const c$1 = process.binding("fs"), t = c$1.FSReqWrap || c$1.FSReqCallback;
2258
+ R = (e, i, $, A$1) => {
2259
+ const G = (J, K$1) => A$1(J, K$1, i), j = new t();
2260
+ j.oncomplete = G, c$1.writeBuffers(e, i, $, j);
2261
+ };
2262
+ }
2263
+ const m = Symbol("_autoClose"), h$2 = Symbol("_close"), g$1 = Symbol("_ended"), s = Symbol("_fd"), B$1 = Symbol("_finished"), o = Symbol("_flags"), x$1 = Symbol("_flush"), z = Symbol("_handleChunk"), T = Symbol("_makeBuf"), q = Symbol("_mode"), E = Symbol("_needDrain"), d$1 = Symbol("_onerror"), y = Symbol("_onopen"), W$1 = Symbol("_onread"), _ = Symbol("_onwrite"), a = Symbol("_open"), l = Symbol("_path"), u = Symbol("_pos"), n = Symbol("_queue"), S = Symbol("_read"), M$1 = Symbol("_readSize"), f = Symbol("_reading"), k = Symbol("_remain"), N$1 = Symbol("_size"), C = Symbol("_write"), b$1 = Symbol("_writing"), F = Symbol("_defaultFlag"), p = Symbol("_errored");
2264
+ class D$1 extends H {
2265
+ constructor(t, e) {
2266
+ if (e = e || {}, super(e), this.readable = true, this.writable = false, typeof t != "string") throw new TypeError("path must be a string");
2267
+ this[p] = false, this[s] = typeof e.fd == "number" ? e.fd : null, this[l] = t, this[M$1] = e.readSize || 16 * 1024 * 1024, this[f] = false, this[N$1] = typeof e.size == "number" ? e.size : Infinity, this[k] = this[N$1], this[m] = typeof e.autoClose == "boolean" ? e.autoClose : true, typeof this[s] == "number" ? this[S]() : this[a]();
2268
+ }
2269
+ get fd() {
2270
+ return this[s];
2271
+ }
2272
+ get path() {
2273
+ return this[l];
2274
+ }
2275
+ write() {
2276
+ throw new TypeError("this is a readable stream");
2277
+ }
2278
+ end() {
2279
+ throw new TypeError("this is a readable stream");
2280
+ }
2281
+ [a]() {
2282
+ r.open(this[l], "r", (t, e) => this[y](t, e));
2283
+ }
2284
+ [y](t, e) {
2285
+ t ? this[d$1](t) : (this[s] = e, this.emit("open", e), this[S]());
2286
+ }
2287
+ [T]() {
2288
+ return Buffer.allocUnsafe(Math.min(this[M$1], this[k]));
2289
+ }
2290
+ [S]() {
2291
+ if (!this[f]) {
2292
+ this[f] = true;
2293
+ const t = this[T]();
2294
+ if (t.length === 0) return process.nextTick(() => this[W$1](null, 0, t));
2295
+ r.read(this[s], t, 0, t.length, null, (e, i, $) => this[W$1](e, i, $));
2296
+ }
2297
+ }
2298
+ [W$1](t, e, i) {
2299
+ this[f] = false, t ? this[d$1](t) : this[z](e, i) && this[S]();
2300
+ }
2301
+ [h$2]() {
2302
+ if (this[m] && typeof this[s] == "number") {
2303
+ const t = this[s];
2304
+ this[s] = null, r.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
2305
+ }
2306
+ }
2307
+ [d$1](t) {
2308
+ this[f] = true, this[h$2](), this.emit("error", t);
2309
+ }
2310
+ [z](t, e) {
2311
+ let i = false;
2312
+ return this[k] -= t, t > 0 && (i = super.write(t < e.length ? e.slice(0, t) : e)), (t === 0 || this[k] <= 0) && (i = false, this[h$2](), super.end()), i;
2313
+ }
2314
+ emit(t, e) {
2315
+ switch (t) {
2316
+ case "prefinish":
2317
+ case "finish": break;
2318
+ case "drain":
2319
+ typeof this[s] == "number" && this[S]();
2320
+ break;
2321
+ case "error": return this[p] ? void 0 : (this[p] = true, super.emit(t, e));
2322
+ default: return super.emit(t, e);
2323
+ }
2324
+ }
2325
+ }
2326
+ class P$2 extends D$1 {
2327
+ [a]() {
2328
+ let t = true;
2329
+ try {
2330
+ this[y](null, r.openSync(this[l], "r")), t = !1;
2331
+ } finally {
2332
+ t && this[h$2]();
2333
+ }
2334
+ }
2335
+ [S]() {
2336
+ let t = true;
2337
+ try {
2338
+ if (!this[f]) {
2339
+ this[f] = !0;
2340
+ do {
2341
+ const e = this[T](), i = e.length === 0 ? 0 : r.readSync(this[s], e, 0, e.length, null);
2342
+ if (!this[z](i, e)) break;
2343
+ } while (!0);
2344
+ this[f] = !1;
2345
+ }
2346
+ t = !1;
2347
+ } finally {
2348
+ t && this[h$2]();
2349
+ }
2350
+ }
2351
+ [h$2]() {
2352
+ if (this[m] && typeof this[s] == "number") {
2353
+ const t = this[s];
2354
+ this[s] = null, r.closeSync(t), this.emit("close");
2355
+ }
2356
+ }
2357
+ }
2358
+ class O extends I$1 {
2359
+ constructor(t, e) {
2360
+ e = e || {}, super(e), this.readable = false, this.writable = true, this[p] = false, this[b$1] = false, this[g$1] = false, this[E] = false, this[n] = [], this[l] = t, this[s] = typeof e.fd == "number" ? e.fd : null, this[q] = e.mode === void 0 ? 438 : e.mode, this[u] = typeof e.start == "number" ? e.start : null, this[m] = typeof e.autoClose == "boolean" ? e.autoClose : true;
2361
+ const i = this[u] !== null ? "r+" : "w";
2362
+ this[F] = e.flags === void 0, this[o] = this[F] ? i : e.flags, this[s] === null && this[a]();
2363
+ }
2364
+ emit(t, e) {
2365
+ if (t === "error") {
2366
+ if (this[p]) return;
2367
+ this[p] = true;
2368
+ }
2369
+ return super.emit(t, e);
2370
+ }
2371
+ get fd() {
2372
+ return this[s];
2373
+ }
2374
+ get path() {
2375
+ return this[l];
2376
+ }
2377
+ [d$1](t) {
2378
+ this[h$2](), this[b$1] = true, this.emit("error", t);
2379
+ }
2380
+ [a]() {
2381
+ r.open(this[l], this[o], this[q], (t, e) => this[y](t, e));
2382
+ }
2383
+ [y](t, e) {
2384
+ this[F] && this[o] === "r+" && t && t.code === "ENOENT" ? (this[o] = "w", this[a]()) : t ? this[d$1](t) : (this[s] = e, this.emit("open", e), this[x$1]());
2385
+ }
2386
+ end(t, e) {
2387
+ return t && this.write(t, e), this[g$1] = true, !this[b$1] && !this[n].length && typeof this[s] == "number" && this[_](null, 0), this;
2388
+ }
2389
+ write(t, e) {
2390
+ return typeof t == "string" && (t = Buffer.from(t, e)), this[g$1] ? (this.emit("error", /* @__PURE__ */ new Error("write() after end()")), false) : this[s] === null || this[b$1] || this[n].length ? (this[n].push(t), this[E] = true, false) : (this[b$1] = true, this[C](t), true);
2391
+ }
2392
+ [C](t) {
2393
+ r.write(this[s], t, 0, t.length, this[u], (e, i) => this[_](e, i));
2394
+ }
2395
+ [_](t, e) {
2396
+ t ? this[d$1](t) : (this[u] !== null && (this[u] += e), this[n].length ? this[x$1]() : (this[b$1] = false, this[g$1] && !this[B$1] ? (this[B$1] = true, this[h$2](), this.emit("finish")) : this[E] && (this[E] = false, this.emit("drain"))));
2397
+ }
2398
+ [x$1]() {
2399
+ if (this[n].length === 0) this[g$1] && this[_](null, 0);
2400
+ else if (this[n].length === 1) this[C](this[n].pop());
2401
+ else {
2402
+ const t = this[n];
2403
+ this[n] = [], R(this[s], t, this[u], (e, i) => this[_](e, i));
2404
+ }
2405
+ }
2406
+ [h$2]() {
2407
+ if (this[m] && typeof this[s] == "number") {
2408
+ const t = this[s];
2409
+ this[s] = null, r.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
2410
+ }
2411
+ }
2412
+ }
2413
+ class U$1 extends O {
2414
+ [a]() {
2415
+ let t;
2416
+ if (this[F] && this[o] === "r+") try {
2417
+ t = r.openSync(this[l], this[o], this[q]);
2418
+ } catch (e) {
2419
+ if (e.code === "ENOENT") return this[o] = "w", this[a]();
2420
+ throw e;
2421
+ }
2422
+ else t = r.openSync(this[l], this[o], this[q]);
2423
+ this[y](null, t);
2424
+ }
2425
+ [h$2]() {
2426
+ if (this[m] && typeof this[s] == "number") {
2427
+ const t = this[s];
2428
+ this[s] = null, r.closeSync(t), this.emit("close");
2429
+ }
2430
+ }
2431
+ [C](t) {
2432
+ let e = true;
2433
+ try {
2434
+ this[_](null, r.writeSync(this[s], t, 0, t.length, this[u])), e = !1;
2435
+ } finally {
2436
+ if (e) try {
2437
+ this[h$2]();
2438
+ } catch {}
2439
+ }
2440
+ }
2441
+ }
2442
+ return s$4.ReadStream = D$1, s$4.ReadStreamSync = P$2, s$4.WriteStream = O, s$4.WriteStreamSync = U$1, s$4;
2443
+ }
2444
+ var r$1 = { exports: {} };
2445
+ var i$2, m$2;
2446
+ function t$2() {
2447
+ if (m$2) return i$2;
2448
+ m$2 = 1;
2449
+ const { promisify: n } = a$a, e = nativeFs;
2450
+ return i$2 = (r) => {
2451
+ if (!r) r = {
2452
+ mode: 511,
2453
+ fs: e
2454
+ };
2455
+ else if (typeof r == "object") r = {
2456
+ mode: 511,
2457
+ fs: e,
2458
+ ...r
2459
+ };
2460
+ else if (typeof r == "number") r = {
2461
+ mode: r,
2462
+ fs: e
2463
+ };
2464
+ else if (typeof r == "string") r = {
2465
+ mode: parseInt(r, 8),
2466
+ fs: e
2467
+ };
2468
+ else throw new TypeError("invalid options argument");
2469
+ return r.mkdir = r.mkdir || r.fs.mkdir || e.mkdir, r.mkdirAsync = n(r.mkdir), r.stat = r.stat || r.fs.stat || e.stat, r.statAsync = n(r.stat), r.statSync = r.statSync || r.fs.statSync || e.statSync, r.mkdirSync = r.mkdirSync || r.fs.mkdirSync || e.mkdirSync, r;
2470
+ }, i$2;
2471
+ }
2472
+ var e$1, t$1;
2473
+ function u$2() {
2474
+ if (t$1) return e$1;
2475
+ t$1 = 1;
2476
+ const s = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform, { resolve: o, parse: n } = path;
2477
+ return e$1 = (r) => {
2478
+ if (/\0/.test(r)) throw Object.assign(/* @__PURE__ */ new TypeError("path must be a string without null bytes"), {
2479
+ path: r,
2480
+ code: "ERR_INVALID_ARG_VALUE"
2481
+ });
2482
+ if (r = o(r), s === "win32") {
2483
+ const i = /[*|"<>?:]/, { root: a } = n(r);
2484
+ if (i.test(r.substr(a.length))) throw Object.assign(/* @__PURE__ */ new Error("Illegal characters in path."), {
2485
+ path: r,
2486
+ code: "EINVAL"
2487
+ });
2488
+ }
2489
+ return r;
2490
+ }, e$1;
2491
+ }
2492
+ var i$1, c$2;
2493
+ function t() {
2494
+ if (c$2) return i$1;
2495
+ c$2 = 1;
2496
+ const { dirname: u } = path, f = (r, e, n = void 0) => n === e ? Promise.resolve() : r.statAsync(e).then((d$1) => d$1.isDirectory() ? n : void 0, (d$1) => d$1.code === "ENOENT" ? f(r, u(e), e) : void 0), o = (r, e, n = void 0) => {
2497
+ if (n !== e) try {
2498
+ return r.statSync(e).isDirectory() ? n : void 0;
2499
+ } catch (d$1) {
2500
+ return d$1.code === "ENOENT" ? o(r, u(e), e) : void 0;
2501
+ }
2502
+ };
2503
+ return i$1 = {
2504
+ findMade: f,
2505
+ findMadeSync: o
2506
+ }, i$1;
2507
+ }
2508
+ var o$3, a$4;
2509
+ function y$2() {
2510
+ if (a$4) return o$3;
2511
+ a$4 = 1;
2512
+ const { dirname: f } = path, t = (n, e, c$1) => {
2513
+ e.recursive = false;
2514
+ const i = f(n);
2515
+ return i === n ? e.mkdirAsync(n, e).catch((r) => {
2516
+ if (r.code !== "EISDIR") throw r;
2517
+ }) : e.mkdirAsync(n, e).then(() => c$1 || n, (r) => {
2518
+ if (r.code === "ENOENT") return t(i, e).then((u) => t(n, e, u));
2519
+ if (r.code !== "EEXIST" && r.code !== "EROFS") throw r;
2520
+ return e.statAsync(n).then((u) => {
2521
+ if (u.isDirectory()) return c$1;
2522
+ throw r;
2523
+ }, () => {
2524
+ throw r;
2525
+ });
2526
+ });
2527
+ }, d$1 = (n, e, c$1) => {
2528
+ const i = f(n);
2529
+ if (e.recursive = false, i === n) try {
2530
+ return e.mkdirSync(n, e);
2531
+ } catch (r) {
2532
+ if (r.code !== "EISDIR") throw r;
2533
+ return;
2534
+ }
2535
+ try {
2536
+ return e.mkdirSync(n, e), c$1 || n;
2537
+ } catch (r) {
2538
+ if (r.code === "ENOENT") return d$1(n, e, d$1(i, e, c$1));
2539
+ if (r.code !== "EEXIST" && r.code !== "EROFS") throw r;
2540
+ try {
2541
+ if (!e.statSync(n).isDirectory()) throw r;
2542
+ } catch {
2543
+ throw r;
2544
+ }
2545
+ }
2546
+ };
2547
+ return o$3 = {
2548
+ mkdirpManual: t,
2549
+ mkdirpManualSync: d$1
2550
+ }, o$3;
2551
+ }
2552
+ var c$1, m$1;
2553
+ function s$3() {
2554
+ if (m$1) return c$1;
2555
+ m$1 = 1;
2556
+ const { dirname: u } = path, { findMade: d$1, findMadeSync: t$1 } = t(), { mkdirpManual: a, mkdirpManualSync: k } = y$2();
2557
+ return c$1 = {
2558
+ mkdirpNative: (e, r) => (r.recursive = true, u(e) === e ? r.mkdirAsync(e, r) : d$1(r, e).then((n) => r.mkdirAsync(e, r).then(() => n).catch((i) => {
2559
+ if (i.code === "ENOENT") return a(e, r);
2560
+ throw i;
2561
+ }))),
2562
+ mkdirpNativeSync: (e, r) => {
2563
+ if (r.recursive = true, u(e) === e) return r.mkdirSync(e, r);
2564
+ const n = t$1(r, e);
2565
+ try {
2566
+ return r.mkdirSync(e, r), n;
2567
+ } catch (i) {
2568
+ if (i.code === "ENOENT") return k(e, r);
2569
+ throw i;
2570
+ }
2571
+ }
2572
+ }, c$1;
2573
+ }
2574
+ var s$2, n$1;
2575
+ function a$3() {
2576
+ if (n$1) return s$2;
2577
+ n$1 = 1;
2578
+ const i = nativeFs, e = (process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version).replace(/^v/, "").split("."), t = +e[0] > 10 || +e[0] == 10 && +e[1] >= 12;
2579
+ return s$2 = {
2580
+ useNative: t ? (r) => r.mkdir === i.mkdir : () => false,
2581
+ useNativeSync: t ? (r) => r.mkdirSync === i.mkdirSync : () => false
2582
+ }, s$2;
2583
+ }
2584
+ var m, s$1;
2585
+ function S() {
2586
+ if (s$1) return m;
2587
+ s$1 = 1;
2588
+ const i = t$2(), u = u$2(), { mkdirpNative: a, mkdirpNativeSync: c$1 } = s$3(), { mkdirpManual: o, mkdirpManualSync: q } = y$2(), { useNative: t, useNativeSync: _ } = a$3(), n = (e, r) => (e = u(e), r = i(r), t(r) ? a(e, r) : o(e, r)), d$1 = (e, r) => (e = u(e), r = i(r), _(r) ? c$1(e, r) : q(e, r));
2589
+ return n.sync = d$1, n.native = (e, r) => a(u(e), i(r)), n.manual = (e, r) => o(u(e), i(r)), n.nativeSync = (e, r) => c$1(u(e), i(r)), n.manualSync = (e, r) => q(u(e), i(r)), m = n, m;
2590
+ }
2591
+ var y$1, O;
2592
+ function F$1() {
2593
+ if (O) return y$1;
2594
+ O = 1;
2595
+ const c$1 = nativeFs, a = path, T = c$1.lchown ? "lchown" : "chown", I$1 = c$1.lchownSync ? "lchownSync" : "chownSync", i = c$1.lchown && !process.version.match(/v1[1-9]+\./) && !process.version.match(/v10\.[6-9]/), u = (r, e, n) => {
2596
+ try {
2597
+ return c$1[I$1](r, e, n);
2598
+ } catch (t) {
2599
+ if (t.code !== "ENOENT") throw t;
2600
+ }
2601
+ }, D$1 = (r, e, n) => {
2602
+ try {
2603
+ return c$1.chownSync(r, e, n);
2604
+ } catch (t) {
2605
+ if (t.code !== "ENOENT") throw t;
2606
+ }
2607
+ }, _ = i ? (r, e, n, t) => (o) => {
2608
+ !o || o.code !== "EISDIR" ? t(o) : c$1.chown(r, e, n, t);
2609
+ } : (r, e, n, t) => t, w = i ? (r, e, n) => {
2610
+ try {
2611
+ return u(r, e, n);
2612
+ } catch (t) {
2613
+ if (t.code !== "EISDIR") throw t;
2614
+ D$1(r, e, n);
2615
+ }
2616
+ } : (r, e, n) => u(r, e, n), R = process.version;
2617
+ let N$1 = (r, e, n) => c$1.readdir(r, e, n), q = (r, e) => c$1.readdirSync(r, e);
2618
+ /^v4\./.test(R) && (N$1 = (r, e, n) => c$1.readdir(r, n));
2619
+ const h$2 = (r, e, n, t) => {
2620
+ c$1[T](r, e, n, _(r, e, n, (o) => {
2621
+ t(o && o.code !== "ENOENT" ? o : null);
2622
+ }));
2623
+ }, S = (r, e, n, t, o) => {
2624
+ if (typeof e == "string") return c$1.lstat(a.resolve(r, e), (s, f) => {
2625
+ if (s) return o(s.code !== "ENOENT" ? s : null);
2626
+ f.name = e, S(r, f, n, t, o);
2627
+ });
2628
+ if (e.isDirectory()) E(a.resolve(r, e.name), n, t, (s) => {
2629
+ if (s) return o(s);
2630
+ h$2(a.resolve(r, e.name), n, t, o);
2631
+ });
2632
+ else h$2(a.resolve(r, e.name), n, t, o);
2633
+ }, E = (r, e, n, t) => {
2634
+ N$1(r, { withFileTypes: true }, (o, s) => {
2635
+ if (o) {
2636
+ if (o.code === "ENOENT") return t();
2637
+ if (o.code !== "ENOTDIR" && o.code !== "ENOTSUP") return t(o);
2638
+ }
2639
+ if (o || !s.length) return h$2(r, e, n, t);
2640
+ let f = s.length, v = null;
2641
+ const H = (l) => {
2642
+ if (!v) {
2643
+ if (l) return t(v = l);
2644
+ if (--f === 0) return h$2(r, e, n, t);
2645
+ }
2646
+ };
2647
+ s.forEach((l) => S(r, l, e, n, H));
2648
+ });
2649
+ }, C = (r, e, n, t) => {
2650
+ if (typeof e == "string") try {
2651
+ const o = c$1.lstatSync(a.resolve(r, e));
2652
+ o.name = e, e = o;
2653
+ } catch (o) {
2654
+ if (o.code === "ENOENT") return;
2655
+ throw o;
2656
+ }
2657
+ e.isDirectory() && m(a.resolve(r, e.name), n, t), w(a.resolve(r, e.name), n, t);
2658
+ }, m = (r, e, n) => {
2659
+ let t;
2660
+ try {
2661
+ t = q(r, { withFileTypes: !0 });
2662
+ } catch (o) {
2663
+ if (o.code === "ENOENT") return;
2664
+ if (o.code === "ENOTDIR" || o.code === "ENOTSUP") return w(r, e, n);
2665
+ throw o;
2666
+ }
2667
+ return t && t.length && t.forEach((o) => C(r, o, e, n)), w(r, e, n);
2668
+ };
2669
+ return y$1 = E, E.sync = m, y$1;
2670
+ }
2671
+ var R;
2672
+ function H() {
2673
+ if (R) return r$1.exports;
2674
+ R = 1;
2675
+ const g$1 = S(), l = nativeFs, p = path, x$1 = F$1(), y = a$7();
2676
+ class D$1 extends Error {
2677
+ constructor(e, s) {
2678
+ super("Cannot extract through symbolic link"), this.path = s, this.symlink = e;
2679
+ }
2680
+ get name() {
2681
+ return "SylinkError";
2682
+ }
2683
+ }
2684
+ class E extends Error {
2685
+ constructor(e, s) {
2686
+ super(s + ": Cannot cd into '" + e + "'"), this.path = e, this.code = s;
2687
+ }
2688
+ get name() {
2689
+ return "CwdError";
2690
+ }
2691
+ }
2692
+ const v = (n, e) => n.get(y(e)), q = (n, e, s) => n.set(y(e), s), I$1 = (n, e) => {
2693
+ l.stat(n, (s, r) => {
2694
+ (s || !r.isDirectory()) && (s = new E(n, s && s.code || "ENOTDIR")), e(s);
2695
+ });
2696
+ };
2697
+ r$1.exports = (n, e, s) => {
2698
+ n = y(n);
2699
+ const r = e.umask, c$1 = e.mode | 448, f = (c$1 & r) !== 0, t = e.uid, i = e.gid, a = typeof t == "number" && typeof i == "number" && (t !== e.processUid || i !== e.processGid), u = e.preserve, m = e.unlink, h$2 = e.cache, d$1 = y(e.cwd), w = (k, o) => {
2700
+ k ? s(k) : (q(h$2, n, true), o && a ? x$1(o, t, i, (G) => w(G)) : f ? l.chmod(n, c$1, s) : s());
2701
+ };
2702
+ if (h$2 && v(h$2, n) === true) return w();
2703
+ if (n === d$1) return I$1(n, w);
2704
+ if (u) return g$1(n, { mode: c$1 }).then((k) => w(null, k), w);
2705
+ C(d$1, y(p.relative(d$1, n)).split("/"), c$1, h$2, m, d$1, null, w);
2706
+ };
2707
+ const C = (n, e, s, r, c$1, f, t, i) => {
2708
+ if (!e.length) return i(null, t);
2709
+ const a = e.shift(), u = y(p.resolve(n + "/" + a));
2710
+ if (v(r, u)) return C(u, e, s, r, c$1, f, t, i);
2711
+ l.mkdir(u, s, j(u, e, s, r, c$1, f, t, i));
2712
+ }, j = (n, e, s, r, c$1, f, t, i) => (a) => {
2713
+ a ? l.lstat(n, (u, m) => {
2714
+ if (u) u.path = u.path && y(u.path), i(u);
2715
+ else if (m.isDirectory()) C(n, e, s, r, c$1, f, t, i);
2716
+ else if (c$1) l.unlink(n, (h$2) => {
2717
+ if (h$2) return i(h$2);
2718
+ l.mkdir(n, s, j(n, e, s, r, c$1, f, t, i));
2719
+ });
2720
+ else {
2721
+ if (m.isSymbolicLink()) return i(new D$1(n, n + "/" + e.join("/")));
2722
+ i(a);
2723
+ }
2724
+ }) : (t = t || n, C(n, e, s, r, c$1, f, t, i));
2725
+ }, L = (n) => {
2726
+ let e = false, s = "ENOTDIR";
2727
+ try {
2728
+ e = l.statSync(n).isDirectory();
2729
+ } catch (r) {
2730
+ s = r.code;
2731
+ } finally {
2732
+ if (!e) throw new E(n, s);
2733
+ }
2734
+ };
2735
+ return r$1.exports.sync = (n, e) => {
2736
+ n = y(n);
2737
+ const s = e.umask, r = e.mode | 448, c$1 = (r & s) !== 0, f = e.uid, t = e.gid, i = typeof f == "number" && typeof t == "number" && (f !== e.processUid || t !== e.processGid), a = e.preserve, u = e.unlink, m = e.cache, h$2 = y(e.cwd), d$1 = (k) => {
2738
+ q(m, n, true), k && i && x$1.sync(k, f, t), c$1 && l.chmodSync(n, r);
2739
+ };
2740
+ if (m && v(m, n) === true) return d$1();
2741
+ if (n === h$2) return L(h$2), d$1();
2742
+ if (a) return d$1(g$1.sync(n, r));
2743
+ const $ = y(p.relative(h$2, n)).split("/");
2744
+ let S = null;
2745
+ for (let k = $.shift(), o = h$2; k && (o += "/" + k); k = $.shift()) if (o = y(p.resolve(o)), !v(m, o)) try {
2746
+ l.mkdirSync(o, r), S = S || o, q(m, o, !0);
2747
+ } catch {
2748
+ const M$1 = l.lstatSync(o);
2749
+ if (M$1.isDirectory()) {
2750
+ q(m, o, true);
2751
+ continue;
2752
+ } else if (u) {
2753
+ l.unlinkSync(o), l.mkdirSync(o, r), S = S || o, q(m, o, true);
2754
+ continue;
2755
+ } else if (M$1.isSymbolicLink()) return new D$1(o, o + "/" + $.join("/"));
2756
+ }
2757
+ return d$1(S);
2758
+ }, r$1.exports;
2759
+ }
2760
+ var a$2, i;
2761
+ function p() {
2762
+ if (i) return a$2;
2763
+ i = 1;
2764
+ const o = [
2765
+ "|",
2766
+ "<",
2767
+ ">",
2768
+ "?",
2769
+ ":"
2770
+ ], t = o.map((e) => String.fromCharCode(61440 + e.charCodeAt(0))), s = new Map(o.map((e, r) => [e, t[r]])), c$1 = new Map(t.map((e, r) => [e, o[r]]));
2771
+ return a$2 = {
2772
+ encode: (e) => o.reduce((r, n) => r.split(n).join(s.get(n)), e),
2773
+ decode: (e) => t.reduce((r, n) => r.split(n).join(c$1.get(n)), e)
2774
+ }, a$2;
2775
+ }
2776
+ var o$2, n;
2777
+ function a$1() {
2778
+ if (n) return o$2;
2779
+ n = 1;
2780
+ const r = Object.create(null), { hasOwnProperty: i } = Object.prototype;
2781
+ return o$2 = (e) => (i.call(r, e) || (r[e] = e.normalize("NFD")), r[e]), o$2;
2782
+ }
2783
+ var a, l;
2784
+ function s() {
2785
+ return l || (l = 1, a = (r) => {
2786
+ let e = r.length - 1, i = -1;
2787
+ for (; e > -1 && r.charAt(e) === "/";) i = e, e--;
2788
+ return i === -1 ? r : r.slice(0, i);
2789
+ }), a;
2790
+ }
2791
+ var u$1, f$1;
2792
+ function z() {
2793
+ if (f$1) return u$1;
2794
+ f$1 = 1;
2795
+ const l = j$1, m = a$1(), g$1 = s(), { join: d$1 } = path, q = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32";
2796
+ return u$1 = () => {
2797
+ const i = /* @__PURE__ */ new Map(), c$1 = /* @__PURE__ */ new Map(), v = (e) => e.split("/").slice(0, -1).reduce((o, r) => (o.length && (r = d$1(o[o.length - 1], r)), o.push(r || "/"), o), []), a = /* @__PURE__ */ new Set(), w = (e) => {
2798
+ const s = c$1.get(e);
2799
+ if (!s) throw new Error("function does not have any path reservations");
2800
+ return {
2801
+ paths: s.paths.map((o) => i.get(o)),
2802
+ dirs: [...s.dirs].map((o) => i.get(o))
2803
+ };
2804
+ }, h$2 = (e) => {
2805
+ const { paths: s, dirs: o } = w(e);
2806
+ return s.every((r) => r[0] === e) && o.every((r) => r[0] instanceof Set && r[0].has(e));
2807
+ }, p = (e) => a.has(e) || !h$2(e) ? false : (a.add(e), e(() => S(e)), true), S = (e) => {
2808
+ if (!a.has(e)) return false;
2809
+ const { paths: s, dirs: o } = c$1.get(e), r = /* @__PURE__ */ new Set();
2810
+ return s.forEach((t) => {
2811
+ const n = i.get(t);
2812
+ l.equal(n[0], e), n.length === 1 ? i.delete(t) : (n.shift(), typeof n[0] == "function" ? r.add(n[0]) : n[0].forEach((E) => r.add(E)));
2813
+ }), o.forEach((t) => {
2814
+ const n = i.get(t);
2815
+ l(n[0] instanceof Set), n[0].size === 1 && n.length === 1 ? i.delete(t) : n[0].size === 1 ? (n.shift(), r.add(n[0])) : n[0].delete(e);
2816
+ }), a.delete(e), r.forEach((t) => p(t)), true;
2817
+ };
2818
+ return {
2819
+ check: h$2,
2820
+ reserve: (e, s) => {
2821
+ e = q ? ["win32 parallelization disabled"] : e.map((r) => g$1(d$1(m(r))).toLowerCase());
2822
+ const o = new Set(e.map((r) => v(r)).reduce((r, t) => r.concat(t)));
2823
+ return c$1.set(s, {
2824
+ dirs: o,
2825
+ paths: e
2826
+ }), e.forEach((r) => {
2827
+ const t = i.get(r);
2828
+ t ? t.push(s) : i.set(r, [s]);
2829
+ }), o.forEach((r) => {
2830
+ const t = i.get(r);
2831
+ t ? t[t.length - 1] instanceof Set ? t[t.length - 1].add(s) : t.push(new Set([s])) : i.set(r, [new Set([s])]);
2832
+ }), p(s);
2833
+ }
2834
+ };
2835
+ }, u$1;
2836
+ }
2837
+ var o$1, u;
2838
+ function c$5() {
2839
+ if (u) return o$1;
2840
+ u = 1;
2841
+ const { isAbsolute: l, parse: t } = path.win32;
2842
+ return o$1 = (r) => {
2843
+ let s = "", e = t(r);
2844
+ for (; l(r) || e.root;) {
2845
+ const i = r.charAt(0) === "/" && r.slice(0, 4) !== "//?/" ? "/" : e.root;
2846
+ r = r.slice(i.length), s += i, e = t(r);
2847
+ }
2848
+ return [s, r];
2849
+ }, o$1;
2850
+ }
2851
+ var e, o;
2852
+ function F() {
2853
+ if (o) return e;
2854
+ o = 1;
2855
+ const t = process.env.__FAKE_PLATFORM__ || process.platform, s = typeof Bun < "u" ? false : t === "win32", { O_CREAT: _, O_TRUNC: a, O_WRONLY: i, UV_FS_O_FILEMAP: r = 0 } = (commonjsGlobal.__FAKE_TESTING_FS__ || nativeFs).constants, c$1 = s && !!r, f = 512 * 1024, p = r | a | _ | i;
2856
+ return e = c$1 ? (l) => l < f ? p : "w" : () => "w", e;
2857
+ }
2858
+ var G, y;
2859
+ function Os() {
2860
+ if (y) return G;
2861
+ y = 1;
2862
+ const ss = j$1, is = rt(), r = nativeFs, es = X(), w = path, M$1 = H(), K$1 = p(), ts = z(), os$1 = c$5(), l = a$7(), rs = s(), hs = a$1(), H$1 = Symbol("onEntry"), q = Symbol("checkFs"), Y = Symbol("checkFs2"), v = Symbol("pruneCache"), N$1 = Symbol("isReusable"), d$1 = Symbol("makeFs"), U$1 = Symbol("file"), F$1 = Symbol("directory"), O = Symbol("link"), B$1 = Symbol("symlink"), z$1$1 = Symbol("hardlink"), W$1 = Symbol("unsupported"), j = Symbol("checkPath"), b$1 = Symbol("mkdir"), m = Symbol("onError"), $ = Symbol("pending"), V$1 = Symbol("pend"), S = Symbol("unpend"), P$2 = Symbol("ended"), A$1 = Symbol("maybeClose"), x$1 = Symbol("skip"), E = Symbol("doChown"), R = Symbol("uid"), _ = Symbol("gid"), g$1 = Symbol("checkedCwd"), X$1 = Ds, J = F(), C = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32", cs = 1024, as = (a, s) => {
2863
+ if (!C) return r.unlink(a, s);
2864
+ const i = a + ".DELETE." + X$1.randomBytes(16).toString("hex");
2865
+ r.rename(a, i, (e) => {
2866
+ if (e) return s(e);
2867
+ r.unlink(i, s);
2868
+ });
2869
+ }, us = (a) => {
2870
+ if (!C) return r.unlinkSync(a);
2871
+ const s = a + ".DELETE." + X$1.randomBytes(16).toString("hex");
2872
+ r.renameSync(a, s), r.unlinkSync(s);
2873
+ }, Q = (a, s, i) => a === a >>> 0 ? a : s === s >>> 0 ? s : i, Z = (a) => rs(l(hs(a))).toLowerCase(), ns = (a, s) => {
2874
+ s = Z(s);
2875
+ for (const i of a.keys()) {
2876
+ const e = Z(i);
2877
+ (e === s || e.indexOf(s + "/") === 0) && a.delete(i);
2878
+ }
2879
+ }, ms = (a) => {
2880
+ for (const s of a.keys()) a.delete(s);
2881
+ };
2882
+ class L extends is {
2883
+ constructor(s) {
2884
+ if (s || (s = {}), s.ondone = (i) => {
2885
+ this[P$2] = true, this[A$1]();
2886
+ }, super(s), this[g$1] = false, this.reservations = ts(), this.transform = typeof s.transform == "function" ? s.transform : null, this.writable = true, this.readable = false, this[$] = 0, this[P$2] = false, this.dirCache = s.dirCache || /* @__PURE__ */ new Map(), typeof s.uid == "number" || typeof s.gid == "number") {
2887
+ if (typeof s.uid != "number" || typeof s.gid != "number") throw new TypeError("cannot set owner without number uid and gid");
2888
+ if (s.preserveOwner) throw new TypeError("cannot preserve owner in archive and also set owner explicitly");
2889
+ this.uid = s.uid, this.gid = s.gid, this.setOwner = true;
2890
+ } else this.uid = null, this.gid = null, this.setOwner = false;
2891
+ s.preserveOwner === void 0 && typeof s.uid != "number" ? this.preserveOwner = process.getuid && process.getuid() === 0 : this.preserveOwner = !!s.preserveOwner, this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? process.getuid() : null, this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? process.getgid() : null, this.maxDepth = typeof s.maxDepth == "number" ? s.maxDepth : cs, this.forceChown = s.forceChown === true, this.win32 = !!s.win32 || C, this.newer = !!s.newer, this.keep = !!s.keep, this.noMtime = !!s.noMtime, this.preservePaths = !!s.preservePaths, this.unlink = !!s.unlink, this.cwd = l(w.resolve(s.cwd || process.cwd())), this.strip = +s.strip || 0, this.processUmask = s.noChmod ? 0 : process.umask(), this.umask = typeof s.umask == "number" ? s.umask : this.processUmask, this.dmode = s.dmode || 511 & ~this.umask, this.fmode = s.fmode || 438 & ~this.umask, this.on("entry", (i) => this[H$1](i));
2892
+ }
2893
+ warn(s, i, e = {}) {
2894
+ return (s === "TAR_BAD_ARCHIVE" || s === "TAR_ABORT") && (e.recoverable = false), super.warn(s, i, e);
2895
+ }
2896
+ [A$1]() {
2897
+ this[P$2] && this[$] === 0 && (this.emit("prefinish"), this.emit("finish"), this.emit("end"));
2898
+ }
2899
+ [j](s) {
2900
+ const i = l(s.path), e = i.split("/");
2901
+ if (this.strip) {
2902
+ if (e.length < this.strip) return false;
2903
+ if (s.type === "Link") {
2904
+ const t = l(s.linkpath).split("/");
2905
+ if (t.length >= this.strip) s.linkpath = t.slice(this.strip).join("/");
2906
+ else return false;
2907
+ }
2908
+ e.splice(0, this.strip), s.path = e.join("/");
2909
+ }
2910
+ if (isFinite(this.maxDepth) && e.length > this.maxDepth) return this.warn("TAR_ENTRY_ERROR", "path excessively deep", {
2911
+ entry: s,
2912
+ path: i,
2913
+ depth: e.length,
2914
+ maxDepth: this.maxDepth
2915
+ }), false;
2916
+ if (!this.preservePaths) {
2917
+ if (e.includes("..") || C && /^[a-z]:\.\.$/i.test(e[0])) return this.warn("TAR_ENTRY_ERROR", "path contains '..'", {
2918
+ entry: s,
2919
+ path: i
2920
+ }), false;
2921
+ const [t, o] = os$1(i);
2922
+ t && (s.path = o, this.warn("TAR_ENTRY_INFO", `stripping ${t} from absolute path`, {
2923
+ entry: s,
2924
+ path: i
2925
+ }));
2926
+ }
2927
+ if (w.isAbsolute(s.path) ? s.absolute = l(w.resolve(s.path)) : s.absolute = l(w.resolve(this.cwd, s.path)), !this.preservePaths && s.absolute.indexOf(this.cwd + "/") !== 0 && s.absolute !== this.cwd) return this.warn("TAR_ENTRY_ERROR", "path escaped extraction target", {
2928
+ entry: s,
2929
+ path: l(s.path),
2930
+ resolvedPath: s.absolute,
2931
+ cwd: this.cwd
2932
+ }), false;
2933
+ if (s.absolute === this.cwd && s.type !== "Directory" && s.type !== "GNUDumpDir") return false;
2934
+ if (this.win32) {
2935
+ const { root: t } = w.win32.parse(s.absolute);
2936
+ s.absolute = t + K$1.encode(s.absolute.slice(t.length));
2937
+ const { root: o } = w.win32.parse(s.path);
2938
+ s.path = o + K$1.encode(s.path.slice(o.length));
2939
+ }
2940
+ return true;
2941
+ }
2942
+ [H$1](s) {
2943
+ if (!this[j](s)) return s.resume();
2944
+ switch (ss.equal(typeof s.absolute, "string"), s.type) {
2945
+ case "Directory":
2946
+ case "GNUDumpDir": s.mode && (s.mode = s.mode | 448);
2947
+ case "File":
2948
+ case "OldFile":
2949
+ case "ContiguousFile":
2950
+ case "Link":
2951
+ case "SymbolicLink": return this[q](s);
2952
+ case "CharacterDevice":
2953
+ case "BlockDevice":
2954
+ case "FIFO":
2955
+ default: return this[W$1](s);
2956
+ }
2957
+ }
2958
+ [m](s, i) {
2959
+ s.name === "CwdError" ? this.emit("error", s) : (this.warn("TAR_ENTRY_ERROR", s, { entry: i }), this[S](), i.resume());
2960
+ }
2961
+ [b$1](s, i, e) {
2962
+ M$1(l(s), {
2963
+ uid: this.uid,
2964
+ gid: this.gid,
2965
+ processUid: this.processUid,
2966
+ processGid: this.processGid,
2967
+ umask: this.processUmask,
2968
+ preserve: this.preservePaths,
2969
+ unlink: this.unlink,
2970
+ cache: this.dirCache,
2971
+ cwd: this.cwd,
2972
+ mode: i,
2973
+ noChmod: this.noChmod
2974
+ }, e);
2975
+ }
2976
+ [E](s) {
2977
+ return this.forceChown || this.preserveOwner && (typeof s.uid == "number" && s.uid !== this.processUid || typeof s.gid == "number" && s.gid !== this.processGid) || typeof this.uid == "number" && this.uid !== this.processUid || typeof this.gid == "number" && this.gid !== this.processGid;
2978
+ }
2979
+ [R](s) {
2980
+ return Q(this.uid, s.uid, this.processUid);
2981
+ }
2982
+ [_](s) {
2983
+ return Q(this.gid, s.gid, this.processGid);
2984
+ }
2985
+ [U$1](s, i) {
2986
+ const e = s.mode & 4095 || this.fmode, t = new es.WriteStream(s.absolute, {
2987
+ flags: J(s.size),
2988
+ mode: e,
2989
+ autoClose: false
2990
+ });
2991
+ t.on("error", (c$1) => {
2992
+ t.fd && r.close(t.fd, () => {}), t.write = () => true, this[m](c$1, s), i();
2993
+ });
2994
+ let o = 1;
2995
+ const u = (c$1) => {
2996
+ if (c$1) {
2997
+ t.fd && r.close(t.fd, () => {}), this[m](c$1, s), i();
2998
+ return;
2999
+ }
3000
+ --o === 0 && r.close(t.fd, (n) => {
3001
+ n ? this[m](n, s) : this[S](), i();
3002
+ });
3003
+ };
3004
+ t.on("finish", (c$1) => {
3005
+ const n = s.absolute, p = t.fd;
3006
+ if (s.mtime && !this.noMtime) {
3007
+ o++;
3008
+ const f = s.atime || /* @__PURE__ */ new Date(), k = s.mtime;
3009
+ r.futimes(p, f, k, (D$1) => D$1 ? r.utimes(n, f, k, (I$1) => u(I$1 && D$1)) : u());
3010
+ }
3011
+ if (this[E](s)) {
3012
+ o++;
3013
+ const f = this[R](s), k = this[_](s);
3014
+ r.fchown(p, f, k, (D$1) => D$1 ? r.chown(n, f, k, (I$1) => u(I$1 && D$1)) : u());
3015
+ }
3016
+ u();
3017
+ });
3018
+ const h$2 = this.transform && this.transform(s) || s;
3019
+ h$2 !== s && (h$2.on("error", (c$1) => {
3020
+ this[m](c$1, s), i();
3021
+ }), s.pipe(h$2)), h$2.pipe(t);
3022
+ }
3023
+ [F$1](s, i) {
3024
+ const e = s.mode & 4095 || this.dmode;
3025
+ this[b$1](s.absolute, e, (t) => {
3026
+ if (t) {
3027
+ this[m](t, s), i();
3028
+ return;
3029
+ }
3030
+ let o = 1;
3031
+ const u = (h$2) => {
3032
+ --o === 0 && (i(), this[S](), s.resume());
3033
+ };
3034
+ s.mtime && !this.noMtime && (o++, r.utimes(s.absolute, s.atime || /* @__PURE__ */ new Date(), s.mtime, u)), this[E](s) && (o++, r.chown(s.absolute, this[R](s), this[_](s), u)), u();
3035
+ });
3036
+ }
3037
+ [W$1](s) {
3038
+ s.unsupported = true, this.warn("TAR_ENTRY_UNSUPPORTED", `unsupported entry type: ${s.type}`, { entry: s }), s.resume();
3039
+ }
3040
+ [B$1](s, i) {
3041
+ this[O](s, s.linkpath, "symlink", i);
3042
+ }
3043
+ [z$1$1](s, i) {
3044
+ const e = l(w.resolve(this.cwd, s.linkpath));
3045
+ this[O](s, e, "link", i);
3046
+ }
3047
+ [V$1]() {
3048
+ this[$]++;
3049
+ }
3050
+ [S]() {
3051
+ this[$]--, this[A$1]();
3052
+ }
3053
+ [x$1](s) {
3054
+ this[S](), s.resume();
3055
+ }
3056
+ [N$1](s, i) {
3057
+ return s.type === "File" && !this.unlink && i.isFile() && i.nlink <= 1 && !C;
3058
+ }
3059
+ [q](s) {
3060
+ this[V$1]();
3061
+ const i = [s.path];
3062
+ s.linkpath && i.push(s.linkpath), this.reservations.reserve(i, (e) => this[Y](s, e));
3063
+ }
3064
+ [v](s) {
3065
+ s.type === "SymbolicLink" ? ms(this.dirCache) : s.type !== "Directory" && ns(this.dirCache, s.absolute);
3066
+ }
3067
+ [Y](s, i) {
3068
+ this[v](s);
3069
+ const e = (h$2) => {
3070
+ this[v](s), i(h$2);
3071
+ }, t = () => {
3072
+ this[b$1](this.cwd, this.dmode, (h$2) => {
3073
+ if (h$2) {
3074
+ this[m](h$2, s), e();
3075
+ return;
3076
+ }
3077
+ this[g$1] = true, o();
3078
+ });
3079
+ }, o = () => {
3080
+ if (s.absolute !== this.cwd) {
3081
+ const h$2 = l(w.dirname(s.absolute));
3082
+ if (h$2 !== this.cwd) return this[b$1](h$2, this.dmode, (c$1) => {
3083
+ if (c$1) {
3084
+ this[m](c$1, s), e();
3085
+ return;
3086
+ }
3087
+ u();
3088
+ });
3089
+ }
3090
+ u();
3091
+ }, u = () => {
3092
+ r.lstat(s.absolute, (h$2, c$1) => {
3093
+ if (c$1 && (this.keep || this.newer && c$1.mtime > s.mtime)) {
3094
+ this[x$1](s), e();
3095
+ return;
3096
+ }
3097
+ if (h$2 || this[N$1](s, c$1)) return this[d$1](null, s, e);
3098
+ if (c$1.isDirectory()) {
3099
+ if (s.type === "Directory") {
3100
+ const n = !this.noChmod && s.mode && (c$1.mode & 4095) !== s.mode, p = (f) => this[d$1](f, s, e);
3101
+ return n ? r.chmod(s.absolute, s.mode, p) : p();
3102
+ }
3103
+ if (s.absolute !== this.cwd) return r.rmdir(s.absolute, (n) => this[d$1](n, s, e));
3104
+ }
3105
+ if (s.absolute === this.cwd) return this[d$1](null, s, e);
3106
+ as(s.absolute, (n) => this[d$1](n, s, e));
3107
+ });
3108
+ };
3109
+ this[g$1] ? o() : t();
3110
+ }
3111
+ [d$1](s, i, e) {
3112
+ if (s) {
3113
+ this[m](s, i), e();
3114
+ return;
3115
+ }
3116
+ switch (i.type) {
3117
+ case "File":
3118
+ case "OldFile":
3119
+ case "ContiguousFile": return this[U$1](i, e);
3120
+ case "Link": return this[z$1$1](i, e);
3121
+ case "SymbolicLink": return this[B$1](i, e);
3122
+ case "Directory":
3123
+ case "GNUDumpDir": return this[F$1](i, e);
3124
+ }
3125
+ }
3126
+ [O](s, i, e, t) {
3127
+ r[e](i, s.absolute, (o) => {
3128
+ o ? this[m](o, s) : (this[S](), s.resume()), t();
3129
+ });
3130
+ }
3131
+ }
3132
+ const T = (a) => {
3133
+ try {
3134
+ return [null, a()];
3135
+ } catch (s) {
3136
+ return [s, null];
3137
+ }
3138
+ };
3139
+ class ls extends L {
3140
+ [d$1](s, i) {
3141
+ return super[d$1](s, i, () => {});
3142
+ }
3143
+ [q](s) {
3144
+ if (this[v](s), !this[g$1]) {
3145
+ const o = this[b$1](this.cwd, this.dmode);
3146
+ if (o) return this[m](o, s);
3147
+ this[g$1] = true;
3148
+ }
3149
+ if (s.absolute !== this.cwd) {
3150
+ const o = l(w.dirname(s.absolute));
3151
+ if (o !== this.cwd) {
3152
+ const u = this[b$1](o, this.dmode);
3153
+ if (u) return this[m](u, s);
3154
+ }
3155
+ }
3156
+ const [i, e] = T(() => r.lstatSync(s.absolute));
3157
+ if (e && (this.keep || this.newer && e.mtime > s.mtime)) return this[x$1](s);
3158
+ if (i || this[N$1](s, e)) return this[d$1](null, s);
3159
+ if (e.isDirectory()) {
3160
+ if (s.type === "Directory") {
3161
+ const [h$2] = !this.noChmod && s.mode && (e.mode & 4095) !== s.mode ? T(() => {
3162
+ r.chmodSync(s.absolute, s.mode);
3163
+ }) : [];
3164
+ return this[d$1](h$2, s);
3165
+ }
3166
+ const [o] = T(() => r.rmdirSync(s.absolute));
3167
+ this[d$1](o, s);
3168
+ }
3169
+ const [t] = s.absolute === this.cwd ? [] : T(() => us(s.absolute));
3170
+ this[d$1](t, s);
3171
+ }
3172
+ [U$1](s, i) {
3173
+ const e = s.mode & 4095 || this.fmode, t = (h$2) => {
3174
+ let c$1;
3175
+ try {
3176
+ r.closeSync(o);
3177
+ } catch (n) {
3178
+ c$1 = n;
3179
+ }
3180
+ (h$2 || c$1) && this[m](h$2 || c$1, s), i();
3181
+ };
3182
+ let o;
3183
+ try {
3184
+ o = r.openSync(s.absolute, J(s.size), e);
3185
+ } catch (h$2) {
3186
+ return t(h$2);
3187
+ }
3188
+ const u = this.transform && this.transform(s) || s;
3189
+ u !== s && (u.on("error", (h$2) => this[m](h$2, s)), s.pipe(u)), u.on("data", (h$2) => {
3190
+ try {
3191
+ r.writeSync(o, h$2, 0, h$2.length);
3192
+ } catch (c$1) {
3193
+ t(c$1);
3194
+ }
3195
+ }), u.on("end", (h$2) => {
3196
+ let c$1 = null;
3197
+ if (s.mtime && !this.noMtime) {
3198
+ const n = s.atime || /* @__PURE__ */ new Date(), p = s.mtime;
3199
+ try {
3200
+ r.futimesSync(o, n, p);
3201
+ } catch (f) {
3202
+ try {
3203
+ r.utimesSync(s.absolute, n, p);
3204
+ } catch {
3205
+ c$1 = f;
3206
+ }
3207
+ }
3208
+ }
3209
+ if (this[E](s)) {
3210
+ const n = this[R](s), p = this[_](s);
3211
+ try {
3212
+ r.fchownSync(o, n, p);
3213
+ } catch (f) {
3214
+ try {
3215
+ r.chownSync(s.absolute, n, p);
3216
+ } catch {
3217
+ c$1 = c$1 || f;
3218
+ }
3219
+ }
3220
+ }
3221
+ t(c$1);
3222
+ });
3223
+ }
3224
+ [F$1](s, i) {
3225
+ const e = s.mode & 4095 || this.dmode, t = this[b$1](s.absolute, e);
3226
+ if (t) {
3227
+ this[m](t, s), i();
3228
+ return;
3229
+ }
3230
+ if (s.mtime && !this.noMtime) try {
3231
+ r.utimesSync(s.absolute, s.atime || /* @__PURE__ */ new Date(), s.mtime);
3232
+ } catch {}
3233
+ if (this[E](s)) try {
3234
+ r.chownSync(s.absolute, this[R](s), this[_](s));
3235
+ } catch {}
3236
+ i(), s.resume();
3237
+ }
3238
+ [b$1](s, i) {
3239
+ try {
3240
+ return M$1.sync(l(s), {
3241
+ uid: this.uid,
3242
+ gid: this.gid,
3243
+ processUid: this.processUid,
3244
+ processGid: this.processGid,
3245
+ umask: this.processUmask,
3246
+ preserve: this.preservePaths,
3247
+ unlink: this.unlink,
3248
+ cache: this.dirCache,
3249
+ cwd: this.cwd,
3250
+ mode: i
3251
+ });
3252
+ } catch (e) {
3253
+ return e;
3254
+ }
3255
+ }
3256
+ [O](s, i, e, t) {
3257
+ try {
3258
+ r[e + "Sync"](i, s.absolute), t(), s.resume();
3259
+ } catch (o) {
3260
+ return this[m](o, s);
3261
+ }
3262
+ }
3263
+ }
3264
+ return L.Sync = ls, G = L, G;
3265
+ }
3266
+ var f, q;
3267
+ function v() {
3268
+ if (q) return f;
3269
+ q = 1;
3270
+ const w = s$6(), u = Os(), p = nativeFs, y = X(), l = path, m = s();
3271
+ f = (r, e, o) => {
3272
+ typeof r == "function" ? (o = r, e = null, r = {}) : Array.isArray(r) && (e = r, r = {}), typeof e == "function" && (o = e, e = null), e ? e = Array.from(e) : e = [];
3273
+ const t = w(r);
3274
+ if (t.sync && typeof o == "function") throw new TypeError("callback not supported for sync tar functions");
3275
+ if (!t.file && typeof o == "function") throw new TypeError("callback only supported with file option");
3276
+ return e.length && d$1(t, e), t.file && t.sync ? $(t) : t.file ? h$2(t, o) : t.sync ? x$1(t) : z(t);
3277
+ };
3278
+ const d$1 = (r, e) => {
3279
+ const o = new Map(e.map((n) => [m(n), true])), t = r.filter, s = (n, i) => {
3280
+ const a = i || l.parse(n).root || ".", c$1 = n === a ? false : o.has(n) ? o.get(n) : s(l.dirname(n), a);
3281
+ return o.set(n, c$1), c$1;
3282
+ };
3283
+ r.filter = t ? (n, i) => t(n, i) && s(m(n)) : (n) => s(m(n));
3284
+ }, $ = (r) => {
3285
+ const e = new u.Sync(r), o = r.file, t = p.statSync(o), s = r.maxReadSize || 16 * 1024 * 1024;
3286
+ new y.ReadStreamSync(o, {
3287
+ readSize: s,
3288
+ size: t.size
3289
+ }).pipe(e);
3290
+ }, h$2 = (r, e) => {
3291
+ const o = new u(r), t = r.maxReadSize || 16 * 1024 * 1024, s = r.file, n = new Promise((i, a) => {
3292
+ o.on("error", a), o.on("close", i), p.stat(s, (c$1, R) => {
3293
+ if (c$1) a(c$1);
3294
+ else {
3295
+ const S = new y.ReadStream(s, {
3296
+ readSize: t,
3297
+ size: R.size
3298
+ });
3299
+ S.on("error", a), S.pipe(o);
3300
+ }
3301
+ });
3302
+ });
3303
+ return e ? n.then(e, e) : n;
3304
+ }, x$1 = (r) => new u.Sync(r), z = (r) => new u(r);
3305
+ return f;
3306
+ }
3307
+ const tarExtract = getDefaultExportFromCjs(v());
3308
+ async function download(url, filePath, options = {}) {
3309
+ const infoPath = filePath + ".json";
3310
+ const info = JSON.parse(await readFile(infoPath, "utf8").catch(() => "{}"));
3311
+ const etag = (await sendFetch(url, {
3312
+ method: "HEAD",
3313
+ headers: options.headers
3314
+ }).catch(() => void 0))?.headers.get("etag");
3315
+ if (info.etag === etag && existsSync(filePath)) return;
3316
+ if (typeof etag === "string") info.etag = etag;
3317
+ const response = await sendFetch(url, { headers: options.headers });
3318
+ if (response.status >= 400) throw new Error(`Failed to download ${url}: ${response.status} ${response.statusText}`);
3319
+ const stream = createWriteStream(filePath);
3320
+ await promisify(pipeline)(response.body, stream);
3321
+ await writeFile(infoPath, JSON.stringify(info), "utf8");
3322
+ }
3323
+ const inputRegex = /^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/;
3324
+ function parseGitURI(input) {
3325
+ const m = input.match(inputRegex)?.groups || {};
3326
+ return {
3327
+ repo: m.repo,
3328
+ subdir: m.subdir || "/",
3329
+ ref: m.ref ? m.ref.slice(1) : "main"
3330
+ };
3331
+ }
3332
+ function debug(...args) {
3333
+ if (process.env.DEBUG) console.debug("[giget]", ...args);
3334
+ }
3335
+ async function sendFetch(url, options = {}) {
3336
+ if (options.headers?.["sec-fetch-mode"]) options.mode = options.headers["sec-fetch-mode"];
3337
+ const res = await l$1(url, {
3338
+ ...options,
3339
+ headers: normalizeHeaders(options.headers)
3340
+ }).catch((error) => {
3341
+ throw new Error(`Failed to download ${url}: ${error}`, { cause: error });
3342
+ });
3343
+ if (options.validateStatus && res.status >= 400) throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`);
3344
+ return res;
3345
+ }
3346
+ function cacheDirectory() {
3347
+ const cacheDir = process.env.XDG_CACHE_HOME ? resolve$2(process.env.XDG_CACHE_HOME, "giget") : resolve$2(homedir(), ".cache/giget");
3348
+ if (process.platform === "win32") {
3349
+ const windowsCacheDir = resolve$2(tmpdir(), "giget");
3350
+ if (!existsSync(windowsCacheDir) && existsSync(cacheDir)) try {
3351
+ renameSync(cacheDir, windowsCacheDir);
3352
+ } catch {}
3353
+ return windowsCacheDir;
3354
+ }
3355
+ return cacheDir;
3356
+ }
3357
+ function normalizeHeaders(headers = {}) {
3358
+ const normalized = {};
3359
+ for (const [key, value] of Object.entries(headers)) {
3360
+ if (!value) continue;
3361
+ normalized[key.toLowerCase()] = value;
3362
+ }
3363
+ return normalized;
3364
+ }
3365
+ const http = async (input, options) => {
3366
+ if (input.endsWith(".json")) return await _httpJSON(input, options);
3367
+ const url = new URL(input);
3368
+ let name = basename$2(url.pathname);
3369
+ try {
3370
+ const head = await sendFetch(url.href, {
3371
+ method: "HEAD",
3372
+ validateStatus: true,
3373
+ headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 }
3374
+ });
3375
+ if ((head.headers.get("content-type") || "").includes("application/json")) return await _httpJSON(input, options);
3376
+ const filename = head.headers.get("content-disposition")?.match(/filename="?(.+)"?/)?.[1];
3377
+ if (filename) name = filename.split(".")[0];
3378
+ } catch (error) {
3379
+ debug(`Failed to fetch HEAD for ${url.href}:`, error);
3380
+ }
3381
+ return {
3382
+ name: `${name}-${url.href.slice(0, 8)}`,
3383
+ version: "",
3384
+ subdir: "",
3385
+ tar: url.href,
3386
+ defaultDir: name,
3387
+ headers: { Authorization: options.auth ? `Bearer ${options.auth}` : void 0 }
3388
+ };
3389
+ };
3390
+ const _httpJSON = async (input, options) => {
3391
+ const info = await (await sendFetch(input, {
3392
+ validateStatus: true,
3393
+ headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 }
3394
+ })).json();
3395
+ if (!info.tar || !info.name) throw new Error(`Invalid template info from ${input}. name or tar fields are missing!`);
3396
+ return info;
3397
+ };
3398
+ const github = (input, options) => {
3399
+ const parsed = parseGitURI(input);
3400
+ const githubAPIURL = process.env.GIGET_GITHUB_URL || "https://api.github.com";
3401
+ return {
3402
+ name: parsed.repo.replace("/", "-"),
3403
+ version: parsed.ref,
3404
+ subdir: parsed.subdir,
3405
+ headers: {
3406
+ Authorization: options.auth ? `Bearer ${options.auth}` : void 0,
3407
+ Accept: "application/vnd.github+json",
3408
+ "X-GitHub-Api-Version": "2022-11-28"
3409
+ },
3410
+ url: `${githubAPIURL.replace("api.github.com", "github.com")}/${parsed.repo}/tree/${parsed.ref}${parsed.subdir}`,
3411
+ tar: `${githubAPIURL}/repos/${parsed.repo}/tarball/${parsed.ref}`
3412
+ };
3413
+ };
3414
+ const gitlab = (input, options) => {
3415
+ const parsed = parseGitURI(input);
3416
+ const gitlab2 = process.env.GIGET_GITLAB_URL || "https://gitlab.com";
3417
+ return {
3418
+ name: parsed.repo.replace("/", "-"),
3419
+ version: parsed.ref,
3420
+ subdir: parsed.subdir,
3421
+ headers: {
3422
+ authorization: options.auth ? `Bearer ${options.auth}` : void 0,
3423
+ "sec-fetch-mode": "same-origin"
3424
+ },
3425
+ url: `${gitlab2}/${parsed.repo}/tree/${parsed.ref}${parsed.subdir}`,
3426
+ tar: `${gitlab2}/${parsed.repo}/-/archive/${parsed.ref}.tar.gz`
3427
+ };
3428
+ };
3429
+ const bitbucket = (input, options) => {
3430
+ const parsed = parseGitURI(input);
3431
+ return {
3432
+ name: parsed.repo.replace("/", "-"),
3433
+ version: parsed.ref,
3434
+ subdir: parsed.subdir,
3435
+ headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 },
3436
+ url: `https://bitbucket.com/${parsed.repo}/src/${parsed.ref}${parsed.subdir}`,
3437
+ tar: `https://bitbucket.org/${parsed.repo}/get/${parsed.ref}.tar.gz`
3438
+ };
3439
+ };
3440
+ const sourcehut = (input, options) => {
3441
+ const parsed = parseGitURI(input);
3442
+ return {
3443
+ name: parsed.repo.replace("/", "-"),
3444
+ version: parsed.ref,
3445
+ subdir: parsed.subdir,
3446
+ headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 },
3447
+ url: `https://git.sr.ht/~${parsed.repo}/tree/${parsed.ref}/item${parsed.subdir}`,
3448
+ tar: `https://git.sr.ht/~${parsed.repo}/archive/${parsed.ref}.tar.gz`
3449
+ };
3450
+ };
3451
+ const providers = {
3452
+ http,
3453
+ https: http,
3454
+ github,
3455
+ gh: github,
3456
+ gitlab,
3457
+ bitbucket,
3458
+ sourcehut
3459
+ };
3460
+ const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/unjs/giget/main/templates";
3461
+ const registryProvider = (registryEndpoint = DEFAULT_REGISTRY, options = {}) => {
3462
+ return async (input) => {
3463
+ const start = Date.now();
3464
+ const registryURL = `${registryEndpoint}/${input}.json`;
3465
+ const result = await sendFetch(registryURL, { headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 } });
3466
+ if (result.status >= 400) throw new Error(`Failed to download ${input} template info from ${registryURL}: ${result.status} ${result.statusText}`);
3467
+ const info = await result.json();
3468
+ if (!info.tar || !info.name) throw new Error(`Invalid template info from ${registryURL}. name or tar fields are missing!`);
3469
+ debug(`Fetched ${input} template info from ${registryURL} in ${Date.now() - start}ms`);
3470
+ return info;
3471
+ };
3472
+ };
3473
+ const sourceProtoRe = /^([\w-.]+):/;
3474
+ async function downloadTemplate(input, options = {}) {
3475
+ options = defu({
3476
+ registry: process.env.GIGET_REGISTRY,
3477
+ auth: process.env.GIGET_AUTH
3478
+ }, options);
3479
+ const registry = options.registry === false ? void 0 : registryProvider(options.registry, { auth: options.auth });
3480
+ let providerName = options.provider || (registry ? "registry" : "github");
3481
+ let source = input;
3482
+ const sourceProviderMatch = input.match(sourceProtoRe);
3483
+ if (sourceProviderMatch) {
3484
+ providerName = sourceProviderMatch[1];
3485
+ source = input.slice(sourceProviderMatch[0].length);
3486
+ if (providerName === "http" || providerName === "https") source = input;
3487
+ }
3488
+ const provider = options.providers?.[providerName] || providers[providerName] || registry;
3489
+ if (!provider) throw new Error(`Unsupported provider: ${providerName}`);
3490
+ const template = await Promise.resolve().then(() => provider(source, { auth: options.auth })).catch((error) => {
3491
+ throw new Error(`Failed to download template from ${providerName}: ${error.message}`);
3492
+ });
3493
+ if (!template) throw new Error(`Failed to resolve template from ${providerName}`);
3494
+ template.name = (template.name || "template").replace(/[^\da-z-]/gi, "-");
3495
+ template.defaultDir = (template.defaultDir || template.name).replace(/[^\da-z-]/gi, "-");
3496
+ const tarPath = resolve$2(resolve$2(cacheDirectory(), providerName, template.name), (template.version || template.name) + ".tar.gz");
3497
+ if (options.preferOffline && existsSync(tarPath)) options.offline = true;
3498
+ if (!options.offline) {
3499
+ await mkdir(dirname$2(tarPath), { recursive: true });
3500
+ const s2 = Date.now();
3501
+ await download(template.tar, tarPath, { headers: {
3502
+ Authorization: options.auth ? `Bearer ${options.auth}` : void 0,
3503
+ ...normalizeHeaders(template.headers)
3504
+ } }).catch((error) => {
3505
+ if (!existsSync(tarPath)) throw error;
3506
+ debug("Download error. Using cached version:", error);
3507
+ options.offline = true;
3508
+ });
3509
+ debug(`Downloaded ${template.tar} to ${tarPath} in ${Date.now() - s2}ms`);
3510
+ }
3511
+ if (!existsSync(tarPath)) throw new Error(`Tarball not found: ${tarPath} (offline: ${options.offline})`);
3512
+ const extractPath = resolve$2(resolve$2(options.cwd || "."), options.dir || template.defaultDir);
3513
+ if (options.forceClean) await rm(extractPath, {
3514
+ recursive: true,
3515
+ force: true
3516
+ });
3517
+ if (!options.force && existsSync(extractPath) && readdirSync(extractPath).length > 0) throw new Error(`Destination ${extractPath} already exists.`);
3518
+ await mkdir(extractPath, { recursive: true });
3519
+ const s = Date.now();
3520
+ const subdir = template.subdir?.replace(/^\//, "") || "";
3521
+ await tarExtract({
3522
+ file: tarPath,
3523
+ cwd: extractPath,
3524
+ onentry(entry) {
3525
+ entry.path = entry.path.split("/").splice(1).join("/");
3526
+ if (subdir) if (entry.path.startsWith(subdir + "/")) entry.path = entry.path.slice(subdir.length);
3527
+ else entry.path = "";
3528
+ }
3529
+ });
3530
+ debug(`Extracted to ${extractPath} in ${Date.now() - s}ms`);
3531
+ if (options.install) {
3532
+ debug("Installing dependencies...");
3533
+ await installDependencies({
3534
+ cwd: extractPath,
3535
+ silent: options.silent
3536
+ });
3537
+ }
3538
+ return {
3539
+ ...template,
3540
+ source,
3541
+ dir: extractPath
3542
+ };
3543
+ }
3544
+
3545
+ //#endregion
3546
+ //#region node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.mjs
3547
+ var dist_exports = /* @__PURE__ */ __exportAll({ downloadTemplate: () => downloadTemplate });
3548
+
3549
+ //#endregion
3550
+ export { dist_exports$1 as n, dist_exports as t };