@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
package/dist/vpqr-plugin.esm.js
CHANGED
|
@@ -6,11 +6,7 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
|
|
10
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
-
} catch (e) {
|
|
12
|
-
throw mod = 0, e;
|
|
13
|
-
}
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
10
|
};
|
|
15
11
|
var __copyProps = (to, from, except, desc) => {
|
|
16
12
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -29,9 +25,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
25
|
mod
|
|
30
26
|
));
|
|
31
27
|
|
|
32
|
-
// ../../../node_modules
|
|
28
|
+
// ../../../node_modules/base32-decode/index.js
|
|
33
29
|
var require_base32_decode = __commonJS({
|
|
34
|
-
"../../../node_modules
|
|
30
|
+
"../../../node_modules/base32-decode/index.js"(exports, module) {
|
|
35
31
|
"use strict";
|
|
36
32
|
var RFC46482 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
37
33
|
var RFC4648_HEX2 = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
@@ -81,24 +77,10 @@ var require_base32_decode = __commonJS({
|
|
|
81
77
|
}
|
|
82
78
|
});
|
|
83
79
|
|
|
84
|
-
// ../../../node_modules
|
|
85
|
-
var typeofs = [
|
|
86
|
-
"string",
|
|
87
|
-
"number",
|
|
88
|
-
"bigint",
|
|
89
|
-
"symbol"
|
|
90
|
-
];
|
|
80
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/is.js
|
|
91
81
|
var objectTypeNames = [
|
|
92
|
-
"Function",
|
|
93
|
-
"Generator",
|
|
94
|
-
"AsyncGenerator",
|
|
95
|
-
"GeneratorFunction",
|
|
96
|
-
"AsyncGeneratorFunction",
|
|
97
|
-
"AsyncFunction",
|
|
98
|
-
"Observable",
|
|
99
|
-
"Array",
|
|
100
|
-
"Buffer",
|
|
101
82
|
"Object",
|
|
83
|
+
// for Object.create(null) and other non-plain objects
|
|
102
84
|
"RegExp",
|
|
103
85
|
"Date",
|
|
104
86
|
"Error",
|
|
@@ -113,7 +95,6 @@ var objectTypeNames = [
|
|
|
113
95
|
"URL",
|
|
114
96
|
"HTMLElement",
|
|
115
97
|
"Int8Array",
|
|
116
|
-
"Uint8Array",
|
|
117
98
|
"Uint8ClampedArray",
|
|
118
99
|
"Int16Array",
|
|
119
100
|
"Uint16Array",
|
|
@@ -135,7 +116,7 @@ function is(value) {
|
|
|
135
116
|
return "boolean";
|
|
136
117
|
}
|
|
137
118
|
const typeOf = typeof value;
|
|
138
|
-
if (
|
|
119
|
+
if (typeOf === "string" || typeOf === "number" || typeOf === "bigint" || typeOf === "symbol") {
|
|
139
120
|
return typeOf;
|
|
140
121
|
}
|
|
141
122
|
if (typeOf === "function") {
|
|
@@ -144,8 +125,11 @@ function is(value) {
|
|
|
144
125
|
if (Array.isArray(value)) {
|
|
145
126
|
return "Array";
|
|
146
127
|
}
|
|
147
|
-
if (
|
|
148
|
-
return "
|
|
128
|
+
if (value instanceof Uint8Array) {
|
|
129
|
+
return "Uint8Array";
|
|
130
|
+
}
|
|
131
|
+
if (value.constructor === Object) {
|
|
132
|
+
return "Object";
|
|
149
133
|
}
|
|
150
134
|
const objectType = getObjectType(value);
|
|
151
135
|
if (objectType) {
|
|
@@ -154,10 +138,6 @@ function is(value) {
|
|
|
154
138
|
return "Object";
|
|
155
139
|
}
|
|
156
140
|
__name(is, "is");
|
|
157
|
-
function isBuffer(value) {
|
|
158
|
-
return value && value.constructor && value.constructor.isBuffer && value.constructor.isBuffer.call(null, value);
|
|
159
|
-
}
|
|
160
|
-
__name(isBuffer, "isBuffer");
|
|
161
141
|
function getObjectType(value) {
|
|
162
142
|
const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);
|
|
163
143
|
if (objectTypeNames.includes(objectTypeName)) {
|
|
@@ -167,7 +147,7 @@ function getObjectType(value) {
|
|
|
167
147
|
}
|
|
168
148
|
__name(getObjectType, "getObjectType");
|
|
169
149
|
|
|
170
|
-
// ../../../node_modules
|
|
150
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/token.js
|
|
171
151
|
var _Type = class _Type {
|
|
172
152
|
/**
|
|
173
153
|
* @param {number} major
|
|
@@ -191,6 +171,17 @@ var _Type = class _Type {
|
|
|
191
171
|
compare(typ) {
|
|
192
172
|
return this.major < typ.major ? -1 : this.major > typ.major ? 1 : 0;
|
|
193
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Check equality between two Type instances. Safe to use across different
|
|
176
|
+
* copies of the Type class (e.g., when bundlers duplicate the module).
|
|
177
|
+
* (major, name) uniquely identifies a Type; terminal is implied by these.
|
|
178
|
+
* @param {Type} a
|
|
179
|
+
* @param {Type} b
|
|
180
|
+
* @returns {boolean}
|
|
181
|
+
*/
|
|
182
|
+
static equals(a, b) {
|
|
183
|
+
return a === b || a.major === b.major && a.name === b.name;
|
|
184
|
+
}
|
|
194
185
|
};
|
|
195
186
|
__name(_Type, "Type");
|
|
196
187
|
var Type = _Type;
|
|
@@ -228,56 +219,32 @@ var _Token = class _Token {
|
|
|
228
219
|
__name(_Token, "Token");
|
|
229
220
|
var Token = _Token;
|
|
230
221
|
|
|
231
|
-
// ../../../node_modules
|
|
222
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/byte-utils.js
|
|
232
223
|
var useBuffer = globalThis.process && // @ts-ignore
|
|
233
224
|
!globalThis.process.browser && // @ts-ignore
|
|
234
225
|
globalThis.Buffer && // @ts-ignore
|
|
235
226
|
typeof globalThis.Buffer.isBuffer === "function";
|
|
236
|
-
var textDecoder = new TextDecoder();
|
|
237
227
|
var textEncoder = new TextEncoder();
|
|
238
|
-
function
|
|
239
|
-
return useBuffer && globalThis.Buffer.isBuffer(
|
|
228
|
+
function isBuffer(buf) {
|
|
229
|
+
return useBuffer && globalThis.Buffer.isBuffer(buf);
|
|
240
230
|
}
|
|
241
|
-
__name(
|
|
242
|
-
function asU8A(
|
|
243
|
-
if (!(
|
|
244
|
-
return Uint8Array.from(
|
|
231
|
+
__name(isBuffer, "isBuffer");
|
|
232
|
+
function asU8A(buf) {
|
|
233
|
+
if (!(buf instanceof Uint8Array)) {
|
|
234
|
+
return Uint8Array.from(buf);
|
|
245
235
|
}
|
|
246
|
-
return
|
|
236
|
+
return isBuffer(buf) ? new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength) : buf;
|
|
247
237
|
}
|
|
248
238
|
__name(asU8A, "asU8A");
|
|
249
|
-
var
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* @param {Uint8Array} bytes
|
|
253
|
-
* @param {number} start
|
|
254
|
-
* @param {number} end
|
|
255
|
-
*/
|
|
256
|
-
(bytes, start, end) => {
|
|
257
|
-
return end - start > 64 ? (
|
|
258
|
-
// eslint-disable-line operator-linebreak
|
|
259
|
-
// @ts-ignore
|
|
260
|
-
globalThis.Buffer.from(bytes.subarray(start, end)).toString("utf8")
|
|
261
|
-
) : utf8Slice(bytes, start, end);
|
|
262
|
-
}
|
|
263
|
-
) : (
|
|
264
|
-
// eslint-disable-line operator-linebreak
|
|
265
|
-
/**
|
|
266
|
-
* @param {Uint8Array} bytes
|
|
267
|
-
* @param {number} start
|
|
268
|
-
* @param {number} end
|
|
269
|
-
*/
|
|
270
|
-
(bytes, start, end) => {
|
|
271
|
-
return end - start > 64 ? textDecoder.decode(bytes.subarray(start, end)) : utf8Slice(bytes, start, end);
|
|
272
|
-
}
|
|
273
|
-
);
|
|
239
|
+
var FROM_STRING_THRESHOLD_BUFFER = 24;
|
|
240
|
+
var FROM_STRING_THRESHOLD_TEXTENCODER = 200;
|
|
274
241
|
var fromString = useBuffer ? (
|
|
275
242
|
// eslint-disable-line operator-linebreak
|
|
276
243
|
/**
|
|
277
244
|
* @param {string} string
|
|
278
245
|
*/
|
|
279
246
|
(string) => {
|
|
280
|
-
return string.length
|
|
247
|
+
return string.length >= FROM_STRING_THRESHOLD_BUFFER ? (
|
|
281
248
|
// eslint-disable-line operator-linebreak
|
|
282
249
|
// @ts-ignore
|
|
283
250
|
globalThis.Buffer.from(string)
|
|
@@ -289,7 +256,7 @@ var fromString = useBuffer ? (
|
|
|
289
256
|
* @param {string} string
|
|
290
257
|
*/
|
|
291
258
|
(string) => {
|
|
292
|
-
return string.length
|
|
259
|
+
return string.length >= FROM_STRING_THRESHOLD_TEXTENCODER ? textEncoder.encode(string) : utf8ToBytes(string);
|
|
293
260
|
}
|
|
294
261
|
);
|
|
295
262
|
var fromArray = /* @__PURE__ */ __name((arr) => {
|
|
@@ -302,8 +269,9 @@ var slice = useBuffer ? (
|
|
|
302
269
|
* @param {number} start
|
|
303
270
|
* @param {number} end
|
|
304
271
|
*/
|
|
272
|
+
// Buffer.slice() returns a view, not a copy, so we need special handling
|
|
305
273
|
(bytes, start, end) => {
|
|
306
|
-
if (
|
|
274
|
+
if (isBuffer(bytes)) {
|
|
307
275
|
return new Uint8Array(bytes.subarray(start, end));
|
|
308
276
|
}
|
|
309
277
|
return bytes.slice(start, end);
|
|
@@ -374,7 +342,7 @@ var alloc = useBuffer ? (
|
|
|
374
342
|
}
|
|
375
343
|
);
|
|
376
344
|
function compare(b1, b2) {
|
|
377
|
-
if (
|
|
345
|
+
if (isBuffer(b1) && isBuffer(b2)) {
|
|
378
346
|
return b1.compare(b2);
|
|
379
347
|
}
|
|
380
348
|
for (let i = 0; i < b1.length; i++) {
|
|
@@ -403,6 +371,9 @@ function utf8ToBytes(str) {
|
|
|
403
371
|
out[p++] = c >> 6 & 63 | 128;
|
|
404
372
|
out[p++] = c & 63 | 128;
|
|
405
373
|
} else {
|
|
374
|
+
if (c >= 55296 && c <= 57343) {
|
|
375
|
+
c = 65533;
|
|
376
|
+
}
|
|
406
377
|
out[p++] = c >> 12 | 224;
|
|
407
378
|
out[p++] = c >> 6 & 63 | 128;
|
|
408
379
|
out[p++] = c & 63 | 128;
|
|
@@ -411,84 +382,8 @@ function utf8ToBytes(str) {
|
|
|
411
382
|
return out;
|
|
412
383
|
}
|
|
413
384
|
__name(utf8ToBytes, "utf8ToBytes");
|
|
414
|
-
function utf8Slice(buf2, offset, end) {
|
|
415
|
-
const res = [];
|
|
416
|
-
while (offset < end) {
|
|
417
|
-
const firstByte = buf2[offset];
|
|
418
|
-
let codePoint = null;
|
|
419
|
-
let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
|
|
420
|
-
if (offset + bytesPerSequence <= end) {
|
|
421
|
-
let secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
422
|
-
switch (bytesPerSequence) {
|
|
423
|
-
case 1:
|
|
424
|
-
if (firstByte < 128) {
|
|
425
|
-
codePoint = firstByte;
|
|
426
|
-
}
|
|
427
|
-
break;
|
|
428
|
-
case 2:
|
|
429
|
-
secondByte = buf2[offset + 1];
|
|
430
|
-
if ((secondByte & 192) === 128) {
|
|
431
|
-
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
|
|
432
|
-
if (tempCodePoint > 127) {
|
|
433
|
-
codePoint = tempCodePoint;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
break;
|
|
437
|
-
case 3:
|
|
438
|
-
secondByte = buf2[offset + 1];
|
|
439
|
-
thirdByte = buf2[offset + 2];
|
|
440
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
|
|
441
|
-
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
|
|
442
|
-
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
|
|
443
|
-
codePoint = tempCodePoint;
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
break;
|
|
447
|
-
case 4:
|
|
448
|
-
secondByte = buf2[offset + 1];
|
|
449
|
-
thirdByte = buf2[offset + 2];
|
|
450
|
-
fourthByte = buf2[offset + 3];
|
|
451
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
|
|
452
|
-
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
|
|
453
|
-
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
|
|
454
|
-
codePoint = tempCodePoint;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
if (codePoint === null) {
|
|
460
|
-
codePoint = 65533;
|
|
461
|
-
bytesPerSequence = 1;
|
|
462
|
-
} else if (codePoint > 65535) {
|
|
463
|
-
codePoint -= 65536;
|
|
464
|
-
res.push(codePoint >>> 10 & 1023 | 55296);
|
|
465
|
-
codePoint = 56320 | codePoint & 1023;
|
|
466
|
-
}
|
|
467
|
-
res.push(codePoint);
|
|
468
|
-
offset += bytesPerSequence;
|
|
469
|
-
}
|
|
470
|
-
return decodeCodePointsArray(res);
|
|
471
|
-
}
|
|
472
|
-
__name(utf8Slice, "utf8Slice");
|
|
473
|
-
var MAX_ARGUMENTS_LENGTH = 4096;
|
|
474
|
-
function decodeCodePointsArray(codePoints) {
|
|
475
|
-
const len = codePoints.length;
|
|
476
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
477
|
-
return String.fromCharCode.apply(String, codePoints);
|
|
478
|
-
}
|
|
479
|
-
let res = "";
|
|
480
|
-
let i = 0;
|
|
481
|
-
while (i < len) {
|
|
482
|
-
res += String.fromCharCode.apply(
|
|
483
|
-
String,
|
|
484
|
-
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
485
|
-
);
|
|
486
|
-
}
|
|
487
|
-
return res;
|
|
488
|
-
}
|
|
489
|
-
__name(decodeCodePointsArray, "decodeCodePointsArray");
|
|
490
385
|
|
|
491
|
-
// ../../../node_modules
|
|
386
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/bl.js
|
|
492
387
|
var defaultChunkSize = 256;
|
|
493
388
|
var _Bl = class _Bl {
|
|
494
389
|
/**
|
|
@@ -570,8 +465,44 @@ var _Bl = class _Bl {
|
|
|
570
465
|
};
|
|
571
466
|
__name(_Bl, "Bl");
|
|
572
467
|
var Bl = _Bl;
|
|
468
|
+
var _U8Bl = class _U8Bl {
|
|
469
|
+
/**
|
|
470
|
+
* @param {Uint8Array} dest
|
|
471
|
+
*/
|
|
472
|
+
constructor(dest) {
|
|
473
|
+
this.dest = dest;
|
|
474
|
+
this.cursor = 0;
|
|
475
|
+
this.chunks = [dest];
|
|
476
|
+
}
|
|
477
|
+
reset() {
|
|
478
|
+
this.cursor = 0;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* @param {Uint8Array|number[]} bytes
|
|
482
|
+
*/
|
|
483
|
+
push(bytes) {
|
|
484
|
+
if (this.cursor + bytes.length > this.dest.length) {
|
|
485
|
+
throw new Error("write out of bounds, destination buffer is too small");
|
|
486
|
+
}
|
|
487
|
+
this.dest.set(bytes, this.cursor);
|
|
488
|
+
this.cursor += bytes.length;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* @param {boolean} [reset]
|
|
492
|
+
* @returns {Uint8Array}
|
|
493
|
+
*/
|
|
494
|
+
toBytes(reset = false) {
|
|
495
|
+
const byts = this.dest.subarray(0, this.cursor);
|
|
496
|
+
if (reset) {
|
|
497
|
+
this.reset();
|
|
498
|
+
}
|
|
499
|
+
return byts;
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
__name(_U8Bl, "U8Bl");
|
|
503
|
+
var U8Bl = _U8Bl;
|
|
573
504
|
|
|
574
|
-
// ../../../node_modules
|
|
505
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/common.js
|
|
575
506
|
var decodeErrPrefix = "CBOR decode error:";
|
|
576
507
|
var encodeErrPrefix = "CBOR encode error:";
|
|
577
508
|
var uintMinorPrefixBytes = [];
|
|
@@ -587,7 +518,7 @@ function assertEnoughData(data, pos, need) {
|
|
|
587
518
|
}
|
|
588
519
|
__name(assertEnoughData, "assertEnoughData");
|
|
589
520
|
|
|
590
|
-
// ../../../node_modules
|
|
521
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/0uint.js
|
|
591
522
|
var uintBoundaries = [24, 256, 65536, 4294967296, BigInt("18446744073709551616")];
|
|
592
523
|
function readUint8(data, offset, options) {
|
|
593
524
|
assertEnoughData(data, offset, 1);
|
|
@@ -649,23 +580,23 @@ function decodeUint64(data, pos, _minor, options) {
|
|
|
649
580
|
return new Token(Type.uint, readUint64(data, pos + 1, options), 9);
|
|
650
581
|
}
|
|
651
582
|
__name(decodeUint64, "decodeUint64");
|
|
652
|
-
function encodeUint(
|
|
653
|
-
return encodeUintValue(
|
|
583
|
+
function encodeUint(writer, token) {
|
|
584
|
+
return encodeUintValue(writer, 0, token.value);
|
|
654
585
|
}
|
|
655
586
|
__name(encodeUint, "encodeUint");
|
|
656
|
-
function encodeUintValue(
|
|
587
|
+
function encodeUintValue(writer, major, uint) {
|
|
657
588
|
if (uint < uintBoundaries[0]) {
|
|
658
589
|
const nuint = Number(uint);
|
|
659
|
-
|
|
590
|
+
writer.push([major | nuint]);
|
|
660
591
|
} else if (uint < uintBoundaries[1]) {
|
|
661
592
|
const nuint = Number(uint);
|
|
662
|
-
|
|
593
|
+
writer.push([major | 24, nuint]);
|
|
663
594
|
} else if (uint < uintBoundaries[2]) {
|
|
664
595
|
const nuint = Number(uint);
|
|
665
|
-
|
|
596
|
+
writer.push([major | 25, nuint >>> 8, nuint & 255]);
|
|
666
597
|
} else if (uint < uintBoundaries[3]) {
|
|
667
598
|
const nuint = Number(uint);
|
|
668
|
-
|
|
599
|
+
writer.push([major | 26, nuint >>> 24 & 255, nuint >>> 16 & 255, nuint >>> 8 & 255, nuint & 255]);
|
|
669
600
|
} else {
|
|
670
601
|
const buint = BigInt(uint);
|
|
671
602
|
if (buint < uintBoundaries[4]) {
|
|
@@ -686,7 +617,7 @@ function encodeUintValue(buf2, major, uint) {
|
|
|
686
617
|
set[2] = hi & 255;
|
|
687
618
|
hi = hi >> 8;
|
|
688
619
|
set[1] = hi & 255;
|
|
689
|
-
|
|
620
|
+
writer.push(set);
|
|
690
621
|
} else {
|
|
691
622
|
throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`);
|
|
692
623
|
}
|
|
@@ -718,7 +649,7 @@ encodeUint.compareTokens = /* @__PURE__ */ __name(function compareTokens(tok1, t
|
|
|
718
649
|
);
|
|
719
650
|
}, "compareTokens");
|
|
720
651
|
|
|
721
|
-
// ../../../node_modules
|
|
652
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/1negint.js
|
|
722
653
|
function decodeNegint8(data, pos, _minor, options) {
|
|
723
654
|
return new Token(Type.negint, -1 - readUint8(data, pos + 1, options), 2);
|
|
724
655
|
}
|
|
@@ -747,10 +678,10 @@ function decodeNegint64(data, pos, _minor, options) {
|
|
|
747
678
|
return new Token(Type.negint, neg1b - BigInt(int), 9);
|
|
748
679
|
}
|
|
749
680
|
__name(decodeNegint64, "decodeNegint64");
|
|
750
|
-
function encodeNegint(
|
|
681
|
+
function encodeNegint(writer, token) {
|
|
751
682
|
const negint = token.value;
|
|
752
683
|
const unsigned = typeof negint === "bigint" ? negint * neg1b - pos1b : negint * -1 - 1;
|
|
753
|
-
encodeUintValue(
|
|
684
|
+
encodeUintValue(writer, token.type.majorEncoded, unsigned);
|
|
754
685
|
}
|
|
755
686
|
__name(encodeNegint, "encodeNegint");
|
|
756
687
|
encodeNegint.encodedSize = /* @__PURE__ */ __name(function encodedSize3(token) {
|
|
@@ -777,11 +708,11 @@ encodeNegint.compareTokens = /* @__PURE__ */ __name(function compareTokens2(tok1
|
|
|
777
708
|
);
|
|
778
709
|
}, "compareTokens");
|
|
779
710
|
|
|
780
|
-
// ../../../node_modules
|
|
711
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/2bytes.js
|
|
781
712
|
function toToken(data, pos, prefix, length) {
|
|
782
713
|
assertEnoughData(data, pos, prefix + length);
|
|
783
|
-
const
|
|
784
|
-
return new Token(Type.bytes,
|
|
714
|
+
const buf = data.slice(pos + prefix, pos + prefix + length);
|
|
715
|
+
return new Token(Type.bytes, buf, prefix + length);
|
|
785
716
|
}
|
|
786
717
|
__name(toToken, "toToken");
|
|
787
718
|
function decodeBytesCompact(data, pos, minor, _options) {
|
|
@@ -810,15 +741,15 @@ function decodeBytes64(data, pos, _minor, options) {
|
|
|
810
741
|
__name(decodeBytes64, "decodeBytes64");
|
|
811
742
|
function tokenBytes(token) {
|
|
812
743
|
if (token.encodedBytes === void 0) {
|
|
813
|
-
token.encodedBytes = token.type
|
|
744
|
+
token.encodedBytes = Type.equals(token.type, Type.string) ? fromString(token.value) : token.value;
|
|
814
745
|
}
|
|
815
746
|
return token.encodedBytes;
|
|
816
747
|
}
|
|
817
748
|
__name(tokenBytes, "tokenBytes");
|
|
818
|
-
function encodeBytes(
|
|
749
|
+
function encodeBytes(writer, token) {
|
|
819
750
|
const bytes = tokenBytes(token);
|
|
820
|
-
encodeUintValue(
|
|
821
|
-
|
|
751
|
+
encodeUintValue(writer, token.type.majorEncoded, bytes.length);
|
|
752
|
+
writer.push(bytes);
|
|
822
753
|
}
|
|
823
754
|
__name(encodeBytes, "encodeBytes");
|
|
824
755
|
encodeBytes.encodedSize = /* @__PURE__ */ __name(function encodedSize4(token) {
|
|
@@ -833,13 +764,31 @@ function compareBytes(b1, b2) {
|
|
|
833
764
|
}
|
|
834
765
|
__name(compareBytes, "compareBytes");
|
|
835
766
|
|
|
836
|
-
// ../../../node_modules
|
|
767
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/3string.js
|
|
768
|
+
var textDecoder = new TextDecoder();
|
|
769
|
+
var ASCII_THRESHOLD = 32;
|
|
770
|
+
function toStr(bytes, start, end) {
|
|
771
|
+
const len = end - start;
|
|
772
|
+
if (len < ASCII_THRESHOLD) {
|
|
773
|
+
let str = "";
|
|
774
|
+
for (let i = start; i < end; i++) {
|
|
775
|
+
const c = bytes[i];
|
|
776
|
+
if (c & 128) {
|
|
777
|
+
return textDecoder.decode(bytes.subarray(start, end));
|
|
778
|
+
}
|
|
779
|
+
str += String.fromCharCode(c);
|
|
780
|
+
}
|
|
781
|
+
return str;
|
|
782
|
+
}
|
|
783
|
+
return textDecoder.decode(bytes.subarray(start, end));
|
|
784
|
+
}
|
|
785
|
+
__name(toStr, "toStr");
|
|
837
786
|
function toToken2(data, pos, prefix, length, options) {
|
|
838
787
|
const totLength = prefix + length;
|
|
839
788
|
assertEnoughData(data, pos, totLength);
|
|
840
|
-
const tok = new Token(Type.string,
|
|
789
|
+
const tok = new Token(Type.string, toStr(data, pos + prefix, pos + totLength), totLength);
|
|
841
790
|
if (options.retainStringBytes === true) {
|
|
842
|
-
tok.byteValue = slice(
|
|
791
|
+
tok.byteValue = data.slice(pos + prefix, pos + totLength);
|
|
843
792
|
}
|
|
844
793
|
return tok;
|
|
845
794
|
}
|
|
@@ -870,7 +819,7 @@ function decodeString64(data, pos, _minor, options) {
|
|
|
870
819
|
__name(decodeString64, "decodeString64");
|
|
871
820
|
var encodeString = encodeBytes;
|
|
872
821
|
|
|
873
|
-
// ../../../node_modules
|
|
822
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/4array.js
|
|
874
823
|
function toToken3(_data, _pos, prefix, length) {
|
|
875
824
|
return new Token(Type.array, length, prefix);
|
|
876
825
|
}
|
|
@@ -906,8 +855,8 @@ function decodeArrayIndefinite(data, pos, _minor, options) {
|
|
|
906
855
|
return toToken3(data, pos, 1, Infinity);
|
|
907
856
|
}
|
|
908
857
|
__name(decodeArrayIndefinite, "decodeArrayIndefinite");
|
|
909
|
-
function encodeArray(
|
|
910
|
-
encodeUintValue(
|
|
858
|
+
function encodeArray(writer, token) {
|
|
859
|
+
encodeUintValue(writer, Type.array.majorEncoded, token.value);
|
|
911
860
|
}
|
|
912
861
|
__name(encodeArray, "encodeArray");
|
|
913
862
|
encodeArray.compareTokens = encodeUint.compareTokens;
|
|
@@ -915,7 +864,7 @@ encodeArray.encodedSize = /* @__PURE__ */ __name(function encodedSize5(token) {
|
|
|
915
864
|
return encodeUintValue.encodedSize(token.value);
|
|
916
865
|
}, "encodedSize");
|
|
917
866
|
|
|
918
|
-
// ../../../node_modules
|
|
867
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/5map.js
|
|
919
868
|
function toToken4(_data, _pos, prefix, length) {
|
|
920
869
|
return new Token(Type.map, length, prefix);
|
|
921
870
|
}
|
|
@@ -951,8 +900,8 @@ function decodeMapIndefinite(data, pos, _minor, options) {
|
|
|
951
900
|
return toToken4(data, pos, 1, Infinity);
|
|
952
901
|
}
|
|
953
902
|
__name(decodeMapIndefinite, "decodeMapIndefinite");
|
|
954
|
-
function encodeMap(
|
|
955
|
-
encodeUintValue(
|
|
903
|
+
function encodeMap(writer, token) {
|
|
904
|
+
encodeUintValue(writer, Type.map.majorEncoded, token.value);
|
|
956
905
|
}
|
|
957
906
|
__name(encodeMap, "encodeMap");
|
|
958
907
|
encodeMap.compareTokens = encodeUint.compareTokens;
|
|
@@ -960,7 +909,7 @@ encodeMap.encodedSize = /* @__PURE__ */ __name(function encodedSize6(token) {
|
|
|
960
909
|
return encodeUintValue.encodedSize(token.value);
|
|
961
910
|
}, "encodedSize");
|
|
962
911
|
|
|
963
|
-
// ../../../node_modules
|
|
912
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/6tag.js
|
|
964
913
|
function decodeTagCompact(_data, _pos, minor, _options) {
|
|
965
914
|
return new Token(Type.tag, minor, 1);
|
|
966
915
|
}
|
|
@@ -981,8 +930,8 @@ function decodeTag64(data, pos, _minor, options) {
|
|
|
981
930
|
return new Token(Type.tag, readUint64(data, pos + 1, options), 9);
|
|
982
931
|
}
|
|
983
932
|
__name(decodeTag64, "decodeTag64");
|
|
984
|
-
function encodeTag(
|
|
985
|
-
encodeUintValue(
|
|
933
|
+
function encodeTag(writer, token) {
|
|
934
|
+
encodeUintValue(writer, Type.tag.majorEncoded, token.value);
|
|
986
935
|
}
|
|
987
936
|
__name(encodeTag, "encodeTag");
|
|
988
937
|
encodeTag.compareTokens = encodeUint.compareTokens;
|
|
@@ -990,7 +939,7 @@ encodeTag.encodedSize = /* @__PURE__ */ __name(function encodedSize7(token) {
|
|
|
990
939
|
return encodeUintValue.encodedSize(token.value);
|
|
991
940
|
}, "encodedSize");
|
|
992
941
|
|
|
993
|
-
// ../../../node_modules
|
|
942
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/7float.js
|
|
994
943
|
var MINOR_FALSE = 20;
|
|
995
944
|
var MINOR_TRUE = 21;
|
|
996
945
|
var MINOR_NULL = 22;
|
|
@@ -1035,16 +984,16 @@ function decodeFloat64(data, pos, _minor, options) {
|
|
|
1035
984
|
return createToken(readFloat64(data, pos + 1), 9, options);
|
|
1036
985
|
}
|
|
1037
986
|
__name(decodeFloat64, "decodeFloat64");
|
|
1038
|
-
function encodeFloat(
|
|
987
|
+
function encodeFloat(writer, token, options) {
|
|
1039
988
|
const float = token.value;
|
|
1040
989
|
if (float === false) {
|
|
1041
|
-
|
|
990
|
+
writer.push([Type.float.majorEncoded | MINOR_FALSE]);
|
|
1042
991
|
} else if (float === true) {
|
|
1043
|
-
|
|
992
|
+
writer.push([Type.float.majorEncoded | MINOR_TRUE]);
|
|
1044
993
|
} else if (float === null) {
|
|
1045
|
-
|
|
994
|
+
writer.push([Type.float.majorEncoded | MINOR_NULL]);
|
|
1046
995
|
} else if (float === void 0) {
|
|
1047
|
-
|
|
996
|
+
writer.push([Type.float.majorEncoded | MINOR_UNDEFINED]);
|
|
1048
997
|
} else {
|
|
1049
998
|
let decoded;
|
|
1050
999
|
let success = false;
|
|
@@ -1053,14 +1002,14 @@ function encodeFloat(buf2, token, options) {
|
|
|
1053
1002
|
decoded = readFloat16(ui8a, 1);
|
|
1054
1003
|
if (float === decoded || Number.isNaN(float)) {
|
|
1055
1004
|
ui8a[0] = 249;
|
|
1056
|
-
|
|
1005
|
+
writer.push(ui8a.slice(0, 3));
|
|
1057
1006
|
success = true;
|
|
1058
1007
|
} else {
|
|
1059
1008
|
encodeFloat32(float);
|
|
1060
1009
|
decoded = readFloat32(ui8a, 1);
|
|
1061
1010
|
if (float === decoded) {
|
|
1062
1011
|
ui8a[0] = 250;
|
|
1063
|
-
|
|
1012
|
+
writer.push(ui8a.slice(0, 5));
|
|
1064
1013
|
success = true;
|
|
1065
1014
|
}
|
|
1066
1015
|
}
|
|
@@ -1069,7 +1018,7 @@ function encodeFloat(buf2, token, options) {
|
|
|
1069
1018
|
encodeFloat64(float);
|
|
1070
1019
|
decoded = readFloat64(ui8a, 1);
|
|
1071
1020
|
ui8a[0] = 251;
|
|
1072
|
-
|
|
1021
|
+
writer.push(ui8a.slice(0, 9));
|
|
1073
1022
|
}
|
|
1074
1023
|
}
|
|
1075
1024
|
}
|
|
@@ -1179,7 +1128,7 @@ function readFloat64(ui8a2, pos) {
|
|
|
1179
1128
|
__name(readFloat64, "readFloat64");
|
|
1180
1129
|
encodeFloat.compareTokens = encodeUint.compareTokens;
|
|
1181
1130
|
|
|
1182
|
-
// ../../../node_modules
|
|
1131
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/jump.js
|
|
1183
1132
|
function invalidMinor(data, pos, minor) {
|
|
1184
1133
|
throw new Error(`${decodeErrPrefix} encountered invalid minor (${minor}) for major ${data[pos] >>> 5}`);
|
|
1185
1134
|
}
|
|
@@ -1338,7 +1287,7 @@ function quickEncodeToken(token) {
|
|
|
1338
1287
|
}
|
|
1339
1288
|
__name(quickEncodeToken, "quickEncodeToken");
|
|
1340
1289
|
|
|
1341
|
-
// ../../../node_modules
|
|
1290
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/encode.js
|
|
1342
1291
|
var defaultEncodeOptions = {
|
|
1343
1292
|
float64: false,
|
|
1344
1293
|
mapSorter,
|
|
@@ -1363,7 +1312,7 @@ function makeCborEncoders() {
|
|
|
1363
1312
|
}
|
|
1364
1313
|
__name(makeCborEncoders, "makeCborEncoders");
|
|
1365
1314
|
var cborEncoders = makeCborEncoders();
|
|
1366
|
-
var
|
|
1315
|
+
var defaultWriter = new Bl();
|
|
1367
1316
|
var _Ref = class _Ref {
|
|
1368
1317
|
/**
|
|
1369
1318
|
* @param {object|any[]} obj
|
|
@@ -1544,27 +1493,38 @@ var typeEncoders = {
|
|
|
1544
1493
|
Object(obj, typ, options, refStack) {
|
|
1545
1494
|
const isMap = typ !== "Object";
|
|
1546
1495
|
const keys = isMap ? obj.keys() : Object.keys(obj);
|
|
1547
|
-
const
|
|
1548
|
-
|
|
1496
|
+
const maxLength = isMap ? obj.size : keys.length;
|
|
1497
|
+
let entries;
|
|
1498
|
+
if (maxLength) {
|
|
1499
|
+
entries = new Array(maxLength);
|
|
1500
|
+
refStack = Ref.createCheck(refStack, obj);
|
|
1501
|
+
const skipUndefined = !isMap && options.ignoreUndefinedProperties;
|
|
1502
|
+
let i = 0;
|
|
1503
|
+
for (const key of keys) {
|
|
1504
|
+
const value = isMap ? obj.get(key) : obj[key];
|
|
1505
|
+
if (skipUndefined && value === void 0) {
|
|
1506
|
+
continue;
|
|
1507
|
+
}
|
|
1508
|
+
entries[i++] = [
|
|
1509
|
+
objectToTokens(key, options, refStack),
|
|
1510
|
+
objectToTokens(value, options, refStack)
|
|
1511
|
+
];
|
|
1512
|
+
}
|
|
1513
|
+
if (i < maxLength) {
|
|
1514
|
+
entries.length = i;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
if (!entries?.length) {
|
|
1549
1518
|
if (options.addBreakTokens === true) {
|
|
1550
1519
|
return [simpleTokens.emptyMap, new Token(Type.break)];
|
|
1551
1520
|
}
|
|
1552
1521
|
return simpleTokens.emptyMap;
|
|
1553
1522
|
}
|
|
1554
|
-
refStack = Ref.createCheck(refStack, obj);
|
|
1555
|
-
const entries = [];
|
|
1556
|
-
let i = 0;
|
|
1557
|
-
for (const key of keys) {
|
|
1558
|
-
entries[i++] = [
|
|
1559
|
-
objectToTokens(key, options, refStack),
|
|
1560
|
-
objectToTokens(isMap ? obj.get(key) : obj[key], options, refStack)
|
|
1561
|
-
];
|
|
1562
|
-
}
|
|
1563
1523
|
sortMapEntries(entries, options);
|
|
1564
1524
|
if (options.addBreakTokens) {
|
|
1565
|
-
return [new Token(Type.map, length), entries, new Token(Type.break)];
|
|
1525
|
+
return [new Token(Type.map, entries.length), entries, new Token(Type.break)];
|
|
1566
1526
|
}
|
|
1567
|
-
return [new Token(Type.map, length), entries];
|
|
1527
|
+
return [new Token(Type.map, entries.length), entries];
|
|
1568
1528
|
}
|
|
1569
1529
|
};
|
|
1570
1530
|
typeEncoders.Map = typeEncoders.Object;
|
|
@@ -1634,46 +1594,149 @@ function encodeRfc8949(data) {
|
|
|
1634
1594
|
return encodeCustom(data, cborEncoders, rfc8949EncodeOptions);
|
|
1635
1595
|
}
|
|
1636
1596
|
__name(encodeRfc8949, "encodeRfc8949");
|
|
1637
|
-
function tokensToEncoded(
|
|
1597
|
+
function tokensToEncoded(writer, tokens, encoders, options) {
|
|
1638
1598
|
if (Array.isArray(tokens)) {
|
|
1639
1599
|
for (const token of tokens) {
|
|
1640
|
-
tokensToEncoded(
|
|
1600
|
+
tokensToEncoded(writer, token, encoders, options);
|
|
1641
1601
|
}
|
|
1642
1602
|
} else {
|
|
1643
|
-
encoders[tokens.type.major](
|
|
1603
|
+
encoders[tokens.type.major](writer, tokens, options);
|
|
1644
1604
|
}
|
|
1645
1605
|
}
|
|
1646
1606
|
__name(tokensToEncoded, "tokensToEncoded");
|
|
1647
|
-
|
|
1607
|
+
var MAJOR_UINT = Type.uint.majorEncoded;
|
|
1608
|
+
var MAJOR_NEGINT = Type.negint.majorEncoded;
|
|
1609
|
+
var MAJOR_BYTES = Type.bytes.majorEncoded;
|
|
1610
|
+
var MAJOR_STRING = Type.string.majorEncoded;
|
|
1611
|
+
var MAJOR_ARRAY = Type.array.majorEncoded;
|
|
1612
|
+
var SIMPLE_FALSE = Type.float.majorEncoded | MINOR_FALSE;
|
|
1613
|
+
var SIMPLE_TRUE = Type.float.majorEncoded | MINOR_TRUE;
|
|
1614
|
+
var SIMPLE_NULL = Type.float.majorEncoded | MINOR_NULL;
|
|
1615
|
+
var SIMPLE_UNDEFINED = Type.float.majorEncoded | MINOR_UNDEFINED;
|
|
1616
|
+
var neg1b2 = BigInt(-1);
|
|
1617
|
+
var pos1b2 = BigInt(1);
|
|
1618
|
+
function canDirectEncode(options) {
|
|
1619
|
+
return options.addBreakTokens !== true;
|
|
1620
|
+
}
|
|
1621
|
+
__name(canDirectEncode, "canDirectEncode");
|
|
1622
|
+
function directEncode(writer, data, options, refStack) {
|
|
1623
|
+
const typ = is(data);
|
|
1624
|
+
const customEncoder = options.typeEncoders && options.typeEncoders[typ];
|
|
1625
|
+
if (customEncoder) {
|
|
1626
|
+
const tokens = customEncoder(data, typ, options, refStack);
|
|
1627
|
+
if (tokens != null) {
|
|
1628
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
switch (typ) {
|
|
1633
|
+
case "null":
|
|
1634
|
+
writer.push([SIMPLE_NULL]);
|
|
1635
|
+
return;
|
|
1636
|
+
case "undefined":
|
|
1637
|
+
writer.push([SIMPLE_UNDEFINED]);
|
|
1638
|
+
return;
|
|
1639
|
+
case "boolean":
|
|
1640
|
+
writer.push([data ? SIMPLE_TRUE : SIMPLE_FALSE]);
|
|
1641
|
+
return;
|
|
1642
|
+
case "number":
|
|
1643
|
+
if (!Number.isInteger(data) || !Number.isSafeInteger(data)) {
|
|
1644
|
+
encodeFloat(writer, new Token(Type.float, data), options);
|
|
1645
|
+
} else if (data >= 0) {
|
|
1646
|
+
encodeUintValue(writer, MAJOR_UINT, data);
|
|
1647
|
+
} else {
|
|
1648
|
+
encodeUintValue(writer, MAJOR_NEGINT, data * -1 - 1);
|
|
1649
|
+
}
|
|
1650
|
+
return;
|
|
1651
|
+
case "bigint":
|
|
1652
|
+
if (data >= BigInt(0)) {
|
|
1653
|
+
encodeUintValue(writer, MAJOR_UINT, data);
|
|
1654
|
+
} else {
|
|
1655
|
+
encodeUintValue(writer, MAJOR_NEGINT, data * neg1b2 - pos1b2);
|
|
1656
|
+
}
|
|
1657
|
+
return;
|
|
1658
|
+
case "string": {
|
|
1659
|
+
const bytes = fromString(data);
|
|
1660
|
+
encodeUintValue(writer, MAJOR_STRING, bytes.length);
|
|
1661
|
+
writer.push(bytes);
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
case "Uint8Array":
|
|
1665
|
+
encodeUintValue(writer, MAJOR_BYTES, data.length);
|
|
1666
|
+
writer.push(data);
|
|
1667
|
+
return;
|
|
1668
|
+
case "Array":
|
|
1669
|
+
if (!data.length) {
|
|
1670
|
+
writer.push([MAJOR_ARRAY]);
|
|
1671
|
+
return;
|
|
1672
|
+
}
|
|
1673
|
+
refStack = Ref.createCheck(refStack, data);
|
|
1674
|
+
encodeUintValue(writer, MAJOR_ARRAY, data.length);
|
|
1675
|
+
for (const elem of data) {
|
|
1676
|
+
directEncode(writer, elem, options, refStack);
|
|
1677
|
+
}
|
|
1678
|
+
return;
|
|
1679
|
+
case "Object":
|
|
1680
|
+
case "Map":
|
|
1681
|
+
{
|
|
1682
|
+
const tokens = typeEncoders.Object(data, typ, options, refStack);
|
|
1683
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
1684
|
+
}
|
|
1685
|
+
return;
|
|
1686
|
+
default: {
|
|
1687
|
+
const typeEncoder = typeEncoders[typ];
|
|
1688
|
+
if (!typeEncoder) {
|
|
1689
|
+
throw new Error(`${encodeErrPrefix} unsupported type: ${typ}`);
|
|
1690
|
+
}
|
|
1691
|
+
const tokens = typeEncoder(data, typ, options, refStack);
|
|
1692
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
__name(directEncode, "directEncode");
|
|
1697
|
+
function encodeCustom(data, encoders, options, destination) {
|
|
1698
|
+
const hasDest = destination instanceof Uint8Array;
|
|
1699
|
+
let writeTo = hasDest ? new U8Bl(destination) : defaultWriter;
|
|
1648
1700
|
const tokens = objectToTokens(data, options);
|
|
1649
1701
|
if (!Array.isArray(tokens) && options.quickEncodeToken) {
|
|
1650
1702
|
const quickBytes = options.quickEncodeToken(tokens);
|
|
1651
1703
|
if (quickBytes) {
|
|
1704
|
+
if (hasDest) {
|
|
1705
|
+
writeTo.push(quickBytes);
|
|
1706
|
+
return writeTo.toBytes();
|
|
1707
|
+
}
|
|
1652
1708
|
return quickBytes;
|
|
1653
1709
|
}
|
|
1654
1710
|
const encoder = encoders[tokens.type.major];
|
|
1655
1711
|
if (encoder.encodedSize) {
|
|
1656
1712
|
const size = encoder.encodedSize(tokens, options);
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1713
|
+
if (!hasDest) {
|
|
1714
|
+
writeTo = new Bl(size);
|
|
1715
|
+
}
|
|
1716
|
+
encoder(writeTo, tokens, options);
|
|
1717
|
+
if (writeTo.chunks.length !== 1) {
|
|
1660
1718
|
throw new Error(`Unexpected error: pre-calculated length for ${tokens} was wrong`);
|
|
1661
1719
|
}
|
|
1662
|
-
return asU8A(
|
|
1720
|
+
return hasDest ? writeTo.toBytes() : asU8A(writeTo.chunks[0]);
|
|
1663
1721
|
}
|
|
1664
1722
|
}
|
|
1665
|
-
|
|
1666
|
-
tokensToEncoded(
|
|
1667
|
-
return
|
|
1723
|
+
writeTo.reset();
|
|
1724
|
+
tokensToEncoded(writeTo, tokens, encoders, options);
|
|
1725
|
+
return writeTo.toBytes(true);
|
|
1668
1726
|
}
|
|
1669
1727
|
__name(encodeCustom, "encodeCustom");
|
|
1670
1728
|
function encode(data, options) {
|
|
1671
1729
|
options = Object.assign({}, defaultEncodeOptions, options);
|
|
1730
|
+
if (canDirectEncode(options)) {
|
|
1731
|
+
defaultWriter.reset();
|
|
1732
|
+
directEncode(defaultWriter, data, options, void 0);
|
|
1733
|
+
return defaultWriter.toBytes(true);
|
|
1734
|
+
}
|
|
1672
1735
|
return encodeCustom(data, cborEncoders, options);
|
|
1673
1736
|
}
|
|
1674
1737
|
__name(encode, "encode");
|
|
1675
1738
|
|
|
1676
|
-
// ../../../node_modules
|
|
1739
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/decode.js
|
|
1677
1740
|
var defaultDecodeOptions = {
|
|
1678
1741
|
strict: false,
|
|
1679
1742
|
allowIndefinite: true,
|
|
@@ -1735,6 +1798,7 @@ function tokenToArray(token, tokeniser, options) {
|
|
|
1735
1798
|
__name(tokenToArray, "tokenToArray");
|
|
1736
1799
|
function tokenToMap(token, tokeniser, options) {
|
|
1737
1800
|
const useMaps = options.useMaps === true;
|
|
1801
|
+
const rejectDuplicateMapKeys = options.rejectDuplicateMapKeys === true;
|
|
1738
1802
|
const obj = useMaps ? void 0 : {};
|
|
1739
1803
|
const m = useMaps ? /* @__PURE__ */ new Map() : void 0;
|
|
1740
1804
|
for (let i = 0; i < token.value; i++) {
|
|
@@ -1748,11 +1812,11 @@ function tokenToMap(token, tokeniser, options) {
|
|
|
1748
1812
|
if (key === DONE) {
|
|
1749
1813
|
throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${i} [no key], expected ${token.value})`);
|
|
1750
1814
|
}
|
|
1751
|
-
if (useMaps
|
|
1815
|
+
if (!useMaps && typeof key !== "string") {
|
|
1752
1816
|
throw new Error(`${decodeErrPrefix} non-string keys not supported (got ${typeof key})`);
|
|
1753
1817
|
}
|
|
1754
|
-
if (
|
|
1755
|
-
if (useMaps && m.has(key) || !useMaps && key
|
|
1818
|
+
if (rejectDuplicateMapKeys) {
|
|
1819
|
+
if (useMaps && m.has(key) || !useMaps && Object.hasOwn(obj, key)) {
|
|
1756
1820
|
throw new Error(`${decodeErrPrefix} found repeat map key "${key}"`);
|
|
1757
1821
|
}
|
|
1758
1822
|
}
|
|
@@ -1774,19 +1838,19 @@ function tokensToObject(tokeniser, options) {
|
|
|
1774
1838
|
return DONE;
|
|
1775
1839
|
}
|
|
1776
1840
|
const token = tokeniser.next();
|
|
1777
|
-
if (token.type
|
|
1841
|
+
if (Type.equals(token.type, Type.break)) {
|
|
1778
1842
|
return BREAK;
|
|
1779
1843
|
}
|
|
1780
1844
|
if (token.type.terminal) {
|
|
1781
1845
|
return token.value;
|
|
1782
1846
|
}
|
|
1783
|
-
if (token.type
|
|
1847
|
+
if (Type.equals(token.type, Type.array)) {
|
|
1784
1848
|
return tokenToArray(token, tokeniser, options);
|
|
1785
1849
|
}
|
|
1786
|
-
if (token.type
|
|
1850
|
+
if (Type.equals(token.type, Type.map)) {
|
|
1787
1851
|
return tokenToMap(token, tokeniser, options);
|
|
1788
1852
|
}
|
|
1789
|
-
if (token.type
|
|
1853
|
+
if (Type.equals(token.type, Type.tag)) {
|
|
1790
1854
|
if (options.tags && typeof options.tags[token.value] === "function") {
|
|
1791
1855
|
const tagged = tokensToObject(tokeniser, options);
|
|
1792
1856
|
return options.tags[token.value](tagged);
|
|
@@ -1801,7 +1865,8 @@ function decodeFirst(data, options) {
|
|
|
1801
1865
|
throw new Error(`${decodeErrPrefix} data to decode must be a Uint8Array`);
|
|
1802
1866
|
}
|
|
1803
1867
|
options = Object.assign({}, defaultDecodeOptions, options);
|
|
1804
|
-
const
|
|
1868
|
+
const u8aData = asU8A(data);
|
|
1869
|
+
const tokeniser = options.tokenizer || new Tokeniser(u8aData, options);
|
|
1805
1870
|
const decoded = tokensToObject(tokeniser, options);
|
|
1806
1871
|
if (decoded === DONE) {
|
|
1807
1872
|
throw new Error(`${decodeErrPrefix} did not find any content to decode`);
|
|
@@ -1821,7 +1886,7 @@ function decode(data, options) {
|
|
|
1821
1886
|
}
|
|
1822
1887
|
__name(decode, "decode");
|
|
1823
1888
|
|
|
1824
|
-
// ../../../node_modules
|
|
1889
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/CborldError.js
|
|
1825
1890
|
var _CborldError = class _CborldError extends Error {
|
|
1826
1891
|
constructor(value, message) {
|
|
1827
1892
|
super();
|
|
@@ -1834,7 +1899,7 @@ var _CborldError = class _CborldError extends Error {
|
|
|
1834
1899
|
__name(_CborldError, "CborldError");
|
|
1835
1900
|
var CborldError = _CborldError;
|
|
1836
1901
|
|
|
1837
|
-
// ../../../node_modules
|
|
1902
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/keywords.js
|
|
1838
1903
|
var KEYWORDS = /* @__PURE__ */ new Map([
|
|
1839
1904
|
// ordered is important, do not change
|
|
1840
1905
|
["@context", 0],
|
|
@@ -1870,7 +1935,7 @@ var KEYWORDS = /* @__PURE__ */ new Map([
|
|
|
1870
1935
|
]);
|
|
1871
1936
|
var FIRST_CUSTOM_TERM_ID = 100;
|
|
1872
1937
|
|
|
1873
|
-
// ../../../node_modules
|
|
1938
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/CborldDecoder.js
|
|
1874
1939
|
var _CborldDecoder = class _CborldDecoder {
|
|
1875
1940
|
// eslint-disable-next-line no-unused-vars
|
|
1876
1941
|
decode({ value } = {}) {
|
|
@@ -1884,7 +1949,7 @@ var _CborldDecoder = class _CborldDecoder {
|
|
|
1884
1949
|
__name(_CborldDecoder, "CborldDecoder");
|
|
1885
1950
|
var CborldDecoder = _CborldDecoder;
|
|
1886
1951
|
|
|
1887
|
-
// ../../../node_modules
|
|
1952
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/registeredContexts.js
|
|
1888
1953
|
var ID_TO_URL = /* @__PURE__ */ new Map();
|
|
1889
1954
|
var URL_TO_ID = /* @__PURE__ */ new Map();
|
|
1890
1955
|
_addRegistration(16, "https://www.w3.org/ns/activitystreams");
|
|
@@ -1914,7 +1979,7 @@ function _addRegistration(id, url) {
|
|
|
1914
1979
|
}
|
|
1915
1980
|
__name(_addRegistration, "_addRegistration");
|
|
1916
1981
|
|
|
1917
|
-
// ../../../node_modules
|
|
1982
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/ContextDecoder.js
|
|
1918
1983
|
var _ContextDecoder = class _ContextDecoder extends CborldDecoder {
|
|
1919
1984
|
constructor({ reverseAppContextMap } = {}) {
|
|
1920
1985
|
super();
|
|
@@ -1955,17 +2020,17 @@ function _mapToObject(map) {
|
|
|
1955
2020
|
}
|
|
1956
2021
|
__name(_mapToObject, "_mapToObject");
|
|
1957
2022
|
|
|
1958
|
-
// ../../../node_modules
|
|
2023
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/util-browser.js
|
|
1959
2024
|
function inspect(data, options) {
|
|
1960
2025
|
return JSON.stringify(data, null, 2);
|
|
1961
2026
|
}
|
|
1962
2027
|
__name(inspect, "inspect");
|
|
1963
2028
|
|
|
1964
|
-
// ../../../node_modules
|
|
1965
|
-
var version = "3.
|
|
2029
|
+
// ../../../node_modules/js-base64/base64.mjs
|
|
2030
|
+
var version = "3.8.0";
|
|
1966
2031
|
var VERSION = version;
|
|
1967
2032
|
var _hasBuffer = typeof Buffer === "function";
|
|
1968
|
-
var _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
|
|
2033
|
+
var _TD = typeof TextDecoder === "function" ? new TextDecoder("utf-8", { ignoreBOM: true }) : void 0;
|
|
1969
2034
|
var _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
|
|
1970
2035
|
var b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
1971
2036
|
var b64chs = Array.prototype.slice.call(b64ch);
|
|
@@ -2123,7 +2188,7 @@ var gBase64 = {
|
|
|
2123
2188
|
extendBuiltins
|
|
2124
2189
|
};
|
|
2125
2190
|
|
|
2126
|
-
// ../../../node_modules
|
|
2191
|
+
// ../../../node_modules/base58-universal/lib/baseN.js
|
|
2127
2192
|
var _reverseAlphabets = {};
|
|
2128
2193
|
function encode3(input, alphabet2, maxline) {
|
|
2129
2194
|
if (!(input instanceof Uint8Array)) {
|
|
@@ -2212,7 +2277,7 @@ function decode3(input, alphabet2) {
|
|
|
2212
2277
|
}
|
|
2213
2278
|
__name(decode3, "decode");
|
|
2214
2279
|
|
|
2215
|
-
// ../../../node_modules
|
|
2280
|
+
// ../../../node_modules/base58-universal/lib/index.js
|
|
2216
2281
|
var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
2217
2282
|
function encode4(input, maxline) {
|
|
2218
2283
|
return encode3(input, alphabet, maxline);
|
|
@@ -2223,7 +2288,7 @@ function decode4(input) {
|
|
|
2223
2288
|
}
|
|
2224
2289
|
__name(decode4, "decode");
|
|
2225
2290
|
|
|
2226
|
-
// ../../../node_modules
|
|
2291
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseDecoder.js
|
|
2227
2292
|
var _MultibaseDecoder = class _MultibaseDecoder extends CborldDecoder {
|
|
2228
2293
|
decode({ value } = {}) {
|
|
2229
2294
|
const { buffer: buffer2, byteOffset, length } = value;
|
|
@@ -2248,7 +2313,7 @@ var _MultibaseDecoder = class _MultibaseDecoder extends CborldDecoder {
|
|
|
2248
2313
|
__name(_MultibaseDecoder, "MultibaseDecoder");
|
|
2249
2314
|
var MultibaseDecoder = _MultibaseDecoder;
|
|
2250
2315
|
|
|
2251
|
-
// ../../../node_modules
|
|
2316
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/Transformer.js
|
|
2252
2317
|
var _Transformer = class _Transformer {
|
|
2253
2318
|
/**
|
|
2254
2319
|
* Creates a new Transformer for transforming CBOR-LD <=> JSON-LD.
|
|
@@ -2628,7 +2693,7 @@ var _Transformer = class _Transformer {
|
|
|
2628
2693
|
__name(_Transformer, "Transformer");
|
|
2629
2694
|
var Transformer = _Transformer;
|
|
2630
2695
|
|
|
2631
|
-
// ../../../node_modules
|
|
2696
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlDecoder.js
|
|
2632
2697
|
var ID_TO_SCHEME = /* @__PURE__ */ new Map([
|
|
2633
2698
|
// Note: only v1 mainnet is supported
|
|
2634
2699
|
[1024, "did:v1:nym:"],
|
|
@@ -2664,7 +2729,7 @@ var _Base58DidUrlDecoder = class _Base58DidUrlDecoder extends CborldDecoder {
|
|
|
2664
2729
|
__name(_Base58DidUrlDecoder, "Base58DidUrlDecoder");
|
|
2665
2730
|
var Base58DidUrlDecoder = _Base58DidUrlDecoder;
|
|
2666
2731
|
|
|
2667
|
-
// ../../../node_modules
|
|
2732
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlDecoder.js
|
|
2668
2733
|
var _HttpUrlDecoder = class _HttpUrlDecoder extends CborldDecoder {
|
|
2669
2734
|
constructor({ secure } = {}) {
|
|
2670
2735
|
super();
|
|
@@ -2684,17 +2749,17 @@ var _HttpUrlDecoder = class _HttpUrlDecoder extends CborldDecoder {
|
|
|
2684
2749
|
__name(_HttpUrlDecoder, "HttpUrlDecoder");
|
|
2685
2750
|
var HttpUrlDecoder = _HttpUrlDecoder;
|
|
2686
2751
|
|
|
2687
|
-
// ../../../node_modules
|
|
2752
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/regex.js
|
|
2688
2753
|
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;
|
|
2689
2754
|
|
|
2690
|
-
// ../../../node_modules
|
|
2755
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/validate.js
|
|
2691
2756
|
function validate(uuid) {
|
|
2692
2757
|
return typeof uuid === "string" && regex_default.test(uuid);
|
|
2693
2758
|
}
|
|
2694
2759
|
__name(validate, "validate");
|
|
2695
2760
|
var validate_default = validate;
|
|
2696
2761
|
|
|
2697
|
-
// ../../../node_modules
|
|
2762
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/stringify.js
|
|
2698
2763
|
var byteToHex = [];
|
|
2699
2764
|
for (let i = 0; i < 256; ++i) {
|
|
2700
2765
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -2713,7 +2778,7 @@ function stringify(arr, offset = 0) {
|
|
|
2713
2778
|
__name(stringify, "stringify");
|
|
2714
2779
|
var stringify_default = stringify;
|
|
2715
2780
|
|
|
2716
|
-
// ../../../node_modules
|
|
2781
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/parse.js
|
|
2717
2782
|
function parse(uuid) {
|
|
2718
2783
|
if (!validate_default(uuid)) {
|
|
2719
2784
|
throw TypeError("Invalid UUID");
|
|
@@ -2741,7 +2806,7 @@ function parse(uuid) {
|
|
|
2741
2806
|
__name(parse, "parse");
|
|
2742
2807
|
var parse_default = parse;
|
|
2743
2808
|
|
|
2744
|
-
// ../../../node_modules
|
|
2809
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnDecoder.js
|
|
2745
2810
|
var _UuidUrnDecoder = class _UuidUrnDecoder extends CborldDecoder {
|
|
2746
2811
|
decode({ value } = {}) {
|
|
2747
2812
|
const uuid = typeof value[1] === "string" ? value[1] : stringify_default(value[1]);
|
|
@@ -2756,7 +2821,7 @@ var _UuidUrnDecoder = class _UuidUrnDecoder extends CborldDecoder {
|
|
|
2756
2821
|
__name(_UuidUrnDecoder, "UuidUrnDecoder");
|
|
2757
2822
|
var UuidUrnDecoder = _UuidUrnDecoder;
|
|
2758
2823
|
|
|
2759
|
-
// ../../../node_modules
|
|
2824
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UriDecoder.js
|
|
2760
2825
|
var SCHEME_ID_TO_DECODER = /* @__PURE__ */ new Map([
|
|
2761
2826
|
[1, HttpUrlDecoder],
|
|
2762
2827
|
[2, HttpUrlDecoder],
|
|
@@ -2776,7 +2841,7 @@ var _UriDecoder = class _UriDecoder extends CborldDecoder {
|
|
|
2776
2841
|
__name(_UriDecoder, "UriDecoder");
|
|
2777
2842
|
var UriDecoder = _UriDecoder;
|
|
2778
2843
|
|
|
2779
|
-
// ../../../node_modules
|
|
2844
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermDecoder.js
|
|
2780
2845
|
var _VocabTermDecoder = class _VocabTermDecoder extends CborldDecoder {
|
|
2781
2846
|
constructor({ term } = {}) {
|
|
2782
2847
|
super();
|
|
@@ -2798,7 +2863,7 @@ var _VocabTermDecoder = class _VocabTermDecoder extends CborldDecoder {
|
|
|
2798
2863
|
__name(_VocabTermDecoder, "VocabTermDecoder");
|
|
2799
2864
|
var VocabTermDecoder = _VocabTermDecoder;
|
|
2800
2865
|
|
|
2801
|
-
// ../../../node_modules
|
|
2866
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateDecoder.js
|
|
2802
2867
|
var _XsdDateDecoder = class _XsdDateDecoder extends CborldDecoder {
|
|
2803
2868
|
decode({ value } = {}) {
|
|
2804
2869
|
const dateString = new Date(value * 1e3).toISOString();
|
|
@@ -2813,7 +2878,7 @@ var _XsdDateDecoder = class _XsdDateDecoder extends CborldDecoder {
|
|
|
2813
2878
|
__name(_XsdDateDecoder, "XsdDateDecoder");
|
|
2814
2879
|
var XsdDateDecoder = _XsdDateDecoder;
|
|
2815
2880
|
|
|
2816
|
-
// ../../../node_modules
|
|
2881
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeDecoder.js
|
|
2817
2882
|
var _XsdDateTimeDecoder = class _XsdDateTimeDecoder extends CborldDecoder {
|
|
2818
2883
|
constructor({ value } = {}) {
|
|
2819
2884
|
super();
|
|
@@ -2837,7 +2902,7 @@ var _XsdDateTimeDecoder = class _XsdDateTimeDecoder extends CborldDecoder {
|
|
|
2837
2902
|
__name(_XsdDateTimeDecoder, "XsdDateTimeDecoder");
|
|
2838
2903
|
var XsdDateTimeDecoder = _XsdDateTimeDecoder;
|
|
2839
2904
|
|
|
2840
|
-
// ../../../node_modules
|
|
2905
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/Decompressor.js
|
|
2841
2906
|
var TYPE_DECODERS = /* @__PURE__ */ new Map([
|
|
2842
2907
|
["@id", UriDecoder],
|
|
2843
2908
|
["@vocab", VocabTermDecoder],
|
|
@@ -3054,7 +3119,7 @@ function _sortEntriesByTerm([{ term: t1 }], [{ term: t2 }]) {
|
|
|
3054
3119
|
}
|
|
3055
3120
|
__name(_sortEntriesByTerm, "_sortEntriesByTerm");
|
|
3056
3121
|
|
|
3057
|
-
// ../../../node_modules
|
|
3122
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/decode.js
|
|
3058
3123
|
async function decode5({
|
|
3059
3124
|
cborldBytes,
|
|
3060
3125
|
documentLoader,
|
|
@@ -3108,7 +3173,7 @@ async function decode5({
|
|
|
3108
3173
|
}
|
|
3109
3174
|
__name(decode5, "decode");
|
|
3110
3175
|
|
|
3111
|
-
// ../../../node_modules
|
|
3176
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/CborldEncoder.js
|
|
3112
3177
|
var _CborldEncoder = class _CborldEncoder {
|
|
3113
3178
|
encode() {
|
|
3114
3179
|
throw new Error("Must be implemented by derived class.");
|
|
@@ -3121,7 +3186,7 @@ var _CborldEncoder = class _CborldEncoder {
|
|
|
3121
3186
|
__name(_CborldEncoder, "CborldEncoder");
|
|
3122
3187
|
var CborldEncoder = _CborldEncoder;
|
|
3123
3188
|
|
|
3124
|
-
// ../../../node_modules
|
|
3189
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/ContextEncoder.js
|
|
3125
3190
|
var _ContextEncoder = class _ContextEncoder extends CborldEncoder {
|
|
3126
3191
|
constructor({ context, appContextMap } = {}) {
|
|
3127
3192
|
super();
|
|
@@ -3147,7 +3212,7 @@ var _ContextEncoder = class _ContextEncoder extends CborldEncoder {
|
|
|
3147
3212
|
__name(_ContextEncoder, "ContextEncoder");
|
|
3148
3213
|
var ContextEncoder = _ContextEncoder;
|
|
3149
3214
|
|
|
3150
|
-
// ../../../node_modules
|
|
3215
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseEncoder.js
|
|
3151
3216
|
var _MultibaseEncoder = class _MultibaseEncoder extends CborldEncoder {
|
|
3152
3217
|
constructor({ value } = {}) {
|
|
3153
3218
|
super();
|
|
@@ -3181,7 +3246,7 @@ var _MultibaseEncoder = class _MultibaseEncoder extends CborldEncoder {
|
|
|
3181
3246
|
__name(_MultibaseEncoder, "MultibaseEncoder");
|
|
3182
3247
|
var MultibaseEncoder = _MultibaseEncoder;
|
|
3183
3248
|
|
|
3184
|
-
// ../../../node_modules
|
|
3249
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlEncoder.js
|
|
3185
3250
|
var SCHEME_TO_ID = /* @__PURE__ */ new Map([
|
|
3186
3251
|
["did:v1:nym:", 1024],
|
|
3187
3252
|
["did:key:", 1025]
|
|
@@ -3227,7 +3292,7 @@ function _multibase58ToToken(str) {
|
|
|
3227
3292
|
}
|
|
3228
3293
|
__name(_multibase58ToToken, "_multibase58ToToken");
|
|
3229
3294
|
|
|
3230
|
-
// ../../../node_modules
|
|
3295
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlEncoder.js
|
|
3231
3296
|
var _HttpUrlEncoder = class _HttpUrlEncoder extends CborldEncoder {
|
|
3232
3297
|
constructor({ value, secure } = {}) {
|
|
3233
3298
|
super();
|
|
@@ -3255,7 +3320,7 @@ var _HttpUrlEncoder = class _HttpUrlEncoder extends CborldEncoder {
|
|
|
3255
3320
|
__name(_HttpUrlEncoder, "HttpUrlEncoder");
|
|
3256
3321
|
var HttpUrlEncoder = _HttpUrlEncoder;
|
|
3257
3322
|
|
|
3258
|
-
// ../../../node_modules
|
|
3323
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnEncoder.js
|
|
3259
3324
|
var _UuidUrnEncoder = class _UuidUrnEncoder extends CborldEncoder {
|
|
3260
3325
|
constructor({ value } = {}) {
|
|
3261
3326
|
super();
|
|
@@ -3282,7 +3347,7 @@ var _UuidUrnEncoder = class _UuidUrnEncoder extends CborldEncoder {
|
|
|
3282
3347
|
__name(_UuidUrnEncoder, "UuidUrnEncoder");
|
|
3283
3348
|
var UuidUrnEncoder = _UuidUrnEncoder;
|
|
3284
3349
|
|
|
3285
|
-
// ../../../node_modules
|
|
3350
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UriEncoder.js
|
|
3286
3351
|
var SCHEME_TO_ENCODER = /* @__PURE__ */ new Map([
|
|
3287
3352
|
["http", HttpUrlEncoder],
|
|
3288
3353
|
["https", HttpUrlEncoder],
|
|
@@ -3315,7 +3380,7 @@ var _UriEncoder = class _UriEncoder extends CborldEncoder {
|
|
|
3315
3380
|
__name(_UriEncoder, "UriEncoder");
|
|
3316
3381
|
var UriEncoder = _UriEncoder;
|
|
3317
3382
|
|
|
3318
|
-
// ../../../node_modules
|
|
3383
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermEncoder.js
|
|
3319
3384
|
var _VocabTermEncoder = class _VocabTermEncoder extends CborldEncoder {
|
|
3320
3385
|
constructor({ termId } = {}) {
|
|
3321
3386
|
super();
|
|
@@ -3336,7 +3401,7 @@ var _VocabTermEncoder = class _VocabTermEncoder extends CborldEncoder {
|
|
|
3336
3401
|
__name(_VocabTermEncoder, "VocabTermEncoder");
|
|
3337
3402
|
var VocabTermEncoder = _VocabTermEncoder;
|
|
3338
3403
|
|
|
3339
|
-
// ../../../node_modules
|
|
3404
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateEncoder.js
|
|
3340
3405
|
var _XsdDateEncoder = class _XsdDateEncoder extends CborldEncoder {
|
|
3341
3406
|
constructor({ value, parsed } = {}) {
|
|
3342
3407
|
super();
|
|
@@ -3367,7 +3432,7 @@ var _XsdDateEncoder = class _XsdDateEncoder extends CborldEncoder {
|
|
|
3367
3432
|
__name(_XsdDateEncoder, "XsdDateEncoder");
|
|
3368
3433
|
var XsdDateEncoder = _XsdDateEncoder;
|
|
3369
3434
|
|
|
3370
|
-
// ../../../node_modules
|
|
3435
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeEncoder.js
|
|
3371
3436
|
var _XsdDateTimeEncoder = class _XsdDateTimeEncoder extends CborldEncoder {
|
|
3372
3437
|
constructor({ value, parsed } = {}) {
|
|
3373
3438
|
super();
|
|
@@ -3415,7 +3480,7 @@ var _XsdDateTimeEncoder = class _XsdDateTimeEncoder extends CborldEncoder {
|
|
|
3415
3480
|
__name(_XsdDateTimeEncoder, "XsdDateTimeEncoder");
|
|
3416
3481
|
var XsdDateTimeEncoder = _XsdDateTimeEncoder;
|
|
3417
3482
|
|
|
3418
|
-
// ../../../node_modules
|
|
3483
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/Compressor.js
|
|
3419
3484
|
var TYPE_ENCODERS = /* @__PURE__ */ new Map([
|
|
3420
3485
|
["@id", UriEncoder],
|
|
3421
3486
|
["@vocab", VocabTermEncoder],
|
|
@@ -3571,7 +3636,7 @@ var _Compressor = class _Compressor extends Transformer {
|
|
|
3571
3636
|
__name(_Compressor, "Compressor");
|
|
3572
3637
|
var Compressor = _Compressor;
|
|
3573
3638
|
|
|
3574
|
-
// ../../../node_modules
|
|
3639
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/encode.js
|
|
3575
3640
|
async function encode5({
|
|
3576
3641
|
jsonldDocument,
|
|
3577
3642
|
documentLoader,
|
|
@@ -3604,7 +3669,7 @@ async function encode5({
|
|
|
3604
3669
|
}
|
|
3605
3670
|
__name(encode5, "encode");
|
|
3606
3671
|
|
|
3607
|
-
// ../../../node_modules
|
|
3672
|
+
// ../../../node_modules/to-data-view/index.js
|
|
3608
3673
|
function toDataView(data) {
|
|
3609
3674
|
if (data instanceof Int8Array || data instanceof Uint8Array || data instanceof Uint8ClampedArray) {
|
|
3610
3675
|
return new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
@@ -3616,7 +3681,7 @@ function toDataView(data) {
|
|
|
3616
3681
|
}
|
|
3617
3682
|
__name(toDataView, "toDataView");
|
|
3618
3683
|
|
|
3619
|
-
// ../../../node_modules
|
|
3684
|
+
// ../../../node_modules/base32-encode/index.js
|
|
3620
3685
|
var RFC4648 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
3621
3686
|
var RFC4648_HEX = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
3622
3687
|
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
@@ -3665,10 +3730,10 @@ function base32Encode(data, variant, options) {
|
|
|
3665
3730
|
}
|
|
3666
3731
|
__name(base32Encode, "base32Encode");
|
|
3667
3732
|
|
|
3668
|
-
// ../../../node_modules
|
|
3733
|
+
// ../../../node_modules/@digitalbazaar/vpqr/lib/vpqr.js
|
|
3669
3734
|
var import_base32_decode = __toESM(require_base32_decode(), 1);
|
|
3670
3735
|
|
|
3671
|
-
// ../../../node_modules
|
|
3736
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/common/Mode.js
|
|
3672
3737
|
var Mode;
|
|
3673
3738
|
(function(Mode2) {
|
|
3674
3739
|
Mode2[Mode2["Terminator"] = 0] = "Terminator";
|
|
@@ -3680,7 +3745,7 @@ var Mode;
|
|
|
3680
3745
|
Mode2[Mode2["ECI"] = 7] = "ECI";
|
|
3681
3746
|
})(Mode || (Mode = {}));
|
|
3682
3747
|
|
|
3683
|
-
// ../../../node_modules
|
|
3748
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRData.js
|
|
3684
3749
|
var _QRData = class _QRData {
|
|
3685
3750
|
constructor(mode, data) {
|
|
3686
3751
|
this.bytes = [];
|
|
@@ -3740,7 +3805,7 @@ var _QRData = class _QRData {
|
|
|
3740
3805
|
__name(_QRData, "QRData");
|
|
3741
3806
|
var QRData = _QRData;
|
|
3742
3807
|
|
|
3743
|
-
// ../../../node_modules
|
|
3808
|
+
// ../../../node_modules/@nuintun/qrcode/esm/encoding/UTF8.js
|
|
3744
3809
|
function encode6(text) {
|
|
3745
3810
|
let pos = 0;
|
|
3746
3811
|
const { length } = text;
|
|
@@ -3768,7 +3833,7 @@ function encode6(text) {
|
|
|
3768
3833
|
}
|
|
3769
3834
|
__name(encode6, "encode");
|
|
3770
3835
|
|
|
3771
|
-
// ../../../node_modules
|
|
3836
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRByte.js
|
|
3772
3837
|
var _QRByte = class _QRByte extends QRData {
|
|
3773
3838
|
/**
|
|
3774
3839
|
* @constructor
|
|
@@ -3801,7 +3866,7 @@ var _QRByte = class _QRByte extends QRData {
|
|
|
3801
3866
|
__name(_QRByte, "QRByte");
|
|
3802
3867
|
var QRByte = _QRByte;
|
|
3803
3868
|
|
|
3804
|
-
// ../../../node_modules
|
|
3869
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRMath.js
|
|
3805
3870
|
var EXP_TABLE = [];
|
|
3806
3871
|
var LOG_TABLE = [];
|
|
3807
3872
|
for (let i = 0; i < 256; i++) {
|
|
@@ -3829,7 +3894,7 @@ function gexp(n) {
|
|
|
3829
3894
|
}
|
|
3830
3895
|
__name(gexp, "gexp");
|
|
3831
3896
|
|
|
3832
|
-
// ../../../node_modules
|
|
3897
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/Polynomial.js
|
|
3833
3898
|
var _Polynomial = class _Polynomial {
|
|
3834
3899
|
constructor(num, shift = 0) {
|
|
3835
3900
|
let offset = 0;
|
|
@@ -3888,7 +3953,7 @@ var _Polynomial = class _Polynomial {
|
|
|
3888
3953
|
__name(_Polynomial, "Polynomial");
|
|
3889
3954
|
var Polynomial = _Polynomial;
|
|
3890
3955
|
|
|
3891
|
-
// ../../../node_modules
|
|
3956
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRUtil.js
|
|
3892
3957
|
var N1 = 3;
|
|
3893
3958
|
var N2 = 3;
|
|
3894
3959
|
var N3 = 40;
|
|
@@ -4067,7 +4132,7 @@ function calculateMaskPenalty(qrcode) {
|
|
|
4067
4132
|
}
|
|
4068
4133
|
__name(calculateMaskPenalty, "calculateMaskPenalty");
|
|
4069
4134
|
|
|
4070
|
-
// ../../../node_modules
|
|
4135
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/common/ErrorCorrectionLevel.js
|
|
4071
4136
|
var ErrorCorrectionLevel;
|
|
4072
4137
|
(function(ErrorCorrectionLevel2) {
|
|
4073
4138
|
ErrorCorrectionLevel2[ErrorCorrectionLevel2["L"] = 1] = "L";
|
|
@@ -4076,7 +4141,7 @@ var ErrorCorrectionLevel;
|
|
|
4076
4141
|
ErrorCorrectionLevel2[ErrorCorrectionLevel2["H"] = 2] = "H";
|
|
4077
4142
|
})(ErrorCorrectionLevel || (ErrorCorrectionLevel = {}));
|
|
4078
4143
|
|
|
4079
|
-
// ../../../node_modules
|
|
4144
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/RSBlock.js
|
|
4080
4145
|
var _RSBlock = class _RSBlock {
|
|
4081
4146
|
constructor(totalCount, dataCount) {
|
|
4082
4147
|
this.dataCount = dataCount;
|
|
@@ -4326,7 +4391,7 @@ RSBlock.RS_BLOCK_TABLE = [
|
|
|
4326
4391
|
[20, 45, 15, 61, 46, 16]
|
|
4327
4392
|
];
|
|
4328
4393
|
|
|
4329
|
-
// ../../../node_modules
|
|
4394
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/BitBuffer.js
|
|
4330
4395
|
var _BitBuffer = class _BitBuffer {
|
|
4331
4396
|
constructor() {
|
|
4332
4397
|
this.length = 0;
|
|
@@ -4360,7 +4425,7 @@ var _BitBuffer = class _BitBuffer {
|
|
|
4360
4425
|
__name(_BitBuffer, "BitBuffer");
|
|
4361
4426
|
var BitBuffer = _BitBuffer;
|
|
4362
4427
|
|
|
4363
|
-
// ../../../node_modules
|
|
4428
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/lzw/Dict.js
|
|
4364
4429
|
var MAX_CODE = (1 << 12) - 1;
|
|
4365
4430
|
var _Dict = class _Dict {
|
|
4366
4431
|
constructor(depth) {
|
|
@@ -4400,7 +4465,7 @@ var _Dict = class _Dict {
|
|
|
4400
4465
|
__name(_Dict, "Dict");
|
|
4401
4466
|
var Dict = _Dict;
|
|
4402
4467
|
|
|
4403
|
-
// ../../../node_modules
|
|
4468
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/lzw/DictStream.js
|
|
4404
4469
|
var _DictStream = class _DictStream {
|
|
4405
4470
|
constructor(dict) {
|
|
4406
4471
|
this.bits = 0;
|
|
@@ -4446,7 +4511,7 @@ var _DictStream = class _DictStream {
|
|
|
4446
4511
|
__name(_DictStream, "DictStream");
|
|
4447
4512
|
var DictStream = _DictStream;
|
|
4448
4513
|
|
|
4449
|
-
// ../../../node_modules
|
|
4514
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/lzw/index.js
|
|
4450
4515
|
function compress(pixels, depth, stream) {
|
|
4451
4516
|
const dict = new Dict(depth);
|
|
4452
4517
|
const buffer2 = new DictStream(dict);
|
|
@@ -4475,7 +4540,7 @@ function compress(pixels, depth, stream) {
|
|
|
4475
4540
|
}
|
|
4476
4541
|
__name(compress, "compress");
|
|
4477
4542
|
|
|
4478
|
-
// ../../../node_modules
|
|
4543
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/ByteStream.js
|
|
4479
4544
|
var _ByteStream = class _ByteStream {
|
|
4480
4545
|
constructor() {
|
|
4481
4546
|
this.bytes = [];
|
|
@@ -4496,7 +4561,7 @@ var _ByteStream = class _ByteStream {
|
|
|
4496
4561
|
__name(_ByteStream, "ByteStream");
|
|
4497
4562
|
var ByteStream = _ByteStream;
|
|
4498
4563
|
|
|
4499
|
-
// ../../../node_modules
|
|
4564
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/Base64Stream.js
|
|
4500
4565
|
var { fromCharCode } = String;
|
|
4501
4566
|
function encode7(byte) {
|
|
4502
4567
|
byte &= 63;
|
|
@@ -4556,7 +4621,7 @@ var _Base64Stream = class _Base64Stream {
|
|
|
4556
4621
|
__name(_Base64Stream, "Base64Stream");
|
|
4557
4622
|
var Base64Stream = _Base64Stream;
|
|
4558
4623
|
|
|
4559
|
-
// ../../../node_modules
|
|
4624
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/GIFImage.js
|
|
4560
4625
|
var _GIFImage = class _GIFImage {
|
|
4561
4626
|
constructor(width, height, { foreground = [0, 0, 0], background = [255, 255, 255] } = {}) {
|
|
4562
4627
|
this.pixels = [];
|
|
@@ -4605,7 +4670,7 @@ var _GIFImage = class _GIFImage {
|
|
|
4605
4670
|
__name(_GIFImage, "GIFImage");
|
|
4606
4671
|
var GIFImage = _GIFImage;
|
|
4607
4672
|
|
|
4608
|
-
// ../../../node_modules
|
|
4673
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/common/MaskPattern.js
|
|
4609
4674
|
function getMaskFunc(maskPattern) {
|
|
4610
4675
|
switch (maskPattern) {
|
|
4611
4676
|
case 0:
|
|
@@ -4630,10 +4695,10 @@ function getMaskFunc(maskPattern) {
|
|
|
4630
4695
|
}
|
|
4631
4696
|
__name(getMaskFunc, "getMaskFunc");
|
|
4632
4697
|
|
|
4633
|
-
// ../../../node_modules
|
|
4698
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/Writer.js
|
|
4634
4699
|
var PAD0 = 236;
|
|
4635
4700
|
var PAD1 = 17;
|
|
4636
|
-
var { toString
|
|
4701
|
+
var { toString } = Object.prototype;
|
|
4637
4702
|
function appendECI(encoding, buffer2) {
|
|
4638
4703
|
if (encoding < 0 || encoding >= 1e6) {
|
|
4639
4704
|
throw new Error("byte mode encoding hint out of range");
|
|
@@ -4835,7 +4900,7 @@ var _Encoder = class _Encoder {
|
|
|
4835
4900
|
if (data instanceof QRData) {
|
|
4836
4901
|
chunks.push(data);
|
|
4837
4902
|
} else {
|
|
4838
|
-
const type =
|
|
4903
|
+
const type = toString.call(data);
|
|
4839
4904
|
if (type === "[object String]") {
|
|
4840
4905
|
chunks.push(new QRByte(data));
|
|
4841
4906
|
} else {
|
|
@@ -5073,7 +5138,7 @@ var _Encoder = class _Encoder {
|
|
|
5073
5138
|
__name(_Encoder, "Encoder");
|
|
5074
5139
|
var Encoder = _Encoder;
|
|
5075
5140
|
|
|
5076
|
-
// ../../../node_modules
|
|
5141
|
+
// ../../../node_modules/@nuintun/qrcode/esm/encoding/UTF16.js
|
|
5077
5142
|
function encode8(text) {
|
|
5078
5143
|
const { length } = text;
|
|
5079
5144
|
const bytes = [];
|
|
@@ -5084,7 +5149,7 @@ function encode8(text) {
|
|
|
5084
5149
|
}
|
|
5085
5150
|
__name(encode8, "encode");
|
|
5086
5151
|
|
|
5087
|
-
// ../../../node_modules
|
|
5152
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRAlphanumeric.js
|
|
5088
5153
|
function getByte(byte) {
|
|
5089
5154
|
if (48 <= byte && byte <= 57) {
|
|
5090
5155
|
return byte - 48;
|
|
@@ -5155,7 +5220,7 @@ var _QRAlphanumeric = class _QRAlphanumeric extends QRData {
|
|
|
5155
5220
|
__name(_QRAlphanumeric, "QRAlphanumeric");
|
|
5156
5221
|
var QRAlphanumeric = _QRAlphanumeric;
|
|
5157
5222
|
|
|
5158
|
-
// ../../../node_modules
|
|
5223
|
+
// ../../../node_modules/@digitalbazaar/vpqr/lib/vpqr.js
|
|
5159
5224
|
var VP_QR_VERSION = "VP1";
|
|
5160
5225
|
var BASE_32_UPPERCASE_MULTIBASE_PREFIX = "B";
|
|
5161
5226
|
function _bytesToQrCodeDataUrl({ bytes, size }) {
|