@learncard/vpqr-plugin 1.1.24 → 1.1.26
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.md +12 -7
- package/dist/vpqr-plugin.cjs.development.cjs +353 -288
- package/dist/vpqr-plugin.cjs.development.cjs.map +4 -4
- package/dist/vpqr-plugin.cjs.production.min.cjs +2 -2
- package/dist/vpqr-plugin.cjs.production.min.cjs.map +4 -4
- package/dist/vpqr-plugin.esm.js +353 -288
- package/dist/vpqr-plugin.esm.js.map +4 -4
- package/package.json +58 -56
- package/src/global.d.ts +23 -0
- package/src/index.ts +41 -0
- package/src/types.ts +15 -0
|
@@ -7,11 +7,7 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
9
|
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
-
|
|
11
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
-
} catch (e) {
|
|
13
|
-
throw mod = 0, e;
|
|
14
|
-
}
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
11
|
};
|
|
16
12
|
var __export = (target, all) => {
|
|
17
13
|
for (var name in all)
|
|
@@ -35,9 +31,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
31
|
));
|
|
36
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
33
|
|
|
38
|
-
// ../../../node_modules
|
|
34
|
+
// ../../../node_modules/base32-decode/index.js
|
|
39
35
|
var require_base32_decode = __commonJS({
|
|
40
|
-
"../../../node_modules
|
|
36
|
+
"../../../node_modules/base32-decode/index.js"(exports, module2) {
|
|
41
37
|
"use strict";
|
|
42
38
|
var RFC46482 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
43
39
|
var RFC4648_HEX2 = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
@@ -94,24 +90,10 @@ __export(index_exports, {
|
|
|
94
90
|
});
|
|
95
91
|
module.exports = __toCommonJS(index_exports);
|
|
96
92
|
|
|
97
|
-
// ../../../node_modules
|
|
98
|
-
var typeofs = [
|
|
99
|
-
"string",
|
|
100
|
-
"number",
|
|
101
|
-
"bigint",
|
|
102
|
-
"symbol"
|
|
103
|
-
];
|
|
93
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/is.js
|
|
104
94
|
var objectTypeNames = [
|
|
105
|
-
"Function",
|
|
106
|
-
"Generator",
|
|
107
|
-
"AsyncGenerator",
|
|
108
|
-
"GeneratorFunction",
|
|
109
|
-
"AsyncGeneratorFunction",
|
|
110
|
-
"AsyncFunction",
|
|
111
|
-
"Observable",
|
|
112
|
-
"Array",
|
|
113
|
-
"Buffer",
|
|
114
95
|
"Object",
|
|
96
|
+
// for Object.create(null) and other non-plain objects
|
|
115
97
|
"RegExp",
|
|
116
98
|
"Date",
|
|
117
99
|
"Error",
|
|
@@ -126,7 +108,6 @@ var objectTypeNames = [
|
|
|
126
108
|
"URL",
|
|
127
109
|
"HTMLElement",
|
|
128
110
|
"Int8Array",
|
|
129
|
-
"Uint8Array",
|
|
130
111
|
"Uint8ClampedArray",
|
|
131
112
|
"Int16Array",
|
|
132
113
|
"Uint16Array",
|
|
@@ -148,7 +129,7 @@ function is(value) {
|
|
|
148
129
|
return "boolean";
|
|
149
130
|
}
|
|
150
131
|
const typeOf = typeof value;
|
|
151
|
-
if (
|
|
132
|
+
if (typeOf === "string" || typeOf === "number" || typeOf === "bigint" || typeOf === "symbol") {
|
|
152
133
|
return typeOf;
|
|
153
134
|
}
|
|
154
135
|
if (typeOf === "function") {
|
|
@@ -157,8 +138,11 @@ function is(value) {
|
|
|
157
138
|
if (Array.isArray(value)) {
|
|
158
139
|
return "Array";
|
|
159
140
|
}
|
|
160
|
-
if (
|
|
161
|
-
return "
|
|
141
|
+
if (value instanceof Uint8Array) {
|
|
142
|
+
return "Uint8Array";
|
|
143
|
+
}
|
|
144
|
+
if (value.constructor === Object) {
|
|
145
|
+
return "Object";
|
|
162
146
|
}
|
|
163
147
|
const objectType = getObjectType(value);
|
|
164
148
|
if (objectType) {
|
|
@@ -167,10 +151,6 @@ function is(value) {
|
|
|
167
151
|
return "Object";
|
|
168
152
|
}
|
|
169
153
|
__name(is, "is");
|
|
170
|
-
function isBuffer(value) {
|
|
171
|
-
return value && value.constructor && value.constructor.isBuffer && value.constructor.isBuffer.call(null, value);
|
|
172
|
-
}
|
|
173
|
-
__name(isBuffer, "isBuffer");
|
|
174
154
|
function getObjectType(value) {
|
|
175
155
|
const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);
|
|
176
156
|
if (objectTypeNames.includes(objectTypeName)) {
|
|
@@ -180,7 +160,7 @@ function getObjectType(value) {
|
|
|
180
160
|
}
|
|
181
161
|
__name(getObjectType, "getObjectType");
|
|
182
162
|
|
|
183
|
-
// ../../../node_modules
|
|
163
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/token.js
|
|
184
164
|
var _Type = class _Type {
|
|
185
165
|
/**
|
|
186
166
|
* @param {number} major
|
|
@@ -204,6 +184,17 @@ var _Type = class _Type {
|
|
|
204
184
|
compare(typ) {
|
|
205
185
|
return this.major < typ.major ? -1 : this.major > typ.major ? 1 : 0;
|
|
206
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Check equality between two Type instances. Safe to use across different
|
|
189
|
+
* copies of the Type class (e.g., when bundlers duplicate the module).
|
|
190
|
+
* (major, name) uniquely identifies a Type; terminal is implied by these.
|
|
191
|
+
* @param {Type} a
|
|
192
|
+
* @param {Type} b
|
|
193
|
+
* @returns {boolean}
|
|
194
|
+
*/
|
|
195
|
+
static equals(a, b) {
|
|
196
|
+
return a === b || a.major === b.major && a.name === b.name;
|
|
197
|
+
}
|
|
207
198
|
};
|
|
208
199
|
__name(_Type, "Type");
|
|
209
200
|
var Type = _Type;
|
|
@@ -241,56 +232,32 @@ var _Token = class _Token {
|
|
|
241
232
|
__name(_Token, "Token");
|
|
242
233
|
var Token = _Token;
|
|
243
234
|
|
|
244
|
-
// ../../../node_modules
|
|
235
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/byte-utils.js
|
|
245
236
|
var useBuffer = globalThis.process && // @ts-ignore
|
|
246
237
|
!globalThis.process.browser && // @ts-ignore
|
|
247
238
|
globalThis.Buffer && // @ts-ignore
|
|
248
239
|
typeof globalThis.Buffer.isBuffer === "function";
|
|
249
|
-
var textDecoder = new TextDecoder();
|
|
250
240
|
var textEncoder = new TextEncoder();
|
|
251
|
-
function
|
|
252
|
-
return useBuffer && globalThis.Buffer.isBuffer(
|
|
241
|
+
function isBuffer(buf) {
|
|
242
|
+
return useBuffer && globalThis.Buffer.isBuffer(buf);
|
|
253
243
|
}
|
|
254
|
-
__name(
|
|
255
|
-
function asU8A(
|
|
256
|
-
if (!(
|
|
257
|
-
return Uint8Array.from(
|
|
244
|
+
__name(isBuffer, "isBuffer");
|
|
245
|
+
function asU8A(buf) {
|
|
246
|
+
if (!(buf instanceof Uint8Array)) {
|
|
247
|
+
return Uint8Array.from(buf);
|
|
258
248
|
}
|
|
259
|
-
return
|
|
249
|
+
return isBuffer(buf) ? new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength) : buf;
|
|
260
250
|
}
|
|
261
251
|
__name(asU8A, "asU8A");
|
|
262
|
-
var
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* @param {Uint8Array} bytes
|
|
266
|
-
* @param {number} start
|
|
267
|
-
* @param {number} end
|
|
268
|
-
*/
|
|
269
|
-
(bytes, start, end) => {
|
|
270
|
-
return end - start > 64 ? (
|
|
271
|
-
// eslint-disable-line operator-linebreak
|
|
272
|
-
// @ts-ignore
|
|
273
|
-
globalThis.Buffer.from(bytes.subarray(start, end)).toString("utf8")
|
|
274
|
-
) : utf8Slice(bytes, start, end);
|
|
275
|
-
}
|
|
276
|
-
) : (
|
|
277
|
-
// eslint-disable-line operator-linebreak
|
|
278
|
-
/**
|
|
279
|
-
* @param {Uint8Array} bytes
|
|
280
|
-
* @param {number} start
|
|
281
|
-
* @param {number} end
|
|
282
|
-
*/
|
|
283
|
-
(bytes, start, end) => {
|
|
284
|
-
return end - start > 64 ? textDecoder.decode(bytes.subarray(start, end)) : utf8Slice(bytes, start, end);
|
|
285
|
-
}
|
|
286
|
-
);
|
|
252
|
+
var FROM_STRING_THRESHOLD_BUFFER = 24;
|
|
253
|
+
var FROM_STRING_THRESHOLD_TEXTENCODER = 200;
|
|
287
254
|
var fromString = useBuffer ? (
|
|
288
255
|
// eslint-disable-line operator-linebreak
|
|
289
256
|
/**
|
|
290
257
|
* @param {string} string
|
|
291
258
|
*/
|
|
292
259
|
(string) => {
|
|
293
|
-
return string.length
|
|
260
|
+
return string.length >= FROM_STRING_THRESHOLD_BUFFER ? (
|
|
294
261
|
// eslint-disable-line operator-linebreak
|
|
295
262
|
// @ts-ignore
|
|
296
263
|
globalThis.Buffer.from(string)
|
|
@@ -302,7 +269,7 @@ var fromString = useBuffer ? (
|
|
|
302
269
|
* @param {string} string
|
|
303
270
|
*/
|
|
304
271
|
(string) => {
|
|
305
|
-
return string.length
|
|
272
|
+
return string.length >= FROM_STRING_THRESHOLD_TEXTENCODER ? textEncoder.encode(string) : utf8ToBytes(string);
|
|
306
273
|
}
|
|
307
274
|
);
|
|
308
275
|
var fromArray = /* @__PURE__ */ __name((arr) => {
|
|
@@ -315,8 +282,9 @@ var slice = useBuffer ? (
|
|
|
315
282
|
* @param {number} start
|
|
316
283
|
* @param {number} end
|
|
317
284
|
*/
|
|
285
|
+
// Buffer.slice() returns a view, not a copy, so we need special handling
|
|
318
286
|
(bytes, start, end) => {
|
|
319
|
-
if (
|
|
287
|
+
if (isBuffer(bytes)) {
|
|
320
288
|
return new Uint8Array(bytes.subarray(start, end));
|
|
321
289
|
}
|
|
322
290
|
return bytes.slice(start, end);
|
|
@@ -387,7 +355,7 @@ var alloc = useBuffer ? (
|
|
|
387
355
|
}
|
|
388
356
|
);
|
|
389
357
|
function compare(b1, b2) {
|
|
390
|
-
if (
|
|
358
|
+
if (isBuffer(b1) && isBuffer(b2)) {
|
|
391
359
|
return b1.compare(b2);
|
|
392
360
|
}
|
|
393
361
|
for (let i = 0; i < b1.length; i++) {
|
|
@@ -416,6 +384,9 @@ function utf8ToBytes(str) {
|
|
|
416
384
|
out[p++] = c >> 6 & 63 | 128;
|
|
417
385
|
out[p++] = c & 63 | 128;
|
|
418
386
|
} else {
|
|
387
|
+
if (c >= 55296 && c <= 57343) {
|
|
388
|
+
c = 65533;
|
|
389
|
+
}
|
|
419
390
|
out[p++] = c >> 12 | 224;
|
|
420
391
|
out[p++] = c >> 6 & 63 | 128;
|
|
421
392
|
out[p++] = c & 63 | 128;
|
|
@@ -424,84 +395,8 @@ function utf8ToBytes(str) {
|
|
|
424
395
|
return out;
|
|
425
396
|
}
|
|
426
397
|
__name(utf8ToBytes, "utf8ToBytes");
|
|
427
|
-
function utf8Slice(buf2, offset, end) {
|
|
428
|
-
const res = [];
|
|
429
|
-
while (offset < end) {
|
|
430
|
-
const firstByte = buf2[offset];
|
|
431
|
-
let codePoint = null;
|
|
432
|
-
let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
|
|
433
|
-
if (offset + bytesPerSequence <= end) {
|
|
434
|
-
let secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
435
|
-
switch (bytesPerSequence) {
|
|
436
|
-
case 1:
|
|
437
|
-
if (firstByte < 128) {
|
|
438
|
-
codePoint = firstByte;
|
|
439
|
-
}
|
|
440
|
-
break;
|
|
441
|
-
case 2:
|
|
442
|
-
secondByte = buf2[offset + 1];
|
|
443
|
-
if ((secondByte & 192) === 128) {
|
|
444
|
-
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
|
|
445
|
-
if (tempCodePoint > 127) {
|
|
446
|
-
codePoint = tempCodePoint;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
break;
|
|
450
|
-
case 3:
|
|
451
|
-
secondByte = buf2[offset + 1];
|
|
452
|
-
thirdByte = buf2[offset + 2];
|
|
453
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
|
|
454
|
-
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
|
|
455
|
-
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
|
|
456
|
-
codePoint = tempCodePoint;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
break;
|
|
460
|
-
case 4:
|
|
461
|
-
secondByte = buf2[offset + 1];
|
|
462
|
-
thirdByte = buf2[offset + 2];
|
|
463
|
-
fourthByte = buf2[offset + 3];
|
|
464
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
|
|
465
|
-
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
|
|
466
|
-
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
|
|
467
|
-
codePoint = tempCodePoint;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
if (codePoint === null) {
|
|
473
|
-
codePoint = 65533;
|
|
474
|
-
bytesPerSequence = 1;
|
|
475
|
-
} else if (codePoint > 65535) {
|
|
476
|
-
codePoint -= 65536;
|
|
477
|
-
res.push(codePoint >>> 10 & 1023 | 55296);
|
|
478
|
-
codePoint = 56320 | codePoint & 1023;
|
|
479
|
-
}
|
|
480
|
-
res.push(codePoint);
|
|
481
|
-
offset += bytesPerSequence;
|
|
482
|
-
}
|
|
483
|
-
return decodeCodePointsArray(res);
|
|
484
|
-
}
|
|
485
|
-
__name(utf8Slice, "utf8Slice");
|
|
486
|
-
var MAX_ARGUMENTS_LENGTH = 4096;
|
|
487
|
-
function decodeCodePointsArray(codePoints) {
|
|
488
|
-
const len = codePoints.length;
|
|
489
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
490
|
-
return String.fromCharCode.apply(String, codePoints);
|
|
491
|
-
}
|
|
492
|
-
let res = "";
|
|
493
|
-
let i = 0;
|
|
494
|
-
while (i < len) {
|
|
495
|
-
res += String.fromCharCode.apply(
|
|
496
|
-
String,
|
|
497
|
-
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
498
|
-
);
|
|
499
|
-
}
|
|
500
|
-
return res;
|
|
501
|
-
}
|
|
502
|
-
__name(decodeCodePointsArray, "decodeCodePointsArray");
|
|
503
398
|
|
|
504
|
-
// ../../../node_modules
|
|
399
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/bl.js
|
|
505
400
|
var defaultChunkSize = 256;
|
|
506
401
|
var _Bl = class _Bl {
|
|
507
402
|
/**
|
|
@@ -583,8 +478,44 @@ var _Bl = class _Bl {
|
|
|
583
478
|
};
|
|
584
479
|
__name(_Bl, "Bl");
|
|
585
480
|
var Bl = _Bl;
|
|
481
|
+
var _U8Bl = class _U8Bl {
|
|
482
|
+
/**
|
|
483
|
+
* @param {Uint8Array} dest
|
|
484
|
+
*/
|
|
485
|
+
constructor(dest) {
|
|
486
|
+
this.dest = dest;
|
|
487
|
+
this.cursor = 0;
|
|
488
|
+
this.chunks = [dest];
|
|
489
|
+
}
|
|
490
|
+
reset() {
|
|
491
|
+
this.cursor = 0;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* @param {Uint8Array|number[]} bytes
|
|
495
|
+
*/
|
|
496
|
+
push(bytes) {
|
|
497
|
+
if (this.cursor + bytes.length > this.dest.length) {
|
|
498
|
+
throw new Error("write out of bounds, destination buffer is too small");
|
|
499
|
+
}
|
|
500
|
+
this.dest.set(bytes, this.cursor);
|
|
501
|
+
this.cursor += bytes.length;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* @param {boolean} [reset]
|
|
505
|
+
* @returns {Uint8Array}
|
|
506
|
+
*/
|
|
507
|
+
toBytes(reset = false) {
|
|
508
|
+
const byts = this.dest.subarray(0, this.cursor);
|
|
509
|
+
if (reset) {
|
|
510
|
+
this.reset();
|
|
511
|
+
}
|
|
512
|
+
return byts;
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
__name(_U8Bl, "U8Bl");
|
|
516
|
+
var U8Bl = _U8Bl;
|
|
586
517
|
|
|
587
|
-
// ../../../node_modules
|
|
518
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/common.js
|
|
588
519
|
var decodeErrPrefix = "CBOR decode error:";
|
|
589
520
|
var encodeErrPrefix = "CBOR encode error:";
|
|
590
521
|
var uintMinorPrefixBytes = [];
|
|
@@ -600,7 +531,7 @@ function assertEnoughData(data, pos, need) {
|
|
|
600
531
|
}
|
|
601
532
|
__name(assertEnoughData, "assertEnoughData");
|
|
602
533
|
|
|
603
|
-
// ../../../node_modules
|
|
534
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/0uint.js
|
|
604
535
|
var uintBoundaries = [24, 256, 65536, 4294967296, BigInt("18446744073709551616")];
|
|
605
536
|
function readUint8(data, offset, options) {
|
|
606
537
|
assertEnoughData(data, offset, 1);
|
|
@@ -662,23 +593,23 @@ function decodeUint64(data, pos, _minor, options) {
|
|
|
662
593
|
return new Token(Type.uint, readUint64(data, pos + 1, options), 9);
|
|
663
594
|
}
|
|
664
595
|
__name(decodeUint64, "decodeUint64");
|
|
665
|
-
function encodeUint(
|
|
666
|
-
return encodeUintValue(
|
|
596
|
+
function encodeUint(writer, token) {
|
|
597
|
+
return encodeUintValue(writer, 0, token.value);
|
|
667
598
|
}
|
|
668
599
|
__name(encodeUint, "encodeUint");
|
|
669
|
-
function encodeUintValue(
|
|
600
|
+
function encodeUintValue(writer, major, uint) {
|
|
670
601
|
if (uint < uintBoundaries[0]) {
|
|
671
602
|
const nuint = Number(uint);
|
|
672
|
-
|
|
603
|
+
writer.push([major | nuint]);
|
|
673
604
|
} else if (uint < uintBoundaries[1]) {
|
|
674
605
|
const nuint = Number(uint);
|
|
675
|
-
|
|
606
|
+
writer.push([major | 24, nuint]);
|
|
676
607
|
} else if (uint < uintBoundaries[2]) {
|
|
677
608
|
const nuint = Number(uint);
|
|
678
|
-
|
|
609
|
+
writer.push([major | 25, nuint >>> 8, nuint & 255]);
|
|
679
610
|
} else if (uint < uintBoundaries[3]) {
|
|
680
611
|
const nuint = Number(uint);
|
|
681
|
-
|
|
612
|
+
writer.push([major | 26, nuint >>> 24 & 255, nuint >>> 16 & 255, nuint >>> 8 & 255, nuint & 255]);
|
|
682
613
|
} else {
|
|
683
614
|
const buint = BigInt(uint);
|
|
684
615
|
if (buint < uintBoundaries[4]) {
|
|
@@ -699,7 +630,7 @@ function encodeUintValue(buf2, major, uint) {
|
|
|
699
630
|
set[2] = hi & 255;
|
|
700
631
|
hi = hi >> 8;
|
|
701
632
|
set[1] = hi & 255;
|
|
702
|
-
|
|
633
|
+
writer.push(set);
|
|
703
634
|
} else {
|
|
704
635
|
throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`);
|
|
705
636
|
}
|
|
@@ -731,7 +662,7 @@ encodeUint.compareTokens = /* @__PURE__ */ __name(function compareTokens(tok1, t
|
|
|
731
662
|
);
|
|
732
663
|
}, "compareTokens");
|
|
733
664
|
|
|
734
|
-
// ../../../node_modules
|
|
665
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/1negint.js
|
|
735
666
|
function decodeNegint8(data, pos, _minor, options) {
|
|
736
667
|
return new Token(Type.negint, -1 - readUint8(data, pos + 1, options), 2);
|
|
737
668
|
}
|
|
@@ -760,10 +691,10 @@ function decodeNegint64(data, pos, _minor, options) {
|
|
|
760
691
|
return new Token(Type.negint, neg1b - BigInt(int), 9);
|
|
761
692
|
}
|
|
762
693
|
__name(decodeNegint64, "decodeNegint64");
|
|
763
|
-
function encodeNegint(
|
|
694
|
+
function encodeNegint(writer, token) {
|
|
764
695
|
const negint = token.value;
|
|
765
696
|
const unsigned = typeof negint === "bigint" ? negint * neg1b - pos1b : negint * -1 - 1;
|
|
766
|
-
encodeUintValue(
|
|
697
|
+
encodeUintValue(writer, token.type.majorEncoded, unsigned);
|
|
767
698
|
}
|
|
768
699
|
__name(encodeNegint, "encodeNegint");
|
|
769
700
|
encodeNegint.encodedSize = /* @__PURE__ */ __name(function encodedSize3(token) {
|
|
@@ -790,11 +721,11 @@ encodeNegint.compareTokens = /* @__PURE__ */ __name(function compareTokens2(tok1
|
|
|
790
721
|
);
|
|
791
722
|
}, "compareTokens");
|
|
792
723
|
|
|
793
|
-
// ../../../node_modules
|
|
724
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/2bytes.js
|
|
794
725
|
function toToken(data, pos, prefix, length) {
|
|
795
726
|
assertEnoughData(data, pos, prefix + length);
|
|
796
|
-
const
|
|
797
|
-
return new Token(Type.bytes,
|
|
727
|
+
const buf = data.slice(pos + prefix, pos + prefix + length);
|
|
728
|
+
return new Token(Type.bytes, buf, prefix + length);
|
|
798
729
|
}
|
|
799
730
|
__name(toToken, "toToken");
|
|
800
731
|
function decodeBytesCompact(data, pos, minor, _options) {
|
|
@@ -823,15 +754,15 @@ function decodeBytes64(data, pos, _minor, options) {
|
|
|
823
754
|
__name(decodeBytes64, "decodeBytes64");
|
|
824
755
|
function tokenBytes(token) {
|
|
825
756
|
if (token.encodedBytes === void 0) {
|
|
826
|
-
token.encodedBytes = token.type
|
|
757
|
+
token.encodedBytes = Type.equals(token.type, Type.string) ? fromString(token.value) : token.value;
|
|
827
758
|
}
|
|
828
759
|
return token.encodedBytes;
|
|
829
760
|
}
|
|
830
761
|
__name(tokenBytes, "tokenBytes");
|
|
831
|
-
function encodeBytes(
|
|
762
|
+
function encodeBytes(writer, token) {
|
|
832
763
|
const bytes = tokenBytes(token);
|
|
833
|
-
encodeUintValue(
|
|
834
|
-
|
|
764
|
+
encodeUintValue(writer, token.type.majorEncoded, bytes.length);
|
|
765
|
+
writer.push(bytes);
|
|
835
766
|
}
|
|
836
767
|
__name(encodeBytes, "encodeBytes");
|
|
837
768
|
encodeBytes.encodedSize = /* @__PURE__ */ __name(function encodedSize4(token) {
|
|
@@ -846,13 +777,31 @@ function compareBytes(b1, b2) {
|
|
|
846
777
|
}
|
|
847
778
|
__name(compareBytes, "compareBytes");
|
|
848
779
|
|
|
849
|
-
// ../../../node_modules
|
|
780
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/3string.js
|
|
781
|
+
var textDecoder = new TextDecoder();
|
|
782
|
+
var ASCII_THRESHOLD = 32;
|
|
783
|
+
function toStr(bytes, start, end) {
|
|
784
|
+
const len = end - start;
|
|
785
|
+
if (len < ASCII_THRESHOLD) {
|
|
786
|
+
let str = "";
|
|
787
|
+
for (let i = start; i < end; i++) {
|
|
788
|
+
const c = bytes[i];
|
|
789
|
+
if (c & 128) {
|
|
790
|
+
return textDecoder.decode(bytes.subarray(start, end));
|
|
791
|
+
}
|
|
792
|
+
str += String.fromCharCode(c);
|
|
793
|
+
}
|
|
794
|
+
return str;
|
|
795
|
+
}
|
|
796
|
+
return textDecoder.decode(bytes.subarray(start, end));
|
|
797
|
+
}
|
|
798
|
+
__name(toStr, "toStr");
|
|
850
799
|
function toToken2(data, pos, prefix, length, options) {
|
|
851
800
|
const totLength = prefix + length;
|
|
852
801
|
assertEnoughData(data, pos, totLength);
|
|
853
|
-
const tok = new Token(Type.string,
|
|
802
|
+
const tok = new Token(Type.string, toStr(data, pos + prefix, pos + totLength), totLength);
|
|
854
803
|
if (options.retainStringBytes === true) {
|
|
855
|
-
tok.byteValue = slice(
|
|
804
|
+
tok.byteValue = data.slice(pos + prefix, pos + totLength);
|
|
856
805
|
}
|
|
857
806
|
return tok;
|
|
858
807
|
}
|
|
@@ -883,7 +832,7 @@ function decodeString64(data, pos, _minor, options) {
|
|
|
883
832
|
__name(decodeString64, "decodeString64");
|
|
884
833
|
var encodeString = encodeBytes;
|
|
885
834
|
|
|
886
|
-
// ../../../node_modules
|
|
835
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/4array.js
|
|
887
836
|
function toToken3(_data, _pos, prefix, length) {
|
|
888
837
|
return new Token(Type.array, length, prefix);
|
|
889
838
|
}
|
|
@@ -919,8 +868,8 @@ function decodeArrayIndefinite(data, pos, _minor, options) {
|
|
|
919
868
|
return toToken3(data, pos, 1, Infinity);
|
|
920
869
|
}
|
|
921
870
|
__name(decodeArrayIndefinite, "decodeArrayIndefinite");
|
|
922
|
-
function encodeArray(
|
|
923
|
-
encodeUintValue(
|
|
871
|
+
function encodeArray(writer, token) {
|
|
872
|
+
encodeUintValue(writer, Type.array.majorEncoded, token.value);
|
|
924
873
|
}
|
|
925
874
|
__name(encodeArray, "encodeArray");
|
|
926
875
|
encodeArray.compareTokens = encodeUint.compareTokens;
|
|
@@ -928,7 +877,7 @@ encodeArray.encodedSize = /* @__PURE__ */ __name(function encodedSize5(token) {
|
|
|
928
877
|
return encodeUintValue.encodedSize(token.value);
|
|
929
878
|
}, "encodedSize");
|
|
930
879
|
|
|
931
|
-
// ../../../node_modules
|
|
880
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/5map.js
|
|
932
881
|
function toToken4(_data, _pos, prefix, length) {
|
|
933
882
|
return new Token(Type.map, length, prefix);
|
|
934
883
|
}
|
|
@@ -964,8 +913,8 @@ function decodeMapIndefinite(data, pos, _minor, options) {
|
|
|
964
913
|
return toToken4(data, pos, 1, Infinity);
|
|
965
914
|
}
|
|
966
915
|
__name(decodeMapIndefinite, "decodeMapIndefinite");
|
|
967
|
-
function encodeMap(
|
|
968
|
-
encodeUintValue(
|
|
916
|
+
function encodeMap(writer, token) {
|
|
917
|
+
encodeUintValue(writer, Type.map.majorEncoded, token.value);
|
|
969
918
|
}
|
|
970
919
|
__name(encodeMap, "encodeMap");
|
|
971
920
|
encodeMap.compareTokens = encodeUint.compareTokens;
|
|
@@ -973,7 +922,7 @@ encodeMap.encodedSize = /* @__PURE__ */ __name(function encodedSize6(token) {
|
|
|
973
922
|
return encodeUintValue.encodedSize(token.value);
|
|
974
923
|
}, "encodedSize");
|
|
975
924
|
|
|
976
|
-
// ../../../node_modules
|
|
925
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/6tag.js
|
|
977
926
|
function decodeTagCompact(_data, _pos, minor, _options) {
|
|
978
927
|
return new Token(Type.tag, minor, 1);
|
|
979
928
|
}
|
|
@@ -994,8 +943,8 @@ function decodeTag64(data, pos, _minor, options) {
|
|
|
994
943
|
return new Token(Type.tag, readUint64(data, pos + 1, options), 9);
|
|
995
944
|
}
|
|
996
945
|
__name(decodeTag64, "decodeTag64");
|
|
997
|
-
function encodeTag(
|
|
998
|
-
encodeUintValue(
|
|
946
|
+
function encodeTag(writer, token) {
|
|
947
|
+
encodeUintValue(writer, Type.tag.majorEncoded, token.value);
|
|
999
948
|
}
|
|
1000
949
|
__name(encodeTag, "encodeTag");
|
|
1001
950
|
encodeTag.compareTokens = encodeUint.compareTokens;
|
|
@@ -1003,7 +952,7 @@ encodeTag.encodedSize = /* @__PURE__ */ __name(function encodedSize7(token) {
|
|
|
1003
952
|
return encodeUintValue.encodedSize(token.value);
|
|
1004
953
|
}, "encodedSize");
|
|
1005
954
|
|
|
1006
|
-
// ../../../node_modules
|
|
955
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/7float.js
|
|
1007
956
|
var MINOR_FALSE = 20;
|
|
1008
957
|
var MINOR_TRUE = 21;
|
|
1009
958
|
var MINOR_NULL = 22;
|
|
@@ -1048,16 +997,16 @@ function decodeFloat64(data, pos, _minor, options) {
|
|
|
1048
997
|
return createToken(readFloat64(data, pos + 1), 9, options);
|
|
1049
998
|
}
|
|
1050
999
|
__name(decodeFloat64, "decodeFloat64");
|
|
1051
|
-
function encodeFloat(
|
|
1000
|
+
function encodeFloat(writer, token, options) {
|
|
1052
1001
|
const float = token.value;
|
|
1053
1002
|
if (float === false) {
|
|
1054
|
-
|
|
1003
|
+
writer.push([Type.float.majorEncoded | MINOR_FALSE]);
|
|
1055
1004
|
} else if (float === true) {
|
|
1056
|
-
|
|
1005
|
+
writer.push([Type.float.majorEncoded | MINOR_TRUE]);
|
|
1057
1006
|
} else if (float === null) {
|
|
1058
|
-
|
|
1007
|
+
writer.push([Type.float.majorEncoded | MINOR_NULL]);
|
|
1059
1008
|
} else if (float === void 0) {
|
|
1060
|
-
|
|
1009
|
+
writer.push([Type.float.majorEncoded | MINOR_UNDEFINED]);
|
|
1061
1010
|
} else {
|
|
1062
1011
|
let decoded;
|
|
1063
1012
|
let success = false;
|
|
@@ -1066,14 +1015,14 @@ function encodeFloat(buf2, token, options) {
|
|
|
1066
1015
|
decoded = readFloat16(ui8a, 1);
|
|
1067
1016
|
if (float === decoded || Number.isNaN(float)) {
|
|
1068
1017
|
ui8a[0] = 249;
|
|
1069
|
-
|
|
1018
|
+
writer.push(ui8a.slice(0, 3));
|
|
1070
1019
|
success = true;
|
|
1071
1020
|
} else {
|
|
1072
1021
|
encodeFloat32(float);
|
|
1073
1022
|
decoded = readFloat32(ui8a, 1);
|
|
1074
1023
|
if (float === decoded) {
|
|
1075
1024
|
ui8a[0] = 250;
|
|
1076
|
-
|
|
1025
|
+
writer.push(ui8a.slice(0, 5));
|
|
1077
1026
|
success = true;
|
|
1078
1027
|
}
|
|
1079
1028
|
}
|
|
@@ -1082,7 +1031,7 @@ function encodeFloat(buf2, token, options) {
|
|
|
1082
1031
|
encodeFloat64(float);
|
|
1083
1032
|
decoded = readFloat64(ui8a, 1);
|
|
1084
1033
|
ui8a[0] = 251;
|
|
1085
|
-
|
|
1034
|
+
writer.push(ui8a.slice(0, 9));
|
|
1086
1035
|
}
|
|
1087
1036
|
}
|
|
1088
1037
|
}
|
|
@@ -1192,7 +1141,7 @@ function readFloat64(ui8a2, pos) {
|
|
|
1192
1141
|
__name(readFloat64, "readFloat64");
|
|
1193
1142
|
encodeFloat.compareTokens = encodeUint.compareTokens;
|
|
1194
1143
|
|
|
1195
|
-
// ../../../node_modules
|
|
1144
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/jump.js
|
|
1196
1145
|
function invalidMinor(data, pos, minor) {
|
|
1197
1146
|
throw new Error(`${decodeErrPrefix} encountered invalid minor (${minor}) for major ${data[pos] >>> 5}`);
|
|
1198
1147
|
}
|
|
@@ -1351,7 +1300,7 @@ function quickEncodeToken(token) {
|
|
|
1351
1300
|
}
|
|
1352
1301
|
__name(quickEncodeToken, "quickEncodeToken");
|
|
1353
1302
|
|
|
1354
|
-
// ../../../node_modules
|
|
1303
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/encode.js
|
|
1355
1304
|
var defaultEncodeOptions = {
|
|
1356
1305
|
float64: false,
|
|
1357
1306
|
mapSorter,
|
|
@@ -1376,7 +1325,7 @@ function makeCborEncoders() {
|
|
|
1376
1325
|
}
|
|
1377
1326
|
__name(makeCborEncoders, "makeCborEncoders");
|
|
1378
1327
|
var cborEncoders = makeCborEncoders();
|
|
1379
|
-
var
|
|
1328
|
+
var defaultWriter = new Bl();
|
|
1380
1329
|
var _Ref = class _Ref {
|
|
1381
1330
|
/**
|
|
1382
1331
|
* @param {object|any[]} obj
|
|
@@ -1557,27 +1506,38 @@ var typeEncoders = {
|
|
|
1557
1506
|
Object(obj, typ, options, refStack) {
|
|
1558
1507
|
const isMap = typ !== "Object";
|
|
1559
1508
|
const keys = isMap ? obj.keys() : Object.keys(obj);
|
|
1560
|
-
const
|
|
1561
|
-
|
|
1509
|
+
const maxLength = isMap ? obj.size : keys.length;
|
|
1510
|
+
let entries;
|
|
1511
|
+
if (maxLength) {
|
|
1512
|
+
entries = new Array(maxLength);
|
|
1513
|
+
refStack = Ref.createCheck(refStack, obj);
|
|
1514
|
+
const skipUndefined = !isMap && options.ignoreUndefinedProperties;
|
|
1515
|
+
let i = 0;
|
|
1516
|
+
for (const key of keys) {
|
|
1517
|
+
const value = isMap ? obj.get(key) : obj[key];
|
|
1518
|
+
if (skipUndefined && value === void 0) {
|
|
1519
|
+
continue;
|
|
1520
|
+
}
|
|
1521
|
+
entries[i++] = [
|
|
1522
|
+
objectToTokens(key, options, refStack),
|
|
1523
|
+
objectToTokens(value, options, refStack)
|
|
1524
|
+
];
|
|
1525
|
+
}
|
|
1526
|
+
if (i < maxLength) {
|
|
1527
|
+
entries.length = i;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
if (!entries?.length) {
|
|
1562
1531
|
if (options.addBreakTokens === true) {
|
|
1563
1532
|
return [simpleTokens.emptyMap, new Token(Type.break)];
|
|
1564
1533
|
}
|
|
1565
1534
|
return simpleTokens.emptyMap;
|
|
1566
1535
|
}
|
|
1567
|
-
refStack = Ref.createCheck(refStack, obj);
|
|
1568
|
-
const entries = [];
|
|
1569
|
-
let i = 0;
|
|
1570
|
-
for (const key of keys) {
|
|
1571
|
-
entries[i++] = [
|
|
1572
|
-
objectToTokens(key, options, refStack),
|
|
1573
|
-
objectToTokens(isMap ? obj.get(key) : obj[key], options, refStack)
|
|
1574
|
-
];
|
|
1575
|
-
}
|
|
1576
1536
|
sortMapEntries(entries, options);
|
|
1577
1537
|
if (options.addBreakTokens) {
|
|
1578
|
-
return [new Token(Type.map, length), entries, new Token(Type.break)];
|
|
1538
|
+
return [new Token(Type.map, entries.length), entries, new Token(Type.break)];
|
|
1579
1539
|
}
|
|
1580
|
-
return [new Token(Type.map, length), entries];
|
|
1540
|
+
return [new Token(Type.map, entries.length), entries];
|
|
1581
1541
|
}
|
|
1582
1542
|
};
|
|
1583
1543
|
typeEncoders.Map = typeEncoders.Object;
|
|
@@ -1647,46 +1607,149 @@ function encodeRfc8949(data) {
|
|
|
1647
1607
|
return encodeCustom(data, cborEncoders, rfc8949EncodeOptions);
|
|
1648
1608
|
}
|
|
1649
1609
|
__name(encodeRfc8949, "encodeRfc8949");
|
|
1650
|
-
function tokensToEncoded(
|
|
1610
|
+
function tokensToEncoded(writer, tokens, encoders, options) {
|
|
1651
1611
|
if (Array.isArray(tokens)) {
|
|
1652
1612
|
for (const token of tokens) {
|
|
1653
|
-
tokensToEncoded(
|
|
1613
|
+
tokensToEncoded(writer, token, encoders, options);
|
|
1654
1614
|
}
|
|
1655
1615
|
} else {
|
|
1656
|
-
encoders[tokens.type.major](
|
|
1616
|
+
encoders[tokens.type.major](writer, tokens, options);
|
|
1657
1617
|
}
|
|
1658
1618
|
}
|
|
1659
1619
|
__name(tokensToEncoded, "tokensToEncoded");
|
|
1660
|
-
|
|
1620
|
+
var MAJOR_UINT = Type.uint.majorEncoded;
|
|
1621
|
+
var MAJOR_NEGINT = Type.negint.majorEncoded;
|
|
1622
|
+
var MAJOR_BYTES = Type.bytes.majorEncoded;
|
|
1623
|
+
var MAJOR_STRING = Type.string.majorEncoded;
|
|
1624
|
+
var MAJOR_ARRAY = Type.array.majorEncoded;
|
|
1625
|
+
var SIMPLE_FALSE = Type.float.majorEncoded | MINOR_FALSE;
|
|
1626
|
+
var SIMPLE_TRUE = Type.float.majorEncoded | MINOR_TRUE;
|
|
1627
|
+
var SIMPLE_NULL = Type.float.majorEncoded | MINOR_NULL;
|
|
1628
|
+
var SIMPLE_UNDEFINED = Type.float.majorEncoded | MINOR_UNDEFINED;
|
|
1629
|
+
var neg1b2 = BigInt(-1);
|
|
1630
|
+
var pos1b2 = BigInt(1);
|
|
1631
|
+
function canDirectEncode(options) {
|
|
1632
|
+
return options.addBreakTokens !== true;
|
|
1633
|
+
}
|
|
1634
|
+
__name(canDirectEncode, "canDirectEncode");
|
|
1635
|
+
function directEncode(writer, data, options, refStack) {
|
|
1636
|
+
const typ = is(data);
|
|
1637
|
+
const customEncoder = options.typeEncoders && options.typeEncoders[typ];
|
|
1638
|
+
if (customEncoder) {
|
|
1639
|
+
const tokens = customEncoder(data, typ, options, refStack);
|
|
1640
|
+
if (tokens != null) {
|
|
1641
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
switch (typ) {
|
|
1646
|
+
case "null":
|
|
1647
|
+
writer.push([SIMPLE_NULL]);
|
|
1648
|
+
return;
|
|
1649
|
+
case "undefined":
|
|
1650
|
+
writer.push([SIMPLE_UNDEFINED]);
|
|
1651
|
+
return;
|
|
1652
|
+
case "boolean":
|
|
1653
|
+
writer.push([data ? SIMPLE_TRUE : SIMPLE_FALSE]);
|
|
1654
|
+
return;
|
|
1655
|
+
case "number":
|
|
1656
|
+
if (!Number.isInteger(data) || !Number.isSafeInteger(data)) {
|
|
1657
|
+
encodeFloat(writer, new Token(Type.float, data), options);
|
|
1658
|
+
} else if (data >= 0) {
|
|
1659
|
+
encodeUintValue(writer, MAJOR_UINT, data);
|
|
1660
|
+
} else {
|
|
1661
|
+
encodeUintValue(writer, MAJOR_NEGINT, data * -1 - 1);
|
|
1662
|
+
}
|
|
1663
|
+
return;
|
|
1664
|
+
case "bigint":
|
|
1665
|
+
if (data >= BigInt(0)) {
|
|
1666
|
+
encodeUintValue(writer, MAJOR_UINT, data);
|
|
1667
|
+
} else {
|
|
1668
|
+
encodeUintValue(writer, MAJOR_NEGINT, data * neg1b2 - pos1b2);
|
|
1669
|
+
}
|
|
1670
|
+
return;
|
|
1671
|
+
case "string": {
|
|
1672
|
+
const bytes = fromString(data);
|
|
1673
|
+
encodeUintValue(writer, MAJOR_STRING, bytes.length);
|
|
1674
|
+
writer.push(bytes);
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1677
|
+
case "Uint8Array":
|
|
1678
|
+
encodeUintValue(writer, MAJOR_BYTES, data.length);
|
|
1679
|
+
writer.push(data);
|
|
1680
|
+
return;
|
|
1681
|
+
case "Array":
|
|
1682
|
+
if (!data.length) {
|
|
1683
|
+
writer.push([MAJOR_ARRAY]);
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
refStack = Ref.createCheck(refStack, data);
|
|
1687
|
+
encodeUintValue(writer, MAJOR_ARRAY, data.length);
|
|
1688
|
+
for (const elem of data) {
|
|
1689
|
+
directEncode(writer, elem, options, refStack);
|
|
1690
|
+
}
|
|
1691
|
+
return;
|
|
1692
|
+
case "Object":
|
|
1693
|
+
case "Map":
|
|
1694
|
+
{
|
|
1695
|
+
const tokens = typeEncoders.Object(data, typ, options, refStack);
|
|
1696
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
1697
|
+
}
|
|
1698
|
+
return;
|
|
1699
|
+
default: {
|
|
1700
|
+
const typeEncoder = typeEncoders[typ];
|
|
1701
|
+
if (!typeEncoder) {
|
|
1702
|
+
throw new Error(`${encodeErrPrefix} unsupported type: ${typ}`);
|
|
1703
|
+
}
|
|
1704
|
+
const tokens = typeEncoder(data, typ, options, refStack);
|
|
1705
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
__name(directEncode, "directEncode");
|
|
1710
|
+
function encodeCustom(data, encoders, options, destination) {
|
|
1711
|
+
const hasDest = destination instanceof Uint8Array;
|
|
1712
|
+
let writeTo = hasDest ? new U8Bl(destination) : defaultWriter;
|
|
1661
1713
|
const tokens = objectToTokens(data, options);
|
|
1662
1714
|
if (!Array.isArray(tokens) && options.quickEncodeToken) {
|
|
1663
1715
|
const quickBytes = options.quickEncodeToken(tokens);
|
|
1664
1716
|
if (quickBytes) {
|
|
1717
|
+
if (hasDest) {
|
|
1718
|
+
writeTo.push(quickBytes);
|
|
1719
|
+
return writeTo.toBytes();
|
|
1720
|
+
}
|
|
1665
1721
|
return quickBytes;
|
|
1666
1722
|
}
|
|
1667
1723
|
const encoder = encoders[tokens.type.major];
|
|
1668
1724
|
if (encoder.encodedSize) {
|
|
1669
1725
|
const size = encoder.encodedSize(tokens, options);
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1726
|
+
if (!hasDest) {
|
|
1727
|
+
writeTo = new Bl(size);
|
|
1728
|
+
}
|
|
1729
|
+
encoder(writeTo, tokens, options);
|
|
1730
|
+
if (writeTo.chunks.length !== 1) {
|
|
1673
1731
|
throw new Error(`Unexpected error: pre-calculated length for ${tokens} was wrong`);
|
|
1674
1732
|
}
|
|
1675
|
-
return asU8A(
|
|
1733
|
+
return hasDest ? writeTo.toBytes() : asU8A(writeTo.chunks[0]);
|
|
1676
1734
|
}
|
|
1677
1735
|
}
|
|
1678
|
-
|
|
1679
|
-
tokensToEncoded(
|
|
1680
|
-
return
|
|
1736
|
+
writeTo.reset();
|
|
1737
|
+
tokensToEncoded(writeTo, tokens, encoders, options);
|
|
1738
|
+
return writeTo.toBytes(true);
|
|
1681
1739
|
}
|
|
1682
1740
|
__name(encodeCustom, "encodeCustom");
|
|
1683
1741
|
function encode(data, options) {
|
|
1684
1742
|
options = Object.assign({}, defaultEncodeOptions, options);
|
|
1743
|
+
if (canDirectEncode(options)) {
|
|
1744
|
+
defaultWriter.reset();
|
|
1745
|
+
directEncode(defaultWriter, data, options, void 0);
|
|
1746
|
+
return defaultWriter.toBytes(true);
|
|
1747
|
+
}
|
|
1685
1748
|
return encodeCustom(data, cborEncoders, options);
|
|
1686
1749
|
}
|
|
1687
1750
|
__name(encode, "encode");
|
|
1688
1751
|
|
|
1689
|
-
// ../../../node_modules
|
|
1752
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/decode.js
|
|
1690
1753
|
var defaultDecodeOptions = {
|
|
1691
1754
|
strict: false,
|
|
1692
1755
|
allowIndefinite: true,
|
|
@@ -1748,6 +1811,7 @@ function tokenToArray(token, tokeniser, options) {
|
|
|
1748
1811
|
__name(tokenToArray, "tokenToArray");
|
|
1749
1812
|
function tokenToMap(token, tokeniser, options) {
|
|
1750
1813
|
const useMaps = options.useMaps === true;
|
|
1814
|
+
const rejectDuplicateMapKeys = options.rejectDuplicateMapKeys === true;
|
|
1751
1815
|
const obj = useMaps ? void 0 : {};
|
|
1752
1816
|
const m = useMaps ? /* @__PURE__ */ new Map() : void 0;
|
|
1753
1817
|
for (let i = 0; i < token.value; i++) {
|
|
@@ -1761,11 +1825,11 @@ function tokenToMap(token, tokeniser, options) {
|
|
|
1761
1825
|
if (key === DONE) {
|
|
1762
1826
|
throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${i} [no key], expected ${token.value})`);
|
|
1763
1827
|
}
|
|
1764
|
-
if (useMaps
|
|
1828
|
+
if (!useMaps && typeof key !== "string") {
|
|
1765
1829
|
throw new Error(`${decodeErrPrefix} non-string keys not supported (got ${typeof key})`);
|
|
1766
1830
|
}
|
|
1767
|
-
if (
|
|
1768
|
-
if (useMaps && m.has(key) || !useMaps && key
|
|
1831
|
+
if (rejectDuplicateMapKeys) {
|
|
1832
|
+
if (useMaps && m.has(key) || !useMaps && Object.hasOwn(obj, key)) {
|
|
1769
1833
|
throw new Error(`${decodeErrPrefix} found repeat map key "${key}"`);
|
|
1770
1834
|
}
|
|
1771
1835
|
}
|
|
@@ -1787,19 +1851,19 @@ function tokensToObject(tokeniser, options) {
|
|
|
1787
1851
|
return DONE;
|
|
1788
1852
|
}
|
|
1789
1853
|
const token = tokeniser.next();
|
|
1790
|
-
if (token.type
|
|
1854
|
+
if (Type.equals(token.type, Type.break)) {
|
|
1791
1855
|
return BREAK;
|
|
1792
1856
|
}
|
|
1793
1857
|
if (token.type.terminal) {
|
|
1794
1858
|
return token.value;
|
|
1795
1859
|
}
|
|
1796
|
-
if (token.type
|
|
1860
|
+
if (Type.equals(token.type, Type.array)) {
|
|
1797
1861
|
return tokenToArray(token, tokeniser, options);
|
|
1798
1862
|
}
|
|
1799
|
-
if (token.type
|
|
1863
|
+
if (Type.equals(token.type, Type.map)) {
|
|
1800
1864
|
return tokenToMap(token, tokeniser, options);
|
|
1801
1865
|
}
|
|
1802
|
-
if (token.type
|
|
1866
|
+
if (Type.equals(token.type, Type.tag)) {
|
|
1803
1867
|
if (options.tags && typeof options.tags[token.value] === "function") {
|
|
1804
1868
|
const tagged = tokensToObject(tokeniser, options);
|
|
1805
1869
|
return options.tags[token.value](tagged);
|
|
@@ -1814,7 +1878,8 @@ function decodeFirst(data, options) {
|
|
|
1814
1878
|
throw new Error(`${decodeErrPrefix} data to decode must be a Uint8Array`);
|
|
1815
1879
|
}
|
|
1816
1880
|
options = Object.assign({}, defaultDecodeOptions, options);
|
|
1817
|
-
const
|
|
1881
|
+
const u8aData = asU8A(data);
|
|
1882
|
+
const tokeniser = options.tokenizer || new Tokeniser(u8aData, options);
|
|
1818
1883
|
const decoded = tokensToObject(tokeniser, options);
|
|
1819
1884
|
if (decoded === DONE) {
|
|
1820
1885
|
throw new Error(`${decodeErrPrefix} did not find any content to decode`);
|
|
@@ -1834,7 +1899,7 @@ function decode(data, options) {
|
|
|
1834
1899
|
}
|
|
1835
1900
|
__name(decode, "decode");
|
|
1836
1901
|
|
|
1837
|
-
// ../../../node_modules
|
|
1902
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/CborldError.js
|
|
1838
1903
|
var _CborldError = class _CborldError extends Error {
|
|
1839
1904
|
constructor(value, message) {
|
|
1840
1905
|
super();
|
|
@@ -1847,7 +1912,7 @@ var _CborldError = class _CborldError extends Error {
|
|
|
1847
1912
|
__name(_CborldError, "CborldError");
|
|
1848
1913
|
var CborldError = _CborldError;
|
|
1849
1914
|
|
|
1850
|
-
// ../../../node_modules
|
|
1915
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/keywords.js
|
|
1851
1916
|
var KEYWORDS = /* @__PURE__ */ new Map([
|
|
1852
1917
|
// ordered is important, do not change
|
|
1853
1918
|
["@context", 0],
|
|
@@ -1883,7 +1948,7 @@ var KEYWORDS = /* @__PURE__ */ new Map([
|
|
|
1883
1948
|
]);
|
|
1884
1949
|
var FIRST_CUSTOM_TERM_ID = 100;
|
|
1885
1950
|
|
|
1886
|
-
// ../../../node_modules
|
|
1951
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/CborldDecoder.js
|
|
1887
1952
|
var _CborldDecoder = class _CborldDecoder {
|
|
1888
1953
|
// eslint-disable-next-line no-unused-vars
|
|
1889
1954
|
decode({ value } = {}) {
|
|
@@ -1897,7 +1962,7 @@ var _CborldDecoder = class _CborldDecoder {
|
|
|
1897
1962
|
__name(_CborldDecoder, "CborldDecoder");
|
|
1898
1963
|
var CborldDecoder = _CborldDecoder;
|
|
1899
1964
|
|
|
1900
|
-
// ../../../node_modules
|
|
1965
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/registeredContexts.js
|
|
1901
1966
|
var ID_TO_URL = /* @__PURE__ */ new Map();
|
|
1902
1967
|
var URL_TO_ID = /* @__PURE__ */ new Map();
|
|
1903
1968
|
_addRegistration(16, "https://www.w3.org/ns/activitystreams");
|
|
@@ -1927,7 +1992,7 @@ function _addRegistration(id, url) {
|
|
|
1927
1992
|
}
|
|
1928
1993
|
__name(_addRegistration, "_addRegistration");
|
|
1929
1994
|
|
|
1930
|
-
// ../../../node_modules
|
|
1995
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/ContextDecoder.js
|
|
1931
1996
|
var _ContextDecoder = class _ContextDecoder extends CborldDecoder {
|
|
1932
1997
|
constructor({ reverseAppContextMap } = {}) {
|
|
1933
1998
|
super();
|
|
@@ -1968,17 +2033,17 @@ function _mapToObject(map) {
|
|
|
1968
2033
|
}
|
|
1969
2034
|
__name(_mapToObject, "_mapToObject");
|
|
1970
2035
|
|
|
1971
|
-
// ../../../node_modules
|
|
2036
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/util-browser.js
|
|
1972
2037
|
function inspect(data, options) {
|
|
1973
2038
|
return JSON.stringify(data, null, 2);
|
|
1974
2039
|
}
|
|
1975
2040
|
__name(inspect, "inspect");
|
|
1976
2041
|
|
|
1977
|
-
// ../../../node_modules
|
|
1978
|
-
var version = "3.
|
|
2042
|
+
// ../../../node_modules/js-base64/base64.mjs
|
|
2043
|
+
var version = "3.8.0";
|
|
1979
2044
|
var VERSION = version;
|
|
1980
2045
|
var _hasBuffer = typeof Buffer === "function";
|
|
1981
|
-
var _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
|
|
2046
|
+
var _TD = typeof TextDecoder === "function" ? new TextDecoder("utf-8", { ignoreBOM: true }) : void 0;
|
|
1982
2047
|
var _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
|
|
1983
2048
|
var b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
1984
2049
|
var b64chs = Array.prototype.slice.call(b64ch);
|
|
@@ -2136,7 +2201,7 @@ var gBase64 = {
|
|
|
2136
2201
|
extendBuiltins
|
|
2137
2202
|
};
|
|
2138
2203
|
|
|
2139
|
-
// ../../../node_modules
|
|
2204
|
+
// ../../../node_modules/base58-universal/lib/baseN.js
|
|
2140
2205
|
var _reverseAlphabets = {};
|
|
2141
2206
|
function encode3(input, alphabet2, maxline) {
|
|
2142
2207
|
if (!(input instanceof Uint8Array)) {
|
|
@@ -2225,7 +2290,7 @@ function decode3(input, alphabet2) {
|
|
|
2225
2290
|
}
|
|
2226
2291
|
__name(decode3, "decode");
|
|
2227
2292
|
|
|
2228
|
-
// ../../../node_modules
|
|
2293
|
+
// ../../../node_modules/base58-universal/lib/index.js
|
|
2229
2294
|
var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
2230
2295
|
function encode4(input, maxline) {
|
|
2231
2296
|
return encode3(input, alphabet, maxline);
|
|
@@ -2236,7 +2301,7 @@ function decode4(input) {
|
|
|
2236
2301
|
}
|
|
2237
2302
|
__name(decode4, "decode");
|
|
2238
2303
|
|
|
2239
|
-
// ../../../node_modules
|
|
2304
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseDecoder.js
|
|
2240
2305
|
var _MultibaseDecoder = class _MultibaseDecoder extends CborldDecoder {
|
|
2241
2306
|
decode({ value } = {}) {
|
|
2242
2307
|
const { buffer: buffer2, byteOffset, length } = value;
|
|
@@ -2261,7 +2326,7 @@ var _MultibaseDecoder = class _MultibaseDecoder extends CborldDecoder {
|
|
|
2261
2326
|
__name(_MultibaseDecoder, "MultibaseDecoder");
|
|
2262
2327
|
var MultibaseDecoder = _MultibaseDecoder;
|
|
2263
2328
|
|
|
2264
|
-
// ../../../node_modules
|
|
2329
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/Transformer.js
|
|
2265
2330
|
var _Transformer = class _Transformer {
|
|
2266
2331
|
/**
|
|
2267
2332
|
* Creates a new Transformer for transforming CBOR-LD <=> JSON-LD.
|
|
@@ -2641,7 +2706,7 @@ var _Transformer = class _Transformer {
|
|
|
2641
2706
|
__name(_Transformer, "Transformer");
|
|
2642
2707
|
var Transformer = _Transformer;
|
|
2643
2708
|
|
|
2644
|
-
// ../../../node_modules
|
|
2709
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlDecoder.js
|
|
2645
2710
|
var ID_TO_SCHEME = /* @__PURE__ */ new Map([
|
|
2646
2711
|
// Note: only v1 mainnet is supported
|
|
2647
2712
|
[1024, "did:v1:nym:"],
|
|
@@ -2677,7 +2742,7 @@ var _Base58DidUrlDecoder = class _Base58DidUrlDecoder extends CborldDecoder {
|
|
|
2677
2742
|
__name(_Base58DidUrlDecoder, "Base58DidUrlDecoder");
|
|
2678
2743
|
var Base58DidUrlDecoder = _Base58DidUrlDecoder;
|
|
2679
2744
|
|
|
2680
|
-
// ../../../node_modules
|
|
2745
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlDecoder.js
|
|
2681
2746
|
var _HttpUrlDecoder = class _HttpUrlDecoder extends CborldDecoder {
|
|
2682
2747
|
constructor({ secure } = {}) {
|
|
2683
2748
|
super();
|
|
@@ -2697,17 +2762,17 @@ var _HttpUrlDecoder = class _HttpUrlDecoder extends CborldDecoder {
|
|
|
2697
2762
|
__name(_HttpUrlDecoder, "HttpUrlDecoder");
|
|
2698
2763
|
var HttpUrlDecoder = _HttpUrlDecoder;
|
|
2699
2764
|
|
|
2700
|
-
// ../../../node_modules
|
|
2765
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/regex.js
|
|
2701
2766
|
var regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
2702
2767
|
|
|
2703
|
-
// ../../../node_modules
|
|
2768
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/validate.js
|
|
2704
2769
|
function validate(uuid) {
|
|
2705
2770
|
return typeof uuid === "string" && regex_default.test(uuid);
|
|
2706
2771
|
}
|
|
2707
2772
|
__name(validate, "validate");
|
|
2708
2773
|
var validate_default = validate;
|
|
2709
2774
|
|
|
2710
|
-
// ../../../node_modules
|
|
2775
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/stringify.js
|
|
2711
2776
|
var byteToHex = [];
|
|
2712
2777
|
for (let i = 0; i < 256; ++i) {
|
|
2713
2778
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -2726,7 +2791,7 @@ function stringify(arr, offset = 0) {
|
|
|
2726
2791
|
__name(stringify, "stringify");
|
|
2727
2792
|
var stringify_default = stringify;
|
|
2728
2793
|
|
|
2729
|
-
// ../../../node_modules
|
|
2794
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/parse.js
|
|
2730
2795
|
function parse(uuid) {
|
|
2731
2796
|
if (!validate_default(uuid)) {
|
|
2732
2797
|
throw TypeError("Invalid UUID");
|
|
@@ -2754,7 +2819,7 @@ function parse(uuid) {
|
|
|
2754
2819
|
__name(parse, "parse");
|
|
2755
2820
|
var parse_default = parse;
|
|
2756
2821
|
|
|
2757
|
-
// ../../../node_modules
|
|
2822
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnDecoder.js
|
|
2758
2823
|
var _UuidUrnDecoder = class _UuidUrnDecoder extends CborldDecoder {
|
|
2759
2824
|
decode({ value } = {}) {
|
|
2760
2825
|
const uuid = typeof value[1] === "string" ? value[1] : stringify_default(value[1]);
|
|
@@ -2769,7 +2834,7 @@ var _UuidUrnDecoder = class _UuidUrnDecoder extends CborldDecoder {
|
|
|
2769
2834
|
__name(_UuidUrnDecoder, "UuidUrnDecoder");
|
|
2770
2835
|
var UuidUrnDecoder = _UuidUrnDecoder;
|
|
2771
2836
|
|
|
2772
|
-
// ../../../node_modules
|
|
2837
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UriDecoder.js
|
|
2773
2838
|
var SCHEME_ID_TO_DECODER = /* @__PURE__ */ new Map([
|
|
2774
2839
|
[1, HttpUrlDecoder],
|
|
2775
2840
|
[2, HttpUrlDecoder],
|
|
@@ -2789,7 +2854,7 @@ var _UriDecoder = class _UriDecoder extends CborldDecoder {
|
|
|
2789
2854
|
__name(_UriDecoder, "UriDecoder");
|
|
2790
2855
|
var UriDecoder = _UriDecoder;
|
|
2791
2856
|
|
|
2792
|
-
// ../../../node_modules
|
|
2857
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermDecoder.js
|
|
2793
2858
|
var _VocabTermDecoder = class _VocabTermDecoder extends CborldDecoder {
|
|
2794
2859
|
constructor({ term } = {}) {
|
|
2795
2860
|
super();
|
|
@@ -2811,7 +2876,7 @@ var _VocabTermDecoder = class _VocabTermDecoder extends CborldDecoder {
|
|
|
2811
2876
|
__name(_VocabTermDecoder, "VocabTermDecoder");
|
|
2812
2877
|
var VocabTermDecoder = _VocabTermDecoder;
|
|
2813
2878
|
|
|
2814
|
-
// ../../../node_modules
|
|
2879
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateDecoder.js
|
|
2815
2880
|
var _XsdDateDecoder = class _XsdDateDecoder extends CborldDecoder {
|
|
2816
2881
|
decode({ value } = {}) {
|
|
2817
2882
|
const dateString = new Date(value * 1e3).toISOString();
|
|
@@ -2826,7 +2891,7 @@ var _XsdDateDecoder = class _XsdDateDecoder extends CborldDecoder {
|
|
|
2826
2891
|
__name(_XsdDateDecoder, "XsdDateDecoder");
|
|
2827
2892
|
var XsdDateDecoder = _XsdDateDecoder;
|
|
2828
2893
|
|
|
2829
|
-
// ../../../node_modules
|
|
2894
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeDecoder.js
|
|
2830
2895
|
var _XsdDateTimeDecoder = class _XsdDateTimeDecoder extends CborldDecoder {
|
|
2831
2896
|
constructor({ value } = {}) {
|
|
2832
2897
|
super();
|
|
@@ -2850,7 +2915,7 @@ var _XsdDateTimeDecoder = class _XsdDateTimeDecoder extends CborldDecoder {
|
|
|
2850
2915
|
__name(_XsdDateTimeDecoder, "XsdDateTimeDecoder");
|
|
2851
2916
|
var XsdDateTimeDecoder = _XsdDateTimeDecoder;
|
|
2852
2917
|
|
|
2853
|
-
// ../../../node_modules
|
|
2918
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/Decompressor.js
|
|
2854
2919
|
var TYPE_DECODERS = /* @__PURE__ */ new Map([
|
|
2855
2920
|
["@id", UriDecoder],
|
|
2856
2921
|
["@vocab", VocabTermDecoder],
|
|
@@ -3067,7 +3132,7 @@ function _sortEntriesByTerm([{ term: t1 }], [{ term: t2 }]) {
|
|
|
3067
3132
|
}
|
|
3068
3133
|
__name(_sortEntriesByTerm, "_sortEntriesByTerm");
|
|
3069
3134
|
|
|
3070
|
-
// ../../../node_modules
|
|
3135
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/decode.js
|
|
3071
3136
|
async function decode5({
|
|
3072
3137
|
cborldBytes,
|
|
3073
3138
|
documentLoader,
|
|
@@ -3121,7 +3186,7 @@ async function decode5({
|
|
|
3121
3186
|
}
|
|
3122
3187
|
__name(decode5, "decode");
|
|
3123
3188
|
|
|
3124
|
-
// ../../../node_modules
|
|
3189
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/CborldEncoder.js
|
|
3125
3190
|
var _CborldEncoder = class _CborldEncoder {
|
|
3126
3191
|
encode() {
|
|
3127
3192
|
throw new Error("Must be implemented by derived class.");
|
|
@@ -3134,7 +3199,7 @@ var _CborldEncoder = class _CborldEncoder {
|
|
|
3134
3199
|
__name(_CborldEncoder, "CborldEncoder");
|
|
3135
3200
|
var CborldEncoder = _CborldEncoder;
|
|
3136
3201
|
|
|
3137
|
-
// ../../../node_modules
|
|
3202
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/ContextEncoder.js
|
|
3138
3203
|
var _ContextEncoder = class _ContextEncoder extends CborldEncoder {
|
|
3139
3204
|
constructor({ context, appContextMap } = {}) {
|
|
3140
3205
|
super();
|
|
@@ -3160,7 +3225,7 @@ var _ContextEncoder = class _ContextEncoder extends CborldEncoder {
|
|
|
3160
3225
|
__name(_ContextEncoder, "ContextEncoder");
|
|
3161
3226
|
var ContextEncoder = _ContextEncoder;
|
|
3162
3227
|
|
|
3163
|
-
// ../../../node_modules
|
|
3228
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseEncoder.js
|
|
3164
3229
|
var _MultibaseEncoder = class _MultibaseEncoder extends CborldEncoder {
|
|
3165
3230
|
constructor({ value } = {}) {
|
|
3166
3231
|
super();
|
|
@@ -3194,7 +3259,7 @@ var _MultibaseEncoder = class _MultibaseEncoder extends CborldEncoder {
|
|
|
3194
3259
|
__name(_MultibaseEncoder, "MultibaseEncoder");
|
|
3195
3260
|
var MultibaseEncoder = _MultibaseEncoder;
|
|
3196
3261
|
|
|
3197
|
-
// ../../../node_modules
|
|
3262
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlEncoder.js
|
|
3198
3263
|
var SCHEME_TO_ID = /* @__PURE__ */ new Map([
|
|
3199
3264
|
["did:v1:nym:", 1024],
|
|
3200
3265
|
["did:key:", 1025]
|
|
@@ -3240,7 +3305,7 @@ function _multibase58ToToken(str) {
|
|
|
3240
3305
|
}
|
|
3241
3306
|
__name(_multibase58ToToken, "_multibase58ToToken");
|
|
3242
3307
|
|
|
3243
|
-
// ../../../node_modules
|
|
3308
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlEncoder.js
|
|
3244
3309
|
var _HttpUrlEncoder = class _HttpUrlEncoder extends CborldEncoder {
|
|
3245
3310
|
constructor({ value, secure } = {}) {
|
|
3246
3311
|
super();
|
|
@@ -3268,7 +3333,7 @@ var _HttpUrlEncoder = class _HttpUrlEncoder extends CborldEncoder {
|
|
|
3268
3333
|
__name(_HttpUrlEncoder, "HttpUrlEncoder");
|
|
3269
3334
|
var HttpUrlEncoder = _HttpUrlEncoder;
|
|
3270
3335
|
|
|
3271
|
-
// ../../../node_modules
|
|
3336
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnEncoder.js
|
|
3272
3337
|
var _UuidUrnEncoder = class _UuidUrnEncoder extends CborldEncoder {
|
|
3273
3338
|
constructor({ value } = {}) {
|
|
3274
3339
|
super();
|
|
@@ -3295,7 +3360,7 @@ var _UuidUrnEncoder = class _UuidUrnEncoder extends CborldEncoder {
|
|
|
3295
3360
|
__name(_UuidUrnEncoder, "UuidUrnEncoder");
|
|
3296
3361
|
var UuidUrnEncoder = _UuidUrnEncoder;
|
|
3297
3362
|
|
|
3298
|
-
// ../../../node_modules
|
|
3363
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UriEncoder.js
|
|
3299
3364
|
var SCHEME_TO_ENCODER = /* @__PURE__ */ new Map([
|
|
3300
3365
|
["http", HttpUrlEncoder],
|
|
3301
3366
|
["https", HttpUrlEncoder],
|
|
@@ -3328,7 +3393,7 @@ var _UriEncoder = class _UriEncoder extends CborldEncoder {
|
|
|
3328
3393
|
__name(_UriEncoder, "UriEncoder");
|
|
3329
3394
|
var UriEncoder = _UriEncoder;
|
|
3330
3395
|
|
|
3331
|
-
// ../../../node_modules
|
|
3396
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermEncoder.js
|
|
3332
3397
|
var _VocabTermEncoder = class _VocabTermEncoder extends CborldEncoder {
|
|
3333
3398
|
constructor({ termId } = {}) {
|
|
3334
3399
|
super();
|
|
@@ -3349,7 +3414,7 @@ var _VocabTermEncoder = class _VocabTermEncoder extends CborldEncoder {
|
|
|
3349
3414
|
__name(_VocabTermEncoder, "VocabTermEncoder");
|
|
3350
3415
|
var VocabTermEncoder = _VocabTermEncoder;
|
|
3351
3416
|
|
|
3352
|
-
// ../../../node_modules
|
|
3417
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateEncoder.js
|
|
3353
3418
|
var _XsdDateEncoder = class _XsdDateEncoder extends CborldEncoder {
|
|
3354
3419
|
constructor({ value, parsed } = {}) {
|
|
3355
3420
|
super();
|
|
@@ -3380,7 +3445,7 @@ var _XsdDateEncoder = class _XsdDateEncoder extends CborldEncoder {
|
|
|
3380
3445
|
__name(_XsdDateEncoder, "XsdDateEncoder");
|
|
3381
3446
|
var XsdDateEncoder = _XsdDateEncoder;
|
|
3382
3447
|
|
|
3383
|
-
// ../../../node_modules
|
|
3448
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeEncoder.js
|
|
3384
3449
|
var _XsdDateTimeEncoder = class _XsdDateTimeEncoder extends CborldEncoder {
|
|
3385
3450
|
constructor({ value, parsed } = {}) {
|
|
3386
3451
|
super();
|
|
@@ -3428,7 +3493,7 @@ var _XsdDateTimeEncoder = class _XsdDateTimeEncoder extends CborldEncoder {
|
|
|
3428
3493
|
__name(_XsdDateTimeEncoder, "XsdDateTimeEncoder");
|
|
3429
3494
|
var XsdDateTimeEncoder = _XsdDateTimeEncoder;
|
|
3430
3495
|
|
|
3431
|
-
// ../../../node_modules
|
|
3496
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/Compressor.js
|
|
3432
3497
|
var TYPE_ENCODERS = /* @__PURE__ */ new Map([
|
|
3433
3498
|
["@id", UriEncoder],
|
|
3434
3499
|
["@vocab", VocabTermEncoder],
|
|
@@ -3584,7 +3649,7 @@ var _Compressor = class _Compressor extends Transformer {
|
|
|
3584
3649
|
__name(_Compressor, "Compressor");
|
|
3585
3650
|
var Compressor = _Compressor;
|
|
3586
3651
|
|
|
3587
|
-
// ../../../node_modules
|
|
3652
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/encode.js
|
|
3588
3653
|
async function encode5({
|
|
3589
3654
|
jsonldDocument,
|
|
3590
3655
|
documentLoader,
|
|
@@ -3617,7 +3682,7 @@ async function encode5({
|
|
|
3617
3682
|
}
|
|
3618
3683
|
__name(encode5, "encode");
|
|
3619
3684
|
|
|
3620
|
-
// ../../../node_modules
|
|
3685
|
+
// ../../../node_modules/to-data-view/index.js
|
|
3621
3686
|
function toDataView(data) {
|
|
3622
3687
|
if (data instanceof Int8Array || data instanceof Uint8Array || data instanceof Uint8ClampedArray) {
|
|
3623
3688
|
return new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
@@ -3629,7 +3694,7 @@ function toDataView(data) {
|
|
|
3629
3694
|
}
|
|
3630
3695
|
__name(toDataView, "toDataView");
|
|
3631
3696
|
|
|
3632
|
-
// ../../../node_modules
|
|
3697
|
+
// ../../../node_modules/base32-encode/index.js
|
|
3633
3698
|
var RFC4648 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
3634
3699
|
var RFC4648_HEX = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
3635
3700
|
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
@@ -3678,10 +3743,10 @@ function base32Encode(data, variant, options) {
|
|
|
3678
3743
|
}
|
|
3679
3744
|
__name(base32Encode, "base32Encode");
|
|
3680
3745
|
|
|
3681
|
-
// ../../../node_modules
|
|
3746
|
+
// ../../../node_modules/@digitalbazaar/vpqr/lib/vpqr.js
|
|
3682
3747
|
var import_base32_decode = __toESM(require_base32_decode(), 1);
|
|
3683
3748
|
|
|
3684
|
-
// ../../../node_modules
|
|
3749
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/common/Mode.js
|
|
3685
3750
|
var Mode;
|
|
3686
3751
|
(function(Mode2) {
|
|
3687
3752
|
Mode2[Mode2["Terminator"] = 0] = "Terminator";
|
|
@@ -3693,7 +3758,7 @@ var Mode;
|
|
|
3693
3758
|
Mode2[Mode2["ECI"] = 7] = "ECI";
|
|
3694
3759
|
})(Mode || (Mode = {}));
|
|
3695
3760
|
|
|
3696
|
-
// ../../../node_modules
|
|
3761
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRData.js
|
|
3697
3762
|
var _QRData = class _QRData {
|
|
3698
3763
|
constructor(mode, data) {
|
|
3699
3764
|
this.bytes = [];
|
|
@@ -3753,7 +3818,7 @@ var _QRData = class _QRData {
|
|
|
3753
3818
|
__name(_QRData, "QRData");
|
|
3754
3819
|
var QRData = _QRData;
|
|
3755
3820
|
|
|
3756
|
-
// ../../../node_modules
|
|
3821
|
+
// ../../../node_modules/@nuintun/qrcode/esm/encoding/UTF8.js
|
|
3757
3822
|
function encode6(text) {
|
|
3758
3823
|
let pos = 0;
|
|
3759
3824
|
const { length } = text;
|
|
@@ -3781,7 +3846,7 @@ function encode6(text) {
|
|
|
3781
3846
|
}
|
|
3782
3847
|
__name(encode6, "encode");
|
|
3783
3848
|
|
|
3784
|
-
// ../../../node_modules
|
|
3849
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRByte.js
|
|
3785
3850
|
var _QRByte = class _QRByte extends QRData {
|
|
3786
3851
|
/**
|
|
3787
3852
|
* @constructor
|
|
@@ -3814,7 +3879,7 @@ var _QRByte = class _QRByte extends QRData {
|
|
|
3814
3879
|
__name(_QRByte, "QRByte");
|
|
3815
3880
|
var QRByte = _QRByte;
|
|
3816
3881
|
|
|
3817
|
-
// ../../../node_modules
|
|
3882
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRMath.js
|
|
3818
3883
|
var EXP_TABLE = [];
|
|
3819
3884
|
var LOG_TABLE = [];
|
|
3820
3885
|
for (let i = 0; i < 256; i++) {
|
|
@@ -3842,7 +3907,7 @@ function gexp(n) {
|
|
|
3842
3907
|
}
|
|
3843
3908
|
__name(gexp, "gexp");
|
|
3844
3909
|
|
|
3845
|
-
// ../../../node_modules
|
|
3910
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/Polynomial.js
|
|
3846
3911
|
var _Polynomial = class _Polynomial {
|
|
3847
3912
|
constructor(num, shift = 0) {
|
|
3848
3913
|
let offset = 0;
|
|
@@ -3901,7 +3966,7 @@ var _Polynomial = class _Polynomial {
|
|
|
3901
3966
|
__name(_Polynomial, "Polynomial");
|
|
3902
3967
|
var Polynomial = _Polynomial;
|
|
3903
3968
|
|
|
3904
|
-
// ../../../node_modules
|
|
3969
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRUtil.js
|
|
3905
3970
|
var N1 = 3;
|
|
3906
3971
|
var N2 = 3;
|
|
3907
3972
|
var N3 = 40;
|
|
@@ -4080,7 +4145,7 @@ function calculateMaskPenalty(qrcode) {
|
|
|
4080
4145
|
}
|
|
4081
4146
|
__name(calculateMaskPenalty, "calculateMaskPenalty");
|
|
4082
4147
|
|
|
4083
|
-
// ../../../node_modules
|
|
4148
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/common/ErrorCorrectionLevel.js
|
|
4084
4149
|
var ErrorCorrectionLevel;
|
|
4085
4150
|
(function(ErrorCorrectionLevel2) {
|
|
4086
4151
|
ErrorCorrectionLevel2[ErrorCorrectionLevel2["L"] = 1] = "L";
|
|
@@ -4089,7 +4154,7 @@ var ErrorCorrectionLevel;
|
|
|
4089
4154
|
ErrorCorrectionLevel2[ErrorCorrectionLevel2["H"] = 2] = "H";
|
|
4090
4155
|
})(ErrorCorrectionLevel || (ErrorCorrectionLevel = {}));
|
|
4091
4156
|
|
|
4092
|
-
// ../../../node_modules
|
|
4157
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/RSBlock.js
|
|
4093
4158
|
var _RSBlock = class _RSBlock {
|
|
4094
4159
|
constructor(totalCount, dataCount) {
|
|
4095
4160
|
this.dataCount = dataCount;
|
|
@@ -4339,7 +4404,7 @@ RSBlock.RS_BLOCK_TABLE = [
|
|
|
4339
4404
|
[20, 45, 15, 61, 46, 16]
|
|
4340
4405
|
];
|
|
4341
4406
|
|
|
4342
|
-
// ../../../node_modules
|
|
4407
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/BitBuffer.js
|
|
4343
4408
|
var _BitBuffer = class _BitBuffer {
|
|
4344
4409
|
constructor() {
|
|
4345
4410
|
this.length = 0;
|
|
@@ -4373,7 +4438,7 @@ var _BitBuffer = class _BitBuffer {
|
|
|
4373
4438
|
__name(_BitBuffer, "BitBuffer");
|
|
4374
4439
|
var BitBuffer = _BitBuffer;
|
|
4375
4440
|
|
|
4376
|
-
// ../../../node_modules
|
|
4441
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/lzw/Dict.js
|
|
4377
4442
|
var MAX_CODE = (1 << 12) - 1;
|
|
4378
4443
|
var _Dict = class _Dict {
|
|
4379
4444
|
constructor(depth) {
|
|
@@ -4413,7 +4478,7 @@ var _Dict = class _Dict {
|
|
|
4413
4478
|
__name(_Dict, "Dict");
|
|
4414
4479
|
var Dict = _Dict;
|
|
4415
4480
|
|
|
4416
|
-
// ../../../node_modules
|
|
4481
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/lzw/DictStream.js
|
|
4417
4482
|
var _DictStream = class _DictStream {
|
|
4418
4483
|
constructor(dict) {
|
|
4419
4484
|
this.bits = 0;
|
|
@@ -4459,7 +4524,7 @@ var _DictStream = class _DictStream {
|
|
|
4459
4524
|
__name(_DictStream, "DictStream");
|
|
4460
4525
|
var DictStream = _DictStream;
|
|
4461
4526
|
|
|
4462
|
-
// ../../../node_modules
|
|
4527
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/lzw/index.js
|
|
4463
4528
|
function compress(pixels, depth, stream) {
|
|
4464
4529
|
const dict = new Dict(depth);
|
|
4465
4530
|
const buffer2 = new DictStream(dict);
|
|
@@ -4488,7 +4553,7 @@ function compress(pixels, depth, stream) {
|
|
|
4488
4553
|
}
|
|
4489
4554
|
__name(compress, "compress");
|
|
4490
4555
|
|
|
4491
|
-
// ../../../node_modules
|
|
4556
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/ByteStream.js
|
|
4492
4557
|
var _ByteStream = class _ByteStream {
|
|
4493
4558
|
constructor() {
|
|
4494
4559
|
this.bytes = [];
|
|
@@ -4509,7 +4574,7 @@ var _ByteStream = class _ByteStream {
|
|
|
4509
4574
|
__name(_ByteStream, "ByteStream");
|
|
4510
4575
|
var ByteStream = _ByteStream;
|
|
4511
4576
|
|
|
4512
|
-
// ../../../node_modules
|
|
4577
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/Base64Stream.js
|
|
4513
4578
|
var { fromCharCode } = String;
|
|
4514
4579
|
function encode7(byte) {
|
|
4515
4580
|
byte &= 63;
|
|
@@ -4569,7 +4634,7 @@ var _Base64Stream = class _Base64Stream {
|
|
|
4569
4634
|
__name(_Base64Stream, "Base64Stream");
|
|
4570
4635
|
var Base64Stream = _Base64Stream;
|
|
4571
4636
|
|
|
4572
|
-
// ../../../node_modules
|
|
4637
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/GIFImage.js
|
|
4573
4638
|
var _GIFImage = class _GIFImage {
|
|
4574
4639
|
constructor(width, height, { foreground = [0, 0, 0], background = [255, 255, 255] } = {}) {
|
|
4575
4640
|
this.pixels = [];
|
|
@@ -4618,7 +4683,7 @@ var _GIFImage = class _GIFImage {
|
|
|
4618
4683
|
__name(_GIFImage, "GIFImage");
|
|
4619
4684
|
var GIFImage = _GIFImage;
|
|
4620
4685
|
|
|
4621
|
-
// ../../../node_modules
|
|
4686
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/common/MaskPattern.js
|
|
4622
4687
|
function getMaskFunc(maskPattern) {
|
|
4623
4688
|
switch (maskPattern) {
|
|
4624
4689
|
case 0:
|
|
@@ -4643,10 +4708,10 @@ function getMaskFunc(maskPattern) {
|
|
|
4643
4708
|
}
|
|
4644
4709
|
__name(getMaskFunc, "getMaskFunc");
|
|
4645
4710
|
|
|
4646
|
-
// ../../../node_modules
|
|
4711
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/Writer.js
|
|
4647
4712
|
var PAD0 = 236;
|
|
4648
4713
|
var PAD1 = 17;
|
|
4649
|
-
var { toString
|
|
4714
|
+
var { toString } = Object.prototype;
|
|
4650
4715
|
function appendECI(encoding, buffer2) {
|
|
4651
4716
|
if (encoding < 0 || encoding >= 1e6) {
|
|
4652
4717
|
throw new Error("byte mode encoding hint out of range");
|
|
@@ -4848,7 +4913,7 @@ var _Encoder = class _Encoder {
|
|
|
4848
4913
|
if (data instanceof QRData) {
|
|
4849
4914
|
chunks.push(data);
|
|
4850
4915
|
} else {
|
|
4851
|
-
const type =
|
|
4916
|
+
const type = toString.call(data);
|
|
4852
4917
|
if (type === "[object String]") {
|
|
4853
4918
|
chunks.push(new QRByte(data));
|
|
4854
4919
|
} else {
|
|
@@ -5086,7 +5151,7 @@ var _Encoder = class _Encoder {
|
|
|
5086
5151
|
__name(_Encoder, "Encoder");
|
|
5087
5152
|
var Encoder = _Encoder;
|
|
5088
5153
|
|
|
5089
|
-
// ../../../node_modules
|
|
5154
|
+
// ../../../node_modules/@nuintun/qrcode/esm/encoding/UTF16.js
|
|
5090
5155
|
function encode8(text) {
|
|
5091
5156
|
const { length } = text;
|
|
5092
5157
|
const bytes = [];
|
|
@@ -5097,7 +5162,7 @@ function encode8(text) {
|
|
|
5097
5162
|
}
|
|
5098
5163
|
__name(encode8, "encode");
|
|
5099
5164
|
|
|
5100
|
-
// ../../../node_modules
|
|
5165
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRAlphanumeric.js
|
|
5101
5166
|
function getByte(byte) {
|
|
5102
5167
|
if (48 <= byte && byte <= 57) {
|
|
5103
5168
|
return byte - 48;
|
|
@@ -5168,7 +5233,7 @@ var _QRAlphanumeric = class _QRAlphanumeric extends QRData {
|
|
|
5168
5233
|
__name(_QRAlphanumeric, "QRAlphanumeric");
|
|
5169
5234
|
var QRAlphanumeric = _QRAlphanumeric;
|
|
5170
5235
|
|
|
5171
|
-
// ../../../node_modules
|
|
5236
|
+
// ../../../node_modules/@digitalbazaar/vpqr/lib/vpqr.js
|
|
5172
5237
|
var VP_QR_VERSION = "VP1";
|
|
5173
5238
|
var BASE_32_UPPERCASE_MULTIBASE_PREFIX = "B";
|
|
5174
5239
|
function _bytesToQrCodeDataUrl({ bytes, size }) {
|