@pydantic/genai-prices 0.0.39 → 0.0.41

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.
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import de from "yargs";
3
3
  import { format as he } from "util";
4
- import { resolve as ae, normalize as Ie } from "path";
4
+ import { resolve as ie, normalize as Ie } from "path";
5
5
  import { readFileSync as _e, writeFile as Le, statSync as Pe } from "fs";
6
6
  import "assert";
7
7
  import { fileURLToPath as Te } from "url";
@@ -14,53 +14,53 @@ function Se() {
14
14
  function Ge() {
15
15
  return !!process.versions.electron;
16
16
  }
17
- function Ce(i) {
18
- return i.slice(Ae() + 1);
17
+ function Ce(a) {
18
+ return a.slice(Ae() + 1);
19
19
  }
20
20
  /**
21
21
  * @license
22
22
  * Copyright (c) 2016, Contributors
23
23
  * SPDX-License-Identifier: ISC
24
24
  */
25
- function W(i) {
26
- if (i !== i.toLowerCase() && i !== i.toUpperCase() || (i = i.toLowerCase()), i.indexOf("-") === -1 && i.indexOf("_") === -1)
27
- return i;
25
+ function W(a) {
26
+ if (a !== a.toLowerCase() && a !== a.toUpperCase() || (a = a.toLowerCase()), a.indexOf("-") === -1 && a.indexOf("_") === -1)
27
+ return a;
28
28
  {
29
29
  let m = "", s = !1;
30
- const u = i.match(/^-+/);
31
- for (let k = u ? u[0].length : 0; k < i.length; k++) {
32
- let _ = i.charAt(k);
30
+ const u = a.match(/^-+/);
31
+ for (let k = u ? u[0].length : 0; k < a.length; k++) {
32
+ let _ = a.charAt(k);
33
33
  s && (s = !1, _ = _.toUpperCase()), k !== 0 && (_ === "-" || _ === "_") ? s = !0 : _ !== "-" && _ !== "_" && (m += _);
34
34
  }
35
35
  return m;
36
36
  }
37
37
  }
38
- function Oe(i, n) {
39
- const m = i.toLowerCase();
38
+ function Oe(a, n) {
39
+ const m = a.toLowerCase();
40
40
  n = n || "-";
41
41
  let s = "";
42
- for (let u = 0; u < i.length; u++) {
43
- const k = m.charAt(u), _ = i.charAt(u);
42
+ for (let u = 0; u < a.length; u++) {
43
+ const k = m.charAt(u), _ = a.charAt(u);
44
44
  k !== _ && u > 0 ? s += `${n}${m.charAt(u)}` : s += _;
45
45
  }
46
46
  return s;
47
47
  }
48
- function Re(i) {
49
- return i == null ? !1 : typeof i == "number" || /^0x[0-9a-f]+$/i.test(i) ? !0 : /^0[^.]/.test(i) ? !1 : /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i);
48
+ function Re(a) {
49
+ return a == null ? !1 : typeof a == "number" || /^0x[0-9a-f]+$/i.test(a) ? !0 : /^0[^.]/.test(a) ? !1 : /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(a);
50
50
  }
51
51
  /**
52
52
  * @license
53
53
  * Copyright (c) 2016, Contributors
54
54
  * SPDX-License-Identifier: ISC
55
55
  */
56
- function Ee(i) {
57
- if (Array.isArray(i))
58
- return i.map((_) => typeof _ != "string" ? _ + "" : _);
59
- i = i.trim();
56
+ function Ee(a) {
57
+ if (Array.isArray(a))
58
+ return a.map((_) => typeof _ != "string" ? _ + "" : _);
59
+ a = a.trim();
60
60
  let n = 0, m = null, s = null, u = null;
61
61
  const k = [];
62
- for (let _ = 0; _ < i.length; _++) {
63
- if (m = s, s = i.charAt(_), s === " " && !u) {
62
+ for (let _ = 0; _ < a.length; _++) {
63
+ if (m = s, s = a.charAt(_), s === " " && !u) {
64
64
  m !== " " && n++;
65
65
  continue;
66
66
  }
@@ -74,8 +74,8 @@ function Ee(i) {
74
74
  * SPDX-License-Identifier: ISC
75
75
  */
76
76
  var I;
77
- (function(i) {
78
- i.BOOLEAN = "boolean", i.STRING = "string", i.NUMBER = "number", i.ARRAY = "array";
77
+ (function(a) {
78
+ a.BOOLEAN = "boolean", a.STRING = "string", a.NUMBER = "number", a.ARRAY = "array";
79
79
  })(I || (I = {}));
80
80
  /**
81
81
  * @license
@@ -138,14 +138,14 @@ class Ne {
138
138
  keys: []
139
139
  }, L = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/, U = new RegExp("^--" + h["negation-prefix"] + "(.+)");
140
140
  [].concat(s.array || []).filter(Boolean).forEach(function(e) {
141
- const a = typeof e == "object" ? e.key : e, l = Object.keys(e).map(function(o) {
141
+ const i = typeof e == "object" ? e.key : e, c = Object.keys(e).map(function(o) {
142
142
  return {
143
143
  boolean: "bools",
144
144
  string: "strings",
145
145
  number: "numbers"
146
146
  }[o];
147
147
  }).filter(Boolean).pop();
148
- l && (r[l][a] = !0), r.arrays[a] = !0, r.keys.push(a);
148
+ c && (r[c][i] = !0), r.arrays[i] = !0, r.keys.push(i);
149
149
  }), [].concat(s.boolean || []).filter(Boolean).forEach(function(e) {
150
150
  r.bools[e] = !0, r.keys.push(e);
151
151
  }), [].concat(s.string || []).filter(Boolean).forEach(function(e) {
@@ -156,17 +156,17 @@ class Ne {
156
156
  r.counts[e] = !0, r.keys.push(e);
157
157
  }), [].concat(s.normalize || []).filter(Boolean).forEach(function(e) {
158
158
  r.normalize[e] = !0, r.keys.push(e);
159
- }), typeof s.narg == "object" && Object.entries(s.narg).forEach(([e, a]) => {
160
- typeof a == "number" && (r.nargs[e] = a, r.keys.push(e));
161
- }), typeof s.coerce == "object" && Object.entries(s.coerce).forEach(([e, a]) => {
162
- typeof a == "function" && (r.coercions[e] = a, r.keys.push(e));
159
+ }), typeof s.narg == "object" && Object.entries(s.narg).forEach(([e, i]) => {
160
+ typeof i == "number" && (r.nargs[e] = i, r.keys.push(e));
161
+ }), typeof s.coerce == "object" && Object.entries(s.coerce).forEach(([e, i]) => {
162
+ typeof i == "function" && (r.coercions[e] = i, r.keys.push(e));
163
163
  }), typeof s.config < "u" && (Array.isArray(s.config) || typeof s.config == "string" ? [].concat(s.config).filter(Boolean).forEach(function(e) {
164
164
  r.configs[e] = !0;
165
- }) : typeof s.config == "object" && Object.entries(s.config).forEach(([e, a]) => {
166
- (typeof a == "boolean" || typeof a == "function") && (r.configs[e] = a);
165
+ }) : typeof s.config == "object" && Object.entries(s.config).forEach(([e, i]) => {
166
+ (typeof i == "boolean" || typeof i == "function") && (r.configs[e] = i);
167
167
  })), qe(s.key, _, s.default, r.arrays), Object.keys(f).forEach(function(e) {
168
- (r.aliases[e] || []).forEach(function(a) {
169
- f[a] = f[e];
168
+ (r.aliases[e] || []).forEach(function(i) {
169
+ f[i] = f[e];
170
170
  });
171
171
  });
172
172
  let B = null;
@@ -174,28 +174,28 @@ class Ne {
174
174
  let F = [];
175
175
  const w = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] }), ne = {};
176
176
  for (let e = 0; e < u.length; e++) {
177
- const a = u[e], l = a.replace(/^-{3,}/, "---");
178
- let o, t, p, c, d, v;
179
- if (a !== "--" && /^-/.test(a) && H(a))
180
- K(a);
181
- else if (l.match(/^---+(=|$)/)) {
182
- K(a);
177
+ const i = u[e], c = i.replace(/^-{3,}/, "---");
178
+ let o, t, p, l, d, v;
179
+ if (i !== "--" && /^-/.test(i) && H(i))
180
+ K(i);
181
+ else if (c.match(/^---+(=|$)/)) {
182
+ K(i);
183
183
  continue;
184
- } else if (a.match(/^--.+=/) || !h["short-option-groups"] && a.match(/^-.+=/))
185
- c = a.match(/^--?([^=]+)=([\s\S]*)$/), c !== null && Array.isArray(c) && c.length >= 3 && (g(c[1], r.arrays) ? e = V(e, c[1], u, c[2]) : g(c[1], r.nargs) !== !1 ? e = D(e, c[1], u, c[2]) : q(c[1], c[2], !0));
186
- else if (a.match(U) && h["boolean-negation"])
187
- c = a.match(U), c !== null && Array.isArray(c) && c.length >= 2 && (t = c[1], q(t, g(t, r.arrays) ? [!1] : !1));
188
- else if (a.match(/^--.+/) || !h["short-option-groups"] && a.match(/^-[^-]+/))
189
- c = a.match(/^--?(.+)/), c !== null && Array.isArray(c) && c.length >= 2 && (t = c[1], g(t, r.arrays) ? e = V(e, t, u) : g(t, r.nargs) !== !1 ? e = D(e, t, u) : (d = u[e + 1], d !== void 0 && (!d.match(/^-/) || d.match(L)) && !g(t, r.bools) && !g(t, r.counts) || /^(true|false)$/.test(d) ? (q(t, d), e++) : q(t, R(t))));
190
- else if (a.match(/^-.\..+=/))
191
- c = a.match(/^-([^=]+)=([\s\S]*)$/), c !== null && Array.isArray(c) && c.length >= 3 && q(c[1], c[2]);
192
- else if (a.match(/^-.\..+/) && !a.match(L))
193
- d = u[e + 1], c = a.match(/^-(.\..+)/), c !== null && Array.isArray(c) && c.length >= 2 && (t = c[1], d !== void 0 && !d.match(/^-/) && !g(t, r.bools) && !g(t, r.counts) ? (q(t, d), e++) : q(t, R(t)));
194
- else if (a.match(/^-[^-]+/) && !a.match(L)) {
195
- p = a.slice(1, -1).split(""), o = !1;
184
+ } else if (i.match(/^--.+=/) || !h["short-option-groups"] && i.match(/^-.+=/))
185
+ l = i.match(/^--?([^=]+)=([\s\S]*)$/), l !== null && Array.isArray(l) && l.length >= 3 && (g(l[1], r.arrays) ? e = V(e, l[1], u, l[2]) : g(l[1], r.nargs) !== !1 ? e = D(e, l[1], u, l[2]) : q(l[1], l[2], !0));
186
+ else if (i.match(U) && h["boolean-negation"])
187
+ l = i.match(U), l !== null && Array.isArray(l) && l.length >= 2 && (t = l[1], q(t, g(t, r.arrays) ? [!1] : !1));
188
+ else if (i.match(/^--.+/) || !h["short-option-groups"] && i.match(/^-[^-]+/))
189
+ l = i.match(/^--?(.+)/), l !== null && Array.isArray(l) && l.length >= 2 && (t = l[1], g(t, r.arrays) ? e = V(e, t, u) : g(t, r.nargs) !== !1 ? e = D(e, t, u) : (d = u[e + 1], d !== void 0 && (!d.match(/^-/) || d.match(L)) && !g(t, r.bools) && !g(t, r.counts) || /^(true|false)$/.test(d) ? (q(t, d), e++) : q(t, R(t))));
190
+ else if (i.match(/^-.\..+=/))
191
+ l = i.match(/^-([^=]+)=([\s\S]*)$/), l !== null && Array.isArray(l) && l.length >= 3 && q(l[1], l[2]);
192
+ else if (i.match(/^-.\..+/) && !i.match(L))
193
+ d = u[e + 1], l = i.match(/^-(.\..+)/), l !== null && Array.isArray(l) && l.length >= 2 && (t = l[1], d !== void 0 && !d.match(/^-/) && !g(t, r.bools) && !g(t, r.counts) ? (q(t, d), e++) : q(t, R(t)));
194
+ else if (i.match(/^-[^-]+/) && !i.match(L)) {
195
+ p = i.slice(1, -1).split(""), o = !1;
196
196
  for (let x = 0; x < p.length; x++) {
197
- if (d = a.slice(x + 2), p[x + 1] && p[x + 1] === "=") {
198
- v = a.slice(x + 3), t = p[x], g(t, r.arrays) ? e = V(e, t, u, v) : g(t, r.nargs) !== !1 ? e = D(e, t, u, v) : q(t, v), o = !0;
197
+ if (d = i.slice(x + 2), p[x + 1] && p[x + 1] === "=") {
198
+ v = i.slice(x + 3), t = p[x], g(t, r.arrays) ? e = V(e, t, u, v) : g(t, r.nargs) !== !1 ? e = D(e, t, u, v) : q(t, v), o = !0;
199
199
  break;
200
200
  }
201
201
  if (d === "-") {
@@ -212,17 +212,17 @@ class Ne {
212
212
  } else
213
213
  q(p[x], R(p[x]));
214
214
  }
215
- t = a.slice(-1)[0], !o && t !== "-" && (g(t, r.arrays) ? e = V(e, t, u) : g(t, r.nargs) !== !1 ? e = D(e, t, u) : (d = u[e + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(L)) && !g(t, r.bools) && !g(t, r.counts) || /^(true|false)$/.test(d) ? (q(t, d), e++) : q(t, R(t))));
216
- } else if (a.match(/^-[0-9]$/) && a.match(L) && g(a.slice(1), r.bools))
217
- t = a.slice(1), q(t, R(t));
218
- else if (a === "--") {
215
+ t = i.slice(-1)[0], !o && t !== "-" && (g(t, r.arrays) ? e = V(e, t, u) : g(t, r.nargs) !== !1 ? e = D(e, t, u) : (d = u[e + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(L)) && !g(t, r.bools) && !g(t, r.counts) || /^(true|false)$/.test(d) ? (q(t, d), e++) : q(t, R(t))));
216
+ } else if (i.match(/^-[0-9]$/) && i.match(L) && g(i.slice(1), r.bools))
217
+ t = i.slice(1), q(t, R(t));
218
+ else if (i === "--") {
219
219
  F = u.slice(e + 1);
220
220
  break;
221
221
  } else if (h["halt-at-non-option"]) {
222
222
  F = u.slice(e);
223
223
  break;
224
224
  } else
225
- K(a);
225
+ K(i);
226
226
  }
227
227
  re(w, !0), re(w, !1), ke(w), ge(), me(w, r.aliases, f, !0), fe(w), h["set-placeholder-key"] && be(w), Object.keys(r.counts).forEach(function(e) {
228
228
  E(w, e.split(".")) || q(e, 0);
@@ -231,97 +231,97 @@ class Ne {
231
231
  }), h["camel-case-expansion"] && h["strip-dashed"] && Object.keys(w).filter((e) => e !== "--" && e.includes("-")).forEach((e) => {
232
232
  delete w[e];
233
233
  }), h["strip-aliased"] && [].concat(...Object.keys(_).map((e) => _[e])).forEach((e) => {
234
- h["camel-case-expansion"] && e.includes("-") && delete w[e.split(".").map((a) => W(a)).join(".")], delete w[e];
234
+ h["camel-case-expansion"] && e.includes("-") && delete w[e.split(".").map((i) => W(i)).join(".")], delete w[e];
235
235
  });
236
236
  function K(e) {
237
- const a = $("_", e);
238
- (typeof a == "string" || typeof a == "number") && w._.push(a);
237
+ const i = $("_", e);
238
+ (typeof i == "string" || typeof i == "number") && w._.push(i);
239
239
  }
240
- function D(e, a, l, o) {
241
- let t, p = g(a, r.nargs);
240
+ function D(e, i, c, o) {
241
+ let t, p = g(i, r.nargs);
242
242
  if (p = typeof p != "number" || isNaN(p) ? 1 : p, p === 0)
243
- return T(o) || (B = Error(C("Argument unexpected for: %s", a))), q(a, R(a)), e;
244
- let c = T(o) ? 0 : 1;
243
+ return T(o) || (B = Error(C("Argument unexpected for: %s", i))), q(i, R(i)), e;
244
+ let l = T(o) ? 0 : 1;
245
245
  if (h["nargs-eats-options"])
246
- l.length - (e + 1) + c < p && (B = Error(C("Not enough arguments following: %s", a))), c = p;
246
+ c.length - (e + 1) + l < p && (B = Error(C("Not enough arguments following: %s", i))), l = p;
247
247
  else {
248
- for (t = e + 1; t < l.length && (!l[t].match(/^-[^0-9]/) || l[t].match(L) || H(l[t])); t++)
249
- c++;
250
- c < p && (B = Error(C("Not enough arguments following: %s", a)));
248
+ for (t = e + 1; t < c.length && (!c[t].match(/^-[^0-9]/) || c[t].match(L) || H(c[t])); t++)
249
+ l++;
250
+ l < p && (B = Error(C("Not enough arguments following: %s", i)));
251
251
  }
252
- let d = Math.min(c, p);
253
- for (!T(o) && d > 0 && (q(a, o), d--), t = e + 1; t < d + e + 1; t++)
254
- q(a, l[t]);
252
+ let d = Math.min(l, p);
253
+ for (!T(o) && d > 0 && (q(i, o), d--), t = e + 1; t < d + e + 1; t++)
254
+ q(i, c[t]);
255
255
  return e + d;
256
256
  }
257
- function V(e, a, l, o) {
258
- let t = [], p = o || l[e + 1];
259
- const c = g(a, r.nargs);
260
- if (g(a, r.bools) && !/^(true|false)$/.test(p))
257
+ function V(e, i, c, o) {
258
+ let t = [], p = o || c[e + 1];
259
+ const l = g(i, r.nargs);
260
+ if (g(i, r.bools) && !/^(true|false)$/.test(p))
261
261
  t.push(!0);
262
262
  else if (T(p) || T(o) && /^-/.test(p) && !L.test(p) && !H(p)) {
263
- if (f[a] !== void 0) {
264
- const d = f[a];
263
+ if (f[i] !== void 0) {
264
+ const d = f[i];
265
265
  t = Array.isArray(d) ? d : [d];
266
266
  }
267
267
  } else {
268
- T(o) || t.push(Y(a, o, !0));
269
- for (let d = e + 1; d < l.length && !(!h["greedy-arrays"] && t.length > 0 || c && typeof c == "number" && t.length >= c || (p = l[d], /^-/.test(p) && !L.test(p) && !H(p))); d++)
270
- e = d, t.push(Y(a, p, k));
268
+ T(o) || t.push(Y(i, o, !0));
269
+ for (let d = e + 1; d < c.length && !(!h["greedy-arrays"] && t.length > 0 || l && typeof l == "number" && t.length >= l || (p = c[d], /^-/.test(p) && !L.test(p) && !H(p))); d++)
270
+ e = d, t.push(Y(i, p, k));
271
271
  }
272
- return typeof c == "number" && (c && t.length < c || isNaN(c) && t.length === 0) && (B = Error(C("Not enough arguments following: %s", a))), q(a, t), e;
272
+ return typeof l == "number" && (l && t.length < l || isNaN(l) && t.length === 0) && (B = Error(C("Not enough arguments following: %s", i))), q(i, t), e;
273
273
  }
274
- function q(e, a, l = k) {
274
+ function q(e, i, c = k) {
275
275
  if (/-/.test(e) && h["camel-case-expansion"]) {
276
- const p = e.split(".").map(function(c) {
277
- return W(c);
276
+ const p = e.split(".").map(function(l) {
277
+ return W(l);
278
278
  }).join(".");
279
279
  se(e, p);
280
280
  }
281
- const o = Y(e, a, l), t = e.split(".");
281
+ const o = Y(e, i, c), t = e.split(".");
282
282
  N(w, t, o), r.aliases[e] && r.aliases[e].forEach(function(p) {
283
- const c = p.split(".");
284
- N(w, c, o);
283
+ const l = p.split(".");
284
+ N(w, l, o);
285
285
  }), t.length > 1 && h["dot-notation"] && (r.aliases[t[0]] || []).forEach(function(p) {
286
- let c = p.split(".");
286
+ let l = p.split(".");
287
287
  const d = [].concat(t);
288
- d.shift(), c = c.concat(d), (r.aliases[e] || []).includes(c.join(".")) || N(w, c, o);
289
- }), g(e, r.normalize) && !g(e, r.arrays) && [e].concat(r.aliases[e] || []).forEach(function(c) {
290
- Object.defineProperty(ne, c, {
288
+ d.shift(), l = l.concat(d), (r.aliases[e] || []).includes(l.join(".")) || N(w, l, o);
289
+ }), g(e, r.normalize) && !g(e, r.arrays) && [e].concat(r.aliases[e] || []).forEach(function(l) {
290
+ Object.defineProperty(ne, l, {
291
291
  enumerable: !0,
292
292
  get() {
293
- return a;
293
+ return i;
294
294
  },
295
295
  set(d) {
296
- a = typeof d == "string" ? A.normalize(d) : d;
296
+ i = typeof d == "string" ? A.normalize(d) : d;
297
297
  }
298
298
  });
299
299
  });
300
300
  }
301
- function se(e, a) {
302
- r.aliases[e] && r.aliases[e].length || (r.aliases[e] = [a], Q[a] = !0), r.aliases[a] && r.aliases[a].length || se(a, e);
301
+ function se(e, i) {
302
+ r.aliases[e] && r.aliases[e].length || (r.aliases[e] = [i], Q[i] = !0), r.aliases[i] && r.aliases[i].length || se(i, e);
303
303
  }
304
- function Y(e, a, l) {
305
- l && (a = je(a)), (g(e, r.bools) || g(e, r.counts)) && typeof a == "string" && (a = a === "true");
306
- let o = Array.isArray(a) ? a.map(function(t) {
304
+ function Y(e, i, c) {
305
+ c && (i = je(i)), (g(e, r.bools) || g(e, r.counts)) && typeof i == "string" && (i = i === "true");
306
+ let o = Array.isArray(i) ? i.map(function(t) {
307
307
  return $(e, t);
308
- }) : $(e, a);
309
- return g(e, r.counts) && (T(o) || typeof o == "boolean") && (o = Z()), g(e, r.normalize) && g(e, r.arrays) && (Array.isArray(a) ? o = a.map((t) => A.normalize(t)) : o = A.normalize(a)), o;
308
+ }) : $(e, i);
309
+ return g(e, r.counts) && (T(o) || typeof o == "boolean") && (o = Z()), g(e, r.normalize) && g(e, r.arrays) && (Array.isArray(i) ? o = i.map((t) => A.normalize(t)) : o = A.normalize(i)), o;
310
310
  }
311
- function $(e, a) {
312
- return !h["parse-positional-numbers"] && e === "_" || !g(e, r.strings) && !g(e, r.bools) && !Array.isArray(a) && (Re(a) && h["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${a}`))) || !T(a) && g(e, r.numbers)) && (a = Number(a)), a;
311
+ function $(e, i) {
312
+ return !h["parse-positional-numbers"] && e === "_" || !g(e, r.strings) && !g(e, r.bools) && !Array.isArray(i) && (Re(i) && h["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${i}`))) || !T(i) && g(e, r.numbers)) && (i = Number(i)), i;
313
313
  }
314
314
  function ke(e) {
315
- const a = /* @__PURE__ */ Object.create(null);
316
- me(a, r.aliases, f), Object.keys(r.configs).forEach(function(l) {
317
- const o = e[l] || a[l];
315
+ const i = /* @__PURE__ */ Object.create(null);
316
+ me(i, r.aliases, f), Object.keys(r.configs).forEach(function(c) {
317
+ const o = e[c] || i[c];
318
318
  if (o)
319
319
  try {
320
320
  let t = null;
321
- const p = A.resolve(A.cwd(), o), c = r.configs[l];
322
- if (typeof c == "function") {
321
+ const p = A.resolve(A.cwd(), o), l = r.configs[c];
322
+ if (typeof l == "function") {
323
323
  try {
324
- t = c(p);
324
+ t = l(p);
325
325
  } catch (d) {
326
326
  t = d;
327
327
  }
@@ -333,13 +333,13 @@ class Ne {
333
333
  t = A.require(p);
334
334
  J(t);
335
335
  } catch (t) {
336
- t.name === "PermissionDenied" ? B = t : e[l] && (B = Error(C("Invalid JSON config file: %s", o)));
336
+ t.name === "PermissionDenied" ? B = t : e[c] && (B = Error(C("Invalid JSON config file: %s", o)));
337
337
  }
338
338
  });
339
339
  }
340
- function J(e, a) {
341
- Object.keys(e).forEach(function(l) {
342
- const o = e[l], t = a ? a + "." + l : l;
340
+ function J(e, i) {
341
+ Object.keys(e).forEach(function(c) {
342
+ const o = e[c], t = i ? i + "." + c : c;
343
343
  typeof o == "object" && o !== null && !Array.isArray(o) && h["dot-notation"] ? J(o, t) : (!E(w, t.split(".")) || g(t, r.arrays) && h["combine-arrays"]) && q(t, o);
344
344
  });
345
345
  }
@@ -348,28 +348,28 @@ class Ne {
348
348
  J(e);
349
349
  });
350
350
  }
351
- function re(e, a) {
351
+ function re(e, i) {
352
352
  if (typeof P > "u")
353
353
  return;
354
- const l = typeof P == "string" ? P : "", o = A.env();
354
+ const c = typeof P == "string" ? P : "", o = A.env();
355
355
  Object.keys(o).forEach(function(t) {
356
- if (l === "" || t.lastIndexOf(l, 0) === 0) {
357
- const p = t.split("__").map(function(c, d) {
358
- return d === 0 && (c = c.substring(l.length)), W(c);
356
+ if (c === "" || t.lastIndexOf(c, 0) === 0) {
357
+ const p = t.split("__").map(function(l, d) {
358
+ return d === 0 && (l = l.substring(c.length)), W(l);
359
359
  });
360
- (a && r.configs[p.join(".")] || !a) && !E(e, p) && q(p.join("."), o[t]);
360
+ (i && r.configs[p.join(".")] || !i) && !E(e, p) && q(p.join("."), o[t]);
361
361
  }
362
362
  });
363
363
  }
364
364
  function fe(e) {
365
- let a;
366
- const l = /* @__PURE__ */ new Set();
365
+ let i;
366
+ const c = /* @__PURE__ */ new Set();
367
367
  Object.keys(e).forEach(function(o) {
368
- if (!l.has(o) && (a = g(o, r.coercions), typeof a == "function"))
368
+ if (!c.has(o) && (i = g(o, r.coercions), typeof i == "function"))
369
369
  try {
370
- const t = $(o, a(e[o]));
370
+ const t = $(o, i(e[o]));
371
371
  [].concat(r.aliases[o] || [], o).forEach((p) => {
372
- l.add(p), e[p] = t;
372
+ c.add(p), e[p] = t;
373
373
  });
374
374
  } catch (t) {
375
375
  B = t;
@@ -377,67 +377,67 @@ class Ne {
377
377
  });
378
378
  }
379
379
  function be(e) {
380
- return r.keys.forEach((a) => {
381
- ~a.indexOf(".") || typeof e[a] > "u" && (e[a] = void 0);
380
+ return r.keys.forEach((i) => {
381
+ ~i.indexOf(".") || typeof e[i] > "u" && (e[i] = void 0);
382
382
  }), e;
383
383
  }
384
- function me(e, a, l, o = !1) {
385
- Object.keys(l).forEach(function(t) {
386
- E(e, t.split(".")) || (N(e, t.split("."), l[t]), o && (oe[t] = !0), (a[t] || []).forEach(function(p) {
387
- E(e, p.split(".")) || N(e, p.split("."), l[t]);
384
+ function me(e, i, c, o = !1) {
385
+ Object.keys(c).forEach(function(t) {
386
+ E(e, t.split(".")) || (N(e, t.split("."), c[t]), o && (oe[t] = !0), (i[t] || []).forEach(function(p) {
387
+ E(e, p.split(".")) || N(e, p.split("."), c[t]);
388
388
  }));
389
389
  });
390
390
  }
391
- function E(e, a) {
392
- let l = e;
393
- h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(t) {
394
- l = l[t] || {};
391
+ function E(e, i) {
392
+ let c = e;
393
+ h["dot-notation"] || (i = [i.join(".")]), i.slice(0, -1).forEach(function(t) {
394
+ c = c[t] || {};
395
395
  });
396
- const o = a[a.length - 1];
397
- return typeof l != "object" ? !1 : o in l;
396
+ const o = i[i.length - 1];
397
+ return typeof c != "object" ? !1 : o in c;
398
398
  }
399
- function N(e, a, l) {
399
+ function N(e, i, c) {
400
400
  let o = e;
401
- h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(v) {
402
- v = le(v), typeof o == "object" && o[v] === void 0 && (o[v] = {}), typeof o[v] != "object" || Array.isArray(o[v]) ? (Array.isArray(o[v]) ? o[v].push({}) : o[v] = [o[v], {}], o = o[v][o[v].length - 1]) : o = o[v];
401
+ h["dot-notation"] || (i = [i.join(".")]), i.slice(0, -1).forEach(function(v) {
402
+ v = ce(v), typeof o == "object" && o[v] === void 0 && (o[v] = {}), typeof o[v] != "object" || Array.isArray(o[v]) ? (Array.isArray(o[v]) ? o[v].push({}) : o[v] = [o[v], {}], o = o[v][o[v].length - 1]) : o = o[v];
403
403
  });
404
- const t = le(a[a.length - 1]), p = g(a.join("."), r.arrays), c = Array.isArray(l);
404
+ const t = ce(i[i.length - 1]), p = g(i.join("."), r.arrays), l = Array.isArray(c);
405
405
  let d = h["duplicate-arguments-array"];
406
- !d && g(t, r.nargs) && (d = !0, (!T(o[t]) && r.nargs[t] === 1 || Array.isArray(o[t]) && o[t].length === r.nargs[t]) && (o[t] = void 0)), l === Z() ? o[t] = Z(o[t]) : Array.isArray(o[t]) ? d && p && c ? o[t] = h["flatten-duplicate-arrays"] ? o[t].concat(l) : (Array.isArray(o[t][0]) ? o[t] : [o[t]]).concat([l]) : !d && !!p == !!c ? o[t] = l : o[t] = o[t].concat([l]) : o[t] === void 0 && p ? o[t] = c ? l : [l] : d && !(o[t] === void 0 || g(t, r.counts) || g(t, r.bools)) ? o[t] = [o[t], l] : o[t] = l;
406
+ !d && g(t, r.nargs) && (d = !0, (!T(o[t]) && r.nargs[t] === 1 || Array.isArray(o[t]) && o[t].length === r.nargs[t]) && (o[t] = void 0)), c === Z() ? o[t] = Z(o[t]) : Array.isArray(o[t]) ? d && p && l ? o[t] = h["flatten-duplicate-arrays"] ? o[t].concat(c) : (Array.isArray(o[t][0]) ? o[t] : [o[t]]).concat([c]) : !d && !!p == !!l ? o[t] = c : o[t] = o[t].concat([c]) : o[t] === void 0 && p ? o[t] = l ? c : [c] : d && !(o[t] === void 0 || g(t, r.counts) || g(t, r.bools)) ? o[t] = [o[t], c] : o[t] = c;
407
407
  }
408
408
  function qe(...e) {
409
- e.forEach(function(a) {
410
- Object.keys(a || {}).forEach(function(l) {
411
- r.aliases[l] || (r.aliases[l] = [].concat(_[l] || []), r.aliases[l].concat(l).forEach(function(o) {
409
+ e.forEach(function(i) {
410
+ Object.keys(i || {}).forEach(function(c) {
411
+ r.aliases[c] || (r.aliases[c] = [].concat(_[c] || []), r.aliases[c].concat(c).forEach(function(o) {
412
412
  if (/-/.test(o) && h["camel-case-expansion"]) {
413
413
  const t = W(o);
414
- t !== l && r.aliases[l].indexOf(t) === -1 && (r.aliases[l].push(t), Q[t] = !0);
414
+ t !== c && r.aliases[c].indexOf(t) === -1 && (r.aliases[c].push(t), Q[t] = !0);
415
415
  }
416
- }), r.aliases[l].concat(l).forEach(function(o) {
416
+ }), r.aliases[c].concat(c).forEach(function(o) {
417
417
  if (o.length > 1 && /[A-Z]/.test(o) && h["camel-case-expansion"]) {
418
418
  const t = Oe(o, "-");
419
- t !== l && r.aliases[l].indexOf(t) === -1 && (r.aliases[l].push(t), Q[t] = !0);
419
+ t !== c && r.aliases[c].indexOf(t) === -1 && (r.aliases[c].push(t), Q[t] = !0);
420
420
  }
421
- }), r.aliases[l].forEach(function(o) {
422
- r.aliases[o] = [l].concat(r.aliases[l].filter(function(t) {
421
+ }), r.aliases[c].forEach(function(o) {
422
+ r.aliases[o] = [c].concat(r.aliases[c].filter(function(t) {
423
423
  return o !== t;
424
424
  }));
425
425
  }));
426
426
  });
427
427
  });
428
428
  }
429
- function g(e, a) {
430
- const l = [].concat(r.aliases[e] || [], e), o = Object.keys(a), t = l.find((p) => o.includes(p));
431
- return t ? a[t] : !1;
429
+ function g(e, i) {
430
+ const c = [].concat(r.aliases[e] || [], e), o = Object.keys(i), t = c.find((p) => o.includes(p));
431
+ return t ? i[t] : !1;
432
432
  }
433
433
  function ue(e) {
434
- const a = Object.keys(r);
435
- return [].concat(a.map((o) => r[o])).some(function(o) {
434
+ const i = Object.keys(r);
435
+ return [].concat(i.map((o) => r[o])).some(function(o) {
436
436
  return Array.isArray(o) ? o.includes(e) : o[e];
437
437
  });
438
438
  }
439
- function we(e, ...a) {
440
- return [].concat(...a).some(function(o) {
439
+ function we(e, ...i) {
440
+ return [].concat(...i).some(function(o) {
441
441
  const t = e.match(o);
442
442
  return t && ue(t[1]);
443
443
  });
@@ -445,17 +445,17 @@ class Ne {
445
445
  function ve(e) {
446
446
  if (e.match(L) || !e.match(/^-[^-]+/))
447
447
  return !1;
448
- let a = !0, l;
448
+ let i = !0, c;
449
449
  const o = e.slice(1).split("");
450
450
  for (let t = 0; t < o.length; t++) {
451
- if (l = e.slice(t + 2), !ue(o[t])) {
452
- a = !1;
451
+ if (c = e.slice(t + 2), !ue(o[t])) {
452
+ i = !1;
453
453
  break;
454
454
  }
455
- if (o[t + 1] && o[t + 1] === "=" || l === "-" || /[A-Za-z]/.test(o[t]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(l) || o[t + 1] && o[t + 1].match(/\W/))
455
+ if (o[t + 1] && o[t + 1] === "=" || c === "-" || /[A-Za-z]/.test(o[t]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(c) || o[t + 1] && o[t + 1].match(/\W/))
456
456
  break;
457
457
  }
458
- return a;
458
+ return i;
459
459
  }
460
460
  function H(e) {
461
461
  return h["unknown-options-as-args"] && xe(e);
@@ -475,8 +475,8 @@ class Ne {
475
475
  }[e];
476
476
  }
477
477
  function Be(e) {
478
- let a = I.BOOLEAN;
479
- return g(e, r.strings) ? a = I.STRING : g(e, r.numbers) ? a = I.NUMBER : g(e, r.bools) ? a = I.BOOLEAN : g(e, r.arrays) && (a = I.ARRAY), a;
478
+ let i = I.BOOLEAN;
479
+ return g(e, r.strings) ? i = I.STRING : g(e, r.numbers) ? i = I.NUMBER : g(e, r.bools) ? i = I.BOOLEAN : g(e, r.arrays) && (i = I.ARRAY), i;
480
480
  }
481
481
  function T(e) {
482
482
  return e === void 0;
@@ -494,11 +494,11 @@ class Ne {
494
494
  };
495
495
  }
496
496
  }
497
- function ze(i) {
497
+ function ze(a) {
498
498
  const n = [], m = /* @__PURE__ */ Object.create(null);
499
499
  let s = !0;
500
- for (Object.keys(i).forEach(function(u) {
501
- n.push([].concat(i[u], u));
500
+ for (Object.keys(a).forEach(function(u) {
501
+ n.push([].concat(a[u], u));
502
502
  }); s; ) {
503
503
  s = !1;
504
504
  for (let u = 0; u < n.length; u++)
@@ -518,14 +518,14 @@ function ze(i) {
518
518
  k !== void 0 && typeof k == "string" && (m[k] = u);
519
519
  }), m;
520
520
  }
521
- function Z(i) {
522
- return i !== void 0 ? i + 1 : 1;
521
+ function Z(a) {
522
+ return a !== void 0 ? a + 1 : 1;
523
523
  }
524
- function le(i) {
525
- return i === "__proto__" ? "___proto___" : i;
524
+ function ce(a) {
525
+ return a === "__proto__" ? "___proto___" : a;
526
526
  }
527
- function je(i) {
528
- return typeof i == "string" && (i[0] === "'" || i[0] === '"') && i[i.length - 1] === i[0] ? i.substring(1, i.length - 1) : i;
527
+ function je(a) {
528
+ return typeof a == "string" && (a[0] === "'" || a[0] === '"') && a[a.length - 1] === a[0] ? a.substring(1, a.length - 1) : a;
529
529
  }
530
530
  /**
531
531
  * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
@@ -536,23 +536,23 @@ function je(i) {
536
536
  * SPDX-License-Identifier: ISC
537
537
  */
538
538
  var X, ee, te;
539
- const ce = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12, pe = (ee = (X = process == null ? void 0 : process.versions) === null || X === void 0 ? void 0 : X.node) !== null && ee !== void 0 ? ee : (te = process == null ? void 0 : process.version) === null || te === void 0 ? void 0 : te.slice(1);
540
- if (pe && Number(pe.match(/^([^.]+)/)[1]) < ce)
541
- throw Error(`yargs parser supports a minimum Node.js version of ${ce}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
539
+ const le = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12, pe = (ee = (X = process == null ? void 0 : process.versions) === null || X === void 0 ? void 0 : X.node) !== null && ee !== void 0 ? ee : (te = process == null ? void 0 : process.version) === null || te === void 0 ? void 0 : te.slice(1);
540
+ if (pe && Number(pe.match(/^([^.]+)/)[1]) < le)
541
+ throw Error(`yargs parser supports a minimum Node.js version of ${le}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
542
542
  const Qe = process ? process.env : {};
543
543
  new Ne({
544
544
  cwd: process.cwd,
545
545
  env: () => Qe,
546
546
  format: he,
547
547
  normalize: Ie,
548
- resolve: ae,
548
+ resolve: ie,
549
549
  // TODO: figure out a way to combine ESM and CJS coverage, such that
550
550
  // we can exercise all the lines below:
551
- require: (i) => {
551
+ require: (a) => {
552
552
  if (typeof require < "u")
553
- return require(i);
554
- if (i.match(/\.json$/))
555
- return JSON.parse(_e(i, "utf8"));
553
+ return require(a);
554
+ if (a.match(/\.json$/))
555
+ return JSON.parse(_e(a, "utf8"));
556
556
  throw Error("only .json config files are supported in ESM");
557
557
  }
558
558
  });
@@ -562,10 +562,10 @@ const Fe = {
562
562
  writeFile: Le
563
563
  },
564
564
  format: he,
565
- resolve: ae,
566
- exists: (i) => {
565
+ resolve: ie,
566
+ exists: (a) => {
567
567
  try {
568
- return Pe(i).isFile();
568
+ return Pe(a).isFile();
569
569
  } catch {
570
570
  return !1;
571
571
  }
@@ -658,9 +658,9 @@ class De {
658
658
  return M.exists(n);
659
659
  }
660
660
  }
661
- function Ve(i, n) {
661
+ function Ve(a, n) {
662
662
  M = n;
663
- const m = new De(i);
663
+ const m = new De(a);
664
664
  return {
665
665
  __: m.__.bind(m),
666
666
  __n: m.__n.bind(m),
@@ -670,7 +670,7 @@ function Ve(i, n) {
670
670
  locale: m.locale
671
671
  };
672
672
  }
673
- const $e = (i) => Ve(i, Fe);
673
+ const $e = (a) => Ve(a, Fe);
674
674
  let z;
675
675
  try {
676
676
  z = Te(import.meta.url);
@@ -679,10 +679,10 @@ try {
679
679
  }
680
680
  const He = z.substring(0, z.lastIndexOf("node_modules"));
681
681
  He || process.cwd(), process.cwd, process.exit, process.nextTick, typeof process.stdout.columns < "u" && process.stdout.columns, $e({
682
- directory: ae(z, "../../../locales"),
682
+ directory: ie(z, "../../../locales"),
683
683
  updateFiles: !1
684
684
  });
685
- const ie = [
685
+ const ae = [
686
686
  {
687
687
  id: "anthropic",
688
688
  name: "Anthropic",
@@ -2506,7 +2506,12 @@ Compared to other leading proprietary and open-weights models Command A delivers
2506
2506
  {
2507
2507
  path: "promptTokenCount",
2508
2508
  dest: "input_tokens",
2509
- required: !0
2509
+ required: !1
2510
+ },
2511
+ {
2512
+ path: "cachedContentTokenCount",
2513
+ dest: "cache_read_tokens",
2514
+ required: !1
2510
2515
  },
2511
2516
  {
2512
2517
  path: [
@@ -2515,17 +2520,17 @@ Compared to other leading proprietary and open-weights models Command A delivers
2515
2520
  type: "array-match",
2516
2521
  field: "modality",
2517
2522
  match: {
2518
- equals: "TEXT"
2523
+ equals: "AUDIO"
2519
2524
  }
2520
2525
  },
2521
2526
  "tokenCount"
2522
2527
  ],
2523
- dest: "cache_read_tokens",
2528
+ dest: "cache_audio_read_tokens",
2524
2529
  required: !1
2525
2530
  },
2526
2531
  {
2527
2532
  path: [
2528
- "cacheTokensDetails",
2533
+ "promptTokensDetails",
2529
2534
  {
2530
2535
  type: "array-match",
2531
2536
  field: "modality",
@@ -2535,12 +2540,12 @@ Compared to other leading proprietary and open-weights models Command A delivers
2535
2540
  },
2536
2541
  "tokenCount"
2537
2542
  ],
2538
- dest: "cache_audio_read_tokens",
2543
+ dest: "input_audio_tokens",
2539
2544
  required: !1
2540
2545
  },
2541
2546
  {
2542
2547
  path: [
2543
- "promptTokensDetails",
2548
+ "candidatesTokensDetails",
2544
2549
  {
2545
2550
  type: "array-match",
2546
2551
  field: "modality",
@@ -2550,18 +2555,23 @@ Compared to other leading proprietary and open-weights models Command A delivers
2550
2555
  },
2551
2556
  "tokenCount"
2552
2557
  ],
2553
- dest: "input_audio_tokens",
2558
+ dest: "output_audio_tokens",
2554
2559
  required: !1
2555
2560
  },
2556
2561
  {
2557
2562
  path: "candidatesTokenCount",
2558
2563
  dest: "output_tokens",
2559
- required: !0
2564
+ required: !1
2560
2565
  },
2561
2566
  {
2562
2567
  path: "thoughtsTokenCount",
2563
2568
  dest: "output_tokens",
2564
2569
  required: !1
2570
+ },
2571
+ {
2572
+ path: "toolUsePromptTokenCount",
2573
+ dest: "output_tokens",
2574
+ required: !1
2565
2575
  }
2566
2576
  ]
2567
2577
  },
@@ -2974,6 +2984,43 @@ Compared to other leading proprietary and open-weights models Command A delivers
2974
2984
  }
2975
2985
  }
2976
2986
  },
2987
+ {
2988
+ id: "gemini-3-pro-preview",
2989
+ name: "Gemini 3 Pro Preview",
2990
+ description: "The best model in the world for multimodal understanding, and our most powerful agentic and vibe-coding model yet.",
2991
+ match: {
2992
+ starts_with: "gemini-3-pro-preview"
2993
+ },
2994
+ prices: {
2995
+ input_mtok: {
2996
+ base: 2,
2997
+ tiers: [
2998
+ {
2999
+ start: 2e5,
3000
+ price: 4
3001
+ }
3002
+ ]
3003
+ },
3004
+ cache_read_mtok: {
3005
+ base: 0.2,
3006
+ tiers: [
3007
+ {
3008
+ start: 2e5,
3009
+ price: 0.4
3010
+ }
3011
+ ]
3012
+ },
3013
+ output_mtok: {
3014
+ base: 12,
3015
+ tiers: [
3016
+ {
3017
+ start: 2e5,
3018
+ price: 18
3019
+ }
3020
+ ]
3021
+ }
3022
+ }
3023
+ },
2977
3024
  {
2978
3025
  id: "gemini-embedding-001",
2979
3026
  match: {
@@ -4404,6 +4451,17 @@ Compared to other leading proprietary and open-weights models Command A delivers
4404
4451
  output_mtok: 6
4405
4452
  }
4406
4453
  },
4454
+ {
4455
+ id: "computer-use",
4456
+ name: "Computer use",
4457
+ match: {
4458
+ starts_with: "computer-use"
4459
+ },
4460
+ prices: {
4461
+ input_mtok: 3,
4462
+ output_mtok: 12
4463
+ }
4464
+ },
4407
4465
  {
4408
4466
  id: "curie",
4409
4467
  match: {
@@ -5074,9 +5132,6 @@ Compared to other leading proprietary and open-weights models Command A delivers
5074
5132
  {
5075
5133
  equals: "gpt-5.1-codex"
5076
5134
  },
5077
- {
5078
- equals: "gpt-5.1-mini"
5079
- },
5080
5135
  {
5081
5136
  equals: "gpt-5.1-chat-latest"
5082
5137
  }
@@ -5089,6 +5144,26 @@ Compared to other leading proprietary and open-weights models Command A delivers
5089
5144
  output_mtok: 10
5090
5145
  }
5091
5146
  },
5147
+ {
5148
+ id: "gpt-5.1-codex-mini",
5149
+ name: "GPT-5.1 Codex Mini",
5150
+ match: {
5151
+ or: [
5152
+ {
5153
+ equals: "gpt-5.1-codex-mini"
5154
+ },
5155
+ {
5156
+ equals: "gpt-5.1-mini"
5157
+ }
5158
+ ]
5159
+ },
5160
+ context_window: 4e5,
5161
+ prices: {
5162
+ input_mtok: 0.25,
5163
+ cache_read_mtok: 0.025,
5164
+ output_mtok: 2
5165
+ }
5166
+ },
5092
5167
  {
5093
5168
  id: "gpt-realtime",
5094
5169
  match: {
@@ -12531,37 +12606,37 @@ Compared to other leading proprietary and open-weights models Command A delivers
12531
12606
  ]
12532
12607
  }
12533
12608
  ];
12534
- function We(i, n) {
12609
+ function We(a, n) {
12535
12610
  if (n <= 0) return 0;
12536
12611
  let m = 0;
12537
- const s = [...i.tiers].sort((_, h) => _.start - h.start), u = s[0]?.start ?? n, k = Math.min(n, u);
12538
- m += k * i.base / 1e6;
12612
+ const s = [...a.tiers].sort((_, h) => _.start - h.start), u = s[0]?.start ?? n, k = Math.min(n, u);
12613
+ m += k * a.base / 1e6;
12539
12614
  for (let _ = 0; _ < s.length; _++) {
12540
12615
  const h = s[_], f = s[_ + 1]?.start ?? 1 / 0, y = Math.max(0, Math.min(n, f) - h.start);
12541
12616
  y > 0 && (m += y * h.price / 1e6);
12542
12617
  }
12543
12618
  return m;
12544
12619
  }
12545
- function O(i, n, m) {
12546
- return i === void 0 || n === void 0 ? 0 : typeof i == "number" ? i * n / 1e6 : We(i, n);
12620
+ function O(a, n, m) {
12621
+ return a === void 0 || n === void 0 ? 0 : typeof a == "number" ? a * n / 1e6 : We(a, n);
12547
12622
  }
12548
- function Ue(i, n) {
12623
+ function Ue(a, n) {
12549
12624
  let m = 0, s = 0;
12550
- const u = i.cache_read_tokens ?? 0, k = i.cache_write_tokens ?? 0, _ = i.cache_audio_read_tokens ?? 0, h = i.output_audio_tokens ?? 0;
12551
- let f = i.input_audio_tokens ?? 0;
12625
+ const u = a.cache_read_tokens ?? 0, k = a.cache_write_tokens ?? 0, _ = a.cache_audio_read_tokens ?? 0, h = a.output_audio_tokens ?? 0;
12626
+ let f = a.input_audio_tokens ?? 0;
12552
12627
  if (f -= _, f < 0)
12553
12628
  throw new Error("cache_audio_read_tokens cannot be greater than input_audio_tokens");
12554
- let y = i.input_tokens ?? 0;
12629
+ let y = a.input_tokens ?? 0;
12555
12630
  if (y -= u, y -= k, y -= f, y < 0)
12556
12631
  throw new Error("Uncached text input tokens cannot be negative");
12557
12632
  let P = u;
12558
12633
  if (P -= _, P < 0)
12559
12634
  throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
12560
12635
  m += O(n.input_mtok, y), m += O(n.cache_read_mtok, P), m += O(n.cache_write_mtok, k), m += O(n.input_audio_mtok, f), m += O(n.cache_audio_read_mtok, _);
12561
- let S = i.output_tokens ?? 0;
12636
+ let S = a.output_tokens ?? 0;
12562
12637
  if (S -= h, S < 0)
12563
12638
  throw new Error("output_audio_tokens cannot be greater than output_tokens");
12564
- s += O(n.output_mtok, S), s += O(n.output_audio_mtok, i.output_audio_tokens);
12639
+ s += O(n.output_mtok, S), s += O(n.output_audio_mtok, a.output_audio_tokens);
12565
12640
  let G = m + s;
12566
12641
  return n.requests_kcount !== void 0 && (G += n.requests_kcount / 1e3), {
12567
12642
  input_price: m,
@@ -12569,11 +12644,11 @@ function Ue(i, n) {
12569
12644
  total_price: G
12570
12645
  };
12571
12646
  }
12572
- function Ke(i, n) {
12573
- if (!Array.isArray(i.prices))
12574
- return i.prices;
12575
- for (let m = i.prices.length - 1; m >= 0; m--) {
12576
- const s = i.prices[m], u = s.constraint;
12647
+ function Ke(a, n) {
12648
+ if (!Array.isArray(a.prices))
12649
+ return a.prices;
12650
+ for (let m = a.prices.length - 1; m >= 0; m--) {
12651
+ const s = a.prices[m], u = s.constraint;
12577
12652
  if (u === void 0)
12578
12653
  return s.prices;
12579
12654
  if (u.type === "start_date") {
@@ -12588,34 +12663,34 @@ function Ke(i, n) {
12588
12663
  return s.prices;
12589
12664
  }
12590
12665
  }
12591
- return i.prices[0].prices;
12666
+ return a.prices[0].prices;
12592
12667
  }
12593
- function j(i, n) {
12594
- return "or" in i ? i.or.some((m) => j(m, n)) : "and" in i ? i.and.every((m) => j(m, n)) : "equals" in i ? n === i.equals : "starts_with" in i ? n.startsWith(i.starts_with) : "ends_with" in i ? n.endsWith(i.ends_with) : "contains" in i ? n.includes(i.contains) : "regex" in i ? new RegExp(i.regex).test(n) : !1;
12668
+ function j(a, n) {
12669
+ return "or" in a ? a.or.some((m) => j(m, n)) : "and" in a ? a.and.every((m) => j(m, n)) : "equals" in a ? n === a.equals : "starts_with" in a ? n.startsWith(a.starts_with) : "ends_with" in a ? n.endsWith(a.ends_with) : "contains" in a ? n.includes(a.contains) : "regex" in a ? new RegExp(a.regex).test(n) : !1;
12595
12670
  }
12596
- function Ye(i, n) {
12597
- const m = n.toLowerCase().trim(), s = i.find((u) => u.id === m);
12598
- return s || i.find((u) => u.provider_match && j(u.provider_match, m));
12671
+ function Ye(a, n) {
12672
+ const m = n.toLowerCase().trim(), s = a.find((u) => u.id === m);
12673
+ return s || a.find((u) => u.provider_match && j(u.provider_match, m));
12599
12674
  }
12600
- function Je(i, { modelId: n, providerApiUrl: m, providerId: s }) {
12675
+ function Je(a, { modelId: n, providerApiUrl: m, providerId: s }) {
12601
12676
  if (s)
12602
- return Ye(i, s);
12677
+ return Ye(a, s);
12603
12678
  if (m)
12604
- return i.find((u) => new RegExp(u.api_pattern).test(m));
12679
+ return a.find((u) => new RegExp(u.api_pattern).test(m));
12605
12680
  if (n)
12606
- return i.find((u) => u.model_match && j(u.model_match, n));
12681
+ return a.find((u) => u.model_match && j(u.model_match, n));
12607
12682
  }
12608
- function Ze(i, n) {
12609
- return i.find((m) => j(m.match, n));
12683
+ function Ze(a, n) {
12684
+ return a.find((m) => j(m.match, n));
12610
12685
  }
12611
- let Xe = ie;
12612
- Promise.resolve(ie);
12613
- function et(i, n, m) {
12686
+ let Xe = ae;
12687
+ Promise.resolve(ae);
12688
+ function et(a, n, m) {
12614
12689
  const s = n.toLowerCase().trim(), u = m?.provider ?? Je(Xe, { modelId: s, providerApiUrl: m?.providerApiUrl, providerId: m?.providerId });
12615
12690
  if (!u) return null;
12616
12691
  const k = Ze(u.models, s);
12617
12692
  if (!k) return null;
12618
- const _ = m?.timestamp ?? /* @__PURE__ */ new Date(), h = Ke(k, _), f = Ue(i, h);
12693
+ const _ = m?.timestamp ?? /* @__PURE__ */ new Date(), h = Ke(k, _), f = Ue(a, h);
12619
12694
  return {
12620
12695
  auto_update_timestamp: void 0,
12621
12696
  model: k,
@@ -12627,15 +12702,15 @@ function et(i, n, m) {
12627
12702
  const b = de(Ce(process.argv)).scriptName("genai-prices").command(
12628
12703
  "list [provider]",
12629
12704
  "List providers and models",
12630
- (i) => i.positional("provider", { describe: "Provider ID to filter", type: "string" })
12705
+ (a) => a.positional("provider", { describe: "Provider ID to filter", type: "string" })
12631
12706
  ).command(
12632
12707
  "calc <model...>",
12633
12708
  "Calculate price",
12634
- (i) => i.positional("model", { array: !0, describe: "Model(s) (optionally provider:model)", type: "string" }).option("input-tokens", { type: "number" }).option("cache-write-tokens", { type: "number" }).option("cache-read-tokens", { type: "number" }).option("output-tokens", { type: "number" }).option("input-audio-tokens", { type: "number" }).option("cache-audio-read-tokens", { type: "number" }).option("output-audio-tokens", { type: "number" }).option("requests", { type: "number" }).option("provider", { type: "string" }).option("auto-update", { default: !1, type: "boolean" }).option("timestamp", { describe: "RFC3339 timestamp", type: "string" })
12709
+ (a) => a.positional("model", { array: !0, describe: "Model(s) (optionally provider:model)", type: "string" }).option("input-tokens", { type: "number" }).option("cache-write-tokens", { type: "number" }).option("cache-read-tokens", { type: "number" }).option("output-tokens", { type: "number" }).option("input-audio-tokens", { type: "number" }).option("cache-audio-read-tokens", { type: "number" }).option("output-audio-tokens", { type: "number" }).option("requests", { type: "number" }).option("provider", { type: "string" }).option("auto-update", { default: !1, type: "boolean" }).option("timestamp", { describe: "RFC3339 timestamp", type: "string" })
12635
12710
  ).option("auto-update", { describe: "Enable auto-update from GitHub", type: "boolean" }).option("input-tokens", { type: "number" }).option("cache-write-tokens", { type: "number" }).option("cache-read-tokens", { type: "number" }).option("output-tokens", { type: "number" }).option("input-audio-tokens", { type: "number" }).option("cache-audio-read-tokens", { type: "number" }).option("output-audio-tokens", { type: "number" }).option("requests", { type: "number" }).option("provider", { type: "string" }).option("timestamp", { describe: "RFC3339 timestamp", type: "string" }).version("0.1.0").help().parseSync();
12636
12711
  function tt() {
12637
12712
  if (b._[0] === "list") {
12638
- const m = ie;
12713
+ const m = ae;
12639
12714
  if (b.provider) {
12640
12715
  const s = m.find((u) => u.id === b.provider);
12641
12716
  s || (console.error(`Provider ${b.provider} not found.`), process.exit(1)), console.log(`${s.name}: (${s.models.length} models)`);