@codeworksh/aikit 0.6.0 → 0.7.0

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,11 +1,10 @@
1
- import Type from "typebox";
2
- import { createWriteStream, existsSync, lstatSync, readdir, readdirSync, readlinkSync, realpathSync, statSync } from "fs";
3
- import { chmod, mkdir, readFile, writeFile } from "fs/promises";
4
- import { dirname, join, relative, resolve } from "path";
5
- import { Readable } from "stream";
6
- import { pipeline } from "stream/promises";
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import Type$1 from "typebox";
3
+ import { lstatSync, readdir, readdirSync, readlinkSync, realpathSync } from "fs";
4
+ import { mkdir, readFile, writeFile } from "fs/promises";
5
+ import { dirname } from "path";
7
6
  import { fileURLToPath } from "node:url";
8
- import { join as join$1, posix, resolve as resolve$1, win32 } from "node:path";
7
+ import { join, posix, resolve, win32 } from "node:path";
9
8
  import * as xi from "node:fs";
10
9
  import { lstat, readdir as readdir$1, readlink, realpath } from "node:fs/promises";
11
10
  import { EventEmitter } from "node:events";
@@ -27,6 +26,7 @@ var NamedError = class NamedError extends Error {
27
26
  const result = class extends NamedError {
28
27
  static Schema = schema;
29
28
  name = name;
29
+ data;
30
30
  constructor(data, options) {
31
31
  super(name, options);
32
32
  this.data = data;
@@ -56,133 +56,32 @@ var NamedError = class NamedError extends Error {
56
56
  };
57
57
  //#endregion
58
58
  //#region ../utils/src/filesystem.ts
59
- let Filesystem;
60
- (function(_Filesystem) {
61
- async function exists(path) {
62
- return existsSync(path);
63
- }
64
- _Filesystem.exists = exists;
65
- async function isDir(path) {
66
- try {
67
- return statSync(path).isDirectory();
68
- } catch {
69
- return false;
70
- }
71
- }
72
- _Filesystem.isDir = isDir;
73
- function stat(path) {
74
- return statSync(path, { throwIfNoEntry: false }) ?? void 0;
75
- }
76
- _Filesystem.stat = stat;
77
- async function size(path) {
78
- const result = stat(path)?.size ?? 0;
79
- return typeof result === "bigint" ? Number(result) : result;
80
- }
81
- _Filesystem.size = size;
82
- async function readText(path) {
83
- return readFile(path, "utf-8");
84
- }
85
- _Filesystem.readText = readText;
86
- async function readJson(path) {
87
- return JSON.parse(await readFile(path, "utf-8"));
88
- }
89
- _Filesystem.readJson = readJson;
90
- async function readBytes(path) {
91
- return readFile(path);
92
- }
93
- _Filesystem.readBytes = readBytes;
94
- async function readArrayBuffer(path) {
95
- const buffer = await readFile(path);
96
- return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
97
- }
98
- _Filesystem.readArrayBuffer = readArrayBuffer;
99
- function isEnoent(error) {
100
- return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
101
- }
102
- async function write(path, content, mode) {
103
- try {
59
+ async function readText(path) {
60
+ return readFile(path, "utf-8");
61
+ }
62
+ async function readJson(path) {
63
+ return JSON.parse(await readFile(path, "utf-8"));
64
+ }
65
+ function isEnoent(error) {
66
+ return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
67
+ }
68
+ async function write(path, content, mode) {
69
+ try {
70
+ if (mode) await writeFile(path, content, { mode });
71
+ else await writeFile(path, content);
72
+ } catch (error) {
73
+ if (isEnoent(error)) {
74
+ await mkdir(dirname(path), { recursive: true });
104
75
  if (mode) await writeFile(path, content, { mode });
105
76
  else await writeFile(path, content);
106
- } catch (error) {
107
- if (isEnoent(error)) {
108
- await mkdir(dirname(path), { recursive: true });
109
- if (mode) await writeFile(path, content, { mode });
110
- else await writeFile(path, content);
111
- return;
112
- }
113
- throw error;
114
- }
115
- }
116
- _Filesystem.write = write;
117
- async function writeJson(path, data, mode) {
118
- return write(path, JSON.stringify(data, null, 2), mode);
119
- }
120
- _Filesystem.writeJson = writeJson;
121
- async function writeStream(path, stream, mode) {
122
- const directory = dirname(path);
123
- if (!existsSync(directory)) await mkdir(directory, { recursive: true });
124
- await pipeline(stream instanceof ReadableStream ? Readable.fromWeb(stream) : stream, createWriteStream(path));
125
- if (mode) await chmod(path, mode);
126
- }
127
- _Filesystem.writeStream = writeStream;
128
- function normalizePath(path) {
129
- if (process.platform !== "win32") return path;
130
- try {
131
- return realpathSync.native(path);
132
- } catch {
133
- return path;
134
- }
135
- }
136
- _Filesystem.normalizePath = normalizePath;
137
- function windowsPath(p) {
138
- if (process.platform !== "win32") return p;
139
- return p.replace(/^\/([a-zA-Z]):(?:[\\/]|$)/, (_, drive) => `${drive.toUpperCase()}:/`).replace(/^\/([a-zA-Z])(?:\/|$)/, (_, drive) => `${drive.toUpperCase()}:/`).replace(/^\/cygdrive\/([a-zA-Z])(?:\/|$)/, (_, drive) => `${drive.toUpperCase()}:/`).replace(/^\/mnt\/([a-zA-Z])(?:\/|$)/, (_, drive) => `${drive.toUpperCase()}:/`);
140
- }
141
- _Filesystem.windowsPath = windowsPath;
142
- function overlaps(a, b) {
143
- const relA = relative(a, b);
144
- const relB = relative(b, a);
145
- return !relA?.startsWith("..") || !relB?.startsWith("..");
146
- }
147
- _Filesystem.overlaps = overlaps;
148
- function contains(parent, child) {
149
- return !relative(parent, child).startsWith("..");
150
- }
151
- _Filesystem.contains = contains;
152
- async function findUp(target, start, stop) {
153
- let current = start;
154
- const result = [];
155
- while (true) {
156
- const search = join(current, target);
157
- if (await exists(search)) result.push(search);
158
- if (stop === current) break;
159
- const parent = dirname(current);
160
- if (parent === current) break;
161
- current = parent;
162
- }
163
- return result;
164
- }
165
- _Filesystem.findUp = findUp;
166
- async function* up(options) {
167
- const { targets, start, stop } = options;
168
- let current = start;
169
- while (true) {
170
- for (const target of targets) {
171
- const search = join(current, target);
172
- if (await exists(search)) yield search;
173
- }
174
- if (stop === current) break;
175
- const parent = dirname(current);
176
- if (parent === current) break;
177
- current = parent;
77
+ return;
178
78
  }
79
+ throw error;
179
80
  }
180
- _Filesystem.up = up;
181
- function resolve$2(p) {
182
- return normalizePath(resolve(windowsPath(p)));
183
- }
184
- _Filesystem.resolve = resolve$2;
185
- })(Filesystem || (Filesystem = {}));
81
+ }
82
+ async function writeJson(path, data, mode) {
83
+ return write(path, JSON.stringify(data, null, 2), mode);
84
+ }
186
85
  //#endregion
187
86
  //#region ../utils/src/lazy.ts
188
87
  function lazy(fn) {
@@ -211,10 +110,12 @@ var Gt = (n, t, e) => {
211
110
  body: e.slice(r[0] + s.length, r[1]),
212
111
  post: e.slice(r[1] + i.length)
213
112
  };
214
- }, ce = (n, t) => {
113
+ };
114
+ var ce = (n, t) => {
215
115
  let e = t.match(n);
216
116
  return e ? e[0] : null;
217
- }, ss = (n, t, e) => {
117
+ };
118
+ var ss = (n, t, e) => {
218
119
  let s, i, r, o, h, a = e.indexOf(n), l = e.indexOf(t, a + 1), u = a;
219
120
  if (a >= 0 && l > 0) {
220
121
  if (n === t) return [a, l];
@@ -230,7 +131,22 @@ var Gt = (n, t, e) => {
230
131
  }
231
132
  return h;
232
133
  };
233
- var fe = "\0SLASH" + Math.random() + "\0", ue = "\0OPEN" + Math.random() + "\0", qt = "\0CLOSE" + Math.random() + "\0", de = "\0COMMA" + Math.random() + "\0", pe = "\0PERIOD" + Math.random() + "\0", is = new RegExp(fe, "g"), rs = new RegExp(ue, "g"), ns = new RegExp(qt, "g"), os = new RegExp(de, "g"), hs = new RegExp(pe, "g"), as = /\\\\/g, ls = /\\{/g, cs = /\\}/g, fs = /\\,/g, us = /\\./g, ds = 1e5;
134
+ var fe = "\0SLASH" + Math.random() + "\0";
135
+ var ue = "\0OPEN" + Math.random() + "\0";
136
+ var qt = "\0CLOSE" + Math.random() + "\0";
137
+ var de = "\0COMMA" + Math.random() + "\0";
138
+ var pe = "\0PERIOD" + Math.random() + "\0";
139
+ var is = new RegExp(fe, "g");
140
+ var rs = new RegExp(ue, "g");
141
+ var ns = new RegExp(qt, "g");
142
+ var os = new RegExp(de, "g");
143
+ var hs = new RegExp(pe, "g");
144
+ var as = /\\\\/g;
145
+ var ls = /\\{/g;
146
+ var cs = /\\}/g;
147
+ var fs = /\\,/g;
148
+ var us = /\\./g;
149
+ var ds = 1e5;
234
150
  function Ht(n) {
235
151
  return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
236
152
  }
@@ -332,7 +248,11 @@ var Ss = {
332
248
  "[:upper:]": ["\\p{Lu}", !0],
333
249
  "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
334
250
  "[:xdigit:]": ["A-Fa-f0-9", !1]
335
- }, lt = (n) => n.replace(/[[\]\\-]/g, "\\$&"), Es = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), we = (n) => n.join(""), ye = (n, t) => {
251
+ };
252
+ var lt = (n) => n.replace(/[[\]\\-]/g, "\\$&");
253
+ var Es = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
254
+ var we = (n) => n.join("");
255
+ var ye = (n, t) => {
336
256
  let e = t;
337
257
  if (n.charAt(e) !== "[") throw new Error("not in a brace expression");
338
258
  let s = [], i = [], r = e + 1, o = !1, h = !1, a = !1, l = !1, u = e, c = "";
@@ -403,13 +323,24 @@ var Ss = {
403
323
  ];
404
324
  };
405
325
  var W = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !0 } = {}) => e ? t ? n.replace(/\[([^\/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1") : t ? n.replace(/\[([^\/\\{}])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
406
- var xs = new Set([
326
+ var xs = /* @__PURE__ */ new Set([
407
327
  "!",
408
328
  "?",
409
329
  "+",
410
330
  "*",
411
331
  "@"
412
- ]), be = (n) => xs.has(n), vs = "(?!(?:^|/)\\.\\.?(?:$|/))", Ct = "(?!\\.)", Cs = new Set(["[", "."]), Ts = new Set(["..", "."]), As = /* @__PURE__ */ new Set("().*{}+?[]^$\\!"), ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Kt = "[^/]", Se = Kt + "*?", Ee = Kt + "+?", Q = class n {
332
+ ]);
333
+ var be = (n) => xs.has(n);
334
+ var vs = "(?!(?:^|/)\\.\\.?(?:$|/))";
335
+ var Ct = "(?!\\.)";
336
+ var Cs = /* @__PURE__ */ new Set(["[", "."]);
337
+ var Ts = /* @__PURE__ */ new Set(["..", "."]);
338
+ var As = /* @__PURE__ */ new Set("().*{}+?[]^$\\!");
339
+ var ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
340
+ var Kt = "[^/]";
341
+ var Se = Kt + "*?";
342
+ var Ee = Kt + "+?";
343
+ var Q = class n {
413
344
  type;
414
345
  #t;
415
346
  #s;
@@ -650,34 +581,60 @@ var xs = new Set([
650
581
  }
651
582
  };
652
583
  var tt = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !1 } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&");
653
- var O = (n, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(n)), Rs = /^\*+([^+@!?\*\[\(]*)$/, Os = (n) => (t) => !t.startsWith(".") && t.endsWith(n), Fs = (n) => (t) => t.endsWith(n), Ds = (n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n)), Ms = (n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n)), Ns = /^\*+\.\*+$/, _s = (n) => !n.startsWith(".") && n.includes("."), Ls = (n) => n !== "." && n !== ".." && n.includes("."), Ws = /^\.\*+$/, Ps = (n) => n !== "." && n !== ".." && n.startsWith("."), js = /^\*+$/, Is = (n) => n.length !== 0 && !n.startsWith("."), zs = (n) => n.length !== 0 && n !== "." && n !== "..", Bs = /^\?+([^+@!?\*\[\(]*)?$/, Us = ([n, t = ""]) => {
584
+ var O = (n, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(n));
585
+ var Rs = /^\*+([^+@!?\*\[\(]*)$/;
586
+ var Os = (n) => (t) => !t.startsWith(".") && t.endsWith(n);
587
+ var Fs = (n) => (t) => t.endsWith(n);
588
+ var Ds = (n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n));
589
+ var Ms = (n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n));
590
+ var Ns = /^\*+\.\*+$/;
591
+ var _s = (n) => !n.startsWith(".") && n.includes(".");
592
+ var Ls = (n) => n !== "." && n !== ".." && n.includes(".");
593
+ var Ws = /^\.\*+$/;
594
+ var Ps = (n) => n !== "." && n !== ".." && n.startsWith(".");
595
+ var js = /^\*+$/;
596
+ var Is = (n) => n.length !== 0 && !n.startsWith(".");
597
+ var zs = (n) => n.length !== 0 && n !== "." && n !== "..";
598
+ var Bs = /^\?+([^+@!?\*\[\(]*)?$/;
599
+ var Us = ([n, t = ""]) => {
654
600
  let e = Ce([n]);
655
601
  return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
656
- }, $s = ([n, t = ""]) => {
602
+ };
603
+ var $s = ([n, t = ""]) => {
657
604
  let e = Te([n]);
658
605
  return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
659
- }, Gs = ([n, t = ""]) => {
606
+ };
607
+ var Gs = ([n, t = ""]) => {
660
608
  let e = Te([n]);
661
609
  return t ? (s) => e(s) && s.endsWith(t) : e;
662
- }, Hs = ([n, t = ""]) => {
610
+ };
611
+ var Hs = ([n, t = ""]) => {
663
612
  let e = Ce([n]);
664
613
  return t ? (s) => e(s) && s.endsWith(t) : e;
665
- }, Ce = ([n]) => {
614
+ };
615
+ var Ce = ([n]) => {
666
616
  let t = n.length;
667
617
  return (e) => e.length === t && !e.startsWith(".");
668
- }, Te = ([n]) => {
618
+ };
619
+ var Te = ([n]) => {
669
620
  let t = n.length;
670
621
  return (e) => e.length === t && e !== "." && e !== "..";
671
- }, Ae = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", xe = {
622
+ };
623
+ var Ae = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
624
+ var xe = {
672
625
  win32: { sep: "\\" },
673
626
  posix: { sep: "/" }
674
627
  };
675
628
  O.sep = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
676
629
  var A = Symbol("globstar **");
677
630
  O.GLOBSTAR = A;
678
- var Vs = "[^/]*?", Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", Xs = "(?:(?!(?:\\/|^)\\.).)*?", Js = (n, t = {}) => (e) => O(e, n, t);
631
+ var Vs = "[^/]*?";
632
+ var Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
633
+ var Xs = "(?:(?!(?:\\/|^)\\.).)*?";
634
+ var Js = (n, t = {}) => (e) => O(e, n, t);
679
635
  O.filter = Js;
680
- var N = (n, t = {}) => Object.assign({}, n, t), Zs = (n) => {
636
+ var N = (n, t = {}) => Object.assign({}, n, t);
637
+ var Zs = (n) => {
681
638
  if (!n || typeof n != "object" || !Object.keys(n).length) return O;
682
639
  let t = O;
683
640
  return Object.assign((s, i, r = {}) => t(s, i, N(n, r)), {
@@ -718,7 +675,9 @@ var ti = (n, t, e = {}) => {
718
675
  return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n;
719
676
  };
720
677
  O.match = ti;
721
- var ve = /[?*]|[+@!]\(.*?\)|\[|\]/, ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), D = class {
678
+ var ve = /[?*]|[+@!]\(.*?\)|\[|\]/;
679
+ var ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
680
+ var D = class {
722
681
  options;
723
682
  set;
724
683
  pattern;
@@ -738,7 +697,8 @@ var ve = /[?*]|[+@!]\(.*?\)|\[|\]/, ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\
738
697
  regexp;
739
698
  constructor(t, e = {}) {
740
699
  at(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ae, this.isWindows = this.platform === "win32";
741
- this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e["allowWindowsEscape"] === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
700
+ let s = "allowWindowsEscape";
701
+ this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e[s] === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
742
702
  }
743
703
  hasMagic() {
744
704
  if (this.options.magicalBraces && this.set.length > 1) return !0;
@@ -1001,9 +961,14 @@ O.AST = Q;
1001
961
  O.Minimatch = D;
1002
962
  O.escape = tt;
1003
963
  O.unescape = W;
1004
- var si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, Oe = /* @__PURE__ */ new Set(), Vt = typeof process == "object" && process ? process : {}, Fe = (n, t, e, s) => {
964
+ var si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
965
+ var Oe = /* @__PURE__ */ new Set();
966
+ var Vt = typeof process == "object" && process ? process : {};
967
+ var Fe = (n, t, e, s) => {
1005
968
  typeof Vt.emitWarning == "function" ? Vt.emitWarning(n, t, e, s) : console.error(`[${e}] ${t}: ${n}`);
1006
- }, At = globalThis.AbortController, Re = globalThis.AbortSignal;
969
+ };
970
+ var At = globalThis.AbortController;
971
+ var Re = globalThis.AbortSignal;
1007
972
  if (typeof At > "u") {
1008
973
  Re = class {
1009
974
  onabort;
@@ -1031,11 +996,14 @@ if (typeof At > "u") {
1031
996
  };
1032
997
  }
1033
998
  var ii = (n) => !Oe.has(n);
1034
- var q = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n), De = (n) => q(n) ? n <= Math.pow(2, 8) ? Uint8Array : n <= Math.pow(2, 16) ? Uint16Array : n <= Math.pow(2, 32) ? Uint32Array : n <= Number.MAX_SAFE_INTEGER ? Tt : null : null, Tt = class extends Array {
999
+ var q = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
1000
+ var De = (n) => q(n) ? n <= Math.pow(2, 8) ? Uint8Array : n <= Math.pow(2, 16) ? Uint16Array : n <= Math.pow(2, 32) ? Uint32Array : n <= Number.MAX_SAFE_INTEGER ? Tt : null : null;
1001
+ var Tt = class extends Array {
1035
1002
  constructor(n) {
1036
1003
  super(n), this.fill(0);
1037
1004
  }
1038
- }, ri = class ct {
1005
+ };
1006
+ var ri = class ct {
1039
1007
  heap;
1040
1008
  length;
1041
1009
  static #t = !1;
@@ -1056,7 +1024,8 @@ var q = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n), De = (n) => q(n
1056
1024
  pop() {
1057
1025
  return this.heap[--this.length];
1058
1026
  }
1059
- }, ft = class Me {
1027
+ };
1028
+ var ft = class Me {
1060
1029
  #t;
1061
1030
  #s;
1062
1031
  #n;
@@ -1599,7 +1568,47 @@ var q = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n), De = (n) => q(n
1599
1568
  var Ne = typeof process == "object" && process ? process : {
1600
1569
  stdout: null,
1601
1570
  stderr: null
1602
- }, oi = (n) => !!n && typeof n == "object" && (n instanceof V || n instanceof Pe || hi(n) || ai(n)), hi = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.pipe == "function" && n.pipe !== Pe.Writable.prototype.pipe, ai = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.write == "function" && typeof n.end == "function", G = Symbol("EOF"), H = Symbol("maybeEmitEnd"), K = Symbol("emittedEnd"), kt = Symbol("emittingEnd"), ut = Symbol("emittedError"), Rt = Symbol("closed"), _e = Symbol("read"), Ot = Symbol("flush"), Le = Symbol("flushChunk"), P = Symbol("encoding"), et = Symbol("decoder"), v = Symbol("flowing"), dt = Symbol("paused"), st = Symbol("resume"), C = Symbol("buffer"), F = Symbol("pipes"), T = Symbol("bufferLength"), Yt = Symbol("bufferPush"), Ft = Symbol("bufferShift"), k = Symbol("objectMode"), x = Symbol("destroyed"), Xt = Symbol("error"), Jt = Symbol("emitData"), We = Symbol("emitEnd"), Zt = Symbol("emitEnd2"), B = Symbol("async"), Qt = Symbol("abort"), Dt = Symbol("aborted"), pt = Symbol("signal"), Y = Symbol("dataListeners"), M = Symbol("discarded"), mt = (n) => Promise.resolve().then(n), li = (n) => n(), ci = (n) => n === "end" || n === "finish" || n === "prefinish", fi = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0, ui = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n), Mt = class {
1571
+ };
1572
+ var oi = (n) => !!n && typeof n == "object" && (n instanceof V || n instanceof Pe || hi(n) || ai(n));
1573
+ var hi = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.pipe == "function" && n.pipe !== Pe.Writable.prototype.pipe;
1574
+ var ai = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.write == "function" && typeof n.end == "function";
1575
+ var G = Symbol("EOF");
1576
+ var H = Symbol("maybeEmitEnd");
1577
+ var K = Symbol("emittedEnd");
1578
+ var kt = Symbol("emittingEnd");
1579
+ var ut = Symbol("emittedError");
1580
+ var Rt = Symbol("closed");
1581
+ var _e = Symbol("read");
1582
+ var Ot = Symbol("flush");
1583
+ var Le = Symbol("flushChunk");
1584
+ var P = Symbol("encoding");
1585
+ var et = Symbol("decoder");
1586
+ var v = Symbol("flowing");
1587
+ var dt = Symbol("paused");
1588
+ var st = Symbol("resume");
1589
+ var C = Symbol("buffer");
1590
+ var F = Symbol("pipes");
1591
+ var T = Symbol("bufferLength");
1592
+ var Yt = Symbol("bufferPush");
1593
+ var Ft = Symbol("bufferShift");
1594
+ var k = Symbol("objectMode");
1595
+ var x = Symbol("destroyed");
1596
+ var Xt = Symbol("error");
1597
+ var Jt = Symbol("emitData");
1598
+ var We = Symbol("emitEnd");
1599
+ var Zt = Symbol("emitEnd2");
1600
+ var B = Symbol("async");
1601
+ var Qt = Symbol("abort");
1602
+ var Dt = Symbol("aborted");
1603
+ var pt = Symbol("signal");
1604
+ var Y = Symbol("dataListeners");
1605
+ var M = Symbol("discarded");
1606
+ var mt = (n) => Promise.resolve().then(n);
1607
+ var li = (n) => n();
1608
+ var ci = (n) => n === "end" || n === "finish" || n === "prefinish";
1609
+ var fi = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0;
1610
+ var ui = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n);
1611
+ var Mt = class {
1603
1612
  src;
1604
1613
  dest;
1605
1614
  opts;
@@ -1614,14 +1623,18 @@ var Ne = typeof process == "object" && process ? process : {
1614
1623
  end() {
1615
1624
  this.unpipe(), this.opts.end && this.dest.end();
1616
1625
  }
1617
- }, te = class extends Mt {
1626
+ };
1627
+ var te = class extends Mt {
1618
1628
  unpipe() {
1619
1629
  this.src.removeListener("error", this.proxyErrors), super.unpipe();
1620
1630
  }
1621
1631
  constructor(t, e, s) {
1622
1632
  super(t, e, s), this.proxyErrors = (i) => this.dest.emit("error", i), t.on("error", this.proxyErrors);
1623
1633
  }
1624
- }, di = (n) => !!n.objectMode, pi = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer", V = class extends EventEmitter {
1634
+ };
1635
+ var di = (n) => !!n.objectMode;
1636
+ var pi = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer";
1637
+ var V = class extends EventEmitter {
1625
1638
  [v] = !1;
1626
1639
  [dt] = !1;
1627
1640
  [F] = [];
@@ -1918,47 +1931,80 @@ while (this[Le](this[Ft]()) && this[C].length);
1918
1931
  static get isStream() {
1919
1932
  return oi;
1920
1933
  }
1921
- }, wt = {
1934
+ };
1935
+ var vi = realpathSync.native;
1936
+ var wt = {
1922
1937
  lstatSync,
1923
1938
  readdir,
1924
1939
  readdirSync,
1925
1940
  readlinkSync,
1926
- realpathSync: realpathSync.native,
1941
+ realpathSync: vi,
1927
1942
  promises: {
1928
1943
  lstat,
1929
1944
  readdir: readdir$1,
1930
1945
  readlink,
1931
1946
  realpath
1932
1947
  }
1933
- }, Ue = (n) => !n || n === wt || n === xi ? wt : {
1948
+ };
1949
+ var Ue = (n) => !n || n === wt || n === xi ? wt : {
1934
1950
  ...wt,
1935
1951
  ...n,
1936
1952
  promises: {
1937
1953
  ...wt.promises,
1938
1954
  ...n.promises || {}
1939
1955
  }
1940
- }, $e = /^\\\\\?\\([a-z]:)\\?$/i, Ri = (n) => n.replace(/\//g, "\\").replace($e, "$1\\"), Oi = /[\\\/]/, L = 0, Ge = 1, He = 2, U = 4, qe = 6, Ke = 8, X = 10, Ve = 12, _ = 15, gt = ~_, se = 16, je = 32, yt = 64, j = 128, Nt = 256, Lt = 512, Ie = yt | j | Lt, Fi = 1023, ie = (n) => n.isFile() ? Ke : n.isDirectory() ? U : n.isSymbolicLink() ? X : n.isCharacterDevice() ? He : n.isBlockDevice() ? qe : n.isSocket() ? Ve : n.isFIFO() ? Ge : L, ze = new ft({ max: 2 ** 12 }), bt = (n) => {
1956
+ };
1957
+ var $e = /^\\\\\?\\([a-z]:)\\?$/i;
1958
+ var Ri = (n) => n.replace(/\//g, "\\").replace($e, "$1\\");
1959
+ var Oi = /[\\\/]/;
1960
+ var L = 0;
1961
+ var Ge = 1;
1962
+ var He = 2;
1963
+ var U = 4;
1964
+ var qe = 6;
1965
+ var Ke = 8;
1966
+ var X = 10;
1967
+ var Ve = 12;
1968
+ var _ = 15;
1969
+ var gt = ~_;
1970
+ var se = 16;
1971
+ var je = 32;
1972
+ var yt = 64;
1973
+ var j = 128;
1974
+ var Nt = 256;
1975
+ var Lt = 512;
1976
+ var Ie = yt | j | Lt;
1977
+ var Fi = 1023;
1978
+ var ie = (n) => n.isFile() ? Ke : n.isDirectory() ? U : n.isSymbolicLink() ? X : n.isCharacterDevice() ? He : n.isBlockDevice() ? qe : n.isSocket() ? Ve : n.isFIFO() ? Ge : L;
1979
+ var ze = new ft({ max: 2 ** 12 });
1980
+ var bt = (n) => {
1941
1981
  let t = ze.get(n);
1942
1982
  if (t) return t;
1943
1983
  let e = n.normalize("NFKD");
1944
1984
  return ze.set(n, e), e;
1945
- }, Be = new ft({ max: 2 ** 12 }), _t = (n) => {
1985
+ };
1986
+ var Be = new ft({ max: 2 ** 12 });
1987
+ var _t = (n) => {
1946
1988
  let t = Be.get(n);
1947
1989
  if (t) return t;
1948
1990
  let e = bt(n.toLowerCase());
1949
1991
  return Be.set(n, e), e;
1950
- }, Wt = class extends ft {
1992
+ };
1993
+ var Wt = class extends ft {
1951
1994
  constructor() {
1952
1995
  super({ max: 256 });
1953
1996
  }
1954
- }, ne = class extends ft {
1955
- constructor(t = 16 * 1024) {
1997
+ };
1998
+ var ne = class extends ft {
1999
+ constructor(t = 16384) {
1956
2000
  super({
1957
2001
  maxSize: t,
1958
2002
  sizeCalculation: (e) => e.length + 1
1959
2003
  });
1960
2004
  }
1961
- }, Ye = Symbol("PathScurry setAsCwd"), R = class {
2005
+ };
2006
+ var Ye = Symbol("PathScurry setAsCwd");
2007
+ var R = class {
1962
2008
  name;
1963
2009
  root;
1964
2010
  roots;
@@ -2112,7 +2158,8 @@ while (this[Le](this[Ft]()) && this[C].length);
2112
2158
  if (this.#g !== void 0) return this.#g;
2113
2159
  let t = this.name, e = this.parent;
2114
2160
  if (!e) return this.#g = this.name;
2115
- return this.#g = e.fullpath() + (e.parent ? this.sep : "") + t;
2161
+ let i = e.fullpath() + (e.parent ? this.sep : "") + t;
2162
+ return this.#g = i;
2116
2163
  }
2117
2164
  fullpathPosix() {
2118
2165
  if (this.#y !== void 0) return this.#y;
@@ -2121,8 +2168,8 @@ while (this[Le](this[Ft]()) && this[C].length);
2121
2168
  let i = this.fullpath().replace(/\\/g, "/");
2122
2169
  return /^[a-z]:\//i.test(i) ? this.#y = `//?/${i}` : this.#y = i;
2123
2170
  }
2124
- let t = this.parent, e = t.fullpathPosix();
2125
- return this.#y = e + (!e || !t.parent ? "" : "/") + this.name;
2171
+ let t = this.parent, e = t.fullpathPosix(), s = e + (!e || !t.parent ? "" : "/") + this.name;
2172
+ return this.#y = s;
2126
2173
  }
2127
2174
  isUnknown() {
2128
2175
  return (this.#e & _) === L;
@@ -2370,7 +2417,8 @@ while (this[Le](this[Ft]()) && this[C].length);
2370
2417
  for (; i && i.parent;) e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
2371
2418
  for (i = t; i && i.parent && !e.has(i);) i.#x = void 0, i.#A = void 0, i = i.parent;
2372
2419
  }
2373
- }, Pt = class n extends R {
2420
+ };
2421
+ var Pt = class n extends R {
2374
2422
  sep = "\\";
2375
2423
  splitSep = Oi;
2376
2424
  constructor(t, e = L, s, i, r, o, h) {
@@ -2390,7 +2438,8 @@ while (this[Le](this[Ft]()) && this[C].length);
2390
2438
  sameRoot(t, e = this.root.name) {
2391
2439
  return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
2392
2440
  }
2393
- }, jt = class n extends R {
2441
+ };
2442
+ var jt = class n extends R {
2394
2443
  splitSep = "/";
2395
2444
  sep = "/";
2396
2445
  constructor(t, e = L, s, i, r, o, h) {
@@ -2405,7 +2454,8 @@ while (this[Le](this[Ft]()) && this[C].length);
2405
2454
  newChild(t, e = L, s = {}) {
2406
2455
  return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2407
2456
  }
2408
- }, It = class {
2457
+ };
2458
+ var It = class {
2409
2459
  root;
2410
2460
  rootPath;
2411
2461
  roots;
@@ -2415,7 +2465,7 @@ while (this[Le](this[Ft]()) && this[C].length);
2415
2465
  #n;
2416
2466
  nocase;
2417
2467
  #r;
2418
- constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: o = wt } = {}) {
2468
+ constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16384, fs: o = wt } = {}) {
2419
2469
  this.#r = Ue(o), (t instanceof URL || t.startsWith("file://")) && (t = fileURLToPath(t));
2420
2470
  let h = e.resolve(t);
2421
2471
  this.roots = Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt(), this.#s = new Wt(), this.#n = new ne(r);
@@ -2538,7 +2588,7 @@ while (this[Le](this[Ft]()) && this[C].length);
2538
2588
  typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2539
2589
  let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
2540
2590
  (!r || r(t)) && h.push(s ? t : t.fullpath());
2541
- let a = new Set([t]);
2591
+ let a = /* @__PURE__ */ new Set([t]);
2542
2592
  for (let l of a) {
2543
2593
  let u = l.readdirSync();
2544
2594
  for (let c of u) {
@@ -2566,7 +2616,7 @@ while (this[Le](this[Ft]()) && this[C].length);
2566
2616
  typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2567
2617
  let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e;
2568
2618
  (!r || r(t)) && (yield s ? t : t.fullpath());
2569
- let h = new Set([t]);
2619
+ let h = /* @__PURE__ */ new Set([t]);
2570
2620
  for (let a of h) {
2571
2621
  let l = a.readdirSync();
2572
2622
  for (let u of l) {
@@ -2649,7 +2699,8 @@ while (this[Le](this[Ft]()) && this[C].length);
2649
2699
  let e = this.cwd;
2650
2700
  this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye](e);
2651
2701
  }
2652
- }, it = class extends It {
2702
+ };
2703
+ var it = class extends It {
2653
2704
  sep = "\\";
2654
2705
  constructor(t = process.cwd(), e = {}) {
2655
2706
  let { nocase: s = !0 } = e;
@@ -2668,7 +2719,8 @@ while (this[Le](this[Ft]()) && this[C].length);
2668
2719
  isAbsolute(t) {
2669
2720
  return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
2670
2721
  }
2671
- }, rt = class extends It {
2722
+ };
2723
+ var rt = class extends It {
2672
2724
  sep = "/";
2673
2725
  constructor(t = process.cwd(), e = {}) {
2674
2726
  let { nocase: s = !1 } = e;
@@ -2686,7 +2738,8 @@ while (this[Le](this[Ft]()) && this[C].length);
2686
2738
  isAbsolute(t) {
2687
2739
  return t.startsWith("/");
2688
2740
  }
2689
- }, St = class extends rt {
2741
+ };
2742
+ var St = class extends rt {
2690
2743
  constructor(t = process.cwd(), e = {}) {
2691
2744
  let { nocase: s = !0 } = e;
2692
2745
  super(t, {
@@ -2697,7 +2750,10 @@ while (this[Le](this[Ft]()) && this[C].length);
2697
2750
  };
2698
2751
  process.platform;
2699
2752
  var Xe = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
2700
- var Di = (n) => n.length >= 1, Mi = (n) => n.length >= 1, Ni = Symbol.for("nodejs.util.inspect.custom"), nt = class n {
2753
+ var Di = (n) => n.length >= 1;
2754
+ var Mi = (n) => n.length >= 1;
2755
+ var Ni = Symbol.for("nodejs.util.inspect.custom");
2756
+ var nt = class n {
2701
2757
  #t;
2702
2758
  #s;
2703
2759
  #n;
@@ -2787,7 +2843,8 @@ var Di = (n) => n.length >= 1, Mi = (n) => n.length >= 1, Ni = Symbol.for("nodej
2787
2843
  return this.#n === 0 || !this.isGlobstar() || !this.#u ? !1 : (this.#u = !1, !0);
2788
2844
  }
2789
2845
  };
2790
- var _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", ot = class {
2846
+ var _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
2847
+ var ot = class {
2791
2848
  relative;
2792
2849
  relativeChildren;
2793
2850
  absolute;
@@ -2844,9 +2901,10 @@ var oe = class n {
2844
2901
  }
2845
2902
  storeWalked(t, e) {
2846
2903
  let s = t.fullpath(), i = this.store.get(s);
2847
- i ? i.add(e.globString()) : this.store.set(s, new Set([e.globString()]));
2904
+ i ? i.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()]));
2848
2905
  }
2849
- }, he = class {
2906
+ };
2907
+ var he = class {
2850
2908
  store = /* @__PURE__ */ new Map();
2851
2909
  add(t, e, s) {
2852
2910
  let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
@@ -2859,7 +2917,8 @@ var oe = class n {
2859
2917
  !!(e & 1)
2860
2918
  ]);
2861
2919
  }
2862
- }, ae = class {
2920
+ };
2921
+ var ae = class {
2863
2922
  store = /* @__PURE__ */ new Map();
2864
2923
  add(t, e) {
2865
2924
  if (!t.canReaddir()) return;
@@ -2877,7 +2936,8 @@ var oe = class n {
2877
2936
  keys() {
2878
2937
  return [...this.store.keys()].filter((t) => t.canReaddir());
2879
2938
  }
2880
- }, Et = class n {
2939
+ };
2940
+ var Et = class n {
2881
2941
  hasWalkedCache;
2882
2942
  matches = new he();
2883
2943
  subwalks = new ae();
@@ -2957,7 +3017,8 @@ var oe = class n {
2957
3017
  t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
2958
3018
  }
2959
3019
  };
2960
- var Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? new ot(n, t) : n, zt = class {
3020
+ var Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? new ot(n, t) : n;
3021
+ var zt = class {
2961
3022
  path;
2962
3023
  patterns;
2963
3024
  opts;
@@ -3113,7 +3174,8 @@ var Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? ne
3113
3174
  for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
3114
3175
  o();
3115
3176
  }
3116
- }, xt = class extends zt {
3177
+ };
3178
+ var xt = class extends zt {
3117
3179
  matches = /* @__PURE__ */ new Set();
3118
3180
  constructor(t, e, s) {
3119
3181
  super(t, e, s);
@@ -3135,7 +3197,8 @@ var Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? ne
3135
3197
  if (this.signal?.aborted) throw this.signal.reason;
3136
3198
  }), this.matches;
3137
3199
  }
3138
- }, vt = class extends zt {
3200
+ };
3201
+ var vt = class extends zt {
3139
3202
  results;
3140
3203
  constructor(t, e, s) {
3141
3204
  super(t, e, s), this.results = new V({
@@ -3156,7 +3219,8 @@ var Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? ne
3156
3219
  return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
3157
3220
  }
3158
3221
  };
3159
- var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", I = class {
3222
+ var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
3223
+ var I = class {
3160
3224
  absolute;
3161
3225
  cwd;
3162
3226
  root;
@@ -3196,10 +3260,13 @@ var Pi = typeof process == "object" && process && typeof process.platform == "st
3196
3260
  platform: this.platform
3197
3261
  }, e.scurry) {
3198
3262
  if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
3199
- } else this.scurry = new (e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe)(this.cwd, {
3200
- nocase: e.nocase,
3201
- fs: e.fs
3202
- });
3263
+ } else {
3264
+ let a = e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe;
3265
+ this.scurry = new a(this.cwd, {
3266
+ nocase: e.nocase,
3267
+ fs: e.fs
3268
+ });
3269
+ }
3203
3270
  this.nocase = this.scurry.nocase;
3204
3271
  let s = this.platform === "darwin" || this.platform === "win32", i = {
3205
3272
  braceExpandMax: 1e4,
@@ -3295,10 +3362,15 @@ function Ut(n, t = {}) {
3295
3362
  function es(n, t = {}) {
3296
3363
  return new I(n, t).iterate();
3297
3364
  }
3298
- var ji = Bt, Ii = Object.assign(Qe, { sync: Bt }), zi = Ut, Bi = Object.assign(es, { sync: Ut }), Ui = Object.assign(ts, {
3365
+ var ji = Bt;
3366
+ var Ii = Object.assign(Qe, { sync: Bt });
3367
+ var zi = Ut;
3368
+ var Bi = Object.assign(es, { sync: Ut });
3369
+ var Ui = Object.assign(ts, {
3299
3370
  stream: Bt,
3300
3371
  iterate: Ut
3301
- }), Ze = Object.assign(Je, {
3372
+ });
3373
+ var Ze = Object.assign(Je, {
3302
3374
  glob: Je,
3303
3375
  globSync: ts,
3304
3376
  sync: Ui,
@@ -3507,7 +3579,7 @@ function expand_(str, max, isTop) {
3507
3579
  }
3508
3580
  //#endregion
3509
3581
  //#region ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/esm/assert-valid-pattern.js
3510
- const MAX_PATTERN_LENGTH = 1024 * 64;
3582
+ const MAX_PATTERN_LENGTH = 65536;
3511
3583
  const assertValidPattern = (pattern) => {
3512
3584
  if (typeof pattern !== "string") throw new TypeError("invalid pattern");
3513
3585
  if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
@@ -3618,12 +3690,15 @@ const parseClass = (glob, position) => {
3618
3690
  glob.length - pos,
3619
3691
  true
3620
3692
  ];
3621
- if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) return [
3622
- regexpEscape(ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0]),
3623
- false,
3624
- endPos - pos,
3625
- false
3626
- ];
3693
+ if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
3694
+ const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
3695
+ return [
3696
+ regexpEscape(r),
3697
+ false,
3698
+ endPos - pos,
3699
+ false
3700
+ ];
3701
+ }
3627
3702
  const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
3628
3703
  const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
3629
3704
  return [
@@ -3661,7 +3736,7 @@ const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}
3661
3736
  //#endregion
3662
3737
  //#region ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/esm/ast.js
3663
3738
  var _a;
3664
- const types = new Set([
3739
+ const types = /* @__PURE__ */ new Set([
3665
3740
  "!",
3666
3741
  "?",
3667
3742
  "+",
@@ -3670,7 +3745,7 @@ const types = new Set([
3670
3745
  ]);
3671
3746
  const isExtglobType = (c) => types.has(c);
3672
3747
  const isExtglobAST = (c) => isExtglobType(c.type);
3673
- const adoptionMap = new Map([
3748
+ const adoptionMap = /* @__PURE__ */ new Map([
3674
3749
  ["!", ["@"]],
3675
3750
  ["?", ["?", "@"]],
3676
3751
  ["@", ["@"]],
@@ -3682,12 +3757,12 @@ const adoptionMap = new Map([
3682
3757
  ]],
3683
3758
  ["+", ["+", "@"]]
3684
3759
  ]);
3685
- const adoptionWithSpaceMap = new Map([
3760
+ const adoptionWithSpaceMap = /* @__PURE__ */ new Map([
3686
3761
  ["!", ["?"]],
3687
3762
  ["@", ["?"]],
3688
3763
  ["+", ["?", "*"]]
3689
3764
  ]);
3690
- const adoptionAnyMap = new Map([
3765
+ const adoptionAnyMap = /* @__PURE__ */ new Map([
3691
3766
  ["!", ["?", "@"]],
3692
3767
  ["?", ["?", "@"]],
3693
3768
  ["@", ["?", "@"]],
@@ -3704,27 +3779,27 @@ const adoptionAnyMap = new Map([
3704
3779
  "*"
3705
3780
  ]]
3706
3781
  ]);
3707
- const usurpMap = new Map([
3708
- ["!", new Map([["!", "@"]])],
3709
- ["?", new Map([["*", "*"], ["+", "*"]])],
3710
- ["@", new Map([
3782
+ const usurpMap = /* @__PURE__ */ new Map([
3783
+ ["!", /* @__PURE__ */ new Map([["!", "@"]])],
3784
+ ["?", /* @__PURE__ */ new Map([["*", "*"], ["+", "*"]])],
3785
+ ["@", /* @__PURE__ */ new Map([
3711
3786
  ["!", "!"],
3712
3787
  ["?", "?"],
3713
3788
  ["@", "@"],
3714
3789
  ["*", "*"],
3715
3790
  ["+", "+"]
3716
3791
  ])],
3717
- ["+", new Map([["?", "*"], ["*", "*"]])]
3792
+ ["+", /* @__PURE__ */ new Map([["?", "*"], ["*", "*"]])]
3718
3793
  ]);
3719
3794
  const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
3720
3795
  const startNoDot = "(?!\\.)";
3721
- const addPatternStart = new Set(["[", "."]);
3722
- const justDots = new Set(["..", "."]);
3796
+ const addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
3797
+ const justDots = /* @__PURE__ */ new Set(["..", "."]);
3723
3798
  const reSpecials = /* @__PURE__ */ new Set("().*{}+?[]^$\\!");
3724
3799
  const regExpEscape$1 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
3725
3800
  const qmark = "[^/]";
3726
- const star$1 = qmark + "*?";
3727
- const starNoEmpty = qmark + "+?";
3801
+ const star$1 = "[^/]*?";
3802
+ const starNoEmpty = "[^/]+?";
3728
3803
  let ID = 0;
3729
3804
  var AST = class {
3730
3805
  type;
@@ -4069,7 +4144,7 @@ var AST = class {
4069
4144
  let final = "";
4070
4145
  if (this.type === "!" && this.#emptyExt) final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
4071
4146
  else {
4072
- const close = this.type === "!" ? "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star$1 + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
4147
+ const close = this.type === "!" ? "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + "[^/]*?)" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
4073
4148
  final = start + body + close;
4074
4149
  }
4075
4150
  return [
@@ -4242,11 +4317,11 @@ const qmarksTestNoExtDot = ([$0]) => {
4242
4317
  };
4243
4318
  /* c8 ignore start */
4244
4319
  const defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
4245
- const path = {
4320
+ const path$1 = {
4246
4321
  win32: { sep: "\\" },
4247
4322
  posix: { sep: "/" }
4248
4323
  };
4249
- minimatch.sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
4324
+ minimatch.sep = defaultPlatform === "win32" ? path$1.win32.sep : path$1.posix.sep;
4250
4325
  const GLOBSTAR = Symbol("globstar **");
4251
4326
  minimatch.GLOBSTAR = GLOBSTAR;
4252
4327
  const star = "[^/]*?";
@@ -4334,7 +4409,8 @@ var Minimatch = class {
4334
4409
  this.pattern = pattern;
4335
4410
  this.platform = options.platform || defaultPlatform;
4336
4411
  this.isWindows = this.platform === "win32";
4337
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options["allowWindowsEscape"] === false;
4412
+ const awe = "allowWindowsEscape";
4413
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
4338
4414
  if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
4339
4415
  this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
4340
4416
  this.regexp = null;
@@ -4804,290 +4880,301 @@ minimatch.Minimatch = Minimatch;
4804
4880
  minimatch.escape = escape;
4805
4881
  minimatch.unescape = unescape;
4806
4882
  //#endregion
4807
- //#region ../utils/src/glob.ts
4808
- let Glob;
4809
- (function(_Glob) {
4810
- function toGlobOptions(options) {
4811
- return {
4812
- cwd: options.cwd,
4813
- absolute: options.absolute,
4814
- dot: options.dot,
4815
- follow: options.symlink ?? false,
4816
- nodir: options.include !== "all"
4817
- };
4818
- }
4819
- async function scan(pattern, options = {}) {
4820
- return await Ze(pattern, toGlobOptions(options));
4821
- }
4822
- _Glob.scan = scan;
4823
- function scanSync(pattern, options = {}) {
4824
- return ts(pattern, toGlobOptions(options));
4825
- }
4826
- _Glob.scanSync = scanSync;
4827
- function match(pattern, filepath) {
4828
- return minimatch(filepath, pattern, { dot: true });
4829
- }
4830
- _Glob.match = match;
4831
- })(Glob || (Glob = {}));
4832
- //#endregion
4833
4883
  //#region src/model/catalog.ts
4834
- let ModelCatalog;
4835
- (function(_ModelCatalog) {
4836
- const KnownProviderEnum = _ModelCatalog.KnownProviderEnum = {
4837
- anthropic: "anthropic",
4838
- google: "google",
4839
- googleVertex: "google-vertex",
4840
- googleVertexAnthropic: "google-vertex-anthropic",
4841
- openai: "openai",
4842
- openaiCompatible: "openai-compatible",
4843
- openaiCodex: "openai-codex",
4844
- openrouter: "openrouter",
4845
- xai: "xai"
4846
- };
4847
- _ModelCatalog.KnownProviderEnumSchema = Type.Union([
4848
- Type.Literal(KnownProviderEnum.anthropic),
4849
- Type.Literal(KnownProviderEnum.google),
4850
- Type.Literal(KnownProviderEnum.googleVertex),
4851
- Type.Literal(KnownProviderEnum.googleVertexAnthropic),
4852
- Type.Literal(KnownProviderEnum.openai),
4853
- Type.Literal(KnownProviderEnum.openaiCompatible),
4854
- Type.Literal(KnownProviderEnum.openaiCodex),
4855
- Type.Literal(KnownProviderEnum.openrouter),
4856
- Type.Literal(KnownProviderEnum.xai)
4857
- ]);
4858
- function projectRoot() {
4859
- return process.cwd();
4860
- }
4861
- _ModelCatalog.projectRoot = projectRoot;
4862
- const filename = _ModelCatalog.filename = "models.gen.json";
4863
- function path() {
4864
- return resolve$1(process.env.CODEWORK_MODELS_FILE ?? join$1(projectRoot(), filename));
4865
- }
4866
- _ModelCatalog.path = path;
4867
- const data = _ModelCatalog.data = lazy(async () => {
4868
- const content = await Filesystem.readText(path()).catch(() => void 0);
4869
- if (!content?.trim()) return {};
4870
- return JSON.parse(content);
4871
- });
4872
- async function get() {
4873
- return data().catch(() => ({}));
4874
- }
4875
- _ModelCatalog.get = get;
4876
- })(ModelCatalog || (ModelCatalog = {}));
4884
+ const KnownProviderEnum$1 = {
4885
+ anthropic: "anthropic",
4886
+ google: "google",
4887
+ googleVertex: "google-vertex",
4888
+ googleVertexAnthropic: "google-vertex-anthropic",
4889
+ openai: "openai",
4890
+ openaiCompatible: "openai-compatible",
4891
+ openaiCodex: "openai-codex",
4892
+ openrouter: "openrouter",
4893
+ xai: "xai"
4894
+ };
4895
+ const KnownProviderEnumSchema$1 = Type$1.Union([
4896
+ Type$1.Literal(KnownProviderEnum$1.anthropic),
4897
+ Type$1.Literal(KnownProviderEnum$1.google),
4898
+ Type$1.Literal(KnownProviderEnum$1.googleVertex),
4899
+ Type$1.Literal(KnownProviderEnum$1.googleVertexAnthropic),
4900
+ Type$1.Literal(KnownProviderEnum$1.openai),
4901
+ Type$1.Literal(KnownProviderEnum$1.openaiCompatible),
4902
+ Type$1.Literal(KnownProviderEnum$1.openaiCodex),
4903
+ Type$1.Literal(KnownProviderEnum$1.openrouter),
4904
+ Type$1.Literal(KnownProviderEnum$1.xai)
4905
+ ]);
4906
+ function projectRoot() {
4907
+ return process.cwd();
4908
+ }
4909
+ function path() {
4910
+ return resolve(process.env.CODEWORK_MODELS_FILE ?? join(projectRoot(), "models.gen.json"));
4911
+ }
4912
+ const data = lazy(async () => {
4913
+ const content = await readText(path()).catch(() => void 0);
4914
+ if (!content?.trim()) return {};
4915
+ return JSON.parse(content);
4916
+ });
4917
+ async function get() {
4918
+ return data().catch(() => ({}));
4919
+ }
4877
4920
  //#endregion
4878
4921
  //#region src/model/model.ts
4879
- let Model;
4880
- (function(_Model) {
4881
- _Model.KnownProviderEnum = ModelCatalog.KnownProviderEnum;
4882
- const KnownProviderEnumSchema = _Model.KnownProviderEnumSchema = ModelCatalog.KnownProviderEnumSchema;
4883
- const ThinkingLevelEnum = _Model.ThinkingLevelEnum = {
4884
- off: "off",
4885
- minimal: "minimal",
4886
- low: "low",
4887
- medium: "medium",
4888
- high: "high",
4889
- xhigh: "xhigh"
4890
- };
4891
- const ThinkingLevel = _Model.ThinkingLevel = Type.Union([
4892
- Type.Literal(ThinkingLevelEnum.off),
4893
- Type.Literal(ThinkingLevelEnum.minimal),
4894
- Type.Literal(ThinkingLevelEnum.low),
4895
- Type.Literal(ThinkingLevelEnum.medium),
4896
- Type.Literal(ThinkingLevelEnum.high),
4897
- Type.Literal(ThinkingLevelEnum.xhigh)
4898
- ]);
4899
- _Model.ActiveThinkingLevel = Type.Union([
4900
- Type.Literal(ThinkingLevelEnum.minimal),
4901
- Type.Literal(ThinkingLevelEnum.low),
4902
- Type.Literal(ThinkingLevelEnum.medium),
4903
- Type.Literal(ThinkingLevelEnum.high),
4904
- Type.Literal(ThinkingLevelEnum.xhigh)
4905
- ]);
4906
- const ACTIVE_THINKING_LEVELS = [
4907
- ThinkingLevelEnum.minimal,
4908
- ThinkingLevelEnum.low,
4909
- ThinkingLevelEnum.medium,
4910
- ThinkingLevelEnum.high,
4911
- ThinkingLevelEnum.xhigh
4912
- ];
4913
- const MODEL_THINKING_LEVELS = [ThinkingLevelEnum.off, ...ACTIVE_THINKING_LEVELS];
4914
- const ProviderInfo = _Model.ProviderInfo = Type.Object({
4915
- id: Type.String(),
4916
- name: Type.String(),
4917
- source: Type.Enum([
4918
- "env",
4919
- "config",
4920
- "custom",
4921
- "api",
4922
- "unknown"
4923
- ]),
4924
- env: Type.Array(Type.String()),
4925
- key: Type.Optional(Type.String()),
4926
- options: Type.Optional(Type.Record(Type.String(), Type.Any()))
4927
- });
4928
- const InputSchema = Type.Array(Type.Union([Type.Literal("text"), Type.Literal("image")]));
4929
- const CostSchema = Type.Object({
4930
- input: Type.Number(),
4931
- output: Type.Number(),
4932
- cacheRead: Type.Number(),
4933
- cacheWrite: Type.Number()
4934
- });
4935
- const SupportedProtocolsSchema = Type.Partial(Type.Object({
4936
- anthropic: KnownProviderEnumSchema,
4937
- google: KnownProviderEnumSchema,
4938
- googleVertex: KnownProviderEnumSchema,
4939
- googleVertexAnthropic: KnownProviderEnumSchema,
4940
- openai: KnownProviderEnumSchema,
4941
- openaiCompatible: KnownProviderEnumSchema,
4942
- openaiCodex: KnownProviderEnumSchema,
4943
- openrouter: KnownProviderEnumSchema,
4944
- xai: KnownProviderEnumSchema
4945
- }));
4946
- const APIMethodEnum = _Model.APIMethodEnum = {
4947
- languageModel: "languageModel",
4948
- chat: "chat",
4949
- completion: "completion",
4950
- completionModel: "completionModel",
4951
- messages: "messages",
4952
- responses: "responses"
4953
- };
4954
- const APIMethodEnumSchema = _Model.APIMethodEnumSchema = Type.Union([
4955
- Type.Literal(APIMethodEnum.languageModel),
4956
- Type.Literal(APIMethodEnum.chat),
4957
- Type.Literal(APIMethodEnum.completion),
4958
- Type.Literal(APIMethodEnum.completionModel),
4959
- Type.Literal(APIMethodEnum.messages),
4960
- Type.Literal(APIMethodEnum.responses)
4961
- ]);
4962
- const APIMetadataSchema = _Model.APIMetadataSchema = Type.Object({
4963
- id: Type.Optional(Type.String()),
4964
- url: Type.Optional(Type.String()),
4965
- method: Type.Optional(APIMethodEnumSchema)
4966
- });
4967
- const ThinkingLevelMapSchema = _Model.ThinkingLevelMapSchema = Type.Partial(Type.Record(ThinkingLevel, Type.Union([Type.String(), Type.Null()])));
4968
- const Schema = _Model.Schema = Type.Object({
4969
- id: Type.String(),
4970
- name: Type.String(),
4971
- provider: ProviderInfo,
4972
- baseUrl: Type.String(),
4973
- reasoning: Type.Boolean(),
4974
- thinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),
4975
- input: InputSchema,
4976
- cost: CostSchema,
4977
- contextWindow: Type.Number(),
4978
- maxTokens: Type.Number(),
4979
- headers: Type.Optional(Type.Record(Type.String(), Type.String())),
4980
- npm: Type.Optional(Type.String()),
4981
- api: Type.Optional(APIMetadataSchema),
4982
- providerOptionsKey: Type.Optional(Type.String()),
4983
- options: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
4984
- providerOptions: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
4985
- protocol: KnownProviderEnumSchema,
4986
- supportedProtocols: Type.Optional(SupportedProtocolsSchema)
4987
- });
4988
- const ExtrasSchema = _Model.ExtrasSchema = Type.Object({});
4989
- _Model.Info = Type.Evaluate(Type.Intersect([Schema, ExtrasSchema]));
4990
- function calculateCost(model, usage) {
4991
- usage.cost.input = usage.input / 1e6 * model.cost.input;
4992
- usage.cost.output = usage.output / 1e6 * model.cost.output;
4993
- usage.cost.cacheRead = usage.cacheRead / 1e6 * model.cost.cacheRead;
4994
- usage.cost.cacheWrite = usage.cacheWrite / 1e6 * model.cost.cacheWrite;
4995
- usage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;
4996
- }
4997
- _Model.calculateCost = calculateCost;
4998
- function normalizeInput(input) {
4999
- const normalized = /* @__PURE__ */ new Set();
5000
- for (const modality of input ?? ["text"]) if (modality === "text" || modality === "image") normalized.add(modality);
5001
- if (normalized.size === 0) normalized.add("text");
5002
- return [...normalized];
5003
- }
5004
- _Model.normalizeInput = normalizeInput;
5005
- async function getBuiltInModels() {
5006
- return await ModelCatalog.get();
5007
- }
5008
- _Model.getBuiltInModels = getBuiltInModels;
5009
- const registry = _Model.registry = lazy(async () => {
5010
- const registry = /* @__PURE__ */ new Map();
5011
- const models = await getBuiltInModels();
5012
- for (const [provider, value] of Object.entries(models)) {
5013
- const providerModels = /* @__PURE__ */ new Map();
5014
- for (const [id, model] of Object.entries(value)) providerModels.set(id, model);
5015
- registry.set(provider, providerModels);
5016
- }
5017
- return registry;
5018
- });
5019
- function supportsProtocol(model, protocol) {
5020
- if (model.protocol === protocol) return true;
5021
- return Object.values(model.supportedProtocols ?? {}).includes(protocol);
5022
- }
5023
- _Model.supportsProtocol = supportsProtocol;
5024
- async function getModel(provider, model, overrides) {
5025
- const result = (await registry()).get(provider)?.get(model);
5026
- if (result && overrides) {
5027
- if (overrides.protocol && !supportsProtocol(result, overrides.protocol)) return;
5028
- return {
5029
- ...result,
5030
- ...overrides
5031
- };
5032
- }
5033
- return result;
5034
- }
5035
- _Model.getModel = getModel;
5036
- async function getProviders() {
5037
- const data = await registry();
5038
- return Array.from(data.keys());
5039
- }
5040
- _Model.getProviders = getProviders;
5041
- async function getModels(provider) {
5042
- const models = (await registry()).get(provider);
5043
- return models ? Array.from(models.values()) : [];
5044
- }
5045
- _Model.getModels = getModels;
5046
- function modelsAreEqual(a, b) {
5047
- if (!a || !b) return false;
5048
- return a.id === b.id && a.provider.id === b.provider.id;
5049
- }
5050
- _Model.modelsAreEqual = modelsAreEqual;
5051
- function getSupportedThinkingLevels(model) {
5052
- if (!model.reasoning) return ["off"];
5053
- return MODEL_THINKING_LEVELS.filter((level) => {
5054
- const mapped = model.thinkingLevelMap?.[level];
5055
- if (mapped === null) return false;
5056
- if (level === "xhigh") return mapped !== void 0;
5057
- return true;
5058
- });
5059
- }
5060
- _Model.getSupportedThinkingLevels = getSupportedThinkingLevels;
5061
- function clampThinkingLevel(model, level) {
5062
- const availableLevels = getSupportedThinkingLevels(model);
5063
- if (availableLevels.includes(level)) return level;
5064
- const requestedIndex = MODEL_THINKING_LEVELS.indexOf(level);
5065
- if (requestedIndex === -1) return availableLevels[0] ?? "off";
5066
- for (let i = requestedIndex; i < MODEL_THINKING_LEVELS.length; i++) {
5067
- const candidate = MODEL_THINKING_LEVELS[i];
5068
- if (availableLevels.includes(candidate)) return candidate;
5069
- }
5070
- for (let i = requestedIndex - 1; i >= 0; i--) {
5071
- const candidate = MODEL_THINKING_LEVELS[i];
5072
- if (availableLevels.includes(candidate)) return candidate;
5073
- }
5074
- return availableLevels[0] ?? "off";
4922
+ var model_exports = /* @__PURE__ */ __exportAll({
4923
+ APIMetadataSchema: () => APIMetadataSchema,
4924
+ APIMethodEnum: () => APIMethodEnum,
4925
+ APIMethodEnumSchema: () => APIMethodEnumSchema,
4926
+ ActiveThinkingLevel: () => ActiveThinkingLevel,
4927
+ CompatibilitySchema: () => CompatibilitySchema,
4928
+ ExtrasSchema: () => ExtrasSchema,
4929
+ Info: () => Info,
4930
+ KnownProviderEnum: () => KnownProviderEnum,
4931
+ KnownProviderEnumSchema: () => KnownProviderEnumSchema,
4932
+ ProviderInfo: () => ProviderInfo,
4933
+ Schema: () => Schema,
4934
+ ThinkingLevel: () => ThinkingLevel,
4935
+ ThinkingLevelEnum: () => ThinkingLevelEnum,
4936
+ ThinkingLevelMapSchema: () => ThinkingLevelMapSchema,
4937
+ calculateCost: () => calculateCost,
4938
+ clampThinkingLevel: () => clampThinkingLevel,
4939
+ getBuiltInModels: () => getBuiltInModels,
4940
+ getModel: () => getModel,
4941
+ getModels: () => getModels,
4942
+ getProviders: () => getProviders,
4943
+ getSupportedThinkingLevels: () => getSupportedThinkingLevels,
4944
+ modelsAreEqual: () => modelsAreEqual,
4945
+ normalizeInput: () => normalizeInput,
4946
+ registry: () => registry,
4947
+ supportsProtocol: () => supportsProtocol
4948
+ });
4949
+ const KnownProviderEnum = KnownProviderEnum$1;
4950
+ const KnownProviderEnumSchema = KnownProviderEnumSchema$1;
4951
+ const ThinkingLevelEnum = {
4952
+ off: "off",
4953
+ minimal: "minimal",
4954
+ low: "low",
4955
+ medium: "medium",
4956
+ high: "high",
4957
+ xhigh: "xhigh",
4958
+ max: "max"
4959
+ };
4960
+ const ThinkingLevel = Type$1.Union([
4961
+ Type$1.Literal(ThinkingLevelEnum.off),
4962
+ Type$1.Literal(ThinkingLevelEnum.minimal),
4963
+ Type$1.Literal(ThinkingLevelEnum.low),
4964
+ Type$1.Literal(ThinkingLevelEnum.medium),
4965
+ Type$1.Literal(ThinkingLevelEnum.high),
4966
+ Type$1.Literal(ThinkingLevelEnum.xhigh),
4967
+ Type$1.Literal(ThinkingLevelEnum.max)
4968
+ ]);
4969
+ const ActiveThinkingLevel = Type$1.Union([
4970
+ Type$1.Literal(ThinkingLevelEnum.minimal),
4971
+ Type$1.Literal(ThinkingLevelEnum.low),
4972
+ Type$1.Literal(ThinkingLevelEnum.medium),
4973
+ Type$1.Literal(ThinkingLevelEnum.high),
4974
+ Type$1.Literal(ThinkingLevelEnum.xhigh),
4975
+ Type$1.Literal(ThinkingLevelEnum.max)
4976
+ ]);
4977
+ const ACTIVE_THINKING_LEVELS = [
4978
+ ThinkingLevelEnum.minimal,
4979
+ ThinkingLevelEnum.low,
4980
+ ThinkingLevelEnum.medium,
4981
+ ThinkingLevelEnum.high,
4982
+ ThinkingLevelEnum.xhigh,
4983
+ ThinkingLevelEnum.max
4984
+ ];
4985
+ const MODEL_THINKING_LEVELS = [ThinkingLevelEnum.off, ...ACTIVE_THINKING_LEVELS];
4986
+ const ProviderInfo = Type$1.Object({
4987
+ id: Type$1.String(),
4988
+ name: Type$1.String(),
4989
+ source: Type$1.Enum([
4990
+ "env",
4991
+ "config",
4992
+ "custom",
4993
+ "api",
4994
+ "unknown"
4995
+ ]),
4996
+ env: Type$1.Array(Type$1.String()),
4997
+ key: Type$1.Optional(Type$1.String()),
4998
+ options: Type$1.Optional(Type$1.Record(Type$1.String(), Type$1.Any()))
4999
+ });
5000
+ const InputSchema = Type$1.Array(Type$1.Union([Type$1.Literal("text"), Type$1.Literal("image")]));
5001
+ const CostRatesSchema = Type$1.Object({
5002
+ input: Type$1.Number(),
5003
+ output: Type$1.Number(),
5004
+ cacheRead: Type$1.Number(),
5005
+ cacheWrite: Type$1.Number()
5006
+ });
5007
+ const CostTierSchema = Type$1.Object({
5008
+ ...CostRatesSchema.properties,
5009
+ inputTokensAbove: Type$1.Number()
5010
+ });
5011
+ const CostSchema = Type$1.Object({
5012
+ ...CostRatesSchema.properties,
5013
+ tiers: Type$1.Optional(Type$1.Array(CostTierSchema))
5014
+ });
5015
+ const SupportedProtocolsSchema = Type$1.Partial(Type$1.Object({
5016
+ anthropic: KnownProviderEnumSchema,
5017
+ google: KnownProviderEnumSchema,
5018
+ googleVertex: KnownProviderEnumSchema,
5019
+ googleVertexAnthropic: KnownProviderEnumSchema,
5020
+ openai: KnownProviderEnumSchema,
5021
+ openaiCompatible: KnownProviderEnumSchema,
5022
+ openaiCodex: KnownProviderEnumSchema,
5023
+ openrouter: KnownProviderEnumSchema,
5024
+ xai: KnownProviderEnumSchema
5025
+ }));
5026
+ const APIMethodEnum = {
5027
+ languageModel: "languageModel",
5028
+ chat: "chat",
5029
+ completion: "completion",
5030
+ completionModel: "completionModel",
5031
+ messages: "messages",
5032
+ responses: "responses"
5033
+ };
5034
+ const APIMethodEnumSchema = Type$1.Union([
5035
+ Type$1.Literal(APIMethodEnum.languageModel),
5036
+ Type$1.Literal(APIMethodEnum.chat),
5037
+ Type$1.Literal(APIMethodEnum.completion),
5038
+ Type$1.Literal(APIMethodEnum.completionModel),
5039
+ Type$1.Literal(APIMethodEnum.messages),
5040
+ Type$1.Literal(APIMethodEnum.responses)
5041
+ ]);
5042
+ const APIMetadataSchema = Type$1.Object({
5043
+ id: Type$1.Optional(Type$1.String()),
5044
+ url: Type$1.Optional(Type$1.String()),
5045
+ method: Type$1.Optional(APIMethodEnumSchema)
5046
+ });
5047
+ const ThinkingLevelMapSchema = Type$1.Partial(Type$1.Record(ThinkingLevel, Type$1.Union([Type$1.String(), Type$1.Null()])));
5048
+ const CompatibilitySchema = Type$1.Object({
5049
+ supportsToolSearch: Type$1.Optional(Type$1.Boolean()),
5050
+ supportsAdditionalTools: Type$1.Optional(Type$1.Boolean()),
5051
+ supportsStrictMode: Type$1.Optional(Type$1.Boolean()),
5052
+ supportsOpenAIGrammarTools: Type$1.Optional(Type$1.Boolean())
5053
+ });
5054
+ const Schema = Type$1.Object({
5055
+ id: Type$1.String(),
5056
+ name: Type$1.String(),
5057
+ provider: ProviderInfo,
5058
+ baseUrl: Type$1.String(),
5059
+ reasoning: Type$1.Boolean(),
5060
+ thinkingLevelMap: Type$1.Optional(ThinkingLevelMapSchema),
5061
+ input: InputSchema,
5062
+ cost: CostSchema,
5063
+ contextWindow: Type$1.Number(),
5064
+ maxTokens: Type$1.Number(),
5065
+ headers: Type$1.Optional(Type$1.Record(Type$1.String(), Type$1.String())),
5066
+ npm: Type$1.Optional(Type$1.String()),
5067
+ api: Type$1.Optional(APIMetadataSchema),
5068
+ providerOptionsKey: Type$1.Optional(Type$1.String()),
5069
+ options: Type$1.Optional(Type$1.Record(Type$1.String(), Type$1.Unknown())),
5070
+ providerOptions: Type$1.Optional(Type$1.Record(Type$1.String(), Type$1.Unknown())),
5071
+ compat: Type$1.Optional(CompatibilitySchema),
5072
+ protocol: KnownProviderEnumSchema,
5073
+ supportedProtocols: Type$1.Optional(SupportedProtocolsSchema)
5074
+ });
5075
+ const ExtrasSchema = Type$1.Object({});
5076
+ const Info = Type$1.Evaluate(Type$1.Intersect([Schema, ExtrasSchema]));
5077
+ function calculateCost(model, usage) {
5078
+ const inputTokens = usage.input + usage.cacheRead + usage.cacheWrite;
5079
+ let rates = model.cost;
5080
+ let matchedThreshold = -1;
5081
+ for (const tier of model.cost.tiers ?? []) if (inputTokens > tier.inputTokensAbove && tier.inputTokensAbove > matchedThreshold) {
5082
+ rates = tier;
5083
+ matchedThreshold = tier.inputTokensAbove;
5084
+ }
5085
+ usage.cost.input = usage.input / 1e6 * rates.input;
5086
+ usage.cost.output = usage.output / 1e6 * rates.output;
5087
+ usage.cost.cacheRead = usage.cacheRead / 1e6 * rates.cacheRead;
5088
+ usage.cost.cacheWrite = usage.cacheWrite / 1e6 * rates.cacheWrite;
5089
+ usage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;
5090
+ }
5091
+ function normalizeInput(input) {
5092
+ const normalized = /* @__PURE__ */ new Set();
5093
+ for (const modality of input ?? ["text"]) if (modality === "text" || modality === "image") normalized.add(modality);
5094
+ if (normalized.size === 0) normalized.add("text");
5095
+ return [...normalized];
5096
+ }
5097
+ async function getBuiltInModels() {
5098
+ return await get();
5099
+ }
5100
+ const registry = lazy(async () => {
5101
+ const registry = /* @__PURE__ */ new Map();
5102
+ const models = await getBuiltInModels();
5103
+ for (const [provider, value] of Object.entries(models)) {
5104
+ const providerModels = /* @__PURE__ */ new Map();
5105
+ for (const [id, model] of Object.entries(value)) providerModels.set(id, model);
5106
+ registry.set(provider, providerModels);
5107
+ }
5108
+ return registry;
5109
+ });
5110
+ function supportsProtocol(model, protocol) {
5111
+ if (model.protocol === protocol) return true;
5112
+ return Object.values(model.supportedProtocols ?? {}).includes(protocol);
5113
+ }
5114
+ async function getModel(provider, model, overrides) {
5115
+ const result = (await registry()).get(provider)?.get(model);
5116
+ if (result && overrides) {
5117
+ if (overrides.protocol && !supportsProtocol(result, overrides.protocol)) return;
5118
+ return {
5119
+ ...result,
5120
+ ...overrides
5121
+ };
5075
5122
  }
5076
- _Model.clampThinkingLevel = clampThinkingLevel;
5077
- })(Model || (Model = {}));
5123
+ return result;
5124
+ }
5125
+ async function getProviders() {
5126
+ const data = await registry();
5127
+ return Array.from(data.keys());
5128
+ }
5129
+ async function getModels(provider) {
5130
+ const models = (await registry()).get(provider);
5131
+ return models ? Array.from(models.values()) : [];
5132
+ }
5133
+ /**
5134
+ * Check if two models are equal by comparing both their id and provider id.
5135
+ * Returns false if either model is null or undefined.
5136
+ */
5137
+ function modelsAreEqual(a, b) {
5138
+ if (!a || !b) return false;
5139
+ return a.id === b.id && a.provider.id === b.provider.id;
5140
+ }
5141
+ function getSupportedThinkingLevels(model) {
5142
+ if (!model.reasoning) return ["off"];
5143
+ return MODEL_THINKING_LEVELS.filter((level) => {
5144
+ const mapped = model.thinkingLevelMap?.[level];
5145
+ if (mapped === null) return false;
5146
+ if (level === "xhigh" || level === "max") return mapped !== void 0;
5147
+ return true;
5148
+ });
5149
+ }
5150
+ function clampThinkingLevel(model, level) {
5151
+ const availableLevels = getSupportedThinkingLevels(model);
5152
+ if (availableLevels.includes(level)) return level;
5153
+ const requestedIndex = MODEL_THINKING_LEVELS.indexOf(level);
5154
+ if (requestedIndex === -1) return availableLevels[0] ?? "off";
5155
+ for (let i = requestedIndex; i < MODEL_THINKING_LEVELS.length; i++) {
5156
+ const candidate = MODEL_THINKING_LEVELS[i];
5157
+ if (availableLevels.includes(candidate)) return candidate;
5158
+ }
5159
+ for (let i = requestedIndex - 1; i >= 0; i--) {
5160
+ const candidate = MODEL_THINKING_LEVELS[i];
5161
+ if (availableLevels.includes(candidate)) return candidate;
5162
+ }
5163
+ return availableLevels[0] ?? "off";
5164
+ }
5078
5165
  //#endregion
5079
5166
  //#region src/llm/registry.ts
5080
5167
  const DEFAULT_AI_SDK_FALLBACK = "@ai-sdk/openai-compatible";
5081
5168
  const AI_SDK_PACKAGE_TO_PROTOCOL = {
5082
- "@ai-sdk/anthropic": Model.KnownProviderEnum.anthropic,
5083
- "@ai-sdk/google": Model.KnownProviderEnum.google,
5084
- "@ai-sdk/google-vertex": Model.KnownProviderEnum.googleVertex,
5085
- "@ai-sdk/google-vertex/anthropic": Model.KnownProviderEnum.googleVertexAnthropic,
5086
- "@ai-sdk/openai": Model.KnownProviderEnum.openai,
5087
- "@ai-sdk/openai-compatible": Model.KnownProviderEnum.openaiCompatible,
5088
- "@codeworksh/ai-sdk-openai-codex": Model.KnownProviderEnum.openaiCodex,
5089
- "@openrouter/ai-sdk-provider": Model.KnownProviderEnum.openrouter,
5090
- "@ai-sdk/xai": Model.KnownProviderEnum.xai
5169
+ "@ai-sdk/anthropic": KnownProviderEnum.anthropic,
5170
+ "@ai-sdk/google": KnownProviderEnum.google,
5171
+ "@ai-sdk/google-vertex": KnownProviderEnum.googleVertex,
5172
+ "@ai-sdk/google-vertex/anthropic": KnownProviderEnum.googleVertexAnthropic,
5173
+ "@ai-sdk/openai": KnownProviderEnum.openai,
5174
+ "@ai-sdk/openai-compatible": KnownProviderEnum.openaiCompatible,
5175
+ "@codeworksh/ai-sdk-openai-codex": KnownProviderEnum.openaiCodex,
5176
+ "@openrouter/ai-sdk-provider": KnownProviderEnum.openrouter,
5177
+ "@ai-sdk/xai": KnownProviderEnum.xai
5091
5178
  };
5092
5179
  const PROVIDER_LOADERS = {
5093
5180
  "@ai-sdk/anthropic": () => import("@ai-sdk/anthropic").then((m) => m.createAnthropic),
@@ -5098,7 +5185,7 @@ const PROVIDER_LOADERS = {
5098
5185
  "@ai-sdk/openai-compatible": () => import("@ai-sdk/openai-compatible").then((m) => m.createOpenAICompatible),
5099
5186
  "@openrouter/ai-sdk-provider": () => import("@openrouter/ai-sdk-provider").then((m) => m.createOpenRouter),
5100
5187
  "@ai-sdk/xai": () => import("@ai-sdk/xai").then((m) => m.createXai),
5101
- "@codeworksh/ai-sdk-openai-codex": () => import("./openai-codex-bzfev3us.mjs").then((m) => m.createOpenAICodex)
5188
+ "@codeworksh/ai-sdk-openai-codex": () => import("./openai-codex-FcyE8vxh.mjs").then((m) => m.createOpenAICodex)
5102
5189
  };
5103
5190
  function isAISDKPackage(value) {
5104
5191
  return value in AI_SDK_PACKAGE_TO_PROTOCOL;
@@ -5108,34 +5195,35 @@ function packageForModel(model) {
5108
5195
  return isAISDKPackage(npm) ? npm : DEFAULT_AI_SDK_FALLBACK;
5109
5196
  }
5110
5197
  function protocolForPackage(npm) {
5111
- return AI_SDK_PACKAGE_TO_PROTOCOL[npm && isAISDKPackage(npm) ? npm : DEFAULT_AI_SDK_FALLBACK];
5198
+ const resolved = npm && isAISDKPackage(npm) ? npm : DEFAULT_AI_SDK_FALLBACK;
5199
+ return AI_SDK_PACKAGE_TO_PROTOCOL[resolved];
5112
5200
  }
5113
5201
  async function loadProviderFactory(npm) {
5114
5202
  return PROVIDER_LOADERS[npm]();
5115
5203
  }
5116
5204
  function defaultMethodForModel(model) {
5117
- if (model.protocol === Model.KnownProviderEnum.openai || model.protocol === Model.KnownProviderEnum.openaiCodex || model.protocol === Model.KnownProviderEnum.xai) return Model.APIMethodEnum.responses;
5118
- return Model.APIMethodEnum.languageModel;
5205
+ if (model.protocol === KnownProviderEnum.openai || model.protocol === KnownProviderEnum.openaiCodex || model.protocol === KnownProviderEnum.xai) return APIMethodEnum.responses;
5206
+ return APIMethodEnum.languageModel;
5119
5207
  }
5120
5208
  function resolveLanguageModel(provider, model, methodOverride) {
5121
5209
  const modelId = model.api?.id ?? model.id;
5122
5210
  const method = methodOverride ?? model.api?.method ?? defaultMethodForModel(model);
5123
5211
  const callable = provider;
5124
- if (method === Model.APIMethodEnum.responses && callable.responses) return callable.responses(modelId);
5125
- if (method === Model.APIMethodEnum.messages && callable.messages) return callable.messages(modelId);
5126
- if (method === Model.APIMethodEnum.chat) {
5212
+ if (method === APIMethodEnum.responses && callable.responses) return callable.responses(modelId);
5213
+ if (method === APIMethodEnum.messages && callable.messages) return callable.messages(modelId);
5214
+ if (method === APIMethodEnum.chat) {
5127
5215
  if (callable.chat) return callable.chat(modelId);
5128
5216
  if (callable.chatModel) return callable.chatModel(modelId);
5129
5217
  }
5130
- if (method === Model.APIMethodEnum.completion) {
5218
+ if (method === APIMethodEnum.completion) {
5131
5219
  if (callable.completion) return callable.completion(modelId);
5132
5220
  if (callable.completionModel) return callable.completionModel(modelId);
5133
5221
  }
5134
- if (method === Model.APIMethodEnum.completionModel && callable.completionModel) return callable.completionModel(modelId);
5222
+ if (method === APIMethodEnum.completionModel && callable.completionModel) return callable.completionModel(modelId);
5135
5223
  if (callable.languageModel) return callable.languageModel(modelId);
5136
5224
  return callable(modelId);
5137
5225
  }
5138
5226
  //#endregion
5139
- export { protocolForPackage as a, ModelCatalog as c, NamedError as d, packageForModel as i, lazy as l, isAISDKPackage as n, resolveLanguageModel as o, loadProviderFactory as r, Model as s, DEFAULT_AI_SDK_FALLBACK as t, Filesystem as u };
5227
+ export { lazy as C, NamedError as E, path as S, writeJson as T, getProviders as _, protocolForPackage as a, normalizeInput as b, APIMethodEnumSchema as c, KnownProviderEnumSchema as d, ProviderInfo as f, getModels as g, getModel as h, packageForModel as i, ActiveThinkingLevel as l, clampThinkingLevel as m, isAISDKPackage as n, resolveLanguageModel as o, calculateCost as p, loadProviderFactory as r, APIMethodEnum as s, DEFAULT_AI_SDK_FALLBACK as t, KnownProviderEnum as u, model_exports as v, readJson as w, registry as x, modelsAreEqual as y };
5140
5228
 
5141
- //# sourceMappingURL=registry-DUKrGxt4.mjs.map
5229
+ //# sourceMappingURL=registry-CMkIE_B4.mjs.map