@cbortech/cbor 0.25.2 → 0.25.4

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,80 +1,81 @@
1
+ import { n as e, t } from "./tokenizer-C597LW89.js";
1
2
  //#region src/tag.ts
2
- var e = Symbol.for("cbor.tag"), t = class {
3
+ var n = Symbol.for("cbor.tag"), r = class {
3
4
  valueOf() {
4
5
  return null;
5
6
  }
6
7
  toJSON() {
7
8
  return null;
8
9
  }
9
- }, n = class {
10
+ }, i = class {
10
11
  valueOf() {}
11
12
  toJSON() {}
12
13
  };
13
- function r(t) {
14
- if (!s(t)) return;
15
- let n = t[e];
16
- return typeof n == "bigint" ? n : void 0;
14
+ function a(e) {
15
+ if (!l(e)) return;
16
+ let t = e[n];
17
+ return typeof t == "bigint" ? t : void 0;
17
18
  }
18
- function i(r, i) {
19
+ function o(e, t) {
19
20
  let a;
20
- switch (typeof r) {
21
+ switch (typeof e) {
21
22
  case "number":
22
- a = new Number(r);
23
+ a = new Number(e);
23
24
  break;
24
25
  case "string":
25
- a = new String(r);
26
+ a = new String(e);
26
27
  break;
27
28
  case "boolean":
28
- a = new Boolean(r);
29
+ a = new Boolean(e);
29
30
  break;
30
31
  case "bigint":
31
- a = Object(r);
32
+ a = Object(e);
32
33
  break;
33
34
  case "undefined":
34
- a = new n();
35
+ a = new i();
35
36
  break;
36
37
  case "object":
37
- if (r === null) {
38
- a = new t();
38
+ if (e === null) {
39
+ a = new r();
39
40
  break;
40
41
  }
41
- a = r;
42
+ a = e;
42
43
  break;
43
- default: throw TypeError(`setCborTag: cannot tag value of type ${typeof r}`);
44
+ default: throw TypeError(`setCborTag: cannot tag value of type ${typeof e}`);
44
45
  }
45
- return a[e] = i, a;
46
+ return a[n] = t, a;
46
47
  }
47
- function a(r) {
48
- if (r instanceof Number || r instanceof String || r instanceof Boolean || Object.prototype.toString.call(r) === "[object BigInt]") return r.valueOf();
49
- if (r instanceof t) return null;
50
- if (!(r instanceof n)) return typeof r == "object" && r && delete r[e], r;
48
+ function s(e) {
49
+ if (e instanceof Number || e instanceof String || e instanceof Boolean || Object.prototype.toString.call(e) === "[object BigInt]") return e.valueOf();
50
+ if (e instanceof r) return null;
51
+ if (!(e instanceof i)) return typeof e == "object" && e && delete e[n], e;
51
52
  }
52
- function o(e) {
53
+ function c(e) {
53
54
  if (e instanceof Number || e instanceof String || e instanceof Boolean || Object.prototype.toString.call(e) === "[object BigInt]") return e.valueOf();
54
- if (e instanceof t) return null;
55
- if (!(e instanceof n)) return e;
55
+ if (e instanceof r) return null;
56
+ if (!(e instanceof i)) return e;
56
57
  }
57
- function s(e) {
58
+ function l(e) {
58
59
  return typeof e == "object" && !!e;
59
60
  }
60
- var c = class {
61
+ var u = class {
61
62
  constructor() {}
62
- static symbol = e;
63
- static Null = t;
64
- static Undefined = n;
63
+ static symbol = n;
64
+ static Null = r;
65
+ static Undefined = i;
65
66
  static get(e) {
66
- return r(e);
67
+ return a(e);
67
68
  }
68
69
  static set(e, t) {
69
- return i(e, t);
70
+ return o(e, t);
70
71
  }
71
72
  static remove(e) {
72
- return a(e);
73
+ return s(e);
73
74
  }
74
75
  static getValue(e) {
75
- return o(e);
76
+ return c(e);
76
77
  }
77
- }, l = Symbol("cbor.omit"), u = class e {
78
+ }, d = Symbol("cbor.omit"), f = class e {
78
79
  value;
79
80
  constructor(e) {
80
81
  if (!Number.isInteger(e) || e < 0 || e > 255) throw RangeError("Simple value must be an integer in 0–255");
@@ -92,23 +93,45 @@ var c = class {
92
93
  static get(t) {
93
94
  return t instanceof e ? t.value : void 0;
94
95
  }
95
- };
96
+ }, p = Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0")), m = new Int8Array(128).fill(-1);
97
+ for (let e = 0; e < 16; e++) m["0123456789abcdef".charCodeAt(e)] = e, m["0123456789ABCDEF".charCodeAt(e)] = e;
98
+ var ee = typeof Uint8Array.prototype.toHex == "function", te = typeof Uint8Array.fromHex == "function", ne = 256;
99
+ function re(e) {
100
+ if (ee) return e.toHex();
101
+ let t = "";
102
+ for (let n = 0; n < e.length; n++) t += p[e[n]];
103
+ return t;
104
+ }
105
+ function ie(e) {
106
+ if (e.length % 2 != 0) throw SyntaxError(`hex string has odd length: ${e.length}`);
107
+ if (te && e.length >= ne) return Uint8Array.fromHex(e);
108
+ let t = new Uint8Array(e.length / 2);
109
+ for (let n = 0, r = 0; n < e.length; n += 2, r++) {
110
+ let i = e.charCodeAt(n), a = e.charCodeAt(n + 1), o = i < 128 ? m[i] : -1, s = a < 128 ? m[a] : -1;
111
+ if ((o | s) < 0) {
112
+ let t = o < 0 ? e[n] : e[n + 1];
113
+ throw SyntaxError(`invalid character ${JSON.stringify(t)} in hex string`);
114
+ }
115
+ t[r] = o << 4 | s;
116
+ }
117
+ return t;
118
+ }
96
119
  //#endregion
97
120
  //#region src/cdn/serialize-utils.ts
98
- function d(e) {
121
+ function h(e) {
99
122
  let t = e?.indent;
100
123
  return t === void 0 ? null : typeof t == "number" ? " ".repeat(t) : t;
101
124
  }
102
- function f(e, t) {
125
+ function g(e, t) {
103
126
  return e.repeat(t);
104
127
  }
105
- function p(e) {
128
+ function ae(e) {
106
129
  return !!(e.comments?.leading?.length || e.comments?.trailing?.length || e.comments?.dangling?.length);
107
130
  }
108
- function ee(e) {
131
+ function oe(e) {
109
132
  return !!(e.comments?.trailing?.length || e.comments?.dangling?.length);
110
133
  }
111
- function m(e, t) {
134
+ function _(e, t) {
112
135
  if (!t) return e.text;
113
136
  let { marker: n, text: r } = e;
114
137
  if (t === "c-style") return n === "#" ? "//" + r.slice(1) : n === "/" ? "/*" + r.slice(1, -1) + "*/" : r;
@@ -119,17 +142,17 @@ function m(e, t) {
119
142
  }
120
143
  return r;
121
144
  }
122
- function te(e, t, n) {
123
- return (e.comments?.leading ?? []).map((e) => t + m(e, n));
145
+ function se(e, t, n) {
146
+ return (e.comments?.leading ?? []).map((e) => t + _(e, n));
124
147
  }
125
- function h(e, t) {
148
+ function ce(e, t) {
126
149
  let n = e.comments?.trailing ?? [];
127
- return n.length === 0 ? "" : " " + n.map((e) => m(e, t)).join(" ");
150
+ return n.length === 0 ? "" : " " + n.map((e) => _(e, t)).join(" ");
128
151
  }
129
- function ne(e, t, n) {
130
- return (e.comments?.dangling ?? []).map((e) => t + m(e, n));
152
+ function le(e, t, n) {
153
+ return (e.comments?.dangling ?? []).map((e) => t + _(e, n));
131
154
  }
132
- function re(e, t = !1) {
155
+ function ue(e, t = !1) {
133
156
  let n = e?.commas ?? "comma", r = n !== "none";
134
157
  return {
135
158
  inlineSep: r ? t ? "," : ", " : " ",
@@ -138,18 +161,15 @@ function re(e, t = !1) {
138
161
  colSep: t ? ":" : ": "
139
162
  };
140
163
  }
141
- function ie(e) {
142
- return typeof e.toHex == "function" ? e.toHex() : Array.from(e, (e) => e.toString(16).padStart(2, "0")).join("");
143
- }
144
- var g = typeof new Uint8Array().toBase64 == "function";
145
- function ae(e) {
146
- if (g) return e.toBase64({ omitPadding: !0 });
164
+ var de = typeof new Uint8Array().toBase64 == "function";
165
+ function fe(e) {
166
+ if (de) return e.toBase64({ omitPadding: !0 });
147
167
  let t = "";
148
168
  for (let n of e) t += String.fromCharCode(n);
149
169
  return btoa(t).replace(/=/g, "");
150
170
  }
151
- function oe(e) {
152
- if (g) return e.toBase64({
171
+ function pe(e) {
172
+ if (de) return e.toBase64({
153
173
  alphabet: "base64url",
154
174
  omitPadding: !0
155
175
  });
@@ -157,54 +177,54 @@ function oe(e) {
157
177
  for (let n of e) t += String.fromCharCode(n);
158
178
  return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
159
179
  }
160
- var se = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", ce = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
161
- function le(e, t) {
180
+ var me = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", he = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
181
+ function ge(e, t) {
162
182
  let n = "", r = 0, i = 0;
163
183
  for (let a of e) for (r = r << 8 | a, i += 8; i >= 5;) i -= 5, n += t[r >> i & 31];
164
184
  return i > 0 && (n += t[r << 5 - i & 31]), n;
165
185
  }
166
- function ue(e) {
186
+ function _e(e) {
167
187
  for (let t of e) {
168
188
  let e = t.codePointAt(0);
169
189
  if (e < 32 || e === 127) return !0;
170
190
  }
171
191
  return !1;
172
192
  }
173
- function de(e, t, n) {
193
+ function ve(e, t, n) {
174
194
  if (n === "string") {
175
- let t = pe(e);
176
- if (t != null) return ge(t);
195
+ let t = be(e);
196
+ if (t != null) return Ce(t);
177
197
  }
178
198
  if (n === "printable-string" || n === void 0) {
179
- let t = pe(e);
180
- if (t != null && !ue(t)) return ge(t);
199
+ let t = be(e);
200
+ if (t != null && !_e(t)) return Ce(t);
181
201
  }
182
202
  switch (t) {
183
- case "base64": return `b64'${ae(e)}'`;
184
- case "base64url": return `b64'${oe(e)}'`;
185
- case "base32": return `b32'${le(e, se)}'`;
186
- case "base32hex": return `h32'${le(e, ce)}'`;
187
- default: return `h'${ie(e)}'`;
203
+ case "base64": return `b64'${fe(e)}'`;
204
+ case "base64url": return `b64'${pe(e)}'`;
205
+ case "base32": return `b32'${ge(e, me)}'`;
206
+ case "base32hex": return `h32'${ge(e, he)}'`;
207
+ default: return `h'${re(e)}'`;
188
208
  }
189
209
  }
190
- var fe = new TextDecoder("utf-8", { fatal: !0 });
191
- function pe(e) {
210
+ var ye = new TextDecoder("utf-8", { fatal: !0 });
211
+ function be(e) {
192
212
  try {
193
- return fe.decode(e);
213
+ return ye.decode(e);
194
214
  } catch {
195
215
  return null;
196
216
  }
197
217
  }
198
- function me(e, t) {
218
+ function xe(e, t) {
199
219
  for (let n = 0; n < e.length; n++) {
200
220
  let r = e.charCodeAt(n);
201
221
  if (r === t || r === 92 || r < 32 || r === 127 || r >= 8192 && (r === 8232 || r === 8233 || r >= 8203 && r <= 8205 || r === 65279)) return !0;
202
222
  }
203
223
  return !1;
204
224
  }
205
- function he(e, t) {
225
+ function Se(e, t) {
206
226
  let n = t.codePointAt(0);
207
- if (!me(e, n)) return t + e + t;
227
+ if (!xe(e, n)) return t + e + t;
208
228
  let r = t;
209
229
  for (let i of e) {
210
230
  let e = i.codePointAt(0);
@@ -229,31 +249,31 @@ function he(e, t) {
229
249
  }
230
250
  return r + t;
231
251
  }
232
- function ge(e) {
233
- return he(e, "'");
252
+ function Ce(e) {
253
+ return Se(e, "'");
234
254
  }
235
- function _e(e) {
236
- return he(e, "'");
255
+ function we(e) {
256
+ return Se(e, "'");
237
257
  }
238
- function ve(e) {
239
- return he(e, "\"");
258
+ function Te(e) {
259
+ return Se(e, "\"");
240
260
  }
241
- function ye(e) {
261
+ function Ee(e) {
242
262
  if (isNaN(e)) return "NaN";
243
263
  if (!isFinite(e)) return e > 0 ? "Infinity" : "-Infinity";
244
264
  if (Object.is(e, -0)) return "-0.0";
245
265
  let t = e.toString();
246
266
  return t.includes(".") || t.includes("e") ? t : t + ".0";
247
267
  }
248
- function be(e, t, n) {
268
+ function De(e, t, n) {
249
269
  return t === void 0 || t === n ? "" : t === "half" ? "_1" : t === "single" ? "_2" : "_3";
250
270
  }
251
271
  //#endregion
252
272
  //#region src/utils/float16.ts
253
- var xe = "getFloat16" in DataView.prototype && "setFloat16" in DataView.prototype, Se = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
254
- function Ce(e) {
255
- Se.setFloat64(0, e, !1);
256
- let t = Se.getUint32(0, !1), n = Se.getUint32(4, !1), r = t >>> 31 & 1, i = t >>> 20 & 2047, a = t & 1048575;
273
+ var Oe = "getFloat16" in DataView.prototype && "setFloat16" in DataView.prototype, ke = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
274
+ function Ae(e) {
275
+ ke.setFloat64(0, e, !1);
276
+ let t = ke.getUint32(0, !1), n = ke.getUint32(4, !1), r = t >>> 31 & 1, i = t >>> 20 & 2047, a = t & 1048575;
257
277
  if (i === 2047) {
258
278
  if (a === 0 && n === 0) return r << 15 | 31744;
259
279
  let e = a >> 10 | (n === 0 ? 0 : 1) || 1;
@@ -274,14 +294,14 @@ function Ce(e) {
274
294
  let u = o <= 0 ? 0 : o;
275
295
  return r << 15 | u << 10 | s;
276
296
  }
277
- function _(e) {
297
+ function je(e) {
278
298
  let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023;
279
299
  return n === 31 ? r === 0 ? t ? -Infinity : Infinity : NaN : n === 0 ? r === 0 ? t ? -0 : 0 : (t ? -1 : 1) * 2 ** -14 * (r / 1024) : (t ? -1 : 1) * 2 ** (n - 15) * (1 + r / 1024);
280
300
  }
281
- var we = xe ? (e, t, n, r) => {
301
+ var Me = Oe ? (e, t, n, r) => {
282
302
  e.setFloat16(t, n, r);
283
303
  } : (e, t, n, r) => {
284
- e.setUint16(t, Ce(n), r);
304
+ e.setUint16(t, Ae(n), r);
285
305
  }, v = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8)), y = new Uint8Array(v.buffer), b = class {
286
306
  buf;
287
307
  len = 0;
@@ -316,7 +336,7 @@ var we = xe ? (e, t, n, r) => {
316
336
  v.setBigUint64(0, e, !1), this._ensure(8), this.buf.set(y, this.len), this.len += 8;
317
337
  }
318
338
  writeFloat16(e) {
319
- we(v, 0, e, !1), this._ensure(2);
339
+ Me(v, 0, e, !1), this._ensure(2);
320
340
  let t = this.buf;
321
341
  t[this.len++] = y[0], t[this.len++] = y[1];
322
342
  }
@@ -331,14 +351,14 @@ var we = xe ? (e, t, n, r) => {
331
351
  finish() {
332
352
  return this.buf.slice(0, this.len);
333
353
  }
334
- }, Te = [
354
+ }, Ne = [
335
355
  255n,
336
356
  65535n,
337
357
  4294967295n,
338
358
  18446744073709551615n
339
359
  ];
340
- function Ee(e) {
341
- return e === "i" ? 23n : Te[e];
360
+ function Pe(e) {
361
+ return e === "i" ? 23n : Ne[e];
342
362
  }
343
363
  function x(e, t, n, r) {
344
364
  if (r === void 0 && typeof n == "number" && n < 4294967296) {
@@ -352,30 +372,30 @@ function x(e, t, n, r) {
352
372
  e.writeByte(t << 5 | Number(i));
353
373
  return;
354
374
  }
355
- if (i > Te[r]) throw RangeError(`value ${i} does not fit in encodingWidth _${r} (max ${Te[r]})`);
375
+ if (i > Ne[r]) throw RangeError(`value ${i} does not fit in encodingWidth _${r} (max ${Ne[r]})`);
356
376
  let n = 24 + r;
357
377
  e.writeByte(t << 5 | n), n === 24 ? e.writeByte(Number(i)) : n === 25 ? e.writeUint16(Number(i)) : n === 26 ? e.writeUint32(Number(i)) : e.writeBigUint64(i);
358
378
  return;
359
379
  }
360
380
  i <= 23n ? e.writeByte(t << 5 | Number(i)) : i <= 255n ? (e.writeByte(t << 5 | 24), e.writeByte(Number(i))) : i <= 65535n ? (e.writeByte(t << 5 | 25), e.writeUint16(Number(i))) : i <= 4294967295n ? (e.writeByte(t << 5 | 26), e.writeUint32(Number(i))) : (e.writeByte(t << 5 | 27), e.writeBigUint64(i));
361
381
  }
362
- function De(e, t, n) {
382
+ function S(e, t, n) {
363
383
  let r = new b(9);
364
384
  return x(r, e, t, n), r.finish();
365
385
  }
366
- var Oe = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4));
367
- function ke(e) {
368
- return Object.is(_(Ce(e)), e);
386
+ var Fe = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4));
387
+ function Ie(e) {
388
+ return Object.is(je(Ae(e)), e);
369
389
  }
370
- function Ae(e) {
371
- return Oe.setFloat32(0, e, !1), Object.is(Oe.getFloat32(0, !1), e);
390
+ function Le(e) {
391
+ return Fe.setFloat32(0, e, !1), Object.is(Fe.getFloat32(0, !1), e);
372
392
  }
373
- function je(e) {
374
- return ke(e) ? "half" : Ae(e) ? "single" : "double";
393
+ function Re(e) {
394
+ return Ie(e) ? "half" : Le(e) ? "single" : "double";
375
395
  }
376
396
  //#endregion
377
397
  //#region src/ast/CborItem.ts
378
- var S = class e {
398
+ var C = class e {
379
399
  start;
380
400
  end;
381
401
  comments;
@@ -394,7 +414,7 @@ var S = class e {
394
414
  ...e
395
415
  } : e, n = this._toCDN(t, 0), r = t?.preserveComments;
396
416
  if (!r) return n;
397
- let i = typeof r == "string" ? r : void 0, a = this.comments?.leading?.map((e) => m(e, i)) ?? [], o = this.comments?.trailing ?? [], s = o.length === 0 ? n : `${n} ${o.map((e) => m(e, i).trimEnd()).join(" ")}`;
417
+ let i = typeof r == "string" ? r : void 0, a = this.comments?.leading?.map((e) => _(e, i)) ?? [], o = this.comments?.trailing ?? [], s = o.length === 0 ? n : `${n} ${o.map((e) => _(e, i).trimEnd()).join(" ")}`;
398
418
  return [...a, s].join("\n");
399
419
  }
400
420
  toEDN(e) {
@@ -407,7 +427,7 @@ var S = class e {
407
427
  } : e, n = this._toJS(t);
408
428
  if (!t?.reviver) return n;
409
429
  let r = t.reviver.call({ "": n }, "", n);
410
- return r === l ? void 0 : r;
430
+ return r === d ? void 0 : r;
411
431
  }
412
432
  toHexDump(e) {
413
433
  let t = this._defaults ? {
@@ -438,7 +458,7 @@ var S = class e {
438
458
  comment: this._toCDN(t, 0)
439
459
  }];
440
460
  }
441
- }, C = class extends S {
461
+ }, w = class extends C {
442
462
  value;
443
463
  encodingWidth;
444
464
  constructor(e, t) {
@@ -462,7 +482,7 @@ var S = class e {
462
482
  let t = e?.integerAs ?? "auto";
463
483
  return t === "bigint" ? this.value : t === "number" || this.value <= BigInt(2 ** 53 - 1) ? Number(this.value) : this.value;
464
484
  }
465
- }, w = class extends S {
485
+ }, T = class extends C {
466
486
  argument;
467
487
  encodingWidth;
468
488
  constructor(e, t) {
@@ -491,8 +511,8 @@ var S = class e {
491
511
  let t = this.value, n = e?.integerAs ?? "auto";
492
512
  return n === "bigint" ? t : n === "number" || t >= BigInt(-(2 ** 53 - 1)) ? Number(t) : t;
493
513
  }
494
- }, Me = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
495
- function Ne(e) {
514
+ }, ze = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
515
+ function Be(e) {
496
516
  let t = e.startsWith("-"), n = e.slice(t ? 3 : 2), r = n.search(/[pP]/);
497
517
  if (r === -1) throw SyntaxError(`EDN parse error: hex float missing 'p' exponent: ${e}`);
498
518
  let i = n.slice(0, r), a = n.slice(r + 1);
@@ -510,20 +530,20 @@ function Ne(e) {
510
530
  let l = c * 2 ** o;
511
531
  return t ? -l : l;
512
532
  }
513
- function Pe(e) {
533
+ function Ve(e) {
514
534
  if (isNaN(e)) return "NaN";
515
535
  if (!isFinite(e)) return e > 0 ? "Infinity" : "-Infinity";
516
536
  let t = Object.is(e, -0) || e < 0, n = Math.abs(e);
517
537
  if (n === 0) return t ? "-0x0p+0" : "0x0p+0";
518
- Me.setFloat64(0, n, !1);
519
- let r = Me.getUint32(0, !1), i = Me.getUint32(4, !1), a = r >>> 20 & 2047, o = r & 1048575, s = i, c = (o.toString(16).padStart(5, "0") + s.toString(16).padStart(8, "0")).replace(/0+$/, ""), l = c === "" ? "" : `.${c}`, u, d;
538
+ ze.setFloat64(0, n, !1);
539
+ let r = ze.getUint32(0, !1), i = ze.getUint32(4, !1), a = r >>> 20 & 2047, o = r & 1048575, s = i, c = (o.toString(16).padStart(5, "0") + s.toString(16).padStart(8, "0")).replace(/0+$/, ""), l = c === "" ? "" : `.${c}`, u, d;
520
540
  a === 0 ? (u = "0", d = -1022) : (u = "1", d = a - 1023);
521
541
  let f = d >= 0 ? `+${d}` : `${d}`, p = `0x${u}${l}p${f}`;
522
542
  return t ? `-${p}` : p;
523
543
  }
524
544
  //#endregion
525
545
  //#region src/ast/CborFloat.ts
526
- var T = class extends S {
546
+ var E = class extends C {
527
547
  value;
528
548
  precision;
529
549
  ednSource;
@@ -531,18 +551,18 @@ var T = class extends S {
531
551
  super(), this.value = e, this.precision = t?.precision;
532
552
  }
533
553
  _encodeTo(e, t) {
534
- let n = this.precision ?? je(this.value);
554
+ let n = this.precision ?? Re(this.value);
535
555
  n === "half" ? (e.writeByte(249), e.writeFloat16(this.value)) : n === "single" ? (e.writeByte(250), e.writeFloat32(this.value)) : (e.writeByte(251), e.writeFloat64(this.value));
536
556
  }
537
557
  _toCDN(e, t) {
538
558
  if (e?.appStrings !== !1 && this.ednSource !== void 0) return this.ednSource;
539
- let n = je(this.value);
540
- return (e?.floatFormat === "hex" ? Pe(this.value) : ye(this.value)) + be(this.value, this.precision, n);
559
+ let n = Re(this.value);
560
+ return (e?.floatFormat === "hex" ? Ve(this.value) : Ee(this.value)) + De(this.value, this.precision, n);
541
561
  }
542
562
  _toJS(e) {
543
563
  return this.value;
544
564
  }
545
- }, E = class extends S {
565
+ }, D = class extends C {
546
566
  tag;
547
567
  content;
548
568
  encodingWidth;
@@ -560,986 +580,16 @@ var T = class extends S {
560
580
  _toHexDump(e, t) {
561
581
  let n = [{
562
582
  depth: e,
563
- hex: ((e) => Array.from(e, (e) => e.toString(16).toUpperCase().padStart(2, "0")).join(" "))(De(6, this.tag, this.encodingWidth)),
583
+ hex: ((e) => Array.from(e, (e) => e.toString(16).toUpperCase().padStart(2, "0")).join(" "))(S(6, this.tag, this.encodingWidth)),
564
584
  comment: `Tag ${this.tag}`
565
585
  }];
566
586
  return n.push(...this.content._toHexDump(e + 1, t)), n;
567
587
  }
568
588
  _toJS(e) {
569
589
  let t = this.content._toJS(e);
570
- return e?.stripTags ? t : c.set(t, this.tag);
571
- }
572
- };
573
- //#endregion
574
- //#region src/cdn/tokenizer.ts
575
- function Fe(e, t) {
576
- let n = 1, r = 1;
577
- for (let i = 0; i < t; i++) e[i] === "\n" ? (n++, r = 1) : r++;
578
- return {
579
- line: n,
580
- col: r
581
- };
582
- }
583
- function D(e) {
584
- return e >= 48 && e <= 57 || e >= 97 && e <= 102 || e >= 65 && e <= 70;
585
- }
586
- var Ie = new TextEncoder(), Le = class {
587
- input;
588
- pos;
589
- line;
590
- col;
591
- _peeked = null;
592
- _lastConsumedEndOffset;
593
- comments = [];
594
- onEscapeWarning;
595
- constructor(e, t) {
596
- this.input = e;
597
- let n = t?.offset ?? 0;
598
- if (!Number.isInteger(n) || n < 0 || n > e.length) throw RangeError(`EDN parse offset must be an integer between 0 and ${e.length}`);
599
- let r = Fe(e, n);
600
- this.pos = n, this.line = r.line, this.col = r.col, this._lastConsumedEndOffset = n;
601
- }
602
- peek() {
603
- return this._peeked === null && (this._peeked = this._readNext()), this._peeked;
604
- }
605
- consume() {
606
- let e = this._peeked === null ? this._readNext() : this._peeked;
607
- return this._peeked = null, this._lastConsumedEndOffset = e.endOffset, e;
608
- }
609
- get lastEndOffset() {
610
- return this._lastConsumedEndOffset;
611
- }
612
- get source() {
613
- return this.input;
614
- }
615
- _ch() {
616
- return this.input[this.pos] ?? "";
617
- }
618
- _eof() {
619
- return this.pos >= this.input.length;
620
- }
621
- _advance() {
622
- let e = this.input[this.pos++] ?? "";
623
- return e === "\n" ? (this.line++, this.col = 1) : this.col++, e;
624
- }
625
- _fail(e, t = this.line, n = this.col) {
626
- throw SyntaxError(`EDN parse error at line ${t}, column ${n}: ${e}`);
627
- }
628
- _skipWS() {
629
- for (;;) {
630
- for (;;) {
631
- let e = this.input[this.pos];
632
- if (e === void 0) return;
633
- if (e === " " || e === "\n" || e === " " || e === "\r") {
634
- this._advance();
635
- continue;
636
- }
637
- if (e > " " && e <= "~") break;
638
- if (/\s/.test(e)) {
639
- this._advance();
640
- continue;
641
- }
642
- break;
643
- }
644
- let e = this._ch();
645
- if (e === "#") {
646
- let e = this.pos, t = this.line, n = this.col;
647
- for (; !this._eof() && this._ch() !== "\n";) this._advance();
648
- this.comments.push({
649
- kind: "line",
650
- marker: "#",
651
- text: this.input.slice(e, this.pos),
652
- start: e,
653
- end: this.pos,
654
- line: t,
655
- col: n
656
- });
657
- continue;
658
- }
659
- if (e === "/") {
660
- let e = this.input[this.pos + 1] ?? "";
661
- if (e === "/") {
662
- let e = this.pos, t = this.line, n = this.col;
663
- for (this._advance(), this._advance(); !this._eof() && this._ch() !== "\n";) this._advance();
664
- this.comments.push({
665
- kind: "line",
666
- marker: "//",
667
- text: this.input.slice(e, this.pos),
668
- start: e,
669
- end: this.pos,
670
- line: t,
671
- col: n
672
- });
673
- continue;
674
- }
675
- if (e === "*") {
676
- let e = this.pos, t = this.line, n = this.col;
677
- this._advance(), this._advance(), this._skipBlockCommentStar(), this.comments.push({
678
- kind: "block",
679
- marker: "/*",
680
- text: this.input.slice(e, this.pos),
681
- start: e,
682
- end: this.pos,
683
- line: t,
684
- col: n
685
- });
686
- continue;
687
- }
688
- let t = this.pos, n = this.line, r = this.col;
689
- this._advance(), this._skipBlockCommentSlash(), this.comments.push({
690
- kind: "block",
691
- marker: "/",
692
- text: this.input.slice(t, this.pos),
693
- start: t,
694
- end: this.pos,
695
- line: n,
696
- col: r
697
- });
698
- continue;
699
- }
700
- return;
701
- }
702
- }
703
- _skipByteStringComment(e) {
704
- let t = this._ch();
705
- if (t === "/") {
706
- let t = this.input[this.pos + 1] ?? "";
707
- if (t === "/") {
708
- for (this._advance(), this._advance(); !this._eof() && this._ch() !== "\n";) {
709
- if (this._ch() === "\\") {
710
- this._advance(), !this._eof() && this._ch() !== "\n" && this._advance();
711
- continue;
712
- }
713
- if (this._ch() === e) break;
714
- this._advance();
715
- }
716
- return !0;
717
- }
718
- return t === "*" ? (this._advance(), this._advance(), this._skipBlockCommentStar(), !0) : (this._advance(), this._skipBlockCommentSlash(), !0);
719
- }
720
- if (t === "#") {
721
- for (; !this._eof() && this._ch() !== "\n";) {
722
- if (this._ch() === "\\") {
723
- if (this._advance(), this._eof() || this._ch() === "\n") continue;
724
- this._advance() === "u" && this._validateHexCommentUnicodeEscape();
725
- continue;
726
- }
727
- if (this._ch() === e) break;
728
- this._advance();
729
- }
730
- return !0;
731
- }
732
- return !1;
733
- }
734
- _validateHexCommentUnicodeEscape() {
735
- let e = this.line, t = this.col;
736
- if (!this._eof() && this._ch() === "{") {
737
- this._advance();
738
- let n = "";
739
- for (; !this._eof() && this._ch() !== "}" && this._ch() !== "\n";) n += this._advance();
740
- !this._eof() && this._ch() === "}" && this._advance();
741
- let r = parseInt(n || "0", 16);
742
- r >= 55296 && r <= 57343 && this._fail(`\\u{${n}} is a surrogate code point, not allowed in hex string comments`, e, t);
743
- return;
744
- }
745
- let n = "";
746
- for (let e = 0; e < 4 && !(this._eof() || this._ch() === "\n" || !/[0-9a-fA-F]/.test(this._ch())); e++) n += this._advance();
747
- if (n.length < 4) return;
748
- let r = parseInt(n, 16);
749
- if (r >= 55296 && r <= 56319) {
750
- (this._ch() !== "\\" || (this.input[this.pos + 1] ?? "") !== "u") && this._fail(`lone high surrogate \\u${n} in hex string comment`, e, t), this._advance(), this._advance();
751
- let r = "";
752
- for (let e = 0; e < 4 && !(this._eof() || this._ch() === "\n" || !/[0-9a-fA-F]/.test(this._ch())); e++) r += this._advance();
753
- let i = parseInt(r || "0", 16);
754
- (i < 56320 || i > 57343) && this._fail(`\\u${n} (high surrogate) not followed by valid low surrogate in hex string comment`, e, t);
755
- return;
756
- }
757
- r >= 56320 && r <= 57343 && this._fail(`lone low surrogate \\u${n} in hex string comment`, e, t);
758
- }
759
- _skipRawComment(e, t, n, r, i) {
760
- let a = e[t];
761
- if (a === "/") {
762
- if (t++, e[t] === "/") {
763
- for (t++; t < e.length && e[t] !== "\n";) t++;
764
- return t;
765
- }
766
- if (e[t] === "*") {
767
- for (t++; t < e.length;) {
768
- if (e[t] === "*" && e[t + 1] === "/") return t + 2;
769
- t++;
770
- }
771
- return t;
772
- }
773
- for (; t < e.length && e[t] !== "/";) t++;
774
- if (t >= e.length) throw SyntaxError(`EDN parse error at line ${r}, column ${i}: unterminated block comment in ${n}`);
775
- return t + 1;
776
- }
777
- if (a === "#") {
778
- for (; t < e.length && e[t] !== "\n";) t++;
779
- return t;
780
- }
781
- return -1;
782
- }
783
- _skipBlockCommentSlash() {
784
- let e = this.line, t = this.col;
785
- for (; !this._eof();) {
786
- if (this._ch() === "\\") {
787
- this._advance(), this._eof() || this._advance();
788
- continue;
789
- }
790
- if (this._ch() === "/") break;
791
- this._advance();
792
- }
793
- this._eof() && this._fail("unterminated block comment", e, t), this._advance();
794
- }
795
- _skipBlockCommentStar() {
796
- let e = this.line, t = this.col;
797
- for (; !this._eof();) {
798
- if (this._ch() === "*" && (this.input[this.pos + 1] ?? "") === "/") {
799
- this._advance(), this._advance();
800
- return;
801
- }
802
- this._advance();
803
- }
804
- this._fail("unterminated block comment", e, t);
805
- }
806
- _readStringContent(e) {
807
- this._advance();
808
- let t = e.charCodeAt(0), n = this.input.length, r = "";
809
- for (; !this._eof() && this._ch() !== e;) {
810
- let i = this.pos, a = 0, o = -1;
811
- for (; i < n;) {
812
- let e = this.input.charCodeAt(i);
813
- if (e === t || e === 92 || e === 127) break;
814
- if (e < 32) {
815
- if (e !== 10) break;
816
- a++, o = i;
817
- }
818
- i++;
819
- }
820
- if (i > this.pos) {
821
- r += this.input.slice(this.pos, i), a > 0 ? (this.line += a, this.col = i - o) : this.col += i - this.pos, this.pos = i;
822
- continue;
823
- }
824
- let s = this._ch();
825
- if (s === "\r") {
826
- this._advance();
827
- continue;
828
- }
829
- let c = s.codePointAt(0);
830
- if ((c < 32 && c !== 10 || c === 127) && this._fail(`unescaped control character U+${c.toString(16).padStart(4, "0")} is not allowed in string literals`), s === "\\") {
831
- let t = this.pos, n = this.line, i = this.col;
832
- this._advance();
833
- let a = this._advance();
834
- switch (a) {
835
- case "n":
836
- r += "\n";
837
- break;
838
- case "r":
839
- r += "\r";
840
- break;
841
- case "t":
842
- r += " ";
843
- break;
844
- case "b":
845
- r += "\b";
846
- break;
847
- case "f":
848
- r += "\f";
849
- break;
850
- case "\\":
851
- r += "\\";
852
- break;
853
- case "u":
854
- r += this._readUnicodeEscape(e, t, n, i);
855
- break;
856
- default:
857
- if (a === e) {
858
- r += a;
859
- break;
860
- }
861
- if (a === "/") {
862
- e === "'" && this._fail("\\/ is not a valid escape in single-quoted byte strings (§5.1)", n, i), r += "/";
863
- break;
864
- }
865
- if (this.onEscapeWarning) {
866
- if (a === "0") {
867
- this.onEscapeWarning("\\0 is a non-standard escape sequence; use \\u0000 instead", t, n, i), r += "\0";
868
- break;
869
- }
870
- if (a === "v") {
871
- this.onEscapeWarning("\\v is a non-standard escape sequence; use \\u000b instead", t, n, i), r += "\v";
872
- break;
873
- }
874
- if (a === "x") {
875
- let e = this._ch(), a = this.input[this.pos + 1] ?? "";
876
- (!/[0-9a-fA-F]/.test(e) || !/[0-9a-fA-F]/.test(a)) && this._fail("\\x escape requires exactly two hex digits", n, i), this._advance(), this._advance();
877
- let o = parseInt(e + a, 16);
878
- this.onEscapeWarning(`\\x${e}${a} is a non-standard escape sequence; use \\u00${e}${a} instead`, t, n, i), r += String.fromCharCode(o);
879
- break;
880
- }
881
- if (a === "\"" || a === "'") {
882
- this.onEscapeWarning(`\\${a} inside ${e === "\"" ? "double" : "single"}-quoted string is non-standard`, t, n, i), r += a;
883
- break;
884
- }
885
- if (a === "\n" || a === "\r") {
886
- a === "\r" && this._ch() === "\n" && this._advance(), this.onEscapeWarning("line continuation (\\<newline>) is non-standard; the newline is ignored", t, n, i);
887
- break;
888
- }
889
- this.onEscapeWarning(`\\${a} is an unknown escape sequence; interpreted as '${a}'`, t, n, i), r += a;
890
- break;
891
- }
892
- this._fail(`invalid escape sequence \\${a} in ${e === "\"" ? "double" : "single"}-quoted string`, n, i);
893
- }
894
- } else r += this._advance();
895
- }
896
- return this._eof() && this._fail("unterminated string literal"), this._advance(), r;
897
- }
898
- _readUnicodeEscape(e, t, n, r) {
899
- let i = this.line, a = this.col, o = (o) => {
900
- if (e === "'" && o >= 32 && o <= 126) {
901
- let e = `\\u escape for printable ASCII U+${o.toString(16).padStart(4, "0").toUpperCase()} is not allowed in single-quoted strings (§5.1 hexchar-s)`;
902
- if (this.onEscapeWarning) {
903
- this.onEscapeWarning(e, t ?? this.pos, n ?? i, r ?? a);
904
- return;
905
- }
906
- this._fail(e, i, a);
907
- }
908
- };
909
- if (!this._eof() && this._ch() === "{") {
910
- this._advance();
911
- let e = "";
912
- for (; !this._eof() && this._ch() !== "}";) {
913
- let t = this._ch();
914
- /[0-9a-fA-F]/.test(t) || this._fail(`invalid character in \\u{} escape: ${JSON.stringify(t)}`, i, a), e += this._advance();
915
- }
916
- this._eof() && this._fail("unterminated \\u{} escape", i, a), this._advance(), e.length === 0 && this._fail("empty \\u{} escape", i, a);
917
- let t = parseInt(e, 16);
918
- return t > 1114111 && this._fail(`\\u{${e}} exceeds maximum Unicode code point U+10FFFF`, i, a), t >= 55296 && t <= 57343 && this._fail(`\\u{${e}} is a surrogate code point, which is not a valid Unicode scalar value`, i, a), o(t), String.fromCodePoint(t);
919
- }
920
- let s = "";
921
- for (let e = 0; e < 4; e++) {
922
- this._eof() && this._fail("truncated \\uXXXX escape", i, a);
923
- let e = this._ch();
924
- /[0-9a-fA-F]/.test(e) || this._fail(`invalid hex digit in \\uXXXX escape: ${JSON.stringify(e)}`, i, a), s += this._advance();
925
- }
926
- let c = parseInt(s, 16);
927
- if (c >= 55296 && c <= 56319) {
928
- (this._ch() !== "\\" || (this.input[this.pos + 1] ?? "") !== "u") && this._fail(`lone high surrogate \\u${s} must be followed by \\uDC00–\\uDFFF`, i, a), this._advance(), this._advance();
929
- let e = this.line, t = this.col, n = "";
930
- for (let r = 0; r < 4; r++) this._eof() && this._fail("truncated low-surrogate escape", e, t), n += this._advance();
931
- let r = parseInt(n, 16);
932
- return (r < 56320 || r > 57343) && this._fail(`\\u${s} (high surrogate) not followed by a valid low surrogate (got \\u${n})`, i, a), String.fromCodePoint(65536 + (c - 55296) * 1024 + (r - 56320));
933
- }
934
- return c >= 56320 && c <= 57343 && this._fail(`lone low surrogate \\u${s} is not valid`, i, a), o(c), String.fromCharCode(c);
935
- }
936
- _readRawStringContent() {
937
- let e = this.line, t = this.col, n = 0;
938
- for (; !this._eof() && this._ch() === "`";) this._advance(), n++;
939
- !this._eof() && this._ch() === "\r" && this._advance(), !this._eof() && this._ch() === "\n" && this._advance();
940
- let r = this.input.length, i = "";
941
- for (; !this._eof();) {
942
- let a = this.pos, o = 0, s = -1;
943
- for (; a < r;) {
944
- let e = this.input.charCodeAt(a);
945
- if (e === 96 || e === 127) break;
946
- if (e < 32) {
947
- if (e !== 10) break;
948
- o++, s = a;
949
- }
950
- a++;
951
- }
952
- if (a > this.pos) {
953
- i += this.input.slice(this.pos, a), o > 0 ? (this.line += o, this.col = a - s) : this.col += a - this.pos, this.pos = a;
954
- continue;
955
- }
956
- let c = this._ch();
957
- if (c === "\r") {
958
- this._advance();
959
- continue;
960
- }
961
- if (c === "`") {
962
- let r = 0;
963
- for (; !this._eof() && this._ch() === "`";) this._advance(), r++;
964
- if (r >= n) return i += "`".repeat(r - n), i === "" && this._fail("raw string must not be empty (§2.5.3)", e, t), i;
965
- i += "`".repeat(r);
966
- } else {
967
- let e = c.codePointAt(0);
968
- e < 32 && e !== 10 && e !== 13 && this._fail(`raw string content must not contain control character U+${e.toString(16).toUpperCase().padStart(4, "0")} (§2.5.3)`, this.line, this.col), e === 127 && this._fail("raw string content must not contain DEL (U+007F) (§2.5.3)", this.line, this.col), i += this._advance();
969
- }
970
- }
971
- this._fail("unterminated raw string literal", e, t);
972
- }
973
- _processRawHexContent(e, t, n) {
974
- let r = "", i = !1, a = 0;
975
- for (; a < e.length;) {
976
- let o = e[a];
977
- if (o === "\n" || o === " " || o === "\r") {
978
- a++;
979
- continue;
980
- }
981
- if (o === " ") throw SyntaxError(`EDN parse error at line ${t}, column ${n}: horizontal tab (HT) is not allowed inside h\`\` raw byte string literals (§5.3.3)`);
982
- let s = this._skipRawComment(e, a, "h`` raw byte string", t, n);
983
- if (s !== -1) {
984
- a = s;
985
- continue;
986
- }
987
- if (o === "." && e[a + 1] === "." && e[a + 2] === ".") {
988
- for (a += 3; a < e.length && e[a] === ".";) a++;
989
- r += "...", i = !0;
990
- continue;
991
- }
992
- if (D(e.charCodeAt(a))) {
993
- let t = a;
994
- for (; a < e.length && D(e.charCodeAt(a));) a++;
995
- r += e.slice(t, a);
996
- continue;
997
- }
998
- throw SyntaxError(`EDN parse error at line ${t}, column ${n}: unexpected character ${JSON.stringify(o)} in h\`\` raw byte string`);
999
- }
1000
- return {
1001
- value: r,
1002
- elided: i
1003
- };
1004
- }
1005
- _processRawB64Content(e, t, n) {
1006
- let r = "", i = 0;
1007
- for (; i < e.length;) {
1008
- let a = e[i];
1009
- if (a === "\n" || a === " " || a === "\r") {
1010
- i++;
1011
- continue;
1012
- }
1013
- if (a === " ") throw SyntaxError(`EDN parse error at line ${t}, column ${n}: horizontal tab (HT) is not allowed inside b64\`\` raw byte string literals (§5.3.4)`);
1014
- if (a === "#") {
1015
- for (; i < e.length && e[i] !== "\n";) i++;
1016
- continue;
1017
- }
1018
- let o = i;
1019
- for (; i < e.length;) {
1020
- let t = e[i];
1021
- if (t === "\n" || t === " " || t === "\r" || t === " " || t === "#") break;
1022
- i++;
1023
- }
1024
- r += e.slice(o, i);
1025
- }
1026
- return r;
590
+ return e?.stripTags ? t : u.set(t, this.tag);
1027
591
  }
1028
- _readByteContent(e) {
1029
- this._advance();
1030
- let t = "";
1031
- for (; !this._eof() && this._ch() !== e;) {
1032
- let n = this._ch();
1033
- if (n === "\n" || n === " ") {
1034
- this._advance();
1035
- continue;
1036
- }
1037
- if (n === "\r") {
1038
- this._advance();
1039
- continue;
1040
- }
1041
- if (n === " " && this._fail("horizontal tab (HT) is not allowed inside byte string literals (§5.2.2)", this.line, this.col), n === "#") {
1042
- for (; !this._eof() && this._ch() !== "\n";) {
1043
- if (this._ch() === "\\") {
1044
- this._advance(), !this._eof() && this._ch() !== "\n" && this._advance();
1045
- continue;
1046
- }
1047
- if (this._ch() === e) break;
1048
- this._advance();
1049
- }
1050
- continue;
1051
- }
1052
- let r = this.pos, i = this.pos, a = this.input.length;
1053
- for (; i < a;) {
1054
- let t = this.input[i];
1055
- if (t === e || t === "\n" || t === " " || t === "\r" || t === " " || t === "#") break;
1056
- i++;
1057
- }
1058
- this.col += i - r, this.pos = i, t += this.input.slice(r, i);
1059
- }
1060
- return this._eof() && this._fail("unterminated byte string literal"), this._advance(), t;
1061
- }
1062
- _readHexByteContentElisionAware(e) {
1063
- this._advance();
1064
- let t = "", n = !1;
1065
- for (; !this._eof() && this._ch() !== e;) {
1066
- let r = this._ch();
1067
- if (r === "\n" || r === " " || r === "\r") {
1068
- this._advance();
1069
- continue;
1070
- }
1071
- if (r === " " && this._fail("horizontal tab (HT) is not allowed inside hex byte string literals (§5.2.1)", this.line, this.col), !this._skipByteStringComment(e)) {
1072
- if (r === "." && (this.input[this.pos + 1] ?? "") === "." && (this.input[this.pos + 2] ?? "") === ".") {
1073
- for (this._advance(), this._advance(), this._advance(); !this._eof() && this._ch() === ".";) this._advance();
1074
- t.endsWith("...") || (t += "..."), n = !0;
1075
- continue;
1076
- }
1077
- if (D(r.charCodeAt(0))) {
1078
- let e = this.pos, n = this.pos, r = this.input.length;
1079
- for (; n < r && D(this.input.charCodeAt(n));) n++;
1080
- this.col += n - e, this.pos = n, t += this.input.slice(e, n);
1081
- continue;
1082
- }
1083
- this._fail(`unexpected character ${JSON.stringify(r)} in hex byte string`);
1084
- }
1085
- }
1086
- return this._eof() && this._fail("unterminated hex byte string literal"), this._advance(), {
1087
- value: t,
1088
- elided: n
1089
- };
1090
- }
1091
- _readNext() {
1092
- this._skipWS();
1093
- let e = this.pos;
1094
- return {
1095
- ...this._readNextCore(),
1096
- raw: this.input.slice(e, this.pos),
1097
- offset: e,
1098
- endOffset: this.pos
1099
- };
1100
- }
1101
- _readNextCore() {
1102
- let e = this.line, t = this.col;
1103
- if (this._eof()) return {
1104
- type: "EOF",
1105
- value: "",
1106
- line: e,
1107
- col: t
1108
- };
1109
- let n = this._ch();
1110
- switch (n) {
1111
- case "[": return this._advance(), {
1112
- type: "LBRACKET",
1113
- value: "[",
1114
- line: e,
1115
- col: t
1116
- };
1117
- case "]": return this._advance(), {
1118
- type: "RBRACKET",
1119
- value: "]",
1120
- line: e,
1121
- col: t
1122
- };
1123
- case "{": return this._advance(), {
1124
- type: "LBRACE",
1125
- value: "{",
1126
- line: e,
1127
- col: t
1128
- };
1129
- case "}": return this._advance(), {
1130
- type: "RBRACE",
1131
- value: "}",
1132
- line: e,
1133
- col: t
1134
- };
1135
- case "(": return this._advance(), {
1136
- type: "LPAREN",
1137
- value: "(",
1138
- line: e,
1139
- col: t
1140
- };
1141
- case ")": return this._advance(), {
1142
- type: "RPAREN",
1143
- value: ")",
1144
- line: e,
1145
- col: t
1146
- };
1147
- case ":": return this._advance(), {
1148
- type: "COLON",
1149
- value: ":",
1150
- line: e,
1151
- col: t
1152
- };
1153
- case ",": return this._advance(), {
1154
- type: "COMMA",
1155
- value: ",",
1156
- line: e,
1157
- col: t
1158
- };
1159
- case "<":
1160
- if ((this.input[this.pos + 1] ?? "") === "<") return this._advance(), this._advance(), {
1161
- type: "LT_LT",
1162
- value: "<<",
1163
- line: e,
1164
- col: t
1165
- };
1166
- this._fail("unexpected character '<'", e, t);
1167
- case ">":
1168
- if ((this.input[this.pos + 1] ?? "") === ">") return this._advance(), this._advance(), {
1169
- type: "GT_GT",
1170
- value: ">>",
1171
- line: e,
1172
- col: t
1173
- };
1174
- this._fail("unexpected character '>'", e, t);
1175
- case "+": {
1176
- let n = this._readSignedInfinity("+", e, t);
1177
- if (n !== null) return n;
1178
- let r = this.input[this.pos + 1] ?? "";
1179
- return r >= "0" && r <= "9" || r === "." ? (this._advance(), this._readNumber(e, t)) : (this._advance(), {
1180
- type: "PLUS",
1181
- value: "+",
1182
- line: e,
1183
- col: t
1184
- });
1185
- }
1186
- case "`": return {
1187
- type: "RAWSTRING",
1188
- value: this._readRawStringContent(),
1189
- line: e,
1190
- col: t
1191
- };
1192
- case "\"": {
1193
- let n = this._readStringContent("\"");
1194
- return n === "" && this._ch() === "_" ? (this._advance(), {
1195
- type: "EMPTY_INDEF_TEXT",
1196
- value: "",
1197
- line: e,
1198
- col: t
1199
- }) : {
1200
- type: "TSTR",
1201
- value: n,
1202
- line: e,
1203
- col: t
1204
- };
1205
- }
1206
- case "'": {
1207
- if ((this.input[this.pos + 1] ?? "") === "'" && (this.input[this.pos + 2] ?? "") === "_") return this._advance(), this._advance(), this._advance(), {
1208
- type: "EMPTY_INDEF_BYTES",
1209
- value: "",
1210
- line: e,
1211
- col: t
1212
- };
1213
- let n = this._readStringContent("'"), r = Ie.encode(n);
1214
- return {
1215
- type: "SQSTR",
1216
- value: Array.from(r, (e) => e.toString(16).padStart(2, "0")).join(""),
1217
- line: e,
1218
- col: t
1219
- };
1220
- }
1221
- }
1222
- if (n === "-") {
1223
- let n = this._readSignedInfinity("-", e, t);
1224
- return n === null ? this._readNumber(e, t) : n;
1225
- }
1226
- if (n >= "0" && n <= "9" || n === "." && /[0-9]/.test(this.input[this.pos + 1] ?? "")) return this._readNumber(e, t);
1227
- if (/[a-zA-Z_]/.test(n)) return this._readIdent(e, t);
1228
- if (n === ".") {
1229
- if ((this.input[this.pos + 1] ?? "") === "." && (this.input[this.pos + 2] ?? "") === ".") {
1230
- for (this._advance(), this._advance(), this._advance(); !this._eof() && this._ch() === ".";) this._advance();
1231
- return {
1232
- type: "ELLIPSIS",
1233
- value: "...",
1234
- line: e,
1235
- col: t
1236
- };
1237
- }
1238
- this._fail("unexpected character '.'", e, t);
1239
- }
1240
- this._fail(`unexpected character ${JSON.stringify(n)}`, e, t);
1241
- }
1242
- _readSignedInfinity(e, t, n) {
1243
- if (!this.input.startsWith("Infinity", this.pos + 1)) return null;
1244
- let r = this.input[this.pos + 9] ?? "", i = r === "_" && /[0-7i]/.test(this.input[this.pos + 10] ?? "") && !/[a-zA-Z0-9_]/.test(this.input[this.pos + 11] ?? "");
1245
- if (/[a-zA-Z0-9_]/.test(r) && !i) return null;
1246
- this._advance();
1247
- for (let e = 0; e < 8; e++) this._advance();
1248
- let a = e === "-" ? "-Infinity" : "Infinity";
1249
- return i && (a += this._advance() + this._advance()), {
1250
- type: "FLOAT",
1251
- value: a,
1252
- line: t,
1253
- col: n
1254
- };
1255
- }
1256
- _skipHexDigits() {
1257
- let e = this.pos, t = this.input.length;
1258
- for (; e < t && D(this.input.charCodeAt(e));) e++;
1259
- this.col += e - this.pos, this.pos = e;
1260
- }
1261
- _skipDecimalDigits() {
1262
- let e = this.pos, t = this.input.length;
1263
- for (; e < t;) {
1264
- let t = this.input.charCodeAt(e);
1265
- if (t < 48 || t > 57) break;
1266
- e++;
1267
- }
1268
- this.col += e - this.pos, this.pos = e;
1269
- }
1270
- _tryConsumeEncodingSuffix() {
1271
- if (this._ch() !== "_") return;
1272
- let e = this.input[this.pos + 1] ?? "", t = this.input[this.pos + 2] ?? "";
1273
- (e >= "0" && e <= "7" || e === "i") && !/[0-9a-zA-Z_]/.test(t) && (this._advance(), this._advance());
1274
- }
1275
- _readNumber(e, t) {
1276
- let n = this.pos, r = () => this.input.slice(n, this.pos);
1277
- if (this._ch() === "-" && this._advance(), this._ch() === "0") {
1278
- let n = this.input[this.pos + 1] ?? "";
1279
- if (n === "x" || n === "X") {
1280
- this._advance(), this._advance();
1281
- let n = this.pos;
1282
- this._skipHexDigits();
1283
- let i = this.pos > n, a = !1, o = !1;
1284
- if (!this._eof() && this._ch() === ".") {
1285
- a = !0, this._advance();
1286
- let e = this.pos;
1287
- this._skipHexDigits(), o = this.pos > e;
1288
- }
1289
- if (!this._eof() && (this._ch() === "p" || this._ch() === "P")) {
1290
- a = !0, !i && !o && this._fail(`hex float has no mantissa digits: ${r()}`, e, t), this._advance(), !this._eof() && (this._ch() === "+" || this._ch() === "-") && this._advance();
1291
- let n = this.pos;
1292
- this._skipDecimalDigits(), this.pos === n && this._fail(`hex float missing exponent digits: ${r()}`, e, t);
1293
- } else a && this._fail(`hex float missing 'p' exponent: ${r()}`, e, t);
1294
- return a ? (this._tryConsumeEncodingSuffix(), {
1295
- type: "FLOAT",
1296
- value: r(),
1297
- line: e,
1298
- col: t
1299
- }) : {
1300
- type: "INTEGER",
1301
- value: r(),
1302
- line: e,
1303
- col: t
1304
- };
1305
- }
1306
- if (n === "o" || n === "O") {
1307
- for (this._advance(), this._advance(); !this._eof() && this._ch() >= "0" && this._ch() <= "7";) this._advance();
1308
- return {
1309
- type: "INTEGER",
1310
- value: r(),
1311
- line: e,
1312
- col: t
1313
- };
1314
- }
1315
- if (n === "b" || n === "B") {
1316
- for (this._advance(), this._advance(); !this._eof() && (this._ch() === "0" || this._ch() === "1");) this._advance();
1317
- return {
1318
- type: "INTEGER",
1319
- value: r(),
1320
- line: e,
1321
- col: t
1322
- };
1323
- }
1324
- }
1325
- this._skipDecimalDigits();
1326
- let i = !1;
1327
- if (!this._eof() && this._ch() === "." && (i = !0, this._advance(), this._skipDecimalDigits()), !this._eof() && (this._ch() === "e" || this._ch() === "E")) {
1328
- i = !0, this._advance(), !this._eof() && (this._ch() === "+" || this._ch() === "-") && this._advance();
1329
- let n = this.pos;
1330
- this._skipDecimalDigits(), this.pos === n && this._fail(`float exponent has no digits: ${JSON.stringify(r())}`, e, t);
1331
- }
1332
- return this._tryConsumeEncodingSuffix(), {
1333
- type: i ? "FLOAT" : "INTEGER",
1334
- value: r(),
1335
- line: e,
1336
- col: t
1337
- };
1338
- }
1339
- _readIdent(e, t) {
1340
- let n = this.pos;
1341
- {
1342
- let e = this.pos, t = this.input.length;
1343
- for (; e < t;) {
1344
- let t = this.input.charCodeAt(e);
1345
- if (!(t >= 97 && t <= 122 || t >= 65 && t <= 90 || t >= 48 && t <= 57 || t === 95)) break;
1346
- e++;
1347
- }
1348
- this.col += e - this.pos, this.pos = e;
1349
- }
1350
- let r = this.input.slice(n, this.pos);
1351
- switch (r) {
1352
- case "true": return {
1353
- type: "TRUE",
1354
- value: r,
1355
- line: e,
1356
- col: t
1357
- };
1358
- case "false": return {
1359
- type: "FALSE",
1360
- value: r,
1361
- line: e,
1362
- col: t
1363
- };
1364
- case "null": return {
1365
- type: "NULL",
1366
- value: r,
1367
- line: e,
1368
- col: t
1369
- };
1370
- case "undefined": return {
1371
- type: "UNDEFINED",
1372
- value: r,
1373
- line: e,
1374
- col: t
1375
- };
1376
- case "NaN":
1377
- case "NaN_0":
1378
- case "NaN_1":
1379
- case "NaN_2":
1380
- case "NaN_3":
1381
- case "NaN_4":
1382
- case "NaN_5":
1383
- case "NaN_6":
1384
- case "NaN_7":
1385
- case "NaN_i":
1386
- case "Infinity":
1387
- case "Infinity_0":
1388
- case "Infinity_1":
1389
- case "Infinity_2":
1390
- case "Infinity_3":
1391
- case "Infinity_4":
1392
- case "Infinity_5":
1393
- case "Infinity_6":
1394
- case "Infinity_7":
1395
- case "Infinity_i": return {
1396
- type: "FLOAT",
1397
- value: r,
1398
- line: e,
1399
- col: t
1400
- };
1401
- case "simple": return {
1402
- type: "SIMPLE",
1403
- value: r,
1404
- line: e,
1405
- col: t
1406
- };
1407
- case "_": return {
1408
- type: "UNDERSCORE",
1409
- value: "_",
1410
- line: e,
1411
- col: t
1412
- };
1413
- case "_0": return {
1414
- type: "ENCODING_INDICATOR",
1415
- value: "0",
1416
- line: e,
1417
- col: t
1418
- };
1419
- case "_1": return {
1420
- type: "ENCODING_INDICATOR",
1421
- value: "1",
1422
- line: e,
1423
- col: t
1424
- };
1425
- case "_2": return {
1426
- type: "ENCODING_INDICATOR",
1427
- value: "2",
1428
- line: e,
1429
- col: t
1430
- };
1431
- case "_3": return {
1432
- type: "ENCODING_INDICATOR",
1433
- value: "3",
1434
- line: e,
1435
- col: t
1436
- };
1437
- case "_4": return {
1438
- type: "ENCODING_INDICATOR",
1439
- value: "4",
1440
- line: e,
1441
- col: t
1442
- };
1443
- case "_5": return {
1444
- type: "ENCODING_INDICATOR",
1445
- value: "5",
1446
- line: e,
1447
- col: t
1448
- };
1449
- case "_6": return {
1450
- type: "ENCODING_INDICATOR",
1451
- value: "6",
1452
- line: e,
1453
- col: t
1454
- };
1455
- case "_7": return {
1456
- type: "ENCODING_INDICATOR",
1457
- value: "7",
1458
- line: e,
1459
- col: t
1460
- };
1461
- case "_i": return {
1462
- type: "ENCODING_INDICATOR",
1463
- value: "i",
1464
- line: e,
1465
- col: t
1466
- };
1467
- }
1468
- let i = r[0] ?? "", a = i >= "a" && i <= "z";
1469
- if (a || i >= "A" && i <= "Z") {
1470
- let n = r.slice(1);
1471
- if (a ? /^[a-z0-9]*$/.test(n) : /^[A-Z0-9]*$/.test(n)) {
1472
- let n = this.pos;
1473
- for (; !this._eof();) {
1474
- let e = this._ch();
1475
- if (!(a ? e >= "a" && e <= "z" || e >= "0" && e <= "9" || e === "-" : e >= "A" && e <= "Z" || e >= "0" && e <= "9" || e === "-")) break;
1476
- this.pos++;
1477
- }
1478
- this.pos > n && (this.col += this.pos - n, r += this.input.slice(n, this.pos));
1479
- let i = this._ch();
1480
- if (i === "\"" && this._fail(`"${r}" prefix requires single quotes or backticks, not double quotes`, e, t), i === "'") switch (r) {
1481
- case "h": {
1482
- let { value: n, elided: r } = this._readHexByteContentElisionAware(i);
1483
- return {
1484
- type: r ? "BYTES_HEX_ELIDED" : "BYTES_HEX",
1485
- value: n,
1486
- line: e,
1487
- col: t
1488
- };
1489
- }
1490
- case "b64": return {
1491
- type: "BYTES_B64",
1492
- value: this._readByteContent(i),
1493
- line: e,
1494
- col: t
1495
- };
1496
- default: return {
1497
- type: "APP_STRING",
1498
- appPrefix: r,
1499
- value: this._readStringContent(i),
1500
- line: e,
1501
- col: t
1502
- };
1503
- }
1504
- if (i === "`") {
1505
- let n = this._readRawStringContent();
1506
- switch (r) {
1507
- case "h": {
1508
- let { value: r, elided: i } = this._processRawHexContent(n, e, t);
1509
- return {
1510
- type: i ? "BYTES_HEX_ELIDED" : "BYTES_HEX",
1511
- value: r,
1512
- line: e,
1513
- col: t
1514
- };
1515
- }
1516
- case "b64": return {
1517
- type: "BYTES_B64",
1518
- value: this._processRawB64Content(n, e, t),
1519
- line: e,
1520
- col: t
1521
- };
1522
- default: return {
1523
- type: "APP_STRING",
1524
- appPrefix: r,
1525
- value: n,
1526
- line: e,
1527
- col: t
1528
- };
1529
- }
1530
- }
1531
- if (i === "<" && (this.input[this.pos + 1] ?? "") === "<") return this._advance(), this._advance(), {
1532
- type: "APP_SEQUENCE",
1533
- appPrefix: r,
1534
- value: "",
1535
- line: e,
1536
- col: t
1537
- };
1538
- }
1539
- }
1540
- this._fail(`unknown identifier ${JSON.stringify(r)}`, e, t);
1541
- }
1542
- }, O = class extends S {
592
+ }, O = class extends C {
1543
593
  indefiniteLength = !1;
1544
594
  value;
1545
595
  ednEncoding;
@@ -1555,12 +605,12 @@ var Ie = new TextEncoder(), Le = class {
1555
605
  let n = this.encodingWidth === void 0 ? "" : `_${this.encodingWidth}`;
1556
606
  if (e?.preserveByteString && this.ednSource !== void 0) return this.ednSource + n;
1557
607
  let r = e?.bstrEncoding ?? this.ednEncoding;
1558
- return e?.appStrings === !1 && r !== "hex" && (r = "hex"), de(this.value, r, e?.sqstr) + n;
608
+ return e?.appStrings === !1 && r !== "hex" && (r = "hex"), ve(this.value, r, e?.sqstr) + n;
1559
609
  }
1560
610
  _toJS(e) {
1561
611
  return this.value;
1562
612
  }
1563
- }, k = class extends S {
613
+ }, k = class extends C {
1564
614
  indefiniteLength = !0;
1565
615
  chunks;
1566
616
  constructor(e) {
@@ -1592,7 +642,7 @@ var Ie = new TextEncoder(), Le = class {
1592
642
  for (let e of this.chunks) n.set(e.value, r), r += e.value.length;
1593
643
  return n;
1594
644
  }
1595
- }, A = class extends S {
645
+ }, A = class extends C {
1596
646
  indefiniteLength = !0;
1597
647
  chunks;
1598
648
  constructor(e) {
@@ -1622,7 +672,7 @@ var Ie = new TextEncoder(), Le = class {
1622
672
  _toJS(e) {
1623
673
  return this.chunks.map((e) => e.value).join("");
1624
674
  }
1625
- }, j = class extends S {
675
+ }, j = class extends C {
1626
676
  items;
1627
677
  indefiniteLength;
1628
678
  encodingWidth;
@@ -1640,21 +690,21 @@ var Ie = new TextEncoder(), Le = class {
1640
690
  for (let n of this.items) n._encode(e, t);
1641
691
  }
1642
692
  _toCDN(e, t) {
1643
- let n = d(e), r = e?.preserveComments, i = typeof r == "string" ? r : void 0, a = r && (ee(this) || this.items.some(p));
693
+ let n = h(e), r = e?.preserveComments, i = typeof r == "string" ? r : void 0, a = r && (oe(this) || this.items.some(ae));
1644
694
  n === null && a && (n = " ");
1645
- let { inlineSep: o, multilineSep: s, trailSep: c } = re(e, n === null), l = !this.indefiniteLength && this.encodingWidth !== void 0 ? `_${this.encodingWidth} ` : "";
695
+ let { inlineSep: o, multilineSep: s, trailSep: c } = ue(e, n === null), l = !this.indefiniteLength && this.encodingWidth !== void 0 ? `_${this.encodingWidth} ` : "";
1646
696
  if (n === null || this.items.length === 0 && !a) {
1647
697
  let n = this.items.map((n) => n._toCDN(e, t + 1)).join(o);
1648
698
  return this.indefiniteLength ? this.items.length === 0 ? "[_ ]" : `[_ ${n}]` : `[${l}${n}]`;
1649
699
  }
1650
- let u = f(n, t + 1), m = f(n, t), ie = this.indefiniteLength ? "[_ " : `[${l}`, g = [];
700
+ let u = g(n, t + 1), d = g(n, t), f = this.indefiniteLength ? "[_ " : `[${l}`, p = [];
1651
701
  for (let n = 0; n < this.items.length; n++) {
1652
702
  let a = this.items[n];
1653
- r && g.push(...te(a, u, i));
703
+ r && p.push(...se(a, u, i));
1654
704
  let o = n < this.items.length - 1 ? s : c;
1655
- g.push(`${u}${a._toCDN(e, t + 1)}${o}${r ? h(a, i) : ""}`);
705
+ p.push(`${u}${a._toCDN(e, t + 1)}${o}${r ? ce(a, i) : ""}`);
1656
706
  }
1657
- return r && g.push(...ne(this, u, i)), `${ie}\n${g.join("\n")}\n${m}]`;
707
+ return r && p.push(...le(this, u, i)), `${f}\n${p.join("\n")}\n${d}]`;
1658
708
  }
1659
709
  _toHexDump(e, t) {
1660
710
  let n = (e) => e.toString(16).toUpperCase().padStart(2, "0"), r = (e) => Array.from(e, (e) => e.toString(16).toUpperCase().padStart(2, "0")).join(" ");
@@ -1673,7 +723,7 @@ var Ie = new TextEncoder(), Le = class {
1673
723
  }
1674
724
  let i = [{
1675
725
  depth: e,
1676
- hex: r(De(4, BigInt(this.items.length), this.encodingWidth)),
726
+ hex: r(S(4, BigInt(this.items.length), this.encodingWidth)),
1677
727
  comment: `Array of length ${this.items.length}`
1678
728
  }];
1679
729
  for (let n of this.items) i.push(...n._toHexDump(e + 1, t));
@@ -1688,11 +738,11 @@ var Ie = new TextEncoder(), Le = class {
1688
738
  } : void 0, r = this.items.map((e) => e._toJS(n)), i = 0;
1689
739
  for (let n = 0; n < this.items.length; n++) {
1690
740
  let a = n - i, o = this.items[n]._toJS(e), s = t.call(r, String(n), o);
1691
- s === l || e?.undefinedOmits && s === void 0 ? (r.splice(a, 1), i++) : r[a] = s;
741
+ s === d || e?.undefinedOmits && s === void 0 ? (r.splice(a, 1), i++) : r[a] = s;
1692
742
  }
1693
743
  return r;
1694
744
  }
1695
- }, M = class extends S {
745
+ }, M = class extends C {
1696
746
  entries;
1697
747
  indefiniteLength;
1698
748
  encodingWidth;
@@ -1710,25 +760,25 @@ var Ie = new TextEncoder(), Le = class {
1710
760
  for (let [n, r] of this.entries) n._encode(e, t), r._encode(e, t);
1711
761
  }
1712
762
  _toCDN(e, t) {
1713
- let n = d(e), r = e?.preserveComments, i = typeof r == "string" ? r : void 0, a = r && (ee(this) || this.entries.some(([e, t]) => p(e) || p(t)));
763
+ let n = h(e), r = e?.preserveComments, i = typeof r == "string" ? r : void 0, a = r && (oe(this) || this.entries.some(([e, t]) => ae(e) || ae(t)));
1714
764
  n === null && a && (n = " ");
1715
- let { inlineSep: o, multilineSep: s, trailSep: c, colSep: l } = re(e, n === null), u = !this.indefiniteLength && this.encodingWidth !== void 0 ? `_${this.encodingWidth} ` : "", m = this.indefiniteLength ? "{_ " : `{${u}`;
765
+ let { inlineSep: o, multilineSep: s, trailSep: c, colSep: l } = ue(e, n === null), u = !this.indefiniteLength && this.encodingWidth !== void 0 ? `_${this.encodingWidth} ` : "", d = this.indefiniteLength ? "{_ " : `{${u}`;
1716
766
  if (n === null || this.entries.length === 0 && !a) {
1717
767
  let n = this.entries.map(([n, r]) => `${n._toCDN(e, t + 1)}${l}${r._toCDN(e, t + 1)}`).join(o);
1718
768
  return this.indefiniteLength ? this.entries.length === 0 ? "{_ }" : `{_ ${n}}` : `{${u}${n}}`;
1719
769
  }
1720
- let h = f(n, t + 1), ie = f(n, t), g = [];
770
+ let f = g(n, t + 1), p = g(n, t), m = [];
1721
771
  for (let n = 0; n < this.entries.length; n++) {
1722
772
  let [a, o] = this.entries[n];
1723
- r && g.push(...te(a, h, i));
1724
- let u = n < this.entries.length - 1 ? s : c, d = r ? Re([
773
+ r && m.push(...se(a, f, i));
774
+ let u = n < this.entries.length - 1 ? s : c, d = r ? He([
1725
775
  ...a.comments?.trailing ?? [],
1726
776
  ...o.comments?.leading ?? [],
1727
777
  ...o.comments?.trailing ?? []
1728
778
  ], i) : "";
1729
- g.push(`${h}${a._toCDN(e, t + 1)}${l}${o._toCDN(e, t + 1)}${u}${d}`);
779
+ m.push(`${f}${a._toCDN(e, t + 1)}${l}${o._toCDN(e, t + 1)}${u}${d}`);
1730
780
  }
1731
- return r && g.push(...ne(this, h, i)), `${m}\n${g.join("\n")}\n${ie}}`;
781
+ return r && m.push(...le(this, f, i)), `${d}\n${m.join("\n")}\n${p}}`;
1732
782
  }
1733
783
  _toHexDump(e, t) {
1734
784
  let n = (e) => e.toString(16).toUpperCase().padStart(2, "0"), r = (e) => Array.from(e, (e) => e.toString(16).toUpperCase().padStart(2, "0")).join(" ");
@@ -1747,7 +797,7 @@ var Ie = new TextEncoder(), Le = class {
1747
797
  }
1748
798
  let i = [{
1749
799
  depth: e,
1750
- hex: r(De(5, BigInt(this.entries.length), this.encodingWidth)),
800
+ hex: r(S(5, BigInt(this.entries.length), this.encodingWidth)),
1751
801
  comment: `Map of length ${this.entries.length}`
1752
802
  }];
1753
803
  for (let [n, r] of this.entries) i.push(...n._toHexDump(e + 1, t)), i.push(...r._toHexDump(e + 1, t));
@@ -1760,17 +810,17 @@ var Ie = new TextEncoder(), Le = class {
1760
810
  let r = e?.undefinedOmits;
1761
811
  for (let e = 0; e < n.length; e++) {
1762
812
  let [i, a] = n[e], o = t.call(n, i, a);
1763
- o === l || r && o === void 0 ? n.splice(e--, 1) : n[e] = [i, o];
813
+ o === d || r && o === void 0 ? n.splice(e--, 1) : n[e] = [i, o];
1764
814
  }
1765
815
  return n;
1766
816
  };
1767
- return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof B) ? (() => {
817
+ return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof z) ? (() => {
1768
818
  let n = e ? {
1769
819
  ...e,
1770
820
  reviver: void 0
1771
821
  } : void 0, r = {};
1772
822
  for (let [e, t] of this.entries) {
1773
- let i = e instanceof B ? e.value : e.toCDN(), a = t._toJS(n);
823
+ let i = e instanceof z ? e.value : e.toCDN(), a = t._toJS(n);
1774
824
  i === "__proto__" ? Object.defineProperty(r, i, {
1775
825
  value: a,
1776
826
  writable: !0,
@@ -1782,29 +832,29 @@ var Ie = new TextEncoder(), Le = class {
1782
832
  let i = /* @__PURE__ */ new Map();
1783
833
  for (let e = 0; e < this.entries.length; e++) {
1784
834
  let [t] = this.entries[e];
1785
- i.set(t instanceof B ? t.value : t.toCDN(), e);
835
+ i.set(t instanceof z ? t.value : t.toCDN(), e);
1786
836
  }
1787
837
  for (let n = 0; n < this.entries.length; n++) {
1788
- let [a, o] = this.entries[n], s = a instanceof B ? a.value : a.toCDN();
838
+ let [a, o] = this.entries[n], s = a instanceof z ? a.value : a.toCDN();
1789
839
  if (i.get(s) !== n) continue;
1790
- let c = o._toJS(e), u = t.call(r, s, c);
1791
- u === l || e?.undefinedOmits && u === void 0 ? delete r[s] : s === "__proto__" ? Object.defineProperty(r, s, {
1792
- value: u,
840
+ let c = o._toJS(e), l = t.call(r, s, c);
841
+ l === d || e?.undefinedOmits && l === void 0 ? delete r[s] : s === "__proto__" ? Object.defineProperty(r, s, {
842
+ value: l,
1793
843
  writable: !0,
1794
844
  enumerable: !0,
1795
845
  configurable: !0
1796
- }) : r[s] = u;
846
+ }) : r[s] = l;
1797
847
  }
1798
848
  return r;
1799
849
  })() : n();
1800
850
  }
1801
851
  };
1802
- function Re(e, t) {
1803
- return e.length === 0 ? "" : " " + e.map((e) => m(e, t).trimEnd()).join(" ");
852
+ function He(e, t) {
853
+ return e.length === 0 ? "" : " " + e.map((e) => _(e, t).trimEnd()).join(" ");
1804
854
  }
1805
855
  //#endregion
1806
856
  //#region src/ast/CborSimple.ts
1807
- var N = class e extends S {
857
+ var N = class e extends C {
1808
858
  value;
1809
859
  constructor(e) {
1810
860
  if (super(), !Number.isInteger(e) || e < 0 || e > 255) throw RangeError("CborSimple value must be an integer in 0–255");
@@ -1836,10 +886,10 @@ var N = class e extends S {
1836
886
  case 21: return !0;
1837
887
  case 22: return null;
1838
888
  case 23: return;
1839
- default: return new u(this.value);
889
+ default: return new f(this.value);
1840
890
  }
1841
891
  }
1842
- }, P = class extends S {
892
+ }, P = class extends C {
1843
893
  items;
1844
894
  constructor(e) {
1845
895
  super(), this.items = e;
@@ -1855,15 +905,15 @@ var N = class e extends S {
1855
905
  }
1856
906
  _toCDN(e, t) {
1857
907
  if (this.items.length === 0) return "<<>>";
1858
- let n = d(e), { inlineSep: r, multilineSep: i, trailSep: a } = re(e, n === null);
908
+ let n = h(e), { inlineSep: r, multilineSep: i, trailSep: a } = ue(e, n === null);
1859
909
  if (n === null) return `<<${this.items.map((n) => n._toCDN(e, t + 1)).join(r)}>>`;
1860
- let o = f(n, t + 1), s = f(n, t), c = this.items.map((n) => `${o}${n._toCDN(e, t + 1)}`), l = c.length - 1;
910
+ let o = g(n, t + 1), s = g(n, t), c = this.items.map((n) => `${o}${n._toCDN(e, t + 1)}`), l = c.length - 1;
1861
911
  return `<<\n${c.map((e, t) => t < l ? `${e}${i}` : `${e}${a}`).join("\n")}\n${s}>>`;
1862
912
  }
1863
913
  _toHexDump(e, t) {
1864
914
  let n = (e) => Array.from(e, (e) => e.toString(16).toUpperCase().padStart(2, "0")).join(" "), r = this._content().length, i = [{
1865
915
  depth: e,
1866
- hex: n(De(2, BigInt(r))),
916
+ hex: n(S(2, BigInt(r))),
1867
917
  comment: `Embedded CBOR sequence, ${r} byte${r === 1 ? "" : "s"}`
1868
918
  }];
1869
919
  for (let n of this.items) i.push(...n._toHexDump(e + 1, t));
@@ -1872,17 +922,17 @@ var N = class e extends S {
1872
922
  _toJS(e) {
1873
923
  return this._content();
1874
924
  }
1875
- }, ze = 999n, F = class extends E {
925
+ }, Ue = 999n, F = class extends D {
1876
926
  constructor(e, t) {
1877
- let n = t.length === 1 && t[0] instanceof B ? t[0] : new j(t);
1878
- super(ze, new j([new B(e), n]));
927
+ let n = t.length === 1 && t[0] instanceof z ? t[0] : new j(t);
928
+ super(Ue, new j([new z(e), n]));
1879
929
  }
1880
930
  _toCDN(e, t) {
1881
931
  if (e?.appStrings === !1) return super._toCDN(e, t);
1882
932
  let n = this.content, r = n.items[0].value, i = n.items[1];
1883
- return i instanceof B ? `${r}${_e(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
933
+ return i instanceof z ? `${r}${we(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
1884
934
  }
1885
- }, Be = class extends S {
935
+ }, We = class extends C {
1886
936
  inner;
1887
937
  ednSource;
1888
938
  constructor(e, t) {
@@ -1897,15 +947,15 @@ var N = class e extends S {
1897
947
  _toJS(e) {
1898
948
  return this.inner._toJS(e);
1899
949
  }
1900
- }, Ve = 888n, I = class extends E {
950
+ }, Ge = 888n, I = class extends D {
1901
951
  constructor(e) {
1902
- e === void 0 ? super(Ve, N.NULL) : super(Ve, new j(e));
952
+ e === void 0 ? super(Ge, N.NULL) : super(Ge, new j(e));
1903
953
  }
1904
954
  _toCDN(e, t) {
1905
955
  return this.content instanceof N ? "..." : this.content instanceof j ? this.content.items.map((n) => n._toCDN(e, t)).join(" + ") : super._toCDN(e, t);
1906
956
  }
1907
- }, He = 2n, Ue = 3n, We = 18446744073709551615n, Ge = -18446744073709551616n;
1908
- function Ke(e) {
957
+ }, Ke = 2n, qe = 3n, Je = 18446744073709551615n, Ye = -18446744073709551616n;
958
+ function Xe(e) {
1909
959
  if (e < 0n) throw RangeError("bigintToBytes requires a non-negative value");
1910
960
  if (e === 0n) return new Uint8Array();
1911
961
  let t = e.toString(16);
@@ -1914,16 +964,16 @@ function Ke(e) {
1914
964
  for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
1915
965
  return n;
1916
966
  }
1917
- function qe(e) {
967
+ function Ze(e) {
1918
968
  let t = 0n;
1919
969
  for (let n of e) t = t << 8n | BigInt(n);
1920
970
  return t;
1921
971
  }
1922
- var L = class extends E {
972
+ var Qe = class extends D {
1923
973
  bigValue;
1924
974
  constructor(e) {
1925
- if (e <= We) throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);
1926
- super(He, new O(Ke(e))), this.bigValue = e;
975
+ if (e <= Je) throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);
976
+ super(Ke, new O(Xe(e))), this.bigValue = e;
1927
977
  }
1928
978
  _toCDN(e, t) {
1929
979
  return this.bigValue.toString();
@@ -1931,11 +981,11 @@ var L = class extends E {
1931
981
  _toJS(e) {
1932
982
  return this.bigValue;
1933
983
  }
1934
- }, R = class extends E {
984
+ }, L = class extends D {
1935
985
  bigValue;
1936
986
  constructor(e) {
1937
- if (e >= Ge) throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);
1938
- super(Ue, new O(Ke(-1n - e))), this.bigValue = e;
987
+ if (e >= Ye) throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);
988
+ super(qe, new O(Xe(-1n - e))), this.bigValue = e;
1939
989
  }
1940
990
  _toCDN(e, t) {
1941
991
  return this.bigValue.toString();
@@ -1943,22 +993,22 @@ var L = class extends E {
1943
993
  _toJS(e) {
1944
994
  return this.bigValue;
1945
995
  }
1946
- }, Je = new TextEncoder(), Ye = new TextDecoder("utf-8", { fatal: !0 }), Xe = new TextDecoder("utf-8", { fatal: !1 });
1947
- function Ze(e, t) {
1948
- let n = new Le(e, { offset: t?.offset }), r = new lt(n, t ?? {}).parse();
1949
- return t?.preserveComments && rt(r, n.comments, e), r;
996
+ }, $e = new TextEncoder(), et = new TextDecoder("utf-8", { fatal: !0 }), tt = new TextDecoder("utf-8", { fatal: !1 });
997
+ function nt(e, n) {
998
+ let r = new t(e, { offset: n?.offset }), i = new pt(r, n ?? {}).parse();
999
+ return n?.preserveComments && st(i, r.comments, e), i;
1950
1000
  }
1951
- function Qe(e) {
1001
+ function rt(e) {
1952
1002
  let t = e, n;
1953
1003
  return /[_][0-7i]$/.test(e) && (n = e[e.length - 1], t = e.slice(0, -2)), {
1954
1004
  numStr: t,
1955
1005
  rawSuffix: n
1956
1006
  };
1957
1007
  }
1958
- function $e(e) {
1008
+ function it(e) {
1959
1009
  return e.startsWith("-") ? -BigInt(e.slice(1)) : BigInt(e);
1960
1010
  }
1961
- function et(e, t) {
1011
+ function at(e, t) {
1962
1012
  if (e.endsWith("_i") || e.endsWith("_0")) {
1963
1013
  let n = "_0 and _i encoding indicators are not valid for floating-point values";
1964
1014
  if (t) t(n), e = e.slice(0, -2);
@@ -1982,21 +1032,14 @@ function et(e, t) {
1982
1032
  };
1983
1033
  let n = e, r;
1984
1034
  return e.endsWith("_1") ? (r = "half", n = e.slice(0, -2)) : e.endsWith("_2") ? (r = "single", n = e.slice(0, -2)) : e.endsWith("_3") && (r = "double", n = e.slice(0, -2)), /^-?0[xX]/.test(n) ? {
1985
- value: Ne(n),
1035
+ value: Be(n),
1986
1036
  precision: r
1987
1037
  } : {
1988
1038
  value: parseFloat(n),
1989
1039
  precision: r
1990
1040
  };
1991
1041
  }
1992
- function tt(e) {
1993
- if (typeof Uint8Array.fromHex == "function") return Uint8Array.fromHex(e);
1994
- if (e.length % 2 != 0) throw SyntaxError(`hex string has odd length: ${e.length}`);
1995
- let t = new Uint8Array(e.length / 2);
1996
- for (let n = 0; n < e.length; n += 2) t[n / 2] = parseInt(e.slice(n, n + 2), 16);
1997
- return t;
1998
- }
1999
- function nt(e, t) {
1042
+ function ot(e, t) {
2000
1043
  let n = e.indexOf("="), r = n >= 0 ? e.slice(0, n) : e, i = n >= 0 ? e.slice(n) : "";
2001
1044
  if (/[^A-Za-z0-9+/\-_]/.test(r)) {
2002
1045
  let e = [...r].find((e) => !/[A-Za-z0-9+/\-_]/.test(e)) ?? "";
@@ -2033,24 +1076,24 @@ function nt(e, t) {
2033
1076
  for (let e = 0; e < c.length; e++) l[e] = c.charCodeAt(e);
2034
1077
  return l;
2035
1078
  }
2036
- function rt(e, t, n) {
1079
+ function st(e, t, n) {
2037
1080
  if (t.length === 0) return;
2038
- let r = it(e), i = ot(n);
1081
+ let r = ct(e), i = ut(n);
2039
1082
  for (let a of t) {
2040
1083
  let t = { ...a }, o = [...r].filter((e) => e.end <= a.start).sort((e, t) => t.end - e.end || t.start - e.start)[0], s = o ? n.slice(o.end, a.start) : "";
2041
1084
  if (o && i(o.end) === a.line && !s.includes(":")) {
2042
- at(o.node, "trailing", t);
1085
+ lt(o.node, "trailing", t);
2043
1086
  continue;
2044
1087
  }
2045
1088
  let c = [...r].filter((e) => e.start < a.start && a.end < e.end).sort((e, t) => t.start - e.start || e.end - t.end)[0], l = [...r].filter((e) => e.start >= a.end).sort((e, t) => e.start - t.start || t.end - e.end)[0];
2046
1089
  if ((!c || l && l.end <= c.end) && l) {
2047
- at(l.node, "leading", t);
1090
+ lt(l.node, "leading", t);
2048
1091
  continue;
2049
1092
  }
2050
- at(c?.node ?? e, "dangling", t);
1093
+ lt(c?.node ?? e, "dangling", t);
2051
1094
  }
2052
1095
  }
2053
- function it(e) {
1096
+ function ct(e) {
2054
1097
  let t = [], n = (e) => {
2055
1098
  if (e.start !== void 0 && e.end !== void 0 && t.push({
2056
1099
  node: e,
@@ -2068,14 +1111,14 @@ function it(e) {
2068
1111
  for (let t of e.chunks) n(t);
2069
1112
  return;
2070
1113
  }
2071
- e instanceof E && n(e.content);
1114
+ e instanceof D && n(e.content);
2072
1115
  };
2073
1116
  return n(e), t;
2074
1117
  }
2075
- function at(e, t, n) {
1118
+ function lt(e, t, n) {
2076
1119
  e.comments ??= {}, e.comments[t] ??= [], e.comments[t].push(n);
2077
1120
  }
2078
- function ot(e) {
1121
+ function ut(e) {
2079
1122
  let t = [0];
2080
1123
  for (let n = 0; n < e.length; n++) e[n] === "\n" && t.push(n + 1);
2081
1124
  return (n) => {
@@ -2089,15 +1132,15 @@ function ot(e) {
2089
1132
  return a + 1;
2090
1133
  };
2091
1134
  }
2092
- var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, st = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, ct = new Map([
2093
- ["b32", z("b32")],
2094
- ["h32", z("h32")],
2095
- ["float", z("float")],
2096
- ["same", z("same")],
2097
- ["hash", st("hash", "@cbortech/hash-extension")],
2098
- ["uuid", st("uuid", "@cbortech/uuid-extension")],
2099
- ["UUID", st("uuid", "@cbortech/uuid-extension")]
2100
- ]), lt = class {
1135
+ var R = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, dt = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, ft = new Map([
1136
+ ["b32", R("b32")],
1137
+ ["h32", R("h32")],
1138
+ ["float", R("float")],
1139
+ ["same", R("same")],
1140
+ ["hash", dt("hash", "@cbortech/hash-extension")],
1141
+ ["uuid", dt("uuid", "@cbortech/uuid-extension")],
1142
+ ["UUID", dt("uuid", "@cbortech/uuid-extension")]
1143
+ ]), pt = class {
2101
1144
  t;
2102
1145
  _options;
2103
1146
  extByPrefix;
@@ -2105,20 +1148,24 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2105
1148
  unresolvedExtension;
2106
1149
  _pendingWarnings = [];
2107
1150
  _hintedPrefixes = /* @__PURE__ */ new Set();
2108
- constructor(e, t) {
2109
- this.t = e, this._options = t, this.extByPrefix = /* @__PURE__ */ new Map(), this.extByTag = /* @__PURE__ */ new Map(), this.unresolvedExtension = t.unresolvedExtension ?? "cpa999";
2110
- for (let e of [...Z, ...t.extensions ?? []]) {
1151
+ constructor(t, n) {
1152
+ this.t = t, this._options = n, this.extByPrefix = /* @__PURE__ */ new Map(), this.extByTag = /* @__PURE__ */ new Map(), this.unresolvedExtension = n.unresolvedExtension ?? "cpa999";
1153
+ for (let e of [...Z, ...n.extensions ?? []]) {
2111
1154
  for (let t of e.appStringPrefixes ?? []) this.extByPrefix.set(t, e);
2112
1155
  for (let t of e.tagNumbers ?? []) this.extByTag.set(t, e);
2113
1156
  }
2114
- this.t.onEscapeWarning = (e, t, n, r) => {
2115
- let i = {
2116
- message: e,
2117
- offset: t,
2118
- line: n,
2119
- column: r
1157
+ this.t.onEscapeWarning = (t, n, r, i) => {
1158
+ let a = {
1159
+ message: t,
1160
+ offset: n,
1161
+ line: r,
1162
+ column: i
2120
1163
  };
2121
- if (this._pendingWarnings.push(i), this._options.onWarning ? this._options.onWarning(i) : this._options.silent || console.warn(`CDN strict violation at line ${n}, column ${r}: ${e}`), this._options.strict !== !1) throw SyntaxError(`EDN parse error at line ${n}, column ${r}: ${e}`);
1164
+ if (this._pendingWarnings.push(a), this._options.onWarning ? this._options.onWarning(a) : this._options.silent || console.warn(`CDN strict violation at line ${r}, column ${i}: ${t}`), this._options.strict !== !1) throw new e(t, {
1165
+ offset: n,
1166
+ line: r,
1167
+ column: i
1168
+ });
2122
1169
  };
2123
1170
  }
2124
1171
  parse() {
@@ -2148,10 +1195,10 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2148
1195
  case "BYTES_B64": return this.t.consume(), this._parseBytesConcat(this._decodeBytesToken(e), e.type, e.raw);
2149
1196
  case "EMPTY_INDEF_BYTES": return this.t.consume(), new k([]);
2150
1197
  case "EMPTY_INDEF_TEXT": return this.t.consume(), new A([]);
2151
- case "TRUE": return this.t.consume(), N.TRUE;
2152
- case "FALSE": return this.t.consume(), N.FALSE;
2153
- case "NULL": return this.t.consume(), N.NULL;
2154
- case "UNDEFINED": return this.t.consume(), N.UNDEFINED;
1198
+ case "TRUE": return this.t.consume(), new N(21);
1199
+ case "FALSE": return this.t.consume(), new N(20);
1200
+ case "NULL": return this.t.consume(), new N(22);
1201
+ case "UNDEFINED": return this.t.consume(), new N(23);
2155
1202
  case "SIMPLE": return this.parseSimple();
2156
1203
  case "LBRACKET": return this.parseArray();
2157
1204
  case "LBRACE": return this.parseMap();
@@ -2161,7 +1208,7 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2161
1208
  this.t.consume();
2162
1209
  let t = this.extByPrefix.get(e.appPrefix);
2163
1210
  if (!t?.parseAppString) {
2164
- if (t || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new F(e.appPrefix, [new B(e.value)]);
1211
+ if (t || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new F(e.appPrefix, [new z(e.value)]);
2165
1212
  this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
2166
1213
  }
2167
1214
  {
@@ -2172,10 +1219,10 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2172
1219
  ednEncoding: n.ednEncoding,
2173
1220
  encodingWidth: n.encodingWidth,
2174
1221
  ednSource: e.raw
2175
- }) : (n instanceof T && n.ednSource === void 0 && (n.ednSource = e.raw), n);
1222
+ }) : (n instanceof E && n.ednSource === void 0 && (n.ednSource = e.raw), n);
2176
1223
  } catch (t) {
2177
1224
  if (this._options.strict !== !1) throw t;
2178
- return this._pendingWarnings.length === n && this._warn(t instanceof Error ? t.message : String(t), e), new F(e.appPrefix, [new B(e.value)]);
1225
+ return this._pendingWarnings.length === n && this._warn(t instanceof Error ? t.message : String(t), e), new F(e.appPrefix, [new z(e.value)]);
2179
1226
  }
2180
1227
  }
2181
1228
  }
@@ -2194,8 +1241,8 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2194
1241
  let r = this._pendingWarnings.length;
2195
1242
  try {
2196
1243
  let r = n.parseAppSequence(e.appPrefix, t, this._extOnError(e)), i = this.t.source.slice(e.offset, this.t.lastEndOffset);
2197
- if (r instanceof T) r.ednSource === void 0 && (r.ednSource = i);
2198
- else if (n.preserveAppSeqSource) return new Be(r, i);
1244
+ if (r instanceof E) r.ednSource === void 0 && (r.ednSource = i);
1245
+ else if (n.preserveAppSeqSource) return new We(r, i);
2199
1246
  return r;
2200
1247
  } catch (n) {
2201
1248
  if (this._options.strict !== !1) throw n;
@@ -2214,16 +1261,16 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2214
1261
  }
2215
1262
  }
2216
1263
  parseIntegerOrTag() {
2217
- let e = this.t.consume(), { numStr: t, rawSuffix: n } = Qe(e.value), r = n === void 0 ? this.consumeEncodingIndicator() : this._resolveEncodingWidth(n, e), i = $e(t);
2218
- if (i > 18446744073709551615n) return this.t.peek().type === "LPAREN" && this._fail("tag number exceeds maximum uint64", e), new L(i);
2219
- if (i < -18446744073709551616n) return new R(i);
1264
+ let e = this.t.consume(), { numStr: t, rawSuffix: n } = rt(e.value), r = n === void 0 ? this.consumeEncodingIndicator() : this._resolveEncodingWidth(n, e), i = it(t);
1265
+ if (i > 18446744073709551615n) return this.t.peek().type === "LPAREN" && this._fail("tag number exceeds maximum uint64", e), new Qe(i);
1266
+ if (i < -18446744073709551616n) return new L(i);
2220
1267
  if (r !== void 0) {
2221
1268
  let t = i >= 0n ? i : -(i + 1n);
2222
1269
  r = this._validateEncodingFit(t, r, e);
2223
1270
  }
2224
- let a = i >= 0n ? new C(i, r === void 0 ? void 0 : { encodingWidth: r }) : new w(i, r === void 0 ? void 0 : { encodingWidth: r });
1271
+ let a = i >= 0n ? new w(i, r === void 0 ? void 0 : { encodingWidth: r }) : new T(i, r === void 0 ? void 0 : { encodingWidth: r });
2225
1272
  if (this.t.peek().type === "LPAREN") {
2226
- a instanceof C || this._fail("tag number must be non-negative", e), this.t.consume();
1273
+ a instanceof w || this._fail("tag number must be non-negative", e), this.t.consume();
2227
1274
  let t = this._pendingWarnings.splice(0), n = this.parseValue();
2228
1275
  this.expect("RPAREN");
2229
1276
  let i = a.value, o = this.extByTag.get(i);
@@ -2231,24 +1278,24 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2231
1278
  let e = o.parseTag(i, n);
2232
1279
  if (e !== void 0) return t.length > 0 && (e.warnings ??= [], e.warnings.push(...t)), e;
2233
1280
  }
2234
- let s = new E(i, n, r === void 0 ? void 0 : { encodingWidth: r });
1281
+ let s = new D(i, n, r === void 0 ? void 0 : { encodingWidth: r });
2235
1282
  return t.length > 0 && (s.warnings ??= [], s.warnings.push(...t)), s;
2236
1283
  }
2237
1284
  return a;
2238
1285
  }
2239
1286
  parseFloat() {
2240
- let e = this.t.consume(), t = (t) => this._warnOrFail(t, e), { value: n, precision: r } = et(e.value, t);
1287
+ let e = this.t.consume(), t = (t) => this._warnOrFail(t, e), { value: n, precision: r } = at(e.value, t);
2241
1288
  if (r === "half" || r === "single") {
2242
- let e = r === "half" ? _(Ce(n)) : Math.fround(n);
1289
+ let e = r === "half" ? je(Ae(n)) : Math.fround(n);
2243
1290
  Object.is(n, e) || isNaN(n) && isNaN(e) || t(`${n} cannot be exactly represented as ${r === "half" ? "f16 (_1)" : "f32 (_2)"}; use _3 or remove the indicator`);
2244
1291
  }
2245
- return new T(n, r === void 0 ? void 0 : { precision: r });
1292
+ return new E(n, r === void 0 ? void 0 : { precision: r });
2246
1293
  }
2247
1294
  parseString() {
2248
1295
  let e = this.t.consume();
2249
1296
  if (this.t.peek().type !== "PLUS") {
2250
- let t = this.consumeEncodingIndicator(() => BigInt(Je.encode(e.value).length));
2251
- return new B(e.value, t === void 0 ? void 0 : { encodingWidth: t });
1297
+ let t = this.consumeEncodingIndicator(() => BigInt($e.encode(e.value).length));
1298
+ return new z(e.value, t === void 0 ? void 0 : { encodingWidth: t });
2252
1299
  }
2253
1300
  let t = !1, n = [{ text: e.value }];
2254
1301
  for (; this.t.peek().type === "PLUS";) {
@@ -2257,31 +1304,36 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2257
1304
  e.type === "ELLIPSIS" ? (this.t.consume(), n.push({ ellipsis: !0 }), t = !0) : e.type === "TSTR" || e.type === "RAWSTRING" ? (this.t.consume(), n.push({ text: e.value })) : this._isBytesToken(e.type) ? (this.t.consume(), n.push({ text: this._decodeUtf8(this._decodeBytesToken(e), e) })) : this._fail(`expected string or byte string after +, got ${JSON.stringify(e.value)}`, e);
2258
1305
  }
2259
1306
  if (!t) {
2260
- let e = n.map((e) => "text" in e ? e.text : "").join(""), t = this.consumeEncodingIndicator(() => BigInt(Je.encode(e).length));
2261
- return new B(e, t === void 0 ? void 0 : { encodingWidth: t });
1307
+ let e = n.map((e) => "text" in e ? e.text : "").join(""), t = this.consumeEncodingIndicator(() => BigInt($e.encode(e).length));
1308
+ return new z(e, t === void 0 ? void 0 : { encodingWidth: t });
2262
1309
  }
2263
1310
  let r = [], i = "";
2264
- for (let e of n) "ellipsis" in e ? (i !== "" && (r.push(new B(i)), i = ""), r.push(new I())) : i += e.text;
2265
- return i !== "" && r.push(new B(i)), new I(r);
1311
+ for (let e of n) "ellipsis" in e ? (i !== "" && (r.push(new z(i)), i = ""), r.push(new I())) : i += e.text;
1312
+ return i !== "" && r.push(new z(i)), new I(r);
2266
1313
  }
2267
1314
  _isBytesToken(e) {
2268
1315
  return e === "BYTES_HEX" || e === "SQSTR" || e === "BYTES_B64";
2269
1316
  }
2270
- _decodeBytesToken(e) {
2271
- let t = (t) => this._warnOrFail(t, e);
2272
- switch (e.type) {
1317
+ _decodeBytesToken(t) {
1318
+ let n = (e) => this._warnOrFail(e, t);
1319
+ switch (t.type) {
2273
1320
  case "BYTES_HEX":
2274
- case "SQSTR": return tt(e.value);
2275
- case "BYTES_B64": return nt(e.value, t);
2276
- default: this._fail("expected byte string token", e);
1321
+ case "SQSTR": return ie(t.value);
1322
+ case "BYTES_B64": try {
1323
+ return ot(t.value, n);
1324
+ } catch (n) {
1325
+ if (n instanceof e || !(n instanceof SyntaxError)) throw n;
1326
+ this._fail(n.message, t);
1327
+ }
1328
+ default: this._fail("expected byte string token", t);
2277
1329
  }
2278
1330
  }
2279
1331
  _decodeUtf8(e, t) {
2280
- if (this._options.allowInvalidUtf8) return Xe.decode(e);
1332
+ if (this._options.allowInvalidUtf8) return tt.decode(e);
2281
1333
  try {
2282
- return Ye.decode(e);
1334
+ return et.decode(e);
2283
1335
  } catch {
2284
- return this._warnOrFail("byte string in text concatenation is not valid UTF-8", t), Xe.decode(e);
1336
+ return this._warnOrFail("byte string in text concatenation is not valid UTF-8", t), tt.decode(e);
2285
1337
  }
2286
1338
  }
2287
1339
  _tokenTypeToCdnEncoding(e) {
@@ -2305,7 +1357,7 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2305
1357
  this.t.consume();
2306
1358
  let t = this._buildBytesElidedItems(e.value);
2307
1359
  for (let e of t) e instanceof I ? (i.push({ ellipsis: !0 }), r = !0) : e instanceof O && i.push({ bytes: e.value });
2308
- } else this._isBytesToken(e.type) ? (this.t.consume(), i.push({ bytes: this._decodeBytesToken(e) })) : e.type === "TSTR" || e.type === "RAWSTRING" ? (this.t.consume(), this._warnOrFail("text string in a byte-string concatenation is not allowed; use a byte string literal (h'...', b64'...', or '...') instead", e), i.push({ bytes: Je.encode(e.value) })) : this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`, e);
1360
+ } else this._isBytesToken(e.type) ? (this.t.consume(), i.push({ bytes: this._decodeBytesToken(e) })) : e.type === "TSTR" || e.type === "RAWSTRING" ? (this.t.consume(), this._warnOrFail("text string in a byte-string concatenation is not allowed; use a byte string literal (h'...', b64'...', or '...') instead", e), i.push({ bytes: $e.encode(e.value) })) : this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`, e);
2309
1361
  }
2310
1362
  if (!r) {
2311
1363
  let e = i.map((e) => "bytes" in e ? e.bytes : new Uint8Array()), t = this._concatBytes(e), n = this.consumeEncodingIndicator(() => BigInt(t.length));
@@ -2337,7 +1389,7 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2337
1389
  }
2338
1390
  _buildBytesElidedItems(e) {
2339
1391
  let t = e.split("..."), n = [];
2340
- for (let e = 0; e < t.length; e++) e > 0 && n.push(new I()), t[e].length > 0 && n.push(new O(tt(t[e])));
1392
+ for (let e = 0; e < t.length; e++) e > 0 && n.push(new I()), t[e].length > 0 && n.push(new O(ie(t[e])));
2341
1393
  return n;
2342
1394
  }
2343
1395
  _mergeFirstBytesItem(e, t) {
@@ -2354,7 +1406,7 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2354
1406
  this.t.consume(), this.expect("LPAREN");
2355
1407
  let e = this.t.peek();
2356
1408
  e.type !== "INTEGER" && this._fail(`expected integer inside simple(), got ${JSON.stringify(e.value)}`, e), this.t.consume();
2357
- let { numStr: t } = Qe(e.value), n = Number($e(t));
1409
+ let { numStr: t } = rt(e.value), n = Number(it(t));
2358
1410
  return this.expect("RPAREN"), new N(n);
2359
1411
  }
2360
1412
  parseEmbeddedCBOR() {
@@ -2414,9 +1466,9 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2414
1466
  }));
2415
1467
  return t.length > 0 && (e.warnings = t), e;
2416
1468
  }
2417
- if (r instanceof B) {
1469
+ if (r instanceof z) {
2418
1470
  let e = new A(n.map((e, t) => {
2419
- if (e instanceof B) return e;
1471
+ if (e instanceof z) return e;
2420
1472
  this._fail(`indefinite text string chunk ${t} must be a text string, not a byte string`);
2421
1473
  }));
2422
1474
  return t.length > 0 && (e.warnings = t), e;
@@ -2434,7 +1486,7 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2434
1486
  return t.type !== e && this._fail(`expected ${e}, got ${t.type} (${JSON.stringify(t.value)})`, t), t;
2435
1487
  }
2436
1488
  _validateEncodingFit(e, t, n) {
2437
- let r = Ee(t);
1489
+ let r = Pe(t);
2438
1490
  if (e <= r) return t;
2439
1491
  let i = `value ${e} does not fit in encoding indicator ${t === "i" ? "_i (max 23)" : `_${t} (max ${r})`}`;
2440
1492
  this._warnOrFail(i, n);
@@ -2458,7 +1510,7 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2458
1510
  this._warn(e, t), this._options.strict !== !1 && this._fail(e, t);
2459
1511
  }
2460
1512
  _hintMissingExtension(e, t) {
2461
- let n = ct.get(e);
1513
+ let n = ft.get(e);
2462
1514
  if (n === void 0 || this._hintedPrefixes.has(e)) return;
2463
1515
  this._hintedPrefixes.add(e);
2464
1516
  let r = `app-string prefix '${e}' requires an extension that is not enabled; ${n}`;
@@ -2477,11 +1529,15 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2477
1529
  console.warn(`CDN strict violation${n}: ${e}`);
2478
1530
  }
2479
1531
  }
2480
- _fail(e, t) {
2481
- let n = t ? ` at line ${t.line}, column ${t.col}` : "";
2482
- throw SyntaxError(`EDN parse error${n}: ${e}`);
1532
+ _fail(t, n) {
1533
+ throw new e(t, n ? {
1534
+ offset: n.offset,
1535
+ line: n.line,
1536
+ column: n.col,
1537
+ endOffset: n.endOffset
1538
+ } : void 0);
2483
1539
  }
2484
- }, ut = new TextEncoder(), dt = !1, B = class extends S {
1540
+ }, mt = new TextEncoder(), ht = !1, z = class extends C {
2485
1541
  indefiniteLength = !1;
2486
1542
  value;
2487
1543
  encodingWidth;
@@ -2489,42 +1545,42 @@ var z = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exten
2489
1545
  super(), this.value = e, this.encodingWidth = t?.encodingWidth;
2490
1546
  }
2491
1547
  _encodeTo(e, t) {
2492
- let n = ut.encode(this.value);
1548
+ let n = mt.encode(this.value);
2493
1549
  x(e, 3, n.length, this.encodingWidth), e.writeBytes(n);
2494
1550
  }
2495
1551
  _toCDN(e, t) {
2496
1552
  let n = this.encodingWidth === void 0 ? "" : `_${this.encodingWidth}`;
2497
- return ft(this.value, n, e, t);
1553
+ return gt(this.value, n, e, t);
2498
1554
  }
2499
1555
  _toJS(e) {
2500
1556
  return this.value;
2501
1557
  }
2502
1558
  };
2503
- function ft(e, t, n, r) {
2504
- let i = pt(n?.textStringFormat ?? []), a = d(n);
2505
- if (i.length === 0 || a === null) return ve(e) + t;
1559
+ function gt(e, t, n, r) {
1560
+ let i = _t(n?.textStringFormat ?? []), a = h(n);
1561
+ if (i.length === 0 || a === null) return Te(e) + t;
2506
1562
  let o = /* @__PURE__ */ new Map(), s = null;
2507
- if (i.includes("cdn") && (s = ht(e), s !== null)) for (let { point: e, contentDepth: t } of s) o.set(e, t);
1563
+ if (i.includes("cdn") && (s = yt(e), s !== null)) for (let { point: e, contentDepth: t } of s) o.set(e, t);
2508
1564
  if (i.includes("newline")) {
2509
- let t = s === null ? mt(e, 0) : gt(e);
1565
+ let t = s === null ? vt(e, 0) : bt(e);
2510
1566
  for (let { point: e, contentDepth: n } of t) o.has(e) || o.set(e, n);
2511
1567
  }
2512
- let c = Ct(e, o);
2513
- if (c.length <= 1) return ve(e) + t;
1568
+ let c = Dt(e, o);
1569
+ if (c.length <= 1) return Te(e) + t;
2514
1570
  let l = c.map(({ text: e }, n) => {
2515
- let r = ve(e);
1571
+ let r = Te(e);
2516
1572
  return n === c.length - 1 ? r + t : r;
2517
1573
  }), u = l[0];
2518
1574
  for (let e = 1; e < l.length; e++) {
2519
- let t = f(a, r + 1 + c[e].contentDepth);
1575
+ let t = g(a, r + 1 + c[e].contentDepth);
2520
1576
  u += ` +\n${t}${l[e]}`;
2521
1577
  }
2522
1578
  return u;
2523
1579
  }
2524
- function pt(e) {
2525
- return e.map((e) => e === "cboredn" ? (dt || (dt = !0, console.warn("`textStringFormat: ['cboredn']` is deprecated; use `textStringFormat: ['cdn']` instead.")), "cdn") : e);
1580
+ function _t(e) {
1581
+ return e.map((e) => e === "cboredn" ? (ht || (ht = !0, console.warn("`textStringFormat: ['cboredn']` is deprecated; use `textStringFormat: ['cdn']` instead.")), "cdn") : e);
2526
1582
  }
2527
- function mt(e, t) {
1583
+ function vt(e, t) {
2528
1584
  let n = [];
2529
1585
  for (let r = 0; r < e.length; r++) {
2530
1586
  let i = e[r];
@@ -2541,75 +1597,75 @@ function mt(e, t) {
2541
1597
  }
2542
1598
  return n;
2543
1599
  }
2544
- function ht(e) {
1600
+ function yt(e) {
2545
1601
  try {
2546
- Ze(e);
1602
+ nt(e);
2547
1603
  } catch {
2548
1604
  return null;
2549
1605
  }
2550
- let t = [], n = new Le(e), r = 0, i = null, a = !1, o = 0;
1606
+ let n = [], r = new t(e), i = 0, a = null, o = !1, s = 0;
2551
1607
  for (;;) {
2552
- let s = n.consume();
2553
- if (s.type === "EOF") break;
1608
+ let t = r.consume();
1609
+ if (t.type === "EOF") break;
2554
1610
  let c = !1;
2555
- if (a || (a = !0, s.offset > 0 && xt(n.comments, 0, s.offset) && t.push({
2556
- point: s.offset,
2557
- contentDepth: r
2558
- })), i !== null) {
2559
- if (i.kind === "opener" && vt.has(s.type)) {
2560
- i.point = s.endOffset, o = s.endOffset;
1611
+ if (o || (o = !0, t.offset > 0 && Tt(r.comments, 0, t.offset) && n.push({
1612
+ point: t.offset,
1613
+ contentDepth: i
1614
+ })), a !== null) {
1615
+ if (a.kind === "opener" && St.has(t.type)) {
1616
+ a.point = t.endOffset, s = t.endOffset;
2561
1617
  continue;
2562
- } else i.kind === "opener" && bt.has(s.type) && St(e, i.point, s.offset) ? c = !0 : t.push({
2563
- point: s.offset,
2564
- contentDepth: i.contentDepth
1618
+ } else a.kind === "opener" && wt.has(t.type) && Et(e, a.point, t.offset) ? c = !0 : n.push({
1619
+ point: t.offset,
1620
+ contentDepth: a.contentDepth
2565
1621
  });
2566
- i = null;
1622
+ a = null;
2567
1623
  }
2568
- yt.has(s.type) ? (r++, i = {
2569
- point: s.endOffset,
2570
- contentDepth: r,
1624
+ Ct.has(t.type) ? (i++, a = {
1625
+ point: t.endOffset,
1626
+ contentDepth: i,
2571
1627
  kind: "opener"
2572
- }) : bt.has(s.type) ? (r = Math.max(0, r - 1), c || t.push({
2573
- point: s.offset,
2574
- contentDepth: r
2575
- })) : s.type === "COMMA" && (i = {
2576
- point: s.endOffset,
2577
- contentDepth: r,
1628
+ }) : wt.has(t.type) ? (i = Math.max(0, i - 1), c || n.push({
1629
+ point: t.offset,
1630
+ contentDepth: i
1631
+ })) : t.type === "COMMA" && (a = {
1632
+ point: t.endOffset,
1633
+ contentDepth: i,
2578
1634
  kind: "comma"
2579
- }), o = s.endOffset;
1635
+ }), s = t.endOffset;
2580
1636
  }
2581
- let s = n.comments.find((e) => e.start >= o);
2582
- return s !== void 0 && t.push({
2583
- point: s.start,
2584
- contentDepth: r
2585
- }), t;
1637
+ let c = r.comments.find((e) => e.start >= s);
1638
+ return c !== void 0 && n.push({
1639
+ point: c.start,
1640
+ contentDepth: i
1641
+ }), n;
2586
1642
  }
2587
- function gt(e) {
2588
- let t = [], n = new Le(e), r = 0;
1643
+ function bt(e) {
1644
+ let n = [], r = new t(e), i = 0;
2589
1645
  for (;;) {
2590
- let i = n.consume();
2591
- if (i.type === "EOF") break;
2592
- if (yt.has(i.type)) r++;
2593
- else if (bt.has(i.type)) r = Math.max(0, r - 1);
2594
- else if (i.type !== "COMMA") {
2595
- if (i.type === "TSTR") {
2596
- let n = e.slice(i.offset, i.endOffset);
2597
- for (let e of _t(n)) t.push({
2598
- point: i.offset + e,
2599
- contentDepth: r + 1
1646
+ let t = r.consume();
1647
+ if (t.type === "EOF") break;
1648
+ if (Ct.has(t.type)) i++;
1649
+ else if (wt.has(t.type)) i = Math.max(0, i - 1);
1650
+ else if (t.type !== "COMMA") {
1651
+ if (t.type === "TSTR") {
1652
+ let r = e.slice(t.offset, t.endOffset);
1653
+ for (let e of xt(r)) n.push({
1654
+ point: t.offset + e,
1655
+ contentDepth: i + 1
2600
1656
  });
2601
- } else if (i.type === "RAWSTRING") {
2602
- let n = e.slice(i.offset, i.endOffset);
2603
- for (let { point: e } of mt(n, 0)) t.push({
2604
- point: i.offset + e,
2605
- contentDepth: r + 1
1657
+ } else if (t.type === "RAWSTRING") {
1658
+ let r = e.slice(t.offset, t.endOffset);
1659
+ for (let { point: e } of vt(r, 0)) n.push({
1660
+ point: t.offset + e,
1661
+ contentDepth: i + 1
2606
1662
  });
2607
1663
  }
2608
1664
  }
2609
1665
  }
2610
- return t;
1666
+ return n;
2611
1667
  }
2612
- function _t(e) {
1668
+ function xt(e) {
2613
1669
  let t = [], n = 1, r = e.length - 1;
2614
1670
  for (; n < r;) {
2615
1671
  let r = e[n];
@@ -2625,24 +1681,24 @@ function _t(e) {
2625
1681
  }
2626
1682
  return t;
2627
1683
  }
2628
- var vt = new Set(["ENCODING_INDICATOR", "UNDERSCORE"]), yt = new Set([
1684
+ var St = new Set(["ENCODING_INDICATOR", "UNDERSCORE"]), Ct = new Set([
2629
1685
  "LBRACKET",
2630
1686
  "LBRACE",
2631
1687
  "LPAREN",
2632
1688
  "LT_LT"
2633
- ]), bt = new Set([
1689
+ ]), wt = new Set([
2634
1690
  "RBRACKET",
2635
1691
  "RBRACE",
2636
1692
  "RPAREN",
2637
1693
  "GT_GT"
2638
1694
  ]);
2639
- function xt(e, t, n) {
1695
+ function Tt(e, t, n) {
2640
1696
  return e.some((e) => e.start >= t && e.end <= n);
2641
1697
  }
2642
- function St(e, t, n) {
1698
+ function Et(e, t, n) {
2643
1699
  return /^[\t\n\r ]*$/.test(e.slice(t, n));
2644
1700
  }
2645
- function Ct(e, t) {
1701
+ function Dt(e, t) {
2646
1702
  let n = [...t].filter(([t]) => t > 0 && t < e.length).sort(([e], [t]) => e - t);
2647
1703
  if (n.length === 0) return [{
2648
1704
  text: e,
@@ -2660,7 +1716,7 @@ function Ct(e, t) {
2660
1716
  }
2661
1717
  //#endregion
2662
1718
  //#region src/extensions/dt.ts
2663
- function V(e) {
1719
+ function B(e) {
2664
1720
  if (Number.isInteger(e)) return (/* @__PURE__ */ new Date(e * 1e3)).toISOString().replace(/\.000Z$/, "Z");
2665
1721
  let t = Math.round(e * 1e3);
2666
1722
  if (t / 1e3 === e) return new Date(t).toISOString().replace(/\.000Z$/, "Z");
@@ -2668,17 +1724,17 @@ function V(e) {
2668
1724
  for (; s.length < 3;) s += "0";
2669
1725
  return `${i}.${s}Z`;
2670
1726
  }
2671
- var wt = new TextDecoder("utf-8", { fatal: !0 });
2672
- function Tt(e) {
1727
+ var Ot = new TextDecoder("utf-8", { fatal: !0 });
1728
+ function kt(e) {
2673
1729
  if (e.length !== 1) throw SyntaxError("dt<<...>>: expected exactly one item");
2674
1730
  let t = e[0];
2675
- if (t instanceof B) return t.value;
2676
- if (t instanceof O) return wt.decode(t.value);
1731
+ if (t instanceof z) return t.value;
1732
+ if (t instanceof O) return Ot.decode(t.value);
2677
1733
  throw SyntaxError("dt<<...>>: expected a text string or byte string");
2678
1734
  }
2679
- var Et = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i;
2680
- function Dt(e, t) {
2681
- if (!Et.test(e)) {
1735
+ var At = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i;
1736
+ function jt(e, t) {
1737
+ if (!At.test(e)) {
2682
1738
  let n = `dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`;
2683
1739
  if (t) t(n);
2684
1740
  else throw SyntaxError(n);
@@ -2689,82 +1745,82 @@ function Dt(e, t) {
2689
1745
  if (isNaN(a)) throw SyntaxError(`dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`);
2690
1746
  if (i === void 0) {
2691
1747
  let e = a / 1e3;
2692
- return e >= 0 ? new kt(BigInt(e)) : new At(BigInt(e));
1748
+ return e >= 0 ? new Nt(BigInt(e)) : new Pt(BigInt(e));
2693
1749
  }
2694
- return new jt(a / 1e3 + i);
1750
+ return new Ft(a / 1e3 + i);
2695
1751
  }
2696
- var Ot = 1n, kt = class extends C {
1752
+ var Mt = 1n, Nt = class extends w {
2697
1753
  constructor(e, t) {
2698
1754
  super(e, t);
2699
1755
  }
2700
1756
  _toCDN(e, t) {
2701
- return e?.appStrings === !1 ? super._toCDN(e, t) : `dt'${V(Number(this.value))}'`;
1757
+ return e?.appStrings === !1 ? super._toCDN(e, t) : `dt'${B(Number(this.value))}'`;
2702
1758
  }
2703
- }, At = class extends w {
1759
+ }, Pt = class extends T {
2704
1760
  constructor(e, t) {
2705
1761
  super(e, t);
2706
1762
  }
2707
1763
  _toCDN(e, t) {
2708
- return e?.appStrings === !1 ? super._toCDN(e, t) : `dt'${V(Number(this.value))}'`;
1764
+ return e?.appStrings === !1 ? super._toCDN(e, t) : `dt'${B(Number(this.value))}'`;
2709
1765
  }
2710
- }, jt = class extends T {
1766
+ }, Ft = class extends E {
2711
1767
  constructor(e, t) {
2712
1768
  super(e, t);
2713
1769
  }
2714
1770
  _toCDN(e, t) {
2715
- return e?.appStrings === !1 ? super._toCDN(e, t) : `dt'${V(this.value)}'`;
1771
+ return e?.appStrings === !1 ? super._toCDN(e, t) : `dt'${B(this.value)}'`;
2716
1772
  }
2717
- }, Mt = class extends E {
1773
+ }, It = class extends D {
2718
1774
  constructor(e, t) {
2719
- super(Ot, Dt(e), t);
1775
+ super(Mt, jt(e), t);
2720
1776
  }
2721
1777
  _toCDN(e, t) {
2722
1778
  if (e?.appStrings === !1) return super._toCDN(e, t);
2723
1779
  let n = this.content;
2724
- return `DT'${V(n instanceof T ? n.value : Number(n.value))}'`;
1780
+ return `DT'${B(n instanceof E ? n.value : Number(n.value))}'`;
2725
1781
  }
2726
- }, Nt = class extends Mt {
1782
+ }, Lt = class extends It {
2727
1783
  constructor(e, t) {
2728
1784
  super(e, t);
2729
1785
  }
2730
1786
  _toJS(e) {
2731
- let t = this.content, n = t instanceof T ? t.value * 1e3 : Number(t.value) * 1e3;
1787
+ let t = this.content, n = t instanceof E ? t.value * 1e3 : Number(t.value) * 1e3;
2732
1788
  return new Date(n);
2733
1789
  }
2734
1790
  };
2735
- function Pt(e) {
1791
+ function Rt(e) {
2736
1792
  let t = e?.jsDate ?? !1;
2737
1793
  function n(e) {
2738
- return t ? new Nt(e) : new Mt(e);
1794
+ return t ? new Lt(e) : new It(e);
2739
1795
  }
2740
1796
  let r = {
2741
1797
  appStringPrefixes: ["dt", "DT"],
2742
- tagNumbers: [Ot],
1798
+ tagNumbers: [Mt],
2743
1799
  parseAppString(e, t, r) {
2744
- return e === "DT" ? n(t) : Dt(t, r);
1800
+ return e === "DT" ? n(t) : jt(t, r);
2745
1801
  },
2746
1802
  parseAppSequence(e, t, r) {
2747
- let i = Tt(t);
2748
- return e === "DT" ? n(i) : Dt(i, r);
1803
+ let i = kt(t);
1804
+ return e === "DT" ? n(i) : jt(i, r);
2749
1805
  },
2750
1806
  parseTag(e, t) {
2751
1807
  if (e !== 1n) return;
2752
1808
  let r;
2753
- if (t instanceof C) r = Number(t.value);
2754
- else if (t instanceof w) r = Number(t.value);
2755
- else if (t instanceof T) r = t.value;
1809
+ if (t instanceof w) r = Number(t.value);
1810
+ else if (t instanceof T) r = Number(t.value);
1811
+ else if (t instanceof E) r = t.value;
2756
1812
  else return;
2757
- return n(V(r));
1813
+ return n(B(r));
2758
1814
  }
2759
1815
  };
2760
1816
  return t && (r.fromJS = (e, t) => {
2761
- if (e instanceof Date) return new Nt(V(e.getTime() / 1e3));
1817
+ if (e instanceof Date) return new Lt(B(e.getTime() / 1e3));
2762
1818
  }, r.isJSType = (e) => e instanceof Date), r;
2763
1819
  }
2764
- var Ft = Pt(), It = Pt({ jsDate: !0 });
1820
+ var zt = Rt(), Bt = Rt({ jsDate: !0 });
2765
1821
  //#endregion
2766
1822
  //#region src/utils/ip.ts
2767
- function Lt(e) {
1823
+ function Vt(e) {
2768
1824
  let t = e.split(".");
2769
1825
  if (t.length !== 4) throw SyntaxError(`ip: invalid IPv4 address: ${JSON.stringify(e)}`);
2770
1826
  let n = new Uint8Array(4);
@@ -2777,11 +1833,11 @@ function Lt(e) {
2777
1833
  }
2778
1834
  return n;
2779
1835
  }
2780
- function Rt(e) {
1836
+ function Ht(e) {
2781
1837
  let t = new Uint8Array(16);
2782
1838
  if (e === "::") return t;
2783
1839
  let n = e, r = null, i = e.match(/^(.*):(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);
2784
- i && (n = i[1], n.endsWith(":") && (n += ":"), r = Lt(i[2]));
1840
+ i && (n = i[1], n.endsWith(":") && (n += ":"), r = Vt(i[2]));
2785
1841
  let a = n.split("::");
2786
1842
  if (a.length > 2) throw SyntaxError(`ip: invalid IPv6 address: ${JSON.stringify(e)}`);
2787
1843
  let o = a.length === 2, s = a[0] ? a[0].split(":") : [], c = o && a[1] ? a[1].split(":") : [], l = r ? 6 : 8;
@@ -2798,11 +1854,11 @@ function Rt(e) {
2798
1854
  }
2799
1855
  return r && t.set(r, 12), t;
2800
1856
  }
2801
- function zt(e) {
1857
+ function Ut(e) {
2802
1858
  return Array.from(e).join(".");
2803
1859
  }
2804
- function Bt(e) {
2805
- let t = e.slice(0, 10).every((e) => e === 0) && e[10] === 255 && e[11] === 255 ? zt(e.slice(12)) : null, n = t ? 6 : 8, r = [];
1860
+ function Wt(e) {
1861
+ let t = e.slice(0, 10).every((e) => e === 0) && e[10] === 255 && e[11] === 255 ? Ut(e.slice(12)) : null, n = t ? 6 : 8, r = [];
2806
1862
  for (let t = 0; t < n * 2; t += 2) r.push(e[t] << 8 | e[t + 1]);
2807
1863
  let i = -1, a = 0, o = 0;
2808
1864
  for (; o < n;) if (r[o] === 0) {
@@ -2816,29 +1872,29 @@ function Bt(e) {
2816
1872
  }
2817
1873
  //#endregion
2818
1874
  //#region src/extensions/ip.ts
2819
- var Vt = "ip", H = "IP", U = 52n, Ht = 54n, Ut = new TextDecoder("utf-8", { fatal: !0 });
2820
- function Wt(e) {
1875
+ var Gt = "ip", V = "IP", H = 52n, U = 54n, Kt = new TextDecoder("utf-8", { fatal: !0 });
1876
+ function qt(e) {
2821
1877
  if (e.length !== 1) throw SyntaxError("ip<<...>>: expected exactly one item");
2822
1878
  let t = e[0];
2823
- if (t instanceof B) return t.value;
2824
- if (t instanceof O) return Ut.decode(t.value);
1879
+ if (t instanceof z) return t.value;
1880
+ if (t instanceof O) return Kt.decode(t.value);
2825
1881
  throw SyntaxError("ip<<...>>: expected a text string or byte string");
2826
1882
  }
2827
- function Gt(e) {
1883
+ function Jt(e) {
2828
1884
  return /^\d/.test(e) && e.includes(".") && !e.includes(":") ? {
2829
- bytes: Lt(e),
1885
+ bytes: Vt(e),
2830
1886
  isV4: !0
2831
1887
  } : {
2832
- bytes: Rt(e),
1888
+ bytes: Ht(e),
2833
1889
  isV4: !1
2834
1890
  };
2835
1891
  }
2836
- function Kt(e) {
2837
- if (e.length === 4) return zt(e);
2838
- if (e.length === 16) return Bt(e);
1892
+ function Yt(e) {
1893
+ if (e.length === 4) return Ut(e);
1894
+ if (e.length === 16) return Wt(e);
2839
1895
  throw SyntaxError(`ip: unexpected byte length: ${e.length}`);
2840
1896
  }
2841
- function qt(e, t) {
1897
+ function Xt(e, t) {
2842
1898
  let n = new Uint8Array(e.length);
2843
1899
  n.set(e);
2844
1900
  let r = Math.floor(t / 8), i = t % 8;
@@ -2848,79 +1904,79 @@ function qt(e, t) {
2848
1904
  for (; a > 0 && n[a - 1] === 0;) a--;
2849
1905
  return n.slice(0, a);
2850
1906
  }
2851
- function Jt(e, t) {
1907
+ function Zt(e, t) {
2852
1908
  let n = new Uint8Array(t);
2853
1909
  return n.set(e), n;
2854
1910
  }
2855
- var Yt = class extends O {
1911
+ var Qt = class extends O {
2856
1912
  _toCDN(e, t) {
2857
- return e?.appStrings === !1 ? super._toCDN(e, t) : `${Vt}'${Kt(this.value)}'`;
1913
+ return e?.appStrings === !1 ? super._toCDN(e, t) : `${Gt}'${Yt(this.value)}'`;
2858
1914
  }
2859
- }, Xt = class extends j {
1915
+ }, $t = class extends j {
2860
1916
  _isV4;
2861
1917
  constructor(e, t, n) {
2862
- super([new C(BigInt(e)), new O(t)]), this._isV4 = n;
1918
+ super([new w(BigInt(e)), new O(t)]), this._isV4 = n;
2863
1919
  }
2864
1920
  _toCDN(e, t) {
2865
1921
  if (e?.appStrings === !1) return super._toCDN(e, t);
2866
1922
  let n = Number(this.items[0].value), r = this.items[1].value;
2867
- return `${Vt}'${Kt(Jt(r, this._isV4 ? 4 : 16))}/${n}'`;
1923
+ return `${Gt}'${Yt(Zt(r, this._isV4 ? 4 : 16))}/${n}'`;
2868
1924
  }
2869
- }, Zt = class extends E {
1925
+ }, en = class extends D {
2870
1926
  constructor(e, t) {
2871
1927
  super(e, t);
2872
1928
  }
2873
1929
  _toCDN(e, t) {
2874
1930
  if (e?.appStrings === !1) return super._toCDN(e, t);
2875
- let n = this.tag === U ? 4 : 16, r = this.content;
2876
- if (r instanceof O) return `${H}'${Kt(r.value)}'`;
2877
- if (r instanceof j && r.items.length === 2 && r.items[0] instanceof C && r.items[1] instanceof O) {
1931
+ let n = this.tag === H ? 4 : 16, r = this.content;
1932
+ if (r instanceof O) return `${V}'${Yt(r.value)}'`;
1933
+ if (r instanceof j && r.items.length === 2 && r.items[0] instanceof w && r.items[1] instanceof O) {
2878
1934
  let e = Number(r.items[0].value);
2879
- return `${H}'${Kt(Jt(r.items[1].value, n))}/${e}'`;
1935
+ return `${V}'${Yt(Zt(r.items[1].value, n))}/${e}'`;
2880
1936
  }
2881
1937
  return super._toCDN(e, t);
2882
1938
  }
2883
1939
  };
2884
- function Qt(e, t) {
1940
+ function tn(e, t) {
2885
1941
  let n = t.indexOf("/");
2886
1942
  if (n === -1) {
2887
- let { bytes: n, isV4: r } = Gt(t);
2888
- return e === H ? new Zt(r ? U : Ht, new O(n)) : new Yt(n);
1943
+ let { bytes: n, isV4: r } = Jt(t);
1944
+ return e === V ? new en(r ? H : U, new O(n)) : new Qt(n);
2889
1945
  }
2890
1946
  let r = t.slice(0, n), i = t.slice(n + 1);
2891
1947
  if (!/^\d+$/.test(i)) throw SyntaxError(`ip: invalid prefix length: ${JSON.stringify(i)}`);
2892
- let a = parseInt(i, 10), { bytes: o, isV4: s } = Gt(r), c = s ? 32 : 128;
1948
+ let a = parseInt(i, 10), { bytes: o, isV4: s } = Jt(r), c = s ? 32 : 128;
2893
1949
  if (a > c) throw SyntaxError(`ip: prefix length ${a} exceeds maximum ${c} for ${s ? "IPv4" : "IPv6"}`);
2894
- let l = qt(o, a);
2895
- return e === H ? new Zt(s ? U : Ht, new j([new C(BigInt(a)), new O(l)])) : new Xt(a, l, s);
1950
+ let l = Xt(o, a);
1951
+ return e === V ? new en(s ? H : U, new j([new w(BigInt(a)), new O(l)])) : new $t(a, l, s);
2896
1952
  }
2897
- var $t = {
2898
- appStringPrefixes: [Vt, H],
2899
- tagNumbers: [U, Ht],
1953
+ var nn = {
1954
+ appStringPrefixes: [Gt, V],
1955
+ tagNumbers: [H, U],
2900
1956
  parseAppString(e, t) {
2901
- return Qt(e, t);
1957
+ return tn(e, t);
2902
1958
  },
2903
1959
  parseAppSequence(e, t) {
2904
- return Qt(e, Wt(t));
1960
+ return tn(e, qt(t));
2905
1961
  },
2906
1962
  parseTag(e, t) {
2907
- if (!(e !== U && e !== Ht) && (t instanceof O || t instanceof j)) return new Zt(e, t);
1963
+ if (!(e !== H && e !== U) && (t instanceof O || t instanceof j)) return new en(e, t);
2908
1964
  }
2909
- }, en = 18446744073709551615n, tn = -18446744073709551616n, nn = {
2910
- tagNumbers: [He, Ue],
1965
+ }, rn = 18446744073709551615n, an = -18446744073709551616n, on = {
1966
+ tagNumbers: [Ke, qe],
2911
1967
  parseTag(e, t) {
2912
1968
  if (t instanceof O) {
2913
1969
  if (e === 2n) {
2914
- let e = qe(t.value);
2915
- return e > en ? new L(e) : void 0;
1970
+ let e = Ze(t.value);
1971
+ return e > rn ? new Qe(e) : void 0;
2916
1972
  }
2917
1973
  if (e === 3n) {
2918
- let e = -1n - qe(t.value);
2919
- return e < tn ? new R(e) : void 0;
1974
+ let e = -1n - Ze(t.value);
1975
+ return e < an ? new L(e) : void 0;
2920
1976
  }
2921
1977
  }
2922
1978
  }
2923
- }, rn = "cri", an = "CRI", on = 99n, sn = new Map([
1979
+ }, sn = "cri", cn = "CRI", ln = 99n, un = new Map([
2924
1980
  ["coap", -1n],
2925
1981
  ["coaps", -2n],
2926
1982
  ["http", -3n],
@@ -2931,7 +1987,7 @@ var $t = {
2931
1987
  ["coaps+tcp", -8n],
2932
1988
  ["coap+ws", -25n],
2933
1989
  ["coaps+ws", -26n]
2934
- ]), cn = new Map([...sn.entries()].map(([e, t]) => [t, e]));
1990
+ ]), dn = new Map([...un.entries()].map(([e, t]) => [t, e]));
2935
1991
  function W(e) {
2936
1992
  try {
2937
1993
  return decodeURIComponent(e);
@@ -2939,39 +1995,39 @@ function W(e) {
2939
1995
  return e;
2940
1996
  }
2941
1997
  }
2942
- var ln = new TextEncoder(), un = new TextDecoder("utf-8", { fatal: !0 });
2943
- function dn(e) {
2944
- return Array.from(ln.encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
1998
+ var fn = new TextEncoder(), pn = new TextDecoder("utf-8", { fatal: !0 });
1999
+ function mn(e) {
2000
+ return Array.from(fn.encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
2945
2001
  }
2946
2002
  function G(e, t) {
2947
2003
  let n = "";
2948
- for (let r of e) n += t(r) ? r : dn(r);
2004
+ for (let r of e) n += t(r) ? r : mn(r);
2949
2005
  return n;
2950
2006
  }
2951
- function fn(e) {
2952
- return /[A-Za-z0-9\-._~]/.test(e);
2953
- }
2954
- function pn(e) {
2955
- return /[!$&'()*+,;=]/.test(e);
2956
- }
2957
- function mn(e) {
2958
- return fn(e) || pn(e) || e === ":" || e === "@";
2959
- }
2960
2007
  function hn(e) {
2961
- return (mn(e) || e === "/" || e === "?") && e !== "&";
2008
+ return /[A-Za-z0-9\-._~]/.test(e);
2962
2009
  }
2963
2010
  function gn(e) {
2964
- return mn(e) || e === "/" || e === "?";
2011
+ return /[!$&'()*+,;=]/.test(e);
2965
2012
  }
2966
2013
  function _n(e) {
2967
- return fn(e) || pn(e) || e === ":";
2014
+ return hn(e) || gn(e) || e === ":" || e === "@";
2968
2015
  }
2969
2016
  function vn(e) {
2970
- return fn(e) || pn(e);
2017
+ return (_n(e) || e === "/" || e === "?") && e !== "&";
2971
2018
  }
2972
2019
  function yn(e) {
2020
+ return _n(e) || e === "/" || e === "?";
2021
+ }
2022
+ function bn(e) {
2023
+ return hn(e) || gn(e) || e === ":";
2024
+ }
2025
+ function xn(e) {
2026
+ return hn(e) || gn(e);
2027
+ }
2028
+ function Sn(e) {
2973
2029
  let t = [], n = e, r = n.indexOf("@");
2974
- r >= 0 && (t.push(N.FALSE), t.push(new B(W(n.slice(0, r)))), n = n.slice(r + 1));
2030
+ r >= 0 && (t.push(N.FALSE), t.push(new z(W(n.slice(0, r)))), n = n.slice(r + 1));
2975
2031
  let i, a = null;
2976
2032
  if (n.startsWith("[")) {
2977
2033
  let e = n.indexOf("]");
@@ -2980,90 +2036,90 @@ function yn(e) {
2980
2036
  let r = n.slice(e + 1);
2981
2037
  if (r.startsWith(":")) a = r.slice(1);
2982
2038
  else if (r.length > 0) throw SyntaxError("cri: unexpected characters after ']' in authority");
2983
- t.push(new O(Rt(i)));
2039
+ t.push(new O(Ht(i)));
2984
2040
  } else {
2985
2041
  let e = n.lastIndexOf(":");
2986
- 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 O(Lt(i)));
2987
- else for (let e of i.toLowerCase().split(".")) t.push(new B(e));
2042
+ 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 O(Vt(i)));
2043
+ else for (let e of i.toLowerCase().split(".")) t.push(new z(e));
2988
2044
  }
2989
2045
  if (a !== null && a !== "") {
2990
2046
  if (!/^\d+$/.test(a)) throw SyntaxError(`cri: invalid port: ${JSON.stringify(a)}`);
2991
2047
  let e = parseInt(a, 10);
2992
2048
  if (e > 65535) throw SyntaxError(`cri: port ${e} out of range`);
2993
- t.push(new C(BigInt(e)));
2049
+ t.push(new w(BigInt(e)));
2994
2050
  }
2995
2051
  return new j(t);
2996
2052
  }
2997
- function bn(e) {
2053
+ function Cn(e) {
2998
2054
  let t = e.items, n = 0, r = "";
2999
2055
  if (n < t.length && t[n] instanceof N && t[n].value === 20) {
3000
2056
  n++;
3001
2057
  let e = t[n++];
3002
- r += G(e.value, _n) + "@";
2058
+ r += G(e.value, bn) + "@";
3003
2059
  }
3004
2060
  if (n >= t.length) return r;
3005
2061
  let i = t[n];
3006
2062
  if (i instanceof O) {
3007
2063
  n++;
3008
2064
  let { length: e } = i.value;
3009
- if (e === 4) r += zt(i.value);
3010
- else if (e === 16) r += "[" + Bt(i.value) + "]";
2065
+ if (e === 4) r += Ut(i.value);
2066
+ else if (e === 16) r += "[" + Wt(i.value) + "]";
3011
2067
  else throw Error(`cri: unexpected host-ip byte length: ${e}`);
3012
- n < t.length && t[n] instanceof B && (r += `%25${G(t[n++].value, vn)}`);
2068
+ n < t.length && t[n] instanceof z && (r += `%25${G(t[n++].value, xn)}`);
3013
2069
  } else {
3014
2070
  let e = [];
3015
- for (; n < t.length && t[n] instanceof B;) e.push(G(t[n++].value, vn));
2071
+ for (; n < t.length && t[n] instanceof z;) e.push(G(t[n++].value, xn));
3016
2072
  r += e.join(".");
3017
2073
  }
3018
- return n < t.length && t[n] instanceof C && (r += ":" + t[n].value.toString()), r;
2074
+ return n < t.length && t[n] instanceof w && (r += ":" + t[n].value.toString()), r;
3019
2075
  }
3020
- function xn(e) {
2076
+ function wn(e) {
3021
2077
  let t = e.slice(2), n = t.indexOf("/"), r, i;
3022
- return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new B(W(e)))) : (r = t, i = []), {
3023
- authority: yn(r),
2078
+ return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new z(W(e)))) : (r = t, i = []), {
2079
+ authority: Sn(r),
3024
2080
  pathSegments: i
3025
2081
  };
3026
2082
  }
3027
- function Sn(e) {
2083
+ function Tn(e) {
3028
2084
  let t = e, n = null, r = t.indexOf("#");
3029
2085
  r >= 0 && (n = W(t.slice(r + 1)), t = t.slice(0, r));
3030
2086
  let i = null, a = t.indexOf("?");
3031
2087
  if (a >= 0) {
3032
2088
  let e = t.slice(a + 1);
3033
- t = t.slice(0, a), i = e.split("&").map((e) => new B(W(e)));
2089
+ t = t.slice(0, a), i = e.split("&").map((e) => new z(W(e)));
3034
2090
  }
3035
2091
  let o = [], s = /^([a-zA-Z][a-zA-Z0-9+.\-]*):([\s\S]*)$/.exec(t);
3036
2092
  if (s) {
3037
- let e = s[1].toLowerCase(), t = s[2], n = sn.get(e);
3038
- if (o.push(n === void 0 ? new B(e) : new w(n)), t.startsWith("//")) {
3039
- let { authority: e, pathSegments: n } = xn(t);
2093
+ let e = s[1].toLowerCase(), t = s[2], n = un.get(e);
2094
+ if (o.push(n === void 0 ? new z(e) : new T(n)), t.startsWith("//")) {
2095
+ let { authority: e, pathSegments: n } = wn(t);
3040
2096
  o.push(e, new j(n));
3041
2097
  } else if (t.startsWith("/")) {
3042
- let e = t.slice(1).split("/").map((e) => new B(W(e)));
2098
+ let e = t.slice(1).split("/").map((e) => new z(W(e)));
3043
2099
  o.push(N.NULL, new j(e));
3044
2100
  } else {
3045
- let e = t.split("/").map((e) => new B(W(e)));
2101
+ let e = t.split("/").map((e) => new z(W(e)));
3046
2102
  o.push(N.TRUE, new j(e));
3047
2103
  }
3048
2104
  } else if (t.startsWith("//")) {
3049
- let { authority: e, pathSegments: n } = xn(t);
2105
+ let { authority: e, pathSegments: n } = wn(t);
3050
2106
  o.push(N.FALSE, e, new j(n));
3051
2107
  } else if (t.startsWith("/")) {
3052
- let e = t.slice(1).split("/").map((e) => new B(W(e)));
2108
+ let e = t.slice(1).split("/").map((e) => new z(W(e)));
3053
2109
  o.push(N.TRUE, new j(e));
3054
- } else if (t === "") o.push(new C(0n));
2110
+ } else if (t === "") o.push(new w(0n));
3055
2111
  else {
3056
2112
  let n = 1n, r = t, i = !1;
3057
2113
  for (r.startsWith("./") && (i = !0, r = r.slice(2)); r.startsWith("../");) n++, r = r.slice(3);
3058
2114
  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)}`);
3059
- let a = r === "" ? [] : r.split("/").map((e) => new B(W(e)));
3060
- o.push(new C(n), new j(a));
2115
+ let a = r === "" ? [] : r.split("/").map((e) => new z(W(e)));
2116
+ o.push(new w(n), new j(a));
3061
2117
  }
3062
- if (i !== null && o.push(new j(i)), n !== null && (i === null && o.push(N.NULL), o.push(new B(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
2118
+ if (i !== null && o.push(new j(i)), n !== null && (i === null && o.push(N.NULL), o.push(new z(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
3063
2119
  let e = o[o.length - 1];
3064
2120
  e instanceof j && e.items.length === 0 && o.pop();
3065
2121
  }
3066
- return o.length === 1 && o[0] instanceof C && o[0].value === 0n ? [] : o;
2122
+ return o.length === 1 && o[0] instanceof w && o[0].value === 0n ? [] : o;
3067
2123
  }
3068
2124
  function K(e, t) {
3069
2125
  let n = t, r = "";
@@ -3072,34 +2128,34 @@ function K(e, t) {
3072
2128
  if (t instanceof j) {
3073
2129
  if (n++, t.items.length > 0) {
3074
2130
  let e = t.items.map((e) => {
3075
- if (!(e instanceof B)) throw Error("cri: query item must be a text string");
3076
- return G(e.value, hn);
2131
+ if (!(e instanceof z)) throw Error("cri: query item must be a text string");
2132
+ return G(e.value, vn);
3077
2133
  });
3078
2134
  r += "?" + e.join("&");
3079
2135
  }
3080
2136
  } else t instanceof N && t.value === 22 && n++;
3081
2137
  }
3082
- return n < e.length && e[n] instanceof B && (r += "#" + G(e[n].value, gn)), r;
2138
+ return n < e.length && e[n] instanceof z && (r += "#" + G(e[n].value, yn)), r;
3083
2139
  }
3084
- function Cn(e) {
2140
+ function En(e) {
3085
2141
  return e.items.map((e) => {
3086
- if (!(e instanceof B)) throw Error("cri: path segment must be a text string");
3087
- return G(e.value, mn);
2142
+ if (!(e instanceof z)) throw Error("cri: path segment must be a text string");
2143
+ return G(e.value, _n);
3088
2144
  });
3089
2145
  }
3090
- function wn(e) {
2146
+ function Dn(e) {
3091
2147
  if (e.length === 0) return "";
3092
2148
  let t = 0, n = e[t++];
3093
- if (n instanceof w || n instanceof B) {
2149
+ if (n instanceof T || n instanceof z) {
3094
2150
  let r;
3095
- if (n instanceof w) {
3096
- let e = cn.get(n.value);
2151
+ if (n instanceof T) {
2152
+ let e = dn.get(n.value);
3097
2153
  if (e === void 0) throw Error(`cri: unrecognised scheme-id ${n.value}`);
3098
2154
  r = e + ":";
3099
2155
  } else r = n.value + ":";
3100
2156
  if (t >= e.length) return r;
3101
2157
  let i = e[t++], a = "", o = !1;
3102
- if (i instanceof j) a = "//" + bn(i), o = !0;
2158
+ if (i instanceof j) a = "//" + Cn(i), o = !0;
3103
2159
  else if (i instanceof N) if (i.value === 22) o = !0;
3104
2160
  else if (i.value === 21) o = !1;
3105
2161
  else throw Error(`cri: unexpected no-authority value: simple(${i.value})`);
@@ -3107,16 +2163,16 @@ function wn(e) {
3107
2163
  let s = "";
3108
2164
  if (t < e.length && e[t] instanceof j) {
3109
2165
  let n = e[t++];
3110
- n.items.length > 0 && (s = (o ? "/" : "") + Cn(n).join("/"));
2166
+ n.items.length > 0 && (s = (o ? "/" : "") + En(n).join("/"));
3111
2167
  }
3112
2168
  return r + a + s + K(e, t);
3113
2169
  }
3114
2170
  if (n instanceof N && n.value === 20) {
3115
2171
  if (t >= e.length || !(e[t] instanceof j)) throw Error("cri: network-path reference requires an authority array");
3116
- let n = bn(e[t++]), r = "";
2172
+ let n = Cn(e[t++]), r = "";
3117
2173
  if (t < e.length && e[t] instanceof j) {
3118
2174
  let n = e[t++];
3119
- n.items.length > 0 && (r = "/" + Cn(n).join("/"));
2175
+ n.items.length > 0 && (r = "/" + En(n).join("/"));
3120
2176
  }
3121
2177
  return "//" + n + r + K(e, t);
3122
2178
  }
@@ -3124,18 +2180,18 @@ function wn(e) {
3124
2180
  let n = "/";
3125
2181
  if (t < e.length && e[t] instanceof j) {
3126
2182
  let r = e[t++];
3127
- n = "/" + Cn(r).join("/");
2183
+ n = "/" + En(r).join("/");
3128
2184
  }
3129
2185
  return n + K(e, t);
3130
2186
  }
3131
- if (n instanceof C) {
2187
+ if (n instanceof w) {
3132
2188
  let r = n.value;
3133
2189
  if (r === 0n) return K(e, t);
3134
2190
  let i = r === 1n ? "" : "../".repeat(Number(r) - 1), a;
3135
2191
  if (t < e.length && e[t] instanceof j) {
3136
2192
  let n = e[t++];
3137
2193
  if (n.items.length > 0) {
3138
- let e = Cn(n);
2194
+ let e = En(n);
3139
2195
  a = (r === 1n && e[0].includes(":") ? "./" : i) + e.join("/");
3140
2196
  } else a = i === "" ? "./" : i;
3141
2197
  } else a = i === "" ? "./" : i;
@@ -3143,65 +2199,65 @@ function wn(e) {
3143
2199
  }
3144
2200
  throw Error("cri: unrecognised first element type in CRI array");
3145
2201
  }
3146
- var Tn = class extends j {
2202
+ var On = class extends j {
3147
2203
  _toCDN(e, t) {
3148
2204
  if (e?.appStrings === !1) return super._toCDN(e, t);
3149
2205
  try {
3150
- return `${rn}'${wn(this.items)}'`;
2206
+ return `${sn}'${Dn(this.items)}'`;
3151
2207
  } catch {
3152
2208
  return super._toCDN(e, t);
3153
2209
  }
3154
2210
  }
3155
- }, En = class extends E {
2211
+ }, kn = class extends D {
3156
2212
  constructor(e) {
3157
- super(on, e);
2213
+ super(ln, e);
3158
2214
  }
3159
2215
  _toCDN(e, t) {
3160
2216
  if (e?.appStrings === !1) return super._toCDN(e, t);
3161
2217
  try {
3162
- return `${an}'${wn(this.content.items)}'`;
2218
+ return `${cn}'${Dn(this.content.items)}'`;
3163
2219
  } catch {
3164
2220
  return super._toCDN(e, t);
3165
2221
  }
3166
2222
  }
3167
2223
  };
3168
- function Dn(e) {
2224
+ function An(e) {
3169
2225
  if (e.length !== 1) throw SyntaxError("cri<<...>>: expected exactly one item");
3170
2226
  let t = e[0];
3171
- if (t instanceof B) return t.value;
3172
- if (t instanceof O) return un.decode(t.value);
2227
+ if (t instanceof z) return t.value;
2228
+ if (t instanceof O) return pn.decode(t.value);
3173
2229
  throw SyntaxError("cri<<...>>: expected a text string or byte string");
3174
2230
  }
3175
- function On(e, t) {
3176
- let n = new Tn(Sn(t));
3177
- return e === an ? new En(n) : n;
2231
+ function jn(e, t) {
2232
+ let n = new On(Tn(t));
2233
+ return e === cn ? new kn(n) : n;
3178
2234
  }
3179
- var kn = {
3180
- appStringPrefixes: [rn, an],
3181
- tagNumbers: [on],
2235
+ var Mn = {
2236
+ appStringPrefixes: [sn, cn],
2237
+ tagNumbers: [ln],
3182
2238
  parseAppString(e, t) {
3183
- return On(e, t);
2239
+ return jn(e, t);
3184
2240
  },
3185
2241
  parseAppSequence(e, t) {
3186
- return On(e, Dn(t));
2242
+ return jn(e, An(t));
3187
2243
  },
3188
2244
  parseTag(e, t) {
3189
- if (e === 99n && t instanceof j) return new En(new Tn(t.items, {
2245
+ if (e === 99n && t instanceof j) return new kn(new On(t.items, {
3190
2246
  indefiniteLength: t.indefiniteLength,
3191
2247
  encodingWidth: t.encodingWidth
3192
2248
  }));
3193
2249
  }
3194
- }, An = new TextDecoder("utf-8", {
2250
+ }, Nn = new TextDecoder("utf-8", {
3195
2251
  fatal: !0,
3196
2252
  ignoreBOM: !0
3197
- }), jn = new TextDecoder("utf-8", {
2253
+ }), Pn = new TextDecoder("utf-8", {
3198
2254
  fatal: !1,
3199
2255
  ignoreBOM: !0
3200
2256
  });
3201
2257
  function q(e) {
3202
2258
  throw Error(`CBOR decode error: ${e}`);
3203
2259
  }
3204
- function Mn(e, t, n) {
2260
+ function Fn(e, t, n) {
3205
2261
  let r = {
3206
2262
  message: e,
3207
2263
  offset: t
@@ -3209,26 +2265,26 @@ function Mn(e, t, n) {
3209
2265
  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}`);
3210
2266
  return r;
3211
2267
  }
3212
- function Nn(e, t) {
2268
+ function In(e, t) {
3213
2269
  e.warnings ??= [], e.warnings.push(t);
3214
2270
  }
3215
- function Pn(e) {
2271
+ function Ln(e) {
3216
2272
  let t = "";
3217
2273
  for (let n of e) t += n.toString(16).padStart(2, "0");
3218
2274
  return t;
3219
2275
  }
3220
2276
  function J(e) {
3221
- if (e instanceof C) return ["u", String(e.value)];
3222
- if (e instanceof w) return ["n", String(e.value)];
3223
- if (e instanceof B) return ["t", e.value];
2277
+ if (e instanceof w) return ["u", String(e.value)];
2278
+ if (e instanceof T) return ["n", String(e.value)];
2279
+ if (e instanceof z) return ["t", e.value];
3224
2280
  if (e instanceof A) return ["t", e.chunks.map((e) => e.value).join("")];
3225
- if (e instanceof O) return ["b", Pn(e.value)];
2281
+ if (e instanceof O) return ["b", Ln(e.value)];
3226
2282
  if (e instanceof k) {
3227
2283
  let t = "";
3228
- for (let n of e.chunks) t += Pn(n.value);
2284
+ for (let n of e.chunks) t += Ln(n.value);
3229
2285
  return ["b", t];
3230
2286
  }
3231
- if (e instanceof T) return isNaN(e.value) ? ["f", "NaN"] : Object.is(e.value, -0) ? ["f", "-0"] : ["f", String(e.value)];
2287
+ if (e instanceof E) return isNaN(e.value) ? ["f", "NaN"] : Object.is(e.value, -0) ? ["f", "-0"] : ["f", String(e.value)];
3232
2288
  if (e instanceof N) return ["s", e.value];
3233
2289
  if (e instanceof j) return ["A", e.items.map(J)];
3234
2290
  if (e instanceof M) {
@@ -3237,7 +2293,7 @@ function J(e) {
3237
2293
  let n = t.map((e) => [JSON.stringify(e[0]), e]);
3238
2294
  return n.sort((e, t) => e[0] < t[0] ? -1 : +(e[0] > t[0])), ["M", n.map((e) => e[1])];
3239
2295
  }
3240
- if (e instanceof E) return [
2296
+ if (e instanceof D) return [
3241
2297
  "G",
3242
2298
  String(e.tag),
3243
2299
  J(e.content)
@@ -3246,22 +2302,22 @@ function J(e) {
3246
2302
  for (let e of t) n += e.toString(16).padStart(2, "0");
3247
2303
  return ["c", n];
3248
2304
  }
3249
- function Fn(e) {
3250
- if (e instanceof C) return "u" + e.value;
3251
- if (e instanceof w) return "n" + e.value;
3252
- if (e instanceof B) return "t" + e.value;
2305
+ function Rn(e) {
2306
+ if (e instanceof w) return "u" + e.value;
2307
+ if (e instanceof T) return "n" + e.value;
2308
+ if (e instanceof z) return "t" + e.value;
3253
2309
  if (e instanceof A) {
3254
2310
  let t = "t";
3255
2311
  for (let n of e.chunks) t += n.value;
3256
2312
  return t;
3257
2313
  }
3258
- if (e instanceof O) return "b" + Pn(e.value);
2314
+ if (e instanceof O) return "b" + Ln(e.value);
3259
2315
  if (e instanceof k) {
3260
2316
  let t = "b";
3261
- for (let n of e.chunks) t += Pn(n.value);
2317
+ for (let n of e.chunks) t += Ln(n.value);
3262
2318
  return t;
3263
2319
  }
3264
- return e instanceof T ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof N ? "s" + e.value : JSON.stringify(J(e));
2320
+ return e instanceof E ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof N ? "s" + e.value : JSON.stringify(J(e));
3265
2321
  }
3266
2322
  function Y(e, t, n) {
3267
2323
  if (n <= 23) return {
@@ -3288,7 +2344,7 @@ function Y(e, t, n) {
3288
2344
  default: q(`reserved additional info value: ${n}`);
3289
2345
  }
3290
2346
  }
3291
- function In(e, t, n, r, i, a) {
2347
+ function zn(e, t, n, r, i, a) {
3292
2348
  let o = [], s = t;
3293
2349
  for (;;) {
3294
2350
  if (s >= e.byteLength && q(`unexpected end of indefinite ${i}`), e.getUint8(s) === 255) {
@@ -3303,35 +2359,35 @@ function In(e, t, n, r, i, a) {
3303
2359
  nextOffset: s
3304
2360
  };
3305
2361
  }
3306
- function Ln(e, t, n, r) {
3307
- let i = Fn(e);
3308
- t.has(i) && n.push(Mn(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
2362
+ function Bn(e, t, n, r) {
2363
+ let i = Rn(e);
2364
+ t.has(i) && n.push(Fn(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
3309
2365
  }
3310
2366
  function X(e, t, n, r) {
3311
- let i = t, a = Rn(e, t, n, r);
2367
+ let i = t, a = Vn(e, t, n, r);
3312
2368
  return a.value.start = i, a.value.end = a.nextOffset, a;
3313
2369
  }
3314
- function Rn(e, t, n, r) {
2370
+ function Vn(e, t, n, r) {
3315
2371
  t >= e.byteLength && q("unexpected end of input");
3316
2372
  let i = e.getUint8(t++), a = i >> 5, o = i & 31;
3317
2373
  switch (a) {
3318
2374
  case 0: {
3319
2375
  let { value: n, nextOffset: r } = Y(e, t, o);
3320
2376
  return {
3321
- value: new C(n),
2377
+ value: new w(n),
3322
2378
  nextOffset: r
3323
2379
  };
3324
2380
  }
3325
2381
  case 1: {
3326
2382
  let { value: n, nextOffset: r } = Y(e, t, o);
3327
2383
  return {
3328
- value: new w(-1n - n),
2384
+ value: new T(-1n - n),
3329
2385
  nextOffset: r
3330
2386
  };
3331
2387
  }
3332
2388
  case 2: {
3333
2389
  if (o === 31) {
3334
- let { chunks: i, nextOffset: a } = In(e, t, n, r, "byte string", (e) => e instanceof O);
2390
+ let { chunks: i, nextOffset: a } = zn(e, t, n, r, "byte string", (e) => e instanceof O);
3335
2391
  return {
3336
2392
  value: new k(i),
3337
2393
  nextOffset: a
@@ -3345,7 +2401,7 @@ function Rn(e, t, n, r) {
3345
2401
  }
3346
2402
  case 3: {
3347
2403
  if (o === 31) {
3348
- let { chunks: i, nextOffset: a } = In(e, t, n, r, "text string", (e) => e instanceof B);
2404
+ let { chunks: i, nextOffset: a } = zn(e, t, n, r, "text string", (e) => e instanceof z);
3349
2405
  return {
3350
2406
  value: new A(i),
3351
2407
  nextOffset: a
@@ -3355,12 +2411,12 @@ function Rn(e, t, n, r) {
3355
2411
  a + s > e.byteLength && q("text string extends beyond input");
3356
2412
  let c = new Uint8Array(e.buffer, e.byteOffset + a, s), l, u;
3357
2413
  try {
3358
- l = An.decode(c);
2414
+ l = Nn.decode(c);
3359
2415
  } catch {
3360
- u = Mn("invalid UTF-8 sequence in text string", a, n), l = jn.decode(c);
2416
+ u = Fn("invalid UTF-8 sequence in text string", a, n), l = Pn.decode(c);
3361
2417
  }
3362
- let d = new B(l);
3363
- return u && Nn(d, u), {
2418
+ let d = new z(l);
2419
+ return u && In(d, u), {
3364
2420
  value: d,
3365
2421
  nextOffset: a + s
3366
2422
  };
@@ -3400,12 +2456,12 @@ function Rn(e, t, n, r) {
3400
2456
  break;
3401
2457
  }
3402
2458
  let t = X(e, s, n, r);
3403
- Ln(t.value, a, o, n), s = t.nextOffset;
2459
+ Bn(t.value, a, o, n), s = t.nextOffset;
3404
2460
  let c = X(e, s, n, r);
3405
2461
  s = c.nextOffset, i.push([t.value, c.value]);
3406
2462
  }
3407
2463
  let c = new M(i, { indefiniteLength: !0 });
3408
- for (let e of o) Nn(c, e);
2464
+ for (let e of o) In(c, e);
3409
2465
  return {
3410
2466
  value: c,
3411
2467
  nextOffset: s
@@ -3414,12 +2470,12 @@ function Rn(e, t, n, r) {
3414
2470
  let { value: i, nextOffset: a } = Y(e, t, o), s = Number(i), c = [], l = /* @__PURE__ */ new Set(), u = [], d = a;
3415
2471
  for (let t = 0; t < s; t++) {
3416
2472
  let t = X(e, d, n, r);
3417
- Ln(t.value, l, u, n), d = t.nextOffset;
2473
+ Bn(t.value, l, u, n), d = t.nextOffset;
3418
2474
  let i = X(e, d, n, r);
3419
2475
  d = i.nextOffset, c.push([t.value, i.value]);
3420
2476
  }
3421
2477
  let f = new M(c);
3422
- for (let e of u) Nn(f, e);
2478
+ for (let e of u) In(f, e);
3423
2479
  return {
3424
2480
  value: f,
3425
2481
  nextOffset: d
@@ -3436,7 +2492,7 @@ function Rn(e, t, n, r) {
3436
2492
  };
3437
2493
  }
3438
2494
  return {
3439
- value: new E(i, s.value),
2495
+ value: new D(i, s.value),
3440
2496
  nextOffset: s.nextOffset
3441
2497
  };
3442
2498
  }
@@ -3446,27 +2502,27 @@ function Rn(e, t, n, r) {
3446
2502
  nextOffset: t
3447
2503
  };
3448
2504
  if (o === 20) return {
3449
- value: N.FALSE,
2505
+ value: new N(20),
3450
2506
  nextOffset: t
3451
2507
  };
3452
2508
  if (o === 21) return {
3453
- value: N.TRUE,
2509
+ value: new N(21),
3454
2510
  nextOffset: t
3455
2511
  };
3456
2512
  if (o === 22) return {
3457
- value: N.NULL,
2513
+ value: new N(22),
3458
2514
  nextOffset: t
3459
2515
  };
3460
2516
  if (o === 23) return {
3461
- value: N.UNDEFINED,
2517
+ value: new N(23),
3462
2518
  nextOffset: t
3463
2519
  };
3464
2520
  if (o === 24) {
3465
2521
  t + 1 > e.byteLength && q("unexpected end of input");
3466
2522
  let r = e.getUint8(t);
3467
2523
  if (r < 32) {
3468
- let e = Mn(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`, t - 1, n), i = new N(r);
3469
- return Nn(i, e), {
2524
+ let e = Fn(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`, t - 1, n), i = new N(r);
2525
+ return In(i, e), {
3470
2526
  value: i,
3471
2527
  nextOffset: t + 1
3472
2528
  };
@@ -3477,38 +2533,38 @@ function Rn(e, t, n, r) {
3477
2533
  };
3478
2534
  }
3479
2535
  return o === 25 ? (t + 2 > e.byteLength && q("unexpected end of input"), {
3480
- value: new T(_(e.getUint16(t, !1)), { precision: "half" }),
2536
+ value: new E(je(e.getUint16(t, !1)), { precision: "half" }),
3481
2537
  nextOffset: t + 2
3482
2538
  }) : o === 26 ? (t + 4 > e.byteLength && q("unexpected end of input"), {
3483
- value: new T(e.getFloat32(t, !1), { precision: "single" }),
2539
+ value: new E(e.getFloat32(t, !1), { precision: "single" }),
3484
2540
  nextOffset: t + 4
3485
2541
  }) : o === 27 ? (t + 8 > e.byteLength && q("unexpected end of input"), {
3486
- value: new T(e.getFloat64(t, !1), { precision: "double" }),
2542
+ value: new E(e.getFloat64(t, !1), { precision: "double" }),
3487
2543
  nextOffset: t + 8
3488
2544
  }) : (o < 31 && q(`reserved additional info value in major type 7: ${o}`), q("unexpected break code outside indefinite-length item"));
3489
2545
  }
3490
2546
  return q(`unknown major type: ${a}`);
3491
2547
  }
3492
- function zn(e) {
2548
+ function Hn(e) {
3493
2549
  if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new Uint8Array(e);
3494
2550
  if (ArrayBuffer.isView(e)) return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
3495
2551
  throw TypeError("expected ArrayBufferView or ArrayBufferLike");
3496
2552
  }
3497
- function Bn(e, t) {
3498
- let n = zn(e), r = new DataView(n.buffer, n.byteOffset, n.byteLength), i = t?.offset ?? 0;
2553
+ function Un(e, t) {
2554
+ let n = Hn(e), r = new DataView(n.buffer, n.byteOffset, n.byteLength), i = t?.offset ?? 0;
3499
2555
  if (!Number.isInteger(i) || i < 0 || i > r.byteLength) throw RangeError(`CBOR decode offset must be an integer between 0 and ${r.byteLength}`);
3500
2556
  let { value: a, nextOffset: o } = X(r, i, t, [...t?.extensions ?? [], ...Z].filter((e) => e.parseTag !== void 0));
3501
2557
  return !t?.allowTrailing && o !== r.byteLength && q(`${r.byteLength - o} trailing byte(s) after end of CBOR item`), a;
3502
2558
  }
3503
2559
  //#endregion
3504
2560
  //#region src/extensions/cbordata.ts
3505
- var Vn = 24n, Z = [
3506
- Ft,
3507
- $t,
2561
+ var Wn = 24n, Z = [
2562
+ zt,
3508
2563
  nn,
3509
- kn,
2564
+ on,
2565
+ Mn,
3510
2566
  {
3511
- tagNumbers: [Vn],
2567
+ tagNumbers: [Wn],
3512
2568
  parseTag(e, t, n) {
3513
2569
  if (e !== 24n || !(t instanceof O)) return;
3514
2570
  let r = n ? {
@@ -3518,7 +2574,7 @@ var Vn = 24n, Z = [
3518
2574
  silent: n.silent
3519
2575
  } : void 0;
3520
2576
  try {
3521
- return new E(Vn, new P([Bn(t.value, r)]));
2577
+ return new D(Wn, new P([Un(t.value, r)]));
3522
2578
  } catch (e) {
3523
2579
  if (r?.strict !== !1) throw e;
3524
2580
  return;
@@ -3530,53 +2586,53 @@ var Vn = 24n, Z = [
3530
2586
  //#region src/js/fromJS.ts
3531
2587
  function Q(e, t) {
3532
2588
  if (t?.replacer) {
3533
- let { replacer: n, ...r } = t, i = Wn(e, n, r.extensions, r.undefinedOmits);
3534
- return i === l ? N.UNDEFINED : Q(i, Object.keys(r).length > 0 ? r : void 0);
2589
+ let { replacer: n, ...r } = t, i = qn(e, n, r.extensions, r.undefinedOmits);
2590
+ return i === d ? N.UNDEFINED : Q(i, Object.keys(r).length > 0 ? r : void 0);
3535
2591
  }
3536
- return Hn(e, t, !0);
2592
+ return Gn(e, t, !0);
3537
2593
  }
3538
- function Hn(e, t, n) {
2594
+ function Gn(e, t, n) {
3539
2595
  for (let n of [...t?.extensions ?? [], ...Z]) if (n.fromJS) {
3540
2596
  let r = n.fromJS(e, t ?? {});
3541
2597
  if (r !== void 0) return r;
3542
2598
  }
3543
- if (n && typeof e == "object" && e && c.symbol in e) {
3544
- let n = e[c.symbol], r = Hn(e, t, !1);
2599
+ if (n && typeof e == "object" && e && u.symbol in e) {
2600
+ let n = e[u.symbol], r = Gn(e, t, !1);
3545
2601
  for (let e of [...t?.extensions ?? [], ...Z]) if (e.parseTag) {
3546
2602
  let t = e.parseTag(n, r);
3547
2603
  if (t !== void 0) return t;
3548
2604
  }
3549
- return new E(n, r);
2605
+ return new D(n, r);
3550
2606
  }
3551
- if (e instanceof c.Null) return N.NULL;
3552
- if (e instanceof c.Undefined) return N.UNDEFINED;
3553
- if (e instanceof u) return new N(e.value);
2607
+ if (e instanceof u.Null) return N.NULL;
2608
+ if (e instanceof u.Undefined) return N.UNDEFINED;
2609
+ if (e instanceof f) return new N(e.value);
3554
2610
  if (e === null) return N.NULL;
3555
2611
  if (e === void 0) return N.UNDEFINED;
3556
2612
  if (e === !0) return N.TRUE;
3557
2613
  if (e === !1) return N.FALSE;
3558
- if (typeof e == "bigint") return e > 18446744073709551615n ? new L(e) : e < -18446744073709551616n ? new R(e) : e >= 0n ? new C(e) : new w(e);
3559
- if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new C(BigInt(e)) : new w(BigInt(e)) : new T(e);
3560
- if (typeof e == "string") return new B(e);
3561
- if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return Hn(e.valueOf(), t, !1);
2614
+ if (typeof e == "bigint") return e > 18446744073709551615n ? new Qe(e) : e < -18446744073709551616n ? new L(e) : e >= 0n ? new w(e) : new T(e);
2615
+ if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new w(BigInt(e)) : new T(BigInt(e)) : new E(e);
2616
+ if (typeof e == "string") return new z(e);
2617
+ if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return Gn(e.valueOf(), t, !1);
3562
2618
  if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new O(new Uint8Array(e));
3563
- if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new j(Array.from(e, (e) => new C(BigInt(e)))) : new O(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
2619
+ if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new j(Array.from(e, (e) => new w(BigInt(e)))) : new O(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
3564
2620
  if (e instanceof $) return new M([...e].map(([e, n]) => [Q(e, t), Q(n, t)]));
3565
2621
  if (Array.isArray(e)) return new j(e.map((e) => Q(e, t)));
3566
2622
  if (typeof e == "object") {
3567
2623
  let n = [];
3568
- for (let [r, i] of Object.entries(e)) n.push([new B(r), Q(i, t)]);
2624
+ for (let [r, i] of Object.entries(e)) n.push([new z(r), Q(i, t)]);
3569
2625
  return new M(n);
3570
2626
  }
3571
2627
  throw TypeError(`fromJS: unsupported value type: ${typeof e}`);
3572
2628
  }
3573
- function Un(e) {
3574
- 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 c.Null || e instanceof c.Undefined || e instanceof u;
2629
+ function Kn(e) {
2630
+ 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 u.Null || e instanceof u.Undefined || e instanceof f;
3575
2631
  }
3576
- function Wn(e, t, n, r) {
2632
+ function qn(e, t, n, r) {
3577
2633
  let i = [...n ?? [], ...Z];
3578
2634
  function a(e) {
3579
- return e === l || r === !0 && e === void 0;
2635
+ return e === d || r === !0 && e === void 0;
3580
2636
  }
3581
2637
  if (Array.isArray(t)) {
3582
2638
  let n = t.map(String);
@@ -3584,7 +2640,7 @@ function Wn(e, t, n, r) {
3584
2640
  if (typeof e != "object" || !e) return e;
3585
2641
  if (e instanceof $) return $.from(e, ([e, t]) => [e, r(t)]);
3586
2642
  if (Array.isArray(e)) return e.map(r);
3587
- if (c.symbol in e || Un(e) || i.some((t) => t.isJSType?.(e))) return e;
2643
+ if (u.symbol in e || Kn(e) || i.some((t) => t.isJSType?.(e))) return e;
3588
2644
  let t = Object.getPrototypeOf(e);
3589
2645
  if (t === Object.prototype || t === null) {
3590
2646
  let t = e.toJSON;
@@ -3606,7 +2662,7 @@ function Wn(e, t, n, r) {
3606
2662
  }
3607
2663
  }
3608
2664
  if (e = o.call(n, t, e), typeof e == "object" && e) {
3609
- if (c.symbol in e) return e;
2665
+ if (u.symbol in e) return e;
3610
2666
  if (e instanceof $) {
3611
2667
  let t = new $();
3612
2668
  for (let [n, r] of e) {
@@ -3619,7 +2675,7 @@ function Wn(e, t, n, r) {
3619
2675
  let r = s(t, String(n), e);
3620
2676
  return a(r) ? null : r;
3621
2677
  });
3622
- if (Un(e) || i.some((t) => t.isJSType?.(e))) return e;
2678
+ if (Kn(e) || i.some((t) => t.isJSType?.(e))) return e;
3623
2679
  let t = {};
3624
2680
  for (let n of Object.keys(e)) {
3625
2681
  let r = s(e[n], n, e);
@@ -3649,6 +2705,6 @@ var $ = class extends Array {
3649
2705
  }
3650
2706
  };
3651
2707
  //#endregion
3652
- export { u as C, c as D, t as E, n as O, _ as S, e as T, E as _, It as a, C as b, R as c, N as d, M as f, O as g, k as h, Bn as i, L as l, A as m, Wn as n, B as o, j as p, Q as r, Ze as s, $ as t, P as u, T as v, l as w, S as x, w as y };
2708
+ export { ie as C, r as D, n as E, u as O, je as S, d as T, D as _, Bt as a, w as b, L as c, N as d, M as f, O as g, k as h, Un as i, i as k, Qe as l, A as m, qn as n, z as o, j as p, Q as r, nt as s, $ as t, P as u, E as v, f as w, C as x, T as y };
3653
2709
 
3654
- //# sourceMappingURL=mapEntries-BMMPg2FB.js.map
2710
+ //# sourceMappingURL=mapEntries-D6BfG4-1.js.map