@cbortech/cbor 0.25.11 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { a as e, i as t, n, o as r, r as i, t as a } from "./tokenizer-DkLlZ1gc.js";
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./tokenizer-CeuixxXi.js";
2
2
  //#region src/tag.ts
3
3
  var o = Symbol.for("cbor.tag"), s = class {
4
4
  valueOf() {
@@ -717,7 +717,7 @@ var j = class extends O {
717
717
  e.writeByte(255);
718
718
  }
719
719
  _toCDN(e, t) {
720
- return (e?.encodingIndicators ?? "auto") === "never" ? new B(this.chunks.map((e) => e.value).join(""))._toCDN(e, t) : this.chunks.length === 0 ? "\"\"_" : `(_ ${this.chunks.map((t) => t._toCDN(e, 0)).join(", ")})`;
720
+ return (e?.encodingIndicators ?? "auto") === "never" ? new V(this.chunks.map((e) => e.value).join(""))._toCDN(e, t) : this.chunks.length === 0 ? "\"\"_" : `(_ ${this.chunks.map((t) => t._toCDN(e, 0)).join(", ")})`;
721
721
  }
722
722
  _toHexDump(e, t) {
723
723
  let r = [{
@@ -879,13 +879,13 @@ var j = class extends O {
879
879
  }
880
880
  return n;
881
881
  };
882
- return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof B) ? (() => {
882
+ return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof V) ? (() => {
883
883
  let n = e ? {
884
884
  ...e,
885
885
  reviver: void 0
886
886
  } : void 0, r = {};
887
887
  for (let [e, t] of this.entries) {
888
- let i = e instanceof B ? e.value : e.toCDN(), a = t._toJS(n);
888
+ let i = e instanceof V ? e.value : e.toCDN(), a = t._toJS(n);
889
889
  i === "__proto__" ? Object.defineProperty(r, i, {
890
890
  value: a,
891
891
  writable: !0,
@@ -897,10 +897,10 @@ var j = class extends O {
897
897
  let i = /* @__PURE__ */ new Map();
898
898
  for (let e = 0; e < this.entries.length; e++) {
899
899
  let [t] = this.entries[e];
900
- i.set(t instanceof B ? t.value : t.toCDN(), e);
900
+ i.set(t instanceof V ? t.value : t.toCDN(), e);
901
901
  }
902
902
  for (let n = 0; n < this.entries.length; n++) {
903
- let [a, o] = this.entries[n], s = a instanceof B ? a.value : a.toCDN();
903
+ let [a, o] = this.entries[n], s = a instanceof V ? a.value : a.toCDN();
904
904
  if (i.get(s) !== n) continue;
905
905
  let c = o._toJS(e), l = t.call(r, s, c);
906
906
  l === h || e?.undefinedOmits && l === void 0 ? delete r[s] : s === "__proto__" ? Object.defineProperty(r, s, {
@@ -991,13 +991,13 @@ var R = class e extends O {
991
991
  }
992
992
  }, We = 999n, Ge = class extends M {
993
993
  constructor(e, t) {
994
- let n = t.length === 1 && t[0] instanceof B ? t[0] : new I(t);
995
- super(We, new I([new B(e), n]));
994
+ let n = t.length === 1 && t[0] instanceof V ? t[0] : new I(t);
995
+ super(We, new I([new V(e), n]));
996
996
  }
997
997
  _toCDN(e, t) {
998
998
  if (e?.appStrings === !1) return super._toCDN(e, t);
999
999
  let n = this.content, r = n.items[0].value, i = n.items[1];
1000
- return i instanceof B ? `${r}${xe(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
1000
+ return i instanceof V ? `${r}${xe(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
1001
1001
  }
1002
1002
  }, Ke = class extends O {
1003
1003
  inner;
@@ -1219,14 +1219,24 @@ function pt(e) {
1219
1219
  return a + 1;
1220
1220
  };
1221
1221
  }
1222
- var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, ht = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, gt = /* @__PURE__ */ new Map([
1222
+ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, ht = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, B = (e) => `'${e}' is a default built-in extension that was excluded via the 'builtinExtensions' option; add it back to that array (or omit 'builtinExtensions' to use the default set)`, gt = /* @__PURE__ */ new Map([
1223
1223
  ["b32", mt("b32")],
1224
1224
  ["h32", mt("h32")],
1225
- ["float", mt("float")],
1226
1225
  ["same", mt("same")],
1227
1226
  ["hash", ht("hash", "@cbortech/hash-extension")],
1228
1227
  ["uuid", ht("uuid", "@cbortech/uuid-extension")],
1229
- ["UUID", ht("uuid", "@cbortech/uuid-extension")]
1228
+ ["UUID", ht("uuid", "@cbortech/uuid-extension")],
1229
+ ["dt", B("dt")],
1230
+ ["DT", B("dt")],
1231
+ ["ip", B("ip")],
1232
+ ["IP", B("ip")],
1233
+ ["cri", B("cri")],
1234
+ ["CRI", B("cri")],
1235
+ ["t1", B("t1")],
1236
+ ["b1", B("b1")],
1237
+ ["ilbs", B("ilbs")],
1238
+ ["ilts", B("ilts")],
1239
+ ["float", B("float")]
1230
1240
  ]), _t = class {
1231
1241
  t;
1232
1242
  _options;
@@ -1237,7 +1247,8 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1237
1247
  _hintedPrefixes = /* @__PURE__ */ new Set();
1238
1248
  constructor(e, t) {
1239
1249
  this.t = e, this._options = t, this.extByPrefix = /* @__PURE__ */ new Map(), this.extByTag = /* @__PURE__ */ new Map(), this.unresolvedExtension = t.unresolvedExtension ?? "cpa999";
1240
- for (let e of [...Z, ...t.extensions ?? []]) {
1250
+ let n = Z(t.builtinExtensions);
1251
+ for (let e of [...n, ...t.extensions ?? []]) {
1241
1252
  for (let t of e.appStringPrefixes ?? []) this.extByPrefix.set(t, e);
1242
1253
  for (let t of e.tagNumbers ?? []) this.extByTag.set(t, e);
1243
1254
  }
@@ -1307,7 +1318,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1307
1318
  }
1308
1319
  let r = this.extByPrefix.get(e.appPrefix);
1309
1320
  if (!r?.parseAppString) {
1310
- if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new Ge(e.appPrefix, [new B(e.value)]);
1321
+ if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new Ge(e.appPrefix, [new V(e.value)]);
1311
1322
  this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
1312
1323
  }
1313
1324
  {
@@ -1321,7 +1332,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1321
1332
  }) : (i instanceof j && i.ednSource === void 0 && (i.ednSource = e.raw + n), i);
1322
1333
  } catch (t) {
1323
1334
  if (this._options.strict !== !1) throw t;
1324
- return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new Ge(e.appPrefix, [new B(e.value)]);
1335
+ return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new Ge(e.appPrefix, [new V(e.value)]);
1325
1336
  }
1326
1337
  }
1327
1338
  }
@@ -1403,7 +1414,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1403
1414
  let e = this.t.consume();
1404
1415
  if (this.t.peek().type !== "PLUS") {
1405
1416
  let t = this.consumeEncodingIndicator(() => BigInt(nt.encode(e.value).length));
1406
- return new B(e.value, t === void 0 ? void 0 : { encodingWidth: t });
1417
+ return new V(e.value, t === void 0 ? void 0 : { encodingWidth: t });
1407
1418
  }
1408
1419
  let t = !1, n = [{ text: e.value }];
1409
1420
  for (; this.t.peek().type === "PLUS";) {
@@ -1413,14 +1424,14 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1413
1424
  }
1414
1425
  if (!t) {
1415
1426
  let e = n.map((e) => "text" in e ? e.text : ""), t = e.join(""), r = this.consumeEncodingIndicator(() => BigInt(nt.encode(t).length));
1416
- return new B(t, {
1427
+ return new V(t, {
1417
1428
  ednParts: e,
1418
1429
  ...r === void 0 ? {} : { encodingWidth: r }
1419
1430
  });
1420
1431
  }
1421
1432
  let r = [], i = "";
1422
- for (let e of n) "ellipsis" in e ? (i !== "" && (r.push(new B(i)), i = ""), r.push(new z())) : i += e.text;
1423
- return i !== "" && r.push(new B(i)), new z(r);
1433
+ for (let e of n) "ellipsis" in e ? (i !== "" && (r.push(new V(i)), i = ""), r.push(new z())) : i += e.text;
1434
+ return i !== "" && r.push(new V(i)), new z(r);
1424
1435
  }
1425
1436
  _isBytesToken(e) {
1426
1437
  return e === "BYTES_HEX" || e === "SQSTR" || e === "BYTES_B64";
@@ -1622,9 +1633,9 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1622
1633
  }));
1623
1634
  return t.length > 0 && (e.warnings = t), e;
1624
1635
  }
1625
- if (r instanceof B) {
1636
+ if (r instanceof V) {
1626
1637
  let e = new F(n.map((e, t) => {
1627
- if (e instanceof B) return e;
1638
+ if (e instanceof V) return e;
1628
1639
  this._fail(`indefinite text string chunk ${t} must be a text string, not a byte string`);
1629
1640
  }));
1630
1641
  return t.length > 0 && (e.warnings = t), e;
@@ -1667,7 +1678,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1667
1678
  let r = this._validateEncodingFit(BigInt(e.value.length), t, n);
1668
1679
  r !== void 0 && (e.encodingWidth = r);
1669
1680
  }
1670
- } else if (e instanceof B) {
1681
+ } else if (e instanceof V) {
1671
1682
  if (e.encodingWidth === void 0) {
1672
1683
  let r = this._validateEncodingFit(BigInt(nt.encode(e.value).length), t, n);
1673
1684
  r !== void 0 && (e.encodingWidth = r);
@@ -1745,7 +1756,7 @@ function vt(e) {
1745
1756
  }
1746
1757
  //#endregion
1747
1758
  //#region src/ast/CborTextString.ts
1748
- var yt = new TextEncoder(), bt = !1, B = class extends O {
1759
+ var yt = new TextEncoder(), bt = !1, V = class extends O {
1749
1760
  indefiniteLength = !1;
1750
1761
  value;
1751
1762
  encodingWidth;
@@ -1952,7 +1963,7 @@ function Pt(e, t) {
1952
1963
  }
1953
1964
  //#endregion
1954
1965
  //#region src/extensions/dt.ts
1955
- function V(e) {
1966
+ function H(e) {
1956
1967
  if (Number.isInteger(e)) return (/* @__PURE__ */ new Date(e * 1e3)).toISOString().replace(/\.000Z$/, "Z");
1957
1968
  let t = Math.round(e * 1e3);
1958
1969
  if (t / 1e3 === e) return new Date(t).toISOString().replace(/\.000Z$/, "Z");
@@ -1964,7 +1975,7 @@ var Ft = new TextDecoder("utf-8", { fatal: !0 });
1964
1975
  function It(e) {
1965
1976
  if (e.length !== 1) throw SyntaxError("dt<<...>>: expected exactly one item");
1966
1977
  let t = e[0];
1967
- if (t instanceof B) return t.value;
1978
+ if (t instanceof V) return t.value;
1968
1979
  if (t instanceof N) return Ft.decode(t.value);
1969
1980
  throw SyntaxError("dt<<...>>: expected a text string or byte string");
1970
1981
  }
@@ -1992,7 +2003,7 @@ var zt = 1n, Bt = class extends k {
1992
2003
  _toCDN(e, t) {
1993
2004
  if (e?.appStrings === !1) return super._toCDN(e, t);
1994
2005
  let n = x(e, this.encodingWidth, () => b(this.value));
1995
- return `dt'${V(Number(this.value))}'${n}`;
2006
+ return `dt'${H(Number(this.value))}'${n}`;
1996
2007
  }
1997
2008
  }, Vt = class extends A {
1998
2009
  constructor(e, t) {
@@ -2001,7 +2012,7 @@ var zt = 1n, Bt = class extends k {
2001
2012
  _toCDN(e, t) {
2002
2013
  if (e?.appStrings === !1) return super._toCDN(e, t);
2003
2014
  let n = x(e, this.encodingWidth, () => b(this.argument));
2004
- return `dt'${V(Number(this.value))}'${n}`;
2015
+ return `dt'${H(Number(this.value))}'${n}`;
2005
2016
  }
2006
2017
  }, Ht = class extends j {
2007
2018
  constructor(e, t) {
@@ -2010,7 +2021,7 @@ var zt = 1n, Bt = class extends k {
2010
2021
  _toCDN(e, t) {
2011
2022
  if (e?.appStrings === !1) return super._toCDN(e, t);
2012
2023
  let n = D(this.value), r = we(this.value, this.precision, n, e?.encodingIndicators ?? "auto");
2013
- return `dt'${V(this.value)}'${r}`;
2024
+ return `dt'${H(this.value)}'${r}`;
2014
2025
  }
2015
2026
  }, Ut = class extends M {
2016
2027
  constructor(e, t) {
@@ -2024,7 +2035,7 @@ var zt = 1n, Bt = class extends k {
2024
2035
  appStrings: !1
2025
2036
  }, t);
2026
2037
  let r = n instanceof j ? n.value : Number(n.value), i = x(e, this.encodingWidth, () => b(zt));
2027
- return `DT'${V(r)}'${i}`;
2038
+ return `DT'${H(r)}'${i}`;
2028
2039
  }
2029
2040
  }, Wt = class extends Ut {
2030
2041
  constructor(e, t) {
@@ -2061,7 +2072,7 @@ function Gt(e) {
2061
2072
  }
2062
2073
  };
2063
2074
  return t && (r.fromJS = (e, t) => {
2064
- if (e instanceof Date) return new Wt(V(e.getTime() / 1e3));
2075
+ if (e instanceof Date) return new Wt(H(e.getTime() / 1e3));
2065
2076
  }, r.isJSType = (e) => e instanceof Date), r;
2066
2077
  }
2067
2078
  var Kt = Gt(), qt = Gt({ jsDate: !0 });
@@ -2119,11 +2130,11 @@ function Zt(e) {
2119
2130
  }
2120
2131
  //#endregion
2121
2132
  //#region src/extensions/ip.ts
2122
- var Qt = "ip", H = "IP", U = 52n, $t = 54n, en = new TextDecoder("utf-8", { fatal: !0 });
2133
+ var Qt = "ip", U = "IP", W = 52n, $t = 54n, en = new TextDecoder("utf-8", { fatal: !0 });
2123
2134
  function tn(e) {
2124
2135
  if (e.length !== 1) throw SyntaxError("ip<<...>>: expected exactly one item");
2125
2136
  let t = e[0];
2126
- if (t instanceof B) return t.value;
2137
+ if (t instanceof V) return t.value;
2127
2138
  if (t instanceof N) return en.decode(t.value);
2128
2139
  throw SyntaxError("ip<<...>>: expected a text string or byte string");
2129
2140
  }
@@ -2177,16 +2188,16 @@ var sn = class extends N {
2177
2188
  }
2178
2189
  _toCDN(e, t) {
2179
2190
  if (e?.appStrings === !1) return super._toCDN(e, t);
2180
- let n = this.tag === U ? 4 : 16, r = this.content;
2191
+ let n = this.tag === W ? 4 : 16, r = this.content;
2181
2192
  if (r instanceof N) {
2182
2193
  if (r.encodingWidth !== void 0) return super._toCDN(e, t);
2183
2194
  let n = x(e, this.encodingWidth, () => b(this.tag));
2184
- return `${H}'${rn(r.value)}'${n}`;
2195
+ return `${U}'${rn(r.value)}'${n}`;
2185
2196
  }
2186
2197
  if (r instanceof I && r.items.length === 2 && r.items[0] instanceof k && r.items[1] instanceof N) {
2187
2198
  if (r.encodingWidth !== void 0 || r.items[0].encodingWidth !== void 0 || r.items[1].encodingWidth !== void 0) return super._toCDN(e, t);
2188
2199
  let i = Number(r.items[0].value), a = on(r.items[1].value, n), o = x(e, this.encodingWidth, () => b(this.tag));
2189
- return `${H}'${rn(a)}/${i}'${o}`;
2200
+ return `${U}'${rn(a)}/${i}'${o}`;
2190
2201
  }
2191
2202
  return super._toCDN(e, t);
2192
2203
  }
@@ -2195,18 +2206,18 @@ function un(e, t) {
2195
2206
  let n = t.indexOf("/");
2196
2207
  if (n === -1) {
2197
2208
  let { bytes: n, isV4: r } = nn(t);
2198
- return e === H ? new ln(r ? U : $t, new N(n)) : new sn(n);
2209
+ return e === U ? new ln(r ? W : $t, new N(n)) : new sn(n);
2199
2210
  }
2200
2211
  let r = t.slice(0, n), i = t.slice(n + 1);
2201
2212
  if (!/^\d+$/.test(i)) throw SyntaxError(`ip: invalid prefix length: ${JSON.stringify(i)}`);
2202
2213
  let a = parseInt(i, 10), { bytes: o, isV4: s } = nn(r), c = s ? 32 : 128;
2203
2214
  if (a > c) throw SyntaxError(`ip: prefix length ${a} exceeds maximum ${c} for ${s ? "IPv4" : "IPv6"}`);
2204
2215
  let l = an(o, a);
2205
- return e === H ? new ln(s ? U : $t, new I([new k(BigInt(a)), new N(l)])) : new cn(a, l, s);
2216
+ return e === U ? new ln(s ? W : $t, new I([new k(BigInt(a)), new N(l)])) : new cn(a, l, s);
2206
2217
  }
2207
2218
  var dn = {
2208
- appStringPrefixes: [Qt, H],
2209
- tagNumbers: [U, $t],
2219
+ appStringPrefixes: [Qt, U],
2220
+ tagNumbers: [W, $t],
2210
2221
  parseAppString(e, t) {
2211
2222
  return un(e, t);
2212
2223
  },
@@ -2214,23 +2225,9 @@ var dn = {
2214
2225
  return un(e, tn(t));
2215
2226
  },
2216
2227
  parseTag(e, t) {
2217
- if (!(e !== U && e !== $t) && (t instanceof N || t instanceof I)) return new ln(e, t);
2228
+ if (!(e !== W && e !== $t) && (t instanceof N || t instanceof I)) return new ln(e, t);
2218
2229
  }
2219
- }, fn = 18446744073709551615n, pn = -18446744073709551616n, mn = {
2220
- tagNumbers: [Je, Ye],
2221
- parseTag(e, t) {
2222
- if (t instanceof N) {
2223
- if (e === 2n) {
2224
- let e = $e(t.value);
2225
- return e > fn ? new et(e) : void 0;
2226
- }
2227
- if (e === 3n) {
2228
- let e = -1n - $e(t.value);
2229
- return e < pn ? new tt(e) : void 0;
2230
- }
2231
- }
2232
- }
2233
- }, hn = "cri", gn = "CRI", _n = 99n, vn = /* @__PURE__ */ new Map([
2230
+ }, fn = "cri", pn = "CRI", mn = 99n, hn = /* @__PURE__ */ new Map([
2234
2231
  ["coap", -1n],
2235
2232
  ["coaps", -2n],
2236
2233
  ["http", -3n],
@@ -2241,47 +2238,47 @@ var dn = {
2241
2238
  ["coaps+tcp", -8n],
2242
2239
  ["coap+ws", -25n],
2243
2240
  ["coaps+ws", -26n]
2244
- ]), yn = new Map([...vn.entries()].map(([e, t]) => [t, e]));
2245
- function W(e) {
2241
+ ]), gn = new Map([...hn.entries()].map(([e, t]) => [t, e]));
2242
+ function G(e) {
2246
2243
  try {
2247
2244
  return decodeURIComponent(e);
2248
2245
  } catch {
2249
2246
  return e;
2250
2247
  }
2251
2248
  }
2252
- var bn = new TextEncoder(), xn = new TextDecoder("utf-8", { fatal: !0 });
2253
- function Sn(e) {
2254
- return Array.from(bn.encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
2249
+ var _n = new TextEncoder(), vn = new TextDecoder("utf-8", { fatal: !0 });
2250
+ function yn(e) {
2251
+ return Array.from(_n.encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
2255
2252
  }
2256
- function G(e, t) {
2253
+ function K(e, t) {
2257
2254
  let n = "";
2258
- for (let r of e) n += t(r) ? r : Sn(r);
2255
+ for (let r of e) n += t(r) ? r : yn(r);
2259
2256
  return n;
2260
2257
  }
2261
- function Cn(e) {
2258
+ function bn(e) {
2262
2259
  return /[A-Za-z0-9\-._~]/.test(e);
2263
2260
  }
2264
- function wn(e) {
2261
+ function xn(e) {
2265
2262
  return /[!$&'()*+,;=]/.test(e);
2266
2263
  }
2267
- function Tn(e) {
2268
- return Cn(e) || wn(e) || e === ":" || e === "@";
2264
+ function Sn(e) {
2265
+ return bn(e) || xn(e) || e === ":" || e === "@";
2269
2266
  }
2270
- function En(e) {
2271
- return (Tn(e) || e === "/" || e === "?") && e !== "&";
2267
+ function Cn(e) {
2268
+ return (Sn(e) || e === "/" || e === "?") && e !== "&";
2272
2269
  }
2273
- function Dn(e) {
2274
- return Tn(e) || e === "/" || e === "?";
2270
+ function wn(e) {
2271
+ return Sn(e) || e === "/" || e === "?";
2275
2272
  }
2276
- function On(e) {
2277
- return Cn(e) || wn(e) || e === ":";
2273
+ function Tn(e) {
2274
+ return bn(e) || xn(e) || e === ":";
2278
2275
  }
2279
- function kn(e) {
2280
- return Cn(e) || wn(e);
2276
+ function En(e) {
2277
+ return bn(e) || xn(e);
2281
2278
  }
2282
- function An(e) {
2279
+ function Dn(e) {
2283
2280
  let t = [], n = e, r = n.indexOf("@");
2284
- r >= 0 && (t.push(R.FALSE), t.push(new B(W(n.slice(0, r)))), n = n.slice(r + 1));
2281
+ r >= 0 && (t.push(R.FALSE), t.push(new V(G(n.slice(0, r)))), n = n.slice(r + 1));
2285
2282
  let i, a = null;
2286
2283
  if (n.startsWith("[")) {
2287
2284
  let e = n.indexOf("]");
@@ -2294,7 +2291,7 @@ function An(e) {
2294
2291
  } else {
2295
2292
  let e = n.lastIndexOf(":");
2296
2293
  if (e >= 0 ? (i = n.slice(0, e), a = n.slice(e + 1)) : i = n, i !== "") if (/^\d{1,3}(\.\d{1,3}){3}$/.test(i)) t.push(new N(Jt(i)));
2297
- else for (let e of i.toLowerCase().split(".")) t.push(new B(e));
2294
+ else for (let e of i.toLowerCase().split(".")) t.push(new V(e));
2298
2295
  }
2299
2296
  if (a !== null && a !== "") {
2300
2297
  if (!/^\d+$/.test(a)) throw SyntaxError(`cri: invalid port: ${JSON.stringify(a)}`);
@@ -2304,12 +2301,12 @@ function An(e) {
2304
2301
  }
2305
2302
  return new I(t);
2306
2303
  }
2307
- function jn(e) {
2304
+ function On(e) {
2308
2305
  let t = e.items, n = 0, r = "";
2309
2306
  if (n < t.length && t[n] instanceof R && t[n].value === 20) {
2310
2307
  n++;
2311
2308
  let e = t[n++];
2312
- r += G(e.value, On) + "@";
2309
+ r += K(e.value, Tn) + "@";
2313
2310
  }
2314
2311
  if (n >= t.length) return r;
2315
2312
  let i = t[n];
@@ -2319,97 +2316,97 @@ function jn(e) {
2319
2316
  if (e === 4) r += Xt(i.value);
2320
2317
  else if (e === 16) r += "[" + Zt(i.value) + "]";
2321
2318
  else throw Error(`cri: unexpected host-ip byte length: ${e}`);
2322
- n < t.length && t[n] instanceof B && (r += `%25${G(t[n++].value, kn)}`);
2319
+ n < t.length && t[n] instanceof V && (r += `%25${K(t[n++].value, En)}`);
2323
2320
  } else {
2324
2321
  let e = [];
2325
- for (; n < t.length && t[n] instanceof B;) e.push(G(t[n++].value, kn));
2322
+ for (; n < t.length && t[n] instanceof V;) e.push(K(t[n++].value, En));
2326
2323
  r += e.join(".");
2327
2324
  }
2328
2325
  return n < t.length && t[n] instanceof k && (r += ":" + t[n].value.toString()), r;
2329
2326
  }
2330
- function Mn(e) {
2327
+ function kn(e) {
2331
2328
  let t = e.slice(2), n = t.indexOf("/"), r, i;
2332
- return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new B(W(e)))) : (r = t, i = []), {
2333
- authority: An(r),
2329
+ return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new V(G(e)))) : (r = t, i = []), {
2330
+ authority: Dn(r),
2334
2331
  pathSegments: i
2335
2332
  };
2336
2333
  }
2337
- function Nn(e) {
2334
+ function An(e) {
2338
2335
  let t = e, n = null, r = t.indexOf("#");
2339
- r >= 0 && (n = W(t.slice(r + 1)), t = t.slice(0, r));
2336
+ r >= 0 && (n = G(t.slice(r + 1)), t = t.slice(0, r));
2340
2337
  let i = null, a = t.indexOf("?");
2341
2338
  if (a >= 0) {
2342
2339
  let e = t.slice(a + 1);
2343
- t = t.slice(0, a), i = e.split("&").map((e) => new B(W(e)));
2340
+ t = t.slice(0, a), i = e.split("&").map((e) => new V(G(e)));
2344
2341
  }
2345
2342
  let o = [], s = /^([a-zA-Z][a-zA-Z0-9+.\-]*):([\s\S]*)$/.exec(t);
2346
2343
  if (s) {
2347
- let e = s[1].toLowerCase(), t = s[2], n = vn.get(e);
2348
- if (o.push(n === void 0 ? new B(e) : new A(n)), t.startsWith("//")) {
2349
- let { authority: e, pathSegments: n } = Mn(t);
2344
+ let e = s[1].toLowerCase(), t = s[2], n = hn.get(e);
2345
+ if (o.push(n === void 0 ? new V(e) : new A(n)), t.startsWith("//")) {
2346
+ let { authority: e, pathSegments: n } = kn(t);
2350
2347
  o.push(e, new I(n));
2351
2348
  } else if (t.startsWith("/")) {
2352
- let e = t.slice(1).split("/").map((e) => new B(W(e)));
2349
+ let e = t.slice(1).split("/").map((e) => new V(G(e)));
2353
2350
  o.push(R.NULL, new I(e));
2354
2351
  } else {
2355
- let e = t.split("/").map((e) => new B(W(e)));
2352
+ let e = t.split("/").map((e) => new V(G(e)));
2356
2353
  o.push(R.TRUE, new I(e));
2357
2354
  }
2358
2355
  } else if (t.startsWith("//")) {
2359
- let { authority: e, pathSegments: n } = Mn(t);
2356
+ let { authority: e, pathSegments: n } = kn(t);
2360
2357
  o.push(R.FALSE, e, new I(n));
2361
2358
  } else if (t.startsWith("/")) {
2362
- let e = t.slice(1).split("/").map((e) => new B(W(e)));
2359
+ let e = t.slice(1).split("/").map((e) => new V(G(e)));
2363
2360
  o.push(R.TRUE, new I(e));
2364
2361
  } else if (t === "") o.push(new k(0n));
2365
2362
  else {
2366
2363
  let n = 1n, r = t, i = !1;
2367
2364
  for (r.startsWith("./") && (i = !0, r = r.slice(2)); r.startsWith("../");) n++, r = r.slice(3);
2368
2365
  if (r === ".." ? (n++, r = "") : r === "." && (r = ""), n === 1n && !i && r !== "" && r.split("/")[0].includes(":")) throw SyntaxError(`cri: invalid relative-path reference — first segment must not contain ':' without a './' prefix (RFC 3986 §3.3): ${JSON.stringify(e)}`);
2369
- let a = r === "" ? [] : r.split("/").map((e) => new B(W(e)));
2366
+ let a = r === "" ? [] : r.split("/").map((e) => new V(G(e)));
2370
2367
  o.push(new k(n), new I(a));
2371
2368
  }
2372
- if (i !== null && o.push(new I(i)), n !== null && (i === null && o.push(R.NULL), o.push(new B(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
2369
+ if (i !== null && o.push(new I(i)), n !== null && (i === null && o.push(R.NULL), o.push(new V(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
2373
2370
  let e = o[o.length - 1];
2374
2371
  e instanceof I && e.items.length === 0 && o.pop();
2375
2372
  }
2376
2373
  return o.length === 1 && o[0] instanceof k && o[0].value === 0n ? [] : o;
2377
2374
  }
2378
- function K(e, t) {
2375
+ function q(e, t) {
2379
2376
  let n = t, r = "";
2380
2377
  if (n < e.length) {
2381
2378
  let t = e[n];
2382
2379
  if (t instanceof I) {
2383
2380
  if (n++, t.items.length > 0) {
2384
2381
  let e = t.items.map((e) => {
2385
- if (!(e instanceof B)) throw Error("cri: query item must be a text string");
2386
- return G(e.value, En);
2382
+ if (!(e instanceof V)) throw Error("cri: query item must be a text string");
2383
+ return K(e.value, Cn);
2387
2384
  });
2388
2385
  r += "?" + e.join("&");
2389
2386
  }
2390
2387
  } else t instanceof R && t.value === 22 && n++;
2391
2388
  }
2392
- return n < e.length && e[n] instanceof B && (r += "#" + G(e[n].value, Dn)), r;
2389
+ return n < e.length && e[n] instanceof V && (r += "#" + K(e[n].value, wn)), r;
2393
2390
  }
2394
- function Pn(e) {
2391
+ function jn(e) {
2395
2392
  return e.items.map((e) => {
2396
- if (!(e instanceof B)) throw Error("cri: path segment must be a text string");
2397
- return G(e.value, Tn);
2393
+ if (!(e instanceof V)) throw Error("cri: path segment must be a text string");
2394
+ return K(e.value, Sn);
2398
2395
  });
2399
2396
  }
2400
- function Fn(e) {
2397
+ function Mn(e) {
2401
2398
  if (e.length === 0) return "";
2402
2399
  let t = 0, n = e[t++];
2403
- if (n instanceof A || n instanceof B) {
2400
+ if (n instanceof A || n instanceof V) {
2404
2401
  let r;
2405
2402
  if (n instanceof A) {
2406
- let e = yn.get(n.value);
2403
+ let e = gn.get(n.value);
2407
2404
  if (e === void 0) throw Error(`cri: unrecognised scheme-id ${n.value}`);
2408
2405
  r = e + ":";
2409
2406
  } else r = n.value + ":";
2410
2407
  if (t >= e.length) return r;
2411
2408
  let i = e[t++], a = "", o = !1;
2412
- if (i instanceof I) a = "//" + jn(i), o = !0;
2409
+ if (i instanceof I) a = "//" + On(i), o = !0;
2413
2410
  else if (i instanceof R) if (i.value === 22) o = !0;
2414
2411
  else if (i.value === 21) o = !1;
2415
2412
  else throw Error(`cri: unexpected no-authority value: simple(${i.value})`);
@@ -2417,95 +2414,109 @@ function Fn(e) {
2417
2414
  let s = "";
2418
2415
  if (t < e.length && e[t] instanceof I) {
2419
2416
  let n = e[t++];
2420
- n.items.length > 0 && (s = (o ? "/" : "") + Pn(n).join("/"));
2417
+ n.items.length > 0 && (s = (o ? "/" : "") + jn(n).join("/"));
2421
2418
  }
2422
- return r + a + s + K(e, t);
2419
+ return r + a + s + q(e, t);
2423
2420
  }
2424
2421
  if (n instanceof R && n.value === 20) {
2425
2422
  if (t >= e.length || !(e[t] instanceof I)) throw Error("cri: network-path reference requires an authority array");
2426
- let n = jn(e[t++]), r = "";
2423
+ let n = On(e[t++]), r = "";
2427
2424
  if (t < e.length && e[t] instanceof I) {
2428
2425
  let n = e[t++];
2429
- n.items.length > 0 && (r = "/" + Pn(n).join("/"));
2426
+ n.items.length > 0 && (r = "/" + jn(n).join("/"));
2430
2427
  }
2431
- return "//" + n + r + K(e, t);
2428
+ return "//" + n + r + q(e, t);
2432
2429
  }
2433
2430
  if (n instanceof R && n.value === 21) {
2434
2431
  let n = "/";
2435
2432
  if (t < e.length && e[t] instanceof I) {
2436
2433
  let r = e[t++];
2437
- n = "/" + Pn(r).join("/");
2434
+ n = "/" + jn(r).join("/");
2438
2435
  }
2439
- return n + K(e, t);
2436
+ return n + q(e, t);
2440
2437
  }
2441
2438
  if (n instanceof k) {
2442
2439
  let r = n.value;
2443
- if (r === 0n) return K(e, t);
2440
+ if (r === 0n) return q(e, t);
2444
2441
  let i = r === 1n ? "" : "../".repeat(Number(r) - 1), a;
2445
2442
  if (t < e.length && e[t] instanceof I) {
2446
2443
  let n = e[t++];
2447
2444
  if (n.items.length > 0) {
2448
- let e = Pn(n);
2445
+ let e = jn(n);
2449
2446
  a = (r === 1n && e[0].includes(":") ? "./" : i) + e.join("/");
2450
2447
  } else a = i === "" ? "./" : i;
2451
2448
  } else a = i === "" ? "./" : i;
2452
- return a + K(e, t);
2449
+ return a + q(e, t);
2453
2450
  }
2454
2451
  throw Error("cri: unrecognised first element type in CRI array");
2455
2452
  }
2456
- var In = class extends I {
2453
+ var Nn = class extends I {
2457
2454
  _toCDN(e, t) {
2458
2455
  if (e?.appStrings === !1) return super._toCDN(e, t);
2459
2456
  try {
2460
2457
  let t = x(e, this.encodingWidth, () => b(BigInt(this.items.length)));
2461
- return `${hn}'${Fn(this.items)}'${t}`;
2458
+ return `${fn}'${Mn(this.items)}'${t}`;
2462
2459
  } catch {
2463
2460
  return super._toCDN(e, t);
2464
2461
  }
2465
2462
  }
2466
- }, Ln = class extends M {
2463
+ }, Pn = class extends M {
2467
2464
  constructor(e) {
2468
- super(_n, e);
2465
+ super(mn, e);
2469
2466
  }
2470
2467
  _toCDN(e, t) {
2471
2468
  if (e?.appStrings === !1) return super._toCDN(e, t);
2472
2469
  try {
2473
2470
  let n = this.content;
2474
2471
  if (n.encodingWidth !== void 0) return super._toCDN(e, t);
2475
- let r = x(e, this.encodingWidth, () => b(_n));
2476
- return `${gn}'${Fn(n.items)}'${r}`;
2472
+ let r = x(e, this.encodingWidth, () => b(mn));
2473
+ return `${pn}'${Mn(n.items)}'${r}`;
2477
2474
  } catch {
2478
2475
  return super._toCDN(e, t);
2479
2476
  }
2480
2477
  }
2481
2478
  };
2482
- function Rn(e) {
2479
+ function Fn(e) {
2483
2480
  if (e.length !== 1) throw SyntaxError("cri<<...>>: expected exactly one item");
2484
2481
  let t = e[0];
2485
- if (t instanceof B) return t.value;
2486
- if (t instanceof N) return xn.decode(t.value);
2482
+ if (t instanceof V) return t.value;
2483
+ if (t instanceof N) return vn.decode(t.value);
2487
2484
  throw SyntaxError("cri<<...>>: expected a text string or byte string");
2488
2485
  }
2489
- function zn(e, t) {
2490
- let n = new In(Nn(t));
2491
- return e === gn ? new Ln(n) : n;
2486
+ function In(e, t) {
2487
+ let n = new Nn(An(t));
2488
+ return e === pn ? new Pn(n) : n;
2492
2489
  }
2493
- var Bn = {
2494
- appStringPrefixes: [hn, gn],
2495
- tagNumbers: [_n],
2490
+ var Ln = {
2491
+ appStringPrefixes: [fn, pn],
2492
+ tagNumbers: [mn],
2496
2493
  parseAppString(e, t) {
2497
- return zn(e, t);
2494
+ return In(e, t);
2498
2495
  },
2499
2496
  parseAppSequence(e, t) {
2500
- return zn(e, Rn(t));
2497
+ return In(e, Fn(t));
2501
2498
  },
2502
2499
  parseTag(e, t) {
2503
2500
  if (e !== 99n || !(t instanceof I)) return;
2504
- let n = new In(t.items, {
2501
+ let n = new Nn(t.items, {
2505
2502
  indefiniteLength: t.indefiniteLength,
2506
2503
  encodingWidth: t.encodingWidth
2507
2504
  });
2508
- return n.start = t.start, n.end = t.end, new Ln(n);
2505
+ return n.start = t.start, n.end = t.end, new Pn(n);
2506
+ }
2507
+ }, Rn = 18446744073709551615n, zn = -18446744073709551616n, Bn = {
2508
+ tagNumbers: [Je, Ye],
2509
+ parseTag(e, t) {
2510
+ if (t instanceof N) {
2511
+ if (e === 2n) {
2512
+ let e = $e(t.value);
2513
+ return e > Rn ? new et(e) : void 0;
2514
+ }
2515
+ if (e === 3n) {
2516
+ let e = -1n - $e(t.value);
2517
+ return e < zn ? new tt(e) : void 0;
2518
+ }
2519
+ }
2509
2520
  }
2510
2521
  };
2511
2522
  //#endregion
@@ -2529,7 +2540,7 @@ var Un = new TextDecoder("utf-8", {
2529
2540
  fatal: !1,
2530
2541
  ignoreBOM: !0
2531
2542
  });
2532
- function q(e) {
2543
+ function J(e) {
2533
2544
  throw Error(`CBOR decode error: ${e}`);
2534
2545
  }
2535
2546
  function Gn(e, t, n) {
@@ -2540,13 +2551,13 @@ function Gn(e, t, n) {
2540
2551
  if (n?.onWarning ? n.onWarning(r) : n?.silent || console.warn(`CBOR strict violation at offset ${t}: ${e}`), n?.strict !== !1) throw Error(`CBOR decode error: ${e}`);
2541
2552
  return r;
2542
2553
  }
2543
- function J(e, t) {
2554
+ function Y(e, t) {
2544
2555
  e.warnings ??= [], e.warnings.push(t);
2545
2556
  }
2546
- function Y(e) {
2557
+ function Kn(e) {
2547
2558
  if (e instanceof k) return ["u", String(e.value)];
2548
2559
  if (e instanceof A) return ["n", String(e.value)];
2549
- if (e instanceof B) return ["t", e.value];
2560
+ if (e instanceof V) return ["t", e.value];
2550
2561
  if (e instanceof F) return ["t", e.chunks.map((e) => e.value).join("")];
2551
2562
  if (e instanceof N) return ["b", i(e.value)];
2552
2563
  if (e instanceof P) {
@@ -2556,9 +2567,9 @@ function Y(e) {
2556
2567
  }
2557
2568
  if (e instanceof j) return isNaN(e.value) ? ["f", "NaN"] : Object.is(e.value, -0) ? ["f", "-0"] : ["f", String(e.value)];
2558
2569
  if (e instanceof R) return ["s", e.value];
2559
- if (e instanceof I) return ["A", e.items.map(Y)];
2570
+ if (e instanceof I) return ["A", e.items.map(Kn)];
2560
2571
  if (e instanceof L) {
2561
- let t = e.entries.map(([e, t]) => [Y(e), Y(t)]);
2572
+ let t = e.entries.map(([e, t]) => [Kn(e), Kn(t)]);
2562
2573
  if (t.length <= 1) return ["M", t];
2563
2574
  let n = t.map((e) => [JSON.stringify(e[0]), e]);
2564
2575
  return n.sort((e, t) => e[0] < t[0] ? -1 : +(e[0] > t[0])), ["M", n.map((e) => e[1])];
@@ -2566,13 +2577,13 @@ function Y(e) {
2566
2577
  return e instanceof M ? [
2567
2578
  "G",
2568
2579
  String(e.tag),
2569
- Y(e.content)
2580
+ Kn(e.content)
2570
2581
  ] : ["c", i(e.toCBOR())];
2571
2582
  }
2572
- function Kn(e) {
2583
+ function qn(e) {
2573
2584
  if (e instanceof k) return "u" + e.value;
2574
2585
  if (e instanceof A) return "n" + e.value;
2575
- if (e instanceof B) return "t" + e.value;
2586
+ if (e instanceof V) return "t" + e.value;
2576
2587
  if (e instanceof F) {
2577
2588
  let t = "t";
2578
2589
  for (let n of e.chunks) t += n.value;
@@ -2584,109 +2595,109 @@ function Kn(e) {
2584
2595
  for (let n of e.chunks) t += i(n.value);
2585
2596
  return t;
2586
2597
  }
2587
- return e instanceof j ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof R ? "s" + e.value : JSON.stringify(Y(e));
2598
+ return e instanceof j ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof R ? "s" + e.value : JSON.stringify(Kn(e));
2588
2599
  }
2589
- var qn = Array.from({ length: 24 }, (e, t) => BigInt(t)), Jn;
2590
- function Yn() {
2591
- return Jn ??= Z.filter((e) => e.parseTag !== void 0);
2600
+ var Jn = Array.from({ length: 24 }, (e, t) => BigInt(t)), Yn;
2601
+ function Xn(e) {
2602
+ return e === void 0 ? Yn ??= Z(void 0).filter((e) => e.parseTag !== void 0) : Z(e).filter((e) => e.parseTag !== void 0);
2592
2603
  }
2593
- function Xn(e, t) {
2604
+ function Zn(e, t) {
2594
2605
  for (let n = 0; n < t; n++) if (e[n] >= 128) return;
2595
2606
  return String.fromCharCode.apply(null, e);
2596
2607
  }
2597
- function Zn(e, t, n) {
2608
+ function Qn(e, t, n) {
2598
2609
  if (n <= 23) return {
2599
- value: qn[n],
2610
+ value: Jn[n],
2600
2611
  nextOffset: t
2601
2612
  };
2602
2613
  switch (n) {
2603
- case 24: return t + 1 > e.byteLength && q("unexpected end of input"), {
2614
+ case 24: return t + 1 > e.byteLength && J("unexpected end of input"), {
2604
2615
  value: BigInt(e.getUint8(t)),
2605
2616
  nextOffset: t + 1
2606
2617
  };
2607
- case 25: return t + 2 > e.byteLength && q("unexpected end of input"), {
2618
+ case 25: return t + 2 > e.byteLength && J("unexpected end of input"), {
2608
2619
  value: BigInt(e.getUint16(t, !1)),
2609
2620
  nextOffset: t + 2
2610
2621
  };
2611
- case 26: return t + 4 > e.byteLength && q("unexpected end of input"), {
2622
+ case 26: return t + 4 > e.byteLength && J("unexpected end of input"), {
2612
2623
  value: BigInt(e.getUint32(t, !1)),
2613
2624
  nextOffset: t + 4
2614
2625
  };
2615
- case 27: return t + 8 > e.byteLength && q("unexpected end of input"), {
2626
+ case 27: return t + 8 > e.byteLength && J("unexpected end of input"), {
2616
2627
  value: e.getBigUint64(t, !1),
2617
2628
  nextOffset: t + 8
2618
2629
  };
2619
- default: q(`reserved additional info value: ${n}`);
2630
+ default: J(`reserved additional info value: ${n}`);
2620
2631
  }
2621
2632
  }
2622
- function Qn(e, t, n) {
2633
+ function $n(e, t, n) {
2623
2634
  if (n <= 23) return {
2624
2635
  value: n,
2625
2636
  nextOffset: t
2626
2637
  };
2627
2638
  switch (n) {
2628
- case 24: return t + 1 > e.byteLength && q("unexpected end of input"), {
2639
+ case 24: return t + 1 > e.byteLength && J("unexpected end of input"), {
2629
2640
  value: e.getUint8(t),
2630
2641
  nextOffset: t + 1
2631
2642
  };
2632
- case 25: return t + 2 > e.byteLength && q("unexpected end of input"), {
2643
+ case 25: return t + 2 > e.byteLength && J("unexpected end of input"), {
2633
2644
  value: e.getUint16(t, !1),
2634
2645
  nextOffset: t + 2
2635
2646
  };
2636
- case 26: return t + 4 > e.byteLength && q("unexpected end of input"), {
2647
+ case 26: return t + 4 > e.byteLength && J("unexpected end of input"), {
2637
2648
  value: e.getUint32(t, !1),
2638
2649
  nextOffset: t + 4
2639
2650
  };
2640
2651
  case 27: {
2641
- t + 8 > e.byteLength && q("unexpected end of input");
2652
+ t + 8 > e.byteLength && J("unexpected end of input");
2642
2653
  let n = e.getUint32(t, !1), r = e.getUint32(t + 4, !1);
2643
2654
  return {
2644
2655
  value: n * 4294967296 + r,
2645
2656
  nextOffset: t + 8
2646
2657
  };
2647
2658
  }
2648
- default: q(`reserved additional info value: ${n}`);
2659
+ default: J(`reserved additional info value: ${n}`);
2649
2660
  }
2650
2661
  }
2651
- function $n(e, t, n, r, i, a) {
2662
+ function er(e, t, n, r, i, a) {
2652
2663
  let o = [], s = t;
2653
2664
  for (;;) {
2654
- if (s >= e.byteLength && q(`unexpected end of indefinite ${i}`), e.getUint8(s) === 255) {
2665
+ if (s >= e.byteLength && J(`unexpected end of indefinite ${i}`), e.getUint8(s) === 255) {
2655
2666
  s++;
2656
2667
  break;
2657
2668
  }
2658
2669
  let t = X(e, s, n, r);
2659
- a(t.value) || q(`indefinite-length ${i} chunk must be a definite ${i}`), o.push(t.value), s = t.nextOffset;
2670
+ a(t.value) || J(`indefinite-length ${i} chunk must be a definite ${i}`), o.push(t.value), s = t.nextOffset;
2660
2671
  }
2661
2672
  return {
2662
2673
  chunks: o,
2663
2674
  nextOffset: s
2664
2675
  };
2665
2676
  }
2666
- function er(e, t, n, r) {
2667
- let i = Kn(e);
2677
+ function tr(e, t, n, r) {
2678
+ let i = qn(e);
2668
2679
  t.has(i) && n.push(Gn(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
2669
2680
  }
2670
2681
  function X(e, t, n, r) {
2671
- let i = t, a = nr(e, t, n, r);
2682
+ let i = t, a = rr(e, t, n, r);
2672
2683
  return a.value.start = i, a.value.end = a.nextOffset, a;
2673
2684
  }
2674
- function tr(e, t, n) {
2685
+ function nr(e, t, n) {
2675
2686
  return new Uint8Array(e.buffer, e.byteOffset + t, n).slice();
2676
2687
  }
2677
- function nr(e, t, n, r) {
2678
- t >= e.byteLength && q("unexpected end of input");
2688
+ function rr(e, t, n, r) {
2689
+ t >= e.byteLength && J("unexpected end of input");
2679
2690
  let i = e.getUint8(t++), a = i >> 5, o = i & 31;
2680
2691
  switch (a) {
2681
2692
  case 0: {
2682
- let { value: n, nextOffset: r } = Zn(e, t, o);
2693
+ let { value: n, nextOffset: r } = Qn(e, t, o);
2683
2694
  return {
2684
2695
  value: new k(n, { encodingWidth: Vn(o, n) }),
2685
2696
  nextOffset: r
2686
2697
  };
2687
2698
  }
2688
2699
  case 1: {
2689
- let { value: n, nextOffset: r } = Zn(e, t, o), i = Vn(o, n);
2700
+ let { value: n, nextOffset: r } = Qn(e, t, o), i = Vn(o, n);
2690
2701
  return {
2691
2702
  value: new A(-1n - n, { encodingWidth: i }),
2692
2703
  nextOffset: r
@@ -2694,37 +2705,37 @@ function nr(e, t, n, r) {
2694
2705
  }
2695
2706
  case 2: {
2696
2707
  if (o === 31) {
2697
- let { chunks: i, nextOffset: a } = $n(e, t, n, r, "byte string", (e) => e instanceof N);
2708
+ let { chunks: i, nextOffset: a } = er(e, t, n, r, "byte string", (e) => e instanceof N);
2698
2709
  return {
2699
2710
  value: new P(i),
2700
2711
  nextOffset: a
2701
2712
  };
2702
2713
  }
2703
- let { value: i, nextOffset: a } = Qn(e, t, o), s = Hn(o, i);
2704
- return a + i > e.byteLength && q("byte string extends beyond input"), {
2714
+ let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i);
2715
+ return a + i > e.byteLength && J("byte string extends beyond input"), {
2705
2716
  value: new N(new Uint8Array(e.buffer, e.byteOffset + a, i).slice(), { encodingWidth: s }),
2706
2717
  nextOffset: a + i
2707
2718
  };
2708
2719
  }
2709
2720
  case 3: {
2710
2721
  if (o === 31) {
2711
- let { chunks: i, nextOffset: a } = $n(e, t, n, r, "text string", (e) => e instanceof B);
2722
+ let { chunks: i, nextOffset: a } = er(e, t, n, r, "text string", (e) => e instanceof V);
2712
2723
  return {
2713
2724
  value: new F(i),
2714
2725
  nextOffset: a
2715
2726
  };
2716
2727
  }
2717
- let { value: i, nextOffset: a } = Qn(e, t, o), s = Hn(o, i);
2718
- a + i > e.byteLength && q("text string extends beyond input");
2719
- let c = new Uint8Array(e.buffer, e.byteOffset + a, i), l, u, d = i < 64 ? Xn(c, i) : void 0;
2728
+ let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i);
2729
+ a + i > e.byteLength && J("text string extends beyond input");
2730
+ let c = new Uint8Array(e.buffer, e.byteOffset + a, i), l, u, d = i < 64 ? Zn(c, i) : void 0;
2720
2731
  if (d !== void 0) l = d;
2721
2732
  else try {
2722
2733
  l = Un.decode(c);
2723
2734
  } catch {
2724
2735
  u = Gn("invalid UTF-8 sequence in text string", a, n), l = Wn.decode(c);
2725
2736
  }
2726
- let f = new B(l, { encodingWidth: s });
2727
- return u && J(f, u), {
2737
+ let f = new V(l, { encodingWidth: s });
2738
+ return u && Y(f, u), {
2728
2739
  value: f,
2729
2740
  nextOffset: a + i
2730
2741
  };
@@ -2733,7 +2744,7 @@ function nr(e, t, n, r) {
2733
2744
  if (o === 31) {
2734
2745
  let i = [], a = t;
2735
2746
  for (;;) {
2736
- if (a >= e.byteLength && q("unexpected end of indefinite array"), e.getUint8(a) === 255) {
2747
+ if (a >= e.byteLength && J("unexpected end of indefinite array"), e.getUint8(a) === 255) {
2737
2748
  a++;
2738
2749
  break;
2739
2750
  }
@@ -2745,7 +2756,7 @@ function nr(e, t, n, r) {
2745
2756
  nextOffset: a
2746
2757
  };
2747
2758
  }
2748
- let { value: i, nextOffset: a } = Qn(e, t, o), s = Hn(o, i), c = [], l = a;
2759
+ let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i), c = [], l = a;
2749
2760
  for (let t = 0; t < i; t++) {
2750
2761
  let t = X(e, l, n, r);
2751
2762
  c.push(t.value), l = t.nextOffset;
@@ -2759,39 +2770,39 @@ function nr(e, t, n, r) {
2759
2770
  if (o === 31) {
2760
2771
  let i = [], a = /* @__PURE__ */ new Set(), o = [], s = t;
2761
2772
  for (;;) {
2762
- if (s >= e.byteLength && q("unexpected end of indefinite map"), e.getUint8(s) === 255) {
2773
+ if (s >= e.byteLength && J("unexpected end of indefinite map"), e.getUint8(s) === 255) {
2763
2774
  s++;
2764
2775
  break;
2765
2776
  }
2766
2777
  let t = X(e, s, n, r);
2767
- er(t.value, a, o, n), s = t.nextOffset;
2778
+ tr(t.value, a, o, n), s = t.nextOffset;
2768
2779
  let c = X(e, s, n, r);
2769
2780
  s = c.nextOffset, i.push([t.value, c.value]);
2770
2781
  }
2771
2782
  let c = new L(i, { indefiniteLength: !0 });
2772
- for (let e of o) J(c, e);
2783
+ for (let e of o) Y(c, e);
2773
2784
  return {
2774
2785
  value: c,
2775
2786
  nextOffset: s
2776
2787
  };
2777
2788
  }
2778
- let { value: i, nextOffset: a } = Qn(e, t, o), s = Hn(o, i), c = [], l = /* @__PURE__ */ new Set(), u = [], d = a;
2789
+ let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i), c = [], l = /* @__PURE__ */ new Set(), u = [], d = a;
2779
2790
  for (let t = 0; t < i; t++) {
2780
2791
  let t = X(e, d, n, r);
2781
- er(t.value, l, u, n), d = t.nextOffset;
2792
+ tr(t.value, l, u, n), d = t.nextOffset;
2782
2793
  let i = X(e, d, n, r);
2783
2794
  d = i.nextOffset, c.push([t.value, i.value]);
2784
2795
  }
2785
2796
  let f = new L(c, { encodingWidth: s });
2786
- for (let e of u) J(f, e);
2797
+ for (let e of u) Y(f, e);
2787
2798
  return {
2788
2799
  value: f,
2789
2800
  nextOffset: d
2790
2801
  };
2791
2802
  }
2792
2803
  case 6: {
2793
- o === 31 && q("tags cannot use indefinite-length encoding");
2794
- let { value: i, nextOffset: a } = Zn(e, t, o), s = Vn(o, i), c = X(e, a, n, r);
2804
+ o === 31 && J("tags cannot use indefinite-length encoding");
2805
+ let { value: i, nextOffset: a } = Qn(e, t, o), s = Vn(o, i), c = X(e, a, n, r);
2795
2806
  for (let e of r) {
2796
2807
  let t = e.parseTag(i, c.value, n);
2797
2808
  if (t !== void 0) return t instanceof M && s !== void 0 && (t.encodingWidth = s), {
@@ -2826,11 +2837,11 @@ function nr(e, t, n, r) {
2826
2837
  nextOffset: t
2827
2838
  };
2828
2839
  if (o === 24) {
2829
- t + 1 > e.byteLength && q("unexpected end of input");
2840
+ t + 1 > e.byteLength && J("unexpected end of input");
2830
2841
  let r = e.getUint8(t);
2831
2842
  if (r < 32) {
2832
2843
  let e = Gn(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`, t - 1, n), i = new R(r);
2833
- return J(i, e), {
2844
+ return Y(i, e), {
2834
2845
  value: i,
2835
2846
  nextOffset: t + 1
2836
2847
  };
@@ -2841,106 +2852,411 @@ function nr(e, t, n, r) {
2841
2852
  };
2842
2853
  }
2843
2854
  if (o === 25) {
2844
- t + 2 > e.byteLength && q("unexpected end of input");
2855
+ t + 2 > e.byteLength && J("unexpected end of input");
2845
2856
  let n = C(e.getUint16(t, !1));
2846
2857
  return {
2847
2858
  value: new j(n, {
2848
2859
  precision: "half",
2849
- rawBits: Number.isNaN(n) ? tr(e, t, 2) : void 0
2860
+ rawBits: Number.isNaN(n) ? nr(e, t, 2) : void 0
2850
2861
  }),
2851
2862
  nextOffset: t + 2
2852
2863
  };
2853
2864
  }
2854
2865
  if (o === 26) {
2855
- t + 4 > e.byteLength && q("unexpected end of input");
2866
+ t + 4 > e.byteLength && J("unexpected end of input");
2856
2867
  let n = e.getFloat32(t, !1);
2857
2868
  return {
2858
2869
  value: new j(n, {
2859
2870
  precision: "single",
2860
- rawBits: Number.isNaN(n) ? tr(e, t, 4) : void 0
2871
+ rawBits: Number.isNaN(n) ? nr(e, t, 4) : void 0
2861
2872
  }),
2862
2873
  nextOffset: t + 4
2863
2874
  };
2864
2875
  }
2865
2876
  if (o === 27) {
2866
- t + 8 > e.byteLength && q("unexpected end of input");
2877
+ t + 8 > e.byteLength && J("unexpected end of input");
2867
2878
  let n = e.getFloat64(t, !1);
2868
2879
  return {
2869
2880
  value: new j(n, {
2870
2881
  precision: "double",
2871
- rawBits: Number.isNaN(n) ? tr(e, t, 8) : void 0
2882
+ rawBits: Number.isNaN(n) ? nr(e, t, 8) : void 0
2872
2883
  }),
2873
2884
  nextOffset: t + 8
2874
2885
  };
2875
2886
  }
2876
- return o < 31 && q(`reserved additional info value in major type 7: ${o}`), q("unexpected break code outside indefinite-length item");
2887
+ return o < 31 && J(`reserved additional info value in major type 7: ${o}`), J("unexpected break code outside indefinite-length item");
2877
2888
  }
2878
- return q(`unknown major type: ${a}`);
2889
+ return J(`unknown major type: ${a}`);
2879
2890
  }
2880
- function rr(e) {
2891
+ function ir(e) {
2881
2892
  if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new Uint8Array(e);
2882
2893
  if (ArrayBuffer.isView(e)) return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
2883
2894
  throw TypeError("expected ArrayBufferView or ArrayBufferLike");
2884
2895
  }
2885
- function ir(e, t) {
2886
- let n = rr(e), r = new DataView(n.buffer, n.byteOffset, n.byteLength), i = t?.offset ?? 0;
2896
+ function ar(e, t) {
2897
+ let n = ir(e), r = new DataView(n.buffer, n.byteOffset, n.byteLength), i = t?.offset ?? 0;
2887
2898
  if (!Number.isInteger(i) || i < 0 || i > r.byteLength) throw RangeError(`CBOR decode offset must be an integer between 0 and ${r.byteLength}`);
2888
- let a = t?.extensions?.length ? [...t.extensions.filter((e) => e.parseTag !== void 0), ...Yn()] : Yn(), { value: o, nextOffset: s } = X(r, i, t, a);
2889
- if (!t?.allowTrailing && s !== r.byteLength) {
2890
- J(o, Gn(`${r.byteLength - s} trailing byte(s) after end of CBOR item`, s, t));
2899
+ let a = Xn(t?.builtinExtensions), o = t?.extensions?.length ? [...t.extensions.filter((e) => e.parseTag !== void 0), ...a] : a, { value: s, nextOffset: c } = X(r, i, t, o);
2900
+ if (!t?.allowTrailing && c !== r.byteLength) {
2901
+ Y(s, Gn(`${r.byteLength - c} trailing byte(s) after end of CBOR item`, c, t));
2891
2902
  let e = {
2892
2903
  strict: !1,
2893
2904
  silent: !0
2894
- }, n = s;
2895
- for (; n < r.byteLength;) ({nextOffset: n} = X(r, n, e, a));
2905
+ }, n = c;
2906
+ for (; n < r.byteLength;) ({nextOffset: n} = X(r, n, e, o));
2896
2907
  }
2897
- return o;
2908
+ return s;
2898
2909
  }
2899
2910
  //#endregion
2900
2911
  //#region src/extensions/cbordata.ts
2901
- var ar = 24n, Z = [
2902
- Kt,
2903
- dn,
2904
- mn,
2905
- Bn,
2906
- {
2907
- tagNumbers: [ar],
2908
- parseTag(e, t, n) {
2909
- if (e !== 24n || !(t instanceof N)) return;
2910
- let r = n ? {
2911
- extensions: n.extensions,
2912
- strict: n.strict,
2913
- onWarning: n.onWarning,
2914
- silent: n.silent
2915
- } : void 0;
2916
- try {
2917
- return new M(ar, new Ue([ir(t.value, r)], { encodingWidth: t.encodingWidth }));
2918
- } catch (e) {
2919
- if (r?.strict !== !1) throw e;
2920
- return;
2912
+ var or = 24n, sr = {
2913
+ tagNumbers: [or],
2914
+ parseTag(e, t, n) {
2915
+ if (e !== 24n || !(t instanceof N)) return;
2916
+ let r = n ? {
2917
+ extensions: n.extensions,
2918
+ builtinExtensions: n.builtinExtensions,
2919
+ strict: n.strict,
2920
+ onWarning: n.onWarning,
2921
+ silent: n.silent
2922
+ } : void 0;
2923
+ try {
2924
+ return new M(or, new Ue([ar(t.value, r)], { encodingWidth: t.encodingWidth }));
2925
+ } catch (e) {
2926
+ if (r?.strict !== !1) throw e;
2927
+ return;
2928
+ }
2929
+ }
2930
+ }, cr = new TextEncoder(), lr = new TextDecoder("utf-8", { fatal: !0 }), ur = new TextDecoder("utf-8", { fatal: !1 }), dr = Symbol("ellipsis");
2931
+ function fr(e) {
2932
+ let t = 0;
2933
+ for (let n of e) t += n.length;
2934
+ let n = new Uint8Array(t), r = 0;
2935
+ for (let t of e) n.set(t, r), r += t.length;
2936
+ return n;
2937
+ }
2938
+ function pr(e, t, n) {
2939
+ if (t instanceof Ke) {
2940
+ pr(e, t.inner, n);
2941
+ return;
2942
+ }
2943
+ if (t instanceof z) {
2944
+ if (t.content instanceof I) for (let r of t.content.items) pr(e, r, n);
2945
+ else n.push(dr);
2946
+ return;
2947
+ }
2948
+ if (t instanceof V) {
2949
+ n.push(cr.encode(t.value));
2950
+ return;
2951
+ }
2952
+ if (t instanceof N) {
2953
+ n.push(t.value);
2954
+ return;
2955
+ }
2956
+ if (t instanceof F) {
2957
+ n.push(cr.encode(t.chunks.map((e) => e.value).join("")));
2958
+ return;
2959
+ }
2960
+ if (t instanceof P) {
2961
+ n.push(fr(t.chunks.map((e) => e.value)));
2962
+ return;
2963
+ }
2964
+ throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings or ellipses`);
2965
+ }
2966
+ function mr(e, t) {
2967
+ try {
2968
+ return lr.decode(e);
2969
+ } catch {
2970
+ let n = "t1 concatenation result is not valid UTF-8";
2971
+ if (t) t(n);
2972
+ else throw SyntaxError(n);
2973
+ return ur.decode(e);
2974
+ }
2975
+ }
2976
+ function hr(e, t, n) {
2977
+ let r = [];
2978
+ for (let n of t) pr(e, n, r);
2979
+ let i = e === "t1", a = [], o = !1, s = [], c = () => {
2980
+ if (s.length === 0) return;
2981
+ let e = fr(s);
2982
+ s.length = 0, e.length !== 0 && a.push(i ? new V(mr(e, n)) : new N(e));
2983
+ };
2984
+ for (let e of r) e === dr ? (c(), a[a.length - 1] instanceof z || (a.push(new z()), o = !0)) : s.push(e);
2985
+ if (!o) {
2986
+ let e = fr(s);
2987
+ return i ? new V(mr(e, n)) : new N(e);
2988
+ }
2989
+ return c(), a.length === 1 ? new z() : new z(a);
2990
+ }
2991
+ function gr(e) {
2992
+ return {
2993
+ appStringPrefixes: [e],
2994
+ preserveAppSeqSource: !0,
2995
+ parseAppString(t, n, r) {
2996
+ return hr(e, [new V(n)], r);
2997
+ },
2998
+ parseAppSequence(t, n, r) {
2999
+ return hr(e, n, r);
3000
+ }
3001
+ };
3002
+ }
3003
+ var _r = gr("t1"), vr = gr("b1"), yr = new TextEncoder(), br = new TextDecoder("utf-8", { fatal: !0 }), xr = new TextDecoder("utf-8", { fatal: !1 });
3004
+ function Sr(e) {
3005
+ let t = 0;
3006
+ for (let n of e) t += n.length;
3007
+ let n = new Uint8Array(t), r = 0;
3008
+ for (let t of e) n.set(t, r), r += t.length;
3009
+ return n;
3010
+ }
3011
+ function Cr(e, t, n) {
3012
+ let r = e === "ilts", i = [], a = [];
3013
+ for (let o of t) {
3014
+ if (o instanceof Ke && (o = o.inner), o instanceof z) throw SyntaxError(`${e}<<...>> cannot contain ellipses; there is no way to include an elision in an indefinite-length string`);
3015
+ let t, s, c;
3016
+ if (o instanceof V) t = o.value, c = o.encodingWidth;
3017
+ else if (o instanceof N) s = o.value, c = o.encodingWidth;
3018
+ else if (o instanceof F) t = o.chunks.map((e) => e.value).join("");
3019
+ else if (o instanceof P) s = Sr(o.chunks.map((e) => e.value));
3020
+ else throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings`);
3021
+ if (r) {
3022
+ let e;
3023
+ if (t !== void 0) e = t;
3024
+ else try {
3025
+ e = br.decode(s);
3026
+ } catch {
3027
+ let t = "ilts chunk is not valid UTF-8";
3028
+ if (n) n(t);
3029
+ else throw SyntaxError(t);
3030
+ e = xr.decode(s);
3031
+ }
3032
+ a.push(new V(e, c === void 0 ? void 0 : { encodingWidth: c }));
3033
+ } else {
3034
+ let e = s ?? yr.encode(t);
3035
+ i.push(new N(e, c === void 0 ? void 0 : { encodingWidth: c }));
3036
+ }
3037
+ }
3038
+ return r ? new F(a) : new P(i);
3039
+ }
3040
+ function wr(e) {
3041
+ return {
3042
+ appStringPrefixes: [e],
3043
+ preserveAppSeqSource: !0,
3044
+ parseAppString(t, n, r) {
3045
+ return new Ke(Cr(e, [new V(n)], r), `${e}${xe(n)}`);
3046
+ },
3047
+ parseAppSequence(t, n, r) {
3048
+ return Cr(e, n, r);
3049
+ }
3050
+ };
3051
+ }
3052
+ var Tr = wr("ilbs"), Er = wr("ilts");
3053
+ //#endregion
3054
+ //#region src/utils/strip-comments.ts
3055
+ function Dr(e) {
3056
+ let t = "", n = 0;
3057
+ for (; n < e.length;) {
3058
+ let r = e[n];
3059
+ if (r === " " || r === "\n" || r === "\r") {
3060
+ n++;
3061
+ continue;
3062
+ }
3063
+ if (r === "#") {
3064
+ for (; n < e.length && e[n] !== "\n";) n++;
3065
+ continue;
3066
+ }
3067
+ if (r === "/") {
3068
+ let t = e[n + 1] ?? "";
3069
+ if (t === "/") {
3070
+ for (; n < e.length && e[n] !== "\n";) n++;
3071
+ continue;
2921
3072
  }
3073
+ if (t === "*") {
3074
+ for (n += 2; n < e.length && !(e[n] === "*" && (e[n + 1] ?? "") === "/");) n++;
3075
+ if (n >= e.length) throw SyntaxError("unterminated block comment");
3076
+ n += 2;
3077
+ continue;
3078
+ }
3079
+ for (n++; n < e.length && e[n] !== "/";) n++;
3080
+ if (n >= e.length) throw SyntaxError("unterminated block comment");
3081
+ n++;
3082
+ continue;
2922
3083
  }
3084
+ t += r, n++;
3085
+ }
3086
+ return t;
3087
+ }
3088
+ //#endregion
3089
+ //#region src/extensions/float.ts
3090
+ var Or = class extends j {
3091
+ _bits;
3092
+ constructor(e) {
3093
+ super(C(e), { precision: "half" }), this._bits = e & 65535;
3094
+ }
3095
+ _toCBOR() {
3096
+ return new Uint8Array([
3097
+ 249,
3098
+ this._bits >> 8 & 255,
3099
+ this._bits & 255
3100
+ ]);
3101
+ }
3102
+ }, kr = class extends j {
3103
+ _raw;
3104
+ constructor(e) {
3105
+ super(new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), { precision: "single" }), this._raw = e.slice();
3106
+ }
3107
+ _toCBOR() {
3108
+ let e = /* @__PURE__ */ new Uint8Array(5);
3109
+ return e[0] = 250, e.set(this._raw, 1), e;
3110
+ }
3111
+ }, Ar = class extends j {
3112
+ _raw;
3113
+ constructor(e) {
3114
+ super(new DataView(e.buffer, e.byteOffset).getFloat64(0, !1), { precision: "double" }), this._raw = e.slice();
2923
3115
  }
2924
- ], or;
2925
- function sr() {
2926
- return or ??= {
2927
- fromJS: Z.filter((e) => e.fromJS !== void 0),
2928
- parseTag: Z.filter((e) => e.parseTag !== void 0)
3116
+ _toCBOR() {
3117
+ let e = /* @__PURE__ */ new Uint8Array(9);
3118
+ return e[0] = 251, e.set(this._raw, 1), e;
3119
+ }
3120
+ };
3121
+ function jr(e) {
3122
+ if (e.length === 2) return new Or(e[0] << 8 | e[1]);
3123
+ if (e.length === 4) return new kr(e);
3124
+ if (e.length === 8) return new Ar(e);
3125
+ throw SyntaxError(`float'...' requires 4, 8, or 16 hex digits (2, 4, or 8 bytes); got ${e.length} bytes`);
3126
+ }
3127
+ function Mr(e) {
3128
+ let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023, i;
3129
+ if (n === 31) i = t << 31 | 2139095040 | r << 13;
3130
+ else if (n === 0 && r === 0) i = t << 31;
3131
+ else if (n === 0) {
3132
+ let e = r, n = 0;
3133
+ for (; !(e & 512);) e <<= 1, n++;
3134
+ i = t << 31 | 112 - n << 23 | (e & 511) << 14;
3135
+ } else i = t << 31 | n + 112 << 23 | r << 13;
3136
+ let a = /* @__PURE__ */ new Uint8Array(4);
3137
+ return new DataView(a.buffer).setUint32(0, i >>> 0, !1), a;
3138
+ }
3139
+ function Nr(e) {
3140
+ let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023, i = /* @__PURE__ */ new Uint8Array(8), a = new DataView(i.buffer);
3141
+ if (n === 31) a.setUint32(0, (t << 31 | 2146435072 | r << 10) >>> 0, !1), a.setUint32(4, 0, !1);
3142
+ else if (n === 0 && r === 0) a.setUint32(0, t << 31 >>> 0, !1), a.setUint32(4, 0, !1);
3143
+ else if (n === 0) {
3144
+ let e = r, n = 0;
3145
+ for (; !(e & 512);) e <<= 1, n++;
3146
+ a.setUint32(0, (t << 31 | 1008 - n << 20 | (e & 511) << 11) >>> 0, !1), a.setUint32(4, 0, !1);
3147
+ } else a.setUint32(0, (t << 31 | n + 1008 << 20 | r << 10) >>> 0, !1), a.setUint32(4, 0, !1);
3148
+ return i;
3149
+ }
3150
+ function Pr(e) {
3151
+ let t = new DataView(e.buffer, e.byteOffset).getUint32(0, !1), n = t >>> 31 & 1, r = t >>> 23 & 255, i = t & 8388607, a = /* @__PURE__ */ new Uint8Array(8), o = new DataView(a.buffer);
3152
+ if (r === 255) o.setUint32(0, (n << 31 | 2146435072 | i >>> 3) >>> 0, !1), o.setUint32(4, (i & 7) << 29, !1);
3153
+ else if (r === 0 && i === 0) o.setUint32(0, n << 31 >>> 0, !1), o.setUint32(4, 0, !1);
3154
+ else {
3155
+ let t = new DataView(e.buffer, e.byteOffset).getFloat32(0, !1);
3156
+ o.setFloat64(0, t, !1);
3157
+ }
3158
+ return a;
3159
+ }
3160
+ function Fr(e, t, n) {
3161
+ let r = e.length === 2 ? 1 : e.length === 4 ? 2 : 3;
3162
+ if (r === 1) {
3163
+ let n = e[0] << 8 | e[1];
3164
+ if (t === 2) return new kr(Mr(n));
3165
+ if (t === 3) return new Ar(Nr(n));
3166
+ }
3167
+ if (r === 2) {
3168
+ if (t === 3) return new Ar(Pr(e));
3169
+ if (t === 1) {
3170
+ let t = new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), r = S(t);
3171
+ return !Object.is(C(r), t) && !isNaN(t) && n("float'...' value cannot be exactly represented as float16 (_1)"), new Or(r);
3172
+ }
3173
+ }
3174
+ if (r === 3) {
3175
+ let r = new DataView(e.buffer, e.byteOffset).getFloat64(0, !1);
3176
+ if (t === 1) {
3177
+ let e = S(r);
3178
+ return !Object.is(C(e), r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float16 (_1)"), new Or(e);
3179
+ }
3180
+ if (t === 2) {
3181
+ let e = Math.fround(r);
3182
+ !Object.is(e, r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float32 (_2)");
3183
+ let t = /* @__PURE__ */ new Uint8Array(4);
3184
+ return new DataView(t.buffer).setFloat32(0, e, !1), new kr(t);
3185
+ }
3186
+ }
3187
+ return jr(e);
3188
+ }
3189
+ var Ir = {
3190
+ appStringPrefixes: ["float"],
3191
+ parseAppString(t, n, r, i) {
3192
+ let a = Dr(n);
3193
+ if (!/^[0-9a-fA-F]*$/.test(a)) throw SyntaxError("float'...' contains non-hex characters");
3194
+ if (a.length % 2 != 0) throw SyntaxError(`float'...' hex content has odd length (${a.length} digits)`);
3195
+ let o = e(a), s = i?.encodingWidth;
3196
+ if (s === void 0) return jr(o);
3197
+ if (s !== 1 && s !== 2 && s !== 3) {
3198
+ let e = `float'...' encoding indicator _${s} is not valid; use _1, _2, or _3`;
3199
+ if (r) return r(e), jr(o);
3200
+ throw SyntaxError(e);
3201
+ }
3202
+ return s === (o.length === 2 ? 1 : o.length === 4 ? 2 : 3) ? jr(o) : Fr(o, s, r ?? ((e) => {
3203
+ throw SyntaxError(e);
3204
+ }));
3205
+ },
3206
+ parseAppSequence(e, t, n) {
3207
+ if (t.length === 0) throw SyntaxError("float<<...>> requires exactly one byte-string item");
3208
+ if (t.length > 1) {
3209
+ let e = `float<<...>> expects 1 item; got ${t.length} — using first`;
3210
+ if (n) n(e);
3211
+ else throw SyntaxError(e);
3212
+ }
3213
+ if (!(t[0] instanceof N)) throw SyntaxError("float<<...>> item must be a byte string");
3214
+ return jr(t[0].value);
3215
+ }
3216
+ }, Lr = [Bn, sr], Rr = [
3217
+ Kt,
3218
+ dn,
3219
+ Ln,
3220
+ _r,
3221
+ vr,
3222
+ Tr,
3223
+ Er,
3224
+ Ir
3225
+ ], zr;
3226
+ function Z(e) {
3227
+ return e === void 0 ? zr ??= [...Lr, ...Rr] : e === !1 ? Lr : [...Lr, ...e];
3228
+ }
3229
+ //#endregion
3230
+ //#region src/js/fromJS.ts
3231
+ var Br;
3232
+ function Vr(e) {
3233
+ if (e === void 0) {
3234
+ if (Br) return Br;
3235
+ let e = Z(void 0);
3236
+ return Br = {
3237
+ fromJS: e.filter((e) => e.fromJS !== void 0),
3238
+ parseTag: e.filter((e) => e.parseTag !== void 0)
3239
+ };
3240
+ }
3241
+ let t = Z(e);
3242
+ return {
3243
+ fromJS: t.filter((e) => e.fromJS !== void 0),
3244
+ parseTag: t.filter((e) => e.parseTag !== void 0)
2929
3245
  };
2930
3246
  }
2931
- function cr(e) {
2932
- let t = e?.extensions, n = sr();
3247
+ function Hr(e) {
3248
+ let t = e?.extensions, n = Vr(e?.builtinExtensions);
2933
3249
  return t?.length ? {
2934
3250
  fromJS: [...t.filter((e) => e.fromJS !== void 0), ...n.fromJS],
2935
3251
  parseTag: [...t.filter((e) => e.parseTag !== void 0), ...n.parseTag]
2936
3252
  } : n;
2937
3253
  }
2938
- function lr(e, t) {
3254
+ function Ur(e, t) {
2939
3255
  if (t?.replacer) {
2940
- let { replacer: n, ...r } = t, i = dr(e, n, r.extensions, r.undefinedOmits);
2941
- return i === h ? R.UNDEFINED : lr(i, Object.keys(r).length > 0 ? r : void 0);
3256
+ let { replacer: n, ...r } = t, i = Gr(e, n, r.extensions, r.undefinedOmits, r.builtinExtensions);
3257
+ return i === h ? R.UNDEFINED : Ur(i, Object.keys(r).length > 0 ? r : void 0);
2942
3258
  }
2943
- return Q(e, t, !0, cr(t));
3259
+ return Q(e, t, !0, Hr(t));
2944
3260
  }
2945
3261
  function Q(e, t, n, r) {
2946
3262
  for (let n of r.fromJS) {
@@ -2964,7 +3280,7 @@ function Q(e, t, n, r) {
2964
3280
  if (e === !1) return R.FALSE;
2965
3281
  if (typeof e == "bigint") return e > 18446744073709551615n ? new et(e) : e < -18446744073709551616n ? new tt(e) : e >= 0n ? new k(e) : new A(e);
2966
3282
  if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new k(BigInt(e)) : new A(BigInt(e)) : new j(e);
2967
- if (typeof e == "string") return new B(e);
3283
+ if (typeof e == "string") return new V(e);
2968
3284
  if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return Q(e.valueOf(), t, !1, r);
2969
3285
  if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new N(new Uint8Array(e));
2970
3286
  if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new I(Array.from(e, (e) => new k(BigInt(e)))) : new N(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
@@ -2972,17 +3288,17 @@ function Q(e, t, n, r) {
2972
3288
  if (Array.isArray(e)) return new I(e.map((e) => Q(e, t, !0, r)));
2973
3289
  if (typeof e == "object") {
2974
3290
  let n = [];
2975
- for (let [i, a] of Object.entries(e)) n.push([new B(i), Q(a, t, !0, r)]);
3291
+ for (let [i, a] of Object.entries(e)) n.push([new V(i), Q(a, t, !0, r)]);
2976
3292
  return new L(n);
2977
3293
  }
2978
3294
  throw TypeError(`fromJS: unsupported value type: ${typeof e}`);
2979
3295
  }
2980
- function ur(e) {
3296
+ function Wr(e) {
2981
3297
  return ArrayBuffer.isView(e) || e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer || e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]" || e instanceof m.Null || e instanceof m.Undefined || e instanceof g;
2982
3298
  }
2983
- function dr(e, t, n, r) {
2984
- let i = [...n ?? [], ...Z].filter((e) => e.isJSType !== void 0);
2985
- function a(e) {
3299
+ function Gr(e, t, n, r, i) {
3300
+ let a = [...n ?? [], ...Z(i)].filter((e) => e.isJSType !== void 0);
3301
+ function o(e) {
2986
3302
  return e === h || r === !0 && e === void 0;
2987
3303
  }
2988
3304
  if (Array.isArray(t)) {
@@ -2991,20 +3307,20 @@ function dr(e, t, n, r) {
2991
3307
  if (typeof e != "object" || !e) return e;
2992
3308
  if (e instanceof $) return $.from(e, ([e, t]) => [e, r(t)]);
2993
3309
  if (Array.isArray(e)) return e.map(r);
2994
- if (m.symbol in e || ur(e) || i.some((t) => t.isJSType(e))) return e;
3310
+ if (m.symbol in e || Wr(e) || a.some((t) => t.isJSType(e))) return e;
2995
3311
  let t = Object.getPrototypeOf(e);
2996
3312
  if (t === Object.prototype || t === null) {
2997
3313
  let t = e.toJSON;
2998
3314
  if (typeof t == "function") return r(t.call(e));
2999
3315
  }
3000
- let a = {};
3001
- for (let t of n) Object.prototype.hasOwnProperty.call(e, t) && (a[t] = r(e[t]));
3002
- return a;
3316
+ let i = {};
3317
+ for (let t of n) Object.prototype.hasOwnProperty.call(e, t) && (i[t] = r(e[t]));
3318
+ return i;
3003
3319
  }
3004
3320
  return r(e);
3005
3321
  }
3006
- let o = t;
3007
- function s(e, t, n) {
3322
+ let s = t;
3323
+ function c(e, t, n) {
3008
3324
  if (typeof e == "object" && e && !(e instanceof $)) {
3009
3325
  let n = Object.getPrototypeOf(e);
3010
3326
  if (n === Object.prototype || n === null) {
@@ -3012,31 +3328,31 @@ function dr(e, t, n, r) {
3012
3328
  typeof n == "function" && (e = n.call(e, t));
3013
3329
  }
3014
3330
  }
3015
- if (e = o.call(n, t, e), typeof e == "object" && e) {
3331
+ if (e = s.call(n, t, e), typeof e == "object" && e) {
3016
3332
  if (m.symbol in e) return e;
3017
3333
  if (e instanceof $) {
3018
3334
  let t = new $();
3019
3335
  for (let [n, r] of e) {
3020
- let i = s(r, n, e);
3021
- a(i) || t.push([n, i]);
3336
+ let i = c(r, n, e);
3337
+ o(i) || t.push([n, i]);
3022
3338
  }
3023
3339
  return t;
3024
3340
  }
3025
3341
  if (Array.isArray(e)) return e.map((t, n) => {
3026
- let r = s(t, String(n), e);
3027
- return a(r) ? null : r;
3342
+ let r = c(t, String(n), e);
3343
+ return o(r) ? null : r;
3028
3344
  });
3029
- if (ur(e) || i.some((t) => t.isJSType(e))) return e;
3345
+ if (Wr(e) || a.some((t) => t.isJSType(e))) return e;
3030
3346
  let t = {};
3031
3347
  for (let n of Object.keys(e)) {
3032
- let r = s(e[n], n, e);
3033
- a(r) || (t[n] = r);
3348
+ let r = c(e[n], n, e);
3349
+ o(r) || (t[n] = r);
3034
3350
  }
3035
3351
  return t;
3036
3352
  }
3037
3353
  return e;
3038
3354
  }
3039
- return s(e, "", { "": e });
3355
+ return c(e, "", { "": e });
3040
3356
  }
3041
3357
  //#endregion
3042
3358
  //#region src/mapEntries.ts
@@ -3044,7 +3360,7 @@ var $ = class extends Array {
3044
3360
  toJSON() {
3045
3361
  let e = {};
3046
3362
  for (let [t, n] of this) {
3047
- let r = typeof t == "string" ? t : lr(t).toCDN();
3363
+ let r = typeof t == "string" ? t : Ur(t).toCDN();
3048
3364
  r === "__proto__" ? Object.defineProperty(e, r, {
3049
3365
  value: n,
3050
3366
  writable: !0,
@@ -3056,6 +3372,6 @@ var $ = class extends Array {
3056
3372
  }
3057
3373
  };
3058
3374
  //#endregion
3059
- export { S as C, s as D, o as E, m as O, C as S, h as T, M as _, qt as a, k as b, tt as c, R as d, L as f, N as g, P as h, ir as i, c as k, et as l, F as m, dr as n, B as o, I as p, lr as r, at as s, $ as t, Ue as u, j as v, g as w, O as x, A as y };
3375
+ export { k as A, I as C, M as D, N as E, s as F, m as I, c as L, g as M, h as N, j as O, o as P, L as S, P as T, at as _, Ir as a, Ue as b, Er as c, ar as d, Ln as f, V as g, qt as h, Rr as i, O as j, A as k, vr as l, Kt as m, Gr as n, Dr as o, dn as p, Ur as r, Tr as s, $ as t, _r as u, tt as v, F as w, R as x, et as y };
3060
3376
 
3061
- //# sourceMappingURL=mapEntries-CYvdsAfP.js.map
3377
+ //# sourceMappingURL=mapEntries-ClxYqDPp.js.map