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