@cbortech/cbor 0.26.1 → 0.26.2
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.
- package/README.ja.md +7 -0
- package/README.md +7 -0
- package/dist/ast/index.cjs +1 -1
- package/dist/ast/index.js +1 -1
- package/dist/extensions/builtins.d.ts +4 -4
- package/dist/extensions/ellipsis.d.ts +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{mapEntries-Bys9cXgV.cjs → mapEntries-CZLpI8fS.cjs} +8 -8
- package/dist/mapEntries-CZLpI8fS.cjs.map +1 -0
- package/dist/{mapEntries-ClxYqDPp.js → mapEntries-KwZz9nq2.js} +634 -603
- package/dist/mapEntries-KwZz9nq2.js.map +1 -0
- package/package.json +7 -7
- package/dist/mapEntries-Bys9cXgV.cjs.map +0 -1
- package/dist/mapEntries-ClxYqDPp.js.map +0 -1
|
@@ -420,12 +420,12 @@ function Le(e) {
|
|
|
420
420
|
function Re(e) {
|
|
421
421
|
return Ie.setFloat32(0, e, !1), Object.is(Ie.getFloat32(0, !1), e);
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function ze(e) {
|
|
424
424
|
return Le(e) ? "half" : Re(e) ? "single" : "double";
|
|
425
425
|
}
|
|
426
426
|
//#endregion
|
|
427
427
|
//#region src/ast/CborItem.ts
|
|
428
|
-
var
|
|
428
|
+
var D = class e {
|
|
429
429
|
start;
|
|
430
430
|
end;
|
|
431
431
|
comments;
|
|
@@ -493,7 +493,7 @@ var O = class e {
|
|
|
493
493
|
comment: this._toCDN(n, 0)
|
|
494
494
|
}];
|
|
495
495
|
}
|
|
496
|
-
},
|
|
496
|
+
}, O = class extends D {
|
|
497
497
|
value;
|
|
498
498
|
encodingWidth;
|
|
499
499
|
constructor(e, t) {
|
|
@@ -517,7 +517,7 @@ var O = class e {
|
|
|
517
517
|
let t = e?.integerAs ?? "auto";
|
|
518
518
|
return t === "bigint" ? this.value : t === "number" || this.value <= BigInt(2 ** 53 - 1) ? Number(this.value) : this.value;
|
|
519
519
|
}
|
|
520
|
-
},
|
|
520
|
+
}, k = class extends D {
|
|
521
521
|
argument;
|
|
522
522
|
encodingWidth;
|
|
523
523
|
constructor(e, t) {
|
|
@@ -546,8 +546,8 @@ var O = class e {
|
|
|
546
546
|
let t = this.value, n = e?.integerAs ?? "auto";
|
|
547
547
|
return n === "bigint" ? t : n === "number" || t >= BigInt(-(2 ** 53 - 1)) ? Number(t) : t;
|
|
548
548
|
}
|
|
549
|
-
},
|
|
550
|
-
function
|
|
549
|
+
}, Be = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
|
|
550
|
+
function Ve(e) {
|
|
551
551
|
let t = e.startsWith("-"), n = e.slice(t ? 3 : 2), r = n.search(/[pP]/);
|
|
552
552
|
if (r === -1) throw SyntaxError(`EDN parse error: hex float missing 'p' exponent: ${e}`);
|
|
553
553
|
let i = n.slice(0, r), a = n.slice(r + 1);
|
|
@@ -565,20 +565,20 @@ function Be(e) {
|
|
|
565
565
|
let l = c * 2 ** o;
|
|
566
566
|
return t ? -l : l;
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function He(e) {
|
|
569
569
|
if (isNaN(e)) return "NaN";
|
|
570
570
|
if (!isFinite(e)) return e > 0 ? "Infinity" : "-Infinity";
|
|
571
571
|
let t = Object.is(e, -0) || e < 0, n = Math.abs(e);
|
|
572
572
|
if (n === 0) return t ? "-0x0p+0" : "0x0p+0";
|
|
573
|
-
|
|
574
|
-
let r =
|
|
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;
|
|
575
575
|
a === 0 ? (u = "0", d = -1022) : (u = "1", d = a - 1023);
|
|
576
576
|
let f = d >= 0 ? `+${d}` : `${d}`, p = `0x${u}${l}p${f}`;
|
|
577
577
|
return t ? `-${p}` : p;
|
|
578
578
|
}
|
|
579
579
|
//#endregion
|
|
580
580
|
//#region src/ast/CborFloat.ts
|
|
581
|
-
var
|
|
581
|
+
var A = class extends D {
|
|
582
582
|
value;
|
|
583
583
|
precision;
|
|
584
584
|
ednSource;
|
|
@@ -587,7 +587,7 @@ var j = class extends O {
|
|
|
587
587
|
super(), this.value = e, this.precision = t?.precision, this.rawBits = t?.rawBits;
|
|
588
588
|
}
|
|
589
589
|
_encodeTo(e, t) {
|
|
590
|
-
let n = this.precision ??
|
|
590
|
+
let n = this.precision ?? ze(this.value), r = Number.isNaN(this.value) ? this.rawBits : void 0;
|
|
591
591
|
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
592
|
}
|
|
593
593
|
_toCDN(e, t) {
|
|
@@ -596,18 +596,18 @@ var j = class extends O {
|
|
|
596
596
|
if (n === "never") return this.ednSource.replace(/_[0-3i]$/, "");
|
|
597
597
|
if (n === "always") {
|
|
598
598
|
if (/_[0-3i]$/.test(this.ednSource)) return this.ednSource;
|
|
599
|
-
let e = this.precision ??
|
|
599
|
+
let e = this.precision ?? ze(this.value), t = e === "half" ? "_1" : e === "single" ? "_2" : "_3";
|
|
600
600
|
return this.ednSource + t;
|
|
601
601
|
}
|
|
602
602
|
return this.ednSource;
|
|
603
603
|
}
|
|
604
|
-
let r =
|
|
605
|
-
return (e?.floatFormat === "hex" ?
|
|
604
|
+
let r = ze(this.value);
|
|
605
|
+
return (e?.floatFormat === "hex" ? He(this.value) : Ce(this.value)) + we(this.value, this.precision, r, n);
|
|
606
606
|
}
|
|
607
607
|
_toJS(e) {
|
|
608
608
|
return this.value;
|
|
609
609
|
}
|
|
610
|
-
},
|
|
610
|
+
}, j = class extends D {
|
|
611
611
|
tag;
|
|
612
612
|
content;
|
|
613
613
|
encodingWidth;
|
|
@@ -637,7 +637,7 @@ var j = class extends O {
|
|
|
637
637
|
let t = this.content._toJS(e);
|
|
638
638
|
return e?.stripTags ? t : m.set(t, this.tag);
|
|
639
639
|
}
|
|
640
|
-
},
|
|
640
|
+
}, M = class extends D {
|
|
641
641
|
indefiniteLength = !1;
|
|
642
642
|
value;
|
|
643
643
|
ednEncoding;
|
|
@@ -668,7 +668,7 @@ var j = class extends O {
|
|
|
668
668
|
_toJS(e) {
|
|
669
669
|
return this.value;
|
|
670
670
|
}
|
|
671
|
-
},
|
|
671
|
+
}, N = class extends D {
|
|
672
672
|
indefiniteLength = !0;
|
|
673
673
|
chunks;
|
|
674
674
|
constructor(e) {
|
|
@@ -683,7 +683,7 @@ var j = class extends O {
|
|
|
683
683
|
if ((e?.encodingIndicators ?? "auto") === "never") {
|
|
684
684
|
let t = this.chunks.reduce((e, t) => e + t.value.length, 0), n = new Uint8Array(t), r = 0;
|
|
685
685
|
for (let e of this.chunks) n.set(e.value, r), r += e.value.length;
|
|
686
|
-
return new
|
|
686
|
+
return new M(n)._toCDN(e, 0);
|
|
687
687
|
}
|
|
688
688
|
return this.chunks.length === 0 ? "''_" : `(_ ${this.chunks.map((t) => t._toCDN(e, 0)).join(", ")})`;
|
|
689
689
|
}
|
|
@@ -705,7 +705,7 @@ var j = class extends O {
|
|
|
705
705
|
for (let e of this.chunks) n.set(e.value, r), r += e.value.length;
|
|
706
706
|
return n;
|
|
707
707
|
}
|
|
708
|
-
},
|
|
708
|
+
}, P = class extends D {
|
|
709
709
|
indefiniteLength = !0;
|
|
710
710
|
chunks;
|
|
711
711
|
constructor(e) {
|
|
@@ -717,7 +717,7 @@ var j = class extends O {
|
|
|
717
717
|
e.writeByte(255);
|
|
718
718
|
}
|
|
719
719
|
_toCDN(e, t) {
|
|
720
|
-
return (e?.encodingIndicators ?? "auto") === "never" ? new
|
|
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(", ")})`;
|
|
721
721
|
}
|
|
722
722
|
_toHexDump(e, t) {
|
|
723
723
|
let r = [{
|
|
@@ -735,7 +735,7 @@ var j = class extends O {
|
|
|
735
735
|
_toJS(e) {
|
|
736
736
|
return this.chunks.map((e) => e.value).join("");
|
|
737
737
|
}
|
|
738
|
-
},
|
|
738
|
+
}, F = class extends D {
|
|
739
739
|
items;
|
|
740
740
|
indefiniteLength;
|
|
741
741
|
encodingWidth;
|
|
@@ -803,7 +803,7 @@ var j = class extends O {
|
|
|
803
803
|
}
|
|
804
804
|
return r;
|
|
805
805
|
}
|
|
806
|
-
},
|
|
806
|
+
}, I = class extends D {
|
|
807
807
|
entries;
|
|
808
808
|
indefiniteLength;
|
|
809
809
|
encodingWidth;
|
|
@@ -838,7 +838,7 @@ var j = class extends O {
|
|
|
838
838
|
entryLeadingNode: (e) => this.entries[e][0],
|
|
839
839
|
entryTrailing: (e, t) => {
|
|
840
840
|
let [n, r] = this.entries[e];
|
|
841
|
-
return
|
|
841
|
+
return Ue([
|
|
842
842
|
...n.comments?.trailing ?? [],
|
|
843
843
|
...r.comments?.leading ?? [],
|
|
844
844
|
...r.comments?.trailing ?? []
|
|
@@ -879,13 +879,13 @@ var j = class extends O {
|
|
|
879
879
|
}
|
|
880
880
|
return n;
|
|
881
881
|
};
|
|
882
|
-
return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof
|
|
882
|
+
return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof B) ? (() => {
|
|
883
883
|
let n = e ? {
|
|
884
884
|
...e,
|
|
885
885
|
reviver: void 0
|
|
886
886
|
} : void 0, r = {};
|
|
887
887
|
for (let [e, t] of this.entries) {
|
|
888
|
-
let i = e instanceof
|
|
888
|
+
let i = e instanceof B ? e.value : e.toCDN(), a = t._toJS(n);
|
|
889
889
|
i === "__proto__" ? Object.defineProperty(r, i, {
|
|
890
890
|
value: a,
|
|
891
891
|
writable: !0,
|
|
@@ -897,10 +897,10 @@ var j = class extends O {
|
|
|
897
897
|
let i = /* @__PURE__ */ new Map();
|
|
898
898
|
for (let e = 0; e < this.entries.length; e++) {
|
|
899
899
|
let [t] = this.entries[e];
|
|
900
|
-
i.set(t instanceof
|
|
900
|
+
i.set(t instanceof B ? t.value : t.toCDN(), e);
|
|
901
901
|
}
|
|
902
902
|
for (let n = 0; n < this.entries.length; n++) {
|
|
903
|
-
let [a, o] = this.entries[n], s = a instanceof
|
|
903
|
+
let [a, o] = this.entries[n], s = a instanceof B ? a.value : a.toCDN();
|
|
904
904
|
if (i.get(s) !== n) continue;
|
|
905
905
|
let c = o._toJS(e), l = t.call(r, s, c);
|
|
906
906
|
l === h || e?.undefinedOmits && l === void 0 ? delete r[s] : s === "__proto__" ? Object.defineProperty(r, s, {
|
|
@@ -914,12 +914,12 @@ var j = class extends O {
|
|
|
914
914
|
})() : n();
|
|
915
915
|
}
|
|
916
916
|
};
|
|
917
|
-
function
|
|
917
|
+
function Ue(e, t) {
|
|
918
918
|
return e.length === 0 ? "" : " " + e.map((e) => v(e, t).trimEnd()).join(" ");
|
|
919
919
|
}
|
|
920
920
|
//#endregion
|
|
921
921
|
//#region src/ast/CborSimple.ts
|
|
922
|
-
var
|
|
922
|
+
var L = class e extends D {
|
|
923
923
|
value;
|
|
924
924
|
constructor(e) {
|
|
925
925
|
if (super(), !Number.isInteger(e) || e < 0 || e > 255) throw RangeError("CborSimple value must be an integer in 0–255");
|
|
@@ -954,7 +954,7 @@ var R = class e extends O {
|
|
|
954
954
|
default: return new g(this.value);
|
|
955
955
|
}
|
|
956
956
|
}
|
|
957
|
-
},
|
|
957
|
+
}, We = class extends D {
|
|
958
958
|
items;
|
|
959
959
|
encodingWidth;
|
|
960
960
|
constructor(e, t) {
|
|
@@ -989,17 +989,17 @@ var R = class e extends O {
|
|
|
989
989
|
_toJS(e) {
|
|
990
990
|
return this._content();
|
|
991
991
|
}
|
|
992
|
-
},
|
|
992
|
+
}, Ge = 999n, Ke = class extends j {
|
|
993
993
|
constructor(e, t) {
|
|
994
|
-
let n = t.length === 1 && t[0] instanceof
|
|
995
|
-
super(
|
|
994
|
+
let n = t.length === 1 && t[0] instanceof B ? t[0] : new F(t);
|
|
995
|
+
super(Ge, new F([new B(e), n]));
|
|
996
996
|
}
|
|
997
997
|
_toCDN(e, t) {
|
|
998
998
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
999
999
|
let n = this.content, r = n.items[0].value, i = n.items[1];
|
|
1000
|
-
return i instanceof
|
|
1000
|
+
return i instanceof B ? `${r}${xe(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
|
|
1001
1001
|
}
|
|
1002
|
-
},
|
|
1002
|
+
}, qe = class extends D {
|
|
1003
1003
|
inner;
|
|
1004
1004
|
ednSource;
|
|
1005
1005
|
constructor(e, t) {
|
|
@@ -1015,15 +1015,15 @@ var R = class e extends O {
|
|
|
1015
1015
|
_toJS(e) {
|
|
1016
1016
|
return this.inner._toJS(e);
|
|
1017
1017
|
}
|
|
1018
|
-
},
|
|
1018
|
+
}, Je = 888n, R = class extends j {
|
|
1019
1019
|
constructor(e) {
|
|
1020
|
-
e === void 0 ? super(
|
|
1020
|
+
e === void 0 ? super(Je, L.NULL) : super(Je, new F(e));
|
|
1021
1021
|
}
|
|
1022
1022
|
_toCDN(e, t) {
|
|
1023
|
-
return this.content instanceof
|
|
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);
|
|
1024
1024
|
}
|
|
1025
|
-
},
|
|
1026
|
-
function
|
|
1025
|
+
}, Ye = 2n, Xe = 3n, Ze = 18446744073709551615n, Qe = -18446744073709551616n;
|
|
1026
|
+
function $e(e) {
|
|
1027
1027
|
if (e < 0n) throw RangeError("bigintToBytes requires a non-negative value");
|
|
1028
1028
|
if (e === 0n) return /* @__PURE__ */ new Uint8Array();
|
|
1029
1029
|
let t = e.toString(16);
|
|
@@ -1032,16 +1032,16 @@ function Qe(e) {
|
|
|
1032
1032
|
for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
|
|
1033
1033
|
return n;
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1035
|
+
function et(e) {
|
|
1036
1036
|
let t = 0n;
|
|
1037
1037
|
for (let n of e) t = t << 8n | BigInt(n);
|
|
1038
1038
|
return t;
|
|
1039
1039
|
}
|
|
1040
|
-
var
|
|
1040
|
+
var tt = class extends j {
|
|
1041
1041
|
bigValue;
|
|
1042
1042
|
constructor(e) {
|
|
1043
|
-
if (e <=
|
|
1044
|
-
super(
|
|
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;
|
|
1045
1045
|
}
|
|
1046
1046
|
_toCDN(e, t) {
|
|
1047
1047
|
return this.bigValue.toString();
|
|
@@ -1049,11 +1049,11 @@ var et = class extends M {
|
|
|
1049
1049
|
_toJS(e) {
|
|
1050
1050
|
return this.bigValue;
|
|
1051
1051
|
}
|
|
1052
|
-
},
|
|
1052
|
+
}, nt = class extends j {
|
|
1053
1053
|
bigValue;
|
|
1054
1054
|
constructor(e) {
|
|
1055
|
-
if (e >=
|
|
1056
|
-
super(
|
|
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;
|
|
1057
1057
|
}
|
|
1058
1058
|
_toCDN(e, t) {
|
|
1059
1059
|
return this.bigValue.toString();
|
|
@@ -1061,25 +1061,25 @@ var et = class extends M {
|
|
|
1061
1061
|
_toJS(e) {
|
|
1062
1062
|
return this.bigValue;
|
|
1063
1063
|
}
|
|
1064
|
-
},
|
|
1065
|
-
function
|
|
1064
|
+
}, rt = new TextEncoder(), it = new TextDecoder("utf-8", { fatal: !0 }), at = new TextDecoder("utf-8", { fatal: !1 });
|
|
1065
|
+
function ot(e, t) {
|
|
1066
1066
|
let n = new a(e, {
|
|
1067
1067
|
offset: t?.offset,
|
|
1068
1068
|
skipRS: t?._skipRS
|
|
1069
|
-
}), r = new
|
|
1070
|
-
return t?.preserveComments &&
|
|
1069
|
+
}), r = new vt(n, t ?? {}).parse();
|
|
1070
|
+
return t?.preserveComments && dt(r, n.comments, e), r;
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function st(e) {
|
|
1073
1073
|
let t = e, n;
|
|
1074
1074
|
return /[_][0-7i]$/.test(e) && (n = e[e.length - 1], t = e.slice(0, -2)), {
|
|
1075
1075
|
numStr: t,
|
|
1076
1076
|
rawSuffix: n
|
|
1077
1077
|
};
|
|
1078
1078
|
}
|
|
1079
|
-
function
|
|
1079
|
+
function ct(e) {
|
|
1080
1080
|
return e.startsWith("-") ? -BigInt(e.slice(1)) : BigInt(e);
|
|
1081
1081
|
}
|
|
1082
|
-
function
|
|
1082
|
+
function lt(e, t) {
|
|
1083
1083
|
if (e.endsWith("_i") || e.endsWith("_0")) {
|
|
1084
1084
|
let n = "_0 and _i encoding indicators are not valid for floating-point values";
|
|
1085
1085
|
if (t) t(n), e = e.slice(0, -2);
|
|
@@ -1103,14 +1103,14 @@ function ct(e, t) {
|
|
|
1103
1103
|
};
|
|
1104
1104
|
let n = e, r;
|
|
1105
1105
|
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:
|
|
1106
|
+
value: Ve(n),
|
|
1107
1107
|
precision: r
|
|
1108
1108
|
} : {
|
|
1109
1109
|
value: parseFloat(n),
|
|
1110
1110
|
precision: r
|
|
1111
1111
|
};
|
|
1112
1112
|
}
|
|
1113
|
-
function
|
|
1113
|
+
function ut(e, t) {
|
|
1114
1114
|
let n = e.indexOf("="), r = n >= 0 ? e.slice(0, n) : e, i = n >= 0 ? e.slice(n) : "";
|
|
1115
1115
|
if (/[^A-Za-z0-9+/\-_]/.test(r)) {
|
|
1116
1116
|
let e = [...r].find((e) => !/[A-Za-z0-9+/\-_]/.test(e)) ?? "";
|
|
@@ -1147,9 +1147,9 @@ function lt(e, t) {
|
|
|
1147
1147
|
for (let e = 0; e < c.length; e++) l[e] = c.charCodeAt(e);
|
|
1148
1148
|
return l;
|
|
1149
1149
|
}
|
|
1150
|
-
function
|
|
1150
|
+
function dt(e, t, n) {
|
|
1151
1151
|
if (t.length === 0) return;
|
|
1152
|
-
let r =
|
|
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;
|
|
1153
1153
|
for (let t of s) {
|
|
1154
1154
|
let r = { ...t }, s = 0, u = o.length;
|
|
1155
1155
|
for (; s < u;) {
|
|
@@ -1158,7 +1158,7 @@ function ut(e, t, n) {
|
|
|
1158
1158
|
}
|
|
1159
1159
|
let d = s > 0 ? o[s - 1] : void 0, f = d ? n.slice(d.end, t.start) : "";
|
|
1160
1160
|
if (d && i(d.end) === t.line && !f.includes(":")) {
|
|
1161
|
-
|
|
1161
|
+
pt(d.node, "trailing", r);
|
|
1162
1162
|
continue;
|
|
1163
1163
|
}
|
|
1164
1164
|
for (; l < a.length && a[l].start < t.start;) {
|
|
@@ -1174,38 +1174,38 @@ function ut(e, t, n) {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
let m = s < a.length ? a[s] : void 0;
|
|
1176
1176
|
if ((!p || m && m.end <= p.end) && m) {
|
|
1177
|
-
|
|
1177
|
+
pt(m.node, "leading", r);
|
|
1178
1178
|
continue;
|
|
1179
1179
|
}
|
|
1180
|
-
|
|
1180
|
+
pt(p?.node ?? e, "dangling", r);
|
|
1181
1181
|
}
|
|
1182
1182
|
}
|
|
1183
|
-
function
|
|
1183
|
+
function ft(e) {
|
|
1184
1184
|
let t = [], n = (e) => {
|
|
1185
1185
|
if (e.start !== void 0 && e.end !== void 0 && t.push({
|
|
1186
1186
|
node: e,
|
|
1187
1187
|
start: e.start,
|
|
1188
1188
|
end: e.end
|
|
1189
|
-
}), e instanceof
|
|
1189
|
+
}), e instanceof F || e instanceof We) {
|
|
1190
1190
|
for (let t of e.items) n(t);
|
|
1191
1191
|
return;
|
|
1192
1192
|
}
|
|
1193
|
-
if (e instanceof
|
|
1193
|
+
if (e instanceof I) {
|
|
1194
1194
|
for (let [t, r] of e.entries) n(t), n(r);
|
|
1195
1195
|
return;
|
|
1196
1196
|
}
|
|
1197
|
-
if (e instanceof
|
|
1197
|
+
if (e instanceof N || e instanceof P) {
|
|
1198
1198
|
for (let t of e.chunks) n(t);
|
|
1199
1199
|
return;
|
|
1200
1200
|
}
|
|
1201
|
-
e instanceof
|
|
1201
|
+
e instanceof j && n(e.content);
|
|
1202
1202
|
};
|
|
1203
1203
|
return n(e), t;
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1205
|
+
function pt(e, t, n) {
|
|
1206
1206
|
e.comments ??= {}, e.comments[t] ??= [], e.comments[t].push(n);
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function mt(e) {
|
|
1209
1209
|
let t = [0];
|
|
1210
1210
|
for (let n = 0; n < e.length; n++) e[n] === "\n" && t.push(n + 1);
|
|
1211
1211
|
return (n) => {
|
|
@@ -1219,25 +1219,25 @@ function pt(e) {
|
|
|
1219
1219
|
return a + 1;
|
|
1220
1220
|
};
|
|
1221
1221
|
}
|
|
1222
|
-
var
|
|
1223
|
-
["b32",
|
|
1224
|
-
["h32",
|
|
1225
|
-
["same",
|
|
1226
|
-
["hash",
|
|
1227
|
-
["uuid",
|
|
1228
|
-
["UUID",
|
|
1229
|
-
["dt",
|
|
1230
|
-
["DT",
|
|
1231
|
-
["ip",
|
|
1232
|
-
["IP",
|
|
1233
|
-
["cri",
|
|
1234
|
-
["CRI",
|
|
1235
|
-
["t1",
|
|
1236
|
-
["b1",
|
|
1237
|
-
["ilbs",
|
|
1238
|
-
["ilts",
|
|
1239
|
-
["float",
|
|
1240
|
-
]),
|
|
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 {
|
|
1241
1241
|
t;
|
|
1242
1242
|
_options;
|
|
1243
1243
|
extByPrefix;
|
|
@@ -1298,12 +1298,12 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1298
1298
|
case "BYTES_HEX":
|
|
1299
1299
|
case "SQSTR":
|
|
1300
1300
|
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
|
|
1302
|
-
case "EMPTY_INDEF_TEXT": return this.t.consume(), new
|
|
1303
|
-
case "TRUE": return this.t.consume(), new
|
|
1304
|
-
case "FALSE": return this.t.consume(), new
|
|
1305
|
-
case "NULL": return this.t.consume(), new
|
|
1306
|
-
case "UNDEFINED": return this.t.consume(), new
|
|
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);
|
|
1307
1307
|
case "SIMPLE": return this.parseSimple();
|
|
1308
1308
|
case "LBRACKET": return this.parseArray();
|
|
1309
1309
|
case "LBRACE": return this.parseMap();
|
|
@@ -1318,21 +1318,21 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1318
1318
|
}
|
|
1319
1319
|
let r = this.extByPrefix.get(e.appPrefix);
|
|
1320
1320
|
if (!r?.parseAppString) {
|
|
1321
|
-
if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new
|
|
1321
|
+
if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new Ke(e.appPrefix, [new B(e.value)]);
|
|
1322
1322
|
this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
|
|
1323
1323
|
}
|
|
1324
1324
|
{
|
|
1325
1325
|
let i = this._pendingWarnings.length;
|
|
1326
1326
|
try {
|
|
1327
1327
|
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
|
|
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, {
|
|
1329
1329
|
ednEncoding: i.ednEncoding,
|
|
1330
1330
|
encodingWidth: i.encodingWidth,
|
|
1331
1331
|
ednSource: e.raw + n
|
|
1332
|
-
}) : (i instanceof
|
|
1332
|
+
}) : (i instanceof A && i.ednSource === void 0 && (i.ednSource = e.raw + n), i);
|
|
1333
1333
|
} catch (t) {
|
|
1334
1334
|
if (this._options.strict !== !1) throw t;
|
|
1335
|
-
return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new
|
|
1335
|
+
return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new Ke(e.appPrefix, [new B(e.value)]);
|
|
1336
1336
|
}
|
|
1337
1337
|
}
|
|
1338
1338
|
}
|
|
@@ -1350,7 +1350,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1350
1350
|
this.t.peek().type === "ENCODING_INDICATOR" && (r = this.t.consume(), n = this._resolveEncodingWidth(r.value, r));
|
|
1351
1351
|
let i = this.extByPrefix.get(e.appPrefix);
|
|
1352
1352
|
if (!i) {
|
|
1353
|
-
if (this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new
|
|
1353
|
+
if (this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new Ke(e.appPrefix, t);
|
|
1354
1354
|
this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
|
|
1355
1355
|
}
|
|
1356
1356
|
i.parseAppSequence || this._fail(`app-string extension ${JSON.stringify(e.appPrefix)} does not support <<...>> form`, e);
|
|
@@ -1360,61 +1360,61 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1360
1360
|
let a = i.parseAppSequence(e.appPrefix, t, this._extOnError(e));
|
|
1361
1361
|
n !== void 0 && this._applyEiToResult(a, n, r ?? e);
|
|
1362
1362
|
let o = this.t.source.slice(e.offset, this.t.lastEndOffset);
|
|
1363
|
-
if (a instanceof
|
|
1364
|
-
else if (i.preserveAppSeqSource) return new
|
|
1363
|
+
if (a instanceof A) a.ednSource === void 0 && (a.ednSource = o);
|
|
1364
|
+
else if (i.preserveAppSeqSource) return new qe(a, o);
|
|
1365
1365
|
return a;
|
|
1366
1366
|
} catch (n) {
|
|
1367
1367
|
if (this._options.strict !== !1) throw n;
|
|
1368
|
-
return this._pendingWarnings.length === a && this._warn(n instanceof Error ? n.message : String(n), e), new
|
|
1368
|
+
return this._pendingWarnings.length === a && this._warn(n instanceof Error ? n.message : String(n), e), new Ke(e.appPrefix, t);
|
|
1369
1369
|
}
|
|
1370
1370
|
}
|
|
1371
1371
|
}
|
|
1372
1372
|
case "ELLIPSIS": {
|
|
1373
|
-
if (this.t.consume(), this.t.peek().type !== "PLUS") return new
|
|
1374
|
-
let e = [new
|
|
1373
|
+
if (this.t.consume(), this.t.peek().type !== "PLUS") return new R();
|
|
1374
|
+
let e = [new R()];
|
|
1375
1375
|
for (; this.t.peek().type === "PLUS";) this.t.consume(), e.push(this.parseValue());
|
|
1376
|
-
return new
|
|
1376
|
+
return new R(e);
|
|
1377
1377
|
}
|
|
1378
1378
|
case "BYTES_HEX_ELIDED": return this.t.consume(), this._parseHexElidedConcat(e);
|
|
1379
1379
|
default: this._fail(`unexpected token: ${JSON.stringify(e.value)}`, e);
|
|
1380
1380
|
}
|
|
1381
1381
|
}
|
|
1382
1382
|
parseIntegerOrTag() {
|
|
1383
|
-
let e = this.t.consume(), { numStr: t, rawSuffix: n } =
|
|
1384
|
-
if (i > 18446744073709551615n) return this.t.peek().type === "LPAREN" && this._fail("tag number exceeds maximum uint64", e), new
|
|
1385
|
-
if (i < -18446744073709551616n) return new
|
|
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);
|
|
1386
1386
|
if (r !== void 0) {
|
|
1387
1387
|
let t = i >= 0n ? i : -(i + 1n);
|
|
1388
1388
|
r = this._validateEncodingFit(t, r, e);
|
|
1389
1389
|
}
|
|
1390
|
-
let a = i >= 0n ? new
|
|
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 });
|
|
1391
1391
|
if (this.t.peek().type === "LPAREN") {
|
|
1392
|
-
a instanceof
|
|
1392
|
+
a instanceof O || this._fail("tag number must be non-negative", e), this.t.consume();
|
|
1393
1393
|
let t = this._pendingWarnings.splice(0), n = this.parseValue();
|
|
1394
1394
|
this.expect("RPAREN");
|
|
1395
1395
|
let i = a.value, o = this.extByTag.get(i);
|
|
1396
1396
|
if (o?.parseTag) {
|
|
1397
1397
|
let e = o.parseTag(i, n);
|
|
1398
|
-
if (e !== void 0) return e instanceof
|
|
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;
|
|
1399
1399
|
}
|
|
1400
|
-
let s = new
|
|
1400
|
+
let s = new j(i, n, r === void 0 ? void 0 : { encodingWidth: r });
|
|
1401
1401
|
return t.length > 0 && (s.warnings ??= [], s.warnings.push(...t)), s;
|
|
1402
1402
|
}
|
|
1403
1403
|
return a;
|
|
1404
1404
|
}
|
|
1405
1405
|
parseFloat() {
|
|
1406
|
-
let e = this.t.consume(), t = (t) => this._warnOrFail(t, e), { value: n, precision: r } =
|
|
1406
|
+
let e = this.t.consume(), t = (t) => this._warnOrFail(t, e), { value: n, precision: r } = lt(e.value, t);
|
|
1407
1407
|
if (r === "half" || r === "single") {
|
|
1408
1408
|
let e = r === "half" ? C(S(n)) : Math.fround(n);
|
|
1409
1409
|
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
1410
|
}
|
|
1411
|
-
return new
|
|
1411
|
+
return new A(n, r === void 0 ? void 0 : { precision: r });
|
|
1412
1412
|
}
|
|
1413
1413
|
parseString() {
|
|
1414
1414
|
let e = this.t.consume();
|
|
1415
1415
|
if (this.t.peek().type !== "PLUS") {
|
|
1416
|
-
let t = this.consumeEncodingIndicator(() => BigInt(
|
|
1417
|
-
return new
|
|
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
1418
|
}
|
|
1419
1419
|
let t = !1, n = [{ text: e.value }];
|
|
1420
1420
|
for (; this.t.peek().type === "PLUS";) {
|
|
@@ -1423,15 +1423,15 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1423
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);
|
|
1424
1424
|
}
|
|
1425
1425
|
if (!t) {
|
|
1426
|
-
let e = n.map((e) => "text" in e ? e.text : ""), t = e.join(""), r = this.consumeEncodingIndicator(() => BigInt(
|
|
1427
|
-
return new
|
|
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, {
|
|
1428
1428
|
ednParts: e,
|
|
1429
1429
|
...r === void 0 ? {} : { encodingWidth: r }
|
|
1430
1430
|
});
|
|
1431
1431
|
}
|
|
1432
1432
|
let r = [], i = "";
|
|
1433
|
-
for (let e of n) "ellipsis" in e ? (i !== "" && (r.push(new
|
|
1434
|
-
return i !== "" && r.push(new
|
|
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);
|
|
1435
1435
|
}
|
|
1436
1436
|
_isBytesToken(e) {
|
|
1437
1437
|
return e === "BYTES_HEX" || e === "SQSTR" || e === "BYTES_B64";
|
|
@@ -1453,7 +1453,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1453
1453
|
}
|
|
1454
1454
|
case "BYTES_HEX": return this._hexToBytes(e.value, e);
|
|
1455
1455
|
case "BYTES_B64": try {
|
|
1456
|
-
return
|
|
1456
|
+
return ut(e.value, t);
|
|
1457
1457
|
} catch (t) {
|
|
1458
1458
|
if (t instanceof r || !(t instanceof SyntaxError)) throw t;
|
|
1459
1459
|
this._fail(t.message, e);
|
|
@@ -1462,11 +1462,11 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1462
1462
|
}
|
|
1463
1463
|
}
|
|
1464
1464
|
_decodeUtf8(e, t) {
|
|
1465
|
-
if (this._options.allowInvalidUtf8) return
|
|
1465
|
+
if (this._options.allowInvalidUtf8) return at.decode(e);
|
|
1466
1466
|
try {
|
|
1467
|
-
return
|
|
1467
|
+
return it.decode(e);
|
|
1468
1468
|
} catch {
|
|
1469
|
-
return this._warnOrFail("byte string in text concatenation is not valid UTF-8", t),
|
|
1469
|
+
return this._warnOrFail("byte string in text concatenation is not valid UTF-8", t), at.decode(e);
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
1472
|
_tokenTypeToCdnEncoding(e) {
|
|
@@ -1475,7 +1475,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1475
1475
|
_parseBytesConcat(e, t, n) {
|
|
1476
1476
|
if (this.t.peek().type !== "PLUS") {
|
|
1477
1477
|
let r = this.consumeEncodingIndicator(() => BigInt(e.length));
|
|
1478
|
-
return new
|
|
1478
|
+
return new M(e, {
|
|
1479
1479
|
ednEncoding: this._tokenTypeToCdnEncoding(t),
|
|
1480
1480
|
ednSource: n,
|
|
1481
1481
|
...r === void 0 ? {} : { encodingWidth: r }
|
|
@@ -1492,32 +1492,32 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1492
1492
|
else if (e.type === "BYTES_HEX_ELIDED") {
|
|
1493
1493
|
this.t.consume();
|
|
1494
1494
|
let t = this._buildBytesElidedItems(e.value, e);
|
|
1495
|
-
for (let e of t) e instanceof
|
|
1495
|
+
for (let e of t) e instanceof R ? (i.push({ ellipsis: !0 }), r = !0) : e instanceof M && i.push({ bytes: e.value });
|
|
1496
1496
|
} else this._isBytesToken(e.type) ? (this.t.consume(), i.push({
|
|
1497
1497
|
bytes: this._decodeBytesToken(e),
|
|
1498
1498
|
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:
|
|
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);
|
|
1500
1500
|
}
|
|
1501
1501
|
if (!r) {
|
|
1502
1502
|
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
|
|
1503
|
+
return new M(n, {
|
|
1504
1504
|
ednEncoding: this._tokenTypeToCdnEncoding(t),
|
|
1505
1505
|
ednParts: e,
|
|
1506
1506
|
...r === void 0 ? {} : { encodingWidth: r }
|
|
1507
1507
|
});
|
|
1508
1508
|
}
|
|
1509
1509
|
let a = [], o = [], s = () => {
|
|
1510
|
-
o.length > 0 && (a.push(new
|
|
1510
|
+
o.length > 0 && (a.push(new M(this._concatBytes([...o]))), o.length = 0);
|
|
1511
1511
|
};
|
|
1512
|
-
for (let e of i) "ellipsis" in e ? (s(), a.push(new
|
|
1513
|
-
return s(), new
|
|
1512
|
+
for (let e of i) "ellipsis" in e ? (s(), a.push(new R())) : o.push(e.bytes);
|
|
1513
|
+
return s(), new R(a);
|
|
1514
1514
|
}
|
|
1515
1515
|
_parseHexElidedConcat(e) {
|
|
1516
1516
|
let t = this._buildBytesElidedItems(e.value, e);
|
|
1517
1517
|
for (; this.t.peek().type === "PLUS";) {
|
|
1518
1518
|
this.t.consume();
|
|
1519
1519
|
let e = this.t.peek();
|
|
1520
|
-
if (e.type === "ELLIPSIS") this.t.consume(), t.push(new
|
|
1520
|
+
if (e.type === "ELLIPSIS") this.t.consume(), t.push(new R());
|
|
1521
1521
|
else if (e.type === "BYTES_HEX_ELIDED") {
|
|
1522
1522
|
this.t.consume();
|
|
1523
1523
|
let n = this._buildBytesElidedItems(e.value, e);
|
|
@@ -1525,20 +1525,20 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1525
1525
|
} else if (this._isBytesToken(e.type)) {
|
|
1526
1526
|
this.t.consume();
|
|
1527
1527
|
let n = this._decodeBytesToken(e), r = t[t.length - 1];
|
|
1528
|
-
r instanceof
|
|
1528
|
+
r instanceof M ? t[t.length - 1] = new M(this._concatBytes([r.value, n])) : t.push(new M(n));
|
|
1529
1529
|
} else this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`, e);
|
|
1530
1530
|
}
|
|
1531
|
-
return new
|
|
1531
|
+
return new R(t);
|
|
1532
1532
|
}
|
|
1533
1533
|
_buildBytesElidedItems(e, t) {
|
|
1534
1534
|
let n = e.split("..."), r = [];
|
|
1535
|
-
for (let e = 0; e < n.length; e++) e > 0 && r.push(new
|
|
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)));
|
|
1536
1536
|
return r;
|
|
1537
1537
|
}
|
|
1538
1538
|
_mergeFirstBytesItem(e, t) {
|
|
1539
1539
|
if (t.length === 0) return;
|
|
1540
1540
|
let n = e[e.length - 1], r = t[0];
|
|
1541
|
-
n instanceof
|
|
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);
|
|
1542
1542
|
}
|
|
1543
1543
|
_concatBytes(e) {
|
|
1544
1544
|
let t = e.reduce((e, t) => e + t.byteLength, 0), n = new Uint8Array(t), r = 0;
|
|
@@ -1549,8 +1549,8 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1549
1549
|
this.t.consume(), this.expect("LPAREN");
|
|
1550
1550
|
let e = this.t.peek();
|
|
1551
1551
|
e.type !== "INTEGER" && this._fail(`expected integer inside simple(), got ${JSON.stringify(e.value)}`, e), this.t.consume();
|
|
1552
|
-
let { numStr: t } =
|
|
1553
|
-
return this.expect("RPAREN"), new
|
|
1552
|
+
let { numStr: t } = st(e.value), n = Number(ct(t));
|
|
1553
|
+
return this.expect("RPAREN"), new L(n);
|
|
1554
1554
|
}
|
|
1555
1555
|
parseEmbeddedCBOR() {
|
|
1556
1556
|
this.t.consume();
|
|
@@ -1567,7 +1567,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1567
1567
|
let e = this.t.consume();
|
|
1568
1568
|
t = this._resolveEncodingWidth(e.value, e);
|
|
1569
1569
|
}
|
|
1570
|
-
return new
|
|
1570
|
+
return new We(e, { encodingWidth: t });
|
|
1571
1571
|
}
|
|
1572
1572
|
parseArray() {
|
|
1573
1573
|
this.t.consume();
|
|
@@ -1581,7 +1581,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1581
1581
|
i.push(this.parseValue());
|
|
1582
1582
|
}
|
|
1583
1583
|
this.expect("RBRACKET"), t !== void 0 && n !== void 0 && (t = this._validateEncodingFit(BigInt(i.length), t, n));
|
|
1584
|
-
let a = new
|
|
1584
|
+
let a = new F(i, {
|
|
1585
1585
|
indefiniteLength: e,
|
|
1586
1586
|
encodingWidth: t
|
|
1587
1587
|
});
|
|
@@ -1602,7 +1602,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1602
1602
|
i.push([e, t]);
|
|
1603
1603
|
}
|
|
1604
1604
|
this.expect("RBRACE"), t !== void 0 && n !== void 0 && (t = this._validateEncodingFit(BigInt(i.length), t, n));
|
|
1605
|
-
let a = new
|
|
1605
|
+
let a = new I(i, {
|
|
1606
1606
|
indefiniteLength: e,
|
|
1607
1607
|
encodingWidth: t
|
|
1608
1608
|
});
|
|
@@ -1626,16 +1626,16 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1626
1626
|
}
|
|
1627
1627
|
this.expect("RPAREN"), n.length === 0 && this._fail("empty indefinite group (_ ) is ambiguous; use ''_ for bytes or \"\"_ for text");
|
|
1628
1628
|
let r = n[0];
|
|
1629
|
-
if (r instanceof
|
|
1630
|
-
let e = new
|
|
1631
|
-
if (e instanceof
|
|
1629
|
+
if (r instanceof M) {
|
|
1630
|
+
let e = new N(n.map((e, t) => {
|
|
1631
|
+
if (e instanceof M) return e;
|
|
1632
1632
|
this._fail(`indefinite byte string chunk ${t} must be a byte string, not a text string`);
|
|
1633
1633
|
}));
|
|
1634
1634
|
return t.length > 0 && (e.warnings = t), e;
|
|
1635
1635
|
}
|
|
1636
|
-
if (r instanceof
|
|
1637
|
-
let e = new
|
|
1638
|
-
if (e instanceof
|
|
1636
|
+
if (r instanceof B) {
|
|
1637
|
+
let e = new P(n.map((e, t) => {
|
|
1638
|
+
if (e instanceof B) return e;
|
|
1639
1639
|
this._fail(`indefinite text string chunk ${t} must be a text string, not a byte string`);
|
|
1640
1640
|
}));
|
|
1641
1641
|
return t.length > 0 && (e.warnings = t), e;
|
|
@@ -1653,7 +1653,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1653
1653
|
return t.type !== e && this._fail(`expected ${e}, got ${t.type} (${JSON.stringify(t.value)})`, t), t;
|
|
1654
1654
|
}
|
|
1655
1655
|
_applyEiToResult(e, t, n) {
|
|
1656
|
-
if (e instanceof
|
|
1656
|
+
if (e instanceof A) {
|
|
1657
1657
|
let r = t === 1 ? "half" : t === 2 ? "single" : t === 3 ? "double" : void 0;
|
|
1658
1658
|
if (r === void 0) this._warnOrFail(`encoding indicator _${t} is not valid for a float; use _1, _2, or _3`, n);
|
|
1659
1659
|
else if (e.precision !== r) {
|
|
@@ -1663,37 +1663,37 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1663
1663
|
}
|
|
1664
1664
|
e.precision = r;
|
|
1665
1665
|
}
|
|
1666
|
-
} else if (e instanceof
|
|
1666
|
+
} else if (e instanceof O) {
|
|
1667
1667
|
if (e.encodingWidth === void 0) {
|
|
1668
1668
|
let r = this._validateEncodingFit(e.value, t, n);
|
|
1669
1669
|
r !== void 0 && (e.encodingWidth = r);
|
|
1670
1670
|
}
|
|
1671
|
-
} else if (e instanceof
|
|
1671
|
+
} else if (e instanceof k) {
|
|
1672
1672
|
if (e.encodingWidth === void 0) {
|
|
1673
1673
|
let r = this._validateEncodingFit(e.argument, t, n);
|
|
1674
1674
|
r !== void 0 && (e.encodingWidth = r);
|
|
1675
1675
|
}
|
|
1676
|
-
} else if (e instanceof
|
|
1676
|
+
} else if (e instanceof M) {
|
|
1677
1677
|
if (e.encodingWidth === void 0) {
|
|
1678
1678
|
let r = this._validateEncodingFit(BigInt(e.value.length), t, n);
|
|
1679
1679
|
r !== void 0 && (e.encodingWidth = r);
|
|
1680
1680
|
}
|
|
1681
|
-
} else if (e instanceof
|
|
1681
|
+
} else if (e instanceof B) {
|
|
1682
1682
|
if (e.encodingWidth === void 0) {
|
|
1683
|
-
let r = this._validateEncodingFit(BigInt(
|
|
1683
|
+
let r = this._validateEncodingFit(BigInt(rt.encode(e.value).length), t, n);
|
|
1684
1684
|
r !== void 0 && (e.encodingWidth = r);
|
|
1685
1685
|
}
|
|
1686
|
-
} else if (e instanceof
|
|
1686
|
+
} else if (e instanceof F) {
|
|
1687
1687
|
if (e.encodingWidth === void 0) {
|
|
1688
1688
|
let r = this._validateEncodingFit(BigInt(e.items.length), t, n);
|
|
1689
1689
|
r !== void 0 && (e.encodingWidth = r);
|
|
1690
1690
|
}
|
|
1691
|
-
} else if (e instanceof
|
|
1691
|
+
} else if (e instanceof I) {
|
|
1692
1692
|
if (e.encodingWidth === void 0) {
|
|
1693
1693
|
let r = this._validateEncodingFit(BigInt(e.entries.length), t, n);
|
|
1694
1694
|
r !== void 0 && (e.encodingWidth = r);
|
|
1695
1695
|
}
|
|
1696
|
-
} else if (e instanceof
|
|
1696
|
+
} else if (e instanceof j) {
|
|
1697
1697
|
if (e.encodingWidth === void 0) {
|
|
1698
1698
|
let r = this._validateEncodingFit(e.tag, t, n);
|
|
1699
1699
|
r !== void 0 && (e.encodingWidth = r);
|
|
@@ -1725,28 +1725,28 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1725
1725
|
this._warn(e, t), this._options.strict !== !1 && this._fail(e, t);
|
|
1726
1726
|
}
|
|
1727
1727
|
_hintMissingExtension(e, t) {
|
|
1728
|
-
let n =
|
|
1728
|
+
let n = _t.get(e);
|
|
1729
1729
|
if (n === void 0 || this._hintedPrefixes.has(e)) return;
|
|
1730
1730
|
this._hintedPrefixes.add(e);
|
|
1731
1731
|
let r = `app-string prefix '${e}' requires an extension that is not enabled; ${n}`;
|
|
1732
1732
|
this._options.onWarning ? this._options.onWarning({
|
|
1733
1733
|
message: r,
|
|
1734
|
-
...
|
|
1734
|
+
...yt(t)
|
|
1735
1735
|
}) : this._options.silent || console.warn(`CDN: ${r}`);
|
|
1736
1736
|
}
|
|
1737
1737
|
_warn(e, t) {
|
|
1738
1738
|
let n = { message: e };
|
|
1739
|
-
if (t !== void 0 && Object.assign(n,
|
|
1739
|
+
if (t !== void 0 && Object.assign(n, yt(t)), this._pendingWarnings.push(n), this._options.onWarning) this._options.onWarning(n);
|
|
1740
1740
|
else if (!this._options.silent) {
|
|
1741
1741
|
let n = t ? ` at line ${t.line}, column ${t.col}` : "";
|
|
1742
1742
|
console.warn(`CDN strict violation${n}: ${e}`);
|
|
1743
1743
|
}
|
|
1744
1744
|
}
|
|
1745
1745
|
_fail(e, t) {
|
|
1746
|
-
throw new r(e, t ?
|
|
1746
|
+
throw new r(e, t ? yt(t) : void 0);
|
|
1747
1747
|
}
|
|
1748
1748
|
};
|
|
1749
|
-
function
|
|
1749
|
+
function yt(e) {
|
|
1750
1750
|
return {
|
|
1751
1751
|
offset: e.offset,
|
|
1752
1752
|
line: e.line,
|
|
@@ -1756,7 +1756,7 @@ function vt(e) {
|
|
|
1756
1756
|
}
|
|
1757
1757
|
//#endregion
|
|
1758
1758
|
//#region src/ast/CborTextString.ts
|
|
1759
|
-
var
|
|
1759
|
+
var bt = new TextEncoder(), xt = !1, B = class extends D {
|
|
1760
1760
|
indefiniteLength = !1;
|
|
1761
1761
|
value;
|
|
1762
1762
|
encodingWidth;
|
|
@@ -1768,43 +1768,43 @@ var yt = new TextEncoder(), bt = !1, V = class extends O {
|
|
|
1768
1768
|
e.writeTextString(3, this.value, this.encodingWidth);
|
|
1769
1769
|
}
|
|
1770
1770
|
_toCDN(e, t) {
|
|
1771
|
-
let n = x(e, this.encodingWidth, () => b(BigInt(
|
|
1772
|
-
return
|
|
1771
|
+
let n = x(e, this.encodingWidth, () => b(BigInt(bt.encode(this.value).length)));
|
|
1772
|
+
return St(this.value, n, e, t, this.ednParts);
|
|
1773
1773
|
}
|
|
1774
1774
|
_toJS(e) {
|
|
1775
1775
|
return this.value;
|
|
1776
1776
|
}
|
|
1777
1777
|
};
|
|
1778
|
-
function
|
|
1779
|
-
let { cdn: a, newline: o } =
|
|
1780
|
-
if (s === null) return c === void 0 ? Se(e) + t :
|
|
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) => ({
|
|
1781
1781
|
text: e,
|
|
1782
1782
|
contentDepth: 0
|
|
1783
1783
|
})), t, null, r);
|
|
1784
1784
|
if (!a && !o && c === void 0) return Se(e) + t;
|
|
1785
|
-
let l = a ?
|
|
1785
|
+
let l = a ? Dt(e) : null;
|
|
1786
1786
|
if (l === null && c !== void 0) {
|
|
1787
1787
|
let e = [];
|
|
1788
1788
|
for (let t of c) if (o) {
|
|
1789
1789
|
let n = /* @__PURE__ */ new Map();
|
|
1790
|
-
for (let { point: e, contentDepth: r } of
|
|
1791
|
-
e.push(...
|
|
1790
|
+
for (let { point: e, contentDepth: r } of Et(t, 0)) n.set(e, r);
|
|
1791
|
+
e.push(...Ft(t, n));
|
|
1792
1792
|
} else e.push({
|
|
1793
1793
|
text: t,
|
|
1794
1794
|
contentDepth: 0
|
|
1795
1795
|
});
|
|
1796
|
-
return
|
|
1796
|
+
return Ct(e, t, s, r);
|
|
1797
1797
|
}
|
|
1798
1798
|
let u = /* @__PURE__ */ new Map();
|
|
1799
1799
|
if (l !== null) for (let { point: e, contentDepth: t } of l) u.set(e, t);
|
|
1800
1800
|
if (o) {
|
|
1801
|
-
let t = l === null ?
|
|
1801
|
+
let t = l === null ? Et(e, 0) : Ot(e);
|
|
1802
1802
|
for (let { point: e, contentDepth: n } of t) u.has(e) || u.set(e, n);
|
|
1803
1803
|
}
|
|
1804
|
-
let d =
|
|
1805
|
-
return d.length <= 1 ? Se(e) + t :
|
|
1804
|
+
let d = Ft(e, u);
|
|
1805
|
+
return d.length <= 1 ? Se(e) + t : Ct(d, t, s, r);
|
|
1806
1806
|
}
|
|
1807
|
-
function
|
|
1807
|
+
function Ct(e, t, n, r) {
|
|
1808
1808
|
let i = e.map(({ text: n }, r) => {
|
|
1809
1809
|
let i = Se(n);
|
|
1810
1810
|
return r === e.length - 1 ? i + t : i;
|
|
@@ -1817,17 +1817,17 @@ function St(e, t, n, r) {
|
|
|
1817
1817
|
}
|
|
1818
1818
|
return a;
|
|
1819
1819
|
}
|
|
1820
|
-
function
|
|
1821
|
-
let t = e?.splitCdn === void 0 || e?.splitNewline === void 0 ?
|
|
1820
|
+
function wt(e) {
|
|
1821
|
+
let t = e?.splitCdn === void 0 || e?.splitNewline === void 0 ? Tt(e?.textStringFormat ?? []) : [];
|
|
1822
1822
|
return {
|
|
1823
1823
|
cdn: e?.splitCdn ?? t.includes("cdn"),
|
|
1824
1824
|
newline: e?.splitNewline ?? t.includes("newline")
|
|
1825
1825
|
};
|
|
1826
1826
|
}
|
|
1827
|
-
function
|
|
1828
|
-
return e.map((e) => e === "cboredn" ? (
|
|
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);
|
|
1829
1829
|
}
|
|
1830
|
-
function
|
|
1830
|
+
function Et(e, t) {
|
|
1831
1831
|
let n = [];
|
|
1832
1832
|
for (let r = 0; r < e.length; r++) {
|
|
1833
1833
|
let i = e[r];
|
|
@@ -1844,9 +1844,9 @@ function Tt(e, t) {
|
|
|
1844
1844
|
}
|
|
1845
1845
|
return n;
|
|
1846
1846
|
}
|
|
1847
|
-
function
|
|
1847
|
+
function Dt(e) {
|
|
1848
1848
|
try {
|
|
1849
|
-
|
|
1849
|
+
ot(e);
|
|
1850
1850
|
} catch {
|
|
1851
1851
|
return null;
|
|
1852
1852
|
}
|
|
@@ -1855,24 +1855,24 @@ function Et(e) {
|
|
|
1855
1855
|
let a = n.consume();
|
|
1856
1856
|
if (a.type === "EOF") break;
|
|
1857
1857
|
let c = !1;
|
|
1858
|
-
if (o || (o = !0, a.offset > 0 &&
|
|
1858
|
+
if (o || (o = !0, a.offset > 0 && Nt(n.comments, 0, a.offset) && t.push({
|
|
1859
1859
|
point: a.offset,
|
|
1860
1860
|
contentDepth: r
|
|
1861
1861
|
})), i !== null) {
|
|
1862
|
-
if (i.kind === "opener" &&
|
|
1862
|
+
if (i.kind === "opener" && At.has(a.type)) {
|
|
1863
1863
|
i.point = a.endOffset, s = a.endOffset;
|
|
1864
1864
|
continue;
|
|
1865
|
-
} else i.kind === "opener" &&
|
|
1865
|
+
} else i.kind === "opener" && Mt.has(a.type) && Pt(e, i.point, a.offset) ? c = !0 : t.push({
|
|
1866
1866
|
point: a.offset,
|
|
1867
1867
|
contentDepth: i.contentDepth
|
|
1868
1868
|
});
|
|
1869
1869
|
i = null;
|
|
1870
1870
|
}
|
|
1871
|
-
|
|
1871
|
+
jt.has(a.type) ? (r++, i = {
|
|
1872
1872
|
point: a.endOffset,
|
|
1873
1873
|
contentDepth: r,
|
|
1874
1874
|
kind: "opener"
|
|
1875
|
-
}) :
|
|
1875
|
+
}) : Mt.has(a.type) ? (r = Math.max(0, r - 1), c || t.push({
|
|
1876
1876
|
point: a.offset,
|
|
1877
1877
|
contentDepth: r
|
|
1878
1878
|
})) : a.type === "COMMA" && (i = {
|
|
@@ -1887,23 +1887,23 @@ function Et(e) {
|
|
|
1887
1887
|
contentDepth: r
|
|
1888
1888
|
}), t;
|
|
1889
1889
|
}
|
|
1890
|
-
function
|
|
1890
|
+
function Ot(e) {
|
|
1891
1891
|
let t = [], n = new a(e), r = 0;
|
|
1892
1892
|
for (;;) {
|
|
1893
1893
|
let i = n.consume();
|
|
1894
1894
|
if (i.type === "EOF") break;
|
|
1895
|
-
if (
|
|
1896
|
-
else if (
|
|
1895
|
+
if (jt.has(i.type)) r++;
|
|
1896
|
+
else if (Mt.has(i.type)) r = Math.max(0, r - 1);
|
|
1897
1897
|
else if (i.type !== "COMMA") {
|
|
1898
1898
|
if (i.type === "TSTR") {
|
|
1899
1899
|
let n = e.slice(i.offset, i.endOffset);
|
|
1900
|
-
for (let e of
|
|
1900
|
+
for (let e of kt(n)) t.push({
|
|
1901
1901
|
point: i.offset + e,
|
|
1902
1902
|
contentDepth: r + 1
|
|
1903
1903
|
});
|
|
1904
1904
|
} else if (i.type === "RAWSTRING") {
|
|
1905
1905
|
let n = e.slice(i.offset, i.endOffset);
|
|
1906
|
-
for (let { point: e } of
|
|
1906
|
+
for (let { point: e } of Et(n, 0)) t.push({
|
|
1907
1907
|
point: i.offset + e,
|
|
1908
1908
|
contentDepth: r + 1
|
|
1909
1909
|
});
|
|
@@ -1912,7 +1912,7 @@ function Dt(e) {
|
|
|
1912
1912
|
}
|
|
1913
1913
|
return t;
|
|
1914
1914
|
}
|
|
1915
|
-
function
|
|
1915
|
+
function kt(e) {
|
|
1916
1916
|
let t = [], n = 1, r = e.length - 1;
|
|
1917
1917
|
for (; n < r;) {
|
|
1918
1918
|
let r = e[n];
|
|
@@ -1928,24 +1928,24 @@ function Ot(e) {
|
|
|
1928
1928
|
}
|
|
1929
1929
|
return t;
|
|
1930
1930
|
}
|
|
1931
|
-
var
|
|
1931
|
+
var At = /* @__PURE__ */ new Set(["ENCODING_INDICATOR", "UNDERSCORE"]), jt = /* @__PURE__ */ new Set([
|
|
1932
1932
|
"LBRACKET",
|
|
1933
1933
|
"LBRACE",
|
|
1934
1934
|
"LPAREN",
|
|
1935
1935
|
"LT_LT"
|
|
1936
|
-
]),
|
|
1936
|
+
]), Mt = /* @__PURE__ */ new Set([
|
|
1937
1937
|
"RBRACKET",
|
|
1938
1938
|
"RBRACE",
|
|
1939
1939
|
"RPAREN",
|
|
1940
1940
|
"GT_GT"
|
|
1941
1941
|
]);
|
|
1942
|
-
function
|
|
1942
|
+
function Nt(e, t, n) {
|
|
1943
1943
|
return e.some((e) => e.start >= t && e.end <= n);
|
|
1944
1944
|
}
|
|
1945
|
-
function
|
|
1945
|
+
function Pt(e, t, n) {
|
|
1946
1946
|
return /^[\t\n\r ]*$/.test(e.slice(t, n));
|
|
1947
1947
|
}
|
|
1948
|
-
function
|
|
1948
|
+
function Ft(e, t) {
|
|
1949
1949
|
let n = [...t].filter(([t]) => t > 0 && t < e.length).sort(([e], [t]) => e - t);
|
|
1950
1950
|
if (n.length === 0) return [{
|
|
1951
1951
|
text: e,
|
|
@@ -1963,7 +1963,7 @@ function Pt(e, t) {
|
|
|
1963
1963
|
}
|
|
1964
1964
|
//#endregion
|
|
1965
1965
|
//#region src/extensions/dt.ts
|
|
1966
|
-
function
|
|
1966
|
+
function V(e) {
|
|
1967
1967
|
if (Number.isInteger(e)) return (/* @__PURE__ */ new Date(e * 1e3)).toISOString().replace(/\.000Z$/, "Z");
|
|
1968
1968
|
let t = Math.round(e * 1e3);
|
|
1969
1969
|
if (t / 1e3 === e) return new Date(t).toISOString().replace(/\.000Z$/, "Z");
|
|
@@ -1971,17 +1971,17 @@ function H(e) {
|
|
|
1971
1971
|
for (; s.length < 3;) s += "0";
|
|
1972
1972
|
return `${i}.${s}Z`;
|
|
1973
1973
|
}
|
|
1974
|
-
var
|
|
1975
|
-
function
|
|
1974
|
+
var It = new TextDecoder("utf-8", { fatal: !0 });
|
|
1975
|
+
function Lt(e) {
|
|
1976
1976
|
if (e.length !== 1) throw SyntaxError("dt<<...>>: expected exactly one item");
|
|
1977
1977
|
let t = e[0];
|
|
1978
|
-
if (t instanceof
|
|
1979
|
-
if (t instanceof
|
|
1978
|
+
if (t instanceof B) return t.value;
|
|
1979
|
+
if (t instanceof M) return It.decode(t.value);
|
|
1980
1980
|
throw SyntaxError("dt<<...>>: expected a text string or byte string");
|
|
1981
1981
|
}
|
|
1982
|
-
var
|
|
1983
|
-
function
|
|
1984
|
-
if (!
|
|
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)) {
|
|
1985
1985
|
let n = `dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`;
|
|
1986
1986
|
if (t) t(n);
|
|
1987
1987
|
else throw SyntaxError(n);
|
|
@@ -1992,93 +1992,93 @@ function Rt(e, t) {
|
|
|
1992
1992
|
if (isNaN(a)) throw SyntaxError(`dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`);
|
|
1993
1993
|
if (i === void 0) {
|
|
1994
1994
|
let e = a / 1e3;
|
|
1995
|
-
return e >= 0 ? new
|
|
1995
|
+
return e >= 0 ? new Vt(BigInt(e)) : new Ht(BigInt(e));
|
|
1996
1996
|
}
|
|
1997
|
-
return new
|
|
1997
|
+
return new Ut(a / 1e3 + i);
|
|
1998
1998
|
}
|
|
1999
|
-
var
|
|
1999
|
+
var Bt = 1n, Vt = class extends O {
|
|
2000
2000
|
constructor(e, t) {
|
|
2001
2001
|
super(e, t);
|
|
2002
2002
|
}
|
|
2003
2003
|
_toCDN(e, t) {
|
|
2004
2004
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2005
2005
|
let n = x(e, this.encodingWidth, () => b(this.value));
|
|
2006
|
-
return `dt'${
|
|
2006
|
+
return `dt'${V(Number(this.value))}'${n}`;
|
|
2007
2007
|
}
|
|
2008
|
-
},
|
|
2008
|
+
}, Ht = class extends k {
|
|
2009
2009
|
constructor(e, t) {
|
|
2010
2010
|
super(e, t);
|
|
2011
2011
|
}
|
|
2012
2012
|
_toCDN(e, t) {
|
|
2013
2013
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2014
2014
|
let n = x(e, this.encodingWidth, () => b(this.argument));
|
|
2015
|
-
return `dt'${
|
|
2015
|
+
return `dt'${V(Number(this.value))}'${n}`;
|
|
2016
2016
|
}
|
|
2017
|
-
},
|
|
2017
|
+
}, Ut = class extends A {
|
|
2018
2018
|
constructor(e, t) {
|
|
2019
2019
|
super(e, t);
|
|
2020
2020
|
}
|
|
2021
2021
|
_toCDN(e, t) {
|
|
2022
2022
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2023
|
-
let n =
|
|
2024
|
-
return `dt'${
|
|
2023
|
+
let n = ze(this.value), r = we(this.value, this.precision, n, e?.encodingIndicators ?? "auto");
|
|
2024
|
+
return `dt'${V(this.value)}'${r}`;
|
|
2025
2025
|
}
|
|
2026
|
-
},
|
|
2026
|
+
}, Wt = class extends j {
|
|
2027
2027
|
constructor(e, t) {
|
|
2028
|
-
super(
|
|
2028
|
+
super(Bt, typeof e == "string" ? zt(e) : e, t);
|
|
2029
2029
|
}
|
|
2030
2030
|
_toCDN(e, t) {
|
|
2031
2031
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2032
2032
|
let n = this.content;
|
|
2033
|
-
if (n instanceof
|
|
2033
|
+
if (n instanceof A ? n.precision !== void 0 && n.precision !== ze(n.value) : n.encodingWidth !== void 0) return super._toCDN({
|
|
2034
2034
|
...e,
|
|
2035
2035
|
appStrings: !1
|
|
2036
2036
|
}, t);
|
|
2037
|
-
let r = n instanceof
|
|
2038
|
-
return `DT'${
|
|
2037
|
+
let r = n instanceof A ? n.value : Number(n.value), i = x(e, this.encodingWidth, () => b(Bt));
|
|
2038
|
+
return `DT'${V(r)}'${i}`;
|
|
2039
2039
|
}
|
|
2040
|
-
},
|
|
2040
|
+
}, Gt = class extends Wt {
|
|
2041
2041
|
constructor(e, t) {
|
|
2042
2042
|
super(e, t);
|
|
2043
2043
|
}
|
|
2044
2044
|
_toJS(e) {
|
|
2045
|
-
let t = this.content, n = t instanceof
|
|
2045
|
+
let t = this.content, n = t instanceof A ? t.value * 1e3 : Number(t.value) * 1e3;
|
|
2046
2046
|
return new Date(n);
|
|
2047
2047
|
}
|
|
2048
2048
|
};
|
|
2049
|
-
function
|
|
2049
|
+
function Kt(e) {
|
|
2050
2050
|
let t = e?.jsDate ?? !1;
|
|
2051
2051
|
function n(e) {
|
|
2052
|
-
return t ? new
|
|
2052
|
+
return t ? new Gt(e) : new Wt(e);
|
|
2053
2053
|
}
|
|
2054
2054
|
let r = {
|
|
2055
2055
|
appStringPrefixes: ["dt", "DT"],
|
|
2056
|
-
tagNumbers: [
|
|
2056
|
+
tagNumbers: [Bt],
|
|
2057
2057
|
parseAppString(e, t, r) {
|
|
2058
|
-
return e === "DT" ? n(t) :
|
|
2058
|
+
return e === "DT" ? n(t) : zt(t, r);
|
|
2059
2059
|
},
|
|
2060
2060
|
parseAppSequence(e, t, r) {
|
|
2061
|
-
let i =
|
|
2062
|
-
return e === "DT" ? n(i) :
|
|
2061
|
+
let i = Lt(t);
|
|
2062
|
+
return e === "DT" ? n(i) : zt(i, r);
|
|
2063
2063
|
},
|
|
2064
2064
|
parseTag(e, n) {
|
|
2065
2065
|
if (e !== 1n) return;
|
|
2066
2066
|
let r;
|
|
2067
|
-
if (n instanceof
|
|
2068
|
-
else if (n instanceof
|
|
2069
|
-
else if (n instanceof
|
|
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);
|
|
2070
2070
|
else return;
|
|
2071
|
-
return r.start = n.start, r.end = n.end, t ? new
|
|
2071
|
+
return r.start = n.start, r.end = n.end, t ? new Gt(r) : new Wt(r);
|
|
2072
2072
|
}
|
|
2073
2073
|
};
|
|
2074
2074
|
return t && (r.fromJS = (e, t) => {
|
|
2075
|
-
if (e instanceof Date) return new
|
|
2075
|
+
if (e instanceof Date) return new Gt(V(e.getTime() / 1e3));
|
|
2076
2076
|
}, r.isJSType = (e) => e instanceof Date), r;
|
|
2077
2077
|
}
|
|
2078
|
-
var
|
|
2078
|
+
var qt = Kt(), Jt = Kt({ jsDate: !0 });
|
|
2079
2079
|
//#endregion
|
|
2080
2080
|
//#region src/utils/ip.ts
|
|
2081
|
-
function
|
|
2081
|
+
function Yt(e) {
|
|
2082
2082
|
let t = e.split(".");
|
|
2083
2083
|
if (t.length !== 4) throw SyntaxError(`ip: invalid IPv4 address: ${JSON.stringify(e)}`);
|
|
2084
2084
|
let n = /* @__PURE__ */ new Uint8Array(4);
|
|
@@ -2091,11 +2091,11 @@ function Jt(e) {
|
|
|
2091
2091
|
}
|
|
2092
2092
|
return n;
|
|
2093
2093
|
}
|
|
2094
|
-
function
|
|
2094
|
+
function Xt(e) {
|
|
2095
2095
|
let t = /* @__PURE__ */ new Uint8Array(16);
|
|
2096
2096
|
if (e === "::") return t;
|
|
2097
2097
|
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 =
|
|
2098
|
+
i && (n = i[1], n.endsWith(":") && (n += ":"), r = Yt(i[2]));
|
|
2099
2099
|
let a = n.split("::");
|
|
2100
2100
|
if (a.length > 2) throw SyntaxError(`ip: invalid IPv6 address: ${JSON.stringify(e)}`);
|
|
2101
2101
|
let o = a.length === 2, s = a[0] ? a[0].split(":") : [], c = o && a[1] ? a[1].split(":") : [], l = r ? 6 : 8;
|
|
@@ -2112,11 +2112,11 @@ function Yt(e) {
|
|
|
2112
2112
|
}
|
|
2113
2113
|
return r && t.set(r, 12), t;
|
|
2114
2114
|
}
|
|
2115
|
-
function
|
|
2115
|
+
function Zt(e) {
|
|
2116
2116
|
return Array.from(e).join(".");
|
|
2117
2117
|
}
|
|
2118
|
-
function
|
|
2119
|
-
let t = e.slice(0, 10).every((e) => e === 0) && e[10] === 255 && e[11] === 255 ?
|
|
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 = [];
|
|
2120
2120
|
for (let t = 0; t < n * 2; t += 2) r.push(e[t] << 8 | e[t + 1]);
|
|
2121
2121
|
let i = -1, a = 0, o = 0;
|
|
2122
2122
|
for (; o < n;) if (r[o] === 0) {
|
|
@@ -2130,29 +2130,29 @@ function Zt(e) {
|
|
|
2130
2130
|
}
|
|
2131
2131
|
//#endregion
|
|
2132
2132
|
//#region src/extensions/ip.ts
|
|
2133
|
-
var
|
|
2134
|
-
function
|
|
2133
|
+
var $t = "ip", H = "IP", U = 52n, en = 54n, tn = new TextDecoder("utf-8", { fatal: !0 });
|
|
2134
|
+
function nn(e) {
|
|
2135
2135
|
if (e.length !== 1) throw SyntaxError("ip<<...>>: expected exactly one item");
|
|
2136
2136
|
let t = e[0];
|
|
2137
|
-
if (t instanceof
|
|
2138
|
-
if (t instanceof
|
|
2137
|
+
if (t instanceof B) return t.value;
|
|
2138
|
+
if (t instanceof M) return tn.decode(t.value);
|
|
2139
2139
|
throw SyntaxError("ip<<...>>: expected a text string or byte string");
|
|
2140
2140
|
}
|
|
2141
|
-
function
|
|
2141
|
+
function rn(e) {
|
|
2142
2142
|
return /^\d/.test(e) && e.includes(".") && !e.includes(":") ? {
|
|
2143
|
-
bytes:
|
|
2143
|
+
bytes: Yt(e),
|
|
2144
2144
|
isV4: !0
|
|
2145
2145
|
} : {
|
|
2146
|
-
bytes:
|
|
2146
|
+
bytes: Xt(e),
|
|
2147
2147
|
isV4: !1
|
|
2148
2148
|
};
|
|
2149
2149
|
}
|
|
2150
|
-
function
|
|
2151
|
-
if (e.length === 4) return
|
|
2152
|
-
if (e.length === 16) return
|
|
2150
|
+
function an(e) {
|
|
2151
|
+
if (e.length === 4) return Zt(e);
|
|
2152
|
+
if (e.length === 16) return Qt(e);
|
|
2153
2153
|
throw SyntaxError(`ip: unexpected byte length: ${e.length}`);
|
|
2154
2154
|
}
|
|
2155
|
-
function
|
|
2155
|
+
function on(e, t) {
|
|
2156
2156
|
let n = new Uint8Array(e.length);
|
|
2157
2157
|
n.set(e);
|
|
2158
2158
|
let r = Math.floor(t / 8), i = t % 8;
|
|
@@ -2162,72 +2162,72 @@ function an(e, t) {
|
|
|
2162
2162
|
for (; a > 0 && n[a - 1] === 0;) a--;
|
|
2163
2163
|
return n.slice(0, a);
|
|
2164
2164
|
}
|
|
2165
|
-
function
|
|
2165
|
+
function sn(e, t) {
|
|
2166
2166
|
let n = new Uint8Array(t);
|
|
2167
2167
|
return n.set(e), n;
|
|
2168
2168
|
}
|
|
2169
|
-
var
|
|
2169
|
+
var cn = class extends M {
|
|
2170
2170
|
_toCDN(e, t) {
|
|
2171
2171
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2172
2172
|
let n = x(e, this.encodingWidth, () => b(BigInt(this.value.length)));
|
|
2173
|
-
return `${
|
|
2173
|
+
return `${$t}'${an(this.value)}'${n}`;
|
|
2174
2174
|
}
|
|
2175
|
-
},
|
|
2175
|
+
}, ln = class extends F {
|
|
2176
2176
|
_isV4;
|
|
2177
2177
|
constructor(e, t, n) {
|
|
2178
|
-
super([new
|
|
2178
|
+
super([new O(BigInt(e)), new M(t)]), this._isV4 = n;
|
|
2179
2179
|
}
|
|
2180
2180
|
_toCDN(e, t) {
|
|
2181
2181
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2182
2182
|
let n = Number(this.items[0].value), r = this.items[1].value;
|
|
2183
|
-
return `${
|
|
2183
|
+
return `${$t}'${an(sn(r, this._isV4 ? 4 : 16))}/${n}'`;
|
|
2184
2184
|
}
|
|
2185
|
-
},
|
|
2185
|
+
}, un = class extends j {
|
|
2186
2186
|
constructor(e, t) {
|
|
2187
2187
|
super(e, t);
|
|
2188
2188
|
}
|
|
2189
2189
|
_toCDN(e, t) {
|
|
2190
2190
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2191
|
-
let n = this.tag ===
|
|
2192
|
-
if (r instanceof
|
|
2191
|
+
let n = this.tag === U ? 4 : 16, r = this.content;
|
|
2192
|
+
if (r instanceof M) {
|
|
2193
2193
|
if (r.encodingWidth !== void 0) return super._toCDN(e, t);
|
|
2194
2194
|
let n = x(e, this.encodingWidth, () => b(this.tag));
|
|
2195
|
-
return `${
|
|
2195
|
+
return `${H}'${an(r.value)}'${n}`;
|
|
2196
2196
|
}
|
|
2197
|
-
if (r instanceof
|
|
2197
|
+
if (r instanceof F && r.items.length === 2 && r.items[0] instanceof O && r.items[1] instanceof M) {
|
|
2198
2198
|
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 =
|
|
2200
|
-
return `${
|
|
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}`;
|
|
2201
2201
|
}
|
|
2202
2202
|
return super._toCDN(e, t);
|
|
2203
2203
|
}
|
|
2204
2204
|
};
|
|
2205
|
-
function
|
|
2205
|
+
function dn(e, t) {
|
|
2206
2206
|
let n = t.indexOf("/");
|
|
2207
2207
|
if (n === -1) {
|
|
2208
|
-
let { bytes: n, isV4: r } =
|
|
2209
|
-
return e ===
|
|
2208
|
+
let { bytes: n, isV4: r } = rn(t);
|
|
2209
|
+
return e === H ? new un(r ? U : en, new M(n)) : new cn(n);
|
|
2210
2210
|
}
|
|
2211
2211
|
let r = t.slice(0, n), i = t.slice(n + 1);
|
|
2212
2212
|
if (!/^\d+$/.test(i)) throw SyntaxError(`ip: invalid prefix length: ${JSON.stringify(i)}`);
|
|
2213
|
-
let a = parseInt(i, 10), { bytes: o, isV4: s } =
|
|
2213
|
+
let a = parseInt(i, 10), { bytes: o, isV4: s } = rn(r), c = s ? 32 : 128;
|
|
2214
2214
|
if (a > c) throw SyntaxError(`ip: prefix length ${a} exceeds maximum ${c} for ${s ? "IPv4" : "IPv6"}`);
|
|
2215
|
-
let l =
|
|
2216
|
-
return e ===
|
|
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);
|
|
2217
2217
|
}
|
|
2218
|
-
var
|
|
2219
|
-
appStringPrefixes: [
|
|
2220
|
-
tagNumbers: [
|
|
2218
|
+
var fn = {
|
|
2219
|
+
appStringPrefixes: [$t, H],
|
|
2220
|
+
tagNumbers: [U, en],
|
|
2221
2221
|
parseAppString(e, t) {
|
|
2222
|
-
return
|
|
2222
|
+
return dn(e, t);
|
|
2223
2223
|
},
|
|
2224
2224
|
parseAppSequence(e, t) {
|
|
2225
|
-
return
|
|
2225
|
+
return dn(e, nn(t));
|
|
2226
2226
|
},
|
|
2227
2227
|
parseTag(e, t) {
|
|
2228
|
-
if (!(e !==
|
|
2228
|
+
if (!(e !== U && e !== en) && (t instanceof M || t instanceof F)) return new un(e, t);
|
|
2229
2229
|
}
|
|
2230
|
-
},
|
|
2230
|
+
}, pn = "cri", mn = "CRI", hn = 99n, gn = /* @__PURE__ */ new Map([
|
|
2231
2231
|
["coap", -1n],
|
|
2232
2232
|
["coaps", -2n],
|
|
2233
2233
|
["http", -3n],
|
|
@@ -2238,47 +2238,47 @@ var dn = {
|
|
|
2238
2238
|
["coaps+tcp", -8n],
|
|
2239
2239
|
["coap+ws", -25n],
|
|
2240
2240
|
["coaps+ws", -26n]
|
|
2241
|
-
]),
|
|
2242
|
-
function
|
|
2241
|
+
]), _n = new Map([...gn.entries()].map(([e, t]) => [t, e]));
|
|
2242
|
+
function W(e) {
|
|
2243
2243
|
try {
|
|
2244
2244
|
return decodeURIComponent(e);
|
|
2245
2245
|
} catch {
|
|
2246
2246
|
return e;
|
|
2247
2247
|
}
|
|
2248
2248
|
}
|
|
2249
|
-
var
|
|
2250
|
-
function
|
|
2251
|
-
return Array.from(
|
|
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("");
|
|
2252
2252
|
}
|
|
2253
|
-
function
|
|
2253
|
+
function G(e, t) {
|
|
2254
2254
|
let n = "";
|
|
2255
|
-
for (let r of e) n += t(r) ? r :
|
|
2255
|
+
for (let r of e) n += t(r) ? r : bn(r);
|
|
2256
2256
|
return n;
|
|
2257
2257
|
}
|
|
2258
|
-
function bn(e) {
|
|
2259
|
-
return /[A-Za-z0-9\-._~]/.test(e);
|
|
2260
|
-
}
|
|
2261
2258
|
function xn(e) {
|
|
2262
|
-
return /[
|
|
2259
|
+
return /[A-Za-z0-9\-._~]/.test(e);
|
|
2263
2260
|
}
|
|
2264
2261
|
function Sn(e) {
|
|
2265
|
-
return
|
|
2262
|
+
return /[!$&'()*+,;=]/.test(e);
|
|
2266
2263
|
}
|
|
2267
2264
|
function Cn(e) {
|
|
2268
|
-
return (Sn(e) || e === "
|
|
2265
|
+
return xn(e) || Sn(e) || e === ":" || e === "@";
|
|
2269
2266
|
}
|
|
2270
2267
|
function wn(e) {
|
|
2271
|
-
return
|
|
2268
|
+
return (Cn(e) || e === "/" || e === "?") && e !== "&";
|
|
2272
2269
|
}
|
|
2273
2270
|
function Tn(e) {
|
|
2274
|
-
return
|
|
2271
|
+
return Cn(e) || e === "/" || e === "?";
|
|
2275
2272
|
}
|
|
2276
2273
|
function En(e) {
|
|
2277
|
-
return
|
|
2274
|
+
return xn(e) || Sn(e) || e === ":";
|
|
2278
2275
|
}
|
|
2279
2276
|
function Dn(e) {
|
|
2277
|
+
return xn(e) || Sn(e);
|
|
2278
|
+
}
|
|
2279
|
+
function On(e) {
|
|
2280
2280
|
let t = [], n = e, r = n.indexOf("@");
|
|
2281
|
-
r >= 0 && (t.push(
|
|
2281
|
+
r >= 0 && (t.push(L.FALSE), t.push(new B(W(n.slice(0, r)))), n = n.slice(r + 1));
|
|
2282
2282
|
let i, a = null;
|
|
2283
2283
|
if (n.startsWith("[")) {
|
|
2284
2284
|
let e = n.indexOf("]");
|
|
@@ -2287,263 +2287,263 @@ function Dn(e) {
|
|
|
2287
2287
|
let r = n.slice(e + 1);
|
|
2288
2288
|
if (r.startsWith(":")) a = r.slice(1);
|
|
2289
2289
|
else if (r.length > 0) throw SyntaxError("cri: unexpected characters after ']' in authority");
|
|
2290
|
-
t.push(new
|
|
2290
|
+
t.push(new M(Xt(i)));
|
|
2291
2291
|
} else {
|
|
2292
2292
|
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
|
|
2294
|
-
else for (let e of i.toLowerCase().split(".")) t.push(new
|
|
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));
|
|
2295
2295
|
}
|
|
2296
2296
|
if (a !== null && a !== "") {
|
|
2297
2297
|
if (!/^\d+$/.test(a)) throw SyntaxError(`cri: invalid port: ${JSON.stringify(a)}`);
|
|
2298
2298
|
let e = parseInt(a, 10);
|
|
2299
2299
|
if (e > 65535) throw SyntaxError(`cri: port ${e} out of range`);
|
|
2300
|
-
t.push(new
|
|
2300
|
+
t.push(new O(BigInt(e)));
|
|
2301
2301
|
}
|
|
2302
|
-
return new
|
|
2302
|
+
return new F(t);
|
|
2303
2303
|
}
|
|
2304
|
-
function
|
|
2304
|
+
function kn(e) {
|
|
2305
2305
|
let t = e.items, n = 0, r = "";
|
|
2306
|
-
if (n < t.length && t[n] instanceof
|
|
2306
|
+
if (n < t.length && t[n] instanceof L && t[n].value === 20) {
|
|
2307
2307
|
n++;
|
|
2308
2308
|
let e = t[n++];
|
|
2309
|
-
r +=
|
|
2309
|
+
r += G(e.value, En) + "@";
|
|
2310
2310
|
}
|
|
2311
2311
|
if (n >= t.length) return r;
|
|
2312
2312
|
let i = t[n];
|
|
2313
|
-
if (i instanceof
|
|
2313
|
+
if (i instanceof M) {
|
|
2314
2314
|
n++;
|
|
2315
2315
|
let { length: e } = i.value;
|
|
2316
|
-
if (e === 4) r +=
|
|
2317
|
-
else if (e === 16) r += "[" +
|
|
2316
|
+
if (e === 4) r += Zt(i.value);
|
|
2317
|
+
else if (e === 16) r += "[" + Qt(i.value) + "]";
|
|
2318
2318
|
else throw Error(`cri: unexpected host-ip byte length: ${e}`);
|
|
2319
|
-
n < t.length && t[n] instanceof
|
|
2319
|
+
n < t.length && t[n] instanceof B && (r += `%25${G(t[n++].value, Dn)}`);
|
|
2320
2320
|
} else {
|
|
2321
2321
|
let e = [];
|
|
2322
|
-
for (; n < t.length && t[n] instanceof
|
|
2322
|
+
for (; n < t.length && t[n] instanceof B;) e.push(G(t[n++].value, Dn));
|
|
2323
2323
|
r += e.join(".");
|
|
2324
2324
|
}
|
|
2325
|
-
return n < t.length && t[n] instanceof
|
|
2325
|
+
return n < t.length && t[n] instanceof O && (r += ":" + t[n].value.toString()), r;
|
|
2326
2326
|
}
|
|
2327
|
-
function
|
|
2327
|
+
function An(e) {
|
|
2328
2328
|
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
|
|
2330
|
-
authority:
|
|
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),
|
|
2331
2331
|
pathSegments: i
|
|
2332
2332
|
};
|
|
2333
2333
|
}
|
|
2334
|
-
function
|
|
2334
|
+
function jn(e) {
|
|
2335
2335
|
let t = e, n = null, r = t.indexOf("#");
|
|
2336
|
-
r >= 0 && (n =
|
|
2336
|
+
r >= 0 && (n = W(t.slice(r + 1)), t = t.slice(0, r));
|
|
2337
2337
|
let i = null, a = t.indexOf("?");
|
|
2338
2338
|
if (a >= 0) {
|
|
2339
2339
|
let e = t.slice(a + 1);
|
|
2340
|
-
t = t.slice(0, a), i = e.split("&").map((e) => new
|
|
2340
|
+
t = t.slice(0, a), i = e.split("&").map((e) => new B(W(e)));
|
|
2341
2341
|
}
|
|
2342
2342
|
let o = [], s = /^([a-zA-Z][a-zA-Z0-9+.\-]*):([\s\S]*)$/.exec(t);
|
|
2343
2343
|
if (s) {
|
|
2344
|
-
let e = s[1].toLowerCase(), t = s[2], n =
|
|
2345
|
-
if (o.push(n === void 0 ? new
|
|
2346
|
-
let { authority: e, pathSegments: n } =
|
|
2347
|
-
o.push(e, new
|
|
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));
|
|
2348
2348
|
} else if (t.startsWith("/")) {
|
|
2349
|
-
let e = t.slice(1).split("/").map((e) => new
|
|
2350
|
-
o.push(
|
|
2349
|
+
let e = t.slice(1).split("/").map((e) => new B(W(e)));
|
|
2350
|
+
o.push(L.NULL, new F(e));
|
|
2351
2351
|
} else {
|
|
2352
|
-
let e = t.split("/").map((e) => new
|
|
2353
|
-
o.push(
|
|
2352
|
+
let e = t.split("/").map((e) => new B(W(e)));
|
|
2353
|
+
o.push(L.TRUE, new F(e));
|
|
2354
2354
|
}
|
|
2355
2355
|
} else if (t.startsWith("//")) {
|
|
2356
|
-
let { authority: e, pathSegments: n } =
|
|
2357
|
-
o.push(
|
|
2356
|
+
let { authority: e, pathSegments: n } = An(t);
|
|
2357
|
+
o.push(L.FALSE, e, new F(n));
|
|
2358
2358
|
} else if (t.startsWith("/")) {
|
|
2359
|
-
let e = t.slice(1).split("/").map((e) => new
|
|
2360
|
-
o.push(
|
|
2361
|
-
} else if (t === "") o.push(new
|
|
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));
|
|
2362
2362
|
else {
|
|
2363
2363
|
let n = 1n, r = t, i = !1;
|
|
2364
2364
|
for (r.startsWith("./") && (i = !0, r = r.slice(2)); r.startsWith("../");) n++, r = r.slice(3);
|
|
2365
2365
|
if (r === ".." ? (n++, r = "") : r === "." && (r = ""), n === 1n && !i && r !== "" && r.split("/")[0].includes(":")) throw SyntaxError(`cri: invalid relative-path reference — first segment must not contain ':' without a './' prefix (RFC 3986 §3.3): ${JSON.stringify(e)}`);
|
|
2366
|
-
let a = r === "" ? [] : r.split("/").map((e) => new
|
|
2367
|
-
o.push(new
|
|
2366
|
+
let a = r === "" ? [] : r.split("/").map((e) => new B(W(e)));
|
|
2367
|
+
o.push(new O(n), new F(a));
|
|
2368
2368
|
}
|
|
2369
|
-
if (i !== null && o.push(new
|
|
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) {
|
|
2370
2370
|
let e = o[o.length - 1];
|
|
2371
|
-
e instanceof
|
|
2371
|
+
e instanceof F && e.items.length === 0 && o.pop();
|
|
2372
2372
|
}
|
|
2373
|
-
return o.length === 1 && o[0] instanceof
|
|
2373
|
+
return o.length === 1 && o[0] instanceof O && o[0].value === 0n ? [] : o;
|
|
2374
2374
|
}
|
|
2375
|
-
function
|
|
2375
|
+
function K(e, t) {
|
|
2376
2376
|
let n = t, r = "";
|
|
2377
2377
|
if (n < e.length) {
|
|
2378
2378
|
let t = e[n];
|
|
2379
|
-
if (t instanceof
|
|
2379
|
+
if (t instanceof F) {
|
|
2380
2380
|
if (n++, t.items.length > 0) {
|
|
2381
2381
|
let e = t.items.map((e) => {
|
|
2382
|
-
if (!(e instanceof
|
|
2383
|
-
return
|
|
2382
|
+
if (!(e instanceof B)) throw Error("cri: query item must be a text string");
|
|
2383
|
+
return G(e.value, wn);
|
|
2384
2384
|
});
|
|
2385
2385
|
r += "?" + e.join("&");
|
|
2386
2386
|
}
|
|
2387
|
-
} else t instanceof
|
|
2387
|
+
} else t instanceof L && t.value === 22 && n++;
|
|
2388
2388
|
}
|
|
2389
|
-
return n < e.length && e[n] instanceof
|
|
2389
|
+
return n < e.length && e[n] instanceof B && (r += "#" + G(e[n].value, Tn)), r;
|
|
2390
2390
|
}
|
|
2391
|
-
function
|
|
2391
|
+
function Mn(e) {
|
|
2392
2392
|
return e.items.map((e) => {
|
|
2393
|
-
if (!(e instanceof
|
|
2394
|
-
return
|
|
2393
|
+
if (!(e instanceof B)) throw Error("cri: path segment must be a text string");
|
|
2394
|
+
return G(e.value, Cn);
|
|
2395
2395
|
});
|
|
2396
2396
|
}
|
|
2397
|
-
function
|
|
2397
|
+
function Nn(e) {
|
|
2398
2398
|
if (e.length === 0) return "";
|
|
2399
2399
|
let t = 0, n = e[t++];
|
|
2400
|
-
if (n instanceof
|
|
2400
|
+
if (n instanceof k || n instanceof B) {
|
|
2401
2401
|
let r;
|
|
2402
|
-
if (n instanceof
|
|
2403
|
-
let e =
|
|
2402
|
+
if (n instanceof k) {
|
|
2403
|
+
let e = _n.get(n.value);
|
|
2404
2404
|
if (e === void 0) throw Error(`cri: unrecognised scheme-id ${n.value}`);
|
|
2405
2405
|
r = e + ":";
|
|
2406
2406
|
} else r = n.value + ":";
|
|
2407
2407
|
if (t >= e.length) return r;
|
|
2408
2408
|
let i = e[t++], a = "", o = !1;
|
|
2409
|
-
if (i instanceof
|
|
2410
|
-
else if (i instanceof
|
|
2409
|
+
if (i instanceof F) a = "//" + kn(i), o = !0;
|
|
2410
|
+
else if (i instanceof L) if (i.value === 22) o = !0;
|
|
2411
2411
|
else if (i.value === 21) o = !1;
|
|
2412
2412
|
else throw Error(`cri: unexpected no-authority value: simple(${i.value})`);
|
|
2413
2413
|
else throw Error("cri: unexpected type for authority element");
|
|
2414
2414
|
let s = "";
|
|
2415
|
-
if (t < e.length && e[t] instanceof
|
|
2415
|
+
if (t < e.length && e[t] instanceof F) {
|
|
2416
2416
|
let n = e[t++];
|
|
2417
|
-
n.items.length > 0 && (s = (o ? "/" : "") +
|
|
2417
|
+
n.items.length > 0 && (s = (o ? "/" : "") + Mn(n).join("/"));
|
|
2418
2418
|
}
|
|
2419
|
-
return r + a + s +
|
|
2419
|
+
return r + a + s + K(e, t);
|
|
2420
2420
|
}
|
|
2421
|
-
if (n instanceof
|
|
2422
|
-
if (t >= e.length || !(e[t] instanceof
|
|
2423
|
-
let n =
|
|
2424
|
-
if (t < e.length && e[t] instanceof
|
|
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) {
|
|
2425
2425
|
let n = e[t++];
|
|
2426
|
-
n.items.length > 0 && (r = "/" +
|
|
2426
|
+
n.items.length > 0 && (r = "/" + Mn(n).join("/"));
|
|
2427
2427
|
}
|
|
2428
|
-
return "//" + n + r +
|
|
2428
|
+
return "//" + n + r + K(e, t);
|
|
2429
2429
|
}
|
|
2430
|
-
if (n instanceof
|
|
2430
|
+
if (n instanceof L && n.value === 21) {
|
|
2431
2431
|
let n = "/";
|
|
2432
|
-
if (t < e.length && e[t] instanceof
|
|
2432
|
+
if (t < e.length && e[t] instanceof F) {
|
|
2433
2433
|
let r = e[t++];
|
|
2434
|
-
n = "/" +
|
|
2434
|
+
n = "/" + Mn(r).join("/");
|
|
2435
2435
|
}
|
|
2436
|
-
return n +
|
|
2436
|
+
return n + K(e, t);
|
|
2437
2437
|
}
|
|
2438
|
-
if (n instanceof
|
|
2438
|
+
if (n instanceof O) {
|
|
2439
2439
|
let r = n.value;
|
|
2440
|
-
if (r === 0n) return
|
|
2440
|
+
if (r === 0n) return K(e, t);
|
|
2441
2441
|
let i = r === 1n ? "" : "../".repeat(Number(r) - 1), a;
|
|
2442
|
-
if (t < e.length && e[t] instanceof
|
|
2442
|
+
if (t < e.length && e[t] instanceof F) {
|
|
2443
2443
|
let n = e[t++];
|
|
2444
2444
|
if (n.items.length > 0) {
|
|
2445
|
-
let e =
|
|
2445
|
+
let e = Mn(n);
|
|
2446
2446
|
a = (r === 1n && e[0].includes(":") ? "./" : i) + e.join("/");
|
|
2447
2447
|
} else a = i === "" ? "./" : i;
|
|
2448
2448
|
} else a = i === "" ? "./" : i;
|
|
2449
|
-
return a +
|
|
2449
|
+
return a + K(e, t);
|
|
2450
2450
|
}
|
|
2451
2451
|
throw Error("cri: unrecognised first element type in CRI array");
|
|
2452
2452
|
}
|
|
2453
|
-
var
|
|
2453
|
+
var Pn = class extends F {
|
|
2454
2454
|
_toCDN(e, t) {
|
|
2455
2455
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2456
2456
|
try {
|
|
2457
2457
|
let t = x(e, this.encodingWidth, () => b(BigInt(this.items.length)));
|
|
2458
|
-
return `${
|
|
2458
|
+
return `${pn}'${Nn(this.items)}'${t}`;
|
|
2459
2459
|
} catch {
|
|
2460
2460
|
return super._toCDN(e, t);
|
|
2461
2461
|
}
|
|
2462
2462
|
}
|
|
2463
|
-
},
|
|
2463
|
+
}, Fn = class extends j {
|
|
2464
2464
|
constructor(e) {
|
|
2465
|
-
super(
|
|
2465
|
+
super(hn, e);
|
|
2466
2466
|
}
|
|
2467
2467
|
_toCDN(e, t) {
|
|
2468
2468
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2469
2469
|
try {
|
|
2470
2470
|
let n = this.content;
|
|
2471
2471
|
if (n.encodingWidth !== void 0) return super._toCDN(e, t);
|
|
2472
|
-
let r = x(e, this.encodingWidth, () => b(
|
|
2473
|
-
return `${
|
|
2472
|
+
let r = x(e, this.encodingWidth, () => b(hn));
|
|
2473
|
+
return `${mn}'${Nn(n.items)}'${r}`;
|
|
2474
2474
|
} catch {
|
|
2475
2475
|
return super._toCDN(e, t);
|
|
2476
2476
|
}
|
|
2477
2477
|
}
|
|
2478
2478
|
};
|
|
2479
|
-
function
|
|
2479
|
+
function In(e) {
|
|
2480
2480
|
if (e.length !== 1) throw SyntaxError("cri<<...>>: expected exactly one item");
|
|
2481
2481
|
let t = e[0];
|
|
2482
|
-
if (t instanceof
|
|
2483
|
-
if (t instanceof
|
|
2482
|
+
if (t instanceof B) return t.value;
|
|
2483
|
+
if (t instanceof M) return yn.decode(t.value);
|
|
2484
2484
|
throw SyntaxError("cri<<...>>: expected a text string or byte string");
|
|
2485
2485
|
}
|
|
2486
|
-
function
|
|
2487
|
-
let n = new
|
|
2488
|
-
return e ===
|
|
2486
|
+
function Ln(e, t) {
|
|
2487
|
+
let n = new Pn(jn(t));
|
|
2488
|
+
return e === mn ? new Fn(n) : n;
|
|
2489
2489
|
}
|
|
2490
|
-
var
|
|
2491
|
-
appStringPrefixes: [
|
|
2492
|
-
tagNumbers: [
|
|
2490
|
+
var Rn = {
|
|
2491
|
+
appStringPrefixes: [pn, mn],
|
|
2492
|
+
tagNumbers: [hn],
|
|
2493
2493
|
parseAppString(e, t) {
|
|
2494
|
-
return
|
|
2494
|
+
return Ln(e, t);
|
|
2495
2495
|
},
|
|
2496
2496
|
parseAppSequence(e, t) {
|
|
2497
|
-
return
|
|
2497
|
+
return Ln(e, In(t));
|
|
2498
2498
|
},
|
|
2499
2499
|
parseTag(e, t) {
|
|
2500
|
-
if (e !== 99n || !(t instanceof
|
|
2501
|
-
let n = new
|
|
2500
|
+
if (e !== 99n || !(t instanceof F)) return;
|
|
2501
|
+
let n = new Pn(t.items, {
|
|
2502
2502
|
indefiniteLength: t.indefiniteLength,
|
|
2503
2503
|
encodingWidth: t.encodingWidth
|
|
2504
2504
|
});
|
|
2505
|
-
return n.start = t.start, n.end = t.end, new
|
|
2505
|
+
return n.start = t.start, n.end = t.end, new Fn(n);
|
|
2506
2506
|
}
|
|
2507
|
-
},
|
|
2508
|
-
tagNumbers: [
|
|
2507
|
+
}, zn = 18446744073709551615n, Bn = -18446744073709551616n, Vn = {
|
|
2508
|
+
tagNumbers: [Ye, Xe],
|
|
2509
2509
|
parseTag(e, t) {
|
|
2510
|
-
if (t instanceof
|
|
2510
|
+
if (t instanceof M) {
|
|
2511
2511
|
if (e === 2n) {
|
|
2512
|
-
let e =
|
|
2513
|
-
return e >
|
|
2512
|
+
let e = et(t.value);
|
|
2513
|
+
return e > zn ? new tt(e) : void 0;
|
|
2514
2514
|
}
|
|
2515
2515
|
if (e === 3n) {
|
|
2516
|
-
let e = -1n -
|
|
2517
|
-
return e <
|
|
2516
|
+
let e = -1n - et(t.value);
|
|
2517
|
+
return e < Bn ? new nt(e) : void 0;
|
|
2518
2518
|
}
|
|
2519
2519
|
}
|
|
2520
2520
|
}
|
|
2521
2521
|
};
|
|
2522
2522
|
//#endregion
|
|
2523
2523
|
//#region src/cbor/decoder.ts
|
|
2524
|
-
function
|
|
2524
|
+
function Hn(e, t) {
|
|
2525
2525
|
if (e === 24 && t <= 23n) return 0;
|
|
2526
2526
|
if (e === 25 && t <= 255n) return 1;
|
|
2527
2527
|
if (e === 26 && t <= 65535n) return 2;
|
|
2528
2528
|
if (e === 27 && t <= 4294967295n) return 3;
|
|
2529
2529
|
}
|
|
2530
|
-
function
|
|
2530
|
+
function Un(e, t) {
|
|
2531
2531
|
if (e === 24 && t <= 23) return 0;
|
|
2532
2532
|
if (e === 25 && t <= 255) return 1;
|
|
2533
2533
|
if (e === 26 && t <= 65535) return 2;
|
|
2534
2534
|
if (e === 27 && t <= 4294967295) return 3;
|
|
2535
2535
|
}
|
|
2536
|
-
var
|
|
2536
|
+
var Wn = new TextDecoder("utf-8", {
|
|
2537
2537
|
fatal: !0,
|
|
2538
2538
|
ignoreBOM: !0
|
|
2539
|
-
}),
|
|
2539
|
+
}), Gn = new TextDecoder("utf-8", {
|
|
2540
2540
|
fatal: !1,
|
|
2541
2541
|
ignoreBOM: !0
|
|
2542
2542
|
});
|
|
2543
|
-
function
|
|
2543
|
+
function q(e) {
|
|
2544
2544
|
throw Error(`CBOR decode error: ${e}`);
|
|
2545
2545
|
}
|
|
2546
|
-
function
|
|
2546
|
+
function Kn(e, t, n) {
|
|
2547
2547
|
let r = {
|
|
2548
2548
|
message: e,
|
|
2549
2549
|
offset: t
|
|
@@ -2551,51 +2551,51 @@ function Gn(e, t, n) {
|
|
|
2551
2551
|
if (n?.onWarning ? n.onWarning(r) : n?.silent || console.warn(`CBOR strict violation at offset ${t}: ${e}`), n?.strict !== !1) throw Error(`CBOR decode error: ${e}`);
|
|
2552
2552
|
return r;
|
|
2553
2553
|
}
|
|
2554
|
-
function
|
|
2554
|
+
function J(e, t) {
|
|
2555
2555
|
e.warnings ??= [], e.warnings.push(t);
|
|
2556
2556
|
}
|
|
2557
|
-
function
|
|
2558
|
-
if (e instanceof
|
|
2559
|
-
if (e instanceof
|
|
2560
|
-
if (e instanceof
|
|
2561
|
-
if (e instanceof
|
|
2562
|
-
if (e instanceof
|
|
2563
|
-
if (e instanceof
|
|
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) {
|
|
2564
2564
|
let t = "";
|
|
2565
2565
|
for (let n of e.chunks) t += i(n.value);
|
|
2566
2566
|
return ["b", t];
|
|
2567
2567
|
}
|
|
2568
|
-
if (e instanceof
|
|
2569
|
-
if (e instanceof
|
|
2570
|
-
if (e instanceof
|
|
2571
|
-
if (e instanceof
|
|
2572
|
-
let t = e.entries.map(([e, t]) => [
|
|
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)]);
|
|
2573
2573
|
if (t.length <= 1) return ["M", t];
|
|
2574
2574
|
let n = t.map((e) => [JSON.stringify(e[0]), e]);
|
|
2575
2575
|
return n.sort((e, t) => e[0] < t[0] ? -1 : +(e[0] > t[0])), ["M", n.map((e) => e[1])];
|
|
2576
2576
|
}
|
|
2577
|
-
return e instanceof
|
|
2577
|
+
return e instanceof j ? [
|
|
2578
2578
|
"G",
|
|
2579
2579
|
String(e.tag),
|
|
2580
|
-
|
|
2580
|
+
Y(e.content)
|
|
2581
2581
|
] : ["c", i(e.toCBOR())];
|
|
2582
2582
|
}
|
|
2583
2583
|
function qn(e) {
|
|
2584
|
-
if (e instanceof
|
|
2585
|
-
if (e instanceof
|
|
2586
|
-
if (e instanceof
|
|
2587
|
-
if (e instanceof
|
|
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) {
|
|
2588
2588
|
let t = "t";
|
|
2589
2589
|
for (let n of e.chunks) t += n.value;
|
|
2590
2590
|
return t;
|
|
2591
2591
|
}
|
|
2592
|
-
if (e instanceof
|
|
2593
|
-
if (e instanceof
|
|
2592
|
+
if (e instanceof M) return "b" + i(e.value);
|
|
2593
|
+
if (e instanceof N) {
|
|
2594
2594
|
let t = "b";
|
|
2595
2595
|
for (let n of e.chunks) t += i(n.value);
|
|
2596
2596
|
return t;
|
|
2597
2597
|
}
|
|
2598
|
-
return e instanceof
|
|
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));
|
|
2599
2599
|
}
|
|
2600
2600
|
var Jn = Array.from({ length: 24 }, (e, t) => BigInt(t)), Yn;
|
|
2601
2601
|
function Xn(e) {
|
|
@@ -2611,23 +2611,23 @@ function Qn(e, t, n) {
|
|
|
2611
2611
|
nextOffset: t
|
|
2612
2612
|
};
|
|
2613
2613
|
switch (n) {
|
|
2614
|
-
case 24: return t + 1 > e.byteLength &&
|
|
2614
|
+
case 24: return t + 1 > e.byteLength && q("unexpected end of input"), {
|
|
2615
2615
|
value: BigInt(e.getUint8(t)),
|
|
2616
2616
|
nextOffset: t + 1
|
|
2617
2617
|
};
|
|
2618
|
-
case 25: return t + 2 > e.byteLength &&
|
|
2618
|
+
case 25: return t + 2 > e.byteLength && q("unexpected end of input"), {
|
|
2619
2619
|
value: BigInt(e.getUint16(t, !1)),
|
|
2620
2620
|
nextOffset: t + 2
|
|
2621
2621
|
};
|
|
2622
|
-
case 26: return t + 4 > e.byteLength &&
|
|
2622
|
+
case 26: return t + 4 > e.byteLength && q("unexpected end of input"), {
|
|
2623
2623
|
value: BigInt(e.getUint32(t, !1)),
|
|
2624
2624
|
nextOffset: t + 4
|
|
2625
2625
|
};
|
|
2626
|
-
case 27: return t + 8 > e.byteLength &&
|
|
2626
|
+
case 27: return t + 8 > e.byteLength && q("unexpected end of input"), {
|
|
2627
2627
|
value: e.getBigUint64(t, !1),
|
|
2628
2628
|
nextOffset: t + 8
|
|
2629
2629
|
};
|
|
2630
|
-
default:
|
|
2630
|
+
default: q(`reserved additional info value: ${n}`);
|
|
2631
2631
|
}
|
|
2632
2632
|
}
|
|
2633
2633
|
function $n(e, t, n) {
|
|
@@ -2636,38 +2636,38 @@ function $n(e, t, n) {
|
|
|
2636
2636
|
nextOffset: t
|
|
2637
2637
|
};
|
|
2638
2638
|
switch (n) {
|
|
2639
|
-
case 24: return t + 1 > e.byteLength &&
|
|
2639
|
+
case 24: return t + 1 > e.byteLength && q("unexpected end of input"), {
|
|
2640
2640
|
value: e.getUint8(t),
|
|
2641
2641
|
nextOffset: t + 1
|
|
2642
2642
|
};
|
|
2643
|
-
case 25: return t + 2 > e.byteLength &&
|
|
2643
|
+
case 25: return t + 2 > e.byteLength && q("unexpected end of input"), {
|
|
2644
2644
|
value: e.getUint16(t, !1),
|
|
2645
2645
|
nextOffset: t + 2
|
|
2646
2646
|
};
|
|
2647
|
-
case 26: return t + 4 > e.byteLength &&
|
|
2647
|
+
case 26: return t + 4 > e.byteLength && q("unexpected end of input"), {
|
|
2648
2648
|
value: e.getUint32(t, !1),
|
|
2649
2649
|
nextOffset: t + 4
|
|
2650
2650
|
};
|
|
2651
2651
|
case 27: {
|
|
2652
|
-
t + 8 > e.byteLength &&
|
|
2652
|
+
t + 8 > e.byteLength && q("unexpected end of input");
|
|
2653
2653
|
let n = e.getUint32(t, !1), r = e.getUint32(t + 4, !1);
|
|
2654
2654
|
return {
|
|
2655
2655
|
value: n * 4294967296 + r,
|
|
2656
2656
|
nextOffset: t + 8
|
|
2657
2657
|
};
|
|
2658
2658
|
}
|
|
2659
|
-
default:
|
|
2659
|
+
default: q(`reserved additional info value: ${n}`);
|
|
2660
2660
|
}
|
|
2661
2661
|
}
|
|
2662
2662
|
function er(e, t, n, r, i, a) {
|
|
2663
2663
|
let o = [], s = t;
|
|
2664
2664
|
for (;;) {
|
|
2665
|
-
if (s >= e.byteLength &&
|
|
2665
|
+
if (s >= e.byteLength && q(`unexpected end of indefinite ${i}`), e.getUint8(s) === 255) {
|
|
2666
2666
|
s++;
|
|
2667
2667
|
break;
|
|
2668
2668
|
}
|
|
2669
2669
|
let t = X(e, s, n, r);
|
|
2670
|
-
a(t.value) ||
|
|
2670
|
+
a(t.value) || q(`indefinite-length ${i} chunk must be a definite ${i}`), o.push(t.value), s = t.nextOffset;
|
|
2671
2671
|
}
|
|
2672
2672
|
return {
|
|
2673
2673
|
chunks: o,
|
|
@@ -2676,7 +2676,7 @@ function er(e, t, n, r, i, a) {
|
|
|
2676
2676
|
}
|
|
2677
2677
|
function tr(e, t, n, r) {
|
|
2678
2678
|
let i = qn(e);
|
|
2679
|
-
t.has(i) && n.push(
|
|
2679
|
+
t.has(i) && n.push(Kn(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
|
|
2680
2680
|
}
|
|
2681
2681
|
function X(e, t, n, r) {
|
|
2682
2682
|
let i = t, a = rr(e, t, n, r);
|
|
@@ -2686,56 +2686,56 @@ function nr(e, t, n) {
|
|
|
2686
2686
|
return new Uint8Array(e.buffer, e.byteOffset + t, n).slice();
|
|
2687
2687
|
}
|
|
2688
2688
|
function rr(e, t, n, r) {
|
|
2689
|
-
t >= e.byteLength &&
|
|
2689
|
+
t >= e.byteLength && q("unexpected end of input");
|
|
2690
2690
|
let i = e.getUint8(t++), a = i >> 5, o = i & 31;
|
|
2691
2691
|
switch (a) {
|
|
2692
2692
|
case 0: {
|
|
2693
2693
|
let { value: n, nextOffset: r } = Qn(e, t, o);
|
|
2694
2694
|
return {
|
|
2695
|
-
value: new
|
|
2695
|
+
value: new O(n, { encodingWidth: Hn(o, n) }),
|
|
2696
2696
|
nextOffset: r
|
|
2697
2697
|
};
|
|
2698
2698
|
}
|
|
2699
2699
|
case 1: {
|
|
2700
|
-
let { value: n, nextOffset: r } = Qn(e, t, o), i =
|
|
2700
|
+
let { value: n, nextOffset: r } = Qn(e, t, o), i = Hn(o, n);
|
|
2701
2701
|
return {
|
|
2702
|
-
value: new
|
|
2702
|
+
value: new k(-1n - n, { encodingWidth: i }),
|
|
2703
2703
|
nextOffset: r
|
|
2704
2704
|
};
|
|
2705
2705
|
}
|
|
2706
2706
|
case 2: {
|
|
2707
2707
|
if (o === 31) {
|
|
2708
|
-
let { chunks: i, nextOffset: a } = er(e, t, n, r, "byte string", (e) => e instanceof
|
|
2708
|
+
let { chunks: i, nextOffset: a } = er(e, t, n, r, "byte string", (e) => e instanceof M);
|
|
2709
2709
|
return {
|
|
2710
|
-
value: new
|
|
2710
|
+
value: new N(i),
|
|
2711
2711
|
nextOffset: a
|
|
2712
2712
|
};
|
|
2713
2713
|
}
|
|
2714
|
-
let { value: i, nextOffset: a } = $n(e, t, o), s =
|
|
2715
|
-
return a + i > e.byteLength &&
|
|
2716
|
-
value: new
|
|
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 }),
|
|
2717
2717
|
nextOffset: a + i
|
|
2718
2718
|
};
|
|
2719
2719
|
}
|
|
2720
2720
|
case 3: {
|
|
2721
2721
|
if (o === 31) {
|
|
2722
|
-
let { chunks: i, nextOffset: a } = er(e, t, n, r, "text string", (e) => e instanceof
|
|
2722
|
+
let { chunks: i, nextOffset: a } = er(e, t, n, r, "text string", (e) => e instanceof B);
|
|
2723
2723
|
return {
|
|
2724
|
-
value: new
|
|
2724
|
+
value: new P(i),
|
|
2725
2725
|
nextOffset: a
|
|
2726
2726
|
};
|
|
2727
2727
|
}
|
|
2728
|
-
let { value: i, nextOffset: a } = $n(e, t, o), s =
|
|
2729
|
-
a + i > e.byteLength &&
|
|
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");
|
|
2730
2730
|
let c = new Uint8Array(e.buffer, e.byteOffset + a, i), l, u, d = i < 64 ? Zn(c, i) : void 0;
|
|
2731
2731
|
if (d !== void 0) l = d;
|
|
2732
2732
|
else try {
|
|
2733
|
-
l =
|
|
2733
|
+
l = Wn.decode(c);
|
|
2734
2734
|
} catch {
|
|
2735
|
-
u =
|
|
2735
|
+
u = Kn("invalid UTF-8 sequence in text string", a, n), l = Gn.decode(c);
|
|
2736
2736
|
}
|
|
2737
|
-
let f = new
|
|
2738
|
-
return u &&
|
|
2737
|
+
let f = new B(l, { encodingWidth: s });
|
|
2738
|
+
return u && J(f, u), {
|
|
2739
2739
|
value: f,
|
|
2740
2740
|
nextOffset: a + i
|
|
2741
2741
|
};
|
|
@@ -2744,7 +2744,7 @@ function rr(e, t, n, r) {
|
|
|
2744
2744
|
if (o === 31) {
|
|
2745
2745
|
let i = [], a = t;
|
|
2746
2746
|
for (;;) {
|
|
2747
|
-
if (a >= e.byteLength &&
|
|
2747
|
+
if (a >= e.byteLength && q("unexpected end of indefinite array"), e.getUint8(a) === 255) {
|
|
2748
2748
|
a++;
|
|
2749
2749
|
break;
|
|
2750
2750
|
}
|
|
@@ -2752,17 +2752,17 @@ function rr(e, t, n, r) {
|
|
|
2752
2752
|
i.push(t.value), a = t.nextOffset;
|
|
2753
2753
|
}
|
|
2754
2754
|
return {
|
|
2755
|
-
value: new
|
|
2755
|
+
value: new F(i, { indefiniteLength: !0 }),
|
|
2756
2756
|
nextOffset: a
|
|
2757
2757
|
};
|
|
2758
2758
|
}
|
|
2759
|
-
let { value: i, nextOffset: a } = $n(e, t, o), s =
|
|
2759
|
+
let { value: i, nextOffset: a } = $n(e, t, o), s = Un(o, i), c = [], l = a;
|
|
2760
2760
|
for (let t = 0; t < i; t++) {
|
|
2761
2761
|
let t = X(e, l, n, r);
|
|
2762
2762
|
c.push(t.value), l = t.nextOffset;
|
|
2763
2763
|
}
|
|
2764
2764
|
return {
|
|
2765
|
-
value: new
|
|
2765
|
+
value: new F(c, { encodingWidth: s }),
|
|
2766
2766
|
nextOffset: l
|
|
2767
2767
|
};
|
|
2768
2768
|
}
|
|
@@ -2770,7 +2770,7 @@ function rr(e, t, n, r) {
|
|
|
2770
2770
|
if (o === 31) {
|
|
2771
2771
|
let i = [], a = /* @__PURE__ */ new Set(), o = [], s = t;
|
|
2772
2772
|
for (;;) {
|
|
2773
|
-
if (s >= e.byteLength &&
|
|
2773
|
+
if (s >= e.byteLength && q("unexpected end of indefinite map"), e.getUint8(s) === 255) {
|
|
2774
2774
|
s++;
|
|
2775
2775
|
break;
|
|
2776
2776
|
}
|
|
@@ -2779,83 +2779,83 @@ function rr(e, t, n, r) {
|
|
|
2779
2779
|
let c = X(e, s, n, r);
|
|
2780
2780
|
s = c.nextOffset, i.push([t.value, c.value]);
|
|
2781
2781
|
}
|
|
2782
|
-
let c = new
|
|
2783
|
-
for (let e of o)
|
|
2782
|
+
let c = new I(i, { indefiniteLength: !0 });
|
|
2783
|
+
for (let e of o) J(c, e);
|
|
2784
2784
|
return {
|
|
2785
2785
|
value: c,
|
|
2786
2786
|
nextOffset: s
|
|
2787
2787
|
};
|
|
2788
2788
|
}
|
|
2789
|
-
let { value: i, nextOffset: a } = $n(e, t, o), s =
|
|
2789
|
+
let { value: i, nextOffset: a } = $n(e, t, o), s = Un(o, i), c = [], l = /* @__PURE__ */ new Set(), u = [], d = a;
|
|
2790
2790
|
for (let t = 0; t < i; t++) {
|
|
2791
2791
|
let t = X(e, d, n, r);
|
|
2792
2792
|
tr(t.value, l, u, n), d = t.nextOffset;
|
|
2793
2793
|
let i = X(e, d, n, r);
|
|
2794
2794
|
d = i.nextOffset, c.push([t.value, i.value]);
|
|
2795
2795
|
}
|
|
2796
|
-
let f = new
|
|
2797
|
-
for (let e of u)
|
|
2796
|
+
let f = new I(c, { encodingWidth: s });
|
|
2797
|
+
for (let e of u) J(f, e);
|
|
2798
2798
|
return {
|
|
2799
2799
|
value: f,
|
|
2800
2800
|
nextOffset: d
|
|
2801
2801
|
};
|
|
2802
2802
|
}
|
|
2803
2803
|
case 6: {
|
|
2804
|
-
o === 31 &&
|
|
2805
|
-
let { value: i, nextOffset: a } = Qn(e, t, o), s =
|
|
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);
|
|
2806
2806
|
for (let e of r) {
|
|
2807
2807
|
let t = e.parseTag(i, c.value, n);
|
|
2808
|
-
if (t !== void 0) return t instanceof
|
|
2808
|
+
if (t !== void 0) return t instanceof j && s !== void 0 && (t.encodingWidth = s), {
|
|
2809
2809
|
value: t,
|
|
2810
2810
|
nextOffset: c.nextOffset
|
|
2811
2811
|
};
|
|
2812
2812
|
}
|
|
2813
2813
|
return {
|
|
2814
|
-
value: new
|
|
2814
|
+
value: new j(i, c.value, { encodingWidth: s }),
|
|
2815
2815
|
nextOffset: c.nextOffset
|
|
2816
2816
|
};
|
|
2817
2817
|
}
|
|
2818
2818
|
case 7:
|
|
2819
2819
|
if (o <= 19) return {
|
|
2820
|
-
value: new
|
|
2820
|
+
value: new L(o),
|
|
2821
2821
|
nextOffset: t
|
|
2822
2822
|
};
|
|
2823
2823
|
if (o === 20) return {
|
|
2824
|
-
value: new
|
|
2824
|
+
value: new L(20),
|
|
2825
2825
|
nextOffset: t
|
|
2826
2826
|
};
|
|
2827
2827
|
if (o === 21) return {
|
|
2828
|
-
value: new
|
|
2828
|
+
value: new L(21),
|
|
2829
2829
|
nextOffset: t
|
|
2830
2830
|
};
|
|
2831
2831
|
if (o === 22) return {
|
|
2832
|
-
value: new
|
|
2832
|
+
value: new L(22),
|
|
2833
2833
|
nextOffset: t
|
|
2834
2834
|
};
|
|
2835
2835
|
if (o === 23) return {
|
|
2836
|
-
value: new
|
|
2836
|
+
value: new L(23),
|
|
2837
2837
|
nextOffset: t
|
|
2838
2838
|
};
|
|
2839
2839
|
if (o === 24) {
|
|
2840
|
-
t + 1 > e.byteLength &&
|
|
2840
|
+
t + 1 > e.byteLength && q("unexpected end of input");
|
|
2841
2841
|
let r = e.getUint8(t);
|
|
2842
2842
|
if (r < 32) {
|
|
2843
|
-
let e =
|
|
2844
|
-
return
|
|
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), {
|
|
2845
2845
|
value: i,
|
|
2846
2846
|
nextOffset: t + 1
|
|
2847
2847
|
};
|
|
2848
2848
|
}
|
|
2849
2849
|
return {
|
|
2850
|
-
value: new
|
|
2850
|
+
value: new L(r),
|
|
2851
2851
|
nextOffset: t + 1
|
|
2852
2852
|
};
|
|
2853
2853
|
}
|
|
2854
2854
|
if (o === 25) {
|
|
2855
|
-
t + 2 > e.byteLength &&
|
|
2855
|
+
t + 2 > e.byteLength && q("unexpected end of input");
|
|
2856
2856
|
let n = C(e.getUint16(t, !1));
|
|
2857
2857
|
return {
|
|
2858
|
-
value: new
|
|
2858
|
+
value: new A(n, {
|
|
2859
2859
|
precision: "half",
|
|
2860
2860
|
rawBits: Number.isNaN(n) ? nr(e, t, 2) : void 0
|
|
2861
2861
|
}),
|
|
@@ -2863,10 +2863,10 @@ function rr(e, t, n, r) {
|
|
|
2863
2863
|
};
|
|
2864
2864
|
}
|
|
2865
2865
|
if (o === 26) {
|
|
2866
|
-
t + 4 > e.byteLength &&
|
|
2866
|
+
t + 4 > e.byteLength && q("unexpected end of input");
|
|
2867
2867
|
let n = e.getFloat32(t, !1);
|
|
2868
2868
|
return {
|
|
2869
|
-
value: new
|
|
2869
|
+
value: new A(n, {
|
|
2870
2870
|
precision: "single",
|
|
2871
2871
|
rawBits: Number.isNaN(n) ? nr(e, t, 4) : void 0
|
|
2872
2872
|
}),
|
|
@@ -2874,19 +2874,19 @@ function rr(e, t, n, r) {
|
|
|
2874
2874
|
};
|
|
2875
2875
|
}
|
|
2876
2876
|
if (o === 27) {
|
|
2877
|
-
t + 8 > e.byteLength &&
|
|
2877
|
+
t + 8 > e.byteLength && q("unexpected end of input");
|
|
2878
2878
|
let n = e.getFloat64(t, !1);
|
|
2879
2879
|
return {
|
|
2880
|
-
value: new
|
|
2880
|
+
value: new A(n, {
|
|
2881
2881
|
precision: "double",
|
|
2882
2882
|
rawBits: Number.isNaN(n) ? nr(e, t, 8) : void 0
|
|
2883
2883
|
}),
|
|
2884
2884
|
nextOffset: t + 8
|
|
2885
2885
|
};
|
|
2886
2886
|
}
|
|
2887
|
-
return o < 31 &&
|
|
2887
|
+
return o < 31 && q(`reserved additional info value in major type 7: ${o}`), q("unexpected break code outside indefinite-length item");
|
|
2888
2888
|
}
|
|
2889
|
-
return
|
|
2889
|
+
return q(`unknown major type: ${a}`);
|
|
2890
2890
|
}
|
|
2891
2891
|
function ir(e) {
|
|
2892
2892
|
if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new Uint8Array(e);
|
|
@@ -2898,7 +2898,7 @@ function ar(e, t) {
|
|
|
2898
2898
|
if (!Number.isInteger(i) || i < 0 || i > r.byteLength) throw RangeError(`CBOR decode offset must be an integer between 0 and ${r.byteLength}`);
|
|
2899
2899
|
let a = Xn(t?.builtinExtensions), o = t?.extensions?.length ? [...t.extensions.filter((e) => e.parseTag !== void 0), ...a] : a, { value: s, nextOffset: c } = X(r, i, t, o);
|
|
2900
2900
|
if (!t?.allowTrailing && c !== r.byteLength) {
|
|
2901
|
-
|
|
2901
|
+
J(s, Kn(`${r.byteLength - c} trailing byte(s) after end of CBOR item`, c, t));
|
|
2902
2902
|
let e = {
|
|
2903
2903
|
strict: !1,
|
|
2904
2904
|
silent: !0
|
|
@@ -2912,7 +2912,7 @@ function ar(e, t) {
|
|
|
2912
2912
|
var or = 24n, sr = {
|
|
2913
2913
|
tagNumbers: [or],
|
|
2914
2914
|
parseTag(e, t, n) {
|
|
2915
|
-
if (e !== 24n || !(t instanceof
|
|
2915
|
+
if (e !== 24n || !(t instanceof M)) return;
|
|
2916
2916
|
let r = n ? {
|
|
2917
2917
|
extensions: n.extensions,
|
|
2918
2918
|
builtinExtensions: n.builtinExtensions,
|
|
@@ -2921,138 +2921,165 @@ var or = 24n, sr = {
|
|
|
2921
2921
|
silent: n.silent
|
|
2922
2922
|
} : void 0;
|
|
2923
2923
|
try {
|
|
2924
|
-
return new
|
|
2924
|
+
return new j(or, new We([ar(t.value, r)], { encodingWidth: t.encodingWidth }));
|
|
2925
2925
|
} catch (e) {
|
|
2926
2926
|
if (r?.strict !== !1) throw e;
|
|
2927
2927
|
return;
|
|
2928
2928
|
}
|
|
2929
2929
|
}
|
|
2930
|
-
}
|
|
2931
|
-
|
|
2930
|
+
};
|
|
2931
|
+
//#endregion
|
|
2932
|
+
//#region src/extensions/ellipsis.ts
|
|
2933
|
+
function cr(e) {
|
|
2934
|
+
return e instanceof R && !(e.content instanceof F);
|
|
2935
|
+
}
|
|
2936
|
+
function lr(e) {
|
|
2937
|
+
let t = !1, n = !1, r = !1, i;
|
|
2938
|
+
for (let a of e) {
|
|
2939
|
+
let e;
|
|
2940
|
+
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;
|
|
2943
|
+
else return !1;
|
|
2944
|
+
if (e === i) return !1;
|
|
2945
|
+
i = e;
|
|
2946
|
+
}
|
|
2947
|
+
return r && !(t && n);
|
|
2948
|
+
}
|
|
2949
|
+
var ur = {
|
|
2950
|
+
tagNumbers: [Je],
|
|
2951
|
+
parseTag(e, t) {
|
|
2952
|
+
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);
|
|
2955
|
+
}
|
|
2956
|
+
}
|
|
2957
|
+
}, dr = new TextEncoder(), fr = new TextDecoder("utf-8", { fatal: !0 }), pr = new TextDecoder("utf-8", { fatal: !1 }), mr = Symbol("ellipsis");
|
|
2958
|
+
function hr(e) {
|
|
2932
2959
|
let t = 0;
|
|
2933
2960
|
for (let n of e) t += n.length;
|
|
2934
2961
|
let n = new Uint8Array(t), r = 0;
|
|
2935
2962
|
for (let t of e) n.set(t, r), r += t.length;
|
|
2936
2963
|
return n;
|
|
2937
2964
|
}
|
|
2938
|
-
function
|
|
2939
|
-
if (t instanceof
|
|
2940
|
-
|
|
2965
|
+
function gr(e, t, n) {
|
|
2966
|
+
if (t instanceof qe) {
|
|
2967
|
+
gr(e, t.inner, n);
|
|
2941
2968
|
return;
|
|
2942
2969
|
}
|
|
2943
|
-
if (t instanceof
|
|
2944
|
-
if (t.content instanceof
|
|
2945
|
-
else n.push(
|
|
2970
|
+
if (t instanceof R) {
|
|
2971
|
+
if (t.content instanceof F) for (let r of t.content.items) gr(e, r, n);
|
|
2972
|
+
else n.push(mr);
|
|
2946
2973
|
return;
|
|
2947
2974
|
}
|
|
2948
|
-
if (t instanceof
|
|
2949
|
-
n.push(
|
|
2975
|
+
if (t instanceof B) {
|
|
2976
|
+
n.push(dr.encode(t.value));
|
|
2950
2977
|
return;
|
|
2951
2978
|
}
|
|
2952
|
-
if (t instanceof
|
|
2979
|
+
if (t instanceof M) {
|
|
2953
2980
|
n.push(t.value);
|
|
2954
2981
|
return;
|
|
2955
2982
|
}
|
|
2956
|
-
if (t instanceof
|
|
2957
|
-
n.push(
|
|
2983
|
+
if (t instanceof P) {
|
|
2984
|
+
n.push(dr.encode(t.chunks.map((e) => e.value).join("")));
|
|
2958
2985
|
return;
|
|
2959
2986
|
}
|
|
2960
|
-
if (t instanceof
|
|
2961
|
-
n.push(
|
|
2987
|
+
if (t instanceof N) {
|
|
2988
|
+
n.push(hr(t.chunks.map((e) => e.value)));
|
|
2962
2989
|
return;
|
|
2963
2990
|
}
|
|
2964
2991
|
throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings or ellipses`);
|
|
2965
2992
|
}
|
|
2966
|
-
function
|
|
2993
|
+
function _r(e, t) {
|
|
2967
2994
|
try {
|
|
2968
|
-
return
|
|
2995
|
+
return fr.decode(e);
|
|
2969
2996
|
} catch {
|
|
2970
2997
|
let n = "t1 concatenation result is not valid UTF-8";
|
|
2971
2998
|
if (t) t(n);
|
|
2972
2999
|
else throw SyntaxError(n);
|
|
2973
|
-
return
|
|
3000
|
+
return pr.decode(e);
|
|
2974
3001
|
}
|
|
2975
3002
|
}
|
|
2976
|
-
function
|
|
3003
|
+
function vr(e, t, n) {
|
|
2977
3004
|
let r = [];
|
|
2978
|
-
for (let n of t)
|
|
3005
|
+
for (let n of t) gr(e, n, r);
|
|
2979
3006
|
let i = e === "t1", a = [], o = !1, s = [], c = () => {
|
|
2980
3007
|
if (s.length === 0) return;
|
|
2981
|
-
let e =
|
|
2982
|
-
s.length = 0, e.length !== 0 && a.push(i ? new
|
|
3008
|
+
let e = hr(s);
|
|
3009
|
+
s.length = 0, e.length !== 0 && a.push(i ? new B(_r(e, n)) : new M(e));
|
|
2983
3010
|
};
|
|
2984
|
-
for (let e of r) e ===
|
|
3011
|
+
for (let e of r) e === mr ? (c(), a[a.length - 1] instanceof R || (a.push(new R()), o = !0)) : s.push(e);
|
|
2985
3012
|
if (!o) {
|
|
2986
|
-
let e =
|
|
2987
|
-
return i ? new
|
|
3013
|
+
let e = hr(s);
|
|
3014
|
+
return i ? new B(_r(e, n)) : new M(e);
|
|
2988
3015
|
}
|
|
2989
|
-
return c(), a.length === 1 ? new
|
|
3016
|
+
return c(), a.length === 1 ? new R() : new R(a);
|
|
2990
3017
|
}
|
|
2991
|
-
function
|
|
3018
|
+
function yr(e) {
|
|
2992
3019
|
return {
|
|
2993
3020
|
appStringPrefixes: [e],
|
|
2994
3021
|
preserveAppSeqSource: !0,
|
|
2995
3022
|
parseAppString(t, n, r) {
|
|
2996
|
-
return
|
|
3023
|
+
return vr(e, [new B(n)], r);
|
|
2997
3024
|
},
|
|
2998
3025
|
parseAppSequence(t, n, r) {
|
|
2999
|
-
return
|
|
3026
|
+
return vr(e, n, r);
|
|
3000
3027
|
}
|
|
3001
3028
|
};
|
|
3002
3029
|
}
|
|
3003
|
-
var
|
|
3004
|
-
function
|
|
3030
|
+
var br = yr("t1"), xr = yr("b1"), Sr = new TextEncoder(), Cr = new TextDecoder("utf-8", { fatal: !0 }), wr = new TextDecoder("utf-8", { fatal: !1 });
|
|
3031
|
+
function Tr(e) {
|
|
3005
3032
|
let t = 0;
|
|
3006
3033
|
for (let n of e) t += n.length;
|
|
3007
3034
|
let n = new Uint8Array(t), r = 0;
|
|
3008
3035
|
for (let t of e) n.set(t, r), r += t.length;
|
|
3009
3036
|
return n;
|
|
3010
3037
|
}
|
|
3011
|
-
function
|
|
3038
|
+
function Er(e, t, n) {
|
|
3012
3039
|
let r = e === "ilts", i = [], a = [];
|
|
3013
3040
|
for (let o of t) {
|
|
3014
|
-
if (o instanceof
|
|
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`);
|
|
3015
3042
|
let t, s, c;
|
|
3016
|
-
if (o instanceof
|
|
3017
|
-
else if (o instanceof
|
|
3018
|
-
else if (o instanceof
|
|
3019
|
-
else if (o instanceof
|
|
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));
|
|
3020
3047
|
else throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings`);
|
|
3021
3048
|
if (r) {
|
|
3022
3049
|
let e;
|
|
3023
3050
|
if (t !== void 0) e = t;
|
|
3024
3051
|
else try {
|
|
3025
|
-
e =
|
|
3052
|
+
e = Cr.decode(s);
|
|
3026
3053
|
} catch {
|
|
3027
3054
|
let t = "ilts chunk is not valid UTF-8";
|
|
3028
3055
|
if (n) n(t);
|
|
3029
3056
|
else throw SyntaxError(t);
|
|
3030
|
-
e =
|
|
3057
|
+
e = wr.decode(s);
|
|
3031
3058
|
}
|
|
3032
|
-
a.push(new
|
|
3059
|
+
a.push(new B(e, c === void 0 ? void 0 : { encodingWidth: c }));
|
|
3033
3060
|
} else {
|
|
3034
|
-
let e = s ??
|
|
3035
|
-
i.push(new
|
|
3061
|
+
let e = s ?? Sr.encode(t);
|
|
3062
|
+
i.push(new M(e, c === void 0 ? void 0 : { encodingWidth: c }));
|
|
3036
3063
|
}
|
|
3037
3064
|
}
|
|
3038
|
-
return r ? new
|
|
3065
|
+
return r ? new P(a) : new N(i);
|
|
3039
3066
|
}
|
|
3040
|
-
function
|
|
3067
|
+
function Dr(e) {
|
|
3041
3068
|
return {
|
|
3042
3069
|
appStringPrefixes: [e],
|
|
3043
3070
|
preserveAppSeqSource: !0,
|
|
3044
3071
|
parseAppString(t, n, r) {
|
|
3045
|
-
return new
|
|
3072
|
+
return new qe(Er(e, [new B(n)], r), `${e}${xe(n)}`);
|
|
3046
3073
|
},
|
|
3047
3074
|
parseAppSequence(t, n, r) {
|
|
3048
|
-
return
|
|
3075
|
+
return Er(e, n, r);
|
|
3049
3076
|
}
|
|
3050
3077
|
};
|
|
3051
3078
|
}
|
|
3052
|
-
var
|
|
3079
|
+
var Or = Dr("ilbs"), kr = Dr("ilts");
|
|
3053
3080
|
//#endregion
|
|
3054
3081
|
//#region src/utils/strip-comments.ts
|
|
3055
|
-
function
|
|
3082
|
+
function Ar(e) {
|
|
3056
3083
|
let t = "", n = 0;
|
|
3057
3084
|
for (; n < e.length;) {
|
|
3058
3085
|
let r = e[n];
|
|
@@ -3087,7 +3114,7 @@ function Dr(e) {
|
|
|
3087
3114
|
}
|
|
3088
3115
|
//#endregion
|
|
3089
3116
|
//#region src/extensions/float.ts
|
|
3090
|
-
var
|
|
3117
|
+
var jr = class extends A {
|
|
3091
3118
|
_bits;
|
|
3092
3119
|
constructor(e) {
|
|
3093
3120
|
super(C(e), { precision: "half" }), this._bits = e & 65535;
|
|
@@ -3099,7 +3126,7 @@ var Or = class extends j {
|
|
|
3099
3126
|
this._bits & 255
|
|
3100
3127
|
]);
|
|
3101
3128
|
}
|
|
3102
|
-
},
|
|
3129
|
+
}, Mr = class extends A {
|
|
3103
3130
|
_raw;
|
|
3104
3131
|
constructor(e) {
|
|
3105
3132
|
super(new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), { precision: "single" }), this._raw = e.slice();
|
|
@@ -3108,7 +3135,7 @@ var Or = class extends j {
|
|
|
3108
3135
|
let e = /* @__PURE__ */ new Uint8Array(5);
|
|
3109
3136
|
return e[0] = 250, e.set(this._raw, 1), e;
|
|
3110
3137
|
}
|
|
3111
|
-
},
|
|
3138
|
+
}, Nr = class extends A {
|
|
3112
3139
|
_raw;
|
|
3113
3140
|
constructor(e) {
|
|
3114
3141
|
super(new DataView(e.buffer, e.byteOffset).getFloat64(0, !1), { precision: "double" }), this._raw = e.slice();
|
|
@@ -3118,13 +3145,13 @@ var Or = class extends j {
|
|
|
3118
3145
|
return e[0] = 251, e.set(this._raw, 1), e;
|
|
3119
3146
|
}
|
|
3120
3147
|
};
|
|
3121
|
-
function
|
|
3122
|
-
if (e.length === 2) return new
|
|
3123
|
-
if (e.length === 4) return new
|
|
3124
|
-
if (e.length === 8) return new
|
|
3148
|
+
function Pr(e) {
|
|
3149
|
+
if (e.length === 2) return new jr(e[0] << 8 | e[1]);
|
|
3150
|
+
if (e.length === 4) return new Mr(e);
|
|
3151
|
+
if (e.length === 8) return new Nr(e);
|
|
3125
3152
|
throw SyntaxError(`float'...' requires 4, 8, or 16 hex digits (2, 4, or 8 bytes); got ${e.length} bytes`);
|
|
3126
3153
|
}
|
|
3127
|
-
function
|
|
3154
|
+
function Fr(e) {
|
|
3128
3155
|
let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023, i;
|
|
3129
3156
|
if (n === 31) i = t << 31 | 2139095040 | r << 13;
|
|
3130
3157
|
else if (n === 0 && r === 0) i = t << 31;
|
|
@@ -3136,7 +3163,7 @@ function Mr(e) {
|
|
|
3136
3163
|
let a = /* @__PURE__ */ new Uint8Array(4);
|
|
3137
3164
|
return new DataView(a.buffer).setUint32(0, i >>> 0, !1), a;
|
|
3138
3165
|
}
|
|
3139
|
-
function
|
|
3166
|
+
function Ir(e) {
|
|
3140
3167
|
let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023, i = /* @__PURE__ */ new Uint8Array(8), a = new DataView(i.buffer);
|
|
3141
3168
|
if (n === 31) a.setUint32(0, (t << 31 | 2146435072 | r << 10) >>> 0, !1), a.setUint32(4, 0, !1);
|
|
3142
3169
|
else if (n === 0 && r === 0) a.setUint32(0, t << 31 >>> 0, !1), a.setUint32(4, 0, !1);
|
|
@@ -3147,7 +3174,7 @@ function Nr(e) {
|
|
|
3147
3174
|
} else a.setUint32(0, (t << 31 | n + 1008 << 20 | r << 10) >>> 0, !1), a.setUint32(4, 0, !1);
|
|
3148
3175
|
return i;
|
|
3149
3176
|
}
|
|
3150
|
-
function
|
|
3177
|
+
function Lr(e) {
|
|
3151
3178
|
let t = new DataView(e.buffer, e.byteOffset).getUint32(0, !1), n = t >>> 31 & 1, r = t >>> 23 & 255, i = t & 8388607, a = /* @__PURE__ */ new Uint8Array(8), o = new DataView(a.buffer);
|
|
3152
3179
|
if (r === 255) o.setUint32(0, (n << 31 | 2146435072 | i >>> 3) >>> 0, !1), o.setUint32(4, (i & 7) << 29, !1);
|
|
3153
3180
|
else if (r === 0 && i === 0) o.setUint32(0, n << 31 >>> 0, !1), o.setUint32(4, 0, !1);
|
|
@@ -3157,49 +3184,49 @@ function Pr(e) {
|
|
|
3157
3184
|
}
|
|
3158
3185
|
return a;
|
|
3159
3186
|
}
|
|
3160
|
-
function
|
|
3187
|
+
function Rr(e, t, n) {
|
|
3161
3188
|
let r = e.length === 2 ? 1 : e.length === 4 ? 2 : 3;
|
|
3162
3189
|
if (r === 1) {
|
|
3163
3190
|
let n = e[0] << 8 | e[1];
|
|
3164
|
-
if (t === 2) return new
|
|
3165
|
-
if (t === 3) return new
|
|
3191
|
+
if (t === 2) return new Mr(Fr(n));
|
|
3192
|
+
if (t === 3) return new Nr(Ir(n));
|
|
3166
3193
|
}
|
|
3167
3194
|
if (r === 2) {
|
|
3168
|
-
if (t === 3) return new
|
|
3195
|
+
if (t === 3) return new Nr(Lr(e));
|
|
3169
3196
|
if (t === 1) {
|
|
3170
3197
|
let t = new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), r = S(t);
|
|
3171
|
-
return !Object.is(C(r), t) && !isNaN(t) && n("float'...' value cannot be exactly represented as float16 (_1)"), new
|
|
3198
|
+
return !Object.is(C(r), t) && !isNaN(t) && n("float'...' value cannot be exactly represented as float16 (_1)"), new jr(r);
|
|
3172
3199
|
}
|
|
3173
3200
|
}
|
|
3174
3201
|
if (r === 3) {
|
|
3175
3202
|
let r = new DataView(e.buffer, e.byteOffset).getFloat64(0, !1);
|
|
3176
3203
|
if (t === 1) {
|
|
3177
3204
|
let e = S(r);
|
|
3178
|
-
return !Object.is(C(e), r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float16 (_1)"), new
|
|
3205
|
+
return !Object.is(C(e), r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float16 (_1)"), new jr(e);
|
|
3179
3206
|
}
|
|
3180
3207
|
if (t === 2) {
|
|
3181
3208
|
let e = Math.fround(r);
|
|
3182
3209
|
!Object.is(e, r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float32 (_2)");
|
|
3183
3210
|
let t = /* @__PURE__ */ new Uint8Array(4);
|
|
3184
|
-
return new DataView(t.buffer).setFloat32(0, e, !1), new
|
|
3211
|
+
return new DataView(t.buffer).setFloat32(0, e, !1), new Mr(t);
|
|
3185
3212
|
}
|
|
3186
3213
|
}
|
|
3187
|
-
return
|
|
3214
|
+
return Pr(e);
|
|
3188
3215
|
}
|
|
3189
|
-
var
|
|
3216
|
+
var zr = {
|
|
3190
3217
|
appStringPrefixes: ["float"],
|
|
3191
3218
|
parseAppString(t, n, r, i) {
|
|
3192
|
-
let a =
|
|
3219
|
+
let a = Ar(n);
|
|
3193
3220
|
if (!/^[0-9a-fA-F]*$/.test(a)) throw SyntaxError("float'...' contains non-hex characters");
|
|
3194
3221
|
if (a.length % 2 != 0) throw SyntaxError(`float'...' hex content has odd length (${a.length} digits)`);
|
|
3195
3222
|
let o = e(a), s = i?.encodingWidth;
|
|
3196
|
-
if (s === void 0) return
|
|
3223
|
+
if (s === void 0) return Pr(o);
|
|
3197
3224
|
if (s !== 1 && s !== 2 && s !== 3) {
|
|
3198
3225
|
let e = `float'...' encoding indicator _${s} is not valid; use _1, _2, or _3`;
|
|
3199
|
-
if (r) return r(e),
|
|
3226
|
+
if (r) return r(e), Pr(o);
|
|
3200
3227
|
throw SyntaxError(e);
|
|
3201
3228
|
}
|
|
3202
|
-
return s === (o.length === 2 ? 1 : o.length === 4 ? 2 : 3) ?
|
|
3229
|
+
return s === (o.length === 2 ? 1 : o.length === 4 ? 2 : 3) ? Pr(o) : Rr(o, s, r ?? ((e) => {
|
|
3203
3230
|
throw SyntaxError(e);
|
|
3204
3231
|
}));
|
|
3205
3232
|
},
|
|
@@ -3210,30 +3237,34 @@ var Ir = {
|
|
|
3210
3237
|
if (n) n(e);
|
|
3211
3238
|
else throw SyntaxError(e);
|
|
3212
3239
|
}
|
|
3213
|
-
if (!(t[0] instanceof
|
|
3214
|
-
return
|
|
3215
|
-
}
|
|
3216
|
-
},
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3240
|
+
if (!(t[0] instanceof M)) throw SyntaxError("float<<...>> item must be a byte string");
|
|
3241
|
+
return Pr(t[0].value);
|
|
3242
|
+
}
|
|
3243
|
+
}, Br = [
|
|
3244
|
+
Vn,
|
|
3245
|
+
sr,
|
|
3246
|
+
ur
|
|
3247
|
+
], Vr = [
|
|
3248
|
+
qt,
|
|
3249
|
+
fn,
|
|
3250
|
+
Rn,
|
|
3251
|
+
br,
|
|
3252
|
+
xr,
|
|
3253
|
+
Or,
|
|
3254
|
+
kr,
|
|
3255
|
+
zr
|
|
3256
|
+
], Hr;
|
|
3226
3257
|
function Z(e) {
|
|
3227
|
-
return e === void 0 ?
|
|
3258
|
+
return e === void 0 ? Hr ??= [...Br, ...Vr] : e === !1 ? Br : [...Br, ...e];
|
|
3228
3259
|
}
|
|
3229
3260
|
//#endregion
|
|
3230
3261
|
//#region src/js/fromJS.ts
|
|
3231
|
-
var
|
|
3232
|
-
function
|
|
3262
|
+
var Ur;
|
|
3263
|
+
function Wr(e) {
|
|
3233
3264
|
if (e === void 0) {
|
|
3234
|
-
if (
|
|
3265
|
+
if (Ur) return Ur;
|
|
3235
3266
|
let e = Z(void 0);
|
|
3236
|
-
return
|
|
3267
|
+
return Ur = {
|
|
3237
3268
|
fromJS: e.filter((e) => e.fromJS !== void 0),
|
|
3238
3269
|
parseTag: e.filter((e) => e.parseTag !== void 0)
|
|
3239
3270
|
};
|
|
@@ -3244,19 +3275,19 @@ function Vr(e) {
|
|
|
3244
3275
|
parseTag: t.filter((e) => e.parseTag !== void 0)
|
|
3245
3276
|
};
|
|
3246
3277
|
}
|
|
3247
|
-
function
|
|
3248
|
-
let t = e?.extensions, n =
|
|
3278
|
+
function Gr(e) {
|
|
3279
|
+
let t = e?.extensions, n = Wr(e?.builtinExtensions);
|
|
3249
3280
|
return t?.length ? {
|
|
3250
3281
|
fromJS: [...t.filter((e) => e.fromJS !== void 0), ...n.fromJS],
|
|
3251
3282
|
parseTag: [...t.filter((e) => e.parseTag !== void 0), ...n.parseTag]
|
|
3252
3283
|
} : n;
|
|
3253
3284
|
}
|
|
3254
|
-
function
|
|
3285
|
+
function Kr(e, t) {
|
|
3255
3286
|
if (t?.replacer) {
|
|
3256
|
-
let { replacer: n, ...r } = t, i =
|
|
3257
|
-
return i === h ?
|
|
3287
|
+
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);
|
|
3258
3289
|
}
|
|
3259
|
-
return Q(e, t, !0,
|
|
3290
|
+
return Q(e, t, !0, Gr(t));
|
|
3260
3291
|
}
|
|
3261
3292
|
function Q(e, t, n, r) {
|
|
3262
3293
|
for (let n of r.fromJS) {
|
|
@@ -3269,34 +3300,34 @@ function Q(e, t, n, r) {
|
|
|
3269
3300
|
let t = e.parseTag(n, i);
|
|
3270
3301
|
if (t !== void 0) return t;
|
|
3271
3302
|
}
|
|
3272
|
-
return new
|
|
3273
|
-
}
|
|
3274
|
-
if (e instanceof m.Null) return
|
|
3275
|
-
if (e instanceof m.Undefined) return
|
|
3276
|
-
if (e instanceof g) return new
|
|
3277
|
-
if (e === null) return
|
|
3278
|
-
if (e === void 0) return
|
|
3279
|
-
if (e === !0) return
|
|
3280
|
-
if (e === !1) return
|
|
3281
|
-
if (typeof e == "bigint") return e > 18446744073709551615n ? new
|
|
3282
|
-
if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new
|
|
3283
|
-
if (typeof e == "string") return new
|
|
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);
|
|
3284
3315
|
if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return Q(e.valueOf(), t, !1, r);
|
|
3285
|
-
if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new
|
|
3286
|
-
if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new
|
|
3287
|
-
if (e instanceof $) return new
|
|
3288
|
-
if (Array.isArray(e)) return new
|
|
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)));
|
|
3289
3320
|
if (typeof e == "object") {
|
|
3290
3321
|
let n = [];
|
|
3291
|
-
for (let [i, a] of Object.entries(e)) n.push([new
|
|
3292
|
-
return new
|
|
3322
|
+
for (let [i, a] of Object.entries(e)) n.push([new B(i), Q(a, t, !0, r)]);
|
|
3323
|
+
return new I(n);
|
|
3293
3324
|
}
|
|
3294
3325
|
throw TypeError(`fromJS: unsupported value type: ${typeof e}`);
|
|
3295
3326
|
}
|
|
3296
|
-
function
|
|
3327
|
+
function qr(e) {
|
|
3297
3328
|
return ArrayBuffer.isView(e) || e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer || e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]" || e instanceof m.Null || e instanceof m.Undefined || e instanceof g;
|
|
3298
3329
|
}
|
|
3299
|
-
function
|
|
3330
|
+
function Jr(e, t, n, r, i) {
|
|
3300
3331
|
let a = [...n ?? [], ...Z(i)].filter((e) => e.isJSType !== void 0);
|
|
3301
3332
|
function o(e) {
|
|
3302
3333
|
return e === h || r === !0 && e === void 0;
|
|
@@ -3307,7 +3338,7 @@ function Gr(e, t, n, r, i) {
|
|
|
3307
3338
|
if (typeof e != "object" || !e) return e;
|
|
3308
3339
|
if (e instanceof $) return $.from(e, ([e, t]) => [e, r(t)]);
|
|
3309
3340
|
if (Array.isArray(e)) return e.map(r);
|
|
3310
|
-
if (m.symbol in e ||
|
|
3341
|
+
if (m.symbol in e || qr(e) || a.some((t) => t.isJSType(e))) return e;
|
|
3311
3342
|
let t = Object.getPrototypeOf(e);
|
|
3312
3343
|
if (t === Object.prototype || t === null) {
|
|
3313
3344
|
let t = e.toJSON;
|
|
@@ -3342,7 +3373,7 @@ function Gr(e, t, n, r, i) {
|
|
|
3342
3373
|
let r = c(t, String(n), e);
|
|
3343
3374
|
return o(r) ? null : r;
|
|
3344
3375
|
});
|
|
3345
|
-
if (
|
|
3376
|
+
if (qr(e) || a.some((t) => t.isJSType(e))) return e;
|
|
3346
3377
|
let t = {};
|
|
3347
3378
|
for (let n of Object.keys(e)) {
|
|
3348
3379
|
let r = c(e[n], n, e);
|
|
@@ -3360,7 +3391,7 @@ var $ = class extends Array {
|
|
|
3360
3391
|
toJSON() {
|
|
3361
3392
|
let e = {};
|
|
3362
3393
|
for (let [t, n] of this) {
|
|
3363
|
-
let r = typeof t == "string" ? t :
|
|
3394
|
+
let r = typeof t == "string" ? t : Kr(t).toCDN();
|
|
3364
3395
|
r === "__proto__" ? Object.defineProperty(e, r, {
|
|
3365
3396
|
value: n,
|
|
3366
3397
|
writable: !0,
|
|
@@ -3372,6 +3403,6 @@ var $ = class extends Array {
|
|
|
3372
3403
|
}
|
|
3373
3404
|
};
|
|
3374
3405
|
//#endregion
|
|
3375
|
-
export {
|
|
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 };
|
|
3376
3407
|
|
|
3377
|
-
//# sourceMappingURL=mapEntries-
|
|
3408
|
+
//# sourceMappingURL=mapEntries-KwZz9nq2.js.map
|