@cbortech/cbor 0.26.8 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.ja.md +193 -28
  2. package/README.md +196 -29
  3. package/dist/ast/CborAppSeqResult.d.ts +58 -3
  4. package/dist/ast/CborArray.d.ts +2 -2
  5. package/dist/ast/CborByteString.d.ts +17 -1
  6. package/dist/ast/CborEmbeddedCBOR.d.ts +2 -2
  7. package/dist/ast/CborFloat.d.ts +2 -2
  8. package/dist/ast/CborIndefiniteByteString.d.ts +25 -1
  9. package/dist/ast/CborIndefiniteTextString.d.ts +17 -1
  10. package/dist/ast/CborItem.d.ts +340 -10
  11. package/dist/ast/CborMap.d.ts +2 -2
  12. package/dist/ast/CborNint.d.ts +1 -1
  13. package/dist/ast/CborTag.d.ts +30 -3
  14. package/dist/ast/CborTextString.d.ts +3 -2
  15. package/dist/ast/CborUint.d.ts +1 -1
  16. package/dist/ast/CborUnresolvedAppExt.d.ts +2 -2
  17. package/dist/ast/index.cjs +1 -1
  18. package/dist/ast/index.js +2 -2
  19. package/dist/cddl/index.cjs +1 -1
  20. package/dist/cddl/index.js +1 -1
  21. package/dist/cdn/index.cjs +2 -2
  22. package/dist/cdn/index.cjs.map +1 -1
  23. package/dist/cdn/index.js +18 -18
  24. package/dist/cdn/index.js.map +1 -1
  25. package/dist/cdn/serialize-utils.d.ts +237 -10
  26. package/dist/cdn/tokenizer.d.ts +12 -11
  27. package/dist/extensions/builtins.d.ts +5 -5
  28. package/dist/extensions/cri.d.ts +4 -4
  29. package/dist/extensions/dt.d.ts +4 -4
  30. package/dist/extensions/ip.d.ts +4 -4
  31. package/dist/extensions/types.d.ts +44 -5
  32. package/dist/index.cjs +3 -3
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.js +158 -158
  36. package/dist/index.js.map +1 -1
  37. package/dist/{mapEntries-Ci_dppP6.js → mapEntries-CCLaJSaJ.js} +1599 -1275
  38. package/dist/mapEntries-CCLaJSaJ.js.map +1 -0
  39. package/dist/mapEntries-CZZJScaj.cjs +13 -0
  40. package/dist/mapEntries-CZZJScaj.cjs.map +1 -0
  41. package/dist/{schema-y8G5mDIS.js → schema-DN9inJny.js} +294 -294
  42. package/dist/{schema-y8G5mDIS.js.map → schema-DN9inJny.js.map} +1 -1
  43. package/dist/schema-zsg5yCPK.cjs +63 -0
  44. package/dist/{schema-DgnkH0P6.cjs.map → schema-zsg5yCPK.cjs.map} +1 -1
  45. package/dist/serialize-utils-DhlW61ZX.cjs +37 -0
  46. package/dist/serialize-utils-DhlW61ZX.cjs.map +1 -0
  47. package/dist/{tokenizer-N-vAvRdj.js → serialize-utils-h-CVB9rg.js} +636 -358
  48. package/dist/serialize-utils-h-CVB9rg.js.map +1 -0
  49. package/dist/types.d.ts +508 -58
  50. package/dist/utils/base64.d.ts +1 -1
  51. package/dist/utils/hexfloat.d.ts +11 -3
  52. package/dist/utils/strip-comments.d.ts +1 -1
  53. package/package.json +13 -12
  54. package/dist/mapEntries-BJzyBUH5.cjs +0 -13
  55. package/dist/mapEntries-BJzyBUH5.cjs.map +0 -1
  56. package/dist/mapEntries-Ci_dppP6.js.map +0 -1
  57. package/dist/schema-DgnkH0P6.cjs +0 -63
  58. package/dist/tokenizer-BD08xbyd.cjs +0 -36
  59. package/dist/tokenizer-BD08xbyd.cjs.map +0 -1
  60. package/dist/tokenizer-N-vAvRdj.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { C as e, D as t, E as n, S as r, T as i, _ as a, a as o, b as s, c, d as l, f as u, g as d, h as f, i as p, l as ee, m as te, n as m, o as ne, p as h, r as g, s as _, t as re, u as ie, v, w as y, x as ae, y as oe } from "./tokenizer-N-vAvRdj.js";
1
+ import { A as e, C as t, D as n, E as r, F as i, I as a, M as o, N as s, O as c, P as l, S as u, T as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as y, i as b, j as ee, k as x, l as S, m as C, n as w, o as T, p as te, r as E, s as ne, t as D, u as re, v as ie, w as O, x as ae, y as oe } from "./serialize-utils-h-CVB9rg.js";
2
2
  //#region src/tag.ts
3
3
  var se = Symbol.for("cbor.tag"), ce = class {
4
4
  valueOf() {
@@ -58,7 +58,7 @@ function pe(e) {
58
58
  function me(e) {
59
59
  return typeof e == "object" && !!e;
60
60
  }
61
- var b = class {
61
+ var k = class {
62
62
  constructor() {}
63
63
  static symbol = se;
64
64
  static Null = ce;
@@ -75,7 +75,7 @@ var b = class {
75
75
  static getValue(e) {
76
76
  return pe(e);
77
77
  }
78
- }, x = Symbol("cbor.omit"), he = class e {
78
+ }, A = Symbol("cbor.omit"), he = class e {
79
79
  value;
80
80
  constructor(e) {
81
81
  if (!Number.isInteger(e) || e < 0 || e > 255) throw RangeError("Simple value must be an integer in 0–255");
@@ -94,7 +94,7 @@ var b = class {
94
94
  return t instanceof e ? t.value : void 0;
95
95
  }
96
96
  }, ge = "getFloat16" in DataView.prototype && "setFloat16" in DataView.prototype, _e = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
97
- function S(e) {
97
+ function ve(e) {
98
98
  _e.setFloat64(0, e, !1);
99
99
  let t = _e.getUint32(0, !1), n = _e.getUint32(4, !1), r = t >>> 31 & 1, i = t >>> 20 & 2047, a = t & 1048575;
100
100
  if (i === 2047) {
@@ -108,8 +108,8 @@ function S(e) {
108
108
  if (o <= 0) {
109
109
  if (o < -10) return r << 15;
110
110
  let e = 1 << 20 | a, t = 11 - o;
111
- t <= 20 ? (s = e >> t & 1023, c = e >> t - 1 & 1, l = (e & (1 << t - 1) - 1) != 0 || n !== 0) : (s = 0, c = 1, l = a !== 0 || n !== 0);
112
- } else s = a >> 10, c = a >> 9 & 1, l = (a & 511) != 0 || n !== 0;
111
+ t <= 20 ? (s = e >> t & 1023, c = e >> t - 1 & 1, l = !!(e & (1 << t - 1) - 1) || n !== 0) : (s = 0, c = 1, l = a !== 0 || n !== 0);
112
+ } else s = a >> 10, c = a >> 9 & 1, l = !!(a & 511) || n !== 0;
113
113
  if (c !== 0 && (l || s & 1) && s++, s >= 1024) {
114
114
  let e = o <= 0 ? 1 : o + 1;
115
115
  return e >= 31 ? r << 15 | 31744 : r << 15 | e << 10;
@@ -117,19 +117,19 @@ function S(e) {
117
117
  let u = o <= 0 ? 0 : o;
118
118
  return r << 15 | u << 10 | s;
119
119
  }
120
- function C(e) {
120
+ function j(e) {
121
121
  let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023;
122
122
  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);
123
123
  }
124
- var ve = ge ? (e, t, n, r) => {
124
+ var ye = ge ? (e, t, n, r) => {
125
125
  e.setFloat16(t, n, r);
126
126
  } : (e, t, n, r) => {
127
- e.setUint16(t, S(n), r);
128
- }, w = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8)), T = new Uint8Array(w.buffer), ye = new TextEncoder(), be = typeof ye.encodeInto == "function";
129
- function xe(e) {
127
+ e.setUint16(t, ve(n), r);
128
+ }, be = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8)), M = new Uint8Array(be.buffer), xe = new TextEncoder(), Se = typeof xe.encodeInto == "function";
129
+ function Ce(e) {
130
130
  return e <= 23 ? 1 : e <= 255 ? 2 : e <= 65535 ? 3 : e <= 4294967295 ? 5 : 9;
131
131
  }
132
- function Se(e) {
132
+ function we(e) {
133
133
  return e === "i" ? 1 : [
134
134
  2,
135
135
  3,
@@ -137,7 +137,7 @@ function Se(e) {
137
137
  9
138
138
  ][e];
139
139
  }
140
- var Ce = class {
140
+ var Te = class {
141
141
  buf;
142
142
  len = 0;
143
143
  constructor(e = 256) {
@@ -168,45 +168,45 @@ var Ce = class {
168
168
  t[this.len++] = e >>> 24 & 255, t[this.len++] = e >>> 16 & 255, t[this.len++] = e >>> 8 & 255, t[this.len++] = e & 255;
169
169
  }
170
170
  writeBigUint64(e) {
171
- w.setBigUint64(0, e, !1), this._ensure(8), this.buf.set(T, this.len), this.len += 8;
171
+ be.setBigUint64(0, e, !1), this._ensure(8), this.buf.set(M, this.len), this.len += 8;
172
172
  }
173
173
  writeFloat16(e) {
174
- ve(w, 0, e, !1), this._ensure(2);
174
+ ye(be, 0, e, !1), this._ensure(2);
175
175
  let t = this.buf;
176
- t[this.len++] = T[0], t[this.len++] = T[1];
176
+ t[this.len++] = M[0], t[this.len++] = M[1];
177
177
  }
178
178
  writeFloat32(e) {
179
- w.setFloat32(0, e, !1), this._ensure(4);
179
+ be.setFloat32(0, e, !1), this._ensure(4);
180
180
  let t = this.buf;
181
- t[this.len++] = T[0], t[this.len++] = T[1], t[this.len++] = T[2], t[this.len++] = T[3];
181
+ t[this.len++] = M[0], t[this.len++] = M[1], t[this.len++] = M[2], t[this.len++] = M[3];
182
182
  }
183
183
  writeFloat64(e) {
184
- w.setFloat64(0, e, !1), this._ensure(8), this.buf.set(T, this.len), this.len += 8;
184
+ be.setFloat64(0, e, !1), this._ensure(8), this.buf.set(M, this.len), this.len += 8;
185
185
  }
186
186
  writeTextString(e, t, n) {
187
- if (!be) {
188
- let r = ye.encode(t);
189
- E(this, e, r.length, n), this.writeBytes(r);
187
+ if (!Se) {
188
+ let r = xe.encode(t);
189
+ N(this, e, r.length, n), this.writeBytes(r);
190
190
  return;
191
191
  }
192
- let r = n === void 0 ? xe(t.length) : Se(n);
192
+ let r = n === void 0 ? Ce(t.length) : we(n);
193
193
  this._ensure(9 + 3 * t.length);
194
- let { written: i } = ye.encodeInto(t, this.buf.subarray(this.len + r)), a = n === void 0 ? xe(i) : r;
195
- a !== r && this.buf.copyWithin(this.len + a, this.len + r, this.len + r + i), E(this, e, i, n), this.len += i;
194
+ let { written: i } = xe.encodeInto(t, this.buf.subarray(this.len + r)), a = n === void 0 ? Ce(i) : r;
195
+ a !== r && this.buf.copyWithin(this.len + a, this.len + r, this.len + r + i), N(this, e, i, n), this.len += i;
196
196
  }
197
197
  finish() {
198
198
  return this.buf.slice(0, this.len);
199
199
  }
200
- }, we = [
200
+ }, Ee = [
201
201
  255n,
202
202
  65535n,
203
203
  4294967295n,
204
204
  18446744073709551615n
205
205
  ];
206
- function Te(e) {
207
- return e === "i" ? 23n : we[e];
206
+ function De(e) {
207
+ return e === "i" ? 23n : Ee[e];
208
208
  }
209
- function E(e, t, n, r) {
209
+ function N(e, t, n, r) {
210
210
  if (r === void 0 && typeof n == "number" && n < 4294967296) {
211
211
  n <= 23 ? e.writeByte(t << 5 | n) : n <= 255 ? (e.writeByte(t << 5 | 24), e.writeByte(n)) : n <= 65535 ? (e.writeByte(t << 5 | 25), e.writeUint16(n)) : (e.writeByte(t << 5 | 26), e.writeUint32(n));
212
212
  return;
@@ -218,42 +218,101 @@ function E(e, t, n, r) {
218
218
  e.writeByte(t << 5 | Number(i));
219
219
  return;
220
220
  }
221
- if (i > we[r]) throw RangeError(`value ${i} does not fit in encodingWidth _${r} (max ${we[r]})`);
221
+ if (i > Ee[r]) throw RangeError(`value ${i} does not fit in encodingWidth _${r} (max ${Ee[r]})`);
222
222
  let n = 24 + r;
223
223
  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);
224
224
  return;
225
225
  }
226
226
  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));
227
227
  }
228
- function Ee(e, t, n) {
229
- let r = new Ce(9);
230
- return E(r, e, t, n), r.finish();
228
+ function Oe(e, t, n) {
229
+ let r = new Te(9);
230
+ return N(r, e, t, n), r.finish();
231
231
  }
232
- var De = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4));
233
- function Oe(e) {
234
- return Object.is(C(S(e)), e);
232
+ var ke = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4));
233
+ function Ae(e) {
234
+ return Object.is(j(ve(e)), e);
235
235
  }
236
- function ke(e) {
237
- return De.setFloat32(0, e, !1), Object.is(De.getFloat32(0, !1), e);
236
+ function je(e) {
237
+ return ke.setFloat32(0, e, !1), Object.is(ke.getFloat32(0, !1), e);
238
238
  }
239
- function D(e) {
240
- return Oe(e) ? "half" : ke(e) ? "single" : "double";
239
+ function P(e) {
240
+ return Ae(e) ? "half" : je(e) ? "single" : "double";
241
241
  }
242
242
  //#endregion
243
243
  //#region src/ast/CborItem.ts
244
- function Ae(e) {
244
+ function Me(e) {
245
245
  return {
246
246
  ...e,
247
- preserveComments: e.preserveComments ?? !0,
247
+ preserveComments: e.comments === void 0 ? e.preserveComments ?? !0 : e.preserveComments,
248
248
  preserveByteString: e.preserveByteString ?? !0,
249
249
  preserveRawString: e.preserveRawString ?? !0,
250
250
  preserveConcatenation: e.preserveConcatenation ?? !0,
251
251
  preserveNumberFormat: e.preserveNumberFormat ?? !0,
252
- preserveAppSequence: e.preserveAppSequence ?? !0,
252
+ preserveAppPrefix: e.preserveAppPrefix ?? !0,
253
253
  preserveBlankLines: e.preserveBlankLines ?? !0
254
254
  };
255
255
  }
256
- var O = class e {
256
+ function Ne(e) {
257
+ return e.preserveAppSequence === void 0 && e.appStrings === void 0 ? e : {
258
+ ...e,
259
+ preserveAppPrefix: e.preserveAppPrefix ?? e.preserveAppSequence,
260
+ appPrefix: e.appPrefix ?? e.appStrings
261
+ };
262
+ }
263
+ function Pe(e) {
264
+ if (e.preserveAppSequence === void 0 && e.appStrings === void 0) return e;
265
+ let t = Ne(e), n = { ...e };
266
+ return t.preserveAppPrefix !== void 0 && (n.preserveAppPrefix = t.preserveAppPrefix), t.appPrefix !== void 0 && (n.appPrefix = t.appPrefix), n;
267
+ }
268
+ var Fe = Object.freeze([]);
269
+ function Ie(e) {
270
+ return !!(e?.itemOptions || e?.extensions?.length);
271
+ }
272
+ function Le(e) {
273
+ return e && {
274
+ ...e,
275
+ reviver: void 0
276
+ };
277
+ }
278
+ function Re(e) {
279
+ let { reviver: t, extensions: n, ...r } = e;
280
+ return n ? {
281
+ ...r,
282
+ extensions: [...n]
283
+ } : r;
284
+ }
285
+ var ze = Symbol("cbor.itemOptions.dispatchCache"), Be = Symbol("cbor.itemOptions.rawPass"), Ve = Object.freeze([]);
286
+ function He(e) {
287
+ return e?.[ze];
288
+ }
289
+ function Ue(e) {
290
+ let t = /* @__PURE__ */ new WeakMap();
291
+ return Object.assign({}, e, { [ze]: t });
292
+ }
293
+ function We(e, t) {
294
+ if (e.length !== t.length) return !1;
295
+ for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
296
+ return !0;
297
+ }
298
+ function Ge(e, t) {
299
+ return e?.find((e) => We(e.occurrence, t));
300
+ }
301
+ function Ke(e, t, n) {
302
+ let r = e.get(t);
303
+ r ? r.push(n) : e.set(t, [n]);
304
+ }
305
+ function qe(e) {
306
+ return !!e?.itemOptions;
307
+ }
308
+ function Je(e) {
309
+ let { textStringFormat: t, ...n } = e;
310
+ return delete n[Ye], t ? {
311
+ ...n,
312
+ textStringFormat: [...t]
313
+ } : n;
314
+ }
315
+ var Ye = Symbol("cdnOverrideTracker"), F = class e {
257
316
  start;
258
317
  end;
259
318
  comments;
@@ -269,11 +328,14 @@ var O = class e {
269
328
  get _containsCdnContainer() {
270
329
  return !1;
271
330
  }
331
+ _isMultiWordText(e, t = !0, n) {
332
+ return !1;
333
+ }
272
334
  toCBOR(e) {
273
335
  let t = this._defaults ? {
274
336
  ...this._defaults,
275
337
  ...e
276
- } : e, n = new Ce();
338
+ } : e, n = new Te();
277
339
  return this._encode(n, t), n.finish();
278
340
  }
279
341
  toCDN(e) {
@@ -281,11 +343,11 @@ var O = class e {
281
343
  ...this._defaults,
282
344
  ...e
283
345
  } : e;
284
- t?.preserveAll && (t = Ae(t));
285
- let n = this._toCDN(t, 0), r = t?.preserveComments;
286
- if (!r || v(t) === null) return n;
287
- let i = typeof r == "string" ? r : void 0, { ownLines: a, inlinePrefix: s } = ae(this, "", i), c = this.comments?.trailing ?? [], l = c.length === 0 ? n : `${n} ${c.map((e) => o(e, i).trimEnd()).join(" ")}`;
288
- return [...a, `${s}${l}`].join("\n");
346
+ t &&= Ne(t), t?.preserveAll && (t = Me(t));
347
+ let r = this._resolveCdnOptions(t, Fe, {}), i = this._toCDN(r, 0, Fe);
348
+ if (!n(r) || O(r) === null) return i;
349
+ let a = u(r), { ownLines: o, inlinePrefix: s } = c(this, "", a), l = this.comments?.trailing ?? [], d = l.length === 0 ? i : `${i} ${l.map((e) => b(e, a).trimEnd()).join(" ")}`;
350
+ return [...o, `${s}${d}`].join("\n");
289
351
  }
290
352
  toEDN(e) {
291
353
  return this.toCDN(e);
@@ -294,16 +356,18 @@ var O = class e {
294
356
  let t = this._defaults ? {
295
357
  ...this._defaults,
296
358
  ...e
297
- } : e, n = this._toJS(t);
359
+ } : e, n = Ie(t) ? this._toJSChild(Ue(t), Fe, Ve, {}) : this._toJS(t);
298
360
  if (!t?.reviver) return n;
299
361
  let r = t.reviver.call({ "": n }, "", n);
300
- return r === x ? void 0 : r;
362
+ return r === A ? void 0 : r;
301
363
  }
302
364
  toHexDump(e) {
303
365
  let t = this._defaults ? {
304
366
  ...this._defaults,
305
367
  ...e
306
- } : e, n = t?.indent ?? 3, r = typeof n == "string" ? n : " ".repeat(n), i = (t?.commentStyle ?? "--") + " ", a = this._toHexDump(0, t), o = 0;
368
+ } : e;
369
+ t &&= Ne(t);
370
+ let n = t?.indent ?? 3, r = typeof n == "string" ? n : " ".repeat(n), i = (t?.commentStyle ?? "--") + " ", a = this._toHexDump(0, t), o = 0;
307
371
  for (let e of a) {
308
372
  let t = e.depth * r.length + e.hex.length;
309
373
  t > o && (o = t);
@@ -323,17 +387,71 @@ var O = class e {
323
387
  t.writeBytes(this._toCBOR(n));
324
388
  }
325
389
  _toCBOR(e) {
326
- let t = new Ce();
390
+ let t = new Te();
327
391
  return this._encodeTo(t, e), t.finish();
328
392
  }
393
+ _resolveCdnOptions(e, t, n) {
394
+ if (!qe(e)) return e;
395
+ let r = n.isMapKey || t.length === 0 ? void 0 : t[t.length - 1], i = e.itemOptions(this, {
396
+ ...n,
397
+ key: r,
398
+ path: t,
399
+ options: Je(e)
400
+ });
401
+ if (!i) return e;
402
+ let a = e[Ye];
403
+ a && (a.applied = !0);
404
+ let o = {
405
+ ...e,
406
+ ...Pe(i)
407
+ };
408
+ return o.preserveAll && (o = Me(o)), o;
409
+ }
410
+ _toJSChild(e, t, n, r) {
411
+ let i = He(e), a = Ge(i?.get(this), n);
412
+ if (a) {
413
+ if (a.outcome.kind === "value") return a.outcome.value;
414
+ let r = a.outcome.override ? {
415
+ ...e,
416
+ ...a.outcome.override
417
+ } : e;
418
+ return this._toJS(r, t, n);
419
+ }
420
+ let o = r.isMapKey || t.length === 0 ? void 0 : t[t.length - 1], s = e, c;
421
+ if (e?.itemOptions && (c = e.itemOptions(this, {
422
+ ...r,
423
+ key: o,
424
+ path: t,
425
+ options: Re(e)
426
+ }), c && (s = {
427
+ ...e,
428
+ ...c
429
+ })), s?.extensions?.length) for (let e of s.extensions) {
430
+ let t = e.toJS?.(this, Re(s));
431
+ if (t) return i && Ke(i, this, {
432
+ occurrence: n,
433
+ outcome: {
434
+ kind: "value",
435
+ value: t.value
436
+ }
437
+ }), t.value;
438
+ }
439
+ return i && Ke(i, this, {
440
+ occurrence: n,
441
+ outcome: {
442
+ kind: "override",
443
+ override: c
444
+ }
445
+ }), this._toJS(s, t, n);
446
+ }
329
447
  _toHexDump(e, t) {
330
448
  return [{
331
449
  depth: e,
332
- hex: i(this._toCBOR()),
450
+ hex: l(this._toCBOR()),
333
451
  comment: this._toCDN(t, 0)
334
452
  }];
335
453
  }
336
- }, k = class extends O {
454
+ }, I = class extends F {
337
455
  value;
338
456
  encodingWidth;
339
457
  ednSource;
@@ -343,24 +461,24 @@ var O = class e {
343
461
  this.encodingWidth = t?.encodingWidth, this.ednSource = t?.ednSource;
344
462
  }
345
463
  _encodeTo(e, t) {
346
- E(e, 0, this.value, this.encodingWidth);
464
+ N(e, 0, this.value, this.encodingWidth);
347
465
  }
348
- _toCDN(e, t) {
349
- let n = a(e, this.encodingWidth, () => p(this.value));
350
- if (e?.preserveNumberFormat && this.ednSource !== void 0) return this.ednSource + n;
351
- let r = this.value;
466
+ _toCDN(e, n, r) {
467
+ let i = t(e, this.encodingWidth, () => E(this.value));
468
+ if (e?.preserveNumberFormat && this.ednSource !== void 0) return this.ednSource + i;
469
+ let a = this.value;
352
470
  switch (e?.intFormat) {
353
- case "hex": return `0x${r.toString(16)}${n}`;
354
- case "octal": return `0o${r.toString(8)}${n}`;
355
- case "binary": return `0b${r.toString(2)}${n}`;
356
- default: return r.toString() + n;
471
+ case "hex": return `0x${a.toString(16)}${i}`;
472
+ case "octal": return `0o${a.toString(8)}${i}`;
473
+ case "binary": return `0b${a.toString(2)}${i}`;
474
+ default: return a.toString() + i;
357
475
  }
358
476
  }
359
477
  _toJS(e) {
360
478
  let t = e?.integerAs ?? "auto";
361
479
  return t === "bigint" ? this.value : t === "number" || this.value <= BigInt(2 ** 53 - 1) ? Number(this.value) : this.value;
362
480
  }
363
- }, A = class extends O {
481
+ }, L = class extends F {
364
482
  argument;
365
483
  encodingWidth;
366
484
  ednSource;
@@ -375,25 +493,25 @@ var O = class e {
375
493
  return -1n - this.argument;
376
494
  }
377
495
  _encodeTo(e, t) {
378
- E(e, 1, this.argument, this.encodingWidth);
496
+ N(e, 1, this.argument, this.encodingWidth);
379
497
  }
380
- _toCDN(e, t) {
381
- let n = a(e, this.encodingWidth, () => p(this.argument));
382
- if (e?.preserveNumberFormat && this.ednSource !== void 0) return this.ednSource + n;
383
- let r = this.argument + 1n;
498
+ _toCDN(e, n, r) {
499
+ let i = t(e, this.encodingWidth, () => E(this.argument));
500
+ if (e?.preserveNumberFormat && this.ednSource !== void 0) return this.ednSource + i;
501
+ let a = this.argument + 1n;
384
502
  switch (e?.intFormat) {
385
- case "hex": return `-0x${r.toString(16)}${n}`;
386
- case "octal": return `-0o${r.toString(8)}${n}`;
387
- case "binary": return `-0b${r.toString(2)}${n}`;
388
- default: return this.value.toString() + n;
503
+ case "hex": return `-0x${a.toString(16)}${i}`;
504
+ case "octal": return `-0o${a.toString(8)}${i}`;
505
+ case "binary": return `-0b${a.toString(2)}${i}`;
506
+ default: return this.value.toString() + i;
389
507
  }
390
508
  }
391
509
  _toJS(e) {
392
510
  let t = this.value, n = e?.integerAs ?? "auto";
393
511
  return n === "bigint" ? t : n === "number" || t >= BigInt(-(2 ** 53 - 1)) ? Number(t) : t;
394
512
  }
395
- }, je = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
396
- function Me(e) {
513
+ }, Xe = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
514
+ function Ze(e) {
397
515
  let t = e.startsWith("-"), n = e.slice(t ? 3 : 2), r = n.search(/[pP]/);
398
516
  if (r === -1) throw SyntaxError(`EDN parse error: hex float missing 'p' exponent: ${e}`);
399
517
  let i = n.slice(0, r), a = n.slice(r + 1);
@@ -411,20 +529,23 @@ function Me(e) {
411
529
  let l = c * 2 ** o;
412
530
  return t ? -l : l;
413
531
  }
414
- function Ne(e) {
532
+ function Qe(e) {
415
533
  if (isNaN(e)) return "NaN";
416
534
  if (!isFinite(e)) return e > 0 ? "Infinity" : "-Infinity";
417
535
  let t = Object.is(e, -0) || e < 0, n = Math.abs(e);
418
536
  if (n === 0) return t ? "-0x0p+0" : "0x0p+0";
419
- je.setFloat64(0, n, !1);
420
- let r = je.getUint32(0, !1), i = je.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;
421
- a === 0 ? (u = "0", d = -1022) : (u = "1", d = a - 1023);
422
- let f = d >= 0 ? `+${d}` : `${d}`, p = `0x${u}${l}p${f}`;
423
- return t ? `-${p}` : p;
537
+ Xe.setFloat64(0, n, !1);
538
+ let r = Xe.getUint32(0, !1), i = Xe.getUint32(4, !1), a = r >>> 20 & 2047, o = r & 1048575, s = i, c, l;
539
+ if (a === 0) {
540
+ let e = BigInt(o) << 32n | BigInt(s), t = e.toString(2).length;
541
+ c = e - (1n << BigInt(t - 1)) << BigInt(52 - (t - 1)), l = t - 1075;
542
+ } else c = BigInt(o) << 32n | BigInt(s), l = a - 1023;
543
+ let u = c.toString(16).padStart(13, "0").replace(/0+$/, ""), d = `0x1${u === "" ? "" : `.${u}`}p${l >= 0 ? `+${l}` : `${l}`}`;
544
+ return t ? `-${d}` : d;
424
545
  }
425
546
  //#endregion
426
547
  //#region src/ast/CborFloat.ts
427
- var j = class extends O {
548
+ var R = class extends F {
428
549
  value;
429
550
  precision;
430
551
  ednSource;
@@ -434,38 +555,42 @@ var j = class extends O {
434
555
  super(), this.value = e, this.precision = t?.precision, this.rawBits = t?.rawBits, this.literalSource = t?.literalSource;
435
556
  }
436
557
  _encodeTo(e, t) {
437
- let n = this.precision ?? D(this.value), r = Number.isNaN(this.value) ? this.rawBits : void 0;
558
+ let n = this.precision ?? P(this.value), r = Number.isNaN(this.value) ? this.rawBits : void 0;
438
559
  n === "half" ? (e.writeByte(249), r?.length === 2 ? e.writeBytes(r) : e.writeFloat16(this.value)) : n === "single" ? (e.writeByte(250), r?.length === 4 ? e.writeBytes(r) : e.writeFloat32(this.value)) : (e.writeByte(251), r?.length === 8 ? e.writeBytes(r) : e.writeFloat64(this.value));
439
560
  }
440
- _toCDN(e, t) {
441
- let n = e?.encodingIndicators ?? "auto";
442
- if (e?.appStrings !== !1 && this.ednSource !== void 0 && (v(e) !== null || !/[\r\n]/.test(this.ednSource))) {
561
+ _toCDN(e, t, n) {
562
+ let r = e?.encodingIndicators ?? "auto";
563
+ if (e?.appPrefix !== !1 && (e?.floatFormat === void 0 || e?.floatFormat === "app-extension") && this.ednSource !== void 0 && (O(e) !== null || !/[\r\n]/.test(this.ednSource))) {
443
564
  let e = this.ednSource;
444
- if (n === "never") return e.replace(/_[0-3i]$/, "");
445
- if (n === "always") {
565
+ if (r === "never") return e.replace(/_[0-3i]$/, "");
566
+ if (r === "always") {
446
567
  if (/_[0-3i]$/.test(e)) return e;
447
- let t = this.precision ?? D(this.value);
568
+ let t = this.precision ?? P(this.value);
448
569
  return e + (t === "half" ? "_1" : t === "single" ? "_2" : "_3");
449
570
  }
450
571
  return e;
451
572
  }
452
573
  if (e?.preserveNumberFormat && this.literalSource !== void 0) {
453
574
  let e = this.literalSource;
454
- if (n === "never") return e.replace(/_[0-7i]$/, "");
455
- if (n === "always") {
575
+ if (r === "never") return e.replace(/_[0-7i]$/, "");
576
+ if (r === "always") {
456
577
  if (/_[0-7i]$/.test(e)) return e;
457
- let t = D(this.value);
458
- return e + ie(this.value, this.precision, t, "always");
578
+ let t = P(this.value);
579
+ return e + S(this.value, this.precision, t, "always");
459
580
  }
460
581
  return e;
461
582
  }
462
- let r = D(this.value);
463
- return (e?.floatFormat === "hex" ? Ne(this.value) : l(this.value)) + ie(this.value, this.precision, r, n);
583
+ let i = P(this.value);
584
+ if (e?.floatFormat === "app-extension" && e?.appPrefix !== !1) {
585
+ let e = this.toCBOR();
586
+ return `float'${s(e.subarray(1))}'` + S(this.value, this.precision, i, r);
587
+ }
588
+ return (e?.floatFormat === "hex" ? Qe(this.value) : re(this.value)) + S(this.value, this.precision, i, r);
464
589
  }
465
590
  _toJS(e) {
466
591
  return this.value;
467
592
  }
468
- }, M = class extends O {
593
+ }, z = class extends F {
469
594
  tag;
470
595
  content;
471
596
  encodingWidth;
@@ -477,35 +602,38 @@ var j = class extends O {
477
602
  get _containsCdnContainer() {
478
603
  return this.content._containsCdnContainer;
479
604
  }
605
+ _isMultiWordText(e, t = !0, n) {
606
+ return y(this._toCDN(e, 0, n), t);
607
+ }
480
608
  _encodeTo(e, t) {
481
- E(e, 6, this.tag, this.encodingWidth), this.content._encode(e, t);
609
+ N(e, 6, this.tag, this.encodingWidth), this.content._encode(e, t);
482
610
  }
483
- _toCDN(e, t) {
484
- let n = a(e, this.encodingWidth, () => p(this.tag));
485
- return `${e?.preserveNumberFormat && this.ednSource !== void 0 ? this.ednSource : this.tag.toString()}${n}${d(this.content, this, e, t, (t) => this.content._toCDN(e, t), "(", ")")}`;
611
+ _toCDN(e, n, r) {
612
+ let i = t(e, this.encodingWidth, () => E(this.tag)), a = e?.preserveNumberFormat && this.ednSource !== void 0 ? this.ednSource : this.tag.toString(), o = this.content._resolveCdnOptions(e, r ?? [], { parent: this });
613
+ return `${a}${i}${ae(this.content, this, e, o, n, (e) => this.content._toCDN(o, e, r), "(", ")")}`;
486
614
  }
487
615
  _toHexDump(e, t) {
488
616
  let n = [{
489
617
  depth: e,
490
- hex: i(Ee(6, this.tag, this.encodingWidth)),
618
+ hex: l(Oe(6, this.tag, this.encodingWidth)),
491
619
  comment: `Tag ${this.tag}`
492
620
  }];
493
- return n.push(...this.content._toHexDump(e + 1, {
621
+ return m(n, this.content._toHexDump(e + 1, {
494
622
  ...t,
495
- appStrings: !1
623
+ appPrefix: !1
496
624
  })), n;
497
625
  }
498
- _toJS(e) {
499
- let t = this.content._toJS(e);
500
- return e?.stripTags ? t : b.set(t, this.tag);
626
+ _toJS(e, t, n) {
627
+ let r = Ie(e) ? this.content._toJSChild(e, t ?? [], n ?? Ve, { parent: this }) : this.content._toJS(e);
628
+ return e?.stripTags ? r : k.set(r, this.tag);
501
629
  }
502
630
  };
503
631
  //#endregion
504
632
  //#region src/ast/CborByteString.ts
505
- function Pe(e, t, n) {
506
- if (e !== void 0) return t?.preserveComments || n === void 0 ? e : r(e, n);
633
+ function $e(e, t, r) {
634
+ if (e !== void 0) return n(t) || r === void 0 ? e : x(e, r);
507
635
  }
508
- var N = class extends O {
636
+ var B = class extends F {
509
637
  indefiniteLength = !1;
510
638
  value;
511
639
  ednEncoding;
@@ -516,29 +644,32 @@ var N = class extends O {
516
644
  constructor(e, t) {
517
645
  super(), this.value = e, this.ednEncoding = t?.ednEncoding ?? "hex", this.encodingWidth = t?.encodingWidth, this.ednSource = t?.ednSource, this.ednCommentSyntax = t?.ednCommentSyntax, this.ednParts = t?.ednParts;
518
646
  }
519
- _encodeTo(e, t) {
520
- E(e, 2, this.value.length, this.encodingWidth), e.writeBytes(this.value);
647
+ _isMultiWordText(e, t = !0, n) {
648
+ return C(this.value, e?.sqstr);
521
649
  }
522
- _toCDN(e, t) {
523
- let n = v(e);
524
- if (e?.preserveConcatenation && n !== null && this.ednParts !== void 0 && this.ednParts.length > 1) {
525
- let r = a(e, this.encodingWidth, () => p(BigInt(this.value.length))), i = e?.bstrEncoding ?? this.ednEncoding;
526
- e?.appStrings === !1 && i !== "hex" && (i = "hex");
527
- let o = this.ednParts.map((t) => {
528
- let n = e?.preserveByteString ? Pe(t.source, e, t.commentSyntax) : void 0;
529
- return n === void 0 ? oe(t.bytes, i, e?.sqstr) : n;
530
- });
531
- return o[o.length - 1] += r, f(o, n, t, e?.preserveComments ? ne(this.comments?.dangling, this.ednParts, typeof e.preserveComments == "string" ? e.preserveComments : void 0) : void 0);
650
+ _encodeTo(e, t) {
651
+ N(e, 2, this.value.length, this.encodingWidth), e.writeBytes(this.value);
652
+ }
653
+ _toCDN(e, r, i) {
654
+ let a = O(e);
655
+ if (e?.preserveConcatenation && a !== null && this.ednParts !== void 0 && this.ednParts.length > 1) {
656
+ let i = t(e, this.encodingWidth, () => E(BigInt(this.value.length))), o = e?.bstrEncoding ?? this.ednEncoding;
657
+ e?.appPrefix === !1 && o !== "hex" && (o = "hex");
658
+ let s = this.ednParts.map((t) => {
659
+ let n = e?.preserveByteString ? $e(t.source, e, t.commentSyntax) : void 0;
660
+ return n === void 0 ? d(t.bytes, o, e?.sqstr) : n;
661
+ }), c = n(e) ? p(this.comments?.dangling, this.ednParts, u(e)) : void 0;
662
+ return e?.modernConcat && e?.appPrefix !== !1 ? ie("b1", s, i, a, r, c) : (s[s.length - 1] += i, oe(s, a, r, c));
532
663
  }
533
- let r = e?.preserveByteString ? Pe(this.ednSource, e, this.ednCommentSyntax) : void 0;
534
- if (r !== void 0 && (n !== null || !/[\r\n]/.test(r))) return /_[0-3i]$/.test(r) ? (e?.encodingIndicators ?? "auto") === "never" ? r.replace(/_[0-3i]$/, "") : r : r + a(e, this.encodingWidth, () => p(BigInt(this.value.length)));
535
- let i = a(e, this.encodingWidth, () => p(BigInt(this.value.length))), o = e?.bstrEncoding ?? this.ednEncoding;
536
- return e?.appStrings === !1 && o !== "hex" && (o = "hex"), oe(this.value, o, e?.sqstr) + i;
664
+ let o = e?.preserveByteString ? $e(this.ednSource, e, this.ednCommentSyntax) : void 0;
665
+ if (o !== void 0 && (a !== null || !/[\r\n]/.test(o))) return /_[0-3i]$/.test(o) ? (e?.encodingIndicators ?? "auto") === "never" ? o.replace(/_[0-3i]$/, "") : o : o + t(e, this.encodingWidth, () => E(BigInt(this.value.length)));
666
+ let s = t(e, this.encodingWidth, () => E(BigInt(this.value.length))), c = e?.bstrEncoding ?? this.ednEncoding;
667
+ return e?.appPrefix === !1 && c !== "hex" && (c = "hex"), d(this.value, c, e?.sqstr) + s;
537
668
  }
538
669
  _toJS(e) {
539
670
  return this.value;
540
671
  }
541
- }, P = class extends O {
672
+ }, V = class extends F {
542
673
  indefiniteLength = !0;
543
674
  chunks;
544
675
  constructor(e) {
@@ -549,46 +680,55 @@ var N = class extends O {
549
680
  for (let n of this.chunks) n._encode(e, t);
550
681
  e.writeByte(255);
551
682
  }
552
- _toCDN(e, t) {
683
+ _isMultiWordText(e, t = !0) {
684
+ return this.chunks.some((t) => t._isMultiWordText(e));
685
+ }
686
+ _toCDN(e, t, n) {
553
687
  if ((e?.encodingIndicators ?? "auto") === "never") {
554
688
  let n = this.chunks.reduce((e, t) => e + t.value.length, 0), r = new Uint8Array(n), i = 0;
555
689
  for (let e of this.chunks) r.set(e.value, i), i += e.value.length;
556
- return new N(r)._toCDN(e, t);
690
+ return new B(r)._toCDN(e, t);
557
691
  }
558
- return this.chunks.length === 0 ? "''_" : s({
692
+ let i = n ?? [], a = qe(e), o = (t) => a ? this.chunks[t]._resolveCdnOptions(e, [...i, t], { parent: this }) : e, s = !!e?.modernStreamSyntax && e?.appPrefix !== !1;
693
+ return !s && this.chunks.length === 0 ? "''_" : r({
559
694
  node: this,
560
695
  options: e,
561
696
  depth: t,
562
- openChar: "(",
563
- closeChar: ")",
697
+ openChar: s ? "ilbs<<" : "(",
698
+ closeChar: s ? ">>" : ")",
564
699
  count: this.chunks.length,
565
700
  indefiniteLength: !0,
701
+ indefiniteMarker: !s,
566
702
  encodingWidth: void 0,
567
- hasEntryComments: () => this.chunks.some(h),
568
- renderEntry: (n) => this.chunks[n]._toCDN(e, t + 1),
703
+ hasEntryComments: (e) => _(this.chunks[e]),
704
+ renderEntry: (e) => this.chunks[e]._toCDN(o(e), t + 1, a ? [...i, e] : void 0),
705
+ entryIsLeaf: s ? void 0 : () => !0,
706
+ alwaysInlineLeaf: s,
707
+ entryIsMultiWordText: (e) => this.chunks[e]._isMultiWordText(o(e), !s, a ? [...i, e] : void 0),
569
708
  entryLeadingNode: (e) => this.chunks[e],
570
- entryTrailing: (e, t) => u(this.chunks[e], t)
709
+ entryTrailing: (e, t) => g(this.chunks[e], t),
710
+ entryOptions: a ? o : void 0
571
711
  });
572
712
  }
573
- _toHexDump(t, n) {
574
- let r = [{
575
- depth: t,
576
- hex: e(95),
713
+ _toHexDump(e, t) {
714
+ let n = [{
715
+ depth: e,
716
+ hex: o(95),
577
717
  comment: "Start indefinite-length byte string"
578
718
  }];
579
- for (let e of this.chunks) r.push(...e._toHexDump(t + 1, n));
580
- return r.push({
581
- depth: t,
582
- hex: e(255),
719
+ for (let r of this.chunks) m(n, r._toHexDump(e + 1, t));
720
+ return n.push({
721
+ depth: e,
722
+ hex: o(255),
583
723
  comment: "\"break\""
584
- }), r;
724
+ }), n;
585
725
  }
586
726
  _toJS(e) {
587
727
  let t = this.chunks.reduce((e, t) => e + t.value.length, 0), n = new Uint8Array(t), r = 0;
588
728
  for (let e of this.chunks) n.set(e.value, r), r += e.value.length;
589
729
  return n;
590
730
  }
591
- }, F = class extends O {
731
+ }, H = class extends F {
592
732
  indefiniteLength = !0;
593
733
  chunks;
594
734
  constructor(e) {
@@ -599,39 +739,49 @@ var N = class extends O {
599
739
  for (let n of this.chunks) n._encode(e, t);
600
740
  e.writeByte(255);
601
741
  }
602
- _toCDN(e, t) {
603
- return (e?.encodingIndicators ?? "auto") === "never" ? new G(this.chunks.map((e) => e.value).join(""))._toCDN(e, t) : this.chunks.length === 0 ? "\"\"_" : s({
742
+ _isMultiWordText(e, t = !0) {
743
+ return this.chunks.some((t) => t._isMultiWordText(e));
744
+ }
745
+ _toCDN(e, t, n) {
746
+ if ((e?.encodingIndicators ?? "auto") === "never") return new Y(this.chunks.map((e) => e.value).join(""))._toCDN(e, t);
747
+ let i = n ?? [], a = qe(e), o = (t) => a ? this.chunks[t]._resolveCdnOptions(e, [...i, t], { parent: this }) : e, s = !!e?.modernStreamSyntax && e?.appPrefix !== !1;
748
+ return !s && this.chunks.length === 0 ? "\"\"_" : r({
604
749
  node: this,
605
750
  options: e,
606
751
  depth: t,
607
- openChar: "(",
608
- closeChar: ")",
752
+ openChar: s ? "ilts<<" : "(",
753
+ closeChar: s ? ">>" : ")",
609
754
  count: this.chunks.length,
610
755
  indefiniteLength: !0,
756
+ indefiniteMarker: !s,
611
757
  encodingWidth: void 0,
612
- hasEntryComments: () => this.chunks.some(h),
613
- renderEntry: (n) => this.chunks[n]._toCDN(e, t + 1),
758
+ hasEntryComments: (e) => _(this.chunks[e]),
759
+ renderEntry: (e) => this.chunks[e]._toCDN(o(e), t + 1, a ? [...i, e] : void 0),
760
+ entryIsLeaf: s ? void 0 : () => !0,
761
+ alwaysInlineLeaf: s,
762
+ entryIsMultiWordText: (e) => this.chunks[e]._isMultiWordText(o(e), !s, a ? [...i, e] : void 0),
614
763
  entryLeadingNode: (e) => this.chunks[e],
615
- entryTrailing: (e, t) => u(this.chunks[e], t)
764
+ entryTrailing: (e, t) => g(this.chunks[e], t),
765
+ entryOptions: a ? o : void 0
616
766
  });
617
767
  }
618
- _toHexDump(t, n) {
619
- let r = [{
620
- depth: t,
621
- hex: e(127),
768
+ _toHexDump(e, t) {
769
+ let n = [{
770
+ depth: e,
771
+ hex: o(127),
622
772
  comment: "Start indefinite-length text string"
623
773
  }];
624
- for (let e of this.chunks) r.push(...e._toHexDump(t + 1, n));
625
- return r.push({
626
- depth: t,
627
- hex: e(255),
774
+ for (let r of this.chunks) m(n, r._toHexDump(e + 1, t));
775
+ return n.push({
776
+ depth: e,
777
+ hex: o(255),
628
778
  comment: "\"break\""
629
- }), r;
779
+ }), n;
630
780
  }
631
781
  _toJS(e) {
632
782
  return this.chunks.map((e) => e.value).join("");
633
783
  }
634
- }, I = class extends O {
784
+ }, U = class extends F {
635
785
  items;
636
786
  indefiniteLength;
637
787
  encodingWidth;
@@ -648,11 +798,12 @@ var N = class extends O {
648
798
  e.writeByte(255);
649
799
  return;
650
800
  }
651
- E(e, 4, this.items.length, this.encodingWidth);
801
+ N(e, 4, this.items.length, this.encodingWidth);
652
802
  for (let n of this.items) n._encode(e, t);
653
803
  }
654
- _toCDN(e, t) {
655
- return s({
804
+ _toCDN(e, t, n) {
805
+ let i = n ?? [], a = qe(e), o = (t) => a ? this.items[t]._resolveCdnOptions(e, [...i, t], { parent: this }) : e;
806
+ return r({
656
807
  node: this,
657
808
  options: e,
658
809
  depth: t,
@@ -661,49 +812,52 @@ var N = class extends O {
661
812
  count: this.items.length,
662
813
  indefiniteLength: this.indefiniteLength,
663
814
  encodingWidth: this.encodingWidth,
664
- hasEntryComments: () => this.items.some(h),
665
- renderEntry: (n) => this.items[n]._toCDN(e, t + 1),
815
+ hasEntryComments: (e) => _(this.items[e]),
816
+ renderEntry: (e) => this.items[e]._toCDN(o(e), t + 1, a ? [...i, e] : void 0),
666
817
  entryIsLeaf: (e) => !this.items[e]._containsCdnContainer,
818
+ entryIsMultiWordText: (e) => this.items[e]._isMultiWordText(o(e), !0, a ? [...i, e] : void 0),
667
819
  entryLeadingNode: (e) => this.items[e],
668
- entryTrailing: (e, t) => u(this.items[e], t)
820
+ entryTrailing: (e, t) => g(this.items[e], t),
821
+ entryOptions: a ? o : void 0
669
822
  });
670
823
  }
671
- _toHexDump(t, n) {
824
+ _toHexDump(e, t) {
672
825
  if (this.indefiniteLength) {
673
- let r = [{
674
- depth: t,
675
- hex: e(159),
826
+ let n = [{
827
+ depth: e,
828
+ hex: o(159),
676
829
  comment: "Start indefinite-length array"
677
830
  }];
678
- for (let e of this.items) r.push(...e._toHexDump(t + 1, n));
679
- return r.push({
680
- depth: t,
681
- hex: e(255),
831
+ for (let r of this.items) m(n, r._toHexDump(e + 1, t));
832
+ return n.push({
833
+ depth: e,
834
+ hex: o(255),
682
835
  comment: "\"break\""
683
- }), r;
836
+ }), n;
684
837
  }
685
- let r = [{
686
- depth: t,
687
- hex: i(Ee(4, BigInt(this.items.length), this.encodingWidth)),
838
+ let n = [{
839
+ depth: e,
840
+ hex: l(Oe(4, BigInt(this.items.length), this.encodingWidth)),
688
841
  comment: `Array of length ${this.items.length}`
689
842
  }];
690
- for (let e of this.items) r.push(...e._toHexDump(t + 1, n));
691
- return r;
843
+ for (let r of this.items) m(n, r._toHexDump(e + 1, t));
844
+ return n;
692
845
  }
693
- _toJS(e) {
694
- let t = e?.reviver;
695
- if (!t) return this.items.map((t) => t._toJS(e));
696
- let n = e ? {
697
- ...e,
698
- reviver: void 0
699
- } : void 0, r = this.items.map((e) => e._toJS(n)), i = 0;
700
- for (let n = 0; n < this.items.length; n++) {
701
- let a = n - i, o = this.items[n]._toJS(e), s = t.call(r, String(n), o);
702
- s === x || e?.undefinedOmits && s === void 0 ? (r.splice(a, 1), i++) : r[a] = s;
846
+ _toJS(e, t, n) {
847
+ let r = e?.reviver, i = Ie(e), a = n ?? Ve, o = (e, n, r, o) => i ? e._toJSChild(r, [...t ?? [], n], o ? [
848
+ ...a,
849
+ Be,
850
+ n
851
+ ] : [...a, n], { parent: this }) : e._toJS(r);
852
+ if (!r) return this.items.map((t, n) => o(t, n, e, !1));
853
+ let s = Le(e), c = this.items.map((e, t) => o(e, t, s, !0)), l = 0;
854
+ for (let t = 0; t < this.items.length; t++) {
855
+ let n = t - l, i = o(this.items[t], t, e, !1), a = r.call(c, String(t), i);
856
+ a === A || e?.undefinedOmits && a === void 0 ? (c.splice(n, 1), l++) : c[n] = a;
703
857
  }
704
- return r;
858
+ return c;
705
859
  }
706
- }, L = class extends O {
860
+ }, W = class extends F {
707
861
  entries;
708
862
  indefiniteLength;
709
863
  encodingWidth;
@@ -720,11 +874,46 @@ var N = class extends O {
720
874
  e.writeByte(255);
721
875
  return;
722
876
  }
723
- E(e, 5, this.entries.length, this.encodingWidth);
877
+ N(e, 5, this.entries.length, this.encodingWidth);
724
878
  for (let [n, r] of this.entries) n._encode(e, t), r._encode(e, t);
725
879
  }
726
- _toCDN(e, t) {
727
- return s({
880
+ _toCDN(e, t, n) {
881
+ let i = n ?? [], a = qe(e), o = [], s = (t) => {
882
+ let n = o[t];
883
+ if (!n) {
884
+ let [r, s] = this.entries[t];
885
+ if (!a) n = [
886
+ void 0,
887
+ e,
888
+ e
889
+ ];
890
+ else {
891
+ let t = r instanceof Y ? r.value : r.toCDN();
892
+ n = [
893
+ t,
894
+ r._resolveCdnOptions(e, i, {
895
+ parent: this,
896
+ isMapKey: !0,
897
+ keyNode: r
898
+ }),
899
+ s._resolveCdnOptions(e, [...i, t], {
900
+ parent: this,
901
+ keyNode: r
902
+ })
903
+ ];
904
+ }
905
+ o[t] = n;
906
+ }
907
+ return n;
908
+ }, c = [], l = (e) => {
909
+ let n = c[e];
910
+ if (!n) {
911
+ let [r, o] = this.entries[e], [l, u, d] = s(e);
912
+ n = [r._toCDN(u, t + 1, a ? i : void 0), o._toCDN(d, t + 1, a ? [...i, l] : void 0)], c[e] = n;
913
+ }
914
+ return n;
915
+ };
916
+ return r({
728
917
  node: this,
729
918
  options: e,
730
919
  depth: t,
@@ -733,100 +922,125 @@ var N = class extends O {
733
922
  count: this.entries.length,
734
923
  indefiniteLength: this.indefiniteLength,
735
924
  encodingWidth: this.encodingWidth,
736
- hasEntryComments: () => this.entries.some(([e, t]) => h(e) || h(t)),
737
- renderEntry: (n, r) => {
738
- let [i, a] = this.entries[n];
739
- return `${i._toCDN(e, t + 1)}${r}${a._toCDN(e, t + 1)}`;
925
+ hasEntryComments: (e) => {
926
+ let [t, n] = this.entries[e];
927
+ return _(t) || _(n);
928
+ },
929
+ renderEntry: (e, t) => {
930
+ let [n, r] = l(e);
931
+ return `${n}${t}${r}`;
740
932
  },
741
933
  entryIsLeaf: (e) => {
742
934
  let [t, n] = this.entries[e];
743
935
  return !t._containsCdnContainer && !n._containsCdnContainer;
744
936
  },
937
+ entryIsMultiWordText: (e) => {
938
+ let [t, n] = this.entries[e], [r, o, c] = s(e), u = a ? i : void 0, d = a ? [...i, r] : void 0;
939
+ if (t._isMultiWordText(o, !0, u) || n._isMultiWordText(c, !0, d)) return !0;
940
+ let [p, m] = l(e);
941
+ return f(p) || f(m);
942
+ },
745
943
  entryLeadingNode: (e) => this.entries[e][0],
746
944
  entryTrailing: (e, t) => {
747
945
  let [n, r] = this.entries[e];
748
- return Fe([
946
+ return et([
749
947
  ...n.comments?.trailing ?? [],
750
948
  ...r.comments?.leading ?? [],
751
949
  ...r.comments?.trailing ?? []
752
950
  ], t);
753
- }
951
+ },
952
+ entryOptions: a ? (e) => s(e)[1] : void 0
754
953
  });
755
954
  }
756
- _toHexDump(t, n) {
955
+ _toHexDump(e, t) {
757
956
  if (this.indefiniteLength) {
758
- let r = [{
759
- depth: t,
760
- hex: e(191),
957
+ let n = [{
958
+ depth: e,
959
+ hex: o(191),
761
960
  comment: "Start indefinite-length map"
762
961
  }];
763
- for (let [e, i] of this.entries) r.push(...e._toHexDump(t + 1, n)), r.push(...i._toHexDump(t + 1, n));
764
- return r.push({
765
- depth: t,
766
- hex: e(255),
962
+ for (let [r, i] of this.entries) m(n, r._toHexDump(e + 1, t)), m(n, i._toHexDump(e + 1, t));
963
+ return n.push({
964
+ depth: e,
965
+ hex: o(255),
767
966
  comment: "\"break\""
768
- }), r;
967
+ }), n;
769
968
  }
770
- let r = [{
771
- depth: t,
772
- hex: i(Ee(5, BigInt(this.entries.length), this.encodingWidth)),
969
+ let n = [{
970
+ depth: e,
971
+ hex: l(Oe(5, BigInt(this.entries.length), this.encodingWidth)),
773
972
  comment: `Map of length ${this.entries.length}`
774
973
  }];
775
- for (let [e, i] of this.entries) r.push(...e._toHexDump(t + 1, n)), r.push(...i._toHexDump(t + 1, n));
776
- return r;
974
+ for (let [r, i] of this.entries) m(n, r._toHexDump(e + 1, t)), m(n, i._toHexDump(e + 1, t));
975
+ return n;
777
976
  }
778
- _toJS(e) {
779
- let t = e?.reviver, n = () => {
780
- let n = $.from(this.entries, ([t, n]) => [t._toJS(e), n._toJS(e)]);
781
- if (!t) return n;
782
- let r = e?.undefinedOmits;
977
+ _toJS(e, t, n) {
978
+ let r = e?.reviver, i = Ie(e), a = t ?? [], o = n ?? Ve, s = () => {
979
+ let t = (e, t, n, r) => {
980
+ if (!i) return [e._toJS(r), t._toJS(r)];
981
+ let s = e._toJSChild(r, a, [...o, `k${n}`], {
982
+ parent: this,
983
+ isMapKey: !0,
984
+ keyNode: e
985
+ });
986
+ return [s, t._toJSChild(r, [...a, s], [...o, `v${n}`], {
987
+ parent: this,
988
+ keyNode: e
989
+ })];
990
+ }, n = $.from(this.entries, ([n, r], i) => t(n, r, i, e));
991
+ if (!r) return n;
992
+ let s = e?.undefinedOmits;
783
993
  for (let e = 0; e < n.length; e++) {
784
- let [i, a] = n[e], o = t.call(n, i, a);
785
- o === x || r && o === void 0 ? n.splice(e--, 1) : n[e] = [i, o];
994
+ let [t, i] = n[e], a = r.call(n, t, i);
995
+ a === A || s && a === void 0 ? n.splice(e--, 1) : n[e] = [t, a];
786
996
  }
787
997
  return n;
788
998
  };
789
- return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof G) ? (() => {
790
- let n = e ? {
791
- ...e,
792
- reviver: void 0
793
- } : void 0, r = {};
794
- for (let [e, t] of this.entries) {
795
- let i = e instanceof G ? e.value : e.toCDN(), a = t._toJS(n);
796
- i === "__proto__" ? Object.defineProperty(r, i, {
797
- value: a,
999
+ return e?.mapAs === "entries" ? s() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof Y) ? (() => {
1000
+ let t = (e, t, n, r, s, c) => i ? t._toJSChild(s, [...a, n], c ? [
1001
+ ...o,
1002
+ Be,
1003
+ `v${r}`
1004
+ ] : [...o, `v${r}`], {
1005
+ parent: this,
1006
+ keyNode: e
1007
+ }) : t._toJS(s), n = Le(e), s = {};
1008
+ for (let e = 0; e < this.entries.length; e++) {
1009
+ let [i, a] = this.entries[e], o = i instanceof Y ? i.value : i.toCDN(), c = t(i, a, o, e, n, !!r);
1010
+ o === "__proto__" ? Object.defineProperty(s, o, {
1011
+ value: c,
798
1012
  writable: !0,
799
1013
  enumerable: !0,
800
1014
  configurable: !0
801
- }) : r[i] = a;
1015
+ }) : s[o] = c;
802
1016
  }
803
- if (!t) return r;
804
- let i = /* @__PURE__ */ new Map();
1017
+ if (!r) return s;
1018
+ let c = /* @__PURE__ */ new Map();
805
1019
  for (let e = 0; e < this.entries.length; e++) {
806
1020
  let [t] = this.entries[e];
807
- i.set(t instanceof G ? t.value : t.toCDN(), e);
1021
+ c.set(t instanceof Y ? t.value : t.toCDN(), e);
808
1022
  }
809
1023
  for (let n = 0; n < this.entries.length; n++) {
810
- let [a, o] = this.entries[n], s = a instanceof G ? a.value : a.toCDN();
811
- if (i.get(s) !== n) continue;
812
- let c = o._toJS(e), l = t.call(r, s, c);
813
- l === x || e?.undefinedOmits && l === void 0 ? delete r[s] : s === "__proto__" ? Object.defineProperty(r, s, {
814
- value: l,
1024
+ let [i, a] = this.entries[n], o = i instanceof Y ? i.value : i.toCDN();
1025
+ if (c.get(o) !== n) continue;
1026
+ let l = t(i, a, o, n, e, !1), u = r.call(s, o, l);
1027
+ u === A || e?.undefinedOmits && u === void 0 ? delete s[o] : o === "__proto__" ? Object.defineProperty(s, o, {
1028
+ value: u,
815
1029
  writable: !0,
816
1030
  enumerable: !0,
817
1031
  configurable: !0
818
- }) : r[s] = l;
1032
+ }) : s[o] = u;
819
1033
  }
820
- return r;
821
- })() : n();
1034
+ return s;
1035
+ })() : s();
822
1036
  }
823
1037
  };
824
- function Fe(e, t) {
825
- return e.length === 0 ? "" : " " + e.map((e) => o(e, t).trimEnd()).join(" ");
1038
+ function et(e, t) {
1039
+ return e.length === 0 ? "" : " " + e.map((e) => b(e, t).trimEnd()).join(" ");
826
1040
  }
827
1041
  //#endregion
828
1042
  //#region src/ast/CborSimple.ts
829
- var R = class e extends O {
1043
+ var G = class e extends F {
830
1044
  value;
831
1045
  ednSource;
832
1046
  constructor(e, t) {
@@ -863,7 +1077,7 @@ var R = class e extends O {
863
1077
  default: return new he(this.value);
864
1078
  }
865
1079
  }
866
- }, z = class extends O {
1080
+ }, K = class extends F {
867
1081
  items;
868
1082
  encodingWidth;
869
1083
  constructor(e, t) {
@@ -873,16 +1087,17 @@ var R = class e extends O {
873
1087
  return this.items.some((e) => e._containsCdnContainer);
874
1088
  }
875
1089
  _content(e) {
876
- let t = new Ce();
1090
+ let t = new Te();
877
1091
  for (let n of this.items) n._encode(t, e);
878
1092
  return t.finish();
879
1093
  }
880
1094
  _encodeTo(e, t) {
881
1095
  let n = this._content(t);
882
- E(e, 2, n.length, this.encodingWidth), e.writeBytes(n);
1096
+ N(e, 2, n.length, this.encodingWidth), e.writeBytes(n);
883
1097
  }
884
- _toCDN(e, t) {
885
- return s({
1098
+ _toCDN(e, t, n) {
1099
+ let i = n ?? [], a = qe(e), o = (t) => a ? this.items[t]._resolveCdnOptions(e, [...i, t], { parent: this }) : e;
1100
+ return r({
886
1101
  node: this,
887
1102
  options: e,
888
1103
  depth: t,
@@ -893,19 +1108,22 @@ var R = class e extends O {
893
1108
  encodingWidth: this.encodingWidth,
894
1109
  eiPosition: "close",
895
1110
  canonicalCount: () => BigInt(this._content(e).length),
896
- hasEntryComments: () => this.items.some(h),
897
- renderEntry: (n) => this.items[n]._toCDN(e, t + 1),
1111
+ hasEntryComments: (e) => _(this.items[e]),
1112
+ renderEntry: (e) => this.items[e]._toCDN(o(e), t + 1, a ? [...i, e] : void 0),
1113
+ alwaysInlineLeaf: !0,
1114
+ entryIsMultiWordText: (e) => this.items[e]._isMultiWordText(o(e), !1, a ? [...i, e] : void 0),
898
1115
  entryLeadingNode: (e) => this.items[e],
899
- entryTrailing: (e, t) => u(this.items[e], t)
1116
+ entryTrailing: (e, t) => g(this.items[e], t),
1117
+ entryOptions: a ? o : void 0
900
1118
  });
901
1119
  }
902
1120
  _toHexDump(e, t) {
903
1121
  let n = this._content().length, r = [{
904
1122
  depth: e,
905
- hex: i(Ee(2, BigInt(n), this.encodingWidth)),
1123
+ hex: l(Oe(2, BigInt(n), this.encodingWidth)),
906
1124
  comment: `Embedded CBOR sequence, ${n} byte${n === 1 ? "" : "s"}`
907
1125
  }];
908
- for (let n of this.items) r.push(...n._toHexDump(e + 1, t));
1126
+ for (let n of this.items) m(r, n._toHexDump(e + 1, t));
909
1127
  return r;
910
1128
  }
911
1129
  _toJS(e) {
@@ -914,7 +1132,7 @@ var R = class e extends O {
914
1132
  };
915
1133
  //#endregion
916
1134
  //#region src/utils/strip-comments.ts
917
- function Ie(e) {
1135
+ function tt(e) {
918
1136
  let t = "", n = 0;
919
1137
  for (; n < e.length;) {
920
1138
  let r = e[n];
@@ -933,7 +1151,7 @@ function Ie(e) {
933
1151
  continue;
934
1152
  }
935
1153
  if (t === "*") {
936
- for (n += 2; n < e.length && !(e[n] === "*" && (e[n + 1] ?? "") === "/");) n++;
1154
+ for (n += 2; n < e.length && (e[n] !== "*" || (e[n + 1] ?? "") !== "/");) n++;
937
1155
  if (n >= e.length) throw SyntaxError("unterminated block comment");
938
1156
  n += 2;
939
1157
  continue;
@@ -949,14 +1167,14 @@ function Ie(e) {
949
1167
  }
950
1168
  //#endregion
951
1169
  //#region src/extensions/b32.ts
952
- var Le = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", Re = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
953
- function ze(e) {
1170
+ var nt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", rt = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
1171
+ function it(e) {
954
1172
  let t = e.length;
955
1173
  for (; t > 0 && e.charCodeAt(t - 1) === 61;) t--;
956
1174
  return e.slice(0, t);
957
1175
  }
958
- function Be(e, t, n) {
959
- let r = ze(e).toUpperCase(), i = r.length % 8;
1176
+ function at(e, t, n) {
1177
+ let r = it(e).toUpperCase(), i = r.length % 8;
960
1178
  if (i === 1 || i === 3 || i === 6) throw SyntaxError(`invalid base32 length: ${r.length} characters`);
961
1179
  let a = (/* @__PURE__ */ new Uint8Array(128)).fill(255);
962
1180
  for (let e = 0; e < t.length; e++) a[t.charCodeAt(e)] = e;
@@ -973,69 +1191,27 @@ function Be(e, t, n) {
973
1191
  }
974
1192
  return o;
975
1193
  }
976
- var Ve = {
1194
+ var ot = {
977
1195
  appStringPrefixes: ["b32"],
978
1196
  parseAppString(e, t, n) {
979
- return new N(Be(Ie(t), Le, n), { ednEncoding: "base32" });
1197
+ return new B(at(tt(t), nt, n), { ednEncoding: "base32" });
980
1198
  }
981
- }, He = {
1199
+ }, st = {
982
1200
  appStringPrefixes: ["h32"],
983
1201
  parseAppString(e, t, n) {
984
- return new N(Be(Ie(t), Re, n), { ednEncoding: "base32hex" });
985
- }
986
- };
987
- //#endregion
988
- //#region src/utils/base64.ts
989
- function Ue(e, t) {
990
- let n = e.indexOf("="), r = n >= 0 ? e.slice(0, n) : e, i = n >= 0 ? e.slice(n) : "";
991
- if (/[^A-Za-z0-9+/\-_]/.test(r)) {
992
- let e = [...r].find((e) => !/[A-Za-z0-9+/\-_]/.test(e)) ?? "";
993
- throw SyntaxError(`invalid character ${JSON.stringify(e)} in base64 data`);
994
- }
995
- if (i && !/^=+$/.test(i)) throw SyntaxError("invalid character after base64 '=' padding");
996
- let a = r.length % 4;
997
- if (a === 1) throw SyntaxError(`invalid base64 length: ${r.length} data characters (length mod 4 = 1 is never valid)`);
998
- let o = a === 0 ? 0 : 4 - a;
999
- if (i.length > o) {
1000
- let e = `base64 has ${i.length} '=' character${i.length > 1 ? "s" : ""} but the data length (${r.length}) requires at most ${o}`;
1001
- if (t) t(e);
1002
- else throw SyntaxError(e);
1003
- }
1004
- if (i.length > 0 && i.length < o) {
1005
- let e = `base64 has ${i.length} '=' character${i.length > 1 ? "s" : ""} but needs exactly ${o} — use full padding or no padding at all`;
1006
- if (t) t(e);
1007
- else throw SyntaxError(e);
1008
- }
1009
- if (a !== 0 && r.length > 0) {
1010
- let e = r[r.length - 1].replace("-", "+").replace("_", "/"), n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e);
1011
- if (n >= 0 && n & (a === 2 ? 15 : 3)) {
1012
- let e = "base64 has non-zero trailing bits in the final quantum (RFC 4648 §3.5)";
1013
- if (t) t(e);
1014
- else throw SyntaxError(e);
1015
- }
1202
+ return new B(at(tt(t), rt, n), { ednEncoding: "base32hex" });
1016
1203
  }
1017
- let s = r.replace(/-/g, "+").replace(/_/g, "/") + "=".repeat(o);
1018
- if (typeof Uint8Array.fromBase64 == "function") return Uint8Array.fromBase64(s, {
1019
- alphabet: "base64",
1020
- lastChunkHandling: "loose"
1021
- });
1022
- let c = atob(s), l = new Uint8Array(c.length);
1023
- for (let e = 0; e < c.length; e++) l[e] = c.charCodeAt(e);
1024
- return l;
1025
- }
1026
- //#endregion
1027
- //#region src/ast/CborUnresolvedAppExt.ts
1028
- var We = 999n, Ge = class extends M {
1204
+ }, ct = 999n, lt = class extends z {
1029
1205
  constructor(e, t) {
1030
- let n = t.length === 1 && t[0] instanceof G ? t[0] : new I(t);
1031
- super(We, new I([new G(e), n]));
1206
+ let n = t.length === 1 && t[0] instanceof Y ? t[0] : new U(t);
1207
+ super(ct, new U([new Y(e), n]));
1032
1208
  }
1033
1209
  _toCDN(e, t) {
1034
- if (e?.appStrings === !1) return super._toCDN(e, t);
1210
+ if (e?.appPrefix === !1) return super._toCDN(e, t);
1035
1211
  let n = this.content, r = n.items[0].value, i = n.items[1];
1036
- return i instanceof G ? `${r}${c(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
1212
+ return i instanceof Y ? `${r}${ne(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
1037
1213
  }
1038
- }, B = class extends O {
1214
+ }, ut = class extends F {
1039
1215
  inner;
1040
1216
  ednSource;
1041
1217
  constructor(e, t) {
@@ -1044,140 +1220,154 @@ var We = 999n, Ge = class extends M {
1044
1220
  get _containsCdnContainer() {
1045
1221
  return this.inner._containsCdnContainer;
1046
1222
  }
1223
+ _isMultiWordText(e, t = !0, n) {
1224
+ return y(this._toCDN(e, 0, n), t);
1225
+ }
1047
1226
  _encodeTo(e, t) {
1048
1227
  this.inner._encode(e, t);
1049
1228
  }
1050
- _toCDN(e, t) {
1051
- let n = e?.encodingIndicators ?? "auto";
1052
- return e?.appStrings !== !1 && n === "auto" && (v(e) !== null || !/[\r\n]/.test(this.ednSource)) ? this.ednSource : this.inner._toCDN(e, t);
1229
+ _toCDN(e, t, n) {
1230
+ let r = e?.encodingIndicators ?? "auto";
1231
+ if (!(e?.appPrefix !== !1 && r === "auto" && (O(e) !== null || !/[\r\n]/.test(this.ednSource)))) return this.inner._toCDN(this.inner._resolveCdnOptions(e, n ?? [], { parent: this }), t, n);
1232
+ if (!qe(e)) return this.ednSource;
1233
+ let i = e[Ye], a = { applied: !1 }, o = {
1234
+ ...e,
1235
+ [Ye]: a
1236
+ }, s = this.inner._toCDN(this.inner._resolveCdnOptions(o, n ?? [], { parent: this }), t, n);
1237
+ return a.applied && i && (i.applied = !0), a.applied ? s : this.ednSource;
1053
1238
  }
1054
- _toJS(e) {
1055
- return this.inner._toJS(e);
1239
+ _toJS(e, t, n) {
1240
+ return Ie(e) ? this.inner._toJSChild(e, t ?? [], n ?? Ve, { parent: this }) : this.inner._toJS(e);
1056
1241
  }
1057
- }, Ke = 888n;
1058
- function qe(e, t, n, r) {
1059
- return n ? [...(e.comments?.trailing ?? []).map((e) => o(e, r)), ...(t.comments?.leading ?? []).map((e) => o(e, r))] : [];
1242
+ }, dt = 888n;
1243
+ function ft(e, t, n, r) {
1244
+ return n ? [...(e.comments?.trailing ?? []).map((e) => b(e, r)), ...(t.comments?.leading ?? []).map((e) => b(e, r))] : [];
1060
1245
  }
1061
- function Je(e, t, n, r) {
1062
- return n === null || !t.some((e) => e.length > 0) ? e.join(" + ") : f(e, n, r, t);
1246
+ function pt(e, t, n, r) {
1247
+ return n === null || !t.some((e) => e.length > 0) ? e.join(" + ") : oe(e, n, r, t);
1063
1248
  }
1064
- function Ye(e, t, n, i) {
1249
+ function mt(e, t, r, i) {
1065
1250
  if (e === void 0) return;
1066
- let a = t?.preserveComments || i === void 0 ? e : r(e, i);
1067
- return Ze(a, n) ? a : void 0;
1251
+ let a = n(t) || i === void 0 ? e : x(e, i);
1252
+ return gt(a, r) ? a : void 0;
1068
1253
  }
1069
- function Xe(e, t) {
1070
- return e !== void 0 && Ze(e, t);
1254
+ function ht(e, t) {
1255
+ return e !== void 0 && gt(e, t);
1071
1256
  }
1072
- function Ze(e, t) {
1257
+ function gt(e, t) {
1073
1258
  return t !== null || !/[\r\n]/.test(e);
1074
1259
  }
1075
- var V = class e extends M {
1260
+ var q = class e extends z {
1076
1261
  realBoundary;
1077
1262
  fromByteLiteral;
1078
1263
  literalSource;
1079
1264
  constructor(e, t) {
1080
- Array.isArray(e) ? (super(Ke, new I(e)), this.fromByteLiteral = !1, this.literalSource = void 0, this.realBoundary = t) : (super(Ke, R.NULL), this.fromByteLiteral = e ?? !1, this.literalSource = t, this.realBoundary = void 0);
1081
- }
1082
- _toCDN(e, t) {
1083
- if (e?.appStrings === !1) return super._toCDN(e, t);
1084
- if (this.content instanceof R) return "...";
1085
- if (this.content instanceof I) {
1086
- let n = !!e?.preserveConcatenation;
1087
- if (n || e?.preserveByteString && !this._hasRealConcatenation()) {
1088
- let n = this._renderPreservedBytesElision(e, t);
1089
- if (n !== void 0) return n;
1265
+ Array.isArray(e) ? (super(dt, new U(e)), this.fromByteLiteral = !1, this.literalSource = void 0, this.realBoundary = t) : (super(dt, G.NULL), this.fromByteLiteral = e ?? !1, this.literalSource = t, this.realBoundary = void 0);
1266
+ }
1267
+ _toCDN(t, r) {
1268
+ if (t?.appPrefix === !1) return super._toCDN(t, r);
1269
+ if (this.content instanceof G) return "...";
1270
+ if (this.content instanceof U) {
1271
+ let i = !!t?.preserveConcatenation;
1272
+ if (i || t?.preserveByteString && !this._hasRealConcatenation()) {
1273
+ let e = this._renderPreservedBytesElision(t, r);
1274
+ if (e !== void 0) return e;
1090
1275
  }
1091
- if (!n || this.realBoundary === void 0) {
1276
+ if (!i || this.realBoundary === void 0) {
1092
1277
  let e = this._compactHexElided();
1093
1278
  if (e !== void 0) return e;
1094
1279
  }
1095
- let r = this.content.items, i = r.map((r) => n ? this._renderFragment(r, e, t) : r._toCDN(e, t)), a = !!e?.preserveComments, o = typeof e?.preserveComments == "string" ? e.preserveComments : void 0;
1096
- return Je(i, r.slice(1).map((e, t) => qe(r[t], e, a, o)), v(e), t);
1280
+ let a = this.content.items, o = a.map((e) => i ? this._renderFragment(e, t, r) : e._toCDN(t, r)), s = n(t), c = u(t), l = a.slice(1).map((e, t) => ft(a[t], e, s, c));
1281
+ if (t?.modernConcat) {
1282
+ let n = a.every((t) => t instanceof B || t instanceof e && t.content instanceof G);
1283
+ return ie(n ? "b1" : "t1", o, "", O(t), r, l);
1284
+ }
1285
+ return pt(o, l, O(t), r);
1097
1286
  }
1098
- return super._toCDN(e, t);
1287
+ return super._toCDN(t, r);
1099
1288
  }
1100
1289
  _hasRealConcatenation() {
1101
- return this.realBoundary?.some((e, t) => t > 0 && e) ? !0 : this.content.items.some((e) => e instanceof N && e.ednParts !== void 0 && e.ednParts.length > 1);
1102
- }
1103
- _renderFragment(e, t, n) {
1104
- let r = v(t), i = !!t?.preserveComments, a = typeof t?.preserveComments == "string" ? t.preserveComments : void 0;
1105
- if (e instanceof N && e.ednParts !== void 0 && e.ednParts.length > 1) {
1106
- let o = t?.appStrings === !1 ? "hex" : t?.bstrEncoding ?? e.ednEncoding;
1107
- return Je(e.ednParts.map((e) => {
1108
- let n = t?.preserveByteString ? Ye(e.source, t, r, e.commentSyntax) : void 0;
1109
- return n === void 0 ? oe(e.bytes, o, t?.sqstr) : n;
1110
- }), i ? ne(e.comments?.dangling, e.ednParts, a) ?? [] : [], r, n);
1111
- }
1112
- if (e instanceof G && e.ednParts !== void 0 && e.ednParts.length > 1) {
1113
- let o = t?.preserveRawString ? e.ednPartSources : void 0;
1114
- return Je(e.ednParts.map((e, t) => {
1115
- let n = o?.[t];
1116
- return Xe(n, r) ? n : ee(e);
1117
- }), i ? ne(e.comments?.dangling, e.ednPartSpans, a) ?? [] : [], r, n);
1118
- }
1119
- return e._toCDN(t, n);
1290
+ return this.realBoundary?.some((e, t) => t > 0 && e) ? !0 : this.content.items.some((e) => e instanceof B && e.ednParts !== void 0 && e.ednParts.length > 1);
1291
+ }
1292
+ _renderFragment(e, t, r) {
1293
+ let i = O(t), a = n(t), o = u(t), s = !!t?.modernConcat;
1294
+ if (e instanceof B && e.ednParts !== void 0 && e.ednParts.length > 1) {
1295
+ let n = t?.appPrefix === !1 ? "hex" : t?.bstrEncoding ?? e.ednEncoding, c = e.ednParts.map((e) => {
1296
+ let r = t?.preserveByteString ? mt(e.source, t, i, e.commentSyntax) : void 0;
1297
+ return r === void 0 ? d(e.bytes, n, t?.sqstr) : r;
1298
+ }), l = a ? p(e.comments?.dangling, e.ednParts, o) ?? [] : [];
1299
+ return s ? ie("b1", c, "", i, r, l) : pt(c, l, i, r);
1300
+ }
1301
+ if (e instanceof Y && e.ednParts !== void 0 && e.ednParts.length > 1) {
1302
+ let n = t?.preserveRawString ? e.ednPartSources : void 0, c = e.ednParts.map((e, t) => {
1303
+ let r = n?.[t];
1304
+ return ht(r, i) ? r : h(e);
1305
+ }), l = a ? p(e.comments?.dangling, e.ednPartSpans, o) ?? [] : [];
1306
+ return s ? ie("t1", c, "", i, r, l) : pt(c, l, i, r);
1307
+ }
1308
+ return e._toCDN(t, r);
1120
1309
  }
1121
1310
  _compactHexElided() {
1122
1311
  let t = this.content.items, n = "", r = !1;
1123
- for (let i of t) if (i instanceof N) n += y(i.value), r = !0;
1124
- else if (i instanceof e && i.content instanceof R) n += "...";
1312
+ for (let i of t) if (i instanceof B) n += s(i.value), r = !0;
1313
+ else if (i instanceof e && i.content instanceof G) n += "...";
1125
1314
  else return;
1126
1315
  if (r) return `h'${n}'`;
1127
1316
  }
1128
- _renderPreservedBytesElision(t, n) {
1317
+ _renderPreservedBytesElision(t, r) {
1129
1318
  if (this.realBoundary === void 0) return;
1130
- let r = this.realBoundary, i = this.content.items, a = [], o = [], s = [], c = (e) => {
1131
- s.length > 0 && (a.push(s), o.push(e ?? []), s = []);
1132
- }, l = !!t?.preserveComments, u = typeof t?.preserveComments == "string" ? t.preserveComments : void 0;
1133
- for (let t = 0; t < i.length; t++) {
1134
- let n = i[t];
1135
- if (t > 0 && r[t] && c(qe(i[t - 1], n, l, u)), n instanceof e && n.content instanceof R) s.push({
1319
+ let i = this.realBoundary, a = this.content.items, o = [], c = [], l = [], f = (e) => {
1320
+ l.length > 0 && (o.push(l), c.push(e ?? []), l = []);
1321
+ }, m = n(t), h = u(t);
1322
+ for (let t = 0; t < a.length; t++) {
1323
+ let n = a[t];
1324
+ if (t > 0 && i[t] && f(ft(a[t - 1], n, m, h)), n instanceof e && n.content instanceof G) l.push({
1136
1325
  ellipsis: !0,
1137
1326
  fromByteLiteral: n.fromByteLiteral,
1138
1327
  literalSource: n.literalSource
1139
1328
  });
1140
- else if (n instanceof N) if (n.ednParts !== void 0 && n.ednParts.length > 1) {
1141
- let [e, ...t] = n.ednParts;
1142
- s.push({
1143
- bytes: e.bytes,
1144
- source: e.source,
1145
- commentSyntax: e.commentSyntax
1146
- });
1147
- let r = l ? ne(n.comments?.dangling, n.ednParts, u) : void 0;
1148
- t.forEach((e, t) => {
1149
- c(r?.[t]), s.push({
1329
+ else if (n instanceof B) {
1330
+ if (n.ednParts !== void 0 && n.ednParts.length > 1) {
1331
+ let [e, ...t] = n.ednParts;
1332
+ l.push({
1150
1333
  bytes: e.bytes,
1151
1334
  source: e.source,
1152
1335
  commentSyntax: e.commentSyntax
1153
1336
  });
1337
+ let r = m ? p(n.comments?.dangling, n.ednParts, h) : void 0;
1338
+ t.forEach((e, t) => {
1339
+ f(r?.[t]), l.push({
1340
+ bytes: e.bytes,
1341
+ source: e.source,
1342
+ commentSyntax: e.commentSyntax
1343
+ });
1344
+ });
1345
+ } else l.push({
1346
+ bytes: n.value,
1347
+ source: n.ednSource,
1348
+ commentSyntax: n.ednCommentSyntax
1154
1349
  });
1155
- } else s.push({
1156
- bytes: n.value,
1157
- source: n.ednSource,
1158
- commentSyntax: n.ednCommentSyntax
1159
- });
1160
- else return;
1350
+ } else return;
1161
1351
  }
1162
- if (s.length > 0 && a.push(s), a.length === 0) return;
1163
- let d = t?.appStrings === !1 ? "hex" : t?.bstrEncoding ?? "hex", f = v(t);
1164
- return Je(a.map((e) => {
1352
+ if (l.length > 0 && o.push(l), o.length === 0) return;
1353
+ let g = t?.appPrefix === !1 ? "hex" : t?.bstrEncoding ?? "hex", _ = O(t), v = o.map((e) => {
1165
1354
  if (t?.preserveByteString) for (let n of e) {
1166
1355
  if (!("ellipsis" in n)) continue;
1167
- let e = Ye(n.literalSource, t, f, "full");
1356
+ let e = mt(n.literalSource, t, _, "full");
1168
1357
  if (e !== void 0) return e;
1169
1358
  }
1170
1359
  let n = e.filter((e) => !("ellipsis" in e));
1171
1360
  if (n.length === 0) return e.some((e) => "ellipsis" in e && e.fromByteLiteral) ? "h'...'" : "...";
1172
1361
  if (e.length === 1) {
1173
- let e = n[0], r = t?.preserveByteString ? Ye(e.source, t, f, e.commentSyntax) : void 0;
1174
- return r === void 0 ? oe(e.bytes, d, t?.sqstr) : r;
1362
+ let e = n[0], r = t?.preserveByteString ? mt(e.source, t, _, e.commentSyntax) : void 0;
1363
+ return r === void 0 ? d(e.bytes, g, t?.sqstr) : r;
1175
1364
  }
1176
- return `h'${e.map((e) => "ellipsis" in e ? "..." : y(e.bytes)).join("")}'`;
1177
- }), o, f, n);
1365
+ return `h'${e.map((e) => "ellipsis" in e ? "..." : s(e.bytes)).join("")}'`;
1366
+ });
1367
+ return t?.preserveConcatenation && t?.modernConcat && v.length > 1 ? ie("b1", v, "", _, r, c) : pt(v, c, _, r);
1178
1368
  }
1179
- }, Qe = 2n, $e = 3n, et = 18446744073709551615n, tt = -18446744073709551616n;
1180
- function nt(e) {
1369
+ }, _t = 2n, vt = 3n, yt = 18446744073709551615n, bt = -18446744073709551616n;
1370
+ function xt(e) {
1181
1371
  if (e < 0n) throw RangeError("bigintToBytes requires a non-negative value");
1182
1372
  if (e === 0n) return /* @__PURE__ */ new Uint8Array();
1183
1373
  let t = e.toString(16);
@@ -1186,16 +1376,16 @@ function nt(e) {
1186
1376
  for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
1187
1377
  return n;
1188
1378
  }
1189
- function rt(e) {
1379
+ function St(e) {
1190
1380
  let t = 0n;
1191
1381
  for (let n of e) t = t << 8n | BigInt(n);
1192
1382
  return t;
1193
1383
  }
1194
- var it = class extends M {
1384
+ var Ct = class extends z {
1195
1385
  bigValue;
1196
1386
  constructor(e) {
1197
- if (e <= et) throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);
1198
- super(Qe, new N(nt(e))), this.bigValue = e;
1387
+ if (e <= yt) throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);
1388
+ super(_t, new B(xt(e))), this.bigValue = e;
1199
1389
  }
1200
1390
  _toCDN(e, t) {
1201
1391
  return this.bigValue.toString();
@@ -1203,11 +1393,11 @@ var it = class extends M {
1203
1393
  _toJS(e) {
1204
1394
  return this.bigValue;
1205
1395
  }
1206
- }, at = class extends M {
1396
+ }, wt = class extends z {
1207
1397
  bigValue;
1208
1398
  constructor(e) {
1209
- if (e >= tt) throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);
1210
- super($e, new N(nt(-1n - e))), this.bigValue = e;
1399
+ if (e >= bt) throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);
1400
+ super(vt, new B(xt(-1n - e))), this.bigValue = e;
1211
1401
  }
1212
1402
  _toCDN(e, t) {
1213
1403
  return this.bigValue.toString();
@@ -1215,33 +1405,33 @@ var it = class extends M {
1215
1405
  _toJS(e) {
1216
1406
  return this.bigValue;
1217
1407
  }
1218
- }, ot = new TextEncoder(), st = new TextDecoder("utf-8", { fatal: !0 }), ct = new TextDecoder("utf-8", { fatal: !1 });
1219
- function lt(e, t) {
1220
- let n = new re(e, {
1221
- offset: t?.offset,
1222
- skipRS: t?._skipRS
1223
- }), r = new Dt(n, t ?? {}).parse();
1224
- return (t?.preserveComments || t?.preserveAll) && (bt(r, n.comments, e), U(r)), r;
1408
+ }, Tt = new TextEncoder(), Et = new TextDecoder("utf-8", { fatal: !0 }), Dt = new TextDecoder("utf-8", { fatal: !1 });
1409
+ function Ot(t, r) {
1410
+ let i = new e(t, {
1411
+ offset: r?.offset,
1412
+ skipRS: r?._skipRS
1413
+ }), a = new Jt(i, r ?? {}).parse();
1414
+ return (n(r) || r?.preserveAll) && (Bt(a, i.comments, t), Ut(a)), a;
1225
1415
  }
1226
- function ut(e) {
1416
+ function kt(e) {
1227
1417
  let t = e, n;
1228
1418
  return /[_][0-7i]$/.test(e) && (n = e[e.length - 1], t = e.slice(0, -2)), {
1229
1419
  numStr: t,
1230
1420
  rawSuffix: n
1231
1421
  };
1232
1422
  }
1233
- function dt(e) {
1423
+ function At(e) {
1234
1424
  return e.startsWith("-") ? -BigInt(e.slice(1)) : BigInt(e);
1235
1425
  }
1236
- function H(e) {
1237
- if (e !== void 0) return pt([e.appSeqSourceFeatures, ft(e)]);
1426
+ function jt(e) {
1427
+ if (e !== void 0) return Nt([e.appSeqSourceFeatures, Mt(e)]);
1238
1428
  }
1239
- function ft(e) {
1240
- if (e instanceof N) return {
1429
+ function Mt(e) {
1430
+ if (e instanceof B) return {
1241
1431
  byteString: !0,
1242
1432
  concatenation: e.ednParts !== void 0 && e.ednParts.length > 1
1243
1433
  };
1244
- if (e instanceof G) {
1434
+ if (e instanceof Y) {
1245
1435
  let t = e.ednParts !== void 0, n = e.ednPartSources?.filter((e) => e !== void 0).length ?? 0, r = t ? e.ednParts.reduce((t, n, r) => {
1246
1436
  let i = e.ednPartSources?.[r] !== void 0, a = e.ednPartIsByteString?.[r] ?? !1;
1247
1437
  return i || !a ? t : t + 1;
@@ -1253,12 +1443,12 @@ function ft(e) {
1253
1443
  concatenation: t && e.ednParts.length > 1
1254
1444
  };
1255
1445
  }
1256
- if (e instanceof I) return pt(e.items.map(H));
1257
- if (e instanceof L) return pt(e.entries.flatMap(([e, t]) => [H(e), H(t)]));
1258
- if (e instanceof M) return H(e.content);
1259
- if (e instanceof P || e instanceof F || e instanceof z) return pt((e instanceof z ? e.items : e.chunks).map(H));
1446
+ if (e instanceof U) return Nt(e.items.map(jt));
1447
+ if (e instanceof W) return Nt(e.entries.flatMap(([e, t]) => [jt(e), jt(t)]));
1448
+ if (e instanceof z) return jt(e.content);
1449
+ if (e instanceof V || e instanceof H || e instanceof K) return Nt((e instanceof K ? e.items : e.chunks).map(jt));
1260
1450
  }
1261
- function pt(e) {
1451
+ function Nt(e) {
1262
1452
  let t = e.filter((e) => e !== void 0);
1263
1453
  if (t.length !== 0) return {
1264
1454
  byteString: t.some((e) => e.byteString),
@@ -1267,7 +1457,7 @@ function pt(e) {
1267
1457
  concatenation: t.some((e) => e.concatenation)
1268
1458
  };
1269
1459
  }
1270
- function mt(e, t) {
1460
+ function Pt(e, t) {
1271
1461
  if (e.endsWith("_i") || e.endsWith("_0")) {
1272
1462
  let n = "_0 and _i encoding indicators are not valid for floating-point values";
1273
1463
  if (t) t(n), e = e.slice(0, -2);
@@ -1291,18 +1481,18 @@ function mt(e, t) {
1291
1481
  };
1292
1482
  let n = e, r;
1293
1483
  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) ? {
1294
- value: Me(n),
1484
+ value: Ze(n),
1295
1485
  precision: r
1296
1486
  } : {
1297
1487
  value: parseFloat(n),
1298
1488
  precision: r
1299
1489
  };
1300
1490
  }
1301
- var ht = /\r?\n[ \t]*\r?\n/;
1302
- function gt(e, t, n) {
1303
- return ht.test(e.slice(t, n));
1491
+ var Ft = /\r?\n[ \t]*\r?\n/;
1492
+ function It(e, t, n) {
1493
+ return Ft.test(e.slice(t, n));
1304
1494
  }
1305
- function _t(e, t, n, r) {
1495
+ function Lt(e, t, n, r) {
1306
1496
  let i = [];
1307
1497
  for (let a = t; a < e.length; a++) {
1308
1498
  let t = e[a];
@@ -1315,7 +1505,7 @@ function _t(e, t, n, r) {
1315
1505
  }
1316
1506
  return i;
1317
1507
  }
1318
- function vt(e, t, n, r) {
1508
+ function Rt(e, t, n, r) {
1319
1509
  if (n.end !== void 0) return {
1320
1510
  start: (/_[0-7i]$/.test(e.slice(Math.max(0, n.end - 2), n.end)) ? n.end - 2 : n.end) - t,
1321
1511
  end: n.end - t,
@@ -1323,50 +1513,50 @@ function vt(e, t, n, r) {
1323
1513
  never: ""
1324
1514
  };
1325
1515
  }
1326
- function yt(e, t, n) {
1327
- if (n instanceof k) {
1328
- let r = vt(e, t, n, `_${n.encodingWidth ?? p(n.value)}`);
1329
- return r ? [r] : [];
1516
+ function zt(t, n, r) {
1517
+ if (r instanceof I) {
1518
+ let e = Rt(t, n, r, `_${r.encodingWidth ?? E(r.value)}`);
1519
+ return e ? [e] : [];
1330
1520
  }
1331
- if (n instanceof A) {
1332
- let r = vt(e, t, n, `_${n.encodingWidth ?? p(n.argument)}`);
1333
- return r ? [r] : [];
1521
+ if (r instanceof L) {
1522
+ let e = Rt(t, n, r, `_${r.encodingWidth ?? E(r.argument)}`);
1523
+ return e ? [e] : [];
1334
1524
  }
1335
- if (n instanceof j) {
1336
- let r = n.precision ?? D(n.value), i = vt(e, t, n, r === "half" ? "_1" : r === "single" ? "_2" : "_3");
1525
+ if (r instanceof R) {
1526
+ let e = r.precision ?? P(r.value), i = Rt(t, n, r, e === "half" ? "_1" : e === "single" ? "_2" : "_3");
1337
1527
  return i ? [i] : [];
1338
1528
  }
1339
- if (n instanceof N) {
1340
- let r = vt(e, t, n, `_${n.encodingWidth ?? p(BigInt(n.value.length))}`);
1341
- return r ? [r] : [];
1342
- }
1343
- if (n instanceof G) {
1344
- let r = vt(e, t, n, `_${n.encodingWidth ?? p(BigInt(ot.encode(n.value).length))}`);
1345
- return r ? [r] : [];
1346
- }
1347
- if (n instanceof I) {
1348
- let r = [];
1349
- if (n.indefiniteLength) return;
1350
- if (n.start !== void 0) {
1351
- let i = new re(e, { offset: n.start }), a = i.consume(), o = i.peek(), s = o.type === "ENCODING_INDICATOR", c = `_${n.encodingWidth ?? p(BigInt(n.items.length))}`, l = e[a.endOffset] ?? "", u = !s && /[+\-.0-9A-Z_a-z]/.test(l) ? " " : "";
1352
- r.push({
1353
- start: (s ? o.offset : a.endOffset) - t,
1354
- end: (s ? o.endOffset : a.endOffset) - t,
1355
- always: c + u,
1529
+ if (r instanceof B) {
1530
+ let e = Rt(t, n, r, `_${r.encodingWidth ?? E(BigInt(r.value.length))}`);
1531
+ return e ? [e] : [];
1532
+ }
1533
+ if (r instanceof Y) {
1534
+ let e = Rt(t, n, r, `_${r.encodingWidth ?? E(BigInt(Tt.encode(r.value).length))}`);
1535
+ return e ? [e] : [];
1536
+ }
1537
+ if (r instanceof U) {
1538
+ let i = [];
1539
+ if (r.indefiniteLength) return;
1540
+ if (r.start !== void 0) {
1541
+ let a = new e(t, { offset: r.start }), o = a.consume(), s = a.peek(), c = s.type === "ENCODING_INDICATOR", l = `_${r.encodingWidth ?? E(BigInt(r.items.length))}`, u = t[o.endOffset] ?? "", d = !c && /[+\-.0-9A-Z_a-z]/.test(u) ? " " : "";
1542
+ i.push({
1543
+ start: (c ? s.offset : o.endOffset) - n,
1544
+ end: (c ? s.endOffset : o.endOffset) - n,
1545
+ always: l + d,
1356
1546
  never: ""
1357
1547
  });
1358
1548
  }
1359
- for (let i of n.items) {
1360
- let n = yt(e, t, i);
1361
- if (n === void 0) return;
1362
- r.push(...n);
1549
+ for (let e of r.items) {
1550
+ let r = zt(t, n, e);
1551
+ if (r === void 0) return;
1552
+ m(i, r);
1363
1553
  }
1364
- return r;
1554
+ return i;
1365
1555
  }
1366
1556
  }
1367
- function bt(e, t, n) {
1557
+ function Bt(e, t, n) {
1368
1558
  if (t.length === 0) return;
1369
- let r = xt(e), i = Ct(n), a = [...r].sort((e, t) => e.start - t.start || t.end - e.end), o = [...r].sort((e, t) => e.end - t.end || e.start - t.start), s = [...t].sort((e, t) => e.start - t.start), c = [], l = 0;
1559
+ let r = Vt(e), i = Wt(n), a = [...r].sort((e, t) => e.start - t.start || t.end - e.end), o = [...r].sort((e, t) => e.end - t.end || e.start - t.start), s = [...t].sort((e, t) => e.start - t.start), c = [], l = 0;
1370
1560
  for (let e of s) {
1371
1561
  let t = { ...e }, r = 0, s = o.length;
1372
1562
  for (; r < s;) {
@@ -1375,7 +1565,7 @@ function bt(e, t, n) {
1375
1565
  }
1376
1566
  let u = r > 0 ? o[r - 1] : void 0, d = u ? n.slice(u.end, e.start) : "";
1377
1567
  if (u && i(u.end) === e.line && !d.includes(":")) {
1378
- St(u.node, "trailing", t);
1568
+ Ht(u.node, "trailing", t);
1379
1569
  continue;
1380
1570
  }
1381
1571
  for (; l < a.length && a[l].start < e.start;) {
@@ -1391,62 +1581,62 @@ function bt(e, t, n) {
1391
1581
  }
1392
1582
  let p = r < a.length ? a[r] : void 0;
1393
1583
  if ((!f || p && p.end <= f.end) && p) {
1394
- t.sameLine = i(e.end) === i(p.start), St(p.node, "leading", t);
1584
+ t.sameLine = i(e.end) === i(p.start), Ht(p.node, "leading", t);
1395
1585
  continue;
1396
1586
  }
1397
- f && St(f.node, "dangling", t);
1587
+ f && Ht(f.node, "dangling", t);
1398
1588
  }
1399
1589
  }
1400
- function xt(e) {
1590
+ function Vt(e) {
1401
1591
  let t = [], n = (e) => {
1402
1592
  if (e.start !== void 0 && e.end !== void 0 && t.push({
1403
1593
  node: e,
1404
1594
  start: e.start,
1405
1595
  end: e.end
1406
- }), e instanceof I || e instanceof z) {
1596
+ }), e instanceof U || e instanceof K) {
1407
1597
  for (let t of e.items) n(t);
1408
1598
  return;
1409
1599
  }
1410
- if (e instanceof L) {
1600
+ if (e instanceof W) {
1411
1601
  for (let [t, r] of e.entries) n(t), n(r);
1412
1602
  return;
1413
1603
  }
1414
- if (e instanceof P || e instanceof F) {
1604
+ if (e instanceof V || e instanceof H) {
1415
1605
  for (let t of e.chunks) n(t);
1416
1606
  return;
1417
1607
  }
1418
- e instanceof M && n(e.content);
1608
+ e instanceof z && n(e.content);
1419
1609
  };
1420
1610
  return n(e), t;
1421
1611
  }
1422
- function St(e, t, n) {
1612
+ function Ht(e, t, n) {
1423
1613
  e.comments ??= {}, e.comments[t] ??= [], e.comments[t].push(n);
1424
1614
  }
1425
- function U(e) {
1426
- if (e instanceof V) {
1427
- if (e.content instanceof I) {
1615
+ function Ut(e) {
1616
+ if (e instanceof q) {
1617
+ if (e.content instanceof U) {
1428
1618
  let t = e.content.items;
1429
- for (let e of t) U(e);
1619
+ for (let e of t) Ut(e);
1430
1620
  let n = t[t.length - 1], r = n?.comments?.trailing;
1431
1621
  r !== void 0 && r.length > 0 && !e.comments?.trailing?.length && (e.comments ??= {}, e.comments.trailing = r, n.comments.trailing = void 0);
1432
1622
  }
1433
1623
  return;
1434
1624
  }
1435
- if (e instanceof I || e instanceof z) {
1436
- for (let t of e.items) U(t);
1625
+ if (e instanceof U || e instanceof K) {
1626
+ for (let t of e.items) Ut(t);
1437
1627
  return;
1438
1628
  }
1439
- if (e instanceof L) {
1440
- for (let [t, n] of e.entries) U(t), U(n);
1629
+ if (e instanceof W) {
1630
+ for (let [t, n] of e.entries) Ut(t), Ut(n);
1441
1631
  return;
1442
1632
  }
1443
- if (e instanceof P || e instanceof F) {
1444
- for (let t of e.chunks) U(t);
1633
+ if (e instanceof V || e instanceof H) {
1634
+ for (let t of e.chunks) Ut(t);
1445
1635
  return;
1446
1636
  }
1447
- e instanceof M && U(e.content);
1637
+ e instanceof z && Ut(e.content);
1448
1638
  }
1449
- function Ct(e) {
1639
+ function Wt(e) {
1450
1640
  let t = [0];
1451
1641
  for (let n = 0; n < e.length; n++) e[n] === "\n" && t.push(n + 1);
1452
1642
  return (n) => {
@@ -1460,25 +1650,25 @@ function Ct(e) {
1460
1650
  return a + 1;
1461
1651
  };
1462
1652
  }
1463
- var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, Tt = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, W = (e) => `'${e}' is a default built-in extension that was excluded via the 'builtinExtensions' option; add it back to that array (or omit 'builtinExtensions' to use the default set)`, Et = /* @__PURE__ */ new Map([
1464
- ["b32", wt("b32")],
1465
- ["h32", wt("h32")],
1466
- ["same", wt("same")],
1467
- ["hash", Tt("hash", "@cbortech/hash-extension")],
1468
- ["uuid", Tt("uuid", "@cbortech/uuid-extension")],
1469
- ["UUID", Tt("uuid", "@cbortech/uuid-extension")],
1470
- ["dt", W("dt")],
1471
- ["DT", W("dt")],
1472
- ["ip", W("ip")],
1473
- ["IP", W("ip")],
1474
- ["cri", W("cri")],
1475
- ["CRI", W("cri")],
1476
- ["t1", W("t1")],
1477
- ["b1", W("b1")],
1478
- ["ilbs", W("ilbs")],
1479
- ["ilts", W("ilts")],
1480
- ["float", W("float")]
1481
- ]), Dt = class {
1653
+ var Gt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, Kt = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, J = (e) => `'${e}' is a default built-in extension that was excluded via the 'builtinExtensions' option; add it back to that array (or omit 'builtinExtensions' to use the default set)`, qt = /* @__PURE__ */ new Map([
1654
+ ["b32", Gt("b32")],
1655
+ ["h32", Gt("h32")],
1656
+ ["same", Gt("same")],
1657
+ ["hash", Kt("hash", "@cbortech/hash-extension")],
1658
+ ["uuid", Kt("uuid", "@cbortech/uuid-extension")],
1659
+ ["UUID", Kt("uuid", "@cbortech/uuid-extension")],
1660
+ ["dt", J("dt")],
1661
+ ["DT", J("dt")],
1662
+ ["ip", J("ip")],
1663
+ ["IP", J("ip")],
1664
+ ["cri", J("cri")],
1665
+ ["CRI", J("cri")],
1666
+ ["t1", J("t1")],
1667
+ ["b1", J("b1")],
1668
+ ["ilbs", J("ilbs")],
1669
+ ["ilts", J("ilts")],
1670
+ ["float", J("float")]
1671
+ ]), Jt = class {
1482
1672
  t;
1483
1673
  _options;
1484
1674
  extByPrefix;
@@ -1486,26 +1676,26 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1486
1676
  unresolvedExtension;
1487
1677
  _pendingWarnings = [];
1488
1678
  _hintedPrefixes = /* @__PURE__ */ new Set();
1489
- constructor(e, n) {
1490
- this.t = e, this._options = n, this.extByPrefix = /* @__PURE__ */ new Map(), this.extByTag = /* @__PURE__ */ new Map(), this.unresolvedExtension = n.unresolvedExtension ?? "cpa999";
1491
- let r = Z(n.builtinExtensions);
1492
- for (let e of [...r, ...n.extensions ?? []]) {
1679
+ constructor(e, t) {
1680
+ this.t = e, this._options = t, this.extByPrefix = /* @__PURE__ */ new Map(), this.extByTag = /* @__PURE__ */ new Map(), this.unresolvedExtension = t.unresolvedExtension ?? "cpa999";
1681
+ let n = Oi(t.builtinExtensions);
1682
+ for (let e of [...n, ...t.extensions ?? []]) {
1493
1683
  for (let t of e.appStringPrefixes ?? []) this.extByPrefix.set(t, e);
1494
1684
  for (let t of e.tagNumbers ?? []) this.extByTag.set(t, e);
1495
1685
  }
1496
- this.t.onEscapeWarning = (e, n, r, i, a) => {
1686
+ this.t.onEscapeWarning = (e, t, n, r, i) => {
1497
1687
  let o = {
1498
1688
  message: e,
1499
- offset: n,
1500
- line: r,
1501
- column: i,
1502
- endOffset: a
1689
+ offset: t,
1690
+ line: n,
1691
+ column: r,
1692
+ endOffset: i
1503
1693
  };
1504
- if (this._pendingWarnings.push(o), this._options.onWarning ? this._options.onWarning(o) : this._options.silent || console.warn(`CDN strict violation at line ${r}, column ${i}: ${e}`), this._options.strict !== !1) throw new t(e, {
1505
- offset: n,
1506
- line: r,
1507
- column: i,
1508
- endOffset: a
1694
+ if (this._pendingWarnings.push(o), this._options.onWarning ? this._options.onWarning(o) : this._options.silent || console.warn(`CDN strict violation at line ${n}, column ${r}: ${e}`), this._options.strict !== !1) throw new a(e, {
1695
+ offset: t,
1696
+ line: n,
1697
+ column: r,
1698
+ endOffset: i
1509
1699
  });
1510
1700
  };
1511
1701
  }
@@ -1539,12 +1729,12 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1539
1729
  case "BYTES_HEX":
1540
1730
  case "SQSTR":
1541
1731
  case "BYTES_B64": return this.t.consume(), this._parseBytesConcat(this._decodeBytesToken(e), e.type, e.raw, e.offset, e.endOffset);
1542
- case "EMPTY_INDEF_BYTES": return this.t.consume(), new P([]);
1543
- case "EMPTY_INDEF_TEXT": return this.t.consume(), new F([]);
1544
- case "TRUE": return this.t.consume(), new R(21);
1545
- case "FALSE": return this.t.consume(), new R(20);
1546
- case "NULL": return this.t.consume(), new R(22);
1547
- case "UNDEFINED": return this.t.consume(), new R(23);
1732
+ case "EMPTY_INDEF_BYTES": return this.t.consume(), new V([]);
1733
+ case "EMPTY_INDEF_TEXT": return this.t.consume(), new H([]);
1734
+ case "TRUE": return this.t.consume(), new G(21);
1735
+ case "FALSE": return this.t.consume(), new G(20);
1736
+ case "NULL": return this.t.consume(), new G(22);
1737
+ case "UNDEFINED": return this.t.consume(), new G(23);
1548
1738
  case "SIMPLE": return this.parseSimple();
1549
1739
  case "LBRACKET": return this.parseArray();
1550
1740
  case "LBRACE": return this.parseMap();
@@ -1559,22 +1749,22 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1559
1749
  }
1560
1750
  let r = this.extByPrefix.get(e.appPrefix);
1561
1751
  if (!r?.parseAppString) {
1562
- if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new Ge(e.appPrefix, [new G(e.value)]);
1752
+ if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new lt(e.appPrefix, [new Y(e.value)]);
1563
1753
  this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
1564
1754
  }
1565
1755
  {
1566
1756
  let i = this._pendingWarnings.length;
1567
1757
  try {
1568
1758
  let i = r.parseAppString(e.appPrefix, e.value, this._extOnError(e), t === void 0 ? void 0 : { encodingWidth: t });
1569
- return t !== void 0 && this._applyEiToResult(i, t, e), r.preserveAppSeqSource === "optional" ? (i.appSeqSource = e.raw + n, i) : i instanceof N && Object.getPrototypeOf(i) === N.prototype && i.ednSource === void 0 ? new N(i.value, {
1759
+ return t !== void 0 && this._applyEiToResult(i, t, e), r.preserveAppSeqSource === "optional" ? (i.appSeqSource = e.raw + n, i) : i instanceof B && Object.getPrototypeOf(i) === B.prototype && i.ednSource === void 0 ? new B(i.value, {
1570
1760
  ednEncoding: i.ednEncoding,
1571
1761
  encodingWidth: i.encodingWidth,
1572
1762
  ednSource: e.raw + n,
1573
- ednCommentSyntax: r === Ve || r === He ? "full" : void 0
1574
- }) : (i instanceof j && i.ednSource === void 0 && (i.ednSource = e.raw + n), i);
1763
+ ednCommentSyntax: r === ot || r === st ? "full" : void 0
1764
+ }) : (i instanceof R && i.ednSource === void 0 && (i.ednSource = e.raw + n), i);
1575
1765
  } catch (t) {
1576
1766
  if (this._options.strict !== !1) throw t;
1577
- return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new Ge(e.appPrefix, [new G(e.value)]);
1767
+ return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new lt(e.appPrefix, [new Y(e.value)]);
1578
1768
  }
1579
1769
  }
1580
1770
  }
@@ -1583,9 +1773,11 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1583
1773
  this.t.consume();
1584
1774
  let n = [];
1585
1775
  for (; this.t.peek().type !== "GT_GT";) {
1586
- if (this.t.peek().type === "EOF" && this._fail(`unterminated ${e.appPrefix}<<...>>`, e), n.length > 0) if (this.t.peek().type === "COMMA") {
1587
- if (this.t.consume(), this.t.peek().type === "GT_GT") break;
1588
- } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("<<...>> items must be separated by \",\" or whitespace", this.t.peek());
1776
+ if (this.t.peek().type === "EOF" && this._fail(`unterminated ${e.appPrefix}<<...>>`, e), n.length > 0) {
1777
+ if (this.t.peek().type === "COMMA") {
1778
+ if (this.t.consume(), this.t.peek().type === "GT_GT") break;
1779
+ } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("<<...>> items must be separated by \",\" or whitespace", this.t.peek());
1780
+ }
1589
1781
  n.push(this.parseValue());
1590
1782
  }
1591
1783
  this.expect("GT_GT");
@@ -1593,7 +1785,7 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1593
1785
  this.t.peek().type === "ENCODING_INDICATOR" && (i = this.t.consume(), r = this._resolveEncodingWidth(i.value, i));
1594
1786
  let a = this.extByPrefix.get(e.appPrefix);
1595
1787
  if (!a) {
1596
- if (this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new Ge(e.appPrefix, n);
1788
+ if (this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new lt(e.appPrefix, n);
1597
1789
  this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
1598
1790
  }
1599
1791
  a.parseAppSequence || this._fail(`app-string extension ${JSON.stringify(e.appPrefix)} does not support <<...>> form`, e);
@@ -1603,65 +1795,65 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1603
1795
  let o = a.parseAppSequence(e.appPrefix, n, this._extOnError(e));
1604
1796
  r !== void 0 && this._applyEiToResult(o, r, i ?? e);
1605
1797
  let s = this.t.source.slice(e.offset, this.t.lastEndOffset);
1606
- if (a.preserveAppSeqSource === "optional") o.appSeqSource = s, o.appSeqComments = _t(this.t.comments, t, e.offset, this.t.lastEndOffset), n.length === 1 && (n[0].end !== void 0 && (o.appSeqInnerEnd = n[0].end - e.offset), o.appSeqSourceFeatures = H(n[0]));
1607
- else if (o instanceof j) o.ednSource === void 0 && (o.ednSource = s);
1608
- else if (a.preserveAppSeqSource) return new B(o, s);
1798
+ if (a.preserveAppSeqSource === "optional") o.appSeqSource = s, o.appSeqComments = Lt(this.t.comments, t, e.offset, this.t.lastEndOffset), n.length === 1 && (n[0].end !== void 0 && (o.appSeqInnerEnd = n[0].end - e.offset), o.appSeqSourceFeatures = jt(n[0]));
1799
+ else if (o instanceof R) o.ednSource === void 0 && (o.ednSource = s);
1800
+ else if (a.preserveAppSeqSource) return new ut(o, s);
1609
1801
  return o;
1610
1802
  } catch (t) {
1611
1803
  if (this._options.strict !== !1) throw t;
1612
- return this._pendingWarnings.length === o && this._warn(t instanceof Error ? t.message : String(t), e), new Ge(e.appPrefix, n);
1804
+ return this._pendingWarnings.length === o && this._warn(t instanceof Error ? t.message : String(t), e), new lt(e.appPrefix, n);
1613
1805
  }
1614
1806
  }
1615
1807
  }
1616
1808
  case "ELLIPSIS": {
1617
- if (this.t.consume(), this.t.peek().type !== "PLUS") return new V();
1618
- let e = [new V()];
1809
+ if (this.t.consume(), this.t.peek().type !== "PLUS") return new q();
1810
+ let e = [new q()];
1619
1811
  for (; this.t.peek().type === "PLUS";) this.t.consume(), e.push(this.parseValue());
1620
- return new V(e, e.map(() => !0));
1812
+ return new q(e, e.map(() => !0));
1621
1813
  }
1622
1814
  case "BYTES_HEX_ELIDED": return this.t.consume(), this._parseHexElidedConcat(e);
1623
1815
  default: this._fail(`unexpected token: ${JSON.stringify(e.value)}`, e);
1624
1816
  }
1625
1817
  }
1626
1818
  parseIntegerOrTag() {
1627
- let e = this.t.comments.length, t = this.t.consume(), { numStr: n, rawSuffix: r } = ut(t.value), i = r === void 0 ? t.endOffset : t.endOffset - 2, a = t.endOffset, o = r === void 0 ? this.consumeEncodingIndicator(void 0, (e) => {
1819
+ let e = this.t.comments.length, t = this.t.consume(), { numStr: n, rawSuffix: r } = kt(t.value), i = r === void 0 ? t.endOffset : t.endOffset - 2, a = t.endOffset, o = r === void 0 ? this.consumeEncodingIndicator(void 0, (e) => {
1628
1820
  i = e.offset, a = e.endOffset;
1629
- }) : this._resolveEncodingWidth(r, t), s = dt(n), c = r === void 0 ? t.raw : t.raw.slice(0, -2);
1630
- if (s > 18446744073709551615n) return this.t.peek().type === "LPAREN" && this._fail("tag number exceeds maximum uint64", t), new it(s);
1631
- if (s < -18446744073709551616n) return new at(s);
1821
+ }) : this._resolveEncodingWidth(r, t), s = At(n), c = r === void 0 ? t.raw : t.raw.slice(0, -2);
1822
+ if (s > 18446744073709551615n) return this.t.peek().type === "LPAREN" && this._fail("tag number exceeds maximum uint64", t), new Ct(s);
1823
+ if (s < -18446744073709551616n) return new wt(s);
1632
1824
  if (o !== void 0) {
1633
1825
  let e = s >= 0n ? s : -(s + 1n);
1634
1826
  o = this._validateEncodingFit(e, o, t);
1635
1827
  }
1636
- let l = s >= 0n ? new k(s, {
1828
+ let l = s >= 0n ? new I(s, {
1637
1829
  encodingWidth: o,
1638
1830
  ednSource: c
1639
- }) : new A(s, {
1831
+ }) : new L(s, {
1640
1832
  encodingWidth: o,
1641
1833
  ednSource: c
1642
1834
  });
1643
1835
  if (this.t.peek().type === "LPAREN") {
1644
- l instanceof k || this._fail("tag number must be non-negative", t), this.t.consume();
1836
+ l instanceof I || this._fail("tag number must be non-negative", t), this.t.consume();
1645
1837
  let n = this._pendingWarnings.splice(0), r = this.parseValue();
1646
1838
  this.expect("RPAREN");
1647
1839
  let s = l.value, u = this.extByTag.get(s);
1648
1840
  if (u?.parseTag) {
1649
1841
  let l = u.parseTag(s, r);
1650
1842
  if (l !== void 0) {
1651
- if (l instanceof M && (o !== void 0 && l.encodingWidth === void 0 && (l.encodingWidth = o), l.ednSource === void 0 && (l.ednSource = c), u.preserveAppSeqSource === "optional" && l.appSeqSource === void 0)) {
1652
- l.appSeqSource = this.t.source.slice(t.offset, this.t.lastEndOffset), l.appSeqComments = _t(this.t.comments, e, t.offset, this.t.lastEndOffset);
1653
- let n = l.encodingWidth ?? p(l.tag), o = yt(this.t.source, t.offset, l.content);
1843
+ if (l instanceof z && (o !== void 0 && l.encodingWidth === void 0 && (l.encodingWidth = o), l.ednSource === void 0 && (l.ednSource = c), u.preserveAppSeqSource === "optional" && l.appSeqSource === void 0)) {
1844
+ l.appSeqSource = this.t.source.slice(t.offset, this.t.lastEndOffset), l.appSeqComments = Lt(this.t.comments, e, t.offset, this.t.lastEndOffset);
1845
+ let n = l.encodingWidth ?? E(l.tag), o = zt(this.t.source, t.offset, l.content);
1654
1846
  l.appSeqEncodingEdits = [{
1655
1847
  start: i - t.offset,
1656
1848
  end: a - t.offset,
1657
1849
  always: `_${n}`,
1658
1850
  never: ""
1659
- }, ...o ?? []], o === void 0 && (l.appSeqEncodingEditsComplete = !1), l.appSeqSourceFeatures = H(r);
1851
+ }, ...o ?? []], o === void 0 && (l.appSeqEncodingEditsComplete = !1), l.appSeqSourceFeatures = jt(r);
1660
1852
  }
1661
1853
  return n.length > 0 && (l.warnings ??= [], l.warnings.push(...n)), l;
1662
1854
  }
1663
1855
  }
1664
- let d = new M(s, r, {
1856
+ let d = new z(s, r, {
1665
1857
  encodingWidth: o,
1666
1858
  ednSource: c
1667
1859
  });
@@ -1670,12 +1862,12 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1670
1862
  return l;
1671
1863
  }
1672
1864
  parseFloat() {
1673
- let e = this.t.consume(), t = (t) => this._warnOrFail(t, e), { value: n, precision: r } = mt(e.value, t);
1865
+ let e = this.t.consume(), t = (t) => this._warnOrFail(t, e), { value: n, precision: r } = Pt(e.value, t);
1674
1866
  if (r === "half" || r === "single") {
1675
- let e = r === "half" ? C(S(n)) : Math.fround(n);
1867
+ let e = r === "half" ? j(ve(n)) : Math.fround(n);
1676
1868
  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`);
1677
1869
  }
1678
- return new j(n, {
1870
+ return new R(n, {
1679
1871
  precision: r,
1680
1872
  literalSource: e.raw
1681
1873
  });
@@ -1683,11 +1875,11 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1683
1875
  parseString() {
1684
1876
  let e = this.t.consume();
1685
1877
  if (this.t.peek().type !== "PLUS") {
1686
- let t = this.consumeEncodingIndicator(() => BigInt(ot.encode(e.value).length));
1687
- return e.type === "RAWSTRING" ? new G(e.value, {
1878
+ let t = this.consumeEncodingIndicator(() => BigInt(Tt.encode(e.value).length));
1879
+ return e.type === "RAWSTRING" ? new Y(e.value, {
1688
1880
  ednSource: e.raw,
1689
1881
  ...t === void 0 ? {} : { encodingWidth: t }
1690
- }) : new G(e.value, {
1882
+ }) : new Y(e.value, {
1691
1883
  quotedEdnSource: e.raw,
1692
1884
  ...t === void 0 ? {} : { encodingWidth: t }
1693
1885
  });
@@ -1729,8 +1921,8 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1729
1921
  let e = n.map((e) => "text" in e ? e.text : ""), t = n.map((e) => "text" in e ? e.source : void 0), r = n.map((e) => "text" in e ? e.isByteString ?? !1 : !1), i = n.map((e) => ({
1730
1922
  start: e.start,
1731
1923
  end: e.end
1732
- })), a = e.join(""), o = this.consumeEncodingIndicator(() => BigInt(ot.encode(a).length));
1733
- return new G(a, {
1924
+ })), a = e.join(""), o = this.consumeEncodingIndicator(() => BigInt(Tt.encode(a).length));
1925
+ return new Y(a, {
1734
1926
  ednParts: e,
1735
1927
  ednPartSpans: i,
1736
1928
  ...t.some((e) => e !== void 0) ? { ednPartSources: t } : {},
@@ -1741,7 +1933,7 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1741
1933
  let r = [], i = [], a = () => {
1742
1934
  let e = i.map((e) => e.text), t = e.join("");
1743
1935
  if (t !== "") {
1744
- let n = i.map((e) => e.source), a = i.map((e) => e.isByteString ?? !1), o = new G(t, {
1936
+ let n = i.map((e) => e.source), a = i.map((e) => e.isByteString ?? !1), o = new Y(t, {
1745
1937
  ednParts: e,
1746
1938
  ednPartSpans: i.map((e) => ({
1747
1939
  start: e.start,
@@ -1756,24 +1948,24 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1756
1948
  };
1757
1949
  for (let e of n) if ("ellipsis" in e) {
1758
1950
  a();
1759
- let t = new V();
1951
+ let t = new q();
1760
1952
  t.start = e.start, t.end = e.end, r.push(t);
1761
1953
  } else i.push(e);
1762
- return a(), new V(r);
1954
+ return a(), new q(r);
1763
1955
  }
1764
1956
  _isBytesToken(e) {
1765
1957
  return e === "BYTES_HEX" || e === "SQSTR" || e === "BYTES_B64";
1766
1958
  }
1767
- _hexToBytes(e, r) {
1959
+ _hexToBytes(e, t) {
1768
1960
  try {
1769
- return n(e);
1961
+ return i(e);
1770
1962
  } catch (e) {
1771
- if (e instanceof t || !(e instanceof SyntaxError)) throw e;
1772
- this._fail(e.message, r);
1963
+ if (e instanceof a || !(e instanceof SyntaxError)) throw e;
1964
+ this._fail(e.message, t);
1773
1965
  }
1774
1966
  }
1775
1967
  _decodeBytesToken(e) {
1776
- let n = (t) => this._warnOrFail(t, e);
1968
+ let t = (t) => this._warnOrFail(t, e);
1777
1969
  switch (e.type) {
1778
1970
  case "SQSTR": {
1779
1971
  let t = e._sqstrBytes;
@@ -1781,20 +1973,20 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1781
1973
  }
1782
1974
  case "BYTES_HEX": return this._hexToBytes(e.value, e);
1783
1975
  case "BYTES_B64": try {
1784
- return Ue(e.value, n);
1785
- } catch (n) {
1786
- if (n instanceof t || !(n instanceof SyntaxError)) throw n;
1787
- this._fail(n.message, e);
1976
+ return ee(e.value, t);
1977
+ } catch (t) {
1978
+ if (t instanceof a || !(t instanceof SyntaxError)) throw t;
1979
+ this._fail(t.message, e);
1788
1980
  }
1789
1981
  default: this._fail("expected byte string token", e);
1790
1982
  }
1791
1983
  }
1792
1984
  _decodeUtf8(e, t) {
1793
- if (this._options.allowInvalidUtf8) return ct.decode(e);
1985
+ if (this._options.allowInvalidUtf8) return Dt.decode(e);
1794
1986
  try {
1795
- return st.decode(e);
1987
+ return Et.decode(e);
1796
1988
  } catch {
1797
- return this._warnOrFail("byte string in text concatenation is not valid UTF-8", t), ct.decode(e);
1989
+ return this._warnOrFail("byte string in text concatenation is not valid UTF-8", t), Dt.decode(e);
1798
1990
  }
1799
1991
  }
1800
1992
  _tokenTypeToCdnEncoding(e) {
@@ -1807,7 +1999,7 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1807
1999
  _parseBytesConcat(e, t, n, r, i) {
1808
2000
  if (this.t.peek().type !== "PLUS") {
1809
2001
  let r = this.consumeEncodingIndicator(() => BigInt(e.length));
1810
- return new N(e, {
2002
+ return new B(e, {
1811
2003
  ednEncoding: this._tokenTypeToCdnEncoding(t),
1812
2004
  ednSource: n,
1813
2005
  ednCommentSyntax: this._tokenTypeToCommentSyntax(t),
@@ -1843,7 +2035,7 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1843
2035
  else if (e.type === "BYTES_HEX_ELIDED") {
1844
2036
  this.t.consume();
1845
2037
  let n = this._elidedHexAtoms(e.value, e);
1846
- n.length > 0 && (n[0].real = !0), t.push(...n);
2038
+ n.length > 0 && (n[0].real = !0), m(t, n);
1847
2039
  } else this._isBytesToken(e.type) ? (this.t.consume(), t.push({
1848
2040
  bytes: this._decodeBytesToken(e),
1849
2041
  source: e.raw,
@@ -1852,7 +2044,7 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1852
2044
  start: e.offset,
1853
2045
  end: e.endOffset
1854
2046
  })) : 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), t.push({
1855
- bytes: ot.encode(e.value),
2047
+ bytes: Tt.encode(e.value),
1856
2048
  real: !0,
1857
2049
  start: e.offset,
1858
2050
  end: e.endOffset
@@ -1881,7 +2073,7 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1881
2073
  _buildFromByteAtoms(e, t) {
1882
2074
  if (!e.some((e) => "ellipsis" in e)) {
1883
2075
  let n = e, r = this._concatBytes(n.map((e) => e.bytes)), i = this.consumeEncodingIndicator(() => BigInt(r.length));
1884
- return new N(r, {
2076
+ return new B(r, {
1885
2077
  ednEncoding: t,
1886
2078
  ednParts: n,
1887
2079
  ...i === void 0 ? {} : { encodingWidth: i }
@@ -1889,7 +2081,7 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1889
2081
  }
1890
2082
  let n = [], r = [], i = [], a = () => {
1891
2083
  if (i.length > 0) {
1892
- let e = new N(this._concatBytes(i.map((e) => e.bytes)), { ...i.length > 1 ? { ednParts: i.map(({ bytes: e, source: t, commentSyntax: n, start: r, end: i }) => ({
2084
+ let e = new B(this._concatBytes(i.map((e) => e.bytes)), { ...i.length > 1 ? { ednParts: i.map(({ bytes: e, source: t, commentSyntax: n, start: r, end: i }) => ({
1893
2085
  bytes: e,
1894
2086
  source: t,
1895
2087
  commentSyntax: n,
@@ -1904,10 +2096,10 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1904
2096
  };
1905
2097
  for (let t of e) if ("ellipsis" in t) {
1906
2098
  a();
1907
- let e = new V(t.fromByteLiteral, t.literalSource);
2099
+ let e = new q(t.fromByteLiteral, t.literalSource);
1908
2100
  e.start = t.start, e.end = t.end, n.push(e), r.push(t.real);
1909
2101
  } else i.push(t);
1910
- return a(), new V(n, r);
2102
+ return a(), new q(n, r);
1911
2103
  }
1912
2104
  _concatBytes(e) {
1913
2105
  let t = e.reduce((e, t) => e + t.byteLength, 0), n = new Uint8Array(t), r = 0;
@@ -1918,16 +2110,18 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1918
2110
  this.t.consume(), this.expect("LPAREN");
1919
2111
  let e = this.t.peek();
1920
2112
  e.type !== "INTEGER" && this._fail(`expected integer inside simple(), got ${JSON.stringify(e.value)}`, e), this.t.consume();
1921
- let { numStr: t } = ut(e.value), n = Number(dt(t));
1922
- return this.expect("RPAREN"), new R(n, { ednSource: e.raw });
2113
+ let { numStr: t } = kt(e.value), n = Number(At(t));
2114
+ return this.expect("RPAREN"), new G(n, { ednSource: e.raw });
1923
2115
  }
1924
2116
  parseEmbeddedCBOR() {
1925
2117
  this.t.consume();
1926
2118
  let e = [];
1927
2119
  for (; this.t.peek().type !== "GT_GT";) {
1928
- if (e.length > 0) if (this.t.peek().type === "COMMA") {
1929
- if (this.t.consume(), this.t.peek().type === "GT_GT") break;
1930
- } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("<<...>> items must be separated by \",\" or whitespace", this.t.peek());
2120
+ if (e.length > 0) {
2121
+ if (this.t.peek().type === "COMMA") {
2122
+ if (this.t.consume(), this.t.peek().type === "GT_GT") break;
2123
+ } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("<<...>> items must be separated by \",\" or whitespace", this.t.peek());
2124
+ }
1931
2125
  e.push(this.parseValue());
1932
2126
  }
1933
2127
  this.expect("GT_GT");
@@ -1936,7 +2130,7 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1936
2130
  let e = this.t.consume();
1937
2131
  t = this._resolveEncodingWidth(e.value, e);
1938
2132
  }
1939
- return new z(e, { encodingWidth: t });
2133
+ return new K(e, { encodingWidth: t });
1940
2134
  }
1941
2135
  parseArray() {
1942
2136
  this.t.consume();
@@ -1944,14 +2138,16 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1944
2138
  this.t.peek().type === "UNDERSCORE" ? (this.t.consume(), e = !0) : this.t.peek().type === "ENCODING_INDICATOR" && (n = this.t.consume(), n.value === "7" ? (e = !0, this._warnOrFail("encoding indicator _7 is non-standard; use _ to indicate indefinite length", n), n = void 0) : t = this._resolveEncodingWidth(n.value, n));
1945
2139
  let r = this._pendingWarnings.splice(0), i = [], a = this.t.lastEndOffset;
1946
2140
  for (; this.t.peek().type !== "RBRACKET";) {
1947
- if (i.length > 0) if (this.t.peek().type === "COMMA") {
1948
- if (this.t.consume(), this.t.peek().type === "RBRACKET") break;
1949
- } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("array items must be separated by \",\" or whitespace", this.t.peek());
2141
+ if (i.length > 0) {
2142
+ if (this.t.peek().type === "COMMA") {
2143
+ if (this.t.consume(), this.t.peek().type === "RBRACKET") break;
2144
+ } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("array items must be separated by \",\" or whitespace", this.t.peek());
2145
+ }
1950
2146
  let e = this.parseValue();
1951
- gt(this.t.source, a, e.start) && (e.blankLineBefore = !0), a = e.end, i.push(e);
2147
+ It(this.t.source, a, e.start) && (e.blankLineBefore = !0), a = e.end, i.push(e);
1952
2148
  }
1953
2149
  this.expect("RBRACKET"), t !== void 0 && n !== void 0 && (t = this._validateEncodingFit(BigInt(i.length), t, n));
1954
- let o = new I(i, {
2150
+ let o = new U(i, {
1955
2151
  indefiniteLength: e,
1956
2152
  encodingWidth: t
1957
2153
  });
@@ -1963,16 +2159,18 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1963
2159
  this.t.peek().type === "UNDERSCORE" ? (this.t.consume(), e = !0) : this.t.peek().type === "ENCODING_INDICATOR" && (n = this.t.consume(), n.value === "7" ? (e = !0, this._warnOrFail("encoding indicator _7 is non-standard; use _ to indicate indefinite length", n), n = void 0) : t = this._resolveEncodingWidth(n.value, n));
1964
2160
  let r = this._pendingWarnings.splice(0), i = [], a = this.t.lastEndOffset;
1965
2161
  for (; this.t.peek().type !== "RBRACE";) {
1966
- if (i.length > 0) if (this.t.peek().type === "COMMA") {
1967
- if (this.t.consume(), this.t.peek().type === "RBRACE") break;
1968
- } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("map entries must be separated by \",\" or whitespace", this.t.peek());
2162
+ if (i.length > 0) {
2163
+ if (this.t.peek().type === "COMMA") {
2164
+ if (this.t.consume(), this.t.peek().type === "RBRACE") break;
2165
+ } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("map entries must be separated by \",\" or whitespace", this.t.peek());
2166
+ }
1969
2167
  let e = this.parseValue();
1970
- gt(this.t.source, a, e.start) && (e.blankLineBefore = !0), this.expect("COLON");
2168
+ It(this.t.source, a, e.start) && (e.blankLineBefore = !0), this.expect("COLON");
1971
2169
  let t = this.parseValue();
1972
2170
  a = t.end, i.push([e, t]);
1973
2171
  }
1974
2172
  this.expect("RBRACE"), t !== void 0 && n !== void 0 && (t = this._validateEncodingFit(BigInt(i.length), t, n));
1975
- let o = new L(i, {
2173
+ let o = new W(i, {
1976
2174
  indefiniteLength: e,
1977
2175
  encodingWidth: t
1978
2176
  });
@@ -1989,24 +2187,26 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1989
2187
  } else e.type !== "RPAREN" && this._warnOrFail("indefinite string group is missing _ after (; interpreting as (_ ...)", e);
1990
2188
  let t = this._pendingWarnings.splice(0), n = [], r = this.t.lastEndOffset;
1991
2189
  for (; this.t.peek().type !== "RPAREN";) {
1992
- if (n.length > 0) if (this.t.peek().type === "COMMA") {
1993
- if (this.t.consume(), this.t.peek().type === "RPAREN") break;
1994
- } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("indefinite string chunks must be separated by \",\" or whitespace", this.t.peek());
2190
+ if (n.length > 0) {
2191
+ if (this.t.peek().type === "COMMA") {
2192
+ if (this.t.consume(), this.t.peek().type === "RPAREN") break;
2193
+ } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("indefinite string chunks must be separated by \",\" or whitespace", this.t.peek());
2194
+ }
1995
2195
  let e = this.parseValue();
1996
- gt(this.t.source, r, e.start) && (e.blankLineBefore = !0), r = e.end, n.push(e);
2196
+ It(this.t.source, r, e.start) && (e.blankLineBefore = !0), r = e.end, n.push(e);
1997
2197
  }
1998
2198
  this.expect("RPAREN"), n.length === 0 && this._fail("empty indefinite group (_ ) is ambiguous; use ''_ for bytes or \"\"_ for text");
1999
2199
  let i = n[0];
2000
- if (i instanceof N) {
2001
- let e = new P(n.map((e, t) => {
2002
- if (e instanceof N) return e;
2200
+ if (i instanceof B) {
2201
+ let e = new V(n.map((e, t) => {
2202
+ if (e instanceof B) return e;
2003
2203
  this._fail(`indefinite byte string chunk ${t} must be a byte string, not a text string`);
2004
2204
  }));
2005
2205
  return t.length > 0 && (e.warnings = t), e;
2006
2206
  }
2007
- if (i instanceof G) {
2008
- let e = new F(n.map((e, t) => {
2009
- if (e instanceof G) return e;
2207
+ if (i instanceof Y) {
2208
+ let e = new H(n.map((e, t) => {
2209
+ if (e instanceof Y) return e;
2010
2210
  this._fail(`indefinite text string chunk ${t} must be a text string, not a byte string`);
2011
2211
  }));
2012
2212
  return t.length > 0 && (e.warnings = t), e;
@@ -2026,47 +2226,47 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
2026
2226
  return t.type !== e && this._fail(`expected ${e}, got ${t.type} (${JSON.stringify(t.value)})`, t), t;
2027
2227
  }
2028
2228
  _applyEiToResult(e, t, n) {
2029
- if (e instanceof j) {
2229
+ if (e instanceof R) {
2030
2230
  let r = t === 1 ? "half" : t === 2 ? "single" : t === 3 ? "double" : void 0;
2031
2231
  if (r === void 0) this._warnOrFail(`encoding indicator _${t} is not valid for a float; use _1, _2, or _3`, n);
2032
2232
  else if (e.precision !== r) {
2033
2233
  if (r !== "double") {
2034
- let t = r === "half" ? C(S(e.value)) : Math.fround(e.value);
2234
+ let t = r === "half" ? j(ve(e.value)) : Math.fround(e.value);
2035
2235
  !Object.is(t, e.value) && !isNaN(e.value) && this._warnOrFail(`${e.value} cannot be exactly represented as ${r === "half" ? "float16 (_1)" : "float32 (_2)"}`, n);
2036
2236
  }
2037
2237
  e.precision = r;
2038
2238
  }
2039
- } else if (e instanceof k) {
2239
+ } else if (e instanceof I) {
2040
2240
  if (e.encodingWidth === void 0) {
2041
2241
  let r = this._validateEncodingFit(e.value, t, n);
2042
2242
  r !== void 0 && (e.encodingWidth = r);
2043
2243
  }
2044
- } else if (e instanceof A) {
2244
+ } else if (e instanceof L) {
2045
2245
  if (e.encodingWidth === void 0) {
2046
2246
  let r = this._validateEncodingFit(e.argument, t, n);
2047
2247
  r !== void 0 && (e.encodingWidth = r);
2048
2248
  }
2049
- } else if (e instanceof N) {
2249
+ } else if (e instanceof B) {
2050
2250
  if (e.encodingWidth === void 0) {
2051
2251
  let r = this._validateEncodingFit(BigInt(e.value.length), t, n);
2052
2252
  r !== void 0 && (e.encodingWidth = r);
2053
2253
  }
2054
- } else if (e instanceof G) {
2254
+ } else if (e instanceof Y) {
2055
2255
  if (e.encodingWidth === void 0) {
2056
- let r = this._validateEncodingFit(BigInt(ot.encode(e.value).length), t, n);
2256
+ let r = this._validateEncodingFit(BigInt(Tt.encode(e.value).length), t, n);
2057
2257
  r !== void 0 && (e.encodingWidth = r);
2058
2258
  }
2059
- } else if (e instanceof I) {
2259
+ } else if (e instanceof U) {
2060
2260
  if (e.encodingWidth === void 0) {
2061
2261
  let r = this._validateEncodingFit(BigInt(e.items.length), t, n);
2062
2262
  r !== void 0 && (e.encodingWidth = r);
2063
2263
  }
2064
- } else if (e instanceof L) {
2264
+ } else if (e instanceof W) {
2065
2265
  if (e.encodingWidth === void 0) {
2066
2266
  let r = this._validateEncodingFit(BigInt(e.entries.length), t, n);
2067
2267
  r !== void 0 && (e.encodingWidth = r);
2068
2268
  }
2069
- } else if (e instanceof M) {
2269
+ } else if (e instanceof z) {
2070
2270
  if (e.encodingWidth === void 0) {
2071
2271
  let r = this._validateEncodingFit(e.tag, t, n);
2072
2272
  r !== void 0 && (e.encodingWidth = r);
@@ -2074,7 +2274,7 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
2074
2274
  } else this._warnOrFail(`encoding indicator _${t} is not applicable to this app-string result type`, n);
2075
2275
  }
2076
2276
  _validateEncodingFit(e, t, n) {
2077
- let r = Te(t);
2277
+ let r = De(t);
2078
2278
  if (e <= r) return t;
2079
2279
  let i = `value ${e} does not fit in encoding indicator ${t === "i" ? "_i (max 23)" : `_${t} (max ${r})`}`;
2080
2280
  this._warnOrFail(i, n);
@@ -2098,29 +2298,29 @@ var wt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
2098
2298
  this._warn(e, t), this._options.strict !== !1 && this._fail(e, t);
2099
2299
  }
2100
2300
  _hintMissingExtension(e, t) {
2101
- let n = Et.get(e);
2301
+ let n = qt.get(e);
2102
2302
  if (n === void 0 || this._hintedPrefixes.has(e)) return;
2103
2303
  this._hintedPrefixes.add(e);
2104
2304
  let r = `app-string prefix '${e}' requires an extension that is not enabled; ${n}`;
2105
2305
  this._options.onWarning ? this._options.onWarning({
2106
2306
  message: r,
2107
- ...Ot(t),
2307
+ ...Yt(t),
2108
2308
  hint: !0
2109
2309
  }) : this._options.silent || console.warn(`CDN: ${r}`);
2110
2310
  }
2111
2311
  _warn(e, t) {
2112
2312
  let n = { message: e };
2113
- if (t !== void 0 && Object.assign(n, Ot(t)), this._pendingWarnings.push(n), this._options.onWarning) this._options.onWarning(n);
2313
+ if (t !== void 0 && Object.assign(n, Yt(t)), this._pendingWarnings.push(n), this._options.onWarning) this._options.onWarning(n);
2114
2314
  else if (!this._options.silent) {
2115
2315
  let n = t ? ` at line ${t.line}, column ${t.col}` : "";
2116
2316
  console.warn(`CDN strict violation${n}: ${e}`);
2117
2317
  }
2118
2318
  }
2119
- _fail(e, n) {
2120
- throw new t(e, n ? Ot(n) : void 0);
2319
+ _fail(e, t) {
2320
+ throw new a(e, t ? Yt(t) : void 0);
2121
2321
  }
2122
2322
  };
2123
- function Ot(e) {
2323
+ function Yt(e) {
2124
2324
  return {
2125
2325
  offset: e.offset,
2126
2326
  line: e.line,
@@ -2130,7 +2330,7 @@ function Ot(e) {
2130
2330
  }
2131
2331
  //#endregion
2132
2332
  //#region src/ast/CborTextString.ts
2133
- var kt = new TextEncoder(), At = !1, G = class extends O {
2333
+ var Xt = new TextEncoder(), Zt = new TextDecoder(), Qt = !1, Y = class extends F {
2134
2334
  indefiniteLength = !1;
2135
2335
  value;
2136
2336
  encodingWidth;
@@ -2143,59 +2343,66 @@ var kt = new TextEncoder(), At = !1, G = class extends O {
2143
2343
  constructor(e, t) {
2144
2344
  super(), this.value = e, this.encodingWidth = t?.encodingWidth, this.ednParts = t?.ednParts, this.ednSource = t?.ednSource, this.quotedEdnSource = t?.quotedEdnSource, this.ednPartSources = t?.ednPartSources, this.ednPartIsByteString = t?.ednPartIsByteString, this.ednPartSpans = t?.ednPartSpans;
2145
2345
  }
2346
+ _isMultiWordText(e, t = !0, n) {
2347
+ return v(this.value);
2348
+ }
2146
2349
  _encodeTo(e, t) {
2147
2350
  e.writeTextString(3, this.value, this.encodingWidth);
2148
2351
  }
2149
- _toCDN(e, t) {
2150
- let n = a(e, this.encodingWidth, () => p(BigInt(kt.encode(this.value).length)));
2151
- return jt(this.value, n, e, t, this.ednParts, this.ednSource, this.quotedEdnSource, this.ednPartSources, this.ednPartSpans, this.comments?.dangling);
2352
+ _toCDN(e, n, r) {
2353
+ let i = t(e, this.encodingWidth, () => E(BigInt(Xt.encode(this.value).length)));
2354
+ return $t(this.value, i, e, n, this.ednParts, this.ednSource, this.quotedEdnSource, this.ednPartSources, this.ednPartSpans, this.comments?.dangling);
2152
2355
  }
2153
2356
  _toJS(e) {
2154
2357
  return this.value;
2155
2358
  }
2156
2359
  };
2157
- function jt(e, t, n, r, i, a, o, s, c, l) {
2158
- let u = v(n);
2159
- if (n?.preserveRawString && a !== void 0 && (u !== null || !/[\r\n]/.test(a))) return a + t;
2160
- if (n?.preserveTextString && o !== void 0 && (u !== null || !/[\r\n]/.test(o))) return o + t;
2161
- if (u === null) return ee(e) + t;
2162
- let d = n?.preserveRawString ? s : void 0, f = d?.some((e) => e !== void 0) ?? !1, { cdn: p, newline: te } = Nt(n), m = n?.preserveConcatenation && i !== void 0 && (i.length > 1 || f) ? i : void 0;
2163
- if (!p && !te && m === void 0) return ee(e) + t;
2164
- let h = p ? It(e) : null;
2165
- if (m !== void 0 && (h === null || f)) {
2166
- let e = n?.preserveComments ? ne(l, c, typeof n.preserveComments == "string" ? n.preserveComments : void 0) : void 0, i = [];
2167
- for (let [t, n] of m.entries()) {
2168
- let r = d?.[t];
2169
- if (r !== void 0) i.push({
2360
+ function $t(e, t, r, i, a, o, s, c, l, d) {
2361
+ let f = O(r);
2362
+ if (r?.preserveRawString && o !== void 0 && (f !== null || !/[\r\n]/.test(o))) return o + t;
2363
+ if (r?.preserveTextString && s !== void 0 && (f !== null || !/[\r\n]/.test(s))) return s + t;
2364
+ if (f === null) return h(e) + t;
2365
+ let g = r?.preserveRawString ? c : void 0, _ = g?.some((e) => e !== void 0) ?? !1, { cdn: v, newline: y } = tn(r), b = r?.preserveConcatenation && a !== void 0 && (a.length > 1 || _) ? a : void 0;
2366
+ if (!v && !y && b === void 0) return h(e) + t;
2367
+ let ee = v ? an(e, !!r?.inlineLeafContainers, y) : null;
2368
+ if (b !== void 0 && (ee === null || _)) {
2369
+ let e = n(r) ? p(d, l, u(r)) : void 0, a = [];
2370
+ for (let [t, n] of b.entries()) {
2371
+ let r = g?.[t];
2372
+ if (r !== void 0) a.push({
2170
2373
  text: n,
2171
2374
  contentDepth: 0,
2172
2375
  source: r
2173
2376
  });
2174
- else if (te) {
2377
+ else if (y) {
2175
2378
  let e = /* @__PURE__ */ new Map();
2176
- for (let { point: t, contentDepth: r } of Ft(n, 0)) e.set(t, r);
2177
- i.push(...Wt(n, e));
2178
- } else i.push({
2379
+ for (let { point: t, contentDepth: r } of rn(n, 0)) e.set(t, r);
2380
+ m(a, mn(n, e));
2381
+ } else a.push({
2179
2382
  text: n,
2180
2383
  contentDepth: 0
2181
2384
  });
2182
- let a = e?.[t];
2183
- a && a.length > 0 && (i[i.length - 1].commentsAfter = a);
2385
+ let i = e?.[t];
2386
+ i && i.length > 0 && (a[a.length - 1].commentsAfter = i);
2387
+ }
2388
+ if (r?.modernConcat && r?.appPrefix !== !1) {
2389
+ let e = a.map(({ text: e, source: t }) => t ?? h(e)), n = a.map((e) => e.commentsAfter ?? []);
2390
+ return ie("t1", e, t, f, i, n);
2184
2391
  }
2185
- return Mt(i, t, u, r);
2392
+ return en(a, t, f, i);
2186
2393
  }
2187
- let g = /* @__PURE__ */ new Map();
2188
- if (h !== null) for (let { point: e, contentDepth: t } of h) g.set(e, t);
2189
- if (te) {
2190
- let t = h === null ? Ft(e, 0) : Lt(e);
2191
- for (let { point: e, contentDepth: n } of t) g.has(e) || g.set(e, n);
2394
+ let x = /* @__PURE__ */ new Map();
2395
+ if (ee !== null) for (let { point: e, contentDepth: t } of ee) x.set(e, t);
2396
+ if (y) {
2397
+ let t = ee === null ? rn(e, 0) : on(e);
2398
+ for (let { point: e, contentDepth: n } of t) x.has(e) || x.set(e, n);
2192
2399
  }
2193
- let _ = Wt(e, g);
2194
- return _.length <= 1 ? ee(e) + t : Mt(_, t, u, r);
2400
+ let S = mn(e, x);
2401
+ return S.length <= 1 ? h(e) + t : en(S, t, f, i);
2195
2402
  }
2196
- function Mt(e, t, n, r) {
2403
+ function en(e, t, n, r) {
2197
2404
  let i = e.map(({ text: n, source: r }, i) => {
2198
- let a = r ?? ee(n);
2405
+ let a = r ?? h(n);
2199
2406
  return i === e.length - 1 ? a + t : a;
2200
2407
  }), a = i[0];
2201
2408
  for (let t = 1; t < i.length; t++) {
@@ -2206,17 +2413,17 @@ function Mt(e, t, n, r) {
2206
2413
  }
2207
2414
  return a;
2208
2415
  }
2209
- function Nt(e) {
2210
- let t = e?.splitCdn === void 0 || e?.splitNewline === void 0 ? Pt(e?.textStringFormat ?? []) : [];
2416
+ function tn(e) {
2417
+ let t = e?.splitCdn === void 0 || e?.splitNewline === void 0 ? nn(e?.textStringFormat ?? []) : [];
2211
2418
  return {
2212
2419
  cdn: e?.splitCdn ?? t.includes("cdn"),
2213
2420
  newline: e?.splitNewline ?? t.includes("newline")
2214
2421
  };
2215
2422
  }
2216
- function Pt(e) {
2217
- return e.map((e) => e === "cboredn" ? (At || (At = !0, console.warn("`textStringFormat: ['cboredn']` is deprecated; use `textStringFormat: ['cdn']` instead.")), "cdn") : e);
2423
+ function nn(e) {
2424
+ return e.map((e) => e === "cboredn" ? (Qt || (Qt = !0, console.warn("`textStringFormat: ['cboredn']` is deprecated; use `textStringFormat: ['cdn']` instead.")), "cdn") : e);
2218
2425
  }
2219
- function Ft(e, t) {
2426
+ function rn(e, t) {
2220
2427
  let n = [];
2221
2428
  for (let r = 0; r < e.length; r++) {
2222
2429
  let i = e[r];
@@ -2233,108 +2440,209 @@ function Ft(e, t) {
2233
2440
  }
2234
2441
  return n;
2235
2442
  }
2236
- function It(e) {
2443
+ function an(t, n, r) {
2237
2444
  try {
2238
- lt(e);
2445
+ Ot(t);
2239
2446
  } catch {
2240
2447
  return null;
2241
2448
  }
2242
- let t = [], n = new re(e), r = 0, i = null, a = !1, o = 0;
2449
+ let a = [], o = new e(t), s = 0, c = null, l = !1, u = 0, d = null, f = [], p = (e, t) => {
2450
+ let n = f[f.length - 1];
2451
+ n ? n.ownCandidates.push({
2452
+ point: e,
2453
+ contentDepth: t
2454
+ }) : a.push({
2455
+ point: e,
2456
+ contentDepth: t
2457
+ });
2458
+ }, m = (e) => e.kind === "LT_LT" || e.kind === "APP_SEQUENCE", h = () => {
2459
+ for (let e = f.length - 1; e >= 0; e--) {
2460
+ let t = f[e];
2461
+ if (!(t.kind === "LPAREN" && t.isTagParen)) return t;
2462
+ }
2463
+ }, g = (e) => {
2464
+ let t = (m(e) || !e.entryHasContainer) && !e.entryForcedBreak;
2465
+ e.allOk = e.allOk && t, e.anyForcedBreak = e.anyForcedBreak || e.entryForcedBreak, e.anyForcedBreakStructural = e.anyForcedBreakStructural || e.entryForcedBreakStructural, e.entryHasContainer = !1, e.entryForcedBreak = !1, e.entryForcedBreakStructural = !1;
2466
+ }, _ = "none", y = [], b = !1, x = !1, S = !1, C = !1, w = [], T = !1, te = (e) => {
2467
+ w.push({
2468
+ depth: e,
2469
+ kind: _,
2470
+ texts: y,
2471
+ broken: b,
2472
+ hasEllipsis: x,
2473
+ sawPlus: S,
2474
+ awaitingTagCheck: C
2475
+ }), _ = "none", y = [], b = !1, x = !1, S = !1, C = !1, T = !0;
2476
+ }, E = () => {
2477
+ let e = w[w.length - 1];
2478
+ e !== void 0 && s === e.depth && (w.pop(), _ = e.kind, y = e.texts, b = e.broken, x = e.hasEllipsis, S = e.sawPlus, C = e.awaitingTagCheck);
2479
+ }, ne = () => {
2480
+ if (x && S) for (let e of f) e.entryHasContainer = !0;
2481
+ if (_ === "text" && !b && y.length > 0 && v(y.join(""))) {
2482
+ let e = f[f.length - 1];
2483
+ e && (e.entryForcedBreak = !0);
2484
+ }
2485
+ _ = "none", y = [], b = !1, x = !1, S = !1, C = !1;
2486
+ };
2243
2487
  for (;;) {
2244
- let s = n.consume();
2245
- if (s.type === "EOF") break;
2246
- let c = !1;
2247
- if (a || (a = !0, s.offset > 0 && Ht(n.comments, 0, s.offset) && t.push({
2248
- point: s.offset,
2249
- contentDepth: r
2250
- })), i !== null) {
2251
- if (i.kind === "opener" && zt.has(s.type)) {
2252
- i.point = s.endOffset, o = s.endOffset;
2488
+ let e = o.consume();
2489
+ if (e.type === "EOF") {
2490
+ ne();
2491
+ break;
2492
+ }
2493
+ let v = !1, w = !1;
2494
+ if (C && (e.type === "ENCODING_INDICATOR" ? w = !0 : e.type === "LPAREN" ? (C = !1, te(s), w = !0) : C = !1), !w) {
2495
+ let t = e.type === "PLUS" || e.type === "ENCODING_INDICATOR" || d === "PLUS" && (dn.has(e.type) || e.type === "ELLIPSIS");
2496
+ _ !== "none" && !t && (d === "PLUS" && x ? ln.has(e.type) ? te(s) : e.type === "INTEGER" && (C = !0) : ne()), e.type === "PLUS" && _ !== "none" && (S = !0);
2497
+ }
2498
+ if (l || (l = !0, e.offset > 0 && fn(o.comments, 0, e.offset) && p(e.offset, s)), c !== null) {
2499
+ if (c.kind === "opener" && cn.has(e.type)) {
2500
+ c.point = e.endOffset, d = e.type, u = e.endOffset;
2253
2501
  continue;
2254
- } else i.kind === "opener" && Vt.has(s.type) && Ut(e, i.point, s.offset) ? c = !0 : t.push({
2255
- point: s.offset,
2256
- contentDepth: i.contentDepth
2257
- });
2258
- i = null;
2259
- }
2260
- Bt.has(s.type) ? (r++, i = {
2261
- point: s.endOffset,
2262
- contentDepth: r,
2263
- kind: "opener"
2264
- }) : Vt.has(s.type) ? (r = Math.max(0, r - 1), c || t.push({
2265
- point: s.offset,
2266
- contentDepth: r
2267
- })) : s.type === "COMMA" && (i = {
2268
- point: s.endOffset,
2269
- contentDepth: r,
2270
- kind: "comma"
2271
- }), o = s.endOffset;
2272
- }
2273
- let s = n.comments.find((e) => e.start >= o);
2274
- return s !== void 0 && t.push({
2275
- point: s.start,
2276
- contentDepth: r
2277
- }), t;
2278
- }
2279
- function Lt(e) {
2280
- let t = [], n = new re(e), r = 0;
2502
+ }
2503
+ c.kind === "opener" && un.has(e.type) && pn(t, c.point, e.offset) ? v = !0 : p(e.offset, c.contentDepth), c = null;
2504
+ }
2505
+ if (ln.has(e.type)) {
2506
+ if (e.type === "LBRACKET" || e.type === "LBRACE") for (let e of f) e.entryHasContainer = !0;
2507
+ s++, c = {
2508
+ point: e.endOffset,
2509
+ contentDepth: s,
2510
+ kind: "opener"
2511
+ }, f.push({
2512
+ kind: e.type,
2513
+ isTagParen: e.type === "LPAREN" && d === "INTEGER",
2514
+ isChainContinuationRoot: T,
2515
+ openOffset: e.offset,
2516
+ ownCandidates: [],
2517
+ childCandidates: [],
2518
+ entryHasContainer: !1,
2519
+ entryForcedBreak: !1,
2520
+ anyForcedBreak: !1,
2521
+ entryForcedBreakStructural: !1,
2522
+ anyForcedBreakStructural: !1,
2523
+ allOk: !0
2524
+ }), T = !1;
2525
+ } else if (un.has(e.type)) {
2526
+ s = Math.max(0, s - 1), E(), v || p(e.offset, s);
2527
+ let t = f.pop();
2528
+ if (t) {
2529
+ g(t);
2530
+ let r = t.kind === "LPAREN" && t.isTagParen, i = (m(t) || n && (t.kind === "LBRACKET" || t.kind === "LBRACE" || t.kind === "LPAREN")) && t.ownCandidates.length > 0 && (r || t.allOk) && !fn(o.comments, t.openOffset, e.endOffset) ? t.childCandidates : [...t.ownCandidates, ...t.childCandidates], s = f[f.length - 1];
2531
+ if (s) {
2532
+ for (let e of i) s.childCandidates.push(e);
2533
+ let e = i.length > 0 || t.anyForcedBreakStructural;
2534
+ (t.isChainContinuationRoot && t.isTagParen ? e : i.length > 0 || t.anyForcedBreak) && (s.entryForcedBreak = !0), e && (s.entryForcedBreakStructural = !0);
2535
+ } else for (let e of i) a.push(e);
2536
+ }
2537
+ } else if (e.type === "COMMA") {
2538
+ let t = f[f.length - 1];
2539
+ t && g(t), c = {
2540
+ point: e.endOffset,
2541
+ contentDepth: s,
2542
+ kind: "comma"
2543
+ };
2544
+ } else if (e.type === "TSTR" || e.type === "RAWSTRING") {
2545
+ let n = t.slice(e.offset, e.endOffset);
2546
+ if (r && (e.type === "TSTR" ? sn(n).length > 0 : rn(n, 0).length > 0)) {
2547
+ let e = f[f.length - 1];
2548
+ e && (e.entryForcedBreak = !0, e.entryForcedBreakStructural = !0);
2549
+ }
2550
+ d === "PLUS" && _ === "text" ? y.push(e.value) : (_ = "text", y = [e.value], b = !1);
2551
+ } else if (e.type === "SQSTR") {
2552
+ if (d !== "PLUS" || _ !== "byte") {
2553
+ let t = e._sqstrBytes, n = t ? Zt.decode(t) : null;
2554
+ d === "PLUS" && _ === "text" ? n === null ? b = !0 : y.push(n) : (_ = "text", y = n === null ? [] : [n], b = n === null);
2555
+ }
2556
+ } else if (e.type === "BYTES_HEX" || e.type === "BYTES_HEX_ELIDED" || e.type === "BYTES_B64" || e.type === "APP_STRING") {
2557
+ if (d === "PLUS" && _ === "text") {
2558
+ let t = null;
2559
+ try {
2560
+ e.type === "BYTES_HEX" ? t = Zt.decode(i(e.value)) : e.type === "BYTES_B64" && (t = Zt.decode(ee(e.value)));
2561
+ } catch {
2562
+ t = null;
2563
+ }
2564
+ t === null ? b = !0 : y.push(t);
2565
+ } else {
2566
+ let e = f[f.length - 1], t = h();
2567
+ e && (!t || !m(t)) && (e.entryForcedBreak = !0), (d !== "PLUS" || _ === "none") && (_ = "byte");
2568
+ }
2569
+ } else e.type === "ELLIPSIS" && (x = !0, d === "PLUS" && _ === "text" ? b = !0 : (d !== "PLUS" || _ === "none") && (_ = "text", y = [], b = !0));
2570
+ d = e.type, u = e.endOffset;
2571
+ }
2572
+ let D = o.comments.find((e) => e.start >= u);
2573
+ return D !== void 0 && a.push({
2574
+ point: D.start,
2575
+ contentDepth: s
2576
+ }), a;
2577
+ }
2578
+ function on(t) {
2579
+ let n = [], r = new e(t), i = 0;
2281
2580
  for (;;) {
2282
- let i = n.consume();
2283
- if (i.type === "EOF") break;
2284
- if (Bt.has(i.type)) r++;
2285
- else if (Vt.has(i.type)) r = Math.max(0, r - 1);
2286
- else if (i.type !== "COMMA") {
2287
- if (i.type === "TSTR") {
2288
- let n = e.slice(i.offset, i.endOffset);
2289
- for (let e of Rt(n)) t.push({
2290
- point: i.offset + e,
2291
- contentDepth: r + 1
2581
+ let e = r.consume();
2582
+ if (e.type === "EOF") break;
2583
+ if (ln.has(e.type)) i++;
2584
+ else if (un.has(e.type)) i = Math.max(0, i - 1);
2585
+ else if (e.type !== "COMMA") {
2586
+ if (e.type === "TSTR") {
2587
+ let r = t.slice(e.offset, e.endOffset);
2588
+ for (let t of sn(r)) n.push({
2589
+ point: e.offset + t,
2590
+ contentDepth: i + 1
2292
2591
  });
2293
- } else if (i.type === "RAWSTRING") {
2294
- let n = e.slice(i.offset, i.endOffset);
2295
- for (let { point: e } of Ft(n, 0)) t.push({
2296
- point: i.offset + e,
2297
- contentDepth: r + 1
2592
+ } else if (e.type === "RAWSTRING") {
2593
+ let r = t.slice(e.offset, e.endOffset);
2594
+ for (let { point: t } of rn(r, 0)) n.push({
2595
+ point: e.offset + t,
2596
+ contentDepth: i + 1
2298
2597
  });
2299
2598
  }
2300
2599
  }
2301
2600
  }
2302
- return t;
2601
+ return n;
2303
2602
  }
2304
- function Rt(e) {
2603
+ function sn(e) {
2305
2604
  let t = [], n = 1, r = e.length - 1;
2306
2605
  for (; n < r;) {
2307
2606
  let r = e[n];
2308
2607
  if (r === "\\") {
2309
2608
  let r = e[n + 1];
2310
2609
  if (r === "n" || r === "r") t.push(n + 2), n += 2;
2311
- else if (r === "u") if (e[n + 2] === "{") {
2312
- let t = e.indexOf("}", n + 3);
2313
- n = t >= 0 ? t + 1 : n + 2;
2314
- } else n += 6;
2315
- else n += 2;
2610
+ else if (r === "u") {
2611
+ if (e[n + 2] === "{") {
2612
+ let t = e.indexOf("}", n + 3);
2613
+ n = t >= 0 ? t + 1 : n + 2;
2614
+ } else n += 6;
2615
+ } else n += 2;
2316
2616
  } else r === "\r" ? e[n + 1] === "\n" ? (t.push(n + 2), n += 2) : (t.push(n + 1), n++) : (r === "\n" && t.push(n + 1), n++);
2317
2617
  }
2318
2618
  return t;
2319
2619
  }
2320
- var zt = /* @__PURE__ */ new Set(["ENCODING_INDICATOR", "UNDERSCORE"]), Bt = /* @__PURE__ */ new Set([
2620
+ var cn = /* @__PURE__ */ new Set(["ENCODING_INDICATOR", "UNDERSCORE"]), ln = /* @__PURE__ */ new Set([
2321
2621
  "LBRACKET",
2322
2622
  "LBRACE",
2323
2623
  "LPAREN",
2324
- "LT_LT"
2325
- ]), Vt = /* @__PURE__ */ new Set([
2624
+ "LT_LT",
2625
+ "APP_SEQUENCE"
2626
+ ]), un = /* @__PURE__ */ new Set([
2326
2627
  "RBRACKET",
2327
2628
  "RBRACE",
2328
2629
  "RPAREN",
2329
2630
  "GT_GT"
2631
+ ]), dn = /* @__PURE__ */ new Set([
2632
+ "TSTR",
2633
+ "RAWSTRING",
2634
+ "SQSTR",
2635
+ "BYTES_HEX",
2636
+ "BYTES_HEX_ELIDED",
2637
+ "BYTES_B64"
2330
2638
  ]);
2331
- function Ht(e, t, n) {
2639
+ function fn(e, t, n) {
2332
2640
  return e.some((e) => e.start >= t && e.end <= n);
2333
2641
  }
2334
- function Ut(e, t, n) {
2642
+ function pn(e, t, n) {
2335
2643
  return /^[\t\n\r ]*$/.test(e.slice(t, n));
2336
2644
  }
2337
- function Wt(e, t) {
2645
+ function mn(e, t) {
2338
2646
  let n = [...t].filter(([t]) => t > 0 && t < e.length).sort(([e], [t]) => e - t);
2339
2647
  if (n.length === 0) return [{
2340
2648
  text: e,
@@ -2352,7 +2660,7 @@ function Wt(e, t) {
2352
2660
  }
2353
2661
  //#endregion
2354
2662
  //#region src/extensions/dt.ts
2355
- function Gt(e) {
2663
+ function hn(e) {
2356
2664
  if (Number.isInteger(e)) return (/* @__PURE__ */ new Date(e * 1e3)).toISOString().replace(/\.000Z$/, "Z");
2357
2665
  let t = Math.round(e * 1e3);
2358
2666
  if (t / 1e3 === e) return new Date(t).toISOString().replace(/\.000Z$/, "Z");
@@ -2360,17 +2668,17 @@ function Gt(e) {
2360
2668
  for (; s.length < 3;) s += "0";
2361
2669
  return `${i}.${s}Z`;
2362
2670
  }
2363
- var Kt = new TextDecoder("utf-8", { fatal: !0 });
2364
- function qt(e) {
2671
+ var gn = new TextDecoder("utf-8", { fatal: !0 });
2672
+ function _n(e) {
2365
2673
  if (e.length !== 1) throw SyntaxError("dt<<...>>: expected exactly one item");
2366
2674
  let t = e[0];
2367
- if (t instanceof G) return t.value;
2368
- if (t instanceof N) return Kt.decode(t.value);
2675
+ if (t instanceof Y) return t.value;
2676
+ if (t instanceof B) return gn.decode(t.value);
2369
2677
  throw SyntaxError("dt<<...>>: expected a text string or byte string");
2370
2678
  }
2371
- var Jt = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i;
2372
- function Yt(e, t) {
2373
- if (!Jt.test(e)) {
2679
+ var vn = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i;
2680
+ function yn(e, t) {
2681
+ if (!vn.test(e)) {
2374
2682
  let n = `dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`;
2375
2683
  if (t) t(n);
2376
2684
  else throw SyntaxError(n);
@@ -2381,110 +2689,123 @@ function Yt(e, t) {
2381
2689
  if (isNaN(a)) throw SyntaxError(`dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`);
2382
2690
  if (i === void 0) {
2383
2691
  let e = a / 1e3;
2384
- return e >= 0 ? new Zt(BigInt(e)) : new Qt(BigInt(e));
2692
+ return e >= 0 ? new xn(BigInt(e)) : new Sn(BigInt(e));
2385
2693
  }
2386
- return new $t(a / 1e3 + i);
2694
+ return new Cn(a / 1e3 + i);
2387
2695
  }
2388
- var Xt = 1n, Zt = class extends k {
2696
+ var bn = 1n, xn = class extends I {
2389
2697
  constructor(e, t) {
2390
2698
  super(e, t);
2391
2699
  }
2392
- _toCDN(e, t) {
2393
- if (e?.appStrings === !1) return super._toCDN(e, t);
2394
- let n = a(e, this.encodingWidth, () => p(this.value));
2395
- return _(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted" ? m(this.appSeqSource, n, e, this.appSeqInnerEnd, this.appSeqComments) : `dt'${Gt(Number(this.value))}'${n}`;
2700
+ _toCDN(e, n, r) {
2701
+ if (e?.appPrefix === !1) return super._toCDN(e, n, r);
2702
+ let i = t(e, this.encodingWidth, () => E(this.value));
2703
+ return T(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted" ? D(this.appSeqSource, i, e, this.appSeqInnerEnd, this.appSeqComments) : `dt'${hn(Number(this.value))}'${i}`;
2396
2704
  }
2397
- }, Qt = class extends A {
2705
+ }, Sn = class extends L {
2398
2706
  constructor(e, t) {
2399
2707
  super(e, t);
2400
2708
  }
2401
- _toCDN(e, t) {
2402
- if (e?.appStrings === !1) return super._toCDN(e, t);
2403
- let n = a(e, this.encodingWidth, () => p(this.argument));
2404
- return _(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted" ? m(this.appSeqSource, n, e, this.appSeqInnerEnd, this.appSeqComments) : `dt'${Gt(Number(this.value))}'${n}`;
2709
+ _toCDN(e, n, r) {
2710
+ if (e?.appPrefix === !1) return super._toCDN(e, n, r);
2711
+ let i = t(e, this.encodingWidth, () => E(this.argument));
2712
+ return T(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted" ? D(this.appSeqSource, i, e, this.appSeqInnerEnd, this.appSeqComments) : `dt'${hn(Number(this.value))}'${i}`;
2405
2713
  }
2406
- }, $t = class extends j {
2714
+ }, Cn = class extends R {
2407
2715
  constructor(e, t) {
2408
2716
  super(e, t);
2409
2717
  }
2410
- _toCDN(e, t) {
2411
- if (e?.appStrings === !1) return super._toCDN(e, t);
2412
- let n = D(this.value), r = ie(this.value, this.precision, n, e?.encodingIndicators ?? "auto");
2413
- return _(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted" ? m(this.appSeqSource, r, e, this.appSeqInnerEnd, this.appSeqComments) : `dt'${Gt(this.value)}'${r}`;
2718
+ _toCDN(e, t, n) {
2719
+ if (e?.appPrefix === !1) return super._toCDN(e, t, n);
2720
+ let r = P(this.value), i = S(this.value, this.precision, r, e?.encodingIndicators ?? "auto");
2721
+ return T(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted" ? D(this.appSeqSource, i, e, this.appSeqInnerEnd, this.appSeqComments) : `dt'${hn(this.value)}'${i}`;
2414
2722
  }
2415
- }, en = class extends M {
2723
+ }, wn = class extends z {
2416
2724
  constructor(e, t) {
2417
- super(Xt, typeof e == "string" ? Yt(e) : e, t);
2418
- }
2419
- _toCDN(e, t) {
2420
- if (e?.appStrings === !1) return super._toCDN(e, t);
2421
- let n = _(e, this.appSeqSource, this.ednSource, this.appSeqSourceFeatures, this.appSeqEncodingEditsComplete);
2422
- if (n === "verbatim") return this.appSeqSource;
2423
- if (n === "source") return g(this.appSeqSource, e, this.appSeqComments, this.appSeqEncodingEdits);
2424
- if (n === "structural") return super._toCDN({
2725
+ super(bn, typeof e == "string" ? yn(e) : e, t);
2726
+ }
2727
+ _toCDN(e, n, r) {
2728
+ if (e?.appPrefix === !1) return super._toCDN(e, n, r);
2729
+ let i = T(e, this.appSeqSource, this.ednSource, this.appSeqSourceFeatures, this.appSeqEncodingEditsComplete);
2730
+ if (i === "verbatim") return this.appSeqSource;
2731
+ if (i === "source") return w(this.appSeqSource, e, this.appSeqComments, this.appSeqEncodingEdits);
2732
+ if (i === "structural") return super._toCDN({
2425
2733
  ...e,
2426
- appStrings: !1
2427
- }, t);
2428
- let r = a(e, this.encodingWidth, () => p(Xt));
2429
- if (n === "adjusted") return m(this.appSeqSource, r, e, this.appSeqInnerEnd, this.appSeqComments);
2430
- let i = this.content;
2431
- return (i instanceof j ? i.precision !== void 0 && i.precision !== D(i.value) : i.encodingWidth !== void 0) ? super._toCDN({
2734
+ appPrefix: !1
2735
+ }, n, r);
2736
+ let a = t(e, this.encodingWidth, () => E(bn));
2737
+ if (i === "adjusted") return D(this.appSeqSource, a, e, this.appSeqInnerEnd, this.appSeqComments);
2738
+ let o = this.content;
2739
+ return (o instanceof R ? o.precision !== void 0 && o.precision !== P(o.value) : o.encodingWidth !== void 0) ? super._toCDN({
2432
2740
  ...e,
2433
- appStrings: !1
2434
- }, t) : `DT'${Gt(i instanceof j ? i.value : Number(i.value))}'${r}`;
2741
+ appPrefix: !1
2742
+ }, n, r) : `DT'${hn(o instanceof R ? o.value : Number(o.value))}'${a}`;
2435
2743
  }
2436
- }, tn = class extends en {
2744
+ }, Tn = class extends wn {
2437
2745
  constructor(e, t) {
2438
2746
  super(e, t);
2439
2747
  }
2440
2748
  _toJS(e) {
2441
- let t = this.content, n = t instanceof j ? t.value * 1e3 : Number(t.value) * 1e3;
2749
+ let t = this.content, n = t instanceof R ? t.value * 1e3 : Number(t.value) * 1e3;
2442
2750
  return new Date(n);
2443
2751
  }
2444
2752
  };
2445
- function nn(e) {
2753
+ function En(e) {
2754
+ return (t, n) => {
2755
+ if (!(t instanceof wn)) return;
2756
+ let r = t.content;
2757
+ if (e) {
2758
+ let e = r instanceof R ? r.value * 1e3 : Number(r.value) * 1e3;
2759
+ return { value: new Date(e) };
2760
+ }
2761
+ let i = r._toJS(n);
2762
+ return { value: n.stripTags ? i : k.set(i, t.tag) };
2763
+ };
2764
+ }
2765
+ function Dn(e) {
2446
2766
  let t = e?.jsDate ?? !1;
2447
2767
  function n(e) {
2448
- return t ? new tn(e) : new en(e);
2768
+ return t ? new Tn(e) : new wn(e);
2449
2769
  }
2450
2770
  let r = {
2451
2771
  appStringPrefixes: ["dt", "DT"],
2452
- tagNumbers: [Xt],
2772
+ tagNumbers: [bn],
2453
2773
  preserveAppSeqSource: "optional",
2774
+ toJS: En(t),
2454
2775
  parseAppString(e, t, r) {
2455
- return e === "DT" ? n(t) : Yt(t, r);
2776
+ return e === "DT" ? n(t) : yn(t, r);
2456
2777
  },
2457
2778
  parseAppSequence(e, t, r) {
2458
- let i = qt(t);
2459
- return e === "DT" ? n(i) : Yt(i, r);
2779
+ let i = _n(t);
2780
+ return e === "DT" ? n(i) : yn(i, r);
2460
2781
  },
2461
2782
  parseTag(e, n) {
2462
2783
  if (e !== 1n) return;
2463
2784
  let r;
2464
- if (n instanceof k) r = new Zt(n.value, {
2785
+ if (n instanceof I) r = new xn(n.value, {
2465
2786
  encodingWidth: n.encodingWidth,
2466
2787
  ednSource: n.ednSource
2467
2788
  });
2468
- else if (n instanceof A) r = new Qt(n.value, {
2789
+ else if (n instanceof L) r = new Sn(n.value, {
2469
2790
  encodingWidth: n.encodingWidth,
2470
2791
  ednSource: n.ednSource
2471
2792
  });
2472
- else if (n instanceof j) r = new $t(n.value, {
2793
+ else if (n instanceof R) r = new Cn(n.value, {
2473
2794
  precision: n.precision,
2474
2795
  literalSource: n.literalSource
2475
2796
  });
2476
2797
  else return;
2477
- return r.start = n.start, r.end = n.end, t ? new tn(r) : new en(r);
2798
+ return r.start = n.start, r.end = n.end, t ? new Tn(r) : new wn(r);
2478
2799
  }
2479
2800
  };
2480
2801
  return t && (r.fromJS = (e, t) => {
2481
- if (e instanceof Date) return new tn(Gt(e.getTime() / 1e3));
2802
+ if (e instanceof Date) return new Tn(hn(e.getTime() / 1e3));
2482
2803
  }, r.isJSType = (e) => e instanceof Date), r;
2483
2804
  }
2484
- var rn = nn(), an = nn({ jsDate: !0 });
2805
+ var On = Dn(), kn = Dn({ jsDate: !0 });
2485
2806
  //#endregion
2486
2807
  //#region src/utils/ip.ts
2487
- function on(e) {
2808
+ function An(e) {
2488
2809
  let t = e.split(".");
2489
2810
  if (t.length !== 4) throw SyntaxError(`ip: invalid IPv4 address: ${JSON.stringify(e)}`);
2490
2811
  let n = /* @__PURE__ */ new Uint8Array(4);
@@ -2497,11 +2818,11 @@ function on(e) {
2497
2818
  }
2498
2819
  return n;
2499
2820
  }
2500
- function sn(e) {
2821
+ function jn(e) {
2501
2822
  let t = /* @__PURE__ */ new Uint8Array(16);
2502
2823
  if (e === "::") return t;
2503
2824
  let n = e, r = null, i = e.match(/^(.*):(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);
2504
- i && (n = i[1], n.endsWith(":") && (n += ":"), r = on(i[2]));
2825
+ i && (n = i[1], n.endsWith(":") && (n += ":"), r = An(i[2]));
2505
2826
  let a = n.split("::");
2506
2827
  if (a.length > 2) throw SyntaxError(`ip: invalid IPv6 address: ${JSON.stringify(e)}`);
2507
2828
  let o = a.length === 2, s = a[0] ? a[0].split(":") : [], c = o && a[1] ? a[1].split(":") : [], l = r ? 6 : 8;
@@ -2518,11 +2839,11 @@ function sn(e) {
2518
2839
  }
2519
2840
  return r && t.set(r, 12), t;
2520
2841
  }
2521
- function cn(e) {
2842
+ function Mn(e) {
2522
2843
  return Array.from(e).join(".");
2523
2844
  }
2524
- function ln(e) {
2525
- let t = e.slice(0, 10).every((e) => e === 0) && e[10] === 255 && e[11] === 255 ? cn(e.slice(12)) : null, n = t ? 6 : 8, r = [];
2845
+ function Nn(e) {
2846
+ let t = e.slice(0, 10).every((e) => e === 0) && e[10] === 255 && e[11] === 255 ? Mn(e.slice(12)) : null, n = t ? 6 : 8, r = [];
2526
2847
  for (let t = 0; t < n * 2; t += 2) r.push(e[t] << 8 | e[t + 1]);
2527
2848
  let i = -1, a = 0, o = 0;
2528
2849
  for (; o < n;) if (r[o] === 0) {
@@ -2536,29 +2857,29 @@ function ln(e) {
2536
2857
  }
2537
2858
  //#endregion
2538
2859
  //#region src/extensions/ip.ts
2539
- var un = "ip", dn = "IP", fn = 52n, pn = 54n, mn = new TextDecoder("utf-8", { fatal: !0 });
2540
- function hn(e) {
2860
+ var Pn = "ip", Fn = "IP", In = 52n, Ln = 54n, Rn = new TextDecoder("utf-8", { fatal: !0 });
2861
+ function zn(e) {
2541
2862
  if (e.length !== 1) throw SyntaxError("ip<<...>>: expected exactly one item");
2542
2863
  let t = e[0];
2543
- if (t instanceof G) return t.value;
2544
- if (t instanceof N) return mn.decode(t.value);
2864
+ if (t instanceof Y) return t.value;
2865
+ if (t instanceof B) return Rn.decode(t.value);
2545
2866
  throw SyntaxError("ip<<...>>: expected a text string or byte string");
2546
2867
  }
2547
- function gn(e) {
2868
+ function Bn(e) {
2548
2869
  return /^\d/.test(e) && e.includes(".") && !e.includes(":") ? {
2549
- bytes: on(e),
2870
+ bytes: An(e),
2550
2871
  isV4: !0
2551
2872
  } : {
2552
- bytes: sn(e),
2873
+ bytes: jn(e),
2553
2874
  isV4: !1
2554
2875
  };
2555
2876
  }
2556
- function _n(e) {
2557
- if (e.length === 4) return cn(e);
2558
- if (e.length === 16) return ln(e);
2877
+ function Vn(e) {
2878
+ if (e.length === 4) return Mn(e);
2879
+ if (e.length === 16) return Nn(e);
2559
2880
  throw SyntaxError(`ip: unexpected byte length: ${e.length}`);
2560
2881
  }
2561
- function vn(e, t) {
2882
+ function Hn(e, t) {
2562
2883
  let n = new Uint8Array(e.length);
2563
2884
  n.set(e);
2564
2885
  let r = Math.floor(t / 8), i = t % 8;
@@ -2568,82 +2889,82 @@ function vn(e, t) {
2568
2889
  for (; a > 0 && n[a - 1] === 0;) a--;
2569
2890
  return n.slice(0, a);
2570
2891
  }
2571
- function yn(e, t) {
2892
+ function Un(e, t) {
2572
2893
  let n = new Uint8Array(t);
2573
2894
  return n.set(e), n;
2574
2895
  }
2575
- var bn = class extends N {
2576
- _toCDN(e, t) {
2577
- if (e?.appStrings === !1) return super._toCDN(e, t);
2578
- let n = a(e, this.encodingWidth, () => p(BigInt(this.value.length)));
2579
- return _(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted" ? m(this.appSeqSource, n, e, this.appSeqInnerEnd, this.appSeqComments) : `${un}'${_n(this.value)}'${n}`;
2896
+ var Wn = class extends B {
2897
+ _toCDN(e, n, r) {
2898
+ if (e?.appPrefix === !1) return super._toCDN(e, n, r);
2899
+ let i = t(e, this.encodingWidth, () => E(BigInt(this.value.length)));
2900
+ return T(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted" ? D(this.appSeqSource, i, e, this.appSeqInnerEnd, this.appSeqComments) : `${Pn}'${Vn(this.value)}'${i}`;
2580
2901
  }
2581
- }, xn = class extends I {
2902
+ }, Gn = class extends U {
2582
2903
  _isV4;
2583
2904
  constructor(e, t, n) {
2584
- super([new k(BigInt(e)), new N(t)]), this._isV4 = n;
2905
+ super([new I(BigInt(e)), new B(t)]), this._isV4 = n;
2585
2906
  }
2586
- _toCDN(e, t) {
2587
- if (e?.appStrings === !1) return super._toCDN(e, t);
2588
- if (_(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted") return m(this.appSeqSource, "", e, this.appSeqInnerEnd, this.appSeqComments);
2589
- let n = Number(this.items[0].value), r = this.items[1].value;
2590
- return `${un}'${_n(yn(r, this._isV4 ? 4 : 16))}/${n}'`;
2907
+ _toCDN(e, t, n) {
2908
+ if (e?.appPrefix === !1) return super._toCDN(e, t, n);
2909
+ if (T(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted") return D(this.appSeqSource, "", e, this.appSeqInnerEnd, this.appSeqComments);
2910
+ let r = Number(this.items[0].value), i = this.items[1].value;
2911
+ return `${Pn}'${Vn(Un(i, this._isV4 ? 4 : 16))}/${r}'`;
2591
2912
  }
2592
- }, Sn = class extends M {
2913
+ }, Kn = class extends z {
2593
2914
  constructor(e, t) {
2594
2915
  super(e, t);
2595
2916
  }
2596
- _toCDN(e, t) {
2597
- if (e?.appStrings === !1) return super._toCDN(e, t);
2598
- let n = _(e, this.appSeqSource, this.ednSource, this.appSeqSourceFeatures, this.appSeqEncodingEditsComplete);
2599
- if (n === "verbatim") return this.appSeqSource;
2600
- if (n === "source") return g(this.appSeqSource, e, this.appSeqComments, this.appSeqEncodingEdits);
2601
- if (n === "structural") return super._toCDN(e, t);
2602
- if (n === "adjusted") {
2603
- let t = a(e, this.encodingWidth, () => p(this.tag));
2604
- return m(this.appSeqSource, t, e, this.appSeqInnerEnd, this.appSeqComments);
2605
- }
2606
- let r = this.tag === fn ? 4 : 16, i = this.content;
2607
- if (i instanceof N) {
2608
- if (i.encodingWidth !== void 0) return super._toCDN(e, t);
2609
- let n = a(e, this.encodingWidth, () => p(this.tag));
2610
- return `${dn}'${_n(i.value)}'${n}`;
2611
- }
2612
- if (i instanceof I && i.items.length === 2 && i.items[0] instanceof k && i.items[1] instanceof N) {
2613
- if (i.encodingWidth !== void 0 || i.items[0].encodingWidth !== void 0 || i.items[1].encodingWidth !== void 0) return super._toCDN(e, t);
2614
- let n = Number(i.items[0].value), o = yn(i.items[1].value, r), s = a(e, this.encodingWidth, () => p(this.tag));
2615
- return `${dn}'${_n(o)}/${n}'${s}`;
2616
- }
2617
- return super._toCDN(e, t);
2917
+ _toCDN(e, n, r) {
2918
+ if (e?.appPrefix === !1) return super._toCDN(e, n, r);
2919
+ let i = T(e, this.appSeqSource, this.ednSource, this.appSeqSourceFeatures, this.appSeqEncodingEditsComplete);
2920
+ if (i === "verbatim") return this.appSeqSource;
2921
+ if (i === "source") return w(this.appSeqSource, e, this.appSeqComments, this.appSeqEncodingEdits);
2922
+ if (i === "structural") return super._toCDN(e, n, r);
2923
+ if (i === "adjusted") {
2924
+ let n = t(e, this.encodingWidth, () => E(this.tag));
2925
+ return D(this.appSeqSource, n, e, this.appSeqInnerEnd, this.appSeqComments);
2926
+ }
2927
+ let a = this.tag === In ? 4 : 16, o = this.content;
2928
+ if (o instanceof B) {
2929
+ if (o.encodingWidth !== void 0) return super._toCDN(e, n, r);
2930
+ let i = t(e, this.encodingWidth, () => E(this.tag));
2931
+ return `${Fn}'${Vn(o.value)}'${i}`;
2932
+ }
2933
+ if (o instanceof U && o.items.length === 2 && o.items[0] instanceof I && o.items[1] instanceof B) {
2934
+ if (o.encodingWidth !== void 0 || o.items[0].encodingWidth !== void 0 || o.items[1].encodingWidth !== void 0) return super._toCDN(e, n, r);
2935
+ let i = Number(o.items[0].value), s = Un(o.items[1].value, a), c = t(e, this.encodingWidth, () => E(this.tag));
2936
+ return `${Fn}'${Vn(s)}/${i}'${c}`;
2937
+ }
2938
+ return super._toCDN(e, n, r);
2618
2939
  }
2619
2940
  };
2620
- function Cn(e, t) {
2941
+ function qn(e, t) {
2621
2942
  let n = t.indexOf("/");
2622
2943
  if (n === -1) {
2623
- let { bytes: n, isV4: r } = gn(t);
2624
- return e === dn ? new Sn(r ? fn : pn, new N(n)) : new bn(n);
2944
+ let { bytes: n, isV4: r } = Bn(t);
2945
+ return e === Fn ? new Kn(r ? In : Ln, new B(n)) : new Wn(n);
2625
2946
  }
2626
2947
  let r = t.slice(0, n), i = t.slice(n + 1);
2627
2948
  if (!/^\d+$/.test(i)) throw SyntaxError(`ip: invalid prefix length: ${JSON.stringify(i)}`);
2628
- let a = parseInt(i, 10), { bytes: o, isV4: s } = gn(r), c = s ? 32 : 128;
2949
+ let a = parseInt(i, 10), { bytes: o, isV4: s } = Bn(r), c = s ? 32 : 128;
2629
2950
  if (a > c) throw SyntaxError(`ip: prefix length ${a} exceeds maximum ${c} for ${s ? "IPv4" : "IPv6"}`);
2630
- let l = vn(o, a);
2631
- return e === dn ? new Sn(s ? fn : pn, new I([new k(BigInt(a)), new N(l)])) : new xn(a, l, s);
2951
+ let l = Hn(o, a);
2952
+ return e === Fn ? new Kn(s ? In : Ln, new U([new I(BigInt(a)), new B(l)])) : new Gn(a, l, s);
2632
2953
  }
2633
- var wn = {
2634
- appStringPrefixes: [un, dn],
2635
- tagNumbers: [fn, pn],
2954
+ var Jn = {
2955
+ appStringPrefixes: [Pn, Fn],
2956
+ tagNumbers: [In, Ln],
2636
2957
  preserveAppSeqSource: "optional",
2637
2958
  parseAppString(e, t) {
2638
- return Cn(e, t);
2959
+ return qn(e, t);
2639
2960
  },
2640
2961
  parseAppSequence(e, t) {
2641
- return Cn(e, hn(t));
2962
+ return qn(e, zn(t));
2642
2963
  },
2643
2964
  parseTag(e, t) {
2644
- if (!(e !== fn && e !== pn) && (t instanceof N || t instanceof I)) return new Sn(e, t);
2965
+ if ((e === In || e === Ln) && (t instanceof B || t instanceof U)) return new Kn(e, t);
2645
2966
  }
2646
- }, Tn = "cri", En = "CRI", Dn = 99n, On = /* @__PURE__ */ new Map([
2967
+ }, Yn = "cri", Xn = "CRI", Zn = 99n, Qn = /* @__PURE__ */ new Map([
2647
2968
  ["coap", -1n],
2648
2969
  ["coaps", -2n],
2649
2970
  ["http", -3n],
@@ -2654,47 +2975,47 @@ var wn = {
2654
2975
  ["coaps+tcp", -8n],
2655
2976
  ["coap+ws", -25n],
2656
2977
  ["coaps+ws", -26n]
2657
- ]), kn = new Map([...On.entries()].map(([e, t]) => [t, e]));
2658
- function K(e) {
2978
+ ]), $n = new Map([...Qn.entries()].map(([e, t]) => [t, e]));
2979
+ function X(e) {
2659
2980
  try {
2660
2981
  return decodeURIComponent(e);
2661
2982
  } catch {
2662
2983
  return e;
2663
2984
  }
2664
2985
  }
2665
- var An = new TextEncoder(), jn = new TextDecoder("utf-8", { fatal: !0 });
2666
- function Mn(e) {
2667
- return Array.from(An.encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
2986
+ var er = new TextEncoder(), tr = new TextDecoder("utf-8", { fatal: !0 });
2987
+ function nr(e) {
2988
+ return Array.from(er.encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
2668
2989
  }
2669
- function q(e, t) {
2990
+ function rr(e, t) {
2670
2991
  let n = "";
2671
- for (let r of e) n += t(r) ? r : Mn(r);
2992
+ for (let r of e) n += t(r) ? r : nr(r);
2672
2993
  return n;
2673
2994
  }
2674
- function Nn(e) {
2995
+ function ir(e) {
2675
2996
  return /[A-Za-z0-9\-._~]/.test(e);
2676
2997
  }
2677
- function Pn(e) {
2998
+ function ar(e) {
2678
2999
  return /[!$&'()*+,;=]/.test(e);
2679
3000
  }
2680
- function Fn(e) {
2681
- return Nn(e) || Pn(e) || e === ":" || e === "@";
3001
+ function or(e) {
3002
+ return ir(e) || ar(e) || e === ":" || e === "@";
2682
3003
  }
2683
- function In(e) {
2684
- return (Fn(e) || e === "/" || e === "?") && e !== "&";
3004
+ function sr(e) {
3005
+ return (or(e) || e === "/" || e === "?") && e !== "&";
2685
3006
  }
2686
- function Ln(e) {
2687
- return Fn(e) || e === "/" || e === "?";
3007
+ function cr(e) {
3008
+ return or(e) || e === "/" || e === "?";
2688
3009
  }
2689
- function Rn(e) {
2690
- return Nn(e) || Pn(e) || e === ":";
3010
+ function lr(e) {
3011
+ return ir(e) || ar(e) || e === ":";
2691
3012
  }
2692
- function zn(e) {
2693
- return Nn(e) || Pn(e);
3013
+ function ur(e) {
3014
+ return ir(e) || ar(e);
2694
3015
  }
2695
- function Bn(e) {
3016
+ function dr(e) {
2696
3017
  let t = [], n = e, r = n.indexOf("@");
2697
- r >= 0 && (t.push(R.FALSE), t.push(new G(K(n.slice(0, r)))), n = n.slice(r + 1));
3018
+ r >= 0 && (t.push(G.FALSE), t.push(new Y(X(n.slice(0, r)))), n = n.slice(r + 1));
2698
3019
  let i, a = null;
2699
3020
  if (n.startsWith("[")) {
2700
3021
  let e = n.indexOf("]");
@@ -2703,272 +3024,275 @@ function Bn(e) {
2703
3024
  let r = n.slice(e + 1);
2704
3025
  if (r.startsWith(":")) a = r.slice(1);
2705
3026
  else if (r.length > 0) throw SyntaxError("cri: unexpected characters after ']' in authority");
2706
- t.push(new N(sn(i)));
3027
+ t.push(new B(jn(i)));
2707
3028
  } else {
2708
3029
  let e = n.lastIndexOf(":");
2709
- if (e >= 0 ? (i = n.slice(0, e), a = n.slice(e + 1)) : i = n, i !== "") if (/^\d{1,3}(\.\d{1,3}){3}$/.test(i)) t.push(new N(on(i)));
2710
- else for (let e of i.toLowerCase().split(".")) t.push(new G(e));
3030
+ if (e >= 0 ? (i = n.slice(0, e), a = n.slice(e + 1)) : i = n, i !== "") {
3031
+ if (/^\d{1,3}(\.\d{1,3}){3}$/.test(i)) t.push(new B(An(i)));
3032
+ else for (let e of i.toLowerCase().split(".")) t.push(new Y(e));
3033
+ }
2711
3034
  }
2712
3035
  if (a !== null && a !== "") {
2713
3036
  if (!/^\d+$/.test(a)) throw SyntaxError(`cri: invalid port: ${JSON.stringify(a)}`);
2714
3037
  let e = parseInt(a, 10);
2715
3038
  if (e > 65535) throw SyntaxError(`cri: port ${e} out of range`);
2716
- t.push(new k(BigInt(e)));
3039
+ t.push(new I(BigInt(e)));
2717
3040
  }
2718
- return new I(t);
3041
+ return new U(t);
2719
3042
  }
2720
- function Vn(e) {
3043
+ function fr(e) {
2721
3044
  let t = e.items, n = 0, r = "";
2722
- if (n < t.length && t[n] instanceof R && t[n].value === 20) {
3045
+ if (n < t.length && t[n] instanceof G && t[n].value === 20) {
2723
3046
  n++;
2724
3047
  let e = t[n++];
2725
- r += q(e.value, Rn) + "@";
3048
+ r += rr(e.value, lr) + "@";
2726
3049
  }
2727
3050
  if (n >= t.length) return r;
2728
3051
  let i = t[n];
2729
- if (i instanceof N) {
3052
+ if (i instanceof B) {
2730
3053
  n++;
2731
3054
  let { length: e } = i.value;
2732
- if (e === 4) r += cn(i.value);
2733
- else if (e === 16) r += "[" + ln(i.value) + "]";
3055
+ if (e === 4) r += Mn(i.value);
3056
+ else if (e === 16) r += "[" + Nn(i.value) + "]";
2734
3057
  else throw Error(`cri: unexpected host-ip byte length: ${e}`);
2735
- n < t.length && t[n] instanceof G && (r += `%25${q(t[n++].value, zn)}`);
3058
+ n < t.length && t[n] instanceof Y && (r += `%25${rr(t[n++].value, ur)}`);
2736
3059
  } else {
2737
3060
  let e = [];
2738
- for (; n < t.length && t[n] instanceof G;) e.push(q(t[n++].value, zn));
3061
+ for (; n < t.length && t[n] instanceof Y;) e.push(rr(t[n++].value, ur));
2739
3062
  r += e.join(".");
2740
3063
  }
2741
- return n < t.length && t[n] instanceof k && (r += ":" + t[n].value.toString()), r;
3064
+ return n < t.length && t[n] instanceof I && (r += ":" + t[n].value.toString()), r;
2742
3065
  }
2743
- function Hn(e) {
3066
+ function pr(e) {
2744
3067
  let t = e.slice(2), n = t.indexOf("/"), r, i;
2745
- return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new G(K(e)))) : (r = t, i = []), {
2746
- authority: Bn(r),
3068
+ return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new Y(X(e)))) : (r = t, i = []), {
3069
+ authority: dr(r),
2747
3070
  pathSegments: i
2748
3071
  };
2749
3072
  }
2750
- function Un(e) {
3073
+ function mr(e) {
2751
3074
  let t = e, n = null, r = t.indexOf("#");
2752
- r >= 0 && (n = K(t.slice(r + 1)), t = t.slice(0, r));
3075
+ r >= 0 && (n = X(t.slice(r + 1)), t = t.slice(0, r));
2753
3076
  let i = null, a = t.indexOf("?");
2754
3077
  if (a >= 0) {
2755
3078
  let e = t.slice(a + 1);
2756
- t = t.slice(0, a), i = e.split("&").map((e) => new G(K(e)));
3079
+ t = t.slice(0, a), i = e.split("&").map((e) => new Y(X(e)));
2757
3080
  }
2758
3081
  let o = [], s = /^([a-zA-Z][a-zA-Z0-9+.\-]*):([\s\S]*)$/.exec(t);
2759
3082
  if (s) {
2760
- let e = s[1].toLowerCase(), t = s[2], n = On.get(e);
2761
- if (o.push(n === void 0 ? new G(e) : new A(n)), t.startsWith("//")) {
2762
- let { authority: e, pathSegments: n } = Hn(t);
2763
- o.push(e, new I(n));
3083
+ let e = s[1].toLowerCase(), t = s[2], n = Qn.get(e);
3084
+ if (o.push(n === void 0 ? new Y(e) : new L(n)), t.startsWith("//")) {
3085
+ let { authority: e, pathSegments: n } = pr(t);
3086
+ o.push(e, new U(n));
2764
3087
  } else if (t.startsWith("/")) {
2765
- let e = t.slice(1).split("/").map((e) => new G(K(e)));
2766
- o.push(R.NULL, new I(e));
3088
+ let e = t.slice(1).split("/").map((e) => new Y(X(e)));
3089
+ o.push(G.NULL, new U(e));
2767
3090
  } else {
2768
- let e = t.split("/").map((e) => new G(K(e)));
2769
- o.push(R.TRUE, new I(e));
3091
+ let e = t.split("/").map((e) => new Y(X(e)));
3092
+ o.push(G.TRUE, new U(e));
2770
3093
  }
2771
3094
  } else if (t.startsWith("//")) {
2772
- let { authority: e, pathSegments: n } = Hn(t);
2773
- o.push(R.FALSE, e, new I(n));
3095
+ let { authority: e, pathSegments: n } = pr(t);
3096
+ o.push(G.FALSE, e, new U(n));
2774
3097
  } else if (t.startsWith("/")) {
2775
- let e = t.slice(1).split("/").map((e) => new G(K(e)));
2776
- o.push(R.TRUE, new I(e));
2777
- } else if (t === "") o.push(new k(0n));
3098
+ let e = t.slice(1).split("/").map((e) => new Y(X(e)));
3099
+ o.push(G.TRUE, new U(e));
3100
+ } else if (t === "") o.push(new I(0n));
2778
3101
  else {
2779
3102
  let n = 1n, r = t, i = !1;
2780
3103
  for (r.startsWith("./") && (i = !0, r = r.slice(2)); r.startsWith("../");) n++, r = r.slice(3);
2781
3104
  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)}`);
2782
- let a = r === "" ? [] : r.split("/").map((e) => new G(K(e)));
2783
- o.push(new k(n), new I(a));
3105
+ let a = r === "" ? [] : r.split("/").map((e) => new Y(X(e)));
3106
+ o.push(new I(n), new U(a));
2784
3107
  }
2785
- if (i !== null && o.push(new I(i)), n !== null && (i === null && o.push(R.NULL), o.push(new G(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
3108
+ if (i !== null && o.push(new U(i)), n !== null && (i === null && o.push(G.NULL), o.push(new Y(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
2786
3109
  let e = o[o.length - 1];
2787
- e instanceof I && e.items.length === 0 && o.pop();
3110
+ e instanceof U && e.items.length === 0 && o.pop();
2788
3111
  }
2789
- return o.length === 1 && o[0] instanceof k && o[0].value === 0n ? [] : o;
3112
+ return o.length === 1 && o[0] instanceof I && o[0].value === 0n ? [] : o;
2790
3113
  }
2791
- function Wn(e, t) {
3114
+ function hr(e, t) {
2792
3115
  let n = t, r = "";
2793
3116
  if (n < e.length) {
2794
3117
  let t = e[n];
2795
- if (t instanceof I) {
3118
+ if (t instanceof U) {
2796
3119
  if (n++, t.items.length > 0) {
2797
3120
  let e = t.items.map((e) => {
2798
- if (!(e instanceof G)) throw Error("cri: query item must be a text string");
2799
- return q(e.value, In);
3121
+ if (!(e instanceof Y)) throw Error("cri: query item must be a text string");
3122
+ return rr(e.value, sr);
2800
3123
  });
2801
3124
  r += "?" + e.join("&");
2802
3125
  }
2803
- } else t instanceof R && t.value === 22 && n++;
3126
+ } else t instanceof G && t.value === 22 && n++;
2804
3127
  }
2805
- return n < e.length && e[n] instanceof G && (r += "#" + q(e[n].value, Ln)), r;
3128
+ return n < e.length && e[n] instanceof Y && (r += "#" + rr(e[n].value, cr)), r;
2806
3129
  }
2807
- function Gn(e) {
3130
+ function gr(e) {
2808
3131
  return e.items.map((e) => {
2809
- if (!(e instanceof G)) throw Error("cri: path segment must be a text string");
2810
- return q(e.value, Fn);
3132
+ if (!(e instanceof Y)) throw Error("cri: path segment must be a text string");
3133
+ return rr(e.value, or);
2811
3134
  });
2812
3135
  }
2813
- function Kn(e) {
3136
+ function _r(e) {
2814
3137
  if (e.length === 0) return "";
2815
3138
  let t = 0, n = e[t++];
2816
- if (n instanceof A || n instanceof G) {
3139
+ if (n instanceof L || n instanceof Y) {
2817
3140
  let r;
2818
- if (n instanceof A) {
2819
- let e = kn.get(n.value);
3141
+ if (n instanceof L) {
3142
+ let e = $n.get(n.value);
2820
3143
  if (e === void 0) throw Error(`cri: unrecognised scheme-id ${n.value}`);
2821
3144
  r = e + ":";
2822
3145
  } else r = n.value + ":";
2823
3146
  if (t >= e.length) return r;
2824
3147
  let i = e[t++], a = "", o = !1;
2825
- if (i instanceof I) a = "//" + Vn(i), o = !0;
2826
- else if (i instanceof R) if (i.value === 22) o = !0;
2827
- else if (i.value === 21) o = !1;
2828
- else throw Error(`cri: unexpected no-authority value: simple(${i.value})`);
2829
- else throw Error("cri: unexpected type for authority element");
3148
+ if (i instanceof U) a = "//" + fr(i), o = !0;
3149
+ else if (i instanceof G) {
3150
+ if (i.value === 22) o = !0;
3151
+ else if (i.value === 21) o = !1;
3152
+ else throw Error(`cri: unexpected no-authority value: simple(${i.value})`);
3153
+ } else throw Error("cri: unexpected type for authority element");
2830
3154
  let s = "";
2831
- if (t < e.length && e[t] instanceof I) {
3155
+ if (t < e.length && e[t] instanceof U) {
2832
3156
  let n = e[t++];
2833
- n.items.length > 0 && (s = (o ? "/" : "") + Gn(n).join("/"));
3157
+ n.items.length > 0 && (s = (o ? "/" : "") + gr(n).join("/"));
2834
3158
  }
2835
- return r + a + s + Wn(e, t);
3159
+ return r + a + s + hr(e, t);
2836
3160
  }
2837
- if (n instanceof R && n.value === 20) {
2838
- if (t >= e.length || !(e[t] instanceof I)) throw Error("cri: network-path reference requires an authority array");
2839
- let n = Vn(e[t++]), r = "";
2840
- if (t < e.length && e[t] instanceof I) {
3161
+ if (n instanceof G && n.value === 20) {
3162
+ if (t >= e.length || !(e[t] instanceof U)) throw Error("cri: network-path reference requires an authority array");
3163
+ let n = fr(e[t++]), r = "";
3164
+ if (t < e.length && e[t] instanceof U) {
2841
3165
  let n = e[t++];
2842
- n.items.length > 0 && (r = "/" + Gn(n).join("/"));
3166
+ n.items.length > 0 && (r = "/" + gr(n).join("/"));
2843
3167
  }
2844
- return "//" + n + r + Wn(e, t);
3168
+ return "//" + n + r + hr(e, t);
2845
3169
  }
2846
- if (n instanceof R && n.value === 21) {
3170
+ if (n instanceof G && n.value === 21) {
2847
3171
  let n = "/";
2848
- if (t < e.length && e[t] instanceof I) {
3172
+ if (t < e.length && e[t] instanceof U) {
2849
3173
  let r = e[t++];
2850
- n = "/" + Gn(r).join("/");
3174
+ n = "/" + gr(r).join("/");
2851
3175
  }
2852
- return n + Wn(e, t);
3176
+ return n + hr(e, t);
2853
3177
  }
2854
- if (n instanceof k) {
3178
+ if (n instanceof I) {
2855
3179
  let r = n.value;
2856
- if (r === 0n) return Wn(e, t);
3180
+ if (r === 0n) return hr(e, t);
2857
3181
  let i = r === 1n ? "" : "../".repeat(Number(r) - 1), a;
2858
- if (t < e.length && e[t] instanceof I) {
3182
+ if (t < e.length && e[t] instanceof U) {
2859
3183
  let n = e[t++];
2860
3184
  if (n.items.length > 0) {
2861
- let e = Gn(n);
3185
+ let e = gr(n);
2862
3186
  a = (r === 1n && e[0].includes(":") ? "./" : i) + e.join("/");
2863
3187
  } else a = i === "" ? "./" : i;
2864
3188
  } else a = i === "" ? "./" : i;
2865
- return a + Wn(e, t);
3189
+ return a + hr(e, t);
2866
3190
  }
2867
3191
  throw Error("cri: unrecognised first element type in CRI array");
2868
3192
  }
2869
- var qn = class extends I {
2870
- _toCDN(e, t) {
2871
- if (e?.appStrings === !1) return super._toCDN(e, t);
2872
- let n = a(e, this.encodingWidth, () => p(BigInt(this.items.length)));
2873
- if (_(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted") return m(this.appSeqSource, n, e, this.appSeqInnerEnd, this.appSeqComments);
3193
+ var vr = class extends U {
3194
+ _toCDN(e, n, r) {
3195
+ if (e?.appPrefix === !1) return super._toCDN(e, n, r);
3196
+ let i = t(e, this.encodingWidth, () => E(BigInt(this.items.length)));
3197
+ if (T(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted") return D(this.appSeqSource, i, e, this.appSeqInnerEnd, this.appSeqComments);
2874
3198
  try {
2875
- return `${Tn}'${Kn(this.items)}'${n}`;
3199
+ return `${Yn}'${_r(this.items)}'${i}`;
2876
3200
  } catch {
2877
- return super._toCDN(e, t);
3201
+ return super._toCDN(e, n, r);
2878
3202
  }
2879
3203
  }
2880
- }, Jn = class extends M {
3204
+ }, yr = class extends z {
2881
3205
  constructor(e) {
2882
- super(Dn, e);
2883
- }
2884
- _toCDN(e, t) {
2885
- if (e?.appStrings === !1) return super._toCDN(e, t);
2886
- let n = _(e, this.appSeqSource, this.ednSource, this.appSeqSourceFeatures, this.appSeqEncodingEditsComplete);
2887
- if (n === "verbatim") return this.appSeqSource;
2888
- if (n === "source") return g(this.appSeqSource, e, this.appSeqComments, this.appSeqEncodingEdits);
2889
- if (n === "structural") return super._toCDN({
3206
+ super(Zn, e);
3207
+ }
3208
+ _toCDN(e, n, r) {
3209
+ if (e?.appPrefix === !1) return super._toCDN(e, n, r);
3210
+ let i = T(e, this.appSeqSource, this.ednSource, this.appSeqSourceFeatures, this.appSeqEncodingEditsComplete);
3211
+ if (i === "verbatim") return this.appSeqSource;
3212
+ if (i === "source") return w(this.appSeqSource, e, this.appSeqComments, this.appSeqEncodingEdits);
3213
+ if (i === "structural") return super._toCDN({
2890
3214
  ...e,
2891
- appStrings: !1
2892
- }, t);
3215
+ appPrefix: !1
3216
+ }, n, r);
2893
3217
  try {
2894
- let r = this.content;
2895
- if (r.encodingWidth !== void 0) return super._toCDN(e, t);
2896
- let i = a(e, this.encodingWidth, () => p(Dn));
2897
- return n === "adjusted" ? m(this.appSeqSource, i, e, this.appSeqInnerEnd, this.appSeqComments) : `${En}'${Kn(r.items)}'${i}`;
3218
+ let a = this.content;
3219
+ if (a.encodingWidth !== void 0) return super._toCDN(e, n, r);
3220
+ let o = t(e, this.encodingWidth, () => E(Zn));
3221
+ return i === "adjusted" ? D(this.appSeqSource, o, e, this.appSeqInnerEnd, this.appSeqComments) : `${Xn}'${_r(a.items)}'${o}`;
2898
3222
  } catch {
2899
- return super._toCDN(e, t);
3223
+ return super._toCDN(e, n, r);
2900
3224
  }
2901
3225
  }
2902
3226
  };
2903
- function Yn(e) {
3227
+ function br(e) {
2904
3228
  if (e.length !== 1) throw SyntaxError("cri<<...>>: expected exactly one item");
2905
3229
  let t = e[0];
2906
- if (t instanceof G) return t.value;
2907
- if (t instanceof N) return jn.decode(t.value);
3230
+ if (t instanceof Y) return t.value;
3231
+ if (t instanceof B) return tr.decode(t.value);
2908
3232
  throw SyntaxError("cri<<...>>: expected a text string or byte string");
2909
3233
  }
2910
- function Xn(e, t) {
2911
- let n = new qn(Un(t));
2912
- return e === En ? new Jn(n) : n;
3234
+ function xr(e, t) {
3235
+ let n = new vr(mr(t));
3236
+ return e === Xn ? new yr(n) : n;
2913
3237
  }
2914
- var Zn = {
2915
- appStringPrefixes: [Tn, En],
2916
- tagNumbers: [Dn],
3238
+ var Sr = {
3239
+ appStringPrefixes: [Yn, Xn],
3240
+ tagNumbers: [Zn],
2917
3241
  preserveAppSeqSource: "optional",
2918
3242
  parseAppString(e, t) {
2919
- return Xn(e, t);
3243
+ return xr(e, t);
2920
3244
  },
2921
3245
  parseAppSequence(e, t) {
2922
- return Xn(e, Yn(t));
3246
+ return xr(e, br(t));
2923
3247
  },
2924
3248
  parseTag(e, t) {
2925
- if (e !== 99n || !(t instanceof I)) return;
2926
- let n = new qn(t.items, {
3249
+ if (e !== 99n || !(t instanceof U)) return;
3250
+ let n = new vr(t.items, {
2927
3251
  indefiniteLength: t.indefiniteLength,
2928
3252
  encodingWidth: t.encodingWidth
2929
3253
  });
2930
- return n.start = t.start, n.end = t.end, new Jn(n);
3254
+ return n.start = t.start, n.end = t.end, new yr(n);
2931
3255
  }
2932
- }, Qn = 18446744073709551615n, $n = -18446744073709551616n, er = {
2933
- tagNumbers: [Qe, $e],
3256
+ }, Cr = 18446744073709551615n, wr = -18446744073709551616n, Tr = {
3257
+ tagNumbers: [_t, vt],
2934
3258
  parseTag(e, t) {
2935
- if (t instanceof N) {
3259
+ if (t instanceof B) {
2936
3260
  if (e === 2n) {
2937
- let e = rt(t.value);
2938
- return e > Qn ? new it(e) : void 0;
3261
+ let e = St(t.value);
3262
+ return e > Cr ? new Ct(e) : void 0;
2939
3263
  }
2940
3264
  if (e === 3n) {
2941
- let e = -1n - rt(t.value);
2942
- return e < $n ? new at(e) : void 0;
3265
+ let e = -1n - St(t.value);
3266
+ return e < wr ? new wt(e) : void 0;
2943
3267
  }
2944
3268
  }
2945
3269
  }
2946
3270
  };
2947
3271
  //#endregion
2948
3272
  //#region src/cbor/decoder.ts
2949
- function tr(e, t) {
3273
+ function Er(e, t) {
2950
3274
  if (e === 24 && t <= 23n) return 0;
2951
3275
  if (e === 25 && t <= 255n) return 1;
2952
3276
  if (e === 26 && t <= 65535n) return 2;
2953
3277
  if (e === 27 && t <= 4294967295n) return 3;
2954
3278
  }
2955
- function nr(e, t) {
3279
+ function Dr(e, t) {
2956
3280
  if (e === 24 && t <= 23) return 0;
2957
3281
  if (e === 25 && t <= 255) return 1;
2958
3282
  if (e === 26 && t <= 65535) return 2;
2959
3283
  if (e === 27 && t <= 4294967295) return 3;
2960
3284
  }
2961
- var rr = new TextDecoder("utf-8", {
3285
+ var Or = new TextDecoder("utf-8", {
2962
3286
  fatal: !0,
2963
3287
  ignoreBOM: !0
2964
- }), ir = new TextDecoder("utf-8", {
3288
+ }), kr = new TextDecoder("utf-8", {
2965
3289
  fatal: !1,
2966
3290
  ignoreBOM: !0
2967
3291
  });
2968
- function J(e) {
3292
+ function Z(e) {
2969
3293
  throw Error(`CBOR decode error: ${e}`);
2970
3294
  }
2971
- function ar(e, t, n) {
3295
+ function Ar(e, t, n) {
2972
3296
  let r = {
2973
3297
  message: e,
2974
3298
  offset: t
@@ -2976,191 +3300,191 @@ function ar(e, t, n) {
2976
3300
  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}`);
2977
3301
  return r;
2978
3302
  }
2979
- function or(e, t) {
3303
+ function jr(e, t) {
2980
3304
  e.warnings ??= [], e.warnings.push(t);
2981
3305
  }
2982
- function Y(e) {
2983
- if (e instanceof k) return ["u", String(e.value)];
2984
- if (e instanceof A) return ["n", String(e.value)];
2985
- if (e instanceof G) return ["t", e.value];
2986
- if (e instanceof F) return ["t", e.chunks.map((e) => e.value).join("")];
2987
- if (e instanceof N) return ["b", y(e.value)];
2988
- if (e instanceof P) {
3306
+ function Mr(e) {
3307
+ if (e instanceof I) return ["u", String(e.value)];
3308
+ if (e instanceof L) return ["n", String(e.value)];
3309
+ if (e instanceof Y) return ["t", e.value];
3310
+ if (e instanceof H) return ["t", e.chunks.map((e) => e.value).join("")];
3311
+ if (e instanceof B) return ["b", s(e.value)];
3312
+ if (e instanceof V) {
2989
3313
  let t = "";
2990
- for (let n of e.chunks) t += y(n.value);
3314
+ for (let n of e.chunks) t += s(n.value);
2991
3315
  return ["b", t];
2992
3316
  }
2993
- if (e instanceof j) return isNaN(e.value) ? ["f", "NaN"] : Object.is(e.value, -0) ? ["f", "-0"] : ["f", String(e.value)];
2994
- if (e instanceof R) return ["s", e.value];
2995
- if (e instanceof I) return ["A", e.items.map(Y)];
2996
- if (e instanceof L) {
2997
- let t = e.entries.map(([e, t]) => [Y(e), Y(t)]);
3317
+ if (e instanceof R) return isNaN(e.value) ? ["f", "NaN"] : Object.is(e.value, -0) ? ["f", "-0"] : ["f", String(e.value)];
3318
+ if (e instanceof G) return ["s", e.value];
3319
+ if (e instanceof U) return ["A", e.items.map(Mr)];
3320
+ if (e instanceof W) {
3321
+ let t = e.entries.map(([e, t]) => [Mr(e), Mr(t)]);
2998
3322
  if (t.length <= 1) return ["M", t];
2999
3323
  let n = t.map((e) => [JSON.stringify(e[0]), e]);
3000
3324
  return n.sort((e, t) => e[0] < t[0] ? -1 : +(e[0] > t[0])), ["M", n.map((e) => e[1])];
3001
3325
  }
3002
- return e instanceof M ? [
3326
+ return e instanceof z ? [
3003
3327
  "G",
3004
3328
  String(e.tag),
3005
- Y(e.content)
3006
- ] : ["c", y(e.toCBOR())];
3329
+ Mr(e.content)
3330
+ ] : ["c", s(e.toCBOR())];
3007
3331
  }
3008
- function sr(e) {
3009
- if (e instanceof k) return "u" + e.value;
3010
- if (e instanceof A) return "n" + e.value;
3011
- if (e instanceof G) return "t" + e.value;
3012
- if (e instanceof F) {
3332
+ function Nr(e) {
3333
+ if (e instanceof I) return "u" + e.value;
3334
+ if (e instanceof L) return "n" + e.value;
3335
+ if (e instanceof Y) return "t" + e.value;
3336
+ if (e instanceof H) {
3013
3337
  let t = "t";
3014
3338
  for (let n of e.chunks) t += n.value;
3015
3339
  return t;
3016
3340
  }
3017
- if (e instanceof N) return "b" + y(e.value);
3018
- if (e instanceof P) {
3341
+ if (e instanceof B) return "b" + s(e.value);
3342
+ if (e instanceof V) {
3019
3343
  let t = "b";
3020
- for (let n of e.chunks) t += y(n.value);
3344
+ for (let n of e.chunks) t += s(n.value);
3021
3345
  return t;
3022
3346
  }
3023
- return e instanceof j ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof R ? "s" + e.value : JSON.stringify(Y(e));
3347
+ return e instanceof R ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof G ? "s" + e.value : JSON.stringify(Mr(e));
3024
3348
  }
3025
- var cr = Array.from({ length: 24 }, (e, t) => BigInt(t)), lr;
3026
- function ur(e) {
3027
- return e === void 0 ? lr ??= Z(void 0).filter((e) => e.parseTag !== void 0) : Z(e).filter((e) => e.parseTag !== void 0);
3349
+ var Pr = Array.from({ length: 24 }, (e, t) => BigInt(t)), Fr;
3350
+ function Ir(e) {
3351
+ return e === void 0 ? Fr ??= Oi(void 0).filter((e) => e.parseTag !== void 0) : Oi(e).filter((e) => e.parseTag !== void 0);
3028
3352
  }
3029
- function dr(e, t) {
3353
+ function Lr(e, t) {
3030
3354
  for (let n = 0; n < t; n++) if (e[n] >= 128) return;
3031
3355
  return String.fromCharCode.apply(null, e);
3032
3356
  }
3033
- function fr(e, t, n) {
3357
+ function Rr(e, t, n) {
3034
3358
  if (n <= 23) return {
3035
- value: cr[n],
3359
+ value: Pr[n],
3036
3360
  nextOffset: t
3037
3361
  };
3038
3362
  switch (n) {
3039
- case 24: return t + 1 > e.byteLength && J("unexpected end of input"), {
3363
+ case 24: return t + 1 > e.byteLength && Z("unexpected end of input"), {
3040
3364
  value: BigInt(e.getUint8(t)),
3041
3365
  nextOffset: t + 1
3042
3366
  };
3043
- case 25: return t + 2 > e.byteLength && J("unexpected end of input"), {
3367
+ case 25: return t + 2 > e.byteLength && Z("unexpected end of input"), {
3044
3368
  value: BigInt(e.getUint16(t, !1)),
3045
3369
  nextOffset: t + 2
3046
3370
  };
3047
- case 26: return t + 4 > e.byteLength && J("unexpected end of input"), {
3371
+ case 26: return t + 4 > e.byteLength && Z("unexpected end of input"), {
3048
3372
  value: BigInt(e.getUint32(t, !1)),
3049
3373
  nextOffset: t + 4
3050
3374
  };
3051
- case 27: return t + 8 > e.byteLength && J("unexpected end of input"), {
3375
+ case 27: return t + 8 > e.byteLength && Z("unexpected end of input"), {
3052
3376
  value: e.getBigUint64(t, !1),
3053
3377
  nextOffset: t + 8
3054
3378
  };
3055
- default: J(`reserved additional info value: ${n}`);
3379
+ default: Z(`reserved additional info value: ${n}`);
3056
3380
  }
3057
3381
  }
3058
- function pr(e, t, n) {
3382
+ function zr(e, t, n) {
3059
3383
  if (n <= 23) return {
3060
3384
  value: n,
3061
3385
  nextOffset: t
3062
3386
  };
3063
3387
  switch (n) {
3064
- case 24: return t + 1 > e.byteLength && J("unexpected end of input"), {
3388
+ case 24: return t + 1 > e.byteLength && Z("unexpected end of input"), {
3065
3389
  value: e.getUint8(t),
3066
3390
  nextOffset: t + 1
3067
3391
  };
3068
- case 25: return t + 2 > e.byteLength && J("unexpected end of input"), {
3392
+ case 25: return t + 2 > e.byteLength && Z("unexpected end of input"), {
3069
3393
  value: e.getUint16(t, !1),
3070
3394
  nextOffset: t + 2
3071
3395
  };
3072
- case 26: return t + 4 > e.byteLength && J("unexpected end of input"), {
3396
+ case 26: return t + 4 > e.byteLength && Z("unexpected end of input"), {
3073
3397
  value: e.getUint32(t, !1),
3074
3398
  nextOffset: t + 4
3075
3399
  };
3076
3400
  case 27: {
3077
- t + 8 > e.byteLength && J("unexpected end of input");
3401
+ t + 8 > e.byteLength && Z("unexpected end of input");
3078
3402
  let n = e.getUint32(t, !1), r = e.getUint32(t + 4, !1);
3079
3403
  return {
3080
3404
  value: n * 4294967296 + r,
3081
3405
  nextOffset: t + 8
3082
3406
  };
3083
3407
  }
3084
- default: J(`reserved additional info value: ${n}`);
3408
+ default: Z(`reserved additional info value: ${n}`);
3085
3409
  }
3086
3410
  }
3087
- function mr(e, t, n, r, i, a) {
3411
+ function Br(e, t, n, r, i, a) {
3088
3412
  let o = [], s = t;
3089
3413
  for (;;) {
3090
- if (s >= e.byteLength && J(`unexpected end of indefinite ${i}`), e.getUint8(s) === 255) {
3414
+ if (s >= e.byteLength && Z(`unexpected end of indefinite ${i}`), e.getUint8(s) === 255) {
3091
3415
  s++;
3092
3416
  break;
3093
3417
  }
3094
- let t = X(e, s, n, r);
3095
- a(t.value) || J(`indefinite-length ${i} chunk must be a definite ${i}`), o.push(t.value), s = t.nextOffset;
3418
+ let t = Q(e, s, n, r);
3419
+ a(t.value) || Z(`indefinite-length ${i} chunk must be a definite ${i}`), o.push(t.value), s = t.nextOffset;
3096
3420
  }
3097
3421
  return {
3098
3422
  chunks: o,
3099
3423
  nextOffset: s
3100
3424
  };
3101
3425
  }
3102
- function hr(e, t, n, r) {
3103
- let i = sr(e);
3104
- t.has(i) && n.push(ar(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
3426
+ function Vr(e, t, n, r) {
3427
+ let i = Nr(e);
3428
+ t.has(i) && n.push(Ar(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
3105
3429
  }
3106
- function X(e, t, n, r) {
3107
- let i = t, a = _r(e, t, n, r);
3430
+ function Q(e, t, n, r) {
3431
+ let i = t, a = Ur(e, t, n, r);
3108
3432
  return a.value.start = i, a.value.end = a.nextOffset, a;
3109
3433
  }
3110
- function gr(e, t, n) {
3434
+ function Hr(e, t, n) {
3111
3435
  return new Uint8Array(e.buffer, e.byteOffset + t, n).slice();
3112
3436
  }
3113
- function _r(e, t, n, r) {
3114
- t >= e.byteLength && J("unexpected end of input");
3437
+ function Ur(e, t, n, r) {
3438
+ t >= e.byteLength && Z("unexpected end of input");
3115
3439
  let i = e.getUint8(t++), a = i >> 5, o = i & 31;
3116
3440
  switch (a) {
3117
3441
  case 0: {
3118
- let { value: n, nextOffset: r } = fr(e, t, o);
3442
+ let { value: n, nextOffset: r } = Rr(e, t, o);
3119
3443
  return {
3120
- value: new k(n, { encodingWidth: tr(o, n) }),
3444
+ value: new I(n, { encodingWidth: Er(o, n) }),
3121
3445
  nextOffset: r
3122
3446
  };
3123
3447
  }
3124
3448
  case 1: {
3125
- let { value: n, nextOffset: r } = fr(e, t, o), i = tr(o, n);
3449
+ let { value: n, nextOffset: r } = Rr(e, t, o), i = Er(o, n);
3126
3450
  return {
3127
- value: new A(-1n - n, { encodingWidth: i }),
3451
+ value: new L(-1n - n, { encodingWidth: i }),
3128
3452
  nextOffset: r
3129
3453
  };
3130
3454
  }
3131
3455
  case 2: {
3132
3456
  if (o === 31) {
3133
- let { chunks: i, nextOffset: a } = mr(e, t, n, r, "byte string", (e) => e instanceof N);
3457
+ let { chunks: i, nextOffset: a } = Br(e, t, n, r, "byte string", (e) => e instanceof B);
3134
3458
  return {
3135
- value: new P(i),
3459
+ value: new V(i),
3136
3460
  nextOffset: a
3137
3461
  };
3138
3462
  }
3139
- let { value: i, nextOffset: a } = pr(e, t, o), s = nr(o, i);
3140
- return a + i > e.byteLength && J("byte string extends beyond input"), {
3141
- value: new N(new Uint8Array(e.buffer, e.byteOffset + a, i).slice(), { encodingWidth: s }),
3463
+ let { value: i, nextOffset: a } = zr(e, t, o), s = Dr(o, i);
3464
+ return a + i > e.byteLength && Z("byte string extends beyond input"), {
3465
+ value: new B(new Uint8Array(e.buffer, e.byteOffset + a, i).slice(), { encodingWidth: s }),
3142
3466
  nextOffset: a + i
3143
3467
  };
3144
3468
  }
3145
3469
  case 3: {
3146
3470
  if (o === 31) {
3147
- let { chunks: i, nextOffset: a } = mr(e, t, n, r, "text string", (e) => e instanceof G);
3471
+ let { chunks: i, nextOffset: a } = Br(e, t, n, r, "text string", (e) => e instanceof Y);
3148
3472
  return {
3149
- value: new F(i),
3473
+ value: new H(i),
3150
3474
  nextOffset: a
3151
3475
  };
3152
3476
  }
3153
- let { value: i, nextOffset: a } = pr(e, t, o), s = nr(o, i);
3154
- a + i > e.byteLength && J("text string extends beyond input");
3155
- let c = new Uint8Array(e.buffer, e.byteOffset + a, i), l, u, d = i < 64 ? dr(c, i) : void 0;
3477
+ let { value: i, nextOffset: a } = zr(e, t, o), s = Dr(o, i);
3478
+ a + i > e.byteLength && Z("text string extends beyond input");
3479
+ let c = new Uint8Array(e.buffer, e.byteOffset + a, i), l, u, d = i < 64 ? Lr(c, i) : void 0;
3156
3480
  if (d !== void 0) l = d;
3157
3481
  else try {
3158
- l = rr.decode(c);
3482
+ l = Or.decode(c);
3159
3483
  } catch {
3160
- u = ar("invalid UTF-8 sequence in text string", a, n), l = ir.decode(c);
3484
+ u = Ar("invalid UTF-8 sequence in text string", a, n), l = kr.decode(c);
3161
3485
  }
3162
- let f = new G(l, { encodingWidth: s });
3163
- return u && or(f, u), {
3486
+ let f = new Y(l, { encodingWidth: s });
3487
+ return u && jr(f, u), {
3164
3488
  value: f,
3165
3489
  nextOffset: a + i
3166
3490
  };
@@ -3169,25 +3493,25 @@ function _r(e, t, n, r) {
3169
3493
  if (o === 31) {
3170
3494
  let i = [], a = t;
3171
3495
  for (;;) {
3172
- if (a >= e.byteLength && J("unexpected end of indefinite array"), e.getUint8(a) === 255) {
3496
+ if (a >= e.byteLength && Z("unexpected end of indefinite array"), e.getUint8(a) === 255) {
3173
3497
  a++;
3174
3498
  break;
3175
3499
  }
3176
- let t = X(e, a, n, r);
3500
+ let t = Q(e, a, n, r);
3177
3501
  i.push(t.value), a = t.nextOffset;
3178
3502
  }
3179
3503
  return {
3180
- value: new I(i, { indefiniteLength: !0 }),
3504
+ value: new U(i, { indefiniteLength: !0 }),
3181
3505
  nextOffset: a
3182
3506
  };
3183
3507
  }
3184
- let { value: i, nextOffset: a } = pr(e, t, o), s = nr(o, i), c = [], l = a;
3508
+ let { value: i, nextOffset: a } = zr(e, t, o), s = Dr(o, i), c = [], l = a;
3185
3509
  for (let t = 0; t < i; t++) {
3186
- let t = X(e, l, n, r);
3510
+ let t = Q(e, l, n, r);
3187
3511
  c.push(t.value), l = t.nextOffset;
3188
3512
  }
3189
3513
  return {
3190
- value: new I(c, { encodingWidth: s }),
3514
+ value: new U(c, { encodingWidth: s }),
3191
3515
  nextOffset: l
3192
3516
  };
3193
3517
  }
@@ -3195,149 +3519,149 @@ function _r(e, t, n, r) {
3195
3519
  if (o === 31) {
3196
3520
  let i = [], a = /* @__PURE__ */ new Set(), o = [], s = t;
3197
3521
  for (;;) {
3198
- if (s >= e.byteLength && J("unexpected end of indefinite map"), e.getUint8(s) === 255) {
3522
+ if (s >= e.byteLength && Z("unexpected end of indefinite map"), e.getUint8(s) === 255) {
3199
3523
  s++;
3200
3524
  break;
3201
3525
  }
3202
- let t = X(e, s, n, r);
3203
- hr(t.value, a, o, n), s = t.nextOffset;
3204
- let c = X(e, s, n, r);
3526
+ let t = Q(e, s, n, r);
3527
+ Vr(t.value, a, o, n), s = t.nextOffset;
3528
+ let c = Q(e, s, n, r);
3205
3529
  s = c.nextOffset, i.push([t.value, c.value]);
3206
3530
  }
3207
- let c = new L(i, { indefiniteLength: !0 });
3208
- for (let e of o) or(c, e);
3531
+ let c = new W(i, { indefiniteLength: !0 });
3532
+ for (let e of o) jr(c, e);
3209
3533
  return {
3210
3534
  value: c,
3211
3535
  nextOffset: s
3212
3536
  };
3213
3537
  }
3214
- let { value: i, nextOffset: a } = pr(e, t, o), s = nr(o, i), c = [], l = /* @__PURE__ */ new Set(), u = [], d = a;
3538
+ let { value: i, nextOffset: a } = zr(e, t, o), s = Dr(o, i), c = [], l = /* @__PURE__ */ new Set(), u = [], d = a;
3215
3539
  for (let t = 0; t < i; t++) {
3216
- let t = X(e, d, n, r);
3217
- hr(t.value, l, u, n), d = t.nextOffset;
3218
- let i = X(e, d, n, r);
3540
+ let t = Q(e, d, n, r);
3541
+ Vr(t.value, l, u, n), d = t.nextOffset;
3542
+ let i = Q(e, d, n, r);
3219
3543
  d = i.nextOffset, c.push([t.value, i.value]);
3220
3544
  }
3221
- let f = new L(c, { encodingWidth: s });
3222
- for (let e of u) or(f, e);
3545
+ let f = new W(c, { encodingWidth: s });
3546
+ for (let e of u) jr(f, e);
3223
3547
  return {
3224
3548
  value: f,
3225
3549
  nextOffset: d
3226
3550
  };
3227
3551
  }
3228
3552
  case 6: {
3229
- o === 31 && J("tags cannot use indefinite-length encoding");
3230
- let { value: i, nextOffset: a } = fr(e, t, o), s = tr(o, i), c = X(e, a, n, r);
3553
+ o === 31 && Z("tags cannot use indefinite-length encoding");
3554
+ let { value: i, nextOffset: a } = Rr(e, t, o), s = Er(o, i), c = Q(e, a, n, r);
3231
3555
  for (let e of r) {
3232
3556
  let t = e.parseTag(i, c.value, n);
3233
- if (t !== void 0) return t instanceof M && s !== void 0 && (t.encodingWidth = s), {
3557
+ if (t !== void 0) return t instanceof z && s !== void 0 && (t.encodingWidth = s), {
3234
3558
  value: t,
3235
3559
  nextOffset: c.nextOffset
3236
3560
  };
3237
3561
  }
3238
3562
  return {
3239
- value: new M(i, c.value, { encodingWidth: s }),
3563
+ value: new z(i, c.value, { encodingWidth: s }),
3240
3564
  nextOffset: c.nextOffset
3241
3565
  };
3242
3566
  }
3243
3567
  case 7:
3244
3568
  if (o <= 19) return {
3245
- value: new R(o),
3569
+ value: new G(o),
3246
3570
  nextOffset: t
3247
3571
  };
3248
3572
  if (o === 20) return {
3249
- value: new R(20),
3573
+ value: new G(20),
3250
3574
  nextOffset: t
3251
3575
  };
3252
3576
  if (o === 21) return {
3253
- value: new R(21),
3577
+ value: new G(21),
3254
3578
  nextOffset: t
3255
3579
  };
3256
3580
  if (o === 22) return {
3257
- value: new R(22),
3581
+ value: new G(22),
3258
3582
  nextOffset: t
3259
3583
  };
3260
3584
  if (o === 23) return {
3261
- value: new R(23),
3585
+ value: new G(23),
3262
3586
  nextOffset: t
3263
3587
  };
3264
3588
  if (o === 24) {
3265
- t + 1 > e.byteLength && J("unexpected end of input");
3589
+ t + 1 > e.byteLength && Z("unexpected end of input");
3266
3590
  let r = e.getUint8(t);
3267
3591
  if (r < 32) {
3268
- let e = ar(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`, t - 1, n), i = new R(r);
3269
- return or(i, e), {
3592
+ let e = Ar(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`, t - 1, n), i = new G(r);
3593
+ return jr(i, e), {
3270
3594
  value: i,
3271
3595
  nextOffset: t + 1
3272
3596
  };
3273
3597
  }
3274
3598
  return {
3275
- value: new R(r),
3599
+ value: new G(r),
3276
3600
  nextOffset: t + 1
3277
3601
  };
3278
3602
  }
3279
3603
  if (o === 25) {
3280
- t + 2 > e.byteLength && J("unexpected end of input");
3281
- let n = C(e.getUint16(t, !1));
3604
+ t + 2 > e.byteLength && Z("unexpected end of input");
3605
+ let n = j(e.getUint16(t, !1));
3282
3606
  return {
3283
- value: new j(n, {
3607
+ value: new R(n, {
3284
3608
  precision: "half",
3285
- rawBits: Number.isNaN(n) ? gr(e, t, 2) : void 0
3609
+ rawBits: Number.isNaN(n) ? Hr(e, t, 2) : void 0
3286
3610
  }),
3287
3611
  nextOffset: t + 2
3288
3612
  };
3289
3613
  }
3290
3614
  if (o === 26) {
3291
- t + 4 > e.byteLength && J("unexpected end of input");
3615
+ t + 4 > e.byteLength && Z("unexpected end of input");
3292
3616
  let n = e.getFloat32(t, !1);
3293
3617
  return {
3294
- value: new j(n, {
3618
+ value: new R(n, {
3295
3619
  precision: "single",
3296
- rawBits: Number.isNaN(n) ? gr(e, t, 4) : void 0
3620
+ rawBits: Number.isNaN(n) ? Hr(e, t, 4) : void 0
3297
3621
  }),
3298
3622
  nextOffset: t + 4
3299
3623
  };
3300
3624
  }
3301
3625
  if (o === 27) {
3302
- t + 8 > e.byteLength && J("unexpected end of input");
3626
+ t + 8 > e.byteLength && Z("unexpected end of input");
3303
3627
  let n = e.getFloat64(t, !1);
3304
3628
  return {
3305
- value: new j(n, {
3629
+ value: new R(n, {
3306
3630
  precision: "double",
3307
- rawBits: Number.isNaN(n) ? gr(e, t, 8) : void 0
3631
+ rawBits: Number.isNaN(n) ? Hr(e, t, 8) : void 0
3308
3632
  }),
3309
3633
  nextOffset: t + 8
3310
3634
  };
3311
3635
  }
3312
- return o < 31 && J(`reserved additional info value in major type 7: ${o}`), J("unexpected break code outside indefinite-length item");
3636
+ return o < 31 && Z(`reserved additional info value in major type 7: ${o}`), Z("unexpected break code outside indefinite-length item");
3313
3637
  }
3314
- return J(`unknown major type: ${a}`);
3638
+ return Z(`unknown major type: ${a}`);
3315
3639
  }
3316
- function vr(e) {
3640
+ function Wr(e) {
3317
3641
  if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new Uint8Array(e);
3318
3642
  if (ArrayBuffer.isView(e)) return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
3319
3643
  throw TypeError("expected ArrayBufferView or ArrayBufferLike");
3320
3644
  }
3321
- function yr(e, t) {
3322
- let n = vr(e), r = new DataView(n.buffer, n.byteOffset, n.byteLength), i = t?.offset ?? 0;
3645
+ function Gr(e, t) {
3646
+ let n = Wr(e), r = new DataView(n.buffer, n.byteOffset, n.byteLength), i = t?.offset ?? 0;
3323
3647
  if (!Number.isInteger(i) || i < 0 || i > r.byteLength) throw RangeError(`CBOR decode offset must be an integer between 0 and ${r.byteLength}`);
3324
- let a = ur(t?.builtinExtensions), o = t?.extensions?.length ? [...t.extensions.filter((e) => e.parseTag !== void 0), ...a] : a, { value: s, nextOffset: c } = X(r, i, t, o);
3648
+ let a = Ir(t?.builtinExtensions), o = t?.extensions?.length ? [...t.extensions.filter((e) => e.parseTag !== void 0), ...a] : a, { value: s, nextOffset: c } = Q(r, i, t, o);
3325
3649
  if (!t?.allowTrailing && c !== r.byteLength) {
3326
- or(s, ar(`${r.byteLength - c} trailing byte(s) after end of CBOR item`, c, t));
3650
+ jr(s, Ar(`${r.byteLength - c} trailing byte(s) after end of CBOR item`, c, t));
3327
3651
  let e = {
3328
3652
  strict: !1,
3329
3653
  silent: !0
3330
3654
  }, n = c;
3331
- for (; n < r.byteLength;) ({nextOffset: n} = X(r, n, e, o));
3655
+ for (; n < r.byteLength;) ({nextOffset: n} = Q(r, n, e, o));
3332
3656
  }
3333
3657
  return s;
3334
3658
  }
3335
3659
  //#endregion
3336
3660
  //#region src/extensions/cbordata.ts
3337
- var br = 24n, xr = {
3338
- tagNumbers: [br],
3661
+ var Kr = 24n, qr = {
3662
+ tagNumbers: [Kr],
3339
3663
  parseTag(e, t, n) {
3340
- if (e !== 24n || !(t instanceof N)) return;
3664
+ if (e !== 24n || !(t instanceof B)) return;
3341
3665
  let r = (t.end ?? t.value.length) - t.value.length, i = n ? {
3342
3666
  extensions: n.extensions,
3343
3667
  builtinExtensions: n.builtinExtensions,
@@ -3349,7 +3673,7 @@ var br = 24n, xr = {
3349
3673
  silent: n.silent
3350
3674
  } : void 0;
3351
3675
  try {
3352
- return new M(br, new z([yr(t.value, i)], { encodingWidth: t.encodingWidth }));
3676
+ return new z(Kr, new K([Gr(t.value, i)], { encodingWidth: t.encodingWidth }));
3353
3677
  } catch (e) {
3354
3678
  if (i?.strict !== !1) throw e;
3355
3679
  let t = `tag 24 content is not valid CBOR: ${e instanceof Error ? e.message : String(e)}`, a = {
@@ -3363,156 +3687,156 @@ var br = 24n, xr = {
3363
3687
  };
3364
3688
  //#endregion
3365
3689
  //#region src/extensions/ellipsis.ts
3366
- function Sr(e) {
3367
- return e instanceof V && !(e.content instanceof I);
3690
+ function Jr(e) {
3691
+ return e instanceof q && !(e.content instanceof U);
3368
3692
  }
3369
- function Cr(e) {
3693
+ function Yr(e) {
3370
3694
  let t = !1, n = !1, r = !1, i;
3371
3695
  for (let a of e) {
3372
3696
  let e;
3373
- if (Sr(a)) e = !0, r = !0;
3374
- else if (a instanceof G) e = !1, t = !0;
3375
- else if (a instanceof N) e = !1, n = !0;
3697
+ if (Jr(a)) e = !0, r = !0;
3698
+ else if (a instanceof Y) e = !1, t = !0;
3699
+ else if (a instanceof B) e = !1, n = !0;
3376
3700
  else return !1;
3377
3701
  if (e === i) return !1;
3378
3702
  i = e;
3379
3703
  }
3380
3704
  return r && !(t && n);
3381
3705
  }
3382
- var wr = {
3383
- tagNumbers: [Ke],
3706
+ var Xr = {
3707
+ tagNumbers: [dt],
3384
3708
  parseTag(e, t) {
3385
3709
  if (e === 888n) {
3386
- if (t instanceof R && t.value === 22) return new V();
3387
- if (t instanceof I && Cr(t.items)) return new V(t.items);
3710
+ if (t instanceof G && t.value === 22) return new q();
3711
+ if (t instanceof U && Yr(t.items)) return new q(t.items);
3388
3712
  }
3389
3713
  }
3390
- }, Tr = new TextEncoder(), Er = new TextDecoder("utf-8", { fatal: !0 }), Dr = new TextDecoder("utf-8", { fatal: !1 }), Or = Symbol("ellipsis");
3391
- function kr(e) {
3714
+ }, Zr = new TextEncoder(), Qr = new TextDecoder("utf-8", { fatal: !0 }), $r = new TextDecoder("utf-8", { fatal: !1 }), ei = Symbol("ellipsis");
3715
+ function ti(e) {
3392
3716
  let t = 0;
3393
3717
  for (let n of e) t += n.length;
3394
3718
  let n = new Uint8Array(t), r = 0;
3395
3719
  for (let t of e) n.set(t, r), r += t.length;
3396
3720
  return n;
3397
3721
  }
3398
- function Ar(e, t, n) {
3399
- if (t instanceof B) {
3400
- Ar(e, t.inner, n);
3722
+ function ni(e, t, n) {
3723
+ if (t instanceof ut) {
3724
+ ni(e, t.inner, n);
3401
3725
  return;
3402
3726
  }
3403
- if (t instanceof V) {
3404
- if (t.content instanceof I) for (let r of t.content.items) Ar(e, r, n);
3405
- else n.push(Or);
3727
+ if (t instanceof q) {
3728
+ if (t.content instanceof U) for (let r of t.content.items) ni(e, r, n);
3729
+ else n.push(ei);
3406
3730
  return;
3407
3731
  }
3408
- if (t instanceof G) {
3409
- n.push(Tr.encode(t.value));
3732
+ if (t instanceof Y) {
3733
+ n.push(Zr.encode(t.value));
3410
3734
  return;
3411
3735
  }
3412
- if (t instanceof N) {
3736
+ if (t instanceof B) {
3413
3737
  n.push(t.value);
3414
3738
  return;
3415
3739
  }
3416
- if (t instanceof F) {
3417
- n.push(Tr.encode(t.chunks.map((e) => e.value).join("")));
3740
+ if (t instanceof H) {
3741
+ n.push(Zr.encode(t.chunks.map((e) => e.value).join("")));
3418
3742
  return;
3419
3743
  }
3420
- if (t instanceof P) {
3421
- n.push(kr(t.chunks.map((e) => e.value)));
3744
+ if (t instanceof V) {
3745
+ n.push(ti(t.chunks.map((e) => e.value)));
3422
3746
  return;
3423
3747
  }
3424
3748
  throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings or ellipses`);
3425
3749
  }
3426
- function jr(e, t) {
3750
+ function ri(e, t) {
3427
3751
  try {
3428
- return Er.decode(e);
3752
+ return Qr.decode(e);
3429
3753
  } catch {
3430
3754
  let n = "t1 concatenation result is not valid UTF-8";
3431
3755
  if (t) t(n);
3432
3756
  else throw SyntaxError(n);
3433
- return Dr.decode(e);
3757
+ return $r.decode(e);
3434
3758
  }
3435
3759
  }
3436
- function Mr(e, t, n) {
3760
+ function ii(e, t, n) {
3437
3761
  let r = [];
3438
- for (let n of t) Ar(e, n, r);
3762
+ for (let n of t) ni(e, n, r);
3439
3763
  let i = e === "t1", a = [], o = !1, s = [], c = () => {
3440
3764
  if (s.length === 0) return;
3441
- let e = kr(s);
3442
- s.length = 0, e.length !== 0 && a.push(i ? new G(jr(e, n)) : new N(e));
3765
+ let e = ti(s);
3766
+ s.length = 0, e.length !== 0 && a.push(i ? new Y(ri(e, n)) : new B(e));
3443
3767
  };
3444
- for (let e of r) e === Or ? (c(), a[a.length - 1] instanceof V || (a.push(new V()), o = !0)) : s.push(e);
3768
+ for (let e of r) e === ei ? (c(), a[a.length - 1] instanceof q || (a.push(new q()), o = !0)) : s.push(e);
3445
3769
  if (!o) {
3446
- let e = kr(s);
3447
- return i ? new G(jr(e, n)) : new N(e);
3770
+ let e = ti(s);
3771
+ return i ? new Y(ri(e, n)) : new B(e);
3448
3772
  }
3449
- return c(), a.length === 1 ? new V() : new V(a);
3773
+ return c(), a.length === 1 ? new q() : new q(a);
3450
3774
  }
3451
- function Nr(e) {
3775
+ function ai(e) {
3452
3776
  return {
3453
3777
  appStringPrefixes: [e],
3454
3778
  preserveAppSeqSource: !0,
3455
3779
  parseAppString(t, n, r) {
3456
- return Mr(e, [new G(n)], r);
3780
+ return ii(e, [new Y(n)], r);
3457
3781
  },
3458
3782
  parseAppSequence(t, n, r) {
3459
- return Mr(e, n, r);
3783
+ return ii(e, n, r);
3460
3784
  }
3461
3785
  };
3462
3786
  }
3463
- var Pr = Nr("t1"), Fr = Nr("b1"), Ir = new TextEncoder(), Lr = new TextDecoder("utf-8", { fatal: !0 }), Rr = new TextDecoder("utf-8", { fatal: !1 });
3464
- function zr(e) {
3787
+ var oi = ai("t1"), si = ai("b1"), ci = new TextEncoder(), li = new TextDecoder("utf-8", { fatal: !0 }), ui = new TextDecoder("utf-8", { fatal: !1 });
3788
+ function di(e) {
3465
3789
  let t = 0;
3466
3790
  for (let n of e) t += n.length;
3467
3791
  let n = new Uint8Array(t), r = 0;
3468
3792
  for (let t of e) n.set(t, r), r += t.length;
3469
3793
  return n;
3470
3794
  }
3471
- function Br(e, t, n) {
3795
+ function fi(e, t, n) {
3472
3796
  let r = e === "ilts", i = [], a = [];
3473
3797
  for (let o of t) {
3474
- if (o instanceof B && (o = o.inner), o instanceof V) throw SyntaxError(`${e}<<...>> cannot contain ellipses; there is no way to include an elision in an indefinite-length string`);
3798
+ if (o instanceof ut && (o = o.inner), o instanceof q) throw SyntaxError(`${e}<<...>> cannot contain ellipses; there is no way to include an elision in an indefinite-length string`);
3475
3799
  let t, s, c;
3476
- if (o instanceof G) t = o.value, c = o.encodingWidth;
3477
- else if (o instanceof N) s = o.value, c = o.encodingWidth;
3478
- else if (o instanceof F) t = o.chunks.map((e) => e.value).join("");
3479
- else if (o instanceof P) s = zr(o.chunks.map((e) => e.value));
3800
+ if (o instanceof Y) t = o.value, c = o.encodingWidth;
3801
+ else if (o instanceof B) s = o.value, c = o.encodingWidth;
3802
+ else if (o instanceof H) t = o.chunks.map((e) => e.value).join("");
3803
+ else if (o instanceof V) s = di(o.chunks.map((e) => e.value));
3480
3804
  else throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings`);
3481
3805
  if (r) {
3482
3806
  let e;
3483
3807
  if (t !== void 0) e = t;
3484
3808
  else try {
3485
- e = Lr.decode(s);
3809
+ e = li.decode(s);
3486
3810
  } catch {
3487
3811
  let t = "ilts chunk is not valid UTF-8";
3488
3812
  if (n) n(t);
3489
3813
  else throw SyntaxError(t);
3490
- e = Rr.decode(s);
3814
+ e = ui.decode(s);
3491
3815
  }
3492
- a.push(new G(e, c === void 0 ? void 0 : { encodingWidth: c }));
3816
+ a.push(new Y(e, c === void 0 ? void 0 : { encodingWidth: c }));
3493
3817
  } else {
3494
- let e = s ?? Ir.encode(t);
3495
- i.push(new N(e, c === void 0 ? void 0 : { encodingWidth: c }));
3818
+ let e = s ?? ci.encode(t);
3819
+ i.push(new B(e, c === void 0 ? void 0 : { encodingWidth: c }));
3496
3820
  }
3497
3821
  }
3498
- return r ? new F(a) : new P(i);
3822
+ return r ? new H(a) : new V(i);
3499
3823
  }
3500
- function Vr(e) {
3824
+ function pi(e) {
3501
3825
  return {
3502
3826
  appStringPrefixes: [e],
3503
3827
  preserveAppSeqSource: !0,
3504
3828
  parseAppString(t, n, r) {
3505
- return new B(Br(e, [new G(n)], r), `${e}${c(n)}`);
3829
+ return new ut(fi(e, [new Y(n)], r), `${e}${ne(n)}`);
3506
3830
  },
3507
3831
  parseAppSequence(t, n, r) {
3508
- return Br(e, n, r);
3832
+ return fi(e, n, r);
3509
3833
  }
3510
3834
  };
3511
3835
  }
3512
- var Hr = Vr("ilbs"), Ur = Vr("ilts"), Wr = class extends j {
3836
+ var mi = pi("ilbs"), hi = pi("ilts"), gi = class extends R {
3513
3837
  _bits;
3514
3838
  constructor(e) {
3515
- super(C(e), { precision: "half" }), this._bits = e & 65535;
3839
+ super(j(e), { precision: "half" }), this._bits = e & 65535;
3516
3840
  }
3517
3841
  _toCBOR() {
3518
3842
  return new Uint8Array([
@@ -3521,7 +3845,7 @@ var Hr = Vr("ilbs"), Ur = Vr("ilts"), Wr = class extends j {
3521
3845
  this._bits & 255
3522
3846
  ]);
3523
3847
  }
3524
- }, Gr = class extends j {
3848
+ }, _i = class extends R {
3525
3849
  _raw;
3526
3850
  constructor(e) {
3527
3851
  super(new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), { precision: "single" }), this._raw = e.slice();
@@ -3530,7 +3854,7 @@ var Hr = Vr("ilbs"), Ur = Vr("ilts"), Wr = class extends j {
3530
3854
  let e = /* @__PURE__ */ new Uint8Array(5);
3531
3855
  return e[0] = 250, e.set(this._raw, 1), e;
3532
3856
  }
3533
- }, Kr = class extends j {
3857
+ }, vi = class extends R {
3534
3858
  _raw;
3535
3859
  constructor(e) {
3536
3860
  super(new DataView(e.buffer, e.byteOffset).getFloat64(0, !1), { precision: "double" }), this._raw = e.slice();
@@ -3540,13 +3864,13 @@ var Hr = Vr("ilbs"), Ur = Vr("ilts"), Wr = class extends j {
3540
3864
  return e[0] = 251, e.set(this._raw, 1), e;
3541
3865
  }
3542
3866
  };
3543
- function qr(e) {
3544
- if (e.length === 2) return new Wr(e[0] << 8 | e[1]);
3545
- if (e.length === 4) return new Gr(e);
3546
- if (e.length === 8) return new Kr(e);
3867
+ function yi(e) {
3868
+ if (e.length === 2) return new gi(e[0] << 8 | e[1]);
3869
+ if (e.length === 4) return new _i(e);
3870
+ if (e.length === 8) return new vi(e);
3547
3871
  throw SyntaxError(`float'...' requires 4, 8, or 16 hex digits (2, 4, or 8 bytes); got ${e.length} bytes`);
3548
3872
  }
3549
- function Jr(e) {
3873
+ function bi(e) {
3550
3874
  let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023, i;
3551
3875
  if (n === 31) i = t << 31 | 2139095040 | r << 13;
3552
3876
  else if (n === 0 && r === 0) i = t << 31;
@@ -3558,7 +3882,7 @@ function Jr(e) {
3558
3882
  let a = /* @__PURE__ */ new Uint8Array(4);
3559
3883
  return new DataView(a.buffer).setUint32(0, i >>> 0, !1), a;
3560
3884
  }
3561
- function Yr(e) {
3885
+ function xi(e) {
3562
3886
  let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023, i = /* @__PURE__ */ new Uint8Array(8), a = new DataView(i.buffer);
3563
3887
  if (n === 31) a.setUint32(0, (t << 31 | 2146435072 | r << 10) >>> 0, !1), a.setUint32(4, 0, !1);
3564
3888
  else if (n === 0 && r === 0) a.setUint32(0, t << 31 >>> 0, !1), a.setUint32(4, 0, !1);
@@ -3569,7 +3893,7 @@ function Yr(e) {
3569
3893
  } else a.setUint32(0, (t << 31 | n + 1008 << 20 | r << 10) >>> 0, !1), a.setUint32(4, 0, !1);
3570
3894
  return i;
3571
3895
  }
3572
- function Xr(e) {
3896
+ function Si(e) {
3573
3897
  let t = new DataView(e.buffer, e.byteOffset).getUint32(0, !1), n = t >>> 31 & 1, r = t >>> 23 & 255, i = t & 8388607, a = /* @__PURE__ */ new Uint8Array(8), o = new DataView(a.buffer);
3574
3898
  if (r === 255) o.setUint32(0, (n << 31 | 2146435072 | i >>> 3) >>> 0, !1), o.setUint32(4, (i & 7) << 29, !1);
3575
3899
  else if (r === 0 && i === 0) o.setUint32(0, n << 31 >>> 0, !1), o.setUint32(4, 0, !1);
@@ -3579,49 +3903,49 @@ function Xr(e) {
3579
3903
  }
3580
3904
  return a;
3581
3905
  }
3582
- function Zr(e, t, n) {
3906
+ function Ci(e, t, n) {
3583
3907
  let r = e.length === 2 ? 1 : e.length === 4 ? 2 : 3;
3584
3908
  if (r === 1) {
3585
3909
  let n = e[0] << 8 | e[1];
3586
- if (t === 2) return new Gr(Jr(n));
3587
- if (t === 3) return new Kr(Yr(n));
3910
+ if (t === 2) return new _i(bi(n));
3911
+ if (t === 3) return new vi(xi(n));
3588
3912
  }
3589
3913
  if (r === 2) {
3590
- if (t === 3) return new Kr(Xr(e));
3914
+ if (t === 3) return new vi(Si(e));
3591
3915
  if (t === 1) {
3592
- let t = new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), r = S(t);
3593
- return !Object.is(C(r), t) && !isNaN(t) && n("float'...' value cannot be exactly represented as float16 (_1)"), new Wr(r);
3916
+ let t = new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), r = ve(t);
3917
+ return !Object.is(j(r), t) && !isNaN(t) && n("float'...' value cannot be exactly represented as float16 (_1)"), new gi(r);
3594
3918
  }
3595
3919
  }
3596
3920
  if (r === 3) {
3597
3921
  let r = new DataView(e.buffer, e.byteOffset).getFloat64(0, !1);
3598
3922
  if (t === 1) {
3599
- let e = S(r);
3600
- return !Object.is(C(e), r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float16 (_1)"), new Wr(e);
3923
+ let e = ve(r);
3924
+ return !Object.is(j(e), r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float16 (_1)"), new gi(e);
3601
3925
  }
3602
3926
  if (t === 2) {
3603
3927
  let e = Math.fround(r);
3604
3928
  !Object.is(e, r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float32 (_2)");
3605
3929
  let t = /* @__PURE__ */ new Uint8Array(4);
3606
- return new DataView(t.buffer).setFloat32(0, e, !1), new Gr(t);
3930
+ return new DataView(t.buffer).setFloat32(0, e, !1), new _i(t);
3607
3931
  }
3608
3932
  }
3609
- return qr(e);
3933
+ return yi(e);
3610
3934
  }
3611
- var Qr = {
3935
+ var wi = {
3612
3936
  appStringPrefixes: ["float"],
3613
- parseAppString(e, t, r, i) {
3614
- let a = Ie(t);
3937
+ parseAppString(e, t, n, r) {
3938
+ let a = tt(t);
3615
3939
  if (!/^[0-9a-fA-F]*$/.test(a)) throw SyntaxError("float'...' contains non-hex characters");
3616
3940
  if (a.length % 2 != 0) throw SyntaxError(`float'...' hex content has odd length (${a.length} digits)`);
3617
- let o = n(a), s = i?.encodingWidth;
3618
- if (s === void 0) return qr(o);
3941
+ let o = i(a), s = r?.encodingWidth;
3942
+ if (s === void 0) return yi(o);
3619
3943
  if (s !== 1 && s !== 2 && s !== 3) {
3620
3944
  let e = `float'...' encoding indicator _${s} is not valid; use _1, _2, or _3`;
3621
- if (r) return r(e), qr(o);
3945
+ if (n) return n(e), yi(o);
3622
3946
  throw SyntaxError(e);
3623
3947
  }
3624
- return s === (o.length === 2 ? 1 : o.length === 4 ? 2 : 3) ? qr(o) : Zr(o, s, r ?? ((e) => {
3948
+ return s === (o.length === 2 ? 1 : o.length === 4 ? 2 : 3) ? yi(o) : Ci(o, s, n ?? ((e) => {
3625
3949
  throw SyntaxError(e);
3626
3950
  }));
3627
3951
  },
@@ -3632,100 +3956,100 @@ var Qr = {
3632
3956
  if (n) n(e);
3633
3957
  else throw SyntaxError(e);
3634
3958
  }
3635
- if (!(t[0] instanceof N)) throw SyntaxError("float<<...>> item must be a byte string");
3636
- return qr(t[0].value);
3637
- }
3638
- }, $r = [
3639
- er,
3640
- xr,
3641
- wr
3642
- ], ei = [
3643
- rn,
3644
- wn,
3645
- Zn,
3646
- Pr,
3647
- Fr,
3648
- Hr,
3649
- Ur,
3650
- Qr
3651
- ], ti;
3652
- function Z(e) {
3653
- return e === void 0 ? ti ??= [...$r, ...ei] : e === !1 ? $r : [...$r, ...e];
3959
+ if (!(t[0] instanceof B)) throw SyntaxError("float<<...>> item must be a byte string");
3960
+ return yi(t[0].value);
3961
+ }
3962
+ }, Ti = [
3963
+ Tr,
3964
+ qr,
3965
+ Xr
3966
+ ], Ei = [
3967
+ On,
3968
+ Jn,
3969
+ Sr,
3970
+ oi,
3971
+ si,
3972
+ mi,
3973
+ hi,
3974
+ wi
3975
+ ], Di;
3976
+ function Oi(e) {
3977
+ return e === void 0 ? Di ??= [...Ti, ...Ei] : e === !1 ? Ti : [...Ti, ...e];
3654
3978
  }
3655
3979
  //#endregion
3656
3980
  //#region src/js/fromJS.ts
3657
- var ni;
3658
- function ri(e) {
3981
+ var ki;
3982
+ function Ai(e) {
3659
3983
  if (e === void 0) {
3660
- if (ni) return ni;
3661
- let e = Z(void 0);
3662
- return ni = {
3984
+ if (ki) return ki;
3985
+ let e = Oi(void 0);
3986
+ return ki = {
3663
3987
  fromJS: e.filter((e) => e.fromJS !== void 0),
3664
3988
  parseTag: e.filter((e) => e.parseTag !== void 0)
3665
3989
  };
3666
3990
  }
3667
- let t = Z(e);
3991
+ let t = Oi(e);
3668
3992
  return {
3669
3993
  fromJS: t.filter((e) => e.fromJS !== void 0),
3670
3994
  parseTag: t.filter((e) => e.parseTag !== void 0)
3671
3995
  };
3672
3996
  }
3673
- function ii(e) {
3674
- let t = e?.extensions, n = ri(e?.builtinExtensions);
3997
+ function ji(e) {
3998
+ let t = e?.extensions, n = Ai(e?.builtinExtensions);
3675
3999
  return t?.length ? {
3676
4000
  fromJS: [...t.filter((e) => e.fromJS !== void 0), ...n.fromJS],
3677
4001
  parseTag: [...t.filter((e) => e.parseTag !== void 0), ...n.parseTag]
3678
4002
  } : n;
3679
4003
  }
3680
- function ai(e, t) {
4004
+ function Mi(e, t) {
3681
4005
  if (t?.replacer) {
3682
- let { replacer: n, ...r } = t, i = si(e, n, r.extensions, r.undefinedOmits, r.builtinExtensions);
3683
- return i === x ? R.UNDEFINED : ai(i, Object.keys(r).length > 0 ? r : void 0);
4006
+ let { replacer: n, ...r } = t, i = Fi(e, n, r.extensions, r.undefinedOmits, r.builtinExtensions);
4007
+ return i === A ? G.UNDEFINED : Mi(i, Object.keys(r).length > 0 ? r : void 0);
3684
4008
  }
3685
- return Q(e, t, !0, ii(t));
4009
+ return Ni(e, t, !0, ji(t));
3686
4010
  }
3687
- function Q(e, t, n, r) {
4011
+ function Ni(e, t, n, r) {
3688
4012
  for (let n of r.fromJS) {
3689
4013
  let r = n.fromJS(e, t ?? {});
3690
4014
  if (r !== void 0) return r;
3691
4015
  }
3692
- if (n && typeof e == "object" && e && b.symbol in e) {
3693
- let n = e[b.symbol], i = Q(e, t, !1, r);
4016
+ if (n && typeof e == "object" && e && k.symbol in e) {
4017
+ let n = e[k.symbol], i = Ni(e, t, !1, r);
3694
4018
  for (let e of r.parseTag) {
3695
4019
  let t = e.parseTag(n, i);
3696
4020
  if (t !== void 0) return t;
3697
4021
  }
3698
- return new M(n, i);
3699
- }
3700
- if (e instanceof b.Null) return R.NULL;
3701
- if (e instanceof b.Undefined) return R.UNDEFINED;
3702
- if (e instanceof he) return new R(e.value);
3703
- if (e === null) return R.NULL;
3704
- if (e === void 0) return R.UNDEFINED;
3705
- if (e === !0) return R.TRUE;
3706
- if (e === !1) return R.FALSE;
3707
- if (typeof e == "bigint") return e > 18446744073709551615n ? new it(e) : e < -18446744073709551616n ? new at(e) : e >= 0n ? new k(e) : new A(e);
3708
- if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new k(BigInt(e)) : new A(BigInt(e)) : new j(e);
3709
- if (typeof e == "string") return new G(e);
3710
- if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return Q(e.valueOf(), t, !1, r);
3711
- if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new N(new Uint8Array(e));
3712
- if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new I(Array.from(e, (e) => new k(BigInt(e)))) : new N(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
3713
- if (e instanceof $) return new L([...e].map(([e, n]) => [Q(e, t, !0, r), Q(n, t, !0, r)]));
3714
- if (Array.isArray(e)) return new I(e.map((e) => Q(e, t, !0, r)));
4022
+ return new z(n, i);
4023
+ }
4024
+ if (e instanceof k.Null) return G.NULL;
4025
+ if (e instanceof k.Undefined) return G.UNDEFINED;
4026
+ if (e instanceof he) return new G(e.value);
4027
+ if (e === null) return G.NULL;
4028
+ if (e === void 0) return G.UNDEFINED;
4029
+ if (e === !0) return G.TRUE;
4030
+ if (e === !1) return G.FALSE;
4031
+ if (typeof e == "bigint") return e > 18446744073709551615n ? new Ct(e) : e < -18446744073709551616n ? new wt(e) : e >= 0n ? new I(e) : new L(e);
4032
+ if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new I(BigInt(e)) : new L(BigInt(e)) : new R(e);
4033
+ if (typeof e == "string") return new Y(e);
4034
+ if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return Ni(e.valueOf(), t, !1, r);
4035
+ if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new B(new Uint8Array(e));
4036
+ if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new U(Array.from(e, (e) => new I(BigInt(e)))) : new B(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
4037
+ if (e instanceof $) return new W([...e].map(([e, n]) => [Ni(e, t, !0, r), Ni(n, t, !0, r)]));
4038
+ if (Array.isArray(e)) return new U(e.map((e) => Ni(e, t, !0, r)));
3715
4039
  if (typeof e == "object") {
3716
4040
  let n = [];
3717
- for (let [i, a] of Object.entries(e)) n.push([new G(i), Q(a, t, !0, r)]);
3718
- return new L(n);
4041
+ for (let [i, a] of Object.entries(e)) n.push([new Y(i), Ni(a, t, !0, r)]);
4042
+ return new W(n);
3719
4043
  }
3720
4044
  throw TypeError(`fromJS: unsupported value type: ${typeof e}`);
3721
4045
  }
3722
- function oi(e) {
3723
- 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 b.Null || e instanceof b.Undefined || e instanceof he;
4046
+ function Pi(e) {
4047
+ 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 k.Null || e instanceof k.Undefined || e instanceof he;
3724
4048
  }
3725
- function si(e, t, n, r, i) {
3726
- let a = [...n ?? [], ...Z(i)].filter((e) => e.isJSType !== void 0);
4049
+ function Fi(e, t, n, r, i) {
4050
+ let a = [...n ?? [], ...Oi(i)].filter((e) => e.isJSType !== void 0);
3727
4051
  function o(e) {
3728
- return e === x || r === !0 && e === void 0;
4052
+ return e === A || r === !0 && e === void 0;
3729
4053
  }
3730
4054
  if (Array.isArray(t)) {
3731
4055
  let n = t.map(String);
@@ -3733,7 +4057,7 @@ function si(e, t, n, r, i) {
3733
4057
  if (typeof e != "object" || !e) return e;
3734
4058
  if (e instanceof $) return $.from(e, ([e, t]) => [e, r(t)]);
3735
4059
  if (Array.isArray(e)) return e.map(r);
3736
- if (b.symbol in e || oi(e) || a.some((t) => t.isJSType(e))) return e;
4060
+ if (k.symbol in e || Pi(e) || a.some((t) => t.isJSType(e))) return e;
3737
4061
  let t = Object.getPrototypeOf(e);
3738
4062
  if (t === Object.prototype || t === null) {
3739
4063
  let t = e.toJSON;
@@ -3755,7 +4079,7 @@ function si(e, t, n, r, i) {
3755
4079
  }
3756
4080
  }
3757
4081
  if (e = s.call(n, t, e), typeof e == "object" && e) {
3758
- if (b.symbol in e) return e;
4082
+ if (k.symbol in e) return e;
3759
4083
  if (e instanceof $) {
3760
4084
  let t = new $();
3761
4085
  for (let [n, r] of e) {
@@ -3768,7 +4092,7 @@ function si(e, t, n, r, i) {
3768
4092
  let r = c(t, String(n), e);
3769
4093
  return o(r) ? null : r;
3770
4094
  });
3771
- if (oi(e) || a.some((t) => t.isJSType(e))) return e;
4095
+ if (Pi(e) || a.some((t) => t.isJSType(e))) return e;
3772
4096
  let t = {};
3773
4097
  for (let n of Object.keys(e)) {
3774
4098
  let r = c(e[n], n, e);
@@ -3786,7 +4110,7 @@ var $ = class extends Array {
3786
4110
  toJSON() {
3787
4111
  let e = {};
3788
4112
  for (let [t, n] of this) {
3789
- let r = typeof t == "string" ? t : ai(t).toCDN();
4113
+ let r = typeof t == "string" ? t : Mi(t).toCDN();
3790
4114
  r === "__proto__" ? Object.defineProperty(e, r, {
3791
4115
  value: n,
3792
4116
  writable: !0,
@@ -3798,6 +4122,6 @@ var $ = class extends Array {
3798
4122
  }
3799
4123
  };
3800
4124
  //#endregion
3801
- export { N as A, se as B, He as C, I as D, L as E, k as F, b as H, O as I, D as L, j as M, Me as N, F as O, A as P, he as R, Ve as S, R as T, le as U, ce as V, at as _, Qr as a, B as b, Fr as c, Zn as d, wn as f, lt as g, G as h, ei as i, M as j, P as k, Pr as l, an as m, si as n, Hr as o, rn as p, ai as r, Ur as s, $ as t, yr as u, it as v, z as w, Ue as x, V as y, x as z };
4125
+ export { z as A, ce as B, K as C, H as D, U as E, F, le as H, P as I, he as L, Ze as M, L as N, V as O, I as P, A as R, st as S, W as T, k as V, wt as _, wi as a, ut as b, si as c, Sr as d, Jn as f, Ot as g, Y as h, Ei as i, R as j, B as k, oi as l, kn as m, Fi as n, mi as o, On as p, Mi as r, hi as s, $ as t, Gr as u, Ct as v, G as w, ot as x, q as y, se as z };
3802
4126
 
3803
- //# sourceMappingURL=mapEntries-Ci_dppP6.js.map
4127
+ //# sourceMappingURL=mapEntries-CCLaJSaJ.js.map