@cbortech/cbor 0.26.2 → 0.26.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -96,23 +96,23 @@ var m = class {
96
96
  };
97
97
  //#endregion
98
98
  //#region src/cdn/serialize-utils.ts
99
- function ee(e) {
99
+ function _(e) {
100
100
  let t = e?.indent;
101
101
  return t === void 0 ? null : typeof t == "number" ? " ".repeat(t) : t;
102
102
  }
103
- function _(e, t) {
103
+ function v(e, t) {
104
104
  return e.repeat(t);
105
105
  }
106
- function te(e, t, n) {
107
- return t === null ? e.join(" + ") : e.join(` +\n${_(t, n + 1)}`);
106
+ function ee(e, t, n) {
107
+ return t === null ? e.join(" + ") : e.join(` +\n${v(t, n + 1)}`);
108
108
  }
109
- function ne(e) {
109
+ function y(e) {
110
110
  return !!(e.comments?.leading?.length || e.comments?.trailing?.length || e.comments?.dangling?.length);
111
111
  }
112
- function re(e) {
112
+ function te(e) {
113
113
  return !!(e.comments?.trailing?.length || e.comments?.dangling?.length);
114
114
  }
115
- function v(e, t) {
115
+ function b(e, t) {
116
116
  if (!t) return e.text;
117
117
  let { marker: n, text: r } = e;
118
118
  if (t === "c-style") return n === "#" ? "//" + r.slice(1) : n === "/" ? "/*" + r.slice(1, -1) + "*/" : r;
@@ -123,17 +123,17 @@ function v(e, t) {
123
123
  }
124
124
  return r;
125
125
  }
126
- function ie(e, t, n) {
127
- return (e.comments?.leading ?? []).map((e) => t + v(e, n));
126
+ function ne(e, t, n) {
127
+ return (e.comments?.leading ?? []).map((e) => t + b(e, n));
128
128
  }
129
- function y(e, t) {
129
+ function re(e, t) {
130
130
  let n = e.comments?.trailing ?? [];
131
- return n.length === 0 ? "" : " " + n.map((e) => v(e, t)).join(" ");
131
+ return n.length === 0 ? "" : " " + n.map((e) => b(e, t)).join(" ");
132
132
  }
133
- function ae(e, t, n) {
134
- return (e.comments?.dangling ?? []).map((e) => t + v(e, n));
133
+ function ie(e, t, n) {
134
+ return (e.comments?.dangling ?? []).map((e) => t + b(e, n));
135
135
  }
136
- function oe(e, t = !1) {
136
+ function ae(e, t = !1) {
137
137
  let n = e?.commas ?? "comma", r = n !== "none";
138
138
  return {
139
139
  inlineSep: r ? t ? "," : ", " : " ",
@@ -142,32 +142,49 @@ function oe(e, t = !1) {
142
142
  colSep: t ? ":" : ": "
143
143
  };
144
144
  }
145
- function se(e) {
146
- let { options: t, depth: n, openChar: r, closeChar: i, count: a } = e, o = ee(t), s = t?.preserveComments, c = typeof s == "string" ? s : void 0, l = s && (re(e.node) || e.hasEntryComments());
145
+ function x(e) {
146
+ let { options: t, depth: n, openChar: r, closeChar: i, count: a } = e, o = _(t), s = t?.preserveComments, c = typeof s == "string" ? s : void 0, l = s && (te(e.node) || e.hasEntryComments());
147
147
  o === null && l && (o = " ");
148
- let { inlineSep: u, multilineSep: d, trailSep: f, colSep: p } = oe(t, o === null), m = e.indefiniteLength ? "" : x(t, e.encodingWidth, () => b(BigInt(a))), h = m ? m + " " : "", g = e.indefiniteLength && (t?.encodingIndicators ?? "auto") !== "never";
148
+ let { inlineSep: u, multilineSep: d, trailSep: f, colSep: p } = ae(t, o === null), m = e.indefiniteLength ? "" : w(t, e.encodingWidth, () => C(BigInt(a))), h = m ? m + " " : "", g = e.indefiniteLength && (t?.encodingIndicators ?? "auto") !== "never", ee = (t) => e.indefiniteLength ? g ? a === 0 ? `${r}_ ${i}` : `${r}_ ${t}${i}` : `${r}${t}${i}` : `${r}${h}${t}${i}`;
149
149
  if (o === null || a === 0 && !l) {
150
150
  let t = "";
151
151
  for (let n = 0; n < a; n++) n > 0 && (t += u), t += e.renderEntry(n, p);
152
- return e.indefiniteLength ? g ? a === 0 ? `${r}_ ${i}` : `${r}_ ${t}${i}` : `${r}${t}${i}` : `${r}${h}${t}${i}`;
152
+ return ee(t);
153
+ }
154
+ let y = null;
155
+ if (t?.inlineLeafContainers && a > 0 && !l) {
156
+ let t = [], n = !0;
157
+ for (let r = 0; r < a; r++) {
158
+ if (e.entryIsLeaf && !e.entryIsLeaf(r)) {
159
+ n = !1;
160
+ break;
161
+ }
162
+ let i = e.renderEntry(r, p);
163
+ if (t.push(i), i.includes("\n")) {
164
+ n = !1;
165
+ break;
166
+ }
167
+ }
168
+ if (n) return ee(t.join(u));
169
+ y = t;
153
170
  }
154
- let te = _(o, n + 1), ne = _(o, n), v = e.indefiniteLength ? g ? `${r}_ ` : r : `${r}${h}`, y = [];
171
+ let b = v(o, n + 1), re = v(o, n), x = e.indefiniteLength ? g ? `${r}_ ` : r : `${r}${h}`, S = [];
155
172
  for (let t = 0; t < a; t++) {
156
- s && y.push(...ie(e.entryLeadingNode(t), te, c));
157
- let n = t < a - 1 ? d : f;
158
- y.push(`${te}${e.renderEntry(t, p)}${n}${s ? e.entryTrailing(t, c) : ""}`);
173
+ s && S.push(...ne(e.entryLeadingNode(t), b, c));
174
+ let n = t < a - 1 ? d : f, r = y?.[t] ?? e.renderEntry(t, p);
175
+ S.push(`${b}${r}${n}${s ? e.entryTrailing(t, c) : ""}`);
159
176
  }
160
- return s && y.push(...ae(e.node, te, c)), `${v}\n${y.join("\n")}\n${ne}${i}`;
177
+ return s && S.push(...ie(e.node, b, c)), `${x}\n${S.join("\n")}\n${re}${i}`;
161
178
  }
162
- var ce = typeof (/* @__PURE__ */ new Uint8Array()).toBase64 == "function";
163
- function le(e) {
164
- if (ce) return e.toBase64({ omitPadding: !0 });
179
+ var S = typeof (/* @__PURE__ */ new Uint8Array()).toBase64 == "function";
180
+ function oe(e) {
181
+ if (S) return e.toBase64({ omitPadding: !0 });
165
182
  let t = "";
166
183
  for (let n of e) t += String.fromCharCode(n);
167
184
  return btoa(t).replace(/=/g, "");
168
185
  }
169
- function ue(e) {
170
- if (ce) return e.toBase64({
186
+ function se(e) {
187
+ if (S) return e.toBase64({
171
188
  alphabet: "base64url",
172
189
  omitPadding: !0
173
190
  });
@@ -175,54 +192,54 @@ function ue(e) {
175
192
  for (let n of e) t += String.fromCharCode(n);
176
193
  return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
177
194
  }
178
- var de = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", fe = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
179
- function pe(e, t) {
195
+ var ce = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", le = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
196
+ function ue(e, t) {
180
197
  let n = "", r = 0, i = 0;
181
198
  for (let a of e) for (r = r << 8 | a, i += 8; i >= 5;) i -= 5, n += t[r >> i & 31];
182
199
  return i > 0 && (n += t[r << 5 - i & 31]), n;
183
200
  }
184
- function me(e) {
201
+ function de(e) {
185
202
  for (let t of e) {
186
203
  let e = t.codePointAt(0);
187
204
  if (e < 32 || e === 127) return !0;
188
205
  }
189
206
  return !1;
190
207
  }
191
- function he(e, t, n) {
208
+ function fe(e, t, n) {
192
209
  if (n === "string") {
193
- let t = _e(e);
194
- if (t != null) return be(t);
210
+ let t = me(e);
211
+ if (t != null) return _e(t);
195
212
  }
196
213
  if (n === "printable-string" || n === void 0) {
197
- let t = _e(e);
198
- if (t != null && !me(t)) return be(t);
214
+ let t = me(e);
215
+ if (t != null && !de(t)) return _e(t);
199
216
  }
200
217
  switch (t) {
201
- case "base64": return `b64'${le(e)}'`;
202
- case "base64url": return `b64'${ue(e)}'`;
203
- case "base32": return `b32'${pe(e, de)}'`;
204
- case "base32hex": return `h32'${pe(e, fe)}'`;
218
+ case "base64": return `b64'${oe(e)}'`;
219
+ case "base64url": return `b64'${se(e)}'`;
220
+ case "base32": return `b32'${ue(e, ce)}'`;
221
+ case "base32hex": return `h32'${ue(e, le)}'`;
205
222
  default: return `h'${i(e)}'`;
206
223
  }
207
224
  }
208
- var ge = new TextDecoder("utf-8", { fatal: !0 });
209
- function _e(e) {
225
+ var pe = new TextDecoder("utf-8", { fatal: !0 });
226
+ function me(e) {
210
227
  try {
211
- return ge.decode(e);
228
+ return pe.decode(e);
212
229
  } catch {
213
230
  return null;
214
231
  }
215
232
  }
216
- function ve(e, t) {
233
+ function he(e, t) {
217
234
  for (let n = 0; n < e.length; n++) {
218
235
  let r = e.charCodeAt(n);
219
236
  if (r === t || r === 92 || r < 32 || r === 127 || r >= 8192 && (r === 8232 || r === 8233 || r >= 8203 && r <= 8205 || r === 65279)) return !0;
220
237
  }
221
238
  return !1;
222
239
  }
223
- function ye(e, t) {
240
+ function ge(e, t) {
224
241
  let n = t.codePointAt(0);
225
- if (!ve(e, n)) return t + e + t;
242
+ if (!he(e, n)) return t + e + t;
226
243
  let r = t;
227
244
  for (let i of e) {
228
245
  let e = i.codePointAt(0);
@@ -247,40 +264,40 @@ function ye(e, t) {
247
264
  }
248
265
  return r + t;
249
266
  }
250
- function be(e) {
251
- return ye(e, "'");
267
+ function _e(e) {
268
+ return ge(e, "'");
252
269
  }
253
- function xe(e) {
254
- return ye(e, "'");
270
+ function ve(e) {
271
+ return ge(e, "'");
255
272
  }
256
- function Se(e) {
257
- return ye(e, "\"");
273
+ function ye(e) {
274
+ return ge(e, "\"");
258
275
  }
259
- function Ce(e) {
276
+ function be(e) {
260
277
  if (isNaN(e)) return "NaN";
261
278
  if (!isFinite(e)) return e > 0 ? "Infinity" : "-Infinity";
262
279
  if (Object.is(e, -0)) return "-0.0";
263
280
  let t = e.toString();
264
281
  return t.includes(".") || t.includes("e") ? t : t + ".0";
265
282
  }
266
- function we(e, t, n, r) {
283
+ function xe(e, t, n, r) {
267
284
  if (r === "never") return "";
268
285
  let i = t ?? n;
269
286
  return r === "always" ? i === "half" ? "_1" : i === "single" ? "_2" : "_3" : t === void 0 || t === n ? "" : t === "half" ? "_1" : t === "single" ? "_2" : "_3";
270
287
  }
271
- function b(e) {
288
+ function C(e) {
272
289
  return e <= 23n ? "i" : e <= 255n ? 0 : e <= 65535n ? 1 : e <= 4294967295n ? 2 : 3;
273
290
  }
274
- function x(e, t, n) {
291
+ function w(e, t, n) {
275
292
  let r = e?.encodingIndicators ?? "auto";
276
293
  return r === "never" ? "" : r === "always" ? `_${t ?? n()}` : t === void 0 ? "" : `_${t}`;
277
294
  }
278
295
  //#endregion
279
296
  //#region src/utils/float16.ts
280
- var Te = "getFloat16" in DataView.prototype && "setFloat16" in DataView.prototype, Ee = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
281
- function S(e) {
282
- Ee.setFloat64(0, e, !1);
283
- let t = Ee.getUint32(0, !1), n = Ee.getUint32(4, !1), r = t >>> 31 & 1, i = t >>> 20 & 2047, a = t & 1048575;
297
+ var Se = "getFloat16" in DataView.prototype && "setFloat16" in DataView.prototype, Ce = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
298
+ function T(e) {
299
+ Ce.setFloat64(0, e, !1);
300
+ let t = Ce.getUint32(0, !1), n = Ce.getUint32(4, !1), r = t >>> 31 & 1, i = t >>> 20 & 2047, a = t & 1048575;
284
301
  if (i === 2047) {
285
302
  if (a === 0 && n === 0) return r << 15 | 31744;
286
303
  let e = a >> 10 | (n === 0 ? 0 : 1) || 1;
@@ -301,19 +318,19 @@ function S(e) {
301
318
  let u = o <= 0 ? 0 : o;
302
319
  return r << 15 | u << 10 | s;
303
320
  }
304
- function C(e) {
321
+ function E(e) {
305
322
  let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023;
306
323
  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);
307
324
  }
308
- var De = Te ? (e, t, n, r) => {
325
+ var we = Se ? (e, t, n, r) => {
309
326
  e.setFloat16(t, n, r);
310
327
  } : (e, t, n, r) => {
311
- e.setUint16(t, S(n), r);
312
- }, w = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8)), T = new Uint8Array(w.buffer), Oe = new TextEncoder(), ke = typeof Oe.encodeInto == "function";
313
- function Ae(e) {
328
+ e.setUint16(t, T(n), r);
329
+ }, Te = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8)), D = new Uint8Array(Te.buffer), Ee = new TextEncoder(), De = typeof Ee.encodeInto == "function";
330
+ function Oe(e) {
314
331
  return e <= 23 ? 1 : e <= 255 ? 2 : e <= 65535 ? 3 : e <= 4294967295 ? 5 : 9;
315
332
  }
316
- function je(e) {
333
+ function ke(e) {
317
334
  return e === "i" ? 1 : [
318
335
  2,
319
336
  3,
@@ -321,7 +338,7 @@ function je(e) {
321
338
  9
322
339
  ][e];
323
340
  }
324
- var Me = class {
341
+ var Ae = class {
325
342
  buf;
326
343
  len = 0;
327
344
  constructor(e = 256) {
@@ -352,45 +369,45 @@ var Me = class {
352
369
  t[this.len++] = e >>> 24 & 255, t[this.len++] = e >>> 16 & 255, t[this.len++] = e >>> 8 & 255, t[this.len++] = e & 255;
353
370
  }
354
371
  writeBigUint64(e) {
355
- w.setBigUint64(0, e, !1), this._ensure(8), this.buf.set(T, this.len), this.len += 8;
372
+ Te.setBigUint64(0, e, !1), this._ensure(8), this.buf.set(D, this.len), this.len += 8;
356
373
  }
357
374
  writeFloat16(e) {
358
- De(w, 0, e, !1), this._ensure(2);
375
+ we(Te, 0, e, !1), this._ensure(2);
359
376
  let t = this.buf;
360
- t[this.len++] = T[0], t[this.len++] = T[1];
377
+ t[this.len++] = D[0], t[this.len++] = D[1];
361
378
  }
362
379
  writeFloat32(e) {
363
- w.setFloat32(0, e, !1), this._ensure(4);
380
+ Te.setFloat32(0, e, !1), this._ensure(4);
364
381
  let t = this.buf;
365
- t[this.len++] = T[0], t[this.len++] = T[1], t[this.len++] = T[2], t[this.len++] = T[3];
382
+ t[this.len++] = D[0], t[this.len++] = D[1], t[this.len++] = D[2], t[this.len++] = D[3];
366
383
  }
367
384
  writeFloat64(e) {
368
- w.setFloat64(0, e, !1), this._ensure(8), this.buf.set(T, this.len), this.len += 8;
385
+ Te.setFloat64(0, e, !1), this._ensure(8), this.buf.set(D, this.len), this.len += 8;
369
386
  }
370
387
  writeTextString(e, t, n) {
371
- if (!ke) {
372
- let r = Oe.encode(t);
373
- E(this, e, r.length, n), this.writeBytes(r);
388
+ if (!De) {
389
+ let r = Ee.encode(t);
390
+ O(this, e, r.length, n), this.writeBytes(r);
374
391
  return;
375
392
  }
376
- let r = n === void 0 ? Ae(t.length) : je(n);
393
+ let r = n === void 0 ? Oe(t.length) : ke(n);
377
394
  this._ensure(9 + 3 * t.length);
378
- let { written: i } = Oe.encodeInto(t, this.buf.subarray(this.len + r)), a = n === void 0 ? Ae(i) : r;
379
- a !== r && this.buf.copyWithin(this.len + a, this.len + r, this.len + r + i), E(this, e, i, n), this.len += i;
395
+ let { written: i } = Ee.encodeInto(t, this.buf.subarray(this.len + r)), a = n === void 0 ? Oe(i) : r;
396
+ a !== r && this.buf.copyWithin(this.len + a, this.len + r, this.len + r + i), O(this, e, i, n), this.len += i;
380
397
  }
381
398
  finish() {
382
399
  return this.buf.slice(0, this.len);
383
400
  }
384
- }, Ne = [
401
+ }, je = [
385
402
  255n,
386
403
  65535n,
387
404
  4294967295n,
388
405
  18446744073709551615n
389
406
  ];
390
- function Pe(e) {
391
- return e === "i" ? 23n : Ne[e];
407
+ function Me(e) {
408
+ return e === "i" ? 23n : je[e];
392
409
  }
393
- function E(e, t, n, r) {
410
+ function O(e, t, n, r) {
394
411
  if (r === void 0 && typeof n == "number" && n < 4294967296) {
395
412
  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));
396
413
  return;
@@ -402,40 +419,43 @@ function E(e, t, n, r) {
402
419
  e.writeByte(t << 5 | Number(i));
403
420
  return;
404
421
  }
405
- if (i > Ne[r]) throw RangeError(`value ${i} does not fit in encodingWidth _${r} (max ${Ne[r]})`);
422
+ if (i > je[r]) throw RangeError(`value ${i} does not fit in encodingWidth _${r} (max ${je[r]})`);
406
423
  let n = 24 + r;
407
424
  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);
408
425
  return;
409
426
  }
410
427
  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));
411
428
  }
412
- function Fe(e, t, n) {
413
- let r = new Me(9);
414
- return E(r, e, t, n), r.finish();
429
+ function Ne(e, t, n) {
430
+ let r = new Ae(9);
431
+ return O(r, e, t, n), r.finish();
415
432
  }
416
- var Ie = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4));
417
- function Le(e) {
418
- return Object.is(C(S(e)), e);
433
+ var Pe = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4));
434
+ function Fe(e) {
435
+ return Object.is(E(T(e)), e);
419
436
  }
420
- function Re(e) {
421
- return Ie.setFloat32(0, e, !1), Object.is(Ie.getFloat32(0, !1), e);
437
+ function Ie(e) {
438
+ return Pe.setFloat32(0, e, !1), Object.is(Pe.getFloat32(0, !1), e);
422
439
  }
423
- function ze(e) {
424
- return Le(e) ? "half" : Re(e) ? "single" : "double";
440
+ function Le(e) {
441
+ return Fe(e) ? "half" : Ie(e) ? "single" : "double";
425
442
  }
426
443
  //#endregion
427
444
  //#region src/ast/CborItem.ts
428
- var D = class e {
445
+ var k = class e {
429
446
  start;
430
447
  end;
431
448
  comments;
432
449
  warnings;
433
450
  _defaults;
451
+ get _containsCdnContainer() {
452
+ return !1;
453
+ }
434
454
  toCBOR(e) {
435
455
  let t = this._defaults ? {
436
456
  ...this._defaults,
437
457
  ...e
438
- } : e, n = new Me();
458
+ } : e, n = new Ae();
439
459
  return this._encode(n, t), n.finish();
440
460
  }
441
461
  toCDN(e) {
@@ -444,7 +464,7 @@ var D = class e {
444
464
  ...e
445
465
  } : e, n = this._toCDN(t, 0), r = t?.preserveComments;
446
466
  if (!r) return n;
447
- let i = typeof r == "string" ? r : void 0, a = this.comments?.leading?.map((e) => v(e, i)) ?? [], o = this.comments?.trailing ?? [], s = o.length === 0 ? n : `${n} ${o.map((e) => v(e, i).trimEnd()).join(" ")}`;
467
+ let i = typeof r == "string" ? r : void 0, a = this.comments?.leading?.map((e) => b(e, i)) ?? [], o = this.comments?.trailing ?? [], s = o.length === 0 ? n : `${n} ${o.map((e) => b(e, i).trimEnd()).join(" ")}`;
448
468
  return [...a, s].join("\n");
449
469
  }
450
470
  toEDN(e) {
@@ -483,7 +503,7 @@ var D = class e {
483
503
  t.writeBytes(this._toCBOR(n));
484
504
  }
485
505
  _toCBOR(e) {
486
- let t = new Me();
506
+ let t = new Ae();
487
507
  return this._encodeTo(t, e), t.finish();
488
508
  }
489
509
  _toHexDump(e, n) {
@@ -493,7 +513,7 @@ var D = class e {
493
513
  comment: this._toCDN(n, 0)
494
514
  }];
495
515
  }
496
- }, O = class extends D {
516
+ }, A = class extends k {
497
517
  value;
498
518
  encodingWidth;
499
519
  constructor(e, t) {
@@ -502,10 +522,10 @@ var D = class e {
502
522
  this.encodingWidth = t?.encodingWidth;
503
523
  }
504
524
  _encodeTo(e, t) {
505
- E(e, 0, this.value, this.encodingWidth);
525
+ O(e, 0, this.value, this.encodingWidth);
506
526
  }
507
527
  _toCDN(e, t) {
508
- let n = x(e, this.encodingWidth, () => b(this.value)), r = this.value;
528
+ let n = w(e, this.encodingWidth, () => C(this.value)), r = this.value;
509
529
  switch (e?.intFormat) {
510
530
  case "hex": return `0x${r.toString(16)}${n}`;
511
531
  case "octal": return `0o${r.toString(8)}${n}`;
@@ -517,7 +537,7 @@ var D = class e {
517
537
  let t = e?.integerAs ?? "auto";
518
538
  return t === "bigint" ? this.value : t === "number" || this.value <= BigInt(2 ** 53 - 1) ? Number(this.value) : this.value;
519
539
  }
520
- }, k = class extends D {
540
+ }, j = class extends k {
521
541
  argument;
522
542
  encodingWidth;
523
543
  constructor(e, t) {
@@ -531,10 +551,10 @@ var D = class e {
531
551
  return -1n - this.argument;
532
552
  }
533
553
  _encodeTo(e, t) {
534
- E(e, 1, this.argument, this.encodingWidth);
554
+ O(e, 1, this.argument, this.encodingWidth);
535
555
  }
536
556
  _toCDN(e, t) {
537
- let n = x(e, this.encodingWidth, () => b(this.argument)), r = this.argument + 1n;
557
+ let n = w(e, this.encodingWidth, () => C(this.argument)), r = this.argument + 1n;
538
558
  switch (e?.intFormat) {
539
559
  case "hex": return `-0x${r.toString(16)}${n}`;
540
560
  case "octal": return `-0o${r.toString(8)}${n}`;
@@ -546,8 +566,8 @@ var D = class e {
546
566
  let t = this.value, n = e?.integerAs ?? "auto";
547
567
  return n === "bigint" ? t : n === "number" || t >= BigInt(-(2 ** 53 - 1)) ? Number(t) : t;
548
568
  }
549
- }, Be = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
550
- function Ve(e) {
569
+ }, Re = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
570
+ function ze(e) {
551
571
  let t = e.startsWith("-"), n = e.slice(t ? 3 : 2), r = n.search(/[pP]/);
552
572
  if (r === -1) throw SyntaxError(`EDN parse error: hex float missing 'p' exponent: ${e}`);
553
573
  let i = n.slice(0, r), a = n.slice(r + 1);
@@ -565,20 +585,20 @@ function Ve(e) {
565
585
  let l = c * 2 ** o;
566
586
  return t ? -l : l;
567
587
  }
568
- function He(e) {
588
+ function Be(e) {
569
589
  if (isNaN(e)) return "NaN";
570
590
  if (!isFinite(e)) return e > 0 ? "Infinity" : "-Infinity";
571
591
  let t = Object.is(e, -0) || e < 0, n = Math.abs(e);
572
592
  if (n === 0) return t ? "-0x0p+0" : "0x0p+0";
573
- Be.setFloat64(0, n, !1);
574
- let r = Be.getUint32(0, !1), i = Be.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;
593
+ Re.setFloat64(0, n, !1);
594
+ let r = Re.getUint32(0, !1), i = Re.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;
575
595
  a === 0 ? (u = "0", d = -1022) : (u = "1", d = a - 1023);
576
596
  let f = d >= 0 ? `+${d}` : `${d}`, p = `0x${u}${l}p${f}`;
577
597
  return t ? `-${p}` : p;
578
598
  }
579
599
  //#endregion
580
600
  //#region src/ast/CborFloat.ts
581
- var A = class extends D {
601
+ var M = class extends k {
582
602
  value;
583
603
  precision;
584
604
  ednSource;
@@ -587,7 +607,7 @@ var A = class extends D {
587
607
  super(), this.value = e, this.precision = t?.precision, this.rawBits = t?.rawBits;
588
608
  }
589
609
  _encodeTo(e, t) {
590
- let n = this.precision ?? ze(this.value), r = Number.isNaN(this.value) ? this.rawBits : void 0;
610
+ let n = this.precision ?? Le(this.value), r = Number.isNaN(this.value) ? this.rawBits : void 0;
591
611
  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));
592
612
  }
593
613
  _toCDN(e, t) {
@@ -596,18 +616,18 @@ var A = class extends D {
596
616
  if (n === "never") return this.ednSource.replace(/_[0-3i]$/, "");
597
617
  if (n === "always") {
598
618
  if (/_[0-3i]$/.test(this.ednSource)) return this.ednSource;
599
- let e = this.precision ?? ze(this.value), t = e === "half" ? "_1" : e === "single" ? "_2" : "_3";
619
+ let e = this.precision ?? Le(this.value), t = e === "half" ? "_1" : e === "single" ? "_2" : "_3";
600
620
  return this.ednSource + t;
601
621
  }
602
622
  return this.ednSource;
603
623
  }
604
- let r = ze(this.value);
605
- return (e?.floatFormat === "hex" ? He(this.value) : Ce(this.value)) + we(this.value, this.precision, r, n);
624
+ let r = Le(this.value);
625
+ return (e?.floatFormat === "hex" ? Be(this.value) : be(this.value)) + xe(this.value, this.precision, r, n);
606
626
  }
607
627
  _toJS(e) {
608
628
  return this.value;
609
629
  }
610
- }, j = class extends D {
630
+ }, N = class extends k {
611
631
  tag;
612
632
  content;
613
633
  encodingWidth;
@@ -615,17 +635,20 @@ var A = class extends D {
615
635
  if (super(), this.tag = BigInt(e), this.tag < 0n) throw RangeError("CborTag tag number must be non-negative");
616
636
  this.content = t, this.encodingWidth = n?.encodingWidth;
617
637
  }
638
+ get _containsCdnContainer() {
639
+ return this.content._containsCdnContainer;
640
+ }
618
641
  _encodeTo(e, t) {
619
- E(e, 6, this.tag, this.encodingWidth), this.content._encode(e, t);
642
+ O(e, 6, this.tag, this.encodingWidth), this.content._encode(e, t);
620
643
  }
621
644
  _toCDN(e, t) {
622
- let n = x(e, this.encodingWidth, () => b(this.tag));
645
+ let n = w(e, this.encodingWidth, () => C(this.tag));
623
646
  return `${this.tag}${n}(${this.content._toCDN(e, t)})`;
624
647
  }
625
648
  _toHexDump(e, n) {
626
649
  let r = [{
627
650
  depth: e,
628
- hex: t(Fe(6, this.tag, this.encodingWidth)),
651
+ hex: t(Ne(6, this.tag, this.encodingWidth)),
629
652
  comment: `Tag ${this.tag}`
630
653
  }];
631
654
  return r.push(...this.content._toHexDump(e + 1, {
@@ -637,7 +660,7 @@ var A = class extends D {
637
660
  let t = this.content._toJS(e);
638
661
  return e?.stripTags ? t : m.set(t, this.tag);
639
662
  }
640
- }, M = class extends D {
663
+ }, P = class extends k {
641
664
  indefiniteLength = !1;
642
665
  value;
643
666
  ednEncoding;
@@ -648,27 +671,27 @@ var A = class extends D {
648
671
  super(), this.value = e, this.ednEncoding = t?.ednEncoding ?? "hex", this.encodingWidth = t?.encodingWidth, this.ednSource = t?.ednSource, this.ednParts = t?.ednParts;
649
672
  }
650
673
  _encodeTo(e, t) {
651
- E(e, 2, this.value.length, this.encodingWidth), e.writeBytes(this.value);
674
+ O(e, 2, this.value.length, this.encodingWidth), e.writeBytes(this.value);
652
675
  }
653
676
  _toCDN(e, t) {
654
677
  if (e?.preserveConcatenation && this.ednParts !== void 0 && this.ednParts.length > 1) {
655
- let n = x(e, this.encodingWidth, () => b(BigInt(this.value.length))), r = e?.bstrEncoding ?? this.ednEncoding;
678
+ let n = w(e, this.encodingWidth, () => C(BigInt(this.value.length))), r = e?.bstrEncoding ?? this.ednEncoding;
656
679
  e?.appStrings === !1 && r !== "hex" && (r = "hex");
657
- let i = this.ednParts.map((t) => e?.preserveByteString && t.source !== void 0 ? t.source : he(t.bytes, r, e?.sqstr));
658
- return i[i.length - 1] += n, te(i, ee(e), t);
680
+ let i = this.ednParts.map((t) => e?.preserveByteString && t.source !== void 0 ? t.source : fe(t.bytes, r, e?.sqstr));
681
+ return i[i.length - 1] += n, ee(i, _(e), t);
659
682
  }
660
683
  if (e?.preserveByteString && this.ednSource !== void 0) {
661
684
  if (/_[0-3i]$/.test(this.ednSource)) return (e?.encodingIndicators ?? "auto") === "never" ? this.ednSource.replace(/_[0-3i]$/, "") : this.ednSource;
662
- let t = x(e, this.encodingWidth, () => b(BigInt(this.value.length)));
685
+ let t = w(e, this.encodingWidth, () => C(BigInt(this.value.length)));
663
686
  return this.ednSource + t;
664
687
  }
665
- let n = x(e, this.encodingWidth, () => b(BigInt(this.value.length))), r = e?.bstrEncoding ?? this.ednEncoding;
666
- return e?.appStrings === !1 && r !== "hex" && (r = "hex"), he(this.value, r, e?.sqstr) + n;
688
+ let n = w(e, this.encodingWidth, () => C(BigInt(this.value.length))), r = e?.bstrEncoding ?? this.ednEncoding;
689
+ return e?.appStrings === !1 && r !== "hex" && (r = "hex"), fe(this.value, r, e?.sqstr) + n;
667
690
  }
668
691
  _toJS(e) {
669
692
  return this.value;
670
693
  }
671
- }, N = class extends D {
694
+ }, F = class extends k {
672
695
  indefiniteLength = !0;
673
696
  chunks;
674
697
  constructor(e) {
@@ -681,11 +704,24 @@ var A = class extends D {
681
704
  }
682
705
  _toCDN(e, t) {
683
706
  if ((e?.encodingIndicators ?? "auto") === "never") {
684
- let t = this.chunks.reduce((e, t) => e + t.value.length, 0), n = new Uint8Array(t), r = 0;
685
- for (let e of this.chunks) n.set(e.value, r), r += e.value.length;
686
- return new M(n)._toCDN(e, 0);
707
+ let n = this.chunks.reduce((e, t) => e + t.value.length, 0), r = new Uint8Array(n), i = 0;
708
+ for (let e of this.chunks) r.set(e.value, i), i += e.value.length;
709
+ return new P(r)._toCDN(e, t);
687
710
  }
688
- return this.chunks.length === 0 ? "''_" : `(_ ${this.chunks.map((t) => t._toCDN(e, 0)).join(", ")})`;
711
+ return this.chunks.length === 0 ? "''_" : x({
712
+ node: this,
713
+ options: e,
714
+ depth: t,
715
+ openChar: "(",
716
+ closeChar: ")",
717
+ count: this.chunks.length,
718
+ indefiniteLength: !0,
719
+ encodingWidth: void 0,
720
+ hasEntryComments: () => this.chunks.some(y),
721
+ renderEntry: (n) => this.chunks[n]._toCDN(e, t + 1),
722
+ entryLeadingNode: (e) => this.chunks[e],
723
+ entryTrailing: (e, t) => re(this.chunks[e], t)
724
+ });
689
725
  }
690
726
  _toHexDump(e, t) {
691
727
  let r = [{
@@ -705,7 +741,7 @@ var A = class extends D {
705
741
  for (let e of this.chunks) n.set(e.value, r), r += e.value.length;
706
742
  return n;
707
743
  }
708
- }, P = class extends D {
744
+ }, I = class extends k {
709
745
  indefiniteLength = !0;
710
746
  chunks;
711
747
  constructor(e) {
@@ -717,7 +753,20 @@ var A = class extends D {
717
753
  e.writeByte(255);
718
754
  }
719
755
  _toCDN(e, t) {
720
- return (e?.encodingIndicators ?? "auto") === "never" ? new B(this.chunks.map((e) => e.value).join(""))._toCDN(e, t) : this.chunks.length === 0 ? "\"\"_" : `(_ ${this.chunks.map((t) => t._toCDN(e, 0)).join(", ")})`;
756
+ return (e?.encodingIndicators ?? "auto") === "never" ? new H(this.chunks.map((e) => e.value).join(""))._toCDN(e, t) : this.chunks.length === 0 ? "\"\"_" : x({
757
+ node: this,
758
+ options: e,
759
+ depth: t,
760
+ openChar: "(",
761
+ closeChar: ")",
762
+ count: this.chunks.length,
763
+ indefiniteLength: !0,
764
+ encodingWidth: void 0,
765
+ hasEntryComments: () => this.chunks.some(y),
766
+ renderEntry: (n) => this.chunks[n]._toCDN(e, t + 1),
767
+ entryLeadingNode: (e) => this.chunks[e],
768
+ entryTrailing: (e, t) => re(this.chunks[e], t)
769
+ });
721
770
  }
722
771
  _toHexDump(e, t) {
723
772
  let r = [{
@@ -735,13 +784,16 @@ var A = class extends D {
735
784
  _toJS(e) {
736
785
  return this.chunks.map((e) => e.value).join("");
737
786
  }
738
- }, F = class extends D {
787
+ }, L = class extends k {
739
788
  items;
740
789
  indefiniteLength;
741
790
  encodingWidth;
742
791
  constructor(e, t) {
743
792
  super(), this.items = e, this.indefiniteLength = t?.indefiniteLength ?? !1, this.encodingWidth = t?.encodingWidth;
744
793
  }
794
+ get _containsCdnContainer() {
795
+ return !0;
796
+ }
745
797
  _encodeTo(e, t) {
746
798
  if (this.indefiniteLength) {
747
799
  e.writeByte(159);
@@ -749,11 +801,11 @@ var A = class extends D {
749
801
  e.writeByte(255);
750
802
  return;
751
803
  }
752
- E(e, 4, this.items.length, this.encodingWidth);
804
+ O(e, 4, this.items.length, this.encodingWidth);
753
805
  for (let n of this.items) n._encode(e, t);
754
806
  }
755
807
  _toCDN(e, t) {
756
- return se({
808
+ return x({
757
809
  node: this,
758
810
  options: e,
759
811
  depth: t,
@@ -762,10 +814,11 @@ var A = class extends D {
762
814
  count: this.items.length,
763
815
  indefiniteLength: this.indefiniteLength,
764
816
  encodingWidth: this.encodingWidth,
765
- hasEntryComments: () => this.items.some(ne),
817
+ hasEntryComments: () => this.items.some(y),
766
818
  renderEntry: (n) => this.items[n]._toCDN(e, t + 1),
819
+ entryIsLeaf: (e) => !this.items[e]._containsCdnContainer,
767
820
  entryLeadingNode: (e) => this.items[e],
768
- entryTrailing: (e, t) => y(this.items[e], t)
821
+ entryTrailing: (e, t) => re(this.items[e], t)
769
822
  });
770
823
  }
771
824
  _toHexDump(e, r) {
@@ -784,7 +837,7 @@ var A = class extends D {
784
837
  }
785
838
  let i = [{
786
839
  depth: e,
787
- hex: t(Fe(4, BigInt(this.items.length), this.encodingWidth)),
840
+ hex: t(Ne(4, BigInt(this.items.length), this.encodingWidth)),
788
841
  comment: `Array of length ${this.items.length}`
789
842
  }];
790
843
  for (let t of this.items) i.push(...t._toHexDump(e + 1, r));
@@ -803,13 +856,16 @@ var A = class extends D {
803
856
  }
804
857
  return r;
805
858
  }
806
- }, I = class extends D {
859
+ }, R = class extends k {
807
860
  entries;
808
861
  indefiniteLength;
809
862
  encodingWidth;
810
863
  constructor(e, t) {
811
864
  super(), this.entries = e, this.indefiniteLength = t?.indefiniteLength ?? !1, this.encodingWidth = t?.encodingWidth;
812
865
  }
866
+ get _containsCdnContainer() {
867
+ return !0;
868
+ }
813
869
  _encodeTo(e, t) {
814
870
  if (this.indefiniteLength) {
815
871
  e.writeByte(191);
@@ -817,11 +873,11 @@ var A = class extends D {
817
873
  e.writeByte(255);
818
874
  return;
819
875
  }
820
- E(e, 5, this.entries.length, this.encodingWidth);
876
+ O(e, 5, this.entries.length, this.encodingWidth);
821
877
  for (let [n, r] of this.entries) n._encode(e, t), r._encode(e, t);
822
878
  }
823
879
  _toCDN(e, t) {
824
- return se({
880
+ return x({
825
881
  node: this,
826
882
  options: e,
827
883
  depth: t,
@@ -830,15 +886,19 @@ var A = class extends D {
830
886
  count: this.entries.length,
831
887
  indefiniteLength: this.indefiniteLength,
832
888
  encodingWidth: this.encodingWidth,
833
- hasEntryComments: () => this.entries.some(([e, t]) => ne(e) || ne(t)),
889
+ hasEntryComments: () => this.entries.some(([e, t]) => y(e) || y(t)),
834
890
  renderEntry: (n, r) => {
835
891
  let [i, a] = this.entries[n];
836
892
  return `${i._toCDN(e, t + 1)}${r}${a._toCDN(e, t + 1)}`;
837
893
  },
894
+ entryIsLeaf: (e) => {
895
+ let [t, n] = this.entries[e];
896
+ return !t._containsCdnContainer && !n._containsCdnContainer;
897
+ },
838
898
  entryLeadingNode: (e) => this.entries[e][0],
839
899
  entryTrailing: (e, t) => {
840
900
  let [n, r] = this.entries[e];
841
- return Ue([
901
+ return Ve([
842
902
  ...n.comments?.trailing ?? [],
843
903
  ...r.comments?.leading ?? [],
844
904
  ...r.comments?.trailing ?? []
@@ -862,7 +922,7 @@ var A = class extends D {
862
922
  }
863
923
  let i = [{
864
924
  depth: e,
865
- hex: t(Fe(5, BigInt(this.entries.length), this.encodingWidth)),
925
+ hex: t(Ne(5, BigInt(this.entries.length), this.encodingWidth)),
866
926
  comment: `Map of length ${this.entries.length}`
867
927
  }];
868
928
  for (let [t, n] of this.entries) i.push(...t._toHexDump(e + 1, r)), i.push(...n._toHexDump(e + 1, r));
@@ -879,13 +939,13 @@ var A = class extends D {
879
939
  }
880
940
  return n;
881
941
  };
882
- return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof B) ? (() => {
942
+ return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof H) ? (() => {
883
943
  let n = e ? {
884
944
  ...e,
885
945
  reviver: void 0
886
946
  } : void 0, r = {};
887
947
  for (let [e, t] of this.entries) {
888
- let i = e instanceof B ? e.value : e.toCDN(), a = t._toJS(n);
948
+ let i = e instanceof H ? e.value : e.toCDN(), a = t._toJS(n);
889
949
  i === "__proto__" ? Object.defineProperty(r, i, {
890
950
  value: a,
891
951
  writable: !0,
@@ -897,10 +957,10 @@ var A = class extends D {
897
957
  let i = /* @__PURE__ */ new Map();
898
958
  for (let e = 0; e < this.entries.length; e++) {
899
959
  let [t] = this.entries[e];
900
- i.set(t instanceof B ? t.value : t.toCDN(), e);
960
+ i.set(t instanceof H ? t.value : t.toCDN(), e);
901
961
  }
902
962
  for (let n = 0; n < this.entries.length; n++) {
903
- let [a, o] = this.entries[n], s = a instanceof B ? a.value : a.toCDN();
963
+ let [a, o] = this.entries[n], s = a instanceof H ? a.value : a.toCDN();
904
964
  if (i.get(s) !== n) continue;
905
965
  let c = o._toJS(e), l = t.call(r, s, c);
906
966
  l === h || e?.undefinedOmits && l === void 0 ? delete r[s] : s === "__proto__" ? Object.defineProperty(r, s, {
@@ -914,12 +974,12 @@ var A = class extends D {
914
974
  })() : n();
915
975
  }
916
976
  };
917
- function Ue(e, t) {
918
- return e.length === 0 ? "" : " " + e.map((e) => v(e, t).trimEnd()).join(" ");
977
+ function Ve(e, t) {
978
+ return e.length === 0 ? "" : " " + e.map((e) => b(e, t).trimEnd()).join(" ");
919
979
  }
920
980
  //#endregion
921
981
  //#region src/ast/CborSimple.ts
922
- var L = class e extends D {
982
+ var z = class e extends k {
923
983
  value;
924
984
  constructor(e) {
925
985
  if (super(), !Number.isInteger(e) || e < 0 || e > 255) throw RangeError("CborSimple value must be an integer in 0–255");
@@ -954,33 +1014,36 @@ var L = class e extends D {
954
1014
  default: return new g(this.value);
955
1015
  }
956
1016
  }
957
- }, We = class extends D {
1017
+ }, He = class extends k {
958
1018
  items;
959
1019
  encodingWidth;
960
1020
  constructor(e, t) {
961
1021
  super(), this.items = e, this.encodingWidth = t?.encodingWidth;
962
1022
  }
1023
+ get _containsCdnContainer() {
1024
+ return this.items.some((e) => e._containsCdnContainer);
1025
+ }
963
1026
  _content(e) {
964
- let t = new Me();
1027
+ let t = new Ae();
965
1028
  for (let n of this.items) n._encode(t, e);
966
1029
  return t.finish();
967
1030
  }
968
1031
  _encodeTo(e, t) {
969
1032
  let n = this._content(t);
970
- E(e, 2, n.length, this.encodingWidth), e.writeBytes(n);
1033
+ O(e, 2, n.length, this.encodingWidth), e.writeBytes(n);
971
1034
  }
972
1035
  _toCDN(e, t) {
973
- let n = x(e, this.encodingWidth, () => b(BigInt(this._content(e).length)));
1036
+ let n = w(e, this.encodingWidth, () => C(BigInt(this._content(e).length)));
974
1037
  if (this.items.length === 0) return `<<>>${n}`;
975
- let r = ee(e), { inlineSep: i, multilineSep: a, trailSep: o } = oe(e, r === null);
1038
+ let r = _(e), { inlineSep: i, multilineSep: a, trailSep: o } = ae(e, r === null);
976
1039
  if (r === null) return `<<${this.items.map((n) => n._toCDN(e, t + 1)).join(i)}>>${n}`;
977
- let s = _(r, t + 1), c = _(r, t), l = this.items.map((n) => `${s}${n._toCDN(e, t + 1)}`), u = l.length - 1;
1040
+ let s = v(r, t + 1), c = v(r, t), l = this.items.map((n) => `${s}${n._toCDN(e, t + 1)}`), u = l.length - 1;
978
1041
  return `<<\n${l.map((e, t) => t < u ? `${e}${a}` : `${e}${o}`).join("\n")}\n${c}>>${n}`;
979
1042
  }
980
1043
  _toHexDump(e, n) {
981
1044
  let r = this._content().length, i = [{
982
1045
  depth: e,
983
- hex: t(Fe(2, BigInt(r), this.encodingWidth)),
1046
+ hex: t(Ne(2, BigInt(r), this.encodingWidth)),
984
1047
  comment: `Embedded CBOR sequence, ${r} byte${r === 1 ? "" : "s"}`
985
1048
  }];
986
1049
  for (let t of this.items) i.push(...t._toHexDump(e + 1, n));
@@ -989,22 +1052,25 @@ var L = class e extends D {
989
1052
  _toJS(e) {
990
1053
  return this._content();
991
1054
  }
992
- }, Ge = 999n, Ke = class extends j {
1055
+ }, Ue = 999n, We = class extends N {
993
1056
  constructor(e, t) {
994
- let n = t.length === 1 && t[0] instanceof B ? t[0] : new F(t);
995
- super(Ge, new F([new B(e), n]));
1057
+ let n = t.length === 1 && t[0] instanceof H ? t[0] : new L(t);
1058
+ super(Ue, new L([new H(e), n]));
996
1059
  }
997
1060
  _toCDN(e, t) {
998
1061
  if (e?.appStrings === !1) return super._toCDN(e, t);
999
1062
  let n = this.content, r = n.items[0].value, i = n.items[1];
1000
- return i instanceof B ? `${r}${xe(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
1063
+ return i instanceof H ? `${r}${ve(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
1001
1064
  }
1002
- }, qe = class extends D {
1065
+ }, Ge = class extends k {
1003
1066
  inner;
1004
1067
  ednSource;
1005
1068
  constructor(e, t) {
1006
1069
  super(), this.inner = e, this.ednSource = t;
1007
1070
  }
1071
+ get _containsCdnContainer() {
1072
+ return this.inner._containsCdnContainer;
1073
+ }
1008
1074
  _encodeTo(e, t) {
1009
1075
  this.inner._encode(e, t);
1010
1076
  }
@@ -1015,15 +1081,21 @@ var L = class e extends D {
1015
1081
  _toJS(e) {
1016
1082
  return this.inner._toJS(e);
1017
1083
  }
1018
- }, Je = 888n, R = class extends j {
1084
+ }, Ke = 888n, B = class extends N {
1019
1085
  constructor(e) {
1020
- e === void 0 ? super(Je, L.NULL) : super(Je, new F(e));
1086
+ e === void 0 ? super(Ke, z.NULL) : super(Ke, new L(e));
1021
1087
  }
1022
1088
  _toCDN(e, t) {
1023
- return e?.appStrings === !1 ? super._toCDN(e, t) : this.content instanceof L ? "..." : this.content instanceof F ? this.content.items.map((n) => n._toCDN(e, t)).join(" + ") : super._toCDN(e, t);
1089
+ if (e?.appStrings === !1) return super._toCDN(e, t);
1090
+ if (this.content instanceof z) return "...";
1091
+ if (this.content instanceof L) {
1092
+ let n = this.content.items.map((n) => n._toCDN(e, t));
1093
+ return n.length === 0 ? "" : ee(n, _(e), t);
1094
+ }
1095
+ return super._toCDN(e, t);
1024
1096
  }
1025
- }, Ye = 2n, Xe = 3n, Ze = 18446744073709551615n, Qe = -18446744073709551616n;
1026
- function $e(e) {
1097
+ }, qe = 2n, Je = 3n, Ye = 18446744073709551615n, Xe = -18446744073709551616n;
1098
+ function Ze(e) {
1027
1099
  if (e < 0n) throw RangeError("bigintToBytes requires a non-negative value");
1028
1100
  if (e === 0n) return /* @__PURE__ */ new Uint8Array();
1029
1101
  let t = e.toString(16);
@@ -1032,16 +1104,16 @@ function $e(e) {
1032
1104
  for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
1033
1105
  return n;
1034
1106
  }
1035
- function et(e) {
1107
+ function Qe(e) {
1036
1108
  let t = 0n;
1037
1109
  for (let n of e) t = t << 8n | BigInt(n);
1038
1110
  return t;
1039
1111
  }
1040
- var tt = class extends j {
1112
+ var $e = class extends N {
1041
1113
  bigValue;
1042
1114
  constructor(e) {
1043
- if (e <= Ze) throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);
1044
- super(Ye, new M($e(e))), this.bigValue = e;
1115
+ if (e <= Ye) throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);
1116
+ super(qe, new P(Ze(e))), this.bigValue = e;
1045
1117
  }
1046
1118
  _toCDN(e, t) {
1047
1119
  return this.bigValue.toString();
@@ -1049,11 +1121,11 @@ var tt = class extends j {
1049
1121
  _toJS(e) {
1050
1122
  return this.bigValue;
1051
1123
  }
1052
- }, nt = class extends j {
1124
+ }, et = class extends N {
1053
1125
  bigValue;
1054
1126
  constructor(e) {
1055
- if (e >= Qe) throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);
1056
- super(Xe, new M($e(-1n - e))), this.bigValue = e;
1127
+ if (e >= Xe) throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);
1128
+ super(Je, new P(Ze(-1n - e))), this.bigValue = e;
1057
1129
  }
1058
1130
  _toCDN(e, t) {
1059
1131
  return this.bigValue.toString();
@@ -1061,25 +1133,25 @@ var tt = class extends j {
1061
1133
  _toJS(e) {
1062
1134
  return this.bigValue;
1063
1135
  }
1064
- }, rt = new TextEncoder(), it = new TextDecoder("utf-8", { fatal: !0 }), at = new TextDecoder("utf-8", { fatal: !1 });
1065
- function ot(e, t) {
1136
+ }, tt = new TextEncoder(), nt = new TextDecoder("utf-8", { fatal: !0 }), rt = new TextDecoder("utf-8", { fatal: !1 });
1137
+ function it(e, t) {
1066
1138
  let n = new a(e, {
1067
1139
  offset: t?.offset,
1068
1140
  skipRS: t?._skipRS
1069
- }), r = new vt(n, t ?? {}).parse();
1070
- return t?.preserveComments && dt(r, n.comments, e), r;
1141
+ }), r = new gt(n, t ?? {}).parse();
1142
+ return t?.preserveComments && lt(r, n.comments, e), r;
1071
1143
  }
1072
- function st(e) {
1144
+ function at(e) {
1073
1145
  let t = e, n;
1074
1146
  return /[_][0-7i]$/.test(e) && (n = e[e.length - 1], t = e.slice(0, -2)), {
1075
1147
  numStr: t,
1076
1148
  rawSuffix: n
1077
1149
  };
1078
1150
  }
1079
- function ct(e) {
1151
+ function ot(e) {
1080
1152
  return e.startsWith("-") ? -BigInt(e.slice(1)) : BigInt(e);
1081
1153
  }
1082
- function lt(e, t) {
1154
+ function st(e, t) {
1083
1155
  if (e.endsWith("_i") || e.endsWith("_0")) {
1084
1156
  let n = "_0 and _i encoding indicators are not valid for floating-point values";
1085
1157
  if (t) t(n), e = e.slice(0, -2);
@@ -1103,14 +1175,14 @@ function lt(e, t) {
1103
1175
  };
1104
1176
  let n = e, r;
1105
1177
  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) ? {
1106
- value: Ve(n),
1178
+ value: ze(n),
1107
1179
  precision: r
1108
1180
  } : {
1109
1181
  value: parseFloat(n),
1110
1182
  precision: r
1111
1183
  };
1112
1184
  }
1113
- function ut(e, t) {
1185
+ function ct(e, t) {
1114
1186
  let n = e.indexOf("="), r = n >= 0 ? e.slice(0, n) : e, i = n >= 0 ? e.slice(n) : "";
1115
1187
  if (/[^A-Za-z0-9+/\-_]/.test(r)) {
1116
1188
  let e = [...r].find((e) => !/[A-Za-z0-9+/\-_]/.test(e)) ?? "";
@@ -1147,9 +1219,9 @@ function ut(e, t) {
1147
1219
  for (let e = 0; e < c.length; e++) l[e] = c.charCodeAt(e);
1148
1220
  return l;
1149
1221
  }
1150
- function dt(e, t, n) {
1222
+ function lt(e, t, n) {
1151
1223
  if (t.length === 0) return;
1152
- let r = ft(e), i = mt(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;
1224
+ let r = ut(e), i = ft(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;
1153
1225
  for (let t of s) {
1154
1226
  let r = { ...t }, s = 0, u = o.length;
1155
1227
  for (; s < u;) {
@@ -1158,7 +1230,7 @@ function dt(e, t, n) {
1158
1230
  }
1159
1231
  let d = s > 0 ? o[s - 1] : void 0, f = d ? n.slice(d.end, t.start) : "";
1160
1232
  if (d && i(d.end) === t.line && !f.includes(":")) {
1161
- pt(d.node, "trailing", r);
1233
+ dt(d.node, "trailing", r);
1162
1234
  continue;
1163
1235
  }
1164
1236
  for (; l < a.length && a[l].start < t.start;) {
@@ -1174,38 +1246,38 @@ function dt(e, t, n) {
1174
1246
  }
1175
1247
  let m = s < a.length ? a[s] : void 0;
1176
1248
  if ((!p || m && m.end <= p.end) && m) {
1177
- pt(m.node, "leading", r);
1249
+ dt(m.node, "leading", r);
1178
1250
  continue;
1179
1251
  }
1180
- pt(p?.node ?? e, "dangling", r);
1252
+ dt(p?.node ?? e, "dangling", r);
1181
1253
  }
1182
1254
  }
1183
- function ft(e) {
1255
+ function ut(e) {
1184
1256
  let t = [], n = (e) => {
1185
1257
  if (e.start !== void 0 && e.end !== void 0 && t.push({
1186
1258
  node: e,
1187
1259
  start: e.start,
1188
1260
  end: e.end
1189
- }), e instanceof F || e instanceof We) {
1261
+ }), e instanceof L || e instanceof He) {
1190
1262
  for (let t of e.items) n(t);
1191
1263
  return;
1192
1264
  }
1193
- if (e instanceof I) {
1265
+ if (e instanceof R) {
1194
1266
  for (let [t, r] of e.entries) n(t), n(r);
1195
1267
  return;
1196
1268
  }
1197
- if (e instanceof N || e instanceof P) {
1269
+ if (e instanceof F || e instanceof I) {
1198
1270
  for (let t of e.chunks) n(t);
1199
1271
  return;
1200
1272
  }
1201
- e instanceof j && n(e.content);
1273
+ e instanceof N && n(e.content);
1202
1274
  };
1203
1275
  return n(e), t;
1204
1276
  }
1205
- function pt(e, t, n) {
1277
+ function dt(e, t, n) {
1206
1278
  e.comments ??= {}, e.comments[t] ??= [], e.comments[t].push(n);
1207
1279
  }
1208
- function mt(e) {
1280
+ function ft(e) {
1209
1281
  let t = [0];
1210
1282
  for (let n = 0; n < e.length; n++) e[n] === "\n" && t.push(n + 1);
1211
1283
  return (n) => {
@@ -1219,25 +1291,25 @@ function mt(e) {
1219
1291
  return a + 1;
1220
1292
  };
1221
1293
  }
1222
- var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, gt = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, z = (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)`, _t = /* @__PURE__ */ new Map([
1223
- ["b32", ht("b32")],
1224
- ["h32", ht("h32")],
1225
- ["same", ht("same")],
1226
- ["hash", gt("hash", "@cbortech/hash-extension")],
1227
- ["uuid", gt("uuid", "@cbortech/uuid-extension")],
1228
- ["UUID", gt("uuid", "@cbortech/uuid-extension")],
1229
- ["dt", z("dt")],
1230
- ["DT", z("dt")],
1231
- ["ip", z("ip")],
1232
- ["IP", z("ip")],
1233
- ["cri", z("cri")],
1234
- ["CRI", z("cri")],
1235
- ["t1", z("t1")],
1236
- ["b1", z("b1")],
1237
- ["ilbs", z("ilbs")],
1238
- ["ilts", z("ilts")],
1239
- ["float", z("float")]
1240
- ]), vt = class {
1294
+ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, mt = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, V = (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)`, ht = /* @__PURE__ */ new Map([
1295
+ ["b32", pt("b32")],
1296
+ ["h32", pt("h32")],
1297
+ ["same", pt("same")],
1298
+ ["hash", mt("hash", "@cbortech/hash-extension")],
1299
+ ["uuid", mt("uuid", "@cbortech/uuid-extension")],
1300
+ ["UUID", mt("uuid", "@cbortech/uuid-extension")],
1301
+ ["dt", V("dt")],
1302
+ ["DT", V("dt")],
1303
+ ["ip", V("ip")],
1304
+ ["IP", V("ip")],
1305
+ ["cri", V("cri")],
1306
+ ["CRI", V("cri")],
1307
+ ["t1", V("t1")],
1308
+ ["b1", V("b1")],
1309
+ ["ilbs", V("ilbs")],
1310
+ ["ilts", V("ilts")],
1311
+ ["float", V("float")]
1312
+ ]), gt = class {
1241
1313
  t;
1242
1314
  _options;
1243
1315
  extByPrefix;
@@ -1298,12 +1370,12 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1298
1370
  case "BYTES_HEX":
1299
1371
  case "SQSTR":
1300
1372
  case "BYTES_B64": return this.t.consume(), this._parseBytesConcat(this._decodeBytesToken(e), e.type, e.raw);
1301
- case "EMPTY_INDEF_BYTES": return this.t.consume(), new N([]);
1302
- case "EMPTY_INDEF_TEXT": return this.t.consume(), new P([]);
1303
- case "TRUE": return this.t.consume(), new L(21);
1304
- case "FALSE": return this.t.consume(), new L(20);
1305
- case "NULL": return this.t.consume(), new L(22);
1306
- case "UNDEFINED": return this.t.consume(), new L(23);
1373
+ case "EMPTY_INDEF_BYTES": return this.t.consume(), new F([]);
1374
+ case "EMPTY_INDEF_TEXT": return this.t.consume(), new I([]);
1375
+ case "TRUE": return this.t.consume(), new z(21);
1376
+ case "FALSE": return this.t.consume(), new z(20);
1377
+ case "NULL": return this.t.consume(), new z(22);
1378
+ case "UNDEFINED": return this.t.consume(), new z(23);
1307
1379
  case "SIMPLE": return this.parseSimple();
1308
1380
  case "LBRACKET": return this.parseArray();
1309
1381
  case "LBRACE": return this.parseMap();
@@ -1318,21 +1390,21 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1318
1390
  }
1319
1391
  let r = this.extByPrefix.get(e.appPrefix);
1320
1392
  if (!r?.parseAppString) {
1321
- if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new Ke(e.appPrefix, [new B(e.value)]);
1393
+ if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new We(e.appPrefix, [new H(e.value)]);
1322
1394
  this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
1323
1395
  }
1324
1396
  {
1325
1397
  let i = this._pendingWarnings.length;
1326
1398
  try {
1327
1399
  let i = r.parseAppString(e.appPrefix, e.value, this._extOnError(e), t === void 0 ? void 0 : { encodingWidth: t });
1328
- return t !== void 0 && this._applyEiToResult(i, t, e), i instanceof M && Object.getPrototypeOf(i) === M.prototype && i.ednSource === void 0 ? new M(i.value, {
1400
+ return t !== void 0 && this._applyEiToResult(i, t, e), i instanceof P && Object.getPrototypeOf(i) === P.prototype && i.ednSource === void 0 ? new P(i.value, {
1329
1401
  ednEncoding: i.ednEncoding,
1330
1402
  encodingWidth: i.encodingWidth,
1331
1403
  ednSource: e.raw + n
1332
- }) : (i instanceof A && i.ednSource === void 0 && (i.ednSource = e.raw + n), i);
1404
+ }) : (i instanceof M && i.ednSource === void 0 && (i.ednSource = e.raw + n), i);
1333
1405
  } catch (t) {
1334
1406
  if (this._options.strict !== !1) throw t;
1335
- return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new Ke(e.appPrefix, [new B(e.value)]);
1407
+ return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new We(e.appPrefix, [new H(e.value)]);
1336
1408
  }
1337
1409
  }
1338
1410
  }
@@ -1350,7 +1422,7 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1350
1422
  this.t.peek().type === "ENCODING_INDICATOR" && (r = this.t.consume(), n = this._resolveEncodingWidth(r.value, r));
1351
1423
  let i = this.extByPrefix.get(e.appPrefix);
1352
1424
  if (!i) {
1353
- if (this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new Ke(e.appPrefix, t);
1425
+ if (this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new We(e.appPrefix, t);
1354
1426
  this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
1355
1427
  }
1356
1428
  i.parseAppSequence || this._fail(`app-string extension ${JSON.stringify(e.appPrefix)} does not support <<...>> form`, e);
@@ -1360,78 +1432,98 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1360
1432
  let a = i.parseAppSequence(e.appPrefix, t, this._extOnError(e));
1361
1433
  n !== void 0 && this._applyEiToResult(a, n, r ?? e);
1362
1434
  let o = this.t.source.slice(e.offset, this.t.lastEndOffset);
1363
- if (a instanceof A) a.ednSource === void 0 && (a.ednSource = o);
1364
- else if (i.preserveAppSeqSource) return new qe(a, o);
1435
+ if (a instanceof M) a.ednSource === void 0 && (a.ednSource = o);
1436
+ else if (i.preserveAppSeqSource) return new Ge(a, o);
1365
1437
  return a;
1366
1438
  } catch (n) {
1367
1439
  if (this._options.strict !== !1) throw n;
1368
- return this._pendingWarnings.length === a && this._warn(n instanceof Error ? n.message : String(n), e), new Ke(e.appPrefix, t);
1440
+ return this._pendingWarnings.length === a && this._warn(n instanceof Error ? n.message : String(n), e), new We(e.appPrefix, t);
1369
1441
  }
1370
1442
  }
1371
1443
  }
1372
1444
  case "ELLIPSIS": {
1373
- if (this.t.consume(), this.t.peek().type !== "PLUS") return new R();
1374
- let e = [new R()];
1445
+ if (this.t.consume(), this.t.peek().type !== "PLUS") return new B();
1446
+ let e = [new B()];
1375
1447
  for (; this.t.peek().type === "PLUS";) this.t.consume(), e.push(this.parseValue());
1376
- return new R(e);
1448
+ return new B(e);
1377
1449
  }
1378
1450
  case "BYTES_HEX_ELIDED": return this.t.consume(), this._parseHexElidedConcat(e);
1379
1451
  default: this._fail(`unexpected token: ${JSON.stringify(e.value)}`, e);
1380
1452
  }
1381
1453
  }
1382
1454
  parseIntegerOrTag() {
1383
- let e = this.t.consume(), { numStr: t, rawSuffix: n } = st(e.value), r = n === void 0 ? this.consumeEncodingIndicator() : this._resolveEncodingWidth(n, e), i = ct(t);
1384
- if (i > 18446744073709551615n) return this.t.peek().type === "LPAREN" && this._fail("tag number exceeds maximum uint64", e), new tt(i);
1385
- if (i < -18446744073709551616n) return new nt(i);
1455
+ let e = this.t.consume(), { numStr: t, rawSuffix: n } = at(e.value), r = n === void 0 ? this.consumeEncodingIndicator() : this._resolveEncodingWidth(n, e), i = ot(t);
1456
+ if (i > 18446744073709551615n) return this.t.peek().type === "LPAREN" && this._fail("tag number exceeds maximum uint64", e), new $e(i);
1457
+ if (i < -18446744073709551616n) return new et(i);
1386
1458
  if (r !== void 0) {
1387
1459
  let t = i >= 0n ? i : -(i + 1n);
1388
1460
  r = this._validateEncodingFit(t, r, e);
1389
1461
  }
1390
- let a = i >= 0n ? new O(i, r === void 0 ? void 0 : { encodingWidth: r }) : new k(i, r === void 0 ? void 0 : { encodingWidth: r });
1462
+ let a = i >= 0n ? new A(i, r === void 0 ? void 0 : { encodingWidth: r }) : new j(i, r === void 0 ? void 0 : { encodingWidth: r });
1391
1463
  if (this.t.peek().type === "LPAREN") {
1392
- a instanceof O || this._fail("tag number must be non-negative", e), this.t.consume();
1464
+ a instanceof A || this._fail("tag number must be non-negative", e), this.t.consume();
1393
1465
  let t = this._pendingWarnings.splice(0), n = this.parseValue();
1394
1466
  this.expect("RPAREN");
1395
1467
  let i = a.value, o = this.extByTag.get(i);
1396
1468
  if (o?.parseTag) {
1397
1469
  let e = o.parseTag(i, n);
1398
- if (e !== void 0) return e instanceof j && r !== void 0 && e.encodingWidth === void 0 && (e.encodingWidth = r), t.length > 0 && (e.warnings ??= [], e.warnings.push(...t)), e;
1470
+ if (e !== void 0) return e instanceof N && r !== void 0 && e.encodingWidth === void 0 && (e.encodingWidth = r), t.length > 0 && (e.warnings ??= [], e.warnings.push(...t)), e;
1399
1471
  }
1400
- let s = new j(i, n, r === void 0 ? void 0 : { encodingWidth: r });
1472
+ let s = new N(i, n, r === void 0 ? void 0 : { encodingWidth: r });
1401
1473
  return t.length > 0 && (s.warnings ??= [], s.warnings.push(...t)), s;
1402
1474
  }
1403
1475
  return a;
1404
1476
  }
1405
1477
  parseFloat() {
1406
- let e = this.t.consume(), t = (t) => this._warnOrFail(t, e), { value: n, precision: r } = lt(e.value, t);
1478
+ let e = this.t.consume(), t = (t) => this._warnOrFail(t, e), { value: n, precision: r } = st(e.value, t);
1407
1479
  if (r === "half" || r === "single") {
1408
- let e = r === "half" ? C(S(n)) : Math.fround(n);
1480
+ let e = r === "half" ? E(T(n)) : Math.fround(n);
1409
1481
  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`);
1410
1482
  }
1411
- return new A(n, r === void 0 ? void 0 : { precision: r });
1483
+ return new M(n, r === void 0 ? void 0 : { precision: r });
1412
1484
  }
1413
1485
  parseString() {
1414
1486
  let e = this.t.consume();
1415
1487
  if (this.t.peek().type !== "PLUS") {
1416
- let t = this.consumeEncodingIndicator(() => BigInt(rt.encode(e.value).length));
1417
- return new B(e.value, t === void 0 ? void 0 : { encodingWidth: t });
1418
- }
1419
- let t = !1, n = [{ text: e.value }];
1488
+ let t = this.consumeEncodingIndicator(() => BigInt(tt.encode(e.value).length));
1489
+ return e.type === "RAWSTRING" ? new H(e.value, {
1490
+ ednSource: e.raw,
1491
+ ...t === void 0 ? {} : { encodingWidth: t }
1492
+ }) : new H(e.value, t === void 0 ? void 0 : { encodingWidth: t });
1493
+ }
1494
+ let t = !1, n = [e.type === "RAWSTRING" ? {
1495
+ text: e.value,
1496
+ source: e.raw
1497
+ } : { text: e.value }];
1420
1498
  for (; this.t.peek().type === "PLUS";) {
1421
1499
  this.t.consume();
1422
1500
  let e = this.t.peek();
1423
- e.type === "ELLIPSIS" ? (this.t.consume(), n.push({ ellipsis: !0 }), t = !0) : e.type === "TSTR" || e.type === "RAWSTRING" ? (this.t.consume(), n.push({ text: e.value })) : this._isBytesToken(e.type) ? (this.t.consume(), n.push({ text: this._decodeUtf8(this._decodeBytesToken(e), e) })) : this._fail(`expected string or byte string after +, got ${JSON.stringify(e.value)}`, e);
1501
+ e.type === "ELLIPSIS" ? (this.t.consume(), n.push({ ellipsis: !0 }), t = !0) : e.type === "TSTR" || e.type === "RAWSTRING" ? (this.t.consume(), n.push(e.type === "RAWSTRING" ? {
1502
+ text: e.value,
1503
+ source: e.raw
1504
+ } : { text: e.value })) : this._isBytesToken(e.type) ? (this.t.consume(), n.push({ text: this._decodeUtf8(this._decodeBytesToken(e), e) })) : this._fail(`expected string or byte string after +, got ${JSON.stringify(e.value)}`, e);
1424
1505
  }
1425
1506
  if (!t) {
1426
- let e = n.map((e) => "text" in e ? e.text : ""), t = e.join(""), r = this.consumeEncodingIndicator(() => BigInt(rt.encode(t).length));
1427
- return new B(t, {
1507
+ let e = n.map((e) => "text" in e ? e.text : ""), t = n.map((e) => "text" in e ? e.source : void 0), r = e.join(""), i = this.consumeEncodingIndicator(() => BigInt(tt.encode(r).length));
1508
+ return new H(r, {
1428
1509
  ednParts: e,
1429
- ...r === void 0 ? {} : { encodingWidth: r }
1510
+ ...t.some((e) => e !== void 0) ? { ednPartSources: t } : {},
1511
+ ...i === void 0 ? {} : { encodingWidth: i }
1430
1512
  });
1431
1513
  }
1432
- let r = [], i = "";
1433
- for (let e of n) "ellipsis" in e ? (i !== "" && (r.push(new B(i)), i = ""), r.push(new R())) : i += e.text;
1434
- return i !== "" && r.push(new B(i)), new R(r);
1514
+ let r = [], i = [], a = () => {
1515
+ let e = i.map((e) => e.text), t = e.join("");
1516
+ if (t !== "") {
1517
+ let n = i.map((e) => e.source);
1518
+ r.push(new H(t, {
1519
+ ednParts: e,
1520
+ ...n.some((e) => e !== void 0) ? { ednPartSources: n } : {}
1521
+ }));
1522
+ }
1523
+ i.length = 0;
1524
+ };
1525
+ for (let e of n) "ellipsis" in e ? (a(), r.push(new B())) : i.push(e);
1526
+ return a(), new B(r);
1435
1527
  }
1436
1528
  _isBytesToken(e) {
1437
1529
  return e === "BYTES_HEX" || e === "SQSTR" || e === "BYTES_B64";
@@ -1453,7 +1545,7 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1453
1545
  }
1454
1546
  case "BYTES_HEX": return this._hexToBytes(e.value, e);
1455
1547
  case "BYTES_B64": try {
1456
- return ut(e.value, t);
1548
+ return ct(e.value, t);
1457
1549
  } catch (t) {
1458
1550
  if (t instanceof r || !(t instanceof SyntaxError)) throw t;
1459
1551
  this._fail(t.message, e);
@@ -1462,11 +1554,11 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1462
1554
  }
1463
1555
  }
1464
1556
  _decodeUtf8(e, t) {
1465
- if (this._options.allowInvalidUtf8) return at.decode(e);
1557
+ if (this._options.allowInvalidUtf8) return rt.decode(e);
1466
1558
  try {
1467
- return it.decode(e);
1559
+ return nt.decode(e);
1468
1560
  } catch {
1469
- return this._warnOrFail("byte string in text concatenation is not valid UTF-8", t), at.decode(e);
1561
+ return this._warnOrFail("byte string in text concatenation is not valid UTF-8", t), rt.decode(e);
1470
1562
  }
1471
1563
  }
1472
1564
  _tokenTypeToCdnEncoding(e) {
@@ -1475,7 +1567,7 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1475
1567
  _parseBytesConcat(e, t, n) {
1476
1568
  if (this.t.peek().type !== "PLUS") {
1477
1569
  let r = this.consumeEncodingIndicator(() => BigInt(e.length));
1478
- return new M(e, {
1570
+ return new P(e, {
1479
1571
  ednEncoding: this._tokenTypeToCdnEncoding(t),
1480
1572
  ednSource: n,
1481
1573
  ...r === void 0 ? {} : { encodingWidth: r }
@@ -1492,32 +1584,32 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1492
1584
  else if (e.type === "BYTES_HEX_ELIDED") {
1493
1585
  this.t.consume();
1494
1586
  let t = this._buildBytesElidedItems(e.value, e);
1495
- for (let e of t) e instanceof R ? (i.push({ ellipsis: !0 }), r = !0) : e instanceof M && i.push({ bytes: e.value });
1587
+ for (let e of t) e instanceof B ? (i.push({ ellipsis: !0 }), r = !0) : e instanceof P && i.push({ bytes: e.value });
1496
1588
  } else this._isBytesToken(e.type) ? (this.t.consume(), i.push({
1497
1589
  bytes: this._decodeBytesToken(e),
1498
1590
  source: e.raw
1499
- })) : e.type === "TSTR" || e.type === "RAWSTRING" ? (this.t.consume(), this._warnOrFail("text string in a byte-string concatenation is not allowed; use a byte string literal (h'...', b64'...', or '...') instead", e), i.push({ bytes: rt.encode(e.value) })) : this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`, e);
1591
+ })) : e.type === "TSTR" || e.type === "RAWSTRING" ? (this.t.consume(), this._warnOrFail("text string in a byte-string concatenation is not allowed; use a byte string literal (h'...', b64'...', or '...') instead", e), i.push({ bytes: tt.encode(e.value) })) : this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`, e);
1500
1592
  }
1501
1593
  if (!r) {
1502
1594
  let e = i.map((e) => "bytes" in e ? e : { bytes: /* @__PURE__ */ new Uint8Array() }), n = this._concatBytes(e.map((e) => e.bytes)), r = this.consumeEncodingIndicator(() => BigInt(n.length));
1503
- return new M(n, {
1595
+ return new P(n, {
1504
1596
  ednEncoding: this._tokenTypeToCdnEncoding(t),
1505
1597
  ednParts: e,
1506
1598
  ...r === void 0 ? {} : { encodingWidth: r }
1507
1599
  });
1508
1600
  }
1509
1601
  let a = [], o = [], s = () => {
1510
- o.length > 0 && (a.push(new M(this._concatBytes([...o]))), o.length = 0);
1602
+ o.length > 0 && (a.push(new P(this._concatBytes([...o]))), o.length = 0);
1511
1603
  };
1512
- for (let e of i) "ellipsis" in e ? (s(), a.push(new R())) : o.push(e.bytes);
1513
- return s(), new R(a);
1604
+ for (let e of i) "ellipsis" in e ? (s(), a.push(new B())) : o.push(e.bytes);
1605
+ return s(), new B(a);
1514
1606
  }
1515
1607
  _parseHexElidedConcat(e) {
1516
1608
  let t = this._buildBytesElidedItems(e.value, e);
1517
1609
  for (; this.t.peek().type === "PLUS";) {
1518
1610
  this.t.consume();
1519
1611
  let e = this.t.peek();
1520
- if (e.type === "ELLIPSIS") this.t.consume(), t.push(new R());
1612
+ if (e.type === "ELLIPSIS") this.t.consume(), t.push(new B());
1521
1613
  else if (e.type === "BYTES_HEX_ELIDED") {
1522
1614
  this.t.consume();
1523
1615
  let n = this._buildBytesElidedItems(e.value, e);
@@ -1525,20 +1617,20 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1525
1617
  } else if (this._isBytesToken(e.type)) {
1526
1618
  this.t.consume();
1527
1619
  let n = this._decodeBytesToken(e), r = t[t.length - 1];
1528
- r instanceof M ? t[t.length - 1] = new M(this._concatBytes([r.value, n])) : t.push(new M(n));
1620
+ r instanceof P ? t[t.length - 1] = new P(this._concatBytes([r.value, n])) : t.push(new P(n));
1529
1621
  } else this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`, e);
1530
1622
  }
1531
- return new R(t);
1623
+ return new B(t);
1532
1624
  }
1533
1625
  _buildBytesElidedItems(e, t) {
1534
1626
  let n = e.split("..."), r = [];
1535
- for (let e = 0; e < n.length; e++) e > 0 && r.push(new R()), n[e].length > 0 && r.push(new M(this._hexToBytes(n[e], t)));
1627
+ for (let e = 0; e < n.length; e++) e > 0 && r.push(new B()), n[e].length > 0 && r.push(new P(this._hexToBytes(n[e], t)));
1536
1628
  return r;
1537
1629
  }
1538
1630
  _mergeFirstBytesItem(e, t) {
1539
1631
  if (t.length === 0) return;
1540
1632
  let n = e[e.length - 1], r = t[0];
1541
- n instanceof M && r instanceof M ? (e[e.length - 1] = new M(this._concatBytes([n.value, r.value])), e.push(...t.slice(1))) : e.push(...t);
1633
+ n instanceof P && r instanceof P ? (e[e.length - 1] = new P(this._concatBytes([n.value, r.value])), e.push(...t.slice(1))) : e.push(...t);
1542
1634
  }
1543
1635
  _concatBytes(e) {
1544
1636
  let t = e.reduce((e, t) => e + t.byteLength, 0), n = new Uint8Array(t), r = 0;
@@ -1549,8 +1641,8 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1549
1641
  this.t.consume(), this.expect("LPAREN");
1550
1642
  let e = this.t.peek();
1551
1643
  e.type !== "INTEGER" && this._fail(`expected integer inside simple(), got ${JSON.stringify(e.value)}`, e), this.t.consume();
1552
- let { numStr: t } = st(e.value), n = Number(ct(t));
1553
- return this.expect("RPAREN"), new L(n);
1644
+ let { numStr: t } = at(e.value), n = Number(ot(t));
1645
+ return this.expect("RPAREN"), new z(n);
1554
1646
  }
1555
1647
  parseEmbeddedCBOR() {
1556
1648
  this.t.consume();
@@ -1567,7 +1659,7 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1567
1659
  let e = this.t.consume();
1568
1660
  t = this._resolveEncodingWidth(e.value, e);
1569
1661
  }
1570
- return new We(e, { encodingWidth: t });
1662
+ return new He(e, { encodingWidth: t });
1571
1663
  }
1572
1664
  parseArray() {
1573
1665
  this.t.consume();
@@ -1581,7 +1673,7 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1581
1673
  i.push(this.parseValue());
1582
1674
  }
1583
1675
  this.expect("RBRACKET"), t !== void 0 && n !== void 0 && (t = this._validateEncodingFit(BigInt(i.length), t, n));
1584
- let a = new F(i, {
1676
+ let a = new L(i, {
1585
1677
  indefiniteLength: e,
1586
1678
  encodingWidth: t
1587
1679
  });
@@ -1602,7 +1694,7 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1602
1694
  i.push([e, t]);
1603
1695
  }
1604
1696
  this.expect("RBRACE"), t !== void 0 && n !== void 0 && (t = this._validateEncodingFit(BigInt(i.length), t, n));
1605
- let a = new I(i, {
1697
+ let a = new R(i, {
1606
1698
  indefiniteLength: e,
1607
1699
  encodingWidth: t
1608
1700
  });
@@ -1626,16 +1718,16 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1626
1718
  }
1627
1719
  this.expect("RPAREN"), n.length === 0 && this._fail("empty indefinite group (_ ) is ambiguous; use ''_ for bytes or \"\"_ for text");
1628
1720
  let r = n[0];
1629
- if (r instanceof M) {
1630
- let e = new N(n.map((e, t) => {
1631
- if (e instanceof M) return e;
1721
+ if (r instanceof P) {
1722
+ let e = new F(n.map((e, t) => {
1723
+ if (e instanceof P) return e;
1632
1724
  this._fail(`indefinite byte string chunk ${t} must be a byte string, not a text string`);
1633
1725
  }));
1634
1726
  return t.length > 0 && (e.warnings = t), e;
1635
1727
  }
1636
- if (r instanceof B) {
1637
- let e = new P(n.map((e, t) => {
1638
- if (e instanceof B) return e;
1728
+ if (r instanceof H) {
1729
+ let e = new I(n.map((e, t) => {
1730
+ if (e instanceof H) return e;
1639
1731
  this._fail(`indefinite text string chunk ${t} must be a text string, not a byte string`);
1640
1732
  }));
1641
1733
  return t.length > 0 && (e.warnings = t), e;
@@ -1653,47 +1745,47 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1653
1745
  return t.type !== e && this._fail(`expected ${e}, got ${t.type} (${JSON.stringify(t.value)})`, t), t;
1654
1746
  }
1655
1747
  _applyEiToResult(e, t, n) {
1656
- if (e instanceof A) {
1748
+ if (e instanceof M) {
1657
1749
  let r = t === 1 ? "half" : t === 2 ? "single" : t === 3 ? "double" : void 0;
1658
1750
  if (r === void 0) this._warnOrFail(`encoding indicator _${t} is not valid for a float; use _1, _2, or _3`, n);
1659
1751
  else if (e.precision !== r) {
1660
1752
  if (r !== "double") {
1661
- let t = r === "half" ? C(S(e.value)) : Math.fround(e.value);
1753
+ let t = r === "half" ? E(T(e.value)) : Math.fround(e.value);
1662
1754
  !Object.is(t, e.value) && !isNaN(e.value) && this._warnOrFail(`${e.value} cannot be exactly represented as ${r === "half" ? "float16 (_1)" : "float32 (_2)"}`, n);
1663
1755
  }
1664
1756
  e.precision = r;
1665
1757
  }
1666
- } else if (e instanceof O) {
1758
+ } else if (e instanceof A) {
1667
1759
  if (e.encodingWidth === void 0) {
1668
1760
  let r = this._validateEncodingFit(e.value, t, n);
1669
1761
  r !== void 0 && (e.encodingWidth = r);
1670
1762
  }
1671
- } else if (e instanceof k) {
1763
+ } else if (e instanceof j) {
1672
1764
  if (e.encodingWidth === void 0) {
1673
1765
  let r = this._validateEncodingFit(e.argument, t, n);
1674
1766
  r !== void 0 && (e.encodingWidth = r);
1675
1767
  }
1676
- } else if (e instanceof M) {
1768
+ } else if (e instanceof P) {
1677
1769
  if (e.encodingWidth === void 0) {
1678
1770
  let r = this._validateEncodingFit(BigInt(e.value.length), t, n);
1679
1771
  r !== void 0 && (e.encodingWidth = r);
1680
1772
  }
1681
- } else if (e instanceof B) {
1773
+ } else if (e instanceof H) {
1682
1774
  if (e.encodingWidth === void 0) {
1683
- let r = this._validateEncodingFit(BigInt(rt.encode(e.value).length), t, n);
1775
+ let r = this._validateEncodingFit(BigInt(tt.encode(e.value).length), t, n);
1684
1776
  r !== void 0 && (e.encodingWidth = r);
1685
1777
  }
1686
- } else if (e instanceof F) {
1778
+ } else if (e instanceof L) {
1687
1779
  if (e.encodingWidth === void 0) {
1688
1780
  let r = this._validateEncodingFit(BigInt(e.items.length), t, n);
1689
1781
  r !== void 0 && (e.encodingWidth = r);
1690
1782
  }
1691
- } else if (e instanceof I) {
1783
+ } else if (e instanceof R) {
1692
1784
  if (e.encodingWidth === void 0) {
1693
1785
  let r = this._validateEncodingFit(BigInt(e.entries.length), t, n);
1694
1786
  r !== void 0 && (e.encodingWidth = r);
1695
1787
  }
1696
- } else if (e instanceof j) {
1788
+ } else if (e instanceof N) {
1697
1789
  if (e.encodingWidth === void 0) {
1698
1790
  let r = this._validateEncodingFit(e.tag, t, n);
1699
1791
  r !== void 0 && (e.encodingWidth = r);
@@ -1701,7 +1793,7 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1701
1793
  } else this._warnOrFail(`encoding indicator _${t} is not applicable to this app-string result type`, n);
1702
1794
  }
1703
1795
  _validateEncodingFit(e, t, n) {
1704
- let r = Pe(t);
1796
+ let r = Me(t);
1705
1797
  if (e <= r) return t;
1706
1798
  let i = `value ${e} does not fit in encoding indicator ${t === "i" ? "_i (max 23)" : `_${t} (max ${r})`}`;
1707
1799
  this._warnOrFail(i, n);
@@ -1725,28 +1817,29 @@ var ht = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1725
1817
  this._warn(e, t), this._options.strict !== !1 && this._fail(e, t);
1726
1818
  }
1727
1819
  _hintMissingExtension(e, t) {
1728
- let n = _t.get(e);
1820
+ let n = ht.get(e);
1729
1821
  if (n === void 0 || this._hintedPrefixes.has(e)) return;
1730
1822
  this._hintedPrefixes.add(e);
1731
1823
  let r = `app-string prefix '${e}' requires an extension that is not enabled; ${n}`;
1732
1824
  this._options.onWarning ? this._options.onWarning({
1733
1825
  message: r,
1734
- ...yt(t)
1826
+ ..._t(t),
1827
+ hint: !0
1735
1828
  }) : this._options.silent || console.warn(`CDN: ${r}`);
1736
1829
  }
1737
1830
  _warn(e, t) {
1738
1831
  let n = { message: e };
1739
- if (t !== void 0 && Object.assign(n, yt(t)), this._pendingWarnings.push(n), this._options.onWarning) this._options.onWarning(n);
1832
+ if (t !== void 0 && Object.assign(n, _t(t)), this._pendingWarnings.push(n), this._options.onWarning) this._options.onWarning(n);
1740
1833
  else if (!this._options.silent) {
1741
1834
  let n = t ? ` at line ${t.line}, column ${t.col}` : "";
1742
1835
  console.warn(`CDN strict violation${n}: ${e}`);
1743
1836
  }
1744
1837
  }
1745
1838
  _fail(e, t) {
1746
- throw new r(e, t ? yt(t) : void 0);
1839
+ throw new r(e, t ? _t(t) : void 0);
1747
1840
  }
1748
1841
  };
1749
- function yt(e) {
1842
+ function _t(e) {
1750
1843
  return {
1751
1844
  offset: e.offset,
1752
1845
  line: e.line,
@@ -1756,78 +1849,90 @@ function yt(e) {
1756
1849
  }
1757
1850
  //#endregion
1758
1851
  //#region src/ast/CborTextString.ts
1759
- var bt = new TextEncoder(), xt = !1, B = class extends D {
1852
+ var vt = new TextEncoder(), yt = !1, H = class extends k {
1760
1853
  indefiniteLength = !1;
1761
1854
  value;
1762
1855
  encodingWidth;
1763
1856
  ednParts;
1857
+ ednSource;
1858
+ ednPartSources;
1764
1859
  constructor(e, t) {
1765
- super(), this.value = e, this.encodingWidth = t?.encodingWidth, this.ednParts = t?.ednParts;
1860
+ super(), this.value = e, this.encodingWidth = t?.encodingWidth, this.ednParts = t?.ednParts, this.ednSource = t?.ednSource, this.ednPartSources = t?.ednPartSources;
1766
1861
  }
1767
1862
  _encodeTo(e, t) {
1768
1863
  e.writeTextString(3, this.value, this.encodingWidth);
1769
1864
  }
1770
1865
  _toCDN(e, t) {
1771
- let n = x(e, this.encodingWidth, () => b(BigInt(bt.encode(this.value).length)));
1772
- return St(this.value, n, e, t, this.ednParts);
1866
+ let n = w(e, this.encodingWidth, () => C(BigInt(vt.encode(this.value).length)));
1867
+ return bt(this.value, n, e, t, this.ednParts, this.ednSource, this.ednPartSources);
1773
1868
  }
1774
1869
  _toJS(e) {
1775
1870
  return this.value;
1776
1871
  }
1777
1872
  };
1778
- function St(e, t, n, r, i) {
1779
- let { cdn: a, newline: o } = wt(n), s = ee(n), c = n?.preserveConcatenation && i !== void 0 && i.length > 1 ? i : void 0;
1780
- if (s === null) return c === void 0 ? Se(e) + t : Ct(c.map((e) => ({
1873
+ function bt(e, t, n, r, i, a, o) {
1874
+ if (n?.preserveRawString && a !== void 0) return a + t;
1875
+ let s = n?.preserveRawString ? o : void 0, c = s?.some((e) => e !== void 0) ?? !1, { cdn: l, newline: u } = St(n), d = _(n), f = n?.preserveConcatenation && i !== void 0 && (i.length > 1 || c) ? i : void 0;
1876
+ if (d === null) return f === void 0 ? ye(e) + t : xt(f.map((e, t) => ({
1781
1877
  text: e,
1782
- contentDepth: 0
1878
+ contentDepth: 0,
1879
+ source: s?.[t]
1783
1880
  })), t, null, r);
1784
- if (!a && !o && c === void 0) return Se(e) + t;
1785
- let l = a ? Dt(e) : null;
1786
- if (l === null && c !== void 0) {
1881
+ if (!l && !u && f === void 0) return ye(e) + t;
1882
+ let p = l ? Tt(e) : null;
1883
+ if (f !== void 0 && (p === null || c)) {
1787
1884
  let e = [];
1788
- for (let t of c) if (o) {
1789
- let n = /* @__PURE__ */ new Map();
1790
- for (let { point: e, contentDepth: r } of Et(t, 0)) n.set(e, r);
1791
- e.push(...Ft(t, n));
1792
- } else e.push({
1793
- text: t,
1794
- contentDepth: 0
1795
- });
1796
- return Ct(e, t, s, r);
1885
+ for (let [t, n] of f.entries()) {
1886
+ let r = s?.[t];
1887
+ if (r !== void 0) e.push({
1888
+ text: n,
1889
+ contentDepth: 0,
1890
+ source: r
1891
+ });
1892
+ else if (u) {
1893
+ let t = /* @__PURE__ */ new Map();
1894
+ for (let { point: e, contentDepth: r } of wt(n, 0)) t.set(e, r);
1895
+ e.push(...Nt(n, t));
1896
+ } else e.push({
1897
+ text: n,
1898
+ contentDepth: 0
1899
+ });
1900
+ }
1901
+ return xt(e, t, d, r);
1797
1902
  }
1798
- let u = /* @__PURE__ */ new Map();
1799
- if (l !== null) for (let { point: e, contentDepth: t } of l) u.set(e, t);
1800
- if (o) {
1801
- let t = l === null ? Et(e, 0) : Ot(e);
1802
- for (let { point: e, contentDepth: n } of t) u.has(e) || u.set(e, n);
1903
+ let m = /* @__PURE__ */ new Map();
1904
+ if (p !== null) for (let { point: e, contentDepth: t } of p) m.set(e, t);
1905
+ if (u) {
1906
+ let t = p === null ? wt(e, 0) : Et(e);
1907
+ for (let { point: e, contentDepth: n } of t) m.has(e) || m.set(e, n);
1803
1908
  }
1804
- let d = Ft(e, u);
1805
- return d.length <= 1 ? Se(e) + t : Ct(d, t, s, r);
1909
+ let h = Nt(e, m);
1910
+ return h.length <= 1 ? ye(e) + t : xt(h, t, d, r);
1806
1911
  }
1807
- function Ct(e, t, n, r) {
1808
- let i = e.map(({ text: n }, r) => {
1809
- let i = Se(n);
1810
- return r === e.length - 1 ? i + t : i;
1912
+ function xt(e, t, n, r) {
1913
+ let i = e.map(({ text: n, source: r }, i) => {
1914
+ let a = r ?? ye(n);
1915
+ return i === e.length - 1 ? a + t : a;
1811
1916
  });
1812
1917
  if (n === null) return i.join(" + ");
1813
1918
  let a = i[0];
1814
1919
  for (let t = 1; t < i.length; t++) {
1815
- let o = _(n, r + 1 + e[t].contentDepth);
1920
+ let o = v(n, r + 1 + e[t].contentDepth);
1816
1921
  a += ` +\n${o}${i[t]}`;
1817
1922
  }
1818
1923
  return a;
1819
1924
  }
1820
- function wt(e) {
1821
- let t = e?.splitCdn === void 0 || e?.splitNewline === void 0 ? Tt(e?.textStringFormat ?? []) : [];
1925
+ function St(e) {
1926
+ let t = e?.splitCdn === void 0 || e?.splitNewline === void 0 ? Ct(e?.textStringFormat ?? []) : [];
1822
1927
  return {
1823
1928
  cdn: e?.splitCdn ?? t.includes("cdn"),
1824
1929
  newline: e?.splitNewline ?? t.includes("newline")
1825
1930
  };
1826
1931
  }
1827
- function Tt(e) {
1828
- return e.map((e) => e === "cboredn" ? (xt || (xt = !0, console.warn("`textStringFormat: ['cboredn']` is deprecated; use `textStringFormat: ['cdn']` instead.")), "cdn") : e);
1932
+ function Ct(e) {
1933
+ return e.map((e) => e === "cboredn" ? (yt || (yt = !0, console.warn("`textStringFormat: ['cboredn']` is deprecated; use `textStringFormat: ['cdn']` instead.")), "cdn") : e);
1829
1934
  }
1830
- function Et(e, t) {
1935
+ function wt(e, t) {
1831
1936
  let n = [];
1832
1937
  for (let r = 0; r < e.length; r++) {
1833
1938
  let i = e[r];
@@ -1844,9 +1949,9 @@ function Et(e, t) {
1844
1949
  }
1845
1950
  return n;
1846
1951
  }
1847
- function Dt(e) {
1952
+ function Tt(e) {
1848
1953
  try {
1849
- ot(e);
1954
+ it(e);
1850
1955
  } catch {
1851
1956
  return null;
1852
1957
  }
@@ -1855,24 +1960,24 @@ function Dt(e) {
1855
1960
  let a = n.consume();
1856
1961
  if (a.type === "EOF") break;
1857
1962
  let c = !1;
1858
- if (o || (o = !0, a.offset > 0 && Nt(n.comments, 0, a.offset) && t.push({
1963
+ if (o || (o = !0, a.offset > 0 && jt(n.comments, 0, a.offset) && t.push({
1859
1964
  point: a.offset,
1860
1965
  contentDepth: r
1861
1966
  })), i !== null) {
1862
- if (i.kind === "opener" && At.has(a.type)) {
1967
+ if (i.kind === "opener" && Ot.has(a.type)) {
1863
1968
  i.point = a.endOffset, s = a.endOffset;
1864
1969
  continue;
1865
- } else i.kind === "opener" && Mt.has(a.type) && Pt(e, i.point, a.offset) ? c = !0 : t.push({
1970
+ } else i.kind === "opener" && At.has(a.type) && Mt(e, i.point, a.offset) ? c = !0 : t.push({
1866
1971
  point: a.offset,
1867
1972
  contentDepth: i.contentDepth
1868
1973
  });
1869
1974
  i = null;
1870
1975
  }
1871
- jt.has(a.type) ? (r++, i = {
1976
+ kt.has(a.type) ? (r++, i = {
1872
1977
  point: a.endOffset,
1873
1978
  contentDepth: r,
1874
1979
  kind: "opener"
1875
- }) : Mt.has(a.type) ? (r = Math.max(0, r - 1), c || t.push({
1980
+ }) : At.has(a.type) ? (r = Math.max(0, r - 1), c || t.push({
1876
1981
  point: a.offset,
1877
1982
  contentDepth: r
1878
1983
  })) : a.type === "COMMA" && (i = {
@@ -1887,23 +1992,23 @@ function Dt(e) {
1887
1992
  contentDepth: r
1888
1993
  }), t;
1889
1994
  }
1890
- function Ot(e) {
1995
+ function Et(e) {
1891
1996
  let t = [], n = new a(e), r = 0;
1892
1997
  for (;;) {
1893
1998
  let i = n.consume();
1894
1999
  if (i.type === "EOF") break;
1895
- if (jt.has(i.type)) r++;
1896
- else if (Mt.has(i.type)) r = Math.max(0, r - 1);
2000
+ if (kt.has(i.type)) r++;
2001
+ else if (At.has(i.type)) r = Math.max(0, r - 1);
1897
2002
  else if (i.type !== "COMMA") {
1898
2003
  if (i.type === "TSTR") {
1899
2004
  let n = e.slice(i.offset, i.endOffset);
1900
- for (let e of kt(n)) t.push({
2005
+ for (let e of Dt(n)) t.push({
1901
2006
  point: i.offset + e,
1902
2007
  contentDepth: r + 1
1903
2008
  });
1904
2009
  } else if (i.type === "RAWSTRING") {
1905
2010
  let n = e.slice(i.offset, i.endOffset);
1906
- for (let { point: e } of Et(n, 0)) t.push({
2011
+ for (let { point: e } of wt(n, 0)) t.push({
1907
2012
  point: i.offset + e,
1908
2013
  contentDepth: r + 1
1909
2014
  });
@@ -1912,7 +2017,7 @@ function Ot(e) {
1912
2017
  }
1913
2018
  return t;
1914
2019
  }
1915
- function kt(e) {
2020
+ function Dt(e) {
1916
2021
  let t = [], n = 1, r = e.length - 1;
1917
2022
  for (; n < r;) {
1918
2023
  let r = e[n];
@@ -1928,24 +2033,24 @@ function kt(e) {
1928
2033
  }
1929
2034
  return t;
1930
2035
  }
1931
- var At = /* @__PURE__ */ new Set(["ENCODING_INDICATOR", "UNDERSCORE"]), jt = /* @__PURE__ */ new Set([
2036
+ var Ot = /* @__PURE__ */ new Set(["ENCODING_INDICATOR", "UNDERSCORE"]), kt = /* @__PURE__ */ new Set([
1932
2037
  "LBRACKET",
1933
2038
  "LBRACE",
1934
2039
  "LPAREN",
1935
2040
  "LT_LT"
1936
- ]), Mt = /* @__PURE__ */ new Set([
2041
+ ]), At = /* @__PURE__ */ new Set([
1937
2042
  "RBRACKET",
1938
2043
  "RBRACE",
1939
2044
  "RPAREN",
1940
2045
  "GT_GT"
1941
2046
  ]);
1942
- function Nt(e, t, n) {
2047
+ function jt(e, t, n) {
1943
2048
  return e.some((e) => e.start >= t && e.end <= n);
1944
2049
  }
1945
- function Pt(e, t, n) {
2050
+ function Mt(e, t, n) {
1946
2051
  return /^[\t\n\r ]*$/.test(e.slice(t, n));
1947
2052
  }
1948
- function Ft(e, t) {
2053
+ function Nt(e, t) {
1949
2054
  let n = [...t].filter(([t]) => t > 0 && t < e.length).sort(([e], [t]) => e - t);
1950
2055
  if (n.length === 0) return [{
1951
2056
  text: e,
@@ -1963,7 +2068,7 @@ function Ft(e, t) {
1963
2068
  }
1964
2069
  //#endregion
1965
2070
  //#region src/extensions/dt.ts
1966
- function V(e) {
2071
+ function U(e) {
1967
2072
  if (Number.isInteger(e)) return (/* @__PURE__ */ new Date(e * 1e3)).toISOString().replace(/\.000Z$/, "Z");
1968
2073
  let t = Math.round(e * 1e3);
1969
2074
  if (t / 1e3 === e) return new Date(t).toISOString().replace(/\.000Z$/, "Z");
@@ -1971,17 +2076,17 @@ function V(e) {
1971
2076
  for (; s.length < 3;) s += "0";
1972
2077
  return `${i}.${s}Z`;
1973
2078
  }
1974
- var It = new TextDecoder("utf-8", { fatal: !0 });
1975
- function Lt(e) {
2079
+ var Pt = new TextDecoder("utf-8", { fatal: !0 });
2080
+ function Ft(e) {
1976
2081
  if (e.length !== 1) throw SyntaxError("dt<<...>>: expected exactly one item");
1977
2082
  let t = e[0];
1978
- if (t instanceof B) return t.value;
1979
- if (t instanceof M) return It.decode(t.value);
2083
+ if (t instanceof H) return t.value;
2084
+ if (t instanceof P) return Pt.decode(t.value);
1980
2085
  throw SyntaxError("dt<<...>>: expected a text string or byte string");
1981
2086
  }
1982
- var Rt = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i;
1983
- function zt(e, t) {
1984
- if (!Rt.test(e)) {
2087
+ var It = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i;
2088
+ function Lt(e, t) {
2089
+ if (!It.test(e)) {
1985
2090
  let n = `dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`;
1986
2091
  if (t) t(n);
1987
2092
  else throw SyntaxError(n);
@@ -1992,93 +2097,93 @@ function zt(e, t) {
1992
2097
  if (isNaN(a)) throw SyntaxError(`dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`);
1993
2098
  if (i === void 0) {
1994
2099
  let e = a / 1e3;
1995
- return e >= 0 ? new Vt(BigInt(e)) : new Ht(BigInt(e));
2100
+ return e >= 0 ? new zt(BigInt(e)) : new Bt(BigInt(e));
1996
2101
  }
1997
- return new Ut(a / 1e3 + i);
2102
+ return new Vt(a / 1e3 + i);
1998
2103
  }
1999
- var Bt = 1n, Vt = class extends O {
2104
+ var Rt = 1n, zt = class extends A {
2000
2105
  constructor(e, t) {
2001
2106
  super(e, t);
2002
2107
  }
2003
2108
  _toCDN(e, t) {
2004
2109
  if (e?.appStrings === !1) return super._toCDN(e, t);
2005
- let n = x(e, this.encodingWidth, () => b(this.value));
2006
- return `dt'${V(Number(this.value))}'${n}`;
2110
+ let n = w(e, this.encodingWidth, () => C(this.value));
2111
+ return `dt'${U(Number(this.value))}'${n}`;
2007
2112
  }
2008
- }, Ht = class extends k {
2113
+ }, Bt = class extends j {
2009
2114
  constructor(e, t) {
2010
2115
  super(e, t);
2011
2116
  }
2012
2117
  _toCDN(e, t) {
2013
2118
  if (e?.appStrings === !1) return super._toCDN(e, t);
2014
- let n = x(e, this.encodingWidth, () => b(this.argument));
2015
- return `dt'${V(Number(this.value))}'${n}`;
2119
+ let n = w(e, this.encodingWidth, () => C(this.argument));
2120
+ return `dt'${U(Number(this.value))}'${n}`;
2016
2121
  }
2017
- }, Ut = class extends A {
2122
+ }, Vt = class extends M {
2018
2123
  constructor(e, t) {
2019
2124
  super(e, t);
2020
2125
  }
2021
2126
  _toCDN(e, t) {
2022
2127
  if (e?.appStrings === !1) return super._toCDN(e, t);
2023
- let n = ze(this.value), r = we(this.value, this.precision, n, e?.encodingIndicators ?? "auto");
2024
- return `dt'${V(this.value)}'${r}`;
2128
+ let n = Le(this.value), r = xe(this.value, this.precision, n, e?.encodingIndicators ?? "auto");
2129
+ return `dt'${U(this.value)}'${r}`;
2025
2130
  }
2026
- }, Wt = class extends j {
2131
+ }, Ht = class extends N {
2027
2132
  constructor(e, t) {
2028
- super(Bt, typeof e == "string" ? zt(e) : e, t);
2133
+ super(Rt, typeof e == "string" ? Lt(e) : e, t);
2029
2134
  }
2030
2135
  _toCDN(e, t) {
2031
2136
  if (e?.appStrings === !1) return super._toCDN(e, t);
2032
2137
  let n = this.content;
2033
- if (n instanceof A ? n.precision !== void 0 && n.precision !== ze(n.value) : n.encodingWidth !== void 0) return super._toCDN({
2138
+ if (n instanceof M ? n.precision !== void 0 && n.precision !== Le(n.value) : n.encodingWidth !== void 0) return super._toCDN({
2034
2139
  ...e,
2035
2140
  appStrings: !1
2036
2141
  }, t);
2037
- let r = n instanceof A ? n.value : Number(n.value), i = x(e, this.encodingWidth, () => b(Bt));
2038
- return `DT'${V(r)}'${i}`;
2142
+ let r = n instanceof M ? n.value : Number(n.value), i = w(e, this.encodingWidth, () => C(Rt));
2143
+ return `DT'${U(r)}'${i}`;
2039
2144
  }
2040
- }, Gt = class extends Wt {
2145
+ }, Ut = class extends Ht {
2041
2146
  constructor(e, t) {
2042
2147
  super(e, t);
2043
2148
  }
2044
2149
  _toJS(e) {
2045
- let t = this.content, n = t instanceof A ? t.value * 1e3 : Number(t.value) * 1e3;
2150
+ let t = this.content, n = t instanceof M ? t.value * 1e3 : Number(t.value) * 1e3;
2046
2151
  return new Date(n);
2047
2152
  }
2048
2153
  };
2049
- function Kt(e) {
2154
+ function Wt(e) {
2050
2155
  let t = e?.jsDate ?? !1;
2051
2156
  function n(e) {
2052
- return t ? new Gt(e) : new Wt(e);
2157
+ return t ? new Ut(e) : new Ht(e);
2053
2158
  }
2054
2159
  let r = {
2055
2160
  appStringPrefixes: ["dt", "DT"],
2056
- tagNumbers: [Bt],
2161
+ tagNumbers: [Rt],
2057
2162
  parseAppString(e, t, r) {
2058
- return e === "DT" ? n(t) : zt(t, r);
2163
+ return e === "DT" ? n(t) : Lt(t, r);
2059
2164
  },
2060
2165
  parseAppSequence(e, t, r) {
2061
- let i = Lt(t);
2062
- return e === "DT" ? n(i) : zt(i, r);
2166
+ let i = Ft(t);
2167
+ return e === "DT" ? n(i) : Lt(i, r);
2063
2168
  },
2064
2169
  parseTag(e, n) {
2065
2170
  if (e !== 1n) return;
2066
2171
  let r;
2067
- if (n instanceof O) r = new Vt(n.value, { encodingWidth: n.encodingWidth });
2068
- else if (n instanceof k) r = new Ht(n.value, { encodingWidth: n.encodingWidth });
2069
- else if (n instanceof A) r = new Ut(n.value), n.precision !== void 0 && (r.precision = n.precision);
2172
+ if (n instanceof A) r = new zt(n.value, { encodingWidth: n.encodingWidth });
2173
+ else if (n instanceof j) r = new Bt(n.value, { encodingWidth: n.encodingWidth });
2174
+ else if (n instanceof M) r = new Vt(n.value), n.precision !== void 0 && (r.precision = n.precision);
2070
2175
  else return;
2071
- return r.start = n.start, r.end = n.end, t ? new Gt(r) : new Wt(r);
2176
+ return r.start = n.start, r.end = n.end, t ? new Ut(r) : new Ht(r);
2072
2177
  }
2073
2178
  };
2074
2179
  return t && (r.fromJS = (e, t) => {
2075
- if (e instanceof Date) return new Gt(V(e.getTime() / 1e3));
2180
+ if (e instanceof Date) return new Ut(U(e.getTime() / 1e3));
2076
2181
  }, r.isJSType = (e) => e instanceof Date), r;
2077
2182
  }
2078
- var qt = Kt(), Jt = Kt({ jsDate: !0 });
2183
+ var Gt = Wt(), Kt = Wt({ jsDate: !0 });
2079
2184
  //#endregion
2080
2185
  //#region src/utils/ip.ts
2081
- function Yt(e) {
2186
+ function qt(e) {
2082
2187
  let t = e.split(".");
2083
2188
  if (t.length !== 4) throw SyntaxError(`ip: invalid IPv4 address: ${JSON.stringify(e)}`);
2084
2189
  let n = /* @__PURE__ */ new Uint8Array(4);
@@ -2091,11 +2196,11 @@ function Yt(e) {
2091
2196
  }
2092
2197
  return n;
2093
2198
  }
2094
- function Xt(e) {
2199
+ function Jt(e) {
2095
2200
  let t = /* @__PURE__ */ new Uint8Array(16);
2096
2201
  if (e === "::") return t;
2097
2202
  let n = e, r = null, i = e.match(/^(.*):(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);
2098
- i && (n = i[1], n.endsWith(":") && (n += ":"), r = Yt(i[2]));
2203
+ i && (n = i[1], n.endsWith(":") && (n += ":"), r = qt(i[2]));
2099
2204
  let a = n.split("::");
2100
2205
  if (a.length > 2) throw SyntaxError(`ip: invalid IPv6 address: ${JSON.stringify(e)}`);
2101
2206
  let o = a.length === 2, s = a[0] ? a[0].split(":") : [], c = o && a[1] ? a[1].split(":") : [], l = r ? 6 : 8;
@@ -2112,11 +2217,11 @@ function Xt(e) {
2112
2217
  }
2113
2218
  return r && t.set(r, 12), t;
2114
2219
  }
2115
- function Zt(e) {
2220
+ function Yt(e) {
2116
2221
  return Array.from(e).join(".");
2117
2222
  }
2118
- function Qt(e) {
2119
- let t = e.slice(0, 10).every((e) => e === 0) && e[10] === 255 && e[11] === 255 ? Zt(e.slice(12)) : null, n = t ? 6 : 8, r = [];
2223
+ function Xt(e) {
2224
+ let t = e.slice(0, 10).every((e) => e === 0) && e[10] === 255 && e[11] === 255 ? Yt(e.slice(12)) : null, n = t ? 6 : 8, r = [];
2120
2225
  for (let t = 0; t < n * 2; t += 2) r.push(e[t] << 8 | e[t + 1]);
2121
2226
  let i = -1, a = 0, o = 0;
2122
2227
  for (; o < n;) if (r[o] === 0) {
@@ -2130,29 +2235,29 @@ function Qt(e) {
2130
2235
  }
2131
2236
  //#endregion
2132
2237
  //#region src/extensions/ip.ts
2133
- var $t = "ip", H = "IP", U = 52n, en = 54n, tn = new TextDecoder("utf-8", { fatal: !0 });
2134
- function nn(e) {
2238
+ var Zt = "ip", W = "IP", G = 52n, Qt = 54n, $t = new TextDecoder("utf-8", { fatal: !0 });
2239
+ function en(e) {
2135
2240
  if (e.length !== 1) throw SyntaxError("ip<<...>>: expected exactly one item");
2136
2241
  let t = e[0];
2137
- if (t instanceof B) return t.value;
2138
- if (t instanceof M) return tn.decode(t.value);
2242
+ if (t instanceof H) return t.value;
2243
+ if (t instanceof P) return $t.decode(t.value);
2139
2244
  throw SyntaxError("ip<<...>>: expected a text string or byte string");
2140
2245
  }
2141
- function rn(e) {
2246
+ function tn(e) {
2142
2247
  return /^\d/.test(e) && e.includes(".") && !e.includes(":") ? {
2143
- bytes: Yt(e),
2248
+ bytes: qt(e),
2144
2249
  isV4: !0
2145
2250
  } : {
2146
- bytes: Xt(e),
2251
+ bytes: Jt(e),
2147
2252
  isV4: !1
2148
2253
  };
2149
2254
  }
2150
- function an(e) {
2151
- if (e.length === 4) return Zt(e);
2152
- if (e.length === 16) return Qt(e);
2255
+ function nn(e) {
2256
+ if (e.length === 4) return Yt(e);
2257
+ if (e.length === 16) return Xt(e);
2153
2258
  throw SyntaxError(`ip: unexpected byte length: ${e.length}`);
2154
2259
  }
2155
- function on(e, t) {
2260
+ function rn(e, t) {
2156
2261
  let n = new Uint8Array(e.length);
2157
2262
  n.set(e);
2158
2263
  let r = Math.floor(t / 8), i = t % 8;
@@ -2162,72 +2267,72 @@ function on(e, t) {
2162
2267
  for (; a > 0 && n[a - 1] === 0;) a--;
2163
2268
  return n.slice(0, a);
2164
2269
  }
2165
- function sn(e, t) {
2270
+ function an(e, t) {
2166
2271
  let n = new Uint8Array(t);
2167
2272
  return n.set(e), n;
2168
2273
  }
2169
- var cn = class extends M {
2274
+ var on = class extends P {
2170
2275
  _toCDN(e, t) {
2171
2276
  if (e?.appStrings === !1) return super._toCDN(e, t);
2172
- let n = x(e, this.encodingWidth, () => b(BigInt(this.value.length)));
2173
- return `${$t}'${an(this.value)}'${n}`;
2277
+ let n = w(e, this.encodingWidth, () => C(BigInt(this.value.length)));
2278
+ return `${Zt}'${nn(this.value)}'${n}`;
2174
2279
  }
2175
- }, ln = class extends F {
2280
+ }, sn = class extends L {
2176
2281
  _isV4;
2177
2282
  constructor(e, t, n) {
2178
- super([new O(BigInt(e)), new M(t)]), this._isV4 = n;
2283
+ super([new A(BigInt(e)), new P(t)]), this._isV4 = n;
2179
2284
  }
2180
2285
  _toCDN(e, t) {
2181
2286
  if (e?.appStrings === !1) return super._toCDN(e, t);
2182
2287
  let n = Number(this.items[0].value), r = this.items[1].value;
2183
- return `${$t}'${an(sn(r, this._isV4 ? 4 : 16))}/${n}'`;
2288
+ return `${Zt}'${nn(an(r, this._isV4 ? 4 : 16))}/${n}'`;
2184
2289
  }
2185
- }, un = class extends j {
2290
+ }, cn = class extends N {
2186
2291
  constructor(e, t) {
2187
2292
  super(e, t);
2188
2293
  }
2189
2294
  _toCDN(e, t) {
2190
2295
  if (e?.appStrings === !1) return super._toCDN(e, t);
2191
- let n = this.tag === U ? 4 : 16, r = this.content;
2192
- if (r instanceof M) {
2296
+ let n = this.tag === G ? 4 : 16, r = this.content;
2297
+ if (r instanceof P) {
2193
2298
  if (r.encodingWidth !== void 0) return super._toCDN(e, t);
2194
- let n = x(e, this.encodingWidth, () => b(this.tag));
2195
- return `${H}'${an(r.value)}'${n}`;
2299
+ let n = w(e, this.encodingWidth, () => C(this.tag));
2300
+ return `${W}'${nn(r.value)}'${n}`;
2196
2301
  }
2197
- if (r instanceof F && r.items.length === 2 && r.items[0] instanceof O && r.items[1] instanceof M) {
2302
+ if (r instanceof L && r.items.length === 2 && r.items[0] instanceof A && r.items[1] instanceof P) {
2198
2303
  if (r.encodingWidth !== void 0 || r.items[0].encodingWidth !== void 0 || r.items[1].encodingWidth !== void 0) return super._toCDN(e, t);
2199
- let i = Number(r.items[0].value), a = sn(r.items[1].value, n), o = x(e, this.encodingWidth, () => b(this.tag));
2200
- return `${H}'${an(a)}/${i}'${o}`;
2304
+ let i = Number(r.items[0].value), a = an(r.items[1].value, n), o = w(e, this.encodingWidth, () => C(this.tag));
2305
+ return `${W}'${nn(a)}/${i}'${o}`;
2201
2306
  }
2202
2307
  return super._toCDN(e, t);
2203
2308
  }
2204
2309
  };
2205
- function dn(e, t) {
2310
+ function ln(e, t) {
2206
2311
  let n = t.indexOf("/");
2207
2312
  if (n === -1) {
2208
- let { bytes: n, isV4: r } = rn(t);
2209
- return e === H ? new un(r ? U : en, new M(n)) : new cn(n);
2313
+ let { bytes: n, isV4: r } = tn(t);
2314
+ return e === W ? new cn(r ? G : Qt, new P(n)) : new on(n);
2210
2315
  }
2211
2316
  let r = t.slice(0, n), i = t.slice(n + 1);
2212
2317
  if (!/^\d+$/.test(i)) throw SyntaxError(`ip: invalid prefix length: ${JSON.stringify(i)}`);
2213
- let a = parseInt(i, 10), { bytes: o, isV4: s } = rn(r), c = s ? 32 : 128;
2318
+ let a = parseInt(i, 10), { bytes: o, isV4: s } = tn(r), c = s ? 32 : 128;
2214
2319
  if (a > c) throw SyntaxError(`ip: prefix length ${a} exceeds maximum ${c} for ${s ? "IPv4" : "IPv6"}`);
2215
- let l = on(o, a);
2216
- return e === H ? new un(s ? U : en, new F([new O(BigInt(a)), new M(l)])) : new ln(a, l, s);
2320
+ let l = rn(o, a);
2321
+ return e === W ? new cn(s ? G : Qt, new L([new A(BigInt(a)), new P(l)])) : new sn(a, l, s);
2217
2322
  }
2218
- var fn = {
2219
- appStringPrefixes: [$t, H],
2220
- tagNumbers: [U, en],
2323
+ var un = {
2324
+ appStringPrefixes: [Zt, W],
2325
+ tagNumbers: [G, Qt],
2221
2326
  parseAppString(e, t) {
2222
- return dn(e, t);
2327
+ return ln(e, t);
2223
2328
  },
2224
2329
  parseAppSequence(e, t) {
2225
- return dn(e, nn(t));
2330
+ return ln(e, en(t));
2226
2331
  },
2227
2332
  parseTag(e, t) {
2228
- if (!(e !== U && e !== en) && (t instanceof M || t instanceof F)) return new un(e, t);
2333
+ if (!(e !== G && e !== Qt) && (t instanceof P || t instanceof L)) return new cn(e, t);
2229
2334
  }
2230
- }, pn = "cri", mn = "CRI", hn = 99n, gn = /* @__PURE__ */ new Map([
2335
+ }, dn = "cri", fn = "CRI", pn = 99n, mn = /* @__PURE__ */ new Map([
2231
2336
  ["coap", -1n],
2232
2337
  ["coaps", -2n],
2233
2338
  ["http", -3n],
@@ -2238,47 +2343,47 @@ var fn = {
2238
2343
  ["coaps+tcp", -8n],
2239
2344
  ["coap+ws", -25n],
2240
2345
  ["coaps+ws", -26n]
2241
- ]), _n = new Map([...gn.entries()].map(([e, t]) => [t, e]));
2242
- function W(e) {
2346
+ ]), hn = new Map([...mn.entries()].map(([e, t]) => [t, e]));
2347
+ function K(e) {
2243
2348
  try {
2244
2349
  return decodeURIComponent(e);
2245
2350
  } catch {
2246
2351
  return e;
2247
2352
  }
2248
2353
  }
2249
- var vn = new TextEncoder(), yn = new TextDecoder("utf-8", { fatal: !0 });
2250
- function bn(e) {
2251
- return Array.from(vn.encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
2354
+ var gn = new TextEncoder(), _n = new TextDecoder("utf-8", { fatal: !0 });
2355
+ function vn(e) {
2356
+ return Array.from(gn.encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
2252
2357
  }
2253
- function G(e, t) {
2358
+ function q(e, t) {
2254
2359
  let n = "";
2255
- for (let r of e) n += t(r) ? r : bn(r);
2360
+ for (let r of e) n += t(r) ? r : vn(r);
2256
2361
  return n;
2257
2362
  }
2258
- function xn(e) {
2363
+ function yn(e) {
2259
2364
  return /[A-Za-z0-9\-._~]/.test(e);
2260
2365
  }
2261
- function Sn(e) {
2366
+ function bn(e) {
2262
2367
  return /[!$&'()*+,;=]/.test(e);
2263
2368
  }
2369
+ function xn(e) {
2370
+ return yn(e) || bn(e) || e === ":" || e === "@";
2371
+ }
2372
+ function Sn(e) {
2373
+ return (xn(e) || e === "/" || e === "?") && e !== "&";
2374
+ }
2264
2375
  function Cn(e) {
2265
- return xn(e) || Sn(e) || e === ":" || e === "@";
2376
+ return xn(e) || e === "/" || e === "?";
2266
2377
  }
2267
2378
  function wn(e) {
2268
- return (Cn(e) || e === "/" || e === "?") && e !== "&";
2379
+ return yn(e) || bn(e) || e === ":";
2269
2380
  }
2270
2381
  function Tn(e) {
2271
- return Cn(e) || e === "/" || e === "?";
2382
+ return yn(e) || bn(e);
2272
2383
  }
2273
2384
  function En(e) {
2274
- return xn(e) || Sn(e) || e === ":";
2275
- }
2276
- function Dn(e) {
2277
- return xn(e) || Sn(e);
2278
- }
2279
- function On(e) {
2280
2385
  let t = [], n = e, r = n.indexOf("@");
2281
- r >= 0 && (t.push(L.FALSE), t.push(new B(W(n.slice(0, r)))), n = n.slice(r + 1));
2386
+ r >= 0 && (t.push(z.FALSE), t.push(new H(K(n.slice(0, r)))), n = n.slice(r + 1));
2282
2387
  let i, a = null;
2283
2388
  if (n.startsWith("[")) {
2284
2389
  let e = n.indexOf("]");
@@ -2287,263 +2392,263 @@ function On(e) {
2287
2392
  let r = n.slice(e + 1);
2288
2393
  if (r.startsWith(":")) a = r.slice(1);
2289
2394
  else if (r.length > 0) throw SyntaxError("cri: unexpected characters after ']' in authority");
2290
- t.push(new M(Xt(i)));
2395
+ t.push(new P(Jt(i)));
2291
2396
  } else {
2292
2397
  let e = n.lastIndexOf(":");
2293
- if (e >= 0 ? (i = n.slice(0, e), a = n.slice(e + 1)) : i = n, i !== "") if (/^\d{1,3}(\.\d{1,3}){3}$/.test(i)) t.push(new M(Yt(i)));
2294
- else for (let e of i.toLowerCase().split(".")) t.push(new B(e));
2398
+ if (e >= 0 ? (i = n.slice(0, e), a = n.slice(e + 1)) : i = n, i !== "") if (/^\d{1,3}(\.\d{1,3}){3}$/.test(i)) t.push(new P(qt(i)));
2399
+ else for (let e of i.toLowerCase().split(".")) t.push(new H(e));
2295
2400
  }
2296
2401
  if (a !== null && a !== "") {
2297
2402
  if (!/^\d+$/.test(a)) throw SyntaxError(`cri: invalid port: ${JSON.stringify(a)}`);
2298
2403
  let e = parseInt(a, 10);
2299
2404
  if (e > 65535) throw SyntaxError(`cri: port ${e} out of range`);
2300
- t.push(new O(BigInt(e)));
2405
+ t.push(new A(BigInt(e)));
2301
2406
  }
2302
- return new F(t);
2407
+ return new L(t);
2303
2408
  }
2304
- function kn(e) {
2409
+ function Dn(e) {
2305
2410
  let t = e.items, n = 0, r = "";
2306
- if (n < t.length && t[n] instanceof L && t[n].value === 20) {
2411
+ if (n < t.length && t[n] instanceof z && t[n].value === 20) {
2307
2412
  n++;
2308
2413
  let e = t[n++];
2309
- r += G(e.value, En) + "@";
2414
+ r += q(e.value, wn) + "@";
2310
2415
  }
2311
2416
  if (n >= t.length) return r;
2312
2417
  let i = t[n];
2313
- if (i instanceof M) {
2418
+ if (i instanceof P) {
2314
2419
  n++;
2315
2420
  let { length: e } = i.value;
2316
- if (e === 4) r += Zt(i.value);
2317
- else if (e === 16) r += "[" + Qt(i.value) + "]";
2421
+ if (e === 4) r += Yt(i.value);
2422
+ else if (e === 16) r += "[" + Xt(i.value) + "]";
2318
2423
  else throw Error(`cri: unexpected host-ip byte length: ${e}`);
2319
- n < t.length && t[n] instanceof B && (r += `%25${G(t[n++].value, Dn)}`);
2424
+ n < t.length && t[n] instanceof H && (r += `%25${q(t[n++].value, Tn)}`);
2320
2425
  } else {
2321
2426
  let e = [];
2322
- for (; n < t.length && t[n] instanceof B;) e.push(G(t[n++].value, Dn));
2427
+ for (; n < t.length && t[n] instanceof H;) e.push(q(t[n++].value, Tn));
2323
2428
  r += e.join(".");
2324
2429
  }
2325
- return n < t.length && t[n] instanceof O && (r += ":" + t[n].value.toString()), r;
2430
+ return n < t.length && t[n] instanceof A && (r += ":" + t[n].value.toString()), r;
2326
2431
  }
2327
- function An(e) {
2432
+ function On(e) {
2328
2433
  let t = e.slice(2), n = t.indexOf("/"), r, i;
2329
- return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new B(W(e)))) : (r = t, i = []), {
2330
- authority: On(r),
2434
+ return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new H(K(e)))) : (r = t, i = []), {
2435
+ authority: En(r),
2331
2436
  pathSegments: i
2332
2437
  };
2333
2438
  }
2334
- function jn(e) {
2439
+ function kn(e) {
2335
2440
  let t = e, n = null, r = t.indexOf("#");
2336
- r >= 0 && (n = W(t.slice(r + 1)), t = t.slice(0, r));
2441
+ r >= 0 && (n = K(t.slice(r + 1)), t = t.slice(0, r));
2337
2442
  let i = null, a = t.indexOf("?");
2338
2443
  if (a >= 0) {
2339
2444
  let e = t.slice(a + 1);
2340
- t = t.slice(0, a), i = e.split("&").map((e) => new B(W(e)));
2445
+ t = t.slice(0, a), i = e.split("&").map((e) => new H(K(e)));
2341
2446
  }
2342
2447
  let o = [], s = /^([a-zA-Z][a-zA-Z0-9+.\-]*):([\s\S]*)$/.exec(t);
2343
2448
  if (s) {
2344
- let e = s[1].toLowerCase(), t = s[2], n = gn.get(e);
2345
- if (o.push(n === void 0 ? new B(e) : new k(n)), t.startsWith("//")) {
2346
- let { authority: e, pathSegments: n } = An(t);
2347
- o.push(e, new F(n));
2449
+ let e = s[1].toLowerCase(), t = s[2], n = mn.get(e);
2450
+ if (o.push(n === void 0 ? new H(e) : new j(n)), t.startsWith("//")) {
2451
+ let { authority: e, pathSegments: n } = On(t);
2452
+ o.push(e, new L(n));
2348
2453
  } else if (t.startsWith("/")) {
2349
- let e = t.slice(1).split("/").map((e) => new B(W(e)));
2350
- o.push(L.NULL, new F(e));
2454
+ let e = t.slice(1).split("/").map((e) => new H(K(e)));
2455
+ o.push(z.NULL, new L(e));
2351
2456
  } else {
2352
- let e = t.split("/").map((e) => new B(W(e)));
2353
- o.push(L.TRUE, new F(e));
2457
+ let e = t.split("/").map((e) => new H(K(e)));
2458
+ o.push(z.TRUE, new L(e));
2354
2459
  }
2355
2460
  } else if (t.startsWith("//")) {
2356
- let { authority: e, pathSegments: n } = An(t);
2357
- o.push(L.FALSE, e, new F(n));
2461
+ let { authority: e, pathSegments: n } = On(t);
2462
+ o.push(z.FALSE, e, new L(n));
2358
2463
  } else if (t.startsWith("/")) {
2359
- let e = t.slice(1).split("/").map((e) => new B(W(e)));
2360
- o.push(L.TRUE, new F(e));
2361
- } else if (t === "") o.push(new O(0n));
2464
+ let e = t.slice(1).split("/").map((e) => new H(K(e)));
2465
+ o.push(z.TRUE, new L(e));
2466
+ } else if (t === "") o.push(new A(0n));
2362
2467
  else {
2363
2468
  let n = 1n, r = t, i = !1;
2364
2469
  for (r.startsWith("./") && (i = !0, r = r.slice(2)); r.startsWith("../");) n++, r = r.slice(3);
2365
2470
  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)}`);
2366
- let a = r === "" ? [] : r.split("/").map((e) => new B(W(e)));
2367
- o.push(new O(n), new F(a));
2471
+ let a = r === "" ? [] : r.split("/").map((e) => new H(K(e)));
2472
+ o.push(new A(n), new L(a));
2368
2473
  }
2369
- if (i !== null && o.push(new F(i)), n !== null && (i === null && o.push(L.NULL), o.push(new B(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
2474
+ if (i !== null && o.push(new L(i)), n !== null && (i === null && o.push(z.NULL), o.push(new H(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
2370
2475
  let e = o[o.length - 1];
2371
- e instanceof F && e.items.length === 0 && o.pop();
2476
+ e instanceof L && e.items.length === 0 && o.pop();
2372
2477
  }
2373
- return o.length === 1 && o[0] instanceof O && o[0].value === 0n ? [] : o;
2478
+ return o.length === 1 && o[0] instanceof A && o[0].value === 0n ? [] : o;
2374
2479
  }
2375
- function K(e, t) {
2480
+ function An(e, t) {
2376
2481
  let n = t, r = "";
2377
2482
  if (n < e.length) {
2378
2483
  let t = e[n];
2379
- if (t instanceof F) {
2484
+ if (t instanceof L) {
2380
2485
  if (n++, t.items.length > 0) {
2381
2486
  let e = t.items.map((e) => {
2382
- if (!(e instanceof B)) throw Error("cri: query item must be a text string");
2383
- return G(e.value, wn);
2487
+ if (!(e instanceof H)) throw Error("cri: query item must be a text string");
2488
+ return q(e.value, Sn);
2384
2489
  });
2385
2490
  r += "?" + e.join("&");
2386
2491
  }
2387
- } else t instanceof L && t.value === 22 && n++;
2492
+ } else t instanceof z && t.value === 22 && n++;
2388
2493
  }
2389
- return n < e.length && e[n] instanceof B && (r += "#" + G(e[n].value, Tn)), r;
2494
+ return n < e.length && e[n] instanceof H && (r += "#" + q(e[n].value, Cn)), r;
2390
2495
  }
2391
- function Mn(e) {
2496
+ function jn(e) {
2392
2497
  return e.items.map((e) => {
2393
- if (!(e instanceof B)) throw Error("cri: path segment must be a text string");
2394
- return G(e.value, Cn);
2498
+ if (!(e instanceof H)) throw Error("cri: path segment must be a text string");
2499
+ return q(e.value, xn);
2395
2500
  });
2396
2501
  }
2397
- function Nn(e) {
2502
+ function Mn(e) {
2398
2503
  if (e.length === 0) return "";
2399
2504
  let t = 0, n = e[t++];
2400
- if (n instanceof k || n instanceof B) {
2505
+ if (n instanceof j || n instanceof H) {
2401
2506
  let r;
2402
- if (n instanceof k) {
2403
- let e = _n.get(n.value);
2507
+ if (n instanceof j) {
2508
+ let e = hn.get(n.value);
2404
2509
  if (e === void 0) throw Error(`cri: unrecognised scheme-id ${n.value}`);
2405
2510
  r = e + ":";
2406
2511
  } else r = n.value + ":";
2407
2512
  if (t >= e.length) return r;
2408
2513
  let i = e[t++], a = "", o = !1;
2409
- if (i instanceof F) a = "//" + kn(i), o = !0;
2410
- else if (i instanceof L) if (i.value === 22) o = !0;
2514
+ if (i instanceof L) a = "//" + Dn(i), o = !0;
2515
+ else if (i instanceof z) if (i.value === 22) o = !0;
2411
2516
  else if (i.value === 21) o = !1;
2412
2517
  else throw Error(`cri: unexpected no-authority value: simple(${i.value})`);
2413
2518
  else throw Error("cri: unexpected type for authority element");
2414
2519
  let s = "";
2415
- if (t < e.length && e[t] instanceof F) {
2520
+ if (t < e.length && e[t] instanceof L) {
2416
2521
  let n = e[t++];
2417
- n.items.length > 0 && (s = (o ? "/" : "") + Mn(n).join("/"));
2522
+ n.items.length > 0 && (s = (o ? "/" : "") + jn(n).join("/"));
2418
2523
  }
2419
- return r + a + s + K(e, t);
2524
+ return r + a + s + An(e, t);
2420
2525
  }
2421
- if (n instanceof L && n.value === 20) {
2422
- if (t >= e.length || !(e[t] instanceof F)) throw Error("cri: network-path reference requires an authority array");
2423
- let n = kn(e[t++]), r = "";
2424
- if (t < e.length && e[t] instanceof F) {
2526
+ if (n instanceof z && n.value === 20) {
2527
+ if (t >= e.length || !(e[t] instanceof L)) throw Error("cri: network-path reference requires an authority array");
2528
+ let n = Dn(e[t++]), r = "";
2529
+ if (t < e.length && e[t] instanceof L) {
2425
2530
  let n = e[t++];
2426
- n.items.length > 0 && (r = "/" + Mn(n).join("/"));
2531
+ n.items.length > 0 && (r = "/" + jn(n).join("/"));
2427
2532
  }
2428
- return "//" + n + r + K(e, t);
2533
+ return "//" + n + r + An(e, t);
2429
2534
  }
2430
- if (n instanceof L && n.value === 21) {
2535
+ if (n instanceof z && n.value === 21) {
2431
2536
  let n = "/";
2432
- if (t < e.length && e[t] instanceof F) {
2537
+ if (t < e.length && e[t] instanceof L) {
2433
2538
  let r = e[t++];
2434
- n = "/" + Mn(r).join("/");
2539
+ n = "/" + jn(r).join("/");
2435
2540
  }
2436
- return n + K(e, t);
2541
+ return n + An(e, t);
2437
2542
  }
2438
- if (n instanceof O) {
2543
+ if (n instanceof A) {
2439
2544
  let r = n.value;
2440
- if (r === 0n) return K(e, t);
2545
+ if (r === 0n) return An(e, t);
2441
2546
  let i = r === 1n ? "" : "../".repeat(Number(r) - 1), a;
2442
- if (t < e.length && e[t] instanceof F) {
2547
+ if (t < e.length && e[t] instanceof L) {
2443
2548
  let n = e[t++];
2444
2549
  if (n.items.length > 0) {
2445
- let e = Mn(n);
2550
+ let e = jn(n);
2446
2551
  a = (r === 1n && e[0].includes(":") ? "./" : i) + e.join("/");
2447
2552
  } else a = i === "" ? "./" : i;
2448
2553
  } else a = i === "" ? "./" : i;
2449
- return a + K(e, t);
2554
+ return a + An(e, t);
2450
2555
  }
2451
2556
  throw Error("cri: unrecognised first element type in CRI array");
2452
2557
  }
2453
- var Pn = class extends F {
2558
+ var Nn = class extends L {
2454
2559
  _toCDN(e, t) {
2455
2560
  if (e?.appStrings === !1) return super._toCDN(e, t);
2456
2561
  try {
2457
- let t = x(e, this.encodingWidth, () => b(BigInt(this.items.length)));
2458
- return `${pn}'${Nn(this.items)}'${t}`;
2562
+ let t = w(e, this.encodingWidth, () => C(BigInt(this.items.length)));
2563
+ return `${dn}'${Mn(this.items)}'${t}`;
2459
2564
  } catch {
2460
2565
  return super._toCDN(e, t);
2461
2566
  }
2462
2567
  }
2463
- }, Fn = class extends j {
2568
+ }, Pn = class extends N {
2464
2569
  constructor(e) {
2465
- super(hn, e);
2570
+ super(pn, e);
2466
2571
  }
2467
2572
  _toCDN(e, t) {
2468
2573
  if (e?.appStrings === !1) return super._toCDN(e, t);
2469
2574
  try {
2470
2575
  let n = this.content;
2471
2576
  if (n.encodingWidth !== void 0) return super._toCDN(e, t);
2472
- let r = x(e, this.encodingWidth, () => b(hn));
2473
- return `${mn}'${Nn(n.items)}'${r}`;
2577
+ let r = w(e, this.encodingWidth, () => C(pn));
2578
+ return `${fn}'${Mn(n.items)}'${r}`;
2474
2579
  } catch {
2475
2580
  return super._toCDN(e, t);
2476
2581
  }
2477
2582
  }
2478
2583
  };
2479
- function In(e) {
2584
+ function Fn(e) {
2480
2585
  if (e.length !== 1) throw SyntaxError("cri<<...>>: expected exactly one item");
2481
2586
  let t = e[0];
2482
- if (t instanceof B) return t.value;
2483
- if (t instanceof M) return yn.decode(t.value);
2587
+ if (t instanceof H) return t.value;
2588
+ if (t instanceof P) return _n.decode(t.value);
2484
2589
  throw SyntaxError("cri<<...>>: expected a text string or byte string");
2485
2590
  }
2486
- function Ln(e, t) {
2487
- let n = new Pn(jn(t));
2488
- return e === mn ? new Fn(n) : n;
2591
+ function In(e, t) {
2592
+ let n = new Nn(kn(t));
2593
+ return e === fn ? new Pn(n) : n;
2489
2594
  }
2490
- var Rn = {
2491
- appStringPrefixes: [pn, mn],
2492
- tagNumbers: [hn],
2595
+ var Ln = {
2596
+ appStringPrefixes: [dn, fn],
2597
+ tagNumbers: [pn],
2493
2598
  parseAppString(e, t) {
2494
- return Ln(e, t);
2599
+ return In(e, t);
2495
2600
  },
2496
2601
  parseAppSequence(e, t) {
2497
- return Ln(e, In(t));
2602
+ return In(e, Fn(t));
2498
2603
  },
2499
2604
  parseTag(e, t) {
2500
- if (e !== 99n || !(t instanceof F)) return;
2501
- let n = new Pn(t.items, {
2605
+ if (e !== 99n || !(t instanceof L)) return;
2606
+ let n = new Nn(t.items, {
2502
2607
  indefiniteLength: t.indefiniteLength,
2503
2608
  encodingWidth: t.encodingWidth
2504
2609
  });
2505
- return n.start = t.start, n.end = t.end, new Fn(n);
2610
+ return n.start = t.start, n.end = t.end, new Pn(n);
2506
2611
  }
2507
- }, zn = 18446744073709551615n, Bn = -18446744073709551616n, Vn = {
2508
- tagNumbers: [Ye, Xe],
2612
+ }, Rn = 18446744073709551615n, zn = -18446744073709551616n, Bn = {
2613
+ tagNumbers: [qe, Je],
2509
2614
  parseTag(e, t) {
2510
- if (t instanceof M) {
2615
+ if (t instanceof P) {
2511
2616
  if (e === 2n) {
2512
- let e = et(t.value);
2513
- return e > zn ? new tt(e) : void 0;
2617
+ let e = Qe(t.value);
2618
+ return e > Rn ? new $e(e) : void 0;
2514
2619
  }
2515
2620
  if (e === 3n) {
2516
- let e = -1n - et(t.value);
2517
- return e < Bn ? new nt(e) : void 0;
2621
+ let e = -1n - Qe(t.value);
2622
+ return e < zn ? new et(e) : void 0;
2518
2623
  }
2519
2624
  }
2520
2625
  }
2521
2626
  };
2522
2627
  //#endregion
2523
2628
  //#region src/cbor/decoder.ts
2524
- function Hn(e, t) {
2629
+ function Vn(e, t) {
2525
2630
  if (e === 24 && t <= 23n) return 0;
2526
2631
  if (e === 25 && t <= 255n) return 1;
2527
2632
  if (e === 26 && t <= 65535n) return 2;
2528
2633
  if (e === 27 && t <= 4294967295n) return 3;
2529
2634
  }
2530
- function Un(e, t) {
2635
+ function Hn(e, t) {
2531
2636
  if (e === 24 && t <= 23) return 0;
2532
2637
  if (e === 25 && t <= 255) return 1;
2533
2638
  if (e === 26 && t <= 65535) return 2;
2534
2639
  if (e === 27 && t <= 4294967295) return 3;
2535
2640
  }
2536
- var Wn = new TextDecoder("utf-8", {
2641
+ var Un = new TextDecoder("utf-8", {
2537
2642
  fatal: !0,
2538
2643
  ignoreBOM: !0
2539
- }), Gn = new TextDecoder("utf-8", {
2644
+ }), Wn = new TextDecoder("utf-8", {
2540
2645
  fatal: !1,
2541
2646
  ignoreBOM: !0
2542
2647
  });
2543
- function q(e) {
2648
+ function J(e) {
2544
2649
  throw Error(`CBOR decode error: ${e}`);
2545
2650
  }
2546
- function Kn(e, t, n) {
2651
+ function Gn(e, t, n) {
2547
2652
  let r = {
2548
2653
  message: e,
2549
2654
  offset: t
@@ -2551,51 +2656,51 @@ function Kn(e, t, n) {
2551
2656
  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}`);
2552
2657
  return r;
2553
2658
  }
2554
- function J(e, t) {
2659
+ function Y(e, t) {
2555
2660
  e.warnings ??= [], e.warnings.push(t);
2556
2661
  }
2557
- function Y(e) {
2558
- if (e instanceof O) return ["u", String(e.value)];
2559
- if (e instanceof k) return ["n", String(e.value)];
2560
- if (e instanceof B) return ["t", e.value];
2561
- if (e instanceof P) return ["t", e.chunks.map((e) => e.value).join("")];
2562
- if (e instanceof M) return ["b", i(e.value)];
2563
- if (e instanceof N) {
2662
+ function Kn(e) {
2663
+ if (e instanceof A) return ["u", String(e.value)];
2664
+ if (e instanceof j) return ["n", String(e.value)];
2665
+ if (e instanceof H) return ["t", e.value];
2666
+ if (e instanceof I) return ["t", e.chunks.map((e) => e.value).join("")];
2667
+ if (e instanceof P) return ["b", i(e.value)];
2668
+ if (e instanceof F) {
2564
2669
  let t = "";
2565
2670
  for (let n of e.chunks) t += i(n.value);
2566
2671
  return ["b", t];
2567
2672
  }
2568
- if (e instanceof A) return isNaN(e.value) ? ["f", "NaN"] : Object.is(e.value, -0) ? ["f", "-0"] : ["f", String(e.value)];
2569
- if (e instanceof L) return ["s", e.value];
2570
- if (e instanceof F) return ["A", e.items.map(Y)];
2571
- if (e instanceof I) {
2572
- let t = e.entries.map(([e, t]) => [Y(e), Y(t)]);
2673
+ if (e instanceof M) return isNaN(e.value) ? ["f", "NaN"] : Object.is(e.value, -0) ? ["f", "-0"] : ["f", String(e.value)];
2674
+ if (e instanceof z) return ["s", e.value];
2675
+ if (e instanceof L) return ["A", e.items.map(Kn)];
2676
+ if (e instanceof R) {
2677
+ let t = e.entries.map(([e, t]) => [Kn(e), Kn(t)]);
2573
2678
  if (t.length <= 1) return ["M", t];
2574
2679
  let n = t.map((e) => [JSON.stringify(e[0]), e]);
2575
2680
  return n.sort((e, t) => e[0] < t[0] ? -1 : +(e[0] > t[0])), ["M", n.map((e) => e[1])];
2576
2681
  }
2577
- return e instanceof j ? [
2682
+ return e instanceof N ? [
2578
2683
  "G",
2579
2684
  String(e.tag),
2580
- Y(e.content)
2685
+ Kn(e.content)
2581
2686
  ] : ["c", i(e.toCBOR())];
2582
2687
  }
2583
2688
  function qn(e) {
2584
- if (e instanceof O) return "u" + e.value;
2585
- if (e instanceof k) return "n" + e.value;
2586
- if (e instanceof B) return "t" + e.value;
2587
- if (e instanceof P) {
2689
+ if (e instanceof A) return "u" + e.value;
2690
+ if (e instanceof j) return "n" + e.value;
2691
+ if (e instanceof H) return "t" + e.value;
2692
+ if (e instanceof I) {
2588
2693
  let t = "t";
2589
2694
  for (let n of e.chunks) t += n.value;
2590
2695
  return t;
2591
2696
  }
2592
- if (e instanceof M) return "b" + i(e.value);
2593
- if (e instanceof N) {
2697
+ if (e instanceof P) return "b" + i(e.value);
2698
+ if (e instanceof F) {
2594
2699
  let t = "b";
2595
2700
  for (let n of e.chunks) t += i(n.value);
2596
2701
  return t;
2597
2702
  }
2598
- return e instanceof A ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof L ? "s" + e.value : JSON.stringify(Y(e));
2703
+ return e instanceof M ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof z ? "s" + e.value : JSON.stringify(Kn(e));
2599
2704
  }
2600
2705
  var Jn = Array.from({ length: 24 }, (e, t) => BigInt(t)), Yn;
2601
2706
  function Xn(e) {
@@ -2611,23 +2716,23 @@ function Qn(e, t, n) {
2611
2716
  nextOffset: t
2612
2717
  };
2613
2718
  switch (n) {
2614
- case 24: return t + 1 > e.byteLength && q("unexpected end of input"), {
2719
+ case 24: return t + 1 > e.byteLength && J("unexpected end of input"), {
2615
2720
  value: BigInt(e.getUint8(t)),
2616
2721
  nextOffset: t + 1
2617
2722
  };
2618
- case 25: return t + 2 > e.byteLength && q("unexpected end of input"), {
2723
+ case 25: return t + 2 > e.byteLength && J("unexpected end of input"), {
2619
2724
  value: BigInt(e.getUint16(t, !1)),
2620
2725
  nextOffset: t + 2
2621
2726
  };
2622
- case 26: return t + 4 > e.byteLength && q("unexpected end of input"), {
2727
+ case 26: return t + 4 > e.byteLength && J("unexpected end of input"), {
2623
2728
  value: BigInt(e.getUint32(t, !1)),
2624
2729
  nextOffset: t + 4
2625
2730
  };
2626
- case 27: return t + 8 > e.byteLength && q("unexpected end of input"), {
2731
+ case 27: return t + 8 > e.byteLength && J("unexpected end of input"), {
2627
2732
  value: e.getBigUint64(t, !1),
2628
2733
  nextOffset: t + 8
2629
2734
  };
2630
- default: q(`reserved additional info value: ${n}`);
2735
+ default: J(`reserved additional info value: ${n}`);
2631
2736
  }
2632
2737
  }
2633
2738
  function $n(e, t, n) {
@@ -2636,38 +2741,38 @@ function $n(e, t, n) {
2636
2741
  nextOffset: t
2637
2742
  };
2638
2743
  switch (n) {
2639
- case 24: return t + 1 > e.byteLength && q("unexpected end of input"), {
2744
+ case 24: return t + 1 > e.byteLength && J("unexpected end of input"), {
2640
2745
  value: e.getUint8(t),
2641
2746
  nextOffset: t + 1
2642
2747
  };
2643
- case 25: return t + 2 > e.byteLength && q("unexpected end of input"), {
2748
+ case 25: return t + 2 > e.byteLength && J("unexpected end of input"), {
2644
2749
  value: e.getUint16(t, !1),
2645
2750
  nextOffset: t + 2
2646
2751
  };
2647
- case 26: return t + 4 > e.byteLength && q("unexpected end of input"), {
2752
+ case 26: return t + 4 > e.byteLength && J("unexpected end of input"), {
2648
2753
  value: e.getUint32(t, !1),
2649
2754
  nextOffset: t + 4
2650
2755
  };
2651
2756
  case 27: {
2652
- t + 8 > e.byteLength && q("unexpected end of input");
2757
+ t + 8 > e.byteLength && J("unexpected end of input");
2653
2758
  let n = e.getUint32(t, !1), r = e.getUint32(t + 4, !1);
2654
2759
  return {
2655
2760
  value: n * 4294967296 + r,
2656
2761
  nextOffset: t + 8
2657
2762
  };
2658
2763
  }
2659
- default: q(`reserved additional info value: ${n}`);
2764
+ default: J(`reserved additional info value: ${n}`);
2660
2765
  }
2661
2766
  }
2662
2767
  function er(e, t, n, r, i, a) {
2663
2768
  let o = [], s = t;
2664
2769
  for (;;) {
2665
- if (s >= e.byteLength && q(`unexpected end of indefinite ${i}`), e.getUint8(s) === 255) {
2770
+ if (s >= e.byteLength && J(`unexpected end of indefinite ${i}`), e.getUint8(s) === 255) {
2666
2771
  s++;
2667
2772
  break;
2668
2773
  }
2669
2774
  let t = X(e, s, n, r);
2670
- a(t.value) || q(`indefinite-length ${i} chunk must be a definite ${i}`), o.push(t.value), s = t.nextOffset;
2775
+ a(t.value) || J(`indefinite-length ${i} chunk must be a definite ${i}`), o.push(t.value), s = t.nextOffset;
2671
2776
  }
2672
2777
  return {
2673
2778
  chunks: o,
@@ -2676,7 +2781,7 @@ function er(e, t, n, r, i, a) {
2676
2781
  }
2677
2782
  function tr(e, t, n, r) {
2678
2783
  let i = qn(e);
2679
- t.has(i) && n.push(Kn(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
2784
+ t.has(i) && n.push(Gn(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
2680
2785
  }
2681
2786
  function X(e, t, n, r) {
2682
2787
  let i = t, a = rr(e, t, n, r);
@@ -2686,56 +2791,56 @@ function nr(e, t, n) {
2686
2791
  return new Uint8Array(e.buffer, e.byteOffset + t, n).slice();
2687
2792
  }
2688
2793
  function rr(e, t, n, r) {
2689
- t >= e.byteLength && q("unexpected end of input");
2794
+ t >= e.byteLength && J("unexpected end of input");
2690
2795
  let i = e.getUint8(t++), a = i >> 5, o = i & 31;
2691
2796
  switch (a) {
2692
2797
  case 0: {
2693
2798
  let { value: n, nextOffset: r } = Qn(e, t, o);
2694
2799
  return {
2695
- value: new O(n, { encodingWidth: Hn(o, n) }),
2800
+ value: new A(n, { encodingWidth: Vn(o, n) }),
2696
2801
  nextOffset: r
2697
2802
  };
2698
2803
  }
2699
2804
  case 1: {
2700
- let { value: n, nextOffset: r } = Qn(e, t, o), i = Hn(o, n);
2805
+ let { value: n, nextOffset: r } = Qn(e, t, o), i = Vn(o, n);
2701
2806
  return {
2702
- value: new k(-1n - n, { encodingWidth: i }),
2807
+ value: new j(-1n - n, { encodingWidth: i }),
2703
2808
  nextOffset: r
2704
2809
  };
2705
2810
  }
2706
2811
  case 2: {
2707
2812
  if (o === 31) {
2708
- let { chunks: i, nextOffset: a } = er(e, t, n, r, "byte string", (e) => e instanceof M);
2813
+ let { chunks: i, nextOffset: a } = er(e, t, n, r, "byte string", (e) => e instanceof P);
2709
2814
  return {
2710
- value: new N(i),
2815
+ value: new F(i),
2711
2816
  nextOffset: a
2712
2817
  };
2713
2818
  }
2714
- let { value: i, nextOffset: a } = $n(e, t, o), s = Un(o, i);
2715
- return a + i > e.byteLength && q("byte string extends beyond input"), {
2716
- value: new M(new Uint8Array(e.buffer, e.byteOffset + a, i).slice(), { encodingWidth: s }),
2819
+ let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i);
2820
+ return a + i > e.byteLength && J("byte string extends beyond input"), {
2821
+ value: new P(new Uint8Array(e.buffer, e.byteOffset + a, i).slice(), { encodingWidth: s }),
2717
2822
  nextOffset: a + i
2718
2823
  };
2719
2824
  }
2720
2825
  case 3: {
2721
2826
  if (o === 31) {
2722
- let { chunks: i, nextOffset: a } = er(e, t, n, r, "text string", (e) => e instanceof B);
2827
+ let { chunks: i, nextOffset: a } = er(e, t, n, r, "text string", (e) => e instanceof H);
2723
2828
  return {
2724
- value: new P(i),
2829
+ value: new I(i),
2725
2830
  nextOffset: a
2726
2831
  };
2727
2832
  }
2728
- let { value: i, nextOffset: a } = $n(e, t, o), s = Un(o, i);
2729
- a + i > e.byteLength && q("text string extends beyond input");
2833
+ let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i);
2834
+ a + i > e.byteLength && J("text string extends beyond input");
2730
2835
  let c = new Uint8Array(e.buffer, e.byteOffset + a, i), l, u, d = i < 64 ? Zn(c, i) : void 0;
2731
2836
  if (d !== void 0) l = d;
2732
2837
  else try {
2733
- l = Wn.decode(c);
2838
+ l = Un.decode(c);
2734
2839
  } catch {
2735
- u = Kn("invalid UTF-8 sequence in text string", a, n), l = Gn.decode(c);
2840
+ u = Gn("invalid UTF-8 sequence in text string", a, n), l = Wn.decode(c);
2736
2841
  }
2737
- let f = new B(l, { encodingWidth: s });
2738
- return u && J(f, u), {
2842
+ let f = new H(l, { encodingWidth: s });
2843
+ return u && Y(f, u), {
2739
2844
  value: f,
2740
2845
  nextOffset: a + i
2741
2846
  };
@@ -2744,7 +2849,7 @@ function rr(e, t, n, r) {
2744
2849
  if (o === 31) {
2745
2850
  let i = [], a = t;
2746
2851
  for (;;) {
2747
- if (a >= e.byteLength && q("unexpected end of indefinite array"), e.getUint8(a) === 255) {
2852
+ if (a >= e.byteLength && J("unexpected end of indefinite array"), e.getUint8(a) === 255) {
2748
2853
  a++;
2749
2854
  break;
2750
2855
  }
@@ -2752,17 +2857,17 @@ function rr(e, t, n, r) {
2752
2857
  i.push(t.value), a = t.nextOffset;
2753
2858
  }
2754
2859
  return {
2755
- value: new F(i, { indefiniteLength: !0 }),
2860
+ value: new L(i, { indefiniteLength: !0 }),
2756
2861
  nextOffset: a
2757
2862
  };
2758
2863
  }
2759
- let { value: i, nextOffset: a } = $n(e, t, o), s = Un(o, i), c = [], l = a;
2864
+ let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i), c = [], l = a;
2760
2865
  for (let t = 0; t < i; t++) {
2761
2866
  let t = X(e, l, n, r);
2762
2867
  c.push(t.value), l = t.nextOffset;
2763
2868
  }
2764
2869
  return {
2765
- value: new F(c, { encodingWidth: s }),
2870
+ value: new L(c, { encodingWidth: s }),
2766
2871
  nextOffset: l
2767
2872
  };
2768
2873
  }
@@ -2770,7 +2875,7 @@ function rr(e, t, n, r) {
2770
2875
  if (o === 31) {
2771
2876
  let i = [], a = /* @__PURE__ */ new Set(), o = [], s = t;
2772
2877
  for (;;) {
2773
- if (s >= e.byteLength && q("unexpected end of indefinite map"), e.getUint8(s) === 255) {
2878
+ if (s >= e.byteLength && J("unexpected end of indefinite map"), e.getUint8(s) === 255) {
2774
2879
  s++;
2775
2880
  break;
2776
2881
  }
@@ -2779,83 +2884,83 @@ function rr(e, t, n, r) {
2779
2884
  let c = X(e, s, n, r);
2780
2885
  s = c.nextOffset, i.push([t.value, c.value]);
2781
2886
  }
2782
- let c = new I(i, { indefiniteLength: !0 });
2783
- for (let e of o) J(c, e);
2887
+ let c = new R(i, { indefiniteLength: !0 });
2888
+ for (let e of o) Y(c, e);
2784
2889
  return {
2785
2890
  value: c,
2786
2891
  nextOffset: s
2787
2892
  };
2788
2893
  }
2789
- let { value: i, nextOffset: a } = $n(e, t, o), s = Un(o, i), c = [], l = /* @__PURE__ */ new Set(), u = [], d = a;
2894
+ let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i), c = [], l = /* @__PURE__ */ new Set(), u = [], d = a;
2790
2895
  for (let t = 0; t < i; t++) {
2791
2896
  let t = X(e, d, n, r);
2792
2897
  tr(t.value, l, u, n), d = t.nextOffset;
2793
2898
  let i = X(e, d, n, r);
2794
2899
  d = i.nextOffset, c.push([t.value, i.value]);
2795
2900
  }
2796
- let f = new I(c, { encodingWidth: s });
2797
- for (let e of u) J(f, e);
2901
+ let f = new R(c, { encodingWidth: s });
2902
+ for (let e of u) Y(f, e);
2798
2903
  return {
2799
2904
  value: f,
2800
2905
  nextOffset: d
2801
2906
  };
2802
2907
  }
2803
2908
  case 6: {
2804
- o === 31 && q("tags cannot use indefinite-length encoding");
2805
- let { value: i, nextOffset: a } = Qn(e, t, o), s = Hn(o, i), c = X(e, a, n, r);
2909
+ o === 31 && J("tags cannot use indefinite-length encoding");
2910
+ let { value: i, nextOffset: a } = Qn(e, t, o), s = Vn(o, i), c = X(e, a, n, r);
2806
2911
  for (let e of r) {
2807
2912
  let t = e.parseTag(i, c.value, n);
2808
- if (t !== void 0) return t instanceof j && s !== void 0 && (t.encodingWidth = s), {
2913
+ if (t !== void 0) return t instanceof N && s !== void 0 && (t.encodingWidth = s), {
2809
2914
  value: t,
2810
2915
  nextOffset: c.nextOffset
2811
2916
  };
2812
2917
  }
2813
2918
  return {
2814
- value: new j(i, c.value, { encodingWidth: s }),
2919
+ value: new N(i, c.value, { encodingWidth: s }),
2815
2920
  nextOffset: c.nextOffset
2816
2921
  };
2817
2922
  }
2818
2923
  case 7:
2819
2924
  if (o <= 19) return {
2820
- value: new L(o),
2925
+ value: new z(o),
2821
2926
  nextOffset: t
2822
2927
  };
2823
2928
  if (o === 20) return {
2824
- value: new L(20),
2929
+ value: new z(20),
2825
2930
  nextOffset: t
2826
2931
  };
2827
2932
  if (o === 21) return {
2828
- value: new L(21),
2933
+ value: new z(21),
2829
2934
  nextOffset: t
2830
2935
  };
2831
2936
  if (o === 22) return {
2832
- value: new L(22),
2937
+ value: new z(22),
2833
2938
  nextOffset: t
2834
2939
  };
2835
2940
  if (o === 23) return {
2836
- value: new L(23),
2941
+ value: new z(23),
2837
2942
  nextOffset: t
2838
2943
  };
2839
2944
  if (o === 24) {
2840
- t + 1 > e.byteLength && q("unexpected end of input");
2945
+ t + 1 > e.byteLength && J("unexpected end of input");
2841
2946
  let r = e.getUint8(t);
2842
2947
  if (r < 32) {
2843
- let e = Kn(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`, t - 1, n), i = new L(r);
2844
- return J(i, e), {
2948
+ let e = Gn(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`, t - 1, n), i = new z(r);
2949
+ return Y(i, e), {
2845
2950
  value: i,
2846
2951
  nextOffset: t + 1
2847
2952
  };
2848
2953
  }
2849
2954
  return {
2850
- value: new L(r),
2955
+ value: new z(r),
2851
2956
  nextOffset: t + 1
2852
2957
  };
2853
2958
  }
2854
2959
  if (o === 25) {
2855
- t + 2 > e.byteLength && q("unexpected end of input");
2856
- let n = C(e.getUint16(t, !1));
2960
+ t + 2 > e.byteLength && J("unexpected end of input");
2961
+ let n = E(e.getUint16(t, !1));
2857
2962
  return {
2858
- value: new A(n, {
2963
+ value: new M(n, {
2859
2964
  precision: "half",
2860
2965
  rawBits: Number.isNaN(n) ? nr(e, t, 2) : void 0
2861
2966
  }),
@@ -2863,10 +2968,10 @@ function rr(e, t, n, r) {
2863
2968
  };
2864
2969
  }
2865
2970
  if (o === 26) {
2866
- t + 4 > e.byteLength && q("unexpected end of input");
2971
+ t + 4 > e.byteLength && J("unexpected end of input");
2867
2972
  let n = e.getFloat32(t, !1);
2868
2973
  return {
2869
- value: new A(n, {
2974
+ value: new M(n, {
2870
2975
  precision: "single",
2871
2976
  rawBits: Number.isNaN(n) ? nr(e, t, 4) : void 0
2872
2977
  }),
@@ -2874,19 +2979,19 @@ function rr(e, t, n, r) {
2874
2979
  };
2875
2980
  }
2876
2981
  if (o === 27) {
2877
- t + 8 > e.byteLength && q("unexpected end of input");
2982
+ t + 8 > e.byteLength && J("unexpected end of input");
2878
2983
  let n = e.getFloat64(t, !1);
2879
2984
  return {
2880
- value: new A(n, {
2985
+ value: new M(n, {
2881
2986
  precision: "double",
2882
2987
  rawBits: Number.isNaN(n) ? nr(e, t, 8) : void 0
2883
2988
  }),
2884
2989
  nextOffset: t + 8
2885
2990
  };
2886
2991
  }
2887
- return o < 31 && q(`reserved additional info value in major type 7: ${o}`), q("unexpected break code outside indefinite-length item");
2992
+ return o < 31 && J(`reserved additional info value in major type 7: ${o}`), J("unexpected break code outside indefinite-length item");
2888
2993
  }
2889
- return q(`unknown major type: ${a}`);
2994
+ return J(`unknown major type: ${a}`);
2890
2995
  }
2891
2996
  function ir(e) {
2892
2997
  if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new Uint8Array(e);
@@ -2898,7 +3003,7 @@ function ar(e, t) {
2898
3003
  if (!Number.isInteger(i) || i < 0 || i > r.byteLength) throw RangeError(`CBOR decode offset must be an integer between 0 and ${r.byteLength}`);
2899
3004
  let a = Xn(t?.builtinExtensions), o = t?.extensions?.length ? [...t.extensions.filter((e) => e.parseTag !== void 0), ...a] : a, { value: s, nextOffset: c } = X(r, i, t, o);
2900
3005
  if (!t?.allowTrailing && c !== r.byteLength) {
2901
- J(s, Kn(`${r.byteLength - c} trailing byte(s) after end of CBOR item`, c, t));
3006
+ Y(s, Gn(`${r.byteLength - c} trailing byte(s) after end of CBOR item`, c, t));
2902
3007
  let e = {
2903
3008
  strict: !1,
2904
3009
  silent: !0
@@ -2912,18 +3017,26 @@ function ar(e, t) {
2912
3017
  var or = 24n, sr = {
2913
3018
  tagNumbers: [or],
2914
3019
  parseTag(e, t, n) {
2915
- if (e !== 24n || !(t instanceof M)) return;
2916
- let r = n ? {
3020
+ if (e !== 24n || !(t instanceof P)) return;
3021
+ let r = (t.end ?? t.value.length) - t.value.length, i = n ? {
2917
3022
  extensions: n.extensions,
2918
3023
  builtinExtensions: n.builtinExtensions,
2919
3024
  strict: n.strict,
2920
- onWarning: n.onWarning,
3025
+ onWarning: n.onWarning ? (e) => n.onWarning({
3026
+ ...e,
3027
+ offset: e.offset + r
3028
+ }) : void 0,
2921
3029
  silent: n.silent
2922
3030
  } : void 0;
2923
3031
  try {
2924
- return new j(or, new We([ar(t.value, r)], { encodingWidth: t.encodingWidth }));
3032
+ return new N(or, new He([ar(t.value, i)], { encodingWidth: t.encodingWidth }));
2925
3033
  } catch (e) {
2926
- if (r?.strict !== !1) throw e;
3034
+ if (i?.strict !== !1) throw e;
3035
+ let t = `tag 24 content is not valid CBOR: ${e instanceof Error ? e.message : String(e)}`, a = {
3036
+ message: t,
3037
+ offset: r
3038
+ };
3039
+ n?.onWarning ? n.onWarning(a) : n?.silent || console.warn(`CBOR strict violation at offset ${a.offset}: ${t}`);
2927
3040
  return;
2928
3041
  }
2929
3042
  }
@@ -2931,15 +3044,15 @@ var or = 24n, sr = {
2931
3044
  //#endregion
2932
3045
  //#region src/extensions/ellipsis.ts
2933
3046
  function cr(e) {
2934
- return e instanceof R && !(e.content instanceof F);
3047
+ return e instanceof B && !(e.content instanceof L);
2935
3048
  }
2936
3049
  function lr(e) {
2937
3050
  let t = !1, n = !1, r = !1, i;
2938
3051
  for (let a of e) {
2939
3052
  let e;
2940
3053
  if (cr(a)) e = !0, r = !0;
2941
- else if (a instanceof B) e = !1, t = !0;
2942
- else if (a instanceof M) e = !1, n = !0;
3054
+ else if (a instanceof H) e = !1, t = !0;
3055
+ else if (a instanceof P) e = !1, n = !0;
2943
3056
  else return !1;
2944
3057
  if (e === i) return !1;
2945
3058
  i = e;
@@ -2947,11 +3060,11 @@ function lr(e) {
2947
3060
  return r && !(t && n);
2948
3061
  }
2949
3062
  var ur = {
2950
- tagNumbers: [Je],
3063
+ tagNumbers: [Ke],
2951
3064
  parseTag(e, t) {
2952
3065
  if (e === 888n) {
2953
- if (t instanceof L && t.value === 22) return new R();
2954
- if (t instanceof F && lr(t.items)) return new R(t.items);
3066
+ if (t instanceof z && t.value === 22) return new B();
3067
+ if (t instanceof L && lr(t.items)) return new B(t.items);
2955
3068
  }
2956
3069
  }
2957
3070
  }, dr = new TextEncoder(), fr = new TextDecoder("utf-8", { fatal: !0 }), pr = new TextDecoder("utf-8", { fatal: !1 }), mr = Symbol("ellipsis");
@@ -2963,28 +3076,28 @@ function hr(e) {
2963
3076
  return n;
2964
3077
  }
2965
3078
  function gr(e, t, n) {
2966
- if (t instanceof qe) {
3079
+ if (t instanceof Ge) {
2967
3080
  gr(e, t.inner, n);
2968
3081
  return;
2969
3082
  }
2970
- if (t instanceof R) {
2971
- if (t.content instanceof F) for (let r of t.content.items) gr(e, r, n);
3083
+ if (t instanceof B) {
3084
+ if (t.content instanceof L) for (let r of t.content.items) gr(e, r, n);
2972
3085
  else n.push(mr);
2973
3086
  return;
2974
3087
  }
2975
- if (t instanceof B) {
3088
+ if (t instanceof H) {
2976
3089
  n.push(dr.encode(t.value));
2977
3090
  return;
2978
3091
  }
2979
- if (t instanceof M) {
3092
+ if (t instanceof P) {
2980
3093
  n.push(t.value);
2981
3094
  return;
2982
3095
  }
2983
- if (t instanceof P) {
3096
+ if (t instanceof I) {
2984
3097
  n.push(dr.encode(t.chunks.map((e) => e.value).join("")));
2985
3098
  return;
2986
3099
  }
2987
- if (t instanceof N) {
3100
+ if (t instanceof F) {
2988
3101
  n.push(hr(t.chunks.map((e) => e.value)));
2989
3102
  return;
2990
3103
  }
@@ -3006,21 +3119,21 @@ function vr(e, t, n) {
3006
3119
  let i = e === "t1", a = [], o = !1, s = [], c = () => {
3007
3120
  if (s.length === 0) return;
3008
3121
  let e = hr(s);
3009
- s.length = 0, e.length !== 0 && a.push(i ? new B(_r(e, n)) : new M(e));
3122
+ s.length = 0, e.length !== 0 && a.push(i ? new H(_r(e, n)) : new P(e));
3010
3123
  };
3011
- for (let e of r) e === mr ? (c(), a[a.length - 1] instanceof R || (a.push(new R()), o = !0)) : s.push(e);
3124
+ for (let e of r) e === mr ? (c(), a[a.length - 1] instanceof B || (a.push(new B()), o = !0)) : s.push(e);
3012
3125
  if (!o) {
3013
3126
  let e = hr(s);
3014
- return i ? new B(_r(e, n)) : new M(e);
3127
+ return i ? new H(_r(e, n)) : new P(e);
3015
3128
  }
3016
- return c(), a.length === 1 ? new R() : new R(a);
3129
+ return c(), a.length === 1 ? new B() : new B(a);
3017
3130
  }
3018
3131
  function yr(e) {
3019
3132
  return {
3020
3133
  appStringPrefixes: [e],
3021
3134
  preserveAppSeqSource: !0,
3022
3135
  parseAppString(t, n, r) {
3023
- return vr(e, [new B(n)], r);
3136
+ return vr(e, [new H(n)], r);
3024
3137
  },
3025
3138
  parseAppSequence(t, n, r) {
3026
3139
  return vr(e, n, r);
@@ -3038,12 +3151,12 @@ function Tr(e) {
3038
3151
  function Er(e, t, n) {
3039
3152
  let r = e === "ilts", i = [], a = [];
3040
3153
  for (let o of t) {
3041
- if (o instanceof qe && (o = o.inner), o instanceof R) throw SyntaxError(`${e}<<...>> cannot contain ellipses; there is no way to include an elision in an indefinite-length string`);
3154
+ if (o instanceof Ge && (o = o.inner), o instanceof B) throw SyntaxError(`${e}<<...>> cannot contain ellipses; there is no way to include an elision in an indefinite-length string`);
3042
3155
  let t, s, c;
3043
- if (o instanceof B) t = o.value, c = o.encodingWidth;
3044
- else if (o instanceof M) s = o.value, c = o.encodingWidth;
3045
- else if (o instanceof P) t = o.chunks.map((e) => e.value).join("");
3046
- else if (o instanceof N) s = Tr(o.chunks.map((e) => e.value));
3156
+ if (o instanceof H) t = o.value, c = o.encodingWidth;
3157
+ else if (o instanceof P) s = o.value, c = o.encodingWidth;
3158
+ else if (o instanceof I) t = o.chunks.map((e) => e.value).join("");
3159
+ else if (o instanceof F) s = Tr(o.chunks.map((e) => e.value));
3047
3160
  else throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings`);
3048
3161
  if (r) {
3049
3162
  let e;
@@ -3056,20 +3169,20 @@ function Er(e, t, n) {
3056
3169
  else throw SyntaxError(t);
3057
3170
  e = wr.decode(s);
3058
3171
  }
3059
- a.push(new B(e, c === void 0 ? void 0 : { encodingWidth: c }));
3172
+ a.push(new H(e, c === void 0 ? void 0 : { encodingWidth: c }));
3060
3173
  } else {
3061
3174
  let e = s ?? Sr.encode(t);
3062
- i.push(new M(e, c === void 0 ? void 0 : { encodingWidth: c }));
3175
+ i.push(new P(e, c === void 0 ? void 0 : { encodingWidth: c }));
3063
3176
  }
3064
3177
  }
3065
- return r ? new P(a) : new N(i);
3178
+ return r ? new I(a) : new F(i);
3066
3179
  }
3067
3180
  function Dr(e) {
3068
3181
  return {
3069
3182
  appStringPrefixes: [e],
3070
3183
  preserveAppSeqSource: !0,
3071
3184
  parseAppString(t, n, r) {
3072
- return new qe(Er(e, [new B(n)], r), `${e}${xe(n)}`);
3185
+ return new Ge(Er(e, [new H(n)], r), `${e}${ve(n)}`);
3073
3186
  },
3074
3187
  parseAppSequence(t, n, r) {
3075
3188
  return Er(e, n, r);
@@ -3114,10 +3227,10 @@ function Ar(e) {
3114
3227
  }
3115
3228
  //#endregion
3116
3229
  //#region src/extensions/float.ts
3117
- var jr = class extends A {
3230
+ var jr = class extends M {
3118
3231
  _bits;
3119
3232
  constructor(e) {
3120
- super(C(e), { precision: "half" }), this._bits = e & 65535;
3233
+ super(E(e), { precision: "half" }), this._bits = e & 65535;
3121
3234
  }
3122
3235
  _toCBOR() {
3123
3236
  return new Uint8Array([
@@ -3126,7 +3239,7 @@ var jr = class extends A {
3126
3239
  this._bits & 255
3127
3240
  ]);
3128
3241
  }
3129
- }, Mr = class extends A {
3242
+ }, Mr = class extends M {
3130
3243
  _raw;
3131
3244
  constructor(e) {
3132
3245
  super(new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), { precision: "single" }), this._raw = e.slice();
@@ -3135,7 +3248,7 @@ var jr = class extends A {
3135
3248
  let e = /* @__PURE__ */ new Uint8Array(5);
3136
3249
  return e[0] = 250, e.set(this._raw, 1), e;
3137
3250
  }
3138
- }, Nr = class extends A {
3251
+ }, Nr = class extends M {
3139
3252
  _raw;
3140
3253
  constructor(e) {
3141
3254
  super(new DataView(e.buffer, e.byteOffset).getFloat64(0, !1), { precision: "double" }), this._raw = e.slice();
@@ -3194,15 +3307,15 @@ function Rr(e, t, n) {
3194
3307
  if (r === 2) {
3195
3308
  if (t === 3) return new Nr(Lr(e));
3196
3309
  if (t === 1) {
3197
- let t = new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), r = S(t);
3198
- return !Object.is(C(r), t) && !isNaN(t) && n("float'...' value cannot be exactly represented as float16 (_1)"), new jr(r);
3310
+ let t = new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), r = T(t);
3311
+ return !Object.is(E(r), t) && !isNaN(t) && n("float'...' value cannot be exactly represented as float16 (_1)"), new jr(r);
3199
3312
  }
3200
3313
  }
3201
3314
  if (r === 3) {
3202
3315
  let r = new DataView(e.buffer, e.byteOffset).getFloat64(0, !1);
3203
3316
  if (t === 1) {
3204
- let e = S(r);
3205
- return !Object.is(C(e), r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float16 (_1)"), new jr(e);
3317
+ let e = T(r);
3318
+ return !Object.is(E(e), r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float16 (_1)"), new jr(e);
3206
3319
  }
3207
3320
  if (t === 2) {
3208
3321
  let e = Math.fround(r);
@@ -3237,17 +3350,17 @@ var zr = {
3237
3350
  if (n) n(e);
3238
3351
  else throw SyntaxError(e);
3239
3352
  }
3240
- if (!(t[0] instanceof M)) throw SyntaxError("float<<...>> item must be a byte string");
3353
+ if (!(t[0] instanceof P)) throw SyntaxError("float<<...>> item must be a byte string");
3241
3354
  return Pr(t[0].value);
3242
3355
  }
3243
3356
  }, Br = [
3244
- Vn,
3357
+ Bn,
3245
3358
  sr,
3246
3359
  ur
3247
3360
  ], Vr = [
3248
- qt,
3249
- fn,
3250
- Rn,
3361
+ Gt,
3362
+ un,
3363
+ Ln,
3251
3364
  br,
3252
3365
  xr,
3253
3366
  Or,
@@ -3285,7 +3398,7 @@ function Gr(e) {
3285
3398
  function Kr(e, t) {
3286
3399
  if (t?.replacer) {
3287
3400
  let { replacer: n, ...r } = t, i = Jr(e, n, r.extensions, r.undefinedOmits, r.builtinExtensions);
3288
- return i === h ? L.UNDEFINED : Kr(i, Object.keys(r).length > 0 ? r : void 0);
3401
+ return i === h ? z.UNDEFINED : Kr(i, Object.keys(r).length > 0 ? r : void 0);
3289
3402
  }
3290
3403
  return Q(e, t, !0, Gr(t));
3291
3404
  }
@@ -3300,27 +3413,27 @@ function Q(e, t, n, r) {
3300
3413
  let t = e.parseTag(n, i);
3301
3414
  if (t !== void 0) return t;
3302
3415
  }
3303
- return new j(n, i);
3304
- }
3305
- if (e instanceof m.Null) return L.NULL;
3306
- if (e instanceof m.Undefined) return L.UNDEFINED;
3307
- if (e instanceof g) return new L(e.value);
3308
- if (e === null) return L.NULL;
3309
- if (e === void 0) return L.UNDEFINED;
3310
- if (e === !0) return L.TRUE;
3311
- if (e === !1) return L.FALSE;
3312
- if (typeof e == "bigint") return e > 18446744073709551615n ? new tt(e) : e < -18446744073709551616n ? new nt(e) : e >= 0n ? new O(e) : new k(e);
3313
- if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new O(BigInt(e)) : new k(BigInt(e)) : new A(e);
3314
- if (typeof e == "string") return new B(e);
3416
+ return new N(n, i);
3417
+ }
3418
+ if (e instanceof m.Null) return z.NULL;
3419
+ if (e instanceof m.Undefined) return z.UNDEFINED;
3420
+ if (e instanceof g) return new z(e.value);
3421
+ if (e === null) return z.NULL;
3422
+ if (e === void 0) return z.UNDEFINED;
3423
+ if (e === !0) return z.TRUE;
3424
+ if (e === !1) return z.FALSE;
3425
+ if (typeof e == "bigint") return e > 18446744073709551615n ? new $e(e) : e < -18446744073709551616n ? new et(e) : e >= 0n ? new A(e) : new j(e);
3426
+ if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new A(BigInt(e)) : new j(BigInt(e)) : new M(e);
3427
+ if (typeof e == "string") return new H(e);
3315
3428
  if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return Q(e.valueOf(), t, !1, r);
3316
- if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new M(new Uint8Array(e));
3317
- if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new F(Array.from(e, (e) => new O(BigInt(e)))) : new M(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
3318
- if (e instanceof $) return new I([...e].map(([e, n]) => [Q(e, t, !0, r), Q(n, t, !0, r)]));
3319
- if (Array.isArray(e)) return new F(e.map((e) => Q(e, t, !0, r)));
3429
+ if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new P(new Uint8Array(e));
3430
+ if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new L(Array.from(e, (e) => new A(BigInt(e)))) : new P(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
3431
+ if (e instanceof $) return new R([...e].map(([e, n]) => [Q(e, t, !0, r), Q(n, t, !0, r)]));
3432
+ if (Array.isArray(e)) return new L(e.map((e) => Q(e, t, !0, r)));
3320
3433
  if (typeof e == "object") {
3321
3434
  let n = [];
3322
- for (let [i, a] of Object.entries(e)) n.push([new B(i), Q(a, t, !0, r)]);
3323
- return new I(n);
3435
+ for (let [i, a] of Object.entries(e)) n.push([new H(i), Q(a, t, !0, r)]);
3436
+ return new R(n);
3324
3437
  }
3325
3438
  throw TypeError(`fromJS: unsupported value type: ${typeof e}`);
3326
3439
  }
@@ -3403,6 +3516,6 @@ var $ = class extends Array {
3403
3516
  }
3404
3517
  };
3405
3518
  //#endregion
3406
- export { O as A, F as C, j as D, M as E, s as F, m as I, c as L, g as M, h as N, A as O, o as P, I as S, N as T, ot as _, zr as a, We as b, kr as c, ar as d, Rn as f, B as g, Jt as h, Vr as i, D as j, k, xr as l, qt as m, Jr as n, Ar as o, fn as p, Kr as r, Or as s, $ as t, br as u, nt as v, P as w, L as x, tt as y };
3519
+ export { A, L as C, N as D, P as E, s as F, m as I, c as L, g as M, h as N, M as O, o as P, R as S, F as T, it as _, zr as a, He as b, kr as c, ar as d, Ln as f, H as g, Kt as h, Vr as i, k as j, j as k, xr as l, Gt as m, Jr as n, Ar as o, un as p, Kr as r, Or as s, $ as t, br as u, et as v, I as w, z as x, $e as y };
3407
3520
 
3408
- //# sourceMappingURL=mapEntries-KwZz9nq2.js.map
3521
+ //# sourceMappingURL=mapEntries-hyNVtz5Z.js.map