@pydantic/genai-prices 0.0.42 → 0.0.44
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 +871 -350
- package/dist/index.cjs +3 -3
- package/dist/index.js +574 -53
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { format as
|
|
4
|
-
import { resolve as
|
|
5
|
-
import { readFileSync as
|
|
2
|
+
import dt from "yargs";
|
|
3
|
+
import { format as ht } from "util";
|
|
4
|
+
import { resolve as at, normalize as It } from "path";
|
|
5
|
+
import { readFileSync as _t, writeFile as Lt, statSync as Pt } from "fs";
|
|
6
6
|
import "assert";
|
|
7
|
-
import { fileURLToPath as
|
|
8
|
-
function
|
|
9
|
-
return
|
|
7
|
+
import { fileURLToPath as Tt } from "url";
|
|
8
|
+
function At() {
|
|
9
|
+
return St() ? 0 : 1;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
11
|
+
function St() {
|
|
12
|
+
return Gt() && !process.defaultApp;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function Gt() {
|
|
15
15
|
return !!process.versions.electron;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return i.slice(
|
|
17
|
+
function Ct(i) {
|
|
18
|
+
return i.slice(At() + 1);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* @license
|
|
@@ -26,26 +26,26 @@ function W(i) {
|
|
|
26
26
|
if (i !== i.toLowerCase() && i !== i.toUpperCase() || (i = i.toLowerCase()), i.indexOf("-") === -1 && i.indexOf("_") === -1)
|
|
27
27
|
return i;
|
|
28
28
|
{
|
|
29
|
-
let m = "",
|
|
29
|
+
let m = "", n = !1;
|
|
30
30
|
const u = i.match(/^-+/);
|
|
31
31
|
for (let k = u ? u[0].length : 0; k < i.length; k++) {
|
|
32
32
|
let _ = i.charAt(k);
|
|
33
|
-
|
|
33
|
+
n && (n = !1, _ = _.toUpperCase()), k !== 0 && (_ === "-" || _ === "_") ? n = !0 : _ !== "-" && _ !== "_" && (m += _);
|
|
34
34
|
}
|
|
35
35
|
return m;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Ot(i, s) {
|
|
39
39
|
const m = i.toLowerCase();
|
|
40
|
-
|
|
41
|
-
let
|
|
40
|
+
s = s || "-";
|
|
41
|
+
let n = "";
|
|
42
42
|
for (let u = 0; u < i.length; u++) {
|
|
43
43
|
const k = m.charAt(u), _ = i.charAt(u);
|
|
44
|
-
k !== _ && u > 0 ?
|
|
44
|
+
k !== _ && u > 0 ? n += `${s}${m.charAt(u)}` : n += _;
|
|
45
45
|
}
|
|
46
|
-
return
|
|
46
|
+
return n;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function Rt(i) {
|
|
49
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);
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
@@ -53,18 +53,18 @@ function Re(i) {
|
|
|
53
53
|
* Copyright (c) 2016, Contributors
|
|
54
54
|
* SPDX-License-Identifier: ISC
|
|
55
55
|
*/
|
|
56
|
-
function
|
|
56
|
+
function Et(i) {
|
|
57
57
|
if (Array.isArray(i))
|
|
58
58
|
return i.map((_) => typeof _ != "string" ? _ + "" : _);
|
|
59
59
|
i = i.trim();
|
|
60
|
-
let
|
|
60
|
+
let s = 0, m = null, n = null, u = null;
|
|
61
61
|
const k = [];
|
|
62
62
|
for (let _ = 0; _ < i.length; _++) {
|
|
63
|
-
if (m =
|
|
64
|
-
m !== " " &&
|
|
63
|
+
if (m = n, n = i.charAt(_), n === " " && !u) {
|
|
64
|
+
m !== " " && s++;
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
n === u ? u = null : (n === "'" || n === '"') && !u && (u = n), k[s] || (k[s] = ""), k[s] += n;
|
|
68
68
|
}
|
|
69
69
|
return k;
|
|
70
70
|
}
|
|
@@ -83,12 +83,12 @@ var I;
|
|
|
83
83
|
* SPDX-License-Identifier: ISC
|
|
84
84
|
*/
|
|
85
85
|
let A;
|
|
86
|
-
class
|
|
87
|
-
constructor(
|
|
88
|
-
A =
|
|
86
|
+
class Nt {
|
|
87
|
+
constructor(s) {
|
|
88
|
+
A = s;
|
|
89
89
|
}
|
|
90
|
-
parse(
|
|
91
|
-
const
|
|
90
|
+
parse(s, m) {
|
|
91
|
+
const n = Object.assign({
|
|
92
92
|
alias: void 0,
|
|
93
93
|
array: void 0,
|
|
94
94
|
boolean: void 0,
|
|
@@ -105,7 +105,7 @@ class Ne {
|
|
|
105
105
|
number: void 0,
|
|
106
106
|
__: void 0,
|
|
107
107
|
key: void 0
|
|
108
|
-
}, m), u =
|
|
108
|
+
}, m), u = Et(s), k = typeof s == "string", _ = zt(Object.assign(/* @__PURE__ */ Object.create(null), n.alias)), h = Object.assign({
|
|
109
109
|
"boolean-negation": !0,
|
|
110
110
|
"camel-case-expansion": !0,
|
|
111
111
|
"combine-arrays": !1,
|
|
@@ -124,7 +124,7 @@ class Ne {
|
|
|
124
124
|
"strip-aliased": !1,
|
|
125
125
|
"strip-dashed": !1,
|
|
126
126
|
"unknown-options-as-args": !1
|
|
127
|
-
},
|
|
127
|
+
}, n.configuration), f = Object.assign(/* @__PURE__ */ Object.create(null), n.default), y = n.configObjects || [], P = n.envPrefix, S = h["populate--"], G = S ? "--" : "_", Q = /* @__PURE__ */ Object.create(null), ot = /* @__PURE__ */ Object.create(null), C = n.__ || A.format, r = {
|
|
128
128
|
aliases: /* @__PURE__ */ Object.create(null),
|
|
129
129
|
arrays: /* @__PURE__ */ Object.create(null),
|
|
130
130
|
bools: /* @__PURE__ */ Object.create(null),
|
|
@@ -137,8 +137,8 @@ class Ne {
|
|
|
137
137
|
coercions: /* @__PURE__ */ Object.create(null),
|
|
138
138
|
keys: []
|
|
139
139
|
}, L = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/, U = new RegExp("^--" + h["negation-prefix"] + "(.+)");
|
|
140
|
-
[].concat(
|
|
141
|
-
const a = typeof
|
|
140
|
+
[].concat(n.array || []).filter(Boolean).forEach(function(t) {
|
|
141
|
+
const a = typeof t == "object" ? t.key : t, c = Object.keys(t).map(function(o) {
|
|
142
142
|
return {
|
|
143
143
|
boolean: "bools",
|
|
144
144
|
string: "strings",
|
|
@@ -146,56 +146,56 @@ class Ne {
|
|
|
146
146
|
}[o];
|
|
147
147
|
}).filter(Boolean).pop();
|
|
148
148
|
c && (r[c][a] = !0), r.arrays[a] = !0, r.keys.push(a);
|
|
149
|
-
}), [].concat(
|
|
150
|
-
r.bools[
|
|
151
|
-
}), [].concat(
|
|
152
|
-
r.strings[
|
|
153
|
-
}), [].concat(
|
|
154
|
-
r.numbers[
|
|
155
|
-
}), [].concat(
|
|
156
|
-
r.counts[
|
|
157
|
-
}), [].concat(
|
|
158
|
-
r.normalize[
|
|
159
|
-
}), typeof
|
|
160
|
-
typeof a == "number" && (r.nargs[
|
|
161
|
-
}), typeof
|
|
162
|
-
typeof a == "function" && (r.coercions[
|
|
163
|
-
}), typeof
|
|
164
|
-
r.configs[
|
|
165
|
-
}) : typeof
|
|
166
|
-
(typeof a == "boolean" || typeof a == "function") && (r.configs[
|
|
167
|
-
})),
|
|
168
|
-
(r.aliases[
|
|
169
|
-
f[a] = f[
|
|
149
|
+
}), [].concat(n.boolean || []).filter(Boolean).forEach(function(t) {
|
|
150
|
+
r.bools[t] = !0, r.keys.push(t);
|
|
151
|
+
}), [].concat(n.string || []).filter(Boolean).forEach(function(t) {
|
|
152
|
+
r.strings[t] = !0, r.keys.push(t);
|
|
153
|
+
}), [].concat(n.number || []).filter(Boolean).forEach(function(t) {
|
|
154
|
+
r.numbers[t] = !0, r.keys.push(t);
|
|
155
|
+
}), [].concat(n.count || []).filter(Boolean).forEach(function(t) {
|
|
156
|
+
r.counts[t] = !0, r.keys.push(t);
|
|
157
|
+
}), [].concat(n.normalize || []).filter(Boolean).forEach(function(t) {
|
|
158
|
+
r.normalize[t] = !0, r.keys.push(t);
|
|
159
|
+
}), typeof n.narg == "object" && Object.entries(n.narg).forEach(([t, a]) => {
|
|
160
|
+
typeof a == "number" && (r.nargs[t] = a, r.keys.push(t));
|
|
161
|
+
}), typeof n.coerce == "object" && Object.entries(n.coerce).forEach(([t, a]) => {
|
|
162
|
+
typeof a == "function" && (r.coercions[t] = a, r.keys.push(t));
|
|
163
|
+
}), typeof n.config < "u" && (Array.isArray(n.config) || typeof n.config == "string" ? [].concat(n.config).filter(Boolean).forEach(function(t) {
|
|
164
|
+
r.configs[t] = !0;
|
|
165
|
+
}) : typeof n.config == "object" && Object.entries(n.config).forEach(([t, a]) => {
|
|
166
|
+
(typeof a == "boolean" || typeof a == "function") && (r.configs[t] = a);
|
|
167
|
+
})), qt(n.key, _, n.default, r.arrays), Object.keys(f).forEach(function(t) {
|
|
168
|
+
(r.aliases[t] || []).forEach(function(a) {
|
|
169
|
+
f[a] = f[t];
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
172
|
let B = null;
|
|
173
|
-
|
|
173
|
+
Mt();
|
|
174
174
|
let F = [];
|
|
175
|
-
const w = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] }),
|
|
176
|
-
for (let
|
|
177
|
-
const a = u[
|
|
178
|
-
let o,
|
|
175
|
+
const w = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] }), st = {};
|
|
176
|
+
for (let t = 0; t < u.length; t++) {
|
|
177
|
+
const a = u[t], c = a.replace(/^-{3,}/, "---");
|
|
178
|
+
let o, e, p, l, d, v;
|
|
179
179
|
if (a !== "--" && /^-/.test(a) && H(a))
|
|
180
180
|
K(a);
|
|
181
181
|
else if (c.match(/^---+(=|$)/)) {
|
|
182
182
|
K(a);
|
|
183
183
|
continue;
|
|
184
184
|
} else if (a.match(/^--.+=/) || !h["short-option-groups"] && a.match(/^-.+=/))
|
|
185
|
-
l = a.match(/^--?([^=]+)=([\s\S]*)$/), l !== null && Array.isArray(l) && l.length >= 3 && (g(l[1], r.arrays) ?
|
|
185
|
+
l = a.match(/^--?([^=]+)=([\s\S]*)$/), l !== null && Array.isArray(l) && l.length >= 3 && (g(l[1], r.arrays) ? t = V(t, l[1], u, l[2]) : g(l[1], r.nargs) !== !1 ? t = D(t, l[1], u, l[2]) : q(l[1], l[2], !0));
|
|
186
186
|
else if (a.match(U) && h["boolean-negation"])
|
|
187
|
-
l = a.match(U), l !== null && Array.isArray(l) && l.length >= 2 && (
|
|
187
|
+
l = a.match(U), l !== null && Array.isArray(l) && l.length >= 2 && (e = l[1], q(e, g(e, r.arrays) ? [!1] : !1));
|
|
188
188
|
else if (a.match(/^--.+/) || !h["short-option-groups"] && a.match(/^-[^-]+/))
|
|
189
|
-
l = a.match(/^--?(.+)/), l !== null && Array.isArray(l) && l.length >= 2 && (
|
|
189
|
+
l = a.match(/^--?(.+)/), l !== null && Array.isArray(l) && l.length >= 2 && (e = l[1], g(e, r.arrays) ? t = V(t, e, u) : g(e, r.nargs) !== !1 ? t = D(t, e, u) : (d = u[t + 1], d !== void 0 && (!d.match(/^-/) || d.match(L)) && !g(e, r.bools) && !g(e, r.counts) || /^(true|false)$/.test(d) ? (q(e, d), t++) : q(e, R(e))));
|
|
190
190
|
else if (a.match(/^-.\..+=/))
|
|
191
191
|
l = a.match(/^-([^=]+)=([\s\S]*)$/), l !== null && Array.isArray(l) && l.length >= 3 && q(l[1], l[2]);
|
|
192
192
|
else if (a.match(/^-.\..+/) && !a.match(L))
|
|
193
|
-
d = u[
|
|
193
|
+
d = u[t + 1], l = a.match(/^-(.\..+)/), l !== null && Array.isArray(l) && l.length >= 2 && (e = l[1], d !== void 0 && !d.match(/^-/) && !g(e, r.bools) && !g(e, r.counts) ? (q(e, d), t++) : q(e, R(e)));
|
|
194
194
|
else if (a.match(/^-[^-]+/) && !a.match(L)) {
|
|
195
195
|
p = a.slice(1, -1).split(""), o = !1;
|
|
196
196
|
for (let x = 0; x < p.length; x++) {
|
|
197
197
|
if (d = a.slice(x + 2), p[x + 1] && p[x + 1] === "=") {
|
|
198
|
-
v = a.slice(x + 3),
|
|
198
|
+
v = a.slice(x + 3), e = p[x], g(e, r.arrays) ? t = V(t, e, u, v) : g(e, r.nargs) !== !1 ? t = D(t, e, u, v) : q(e, v), o = !0;
|
|
199
199
|
break;
|
|
200
200
|
}
|
|
201
201
|
if (d === "-") {
|
|
@@ -212,82 +212,82 @@ class Ne {
|
|
|
212
212
|
} else
|
|
213
213
|
q(p[x], R(p[x]));
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
e = a.slice(-1)[0], !o && e !== "-" && (g(e, r.arrays) ? t = V(t, e, u) : g(e, r.nargs) !== !1 ? t = D(t, e, u) : (d = u[t + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(L)) && !g(e, r.bools) && !g(e, r.counts) || /^(true|false)$/.test(d) ? (q(e, d), t++) : q(e, R(e))));
|
|
216
216
|
} else if (a.match(/^-[0-9]$/) && a.match(L) && g(a.slice(1), r.bools))
|
|
217
|
-
|
|
217
|
+
e = a.slice(1), q(e, R(e));
|
|
218
218
|
else if (a === "--") {
|
|
219
|
-
F = u.slice(
|
|
219
|
+
F = u.slice(t + 1);
|
|
220
220
|
break;
|
|
221
221
|
} else if (h["halt-at-non-option"]) {
|
|
222
|
-
F = u.slice(
|
|
222
|
+
F = u.slice(t);
|
|
223
223
|
break;
|
|
224
224
|
} else
|
|
225
225
|
K(a);
|
|
226
226
|
}
|
|
227
|
-
|
|
228
|
-
E(w,
|
|
229
|
-
}), S && F.length && (w[G] = []), F.forEach(function(
|
|
230
|
-
w[G].push(
|
|
231
|
-
}), h["camel-case-expansion"] && h["strip-dashed"] && Object.keys(w).filter((
|
|
232
|
-
delete w[
|
|
233
|
-
}), h["strip-aliased"] && [].concat(...Object.keys(_).map((
|
|
234
|
-
h["camel-case-expansion"] &&
|
|
227
|
+
rt(w, !0), rt(w, !1), kt(w), gt(), mt(w, r.aliases, f, !0), ft(w), h["set-placeholder-key"] && bt(w), Object.keys(r.counts).forEach(function(t) {
|
|
228
|
+
E(w, t.split(".")) || q(t, 0);
|
|
229
|
+
}), S && F.length && (w[G] = []), F.forEach(function(t) {
|
|
230
|
+
w[G].push(t);
|
|
231
|
+
}), h["camel-case-expansion"] && h["strip-dashed"] && Object.keys(w).filter((t) => t !== "--" && t.includes("-")).forEach((t) => {
|
|
232
|
+
delete w[t];
|
|
233
|
+
}), h["strip-aliased"] && [].concat(...Object.keys(_).map((t) => _[t])).forEach((t) => {
|
|
234
|
+
h["camel-case-expansion"] && t.includes("-") && delete w[t.split(".").map((a) => W(a)).join(".")], delete w[t];
|
|
235
235
|
});
|
|
236
|
-
function K(
|
|
237
|
-
const a = $("_",
|
|
236
|
+
function K(t) {
|
|
237
|
+
const a = $("_", t);
|
|
238
238
|
(typeof a == "string" || typeof a == "number") && w._.push(a);
|
|
239
239
|
}
|
|
240
|
-
function D(
|
|
241
|
-
let
|
|
240
|
+
function D(t, a, c, o) {
|
|
241
|
+
let e, p = g(a, 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)),
|
|
243
|
+
return T(o) || (B = Error(C("Argument unexpected for: %s", a))), q(a, R(a)), t;
|
|
244
244
|
let l = T(o) ? 0 : 1;
|
|
245
245
|
if (h["nargs-eats-options"])
|
|
246
|
-
c.length - (
|
|
246
|
+
c.length - (t + 1) + l < p && (B = Error(C("Not enough arguments following: %s", a))), l = p;
|
|
247
247
|
else {
|
|
248
|
-
for (
|
|
248
|
+
for (e = t + 1; e < c.length && (!c[e].match(/^-[^0-9]/) || c[e].match(L) || H(c[e])); e++)
|
|
249
249
|
l++;
|
|
250
250
|
l < p && (B = Error(C("Not enough arguments following: %s", a)));
|
|
251
251
|
}
|
|
252
252
|
let d = Math.min(l, p);
|
|
253
|
-
for (!T(o) && d > 0 && (q(a, o), d--),
|
|
254
|
-
q(a, c[
|
|
255
|
-
return
|
|
253
|
+
for (!T(o) && d > 0 && (q(a, o), d--), e = t + 1; e < d + t + 1; e++)
|
|
254
|
+
q(a, c[e]);
|
|
255
|
+
return t + d;
|
|
256
256
|
}
|
|
257
|
-
function V(
|
|
258
|
-
let
|
|
257
|
+
function V(t, a, c, o) {
|
|
258
|
+
let e = [], p = o || c[t + 1];
|
|
259
259
|
const l = g(a, r.nargs);
|
|
260
260
|
if (g(a, r.bools) && !/^(true|false)$/.test(p))
|
|
261
|
-
|
|
261
|
+
e.push(!0);
|
|
262
262
|
else if (T(p) || T(o) && /^-/.test(p) && !L.test(p) && !H(p)) {
|
|
263
263
|
if (f[a] !== void 0) {
|
|
264
264
|
const d = f[a];
|
|
265
|
-
|
|
265
|
+
e = Array.isArray(d) ? d : [d];
|
|
266
266
|
}
|
|
267
267
|
} else {
|
|
268
|
-
T(o) ||
|
|
269
|
-
for (let d =
|
|
270
|
-
|
|
268
|
+
T(o) || e.push(Y(a, o, !0));
|
|
269
|
+
for (let d = t + 1; d < c.length && !(!h["greedy-arrays"] && e.length > 0 || l && typeof l == "number" && e.length >= l || (p = c[d], /^-/.test(p) && !L.test(p) && !H(p))); d++)
|
|
270
|
+
t = d, e.push(Y(a, p, k));
|
|
271
271
|
}
|
|
272
|
-
return typeof l == "number" && (l &&
|
|
272
|
+
return typeof l == "number" && (l && e.length < l || isNaN(l) && e.length === 0) && (B = Error(C("Not enough arguments following: %s", a))), q(a, e), t;
|
|
273
273
|
}
|
|
274
|
-
function q(
|
|
275
|
-
if (/-/.test(
|
|
276
|
-
const p =
|
|
274
|
+
function q(t, a, c = k) {
|
|
275
|
+
if (/-/.test(t) && h["camel-case-expansion"]) {
|
|
276
|
+
const p = t.split(".").map(function(l) {
|
|
277
277
|
return W(l);
|
|
278
278
|
}).join(".");
|
|
279
|
-
|
|
279
|
+
nt(t, p);
|
|
280
280
|
}
|
|
281
|
-
const o = Y(
|
|
282
|
-
N(w,
|
|
281
|
+
const o = Y(t, a, c), e = t.split(".");
|
|
282
|
+
N(w, e, o), r.aliases[t] && r.aliases[t].forEach(function(p) {
|
|
283
283
|
const l = p.split(".");
|
|
284
284
|
N(w, l, o);
|
|
285
|
-
}),
|
|
285
|
+
}), e.length > 1 && h["dot-notation"] && (r.aliases[e[0]] || []).forEach(function(p) {
|
|
286
286
|
let l = p.split(".");
|
|
287
|
-
const d = [].concat(
|
|
288
|
-
d.shift(), l = l.concat(d), (r.aliases[
|
|
289
|
-
}), g(
|
|
290
|
-
Object.defineProperty(
|
|
287
|
+
const d = [].concat(e);
|
|
288
|
+
d.shift(), l = l.concat(d), (r.aliases[t] || []).includes(l.join(".")) || N(w, l, o);
|
|
289
|
+
}), g(t, r.normalize) && !g(t, r.arrays) && [t].concat(r.aliases[t] || []).forEach(function(l) {
|
|
290
|
+
Object.defineProperty(st, l, {
|
|
291
291
|
enumerable: !0,
|
|
292
292
|
get() {
|
|
293
293
|
return a;
|
|
@@ -298,219 +298,219 @@ class Ne {
|
|
|
298
298
|
});
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
-
function
|
|
302
|
-
r.aliases[
|
|
301
|
+
function nt(t, a) {
|
|
302
|
+
r.aliases[t] && r.aliases[t].length || (r.aliases[t] = [a], Q[a] = !0), r.aliases[a] && r.aliases[a].length || nt(a, t);
|
|
303
303
|
}
|
|
304
|
-
function Y(
|
|
305
|
-
c && (a =
|
|
306
|
-
let o = Array.isArray(a) ? a.map(function(
|
|
307
|
-
return $(
|
|
308
|
-
}) : $(
|
|
309
|
-
return g(
|
|
304
|
+
function Y(t, a, c) {
|
|
305
|
+
c && (a = jt(a)), (g(t, r.bools) || g(t, r.counts)) && typeof a == "string" && (a = a === "true");
|
|
306
|
+
let o = Array.isArray(a) ? a.map(function(e) {
|
|
307
|
+
return $(t, e);
|
|
308
|
+
}) : $(t, a);
|
|
309
|
+
return g(t, r.counts) && (T(o) || typeof o == "boolean") && (o = Z()), g(t, r.normalize) && g(t, r.arrays) && (Array.isArray(a) ? o = a.map((e) => A.normalize(e)) : o = A.normalize(a)), o;
|
|
310
310
|
}
|
|
311
|
-
function $(
|
|
312
|
-
return !h["parse-positional-numbers"] &&
|
|
311
|
+
function $(t, a) {
|
|
312
|
+
return !h["parse-positional-numbers"] && t === "_" || !g(t, r.strings) && !g(t, r.bools) && !Array.isArray(a) && (Rt(a) && h["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${a}`))) || !T(a) && g(t, r.numbers)) && (a = Number(a)), a;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function kt(t) {
|
|
315
315
|
const a = /* @__PURE__ */ Object.create(null);
|
|
316
|
-
|
|
317
|
-
const o =
|
|
316
|
+
mt(a, r.aliases, f), Object.keys(r.configs).forEach(function(c) {
|
|
317
|
+
const o = t[c] || a[c];
|
|
318
318
|
if (o)
|
|
319
319
|
try {
|
|
320
|
-
let
|
|
320
|
+
let e = null;
|
|
321
321
|
const p = A.resolve(A.cwd(), o), l = r.configs[c];
|
|
322
322
|
if (typeof l == "function") {
|
|
323
323
|
try {
|
|
324
|
-
|
|
324
|
+
e = l(p);
|
|
325
325
|
} catch (d) {
|
|
326
|
-
|
|
326
|
+
e = d;
|
|
327
327
|
}
|
|
328
|
-
if (
|
|
329
|
-
B =
|
|
328
|
+
if (e instanceof Error) {
|
|
329
|
+
B = e;
|
|
330
330
|
return;
|
|
331
331
|
}
|
|
332
332
|
} else
|
|
333
|
-
|
|
334
|
-
J(
|
|
335
|
-
} catch (
|
|
336
|
-
|
|
333
|
+
e = A.require(p);
|
|
334
|
+
J(e);
|
|
335
|
+
} catch (e) {
|
|
336
|
+
e.name === "PermissionDenied" ? B = e : t[c] && (B = Error(C("Invalid JSON config file: %s", o)));
|
|
337
337
|
}
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
|
-
function J(
|
|
341
|
-
Object.keys(
|
|
342
|
-
const o =
|
|
343
|
-
typeof o == "object" && o !== null && !Array.isArray(o) && h["dot-notation"] ? J(o,
|
|
340
|
+
function J(t, a) {
|
|
341
|
+
Object.keys(t).forEach(function(c) {
|
|
342
|
+
const o = t[c], e = a ? a + "." + c : c;
|
|
343
|
+
typeof o == "object" && o !== null && !Array.isArray(o) && h["dot-notation"] ? J(o, e) : (!E(w, e.split(".")) || g(e, r.arrays) && h["combine-arrays"]) && q(e, o);
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
|
-
function
|
|
347
|
-
typeof y < "u" && y.forEach(function(
|
|
348
|
-
J(
|
|
346
|
+
function gt() {
|
|
347
|
+
typeof y < "u" && y.forEach(function(t) {
|
|
348
|
+
J(t);
|
|
349
349
|
});
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function rt(t, a) {
|
|
352
352
|
if (typeof P > "u")
|
|
353
353
|
return;
|
|
354
354
|
const c = typeof P == "string" ? P : "", o = A.env();
|
|
355
|
-
Object.keys(o).forEach(function(
|
|
356
|
-
if (c === "" ||
|
|
357
|
-
const p =
|
|
355
|
+
Object.keys(o).forEach(function(e) {
|
|
356
|
+
if (c === "" || e.lastIndexOf(c, 0) === 0) {
|
|
357
|
+
const p = e.split("__").map(function(l, d) {
|
|
358
358
|
return d === 0 && (l = l.substring(c.length)), W(l);
|
|
359
359
|
});
|
|
360
|
-
(a && r.configs[p.join(".")] || !a) && !E(
|
|
360
|
+
(a && r.configs[p.join(".")] || !a) && !E(t, p) && q(p.join("."), o[e]);
|
|
361
361
|
}
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function ft(t) {
|
|
365
365
|
let a;
|
|
366
366
|
const c = /* @__PURE__ */ new Set();
|
|
367
|
-
Object.keys(
|
|
367
|
+
Object.keys(t).forEach(function(o) {
|
|
368
368
|
if (!c.has(o) && (a = g(o, r.coercions), typeof a == "function"))
|
|
369
369
|
try {
|
|
370
|
-
const
|
|
370
|
+
const e = $(o, a(t[o]));
|
|
371
371
|
[].concat(r.aliases[o] || [], o).forEach((p) => {
|
|
372
|
-
c.add(p),
|
|
372
|
+
c.add(p), t[p] = e;
|
|
373
373
|
});
|
|
374
|
-
} catch (
|
|
375
|
-
B =
|
|
374
|
+
} catch (e) {
|
|
375
|
+
B = e;
|
|
376
376
|
}
|
|
377
377
|
});
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function bt(t) {
|
|
380
380
|
return r.keys.forEach((a) => {
|
|
381
|
-
~a.indexOf(".") || typeof
|
|
382
|
-
}),
|
|
381
|
+
~a.indexOf(".") || typeof t[a] > "u" && (t[a] = void 0);
|
|
382
|
+
}), t;
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
Object.keys(c).forEach(function(
|
|
386
|
-
E(
|
|
387
|
-
E(
|
|
384
|
+
function mt(t, a, c, o = !1) {
|
|
385
|
+
Object.keys(c).forEach(function(e) {
|
|
386
|
+
E(t, e.split(".")) || (N(t, e.split("."), c[e]), o && (ot[e] = !0), (a[e] || []).forEach(function(p) {
|
|
387
|
+
E(t, p.split(".")) || N(t, p.split("."), c[e]);
|
|
388
388
|
}));
|
|
389
389
|
});
|
|
390
390
|
}
|
|
391
|
-
function E(
|
|
392
|
-
let c =
|
|
393
|
-
h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(
|
|
394
|
-
c = c[
|
|
391
|
+
function E(t, a) {
|
|
392
|
+
let c = t;
|
|
393
|
+
h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(e) {
|
|
394
|
+
c = c[e] || {};
|
|
395
395
|
});
|
|
396
396
|
const o = a[a.length - 1];
|
|
397
397
|
return typeof c != "object" ? !1 : o in c;
|
|
398
398
|
}
|
|
399
|
-
function N(
|
|
400
|
-
let o =
|
|
399
|
+
function N(t, a, c) {
|
|
400
|
+
let o = t;
|
|
401
401
|
h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(v) {
|
|
402
|
-
v =
|
|
402
|
+
v = ct(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
|
|
404
|
+
const e = ct(a[a.length - 1]), p = g(a.join("."), r.arrays), l = Array.isArray(c);
|
|
405
405
|
let d = h["duplicate-arguments-array"];
|
|
406
|
-
!d && g(
|
|
406
|
+
!d && g(e, r.nargs) && (d = !0, (!T(o[e]) && r.nargs[e] === 1 || Array.isArray(o[e]) && o[e].length === r.nargs[e]) && (o[e] = void 0)), c === Z() ? o[e] = Z(o[e]) : Array.isArray(o[e]) ? d && p && l ? o[e] = h["flatten-duplicate-arrays"] ? o[e].concat(c) : (Array.isArray(o[e][0]) ? o[e] : [o[e]]).concat([c]) : !d && !!p == !!l ? o[e] = c : o[e] = o[e].concat([c]) : o[e] === void 0 && p ? o[e] = l ? c : [c] : d && !(o[e] === void 0 || g(e, r.counts) || g(e, r.bools)) ? o[e] = [o[e], c] : o[e] = c;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
|
|
408
|
+
function qt(...t) {
|
|
409
|
+
t.forEach(function(a) {
|
|
410
410
|
Object.keys(a || {}).forEach(function(c) {
|
|
411
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
|
-
const
|
|
414
|
-
|
|
413
|
+
const e = W(o);
|
|
414
|
+
e !== c && r.aliases[c].indexOf(e) === -1 && (r.aliases[c].push(e), Q[e] = !0);
|
|
415
415
|
}
|
|
416
416
|
}), r.aliases[c].concat(c).forEach(function(o) {
|
|
417
417
|
if (o.length > 1 && /[A-Z]/.test(o) && h["camel-case-expansion"]) {
|
|
418
|
-
const
|
|
419
|
-
|
|
418
|
+
const e = Ot(o, "-");
|
|
419
|
+
e !== c && r.aliases[c].indexOf(e) === -1 && (r.aliases[c].push(e), Q[e] = !0);
|
|
420
420
|
}
|
|
421
421
|
}), r.aliases[c].forEach(function(o) {
|
|
422
|
-
r.aliases[o] = [c].concat(r.aliases[c].filter(function(
|
|
423
|
-
return o !==
|
|
422
|
+
r.aliases[o] = [c].concat(r.aliases[c].filter(function(e) {
|
|
423
|
+
return o !== e;
|
|
424
424
|
}));
|
|
425
425
|
}));
|
|
426
426
|
});
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
|
-
function g(
|
|
430
|
-
const c = [].concat(r.aliases[
|
|
431
|
-
return
|
|
429
|
+
function g(t, a) {
|
|
430
|
+
const c = [].concat(r.aliases[t] || [], t), o = Object.keys(a), e = c.find((p) => o.includes(p));
|
|
431
|
+
return e ? a[e] : !1;
|
|
432
432
|
}
|
|
433
|
-
function
|
|
433
|
+
function ut(t) {
|
|
434
434
|
const a = Object.keys(r);
|
|
435
435
|
return [].concat(a.map((o) => r[o])).some(function(o) {
|
|
436
|
-
return Array.isArray(o) ? o.includes(
|
|
436
|
+
return Array.isArray(o) ? o.includes(t) : o[t];
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function wt(t, ...a) {
|
|
440
440
|
return [].concat(...a).some(function(o) {
|
|
441
|
-
const
|
|
442
|
-
return
|
|
441
|
+
const e = t.match(o);
|
|
442
|
+
return e && ut(e[1]);
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
|
-
function
|
|
446
|
-
if (
|
|
445
|
+
function vt(t) {
|
|
446
|
+
if (t.match(L) || !t.match(/^-[^-]+/))
|
|
447
447
|
return !1;
|
|
448
448
|
let a = !0, c;
|
|
449
|
-
const o =
|
|
450
|
-
for (let
|
|
451
|
-
if (c =
|
|
449
|
+
const o = t.slice(1).split("");
|
|
450
|
+
for (let e = 0; e < o.length; e++) {
|
|
451
|
+
if (c = t.slice(e + 2), !ut(o[e])) {
|
|
452
452
|
a = !1;
|
|
453
453
|
break;
|
|
454
454
|
}
|
|
455
|
-
if (o[
|
|
455
|
+
if (o[e + 1] && o[e + 1] === "=" || c === "-" || /[A-Za-z]/.test(o[e]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(c) || o[e + 1] && o[e + 1].match(/\W/))
|
|
456
456
|
break;
|
|
457
457
|
}
|
|
458
458
|
return a;
|
|
459
459
|
}
|
|
460
|
-
function H(
|
|
461
|
-
return h["unknown-options-as-args"] &&
|
|
460
|
+
function H(t) {
|
|
461
|
+
return h["unknown-options-as-args"] && xt(t);
|
|
462
462
|
}
|
|
463
|
-
function
|
|
464
|
-
return
|
|
463
|
+
function xt(t) {
|
|
464
|
+
return t = t.replace(/^-{3,}/, "--"), t.match(L) || vt(t) ? !1 : !wt(t, /^-+([^=]+?)=[\s\S]*$/, U, /^-+([^=]+?)$/, /^-+([^=]+?)-$/, /^-+([^=]+?\d+)$/, /^-+([^=]+?)\W+.*$/);
|
|
465
465
|
}
|
|
466
|
-
function R(
|
|
467
|
-
return !g(
|
|
466
|
+
function R(t) {
|
|
467
|
+
return !g(t, r.bools) && !g(t, r.counts) && `${t}` in f ? f[t] : yt(Bt(t));
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function yt(t) {
|
|
470
470
|
return {
|
|
471
471
|
[I.BOOLEAN]: !0,
|
|
472
472
|
[I.STRING]: "",
|
|
473
473
|
[I.NUMBER]: void 0,
|
|
474
474
|
[I.ARRAY]: []
|
|
475
|
-
}[
|
|
475
|
+
}[t];
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function Bt(t) {
|
|
478
478
|
let a = I.BOOLEAN;
|
|
479
|
-
return g(
|
|
479
|
+
return g(t, r.strings) ? a = I.STRING : g(t, r.numbers) ? a = I.NUMBER : g(t, r.bools) ? a = I.BOOLEAN : g(t, r.arrays) && (a = I.ARRAY), a;
|
|
480
480
|
}
|
|
481
|
-
function T(
|
|
482
|
-
return
|
|
481
|
+
function T(t) {
|
|
482
|
+
return t === void 0;
|
|
483
483
|
}
|
|
484
|
-
function
|
|
485
|
-
Object.keys(r.counts).find((
|
|
484
|
+
function Mt() {
|
|
485
|
+
Object.keys(r.counts).find((t) => g(t, r.arrays) ? (B = Error(C("Invalid configuration: %s, opts.count excludes opts.array.", t)), !0) : g(t, r.nargs) ? (B = Error(C("Invalid configuration: %s, opts.count excludes opts.narg.", t)), !0) : !1);
|
|
486
486
|
}
|
|
487
487
|
return {
|
|
488
488
|
aliases: Object.assign({}, r.aliases),
|
|
489
|
-
argv: Object.assign(
|
|
489
|
+
argv: Object.assign(st, w),
|
|
490
490
|
configuration: h,
|
|
491
|
-
defaulted: Object.assign({},
|
|
491
|
+
defaulted: Object.assign({}, ot),
|
|
492
492
|
error: B,
|
|
493
493
|
newAliases: Object.assign({}, Q)
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
function
|
|
498
|
-
const
|
|
499
|
-
let
|
|
497
|
+
function zt(i) {
|
|
498
|
+
const s = [], m = /* @__PURE__ */ Object.create(null);
|
|
499
|
+
let n = !0;
|
|
500
500
|
for (Object.keys(i).forEach(function(u) {
|
|
501
|
-
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
for (let u = 0; u <
|
|
505
|
-
for (let k = u + 1; k <
|
|
506
|
-
if (
|
|
507
|
-
return
|
|
501
|
+
s.push([].concat(i[u], u));
|
|
502
|
+
}); n; ) {
|
|
503
|
+
n = !1;
|
|
504
|
+
for (let u = 0; u < s.length; u++)
|
|
505
|
+
for (let k = u + 1; k < s.length; k++)
|
|
506
|
+
if (s[u].filter(function(h) {
|
|
507
|
+
return s[k].indexOf(h) !== -1;
|
|
508
508
|
}).length) {
|
|
509
|
-
|
|
509
|
+
s[u] = s[u].concat(s[k]), s.splice(k, 1), n = !0;
|
|
510
510
|
break;
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
return
|
|
513
|
+
return s.forEach(function(u) {
|
|
514
514
|
u = u.filter(function(_, h, f) {
|
|
515
515
|
return f.indexOf(_) === h;
|
|
516
516
|
});
|
|
@@ -521,10 +521,10 @@ function ze(i) {
|
|
|
521
521
|
function Z(i) {
|
|
522
522
|
return i !== void 0 ? i + 1 : 1;
|
|
523
523
|
}
|
|
524
|
-
function
|
|
524
|
+
function ct(i) {
|
|
525
525
|
return i === "__proto__" ? "___proto___" : i;
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function jt(i) {
|
|
528
528
|
return typeof i == "string" && (i[0] === "'" || i[0] === '"') && i[i.length - 1] === i[0] ? i.substring(1, i.length - 1) : i;
|
|
529
529
|
}
|
|
530
530
|
/**
|
|
@@ -535,132 +535,132 @@ function je(i) {
|
|
|
535
535
|
* Copyright (c) 2016, Contributors
|
|
536
536
|
* SPDX-License-Identifier: ISC
|
|
537
537
|
*/
|
|
538
|
-
var X,
|
|
539
|
-
const
|
|
540
|
-
if (
|
|
541
|
-
throw Error(`yargs parser supports a minimum Node.js version of ${
|
|
542
|
-
const
|
|
543
|
-
new
|
|
538
|
+
var X, tt, et;
|
|
539
|
+
const lt = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12, pt = (tt = (X = process == null ? void 0 : process.versions) === null || X === void 0 ? void 0 : X.node) !== null && tt !== void 0 ? tt : (et = process == null ? void 0 : process.version) === null || et === void 0 ? void 0 : et.slice(1);
|
|
540
|
+
if (pt && Number(pt.match(/^([^.]+)/)[1]) < lt)
|
|
541
|
+
throw Error(`yargs parser supports a minimum Node.js version of ${lt}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
|
|
542
|
+
const Qt = process ? process.env : {};
|
|
543
|
+
new Nt({
|
|
544
544
|
cwd: process.cwd,
|
|
545
|
-
env: () =>
|
|
546
|
-
format:
|
|
547
|
-
normalize:
|
|
548
|
-
resolve:
|
|
545
|
+
env: () => Qt,
|
|
546
|
+
format: ht,
|
|
547
|
+
normalize: It,
|
|
548
|
+
resolve: at,
|
|
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
551
|
require: (i) => {
|
|
552
552
|
if (typeof require < "u")
|
|
553
553
|
return require(i);
|
|
554
554
|
if (i.match(/\.json$/))
|
|
555
|
-
return JSON.parse(
|
|
555
|
+
return JSON.parse(_t(i, "utf8"));
|
|
556
556
|
throw Error("only .json config files are supported in ESM");
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
|
-
const
|
|
559
|
+
const Ft = {
|
|
560
560
|
fs: {
|
|
561
|
-
readFileSync:
|
|
562
|
-
writeFile:
|
|
561
|
+
readFileSync: _t,
|
|
562
|
+
writeFile: Lt
|
|
563
563
|
},
|
|
564
|
-
format:
|
|
565
|
-
resolve:
|
|
564
|
+
format: ht,
|
|
565
|
+
resolve: at,
|
|
566
566
|
exists: (i) => {
|
|
567
567
|
try {
|
|
568
|
-
return
|
|
568
|
+
return Pt(i).isFile();
|
|
569
569
|
} catch {
|
|
570
570
|
return !1;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
};
|
|
574
574
|
let M;
|
|
575
|
-
class
|
|
576
|
-
constructor(
|
|
577
|
-
|
|
575
|
+
class Dt {
|
|
576
|
+
constructor(s) {
|
|
577
|
+
s = s || {}, this.directory = s.directory || "./locales", this.updateFiles = typeof s.updateFiles == "boolean" ? s.updateFiles : !0, this.locale = s.locale || "en", this.fallbackToLanguage = typeof s.fallbackToLanguage == "boolean" ? s.fallbackToLanguage : !0, this.cache = /* @__PURE__ */ Object.create(null), this.writeQueue = [];
|
|
578
578
|
}
|
|
579
|
-
__(...
|
|
579
|
+
__(...s) {
|
|
580
580
|
if (typeof arguments[0] != "string")
|
|
581
581
|
return this._taggedLiteral(arguments[0], ...arguments);
|
|
582
|
-
const m =
|
|
583
|
-
let
|
|
582
|
+
const m = s.shift();
|
|
583
|
+
let n = function() {
|
|
584
584
|
};
|
|
585
|
-
return typeof
|
|
585
|
+
return typeof s[s.length - 1] == "function" && (n = s.pop()), n = n || function() {
|
|
586
586
|
}, this.cache[this.locale] || this._readLocaleFile(), !this.cache[this.locale][m] && this.updateFiles ? (this.cache[this.locale][m] = m, this._enqueueWrite({
|
|
587
587
|
directory: this.directory,
|
|
588
588
|
locale: this.locale,
|
|
589
|
-
cb:
|
|
590
|
-
})) :
|
|
589
|
+
cb: n
|
|
590
|
+
})) : n(), M.format.apply(M.format, [this.cache[this.locale][m] || m].concat(s));
|
|
591
591
|
}
|
|
592
592
|
__n() {
|
|
593
|
-
const
|
|
593
|
+
const s = Array.prototype.slice.call(arguments), m = s.shift(), n = s.shift(), u = s.shift();
|
|
594
594
|
let k = function() {
|
|
595
595
|
};
|
|
596
|
-
typeof
|
|
597
|
-
let _ = u === 1 ? m :
|
|
596
|
+
typeof s[s.length - 1] == "function" && (k = s.pop()), this.cache[this.locale] || this._readLocaleFile();
|
|
597
|
+
let _ = u === 1 ? m : n;
|
|
598
598
|
this.cache[this.locale][m] && (_ = this.cache[this.locale][m][u === 1 ? "one" : "other"]), !this.cache[this.locale][m] && this.updateFiles ? (this.cache[this.locale][m] = {
|
|
599
599
|
one: m,
|
|
600
|
-
other:
|
|
600
|
+
other: n
|
|
601
601
|
}, this._enqueueWrite({
|
|
602
602
|
directory: this.directory,
|
|
603
603
|
locale: this.locale,
|
|
604
604
|
cb: k
|
|
605
605
|
})) : k();
|
|
606
606
|
const h = [_];
|
|
607
|
-
return ~_.indexOf("%d") && h.push(u), M.format.apply(M.format, h.concat(
|
|
607
|
+
return ~_.indexOf("%d") && h.push(u), M.format.apply(M.format, h.concat(s));
|
|
608
608
|
}
|
|
609
|
-
setLocale(
|
|
610
|
-
this.locale =
|
|
609
|
+
setLocale(s) {
|
|
610
|
+
this.locale = s;
|
|
611
611
|
}
|
|
612
612
|
getLocale() {
|
|
613
613
|
return this.locale;
|
|
614
614
|
}
|
|
615
|
-
updateLocale(
|
|
615
|
+
updateLocale(s) {
|
|
616
616
|
this.cache[this.locale] || this._readLocaleFile();
|
|
617
|
-
for (const m in
|
|
618
|
-
Object.prototype.hasOwnProperty.call(
|
|
617
|
+
for (const m in s)
|
|
618
|
+
Object.prototype.hasOwnProperty.call(s, m) && (this.cache[this.locale][m] = s[m]);
|
|
619
619
|
}
|
|
620
|
-
_taggedLiteral(
|
|
621
|
-
let
|
|
622
|
-
return
|
|
620
|
+
_taggedLiteral(s, ...m) {
|
|
621
|
+
let n = "";
|
|
622
|
+
return s.forEach(function(u, k) {
|
|
623
623
|
const _ = m[k + 1];
|
|
624
|
-
|
|
625
|
-
}), this.__.apply(this, [
|
|
624
|
+
n += u, typeof _ < "u" && (n += "%s");
|
|
625
|
+
}), this.__.apply(this, [n].concat([].slice.call(m, 1)));
|
|
626
626
|
}
|
|
627
|
-
_enqueueWrite(
|
|
628
|
-
this.writeQueue.push(
|
|
627
|
+
_enqueueWrite(s) {
|
|
628
|
+
this.writeQueue.push(s), this.writeQueue.length === 1 && this._processWriteQueue();
|
|
629
629
|
}
|
|
630
630
|
_processWriteQueue() {
|
|
631
|
-
const
|
|
631
|
+
const s = this, m = this.writeQueue[0], n = m.directory, u = m.locale, k = m.cb, _ = this._resolveLocaleFile(n, u), h = JSON.stringify(this.cache[u], null, 2);
|
|
632
632
|
M.fs.writeFile(_, h, "utf-8", function(f) {
|
|
633
|
-
|
|
633
|
+
s.writeQueue.shift(), s.writeQueue.length > 0 && s._processWriteQueue(), k(f);
|
|
634
634
|
});
|
|
635
635
|
}
|
|
636
636
|
_readLocaleFile() {
|
|
637
|
-
let
|
|
637
|
+
let s = {};
|
|
638
638
|
const m = this._resolveLocaleFile(this.directory, this.locale);
|
|
639
639
|
try {
|
|
640
|
-
M.fs.readFileSync && (
|
|
641
|
-
} catch (
|
|
642
|
-
if (
|
|
643
|
-
|
|
640
|
+
M.fs.readFileSync && (s = JSON.parse(M.fs.readFileSync(m, "utf-8")));
|
|
641
|
+
} catch (n) {
|
|
642
|
+
if (n instanceof SyntaxError && (n.message = "syntax error in " + m), n.code === "ENOENT")
|
|
643
|
+
s = {};
|
|
644
644
|
else
|
|
645
|
-
throw
|
|
645
|
+
throw n;
|
|
646
646
|
}
|
|
647
|
-
this.cache[this.locale] =
|
|
647
|
+
this.cache[this.locale] = s;
|
|
648
648
|
}
|
|
649
|
-
_resolveLocaleFile(
|
|
650
|
-
let
|
|
651
|
-
if (this.fallbackToLanguage && !this._fileExistsSync(
|
|
652
|
-
const u = M.resolve(
|
|
653
|
-
this._fileExistsSync(u) && (
|
|
649
|
+
_resolveLocaleFile(s, m) {
|
|
650
|
+
let n = M.resolve(s, "./", m + ".json");
|
|
651
|
+
if (this.fallbackToLanguage && !this._fileExistsSync(n) && ~m.lastIndexOf("_")) {
|
|
652
|
+
const u = M.resolve(s, "./", m.split("_")[0] + ".json");
|
|
653
|
+
this._fileExistsSync(u) && (n = u);
|
|
654
654
|
}
|
|
655
|
-
return
|
|
655
|
+
return n;
|
|
656
656
|
}
|
|
657
|
-
_fileExistsSync(
|
|
658
|
-
return M.exists(
|
|
657
|
+
_fileExistsSync(s) {
|
|
658
|
+
return M.exists(s);
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
|
-
function
|
|
662
|
-
M =
|
|
663
|
-
const m = new
|
|
661
|
+
function Vt(i, s) {
|
|
662
|
+
M = s;
|
|
663
|
+
const m = new Dt(i);
|
|
664
664
|
return {
|
|
665
665
|
__: m.__.bind(m),
|
|
666
666
|
__n: m.__n.bind(m),
|
|
@@ -670,19 +670,19 @@ function Ve(i, n) {
|
|
|
670
670
|
locale: m.locale
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
const $
|
|
673
|
+
const $t = (i) => Vt(i, Ft);
|
|
674
674
|
let z;
|
|
675
675
|
try {
|
|
676
|
-
z =
|
|
676
|
+
z = Tt(import.meta.url);
|
|
677
677
|
} catch {
|
|
678
678
|
z = process.cwd();
|
|
679
679
|
}
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
directory:
|
|
680
|
+
const Ht = z.substring(0, z.lastIndexOf("node_modules"));
|
|
681
|
+
Ht || process.cwd(), process.cwd, process.exit, process.nextTick, typeof process.stdout.columns < "u" && process.stdout.columns, $t({
|
|
682
|
+
directory: at(z, "../../../locales"),
|
|
683
683
|
updateFiles: !1
|
|
684
684
|
});
|
|
685
|
-
const
|
|
685
|
+
const it = [
|
|
686
686
|
{
|
|
687
687
|
id: "anthropic",
|
|
688
688
|
name: "Anthropic",
|
|
@@ -731,6 +731,28 @@ const ie = [
|
|
|
731
731
|
required: !0
|
|
732
732
|
}
|
|
733
733
|
]
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
api_flavor: "chat",
|
|
737
|
+
root: "usage",
|
|
738
|
+
model_path: "model",
|
|
739
|
+
mappings: [
|
|
740
|
+
{
|
|
741
|
+
path: "prompt_tokens",
|
|
742
|
+
dest: "input_tokens",
|
|
743
|
+
required: !0
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
path: "cached_tokens",
|
|
747
|
+
dest: "cache_read_tokens",
|
|
748
|
+
required: !1
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
path: "completion_tokens",
|
|
752
|
+
dest: "output_tokens",
|
|
753
|
+
required: !0
|
|
754
|
+
}
|
|
755
|
+
]
|
|
734
756
|
}
|
|
735
757
|
],
|
|
736
758
|
models: [
|
|
@@ -1280,24 +1302,50 @@ const ie = [
|
|
|
1280
1302
|
}
|
|
1281
1303
|
},
|
|
1282
1304
|
{
|
|
1283
|
-
id: "
|
|
1284
|
-
name: "
|
|
1305
|
+
id: "deepseek.r1-v1:0",
|
|
1306
|
+
name: "DeepSeek-R1",
|
|
1285
1307
|
match: {
|
|
1286
|
-
contains: "
|
|
1308
|
+
contains: "r1"
|
|
1287
1309
|
},
|
|
1288
1310
|
prices: {
|
|
1289
|
-
input_mtok:
|
|
1311
|
+
input_mtok: 1.35,
|
|
1312
|
+
output_mtok: 5.4
|
|
1290
1313
|
}
|
|
1291
1314
|
},
|
|
1292
1315
|
{
|
|
1293
|
-
id: "
|
|
1294
|
-
name: "DeepSeek-R1",
|
|
1316
|
+
id: "global.anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
1295
1317
|
match: {
|
|
1296
|
-
|
|
1318
|
+
starts_with: "global.anthropic.claude-haiku-4-5-20251001-v1"
|
|
1297
1319
|
},
|
|
1298
1320
|
prices: {
|
|
1299
|
-
input_mtok: 1
|
|
1300
|
-
|
|
1321
|
+
input_mtok: 1,
|
|
1322
|
+
cache_write_mtok: 1.25,
|
|
1323
|
+
cache_read_mtok: 0.1,
|
|
1324
|
+
output_mtok: 5
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1327
|
+
{
|
|
1328
|
+
id: "global.anthropic.claude-sonnet-4-20250514-v1:0",
|
|
1329
|
+
match: {
|
|
1330
|
+
starts_with: "global.anthropic.claude-sonnet-4-20250514-v1"
|
|
1331
|
+
},
|
|
1332
|
+
prices: {
|
|
1333
|
+
input_mtok: 3,
|
|
1334
|
+
cache_write_mtok: 3.75,
|
|
1335
|
+
cache_read_mtok: 0.3,
|
|
1336
|
+
output_mtok: 15
|
|
1337
|
+
}
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
id: "global.anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
1341
|
+
match: {
|
|
1342
|
+
starts_with: "global.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
1343
|
+
},
|
|
1344
|
+
prices: {
|
|
1345
|
+
input_mtok: 3,
|
|
1346
|
+
cache_write_mtok: 3.75,
|
|
1347
|
+
cache_read_mtok: 0.3,
|
|
1348
|
+
output_mtok: 15
|
|
1301
1349
|
}
|
|
1302
1350
|
},
|
|
1303
1351
|
{
|
|
@@ -1519,6 +1567,374 @@ const ie = [
|
|
|
1519
1567
|
input_mtok: 0.15,
|
|
1520
1568
|
output_mtok: 0.6
|
|
1521
1569
|
}
|
|
1570
|
+
},
|
|
1571
|
+
{
|
|
1572
|
+
id: "regional.anthropic.claude-3-5-haiku-20241022-v1:0",
|
|
1573
|
+
match: {
|
|
1574
|
+
or: [
|
|
1575
|
+
{
|
|
1576
|
+
starts_with: "us.anthropic.claude-3-5-haiku-20241022-v1"
|
|
1577
|
+
},
|
|
1578
|
+
{
|
|
1579
|
+
starts_with: "au.anthropic.claude-3-5-haiku-20241022-v1"
|
|
1580
|
+
},
|
|
1581
|
+
{
|
|
1582
|
+
starts_with: "apac.anthropic.claude-3-5-haiku-20241022-v1"
|
|
1583
|
+
},
|
|
1584
|
+
{
|
|
1585
|
+
starts_with: "eu.anthropic.claude-3-5-haiku-20241022-v1"
|
|
1586
|
+
},
|
|
1587
|
+
{
|
|
1588
|
+
starts_with: "us-gov.anthropic.claude-3-5-haiku-20241022-v1"
|
|
1589
|
+
},
|
|
1590
|
+
{
|
|
1591
|
+
starts_with: "jp.anthropic.claude-3-5-haiku-20241022-v1"
|
|
1592
|
+
}
|
|
1593
|
+
]
|
|
1594
|
+
},
|
|
1595
|
+
prices: {
|
|
1596
|
+
input_mtok: 0.8,
|
|
1597
|
+
cache_write_mtok: 1,
|
|
1598
|
+
cache_read_mtok: 0.08,
|
|
1599
|
+
output_mtok: 4
|
|
1600
|
+
}
|
|
1601
|
+
},
|
|
1602
|
+
{
|
|
1603
|
+
id: "regional.anthropic.claude-3-5-sonnet-20240620-v1:0",
|
|
1604
|
+
match: {
|
|
1605
|
+
or: [
|
|
1606
|
+
{
|
|
1607
|
+
starts_with: "us.anthropic.claude-3-5-sonnet-20240620-v1"
|
|
1608
|
+
},
|
|
1609
|
+
{
|
|
1610
|
+
starts_with: "au.anthropic.claude-3-5-sonnet-20240620-v1"
|
|
1611
|
+
},
|
|
1612
|
+
{
|
|
1613
|
+
starts_with: "apac.anthropic.claude-3-5-sonnet-20240620-v1"
|
|
1614
|
+
},
|
|
1615
|
+
{
|
|
1616
|
+
starts_with: "eu.anthropic.claude-3-5-sonnet-20240620-v1"
|
|
1617
|
+
},
|
|
1618
|
+
{
|
|
1619
|
+
starts_with: "us-gov.anthropic.claude-3-5-sonnet-20240620-v1"
|
|
1620
|
+
},
|
|
1621
|
+
{
|
|
1622
|
+
starts_with: "jp.anthropic.claude-3-5-sonnet-20240620-v1"
|
|
1623
|
+
}
|
|
1624
|
+
]
|
|
1625
|
+
},
|
|
1626
|
+
prices: {
|
|
1627
|
+
input_mtok: 3,
|
|
1628
|
+
cache_write_mtok: 3.75,
|
|
1629
|
+
cache_read_mtok: 0.3,
|
|
1630
|
+
output_mtok: 15
|
|
1631
|
+
}
|
|
1632
|
+
},
|
|
1633
|
+
{
|
|
1634
|
+
id: "regional.anthropic.claude-3-5-sonnet-20241022-v2:0",
|
|
1635
|
+
match: {
|
|
1636
|
+
or: [
|
|
1637
|
+
{
|
|
1638
|
+
starts_with: "us.anthropic.claude-3-5-sonnet-20241022-v2"
|
|
1639
|
+
},
|
|
1640
|
+
{
|
|
1641
|
+
starts_with: "au.anthropic.claude-3-5-sonnet-20241022-v2"
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
starts_with: "apac.anthropic.claude-3-5-sonnet-20241022-v2"
|
|
1645
|
+
},
|
|
1646
|
+
{
|
|
1647
|
+
starts_with: "eu.anthropic.claude-3-5-sonnet-20241022-v2"
|
|
1648
|
+
},
|
|
1649
|
+
{
|
|
1650
|
+
starts_with: "us-gov.anthropic.claude-3-5-sonnet-20241022-v2"
|
|
1651
|
+
},
|
|
1652
|
+
{
|
|
1653
|
+
starts_with: "jp.anthropic.claude-3-5-sonnet-20241022-v2"
|
|
1654
|
+
}
|
|
1655
|
+
]
|
|
1656
|
+
},
|
|
1657
|
+
prices: {
|
|
1658
|
+
input_mtok: 3,
|
|
1659
|
+
cache_write_mtok: 3.75,
|
|
1660
|
+
cache_read_mtok: 0.3,
|
|
1661
|
+
output_mtok: 15
|
|
1662
|
+
}
|
|
1663
|
+
},
|
|
1664
|
+
{
|
|
1665
|
+
id: "regional.anthropic.claude-3-7-sonnet-20250219-v1:0",
|
|
1666
|
+
match: {
|
|
1667
|
+
or: [
|
|
1668
|
+
{
|
|
1669
|
+
starts_with: "us.anthropic.claude-3-7-sonnet-20250219-v1"
|
|
1670
|
+
},
|
|
1671
|
+
{
|
|
1672
|
+
starts_with: "au.anthropic.claude-3-7-sonnet-20250219-v1"
|
|
1673
|
+
},
|
|
1674
|
+
{
|
|
1675
|
+
starts_with: "apac.anthropic.claude-3-7-sonnet-20250219-v1"
|
|
1676
|
+
},
|
|
1677
|
+
{
|
|
1678
|
+
starts_with: "eu.anthropic.claude-3-7-sonnet-20250219-v1"
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
starts_with: "us-gov.anthropic.claude-3-7-sonnet-20250219-v1"
|
|
1682
|
+
},
|
|
1683
|
+
{
|
|
1684
|
+
starts_with: "jp.anthropic.claude-3-7-sonnet-20250219-v1"
|
|
1685
|
+
}
|
|
1686
|
+
]
|
|
1687
|
+
},
|
|
1688
|
+
prices: {
|
|
1689
|
+
input_mtok: 3,
|
|
1690
|
+
cache_write_mtok: 3.75,
|
|
1691
|
+
cache_read_mtok: 0.3,
|
|
1692
|
+
output_mtok: 15
|
|
1693
|
+
}
|
|
1694
|
+
},
|
|
1695
|
+
{
|
|
1696
|
+
id: "regional.anthropic.claude-3-haiku-20240307-v1:0",
|
|
1697
|
+
match: {
|
|
1698
|
+
or: [
|
|
1699
|
+
{
|
|
1700
|
+
starts_with: "us.anthropic.claude-3-haiku-20240307-v1"
|
|
1701
|
+
},
|
|
1702
|
+
{
|
|
1703
|
+
starts_with: "au.anthropic.claude-3-haiku-20240307-v1"
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
starts_with: "apac.anthropic.claude-3-haiku-20240307-v1"
|
|
1707
|
+
},
|
|
1708
|
+
{
|
|
1709
|
+
starts_with: "eu.anthropic.claude-3-haiku-20240307-v1"
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
starts_with: "us-gov.anthropic.claude-3-haiku-20240307-v1"
|
|
1713
|
+
},
|
|
1714
|
+
{
|
|
1715
|
+
starts_with: "jp.anthropic.claude-3-haiku-20240307-v1"
|
|
1716
|
+
}
|
|
1717
|
+
]
|
|
1718
|
+
},
|
|
1719
|
+
prices: {
|
|
1720
|
+
input_mtok: 0.25,
|
|
1721
|
+
output_mtok: 1.25
|
|
1722
|
+
}
|
|
1723
|
+
},
|
|
1724
|
+
{
|
|
1725
|
+
id: "regional.anthropic.claude-3-opus-20240229-v1:0",
|
|
1726
|
+
match: {
|
|
1727
|
+
or: [
|
|
1728
|
+
{
|
|
1729
|
+
starts_with: "us.anthropic.claude-3-opus-20240229-v1"
|
|
1730
|
+
},
|
|
1731
|
+
{
|
|
1732
|
+
starts_with: "au.anthropic.claude-3-opus-20240229-v1"
|
|
1733
|
+
},
|
|
1734
|
+
{
|
|
1735
|
+
starts_with: "apac.anthropic.claude-3-opus-20240229-v1"
|
|
1736
|
+
},
|
|
1737
|
+
{
|
|
1738
|
+
starts_with: "eu.anthropic.claude-3-opus-20240229-v1"
|
|
1739
|
+
},
|
|
1740
|
+
{
|
|
1741
|
+
starts_with: "us-gov.anthropic.claude-3-opus-20240229-v1"
|
|
1742
|
+
},
|
|
1743
|
+
{
|
|
1744
|
+
starts_with: "jp.anthropic.claude-3-opus-20240229-v1"
|
|
1745
|
+
}
|
|
1746
|
+
]
|
|
1747
|
+
},
|
|
1748
|
+
prices: {
|
|
1749
|
+
input_mtok: 15,
|
|
1750
|
+
output_mtok: 75
|
|
1751
|
+
}
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
id: "regional.anthropic.claude-3-sonnet-20240229-v1:0",
|
|
1755
|
+
match: {
|
|
1756
|
+
or: [
|
|
1757
|
+
{
|
|
1758
|
+
starts_with: "us.anthropic.claude-3-sonnet-20240229-v1"
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
starts_with: "au.anthropic.claude-3-sonnet-20240229-v1"
|
|
1762
|
+
},
|
|
1763
|
+
{
|
|
1764
|
+
starts_with: "apac.anthropic.claude-3-sonnet-20240229-v1"
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
starts_with: "eu.anthropic.claude-3-sonnet-20240229-v1"
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
starts_with: "us-gov.anthropic.claude-3-sonnet-20240229-v1"
|
|
1771
|
+
},
|
|
1772
|
+
{
|
|
1773
|
+
starts_with: "jp.anthropic.claude-3-sonnet-20240229-v1"
|
|
1774
|
+
}
|
|
1775
|
+
]
|
|
1776
|
+
},
|
|
1777
|
+
prices: {
|
|
1778
|
+
input_mtok: 3,
|
|
1779
|
+
cache_write_mtok: 3.75,
|
|
1780
|
+
cache_read_mtok: 0.3,
|
|
1781
|
+
output_mtok: 15
|
|
1782
|
+
}
|
|
1783
|
+
},
|
|
1784
|
+
{
|
|
1785
|
+
id: "regional.anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
1786
|
+
match: {
|
|
1787
|
+
or: [
|
|
1788
|
+
{
|
|
1789
|
+
starts_with: "us.anthropic.claude-haiku-4-5-20251001-v1"
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
starts_with: "au.anthropic.claude-haiku-4-5-20251001-v1"
|
|
1793
|
+
},
|
|
1794
|
+
{
|
|
1795
|
+
starts_with: "apac.anthropic.claude-haiku-4-5-20251001-v1"
|
|
1796
|
+
},
|
|
1797
|
+
{
|
|
1798
|
+
starts_with: "eu.anthropic.claude-haiku-4-5-20251001-v1"
|
|
1799
|
+
},
|
|
1800
|
+
{
|
|
1801
|
+
starts_with: "us-gov.anthropic.claude-haiku-4-5-20251001-v1"
|
|
1802
|
+
},
|
|
1803
|
+
{
|
|
1804
|
+
starts_with: "jp.anthropic.claude-haiku-4-5-20251001-v1"
|
|
1805
|
+
}
|
|
1806
|
+
]
|
|
1807
|
+
},
|
|
1808
|
+
prices: {
|
|
1809
|
+
input_mtok: 1.1,
|
|
1810
|
+
cache_write_mtok: 1.375,
|
|
1811
|
+
cache_read_mtok: 0.11,
|
|
1812
|
+
output_mtok: 5.5
|
|
1813
|
+
}
|
|
1814
|
+
},
|
|
1815
|
+
{
|
|
1816
|
+
id: "regional.anthropic.claude-opus-4-1-20250805-v1:0",
|
|
1817
|
+
match: {
|
|
1818
|
+
or: [
|
|
1819
|
+
{
|
|
1820
|
+
starts_with: "us.anthropic.claude-opus-4-1-20250805-v1"
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
starts_with: "au.anthropic.claude-opus-4-1-20250805-v1"
|
|
1824
|
+
},
|
|
1825
|
+
{
|
|
1826
|
+
starts_with: "apac.anthropic.claude-opus-4-1-20250805-v1"
|
|
1827
|
+
},
|
|
1828
|
+
{
|
|
1829
|
+
starts_with: "eu.anthropic.claude-opus-4-1-20250805-v1"
|
|
1830
|
+
},
|
|
1831
|
+
{
|
|
1832
|
+
starts_with: "us-gov.anthropic.claude-opus-4-1-20250805-v1"
|
|
1833
|
+
},
|
|
1834
|
+
{
|
|
1835
|
+
starts_with: "jp.anthropic.claude-opus-4-1-20250805-v1"
|
|
1836
|
+
}
|
|
1837
|
+
]
|
|
1838
|
+
},
|
|
1839
|
+
prices: {
|
|
1840
|
+
input_mtok: 15,
|
|
1841
|
+
cache_write_mtok: 18.75,
|
|
1842
|
+
cache_read_mtok: 1.5,
|
|
1843
|
+
output_mtok: 75
|
|
1844
|
+
}
|
|
1845
|
+
},
|
|
1846
|
+
{
|
|
1847
|
+
id: "regional.anthropic.claude-opus-4-20250514-v1:0",
|
|
1848
|
+
match: {
|
|
1849
|
+
or: [
|
|
1850
|
+
{
|
|
1851
|
+
starts_with: "us.anthropic.claude-opus-4-20250514-v1"
|
|
1852
|
+
},
|
|
1853
|
+
{
|
|
1854
|
+
starts_with: "au.anthropic.claude-opus-4-20250514-v1"
|
|
1855
|
+
},
|
|
1856
|
+
{
|
|
1857
|
+
starts_with: "apac.anthropic.claude-opus-4-20250514-v1"
|
|
1858
|
+
},
|
|
1859
|
+
{
|
|
1860
|
+
starts_with: "eu.anthropic.claude-opus-4-20250514-v1"
|
|
1861
|
+
},
|
|
1862
|
+
{
|
|
1863
|
+
starts_with: "us-gov.anthropic.claude-opus-4-20250514-v1"
|
|
1864
|
+
},
|
|
1865
|
+
{
|
|
1866
|
+
starts_with: "jp.anthropic.claude-opus-4-20250514-v1"
|
|
1867
|
+
}
|
|
1868
|
+
]
|
|
1869
|
+
},
|
|
1870
|
+
prices: {
|
|
1871
|
+
input_mtok: 15,
|
|
1872
|
+
cache_write_mtok: 18.75,
|
|
1873
|
+
cache_read_mtok: 1.5,
|
|
1874
|
+
output_mtok: 75
|
|
1875
|
+
}
|
|
1876
|
+
},
|
|
1877
|
+
{
|
|
1878
|
+
id: "regional.anthropic.claude-sonnet-4-20250514-v1:0",
|
|
1879
|
+
match: {
|
|
1880
|
+
or: [
|
|
1881
|
+
{
|
|
1882
|
+
starts_with: "us.anthropic.claude-sonnet-4-20250514-v1"
|
|
1883
|
+
},
|
|
1884
|
+
{
|
|
1885
|
+
starts_with: "au.anthropic.claude-sonnet-4-20250514-v1"
|
|
1886
|
+
},
|
|
1887
|
+
{
|
|
1888
|
+
starts_with: "apac.anthropic.claude-sonnet-4-20250514-v1"
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
starts_with: "eu.anthropic.claude-sonnet-4-20250514-v1"
|
|
1892
|
+
},
|
|
1893
|
+
{
|
|
1894
|
+
starts_with: "us-gov.anthropic.claude-sonnet-4-20250514-v1"
|
|
1895
|
+
},
|
|
1896
|
+
{
|
|
1897
|
+
starts_with: "jp.anthropic.claude-sonnet-4-20250514-v1"
|
|
1898
|
+
}
|
|
1899
|
+
]
|
|
1900
|
+
},
|
|
1901
|
+
prices: {
|
|
1902
|
+
input_mtok: 3,
|
|
1903
|
+
cache_write_mtok: 3.75,
|
|
1904
|
+
cache_read_mtok: 0.3,
|
|
1905
|
+
output_mtok: 15
|
|
1906
|
+
}
|
|
1907
|
+
},
|
|
1908
|
+
{
|
|
1909
|
+
id: "regional.anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
1910
|
+
match: {
|
|
1911
|
+
or: [
|
|
1912
|
+
{
|
|
1913
|
+
starts_with: "us.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
1914
|
+
},
|
|
1915
|
+
{
|
|
1916
|
+
starts_with: "au.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
starts_with: "apac.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
1920
|
+
},
|
|
1921
|
+
{
|
|
1922
|
+
starts_with: "eu.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
1923
|
+
},
|
|
1924
|
+
{
|
|
1925
|
+
starts_with: "us-gov.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
1926
|
+
},
|
|
1927
|
+
{
|
|
1928
|
+
starts_with: "jp.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
1929
|
+
}
|
|
1930
|
+
]
|
|
1931
|
+
},
|
|
1932
|
+
prices: {
|
|
1933
|
+
input_mtok: 3.3,
|
|
1934
|
+
cache_write_mtok: 4.125,
|
|
1935
|
+
cache_read_mtok: 0.33,
|
|
1936
|
+
output_mtok: 16.5
|
|
1937
|
+
}
|
|
1522
1938
|
}
|
|
1523
1939
|
]
|
|
1524
1940
|
},
|
|
@@ -1528,6 +1944,111 @@ const ie = [
|
|
|
1528
1944
|
pricing_urls: ["https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/#pricing"],
|
|
1529
1945
|
api_pattern: "(https?://)?([^.]*\\.)?(?:openai\\.azure\\.com|azure-api\\.net|cognitiveservices\\.azure\\.com)",
|
|
1530
1946
|
price_comments: 'These are prices for "*-Global" models, prices for "Regional" models are often slightly higher. Retired models are listed at https://learn.microsoft.com/th-th/azure/ai-foundry/openai/concepts/legacy-models',
|
|
1947
|
+
extractors: [
|
|
1948
|
+
{
|
|
1949
|
+
api_flavor: "chat",
|
|
1950
|
+
root: "usage",
|
|
1951
|
+
model_path: "model",
|
|
1952
|
+
mappings: [
|
|
1953
|
+
{
|
|
1954
|
+
path: "prompt_tokens",
|
|
1955
|
+
dest: "input_tokens",
|
|
1956
|
+
required: !0
|
|
1957
|
+
},
|
|
1958
|
+
{
|
|
1959
|
+
path: ["prompt_tokens_details", "cached_tokens"],
|
|
1960
|
+
dest: "cache_read_tokens",
|
|
1961
|
+
required: !1
|
|
1962
|
+
},
|
|
1963
|
+
{
|
|
1964
|
+
path: ["prompt_tokens_details", "audio_tokens"],
|
|
1965
|
+
dest: "input_audio_tokens",
|
|
1966
|
+
required: !1
|
|
1967
|
+
},
|
|
1968
|
+
{
|
|
1969
|
+
path: ["completion_tokens_details", "audio_tokens"],
|
|
1970
|
+
dest: "output_audio_tokens",
|
|
1971
|
+
required: !1
|
|
1972
|
+
},
|
|
1973
|
+
{
|
|
1974
|
+
path: "completion_tokens",
|
|
1975
|
+
dest: "output_tokens",
|
|
1976
|
+
required: !0
|
|
1977
|
+
}
|
|
1978
|
+
]
|
|
1979
|
+
},
|
|
1980
|
+
{
|
|
1981
|
+
api_flavor: "responses",
|
|
1982
|
+
root: "usage",
|
|
1983
|
+
model_path: "model",
|
|
1984
|
+
mappings: [
|
|
1985
|
+
{
|
|
1986
|
+
path: "input_tokens",
|
|
1987
|
+
dest: "input_tokens",
|
|
1988
|
+
required: !0
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
path: ["input_tokens_details", "cached_tokens"],
|
|
1992
|
+
dest: "cache_read_tokens",
|
|
1993
|
+
required: !1
|
|
1994
|
+
},
|
|
1995
|
+
{
|
|
1996
|
+
path: "output_tokens",
|
|
1997
|
+
dest: "output_tokens",
|
|
1998
|
+
required: !0
|
|
1999
|
+
}
|
|
2000
|
+
]
|
|
2001
|
+
},
|
|
2002
|
+
{
|
|
2003
|
+
api_flavor: "embeddings",
|
|
2004
|
+
root: "usage",
|
|
2005
|
+
model_path: "model",
|
|
2006
|
+
mappings: [
|
|
2007
|
+
{
|
|
2008
|
+
path: "prompt_tokens",
|
|
2009
|
+
dest: "input_tokens",
|
|
2010
|
+
required: !0
|
|
2011
|
+
}
|
|
2012
|
+
]
|
|
2013
|
+
},
|
|
2014
|
+
{
|
|
2015
|
+
api_flavor: "anthropic",
|
|
2016
|
+
root: "usage",
|
|
2017
|
+
model_path: "model",
|
|
2018
|
+
mappings: [
|
|
2019
|
+
{
|
|
2020
|
+
path: "input_tokens",
|
|
2021
|
+
dest: "input_tokens",
|
|
2022
|
+
required: !0
|
|
2023
|
+
},
|
|
2024
|
+
{
|
|
2025
|
+
path: "cache_creation_input_tokens",
|
|
2026
|
+
dest: "input_tokens",
|
|
2027
|
+
required: !1
|
|
2028
|
+
},
|
|
2029
|
+
{
|
|
2030
|
+
path: "cache_read_input_tokens",
|
|
2031
|
+
dest: "input_tokens",
|
|
2032
|
+
required: !1
|
|
2033
|
+
},
|
|
2034
|
+
{
|
|
2035
|
+
path: "cache_creation_input_tokens",
|
|
2036
|
+
dest: "cache_write_tokens",
|
|
2037
|
+
required: !1
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
path: "cache_read_input_tokens",
|
|
2041
|
+
dest: "cache_read_tokens",
|
|
2042
|
+
required: !1
|
|
2043
|
+
},
|
|
2044
|
+
{
|
|
2045
|
+
path: "output_tokens",
|
|
2046
|
+
dest: "output_tokens",
|
|
2047
|
+
required: !0
|
|
2048
|
+
}
|
|
2049
|
+
]
|
|
2050
|
+
}
|
|
2051
|
+
],
|
|
1531
2052
|
models: [
|
|
1532
2053
|
{
|
|
1533
2054
|
id: "ada",
|
|
@@ -12919,22 +13440,22 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
12919
13440
|
]
|
|
12920
13441
|
}
|
|
12921
13442
|
];
|
|
12922
|
-
function
|
|
12923
|
-
if (
|
|
13443
|
+
function Wt(i, s) {
|
|
13444
|
+
if (s <= 0) return 0;
|
|
12924
13445
|
let m = 0;
|
|
12925
|
-
const
|
|
13446
|
+
const n = [...i.tiers].sort((_, h) => _.start - h.start), u = n[0]?.start ?? s, k = Math.min(s, u);
|
|
12926
13447
|
m += k * i.base / 1e6;
|
|
12927
|
-
for (let _ = 0; _ <
|
|
12928
|
-
const h =
|
|
13448
|
+
for (let _ = 0; _ < n.length; _++) {
|
|
13449
|
+
const h = n[_], f = n[_ + 1]?.start ?? 1 / 0, y = Math.max(0, Math.min(s, f) - h.start);
|
|
12929
13450
|
y > 0 && (m += y * h.price / 1e6);
|
|
12930
13451
|
}
|
|
12931
13452
|
return m;
|
|
12932
13453
|
}
|
|
12933
|
-
function O(i,
|
|
12934
|
-
return i === void 0 ||
|
|
13454
|
+
function O(i, s, m) {
|
|
13455
|
+
return i === void 0 || s === void 0 ? 0 : typeof i == "number" ? i * s / 1e6 : Wt(i, s);
|
|
12935
13456
|
}
|
|
12936
|
-
function
|
|
12937
|
-
let m = 0,
|
|
13457
|
+
function Ut(i, s) {
|
|
13458
|
+
let m = 0, n = 0;
|
|
12938
13459
|
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;
|
|
12939
13460
|
let f = i.input_audio_tokens ?? 0;
|
|
12940
13461
|
if (f -= _, f < 0)
|
|
@@ -12945,65 +13466,65 @@ function Ue(i, n) {
|
|
|
12945
13466
|
let P = u;
|
|
12946
13467
|
if (P -= _, P < 0)
|
|
12947
13468
|
throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
|
|
12948
|
-
m += O(
|
|
13469
|
+
m += O(s.input_mtok, y), m += O(s.cache_read_mtok, P), m += O(s.cache_write_mtok, k), m += O(s.input_audio_mtok, f), m += O(s.cache_audio_read_mtok, _);
|
|
12949
13470
|
let S = i.output_tokens ?? 0;
|
|
12950
13471
|
if (S -= h, S < 0)
|
|
12951
13472
|
throw new Error("output_audio_tokens cannot be greater than output_tokens");
|
|
12952
|
-
|
|
12953
|
-
let G = m +
|
|
12954
|
-
return
|
|
13473
|
+
n += O(s.output_mtok, S), n += O(s.output_audio_mtok, i.output_audio_tokens);
|
|
13474
|
+
let G = m + n;
|
|
13475
|
+
return s.requests_kcount !== void 0 && (G += s.requests_kcount / 1e3), {
|
|
12955
13476
|
input_price: m,
|
|
12956
|
-
output_price:
|
|
13477
|
+
output_price: n,
|
|
12957
13478
|
total_price: G
|
|
12958
13479
|
};
|
|
12959
13480
|
}
|
|
12960
|
-
function
|
|
13481
|
+
function Kt(i, s) {
|
|
12961
13482
|
if (!Array.isArray(i.prices))
|
|
12962
13483
|
return i.prices;
|
|
12963
13484
|
for (let m = i.prices.length - 1; m >= 0; m--) {
|
|
12964
|
-
const
|
|
13485
|
+
const n = i.prices[m], u = n.constraint;
|
|
12965
13486
|
if (u === void 0)
|
|
12966
|
-
return
|
|
13487
|
+
return n.prices;
|
|
12967
13488
|
if (u.type === "start_date") {
|
|
12968
|
-
if (
|
|
12969
|
-
return
|
|
13489
|
+
if (s >= new Date(u.start_date))
|
|
13490
|
+
return n.prices;
|
|
12970
13491
|
} else {
|
|
12971
|
-
const k =
|
|
13492
|
+
const k = s.toISOString().slice(11, 19), _ = u.start_time, h = u.end_time;
|
|
12972
13493
|
if (h < _) {
|
|
12973
13494
|
if (k >= _ || k < h)
|
|
12974
|
-
return
|
|
13495
|
+
return n.prices;
|
|
12975
13496
|
} else if (k >= _ && k < h)
|
|
12976
|
-
return
|
|
13497
|
+
return n.prices;
|
|
12977
13498
|
}
|
|
12978
13499
|
}
|
|
12979
13500
|
return i.prices[0].prices;
|
|
12980
13501
|
}
|
|
12981
|
-
function j(i,
|
|
12982
|
-
return "or" in i ? i.or.some((m) => j(m,
|
|
13502
|
+
function j(i, s) {
|
|
13503
|
+
return "or" in i ? i.or.some((m) => j(m, s)) : "and" in i ? i.and.every((m) => j(m, s)) : "equals" in i ? s === i.equals : "starts_with" in i ? s.startsWith(i.starts_with) : "ends_with" in i ? s.endsWith(i.ends_with) : "contains" in i ? s.includes(i.contains) : "regex" in i ? new RegExp(i.regex).test(s) : !1;
|
|
12983
13504
|
}
|
|
12984
|
-
function
|
|
12985
|
-
const m =
|
|
12986
|
-
return
|
|
13505
|
+
function Yt(i, s) {
|
|
13506
|
+
const m = s.toLowerCase().trim(), n = i.find((u) => u.id === m);
|
|
13507
|
+
return n || i.find((u) => u.provider_match && j(u.provider_match, m));
|
|
12987
13508
|
}
|
|
12988
|
-
function
|
|
12989
|
-
if (
|
|
12990
|
-
return
|
|
13509
|
+
function Jt(i, { modelId: s, providerApiUrl: m, providerId: n }) {
|
|
13510
|
+
if (n)
|
|
13511
|
+
return Yt(i, n);
|
|
12991
13512
|
if (m)
|
|
12992
13513
|
return i.find((u) => new RegExp(u.api_pattern).test(m));
|
|
12993
|
-
if (
|
|
12994
|
-
return i.find((u) => u.model_match && j(u.model_match,
|
|
13514
|
+
if (s)
|
|
13515
|
+
return i.find((u) => u.model_match && j(u.model_match, s));
|
|
12995
13516
|
}
|
|
12996
|
-
function
|
|
12997
|
-
return i.find((m) => j(m.match,
|
|
13517
|
+
function Zt(i, s) {
|
|
13518
|
+
return i.find((m) => j(m.match, s));
|
|
12998
13519
|
}
|
|
12999
|
-
let
|
|
13000
|
-
Promise.resolve(
|
|
13001
|
-
function
|
|
13002
|
-
const
|
|
13520
|
+
let Xt = it;
|
|
13521
|
+
Promise.resolve(it);
|
|
13522
|
+
function te(i, s, m) {
|
|
13523
|
+
const n = s.toLowerCase().trim(), u = m?.provider ?? Jt(Xt, { modelId: n, providerApiUrl: m?.providerApiUrl, providerId: m?.providerId });
|
|
13003
13524
|
if (!u) return null;
|
|
13004
|
-
const k =
|
|
13525
|
+
const k = Zt(u.models, n);
|
|
13005
13526
|
if (!k) return null;
|
|
13006
|
-
const _ = m?.timestamp ?? /* @__PURE__ */ new Date(), h =
|
|
13527
|
+
const _ = m?.timestamp ?? /* @__PURE__ */ new Date(), h = Kt(k, _), f = Ut(i, h);
|
|
13007
13528
|
return {
|
|
13008
13529
|
auto_update_timestamp: void 0,
|
|
13009
13530
|
model: k,
|
|
@@ -13012,7 +13533,7 @@ function et(i, n, m) {
|
|
|
13012
13533
|
...f
|
|
13013
13534
|
};
|
|
13014
13535
|
}
|
|
13015
|
-
const b =
|
|
13536
|
+
const b = dt(Ct(process.argv)).scriptName("genai-prices").command(
|
|
13016
13537
|
"list [provider]",
|
|
13017
13538
|
"List providers and models",
|
|
13018
13539
|
(i) => i.positional("provider", { describe: "Provider ID to filter", type: "string" })
|
|
@@ -13021,24 +13542,24 @@ const b = de(Ce(process.argv)).scriptName("genai-prices").command(
|
|
|
13021
13542
|
"Calculate price",
|
|
13022
13543
|
(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" })
|
|
13023
13544
|
).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();
|
|
13024
|
-
function
|
|
13545
|
+
function ee() {
|
|
13025
13546
|
if (b._[0] === "list") {
|
|
13026
|
-
const m =
|
|
13547
|
+
const m = it;
|
|
13027
13548
|
if (b.provider) {
|
|
13028
|
-
const
|
|
13029
|
-
|
|
13030
|
-
for (const u of
|
|
13031
|
-
console.log(` ${
|
|
13549
|
+
const n = m.find((u) => u.id === b.provider);
|
|
13550
|
+
n || (console.error(`Provider ${b.provider} not found.`), process.exit(1)), console.log(`${n.name}: (${n.models.length} models)`);
|
|
13551
|
+
for (const u of n.models)
|
|
13552
|
+
console.log(` ${n.id}:${u.id}${u.name ? ": " + u.name : ""}`);
|
|
13032
13553
|
} else
|
|
13033
|
-
for (const
|
|
13034
|
-
console.log(`${
|
|
13035
|
-
for (const u of
|
|
13036
|
-
console.log(` ${
|
|
13554
|
+
for (const n of m) {
|
|
13555
|
+
console.log(`${n.name}: (${n.models.length} models)`);
|
|
13556
|
+
for (const u of n.models)
|
|
13557
|
+
console.log(` ${n.id}:${u.id}${u.name ? ": " + u.name : ""}`);
|
|
13037
13558
|
}
|
|
13038
13559
|
process.exit(0);
|
|
13039
13560
|
}
|
|
13040
|
-
const
|
|
13041
|
-
if (
|
|
13561
|
+
const s = b._[0] === "calc" ? Array.isArray(b.model) ? b.model : [b.model] : b._.filter((m) => typeof m == "string");
|
|
13562
|
+
if (s.length > 0) {
|
|
13042
13563
|
const m = {
|
|
13043
13564
|
cache_audio_read_tokens: b["cache-audio-read-tokens"] !== void 0 ? Number(b["cache-audio-read-tokens"]) : void 0,
|
|
13044
13565
|
cache_read_tokens: b["cache-read-tokens"] !== void 0 ? Number(b["cache-read-tokens"]) : void 0,
|
|
@@ -13048,13 +13569,13 @@ function tt() {
|
|
|
13048
13569
|
output_audio_tokens: b["output-audio-tokens"] !== void 0 ? Number(b["output-audio-tokens"]) : void 0,
|
|
13049
13570
|
output_tokens: b["output-tokens"] !== void 0 ? Number(b["output-tokens"]) : void 0,
|
|
13050
13571
|
requests: b.requests !== void 0 ? Number(b.requests) : void 0
|
|
13051
|
-
},
|
|
13572
|
+
}, n = b.timestamp ? new Date(String(b.timestamp)) : void 0;
|
|
13052
13573
|
let u = !1;
|
|
13053
|
-
for (const k of
|
|
13574
|
+
for (const k of s) {
|
|
13054
13575
|
let _, h = k;
|
|
13055
13576
|
h.includes(":") && ([_, h] = h.split(":", 2));
|
|
13056
13577
|
try {
|
|
13057
|
-
const f =
|
|
13578
|
+
const f = te(m, h, { providerId: _, timestamp: n });
|
|
13058
13579
|
if (!f) {
|
|
13059
13580
|
u = !0, console.error(`No price found for model ${k}`);
|
|
13060
13581
|
continue;
|
|
@@ -13077,6 +13598,6 @@ function tt() {
|
|
|
13077
13598
|
}
|
|
13078
13599
|
process.exit(u ? 1 : 0);
|
|
13079
13600
|
}
|
|
13080
|
-
|
|
13601
|
+
dt().showHelp(), process.exit(1);
|
|
13081
13602
|
}
|
|
13082
|
-
|
|
13603
|
+
ee();
|