clanka 0.7.3 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/Acp.d.ts +10 -0
  2. package/dist/Acp.d.ts.map +1 -1
  3. package/dist/Acp.js +1 -2
  4. package/dist/Acp.js.map +1 -1
  5. package/dist/AgentTools.d.ts.map +1 -1
  6. package/dist/AgentTools.js +1 -2
  7. package/dist/AgentTools.js.map +1 -1
  8. package/dist/GlobalWebSocket.d.ts +15 -0
  9. package/dist/GlobalWebSocket.d.ts.map +1 -0
  10. package/dist/GlobalWebSocket.js +26 -0
  11. package/dist/GlobalWebSocket.js.map +1 -0
  12. package/dist/WebToMarkdown.d.ts.map +1 -1
  13. package/dist/WebToMarkdown.js +8 -4
  14. package/dist/WebToMarkdown.js.map +1 -1
  15. package/dist/bin/Effect-DdkIoNCD.mjs +5058 -0
  16. package/dist/bin/Effect-DdkIoNCD.mjs.map +1 -0
  17. package/dist/bin/{McpClient-D6vFD-wP.mjs → McpClient-CJ0Vugoi.mjs} +582 -2896
  18. package/dist/bin/{McpClient-D6vFD-wP.mjs.map → McpClient-CJ0Vugoi.mjs.map} +1 -1
  19. package/dist/bin/OutputFormatter-DN8OGwuK.mjs +575 -0
  20. package/dist/bin/OutputFormatter-DN8OGwuK.mjs.map +1 -0
  21. package/dist/bin/Schema-BALIXGp7.mjs +5475 -0
  22. package/dist/bin/Schema-BALIXGp7.mjs.map +1 -0
  23. package/dist/bin/{SemanticSearch-D9iZ_Mi9.mjs → SemanticSearch-O6PZBRfd.mjs} +147 -1160
  24. package/dist/bin/{SemanticSearch-D9iZ_Mi9.mjs.map → SemanticSearch-O6PZBRfd.mjs.map} +1 -1
  25. package/dist/bin/Stream-B5ebASRi.mjs +2090 -0
  26. package/dist/bin/Stream-B5ebASRi.mjs.map +1 -0
  27. package/dist/bin/cli.mjs +9629 -41431
  28. package/dist/bin/cli.mjs.map +1 -1
  29. package/dist/bin/index.min-CI3qqohw.mjs +3300 -0
  30. package/dist/bin/index.min-CI3qqohw.mjs.map +1 -0
  31. package/dist/bin/turndown.cjs-usmCKZ4b.mjs +15195 -0
  32. package/dist/bin/turndown.cjs-usmCKZ4b.mjs.map +1 -0
  33. package/dist/cli.d.ts +1 -1
  34. package/dist/cli.js +10 -6
  35. package/dist/cli.js.map +1 -1
  36. package/dist/index.d.ts +4 -0
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +4 -0
  39. package/dist/index.js.map +1 -1
  40. package/package.json +2 -4
  41. package/src/Acp.ts +1 -2
  42. package/src/AgentTools.ts +3 -2
  43. package/src/GlobalWebSocket.ts +40 -0
  44. package/src/WebToMarkdown.ts +17 -7
  45. package/src/cli.ts +15 -6
  46. package/src/index.ts +5 -0
  47. package/dist/bin/Schema-D6y3R-At.mjs +0 -28728
  48. package/dist/bin/Schema-D6y3R-At.mjs.map +0 -1
  49. package/dist/bin/Undici-ChB4UBDa.mjs +0 -28
  50. package/dist/bin/Undici-ChB4UBDa.mjs.map +0 -1
@@ -0,0 +1,3300 @@
1
+ import Pe from "node:stream";
2
+ import * as xi from "node:fs";
3
+ import { posix, win32 } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { EventEmitter } from "node:events";
6
+ import { lstat, readdir, readlink, realpath } from "node:fs/promises";
7
+ import { lstatSync, readdir as readdir$1, readdirSync, readlinkSync, realpathSync } from "fs";
8
+ import { StringDecoder } from "node:string_decoder";
9
+ //#region node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.js
10
+ var Gt = (n, t, e) => {
11
+ let s = n instanceof RegExp ? ce(n, e) : n, i = t instanceof RegExp ? ce(t, e) : t, r = s !== null && i != null && ss(s, i, e);
12
+ return r && {
13
+ start: r[0],
14
+ end: r[1],
15
+ pre: e.slice(0, r[0]),
16
+ body: e.slice(r[0] + s.length, r[1]),
17
+ post: e.slice(r[1] + i.length)
18
+ };
19
+ };
20
+ var ce = (n, t) => {
21
+ let e = t.match(n);
22
+ return e ? e[0] : null;
23
+ };
24
+ var ss = (n, t, e) => {
25
+ let s, i, r, o, h, a = e.indexOf(n), l = e.indexOf(t, a + 1), u = a;
26
+ if (a >= 0 && l > 0) {
27
+ if (n === t) return [a, l];
28
+ for (s = [], r = e.length; u >= 0 && !h;) {
29
+ if (u === a) s.push(u), a = e.indexOf(n, u + 1);
30
+ else if (s.length === 1) {
31
+ let c = s.pop();
32
+ c !== void 0 && (h = [c, l]);
33
+ } else i = s.pop(), i !== void 0 && i < r && (r = i, o = l), l = e.indexOf(t, u + 1);
34
+ u = a < l && a >= 0 ? a : l;
35
+ }
36
+ s.length && o !== void 0 && (h = [r, o]);
37
+ }
38
+ return h;
39
+ };
40
+ var fe = "\0SLASH" + Math.random() + "\0";
41
+ var ue = "\0OPEN" + Math.random() + "\0";
42
+ var qt = "\0CLOSE" + Math.random() + "\0";
43
+ var de = "\0COMMA" + Math.random() + "\0";
44
+ var pe = "\0PERIOD" + Math.random() + "\0";
45
+ var is = new RegExp(fe, "g");
46
+ var rs = new RegExp(ue, "g");
47
+ var ns = new RegExp(qt, "g");
48
+ var os = new RegExp(de, "g");
49
+ var hs = new RegExp(pe, "g");
50
+ var as = /\\\\/g;
51
+ var ls = /\\{/g;
52
+ var cs = /\\}/g;
53
+ var fs = /\\,/g;
54
+ var us = /\\./g;
55
+ var ds = 1e5;
56
+ function Ht(n) {
57
+ return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
58
+ }
59
+ function ps(n) {
60
+ return n.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs, de).replace(us, pe);
61
+ }
62
+ function ms(n) {
63
+ return n.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os, ",").replace(hs, ".");
64
+ }
65
+ function me(n) {
66
+ if (!n) return [""];
67
+ let t = [], e = Gt("{", "}", n);
68
+ if (!e) return n.split(",");
69
+ let { pre: s, body: i, post: r } = e, o = s.split(",");
70
+ o[o.length - 1] += "{" + i + "}";
71
+ let h = me(r);
72
+ return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
73
+ }
74
+ function ge(n, t = {}) {
75
+ if (!n) return [];
76
+ let { max: e = ds } = t;
77
+ return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), ht(ps(n), e, !0).map(ms);
78
+ }
79
+ function gs(n) {
80
+ return "{" + n + "}";
81
+ }
82
+ function ws(n) {
83
+ return /^-?0\d/.test(n);
84
+ }
85
+ function ys(n, t) {
86
+ return n <= t;
87
+ }
88
+ function bs(n, t) {
89
+ return n >= t;
90
+ }
91
+ function ht(n, t, e) {
92
+ let s = [], i = Gt("{", "}", n);
93
+ if (!i) return [n];
94
+ let r = i.pre, o = i.post.length ? ht(i.post, t, !1) : [""];
95
+ if (/\$$/.test(i.pre)) for (let h = 0; h < o.length && h < t; h++) {
96
+ let a = r + "{" + i.body + "}" + o[h];
97
+ s.push(a);
98
+ }
99
+ else {
100
+ let h = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), l = h || a, u = i.body.indexOf(",") >= 0;
101
+ if (!l && !u) return i.post.match(/,(?!,).*\}/) ? (n = i.pre + "{" + i.body + qt + i.post, ht(n, t, !0)) : [n];
102
+ let c;
103
+ if (l) c = i.body.split(/\.\./);
104
+ else if (c = me(i.body), c.length === 1 && c[0] !== void 0 && (c = ht(c[0], t, !1).map(gs), c.length === 1)) return o.map((f) => i.pre + c[0] + f);
105
+ let d;
106
+ if (l && c[0] !== void 0 && c[1] !== void 0) {
107
+ let f = Ht(c[0]), m = Ht(c[1]), p = Math.max(c[0].length, c[1].length), w = c.length === 3 && c[2] !== void 0 ? Math.abs(Ht(c[2])) : 1, g = ys;
108
+ m < f && (w *= -1, g = bs);
109
+ let E = c.some(ws);
110
+ d = [];
111
+ for (let y = f; g(y, m); y += w) {
112
+ let b;
113
+ if (a) b = String.fromCharCode(y), b === "\\" && (b = "");
114
+ else if (b = String(y), E) {
115
+ let z = p - b.length;
116
+ if (z > 0) {
117
+ let $ = new Array(z + 1).join("0");
118
+ y < 0 ? b = "-" + $ + b.slice(1) : b = $ + b;
119
+ }
120
+ }
121
+ d.push(b);
122
+ }
123
+ } else {
124
+ d = [];
125
+ for (let f = 0; f < c.length; f++) d.push.apply(d, ht(c[f], t, !1));
126
+ }
127
+ for (let f = 0; f < d.length; f++) for (let m = 0; m < o.length && s.length < t; m++) {
128
+ let p = r + d[f] + o[m];
129
+ (!e || l || p) && s.push(p);
130
+ }
131
+ }
132
+ return s;
133
+ }
134
+ var at = (n) => {
135
+ if (typeof n != "string") throw new TypeError("invalid pattern");
136
+ if (n.length > 65536) throw new TypeError("pattern is too long");
137
+ };
138
+ var Ss = {
139
+ "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
140
+ "[:alpha:]": ["\\p{L}\\p{Nl}", !0],
141
+ "[:ascii:]": ["\\x00-\\x7f", !1],
142
+ "[:blank:]": ["\\p{Zs}\\t", !0],
143
+ "[:cntrl:]": ["\\p{Cc}", !0],
144
+ "[:digit:]": ["\\p{Nd}", !0],
145
+ "[:graph:]": [
146
+ "\\p{Z}\\p{C}",
147
+ !0,
148
+ !0
149
+ ],
150
+ "[:lower:]": ["\\p{Ll}", !0],
151
+ "[:print:]": ["\\p{C}", !0],
152
+ "[:punct:]": ["\\p{P}", !0],
153
+ "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", !0],
154
+ "[:upper:]": ["\\p{Lu}", !0],
155
+ "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
156
+ "[:xdigit:]": ["A-Fa-f0-9", !1]
157
+ };
158
+ var lt = (n) => n.replace(/[[\]\\-]/g, "\\$&");
159
+ var Es = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
160
+ var we = (n) => n.join("");
161
+ var ye = (n, t) => {
162
+ let e = t;
163
+ if (n.charAt(e) !== "[") throw new Error("not in a brace expression");
164
+ let s = [], i = [], r = e + 1, o = !1, h = !1, a = !1, l = !1, u = e, c = "";
165
+ t: for (; r < n.length;) {
166
+ let p = n.charAt(r);
167
+ if ((p === "!" || p === "^") && r === e + 1) {
168
+ l = !0, r++;
169
+ continue;
170
+ }
171
+ if (p === "]" && o && !a) {
172
+ u = r + 1;
173
+ break;
174
+ }
175
+ if (o = !0, p === "\\" && !a) {
176
+ a = !0, r++;
177
+ continue;
178
+ }
179
+ if (p === "[" && !a) {
180
+ for (let [w, [g, S, E]] of Object.entries(Ss)) if (n.startsWith(w, r)) {
181
+ if (c) return [
182
+ "$.",
183
+ !1,
184
+ n.length - e,
185
+ !0
186
+ ];
187
+ r += w.length, E ? i.push(g) : s.push(g), h = h || S;
188
+ continue t;
189
+ }
190
+ }
191
+ if (a = !1, c) {
192
+ p > c ? s.push(lt(c) + "-" + lt(p)) : p === c && s.push(lt(p)), c = "", r++;
193
+ continue;
194
+ }
195
+ if (n.startsWith("-]", r + 1)) {
196
+ s.push(lt(p + "-")), r += 2;
197
+ continue;
198
+ }
199
+ if (n.startsWith("-", r + 1)) {
200
+ c = p, r += 2;
201
+ continue;
202
+ }
203
+ s.push(lt(p)), r++;
204
+ }
205
+ if (u < r) return [
206
+ "",
207
+ !1,
208
+ 0,
209
+ !1
210
+ ];
211
+ if (!s.length && !i.length) return [
212
+ "$.",
213
+ !1,
214
+ n.length - e,
215
+ !0
216
+ ];
217
+ if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !l) return [
218
+ Es(s[0].length === 2 ? s[0].slice(-1) : s[0]),
219
+ !1,
220
+ u - e,
221
+ !1
222
+ ];
223
+ let d = "[" + (l ? "^" : "") + we(s) + "]", f = "[" + (l ? "" : "^") + we(i) + "]";
224
+ return [
225
+ s.length && i.length ? "(" + d + "|" + f + ")" : s.length ? d : f,
226
+ h,
227
+ u - e,
228
+ !0
229
+ ];
230
+ };
231
+ var W = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !0 } = {}) => e ? t ? n.replace(/\[([^\/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1") : t ? n.replace(/\[([^\/\\{}])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
232
+ var xs = new Set([
233
+ "!",
234
+ "?",
235
+ "+",
236
+ "*",
237
+ "@"
238
+ ]);
239
+ var be = (n) => xs.has(n);
240
+ var vs = "(?!(?:^|/)\\.\\.?(?:$|/))";
241
+ var Ct = "(?!\\.)";
242
+ var Cs = new Set(["[", "."]);
243
+ var Ts = new Set(["..", "."]);
244
+ var As = new Set("().*{}+?[]^$\\!");
245
+ var ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
246
+ var Kt = "[^/]";
247
+ var Se = Kt + "*?";
248
+ var Ee = Kt + "+?";
249
+ var Q = class n {
250
+ type;
251
+ #t;
252
+ #s;
253
+ #n = !1;
254
+ #r = [];
255
+ #o;
256
+ #S;
257
+ #w;
258
+ #c = !1;
259
+ #h;
260
+ #u;
261
+ #f = !1;
262
+ constructor(t, e, s = {}) {
263
+ this.type = t, t && (this.#s = !0), this.#o = e, this.#t = this.#o ? this.#o.#t : this, this.#h = this.#t === this ? s : this.#t.#h, this.#w = this.#t === this ? [] : this.#t.#w, t === "!" && !this.#t.#c && this.#w.push(this), this.#S = this.#o ? this.#o.#r.length : 0;
264
+ }
265
+ get hasMagic() {
266
+ if (this.#s !== void 0) return this.#s;
267
+ for (let t of this.#r) if (typeof t != "string" && (t.type || t.hasMagic)) return this.#s = !0;
268
+ return this.#s;
269
+ }
270
+ toString() {
271
+ return this.#u !== void 0 ? this.#u : this.type ? this.#u = this.type + "(" + this.#r.map((t) => String(t)).join("|") + ")" : this.#u = this.#r.map((t) => String(t)).join("");
272
+ }
273
+ #a() {
274
+ if (this !== this.#t) throw new Error("should only call on root");
275
+ if (this.#c) return this;
276
+ this.toString(), this.#c = !0;
277
+ let t;
278
+ for (; t = this.#w.pop();) {
279
+ if (t.type !== "!") continue;
280
+ let e = t, s = e.#o;
281
+ for (; s;) {
282
+ for (let i = e.#S + 1; !s.type && i < s.#r.length; i++) for (let r of t.#r) {
283
+ if (typeof r == "string") throw new Error("string part in extglob AST??");
284
+ r.copyIn(s.#r[i]);
285
+ }
286
+ e = s, s = e.#o;
287
+ }
288
+ }
289
+ return this;
290
+ }
291
+ push(...t) {
292
+ for (let e of t) if (e !== "") {
293
+ if (typeof e != "string" && !(e instanceof n && e.#o === this)) throw new Error("invalid part: " + e);
294
+ this.#r.push(e);
295
+ }
296
+ }
297
+ toJSON() {
298
+ let t = this.type === null ? this.#r.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#r.map((e) => e.toJSON())];
299
+ return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#c && this.#o?.type === "!") && t.push({}), t;
300
+ }
301
+ isStart() {
302
+ if (this.#t === this) return !0;
303
+ if (!this.#o?.isStart()) return !1;
304
+ if (this.#S === 0) return !0;
305
+ let t = this.#o;
306
+ for (let e = 0; e < this.#S; e++) {
307
+ let s = t.#r[e];
308
+ if (!(s instanceof n && s.type === "!")) return !1;
309
+ }
310
+ return !0;
311
+ }
312
+ isEnd() {
313
+ if (this.#t === this || this.#o?.type === "!") return !0;
314
+ if (!this.#o?.isEnd()) return !1;
315
+ if (!this.type) return this.#o?.isEnd();
316
+ let t = this.#o ? this.#o.#r.length : 0;
317
+ return this.#S === t - 1;
318
+ }
319
+ copyIn(t) {
320
+ typeof t == "string" ? this.push(t) : this.push(t.clone(this));
321
+ }
322
+ clone(t) {
323
+ let e = new n(this.type, t);
324
+ for (let s of this.#r) e.copyIn(s);
325
+ return e;
326
+ }
327
+ static #i(t, e, s, i) {
328
+ let r = !1, o = !1, h = -1, a = !1;
329
+ if (e.type === null) {
330
+ let f = s, m = "";
331
+ for (; f < t.length;) {
332
+ let p = t.charAt(f++);
333
+ if (r || p === "\\") {
334
+ r = !r, m += p;
335
+ continue;
336
+ }
337
+ if (o) {
338
+ f === h + 1 ? (p === "^" || p === "!") && (a = !0) : p === "]" && !(f === h + 2 && a) && (o = !1), m += p;
339
+ continue;
340
+ } else if (p === "[") {
341
+ o = !0, h = f, a = !1, m += p;
342
+ continue;
343
+ }
344
+ if (!i.noext && be(p) && t.charAt(f) === "(") {
345
+ e.push(m), m = "";
346
+ let w = new n(p, e);
347
+ f = n.#i(t, w, f, i), e.push(w);
348
+ continue;
349
+ }
350
+ m += p;
351
+ }
352
+ return e.push(m), f;
353
+ }
354
+ let l = s + 1, u = new n(null, e), c = [], d = "";
355
+ for (; l < t.length;) {
356
+ let f = t.charAt(l++);
357
+ if (r || f === "\\") {
358
+ r = !r, d += f;
359
+ continue;
360
+ }
361
+ if (o) {
362
+ l === h + 1 ? (f === "^" || f === "!") && (a = !0) : f === "]" && !(l === h + 2 && a) && (o = !1), d += f;
363
+ continue;
364
+ } else if (f === "[") {
365
+ o = !0, h = l, a = !1, d += f;
366
+ continue;
367
+ }
368
+ if (be(f) && t.charAt(l) === "(") {
369
+ u.push(d), d = "";
370
+ let m = new n(f, u);
371
+ u.push(m), l = n.#i(t, m, l, i);
372
+ continue;
373
+ }
374
+ if (f === "|") {
375
+ u.push(d), d = "", c.push(u), u = new n(null, e);
376
+ continue;
377
+ }
378
+ if (f === ")") return d === "" && e.#r.length === 0 && (e.#f = !0), u.push(d), d = "", e.push(...c, u), l;
379
+ d += f;
380
+ }
381
+ return e.type = null, e.#s = void 0, e.#r = [t.substring(s - 1)], l;
382
+ }
383
+ static fromGlob(t, e = {}) {
384
+ let s = new n(null, void 0, e);
385
+ return n.#i(t, s, 0, e), s;
386
+ }
387
+ toMMPattern() {
388
+ if (this !== this.#t) return this.#t.toMMPattern();
389
+ let t = this.toString(), [e, s, i, r] = this.toRegExpSource();
390
+ if (!(i || this.#s || this.#h.nocase && !this.#h.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase())) return s;
391
+ let h = (this.#h.nocase ? "i" : "") + (r ? "u" : "");
392
+ return Object.assign(new RegExp(`^${e}$`, h), {
393
+ _src: e,
394
+ _glob: t
395
+ });
396
+ }
397
+ get options() {
398
+ return this.#h;
399
+ }
400
+ toRegExpSource(t) {
401
+ let e = t ?? !!this.#h.dot;
402
+ if (this.#t === this && this.#a(), !this.type) {
403
+ let a = this.isStart() && this.isEnd() && !this.#r.some((f) => typeof f != "string"), l = this.#r.map((f) => {
404
+ let [m, p, w, g] = typeof f == "string" ? n.#E(f, this.#s, a) : f.toRegExpSource(t);
405
+ return this.#s = this.#s || w, this.#n = this.#n || g, m;
406
+ }).join(""), u = "";
407
+ if (this.isStart() && typeof this.#r[0] == "string" && !(this.#r.length === 1 && Ts.has(this.#r[0]))) {
408
+ let m = Cs, p = e && m.has(l.charAt(0)) || l.startsWith("\\.") && m.has(l.charAt(2)) || l.startsWith("\\.\\.") && m.has(l.charAt(4)), w = !e && !t && m.has(l.charAt(0));
409
+ u = p ? vs : w ? Ct : "";
410
+ }
411
+ let c = "";
412
+ return this.isEnd() && this.#t.#c && this.#o?.type === "!" && (c = "(?:$|\\/)"), [
413
+ u + l + c,
414
+ W(l),
415
+ this.#s = !!this.#s,
416
+ this.#n
417
+ ];
418
+ }
419
+ let s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e);
420
+ if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
421
+ let a = this.toString();
422
+ return this.#r = [a], this.type = null, this.#s = void 0, [
423
+ a,
424
+ W(this.toString()),
425
+ !1,
426
+ !1
427
+ ];
428
+ }
429
+ let o = !s || t || e || !Ct ? "" : this.#d(!0);
430
+ o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
431
+ let h = "";
432
+ if (this.type === "!" && this.#f) h = (this.isStart() && !e ? Ct : "") + Ee;
433
+ else {
434
+ let a = this.type === "!" ? "))" + (this.isStart() && !e && !t ? Ct : "") + Se + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
435
+ h = i + r + a;
436
+ }
437
+ return [
438
+ h,
439
+ W(r),
440
+ this.#s = !!this.#s,
441
+ this.#n
442
+ ];
443
+ }
444
+ #d(t) {
445
+ return this.#r.map((e) => {
446
+ if (typeof e == "string") throw new Error("string type in extglob ast??");
447
+ let [s, i, r, o] = e.toRegExpSource(t);
448
+ return this.#n = this.#n || o, s;
449
+ }).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
450
+ }
451
+ static #E(t, e, s = !1) {
452
+ let i = !1, r = "", o = !1, h = !1;
453
+ for (let a = 0; a < t.length; a++) {
454
+ let l = t.charAt(a);
455
+ if (i) {
456
+ i = !1, r += (As.has(l) ? "\\" : "") + l;
457
+ continue;
458
+ }
459
+ if (l === "*") {
460
+ if (h) continue;
461
+ h = !0, r += s && /^[*]+$/.test(t) ? Ee : Se, e = !0;
462
+ continue;
463
+ } else h = !1;
464
+ if (l === "\\") {
465
+ a === t.length - 1 ? r += "\\\\" : i = !0;
466
+ continue;
467
+ }
468
+ if (l === "[") {
469
+ let [u, c, d, f] = ye(t, a);
470
+ if (d) {
471
+ r += u, o = o || c, a += d - 1, e = e || f;
472
+ continue;
473
+ }
474
+ }
475
+ if (l === "?") {
476
+ r += Kt, e = !0;
477
+ continue;
478
+ }
479
+ r += ks(l);
480
+ }
481
+ return [
482
+ r,
483
+ W(t),
484
+ !!e,
485
+ o
486
+ ];
487
+ }
488
+ };
489
+ var tt = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !1 } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&");
490
+ var O = (n, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(n));
491
+ var Rs = /^\*+([^+@!?\*\[\(]*)$/;
492
+ var Os = (n) => (t) => !t.startsWith(".") && t.endsWith(n);
493
+ var Fs = (n) => (t) => t.endsWith(n);
494
+ var Ds = (n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n));
495
+ var Ms = (n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n));
496
+ var Ns = /^\*+\.\*+$/;
497
+ var _s = (n) => !n.startsWith(".") && n.includes(".");
498
+ var Ls = (n) => n !== "." && n !== ".." && n.includes(".");
499
+ var Ws = /^\.\*+$/;
500
+ var Ps = (n) => n !== "." && n !== ".." && n.startsWith(".");
501
+ var js = /^\*+$/;
502
+ var Is = (n) => n.length !== 0 && !n.startsWith(".");
503
+ var zs = (n) => n.length !== 0 && n !== "." && n !== "..";
504
+ var Bs = /^\?+([^+@!?\*\[\(]*)?$/;
505
+ var Us = ([n, t = ""]) => {
506
+ let e = Ce([n]);
507
+ return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
508
+ };
509
+ var $s = ([n, t = ""]) => {
510
+ let e = Te([n]);
511
+ return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
512
+ };
513
+ var Gs = ([n, t = ""]) => {
514
+ let e = Te([n]);
515
+ return t ? (s) => e(s) && s.endsWith(t) : e;
516
+ };
517
+ var Hs = ([n, t = ""]) => {
518
+ let e = Ce([n]);
519
+ return t ? (s) => e(s) && s.endsWith(t) : e;
520
+ };
521
+ var Ce = ([n]) => {
522
+ let t = n.length;
523
+ return (e) => e.length === t && !e.startsWith(".");
524
+ };
525
+ var Te = ([n]) => {
526
+ let t = n.length;
527
+ return (e) => e.length === t && e !== "." && e !== "..";
528
+ };
529
+ var Ae = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
530
+ var xe = {
531
+ win32: { sep: "\\" },
532
+ posix: { sep: "/" }
533
+ };
534
+ O.sep = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
535
+ var A = Symbol("globstar **");
536
+ O.GLOBSTAR = A;
537
+ var Vs = "[^/]*?";
538
+ var Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
539
+ var Xs = "(?:(?!(?:\\/|^)\\.).)*?";
540
+ var Js = (n, t = {}) => (e) => O(e, n, t);
541
+ O.filter = Js;
542
+ var N = (n, t = {}) => Object.assign({}, n, t);
543
+ var Zs = (n) => {
544
+ if (!n || typeof n != "object" || !Object.keys(n).length) return O;
545
+ let t = O;
546
+ return Object.assign((s, i, r = {}) => t(s, i, N(n, r)), {
547
+ Minimatch: class extends t.Minimatch {
548
+ constructor(i, r = {}) {
549
+ super(i, N(n, r));
550
+ }
551
+ static defaults(i) {
552
+ return t.defaults(N(n, i)).Minimatch;
553
+ }
554
+ },
555
+ AST: class extends t.AST {
556
+ constructor(i, r, o = {}) {
557
+ super(i, r, N(n, o));
558
+ }
559
+ static fromGlob(i, r = {}) {
560
+ return t.AST.fromGlob(i, N(n, r));
561
+ }
562
+ },
563
+ unescape: (s, i = {}) => t.unescape(s, N(n, i)),
564
+ escape: (s, i = {}) => t.escape(s, N(n, i)),
565
+ filter: (s, i = {}) => t.filter(s, N(n, i)),
566
+ defaults: (s) => t.defaults(N(n, s)),
567
+ makeRe: (s, i = {}) => t.makeRe(s, N(n, i)),
568
+ braceExpand: (s, i = {}) => t.braceExpand(s, N(n, i)),
569
+ match: (s, i, r = {}) => t.match(s, i, N(n, r)),
570
+ sep: t.sep,
571
+ GLOBSTAR: A
572
+ });
573
+ };
574
+ O.defaults = Zs;
575
+ var ke = (n, t = {}) => (at(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : ge(n, { max: t.braceExpandMax }));
576
+ O.braceExpand = ke;
577
+ var Qs = (n, t = {}) => new D(n, t).makeRe();
578
+ O.makeRe = Qs;
579
+ var ti = (n, t, e = {}) => {
580
+ let s = new D(t, e);
581
+ return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n;
582
+ };
583
+ O.match = ti;
584
+ var ve = /[?*]|[+@!]\(.*?\)|\[|\]/;
585
+ var ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
586
+ var D = class {
587
+ options;
588
+ set;
589
+ pattern;
590
+ windowsPathsNoEscape;
591
+ nonegate;
592
+ negate;
593
+ comment;
594
+ empty;
595
+ preserveMultipleSlashes;
596
+ partial;
597
+ globSet;
598
+ globParts;
599
+ nocase;
600
+ isWindows;
601
+ platform;
602
+ windowsNoMagicRoot;
603
+ regexp;
604
+ constructor(t, e = {}) {
605
+ at(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ae, this.isWindows = this.platform === "win32";
606
+ let s = "allowWindowsEscape";
607
+ this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e[s] === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
608
+ }
609
+ hasMagic() {
610
+ if (this.options.magicalBraces && this.set.length > 1) return !0;
611
+ for (let t of this.set) for (let e of t) if (typeof e != "string") return !0;
612
+ return !1;
613
+ }
614
+ debug(...t) {}
615
+ make() {
616
+ let t = this.pattern, e = this.options;
617
+ if (!e.nocomment && t.charAt(0) === "#") {
618
+ this.comment = !0;
619
+ return;
620
+ }
621
+ if (!t) {
622
+ this.empty = !0;
623
+ return;
624
+ }
625
+ this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet);
626
+ let s = this.globSet.map((r) => this.slashSplit(r));
627
+ this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts);
628
+ let i = this.globParts.map((r, o, h) => {
629
+ if (this.isWindows && this.windowsNoMagicRoot) {
630
+ let a = r[0] === "" && r[1] === "" && (r[2] === "?" || !ve.test(r[2])) && !ve.test(r[3]), l = /^[a-z]:/i.test(r[0]);
631
+ if (a) return [...r.slice(0, 4), ...r.slice(4).map((u) => this.parse(u))];
632
+ if (l) return [r[0], ...r.slice(1).map((u) => this.parse(u))];
633
+ }
634
+ return r.map((a) => this.parse(a));
635
+ });
636
+ if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(!1) === -1), this.isWindows) for (let r = 0; r < this.set.length; r++) {
637
+ let o = this.set[r];
638
+ o[0] === "" && o[1] === "" && this.globParts[r][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
639
+ }
640
+ this.debug(this.pattern, this.set);
641
+ }
642
+ preprocess(t) {
643
+ if (this.options.noglobstar) for (let s = 0; s < t.length; s++) for (let i = 0; i < t[s].length; i++) t[s][i] === "**" && (t[s][i] = "*");
644
+ let { optimizationLevel: e = 1 } = this.options;
645
+ return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
646
+ }
647
+ adjascentGlobstarOptimize(t) {
648
+ return t.map((e) => {
649
+ let s = -1;
650
+ for (; (s = e.indexOf("**", s + 1)) !== -1;) {
651
+ let i = s;
652
+ for (; e[i + 1] === "**";) i++;
653
+ i !== s && e.splice(s, i - s);
654
+ }
655
+ return e;
656
+ });
657
+ }
658
+ levelOneOptimize(t) {
659
+ return t.map((e) => (e = e.reduce((s, i) => {
660
+ let r = s[s.length - 1];
661
+ return i === "**" && r === "**" ? s : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i), s);
662
+ }, []), e.length === 0 ? [""] : e));
663
+ }
664
+ levelTwoFileOptimize(t) {
665
+ Array.isArray(t) || (t = this.slashSplit(t));
666
+ let e = !1;
667
+ do {
668
+ if (e = !1, !this.preserveMultipleSlashes) {
669
+ for (let i = 1; i < t.length - 1; i++) {
670
+ let r = t[i];
671
+ i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = !0, t.splice(i, 1), i--);
672
+ }
673
+ t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = !0, t.pop());
674
+ }
675
+ let s = 0;
676
+ for (; (s = t.indexOf("..", s + 1)) !== -1;) {
677
+ let i = t[s - 1];
678
+ i && i !== "." && i !== ".." && i !== "**" && (e = !0, t.splice(s - 1, 2), s -= 2);
679
+ }
680
+ } while (e);
681
+ return t.length === 0 ? [""] : t;
682
+ }
683
+ firstPhasePreProcess(t) {
684
+ let e = !1;
685
+ do {
686
+ e = !1;
687
+ for (let s of t) {
688
+ let i = -1;
689
+ for (; (i = s.indexOf("**", i + 1)) !== -1;) {
690
+ let o = i;
691
+ for (; s[o + 1] === "**";) o++;
692
+ o > i && s.splice(i + 1, o - i);
693
+ let h = s[i + 1], a = s[i + 2], l = s[i + 3];
694
+ if (h !== ".." || !a || a === "." || a === ".." || !l || l === "." || l === "..") continue;
695
+ e = !0, s.splice(i, 1);
696
+ let u = s.slice(0);
697
+ u[i] = "**", t.push(u), i--;
698
+ }
699
+ if (!this.preserveMultipleSlashes) {
700
+ for (let o = 1; o < s.length - 1; o++) {
701
+ let h = s[o];
702
+ o === 1 && h === "" && s[0] === "" || (h === "." || h === "") && (e = !0, s.splice(o, 1), o--);
703
+ }
704
+ s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = !0, s.pop());
705
+ }
706
+ let r = 0;
707
+ for (; (r = s.indexOf("..", r + 1)) !== -1;) {
708
+ let o = s[r - 1];
709
+ if (o && o !== "." && o !== ".." && o !== "**") {
710
+ e = !0;
711
+ let a = r === 1 && s[r + 1] === "**" ? ["."] : [];
712
+ s.splice(r - 1, 2, ...a), s.length === 0 && s.push(""), r -= 2;
713
+ }
714
+ }
715
+ }
716
+ } while (e);
717
+ return t;
718
+ }
719
+ secondPhasePreProcess(t) {
720
+ for (let e = 0; e < t.length - 1; e++) for (let s = e + 1; s < t.length; s++) {
721
+ let i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
722
+ if (i) {
723
+ t[e] = [], t[s] = i;
724
+ break;
725
+ }
726
+ }
727
+ return t.filter((e) => e.length);
728
+ }
729
+ partsMatch(t, e, s = !1) {
730
+ let i = 0, r = 0, o = [], h = "";
731
+ for (; i < t.length && r < e.length;) if (t[i] === e[r]) o.push(h === "b" ? e[r] : t[i]), i++, r++;
732
+ else if (s && t[i] === "**" && e[r] === t[i + 1]) o.push(t[i]), i++;
733
+ else if (s && e[r] === "**" && t[i] === e[r + 1]) o.push(e[r]), r++;
734
+ else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
735
+ if (h === "b") return !1;
736
+ h = "a", o.push(t[i]), i++, r++;
737
+ } else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
738
+ if (h === "a") return !1;
739
+ h = "b", o.push(e[r]), i++, r++;
740
+ } else return !1;
741
+ return t.length === e.length && o;
742
+ }
743
+ parseNegate() {
744
+ if (this.nonegate) return;
745
+ let t = this.pattern, e = !1, s = 0;
746
+ for (let i = 0; i < t.length && t.charAt(i) === "!"; i++) e = !e, s++;
747
+ s && (this.pattern = t.slice(s)), this.negate = e;
748
+ }
749
+ matchOne(t, e, s = !1) {
750
+ let i = this.options;
751
+ if (this.isWindows) {
752
+ let p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), w = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), g = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), S = !g && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), E = w ? 3 : p ? 0 : void 0, y = S ? 3 : g ? 0 : void 0;
753
+ if (typeof E == "number" && typeof y == "number") {
754
+ let [b, z] = [t[E], e[y]];
755
+ b.toLowerCase() === z.toLowerCase() && (e[y] = b, y > E ? e = e.slice(y) : E > y && (t = t.slice(E)));
756
+ }
757
+ }
758
+ let { optimizationLevel: r = 1 } = this.options;
759
+ r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, {
760
+ file: t,
761
+ pattern: e
762
+ }), this.debug("matchOne", t.length, e.length);
763
+ for (var o = 0, h = 0, a = t.length, l = e.length; o < a && h < l; o++, h++) {
764
+ this.debug("matchOne loop");
765
+ var u = e[h], c = t[o];
766
+ if (this.debug(e, u, c), u === !1) return !1;
767
+ if (u === A) {
768
+ this.debug("GLOBSTAR", [
769
+ e,
770
+ u,
771
+ c
772
+ ]);
773
+ var d = o, f = h + 1;
774
+ if (f === l) {
775
+ for (this.debug("** at the end"); o < a; o++) if (t[o] === "." || t[o] === ".." || !i.dot && t[o].charAt(0) === ".") return !1;
776
+ return !0;
777
+ }
778
+ for (; d < a;) {
779
+ var m = t[d];
780
+ if (this.debug(`
781
+ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) return this.debug("globstar found match!", d, a, m), !0;
782
+ if (m === "." || m === ".." || !i.dot && m.charAt(0) === ".") {
783
+ this.debug("dot detected!", t, d, e, f);
784
+ break;
785
+ }
786
+ this.debug("globstar swallow a segment, and continue"), d++;
787
+ }
788
+ return !!(s && (this.debug(`
789
+ >>> no match, partial?`, t, d, e, f), d === a));
790
+ }
791
+ let p;
792
+ if (typeof u == "string" ? (p = c === u, this.debug("string match", u, c, p)) : (p = u.test(c), this.debug("pattern match", u, c, p)), !p) return !1;
793
+ }
794
+ if (o === a && h === l) return !0;
795
+ if (o === a) return s;
796
+ if (h === l) return o === a - 1 && t[o] === "";
797
+ throw new Error("wtf?");
798
+ }
799
+ braceExpand() {
800
+ return ke(this.pattern, this.options);
801
+ }
802
+ parse(t) {
803
+ at(t);
804
+ let e = this.options;
805
+ if (t === "**") return A;
806
+ if (t === "") return "";
807
+ let s, i = null;
808
+ (s = t.match(js)) ? i = e.dot ? zs : Is : (s = t.match(Rs)) ? i = (e.nocase ? e.dot ? Ms : Ds : e.dot ? Fs : Os)(s[1]) : (s = t.match(Bs)) ? i = (e.nocase ? e.dot ? $s : Us : e.dot ? Gs : Hs)(s) : (s = t.match(Ns)) ? i = e.dot ? Ls : _s : (s = t.match(Ws)) && (i = Ps);
809
+ let r = Q.fromGlob(t, this.options).toMMPattern();
810
+ return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
811
+ }
812
+ makeRe() {
813
+ if (this.regexp || this.regexp === !1) return this.regexp;
814
+ let t = this.set;
815
+ if (!t.length) return this.regexp = !1, this.regexp;
816
+ let e = this.options, s = e.noglobstar ? Vs : e.dot ? Ys : Xs, i = new Set(e.nocase ? ["i"] : []), r = t.map((a) => {
817
+ let l = a.map((c) => {
818
+ if (c instanceof RegExp) for (let d of c.flags.split("")) i.add(d);
819
+ return typeof c == "string" ? ei(c) : c === A ? A : c._src;
820
+ });
821
+ l.forEach((c, d) => {
822
+ let f = l[d + 1], m = l[d - 1];
823
+ c !== A || m === A || (m === void 0 ? f !== void 0 && f !== A ? l[d + 1] = "(?:\\/|" + s + "\\/)?" + f : l[d] = s : f === void 0 ? l[d - 1] = m + "(?:\\/|\\/" + s + ")?" : f !== A && (l[d - 1] = m + "(?:\\/|\\/" + s + "\\/)" + f, l[d + 1] = A));
824
+ });
825
+ let u = l.filter((c) => c !== A);
826
+ if (this.partial && u.length >= 1) {
827
+ let c = [];
828
+ for (let d = 1; d <= u.length; d++) c.push(u.slice(0, d).join("/"));
829
+ return "(?:" + c.join("|") + ")";
830
+ }
831
+ return u.join("/");
832
+ }).join("|"), [o, h] = t.length > 1 ? ["(?:", ")"] : ["", ""];
833
+ r = "^" + o + r + h + "$", this.partial && (r = "^(?:\\/|" + o + r.slice(1, -1) + h + ")$"), this.negate && (r = "^(?!" + r + ").+$");
834
+ try {
835
+ this.regexp = new RegExp(r, [...i].join(""));
836
+ } catch {
837
+ this.regexp = !1;
838
+ }
839
+ return this.regexp;
840
+ }
841
+ slashSplit(t) {
842
+ return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^\/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
843
+ }
844
+ match(t, e = this.partial) {
845
+ if (this.debug("match", t, this.pattern), this.comment) return !1;
846
+ if (this.empty) return t === "";
847
+ if (t === "/" && e) return !0;
848
+ let s = this.options;
849
+ this.isWindows && (t = t.split("\\").join("/"));
850
+ let i = this.slashSplit(t);
851
+ this.debug(this.pattern, "split", i);
852
+ let r = this.set;
853
+ this.debug(this.pattern, "set", r);
854
+ let o = i[i.length - 1];
855
+ if (!o) for (let h = i.length - 2; !o && h >= 0; h--) o = i[h];
856
+ for (let h = 0; h < r.length; h++) {
857
+ let a = r[h], l = i;
858
+ if (s.matchBase && a.length === 1 && (l = [o]), this.matchOne(l, a, e)) return s.flipNegate ? !0 : !this.negate;
859
+ }
860
+ return s.flipNegate ? !1 : this.negate;
861
+ }
862
+ static defaults(t) {
863
+ return O.defaults(t).Minimatch;
864
+ }
865
+ };
866
+ O.AST = Q;
867
+ O.Minimatch = D;
868
+ O.escape = tt;
869
+ O.unescape = W;
870
+ var si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
871
+ var Oe = new Set();
872
+ var Vt = typeof process == "object" && process ? process : {};
873
+ var Fe = (n, t, e, s) => {
874
+ typeof Vt.emitWarning == "function" ? Vt.emitWarning(n, t, e, s) : console.error(`[${e}] ${t}: ${n}`);
875
+ };
876
+ var At = globalThis.AbortController;
877
+ var Re = globalThis.AbortSignal;
878
+ if (typeof At > "u") {
879
+ Re = class {
880
+ onabort;
881
+ _onabort = [];
882
+ reason;
883
+ aborted = !1;
884
+ addEventListener(e, s) {
885
+ this._onabort.push(s);
886
+ }
887
+ }, At = class {
888
+ constructor() {
889
+ t();
890
+ }
891
+ signal = new Re();
892
+ abort(e) {
893
+ if (!this.signal.aborted) {
894
+ this.signal.reason = e, this.signal.aborted = !0;
895
+ for (let s of this.signal._onabort) s(e);
896
+ this.signal.onabort?.(e);
897
+ }
898
+ }
899
+ };
900
+ let n = Vt.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
901
+ n && (n = !1, Fe("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
902
+ };
903
+ }
904
+ var ii = (n) => !Oe.has(n);
905
+ var q = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
906
+ var De = (n) => q(n) ? n <= Math.pow(2, 8) ? Uint8Array : n <= Math.pow(2, 16) ? Uint16Array : n <= Math.pow(2, 32) ? Uint32Array : n <= Number.MAX_SAFE_INTEGER ? Tt : null : null;
907
+ var Tt = class extends Array {
908
+ constructor(n) {
909
+ super(n), this.fill(0);
910
+ }
911
+ };
912
+ var ri = class ct {
913
+ heap;
914
+ length;
915
+ static #t = !1;
916
+ static create(t) {
917
+ let e = De(t);
918
+ if (!e) return [];
919
+ ct.#t = !0;
920
+ let s = new ct(t, e);
921
+ return ct.#t = !1, s;
922
+ }
923
+ constructor(t, e) {
924
+ if (!ct.#t) throw new TypeError("instantiate Stack using Stack.create(n)");
925
+ this.heap = new e(t), this.length = 0;
926
+ }
927
+ push(t) {
928
+ this.heap[this.length++] = t;
929
+ }
930
+ pop() {
931
+ return this.heap[--this.length];
932
+ }
933
+ };
934
+ var ft = class Me {
935
+ #t;
936
+ #s;
937
+ #n;
938
+ #r;
939
+ #o;
940
+ #S;
941
+ #w;
942
+ #c;
943
+ get perf() {
944
+ return this.#c;
945
+ }
946
+ ttl;
947
+ ttlResolution;
948
+ ttlAutopurge;
949
+ updateAgeOnGet;
950
+ updateAgeOnHas;
951
+ allowStale;
952
+ noDisposeOnSet;
953
+ noUpdateTTL;
954
+ maxEntrySize;
955
+ sizeCalculation;
956
+ noDeleteOnFetchRejection;
957
+ noDeleteOnStaleGet;
958
+ allowStaleOnFetchAbort;
959
+ allowStaleOnFetchRejection;
960
+ ignoreFetchAbort;
961
+ #h;
962
+ #u;
963
+ #f;
964
+ #a;
965
+ #i;
966
+ #d;
967
+ #E;
968
+ #b;
969
+ #p;
970
+ #R;
971
+ #m;
972
+ #C;
973
+ #T;
974
+ #g;
975
+ #y;
976
+ #x;
977
+ #A;
978
+ #e;
979
+ #_;
980
+ static unsafeExposeInternals(t) {
981
+ return {
982
+ starts: t.#T,
983
+ ttls: t.#g,
984
+ autopurgeTimers: t.#y,
985
+ sizes: t.#C,
986
+ keyMap: t.#f,
987
+ keyList: t.#a,
988
+ valList: t.#i,
989
+ next: t.#d,
990
+ prev: t.#E,
991
+ get head() {
992
+ return t.#b;
993
+ },
994
+ get tail() {
995
+ return t.#p;
996
+ },
997
+ free: t.#R,
998
+ isBackgroundFetch: (e) => t.#l(e),
999
+ backgroundFetch: (e, s, i, r) => t.#U(e, s, i, r),
1000
+ moveToTail: (e) => t.#W(e),
1001
+ indexes: (e) => t.#F(e),
1002
+ rindexes: (e) => t.#D(e),
1003
+ isStale: (e) => t.#v(e)
1004
+ };
1005
+ }
1006
+ get max() {
1007
+ return this.#t;
1008
+ }
1009
+ get maxSize() {
1010
+ return this.#s;
1011
+ }
1012
+ get calculatedSize() {
1013
+ return this.#u;
1014
+ }
1015
+ get size() {
1016
+ return this.#h;
1017
+ }
1018
+ get fetchMethod() {
1019
+ return this.#S;
1020
+ }
1021
+ get memoMethod() {
1022
+ return this.#w;
1023
+ }
1024
+ get dispose() {
1025
+ return this.#n;
1026
+ }
1027
+ get onInsert() {
1028
+ return this.#r;
1029
+ }
1030
+ get disposeAfter() {
1031
+ return this.#o;
1032
+ }
1033
+ constructor(t) {
1034
+ let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: r, updateAgeOnGet: o, updateAgeOnHas: h, allowStale: a, dispose: l, onInsert: u, disposeAfter: c, noDisposeOnSet: d, noUpdateTTL: f, maxSize: m = 0, maxEntrySize: p = 0, sizeCalculation: w, fetchMethod: g, memoMethod: S, noDeleteOnFetchRejection: E, noDeleteOnStaleGet: y, allowStaleOnFetchRejection: b, allowStaleOnFetchAbort: z, ignoreFetchAbort: $, perf: J } = t;
1035
+ if (J !== void 0 && typeof J?.now != "function") throw new TypeError("perf option must have a now() method if specified");
1036
+ if (this.#c = J ?? si, e !== 0 && !q(e)) throw new TypeError("max option must be a nonnegative integer");
1037
+ let Z = e ? De(e) : Array;
1038
+ if (!Z) throw new Error("invalid max value: " + e);
1039
+ if (this.#t = e, this.#s = m, this.maxEntrySize = p || this.#s, this.sizeCalculation = w, this.sizeCalculation) {
1040
+ if (!this.#s && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
1041
+ if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
1042
+ }
1043
+ if (S !== void 0 && typeof S != "function") throw new TypeError("memoMethod must be a function if defined");
1044
+ if (this.#w = S, g !== void 0 && typeof g != "function") throw new TypeError("fetchMethod must be a function if specified");
1045
+ if (this.#S = g, this.#A = !!g, this.#f = new Map(), this.#a = new Array(e).fill(void 0), this.#i = new Array(e).fill(void 0), this.#d = new Z(e), this.#E = new Z(e), this.#b = 0, this.#p = 0, this.#R = ri.create(e), this.#h = 0, this.#u = 0, typeof l == "function" && (this.#n = l), typeof u == "function" && (this.#r = u), typeof c == "function" ? (this.#o = c, this.#m = []) : (this.#o = void 0, this.#m = void 0), this.#x = !!this.#n, this.#_ = !!this.#r, this.#e = !!this.#o, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!f, this.noDeleteOnFetchRejection = !!E, this.allowStaleOnFetchRejection = !!b, this.allowStaleOnFetchAbort = !!z, this.ignoreFetchAbort = !!$, this.maxEntrySize !== 0) {
1046
+ if (this.#s !== 0 && !q(this.#s)) throw new TypeError("maxSize must be a positive integer if specified");
1047
+ if (!q(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
1048
+ this.#G();
1049
+ }
1050
+ if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!y, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!h, this.ttlResolution = q(i) || i === 0 ? i : 1, this.ttlAutopurge = !!r, this.ttl = s || 0, this.ttl) {
1051
+ if (!q(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
1052
+ this.#M();
1053
+ }
1054
+ if (this.#t === 0 && this.ttl === 0 && this.#s === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
1055
+ if (!this.ttlAutopurge && !this.#t && !this.#s) {
1056
+ let $t = "LRU_CACHE_UNBOUNDED";
1057
+ ii($t) && (Oe.add($t), Fe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", $t, Me));
1058
+ }
1059
+ }
1060
+ getRemainingTTL(t) {
1061
+ return this.#f.has(t) ? 1 / 0 : 0;
1062
+ }
1063
+ #M() {
1064
+ let t = new Tt(this.#t), e = new Tt(this.#t);
1065
+ this.#g = t, this.#T = e;
1066
+ let s = this.ttlAutopurge ? new Array(this.#t) : void 0;
1067
+ this.#y = s, this.#j = (o, h, a = this.#c.now()) => {
1068
+ if (e[o] = h !== 0 ? a : 0, t[o] = h, s?.[o] && (clearTimeout(s[o]), s[o] = void 0), h !== 0 && s) {
1069
+ let l = setTimeout(() => {
1070
+ this.#v(o) && this.#O(this.#a[o], "expire");
1071
+ }, h + 1);
1072
+ l.unref && l.unref(), s[o] = l;
1073
+ }
1074
+ }, this.#k = (o) => {
1075
+ e[o] = t[o] !== 0 ? this.#c.now() : 0;
1076
+ }, this.#N = (o, h) => {
1077
+ if (t[h]) {
1078
+ let a = t[h], l = e[h];
1079
+ if (!a || !l) return;
1080
+ o.ttl = a, o.start = l, o.now = i || r();
1081
+ o.remainingTTL = a - (o.now - l);
1082
+ }
1083
+ };
1084
+ let i = 0, r = () => {
1085
+ let o = this.#c.now();
1086
+ if (this.ttlResolution > 0) {
1087
+ i = o;
1088
+ let h = setTimeout(() => i = 0, this.ttlResolution);
1089
+ h.unref && h.unref();
1090
+ }
1091
+ return o;
1092
+ };
1093
+ this.getRemainingTTL = (o) => {
1094
+ let h = this.#f.get(o);
1095
+ if (h === void 0) return 0;
1096
+ let a = t[h], l = e[h];
1097
+ if (!a || !l) return 1 / 0;
1098
+ return a - ((i || r()) - l);
1099
+ }, this.#v = (o) => {
1100
+ let h = e[o], a = t[o];
1101
+ return !!a && !!h && (i || r()) - h > a;
1102
+ };
1103
+ }
1104
+ #k = () => {};
1105
+ #N = () => {};
1106
+ #j = () => {};
1107
+ #v = () => !1;
1108
+ #G() {
1109
+ let t = new Tt(this.#t);
1110
+ this.#u = 0, this.#C = t, this.#P = (e) => {
1111
+ this.#u -= t[e], t[e] = 0;
1112
+ }, this.#I = (e, s, i, r) => {
1113
+ if (this.#l(s)) return 0;
1114
+ if (!q(i)) if (r) {
1115
+ if (typeof r != "function") throw new TypeError("sizeCalculation must be a function");
1116
+ if (i = r(s, e), !q(i)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
1117
+ } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
1118
+ return i;
1119
+ }, this.#L = (e, s, i) => {
1120
+ if (t[e] = s, this.#s) {
1121
+ let r = this.#s - t[e];
1122
+ for (; this.#u > r;) this.#B(!0);
1123
+ }
1124
+ this.#u += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#u);
1125
+ };
1126
+ }
1127
+ #P = (t) => {};
1128
+ #L = (t, e, s) => {};
1129
+ #I = (t, e, s, i) => {
1130
+ if (s || i) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
1131
+ return 0;
1132
+ };
1133
+ *#F({ allowStale: t = this.allowStale } = {}) {
1134
+ if (this.#h) for (let e = this.#p; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#b));) e = this.#E[e];
1135
+ }
1136
+ *#D({ allowStale: t = this.allowStale } = {}) {
1137
+ if (this.#h) for (let e = this.#b; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#p));) e = this.#d[e];
1138
+ }
1139
+ #z(t) {
1140
+ return t !== void 0 && this.#f.get(this.#a[t]) === t;
1141
+ }
1142
+ *entries() {
1143
+ for (let t of this.#F()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
1144
+ }
1145
+ *rentries() {
1146
+ for (let t of this.#D()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
1147
+ }
1148
+ *keys() {
1149
+ for (let t of this.#F()) {
1150
+ let e = this.#a[t];
1151
+ e !== void 0 && !this.#l(this.#i[t]) && (yield e);
1152
+ }
1153
+ }
1154
+ *rkeys() {
1155
+ for (let t of this.#D()) {
1156
+ let e = this.#a[t];
1157
+ e !== void 0 && !this.#l(this.#i[t]) && (yield e);
1158
+ }
1159
+ }
1160
+ *values() {
1161
+ for (let t of this.#F()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
1162
+ }
1163
+ *rvalues() {
1164
+ for (let t of this.#D()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
1165
+ }
1166
+ [Symbol.iterator]() {
1167
+ return this.entries();
1168
+ }
1169
+ [Symbol.toStringTag] = "LRUCache";
1170
+ find(t, e = {}) {
1171
+ for (let s of this.#F()) {
1172
+ let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
1173
+ if (r !== void 0 && t(r, this.#a[s], this)) return this.get(this.#a[s], e);
1174
+ }
1175
+ }
1176
+ forEach(t, e = this) {
1177
+ for (let s of this.#F()) {
1178
+ let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
1179
+ r !== void 0 && t.call(e, r, this.#a[s], this);
1180
+ }
1181
+ }
1182
+ rforEach(t, e = this) {
1183
+ for (let s of this.#D()) {
1184
+ let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
1185
+ r !== void 0 && t.call(e, r, this.#a[s], this);
1186
+ }
1187
+ }
1188
+ purgeStale() {
1189
+ let t = !1;
1190
+ for (let e of this.#D({ allowStale: !0 })) this.#v(e) && (this.#O(this.#a[e], "expire"), t = !0);
1191
+ return t;
1192
+ }
1193
+ info(t) {
1194
+ let e = this.#f.get(t);
1195
+ if (e === void 0) return;
1196
+ let s = this.#i[e], i = this.#l(s) ? s.__staleWhileFetching : s;
1197
+ if (i === void 0) return;
1198
+ let r = { value: i };
1199
+ if (this.#g && this.#T) {
1200
+ let o = this.#g[e], h = this.#T[e];
1201
+ if (o && h) r.ttl = o - (this.#c.now() - h), r.start = Date.now();
1202
+ }
1203
+ return this.#C && (r.size = this.#C[e]), r;
1204
+ }
1205
+ dump() {
1206
+ let t = [];
1207
+ for (let e of this.#F({ allowStale: !0 })) {
1208
+ let s = this.#a[e], i = this.#i[e], r = this.#l(i) ? i.__staleWhileFetching : i;
1209
+ if (r === void 0 || s === void 0) continue;
1210
+ let o = { value: r };
1211
+ if (this.#g && this.#T) {
1212
+ o.ttl = this.#g[e];
1213
+ let h = this.#c.now() - this.#T[e];
1214
+ o.start = Math.floor(Date.now() - h);
1215
+ }
1216
+ this.#C && (o.size = this.#C[e]), t.unshift([s, o]);
1217
+ }
1218
+ return t;
1219
+ }
1220
+ load(t) {
1221
+ this.clear();
1222
+ for (let [e, s] of t) {
1223
+ if (s.start) {
1224
+ let i = Date.now() - s.start;
1225
+ s.start = this.#c.now() - i;
1226
+ }
1227
+ this.set(e, s.value, s);
1228
+ }
1229
+ }
1230
+ set(t, e, s = {}) {
1231
+ if (e === void 0) return this.delete(t), this;
1232
+ let { ttl: i = this.ttl, start: r, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: a } = s, { noUpdateTTL: l = this.noUpdateTTL } = s, u = this.#I(t, e, s.size || 0, h);
1233
+ if (this.maxEntrySize && u > this.maxEntrySize) return a && (a.set = "miss", a.maxEntrySizeExceeded = !0), this.#O(t, "set"), this;
1234
+ let c = this.#h === 0 ? void 0 : this.#f.get(t);
1235
+ if (c === void 0) c = this.#h === 0 ? this.#p : this.#R.length !== 0 ? this.#R.pop() : this.#h === this.#t ? this.#B(!1) : this.#h, this.#a[c] = t, this.#i[c] = e, this.#f.set(t, c), this.#d[this.#p] = c, this.#E[c] = this.#p, this.#p = c, this.#h++, this.#L(c, u, a), a && (a.set = "add"), l = !1, this.#_ && this.#r?.(e, t, "add");
1236
+ else {
1237
+ this.#W(c);
1238
+ let d = this.#i[c];
1239
+ if (e !== d) {
1240
+ if (this.#A && this.#l(d)) {
1241
+ d.__abortController.abort(new Error("replaced"));
1242
+ let { __staleWhileFetching: f } = d;
1243
+ f !== void 0 && !o && (this.#x && this.#n?.(f, t, "set"), this.#e && this.#m?.push([
1244
+ f,
1245
+ t,
1246
+ "set"
1247
+ ]));
1248
+ } else o || (this.#x && this.#n?.(d, t, "set"), this.#e && this.#m?.push([
1249
+ d,
1250
+ t,
1251
+ "set"
1252
+ ]));
1253
+ if (this.#P(c), this.#L(c, u, a), this.#i[c] = e, a) {
1254
+ a.set = "replace";
1255
+ let f = d && this.#l(d) ? d.__staleWhileFetching : d;
1256
+ f !== void 0 && (a.oldValue = f);
1257
+ }
1258
+ } else a && (a.set = "update");
1259
+ this.#_ && this.onInsert?.(e, t, e === d ? "update" : "replace");
1260
+ }
1261
+ if (i !== 0 && !this.#g && this.#M(), this.#g && (l || this.#j(c, i, r), a && this.#N(a, c)), !o && this.#e && this.#m) {
1262
+ let d = this.#m, f;
1263
+ for (; f = d?.shift();) this.#o?.(...f);
1264
+ }
1265
+ return this;
1266
+ }
1267
+ pop() {
1268
+ try {
1269
+ for (; this.#h;) {
1270
+ let t = this.#i[this.#b];
1271
+ if (this.#B(!0), this.#l(t)) {
1272
+ if (t.__staleWhileFetching) return t.__staleWhileFetching;
1273
+ } else if (t !== void 0) return t;
1274
+ }
1275
+ } finally {
1276
+ if (this.#e && this.#m) {
1277
+ let t = this.#m, e;
1278
+ for (; e = t?.shift();) this.#o?.(...e);
1279
+ }
1280
+ }
1281
+ }
1282
+ #B(t) {
1283
+ let e = this.#b, s = this.#a[e], i = this.#i[e];
1284
+ return this.#A && this.#l(i) ? i.__abortController.abort(new Error("evicted")) : (this.#x || this.#e) && (this.#x && this.#n?.(i, s, "evict"), this.#e && this.#m?.push([
1285
+ i,
1286
+ s,
1287
+ "evict"
1288
+ ])), this.#P(e), this.#y?.[e] && (clearTimeout(this.#y[e]), this.#y[e] = void 0), t && (this.#a[e] = void 0, this.#i[e] = void 0, this.#R.push(e)), this.#h === 1 ? (this.#b = this.#p = 0, this.#R.length = 0) : this.#b = this.#d[e], this.#f.delete(s), this.#h--, e;
1289
+ }
1290
+ has(t, e = {}) {
1291
+ let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, r = this.#f.get(t);
1292
+ if (r !== void 0) {
1293
+ let o = this.#i[r];
1294
+ if (this.#l(o) && o.__staleWhileFetching === void 0) return !1;
1295
+ if (this.#v(r)) i && (i.has = "stale", this.#N(i, r));
1296
+ else return s && this.#k(r), i && (i.has = "hit", this.#N(i, r)), !0;
1297
+ } else i && (i.has = "miss");
1298
+ return !1;
1299
+ }
1300
+ peek(t, e = {}) {
1301
+ let { allowStale: s = this.allowStale } = e, i = this.#f.get(t);
1302
+ if (i === void 0 || !s && this.#v(i)) return;
1303
+ let r = this.#i[i];
1304
+ return this.#l(r) ? r.__staleWhileFetching : r;
1305
+ }
1306
+ #U(t, e, s, i) {
1307
+ let r = e === void 0 ? void 0 : this.#i[e];
1308
+ if (this.#l(r)) return r;
1309
+ let o = new At(), { signal: h } = s;
1310
+ h?.addEventListener("abort", () => o.abort(h.reason), { signal: o.signal });
1311
+ let a = {
1312
+ signal: o.signal,
1313
+ options: s,
1314
+ context: i
1315
+ }, l = (p, w = !1) => {
1316
+ let { aborted: g } = o.signal, S = s.ignoreFetchAbort && p !== void 0, E = s.ignoreFetchAbort || !!(s.allowStaleOnFetchAbort && p !== void 0);
1317
+ if (s.status && (g && !w ? (s.status.fetchAborted = !0, s.status.fetchError = o.signal.reason, S && (s.status.fetchAbortIgnored = !0)) : s.status.fetchResolved = !0), g && !S && !w) return c(o.signal.reason, E);
1318
+ let y = f, b = this.#i[e];
1319
+ return (b === f || S && w && b === void 0) && (p === void 0 ? y.__staleWhileFetching !== void 0 ? this.#i[e] = y.__staleWhileFetching : this.#O(t, "fetch") : (s.status && (s.status.fetchUpdated = !0), this.set(t, p, a.options))), p;
1320
+ }, u = (p) => (s.status && (s.status.fetchRejected = !0, s.status.fetchError = p), c(p, !1)), c = (p, w) => {
1321
+ let { aborted: g } = o.signal, S = g && s.allowStaleOnFetchAbort, E = S || s.allowStaleOnFetchRejection, y = E || s.noDeleteOnFetchRejection, b = f;
1322
+ if (this.#i[e] === f && (!y || !w && b.__staleWhileFetching === void 0 ? this.#O(t, "fetch") : S || (this.#i[e] = b.__staleWhileFetching)), E) return s.status && b.__staleWhileFetching !== void 0 && (s.status.returnedStale = !0), b.__staleWhileFetching;
1323
+ if (b.__returned === b) throw p;
1324
+ }, d = (p, w) => {
1325
+ let g = this.#S?.(t, r, a);
1326
+ g && g instanceof Promise && g.then((S) => p(S === void 0 ? void 0 : S), w), o.signal.addEventListener("abort", () => {
1327
+ (!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (p(void 0), s.allowStaleOnFetchAbort && (p = (S) => l(S, !0)));
1328
+ });
1329
+ };
1330
+ s.status && (s.status.fetchDispatched = !0);
1331
+ let f = new Promise(d).then(l, u), m = Object.assign(f, {
1332
+ __abortController: o,
1333
+ __staleWhileFetching: r,
1334
+ __returned: void 0
1335
+ });
1336
+ return e === void 0 ? (this.set(t, m, {
1337
+ ...a.options,
1338
+ status: void 0
1339
+ }), e = this.#f.get(t)) : this.#i[e] = m, m;
1340
+ }
1341
+ #l(t) {
1342
+ if (!this.#A) return !1;
1343
+ let e = t;
1344
+ return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof At;
1345
+ }
1346
+ async fetch(t, e = {}) {
1347
+ let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: h = this.noDisposeOnSet, size: a = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: u = this.noUpdateTTL, noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: m = this.allowStaleOnFetchAbort, context: p, forceRefresh: w = !1, status: g, signal: S } = e;
1348
+ if (!this.#A) return g && (g.fetch = "get"), this.get(t, {
1349
+ allowStale: s,
1350
+ updateAgeOnGet: i,
1351
+ noDeleteOnStaleGet: r,
1352
+ status: g
1353
+ });
1354
+ let E = {
1355
+ allowStale: s,
1356
+ updateAgeOnGet: i,
1357
+ noDeleteOnStaleGet: r,
1358
+ ttl: o,
1359
+ noDisposeOnSet: h,
1360
+ size: a,
1361
+ sizeCalculation: l,
1362
+ noUpdateTTL: u,
1363
+ noDeleteOnFetchRejection: c,
1364
+ allowStaleOnFetchRejection: d,
1365
+ allowStaleOnFetchAbort: m,
1366
+ ignoreFetchAbort: f,
1367
+ status: g,
1368
+ signal: S
1369
+ }, y = this.#f.get(t);
1370
+ if (y === void 0) {
1371
+ g && (g.fetch = "miss");
1372
+ let b = this.#U(t, y, E, p);
1373
+ return b.__returned = b;
1374
+ } else {
1375
+ let b = this.#i[y];
1376
+ if (this.#l(b)) {
1377
+ let Z = s && b.__staleWhileFetching !== void 0;
1378
+ return g && (g.fetch = "inflight", Z && (g.returnedStale = !0)), Z ? b.__staleWhileFetching : b.__returned = b;
1379
+ }
1380
+ let z = this.#v(y);
1381
+ if (!w && !z) return g && (g.fetch = "hit"), this.#W(y), i && this.#k(y), g && this.#N(g, y), b;
1382
+ let $ = this.#U(t, y, E, p), J = $.__staleWhileFetching !== void 0 && s;
1383
+ return g && (g.fetch = z ? "stale" : "refresh", J && z && (g.returnedStale = !0)), J ? $.__staleWhileFetching : $.__returned = $;
1384
+ }
1385
+ }
1386
+ async forceFetch(t, e = {}) {
1387
+ let s = await this.fetch(t, e);
1388
+ if (s === void 0) throw new Error("fetch() returned undefined");
1389
+ return s;
1390
+ }
1391
+ memo(t, e = {}) {
1392
+ let s = this.#w;
1393
+ if (!s) throw new Error("no memoMethod provided to constructor");
1394
+ let { context: i, forceRefresh: r, ...o } = e, h = this.get(t, o);
1395
+ if (!r && h !== void 0) return h;
1396
+ let a = s(t, h, {
1397
+ options: o,
1398
+ context: i
1399
+ });
1400
+ return this.set(t, a, o), a;
1401
+ }
1402
+ get(t, e = {}) {
1403
+ let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: o } = e, h = this.#f.get(t);
1404
+ if (h !== void 0) {
1405
+ let a = this.#i[h], l = this.#l(a);
1406
+ return o && this.#N(o, h), this.#v(h) ? (o && (o.get = "stale"), l ? (o && s && a.__staleWhileFetching !== void 0 && (o.returnedStale = !0), s ? a.__staleWhileFetching : void 0) : (r || this.#O(t, "expire"), o && s && (o.returnedStale = !0), s ? a : void 0)) : (o && (o.get = "hit"), l ? a.__staleWhileFetching : (this.#W(h), i && this.#k(h), a));
1407
+ } else o && (o.get = "miss");
1408
+ }
1409
+ #$(t, e) {
1410
+ this.#E[e] = t, this.#d[t] = e;
1411
+ }
1412
+ #W(t) {
1413
+ t !== this.#p && (t === this.#b ? this.#b = this.#d[t] : this.#$(this.#E[t], this.#d[t]), this.#$(this.#p, t), this.#p = t);
1414
+ }
1415
+ delete(t) {
1416
+ return this.#O(t, "delete");
1417
+ }
1418
+ #O(t, e) {
1419
+ let s = !1;
1420
+ if (this.#h !== 0) {
1421
+ let i = this.#f.get(t);
1422
+ if (i !== void 0) if (this.#y?.[i] && (clearTimeout(this.#y?.[i]), this.#y[i] = void 0), s = !0, this.#h === 1) this.#H(e);
1423
+ else {
1424
+ this.#P(i);
1425
+ let r = this.#i[i];
1426
+ if (this.#l(r) ? r.__abortController.abort(new Error("deleted")) : (this.#x || this.#e) && (this.#x && this.#n?.(r, t, e), this.#e && this.#m?.push([
1427
+ r,
1428
+ t,
1429
+ e
1430
+ ])), this.#f.delete(t), this.#a[i] = void 0, this.#i[i] = void 0, i === this.#p) this.#p = this.#E[i];
1431
+ else if (i === this.#b) this.#b = this.#d[i];
1432
+ else {
1433
+ let o = this.#E[i];
1434
+ this.#d[o] = this.#d[i];
1435
+ let h = this.#d[i];
1436
+ this.#E[h] = this.#E[i];
1437
+ }
1438
+ this.#h--, this.#R.push(i);
1439
+ }
1440
+ }
1441
+ if (this.#e && this.#m?.length) {
1442
+ let i = this.#m, r;
1443
+ for (; r = i?.shift();) this.#o?.(...r);
1444
+ }
1445
+ return s;
1446
+ }
1447
+ clear() {
1448
+ return this.#H("delete");
1449
+ }
1450
+ #H(t) {
1451
+ for (let e of this.#D({ allowStale: !0 })) {
1452
+ let s = this.#i[e];
1453
+ if (this.#l(s)) s.__abortController.abort(new Error("deleted"));
1454
+ else {
1455
+ let i = this.#a[e];
1456
+ this.#x && this.#n?.(s, i, t), this.#e && this.#m?.push([
1457
+ s,
1458
+ i,
1459
+ t
1460
+ ]);
1461
+ }
1462
+ }
1463
+ if (this.#f.clear(), this.#i.fill(void 0), this.#a.fill(void 0), this.#g && this.#T) {
1464
+ this.#g.fill(0), this.#T.fill(0);
1465
+ for (let e of this.#y ?? []) e !== void 0 && clearTimeout(e);
1466
+ this.#y?.fill(void 0);
1467
+ }
1468
+ if (this.#C && this.#C.fill(0), this.#b = 0, this.#p = 0, this.#R.length = 0, this.#u = 0, this.#h = 0, this.#e && this.#m) {
1469
+ let e = this.#m, s;
1470
+ for (; s = e?.shift();) this.#o?.(...s);
1471
+ }
1472
+ }
1473
+ };
1474
+ var Ne = typeof process == "object" && process ? process : {
1475
+ stdout: null,
1476
+ stderr: null
1477
+ };
1478
+ var oi = (n) => !!n && typeof n == "object" && (n instanceof V || n instanceof Pe || hi(n) || ai(n));
1479
+ var hi = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.pipe == "function" && n.pipe !== Pe.Writable.prototype.pipe;
1480
+ var ai = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.write == "function" && typeof n.end == "function";
1481
+ var G = Symbol("EOF");
1482
+ var H = Symbol("maybeEmitEnd");
1483
+ var K = Symbol("emittedEnd");
1484
+ var kt = Symbol("emittingEnd");
1485
+ var ut = Symbol("emittedError");
1486
+ var Rt = Symbol("closed");
1487
+ var _e = Symbol("read");
1488
+ var Ot = Symbol("flush");
1489
+ var Le = Symbol("flushChunk");
1490
+ var P = Symbol("encoding");
1491
+ var et = Symbol("decoder");
1492
+ var v = Symbol("flowing");
1493
+ var dt = Symbol("paused");
1494
+ var st = Symbol("resume");
1495
+ var C = Symbol("buffer");
1496
+ var F = Symbol("pipes");
1497
+ var T = Symbol("bufferLength");
1498
+ var Yt = Symbol("bufferPush");
1499
+ var Ft = Symbol("bufferShift");
1500
+ var k = Symbol("objectMode");
1501
+ var x = Symbol("destroyed");
1502
+ var Xt = Symbol("error");
1503
+ var Jt = Symbol("emitData");
1504
+ var We = Symbol("emitEnd");
1505
+ var Zt = Symbol("emitEnd2");
1506
+ var B = Symbol("async");
1507
+ var Qt = Symbol("abort");
1508
+ var Dt = Symbol("aborted");
1509
+ var pt = Symbol("signal");
1510
+ var Y = Symbol("dataListeners");
1511
+ var M = Symbol("discarded");
1512
+ var mt = (n) => Promise.resolve().then(n);
1513
+ var li = (n) => n();
1514
+ var ci = (n) => n === "end" || n === "finish" || n === "prefinish";
1515
+ var fi = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0;
1516
+ var ui = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n);
1517
+ var Mt = class {
1518
+ src;
1519
+ dest;
1520
+ opts;
1521
+ ondrain;
1522
+ constructor(t, e, s) {
1523
+ this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[st](), this.dest.on("drain", this.ondrain);
1524
+ }
1525
+ unpipe() {
1526
+ this.dest.removeListener("drain", this.ondrain);
1527
+ }
1528
+ proxyErrors(t) {}
1529
+ end() {
1530
+ this.unpipe(), this.opts.end && this.dest.end();
1531
+ }
1532
+ };
1533
+ var te = class extends Mt {
1534
+ unpipe() {
1535
+ this.src.removeListener("error", this.proxyErrors), super.unpipe();
1536
+ }
1537
+ constructor(t, e, s) {
1538
+ super(t, e, s), this.proxyErrors = (i) => this.dest.emit("error", i), t.on("error", this.proxyErrors);
1539
+ }
1540
+ };
1541
+ var di = (n) => !!n.objectMode;
1542
+ var pi = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer";
1543
+ var V = class extends EventEmitter {
1544
+ [v] = !1;
1545
+ [dt] = !1;
1546
+ [F] = [];
1547
+ [C] = [];
1548
+ [k];
1549
+ [P];
1550
+ [B];
1551
+ [et];
1552
+ [G] = !1;
1553
+ [K] = !1;
1554
+ [kt] = !1;
1555
+ [Rt] = !1;
1556
+ [ut] = null;
1557
+ [T] = 0;
1558
+ [x] = !1;
1559
+ [pt];
1560
+ [Dt] = !1;
1561
+ [Y] = 0;
1562
+ [M] = !1;
1563
+ writable = !0;
1564
+ readable = !0;
1565
+ constructor(...t) {
1566
+ let e = t[0] || {};
1567
+ if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
1568
+ di(e) ? (this[k] = !0, this[P] = null) : pi(e) ? (this[P] = e.encoding, this[k] = !1) : (this[k] = !1, this[P] = null), this[B] = !!e.async, this[et] = this[P] ? new StringDecoder(this[P]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[C] }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[F] });
1569
+ let { signal: s } = e;
1570
+ s && (this[pt] = s, s.aborted ? this[Qt]() : s.addEventListener("abort", () => this[Qt]()));
1571
+ }
1572
+ get bufferLength() {
1573
+ return this[T];
1574
+ }
1575
+ get encoding() {
1576
+ return this[P];
1577
+ }
1578
+ set encoding(t) {
1579
+ throw new Error("Encoding must be set at instantiation time");
1580
+ }
1581
+ setEncoding(t) {
1582
+ throw new Error("Encoding must be set at instantiation time");
1583
+ }
1584
+ get objectMode() {
1585
+ return this[k];
1586
+ }
1587
+ set objectMode(t) {
1588
+ throw new Error("objectMode must be set at instantiation time");
1589
+ }
1590
+ get async() {
1591
+ return this[B];
1592
+ }
1593
+ set async(t) {
1594
+ this[B] = this[B] || !!t;
1595
+ }
1596
+ [Qt]() {
1597
+ this[Dt] = !0, this.emit("abort", this[pt]?.reason), this.destroy(this[pt]?.reason);
1598
+ }
1599
+ get aborted() {
1600
+ return this[Dt];
1601
+ }
1602
+ set aborted(t) {}
1603
+ write(t, e, s) {
1604
+ if (this[Dt]) return !1;
1605
+ if (this[G]) throw new Error("write after end");
1606
+ if (this[x]) return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), !0;
1607
+ typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
1608
+ let i = this[B] ? mt : li;
1609
+ if (!this[k] && !Buffer.isBuffer(t)) {
1610
+ if (ui(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
1611
+ else if (fi(t)) t = Buffer.from(t);
1612
+ else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
1613
+ }
1614
+ return this[k] ? (this[v] && this[T] !== 0 && this[Ot](!0), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : t.length ? (typeof t == "string" && (e !== this[P] || this[et]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[P] && (t = this[et].write(t)), this[v] && this[T] !== 0 && this[Ot](!0), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : (this[T] !== 0 && this.emit("readable"), s && i(s), this[v]);
1615
+ }
1616
+ read(t) {
1617
+ if (this[x]) return null;
1618
+ if (this[M] = !1, this[T] === 0 || t === 0 || t && t > this[T]) return this[H](), null;
1619
+ this[k] && (t = null), this[C].length > 1 && !this[k] && (this[C] = [this[P] ? this[C].join("") : Buffer.concat(this[C], this[T])]);
1620
+ let e = this[_e](t || null, this[C][0]);
1621
+ return this[H](), e;
1622
+ }
1623
+ [_e](t, e) {
1624
+ if (this[k]) this[Ft]();
1625
+ else {
1626
+ let s = e;
1627
+ t === s.length || t === null ? this[Ft]() : typeof s == "string" ? (this[C][0] = s.slice(t), e = s.slice(0, t), this[T] -= t) : (this[C][0] = s.subarray(t), e = s.subarray(0, t), this[T] -= t);
1628
+ }
1629
+ return this.emit("data", e), !this[C].length && !this[G] && this.emit("drain"), e;
1630
+ }
1631
+ end(t, e, s) {
1632
+ return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[G] = !0, this.writable = !1, (this[v] || !this[dt]) && this[H](), this;
1633
+ }
1634
+ [st]() {
1635
+ this[x] || (!this[Y] && !this[F].length && (this[M] = !0), this[dt] = !1, this[v] = !0, this.emit("resume"), this[C].length ? this[Ot]() : this[G] ? this[H]() : this.emit("drain"));
1636
+ }
1637
+ resume() {
1638
+ return this[st]();
1639
+ }
1640
+ pause() {
1641
+ this[v] = !1, this[dt] = !0, this[M] = !1;
1642
+ }
1643
+ get destroyed() {
1644
+ return this[x];
1645
+ }
1646
+ get flowing() {
1647
+ return this[v];
1648
+ }
1649
+ get paused() {
1650
+ return this[dt];
1651
+ }
1652
+ [Yt](t) {
1653
+ this[k] ? this[T] += 1 : this[T] += t.length, this[C].push(t);
1654
+ }
1655
+ [Ft]() {
1656
+ return this[k] ? this[T] -= 1 : this[T] -= this[C][0].length, this[C].shift();
1657
+ }
1658
+ [Ot](t = !1) {
1659
+ do ;
1660
+ while (this[Le](this[Ft]()) && this[C].length);
1661
+ !t && !this[C].length && !this[G] && this.emit("drain");
1662
+ }
1663
+ [Le](t) {
1664
+ return this.emit("data", t), this[v];
1665
+ }
1666
+ pipe(t, e) {
1667
+ if (this[x]) return t;
1668
+ this[M] = !1;
1669
+ let s = this[K];
1670
+ return e = e || {}, t === Ne.stdout || t === Ne.stderr ? e.end = !1 : e.end = e.end !== !1, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F].push(e.proxyErrors ? new te(this, t, e) : new Mt(this, t, e)), this[B] ? mt(() => this[st]()) : this[st]()), t;
1671
+ }
1672
+ unpipe(t) {
1673
+ let e = this[F].find((s) => s.dest === t);
1674
+ e && (this[F].length === 1 ? (this[v] && this[Y] === 0 && (this[v] = !1), this[F] = []) : this[F].splice(this[F].indexOf(e), 1), e.unpipe());
1675
+ }
1676
+ addListener(t, e) {
1677
+ return this.on(t, e);
1678
+ }
1679
+ on(t, e) {
1680
+ let s = super.on(t, e);
1681
+ if (t === "data") this[M] = !1, this[Y]++, !this[F].length && !this[v] && this[st]();
1682
+ else if (t === "readable" && this[T] !== 0) super.emit("readable");
1683
+ else if (ci(t) && this[K]) super.emit(t), this.removeAllListeners(t);
1684
+ else if (t === "error" && this[ut]) {
1685
+ let i = e;
1686
+ this[B] ? mt(() => i.call(this, this[ut])) : i.call(this, this[ut]);
1687
+ }
1688
+ return s;
1689
+ }
1690
+ removeListener(t, e) {
1691
+ return this.off(t, e);
1692
+ }
1693
+ off(t, e) {
1694
+ let s = super.off(t, e);
1695
+ return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M] && !this[F].length && (this[v] = !1)), s;
1696
+ }
1697
+ removeAllListeners(t) {
1698
+ let e = super.removeAllListeners(t);
1699
+ return (t === "data" || t === void 0) && (this[Y] = 0, !this[M] && !this[F].length && (this[v] = !1)), e;
1700
+ }
1701
+ get emittedEnd() {
1702
+ return this[K];
1703
+ }
1704
+ [H]() {
1705
+ !this[kt] && !this[K] && !this[x] && this[C].length === 0 && this[G] && (this[kt] = !0, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Rt] && this.emit("close"), this[kt] = !1);
1706
+ }
1707
+ emit(t, ...e) {
1708
+ let s = e[0];
1709
+ if (t !== "error" && t !== "close" && t !== x && this[x]) return !1;
1710
+ if (t === "data") return !this[k] && !s ? !1 : this[B] ? (mt(() => this[Jt](s)), !0) : this[Jt](s);
1711
+ if (t === "end") return this[We]();
1712
+ if (t === "close") {
1713
+ if (this[Rt] = !0, !this[K] && !this[x]) return !1;
1714
+ let r = super.emit("close");
1715
+ return this.removeAllListeners("close"), r;
1716
+ } else if (t === "error") {
1717
+ this[ut] = s, super.emit(Xt, s);
1718
+ let r = !this[pt] || this.listeners("error").length ? super.emit("error", s) : !1;
1719
+ return this[H](), r;
1720
+ } else if (t === "resume") {
1721
+ let r = super.emit("resume");
1722
+ return this[H](), r;
1723
+ } else if (t === "finish" || t === "prefinish") {
1724
+ let r = super.emit(t);
1725
+ return this.removeAllListeners(t), r;
1726
+ }
1727
+ let i = super.emit(t, ...e);
1728
+ return this[H](), i;
1729
+ }
1730
+ [Jt](t) {
1731
+ for (let s of this[F]) s.dest.write(t) === !1 && this.pause();
1732
+ let e = this[M] ? !1 : super.emit("data", t);
1733
+ return this[H](), e;
1734
+ }
1735
+ [We]() {
1736
+ return this[K] ? !1 : (this[K] = !0, this.readable = !1, this[B] ? (mt(() => this[Zt]()), !0) : this[Zt]());
1737
+ }
1738
+ [Zt]() {
1739
+ if (this[et]) {
1740
+ let e = this[et].end();
1741
+ if (e) {
1742
+ for (let s of this[F]) s.dest.write(e);
1743
+ this[M] || super.emit("data", e);
1744
+ }
1745
+ }
1746
+ for (let e of this[F]) e.end();
1747
+ let t = super.emit("end");
1748
+ return this.removeAllListeners("end"), t;
1749
+ }
1750
+ async collect() {
1751
+ let t = Object.assign([], { dataLength: 0 });
1752
+ this[k] || (t.dataLength = 0);
1753
+ let e = this.promise();
1754
+ return this.on("data", (s) => {
1755
+ t.push(s), this[k] || (t.dataLength += s.length);
1756
+ }), await e, t;
1757
+ }
1758
+ async concat() {
1759
+ if (this[k]) throw new Error("cannot concat in objectMode");
1760
+ let t = await this.collect();
1761
+ return this[P] ? t.join("") : Buffer.concat(t, t.dataLength);
1762
+ }
1763
+ async promise() {
1764
+ return new Promise((t, e) => {
1765
+ this.on(x, () => e(new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
1766
+ });
1767
+ }
1768
+ [Symbol.asyncIterator]() {
1769
+ this[M] = !1;
1770
+ let t = !1, e = async () => (this.pause(), t = !0, {
1771
+ value: void 0,
1772
+ done: !0
1773
+ });
1774
+ return {
1775
+ next: () => {
1776
+ if (t) return e();
1777
+ let i = this.read();
1778
+ if (i !== null) return Promise.resolve({
1779
+ done: !1,
1780
+ value: i
1781
+ });
1782
+ if (this[G]) return e();
1783
+ let r, o, h = (c) => {
1784
+ this.off("data", a), this.off("end", l), this.off(x, u), e(), o(c);
1785
+ }, a = (c) => {
1786
+ this.off("error", h), this.off("end", l), this.off(x, u), this.pause(), r({
1787
+ value: c,
1788
+ done: !!this[G]
1789
+ });
1790
+ }, l = () => {
1791
+ this.off("error", h), this.off("data", a), this.off(x, u), e(), r({
1792
+ done: !0,
1793
+ value: void 0
1794
+ });
1795
+ }, u = () => h(new Error("stream destroyed"));
1796
+ return new Promise((c, d) => {
1797
+ o = d, r = c, this.once(x, u), this.once("error", h), this.once("end", l), this.once("data", a);
1798
+ });
1799
+ },
1800
+ throw: e,
1801
+ return: e,
1802
+ [Symbol.asyncIterator]() {
1803
+ return this;
1804
+ },
1805
+ [Symbol.asyncDispose]: async () => {}
1806
+ };
1807
+ }
1808
+ [Symbol.iterator]() {
1809
+ this[M] = !1;
1810
+ let t = !1, e = () => (this.pause(), this.off(Xt, e), this.off(x, e), this.off("end", e), t = !0, {
1811
+ done: !0,
1812
+ value: void 0
1813
+ }), s = () => {
1814
+ if (t) return e();
1815
+ let i = this.read();
1816
+ return i === null ? e() : {
1817
+ done: !1,
1818
+ value: i
1819
+ };
1820
+ };
1821
+ return this.once("end", e), this.once(Xt, e), this.once(x, e), {
1822
+ next: s,
1823
+ throw: e,
1824
+ return: e,
1825
+ [Symbol.iterator]() {
1826
+ return this;
1827
+ },
1828
+ [Symbol.dispose]: () => {}
1829
+ };
1830
+ }
1831
+ destroy(t) {
1832
+ if (this[x]) return t ? this.emit("error", t) : this.emit(x), this;
1833
+ this[x] = !0, this[M] = !0, this[C].length = 0, this[T] = 0;
1834
+ let e = this;
1835
+ return typeof e.close == "function" && !this[Rt] && e.close(), t ? this.emit("error", t) : this.emit(x), this;
1836
+ }
1837
+ static get isStream() {
1838
+ return oi;
1839
+ }
1840
+ };
1841
+ var vi = realpathSync.native;
1842
+ var wt = {
1843
+ lstatSync,
1844
+ readdir: readdir$1,
1845
+ readdirSync,
1846
+ readlinkSync,
1847
+ realpathSync: vi,
1848
+ promises: {
1849
+ lstat,
1850
+ readdir,
1851
+ readlink,
1852
+ realpath
1853
+ }
1854
+ };
1855
+ var Ue = (n) => !n || n === wt || n === xi ? wt : {
1856
+ ...wt,
1857
+ ...n,
1858
+ promises: {
1859
+ ...wt.promises,
1860
+ ...n.promises || {}
1861
+ }
1862
+ };
1863
+ var $e = /^\\\\\?\\([a-z]:)\\?$/i;
1864
+ var Ri = (n) => n.replace(/\//g, "\\").replace($e, "$1\\");
1865
+ var Oi = /[\\\/]/;
1866
+ var L = 0;
1867
+ var Ge = 1;
1868
+ var He = 2;
1869
+ var U = 4;
1870
+ var qe = 6;
1871
+ var Ke = 8;
1872
+ var X = 10;
1873
+ var Ve = 12;
1874
+ var _ = 15;
1875
+ var gt = ~_;
1876
+ var se = 16;
1877
+ var je = 32;
1878
+ var yt = 64;
1879
+ var j = 128;
1880
+ var Nt = 256;
1881
+ var Lt = 512;
1882
+ var Ie = yt | j | Lt;
1883
+ var Fi = 1023;
1884
+ var ie = (n) => n.isFile() ? Ke : n.isDirectory() ? U : n.isSymbolicLink() ? X : n.isCharacterDevice() ? He : n.isBlockDevice() ? qe : n.isSocket() ? Ve : n.isFIFO() ? Ge : L;
1885
+ var ze = new ft({ max: 4096 });
1886
+ var bt = (n) => {
1887
+ let t = ze.get(n);
1888
+ if (t) return t;
1889
+ let e = n.normalize("NFKD");
1890
+ return ze.set(n, e), e;
1891
+ };
1892
+ var Be = new ft({ max: 4096 });
1893
+ var _t = (n) => {
1894
+ let t = Be.get(n);
1895
+ if (t) return t;
1896
+ let e = bt(n.toLowerCase());
1897
+ return Be.set(n, e), e;
1898
+ };
1899
+ var Wt = class extends ft {
1900
+ constructor() {
1901
+ super({ max: 256 });
1902
+ }
1903
+ };
1904
+ var ne = class extends ft {
1905
+ constructor(t = 16384) {
1906
+ super({
1907
+ maxSize: t,
1908
+ sizeCalculation: (e) => e.length + 1
1909
+ });
1910
+ }
1911
+ };
1912
+ var Ye = Symbol("PathScurry setAsCwd");
1913
+ var R = class {
1914
+ name;
1915
+ root;
1916
+ roots;
1917
+ parent;
1918
+ nocase;
1919
+ isCWD = !1;
1920
+ #t;
1921
+ #s;
1922
+ get dev() {
1923
+ return this.#s;
1924
+ }
1925
+ #n;
1926
+ get mode() {
1927
+ return this.#n;
1928
+ }
1929
+ #r;
1930
+ get nlink() {
1931
+ return this.#r;
1932
+ }
1933
+ #o;
1934
+ get uid() {
1935
+ return this.#o;
1936
+ }
1937
+ #S;
1938
+ get gid() {
1939
+ return this.#S;
1940
+ }
1941
+ #w;
1942
+ get rdev() {
1943
+ return this.#w;
1944
+ }
1945
+ #c;
1946
+ get blksize() {
1947
+ return this.#c;
1948
+ }
1949
+ #h;
1950
+ get ino() {
1951
+ return this.#h;
1952
+ }
1953
+ #u;
1954
+ get size() {
1955
+ return this.#u;
1956
+ }
1957
+ #f;
1958
+ get blocks() {
1959
+ return this.#f;
1960
+ }
1961
+ #a;
1962
+ get atimeMs() {
1963
+ return this.#a;
1964
+ }
1965
+ #i;
1966
+ get mtimeMs() {
1967
+ return this.#i;
1968
+ }
1969
+ #d;
1970
+ get ctimeMs() {
1971
+ return this.#d;
1972
+ }
1973
+ #E;
1974
+ get birthtimeMs() {
1975
+ return this.#E;
1976
+ }
1977
+ #b;
1978
+ get atime() {
1979
+ return this.#b;
1980
+ }
1981
+ #p;
1982
+ get mtime() {
1983
+ return this.#p;
1984
+ }
1985
+ #R;
1986
+ get ctime() {
1987
+ return this.#R;
1988
+ }
1989
+ #m;
1990
+ get birthtime() {
1991
+ return this.#m;
1992
+ }
1993
+ #C;
1994
+ #T;
1995
+ #g;
1996
+ #y;
1997
+ #x;
1998
+ #A;
1999
+ #e;
2000
+ #_;
2001
+ #M;
2002
+ #k;
2003
+ get parentPath() {
2004
+ return (this.parent || this).fullpath();
2005
+ }
2006
+ get path() {
2007
+ return this.parentPath;
2008
+ }
2009
+ constructor(t, e = L, s, i, r, o, h) {
2010
+ this.name = t, this.#C = r ? _t(t) : bt(t), this.#e = e & Fi, this.nocase = r, this.roots = i, this.root = s || this, this.#_ = o, this.#g = h.fullpath, this.#x = h.relative, this.#A = h.relativePosix, this.parent = h.parent, this.parent ? this.#t = this.parent.#t : this.#t = Ue(h.fs);
2011
+ }
2012
+ depth() {
2013
+ return this.#T !== void 0 ? this.#T : this.parent ? this.#T = this.parent.depth() + 1 : this.#T = 0;
2014
+ }
2015
+ childrenCache() {
2016
+ return this.#_;
2017
+ }
2018
+ resolve(t) {
2019
+ if (!t) return this;
2020
+ let e = this.getRootString(t), i = t.substring(e.length).split(this.splitSep);
2021
+ return e ? this.getRoot(e).#N(i) : this.#N(i);
2022
+ }
2023
+ #N(t) {
2024
+ let e = this;
2025
+ for (let s of t) e = e.child(s);
2026
+ return e;
2027
+ }
2028
+ children() {
2029
+ let t = this.#_.get(this);
2030
+ if (t) return t;
2031
+ let e = Object.assign([], { provisional: 0 });
2032
+ return this.#_.set(this, e), this.#e &= ~se, e;
2033
+ }
2034
+ child(t, e) {
2035
+ if (t === "" || t === ".") return this;
2036
+ if (t === "..") return this.parent || this;
2037
+ let s = this.children(), i = this.nocase ? _t(t) : bt(t);
2038
+ for (let a of s) if (a.#C === i) return a;
2039
+ let r = this.parent ? this.sep : "", o = this.#g ? this.#g + r + t : void 0, h = this.newChild(t, L, {
2040
+ ...e,
2041
+ parent: this,
2042
+ fullpath: o
2043
+ });
2044
+ return this.canReaddir() || (h.#e |= j), s.push(h), h;
2045
+ }
2046
+ relative() {
2047
+ if (this.isCWD) return "";
2048
+ if (this.#x !== void 0) return this.#x;
2049
+ let t = this.name, e = this.parent;
2050
+ if (!e) return this.#x = this.name;
2051
+ let s = e.relative();
2052
+ return s + (!s || !e.parent ? "" : this.sep) + t;
2053
+ }
2054
+ relativePosix() {
2055
+ if (this.sep === "/") return this.relative();
2056
+ if (this.isCWD) return "";
2057
+ if (this.#A !== void 0) return this.#A;
2058
+ let t = this.name, e = this.parent;
2059
+ if (!e) return this.#A = this.fullpathPosix();
2060
+ let s = e.relativePosix();
2061
+ return s + (!s || !e.parent ? "" : "/") + t;
2062
+ }
2063
+ fullpath() {
2064
+ if (this.#g !== void 0) return this.#g;
2065
+ let t = this.name, e = this.parent;
2066
+ if (!e) return this.#g = this.name;
2067
+ let i = e.fullpath() + (e.parent ? this.sep : "") + t;
2068
+ return this.#g = i;
2069
+ }
2070
+ fullpathPosix() {
2071
+ if (this.#y !== void 0) return this.#y;
2072
+ if (this.sep === "/") return this.#y = this.fullpath();
2073
+ if (!this.parent) {
2074
+ let i = this.fullpath().replace(/\\/g, "/");
2075
+ return /^[a-z]:\//i.test(i) ? this.#y = `//?/${i}` : this.#y = i;
2076
+ }
2077
+ let t = this.parent, e = t.fullpathPosix(), s = e + (!e || !t.parent ? "" : "/") + this.name;
2078
+ return this.#y = s;
2079
+ }
2080
+ isUnknown() {
2081
+ return (this.#e & _) === L;
2082
+ }
2083
+ isType(t) {
2084
+ return this[`is${t}`]();
2085
+ }
2086
+ getType() {
2087
+ return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : this.isSocket() ? "Socket" : "Unknown";
2088
+ }
2089
+ isFile() {
2090
+ return (this.#e & _) === Ke;
2091
+ }
2092
+ isDirectory() {
2093
+ return (this.#e & _) === U;
2094
+ }
2095
+ isCharacterDevice() {
2096
+ return (this.#e & _) === He;
2097
+ }
2098
+ isBlockDevice() {
2099
+ return (this.#e & _) === qe;
2100
+ }
2101
+ isFIFO() {
2102
+ return (this.#e & _) === Ge;
2103
+ }
2104
+ isSocket() {
2105
+ return (this.#e & _) === Ve;
2106
+ }
2107
+ isSymbolicLink() {
2108
+ return (this.#e & X) === X;
2109
+ }
2110
+ lstatCached() {
2111
+ return this.#e & je ? this : void 0;
2112
+ }
2113
+ readlinkCached() {
2114
+ return this.#M;
2115
+ }
2116
+ realpathCached() {
2117
+ return this.#k;
2118
+ }
2119
+ readdirCached() {
2120
+ let t = this.children();
2121
+ return t.slice(0, t.provisional);
2122
+ }
2123
+ canReadlink() {
2124
+ if (this.#M) return !0;
2125
+ if (!this.parent) return !1;
2126
+ let t = this.#e & _;
2127
+ return !(t !== L && t !== X || this.#e & Nt || this.#e & j);
2128
+ }
2129
+ calledReaddir() {
2130
+ return !!(this.#e & se);
2131
+ }
2132
+ isENOENT() {
2133
+ return !!(this.#e & j);
2134
+ }
2135
+ isNamed(t) {
2136
+ return this.nocase ? this.#C === _t(t) : this.#C === bt(t);
2137
+ }
2138
+ async readlink() {
2139
+ let t = this.#M;
2140
+ if (t) return t;
2141
+ if (this.canReadlink() && this.parent) try {
2142
+ let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e);
2143
+ if (s) return this.#M = s;
2144
+ } catch (e) {
2145
+ this.#D(e.code);
2146
+ return;
2147
+ }
2148
+ }
2149
+ readlinkSync() {
2150
+ let t = this.#M;
2151
+ if (t) return t;
2152
+ if (this.canReadlink() && this.parent) try {
2153
+ let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e);
2154
+ if (s) return this.#M = s;
2155
+ } catch (e) {
2156
+ this.#D(e.code);
2157
+ return;
2158
+ }
2159
+ }
2160
+ #j(t) {
2161
+ this.#e |= se;
2162
+ for (let e = t.provisional; e < t.length; e++) {
2163
+ let s = t[e];
2164
+ s && s.#v();
2165
+ }
2166
+ }
2167
+ #v() {
2168
+ this.#e & j || (this.#e = (this.#e | j) & gt, this.#G());
2169
+ }
2170
+ #G() {
2171
+ let t = this.children();
2172
+ t.provisional = 0;
2173
+ for (let e of t) e.#v();
2174
+ }
2175
+ #P() {
2176
+ this.#e |= Lt, this.#L();
2177
+ }
2178
+ #L() {
2179
+ if (this.#e & yt) return;
2180
+ let t = this.#e;
2181
+ (t & _) === U && (t &= gt), this.#e = t | yt, this.#G();
2182
+ }
2183
+ #I(t = "") {
2184
+ t === "ENOTDIR" || t === "EPERM" ? this.#L() : t === "ENOENT" ? this.#v() : this.children().provisional = 0;
2185
+ }
2186
+ #F(t = "") {
2187
+ t === "ENOTDIR" ? this.parent.#L() : t === "ENOENT" && this.#v();
2188
+ }
2189
+ #D(t = "") {
2190
+ let e = this.#e;
2191
+ e |= Nt, t === "ENOENT" && (e |= j), (t === "EINVAL" || t === "UNKNOWN") && (e &= gt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#L();
2192
+ }
2193
+ #z(t, e) {
2194
+ return this.#U(t, e) || this.#B(t, e);
2195
+ }
2196
+ #B(t, e) {
2197
+ let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _;
2198
+ return r !== U && r !== X && r !== L && (i.#e |= yt), e.unshift(i), e.provisional++, i;
2199
+ }
2200
+ #U(t, e) {
2201
+ for (let s = e.provisional; s < e.length; s++) {
2202
+ let i = e[s];
2203
+ if ((this.nocase ? _t(t.name) : bt(t.name)) === i.#C) return this.#l(t, i, s, e);
2204
+ }
2205
+ }
2206
+ #l(t, e, s, i) {
2207
+ let r = e.name;
2208
+ return e.#e = e.#e & gt | ie(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e;
2209
+ }
2210
+ async lstat() {
2211
+ if ((this.#e & j) === 0) try {
2212
+ return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
2213
+ } catch (t) {
2214
+ this.#F(t.code);
2215
+ }
2216
+ }
2217
+ lstatSync() {
2218
+ if ((this.#e & j) === 0) try {
2219
+ return this.#$(this.#t.lstatSync(this.fullpath())), this;
2220
+ } catch (t) {
2221
+ this.#F(t.code);
2222
+ }
2223
+ }
2224
+ #$(t) {
2225
+ let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: o, blocks: h, ctime: a, ctimeMs: l, dev: u, gid: c, ino: d, mode: f, mtime: m, mtimeMs: p, nlink: w, rdev: g, size: S, uid: E } = t;
2226
+ this.#b = e, this.#a = s, this.#m = i, this.#E = r, this.#c = o, this.#f = h, this.#R = a, this.#d = l, this.#s = u, this.#S = c, this.#h = d, this.#n = f, this.#p = m, this.#i = p, this.#r = w, this.#w = g, this.#u = S, this.#o = E;
2227
+ let y = ie(t);
2228
+ this.#e = this.#e & gt | y | je, y !== L && y !== U && y !== X && (this.#e |= yt);
2229
+ }
2230
+ #W = [];
2231
+ #O = !1;
2232
+ #H(t) {
2233
+ this.#O = !1;
2234
+ let e = this.#W.slice();
2235
+ this.#W.length = 0, e.forEach((s) => s(null, t));
2236
+ }
2237
+ readdirCB(t, e = !1) {
2238
+ if (!this.canReaddir()) {
2239
+ e ? t(null, []) : queueMicrotask(() => t(null, []));
2240
+ return;
2241
+ }
2242
+ let s = this.children();
2243
+ if (this.calledReaddir()) {
2244
+ let r = s.slice(0, s.provisional);
2245
+ e ? t(null, r) : queueMicrotask(() => t(null, r));
2246
+ return;
2247
+ }
2248
+ if (this.#W.push(t), this.#O) return;
2249
+ this.#O = !0;
2250
+ let i = this.fullpath();
2251
+ this.#t.readdir(i, { withFileTypes: !0 }, (r, o) => {
2252
+ if (r) this.#I(r.code), s.provisional = 0;
2253
+ else {
2254
+ for (let h of o) this.#z(h, s);
2255
+ this.#j(s);
2256
+ }
2257
+ this.#H(s.slice(0, s.provisional));
2258
+ });
2259
+ }
2260
+ #q;
2261
+ async readdir() {
2262
+ if (!this.canReaddir()) return [];
2263
+ let t = this.children();
2264
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
2265
+ let e = this.fullpath();
2266
+ if (this.#q) await this.#q;
2267
+ else {
2268
+ let s = () => {};
2269
+ this.#q = new Promise((i) => s = i);
2270
+ try {
2271
+ for (let i of await this.#t.promises.readdir(e, { withFileTypes: !0 })) this.#z(i, t);
2272
+ this.#j(t);
2273
+ } catch (i) {
2274
+ this.#I(i.code), t.provisional = 0;
2275
+ }
2276
+ this.#q = void 0, s();
2277
+ }
2278
+ return t.slice(0, t.provisional);
2279
+ }
2280
+ readdirSync() {
2281
+ if (!this.canReaddir()) return [];
2282
+ let t = this.children();
2283
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
2284
+ let e = this.fullpath();
2285
+ try {
2286
+ for (let s of this.#t.readdirSync(e, { withFileTypes: !0 })) this.#z(s, t);
2287
+ this.#j(t);
2288
+ } catch (s) {
2289
+ this.#I(s.code), t.provisional = 0;
2290
+ }
2291
+ return t.slice(0, t.provisional);
2292
+ }
2293
+ canReaddir() {
2294
+ if (this.#e & Ie) return !1;
2295
+ let t = _ & this.#e;
2296
+ return t === L || t === U || t === X;
2297
+ }
2298
+ shouldWalk(t, e) {
2299
+ return (this.#e & U) === U && !(this.#e & Ie) && !t.has(this) && (!e || e(this));
2300
+ }
2301
+ async realpath() {
2302
+ if (this.#k) return this.#k;
2303
+ if (!((Lt | Nt | j) & this.#e)) try {
2304
+ let t = await this.#t.promises.realpath(this.fullpath());
2305
+ return this.#k = this.resolve(t);
2306
+ } catch {
2307
+ this.#P();
2308
+ }
2309
+ }
2310
+ realpathSync() {
2311
+ if (this.#k) return this.#k;
2312
+ if (!((Lt | Nt | j) & this.#e)) try {
2313
+ let t = this.#t.realpathSync(this.fullpath());
2314
+ return this.#k = this.resolve(t);
2315
+ } catch {
2316
+ this.#P();
2317
+ }
2318
+ }
2319
+ [Ye](t) {
2320
+ if (t === this) return;
2321
+ t.isCWD = !1, this.isCWD = !0;
2322
+ let e = new Set([]), s = [], i = this;
2323
+ for (; i && i.parent;) e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
2324
+ for (i = t; i && i.parent && !e.has(i);) i.#x = void 0, i.#A = void 0, i = i.parent;
2325
+ }
2326
+ };
2327
+ var Pt = class n extends R {
2328
+ sep = "\\";
2329
+ splitSep = Oi;
2330
+ constructor(t, e = L, s, i, r, o, h) {
2331
+ super(t, e, s, i, r, o, h);
2332
+ }
2333
+ newChild(t, e = L, s = {}) {
2334
+ return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2335
+ }
2336
+ getRootString(t) {
2337
+ return win32.parse(t).root;
2338
+ }
2339
+ getRoot(t) {
2340
+ if (t = Ri(t.toUpperCase()), t === this.root.name) return this.root;
2341
+ for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s;
2342
+ return this.roots[t] = new it(t, this).root;
2343
+ }
2344
+ sameRoot(t, e = this.root.name) {
2345
+ return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
2346
+ }
2347
+ };
2348
+ var jt = class n extends R {
2349
+ splitSep = "/";
2350
+ sep = "/";
2351
+ constructor(t, e = L, s, i, r, o, h) {
2352
+ super(t, e, s, i, r, o, h);
2353
+ }
2354
+ getRootString(t) {
2355
+ return t.startsWith("/") ? "/" : "";
2356
+ }
2357
+ getRoot(t) {
2358
+ return this.root;
2359
+ }
2360
+ newChild(t, e = L, s = {}) {
2361
+ return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2362
+ }
2363
+ };
2364
+ var It = class {
2365
+ root;
2366
+ rootPath;
2367
+ roots;
2368
+ cwd;
2369
+ #t;
2370
+ #s;
2371
+ #n;
2372
+ nocase;
2373
+ #r;
2374
+ constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16384, fs: o = wt } = {}) {
2375
+ this.#r = Ue(o), (t instanceof URL || t.startsWith("file://")) && (t = fileURLToPath(t));
2376
+ let h = e.resolve(t);
2377
+ this.roots = Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt(), this.#s = new Wt(), this.#n = new ne(r);
2378
+ let a = h.substring(this.rootPath.length).split(s);
2379
+ if (a.length === 1 && !a[0] && a.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor");
2380
+ this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root;
2381
+ let l = this.root, u = a.length - 1, c = e.sep, d = this.rootPath, f = !1;
2382
+ for (let m of a) {
2383
+ let p = u--;
2384
+ l = l.child(m, {
2385
+ relative: new Array(p).fill("..").join(c),
2386
+ relativePosix: new Array(p).fill("..").join("/"),
2387
+ fullpath: d += (f ? "" : c) + m
2388
+ }), f = !0;
2389
+ }
2390
+ this.cwd = l;
2391
+ }
2392
+ depth(t = this.cwd) {
2393
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
2394
+ }
2395
+ childrenCache() {
2396
+ return this.#n;
2397
+ }
2398
+ resolve(...t) {
2399
+ let e = "";
2400
+ for (let r = t.length - 1; r >= 0; r--) {
2401
+ let o = t[r];
2402
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
2403
+ }
2404
+ let s = this.#t.get(e);
2405
+ if (s !== void 0) return s;
2406
+ let i = this.cwd.resolve(e).fullpath();
2407
+ return this.#t.set(e, i), i;
2408
+ }
2409
+ resolvePosix(...t) {
2410
+ let e = "";
2411
+ for (let r = t.length - 1; r >= 0; r--) {
2412
+ let o = t[r];
2413
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
2414
+ }
2415
+ let s = this.#s.get(e);
2416
+ if (s !== void 0) return s;
2417
+ let i = this.cwd.resolve(e).fullpathPosix();
2418
+ return this.#s.set(e, i), i;
2419
+ }
2420
+ relative(t = this.cwd) {
2421
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
2422
+ }
2423
+ relativePosix(t = this.cwd) {
2424
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
2425
+ }
2426
+ basename(t = this.cwd) {
2427
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
2428
+ }
2429
+ dirname(t = this.cwd) {
2430
+ return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
2431
+ }
2432
+ async readdir(t = this.cwd, e = { withFileTypes: !0 }) {
2433
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2434
+ let { withFileTypes: s } = e;
2435
+ if (t.canReaddir()) {
2436
+ let i = await t.readdir();
2437
+ return s ? i : i.map((r) => r.name);
2438
+ } else return [];
2439
+ }
2440
+ readdirSync(t = this.cwd, e = { withFileTypes: !0 }) {
2441
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2442
+ let { withFileTypes: s = !0 } = e;
2443
+ return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
2444
+ }
2445
+ async lstat(t = this.cwd) {
2446
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
2447
+ }
2448
+ lstatSync(t = this.cwd) {
2449
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
2450
+ }
2451
+ async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
2452
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2453
+ let s = await t.readlink();
2454
+ return e ? s : s?.fullpath();
2455
+ }
2456
+ readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
2457
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2458
+ let s = t.readlinkSync();
2459
+ return e ? s : s?.fullpath();
2460
+ }
2461
+ async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
2462
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2463
+ let s = await t.realpath();
2464
+ return e ? s : s?.fullpath();
2465
+ }
2466
+ realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
2467
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2468
+ let s = t.realpathSync();
2469
+ return e ? s : s?.fullpath();
2470
+ }
2471
+ async walk(t = this.cwd, e = {}) {
2472
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2473
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
2474
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
2475
+ let a = new Set(), l = (c, d) => {
2476
+ a.add(c), c.readdirCB((f, m) => {
2477
+ if (f) return d(f);
2478
+ let p = m.length;
2479
+ if (!p) return d();
2480
+ let w = () => {
2481
+ --p === 0 && d();
2482
+ };
2483
+ for (let g of m) (!r || r(g)) && h.push(s ? g : g.fullpath()), i && g.isSymbolicLink() ? g.realpath().then((S) => S?.isUnknown() ? S.lstat() : S).then((S) => S?.shouldWalk(a, o) ? l(S, w) : w()) : g.shouldWalk(a, o) ? l(g, w) : w();
2484
+ }, !0);
2485
+ }, u = t;
2486
+ return new Promise((c, d) => {
2487
+ l(u, (f) => {
2488
+ if (f) return d(f);
2489
+ c(h);
2490
+ });
2491
+ });
2492
+ }
2493
+ walkSync(t = this.cwd, e = {}) {
2494
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2495
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
2496
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
2497
+ let a = new Set([t]);
2498
+ for (let l of a) {
2499
+ let u = l.readdirSync();
2500
+ for (let c of u) {
2501
+ (!r || r(c)) && h.push(s ? c : c.fullpath());
2502
+ let d = c;
2503
+ if (c.isSymbolicLink()) {
2504
+ if (!(i && (d = c.realpathSync()))) continue;
2505
+ d.isUnknown() && d.lstatSync();
2506
+ }
2507
+ d.shouldWalk(a, o) && a.add(d);
2508
+ }
2509
+ }
2510
+ return h;
2511
+ }
2512
+ [Symbol.asyncIterator]() {
2513
+ return this.iterate();
2514
+ }
2515
+ iterate(t = this.cwd, e = {}) {
2516
+ return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
2517
+ }
2518
+ [Symbol.iterator]() {
2519
+ return this.iterateSync();
2520
+ }
2521
+ *iterateSync(t = this.cwd, e = {}) {
2522
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2523
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e;
2524
+ (!r || r(t)) && (yield s ? t : t.fullpath());
2525
+ let h = new Set([t]);
2526
+ for (let a of h) {
2527
+ let l = a.readdirSync();
2528
+ for (let u of l) {
2529
+ (!r || r(u)) && (yield s ? u : u.fullpath());
2530
+ let c = u;
2531
+ if (u.isSymbolicLink()) {
2532
+ if (!(i && (c = u.realpathSync()))) continue;
2533
+ c.isUnknown() && c.lstatSync();
2534
+ }
2535
+ c.shouldWalk(h, o) && h.add(c);
2536
+ }
2537
+ }
2538
+ }
2539
+ stream(t = this.cwd, e = {}) {
2540
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2541
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 });
2542
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
2543
+ let a = new Set(), l = [t], u = 0, c = () => {
2544
+ let d = !1;
2545
+ for (; !d;) {
2546
+ let f = l.shift();
2547
+ if (!f) {
2548
+ u === 0 && h.end();
2549
+ return;
2550
+ }
2551
+ u++, a.add(f);
2552
+ let m = (w, g, S = !1) => {
2553
+ if (w) return h.emit("error", w);
2554
+ if (i && !S) {
2555
+ let E = [];
2556
+ for (let y of g) y.isSymbolicLink() && E.push(y.realpath().then((b) => b?.isUnknown() ? b.lstat() : b));
2557
+ if (E.length) {
2558
+ Promise.all(E).then(() => m(null, g, !0));
2559
+ return;
2560
+ }
2561
+ }
2562
+ for (let E of g) E && (!r || r(E)) && (h.write(s ? E : E.fullpath()) || (d = !0));
2563
+ u--;
2564
+ for (let E of g) {
2565
+ let y = E.realpathCached() || E;
2566
+ y.shouldWalk(a, o) && l.push(y);
2567
+ }
2568
+ d && !h.flowing ? h.once("drain", c) : p || c();
2569
+ }, p = !0;
2570
+ f.readdirCB(m, !0), p = !1;
2571
+ }
2572
+ };
2573
+ return c(), h;
2574
+ }
2575
+ streamSync(t = this.cwd, e = {}) {
2576
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2577
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 }), a = new Set();
2578
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
2579
+ let l = [t], u = 0, c = () => {
2580
+ let d = !1;
2581
+ for (; !d;) {
2582
+ let f = l.shift();
2583
+ if (!f) {
2584
+ u === 0 && h.end();
2585
+ return;
2586
+ }
2587
+ u++, a.add(f);
2588
+ let m = f.readdirSync();
2589
+ for (let p of m) (!r || r(p)) && (h.write(s ? p : p.fullpath()) || (d = !0));
2590
+ u--;
2591
+ for (let p of m) {
2592
+ let w = p;
2593
+ if (p.isSymbolicLink()) {
2594
+ if (!(i && (w = p.realpathSync()))) continue;
2595
+ w.isUnknown() && w.lstatSync();
2596
+ }
2597
+ w.shouldWalk(a, o) && l.push(w);
2598
+ }
2599
+ }
2600
+ d && !h.flowing && h.once("drain", c);
2601
+ };
2602
+ return c(), h;
2603
+ }
2604
+ chdir(t = this.cwd) {
2605
+ let e = this.cwd;
2606
+ this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye](e);
2607
+ }
2608
+ };
2609
+ var it = class extends It {
2610
+ sep = "\\";
2611
+ constructor(t = process.cwd(), e = {}) {
2612
+ let { nocase: s = !0 } = e;
2613
+ super(t, win32, "\\", {
2614
+ ...e,
2615
+ nocase: s
2616
+ }), this.nocase = s;
2617
+ for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase;
2618
+ }
2619
+ parseRootPath(t) {
2620
+ return win32.parse(t).root.toUpperCase();
2621
+ }
2622
+ newRoot(t) {
2623
+ return new Pt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
2624
+ }
2625
+ isAbsolute(t) {
2626
+ return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
2627
+ }
2628
+ };
2629
+ var rt = class extends It {
2630
+ sep = "/";
2631
+ constructor(t = process.cwd(), e = {}) {
2632
+ let { nocase: s = !1 } = e;
2633
+ super(t, posix, "/", {
2634
+ ...e,
2635
+ nocase: s
2636
+ }), this.nocase = s;
2637
+ }
2638
+ parseRootPath(t) {
2639
+ return "/";
2640
+ }
2641
+ newRoot(t) {
2642
+ return new jt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
2643
+ }
2644
+ isAbsolute(t) {
2645
+ return t.startsWith("/");
2646
+ }
2647
+ };
2648
+ var St = class extends rt {
2649
+ constructor(t = process.cwd(), e = {}) {
2650
+ let { nocase: s = !0 } = e;
2651
+ super(t, {
2652
+ ...e,
2653
+ nocase: s
2654
+ });
2655
+ }
2656
+ };
2657
+ process.platform;
2658
+ var Xe = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
2659
+ var Di = (n) => n.length >= 1;
2660
+ var Mi = (n) => n.length >= 1;
2661
+ var Ni = Symbol.for("nodejs.util.inspect.custom");
2662
+ var nt = class n {
2663
+ #t;
2664
+ #s;
2665
+ #n;
2666
+ length;
2667
+ #r;
2668
+ #o;
2669
+ #S;
2670
+ #w;
2671
+ #c;
2672
+ #h;
2673
+ #u = !0;
2674
+ constructor(t, e, s, i) {
2675
+ if (!Di(t)) throw new TypeError("empty pattern list");
2676
+ if (!Mi(e)) throw new TypeError("empty glob list");
2677
+ if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths");
2678
+ if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range");
2679
+ if (this.#t = t, this.#s = e, this.#n = s, this.#r = i, this.#n === 0) {
2680
+ if (this.isUNC()) {
2681
+ let [r, o, h, a, ...l] = this.#t, [u, c, d, f, ...m] = this.#s;
2682
+ l[0] === "" && (l.shift(), m.shift());
2683
+ let p = [
2684
+ r,
2685
+ o,
2686
+ h,
2687
+ a,
2688
+ ""
2689
+ ].join("/"), w = [
2690
+ u,
2691
+ c,
2692
+ d,
2693
+ f,
2694
+ ""
2695
+ ].join("/");
2696
+ this.#t = [p, ...l], this.#s = [w, ...m], this.length = this.#t.length;
2697
+ } else if (this.isDrive() || this.isAbsolute()) {
2698
+ let [r, ...o] = this.#t, [h, ...a] = this.#s;
2699
+ o[0] === "" && (o.shift(), a.shift());
2700
+ let l = r + "/", u = h + "/";
2701
+ this.#t = [l, ...o], this.#s = [u, ...a], this.length = this.#t.length;
2702
+ }
2703
+ }
2704
+ }
2705
+ [Ni]() {
2706
+ return "Pattern <" + this.#s.slice(this.#n).join("/") + ">";
2707
+ }
2708
+ pattern() {
2709
+ return this.#t[this.#n];
2710
+ }
2711
+ isString() {
2712
+ return typeof this.#t[this.#n] == "string";
2713
+ }
2714
+ isGlobstar() {
2715
+ return this.#t[this.#n] === A;
2716
+ }
2717
+ isRegExp() {
2718
+ return this.#t[this.#n] instanceof RegExp;
2719
+ }
2720
+ globString() {
2721
+ return this.#S = this.#S || (this.#n === 0 ? this.isAbsolute() ? this.#s[0] + this.#s.slice(1).join("/") : this.#s.join("/") : this.#s.slice(this.#n).join("/"));
2722
+ }
2723
+ hasMore() {
2724
+ return this.length > this.#n + 1;
2725
+ }
2726
+ rest() {
2727
+ return this.#o !== void 0 ? this.#o : this.hasMore() ? (this.#o = new n(this.#t, this.#s, this.#n + 1, this.#r), this.#o.#h = this.#h, this.#o.#c = this.#c, this.#o.#w = this.#w, this.#o) : this.#o = null;
2728
+ }
2729
+ isUNC() {
2730
+ let t = this.#t;
2731
+ return this.#c !== void 0 ? this.#c : this.#c = this.#r === "win32" && this.#n === 0 && t[0] === "" && t[1] === "" && typeof t[2] == "string" && !!t[2] && typeof t[3] == "string" && !!t[3];
2732
+ }
2733
+ isDrive() {
2734
+ let t = this.#t;
2735
+ return this.#w !== void 0 ? this.#w : this.#w = this.#r === "win32" && this.#n === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]);
2736
+ }
2737
+ isAbsolute() {
2738
+ let t = this.#t;
2739
+ return this.#h !== void 0 ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
2740
+ }
2741
+ root() {
2742
+ let t = this.#t[0];
2743
+ return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
2744
+ }
2745
+ checkFollowGlobstar() {
2746
+ return !(this.#n === 0 || !this.isGlobstar() || !this.#u);
2747
+ }
2748
+ markFollowGlobstar() {
2749
+ return this.#n === 0 || !this.isGlobstar() || !this.#u ? !1 : (this.#u = !1, !0);
2750
+ }
2751
+ };
2752
+ var _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
2753
+ var ot = class {
2754
+ relative;
2755
+ relativeChildren;
2756
+ absolute;
2757
+ absoluteChildren;
2758
+ platform;
2759
+ mmopts;
2760
+ constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: o = _i }) {
2761
+ this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = o, this.mmopts = {
2762
+ dot: !0,
2763
+ nobrace: e,
2764
+ nocase: s,
2765
+ noext: i,
2766
+ noglobstar: r,
2767
+ optimizationLevel: 2,
2768
+ platform: o,
2769
+ nocomment: !0,
2770
+ nonegate: !0
2771
+ };
2772
+ for (let h of t) this.add(h);
2773
+ }
2774
+ add(t) {
2775
+ let e = new D(t, this.mmopts);
2776
+ for (let s = 0; s < e.set.length; s++) {
2777
+ let i = e.set[s], r = e.globParts[s];
2778
+ if (!i || !r) throw new Error("invalid pattern object");
2779
+ for (; i[0] === "." && r[0] === ".";) i.shift(), r.shift();
2780
+ let o = new nt(i, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
2781
+ l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
2782
+ }
2783
+ }
2784
+ ignored(t) {
2785
+ let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
2786
+ for (let o of this.relative) if (o.match(i) || o.match(r)) return !0;
2787
+ for (let o of this.absolute) if (o.match(e) || o.match(s)) return !0;
2788
+ return !1;
2789
+ }
2790
+ childrenIgnored(t) {
2791
+ let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
2792
+ for (let i of this.relativeChildren) if (i.match(s)) return !0;
2793
+ for (let i of this.absoluteChildren) if (i.match(e)) return !0;
2794
+ return !1;
2795
+ }
2796
+ };
2797
+ var oe = class n {
2798
+ store;
2799
+ constructor(t = new Map()) {
2800
+ this.store = t;
2801
+ }
2802
+ copy() {
2803
+ return new n(new Map(this.store));
2804
+ }
2805
+ hasWalked(t, e) {
2806
+ return this.store.get(t.fullpath())?.has(e.globString());
2807
+ }
2808
+ storeWalked(t, e) {
2809
+ let s = t.fullpath(), i = this.store.get(s);
2810
+ i ? i.add(e.globString()) : this.store.set(s, new Set([e.globString()]));
2811
+ }
2812
+ };
2813
+ var he = class {
2814
+ store = new Map();
2815
+ add(t, e, s) {
2816
+ let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
2817
+ this.store.set(t, r === void 0 ? i : i & r);
2818
+ }
2819
+ entries() {
2820
+ return [...this.store.entries()].map(([t, e]) => [
2821
+ t,
2822
+ !!(e & 2),
2823
+ !!(e & 1)
2824
+ ]);
2825
+ }
2826
+ };
2827
+ var ae = class {
2828
+ store = new Map();
2829
+ add(t, e) {
2830
+ if (!t.canReaddir()) return;
2831
+ let s = this.store.get(t);
2832
+ s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
2833
+ }
2834
+ get(t) {
2835
+ let e = this.store.get(t);
2836
+ if (!e) throw new Error("attempting to walk unknown path");
2837
+ return e;
2838
+ }
2839
+ entries() {
2840
+ return this.keys().map((t) => [t, this.store.get(t)]);
2841
+ }
2842
+ keys() {
2843
+ return [...this.store.keys()].filter((t) => t.canReaddir());
2844
+ }
2845
+ };
2846
+ var Et = class n {
2847
+ hasWalkedCache;
2848
+ matches = new he();
2849
+ subwalks = new ae();
2850
+ patterns;
2851
+ follow;
2852
+ dot;
2853
+ opts;
2854
+ constructor(t, e) {
2855
+ this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe();
2856
+ }
2857
+ processPatterns(t, e) {
2858
+ this.patterns = e;
2859
+ let s = e.map((i) => [t, i]);
2860
+ for (let [i, r] of s) {
2861
+ this.hasWalkedCache.storeWalked(i, r);
2862
+ let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== !1;
2863
+ if (o) {
2864
+ i = i.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
2865
+ let c = r.rest();
2866
+ if (c) r = c;
2867
+ else {
2868
+ this.matches.add(i, !0, !1);
2869
+ continue;
2870
+ }
2871
+ }
2872
+ if (i.isENOENT()) continue;
2873
+ let a, l, u = !1;
2874
+ for (; typeof (a = r.pattern()) == "string" && (l = r.rest());) i = i.resolve(a), r = l, u = !0;
2875
+ if (a = r.pattern(), l = r.rest(), u) {
2876
+ if (this.hasWalkedCache.hasWalked(i, r)) continue;
2877
+ this.hasWalkedCache.storeWalked(i, r);
2878
+ }
2879
+ if (typeof a == "string") {
2880
+ let c = a === ".." || a === "" || a === ".";
2881
+ this.matches.add(i.resolve(a), h, c);
2882
+ continue;
2883
+ } else if (a === A) {
2884
+ (!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
2885
+ let c = l?.pattern(), d = l?.rest();
2886
+ if (!l || (c === "" || c === ".") && !d) this.matches.add(i, h, c === "" || c === ".");
2887
+ else if (c === "..") {
2888
+ let f = i.parent || i;
2889
+ d ? this.hasWalkedCache.hasWalked(f, d) || this.subwalks.add(f, d) : this.matches.add(f, h, !0);
2890
+ }
2891
+ } else a instanceof RegExp && this.subwalks.add(i, r);
2892
+ }
2893
+ return this;
2894
+ }
2895
+ subwalkTargets() {
2896
+ return this.subwalks.keys();
2897
+ }
2898
+ child() {
2899
+ return new n(this.opts, this.hasWalkedCache);
2900
+ }
2901
+ filterEntries(t, e) {
2902
+ let s = this.subwalks.get(t), i = this.child();
2903
+ for (let r of e) for (let o of s) {
2904
+ let h = o.isAbsolute(), a = o.pattern(), l = o.rest();
2905
+ a === A ? i.testGlobstar(r, o, l, h) : a instanceof RegExp ? i.testRegExp(r, a, l, h) : i.testString(r, a, l, h);
2906
+ }
2907
+ return i;
2908
+ }
2909
+ testGlobstar(t, e, s, i) {
2910
+ if ((this.dot || !t.name.startsWith(".")) && (e.hasMore() || this.matches.add(t, i, !1), t.canReaddir() && (this.follow || !t.isSymbolicLink() ? this.subwalks.add(t, e) : t.isSymbolicLink() && (s && e.checkFollowGlobstar() ? this.subwalks.add(t, s) : e.markFollowGlobstar() && this.subwalks.add(t, e)))), s) {
2911
+ let r = s.pattern();
2912
+ if (typeof r == "string" && r !== ".." && r !== "" && r !== ".") this.testString(t, r, s.rest(), i);
2913
+ else if (r === "..") {
2914
+ let o = t.parent || t;
2915
+ this.subwalks.add(o, s);
2916
+ } else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
2917
+ }
2918
+ }
2919
+ testRegExp(t, e, s, i) {
2920
+ e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
2921
+ }
2922
+ testString(t, e, s, i) {
2923
+ t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
2924
+ }
2925
+ };
2926
+ var Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? new ot(n, t) : n;
2927
+ var zt = class {
2928
+ path;
2929
+ patterns;
2930
+ opts;
2931
+ seen = new Set();
2932
+ paused = !1;
2933
+ aborted = !1;
2934
+ #t = [];
2935
+ #s;
2936
+ #n;
2937
+ signal;
2938
+ maxDepth;
2939
+ includeChildMatches;
2940
+ constructor(t, e, s) {
2941
+ if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== !1, (s.ignore || !this.includeChildMatches) && (this.#s = Li(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#s.add != "function")) throw new Error("cannot ignore child matches, ignore lacks add() method.");
2942
+ this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
2943
+ this.#t.length = 0;
2944
+ }));
2945
+ }
2946
+ #r(t) {
2947
+ return this.seen.has(t) || !!this.#s?.ignored?.(t);
2948
+ }
2949
+ #o(t) {
2950
+ return !!this.#s?.childrenIgnored?.(t);
2951
+ }
2952
+ pause() {
2953
+ this.paused = !0;
2954
+ }
2955
+ resume() {
2956
+ if (this.signal?.aborted) return;
2957
+ this.paused = !1;
2958
+ let t;
2959
+ for (; !this.paused && (t = this.#t.shift());) t();
2960
+ }
2961
+ onResume(t) {
2962
+ this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
2963
+ }
2964
+ async matchCheck(t, e) {
2965
+ if (e && this.opts.nodir) return;
2966
+ let s;
2967
+ if (this.opts.realpath) {
2968
+ if (s = t.realpathCached() || await t.realpath(), !s) return;
2969
+ t = s;
2970
+ }
2971
+ let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
2972
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
2973
+ let o = await r.realpath();
2974
+ o && (o.isUnknown() || this.opts.stat) && await o.lstat();
2975
+ }
2976
+ return this.matchCheckTest(r, e);
2977
+ }
2978
+ matchCheckTest(t, e) {
2979
+ return t && (this.maxDepth === 1 / 0 || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#r(t) ? t : void 0;
2980
+ }
2981
+ matchCheckSync(t, e) {
2982
+ if (e && this.opts.nodir) return;
2983
+ let s;
2984
+ if (this.opts.realpath) {
2985
+ if (s = t.realpathCached() || t.realpathSync(), !s) return;
2986
+ t = s;
2987
+ }
2988
+ let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
2989
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
2990
+ let o = r.realpathSync();
2991
+ o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
2992
+ }
2993
+ return this.matchCheckTest(r, e);
2994
+ }
2995
+ matchFinish(t, e) {
2996
+ if (this.#r(t)) return;
2997
+ if (!this.includeChildMatches && this.#s?.add) {
2998
+ let r = `${t.relativePosix()}/**`;
2999
+ this.#s.add(r);
3000
+ }
3001
+ let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
3002
+ this.seen.add(t);
3003
+ let i = this.opts.mark && t.isDirectory() ? this.#n : "";
3004
+ if (this.opts.withFileTypes) this.matchEmit(t);
3005
+ else if (s) {
3006
+ let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
3007
+ this.matchEmit(r + i);
3008
+ } else {
3009
+ let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
3010
+ this.matchEmit(r ? o + r + i : "." + i);
3011
+ }
3012
+ }
3013
+ async match(t, e, s) {
3014
+ let i = await this.matchCheck(t, s);
3015
+ i && this.matchFinish(i, e);
3016
+ }
3017
+ matchSync(t, e, s) {
3018
+ let i = this.matchCheckSync(t, s);
3019
+ i && this.matchFinish(i, e);
3020
+ }
3021
+ walkCB(t, e, s) {
3022
+ this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
3023
+ }
3024
+ walkCB2(t, e, s, i) {
3025
+ if (this.#o(t)) return i();
3026
+ if (this.signal?.aborted && i(), this.paused) {
3027
+ this.onResume(() => this.walkCB2(t, e, s, i));
3028
+ return;
3029
+ }
3030
+ s.processPatterns(t, e);
3031
+ let r = 1, o = () => {
3032
+ --r === 0 && i();
3033
+ };
3034
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
3035
+ for (let h of s.subwalkTargets()) {
3036
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
3037
+ r++;
3038
+ let a = h.readdirCached();
3039
+ h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, u) => this.walkCB3(h, u, s, o), !0);
3040
+ }
3041
+ o();
3042
+ }
3043
+ walkCB3(t, e, s, i) {
3044
+ s = s.filterEntries(t, e);
3045
+ let r = 1, o = () => {
3046
+ --r === 0 && i();
3047
+ };
3048
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
3049
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2(h, a, s.child(), o);
3050
+ o();
3051
+ }
3052
+ walkCBSync(t, e, s) {
3053
+ this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
3054
+ }
3055
+ walkCB2Sync(t, e, s, i) {
3056
+ if (this.#o(t)) return i();
3057
+ if (this.signal?.aborted && i(), this.paused) {
3058
+ this.onResume(() => this.walkCB2Sync(t, e, s, i));
3059
+ return;
3060
+ }
3061
+ s.processPatterns(t, e);
3062
+ let r = 1, o = () => {
3063
+ --r === 0 && i();
3064
+ };
3065
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
3066
+ for (let h of s.subwalkTargets()) {
3067
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
3068
+ r++;
3069
+ let a = h.readdirSync();
3070
+ this.walkCB3Sync(h, a, s, o);
3071
+ }
3072
+ o();
3073
+ }
3074
+ walkCB3Sync(t, e, s, i) {
3075
+ s = s.filterEntries(t, e);
3076
+ let r = 1, o = () => {
3077
+ --r === 0 && i();
3078
+ };
3079
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
3080
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
3081
+ o();
3082
+ }
3083
+ };
3084
+ var xt = class extends zt {
3085
+ matches = new Set();
3086
+ constructor(t, e, s) {
3087
+ super(t, e, s);
3088
+ }
3089
+ matchEmit(t) {
3090
+ this.matches.add(t);
3091
+ }
3092
+ async walk() {
3093
+ if (this.signal?.aborted) throw this.signal.reason;
3094
+ return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
3095
+ this.walkCB(this.path, this.patterns, () => {
3096
+ this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
3097
+ });
3098
+ }), this.matches;
3099
+ }
3100
+ walkSync() {
3101
+ if (this.signal?.aborted) throw this.signal.reason;
3102
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
3103
+ if (this.signal?.aborted) throw this.signal.reason;
3104
+ }), this.matches;
3105
+ }
3106
+ };
3107
+ var vt = class extends zt {
3108
+ results;
3109
+ constructor(t, e, s) {
3110
+ super(t, e, s), this.results = new V({
3111
+ signal: this.signal,
3112
+ objectMode: !0
3113
+ }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
3114
+ }
3115
+ matchEmit(t) {
3116
+ this.results.write(t), this.results.flowing || this.pause();
3117
+ }
3118
+ stream() {
3119
+ let t = this.path;
3120
+ return t.isUnknown() ? t.lstat().then(() => {
3121
+ this.walkCB(t, this.patterns, () => this.results.end());
3122
+ }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
3123
+ }
3124
+ streamSync() {
3125
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
3126
+ }
3127
+ };
3128
+ var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
3129
+ var I = class {
3130
+ absolute;
3131
+ cwd;
3132
+ root;
3133
+ dot;
3134
+ dotRelative;
3135
+ follow;
3136
+ ignore;
3137
+ magicalBraces;
3138
+ mark;
3139
+ matchBase;
3140
+ maxDepth;
3141
+ nobrace;
3142
+ nocase;
3143
+ nodir;
3144
+ noext;
3145
+ noglobstar;
3146
+ pattern;
3147
+ platform;
3148
+ realpath;
3149
+ scurry;
3150
+ stat;
3151
+ signal;
3152
+ windowsPathsNoEscape;
3153
+ withFileTypes;
3154
+ includeChildMatches;
3155
+ opts;
3156
+ patterns;
3157
+ constructor(t, e) {
3158
+ if (!e) throw new TypeError("glob options required");
3159
+ if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = fileURLToPath(e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace, this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== !1, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : 1 / 0, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true");
3160
+ if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
3161
+ if (e.noglobstar) throw new TypeError("base matching requires globstar");
3162
+ t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
3163
+ }
3164
+ if (this.pattern = t, this.platform = e.platform || Pi, this.opts = {
3165
+ ...e,
3166
+ platform: this.platform
3167
+ }, e.scurry) {
3168
+ if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
3169
+ } else {
3170
+ let a = e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe;
3171
+ this.scurry = new a(this.cwd, {
3172
+ nocase: e.nocase,
3173
+ fs: e.fs
3174
+ });
3175
+ }
3176
+ this.nocase = this.scurry.nocase;
3177
+ let s = this.platform === "darwin" || this.platform === "win32", i = {
3178
+ braceExpandMax: 1e4,
3179
+ ...e,
3180
+ dot: this.dot,
3181
+ matchBase: this.matchBase,
3182
+ nobrace: this.nobrace,
3183
+ nocase: this.nocase,
3184
+ nocaseMagicOnly: s,
3185
+ nocomment: !0,
3186
+ noext: this.noext,
3187
+ nonegate: !0,
3188
+ optimizationLevel: 2,
3189
+ platform: this.platform,
3190
+ windowsPathsNoEscape: this.windowsPathsNoEscape,
3191
+ debug: !!this.opts.debug
3192
+ }, [o, h] = this.pattern.map((a) => new D(a, i)).reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
3193
+ this.patterns = o.map((a, l) => {
3194
+ let u = h[l];
3195
+ if (!u) throw new Error("invalid pattern object");
3196
+ return new nt(a, u, 0, this.platform);
3197
+ });
3198
+ }
3199
+ async walk() {
3200
+ return [...await new xt(this.patterns, this.scurry.cwd, {
3201
+ ...this.opts,
3202
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
3203
+ platform: this.platform,
3204
+ nocase: this.nocase,
3205
+ includeChildMatches: this.includeChildMatches
3206
+ }).walk()];
3207
+ }
3208
+ walkSync() {
3209
+ return [...new xt(this.patterns, this.scurry.cwd, {
3210
+ ...this.opts,
3211
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
3212
+ platform: this.platform,
3213
+ nocase: this.nocase,
3214
+ includeChildMatches: this.includeChildMatches
3215
+ }).walkSync()];
3216
+ }
3217
+ stream() {
3218
+ return new vt(this.patterns, this.scurry.cwd, {
3219
+ ...this.opts,
3220
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
3221
+ platform: this.platform,
3222
+ nocase: this.nocase,
3223
+ includeChildMatches: this.includeChildMatches
3224
+ }).stream();
3225
+ }
3226
+ streamSync() {
3227
+ return new vt(this.patterns, this.scurry.cwd, {
3228
+ ...this.opts,
3229
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
3230
+ platform: this.platform,
3231
+ nocase: this.nocase,
3232
+ includeChildMatches: this.includeChildMatches
3233
+ }).streamSync();
3234
+ }
3235
+ iterateSync() {
3236
+ return this.streamSync()[Symbol.iterator]();
3237
+ }
3238
+ [Symbol.iterator]() {
3239
+ return this.iterateSync();
3240
+ }
3241
+ iterate() {
3242
+ return this.stream()[Symbol.asyncIterator]();
3243
+ }
3244
+ [Symbol.asyncIterator]() {
3245
+ return this.iterate();
3246
+ }
3247
+ };
3248
+ var le = (n, t = {}) => {
3249
+ Array.isArray(n) || (n = [n]);
3250
+ for (let e of n) if (new D(e, t).hasMagic()) return !0;
3251
+ return !1;
3252
+ };
3253
+ function Bt(n, t = {}) {
3254
+ return new I(n, t).streamSync();
3255
+ }
3256
+ function Qe(n, t = {}) {
3257
+ return new I(n, t).stream();
3258
+ }
3259
+ function ts(n, t = {}) {
3260
+ return new I(n, t).walkSync();
3261
+ }
3262
+ async function Je(n, t = {}) {
3263
+ return new I(n, t).walk();
3264
+ }
3265
+ function Ut(n, t = {}) {
3266
+ return new I(n, t).iterateSync();
3267
+ }
3268
+ function es(n, t = {}) {
3269
+ return new I(n, t).iterate();
3270
+ }
3271
+ var ji = Bt;
3272
+ var Ii = Object.assign(Qe, { sync: Bt });
3273
+ var zi = Ut;
3274
+ var Bi = Object.assign(es, { sync: Ut });
3275
+ var Ui = Object.assign(ts, {
3276
+ stream: Bt,
3277
+ iterate: Ut
3278
+ });
3279
+ var Ze = Object.assign(Je, {
3280
+ glob: Je,
3281
+ globSync: ts,
3282
+ sync: Ui,
3283
+ globStream: Qe,
3284
+ stream: Ii,
3285
+ globStreamSync: Bt,
3286
+ streamSync: ji,
3287
+ globIterate: es,
3288
+ iterate: Bi,
3289
+ globIterateSync: Ut,
3290
+ iterateSync: zi,
3291
+ Glob: I,
3292
+ hasMagic: le,
3293
+ escape: tt,
3294
+ unescape: W
3295
+ });
3296
+ Ze.glob = Ze;
3297
+ //#endregion
3298
+ export { Ze as glob };
3299
+
3300
+ //# sourceMappingURL=index.min-CI3qqohw.mjs.map