@musistudio/claude-code-router 1.0.67 → 1.0.68

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
@@ -67756,7 +67756,7 @@ var require_package3 = __commonJS({
67756
67756
  "package.json"(exports2, module2) {
67757
67757
  module2.exports = {
67758
67758
  name: "@musistudio/claude-code-router",
67759
- version: "1.0.67",
67759
+ version: "1.0.68",
67760
67760
  description: "Use Claude Code without an Anthropics account and route it to another LLM provider",
67761
67761
  bin: {
67762
67762
  ccr: "dist/cli.js"
@@ -67776,7 +67776,7 @@ var require_package3 = __commonJS({
67776
67776
  license: "MIT",
67777
67777
  dependencies: {
67778
67778
  "@fastify/static": "^8.2.0",
67779
- "@musistudio/llms": "^1.0.41",
67779
+ "@musistudio/llms": "^1.0.42",
67780
67780
  "@inquirer/prompts": "^5.0.0",
67781
67781
  dotenv: "^16.4.7",
67782
67782
  "find-process": "^2.0.0",
@@ -70931,7 +70931,7 @@ var import_os2 = require("os");
70931
70931
  var import_path5 = require("path");
70932
70932
  init_utils();
70933
70933
 
70934
- // node_modules/.pnpm/@musistudio+llms@1.0.41_ws@8.18.3/node_modules/@musistudio/llms/dist/esm/server.mjs
70934
+ // node_modules/.pnpm/@musistudio+llms@1.0.42_ws@8.18.3/node_modules/@musistudio/llms/dist/esm/server.mjs
70935
70935
  var import_node_fs = require("node:fs");
70936
70936
  var import_node_path4 = require("node:path");
70937
70937
  var import_node_stream = __toESM(require("node:stream"), 1);
@@ -71568,8 +71568,8 @@ var Nf = z((dA, If) => {
71568
71568
  var jf = z((hA, qf) => {
71569
71569
  var Wa = La();
71570
71570
  qf.exports = function(e, t, n) {
71571
- let o = [], i = "", u, l, d = "", f;
71572
- if (t != null && typeof t == "object" && !Array.isArray(t) && (n = t.space, f = t.quote, t = t.replacer), typeof t == "function") l = t;
71571
+ let o = [], i = "", u, l, f = "", d;
71572
+ if (t != null && typeof t == "object" && !Array.isArray(t) && (n = t.space, d = t.quote, t = t.replacer), typeof t == "function") l = t;
71573
71573
  else if (Array.isArray(t)) {
71574
71574
  u = [];
71575
71575
  for (let w of t) {
@@ -71577,10 +71577,10 @@ var jf = z((hA, qf) => {
71577
71577
  typeof w == "string" ? p = w : (typeof w == "number" || w instanceof String || w instanceof Number) && (p = String(w)), p !== void 0 && u.indexOf(p) < 0 && u.push(p);
71578
71578
  }
71579
71579
  }
71580
- return n instanceof Number ? n = Number(n) : n instanceof String && (n = String(n)), typeof n == "number" ? n > 0 && (n = Math.min(10, Math.floor(n)), d = " ".substr(0, n)) : typeof n == "string" && (d = n.substr(0, 10)), h("", { "": e });
71580
+ return n instanceof Number ? n = Number(n) : n instanceof String && (n = String(n)), typeof n == "number" ? n > 0 && (n = Math.min(10, Math.floor(n)), f = " ".substr(0, n)) : typeof n == "string" && (f = n.substr(0, 10)), h("", { "": e });
71581
71581
  function h(w, p) {
71582
- let g = p[w];
71583
- switch (g != null && (typeof g.toJSON5 == "function" ? g = g.toJSON5(w) : typeof g.toJSON == "function" && (g = g.toJSON(w))), l && (g = l.call(p, w, g)), g instanceof Number ? g = Number(g) : g instanceof String ? g = String(g) : g instanceof Boolean && (g = g.valueOf()), g) {
71582
+ let y = p[w];
71583
+ switch (y != null && (typeof y.toJSON5 == "function" ? y = y.toJSON5(w) : typeof y.toJSON == "function" && (y = y.toJSON(w))), l && (y = l.call(p, w, y)), y instanceof Number ? y = Number(y) : y instanceof String ? y = String(y) : y instanceof Boolean && (y = y.valueOf()), y) {
71584
71584
  case null:
71585
71585
  return "null";
71586
71586
  case true:
@@ -71588,12 +71588,12 @@ var jf = z((hA, qf) => {
71588
71588
  case false:
71589
71589
  return "false";
71590
71590
  }
71591
- if (typeof g == "string") return _(g, false);
71592
- if (typeof g == "number") return String(g);
71593
- if (typeof g == "object") return Array.isArray(g) ? b(g) : A(g);
71591
+ if (typeof y == "string") return g(y, false);
71592
+ if (typeof y == "number") return String(y);
71593
+ if (typeof y == "object") return Array.isArray(y) ? b(y) : A(y);
71594
71594
  }
71595
- function _(w) {
71596
- let p = { "'": 0.1, '"': 0.2 }, g = { "'": "\\'", '"': '\\"', "\\": "\\\\", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", " ": "\\t", "\v": "\\v", "\0": "\\0", "\u2028": "\\u2028", "\u2029": "\\u2029" }, T = "";
71595
+ function g(w) {
71596
+ let p = { "'": 0.1, '"': 0.2 }, y = { "'": "\\'", '"': '\\"', "\\": "\\\\", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", " ": "\\t", "\v": "\\v", "\0": "\\0", "\u2028": "\\u2028", "\u2029": "\\u2029" }, T = "";
71597
71597
  for (let S = 0; S < w.length; S++) {
71598
71598
  let F = w[S];
71599
71599
  switch (F) {
@@ -71607,8 +71607,8 @@ var jf = z((hA, qf) => {
71607
71607
  continue;
71608
71608
  }
71609
71609
  }
71610
- if (g[F]) {
71611
- T += g[F];
71610
+ if (y[F]) {
71611
+ T += y[F];
71612
71612
  continue;
71613
71613
  }
71614
71614
  if (F < " ") {
@@ -71618,27 +71618,27 @@ var jf = z((hA, qf) => {
71618
71618
  }
71619
71619
  T += F;
71620
71620
  }
71621
- let E = f || Object.keys(p).reduce((S, F) => p[S] < p[F] ? S : F);
71622
- return T = T.replace(new RegExp(E, "g"), g[E]), E + T + E;
71621
+ let E = d || Object.keys(p).reduce((S, F) => p[S] < p[F] ? S : F);
71622
+ return T = T.replace(new RegExp(E, "g"), y[E]), E + T + E;
71623
71623
  }
71624
71624
  function A(w) {
71625
71625
  if (o.indexOf(w) >= 0) throw TypeError("Converting circular structure to JSON5");
71626
71626
  o.push(w);
71627
71627
  let p = i;
71628
- i = i + d;
71629
- let g = u || Object.keys(w), T = [];
71630
- for (let S of g) {
71628
+ i = i + f;
71629
+ let y = u || Object.keys(w), T = [];
71630
+ for (let S of y) {
71631
71631
  let F = h(S, w);
71632
71632
  if (F !== void 0) {
71633
71633
  let B = P(S) + ":";
71634
- d !== "" && (B += " "), B += F, T.push(B);
71634
+ f !== "" && (B += " "), B += F, T.push(B);
71635
71635
  }
71636
71636
  }
71637
71637
  let E;
71638
71638
  if (T.length === 0) E = "{}";
71639
71639
  else {
71640
71640
  let S;
71641
- if (d === "") S = T.join(","), E = "{" + S + "}";
71641
+ if (f === "") S = T.join(","), E = "{" + S + "}";
71642
71642
  else {
71643
71643
  let F = `,
71644
71644
  ` + i;
@@ -71650,28 +71650,28 @@ var jf = z((hA, qf) => {
71650
71650
  return o.pop(), i = p, E;
71651
71651
  }
71652
71652
  function P(w) {
71653
- if (w.length === 0) return _(w, true);
71653
+ if (w.length === 0) return g(w, true);
71654
71654
  let p = String.fromCodePoint(w.codePointAt(0));
71655
- if (!Wa.isIdStartChar(p)) return _(w, true);
71656
- for (let g = p.length; g < w.length; g++) if (!Wa.isIdContinueChar(String.fromCodePoint(w.codePointAt(g)))) return _(w, true);
71655
+ if (!Wa.isIdStartChar(p)) return g(w, true);
71656
+ for (let y = p.length; y < w.length; y++) if (!Wa.isIdContinueChar(String.fromCodePoint(w.codePointAt(y)))) return g(w, true);
71657
71657
  return w;
71658
71658
  }
71659
71659
  function b(w) {
71660
71660
  if (o.indexOf(w) >= 0) throw TypeError("Converting circular structure to JSON5");
71661
71661
  o.push(w);
71662
71662
  let p = i;
71663
- i = i + d;
71664
- let g = [];
71663
+ i = i + f;
71664
+ let y = [];
71665
71665
  for (let E = 0; E < w.length; E++) {
71666
71666
  let S = h(String(E), w);
71667
- g.push(S !== void 0 ? S : "null");
71667
+ y.push(S !== void 0 ? S : "null");
71668
71668
  }
71669
71669
  let T;
71670
- if (g.length === 0) T = "[]";
71671
- else if (d === "") T = "[" + g.join(",") + "]";
71670
+ if (y.length === 0) T = "[]";
71671
+ else if (f === "") T = "[" + y.join(",") + "]";
71672
71672
  else {
71673
71673
  let E = `,
71674
- ` + i, S = g.join(E);
71674
+ ` + i, S = y.join(E);
71675
71675
  T = `[
71676
71676
  ` + i + S + `,
71677
71677
  ` + p + "]";
@@ -71704,8 +71704,8 @@ var Ka = z((YA, nd) => {
71704
71704
  return e[t];
71705
71705
  };
71706
71706
  nd.exports = function r() {
71707
- var e, t, n, o, i, u, l = arguments[0], d = 1, f = arguments.length, h = false;
71708
- for (typeof l == "boolean" && (h = l, l = arguments[1] || {}, d = 2), (l == null || typeof l != "object" && typeof l != "function") && (l = {}); d < f; ++d) if (e = arguments[d], e != null) for (t in e) n = td(l, t), o = td(e, t), l !== o && (h && o && (Zf(o) || (i = Qf(o))) ? (i ? (i = false, u = n && Qf(n) ? n : []) : u = n && Zf(n) ? n : {}, ed(l, { name: t, newValue: r(h, u, o) })) : typeof o < "u" && ed(l, { name: t, newValue: o }));
71707
+ var e, t, n, o, i, u, l = arguments[0], f = 1, d = arguments.length, h = false;
71708
+ for (typeof l == "boolean" && (h = l, l = arguments[1] || {}, f = 2), (l == null || typeof l != "object" && typeof l != "function") && (l = {}); f < d; ++f) if (e = arguments[f], e != null) for (t in e) n = td(l, t), o = td(e, t), l !== o && (h && o && (Zf(o) || (i = Qf(o))) ? (i ? (i = false, u = n && Qf(n) ? n : []) : u = n && Zf(n) ? n : {}, ed(l, { name: t, newValue: r(h, u, o) })) : typeof o < "u" && ed(l, { name: t, newValue: o }));
71709
71709
  return l;
71710
71710
  };
71711
71711
  });
@@ -71925,21 +71925,21 @@ var hd = z((rD, dd) => {
71925
71925
  });
71926
71926
  var ru = z((nD, pd) => {
71927
71927
  function I0(r) {
71928
- t.debug = t, t.default = t, t.coerce = d, t.disable = u, t.enable = o, t.enabled = l, t.humanize = hd(), t.destroy = f, Object.keys(r).forEach((h) => {
71928
+ t.debug = t, t.default = t, t.coerce = f, t.disable = u, t.enable = o, t.enabled = l, t.humanize = hd(), t.destroy = d, Object.keys(r).forEach((h) => {
71929
71929
  t[h] = r[h];
71930
71930
  }), t.names = [], t.skips = [], t.formatters = {};
71931
71931
  function e(h) {
71932
- let _ = 0;
71933
- for (let A = 0; A < h.length; A++) _ = (_ << 5) - _ + h.charCodeAt(A), _ |= 0;
71934
- return t.colors[Math.abs(_) % t.colors.length];
71932
+ let g = 0;
71933
+ for (let A = 0; A < h.length; A++) g = (g << 5) - g + h.charCodeAt(A), g |= 0;
71934
+ return t.colors[Math.abs(g) % t.colors.length];
71935
71935
  }
71936
71936
  t.selectColor = e;
71937
71937
  function t(h) {
71938
- let _, A = null, P, b;
71938
+ let g, A = null, P, b;
71939
71939
  function w(...p) {
71940
71940
  if (!w.enabled) return;
71941
- let g = w, T = Number(/* @__PURE__ */ new Date()), E = T - (_ || T);
71942
- g.diff = E, g.prev = _, g.curr = T, _ = T, p[0] = t.coerce(p[0]), typeof p[0] != "string" && p.unshift("%O");
71941
+ let y = w, T = Number(/* @__PURE__ */ new Date()), E = T - (g || T);
71942
+ y.diff = E, y.prev = g, y.curr = T, g = T, p[0] = t.coerce(p[0]), typeof p[0] != "string" && p.unshift("%O");
71943
71943
  let S = 0;
71944
71944
  p[0] = p[0].replace(/%([a-zA-Z%])/g, (B, G) => {
71945
71945
  if (B === "%%") return "%";
@@ -71947,45 +71947,45 @@ var ru = z((nD, pd) => {
71947
71947
  let Z = t.formatters[G];
71948
71948
  if (typeof Z == "function") {
71949
71949
  let H = p[S];
71950
- B = Z.call(g, H), p.splice(S, 1), S--;
71950
+ B = Z.call(y, H), p.splice(S, 1), S--;
71951
71951
  }
71952
71952
  return B;
71953
- }), t.formatArgs.call(g, p), (g.log || t.log).apply(g, p);
71953
+ }), t.formatArgs.call(y, p), (y.log || t.log).apply(y, p);
71954
71954
  }
71955
71955
  return w.namespace = h, w.useColors = t.useColors(), w.color = t.selectColor(h), w.extend = n, w.destroy = t.destroy, Object.defineProperty(w, "enabled", { enumerable: true, configurable: false, get: () => A !== null ? A : (P !== t.namespaces && (P = t.namespaces, b = t.enabled(h)), b), set: (p) => {
71956
71956
  A = p;
71957
71957
  } }), typeof t.init == "function" && t.init(w), w;
71958
71958
  }
71959
- function n(h, _) {
71960
- let A = t(this.namespace + (typeof _ > "u" ? ":" : _) + h);
71959
+ function n(h, g) {
71960
+ let A = t(this.namespace + (typeof g > "u" ? ":" : g) + h);
71961
71961
  return A.log = this.log, A;
71962
71962
  }
71963
71963
  function o(h) {
71964
71964
  t.save(h), t.namespaces = h, t.names = [], t.skips = [];
71965
- let _ = (typeof h == "string" ? h : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
71966
- for (let A of _) A[0] === "-" ? t.skips.push(A.slice(1)) : t.names.push(A);
71965
+ let g = (typeof h == "string" ? h : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
71966
+ for (let A of g) A[0] === "-" ? t.skips.push(A.slice(1)) : t.names.push(A);
71967
71967
  }
71968
- function i(h, _) {
71968
+ function i(h, g) {
71969
71969
  let A = 0, P = 0, b = -1, w = 0;
71970
- for (; A < h.length; ) if (P < _.length && (_[P] === h[A] || _[P] === "*")) _[P] === "*" ? (b = P, w = A, P++) : (A++, P++);
71970
+ for (; A < h.length; ) if (P < g.length && (g[P] === h[A] || g[P] === "*")) g[P] === "*" ? (b = P, w = A, P++) : (A++, P++);
71971
71971
  else if (b !== -1) P = b + 1, w++, A = w;
71972
71972
  else return false;
71973
- for (; P < _.length && _[P] === "*"; ) P++;
71974
- return P === _.length;
71973
+ for (; P < g.length && g[P] === "*"; ) P++;
71974
+ return P === g.length;
71975
71975
  }
71976
71976
  function u() {
71977
- let h = [...t.names, ...t.skips.map((_) => "-" + _)].join(",");
71977
+ let h = [...t.names, ...t.skips.map((g) => "-" + g)].join(",");
71978
71978
  return t.enable(""), h;
71979
71979
  }
71980
71980
  function l(h) {
71981
- for (let _ of t.skips) if (i(h, _)) return false;
71982
- for (let _ of t.names) if (i(h, _)) return true;
71981
+ for (let g of t.skips) if (i(h, g)) return false;
71982
+ for (let g of t.names) if (i(h, g)) return true;
71983
71983
  return false;
71984
71984
  }
71985
- function d(h) {
71985
+ function f(h) {
71986
71986
  return h instanceof Error ? h.stack || h.message : h;
71987
71987
  }
71988
- function f() {
71988
+ function d() {
71989
71989
  console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
71990
71990
  }
71991
71991
  return t.enable(t.load()), t;
@@ -72266,8 +72266,8 @@ var Rd = z((ft) => {
72266
72266
  Promise.resolve().then(() => this.connect(e, o)).then((l) => {
72267
72267
  if (this.decrementSockets(i, u), l instanceof Sd.Agent) try {
72268
72268
  return l.addRequest(e, o);
72269
- } catch (d) {
72270
- return n(d);
72269
+ } catch (f) {
72270
+ return n(f);
72271
72271
  }
72272
72272
  this[Jt].currentSocket = l, super.createSocket(e, t, n);
72273
72273
  }, (l) => {
@@ -72307,30 +72307,30 @@ var kd = z((Dn) => {
72307
72307
  let n = 0, o = [];
72308
72308
  function i() {
72309
72309
  let h = r.read();
72310
- h ? f(h) : r.once("readable", i);
72310
+ h ? d(h) : r.once("readable", i);
72311
72311
  }
72312
72312
  function u() {
72313
- r.removeListener("end", l), r.removeListener("error", d), r.removeListener("readable", i);
72313
+ r.removeListener("end", l), r.removeListener("error", f), r.removeListener("readable", i);
72314
72314
  }
72315
72315
  function l() {
72316
72316
  u(), Oo("onend"), t(new Error("Proxy connection ended before receiving CONNECT response"));
72317
72317
  }
72318
- function d(h) {
72318
+ function f(h) {
72319
72319
  u(), Oo("onerror %o", h), t(h);
72320
72320
  }
72321
- function f(h) {
72321
+ function d(h) {
72322
72322
  o.push(h), n += h.length;
72323
- let _ = Buffer.concat(o, n), A = _.indexOf(`\r
72323
+ let g = Buffer.concat(o, n), A = g.indexOf(`\r
72324
72324
  \r
72325
72325
  `);
72326
72326
  if (A === -1) {
72327
72327
  Oo("have not received end of HTTP headers yet..."), i();
72328
72328
  return;
72329
72329
  }
72330
- let P = _.slice(0, A).toString("ascii").split(`\r
72330
+ let P = g.slice(0, A).toString("ascii").split(`\r
72331
72331
  `), b = P.shift();
72332
72332
  if (!b) return r.destroy(), t(new Error("No header received from proxy CONNECT response"));
72333
- let w = b.split(" "), p = +w[1], g = w.slice(2).join(" "), T = {};
72333
+ let w = b.split(" "), p = +w[1], y = w.slice(2).join(" "), T = {};
72334
72334
  for (let E of P) {
72335
72335
  if (!E) continue;
72336
72336
  let S = E.indexOf(":");
@@ -72338,9 +72338,9 @@ var kd = z((Dn) => {
72338
72338
  let F = E.slice(0, S).toLowerCase(), B = E.slice(S + 1).trimStart(), G = T[F];
72339
72339
  typeof G == "string" ? T[F] = [G, B] : Array.isArray(G) ? G.push(B) : T[F] = B;
72340
72340
  }
72341
- Oo("got proxy server response: %o %o", b, T), u(), e({ connect: { statusCode: p, statusText: g, headers: T }, buffered: _ });
72341
+ Oo("got proxy server response: %o %o", b, T), u(), e({ connect: { statusCode: p, statusText: y, headers: T }, buffered: g });
72342
72342
  }
72343
- r.on("error", d), r.on("end", l), i();
72343
+ r.on("error", f), r.on("end", l), i();
72344
72344
  });
72345
72345
  }
72346
72346
  Dn.parseProxyResponse = f_;
@@ -72389,16 +72389,16 @@ var Id = z((At) => {
72389
72389
  i.Host = `${u}:${t.port}`, i["Proxy-Connection"] || (i["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close");
72390
72390
  for (let A of Object.keys(i)) l += `${A}: ${i[A]}\r
72391
72391
  `;
72392
- let d = (0, __.parseProxyResponse)(o);
72392
+ let f = (0, __.parseProxyResponse)(o);
72393
72393
  o.write(`${l}\r
72394
72394
  `);
72395
- let { connect: f, buffered: h } = await d;
72396
- if (e.emit("proxyConnect", f), this.emit("proxyConnect", f, e), f.statusCode === 200) return e.once("socket", C_), t.secureEndpoint ? (as("Upgrading socket connection to TLS"), Fd.connect({ ...Pd(Od(t), "host", "path", "port"), socket: o })) : o;
72395
+ let { connect: d, buffered: h } = await f;
72396
+ if (e.emit("proxyConnect", d), this.emit("proxyConnect", d, e), d.statusCode === 200) return e.once("socket", C_), t.secureEndpoint ? (as("Upgrading socket connection to TLS"), Fd.connect({ ...Pd(Od(t), "host", "path", "port"), socket: o })) : o;
72397
72397
  o.destroy();
72398
- let _ = new Po.Socket({ writable: false });
72399
- return _.readable = true, e.once("socket", (A) => {
72398
+ let g = new Po.Socket({ writable: false });
72399
+ return g.readable = true, e.once("socket", (A) => {
72400
72400
  as("Replaying proxy buffer for failed request"), (0, p_.default)(A.listenerCount("data") > 0), A.push(h), A.push(null);
72401
- }), _;
72401
+ }), g;
72402
72402
  }
72403
72403
  };
72404
72404
  xo.protocols = ["http", "https"];
@@ -72420,8 +72420,8 @@ function b_(r) {
72420
72420
  let t = r.substring(5, e).split(";"), n = "", o = false, i = t[0] || "text/plain", u = i;
72421
72421
  for (let h = 1; h < t.length; h++) t[h] === "base64" ? o = true : t[h] && (u += `;${t[h]}`, t[h].indexOf("charset=") === 0 && (n = t[h].substring(8)));
72422
72422
  !t[0] && !n.length && (u += ";charset=US-ASCII", n = "US-ASCII");
72423
- let l = o ? "base64" : "ascii", d = unescape(r.substring(e + 1)), f = Buffer.from(d, l);
72424
- return f.type = i, f.typeFull = u, f.charset = n, f;
72423
+ let l = o ? "base64" : "ascii", f = unescape(r.substring(e + 1)), d = Buffer.from(f, l);
72424
+ return d.type = i, d.typeFull = u, d.charset = n, d;
72425
72425
  }
72426
72426
  var Nd;
72427
72427
  var qd = Me(() => {
@@ -72445,20 +72445,20 @@ var Ld = z((Bo, jd) => {
72445
72445
  }
72446
72446
  }
72447
72447
  let i = Promise, u = Promise.prototype.then, l = Promise.reject.bind(i);
72448
- function d(s) {
72448
+ function f(s) {
72449
72449
  return new i(s);
72450
72450
  }
72451
- function f(s) {
72452
- return d((a) => a(s));
72451
+ function d(s) {
72452
+ return f((a) => a(s));
72453
72453
  }
72454
72454
  function h(s) {
72455
72455
  return l(s);
72456
72456
  }
72457
- function _(s, a, c) {
72457
+ function g(s, a, c) {
72458
72458
  return u.call(s, a, c);
72459
72459
  }
72460
72460
  function A(s, a, c) {
72461
- _(_(s, a, c), void 0, n);
72461
+ g(g(s, a, c), void 0, n);
72462
72462
  }
72463
72463
  function P(s, a) {
72464
72464
  A(s, a);
@@ -72467,18 +72467,18 @@ var Ld = z((Bo, jd) => {
72467
72467
  A(s, void 0, a);
72468
72468
  }
72469
72469
  function w(s, a, c) {
72470
- return _(s, a, c);
72470
+ return g(s, a, c);
72471
72471
  }
72472
72472
  function p(s) {
72473
- _(s, void 0, n);
72473
+ g(s, void 0, n);
72474
72474
  }
72475
- let g = (s) => {
72476
- if (typeof queueMicrotask == "function") g = queueMicrotask;
72475
+ let y = (s) => {
72476
+ if (typeof queueMicrotask == "function") y = queueMicrotask;
72477
72477
  else {
72478
- let a = f(void 0);
72479
- g = (c) => _(a, c);
72478
+ let a = d(void 0);
72479
+ y = (c) => g(a, c);
72480
72480
  }
72481
- return g(s);
72481
+ return y(s);
72482
72482
  };
72483
72483
  function T(s, a, c) {
72484
72484
  if (typeof s != "function") throw new TypeError("Argument is not a function");
@@ -72486,9 +72486,9 @@ var Ld = z((Bo, jd) => {
72486
72486
  }
72487
72487
  function E(s, a, c) {
72488
72488
  try {
72489
- return f(T(s, a, c));
72490
- } catch (y) {
72491
- return h(y);
72489
+ return d(T(s, a, c));
72490
+ } catch (_) {
72491
+ return h(_);
72492
72492
  }
72493
72493
  }
72494
72494
  let S = 16384;
@@ -72500,16 +72500,16 @@ var Ld = z((Bo, jd) => {
72500
72500
  return this._size;
72501
72501
  }
72502
72502
  push(a) {
72503
- let c = this._back, y = c;
72504
- c._elements.length === S - 1 && (y = { _elements: [], _next: void 0 }), c._elements.push(a), y !== c && (this._back = y, c._next = y), ++this._size;
72503
+ let c = this._back, _ = c;
72504
+ c._elements.length === S - 1 && (_ = { _elements: [], _next: void 0 }), c._elements.push(a), _ !== c && (this._back = _, c._next = _), ++this._size;
72505
72505
  }
72506
72506
  shift() {
72507
- let a = this._front, c = a, y = this._cursor, v = y + 1, j = a._elements, U = j[y];
72508
- return v === S && (c = a._next, v = 0), --this._size, this._cursor = v, a !== c && (this._front = c), j[y] = void 0, U;
72507
+ let a = this._front, c = a, _ = this._cursor, v = _ + 1, j = a._elements, U = j[_];
72508
+ return v === S && (c = a._next, v = 0), --this._size, this._cursor = v, a !== c && (this._front = c), j[_] = void 0, U;
72509
72509
  }
72510
72510
  forEach(a) {
72511
- let c = this._cursor, y = this._front, v = y._elements;
72512
- for (; (c !== v.length || y._next !== void 0) && !(c === v.length && (y = y._next, v = y._elements, c = 0, v.length === 0)); ) a(v[c]), ++c;
72511
+ let c = this._cursor, _ = this._front, v = _._elements;
72512
+ for (; (c !== v.length || _._next !== void 0) && !(c === v.length && (_ = _._next, v = _._elements, c = 0, v.length === 0)); ) a(v[c]), ++c;
72513
72513
  }
72514
72514
  peek() {
72515
72515
  let a = this._front, c = this._cursor;
@@ -72532,7 +72532,7 @@ var Ld = z((Bo, jd) => {
72532
72532
  return new TypeError("Cannot " + s + " a stream using a released reader");
72533
72533
  }
72534
72534
  function Ae(s) {
72535
- s._closedPromise = d((a, c) => {
72535
+ s._closedPromise = f((a, c) => {
72536
72536
  s._closedPromise_resolve = a, s._closedPromise_reject = c;
72537
72537
  });
72538
72538
  }
@@ -72587,9 +72587,9 @@ var Ld = z((Bo, jd) => {
72587
72587
  return D(ve(s));
72588
72588
  }
72589
72589
  function k(s, a) {
72590
- let y = Number.MAX_SAFE_INTEGER, v = Number(s);
72590
+ let _ = Number.MAX_SAFE_INTEGER, v = Number(s);
72591
72591
  if (v = D(v), !Ue(v)) throw new TypeError(`${a} is not a finite number`);
72592
- if (v = N(v), v < 0 || v > y) throw new TypeError(`${a} is outside the accepted range of 0 to ${y}, inclusive`);
72592
+ if (v = N(v), v < 0 || v > _) throw new TypeError(`${a} is outside the accepted range of 0 to ${_}, inclusive`);
72593
72593
  return !Ue(v) || v === 0 ? 0 : v;
72594
72594
  }
72595
72595
  function x(s, a) {
@@ -72626,10 +72626,10 @@ var Ld = z((Bo, jd) => {
72626
72626
  read() {
72627
72627
  if (!Y(this)) return h(Ie("read"));
72628
72628
  if (this._ownerReadableStream === void 0) return h(Ce("read from"));
72629
- let a, c, y = d((j, U) => {
72629
+ let a, c, _ = f((j, U) => {
72630
72630
  a = j, c = U;
72631
72631
  });
72632
- return Q(this, { _chunkSteps: (j) => a({ value: j, done: false }), _closeSteps: () => a({ value: void 0, done: true }), _errorSteps: (j) => c(j) }), y;
72632
+ return Q(this, { _chunkSteps: (j) => a({ value: j, done: false }), _closeSteps: () => a({ value: void 0, done: true }), _errorSteps: (j) => c(j) }), _;
72633
72633
  }
72634
72634
  releaseLock() {
72635
72635
  if (!Y(this)) throw Ie("releaseLock");
@@ -72651,8 +72651,8 @@ var Ld = z((Bo, jd) => {
72651
72651
  }
72652
72652
  function Pe(s, a) {
72653
72653
  let c = s._readRequests;
72654
- s._readRequests = new F(), c.forEach((y) => {
72655
- y._errorSteps(a);
72654
+ s._readRequests = new F(), c.forEach((_) => {
72655
+ _._errorSteps(a);
72656
72656
  });
72657
72657
  }
72658
72658
  function Ie(s) {
@@ -72674,15 +72674,15 @@ var Ld = z((Bo, jd) => {
72674
72674
  }
72675
72675
  _nextSteps() {
72676
72676
  if (this._isFinished) return Promise.resolve({ value: void 0, done: true });
72677
- let a = this._reader, c, y, v = d((U, K) => {
72678
- c = U, y = K;
72677
+ let a = this._reader, c, _, v = f((U, K) => {
72678
+ c = U, _ = K;
72679
72679
  });
72680
72680
  return Q(a, { _chunkSteps: (U) => {
72681
- this._ongoingPromise = void 0, g(() => c({ value: U, done: false }));
72681
+ this._ongoingPromise = void 0, y(() => c({ value: U, done: false }));
72682
72682
  }, _closeSteps: () => {
72683
72683
  this._ongoingPromise = void 0, this._isFinished = true, Ee(a), c({ value: void 0, done: true });
72684
72684
  }, _errorSteps: (U) => {
72685
- this._ongoingPromise = void 0, this._isFinished = true, Ee(a), y(U);
72685
+ this._ongoingPromise = void 0, this._isFinished = true, Ee(a), _(U);
72686
72686
  } }), v;
72687
72687
  }
72688
72688
  _returnSteps(a) {
@@ -72690,10 +72690,10 @@ var Ld = z((Bo, jd) => {
72690
72690
  this._isFinished = true;
72691
72691
  let c = this._reader;
72692
72692
  if (!this._preventCancel) {
72693
- let y = fe(c, a);
72694
- return Ee(c), w(y, () => ({ value: a, done: true }));
72693
+ let _ = fe(c, a);
72694
+ return Ee(c), w(_, () => ({ value: a, done: true }));
72695
72695
  }
72696
- return Ee(c), f({ value: a, done: true });
72696
+ return Ee(c), d({ value: a, done: true });
72697
72697
  }
72698
72698
  }
72699
72699
  let je = { next() {
@@ -72703,8 +72703,8 @@ var Ld = z((Bo, jd) => {
72703
72703
  } };
72704
72704
  Object.setPrototypeOf(je, be);
72705
72705
  function sn(s, a) {
72706
- let c = L(s), y = new De(c, a), v = Object.create(je);
72707
- return v._asyncIteratorImpl = y, v;
72706
+ let c = L(s), _ = new De(c, a), v = Object.create(je);
72707
+ return v._asyncIteratorImpl = _, v;
72708
72708
  }
72709
72709
  function on(s) {
72710
72710
  if (!t(s) || !Object.prototype.hasOwnProperty.call(s, "_asyncIteratorImpl")) return false;
@@ -72724,14 +72724,14 @@ var Ld = z((Bo, jd) => {
72724
72724
  function Se(s) {
72725
72725
  return s.slice();
72726
72726
  }
72727
- function Tl(s, a, c, y, v) {
72728
- new Uint8Array(s).set(new Uint8Array(c, y, v), a);
72727
+ function Tl(s, a, c, _, v) {
72728
+ new Uint8Array(s).set(new Uint8Array(c, _, v), a);
72729
72729
  }
72730
72730
  let nr = (s) => (typeof s.transfer == "function" ? nr = (a) => a.transfer() : typeof structuredClone == "function" ? nr = (a) => structuredClone(a, { transfer: [a] }) : nr = (a) => a, nr(s)), Cr = (s) => (typeof s.detached == "boolean" ? Cr = (a) => a.detached : Cr = (a) => a.byteLength === 0, Cr(s));
72731
72731
  function vl(s, a, c) {
72732
72732
  if (s.slice) return s.slice(a, c);
72733
- let y = c - a, v = new ArrayBuffer(y);
72734
- return Tl(v, 0, s, a, y), v;
72733
+ let _ = c - a, v = new ArrayBuffer(_);
72734
+ return Tl(v, 0, s, a, _), v;
72735
72735
  }
72736
72736
  function qs(s, a) {
72737
72737
  let c = s[a];
@@ -72743,8 +72743,8 @@ var Ld = z((Bo, jd) => {
72743
72743
  function dg(s) {
72744
72744
  let a = { [Symbol.iterator]: () => s.iterator }, c = (async function* () {
72745
72745
  return yield* a;
72746
- })(), y = c.next;
72747
- return { iterator: c, nextMethod: y, done: false };
72746
+ })(), _ = c.next;
72747
+ return { iterator: c, nextMethod: _, done: false };
72748
72748
  }
72749
72749
  let la = (Le = (rr = Symbol.asyncIterator) !== null && rr !== void 0 ? rr : (Ve = Symbol.for) === null || Ve === void 0 ? void 0 : Ve.call(Symbol, "Symbol.asyncIterator")) !== null && Le !== void 0 ? Le : "@@asyncIterator";
72750
72750
  function Rl(s, a = "sync", c) {
@@ -72755,10 +72755,10 @@ var Ld = z((Bo, jd) => {
72755
72755
  }
72756
72756
  } else c = qs(s, Symbol.iterator);
72757
72757
  if (c === void 0) throw new TypeError("The object is not iterable");
72758
- let y = T(c, s, []);
72759
- if (!t(y)) throw new TypeError("The iterator method must return an object");
72760
- let v = y.next;
72761
- return { iterator: y, nextMethod: v, done: false };
72758
+ let _ = T(c, s, []);
72759
+ if (!t(_)) throw new TypeError("The iterator method must return an object");
72760
+ let v = _.next;
72761
+ return { iterator: _, nextMethod: v, done: false };
72762
72762
  }
72763
72763
  function hg(s) {
72764
72764
  let a = T(s.nextMethod, s.iterator, []);
@@ -72868,16 +72868,16 @@ var Ld = z((Bo, jd) => {
72868
72868
  Ll(this, a);
72869
72869
  return;
72870
72870
  }
72871
- let y = this._autoAllocateChunkSize;
72872
- if (y !== void 0) {
72871
+ let _ = this._autoAllocateChunkSize;
72872
+ if (_ !== void 0) {
72873
72873
  let v;
72874
72874
  try {
72875
- v = new ArrayBuffer(y);
72875
+ v = new ArrayBuffer(_);
72876
72876
  } catch (U) {
72877
72877
  a._errorSteps(U);
72878
72878
  return;
72879
72879
  }
72880
- let j = { buffer: v, bufferByteLength: y, byteOffset: 0, byteLength: y, bytesFilled: 0, minimumFill: 1, elementSize: 1, viewConstructor: Uint8Array, readerType: "default" };
72880
+ let j = { buffer: v, bufferByteLength: _, byteOffset: 0, byteLength: _, bytesFilled: 0, minimumFill: 1, elementSize: 1, viewConstructor: Uint8Array, readerType: "default" };
72881
72881
  this._pendingPullIntos.push(j);
72882
72882
  }
72883
72883
  R(c, a), Ur(this);
@@ -72904,7 +72904,7 @@ var Ld = z((Bo, jd) => {
72904
72904
  }
72905
72905
  s._pulling = true;
72906
72906
  let c = s._pullAlgorithm();
72907
- A(c, () => (s._pulling = false, s._pullAgain && (s._pullAgain = false, Ur(s)), null), (y) => (bt(s, y), null));
72907
+ A(c, () => (s._pulling = false, s._pullAgain && (s._pullAgain = false, Ur(s)), null), (_) => (bt(s, _), null));
72908
72908
  }
72909
72909
  function Ol(s) {
72910
72910
  ma(s), s._pendingPullIntos = new F();
@@ -72912,30 +72912,30 @@ var Ld = z((Bo, jd) => {
72912
72912
  function pa(s, a) {
72913
72913
  let c = false;
72914
72914
  s._state === "closed" && (c = true);
72915
- let y = Pl(a);
72916
- a.readerType === "default" ? O(s, y, c) : Fg(s, y, c);
72915
+ let _ = Pl(a);
72916
+ a.readerType === "default" ? O(s, _, c) : Fg(s, _, c);
72917
72917
  }
72918
72918
  function Pl(s) {
72919
72919
  let a = s.bytesFilled, c = s.elementSize;
72920
72920
  return new s.viewConstructor(s.buffer, s.byteOffset, a / c);
72921
72921
  }
72922
- function js(s, a, c, y) {
72923
- s._queue.push({ buffer: a, byteOffset: c, byteLength: y }), s._queueTotalSize += y;
72922
+ function js(s, a, c, _) {
72923
+ s._queue.push({ buffer: a, byteOffset: c, byteLength: _ }), s._queueTotalSize += _;
72924
72924
  }
72925
- function xl(s, a, c, y) {
72925
+ function xl(s, a, c, _) {
72926
72926
  let v;
72927
72927
  try {
72928
- v = vl(a, c, c + y);
72928
+ v = vl(a, c, c + _);
72929
72929
  } catch (j) {
72930
72930
  throw bt(s, j), j;
72931
72931
  }
72932
- js(s, v, 0, y);
72932
+ js(s, v, 0, _);
72933
72933
  }
72934
72934
  function Bl(s, a) {
72935
72935
  a.bytesFilled > 0 && xl(s, a.buffer, a.byteOffset, a.bytesFilled), un(s);
72936
72936
  }
72937
72937
  function Il(s, a) {
72938
- let c = Math.min(s._queueTotalSize, a.byteLength - a.bytesFilled), y = a.bytesFilled + c, v = c, j = false, U = y % a.elementSize, K = y - U;
72938
+ let c = Math.min(s._queueTotalSize, a.byteLength - a.bytesFilled), _ = a.bytesFilled + c, v = c, j = false, U = _ % a.elementSize, K = _ - U;
72939
72939
  K >= a.minimumFill && (v = K - a.bytesFilled, j = true);
72940
72940
  let ie = s._queue;
72941
72941
  for (; v > 0; ) {
@@ -72968,44 +72968,44 @@ var Ld = z((Bo, jd) => {
72968
72968
  Ll(s, c);
72969
72969
  }
72970
72970
  }
72971
- function Eg(s, a, c, y) {
72971
+ function Eg(s, a, c, _) {
72972
72972
  let v = s._controlledReadableByteStream, j = a.constructor, U = Cg(j), { byteOffset: K, byteLength: ie } = a, te = c * U, ce;
72973
72973
  try {
72974
72974
  ce = nr(a.buffer);
72975
72975
  } catch (Re) {
72976
- y._errorSteps(Re);
72976
+ _._errorSteps(Re);
72977
72977
  return;
72978
72978
  }
72979
72979
  let me = { buffer: ce, bufferByteLength: ce.byteLength, byteOffset: K, byteLength: ie, bytesFilled: 0, minimumFill: te, elementSize: U, viewConstructor: j, readerType: "byob" };
72980
72980
  if (s._pendingPullIntos.length > 0) {
72981
- s._pendingPullIntos.push(me), Hl(v, y);
72981
+ s._pendingPullIntos.push(me), Hl(v, _);
72982
72982
  return;
72983
72983
  }
72984
72984
  if (v._state === "closed") {
72985
72985
  let Re = new j(me.buffer, me.byteOffset, 0);
72986
- y._closeSteps(Re);
72986
+ _._closeSteps(Re);
72987
72987
  return;
72988
72988
  }
72989
72989
  if (s._queueTotalSize > 0) {
72990
72990
  if (Il(s, me)) {
72991
72991
  let Re = Pl(me);
72992
- ql(s), y._chunkSteps(Re);
72992
+ ql(s), _._chunkSteps(Re);
72993
72993
  return;
72994
72994
  }
72995
72995
  if (s._closeRequested) {
72996
72996
  let Re = new TypeError("Insufficient bytes to fill elements in the given buffer");
72997
- bt(s, Re), y._errorSteps(Re);
72997
+ bt(s, Re), _._errorSteps(Re);
72998
72998
  return;
72999
72999
  }
73000
73000
  }
73001
- s._pendingPullIntos.push(me), Hl(v, y), Ur(s);
73001
+ s._pendingPullIntos.push(me), Hl(v, _), Ur(s);
73002
73002
  }
73003
73003
  function wg(s, a) {
73004
73004
  a.readerType === "none" && un(s);
73005
73005
  let c = s._controlledReadableByteStream;
73006
73006
  if (Ca(c)) for (; Gl(c) > 0; ) {
73007
- let y = un(s);
73008
- pa(c, y);
73007
+ let _ = un(s);
73008
+ pa(c, _);
73009
73009
  }
73010
73010
  }
73011
73011
  function Ag(s, a, c) {
@@ -73015,12 +73015,12 @@ var Ld = z((Bo, jd) => {
73015
73015
  }
73016
73016
  if (c.bytesFilled < c.minimumFill) return;
73017
73017
  un(s);
73018
- let y = c.bytesFilled % c.elementSize;
73019
- if (y > 0) {
73018
+ let _ = c.bytesFilled % c.elementSize;
73019
+ if (_ > 0) {
73020
73020
  let v = c.byteOffset + c.bytesFilled;
73021
- xl(s, c.buffer, v - y, y);
73021
+ xl(s, c.buffer, v - _, _);
73022
73022
  }
73023
- c.bytesFilled -= y, pa(s._controlledReadableByteStream, c), ga(s);
73023
+ c.bytesFilled -= _, pa(s._controlledReadableByteStream, c), ga(s);
73024
73024
  }
73025
73025
  function jl(s, a) {
73026
73026
  let c = s._pendingPullIntos.peek();
@@ -73046,8 +73046,8 @@ var Ld = z((Bo, jd) => {
73046
73046
  if (s._pendingPullIntos.length > 0) {
73047
73047
  let c = s._pendingPullIntos.peek();
73048
73048
  if (c.bytesFilled % c.elementSize !== 0) {
73049
- let y = new TypeError("Insufficient bytes to fill elements in the given buffer");
73050
- throw bt(s, y), y;
73049
+ let _ = new TypeError("Insufficient bytes to fill elements in the given buffer");
73050
+ throw bt(s, _), _;
73051
73051
  }
73052
73052
  }
73053
73053
  Ls(s), ns(a);
@@ -73056,9 +73056,9 @@ var Ld = z((Bo, jd) => {
73056
73056
  function Us(s, a) {
73057
73057
  let c = s._controlledReadableByteStream;
73058
73058
  if (s._closeRequested || c._state !== "readable") return;
73059
- let { buffer: y, byteOffset: v, byteLength: j } = a;
73060
- if (Cr(y)) throw new TypeError("chunk's buffer is detached and so cannot be enqueued");
73061
- let U = nr(y);
73059
+ let { buffer: _, byteOffset: v, byteLength: j } = a;
73060
+ if (Cr(_)) throw new TypeError("chunk's buffer is detached and so cannot be enqueued");
73061
+ let U = nr(_);
73062
73062
  if (s._pendingPullIntos.length > 0) {
73063
73063
  let K = s._pendingPullIntos.peek();
73064
73064
  if (Cr(K.buffer)) throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");
@@ -73080,13 +73080,13 @@ var Ld = z((Bo, jd) => {
73080
73080
  function Ll(s, a) {
73081
73081
  let c = s._queue.shift();
73082
73082
  s._queueTotalSize -= c.byteLength, ql(s);
73083
- let y = new Uint8Array(c.buffer, c.byteOffset, c.byteLength);
73084
- a._chunkSteps(y);
73083
+ let _ = new Uint8Array(c.buffer, c.byteOffset, c.byteLength);
73084
+ a._chunkSteps(_);
73085
73085
  }
73086
73086
  function ya(s) {
73087
73087
  if (s._byobRequest === null && s._pendingPullIntos.length > 0) {
73088
- let a = s._pendingPullIntos.peek(), c = new Uint8Array(a.buffer, a.byteOffset + a.bytesFilled, a.byteLength - a.bytesFilled), y = Object.create(jr.prototype);
73089
- Tg(y, s, c), s._byobRequest = y;
73088
+ let a = s._pendingPullIntos.peek(), c = new Uint8Array(a.buffer, a.byteOffset + a.bytesFilled, a.byteLength - a.bytesFilled), _ = Object.create(jr.prototype);
73089
+ Tg(_, s, c), s._byobRequest = _;
73090
73090
  }
73091
73091
  return s._byobRequest;
73092
73092
  }
@@ -73115,18 +73115,18 @@ var Ld = z((Bo, jd) => {
73115
73115
  let v = a.byteLength;
73116
73116
  c.buffer = nr(a.buffer), jl(s, v);
73117
73117
  }
73118
- function Ml(s, a, c, y, v, j, U) {
73119
- a._controlledReadableByteStream = s, a._pullAgain = false, a._pulling = false, a._byobRequest = null, a._queue = a._queueTotalSize = void 0, br(a), a._closeRequested = false, a._started = false, a._strategyHWM = j, a._pullAlgorithm = y, a._cancelAlgorithm = v, a._autoAllocateChunkSize = U, a._pendingPullIntos = new F(), s._readableStreamController = a;
73118
+ function Ml(s, a, c, _, v, j, U) {
73119
+ a._controlledReadableByteStream = s, a._pullAgain = false, a._pulling = false, a._byobRequest = null, a._queue = a._queueTotalSize = void 0, br(a), a._closeRequested = false, a._started = false, a._strategyHWM = j, a._pullAlgorithm = _, a._cancelAlgorithm = v, a._autoAllocateChunkSize = U, a._pendingPullIntos = new F(), s._readableStreamController = a;
73120
73120
  let K = c();
73121
- A(f(K), () => (a._started = true, Ur(a), null), (ie) => (bt(a, ie), null));
73121
+ A(d(K), () => (a._started = true, Ur(a), null), (ie) => (bt(a, ie), null));
73122
73122
  }
73123
73123
  function Sg(s, a, c) {
73124
- let y = Object.create(sr.prototype), v, j, U;
73125
- a.start !== void 0 ? v = () => a.start(y) : v = () => {
73126
- }, a.pull !== void 0 ? j = () => a.pull(y) : j = () => f(void 0), a.cancel !== void 0 ? U = (ie) => a.cancel(ie) : U = () => f(void 0);
73124
+ let _ = Object.create(sr.prototype), v, j, U;
73125
+ a.start !== void 0 ? v = () => a.start(_) : v = () => {
73126
+ }, a.pull !== void 0 ? j = () => a.pull(_) : j = () => d(void 0), a.cancel !== void 0 ? U = (ie) => a.cancel(ie) : U = () => d(void 0);
73127
73127
  let K = a.autoAllocateChunkSize;
73128
73128
  if (K === 0) throw new TypeError("autoAllocateChunkSize must be greater than 0");
73129
- Ml(s, y, v, j, U, c, K);
73129
+ Ml(s, _, v, j, U, c, K);
73130
73130
  }
73131
73131
  function Tg(s, a, c) {
73132
73132
  s._associatedReadableByteStreamController = a, s._view = c;
@@ -73149,8 +73149,8 @@ var Ld = z((Bo, jd) => {
73149
73149
  function kg(s, a) {
73150
73150
  var c;
73151
73151
  ue(s, a);
73152
- let y = (c = s?.min) !== null && c !== void 0 ? c : 1;
73153
- return { min: k(y, `${a} has member 'min' that`) };
73152
+ let _ = (c = s?.min) !== null && c !== void 0 ? c : 1;
73153
+ return { min: k(_, `${a} has member 'min' that`) };
73154
73154
  }
73155
73155
  function $l(s) {
73156
73156
  return new Er(s);
@@ -73187,19 +73187,19 @@ var Ld = z((Bo, jd) => {
73187
73187
  if (a.byteLength === 0) return h(new TypeError("view must have non-zero byteLength"));
73188
73188
  if (a.buffer.byteLength === 0) return h(new TypeError("view's buffer must have non-zero byteLength"));
73189
73189
  if (Cr(a.buffer)) return h(new TypeError("view's buffer has been detached"));
73190
- let y;
73190
+ let _;
73191
73191
  try {
73192
- y = kg(c, "options");
73192
+ _ = kg(c, "options");
73193
73193
  } catch (te) {
73194
73194
  return h(te);
73195
73195
  }
73196
- let v = y.min;
73196
+ let v = _.min;
73197
73197
  if (v === 0) return h(new TypeError("options.min must be greater than 0"));
73198
73198
  if (_g(a)) {
73199
73199
  if (v > a.byteLength) return h(new RangeError("options.min must be less than or equal to view's byteLength"));
73200
73200
  } else if (v > a.length) return h(new RangeError("options.min must be less than or equal to view's length"));
73201
73201
  if (this._ownerReadableStream === void 0) return h(Ce("read from"));
73202
- let j, U, K = d((te, ce) => {
73202
+ let j, U, K = f((te, ce) => {
73203
73203
  j = te, U = ce;
73204
73204
  });
73205
73205
  return Wl(this, a, v, { _chunkSteps: (te) => j({ value: te, done: false }), _closeSteps: (te) => j({ value: te, done: true }), _errorSteps: (te) => U(te) }), K;
@@ -73213,9 +73213,9 @@ var Ld = z((Bo, jd) => {
73213
73213
  function Mr(s) {
73214
73214
  return !t(s) || !Object.prototype.hasOwnProperty.call(s, "_readIntoRequests") ? false : s instanceof Er;
73215
73215
  }
73216
- function Wl(s, a, c, y) {
73216
+ function Wl(s, a, c, _) {
73217
73217
  let v = s._ownerReadableStream;
73218
- v._disturbed = true, v._state === "errored" ? y._errorSteps(v._storedError) : Eg(v._readableStreamController, a, c, y);
73218
+ v._disturbed = true, v._state === "errored" ? _._errorSteps(v._storedError) : Eg(v._readableStreamController, a, c, _);
73219
73219
  }
73220
73220
  function Og(s) {
73221
73221
  Ee(s);
@@ -73224,8 +73224,8 @@ var Ld = z((Bo, jd) => {
73224
73224
  }
73225
73225
  function Jl(s, a) {
73226
73226
  let c = s._readIntoRequests;
73227
- s._readIntoRequests = new F(), c.forEach((y) => {
73228
- y._errorSteps(a);
73227
+ s._readIntoRequests = new F(), c.forEach((_) => {
73228
+ _._errorSteps(a);
73229
73229
  });
73230
73230
  }
73231
73231
  function Hs(s) {
@@ -73243,28 +73243,28 @@ var Ld = z((Bo, jd) => {
73243
73243
  }
73244
73244
  function Ws(s, a) {
73245
73245
  ue(s, a);
73246
- let c = s?.highWaterMark, y = s?.size;
73247
- return { highWaterMark: c === void 0 ? void 0 : C(c), size: y === void 0 ? void 0 : Pg(y, `${a} has member 'size' that`) };
73246
+ let c = s?.highWaterMark, _ = s?.size;
73247
+ return { highWaterMark: c === void 0 ? void 0 : C(c), size: _ === void 0 ? void 0 : Pg(_, `${a} has member 'size' that`) };
73248
73248
  }
73249
73249
  function Pg(s, a) {
73250
73250
  return ge(s, a), (c) => C(s(c));
73251
73251
  }
73252
73252
  function xg(s, a) {
73253
73253
  ue(s, a);
73254
- let c = s?.abort, y = s?.close, v = s?.start, j = s?.type, U = s?.write;
73255
- return { abort: c === void 0 ? void 0 : Bg(c, s, `${a} has member 'abort' that`), close: y === void 0 ? void 0 : Ig(y, s, `${a} has member 'close' that`), start: v === void 0 ? void 0 : Ng(v, s, `${a} has member 'start' that`), write: U === void 0 ? void 0 : qg(U, s, `${a} has member 'write' that`), type: j };
73254
+ let c = s?.abort, _ = s?.close, v = s?.start, j = s?.type, U = s?.write;
73255
+ return { abort: c === void 0 ? void 0 : Bg(c, s, `${a} has member 'abort' that`), close: _ === void 0 ? void 0 : Ig(_, s, `${a} has member 'close' that`), start: v === void 0 ? void 0 : Ng(v, s, `${a} has member 'start' that`), write: U === void 0 ? void 0 : qg(U, s, `${a} has member 'write' that`), type: j };
73256
73256
  }
73257
73257
  function Bg(s, a, c) {
73258
- return ge(s, c), (y) => E(s, a, [y]);
73258
+ return ge(s, c), (_) => E(s, a, [_]);
73259
73259
  }
73260
73260
  function Ig(s, a, c) {
73261
73261
  return ge(s, c), () => E(s, a, []);
73262
73262
  }
73263
73263
  function Ng(s, a, c) {
73264
- return ge(s, c), (y) => T(s, a, [y]);
73264
+ return ge(s, c), (_) => T(s, a, [_]);
73265
73265
  }
73266
73266
  function qg(s, a, c) {
73267
- return ge(s, c), (y, v) => E(s, a, [y, v]);
73267
+ return ge(s, c), (_, v) => E(s, a, [_, v]);
73268
73268
  }
73269
73269
  function zl(s, a) {
73270
73270
  if (!cn(s)) throw new TypeError(`${a} is not a WritableStream.`);
@@ -73284,9 +73284,9 @@ var Ld = z((Bo, jd) => {
73284
73284
  class wr {
73285
73285
  constructor(a = {}, c = {}) {
73286
73286
  a === void 0 ? a = null : ke(a, "First parameter");
73287
- let y = Ws(c, "Second parameter"), v = xg(a, "First parameter");
73287
+ let _ = Ws(c, "Second parameter"), v = xg(a, "First parameter");
73288
73288
  if (Kl(this), v.type !== void 0) throw new RangeError("Invalid type is specified");
73289
- let U = Gs(y), K = Qn(y, 1);
73289
+ let U = Gs(_), K = Qn(_, 1);
73290
73290
  ey(this, v, K, U);
73291
73291
  }
73292
73292
  get locked() {
@@ -73308,11 +73308,11 @@ var Ld = z((Bo, jd) => {
73308
73308
  function Vl(s) {
73309
73309
  return new or(s);
73310
73310
  }
73311
- function Mg(s, a, c, y, v = 1, j = () => 1) {
73311
+ function Mg(s, a, c, _, v = 1, j = () => 1) {
73312
73312
  let U = Object.create(wr.prototype);
73313
73313
  Kl(U);
73314
73314
  let K = Object.create(fn.prototype);
73315
- return rf(U, K, s, a, c, y, v, j), U;
73315
+ return rf(U, K, s, a, c, _, v, j), U;
73316
73316
  }
73317
73317
  function Kl(s) {
73318
73318
  s._state = "writable", s._storedError = void 0, s._writer = void 0, s._writableStreamController = void 0, s._writeRequests = new F(), s._inFlightWriteRequest = void 0, s._closeRequest = void 0, s._inFlightCloseRequest = void 0, s._pendingAbortRequest = void 0, s._backpressure = false;
@@ -73325,14 +73325,14 @@ var Ld = z((Bo, jd) => {
73325
73325
  }
73326
73326
  function Js(s, a) {
73327
73327
  var c;
73328
- if (s._state === "closed" || s._state === "errored") return f(void 0);
73328
+ if (s._state === "closed" || s._state === "errored") return d(void 0);
73329
73329
  s._writableStreamController._abortReason = a, (c = s._writableStreamController._abortController) === null || c === void 0 || c.abort(a);
73330
- let y = s._state;
73331
- if (y === "closed" || y === "errored") return f(void 0);
73330
+ let _ = s._state;
73331
+ if (_ === "closed" || _ === "errored") return d(void 0);
73332
73332
  if (s._pendingAbortRequest !== void 0) return s._pendingAbortRequest._promise;
73333
73333
  let v = false;
73334
- y === "erroring" && (v = true, a = void 0);
73335
- let j = d((U, K) => {
73334
+ _ === "erroring" && (v = true, a = void 0);
73335
+ let j = f((U, K) => {
73336
73336
  s._pendingAbortRequest = { _promise: void 0, _resolve: U, _reject: K, _reason: a, _wasAlreadyErroring: v };
73337
73337
  });
73338
73338
  return s._pendingAbortRequest._promise = j, v || Ea(s, a), j;
@@ -73340,15 +73340,15 @@ var Ld = z((Bo, jd) => {
73340
73340
  function Yl(s) {
73341
73341
  let a = s._state;
73342
73342
  if (a === "closed" || a === "errored") return h(new TypeError(`The stream (in ${a} state) is not in the writable state and cannot be closed`));
73343
- let c = d((v, j) => {
73343
+ let c = f((v, j) => {
73344
73344
  let U = { _resolve: v, _reject: j };
73345
73345
  s._closeRequest = U;
73346
- }), y = s._writer;
73347
- return y !== void 0 && s._backpressure && a === "writable" && ka(y), ty(s._writableStreamController), c;
73346
+ }), _ = s._writer;
73347
+ return _ !== void 0 && s._backpressure && a === "writable" && ka(_), ty(s._writableStreamController), c;
73348
73348
  }
73349
73349
  function $g(s) {
73350
- return d((c, y) => {
73351
- let v = { _resolve: c, _reject: y };
73350
+ return f((c, _) => {
73351
+ let v = { _resolve: c, _reject: _ };
73352
73352
  s._writeRequests.push(v);
73353
73353
  });
73354
73354
  }
@@ -73362,8 +73362,8 @@ var Ld = z((Bo, jd) => {
73362
73362
  function Ea(s, a) {
73363
73363
  let c = s._writableStreamController;
73364
73364
  s._state = "erroring", s._storedError = a;
73365
- let y = s._writer;
73366
- y !== void 0 && Ql(y, a), !zg(s) && c._started && wa(s);
73365
+ let _ = s._writer;
73366
+ _ !== void 0 && Ql(_, a), !zg(s) && c._started && wa(s);
73367
73367
  }
73368
73368
  function wa(s) {
73369
73369
  s._state = "errored", s._writableStreamController[G]();
@@ -73379,8 +73379,8 @@ var Ld = z((Bo, jd) => {
73379
73379
  c._reject(a), zs(s);
73380
73380
  return;
73381
73381
  }
73382
- let y = s._writableStreamController[B](c._reason);
73383
- A(y, () => (c._resolve(), zs(s), null), (v) => (c._reject(v), zs(s), null));
73382
+ let _ = s._writableStreamController[B](c._reason);
73383
+ A(_, () => (c._resolve(), zs(s), null), (v) => (c._reject(v), zs(s), null));
73384
73384
  }
73385
73385
  function Hg(s) {
73386
73386
  s._inFlightWriteRequest._resolve(void 0), s._inFlightWriteRequest = void 0;
@@ -73426,8 +73426,8 @@ var Ld = z((Bo, jd) => {
73426
73426
  else if (c === "erroring") Ra(this, a._storedError), Xs(this);
73427
73427
  else if (c === "closed") uf(this), iy(this);
73428
73428
  else {
73429
- let y = a._storedError;
73430
- Ra(this, y), of(this, y);
73429
+ let _ = a._storedError;
73430
+ Ra(this, _), of(this, _);
73431
73431
  }
73432
73432
  }
73433
73433
  get closed() {
@@ -73471,7 +73471,7 @@ var Ld = z((Bo, jd) => {
73471
73471
  }
73472
73472
  function Xg(s) {
73473
73473
  let a = s._ownerWritableStream, c = a._state;
73474
- return Gt(a) || c === "closed" ? f(void 0) : c === "errored" ? h(a._storedError) : Xl(s);
73474
+ return Gt(a) || c === "closed" ? d(void 0) : c === "errored" ? h(a._storedError) : Xl(s);
73475
73475
  }
73476
73476
  function Qg(s, a) {
73477
73477
  s._closedPromiseState === "pending" ? va(s, a) : ay(s, a);
@@ -73488,14 +73488,14 @@ var Ld = z((Bo, jd) => {
73488
73488
  Ql(s, c), Qg(s, c), a._writer = void 0, s._ownerWritableStream = void 0;
73489
73489
  }
73490
73490
  function ef(s, a) {
73491
- let c = s._ownerWritableStream, y = c._writableStreamController, v = ry(y, a);
73491
+ let c = s._ownerWritableStream, _ = c._writableStreamController, v = ry(_, a);
73492
73492
  if (c !== s._ownerWritableStream) return h(es("write to"));
73493
73493
  let j = c._state;
73494
73494
  if (j === "errored") return h(c._storedError);
73495
73495
  if (Gt(c) || j === "closed") return h(new TypeError("The stream is closing or closed and cannot be written to"));
73496
73496
  if (j === "erroring") return h(c._storedError);
73497
73497
  let U = $g(c);
73498
- return ny(y, a, v), U;
73498
+ return ny(_, a, v), U;
73499
73499
  }
73500
73500
  let tf = {};
73501
73501
  class fn {
@@ -73527,17 +73527,17 @@ var Ld = z((Bo, jd) => {
73527
73527
  function Da(s) {
73528
73528
  return !t(s) || !Object.prototype.hasOwnProperty.call(s, "_controlledWritableStream") ? false : s instanceof fn;
73529
73529
  }
73530
- function rf(s, a, c, y, v, j, U, K) {
73531
- a._controlledWritableStream = s, s._writableStreamController = a, a._queue = void 0, a._queueTotalSize = void 0, br(a), a._abortReason = void 0, a._abortController = Ug(), a._started = false, a._strategySizeAlgorithm = K, a._strategyHWM = U, a._writeAlgorithm = y, a._closeAlgorithm = v, a._abortAlgorithm = j;
73530
+ function rf(s, a, c, _, v, j, U, K) {
73531
+ a._controlledWritableStream = s, s._writableStreamController = a, a._queue = void 0, a._queueTotalSize = void 0, br(a), a._abortReason = void 0, a._abortController = Ug(), a._started = false, a._strategySizeAlgorithm = K, a._strategyHWM = U, a._writeAlgorithm = _, a._closeAlgorithm = v, a._abortAlgorithm = j;
73532
73532
  let ie = Sa(a);
73533
73533
  Aa(s, ie);
73534
- let te = c(), ce = f(te);
73534
+ let te = c(), ce = d(te);
73535
73535
  A(ce, () => (a._started = true, Ks(a), null), (me) => (a._started = true, ba(s, me), null));
73536
73536
  }
73537
- function ey(s, a, c, y) {
73537
+ function ey(s, a, c, _) {
73538
73538
  let v = Object.create(fn.prototype), j, U, K, ie;
73539
73539
  a.start !== void 0 ? j = () => a.start(v) : j = () => {
73540
- }, a.write !== void 0 ? U = (te) => a.write(te, v) : U = () => f(void 0), a.close !== void 0 ? K = () => a.close() : K = () => f(void 0), a.abort !== void 0 ? ie = (te) => a.abort(te) : ie = () => f(void 0), rf(s, v, j, U, K, ie, c, y);
73540
+ }, a.write !== void 0 ? U = (te) => a.write(te, v) : U = () => d(void 0), a.close !== void 0 ? K = () => a.close() : K = () => d(void 0), a.abort !== void 0 ? ie = (te) => a.abort(te) : ie = () => d(void 0), rf(s, v, j, U, K, ie, c, _);
73541
73541
  }
73542
73542
  function Vs(s) {
73543
73543
  s._writeAlgorithm = void 0, s._closeAlgorithm = void 0, s._abortAlgorithm = void 0, s._strategySizeAlgorithm = void 0;
@@ -73562,10 +73562,10 @@ var Ld = z((Bo, jd) => {
73562
73562
  Zn(s, v);
73563
73563
  return;
73564
73564
  }
73565
- let y = s._controlledWritableStream;
73566
- if (!Gt(y) && y._state === "writable") {
73565
+ let _ = s._controlledWritableStream;
73566
+ if (!Gt(_) && _._state === "writable") {
73567
73567
  let v = Sa(s);
73568
- Aa(y, v);
73568
+ Aa(_, v);
73569
73569
  }
73570
73570
  Ks(s);
73571
73571
  }
@@ -73577,8 +73577,8 @@ var Ld = z((Bo, jd) => {
73577
73577
  return;
73578
73578
  }
73579
73579
  if (s._queue.length === 0) return;
73580
- let y = yg(s);
73581
- y === tf ? sy(s) : oy(s, y);
73580
+ let _ = yg(s);
73581
+ _ === tf ? sy(s) : oy(s, _);
73582
73582
  }
73583
73583
  function Zn(s, a) {
73584
73584
  s._controlledWritableStream._state === "writable" && sf(s, a);
@@ -73587,13 +73587,13 @@ var Ld = z((Bo, jd) => {
73587
73587
  let a = s._controlledWritableStream;
73588
73588
  Vg(a), fa(s);
73589
73589
  let c = s._closeAlgorithm();
73590
- Vs(s), A(c, () => (Wg(a), null), (y) => (Jg(a, y), null));
73590
+ Vs(s), A(c, () => (Wg(a), null), (_) => (Jg(a, _), null));
73591
73591
  }
73592
73592
  function oy(s, a) {
73593
73593
  let c = s._controlledWritableStream;
73594
73594
  Kg(c);
73595
- let y = s._writeAlgorithm(a);
73596
- A(y, () => {
73595
+ let _ = s._writeAlgorithm(a);
73596
+ A(_, () => {
73597
73597
  Hg(c);
73598
73598
  let v = c._state;
73599
73599
  if (fa(s), !Gt(c) && v === "writable") {
@@ -73623,7 +73623,7 @@ var Ld = z((Bo, jd) => {
73623
73623
  return new TypeError("Cannot " + s + " a stream using a released writer");
73624
73624
  }
73625
73625
  function Xs(s) {
73626
- s._closedPromise = d((a, c) => {
73626
+ s._closedPromise = f((a, c) => {
73627
73627
  s._closedPromise_resolve = a, s._closedPromise_reject = c, s._closedPromiseState = "pending";
73628
73628
  });
73629
73629
  }
@@ -73643,7 +73643,7 @@ var Ld = z((Bo, jd) => {
73643
73643
  s._closedPromise_resolve !== void 0 && (s._closedPromise_resolve(void 0), s._closedPromise_resolve = void 0, s._closedPromise_reject = void 0, s._closedPromiseState = "resolved");
73644
73644
  }
73645
73645
  function Qs(s) {
73646
- s._readyPromise = d((a, c) => {
73646
+ s._readyPromise = f((a, c) => {
73647
73647
  s._readyPromise_resolve = a, s._readyPromise_reject = c;
73648
73648
  }), s._readyPromiseState = "pending";
73649
73649
  }
@@ -73684,22 +73684,22 @@ var Ld = z((Bo, jd) => {
73684
73684
  return fy(s) ? s : void 0;
73685
73685
  }
73686
73686
  function hy() {
73687
- let s = function(c, y) {
73688
- this.message = c || "", this.name = y || "Error", Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
73687
+ let s = function(c, _) {
73688
+ this.message = c || "", this.name = _ || "Error", Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
73689
73689
  };
73690
73690
  return o(s, "DOMException"), s.prototype = Object.create(Error.prototype), Object.defineProperty(s.prototype, "constructor", { value: s, writable: true, configurable: true }), s;
73691
73691
  }
73692
73692
  let py = dy() || hy();
73693
- function lf(s, a, c, y, v, j) {
73693
+ function lf(s, a, c, _, v, j) {
73694
73694
  let U = L(s), K = Vl(a);
73695
73695
  s._disturbed = true;
73696
- let ie = false, te = f(void 0);
73697
- return d((ce, me) => {
73696
+ let ie = false, te = d(void 0);
73697
+ return f((ce, me) => {
73698
73698
  let Re;
73699
73699
  if (j !== void 0) {
73700
73700
  if (Re = () => {
73701
73701
  let re = j.reason !== void 0 ? j.reason : new py("Aborted", "AbortError"), ye = [];
73702
- y || ye.push(() => a._state === "writable" ? Js(a, re) : f(void 0)), v || ye.push(() => s._state === "readable" ? Ot(s, re) : f(void 0)), rt(() => Promise.all(ye.map((Fe) => Fe())), true, re);
73702
+ _ || ye.push(() => a._state === "writable" ? Js(a, re) : d(void 0)), v || ye.push(() => s._state === "readable" ? Ot(s, re) : d(void 0)), rt(() => Promise.all(ye.map((Fe) => Fe())), true, re);
73703
73703
  }, j.aborted) {
73704
73704
  Re();
73705
73705
  return;
@@ -73707,28 +73707,28 @@ var Ld = z((Bo, jd) => {
73707
73707
  j.addEventListener("abort", Re);
73708
73708
  }
73709
73709
  function Pt() {
73710
- return d((re, ye) => {
73710
+ return f((re, ye) => {
73711
73711
  function Fe(lt) {
73712
- lt ? re() : _(mn(), Fe, ye);
73712
+ lt ? re() : g(mn(), Fe, ye);
73713
73713
  }
73714
73714
  Fe(false);
73715
73715
  });
73716
73716
  }
73717
73717
  function mn() {
73718
- return ie ? f(true) : _(K._readyPromise, () => d((re, ye) => {
73718
+ return ie ? d(true) : g(K._readyPromise, () => f((re, ye) => {
73719
73719
  Q(U, { _chunkSteps: (Fe) => {
73720
- te = _(ef(K, Fe), void 0, e), re(false);
73720
+ te = g(ef(K, Fe), void 0, e), re(false);
73721
73721
  }, _closeSteps: () => re(true), _errorSteps: ye });
73722
73722
  }));
73723
73723
  }
73724
- if (ar(s, U._closedPromise, (re) => (y ? Et(true, re) : rt(() => Js(a, re), true, re), null)), ar(a, K._closedPromise, (re) => (v ? Et(true, re) : rt(() => Ot(s, re), true, re), null)), Qe(s, U._closedPromise, () => (c ? Et() : rt(() => Xg(K)), null)), Gt(a) || a._state === "closed") {
73724
+ if (ar(s, U._closedPromise, (re) => (_ ? Et(true, re) : rt(() => Js(a, re), true, re), null)), ar(a, K._closedPromise, (re) => (v ? Et(true, re) : rt(() => Ot(s, re), true, re), null)), Qe(s, U._closedPromise, () => (c ? Et() : rt(() => Xg(K)), null)), Gt(a) || a._state === "closed") {
73725
73725
  let re = new TypeError("the destination writable stream closed before all data could be piped to it");
73726
73726
  v ? Et(true, re) : rt(() => Ot(s, re), true, re);
73727
73727
  }
73728
73728
  p(Pt());
73729
73729
  function Tr() {
73730
73730
  let re = te;
73731
- return _(te, () => re !== te ? Tr() : void 0);
73731
+ return g(te, () => re !== te ? Tr() : void 0);
73732
73732
  }
73733
73733
  function ar(re, ye, Fe) {
73734
73734
  re._state === "errored" ? Fe(re._storedError) : b(ye, Fe);
@@ -73781,8 +73781,8 @@ var Ld = z((Bo, jd) => {
73781
73781
  [H](a) {
73782
73782
  let c = this._controlledReadableStream;
73783
73783
  if (this._queue.length > 0) {
73784
- let y = fa(this);
73785
- this._closeRequested && this._queue.length === 0 ? (eo(this), ns(c)) : ts(this), a._chunkSteps(y);
73784
+ let _ = fa(this);
73785
+ this._closeRequested && this._queue.length === 0 ? (eo(this), ns(c)) : ts(this), a._chunkSteps(_);
73786
73786
  } else R(c, a), ts(this);
73787
73787
  }
73788
73788
  [ae]() {
@@ -73800,7 +73800,7 @@ var Ld = z((Bo, jd) => {
73800
73800
  }
73801
73801
  s._pulling = true;
73802
73802
  let c = s._pullAlgorithm();
73803
- A(c, () => (s._pulling = false, s._pullAgain && (s._pullAgain = false, ts(s)), null), (y) => (Ft(s, y), null));
73803
+ A(c, () => (s._pulling = false, s._pullAgain && (s._pullAgain = false, ts(s)), null), (_) => (Ft(s, _), null));
73804
73804
  }
73805
73805
  function ff(s) {
73806
73806
  let a = s._controlledReadableStream;
@@ -73819,14 +73819,14 @@ var Ld = z((Bo, jd) => {
73819
73819
  let c = s._controlledReadableStream;
73820
73820
  if (Dr(c) && q(c) > 0) O(c, a, false);
73821
73821
  else {
73822
- let y;
73822
+ let _;
73823
73823
  try {
73824
- y = s._strategySizeAlgorithm(a);
73824
+ _ = s._strategySizeAlgorithm(a);
73825
73825
  } catch (v) {
73826
73826
  throw Ft(s, v), v;
73827
73827
  }
73828
73828
  try {
73829
- da(s, a, y);
73829
+ da(s, a, _);
73830
73830
  } catch (v) {
73831
73831
  throw Ft(s, v), v;
73832
73832
  }
@@ -73848,15 +73848,15 @@ var Ld = z((Bo, jd) => {
73848
73848
  let a = s._controlledReadableStream._state;
73849
73849
  return !s._closeRequested && a === "readable";
73850
73850
  }
73851
- function df(s, a, c, y, v, j, U) {
73852
- a._controlledReadableStream = s, a._queue = void 0, a._queueTotalSize = void 0, br(a), a._started = false, a._closeRequested = false, a._pullAgain = false, a._pulling = false, a._strategySizeAlgorithm = U, a._strategyHWM = j, a._pullAlgorithm = y, a._cancelAlgorithm = v, s._readableStreamController = a;
73851
+ function df(s, a, c, _, v, j, U) {
73852
+ a._controlledReadableStream = s, a._queue = void 0, a._queueTotalSize = void 0, br(a), a._started = false, a._closeRequested = false, a._pullAgain = false, a._pulling = false, a._strategySizeAlgorithm = U, a._strategyHWM = j, a._pullAlgorithm = _, a._cancelAlgorithm = v, s._readableStreamController = a;
73853
73853
  let K = c();
73854
- A(f(K), () => (a._started = true, ts(a), null), (ie) => (Ft(a, ie), null));
73854
+ A(d(K), () => (a._started = true, ts(a), null), (ie) => (Ft(a, ie), null));
73855
73855
  }
73856
- function gy(s, a, c, y) {
73856
+ function gy(s, a, c, _) {
73857
73857
  let v = Object.create(ir.prototype), j, U, K;
73858
73858
  a.start !== void 0 ? j = () => a.start(v) : j = () => {
73859
- }, a.pull !== void 0 ? U = () => a.pull(v) : U = () => f(void 0), a.cancel !== void 0 ? K = (ie) => a.cancel(ie) : K = () => f(void 0), df(s, v, j, U, K, c, y);
73859
+ }, a.pull !== void 0 ? U = () => a.pull(v) : U = () => d(void 0), a.cancel !== void 0 ? K = (ie) => a.cancel(ie) : K = () => d(void 0), df(s, v, j, U, K, c, _);
73860
73860
  }
73861
73861
  function to(s) {
73862
73862
  return new TypeError(`ReadableStreamDefaultController.prototype.${s} can only be used on a ReadableStreamDefaultController`);
@@ -73865,21 +73865,21 @@ var Ld = z((Bo, jd) => {
73865
73865
  return Lr(s._readableStreamController) ? Cy(s) : _y(s);
73866
73866
  }
73867
73867
  function _y(s, a) {
73868
- let c = L(s), y = false, v = false, j = false, U = false, K, ie, te, ce, me, Re = d((Qe) => {
73868
+ let c = L(s), _ = false, v = false, j = false, U = false, K, ie, te, ce, me, Re = f((Qe) => {
73869
73869
  me = Qe;
73870
73870
  });
73871
73871
  function Pt() {
73872
- return y ? (v = true, f(void 0)) : (y = true, Q(c, { _chunkSteps: (rt) => {
73873
- g(() => {
73872
+ return _ ? (v = true, d(void 0)) : (_ = true, Q(c, { _chunkSteps: (rt) => {
73873
+ y(() => {
73874
73874
  v = false;
73875
73875
  let Et = rt, ur = rt;
73876
- j || dn(te._readableStreamController, Et), U || dn(ce._readableStreamController, ur), y = false, v && Pt();
73876
+ j || dn(te._readableStreamController, Et), U || dn(ce._readableStreamController, ur), _ = false, v && Pt();
73877
73877
  });
73878
73878
  }, _closeSteps: () => {
73879
- y = false, j || Gr(te._readableStreamController), U || Gr(ce._readableStreamController), (!j || !U) && me(void 0);
73879
+ _ = false, j || Gr(te._readableStreamController), U || Gr(ce._readableStreamController), (!j || !U) && me(void 0);
73880
73880
  }, _errorSteps: () => {
73881
- y = false;
73882
- } }), f(void 0));
73881
+ _ = false;
73882
+ } }), d(void 0));
73883
73883
  }
73884
73884
  function mn(Qe) {
73885
73885
  if (j = true, K = Qe, U) {
@@ -73900,7 +73900,7 @@ var Ld = z((Bo, jd) => {
73900
73900
  return te = rs(ar, Pt, mn), ce = rs(ar, Pt, Tr), b(c._closedPromise, (Qe) => (Ft(te._readableStreamController, Qe), Ft(ce._readableStreamController, Qe), (!j || !U) && me(void 0), null)), [te, ce];
73901
73901
  }
73902
73902
  function Cy(s) {
73903
- let a = L(s), c = false, y = false, v = false, j = false, U = false, K, ie, te, ce, me, Re = d((re) => {
73903
+ let a = L(s), c = false, _ = false, v = false, j = false, U = false, K, ie, te, ce, me, Re = f((re) => {
73904
73904
  me = re;
73905
73905
  });
73906
73906
  function Pt(re) {
@@ -73908,8 +73908,8 @@ var Ld = z((Bo, jd) => {
73908
73908
  }
73909
73909
  function mn() {
73910
73910
  Mr(a) && (Ee(a), a = L(s), Pt(a)), Q(a, { _chunkSteps: (ye) => {
73911
- g(() => {
73912
- y = false, v = false;
73911
+ y(() => {
73912
+ _ = false, v = false;
73913
73913
  let Fe = ye, lt = ye;
73914
73914
  if (!j && !U) try {
73915
73915
  lt = kl(ye);
@@ -73917,7 +73917,7 @@ var Ld = z((Bo, jd) => {
73917
73917
  bt(te._readableStreamController, gn), bt(ce._readableStreamController, gn), me(Ot(s, gn));
73918
73918
  return;
73919
73919
  }
73920
- j || Us(te._readableStreamController, Fe), U || Us(ce._readableStreamController, lt), c = false, y ? ar() : v && Qe();
73920
+ j || Us(te._readableStreamController, Fe), U || Us(ce._readableStreamController, lt), c = false, _ ? ar() : v && Qe();
73921
73921
  });
73922
73922
  }, _closeSteps: () => {
73923
73923
  c = false, j || Yn(te._readableStreamController), U || Yn(ce._readableStreamController), te._readableStreamController._pendingPullIntos.length > 0 && Ms(te._readableStreamController, 0), ce._readableStreamController._pendingPullIntos.length > 0 && Ms(ce._readableStreamController, 0), (!j || !U) && me(void 0);
@@ -73929,8 +73929,8 @@ var Ld = z((Bo, jd) => {
73929
73929
  Y(a) && (Ee(a), a = $l(s), Pt(a));
73930
73930
  let Fe = ye ? ce : te, lt = ye ? te : ce;
73931
73931
  Wl(a, re, 1, { _chunkSteps: (yn) => {
73932
- g(() => {
73933
- y = false, v = false;
73932
+ y(() => {
73933
+ _ = false, v = false;
73934
73934
  let _n = ye ? U : j;
73935
73935
  if (ye ? j : U) _n || $s(Fe._readableStreamController, yn);
73936
73936
  else {
@@ -73943,7 +73943,7 @@ var Ld = z((Bo, jd) => {
73943
73943
  }
73944
73944
  _n || $s(Fe._readableStreamController, yn), Us(lt._readableStreamController, Rf);
73945
73945
  }
73946
- c = false, y ? ar() : v && Qe();
73946
+ c = false, _ ? ar() : v && Qe();
73947
73947
  });
73948
73948
  }, _closeSteps: (yn) => {
73949
73949
  c = false;
@@ -73954,16 +73954,16 @@ var Ld = z((Bo, jd) => {
73954
73954
  } });
73955
73955
  }
73956
73956
  function ar() {
73957
- if (c) return y = true, f(void 0);
73957
+ if (c) return _ = true, d(void 0);
73958
73958
  c = true;
73959
73959
  let re = ya(te._readableStreamController);
73960
- return re === null ? mn() : Tr(re._view, false), f(void 0);
73960
+ return re === null ? mn() : Tr(re._view, false), d(void 0);
73961
73961
  }
73962
73962
  function Qe() {
73963
- if (c) return v = true, f(void 0);
73963
+ if (c) return v = true, d(void 0);
73964
73964
  c = true;
73965
73965
  let re = ya(ce._readableStreamController);
73966
- return re === null ? mn() : Tr(re._view, true), f(void 0);
73966
+ return re === null ? mn() : Tr(re._view, true), d(void 0);
73967
73967
  }
73968
73968
  function rt(re) {
73969
73969
  if (j = true, K = re, U) {
@@ -73990,7 +73990,7 @@ var Ld = z((Bo, jd) => {
73990
73990
  return by(s) ? Ay(s.getReader()) : wy(s);
73991
73991
  }
73992
73992
  function wy(s) {
73993
- let a, c = Rl(s, "async"), y = e;
73993
+ let a, c = Rl(s, "async"), _ = e;
73994
73994
  function v() {
73995
73995
  let U;
73996
73996
  try {
@@ -73998,7 +73998,7 @@ var Ld = z((Bo, jd) => {
73998
73998
  } catch (ie) {
73999
73999
  return h(ie);
74000
74000
  }
74001
- let K = f(U);
74001
+ let K = d(U);
74002
74002
  return w(K, (ie) => {
74003
74003
  if (!t(ie)) throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");
74004
74004
  if (pg(ie)) Gr(a._readableStreamController);
@@ -74015,23 +74015,23 @@ var Ld = z((Bo, jd) => {
74015
74015
  } catch (me) {
74016
74016
  return h(me);
74017
74017
  }
74018
- if (ie === void 0) return f(void 0);
74018
+ if (ie === void 0) return d(void 0);
74019
74019
  let te;
74020
74020
  try {
74021
74021
  te = T(ie, K, [U]);
74022
74022
  } catch (me) {
74023
74023
  return h(me);
74024
74024
  }
74025
- let ce = f(te);
74025
+ let ce = d(te);
74026
74026
  return w(ce, (me) => {
74027
74027
  if (!t(me)) throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object");
74028
74028
  });
74029
74029
  }
74030
- return a = rs(y, v, j, 0), a;
74030
+ return a = rs(_, v, j, 0), a;
74031
74031
  }
74032
74032
  function Ay(s) {
74033
74033
  let a, c = e;
74034
- function y() {
74034
+ function _() {
74035
74035
  let j;
74036
74036
  try {
74037
74037
  j = s.read();
@@ -74049,26 +74049,26 @@ var Ld = z((Bo, jd) => {
74049
74049
  }
74050
74050
  function v(j) {
74051
74051
  try {
74052
- return f(s.cancel(j));
74052
+ return d(s.cancel(j));
74053
74053
  } catch (U) {
74054
74054
  return h(U);
74055
74055
  }
74056
74056
  }
74057
- return a = rs(c, y, v, 0), a;
74057
+ return a = rs(c, _, v, 0), a;
74058
74058
  }
74059
74059
  function Dy(s, a) {
74060
74060
  ue(s, a);
74061
- let c = s, y = c?.autoAllocateChunkSize, v = c?.cancel, j = c?.pull, U = c?.start, K = c?.type;
74062
- return { autoAllocateChunkSize: y === void 0 ? void 0 : k(y, `${a} has member 'autoAllocateChunkSize' that`), cancel: v === void 0 ? void 0 : Sy(v, c, `${a} has member 'cancel' that`), pull: j === void 0 ? void 0 : Ty(j, c, `${a} has member 'pull' that`), start: U === void 0 ? void 0 : vy(U, c, `${a} has member 'start' that`), type: K === void 0 ? void 0 : Ry(K, `${a} has member 'type' that`) };
74061
+ let c = s, _ = c?.autoAllocateChunkSize, v = c?.cancel, j = c?.pull, U = c?.start, K = c?.type;
74062
+ return { autoAllocateChunkSize: _ === void 0 ? void 0 : k(_, `${a} has member 'autoAllocateChunkSize' that`), cancel: v === void 0 ? void 0 : Sy(v, c, `${a} has member 'cancel' that`), pull: j === void 0 ? void 0 : Ty(j, c, `${a} has member 'pull' that`), start: U === void 0 ? void 0 : vy(U, c, `${a} has member 'start' that`), type: K === void 0 ? void 0 : Ry(K, `${a} has member 'type' that`) };
74063
74063
  }
74064
74064
  function Sy(s, a, c) {
74065
- return ge(s, c), (y) => E(s, a, [y]);
74065
+ return ge(s, c), (_) => E(s, a, [_]);
74066
74066
  }
74067
74067
  function Ty(s, a, c) {
74068
- return ge(s, c), (y) => E(s, a, [y]);
74068
+ return ge(s, c), (_) => E(s, a, [_]);
74069
74069
  }
74070
74070
  function vy(s, a, c) {
74071
- return ge(s, c), (y) => T(s, a, [y]);
74071
+ return ge(s, c), (_) => T(s, a, [_]);
74072
74072
  }
74073
74073
  function Ry(s, a) {
74074
74074
  if (s = `${s}`, s !== "bytes") throw new TypeError(`${a} '${s}' is not a valid enumeration value for ReadableStreamType`);
@@ -74079,8 +74079,8 @@ var Ld = z((Bo, jd) => {
74079
74079
  }
74080
74080
  function hf(s, a) {
74081
74081
  ue(s, a);
74082
- let c = s?.preventAbort, y = s?.preventCancel, v = s?.preventClose, j = s?.signal;
74083
- return j !== void 0 && Fy(j, `${a} has member 'signal' that`), { preventAbort: !!c, preventCancel: !!y, preventClose: !!v, signal: j };
74082
+ let c = s?.preventAbort, _ = s?.preventCancel, v = s?.preventClose, j = s?.signal;
74083
+ return j !== void 0 && Fy(j, `${a} has member 'signal' that`), { preventAbort: !!c, preventCancel: !!_, preventClose: !!v, signal: j };
74084
74084
  }
74085
74085
  function Fy(s, a) {
74086
74086
  if (!jg(s)) throw new TypeError(`${a} is not an AbortSignal.`);
@@ -74089,19 +74089,19 @@ var Ld = z((Bo, jd) => {
74089
74089
  ue(s, a);
74090
74090
  let c = s?.readable;
74091
74091
  m(c, "readable", "ReadableWritablePair"), x(c, `${a} has member 'readable' that`);
74092
- let y = s?.writable;
74093
- return m(y, "writable", "ReadableWritablePair"), zl(y, `${a} has member 'writable' that`), { readable: c, writable: y };
74092
+ let _ = s?.writable;
74093
+ return m(_, "writable", "ReadableWritablePair"), zl(_, `${a} has member 'writable' that`), { readable: c, writable: _ };
74094
74094
  }
74095
74095
  class Ke {
74096
74096
  constructor(a = {}, c = {}) {
74097
74097
  a === void 0 ? a = null : ke(a, "First parameter");
74098
- let y = Ws(c, "Second parameter"), v = Dy(a, "First parameter");
74098
+ let _ = Ws(c, "Second parameter"), v = Dy(a, "First parameter");
74099
74099
  if (Pa(this), v.type === "bytes") {
74100
- if (y.size !== void 0) throw new RangeError("The strategy for a byte stream cannot have a size function");
74101
- let j = Qn(y, 0);
74100
+ if (_.size !== void 0) throw new RangeError("The strategy for a byte stream cannot have a size function");
74101
+ let j = Qn(_, 0);
74102
74102
  Sg(this, v, j);
74103
74103
  } else {
74104
- let j = Gs(y), U = Qn(y, 1);
74104
+ let j = Gs(_), U = Qn(_, 1);
74105
74105
  gy(this, v, U, j);
74106
74106
  }
74107
74107
  }
@@ -74119,23 +74119,23 @@ var Ld = z((Bo, jd) => {
74119
74119
  pipeThrough(a, c = {}) {
74120
74120
  if (!Ar(this)) throw Wr("pipeThrough");
74121
74121
  Ne(a, 1, "pipeThrough");
74122
- let y = Oy(a, "First parameter"), v = hf(c, "Second parameter");
74122
+ let _ = Oy(a, "First parameter"), v = hf(c, "Second parameter");
74123
74123
  if (Dr(this)) throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");
74124
- if (ln(y.writable)) throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");
74125
- let j = lf(this, y.writable, v.preventClose, v.preventAbort, v.preventCancel, v.signal);
74126
- return p(j), y.readable;
74124
+ if (ln(_.writable)) throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");
74125
+ let j = lf(this, _.writable, v.preventClose, v.preventAbort, v.preventCancel, v.signal);
74126
+ return p(j), _.readable;
74127
74127
  }
74128
74128
  pipeTo(a, c = {}) {
74129
74129
  if (!Ar(this)) return h(Wr("pipeTo"));
74130
74130
  if (a === void 0) return h("Parameter 1 is required in 'pipeTo'.");
74131
74131
  if (!cn(a)) return h(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));
74132
- let y;
74132
+ let _;
74133
74133
  try {
74134
- y = hf(c, "Second parameter");
74134
+ _ = hf(c, "Second parameter");
74135
74135
  } catch (v) {
74136
74136
  return h(v);
74137
74137
  }
74138
- return Dr(this) ? h(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")) : ln(a) ? h(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")) : lf(this, a, y.preventClose, y.preventAbort, y.preventCancel, y.signal);
74138
+ return Dr(this) ? h(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")) : ln(a) ? h(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")) : lf(this, a, _.preventClose, _.preventAbort, _.preventCancel, _.signal);
74139
74139
  }
74140
74140
  tee() {
74141
74141
  if (!Ar(this)) throw Wr("tee");
@@ -74155,17 +74155,17 @@ var Ld = z((Bo, jd) => {
74155
74155
  }
74156
74156
  }
74157
74157
  Object.defineProperties(Ke, { from: { enumerable: true } }), Object.defineProperties(Ke.prototype, { cancel: { enumerable: true }, getReader: { enumerable: true }, pipeThrough: { enumerable: true }, pipeTo: { enumerable: true }, tee: { enumerable: true }, values: { enumerable: true }, locked: { enumerable: true } }), o(Ke.from, "from"), o(Ke.prototype.cancel, "cancel"), o(Ke.prototype.getReader, "getReader"), o(Ke.prototype.pipeThrough, "pipeThrough"), o(Ke.prototype.pipeTo, "pipeTo"), o(Ke.prototype.tee, "tee"), o(Ke.prototype.values, "values"), typeof Symbol.toStringTag == "symbol" && Object.defineProperty(Ke.prototype, Symbol.toStringTag, { value: "ReadableStream", configurable: true }), Object.defineProperty(Ke.prototype, la, { value: Ke.prototype.values, writable: true, configurable: true });
74158
- function rs(s, a, c, y = 1, v = () => 1) {
74158
+ function rs(s, a, c, _ = 1, v = () => 1) {
74159
74159
  let j = Object.create(Ke.prototype);
74160
74160
  Pa(j);
74161
74161
  let U = Object.create(ir.prototype);
74162
- return df(j, U, s, a, c, y, v), j;
74162
+ return df(j, U, s, a, c, _, v), j;
74163
74163
  }
74164
74164
  function pf(s, a, c) {
74165
- let y = Object.create(Ke.prototype);
74166
- Pa(y);
74165
+ let _ = Object.create(Ke.prototype);
74166
+ Pa(_);
74167
74167
  let v = Object.create(sr.prototype);
74168
- return Ml(y, v, s, a, c, 0, void 0), y;
74168
+ return Ml(_, v, s, a, c, 0, void 0), _;
74169
74169
  }
74170
74170
  function Pa(s) {
74171
74171
  s._state = "readable", s._reader = void 0, s._storedError = void 0, s._disturbed = false;
@@ -74177,7 +74177,7 @@ var Ld = z((Bo, jd) => {
74177
74177
  return s._reader !== void 0;
74178
74178
  }
74179
74179
  function Ot(s, a) {
74180
- if (s._disturbed = true, s._state === "closed") return f(void 0);
74180
+ if (s._disturbed = true, s._state === "closed") return d(void 0);
74181
74181
  if (s._state === "errored") return h(s._storedError);
74182
74182
  ns(s);
74183
74183
  let c = s._reader;
@@ -74187,16 +74187,16 @@ var Ld = z((Bo, jd) => {
74187
74187
  j._closeSteps(void 0);
74188
74188
  });
74189
74189
  }
74190
- let y = s._readableStreamController[Z](a);
74191
- return w(y, e);
74190
+ let _ = s._readableStreamController[Z](a);
74191
+ return w(_, e);
74192
74192
  }
74193
74193
  function ns(s) {
74194
74194
  s._state = "closed";
74195
74195
  let a = s._reader;
74196
74196
  if (a !== void 0 && (se(a), Y(a))) {
74197
74197
  let c = a._readRequests;
74198
- a._readRequests = new F(), c.forEach((y) => {
74199
- y._closeSteps();
74198
+ a._readRequests = new F(), c.forEach((_) => {
74199
+ _._closeSteps();
74200
74200
  });
74201
74201
  }
74202
74202
  }
@@ -74259,28 +74259,28 @@ var Ld = z((Bo, jd) => {
74259
74259
  }
74260
74260
  function Py(s, a) {
74261
74261
  ue(s, a);
74262
- let c = s?.cancel, y = s?.flush, v = s?.readableType, j = s?.start, U = s?.transform, K = s?.writableType;
74263
- return { cancel: c === void 0 ? void 0 : Ny(c, s, `${a} has member 'cancel' that`), flush: y === void 0 ? void 0 : xy(y, s, `${a} has member 'flush' that`), readableType: v, start: j === void 0 ? void 0 : By(j, s, `${a} has member 'start' that`), transform: U === void 0 ? void 0 : Iy(U, s, `${a} has member 'transform' that`), writableType: K };
74262
+ let c = s?.cancel, _ = s?.flush, v = s?.readableType, j = s?.start, U = s?.transform, K = s?.writableType;
74263
+ return { cancel: c === void 0 ? void 0 : Ny(c, s, `${a} has member 'cancel' that`), flush: _ === void 0 ? void 0 : xy(_, s, `${a} has member 'flush' that`), readableType: v, start: j === void 0 ? void 0 : By(j, s, `${a} has member 'start' that`), transform: U === void 0 ? void 0 : Iy(U, s, `${a} has member 'transform' that`), writableType: K };
74264
74264
  }
74265
74265
  function xy(s, a, c) {
74266
- return ge(s, c), (y) => E(s, a, [y]);
74266
+ return ge(s, c), (_) => E(s, a, [_]);
74267
74267
  }
74268
74268
  function By(s, a, c) {
74269
- return ge(s, c), (y) => T(s, a, [y]);
74269
+ return ge(s, c), (_) => T(s, a, [_]);
74270
74270
  }
74271
74271
  function Iy(s, a, c) {
74272
- return ge(s, c), (y, v) => E(s, a, [y, v]);
74272
+ return ge(s, c), (_, v) => E(s, a, [_, v]);
74273
74273
  }
74274
74274
  function Ny(s, a, c) {
74275
- return ge(s, c), (y) => E(s, a, [y]);
74275
+ return ge(s, c), (_) => E(s, a, [_]);
74276
74276
  }
74277
74277
  class so {
74278
- constructor(a = {}, c = {}, y = {}) {
74278
+ constructor(a = {}, c = {}, _ = {}) {
74279
74279
  a === void 0 && (a = null);
74280
- let v = Ws(c, "Second parameter"), j = Ws(y, "Third parameter"), U = Py(a, "First parameter");
74280
+ let v = Ws(c, "Second parameter"), j = Ws(_, "Third parameter"), U = Py(a, "First parameter");
74281
74281
  if (U.readableType !== void 0) throw new RangeError("Invalid readableType specified");
74282
74282
  if (U.writableType !== void 0) throw new RangeError("Invalid writableType specified");
74283
- let K = Qn(j, 0), ie = Gs(j), te = Qn(v, 1), ce = Gs(v), me, Re = d((Pt) => {
74283
+ let K = Qn(j, 0), ie = Gs(j), te = Qn(v, 1), ce = Gs(v), me, Re = f((Pt) => {
74284
74284
  me = Pt;
74285
74285
  });
74286
74286
  qy(this, Re, te, ce, K, ie), Ly(this, U), U.start !== void 0 ? me(U.start(this._transformStreamController)) : me(void 0);
@@ -74295,7 +74295,7 @@ var Ld = z((Bo, jd) => {
74295
74295
  }
74296
74296
  }
74297
74297
  Object.defineProperties(so.prototype, { readable: { enumerable: true }, writable: { enumerable: true } }), typeof Symbol.toStringTag == "symbol" && Object.defineProperty(so.prototype, Symbol.toStringTag, { value: "TransformStream", configurable: true });
74298
- function qy(s, a, c, y, v, j) {
74298
+ function qy(s, a, c, _, v, j) {
74299
74299
  function U() {
74300
74300
  return a;
74301
74301
  }
@@ -74308,7 +74308,7 @@ var Ld = z((Bo, jd) => {
74308
74308
  function te() {
74309
74309
  return Gy(s);
74310
74310
  }
74311
- s._writable = Mg(U, K, te, ie, c, y);
74311
+ s._writable = Mg(U, K, te, ie, c, _);
74312
74312
  function ce() {
74313
74313
  return Wy(s);
74314
74314
  }
@@ -74330,7 +74330,7 @@ var Ld = z((Bo, jd) => {
74330
74330
  s._backpressure && oo(s, false);
74331
74331
  }
74332
74332
  function oo(s, a) {
74333
- s._backpressureChangePromise !== void 0 && s._backpressureChangePromise_resolve(), s._backpressureChangePromise = d((c) => {
74333
+ s._backpressureChangePromise !== void 0 && s._backpressureChangePromise_resolve(), s._backpressureChangePromise = f((c) => {
74334
74334
  s._backpressureChangePromise_resolve = c;
74335
74335
  }), s._backpressure = a;
74336
74336
  }
@@ -74360,52 +74360,52 @@ var Ld = z((Bo, jd) => {
74360
74360
  function io(s) {
74361
74361
  return !t(s) || !Object.prototype.hasOwnProperty.call(s, "_controlledTransformStream") ? false : s instanceof Sr;
74362
74362
  }
74363
- function jy(s, a, c, y, v) {
74364
- a._controlledTransformStream = s, s._transformStreamController = a, a._transformAlgorithm = c, a._flushAlgorithm = y, a._cancelAlgorithm = v, a._finishPromise = void 0, a._finishPromise_resolve = void 0, a._finishPromise_reject = void 0;
74363
+ function jy(s, a, c, _, v) {
74364
+ a._controlledTransformStream = s, s._transformStreamController = a, a._transformAlgorithm = c, a._flushAlgorithm = _, a._cancelAlgorithm = v, a._finishPromise = void 0, a._finishPromise_resolve = void 0, a._finishPromise_reject = void 0;
74365
74365
  }
74366
74366
  function Ly(s, a) {
74367
- let c = Object.create(Sr.prototype), y, v, j;
74368
- a.transform !== void 0 ? y = (U) => a.transform(U, c) : y = (U) => {
74367
+ let c = Object.create(Sr.prototype), _, v, j;
74368
+ a.transform !== void 0 ? _ = (U) => a.transform(U, c) : _ = (U) => {
74369
74369
  try {
74370
- return Sf(c, U), f(void 0);
74370
+ return Sf(c, U), d(void 0);
74371
74371
  } catch (K) {
74372
74372
  return h(K);
74373
74373
  }
74374
- }, a.flush !== void 0 ? v = () => a.flush(c) : v = () => f(void 0), a.cancel !== void 0 ? j = (U) => a.cancel(U) : j = () => f(void 0), jy(s, c, y, v, j);
74374
+ }, a.flush !== void 0 ? v = () => a.flush(c) : v = () => d(void 0), a.cancel !== void 0 ? j = (U) => a.cancel(U) : j = () => d(void 0), jy(s, c, _, v, j);
74375
74375
  }
74376
74376
  function ao(s) {
74377
74377
  s._transformAlgorithm = void 0, s._flushAlgorithm = void 0, s._cancelAlgorithm = void 0;
74378
74378
  }
74379
74379
  function Sf(s, a) {
74380
- let c = s._controlledTransformStream, y = c._readable._readableStreamController;
74381
- if (!hn(y)) throw new TypeError("Readable side is not in a state that permits enqueue");
74380
+ let c = s._controlledTransformStream, _ = c._readable._readableStreamController;
74381
+ if (!hn(_)) throw new TypeError("Readable side is not in a state that permits enqueue");
74382
74382
  try {
74383
- dn(y, a);
74383
+ dn(_, a);
74384
74384
  } catch (j) {
74385
74385
  throw xa(c, j), c._readable._storedError;
74386
74386
  }
74387
- my(y) !== c._backpressure && oo(c, true);
74387
+ my(_) !== c._backpressure && oo(c, true);
74388
74388
  }
74389
74389
  function Uy(s, a) {
74390
74390
  Df(s._controlledTransformStream, a);
74391
74391
  }
74392
74392
  function Tf(s, a) {
74393
74393
  let c = s._transformAlgorithm(a);
74394
- return w(c, void 0, (y) => {
74395
- throw Df(s._controlledTransformStream, y), y;
74394
+ return w(c, void 0, (_) => {
74395
+ throw Df(s._controlledTransformStream, _), _;
74396
74396
  });
74397
74397
  }
74398
74398
  function My(s) {
74399
74399
  let a = s._controlledTransformStream, c = a._readable._readableStreamController;
74400
74400
  Gr(c);
74401
- let y = new TypeError("TransformStream terminated");
74402
- xa(a, y);
74401
+ let _ = new TypeError("TransformStream terminated");
74402
+ xa(a, _);
74403
74403
  }
74404
74404
  function $y(s, a) {
74405
74405
  let c = s._transformStreamController;
74406
74406
  if (s._backpressure) {
74407
- let y = s._backpressureChangePromise;
74408
- return w(y, () => {
74407
+ let _ = s._backpressureChangePromise;
74408
+ return w(_, () => {
74409
74409
  let v = s._writable;
74410
74410
  if (v._state === "erroring") throw v._storedError;
74411
74411
  return Tf(c, a);
@@ -74416,22 +74416,22 @@ var Ld = z((Bo, jd) => {
74416
74416
  function Hy(s, a) {
74417
74417
  let c = s._transformStreamController;
74418
74418
  if (c._finishPromise !== void 0) return c._finishPromise;
74419
- let y = s._readable;
74420
- c._finishPromise = d((j, U) => {
74419
+ let _ = s._readable;
74420
+ c._finishPromise = f((j, U) => {
74421
74421
  c._finishPromise_resolve = j, c._finishPromise_reject = U;
74422
74422
  });
74423
74423
  let v = c._cancelAlgorithm(a);
74424
- return ao(c), A(v, () => (y._state === "errored" ? pn(c, y._storedError) : (Ft(y._readableStreamController, a), Ia(c)), null), (j) => (Ft(y._readableStreamController, j), pn(c, j), null)), c._finishPromise;
74424
+ return ao(c), A(v, () => (_._state === "errored" ? pn(c, _._storedError) : (Ft(_._readableStreamController, a), Ia(c)), null), (j) => (Ft(_._readableStreamController, j), pn(c, j), null)), c._finishPromise;
74425
74425
  }
74426
74426
  function Gy(s) {
74427
74427
  let a = s._transformStreamController;
74428
74428
  if (a._finishPromise !== void 0) return a._finishPromise;
74429
74429
  let c = s._readable;
74430
- a._finishPromise = d((v, j) => {
74430
+ a._finishPromise = f((v, j) => {
74431
74431
  a._finishPromise_resolve = v, a._finishPromise_reject = j;
74432
74432
  });
74433
- let y = a._flushAlgorithm();
74434
- return ao(a), A(y, () => (c._state === "errored" ? pn(a, c._storedError) : (Gr(c._readableStreamController), Ia(a)), null), (v) => (Ft(c._readableStreamController, v), pn(a, v), null)), a._finishPromise;
74433
+ let _ = a._flushAlgorithm();
74434
+ return ao(a), A(_, () => (c._state === "errored" ? pn(a, c._storedError) : (Gr(c._readableStreamController), Ia(a)), null), (v) => (Ft(c._readableStreamController, v), pn(a, v), null)), a._finishPromise;
74435
74435
  }
74436
74436
  function Wy(s) {
74437
74437
  return oo(s, false), s._backpressureChangePromise;
@@ -74439,12 +74439,12 @@ var Ld = z((Bo, jd) => {
74439
74439
  function Jy(s, a) {
74440
74440
  let c = s._transformStreamController;
74441
74441
  if (c._finishPromise !== void 0) return c._finishPromise;
74442
- let y = s._writable;
74443
- c._finishPromise = d((j, U) => {
74442
+ let _ = s._writable;
74443
+ c._finishPromise = f((j, U) => {
74444
74444
  c._finishPromise_resolve = j, c._finishPromise_reject = U;
74445
74445
  });
74446
74446
  let v = c._cancelAlgorithm(a);
74447
- return ao(c), A(v, () => (y._state === "errored" ? pn(c, y._storedError) : (Zn(y._writableStreamController, a), Ba(s), Ia(c)), null), (j) => (Zn(y._writableStreamController, j), Ba(s), pn(c, j), null)), c._finishPromise;
74447
+ return ao(c), A(v, () => (_._state === "errored" ? pn(c, _._storedError) : (Zn(_._writableStreamController, a), Ba(s), Ia(c)), null), (j) => (Zn(_._writableStreamController, j), Ba(s), pn(c, j), null)), c._finishPromise;
74448
74448
  }
74449
74449
  function uo(s) {
74450
74450
  return new TypeError(`TransformStreamDefaultController.prototype.${s} can only be used on a TransformStreamDefaultController`);
@@ -74555,18 +74555,18 @@ var us = Me(() => {
74555
74555
  } });
74556
74556
  }
74557
74557
  slice(e = 0, t = this.size, n = "") {
74558
- let { size: o } = this, i = e < 0 ? Math.max(o + e, 0) : Math.min(e, o), u = t < 0 ? Math.max(o + t, 0) : Math.min(t, o), l = Math.max(u - i, 0), d = this.#e, f = [], h = 0;
74559
- for (let A of d) {
74558
+ let { size: o } = this, i = e < 0 ? Math.max(o + e, 0) : Math.min(e, o), u = t < 0 ? Math.max(o + t, 0) : Math.min(t, o), l = Math.max(u - i, 0), f = this.#e, d = [], h = 0;
74559
+ for (let A of f) {
74560
74560
  if (h >= l) break;
74561
74561
  let P = ArrayBuffer.isView(A) ? A.byteLength : A.size;
74562
74562
  if (i && P <= i) i -= P, u -= P;
74563
74563
  else {
74564
74564
  let b;
74565
- ArrayBuffer.isView(A) ? (b = A.subarray(i, Math.min(P, u)), h += b.byteLength) : (b = A.slice(i, Math.min(P, u)), h += b.size), u -= P, f.push(b), i = 0;
74565
+ ArrayBuffer.isView(A) ? (b = A.subarray(i, Math.min(P, u)), h += b.byteLength) : (b = A.slice(i, Math.min(P, u)), h += b.size), u -= P, d.push(b), i = 0;
74566
74566
  }
74567
74567
  }
74568
- let _ = new uu([], { type: String(n).toLowerCase() });
74569
- return _.#r = l, _.#e = f, _;
74568
+ let g = new uu([], { type: String(n).toLowerCase() });
74569
+ return g.#r = l, g.#e = d, g;
74570
74570
  }
74571
74571
  get [Symbol.toStringTag]() {
74572
74572
  return "Blob";
@@ -74778,31 +74778,31 @@ async function N_(r, e) {
74778
74778
  if (!/multipart/i.test(e)) throw new TypeError("Failed to fetch");
74779
74779
  let t = e.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
74780
74780
  if (!t) throw new TypeError("no or bad content-type header, no multipart boundary");
74781
- let n = new mu(t[1] || t[2]), o, i, u, l, d, f, h = [], _ = new kr(), A = (g) => {
74782
- u += p.decode(g, { stream: true });
74783
- }, P = (g) => {
74784
- h.push(g);
74781
+ let n = new mu(t[1] || t[2]), o, i, u, l, f, d, h = [], g = new kr(), A = (y) => {
74782
+ u += p.decode(y, { stream: true });
74783
+ }, P = (y) => {
74784
+ h.push(y);
74785
74785
  }, b = () => {
74786
- let g = new Rr(h, f, { type: d });
74787
- _.append(l, g);
74786
+ let y = new Rr(h, d, { type: f });
74787
+ g.append(l, y);
74788
74788
  }, w = () => {
74789
- _.append(l, u);
74789
+ g.append(l, u);
74790
74790
  }, p = new TextDecoder("utf-8");
74791
74791
  p.decode(), n.onPartBegin = function() {
74792
- n.onPartData = A, n.onPartEnd = w, o = "", i = "", u = "", l = "", d = "", f = null, h.length = 0;
74793
- }, n.onHeaderField = function(g) {
74794
- o += p.decode(g, { stream: true });
74795
- }, n.onHeaderValue = function(g) {
74796
- i += p.decode(g, { stream: true });
74792
+ n.onPartData = A, n.onPartEnd = w, o = "", i = "", u = "", l = "", f = "", d = null, h.length = 0;
74793
+ }, n.onHeaderField = function(y) {
74794
+ o += p.decode(y, { stream: true });
74795
+ }, n.onHeaderValue = function(y) {
74796
+ i += p.decode(y, { stream: true });
74797
74797
  }, n.onHeaderEnd = function() {
74798
74798
  if (i += p.decode(), o = o.toLowerCase(), o === "content-disposition") {
74799
- let g = i.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
74800
- g && (l = g[2] || g[3] || ""), f = I_(i), f && (n.onPartData = P, n.onPartEnd = b);
74801
- } else o === "content-type" && (d = i);
74799
+ let y = i.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
74800
+ y && (l = y[2] || y[3] || ""), d = I_(i), d && (n.onPartData = P, n.onPartEnd = b);
74801
+ } else o === "content-type" && (f = i);
74802
74802
  i = "", o = "";
74803
74803
  };
74804
- for await (let g of r) n.write(g);
74805
- return n.end(), _;
74804
+ for await (let y of r) n.write(y);
74805
+ return n.end(), g;
74806
74806
  }
74807
74807
  var zt;
74808
74808
  var Oe;
@@ -74831,9 +74831,9 @@ var ah = Me(() => {
74831
74831
  this.boundary = t, this.lookbehind = new Uint8Array(this.boundary.length + 8), this.state = Oe.START_BOUNDARY;
74832
74832
  }
74833
74833
  write(e) {
74834
- let t = 0, n = e.length, o = this.index, { lookbehind: i, boundary: u, boundaryChars: l, index: d, state: f, flags: h } = this, _ = this.boundary.length, A = _ - 1, P = e.length, b, w, p = (S) => {
74834
+ let t = 0, n = e.length, o = this.index, { lookbehind: i, boundary: u, boundaryChars: l, index: f, state: d, flags: h } = this, g = this.boundary.length, A = g - 1, P = e.length, b, w, p = (S) => {
74835
74835
  this[S + "Mark"] = t;
74836
- }, g = (S) => {
74836
+ }, y = (S) => {
74837
74837
  delete this[S + "Mark"];
74838
74838
  }, T = (S, F, B, G) => {
74839
74839
  (F === void 0 || F !== B) && this[S](G && G.subarray(F, B));
@@ -74841,66 +74841,66 @@ var ah = Me(() => {
74841
74841
  let B = S + "Mark";
74842
74842
  B in this && (F ? (T(S, this[B], t, e), delete this[B]) : (T(S, this[B], e.length, e), this[B] = 0));
74843
74843
  };
74844
- for (t = 0; t < n; t++) switch (b = e[t], f) {
74844
+ for (t = 0; t < n; t++) switch (b = e[t], d) {
74845
74845
  case Oe.START_BOUNDARY:
74846
- if (d === u.length - 2) {
74846
+ if (f === u.length - 2) {
74847
74847
  if (b === fs3) h |= Fr.LAST_BOUNDARY;
74848
74848
  else if (b !== Mo) return;
74849
- d++;
74849
+ f++;
74850
74850
  break;
74851
- } else if (d - 1 === u.length - 2) {
74852
- if (h & Fr.LAST_BOUNDARY && b === fs3) f = Oe.END, h = 0;
74853
- else if (!(h & Fr.LAST_BOUNDARY) && b === Uo) d = 0, T("onPartBegin"), f = Oe.HEADER_FIELD_START;
74851
+ } else if (f - 1 === u.length - 2) {
74852
+ if (h & Fr.LAST_BOUNDARY && b === fs3) d = Oe.END, h = 0;
74853
+ else if (!(h & Fr.LAST_BOUNDARY) && b === Uo) f = 0, T("onPartBegin"), d = Oe.HEADER_FIELD_START;
74854
74854
  else return;
74855
74855
  break;
74856
74856
  }
74857
- b !== u[d + 2] && (d = -2), b === u[d + 2] && d++;
74857
+ b !== u[f + 2] && (f = -2), b === u[f + 2] && f++;
74858
74858
  break;
74859
74859
  case Oe.HEADER_FIELD_START:
74860
- f = Oe.HEADER_FIELD, p("onHeaderField"), d = 0;
74860
+ d = Oe.HEADER_FIELD, p("onHeaderField"), f = 0;
74861
74861
  case Oe.HEADER_FIELD:
74862
74862
  if (b === Mo) {
74863
- g("onHeaderField"), f = Oe.HEADERS_ALMOST_DONE;
74863
+ y("onHeaderField"), d = Oe.HEADERS_ALMOST_DONE;
74864
74864
  break;
74865
74865
  }
74866
- if (d++, b === fs3) break;
74866
+ if (f++, b === fs3) break;
74867
74867
  if (b === O_) {
74868
- if (d === 1) return;
74869
- E("onHeaderField", true), f = Oe.HEADER_VALUE_START;
74868
+ if (f === 1) return;
74869
+ E("onHeaderField", true), d = Oe.HEADER_VALUE_START;
74870
74870
  break;
74871
74871
  }
74872
74872
  if (w = B_(b), w < P_ || w > x_) return;
74873
74873
  break;
74874
74874
  case Oe.HEADER_VALUE_START:
74875
74875
  if (b === F_) break;
74876
- p("onHeaderValue"), f = Oe.HEADER_VALUE;
74876
+ p("onHeaderValue"), d = Oe.HEADER_VALUE;
74877
74877
  case Oe.HEADER_VALUE:
74878
- b === Mo && (E("onHeaderValue", true), T("onHeaderEnd"), f = Oe.HEADER_VALUE_ALMOST_DONE);
74878
+ b === Mo && (E("onHeaderValue", true), T("onHeaderEnd"), d = Oe.HEADER_VALUE_ALMOST_DONE);
74879
74879
  break;
74880
74880
  case Oe.HEADER_VALUE_ALMOST_DONE:
74881
74881
  if (b !== Uo) return;
74882
- f = Oe.HEADER_FIELD_START;
74882
+ d = Oe.HEADER_FIELD_START;
74883
74883
  break;
74884
74884
  case Oe.HEADERS_ALMOST_DONE:
74885
74885
  if (b !== Uo) return;
74886
- T("onHeadersEnd"), f = Oe.PART_DATA_START;
74886
+ T("onHeadersEnd"), d = Oe.PART_DATA_START;
74887
74887
  break;
74888
74888
  case Oe.PART_DATA_START:
74889
- f = Oe.PART_DATA, p("onPartData");
74889
+ d = Oe.PART_DATA, p("onPartData");
74890
74890
  case Oe.PART_DATA:
74891
- if (o = d, d === 0) {
74892
- for (t += A; t < P && !(e[t] in l); ) t += _;
74891
+ if (o = f, f === 0) {
74892
+ for (t += A; t < P && !(e[t] in l); ) t += g;
74893
74893
  t -= A, b = e[t];
74894
74894
  }
74895
- if (d < u.length) u[d] === b ? (d === 0 && E("onPartData", true), d++) : d = 0;
74896
- else if (d === u.length) d++, b === Mo ? h |= Fr.PART_BOUNDARY : b === fs3 ? h |= Fr.LAST_BOUNDARY : d = 0;
74897
- else if (d - 1 === u.length) if (h & Fr.PART_BOUNDARY) {
74898
- if (d = 0, b === Uo) {
74899
- h &= ~Fr.PART_BOUNDARY, T("onPartEnd"), T("onPartBegin"), f = Oe.HEADER_FIELD_START;
74895
+ if (f < u.length) u[f] === b ? (f === 0 && E("onPartData", true), f++) : f = 0;
74896
+ else if (f === u.length) f++, b === Mo ? h |= Fr.PART_BOUNDARY : b === fs3 ? h |= Fr.LAST_BOUNDARY : f = 0;
74897
+ else if (f - 1 === u.length) if (h & Fr.PART_BOUNDARY) {
74898
+ if (f = 0, b === Uo) {
74899
+ h &= ~Fr.PART_BOUNDARY, T("onPartEnd"), T("onPartBegin"), d = Oe.HEADER_FIELD_START;
74900
74900
  break;
74901
74901
  }
74902
- } else h & Fr.LAST_BOUNDARY && b === fs3 ? (T("onPartEnd"), f = Oe.END, h = 0) : d = 0;
74903
- if (d > 0) i[d - 1] = b;
74902
+ } else h & Fr.LAST_BOUNDARY && b === fs3 ? (T("onPartEnd"), d = Oe.END, h = 0) : f = 0;
74903
+ if (f > 0) i[f - 1] = b;
74904
74904
  else if (o > 0) {
74905
74905
  let S = new Uint8Array(i.buffer, i.byteOffset, i.byteLength);
74906
74906
  T("onPartData", 0, o, S), o = 0, p("onPartData"), t--;
@@ -74909,9 +74909,9 @@ var ah = Me(() => {
74909
74909
  case Oe.END:
74910
74910
  break;
74911
74911
  default:
74912
- throw new Error(`Unexpected state entered: ${f}`);
74912
+ throw new Error(`Unexpected state entered: ${d}`);
74913
74913
  }
74914
- E("onHeaderField"), E("onHeaderValue"), E("onPartData"), this.index = d, this.state = f, this.flags = h;
74914
+ E("onHeaderField"), E("onHeaderValue"), E("onPartData"), this.index = f, this.state = d, this.flags = h;
74915
74915
  }
74916
74916
  end() {
74917
74917
  if (this.state === Oe.HEADER_FIELD_START && this.index === 0 || this.state === Oe.PART_DATA && this.index === this.boundary.length) this.onPartEnd();
@@ -75264,18 +75264,18 @@ var Dh = Me(() => {
75264
75264
  super(i, { size: t.size || e.size || 0 });
75265
75265
  let u = new at(t.headers || e.headers || {});
75266
75266
  if (i !== null && !u.has("Content-Type")) {
75267
- let f = $o(i, this);
75268
- f && u.set("Content-Type", f);
75267
+ let d = $o(i, this);
75268
+ d && u.set("Content-Type", d);
75269
75269
  }
75270
75270
  let l = hs(e) ? e.signal : null;
75271
75271
  if ("signal" in t && (l = t.signal), l != null && !Jd(l)) throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");
75272
- let d = t.referrer == null ? e.referrer : t.referrer;
75273
- if (d === "") d = "no-referrer";
75274
- else if (d) {
75275
- let f = new URL(d);
75276
- d = /^about:(\/\/)?client$/.test(f) ? "client" : f;
75277
- } else d = void 0;
75278
- this[We] = { method: o, redirect: t.redirect || e.redirect || "follow", headers: u, parsedURL: n, signal: l, referrer: d }, this.follow = t.follow === void 0 ? e.follow === void 0 ? 20 : e.follow : t.follow, this.compress = t.compress === void 0 ? e.compress === void 0 ? true : e.compress : t.compress, this.counter = t.counter || e.counter || 0, this.agent = t.agent || e.agent, this.highWaterMark = t.highWaterMark || e.highWaterMark || 16384, this.insecureHTTPParser = t.insecureHTTPParser || e.insecureHTTPParser || false, this.referrerPolicy = t.referrerPolicy || e.referrerPolicy || "";
75272
+ let f = t.referrer == null ? e.referrer : t.referrer;
75273
+ if (f === "") f = "no-referrer";
75274
+ else if (f) {
75275
+ let d = new URL(f);
75276
+ f = /^about:(\/\/)?client$/.test(d) ? "client" : d;
75277
+ } else f = void 0;
75278
+ this[We] = { method: o, redirect: t.redirect || e.redirect || "follow", headers: u, parsedURL: n, signal: l, referrer: f }, this.follow = t.follow === void 0 ? e.follow === void 0 ? 20 : e.follow : t.follow, this.compress = t.compress === void 0 ? e.compress === void 0 ? true : e.compress : t.compress, this.counter = t.counter || e.counter || 0, this.agent = t.agent || e.agent, this.highWaterMark = t.highWaterMark || e.highWaterMark || 16384, this.insecureHTTPParser = t.insecureHTTPParser || e.insecureHTTPParser || false, this.referrerPolicy = t.referrerPolicy || e.referrerPolicy || "";
75279
75279
  }
75280
75280
  get method() {
75281
75281
  return this[We].method;
@@ -75346,33 +75346,33 @@ async function Eu(r, e) {
75346
75346
  t(w);
75347
75347
  return;
75348
75348
  }
75349
- let l = (i.protocol === "https:" ? import_node_https.default : import_node_http2.default).request, { signal: d } = o, f = null, h = () => {
75349
+ let l = (i.protocol === "https:" ? import_node_https.default : import_node_http2.default).request, { signal: f } = o, d = null, h = () => {
75350
75350
  let b = new ps("The operation was aborted.");
75351
- n(b), o.body && o.body instanceof import_node_stream2.default.Readable && o.body.destroy(b), !(!f || !f.body) && f.body.emit("error", b);
75351
+ n(b), o.body && o.body instanceof import_node_stream2.default.Readable && o.body.destroy(b), !(!d || !d.body) && d.body.emit("error", b);
75352
75352
  };
75353
- if (d && d.aborted) {
75353
+ if (f && f.aborted) {
75354
75354
  h();
75355
75355
  return;
75356
75356
  }
75357
- let _ = () => {
75357
+ let g = () => {
75358
75358
  h(), P();
75359
75359
  }, A = l(i.toString(), u);
75360
- d && d.addEventListener("abort", _);
75360
+ f && f.addEventListener("abort", g);
75361
75361
  let P = () => {
75362
- A.abort(), d && d.removeEventListener("abort", _);
75362
+ A.abort(), f && f.removeEventListener("abort", g);
75363
75363
  };
75364
75364
  A.on("error", (b) => {
75365
75365
  n(new et(`request to ${o.url} failed, reason: ${b.message}`, "system", b)), P();
75366
75366
  }), K_(A, (b) => {
75367
- f && f.body && f.body.destroy(b);
75367
+ d && d.body && d.body.destroy(b);
75368
75368
  }), process.version < "v14" && A.on("socket", (b) => {
75369
75369
  let w;
75370
75370
  b.prependListener("end", () => {
75371
75371
  w = b._eventsCount;
75372
75372
  }), b.prependListener("close", (p) => {
75373
- if (f && w < b._eventsCount && !p) {
75374
- let g = new Error("Premature close");
75375
- g.code = "ERR_STREAM_PREMATURE_CLOSE", f.body.emit("error", g);
75373
+ if (d && w < b._eventsCount && !p) {
75374
+ let y = new Error("Premature close");
75375
+ y.code = "ERR_STREAM_PREMATURE_CLOSE", d.body.emit("error", y);
75376
75376
  }
75377
75377
  });
75378
75378
  }), A.on("response", (b) => {
@@ -75415,23 +75415,23 @@ async function Eu(r, e) {
75415
75415
  return n(new TypeError(`Redirect option '${o.redirect}' is not a valid value of RequestRedirect`));
75416
75416
  }
75417
75417
  }
75418
- d && b.once("end", () => {
75419
- d.removeEventListener("abort", _);
75418
+ f && b.once("end", () => {
75419
+ f.removeEventListener("abort", g);
75420
75420
  });
75421
75421
  let p = (0, import_node_stream2.pipeline)(b, new import_node_stream2.PassThrough(), (S) => {
75422
75422
  S && n(S);
75423
75423
  });
75424
- process.version < "v12.10" && b.on("aborted", _);
75425
- let g = { url: o.url, status: b.statusCode, statusText: b.statusMessage, headers: w, size: o.size, counter: o.counter, highWaterMark: o.highWaterMark }, T = w.get("Content-Encoding");
75424
+ process.version < "v12.10" && b.on("aborted", g);
75425
+ let y = { url: o.url, status: b.statusCode, statusText: b.statusMessage, headers: w, size: o.size, counter: o.counter, highWaterMark: o.highWaterMark }, T = w.get("Content-Encoding");
75426
75426
  if (!o.compress || o.method === "HEAD" || T === null || b.statusCode === 204 || b.statusCode === 304) {
75427
- f = new dt(p, g), t(f);
75427
+ d = new dt(p, y), t(d);
75428
75428
  return;
75429
75429
  }
75430
75430
  let E = { flush: import_node_zlib.default.Z_SYNC_FLUSH, finishFlush: import_node_zlib.default.Z_SYNC_FLUSH };
75431
75431
  if (T === "gzip" || T === "x-gzip") {
75432
75432
  p = (0, import_node_stream2.pipeline)(p, import_node_zlib.default.createGunzip(E), (S) => {
75433
75433
  S && n(S);
75434
- }), f = new dt(p, g), t(f);
75434
+ }), d = new dt(p, y), t(d);
75435
75435
  return;
75436
75436
  }
75437
75437
  if (T === "deflate" || T === "x-deflate") {
@@ -75443,19 +75443,19 @@ async function Eu(r, e) {
75443
75443
  B && n(B);
75444
75444
  }) : p = (0, import_node_stream2.pipeline)(p, import_node_zlib.default.createInflateRaw(), (B) => {
75445
75445
  B && n(B);
75446
- }), f = new dt(p, g), t(f);
75446
+ }), d = new dt(p, y), t(d);
75447
75447
  }), S.once("end", () => {
75448
- f || (f = new dt(p, g), t(f));
75448
+ d || (d = new dt(p, y), t(d));
75449
75449
  });
75450
75450
  return;
75451
75451
  }
75452
75452
  if (T === "br") {
75453
75453
  p = (0, import_node_stream2.pipeline)(p, import_node_zlib.default.createBrotliDecompress(), (S) => {
75454
75454
  S && n(S);
75455
- }), f = new dt(p, g), t(f);
75455
+ }), d = new dt(p, y), t(d);
75456
75456
  return;
75457
75457
  }
75458
- f = new dt(p, g), t(f);
75458
+ d = new dt(p, y), t(d);
75459
75459
  }), fh(A, o).catch(n);
75460
75460
  });
75461
75461
  }
@@ -75469,14 +75469,14 @@ function K_(r, e) {
75469
75469
  }), r.on("socket", (u) => {
75470
75470
  let l = () => {
75471
75471
  if (n && !o) {
75472
- let f = new Error("Premature close");
75473
- f.code = "ERR_STREAM_PREMATURE_CLOSE", e(f);
75472
+ let d = new Error("Premature close");
75473
+ d.code = "ERR_STREAM_PREMATURE_CLOSE", e(d);
75474
75474
  }
75475
- }, d = (f) => {
75476
- o = import_node_buffer2.Buffer.compare(f.slice(-5), t) === 0, !o && i && (o = import_node_buffer2.Buffer.compare(i.slice(-3), t.slice(0, 3)) === 0 && import_node_buffer2.Buffer.compare(f.slice(-2), t.slice(3)) === 0), i = f;
75475
+ }, f = (d) => {
75476
+ o = import_node_buffer2.Buffer.compare(d.slice(-5), t) === 0, !o && i && (o = import_node_buffer2.Buffer.compare(i.slice(-3), t.slice(0, 3)) === 0 && import_node_buffer2.Buffer.compare(d.slice(-2), t.slice(3)) === 0), i = d;
75477
75477
  };
75478
- u.prependListener("close", l), u.on("data", d), r.on("close", () => {
75479
- u.removeListener("close", l), u.removeListener("data", d);
75478
+ u.prependListener("close", l), u.on("data", f), r.on("close", () => {
75479
+ u.removeListener("close", l), u.removeListener("data", f);
75480
75480
  });
75481
75481
  });
75482
75482
  }
@@ -75597,7 +75597,7 @@ var Ph = z((Fn) => {
75597
75597
  n.url = n.url + l + u;
75598
75598
  } else {
75599
75599
  let u = n.url instanceof URL ? n.url : new URL(n.url);
75600
- for (let [l, d] of new URLSearchParams(n.params)) u.searchParams.append(l, d);
75600
+ for (let [l, f] of new URLSearchParams(n.params)) u.searchParams.append(l, f);
75601
75601
  n.url = u;
75602
75602
  }
75603
75603
  typeof e.maxContentLength == "number" && (n.size = e.maxContentLength), typeof e.maxRedirects == "number" && (n.follow = e.maxRedirects);
@@ -75700,7 +75700,7 @@ var ze = z((tt) => {
75700
75700
  var wu = z((Bh, Ko) => {
75701
75701
  (function(r) {
75702
75702
  "use strict";
75703
- var e, t = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, n = Math.ceil, o = Math.floor, i = "[BigNumber Error] ", u = i + "Number primitive has more than 15 significant digits: ", l = 1e14, d = 14, f = 9007199254740991, h = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], _ = 1e7, A = 1e9;
75703
+ var e, t = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, n = Math.ceil, o = Math.floor, i = "[BigNumber Error] ", u = i + "Number primitive has more than 15 significant digits: ", l = 1e14, f = 14, d = 9007199254740991, h = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], g = 1e7, A = 1e9;
75704
75704
  function P(F) {
75705
75705
  var B, G, Z, H = W.prototype = { constructor: W, toString: null, valueOf: null }, ae = new W(1), de = 20, fe = 4, Ee = -7, Ce = 21, Ae = -1e7, oe = 1e7, he = false, J = 1, V = 0, se = { prefix: "", groupSize: 3, secondaryGroupSize: 0, groupSeparator: ",", decimalSeparator: ".", fractionGroupSize: 0, fractionGroupSeparator: "\xA0", suffix: "" }, Ue = "0123456789abcdefghijklmnopqrstuvwxyz", ve = true;
75706
75706
  function W(m, C) {
@@ -75724,7 +75724,7 @@ var wu = z((Bh, Ko) => {
75724
75724
  }
75725
75725
  (x = q.indexOf(".")) > -1 && (q = q.replace(".", "")), (L = q.search(/e/i)) > 0 ? (x < 0 && (x = L), x += +q.slice(L + 1), q = q.substring(0, L)) : x < 0 && (x = q.length);
75726
75726
  } else {
75727
- if (g(C, 2, Ue.length, "Base"), C == 10 && ve) return I = new W(m), ke(I, de + I.e + 1, fe);
75727
+ if (y(C, 2, Ue.length, "Base"), C == 10 && ve) return I = new W(m), ke(I, de + I.e + 1, fe);
75728
75728
  if (q = String(m), R = typeof m == "number") {
75729
75729
  if (m * 0 != 0) return Z(I, q, R, C);
75730
75730
  if (I.s = 1 / m < 0 ? (q = q.slice(1), -1) : 1, W.DEBUG && q.replace(/^0\.0*|\./, "").length > 15) throw Error(u + m);
@@ -75746,13 +75746,13 @@ var wu = z((Bh, Ko) => {
75746
75746
  for (L = 0; q.charCodeAt(L) === 48; L++) ;
75747
75747
  for (O = q.length; q.charCodeAt(--O) === 48; ) ;
75748
75748
  if (q = q.slice(L, ++O)) {
75749
- if (O -= L, R && W.DEBUG && O > 15 && (m > f || m !== o(m))) throw Error(u + I.s * m);
75749
+ if (O -= L, R && W.DEBUG && O > 15 && (m > d || m !== o(m))) throw Error(u + I.s * m);
75750
75750
  if ((x = x - L - 1) > oe) I.c = I.e = null;
75751
75751
  else if (x < Ae) I.c = [I.e = 0];
75752
75752
  else {
75753
- if (I.e = x, I.c = [], L = (x + 1) % d, x < 0 && (L += d), L < O) {
75754
- for (L && I.c.push(+q.slice(0, L)), O -= d; L < O; ) I.c.push(+q.slice(L, L += d));
75755
- L = d - (q = q.slice(L)).length;
75753
+ if (I.e = x, I.c = [], L = (x + 1) % f, x < 0 && (L += f), L < O) {
75754
+ for (L && I.c.push(+q.slice(0, L)), O -= f; L < O; ) I.c.push(+q.slice(L, L += f));
75755
+ L = f - (q = q.slice(L)).length;
75756
75756
  } else L -= O;
75757
75757
  for (; L--; q += "0") ;
75758
75758
  I.c.push(+q);
@@ -75762,14 +75762,14 @@ var wu = z((Bh, Ko) => {
75762
75762
  W.clone = P, W.ROUND_UP = 0, W.ROUND_DOWN = 1, W.ROUND_CEIL = 2, W.ROUND_FLOOR = 3, W.ROUND_HALF_UP = 4, W.ROUND_HALF_DOWN = 5, W.ROUND_HALF_EVEN = 6, W.ROUND_HALF_CEIL = 7, W.ROUND_HALF_FLOOR = 8, W.EUCLID = 9, W.config = W.set = function(m) {
75763
75763
  var C, D;
75764
75764
  if (m != null) if (typeof m == "object") {
75765
- if (m.hasOwnProperty(C = "DECIMAL_PLACES") && (D = m[C], g(D, 0, A, C), de = D), m.hasOwnProperty(C = "ROUNDING_MODE") && (D = m[C], g(D, 0, 8, C), fe = D), m.hasOwnProperty(C = "EXPONENTIAL_AT") && (D = m[C], D && D.pop ? (g(D[0], -A, 0, C), g(D[1], 0, A, C), Ee = D[0], Ce = D[1]) : (g(D, -A, A, C), Ee = -(Ce = D < 0 ? -D : D))), m.hasOwnProperty(C = "RANGE")) if (D = m[C], D && D.pop) g(D[0], -A, -1, C), g(D[1], 1, A, C), Ae = D[0], oe = D[1];
75766
- else if (g(D, -A, A, C), D) Ae = -(oe = D < 0 ? -D : D);
75765
+ if (m.hasOwnProperty(C = "DECIMAL_PLACES") && (D = m[C], y(D, 0, A, C), de = D), m.hasOwnProperty(C = "ROUNDING_MODE") && (D = m[C], y(D, 0, 8, C), fe = D), m.hasOwnProperty(C = "EXPONENTIAL_AT") && (D = m[C], D && D.pop ? (y(D[0], -A, 0, C), y(D[1], 0, A, C), Ee = D[0], Ce = D[1]) : (y(D, -A, A, C), Ee = -(Ce = D < 0 ? -D : D))), m.hasOwnProperty(C = "RANGE")) if (D = m[C], D && D.pop) y(D[0], -A, -1, C), y(D[1], 1, A, C), Ae = D[0], oe = D[1];
75766
+ else if (y(D, -A, A, C), D) Ae = -(oe = D < 0 ? -D : D);
75767
75767
  else throw Error(i + C + " cannot be zero: " + D);
75768
75768
  if (m.hasOwnProperty(C = "CRYPTO")) if (D = m[C], D === !!D) if (D) if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes)) he = D;
75769
75769
  else throw he = !D, Error(i + "crypto unavailable");
75770
75770
  else he = D;
75771
75771
  else throw Error(i + C + " not true or false: " + D);
75772
- if (m.hasOwnProperty(C = "MODULO_MODE") && (D = m[C], g(D, 0, 9, C), J = D), m.hasOwnProperty(C = "POW_PRECISION") && (D = m[C], g(D, 0, A, C), V = D), m.hasOwnProperty(C = "FORMAT")) if (D = m[C], typeof D == "object") se = D;
75772
+ if (m.hasOwnProperty(C = "MODULO_MODE") && (D = m[C], y(D, 0, 9, C), J = D), m.hasOwnProperty(C = "POW_PRECISION") && (D = m[C], y(D, 0, A, C), V = D), m.hasOwnProperty(C = "FORMAT")) if (D = m[C], typeof D == "object") se = D;
75773
75773
  else throw Error(i + C + " not an object: " + D);
75774
75774
  if (m.hasOwnProperty(C = "ALPHABET")) if (D = m[C], typeof D == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(D)) ve = D.slice(0, 10) == "0123456789", Ue = D;
75775
75775
  else throw Error(i + C + " invalid: " + D);
@@ -75785,7 +75785,7 @@ var wu = z((Bh, Ko) => {
75785
75785
  if (k === 0 && N.length === 1) return true;
75786
75786
  break e;
75787
75787
  }
75788
- if (C = (k + 1) % d, C < 1 && (C += d), String(N[0]).length == C) {
75788
+ if (C = (k + 1) % f, C < 1 && (C += f), String(N[0]).length == C) {
75789
75789
  for (C = 0; C < N.length; C++) if (D = N[C], D < 0 || D >= l || D !== o(D)) break e;
75790
75790
  if (D !== 0) return true;
75791
75791
  }
@@ -75804,7 +75804,7 @@ var wu = z((Bh, Ko) => {
75804
75804
  };
75805
75805
  return function(D) {
75806
75806
  var N, k, x, L, R, O = 0, q = [], I = new W(ae);
75807
- if (D == null ? D = de : g(D, 0, A), L = n(D / d), he) if (crypto.getRandomValues) {
75807
+ if (D == null ? D = de : y(D, 0, A), L = n(D / f), he) if (crypto.getRandomValues) {
75808
75808
  for (N = crypto.getRandomValues(new Uint32Array(L *= 2)); O < L; ) R = N[O] * 131072 + (N[O + 1] >>> 11), R >= 9e15 ? (k = crypto.getRandomValues(new Uint32Array(2)), N[O] = k[0], N[O + 1] = k[1]) : (q.push(R % 1e14), O += 2);
75809
75809
  O = L / 2;
75810
75810
  } else if (crypto.randomBytes) {
@@ -75812,12 +75812,12 @@ var wu = z((Bh, Ko) => {
75812
75812
  O = L / 7;
75813
75813
  } else throw he = false, Error(i + "crypto unavailable");
75814
75814
  if (!he) for (; O < L; ) R = C(), R < 9e15 && (q[O++] = R % 1e14);
75815
- for (L = q[--O], D %= d, L && D && (R = h[d - D], q[O] = o(L / R) * R); q[O] === 0; q.pop(), O--) ;
75815
+ for (L = q[--O], D %= f, L && D && (R = h[f - D], q[O] = o(L / R) * R); q[O] === 0; q.pop(), O--) ;
75816
75816
  if (O < 0) q = [x = 0];
75817
75817
  else {
75818
- for (x = -1; q[0] === 0; q.splice(0, 1), x -= d) ;
75818
+ for (x = -1; q[0] === 0; q.splice(0, 1), x -= f) ;
75819
75819
  for (O = 1, R = q[0]; R >= 10; R /= 10, O++) ;
75820
- O < d && (x -= d - O);
75820
+ O < f && (x -= f - O);
75821
75821
  }
75822
75822
  return I.e = x, I.c = q, I;
75823
75823
  };
@@ -75848,8 +75848,8 @@ var wu = z((Bh, Ko) => {
75848
75848
  };
75849
75849
  })(), B = /* @__PURE__ */ (function() {
75850
75850
  function m(N, k, x) {
75851
- var L, R, O, q, I = 0, M = N.length, Y = k % _, Q = k / _ | 0;
75852
- for (N = N.slice(); M--; ) O = N[M] % _, q = N[M] / _ | 0, L = Q * O + q * Y, R = Y * O + L % _ * _ + I, I = (R / x | 0) + (L / _ | 0) + Q * q, N[M] = R % x;
75851
+ var L, R, O, q, I = 0, M = N.length, Y = k % g, Q = k / g | 0;
75852
+ for (N = N.slice(); M--; ) O = N[M] % g, q = N[M] / g | 0, L = Q * O + q * Y, R = Y * O + L % g * g + I, I = (R / x | 0) + (L / g | 0) + Q * q, N[M] = R % x;
75853
75853
  return I && (N = [I].concat(N)), N;
75854
75854
  }
75855
75855
  function C(N, k, x, L) {
@@ -75868,7 +75868,7 @@ var wu = z((Bh, Ko) => {
75868
75868
  return function(N, k, x, L, R) {
75869
75869
  var O, q, I, M, Y, Q, we, Pe, Ie, be, De, je, sn, on, an, ct, rr, Ve = N.s == k.s ? 1 : -1, Le = N.c, Se = k.c;
75870
75870
  if (!Le || !Le[0] || !Se || !Se[0]) return new W(!N.s || !k.s || (Le ? Se && Le[0] == Se[0] : !Se) ? NaN : Le && Le[0] == 0 || !Se ? Ve * 0 : Ve / 0);
75871
- for (Pe = new W(Ve), Ie = Pe.c = [], q = N.e - k.e, Ve = x + q + 1, R || (R = l, q = b(N.e / d) - b(k.e / d), Ve = Ve / d | 0), I = 0; Se[I] == (Le[I] || 0); I++) ;
75871
+ for (Pe = new W(Ve), Ie = Pe.c = [], q = N.e - k.e, Ve = x + q + 1, R || (R = l, q = b(N.e / f) - b(k.e / f), Ve = Ve / f | 0), I = 0; Se[I] == (Le[I] || 0); I++) ;
75872
75872
  if (Se[I] > (Le[I] || 0) && q--, Ve < 0) Ie.push(1), M = true;
75873
75873
  else {
75874
75874
  for (on = Le.length, ct = Se.length, I = 0, Ve += 2, Y = o(R / (Se[0] + 1)), Y > 1 && (Se = m(Se, Y, R), Le = m(Le, Y, R), ct = Se.length, on = Le.length), sn = ct, be = Le.slice(0, ct), De = be.length; De < ct; be[De++] = 0) ;
@@ -75885,14 +75885,14 @@ var wu = z((Bh, Ko) => {
75885
75885
  }
75886
75886
  if (R == l) {
75887
75887
  for (I = 1, Ve = Ie[0]; Ve >= 10; Ve /= 10, I++) ;
75888
- ke(Pe, x + (Pe.e = I + q * d - 1) + 1, L, M);
75888
+ ke(Pe, x + (Pe.e = I + q * f - 1) + 1, L, M);
75889
75889
  } else Pe.e = q, Pe.r = +M;
75890
75890
  return Pe;
75891
75891
  };
75892
75892
  })();
75893
75893
  function ue(m, C, D, N) {
75894
75894
  var k, x, L, R, O;
75895
- if (D == null ? D = fe : g(D, 0, 8), !m.c) return m.toString();
75895
+ if (D == null ? D = fe : y(D, 0, 8), !m.c) return m.toString();
75896
75896
  if (k = m.c[0], L = m.e, C == null) O = w(m.c), O = N == 1 || N == 2 && (L <= Ee || L >= Ce) ? E(O, L) : S(O, L, "0");
75897
75897
  else if (m = ke(new W(m), C, D), x = m.e, O = w(m.c), R = O.length, N == 1 || N == 2 && (C <= x || x <= Ee)) {
75898
75898
  for (; R < C; O += "0", R++) ;
@@ -75909,7 +75909,7 @@ var wu = z((Bh, Ko) => {
75909
75909
  function ut(m, C, D) {
75910
75910
  for (var N = 1, k = C.length; !C[--k]; C.pop()) ;
75911
75911
  for (k = C[0]; k >= 10; k /= 10, N++) ;
75912
- return (D = N + D * d - 1) > oe ? m.c = m.e = null : D < Ae ? m.c = [m.e = 0] : (m.e = D, m.c = C), m;
75912
+ return (D = N + D * f - 1) > oe ? m.c = m.e = null : D < Ae ? m.c = [m.e = 0] : (m.e = D, m.c = C), m;
75913
75913
  }
75914
75914
  Z = /* @__PURE__ */ (function() {
75915
75915
  var m = /^(-?)0([xbo])(?=\w[\w.]*$)/i, C = /^([^.]+)\.$/, D = /^\.([^.]+)$/, N = /^-?(Infinity|NaN)$/, k = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
@@ -75931,17 +75931,17 @@ var wu = z((Bh, Ko) => {
75931
75931
  if (M) {
75932
75932
  e: {
75933
75933
  for (k = 1, R = M[0]; R >= 10; R /= 10, k++) ;
75934
- if (x = C - k, x < 0) x += d, L = C, O = M[q = 0], I = o(O / Y[k - L - 1] % 10);
75935
- else if (q = n((x + 1) / d), q >= M.length) if (N) {
75934
+ if (x = C - k, x < 0) x += f, L = C, O = M[q = 0], I = o(O / Y[k - L - 1] % 10);
75935
+ else if (q = n((x + 1) / f), q >= M.length) if (N) {
75936
75936
  for (; M.length <= q; M.push(0)) ;
75937
- O = I = 0, k = 1, x %= d, L = x - d + 1;
75937
+ O = I = 0, k = 1, x %= f, L = x - f + 1;
75938
75938
  } else break e;
75939
75939
  else {
75940
75940
  for (O = R = M[q], k = 1; R >= 10; R /= 10, k++) ;
75941
- x %= d, L = x - d + k, I = L < 0 ? 0 : o(O / Y[k - L - 1] % 10);
75941
+ x %= f, L = x - f + k, I = L < 0 ? 0 : o(O / Y[k - L - 1] % 10);
75942
75942
  }
75943
- if (N = N || C < 0 || M[q + 1] != null || (L < 0 ? O : O % Y[k - L - 1]), N = D < 4 ? (I || N) && (D == 0 || D == (m.s < 0 ? 3 : 2)) : I > 5 || I == 5 && (D == 4 || N || D == 6 && (x > 0 ? L > 0 ? O / Y[k - L] : 0 : M[q - 1]) % 10 & 1 || D == (m.s < 0 ? 8 : 7)), C < 1 || !M[0]) return M.length = 0, N ? (C -= m.e + 1, M[0] = Y[(d - C % d) % d], m.e = -C || 0) : M[0] = m.e = 0, m;
75944
- if (x == 0 ? (M.length = q, R = 1, q--) : (M.length = q + 1, R = Y[d - x], M[q] = L > 0 ? o(O / Y[k - L] % Y[L]) * R : 0), N) for (; ; ) if (q == 0) {
75943
+ if (N = N || C < 0 || M[q + 1] != null || (L < 0 ? O : O % Y[k - L - 1]), N = D < 4 ? (I || N) && (D == 0 || D == (m.s < 0 ? 3 : 2)) : I > 5 || I == 5 && (D == 4 || N || D == 6 && (x > 0 ? L > 0 ? O / Y[k - L] : 0 : M[q - 1]) % 10 & 1 || D == (m.s < 0 ? 8 : 7)), C < 1 || !M[0]) return M.length = 0, N ? (C -= m.e + 1, M[0] = Y[(f - C % f) % f], m.e = -C || 0) : M[0] = m.e = 0, m;
75944
+ if (x == 0 ? (M.length = q, R = 1, q--) : (M.length = q + 1, R = Y[f - x], M[q] = L > 0 ? o(O / Y[k - L] % Y[L]) * R : 0), N) for (; ; ) if (q == 0) {
75945
75945
  for (x = 1, L = M[0]; L >= 10; L /= 10, x++) ;
75946
75946
  for (L = M[0] += R, R = 1; L >= 10; L /= 10, R++) ;
75947
75947
  x != R && (m.e++, M[0] == l && (M[0] = 1));
@@ -75967,9 +75967,9 @@ var wu = z((Bh, Ko) => {
75967
75967
  return p(this, new W(m, C));
75968
75968
  }, H.decimalPlaces = H.dp = function(m, C) {
75969
75969
  var D, N, k, x = this;
75970
- if (m != null) return g(m, 0, A), C == null ? C = fe : g(C, 0, 8), ke(new W(x), m + x.e + 1, C);
75970
+ if (m != null) return y(m, 0, A), C == null ? C = fe : y(C, 0, 8), ke(new W(x), m + x.e + 1, C);
75971
75971
  if (!(D = x.c)) return null;
75972
- if (N = ((k = D.length - 1) - b(this.e / d)) * d, k = D[k]) for (; k % 10 == 0; k /= 10, N--) ;
75972
+ if (N = ((k = D.length - 1) - b(this.e / f)) * f, k = D[k]) for (; k % 10 == 0; k /= 10, N--) ;
75973
75973
  return N < 0 && (N = 0), N;
75974
75974
  }, H.dividedBy = H.div = function(m, C) {
75975
75975
  return B(this, new W(m, C), de, fe);
@@ -75984,7 +75984,7 @@ var wu = z((Bh, Ko) => {
75984
75984
  N = !O && M.isInteger() && C.isInteger(), N && (M = M.mod(C));
75985
75985
  } else {
75986
75986
  if (m.e > 9 && (M.e > 0 || M.e < -1 || (M.e == 0 ? M.c[0] > 1 || R && M.c[1] >= 24e7 : M.c[0] < 8e13 || R && M.c[0] <= 9999975e7))) return x = M.s < 0 && T(m) ? -0 : 0, M.e > -1 && (x = 1 / x), new W(O ? 1 / x : x);
75987
- V && (x = n(V / d + 2));
75987
+ V && (x = n(V / f + 2));
75988
75988
  }
75989
75989
  for (R ? (D = new W(0.5), O && (m.s = 1), q = T(m)) : (k = Math.abs(+Ne(m)), q = k % 2), I = new W(ae); ; ) {
75990
75990
  if (q) {
@@ -76004,7 +76004,7 @@ var wu = z((Bh, Ko) => {
76004
76004
  return N ? I : (O && (I = ae.div(I)), C ? I.mod(C) : x ? ke(I, V, fe, L) : I);
76005
76005
  }, H.integerValue = function(m) {
76006
76006
  var C = new W(this);
76007
- return m == null ? m = fe : g(m, 0, 8), ke(C, C.e + 1, m);
76007
+ return m == null ? m = fe : y(m, 0, 8), ke(C, C.e + 1, m);
76008
76008
  }, H.isEqualTo = H.eq = function(m, C) {
76009
76009
  return p(this, new W(m, C)) === 0;
76010
76010
  }, H.isFinite = function() {
@@ -76014,7 +76014,7 @@ var wu = z((Bh, Ko) => {
76014
76014
  }, H.isGreaterThanOrEqualTo = H.gte = function(m, C) {
76015
76015
  return (C = p(this, new W(m, C))) === 1 || C === 0;
76016
76016
  }, H.isInteger = function() {
76017
- return !!this.c && b(this.e / d) > this.c.length - 2;
76017
+ return !!this.c && b(this.e / f) > this.c.length - 2;
76018
76018
  }, H.isLessThan = H.lt = function(m, C) {
76019
76019
  return p(this, new W(m, C)) < 0;
76020
76020
  }, H.isLessThanOrEqualTo = H.lte = function(m, C) {
@@ -76031,7 +76031,7 @@ var wu = z((Bh, Ko) => {
76031
76031
  var D, N, k, x, L = this, R = L.s;
76032
76032
  if (m = new W(m, C), C = m.s, !R || !C) return new W(NaN);
76033
76033
  if (R != C) return m.s = -C, L.plus(m);
76034
- var O = L.e / d, q = m.e / d, I = L.c, M = m.c;
76034
+ var O = L.e / f, q = m.e / f, I = L.c, M = m.c;
76035
76035
  if (!O || !q) {
76036
76036
  if (!I || !M) return I ? (m.s = -C, m) : new W(M ? L : NaN);
76037
76037
  if (!I[0] || !M[0]) return M[0] ? (m.s = -C, m) : new W(I[0] ? L : fe == 3 ? -0 : 0);
@@ -76059,8 +76059,8 @@ var wu = z((Bh, Ko) => {
76059
76059
  }, H.multipliedBy = H.times = function(m, C) {
76060
76060
  var D, N, k, x, L, R, O, q, I, M, Y, Q, we, Pe, Ie, be = this, De = be.c, je = (m = new W(m, C)).c;
76061
76061
  if (!De || !je || !De[0] || !je[0]) return !be.s || !m.s || De && !De[0] && !je || je && !je[0] && !De ? m.c = m.e = m.s = null : (m.s *= be.s, !De || !je ? m.c = m.e = null : (m.c = [0], m.e = 0)), m;
76062
- for (N = b(be.e / d) + b(m.e / d), m.s *= be.s, O = De.length, M = je.length, O < M && (we = De, De = je, je = we, k = O, O = M, M = k), k = O + M, we = []; k--; we.push(0)) ;
76063
- for (Pe = l, Ie = _, k = M; --k >= 0; ) {
76062
+ for (N = b(be.e / f) + b(m.e / f), m.s *= be.s, O = De.length, M = je.length, O < M && (we = De, De = je, je = we, k = O, O = M, M = k), k = O + M, we = []; k--; we.push(0)) ;
76063
+ for (Pe = l, Ie = g, k = M; --k >= 0; ) {
76064
76064
  for (D = 0, Y = je[k] % Ie, Q = je[k] / Ie | 0, L = O, x = k + L; x > k; ) q = De[--L] % Ie, I = De[L] / Ie | 0, R = Q * q + I * Y, q = Y * q + R % Ie * Ie + we[x] + D, D = (q / Pe | 0) + (R / Ie | 0) + Q * I, we[x--] = q % Pe;
76065
76065
  we[x] = D;
76066
76066
  }
@@ -76072,7 +76072,7 @@ var wu = z((Bh, Ko) => {
76072
76072
  var D, N = this, k = N.s;
76073
76073
  if (m = new W(m, C), C = m.s, !k || !C) return new W(NaN);
76074
76074
  if (k != C) return m.s = -C, N.minus(m);
76075
- var x = N.e / d, L = m.e / d, R = N.c, O = m.c;
76075
+ var x = N.e / f, L = m.e / f, R = N.c, O = m.c;
76076
76076
  if (!x || !L) {
76077
76077
  if (!R || !O) return new W(k / 0);
76078
76078
  if (!R[0] || !O[0]) return O[0] ? m : new W(R[0] ? N : k * 0);
@@ -76085,15 +76085,15 @@ var wu = z((Bh, Ko) => {
76085
76085
  return k && (R = [k].concat(R), ++L), ut(m, R, L);
76086
76086
  }, H.precision = H.sd = function(m, C) {
76087
76087
  var D, N, k, x = this;
76088
- if (m != null && m !== !!m) return g(m, 1, A), C == null ? C = fe : g(C, 0, 8), ke(new W(x), m, C);
76088
+ if (m != null && m !== !!m) return y(m, 1, A), C == null ? C = fe : y(C, 0, 8), ke(new W(x), m, C);
76089
76089
  if (!(D = x.c)) return null;
76090
- if (k = D.length - 1, N = k * d + 1, k = D[k]) {
76090
+ if (k = D.length - 1, N = k * f + 1, k = D[k]) {
76091
76091
  for (; k % 10 == 0; k /= 10, N--) ;
76092
76092
  for (k = D[0]; k >= 10; k /= 10, N++) ;
76093
76093
  }
76094
76094
  return m && x.e + 1 > N && (N = x.e + 1), N;
76095
76095
  }, H.shiftedBy = function(m) {
76096
- return g(m, -f, f), this.times("1e" + m);
76096
+ return y(m, -d, d), this.times("1e" + m);
76097
76097
  }, H.squareRoot = H.sqrt = function() {
76098
76098
  var m, C, D, N, k, x = this, L = x.c, R = x.s, O = x.e, q = de + 4, I = new W("0.5");
76099
76099
  if (R !== 1 || !L || !L[0]) return new W(!R || R < 0 && (!L || L[0]) ? NaN : L ? x : 1 / 0);
@@ -76111,9 +76111,9 @@ var wu = z((Bh, Ko) => {
76111
76111
  }
76112
76112
  return ke(D, D.e + de + 1, fe, m);
76113
76113
  }, H.toExponential = function(m, C) {
76114
- return m != null && (g(m, 0, A), m++), ue(this, m, C, 1);
76114
+ return m != null && (y(m, 0, A), m++), ue(this, m, C, 1);
76115
76115
  }, H.toFixed = function(m, C) {
76116
- return m != null && (g(m, 0, A), m = m + this.e + 1), ue(this, m, C);
76116
+ return m != null && (y(m, 0, A), m = m + this.e + 1), ue(this, m, C);
76117
76117
  }, H.toFormat = function(m, C, D) {
76118
76118
  var N, k = this;
76119
76119
  if (D == null) m != null && C && typeof C == "object" ? (D = C, C = null) : m && typeof m == "object" ? (D = m, m = C = null) : D = se;
@@ -76131,15 +76131,15 @@ var wu = z((Bh, Ko) => {
76131
76131
  var C, D, N, k, x, L, R, O, q, I, M, Y, Q = this, we = Q.c;
76132
76132
  if (m != null && (R = new W(m), !R.isInteger() && (R.c || R.s !== 1) || R.lt(ae))) throw Error(i + "Argument " + (R.isInteger() ? "out of range: " : "not an integer: ") + Ne(R));
76133
76133
  if (!we) return new W(Q);
76134
- for (C = new W(ae), q = D = new W(ae), N = O = new W(ae), Y = w(we), x = C.e = Y.length - Q.e - 1, C.c[0] = h[(L = x % d) < 0 ? d + L : L], m = !m || R.comparedTo(C) > 0 ? x > 0 ? C : q : R, L = oe, oe = 1 / 0, R = new W(Y), O.c[0] = 0; I = B(R, C, 0, 1), k = D.plus(I.times(N)), k.comparedTo(m) != 1; ) D = N, N = k, q = O.plus(I.times(k = q)), O = k, C = R.minus(I.times(k = C)), R = k;
76134
+ for (C = new W(ae), q = D = new W(ae), N = O = new W(ae), Y = w(we), x = C.e = Y.length - Q.e - 1, C.c[0] = h[(L = x % f) < 0 ? f + L : L], m = !m || R.comparedTo(C) > 0 ? x > 0 ? C : q : R, L = oe, oe = 1 / 0, R = new W(Y), O.c[0] = 0; I = B(R, C, 0, 1), k = D.plus(I.times(N)), k.comparedTo(m) != 1; ) D = N, N = k, q = O.plus(I.times(k = q)), O = k, C = R.minus(I.times(k = C)), R = k;
76135
76135
  return k = B(m.minus(D), N, 0, 1), O = O.plus(k.times(q)), D = D.plus(k.times(N)), O.s = q.s = Q.s, x = x * 2, M = B(q, N, x, fe).minus(Q).abs().comparedTo(B(O, D, x, fe).minus(Q).abs()) < 1 ? [q, N] : [O, D], oe = L, M;
76136
76136
  }, H.toNumber = function() {
76137
76137
  return +Ne(this);
76138
76138
  }, H.toPrecision = function(m, C) {
76139
- return m != null && g(m, 1, A), ue(this, m, C, 2);
76139
+ return m != null && y(m, 1, A), ue(this, m, C, 2);
76140
76140
  }, H.toString = function(m) {
76141
76141
  var C, D = this, N = D.s, k = D.e;
76142
- return k === null ? N ? (C = "Infinity", N < 0 && (C = "-" + C)) : C = "NaN" : (m == null ? C = k <= Ee || k >= Ce ? E(w(D.c), k) : S(w(D.c), k, "0") : m === 10 && ve ? (D = ke(new W(D), de + k + 1, fe), C = S(w(D.c), D.e, "0")) : (g(m, 2, Ue.length, "Base"), C = G(S(w(D.c), k, "0"), 10, m, N, true)), N < 0 && D.c[0] && (C = "-" + C)), C;
76142
+ return k === null ? N ? (C = "Infinity", N < 0 && (C = "-" + C)) : C = "NaN" : (m == null ? C = k <= Ee || k >= Ce ? E(w(D.c), k) : S(w(D.c), k, "0") : m === 10 && ve ? (D = ke(new W(D), de + k + 1, fe), C = S(w(D.c), D.e, "0")) : (y(m, 2, Ue.length, "Base"), C = G(S(w(D.c), k, "0"), 10, m, N, true)), N < 0 && D.c[0] && (C = "-" + C)), C;
76143
76143
  }, H.valueOf = H.toJSON = function() {
76144
76144
  return Ne(this);
76145
76145
  }, H._isBigNumber = true, F != null && W.set(F), W;
@@ -76150,7 +76150,7 @@ var wu = z((Bh, Ko) => {
76150
76150
  }
76151
76151
  function w(F) {
76152
76152
  for (var B, G, Z = 1, H = F.length, ae = F[0] + ""; Z < H; ) {
76153
- for (B = F[Z++] + "", G = d - B.length; G--; B = "0" + B) ;
76153
+ for (B = F[Z++] + "", G = f - B.length; G--; B = "0" + B) ;
76154
76154
  ae += B;
76155
76155
  }
76156
76156
  for (H = ae.length; ae.charCodeAt(--H) === 48; ) ;
@@ -76166,12 +76166,12 @@ var wu = z((Bh, Ko) => {
76166
76166
  for (fe = (Ee = H.length) < (Ce = ae.length) ? Ee : Ce, de = 0; de < fe; de++) if (H[de] != ae[de]) return H[de] > ae[de] ^ G ? 1 : -1;
76167
76167
  return Ee == Ce ? 0 : Ee > Ce ^ G ? 1 : -1;
76168
76168
  }
76169
- function g(F, B, G, Z) {
76169
+ function y(F, B, G, Z) {
76170
76170
  if (F < B || F > G || F !== o(F)) throw Error(i + (Z || "Argument") + (typeof F == "number" ? F < B || F > G ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(F));
76171
76171
  }
76172
76172
  function T(F) {
76173
76173
  var B = F.c.length - 1;
76174
- return b(F.e / d) == B && F.c[B] % 2 != 0;
76174
+ return b(F.e / f) == B && F.c[B] % 2 != 0;
76175
76175
  }
76176
76176
  function E(F, B) {
76177
76177
  return (F.length > 1 ? F.charAt(0) + "." + F.slice(1) : F) + (B < 0 ? "e" : "e+") + B;
@@ -76196,39 +76196,39 @@ var jh = z((FS, qh) => {
76196
76196
  var Ih = wu(), Nh = qh.exports;
76197
76197
  (function() {
76198
76198
  "use strict";
76199
- function r(f) {
76200
- return f < 10 ? "0" + f : f;
76199
+ function r(d) {
76200
+ return d < 10 ? "0" + d : d;
76201
76201
  }
76202
76202
  var e = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, t = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, n, o, i = { "\b": "\\b", " ": "\\t", "\n": "\\n", "\f": "\\f", "\r": "\\r", '"': '\\"', "\\": "\\\\" }, u;
76203
- function l(f) {
76204
- return t.lastIndex = 0, t.test(f) ? '"' + f.replace(t, function(h) {
76205
- var _ = i[h];
76206
- return typeof _ == "string" ? _ : "\\u" + ("0000" + h.charCodeAt(0).toString(16)).slice(-4);
76207
- }) + '"' : '"' + f + '"';
76208
- }
76209
- function d(f, h) {
76210
- var _, A, P, b, w = n, p, g = h[f], T = g != null && (g instanceof Ih || Ih.isBigNumber(g));
76211
- switch (g && typeof g == "object" && typeof g.toJSON == "function" && (g = g.toJSON(f)), typeof u == "function" && (g = u.call(h, f, g)), typeof g) {
76203
+ function l(d) {
76204
+ return t.lastIndex = 0, t.test(d) ? '"' + d.replace(t, function(h) {
76205
+ var g = i[h];
76206
+ return typeof g == "string" ? g : "\\u" + ("0000" + h.charCodeAt(0).toString(16)).slice(-4);
76207
+ }) + '"' : '"' + d + '"';
76208
+ }
76209
+ function f(d, h) {
76210
+ var g, A, P, b, w = n, p, y = h[d], T = y != null && (y instanceof Ih || Ih.isBigNumber(y));
76211
+ switch (y && typeof y == "object" && typeof y.toJSON == "function" && (y = y.toJSON(d)), typeof u == "function" && (y = u.call(h, d, y)), typeof y) {
76212
76212
  case "string":
76213
- return T ? g : l(g);
76213
+ return T ? y : l(y);
76214
76214
  case "number":
76215
- return isFinite(g) ? String(g) : "null";
76215
+ return isFinite(y) ? String(y) : "null";
76216
76216
  case "boolean":
76217
76217
  case "null":
76218
76218
  case "bigint":
76219
- return String(g);
76219
+ return String(y);
76220
76220
  case "object":
76221
- if (!g) return "null";
76222
- if (n += o, p = [], Object.prototype.toString.apply(g) === "[object Array]") {
76223
- for (b = g.length, _ = 0; _ < b; _ += 1) p[_] = d(_, g) || "null";
76221
+ if (!y) return "null";
76222
+ if (n += o, p = [], Object.prototype.toString.apply(y) === "[object Array]") {
76223
+ for (b = y.length, g = 0; g < b; g += 1) p[g] = f(g, y) || "null";
76224
76224
  return P = p.length === 0 ? "[]" : n ? `[
76225
76225
  ` + n + p.join(`,
76226
76226
  ` + n) + `
76227
76227
  ` + w + "]" : "[" + p.join(",") + "]", n = w, P;
76228
76228
  }
76229
- if (u && typeof u == "object") for (b = u.length, _ = 0; _ < b; _ += 1) typeof u[_] == "string" && (A = u[_], P = d(A, g), P && p.push(l(A) + (n ? ": " : ":") + P));
76230
- else Object.keys(g).forEach(function(E) {
76231
- var S = d(E, g);
76229
+ if (u && typeof u == "object") for (b = u.length, g = 0; g < b; g += 1) typeof u[g] == "string" && (A = u[g], P = f(A, y), P && p.push(l(A) + (n ? ": " : ":") + P));
76230
+ else Object.keys(y).forEach(function(E) {
76231
+ var S = f(E, y);
76232
76232
  S && p.push(l(E) + (n ? ": " : ":") + S);
76233
76233
  });
76234
76234
  return P = p.length === 0 ? "{}" : n ? `{
@@ -76237,12 +76237,12 @@ var jh = z((FS, qh) => {
76237
76237
  ` + w + "}" : "{" + p.join(",") + "}", n = w, P;
76238
76238
  }
76239
76239
  }
76240
- typeof Nh.stringify != "function" && (Nh.stringify = function(f, h, _) {
76240
+ typeof Nh.stringify != "function" && (Nh.stringify = function(d, h, g) {
76241
76241
  var A;
76242
- if (n = "", o = "", typeof _ == "number") for (A = 0; A < _; A += 1) o += " ";
76243
- else typeof _ == "string" && (o = _);
76242
+ if (n = "", o = "", typeof g == "number") for (A = 0; A < g; A += 1) o += " ";
76243
+ else typeof g == "string" && (o = g);
76244
76244
  if (u = h, h && typeof h != "function" && (typeof h != "object" || typeof h.length != "number")) throw new Error("JSON.stringify");
76245
- return d("", { "": f });
76245
+ return f("", { "": d });
76246
76246
  });
76247
76247
  })();
76248
76248
  });
@@ -76261,22 +76261,22 @@ var Uh = z((OS, Lh) => {
76261
76261
  throw { name: "SyntaxError", message: w, at: t, text: i };
76262
76262
  }, l = function(w) {
76263
76263
  return w && w !== n && u("Expected '" + w + "' instead of '" + n + "'"), n = i.charAt(t), t += 1, n;
76264
- }, d = function() {
76264
+ }, f = function() {
76265
76265
  var w, p = "";
76266
76266
  for (n === "-" && (p = "-", l("-")); n >= "0" && n <= "9"; ) p += n, l();
76267
76267
  if (n === ".") for (p += "."; l() && n >= "0" && n <= "9"; ) p += n;
76268
76268
  if (n === "e" || n === "E") for (p += n, l(), (n === "-" || n === "+") && (p += n, l()); n >= "0" && n <= "9"; ) p += n, l();
76269
76269
  if (w = +p, !isFinite(w)) u("Bad number");
76270
76270
  else return Yo == null && (Yo = wu()), p.length > 15 ? e.storeAsString ? p : e.useNativeBigInt ? BigInt(p) : new Yo(p) : e.alwaysParseAsBig ? e.useNativeBigInt ? BigInt(w) : new Yo(w) : w;
76271
- }, f = function() {
76272
- var w, p, g = "", T;
76271
+ }, d = function() {
76272
+ var w, p, y = "", T;
76273
76273
  if (n === '"') for (var E = t; l(); ) {
76274
- if (n === '"') return t - 1 > E && (g += i.substring(E, t - 1)), l(), g;
76274
+ if (n === '"') return t - 1 > E && (y += i.substring(E, t - 1)), l(), y;
76275
76275
  if (n === "\\") {
76276
- if (t - 1 > E && (g += i.substring(E, t - 1)), l(), n === "u") {
76276
+ if (t - 1 > E && (y += i.substring(E, t - 1)), l(), n === "u") {
76277
76277
  for (T = 0, p = 0; p < 4 && (w = parseInt(l(), 16), !!isFinite(w)); p += 1) T = T * 16 + w;
76278
- g += String.fromCharCode(T);
76279
- } else if (typeof o[n] == "string") g += o[n];
76278
+ y += String.fromCharCode(T);
76279
+ } else if (typeof o[n] == "string") y += o[n];
76280
76280
  else break;
76281
76281
  E = t;
76282
76282
  }
@@ -76284,7 +76284,7 @@ var Uh = z((OS, Lh) => {
76284
76284
  u("Bad string");
76285
76285
  }, h = function() {
76286
76286
  for (; n && n <= " "; ) l();
76287
- }, _ = function() {
76287
+ }, g = function() {
76288
76288
  switch (n) {
76289
76289
  case "t":
76290
76290
  return l("t"), l("r"), l("u"), l("e"), true;
@@ -76309,7 +76309,7 @@ var Uh = z((OS, Lh) => {
76309
76309
  if (n === "{") {
76310
76310
  if (l("{"), h(), n === "}") return l("}"), p;
76311
76311
  for (; n; ) {
76312
- if (w = f(), h(), l(":"), e.strict === true && Object.hasOwnProperty.call(p, w) && u('Duplicate key "' + w + '"'), oC.test(w) === true ? e.protoAction === "error" ? u("Object contains forbidden prototype property") : e.protoAction === "ignore" ? A() : p[w] = A() : iC.test(w) === true ? e.constructorAction === "error" ? u("Object contains forbidden constructor property") : e.constructorAction === "ignore" ? A() : p[w] = A() : p[w] = A(), h(), n === "}") return l("}"), p;
76312
+ if (w = d(), h(), l(":"), e.strict === true && Object.hasOwnProperty.call(p, w) && u('Duplicate key "' + w + '"'), oC.test(w) === true ? e.protoAction === "error" ? u("Object contains forbidden prototype property") : e.protoAction === "ignore" ? A() : p[w] = A() : iC.test(w) === true ? e.constructorAction === "error" ? u("Object contains forbidden constructor property") : e.constructorAction === "ignore" ? A() : p[w] = A() : p[w] = A(), h(), n === "}") return l("}"), p;
76313
76313
  l(","), h();
76314
76314
  }
76315
76315
  }
@@ -76322,20 +76322,20 @@ var Uh = z((OS, Lh) => {
76322
76322
  case "[":
76323
76323
  return P();
76324
76324
  case '"':
76325
- return f();
76326
- case "-":
76327
76325
  return d();
76326
+ case "-":
76327
+ return f();
76328
76328
  default:
76329
- return n >= "0" && n <= "9" ? d() : _();
76329
+ return n >= "0" && n <= "9" ? f() : g();
76330
76330
  }
76331
76331
  }, function(w, p) {
76332
- var g;
76333
- return i = w + "", t = 0, n = " ", g = A(), h(), n && u("Syntax error"), typeof p == "function" ? (function T(E, S) {
76332
+ var y;
76333
+ return i = w + "", t = 0, n = " ", y = A(), h(), n && u("Syntax error"), typeof p == "function" ? (function T(E, S) {
76334
76334
  var F, B, G = E[S];
76335
76335
  return G && typeof G == "object" && Object.keys(G).forEach(function(Z) {
76336
76336
  B = T(G, Z), B !== void 0 ? G[Z] = B : delete G[Z];
76337
76337
  }), p.call(E, S, G);
76338
- })({ "": g }, "") : g;
76338
+ })({ "": y }, "") : y;
76339
76339
  };
76340
76340
  };
76341
76341
  Lh.exports = aC;
@@ -76518,10 +76518,10 @@ var ep = z((Te) => {
76518
76518
  l = (o = t.severity) !== null && o !== void 0 ? o : jt.DEFAULT;
76519
76519
  break;
76520
76520
  }
76521
- let d = Qh.formatWithOptions({ colors: ht.Colours.enabled }, ...n), f = Object.assign({}, t);
76522
- delete f.severity;
76523
- let h = Object.getOwnPropertyNames(f).length ? JSON.stringify(f) : "", _ = h ? `${ht.Colours.grey}${h}${ht.Colours.reset}` : "";
76524
- console.error("%s [%s|%s] %s%s", u, i, l, d, h ? ` ${_}` : "");
76521
+ let f = Qh.formatWithOptions({ colors: ht.Colours.enabled }, ...n), d = Object.assign({}, t);
76522
+ delete d.severity;
76523
+ let h = Object.getOwnPropertyNames(d).length ? JSON.stringify(d) : "", g = h ? `${ht.Colours.grey}${h}${ht.Colours.reset}` : "";
76524
+ console.error("%s [%s|%s] %s%s", u, i, l, f, h ? ` ${g}` : "");
76525
76525
  } : () => {
76526
76526
  };
76527
76527
  }
@@ -76562,8 +76562,8 @@ var ep = z((Te) => {
76562
76562
  let n = (t = this.upstream) === null || t === void 0 ? void 0 : t.makeLogger(e);
76563
76563
  return (o, ...i) => {
76564
76564
  var u;
76565
- let l = (u = o.severity) !== null && u !== void 0 ? u : jt.INFO, d = Object.assign({ severity: l, message: Qh.format(...i) }, o), f = JSON.stringify(d);
76566
- n ? n(o, f) : console.log("%s", f);
76565
+ let l = (u = o.severity) !== null && u !== void 0 ? u : jt.INFO, f = Object.assign({ severity: l, message: Qh.format(...i) }, o), d = JSON.stringify(f);
76566
+ n ? n(o, d) : console.log("%s", d);
76567
76567
  };
76568
76568
  }
76569
76569
  setFilters() {
@@ -76686,21 +76686,21 @@ var _s = z((ne) => {
76686
76686
  async function ys(r, e = {}, t = 3, n = false) {
76687
76687
  let o = new Headers(ne.HEADERS), i = "", u = {};
76688
76688
  if (typeof r == "object") {
76689
- let _ = r;
76690
- new Headers(_.headers).forEach((A, P) => o.set(P, A)), i = _.metadataKey, u = _.params || u, t = _.noResponseRetries || t, n = _.fastFail || n;
76689
+ let g = r;
76690
+ new Headers(g.headers).forEach((A, P) => o.set(P, A)), i = g.metadataKey, u = g.params || u, t = g.noResponseRetries || t, n = g.fastFail || n;
76691
76691
  } else i = r;
76692
- typeof e == "string" ? i += `/${e}` : (DC(e), e.property && (i += `/${e.property}`), new Headers(e.headers).forEach((_, A) => o.set(A, _)), u = e.params || u);
76693
- let l = n ? SC : Fu.request, d = { url: `${Ou()}/${i}`, headers: o, retryConfig: { noResponseRetries: t }, params: u, responseType: "text", timeout: sp() };
76694
- tp.info("instance request %j", d);
76695
- let f = await l(d);
76696
- tp.info("instance metadata is %s", f.data);
76697
- let h = f.headers.get(ne.HEADER_NAME);
76692
+ typeof e == "string" ? i += `/${e}` : (DC(e), e.property && (i += `/${e.property}`), new Headers(e.headers).forEach((g, A) => o.set(A, g)), u = e.params || u);
76693
+ let l = n ? SC : Fu.request, f = { url: `${Ou()}/${i}`, headers: o, retryConfig: { noResponseRetries: t }, params: u, responseType: "text", timeout: sp() };
76694
+ tp.info("instance request %j", f);
76695
+ let d = await l(f);
76696
+ tp.info("instance metadata is %s", d.data);
76697
+ let h = d.headers.get(ne.HEADER_NAME);
76698
76698
  if (h !== ne.HEADER_VALUE) throw new RangeError(`Invalid response from metadata service: incorrect ${ne.HEADER_NAME} header. Expected '${ne.HEADER_VALUE}', got ${h ? `'${h}'` : "no header"}`);
76699
- if (typeof f.data == "string") try {
76700
- return EC.parse(f.data);
76699
+ if (typeof d.data == "string") try {
76700
+ return EC.parse(d.data);
76701
76701
  } catch {
76702
76702
  }
76703
- return f.data;
76703
+ return d.data;
76704
76704
  }
76705
76705
  async function SC(r) {
76706
76706
  let e = { ...r, url: r.url?.toString().replace(Ou(), Ou(ne.SECONDARY_HOST_ADDRESS)) }, t = (0, Fu.request)(r), n = (0, Fu.request)(e);
@@ -76793,9 +76793,9 @@ var ap = z((ei) => {
76793
76793
  return (e + t) * 3 / 4 - t;
76794
76794
  }
76795
76795
  function NC(r) {
76796
- var e, t = ip(r), n = t[0], o = t[1], i = new xC(IC(r, n, o)), u = 0, l = o > 0 ? n - 4 : n, d;
76797
- for (d = 0; d < l; d += 4) e = St[r.charCodeAt(d)] << 18 | St[r.charCodeAt(d + 1)] << 12 | St[r.charCodeAt(d + 2)] << 6 | St[r.charCodeAt(d + 3)], i[u++] = e >> 16 & 255, i[u++] = e >> 8 & 255, i[u++] = e & 255;
76798
- return o === 2 && (e = St[r.charCodeAt(d)] << 2 | St[r.charCodeAt(d + 1)] >> 4, i[u++] = e & 255), o === 1 && (e = St[r.charCodeAt(d)] << 10 | St[r.charCodeAt(d + 1)] << 4 | St[r.charCodeAt(d + 2)] >> 2, i[u++] = e >> 8 & 255, i[u++] = e & 255), i;
76796
+ var e, t = ip(r), n = t[0], o = t[1], i = new xC(IC(r, n, o)), u = 0, l = o > 0 ? n - 4 : n, f;
76797
+ for (f = 0; f < l; f += 4) e = St[r.charCodeAt(f)] << 18 | St[r.charCodeAt(f + 1)] << 12 | St[r.charCodeAt(f + 2)] << 6 | St[r.charCodeAt(f + 3)], i[u++] = e >> 16 & 255, i[u++] = e >> 8 & 255, i[u++] = e & 255;
76798
+ return o === 2 && (e = St[r.charCodeAt(f)] << 2 | St[r.charCodeAt(f + 1)] >> 4, i[u++] = e & 255), o === 1 && (e = St[r.charCodeAt(f)] << 10 | St[r.charCodeAt(f + 1)] << 4 | St[r.charCodeAt(f + 2)] >> 2, i[u++] = e >> 8 & 255, i[u++] = e & 255), i;
76799
76799
  }
76800
76800
  function qC(r) {
76801
76801
  return Kt[r >> 18 & 63] + Kt[r >> 12 & 63] + Kt[r >> 6 & 63] + Kt[r & 63];
@@ -76994,18 +76994,18 @@ var Uu = z((GS, bp) => {
76994
76994
  var l = r[i++];
76995
76995
  if (o - i - 2 < l) throw new Error('"r" specified length of "' + l + '", only "' + (o - i - 2) + '" available');
76996
76996
  if (n < l) throw new Error('"r" specified length of "' + l + '", max of "' + n + '" is acceptable');
76997
- var d = i;
76997
+ var f = i;
76998
76998
  if (i += l, r[i++] !== ii) throw new Error('Could not find expected "int" for "s"');
76999
- var f = r[i++];
77000
- if (o - i !== f) throw new Error('"s" specified length of "' + f + '", expected "' + (o - i) + '"');
77001
- if (n < f) throw new Error('"s" specified length of "' + f + '", max of "' + n + '" is acceptable');
76999
+ var d = r[i++];
77000
+ if (o - i !== d) throw new Error('"s" specified length of "' + d + '", expected "' + (o - i) + '"');
77001
+ if (n < d) throw new Error('"s" specified length of "' + d + '", max of "' + n + '" is acceptable');
77002
77002
  var h = i;
77003
- if (i += f, i !== o) throw new Error('Expected to consume entire buffer, but "' + (o - i) + '" bytes remain');
77004
- var _ = t - l, A = t - f, P = si.allocUnsafe(_ + l + A + f);
77005
- for (i = 0; i < _; ++i) P[i] = 0;
77006
- r.copy(P, i, d + Math.max(-_, 0), d + l), i = t;
77003
+ if (i += d, i !== o) throw new Error('Expected to consume entire buffer, but "' + (o - i) + '" bytes remain');
77004
+ var g = t - l, A = t - d, P = si.allocUnsafe(g + l + A + d);
77005
+ for (i = 0; i < g; ++i) P[i] = 0;
77006
+ r.copy(P, i, f + Math.max(-g, 0), f + l), i = t;
77007
77007
  for (var b = i; i < b + A; ++i) P[i] = 0;
77008
- return r.copy(P, i, h + Math.max(-A, 0), h + f), P = P.toString("base64"), P = eb(P), P;
77008
+ return r.copy(P, i, h + Math.max(-A, 0), h + d), P = P.toString("base64"), P = eb(P), P;
77009
77009
  }
77010
77010
  function mp(r, e, t) {
77011
77011
  for (var n = 0; e + n < t && r[e + n] === 0; ) ++n;
@@ -77016,8 +77016,8 @@ var Uu = z((GS, bp) => {
77016
77016
  r = Cp(r);
77017
77017
  var t = gp(e), n = r.length;
77018
77018
  if (n !== t * 2) throw new TypeError('"' + e + '" signatures must be "' + t * 2 + '" bytes, saw "' + n + '"');
77019
- var o = mp(r, 0, t), i = mp(r, t, r.length), u = t - o, l = t - i, d = 2 + u + 1 + 1 + l, f = d < oi, h = si.allocUnsafe((f ? 2 : 3) + d), _ = 0;
77020
- return h[_++] = _p, f ? h[_++] = d : (h[_++] = oi | 1, h[_++] = d & 255), h[_++] = ii, h[_++] = u, o < 0 ? (h[_++] = 0, _ += r.copy(h, _, 0, t)) : _ += r.copy(h, _, o, t), h[_++] = ii, h[_++] = l, i < 0 ? (h[_++] = 0, r.copy(h, _, t)) : r.copy(h, _, t + i), h;
77019
+ var o = mp(r, 0, t), i = mp(r, t, r.length), u = t - o, l = t - i, f = 2 + u + 1 + 1 + l, d = f < oi, h = si.allocUnsafe((d ? 2 : 3) + f), g = 0;
77020
+ return h[g++] = _p, d ? h[g++] = f : (h[g++] = oi | 1, h[g++] = f & 255), h[g++] = ii, h[g++] = u, o < 0 ? (h[g++] = 0, g += r.copy(h, g, 0, t)) : g += r.copy(h, g, o, t), h[g++] = ii, h[g++] = l, i < 0 ? (h[g++] = 0, r.copy(h, g, t)) : r.copy(h, g, t + i), h;
77021
77021
  }
77022
77022
  bp.exports = { derToJose: tb, joseToDer: rb };
77023
77023
  });
@@ -77259,8 +77259,8 @@ var rn = z((Xt) => {
77259
77259
  async getTokenAsync(e) {
77260
77260
  let t = this.endpoints.oauth2TokenUrl.toString(), n = new Headers(), o = { client_id: e.client_id || this._clientId, code_verifier: e.codeVerifier, code: e.code, grant_type: "authorization_code", redirect_uri: e.redirect_uri || this.redirectUri };
77261
77261
  if (this.clientAuthentication === bs.ClientSecretBasic) {
77262
- let d = Buffer.from(`${this._clientId}:${this._clientSecret}`);
77263
- n.set("authorization", `Basic ${d.toString("base64")}`);
77262
+ let f = Buffer.from(`${this._clientId}:${this._clientSecret}`);
77263
+ n.set("authorization", `Basic ${f.toString("base64")}`);
77264
77264
  }
77265
77265
  this.clientAuthentication === bs.ClientSecretPost && (o.client_secret = this._clientSecret);
77266
77266
  let i = { ...r.RETRY_CONFIG, method: "POST", url: t, data: new URLSearchParams((0, vp.removeUndefinedValuesInObject)(o)), headers: n };
@@ -77326,8 +77326,8 @@ var rn = z((Xt) => {
77326
77326
  let l = await this.processAndValidateRefreshHandler();
77327
77327
  if (l?.access_token) {
77328
77328
  this.setCredentials(l);
77329
- let d = new Headers({ authorization: "Bearer " + this.credentials.access_token });
77330
- return { headers: this.addSharedMetadataHeaders(d) };
77329
+ let f = new Headers({ authorization: "Bearer " + this.credentials.access_token });
77330
+ return { headers: this.addSharedMetadataHeaders(f) };
77331
77331
  }
77332
77332
  }
77333
77333
  if (this.apiKey) return { headers: new Headers({ "X-Goog-Api-Key": this.apiKey }) };
@@ -77335,8 +77335,8 @@ var rn = z((Xt) => {
77335
77335
  try {
77336
77336
  n = await this.refreshToken(t.refresh_token), o = n.tokens;
77337
77337
  } catch (l) {
77338
- let d = l;
77339
- throw d.response && (d.response.status === 403 || d.response.status === 404) && (d.message = `Could not refresh access token: ${d.message}`), d;
77338
+ let f = l;
77339
+ throw f.response && (f.response.status === 403 || f.response.status === 404) && (f.message = `Could not refresh access token: ${f.message}`), f;
77340
77340
  }
77341
77341
  let i = this.credentials;
77342
77342
  i.token_type = i.token_type || "Bearer", o.refresh_token = i.refresh_token, this.credentials = o;
@@ -77375,9 +77375,9 @@ var rn = z((Xt) => {
77375
77375
  } catch (n) {
77376
77376
  let o = n.response;
77377
77377
  if (o) {
77378
- let i = o.status, u = this.credentials && this.credentials.access_token && this.credentials.refresh_token && (!this.credentials.expiry_date || this.forceRefreshOnFailure), l = this.credentials && this.credentials.access_token && !this.credentials.refresh_token && (!this.credentials.expiry_date || this.forceRefreshOnFailure) && this.refreshHandler, d = o.config.data instanceof yb.Readable, f = i === 401 || i === 403;
77379
- if (!t && f && !d && u) return await this.refreshAccessTokenAsync(), this.requestAsync(e, true);
77380
- if (!t && f && !d && l) {
77378
+ let i = o.status, u = this.credentials && this.credentials.access_token && this.credentials.refresh_token && (!this.credentials.expiry_date || this.forceRefreshOnFailure), l = this.credentials && this.credentials.access_token && !this.credentials.refresh_token && (!this.credentials.expiry_date || this.forceRefreshOnFailure) && this.refreshHandler, f = o.config.data instanceof yb.Readable, d = i === 401 || i === 403;
77379
+ if (!t && d && !f && u) return await this.refreshAccessTokenAsync(), this.requestAsync(e, true);
77380
+ if (!t && d && !f && l) {
77381
77381
  let h = await this.processAndValidateRefreshHandler();
77382
77382
  return h?.access_token && this.setCredentials(h), this.requestAsync(e, true);
77383
77383
  }
@@ -77418,15 +77418,15 @@ var rn = z((Xt) => {
77418
77418
  throw new Error(`Unsupported certificate format ${t}`);
77419
77419
  }
77420
77420
  try {
77421
- let f = { ...r.RETRY_CONFIG, url: o };
77422
- In.AuthClient.setMethodName(f, "getFederatedSignonCertsAsync"), n = await this.transporter.request(f);
77423
- } catch (f) {
77424
- throw f instanceof Error && (f.message = `Failed to retrieve verification certificates: ${f.message}`), f;
77421
+ let d = { ...r.RETRY_CONFIG, url: o };
77422
+ In.AuthClient.setMethodName(d, "getFederatedSignonCertsAsync"), n = await this.transporter.request(d);
77423
+ } catch (d) {
77424
+ throw d instanceof Error && (d.message = `Failed to retrieve verification certificates: ${d.message}`), d;
77425
77425
  }
77426
77426
  let i = n?.headers.get("cache-control"), u = -1;
77427
77427
  if (i) {
77428
- let f = /max-age=(?<maxAge>[0-9]+)/.exec(i)?.groups?.maxAge;
77429
- f && (u = Number(f) * 1e3);
77428
+ let d = /max-age=(?<maxAge>[0-9]+)/.exec(i)?.groups?.maxAge;
77429
+ d && (u = Number(d) * 1e3);
77430
77430
  }
77431
77431
  let l = {};
77432
77432
  switch (t) {
@@ -77434,13 +77434,13 @@ var rn = z((Xt) => {
77434
77434
  l = n.data;
77435
77435
  break;
77436
77436
  case mr.JWK:
77437
- for (let f of n.data.keys) l[f.kid] = f;
77437
+ for (let d of n.data.keys) l[d.kid] = d;
77438
77438
  break;
77439
77439
  default:
77440
77440
  throw new Error(`Unsupported certificate format ${t}`);
77441
77441
  }
77442
- let d = /* @__PURE__ */ new Date();
77443
- return this.certificateExpiry = u === -1 ? null : new Date(d.getTime() + u), this.certificateCache = l, this.certificateCacheFormat = t, { certs: l, format: t, res: n };
77442
+ let f = /* @__PURE__ */ new Date();
77443
+ return this.certificateExpiry = u === -1 ? null : new Date(f.getTime() + u), this.certificateCache = l, this.certificateCacheFormat = t, { certs: l, format: t, res: n };
77444
77444
  }
77445
77445
  getIapPublicKeys(e) {
77446
77446
  if (e) this.getIapPublicKeysAsync().then((t) => e(null, t.pubkeys, t.res), e);
@@ -77464,7 +77464,7 @@ var rn = z((Xt) => {
77464
77464
  i || (i = r.DEFAULT_MAX_TOKEN_LIFETIME_SECS_);
77465
77465
  let l = e.split(".");
77466
77466
  if (l.length !== 3) throw new Error("Wrong number of segments in token: " + e);
77467
- let d = l[0] + "." + l[1], f = l[2], h, _;
77467
+ let f = l[0] + "." + l[1], d = l[2], h, g;
77468
77468
  try {
77469
77469
  h = JSON.parse(u.decodeBase64StringUtf8(l[0]));
77470
77470
  } catch (E) {
@@ -77472,31 +77472,31 @@ var rn = z((Xt) => {
77472
77472
  }
77473
77473
  if (!h) throw new Error("Can't parse token envelope: " + l[0]);
77474
77474
  try {
77475
- _ = JSON.parse(u.decodeBase64StringUtf8(l[1]));
77475
+ g = JSON.parse(u.decodeBase64StringUtf8(l[1]));
77476
77476
  } catch (E) {
77477
77477
  throw E instanceof Error && (E.message = `Can't parse token payload '${l[0]}`), E;
77478
77478
  }
77479
- if (!_) throw new Error("Can't parse token payload: " + l[1]);
77479
+ if (!g) throw new Error("Can't parse token payload: " + l[1]);
77480
77480
  if (!Object.prototype.hasOwnProperty.call(t, h.kid)) throw new Error("No pem found for envelope: " + JSON.stringify(h));
77481
77481
  let A = t[h.kid];
77482
- if (h.alg === "ES256" && (f = _b.joseToDer(f, "ES256").toString("base64")), !await u.verify(A, d, f)) throw new Error("Invalid token signature: " + e);
77483
- if (!_.iat) throw new Error("No issue time in token: " + JSON.stringify(_));
77484
- if (!_.exp) throw new Error("No expiration time in token: " + JSON.stringify(_));
77485
- let b = Number(_.iat);
77482
+ if (h.alg === "ES256" && (d = _b.joseToDer(d, "ES256").toString("base64")), !await u.verify(A, f, d)) throw new Error("Invalid token signature: " + e);
77483
+ if (!g.iat) throw new Error("No issue time in token: " + JSON.stringify(g));
77484
+ if (!g.exp) throw new Error("No expiration time in token: " + JSON.stringify(g));
77485
+ let b = Number(g.iat);
77486
77486
  if (isNaN(b)) throw new Error("iat field using invalid format");
77487
- let w = Number(_.exp);
77487
+ let w = Number(g.exp);
77488
77488
  if (isNaN(w)) throw new Error("exp field using invalid format");
77489
77489
  let p = (/* @__PURE__ */ new Date()).getTime() / 1e3;
77490
- if (w >= p + i) throw new Error("Expiration time too far in future: " + JSON.stringify(_));
77491
- let g = b - r.CLOCK_SKEW_SECS_, T = w + r.CLOCK_SKEW_SECS_;
77492
- if (p < g) throw new Error("Token used too early, " + p + " < " + g + ": " + JSON.stringify(_));
77493
- if (p > T) throw new Error("Token used too late, " + p + " > " + T + ": " + JSON.stringify(_));
77494
- if (o && o.indexOf(_.iss) < 0) throw new Error("Invalid issuer, expected one of [" + o + "], but got " + _.iss);
77490
+ if (w >= p + i) throw new Error("Expiration time too far in future: " + JSON.stringify(g));
77491
+ let y = b - r.CLOCK_SKEW_SECS_, T = w + r.CLOCK_SKEW_SECS_;
77492
+ if (p < y) throw new Error("Token used too early, " + p + " < " + y + ": " + JSON.stringify(g));
77493
+ if (p > T) throw new Error("Token used too late, " + p + " > " + T + ": " + JSON.stringify(g));
77494
+ if (o && o.indexOf(g.iss) < 0) throw new Error("Invalid issuer, expected one of [" + o + "], but got " + g.iss);
77495
77495
  if (typeof n < "u" && n !== null) {
77496
- let E = _.aud, S = false;
77496
+ let E = g.aud, S = false;
77497
77497
  if (n.constructor === Array ? S = n.indexOf(E) > -1 : S = E === n, !S) throw new Error("Wrong recipient, payload audience != requiredAudience");
77498
77498
  }
77499
- return new Cb.LoginTicket(h, _);
77499
+ return new Cb.LoginTicket(h, g);
77500
77500
  }
77501
77501
  async processAndValidateRefreshHandler() {
77502
77502
  if (this.refreshHandler) {
@@ -77900,14 +77900,14 @@ var Em = z((gi) => {
77900
77900
  if (typeof WeakMap == "function") var t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap();
77901
77901
  return (mi = function(i, u) {
77902
77902
  if (!u && i && i.__esModule) return i;
77903
- var l, d, f = { __proto__: null, default: i };
77904
- if (i === null || yr(i) != "object" && typeof i != "function") return f;
77903
+ var l, f, d = { __proto__: null, default: i };
77904
+ if (i === null || yr(i) != "object" && typeof i != "function") return d;
77905
77905
  if (l = u ? n : t) {
77906
77906
  if (l.has(i)) return l.get(i);
77907
- l.set(i, f);
77907
+ l.set(i, d);
77908
77908
  }
77909
- for (var h in i) h !== "default" && {}.hasOwnProperty.call(i, h) && ((d = (l = Object.defineProperty) && Object.getOwnPropertyDescriptor(i, h)) && (d.get || d.set) ? l(f, h, d) : f[h] = i[h]);
77910
- return f;
77909
+ for (var h in i) h !== "default" && {}.hasOwnProperty.call(i, h) && ((f = (l = Object.defineProperty) && Object.getOwnPropertyDescriptor(i, h)) && (f.get || f.set) ? l(d, h, f) : d[h] = i[h]);
77910
+ return d;
77911
77911
  })(r, e);
77912
77912
  }
77913
77913
  function yr(r) {
@@ -78034,7 +78034,7 @@ var Em = z((gi) => {
78034
78034
  function _t() {
78035
78035
  var r, e, t = typeof Symbol == "function" ? Symbol : {}, n = t.iterator || "@@iterator", o = t.toStringTag || "@@toStringTag";
78036
78036
  function i(P, b, w, p) {
78037
- var g = b && b.prototype instanceof l ? b : l, T = Object.create(g.prototype);
78037
+ var y = b && b.prototype instanceof l ? b : l, T = Object.create(y.prototype);
78038
78038
  return yt(T, "_invoke", (function(E, S, F) {
78039
78039
  var B, G, Z, H = 0, ae = F || [], de = false, fe = { p: 0, n: 0, v: r, a: Ee, f: Ee.bind(r, 4), d: function(Ae, oe) {
78040
78040
  return B = Ae, G = 0, Z = r, fe.n = oe, u;
@@ -78073,20 +78073,20 @@ var Em = z((gi) => {
78073
78073
  var u = {};
78074
78074
  function l() {
78075
78075
  }
78076
- function d() {
78077
- }
78078
78076
  function f() {
78079
78077
  }
78078
+ function d() {
78079
+ }
78080
78080
  e = Object.getPrototypeOf;
78081
78081
  var h = [][n] ? e(e([][n]())) : (yt(e = {}, n, function() {
78082
78082
  return this;
78083
- }), e), _ = f.prototype = l.prototype = Object.create(h);
78083
+ }), e), g = d.prototype = l.prototype = Object.create(h);
78084
78084
  function A(P) {
78085
- return Object.setPrototypeOf ? Object.setPrototypeOf(P, f) : (P.__proto__ = f, yt(P, o, "GeneratorFunction")), P.prototype = Object.create(_), P;
78085
+ return Object.setPrototypeOf ? Object.setPrototypeOf(P, d) : (P.__proto__ = d, yt(P, o, "GeneratorFunction")), P.prototype = Object.create(g), P;
78086
78086
  }
78087
- return d.prototype = f, yt(_, "constructor", f), yt(f, "constructor", d), d.displayName = "GeneratorFunction", yt(f, o, "GeneratorFunction"), yt(_), yt(_, o, "Generator"), yt(_, n, function() {
78087
+ return f.prototype = d, yt(g, "constructor", d), yt(d, "constructor", f), f.displayName = "GeneratorFunction", yt(d, o, "GeneratorFunction"), yt(g), yt(g, o, "Generator"), yt(g, n, function() {
78088
78088
  return this;
78089
- }), yt(_, "toString", function() {
78089
+ }), yt(g, "toString", function() {
78090
78090
  return "[object Generator]";
78091
78091
  }), (_t = function() {
78092
78092
  return { w: i, m: A };
@@ -78099,8 +78099,8 @@ var Em = z((gi) => {
78099
78099
  } catch {
78100
78100
  o = 0;
78101
78101
  }
78102
- yt = function(u, l, d, f) {
78103
- if (l) o ? o(u, l, { value: d, enumerable: !f, configurable: !f, writable: !f }) : u[l] = d;
78102
+ yt = function(u, l, f, d) {
78103
+ if (l) o ? o(u, l, { value: f, enumerable: !d, configurable: !d, writable: !d }) : u[l] = f;
78104
78104
  else {
78105
78105
  var h = function(A, P) {
78106
78106
  yt(u, A, function(b) {
@@ -78113,22 +78113,22 @@ var Em = z((gi) => {
78113
78113
  }
78114
78114
  function fm(r, e, t, n, o, i, u) {
78115
78115
  try {
78116
- var l = r[i](u), d = l.value;
78117
- } catch (f) {
78118
- return void t(f);
78116
+ var l = r[i](u), f = l.value;
78117
+ } catch (d) {
78118
+ return void t(d);
78119
78119
  }
78120
- l.done ? e(d) : Promise.resolve(d).then(n, o);
78120
+ l.done ? e(f) : Promise.resolve(f).then(n, o);
78121
78121
  }
78122
78122
  function Un(r) {
78123
78123
  return function() {
78124
78124
  var e = this, t = arguments;
78125
78125
  return new Promise(function(n, o) {
78126
78126
  var i = r.apply(e, t);
78127
- function u(d) {
78128
- fm(i, n, o, u, l, "next", d);
78127
+ function u(f) {
78128
+ fm(i, n, o, u, l, "next", f);
78129
78129
  }
78130
- function l(d) {
78131
- fm(i, n, o, u, l, "throw", d);
78130
+ function l(f) {
78131
+ fm(i, n, o, u, l, "throw", f);
78132
78132
  }
78133
78133
  u(void 0);
78134
78134
  });
@@ -78181,22 +78181,22 @@ var Em = z((gi) => {
78181
78181
  return $t(Qt, this, pm).call(this, n);
78182
78182
  } }, { key: "getCredentials", value: (function() {
78183
78183
  var e = Un(_t().m(function n(o) {
78184
- var i, u, l, d, f, h, _;
78184
+ var i, u, l, f, d, h, g;
78185
78185
  return _t().w(function(A) {
78186
78186
  for (; ; ) switch (A.n) {
78187
78187
  case 0:
78188
- i = cE.extname(o), _ = i, A.n = _ === ".json" ? 1 : _ === ".der" || _ === ".crt" || _ === ".pem" ? 4 : _ === ".p12" || _ === ".pfx" ? 6 : 7;
78188
+ i = cE.extname(o), g = i, A.n = g === ".json" ? 1 : g === ".der" || g === ".crt" || g === ".pem" ? 4 : g === ".p12" || g === ".pfx" ? 6 : 7;
78189
78189
  break;
78190
78190
  case 1:
78191
78191
  return A.n = 2, dm(o, "utf8");
78192
78192
  case 2:
78193
- if (u = A.v, l = JSON.parse(u), d = l.private_key, f = l.client_email, !(!d || !f)) {
78193
+ if (u = A.v, l = JSON.parse(u), f = l.private_key, d = l.client_email, !(!f || !d)) {
78194
78194
  A.n = 3;
78195
78195
  break;
78196
78196
  }
78197
78197
  throw new Ts("private_key and client_email are required.", "MISSING_CREDENTIALS");
78198
78198
  case 3:
78199
- return A.a(2, { privateKey: d, clientEmail: f });
78199
+ return A.a(2, { privateKey: f, clientEmail: d });
78200
78200
  case 4:
78201
78201
  return A.n = 5, dm(o, "utf8");
78202
78202
  case 5:
@@ -78319,17 +78319,17 @@ var Em = z((gi) => {
78319
78319
  }
78320
78320
  function mc() {
78321
78321
  return mc = Un(_t().m(function r() {
78322
- var e, t, n, o, i, u, l, d, f, h;
78323
- return _t().w(function(_) {
78324
- for (; ; ) switch (_.n) {
78322
+ var e, t, n, o, i, u, l, f, d, h;
78323
+ return _t().w(function(g) {
78324
+ for (; ; ) switch (g.n) {
78325
78325
  case 0:
78326
- return e = Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3), t = this.additionalClaims || {}, n = Object.assign({ iss: this.iss, scope: this.scope, aud: hm, exp: e + 3600, iat: e, sub: this.sub }, t), o = uE.sign({ header: { alg: "RS256" }, payload: n, secret: this.key }), _.p = 1, _.n = 2, this.transporter.request({ method: "POST", url: hm, data: new URLSearchParams({ grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer", assertion: o }), responseType: "json", retryConfig: { httpMethodsToRetry: ["POST"] } });
78326
+ return e = Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3), t = this.additionalClaims || {}, n = Object.assign({ iss: this.iss, scope: this.scope, aud: hm, exp: e + 3600, iat: e, sub: this.sub }, t), o = uE.sign({ header: { alg: "RS256" }, payload: n, secret: this.key }), g.p = 1, g.n = 2, this.transporter.request({ method: "POST", url: hm, data: new URLSearchParams({ grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer", assertion: o }), responseType: "json", retryConfig: { httpMethodsToRetry: ["POST"] } });
78327
78327
  case 2:
78328
- return i = _.v, this.rawToken = i.data, this.expiresAt = i.data.expires_in === null || i.data.expires_in === void 0 ? void 0 : (e + i.data.expires_in) * 1e3, _.a(2, this.rawToken);
78328
+ return i = g.v, this.rawToken = i.data, this.expiresAt = i.data.expires_in === null || i.data.expires_in === void 0 ? void 0 : (e + i.data.expires_in) * 1e3, g.a(2, this.rawToken);
78329
78329
  case 3:
78330
- throw _.p = 3, h = _.v, this.rawToken = void 0, this.tokenExpires = void 0, d = h.response && (u = h.response) !== null && u !== void 0 && u.data ? (l = h.response) === null || l === void 0 ? void 0 : l.data : {}, d.error && (f = d.error_description ? ": ".concat(d.error_description) : "", h.message = "".concat(d.error).concat(f)), h;
78330
+ throw g.p = 3, h = g.v, this.rawToken = void 0, this.tokenExpires = void 0, f = h.response && (u = h.response) !== null && u !== void 0 && u.data ? (l = h.response) === null || l === void 0 ? void 0 : l.data : {}, f.error && (d = f.error_description ? ": ".concat(f.error_description) : "", h.message = "".concat(f.error).concat(d)), h;
78331
78331
  case 4:
78332
- return _.a(2);
78332
+ return g.a(2);
78333
78333
  }
78334
78334
  }, r, this, [[1, 3]]);
78335
78335
  })), mc.apply(this, arguments);
@@ -78357,12 +78357,12 @@ var _c = z((yi) => {
78357
78357
  getRequestHeaders(e, t, n) {
78358
78358
  let o = this.getCachedKey(e, n), i = this.cache.get(o), u = Date.now();
78359
78359
  if (i && i.expiration - u > this.eagerRefreshThresholdMillis) return new Headers(i.headers);
78360
- let l = Math.floor(Date.now() / 1e3), d = r.getExpirationTime(l), f;
78361
- if (Array.isArray(n) && (n = n.join(" ")), n ? f = { iss: this.email, sub: this.email, scope: n, exp: d, iat: l } : f = { iss: this.email, sub: this.email, aud: e, exp: d, iat: l }, t) {
78362
- for (let b in f) if (t[b]) throw new Error(`The '${b}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`);
78360
+ let l = Math.floor(Date.now() / 1e3), f = r.getExpirationTime(l), d;
78361
+ if (Array.isArray(n) && (n = n.join(" ")), n ? d = { iss: this.email, sub: this.email, scope: n, exp: f, iat: l } : d = { iss: this.email, sub: this.email, aud: e, exp: f, iat: l }, t) {
78362
+ for (let b in d) if (t[b]) throw new Error(`The '${b}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`);
78363
78363
  }
78364
- let h = this.keyId ? { ...wm, kid: this.keyId } : wm, _ = Object.assign(f, t), A = DE.sign({ header: h, payload: _, secret: this.key }), P = new Headers({ authorization: `Bearer ${A}` });
78365
- return this.cache.set(o, { expiration: d * 1e3, headers: P }), P;
78364
+ let h = this.keyId ? { ...wm, kid: this.keyId } : wm, g = Object.assign(d, t), A = DE.sign({ header: h, payload: g, secret: this.key }), P = new Headers({ authorization: `Bearer ${A}` });
78365
+ return this.cache.set(o, { expiration: f * 1e3, headers: P }), P;
78366
78366
  }
78367
78367
  static getExpirationTime(e) {
78368
78368
  return e + 3600;
@@ -78644,8 +78644,8 @@ var Tc = z((ks) => {
78644
78644
  let u = new Error(i);
78645
78645
  if (e) {
78646
78646
  let l = Object.keys(e);
78647
- e.stack && l.push("stack"), l.forEach((d) => {
78648
- d !== "message" && Object.defineProperty(u, d, { value: e[d], writable: false, enumerable: true });
78647
+ e.stack && l.push("stack"), l.forEach((f) => {
78648
+ f !== "message" && Object.defineProperty(u, f, { value: e[f], writable: false, enumerable: true });
78649
78649
  });
78650
78650
  }
78651
78651
  return u;
@@ -78704,11 +78704,11 @@ var Ir = z((vt) => {
78704
78704
  if (n && n !== vt.EXTERNAL_ACCOUNT_TYPE) throw new Error(`Expected "${vt.EXTERNAL_ACCOUNT_TYPE}" type but received "${e.type}"`);
78705
78705
  let o = t.get("client_id"), i = t.get("client_secret");
78706
78706
  this.tokenUrl = t.get("token_url") ?? JE.replace("{universeDomain}", this.universeDomain);
78707
- let u = t.get("subject_token_type"), l = t.get("workforce_pool_user_project"), d = t.get("service_account_impersonation_url"), f = t.get("service_account_impersonation"), h = (0, Tm.originalOrCamelOptions)(f).get("token_lifetime_seconds");
78707
+ let u = t.get("subject_token_type"), l = t.get("workforce_pool_user_project"), f = t.get("service_account_impersonation_url"), d = t.get("service_account_impersonation"), h = (0, Tm.originalOrCamelOptions)(d).get("token_lifetime_seconds");
78708
78708
  this.cloudResourceManagerURL = new URL(t.get("cloud_resource_manager_url") || `https://cloudresourcemanager.${this.universeDomain}/v1/projects/`), o && (this.clientAuth = { confidentialClientType: "basic", clientId: o, clientSecret: i }), this.stsCredential = new UE.StsCredentials({ tokenExchangeEndpoint: this.tokenUrl, clientAuthentication: this.clientAuth }), this.scopes = t.get("scopes") || [kc], this.cachedAccessToken = null, this.audience = t.get("audience"), this.subjectTokenType = u, this.workforcePoolUserProject = l;
78709
- let _ = new RegExp(WE);
78710
- if (this.workforcePoolUserProject && !this.audience.match(_)) throw new Error("workforcePoolUserProject should not be set for non-workforce pool credentials.");
78711
- this.serviceAccountImpersonationUrl = d, this.serviceAccountImpersonationLifetime = h, this.serviceAccountImpersonationLifetime ? this.configLifetimeRequested = true : (this.configLifetimeRequested = false, this.serviceAccountImpersonationLifetime = GE), this.projectNumber = this.getProjectNumber(this.audience), this.supplierContext = { audience: this.audience, subjectTokenType: this.subjectTokenType, transporter: this.transporter };
78709
+ let g = new RegExp(WE);
78710
+ if (this.workforcePoolUserProject && !this.audience.match(g)) throw new Error("workforcePoolUserProject should not be set for non-workforce pool credentials.");
78711
+ this.serviceAccountImpersonationUrl = f, this.serviceAccountImpersonationLifetime = h, this.serviceAccountImpersonationLifetime ? this.configLifetimeRequested = true : (this.configLifetimeRequested = false, this.serviceAccountImpersonationLifetime = GE), this.projectNumber = this.getProjectNumber(this.audience), this.supplierContext = { audience: this.audience, subjectTokenType: this.subjectTokenType, transporter: this.transporter };
78712
78712
  }
78713
78713
  getServiceAccountEmail() {
78714
78714
  if (this.serviceAccountImpersonationUrl) {
@@ -78934,18 +78934,18 @@ var km = z((Ct) => {
78934
78934
  let t = new Ti.X509Certificate(e);
78935
78935
  if (!this.trustChainPath) return JSON.stringify([t.raw.toString("base64")]);
78936
78936
  try {
78937
- let i = ((await Si.promises.readFile(this.trustChainPath, "utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g) ?? []).map((d, f) => {
78937
+ let i = ((await Si.promises.readFile(this.trustChainPath, "utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g) ?? []).map((f, d) => {
78938
78938
  try {
78939
- return new Ti.X509Certificate(d);
78939
+ return new Ti.X509Certificate(f);
78940
78940
  } catch (h) {
78941
- let _ = h instanceof Error ? h.message : String(h);
78942
- throw new Rt(`Failed to parse certificate at index ${f} in trust chain file ${this.trustChainPath}: ${_}`);
78941
+ let g = h instanceof Error ? h.message : String(h);
78942
+ throw new Rt(`Failed to parse certificate at index ${d} in trust chain file ${this.trustChainPath}: ${g}`);
78943
78943
  }
78944
- }), u = i.findIndex((d) => t.raw.equals(d.raw)), l;
78944
+ }), u = i.findIndex((f) => t.raw.equals(f.raw)), l;
78945
78945
  if (u === -1) l = [t, ...i];
78946
78946
  else if (u === 0) l = i;
78947
78947
  else throw new Rt(`Leaf certificate exists in the trust chain but is not the first entry (found at index ${u}).`);
78948
- return JSON.stringify(l.map((d) => d.raw.toString("base64")));
78948
+ return JSON.stringify(l.map((f) => f.raw.toString("base64")));
78949
78949
  } catch (n) {
78950
78950
  if (n instanceof Rt) throw n;
78951
78951
  let o = n instanceof Error ? n.message : String(n);
@@ -78968,16 +78968,16 @@ var jc = z((vi) => {
78968
78968
  if (n && o) throw new Error("Only one of credential source or subject token supplier can be specified.");
78969
78969
  if (o) this.subjectTokenSupplier = o, this.credentialSourceType = "programmatic";
78970
78970
  else {
78971
- let i = (0, Nc.originalOrCamelOptions)(n), u = (0, Nc.originalOrCamelOptions)(i.get("format")), l = u.get("type") || "text", d = u.get("subject_token_field_name");
78971
+ let i = (0, Nc.originalOrCamelOptions)(n), u = (0, Nc.originalOrCamelOptions)(i.get("format")), l = u.get("type") || "text", f = u.get("subject_token_field_name");
78972
78972
  if (l !== "json" && l !== "text") throw new Error(`Invalid credential_source format "${l}"`);
78973
- if (l === "json" && !d) throw new Error("Missing subject_token_field_name for JSON credential_source format");
78974
- let f = i.get("file"), h = i.get("url"), _ = i.get("certificate"), A = i.get("headers");
78975
- if (f && h || h && _ || f && _) throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.');
78976
- if (f) this.credentialSourceType = "file", this.subjectTokenSupplier = new ZE.FileSubjectTokenSupplier({ filePath: f, formatType: l, subjectTokenFieldName: d });
78977
- else if (h) this.credentialSourceType = "url", this.subjectTokenSupplier = new ew.UrlSubjectTokenSupplier({ url: h, formatType: l, subjectTokenFieldName: d, headers: A, additionalGaxiosOptions: r.RETRY_CONFIG });
78978
- else if (_) {
78973
+ if (l === "json" && !f) throw new Error("Missing subject_token_field_name for JSON credential_source format");
78974
+ let d = i.get("file"), h = i.get("url"), g = i.get("certificate"), A = i.get("headers");
78975
+ if (d && h || h && g || d && g) throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.');
78976
+ if (d) this.credentialSourceType = "file", this.subjectTokenSupplier = new ZE.FileSubjectTokenSupplier({ filePath: d, formatType: l, subjectTokenFieldName: f });
78977
+ else if (h) this.credentialSourceType = "url", this.subjectTokenSupplier = new ew.UrlSubjectTokenSupplier({ url: h, formatType: l, subjectTokenFieldName: f, headers: A, additionalGaxiosOptions: r.RETRY_CONFIG });
78978
+ else if (g) {
78979
78979
  this.credentialSourceType = "certificate";
78980
- let P = new Fm.CertificateSubjectTokenSupplier({ useDefaultCertificateConfig: _.use_default_certificate_config, certificateConfigLocation: _.certificate_config_location, trustChainPath: _.trust_chain_path });
78980
+ let P = new Fm.CertificateSubjectTokenSupplier({ useDefaultCertificateConfig: g.use_default_certificate_config, certificateConfigLocation: g.certificate_config_location, trustChainPath: g.trust_chain_path });
78981
78981
  this.subjectTokenSupplier = P;
78982
78982
  } else throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.');
78983
78983
  }
@@ -79006,12 +79006,12 @@ var Uc = z((ki) => {
79006
79006
  }
79007
79007
  async getRequestOptions(e) {
79008
79008
  if (!e.url) throw new RangeError('"url" is required in "amzOptions"');
79009
- let t = typeof e.data == "object" ? JSON.stringify(e.data) : e.data, n = e.url, o = e.method || "GET", i = e.body || t, u = e.headers, l = await this.getCredentials(), d = new URL(n);
79009
+ let t = typeof e.data == "object" ? JSON.stringify(e.data) : e.data, n = e.url, o = e.method || "GET", i = e.body || t, u = e.headers, l = await this.getCredentials(), f = new URL(n);
79010
79010
  if (typeof i != "string" && i !== void 0) throw new TypeError(`'requestPayload' is expected to be a string if provided. Got: ${i}`);
79011
- let f = await sw({ crypto: this.crypto, host: d.host, canonicalUri: d.pathname, canonicalQuerystring: d.search.slice(1), method: o, region: this.region, securityCredentials: l, requestPayload: i, additionalAmzHeaders: u }), h = Ri.Gaxios.mergeHeaders(f.amzDate ? { "x-amz-date": f.amzDate } : {}, { authorization: f.authorizationHeader, host: d.host }, u || {});
79011
+ let d = await sw({ crypto: this.crypto, host: f.host, canonicalUri: f.pathname, canonicalQuerystring: f.search.slice(1), method: o, region: this.region, securityCredentials: l, requestPayload: i, additionalAmzHeaders: u }), h = Ri.Gaxios.mergeHeaders(d.amzDate ? { "x-amz-date": d.amzDate } : {}, { authorization: d.authorizationHeader, host: f.host }, u || {});
79012
79012
  l.token && Ri.Gaxios.mergeHeaders(h, { "x-amz-security-token": l.token });
79013
- let _ = { url: n, method: o, headers: h };
79014
- return i !== void 0 && (_.body = i), _;
79013
+ let g = { url: n, method: o, headers: h };
79014
+ return i !== void 0 && (g.body = i), g;
79015
79015
  }
79016
79016
  };
79017
79017
  ki.AwsRequestSigner = Lc;
@@ -79025,21 +79025,21 @@ var Uc = z((ki) => {
79025
79025
  async function sw(r) {
79026
79026
  let e = Ri.Gaxios.mergeHeaders(r.additionalAmzHeaders), t = r.requestPayload || "", n = r.host.split(".")[0], o = /* @__PURE__ */ new Date(), i = o.toISOString().replace(/[-:]/g, "").replace(/\.[0-9]+/, ""), u = o.toISOString().replace(/[-]/g, "").replace(/T.*/, "");
79027
79027
  r.securityCredentials.token && e.set("x-amz-security-token", r.securityCredentials.token);
79028
- let l = Ri.Gaxios.mergeHeaders({ host: r.host }, e.has("date") ? {} : { "x-amz-date": i }, e), d = "", f = [...l.keys()].sort();
79029
- f.forEach((T) => {
79030
- d += `${T}:${l.get(T)}
79028
+ let l = Ri.Gaxios.mergeHeaders({ host: r.host }, e.has("date") ? {} : { "x-amz-date": i }, e), f = "", d = [...l.keys()].sort();
79029
+ d.forEach((T) => {
79030
+ f += `${T}:${l.get(T)}
79031
79031
  `;
79032
79032
  });
79033
- let h = f.join(";"), _ = await r.crypto.sha256DigestHex(t), A = `${r.method.toUpperCase()}
79033
+ let h = d.join(";"), g = await r.crypto.sha256DigestHex(t), A = `${r.method.toUpperCase()}
79034
79034
  ${r.canonicalUri}
79035
79035
  ${r.canonicalQuerystring}
79036
- ${d}
79036
+ ${f}
79037
79037
  ${h}
79038
- ${_}`, P = `${u}/${r.region}/${n}/${rw}`, b = `${Pm}
79038
+ ${g}`, P = `${u}/${r.region}/${n}/${rw}`, b = `${Pm}
79039
79039
  ${i}
79040
79040
  ${P}
79041
- ` + await r.crypto.sha256DigestHex(A), w = await nw(r.crypto, r.securityCredentials.secretAccessKey, u, r.region, n), p = await Fs(r.crypto, w, b), g = `${Pm} Credential=${r.securityCredentials.accessKeyId}/${P}, SignedHeaders=${h}, Signature=${(0, xm.fromArrayBufferToHex)(p)}`;
79042
- return { amzDate: e.has("date") ? void 0 : i, authorizationHeader: g, canonicalQuerystring: r.canonicalQuerystring };
79041
+ ` + await r.crypto.sha256DigestHex(A), w = await nw(r.crypto, r.securityCredentials.secretAccessKey, u, r.region, n), p = await Fs(r.crypto, w, b), y = `${Pm} Credential=${r.securityCredentials.accessKeyId}/${P}, SignedHeaders=${h}, Signature=${(0, xm.fromArrayBufferToHex)(p)}`;
79042
+ return { amzDate: e.has("date") ? void 0 : i, authorizationHeader: y, canonicalQuerystring: r.canonicalQuerystring };
79043
79043
  }
79044
79044
  });
79045
79045
  var Bm = z((Oi) => {
@@ -79114,8 +79114,8 @@ var Hc = z((Pi) => {
79114
79114
  else {
79115
79115
  let i = (0, Im.originalOrCamelOptions)(n);
79116
79116
  this.environmentId = i.get("environment_id");
79117
- let u = i.get("region_url"), l = i.get("url"), d = i.get("imdsv2_session_token_url");
79118
- this.awsSecurityCredentialsSupplier = new aw.DefaultAwsSecurityCredentialsSupplier({ regionUrl: u, securityCredentialsUrl: l, imdsV2SessionTokenUrl: d }), this.regionalCredVerificationUrl = i.get("regional_cred_verification_url"), this.credentialSourceType = "aws", this.validateEnvironmentId();
79117
+ let u = i.get("region_url"), l = i.get("url"), f = i.get("imdsv2_session_token_url");
79118
+ this.awsSecurityCredentialsSupplier = new aw.DefaultAwsSecurityCredentialsSupplier({ regionUrl: u, securityCredentialsUrl: l, imdsV2SessionTokenUrl: f }), this.regionalCredVerificationUrl = i.get("regional_cred_verification_url"), this.credentialSourceType = "aws", this.validateEnvironmentId();
79119
79119
  }
79120
79120
  this.awsRequestSigner = null, this.region = "";
79121
79121
  }
@@ -79229,10 +79229,10 @@ var Xc = z((Gn) => {
79229
79229
  let u = setTimeout(() => (o.removeAllListeners(), o.kill(), n(new Error("The executable failed to finish within the timeout specified."))), this.timeoutMillis);
79230
79230
  o.on("close", (l) => {
79231
79231
  if (clearTimeout(u), l === 0) try {
79232
- let d = JSON.parse(i), f = new nn.ExecutableResponse(d);
79233
- return t(f);
79234
- } catch (d) {
79235
- return d instanceof nn.ExecutableResponseError ? n(d) : n(new nn.ExecutableResponseError(`The executable returned an invalid response: ${i}`));
79232
+ let f = JSON.parse(i), d = new nn.ExecutableResponse(f);
79233
+ return t(d);
79234
+ } catch (f) {
79235
+ return f instanceof nn.ExecutableResponseError ? n(f) : n(new nn.ExecutableResponseError(`The executable returned an invalid response: ${i}`));
79236
79236
  }
79237
79237
  else return n(new Li(i, l.toString()));
79238
79238
  });
@@ -79947,36 +79947,36 @@ async function Hf(r, e, t) {
79947
79947
  }
79948
79948
  function Gf(r, e, t, n, o) {
79949
79949
  let i = new Headers({ "Content-Type": "application/json" });
79950
- t.headers && Object.entries(t.headers).forEach(([f, h]) => {
79951
- h && i.set(f, h);
79950
+ t.headers && Object.entries(t.headers).forEach(([d, h]) => {
79951
+ h && i.set(d, h);
79952
79952
  });
79953
79953
  let u, l = AbortSignal.timeout(t.TIMEOUT ?? 60 * 1e3 * 60);
79954
79954
  if (t.signal) {
79955
- let f = new AbortController(), h = () => f.abort();
79956
- t.signal.addEventListener("abort", h), l.addEventListener("abort", h), u = f.signal;
79955
+ let d = new AbortController(), h = () => d.abort();
79956
+ t.signal.addEventListener("abort", h), l.addEventListener("abort", h), u = d.signal;
79957
79957
  } else u = l;
79958
- let d = { method: "POST", headers: i, body: JSON.stringify(e), signal: u };
79959
- return t.httpsProxy && (d.dispatcher = new import_undici.ProxyAgent(new URL(t.httpsProxy).toString())), n?.debug({ reqId: o.req.id, request: d, headers: Object.fromEntries(i.entries()), requestUrl: typeof r == "string" ? r : r.toString(), useProxy: t.httpsProxy }, "final request"), fetch(typeof r == "string" ? r : r.toString(), d);
79958
+ let f = { method: "POST", headers: i, body: JSON.stringify(e), signal: u };
79959
+ return t.httpsProxy && (f.dispatcher = new import_undici.ProxyAgent(new URL(t.httpsProxy).toString())), n?.debug({ reqId: o.req.id, request: f, headers: Object.fromEntries(i.entries()), requestUrl: typeof r == "string" ? r : r.toString(), useProxy: t.httpsProxy }, "final request"), fetch(typeof r == "string" ? r : r.toString(), f);
79960
79960
  }
79961
- var Wf = "1.0.41";
79961
+ var Wf = "1.0.42";
79962
79962
  async function f0(r, e, t, n) {
79963
79963
  let o = r.body, i = r.provider, u = t._server.providerService.getProvider(i);
79964
79964
  if (!u) throw nt(`Provider '${i}' not found`, 404, "provider_not_found");
79965
- let { requestBody: l, config: d, bypass: f } = await d0(o, u, n, r.headers, { req: r }), h = await p0(l, d, u, t, f, n, { req: r }), _ = await m0(l, h, u, n, f, { req: r });
79966
- return g0(_, e, o);
79965
+ let { requestBody: l, config: f, bypass: d } = await d0(o, u, n, r.headers, { req: r }), h = await p0(l, f, u, t, d, n, { req: r }), g = await m0(l, h, u, n, d, { req: r });
79966
+ return g0(g, e, o);
79967
79967
  }
79968
79968
  async function d0(r, e, t, n, o) {
79969
79969
  let i = r, u = {}, l = false;
79970
79970
  if (l = h0(e, t, r), l && (n instanceof Headers ? n.delete("content-length") : delete n["content-length"], u.headers = n), !l && typeof t.transformRequestOut == "function") {
79971
- let d = await t.transformRequestOut(i);
79972
- d.body ? (i = d.body, u = d.config || {}) : i = d;
79971
+ let f = await t.transformRequestOut(i);
79972
+ f.body ? (i = f.body, u = f.config || {}) : i = f;
79973
79973
  }
79974
- if (!l && e.transformer?.use?.length) for (let d of e.transformer.use) {
79975
- if (!d || typeof d.transformRequestIn != "function") continue;
79976
- let f = await d.transformRequestIn(i, e, o);
79977
- f.body ? (i = f.body, u = { ...u, ...f.config }) : i = f;
79974
+ if (!l && e.transformer?.use?.length) for (let f of e.transformer.use) {
79975
+ if (!f || typeof f.transformRequestIn != "function") continue;
79976
+ let d = await f.transformRequestIn(i, e, o);
79977
+ d.body ? (i = d.body, u = { ...u, ...d.config }) : i = d;
79978
79978
  }
79979
- if (!l && e.transformer?.[r.model]?.use?.length) for (let d of e.transformer[r.model].use) !d || typeof d.transformRequestIn != "function" || (i = await d.transformRequestIn(i, e, o));
79979
+ if (!l && e.transformer?.[r.model]?.use?.length) for (let f of e.transformer[r.model].use) !f || typeof f.transformRequestIn != "function" || (i = await f.transformRequestIn(i, e, o));
79980
79980
  return { requestBody: i, config: u, bypass: l };
79981
79981
  }
79982
79982
  function h0(r, e, t) {
@@ -79985,17 +79985,19 @@ function h0(r, e, t) {
79985
79985
  async function p0(r, e, t, n, o, i, u) {
79986
79986
  let l = e.url || new URL(t.baseUrl);
79987
79987
  if (o && typeof i.auth == "function") {
79988
- let f = await i.auth(r, t);
79989
- if (f.body) {
79990
- r = f.body;
79991
- let h = e.headers || {};
79992
- f.config?.headers && (h = { ...h, ...f.config.headers }, delete h.host, delete f.config.headers), e = { ...e, ...f.config, headers: h };
79993
- } else r = f;
79994
- }
79995
- let d = await Gf(l, r, { httpsProxy: n._server.configService.getHttpsProxy(), ...e, headers: { Authorization: `Bearer ${t.apiKey}`, ...e?.headers || {} } }, n.log, u);
79988
+ let h = await i.auth(r, t);
79989
+ if (h.body) {
79990
+ r = h.body;
79991
+ let g = e.headers || {};
79992
+ h.config?.headers && (g = { ...g, ...h.config.headers }, delete g.host, delete h.config.headers), e = { ...e, ...h.config, headers: g };
79993
+ } else r = h;
79994
+ }
79995
+ let f = { ...e?.headers || {} };
79996
+ !f.authorization && !f.Authorization && !f["x-api-key"] && (f.Authorization = `Bearer ${t.apiKey}`);
79997
+ let d = await Gf(l, r, { httpsProxy: n._server.configService.getHttpsProxy(), ...e, headers: f }, n.log, u);
79996
79998
  if (!d.ok) {
79997
- let f = await d.text();
79998
- throw nt(`Error from provider(${t.name},${r.model}: ${d.status}): ${f}`, d.status, "provider_response_error");
79999
+ let h = await d.text();
80000
+ throw nt(`Error from provider(${t.name},${r.model}: ${d.status}): ${h}`, d.status, "provider_response_error");
79999
80001
  }
80000
80002
  return d;
80001
80003
  }
@@ -80252,19 +80254,19 @@ var bo = class {
80252
80254
  }
80253
80255
  if (Array.isArray(i.content)) {
80254
80256
  if (i.role === "user") {
80255
- let l = i.content.filter((f) => f.type === "tool_result" && f.tool_use_id);
80256
- l.length && l.forEach((f, h) => {
80257
- let _ = { role: "tool", content: typeof f.content == "string" ? f.content : JSON.stringify(f.content), tool_call_id: f.tool_use_id, cache_control: f.cache_control };
80258
- t.push(_);
80257
+ let l = i.content.filter((d) => d.type === "tool_result" && d.tool_use_id);
80258
+ l.length && l.forEach((d, h) => {
80259
+ let g = { role: "tool", content: typeof d.content == "string" ? d.content : JSON.stringify(d.content), tool_call_id: d.tool_use_id, cache_control: d.cache_control };
80260
+ t.push(g);
80259
80261
  });
80260
- let d = i.content.filter((f) => f.type === "text" && f.text || f.type === "image" && f.source);
80261
- d.length && t.push({ role: "user", content: d.map((f) => f?.type === "image" ? { type: "image_url", image_url: { url: f.source?.type === "base64" ? Kf(f.source.data, f.source.media_type) : f.source.url }, media_type: f.source.media_type } : f) });
80262
+ let f = i.content.filter((d) => d.type === "text" && d.text || d.type === "image" && d.source);
80263
+ f.length && t.push({ role: "user", content: f.map((d) => d?.type === "image" ? { type: "image_url", image_url: { url: d.source?.type === "base64" ? Kf(d.source.data, d.source.media_type) : d.source.url }, media_type: d.source.media_type } : d) });
80262
80264
  } else if (i.role === "assistant") {
80263
- let l = { role: "assistant", content: "" }, d = i.content.filter((h) => h.type === "text" && h.text);
80264
- d.length && (l.content = d.map((h) => h.text).join(`
80265
+ let l = { role: "assistant", content: "" }, f = i.content.filter((h) => h.type === "text" && h.text);
80266
+ f.length && (l.content = f.map((h) => h.text).join(`
80265
80267
  `));
80266
- let f = i.content.filter((h) => h.type === "tool_use" && h.id);
80267
- f.length && (l.tool_calls = f.map((h) => ({ id: h.id, type: "function", function: { name: h.name, arguments: JSON.stringify(h.input || {}) } }))), t.push(l);
80268
+ let d = i.content.filter((h) => h.type === "tool_use" && h.id);
80269
+ d.length && (l.tool_calls = d.map((h) => ({ id: h.id, type: "function", function: { name: h.name, arguments: JSON.stringify(h.input || {}) } }))), t.push(l);
80268
80270
  }
80269
80271
  return;
80270
80272
  }
@@ -80288,20 +80290,20 @@ var bo = class {
80288
80290
  }
80289
80291
  async convertOpenAIStreamToAnthropic(e, t) {
80290
80292
  return new ReadableStream({ start: async (o) => {
80291
- let i = new TextEncoder(), u = `msg_${Date.now()}`, l = null, d = "unknown", f = false, h = false, _ = false, A = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), b = 0, w = 0, p = 0, g = false, T = false, E = 0, S = -1, F = () => {
80293
+ let i = new TextEncoder(), u = `msg_${Date.now()}`, l = null, f = "unknown", d = false, h = false, g = false, A = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), b = 0, w = 0, p = 0, y = false, T = false, E = 0, S = -1, F = () => {
80292
80294
  let H = E;
80293
80295
  return E++, H;
80294
80296
  }, B = (H) => {
80295
- if (!g) try {
80297
+ if (!y) try {
80296
80298
  o.enqueue(H);
80297
80299
  let ae = new TextDecoder().decode(H);
80298
80300
  this.logger.debug({ reqId: t.req.id, data: ae, type: "send data" });
80299
80301
  } catch (ae) {
80300
- if (ae instanceof TypeError && ae.message.includes("Controller is already closed")) g = true;
80302
+ if (ae instanceof TypeError && ae.message.includes("Controller is already closed")) y = true;
80301
80303
  else throw this.logger.debug({ reqId: t.req.id, error: ae.message, type: "send data error" }), ae;
80302
80304
  }
80303
80305
  }, G = () => {
80304
- if (!g) try {
80306
+ if (!y) try {
80305
80307
  if (S >= 0) {
80306
80308
  let ae = { type: "content_block_stop", index: S };
80307
80309
  B(i.encode(`event: content_block_stop
@@ -80320,16 +80322,16 @@ data: ${JSON.stringify({ type: "message_delta", delta: { stop_reason: "end_turn"
80320
80322
  B(i.encode(`event: message_stop
80321
80323
  data: ${JSON.stringify(H)}
80322
80324
 
80323
- `)), o.close(), g = true;
80325
+ `)), o.close(), y = true;
80324
80326
  } catch (H) {
80325
- if (H instanceof TypeError && H.message.includes("Controller is already closed")) g = true;
80327
+ if (H instanceof TypeError && H.message.includes("Controller is already closed")) y = true;
80326
80328
  else throw H;
80327
80329
  }
80328
80330
  }, Z = null;
80329
80331
  try {
80330
80332
  Z = e.getReader();
80331
80333
  let H = new TextDecoder(), ae = "";
80332
- for (; !g; ) {
80334
+ for (; !y; ) {
80333
80335
  let { done: de, value: fe } = await Z.read();
80334
80336
  if (de) break;
80335
80337
  ae += H.decode(fe, { stream: true });
@@ -80337,7 +80339,7 @@ data: ${JSON.stringify(H)}
80337
80339
  `);
80338
80340
  ae = Ee.pop() || "";
80339
80341
  for (let Ce of Ee) {
80340
- if (g || _) break;
80342
+ if (y || g) break;
80341
80343
  if (!Ce.startsWith("data:")) continue;
80342
80344
  let Ae = Ce.slice(5).trim();
80343
80345
  if (this.logger.debug({ reqId: t.req.id, type: "recieved data", data: Ae }), Ae !== "[DONE]") try {
@@ -80350,9 +80352,9 @@ data: ${JSON.stringify(J)}
80350
80352
  `));
80351
80353
  continue;
80352
80354
  }
80353
- if (d = oe.model || d, !f && !g && !_) {
80354
- f = true;
80355
- let J = { type: "message_start", message: { id: u, type: "message", role: "assistant", content: [], model: d, stop_reason: null, stop_sequence: null, usage: { input_tokens: 0, output_tokens: 0 } } };
80355
+ if (f = oe.model || f, !d && !y && !g) {
80356
+ d = true;
80357
+ let J = { type: "message_start", message: { id: u, type: "message", role: "assistant", content: [], model: f, stop_reason: null, stop_sequence: null, usage: { input_tokens: 0, output_tokens: 0 } } };
80356
80358
  B(i.encode(`event: message_start
80357
80359
  data: ${JSON.stringify(J)}
80358
80360
 
@@ -80360,7 +80362,7 @@ data: ${JSON.stringify(J)}
80360
80362
  }
80361
80363
  let he = oe.choices?.[0];
80362
80364
  if (oe.usage && (l ? l.usage = { input_tokens: oe.usage?.prompt_tokens || 0, output_tokens: oe.usage?.completion_tokens || 0, cache_read_input_tokens: oe.usage?.cache_read_input_tokens || 0 } : l = { type: "message_delta", delta: { stop_reason: "end_turn", stop_sequence: null }, usage: { input_tokens: oe.usage?.prompt_tokens || 0, output_tokens: oe.usage?.completion_tokens || 0, cache_read_input_tokens: oe.usage?.cache_read_input_tokens || 0 } }), !he) continue;
80363
- if (he?.delta?.thinking && !g && !_) {
80365
+ if (he?.delta?.thinking && !y && !g) {
80364
80366
  if (!T) {
80365
80367
  let J = F(), V = { type: "content_block_start", index: J, content_block: { type: "thinking", thinking: "" } };
80366
80368
  B(i.encode(`event: content_block_start
@@ -80387,7 +80389,7 @@ data: ${JSON.stringify(J)}
80387
80389
  `));
80388
80390
  }
80389
80391
  }
80390
- if (he?.delta?.content && !g && !_) {
80392
+ if (he?.delta?.content && !y && !g) {
80391
80393
  if (w++, S >= 0 && !h) {
80392
80394
  let V = { type: "content_block_stop", index: S };
80393
80395
  B(i.encode(`event: content_block_stop
@@ -80395,7 +80397,7 @@ data: ${JSON.stringify(V)}
80395
80397
 
80396
80398
  `)), S = -1;
80397
80399
  }
80398
- if (!h && !_) {
80400
+ if (!h && !g) {
80399
80401
  h = true;
80400
80402
  let J = F(), V = { type: "content_block_start", index: J, content_block: { type: "text", text: "" } };
80401
80403
  B(i.encode(`event: content_block_start
@@ -80403,7 +80405,7 @@ data: ${JSON.stringify(V)}
80403
80405
 
80404
80406
  `)), S = J;
80405
80407
  }
80406
- if (!g && !_) {
80408
+ if (!y && !g) {
80407
80409
  let J = { type: "content_block_delta", index: S, delta: { type: "text_delta", text: he.delta.content } };
80408
80410
  B(i.encode(`event: content_block_delta
80409
80411
  data: ${JSON.stringify(J)}
@@ -80411,7 +80413,7 @@ data: ${JSON.stringify(J)}
80411
80413
  `));
80412
80414
  }
80413
80415
  }
80414
- if (he?.delta?.annotations?.length && !g && !_) {
80416
+ if (he?.delta?.annotations?.length && !y && !g) {
80415
80417
  if (S >= 0 && h) {
80416
80418
  let J = { type: "content_block_stop", index: S };
80417
80419
  B(i.encode(`event: content_block_stop
@@ -80432,11 +80434,11 @@ data: ${JSON.stringify(Ue)}
80432
80434
  `)), S = -1;
80433
80435
  });
80434
80436
  }
80435
- if (he?.delta?.tool_calls && !g && !_) {
80437
+ if (he?.delta?.tool_calls && !y && !g) {
80436
80438
  p++;
80437
80439
  let J = /* @__PURE__ */ new Set();
80438
80440
  for (let V of he.delta.tool_calls) {
80439
- if (g) break;
80441
+ if (y) break;
80440
80442
  let se = V.index ?? 0;
80441
80443
  if (J.has(se)) continue;
80442
80444
  if (J.add(se), !P.has(se)) {
@@ -80460,7 +80462,7 @@ data: ${JSON.stringify(ge)}
80460
80462
  let ve = A.get(se);
80461
80463
  ve.id.startsWith("call_") && ve.name.startsWith("tool_") && (ve.id = V.id, ve.name = V.function.name);
80462
80464
  }
80463
- if (V.function?.arguments && !g && !_) {
80465
+ if (V.function?.arguments && !y && !g) {
80464
80466
  let ve = P.get(se);
80465
80467
  if (ve === void 0) continue;
80466
80468
  let W = A.get(se);
@@ -80485,7 +80487,7 @@ data: ${JSON.stringify(ut)}
80485
80487
  }
80486
80488
  }
80487
80489
  }
80488
- if (he?.finish_reason && !g && !_) {
80490
+ if (he?.finish_reason && !y && !g) {
80489
80491
  if (w === 0 && p === 0 && console.error("Warning: No content in the stream response!"), S >= 0) {
80490
80492
  let J = { type: "content_block_stop", index: S };
80491
80493
  B(i.encode(`event: content_block_stop
@@ -80493,7 +80495,7 @@ data: ${JSON.stringify(J)}
80493
80495
 
80494
80496
  `)), S = -1;
80495
80497
  }
80496
- g || (l = { type: "message_delta", delta: { stop_reason: { stop: "end_turn", length: "max_tokens", tool_calls: "tool_use", content_filter: "stop_sequence" }[he.finish_reason] || "end_turn", stop_sequence: null }, usage: { input_tokens: oe.usage?.prompt_tokens || 0, output_tokens: oe.usage?.completion_tokens || 0, cache_read_input_tokens: oe.usage?.cache_read_input_tokens || 0 } });
80498
+ y || (l = { type: "message_delta", delta: { stop_reason: { stop: "end_turn", length: "max_tokens", tool_calls: "tool_use", content_filter: "stop_sequence" }[he.finish_reason] || "end_turn", stop_sequence: null }, usage: { input_tokens: oe.usage?.prompt_tokens || 0, output_tokens: oe.usage?.completion_tokens || 0, cache_read_input_tokens: oe.usage?.cache_read_input_tokens || 0 } });
80497
80499
  break;
80498
80500
  }
80499
80501
  } catch (oe) {
@@ -80503,7 +80505,7 @@ data: ${JSON.stringify(J)}
80503
80505
  }
80504
80506
  G();
80505
80507
  } catch (H) {
80506
- if (!g) try {
80508
+ if (!y) try {
80507
80509
  o.error(H);
80508
80510
  } catch (ae) {
80509
80511
  console.error(ae);
@@ -80530,14 +80532,14 @@ data: ${JSON.stringify(J)}
80530
80532
  o.push({ type: "server_tool_use", id: u, name: "web_search", input: { query: "" } }), o.push({ type: "web_search_tool_result", tool_use_id: u, content: n.message.annotations.map((l) => ({ type: "web_search_result", url: l.url_citation.url, title: l.url_citation.title })) });
80531
80533
  }
80532
80534
  n.message.content && o.push({ type: "text", text: n.message.content }), n.message.tool_calls && n.message.tool_calls.length > 0 && n.message.tool_calls.forEach((u, l) => {
80533
- let d = {};
80535
+ let f = {};
80534
80536
  try {
80535
- let f = u.function.arguments || "{}";
80536
- typeof f == "object" ? d = f : typeof f == "string" && (d = JSON.parse(f));
80537
+ let d = u.function.arguments || "{}";
80538
+ typeof d == "object" ? f = d : typeof d == "string" && (f = JSON.parse(d));
80537
80539
  } catch {
80538
- d = { text: u.function.arguments || "" };
80540
+ f = { text: u.function.arguments || "" };
80539
80541
  }
80540
- o.push({ type: "tool_use", id: u.id, name: u.function.name, input: d });
80542
+ o.push({ type: "tool_use", id: u.id, name: u.function.name, input: f });
80541
80543
  }), n.message?.thinking?.content && o.push({ type: "thinking", thinking: n.message.thinking.content, signature: n.message.thinking.signature });
80542
80544
  let i = { id: e.id, type: "message", role: "assistant", model: e.model, content: o, stop_reason: n.finish_reason === "stop" ? "end_turn" : n.finish_reason === "length" ? "max_tokens" : n.finish_reason === "tool_calls" ? "tool_use" : n.finish_reason === "content_filter" ? "stop_sequence" : "end_turn", stop_sequence: null, usage: { input_tokens: e.usage?.prompt_tokens || 0, output_tokens: e.usage?.completion_tokens || 0 } };
80543
80545
  return this.logger.debug({ reqId: t.req.id, result: i }, "Conversion complete, final Anthropic response"), i;
@@ -80569,23 +80571,23 @@ function is(r) {
80569
80571
  for (let [u, l] of Object.entries(r)) if (l != null) if (u == "type") {
80570
80572
  if (l === "null") throw new Error("type: null can not be the only possible type for the field.");
80571
80573
  if (Array.isArray(l)) continue;
80572
- let d = l.toUpperCase();
80573
- e.type = Object.values(Cn).includes(d) ? d : Cn.TYPE_UNSPECIFIED;
80574
+ let f = l.toUpperCase();
80575
+ e.type = Object.values(Cn).includes(f) ? f : Cn.TYPE_UNSPECIFIED;
80574
80576
  } else if (t.includes(u)) e[u] = is(l);
80575
80577
  else if (n.includes(u)) {
80576
- let d = [];
80577
- for (let f of l) {
80578
- if (f.type == "null") {
80578
+ let f = [];
80579
+ for (let d of l) {
80580
+ if (d.type == "null") {
80579
80581
  e.nullable = true;
80580
80582
  continue;
80581
80583
  }
80582
- d.push(is(f));
80584
+ f.push(is(d));
80583
80585
  }
80584
- e[u] = d;
80586
+ e[u] = f;
80585
80587
  } else if (o.includes(u)) {
80586
- let d = {};
80587
- for (let [f, h] of Object.entries(l)) d[f] = is(h);
80588
- e[u] = d;
80588
+ let f = {};
80589
+ for (let [d, h] of Object.entries(l)) f[d] = is(h);
80590
+ e[u] = f;
80589
80591
  } else {
80590
80592
  if (u === "additionalProperties") continue;
80591
80593
  e[u] = l;
@@ -80602,11 +80604,11 @@ function Eo(r) {
80602
80604
  let i = { contents: r.messages.map((u) => {
80603
80605
  let l;
80604
80606
  u.role === "assistant" ? l = "model" : (["user", "system", "tool"].includes(u.role), l = "user");
80605
- let d = [];
80606
- return typeof u.content == "string" ? d.push({ text: u.content }) : Array.isArray(u.content) && d.push(...u.content.map((f) => {
80607
- if (f.type === "text") return { text: f.text || "" };
80608
- if (f.type === "image_url") return f.image_url.url.startsWith("http") ? { file_data: { mime_type: f.media_type, file_uri: f.image_url.url } } : { inlineData: { mime_type: f.media_type, data: f.image_url.url?.split(",")?.pop() || f.image_url.url } };
80609
- })), Array.isArray(u.tool_calls) && d.push(...u.tool_calls.map((f) => ({ functionCall: { id: f.id || `tool_${Math.random().toString(36).substring(2, 15)}`, name: f.function.name, args: JSON.parse(f.function.arguments || "{}") } }))), { role: l, parts: d };
80607
+ let f = [];
80608
+ return typeof u.content == "string" ? f.push({ text: u.content }) : Array.isArray(u.content) && f.push(...u.content.map((d) => {
80609
+ if (d.type === "text") return { text: d.text || "" };
80610
+ if (d.type === "image_url") return d.image_url.url.startsWith("http") ? { file_data: { mime_type: d.media_type, file_uri: d.image_url.url } } : { inlineData: { mime_type: d.media_type, data: d.image_url.url?.split(",")?.pop() || d.image_url.url } };
80611
+ })), Array.isArray(u.tool_calls) && f.push(...u.tool_calls.map((d) => ({ functionCall: { id: d.id || `tool_${Math.random().toString(36).substring(2, 15)}`, name: d.function.name, args: JSON.parse(d.function.arguments || "{}") } }))), { role: l, parts: f };
80610
80612
  }), tools: e.length ? e : void 0 };
80611
80613
  if (r.tool_choice) {
80612
80614
  let u = { functionCallingConfig: {} };
@@ -80615,14 +80617,14 @@ function Eo(r) {
80615
80617
  return i;
80616
80618
  }
80617
80619
  function wo(r) {
80618
- let e = r.contents, t = r.tools, n = r.model, o = r.max_tokens, i = r.temperature, u = r.stream, l = r.tool_choice, d = { messages: [], model: n, max_tokens: o, temperature: i, stream: u, tool_choice: l };
80619
- return Array.isArray(e) && e.forEach((f) => {
80620
- typeof f == "string" ? d.messages.push({ role: "user", content: f }) : typeof f.text == "string" ? d.messages.push({ role: "user", content: f.text || null }) : f.role === "user" ? d.messages.push({ role: "user", content: f?.parts?.map((h) => ({ type: "text", text: h.text || "" })) || [] }) : f.role === "model" && d.messages.push({ role: "assistant", content: f?.parts?.map((h) => ({ type: "text", text: h.text || "" })) || [] });
80621
- }), Array.isArray(t) && (d.tools = [], t.forEach((f) => {
80622
- Array.isArray(f.functionDeclarations) && f.functionDeclarations.forEach((h) => {
80623
- d.tools.push({ type: "function", function: { name: h.name, description: h.description, parameters: h.parameters } });
80620
+ let e = r.contents, t = r.tools, n = r.model, o = r.max_tokens, i = r.temperature, u = r.stream, l = r.tool_choice, f = { messages: [], model: n, max_tokens: o, temperature: i, stream: u, tool_choice: l };
80621
+ return Array.isArray(e) && e.forEach((d) => {
80622
+ typeof d == "string" ? f.messages.push({ role: "user", content: d }) : typeof d.text == "string" ? f.messages.push({ role: "user", content: d.text || null }) : d.role === "user" ? f.messages.push({ role: "user", content: d?.parts?.map((h) => ({ type: "text", text: h.text || "" })) || [] }) : d.role === "model" && f.messages.push({ role: "assistant", content: d?.parts?.map((h) => ({ type: "text", text: h.text || "" })) || [] });
80623
+ }), Array.isArray(t) && (f.tools = [], t.forEach((d) => {
80624
+ Array.isArray(d.functionDeclarations) && d.functionDeclarations.forEach((h) => {
80625
+ f.tools.push({ type: "function", function: { name: h.name, description: h.description, parameters: h.parameters } });
80624
80626
  });
80625
- })), d;
80627
+ })), f;
80626
80628
  }
80627
80629
  async function Ao(r, e, t) {
80628
80630
  if (r.headers.get("Content-Type")?.includes("application/json")) {
@@ -80631,43 +80633,43 @@ async function Ao(r, e, t) {
80631
80633
  return new Response(JSON.stringify(i), { status: r.status, statusText: r.statusText, headers: r.headers });
80632
80634
  } else if (r.headers.get("Content-Type")?.includes("stream")) {
80633
80635
  if (!r.body) return r;
80634
- let n = new TextDecoder(), o = new TextEncoder(), i = (l, d) => {
80636
+ let n = new TextDecoder(), o = new TextEncoder(), i = (l, f) => {
80635
80637
  if (l.startsWith("data: ")) {
80636
- let f = l.slice(6).trim();
80637
- if (f) {
80638
- t?.debug({ chunkStr: f }, `${e} chunk:`);
80638
+ let d = l.slice(6).trim();
80639
+ if (d) {
80640
+ t?.debug({ chunkStr: d }, `${e} chunk:`);
80639
80641
  try {
80640
- let h = JSON.parse(f);
80642
+ let h = JSON.parse(d);
80641
80643
  if (!h.candidates || !h.candidates[0]) {
80642
- log("Invalid chunk structure:", f);
80644
+ log("Invalid chunk structure:", d);
80643
80645
  return;
80644
80646
  }
80645
- let _ = h.candidates[0], A = _.content?.parts || [], P = A.filter((p) => p.functionCall).map((p) => ({ id: p.functionCall?.id || `tool_${Math.random().toString(36).substring(2, 15)}`, type: "function", function: { name: p.functionCall?.name, arguments: JSON.stringify(p.functionCall?.args || {}) } })), w = { choices: [{ delta: { role: "assistant", content: A.filter((p) => p.text).map((p) => p.text).join(`
80646
- `) || "", tool_calls: P.length > 0 ? P : void 0 }, finish_reason: _.finishReason?.toLowerCase() || null, index: _.index || (P.length > 0 ? 1 : 0), logprobs: null }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), id: h.responseId || "", model: h.modelVersion || "", object: "chat.completion.chunk", system_fingerprint: "fp_a49d71b8a1", usage: { completion_tokens: h.usageMetadata?.candidatesTokenCount || 0, prompt_tokens: h.usageMetadata?.promptTokenCount || 0, cached_content_token_count: h.usageMetadata?.cachedContentTokenCount || null, total_tokens: h.usageMetadata?.totalTokenCount || 0 } };
80647
- _?.groundingMetadata?.groundingChunks?.length && (w.choices[0].delta.annotations = _.groundingMetadata.groundingChunks.map((p, g) => {
80648
- let T = _?.groundingMetadata?.groundingSupports?.filter((E) => E.groundingChunkIndices?.includes(g));
80647
+ let g = h.candidates[0], A = g.content?.parts || [], P = A.filter((p) => p.functionCall).map((p) => ({ id: p.functionCall?.id || `tool_${Math.random().toString(36).substring(2, 15)}`, type: "function", function: { name: p.functionCall?.name, arguments: JSON.stringify(p.functionCall?.args || {}) } })), w = { choices: [{ delta: { role: "assistant", content: A.filter((p) => p.text).map((p) => p.text).join(`
80648
+ `) || "", tool_calls: P.length > 0 ? P : void 0 }, finish_reason: g.finishReason?.toLowerCase() || null, index: g.index || (P.length > 0 ? 1 : 0), logprobs: null }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), id: h.responseId || "", model: h.modelVersion || "", object: "chat.completion.chunk", system_fingerprint: "fp_a49d71b8a1", usage: { completion_tokens: h.usageMetadata?.candidatesTokenCount || 0, prompt_tokens: h.usageMetadata?.promptTokenCount || 0, cached_content_token_count: h.usageMetadata?.cachedContentTokenCount || null, total_tokens: h.usageMetadata?.totalTokenCount || 0 } };
80649
+ g?.groundingMetadata?.groundingChunks?.length && (w.choices[0].delta.annotations = g.groundingMetadata.groundingChunks.map((p, y) => {
80650
+ let T = g?.groundingMetadata?.groundingSupports?.filter((E) => E.groundingChunkIndices?.includes(y));
80649
80651
  return { type: "url_citation", url_citation: { url: p?.web?.uri || "", title: p?.web?.title || "", content: T?.[0]?.segment?.text || "", start_index: T?.[0]?.segment?.startIndex || 0, end_index: T?.[0]?.segment?.endIndex || 0 } };
80650
- })), d.enqueue(o.encode(`data: ${JSON.stringify(w)}
80652
+ })), f.enqueue(o.encode(`data: ${JSON.stringify(w)}
80651
80653
 
80652
80654
  `));
80653
80655
  } catch (h) {
80654
- t?.error(`Error parsing ${e} stream chunk`, f, h.message);
80656
+ t?.error(`Error parsing ${e} stream chunk`, d, h.message);
80655
80657
  }
80656
80658
  }
80657
80659
  }
80658
80660
  }, u = new ReadableStream({ async start(l) {
80659
- let d = r.body.getReader(), f = "";
80661
+ let f = r.body.getReader(), d = "";
80660
80662
  try {
80661
80663
  for (; ; ) {
80662
- let { done: h, value: _ } = await d.read();
80664
+ let { done: h, value: g } = await f.read();
80663
80665
  if (h) {
80664
- f && i(f, l);
80666
+ d && i(d, l);
80665
80667
  break;
80666
80668
  }
80667
- f += n.decode(_, { stream: true });
80668
- let A = f.split(`
80669
+ d += n.decode(g, { stream: true });
80670
+ let A = d.split(`
80669
80671
  `);
80670
- f = A.pop() || "";
80672
+ d = A.pop() || "";
80671
80673
  for (let P of A) i(P, l);
80672
80674
  }
80673
80675
  } catch (h) {
@@ -80707,8 +80709,8 @@ var Hi = class {
80707
80709
  async transformRequestIn(e, t) {
80708
80710
  let n = process.env.GOOGLE_CLOUD_PROJECT, o = process.env.GOOGLE_CLOUD_LOCATION || "us-central1";
80709
80711
  if (!n && process.env.GOOGLE_APPLICATION_CREDENTIALS) try {
80710
- let l = (await import("fs")).readFileSync(process.env.GOOGLE_APPLICATION_CREDENTIALS, "utf8"), d = JSON.parse(l);
80711
- d && d.project_id && (n = d.project_id);
80712
+ let l = (await import("fs")).readFileSync(process.env.GOOGLE_APPLICATION_CREDENTIALS, "utf8"), f = JSON.parse(l);
80713
+ f && f.project_id && (n = f.project_id);
80712
80714
  } catch (u) {
80713
80715
  console.error("Error extracting project_id from GOOGLE_APPLICATION_CREDENTIALS:", u);
80714
80716
  }
@@ -80732,21 +80734,21 @@ var Gi = class {
80732
80734
  return new Response(JSON.stringify(t), { status: e.status, statusText: e.statusText, headers: e.headers });
80733
80735
  } else if (e.headers.get("Content-Type")?.includes("stream")) {
80734
80736
  if (!e.body) return e;
80735
- let t = new TextDecoder(), n = new TextEncoder(), o = "", i = false, u = "", l = new ReadableStream({ async start(d) {
80736
- let f = e.body.getReader(), h = (A, P, b) => {
80737
+ let t = new TextDecoder(), n = new TextEncoder(), o = "", i = false, u = "", l = new ReadableStream({ async start(f) {
80738
+ let d = e.body.getReader(), h = (A, P, b) => {
80737
80739
  let w = A.split(`
80738
80740
  `);
80739
80741
  for (let p of w) p.trim() && P.enqueue(b.encode(p + `
80740
80742
  `));
80741
- }, _ = (A, P) => {
80743
+ }, g = (A, P) => {
80742
80744
  let { controller: b, encoder: w } = P;
80743
80745
  if (A.startsWith("data: ") && A.trim() !== "data: [DONE]") try {
80744
80746
  let p = JSON.parse(A.slice(6));
80745
80747
  if (p.choices?.[0]?.delta?.reasoning_content) {
80746
80748
  P.appendReasoningContent(p.choices[0].delta.reasoning_content);
80747
- let g = { ...p, choices: [{ ...p.choices[0], delta: { ...p.choices[0].delta, thinking: { content: p.choices[0].delta.reasoning_content } } }] };
80748
- delete g.choices[0].delta.reasoning_content;
80749
- let T = `data: ${JSON.stringify(g)}
80749
+ let y = { ...p, choices: [{ ...p.choices[0], delta: { ...p.choices[0].delta, thinking: { content: p.choices[0].delta.reasoning_content } } }] };
80750
+ delete y.choices[0].delta.reasoning_content;
80751
+ let T = `data: ${JSON.stringify(y)}
80750
80752
 
80751
80753
  `;
80752
80754
  b.enqueue(w.encode(T));
@@ -80754,7 +80756,7 @@ var Gi = class {
80754
80756
  }
80755
80757
  if (p.choices?.[0]?.delta?.content && P.reasoningContent() && !P.isReasoningComplete()) {
80756
80758
  P.setReasoningComplete(true);
80757
- let g = Date.now().toString(), T = { ...p, choices: [{ ...p.choices[0], delta: { ...p.choices[0].delta, content: null, thinking: { content: P.reasoningContent(), signature: g } } }] };
80759
+ let y = Date.now().toString(), T = { ...p, choices: [{ ...p.choices[0], delta: { ...p.choices[0].delta, content: null, thinking: { content: P.reasoningContent(), signature: y } } }] };
80758
80760
  delete T.choices[0].delta.reasoning_content;
80759
80761
  let E = `data: ${JSON.stringify(T)}
80760
80762
 
@@ -80763,10 +80765,10 @@ var Gi = class {
80763
80765
  }
80764
80766
  if (p.choices[0]?.delta?.reasoning_content && delete p.choices[0].delta.reasoning_content, p.choices?.[0]?.delta && Object.keys(p.choices[0].delta).length > 0) {
80765
80767
  P.isReasoningComplete() && p.choices[0].index++;
80766
- let g = `data: ${JSON.stringify(p)}
80768
+ let y = `data: ${JSON.stringify(p)}
80767
80769
 
80768
80770
  `;
80769
- b.enqueue(w.encode(g));
80771
+ b.enqueue(w.encode(y));
80770
80772
  }
80771
80773
  } catch {
80772
80774
  b.enqueue(w.encode(A + `
@@ -80777,9 +80779,9 @@ var Gi = class {
80777
80779
  };
80778
80780
  try {
80779
80781
  for (; ; ) {
80780
- let { done: A, value: P } = await f.read();
80782
+ let { done: A, value: P } = await d.read();
80781
80783
  if (A) {
80782
- u.trim() && h(u, d, n);
80784
+ u.trim() && h(u, f, n);
80783
80785
  break;
80784
80786
  }
80785
80787
  let b = t.decode(P, { stream: true });
@@ -80788,21 +80790,21 @@ var Gi = class {
80788
80790
  `);
80789
80791
  u = w.pop() || "";
80790
80792
  for (let p of w) if (p.trim()) try {
80791
- _(p, { controller: d, encoder: n, reasoningContent: () => o, appendReasoningContent: (g) => o += g, isReasoningComplete: () => i, setReasoningComplete: (g) => i = g });
80792
- } catch (g) {
80793
- console.error("Error processing line:", p, g), d.enqueue(n.encode(p + `
80793
+ g(p, { controller: f, encoder: n, reasoningContent: () => o, appendReasoningContent: (y) => o += y, isReasoningComplete: () => i, setReasoningComplete: (y) => i = y });
80794
+ } catch (y) {
80795
+ console.error("Error processing line:", p, y), f.enqueue(n.encode(p + `
80794
80796
  `));
80795
80797
  }
80796
80798
  }
80797
80799
  } catch (A) {
80798
- console.error("Stream error:", A), d.error(A);
80800
+ console.error("Stream error:", A), f.error(A);
80799
80801
  } finally {
80800
80802
  try {
80801
- f.releaseLock();
80803
+ d.releaseLock();
80802
80804
  } catch (A) {
80803
80805
  console.error("Error releasing reader lock:", A);
80804
80806
  }
80805
- d.close();
80807
+ f.close();
80806
80808
  }
80807
80809
  } });
80808
80810
  return new Response(l, { status: e.status, statusText: e.statusText, headers: { "Content-Type": e.headers.get("Content-Type") || "text/plain", "Cache-Control": "no-cache", Connection: "keep-alive" } });
@@ -80829,20 +80831,20 @@ Examples:
80829
80831
  return new Response(JSON.stringify(t), { status: e.status, statusText: e.statusText, headers: e.headers });
80830
80832
  } else if (e.headers.get("Content-Type")?.includes("stream")) {
80831
80833
  if (!e.body) return e;
80832
- let t = new TextDecoder(), n = new TextEncoder(), o = -1, i = "", u = "", l = new ReadableStream({ async start(d) {
80833
- let f = e.body.getReader(), h = (A, P, b) => {
80834
+ let t = new TextDecoder(), n = new TextEncoder(), o = -1, i = "", u = "", l = new ReadableStream({ async start(f) {
80835
+ let d = e.body.getReader(), h = (A, P, b) => {
80834
80836
  let w = A.split(`
80835
80837
  `);
80836
80838
  for (let p of w) p.trim() && P.enqueue(b.encode(p + `
80837
80839
  `));
80838
- }, _ = (A, P) => {
80839
- let { controller: b, encoder: w, exitToolIndex: p, setExitToolIndex: g, appendExitToolResponse: T } = P;
80840
+ }, g = (A, P) => {
80841
+ let { controller: b, encoder: w, exitToolIndex: p, setExitToolIndex: y, appendExitToolResponse: T } = P;
80840
80842
  if (A.startsWith("data: ") && A.trim() !== "data: [DONE]") try {
80841
80843
  let E = JSON.parse(A.slice(6));
80842
80844
  if (E.choices[0]?.delta?.tool_calls?.length) {
80843
80845
  let S = E.choices[0].delta.tool_calls[0];
80844
80846
  if (S.function?.name === "ExitTool") {
80845
- g(S.index);
80847
+ y(S.index);
80846
80848
  return;
80847
80849
  } else if (p() > -1 && S.index === p() && S.function.arguments) {
80848
80850
  T(S.function.arguments);
@@ -80873,9 +80875,9 @@ Examples:
80873
80875
  };
80874
80876
  try {
80875
80877
  for (; ; ) {
80876
- let { done: A, value: P } = await f.read();
80878
+ let { done: A, value: P } = await d.read();
80877
80879
  if (A) {
80878
- u.trim() && h(u, d, n);
80880
+ u.trim() && h(u, f, n);
80879
80881
  break;
80880
80882
  }
80881
80883
  let b = t.decode(P, { stream: true });
@@ -80884,21 +80886,21 @@ Examples:
80884
80886
  `);
80885
80887
  u = w.pop() || "";
80886
80888
  for (let p of w) if (p.trim()) try {
80887
- _(p, { controller: d, encoder: n, exitToolIndex: () => o, setExitToolIndex: (g) => o = g, exitToolResponse: () => i, appendExitToolResponse: (g) => i += g });
80888
- } catch (g) {
80889
- console.error("Error processing line:", p, g), d.enqueue(n.encode(p + `
80889
+ g(p, { controller: f, encoder: n, exitToolIndex: () => o, setExitToolIndex: (y) => o = y, exitToolResponse: () => i, appendExitToolResponse: (y) => i += y });
80890
+ } catch (y) {
80891
+ console.error("Error processing line:", p, y), f.enqueue(n.encode(p + `
80890
80892
  `));
80891
80893
  }
80892
80894
  }
80893
80895
  } catch (A) {
80894
- console.error("Stream error:", A), d.error(A);
80896
+ console.error("Stream error:", A), f.error(A);
80895
80897
  } finally {
80896
80898
  try {
80897
- f.releaseLock();
80899
+ d.releaseLock();
80898
80900
  } catch (A) {
80899
80901
  console.error("Error releasing reader lock:", A);
80900
80902
  }
80901
- d.close();
80903
+ f.close();
80902
80904
  }
80903
80905
  } });
80904
80906
  return new Response(l, { status: e.status, statusText: e.statusText, headers: { "Content-Type": "text/event-stream", "Cache-Control": "no-cache", Connection: "keep-alive" } });
@@ -80928,19 +80930,19 @@ var Ji = class {
80928
80930
  return new Response(JSON.stringify(t), { status: e.status, statusText: e.statusText, headers: e.headers });
80929
80931
  } else if (e.headers.get("Content-Type")?.includes("stream")) {
80930
80932
  if (!e.body) return e;
80931
- let t = new TextDecoder(), n = new TextEncoder(), o = false, i = "", u = false, l = false, d = "", f = new ReadableStream({ async start(h) {
80932
- let _ = e.body.getReader(), A = (b, w, p) => {
80933
- let g = b.split(`
80933
+ let t = new TextDecoder(), n = new TextEncoder(), o = false, i = "", u = false, l = false, f = "", d = new ReadableStream({ async start(h) {
80934
+ let g = e.body.getReader(), A = (b, w, p) => {
80935
+ let y = b.split(`
80934
80936
  `);
80935
- for (let T of g) T.trim() && w.enqueue(p.encode(T + `
80937
+ for (let T of y) T.trim() && w.enqueue(p.encode(T + `
80936
80938
  `));
80937
80939
  }, P = (b, w) => {
80938
- let { controller: p, encoder: g } = w;
80940
+ let { controller: p, encoder: y } = w;
80939
80941
  if (b.startsWith("data: ") && b.trim() !== "data: [DONE]") {
80940
80942
  let T = b.slice(6);
80941
80943
  try {
80942
80944
  let E = JSON.parse(T);
80943
- if (E.usage && (this.logger?.debug({ usage: E.usage, hasToolCall: l }, "usage"), E.choices[0].finish_reason = l ? "tool_calls" : "stop"), E.choices?.[0]?.finish_reason === "error" && p.enqueue(g.encode(`data: ${JSON.stringify({ error: E.choices?.[0].error })}
80945
+ if (E.usage && (this.logger?.debug({ usage: E.usage, hasToolCall: l }, "usage"), E.choices[0].finish_reason = l ? "tool_calls" : "stop"), E.choices?.[0]?.finish_reason === "error" && p.enqueue(y.encode(`data: ${JSON.stringify({ error: E.choices?.[0].error })}
80944
80946
 
80945
80947
  `)), E.choices?.[0]?.delta?.content && !w.hasTextContent() && w.setHasTextContent(true), E.choices?.[0]?.delta?.reasoning) {
80946
80948
  w.appendReasoningContent(E.choices[0].delta.reasoning);
@@ -80949,7 +80951,7 @@ var Ji = class {
80949
80951
  let B = `data: ${JSON.stringify(F)}
80950
80952
 
80951
80953
  `;
80952
- p.enqueue(g.encode(B));
80954
+ p.enqueue(y.encode(B));
80953
80955
  return;
80954
80956
  }
80955
80957
  if (E.choices?.[0]?.delta?.content && w.reasoningContent() && !w.isReasoningComplete()) {
@@ -80959,7 +80961,7 @@ var Ji = class {
80959
80961
  let G = `data: ${JSON.stringify(B)}
80960
80962
 
80961
80963
  `;
80962
- p.enqueue(g.encode(G));
80964
+ p.enqueue(y.encode(G));
80963
80965
  }
80964
80966
  E.choices?.[0]?.delta?.reasoning && delete E.choices[0].delta.reasoning, E.choices?.[0]?.delta?.tool_calls?.length && !Number.isNaN(parseInt(E.choices?.[0]?.delta?.tool_calls[0].id, 10)) && E.choices?.[0]?.delta?.tool_calls.forEach((F) => {
80965
80967
  F.id = `call_${Wt()}`;
@@ -80967,19 +80969,19 @@ var Ji = class {
80967
80969
  let S = `data: ${JSON.stringify(E)}
80968
80970
 
80969
80971
  `;
80970
- p.enqueue(g.encode(S));
80972
+ p.enqueue(y.encode(S));
80971
80973
  } catch {
80972
- p.enqueue(g.encode(b + `
80974
+ p.enqueue(y.encode(b + `
80973
80975
  `));
80974
80976
  }
80975
- } else p.enqueue(g.encode(b + `
80977
+ } else p.enqueue(y.encode(b + `
80976
80978
  `));
80977
80979
  };
80978
80980
  try {
80979
80981
  for (; ; ) {
80980
- let { done: b, value: w } = await _.read();
80982
+ let { done: b, value: w } = await g.read();
80981
80983
  if (b) {
80982
- d.trim() && A(d, h, n);
80984
+ f.trim() && A(f, h, n);
80983
80985
  break;
80984
80986
  }
80985
80987
  if (!w || w.length === 0) continue;
@@ -80991,11 +80993,11 @@ var Ji = class {
80991
80993
  continue;
80992
80994
  }
80993
80995
  if (p.length === 0) continue;
80994
- if (d += p, d.length > 1e6) {
80996
+ if (f += p, f.length > 1e6) {
80995
80997
  console.warn("Buffer size exceeds limit, processing partial data");
80996
- let T = d.split(`
80998
+ let T = f.split(`
80997
80999
  `);
80998
- d = T.pop() || "";
81000
+ f = T.pop() || "";
80999
81001
  for (let E of T) if (E.trim()) try {
81000
81002
  P(E, { controller: h, encoder: n, hasTextContent: () => o, setHasTextContent: (S) => o = S, reasoningContent: () => i, appendReasoningContent: (S) => i += S, isReasoningComplete: () => u, setReasoningComplete: (S) => u = S });
81001
81003
  } catch (S) {
@@ -81004,10 +81006,10 @@ var Ji = class {
81004
81006
  }
81005
81007
  continue;
81006
81008
  }
81007
- let g = d.split(`
81009
+ let y = f.split(`
81008
81010
  `);
81009
- d = g.pop() || "";
81010
- for (let T of g) if (T.trim()) try {
81011
+ f = y.pop() || "";
81012
+ for (let T of y) if (T.trim()) try {
81011
81013
  P(T, { controller: h, encoder: n, hasTextContent: () => o, setHasTextContent: (E) => o = E, reasoningContent: () => i, appendReasoningContent: (E) => i += E, isReasoningComplete: () => u, setReasoningComplete: (E) => u = E });
81012
81014
  } catch (E) {
81013
81015
  console.error("Error processing line:", T, E), h.enqueue(n.encode(T + `
@@ -81018,14 +81020,14 @@ var Ji = class {
81018
81020
  console.error("Stream error:", b), h.error(b);
81019
81021
  } finally {
81020
81022
  try {
81021
- _.releaseLock();
81023
+ g.releaseLock();
81022
81024
  } catch (b) {
81023
81025
  console.error("Error releasing reader lock:", b);
81024
81026
  }
81025
81027
  h.close();
81026
81028
  }
81027
81029
  } });
81028
- return new Response(f, { status: e.status, statusText: e.statusText, headers: { "Content-Type": "text/event-stream", "Cache-Control": "no-cache", Connection: "keep-alive" } });
81030
+ return new Response(d, { status: e.status, statusText: e.statusText, headers: { "Content-Type": "text/event-stream", "Cache-Control": "no-cache", Connection: "keep-alive" } });
81029
81031
  }
81030
81032
  return e;
81031
81033
  }
@@ -81058,18 +81060,18 @@ var Vi = class {
81058
81060
  return new Response(JSON.stringify(t), { status: e.status, statusText: e.statusText, headers: e.headers });
81059
81061
  } else if (e.headers.get("Content-Type")?.includes("stream")) {
81060
81062
  if (!e.body) return e;
81061
- let t = new TextDecoder(), n = new TextEncoder(), o = false, i = "", u = false, l = "", d = new ReadableStream({ async start(f) {
81062
- let h = e.body.getReader(), _ = (P, b, w) => {
81063
+ let t = new TextDecoder(), n = new TextEncoder(), o = false, i = "", u = false, l = "", f = new ReadableStream({ async start(d) {
81064
+ let h = e.body.getReader(), g = (P, b, w) => {
81063
81065
  let p = P.split(`
81064
81066
  `);
81065
- for (let g of p) g.trim() && b.enqueue(w.encode(g + `
81067
+ for (let y of p) y.trim() && b.enqueue(w.encode(y + `
81066
81068
  `));
81067
81069
  }, A = (P, b) => {
81068
81070
  let { controller: w, encoder: p } = b;
81069
81071
  if (P.startsWith("data: ") && P.trim() !== "data: [DONE]") {
81070
- let g = P.slice(6);
81072
+ let y = P.slice(6);
81071
81073
  try {
81072
- let T = JSON.parse(g);
81074
+ let T = JSON.parse(y);
81073
81075
  if (T.error) throw new Error(JSON.stringify(T));
81074
81076
  T.choices?.[0]?.delta?.content && !b.hasTextContent() && b.setHasTextContent(true), T.choices?.[0]?.delta?.tool_calls?.length && T.choices?.[0]?.delta?.tool_calls.forEach((S) => {
81075
81077
  S.id = `call_${Wt()}`;
@@ -81089,27 +81091,27 @@ var Vi = class {
81089
81091
  for (; ; ) {
81090
81092
  let { done: P, value: b } = await h.read();
81091
81093
  if (P) {
81092
- l.trim() && _(l, f, n);
81094
+ l.trim() && g(l, d, n);
81093
81095
  break;
81094
81096
  }
81095
81097
  if (!b || b.length === 0) continue;
81096
81098
  let w;
81097
81099
  try {
81098
81100
  w = t.decode(b, { stream: true });
81099
- } catch (g) {
81100
- console.warn("Failed to decode chunk", g);
81101
+ } catch (y) {
81102
+ console.warn("Failed to decode chunk", y);
81101
81103
  continue;
81102
81104
  }
81103
81105
  if (w.length === 0) continue;
81104
81106
  if (l += w, l.length > 1e6) {
81105
81107
  console.warn("Buffer size exceeds limit, processing partial data");
81106
- let g = l.split(`
81108
+ let y = l.split(`
81107
81109
  `);
81108
- l = g.pop() || "";
81109
- for (let T of g) if (T.trim()) try {
81110
- A(T, { controller: f, encoder: n, hasTextContent: () => o, setHasTextContent: (E) => o = E, reasoningContent: () => i, appendReasoningContent: (E) => i += E, isReasoningComplete: () => u, setReasoningComplete: (E) => u = E });
81110
+ l = y.pop() || "";
81111
+ for (let T of y) if (T.trim()) try {
81112
+ A(T, { controller: d, encoder: n, hasTextContent: () => o, setHasTextContent: (E) => o = E, reasoningContent: () => i, appendReasoningContent: (E) => i += E, isReasoningComplete: () => u, setReasoningComplete: (E) => u = E });
81111
81113
  } catch (E) {
81112
- console.error("Error processing line:", T, E), f.enqueue(n.encode(T + `
81114
+ console.error("Error processing line:", T, E), d.enqueue(n.encode(T + `
81113
81115
  `));
81114
81116
  }
81115
81117
  continue;
@@ -81117,25 +81119,25 @@ var Vi = class {
81117
81119
  let p = l.split(`
81118
81120
  `);
81119
81121
  l = p.pop() || "";
81120
- for (let g of p) if (g.trim()) try {
81121
- A(g, { controller: f, encoder: n, hasTextContent: () => o, setHasTextContent: (T) => o = T, reasoningContent: () => i, appendReasoningContent: (T) => i += T, isReasoningComplete: () => u, setReasoningComplete: (T) => u = T });
81122
+ for (let y of p) if (y.trim()) try {
81123
+ A(y, { controller: d, encoder: n, hasTextContent: () => o, setHasTextContent: (T) => o = T, reasoningContent: () => i, appendReasoningContent: (T) => i += T, isReasoningComplete: () => u, setReasoningComplete: (T) => u = T });
81122
81124
  } catch (T) {
81123
- console.error("Error processing line:", g, T), f.enqueue(n.encode(g + `
81125
+ console.error("Error processing line:", y, T), d.enqueue(n.encode(y + `
81124
81126
  `));
81125
81127
  }
81126
81128
  }
81127
81129
  } catch (P) {
81128
- console.error("Stream error:", P), f.error(P);
81130
+ console.error("Stream error:", P), d.error(P);
81129
81131
  } finally {
81130
81132
  try {
81131
81133
  h.releaseLock();
81132
81134
  } catch (P) {
81133
81135
  console.error("Error releasing reader lock:", P);
81134
81136
  }
81135
- f.close();
81137
+ d.close();
81136
81138
  }
81137
81139
  } });
81138
- return new Response(d, { status: e.status, statusText: e.statusText, headers: { "Content-Type": "text/event-stream", "Cache-Control": "no-cache", Connection: "keep-alive" } });
81140
+ return new Response(f, { status: e.status, statusText: e.statusText, headers: { "Content-Type": "text/event-stream", "Cache-Control": "no-cache", Connection: "keep-alive" } });
81139
81141
  }
81140
81142
  return e;
81141
81143
  }
@@ -81237,9 +81239,9 @@ var nA = { '"': '"', "\\": "\\", "/": "/", b: "\b", f: "\f", n: `
81237
81239
  `, r: "\r", t: " " };
81238
81240
  function wl(r) {
81239
81241
  let e = 0, t = "";
81240
- f(["```", "[```", "{```"]), i() || Ce(), f(["```", "```]", "```}"]);
81241
- let o = _(",");
81242
- for (o && u(), _l(r[e]) && ig(t) ? (o || (t = kt(t, ",")), g()) : o && (t = Kn(t, ",")); r[e] === "}" || r[e] === "]"; ) e++, u();
81242
+ d(["```", "[```", "{```"]), i() || Ce(), d(["```", "```]", "```}"]);
81243
+ let o = g(",");
81244
+ for (o && u(), _l(r[e]) && ig(t) ? (o || (t = kt(t, ",")), y()) : o && (t = Kn(t, ",")); r[e] === "}" || r[e] === "]"; ) e++, u();
81243
81245
  if (e >= r.length) return t;
81244
81246
  Ee();
81245
81247
  function i() {
@@ -81250,7 +81252,7 @@ function wl(r) {
81250
81252
  function u() {
81251
81253
  let J = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, V = e, se = l(J);
81252
81254
  do
81253
- se = d(), se && (se = l(J));
81255
+ se = f(), se && (se = l(J));
81254
81256
  while (se);
81255
81257
  return e > V;
81256
81258
  }
@@ -81261,7 +81263,7 @@ function wl(r) {
81261
81263
  else break;
81262
81264
  return se.length > 0 ? (t += se, true) : false;
81263
81265
  }
81264
- function d() {
81266
+ function f() {
81265
81267
  if (r[e] === "/" && r[e + 1] === "*") {
81266
81268
  for (; e < r.length && !sA(r, e); ) e++;
81267
81269
  return e += 2, true;
@@ -81273,7 +81275,7 @@ function wl(r) {
81273
81275
  }
81274
81276
  return false;
81275
81277
  }
81276
- function f(J) {
81278
+ function d(J) {
81277
81279
  if (h(J)) {
81278
81280
  if (hl(r[e])) for (; e < r.length && pl(r[e]); ) e++;
81279
81281
  return u(), true;
@@ -81287,7 +81289,7 @@ function wl(r) {
81287
81289
  }
81288
81290
  return false;
81289
81291
  }
81290
- function _(J) {
81292
+ function g(J) {
81291
81293
  return r[e] === J ? (t += r[e], e++, true) : false;
81292
81294
  }
81293
81295
  function A(J) {
@@ -81305,12 +81307,12 @@ function wl(r) {
81305
81307
  let J = true;
81306
81308
  for (; e < r.length && r[e] !== "}"; ) {
81307
81309
  let V;
81308
- if (J ? (V = true, J = false) : (V = _(","), V || (t = kt(t, ",")), u()), b(), !(T() || G(true))) {
81310
+ if (J ? (V = true, J = false) : (V = g(","), V || (t = kt(t, ",")), u()), b(), !(T() || G(true))) {
81309
81311
  r[e] === "}" || r[e] === "{" || r[e] === "]" || r[e] === "[" || r[e] === void 0 ? t = Kn(t, ",") : Ae();
81310
81312
  break;
81311
81313
  }
81312
81314
  u();
81313
- let Ue = _(":"), ve = e >= r.length;
81315
+ let Ue = g(":"), ve = e >= r.length;
81314
81316
  Ue || (_l(r[e]) || ve ? t = kt(t, ":") : oe()), i() || (Ue || ve ? t += "null" : oe());
81315
81317
  }
81316
81318
  return r[e] === "}" ? (t += "}", e++) : t = kt(t, "}"), true;
@@ -81321,7 +81323,7 @@ function wl(r) {
81321
81323
  if (r[e] === "[") {
81322
81324
  t += "[", e++, u(), A(",") && u();
81323
81325
  let J = true;
81324
- for (; e < r.length && r[e] !== "]"; ) if (J ? J = false : _(",") || (t = kt(t, ",")), b(), !i()) {
81326
+ for (; e < r.length && r[e] !== "]"; ) if (J ? J = false : g(",") || (t = kt(t, ",")), b(), !i()) {
81325
81327
  t = Kn(t, ",");
81326
81328
  break;
81327
81329
  }
@@ -81329,9 +81331,9 @@ function wl(r) {
81329
81331
  }
81330
81332
  return false;
81331
81333
  }
81332
- function g() {
81334
+ function y() {
81333
81335
  let J = true, V = true;
81334
- for (; V; ) J ? J = false : _(",") || (t = kt(t, ",")), V = i();
81336
+ for (; V; ) J ? J = false : g(",") || (t = kt(t, ",")), V = i();
81335
81337
  V || (t = Kn(t, ",")), t = `[
81336
81338
  ${t}
81337
81339
  ]`;
@@ -81496,13 +81498,13 @@ var Xi = class {
81496
81498
  return new Response(JSON.stringify(t), { status: e.status, statusText: e.statusText, headers: e.headers });
81497
81499
  } else if (e.headers.get("Content-Type")?.includes("stream")) {
81498
81500
  if (!e.body) return e;
81499
- let t = new TextDecoder(), n = new TextEncoder(), o = {}, i = false, u = "", l = false, d = false, f = "", h = new ReadableStream({ async start(_) {
81500
- let A = e.body.getReader(), P = (p, g, T) => {
81501
+ let t = new TextDecoder(), n = new TextEncoder(), o = {}, i = false, u = "", l = false, f = false, d = "", h = new ReadableStream({ async start(g) {
81502
+ let A = e.body.getReader(), P = (p, y, T) => {
81501
81503
  let E = p.split(`
81502
81504
  `);
81503
- for (let S of E) S.trim() && g.enqueue(T.encode(S + `
81505
+ for (let S of E) S.trim() && y.enqueue(T.encode(S + `
81504
81506
  `));
81505
- }, b = (p, g, T) => {
81507
+ }, b = (p, y, T) => {
81506
81508
  let E = "";
81507
81509
  try {
81508
81510
  E = Al(o.arguments || "", this.logger);
@@ -81514,9 +81516,9 @@ var Xi = class {
81514
81516
  let B = `data: ${JSON.stringify(F)}
81515
81517
 
81516
81518
  `;
81517
- g.enqueue(T.encode(B));
81518
- }, w = (p, g) => {
81519
- let { controller: T, encoder: E } = g;
81519
+ y.enqueue(T.encode(B));
81520
+ }, w = (p, y) => {
81521
+ let { controller: T, encoder: E } = y;
81520
81522
  if (p.startsWith("data: ") && p.trim() !== "data: [DONE]") {
81521
81523
  let S = p.slice(6);
81522
81524
  try {
@@ -81542,7 +81544,7 @@ var Xi = class {
81542
81544
  b(F, T, E), o = {};
81543
81545
  return;
81544
81546
  }
81545
- F.choices?.[0]?.delta?.tool_calls?.length && g.hasTextContent() && (typeof F.choices[0].index == "number" ? F.choices[0].index += 1 : F.choices[0].index = 1);
81547
+ F.choices?.[0]?.delta?.tool_calls?.length && y.hasTextContent() && (typeof F.choices[0].index == "number" ? F.choices[0].index += 1 : F.choices[0].index = 1);
81546
81548
  let B = `data: ${JSON.stringify(F)}
81547
81549
 
81548
81550
  `;
@@ -81556,52 +81558,52 @@ var Xi = class {
81556
81558
  };
81557
81559
  try {
81558
81560
  for (; ; ) {
81559
- let { done: p, value: g } = await A.read();
81561
+ let { done: p, value: y } = await A.read();
81560
81562
  if (p) {
81561
- f.trim() && P(f, _, n);
81563
+ d.trim() && P(d, g, n);
81562
81564
  break;
81563
81565
  }
81564
- if (!g || g.length === 0) continue;
81566
+ if (!y || y.length === 0) continue;
81565
81567
  let T;
81566
81568
  try {
81567
- T = t.decode(g, { stream: true });
81569
+ T = t.decode(y, { stream: true });
81568
81570
  } catch (S) {
81569
81571
  console.warn("Failed to decode chunk", S);
81570
81572
  continue;
81571
81573
  }
81572
81574
  if (T.length === 0) continue;
81573
- if (f += T, f.length > 1e6) {
81575
+ if (d += T, d.length > 1e6) {
81574
81576
  console.warn("Buffer size exceeds limit, processing partial data");
81575
- let S = f.split(`
81577
+ let S = d.split(`
81576
81578
  `);
81577
- f = S.pop() || "";
81579
+ d = S.pop() || "";
81578
81580
  for (let F of S) if (F.trim()) try {
81579
- w(F, { controller: _, encoder: n, hasTextContent: () => i, setHasTextContent: (B) => i = B, reasoningContent: () => u, appendReasoningContent: (B) => u += B, isReasoningComplete: () => l, setReasoningComplete: (B) => l = B });
81581
+ w(F, { controller: g, encoder: n, hasTextContent: () => i, setHasTextContent: (B) => i = B, reasoningContent: () => u, appendReasoningContent: (B) => u += B, isReasoningComplete: () => l, setReasoningComplete: (B) => l = B });
81580
81582
  } catch (B) {
81581
- console.error("Error processing line:", F, B), _.enqueue(n.encode(F + `
81583
+ console.error("Error processing line:", F, B), g.enqueue(n.encode(F + `
81582
81584
  `));
81583
81585
  }
81584
81586
  continue;
81585
81587
  }
81586
- let E = f.split(`
81588
+ let E = d.split(`
81587
81589
  `);
81588
- f = E.pop() || "";
81590
+ d = E.pop() || "";
81589
81591
  for (let S of E) if (S.trim()) try {
81590
- w(S, { controller: _, encoder: n, hasTextContent: () => i, setHasTextContent: (F) => i = F, reasoningContent: () => u, appendReasoningContent: (F) => u += F, isReasoningComplete: () => l, setReasoningComplete: (F) => l = F });
81592
+ w(S, { controller: g, encoder: n, hasTextContent: () => i, setHasTextContent: (F) => i = F, reasoningContent: () => u, appendReasoningContent: (F) => u += F, isReasoningComplete: () => l, setReasoningComplete: (F) => l = F });
81591
81593
  } catch (F) {
81592
- console.error("Error processing line:", S, F), _.enqueue(n.encode(S + `
81594
+ console.error("Error processing line:", S, F), g.enqueue(n.encode(S + `
81593
81595
  `));
81594
81596
  }
81595
81597
  }
81596
81598
  } catch (p) {
81597
- console.error("Stream error:", p), _.error(p);
81599
+ console.error("Stream error:", p), g.error(p);
81598
81600
  } finally {
81599
81601
  try {
81600
81602
  A.releaseLock();
81601
81603
  } catch (p) {
81602
81604
  console.error("Error releasing reader lock:", p);
81603
81605
  }
81604
- _.close();
81606
+ g.close();
81605
81607
  }
81606
81608
  } });
81607
81609
  return new Response(h, { status: e.status, statusText: e.statusText, headers: { "Content-Type": "text/event-stream", "Cache-Control": "no-cache", Connection: "keep-alive" } });
@@ -81626,21 +81628,21 @@ var Qi = class {
81626
81628
  return t.choices[0]?.message.reasoning_content && (t.thinking = { content: t.choices[0]?.message.reasoning_content }), new Response(JSON.stringify(t), { status: e.status, statusText: e.statusText, headers: e.headers });
81627
81629
  } else if (e.headers.get("Content-Type")?.includes("stream")) {
81628
81630
  if (!e.body) return e;
81629
- let t = new TextDecoder(), n = new TextEncoder(), o = "", i = false, u = "", l = new ReadableStream({ async start(d) {
81630
- let f = e.body.getReader(), h = (A, P, b) => {
81631
+ let t = new TextDecoder(), n = new TextEncoder(), o = "", i = false, u = "", l = new ReadableStream({ async start(f) {
81632
+ let d = e.body.getReader(), h = (A, P, b) => {
81631
81633
  let w = A.split(`
81632
81634
  `);
81633
81635
  for (let p of w) p.trim() && P.enqueue(b.encode(p + `
81634
81636
  `));
81635
- }, _ = (A, P) => {
81637
+ }, g = (A, P) => {
81636
81638
  let { controller: b, encoder: w } = P;
81637
81639
  if (this.logger?.debug({ line: A }, "Processing reason line"), A.startsWith("data: ") && A.trim() !== "data: [DONE]") try {
81638
81640
  let p = JSON.parse(A.slice(6));
81639
81641
  if (console.log(JSON.stringify(p)), p.choices?.[0]?.delta?.reasoning_content) {
81640
81642
  P.appendReasoningContent(p.choices[0].delta.reasoning_content);
81641
- let g = { ...p, choices: [{ ...p.choices[0], delta: { ...p.choices[0].delta, thinking: { content: p.choices[0].delta.reasoning_content } } }] };
81642
- delete g.choices[0].delta.reasoning_content;
81643
- let T = `data: ${JSON.stringify(g)}
81643
+ let y = { ...p, choices: [{ ...p.choices[0], delta: { ...p.choices[0].delta, thinking: { content: p.choices[0].delta.reasoning_content } } }] };
81644
+ delete y.choices[0].delta.reasoning_content;
81645
+ let T = `data: ${JSON.stringify(y)}
81644
81646
 
81645
81647
  `;
81646
81648
  b.enqueue(w.encode(T));
@@ -81648,7 +81650,7 @@ var Qi = class {
81648
81650
  }
81649
81651
  if ((p.choices?.[0]?.delta?.content || p.choices?.[0]?.delta?.tool_calls) && P.reasoningContent() && !P.isReasoningComplete()) {
81650
81652
  P.setReasoningComplete(true);
81651
- let g = Date.now().toString(), T = { ...p, choices: [{ ...p.choices[0], delta: { ...p.choices[0].delta, content: null, thinking: { content: P.reasoningContent(), signature: g } } }] };
81653
+ let y = Date.now().toString(), T = { ...p, choices: [{ ...p.choices[0], delta: { ...p.choices[0].delta, content: null, thinking: { content: P.reasoningContent(), signature: y } } }] };
81652
81654
  delete T.choices[0].delta.reasoning_content;
81653
81655
  let E = `data: ${JSON.stringify(T)}
81654
81656
 
@@ -81657,10 +81659,10 @@ var Qi = class {
81657
81659
  }
81658
81660
  if (p.choices?.[0]?.delta?.reasoning_content && delete p.choices[0].delta.reasoning_content, p.choices?.[0]?.delta && Object.keys(p.choices[0].delta).length > 0) {
81659
81661
  P.isReasoningComplete() && p.choices[0].index++;
81660
- let g = `data: ${JSON.stringify(p)}
81662
+ let y = `data: ${JSON.stringify(p)}
81661
81663
 
81662
81664
  `;
81663
- b.enqueue(w.encode(g));
81665
+ b.enqueue(w.encode(y));
81664
81666
  }
81665
81667
  } catch {
81666
81668
  b.enqueue(w.encode(A + `
@@ -81671,9 +81673,9 @@ var Qi = class {
81671
81673
  };
81672
81674
  try {
81673
81675
  for (; ; ) {
81674
- let { done: A, value: P } = await f.read();
81676
+ let { done: A, value: P } = await d.read();
81675
81677
  if (A) {
81676
- u.trim() && h(u, d, n);
81678
+ u.trim() && h(u, f, n);
81677
81679
  break;
81678
81680
  }
81679
81681
  let b = t.decode(P, { stream: true });
@@ -81682,21 +81684,21 @@ var Qi = class {
81682
81684
  `);
81683
81685
  u = w.pop() || "";
81684
81686
  for (let p of w) if (p.trim()) try {
81685
- _(p, { controller: d, encoder: n, reasoningContent: () => o, appendReasoningContent: (g) => o += g, isReasoningComplete: () => i, setReasoningComplete: (g) => i = g });
81686
- } catch (g) {
81687
- console.error("Error processing line:", p, g), d.enqueue(n.encode(p + `
81687
+ g(p, { controller: f, encoder: n, reasoningContent: () => o, appendReasoningContent: (y) => o += y, isReasoningComplete: () => i, setReasoningComplete: (y) => i = y });
81688
+ } catch (y) {
81689
+ console.error("Error processing line:", p, y), f.enqueue(n.encode(p + `
81688
81690
  `));
81689
81691
  }
81690
81692
  }
81691
81693
  } catch (A) {
81692
- console.error("Stream error:", A), d.error(A);
81694
+ console.error("Stream error:", A), f.error(A);
81693
81695
  } finally {
81694
81696
  try {
81695
- f.releaseLock();
81697
+ d.releaseLock();
81696
81698
  } catch (A) {
81697
81699
  console.error("Error releasing reader lock:", A);
81698
81700
  }
81699
- d.close();
81701
+ f.close();
81700
81702
  }
81701
81703
  } });
81702
81704
  return new Response(l, { status: e.status, statusText: e.statusText, headers: { "Content-Type": "text/event-stream", "Cache-Control": "no-cache", Connection: "keep-alive" } });
@@ -81729,8 +81731,8 @@ function ug(r) {
81729
81731
  let e = [];
81730
81732
  for (let n = 0; n < r.messages.length; n++) {
81731
81733
  let o = r.messages[n], i = n === r.messages.length - 1, u = o.role === "assistant", l = [];
81732
- typeof o.content == "string" ? l.push({ type: "text", text: o.content }) : Array.isArray(o.content) && o.content.forEach((d) => {
81733
- d.type === "text" ? l.push({ type: "text", text: d.text || "" }) : d.type === "image_url" && l.push({ type: "image", source: { type: "base64", media_type: d.media_type || "image/jpeg", data: d.image_url.url } });
81734
+ typeof o.content == "string" ? l.push({ type: "text", text: o.content }) : Array.isArray(o.content) && o.content.forEach((f) => {
81735
+ f.type === "text" ? l.push({ type: "text", text: f.text || "" }) : f.type === "image_url" && l.push({ type: "image", source: { type: "base64", media_type: f.media_type || "image/jpeg", data: f.image_url.url } });
81734
81736
  }), !(!i && l.length === 0 && !o.tool_calls && !o.content) && (i && u && l.length === 0 && o.tool_calls && l.push({ type: "text", text: "" }), e.push({ role: o.role === "assistant" ? "assistant" : "user", content: l }));
81735
81737
  }
81736
81738
  let t = { anthropic_version: "vertex-2023-10-16", messages: e, max_tokens: r.max_tokens || 1e3, stream: r.stream || false, ...r.temperature && { temperature: r.temperature } };
@@ -81751,60 +81753,60 @@ async function lg(r, e, t) {
81751
81753
  return new Response(JSON.stringify(i), { status: r.status, statusText: r.statusText, headers: r.headers });
81752
81754
  } else if (r.headers.get("Content-Type")?.includes("stream")) {
81753
81755
  if (!r.body) return r;
81754
- let n = new TextDecoder(), o = new TextEncoder(), i = (l, d) => {
81756
+ let n = new TextDecoder(), o = new TextEncoder(), i = (l, f) => {
81755
81757
  if (l.startsWith("data: ")) {
81756
- let f = l.slice(6).trim();
81757
- if (f) {
81758
- t?.debug({ chunkStr: f }, `${e} chunk:`);
81758
+ let d = l.slice(6).trim();
81759
+ if (d) {
81760
+ t?.debug({ chunkStr: d }, `${e} chunk:`);
81759
81761
  try {
81760
- let h = JSON.parse(f);
81762
+ let h = JSON.parse(d);
81761
81763
  if (h.type === "content_block_delta" && h.delta?.type === "text_delta") {
81762
- let _ = { choices: [{ delta: { role: "assistant", content: h.delta.text || "" }, finish_reason: null, index: 0, logprobs: null }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), id: h.id || "", model: h.model || "", object: "chat.completion.chunk", system_fingerprint: "fp_a49d71b8a1", usage: { completion_tokens: h.usage?.output_tokens || 0, prompt_tokens: h.usage?.input_tokens || 0, total_tokens: (h.usage?.input_tokens || 0) + (h.usage?.output_tokens || 0) } };
81763
- d.enqueue(o.encode(`data: ${JSON.stringify(_)}
81764
+ let g = { choices: [{ delta: { role: "assistant", content: h.delta.text || "" }, finish_reason: null, index: 0, logprobs: null }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), id: h.id || "", model: h.model || "", object: "chat.completion.chunk", system_fingerprint: "fp_a49d71b8a1", usage: { completion_tokens: h.usage?.output_tokens || 0, prompt_tokens: h.usage?.input_tokens || 0, total_tokens: (h.usage?.input_tokens || 0) + (h.usage?.output_tokens || 0) } };
81765
+ f.enqueue(o.encode(`data: ${JSON.stringify(g)}
81764
81766
 
81765
81767
  `));
81766
81768
  } else if (h.type === "content_block_delta" && h.delta?.type === "input_json_delta") {
81767
- let _ = { choices: [{ delta: { tool_calls: [{ index: h.index || 0, function: { arguments: h.delta.partial_json || "" } }] }, finish_reason: null, index: 0, logprobs: null }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), id: h.id || "", model: h.model || "", object: "chat.completion.chunk", system_fingerprint: "fp_a49d71b8a1", usage: { completion_tokens: h.usage?.output_tokens || 0, prompt_tokens: h.usage?.input_tokens || 0, total_tokens: (h.usage?.input_tokens || 0) + (h.usage?.output_tokens || 0) } };
81768
- d.enqueue(o.encode(`data: ${JSON.stringify(_)}
81769
+ let g = { choices: [{ delta: { tool_calls: [{ index: h.index || 0, function: { arguments: h.delta.partial_json || "" } }] }, finish_reason: null, index: 0, logprobs: null }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), id: h.id || "", model: h.model || "", object: "chat.completion.chunk", system_fingerprint: "fp_a49d71b8a1", usage: { completion_tokens: h.usage?.output_tokens || 0, prompt_tokens: h.usage?.input_tokens || 0, total_tokens: (h.usage?.input_tokens || 0) + (h.usage?.output_tokens || 0) } };
81770
+ f.enqueue(o.encode(`data: ${JSON.stringify(g)}
81769
81771
 
81770
81772
  `));
81771
81773
  } else if (h.type === "content_block_start" && h.content_block?.type === "tool_use") {
81772
- let _ = { choices: [{ delta: { tool_calls: [{ index: h.index || 0, id: h.content_block.id, type: "function", function: { name: h.content_block.name, arguments: "" } }] }, finish_reason: null, index: 0, logprobs: null }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), id: h.id || "", model: h.model || "", object: "chat.completion.chunk", system_fingerprint: "fp_a49d71b8a1", usage: { completion_tokens: h.usage?.output_tokens || 0, prompt_tokens: h.usage?.input_tokens || 0, total_tokens: (h.usage?.input_tokens || 0) + (h.usage?.output_tokens || 0) } };
81773
- d.enqueue(o.encode(`data: ${JSON.stringify(_)}
81774
+ let g = { choices: [{ delta: { tool_calls: [{ index: h.index || 0, id: h.content_block.id, type: "function", function: { name: h.content_block.name, arguments: "" } }] }, finish_reason: null, index: 0, logprobs: null }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), id: h.id || "", model: h.model || "", object: "chat.completion.chunk", system_fingerprint: "fp_a49d71b8a1", usage: { completion_tokens: h.usage?.output_tokens || 0, prompt_tokens: h.usage?.input_tokens || 0, total_tokens: (h.usage?.input_tokens || 0) + (h.usage?.output_tokens || 0) } };
81775
+ f.enqueue(o.encode(`data: ${JSON.stringify(g)}
81774
81776
 
81775
81777
  `));
81776
81778
  } else if (h.type === "message_delta") {
81777
- let _ = { choices: [{ delta: {}, finish_reason: h.delta?.stop_reason === "tool_use" ? "tool_calls" : h.delta?.stop_reason === "max_tokens" ? "length" : h.delta?.stop_reason === "stop_sequence" ? "content_filter" : "stop", index: 0, logprobs: null }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), id: h.id || "", model: h.model || "", object: "chat.completion.chunk", system_fingerprint: "fp_a49d71b8a1", usage: { completion_tokens: h.usage?.output_tokens || 0, prompt_tokens: h.usage?.input_tokens || 0, total_tokens: (h.usage?.input_tokens || 0) + (h.usage?.output_tokens || 0) } };
81778
- d.enqueue(o.encode(`data: ${JSON.stringify(_)}
81779
+ let g = { choices: [{ delta: {}, finish_reason: h.delta?.stop_reason === "tool_use" ? "tool_calls" : h.delta?.stop_reason === "max_tokens" ? "length" : h.delta?.stop_reason === "stop_sequence" ? "content_filter" : "stop", index: 0, logprobs: null }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), id: h.id || "", model: h.model || "", object: "chat.completion.chunk", system_fingerprint: "fp_a49d71b8a1", usage: { completion_tokens: h.usage?.output_tokens || 0, prompt_tokens: h.usage?.input_tokens || 0, total_tokens: (h.usage?.input_tokens || 0) + (h.usage?.output_tokens || 0) } };
81780
+ f.enqueue(o.encode(`data: ${JSON.stringify(g)}
81779
81781
 
81780
81782
  `));
81781
- } else if (h.type === "message_stop") d.enqueue(o.encode(`data: [DONE]
81783
+ } else if (h.type === "message_stop") f.enqueue(o.encode(`data: [DONE]
81782
81784
 
81783
81785
  `));
81784
81786
  else {
81785
- let _ = { choices: [{ delta: { role: "assistant", content: h.content?.[0]?.text || "" }, finish_reason: h.stop_reason?.toLowerCase() || null, index: 0, logprobs: null }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), id: h.id || "", model: h.model || "", object: "chat.completion.chunk", system_fingerprint: "fp_a49d71b8a1", usage: { completion_tokens: h.usage?.output_tokens || 0, prompt_tokens: h.usage?.input_tokens || 0, total_tokens: (h.usage?.input_tokens || 0) + (h.usage?.output_tokens || 0) } };
81786
- d.enqueue(o.encode(`data: ${JSON.stringify(_)}
81787
+ let g = { choices: [{ delta: { role: "assistant", content: h.content?.[0]?.text || "" }, finish_reason: h.stop_reason?.toLowerCase() || null, index: 0, logprobs: null }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), id: h.id || "", model: h.model || "", object: "chat.completion.chunk", system_fingerprint: "fp_a49d71b8a1", usage: { completion_tokens: h.usage?.output_tokens || 0, prompt_tokens: h.usage?.input_tokens || 0, total_tokens: (h.usage?.input_tokens || 0) + (h.usage?.output_tokens || 0) } };
81788
+ f.enqueue(o.encode(`data: ${JSON.stringify(g)}
81787
81789
 
81788
81790
  `));
81789
81791
  }
81790
81792
  } catch (h) {
81791
- t?.error(`Error parsing ${e} stream chunk`, f, h.message);
81793
+ t?.error(`Error parsing ${e} stream chunk`, d, h.message);
81792
81794
  }
81793
81795
  }
81794
81796
  }
81795
81797
  }, u = new ReadableStream({ async start(l) {
81796
- let d = r.body.getReader(), f = "";
81798
+ let f = r.body.getReader(), d = "";
81797
81799
  try {
81798
81800
  for (; ; ) {
81799
- let { done: h, value: _ } = await d.read();
81801
+ let { done: h, value: g } = await f.read();
81800
81802
  if (h) {
81801
- f && i(f, l);
81803
+ d && i(d, l);
81802
81804
  break;
81803
81805
  }
81804
- f += n.decode(_, { stream: true });
81805
- let A = f.split(`
81806
+ d += n.decode(g, { stream: true });
81807
+ let A = d.split(`
81806
81808
  `);
81807
- f = A.pop() || "";
81809
+ d = A.pop() || "";
81808
81810
  for (let P of A) i(P, l);
81809
81811
  }
81810
81812
  } catch (h) {
@@ -81833,8 +81835,8 @@ var ta = class {
81833
81835
  async transformRequestIn(e, t) {
81834
81836
  let n = process.env.GOOGLE_CLOUD_PROJECT, o = process.env.GOOGLE_CLOUD_LOCATION || "us-east5";
81835
81837
  if (!n && process.env.GOOGLE_APPLICATION_CREDENTIALS) try {
81836
- let l = (await import("fs")).readFileSync(process.env.GOOGLE_APPLICATION_CREDENTIALS, "utf8"), d = JSON.parse(l);
81837
- d && d.project_id && (n = d.project_id);
81838
+ let l = (await import("fs")).readFileSync(process.env.GOOGLE_APPLICATION_CREDENTIALS, "utf8"), f = JSON.parse(l);
81839
+ f && f.project_id && (n = f.project_id);
81838
81840
  } catch (u) {
81839
81841
  console.error("Error extracting project_id from GOOGLE_APPLICATION_CREDENTIALS:", u);
81840
81842
  }
@@ -81921,19 +81923,19 @@ var ia = class {
81921
81923
  return new Response(JSON.stringify(t), { status: e.status, statusText: e.statusText, headers: e.headers });
81922
81924
  } else if (e.headers.get("Content-Type")?.includes("stream")) {
81923
81925
  if (!e.body) return e;
81924
- let t = new TextDecoder(), n = new TextEncoder(), o = false, i = "", u = false, l = false, d = "", f = new ReadableStream({ async start(h) {
81925
- let _ = e.body.getReader(), A = (b, w, p) => {
81926
- let g = b.split(`
81926
+ let t = new TextDecoder(), n = new TextEncoder(), o = false, i = "", u = false, l = false, f = "", d = new ReadableStream({ async start(h) {
81927
+ let g = e.body.getReader(), A = (b, w, p) => {
81928
+ let y = b.split(`
81927
81929
  `);
81928
- for (let T of g) T.trim() && w.enqueue(p.encode(T + `
81930
+ for (let T of y) T.trim() && w.enqueue(p.encode(T + `
81929
81931
  `));
81930
81932
  }, P = (b, w) => {
81931
- let { controller: p, encoder: g } = w;
81933
+ let { controller: p, encoder: y } = w;
81932
81934
  if (b.startsWith("data: ") && b.trim() !== "data: [DONE]") {
81933
81935
  let T = b.slice(6);
81934
81936
  try {
81935
81937
  let E = JSON.parse(T);
81936
- if (E.usage && (this.logger?.debug({ usage: E.usage, hasToolCall: l }, "usage"), E.choices[0].finish_reason = l ? "tool_calls" : "stop"), E.choices?.[0]?.finish_reason === "error" && p.enqueue(g.encode(`data: ${JSON.stringify({ error: E.choices?.[0].error })}
81938
+ if (E.usage && (this.logger?.debug({ usage: E.usage, hasToolCall: l }, "usage"), E.choices[0].finish_reason = l ? "tool_calls" : "stop"), E.choices?.[0]?.finish_reason === "error" && p.enqueue(y.encode(`data: ${JSON.stringify({ error: E.choices?.[0].error })}
81937
81939
 
81938
81940
  `)), E.choices?.[0]?.delta?.content && !w.hasTextContent() && w.setHasTextContent(true), E.choices?.[0]?.delta?.reasoning) {
81939
81941
  w.appendReasoningContent(E.choices[0].delta.reasoning);
@@ -81942,7 +81944,7 @@ var ia = class {
81942
81944
  let B = `data: ${JSON.stringify(F)}
81943
81945
 
81944
81946
  `;
81945
- p.enqueue(g.encode(B));
81947
+ p.enqueue(y.encode(B));
81946
81948
  return;
81947
81949
  }
81948
81950
  if (E.choices?.[0]?.delta?.content && w.reasoningContent() && !w.isReasoningComplete()) {
@@ -81952,7 +81954,7 @@ var ia = class {
81952
81954
  let G = `data: ${JSON.stringify(B)}
81953
81955
 
81954
81956
  `;
81955
- p.enqueue(g.encode(G));
81957
+ p.enqueue(y.encode(G));
81956
81958
  }
81957
81959
  E.choices?.[0]?.delta?.reasoning && delete E.choices[0].delta.reasoning, E.choices?.[0]?.delta?.tool_calls?.length && !Number.isNaN(parseInt(E.choices?.[0]?.delta?.tool_calls[0].id, 10)) && E.choices?.[0]?.delta?.tool_calls.forEach((F) => {
81958
81960
  F.id = `call_${Wt()}`;
@@ -81960,19 +81962,19 @@ var ia = class {
81960
81962
  let S = `data: ${JSON.stringify(E)}
81961
81963
 
81962
81964
  `;
81963
- p.enqueue(g.encode(S));
81965
+ p.enqueue(y.encode(S));
81964
81966
  } catch {
81965
- p.enqueue(g.encode(b + `
81967
+ p.enqueue(y.encode(b + `
81966
81968
  `));
81967
81969
  }
81968
- } else p.enqueue(g.encode(b + `
81970
+ } else p.enqueue(y.encode(b + `
81969
81971
  `));
81970
81972
  };
81971
81973
  try {
81972
81974
  for (; ; ) {
81973
- let { done: b, value: w } = await _.read();
81975
+ let { done: b, value: w } = await g.read();
81974
81976
  if (b) {
81975
- d.trim() && A(d, h, n);
81977
+ f.trim() && A(f, h, n);
81976
81978
  break;
81977
81979
  }
81978
81980
  if (!w || w.length === 0) continue;
@@ -81984,11 +81986,11 @@ var ia = class {
81984
81986
  continue;
81985
81987
  }
81986
81988
  if (p.length === 0) continue;
81987
- if (d += p, d.length > 1e6) {
81989
+ if (f += p, f.length > 1e6) {
81988
81990
  console.warn("Buffer size exceeds limit, processing partial data");
81989
- let T = d.split(`
81991
+ let T = f.split(`
81990
81992
  `);
81991
- d = T.pop() || "";
81993
+ f = T.pop() || "";
81992
81994
  for (let E of T) if (E.trim()) try {
81993
81995
  P(E, { controller: h, encoder: n, hasTextContent: () => o, setHasTextContent: (S) => o = S, reasoningContent: () => i, appendReasoningContent: (S) => i += S, isReasoningComplete: () => u, setReasoningComplete: (S) => u = S });
81994
81996
  } catch (S) {
@@ -81997,10 +81999,10 @@ var ia = class {
81997
81999
  }
81998
82000
  continue;
81999
82001
  }
82000
- let g = d.split(`
82002
+ let y = f.split(`
82001
82003
  `);
82002
- d = g.pop() || "";
82003
- for (let T of g) if (T.trim()) try {
82004
+ f = y.pop() || "";
82005
+ for (let T of y) if (T.trim()) try {
82004
82006
  P(T, { controller: h, encoder: n, hasTextContent: () => o, setHasTextContent: (E) => o = E, reasoningContent: () => i, appendReasoningContent: (E) => i += E, isReasoningComplete: () => u, setReasoningComplete: (E) => u = E });
82005
82007
  } catch (E) {
82006
82008
  console.error("Error processing line:", T, E), h.enqueue(n.encode(T + `
@@ -82011,14 +82013,14 @@ var ia = class {
82011
82013
  console.error("Stream error:", b), h.error(b);
82012
82014
  } finally {
82013
82015
  try {
82014
- _.releaseLock();
82016
+ g.releaseLock();
82015
82017
  } catch (b) {
82016
82018
  console.error("Error releasing reader lock:", b);
82017
82019
  }
82018
82020
  h.close();
82019
82021
  }
82020
82022
  } });
82021
- return new Response(f, { status: e.status, statusText: e.statusText, headers: { "Content-Type": "text/event-stream", "Cache-Control": "no-cache", Connection: "keep-alive" } });
82023
+ return new Response(d, { status: e.status, statusText: e.statusText, headers: { "Content-Type": "text/event-stream", "Cache-Control": "no-cache", Connection: "keep-alive" } });
82022
82024
  }
82023
82025
  return e;
82024
82026
  }
@@ -82027,7 +82029,7 @@ var aa = class {
82027
82029
  name = "openai-responses";
82028
82030
  endPoint = "/v1/responses";
82029
82031
  async transformRequestIn(e) {
82030
- delete e.temperature, delete e.max_tokens, e.reasoning && (e.reasoning = { effort: e.reasoning.effort });
82032
+ delete e.temperature, delete e.max_tokens, e.reasoning && (e.reasoning = { effort: e.reasoning.effort, summary: "detailed" });
82031
82033
  let t = [], n = e.messages.filter((o) => o.role === "system");
82032
82034
  if (n.length > 0) {
82033
82035
  let o = n[0];
@@ -82072,27 +82074,27 @@ var aa = class {
82072
82074
  return new Response(JSON.stringify(n), { status: e.status, statusText: e.statusText, headers: e.headers });
82073
82075
  } else if (t.includes("text/event-stream")) {
82074
82076
  if (!e.body) return e;
82075
- let n = new TextDecoder(), o = new TextEncoder(), i = "", u = false, l = this, d = new ReadableStream({ async start(f) {
82076
- let h = e.body.getReader(), _ = -1, A = "", P = (b) => (b !== A && (_++, A = b), _);
82077
+ let n = new TextDecoder(), o = new TextEncoder(), i = "", u = false, l = this, f = new ReadableStream({ async start(d) {
82078
+ let h = e.body.getReader(), g = -1, A = "", P = (b) => (b !== A && (g++, A = b), g);
82077
82079
  try {
82078
82080
  for (; ; ) {
82079
82081
  let { done: b, value: w } = await h.read();
82080
82082
  if (b) {
82081
- u || f.enqueue(o.encode(`data: [DONE]
82083
+ u || d.enqueue(o.encode(`data: [DONE]
82082
82084
 
82083
82085
  `));
82084
82086
  break;
82085
82087
  }
82086
82088
  let p = n.decode(w, { stream: true });
82087
82089
  i += p;
82088
- let g = i.split(/\r?\n/);
82089
- i = g.pop() || "";
82090
- for (let T of g) if (T.trim()) try {
82090
+ let y = i.split(/\r?\n/);
82091
+ i = y.pop() || "";
82092
+ for (let T of y) if (T.trim()) try {
82091
82093
  if (T.startsWith("event: ")) continue;
82092
82094
  if (T.startsWith("data: ")) {
82093
82095
  let E = T.slice(5).trim();
82094
82096
  if (E === "[DONE]") {
82095
- u = true, f.enqueue(o.encode(`data: [DONE]
82097
+ u = true, d.enqueue(o.encode(`data: [DONE]
82096
82098
 
82097
82099
  `));
82098
82100
  continue;
@@ -82101,12 +82103,12 @@ var aa = class {
82101
82103
  let S = JSON.parse(E);
82102
82104
  if (S.type === "response.output_text.delta") {
82103
82105
  let F = { id: S.item_id || "chatcmpl-" + Date.now(), object: "chat.completion.chunk", created: Math.floor(Date.now() / 1e3), model: S.response?.model, choices: [{ index: P(S.type), delta: { content: S.delta || "" }, finish_reason: null }] };
82104
- f.enqueue(o.encode(`data: ${JSON.stringify(F)}
82106
+ d.enqueue(o.encode(`data: ${JSON.stringify(F)}
82105
82107
 
82106
82108
  `));
82107
82109
  } else if (S.type === "response.output_item.added" && S.item?.type === "function_call") {
82108
82110
  let F = { id: S.item.call_id || S.item.id || "chatcmpl-" + Date.now(), object: "chat.completion.chunk", created: Math.floor(Date.now() / 1e3), model: S.response?.model || "gpt-5-codex-", choices: [{ index: P(S.type), delta: { role: "assistant", tool_calls: [{ index: 0, id: S.item.call_id || S.item.id, function: { name: S.item.name || "", arguments: "" }, type: "function" }] }, finish_reason: null }] };
82109
- f.enqueue(o.encode(`data: ${JSON.stringify(F)}
82111
+ d.enqueue(o.encode(`data: ${JSON.stringify(F)}
82110
82112
 
82111
82113
  `));
82112
82114
  } else if (S.type === "response.output_item.added" && S.item?.type === "message") {
@@ -82117,63 +82119,63 @@ var aa = class {
82117
82119
  let B = { role: "assistant" };
82118
82120
  if (F.length === 1 && F[0].type === "text" ? B.content = F[0].text : F.length > 0 && (B.content = F), B.content) {
82119
82121
  let G = { id: S.item.id || "chatcmpl-" + Date.now(), object: "chat.completion.chunk", created: Math.floor(Date.now() / 1e3), model: S.response?.model, choices: [{ index: P(S.type), delta: B, finish_reason: null }] };
82120
- f.enqueue(o.encode(`data: ${JSON.stringify(G)}
82122
+ d.enqueue(o.encode(`data: ${JSON.stringify(G)}
82121
82123
 
82122
82124
  `));
82123
82125
  }
82124
82126
  } else if (S.type === "response.output_text.annotation.added") {
82125
82127
  let F = { id: S.item_id || "chatcmpl-" + Date.now(), object: "chat.completion.chunk", created: Math.floor(Date.now() / 1e3), model: S.response?.model || "gpt-5-codex", choices: [{ index: P(S.type), delta: { annotations: [{ type: "url_citation", url_citation: { url: S.annotation?.url || "", title: S.annotation?.title || "", content: "", start_index: S.annotation?.start_index || 0, end_index: S.annotation?.end_index || 0 } }] }, finish_reason: null }] };
82126
- f.enqueue(o.encode(`data: ${JSON.stringify(F)}
82128
+ d.enqueue(o.encode(`data: ${JSON.stringify(F)}
82127
82129
 
82128
82130
  `));
82129
82131
  } else if (S.type === "response.function_call_arguments.delta") {
82130
82132
  let F = { id: S.item_id || "chatcmpl-" + Date.now(), object: "chat.completion.chunk", created: Math.floor(Date.now() / 1e3), model: S.response?.model || "gpt-5-codex-", choices: [{ index: P(S.type), delta: { tool_calls: [{ index: 0, function: { arguments: S.delta || "" } }] }, finish_reason: null }] };
82131
- f.enqueue(o.encode(`data: ${JSON.stringify(F)}
82133
+ d.enqueue(o.encode(`data: ${JSON.stringify(F)}
82132
82134
 
82133
82135
  `));
82134
82136
  } else if (S.type === "response.completed") {
82135
82137
  let F = S.response?.output?.some((G) => G.type === "function_call") ? "tool_calls" : "stop", B = { id: S.response?.id || "chatcmpl-" + Date.now(), object: "chat.completion.chunk", created: Math.floor(Date.now() / 1e3), model: S.response?.model || "gpt-5-codex-", choices: [{ index: 0, delta: {}, finish_reason: F }] };
82136
- f.enqueue(o.encode(`data: ${JSON.stringify(B)}
82138
+ d.enqueue(o.encode(`data: ${JSON.stringify(B)}
82137
82139
 
82138
82140
  `)), u = true;
82139
82141
  } else if (S.type === "response.reasoning_summary_text.delta") {
82140
82142
  let F = { id: S.item_id || "chatcmpl-" + Date.now(), object: "chat.completion.chunk", created: Math.floor(Date.now() / 1e3), model: S.response?.model, choices: [{ index: P(S.type), delta: { thinking: { content: S.delta || "" } }, finish_reason: null }] };
82141
- f.enqueue(o.encode(`data: ${JSON.stringify(F)}
82143
+ d.enqueue(o.encode(`data: ${JSON.stringify(F)}
82142
82144
 
82143
82145
  `));
82144
82146
  } else if (S.type === "response.reasoning_summary_part.done" && S.part) {
82145
- let F = { id: S.item_id || "chatcmpl-" + Date.now(), object: "chat.completion.chunk", created: Math.floor(Date.now() / 1e3), model: S.response?.model, choices: [{ index: _, delta: { thinking: { signature: S.item_id } }, finish_reason: null }] };
82146
- f.enqueue(o.encode(`data: ${JSON.stringify(F)}
82147
+ let F = { id: S.item_id || "chatcmpl-" + Date.now(), object: "chat.completion.chunk", created: Math.floor(Date.now() / 1e3), model: S.response?.model, choices: [{ index: g, delta: { thinking: { signature: S.item_id } }, finish_reason: null }] };
82148
+ d.enqueue(o.encode(`data: ${JSON.stringify(F)}
82147
82149
 
82148
82150
  `));
82149
82151
  }
82150
82152
  } catch {
82151
- f.enqueue(o.encode(T + `
82153
+ d.enqueue(o.encode(T + `
82152
82154
  `));
82153
82155
  }
82154
- } else f.enqueue(o.encode(T + `
82156
+ } else d.enqueue(o.encode(T + `
82155
82157
  `));
82156
82158
  } catch (E) {
82157
- console.error("Error processing line:", T, E), f.enqueue(o.encode(T + `
82159
+ console.error("Error processing line:", T, E), d.enqueue(o.encode(T + `
82158
82160
  `));
82159
82161
  }
82160
82162
  }
82161
- i.trim() && f.enqueue(o.encode(i + `
82162
- `)), u || f.enqueue(o.encode(`data: [DONE]
82163
+ i.trim() && d.enqueue(o.encode(i + `
82164
+ `)), u || d.enqueue(o.encode(`data: [DONE]
82163
82165
 
82164
82166
  `));
82165
82167
  } catch (b) {
82166
- console.error("Stream error:", b), f.error(b);
82168
+ console.error("Stream error:", b), d.error(b);
82167
82169
  } finally {
82168
82170
  try {
82169
82171
  h.releaseLock();
82170
82172
  } catch (b) {
82171
82173
  console.error("Error releasing reader lock:", b);
82172
82174
  }
82173
- f.close();
82175
+ d.close();
82174
82176
  }
82175
82177
  } });
82176
- return new Response(d, { status: e.status, statusText: e.statusText, headers: { "Content-Type": "text/event-stream", "Cache-Control": "no-cache", Connection: "keep-alive", "Access-Control-Allow-Origin": "*" } });
82178
+ return new Response(f, { status: e.status, statusText: e.statusText, headers: { "Content-Type": "text/event-stream", "Cache-Control": "no-cache", Connection: "keep-alive", "Access-Control-Allow-Origin": "*" } });
82177
82179
  }
82178
82180
  return e;
82179
82181
  }
@@ -82188,24 +82190,24 @@ var aa = class {
82188
82190
  return null;
82189
82191
  }
82190
82192
  convertResponseToChat(e) {
82191
- let t = e.output?.find((f) => f.type === "message"), n = e.output?.find((f) => f.type === "function_call"), o;
82192
- t?.content?.length && t?.content[0].annotations && (o = t.content[0].annotations.map((f) => ({ type: "url_citation", url_citation: { url: f.url || "", title: f.title || "", content: "", start_index: f.start_index || 0, end_index: f.end_index || 0 } }))), this.logger.debug({ data: o, type: "url_citation" });
82193
+ let t = e.output?.find((d) => d.type === "message"), n = e.output?.find((d) => d.type === "function_call"), o;
82194
+ t?.content?.length && t?.content[0].annotations && (o = t.content[0].annotations.map((d) => ({ type: "url_citation", url_citation: { url: d.url || "", title: d.title || "", content: "", start_index: d.start_index || 0, end_index: d.end_index || 0 } }))), this.logger.debug({ data: o, type: "url_citation" });
82193
82195
  let i = null, u = null, l = null;
82194
82196
  if (t && t.reasoning && (l = { content: t.reasoning }), t && t.content) {
82195
- let f = [], h = [];
82196
- if (t.content.forEach((_) => {
82197
- if (_.type === "output_text") f.push(_.text || "");
82198
- else if (_.type === "output_image") {
82199
- let A = this.buildImageContent({ url: _.image_url, mime_type: _.mime_type });
82197
+ let d = [], h = [];
82198
+ if (t.content.forEach((g) => {
82199
+ if (g.type === "output_text") d.push(g.text || "");
82200
+ else if (g.type === "output_image") {
82201
+ let A = this.buildImageContent({ url: g.image_url, mime_type: g.mime_type });
82200
82202
  A && h.push(A);
82201
- } else if (_.type === "output_image_base64") {
82202
- let A = this.buildImageContent({ b64_json: _.image_base64, mime_type: _.mime_type });
82203
+ } else if (g.type === "output_image_base64") {
82204
+ let A = this.buildImageContent({ b64_json: g.image_base64, mime_type: g.mime_type });
82203
82205
  A && h.push(A);
82204
82206
  }
82205
82207
  }), h.length > 0) {
82206
- let _ = [];
82207
- f.length > 0 && _.push({ type: "text", text: f.join("") }), _.push(...h), i = _;
82208
- } else i = f.join("");
82208
+ let g = [];
82209
+ d.length > 0 && g.push({ type: "text", text: d.join("") }), g.push(...h), i = g;
82210
+ } else i = d.join("");
82209
82211
  }
82210
82212
  return n && (u = [{ id: n.call_id || n.id, function: { name: n.name, arguments: n.arguments }, type: "function" }]), { id: e.id || "chatcmpl-" + Date.now(), object: "chat.completion", created: e.created_at, model: e.model, choices: [{ index: 0, message: { role: "assistant", content: i || null, tool_calls: u, thinking: l, annotations: o }, logprobs: null, finish_reason: u ? "tool_calls" : "stop" }], usage: e.usage ? { prompt_tokens: e.usage.input_tokens || 0, completion_tokens: e.usage.output_tokens || 0, total_tokens: e.usage.total_tokens || 0 } : null };
82211
82213
  }
@@ -82242,28 +82244,28 @@ var ua = class {
82242
82244
  } else if (e.headers.get("Content-Type")?.includes("stream")) {
82243
82245
  if (!e.body) return e;
82244
82246
  let o = new TextDecoder(), i = new TextEncoder(), u = new ReadableStream({ async start(l) {
82245
- let d = e.body.getReader(), f = "", h = "SEARCHING", _ = "", A = "", P = (b, w) => {
82247
+ let f = e.body.getReader(), d = "", h = "SEARCHING", g = "", A = "", P = (b, w) => {
82246
82248
  if (typeof w != "string") {
82247
82249
  b.choices?.[0]?.delta && Object.keys(b.choices[0].delta).length > 0 && !b.choices[0].delta.content && l.enqueue(i.encode(`data: ${JSON.stringify(b)}
82248
82250
 
82249
82251
  `));
82250
82252
  return;
82251
82253
  }
82252
- let p = _ + w;
82253
- for (_ = ""; p.length > 0; ) if (h === "SEARCHING") {
82254
- let g = p.indexOf(t);
82255
- if (g !== -1) p = p.substring(g + t.length), h = "REASONING";
82254
+ let p = g + w;
82255
+ for (g = ""; p.length > 0; ) if (h === "SEARCHING") {
82256
+ let y = p.indexOf(t);
82257
+ if (y !== -1) p = p.substring(y + t.length), h = "REASONING";
82256
82258
  else {
82257
82259
  for (let T = t.length - 1; T > 0; T--) if (p.endsWith(t.substring(0, T))) {
82258
- _ = p.substring(p.length - T);
82260
+ g = p.substring(p.length - T);
82259
82261
  break;
82260
82262
  }
82261
82263
  p = "";
82262
82264
  }
82263
82265
  } else if (h === "REASONING") {
82264
- let g = p.indexOf(n);
82265
- if (g !== -1) {
82266
- let T = p.substring(0, g);
82266
+ let y = p.indexOf(n);
82267
+ if (y !== -1) {
82268
+ let T = p.substring(0, y);
82267
82269
  if (T.length > 0) {
82268
82270
  let F = { ...b.choices[0].delta, thinking: { content: T } };
82269
82271
  delete F.content;
@@ -82277,11 +82279,11 @@ var ua = class {
82277
82279
  let S = { ...b, choices: [{ ...b.choices[0], delta: E }] };
82278
82280
  l.enqueue(i.encode(`data: ${JSON.stringify(S)}
82279
82281
 
82280
- `)), p = p.substring(g + n.length), h = "FINAL";
82282
+ `)), p = p.substring(y + n.length), h = "FINAL";
82281
82283
  } else {
82282
82284
  let T = p;
82283
82285
  for (let E = n.length - 1; E > 0; E--) if (p.endsWith(n.substring(0, E))) {
82284
- _ = p.substring(p.length - E), T = p.substring(0, p.length - E);
82286
+ g = p.substring(p.length - E), T = p.substring(0, p.length - E);
82285
82287
  break;
82286
82288
  }
82287
82289
  if (T.length > 0) {
@@ -82309,14 +82311,14 @@ var ua = class {
82309
82311
  };
82310
82312
  try {
82311
82313
  for (; ; ) {
82312
- let { done: b, value: w } = await d.read();
82314
+ let { done: b, value: w } = await f.read();
82313
82315
  if (b) break;
82314
82316
  let p = o.decode(w, { stream: true });
82315
- f += p;
82316
- let g = f.split(`
82317
+ d += p;
82318
+ let y = d.split(`
82317
82319
  `);
82318
- f = g.pop() || "";
82319
- for (let T of g) if (T.trim()) {
82320
+ d = y.pop() || "";
82321
+ for (let T of y) if (T.trim()) {
82320
82322
  if (T.trim() === "data: [DONE]") {
82321
82323
  l.enqueue(i.encode(T + `
82322
82324
 
@@ -82338,7 +82340,7 @@ var ua = class {
82338
82340
  console.error("Stream error:", b), l.error(b);
82339
82341
  } finally {
82340
82342
  try {
82341
- d.releaseLock();
82343
+ f.releaseLock();
82342
82344
  } catch (b) {
82343
82345
  console.error("Error releasing reader lock:", b);
82344
82346
  }