@cbortech/cbor 0.23.1 → 0.24.0
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 +52 -3
- package/README.md +52 -3
- package/dist/ast/index.cjs +1 -1
- package/dist/ast/index.js +1 -1
- package/dist/cbor.d.ts +16 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{mapEntries-CSjvgq1X.js → mapEntries-D5MWtXqq.js} +512 -1154
- package/dist/mapEntries-D5MWtXqq.js.map +1 -0
- package/dist/mapEntries-bihZ3yks.cjs +31 -0
- package/dist/mapEntries-bihZ3yks.cjs.map +1 -0
- package/dist/types.d.ts +12 -2
- package/package.json +18 -17
- package/dist/extensions/hash.d.ts +0 -17
- package/dist/mapEntries-C73nWM8o.cjs +0 -31
- package/dist/mapEntries-C73nWM8o.cjs.map +0 -1
- package/dist/mapEntries-CSjvgq1X.js.map +0 -1
|
@@ -137,7 +137,7 @@ var c = class {
|
|
|
137
137
|
}];
|
|
138
138
|
}
|
|
139
139
|
}, f = "getFloat16" in DataView.prototype && "setFloat16" in DataView.prototype, p = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
|
|
140
|
-
function
|
|
140
|
+
function ee(e) {
|
|
141
141
|
p.setFloat64(0, e, !1);
|
|
142
142
|
let t = p.getUint32(0, !1), n = p.getUint32(4, !1), r = t >>> 31 & 1, i = t >>> 20 & 2047, a = t & 1048575;
|
|
143
143
|
if (i === 2047) {
|
|
@@ -160,18 +160,18 @@ function m(e) {
|
|
|
160
160
|
let u = o <= 0 ? 0 : o;
|
|
161
161
|
return r << 15 | u << 10 | s;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function te(e) {
|
|
164
164
|
let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023;
|
|
165
165
|
return n === 31 ? r === 0 ? t ? -Infinity : Infinity : NaN : n === 0 ? r === 0 ? t ? -0 : 0 : (t ? -1 : 1) * 2 ** -14 * (r / 1024) : (t ? -1 : 1) * 2 ** (n - 15) * (1 + r / 1024);
|
|
166
166
|
}
|
|
167
|
-
var
|
|
167
|
+
var ne = f ? (e, t, n, r) => {
|
|
168
168
|
e.setFloat16(t, n, r);
|
|
169
169
|
} : (e, t, n, r) => {
|
|
170
|
-
e.setUint16(t,
|
|
170
|
+
e.setUint16(t, ee(n), r);
|
|
171
171
|
};
|
|
172
172
|
//#endregion
|
|
173
173
|
//#region src/cbor/encode.ts
|
|
174
|
-
function
|
|
174
|
+
function m(e, t, n) {
|
|
175
175
|
if (n !== void 0) {
|
|
176
176
|
if (n === "i") {
|
|
177
177
|
if (t > 23n) throw RangeError(`value ${t} does not fit in immediate encoding _i (max 23)`);
|
|
@@ -210,24 +210,24 @@ function _(e, t, n) {
|
|
|
210
210
|
let r = new Uint8Array(9);
|
|
211
211
|
return r[0] = e << 5 | 27, new DataView(r.buffer).setBigUint64(1, t, !1), r;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function h(e) {
|
|
214
214
|
let t = e.reduce((e, t) => e + t.length, 0), n = new Uint8Array(t), r = 0;
|
|
215
215
|
for (let t of e) n.set(t, r), r += t.length;
|
|
216
216
|
return n;
|
|
217
217
|
}
|
|
218
|
-
var
|
|
219
|
-
function
|
|
220
|
-
return Object.is(
|
|
218
|
+
var re = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4));
|
|
219
|
+
function ie(e) {
|
|
220
|
+
return Object.is(te(ee(e)), e);
|
|
221
221
|
}
|
|
222
|
-
function
|
|
223
|
-
return
|
|
222
|
+
function ae(e) {
|
|
223
|
+
return re.setFloat32(0, e, !1), Object.is(re.getFloat32(0, !1), e);
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
return
|
|
225
|
+
function oe(e) {
|
|
226
|
+
return ie(e) ? "half" : ae(e) ? "single" : "double";
|
|
227
227
|
}
|
|
228
228
|
//#endregion
|
|
229
229
|
//#region src/ast/CborUint.ts
|
|
230
|
-
var
|
|
230
|
+
var g = class extends d {
|
|
231
231
|
value;
|
|
232
232
|
encodingWidth;
|
|
233
233
|
constructor(e, t) {
|
|
@@ -236,7 +236,7 @@ var y = class extends d {
|
|
|
236
236
|
this.encodingWidth = t?.encodingWidth;
|
|
237
237
|
}
|
|
238
238
|
_toCBOR(e) {
|
|
239
|
-
return
|
|
239
|
+
return m(0, this.value, this.encodingWidth);
|
|
240
240
|
}
|
|
241
241
|
_toEDN(e, t) {
|
|
242
242
|
let n = this.encodingWidth === void 0 ? "" : `_${this.encodingWidth}`, r = this.value;
|
|
@@ -251,7 +251,7 @@ var y = class extends d {
|
|
|
251
251
|
let t = e?.integerAs ?? "auto";
|
|
252
252
|
return t === "bigint" ? this.value : t === "number" || this.value <= BigInt(2 ** 53 - 1) ? Number(this.value) : this.value;
|
|
253
253
|
}
|
|
254
|
-
},
|
|
254
|
+
}, _ = class extends d {
|
|
255
255
|
argument;
|
|
256
256
|
encodingWidth;
|
|
257
257
|
constructor(e, t) {
|
|
@@ -265,7 +265,7 @@ var y = class extends d {
|
|
|
265
265
|
return -1n - this.argument;
|
|
266
266
|
}
|
|
267
267
|
_toCBOR(e) {
|
|
268
|
-
return
|
|
268
|
+
return m(1, this.argument, this.encodingWidth);
|
|
269
269
|
}
|
|
270
270
|
_toEDN(e, t) {
|
|
271
271
|
let n = this.encodingWidth === void 0 ? "" : `_${this.encodingWidth}`, r = this.argument + 1n;
|
|
@@ -283,30 +283,30 @@ var y = class extends d {
|
|
|
283
283
|
};
|
|
284
284
|
//#endregion
|
|
285
285
|
//#region src/edn/serialize-utils.ts
|
|
286
|
-
function
|
|
286
|
+
function v(e) {
|
|
287
287
|
let t = e?.indent;
|
|
288
288
|
return t === void 0 ? null : typeof t == "number" ? " ".repeat(t) : t;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function y(e, t) {
|
|
291
291
|
return e.repeat(t);
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function b(e) {
|
|
294
294
|
return !!(e.comments?.leading?.length || e.comments?.trailing?.length || e.comments?.dangling?.length);
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function se(e) {
|
|
297
297
|
return !!(e.comments?.trailing?.length || e.comments?.dangling?.length);
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function ce(e, t) {
|
|
300
300
|
return (e.comments?.leading ?? []).map((e) => t + e.text);
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function le(e) {
|
|
303
303
|
let t = e.comments?.trailing ?? [];
|
|
304
304
|
return t.length === 0 ? "" : " " + t.map((e) => e.text).join(" ");
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function ue(e, t) {
|
|
307
307
|
return (e.comments?.dangling ?? []).map((e) => t + e.text);
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function x(e, t = !1) {
|
|
310
310
|
let n = e?.commas ?? "comma", r = n !== "none";
|
|
311
311
|
return {
|
|
312
312
|
inlineSep: r ? t ? "," : ", " : " ",
|
|
@@ -456,10 +456,10 @@ var S = class extends d {
|
|
|
456
456
|
super(), this.value = e, this.precision = t?.precision;
|
|
457
457
|
}
|
|
458
458
|
_toCBOR(e) {
|
|
459
|
-
let t = this.precision ??
|
|
459
|
+
let t = this.precision ?? oe(this.value);
|
|
460
460
|
if (t === "half") {
|
|
461
461
|
let e = new Uint8Array(3);
|
|
462
|
-
return e[0] = 249,
|
|
462
|
+
return e[0] = 249, ne(new DataView(e.buffer), 1, this.value, !1), e;
|
|
463
463
|
}
|
|
464
464
|
if (t === "single") {
|
|
465
465
|
let e = new Uint8Array(5);
|
|
@@ -469,7 +469,7 @@ var S = class extends d {
|
|
|
469
469
|
return n[0] = 251, new DataView(n.buffer).setFloat64(1, this.value, !1), n;
|
|
470
470
|
}
|
|
471
471
|
_toEDN(e, t) {
|
|
472
|
-
let n =
|
|
472
|
+
let n = oe(this.value);
|
|
473
473
|
return (e?.floatFormat === "hex" ? ke(this.value) : Te(this.value)) + Ee(this.value, this.precision, n);
|
|
474
474
|
}
|
|
475
475
|
_toJS(e) {
|
|
@@ -484,7 +484,7 @@ var S = class extends d {
|
|
|
484
484
|
this.content = t, this.encodingWidth = n?.encodingWidth;
|
|
485
485
|
}
|
|
486
486
|
_toCBOR(e) {
|
|
487
|
-
return
|
|
487
|
+
return h([m(6, this.tag, this.encodingWidth), this.content._toCBOR(e)]);
|
|
488
488
|
}
|
|
489
489
|
_toEDN(e, t) {
|
|
490
490
|
let n = this.encodingWidth === void 0 ? "" : `_${this.encodingWidth}`;
|
|
@@ -493,13 +493,14 @@ var S = class extends d {
|
|
|
493
493
|
_toHexDump(e, t) {
|
|
494
494
|
let n = [{
|
|
495
495
|
depth: e,
|
|
496
|
-
hex: ((e) => Array.from(e, (e) => e.toString(16).toUpperCase().padStart(2, "0")).join(" "))(
|
|
496
|
+
hex: ((e) => Array.from(e, (e) => e.toString(16).toUpperCase().padStart(2, "0")).join(" "))(m(6, this.tag, this.encodingWidth)),
|
|
497
497
|
comment: `Tag ${this.tag}`
|
|
498
498
|
}];
|
|
499
499
|
return n.push(...this.content._toHexDump(e + 1, t)), n;
|
|
500
500
|
}
|
|
501
501
|
_toJS(e) {
|
|
502
|
-
|
|
502
|
+
let t = this.content._toJS(e);
|
|
503
|
+
return e?.stripTags ? t : c.set(t, this.tag);
|
|
503
504
|
}
|
|
504
505
|
};
|
|
505
506
|
//#endregion
|
|
@@ -513,6 +514,7 @@ function Ae(e, t) {
|
|
|
513
514
|
};
|
|
514
515
|
}
|
|
515
516
|
var je = class {
|
|
517
|
+
input;
|
|
516
518
|
pos;
|
|
517
519
|
line;
|
|
518
520
|
col;
|
|
@@ -1395,7 +1397,7 @@ var je = class {
|
|
|
1395
1397
|
super(), this.value = e, this.ednEncoding = t?.ednEncoding ?? "hex", this.encodingWidth = t?.encodingWidth, this.ednSource = t?.ednSource;
|
|
1396
1398
|
}
|
|
1397
1399
|
_toCBOR(e) {
|
|
1398
|
-
return
|
|
1400
|
+
return h([m(2, BigInt(this.value.length), this.encodingWidth), this.value]);
|
|
1399
1401
|
}
|
|
1400
1402
|
_toEDN(e, t) {
|
|
1401
1403
|
let n = this.encodingWidth === void 0 ? "" : `_${this.encodingWidth}`;
|
|
@@ -1406,7 +1408,7 @@ var je = class {
|
|
|
1406
1408
|
_toJS(e) {
|
|
1407
1409
|
return this.value;
|
|
1408
1410
|
}
|
|
1409
|
-
},
|
|
1411
|
+
}, T = class extends d {
|
|
1410
1412
|
indefiniteLength = !0;
|
|
1411
1413
|
chunks;
|
|
1412
1414
|
constructor(e) {
|
|
@@ -1415,7 +1417,7 @@ var je = class {
|
|
|
1415
1417
|
_toCBOR(e) {
|
|
1416
1418
|
let t = [new Uint8Array([95])];
|
|
1417
1419
|
for (let n of this.chunks) t.push(n._toCBOR(e));
|
|
1418
|
-
return t.push(new Uint8Array([255])),
|
|
1420
|
+
return t.push(new Uint8Array([255])), h(t);
|
|
1419
1421
|
}
|
|
1420
1422
|
_toEDN(e, t) {
|
|
1421
1423
|
return this.chunks.length === 0 ? "''_" : `(_ ${this.chunks.map((t) => t._toEDN(e, 0)).join(", ")})`;
|
|
@@ -1438,7 +1440,7 @@ var je = class {
|
|
|
1438
1440
|
for (let e of this.chunks) n.set(e.value, r), r += e.value.length;
|
|
1439
1441
|
return n;
|
|
1440
1442
|
}
|
|
1441
|
-
},
|
|
1443
|
+
}, E = class extends d {
|
|
1442
1444
|
indefiniteLength = !0;
|
|
1443
1445
|
chunks;
|
|
1444
1446
|
constructor(e) {
|
|
@@ -1447,7 +1449,7 @@ var je = class {
|
|
|
1447
1449
|
_toCBOR(e) {
|
|
1448
1450
|
let t = [new Uint8Array([127])];
|
|
1449
1451
|
for (let n of this.chunks) t.push(n._toCBOR(e));
|
|
1450
|
-
return t.push(new Uint8Array([255])),
|
|
1452
|
+
return t.push(new Uint8Array([255])), h(t);
|
|
1451
1453
|
}
|
|
1452
1454
|
_toEDN(e, t) {
|
|
1453
1455
|
return this.chunks.length === 0 ? "\"\"_" : `(_ ${this.chunks.map((t) => t._toEDN(e, 0)).join(", ")})`;
|
|
@@ -1468,7 +1470,7 @@ var je = class {
|
|
|
1468
1470
|
_toJS(e) {
|
|
1469
1471
|
return this.chunks.map((e) => e.value).join("");
|
|
1470
1472
|
}
|
|
1471
|
-
},
|
|
1473
|
+
}, D = class extends d {
|
|
1472
1474
|
items;
|
|
1473
1475
|
indefiniteLength;
|
|
1474
1476
|
encodingWidth;
|
|
@@ -1479,28 +1481,28 @@ var je = class {
|
|
|
1479
1481
|
if (this.indefiniteLength) {
|
|
1480
1482
|
let t = [new Uint8Array([159])];
|
|
1481
1483
|
for (let n of this.items) t.push(n._toCBOR(e));
|
|
1482
|
-
return t.push(new Uint8Array([255])),
|
|
1484
|
+
return t.push(new Uint8Array([255])), h(t);
|
|
1483
1485
|
}
|
|
1484
|
-
let t = [
|
|
1486
|
+
let t = [m(4, BigInt(this.items.length), this.encodingWidth)];
|
|
1485
1487
|
for (let n of this.items) t.push(n._toCBOR(e));
|
|
1486
|
-
return
|
|
1488
|
+
return h(t);
|
|
1487
1489
|
}
|
|
1488
1490
|
_toEDN(e, t) {
|
|
1489
|
-
let n =
|
|
1491
|
+
let n = v(e), r = e?.preserveComments, i = r && (se(this) || this.items.some(b));
|
|
1490
1492
|
n === null && i && (n = " ");
|
|
1491
|
-
let { inlineSep: a, multilineSep: o, trailSep: s } =
|
|
1493
|
+
let { inlineSep: a, multilineSep: o, trailSep: s } = x(e, n === null), c = !this.indefiniteLength && this.encodingWidth !== void 0 ? `_${this.encodingWidth} ` : "";
|
|
1492
1494
|
if (n === null || this.items.length === 0 && !i) {
|
|
1493
1495
|
let n = this.items.map((n) => n._toEDN(e, t + 1)).join(a);
|
|
1494
1496
|
return this.indefiniteLength ? this.items.length === 0 ? "[_ ]" : `[_ ${n}]` : `[${c}${n}]`;
|
|
1495
1497
|
}
|
|
1496
|
-
let l =
|
|
1498
|
+
let l = y(n, t + 1), u = y(n, t), d = this.indefiniteLength ? "[_ " : `[${c}`, f = [];
|
|
1497
1499
|
for (let n = 0; n < this.items.length; n++) {
|
|
1498
1500
|
let i = this.items[n];
|
|
1499
|
-
r && f.push(...
|
|
1501
|
+
r && f.push(...ce(i, l));
|
|
1500
1502
|
let a = n < this.items.length - 1 ? o : s;
|
|
1501
|
-
f.push(`${l}${i._toEDN(e, t + 1)}${a}${r ?
|
|
1503
|
+
f.push(`${l}${i._toEDN(e, t + 1)}${a}${r ? le(i) : ""}`);
|
|
1502
1504
|
}
|
|
1503
|
-
return r && f.push(...
|
|
1505
|
+
return r && f.push(...ue(this, l)), `${d}\n${f.join("\n")}\n${u}]`;
|
|
1504
1506
|
}
|
|
1505
1507
|
_toHexDump(e, t) {
|
|
1506
1508
|
let n = (e) => e.toString(16).toUpperCase().padStart(2, "0"), r = (e) => Array.from(e, (e) => e.toString(16).toUpperCase().padStart(2, "0")).join(" ");
|
|
@@ -1519,7 +1521,7 @@ var je = class {
|
|
|
1519
1521
|
}
|
|
1520
1522
|
let i = [{
|
|
1521
1523
|
depth: e,
|
|
1522
|
-
hex: r(
|
|
1524
|
+
hex: r(m(4, BigInt(this.items.length), this.encodingWidth)),
|
|
1523
1525
|
comment: `Array of length ${this.items.length}`
|
|
1524
1526
|
}];
|
|
1525
1527
|
for (let n of this.items) i.push(...n._toHexDump(e + 1, t));
|
|
@@ -1538,7 +1540,7 @@ var je = class {
|
|
|
1538
1540
|
}
|
|
1539
1541
|
return r;
|
|
1540
1542
|
}
|
|
1541
|
-
},
|
|
1543
|
+
}, O = class extends d {
|
|
1542
1544
|
entries;
|
|
1543
1545
|
indefiniteLength;
|
|
1544
1546
|
encodingWidth;
|
|
@@ -1549,32 +1551,32 @@ var je = class {
|
|
|
1549
1551
|
if (this.indefiniteLength) {
|
|
1550
1552
|
let t = [new Uint8Array([191])];
|
|
1551
1553
|
for (let [n, r] of this.entries) t.push(n._toCBOR(e), r._toCBOR(e));
|
|
1552
|
-
return t.push(new Uint8Array([255])),
|
|
1554
|
+
return t.push(new Uint8Array([255])), h(t);
|
|
1553
1555
|
}
|
|
1554
|
-
let t = [
|
|
1556
|
+
let t = [m(5, BigInt(this.entries.length), this.encodingWidth)];
|
|
1555
1557
|
for (let [n, r] of this.entries) t.push(n._toCBOR(e), r._toCBOR(e));
|
|
1556
|
-
return
|
|
1558
|
+
return h(t);
|
|
1557
1559
|
}
|
|
1558
1560
|
_toEDN(e, t) {
|
|
1559
|
-
let n =
|
|
1561
|
+
let n = v(e), r = e?.preserveComments, i = r && (se(this) || this.entries.some(([e, t]) => b(e) || b(t)));
|
|
1560
1562
|
n === null && i && (n = " ");
|
|
1561
|
-
let { inlineSep: a, multilineSep: o, trailSep: s, colSep: c } =
|
|
1563
|
+
let { inlineSep: a, multilineSep: o, trailSep: s, colSep: c } = x(e, n === null), l = !this.indefiniteLength && this.encodingWidth !== void 0 ? `_${this.encodingWidth} ` : "", u = this.indefiniteLength ? "{_ " : `{${l}`;
|
|
1562
1564
|
if (n === null || this.entries.length === 0 && !i) {
|
|
1563
1565
|
let n = this.entries.map(([n, r]) => `${n._toEDN(e, t + 1)}${c}${r._toEDN(e, t + 1)}`).join(a);
|
|
1564
1566
|
return this.indefiniteLength ? this.entries.length === 0 ? "{_ }" : `{_ ${n}}` : `{${l}${n}}`;
|
|
1565
1567
|
}
|
|
1566
|
-
let d =
|
|
1568
|
+
let d = y(n, t + 1), f = y(n, t), p = [];
|
|
1567
1569
|
for (let n = 0; n < this.entries.length; n++) {
|
|
1568
1570
|
let [i, a] = this.entries[n];
|
|
1569
|
-
r && p.push(...
|
|
1570
|
-
let l = n < this.entries.length - 1 ? o : s, u = r ?
|
|
1571
|
+
r && p.push(...ce(i, d));
|
|
1572
|
+
let l = n < this.entries.length - 1 ? o : s, u = r ? Me([
|
|
1571
1573
|
...i.comments?.trailing ?? [],
|
|
1572
1574
|
...a.comments?.leading ?? [],
|
|
1573
1575
|
...a.comments?.trailing ?? []
|
|
1574
1576
|
]) : "";
|
|
1575
1577
|
p.push(`${d}${i._toEDN(e, t + 1)}${c}${a._toEDN(e, t + 1)}${l}${u}`);
|
|
1576
1578
|
}
|
|
1577
|
-
return r && p.push(...
|
|
1579
|
+
return r && p.push(...ue(this, d)), `${u}\n${p.join("\n")}\n${f}}`;
|
|
1578
1580
|
}
|
|
1579
1581
|
_toHexDump(e, t) {
|
|
1580
1582
|
let n = (e) => e.toString(16).toUpperCase().padStart(2, "0"), r = (e) => Array.from(e, (e) => e.toString(16).toUpperCase().padStart(2, "0")).join(" ");
|
|
@@ -1593,7 +1595,7 @@ var je = class {
|
|
|
1593
1595
|
}
|
|
1594
1596
|
let i = [{
|
|
1595
1597
|
depth: e,
|
|
1596
|
-
hex: r(
|
|
1598
|
+
hex: r(m(5, BigInt(this.entries.length), this.encodingWidth)),
|
|
1597
1599
|
comment: `Map of length ${this.entries.length}`
|
|
1598
1600
|
}];
|
|
1599
1601
|
for (let [n, r] of this.entries) i.push(...n._toHexDump(e + 1, t)), i.push(...r._toHexDump(e + 1, t));
|
|
@@ -1610,13 +1612,13 @@ var je = class {
|
|
|
1610
1612
|
}
|
|
1611
1613
|
return n;
|
|
1612
1614
|
};
|
|
1613
|
-
return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof
|
|
1615
|
+
return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof F) ? (() => {
|
|
1614
1616
|
let n = e ? {
|
|
1615
1617
|
...e,
|
|
1616
1618
|
reviver: void 0
|
|
1617
1619
|
} : void 0, r = {};
|
|
1618
1620
|
for (let [e, t] of this.entries) {
|
|
1619
|
-
let i = e instanceof
|
|
1621
|
+
let i = e instanceof F ? e.value : e.toEDN(), a = t._toJS(n);
|
|
1620
1622
|
i === "__proto__" ? Object.defineProperty(r, i, {
|
|
1621
1623
|
value: a,
|
|
1622
1624
|
writable: !0,
|
|
@@ -1628,10 +1630,10 @@ var je = class {
|
|
|
1628
1630
|
let i = /* @__PURE__ */ new Map();
|
|
1629
1631
|
for (let e = 0; e < this.entries.length; e++) {
|
|
1630
1632
|
let [t] = this.entries[e];
|
|
1631
|
-
i.set(t instanceof
|
|
1633
|
+
i.set(t instanceof F ? t.value : t.toEDN(), e);
|
|
1632
1634
|
}
|
|
1633
1635
|
for (let n = 0; n < this.entries.length; n++) {
|
|
1634
|
-
let [a, o] = this.entries[n], s = a instanceof
|
|
1636
|
+
let [a, o] = this.entries[n], s = a instanceof F ? a.value : a.toEDN();
|
|
1635
1637
|
if (i.get(s) !== n) continue;
|
|
1636
1638
|
let c = o._toJS(e), u = t.call(r, s, c);
|
|
1637
1639
|
u === l || e?.undefinedOmits && u === void 0 ? delete r[s] : s === "__proto__" ? Object.defineProperty(r, s, {
|
|
@@ -1645,12 +1647,12 @@ var je = class {
|
|
|
1645
1647
|
})() : n();
|
|
1646
1648
|
}
|
|
1647
1649
|
};
|
|
1648
|
-
function
|
|
1650
|
+
function Me(e) {
|
|
1649
1651
|
return e.length === 0 ? "" : " " + e.map((e) => e.text.trimEnd()).join(" ");
|
|
1650
1652
|
}
|
|
1651
1653
|
//#endregion
|
|
1652
1654
|
//#region src/ast/CborSimple.ts
|
|
1653
|
-
var
|
|
1655
|
+
var k = class e extends d {
|
|
1654
1656
|
value;
|
|
1655
1657
|
constructor(e) {
|
|
1656
1658
|
if (super(), !Number.isInteger(e) || e < 0 || e > 255) throw RangeError("CborSimple value must be an integer in 0–255");
|
|
@@ -1681,29 +1683,29 @@ var O = class e extends d {
|
|
|
1681
1683
|
default: return new u(this.value);
|
|
1682
1684
|
}
|
|
1683
1685
|
}
|
|
1684
|
-
},
|
|
1686
|
+
}, A = class extends d {
|
|
1685
1687
|
items;
|
|
1686
1688
|
constructor(e) {
|
|
1687
1689
|
super(), this.items = e;
|
|
1688
1690
|
}
|
|
1689
1691
|
_content(e) {
|
|
1690
|
-
return
|
|
1692
|
+
return h(this.items.map((t) => t._toCBOR(e)));
|
|
1691
1693
|
}
|
|
1692
1694
|
_toCBOR(e) {
|
|
1693
1695
|
let t = this._content(e);
|
|
1694
|
-
return
|
|
1696
|
+
return h([m(2, BigInt(t.length)), t]);
|
|
1695
1697
|
}
|
|
1696
1698
|
_toEDN(e, t) {
|
|
1697
1699
|
if (this.items.length === 0) return "<<>>";
|
|
1698
|
-
let n =
|
|
1700
|
+
let n = v(e), { inlineSep: r, multilineSep: i, trailSep: a } = x(e, n === null);
|
|
1699
1701
|
if (n === null) return `<<${this.items.map((n) => n._toEDN(e, t + 1)).join(r)}>>`;
|
|
1700
|
-
let o =
|
|
1702
|
+
let o = y(n, t + 1), s = y(n, t), c = this.items.map((n) => `${o}${n._toEDN(e, t + 1)}`), l = c.length - 1;
|
|
1701
1703
|
return `<<\n${c.map((e, t) => t < l ? `${e}${i}` : `${e}${a}`).join("\n")}\n${s}>>`;
|
|
1702
1704
|
}
|
|
1703
1705
|
_toHexDump(e, t) {
|
|
1704
1706
|
let n = (e) => Array.from(e, (e) => e.toString(16).toUpperCase().padStart(2, "0")).join(" "), r = this._content().length, i = [{
|
|
1705
1707
|
depth: e,
|
|
1706
|
-
hex: n(
|
|
1708
|
+
hex: n(m(2, BigInt(r))),
|
|
1707
1709
|
comment: `Embedded CBOR sequence, ${r} byte${r === 1 ? "" : "s"}`
|
|
1708
1710
|
}];
|
|
1709
1711
|
for (let n of this.items) i.push(...n._toHexDump(e + 1, t));
|
|
@@ -1712,24 +1714,24 @@ var O = class e extends d {
|
|
|
1712
1714
|
_toJS(e) {
|
|
1713
1715
|
return this._content();
|
|
1714
1716
|
}
|
|
1715
|
-
},
|
|
1717
|
+
}, Ne = 999n, Pe = class extends C {
|
|
1716
1718
|
constructor(e, t) {
|
|
1717
|
-
let n = t.length === 1 && t[0] instanceof
|
|
1718
|
-
super(
|
|
1719
|
+
let n = t.length === 1 && t[0] instanceof F ? t[0] : new D(t);
|
|
1720
|
+
super(Ne, new D([new F(e), n]));
|
|
1719
1721
|
}
|
|
1720
1722
|
_toEDN(e, t) {
|
|
1721
1723
|
let n = this.content, r = n.items[0].value, i = n.items[1];
|
|
1722
|
-
return i instanceof
|
|
1724
|
+
return i instanceof F ? `${r}${Ce(i.value)}` : `${r}<<${i.items.map((n) => n._toEDN(e, t)).join(", ")}>>`;
|
|
1723
1725
|
}
|
|
1724
|
-
},
|
|
1726
|
+
}, Fe = 888n, j = class extends C {
|
|
1725
1727
|
constructor(e) {
|
|
1726
|
-
e === void 0 ? super(
|
|
1728
|
+
e === void 0 ? super(Fe, k.NULL) : super(Fe, new D(e));
|
|
1727
1729
|
}
|
|
1728
1730
|
_toEDN(e, t) {
|
|
1729
|
-
return this.content instanceof
|
|
1731
|
+
return this.content instanceof k ? "..." : this.content instanceof D ? this.content.items.map((n) => n._toEDN(e, t)).join(" + ") : super._toEDN(e, t);
|
|
1730
1732
|
}
|
|
1731
|
-
},
|
|
1732
|
-
function
|
|
1733
|
+
}, Ie = 2n, Le = 3n, Re = 18446744073709551615n, ze = -(Re + 1n);
|
|
1734
|
+
function Be(e) {
|
|
1733
1735
|
if (e < 0n) throw RangeError("bigintToBytes requires a non-negative value");
|
|
1734
1736
|
if (e === 0n) return new Uint8Array();
|
|
1735
1737
|
let t = e.toString(16);
|
|
@@ -1738,16 +1740,16 @@ function He(e) {
|
|
|
1738
1740
|
for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
|
|
1739
1741
|
return n;
|
|
1740
1742
|
}
|
|
1741
|
-
function
|
|
1743
|
+
function Ve(e) {
|
|
1742
1744
|
let t = 0n;
|
|
1743
1745
|
for (let n of e) t = t << 8n | BigInt(n);
|
|
1744
1746
|
return t;
|
|
1745
1747
|
}
|
|
1746
|
-
var
|
|
1748
|
+
var M = class extends C {
|
|
1747
1749
|
bigValue;
|
|
1748
1750
|
constructor(e) {
|
|
1749
|
-
if (e <=
|
|
1750
|
-
super(
|
|
1751
|
+
if (e <= Re) throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);
|
|
1752
|
+
super(Ie, new w(Be(e))), this.bigValue = e;
|
|
1751
1753
|
}
|
|
1752
1754
|
_toEDN(e, t) {
|
|
1753
1755
|
return this.bigValue.toString();
|
|
@@ -1755,11 +1757,11 @@ var We = class extends C {
|
|
|
1755
1757
|
_toJS(e) {
|
|
1756
1758
|
return this.bigValue;
|
|
1757
1759
|
}
|
|
1758
|
-
},
|
|
1760
|
+
}, N = class extends C {
|
|
1759
1761
|
bigValue;
|
|
1760
1762
|
constructor(e) {
|
|
1761
|
-
if (e >=
|
|
1762
|
-
super(
|
|
1763
|
+
if (e >= ze) throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);
|
|
1764
|
+
super(Le, new w(Be(-1n - e))), this.bigValue = e;
|
|
1763
1765
|
}
|
|
1764
1766
|
_toEDN(e, t) {
|
|
1765
1767
|
return this.bigValue.toString();
|
|
@@ -1770,11 +1772,11 @@ var We = class extends C {
|
|
|
1770
1772
|
};
|
|
1771
1773
|
//#endregion
|
|
1772
1774
|
//#region src/edn/parser.ts
|
|
1773
|
-
function
|
|
1774
|
-
let n = new je(e, { offset: t?.offset }), r = new
|
|
1775
|
-
return t?.preserveComments &&
|
|
1775
|
+
function He(e, t) {
|
|
1776
|
+
let n = new je(e, { offset: t?.offset }), r = new et(n, t?.extensions, t?.unresolvedExtension, t?.allowInvalidUtf8, t?.allowTrailing).parse();
|
|
1777
|
+
return t?.preserveComments && Ze(r, n.comments, e), r;
|
|
1776
1778
|
}
|
|
1777
|
-
function
|
|
1779
|
+
function Ue(e) {
|
|
1778
1780
|
let t = e, n;
|
|
1779
1781
|
if (/[_][0-3i]$/.test(e)) {
|
|
1780
1782
|
let r = e[e.length - 1];
|
|
@@ -1785,10 +1787,10 @@ function qe(e) {
|
|
|
1785
1787
|
encodingWidth: n
|
|
1786
1788
|
};
|
|
1787
1789
|
}
|
|
1788
|
-
function
|
|
1790
|
+
function We(e) {
|
|
1789
1791
|
return e.startsWith("-") ? -BigInt(e.slice(1)) : BigInt(e);
|
|
1790
1792
|
}
|
|
1791
|
-
function
|
|
1793
|
+
function Ge(e) {
|
|
1792
1794
|
if (e === "NaN") return {
|
|
1793
1795
|
value: NaN,
|
|
1794
1796
|
precision: void 0
|
|
@@ -1811,15 +1813,15 @@ function Ye(e) {
|
|
|
1811
1813
|
precision: n
|
|
1812
1814
|
};
|
|
1813
1815
|
}
|
|
1814
|
-
function
|
|
1816
|
+
function Ke(e) {
|
|
1815
1817
|
if (typeof Uint8Array.fromHex == "function") return Uint8Array.fromHex(e);
|
|
1816
1818
|
if (e.length % 2 != 0) throw SyntaxError(`hex string has odd length: ${e.length}`);
|
|
1817
1819
|
let t = new Uint8Array(e.length / 2);
|
|
1818
1820
|
for (let n = 0; n < e.length; n += 2) t[n / 2] = parseInt(e.slice(n, n + 2), 16);
|
|
1819
1821
|
return t;
|
|
1820
1822
|
}
|
|
1821
|
-
var
|
|
1822
|
-
function
|
|
1823
|
+
var qe = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", Je = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
1824
|
+
function Ye(e, t) {
|
|
1823
1825
|
let n = e.replace(/=+$/, "").toUpperCase(), r = n.length % 8;
|
|
1824
1826
|
if (r === 1 || r === 3 || r === 6) throw SyntaxError(`invalid base32 length: ${n.length} characters`);
|
|
1825
1827
|
let i = new Uint8Array(128).fill(255);
|
|
@@ -1833,7 +1835,7 @@ function $e(e, t) {
|
|
|
1833
1835
|
if (s > 0 && o & (1 << s) - 1) throw SyntaxError("non-zero trailing bits in base32 input");
|
|
1834
1836
|
return a;
|
|
1835
1837
|
}
|
|
1836
|
-
function
|
|
1838
|
+
function Xe(e) {
|
|
1837
1839
|
if (typeof Uint8Array.fromBase64 == "function") {
|
|
1838
1840
|
let t = /[-_]/.test(e) ? "base64url" : "base64";
|
|
1839
1841
|
return Uint8Array.fromBase64(e, {
|
|
@@ -1845,38 +1847,38 @@ function et(e) {
|
|
|
1845
1847
|
for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
|
|
1846
1848
|
return i;
|
|
1847
1849
|
}
|
|
1848
|
-
function
|
|
1850
|
+
function Ze(e, t, n) {
|
|
1849
1851
|
if (t.length === 0) return;
|
|
1850
|
-
let r =
|
|
1852
|
+
let r = Qe(e), i = $e(n);
|
|
1851
1853
|
for (let a of t) {
|
|
1852
1854
|
let t = { ...a }, o = [...r].filter((e) => e.end <= a.start).sort((e, t) => t.end - e.end || t.start - e.start)[0], s = o ? n.slice(o.end, a.start) : "";
|
|
1853
1855
|
if (o && i(o.end) === a.line && !s.includes(":")) {
|
|
1854
|
-
|
|
1856
|
+
P(o.node, "trailing", t);
|
|
1855
1857
|
continue;
|
|
1856
1858
|
}
|
|
1857
1859
|
let c = [...r].filter((e) => e.start < a.start && a.end < e.end).sort((e, t) => t.start - e.start || e.end - t.end)[0], l = [...r].filter((e) => e.start >= a.end).sort((e, t) => e.start - t.start || t.end - e.end)[0];
|
|
1858
1860
|
if ((!c || l && l.end <= c.end) && l) {
|
|
1859
|
-
|
|
1861
|
+
P(l.node, "leading", t);
|
|
1860
1862
|
continue;
|
|
1861
1863
|
}
|
|
1862
|
-
|
|
1864
|
+
P(c?.node ?? e, "dangling", t);
|
|
1863
1865
|
}
|
|
1864
1866
|
}
|
|
1865
|
-
function
|
|
1867
|
+
function Qe(e) {
|
|
1866
1868
|
let t = [], n = (e) => {
|
|
1867
1869
|
if (e.start !== void 0 && e.end !== void 0 && t.push({
|
|
1868
1870
|
node: e,
|
|
1869
1871
|
start: e.start,
|
|
1870
1872
|
end: e.end
|
|
1871
|
-
}), e instanceof
|
|
1873
|
+
}), e instanceof D || e instanceof A) {
|
|
1872
1874
|
for (let t of e.items) n(t);
|
|
1873
1875
|
return;
|
|
1874
1876
|
}
|
|
1875
|
-
if (e instanceof
|
|
1877
|
+
if (e instanceof O) {
|
|
1876
1878
|
for (let [t, r] of e.entries) n(t), n(r);
|
|
1877
1879
|
return;
|
|
1878
1880
|
}
|
|
1879
|
-
if (e instanceof
|
|
1881
|
+
if (e instanceof T || e instanceof E) {
|
|
1880
1882
|
for (let t of e.chunks) n(t);
|
|
1881
1883
|
return;
|
|
1882
1884
|
}
|
|
@@ -1884,10 +1886,10 @@ function nt(e) {
|
|
|
1884
1886
|
};
|
|
1885
1887
|
return n(e), t;
|
|
1886
1888
|
}
|
|
1887
|
-
function
|
|
1889
|
+
function P(e, t, n) {
|
|
1888
1890
|
e.comments ??= {}, e.comments[t] ??= [], e.comments[t].push(n);
|
|
1889
1891
|
}
|
|
1890
|
-
function
|
|
1892
|
+
function $e(e) {
|
|
1891
1893
|
let t = [0];
|
|
1892
1894
|
for (let n = 0; n < e.length; n++) e[n] === "\n" && t.push(n + 1);
|
|
1893
1895
|
return (n) => {
|
|
@@ -1901,13 +1903,16 @@ function it(e) {
|
|
|
1901
1903
|
return a + 1;
|
|
1902
1904
|
};
|
|
1903
1905
|
}
|
|
1904
|
-
var
|
|
1906
|
+
var et = class {
|
|
1907
|
+
t;
|
|
1908
|
+
allowInvalidUtf8;
|
|
1909
|
+
allowTrailing;
|
|
1905
1910
|
extByPrefix;
|
|
1906
1911
|
extByTag;
|
|
1907
1912
|
unresolvedExtension;
|
|
1908
1913
|
constructor(e, t, n, r, i) {
|
|
1909
1914
|
this.t = e, this.allowInvalidUtf8 = r, this.allowTrailing = i, this.extByPrefix = /* @__PURE__ */ new Map(), this.extByTag = /* @__PURE__ */ new Map(), this.unresolvedExtension = n ?? "cpa999";
|
|
1910
|
-
for (let e of [...
|
|
1915
|
+
for (let e of [...Z, ...t ?? []]) {
|
|
1911
1916
|
for (let t of e.appStringPrefixes ?? []) this.extByPrefix.set(t, e);
|
|
1912
1917
|
for (let t of e.tagNumbers ?? []) this.extByTag.set(t, e);
|
|
1913
1918
|
}
|
|
@@ -1934,12 +1939,12 @@ var at = class {
|
|
|
1934
1939
|
case "BYTES_B64":
|
|
1935
1940
|
case "BYTES_B32":
|
|
1936
1941
|
case "BYTES_H32": return this.t.consume(), this._parseBytesConcat(this._decodeBytesToken(e), e.type, e.raw);
|
|
1937
|
-
case "EMPTY_INDEF_BYTES": return this.t.consume(), new
|
|
1938
|
-
case "EMPTY_INDEF_TEXT": return this.t.consume(), new
|
|
1939
|
-
case "TRUE": return this.t.consume(),
|
|
1940
|
-
case "FALSE": return this.t.consume(),
|
|
1941
|
-
case "NULL": return this.t.consume(),
|
|
1942
|
-
case "UNDEFINED": return this.t.consume(),
|
|
1942
|
+
case "EMPTY_INDEF_BYTES": return this.t.consume(), new T([]);
|
|
1943
|
+
case "EMPTY_INDEF_TEXT": return this.t.consume(), new E([]);
|
|
1944
|
+
case "TRUE": return this.t.consume(), k.TRUE;
|
|
1945
|
+
case "FALSE": return this.t.consume(), k.FALSE;
|
|
1946
|
+
case "NULL": return this.t.consume(), k.NULL;
|
|
1947
|
+
case "UNDEFINED": return this.t.consume(), k.UNDEFINED;
|
|
1943
1948
|
case "SIMPLE": return this.parseSimple();
|
|
1944
1949
|
case "LBRACKET": return this.parseArray();
|
|
1945
1950
|
case "LBRACE": return this.parseMap();
|
|
@@ -1949,7 +1954,7 @@ var at = class {
|
|
|
1949
1954
|
this.t.consume();
|
|
1950
1955
|
let t = this.extByPrefix.get(e.appPrefix);
|
|
1951
1956
|
if (!t?.parseAppString) {
|
|
1952
|
-
if (this.unresolvedExtension === "cpa999") return new
|
|
1957
|
+
if (this.unresolvedExtension === "cpa999") return new Pe(e.appPrefix, [new F(e.value)]);
|
|
1953
1958
|
this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
|
|
1954
1959
|
}
|
|
1955
1960
|
return t.parseAppString(e.appPrefix, e.value);
|
|
@@ -1961,28 +1966,28 @@ var at = class {
|
|
|
1961
1966
|
this.expect("GT_GT");
|
|
1962
1967
|
let n = this.extByPrefix.get(e.appPrefix);
|
|
1963
1968
|
if (!n) {
|
|
1964
|
-
if (this.unresolvedExtension === "cpa999") return new
|
|
1969
|
+
if (this.unresolvedExtension === "cpa999") return new Pe(e.appPrefix, t);
|
|
1965
1970
|
this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
|
|
1966
1971
|
}
|
|
1967
1972
|
return n.parseAppSequence || this._fail(`app-string extension ${JSON.stringify(e.appPrefix)} does not support <<...>> form`, e), n.parseAppSequence(e.appPrefix, t);
|
|
1968
1973
|
}
|
|
1969
1974
|
case "ELLIPSIS": {
|
|
1970
|
-
if (this.t.consume(), this.t.peek().type !== "PLUS") return new
|
|
1971
|
-
let e = [new
|
|
1975
|
+
if (this.t.consume(), this.t.peek().type !== "PLUS") return new j();
|
|
1976
|
+
let e = [new j()];
|
|
1972
1977
|
for (; this.t.peek().type === "PLUS";) this.t.consume(), e.push(this.parseValue());
|
|
1973
|
-
return new
|
|
1978
|
+
return new j(e);
|
|
1974
1979
|
}
|
|
1975
1980
|
case "BYTES_HEX_ELIDED": return this.t.consume(), this._parseHexElidedConcat(e);
|
|
1976
1981
|
default: this._fail(`unexpected token: ${JSON.stringify(e.value)}`, e);
|
|
1977
1982
|
}
|
|
1978
1983
|
}
|
|
1979
1984
|
parseIntegerOrTag() {
|
|
1980
|
-
let e = this.t.consume(), { numStr: t, encodingWidth: n } =
|
|
1981
|
-
if (i > 18446744073709551615n) return this.t.peek().type === "LPAREN" && this._fail("tag number exceeds maximum uint64", e), new
|
|
1982
|
-
if (i < -18446744073709551616n) return new
|
|
1983
|
-
let a = i >= 0n ? new
|
|
1985
|
+
let e = this.t.consume(), { numStr: t, encodingWidth: n } = Ue(e.value), r = n === void 0 ? this.consumeEncodingIndicator() : n, i = We(t);
|
|
1986
|
+
if (i > 18446744073709551615n) return this.t.peek().type === "LPAREN" && this._fail("tag number exceeds maximum uint64", e), new M(i);
|
|
1987
|
+
if (i < -18446744073709551616n) return new N(i);
|
|
1988
|
+
let a = i >= 0n ? new g(i, r === void 0 ? void 0 : { encodingWidth: r }) : new _(i, r === void 0 ? void 0 : { encodingWidth: r });
|
|
1984
1989
|
if (this.t.peek().type === "LPAREN") {
|
|
1985
|
-
a instanceof
|
|
1990
|
+
a instanceof g || this._fail("tag number must be non-negative", e), this.t.consume();
|
|
1986
1991
|
let t = this.parseValue();
|
|
1987
1992
|
this.expect("RPAREN");
|
|
1988
1993
|
let n = a.value, i = this.extByTag.get(n);
|
|
@@ -1995,14 +2000,14 @@ var at = class {
|
|
|
1995
2000
|
return a;
|
|
1996
2001
|
}
|
|
1997
2002
|
parseFloat() {
|
|
1998
|
-
let { value: e, precision: t } =
|
|
2003
|
+
let { value: e, precision: t } = Ge(this.t.consume().value);
|
|
1999
2004
|
return new S(e, t === void 0 ? void 0 : { precision: t });
|
|
2000
2005
|
}
|
|
2001
2006
|
parseString() {
|
|
2002
2007
|
let e = this.t.consume();
|
|
2003
2008
|
if (this.t.peek().type !== "PLUS") {
|
|
2004
2009
|
let t = this.consumeEncodingIndicator();
|
|
2005
|
-
return new
|
|
2010
|
+
return new F(e.value, t === void 0 ? void 0 : { encodingWidth: t });
|
|
2006
2011
|
}
|
|
2007
2012
|
let t = !1, n = [{ text: e.value }];
|
|
2008
2013
|
for (; this.t.peek().type === "PLUS";) {
|
|
@@ -2012,11 +2017,11 @@ var at = class {
|
|
|
2012
2017
|
}
|
|
2013
2018
|
if (!t) {
|
|
2014
2019
|
let e = this.consumeEncodingIndicator();
|
|
2015
|
-
return new
|
|
2020
|
+
return new F(n.map((e) => "text" in e ? e.text : "").join(""), e === void 0 ? void 0 : { encodingWidth: e });
|
|
2016
2021
|
}
|
|
2017
2022
|
let r = [], i = "";
|
|
2018
|
-
for (let e of n) "ellipsis" in e ? (i !== "" && (r.push(new
|
|
2019
|
-
return i !== "" && r.push(new
|
|
2023
|
+
for (let e of n) "ellipsis" in e ? (i !== "" && (r.push(new F(i)), i = ""), r.push(new j())) : i += e.text;
|
|
2024
|
+
return i !== "" && r.push(new F(i)), new j(r);
|
|
2020
2025
|
}
|
|
2021
2026
|
_isBytesToken(e) {
|
|
2022
2027
|
return e === "BYTES_HEX" || e === "SQSTR" || e === "BYTES_B64" || e === "BYTES_B32" || e === "BYTES_H32";
|
|
@@ -2024,10 +2029,10 @@ var at = class {
|
|
|
2024
2029
|
_decodeBytesToken(e) {
|
|
2025
2030
|
switch (e.type) {
|
|
2026
2031
|
case "BYTES_HEX":
|
|
2027
|
-
case "SQSTR": return
|
|
2028
|
-
case "BYTES_B64": return
|
|
2029
|
-
case "BYTES_B32": return
|
|
2030
|
-
case "BYTES_H32": return
|
|
2032
|
+
case "SQSTR": return Ke(e.value);
|
|
2033
|
+
case "BYTES_B64": return Xe(e.value);
|
|
2034
|
+
case "BYTES_B32": return Ye(e.value, qe);
|
|
2035
|
+
case "BYTES_H32": return Ye(e.value, Je);
|
|
2031
2036
|
default: this._fail("expected byte string token", e);
|
|
2032
2037
|
}
|
|
2033
2038
|
}
|
|
@@ -2064,7 +2069,7 @@ var at = class {
|
|
|
2064
2069
|
else if (e.type === "BYTES_HEX_ELIDED") {
|
|
2065
2070
|
this.t.consume();
|
|
2066
2071
|
let t = this._buildBytesElidedItems(e.value);
|
|
2067
|
-
for (let e of t) e instanceof
|
|
2072
|
+
for (let e of t) e instanceof j ? (i.push({ ellipsis: !0 }), r = !0) : e instanceof w && i.push({ bytes: e.value });
|
|
2068
2073
|
} else this._isBytesToken(e.type) ? (this.t.consume(), i.push({ bytes: this._decodeBytesToken(e) })) : e.type === "TSTR" || e.type === "RAWSTRING" ? (this.t.consume(), i.push({ bytes: new TextEncoder().encode(e.value) })) : this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`, e);
|
|
2069
2074
|
}
|
|
2070
2075
|
if (!r) {
|
|
@@ -2074,15 +2079,15 @@ var at = class {
|
|
|
2074
2079
|
let a = [], o = [], s = () => {
|
|
2075
2080
|
o.length > 0 && (a.push(new w(this._concatBytes([...o]))), o.length = 0);
|
|
2076
2081
|
};
|
|
2077
|
-
for (let e of i) "ellipsis" in e ? (s(), a.push(new
|
|
2078
|
-
return s(), new
|
|
2082
|
+
for (let e of i) "ellipsis" in e ? (s(), a.push(new j())) : o.push(e.bytes);
|
|
2083
|
+
return s(), new j(a);
|
|
2079
2084
|
}
|
|
2080
2085
|
_parseHexElidedConcat(e) {
|
|
2081
2086
|
let t = this._buildBytesElidedItems(e.value);
|
|
2082
2087
|
for (; this.t.peek().type === "PLUS";) {
|
|
2083
2088
|
this.t.consume();
|
|
2084
2089
|
let e = this.t.peek();
|
|
2085
|
-
if (e.type === "ELLIPSIS") this.t.consume(), t.push(new
|
|
2090
|
+
if (e.type === "ELLIPSIS") this.t.consume(), t.push(new j());
|
|
2086
2091
|
else if (e.type === "BYTES_HEX_ELIDED") {
|
|
2087
2092
|
this.t.consume();
|
|
2088
2093
|
let n = this._buildBytesElidedItems(e.value);
|
|
@@ -2093,11 +2098,11 @@ var at = class {
|
|
|
2093
2098
|
r instanceof w ? t[t.length - 1] = new w(this._concatBytes([r.value, n])) : t.push(new w(n));
|
|
2094
2099
|
} else this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`, e);
|
|
2095
2100
|
}
|
|
2096
|
-
return new
|
|
2101
|
+
return new j(t);
|
|
2097
2102
|
}
|
|
2098
2103
|
_buildBytesElidedItems(e) {
|
|
2099
2104
|
let t = e.split("..."), n = [];
|
|
2100
|
-
for (let e = 0; e < t.length; e++) e > 0 && n.push(new
|
|
2105
|
+
for (let e = 0; e < t.length; e++) e > 0 && n.push(new j()), t[e].length > 0 && n.push(new w(Ke(t[e])));
|
|
2101
2106
|
return n;
|
|
2102
2107
|
}
|
|
2103
2108
|
_mergeFirstBytesItem(e, t) {
|
|
@@ -2114,14 +2119,14 @@ var at = class {
|
|
|
2114
2119
|
this.t.consume(), this.expect("LPAREN");
|
|
2115
2120
|
let e = this.t.peek();
|
|
2116
2121
|
e.type !== "INTEGER" && this._fail(`expected integer inside simple(), got ${JSON.stringify(e.value)}`, e), this.t.consume();
|
|
2117
|
-
let { numStr: t } =
|
|
2118
|
-
return this.expect("RPAREN"), new
|
|
2122
|
+
let { numStr: t } = Ue(e.value), n = Number(We(t));
|
|
2123
|
+
return this.expect("RPAREN"), new k(n);
|
|
2119
2124
|
}
|
|
2120
2125
|
parseEmbeddedCBOR() {
|
|
2121
2126
|
this.t.consume();
|
|
2122
2127
|
let e = [];
|
|
2123
2128
|
for (; this.t.peek().type !== "GT_GT" && !(e.length > 0 && this.t.peek().type === "COMMA" && (this.t.consume(), this.t.peek().type === "GT_GT"));) e.push(this.parseValue());
|
|
2124
|
-
return this.expect("GT_GT"), new
|
|
2129
|
+
return this.expect("GT_GT"), new A(e);
|
|
2125
2130
|
}
|
|
2126
2131
|
parseArray() {
|
|
2127
2132
|
this.t.consume();
|
|
@@ -2133,7 +2138,7 @@ var at = class {
|
|
|
2133
2138
|
}
|
|
2134
2139
|
let n = [];
|
|
2135
2140
|
for (; this.t.peek().type !== "RBRACKET" && !(n.length > 0 && this.t.peek().type === "COMMA" && (this.t.consume(), this.t.peek().type === "RBRACKET"));) n.push(this.parseValue());
|
|
2136
|
-
return this.expect("RBRACKET"), new
|
|
2141
|
+
return this.expect("RBRACKET"), new D(n, {
|
|
2137
2142
|
indefiniteLength: e,
|
|
2138
2143
|
encodingWidth: t
|
|
2139
2144
|
});
|
|
@@ -2153,7 +2158,7 @@ var at = class {
|
|
|
2153
2158
|
let t = this.parseValue();
|
|
2154
2159
|
n.push([e, t]);
|
|
2155
2160
|
}
|
|
2156
|
-
return this.expect("RBRACE"), new
|
|
2161
|
+
return this.expect("RBRACE"), new O(n, {
|
|
2157
2162
|
indefiniteLength: e,
|
|
2158
2163
|
encodingWidth: t
|
|
2159
2164
|
});
|
|
@@ -2166,12 +2171,12 @@ var at = class {
|
|
|
2166
2171
|
for (; this.t.peek().type !== "RPAREN" && !(t.length > 0 && this.t.peek().type === "COMMA" && (this.t.consume(), this.t.peek().type === "RPAREN"));) t.push(this.parseValue());
|
|
2167
2172
|
this.expect("RPAREN"), t.length === 0 && this._fail("empty indefinite group (_ ) is ambiguous; use ''_ for bytes or \"\"_ for text");
|
|
2168
2173
|
let n = t[0];
|
|
2169
|
-
if (n instanceof w) return new
|
|
2174
|
+
if (n instanceof w) return new T(t.map((e, t) => {
|
|
2170
2175
|
if (e instanceof w) return e;
|
|
2171
2176
|
this._fail(`indefinite byte string chunk ${t} must be a byte string, not a text string`);
|
|
2172
2177
|
}));
|
|
2173
|
-
if (n instanceof
|
|
2174
|
-
if (e instanceof
|
|
2178
|
+
if (n instanceof F) return new E(t.map((e, t) => {
|
|
2179
|
+
if (e instanceof F) return e;
|
|
2175
2180
|
this._fail(`indefinite text string chunk ${t} must be a text string, not a byte string`);
|
|
2176
2181
|
}));
|
|
2177
2182
|
this._fail("indefinite group chunks must be byte strings or text strings");
|
|
@@ -2190,7 +2195,7 @@ var at = class {
|
|
|
2190
2195
|
let n = t ? ` at line ${t.line}, column ${t.col}` : "";
|
|
2191
2196
|
throw SyntaxError(`EDN parse error${n}: ${e}`);
|
|
2192
2197
|
}
|
|
2193
|
-
},
|
|
2198
|
+
}, tt = new TextEncoder(), F = class extends d {
|
|
2194
2199
|
indefiniteLength = !1;
|
|
2195
2200
|
value;
|
|
2196
2201
|
encodingWidth;
|
|
@@ -2198,39 +2203,39 @@ var at = class {
|
|
|
2198
2203
|
super(), this.value = e, this.encodingWidth = t?.encodingWidth;
|
|
2199
2204
|
}
|
|
2200
2205
|
_toCBOR(e) {
|
|
2201
|
-
let t =
|
|
2202
|
-
return
|
|
2206
|
+
let t = tt.encode(this.value);
|
|
2207
|
+
return h([m(3, BigInt(t.length), this.encodingWidth), t]);
|
|
2203
2208
|
}
|
|
2204
2209
|
_toEDN(e, t) {
|
|
2205
2210
|
let n = this.encodingWidth === void 0 ? "" : `_${this.encodingWidth}`;
|
|
2206
|
-
return
|
|
2211
|
+
return nt(this.value, n, e, t);
|
|
2207
2212
|
}
|
|
2208
2213
|
_toJS(e) {
|
|
2209
2214
|
return this.value;
|
|
2210
2215
|
}
|
|
2211
2216
|
};
|
|
2212
|
-
function
|
|
2213
|
-
let i = n?.textStringFormat ?? [], a =
|
|
2217
|
+
function nt(e, t, n, r) {
|
|
2218
|
+
let i = n?.textStringFormat ?? [], a = v(n);
|
|
2214
2219
|
if (i.length === 0 || a === null) return we(e) + t;
|
|
2215
|
-
let o = /* @__PURE__ */ new Map();
|
|
2216
|
-
if (i.includes("cboredn")) {
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
let
|
|
2222
|
-
if (
|
|
2223
|
-
let
|
|
2220
|
+
let o = /* @__PURE__ */ new Map(), s = null;
|
|
2221
|
+
if (i.includes("cboredn") && (s = it(e), s !== null)) for (let { point: e, contentDepth: t } of s) o.set(e, t);
|
|
2222
|
+
if (i.includes("newline")) {
|
|
2223
|
+
let t = s === null ? rt(e, 0) : at(e);
|
|
2224
|
+
for (let { point: e, contentDepth: n } of t) o.has(e) || o.set(e, n);
|
|
2225
|
+
}
|
|
2226
|
+
let c = dt(e, o);
|
|
2227
|
+
if (c.length <= 1) return we(e) + t;
|
|
2228
|
+
let l = c.map(({ text: e }, n) => {
|
|
2224
2229
|
let r = we(e);
|
|
2225
|
-
return n ===
|
|
2226
|
-
}),
|
|
2227
|
-
for (let e = 1; e <
|
|
2228
|
-
let t =
|
|
2229
|
-
|
|
2230
|
+
return n === c.length - 1 ? r + t : r;
|
|
2231
|
+
}), u = l[0];
|
|
2232
|
+
for (let e = 1; e < l.length; e++) {
|
|
2233
|
+
let t = y(a, r + 1 + c[e].contentDepth);
|
|
2234
|
+
u += ` +\n${t}${l[e]}`;
|
|
2230
2235
|
}
|
|
2231
|
-
return
|
|
2236
|
+
return u;
|
|
2232
2237
|
}
|
|
2233
|
-
function
|
|
2238
|
+
function rt(e, t) {
|
|
2234
2239
|
let n = [];
|
|
2235
2240
|
for (let r = 0; r < e.length; r++) {
|
|
2236
2241
|
let i = e[r];
|
|
@@ -2247,33 +2252,42 @@ function ct(e, t) {
|
|
|
2247
2252
|
}
|
|
2248
2253
|
return n;
|
|
2249
2254
|
}
|
|
2250
|
-
function
|
|
2255
|
+
function it(e) {
|
|
2251
2256
|
try {
|
|
2252
|
-
|
|
2257
|
+
He(e);
|
|
2253
2258
|
} catch {
|
|
2254
2259
|
return null;
|
|
2255
2260
|
}
|
|
2256
2261
|
let t = [], n = new je(e), r = 0, i = null, a = !1, o = 0;
|
|
2257
2262
|
for (;;) {
|
|
2258
|
-
let
|
|
2259
|
-
if (
|
|
2260
|
-
let
|
|
2261
|
-
a || (a = !0,
|
|
2262
|
-
point:
|
|
2263
|
-
contentDepth: r
|
|
2264
|
-
})), i !== null && (dt.has(e.type) && e.offset === i.point ? s = !0 : t.push({
|
|
2265
|
-
point: e.offset,
|
|
2266
|
-
contentDepth: i.contentDepth
|
|
2267
|
-
}), i = null), ut.has(e.type) ? (r++, i = {
|
|
2268
|
-
point: e.endOffset,
|
|
2263
|
+
let s = n.consume();
|
|
2264
|
+
if (s.type === "EOF") break;
|
|
2265
|
+
let c = !1;
|
|
2266
|
+
if (a || (a = !0, s.offset > 0 && lt(n.comments, 0, s.offset) && t.push({
|
|
2267
|
+
point: s.offset,
|
|
2269
2268
|
contentDepth: r
|
|
2270
|
-
})
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
point:
|
|
2269
|
+
})), i !== null) {
|
|
2270
|
+
if (i.kind === "opener" && st.has(s.type)) {
|
|
2271
|
+
i.point = s.endOffset, o = s.endOffset;
|
|
2272
|
+
continue;
|
|
2273
|
+
} else i.kind === "opener" && I.has(s.type) && ut(e, i.point, s.offset) ? c = !0 : t.push({
|
|
2274
|
+
point: s.offset,
|
|
2275
|
+
contentDepth: i.contentDepth
|
|
2276
|
+
});
|
|
2277
|
+
i = null;
|
|
2278
|
+
}
|
|
2279
|
+
ct.has(s.type) ? (r++, i = {
|
|
2280
|
+
point: s.endOffset,
|
|
2281
|
+
contentDepth: r,
|
|
2282
|
+
kind: "opener"
|
|
2283
|
+
}) : I.has(s.type) ? (r = Math.max(0, r - 1), c || t.push({
|
|
2284
|
+
point: s.offset,
|
|
2275
2285
|
contentDepth: r
|
|
2276
|
-
})
|
|
2286
|
+
})) : s.type === "COMMA" && (i = {
|
|
2287
|
+
point: s.endOffset,
|
|
2288
|
+
contentDepth: r,
|
|
2289
|
+
kind: "comma"
|
|
2290
|
+
}), o = s.endOffset;
|
|
2277
2291
|
}
|
|
2278
2292
|
let s = n.comments.find((e) => e.start >= o);
|
|
2279
2293
|
return s !== void 0 && t.push({
|
|
@@ -2281,21 +2295,41 @@ function lt(e) {
|
|
|
2281
2295
|
contentDepth: r
|
|
2282
2296
|
}), t;
|
|
2283
2297
|
}
|
|
2284
|
-
|
|
2298
|
+
function at(e) {
|
|
2299
|
+
let t = [], n = new je(e), r = 0;
|
|
2300
|
+
for (;;) {
|
|
2301
|
+
let i = n.consume();
|
|
2302
|
+
if (i.type === "EOF") break;
|
|
2303
|
+
if (ct.has(i.type)) r++;
|
|
2304
|
+
else if (I.has(i.type)) r = Math.max(0, r - 1);
|
|
2305
|
+
else if (i.type !== "COMMA" && ot.has(i.type)) {
|
|
2306
|
+
let n = e.slice(i.offset, i.endOffset);
|
|
2307
|
+
for (let { point: e } of rt(n, 0)) t.push({
|
|
2308
|
+
point: i.offset + e,
|
|
2309
|
+
contentDepth: r + 1
|
|
2310
|
+
});
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
return t;
|
|
2314
|
+
}
|
|
2315
|
+
var ot = new Set(["TSTR", "RAWSTRING"]), st = new Set(["ENCODING_INDICATOR", "UNDERSCORE"]), ct = new Set([
|
|
2285
2316
|
"LBRACKET",
|
|
2286
2317
|
"LBRACE",
|
|
2287
2318
|
"LPAREN",
|
|
2288
2319
|
"LT_LT"
|
|
2289
|
-
]),
|
|
2320
|
+
]), I = new Set([
|
|
2290
2321
|
"RBRACKET",
|
|
2291
2322
|
"RBRACE",
|
|
2292
2323
|
"RPAREN",
|
|
2293
2324
|
"GT_GT"
|
|
2294
2325
|
]);
|
|
2295
|
-
function
|
|
2326
|
+
function lt(e, t, n) {
|
|
2296
2327
|
return e.some((e) => e.start >= t && e.end <= n);
|
|
2297
2328
|
}
|
|
2298
|
-
function
|
|
2329
|
+
function ut(e, t, n) {
|
|
2330
|
+
return /^[\t\n\r ]*$/.test(e.slice(t, n));
|
|
2331
|
+
}
|
|
2332
|
+
function dt(e, t) {
|
|
2299
2333
|
let n = [...t].filter(([t]) => t > 0 && t < e.length).sort(([e], [t]) => e - t);
|
|
2300
2334
|
if (n.length === 0) return [{
|
|
2301
2335
|
text: e,
|
|
@@ -2313,7 +2347,7 @@ function pt(e, t) {
|
|
|
2313
2347
|
}
|
|
2314
2348
|
//#endregion
|
|
2315
2349
|
//#region src/extensions/dt.ts
|
|
2316
|
-
function
|
|
2350
|
+
function L(e) {
|
|
2317
2351
|
if (Number.isInteger(e)) return (/* @__PURE__ */ new Date(e * 1e3)).toISOString().replace(/\.000Z$/, "Z");
|
|
2318
2352
|
let t = Math.round(e * 1e3);
|
|
2319
2353
|
if (t / 1e3 === e) return new Date(t).toISOString().replace(/\.000Z$/, "Z");
|
|
@@ -2321,55 +2355,55 @@ function j(e) {
|
|
|
2321
2355
|
for (; s.length < 3;) s += "0";
|
|
2322
2356
|
return `${i}.${s}Z`;
|
|
2323
2357
|
}
|
|
2324
|
-
function
|
|
2358
|
+
function ft(e) {
|
|
2325
2359
|
if (e.length !== 1) throw SyntaxError("dt<<...>>: expected exactly one item");
|
|
2326
2360
|
let t = e[0];
|
|
2327
|
-
if (t instanceof
|
|
2361
|
+
if (t instanceof F) return t.value;
|
|
2328
2362
|
if (t instanceof w) return new TextDecoder("utf-8", { fatal: !0 }).decode(t.value);
|
|
2329
2363
|
throw SyntaxError("dt<<...>>: expected a text string or byte string");
|
|
2330
2364
|
}
|
|
2331
|
-
function
|
|
2365
|
+
function R(e) {
|
|
2332
2366
|
let t = e.match(/^(.+T\d{2}:\d{2}:\d{2})(\.\d+)(Z|[+-]\d{2}:\d{2})$/i), n, r;
|
|
2333
2367
|
t ? (n = t[1] + t[3], r = parseFloat("0" + t[2])) : (n = e, r = void 0);
|
|
2334
2368
|
let i = Date.parse(n);
|
|
2335
2369
|
if (isNaN(i)) throw SyntaxError(`dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`);
|
|
2336
2370
|
if (r === void 0) {
|
|
2337
2371
|
let e = i / 1e3;
|
|
2338
|
-
return e >= 0 ? new
|
|
2372
|
+
return e >= 0 ? new mt(BigInt(e)) : new ht(BigInt(e));
|
|
2339
2373
|
}
|
|
2340
|
-
return new
|
|
2374
|
+
return new gt(i / 1e3 + r);
|
|
2341
2375
|
}
|
|
2342
|
-
var
|
|
2376
|
+
var pt = 1n, mt = class extends g {
|
|
2343
2377
|
constructor(e, t) {
|
|
2344
2378
|
super(e, t);
|
|
2345
2379
|
}
|
|
2346
2380
|
_toEDN(e, t) {
|
|
2347
|
-
return e?.appStrings === !1 ? super._toEDN(e, t) : `dt'${
|
|
2381
|
+
return e?.appStrings === !1 ? super._toEDN(e, t) : `dt'${L(Number(this.value))}'`;
|
|
2348
2382
|
}
|
|
2349
|
-
},
|
|
2383
|
+
}, ht = class extends _ {
|
|
2350
2384
|
constructor(e, t) {
|
|
2351
2385
|
super(e, t);
|
|
2352
2386
|
}
|
|
2353
2387
|
_toEDN(e, t) {
|
|
2354
|
-
return e?.appStrings === !1 ? super._toEDN(e, t) : `dt'${
|
|
2388
|
+
return e?.appStrings === !1 ? super._toEDN(e, t) : `dt'${L(Number(this.value))}'`;
|
|
2355
2389
|
}
|
|
2356
|
-
},
|
|
2390
|
+
}, gt = class extends S {
|
|
2357
2391
|
constructor(e, t) {
|
|
2358
2392
|
super(e, t);
|
|
2359
2393
|
}
|
|
2360
2394
|
_toEDN(e, t) {
|
|
2361
|
-
return e?.appStrings === !1 ? super._toEDN(e, t) : `dt'${
|
|
2395
|
+
return e?.appStrings === !1 ? super._toEDN(e, t) : `dt'${L(this.value)}'`;
|
|
2362
2396
|
}
|
|
2363
|
-
},
|
|
2397
|
+
}, _t = class extends C {
|
|
2364
2398
|
constructor(e, t) {
|
|
2365
|
-
super(
|
|
2399
|
+
super(pt, R(e), t);
|
|
2366
2400
|
}
|
|
2367
2401
|
_toEDN(e, t) {
|
|
2368
2402
|
if (e?.appStrings === !1) return super._toEDN(e, t);
|
|
2369
2403
|
let n = this.content;
|
|
2370
|
-
return `DT'${
|
|
2404
|
+
return `DT'${L(n instanceof S ? n.value : Number(n.value))}'`;
|
|
2371
2405
|
}
|
|
2372
|
-
},
|
|
2406
|
+
}, vt = class extends _t {
|
|
2373
2407
|
constructor(e, t) {
|
|
2374
2408
|
super(e, t);
|
|
2375
2409
|
}
|
|
@@ -2378,39 +2412,39 @@ var gt = 1n, _t = class extends y {
|
|
|
2378
2412
|
return new Date(n);
|
|
2379
2413
|
}
|
|
2380
2414
|
};
|
|
2381
|
-
function
|
|
2415
|
+
function yt(e) {
|
|
2382
2416
|
let t = e?.jsDate ?? !1;
|
|
2383
2417
|
function n(e) {
|
|
2384
|
-
return t ? new
|
|
2418
|
+
return t ? new vt(e) : new _t(e);
|
|
2385
2419
|
}
|
|
2386
2420
|
let r = {
|
|
2387
2421
|
appStringPrefixes: ["dt", "DT"],
|
|
2388
|
-
tagNumbers: [
|
|
2422
|
+
tagNumbers: [pt],
|
|
2389
2423
|
parseAppString(e, t) {
|
|
2390
|
-
return e === "DT" ? n(t) :
|
|
2424
|
+
return e === "DT" ? n(t) : R(t);
|
|
2391
2425
|
},
|
|
2392
2426
|
parseAppSequence(e, t) {
|
|
2393
|
-
let r =
|
|
2394
|
-
return e === "DT" ? n(r) :
|
|
2427
|
+
let r = ft(t);
|
|
2428
|
+
return e === "DT" ? n(r) : R(r);
|
|
2395
2429
|
},
|
|
2396
2430
|
parseTag(e, t) {
|
|
2397
2431
|
if (e !== 1n) return;
|
|
2398
2432
|
let r;
|
|
2399
|
-
if (t instanceof
|
|
2400
|
-
else if (t instanceof
|
|
2433
|
+
if (t instanceof g) r = Number(t.value);
|
|
2434
|
+
else if (t instanceof _) r = Number(t.value);
|
|
2401
2435
|
else if (t instanceof S) r = t.value;
|
|
2402
2436
|
else return;
|
|
2403
|
-
return n(
|
|
2437
|
+
return n(L(r));
|
|
2404
2438
|
}
|
|
2405
2439
|
};
|
|
2406
2440
|
return t && (r.fromJS = (e, t) => {
|
|
2407
|
-
if (e instanceof Date) return new
|
|
2441
|
+
if (e instanceof Date) return new vt(L(e.getTime() / 1e3));
|
|
2408
2442
|
}, r.isJSType = (e) => e instanceof Date), r;
|
|
2409
2443
|
}
|
|
2410
|
-
var
|
|
2444
|
+
var bt = yt(), xt = yt({ jsDate: !0 });
|
|
2411
2445
|
//#endregion
|
|
2412
2446
|
//#region src/utils/ip.ts
|
|
2413
|
-
function
|
|
2447
|
+
function St(e) {
|
|
2414
2448
|
let t = e.split(".");
|
|
2415
2449
|
if (t.length !== 4) throw SyntaxError(`ip: invalid IPv4 address: ${JSON.stringify(e)}`);
|
|
2416
2450
|
let n = new Uint8Array(4);
|
|
@@ -2423,11 +2457,11 @@ function Tt(e) {
|
|
|
2423
2457
|
}
|
|
2424
2458
|
return n;
|
|
2425
2459
|
}
|
|
2426
|
-
function
|
|
2460
|
+
function Ct(e) {
|
|
2427
2461
|
let t = new Uint8Array(16);
|
|
2428
2462
|
if (e === "::") return t;
|
|
2429
2463
|
let n = e, r = null, i = e.match(/^(.*):(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);
|
|
2430
|
-
i && (n = i[1], n.endsWith(":") && (n += ":"), r =
|
|
2464
|
+
i && (n = i[1], n.endsWith(":") && (n += ":"), r = St(i[2]));
|
|
2431
2465
|
let a = n.split("::");
|
|
2432
2466
|
if (a.length > 2) throw SyntaxError(`ip: invalid IPv6 address: ${JSON.stringify(e)}`);
|
|
2433
2467
|
let o = a.length === 2, s = a[0] ? a[0].split(":") : [], c = o && a[1] ? a[1].split(":") : [], l = r ? 6 : 8;
|
|
@@ -2444,11 +2478,11 @@ function Et(e) {
|
|
|
2444
2478
|
}
|
|
2445
2479
|
return r && t.set(r, 12), t;
|
|
2446
2480
|
}
|
|
2447
|
-
function
|
|
2481
|
+
function wt(e) {
|
|
2448
2482
|
return Array.from(e).join(".");
|
|
2449
2483
|
}
|
|
2450
|
-
function
|
|
2451
|
-
let t = e.slice(0, 10).every((e) => e === 0) && e[10] === 255 && e[11] === 255 ?
|
|
2484
|
+
function Tt(e) {
|
|
2485
|
+
let t = e.slice(0, 10).every((e) => e === 0) && e[10] === 255 && e[11] === 255 ? wt(e.slice(12)) : null, n = t ? 6 : 8, r = [];
|
|
2452
2486
|
for (let t = 0; t < n * 2; t += 2) r.push(e[t] << 8 | e[t + 1]);
|
|
2453
2487
|
let i = -1, a = 0, o = 0;
|
|
2454
2488
|
for (; o < n;) if (r[o] === 0) {
|
|
@@ -2462,29 +2496,29 @@ function Ot(e) {
|
|
|
2462
2496
|
}
|
|
2463
2497
|
//#endregion
|
|
2464
2498
|
//#region src/extensions/ip.ts
|
|
2465
|
-
var
|
|
2466
|
-
function
|
|
2499
|
+
var Et = "ip", z = "IP", B = 52n, V = 54n;
|
|
2500
|
+
function Dt(e) {
|
|
2467
2501
|
if (e.length !== 1) throw SyntaxError("ip<<...>>: expected exactly one item");
|
|
2468
2502
|
let t = e[0];
|
|
2469
|
-
if (t instanceof
|
|
2503
|
+
if (t instanceof F) return t.value;
|
|
2470
2504
|
if (t instanceof w) return new TextDecoder("utf-8", { fatal: !0 }).decode(t.value);
|
|
2471
2505
|
throw SyntaxError("ip<<...>>: expected a text string or byte string");
|
|
2472
2506
|
}
|
|
2473
|
-
function
|
|
2507
|
+
function Ot(e) {
|
|
2474
2508
|
return /^\d/.test(e) && e.includes(".") && !e.includes(":") ? {
|
|
2475
|
-
bytes:
|
|
2509
|
+
bytes: St(e),
|
|
2476
2510
|
isV4: !0
|
|
2477
2511
|
} : {
|
|
2478
|
-
bytes:
|
|
2512
|
+
bytes: Ct(e),
|
|
2479
2513
|
isV4: !1
|
|
2480
2514
|
};
|
|
2481
2515
|
}
|
|
2482
|
-
function
|
|
2483
|
-
if (e.length === 4) return
|
|
2484
|
-
if (e.length === 16) return
|
|
2516
|
+
function H(e) {
|
|
2517
|
+
if (e.length === 4) return wt(e);
|
|
2518
|
+
if (e.length === 16) return Tt(e);
|
|
2485
2519
|
throw SyntaxError(`ip: unexpected byte length: ${e.length}`);
|
|
2486
2520
|
}
|
|
2487
|
-
function
|
|
2521
|
+
function kt(e, t) {
|
|
2488
2522
|
let n = new Uint8Array(e.length);
|
|
2489
2523
|
n.set(e);
|
|
2490
2524
|
let r = Math.floor(t / 8), i = t % 8;
|
|
@@ -2494,79 +2528,79 @@ function It(e, t) {
|
|
|
2494
2528
|
for (; a > 0 && n[a - 1] === 0;) a--;
|
|
2495
2529
|
return n.slice(0, a);
|
|
2496
2530
|
}
|
|
2497
|
-
function
|
|
2531
|
+
function At(e, t) {
|
|
2498
2532
|
let n = new Uint8Array(t);
|
|
2499
2533
|
return n.set(e), n;
|
|
2500
2534
|
}
|
|
2501
|
-
var
|
|
2535
|
+
var jt = class extends w {
|
|
2502
2536
|
_toEDN(e, t) {
|
|
2503
|
-
return e?.appStrings === !1 ? super._toEDN(e, t) : `${
|
|
2537
|
+
return e?.appStrings === !1 ? super._toEDN(e, t) : `${Et}'${H(this.value)}'`;
|
|
2504
2538
|
}
|
|
2505
|
-
},
|
|
2539
|
+
}, Mt = class extends D {
|
|
2506
2540
|
_isV4;
|
|
2507
2541
|
constructor(e, t, n) {
|
|
2508
|
-
super([new
|
|
2542
|
+
super([new g(BigInt(e)), new w(t)]), this._isV4 = n;
|
|
2509
2543
|
}
|
|
2510
2544
|
_toEDN(e, t) {
|
|
2511
2545
|
if (e?.appStrings === !1) return super._toEDN(e, t);
|
|
2512
2546
|
let n = Number(this.items[0].value), r = this.items[1].value;
|
|
2513
|
-
return `${
|
|
2547
|
+
return `${Et}'${H(At(r, this._isV4 ? 4 : 16))}/${n}'`;
|
|
2514
2548
|
}
|
|
2515
|
-
},
|
|
2549
|
+
}, U = class extends C {
|
|
2516
2550
|
constructor(e, t) {
|
|
2517
2551
|
super(e, t);
|
|
2518
2552
|
}
|
|
2519
2553
|
_toEDN(e, t) {
|
|
2520
2554
|
if (e?.appStrings === !1) return super._toEDN(e, t);
|
|
2521
|
-
let n = this.tag ===
|
|
2522
|
-
if (r instanceof w) return `${
|
|
2523
|
-
if (r instanceof
|
|
2555
|
+
let n = this.tag === B ? 4 : 16, r = this.content;
|
|
2556
|
+
if (r instanceof w) return `${z}'${H(r.value)}'`;
|
|
2557
|
+
if (r instanceof D && r.items.length === 2 && r.items[0] instanceof g && r.items[1] instanceof w) {
|
|
2524
2558
|
let e = Number(r.items[0].value);
|
|
2525
|
-
return `${
|
|
2559
|
+
return `${z}'${H(At(r.items[1].value, n))}/${e}'`;
|
|
2526
2560
|
}
|
|
2527
2561
|
return super._toEDN(e, t);
|
|
2528
2562
|
}
|
|
2529
2563
|
};
|
|
2530
|
-
function
|
|
2564
|
+
function Nt(e, t) {
|
|
2531
2565
|
let n = t.indexOf("/");
|
|
2532
2566
|
if (n === -1) {
|
|
2533
|
-
let { bytes: n, isV4: r } =
|
|
2534
|
-
return e ===
|
|
2567
|
+
let { bytes: n, isV4: r } = Ot(t);
|
|
2568
|
+
return e === z ? new U(r ? B : V, new w(n)) : new jt(n);
|
|
2535
2569
|
}
|
|
2536
2570
|
let r = t.slice(0, n), i = t.slice(n + 1);
|
|
2537
2571
|
if (!/^\d+$/.test(i)) throw SyntaxError(`ip: invalid prefix length: ${JSON.stringify(i)}`);
|
|
2538
|
-
let a = parseInt(i, 10), { bytes: o, isV4: s } =
|
|
2572
|
+
let a = parseInt(i, 10), { bytes: o, isV4: s } = Ot(r), c = s ? 32 : 128;
|
|
2539
2573
|
if (a > c) throw SyntaxError(`ip: prefix length ${a} exceeds maximum ${c} for ${s ? "IPv4" : "IPv6"}`);
|
|
2540
|
-
let l =
|
|
2541
|
-
return e ===
|
|
2574
|
+
let l = kt(o, a);
|
|
2575
|
+
return e === z ? new U(s ? B : V, new D([new g(BigInt(a)), new w(l)])) : new Mt(a, l, s);
|
|
2542
2576
|
}
|
|
2543
|
-
var
|
|
2544
|
-
appStringPrefixes: [
|
|
2545
|
-
tagNumbers: [
|
|
2577
|
+
var Pt = {
|
|
2578
|
+
appStringPrefixes: [Et, z],
|
|
2579
|
+
tagNumbers: [B, V],
|
|
2546
2580
|
parseAppString(e, t) {
|
|
2547
|
-
return
|
|
2581
|
+
return Nt(e, t);
|
|
2548
2582
|
},
|
|
2549
2583
|
parseAppSequence(e, t) {
|
|
2550
|
-
return
|
|
2584
|
+
return Nt(e, Dt(t));
|
|
2551
2585
|
},
|
|
2552
2586
|
parseTag(e, t) {
|
|
2553
|
-
if (!(e !==
|
|
2587
|
+
if (!(e !== B && e !== V) && (t instanceof w || t instanceof D)) return new U(e, t);
|
|
2554
2588
|
}
|
|
2555
|
-
},
|
|
2556
|
-
tagNumbers: [
|
|
2589
|
+
}, Ft = 18446744073709551615n, It = -(Ft + 1n), Lt = {
|
|
2590
|
+
tagNumbers: [Ie, Le],
|
|
2557
2591
|
parseTag(e, t) {
|
|
2558
2592
|
if (t instanceof w) {
|
|
2559
2593
|
if (e === 2n) {
|
|
2560
|
-
let e =
|
|
2561
|
-
return e >
|
|
2594
|
+
let e = Ve(t.value);
|
|
2595
|
+
return e > Ft ? new M(e) : void 0;
|
|
2562
2596
|
}
|
|
2563
2597
|
if (e === 3n) {
|
|
2564
|
-
let e = -1n -
|
|
2565
|
-
return e <
|
|
2598
|
+
let e = -1n - Ve(t.value);
|
|
2599
|
+
return e < It ? new N(e) : void 0;
|
|
2566
2600
|
}
|
|
2567
2601
|
}
|
|
2568
2602
|
}
|
|
2569
|
-
},
|
|
2603
|
+
}, Rt = "cri", zt = "CRI", Bt = 99n, Vt = new Map([
|
|
2570
2604
|
["coap", -1n],
|
|
2571
2605
|
["coaps", -2n],
|
|
2572
2606
|
["http", -3n],
|
|
@@ -2577,46 +2611,46 @@ var Ht = {
|
|
|
2577
2611
|
["coaps+tcp", -8n],
|
|
2578
2612
|
["coap+ws", -25n],
|
|
2579
2613
|
["coaps+ws", -26n]
|
|
2580
|
-
]),
|
|
2581
|
-
function
|
|
2614
|
+
]), Ht = new Map([...Vt.entries()].map(([e, t]) => [t, e]));
|
|
2615
|
+
function W(e) {
|
|
2582
2616
|
try {
|
|
2583
2617
|
return decodeURIComponent(e);
|
|
2584
2618
|
} catch {
|
|
2585
2619
|
return e;
|
|
2586
2620
|
}
|
|
2587
2621
|
}
|
|
2588
|
-
function
|
|
2622
|
+
function Ut(e) {
|
|
2589
2623
|
return Array.from(new TextEncoder().encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
|
|
2590
2624
|
}
|
|
2591
|
-
function
|
|
2625
|
+
function G(e, t) {
|
|
2592
2626
|
let n = "";
|
|
2593
|
-
for (let r of e) n += t(r) ? r :
|
|
2627
|
+
for (let r of e) n += t(r) ? r : Ut(r);
|
|
2594
2628
|
return n;
|
|
2595
2629
|
}
|
|
2596
|
-
function
|
|
2630
|
+
function Wt(e) {
|
|
2597
2631
|
return /[A-Za-z0-9\-._~]/.test(e);
|
|
2598
2632
|
}
|
|
2599
|
-
function
|
|
2633
|
+
function Gt(e) {
|
|
2600
2634
|
return /[!$&'()*+,;=]/.test(e);
|
|
2601
2635
|
}
|
|
2602
|
-
function
|
|
2603
|
-
return
|
|
2636
|
+
function Kt(e) {
|
|
2637
|
+
return Wt(e) || Gt(e) || e === ":" || e === "@";
|
|
2604
2638
|
}
|
|
2605
|
-
function
|
|
2606
|
-
return (
|
|
2639
|
+
function qt(e) {
|
|
2640
|
+
return (Kt(e) || e === "/" || e === "?") && e !== "&";
|
|
2607
2641
|
}
|
|
2608
|
-
function
|
|
2609
|
-
return
|
|
2642
|
+
function Jt(e) {
|
|
2643
|
+
return Kt(e) || e === "/" || e === "?";
|
|
2610
2644
|
}
|
|
2611
|
-
function
|
|
2612
|
-
return
|
|
2645
|
+
function Yt(e) {
|
|
2646
|
+
return Wt(e) || Gt(e) || e === ":";
|
|
2613
2647
|
}
|
|
2614
|
-
function
|
|
2615
|
-
return
|
|
2648
|
+
function Xt(e) {
|
|
2649
|
+
return Wt(e) || Gt(e);
|
|
2616
2650
|
}
|
|
2617
|
-
function
|
|
2651
|
+
function Zt(e) {
|
|
2618
2652
|
let t = [], n = e, r = n.indexOf("@");
|
|
2619
|
-
r >= 0 && (t.push(
|
|
2653
|
+
r >= 0 && (t.push(k.FALSE), t.push(new F(W(n.slice(0, r)))), n = n.slice(r + 1));
|
|
2620
2654
|
let i, a = null;
|
|
2621
2655
|
if (n.startsWith("[")) {
|
|
2622
2656
|
let e = n.indexOf("]");
|
|
@@ -2625,943 +2659,268 @@ function on(e) {
|
|
|
2625
2659
|
let r = n.slice(e + 1);
|
|
2626
2660
|
if (r.startsWith(":")) a = r.slice(1);
|
|
2627
2661
|
else if (r.length > 0) throw SyntaxError("cri: unexpected characters after ']' in authority");
|
|
2628
|
-
t.push(new w(
|
|
2662
|
+
t.push(new w(Ct(i)));
|
|
2629
2663
|
} else {
|
|
2630
2664
|
let e = n.lastIndexOf(":");
|
|
2631
|
-
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 w(
|
|
2632
|
-
else for (let e of i.toLowerCase().split(".")) t.push(new
|
|
2665
|
+
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 w(St(i)));
|
|
2666
|
+
else for (let e of i.toLowerCase().split(".")) t.push(new F(e));
|
|
2633
2667
|
}
|
|
2634
2668
|
if (a !== null && a !== "") {
|
|
2635
2669
|
if (!/^\d+$/.test(a)) throw SyntaxError(`cri: invalid port: ${JSON.stringify(a)}`);
|
|
2636
2670
|
let e = parseInt(a, 10);
|
|
2637
2671
|
if (e > 65535) throw SyntaxError(`cri: port ${e} out of range`);
|
|
2638
|
-
t.push(new
|
|
2672
|
+
t.push(new g(BigInt(e)));
|
|
2639
2673
|
}
|
|
2640
|
-
return new
|
|
2674
|
+
return new D(t);
|
|
2641
2675
|
}
|
|
2642
|
-
function
|
|
2676
|
+
function Qt(e) {
|
|
2643
2677
|
let t = e.items, n = 0, r = "";
|
|
2644
|
-
if (n < t.length && t[n] instanceof
|
|
2678
|
+
if (n < t.length && t[n] instanceof k && t[n].value === 20) {
|
|
2645
2679
|
n++;
|
|
2646
2680
|
let e = t[n++];
|
|
2647
|
-
r +=
|
|
2681
|
+
r += G(e.value, Yt) + "@";
|
|
2648
2682
|
}
|
|
2649
2683
|
if (n >= t.length) return r;
|
|
2650
2684
|
let i = t[n];
|
|
2651
2685
|
if (i instanceof w) {
|
|
2652
2686
|
n++;
|
|
2653
2687
|
let { length: e } = i.value;
|
|
2654
|
-
if (e === 4) r +=
|
|
2655
|
-
else if (e === 16) r += "[" +
|
|
2688
|
+
if (e === 4) r += wt(i.value);
|
|
2689
|
+
else if (e === 16) r += "[" + Tt(i.value) + "]";
|
|
2656
2690
|
else throw Error(`cri: unexpected host-ip byte length: ${e}`);
|
|
2657
|
-
n < t.length && t[n] instanceof
|
|
2691
|
+
n < t.length && t[n] instanceof F && (r += `%25${G(t[n++].value, Xt)}`);
|
|
2658
2692
|
} else {
|
|
2659
2693
|
let e = [];
|
|
2660
|
-
for (; n < t.length && t[n] instanceof
|
|
2694
|
+
for (; n < t.length && t[n] instanceof F;) e.push(G(t[n++].value, Xt));
|
|
2661
2695
|
r += e.join(".");
|
|
2662
2696
|
}
|
|
2663
|
-
return n < t.length && t[n] instanceof
|
|
2697
|
+
return n < t.length && t[n] instanceof g && (r += ":" + t[n].value.toString()), r;
|
|
2664
2698
|
}
|
|
2665
|
-
function
|
|
2699
|
+
function $t(e) {
|
|
2666
2700
|
let t = e.slice(2), n = t.indexOf("/"), r, i;
|
|
2667
|
-
return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new
|
|
2668
|
-
authority:
|
|
2701
|
+
return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new F(W(e)))) : (r = t, i = []), {
|
|
2702
|
+
authority: Zt(r),
|
|
2669
2703
|
pathSegments: i
|
|
2670
2704
|
};
|
|
2671
2705
|
}
|
|
2672
|
-
function
|
|
2706
|
+
function en(e) {
|
|
2673
2707
|
let t = e, n = null, r = t.indexOf("#");
|
|
2674
|
-
r >= 0 && (n =
|
|
2708
|
+
r >= 0 && (n = W(t.slice(r + 1)), t = t.slice(0, r));
|
|
2675
2709
|
let i = null, a = t.indexOf("?");
|
|
2676
2710
|
if (a >= 0) {
|
|
2677
2711
|
let e = t.slice(a + 1);
|
|
2678
|
-
t = t.slice(0, a), i = e.split("&").map((e) => new
|
|
2712
|
+
t = t.slice(0, a), i = e.split("&").map((e) => new F(W(e)));
|
|
2679
2713
|
}
|
|
2680
2714
|
let o = [], s = /^([a-zA-Z][a-zA-Z0-9+.\-]*):([\s\S]*)$/.exec(t);
|
|
2681
2715
|
if (s) {
|
|
2682
|
-
let e = s[1].toLowerCase(), t = s[2], n =
|
|
2683
|
-
if (o.push(n === void 0 ? new
|
|
2684
|
-
let { authority: e, pathSegments: n } =
|
|
2685
|
-
o.push(e, new
|
|
2716
|
+
let e = s[1].toLowerCase(), t = s[2], n = Vt.get(e);
|
|
2717
|
+
if (o.push(n === void 0 ? new F(e) : new _(n)), t.startsWith("//")) {
|
|
2718
|
+
let { authority: e, pathSegments: n } = $t(t);
|
|
2719
|
+
o.push(e, new D(n));
|
|
2686
2720
|
} else if (t.startsWith("/")) {
|
|
2687
|
-
let e = t.slice(1).split("/").map((e) => new
|
|
2688
|
-
o.push(
|
|
2721
|
+
let e = t.slice(1).split("/").map((e) => new F(W(e)));
|
|
2722
|
+
o.push(k.NULL, new D(e));
|
|
2689
2723
|
} else {
|
|
2690
|
-
let e = t.split("/").map((e) => new
|
|
2691
|
-
o.push(
|
|
2724
|
+
let e = t.split("/").map((e) => new F(W(e)));
|
|
2725
|
+
o.push(k.TRUE, new D(e));
|
|
2692
2726
|
}
|
|
2693
2727
|
} else if (t.startsWith("//")) {
|
|
2694
|
-
let { authority: e, pathSegments: n } =
|
|
2695
|
-
o.push(
|
|
2728
|
+
let { authority: e, pathSegments: n } = $t(t);
|
|
2729
|
+
o.push(k.FALSE, e, new D(n));
|
|
2696
2730
|
} else if (t.startsWith("/")) {
|
|
2697
|
-
let e = t.slice(1).split("/").map((e) => new
|
|
2698
|
-
o.push(
|
|
2699
|
-
} else if (t === "") o.push(new
|
|
2731
|
+
let e = t.slice(1).split("/").map((e) => new F(W(e)));
|
|
2732
|
+
o.push(k.TRUE, new D(e));
|
|
2733
|
+
} else if (t === "") o.push(new g(0n));
|
|
2700
2734
|
else {
|
|
2701
2735
|
let n = 1n, r = t, i = !1;
|
|
2702
2736
|
for (r.startsWith("./") && (i = !0, r = r.slice(2)); r.startsWith("../");) n++, r = r.slice(3);
|
|
2703
2737
|
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)}`);
|
|
2704
|
-
let a = r === "" ? [] : r.split("/").map((e) => new
|
|
2705
|
-
o.push(new
|
|
2738
|
+
let a = r === "" ? [] : r.split("/").map((e) => new F(W(e)));
|
|
2739
|
+
o.push(new g(n), new D(a));
|
|
2706
2740
|
}
|
|
2707
|
-
if (i !== null && o.push(new
|
|
2741
|
+
if (i !== null && o.push(new D(i)), n !== null && (i === null && o.push(k.NULL), o.push(new F(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
|
|
2708
2742
|
let e = o[o.length - 1];
|
|
2709
|
-
e instanceof
|
|
2743
|
+
e instanceof D && e.items.length === 0 && o.pop();
|
|
2710
2744
|
}
|
|
2711
|
-
return o.length === 1 && o[0] instanceof
|
|
2745
|
+
return o.length === 1 && o[0] instanceof g && o[0].value === 0n ? [] : o;
|
|
2712
2746
|
}
|
|
2713
|
-
function
|
|
2747
|
+
function K(e, t) {
|
|
2714
2748
|
let n = t, r = "";
|
|
2715
2749
|
if (n < e.length) {
|
|
2716
2750
|
let t = e[n];
|
|
2717
|
-
if (t instanceof
|
|
2751
|
+
if (t instanceof D) {
|
|
2718
2752
|
if (n++, t.items.length > 0) {
|
|
2719
2753
|
let e = t.items.map((e) => {
|
|
2720
|
-
if (!(e instanceof
|
|
2721
|
-
return
|
|
2754
|
+
if (!(e instanceof F)) throw Error("cri: query item must be a text string");
|
|
2755
|
+
return G(e.value, qt);
|
|
2722
2756
|
});
|
|
2723
2757
|
r += "?" + e.join("&");
|
|
2724
2758
|
}
|
|
2725
|
-
} else t instanceof
|
|
2759
|
+
} else t instanceof k && t.value === 22 && n++;
|
|
2726
2760
|
}
|
|
2727
|
-
return n < e.length && e[n] instanceof
|
|
2761
|
+
return n < e.length && e[n] instanceof F && (r += "#" + G(e[n].value, Jt)), r;
|
|
2728
2762
|
}
|
|
2729
|
-
function
|
|
2763
|
+
function q(e) {
|
|
2730
2764
|
return e.items.map((e) => {
|
|
2731
|
-
if (!(e instanceof
|
|
2732
|
-
return
|
|
2765
|
+
if (!(e instanceof F)) throw Error("cri: path segment must be a text string");
|
|
2766
|
+
return G(e.value, Kt);
|
|
2733
2767
|
});
|
|
2734
2768
|
}
|
|
2735
|
-
function
|
|
2769
|
+
function tn(e) {
|
|
2736
2770
|
if (e.length === 0) return "";
|
|
2737
2771
|
let t = 0, n = e[t++];
|
|
2738
|
-
if (n instanceof
|
|
2772
|
+
if (n instanceof _ || n instanceof F) {
|
|
2739
2773
|
let r;
|
|
2740
|
-
if (n instanceof
|
|
2741
|
-
let e =
|
|
2774
|
+
if (n instanceof _) {
|
|
2775
|
+
let e = Ht.get(n.value);
|
|
2742
2776
|
if (e === void 0) throw Error(`cri: unrecognised scheme-id ${n.value}`);
|
|
2743
2777
|
r = e + ":";
|
|
2744
2778
|
} else r = n.value + ":";
|
|
2745
2779
|
if (t >= e.length) return r;
|
|
2746
2780
|
let i = e[t++], a = "", o = !1;
|
|
2747
|
-
if (i instanceof
|
|
2748
|
-
else if (i instanceof
|
|
2781
|
+
if (i instanceof D) a = "//" + Qt(i), o = !0;
|
|
2782
|
+
else if (i instanceof k) if (i.value === 22) o = !0;
|
|
2749
2783
|
else if (i.value === 21) o = !1;
|
|
2750
2784
|
else throw Error(`cri: unexpected no-authority value: simple(${i.value})`);
|
|
2751
2785
|
else throw Error("cri: unexpected type for authority element");
|
|
2752
2786
|
let s = "";
|
|
2753
|
-
if (t < e.length && e[t] instanceof
|
|
2787
|
+
if (t < e.length && e[t] instanceof D) {
|
|
2754
2788
|
let n = e[t++];
|
|
2755
|
-
n.items.length > 0 && (s = (o ? "/" : "") +
|
|
2789
|
+
n.items.length > 0 && (s = (o ? "/" : "") + q(n).join("/"));
|
|
2756
2790
|
}
|
|
2757
|
-
return r + a + s +
|
|
2791
|
+
return r + a + s + K(e, t);
|
|
2758
2792
|
}
|
|
2759
|
-
if (n instanceof
|
|
2760
|
-
if (t >= e.length || !(e[t] instanceof
|
|
2761
|
-
let n =
|
|
2762
|
-
if (t < e.length && e[t] instanceof
|
|
2793
|
+
if (n instanceof k && n.value === 20) {
|
|
2794
|
+
if (t >= e.length || !(e[t] instanceof D)) throw Error("cri: network-path reference requires an authority array");
|
|
2795
|
+
let n = Qt(e[t++]), r = "";
|
|
2796
|
+
if (t < e.length && e[t] instanceof D) {
|
|
2763
2797
|
let n = e[t++];
|
|
2764
|
-
n.items.length > 0 && (r = "/" +
|
|
2798
|
+
n.items.length > 0 && (r = "/" + q(n).join("/"));
|
|
2765
2799
|
}
|
|
2766
|
-
return "//" + n + r +
|
|
2800
|
+
return "//" + n + r + K(e, t);
|
|
2767
2801
|
}
|
|
2768
|
-
if (n instanceof
|
|
2802
|
+
if (n instanceof k && n.value === 21) {
|
|
2769
2803
|
let n = "/";
|
|
2770
|
-
if (t < e.length && e[t] instanceof
|
|
2804
|
+
if (t < e.length && e[t] instanceof D) {
|
|
2771
2805
|
let r = e[t++];
|
|
2772
|
-
n = "/" +
|
|
2806
|
+
n = "/" + q(r).join("/");
|
|
2773
2807
|
}
|
|
2774
|
-
return n +
|
|
2808
|
+
return n + K(e, t);
|
|
2775
2809
|
}
|
|
2776
|
-
if (n instanceof
|
|
2810
|
+
if (n instanceof g) {
|
|
2777
2811
|
let r = n.value;
|
|
2778
|
-
if (r === 0n) return
|
|
2812
|
+
if (r === 0n) return K(e, t);
|
|
2779
2813
|
let i = r === 1n ? "" : "../".repeat(Number(r) - 1), a;
|
|
2780
|
-
if (t < e.length && e[t] instanceof
|
|
2814
|
+
if (t < e.length && e[t] instanceof D) {
|
|
2781
2815
|
let n = e[t++];
|
|
2782
2816
|
if (n.items.length > 0) {
|
|
2783
|
-
let e =
|
|
2817
|
+
let e = q(n);
|
|
2784
2818
|
a = (r === 1n && e[0].includes(":") ? "./" : i) + e.join("/");
|
|
2785
2819
|
} else a = i === "" ? "./" : i;
|
|
2786
2820
|
} else a = i === "" ? "./" : i;
|
|
2787
|
-
return a +
|
|
2821
|
+
return a + K(e, t);
|
|
2788
2822
|
}
|
|
2789
2823
|
throw Error("cri: unrecognised first element type in CRI array");
|
|
2790
2824
|
}
|
|
2791
|
-
var
|
|
2825
|
+
var nn = class extends D {
|
|
2792
2826
|
_toEDN(e, t) {
|
|
2793
2827
|
if (e?.appStrings === !1) return super._toEDN(e, t);
|
|
2794
2828
|
try {
|
|
2795
|
-
return `${
|
|
2829
|
+
return `${Rt}'${tn(this.items)}'`;
|
|
2796
2830
|
} catch {
|
|
2797
2831
|
return super._toEDN(e, t);
|
|
2798
2832
|
}
|
|
2799
2833
|
}
|
|
2800
|
-
},
|
|
2834
|
+
}, rn = class extends C {
|
|
2801
2835
|
constructor(e) {
|
|
2802
|
-
super(
|
|
2836
|
+
super(Bt, e);
|
|
2803
2837
|
}
|
|
2804
2838
|
_toEDN(e, t) {
|
|
2805
2839
|
if (e?.appStrings === !1) return super._toEDN(e, t);
|
|
2806
2840
|
try {
|
|
2807
|
-
return `${
|
|
2841
|
+
return `${zt}'${tn(this.content.items)}'`;
|
|
2808
2842
|
} catch {
|
|
2809
2843
|
return super._toEDN(e, t);
|
|
2810
2844
|
}
|
|
2811
2845
|
}
|
|
2812
2846
|
};
|
|
2813
|
-
function
|
|
2847
|
+
function an(e) {
|
|
2814
2848
|
if (e.length !== 1) throw SyntaxError("cri<<...>>: expected exactly one item");
|
|
2815
2849
|
let t = e[0];
|
|
2816
|
-
if (t instanceof
|
|
2850
|
+
if (t instanceof F) return t.value;
|
|
2817
2851
|
if (t instanceof w) return new TextDecoder("utf-8", { fatal: !0 }).decode(t.value);
|
|
2818
2852
|
throw SyntaxError("cri<<...>>: expected a text string or byte string");
|
|
2819
2853
|
}
|
|
2820
|
-
function
|
|
2821
|
-
let n = new
|
|
2822
|
-
return e ===
|
|
2854
|
+
function on(e, t) {
|
|
2855
|
+
let n = new nn(en(t));
|
|
2856
|
+
return e === zt ? new rn(n) : n;
|
|
2823
2857
|
}
|
|
2824
|
-
var
|
|
2825
|
-
appStringPrefixes: [
|
|
2826
|
-
tagNumbers: [
|
|
2858
|
+
var sn = {
|
|
2859
|
+
appStringPrefixes: [Rt, zt],
|
|
2860
|
+
tagNumbers: [Bt],
|
|
2827
2861
|
parseAppString(e, t) {
|
|
2828
|
-
return
|
|
2862
|
+
return on(e, t);
|
|
2829
2863
|
},
|
|
2830
2864
|
parseAppSequence(e, t) {
|
|
2831
|
-
return
|
|
2865
|
+
return on(e, an(t));
|
|
2832
2866
|
},
|
|
2833
2867
|
parseTag(e, t) {
|
|
2834
|
-
if (e === 99n && t instanceof
|
|
2868
|
+
if (e === 99n && t instanceof D) return new rn(new nn(t.items, {
|
|
2835
2869
|
indefiniteLength: t.indefiniteLength,
|
|
2836
2870
|
encodingWidth: t.encodingWidth
|
|
2837
2871
|
}));
|
|
2838
2872
|
}
|
|
2839
|
-
}
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
}
|
|
2845
|
-
function yn(e, t = "") {
|
|
2846
|
-
if (typeof e != "number") {
|
|
2847
|
-
let n = t && `"${t}" `;
|
|
2848
|
-
throw TypeError(`${n}expected number, got ${typeof e}`);
|
|
2849
|
-
}
|
|
2850
|
-
if (!Number.isSafeInteger(e) || e < 0) {
|
|
2851
|
-
let n = t && `"${t}" `;
|
|
2852
|
-
throw RangeError(`${n}expected integer >= 0, got ${e}`);
|
|
2853
|
-
}
|
|
2854
|
-
}
|
|
2855
|
-
function bn(e, t, n = "") {
|
|
2856
|
-
let r = vn(e), i = e?.length, a = t !== void 0;
|
|
2857
|
-
if (!r || a && i !== t) {
|
|
2858
|
-
let o = n && `"${n}" `, s = a ? ` of length ${t}` : "", c = r ? `length=${i}` : `type=${typeof e}`, l = o + "expected Uint8Array" + s + ", got " + c;
|
|
2859
|
-
throw r ? RangeError(l) : TypeError(l);
|
|
2860
|
-
}
|
|
2861
|
-
return e;
|
|
2862
|
-
}
|
|
2863
|
-
function xn(e, t = !0) {
|
|
2864
|
-
if (e.destroyed) throw Error("Hash instance has been destroyed");
|
|
2865
|
-
if (t && e.finished) throw Error("Hash#digest() has already been called");
|
|
2866
|
-
}
|
|
2867
|
-
function Sn(e, t) {
|
|
2868
|
-
bn(e, void 0, "digestInto() output");
|
|
2869
|
-
let n = t.outputLen;
|
|
2870
|
-
if (e.length < n) throw RangeError("\"digestInto() output\" expected to be of length >=" + n);
|
|
2871
|
-
}
|
|
2872
|
-
function Cn(e) {
|
|
2873
|
-
return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
|
|
2874
|
-
}
|
|
2875
|
-
function P(...e) {
|
|
2876
|
-
for (let t = 0; t < e.length; t++) e[t].fill(0);
|
|
2877
|
-
}
|
|
2878
|
-
function wn(e) {
|
|
2879
|
-
return new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
2880
|
-
}
|
|
2881
|
-
function F(e, t) {
|
|
2882
|
-
return e << 32 - t | e >>> t;
|
|
2883
|
-
}
|
|
2884
|
-
function Tn(e, t) {
|
|
2885
|
-
return e << t | e >>> 32 - t >>> 0;
|
|
2886
|
-
}
|
|
2887
|
-
var En = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
2888
|
-
function Dn(e) {
|
|
2889
|
-
return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
2890
|
-
}
|
|
2891
|
-
function On(e) {
|
|
2892
|
-
for (let t = 0; t < e.length; t++) e[t] = Dn(e[t]);
|
|
2893
|
-
return e;
|
|
2894
|
-
}
|
|
2895
|
-
var kn = En ? (e) => e : On;
|
|
2896
|
-
typeof Uint8Array.from([]).toHex == "function" && Uint8Array.fromHex;
|
|
2897
|
-
function I(e, t = {}) {
|
|
2898
|
-
let n = (t, n) => e(n).update(t).digest(), r = e(void 0);
|
|
2899
|
-
return n.outputLen = r.outputLen, n.blockLen = r.blockLen, n.canXOF = r.canXOF, n.create = (t) => e(t), Object.assign(n, t), Object.freeze(n);
|
|
2900
|
-
}
|
|
2901
|
-
var L = (e) => ({ oid: Uint8Array.from([
|
|
2902
|
-
6,
|
|
2903
|
-
9,
|
|
2904
|
-
96,
|
|
2905
|
-
134,
|
|
2906
|
-
72,
|
|
2907
|
-
1,
|
|
2908
|
-
101,
|
|
2909
|
-
3,
|
|
2910
|
-
4,
|
|
2911
|
-
2,
|
|
2912
|
-
e
|
|
2913
|
-
]) });
|
|
2914
|
-
//#endregion
|
|
2915
|
-
//#region node_modules/@noble/hashes/_md.js
|
|
2916
|
-
function An(e, t, n) {
|
|
2917
|
-
return e & t ^ ~e & n;
|
|
2918
|
-
}
|
|
2919
|
-
function jn(e, t, n) {
|
|
2920
|
-
return e & t ^ e & n ^ t & n;
|
|
2921
|
-
}
|
|
2922
|
-
var Mn = class {
|
|
2923
|
-
blockLen;
|
|
2924
|
-
outputLen;
|
|
2925
|
-
canXOF = !1;
|
|
2926
|
-
padOffset;
|
|
2927
|
-
isLE;
|
|
2928
|
-
buffer;
|
|
2929
|
-
view;
|
|
2930
|
-
finished = !1;
|
|
2931
|
-
length = 0;
|
|
2932
|
-
pos = 0;
|
|
2933
|
-
destroyed = !1;
|
|
2934
|
-
constructor(e, t, n, r) {
|
|
2935
|
-
this.blockLen = e, this.outputLen = t, this.padOffset = n, this.isLE = r, this.buffer = new Uint8Array(e), this.view = wn(this.buffer);
|
|
2936
|
-
}
|
|
2937
|
-
update(e) {
|
|
2938
|
-
xn(this), bn(e);
|
|
2939
|
-
let { view: t, buffer: n, blockLen: r } = this, i = e.length;
|
|
2940
|
-
for (let a = 0; a < i;) {
|
|
2941
|
-
let o = Math.min(r - this.pos, i - a);
|
|
2942
|
-
if (o === r) {
|
|
2943
|
-
let t = wn(e);
|
|
2944
|
-
for (; r <= i - a; a += r) this.process(t, a);
|
|
2945
|
-
continue;
|
|
2946
|
-
}
|
|
2947
|
-
n.set(e.subarray(a, a + o), this.pos), this.pos += o, a += o, this.pos === r && (this.process(t, 0), this.pos = 0);
|
|
2948
|
-
}
|
|
2949
|
-
return this.length += e.length, this.roundClean(), this;
|
|
2950
|
-
}
|
|
2951
|
-
digestInto(e) {
|
|
2952
|
-
xn(this), Sn(e, this), this.finished = !0;
|
|
2953
|
-
let { buffer: t, view: n, blockLen: r, isLE: i } = this, { pos: a } = this;
|
|
2954
|
-
t[a++] = 128, P(this.buffer.subarray(a)), this.padOffset > r - a && (this.process(n, 0), a = 0);
|
|
2955
|
-
for (let e = a; e < r; e++) t[e] = 0;
|
|
2956
|
-
n.setBigUint64(r - 8, BigInt(this.length * 8), i), this.process(n, 0);
|
|
2957
|
-
let o = wn(e), s = this.outputLen;
|
|
2958
|
-
if (s % 4) throw Error("_sha2: outputLen must be aligned to 32bit");
|
|
2959
|
-
let c = s / 4, l = this.get();
|
|
2960
|
-
if (c > l.length) throw Error("_sha2: outputLen bigger than state");
|
|
2961
|
-
for (let e = 0; e < c; e++) o.setUint32(4 * e, l[e], i);
|
|
2962
|
-
}
|
|
2963
|
-
digest() {
|
|
2964
|
-
let { buffer: e, outputLen: t } = this;
|
|
2965
|
-
this.digestInto(e);
|
|
2966
|
-
let n = e.slice(0, t);
|
|
2967
|
-
return this.destroy(), n;
|
|
2968
|
-
}
|
|
2969
|
-
_cloneInto(e) {
|
|
2970
|
-
e ||= new this.constructor(), e.set(...this.get());
|
|
2971
|
-
let { blockLen: t, buffer: n, length: r, finished: i, destroyed: a, pos: o } = this;
|
|
2972
|
-
return e.destroyed = a, e.finished = i, e.length = r, e.pos = o, r % t && e.buffer.set(n), e;
|
|
2973
|
-
}
|
|
2974
|
-
clone() {
|
|
2975
|
-
return this._cloneInto();
|
|
2976
|
-
}
|
|
2977
|
-
}, R = /* @__PURE__ */ Uint32Array.from([
|
|
2978
|
-
1779033703,
|
|
2979
|
-
3144134277,
|
|
2980
|
-
1013904242,
|
|
2981
|
-
2773480762,
|
|
2982
|
-
1359893119,
|
|
2983
|
-
2600822924,
|
|
2984
|
-
528734635,
|
|
2985
|
-
1541459225
|
|
2986
|
-
]), z = /* @__PURE__ */ Uint32Array.from([
|
|
2987
|
-
3418070365,
|
|
2988
|
-
3238371032,
|
|
2989
|
-
1654270250,
|
|
2990
|
-
914150663,
|
|
2991
|
-
2438529370,
|
|
2992
|
-
812702999,
|
|
2993
|
-
355462360,
|
|
2994
|
-
4144912697,
|
|
2995
|
-
1731405415,
|
|
2996
|
-
4290775857,
|
|
2997
|
-
2394180231,
|
|
2998
|
-
1750603025,
|
|
2999
|
-
3675008525,
|
|
3000
|
-
1694076839,
|
|
3001
|
-
1203062813,
|
|
3002
|
-
3204075428
|
|
3003
|
-
]), B = /* @__PURE__ */ Uint32Array.from([
|
|
3004
|
-
1779033703,
|
|
3005
|
-
4089235720,
|
|
3006
|
-
3144134277,
|
|
3007
|
-
2227873595,
|
|
3008
|
-
1013904242,
|
|
3009
|
-
4271175723,
|
|
3010
|
-
2773480762,
|
|
3011
|
-
1595750129,
|
|
3012
|
-
1359893119,
|
|
3013
|
-
2917565137,
|
|
3014
|
-
2600822924,
|
|
3015
|
-
725511199,
|
|
3016
|
-
528734635,
|
|
3017
|
-
4215389547,
|
|
3018
|
-
1541459225,
|
|
3019
|
-
327033209
|
|
3020
|
-
]), Nn = /* @__PURE__ */ BigInt(2 ** 32 - 1), Pn = /* @__PURE__ */ BigInt(32);
|
|
3021
|
-
function Fn(e, t = !1) {
|
|
3022
|
-
return t ? {
|
|
3023
|
-
h: Number(e & Nn),
|
|
3024
|
-
l: Number(e >> Pn & Nn)
|
|
3025
|
-
} : {
|
|
3026
|
-
h: Number(e >> Pn & Nn) | 0,
|
|
3027
|
-
l: Number(e & Nn) | 0
|
|
3028
|
-
};
|
|
3029
|
-
}
|
|
3030
|
-
function In(e, t = !1) {
|
|
3031
|
-
let n = e.length, r = new Uint32Array(n), i = new Uint32Array(n);
|
|
3032
|
-
for (let a = 0; a < n; a++) {
|
|
3033
|
-
let { h: n, l: o } = Fn(e[a], t);
|
|
3034
|
-
[r[a], i[a]] = [n, o];
|
|
3035
|
-
}
|
|
3036
|
-
return [r, i];
|
|
3037
|
-
}
|
|
3038
|
-
var Ln = (e, t, n) => e >>> n, Rn = (e, t, n) => e << 32 - n | t >>> n, V = (e, t, n) => e >>> n | t << 32 - n, H = (e, t, n) => e << 32 - n | t >>> n, zn = (e, t, n) => e << 64 - n | t >>> n - 32, Bn = (e, t, n) => e >>> n - 32 | t << 64 - n, Vn = (e, t, n) => e << n | t >>> 32 - n, Hn = (e, t, n) => t << n | e >>> 32 - n, Un = (e, t, n) => t << n - 32 | e >>> 64 - n, Wn = (e, t, n) => e << n - 32 | t >>> 64 - n;
|
|
3039
|
-
function U(e, t, n, r) {
|
|
3040
|
-
let i = (t >>> 0) + (r >>> 0);
|
|
3041
|
-
return {
|
|
3042
|
-
h: e + n + (i / 2 ** 32 | 0) | 0,
|
|
3043
|
-
l: i | 0
|
|
3044
|
-
};
|
|
3045
|
-
}
|
|
3046
|
-
var Gn = (e, t, n) => (e >>> 0) + (t >>> 0) + (n >>> 0), Kn = (e, t, n, r) => t + n + r + (e / 2 ** 32 | 0) | 0, qn = (e, t, n, r) => (e >>> 0) + (t >>> 0) + (n >>> 0) + (r >>> 0), Jn = (e, t, n, r, i) => t + n + r + i + (e / 2 ** 32 | 0) | 0, Yn = (e, t, n, r, i) => (e >>> 0) + (t >>> 0) + (n >>> 0) + (r >>> 0) + (i >>> 0), Xn = (e, t, n, r, i, a) => t + n + r + i + a + (e / 2 ** 32 | 0) | 0, Zn = /* @__PURE__ */ Uint32Array.from([
|
|
3047
|
-
1116352408,
|
|
3048
|
-
1899447441,
|
|
3049
|
-
3049323471,
|
|
3050
|
-
3921009573,
|
|
3051
|
-
961987163,
|
|
3052
|
-
1508970993,
|
|
3053
|
-
2453635748,
|
|
3054
|
-
2870763221,
|
|
3055
|
-
3624381080,
|
|
3056
|
-
310598401,
|
|
3057
|
-
607225278,
|
|
3058
|
-
1426881987,
|
|
3059
|
-
1925078388,
|
|
3060
|
-
2162078206,
|
|
3061
|
-
2614888103,
|
|
3062
|
-
3248222580,
|
|
3063
|
-
3835390401,
|
|
3064
|
-
4022224774,
|
|
3065
|
-
264347078,
|
|
3066
|
-
604807628,
|
|
3067
|
-
770255983,
|
|
3068
|
-
1249150122,
|
|
3069
|
-
1555081692,
|
|
3070
|
-
1996064986,
|
|
3071
|
-
2554220882,
|
|
3072
|
-
2821834349,
|
|
3073
|
-
2952996808,
|
|
3074
|
-
3210313671,
|
|
3075
|
-
3336571891,
|
|
3076
|
-
3584528711,
|
|
3077
|
-
113926993,
|
|
3078
|
-
338241895,
|
|
3079
|
-
666307205,
|
|
3080
|
-
773529912,
|
|
3081
|
-
1294757372,
|
|
3082
|
-
1396182291,
|
|
3083
|
-
1695183700,
|
|
3084
|
-
1986661051,
|
|
3085
|
-
2177026350,
|
|
3086
|
-
2456956037,
|
|
3087
|
-
2730485921,
|
|
3088
|
-
2820302411,
|
|
3089
|
-
3259730800,
|
|
3090
|
-
3345764771,
|
|
3091
|
-
3516065817,
|
|
3092
|
-
3600352804,
|
|
3093
|
-
4094571909,
|
|
3094
|
-
275423344,
|
|
3095
|
-
430227734,
|
|
3096
|
-
506948616,
|
|
3097
|
-
659060556,
|
|
3098
|
-
883997877,
|
|
3099
|
-
958139571,
|
|
3100
|
-
1322822218,
|
|
3101
|
-
1537002063,
|
|
3102
|
-
1747873779,
|
|
3103
|
-
1955562222,
|
|
3104
|
-
2024104815,
|
|
3105
|
-
2227730452,
|
|
3106
|
-
2361852424,
|
|
3107
|
-
2428436474,
|
|
3108
|
-
2756734187,
|
|
3109
|
-
3204031479,
|
|
3110
|
-
3329325298
|
|
3111
|
-
]), W = /* @__PURE__ */ new Uint32Array(64), Qn = class extends Mn {
|
|
3112
|
-
constructor(e) {
|
|
3113
|
-
super(64, e, 8, !1);
|
|
3114
|
-
}
|
|
3115
|
-
get() {
|
|
3116
|
-
let { A: e, B: t, C: n, D: r, E: i, F: a, G: o, H: s } = this;
|
|
3117
|
-
return [
|
|
3118
|
-
e,
|
|
3119
|
-
t,
|
|
3120
|
-
n,
|
|
3121
|
-
r,
|
|
3122
|
-
i,
|
|
3123
|
-
a,
|
|
3124
|
-
o,
|
|
3125
|
-
s
|
|
3126
|
-
];
|
|
3127
|
-
}
|
|
3128
|
-
set(e, t, n, r, i, a, o, s) {
|
|
3129
|
-
this.A = e | 0, this.B = t | 0, this.C = n | 0, this.D = r | 0, this.E = i | 0, this.F = a | 0, this.G = o | 0, this.H = s | 0;
|
|
3130
|
-
}
|
|
3131
|
-
process(e, t) {
|
|
3132
|
-
for (let n = 0; n < 16; n++, t += 4) W[n] = e.getUint32(t, !1);
|
|
3133
|
-
for (let e = 16; e < 64; e++) {
|
|
3134
|
-
let t = W[e - 15], n = W[e - 2], r = F(t, 7) ^ F(t, 18) ^ t >>> 3;
|
|
3135
|
-
W[e] = (F(n, 17) ^ F(n, 19) ^ n >>> 10) + W[e - 7] + r + W[e - 16] | 0;
|
|
3136
|
-
}
|
|
3137
|
-
let { A: n, B: r, C: i, D: a, E: o, F: s, G: c, H: l } = this;
|
|
3138
|
-
for (let e = 0; e < 64; e++) {
|
|
3139
|
-
let t = F(o, 6) ^ F(o, 11) ^ F(o, 25), u = l + t + An(o, s, c) + Zn[e] + W[e] | 0, d = (F(n, 2) ^ F(n, 13) ^ F(n, 22)) + jn(n, r, i) | 0;
|
|
3140
|
-
l = c, c = s, s = o, o = a + u | 0, a = i, i = r, r = n, n = u + d | 0;
|
|
3141
|
-
}
|
|
3142
|
-
n = n + this.A | 0, r = r + this.B | 0, i = i + this.C | 0, a = a + this.D | 0, o = o + this.E | 0, s = s + this.F | 0, c = c + this.G | 0, l = l + this.H | 0, this.set(n, r, i, a, o, s, c, l);
|
|
3143
|
-
}
|
|
3144
|
-
roundClean() {
|
|
3145
|
-
P(W);
|
|
3146
|
-
}
|
|
3147
|
-
destroy() {
|
|
3148
|
-
this.destroyed = !0, this.set(0, 0, 0, 0, 0, 0, 0, 0), P(this.buffer);
|
|
3149
|
-
}
|
|
3150
|
-
}, $n = class extends Qn {
|
|
3151
|
-
A = R[0] | 0;
|
|
3152
|
-
B = R[1] | 0;
|
|
3153
|
-
C = R[2] | 0;
|
|
3154
|
-
D = R[3] | 0;
|
|
3155
|
-
E = R[4] | 0;
|
|
3156
|
-
F = R[5] | 0;
|
|
3157
|
-
G = R[6] | 0;
|
|
3158
|
-
H = R[7] | 0;
|
|
3159
|
-
constructor() {
|
|
3160
|
-
super(32);
|
|
3161
|
-
}
|
|
3162
|
-
}, er = In((/* @__PURE__ */ "0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817".split(".")).map((e) => BigInt(e))), tr = er[0], nr = er[1], G = /* @__PURE__ */ new Uint32Array(80), K = /* @__PURE__ */ new Uint32Array(80), rr = class extends Mn {
|
|
3163
|
-
constructor(e) {
|
|
3164
|
-
super(128, e, 16, !1);
|
|
3165
|
-
}
|
|
3166
|
-
get() {
|
|
3167
|
-
let { Ah: e, Al: t, Bh: n, Bl: r, Ch: i, Cl: a, Dh: o, Dl: s, Eh: c, El: l, Fh: u, Fl: d, Gh: f, Gl: p, Hh: m, Hl: h } = this;
|
|
3168
|
-
return [
|
|
3169
|
-
e,
|
|
3170
|
-
t,
|
|
3171
|
-
n,
|
|
3172
|
-
r,
|
|
3173
|
-
i,
|
|
3174
|
-
a,
|
|
3175
|
-
o,
|
|
3176
|
-
s,
|
|
3177
|
-
c,
|
|
3178
|
-
l,
|
|
3179
|
-
u,
|
|
3180
|
-
d,
|
|
3181
|
-
f,
|
|
3182
|
-
p,
|
|
3183
|
-
m,
|
|
3184
|
-
h
|
|
3185
|
-
];
|
|
3186
|
-
}
|
|
3187
|
-
set(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
|
|
3188
|
-
this.Ah = e | 0, this.Al = t | 0, this.Bh = n | 0, this.Bl = r | 0, this.Ch = i | 0, this.Cl = a | 0, this.Dh = o | 0, this.Dl = s | 0, this.Eh = c | 0, this.El = l | 0, this.Fh = u | 0, this.Fl = d | 0, this.Gh = f | 0, this.Gl = p | 0, this.Hh = m | 0, this.Hl = h | 0;
|
|
3189
|
-
}
|
|
3190
|
-
process(e, t) {
|
|
3191
|
-
for (let n = 0; n < 16; n++, t += 4) G[n] = e.getUint32(t), K[n] = e.getUint32(t += 4);
|
|
3192
|
-
for (let e = 16; e < 80; e++) {
|
|
3193
|
-
let t = G[e - 15] | 0, n = K[e - 15] | 0, r = V(t, n, 1) ^ V(t, n, 8) ^ Ln(t, n, 7), i = H(t, n, 1) ^ H(t, n, 8) ^ Rn(t, n, 7), a = G[e - 2] | 0, o = K[e - 2] | 0, s = V(a, o, 19) ^ zn(a, o, 61) ^ Ln(a, o, 6), c = qn(i, H(a, o, 19) ^ Bn(a, o, 61) ^ Rn(a, o, 6), K[e - 7], K[e - 16]);
|
|
3194
|
-
G[e] = Jn(c, r, s, G[e - 7], G[e - 16]) | 0, K[e] = c | 0;
|
|
3195
|
-
}
|
|
3196
|
-
let { Ah: n, Al: r, Bh: i, Bl: a, Ch: o, Cl: s, Dh: c, Dl: l, Eh: u, El: d, Fh: f, Fl: p, Gh: m, Gl: h, Hh: g, Hl: _ } = this;
|
|
3197
|
-
for (let e = 0; e < 80; e++) {
|
|
3198
|
-
let t = V(u, d, 14) ^ V(u, d, 18) ^ zn(u, d, 41), v = H(u, d, 14) ^ H(u, d, 18) ^ Bn(u, d, 41), ee = u & f ^ ~u & m, te = d & p ^ ~d & h, ne = Yn(_, v, te, nr[e], K[e]), re = Xn(ne, g, t, ee, tr[e], G[e]), y = ne | 0, b = V(n, r, 28) ^ zn(n, r, 34) ^ zn(n, r, 39), ie = H(n, r, 28) ^ Bn(n, r, 34) ^ Bn(n, r, 39), x = n & i ^ n & o ^ i & o, ae = r & a ^ r & s ^ a & s;
|
|
3199
|
-
g = m | 0, _ = h | 0, m = f | 0, h = p | 0, f = u | 0, p = d | 0, {h: u, l: d} = U(c | 0, l | 0, re | 0, y | 0), c = o | 0, l = s | 0, o = i | 0, s = a | 0, i = n | 0, a = r | 0;
|
|
3200
|
-
let oe = Gn(y, ie, ae);
|
|
3201
|
-
n = Kn(oe, re, b, x), r = oe | 0;
|
|
3202
|
-
}
|
|
3203
|
-
({h: n, l: r} = U(this.Ah | 0, this.Al | 0, n | 0, r | 0)), {h: i, l: a} = U(this.Bh | 0, this.Bl | 0, i | 0, a | 0), {h: o, l: s} = U(this.Ch | 0, this.Cl | 0, o | 0, s | 0), {h: c, l: l} = U(this.Dh | 0, this.Dl | 0, c | 0, l | 0), {h: u, l: d} = U(this.Eh | 0, this.El | 0, u | 0, d | 0), {h: f, l: p} = U(this.Fh | 0, this.Fl | 0, f | 0, p | 0), {h: m, l: h} = U(this.Gh | 0, this.Gl | 0, m | 0, h | 0), {h: g, l: _} = U(this.Hh | 0, this.Hl | 0, g | 0, _ | 0), this.set(n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _);
|
|
3204
|
-
}
|
|
3205
|
-
roundClean() {
|
|
3206
|
-
P(G, K);
|
|
3207
|
-
}
|
|
3208
|
-
destroy() {
|
|
3209
|
-
this.destroyed = !0, P(this.buffer), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
3210
|
-
}
|
|
3211
|
-
}, ir = class extends rr {
|
|
3212
|
-
Ah = B[0] | 0;
|
|
3213
|
-
Al = B[1] | 0;
|
|
3214
|
-
Bh = B[2] | 0;
|
|
3215
|
-
Bl = B[3] | 0;
|
|
3216
|
-
Ch = B[4] | 0;
|
|
3217
|
-
Cl = B[5] | 0;
|
|
3218
|
-
Dh = B[6] | 0;
|
|
3219
|
-
Dl = B[7] | 0;
|
|
3220
|
-
Eh = B[8] | 0;
|
|
3221
|
-
El = B[9] | 0;
|
|
3222
|
-
Fh = B[10] | 0;
|
|
3223
|
-
Fl = B[11] | 0;
|
|
3224
|
-
Gh = B[12] | 0;
|
|
3225
|
-
Gl = B[13] | 0;
|
|
3226
|
-
Hh = B[14] | 0;
|
|
3227
|
-
Hl = B[15] | 0;
|
|
3228
|
-
constructor() {
|
|
3229
|
-
super(64);
|
|
3230
|
-
}
|
|
3231
|
-
}, ar = class extends rr {
|
|
3232
|
-
Ah = z[0] | 0;
|
|
3233
|
-
Al = z[1] | 0;
|
|
3234
|
-
Bh = z[2] | 0;
|
|
3235
|
-
Bl = z[3] | 0;
|
|
3236
|
-
Ch = z[4] | 0;
|
|
3237
|
-
Cl = z[5] | 0;
|
|
3238
|
-
Dh = z[6] | 0;
|
|
3239
|
-
Dl = z[7] | 0;
|
|
3240
|
-
Eh = z[8] | 0;
|
|
3241
|
-
El = z[9] | 0;
|
|
3242
|
-
Fh = z[10] | 0;
|
|
3243
|
-
Fl = z[11] | 0;
|
|
3244
|
-
Gh = z[12] | 0;
|
|
3245
|
-
Gl = z[13] | 0;
|
|
3246
|
-
Hh = z[14] | 0;
|
|
3247
|
-
Hl = z[15] | 0;
|
|
3248
|
-
constructor() {
|
|
3249
|
-
super(48);
|
|
3250
|
-
}
|
|
3251
|
-
}, q = /* @__PURE__ */ Uint32Array.from([
|
|
3252
|
-
573645204,
|
|
3253
|
-
4230739756,
|
|
3254
|
-
2673172387,
|
|
3255
|
-
3360449730,
|
|
3256
|
-
596883563,
|
|
3257
|
-
1867755857,
|
|
3258
|
-
2520282905,
|
|
3259
|
-
1497426621,
|
|
3260
|
-
2519219938,
|
|
3261
|
-
2827943907,
|
|
3262
|
-
3193839141,
|
|
3263
|
-
1401305490,
|
|
3264
|
-
721525244,
|
|
3265
|
-
746961066,
|
|
3266
|
-
246885852,
|
|
3267
|
-
2177182882
|
|
3268
|
-
]), or = class extends rr {
|
|
3269
|
-
Ah = q[0] | 0;
|
|
3270
|
-
Al = q[1] | 0;
|
|
3271
|
-
Bh = q[2] | 0;
|
|
3272
|
-
Bl = q[3] | 0;
|
|
3273
|
-
Ch = q[4] | 0;
|
|
3274
|
-
Cl = q[5] | 0;
|
|
3275
|
-
Dh = q[6] | 0;
|
|
3276
|
-
Dl = q[7] | 0;
|
|
3277
|
-
Eh = q[8] | 0;
|
|
3278
|
-
El = q[9] | 0;
|
|
3279
|
-
Fh = q[10] | 0;
|
|
3280
|
-
Fl = q[11] | 0;
|
|
3281
|
-
Gh = q[12] | 0;
|
|
3282
|
-
Gl = q[13] | 0;
|
|
3283
|
-
Hh = q[14] | 0;
|
|
3284
|
-
Hl = q[15] | 0;
|
|
3285
|
-
constructor() {
|
|
3286
|
-
super(32);
|
|
3287
|
-
}
|
|
3288
|
-
}, sr = /* @__PURE__ */ I(() => new $n(), /* @__PURE__ */ L(1)), cr = /* @__PURE__ */ I(() => new ir(), /* @__PURE__ */ L(3)), lr = /* @__PURE__ */ I(() => new ar(), /* @__PURE__ */ L(2)), ur = /* @__PURE__ */ I(() => new or(), /* @__PURE__ */ L(6)), dr = BigInt(0), fr = BigInt(1), pr = BigInt(2), mr = BigInt(7), hr = BigInt(256), gr = BigInt(113), _r = [], vr = [], yr = [];
|
|
3289
|
-
for (let e = 0, t = fr, n = 1, r = 0; e < 24; e++) {
|
|
3290
|
-
[n, r] = [r, (2 * n + 3 * r) % 5], _r.push(2 * (5 * r + n)), vr.push((e + 1) * (e + 2) / 2 % 64);
|
|
3291
|
-
let i = dr;
|
|
3292
|
-
for (let e = 0; e < 7; e++) t = (t << fr ^ (t >> mr) * gr) % hr, t & pr && (i ^= fr << (fr << BigInt(e)) - fr);
|
|
3293
|
-
yr.push(i);
|
|
3294
|
-
}
|
|
3295
|
-
var br = In(yr, !0), xr = br[0], Sr = br[1], Cr = (e, t, n) => n > 32 ? Un(e, t, n) : Vn(e, t, n), wr = (e, t, n) => n > 32 ? Wn(e, t, n) : Hn(e, t, n);
|
|
3296
|
-
function Tr(e, t = 24) {
|
|
3297
|
-
if (yn(t, "rounds"), t < 1 || t > 24) throw Error("\"rounds\" expected integer 1..24");
|
|
3298
|
-
let n = new Uint32Array(10);
|
|
3299
|
-
for (let r = 24 - t; r < 24; r++) {
|
|
3300
|
-
for (let t = 0; t < 10; t++) n[t] = e[t] ^ e[t + 10] ^ e[t + 20] ^ e[t + 30] ^ e[t + 40];
|
|
3301
|
-
for (let t = 0; t < 10; t += 2) {
|
|
3302
|
-
let r = (t + 8) % 10, i = (t + 2) % 10, a = n[i], o = n[i + 1], s = Cr(a, o, 1) ^ n[r], c = wr(a, o, 1) ^ n[r + 1];
|
|
3303
|
-
for (let n = 0; n < 50; n += 10) e[t + n] ^= s, e[t + n + 1] ^= c;
|
|
3304
|
-
}
|
|
3305
|
-
let t = e[2], i = e[3];
|
|
3306
|
-
for (let n = 0; n < 24; n++) {
|
|
3307
|
-
let r = vr[n], a = Cr(t, i, r), o = wr(t, i, r), s = _r[n];
|
|
3308
|
-
t = e[s], i = e[s + 1], e[s] = a, e[s + 1] = o;
|
|
3309
|
-
}
|
|
3310
|
-
for (let t = 0; t < 50; t += 10) {
|
|
3311
|
-
let n = e[t], r = e[t + 1], i = e[t + 2], a = e[t + 3];
|
|
3312
|
-
e[t] ^= ~e[t + 2] & e[t + 4], e[t + 1] ^= ~e[t + 3] & e[t + 5], e[t + 2] ^= ~e[t + 4] & e[t + 6], e[t + 3] ^= ~e[t + 5] & e[t + 7], e[t + 4] ^= ~e[t + 6] & e[t + 8], e[t + 5] ^= ~e[t + 7] & e[t + 9], e[t + 6] ^= ~e[t + 8] & n, e[t + 7] ^= ~e[t + 9] & r, e[t + 8] ^= ~n & i, e[t + 9] ^= ~r & a;
|
|
3313
|
-
}
|
|
3314
|
-
e[0] ^= xr[r], e[1] ^= Sr[r];
|
|
3315
|
-
}
|
|
3316
|
-
P(n);
|
|
3317
|
-
}
|
|
3318
|
-
var Er = class e {
|
|
3319
|
-
state;
|
|
3320
|
-
pos = 0;
|
|
3321
|
-
posOut = 0;
|
|
3322
|
-
finished = !1;
|
|
3323
|
-
state32;
|
|
3324
|
-
destroyed = !1;
|
|
3325
|
-
blockLen;
|
|
3326
|
-
suffix;
|
|
3327
|
-
outputLen;
|
|
3328
|
-
canXOF;
|
|
3329
|
-
enableXOF = !1;
|
|
3330
|
-
rounds;
|
|
3331
|
-
constructor(e, t, n, r = !1, i = 24) {
|
|
3332
|
-
if (this.blockLen = e, this.suffix = t, this.outputLen = n, this.enableXOF = r, this.canXOF = r, this.rounds = i, yn(n, "outputLen"), !(0 < e && e < 200)) throw Error("only keccak-f1600 function is supported");
|
|
3333
|
-
this.state = new Uint8Array(200), this.state32 = Cn(this.state);
|
|
3334
|
-
}
|
|
3335
|
-
clone() {
|
|
3336
|
-
return this._cloneInto();
|
|
3337
|
-
}
|
|
3338
|
-
keccak() {
|
|
3339
|
-
kn(this.state32), Tr(this.state32, this.rounds), kn(this.state32), this.posOut = 0, this.pos = 0;
|
|
3340
|
-
}
|
|
3341
|
-
update(e) {
|
|
3342
|
-
xn(this), bn(e);
|
|
3343
|
-
let { blockLen: t, state: n } = this, r = e.length;
|
|
3344
|
-
for (let i = 0; i < r;) {
|
|
3345
|
-
let a = Math.min(t - this.pos, r - i);
|
|
3346
|
-
for (let t = 0; t < a; t++) n[this.pos++] ^= e[i++];
|
|
3347
|
-
this.pos === t && this.keccak();
|
|
3348
|
-
}
|
|
3349
|
-
return this;
|
|
3350
|
-
}
|
|
3351
|
-
finish() {
|
|
3352
|
-
if (this.finished) return;
|
|
3353
|
-
this.finished = !0;
|
|
3354
|
-
let { state: e, suffix: t, pos: n, blockLen: r } = this;
|
|
3355
|
-
e[n] ^= t, t & 128 && n === r - 1 && this.keccak(), e[r - 1] ^= 128, this.keccak();
|
|
3356
|
-
}
|
|
3357
|
-
writeInto(e) {
|
|
3358
|
-
xn(this, !1), bn(e), this.finish();
|
|
3359
|
-
let t = this.state, { blockLen: n } = this;
|
|
3360
|
-
for (let r = 0, i = e.length; r < i;) {
|
|
3361
|
-
this.posOut >= n && this.keccak();
|
|
3362
|
-
let a = Math.min(n - this.posOut, i - r);
|
|
3363
|
-
e.set(t.subarray(this.posOut, this.posOut + a), r), this.posOut += a, r += a;
|
|
3364
|
-
}
|
|
3365
|
-
return e;
|
|
3366
|
-
}
|
|
3367
|
-
xofInto(e) {
|
|
3368
|
-
if (!this.enableXOF) throw Error("XOF is not possible for this instance");
|
|
3369
|
-
return this.writeInto(e);
|
|
3370
|
-
}
|
|
3371
|
-
xof(e) {
|
|
3372
|
-
return yn(e), this.xofInto(new Uint8Array(e));
|
|
3373
|
-
}
|
|
3374
|
-
digestInto(e) {
|
|
3375
|
-
if (Sn(e, this), this.finished) throw Error("digest() was already called");
|
|
3376
|
-
this.writeInto(e.subarray(0, this.outputLen)), this.destroy();
|
|
3377
|
-
}
|
|
3378
|
-
digest() {
|
|
3379
|
-
let e = new Uint8Array(this.outputLen);
|
|
3380
|
-
return this.digestInto(e), e;
|
|
3381
|
-
}
|
|
3382
|
-
destroy() {
|
|
3383
|
-
this.destroyed = !0, P(this.state);
|
|
3384
|
-
}
|
|
3385
|
-
_cloneInto(t) {
|
|
3386
|
-
let { blockLen: n, suffix: r, outputLen: i, rounds: a, enableXOF: o } = this;
|
|
3387
|
-
return t ||= new e(n, r, i, o, a), t.blockLen = n, t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = a, t.suffix = r, t.outputLen = i, t.enableXOF = o, t.canXOF = this.canXOF, t.destroyed = this.destroyed, t;
|
|
3388
|
-
}
|
|
3389
|
-
}, Dr = (e, t, n, r = {}) => I((r = {}) => new Er(t, e, r.dkLen === void 0 ? n : r.dkLen, !0), r), Or = /* @__PURE__ */ Dr(31, 168, 32, /* @__PURE__ */ L(11)), kr = /* @__PURE__ */ Dr(31, 136, 64, /* @__PURE__ */ L(12)), Ar = /* @__PURE__ */ Uint32Array.from([
|
|
3390
|
-
1732584193,
|
|
3391
|
-
4023233417,
|
|
3392
|
-
2562383102,
|
|
3393
|
-
271733878,
|
|
3394
|
-
3285377520
|
|
3395
|
-
]), J = /* @__PURE__ */ new Uint32Array(80), jr = class extends Mn {
|
|
3396
|
-
A = Ar[0] | 0;
|
|
3397
|
-
B = Ar[1] | 0;
|
|
3398
|
-
C = Ar[2] | 0;
|
|
3399
|
-
D = Ar[3] | 0;
|
|
3400
|
-
E = Ar[4] | 0;
|
|
3401
|
-
constructor() {
|
|
3402
|
-
super(64, 20, 8, !1);
|
|
3403
|
-
}
|
|
3404
|
-
get() {
|
|
3405
|
-
let { A: e, B: t, C: n, D: r, E: i } = this;
|
|
3406
|
-
return [
|
|
3407
|
-
e,
|
|
3408
|
-
t,
|
|
3409
|
-
n,
|
|
3410
|
-
r,
|
|
3411
|
-
i
|
|
3412
|
-
];
|
|
3413
|
-
}
|
|
3414
|
-
set(e, t, n, r, i) {
|
|
3415
|
-
this.A = e | 0, this.B = t | 0, this.C = n | 0, this.D = r | 0, this.E = i | 0;
|
|
3416
|
-
}
|
|
3417
|
-
process(e, t) {
|
|
3418
|
-
for (let n = 0; n < 16; n++, t += 4) J[n] = e.getUint32(t, !1);
|
|
3419
|
-
for (let e = 16; e < 80; e++) J[e] = Tn(J[e - 3] ^ J[e - 8] ^ J[e - 14] ^ J[e - 16], 1);
|
|
3420
|
-
let { A: n, B: r, C: i, D: a, E: o } = this;
|
|
3421
|
-
for (let e = 0; e < 80; e++) {
|
|
3422
|
-
let t, s;
|
|
3423
|
-
e < 20 ? (t = An(r, i, a), s = 1518500249) : e < 40 ? (t = r ^ i ^ a, s = 1859775393) : e < 60 ? (t = jn(r, i, a), s = 2400959708) : (t = r ^ i ^ a, s = 3395469782);
|
|
3424
|
-
let c = Tn(n, 5) + t + o + s + J[e] | 0;
|
|
3425
|
-
o = a, a = i, i = Tn(r, 30), r = n, n = c;
|
|
3426
|
-
}
|
|
3427
|
-
n = n + this.A | 0, r = r + this.B | 0, i = i + this.C | 0, a = a + this.D | 0, o = o + this.E | 0, this.set(n, r, i, a, o);
|
|
3428
|
-
}
|
|
3429
|
-
roundClean() {
|
|
3430
|
-
P(J);
|
|
3431
|
-
}
|
|
3432
|
-
destroy() {
|
|
3433
|
-
this.destroyed = !0, this.set(0, 0, 0, 0, 0), P(this.buffer);
|
|
3434
|
-
}
|
|
3435
|
-
}, Mr = /* @__PURE__ */ I(() => new jr()), Nr = /* @__PURE__ */ Uint8Array.from([
|
|
3436
|
-
7,
|
|
3437
|
-
4,
|
|
3438
|
-
13,
|
|
3439
|
-
1,
|
|
3440
|
-
10,
|
|
3441
|
-
6,
|
|
3442
|
-
15,
|
|
3443
|
-
3,
|
|
3444
|
-
12,
|
|
3445
|
-
0,
|
|
3446
|
-
9,
|
|
3447
|
-
5,
|
|
3448
|
-
2,
|
|
3449
|
-
14,
|
|
3450
|
-
11,
|
|
3451
|
-
8
|
|
3452
|
-
]), Pr = Uint8Array.from(Array(16).fill(0).map((e, t) => t)), Fr = Pr.map((e) => (9 * e + 5) % 16), Ir = /* @__PURE__ */ (() => {
|
|
3453
|
-
let e = [[Pr], [Fr]];
|
|
3454
|
-
for (let t = 0; t < 4; t++) for (let n of e) n.push(n[t].map((e) => Nr[e]));
|
|
3455
|
-
return e;
|
|
3456
|
-
})();
|
|
3457
|
-
Ir[0], Ir[1];
|
|
3458
|
-
//#endregion
|
|
3459
|
-
//#region src/extensions/hash.ts
|
|
3460
|
-
var Lr = new Map([
|
|
3461
|
-
[-14, Mr],
|
|
3462
|
-
[-15, (e) => sr(e).slice(0, 8)],
|
|
3463
|
-
[-16, sr],
|
|
3464
|
-
[-17, ur],
|
|
3465
|
-
[-18, Or],
|
|
3466
|
-
[-43, lr],
|
|
3467
|
-
[-44, cr],
|
|
3468
|
-
[-45, kr]
|
|
3469
|
-
]), Rr = new Map([
|
|
3470
|
-
["SHA-1", -14],
|
|
3471
|
-
["SHA-256/64", -15],
|
|
3472
|
-
["SHA-256", -16],
|
|
3473
|
-
["SHA-512/256", -17],
|
|
3474
|
-
["SHAKE128", -18],
|
|
3475
|
-
["SHA-384", -43],
|
|
3476
|
-
["SHA-512", -44],
|
|
3477
|
-
["SHAKE256", -45]
|
|
3478
|
-
]), zr = new Map([...Rr.entries()].map(([e, t]) => [t, e])), Br = class extends w {
|
|
3479
|
-
_input;
|
|
3480
|
-
_algorithmId;
|
|
3481
|
-
constructor(e, t, n) {
|
|
3482
|
-
super(e), this._input = t, this._algorithmId = n;
|
|
3483
|
-
}
|
|
3484
|
-
_toEDN(e, t) {
|
|
3485
|
-
if (e?.appStrings === !1) return super._toEDN(e, t);
|
|
3486
|
-
let n = this._algorithmId === -16;
|
|
3487
|
-
if (this._input instanceof A && n) return `hash${Ce(this._input.value)}`;
|
|
3488
|
-
let r = this._input instanceof A ? Ce(this._input.value) : ye(this._input.value, e?.bstrEncoding ?? "hex", e?.sqstr);
|
|
3489
|
-
return n ? `hash<<${r}>>` : `hash<<${r}, ${zr.has(this._algorithmId) ? `"${zr.get(this._algorithmId)}"` : String(this._algorithmId)}>>`;
|
|
3490
|
-
}
|
|
3491
|
-
};
|
|
3492
|
-
function Vr(e) {
|
|
3493
|
-
if (e instanceof y || e instanceof b) return Number(e.value);
|
|
3494
|
-
if (e instanceof A) {
|
|
3495
|
-
let t = Rr.get(e.value);
|
|
3496
|
-
if (t === void 0) throw SyntaxError(`hash: unknown algorithm name: ${JSON.stringify(e.value)}`);
|
|
3497
|
-
return t;
|
|
3498
|
-
}
|
|
3499
|
-
throw SyntaxError("hash: algorithm must be an integer or text string");
|
|
3500
|
-
}
|
|
3501
|
-
function Hr(e, t) {
|
|
3502
|
-
let n = e instanceof A ? new TextEncoder().encode(e.value) : e.value, r = Lr.get(t);
|
|
3503
|
-
if (!r) throw SyntaxError(`hash: unsupported COSE algorithm ID ${t}`);
|
|
3504
|
-
return new Br(r(n), e, t);
|
|
3505
|
-
}
|
|
3506
|
-
var Ur = {
|
|
3507
|
-
appStringPrefixes: ["hash"],
|
|
3508
|
-
parseAppString(e, t) {
|
|
3509
|
-
return Hr(new A(t), -16);
|
|
3510
|
-
},
|
|
3511
|
-
parseAppSequence(e, t) {
|
|
3512
|
-
if (t.length === 0 || t.length > 2) throw SyntaxError(`hash<<...>>: expected 1 or 2 items, got ${t.length}`);
|
|
3513
|
-
let n = t[0];
|
|
3514
|
-
if (!(n instanceof A) && !(n instanceof w)) throw SyntaxError("hash: first argument must be a text or byte string");
|
|
3515
|
-
return Hr(n, t.length === 2 ? Vr(t[1]) : -16);
|
|
3516
|
-
}
|
|
3517
|
-
}, Wr = new TextDecoder("utf-8", { fatal: !0 });
|
|
3518
|
-
function Y(e) {
|
|
2873
|
+
}, cn = new TextDecoder("utf-8", {
|
|
2874
|
+
fatal: !0,
|
|
2875
|
+
ignoreBOM: !0
|
|
2876
|
+
});
|
|
2877
|
+
function J(e) {
|
|
3519
2878
|
throw Error(`CBOR decode error: ${e}`);
|
|
3520
2879
|
}
|
|
3521
|
-
function
|
|
2880
|
+
function Y(e, t, n) {
|
|
3522
2881
|
if (n <= 23) return {
|
|
3523
2882
|
value: BigInt(n),
|
|
3524
2883
|
nextOffset: t
|
|
3525
2884
|
};
|
|
3526
2885
|
switch (n) {
|
|
3527
|
-
case 24: return t + 1 > e.byteLength &&
|
|
2886
|
+
case 24: return t + 1 > e.byteLength && J("unexpected end of input"), {
|
|
3528
2887
|
value: BigInt(e.getUint8(t)),
|
|
3529
2888
|
nextOffset: t + 1
|
|
3530
2889
|
};
|
|
3531
|
-
case 25: return t + 2 > e.byteLength &&
|
|
2890
|
+
case 25: return t + 2 > e.byteLength && J("unexpected end of input"), {
|
|
3532
2891
|
value: BigInt(e.getUint16(t, !1)),
|
|
3533
2892
|
nextOffset: t + 2
|
|
3534
2893
|
};
|
|
3535
|
-
case 26: return t + 4 > e.byteLength &&
|
|
2894
|
+
case 26: return t + 4 > e.byteLength && J("unexpected end of input"), {
|
|
3536
2895
|
value: BigInt(e.getUint32(t, !1)),
|
|
3537
2896
|
nextOffset: t + 4
|
|
3538
2897
|
};
|
|
3539
|
-
case 27: return t + 8 > e.byteLength &&
|
|
2898
|
+
case 27: return t + 8 > e.byteLength && J("unexpected end of input"), {
|
|
3540
2899
|
value: e.getBigUint64(t, !1),
|
|
3541
2900
|
nextOffset: t + 8
|
|
3542
2901
|
};
|
|
3543
|
-
default:
|
|
2902
|
+
default: J(`reserved additional info value: ${n}`);
|
|
3544
2903
|
}
|
|
3545
2904
|
}
|
|
3546
|
-
function
|
|
3547
|
-
let r = t, i =
|
|
2905
|
+
function X(e, t, n) {
|
|
2906
|
+
let r = t, i = ln(e, t, n);
|
|
3548
2907
|
return i.value.start = r, i.value.end = i.nextOffset, i;
|
|
3549
2908
|
}
|
|
3550
|
-
function
|
|
3551
|
-
t >= e.byteLength &&
|
|
2909
|
+
function ln(e, t, n) {
|
|
2910
|
+
t >= e.byteLength && J("unexpected end of input");
|
|
3552
2911
|
let r = e.getUint8(t++), i = r >> 5, a = r & 31;
|
|
3553
2912
|
switch (i) {
|
|
3554
2913
|
case 0: {
|
|
3555
|
-
let { value: n, nextOffset: r } =
|
|
2914
|
+
let { value: n, nextOffset: r } = Y(e, t, a);
|
|
3556
2915
|
return {
|
|
3557
|
-
value: new
|
|
2916
|
+
value: new g(n),
|
|
3558
2917
|
nextOffset: r
|
|
3559
2918
|
};
|
|
3560
2919
|
}
|
|
3561
2920
|
case 1: {
|
|
3562
|
-
let { value: n, nextOffset: r } =
|
|
2921
|
+
let { value: n, nextOffset: r } = Y(e, t, a);
|
|
3563
2922
|
return {
|
|
3564
|
-
value: new
|
|
2923
|
+
value: new _(-1n - n),
|
|
3565
2924
|
nextOffset: r
|
|
3566
2925
|
};
|
|
3567
2926
|
}
|
|
@@ -3569,20 +2928,20 @@ function Gr(e, t, n) {
|
|
|
3569
2928
|
if (a === 31) {
|
|
3570
2929
|
let r = [], i = t;
|
|
3571
2930
|
for (;;) {
|
|
3572
|
-
if (i >= e.byteLength &&
|
|
2931
|
+
if (i >= e.byteLength && J("unexpected end of indefinite byte string"), e.getUint8(i) === 255) {
|
|
3573
2932
|
i++;
|
|
3574
2933
|
break;
|
|
3575
2934
|
}
|
|
3576
|
-
let t =
|
|
3577
|
-
t.value instanceof w ||
|
|
2935
|
+
let t = X(e, i, n);
|
|
2936
|
+
t.value instanceof w || J("indefinite-length byte string chunk must be a definite byte string"), r.push(t.value), i = t.nextOffset;
|
|
3578
2937
|
}
|
|
3579
2938
|
return {
|
|
3580
|
-
value: new
|
|
2939
|
+
value: new T(r),
|
|
3581
2940
|
nextOffset: i
|
|
3582
2941
|
};
|
|
3583
2942
|
}
|
|
3584
|
-
let { value: r, nextOffset: i } =
|
|
3585
|
-
return i + o > e.byteLength &&
|
|
2943
|
+
let { value: r, nextOffset: i } = Y(e, t, a), o = Number(r);
|
|
2944
|
+
return i + o > e.byteLength && J("byte string extends beyond input"), {
|
|
3586
2945
|
value: new w(new Uint8Array(e.buffer, e.byteOffset + i, o).slice()),
|
|
3587
2946
|
nextOffset: i + o
|
|
3588
2947
|
};
|
|
@@ -3591,28 +2950,28 @@ function Gr(e, t, n) {
|
|
|
3591
2950
|
if (a === 31) {
|
|
3592
2951
|
let r = [], i = t;
|
|
3593
2952
|
for (;;) {
|
|
3594
|
-
if (i >= e.byteLength &&
|
|
2953
|
+
if (i >= e.byteLength && J("unexpected end of indefinite text string"), e.getUint8(i) === 255) {
|
|
3595
2954
|
i++;
|
|
3596
2955
|
break;
|
|
3597
2956
|
}
|
|
3598
|
-
let t =
|
|
3599
|
-
t.value instanceof
|
|
2957
|
+
let t = X(e, i, n);
|
|
2958
|
+
t.value instanceof F || J("indefinite-length text string chunk must be a definite text string"), r.push(t.value), i = t.nextOffset;
|
|
3600
2959
|
}
|
|
3601
2960
|
return {
|
|
3602
|
-
value: new
|
|
2961
|
+
value: new E(r),
|
|
3603
2962
|
nextOffset: i
|
|
3604
2963
|
};
|
|
3605
2964
|
}
|
|
3606
|
-
let { value: r, nextOffset: i } =
|
|
3607
|
-
i + o > e.byteLength &&
|
|
2965
|
+
let { value: r, nextOffset: i } = Y(e, t, a), o = Number(r);
|
|
2966
|
+
i + o > e.byteLength && J("text string extends beyond input");
|
|
3608
2967
|
let s = new Uint8Array(e.buffer, e.byteOffset + i, o), c;
|
|
3609
2968
|
try {
|
|
3610
|
-
c =
|
|
2969
|
+
c = cn.decode(s);
|
|
3611
2970
|
} catch {
|
|
3612
|
-
|
|
2971
|
+
J("invalid UTF-8 sequence in text string");
|
|
3613
2972
|
}
|
|
3614
2973
|
return {
|
|
3615
|
-
value: new
|
|
2974
|
+
value: new F(c),
|
|
3616
2975
|
nextOffset: i + o
|
|
3617
2976
|
};
|
|
3618
2977
|
}
|
|
@@ -3620,25 +2979,25 @@ function Gr(e, t, n) {
|
|
|
3620
2979
|
if (a === 31) {
|
|
3621
2980
|
let r = [], i = t;
|
|
3622
2981
|
for (;;) {
|
|
3623
|
-
if (i >= e.byteLength &&
|
|
2982
|
+
if (i >= e.byteLength && J("unexpected end of indefinite array"), e.getUint8(i) === 255) {
|
|
3624
2983
|
i++;
|
|
3625
2984
|
break;
|
|
3626
2985
|
}
|
|
3627
|
-
let t =
|
|
2986
|
+
let t = X(e, i, n);
|
|
3628
2987
|
r.push(t.value), i = t.nextOffset;
|
|
3629
2988
|
}
|
|
3630
2989
|
return {
|
|
3631
|
-
value: new
|
|
2990
|
+
value: new D(r, { indefiniteLength: !0 }),
|
|
3632
2991
|
nextOffset: i
|
|
3633
2992
|
};
|
|
3634
2993
|
}
|
|
3635
|
-
let { value: r, nextOffset: i } =
|
|
2994
|
+
let { value: r, nextOffset: i } = Y(e, t, a), o = Number(r), s = [], c = i;
|
|
3636
2995
|
for (let t = 0; t < o; t++) {
|
|
3637
|
-
let t =
|
|
2996
|
+
let t = X(e, c, n);
|
|
3638
2997
|
s.push(t.value), c = t.nextOffset;
|
|
3639
2998
|
}
|
|
3640
2999
|
return {
|
|
3641
|
-
value: new
|
|
3000
|
+
value: new D(s),
|
|
3642
3001
|
nextOffset: c
|
|
3643
3002
|
};
|
|
3644
3003
|
}
|
|
@@ -3646,36 +3005,36 @@ function Gr(e, t, n) {
|
|
|
3646
3005
|
if (a === 31) {
|
|
3647
3006
|
let r = [], i = t;
|
|
3648
3007
|
for (;;) {
|
|
3649
|
-
if (i >= e.byteLength &&
|
|
3008
|
+
if (i >= e.byteLength && J("unexpected end of indefinite map"), e.getUint8(i) === 255) {
|
|
3650
3009
|
i++;
|
|
3651
3010
|
break;
|
|
3652
3011
|
}
|
|
3653
|
-
let t =
|
|
3012
|
+
let t = X(e, i, n);
|
|
3654
3013
|
i = t.nextOffset;
|
|
3655
|
-
let a =
|
|
3014
|
+
let a = X(e, i, n);
|
|
3656
3015
|
i = a.nextOffset, r.push([t.value, a.value]);
|
|
3657
3016
|
}
|
|
3658
3017
|
return {
|
|
3659
|
-
value: new
|
|
3018
|
+
value: new O(r, { indefiniteLength: !0 }),
|
|
3660
3019
|
nextOffset: i
|
|
3661
3020
|
};
|
|
3662
3021
|
}
|
|
3663
|
-
let { value: r, nextOffset: i } =
|
|
3022
|
+
let { value: r, nextOffset: i } = Y(e, t, a), o = Number(r), s = [], c = i;
|
|
3664
3023
|
for (let t = 0; t < o; t++) {
|
|
3665
|
-
let t =
|
|
3024
|
+
let t = X(e, c, n);
|
|
3666
3025
|
c = t.nextOffset;
|
|
3667
|
-
let r =
|
|
3026
|
+
let r = X(e, c, n);
|
|
3668
3027
|
c = r.nextOffset, s.push([t.value, r.value]);
|
|
3669
3028
|
}
|
|
3670
3029
|
return {
|
|
3671
|
-
value: new
|
|
3030
|
+
value: new O(s),
|
|
3672
3031
|
nextOffset: c
|
|
3673
3032
|
};
|
|
3674
3033
|
}
|
|
3675
3034
|
case 6: {
|
|
3676
|
-
a === 31 &&
|
|
3677
|
-
let { value: r, nextOffset: i } =
|
|
3678
|
-
for (let e of [...n?.extensions ?? [], ...
|
|
3035
|
+
a === 31 && J("tags cannot use indefinite-length encoding");
|
|
3036
|
+
let { value: r, nextOffset: i } = Y(e, t, a), o = X(e, i, n);
|
|
3037
|
+
for (let e of [...n?.extensions ?? [], ...Z]) if (e.parseTag) {
|
|
3679
3038
|
let t = e.parseTag(r, o.value);
|
|
3680
3039
|
if (t !== void 0) return {
|
|
3681
3040
|
value: t,
|
|
@@ -3689,70 +3048,69 @@ function Gr(e, t, n) {
|
|
|
3689
3048
|
}
|
|
3690
3049
|
case 7:
|
|
3691
3050
|
if (a <= 19) return {
|
|
3692
|
-
value: new
|
|
3051
|
+
value: new k(a),
|
|
3693
3052
|
nextOffset: t
|
|
3694
3053
|
};
|
|
3695
3054
|
if (a === 20) return {
|
|
3696
|
-
value:
|
|
3055
|
+
value: k.FALSE,
|
|
3697
3056
|
nextOffset: t
|
|
3698
3057
|
};
|
|
3699
3058
|
if (a === 21) return {
|
|
3700
|
-
value:
|
|
3059
|
+
value: k.TRUE,
|
|
3701
3060
|
nextOffset: t
|
|
3702
3061
|
};
|
|
3703
3062
|
if (a === 22) return {
|
|
3704
|
-
value:
|
|
3063
|
+
value: k.NULL,
|
|
3705
3064
|
nextOffset: t
|
|
3706
3065
|
};
|
|
3707
3066
|
if (a === 23) return {
|
|
3708
|
-
value:
|
|
3067
|
+
value: k.UNDEFINED,
|
|
3709
3068
|
nextOffset: t
|
|
3710
3069
|
};
|
|
3711
3070
|
if (a === 24) {
|
|
3712
|
-
t + 1 > e.byteLength &&
|
|
3071
|
+
t + 1 > e.byteLength && J("unexpected end of input");
|
|
3713
3072
|
let n = e.getUint8(t);
|
|
3714
|
-
return n < 32 &&
|
|
3715
|
-
value: new
|
|
3073
|
+
return n < 32 && J(`simple value ${n} must be encoded in initial byte (0–31 reserved for extended encoding)`), {
|
|
3074
|
+
value: new k(n),
|
|
3716
3075
|
nextOffset: t + 1
|
|
3717
3076
|
};
|
|
3718
3077
|
}
|
|
3719
|
-
return a === 25 ? (t + 2 > e.byteLength &&
|
|
3720
|
-
value: new S(
|
|
3078
|
+
return a === 25 ? (t + 2 > e.byteLength && J("unexpected end of input"), {
|
|
3079
|
+
value: new S(te(e.getUint16(t, !1)), { precision: "half" }),
|
|
3721
3080
|
nextOffset: t + 2
|
|
3722
|
-
}) : a === 26 ? (t + 4 > e.byteLength &&
|
|
3081
|
+
}) : a === 26 ? (t + 4 > e.byteLength && J("unexpected end of input"), {
|
|
3723
3082
|
value: new S(e.getFloat32(t, !1), { precision: "single" }),
|
|
3724
3083
|
nextOffset: t + 4
|
|
3725
|
-
}) : a === 27 ? (t + 8 > e.byteLength &&
|
|
3084
|
+
}) : a === 27 ? (t + 8 > e.byteLength && J("unexpected end of input"), {
|
|
3726
3085
|
value: new S(e.getFloat64(t, !1), { precision: "double" }),
|
|
3727
3086
|
nextOffset: t + 8
|
|
3728
|
-
}) : (a < 31 &&
|
|
3087
|
+
}) : (a < 31 && J(`reserved additional info value in major type 7: ${a}`), J("unexpected break code outside indefinite-length item"));
|
|
3729
3088
|
}
|
|
3730
|
-
return
|
|
3089
|
+
return J(`unknown major type: ${i}`);
|
|
3731
3090
|
}
|
|
3732
|
-
function
|
|
3091
|
+
function un(e) {
|
|
3733
3092
|
if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new Uint8Array(e);
|
|
3734
3093
|
if (ArrayBuffer.isView(e)) return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
|
|
3735
3094
|
throw TypeError("expected ArrayBufferView or ArrayBufferLike");
|
|
3736
3095
|
}
|
|
3737
|
-
function
|
|
3738
|
-
let n =
|
|
3096
|
+
function dn(e, t) {
|
|
3097
|
+
let n = un(e), r = new DataView(n.buffer, n.byteOffset, n.byteLength), i = t?.offset ?? 0;
|
|
3739
3098
|
if (!Number.isInteger(i) || i < 0 || i > r.byteLength) throw RangeError(`CBOR decode offset must be an integer between 0 and ${r.byteLength}`);
|
|
3740
|
-
let { value: a, nextOffset: o } =
|
|
3741
|
-
return !t?.allowTrailing && o !== r.byteLength &&
|
|
3099
|
+
let { value: a, nextOffset: o } = X(r, i, t);
|
|
3100
|
+
return !t?.allowTrailing && o !== r.byteLength && J(`${r.byteLength - o} trailing byte(s) after end of CBOR item`), a;
|
|
3742
3101
|
}
|
|
3743
3102
|
//#endregion
|
|
3744
3103
|
//#region src/extensions/cbordata.ts
|
|
3745
|
-
var
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
Ur,
|
|
3104
|
+
var fn = 24n, Z = [
|
|
3105
|
+
bt,
|
|
3106
|
+
Pt,
|
|
3107
|
+
Lt,
|
|
3108
|
+
sn,
|
|
3751
3109
|
{
|
|
3752
|
-
tagNumbers: [
|
|
3110
|
+
tagNumbers: [fn],
|
|
3753
3111
|
parseTag(e, t) {
|
|
3754
3112
|
if (e === 24n && t instanceof w) try {
|
|
3755
|
-
return new C(
|
|
3113
|
+
return new C(fn, new A([dn(t.value)]));
|
|
3756
3114
|
} catch {
|
|
3757
3115
|
return;
|
|
3758
3116
|
}
|
|
@@ -3763,51 +3121,51 @@ var Jr = 24n, Yr = [
|
|
|
3763
3121
|
//#region src/js/fromJS.ts
|
|
3764
3122
|
function Q(e, t) {
|
|
3765
3123
|
if (t?.replacer) {
|
|
3766
|
-
let { replacer: n, ...r } = t, i =
|
|
3767
|
-
return i === l ?
|
|
3124
|
+
let { replacer: n, ...r } = t, i = hn(e, n, r.extensions, r.undefinedOmits);
|
|
3125
|
+
return i === l ? k.UNDEFINED : Q(i, Object.keys(r).length > 0 ? r : void 0);
|
|
3768
3126
|
}
|
|
3769
|
-
return
|
|
3127
|
+
return pn(e, t, !0);
|
|
3770
3128
|
}
|
|
3771
|
-
function
|
|
3772
|
-
for (let n of [...t?.extensions ?? [], ...
|
|
3129
|
+
function pn(e, t, n) {
|
|
3130
|
+
for (let n of [...t?.extensions ?? [], ...Z]) if (n.fromJS) {
|
|
3773
3131
|
let r = n.fromJS(e, t ?? {});
|
|
3774
3132
|
if (r !== void 0) return r;
|
|
3775
3133
|
}
|
|
3776
3134
|
if (n && typeof e == "object" && e && c.symbol in e) {
|
|
3777
|
-
let n = e[c.symbol], r =
|
|
3778
|
-
for (let e of [...t?.extensions ?? [], ...
|
|
3135
|
+
let n = e[c.symbol], r = pn(e, t, !1);
|
|
3136
|
+
for (let e of [...t?.extensions ?? [], ...Z]) if (e.parseTag) {
|
|
3779
3137
|
let t = e.parseTag(n, r);
|
|
3780
3138
|
if (t !== void 0) return t;
|
|
3781
3139
|
}
|
|
3782
3140
|
return new C(n, r);
|
|
3783
3141
|
}
|
|
3784
|
-
if (e instanceof c.Null) return
|
|
3785
|
-
if (e instanceof c.Undefined) return
|
|
3786
|
-
if (e instanceof u) return new
|
|
3787
|
-
if (e === null) return
|
|
3788
|
-
if (e === void 0) return
|
|
3789
|
-
if (e === !0) return
|
|
3790
|
-
if (e === !1) return
|
|
3791
|
-
if (typeof e == "bigint") return e > 18446744073709551615n ? new
|
|
3792
|
-
if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new
|
|
3793
|
-
if (typeof e == "string") return new
|
|
3794
|
-
if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return
|
|
3142
|
+
if (e instanceof c.Null) return k.NULL;
|
|
3143
|
+
if (e instanceof c.Undefined) return k.UNDEFINED;
|
|
3144
|
+
if (e instanceof u) return new k(e.value);
|
|
3145
|
+
if (e === null) return k.NULL;
|
|
3146
|
+
if (e === void 0) return k.UNDEFINED;
|
|
3147
|
+
if (e === !0) return k.TRUE;
|
|
3148
|
+
if (e === !1) return k.FALSE;
|
|
3149
|
+
if (typeof e == "bigint") return e > 18446744073709551615n ? new M(e) : e < -18446744073709551616n ? new N(e) : e >= 0n ? new g(e) : new _(e);
|
|
3150
|
+
if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new g(BigInt(e)) : new _(BigInt(e)) : new S(e);
|
|
3151
|
+
if (typeof e == "string") return new F(e);
|
|
3152
|
+
if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return pn(e.valueOf(), t, !1);
|
|
3795
3153
|
if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new w(new Uint8Array(e));
|
|
3796
|
-
if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new
|
|
3797
|
-
if (e instanceof $) return new
|
|
3798
|
-
if (Array.isArray(e)) return new
|
|
3154
|
+
if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new D(Array.from(e, (e) => new g(BigInt(e)))) : new w(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
|
|
3155
|
+
if (e instanceof $) return new O([...e].map(([e, n]) => [Q(e, t), Q(n, t)]));
|
|
3156
|
+
if (Array.isArray(e)) return new D(e.map((e) => Q(e, t)));
|
|
3799
3157
|
if (typeof e == "object") {
|
|
3800
3158
|
let n = [];
|
|
3801
|
-
for (let [r, i] of Object.entries(e)) n.push([new
|
|
3802
|
-
return new
|
|
3159
|
+
for (let [r, i] of Object.entries(e)) n.push([new F(r), Q(i, t)]);
|
|
3160
|
+
return new O(n);
|
|
3803
3161
|
}
|
|
3804
3162
|
throw TypeError(`fromJS: unsupported value type: ${typeof e}`);
|
|
3805
3163
|
}
|
|
3806
|
-
function
|
|
3164
|
+
function mn(e) {
|
|
3807
3165
|
return ArrayBuffer.isView(e) || e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer || e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]" || e instanceof c.Null || e instanceof c.Undefined || e instanceof u;
|
|
3808
3166
|
}
|
|
3809
|
-
function
|
|
3810
|
-
let i = [...n ?? [], ...
|
|
3167
|
+
function hn(e, t, n, r) {
|
|
3168
|
+
let i = [...n ?? [], ...Z];
|
|
3811
3169
|
function a(e) {
|
|
3812
3170
|
return e === l || r === !0 && e === void 0;
|
|
3813
3171
|
}
|
|
@@ -3817,7 +3175,7 @@ function Qr(e, t, n, r) {
|
|
|
3817
3175
|
if (typeof e != "object" || !e) return e;
|
|
3818
3176
|
if (e instanceof $) return $.from(e, ([e, t]) => [e, r(t)]);
|
|
3819
3177
|
if (Array.isArray(e)) return e.map(r);
|
|
3820
|
-
if (c.symbol in e ||
|
|
3178
|
+
if (c.symbol in e || mn(e) || i.some((t) => t.isJSType?.(e))) return e;
|
|
3821
3179
|
let t = Object.getPrototypeOf(e);
|
|
3822
3180
|
if (t === Object.prototype || t === null) {
|
|
3823
3181
|
let t = e.toJSON;
|
|
@@ -3852,7 +3210,7 @@ function Qr(e, t, n, r) {
|
|
|
3852
3210
|
let r = s(t, String(n), e);
|
|
3853
3211
|
return a(r) ? null : r;
|
|
3854
3212
|
});
|
|
3855
|
-
if (
|
|
3213
|
+
if (mn(e) || i.some((t) => t.isJSType?.(e))) return e;
|
|
3856
3214
|
let t = {};
|
|
3857
3215
|
for (let n of Object.keys(e)) {
|
|
3858
3216
|
let r = s(e[n], n, e);
|
|
@@ -3882,6 +3240,6 @@ var $ = class extends Array {
|
|
|
3882
3240
|
}
|
|
3883
3241
|
};
|
|
3884
3242
|
//#endregion
|
|
3885
|
-
export { l as C, n as D, c as E, u as S, t as T, C as _,
|
|
3243
|
+
export { l as C, n as D, c as E, u as S, t as T, C as _, xt as a, g as b, N as c, k as d, O as f, w as g, T as h, dn as i, M as l, E as m, hn as n, F as o, D as p, Q as r, He as s, $ as t, A as u, S as v, e as w, d as x, _ as y };
|
|
3886
3244
|
|
|
3887
|
-
//# sourceMappingURL=mapEntries-
|
|
3245
|
+
//# sourceMappingURL=mapEntries-D5MWtXqq.js.map
|