tinker-token-usage 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1672 @@
1
+ var pe = Object.defineProperty;
2
+ var he = (t, s, e) => s in t ? pe(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
+ var B = (t, s, e) => he(t, typeof s != "symbol" ? s + "" : s, e);
4
+ import * as ge from "fs";
5
+ import { statSync as ye, stat as de, realpathSync as Ae, realpath as Re, readdirSync as _e, readdir as Se } from "fs";
6
+ import { sep as Ft, basename as Ee, dirname as St, resolve as Mt, normalize as be, relative as me, posix as tt, isAbsolute as xe } from "path";
7
+ import { fileURLToPath as Ce } from "url";
8
+ import { createRequire as $e } from "module";
9
+ var wt = /* @__PURE__ */ $e(import.meta.url);
10
+ function ve(t) {
11
+ let s = be(t);
12
+ return s.length > 1 && s[s.length - 1] === Ft && (s = s.substring(0, s.length - 1)), s;
13
+ }
14
+ const we = /[\\/]/g;
15
+ function Gt(t, s) {
16
+ return t.replace(we, s);
17
+ }
18
+ const Oe = /^[a-z]:[\\/]$/i;
19
+ function He(t) {
20
+ return t === "/" || Oe.test(t);
21
+ }
22
+ function ht(t, s) {
23
+ const { resolvePaths: e, normalizePath: r, pathSeparator: o } = s, n = process.platform === "win32" && t.includes("/") || t.startsWith(".");
24
+ if (e && (t = Mt(t)), (r || n) && (t = ve(t)), t === ".") return "";
25
+ const i = t[t.length - 1] !== o;
26
+ return Gt(i ? t + o : t, o);
27
+ }
28
+ function Wt(t, s) {
29
+ return s + t;
30
+ }
31
+ function Le(t, s) {
32
+ return function(e, r) {
33
+ return r.startsWith(t) ? r.slice(t.length) + e : Gt(me(t, r), s.pathSeparator) + s.pathSeparator + e;
34
+ };
35
+ }
36
+ function Te(t) {
37
+ return t;
38
+ }
39
+ function ke(t, s, e) {
40
+ return s + t + e;
41
+ }
42
+ function Pe(t, s) {
43
+ const { relativePaths: e, includeBasePath: r } = s;
44
+ return e && t ? Le(t, s) : r ? Wt : Te;
45
+ }
46
+ function De(t) {
47
+ return function(s, e) {
48
+ e.push(s.substring(t.length) || ".");
49
+ };
50
+ }
51
+ function Ie(t) {
52
+ return function(s, e, r) {
53
+ const o = s.substring(t.length) || ".";
54
+ r.every((n) => n(o, !0)) && e.push(o);
55
+ };
56
+ }
57
+ const Ne = (t, s) => {
58
+ s.push(t || ".");
59
+ }, Be = (t, s, e) => {
60
+ const r = t || ".";
61
+ e.every((o) => o(r, !0)) && s.push(r);
62
+ }, Fe = () => {
63
+ };
64
+ function Me(t, s) {
65
+ const { includeDirs: e, filters: r, relativePaths: o } = s;
66
+ return e ? o ? r && r.length ? Ie(t) : De(t) : r && r.length ? Be : Ne : Fe;
67
+ }
68
+ const Ge = (t, s, e, r) => {
69
+ r.every((o) => o(t, !1)) && e.files++;
70
+ }, We = (t, s, e, r) => {
71
+ r.every((o) => o(t, !1)) && s.push(t);
72
+ }, Ue = (t, s, e, r) => {
73
+ e.files++;
74
+ }, qe = (t, s) => {
75
+ s.push(t);
76
+ }, Ke = () => {
77
+ };
78
+ function Xe(t) {
79
+ const { excludeFiles: s, filters: e, onlyCounts: r } = t;
80
+ return s ? Ke : e && e.length ? r ? Ge : We : r ? Ue : qe;
81
+ }
82
+ const je = (t) => t, Qe = () => [""].slice(0, 0);
83
+ function ze(t) {
84
+ return t.group ? Qe : je;
85
+ }
86
+ const Ye = (t, s, e) => {
87
+ t.push({
88
+ directory: s,
89
+ files: e,
90
+ dir: s
91
+ });
92
+ }, Ze = () => {
93
+ };
94
+ function Ve(t) {
95
+ return t.group ? Ye : Ze;
96
+ }
97
+ const Je = function(t, s, e) {
98
+ const { queue: r, fs: o, options: { suppressErrors: n } } = s;
99
+ r.enqueue(), o.realpath(t, (i, l) => {
100
+ if (i) return r.dequeue(n ? null : i, s);
101
+ o.stat(l, (h, g) => {
102
+ if (h) return r.dequeue(n ? null : h, s);
103
+ if (g.isDirectory() && Ut(t, l, s)) return r.dequeue(null, s);
104
+ e(g, l), r.dequeue(null, s);
105
+ });
106
+ });
107
+ }, ts = function(t, s, e) {
108
+ const { queue: r, fs: o, options: { suppressErrors: n } } = s;
109
+ r.enqueue();
110
+ try {
111
+ const i = o.realpathSync(t), l = o.statSync(i);
112
+ if (l.isDirectory() && Ut(t, i, s)) return;
113
+ e(l, i);
114
+ } catch (i) {
115
+ if (!n) throw i;
116
+ }
117
+ };
118
+ function es(t, s) {
119
+ return !t.resolveSymlinks || t.excludeSymlinks ? null : s ? ts : Je;
120
+ }
121
+ function Ut(t, s, e) {
122
+ if (e.options.useRealPaths) return ss(s, e);
123
+ let r = St(t), o = 1;
124
+ for (; r !== e.root && o < 2; ) {
125
+ const n = e.symlinks.get(r);
126
+ !!n && (n === s || n.startsWith(s) || s.startsWith(n)) ? o++ : r = St(r);
127
+ }
128
+ return e.symlinks.set(t, s), o > 1;
129
+ }
130
+ function ss(t, s) {
131
+ return s.visited.includes(t + s.options.pathSeparator);
132
+ }
133
+ const ns = (t) => t.counts, rs = (t) => t.groups, os = (t) => t.paths, is = (t) => t.paths.slice(0, t.options.maxFiles), us = (t, s, e) => (lt(s, e, t.counts, t.options.suppressErrors), null), as = (t, s, e) => (lt(s, e, t.paths, t.options.suppressErrors), null), cs = (t, s, e) => (lt(s, e, t.paths.slice(0, t.options.maxFiles), t.options.suppressErrors), null), ls = (t, s, e) => (lt(s, e, t.groups, t.options.suppressErrors), null);
134
+ function lt(t, s, e, r) {
135
+ s(t && !r ? t : null, e);
136
+ }
137
+ function fs(t, s) {
138
+ const { onlyCounts: e, group: r, maxFiles: o } = t;
139
+ return e ? s ? ns : us : r ? s ? rs : ls : o ? s ? is : cs : s ? os : as;
140
+ }
141
+ const qt = { withFileTypes: !0 }, ps = (t, s, e, r, o) => {
142
+ if (t.queue.enqueue(), r < 0) return t.queue.dequeue(null, t);
143
+ const { fs: n } = t;
144
+ t.visited.push(s), t.counts.directories++, n.readdir(s || ".", qt, (i, l = []) => {
145
+ o(l, e, r), t.queue.dequeue(t.options.suppressErrors ? null : i, t);
146
+ });
147
+ }, hs = (t, s, e, r, o) => {
148
+ const { fs: n } = t;
149
+ if (r < 0) return;
150
+ t.visited.push(s), t.counts.directories++;
151
+ let i = [];
152
+ try {
153
+ i = n.readdirSync(s || ".", qt);
154
+ } catch (l) {
155
+ if (!t.options.suppressErrors) throw l;
156
+ }
157
+ o(i, e, r);
158
+ };
159
+ function gs(t) {
160
+ return t ? hs : ps;
161
+ }
162
+ var ys = class {
163
+ constructor(t) {
164
+ B(this, "count", 0);
165
+ this.onQueueEmpty = t;
166
+ }
167
+ enqueue() {
168
+ return this.count++, this.count;
169
+ }
170
+ dequeue(t, s) {
171
+ this.onQueueEmpty && (--this.count <= 0 || t) && (this.onQueueEmpty(t, s), t && (s.controller.abort(), this.onQueueEmpty = void 0));
172
+ }
173
+ }, ds = class {
174
+ constructor() {
175
+ B(this, "_files", 0);
176
+ B(this, "_directories", 0);
177
+ }
178
+ set files(t) {
179
+ this._files = t;
180
+ }
181
+ get files() {
182
+ return this._files;
183
+ }
184
+ set directories(t) {
185
+ this._directories = t;
186
+ }
187
+ get directories() {
188
+ return this._directories;
189
+ }
190
+ /**
191
+ * @deprecated use `directories` instead
192
+ */
193
+ /* c8 ignore next 3 */
194
+ get dirs() {
195
+ return this._directories;
196
+ }
197
+ }, As = class {
198
+ constructor() {
199
+ B(this, "aborted", !1);
200
+ }
201
+ abort() {
202
+ this.aborted = !0;
203
+ }
204
+ }, Kt = class {
205
+ constructor(t, s, e) {
206
+ B(this, "root");
207
+ B(this, "isSynchronous");
208
+ B(this, "state");
209
+ B(this, "joinPath");
210
+ B(this, "pushDirectory");
211
+ B(this, "pushFile");
212
+ B(this, "getArray");
213
+ B(this, "groupFiles");
214
+ B(this, "resolveSymlink");
215
+ B(this, "walkDirectory");
216
+ B(this, "callbackInvoker");
217
+ B(this, "walk", (t, s, e) => {
218
+ const { paths: r, options: { filters: o, resolveSymlinks: n, excludeSymlinks: i, exclude: l, maxFiles: h, signal: g, useRealPaths: d, pathSeparator: A }, controller: S } = this.state;
219
+ if (S.aborted || g && g.aborted || h && r.length > h) return;
220
+ const x = this.getArray(this.state.paths);
221
+ for (let y = 0; y < t.length; ++y) {
222
+ const C = t[y];
223
+ if (C.isFile() || C.isSymbolicLink() && !n && !i) {
224
+ const T = this.joinPath(C.name, s);
225
+ this.pushFile(T, x, this.state.counts, o);
226
+ } else if (C.isDirectory()) {
227
+ let T = ke(C.name, s, this.state.options.pathSeparator);
228
+ if (l && l(C.name, T)) continue;
229
+ this.pushDirectory(T, r, o), this.walkDirectory(this.state, T, T, e - 1, this.walk);
230
+ } else if (this.resolveSymlink && C.isSymbolicLink()) {
231
+ let T = Wt(C.name, s);
232
+ this.resolveSymlink(T, this.state, (G, _) => {
233
+ if (G.isDirectory()) {
234
+ if (_ = ht(_, this.state.options), l && l(C.name, d ? _ : T + A)) return;
235
+ this.walkDirectory(this.state, _, d ? _ : T + A, e - 1, this.walk);
236
+ } else {
237
+ _ = d ? _ : T;
238
+ const M = Ee(_), X = ht(St(_), this.state.options);
239
+ _ = this.joinPath(M, X), this.pushFile(_, x, this.state.counts, o);
240
+ }
241
+ });
242
+ }
243
+ }
244
+ this.groupFiles(this.state.groups, s, x);
245
+ });
246
+ this.isSynchronous = !e, this.callbackInvoker = fs(s, this.isSynchronous), this.root = ht(t, s), this.state = {
247
+ root: He(this.root) ? this.root : this.root.slice(0, -1),
248
+ paths: [""].slice(0, 0),
249
+ groups: [],
250
+ counts: new ds(),
251
+ options: s,
252
+ queue: new ys((r, o) => this.callbackInvoker(o, r, e)),
253
+ symlinks: /* @__PURE__ */ new Map(),
254
+ visited: [""].slice(0, 0),
255
+ controller: new As(),
256
+ fs: s.fs || ge
257
+ }, this.joinPath = Pe(this.root, s), this.pushDirectory = Me(this.root, s), this.pushFile = Xe(s), this.getArray = ze(s), this.groupFiles = Ve(s), this.resolveSymlink = es(s, this.isSynchronous), this.walkDirectory = gs(this.isSynchronous);
258
+ }
259
+ start() {
260
+ return this.pushDirectory(this.root, this.state.paths, this.state.options.filters), this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk), this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
261
+ }
262
+ };
263
+ function Rs(t, s) {
264
+ return new Promise((e, r) => {
265
+ Xt(t, s, (o, n) => {
266
+ if (o) return r(o);
267
+ e(n);
268
+ });
269
+ });
270
+ }
271
+ function Xt(t, s, e) {
272
+ new Kt(t, s, e).start();
273
+ }
274
+ function _s(t, s) {
275
+ return new Kt(t, s).start();
276
+ }
277
+ var Ot = class {
278
+ constructor(t, s) {
279
+ this.root = t, this.options = s;
280
+ }
281
+ withPromise() {
282
+ return Rs(this.root, this.options);
283
+ }
284
+ withCallback(t) {
285
+ Xt(this.root, this.options, t);
286
+ }
287
+ sync() {
288
+ return _s(this.root, this.options);
289
+ }
290
+ };
291
+ let jt = null;
292
+ try {
293
+ wt.resolve("picomatch"), jt = wt("picomatch");
294
+ } catch {
295
+ }
296
+ var Ss = class {
297
+ constructor(t) {
298
+ B(this, "globCache", {});
299
+ B(this, "options", {
300
+ maxDepth: 1 / 0,
301
+ suppressErrors: !0,
302
+ pathSeparator: Ft,
303
+ filters: []
304
+ });
305
+ B(this, "globFunction");
306
+ this.options = {
307
+ ...this.options,
308
+ ...t
309
+ }, this.globFunction = this.options.globFunction;
310
+ }
311
+ group() {
312
+ return this.options.group = !0, this;
313
+ }
314
+ withPathSeparator(t) {
315
+ return this.options.pathSeparator = t, this;
316
+ }
317
+ withBasePath() {
318
+ return this.options.includeBasePath = !0, this;
319
+ }
320
+ withRelativePaths() {
321
+ return this.options.relativePaths = !0, this;
322
+ }
323
+ withDirs() {
324
+ return this.options.includeDirs = !0, this;
325
+ }
326
+ withMaxDepth(t) {
327
+ return this.options.maxDepth = t, this;
328
+ }
329
+ withMaxFiles(t) {
330
+ return this.options.maxFiles = t, this;
331
+ }
332
+ withFullPaths() {
333
+ return this.options.resolvePaths = !0, this.options.includeBasePath = !0, this;
334
+ }
335
+ withErrors() {
336
+ return this.options.suppressErrors = !1, this;
337
+ }
338
+ withSymlinks({ resolvePaths: t = !0 } = {}) {
339
+ return this.options.resolveSymlinks = !0, this.options.useRealPaths = t, this.withFullPaths();
340
+ }
341
+ withAbortSignal(t) {
342
+ return this.options.signal = t, this;
343
+ }
344
+ normalize() {
345
+ return this.options.normalizePath = !0, this;
346
+ }
347
+ filter(t) {
348
+ return this.options.filters.push(t), this;
349
+ }
350
+ onlyDirs() {
351
+ return this.options.excludeFiles = !0, this.options.includeDirs = !0, this;
352
+ }
353
+ exclude(t) {
354
+ return this.options.exclude = t, this;
355
+ }
356
+ onlyCounts() {
357
+ return this.options.onlyCounts = !0, this;
358
+ }
359
+ crawl(t) {
360
+ return new Ot(t || ".", this.options);
361
+ }
362
+ withGlobFunction(t) {
363
+ return this.globFunction = t, this;
364
+ }
365
+ /**
366
+ * @deprecated Pass options using the constructor instead:
367
+ * ```ts
368
+ * new fdir(options).crawl("/path/to/root");
369
+ * ```
370
+ * This method will be removed in v7.0
371
+ */
372
+ /* c8 ignore next 4 */
373
+ crawlWithOptions(t, s) {
374
+ return this.options = {
375
+ ...this.options,
376
+ ...s
377
+ }, new Ot(t || ".", this.options);
378
+ }
379
+ glob(...t) {
380
+ return this.globFunction ? this.globWithOptions(t) : this.globWithOptions(t, { dot: !0 });
381
+ }
382
+ globWithOptions(t, ...s) {
383
+ const e = this.globFunction || jt;
384
+ if (!e) throw new Error("Please specify a glob function to use glob matching.");
385
+ var r = this.globCache[t.join("\0")];
386
+ return r || (r = e(t, ...s), this.globCache[t.join("\0")] = r), this.options.filters.push((o) => r(o)), this;
387
+ }
388
+ };
389
+ function Es(t) {
390
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
391
+ }
392
+ var it = {};
393
+ const z = "\\\\/", Ht = `[^${z}]`, bs = 0, Z = "\\.", ms = "\\+", xs = "\\?", ft = "\\/", Cs = "(?=.)", Qt = "[^/]", mt = `(?:${ft}|$)`, zt = `(?:^|${ft})`, xt = `${Z}{1,2}${mt}`, $s = `(?!${Z})`, vs = `(?!${zt}${xt})`, ws = `(?!${Z}{0,1}${mt})`, Os = `(?!${xt})`, Hs = `[^.${ft}]`, Ls = `${Qt}*?`, Ts = "/", Yt = {
394
+ DOT_LITERAL: Z,
395
+ PLUS_LITERAL: ms,
396
+ QMARK_LITERAL: xs,
397
+ SLASH_LITERAL: ft,
398
+ ONE_CHAR: Cs,
399
+ QMARK: Qt,
400
+ END_ANCHOR: mt,
401
+ DOTS_SLASH: xt,
402
+ NO_DOT: $s,
403
+ NO_DOTS: vs,
404
+ NO_DOT_SLASH: ws,
405
+ NO_DOTS_SLASH: Os,
406
+ QMARK_NO_DOT: Hs,
407
+ STAR: Ls,
408
+ START_ANCHOR: zt,
409
+ SEP: Ts
410
+ }, ks = {
411
+ ...Yt,
412
+ SLASH_LITERAL: `[${z}]`,
413
+ QMARK: Ht,
414
+ STAR: `${Ht}*?`,
415
+ DOTS_SLASH: `${Z}{1,2}(?:[${z}]|$)`,
416
+ NO_DOT: `(?!${Z})`,
417
+ NO_DOTS: `(?!(?:^|[${z}])${Z}{1,2}(?:[${z}]|$))`,
418
+ NO_DOT_SLASH: `(?!${Z}{0,1}(?:[${z}]|$))`,
419
+ NO_DOTS_SLASH: `(?!${Z}{1,2}(?:[${z}]|$))`,
420
+ QMARK_NO_DOT: `[^.${z}]`,
421
+ START_ANCHOR: `(?:^|[${z}])`,
422
+ END_ANCHOR: `(?:[${z}]|$)`,
423
+ SEP: "\\"
424
+ }, Ps = {
425
+ __proto__: null,
426
+ alnum: "a-zA-Z0-9",
427
+ alpha: "a-zA-Z",
428
+ ascii: "\\x00-\\x7F",
429
+ blank: " \\t",
430
+ cntrl: "\\x00-\\x1F\\x7F",
431
+ digit: "0-9",
432
+ graph: "\\x21-\\x7E",
433
+ lower: "a-z",
434
+ print: "\\x20-\\x7E ",
435
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
436
+ space: " \\t\\r\\n\\v\\f",
437
+ upper: "A-Z",
438
+ word: "A-Za-z0-9_",
439
+ xdigit: "A-Fa-f0-9"
440
+ };
441
+ var pt = {
442
+ DEFAULT_MAX_EXTGLOB_RECURSION: bs,
443
+ MAX_LENGTH: 1024 * 64,
444
+ POSIX_REGEX_SOURCE: Ps,
445
+ // regular expressions
446
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
447
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
448
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
449
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
450
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
451
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
452
+ // Replace globs with equivalent patterns to reduce parsing time.
453
+ REPLACEMENTS: {
454
+ __proto__: null,
455
+ "***": "*",
456
+ "**/**": "**",
457
+ "**/**/**": "**"
458
+ },
459
+ // Digits
460
+ CHAR_0: 48,
461
+ /* 0 */
462
+ CHAR_9: 57,
463
+ /* 9 */
464
+ // Alphabet chars.
465
+ CHAR_UPPERCASE_A: 65,
466
+ /* A */
467
+ CHAR_LOWERCASE_A: 97,
468
+ /* a */
469
+ CHAR_UPPERCASE_Z: 90,
470
+ /* Z */
471
+ CHAR_LOWERCASE_Z: 122,
472
+ /* z */
473
+ CHAR_LEFT_PARENTHESES: 40,
474
+ /* ( */
475
+ CHAR_RIGHT_PARENTHESES: 41,
476
+ /* ) */
477
+ CHAR_ASTERISK: 42,
478
+ /* * */
479
+ // Non-alphabetic chars.
480
+ CHAR_AMPERSAND: 38,
481
+ /* & */
482
+ CHAR_AT: 64,
483
+ /* @ */
484
+ CHAR_BACKWARD_SLASH: 92,
485
+ /* \ */
486
+ CHAR_CARRIAGE_RETURN: 13,
487
+ /* \r */
488
+ CHAR_CIRCUMFLEX_ACCENT: 94,
489
+ /* ^ */
490
+ CHAR_COLON: 58,
491
+ /* : */
492
+ CHAR_COMMA: 44,
493
+ /* , */
494
+ CHAR_DOT: 46,
495
+ /* . */
496
+ CHAR_DOUBLE_QUOTE: 34,
497
+ /* " */
498
+ CHAR_EQUAL: 61,
499
+ /* = */
500
+ CHAR_EXCLAMATION_MARK: 33,
501
+ /* ! */
502
+ CHAR_FORM_FEED: 12,
503
+ /* \f */
504
+ CHAR_FORWARD_SLASH: 47,
505
+ /* / */
506
+ CHAR_GRAVE_ACCENT: 96,
507
+ /* ` */
508
+ CHAR_HASH: 35,
509
+ /* # */
510
+ CHAR_HYPHEN_MINUS: 45,
511
+ /* - */
512
+ CHAR_LEFT_ANGLE_BRACKET: 60,
513
+ /* < */
514
+ CHAR_LEFT_CURLY_BRACE: 123,
515
+ /* { */
516
+ CHAR_LEFT_SQUARE_BRACKET: 91,
517
+ /* [ */
518
+ CHAR_LINE_FEED: 10,
519
+ /* \n */
520
+ CHAR_NO_BREAK_SPACE: 160,
521
+ /* \u00A0 */
522
+ CHAR_PERCENT: 37,
523
+ /* % */
524
+ CHAR_PLUS: 43,
525
+ /* + */
526
+ CHAR_QUESTION_MARK: 63,
527
+ /* ? */
528
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
529
+ /* > */
530
+ CHAR_RIGHT_CURLY_BRACE: 125,
531
+ /* } */
532
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
533
+ /* ] */
534
+ CHAR_SEMICOLON: 59,
535
+ /* ; */
536
+ CHAR_SINGLE_QUOTE: 39,
537
+ /* ' */
538
+ CHAR_SPACE: 32,
539
+ /* */
540
+ CHAR_TAB: 9,
541
+ /* \t */
542
+ CHAR_UNDERSCORE: 95,
543
+ /* _ */
544
+ CHAR_VERTICAL_LINE: 124,
545
+ /* | */
546
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
547
+ /* \uFEFF */
548
+ /**
549
+ * Create EXTGLOB_CHARS
550
+ */
551
+ extglobChars(t) {
552
+ return {
553
+ "!": { type: "negate", open: "(?:(?!(?:", close: `))${t.STAR})` },
554
+ "?": { type: "qmark", open: "(?:", close: ")?" },
555
+ "+": { type: "plus", open: "(?:", close: ")+" },
556
+ "*": { type: "star", open: "(?:", close: ")*" },
557
+ "@": { type: "at", open: "(?:", close: ")" }
558
+ };
559
+ },
560
+ /**
561
+ * Create GLOB_CHARS
562
+ */
563
+ globChars(t) {
564
+ return t === !0 ? ks : Yt;
565
+ }
566
+ };
567
+ (function(t) {
568
+ const {
569
+ REGEX_BACKSLASH: s,
570
+ REGEX_REMOVE_BACKSLASH: e,
571
+ REGEX_SPECIAL_CHARS: r,
572
+ REGEX_SPECIAL_CHARS_GLOBAL: o
573
+ } = pt;
574
+ t.isObject = (n) => n !== null && typeof n == "object" && !Array.isArray(n), t.hasRegexChars = (n) => r.test(n), t.isRegexChar = (n) => n.length === 1 && t.hasRegexChars(n), t.escapeRegex = (n) => n.replace(o, "\\$1"), t.toPosixSlashes = (n) => n.replace(s, "/"), t.isWindows = () => {
575
+ if (typeof navigator < "u" && navigator.platform) {
576
+ const n = navigator.platform.toLowerCase();
577
+ return n === "win32" || n === "windows";
578
+ }
579
+ return typeof process < "u" && process.platform ? process.platform === "win32" : !1;
580
+ }, t.removeBackslashes = (n) => n.replace(e, (i) => i === "\\" ? "" : i), t.escapeLast = (n, i, l) => {
581
+ const h = n.lastIndexOf(i, l);
582
+ return h === -1 ? n : n[h - 1] === "\\" ? t.escapeLast(n, i, h - 1) : `${n.slice(0, h)}\\${n.slice(h)}`;
583
+ }, t.removePrefix = (n, i = {}) => {
584
+ let l = n;
585
+ return l.startsWith("./") && (l = l.slice(2), i.prefix = "./"), l;
586
+ }, t.wrapOutput = (n, i = {}, l = {}) => {
587
+ const h = l.contains ? "" : "^", g = l.contains ? "" : "$";
588
+ let d = `${h}(?:${n})${g}`;
589
+ return i.negated === !0 && (d = `(?:^(?!${d}).*$)`), d;
590
+ }, t.basename = (n, { windows: i } = {}) => {
591
+ const l = n.split(i ? /[\\/]/ : "/"), h = l[l.length - 1];
592
+ return h === "" ? l[l.length - 2] : h;
593
+ };
594
+ })(it);
595
+ const Lt = it, {
596
+ CHAR_ASTERISK: gt,
597
+ /* * */
598
+ CHAR_AT: Ds,
599
+ /* @ */
600
+ CHAR_BACKWARD_SLASH: st,
601
+ /* \ */
602
+ CHAR_COMMA: Is,
603
+ /* , */
604
+ CHAR_DOT: yt,
605
+ /* . */
606
+ CHAR_EXCLAMATION_MARK: dt,
607
+ /* ! */
608
+ CHAR_FORWARD_SLASH: Zt,
609
+ /* / */
610
+ CHAR_LEFT_CURLY_BRACE: At,
611
+ /* { */
612
+ CHAR_LEFT_PARENTHESES: Rt,
613
+ /* ( */
614
+ CHAR_LEFT_SQUARE_BRACKET: Ns,
615
+ /* [ */
616
+ CHAR_PLUS: Bs,
617
+ /* + */
618
+ CHAR_QUESTION_MARK: Tt,
619
+ /* ? */
620
+ CHAR_RIGHT_CURLY_BRACE: Fs,
621
+ /* } */
622
+ CHAR_RIGHT_PARENTHESES: kt,
623
+ /* ) */
624
+ CHAR_RIGHT_SQUARE_BRACKET: Ms
625
+ /* ] */
626
+ } = pt, Pt = (t) => t === Zt || t === st, Dt = (t) => {
627
+ t.isPrefix !== !0 && (t.depth = t.isGlobstar ? 1 / 0 : 1);
628
+ }, Gs = (t, s) => {
629
+ const e = s || {}, r = t.length - 1, o = e.parts === !0 || e.scanToEnd === !0, n = [], i = [], l = [];
630
+ let h = t, g = -1, d = 0, A = 0, S = !1, x = !1, y = !1, C = !1, T = !1, G = !1, _ = !1, M = !1, X = !1, P = !1, O = 0, v, R, m = { value: "", depth: 0, isGlob: !1 };
631
+ const c = () => g >= r, W = () => h.charCodeAt(g + 1), N = () => (v = R, h.charCodeAt(++g));
632
+ for (; g < r; ) {
633
+ R = N();
634
+ let $;
635
+ if (R === st) {
636
+ _ = m.backslashes = !0, R = N(), R === At && (G = !0);
637
+ continue;
638
+ }
639
+ if (G === !0 || R === At) {
640
+ for (O++; c() !== !0 && (R = N()); ) {
641
+ if (R === st) {
642
+ _ = m.backslashes = !0, N();
643
+ continue;
644
+ }
645
+ if (R === At) {
646
+ O++;
647
+ continue;
648
+ }
649
+ if (G !== !0 && R === yt && (R = N()) === yt) {
650
+ if (S = m.isBrace = !0, y = m.isGlob = !0, P = !0, o === !0)
651
+ continue;
652
+ break;
653
+ }
654
+ if (G !== !0 && R === Is) {
655
+ if (S = m.isBrace = !0, y = m.isGlob = !0, P = !0, o === !0)
656
+ continue;
657
+ break;
658
+ }
659
+ if (R === Fs && (O--, O === 0)) {
660
+ G = !1, S = m.isBrace = !0, P = !0;
661
+ break;
662
+ }
663
+ }
664
+ if (o === !0)
665
+ continue;
666
+ break;
667
+ }
668
+ if (R === Zt) {
669
+ if (n.push(g), i.push(m), m = { value: "", depth: 0, isGlob: !1 }, P === !0) continue;
670
+ if (v === yt && g === d + 1) {
671
+ d += 2;
672
+ continue;
673
+ }
674
+ A = g + 1;
675
+ continue;
676
+ }
677
+ if (e.noext !== !0 && (R === Bs || R === Ds || R === gt || R === Tt || R === dt) === !0 && W() === Rt) {
678
+ if (y = m.isGlob = !0, C = m.isExtglob = !0, P = !0, R === dt && g === d && (X = !0), o === !0) {
679
+ for (; c() !== !0 && (R = N()); ) {
680
+ if (R === st) {
681
+ _ = m.backslashes = !0, R = N();
682
+ continue;
683
+ }
684
+ if (R === kt) {
685
+ y = m.isGlob = !0, P = !0;
686
+ break;
687
+ }
688
+ }
689
+ continue;
690
+ }
691
+ break;
692
+ }
693
+ if (R === gt) {
694
+ if (v === gt && (T = m.isGlobstar = !0), y = m.isGlob = !0, P = !0, o === !0)
695
+ continue;
696
+ break;
697
+ }
698
+ if (R === Tt) {
699
+ if (y = m.isGlob = !0, P = !0, o === !0)
700
+ continue;
701
+ break;
702
+ }
703
+ if (R === Ns) {
704
+ for (; c() !== !0 && ($ = N()); ) {
705
+ if ($ === st) {
706
+ _ = m.backslashes = !0, N();
707
+ continue;
708
+ }
709
+ if ($ === Ms) {
710
+ x = m.isBracket = !0, y = m.isGlob = !0, P = !0;
711
+ break;
712
+ }
713
+ }
714
+ if (o === !0)
715
+ continue;
716
+ break;
717
+ }
718
+ if (e.nonegate !== !0 && R === dt && g === d) {
719
+ M = m.negated = !0, d++;
720
+ continue;
721
+ }
722
+ if (e.noparen !== !0 && R === Rt) {
723
+ if (y = m.isGlob = !0, o === !0) {
724
+ for (; c() !== !0 && (R = N()); ) {
725
+ if (R === Rt) {
726
+ _ = m.backslashes = !0, R = N();
727
+ continue;
728
+ }
729
+ if (R === kt) {
730
+ P = !0;
731
+ break;
732
+ }
733
+ }
734
+ continue;
735
+ }
736
+ break;
737
+ }
738
+ if (y === !0) {
739
+ if (P = !0, o === !0)
740
+ continue;
741
+ break;
742
+ }
743
+ }
744
+ e.noext === !0 && (C = !1, y = !1);
745
+ let D = h, a = "", u = "";
746
+ d > 0 && (a = h.slice(0, d), h = h.slice(d), A -= d), D && y === !0 && A > 0 ? (D = h.slice(0, A), u = h.slice(A)) : y === !0 ? (D = "", u = h) : D = h, D && D !== "" && D !== "/" && D !== h && Pt(D.charCodeAt(D.length - 1)) && (D = D.slice(0, -1)), e.unescape === !0 && (u && (u = Lt.removeBackslashes(u)), D && _ === !0 && (D = Lt.removeBackslashes(D)));
747
+ const q = {
748
+ prefix: a,
749
+ input: t,
750
+ start: d,
751
+ base: D,
752
+ glob: u,
753
+ isBrace: S,
754
+ isBracket: x,
755
+ isGlob: y,
756
+ isExtglob: C,
757
+ isGlobstar: T,
758
+ negated: M,
759
+ negatedExtglob: X
760
+ };
761
+ if (e.tokens === !0 && (q.maxDepth = 0, Pt(R) || i.push(m), q.tokens = i), e.parts === !0 || e.tokens === !0) {
762
+ let $;
763
+ for (let k = 0; k < n.length; k++) {
764
+ const Y = $ ? $ + 1 : d, K = n[k], V = t.slice(Y, K);
765
+ e.tokens && (k === 0 && d !== 0 ? (i[k].isPrefix = !0, i[k].value = a) : i[k].value = V, Dt(i[k]), q.maxDepth += i[k].depth), (k !== 0 || V !== "") && l.push(V), $ = K;
766
+ }
767
+ if ($ && $ + 1 < t.length) {
768
+ const k = t.slice($ + 1);
769
+ l.push(k), e.tokens && (i[i.length - 1].value = k, Dt(i[i.length - 1]), q.maxDepth += i[i.length - 1].depth);
770
+ }
771
+ q.slashes = n, q.parts = l;
772
+ }
773
+ return q;
774
+ };
775
+ var Ws = Gs;
776
+ const rt = pt, U = it, {
777
+ MAX_LENGTH: ct,
778
+ POSIX_REGEX_SOURCE: Us,
779
+ REGEX_NON_SPECIAL_CHARS: qs,
780
+ REGEX_SPECIAL_CHARS_BACKREF: Ks,
781
+ REPLACEMENTS: Vt
782
+ } = rt, Xs = (t, s) => {
783
+ if (typeof s.expandRange == "function")
784
+ return s.expandRange(...t, s);
785
+ t.sort();
786
+ const e = `[${t.join("-")}]`;
787
+ try {
788
+ new RegExp(e);
789
+ } catch {
790
+ return t.map((o) => U.escapeRegex(o)).join("..");
791
+ }
792
+ return e;
793
+ }, et = (t, s) => `Missing ${t}: "${s}" - use "\\\\${s}" to match literal characters`, Jt = (t) => {
794
+ const s = [];
795
+ let e = 0, r = 0, o = 0, n = "", i = !1;
796
+ for (const l of t) {
797
+ if (i === !0) {
798
+ n += l, i = !1;
799
+ continue;
800
+ }
801
+ if (l === "\\") {
802
+ n += l, i = !0;
803
+ continue;
804
+ }
805
+ if (l === '"') {
806
+ o = o === 1 ? 0 : 1, n += l;
807
+ continue;
808
+ }
809
+ if (o === 0) {
810
+ if (l === "[")
811
+ e++;
812
+ else if (l === "]" && e > 0)
813
+ e--;
814
+ else if (e === 0) {
815
+ if (l === "(")
816
+ r++;
817
+ else if (l === ")" && r > 0)
818
+ r--;
819
+ else if (l === "|" && r === 0) {
820
+ s.push(n), n = "";
821
+ continue;
822
+ }
823
+ }
824
+ }
825
+ n += l;
826
+ }
827
+ return s.push(n), s;
828
+ }, js = (t) => {
829
+ let s = !1;
830
+ for (const e of t) {
831
+ if (s === !0) {
832
+ s = !1;
833
+ continue;
834
+ }
835
+ if (e === "\\") {
836
+ s = !0;
837
+ continue;
838
+ }
839
+ if (/[?*+@!()[\]{}]/.test(e))
840
+ return !1;
841
+ }
842
+ return !0;
843
+ }, Ct = (t) => {
844
+ let s = t.trim(), e = !0;
845
+ for (; e === !0; )
846
+ e = !1, /^@\([^\\()[\]{}|]+\)$/.test(s) && (s = s.slice(2, -1), e = !0);
847
+ if (js(s))
848
+ return s.replace(/\\(.)/g, "$1");
849
+ }, Qs = (t) => {
850
+ const s = t.map(Ct).filter(Boolean);
851
+ for (let e = 0; e < s.length; e++)
852
+ for (let r = e + 1; r < s.length; r++) {
853
+ const o = s[e], n = s[r], i = o[0];
854
+ if (!(!i || o !== i.repeat(o.length) || n !== i.repeat(n.length)) && (o === n || o.startsWith(n) || n.startsWith(o)))
855
+ return !0;
856
+ }
857
+ return !1;
858
+ }, Et = (t, s = !0) => {
859
+ if (t[0] !== "+" && t[0] !== "*" || t[1] !== "(")
860
+ return;
861
+ let e = 0, r = 0, o = 0, n = !1;
862
+ for (let i = 1; i < t.length; i++) {
863
+ const l = t[i];
864
+ if (n === !0) {
865
+ n = !1;
866
+ continue;
867
+ }
868
+ if (l === "\\") {
869
+ n = !0;
870
+ continue;
871
+ }
872
+ if (l === '"') {
873
+ o = o === 1 ? 0 : 1;
874
+ continue;
875
+ }
876
+ if (o !== 1) {
877
+ if (l === "[") {
878
+ e++;
879
+ continue;
880
+ }
881
+ if (l === "]" && e > 0) {
882
+ e--;
883
+ continue;
884
+ }
885
+ if (!(e > 0)) {
886
+ if (l === "(") {
887
+ r++;
888
+ continue;
889
+ }
890
+ if (l === ")" && (r--, r === 0))
891
+ return s === !0 && i !== t.length - 1 ? void 0 : {
892
+ type: t[0],
893
+ body: t.slice(2, i),
894
+ end: i
895
+ };
896
+ }
897
+ }
898
+ }
899
+ }, zs = (t) => `${t.length === 1 ? U.escapeRegex(t[0]) : `[${t.map((e) => U.escapeRegex(e)).join("")}]`}*`, Ys = (t) => {
900
+ let s = 0;
901
+ const e = [];
902
+ for (; s < t.length; ) {
903
+ const r = Et(t.slice(s), !1);
904
+ if (!r || r.type !== "*")
905
+ return;
906
+ const o = Jt(r.body).map((i) => i.trim());
907
+ if (o.length !== 1)
908
+ return;
909
+ const n = Ct(o[0]);
910
+ if (!n || n.length !== 1)
911
+ return;
912
+ e.push(n), s += r.end + 1;
913
+ }
914
+ if (!(e.length < 1))
915
+ return e;
916
+ }, Zs = (t) => {
917
+ let s = 0, e = t.trim(), r = Et(e);
918
+ for (; r; )
919
+ s++, e = r.body.trim(), r = Et(e);
920
+ return s;
921
+ }, Vs = (t, s) => {
922
+ if (s.maxExtglobRecursion === !1)
923
+ return { risky: !1 };
924
+ const e = typeof s.maxExtglobRecursion == "number" ? s.maxExtglobRecursion : rt.DEFAULT_MAX_EXTGLOB_RECURSION, r = Jt(t).map((l) => l.trim());
925
+ if (r.length > 1 && (r.some((l) => l === "") || r.some((l) => /^[*?]+$/.test(l)) || Qs(r)))
926
+ return { risky: !0 };
927
+ const o = [];
928
+ let n = !1, i = !0;
929
+ for (const l of r) {
930
+ const h = Ys(l);
931
+ if (h) {
932
+ n = !0, o.push(...h);
933
+ continue;
934
+ }
935
+ const g = Ct(l);
936
+ if (g && g.length === 1) {
937
+ o.push(g);
938
+ continue;
939
+ }
940
+ if (i = !1, Zs(l) > e)
941
+ return { risky: !0 };
942
+ }
943
+ return n ? i ? { risky: !0, safeOutput: zs([...new Set(o)]) } : { risky: !0 } : { risky: !1 };
944
+ }, $t = (t, s) => {
945
+ if (typeof t != "string")
946
+ throw new TypeError("Expected a string");
947
+ t = Vt[t] || t;
948
+ const e = { ...s }, r = typeof e.maxLength == "number" ? Math.min(ct, e.maxLength) : ct;
949
+ let o = t.length;
950
+ if (o > r)
951
+ throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);
952
+ const n = { type: "bos", value: "", output: e.prepend || "" }, i = [n], l = e.capture ? "" : "?:", h = rt.globChars(e.windows), g = rt.extglobChars(h), {
953
+ DOT_LITERAL: d,
954
+ PLUS_LITERAL: A,
955
+ SLASH_LITERAL: S,
956
+ ONE_CHAR: x,
957
+ DOTS_SLASH: y,
958
+ NO_DOT: C,
959
+ NO_DOT_SLASH: T,
960
+ NO_DOTS_SLASH: G,
961
+ QMARK: _,
962
+ QMARK_NO_DOT: M,
963
+ STAR: X,
964
+ START_ANCHOR: P
965
+ } = h, O = (p) => `(${l}(?:(?!${P}${p.dot ? y : d}).)*?)`, v = e.dot ? "" : C, R = e.dot ? _ : M;
966
+ let m = e.bash === !0 ? O(e) : X;
967
+ e.capture && (m = `(${m})`), typeof e.noext == "boolean" && (e.noextglob = e.noext);
968
+ const c = {
969
+ input: t,
970
+ index: -1,
971
+ start: 0,
972
+ dot: e.dot === !0,
973
+ consumed: "",
974
+ output: "",
975
+ prefix: "",
976
+ backtrack: !1,
977
+ negated: !1,
978
+ brackets: 0,
979
+ braces: 0,
980
+ parens: 0,
981
+ quotes: 0,
982
+ globstar: !1,
983
+ tokens: i
984
+ };
985
+ t = U.removePrefix(t, c), o = t.length;
986
+ const W = [], N = [], D = [];
987
+ let a = n, u;
988
+ const q = () => c.index === o - 1, $ = c.peek = (p = 1) => t[c.index + p], k = c.advance = () => t[++c.index] || "", Y = () => t.slice(c.index + 1), K = (p = "", L = 0) => {
989
+ c.consumed += p, c.index += L;
990
+ }, V = (p) => {
991
+ c.output += p.output != null ? p.output : p.value, K(p.value);
992
+ }, le = () => {
993
+ let p = 1;
994
+ for (; $() === "!" && ($(2) !== "(" || $(3) === "?"); )
995
+ k(), c.start++, p++;
996
+ return p % 2 === 0 ? !1 : (c.negated = !0, c.start++, !0);
997
+ }, ut = (p) => {
998
+ c[p]++, D.push(p);
999
+ }, J = (p) => {
1000
+ c[p]--, D.pop();
1001
+ }, E = (p) => {
1002
+ if (a.type === "globstar") {
1003
+ const L = c.braces > 0 && (p.type === "comma" || p.type === "brace"), f = p.extglob === !0 || W.length && (p.type === "pipe" || p.type === "paren");
1004
+ p.type !== "slash" && p.type !== "paren" && !L && !f && (c.output = c.output.slice(0, -a.output.length), a.type = "star", a.value = "*", a.output = m, c.output += a.output);
1005
+ }
1006
+ if (W.length && p.type !== "paren" && (W[W.length - 1].inner += p.value), (p.value || p.output) && V(p), a && a.type === "text" && p.type === "text") {
1007
+ a.output = (a.output || a.value) + p.value, a.value += p.value;
1008
+ return;
1009
+ }
1010
+ p.prev = a, i.push(p), a = p;
1011
+ }, at = (p, L) => {
1012
+ const f = { ...g[L], conditions: 1, inner: "" };
1013
+ f.prev = a, f.parens = c.parens, f.output = c.output, f.startIndex = c.index, f.tokensIndex = i.length;
1014
+ const b = (e.capture ? "(" : "") + f.open;
1015
+ ut("parens"), E({ type: p, value: L, output: c.output ? "" : x }), E({ type: "paren", extglob: !0, value: k(), output: b }), W.push(f);
1016
+ }, fe = (p) => {
1017
+ const L = t.slice(p.startIndex, c.index + 1), f = t.slice(p.startIndex + 2, c.index), b = Vs(f, e);
1018
+ if ((p.type === "plus" || p.type === "star") && b.risky) {
1019
+ const w = b.safeOutput ? (p.output ? "" : x) + (e.capture ? `(${b.safeOutput})` : b.safeOutput) : void 0, j = i[p.tokensIndex];
1020
+ j.type = "text", j.value = L, j.output = w || U.escapeRegex(L);
1021
+ for (let Q = p.tokensIndex + 1; Q < i.length; Q++)
1022
+ i[Q].value = "", i[Q].output = "", delete i[Q].suffix;
1023
+ c.output = p.output + j.output, c.backtrack = !0, E({ type: "paren", extglob: !0, value: u, output: "" }), J("parens");
1024
+ return;
1025
+ }
1026
+ let H = p.close + (e.capture ? ")" : ""), F;
1027
+ if (p.type === "negate") {
1028
+ let w = m;
1029
+ if (p.inner && p.inner.length > 1 && p.inner.includes("/") && (w = O(e)), (w !== m || q() || /^\)+$/.test(Y())) && (H = p.close = `)$))${w}`), p.inner.includes("*") && (F = Y()) && /^\.[^\\/.]+$/.test(F)) {
1030
+ const j = $t(F, { ...s, fastpaths: !1 }).output;
1031
+ H = p.close = `)${j})${w})`;
1032
+ }
1033
+ p.prev.type === "bos" && (c.negatedExtglob = !0);
1034
+ }
1035
+ E({ type: "paren", extglob: !0, value: u, output: H }), J("parens");
1036
+ };
1037
+ if (e.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(t)) {
1038
+ let p = !1, L = t.replace(Ks, (f, b, H, F, w, j) => F === "\\" ? (p = !0, f) : F === "?" ? b ? b + F + (w ? _.repeat(w.length) : "") : j === 0 ? R + (w ? _.repeat(w.length) : "") : _.repeat(H.length) : F === "." ? d.repeat(H.length) : F === "*" ? b ? b + F + (w ? m : "") : m : b ? f : `\\${f}`);
1039
+ return p === !0 && (e.unescape === !0 ? L = L.replace(/\\/g, "") : L = L.replace(/\\+/g, (f) => f.length % 2 === 0 ? "\\\\" : f ? "\\" : "")), L === t && e.contains === !0 ? (c.output = t, c) : (c.output = U.wrapOutput(L, c, s), c);
1040
+ }
1041
+ for (; !q(); ) {
1042
+ if (u = k(), u === "\0")
1043
+ continue;
1044
+ if (u === "\\") {
1045
+ const f = $();
1046
+ if (f === "/" && e.bash !== !0 || f === "." || f === ";")
1047
+ continue;
1048
+ if (!f) {
1049
+ u += "\\", E({ type: "text", value: u });
1050
+ continue;
1051
+ }
1052
+ const b = /^\\+/.exec(Y());
1053
+ let H = 0;
1054
+ if (b && b[0].length > 2 && (H = b[0].length, c.index += H, H % 2 !== 0 && (u += "\\")), e.unescape === !0 ? u = k() : u += k(), c.brackets === 0) {
1055
+ E({ type: "text", value: u });
1056
+ continue;
1057
+ }
1058
+ }
1059
+ if (c.brackets > 0 && (u !== "]" || a.value === "[" || a.value === "[^")) {
1060
+ if (e.posix !== !1 && u === ":") {
1061
+ const f = a.value.slice(1);
1062
+ if (f.includes("[") && (a.posix = !0, f.includes(":"))) {
1063
+ const b = a.value.lastIndexOf("["), H = a.value.slice(0, b), F = a.value.slice(b + 2), w = Us[F];
1064
+ if (w) {
1065
+ a.value = H + w, c.backtrack = !0, k(), !n.output && i.indexOf(a) === 1 && (n.output = x);
1066
+ continue;
1067
+ }
1068
+ }
1069
+ }
1070
+ (u === "[" && $() !== ":" || u === "-" && $() === "]") && (u = `\\${u}`), u === "]" && (a.value === "[" || a.value === "[^") && (u = `\\${u}`), e.posix === !0 && u === "!" && a.value === "[" && (u = "^"), a.value += u, V({ value: u });
1071
+ continue;
1072
+ }
1073
+ if (c.quotes === 1 && u !== '"') {
1074
+ u = U.escapeRegex(u), a.value += u, V({ value: u });
1075
+ continue;
1076
+ }
1077
+ if (u === '"') {
1078
+ c.quotes = c.quotes === 1 ? 0 : 1, e.keepQuotes === !0 && E({ type: "text", value: u });
1079
+ continue;
1080
+ }
1081
+ if (u === "(") {
1082
+ ut("parens"), E({ type: "paren", value: u });
1083
+ continue;
1084
+ }
1085
+ if (u === ")") {
1086
+ if (c.parens === 0 && e.strictBrackets === !0)
1087
+ throw new SyntaxError(et("opening", "("));
1088
+ const f = W[W.length - 1];
1089
+ if (f && c.parens === f.parens + 1) {
1090
+ fe(W.pop());
1091
+ continue;
1092
+ }
1093
+ E({ type: "paren", value: u, output: c.parens ? ")" : "\\)" }), J("parens");
1094
+ continue;
1095
+ }
1096
+ if (u === "[") {
1097
+ if (e.nobracket === !0 || !Y().includes("]")) {
1098
+ if (e.nobracket !== !0 && e.strictBrackets === !0)
1099
+ throw new SyntaxError(et("closing", "]"));
1100
+ u = `\\${u}`;
1101
+ } else
1102
+ ut("brackets");
1103
+ E({ type: "bracket", value: u });
1104
+ continue;
1105
+ }
1106
+ if (u === "]") {
1107
+ if (e.nobracket === !0 || a && a.type === "bracket" && a.value.length === 1) {
1108
+ E({ type: "text", value: u, output: `\\${u}` });
1109
+ continue;
1110
+ }
1111
+ if (c.brackets === 0) {
1112
+ if (e.strictBrackets === !0)
1113
+ throw new SyntaxError(et("opening", "["));
1114
+ E({ type: "text", value: u, output: `\\${u}` });
1115
+ continue;
1116
+ }
1117
+ J("brackets");
1118
+ const f = a.value.slice(1);
1119
+ if (a.posix !== !0 && f[0] === "^" && !f.includes("/") && (u = `/${u}`), a.value += u, V({ value: u }), e.literalBrackets === !1 || U.hasRegexChars(f))
1120
+ continue;
1121
+ const b = U.escapeRegex(a.value);
1122
+ if (c.output = c.output.slice(0, -a.value.length), e.literalBrackets === !0) {
1123
+ c.output += b, a.value = b;
1124
+ continue;
1125
+ }
1126
+ a.value = `(${l}${b}|${a.value})`, c.output += a.value;
1127
+ continue;
1128
+ }
1129
+ if (u === "{" && e.nobrace !== !0) {
1130
+ ut("braces");
1131
+ const f = {
1132
+ type: "brace",
1133
+ value: u,
1134
+ output: "(",
1135
+ outputIndex: c.output.length,
1136
+ tokensIndex: c.tokens.length
1137
+ };
1138
+ N.push(f), E(f);
1139
+ continue;
1140
+ }
1141
+ if (u === "}") {
1142
+ const f = N[N.length - 1];
1143
+ if (e.nobrace === !0 || !f) {
1144
+ E({ type: "text", value: u, output: u });
1145
+ continue;
1146
+ }
1147
+ let b = ")";
1148
+ if (f.dots === !0) {
1149
+ const H = i.slice(), F = [];
1150
+ for (let w = H.length - 1; w >= 0 && (i.pop(), H[w].type !== "brace"); w--)
1151
+ H[w].type !== "dots" && F.unshift(H[w].value);
1152
+ b = Xs(F, e), c.backtrack = !0;
1153
+ }
1154
+ if (f.comma !== !0 && f.dots !== !0) {
1155
+ const H = c.output.slice(0, f.outputIndex), F = c.tokens.slice(f.tokensIndex);
1156
+ f.value = f.output = "\\{", u = b = "\\}", c.output = H;
1157
+ for (const w of F)
1158
+ c.output += w.output || w.value;
1159
+ }
1160
+ E({ type: "brace", value: u, output: b }), J("braces"), N.pop();
1161
+ continue;
1162
+ }
1163
+ if (u === "|") {
1164
+ W.length > 0 && W[W.length - 1].conditions++, E({ type: "text", value: u });
1165
+ continue;
1166
+ }
1167
+ if (u === ",") {
1168
+ let f = u;
1169
+ const b = N[N.length - 1];
1170
+ b && D[D.length - 1] === "braces" && (b.comma = !0, f = "|"), E({ type: "comma", value: u, output: f });
1171
+ continue;
1172
+ }
1173
+ if (u === "/") {
1174
+ if (a.type === "dot" && c.index === c.start + 1) {
1175
+ c.start = c.index + 1, c.consumed = "", c.output = "", i.pop(), a = n;
1176
+ continue;
1177
+ }
1178
+ E({ type: "slash", value: u, output: S });
1179
+ continue;
1180
+ }
1181
+ if (u === ".") {
1182
+ if (c.braces > 0 && a.type === "dot") {
1183
+ a.value === "." && (a.output = d);
1184
+ const f = N[N.length - 1];
1185
+ a.type = "dots", a.output += u, a.value += u, f.dots = !0;
1186
+ continue;
1187
+ }
1188
+ if (c.braces + c.parens === 0 && a.type !== "bos" && a.type !== "slash") {
1189
+ E({ type: "text", value: u, output: d });
1190
+ continue;
1191
+ }
1192
+ E({ type: "dot", value: u, output: d });
1193
+ continue;
1194
+ }
1195
+ if (u === "?") {
1196
+ if (!(a && a.value === "(") && e.noextglob !== !0 && $() === "(" && $(2) !== "?") {
1197
+ at("qmark", u);
1198
+ continue;
1199
+ }
1200
+ if (a && a.type === "paren") {
1201
+ const b = $();
1202
+ let H = u;
1203
+ (a.value === "(" && !/[!=<:]/.test(b) || b === "<" && !/<([!=]|\w+>)/.test(Y())) && (H = `\\${u}`), E({ type: "text", value: u, output: H });
1204
+ continue;
1205
+ }
1206
+ if (e.dot !== !0 && (a.type === "slash" || a.type === "bos")) {
1207
+ E({ type: "qmark", value: u, output: M });
1208
+ continue;
1209
+ }
1210
+ E({ type: "qmark", value: u, output: _ });
1211
+ continue;
1212
+ }
1213
+ if (u === "!") {
1214
+ if (e.noextglob !== !0 && $() === "(" && ($(2) !== "?" || !/[!=<:]/.test($(3)))) {
1215
+ at("negate", u);
1216
+ continue;
1217
+ }
1218
+ if (e.nonegate !== !0 && c.index === 0) {
1219
+ le();
1220
+ continue;
1221
+ }
1222
+ }
1223
+ if (u === "+") {
1224
+ if (e.noextglob !== !0 && $() === "(" && $(2) !== "?") {
1225
+ at("plus", u);
1226
+ continue;
1227
+ }
1228
+ if (a && a.value === "(" || e.regex === !1) {
1229
+ E({ type: "plus", value: u, output: A });
1230
+ continue;
1231
+ }
1232
+ if (a && (a.type === "bracket" || a.type === "paren" || a.type === "brace") || c.parens > 0) {
1233
+ E({ type: "plus", value: u });
1234
+ continue;
1235
+ }
1236
+ E({ type: "plus", value: A });
1237
+ continue;
1238
+ }
1239
+ if (u === "@") {
1240
+ if (e.noextglob !== !0 && $() === "(" && $(2) !== "?") {
1241
+ E({ type: "at", extglob: !0, value: u, output: "" });
1242
+ continue;
1243
+ }
1244
+ E({ type: "text", value: u });
1245
+ continue;
1246
+ }
1247
+ if (u !== "*") {
1248
+ (u === "$" || u === "^") && (u = `\\${u}`);
1249
+ const f = qs.exec(Y());
1250
+ f && (u += f[0], c.index += f[0].length), E({ type: "text", value: u });
1251
+ continue;
1252
+ }
1253
+ if (a && (a.type === "globstar" || a.star === !0)) {
1254
+ a.type = "star", a.star = !0, a.value += u, a.output = m, c.backtrack = !0, c.globstar = !0, K(u);
1255
+ continue;
1256
+ }
1257
+ let p = Y();
1258
+ if (e.noextglob !== !0 && /^\([^?]/.test(p)) {
1259
+ at("star", u);
1260
+ continue;
1261
+ }
1262
+ if (a.type === "star") {
1263
+ if (e.noglobstar === !0) {
1264
+ K(u);
1265
+ continue;
1266
+ }
1267
+ const f = a.prev, b = f.prev, H = f.type === "slash" || f.type === "bos", F = b && (b.type === "star" || b.type === "globstar");
1268
+ if (e.bash === !0 && (!H || p[0] && p[0] !== "/")) {
1269
+ E({ type: "star", value: u, output: "" });
1270
+ continue;
1271
+ }
1272
+ const w = c.braces > 0 && (f.type === "comma" || f.type === "brace"), j = W.length && (f.type === "pipe" || f.type === "paren");
1273
+ if (!H && f.type !== "paren" && !w && !j) {
1274
+ E({ type: "star", value: u, output: "" });
1275
+ continue;
1276
+ }
1277
+ for (; p.slice(0, 3) === "/**"; ) {
1278
+ const Q = t[c.index + 4];
1279
+ if (Q && Q !== "/")
1280
+ break;
1281
+ p = p.slice(3), K("/**", 3);
1282
+ }
1283
+ if (f.type === "bos" && q()) {
1284
+ a.type = "globstar", a.value += u, a.output = O(e), c.output = a.output, c.globstar = !0, K(u);
1285
+ continue;
1286
+ }
1287
+ if (f.type === "slash" && f.prev.type !== "bos" && !F && q()) {
1288
+ c.output = c.output.slice(0, -(f.output + a.output).length), f.output = `(?:${f.output}`, a.type = "globstar", a.output = O(e) + (e.strictSlashes ? ")" : "|$)"), a.value += u, c.globstar = !0, c.output += f.output + a.output, K(u);
1289
+ continue;
1290
+ }
1291
+ if (f.type === "slash" && f.prev.type !== "bos" && p[0] === "/") {
1292
+ const Q = p[1] !== void 0 ? "|$" : "";
1293
+ c.output = c.output.slice(0, -(f.output + a.output).length), f.output = `(?:${f.output}`, a.type = "globstar", a.output = `${O(e)}${S}|${S}${Q})`, a.value += u, c.output += f.output + a.output, c.globstar = !0, K(u + k()), E({ type: "slash", value: "/", output: "" });
1294
+ continue;
1295
+ }
1296
+ if (f.type === "bos" && p[0] === "/") {
1297
+ a.type = "globstar", a.value += u, a.output = `(?:^|${S}|${O(e)}${S})`, c.output = a.output, c.globstar = !0, K(u + k()), E({ type: "slash", value: "/", output: "" });
1298
+ continue;
1299
+ }
1300
+ c.output = c.output.slice(0, -a.output.length), a.type = "globstar", a.output = O(e), a.value += u, c.output += a.output, c.globstar = !0, K(u);
1301
+ continue;
1302
+ }
1303
+ const L = { type: "star", value: u, output: m };
1304
+ if (e.bash === !0) {
1305
+ L.output = ".*?", (a.type === "bos" || a.type === "slash") && (L.output = v + L.output), E(L);
1306
+ continue;
1307
+ }
1308
+ if (a && (a.type === "bracket" || a.type === "paren") && e.regex === !0) {
1309
+ L.output = u, E(L);
1310
+ continue;
1311
+ }
1312
+ (c.index === c.start || a.type === "slash" || a.type === "dot") && (a.type === "dot" ? (c.output += T, a.output += T) : e.dot === !0 ? (c.output += G, a.output += G) : (c.output += v, a.output += v), $() !== "*" && (c.output += x, a.output += x)), E(L);
1313
+ }
1314
+ for (; c.brackets > 0; ) {
1315
+ if (e.strictBrackets === !0) throw new SyntaxError(et("closing", "]"));
1316
+ c.output = U.escapeLast(c.output, "["), J("brackets");
1317
+ }
1318
+ for (; c.parens > 0; ) {
1319
+ if (e.strictBrackets === !0) throw new SyntaxError(et("closing", ")"));
1320
+ c.output = U.escapeLast(c.output, "("), J("parens");
1321
+ }
1322
+ for (; c.braces > 0; ) {
1323
+ if (e.strictBrackets === !0) throw new SyntaxError(et("closing", "}"));
1324
+ c.output = U.escapeLast(c.output, "{"), J("braces");
1325
+ }
1326
+ if (e.strictSlashes !== !0 && (a.type === "star" || a.type === "bracket") && E({ type: "maybe_slash", value: "", output: `${S}?` }), c.backtrack === !0) {
1327
+ c.output = "";
1328
+ for (const p of c.tokens)
1329
+ c.output += p.output != null ? p.output : p.value, p.suffix && (c.output += p.suffix);
1330
+ }
1331
+ return c;
1332
+ };
1333
+ $t.fastpaths = (t, s) => {
1334
+ const e = { ...s }, r = typeof e.maxLength == "number" ? Math.min(ct, e.maxLength) : ct, o = t.length;
1335
+ if (o > r)
1336
+ throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);
1337
+ t = Vt[t] || t;
1338
+ const {
1339
+ DOT_LITERAL: n,
1340
+ SLASH_LITERAL: i,
1341
+ ONE_CHAR: l,
1342
+ DOTS_SLASH: h,
1343
+ NO_DOT: g,
1344
+ NO_DOTS: d,
1345
+ NO_DOTS_SLASH: A,
1346
+ STAR: S,
1347
+ START_ANCHOR: x
1348
+ } = rt.globChars(e.windows), y = e.dot ? d : g, C = e.dot ? A : g, T = e.capture ? "" : "?:", G = { negated: !1, prefix: "" };
1349
+ let _ = e.bash === !0 ? ".*?" : S;
1350
+ e.capture && (_ = `(${_})`);
1351
+ const M = (v) => v.noglobstar === !0 ? _ : `(${T}(?:(?!${x}${v.dot ? h : n}).)*?)`, X = (v) => {
1352
+ switch (v) {
1353
+ case "*":
1354
+ return `${y}${l}${_}`;
1355
+ case ".*":
1356
+ return `${n}${l}${_}`;
1357
+ case "*.*":
1358
+ return `${y}${_}${n}${l}${_}`;
1359
+ case "*/*":
1360
+ return `${y}${_}${i}${l}${C}${_}`;
1361
+ case "**":
1362
+ return y + M(e);
1363
+ case "**/*":
1364
+ return `(?:${y}${M(e)}${i})?${C}${l}${_}`;
1365
+ case "**/*.*":
1366
+ return `(?:${y}${M(e)}${i})?${C}${_}${n}${l}${_}`;
1367
+ case "**/.*":
1368
+ return `(?:${y}${M(e)}${i})?${n}${l}${_}`;
1369
+ default: {
1370
+ const R = /^(.*?)\.(\w+)$/.exec(v);
1371
+ if (!R) return;
1372
+ const m = X(R[1]);
1373
+ return m ? m + n + R[2] : void 0;
1374
+ }
1375
+ }
1376
+ }, P = U.removePrefix(t, G);
1377
+ let O = X(P);
1378
+ return O && e.strictSlashes !== !0 && (O += `${i}?`), O;
1379
+ };
1380
+ var Js = $t;
1381
+ const tn = Ws, bt = Js, te = it, en = pt, sn = (t) => t && typeof t == "object" && !Array.isArray(t), I = (t, s, e = !1) => {
1382
+ if (Array.isArray(t)) {
1383
+ const d = t.map((S) => I(S, s, e));
1384
+ return (S) => {
1385
+ for (const x of d) {
1386
+ const y = x(S);
1387
+ if (y) return y;
1388
+ }
1389
+ return !1;
1390
+ };
1391
+ }
1392
+ const r = sn(t) && t.tokens && t.input;
1393
+ if (t === "" || typeof t != "string" && !r)
1394
+ throw new TypeError("Expected pattern to be a non-empty string");
1395
+ const o = s || {}, n = o.windows, i = r ? I.compileRe(t, s) : I.makeRe(t, s, !1, !0), l = i.state;
1396
+ delete i.state;
1397
+ let h = () => !1;
1398
+ if (o.ignore) {
1399
+ const d = { ...s, ignore: null, onMatch: null, onResult: null };
1400
+ h = I(o.ignore, d, e);
1401
+ }
1402
+ const g = (d, A = !1) => {
1403
+ const { isMatch: S, match: x, output: y } = I.test(d, i, s, { glob: t, posix: n }), C = { glob: t, state: l, regex: i, posix: n, input: d, output: y, match: x, isMatch: S };
1404
+ return typeof o.onResult == "function" && o.onResult(C), S === !1 ? (C.isMatch = !1, A ? C : !1) : h(d) ? (typeof o.onIgnore == "function" && o.onIgnore(C), C.isMatch = !1, A ? C : !1) : (typeof o.onMatch == "function" && o.onMatch(C), A ? C : !0);
1405
+ };
1406
+ return e && (g.state = l), g;
1407
+ };
1408
+ I.test = (t, s, e, { glob: r, posix: o } = {}) => {
1409
+ if (typeof t != "string")
1410
+ throw new TypeError("Expected input to be a string");
1411
+ if (t === "")
1412
+ return { isMatch: !1, output: "" };
1413
+ const n = e || {}, i = n.format || (o ? te.toPosixSlashes : null);
1414
+ let l = t === r, h = l && i ? i(t) : t;
1415
+ return l === !1 && (h = i ? i(t) : t, l = h === r), (l === !1 || n.capture === !0) && (n.matchBase === !0 || n.basename === !0 ? l = I.matchBase(t, s, e, o) : l = s.exec(h)), { isMatch: !!l, match: l, output: h };
1416
+ };
1417
+ I.matchBase = (t, s, e, r = e && e.windows) => (s instanceof RegExp ? s : I.makeRe(s, e)).test(te.basename(t, { windows: r }));
1418
+ I.isMatch = (t, s, e) => I(s, e)(t);
1419
+ I.parse = (t, s) => Array.isArray(t) ? t.map((e) => I.parse(e, s)) : bt(t, { ...s, fastpaths: !1 });
1420
+ I.scan = (t, s) => tn(t, s);
1421
+ I.compileRe = (t, s, e = !1, r = !1) => {
1422
+ if (e === !0)
1423
+ return t.output;
1424
+ const o = s || {}, n = o.contains ? "" : "^", i = o.contains ? "" : "$";
1425
+ let l = `${n}(?:${t.output})${i}`;
1426
+ t && t.negated === !0 && (l = `^(?!${l}).*$`);
1427
+ const h = I.toRegex(l, s);
1428
+ return r === !0 && (h.state = t), h;
1429
+ };
1430
+ I.makeRe = (t, s = {}, e = !1, r = !1) => {
1431
+ if (!t || typeof t != "string")
1432
+ throw new TypeError("Expected a non-empty string");
1433
+ let o = { negated: !1, fastpaths: !0 };
1434
+ return s.fastpaths !== !1 && (t[0] === "." || t[0] === "*") && (o.output = bt.fastpaths(t, s)), o.output || (o = bt(t, s)), I.compileRe(o, s, e, r);
1435
+ };
1436
+ I.toRegex = (t, s) => {
1437
+ try {
1438
+ const e = s || {};
1439
+ return new RegExp(t, e.flags || (e.nocase ? "i" : ""));
1440
+ } catch (e) {
1441
+ if (s && s.debug === !0) throw e;
1442
+ return /$^/;
1443
+ }
1444
+ };
1445
+ I.constants = en;
1446
+ var nn = I;
1447
+ const ee = nn, rn = it;
1448
+ function se(t, s, e = !1) {
1449
+ return s && (s.windows === null || s.windows === void 0) && (s = { ...s, windows: rn.isWindows() }), ee(t, s, e);
1450
+ }
1451
+ Object.assign(se, ee);
1452
+ var on = se;
1453
+ const ot = /* @__PURE__ */ Es(on), un = Array.isArray, ne = /\\/g, an = /^[A-Za-z]:$/, vt = process.platform === "win32", cn = /^(\/?\.\.)+$/;
1454
+ function ln(t, s = {}) {
1455
+ const e = t.length, r = Array(e), o = Array(e);
1456
+ let n, i;
1457
+ for (n = 0; n < e; n++) {
1458
+ const l = re(t[n]);
1459
+ r[n] = l;
1460
+ const h = l.length, g = Array(h);
1461
+ for (i = 0; i < h; i++) g[i] = ot(l[i], s);
1462
+ o[n] = g;
1463
+ }
1464
+ return (l) => {
1465
+ const h = l.split("/");
1466
+ if (h[0] === ".." && cn.test(l)) return !0;
1467
+ for (n = 0; n < e; n++) {
1468
+ const g = r[n], d = o[n], A = h.length, S = Math.min(A, g.length);
1469
+ for (i = 0; i < S; ) {
1470
+ const x = g[i];
1471
+ if (x.includes("/")) return !0;
1472
+ if (!d[i](h[i])) break;
1473
+ if (!s.noglobstar && x === "**") return !0;
1474
+ i++;
1475
+ }
1476
+ if (i === A) return !0;
1477
+ }
1478
+ return !1;
1479
+ };
1480
+ }
1481
+ const fn = /^[A-Z]:\/$/i, pn = vt ? (t) => fn.test(t) : (t) => t === "/";
1482
+ function It(t, s, e) {
1483
+ if (t === s || s.startsWith(`${t}/`)) {
1484
+ if (e) {
1485
+ const o = t.length + +!pn(t);
1486
+ return (n, i) => n.slice(o, i ? -1 : void 0) || ".";
1487
+ }
1488
+ const r = s.slice(t.length + 1);
1489
+ return r ? (o, n) => {
1490
+ if (o === ".") return r;
1491
+ const i = `${r}/${o}`;
1492
+ return n ? i.slice(0, -1) : i;
1493
+ } : (o, n) => n && o !== "." ? o.slice(0, -1) : o;
1494
+ }
1495
+ return e ? (r) => tt.relative(t, r) || "." : (r) => tt.relative(t, `${s}/${r}`) || ".";
1496
+ }
1497
+ function hn(t, s) {
1498
+ if (s.startsWith(`${t}/`)) {
1499
+ const e = s.slice(t.length + 1);
1500
+ return (r) => `${e}/${r}`;
1501
+ }
1502
+ return (e) => {
1503
+ const r = tt.relative(t, `${s}/${e}`);
1504
+ return e[e.length - 1] === "/" && r !== "" ? `${r}/` : r || ".";
1505
+ };
1506
+ }
1507
+ function Nt(t) {
1508
+ return t.replace(an, (s) => `${s}/`);
1509
+ }
1510
+ const gn = { parts: !0 };
1511
+ function re(t) {
1512
+ var s;
1513
+ const e = ot.scan(t, gn);
1514
+ return !((s = e.parts) === null || s === void 0) && s.length ? e.parts : [t];
1515
+ }
1516
+ const yn = /\\(?![()[\]{}!+@])/g;
1517
+ function dn(t) {
1518
+ return oe(t);
1519
+ }
1520
+ function An(t) {
1521
+ return ie(t).replace(yn, "/");
1522
+ }
1523
+ const Tn = vt ? An : dn, Rn = new RegExp("(?<!\\\\)([()[\\]{}*?|]|^!|[!+@](?=\\()|\\\\(?![()[\\]{}!*+?@|]))", "g"), _n = new RegExp("(?<!\\\\)([()[\\]{}]|^!|[!+@](?=\\())", "g"), oe = (t) => t.replace(Rn, "\\$&"), ie = (t) => t.replace(_n, "\\$&"), Sn = vt ? ie : oe;
1524
+ function En(t, s) {
1525
+ if ((s == null ? void 0 : s.caseSensitiveMatch) === !1) return !0;
1526
+ const e = ot.scan(t);
1527
+ return e.isGlob || e.negated;
1528
+ }
1529
+ function nt(...t) {
1530
+ console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...t);
1531
+ }
1532
+ function ue(t) {
1533
+ return typeof t == "string" ? [t] : t ?? [];
1534
+ }
1535
+ const bn = /^(\/?\.\.)+/, mn = /\\(?=[()[\]{}!*+?@|])/g;
1536
+ function _t(t, s, e, r) {
1537
+ var o;
1538
+ const n = s.cwd;
1539
+ let i = t;
1540
+ t[t.length - 1] === "/" && (i = t.slice(0, -1)), i[i.length - 1] !== "*" && s.expandDirectories && (i += "/**");
1541
+ const l = Sn(n);
1542
+ i = xe(i.replace(mn, "")) ? tt.relative(l, i) : tt.normalize(i);
1543
+ const h = (o = bn.exec(i)) === null || o === void 0 ? void 0 : o[0], g = re(i);
1544
+ if (h) {
1545
+ const A = (h.length + 1) / 3;
1546
+ let S = 0;
1547
+ const x = l.split("/");
1548
+ for (; S < A && g[S + A] === x[x.length + S - A]; )
1549
+ i = i.slice(0, (A - S - 1) * 3) + i.slice((A - S) * 3 + g[S + A].length + 1) || ".", S++;
1550
+ const y = tt.join(n, h.slice(S * 3));
1551
+ y[0] !== "." && e.root.length > y.length && (e.root = Nt(y), e.depthOffset = -A + S);
1552
+ }
1553
+ if (!r && e.depthOffset >= 0) {
1554
+ var d;
1555
+ (d = e.commonPath) !== null && d !== void 0 || (e.commonPath = g);
1556
+ const A = [], S = Math.min(e.commonPath.length, g.length);
1557
+ for (let x = 0; x < S; x++) {
1558
+ const y = g[x];
1559
+ if (y === "**" && !g[x + 1]) {
1560
+ A.pop();
1561
+ break;
1562
+ }
1563
+ if (x === g.length - 1 || y !== e.commonPath[x] || En(y)) break;
1564
+ A.push(y);
1565
+ }
1566
+ e.depthOffset = A.length, e.commonPath = A, e.root = Nt(A.length > 0 ? tt.join(n, ...A) : n);
1567
+ }
1568
+ return i;
1569
+ }
1570
+ function xn(t, s, e) {
1571
+ const r = [], o = [];
1572
+ for (const n of t.ignore)
1573
+ n && (n[0] !== "!" || n[1] === "(") && o.push(_t(n, t, e, !0));
1574
+ for (const n of s)
1575
+ n && (n[0] !== "!" || n[1] === "(" ? r.push(_t(n, t, e, !1)) : (n[1] !== "!" || n[2] === "(") && o.push(_t(n.slice(1), t, e, !0)));
1576
+ return {
1577
+ match: r,
1578
+ ignore: o
1579
+ };
1580
+ }
1581
+ function Cn(t, s) {
1582
+ const e = t.cwd, r = {
1583
+ root: e,
1584
+ depthOffset: 0
1585
+ }, o = xn(t, s, r);
1586
+ t.debug && nt("internal processing patterns:", o);
1587
+ const { absolute: n, caseSensitiveMatch: i, debug: l, dot: h, followSymbolicLinks: g, onlyDirectories: d } = t, A = r.root.replace(ne, ""), S = {
1588
+ dot: h,
1589
+ nobrace: t.braceExpansion === !1,
1590
+ nocase: !i,
1591
+ noextglob: t.extglob === !1,
1592
+ noglobstar: t.globstar === !1,
1593
+ posix: !0
1594
+ }, x = ot(o.match, S), y = ot(o.ignore, S), C = ln(o.match, S), T = It(e, A, n), G = n ? T : It(e, A, !0), _ = (P, O) => {
1595
+ const v = G(O, !0);
1596
+ return v !== "." && !C(v) || y(v);
1597
+ };
1598
+ let M;
1599
+ t.deep !== void 0 && (M = Math.round(t.deep - r.depthOffset));
1600
+ const X = new Ss({
1601
+ filters: [l ? (P, O) => {
1602
+ const v = T(P, O), R = x(v) && !y(v);
1603
+ return R && nt(`matched ${v}`), R;
1604
+ } : (P, O) => {
1605
+ const v = T(P, O);
1606
+ return x(v) && !y(v);
1607
+ }],
1608
+ exclude: l ? (P, O) => {
1609
+ const v = _(P, O);
1610
+ return nt(`${v ? "skipped" : "crawling"} ${O}`), v;
1611
+ } : _,
1612
+ fs: t.fs,
1613
+ pathSeparator: "/",
1614
+ relativePaths: !n,
1615
+ resolvePaths: n,
1616
+ includeBasePath: n,
1617
+ resolveSymlinks: g,
1618
+ excludeSymlinks: !g,
1619
+ excludeFiles: d,
1620
+ includeDirs: d || !t.onlyFiles,
1621
+ maxDepth: M,
1622
+ signal: t.signal
1623
+ }).crawl(A);
1624
+ return t.debug && nt("internal properties:", {
1625
+ ...r,
1626
+ root: A
1627
+ }), [X, e !== A && !n && hn(e, A)];
1628
+ }
1629
+ function ae(t, s) {
1630
+ if (s) for (let e = t.length - 1; e >= 0; e--) t[e] = s(t[e]);
1631
+ return t;
1632
+ }
1633
+ const Bt = {
1634
+ caseSensitiveMatch: !0,
1635
+ debug: !!process.env.TINYGLOBBY_DEBUG,
1636
+ expandDirectories: !0,
1637
+ followSymbolicLinks: !0,
1638
+ onlyFiles: !0
1639
+ };
1640
+ function $n(t) {
1641
+ const s = Object.assign({}, t);
1642
+ for (const e in Bt) s[e] === void 0 && Object.assign(s, { [e]: Bt[e] });
1643
+ return s.cwd = (s.cwd instanceof URL ? Ce(s.cwd) : Mt(s.cwd || process.cwd())).replace(ne, "/"), s.ignore = ue(s.ignore), s.fs && (s.fs = {
1644
+ readdir: s.fs.readdir || Se,
1645
+ readdirSync: s.fs.readdirSync || _e,
1646
+ realpath: s.fs.realpath || Re,
1647
+ realpathSync: s.fs.realpathSync || Ae,
1648
+ stat: s.fs.stat || de,
1649
+ statSync: s.fs.statSync || ye
1650
+ }), s.debug && nt("globbing with options:", s), s;
1651
+ }
1652
+ function ce(t, s = {}) {
1653
+ var e;
1654
+ if (t && (s != null && s.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
1655
+ const r = un(t) || typeof t == "string", o = ue((e = r ? t : t.patterns) !== null && e !== void 0 ? e : "**/*"), n = $n(r ? s : t);
1656
+ return o.length > 0 ? Cn(n, o) : [];
1657
+ }
1658
+ async function kn(t, s) {
1659
+ const [e, r] = ce(t, s);
1660
+ return e ? ae(await e.withPromise(), r) : [];
1661
+ }
1662
+ function Pn(t, s) {
1663
+ const [e, r] = ce(t, s);
1664
+ return e ? ae(e.sync(), r) : [];
1665
+ }
1666
+ export {
1667
+ Tn as convertPathToPattern,
1668
+ Sn as escapePath,
1669
+ kn as glob,
1670
+ Pn as globSync,
1671
+ En as isDynamicPattern
1672
+ };