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