ccusage 15.9.2 → 15.9.3

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.
@@ -1,81 +1,42 @@
1
- import { CLAUDE_CONFIG_DIR_ENV, CLAUDE_PROJECTS_DIR_NAME, DEFAULT_CLAUDE_CODE_PATH, DEFAULT_CLAUDE_CONFIG_PATH, DEFAULT_RECENT_DAYS, PricingFetcher, USAGE_DATA_GLOB_PATTERN, USER_HOME_DIR, __commonJSMin, __require, __toESM, isFailure, isPromise, require_usingCtx } from "./pricing-fetcher-DXFi0Cxk.js";
1
+ import { CLAUDE_CONFIG_DIR_ENV, CLAUDE_PROJECTS_DIR_NAME, DEFAULT_CLAUDE_CODE_PATH, DEFAULT_CLAUDE_CONFIG_PATH, DEFAULT_RECENT_DAYS, PricingFetcher, USAGE_DATA_GLOB_PATTERN, USER_HOME_DIR, __commonJSMin, __require, __toESM, isFailure, isPromise, require_usingCtx } from "./pricing-fetcher-ZrH9X6Xp.js";
2
2
  import { getTotalTokens } from "./_token-utils-WjkbrjKv.js";
3
- import { activityDateSchema, arrayType, booleanType, createBucket, createDailyDate, createMonthlyDate, createProjectPath, createSessionId, createWeeklyDate, dailyDateSchema, isoTimestampSchema, messageIdSchema, modelNameSchema, monthlyDateSchema, numberType, objectType, projectPathSchema, requestIdSchema, sessionIdSchema, stringType, unionType, versionSchema, weeklyDateSchema } from "./_types-B-1t4mxD.js";
4
- import { logger } from "./logger-BrRa0CCy.js";
3
+ import { activityDateSchema, arrayType, booleanType, createBucket, createDailyDate, createMonthlyDate, createProjectPath, createSessionId, createWeeklyDate, dailyDateSchema, isoTimestampSchema, messageIdSchema, modelNameSchema, monthlyDateSchema, numberType, objectType, projectPathSchema, requestIdSchema, sessionIdSchema, stringType, unionType, versionSchema, weeklyDateSchema } from "./_types-C0oFKDO-.js";
4
+ import { logger } from "./logger-L_zzb0iT.js";
5
5
  import a, { readFile } from "node:fs/promises";
6
6
  import path, { posix } from "node:path";
7
7
  import process$1 from "node:process";
8
8
  import b from "node:fs";
9
9
  import F from "node:os";
10
10
  function toArray(array) {
11
- array = array ?? [];
12
- return Array.isArray(array) ? array : [array];
11
+ return array = array ?? [], Array.isArray(array) ? array : [array];
13
12
  }
14
13
  const VOID = Symbol("p-void");
15
- /**
16
- * Return `true` if the type of `x` is `string`.
17
- *
18
- * ```ts
19
- * import { is } from "@core/unknownutil";
20
- *
21
- * const a: unknown = "a";
22
- * if (is.String(a)) {
23
- * const _: string = a;
24
- * }
25
- * ```
26
- */ function isString(x) {
14
+ function isString(x) {
27
15
  return typeof x === "string";
28
16
  }
29
- /**
30
- * Return `true` if the type of `x` satisfies `Record<PropertyKey, unknown>`.
31
- *
32
- * Note that this function returns `true` for ambiguous instances like `Set`, `Map`, `Date`, `Promise`, etc.
33
- * Use {@linkcode [is/record-object].isRecordObject|isRecordObject} instead if you want to check if `x` is an instance of `Object`.
34
- *
35
- * ```ts
36
- * import { is } from "@core/unknownutil";
37
- *
38
- * const a: unknown = {"a": 0, "b": 1};
39
- * if (is.Record(a)) {
40
- * const _: Record<PropertyKey, unknown> = a;
41
- * }
42
- *
43
- * const b: unknown = new Set();
44
- * if (is.Record(b)) {
45
- * const _: Record<PropertyKey, unknown> = b;
46
- * }
47
- * ```
48
- */ function isRecord(x) {
17
+ function isRecord(x) {
49
18
  return x != null && !Array.isArray(x) && typeof x === "object";
50
19
  }
51
20
  const defaultThreshold = 20;
52
- /**
53
- * Inspect a value
54
- */ function inspect(value, options = {}) {
21
+ function inspect(value, options = {}) {
55
22
  if (value === null) return "null";
56
- else if (Array.isArray(value)) return inspectArray(value, options);
23
+ if (Array.isArray(value)) return inspectArray(value, options);
57
24
  switch (typeof value) {
58
25
  case "string": return JSON.stringify(value);
59
26
  case "bigint": return `${value}n`;
60
- case "object":
61
- if (value.constructor?.name !== "Object") return value.constructor?.name;
62
- return inspectRecord(value, options);
27
+ case "object": return value.constructor?.name === "Object" ? inspectRecord(value, options) : value.constructor?.name;
63
28
  case "function": return value.name || "(anonymous)";
64
29
  }
65
30
  return value?.toString() ?? "undefined";
66
31
  }
67
32
  function inspectArray(value, options) {
68
- const { threshold = defaultThreshold } = options;
69
- const vs = value.map((v$1) => inspect(v$1, options));
70
- const s = vs.join(", ");
33
+ const { threshold = defaultThreshold } = options, vs = value.map((v$1) => inspect(v$1, options)), s = vs.join(", ");
71
34
  if (s.length <= threshold) return `[${s}]`;
72
35
  const m$1 = vs.join(",\n");
73
36
  return `[\n${indent(2, m$1)}\n]`;
74
37
  }
75
38
  function inspectRecord(value, options) {
76
- const { threshold = defaultThreshold } = options;
77
- const vs = [...Object.keys(value), ...Object.getOwnPropertySymbols(value)].map((k$1) => `${k$1.toString()}: ${inspect(value[k$1], options)}`);
78
- const s = vs.join(", ");
39
+ const { threshold = defaultThreshold } = options, vs = [...Object.keys(value), ...Object.getOwnPropertySymbols(value)].map((k$1) => `${k$1.toString()}: ${inspect(value[k$1], options)}`), s = vs.join(", ");
79
40
  if (s.length <= threshold) return `{${s}}`;
80
41
  const m$1 = vs.join(",\n");
81
42
  return `{\n${indent(2, m$1)}\n}`;
@@ -84,14 +45,10 @@ function indent(level, text) {
84
45
  const prefix = " ".repeat(level);
85
46
  return text.split("\n").map((line) => `${prefix}${line}`).join("\n");
86
47
  }
87
- /**
88
- * Rewrite the function name.
89
- */ function rewriteName(fn, name, ...args) {
48
+ function rewriteName(fn, name, ...args) {
90
49
  let cachedName;
91
50
  return Object.defineProperties(fn, { name: { get: () => {
92
- if (cachedName) return cachedName;
93
- cachedName = `${name}(${args.map((v$1) => inspect(v$1)).join(", ")})`;
94
- return cachedName;
51
+ return cachedName || (cachedName = `${name}(${args.map((v$1) => inspect(v$1)).join(", ")})`, cachedName);
95
52
  } } });
96
53
  }
97
54
  function annotate(fn, name, value) {
@@ -100,155 +57,39 @@ function annotate(fn, name, value) {
100
57
  function hasAnnotation(fn, name) {
101
58
  return !!fn[name];
102
59
  }
103
- /**
104
- * Return a type predicate function that returns `true` if the type of `x` is `ObjectOf<T>`.
105
- *
106
- * Use {@linkcode [is/record-of].isRecordOf|isRecordOf} if you want to check if the type of `x` is a record of `T`.
107
- *
108
- * If {@linkcode [as/optional].asOptional|asOptional} is specified in the predicate function in `predObj`, the property becomes optional.
109
- * If {@linkcode [as/readonly].asReadonly|asReadonly} is specified in the predicate function in `predObj`, the property becomes readonly.
110
- *
111
- * The number of keys of `x` must be greater than or equal to the number of keys of `predObj`.
112
- * Use {@linkcode [is/strict-of].isStrictOf|isStrictOf} if you want to check the exact number of keys.
113
- *
114
- * To enhance performance, users are advised to cache the return value of this function and mitigate the creation cost.
115
- *
116
- * ```ts
117
- * import { as, is } from "@core/unknownutil";
118
- *
119
- * const isMyType = is.ObjectOf({
120
- * a: is.Number,
121
- * b: is.String,
122
- * c: as.Optional(is.Boolean),
123
- * d: as.Readonly(is.String),
124
- * });
125
- * const a: unknown = { a: 0, b: "a", d: "d" };
126
- * if (isMyType(a)) {
127
- * const _: { a: number; b: string; c?: boolean | undefined, readonly d: string } = a;
128
- * }
129
- * ```
130
- */ function isObjectOf(predObj) {
131
- const preds = [...Object.keys(predObj), ...Object.getOwnPropertySymbols(predObj)].map((k$1) => [k$1, predObj[k$1]]);
132
- const pred = rewriteName((x) => {
133
- if (!isObject$1(x)) return false;
134
- return preds.every(([k$1, pred$1]) => pred$1(x[k$1]));
60
+ function isObjectOf(predObj) {
61
+ const preds = [...Object.keys(predObj), ...Object.getOwnPropertySymbols(predObj)].map((k$1) => [k$1, predObj[k$1]]), pred = rewriteName((x) => {
62
+ return isObject$1(x) ? preds.every(([k$1, pred$1]) => pred$1(x[k$1])) : false;
135
63
  }, "isObjectOf", predObj);
136
64
  return annotate(pred, "predObj", predObj);
137
65
  }
138
66
  function isObject$1(x) {
139
- if (x == null) return false;
140
- if (typeof x !== "object" && typeof x !== "function") return false;
141
- if (Array.isArray(x)) return false;
142
- return true;
67
+ return !(x == null || typeof x !== "object" && typeof x !== "function" || Array.isArray(x));
143
68
  }
144
- /**
145
- * Annotate the given predicate function as optional.
146
- *
147
- * Use this function to annotate a predicate function of `predObj` in {@linkcode [is/object-of].isObjectOf|isObjectOf}.
148
- *
149
- * Note that the annotated predicate function will return `true` if the type of `x` is `T` or `undefined`, indicating that
150
- * this function is not just for annotation but it also changes the behavior of the predicate function.
151
- *
152
- * Use {@linkcode asUnoptional} to remove the annotation.
153
- * Use {@linkcode hasOptional} to check if a predicate function has annotated with this function.
154
- *
155
- * To enhance performance, users are advised to cache the return value of this function and mitigate the creation cost.
156
- *
157
- * ```ts
158
- * import { as, is } from "@core/unknownutil";
159
- *
160
- * const isMyType = is.ObjectOf({
161
- * foo: as.Optional(is.String),
162
- * });
163
- * const a: unknown = {};
164
- * if (isMyType(a)) {
165
- * const _: {foo?: string} = a;
166
- * }
167
- * ```
168
- */ function asOptional(pred) {
169
- if (hasAnnotation(pred, "optional")) return pred;
170
- return rewriteName(annotate((x) => x === void 0 || pred(x), "optional", pred), "asOptional", pred);
69
+ function asOptional(pred) {
70
+ return hasAnnotation(pred, "optional") ? pred : rewriteName(annotate((x) => x === void 0 || pred(x), "optional", pred), "asOptional", pred);
171
71
  }
172
- /**
173
- * Check if a value is an error object
174
- */ const isErrorObject = isObjectOf({
72
+ const isErrorObject = isObjectOf({
175
73
  proto: isString,
176
74
  name: isString,
177
75
  message: isString,
178
76
  stack: asOptional(isString),
179
77
  attributes: isRecord
180
78
  });
181
- /**
182
- * Error indicating that this part is unreachable.
183
- */ var UnreachableError = class UnreachableError extends Error {
79
+ var UnreachableError = class UnreachableError extends Error {
184
80
  args;
185
81
  constructor(args) {
186
- super(`unreachable: ${args}`);
187
- if (Error.captureStackTrace) Error.captureStackTrace(this, UnreachableError);
188
- this.name = this.constructor.name;
189
- this.args = args;
82
+ if (super(`unreachable: ${args}`), Error.captureStackTrace) Error.captureStackTrace(this, UnreachableError);
83
+ this.name = this.constructor.name, this.args = args;
190
84
  }
191
85
  };
192
- /**
193
- * Function indicating that this part is unreachable.
194
- *
195
- * For example, the following code passed type checking.
196
- *
197
- * ```ts
198
- * import { unreachable } from "@core/errorutil/unreachable";
199
- *
200
- * type Animal = "dog" | "cat";
201
- *
202
- * function say(animal: Animal): void {
203
- * switch (animal) {
204
- * case "dog":
205
- * console.log("dog");
206
- * break;
207
- * case "cat":
208
- * console.log("dog");
209
- * break;
210
- * default:
211
- * unreachable(animal);
212
- * }
213
- * }
214
- * say("dog");
215
- * ```
216
- *
217
- * But the following code because a case for "bird" is missing.
218
- *
219
- * ```ts
220
- * import { unreachable } from "@core/errorutil/unreachable";
221
- *
222
- * type Animal = "dog" | "cat" | "bird";
223
- *
224
- * function say(animal: Animal): void {
225
- * switch (animal) {
226
- * case "dog":
227
- * console.log("dog");
228
- * break;
229
- * case "cat":
230
- * console.log("dog");
231
- * break;
232
- * default: {
233
- * // The line below causes a type error if we uncomment it.
234
- * // error: TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type 'never'.
235
- * //unreachable(animal);
236
- * }
237
- * }
238
- * }
239
- * say("dog");
240
- * ```
241
- */ function unreachable(...args) {
86
+ function unreachable(...args) {
242
87
  throw new UnreachableError(args);
243
88
  }
244
- const isResult = (result) => "object" == typeof result && null !== result && "type" in result && ("Success" === result.type && "value" in result || "Failure" === result.type && "error" in result);
245
- const unwrap = (...args) => {
89
+ const isResult = (result) => "object" == typeof result && null !== result && "type" in result && ("Success" === result.type && "value" in result || "Failure" === result.type && "error" in result), unwrap = (...args) => {
246
90
  const firstArgument = args[0];
247
91
  if (isResult(firstArgument) || isPromise(firstArgument)) {
248
- const result = firstArgument;
249
- const hasDefault$1 = 2 === args.length;
250
- const defaultValue$1 = hasDefault$1 ? args[1] : void 0;
251
- const apply = (r) => {
92
+ const result = firstArgument, hasDefault$1 = 2 === args.length, defaultValue$1 = hasDefault$1 ? args[1] : void 0, apply = (r) => {
252
93
  if (isFailure(r)) {
253
94
  if (hasDefault$1) return defaultValue$1;
254
95
  throw r.error;
@@ -257,8 +98,7 @@ const unwrap = (...args) => {
257
98
  };
258
99
  return isPromise(result) ? result.then(apply) : apply(result);
259
100
  }
260
- const hasDefault = 1 === args.length;
261
- const defaultValue = hasDefault ? args[0] : void 0;
101
+ const hasDefault = 1 === args.length, defaultValue = hasDefault ? args[0] : void 0;
262
102
  return (result) => {
263
103
  const apply = (r) => {
264
104
  if (isFailure(r)) {
@@ -273,8 +113,7 @@ const unwrap = (...args) => {
273
113
  function groupBy(arr, getKeyFromItem) {
274
114
  const result = {};
275
115
  for (let i = 0; i < arr.length; i++) {
276
- const item = arr[i];
277
- const key = getKeyFromItem(item);
116
+ const item = arr[i], key = getKeyFromItem(item);
278
117
  if (!Object.hasOwn(result, key)) result[key] = [];
279
118
  result[key].push(item);
280
119
  }
@@ -287,52 +126,37 @@ var castComparer = function(comparer) {
287
126
  return function(a$1, b$1, order) {
288
127
  return comparer(a$1, b$1, order) * order;
289
128
  };
290
- };
291
- var throwInvalidConfigErrorIfTrue = function(condition, context) {
129
+ }, throwInvalidConfigErrorIfTrue = function(condition, context) {
292
130
  if (condition) throw Error("Invalid sort config: " + context);
293
- };
294
- var unpackObjectSorter = function(sortByObj) {
295
- var _a = sortByObj || {}, asc = _a.asc, desc = _a.desc;
296
- var order = asc ? 1 : -1;
297
- var sortBy = asc || desc;
298
- throwInvalidConfigErrorIfTrue(!sortBy, "Expected `asc` or `desc` property");
299
- throwInvalidConfigErrorIfTrue(asc && desc, "Ambiguous object with `asc` and `desc` config properties");
131
+ }, unpackObjectSorter = function(sortByObj) {
132
+ var _a = sortByObj || {}, asc = _a.asc, desc = _a.desc, order = asc ? 1 : -1, sortBy = asc || desc;
133
+ throwInvalidConfigErrorIfTrue(!sortBy, "Expected `asc` or `desc` property"), throwInvalidConfigErrorIfTrue(asc && desc, "Ambiguous object with `asc` and `desc` config properties");
300
134
  var comparer = sortByObj.comparer && castComparer(sortByObj.comparer);
301
135
  return {
302
136
  order,
303
137
  sortBy,
304
138
  comparer
305
139
  };
306
- };
307
- var multiPropertySorterProvider = function(defaultComparer$1) {
140
+ }, multiPropertySorterProvider = function(defaultComparer$1) {
308
141
  return function multiPropertySorter(sortBy, sortByArr, depth$1, order, comparer, a$1, b$1) {
309
- var valA;
310
- var valB;
311
- if (typeof sortBy === "string") {
312
- valA = a$1[sortBy];
313
- valB = b$1[sortBy];
314
- } else if (typeof sortBy === "function") {
315
- valA = sortBy(a$1);
316
- valB = sortBy(b$1);
317
- } else {
142
+ var valA, valB;
143
+ if (typeof sortBy === "string") valA = a$1[sortBy], valB = b$1[sortBy];
144
+ else if (typeof sortBy === "function") valA = sortBy(a$1), valB = sortBy(b$1);
145
+ else {
318
146
  var objectSorterConfig = unpackObjectSorter(sortBy);
319
147
  return multiPropertySorter(objectSorterConfig.sortBy, sortByArr, depth$1, objectSorterConfig.order, objectSorterConfig.comparer || defaultComparer$1, a$1, b$1);
320
148
  }
321
149
  var equality = comparer(valA, valB, order);
322
- if ((equality === 0 || valA == null && valB == null) && sortByArr.length > depth$1) return multiPropertySorter(sortByArr[depth$1], sortByArr, depth$1 + 1, order, comparer, a$1, b$1);
323
- return equality;
150
+ return (equality === 0 || valA == null && valB == null) && sortByArr.length > depth$1 ? multiPropertySorter(sortByArr[depth$1], sortByArr, depth$1 + 1, order, comparer, a$1, b$1) : equality;
324
151
  };
325
152
  };
326
153
  function getSortStrategy(sortBy, comparer, order) {
327
154
  if (sortBy === void 0 || sortBy === true) return function(a$1, b$1) {
328
155
  return comparer(a$1, b$1, order);
329
156
  };
330
- if (typeof sortBy === "string") {
331
- throwInvalidConfigErrorIfTrue(sortBy.includes("."), "String syntax not allowed for nested properties.");
332
- return function(a$1, b$1) {
333
- return comparer(a$1[sortBy], b$1[sortBy], order);
334
- };
335
- }
157
+ if (typeof sortBy === "string") return throwInvalidConfigErrorIfTrue(sortBy.includes("."), "String syntax not allowed for nested properties."), function(a$1, b$1) {
158
+ return comparer(a$1[sortBy], b$1[sortBy], order);
159
+ };
336
160
  if (typeof sortBy === "function") return function(a$1, b$1) {
337
161
  return comparer(sortBy(a$1), sortBy(b$1), order);
338
162
  };
@@ -369,20 +193,11 @@ function createNewSortInstance(opts) {
369
193
  };
370
194
  }
371
195
  var defaultComparer = function(a$1, b$1, order) {
372
- if (a$1 == null) return order;
373
- if (b$1 == null) return -order;
374
- if (typeof a$1 !== typeof b$1) return typeof a$1 < typeof b$1 ? -1 : 1;
375
- if (a$1 < b$1) return -1;
376
- if (a$1 > b$1) return 1;
377
- return 0;
378
- };
379
- var sort = createNewSortInstance({ comparer: defaultComparer });
380
- var inPlaceSort = createNewSortInstance({
196
+ return a$1 == null ? order : b$1 == null ? -order : typeof a$1 === typeof b$1 ? a$1 < b$1 ? -1 : a$1 > b$1 ? 1 : 0 : typeof a$1 < typeof b$1 ? -1 : 1;
197
+ }, sort = createNewSortInstance({ comparer: defaultComparer }), inPlaceSort = createNewSortInstance({
381
198
  comparer: defaultComparer,
382
199
  inPlaceSorting: true
383
- });
384
- var d = Object.defineProperty;
385
- var n = (s, t) => d(s, "name", {
200
+ }), d = Object.defineProperty, n = (s, t) => d(s, "name", {
386
201
  value: t,
387
202
  configurable: !0
388
203
  });
@@ -442,13 +257,11 @@ var u = class {
442
257
  constructor(t) {
443
258
  this.path = t;
444
259
  }
445
- };
446
- var f = class extends u {
260
+ }, f = class extends u {
447
261
  static {
448
262
  n(this, "Directory");
449
263
  }
450
- };
451
- var y = class extends u {
264
+ }, y = class extends u {
452
265
  static {
453
266
  n(this, "File");
454
267
  }
@@ -456,8 +269,7 @@ var y = class extends u {
456
269
  constructor(t, r) {
457
270
  super(t), this.content = r;
458
271
  }
459
- };
460
- var l = class {
272
+ }, l = class {
461
273
  static {
462
274
  n(this, "Symlink");
463
275
  }
@@ -523,15 +335,9 @@ function isTypeSync(fsStatType, statsMethodName, filePath) {
523
335
  throw error;
524
336
  }
525
337
  }
526
- const isFile = isType.bind(void 0, "stat", "isFile");
527
- const isDirectory = isType.bind(void 0, "stat", "isDirectory");
528
- const isSymlink = isType.bind(void 0, "lstat", "isSymbolicLink");
529
- const isFileSync = isTypeSync.bind(void 0, "statSync", "isFile");
530
- const isDirectorySync = isTypeSync.bind(void 0, "statSync", "isDirectory");
531
- const isSymlinkSync = isTypeSync.bind(void 0, "lstatSync", "isSymbolicLink");
532
- var require_utils$1 = __commonJSMin((exports) => {
533
- Object.defineProperty(exports, "__esModule", { value: true });
534
- exports.normalizePath = exports.isRootDirectory = exports.convertSlashes = exports.cleanPath = void 0;
338
+ const isFile = isType.bind(void 0, "stat", "isFile"), isDirectory = isType.bind(void 0, "stat", "isDirectory"), isSymlink = isType.bind(void 0, "lstat", "isSymbolicLink"), isFileSync = isTypeSync.bind(void 0, "statSync", "isFile"), isDirectorySync = isTypeSync.bind(void 0, "statSync", "isDirectory"), isSymlinkSync = isTypeSync.bind(void 0, "lstatSync", "isSymbolicLink");
339
+ var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
340
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.normalizePath = exports.isRootDirectory = exports.convertSlashes = exports.cleanPath = void 0;
535
341
  const path_1$4 = __require("node:path");
536
342
  function cleanPath(path$1) {
537
343
  let normalized = (0, path_1$4.normalize)(path$1);
@@ -550,8 +356,7 @@ var require_utils$1 = __commonJSMin((exports) => {
550
356
  }
551
357
  exports.isRootDirectory = isRootDirectory;
552
358
  function normalizePath(path$1, options) {
553
- const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
554
- const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
359
+ const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options, pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
555
360
  if (resolvePaths) path$1 = (0, path_1$4.resolve)(path$1);
556
361
  if (normalizePath$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
557
362
  if (path$1 === ".") return "";
@@ -559,12 +364,9 @@ var require_utils$1 = __commonJSMin((exports) => {
559
364
  return convertSlashes(needsSeperator ? path$1 + pathSeparator : path$1, pathSeparator);
560
365
  }
561
366
  exports.normalizePath = normalizePath;
562
- });
563
- var require_join_path = __commonJSMin((exports) => {
564
- Object.defineProperty(exports, "__esModule", { value: true });
565
- exports.build = exports.joinDirectoryPath = exports.joinPathWithBasePath = void 0;
566
- const path_1$3 = __require("node:path");
567
- const utils_1$1 = require_utils$1();
367
+ })), require_join_path = /* @__PURE__ */ __commonJSMin(((exports) => {
368
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.build = exports.joinDirectoryPath = exports.joinPathWithBasePath = void 0;
369
+ const path_1$3 = __require("node:path"), utils_1$1 = require_utils$1();
568
370
  function joinPathWithBasePath(filename, directoryPath) {
569
371
  return directoryPath + filename;
570
372
  }
@@ -572,8 +374,7 @@ var require_join_path = __commonJSMin((exports) => {
572
374
  function joinPathWithRelativePath(root, options) {
573
375
  return function(filename, directoryPath) {
574
376
  const sameRoot = directoryPath.startsWith(root);
575
- if (sameRoot) return directoryPath.replace(root, "") + filename;
576
- else return (0, utils_1$1.convertSlashes)((0, path_1$3.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
377
+ return sameRoot ? directoryPath.replace(root, "") + filename : (0, utils_1$1.convertSlashes)((0, path_1$3.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
577
378
  };
578
379
  }
579
380
  function joinPath$1(filename) {
@@ -588,10 +389,8 @@ var require_join_path = __commonJSMin((exports) => {
588
389
  return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath$1;
589
390
  }
590
391
  exports.build = build$7;
591
- });
592
- var require_push_directory = __commonJSMin((exports) => {
593
- Object.defineProperty(exports, "__esModule", { value: true });
594
- exports.build = void 0;
392
+ })), require_push_directory = /* @__PURE__ */ __commonJSMin(((exports) => {
393
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.build = void 0;
595
394
  function pushDirectoryWithRelativePath(root) {
596
395
  return function(directoryPath, paths) {
597
396
  paths.push(directoryPath.substring(root.length) || ".");
@@ -605,102 +404,75 @@ var require_push_directory = __commonJSMin((exports) => {
605
404
  }
606
405
  const pushDirectory$1 = (directoryPath, paths) => {
607
406
  paths.push(directoryPath || ".");
608
- };
609
- const pushDirectoryFilter = (directoryPath, paths, filters) => {
407
+ }, pushDirectoryFilter = (directoryPath, paths, filters) => {
610
408
  const path$1 = directoryPath || ".";
611
409
  if (filters.every((filter) => filter(path$1, true))) paths.push(path$1);
612
- };
613
- const empty$2 = () => {};
410
+ }, empty$2 = () => {};
614
411
  function build$6(root, options) {
615
412
  const { includeDirs, filters, relativePaths } = options;
616
- if (!includeDirs) return empty$2;
617
- if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
618
- return filters && filters.length ? pushDirectoryFilter : pushDirectory$1;
413
+ return includeDirs ? relativePaths ? filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root) : filters && filters.length ? pushDirectoryFilter : pushDirectory$1 : empty$2;
619
414
  }
620
415
  exports.build = build$6;
621
- });
622
- var require_push_file = __commonJSMin((exports) => {
623
- Object.defineProperty(exports, "__esModule", { value: true });
624
- exports.build = void 0;
416
+ })), require_push_file = /* @__PURE__ */ __commonJSMin(((exports) => {
417
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.build = void 0;
625
418
  const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
626
419
  if (filters.every((filter) => filter(filename, false))) counts.files++;
627
- };
628
- const pushFileFilter = (filename, paths, _counts, filters) => {
420
+ }, pushFileFilter = (filename, paths, _counts, filters) => {
629
421
  if (filters.every((filter) => filter(filename, false))) paths.push(filename);
630
- };
631
- const pushFileCount = (_filename, _paths, counts, _filters) => {
422
+ }, pushFileCount = (_filename, _paths, counts, _filters) => {
632
423
  counts.files++;
633
- };
634
- const pushFile$1 = (filename, paths) => {
424
+ }, pushFile$1 = (filename, paths) => {
635
425
  paths.push(filename);
636
- };
637
- const empty$1 = () => {};
426
+ }, empty$1 = () => {};
638
427
  function build$5(options) {
639
428
  const { excludeFiles, filters, onlyCounts } = options;
640
- if (excludeFiles) return empty$1;
641
- if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
642
- else if (onlyCounts) return pushFileCount;
643
- else return pushFile$1;
429
+ return excludeFiles ? empty$1 : filters && filters.length ? onlyCounts ? pushFileFilterAndCount : pushFileFilter : onlyCounts ? pushFileCount : pushFile$1;
644
430
  }
645
431
  exports.build = build$5;
646
- });
647
- var require_get_array = __commonJSMin((exports) => {
648
- Object.defineProperty(exports, "__esModule", { value: true });
649
- exports.build = void 0;
432
+ })), require_get_array = /* @__PURE__ */ __commonJSMin(((exports) => {
433
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.build = void 0;
650
434
  const getArray$1 = (paths) => {
651
435
  return paths;
652
- };
653
- const getArrayGroup = () => {
436
+ }, getArrayGroup = () => {
654
437
  return [""].slice(0, 0);
655
438
  };
656
439
  function build$4(options) {
657
440
  return options.group ? getArrayGroup : getArray$1;
658
441
  }
659
442
  exports.build = build$4;
660
- });
661
- var require_group_files = __commonJSMin((exports) => {
662
- Object.defineProperty(exports, "__esModule", { value: true });
663
- exports.build = void 0;
443
+ })), require_group_files = /* @__PURE__ */ __commonJSMin(((exports) => {
444
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.build = void 0;
664
445
  const groupFiles$1 = (groups, directory, files) => {
665
446
  groups.push({
666
447
  directory,
667
448
  files,
668
449
  dir: directory
669
450
  });
670
- };
671
- const empty = () => {};
451
+ }, empty = () => {};
672
452
  function build$3(options) {
673
453
  return options.group ? groupFiles$1 : empty;
674
454
  }
675
455
  exports.build = build$3;
676
- });
677
- var require_resolve_symlink = __commonJSMin((exports) => {
678
- var __importDefault$1 = function(mod) {
456
+ })), require_resolve_symlink = /* @__PURE__ */ __commonJSMin(((exports) => {
457
+ var __importDefault$1 = exports && exports.__importDefault || function(mod) {
679
458
  return mod && mod.__esModule ? mod : { "default": mod };
680
459
  };
681
- Object.defineProperty(exports, "__esModule", { value: true });
682
- exports.build = void 0;
683
- const fs_1$1 = __importDefault$1(__require("node:fs"));
684
- const path_1$2 = __require("node:path");
685
- const resolveSymlinksAsync = function(path$1, state, callback$1) {
460
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.build = void 0;
461
+ const fs_1$1 = __importDefault$1(__require("node:fs")), path_1$2 = __require("node:path"), resolveSymlinksAsync = function(path$1, state, callback$1) {
686
462
  const { queue, options: { suppressErrors } } = state;
687
- queue.enqueue();
688
- fs_1$1.default.realpath(path$1, (error, resolvedPath) => {
463
+ queue.enqueue(), fs_1$1.default.realpath(path$1, (error, resolvedPath) => {
689
464
  if (error) return queue.dequeue(suppressErrors ? null : error, state);
690
465
  fs_1$1.default.stat(resolvedPath, (error$1, stat) => {
691
466
  if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
692
467
  if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state);
693
- callback$1(stat, resolvedPath);
694
- queue.dequeue(null, state);
468
+ callback$1(stat, resolvedPath), queue.dequeue(null, state);
695
469
  });
696
470
  });
697
- };
698
- const resolveSymlinks = function(path$1, state, callback$1) {
471
+ }, resolveSymlinks = function(path$1, state, callback$1) {
699
472
  const { queue, options: { suppressErrors } } = state;
700
473
  queue.enqueue();
701
474
  try {
702
- const resolvedPath = fs_1$1.default.realpathSync(path$1);
703
- const stat = fs_1$1.default.statSync(resolvedPath);
475
+ const resolvedPath = fs_1$1.default.realpathSync(path$1), stat = fs_1$1.default.statSync(resolvedPath);
704
476
  if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return;
705
477
  callback$1(stat, resolvedPath);
706
478
  } catch (e) {
@@ -708,57 +480,40 @@ var require_resolve_symlink = __commonJSMin((exports) => {
708
480
  }
709
481
  };
710
482
  function build$2(options, isSynchronous) {
711
- if (!options.resolveSymlinks || options.excludeSymlinks) return null;
712
- return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
483
+ return !options.resolveSymlinks || options.excludeSymlinks ? null : isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
713
484
  }
714
485
  exports.build = build$2;
715
486
  function isRecursive(path$1, resolved, state) {
716
487
  if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
717
- let parent = (0, path_1$2.dirname)(path$1);
718
- let depth$1 = 1;
488
+ let parent = (0, path_1$2.dirname)(path$1), depth$1 = 1;
719
489
  while (parent !== state.root && depth$1 < 2) {
720
- const resolvedPath = state.symlinks.get(parent);
721
- const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));
490
+ const resolvedPath = state.symlinks.get(parent), isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));
722
491
  if (isSameRoot) depth$1++;
723
492
  else parent = (0, path_1$2.dirname)(parent);
724
493
  }
725
- state.symlinks.set(path$1, resolved);
726
- return depth$1 > 1;
494
+ return state.symlinks.set(path$1, resolved), depth$1 > 1;
727
495
  }
728
496
  function isRecursiveUsingRealPaths(resolved, state) {
729
497
  return state.visited.includes(resolved + state.options.pathSeparator);
730
498
  }
731
- });
732
- var require_invoke_callback = __commonJSMin((exports) => {
733
- Object.defineProperty(exports, "__esModule", { value: true });
734
- exports.build = void 0;
499
+ })), require_invoke_callback = /* @__PURE__ */ __commonJSMin(((exports) => {
500
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.build = void 0;
735
501
  const onlyCountsSync = (state) => {
736
502
  return state.counts;
737
- };
738
- const groupsSync = (state) => {
503
+ }, groupsSync = (state) => {
739
504
  return state.groups;
740
- };
741
- const defaultSync = (state) => {
505
+ }, defaultSync = (state) => {
742
506
  return state.paths;
743
- };
744
- const limitFilesSync = (state) => {
507
+ }, limitFilesSync = (state) => {
745
508
  return state.paths.slice(0, state.options.maxFiles);
746
- };
747
- const onlyCountsAsync = (state, error, callback$1) => {
748
- report(error, callback$1, state.counts, state.options.suppressErrors);
749
- return null;
750
- };
751
- const defaultAsync = (state, error, callback$1) => {
752
- report(error, callback$1, state.paths, state.options.suppressErrors);
753
- return null;
754
- };
755
- const limitFilesAsync = (state, error, callback$1) => {
756
- report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
757
- return null;
758
- };
759
- const groupsAsync = (state, error, callback$1) => {
760
- report(error, callback$1, state.groups, state.options.suppressErrors);
761
- return null;
509
+ }, onlyCountsAsync = (state, error, callback$1) => {
510
+ return report(error, callback$1, state.counts, state.options.suppressErrors), null;
511
+ }, defaultAsync = (state, error, callback$1) => {
512
+ return report(error, callback$1, state.paths, state.options.suppressErrors), null;
513
+ }, limitFilesAsync = (state, error, callback$1) => {
514
+ return report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors), null;
515
+ }, groupsAsync = (state, error, callback$1) => {
516
+ return report(error, callback$1, state.groups, state.options.suppressErrors), null;
762
517
  };
763
518
  function report(error, callback$1, output, suppressErrors) {
764
519
  if (error && !suppressErrors) callback$1(error, output);
@@ -766,35 +521,22 @@ var require_invoke_callback = __commonJSMin((exports) => {
766
521
  }
767
522
  function build$1(options, isSynchronous) {
768
523
  const { onlyCounts, group, maxFiles } = options;
769
- if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
770
- else if (group) return isSynchronous ? groupsSync : groupsAsync;
771
- else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
772
- else return isSynchronous ? defaultSync : defaultAsync;
524
+ return onlyCounts ? isSynchronous ? onlyCountsSync : onlyCountsAsync : group ? isSynchronous ? groupsSync : groupsAsync : maxFiles ? isSynchronous ? limitFilesSync : limitFilesAsync : isSynchronous ? defaultSync : defaultAsync;
773
525
  }
774
526
  exports.build = build$1;
775
- });
776
- var require_walk_directory = __commonJSMin((exports) => {
777
- var __importDefault = function(mod) {
527
+ })), require_walk_directory = /* @__PURE__ */ __commonJSMin(((exports) => {
528
+ var __importDefault = exports && exports.__importDefault || function(mod) {
778
529
  return mod && mod.__esModule ? mod : { "default": mod };
779
530
  };
780
- Object.defineProperty(exports, "__esModule", { value: true });
781
- exports.build = void 0;
782
- const fs_1 = __importDefault(__require("node:fs"));
783
- const readdirOpts = { withFileTypes: true };
784
- const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
785
- state.queue.enqueue();
786
- if (currentDepth < 0) return state.queue.dequeue(null, state);
787
- state.visited.push(crawlPath);
788
- state.counts.directories++;
789
- fs_1.default.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
790
- callback$1(entries, directoryPath, currentDepth);
791
- state.queue.dequeue(state.options.suppressErrors ? null : error, state);
531
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.build = void 0;
532
+ const fs_1 = __importDefault(__require("node:fs")), readdirOpts = { withFileTypes: true }, walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
533
+ if (state.queue.enqueue(), currentDepth < 0) return state.queue.dequeue(null, state);
534
+ state.visited.push(crawlPath), state.counts.directories++, fs_1.default.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
535
+ callback$1(entries, directoryPath, currentDepth), state.queue.dequeue(state.options.suppressErrors ? null : error, state);
792
536
  });
793
- };
794
- const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
537
+ }, walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
795
538
  if (currentDepth < 0) return;
796
- state.visited.push(crawlPath);
797
- state.counts.directories++;
539
+ state.visited.push(crawlPath), state.counts.directories++;
798
540
  let entries = [];
799
541
  try {
800
542
  entries = fs_1.default.readdirSync(crawlPath || ".", readdirOpts);
@@ -807,15 +549,8 @@ var require_walk_directory = __commonJSMin((exports) => {
807
549
  return isSynchronous ? walkSync : walkAsync;
808
550
  }
809
551
  exports.build = build;
810
- });
811
- var require_queue = __commonJSMin((exports) => {
812
- Object.defineProperty(exports, "__esModule", { value: true });
813
- exports.Queue = void 0;
814
- /**
815
- * This is a custom stateless queue to track concurrent async fs calls.
816
- * It increments a counter whenever a call is queued and decrements it
817
- * as soon as it completes. When the counter hits 0, it calls onQueueEmpty.
818
- */
552
+ })), require_queue = /* @__PURE__ */ __commonJSMin(((exports) => {
553
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.Queue = void 0;
819
554
  var Queue = class {
820
555
  onQueueEmpty;
821
556
  count = 0;
@@ -823,24 +558,17 @@ var require_queue = __commonJSMin((exports) => {
823
558
  this.onQueueEmpty = onQueueEmpty;
824
559
  }
825
560
  enqueue() {
826
- this.count++;
827
- return this.count;
561
+ return this.count++, this.count;
828
562
  }
829
563
  dequeue(error, output) {
830
564
  if (this.onQueueEmpty && (--this.count <= 0 || error)) {
831
- this.onQueueEmpty(error, output);
832
- if (error) {
833
- output.controller.abort();
834
- this.onQueueEmpty = void 0;
835
- }
565
+ if (this.onQueueEmpty(error, output), error) output.controller.abort(), this.onQueueEmpty = void 0;
836
566
  }
837
567
  }
838
568
  };
839
569
  exports.Queue = Queue;
840
- });
841
- var require_counter = __commonJSMin((exports) => {
842
- Object.defineProperty(exports, "__esModule", { value: true });
843
- exports.Counter = void 0;
570
+ })), require_counter = /* @__PURE__ */ __commonJSMin(((exports) => {
571
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.Counter = void 0;
844
572
  var Counter = class {
845
573
  _files = 0;
846
574
  _directories = 0;
@@ -856,18 +584,14 @@ var require_counter = __commonJSMin((exports) => {
856
584
  get directories() {
857
585
  return this._directories;
858
586
  }
859
- /**
860
- * @deprecated use `directories` instead
861
- */
862
587
  /* c8 ignore next 3 */
863
588
  get dirs() {
864
589
  return this._directories;
865
590
  }
866
591
  };
867
592
  exports.Counter = Counter;
868
- });
869
- var require_walker = __commonJSMin((exports) => {
870
- var __createBinding$1 = Object.create ? function(o, m$1, k$1, k2) {
593
+ })), require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
594
+ var __createBinding$1 = exports && exports.__createBinding || (Object.create ? (function(o, m$1, k$1, k2) {
871
595
  if (k2 === void 0) k2 = k$1;
872
596
  var desc = Object.getOwnPropertyDescriptor(m$1, k$1);
873
597
  if (!desc || ("get" in desc ? !m$1.__esModule : desc.writable || desc.configurable)) desc = {
@@ -877,41 +601,26 @@ var require_walker = __commonJSMin((exports) => {
877
601
  }
878
602
  };
879
603
  Object.defineProperty(o, k2, desc);
880
- } : function(o, m$1, k$1, k2) {
604
+ }) : (function(o, m$1, k$1, k2) {
881
605
  if (k2 === void 0) k2 = k$1;
882
606
  o[k2] = m$1[k$1];
883
- };
884
- var __setModuleDefault = Object.create ? function(o, v$1) {
607
+ })), __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v$1) {
885
608
  Object.defineProperty(o, "default", {
886
609
  enumerable: true,
887
610
  value: v$1
888
611
  });
889
- } : function(o, v$1) {
612
+ }) : function(o, v$1) {
890
613
  o["default"] = v$1;
891
- };
892
- var __importStar = function(mod) {
614
+ }), __importStar = exports && exports.__importStar || function(mod) {
893
615
  if (mod && mod.__esModule) return mod;
894
616
  var result = {};
895
617
  if (mod != null) {
896
618
  for (var k$1 in mod) if (k$1 !== "default" && Object.prototype.hasOwnProperty.call(mod, k$1)) __createBinding$1(result, mod, k$1);
897
619
  }
898
- __setModuleDefault(result, mod);
899
- return result;
620
+ return __setModuleDefault(result, mod), result;
900
621
  };
901
- Object.defineProperty(exports, "__esModule", { value: true });
902
- exports.Walker = void 0;
903
- const path_1$1 = __require("node:path");
904
- const utils_1 = require_utils$1();
905
- const joinPath = __importStar(require_join_path());
906
- const pushDirectory = __importStar(require_push_directory());
907
- const pushFile = __importStar(require_push_file());
908
- const getArray = __importStar(require_get_array());
909
- const groupFiles = __importStar(require_group_files());
910
- const resolveSymlink = __importStar(require_resolve_symlink());
911
- const invokeCallback = __importStar(require_invoke_callback());
912
- const walkDirectory = __importStar(require_walk_directory());
913
- const queue_1 = require_queue();
914
- const counter_1 = require_counter();
622
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.Walker = void 0;
623
+ const path_1$1 = __require("node:path"), utils_1 = require_utils$1(), joinPath = __importStar(require_join_path()), pushDirectory = __importStar(require_push_directory()), pushFile = __importStar(require_push_file()), getArray = __importStar(require_get_array()), groupFiles = __importStar(require_group_files()), resolveSymlink = __importStar(require_resolve_symlink()), invokeCallback = __importStar(require_invoke_callback()), walkDirectory = __importStar(require_walk_directory()), queue_1 = require_queue(), counter_1 = require_counter();
915
624
  var Walker = class {
916
625
  root;
917
626
  isSynchronous;
@@ -925,32 +634,20 @@ var require_walker = __commonJSMin((exports) => {
925
634
  walkDirectory;
926
635
  callbackInvoker;
927
636
  constructor(root, options, callback$1) {
928
- this.isSynchronous = !callback$1;
929
- this.callbackInvoker = invokeCallback.build(options, this.isSynchronous);
930
- this.root = (0, utils_1.normalizePath)(root, options);
931
- this.state = {
637
+ this.isSynchronous = !callback$1, this.callbackInvoker = invokeCallback.build(options, this.isSynchronous), this.root = (0, utils_1.normalizePath)(root, options), this.state = {
932
638
  root: (0, utils_1.isRootDirectory)(this.root) ? this.root : this.root.slice(0, -1),
933
639
  paths: [""].slice(0, 0),
934
640
  groups: [],
935
641
  counts: new counter_1.Counter(),
936
642
  options,
937
643
  queue: new queue_1.Queue((error, state) => this.callbackInvoker(state, error, callback$1)),
938
- symlinks: new Map(),
644
+ symlinks: /* @__PURE__ */ new Map(),
939
645
  visited: [""].slice(0, 0),
940
646
  controller: new AbortController()
941
- };
942
- this.joinPath = joinPath.build(this.root, options);
943
- this.pushDirectory = pushDirectory.build(this.root, options);
944
- this.pushFile = pushFile.build(options);
945
- this.getArray = getArray.build(options);
946
- this.groupFiles = groupFiles.build(options);
947
- this.resolveSymlink = resolveSymlink.build(options, this.isSynchronous);
948
- this.walkDirectory = walkDirectory.build(this.isSynchronous);
647
+ }, this.joinPath = joinPath.build(this.root, options), this.pushDirectory = pushDirectory.build(this.root, options), this.pushFile = pushFile.build(options), this.getArray = getArray.build(options), this.groupFiles = groupFiles.build(options), this.resolveSymlink = resolveSymlink.build(options, this.isSynchronous), this.walkDirectory = walkDirectory.build(this.isSynchronous);
949
648
  }
950
649
  start() {
951
- this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
952
- this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
953
- return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
650
+ 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;
954
651
  }
955
652
  walk = (entries, directoryPath, depth$1) => {
956
653
  const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
@@ -964,21 +661,17 @@ var require_walker = __commonJSMin((exports) => {
964
661
  } else if (entry.isDirectory()) {
965
662
  let path$1 = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
966
663
  if (exclude && exclude(entry.name, path$1)) continue;
967
- this.pushDirectory(path$1, paths, filters);
968
- this.walkDirectory(this.state, path$1, path$1, depth$1 - 1, this.walk);
664
+ this.pushDirectory(path$1, paths, filters), this.walkDirectory(this.state, path$1, path$1, depth$1 - 1, this.walk);
969
665
  } else if (this.resolveSymlink && entry.isSymbolicLink()) {
970
666
  let path$1 = joinPath.joinPathWithBasePath(entry.name, directoryPath);
971
667
  this.resolveSymlink(path$1, this.state, (stat, resolvedPath) => {
972
668
  if (stat.isDirectory()) {
973
- resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
974
- if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return;
669
+ if (resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options), exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return;
975
670
  this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth$1 - 1, this.walk);
976
671
  } else {
977
672
  resolvedPath = useRealPaths ? resolvedPath : path$1;
978
- const filename = (0, path_1$1.basename)(resolvedPath);
979
- const directoryPath$1 = (0, utils_1.normalizePath)((0, path_1$1.dirname)(resolvedPath), this.state.options);
980
- resolvedPath = this.joinPath(filename, directoryPath$1);
981
- this.pushFile(resolvedPath, files, this.state.counts, filters);
673
+ const filename = (0, path_1$1.basename)(resolvedPath), directoryPath$1 = (0, utils_1.normalizePath)((0, path_1$1.dirname)(resolvedPath), this.state.options);
674
+ resolvedPath = this.joinPath(filename, directoryPath$1), this.pushFile(resolvedPath, files, this.state.counts, filters);
982
675
  }
983
676
  });
984
677
  }
@@ -987,10 +680,8 @@ var require_walker = __commonJSMin((exports) => {
987
680
  };
988
681
  };
989
682
  exports.Walker = Walker;
990
- });
991
- var require_async = __commonJSMin((exports) => {
992
- Object.defineProperty(exports, "__esModule", { value: true });
993
- exports.callback = exports.promise = void 0;
683
+ })), require_async = /* @__PURE__ */ __commonJSMin(((exports) => {
684
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.callback = exports.promise = void 0;
994
685
  const walker_1$1 = require_walker();
995
686
  function promise(root, options) {
996
687
  return new Promise((resolve, reject) => {
@@ -1006,28 +697,22 @@ var require_async = __commonJSMin((exports) => {
1006
697
  walker.start();
1007
698
  }
1008
699
  exports.callback = callback;
1009
- });
1010
- var require_sync = __commonJSMin((exports) => {
1011
- Object.defineProperty(exports, "__esModule", { value: true });
1012
- exports.sync = void 0;
700
+ })), require_sync = /* @__PURE__ */ __commonJSMin(((exports) => {
701
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.sync = void 0;
1013
702
  const walker_1 = require_walker();
1014
703
  function sync(root, options) {
1015
704
  const walker = new walker_1.Walker(root, options);
1016
705
  return walker.start();
1017
706
  }
1018
707
  exports.sync = sync;
1019
- });
1020
- var require_api_builder = __commonJSMin((exports) => {
1021
- Object.defineProperty(exports, "__esModule", { value: true });
1022
- exports.APIBuilder = void 0;
1023
- const async_1 = require_async();
1024
- const sync_1 = require_sync();
708
+ })), require_api_builder = /* @__PURE__ */ __commonJSMin(((exports) => {
709
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.APIBuilder = void 0;
710
+ const async_1 = require_async(), sync_1 = require_sync();
1025
711
  var APIBuilder = class {
1026
712
  root;
1027
713
  options;
1028
714
  constructor(root, options) {
1029
- this.root = root;
1030
- this.options = options;
715
+ this.root = root, this.options = options;
1031
716
  }
1032
717
  withPromise() {
1033
718
  return (0, async_1.promise)(this.root, this.options);
@@ -1040,30 +725,8 @@ var require_api_builder = __commonJSMin((exports) => {
1040
725
  }
1041
726
  };
1042
727
  exports.APIBuilder = APIBuilder;
1043
- });
1044
- var require_constants = __commonJSMin((exports, module) => {
1045
- const WIN_SLASH = "\\\\/";
1046
- const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1047
- /**
1048
- * Posix glob regex
1049
- */
1050
- const DOT_LITERAL = "\\.";
1051
- const PLUS_LITERAL = "\\+";
1052
- const QMARK_LITERAL = "\\?";
1053
- const SLASH_LITERAL = "\\/";
1054
- const ONE_CHAR = "(?=.)";
1055
- const QMARK = "[^/]";
1056
- const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
1057
- const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
1058
- const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
1059
- const NO_DOT = `(?!${DOT_LITERAL})`;
1060
- const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
1061
- const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
1062
- const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
1063
- const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
1064
- const STAR = `${QMARK}*?`;
1065
- const SEP = "/";
1066
- const POSIX_CHARS = {
728
+ })), require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
729
+ const WIN_SLASH = "\\\\/", WIN_NO_SLASH = `[^${WIN_SLASH}]`, DOT_LITERAL = "\\.", PLUS_LITERAL = "\\+", QMARK_LITERAL = "\\?", SLASH_LITERAL = "\\/", ONE_CHAR = "(?=.)", QMARK = "[^/]", END_ANCHOR = `(?:${SLASH_LITERAL}|$)`, START_ANCHOR = `(?:^|${SLASH_LITERAL})`, DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`, NO_DOT = `(?!${DOT_LITERAL})`, NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`, NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`, NO_DOTS_SLASH = `(?!${DOTS_SLASH})`, QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`, STAR = `${QMARK}*?`, SEP = "/", POSIX_CHARS = {
1067
730
  DOT_LITERAL,
1068
731
  PLUS_LITERAL,
1069
732
  QMARK_LITERAL,
@@ -1080,11 +743,7 @@ var require_constants = __commonJSMin((exports, module) => {
1080
743
  STAR,
1081
744
  START_ANCHOR,
1082
745
  SEP
1083
- };
1084
- /**
1085
- * Windows glob regex
1086
- */
1087
- const WINDOWS_CHARS = {
746
+ }, WINDOWS_CHARS = {
1088
747
  ...POSIX_CHARS,
1089
748
  SLASH_LITERAL: `[${WIN_SLASH}]`,
1090
749
  QMARK: WIN_NO_SLASH,
@@ -1098,11 +757,7 @@ var require_constants = __commonJSMin((exports, module) => {
1098
757
  START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
1099
758
  END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
1100
759
  SEP: "\\"
1101
- };
1102
- /**
1103
- * POSIX Bracket Regex
1104
- */
1105
- const POSIX_REGEX_SOURCE$1 = {
760
+ }, POSIX_REGEX_SOURCE$1 = {
1106
761
  alnum: "a-zA-Z0-9",
1107
762
  alpha: "a-zA-Z",
1108
763
  ascii: "\\x00-\\x7F",
@@ -1208,130 +863,61 @@ var require_constants = __commonJSMin((exports, module) => {
1208
863
  return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
1209
864
  }
1210
865
  };
1211
- });
1212
- var require_utils = __commonJSMin((exports) => {
866
+ })), require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
1213
867
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
1214
- exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
1215
- exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
1216
- exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
1217
- exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
1218
- exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
1219
- exports.isWindows = () => {
868
+ exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val), exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str), exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str), exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1"), exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/"), exports.isWindows = () => {
1220
869
  if (typeof navigator !== "undefined" && navigator.platform) {
1221
870
  const platform = navigator.platform.toLowerCase();
1222
871
  return platform === "win32" || platform === "windows";
1223
872
  }
1224
- if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
1225
- return false;
1226
- };
1227
- exports.removeBackslashes = (str) => {
873
+ return typeof process !== "undefined" && process.platform ? process.platform === "win32" : false;
874
+ }, exports.removeBackslashes = (str) => {
1228
875
  return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
1229
876
  return match === "\\" ? "" : match;
1230
877
  });
1231
- };
1232
- exports.escapeLast = (input, char, lastIdx) => {
878
+ }, exports.escapeLast = (input, char, lastIdx) => {
1233
879
  const idx = input.lastIndexOf(char, lastIdx);
1234
- if (idx === -1) return input;
1235
- if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
1236
- return `${input.slice(0, idx)}\\${input.slice(idx)}`;
1237
- };
1238
- exports.removePrefix = (input, state = {}) => {
880
+ return idx === -1 ? input : input[idx - 1] === "\\" ? exports.escapeLast(input, char, idx - 1) : `${input.slice(0, idx)}\\${input.slice(idx)}`;
881
+ }, exports.removePrefix = (input, state = {}) => {
1239
882
  let output = input;
1240
- if (output.startsWith("./")) {
1241
- output = output.slice(2);
1242
- state.prefix = "./";
1243
- }
883
+ if (output.startsWith("./")) output = output.slice(2), state.prefix = "./";
1244
884
  return output;
1245
- };
1246
- exports.wrapOutput = (input, state = {}, options = {}) => {
1247
- const prepend = options.contains ? "" : "^";
1248
- const append = options.contains ? "" : "$";
885
+ }, exports.wrapOutput = (input, state = {}, options = {}) => {
886
+ const prepend = options.contains ? "" : "^", append = options.contains ? "" : "$";
1249
887
  let output = `${prepend}(?:${input})${append}`;
1250
888
  if (state.negated === true) output = `(?:^(?!${output}).*$)`;
1251
889
  return output;
890
+ }, exports.basename = (path$1, { windows } = {}) => {
891
+ const segs = path$1.split(windows ? /[\\/]/ : "/"), last = segs[segs.length - 1];
892
+ return last === "" ? segs[segs.length - 2] : last;
1252
893
  };
1253
- exports.basename = (path$1, { windows } = {}) => {
1254
- const segs = path$1.split(windows ? /[\\/]/ : "/");
1255
- const last = segs[segs.length - 1];
1256
- if (last === "") return segs[segs.length - 2];
1257
- return last;
1258
- };
1259
- });
1260
- var require_scan = __commonJSMin((exports, module) => {
1261
- const utils$3 = require_utils();
1262
- const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
1263
- const isPathSeparator = (code) => {
894
+ })), require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
895
+ const utils$3 = require_utils(), { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants(), isPathSeparator = (code) => {
1264
896
  return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
1265
- };
1266
- const depth = (token) => {
897
+ }, depth = (token) => {
1267
898
  if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
1268
- };
1269
- /**
1270
- * Quickly scans a glob pattern and returns an object with a handful of
1271
- * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
1272
- * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
1273
- * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
1274
- *
1275
- * ```js
1276
- * const pm = require('picomatch');
1277
- * console.log(pm.scan('foo/bar/*.js'));
1278
- * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
1279
- * ```
1280
- * @param {String} `str`
1281
- * @param {Object} `options`
1282
- * @return {Object} Returns an object with tokens and regex source string.
1283
- * @api public
1284
- */
1285
- const scan$1 = (input, options) => {
1286
- const opts = options || {};
1287
- const length = input.length - 1;
1288
- const scanToEnd = opts.parts === true || opts.scanToEnd === true;
1289
- const slashes = [];
1290
- const tokens = [];
1291
- const parts = [];
1292
- let str = input;
1293
- let index = -1;
1294
- let start = 0;
1295
- let lastIndex = 0;
1296
- let isBrace = false;
1297
- let isBracket = false;
1298
- let isGlob = false;
1299
- let isExtglob = false;
1300
- let isGlobstar = false;
1301
- let braceEscaped = false;
1302
- let backslashes = false;
1303
- let negated = false;
1304
- let negatedExtglob = false;
1305
- let finished = false;
1306
- let braces = 0;
1307
- let prev;
1308
- let code;
1309
- let token = {
899
+ }, scan$1 = (input, options) => {
900
+ const opts = options || {}, length = input.length - 1, scanToEnd = opts.parts === true || opts.scanToEnd === true, slashes = [], tokens = [], parts = [];
901
+ let str = input, index = -1, start = 0, lastIndex = 0, isBrace = false, isBracket = false, isGlob = false, isExtglob = false, isGlobstar = false, braceEscaped = false, backslashes = false, negated = false, negatedExtglob = false, finished = false, braces = 0, prev, code, token = {
1310
902
  value: "",
1311
903
  depth: 0,
1312
904
  isGlob: false
1313
905
  };
1314
- const eos = () => index >= length;
1315
- const peek = () => str.charCodeAt(index + 1);
1316
- const advance = () => {
1317
- prev = code;
1318
- return str.charCodeAt(++index);
906
+ const eos = () => index >= length, peek = () => str.charCodeAt(index + 1), advance = () => {
907
+ return prev = code, str.charCodeAt(++index);
1319
908
  };
1320
909
  while (index < length) {
1321
910
  code = advance();
1322
911
  let next;
1323
912
  if (code === CHAR_BACKWARD_SLASH) {
1324
- backslashes = token.backslashes = true;
1325
- code = advance();
1326
- if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
913
+ if (backslashes = token.backslashes = true, code = advance(), code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
1327
914
  continue;
1328
915
  }
1329
916
  if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
1330
917
  braces++;
1331
918
  while (eos() !== true && (code = advance())) {
1332
919
  if (code === CHAR_BACKWARD_SLASH) {
1333
- backslashes = token.backslashes = true;
1334
- advance();
920
+ backslashes = token.backslashes = true, advance();
1335
921
  continue;
1336
922
  }
1337
923
  if (code === CHAR_LEFT_CURLY_BRACE) {
@@ -1339,25 +925,16 @@ var require_scan = __commonJSMin((exports, module) => {
1339
925
  continue;
1340
926
  }
1341
927
  if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
1342
- isBrace = token.isBrace = true;
1343
- isGlob = token.isGlob = true;
1344
- finished = true;
1345
- if (scanToEnd === true) continue;
928
+ if (isBrace = token.isBrace = true, isGlob = token.isGlob = true, finished = true, scanToEnd === true) continue;
1346
929
  break;
1347
930
  }
1348
931
  if (braceEscaped !== true && code === CHAR_COMMA) {
1349
- isBrace = token.isBrace = true;
1350
- isGlob = token.isGlob = true;
1351
- finished = true;
1352
- if (scanToEnd === true) continue;
932
+ if (isBrace = token.isBrace = true, isGlob = token.isGlob = true, finished = true, scanToEnd === true) continue;
1353
933
  break;
1354
934
  }
1355
935
  if (code === CHAR_RIGHT_CURLY_BRACE) {
1356
- braces--;
1357
- if (braces === 0) {
1358
- braceEscaped = false;
1359
- isBrace = token.isBrace = true;
1360
- finished = true;
936
+ if (braces--, braces === 0) {
937
+ braceEscaped = false, isBrace = token.isBrace = true, finished = true;
1361
938
  break;
1362
939
  }
1363
940
  }
@@ -1366,14 +943,11 @@ var require_scan = __commonJSMin((exports, module) => {
1366
943
  break;
1367
944
  }
1368
945
  if (code === CHAR_FORWARD_SLASH) {
1369
- slashes.push(index);
1370
- tokens.push(token);
1371
- token = {
946
+ if (slashes.push(index), tokens.push(token), token = {
1372
947
  value: "",
1373
948
  depth: 0,
1374
949
  isGlob: false
1375
- };
1376
- if (finished === true) continue;
950
+ }, finished === true) continue;
1377
951
  if (prev === CHAR_DOT && index === start + 1) {
1378
952
  start += 2;
1379
953
  continue;
@@ -1384,20 +958,15 @@ var require_scan = __commonJSMin((exports, module) => {
1384
958
  if (opts.noext !== true) {
1385
959
  const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
1386
960
  if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
1387
- isGlob = token.isGlob = true;
1388
- isExtglob = token.isExtglob = true;
1389
- finished = true;
1390
- if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
961
+ if (isGlob = token.isGlob = true, isExtglob = token.isExtglob = true, finished = true, code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
1391
962
  if (scanToEnd === true) {
1392
963
  while (eos() !== true && (code = advance())) {
1393
964
  if (code === CHAR_BACKWARD_SLASH) {
1394
- backslashes = token.backslashes = true;
1395
- code = advance();
965
+ backslashes = token.backslashes = true, code = advance();
1396
966
  continue;
1397
967
  }
1398
968
  if (code === CHAR_RIGHT_PARENTHESES) {
1399
- isGlob = token.isGlob = true;
1400
- finished = true;
969
+ isGlob = token.isGlob = true, finished = true;
1401
970
  break;
1402
971
  }
1403
972
  }
@@ -1408,28 +977,21 @@ var require_scan = __commonJSMin((exports, module) => {
1408
977
  }
1409
978
  if (code === CHAR_ASTERISK) {
1410
979
  if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
1411
- isGlob = token.isGlob = true;
1412
- finished = true;
1413
- if (scanToEnd === true) continue;
980
+ if (isGlob = token.isGlob = true, finished = true, scanToEnd === true) continue;
1414
981
  break;
1415
982
  }
1416
983
  if (code === CHAR_QUESTION_MARK) {
1417
- isGlob = token.isGlob = true;
1418
- finished = true;
1419
- if (scanToEnd === true) continue;
984
+ if (isGlob = token.isGlob = true, finished = true, scanToEnd === true) continue;
1420
985
  break;
1421
986
  }
1422
987
  if (code === CHAR_LEFT_SQUARE_BRACKET) {
1423
988
  while (eos() !== true && (next = advance())) {
1424
989
  if (next === CHAR_BACKWARD_SLASH) {
1425
- backslashes = token.backslashes = true;
1426
- advance();
990
+ backslashes = token.backslashes = true, advance();
1427
991
  continue;
1428
992
  }
1429
993
  if (next === CHAR_RIGHT_SQUARE_BRACKET) {
1430
- isBracket = token.isBracket = true;
1431
- isGlob = token.isGlob = true;
1432
- finished = true;
994
+ isBracket = token.isBracket = true, isGlob = token.isGlob = true, finished = true;
1433
995
  break;
1434
996
  }
1435
997
  }
@@ -1437,17 +999,14 @@ var require_scan = __commonJSMin((exports, module) => {
1437
999
  break;
1438
1000
  }
1439
1001
  if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
1440
- negated = token.negated = true;
1441
- start++;
1002
+ negated = token.negated = true, start++;
1442
1003
  continue;
1443
1004
  }
1444
1005
  if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
1445
- isGlob = token.isGlob = true;
1446
- if (scanToEnd === true) {
1006
+ if (isGlob = token.isGlob = true, scanToEnd === true) {
1447
1007
  while (eos() !== true && (code = advance())) {
1448
1008
  if (code === CHAR_LEFT_PARENTHESES) {
1449
- backslashes = token.backslashes = true;
1450
- code = advance();
1009
+ backslashes = token.backslashes = true, code = advance();
1451
1010
  continue;
1452
1011
  }
1453
1012
  if (code === CHAR_RIGHT_PARENTHESES) {
@@ -1460,30 +1019,16 @@ var require_scan = __commonJSMin((exports, module) => {
1460
1019
  break;
1461
1020
  }
1462
1021
  if (isGlob === true) {
1463
- finished = true;
1464
- if (scanToEnd === true) continue;
1022
+ if (finished = true, scanToEnd === true) continue;
1465
1023
  break;
1466
1024
  }
1467
1025
  }
1468
- if (opts.noext === true) {
1469
- isExtglob = false;
1470
- isGlob = false;
1471
- }
1472
- let base = str;
1473
- let prefix = "";
1474
- let glob$1 = "";
1475
- if (start > 0) {
1476
- prefix = str.slice(0, start);
1477
- str = str.slice(start);
1478
- lastIndex -= start;
1479
- }
1480
- if (base && isGlob === true && lastIndex > 0) {
1481
- base = str.slice(0, lastIndex);
1482
- glob$1 = str.slice(lastIndex);
1483
- } else if (isGlob === true) {
1484
- base = "";
1485
- glob$1 = str;
1486
- } else base = str;
1026
+ if (opts.noext === true) isExtglob = false, isGlob = false;
1027
+ let base = str, prefix = "", glob$1 = "";
1028
+ if (start > 0) prefix = str.slice(0, start), str = str.slice(start), lastIndex -= start;
1029
+ if (base && isGlob === true && lastIndex > 0) base = str.slice(0, lastIndex), glob$1 = str.slice(lastIndex);
1030
+ else if (isGlob === true) base = "", glob$1 = str;
1031
+ else base = str;
1487
1032
  if (base && base !== "" && base !== "/" && base !== str) {
1488
1033
  if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
1489
1034
  }
@@ -1506,54 +1051,32 @@ var require_scan = __commonJSMin((exports, module) => {
1506
1051
  negatedExtglob
1507
1052
  };
1508
1053
  if (opts.tokens === true) {
1509
- state.maxDepth = 0;
1510
- if (!isPathSeparator(code)) tokens.push(token);
1054
+ if (state.maxDepth = 0, !isPathSeparator(code)) tokens.push(token);
1511
1055
  state.tokens = tokens;
1512
1056
  }
1513
1057
  if (opts.parts === true || opts.tokens === true) {
1514
1058
  let prevIndex;
1515
1059
  for (let idx = 0; idx < slashes.length; idx++) {
1516
- const n$1 = prevIndex ? prevIndex + 1 : start;
1517
- const i = slashes[idx];
1518
- const value = input.slice(n$1, i);
1060
+ const n$1 = prevIndex ? prevIndex + 1 : start, i = slashes[idx], value = input.slice(n$1, i);
1519
1061
  if (opts.tokens) {
1520
- if (idx === 0 && start !== 0) {
1521
- tokens[idx].isPrefix = true;
1522
- tokens[idx].value = prefix;
1523
- } else tokens[idx].value = value;
1524
- depth(tokens[idx]);
1525
- state.maxDepth += tokens[idx].depth;
1062
+ if (idx === 0 && start !== 0) tokens[idx].isPrefix = true, tokens[idx].value = prefix;
1063
+ else tokens[idx].value = value;
1064
+ depth(tokens[idx]), state.maxDepth += tokens[idx].depth;
1526
1065
  }
1527
1066
  if (idx !== 0 || value !== "") parts.push(value);
1528
1067
  prevIndex = i;
1529
1068
  }
1530
1069
  if (prevIndex && prevIndex + 1 < input.length) {
1531
1070
  const value = input.slice(prevIndex + 1);
1532
- parts.push(value);
1533
- if (opts.tokens) {
1534
- tokens[tokens.length - 1].value = value;
1535
- depth(tokens[tokens.length - 1]);
1536
- state.maxDepth += tokens[tokens.length - 1].depth;
1537
- }
1071
+ if (parts.push(value), opts.tokens) tokens[tokens.length - 1].value = value, depth(tokens[tokens.length - 1]), state.maxDepth += tokens[tokens.length - 1].depth;
1538
1072
  }
1539
- state.slashes = slashes;
1540
- state.parts = parts;
1073
+ state.slashes = slashes, state.parts = parts;
1541
1074
  }
1542
1075
  return state;
1543
1076
  };
1544
1077
  module.exports = scan$1;
1545
- });
1546
- var require_parse = __commonJSMin((exports, module) => {
1547
- const constants$1 = require_constants();
1548
- const utils$2 = require_utils();
1549
- /**
1550
- * Constants
1551
- */
1552
- const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants$1;
1553
- /**
1554
- * Helpers
1555
- */
1556
- const expandRange = (args, options) => {
1078
+ })), require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1079
+ const constants$1 = require_constants(), utils$2 = require_utils(), { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants$1, expandRange = (args, options) => {
1557
1080
  if (typeof options.expandRange === "function") return options.expandRange(...args, options);
1558
1081
  args.sort();
1559
1082
  const value = `[${args.join("-")}]`;
@@ -1563,41 +1086,21 @@ var require_parse = __commonJSMin((exports, module) => {
1563
1086
  return args.map((v$1) => utils$2.escapeRegex(v$1)).join("..");
1564
1087
  }
1565
1088
  return value;
1566
- };
1567
- /**
1568
- * Create the message for a syntax error
1569
- */
1570
- const syntaxError = (type, char) => {
1089
+ }, syntaxError = (type, char) => {
1571
1090
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
1572
- };
1573
- /**
1574
- * Parse the given input string.
1575
- * @param {String} input
1576
- * @param {Object} options
1577
- * @return {Object}
1578
- */
1579
- const parse$1 = (input, options) => {
1091
+ }, parse$1 = (input, options) => {
1580
1092
  if (typeof input !== "string") throw new TypeError("Expected a string");
1581
1093
  input = REPLACEMENTS[input] || input;
1582
- const opts = { ...options };
1583
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1094
+ const opts = { ...options }, max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1584
1095
  let len = input.length;
1585
1096
  if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1586
1097
  const bos = {
1587
1098
  type: "bos",
1588
1099
  value: "",
1589
1100
  output: opts.prepend || ""
1590
- };
1591
- const tokens = [bos];
1592
- const capture = opts.capture ? "" : "?:";
1593
- const PLATFORM_CHARS = constants$1.globChars(opts.windows);
1594
- const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
1595
- const { DOT_LITERAL: DOT_LITERAL$1, PLUS_LITERAL: PLUS_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT: NO_DOT$1, NO_DOT_SLASH: NO_DOT_SLASH$1, NO_DOTS_SLASH: NO_DOTS_SLASH$1, QMARK: QMARK$1, QMARK_NO_DOT: QMARK_NO_DOT$1, STAR: STAR$1, START_ANCHOR: START_ANCHOR$1 } = PLATFORM_CHARS;
1596
- const globstar = (opts$1) => {
1101
+ }, tokens = [bos], capture = opts.capture ? "" : "?:", PLATFORM_CHARS = constants$1.globChars(opts.windows), EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS), { DOT_LITERAL: DOT_LITERAL$1, PLUS_LITERAL: PLUS_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT: NO_DOT$1, NO_DOT_SLASH: NO_DOT_SLASH$1, NO_DOTS_SLASH: NO_DOTS_SLASH$1, QMARK: QMARK$1, QMARK_NO_DOT: QMARK_NO_DOT$1, STAR: STAR$1, START_ANCHOR: START_ANCHOR$1 } = PLATFORM_CHARS, globstar = (opts$1) => {
1597
1102
  return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
1598
- };
1599
- const nodot = opts.dot ? "" : NO_DOT$1;
1600
- const qmarkNoDot = opts.dot ? QMARK$1 : QMARK_NO_DOT$1;
1103
+ }, nodot = opts.dot ? "" : NO_DOT$1, qmarkNoDot = opts.dot ? QMARK$1 : QMARK_NO_DOT$1;
1601
1104
  let star = opts.bash === true ? globstar(opts) : STAR$1;
1602
1105
  if (opts.capture) star = `(${star})`;
1603
1106
  if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
@@ -1618,105 +1121,53 @@ var require_parse = __commonJSMin((exports, module) => {
1618
1121
  globstar: false,
1619
1122
  tokens
1620
1123
  };
1621
- input = utils$2.removePrefix(input, state);
1622
- len = input.length;
1623
- const extglobs = [];
1624
- const braces = [];
1625
- const stack = [];
1626
- let prev = bos;
1627
- let value;
1628
- /**
1629
- * Tokenizing helpers
1630
- */
1631
- const eos = () => state.index === len - 1;
1632
- const peek = state.peek = (n$1 = 1) => input[state.index + n$1];
1633
- const advance = state.advance = () => input[++state.index] || "";
1634
- const remaining = () => input.slice(state.index + 1);
1635
- const consume = (value$1 = "", num = 0) => {
1636
- state.consumed += value$1;
1637
- state.index += num;
1638
- };
1639
- const append = (token) => {
1640
- state.output += token.output != null ? token.output : token.value;
1641
- consume(token.value);
1642
- };
1643
- const negate = () => {
1124
+ input = utils$2.removePrefix(input, state), len = input.length;
1125
+ const extglobs = [], braces = [], stack = [];
1126
+ let prev = bos, value;
1127
+ const eos = () => state.index === len - 1, peek = state.peek = (n$1 = 1) => input[state.index + n$1], advance = state.advance = () => input[++state.index] || "", remaining = () => input.slice(state.index + 1), consume = (value$1 = "", num = 0) => {
1128
+ state.consumed += value$1, state.index += num;
1129
+ }, append = (token) => {
1130
+ state.output += token.output != null ? token.output : token.value, consume(token.value);
1131
+ }, negate = () => {
1644
1132
  let count = 1;
1645
- while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
1646
- advance();
1647
- state.start++;
1648
- count++;
1649
- }
1650
- if (count % 2 === 0) return false;
1651
- state.negated = true;
1652
- state.start++;
1653
- return true;
1654
- };
1655
- const increment = (type) => {
1656
- state[type]++;
1657
- stack.push(type);
1658
- };
1659
- const decrement = (type) => {
1660
- state[type]--;
1661
- stack.pop();
1662
- };
1663
- /**
1664
- * Push tokens onto the tokens array. This helper speeds up
1665
- * tokenizing by 1) helping us avoid backtracking as much as possible,
1666
- * and 2) helping us avoid creating extra tokens when consecutive
1667
- * characters are plain text. This improves performance and simplifies
1668
- * lookbehinds.
1669
- */
1670
- const push = (tok) => {
1133
+ while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) advance(), state.start++, count++;
1134
+ return count % 2 === 0 ? false : (state.negated = true, state.start++, true);
1135
+ }, increment = (type) => {
1136
+ state[type]++, stack.push(type);
1137
+ }, decrement = (type) => {
1138
+ state[type]--, stack.pop();
1139
+ }, push = (tok) => {
1671
1140
  if (prev.type === "globstar") {
1672
- const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
1673
- const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
1674
- if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
1675
- state.output = state.output.slice(0, -prev.output.length);
1676
- prev.type = "star";
1677
- prev.value = "*";
1678
- prev.output = star;
1679
- state.output += prev.output;
1680
- }
1141
+ const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace"), isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
1142
+ if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) state.output = state.output.slice(0, -prev.output.length), prev.type = "star", prev.value = "*", prev.output = star, state.output += prev.output;
1681
1143
  }
1682
1144
  if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
1683
1145
  if (tok.value || tok.output) append(tok);
1684
1146
  if (prev && prev.type === "text" && tok.type === "text") {
1685
- prev.output = (prev.output || prev.value) + tok.value;
1686
- prev.value += tok.value;
1147
+ prev.output = (prev.output || prev.value) + tok.value, prev.value += tok.value;
1687
1148
  return;
1688
1149
  }
1689
- tok.prev = prev;
1690
- tokens.push(tok);
1691
- prev = tok;
1692
- };
1693
- const extglobOpen = (type, value$1) => {
1150
+ tok.prev = prev, tokens.push(tok), prev = tok;
1151
+ }, extglobOpen = (type, value$1) => {
1694
1152
  const token = {
1695
1153
  ...EXTGLOB_CHARS[value$1],
1696
1154
  conditions: 1,
1697
1155
  inner: ""
1698
1156
  };
1699
- token.prev = prev;
1700
- token.parens = state.parens;
1701
- token.output = state.output;
1157
+ token.prev = prev, token.parens = state.parens, token.output = state.output;
1702
1158
  const output = (opts.capture ? "(" : "") + token.open;
1703
- increment("parens");
1704
- push({
1159
+ increment("parens"), push({
1705
1160
  type,
1706
1161
  value: value$1,
1707
1162
  output: state.output ? "" : ONE_CHAR$1
1708
- });
1709
- push({
1163
+ }), push({
1710
1164
  type: "paren",
1711
1165
  extglob: true,
1712
1166
  value: advance(),
1713
1167
  output
1714
- });
1715
- extglobs.push(token);
1716
- };
1717
- const extglobClose = (token) => {
1718
- let output = token.close + (opts.capture ? ")" : "");
1719
- let rest;
1168
+ }), extglobs.push(token);
1169
+ }, extglobClose = (token) => {
1170
+ let output = token.close + (opts.capture ? ")" : ""), rest;
1720
1171
  if (token.type === "negate") {
1721
1172
  let extglobStar = star;
1722
1173
  if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
@@ -1735,58 +1186,25 @@ var require_parse = __commonJSMin((exports, module) => {
1735
1186
  extglob: true,
1736
1187
  value,
1737
1188
  output
1738
- });
1739
- decrement("parens");
1189
+ }), decrement("parens");
1740
1190
  };
1741
- /**
1742
- * Fast paths
1743
- */
1744
1191
  if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
1745
- let backslashes = false;
1746
- let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m$1, esc, chars, first, rest, index) => {
1747
- if (first === "\\") {
1748
- backslashes = true;
1749
- return m$1;
1750
- }
1751
- if (first === "?") {
1752
- if (esc) return esc + first + (rest ? QMARK$1.repeat(rest.length) : "");
1753
- if (index === 0) return qmarkNoDot + (rest ? QMARK$1.repeat(rest.length) : "");
1754
- return QMARK$1.repeat(chars.length);
1755
- }
1756
- if (first === ".") return DOT_LITERAL$1.repeat(chars.length);
1757
- if (first === "*") {
1758
- if (esc) return esc + first + (rest ? star : "");
1759
- return star;
1760
- }
1761
- return esc ? m$1 : `\\${m$1}`;
1192
+ let backslashes = false, output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m$1, esc, chars, first, rest, index) => {
1193
+ return first === "\\" ? (backslashes = true, m$1) : first === "?" ? esc ? esc + first + (rest ? QMARK$1.repeat(rest.length) : "") : index === 0 ? qmarkNoDot + (rest ? QMARK$1.repeat(rest.length) : "") : QMARK$1.repeat(chars.length) : first === "." ? DOT_LITERAL$1.repeat(chars.length) : first === "*" ? esc ? esc + first + (rest ? star : "") : star : esc ? m$1 : `\\${m$1}`;
1762
1194
  });
1763
1195
  if (backslashes === true) if (opts.unescape === true) output = output.replace(/\\/g, "");
1764
1196
  else output = output.replace(/\\+/g, (m$1) => {
1765
1197
  return m$1.length % 2 === 0 ? "\\\\" : m$1 ? "\\" : "";
1766
1198
  });
1767
- if (output === input && opts.contains === true) {
1768
- state.output = input;
1769
- return state;
1770
- }
1771
- state.output = utils$2.wrapOutput(output, state, options);
1772
- return state;
1199
+ return output === input && opts.contains === true ? (state.output = input, state) : (state.output = utils$2.wrapOutput(output, state, options), state);
1773
1200
  }
1774
- /**
1775
- * Tokenize input until we reach end-of-string
1776
- */
1777
1201
  while (!eos()) {
1778
- value = advance();
1779
- if (value === "\0") continue;
1780
- /**
1781
- * Escaped characters
1782
- */
1202
+ if (value = advance(), value === "\0") continue;
1783
1203
  if (value === "\\") {
1784
1204
  const next = peek();
1785
- if (next === "/" && opts.bash !== true) continue;
1786
- if (next === "." || next === ";") continue;
1205
+ if (next === "/" && opts.bash !== true || next === "." || next === ";") continue;
1787
1206
  if (!next) {
1788
- value += "\\";
1789
- push({
1207
+ value += "\\", push({
1790
1208
  type: "text",
1791
1209
  value
1792
1210
  });
@@ -1795,9 +1213,7 @@ var require_parse = __commonJSMin((exports, module) => {
1795
1213
  const match = /^\\+/.exec(remaining());
1796
1214
  let slashes = 0;
1797
1215
  if (match && match[0].length > 2) {
1798
- slashes = match[0].length;
1799
- state.index += slashes;
1800
- if (slashes % 2 !== 0) value += "\\";
1216
+ if (slashes = match[0].length, state.index += slashes, slashes % 2 !== 0) value += "\\";
1801
1217
  }
1802
1218
  if (opts.unescape === true) value = advance();
1803
1219
  else value += advance();
@@ -1809,25 +1225,14 @@ var require_parse = __commonJSMin((exports, module) => {
1809
1225
  continue;
1810
1226
  }
1811
1227
  }
1812
- /**
1813
- * If we're inside a regex character class, continue
1814
- * until we reach the closing bracket.
1815
- */
1816
1228
  if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
1817
1229
  if (opts.posix !== false && value === ":") {
1818
1230
  const inner = prev.value.slice(1);
1819
1231
  if (inner.includes("[")) {
1820
- prev.posix = true;
1821
- if (inner.includes(":")) {
1822
- const idx = prev.value.lastIndexOf("[");
1823
- const pre = prev.value.slice(0, idx);
1824
- const rest$1 = prev.value.slice(idx + 2);
1825
- const posix$1 = POSIX_REGEX_SOURCE[rest$1];
1232
+ if (prev.posix = true, inner.includes(":")) {
1233
+ const idx = prev.value.lastIndexOf("["), pre = prev.value.slice(0, idx), rest$1 = prev.value.slice(idx + 2), posix$1 = POSIX_REGEX_SOURCE[rest$1];
1826
1234
  if (posix$1) {
1827
- prev.value = pre + posix$1;
1828
- state.backtrack = true;
1829
- advance();
1830
- if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR$1;
1235
+ if (prev.value = pre + posix$1, state.backtrack = true, advance(), !bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR$1;
1831
1236
  continue;
1832
1237
  }
1833
1238
  }
@@ -1836,37 +1241,22 @@ var require_parse = __commonJSMin((exports, module) => {
1836
1241
  if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
1837
1242
  if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
1838
1243
  if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
1839
- prev.value += value;
1840
- append({ value });
1244
+ prev.value += value, append({ value });
1841
1245
  continue;
1842
1246
  }
1843
- /**
1844
- * If we're inside a quoted string, continue
1845
- * until we reach the closing double quote.
1846
- */
1847
1247
  if (state.quotes === 1 && value !== "\"") {
1848
- value = utils$2.escapeRegex(value);
1849
- prev.value += value;
1850
- append({ value });
1248
+ value = utils$2.escapeRegex(value), prev.value += value, append({ value });
1851
1249
  continue;
1852
1250
  }
1853
- /**
1854
- * Double quotes
1855
- */
1856
1251
  if (value === "\"") {
1857
- state.quotes = state.quotes === 1 ? 0 : 1;
1858
- if (opts.keepQuotes === true) push({
1252
+ if (state.quotes = state.quotes === 1 ? 0 : 1, opts.keepQuotes === true) push({
1859
1253
  type: "text",
1860
1254
  value
1861
1255
  });
1862
1256
  continue;
1863
1257
  }
1864
- /**
1865
- * Parentheses
1866
- */
1867
1258
  if (value === "(") {
1868
- increment("parens");
1869
- push({
1259
+ increment("parens"), push({
1870
1260
  type: "paren",
1871
1261
  value
1872
1262
  });
@@ -1883,13 +1273,9 @@ var require_parse = __commonJSMin((exports, module) => {
1883
1273
  type: "paren",
1884
1274
  value,
1885
1275
  output: state.parens ? ")" : "\\)"
1886
- });
1887
- decrement("parens");
1276
+ }), decrement("parens");
1888
1277
  continue;
1889
1278
  }
1890
- /**
1891
- * Square brackets
1892
- */
1893
1279
  if (value === "[") {
1894
1280
  if (opts.nobracket === true || !remaining().includes("]")) {
1895
1281
  if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
@@ -1922,23 +1308,15 @@ var require_parse = __commonJSMin((exports, module) => {
1922
1308
  decrement("brackets");
1923
1309
  const prevValue = prev.value.slice(1);
1924
1310
  if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
1925
- prev.value += value;
1926
- append({ value });
1927
- if (opts.literalBrackets === false || utils$2.hasRegexChars(prevValue)) continue;
1311
+ if (prev.value += value, append({ value }), opts.literalBrackets === false || utils$2.hasRegexChars(prevValue)) continue;
1928
1312
  const escaped = utils$2.escapeRegex(prev.value);
1929
- state.output = state.output.slice(0, -prev.value.length);
1930
- if (opts.literalBrackets === true) {
1931
- state.output += escaped;
1932
- prev.value = escaped;
1313
+ if (state.output = state.output.slice(0, -prev.value.length), opts.literalBrackets === true) {
1314
+ state.output += escaped, prev.value = escaped;
1933
1315
  continue;
1934
1316
  }
1935
- prev.value = `(${capture}${escaped}|${prev.value})`;
1936
- state.output += prev.value;
1317
+ prev.value = `(${capture}${escaped}|${prev.value})`, state.output += prev.value;
1937
1318
  continue;
1938
1319
  }
1939
- /**
1940
- * Braces
1941
- */
1942
1320
  if (value === "{" && opts.nobrace !== true) {
1943
1321
  increment("braces");
1944
1322
  const open = {
@@ -1948,8 +1326,7 @@ var require_parse = __commonJSMin((exports, module) => {
1948
1326
  outputIndex: state.output.length,
1949
1327
  tokensIndex: state.tokens.length
1950
1328
  };
1951
- braces.push(open);
1952
- push(open);
1329
+ braces.push(open), push(open);
1953
1330
  continue;
1954
1331
  }
1955
1332
  if (value === "}") {
@@ -1964,36 +1341,25 @@ var require_parse = __commonJSMin((exports, module) => {
1964
1341
  }
1965
1342
  let output = ")";
1966
1343
  if (brace.dots === true) {
1967
- const arr = tokens.slice();
1968
- const range = [];
1344
+ const arr = tokens.slice(), range = [];
1969
1345
  for (let i = arr.length - 1; i >= 0; i--) {
1970
- tokens.pop();
1971
- if (arr[i].type === "brace") break;
1346
+ if (tokens.pop(), arr[i].type === "brace") break;
1972
1347
  if (arr[i].type !== "dots") range.unshift(arr[i].value);
1973
1348
  }
1974
- output = expandRange(range, opts);
1975
- state.backtrack = true;
1349
+ output = expandRange(range, opts), state.backtrack = true;
1976
1350
  }
1977
1351
  if (brace.comma !== true && brace.dots !== true) {
1978
- const out = state.output.slice(0, brace.outputIndex);
1979
- const toks = state.tokens.slice(brace.tokensIndex);
1980
- brace.value = brace.output = "\\{";
1981
- value = output = "\\}";
1982
- state.output = out;
1352
+ const out = state.output.slice(0, brace.outputIndex), toks = state.tokens.slice(brace.tokensIndex);
1353
+ brace.value = brace.output = "\\{", value = output = "\\}", state.output = out;
1983
1354
  for (const t of toks) state.output += t.output || t.value;
1984
1355
  }
1985
1356
  push({
1986
1357
  type: "brace",
1987
1358
  value,
1988
1359
  output
1989
- });
1990
- decrement("braces");
1991
- braces.pop();
1360
+ }), decrement("braces"), braces.pop();
1992
1361
  continue;
1993
1362
  }
1994
- /**
1995
- * Pipes
1996
- */
1997
1363
  if (value === "|") {
1998
1364
  if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
1999
1365
  push({
@@ -2002,16 +1368,10 @@ var require_parse = __commonJSMin((exports, module) => {
2002
1368
  });
2003
1369
  continue;
2004
1370
  }
2005
- /**
2006
- * Commas
2007
- */
2008
1371
  if (value === ",") {
2009
1372
  let output = value;
2010
1373
  const brace = braces[braces.length - 1];
2011
- if (brace && stack[stack.length - 1] === "braces") {
2012
- brace.comma = true;
2013
- output = "|";
2014
- }
1374
+ if (brace && stack[stack.length - 1] === "braces") brace.comma = true, output = "|";
2015
1375
  push({
2016
1376
  type: "comma",
2017
1377
  value,
@@ -2019,16 +1379,9 @@ var require_parse = __commonJSMin((exports, module) => {
2019
1379
  });
2020
1380
  continue;
2021
1381
  }
2022
- /**
2023
- * Slashes
2024
- */
2025
1382
  if (value === "/") {
2026
1383
  if (prev.type === "dot" && state.index === state.start + 1) {
2027
- state.start = state.index + 1;
2028
- state.consumed = "";
2029
- state.output = "";
2030
- tokens.pop();
2031
- prev = bos;
1384
+ state.start = state.index + 1, state.consumed = "", state.output = "", tokens.pop(), prev = bos;
2032
1385
  continue;
2033
1386
  }
2034
1387
  push({
@@ -2038,17 +1391,11 @@ var require_parse = __commonJSMin((exports, module) => {
2038
1391
  });
2039
1392
  continue;
2040
1393
  }
2041
- /**
2042
- * Dots
2043
- */
2044
1394
  if (value === ".") {
2045
1395
  if (state.braces > 0 && prev.type === "dot") {
2046
1396
  if (prev.value === ".") prev.output = DOT_LITERAL$1;
2047
1397
  const brace = braces[braces.length - 1];
2048
- prev.type = "dots";
2049
- prev.output += value;
2050
- prev.value += value;
2051
- brace.dots = true;
1398
+ prev.type = "dots", prev.output += value, prev.value += value, brace.dots = true;
2052
1399
  continue;
2053
1400
  }
2054
1401
  if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
@@ -2066,9 +1413,6 @@ var require_parse = __commonJSMin((exports, module) => {
2066
1413
  });
2067
1414
  continue;
2068
1415
  }
2069
- /**
2070
- * Question marks
2071
- */
2072
1416
  if (value === "?") {
2073
1417
  const isGroup = prev && prev.value === "(";
2074
1418
  if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
@@ -2101,9 +1445,6 @@ var require_parse = __commonJSMin((exports, module) => {
2101
1445
  });
2102
1446
  continue;
2103
1447
  }
2104
- /**
2105
- * Exclamation
2106
- */
2107
1448
  if (value === "!") {
2108
1449
  if (opts.noextglob !== true && peek() === "(") {
2109
1450
  if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
@@ -2116,9 +1457,6 @@ var require_parse = __commonJSMin((exports, module) => {
2116
1457
  continue;
2117
1458
  }
2118
1459
  }
2119
- /**
2120
- * Plus
2121
- */
2122
1460
  if (value === "+") {
2123
1461
  if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
2124
1462
  extglobOpen("plus", value);
@@ -2145,9 +1483,6 @@ var require_parse = __commonJSMin((exports, module) => {
2145
1483
  });
2146
1484
  continue;
2147
1485
  }
2148
- /**
2149
- * Plain text
2150
- */
2151
1486
  if (value === "@") {
2152
1487
  if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
2153
1488
  push({
@@ -2164,33 +1499,18 @@ var require_parse = __commonJSMin((exports, module) => {
2164
1499
  });
2165
1500
  continue;
2166
1501
  }
2167
- /**
2168
- * Plain text
2169
- */
2170
1502
  if (value !== "*") {
2171
1503
  if (value === "$" || value === "^") value = `\\${value}`;
2172
1504
  const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
2173
- if (match) {
2174
- value += match[0];
2175
- state.index += match[0].length;
2176
- }
1505
+ if (match) value += match[0], state.index += match[0].length;
2177
1506
  push({
2178
1507
  type: "text",
2179
1508
  value
2180
1509
  });
2181
1510
  continue;
2182
1511
  }
2183
- /**
2184
- * Stars
2185
- */
2186
1512
  if (prev && (prev.type === "globstar" || prev.star === true)) {
2187
- prev.type = "star";
2188
- prev.star = true;
2189
- prev.value += value;
2190
- prev.output = star;
2191
- state.backtrack = true;
2192
- state.globstar = true;
2193
- consume(value);
1513
+ prev.type = "star", prev.star = true, prev.value += value, prev.output = star, state.backtrack = true, state.globstar = true, consume(value);
2194
1514
  continue;
2195
1515
  }
2196
1516
  let rest = remaining();
@@ -2203,10 +1523,7 @@ var require_parse = __commonJSMin((exports, module) => {
2203
1523
  consume(value);
2204
1524
  continue;
2205
1525
  }
2206
- const prior = prev.prev;
2207
- const before = prior.prev;
2208
- const isStart = prior.type === "slash" || prior.type === "bos";
2209
- const afterStar = before && (before.type === "star" || before.type === "globstar");
1526
+ const prior = prev.prev, before = prior.prev, isStart = prior.type === "slash" || prior.type === "bos", afterStar = before && (before.type === "star" || before.type === "globstar");
2210
1527
  if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
2211
1528
  push({
2212
1529
  type: "star",
@@ -2215,8 +1532,7 @@ var require_parse = __commonJSMin((exports, module) => {
2215
1532
  });
2216
1533
  continue;
2217
1534
  }
2218
- const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
2219
- const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
1535
+ const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace"), isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
2220
1536
  if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
2221
1537
  push({
2222
1538
  type: "star",
@@ -2228,40 +1544,19 @@ var require_parse = __commonJSMin((exports, module) => {
2228
1544
  while (rest.slice(0, 3) === "/**") {
2229
1545
  const after = input[state.index + 4];
2230
1546
  if (after && after !== "/") break;
2231
- rest = rest.slice(3);
2232
- consume("/**", 3);
1547
+ rest = rest.slice(3), consume("/**", 3);
2233
1548
  }
2234
1549
  if (prior.type === "bos" && eos()) {
2235
- prev.type = "globstar";
2236
- prev.value += value;
2237
- prev.output = globstar(opts);
2238
- state.output = prev.output;
2239
- state.globstar = true;
2240
- consume(value);
1550
+ prev.type = "globstar", prev.value += value, prev.output = globstar(opts), state.output = prev.output, state.globstar = true, consume(value);
2241
1551
  continue;
2242
1552
  }
2243
1553
  if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
2244
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
2245
- prior.output = `(?:${prior.output}`;
2246
- prev.type = "globstar";
2247
- prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
2248
- prev.value += value;
2249
- state.globstar = true;
2250
- state.output += prior.output + prev.output;
2251
- consume(value);
1554
+ state.output = state.output.slice(0, -(prior.output + prev.output).length), prior.output = `(?:${prior.output}`, prev.type = "globstar", prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)"), prev.value += value, state.globstar = true, state.output += prior.output + prev.output, consume(value);
2252
1555
  continue;
2253
1556
  }
2254
1557
  if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
2255
1558
  const end = rest[1] !== void 0 ? "|$" : "";
2256
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
2257
- prior.output = `(?:${prior.output}`;
2258
- prev.type = "globstar";
2259
- prev.output = `${globstar(opts)}${SLASH_LITERAL$1}|${SLASH_LITERAL$1}${end})`;
2260
- prev.value += value;
2261
- state.output += prior.output + prev.output;
2262
- state.globstar = true;
2263
- consume(value + advance());
2264
- push({
1559
+ state.output = state.output.slice(0, -(prior.output + prev.output).length), prior.output = `(?:${prior.output}`, prev.type = "globstar", prev.output = `${globstar(opts)}${SLASH_LITERAL$1}|${SLASH_LITERAL$1}${end})`, prev.value += value, state.output += prior.output + prev.output, state.globstar = true, consume(value + advance()), push({
2265
1560
  type: "slash",
2266
1561
  value: "/",
2267
1562
  output: ""
@@ -2269,26 +1564,14 @@ var require_parse = __commonJSMin((exports, module) => {
2269
1564
  continue;
2270
1565
  }
2271
1566
  if (prior.type === "bos" && rest[0] === "/") {
2272
- prev.type = "globstar";
2273
- prev.value += value;
2274
- prev.output = `(?:^|${SLASH_LITERAL$1}|${globstar(opts)}${SLASH_LITERAL$1})`;
2275
- state.output = prev.output;
2276
- state.globstar = true;
2277
- consume(value + advance());
2278
- push({
1567
+ prev.type = "globstar", prev.value += value, prev.output = `(?:^|${SLASH_LITERAL$1}|${globstar(opts)}${SLASH_LITERAL$1})`, state.output = prev.output, state.globstar = true, consume(value + advance()), push({
2279
1568
  type: "slash",
2280
1569
  value: "/",
2281
1570
  output: ""
2282
1571
  });
2283
1572
  continue;
2284
1573
  }
2285
- state.output = state.output.slice(0, -prev.output.length);
2286
- prev.type = "globstar";
2287
- prev.output = globstar(opts);
2288
- prev.value += value;
2289
- state.output += prev.output;
2290
- state.globstar = true;
2291
- consume(value);
1574
+ state.output = state.output.slice(0, -prev.output.length), prev.type = "globstar", prev.output = globstar(opts), prev.value += value, state.output += prev.output, state.globstar = true, consume(value);
2292
1575
  continue;
2293
1576
  }
2294
1577
  const token = {
@@ -2297,48 +1580,33 @@ var require_parse = __commonJSMin((exports, module) => {
2297
1580
  output: star
2298
1581
  };
2299
1582
  if (opts.bash === true) {
2300
- token.output = ".*?";
2301
- if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
1583
+ if (token.output = ".*?", prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
2302
1584
  push(token);
2303
1585
  continue;
2304
1586
  }
2305
1587
  if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
2306
- token.output = value;
2307
- push(token);
1588
+ token.output = value, push(token);
2308
1589
  continue;
2309
1590
  }
2310
1591
  if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
2311
- if (prev.type === "dot") {
2312
- state.output += NO_DOT_SLASH$1;
2313
- prev.output += NO_DOT_SLASH$1;
2314
- } else if (opts.dot === true) {
2315
- state.output += NO_DOTS_SLASH$1;
2316
- prev.output += NO_DOTS_SLASH$1;
2317
- } else {
2318
- state.output += nodot;
2319
- prev.output += nodot;
2320
- }
2321
- if (peek() !== "*") {
2322
- state.output += ONE_CHAR$1;
2323
- prev.output += ONE_CHAR$1;
2324
- }
1592
+ if (prev.type === "dot") state.output += NO_DOT_SLASH$1, prev.output += NO_DOT_SLASH$1;
1593
+ else if (opts.dot === true) state.output += NO_DOTS_SLASH$1, prev.output += NO_DOTS_SLASH$1;
1594
+ else state.output += nodot, prev.output += nodot;
1595
+ if (peek() !== "*") state.output += ONE_CHAR$1, prev.output += ONE_CHAR$1;
2325
1596
  }
2326
1597
  push(token);
2327
1598
  }
2328
1599
  while (state.brackets > 0) {
2329
1600
  if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
2330
- state.output = utils$2.escapeLast(state.output, "[");
2331
- decrement("brackets");
1601
+ state.output = utils$2.escapeLast(state.output, "["), decrement("brackets");
2332
1602
  }
2333
1603
  while (state.parens > 0) {
2334
1604
  if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
2335
- state.output = utils$2.escapeLast(state.output, "(");
2336
- decrement("parens");
1605
+ state.output = utils$2.escapeLast(state.output, "("), decrement("parens");
2337
1606
  }
2338
1607
  while (state.braces > 0) {
2339
1608
  if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
2340
- state.output = utils$2.escapeLast(state.output, "{");
2341
- decrement("braces");
1609
+ state.output = utils$2.escapeLast(state.output, "{"), decrement("braces");
2342
1610
  }
2343
1611
  if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
2344
1612
  type: "maybe_slash",
@@ -2347,39 +1615,23 @@ var require_parse = __commonJSMin((exports, module) => {
2347
1615
  });
2348
1616
  if (state.backtrack === true) {
2349
1617
  state.output = "";
2350
- for (const token of state.tokens) {
2351
- state.output += token.output != null ? token.output : token.value;
2352
- if (token.suffix) state.output += token.suffix;
2353
- }
1618
+ for (const token of state.tokens) if (state.output += token.output != null ? token.output : token.value, token.suffix) state.output += token.suffix;
2354
1619
  }
2355
1620
  return state;
2356
1621
  };
2357
- /**
2358
- * Fast paths for creating regular expressions for common glob patterns.
2359
- * This can significantly speed up processing and has very little downside
2360
- * impact when none of the fast paths match.
2361
- */
2362
1622
  parse$1.fastpaths = (input, options) => {
2363
- const opts = { ...options };
2364
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
2365
- const len = input.length;
1623
+ const opts = { ...options }, max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH, len = input.length;
2366
1624
  if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
2367
1625
  input = REPLACEMENTS[input] || input;
2368
- const { DOT_LITERAL: DOT_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT: NO_DOT$1, NO_DOTS: NO_DOTS$1, NO_DOTS_SLASH: NO_DOTS_SLASH$1, STAR: STAR$1, START_ANCHOR: START_ANCHOR$1 } = constants$1.globChars(opts.windows);
2369
- const nodot = opts.dot ? NO_DOTS$1 : NO_DOT$1;
2370
- const slashDot = opts.dot ? NO_DOTS_SLASH$1 : NO_DOT$1;
2371
- const capture = opts.capture ? "" : "?:";
2372
- const state = {
1626
+ const { DOT_LITERAL: DOT_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT: NO_DOT$1, NO_DOTS: NO_DOTS$1, NO_DOTS_SLASH: NO_DOTS_SLASH$1, STAR: STAR$1, START_ANCHOR: START_ANCHOR$1 } = constants$1.globChars(opts.windows), nodot = opts.dot ? NO_DOTS$1 : NO_DOT$1, slashDot = opts.dot ? NO_DOTS_SLASH$1 : NO_DOT$1, capture = opts.capture ? "" : "?:", state = {
2373
1627
  negated: false,
2374
1628
  prefix: ""
2375
1629
  };
2376
1630
  let star = opts.bash === true ? ".*?" : STAR$1;
2377
1631
  if (opts.capture) star = `(${star})`;
2378
1632
  const globstar = (opts$1) => {
2379
- if (opts$1.noglobstar === true) return star;
2380
- return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
2381
- };
2382
- const create = (str) => {
1633
+ return opts$1.noglobstar === true ? star : `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
1634
+ }, create = (str) => {
2383
1635
  switch (str) {
2384
1636
  case "*": return `${nodot}${ONE_CHAR$1}${star}`;
2385
1637
  case ".*": return `${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
@@ -2393,49 +1645,18 @@ var require_parse = __commonJSMin((exports, module) => {
2393
1645
  const match = /^(.*?)\.(\w+)$/.exec(str);
2394
1646
  if (!match) return;
2395
1647
  const source$1 = create(match[1]);
2396
- if (!source$1) return;
2397
- return source$1 + DOT_LITERAL$1 + match[2];
1648
+ return source$1 ? source$1 + DOT_LITERAL$1 + match[2] : void 0;
2398
1649
  }
2399
1650
  }
2400
- };
2401
- const output = utils$2.removePrefix(input, state);
1651
+ }, output = utils$2.removePrefix(input, state);
2402
1652
  let source = create(output);
2403
1653
  if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL$1}?`;
2404
1654
  return source;
2405
- };
2406
- module.exports = parse$1;
2407
- });
2408
- var require_picomatch$1 = __commonJSMin((exports, module) => {
2409
- const scan = require_scan();
2410
- const parse = require_parse();
2411
- const utils$1 = require_utils();
2412
- const constants = require_constants();
2413
- const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
2414
- /**
2415
- * Creates a matcher function from one or more glob patterns. The
2416
- * returned function takes a string to match as its first argument,
2417
- * and returns true if the string is a match. The returned matcher
2418
- * function also takes a boolean as the second argument that, when true,
2419
- * returns an object with additional information.
2420
- *
2421
- * ```js
2422
- * const picomatch = require('picomatch');
2423
- * // picomatch(glob[, options]);
2424
- *
2425
- * const isMatch = picomatch('*.!(*a)');
2426
- * console.log(isMatch('a.a')); //=> false
2427
- * console.log(isMatch('a.b')); //=> true
2428
- * ```
2429
- * @name picomatch
2430
- * @param {String|Array} `globs` One or more glob patterns.
2431
- * @param {Object=} `options`
2432
- * @return {Function=} Returns a matcher function.
2433
- * @api public
2434
- */
2435
- const picomatch$2 = (glob$1, options, returnState = false) => {
1655
+ }, module.exports = parse$1;
1656
+ })), require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1657
+ const scan = require_scan(), parse = require_parse(), utils$1 = require_utils(), constants = require_constants(), isObject = (val) => val && typeof val === "object" && !Array.isArray(val), picomatch$2 = (glob$1, options, returnState = false) => {
2436
1658
  if (Array.isArray(glob$1)) {
2437
- const fns = glob$1.map((input) => picomatch$2(input, options, returnState));
2438
- const arrayMatcher = (str) => {
1659
+ const fns = glob$1.map((input) => picomatch$2(input, options, returnState)), arrayMatcher = (str) => {
2439
1660
  for (const isMatch of fns) {
2440
1661
  const state$1 = isMatch(str);
2441
1662
  if (state$1) return state$1;
@@ -2446,10 +1667,7 @@ var require_picomatch$1 = __commonJSMin((exports, module) => {
2446
1667
  }
2447
1668
  const isState = isObject(glob$1) && glob$1.tokens && glob$1.input;
2448
1669
  if (glob$1 === "" || typeof glob$1 !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
2449
- const opts = options || {};
2450
- const posix$1 = opts.windows;
2451
- const regex = isState ? picomatch$2.compileRe(glob$1, options) : picomatch$2.makeRe(glob$1, options, false, true);
2452
- const state = regex.state;
1670
+ const opts = options || {}, posix$1 = opts.windows, regex = isState ? picomatch$2.compileRe(glob$1, options) : picomatch$2.makeRe(glob$1, options, false, true), state = regex.state;
2453
1671
  delete regex.state;
2454
1672
  let isIgnored = () => false;
2455
1673
  if (opts.ignore) {
@@ -2465,8 +1683,7 @@ var require_picomatch$1 = __commonJSMin((exports, module) => {
2465
1683
  const { isMatch, match, output } = picomatch$2.test(input, regex, options, {
2466
1684
  glob: glob$1,
2467
1685
  posix: posix$1
2468
- });
2469
- const result = {
1686
+ }), result = {
2470
1687
  glob: glob$1,
2471
1688
  state,
2472
1689
  regex,
@@ -2477,14 +1694,10 @@ var require_picomatch$1 = __commonJSMin((exports, module) => {
2477
1694
  isMatch
2478
1695
  };
2479
1696
  if (typeof opts.onResult === "function") opts.onResult(result);
2480
- if (isMatch === false) {
2481
- result.isMatch = false;
2482
- return returnObject ? result : false;
2483
- }
1697
+ if (isMatch === false) return result.isMatch = false, returnObject ? result : false;
2484
1698
  if (isIgnored(input)) {
2485
1699
  if (typeof opts.onIgnore === "function") opts.onIgnore(result);
2486
- result.isMatch = false;
2487
- return returnObject ? result : false;
1700
+ return result.isMatch = false, returnObject ? result : false;
2488
1701
  }
2489
1702
  if (typeof opts.onMatch === "function") opts.onMatch(result);
2490
1703
  return returnObject ? result : true;
@@ -2492,36 +1705,15 @@ var require_picomatch$1 = __commonJSMin((exports, module) => {
2492
1705
  if (returnState) matcher.state = state;
2493
1706
  return matcher;
2494
1707
  };
2495
- /**
2496
- * Test `input` with the given `regex`. This is used by the main
2497
- * `picomatch()` function to test the input string.
2498
- *
2499
- * ```js
2500
- * const picomatch = require('picomatch');
2501
- * // picomatch.test(input, regex[, options]);
2502
- *
2503
- * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
2504
- * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
2505
- * ```
2506
- * @param {String} `input` String to test.
2507
- * @param {RegExp} `regex`
2508
- * @return {Object} Returns an object with matching info.
2509
- * @api public
2510
- */
2511
1708
  picomatch$2.test = (input, regex, options, { glob: glob$1, posix: posix$1 } = {}) => {
2512
1709
  if (typeof input !== "string") throw new TypeError("Expected input to be a string");
2513
1710
  if (input === "") return {
2514
1711
  isMatch: false,
2515
1712
  output: ""
2516
1713
  };
2517
- const opts = options || {};
2518
- const format = opts.format || (posix$1 ? utils$1.toPosixSlashes : null);
2519
- let match = input === glob$1;
2520
- let output = match && format ? format(input) : input;
2521
- if (match === false) {
2522
- output = format ? format(input) : input;
2523
- match = output === glob$1;
2524
- }
1714
+ const opts = options || {}, format = opts.format || (posix$1 ? utils$1.toPosixSlashes : null);
1715
+ let match = input === glob$1, output = match && format ? format(input) : input;
1716
+ if (match === false) output = format ? format(input) : input, match = output === glob$1;
2525
1717
  if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$2.matchBase(input, regex, options, posix$1);
2526
1718
  else match = regex.exec(output);
2527
1719
  return {
@@ -2529,129 +1721,23 @@ var require_picomatch$1 = __commonJSMin((exports, module) => {
2529
1721
  match,
2530
1722
  output
2531
1723
  };
2532
- };
2533
- /**
2534
- * Match the basename of a filepath.
2535
- *
2536
- * ```js
2537
- * const picomatch = require('picomatch');
2538
- * // picomatch.matchBase(input, glob[, options]);
2539
- * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
2540
- * ```
2541
- * @param {String} `input` String to test.
2542
- * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
2543
- * @return {Boolean}
2544
- * @api public
2545
- */
2546
- picomatch$2.matchBase = (input, glob$1, options) => {
1724
+ }, picomatch$2.matchBase = (input, glob$1, options) => {
2547
1725
  const regex = glob$1 instanceof RegExp ? glob$1 : picomatch$2.makeRe(glob$1, options);
2548
1726
  return regex.test(utils$1.basename(input));
2549
- };
2550
- /**
2551
- * Returns true if **any** of the given glob `patterns` match the specified `string`.
2552
- *
2553
- * ```js
2554
- * const picomatch = require('picomatch');
2555
- * // picomatch.isMatch(string, patterns[, options]);
2556
- *
2557
- * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
2558
- * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
2559
- * ```
2560
- * @param {String|Array} str The string to test.
2561
- * @param {String|Array} patterns One or more glob patterns to use for matching.
2562
- * @param {Object} [options] See available [options](#options).
2563
- * @return {Boolean} Returns true if any patterns match `str`
2564
- * @api public
2565
- */
2566
- picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
2567
- /**
2568
- * Parse a glob pattern to create the source string for a regular
2569
- * expression.
2570
- *
2571
- * ```js
2572
- * const picomatch = require('picomatch');
2573
- * const result = picomatch.parse(pattern[, options]);
2574
- * ```
2575
- * @param {String} `pattern`
2576
- * @param {Object} `options`
2577
- * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
2578
- * @api public
2579
- */
2580
- picomatch$2.parse = (pattern, options) => {
2581
- if (Array.isArray(pattern)) return pattern.map((p) => picomatch$2.parse(p, options));
2582
- return parse(pattern, {
1727
+ }, picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str), picomatch$2.parse = (pattern, options) => {
1728
+ return Array.isArray(pattern) ? pattern.map((p) => picomatch$2.parse(p, options)) : parse(pattern, {
2583
1729
  ...options,
2584
1730
  fastpaths: false
2585
1731
  });
2586
- };
2587
- /**
2588
- * Scan a glob pattern to separate the pattern into segments.
2589
- *
2590
- * ```js
2591
- * const picomatch = require('picomatch');
2592
- * // picomatch.scan(input[, options]);
2593
- *
2594
- * const result = picomatch.scan('!./foo/*.js');
2595
- * console.log(result);
2596
- * { prefix: '!./',
2597
- * input: '!./foo/*.js',
2598
- * start: 3,
2599
- * base: 'foo',
2600
- * glob: '*.js',
2601
- * isBrace: false,
2602
- * isBracket: false,
2603
- * isGlob: true,
2604
- * isExtglob: false,
2605
- * isGlobstar: false,
2606
- * negated: true }
2607
- * ```
2608
- * @param {String} `input` Glob pattern to scan.
2609
- * @param {Object} `options`
2610
- * @return {Object} Returns an object with
2611
- * @api public
2612
- */
2613
- picomatch$2.scan = (input, options) => scan(input, options);
2614
- /**
2615
- * Compile a regular expression from the `state` object returned by the
2616
- * [parse()](#parse) method.
2617
- *
2618
- * @param {Object} `state`
2619
- * @param {Object} `options`
2620
- * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
2621
- * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
2622
- * @return {RegExp}
2623
- * @api public
2624
- */
2625
- picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
1732
+ }, picomatch$2.scan = (input, options) => scan(input, options), picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
2626
1733
  if (returnOutput === true) return state.output;
2627
- const opts = options || {};
2628
- const prepend = opts.contains ? "" : "^";
2629
- const append = opts.contains ? "" : "$";
1734
+ const opts = options || {}, prepend = opts.contains ? "" : "^", append = opts.contains ? "" : "$";
2630
1735
  let source = `${prepend}(?:${state.output})${append}`;
2631
1736
  if (state && state.negated === true) source = `^(?!${source}).*$`;
2632
1737
  const regex = picomatch$2.toRegex(source, options);
2633
1738
  if (returnState === true) regex.state = state;
2634
1739
  return regex;
2635
- };
2636
- /**
2637
- * Create a regular expression from a parsed glob pattern.
2638
- *
2639
- * ```js
2640
- * const picomatch = require('picomatch');
2641
- * const state = picomatch.parse('*.js');
2642
- * // picomatch.compileRe(state[, options]);
2643
- *
2644
- * console.log(picomatch.compileRe(state));
2645
- * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
2646
- * ```
2647
- * @param {String} `state` The object returned from the `.parse` method.
2648
- * @param {Object} `options`
2649
- * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
2650
- * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
2651
- * @return {RegExp} Returns a regex created from the given pattern.
2652
- * @api public
2653
- */
2654
- picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
1740
+ }, picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
2655
1741
  if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
2656
1742
  let parsed = {
2657
1743
  negated: false,
@@ -2660,24 +1746,7 @@ var require_picomatch$1 = __commonJSMin((exports, module) => {
2660
1746
  if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
2661
1747
  if (!parsed.output) parsed = parse(input, options);
2662
1748
  return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
2663
- };
2664
- /**
2665
- * Create a regular expression from the given regex source string.
2666
- *
2667
- * ```js
2668
- * const picomatch = require('picomatch');
2669
- * // picomatch.toRegex(source[, options]);
2670
- *
2671
- * const { output } = picomatch.parse('*.js');
2672
- * console.log(picomatch.toRegex(output));
2673
- * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
2674
- * ```
2675
- * @param {String} `source` Regular expression source string.
2676
- * @param {Object} `options`
2677
- * @return {RegExp}
2678
- * @api public
2679
- */
2680
- picomatch$2.toRegex = (source, options) => {
1749
+ }, picomatch$2.toRegex = (source, options) => {
2681
1750
  try {
2682
1751
  const opts = options || {};
2683
1752
  return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
@@ -2685,20 +1754,9 @@ var require_picomatch$1 = __commonJSMin((exports, module) => {
2685
1754
  if (options && options.debug === true) throw err;
2686
1755
  return /$^/;
2687
1756
  }
2688
- };
2689
- /**
2690
- * Picomatch constants.
2691
- * @return {Object}
2692
- */
2693
- picomatch$2.constants = constants;
2694
- /**
2695
- * Expose "picomatch"
2696
- */
2697
- module.exports = picomatch$2;
2698
- });
2699
- var require_picomatch = __commonJSMin((exports, module) => {
2700
- const pico = require_picomatch$1();
2701
- const utils = require_utils();
1757
+ }, picomatch$2.constants = constants, module.exports = picomatch$2;
1758
+ })), require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1759
+ const pico = require_picomatch$1(), utils = require_utils();
2702
1760
  function picomatch$1(glob$1, options, returnState = false) {
2703
1761
  if (options && (options.windows === null || options.windows === void 0)) options = {
2704
1762
  ...options,
@@ -2706,19 +1764,14 @@ var require_picomatch = __commonJSMin((exports, module) => {
2706
1764
  };
2707
1765
  return pico(glob$1, options, returnState);
2708
1766
  }
2709
- Object.assign(picomatch$1, pico);
2710
- module.exports = picomatch$1;
2711
- });
2712
- var require_builder = __commonJSMin((exports) => {
2713
- Object.defineProperty(exports, "__esModule", { value: true });
2714
- exports.Builder = void 0;
2715
- const path_1 = __require("node:path");
2716
- const api_builder_1 = require_api_builder();
1767
+ Object.assign(picomatch$1, pico), module.exports = picomatch$1;
1768
+ })), require_builder = /* @__PURE__ */ __commonJSMin(((exports) => {
1769
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.Builder = void 0;
1770
+ const path_1 = __require("node:path"), api_builder_1 = require_api_builder();
2717
1771
  var pm = null;
2718
1772
  /* c8 ignore next 6 */
2719
1773
  try {
2720
- __require.resolve("picomatch");
2721
- pm = require_picomatch();
1774
+ __require.resolve("picomatch"), pm = require_picomatch();
2722
1775
  } catch (_e) {}
2723
1776
  var Builder = class {
2724
1777
  globCache = {};
@@ -2733,122 +1786,86 @@ var require_builder = __commonJSMin((exports) => {
2733
1786
  this.options = {
2734
1787
  ...this.options,
2735
1788
  ...options
2736
- };
2737
- this.globFunction = this.options.globFunction;
1789
+ }, this.globFunction = this.options.globFunction;
2738
1790
  }
2739
1791
  group() {
2740
- this.options.group = true;
2741
- return this;
1792
+ return this.options.group = true, this;
2742
1793
  }
2743
1794
  withPathSeparator(separator) {
2744
- this.options.pathSeparator = separator;
2745
- return this;
1795
+ return this.options.pathSeparator = separator, this;
2746
1796
  }
2747
1797
  withBasePath() {
2748
- this.options.includeBasePath = true;
2749
- return this;
1798
+ return this.options.includeBasePath = true, this;
2750
1799
  }
2751
1800
  withRelativePaths() {
2752
- this.options.relativePaths = true;
2753
- return this;
1801
+ return this.options.relativePaths = true, this;
2754
1802
  }
2755
1803
  withDirs() {
2756
- this.options.includeDirs = true;
2757
- return this;
1804
+ return this.options.includeDirs = true, this;
2758
1805
  }
2759
1806
  withMaxDepth(depth$1) {
2760
- this.options.maxDepth = depth$1;
2761
- return this;
1807
+ return this.options.maxDepth = depth$1, this;
2762
1808
  }
2763
1809
  withMaxFiles(limit) {
2764
- this.options.maxFiles = limit;
2765
- return this;
1810
+ return this.options.maxFiles = limit, this;
2766
1811
  }
2767
1812
  withFullPaths() {
2768
- this.options.resolvePaths = true;
2769
- this.options.includeBasePath = true;
2770
- return this;
1813
+ return this.options.resolvePaths = true, this.options.includeBasePath = true, this;
2771
1814
  }
2772
1815
  withErrors() {
2773
- this.options.suppressErrors = false;
2774
- return this;
1816
+ return this.options.suppressErrors = false, this;
2775
1817
  }
2776
1818
  withSymlinks({ resolvePaths = true } = {}) {
2777
- this.options.resolveSymlinks = true;
2778
- this.options.useRealPaths = resolvePaths;
2779
- return this.withFullPaths();
1819
+ return this.options.resolveSymlinks = true, this.options.useRealPaths = resolvePaths, this.withFullPaths();
2780
1820
  }
2781
1821
  withAbortSignal(signal) {
2782
- this.options.signal = signal;
2783
- return this;
1822
+ return this.options.signal = signal, this;
2784
1823
  }
2785
1824
  normalize() {
2786
- this.options.normalizePath = true;
2787
- return this;
1825
+ return this.options.normalizePath = true, this;
2788
1826
  }
2789
1827
  filter(predicate) {
2790
- this.options.filters.push(predicate);
2791
- return this;
1828
+ return this.options.filters.push(predicate), this;
2792
1829
  }
2793
1830
  onlyDirs() {
2794
- this.options.excludeFiles = true;
2795
- this.options.includeDirs = true;
2796
- return this;
1831
+ return this.options.excludeFiles = true, this.options.includeDirs = true, this;
2797
1832
  }
2798
1833
  exclude(predicate) {
2799
- this.options.exclude = predicate;
2800
- return this;
1834
+ return this.options.exclude = predicate, this;
2801
1835
  }
2802
1836
  onlyCounts() {
2803
- this.options.onlyCounts = true;
2804
- return this;
1837
+ return this.options.onlyCounts = true, this;
2805
1838
  }
2806
1839
  crawl(root) {
2807
1840
  return new api_builder_1.APIBuilder(root || ".", this.options);
2808
1841
  }
2809
1842
  withGlobFunction(fn) {
2810
- this.globFunction = fn;
2811
- return this;
1843
+ return this.globFunction = fn, this;
2812
1844
  }
2813
- /**
2814
- * @deprecated Pass options using the constructor instead:
2815
- * ```ts
2816
- * new fdir(options).crawl("/path/to/root");
2817
- * ```
2818
- * This method will be removed in v7.0
2819
- */
2820
1845
  /* c8 ignore next 4 */
2821
1846
  crawlWithOptions(root, options) {
2822
- this.options = {
1847
+ return this.options = {
2823
1848
  ...this.options,
2824
1849
  ...options
2825
- };
2826
- return new api_builder_1.APIBuilder(root || ".", this.options);
1850
+ }, new api_builder_1.APIBuilder(root || ".", this.options);
2827
1851
  }
2828
1852
  glob(...patterns) {
2829
- if (this.globFunction) return this.globWithOptions(patterns);
2830
- return this.globWithOptions(patterns, ...[{ dot: true }]);
1853
+ return this.globFunction ? this.globWithOptions(patterns) : this.globWithOptions(patterns, ...[{ dot: true }]);
2831
1854
  }
2832
1855
  globWithOptions(patterns, ...options) {
2833
1856
  const globFn = this.globFunction || pm;
2834
1857
  /* c8 ignore next 5 */
2835
1858
  if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
2836
1859
  var isMatch = this.globCache[patterns.join("\0")];
2837
- if (!isMatch) {
2838
- isMatch = globFn(patterns, ...options);
2839
- this.globCache[patterns.join("\0")] = isMatch;
2840
- }
2841
- this.options.filters.push((path$1) => isMatch(path$1));
2842
- return this;
1860
+ if (!isMatch) isMatch = globFn(patterns, ...options), this.globCache[patterns.join("\0")] = isMatch;
1861
+ return this.options.filters.push((path$1) => isMatch(path$1)), this;
2843
1862
  }
2844
1863
  };
2845
1864
  exports.Builder = Builder;
2846
- });
2847
- var require_types = __commonJSMin((exports) => {
1865
+ })), require_types = /* @__PURE__ */ __commonJSMin(((exports) => {
2848
1866
  Object.defineProperty(exports, "__esModule", { value: true });
2849
- });
2850
- var require_dist = __commonJSMin((exports) => {
2851
- var __createBinding = Object.create ? function(o, m$1, k$1, k2) {
1867
+ })), require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
1868
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m$1, k$1, k2) {
2852
1869
  if (k2 === void 0) k2 = k$1;
2853
1870
  var desc = Object.getOwnPropertyDescriptor(m$1, k$1);
2854
1871
  if (!desc || ("get" in desc ? !m$1.__esModule : desc.writable || desc.configurable)) desc = {
@@ -2858,36 +1875,28 @@ var require_dist = __commonJSMin((exports) => {
2858
1875
  }
2859
1876
  };
2860
1877
  Object.defineProperty(o, k2, desc);
2861
- } : function(o, m$1, k$1, k2) {
1878
+ }) : (function(o, m$1, k$1, k2) {
2862
1879
  if (k2 === void 0) k2 = k$1;
2863
1880
  o[k2] = m$1[k$1];
2864
- };
2865
- var __exportStar = function(m$1, exports$1) {
1881
+ })), __exportStar = exports && exports.__exportStar || function(m$1, exports$1) {
2866
1882
  for (var p in m$1) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m$1, p);
2867
1883
  };
2868
- Object.defineProperty(exports, "__esModule", { value: true });
2869
- exports.fdir = void 0;
1884
+ Object.defineProperty(exports, "__esModule", { value: true }), exports.fdir = void 0;
2870
1885
  const builder_1 = require_builder();
2871
1886
  Object.defineProperty(exports, "fdir", {
2872
1887
  enumerable: true,
2873
1888
  get: function() {
2874
1889
  return builder_1.Builder;
2875
1890
  }
2876
- });
2877
- __exportStar(require_types(), exports);
2878
- });
2879
- var import_dist = __toESM(require_dist(), 1);
2880
- var import_picomatch = __toESM(require_picomatch(), 1);
1891
+ }), __exportStar(require_types(), exports);
1892
+ })), import_dist = /* @__PURE__ */ __toESM(require_dist(), 1), import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
2881
1893
  const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
2882
1894
  function getPartialMatcher(patterns, options) {
2883
- const patternsCount = patterns.length;
2884
- const patternsParts = Array(patternsCount);
2885
- const regexes = Array(patternsCount);
1895
+ const patternsCount = patterns.length, patternsParts = Array(patternsCount), regexes = Array(patternsCount);
2886
1896
  for (let i = 0; i < patternsCount; i++) {
2887
1897
  const parts = splitPattern(patterns[i]);
2888
1898
  patternsParts[i] = parts;
2889
- const partsCount = parts.length;
2890
- const partRegexes = Array(partsCount);
1899
+ const partsCount = parts.length, partRegexes = Array(partsCount);
2891
1900
  for (let j$1 = 0; j$1 < partsCount; j$1++) partRegexes[j$1] = import_picomatch.default.makeRe(parts[j$1], options);
2892
1901
  regexes[i] = partRegexes;
2893
1902
  }
@@ -2895,10 +1904,7 @@ function getPartialMatcher(patterns, options) {
2895
1904
  const inputParts = input.split("/");
2896
1905
  if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
2897
1906
  for (let i = 0; i < patterns.length; i++) {
2898
- const patternParts = patternsParts[i];
2899
- const regex = regexes[i];
2900
- const inputPatternCount = inputParts.length;
2901
- const minParts = Math.min(inputPatternCount, patternParts.length);
1907
+ const patternParts = patternsParts[i], regex = regexes[i], inputPatternCount = inputParts.length, minParts = Math.min(inputPatternCount, patternParts.length);
2902
1908
  let j$1 = 0;
2903
1909
  while (j$1 < minParts) {
2904
1910
  const part = patternParts[j$1];
@@ -2919,23 +1925,16 @@ function splitPattern(path$1) {
2919
1925
  const result = import_picomatch.default.scan(path$1, splitPatternOptions);
2920
1926
  return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
2921
1927
  }
2922
- const isWin = process.platform === "win32";
2923
- const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
2924
- const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
2925
- const escapePosixPath = (path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2926
- const escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2927
- const escapePath = isWin ? escapeWin32Path : escapePosixPath;
1928
+ const isWin = process.platform === "win32", POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g, WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g, escapePosixPath = (path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapePath = isWin ? escapeWin32Path : escapePosixPath;
2928
1929
  function isDynamicPattern(pattern, options) {
2929
1930
  if ((options === null || options === void 0 ? void 0 : options.caseSensitiveMatch) === false) return true;
2930
1931
  const scan$2 = import_picomatch.default.scan(pattern);
2931
1932
  return scan$2.isGlob || scan$2.negated;
2932
1933
  }
2933
1934
  function log(...tasks) {
2934
- console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`, ...tasks);
1935
+ console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
2935
1936
  }
2936
- const PARENT_DIRECTORY = /^(\/?\.\.)+/;
2937
- const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
2938
- const BACKSLASHES = /\\/g;
1937
+ const PARENT_DIRECTORY = /^(\/?\.\.)+/, ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g, BACKSLASHES = /\\/g;
2939
1938
  function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2940
1939
  let result = pattern;
2941
1940
  if (pattern.endsWith("/")) result = pattern.slice(0, -1);
@@ -2943,27 +1942,19 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2943
1942
  const escapedCwd = escapePath(cwd);
2944
1943
  if (path.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapedCwd, result);
2945
1944
  else result = posix.normalize(result);
2946
- const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
2947
- const parts = splitPattern(result);
1945
+ const parentDirectoryMatch = PARENT_DIRECTORY.exec(result), parts = splitPattern(result);
2948
1946
  if (parentDirectoryMatch === null || parentDirectoryMatch === void 0 ? void 0 : parentDirectoryMatch[0]) {
2949
1947
  const n$1 = (parentDirectoryMatch[0].length + 1) / 3;
2950
1948
  let i = 0;
2951
1949
  const cwdParts = escapedCwd.split("/");
2952
- while (i < n$1 && parts[i + n$1] === cwdParts[cwdParts.length + i - n$1]) {
2953
- result = result.slice(0, (n$1 - i - 1) * 3) + result.slice((n$1 - i) * 3 + parts[i + n$1].length + 1) || ".";
2954
- i++;
2955
- }
1950
+ while (i < n$1 && parts[i + n$1] === cwdParts[cwdParts.length + i - n$1]) result = result.slice(0, (n$1 - i - 1) * 3) + result.slice((n$1 - i) * 3 + parts[i + n$1].length + 1) || ".", i++;
2956
1951
  const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i * 3));
2957
- if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
2958
- props.root = potentialRoot;
2959
- props.depthOffset = -n$1 + i;
2960
- }
1952
+ if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) props.root = potentialRoot, props.depthOffset = -n$1 + i;
2961
1953
  }
2962
1954
  if (!isIgnore && props.depthOffset >= 0) {
2963
1955
  var _props$commonPath;
2964
1956
  (_props$commonPath = props.commonPath) !== null && _props$commonPath !== void 0 || (props.commonPath = parts);
2965
- const newCommonPath = [];
2966
- const length = Math.min(props.commonPath.length, parts.length);
1957
+ const newCommonPath = [], length = Math.min(props.commonPath.length, parts.length);
2967
1958
  for (let i = 0; i < length; i++) {
2968
1959
  const part = parts[i];
2969
1960
  if (part === "**" && !parts[i + 1]) {
@@ -2973,9 +1964,7 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2973
1964
  if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;
2974
1965
  newCommonPath.push(part);
2975
1966
  }
2976
- props.depthOffset = newCommonPath.length;
2977
- props.commonPath = newCommonPath;
2978
- props.root = newCommonPath.length > 0 ? path.posix.join(cwd, ...newCommonPath) : cwd;
1967
+ props.depthOffset = newCommonPath.length, props.commonPath = newCommonPath, props.root = newCommonPath.length > 0 ? path.posix.join(cwd, ...newCommonPath) : cwd;
2979
1968
  }
2980
1969
  return result;
2981
1970
  }
@@ -2983,8 +1972,7 @@ function processPatterns({ patterns, ignore = [], expandDirectories = true }, cw
2983
1972
  if (typeof patterns === "string") patterns = [patterns];
2984
1973
  else if (!patterns) patterns = ["**/*"];
2985
1974
  if (typeof ignore === "string") ignore = [ignore];
2986
- const matchPatterns = [];
2987
- const ignorePatterns = [];
1975
+ const matchPatterns = [], ignorePatterns = [];
2988
1976
  for (const pattern of ignore) {
2989
1977
  if (!pattern) continue;
2990
1978
  if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
@@ -3004,8 +1992,7 @@ function getRelativePath(path$1, cwd, root) {
3004
1992
  }
3005
1993
  function processPath(path$1, cwd, root, isDirectory$1, absolute) {
3006
1994
  const relativePath = absolute ? path$1.slice(root === "/" ? 1 : root.length + 1) || "." : path$1;
3007
- if (root === cwd) return isDirectory$1 && relativePath !== "." ? relativePath.slice(0, -1) : relativePath;
3008
- return getRelativePath(relativePath, cwd, root);
1995
+ return root === cwd ? isDirectory$1 && relativePath !== "." ? relativePath.slice(0, -1) : relativePath : getRelativePath(relativePath, cwd, root);
3009
1996
  }
3010
1997
  function formatPaths(paths, cwd, root) {
3011
1998
  for (let i = paths.length - 1; i >= 0; i--) {
@@ -3022,33 +2009,26 @@ function crawl(options, cwd, sync$1) {
3022
2009
  root: cwd,
3023
2010
  commonPath: null,
3024
2011
  depthOffset: 0
3025
- };
3026
- const processed = processPatterns(options, cwd, props);
3027
- const nocase = options.caseSensitiveMatch === false;
2012
+ }, processed = processPatterns(options, cwd, props), nocase = options.caseSensitiveMatch === false;
3028
2013
  if (options.debug) log("internal processing patterns:", processed);
3029
2014
  const matcher = (0, import_picomatch.default)(processed.match, {
3030
2015
  dot: options.dot,
3031
2016
  nocase,
3032
2017
  ignore: processed.ignore
3033
- });
3034
- const ignore = (0, import_picomatch.default)(processed.ignore, {
2018
+ }), ignore = (0, import_picomatch.default)(processed.ignore, {
3035
2019
  dot: options.dot,
3036
2020
  nocase
3037
- });
3038
- const partialMatcher = getPartialMatcher(processed.match, {
2021
+ }), partialMatcher = getPartialMatcher(processed.match, {
3039
2022
  dot: options.dot,
3040
2023
  nocase
3041
- });
3042
- const fdirOptions = {
2024
+ }), fdirOptions = {
3043
2025
  filters: [options.debug ? (p, isDirectory$1) => {
3044
- const path$1 = processPath(p, cwd, props.root, isDirectory$1, options.absolute);
3045
- const matches = matcher(path$1);
2026
+ const path$1 = processPath(p, cwd, props.root, isDirectory$1, options.absolute), matches = matcher(path$1);
3046
2027
  if (matches) log(`matched ${path$1}`);
3047
2028
  return matches;
3048
2029
  } : (p, isDirectory$1) => matcher(processPath(p, cwd, props.root, isDirectory$1, options.absolute))],
3049
2030
  exclude: options.debug ? (_, p) => {
3050
- const relativePath = processPath(p, cwd, props.root, true, true);
3051
- const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
2031
+ const relativePath = processPath(p, cwd, props.root, true, true), skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
3052
2032
  if (skipped) log(`skipped ${p}`);
3053
2033
  else log(`crawling ${p}`);
3054
2034
  return skipped;
@@ -3061,84 +2041,48 @@ function crawl(options, cwd, sync$1) {
3061
2041
  resolveSymlinks: true
3062
2042
  };
3063
2043
  if (options.deep !== void 0) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
3064
- if (options.absolute) {
3065
- fdirOptions.relativePaths = false;
3066
- fdirOptions.resolvePaths = true;
3067
- fdirOptions.includeBasePath = true;
3068
- }
3069
- if (options.followSymbolicLinks === false) {
3070
- fdirOptions.resolveSymlinks = false;
3071
- fdirOptions.excludeSymlinks = true;
3072
- }
3073
- if (options.onlyDirectories) {
3074
- fdirOptions.excludeFiles = true;
3075
- fdirOptions.includeDirs = true;
3076
- } else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
2044
+ if (options.absolute) fdirOptions.relativePaths = false, fdirOptions.resolvePaths = true, fdirOptions.includeBasePath = true;
2045
+ if (options.followSymbolicLinks === false) fdirOptions.resolveSymlinks = false, fdirOptions.excludeSymlinks = true;
2046
+ if (options.onlyDirectories) fdirOptions.excludeFiles = true, fdirOptions.includeDirs = true;
2047
+ else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
3077
2048
  props.root = props.root.replace(BACKSLASHES, "");
3078
2049
  const root = props.root;
3079
2050
  if (options.debug) log("internal properties:", props);
3080
2051
  const api = new import_dist.fdir(fdirOptions).crawl(root);
3081
- if (cwd === root || options.absolute) return sync$1 ? api.sync() : api.withPromise();
3082
- return sync$1 ? formatPaths(api.sync(), cwd, root) : api.withPromise().then((paths) => formatPaths(paths, cwd, root));
2052
+ return cwd === root || options.absolute ? sync$1 ? api.sync() : api.withPromise() : sync$1 ? formatPaths(api.sync(), cwd, root) : api.withPromise().then((paths) => formatPaths(paths, cwd, root));
3083
2053
  }
3084
2054
  async function glob(patternsOrOptions, options) {
3085
2055
  if (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
3086
2056
  const opts = Array.isArray(patternsOrOptions) || typeof patternsOrOptions === "string" ? {
3087
2057
  ...options,
3088
2058
  patterns: patternsOrOptions
3089
- } : patternsOrOptions;
3090
- const cwd = opts.cwd ? path.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
2059
+ } : patternsOrOptions, cwd = opts.cwd ? path.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
3091
2060
  return crawl(opts, cwd, false);
3092
2061
  }
3093
- /**
3094
- * Default session duration in hours (Claude's billing block duration)
3095
- */
3096
2062
  const DEFAULT_SESSION_DURATION_HOURS = 5;
3097
- /**
3098
- * Floors a timestamp to the beginning of the hour in UTC
3099
- * @param timestamp - The timestamp to floor
3100
- * @returns New Date object floored to the UTC hour
3101
- */
3102
2063
  function floorToHour(timestamp) {
3103
2064
  const floored = new Date(timestamp);
3104
- floored.setUTCMinutes(0, 0, 0);
3105
- return floored;
2065
+ return floored.setUTCMinutes(0, 0, 0), floored;
3106
2066
  }
3107
- /**
3108
- * Identifies and creates session blocks from usage entries
3109
- * Groups entries into time-based blocks (typically 5-hour periods) with gap detection
3110
- * @param entries - Array of usage entries to process
3111
- * @param sessionDurationHours - Duration of each session block in hours
3112
- * @returns Array of session blocks with aggregated usage data
3113
- */
3114
2067
  function identifySessionBlocks(entries, sessionDurationHours = DEFAULT_SESSION_DURATION_HOURS) {
3115
2068
  if (entries.length === 0) return [];
3116
- const sessionDurationMs = sessionDurationHours * 60 * 60 * 1e3;
3117
- const blocks = [];
3118
- const sortedEntries = [...entries].sort((a$1, b$1) => a$1.timestamp.getTime() - b$1.timestamp.getTime());
3119
- let currentBlockStart = null;
3120
- let currentBlockEntries = [];
3121
- const now = new Date();
2069
+ const sessionDurationMs = sessionDurationHours * 60 * 60 * 1e3, blocks = [], sortedEntries = [...entries].sort((a$1, b$1) => a$1.timestamp.getTime() - b$1.timestamp.getTime());
2070
+ let currentBlockStart = null, currentBlockEntries = [];
2071
+ const now = /* @__PURE__ */ new Date();
3122
2072
  for (const entry of sortedEntries) {
3123
2073
  const entryTime = entry.timestamp;
3124
- if (currentBlockStart == null) {
3125
- currentBlockStart = floorToHour(entryTime);
3126
- currentBlockEntries = [entry];
3127
- } else {
3128
- const timeSinceBlockStart = entryTime.getTime() - currentBlockStart.getTime();
3129
- const lastEntry = currentBlockEntries.at(-1);
2074
+ if (currentBlockStart == null) currentBlockStart = floorToHour(entryTime), currentBlockEntries = [entry];
2075
+ else {
2076
+ const timeSinceBlockStart = entryTime.getTime() - currentBlockStart.getTime(), lastEntry = currentBlockEntries.at(-1);
3130
2077
  if (lastEntry == null) continue;
3131
- const lastEntryTime = lastEntry.timestamp;
3132
- const timeSinceLastEntry = entryTime.getTime() - lastEntryTime.getTime();
2078
+ const lastEntryTime = lastEntry.timestamp, timeSinceLastEntry = entryTime.getTime() - lastEntryTime.getTime();
3133
2079
  if (timeSinceBlockStart > sessionDurationMs || timeSinceLastEntry > sessionDurationMs) {
3134
2080
  const block = createBlock(currentBlockStart, currentBlockEntries, now, sessionDurationMs);
3135
- blocks.push(block);
3136
- if (timeSinceLastEntry > sessionDurationMs) {
2081
+ if (blocks.push(block), timeSinceLastEntry > sessionDurationMs) {
3137
2082
  const gapBlock = createGapBlock(lastEntryTime, entryTime, sessionDurationMs);
3138
2083
  if (gapBlock != null) blocks.push(gapBlock);
3139
2084
  }
3140
- currentBlockStart = floorToHour(entryTime);
3141
- currentBlockEntries = [entry];
2085
+ currentBlockStart = floorToHour(entryTime), currentBlockEntries = [entry];
3142
2086
  } else currentBlockEntries.push(entry);
3143
2087
  }
3144
2088
  }
@@ -3148,20 +2092,8 @@ function identifySessionBlocks(entries, sessionDurationHours = DEFAULT_SESSION_D
3148
2092
  }
3149
2093
  return blocks;
3150
2094
  }
3151
- /**
3152
- * Creates a session block from a start time and usage entries
3153
- * @param startTime - When the block started
3154
- * @param entries - Usage entries in this block
3155
- * @param now - Current time for active block detection
3156
- * @param sessionDurationMs - Session duration in milliseconds
3157
- * @returns Session block with aggregated data
3158
- */
3159
2095
  function createBlock(startTime, entries, now, sessionDurationMs) {
3160
- const endTime = new Date(startTime.getTime() + sessionDurationMs);
3161
- const lastEntry = entries[entries.length - 1];
3162
- const actualEndTime = lastEntry != null ? lastEntry.timestamp : startTime;
3163
- const isActive = now.getTime() - actualEndTime.getTime() < sessionDurationMs && now < endTime;
3164
- const tokenCounts = {
2096
+ const endTime = new Date(startTime.getTime() + sessionDurationMs), lastEntry = entries[entries.length - 1], actualEndTime = lastEntry != null ? lastEntry.timestamp : startTime, isActive = now.getTime() - actualEndTime.getTime() < sessionDurationMs && now < endTime, tokenCounts = {
3165
2097
  inputTokens: 0,
3166
2098
  outputTokens: 0,
3167
2099
  cacheCreationInputTokens: 0,
@@ -3170,15 +2102,7 @@ function createBlock(startTime, entries, now, sessionDurationMs) {
3170
2102
  let costUSD = 0;
3171
2103
  const models = [];
3172
2104
  let usageLimitResetTime;
3173
- for (const entry of entries) {
3174
- tokenCounts.inputTokens += entry.usage.inputTokens;
3175
- tokenCounts.outputTokens += entry.usage.outputTokens;
3176
- tokenCounts.cacheCreationInputTokens += entry.usage.cacheCreationInputTokens;
3177
- tokenCounts.cacheReadInputTokens += entry.usage.cacheReadInputTokens;
3178
- costUSD += entry.costUSD ?? 0;
3179
- usageLimitResetTime = entry.usageLimitResetTime ?? usageLimitResetTime;
3180
- models.push(entry.model);
3181
- }
2105
+ for (const entry of entries) tokenCounts.inputTokens += entry.usage.inputTokens, tokenCounts.outputTokens += entry.usage.outputTokens, tokenCounts.cacheCreationInputTokens += entry.usage.cacheCreationInputTokens, tokenCounts.cacheReadInputTokens += entry.usage.cacheReadInputTokens, costUSD += entry.costUSD ?? 0, usageLimitResetTime = entry.usageLimitResetTime ?? usageLimitResetTime, models.push(entry.model);
3182
2106
  return {
3183
2107
  id: startTime.toISOString(),
3184
2108
  startTime,
@@ -3192,18 +2116,10 @@ function createBlock(startTime, entries, now, sessionDurationMs) {
3192
2116
  usageLimitResetTime
3193
2117
  };
3194
2118
  }
3195
- /**
3196
- * Creates a gap block representing periods with no activity
3197
- * @param lastActivityTime - Time of last activity before gap
3198
- * @param nextActivityTime - Time of next activity after gap
3199
- * @param sessionDurationMs - Session duration in milliseconds
3200
- * @returns Gap block or null if gap is too short
3201
- */
3202
2119
  function createGapBlock(lastActivityTime, nextActivityTime, sessionDurationMs) {
3203
2120
  const gapDuration = nextActivityTime.getTime() - lastActivityTime.getTime();
3204
2121
  if (gapDuration <= sessionDurationMs) return null;
3205
- const gapStart = new Date(lastActivityTime.getTime() + sessionDurationMs);
3206
- const gapEnd = nextActivityTime;
2122
+ const gapStart = new Date(lastActivityTime.getTime() + sessionDurationMs), gapEnd = nextActivityTime;
3207
2123
  return {
3208
2124
  id: `gap-${gapStart.toISOString()}`,
3209
2125
  startTime: gapStart,
@@ -3221,78 +2137,39 @@ function createGapBlock(lastActivityTime, nextActivityTime, sessionDurationMs) {
3221
2137
  models: []
3222
2138
  };
3223
2139
  }
3224
- /**
3225
- * Calculates the burn rate (tokens/minute and cost/hour) for a session block
3226
- * @param block - Session block to analyze
3227
- * @returns Burn rate calculations or null if block has no activity
3228
- */
3229
2140
  function calculateBurnRate(block) {
3230
2141
  if (block.entries.length === 0 || (block.isGap ?? false)) return null;
3231
- const firstEntryData = block.entries[0];
3232
- const lastEntryData = block.entries[block.entries.length - 1];
2142
+ const firstEntryData = block.entries[0], lastEntryData = block.entries[block.entries.length - 1];
3233
2143
  if (firstEntryData == null || lastEntryData == null) return null;
3234
- const firstEntry = firstEntryData.timestamp;
3235
- const lastEntry = lastEntryData.timestamp;
3236
- const durationMinutes = (lastEntry.getTime() - firstEntry.getTime()) / (1e3 * 60);
2144
+ const firstEntry = firstEntryData.timestamp, lastEntry = lastEntryData.timestamp, durationMinutes = (lastEntry.getTime() - firstEntry.getTime()) / (1e3 * 60);
3237
2145
  if (durationMinutes <= 0) return null;
3238
- const totalTokens = getTotalTokens(block.tokenCounts);
3239
- const tokensPerMinute = totalTokens / durationMinutes;
3240
- const nonCacheTokens = (block.tokenCounts.inputTokens ?? 0) + (block.tokenCounts.outputTokens ?? 0);
3241
- const tokensPerMinuteForIndicator = nonCacheTokens / durationMinutes;
3242
- const costPerHour = block.costUSD / durationMinutes * 60;
2146
+ const totalTokens = getTotalTokens(block.tokenCounts), tokensPerMinute = totalTokens / durationMinutes, nonCacheTokens = (block.tokenCounts.inputTokens ?? 0) + (block.tokenCounts.outputTokens ?? 0), tokensPerMinuteForIndicator = nonCacheTokens / durationMinutes, costPerHour = block.costUSD / durationMinutes * 60;
3243
2147
  return {
3244
2148
  tokensPerMinute,
3245
2149
  tokensPerMinuteForIndicator,
3246
2150
  costPerHour
3247
2151
  };
3248
2152
  }
3249
- /**
3250
- * Projects total usage for an active session block based on current burn rate
3251
- * @param block - Active session block to project
3252
- * @returns Projected usage totals or null if block is inactive or has no burn rate
3253
- */
3254
2153
  function projectBlockUsage(block) {
3255
2154
  if (!block.isActive || (block.isGap ?? false)) return null;
3256
2155
  const burnRate = calculateBurnRate(block);
3257
2156
  if (burnRate == null) return null;
3258
- const now = new Date();
3259
- const remainingTime = block.endTime.getTime() - now.getTime();
3260
- const remainingMinutes = Math.max(0, remainingTime / (1e3 * 60));
3261
- const currentTokens = getTotalTokens(block.tokenCounts);
3262
- const projectedAdditionalTokens = burnRate.tokensPerMinute * remainingMinutes;
3263
- const totalTokens = currentTokens + projectedAdditionalTokens;
3264
- const projectedAdditionalCost = burnRate.costPerHour / 60 * remainingMinutes;
3265
- const totalCost = block.costUSD + projectedAdditionalCost;
2157
+ const now = /* @__PURE__ */ new Date(), remainingTime = block.endTime.getTime() - now.getTime(), remainingMinutes = Math.max(0, remainingTime / (1e3 * 60)), currentTokens = getTotalTokens(block.tokenCounts), projectedAdditionalTokens = burnRate.tokensPerMinute * remainingMinutes, totalTokens = currentTokens + projectedAdditionalTokens, projectedAdditionalCost = burnRate.costPerHour / 60 * remainingMinutes, totalCost = block.costUSD + projectedAdditionalCost;
3266
2158
  return {
3267
2159
  totalTokens: Math.round(totalTokens),
3268
2160
  totalCost: Math.round(totalCost * 100) / 100,
3269
2161
  remainingMinutes: Math.round(remainingMinutes)
3270
2162
  };
3271
2163
  }
3272
- /**
3273
- * Filters session blocks to include only recent ones and active blocks
3274
- * @param blocks - Array of session blocks to filter
3275
- * @param days - Number of recent days to include (default: 3)
3276
- * @returns Filtered array of recent or active blocks
3277
- */
3278
2164
  function filterRecentBlocks(blocks, days = DEFAULT_RECENT_DAYS) {
3279
- const now = new Date();
3280
- const cutoffTime = new Date(now.getTime() - days * 24 * 60 * 60 * 1e3);
2165
+ const now = /* @__PURE__ */ new Date(), cutoffTime = /* @__PURE__ */ new Date(now.getTime() - days * 24 * 60 * 60 * 1e3);
3281
2166
  return blocks.filter((block) => {
3282
2167
  return block.startTime >= cutoffTime || block.isActive;
3283
2168
  });
3284
2169
  }
3285
- var import_usingCtx = __toESM(require_usingCtx(), 1);
3286
- /**
3287
- * Get Claude data directories to search for usage data
3288
- * When CLAUDE_CONFIG_DIR is set: uses only those paths
3289
- * When not set: uses default paths (~/.config/claude and ~/.claude)
3290
- * @returns Array of valid Claude data directory paths
3291
- */
2170
+ var import_usingCtx = /* @__PURE__ */ __toESM(require_usingCtx(), 1);
3292
2171
  function getClaudePaths() {
3293
- const paths = [];
3294
- const normalizedPaths = new Set();
3295
- const envPaths = (process$1.env[CLAUDE_CONFIG_DIR_ENV] ?? "").trim();
2172
+ const paths = [], normalizedPaths = /* @__PURE__ */ new Set(), envPaths = (process$1.env[CLAUDE_CONFIG_DIR_ENV] ?? "").trim();
3296
2173
  if (envPaths !== "") {
3297
2174
  const envPathList = envPaths.split(",").map((p) => p.trim()).filter((p) => p !== "");
3298
2175
  for (const envPath of envPathList) {
@@ -3300,10 +2177,7 @@ function getClaudePaths() {
3300
2177
  if (isDirectorySync(normalizedPath)) {
3301
2178
  const projectsPath = path.join(normalizedPath, CLAUDE_PROJECTS_DIR_NAME);
3302
2179
  if (isDirectorySync(projectsPath)) {
3303
- if (!normalizedPaths.has(normalizedPath)) {
3304
- normalizedPaths.add(normalizedPath);
3305
- paths.push(normalizedPath);
3306
- }
2180
+ if (!normalizedPaths.has(normalizedPath)) normalizedPaths.add(normalizedPath), paths.push(normalizedPath);
3307
2181
  }
3308
2182
  }
3309
2183
  }
@@ -3317,10 +2191,7 @@ function getClaudePaths() {
3317
2191
  if (isDirectorySync(normalizedPath)) {
3318
2192
  const projectsPath = path.join(normalizedPath, CLAUDE_PROJECTS_DIR_NAME);
3319
2193
  if (isDirectorySync(projectsPath)) {
3320
- if (!normalizedPaths.has(normalizedPath)) {
3321
- normalizedPaths.add(normalizedPath);
3322
- paths.push(normalizedPath);
3323
- }
2194
+ if (!normalizedPaths.has(normalizedPath)) normalizedPaths.add(normalizedPath), paths.push(normalizedPath);
3324
2195
  }
3325
2196
  }
3326
2197
  }
@@ -3330,22 +2201,12 @@ function getClaudePaths() {
3330
2201
  - Or set ${CLAUDE_CONFIG_DIR_ENV} environment variable to valid directory path(s) containing a '${CLAUDE_PROJECTS_DIR_NAME}' subdirectory`.trim());
3331
2202
  return paths;
3332
2203
  }
3333
- /**
3334
- * Extract project name from Claude JSONL file path
3335
- * @param jsonlPath - Absolute path to JSONL file
3336
- * @returns Project name extracted from path, or "unknown" if malformed
3337
- */
3338
2204
  function extractProjectFromPath(jsonlPath) {
3339
- const normalizedPath = jsonlPath.replace(/[/\\]/g, path.sep);
3340
- const segments = normalizedPath.split(path.sep);
3341
- const projectsIndex = segments.findIndex((segment) => segment === CLAUDE_PROJECTS_DIR_NAME);
2205
+ const normalizedPath = jsonlPath.replace(/[/\\]/g, path.sep), segments = normalizedPath.split(path.sep), projectsIndex = segments.findIndex((segment) => segment === CLAUDE_PROJECTS_DIR_NAME);
3342
2206
  if (projectsIndex === -1 || projectsIndex + 1 >= segments.length) return "unknown";
3343
2207
  const projectName = segments[projectsIndex + 1];
3344
2208
  return projectName != null && projectName.trim() !== "" ? projectName : "unknown";
3345
2209
  }
3346
- /**
3347
- * Zod schema for validating Claude usage data from JSONL files
3348
- */
3349
2210
  const usageDataSchema = objectType({
3350
2211
  cwd: stringType().optional(),
3351
2212
  sessionId: sessionIdSchema.optional(),
@@ -3365,22 +2226,14 @@ const usageDataSchema = objectType({
3365
2226
  costUSD: numberType().optional(),
3366
2227
  requestId: requestIdSchema.optional(),
3367
2228
  isApiErrorMessage: booleanType().optional()
3368
- });
3369
- /**
3370
- * Zod schema for model-specific usage breakdown data
3371
- */
3372
- const modelBreakdownSchema = objectType({
2229
+ }), modelBreakdownSchema = objectType({
3373
2230
  modelName: modelNameSchema,
3374
2231
  inputTokens: numberType(),
3375
2232
  outputTokens: numberType(),
3376
2233
  cacheCreationTokens: numberType(),
3377
2234
  cacheReadTokens: numberType(),
3378
2235
  cost: numberType()
3379
- });
3380
- /**
3381
- * Zod schema for daily usage aggregation data
3382
- */
3383
- const dailyUsageSchema = objectType({
2236
+ }), dailyUsageSchema = objectType({
3384
2237
  date: dailyDateSchema,
3385
2238
  inputTokens: numberType(),
3386
2239
  outputTokens: numberType(),
@@ -3390,11 +2243,7 @@ const dailyUsageSchema = objectType({
3390
2243
  modelsUsed: arrayType(modelNameSchema),
3391
2244
  modelBreakdowns: arrayType(modelBreakdownSchema),
3392
2245
  project: stringType().optional()
3393
- });
3394
- /**
3395
- * Zod schema for session-based usage aggregation data
3396
- */
3397
- const sessionUsageSchema = objectType({
2246
+ }), sessionUsageSchema = objectType({
3398
2247
  sessionId: sessionIdSchema,
3399
2248
  projectPath: projectPathSchema,
3400
2249
  inputTokens: numberType(),
@@ -3406,11 +2255,7 @@ const sessionUsageSchema = objectType({
3406
2255
  versions: arrayType(versionSchema),
3407
2256
  modelsUsed: arrayType(modelNameSchema),
3408
2257
  modelBreakdowns: arrayType(modelBreakdownSchema)
3409
- });
3410
- /**
3411
- * Zod schema for monthly usage aggregation data
3412
- */
3413
- const monthlyUsageSchema = objectType({
2258
+ }), monthlyUsageSchema = objectType({
3414
2259
  month: monthlyDateSchema,
3415
2260
  inputTokens: numberType(),
3416
2261
  outputTokens: numberType(),
@@ -3420,11 +2265,7 @@ const monthlyUsageSchema = objectType({
3420
2265
  modelsUsed: arrayType(modelNameSchema),
3421
2266
  modelBreakdowns: arrayType(modelBreakdownSchema),
3422
2267
  project: stringType().optional()
3423
- });
3424
- /**
3425
- * Zod schema for weekly usage aggregation data
3426
- */
3427
- const weeklyUsageSchema = objectType({
2268
+ }), weeklyUsageSchema = objectType({
3428
2269
  week: weeklyDateSchema,
3429
2270
  inputTokens: numberType(),
3430
2271
  outputTokens: numberType(),
@@ -3434,11 +2275,7 @@ const weeklyUsageSchema = objectType({
3434
2275
  modelsUsed: arrayType(modelNameSchema),
3435
2276
  modelBreakdowns: arrayType(modelBreakdownSchema),
3436
2277
  project: stringType().optional()
3437
- });
3438
- /**
3439
- * Zod schema for bucket usage aggregation data
3440
- */
3441
- const bucketUsageSchema = objectType({
2278
+ }), bucketUsageSchema = objectType({
3442
2279
  bucket: unionType([weeklyDateSchema, monthlyDateSchema]),
3443
2280
  inputTokens: numberType(),
3444
2281
  outputTokens: numberType(),
@@ -3449,12 +2286,8 @@ const bucketUsageSchema = objectType({
3449
2286
  modelBreakdowns: arrayType(modelBreakdownSchema),
3450
2287
  project: stringType().optional()
3451
2288
  });
3452
- /**
3453
- * Aggregates token counts and costs by model name
3454
- */
3455
2289
  function aggregateByModel(entries, getModel, getUsage, getCost) {
3456
- const modelAggregates = new Map();
3457
- const defaultStats = {
2290
+ const modelAggregates = /* @__PURE__ */ new Map(), defaultStats = {
3458
2291
  inputTokens: 0,
3459
2292
  outputTokens: 0,
3460
2293
  cacheCreationTokens: 0,
@@ -3464,9 +2297,7 @@ function aggregateByModel(entries, getModel, getUsage, getCost) {
3464
2297
  for (const entry of entries) {
3465
2298
  const modelName = getModel(entry) ?? "unknown";
3466
2299
  if (modelName === "<synthetic>") continue;
3467
- const usage = getUsage(entry);
3468
- const cost = getCost(entry);
3469
- const existing = modelAggregates.get(modelName) ?? defaultStats;
2300
+ const usage = getUsage(entry), cost = getCost(entry), existing = modelAggregates.get(modelName) ?? defaultStats;
3470
2301
  modelAggregates.set(modelName, {
3471
2302
  inputTokens: existing.inputTokens + (usage.input_tokens ?? 0),
3472
2303
  outputTokens: existing.outputTokens + (usage.output_tokens ?? 0),
@@ -3477,12 +2308,8 @@ function aggregateByModel(entries, getModel, getUsage, getCost) {
3477
2308
  }
3478
2309
  return modelAggregates;
3479
2310
  }
3480
- /**
3481
- * Aggregates model breakdowns from multiple sources
3482
- */
3483
2311
  function aggregateModelBreakdowns(breakdowns) {
3484
- const modelAggregates = new Map();
3485
- const defaultStats = {
2312
+ const modelAggregates = /* @__PURE__ */ new Map(), defaultStats = {
3486
2313
  inputTokens: 0,
3487
2314
  outputTokens: 0,
3488
2315
  cacheCreationTokens: 0,
@@ -3502,22 +2329,15 @@ function aggregateModelBreakdowns(breakdowns) {
3502
2329
  }
3503
2330
  return modelAggregates;
3504
2331
  }
3505
- /**
3506
- * Converts model aggregates to sorted model breakdowns
3507
- */
3508
2332
  function createModelBreakdowns(modelAggregates) {
3509
2333
  return Array.from(modelAggregates.entries()).map(([modelName, stats]) => ({
3510
2334
  modelName,
3511
2335
  ...stats
3512
2336
  })).sort((a$1, b$1) => b$1.cost - a$1.cost);
3513
2337
  }
3514
- /**
3515
- * Calculates total token counts and costs from entries
3516
- */
3517
2338
  function calculateTotals(entries, getUsage, getCost) {
3518
2339
  return entries.reduce((acc, entry) => {
3519
- const usage = getUsage(entry);
3520
- const cost = getCost(entry);
2340
+ const usage = getUsage(entry), cost = getCost(entry);
3521
2341
  return {
3522
2342
  inputTokens: acc.inputTokens + (usage.input_tokens ?? 0),
3523
2343
  outputTokens: acc.outputTokens + (usage.output_tokens ?? 0),
@@ -3535,53 +2355,27 @@ function calculateTotals(entries, getUsage, getCost) {
3535
2355
  totalCost: 0
3536
2356
  });
3537
2357
  }
3538
- /**
3539
- * Filters items by date range
3540
- */
3541
2358
  function filterByDateRange(items, getDate, since, until) {
3542
- if (since == null && until == null) return items;
3543
- return items.filter((item) => {
2359
+ return since == null && until == null ? items : items.filter((item) => {
3544
2360
  const dateStr = getDate(item).substring(0, 10).replace(/-/g, "");
3545
- if (since != null && dateStr < since) return false;
3546
- if (until != null && dateStr > until) return false;
3547
- return true;
2361
+ return !(since != null && dateStr < since || until != null && dateStr > until);
3548
2362
  });
3549
2363
  }
3550
- /**
3551
- * Filters items by project name
3552
- */
3553
2364
  function filterByProject(items, getProject, projectFilter) {
3554
- if (projectFilter == null) return items;
3555
- return items.filter((item) => {
2365
+ return projectFilter == null ? items : items.filter((item) => {
3556
2366
  const projectName = getProject(item);
3557
2367
  return projectName === projectFilter;
3558
2368
  });
3559
2369
  }
3560
- /**
3561
- * Checks if an entry is a duplicate based on hash
3562
- */
3563
2370
  function isDuplicateEntry(uniqueHash, processedHashes) {
3564
- if (uniqueHash == null) return false;
3565
- return processedHashes.has(uniqueHash);
2371
+ return uniqueHash == null ? false : processedHashes.has(uniqueHash);
3566
2372
  }
3567
- /**
3568
- * Marks an entry as processed
3569
- */
3570
2373
  function markAsProcessed(uniqueHash, processedHashes) {
3571
2374
  if (uniqueHash != null) processedHashes.add(uniqueHash);
3572
2375
  }
3573
- /**
3574
- * Extracts unique models from entries, excluding synthetic model
3575
- */
3576
2376
  function extractUniqueModels(entries, getModel) {
3577
2377
  return uniq(entries.map(getModel).filter((m$1) => m$1 != null && m$1 !== "<synthetic>"));
3578
2378
  }
3579
- /**
3580
- * Creates a date formatter with the specified timezone and locale
3581
- * @param timezone - Timezone to use (e.g., 'UTC', 'America/New_York')
3582
- * @param locale - Locale to use for formatting (e.g., 'en-US', 'ja-JP')
3583
- * @returns Intl.DateTimeFormat instance
3584
- */
3585
2379
  function createDateFormatter(timezone, locale) {
3586
2380
  return new Intl.DateTimeFormat(locale, {
3587
2381
  year: "numeric",
@@ -3590,12 +2384,6 @@ function createDateFormatter(timezone, locale) {
3590
2384
  timeZone: timezone
3591
2385
  });
3592
2386
  }
3593
- /**
3594
- * Creates a date parts formatter with the specified timezone and locale
3595
- * @param timezone - Timezone to use
3596
- * @param locale - Locale to use for formatting
3597
- * @returns Intl.DateTimeFormat instance
3598
- */
3599
2387
  function createDatePartsFormatter(timezone, locale) {
3600
2388
  return new Intl.DateTimeFormat(locale, {
3601
2389
  year: "numeric",
@@ -3604,41 +2392,14 @@ function createDatePartsFormatter(timezone, locale) {
3604
2392
  timeZone: timezone
3605
2393
  });
3606
2394
  }
3607
- /**
3608
- * Formats a date string to YYYY-MM-DD format
3609
- * @param dateStr - Input date string
3610
- * @param timezone - Optional timezone to use for formatting
3611
- * @param locale - Optional locale to use for formatting (defaults to 'en-CA' for YYYY-MM-DD format)
3612
- * @returns Formatted date string in YYYY-MM-DD format
3613
- */
3614
2395
  function formatDate(dateStr, timezone, locale) {
3615
- const date = new Date(dateStr);
3616
- const formatter = createDateFormatter(timezone, locale ?? "en-CA");
2396
+ const date = new Date(dateStr), formatter = createDateFormatter(timezone, locale ?? "en-CA");
3617
2397
  return formatter.format(date);
3618
2398
  }
3619
- /**
3620
- * Formats a date string to compact format with year on first line and month-day on second
3621
- * @param dateStr - Input date string
3622
- * @param timezone - Timezone to use for formatting (pass undefined to use system timezone)
3623
- * @param locale - Locale to use for formatting
3624
- * @returns Formatted date string with newline separator (YYYY\nMM-DD)
3625
- */
3626
2399
  function formatDateCompact(dateStr, timezone, locale) {
3627
- const date = new Date(dateStr);
3628
- const formatter = createDatePartsFormatter(timezone, locale);
3629
- const parts = formatter.formatToParts(date);
3630
- const year = parts.find((p) => p.type === "year")?.value ?? "";
3631
- const month = parts.find((p) => p.type === "month")?.value ?? "";
3632
- const day = parts.find((p) => p.type === "day")?.value ?? "";
2400
+ const date = new Date(dateStr), formatter = createDatePartsFormatter(timezone, locale), parts = formatter.formatToParts(date), year = parts.find((p) => p.type === "year")?.value ?? "", month = parts.find((p) => p.type === "month")?.value ?? "", day = parts.find((p) => p.type === "day")?.value ?? "";
3633
2401
  return `${year}\n${month}-${day}`;
3634
2402
  }
3635
- /**
3636
- * Generic function to sort items by date based on sort order
3637
- * @param items - Array of items to sort
3638
- * @param getDate - Function to extract date/timestamp from item
3639
- * @param order - Sort order (asc or desc)
3640
- * @returns Sorted array
3641
- */
3642
2403
  function sortByDate(items, getDate, order = "desc") {
3643
2404
  const sorted = sort(items);
3644
2405
  switch (order) {
@@ -3647,23 +2408,13 @@ function sortByDate(items, getDate, order = "desc") {
3647
2408
  default: unreachable(order);
3648
2409
  }
3649
2410
  }
3650
- /**
3651
- * Create a unique identifier for deduplication using message ID and request ID
3652
- */
3653
2411
  function createUniqueHash(data) {
3654
- const messageId = data.message.id;
3655
- const requestId = data.requestId;
3656
- if (messageId == null || requestId == null) return null;
3657
- return `${messageId}:${requestId}`;
2412
+ const messageId = data.message.id, requestId = data.requestId;
2413
+ return messageId == null || requestId == null ? null : `${messageId}:${requestId}`;
3658
2414
  }
3659
- /**
3660
- * Extract the earliest timestamp from a JSONL file
3661
- * Scans through the file until it finds a valid timestamp
3662
- */
3663
2415
  async function getEarliestTimestamp(filePath) {
3664
2416
  try {
3665
- const content = await readFile(filePath, "utf-8");
3666
- const lines = content.trim().split("\n");
2417
+ const content = await readFile(filePath, "utf-8"), lines = content.trim().split("\n");
3667
2418
  let earliestDate = null;
3668
2419
  for (const line of lines) {
3669
2420
  if (line.trim() === "") continue;
@@ -3681,71 +2432,38 @@ async function getEarliestTimestamp(filePath) {
3681
2432
  }
3682
2433
  return earliestDate;
3683
2434
  } catch (error) {
3684
- logger.debug(`Failed to get earliest timestamp for ${filePath}:`, error);
3685
- return null;
2435
+ return logger.debug(`Failed to get earliest timestamp for ${filePath}:`, error), null;
3686
2436
  }
3687
2437
  }
3688
- /**
3689
- * Sort files by their earliest timestamp
3690
- * Files without valid timestamps are placed at the end
3691
- */
3692
2438
  async function sortFilesByTimestamp(files) {
3693
2439
  const filesWithTimestamps = await Promise.all(files.map(async (file) => ({
3694
2440
  file,
3695
2441
  timestamp: await getEarliestTimestamp(file)
3696
2442
  })));
3697
2443
  return filesWithTimestamps.sort((a$1, b$1) => {
3698
- if (a$1.timestamp == null && b$1.timestamp == null) return 0;
3699
- if (a$1.timestamp == null) return 1;
3700
- if (b$1.timestamp == null) return -1;
3701
- return a$1.timestamp.getTime() - b$1.timestamp.getTime();
2444
+ return a$1.timestamp == null && b$1.timestamp == null ? 0 : a$1.timestamp == null ? 1 : b$1.timestamp == null ? -1 : a$1.timestamp.getTime() - b$1.timestamp.getTime();
3702
2445
  }).map((item) => item.file);
3703
2446
  }
3704
- /**
3705
- * Calculates cost for a single usage data entry based on the specified cost calculation mode
3706
- * @param data - Usage data entry
3707
- * @param mode - Cost calculation mode (auto, calculate, or display)
3708
- * @param fetcher - Pricing fetcher instance for calculating costs from tokens
3709
- * @returns Calculated cost in USD
3710
- */
3711
2447
  async function calculateCostForEntry(data, mode, fetcher) {
3712
2448
  if (mode === "display") return data.costUSD ?? 0;
3713
- if (mode === "calculate") {
3714
- if (data.message.model != null) return unwrap(fetcher.calculateCostFromTokens(data.message.usage, data.message.model), 0);
3715
- return 0;
3716
- }
3717
- if (mode === "auto") {
3718
- if (data.costUSD != null) return data.costUSD;
3719
- if (data.message.model != null) return unwrap(fetcher.calculateCostFromTokens(data.message.usage, data.message.model), 0);
3720
- return 0;
3721
- }
2449
+ if (mode === "calculate") return data.message.model == null ? 0 : unwrap(fetcher.calculateCostFromTokens(data.message.usage, data.message.model), 0);
2450
+ if (mode === "auto") return data.costUSD == null ? data.message.model == null ? 0 : unwrap(fetcher.calculateCostFromTokens(data.message.usage, data.message.model), 0) : data.costUSD;
3722
2451
  unreachable(mode);
3723
2452
  }
3724
- /**
3725
- * Get Claude Code usage limit expiration date
3726
- * @param data - Usage data entry
3727
- * @returns Usage limit expiration date
3728
- */
3729
2453
  function getUsageLimitResetTime(data) {
3730
2454
  let resetTime = null;
3731
2455
  if (data.isApiErrorMessage === true) {
3732
2456
  const timestampMatch = data.message?.content?.find((c) => c.text != null && c.text.includes("Claude AI usage limit reached"))?.text?.match(/\|(\d+)/) ?? null;
3733
2457
  if (timestampMatch?.[1] != null) {
3734
2458
  const resetTimestamp = Number.parseInt(timestampMatch[1]);
3735
- resetTime = resetTimestamp > 0 ? new Date(resetTimestamp * 1e3) : null;
2459
+ resetTime = resetTimestamp > 0 ? /* @__PURE__ */ new Date(resetTimestamp * 1e3) : null;
3736
2460
  }
3737
2461
  }
3738
2462
  return resetTime;
3739
2463
  }
3740
- /**
3741
- * Glob files from multiple Claude paths in parallel
3742
- * @param claudePaths - Array of Claude base paths
3743
- * @returns Array of file paths with their base directories
3744
- */
3745
2464
  async function globUsageFiles(claudePaths) {
3746
2465
  const filePromises = claudePaths.map(async (claudePath) => {
3747
- const claudeDir = path.join(claudePath, CLAUDE_PROJECTS_DIR_NAME);
3748
- const files = await glob([USAGE_DATA_GLOB_PATTERN], {
2466
+ const claudeDir = path.join(claudePath, CLAUDE_PROJECTS_DIR_NAME), files = await glob([USAGE_DATA_GLOB_PATTERN], {
3749
2467
  cwd: claudeDir,
3750
2468
  absolute: true
3751
2469
  }).catch(() => []);
@@ -3756,39 +2474,21 @@ async function globUsageFiles(claudePaths) {
3756
2474
  });
3757
2475
  return (await Promise.all(filePromises)).flat();
3758
2476
  }
3759
- /**
3760
- * Loads and aggregates Claude usage data by day
3761
- * Processes all JSONL files in the Claude projects directory and groups usage by date
3762
- * @param options - Optional configuration for loading and filtering data
3763
- * @returns Array of daily usage summaries sorted by date
3764
- */
3765
2477
  async function loadDailyUsageData(options) {
3766
2478
  try {
3767
2479
  var _usingCtx = (0, import_usingCtx.default)();
3768
- const claudePaths = toArray(options?.claudePath ?? getClaudePaths());
3769
- const allFiles = await globUsageFiles(claudePaths);
3770
- const fileList = allFiles.map((f$1) => f$1.file);
2480
+ const claudePaths = toArray(options?.claudePath ?? getClaudePaths()), allFiles = await globUsageFiles(claudePaths), fileList = allFiles.map((f$1) => f$1.file);
3771
2481
  if (fileList.length === 0) return [];
3772
- const projectFilteredFiles = filterByProject(fileList, (filePath) => extractProjectFromPath(filePath), options?.project);
3773
- const sortedFiles = await sortFilesByTimestamp(projectFilteredFiles);
3774
- const mode = options?.mode ?? "auto";
3775
- const fetcher = _usingCtx.u(mode === "display" ? null : new PricingFetcher(options?.offline));
3776
- const processedHashes = new Set();
3777
- const allEntries = [];
2482
+ const projectFilteredFiles = filterByProject(fileList, (filePath) => extractProjectFromPath(filePath), options?.project), sortedFiles = await sortFilesByTimestamp(projectFilteredFiles), mode = options?.mode ?? "auto", fetcher = _usingCtx.u(mode === "display" ? null : new PricingFetcher(options?.offline)), processedHashes = /* @__PURE__ */ new Set(), allEntries = [];
3778
2483
  for (const file of sortedFiles) {
3779
- const content = await readFile(file, "utf-8");
3780
- const lines = content.trim().split("\n").filter((line) => line.length > 0);
2484
+ const content = await readFile(file, "utf-8"), lines = content.trim().split("\n").filter((line) => line.length > 0);
3781
2485
  for (const line of lines) try {
3782
- const parsed = JSON.parse(line);
3783
- const result = usageDataSchema.safeParse(parsed);
2486
+ const parsed = JSON.parse(line), result = usageDataSchema.safeParse(parsed);
3784
2487
  if (!result.success) continue;
3785
- const data = result.data;
3786
- const uniqueHash = createUniqueHash(data);
2488
+ const data = result.data, uniqueHash = createUniqueHash(data);
3787
2489
  if (isDuplicateEntry(uniqueHash, processedHashes)) continue;
3788
2490
  markAsProcessed(uniqueHash, processedHashes);
3789
- const date = formatDate(data.timestamp, options?.timezone, "en-CA");
3790
- const cost = fetcher != null ? await calculateCostForEntry(data, mode, fetcher) : data.costUSD ?? 0;
3791
- const project = extractProjectFromPath(file);
2491
+ const date = formatDate(data.timestamp, options?.timezone, "en-CA"), cost = fetcher != null ? await calculateCostForEntry(data, mode, fetcher) : data.costUSD ?? 0, project = extractProjectFromPath(file);
3792
2492
  allEntries.push({
3793
2493
  data,
3794
2494
  date,
@@ -3798,18 +2498,9 @@ async function loadDailyUsageData(options) {
3798
2498
  });
3799
2499
  } catch {}
3800
2500
  }
3801
- const needsProjectGrouping = options?.groupByProject === true || options?.project != null;
3802
- const groupingKey = needsProjectGrouping ? (entry) => `${entry.date}\x00${entry.project}` : (entry) => entry.date;
3803
- const groupedData = groupBy(allEntries, groupingKey);
3804
- const results = Object.entries(groupedData).map(([groupKey, entries]) => {
2501
+ const needsProjectGrouping = options?.groupByProject === true || options?.project != null, groupingKey = needsProjectGrouping ? (entry) => `${entry.date}\x00${entry.project}` : (entry) => entry.date, groupedData = groupBy(allEntries, groupingKey), results = Object.entries(groupedData).map(([groupKey, entries]) => {
3805
2502
  if (entries == null) return void 0;
3806
- const parts = groupKey.split("\0");
3807
- const date = parts[0] ?? groupKey;
3808
- const project = parts.length > 1 ? parts[1] : void 0;
3809
- const modelAggregates = aggregateByModel(entries, (entry) => entry.model, (entry) => entry.data.message.usage, (entry) => entry.cost);
3810
- const modelBreakdowns = createModelBreakdowns(modelAggregates);
3811
- const totals = calculateTotals(entries, (entry) => entry.data.message.usage, (entry) => entry.cost);
3812
- const modelsUsed = extractUniqueModels(entries, (e) => e.model);
2503
+ const parts = groupKey.split("\0"), date = parts[0] ?? groupKey, project = parts.length > 1 ? parts[1] : void 0, modelAggregates = aggregateByModel(entries, (entry) => entry.model, (entry) => entry.data.message.usage, (entry) => entry.cost), modelBreakdowns = createModelBreakdowns(modelAggregates), totals = calculateTotals(entries, (entry) => entry.data.message.usage, (entry) => entry.cost), modelsUsed = extractUniqueModels(entries, (e) => e.model);
3813
2504
  return {
3814
2505
  date: createDailyDate(date),
3815
2506
  ...totals,
@@ -3817,9 +2508,7 @@ async function loadDailyUsageData(options) {
3817
2508
  modelBreakdowns,
3818
2509
  ...project != null && { project }
3819
2510
  };
3820
- }).filter((item) => item != null);
3821
- const dateFiltered = filterByDateRange(results, (item) => item.date, options?.since, options?.until);
3822
- const finalFiltered = filterByProject(dateFiltered, (item) => item.project, options?.project);
2511
+ }).filter((item) => item != null), dateFiltered = filterByDateRange(results, (item) => item.date, options?.since, options?.until), finalFiltered = filterByProject(dateFiltered, (item) => item.project, options?.project);
3823
2512
  return sortByDate(finalFiltered, (item) => item.date, options?.order);
3824
2513
  } catch (_) {
3825
2514
  _usingCtx.e = _;
@@ -3827,46 +2516,24 @@ async function loadDailyUsageData(options) {
3827
2516
  _usingCtx.d();
3828
2517
  }
3829
2518
  }
3830
- /**
3831
- * Loads and aggregates Claude usage data by session
3832
- * Groups usage data by project path and session ID based on file structure
3833
- * @param options - Optional configuration for loading and filtering data
3834
- * @returns Array of session usage summaries sorted by last activity
3835
- */
3836
2519
  async function loadSessionData(options) {
3837
2520
  try {
3838
2521
  var _usingCtx3 = (0, import_usingCtx.default)();
3839
- const claudePaths = toArray(options?.claudePath ?? getClaudePaths());
3840
- const filesWithBase = await globUsageFiles(claudePaths);
2522
+ const claudePaths = toArray(options?.claudePath ?? getClaudePaths()), filesWithBase = await globUsageFiles(claudePaths);
3841
2523
  if (filesWithBase.length === 0) return [];
3842
- const projectFilteredWithBase = filterByProject(filesWithBase, (item) => extractProjectFromPath(item.file), options?.project);
3843
- const fileToBaseMap = new Map(projectFilteredWithBase.map((f$1) => [f$1.file, f$1.baseDir]));
3844
- const sortedFilesWithBase = await sortFilesByTimestamp(projectFilteredWithBase.map((f$1) => f$1.file)).then((sortedFiles) => sortedFiles.map((file) => ({
2524
+ const projectFilteredWithBase = filterByProject(filesWithBase, (item) => extractProjectFromPath(item.file), options?.project), fileToBaseMap = new Map(projectFilteredWithBase.map((f$1) => [f$1.file, f$1.baseDir])), sortedFilesWithBase = await sortFilesByTimestamp(projectFilteredWithBase.map((f$1) => f$1.file)).then((sortedFiles) => sortedFiles.map((file) => ({
3845
2525
  file,
3846
2526
  baseDir: fileToBaseMap.get(file) ?? ""
3847
- })));
3848
- const mode = options?.mode ?? "auto";
3849
- const fetcher = _usingCtx3.u(mode === "display" ? null : new PricingFetcher(options?.offline));
3850
- const processedHashes = new Set();
3851
- const allEntries = [];
2527
+ }))), mode = options?.mode ?? "auto", fetcher = _usingCtx3.u(mode === "display" ? null : new PricingFetcher(options?.offline)), processedHashes = /* @__PURE__ */ new Set(), allEntries = [];
3852
2528
  for (const { file, baseDir } of sortedFilesWithBase) {
3853
- const relativePath = path.relative(baseDir, file);
3854
- const parts = relativePath.split(path.sep);
3855
- const sessionId = parts[parts.length - 2] ?? "unknown";
3856
- const joinedPath = parts.slice(0, -2).join(path.sep);
3857
- const projectPath = joinedPath.length > 0 ? joinedPath : "Unknown Project";
3858
- const content = await readFile(file, "utf-8");
3859
- const lines = content.trim().split("\n").filter((line) => line.length > 0);
2529
+ const relativePath = path.relative(baseDir, file), parts = relativePath.split(path.sep), sessionId = parts[parts.length - 2] ?? "unknown", joinedPath = parts.slice(0, -2).join(path.sep), projectPath = joinedPath.length > 0 ? joinedPath : "Unknown Project", content = await readFile(file, "utf-8"), lines = content.trim().split("\n").filter((line) => line.length > 0);
3860
2530
  for (const line of lines) try {
3861
- const parsed = JSON.parse(line);
3862
- const result = usageDataSchema.safeParse(parsed);
2531
+ const parsed = JSON.parse(line), result = usageDataSchema.safeParse(parsed);
3863
2532
  if (!result.success) continue;
3864
- const data = result.data;
3865
- const uniqueHash = createUniqueHash(data);
2533
+ const data = result.data, uniqueHash = createUniqueHash(data);
3866
2534
  if (isDuplicateEntry(uniqueHash, processedHashes)) continue;
3867
2535
  markAsProcessed(uniqueHash, processedHashes);
3868
- const sessionKey = `${projectPath}/${sessionId}`;
3869
- const cost = fetcher != null ? await calculateCostForEntry(data, mode, fetcher) : data.costUSD ?? 0;
2536
+ const sessionKey = `${projectPath}/${sessionId}`, cost = fetcher != null ? await calculateCostForEntry(data, mode, fetcher) : data.costUSD ?? 0;
3870
2537
  allEntries.push({
3871
2538
  data,
3872
2539
  sessionKey,
@@ -3878,16 +2545,11 @@ async function loadSessionData(options) {
3878
2545
  });
3879
2546
  } catch {}
3880
2547
  }
3881
- const groupedBySessions = groupBy(allEntries, (entry) => entry.sessionKey);
3882
- const results = Object.entries(groupedBySessions).map(([_, entries]) => {
2548
+ const groupedBySessions = groupBy(allEntries, (entry) => entry.sessionKey), results = Object.entries(groupedBySessions).map(([_, entries]) => {
3883
2549
  if (entries == null) return void 0;
3884
- const latestEntry = entries.reduce((latest, current) => current.timestamp > latest.timestamp ? current : latest);
3885
- const versions = [];
2550
+ const latestEntry = entries.reduce((latest, current) => current.timestamp > latest.timestamp ? current : latest), versions = [];
3886
2551
  for (const entry of entries) if (entry.data.version != null) versions.push(entry.data.version);
3887
- const modelAggregates = aggregateByModel(entries, (entry) => entry.model, (entry) => entry.data.message.usage, (entry) => entry.cost);
3888
- const modelBreakdowns = createModelBreakdowns(modelAggregates);
3889
- const totals = calculateTotals(entries, (entry) => entry.data.message.usage, (entry) => entry.cost);
3890
- const modelsUsed = extractUniqueModels(entries, (e) => e.model);
2552
+ const modelAggregates = aggregateByModel(entries, (entry) => entry.model, (entry) => entry.data.message.usage, (entry) => entry.cost), modelBreakdowns = createModelBreakdowns(modelAggregates), totals = calculateTotals(entries, (entry) => entry.data.message.usage, (entry) => entry.cost), modelsUsed = extractUniqueModels(entries, (e) => e.model);
3891
2553
  return {
3892
2554
  sessionId: createSessionId(latestEntry.sessionId),
3893
2555
  projectPath: createProjectPath(latestEntry.projectPath),
@@ -3897,9 +2559,7 @@ async function loadSessionData(options) {
3897
2559
  modelsUsed,
3898
2560
  modelBreakdowns
3899
2561
  };
3900
- }).filter((item) => item != null);
3901
- const dateFiltered = filterByDateRange(results, (item) => item.lastActivity, options?.since, options?.until);
3902
- const sessionFiltered = filterByProject(dateFiltered, (item) => item.projectPath, options?.project);
2562
+ }).filter((item) => item != null), dateFiltered = filterByDateRange(results, (item) => item.lastActivity, options?.since, options?.until), sessionFiltered = filterByProject(dateFiltered, (item) => item.projectPath, options?.project);
3903
2563
  return sortByDate(sessionFiltered, (item) => item.lastActivity, options?.order);
3904
2564
  } catch (_) {
3905
2565
  _usingCtx3.e = _;
@@ -3907,33 +2567,16 @@ async function loadSessionData(options) {
3907
2567
  _usingCtx3.d();
3908
2568
  }
3909
2569
  }
3910
- /**
3911
- * Loads and aggregates Claude usage data by month
3912
- * Uses daily usage data as the source and groups by month
3913
- * @param options - Optional configuration for loading and filtering data
3914
- * @returns Array of monthly usage summaries sorted by month
3915
- */
3916
2570
  async function loadMonthlyUsageData(options) {
3917
2571
  return loadBucketUsageData((data) => createMonthlyDate(data.date.substring(0, 7)), options).then((usages) => usages.map(({ bucket,...rest }) => ({
3918
2572
  month: createMonthlyDate(bucket.toString()),
3919
2573
  ...rest
3920
2574
  })));
3921
2575
  }
3922
- /**
3923
- * @param date - The date to get the week for
3924
- * @param startDay - The day to start the week on (0 = Sunday, 1 = Monday, ..., 6 = Saturday)
3925
- * @returns The date of the first day of the week for the given date
3926
- */
3927
2576
  function getDateWeek(date, startDay) {
3928
- const d$1 = new Date(date);
3929
- const day = d$1.getDay();
3930
- const shift = (day - startDay + 7) % 7;
3931
- d$1.setDate(d$1.getDate() - shift);
3932
- return createWeeklyDate(d$1.toISOString().substring(0, 10));
2577
+ const d$1 = new Date(date), day = d$1.getDay(), shift = (day - startDay + 7) % 7;
2578
+ return d$1.setDate(d$1.getDate() - shift), createWeeklyDate(d$1.toISOString().substring(0, 10));
3933
2579
  }
3934
- /**
3935
- * Convert day name to number (0 = Sunday, 1 = Monday, ..., 6 = Saturday)
3936
- */
3937
2580
  function getDayNumber(day) {
3938
2581
  const dayMap = {
3939
2582
  sunday: 0,
@@ -3953,38 +2596,20 @@ async function loadWeeklyUsageData(options) {
3953
2596
  ...rest
3954
2597
  })));
3955
2598
  }
3956
- /**
3957
- * Load usage data for a specific session by sessionId
3958
- * Searches for a JSONL file named {sessionId}.jsonl in all Claude project directories
3959
- * @param sessionId - The session ID to load data for (matches the JSONL filename)
3960
- * @param options - Options for loading data
3961
- * @param options.mode - Cost calculation mode (auto, calculate, display)
3962
- * @param options.offline - Whether to use offline pricing data
3963
- * @returns Usage data for the specific session or null if not found
3964
- */
3965
2599
  async function loadSessionUsageById(sessionId, options) {
3966
2600
  try {
3967
2601
  var _usingCtx4 = (0, import_usingCtx.default)();
3968
- const claudePaths = getClaudePaths();
3969
- const patterns = claudePaths.map((p) => path.join(p, "projects", "**", `${sessionId}.jsonl`));
3970
- const jsonlFiles = await glob(patterns);
2602
+ const claudePaths = getClaudePaths(), patterns = claudePaths.map((p) => path.join(p, "projects", "**", `${sessionId}.jsonl`)), jsonlFiles = await glob(patterns);
3971
2603
  if (jsonlFiles.length === 0) return null;
3972
2604
  const file = jsonlFiles[0];
3973
2605
  if (file == null) return null;
3974
- const content = await readFile(file, "utf-8");
3975
- const lines = content.trim().split("\n").filter((line) => line.length > 0);
3976
- const mode = options?.mode ?? "auto";
3977
- const fetcher = _usingCtx4.u(mode === "display" ? null : new PricingFetcher(options?.offline));
3978
- const entries = [];
2606
+ const content = await readFile(file, "utf-8"), lines = content.trim().split("\n").filter((line) => line.length > 0), mode = options?.mode ?? "auto", fetcher = _usingCtx4.u(mode === "display" ? null : new PricingFetcher(options?.offline)), entries = [];
3979
2607
  let totalCost = 0;
3980
2608
  for (const line of lines) try {
3981
- const parsed = JSON.parse(line);
3982
- const result = usageDataSchema.safeParse(parsed);
2609
+ const parsed = JSON.parse(line), result = usageDataSchema.safeParse(parsed);
3983
2610
  if (!result.success) continue;
3984
- const data = result.data;
3985
- const cost = fetcher != null ? await calculateCostForEntry(data, mode, fetcher) : data.costUSD ?? 0;
3986
- totalCost += cost;
3987
- entries.push(data);
2611
+ const data = result.data, cost = fetcher != null ? await calculateCostForEntry(data, mode, fetcher) : data.costUSD ?? 0;
2612
+ totalCost += cost, entries.push(data);
3988
2613
  } catch {}
3989
2614
  return {
3990
2615
  totalCost,
@@ -3997,33 +2622,13 @@ async function loadSessionUsageById(sessionId, options) {
3997
2622
  }
3998
2623
  }
3999
2624
  async function loadBucketUsageData(groupingFn, options) {
4000
- const dailyData = await loadDailyUsageData(options);
4001
- const needsProjectGrouping = options?.groupByProject === true || options?.project != null;
4002
- const groupingKey = needsProjectGrouping ? (data) => `${groupingFn(data)}\x00${data.project ?? "unknown"}` : (data) => `${groupingFn(data)}`;
4003
- const grouped = groupBy(dailyData, groupingKey);
4004
- const buckets = [];
2625
+ const dailyData = await loadDailyUsageData(options), needsProjectGrouping = options?.groupByProject === true || options?.project != null, groupingKey = needsProjectGrouping ? (data) => `${groupingFn(data)}\x00${data.project ?? "unknown"}` : (data) => `${groupingFn(data)}`, grouped = groupBy(dailyData, groupingKey), buckets = [];
4005
2626
  for (const [groupKey, dailyEntries] of Object.entries(grouped)) {
4006
2627
  if (dailyEntries == null) continue;
4007
- const parts = groupKey.split("\0");
4008
- const bucket = createBucket(parts[0] ?? groupKey);
4009
- const project = parts.length > 1 ? parts[1] : void 0;
4010
- const allBreakdowns = dailyEntries.flatMap((daily) => daily.modelBreakdowns);
4011
- const modelAggregates = aggregateModelBreakdowns(allBreakdowns);
4012
- const modelBreakdowns = createModelBreakdowns(modelAggregates);
4013
- const models = [];
2628
+ const parts = groupKey.split("\0"), bucket = createBucket(parts[0] ?? groupKey), project = parts.length > 1 ? parts[1] : void 0, allBreakdowns = dailyEntries.flatMap((daily) => daily.modelBreakdowns), modelAggregates = aggregateModelBreakdowns(allBreakdowns), modelBreakdowns = createModelBreakdowns(modelAggregates), models = [];
4014
2629
  for (const data of dailyEntries) for (const model of data.modelsUsed) if (model !== "<synthetic>") models.push(model);
4015
- let totalInputTokens = 0;
4016
- let totalOutputTokens = 0;
4017
- let totalCacheCreationTokens = 0;
4018
- let totalCacheReadTokens = 0;
4019
- let totalCost = 0;
4020
- for (const daily of dailyEntries) {
4021
- totalInputTokens += daily.inputTokens;
4022
- totalOutputTokens += daily.outputTokens;
4023
- totalCacheCreationTokens += daily.cacheCreationTokens;
4024
- totalCacheReadTokens += daily.cacheReadTokens;
4025
- totalCost += daily.totalCost;
4026
- }
2630
+ let totalInputTokens = 0, totalOutputTokens = 0, totalCacheCreationTokens = 0, totalCacheReadTokens = 0, totalCost = 0;
2631
+ for (const daily of dailyEntries) totalInputTokens += daily.inputTokens, totalOutputTokens += daily.outputTokens, totalCacheCreationTokens += daily.cacheCreationTokens, totalCacheReadTokens += daily.cacheReadTokens, totalCost += daily.totalCost;
4027
2632
  const bucketUsage = {
4028
2633
  bucket,
4029
2634
  inputTokens: totalInputTokens,
@@ -4039,45 +2644,28 @@ async function loadBucketUsageData(groupingFn, options) {
4039
2644
  }
4040
2645
  return sortByDate(buckets, (item) => item.bucket, options?.order);
4041
2646
  }
4042
- /**
4043
- * Loads usage data and organizes it into session blocks (typically 5-hour billing periods)
4044
- * Processes all usage data and groups it into time-based blocks for billing analysis
4045
- * @param options - Optional configuration including session duration and filtering
4046
- * @returns Array of session blocks with usage and cost information
4047
- */
4048
2647
  async function loadSessionBlockData(options) {
4049
2648
  try {
4050
2649
  var _usingCtx5 = (0, import_usingCtx.default)();
4051
- const claudePaths = toArray(options?.claudePath ?? getClaudePaths());
4052
- const allFiles = [];
2650
+ const claudePaths = toArray(options?.claudePath ?? getClaudePaths()), allFiles = [];
4053
2651
  for (const claudePath of claudePaths) {
4054
- const claudeDir = path.join(claudePath, CLAUDE_PROJECTS_DIR_NAME);
4055
- const files = await glob([USAGE_DATA_GLOB_PATTERN], {
2652
+ const claudeDir = path.join(claudePath, CLAUDE_PROJECTS_DIR_NAME), files = await glob([USAGE_DATA_GLOB_PATTERN], {
4056
2653
  cwd: claudeDir,
4057
2654
  absolute: true
4058
2655
  });
4059
2656
  allFiles.push(...files);
4060
2657
  }
4061
2658
  if (allFiles.length === 0) return [];
4062
- const blocksFilteredFiles = filterByProject(allFiles, (filePath) => extractProjectFromPath(filePath), options?.project);
4063
- const sortedFiles = await sortFilesByTimestamp(blocksFilteredFiles);
4064
- const mode = options?.mode ?? "auto";
4065
- const fetcher = _usingCtx5.u(mode === "display" ? null : new PricingFetcher(options?.offline));
4066
- const processedHashes = new Set();
4067
- const allEntries = [];
2659
+ const blocksFilteredFiles = filterByProject(allFiles, (filePath) => extractProjectFromPath(filePath), options?.project), sortedFiles = await sortFilesByTimestamp(blocksFilteredFiles), mode = options?.mode ?? "auto", fetcher = _usingCtx5.u(mode === "display" ? null : new PricingFetcher(options?.offline)), processedHashes = /* @__PURE__ */ new Set(), allEntries = [];
4068
2660
  for (const file of sortedFiles) {
4069
- const content = await readFile(file, "utf-8");
4070
- const lines = content.trim().split("\n").filter((line) => line.length > 0);
2661
+ const content = await readFile(file, "utf-8"), lines = content.trim().split("\n").filter((line) => line.length > 0);
4071
2662
  for (const line of lines) try {
4072
- const parsed = JSON.parse(line);
4073
- const result = usageDataSchema.safeParse(parsed);
2663
+ const parsed = JSON.parse(line), result = usageDataSchema.safeParse(parsed);
4074
2664
  if (!result.success) continue;
4075
- const data = result.data;
4076
- const uniqueHash = createUniqueHash(data);
2665
+ const data = result.data, uniqueHash = createUniqueHash(data);
4077
2666
  if (isDuplicateEntry(uniqueHash, processedHashes)) continue;
4078
2667
  markAsProcessed(uniqueHash, processedHashes);
4079
- const cost = fetcher != null ? await calculateCostForEntry(data, mode, fetcher) : data.costUSD ?? 0;
4080
- const usageLimitResetTime = getUsageLimitResetTime(data);
2668
+ const cost = fetcher != null ? await calculateCostForEntry(data, mode, fetcher) : data.costUSD ?? 0, usageLimitResetTime = getUsageLimitResetTime(data);
4081
2669
  allEntries.push({
4082
2670
  timestamp: new Date(data.timestamp),
4083
2671
  usage: {
@@ -4095,12 +2683,9 @@ async function loadSessionBlockData(options) {
4095
2683
  logger.debug(`Skipping invalid JSON line in 5-hour blocks: ${error instanceof Error ? error.message : String(error)}`);
4096
2684
  }
4097
2685
  }
4098
- const blocks = identifySessionBlocks(allEntries, options?.sessionDurationHours);
4099
- const dateFiltered = options?.since != null && options.since !== "" || options?.until != null && options.until !== "" ? blocks.filter((block) => {
2686
+ const blocks = identifySessionBlocks(allEntries, options?.sessionDurationHours), dateFiltered = options?.since != null && options.since !== "" || options?.until != null && options.until !== "" ? blocks.filter((block) => {
4100
2687
  const blockDateStr = formatDate(block.startTime.toISOString(), options?.timezone, "en-CA").replace(/-/g, "");
4101
- if (options.since != null && options.since !== "" && blockDateStr < options.since) return false;
4102
- if (options.until != null && options.until !== "" && blockDateStr > options.until) return false;
4103
- return true;
2688
+ return !(options.since != null && options.since !== "" && blockDateStr < options.since || options.until != null && options.until !== "" && blockDateStr > options.until);
4104
2689
  }) : blocks;
4105
2690
  return sortByDate(dateFiltered, (block) => block.startTime, options?.order);
4106
2691
  } catch (_) {