@learncard/vpqr-plugin 1.0.12 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/vpqr-plugin.cjs.development.js +982 -1080
- package/dist/vpqr-plugin.cjs.development.js.map +4 -4
- package/dist/vpqr-plugin.cjs.production.min.js +9 -3
- package/dist/vpqr-plugin.cjs.production.min.js.map +4 -4
- package/dist/vpqr-plugin.esm.js +981 -1080
- package/dist/vpqr-plugin.esm.js.map +4 -4
- package/package.json +3 -3
package/dist/vpqr-plugin.esm.js
CHANGED
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
16
16
|
}
|
17
17
|
return to;
|
18
18
|
};
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
20
23
|
|
21
24
|
// ../../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js
|
22
25
|
var require_base32_decode = __commonJS({
|
@@ -69,7 +72,7 @@ var require_base32_decode = __commonJS({
|
|
69
72
|
}
|
70
73
|
});
|
71
74
|
|
72
|
-
// ../../../node_modules/.pnpm/cborg@
|
75
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/is.js
|
73
76
|
var typeofs = [
|
74
77
|
"string",
|
75
78
|
"number",
|
@@ -155,7 +158,7 @@ function getObjectType(value) {
|
|
155
158
|
}
|
156
159
|
__name(getObjectType, "getObjectType");
|
157
160
|
|
158
|
-
// ../../../node_modules/.pnpm/cborg@
|
161
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/token.js
|
159
162
|
var Type = class {
|
160
163
|
constructor(major, name, terminal) {
|
161
164
|
this.major = major;
|
@@ -198,7 +201,7 @@ var Token = class {
|
|
198
201
|
};
|
199
202
|
__name(Token, "Token");
|
200
203
|
|
201
|
-
// ../../../node_modules/.pnpm/cborg@
|
204
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/byte-utils.js
|
202
205
|
var useBuffer = globalThis.process && !globalThis.process.browser && globalThis.Buffer && typeof globalThis.Buffer.isBuffer === "function";
|
203
206
|
var textDecoder = new TextDecoder();
|
204
207
|
var textEncoder = new TextEncoder();
|
@@ -267,60 +270,29 @@ function compare(b1, b2) {
|
|
267
270
|
return 0;
|
268
271
|
}
|
269
272
|
__name(compare, "compare");
|
270
|
-
function utf8ToBytes(
|
271
|
-
|
272
|
-
|
273
|
-
let
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
if (
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
continue;
|
287
|
-
}
|
288
|
-
leadSurrogate = codePoint;
|
289
|
-
continue;
|
290
|
-
}
|
291
|
-
if (codePoint < 56320) {
|
292
|
-
if ((units -= 3) > -1)
|
293
|
-
bytes.push(239, 191, 189);
|
294
|
-
leadSurrogate = codePoint;
|
295
|
-
continue;
|
296
|
-
}
|
297
|
-
codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
|
298
|
-
} else if (leadSurrogate) {
|
299
|
-
if ((units -= 3) > -1)
|
300
|
-
bytes.push(239, 191, 189);
|
301
|
-
}
|
302
|
-
leadSurrogate = null;
|
303
|
-
if (codePoint < 128) {
|
304
|
-
if ((units -= 1) < 0)
|
305
|
-
break;
|
306
|
-
bytes.push(codePoint);
|
307
|
-
} else if (codePoint < 2048) {
|
308
|
-
if ((units -= 2) < 0)
|
309
|
-
break;
|
310
|
-
bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);
|
311
|
-
} else if (codePoint < 65536) {
|
312
|
-
if ((units -= 3) < 0)
|
313
|
-
break;
|
314
|
-
bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
|
315
|
-
} else if (codePoint < 1114112) {
|
316
|
-
if ((units -= 4) < 0)
|
317
|
-
break;
|
318
|
-
bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
|
273
|
+
function utf8ToBytes(str) {
|
274
|
+
const out = [];
|
275
|
+
let p = 0;
|
276
|
+
for (let i = 0; i < str.length; i++) {
|
277
|
+
let c = str.charCodeAt(i);
|
278
|
+
if (c < 128) {
|
279
|
+
out[p++] = c;
|
280
|
+
} else if (c < 2048) {
|
281
|
+
out[p++] = c >> 6 | 192;
|
282
|
+
out[p++] = c & 63 | 128;
|
283
|
+
} else if ((c & 64512) === 55296 && i + 1 < str.length && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
284
|
+
c = 65536 + ((c & 1023) << 10) + (str.charCodeAt(++i) & 1023);
|
285
|
+
out[p++] = c >> 18 | 240;
|
286
|
+
out[p++] = c >> 12 & 63 | 128;
|
287
|
+
out[p++] = c >> 6 & 63 | 128;
|
288
|
+
out[p++] = c & 63 | 128;
|
319
289
|
} else {
|
320
|
-
|
290
|
+
out[p++] = c >> 12 | 224;
|
291
|
+
out[p++] = c >> 6 & 63 | 128;
|
292
|
+
out[p++] = c & 63 | 128;
|
321
293
|
}
|
322
294
|
}
|
323
|
-
return
|
295
|
+
return out;
|
324
296
|
}
|
325
297
|
__name(utf8ToBytes, "utf8ToBytes");
|
326
298
|
function utf8Slice(buf2, offset, end) {
|
@@ -391,13 +363,16 @@ function decodeCodePointsArray(codePoints) {
|
|
391
363
|
let res = "";
|
392
364
|
let i = 0;
|
393
365
|
while (i < len) {
|
394
|
-
res += String.fromCharCode.apply(
|
366
|
+
res += String.fromCharCode.apply(
|
367
|
+
String,
|
368
|
+
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
369
|
+
);
|
395
370
|
}
|
396
371
|
return res;
|
397
372
|
}
|
398
373
|
__name(decodeCodePointsArray, "decodeCodePointsArray");
|
399
374
|
|
400
|
-
// ../../../node_modules/.pnpm/cborg@
|
375
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/bl.js
|
401
376
|
var defaultChunkSize = 256;
|
402
377
|
var Bl = class {
|
403
378
|
constructor(chunkSize = defaultChunkSize) {
|
@@ -469,7 +444,7 @@ var Bl = class {
|
|
469
444
|
};
|
470
445
|
__name(Bl, "Bl");
|
471
446
|
|
472
|
-
// ../../../node_modules/.pnpm/cborg@
|
447
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/common.js
|
473
448
|
var decodeErrPrefix = "CBOR decode error:";
|
474
449
|
var encodeErrPrefix = "CBOR encode error:";
|
475
450
|
var uintMinorPrefixBytes = [];
|
@@ -485,14 +460,8 @@ function assertEnoughData(data, pos, need) {
|
|
485
460
|
}
|
486
461
|
__name(assertEnoughData, "assertEnoughData");
|
487
462
|
|
488
|
-
// ../../../node_modules/.pnpm/cborg@
|
489
|
-
var uintBoundaries = [
|
490
|
-
24,
|
491
|
-
256,
|
492
|
-
65536,
|
493
|
-
4294967296,
|
494
|
-
BigInt("18446744073709551616")
|
495
|
-
];
|
463
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/0uint.js
|
464
|
+
var uintBoundaries = [24, 256, 65536, 4294967296, BigInt("18446744073709551616")];
|
496
465
|
function readUint8(data, offset, options) {
|
497
466
|
assertEnoughData(data, offset, 1);
|
498
467
|
const value = data[offset];
|
@@ -563,39 +532,17 @@ function encodeUintValue(buf2, major, uint) {
|
|
563
532
|
buf2.push([major | nuint]);
|
564
533
|
} else if (uint < uintBoundaries[1]) {
|
565
534
|
const nuint = Number(uint);
|
566
|
-
buf2.push([
|
567
|
-
major | 24,
|
568
|
-
nuint
|
569
|
-
]);
|
535
|
+
buf2.push([major | 24, nuint]);
|
570
536
|
} else if (uint < uintBoundaries[2]) {
|
571
537
|
const nuint = Number(uint);
|
572
|
-
buf2.push([
|
573
|
-
major | 25,
|
574
|
-
nuint >>> 8,
|
575
|
-
nuint & 255
|
576
|
-
]);
|
538
|
+
buf2.push([major | 25, nuint >>> 8, nuint & 255]);
|
577
539
|
} else if (uint < uintBoundaries[3]) {
|
578
540
|
const nuint = Number(uint);
|
579
|
-
buf2.push([
|
580
|
-
major | 26,
|
581
|
-
nuint >>> 24 & 255,
|
582
|
-
nuint >>> 16 & 255,
|
583
|
-
nuint >>> 8 & 255,
|
584
|
-
nuint & 255
|
585
|
-
]);
|
541
|
+
buf2.push([major | 26, nuint >>> 24 & 255, nuint >>> 16 & 255, nuint >>> 8 & 255, nuint & 255]);
|
586
542
|
} else {
|
587
543
|
const buint = BigInt(uint);
|
588
544
|
if (buint < uintBoundaries[4]) {
|
589
|
-
const set = [
|
590
|
-
major | 27,
|
591
|
-
0,
|
592
|
-
0,
|
593
|
-
0,
|
594
|
-
0,
|
595
|
-
0,
|
596
|
-
0,
|
597
|
-
0
|
598
|
-
];
|
545
|
+
const set = [major | 27, 0, 0, 0, 0, 0, 0, 0];
|
599
546
|
let lo = Number(buint & BigInt(4294967295));
|
600
547
|
let hi = Number(buint >> BigInt(32) & BigInt(4294967295));
|
601
548
|
set[8] = lo & 255;
|
@@ -641,7 +588,7 @@ encodeUint.compareTokens = /* @__PURE__ */ __name(function compareTokens(tok1, t
|
|
641
588
|
return tok1.value < tok2.value ? -1 : tok1.value > tok2.value ? 1 : 0;
|
642
589
|
}, "compareTokens");
|
643
590
|
|
644
|
-
// ../../../node_modules/.pnpm/cborg@
|
591
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/1negint.js
|
645
592
|
function decodeNegint8(data, pos, _minor, options) {
|
646
593
|
return new Token(Type.negint, -1 - readUint8(data, pos + 1, options), 2);
|
647
594
|
}
|
@@ -697,7 +644,7 @@ encodeNegint.compareTokens = /* @__PURE__ */ __name(function compareTokens2(tok1
|
|
697
644
|
return tok1.value < tok2.value ? 1 : tok1.value > tok2.value ? -1 : 0;
|
698
645
|
}, "compareTokens");
|
699
646
|
|
700
|
-
// ../../../node_modules/.pnpm/cborg@
|
647
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/2bytes.js
|
701
648
|
function toToken(data, pos, prefix, length) {
|
702
649
|
assertEnoughData(data, pos, prefix + length);
|
703
650
|
const buf2 = slice(data, pos + prefix, pos + prefix + length);
|
@@ -753,7 +700,7 @@ function compareBytes(b1, b2) {
|
|
753
700
|
}
|
754
701
|
__name(compareBytes, "compareBytes");
|
755
702
|
|
756
|
-
// ../../../node_modules/.pnpm/cborg@
|
703
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/3string.js
|
757
704
|
function toToken2(data, pos, prefix, length, options) {
|
758
705
|
const totLength = prefix + length;
|
759
706
|
assertEnoughData(data, pos, totLength);
|
@@ -790,7 +737,7 @@ function decodeString64(data, pos, _minor, options) {
|
|
790
737
|
__name(decodeString64, "decodeString64");
|
791
738
|
var encodeString = encodeBytes;
|
792
739
|
|
793
|
-
// ../../../node_modules/.pnpm/cborg@
|
740
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/4array.js
|
794
741
|
function toToken3(_data, _pos, prefix, length) {
|
795
742
|
return new Token(Type.array, length, prefix);
|
796
743
|
}
|
@@ -835,7 +782,7 @@ encodeArray.encodedSize = /* @__PURE__ */ __name(function encodedSize5(token) {
|
|
835
782
|
return encodeUintValue.encodedSize(token.value);
|
836
783
|
}, "encodedSize");
|
837
784
|
|
838
|
-
// ../../../node_modules/.pnpm/cborg@
|
785
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/5map.js
|
839
786
|
function toToken4(_data, _pos, prefix, length) {
|
840
787
|
return new Token(Type.map, length, prefix);
|
841
788
|
}
|
@@ -880,7 +827,7 @@ encodeMap.encodedSize = /* @__PURE__ */ __name(function encodedSize6(token) {
|
|
880
827
|
return encodeUintValue.encodedSize(token.value);
|
881
828
|
}, "encodedSize");
|
882
829
|
|
883
|
-
// ../../../node_modules/.pnpm/cborg@
|
830
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/6tag.js
|
884
831
|
function decodeTagCompact(_data, _pos, minor, _options) {
|
885
832
|
return new Token(Type.tag, minor, 1);
|
886
833
|
}
|
@@ -910,7 +857,7 @@ encodeTag.encodedSize = /* @__PURE__ */ __name(function encodedSize7(token) {
|
|
910
857
|
return encodeUintValue.encodedSize(token.value);
|
911
858
|
}, "encodedSize");
|
912
859
|
|
913
|
-
// ../../../node_modules/.pnpm/cborg@
|
860
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/7float.js
|
914
861
|
var MINOR_FALSE = 20;
|
915
862
|
var MINOR_TRUE = 21;
|
916
863
|
var MINOR_NULL = 22;
|
@@ -1098,7 +1045,7 @@ function readFloat64(ui8a2, pos) {
|
|
1098
1045
|
__name(readFloat64, "readFloat64");
|
1099
1046
|
encodeFloat.compareTokens = encodeUint.compareTokens;
|
1100
1047
|
|
1101
|
-
// ../../../node_modules/.pnpm/cborg@
|
1048
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/jump.js
|
1102
1049
|
function invalidMinor(data, pos, minor) {
|
1103
1050
|
throw new Error(`${decodeErrPrefix} encountered invalid minor (${minor}) for major ${data[pos] >>> 5}`);
|
1104
1051
|
}
|
@@ -1257,7 +1204,7 @@ function quickEncodeToken(token) {
|
|
1257
1204
|
}
|
1258
1205
|
__name(quickEncodeToken, "quickEncodeToken");
|
1259
1206
|
|
1260
|
-
// ../../../node_modules/.pnpm/cborg@
|
1207
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/encode.js
|
1261
1208
|
var defaultEncodeOptions = {
|
1262
1209
|
float64: false,
|
1263
1210
|
mapSorter,
|
@@ -1349,10 +1296,7 @@ var typeEncoders = {
|
|
1349
1296
|
Array(obj, _typ, options, refStack) {
|
1350
1297
|
if (!obj.length) {
|
1351
1298
|
if (options.addBreakTokens === true) {
|
1352
|
-
return [
|
1353
|
-
simpleTokens.emptyArray,
|
1354
|
-
new Token(Type.break)
|
1355
|
-
];
|
1299
|
+
return [simpleTokens.emptyArray, new Token(Type.break)];
|
1356
1300
|
}
|
1357
1301
|
return simpleTokens.emptyArray;
|
1358
1302
|
}
|
@@ -1363,16 +1307,9 @@ var typeEncoders = {
|
|
1363
1307
|
entries[i++] = objectToTokens(e, options, refStack);
|
1364
1308
|
}
|
1365
1309
|
if (options.addBreakTokens) {
|
1366
|
-
return [
|
1367
|
-
new Token(Type.array, obj.length),
|
1368
|
-
entries,
|
1369
|
-
new Token(Type.break)
|
1370
|
-
];
|
1310
|
+
return [new Token(Type.array, obj.length), entries, new Token(Type.break)];
|
1371
1311
|
}
|
1372
|
-
return [
|
1373
|
-
new Token(Type.array, obj.length),
|
1374
|
-
entries
|
1375
|
-
];
|
1312
|
+
return [new Token(Type.array, obj.length), entries];
|
1376
1313
|
},
|
1377
1314
|
Object(obj, typ, options, refStack) {
|
1378
1315
|
const isMap = typ !== "Object";
|
@@ -1380,10 +1317,7 @@ var typeEncoders = {
|
|
1380
1317
|
const length = isMap ? obj.size : keys.length;
|
1381
1318
|
if (!length) {
|
1382
1319
|
if (options.addBreakTokens === true) {
|
1383
|
-
return [
|
1384
|
-
simpleTokens.emptyMap,
|
1385
|
-
new Token(Type.break)
|
1386
|
-
];
|
1320
|
+
return [simpleTokens.emptyMap, new Token(Type.break)];
|
1387
1321
|
}
|
1388
1322
|
return simpleTokens.emptyMap;
|
1389
1323
|
}
|
@@ -1398,16 +1332,9 @@ var typeEncoders = {
|
|
1398
1332
|
}
|
1399
1333
|
sortMapEntries(entries, options);
|
1400
1334
|
if (options.addBreakTokens) {
|
1401
|
-
return [
|
1402
|
-
new Token(Type.map, length),
|
1403
|
-
entries,
|
1404
|
-
new Token(Type.break)
|
1405
|
-
];
|
1335
|
+
return [new Token(Type.map, length), entries, new Token(Type.break)];
|
1406
1336
|
}
|
1407
|
-
return [
|
1408
|
-
new Token(Type.map, length),
|
1409
|
-
entries
|
1410
|
-
];
|
1337
|
+
return [new Token(Type.map, length), entries];
|
1411
1338
|
}
|
1412
1339
|
};
|
1413
1340
|
typeEncoders.Map = typeEncoders.Object;
|
@@ -1490,7 +1417,7 @@ function encode(data, options) {
|
|
1490
1417
|
}
|
1491
1418
|
__name(encode, "encode");
|
1492
1419
|
|
1493
|
-
// ../../../node_modules/.pnpm/cborg@
|
1420
|
+
// ../../../node_modules/.pnpm/cborg@4.2.4/node_modules/cborg/lib/decode.js
|
1494
1421
|
var defaultDecodeOptions = {
|
1495
1422
|
strict: false,
|
1496
1423
|
allowIndefinite: true,
|
@@ -1499,15 +1426,18 @@ var defaultDecodeOptions = {
|
|
1499
1426
|
};
|
1500
1427
|
var Tokeniser = class {
|
1501
1428
|
constructor(data, options = {}) {
|
1502
|
-
this.
|
1429
|
+
this._pos = 0;
|
1503
1430
|
this.data = data;
|
1504
1431
|
this.options = options;
|
1505
1432
|
}
|
1433
|
+
pos() {
|
1434
|
+
return this._pos;
|
1435
|
+
}
|
1506
1436
|
done() {
|
1507
|
-
return this.
|
1437
|
+
return this._pos >= this.data.length;
|
1508
1438
|
}
|
1509
1439
|
next() {
|
1510
|
-
const byt = this.data[this.
|
1440
|
+
const byt = this.data[this._pos];
|
1511
1441
|
let token = quick[byt];
|
1512
1442
|
if (token === void 0) {
|
1513
1443
|
const decoder = jump[byt];
|
@@ -1515,9 +1445,9 @@ var Tokeniser = class {
|
|
1515
1445
|
throw new Error(`${decodeErrPrefix} no decoder for major type ${byt >>> 5} (byte 0x${byt.toString(16).padStart(2, "0")})`);
|
1516
1446
|
}
|
1517
1447
|
const minor = byt & 31;
|
1518
|
-
token = decoder(this.data, this.
|
1448
|
+
token = decoder(this.data, this._pos, minor, this.options);
|
1519
1449
|
}
|
1520
|
-
this.
|
1450
|
+
this._pos += token.encodedLength;
|
1521
1451
|
return token;
|
1522
1452
|
}
|
1523
1453
|
};
|
@@ -1605,7 +1535,7 @@ function tokensToObject(tokeniser, options) {
|
|
1605
1535
|
throw new Error("unsupported");
|
1606
1536
|
}
|
1607
1537
|
__name(tokensToObject, "tokensToObject");
|
1608
|
-
function
|
1538
|
+
function decodeFirst(data, options) {
|
1609
1539
|
if (!(data instanceof Uint8Array)) {
|
1610
1540
|
throw new Error(`${decodeErrPrefix} data to decode must be a Uint8Array`);
|
1611
1541
|
}
|
@@ -1618,14 +1548,19 @@ function decode(data, options) {
|
|
1618
1548
|
if (decoded === BREAK) {
|
1619
1549
|
throw new Error(`${decodeErrPrefix} got unexpected break`);
|
1620
1550
|
}
|
1621
|
-
|
1551
|
+
return [decoded, data.subarray(tokeniser.pos())];
|
1552
|
+
}
|
1553
|
+
__name(decodeFirst, "decodeFirst");
|
1554
|
+
function decode(data, options) {
|
1555
|
+
const [decoded, remainder] = decodeFirst(data, options);
|
1556
|
+
if (remainder.length > 0) {
|
1622
1557
|
throw new Error(`${decodeErrPrefix} too many terminals, data makes no sense`);
|
1623
1558
|
}
|
1624
1559
|
return decoded;
|
1625
1560
|
}
|
1626
1561
|
__name(decode, "decode");
|
1627
1562
|
|
1628
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
1563
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/CborldError.js
|
1629
1564
|
var CborldError = class extends Error {
|
1630
1565
|
constructor(value, message) {
|
1631
1566
|
super();
|
@@ -1637,7 +1572,39 @@ var CborldError = class extends Error {
|
|
1637
1572
|
};
|
1638
1573
|
__name(CborldError, "CborldError");
|
1639
1574
|
|
1640
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
1575
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/keywords.js
|
1576
|
+
var KEYWORDS = /* @__PURE__ */ new Map([
|
1577
|
+
["@context", 0],
|
1578
|
+
["@type", 2],
|
1579
|
+
["@id", 4],
|
1580
|
+
["@value", 6],
|
1581
|
+
["@direction", 8],
|
1582
|
+
["@graph", 10],
|
1583
|
+
["@included", 12],
|
1584
|
+
["@index", 14],
|
1585
|
+
["@json", 16],
|
1586
|
+
["@language", 18],
|
1587
|
+
["@list", 20],
|
1588
|
+
["@nest", 22],
|
1589
|
+
["@reverse", 24],
|
1590
|
+
["@base", 26],
|
1591
|
+
["@container", 28],
|
1592
|
+
["@default", 30],
|
1593
|
+
["@embed", 32],
|
1594
|
+
["@explicit", 34],
|
1595
|
+
["@none", 36],
|
1596
|
+
["@omitDefault", 38],
|
1597
|
+
["@prefix", 40],
|
1598
|
+
["@preserve", 42],
|
1599
|
+
["@protected", 44],
|
1600
|
+
["@requireAll", 46],
|
1601
|
+
["@set", 48],
|
1602
|
+
["@version", 50],
|
1603
|
+
["@vocab", 52]
|
1604
|
+
]);
|
1605
|
+
var FIRST_CUSTOM_TERM_ID = 100;
|
1606
|
+
|
1607
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/CborldDecoder.js
|
1641
1608
|
var CborldDecoder = class {
|
1642
1609
|
decode({ value } = {}) {
|
1643
1610
|
throw new Error("Must be implemented by derived class.");
|
@@ -1648,7 +1615,7 @@ var CborldDecoder = class {
|
|
1648
1615
|
};
|
1649
1616
|
__name(CborldDecoder, "CborldDecoder");
|
1650
1617
|
|
1651
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
1618
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/registeredContexts.js
|
1652
1619
|
var ID_TO_URL = /* @__PURE__ */ new Map();
|
1653
1620
|
var URL_TO_ID = /* @__PURE__ */ new Map();
|
1654
1621
|
_addRegistration(16, "https://www.w3.org/ns/activitystreams");
|
@@ -1666,15 +1633,19 @@ _addRegistration(27, "https://w3id.org/security/suites/hmac-2019/v1");
|
|
1666
1633
|
_addRegistration(28, "https://w3id.org/security/suites/aes-2019/v1");
|
1667
1634
|
_addRegistration(29, "https://w3id.org/vaccination/v1");
|
1668
1635
|
_addRegistration(30, "https://w3id.org/vc-revocation-list-2020/v1");
|
1669
|
-
_addRegistration(31, "https://w3id.org/dcc/
|
1636
|
+
_addRegistration(31, "https://w3id.org/dcc/v1");
|
1670
1637
|
_addRegistration(32, "https://w3id.org/vc/status-list/v1");
|
1638
|
+
_addRegistration(48, "https://w3id.org/security/data-integrity/v1");
|
1639
|
+
_addRegistration(49, "https://w3id.org/security/multikey/v1");
|
1640
|
+
_addRegistration(50, "https://purl.imsglobal.org/spec/ob/v3p0/context.json");
|
1641
|
+
_addRegistration(51, "https://w3id.org/security/data-integrity/v2");
|
1671
1642
|
function _addRegistration(id, url) {
|
1672
1643
|
URL_TO_ID.set(url, id);
|
1673
1644
|
ID_TO_URL.set(id, url);
|
1674
1645
|
}
|
1675
1646
|
__name(_addRegistration, "_addRegistration");
|
1676
1647
|
|
1677
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
1648
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/ContextDecoder.js
|
1678
1649
|
var ContextDecoder = class extends CborldDecoder {
|
1679
1650
|
constructor({ reverseAppContextMap } = {}) {
|
1680
1651
|
super();
|
@@ -1686,7 +1657,10 @@ var ContextDecoder = class extends CborldDecoder {
|
|
1686
1657
|
}
|
1687
1658
|
const url = ID_TO_URL.get(value) || this.reverseAppContextMap.get(value);
|
1688
1659
|
if (url === void 0) {
|
1689
|
-
throw new CborldError(
|
1660
|
+
throw new CborldError(
|
1661
|
+
"ERR_UNDEFINED_COMPRESSED_CONTEXT",
|
1662
|
+
`Undefined compressed context "${value}".`
|
1663
|
+
);
|
1690
1664
|
}
|
1691
1665
|
return url;
|
1692
1666
|
}
|
@@ -1711,11 +1685,15 @@ function _mapToObject(map) {
|
|
1711
1685
|
}
|
1712
1686
|
__name(_mapToObject, "_mapToObject");
|
1713
1687
|
|
1714
|
-
// ../../../node_modules/.pnpm
|
1715
|
-
|
1688
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/util-browser.js
|
1689
|
+
function inspect(data, options) {
|
1690
|
+
return JSON.stringify(data, null, 2);
|
1691
|
+
}
|
1692
|
+
__name(inspect, "inspect");
|
1693
|
+
|
1694
|
+
// ../../../node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.mjs
|
1695
|
+
var version = "3.7.7";
|
1716
1696
|
var VERSION = version;
|
1717
|
-
var _hasatob = typeof atob === "function";
|
1718
|
-
var _hasbtoa = typeof btoa === "function";
|
1719
1697
|
var _hasBuffer = typeof Buffer === "function";
|
1720
1698
|
var _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
|
1721
1699
|
var _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
|
@@ -1742,7 +1720,7 @@ var btoaPolyfill = /* @__PURE__ */ __name((bin) => {
|
|
1742
1720
|
}
|
1743
1721
|
return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
|
1744
1722
|
}, "btoaPolyfill");
|
1745
|
-
var _btoa =
|
1723
|
+
var _btoa = typeof btoa === "function" ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
|
1746
1724
|
var _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
|
1747
1725
|
const maxargs = 4096;
|
1748
1726
|
let strs = [];
|
@@ -1791,7 +1769,7 @@ var atobPolyfill = /* @__PURE__ */ __name((asc) => {
|
|
1791
1769
|
}
|
1792
1770
|
return bin;
|
1793
1771
|
}, "atobPolyfill");
|
1794
|
-
var _atob =
|
1772
|
+
var _atob = typeof atob === "function" ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
|
1795
1773
|
var _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a).split("").map((c) => c.charCodeAt(0)));
|
1796
1774
|
var toUint8Array = /* @__PURE__ */ __name((a) => _toUint8Array(_unURI(a)), "toUint8Array");
|
1797
1775
|
var _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
|
@@ -1968,7 +1946,7 @@ function decode4(input) {
|
|
1968
1946
|
}
|
1969
1947
|
__name(decode4, "decode");
|
1970
1948
|
|
1971
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
1949
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseDecoder.js
|
1972
1950
|
var MultibaseDecoder = class extends CborldDecoder {
|
1973
1951
|
decode({ value } = {}) {
|
1974
1952
|
const { buffer: buffer2, byteOffset, length } = value;
|
@@ -1992,39 +1970,7 @@ var MultibaseDecoder = class extends CborldDecoder {
|
|
1992
1970
|
};
|
1993
1971
|
__name(MultibaseDecoder, "MultibaseDecoder");
|
1994
1972
|
|
1995
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
1996
|
-
var KEYWORDS = /* @__PURE__ */ new Map([
|
1997
|
-
["@context", 0],
|
1998
|
-
["@type", 2],
|
1999
|
-
["@id", 4],
|
2000
|
-
["@value", 6],
|
2001
|
-
["@direction", 8],
|
2002
|
-
["@graph", 10],
|
2003
|
-
["@included", 12],
|
2004
|
-
["@index", 14],
|
2005
|
-
["@json", 16],
|
2006
|
-
["@language", 18],
|
2007
|
-
["@list", 20],
|
2008
|
-
["@nest", 22],
|
2009
|
-
["@reverse", 24],
|
2010
|
-
["@base", 26],
|
2011
|
-
["@container", 28],
|
2012
|
-
["@default", 30],
|
2013
|
-
["@embed", 32],
|
2014
|
-
["@explicit", 34],
|
2015
|
-
["@none", 36],
|
2016
|
-
["@omitDefault", 38],
|
2017
|
-
["@prefix", 40],
|
2018
|
-
["@preserve", 42],
|
2019
|
-
["@protected", 44],
|
2020
|
-
["@requireAll", 46],
|
2021
|
-
["@set", 48],
|
2022
|
-
["@version", 50],
|
2023
|
-
["@vocab", 52]
|
2024
|
-
]);
|
2025
|
-
var FIRST_CUSTOM_TERM_ID = 100;
|
2026
|
-
|
2027
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/Transformer.js
|
1973
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/Transformer.js
|
2028
1974
|
var Transformer = class {
|
2029
1975
|
constructor({ appContextMap, documentLoader } = {}) {
|
2030
1976
|
this.appContextMap = appContextMap;
|
@@ -2044,7 +1990,9 @@ var Transformer = class {
|
|
2044
1990
|
this._beforeTypeScopedContexts({ activeCtx, obj, transformMap });
|
2045
1991
|
activeCtx = await this._applyTypeScopedContexts({ obj, contextStack });
|
2046
1992
|
const { aliases, scopedContextMap, termMap } = activeCtx;
|
2047
|
-
const termEntries = this._getEntries(
|
1993
|
+
const termEntries = this._getEntries(
|
1994
|
+
{ obj, transformMap, transformer: this, termMap }
|
1995
|
+
);
|
2048
1996
|
for (const [termInfo, value] of termEntries) {
|
2049
1997
|
const { term } = termInfo;
|
2050
1998
|
if (term === "@id" || aliases.id.has(term)) {
|
@@ -2066,7 +2014,9 @@ var Transformer = class {
|
|
2066
2014
|
propertyContextStack = contextStack.slice();
|
2067
2015
|
}
|
2068
2016
|
const { plural, def } = termInfo;
|
2069
|
-
const termType = this._getTermType(
|
2017
|
+
const termType = this._getTermType(
|
2018
|
+
{ activeCtx: newActiveCtx || activeCtx, def }
|
2019
|
+
);
|
2070
2020
|
const values = plural ? value : [value];
|
2071
2021
|
const entries = [];
|
2072
2022
|
for (const value2 of values) {
|
@@ -2082,7 +2032,9 @@ var Transformer = class {
|
|
2082
2032
|
continue;
|
2083
2033
|
}
|
2084
2034
|
if (Array.isArray(value2)) {
|
2085
|
-
await this._transformArray(
|
2035
|
+
await this._transformArray(
|
2036
|
+
{ entries, contextStack: propertyContextStack, value: value2 }
|
2037
|
+
);
|
2086
2038
|
continue;
|
2087
2039
|
}
|
2088
2040
|
await this._transformObject({
|
@@ -2223,8 +2175,12 @@ var Transformer = class {
|
|
2223
2175
|
if (importUrl) {
|
2224
2176
|
let importEntry = contextMap.get(importUrl);
|
2225
2177
|
if (!importEntry) {
|
2226
|
-
const { "@context": importCtx } = await this._getDocument(
|
2227
|
-
|
2178
|
+
const { "@context": importCtx } = await this._getDocument(
|
2179
|
+
{ url: importUrl }
|
2180
|
+
);
|
2181
|
+
importEntry = await this._addContext(
|
2182
|
+
{ context: importCtx, contextUrl: importUrl }
|
2183
|
+
);
|
2228
2184
|
}
|
2229
2185
|
context = { ...importEntry.context, ...context };
|
2230
2186
|
}
|
@@ -2288,14 +2244,20 @@ var Transformer = class {
|
|
2288
2244
|
return prefixDef + suffix.join(":");
|
2289
2245
|
}
|
2290
2246
|
if (!(typeof prefixDef === "object" && typeof prefixDef["@id"] === "string")) {
|
2291
|
-
throw new CborldError(
|
2247
|
+
throw new CborldError(
|
2248
|
+
"ERR_INVALID_TERM_DEFINITION",
|
2249
|
+
'JSON-LD term definitions must be strings or objects with "@id".'
|
2250
|
+
);
|
2292
2251
|
}
|
2293
2252
|
return prefixDef["@id"] + suffix.join(":");
|
2294
2253
|
}
|
2295
2254
|
_getIdForTerm({ term, plural }) {
|
2296
2255
|
const id = this.termToId.get(term);
|
2297
2256
|
if (id === void 0) {
|
2298
|
-
throw new CborldError(
|
2257
|
+
throw new CborldError(
|
2258
|
+
"ERR_UNDEFINED_TERM",
|
2259
|
+
"CBOR-LD compression requires all terms to be defined in a JSON-LD context."
|
2260
|
+
);
|
2299
2261
|
}
|
2300
2262
|
return plural ? id + 1 : id;
|
2301
2263
|
}
|
@@ -2307,7 +2269,7 @@ var Transformer = class {
|
|
2307
2269
|
};
|
2308
2270
|
__name(Transformer, "Transformer");
|
2309
2271
|
|
2310
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2272
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlDecoder.js
|
2311
2273
|
var ID_TO_SCHEME = /* @__PURE__ */ new Map([
|
2312
2274
|
[1024, "did:v1:nym:"],
|
2313
2275
|
[1025, "did:key:"]
|
@@ -2341,7 +2303,7 @@ var Base58DidUrlDecoder = class extends CborldDecoder {
|
|
2341
2303
|
};
|
2342
2304
|
__name(Base58DidUrlDecoder, "Base58DidUrlDecoder");
|
2343
2305
|
|
2344
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2306
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlDecoder.js
|
2345
2307
|
var HttpUrlDecoder = class extends CborldDecoder {
|
2346
2308
|
constructor({ secure } = {}) {
|
2347
2309
|
super();
|
@@ -2360,25 +2322,27 @@ var HttpUrlDecoder = class extends CborldDecoder {
|
|
2360
2322
|
};
|
2361
2323
|
__name(HttpUrlDecoder, "HttpUrlDecoder");
|
2362
2324
|
|
2363
|
-
// ../../../node_modules/.pnpm/uuid@
|
2325
|
+
// ../../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/regex.js
|
2364
2326
|
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;
|
2365
2327
|
|
2366
|
-
// ../../../node_modules/.pnpm/uuid@
|
2328
|
+
// ../../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/validate.js
|
2367
2329
|
function validate(uuid) {
|
2368
2330
|
return typeof uuid === "string" && regex_default.test(uuid);
|
2369
2331
|
}
|
2370
2332
|
__name(validate, "validate");
|
2371
2333
|
var validate_default = validate;
|
2372
2334
|
|
2373
|
-
// ../../../node_modules/.pnpm/uuid@
|
2335
|
+
// ../../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/stringify.js
|
2374
2336
|
var byteToHex = [];
|
2375
|
-
for (i = 0; i < 256; ++i) {
|
2376
|
-
byteToHex.push((i + 256).toString(16).
|
2337
|
+
for (let i = 0; i < 256; ++i) {
|
2338
|
+
byteToHex.push((i + 256).toString(16).slice(1));
|
2377
2339
|
}
|
2378
|
-
|
2379
|
-
|
2380
|
-
|
2381
|
-
|
2340
|
+
function unsafeStringify(arr, offset = 0) {
|
2341
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
2342
|
+
}
|
2343
|
+
__name(unsafeStringify, "unsafeStringify");
|
2344
|
+
function stringify(arr, offset = 0) {
|
2345
|
+
const uuid = unsafeStringify(arr, offset);
|
2382
2346
|
if (!validate_default(uuid)) {
|
2383
2347
|
throw TypeError("Stringified UUID is invalid");
|
2384
2348
|
}
|
@@ -2387,13 +2351,13 @@ function stringify(arr) {
|
|
2387
2351
|
__name(stringify, "stringify");
|
2388
2352
|
var stringify_default = stringify;
|
2389
2353
|
|
2390
|
-
// ../../../node_modules/.pnpm/uuid@
|
2354
|
+
// ../../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/parse.js
|
2391
2355
|
function parse(uuid) {
|
2392
2356
|
if (!validate_default(uuid)) {
|
2393
2357
|
throw TypeError("Invalid UUID");
|
2394
2358
|
}
|
2395
|
-
|
2396
|
-
|
2359
|
+
let v;
|
2360
|
+
const arr = new Uint8Array(16);
|
2397
2361
|
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
2398
2362
|
arr[1] = v >>> 16 & 255;
|
2399
2363
|
arr[2] = v >>> 8 & 255;
|
@@ -2415,7 +2379,7 @@ function parse(uuid) {
|
|
2415
2379
|
__name(parse, "parse");
|
2416
2380
|
var parse_default = parse;
|
2417
2381
|
|
2418
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2382
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnDecoder.js
|
2419
2383
|
var UuidUrnDecoder = class extends CborldDecoder {
|
2420
2384
|
decode({ value } = {}) {
|
2421
2385
|
const uuid = typeof value[1] === "string" ? value[1] : stringify_default(value[1]);
|
@@ -2429,7 +2393,7 @@ var UuidUrnDecoder = class extends CborldDecoder {
|
|
2429
2393
|
};
|
2430
2394
|
__name(UuidUrnDecoder, "UuidUrnDecoder");
|
2431
2395
|
|
2432
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2396
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/UriDecoder.js
|
2433
2397
|
var SCHEME_ID_TO_DECODER = /* @__PURE__ */ new Map([
|
2434
2398
|
[1, HttpUrlDecoder],
|
2435
2399
|
[2, HttpUrlDecoder],
|
@@ -2448,7 +2412,7 @@ var UriDecoder = class extends CborldDecoder {
|
|
2448
2412
|
};
|
2449
2413
|
__name(UriDecoder, "UriDecoder");
|
2450
2414
|
|
2451
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2415
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermDecoder.js
|
2452
2416
|
var VocabTermDecoder = class extends CborldDecoder {
|
2453
2417
|
constructor({ term } = {}) {
|
2454
2418
|
super();
|
@@ -2469,7 +2433,7 @@ var VocabTermDecoder = class extends CborldDecoder {
|
|
2469
2433
|
};
|
2470
2434
|
__name(VocabTermDecoder, "VocabTermDecoder");
|
2471
2435
|
|
2472
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2436
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateDecoder.js
|
2473
2437
|
var XsdDateDecoder = class extends CborldDecoder {
|
2474
2438
|
decode({ value } = {}) {
|
2475
2439
|
const dateString = new Date(value * 1e3).toISOString();
|
@@ -2483,7 +2447,7 @@ var XsdDateDecoder = class extends CborldDecoder {
|
|
2483
2447
|
};
|
2484
2448
|
__name(XsdDateDecoder, "XsdDateDecoder");
|
2485
2449
|
|
2486
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2450
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeDecoder.js
|
2487
2451
|
var XsdDateTimeDecoder = class extends CborldDecoder {
|
2488
2452
|
constructor({ value } = {}) {
|
2489
2453
|
super();
|
@@ -2506,13 +2470,7 @@ var XsdDateTimeDecoder = class extends CborldDecoder {
|
|
2506
2470
|
};
|
2507
2471
|
__name(XsdDateTimeDecoder, "XsdDateTimeDecoder");
|
2508
2472
|
|
2509
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2510
|
-
function inspect(data, options) {
|
2511
|
-
return JSON.stringify(data, null, 2);
|
2512
|
-
}
|
2513
|
-
__name(inspect, "inspect");
|
2514
|
-
|
2515
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/Decompressor.js
|
2473
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/Decompressor.js
|
2516
2474
|
var TYPE_DECODERS = /* @__PURE__ */ new Map([
|
2517
2475
|
["@id", UriDecoder],
|
2518
2476
|
["@vocab", VocabTermDecoder],
|
@@ -2558,20 +2516,30 @@ var Decompressor = class extends Transformer {
|
|
2558
2516
|
_beforeObjectContexts({ obj, transformMap }) {
|
2559
2517
|
const encodedContext = transformMap.get(CONTEXT_TERM_ID);
|
2560
2518
|
if (encodedContext) {
|
2561
|
-
const decoder = ContextDecoder.createDecoder(
|
2519
|
+
const decoder = ContextDecoder.createDecoder(
|
2520
|
+
{ value: encodedContext, transformer: this }
|
2521
|
+
);
|
2562
2522
|
obj["@context"] = decoder ? decoder.decode({ value: encodedContext }) : encodedContext;
|
2563
2523
|
}
|
2564
2524
|
const encodedContexts = transformMap.get(CONTEXT_TERM_ID_PLURAL);
|
2565
2525
|
if (encodedContexts) {
|
2566
2526
|
if (encodedContext) {
|
2567
|
-
throw new CborldError(
|
2527
|
+
throw new CborldError(
|
2528
|
+
"ERR_INVALID_ENCODED_CONTEXT",
|
2529
|
+
"Both singular and plural context IDs were found in the CBOR-LD input."
|
2530
|
+
);
|
2568
2531
|
}
|
2569
2532
|
if (!Array.isArray(encodedContexts)) {
|
2570
|
-
throw new CborldError(
|
2533
|
+
throw new CborldError(
|
2534
|
+
"ERR_INVALID_ENCODED_CONTEXT",
|
2535
|
+
"Encoded plural context value must be an array."
|
2536
|
+
);
|
2571
2537
|
}
|
2572
2538
|
const entries = [];
|
2573
2539
|
for (const value of encodedContexts) {
|
2574
|
-
const decoder = ContextDecoder.createDecoder(
|
2540
|
+
const decoder = ContextDecoder.createDecoder(
|
2541
|
+
{ value, transformer: this }
|
2542
|
+
);
|
2575
2543
|
entries.push(decoder ? decoder.decode({ value }) : value);
|
2576
2544
|
}
|
2577
2545
|
obj["@context"] = entries;
|
@@ -2589,11 +2557,15 @@ var Decompressor = class extends Transformer {
|
|
2589
2557
|
if (value !== void 0) {
|
2590
2558
|
if (Array.isArray(value)) {
|
2591
2559
|
obj[term] = value.map((value2) => {
|
2592
|
-
const decoder = VocabTermDecoder.createDecoder(
|
2560
|
+
const decoder = VocabTermDecoder.createDecoder(
|
2561
|
+
{ value: value2, transformer: this }
|
2562
|
+
);
|
2593
2563
|
return decoder ? decoder.decode({ value: value2 }) : value2;
|
2594
2564
|
});
|
2595
2565
|
} else {
|
2596
|
-
const decoder = VocabTermDecoder.createDecoder(
|
2566
|
+
const decoder = VocabTermDecoder.createDecoder(
|
2567
|
+
{ value, transformer: this }
|
2568
|
+
);
|
2597
2569
|
obj[term] = decoder ? decoder.decode({ value }) : value;
|
2598
2570
|
}
|
2599
2571
|
}
|
@@ -2607,11 +2579,17 @@ var Decompressor = class extends Transformer {
|
|
2607
2579
|
}
|
2608
2580
|
const { term, plural } = this._getTermForId({ id: key });
|
2609
2581
|
if (term === void 0) {
|
2610
|
-
throw new CborldError(
|
2582
|
+
throw new CborldError(
|
2583
|
+
"ERR_UNKNOWN_CBORLD_TERM_ID",
|
2584
|
+
`Unknown term ID '${key}' was detected in the CBOR-LD input.`
|
2585
|
+
);
|
2611
2586
|
}
|
2612
2587
|
const def = termMap.get(term);
|
2613
2588
|
if (def === void 0 && !(term.startsWith("@") && KEYWORDS.has(term))) {
|
2614
|
-
throw new CborldError(
|
2589
|
+
throw new CborldError(
|
2590
|
+
"ERR_UNKNOWN_CBORLD_TERM",
|
2591
|
+
`Unknown term "${term}" was detected in the CBOR-LD input.`
|
2592
|
+
);
|
2615
2593
|
}
|
2616
2594
|
entries.push([{ term, termId: key, plural, def }, value]);
|
2617
2595
|
}
|
@@ -2620,11 +2598,17 @@ var Decompressor = class extends Transformer {
|
|
2620
2598
|
_getTermInfo({ termMap, key }) {
|
2621
2599
|
const { term, plural } = this._getTermForId({ id: key });
|
2622
2600
|
if (term === void 0) {
|
2623
|
-
throw new CborldError(
|
2601
|
+
throw new CborldError(
|
2602
|
+
"ERR_UNKNOWN_CBORLD_TERM_ID",
|
2603
|
+
`Unknown term ID '${key}' was detected in the CBOR-LD input.`
|
2604
|
+
);
|
2624
2605
|
}
|
2625
2606
|
const def = termMap.get(term);
|
2626
2607
|
if (def === void 0 && !(term.startsWith("@") && KEYWORDS.has(term))) {
|
2627
|
-
throw new CborldError(
|
2608
|
+
throw new CborldError(
|
2609
|
+
"ERR_UNKNOWN_CBORLD_TERM",
|
2610
|
+
`Unknown term "${term}" was detected in the CBOR-LD input.`
|
2611
|
+
);
|
2628
2612
|
}
|
2629
2613
|
return { term, termId: key, plural, def };
|
2630
2614
|
}
|
@@ -2637,14 +2621,18 @@ var Decompressor = class extends Transformer {
|
|
2637
2621
|
const values = plural ? value : [value];
|
2638
2622
|
const entries = [];
|
2639
2623
|
for (const value2 of values) {
|
2640
|
-
const decoder = VocabTermDecoder.createDecoder(
|
2624
|
+
const decoder = VocabTermDecoder.createDecoder(
|
2625
|
+
{ value: value2, transformer: this }
|
2626
|
+
);
|
2641
2627
|
entries.push(decoder ? decoder.decode({ value: value2 }) : value2);
|
2642
2628
|
}
|
2643
2629
|
obj[term] = plural ? entries : entries[0];
|
2644
2630
|
}
|
2645
2631
|
_transformTypedValue({ entries, termType, value }) {
|
2646
2632
|
const DecoderClass = TYPE_DECODERS.get(termType);
|
2647
|
-
const decoder = DecoderClass && DecoderClass.createDecoder(
|
2633
|
+
const decoder = DecoderClass && DecoderClass.createDecoder(
|
2634
|
+
{ value, transformer: this }
|
2635
|
+
);
|
2648
2636
|
if (decoder) {
|
2649
2637
|
entries.push(decoder.decode({ value }));
|
2650
2638
|
return true;
|
@@ -2675,7 +2663,7 @@ function _sortEntriesByTerm([{ term: t1 }], [{ term: t2 }]) {
|
|
2675
2663
|
}
|
2676
2664
|
__name(_sortEntriesByTerm, "_sortEntriesByTerm");
|
2677
2665
|
|
2678
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2666
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/decode.js
|
2679
2667
|
async function decode5({
|
2680
2668
|
cborldBytes,
|
2681
2669
|
documentLoader,
|
@@ -2687,17 +2675,29 @@ async function decode5({
|
|
2687
2675
|
}
|
2688
2676
|
let index = 0;
|
2689
2677
|
if (cborldBytes[index++] !== 217) {
|
2690
|
-
throw new CborldError(
|
2678
|
+
throw new CborldError(
|
2679
|
+
"ERR_NOT_CBORLD",
|
2680
|
+
'CBOR-LD must start with a CBOR major type "Tag" header of `0xd9`.'
|
2681
|
+
);
|
2691
2682
|
}
|
2692
2683
|
if (cborldBytes[index++] !== 5) {
|
2693
|
-
throw new CborldError(
|
2684
|
+
throw new CborldError(
|
2685
|
+
"ERR_NOT_CBORLD",
|
2686
|
+
"CBOR-LD 16-bit tag must start with `0x05`."
|
2687
|
+
);
|
2694
2688
|
}
|
2695
2689
|
const compressionMode = cborldBytes[index];
|
2696
2690
|
if (compressionMode === void 0) {
|
2697
|
-
throw new CborldError(
|
2691
|
+
throw new CborldError(
|
2692
|
+
"ERR_NOT_CBORLD",
|
2693
|
+
"Truncated CBOR-LD 16-bit tag."
|
2694
|
+
);
|
2698
2695
|
}
|
2699
2696
|
if (!(compressionMode === 0 || compressionMode === 1)) {
|
2700
|
-
throw new CborldError(
|
2697
|
+
throw new CborldError(
|
2698
|
+
"ERR_NOT_CBORLD",
|
2699
|
+
`Unsupported CBOR-LD compression mode "${compressionMode}".`
|
2700
|
+
);
|
2701
2701
|
}
|
2702
2702
|
index++;
|
2703
2703
|
const { buffer: buffer2, byteOffset, length } = cborldBytes;
|
@@ -2706,7 +2706,9 @@ async function decode5({
|
|
2706
2706
|
return decode(suffix, { useMaps: false });
|
2707
2707
|
}
|
2708
2708
|
const decompressor = new Decompressor({ documentLoader, appContextMap });
|
2709
|
-
const result = await decompressor.decompress(
|
2709
|
+
const result = await decompressor.decompress(
|
2710
|
+
{ compressedBytes: suffix, diagnose }
|
2711
|
+
);
|
2710
2712
|
if (diagnose) {
|
2711
2713
|
diagnose("Diagnostic JSON-LD result:");
|
2712
2714
|
diagnose(inspect(result, { depth: null, colors: true }));
|
@@ -2715,7 +2717,7 @@ async function decode5({
|
|
2715
2717
|
}
|
2716
2718
|
__name(decode5, "decode");
|
2717
2719
|
|
2718
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2720
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/CborldEncoder.js
|
2719
2721
|
var CborldEncoder = class {
|
2720
2722
|
encode() {
|
2721
2723
|
throw new Error("Must be implemented by derived class.");
|
@@ -2726,7 +2728,7 @@ var CborldEncoder = class {
|
|
2726
2728
|
};
|
2727
2729
|
__name(CborldEncoder, "CborldEncoder");
|
2728
2730
|
|
2729
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2731
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/ContextEncoder.js
|
2730
2732
|
var ContextEncoder = class extends CborldEncoder {
|
2731
2733
|
constructor({ context, appContextMap } = {}) {
|
2732
2734
|
super();
|
@@ -2751,7 +2753,7 @@ var ContextEncoder = class extends CborldEncoder {
|
|
2751
2753
|
};
|
2752
2754
|
__name(ContextEncoder, "ContextEncoder");
|
2753
2755
|
|
2754
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2756
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseEncoder.js
|
2755
2757
|
var MultibaseEncoder = class extends CborldEncoder {
|
2756
2758
|
constructor({ value } = {}) {
|
2757
2759
|
super();
|
@@ -2784,7 +2786,7 @@ var MultibaseEncoder = class extends CborldEncoder {
|
|
2784
2786
|
};
|
2785
2787
|
__name(MultibaseEncoder, "MultibaseEncoder");
|
2786
2788
|
|
2787
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2789
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlEncoder.js
|
2788
2790
|
var SCHEME_TO_ID = /* @__PURE__ */ new Map([
|
2789
2791
|
["did:v1:nym:", 1024],
|
2790
2792
|
["did:key:", 1025]
|
@@ -2829,7 +2831,7 @@ function _multibase58ToToken(str) {
|
|
2829
2831
|
}
|
2830
2832
|
__name(_multibase58ToToken, "_multibase58ToToken");
|
2831
2833
|
|
2832
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2834
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlEncoder.js
|
2833
2835
|
var HttpUrlEncoder = class extends CborldEncoder {
|
2834
2836
|
constructor({ value, secure } = {}) {
|
2835
2837
|
super();
|
@@ -2856,7 +2858,7 @@ var HttpUrlEncoder = class extends CborldEncoder {
|
|
2856
2858
|
};
|
2857
2859
|
__name(HttpUrlEncoder, "HttpUrlEncoder");
|
2858
2860
|
|
2859
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2861
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnEncoder.js
|
2860
2862
|
var UuidUrnEncoder = class extends CborldEncoder {
|
2861
2863
|
constructor({ value } = {}) {
|
2862
2864
|
super();
|
@@ -2882,7 +2884,7 @@ var UuidUrnEncoder = class extends CborldEncoder {
|
|
2882
2884
|
};
|
2883
2885
|
__name(UuidUrnEncoder, "UuidUrnEncoder");
|
2884
2886
|
|
2885
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2887
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/UriEncoder.js
|
2886
2888
|
var SCHEME_TO_ENCODER = /* @__PURE__ */ new Map([
|
2887
2889
|
["http", HttpUrlEncoder],
|
2888
2890
|
["https", HttpUrlEncoder],
|
@@ -2914,7 +2916,7 @@ var UriEncoder = class extends CborldEncoder {
|
|
2914
2916
|
};
|
2915
2917
|
__name(UriEncoder, "UriEncoder");
|
2916
2918
|
|
2917
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2919
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermEncoder.js
|
2918
2920
|
var VocabTermEncoder = class extends CborldEncoder {
|
2919
2921
|
constructor({ termId } = {}) {
|
2920
2922
|
super();
|
@@ -2934,7 +2936,7 @@ var VocabTermEncoder = class extends CborldEncoder {
|
|
2934
2936
|
};
|
2935
2937
|
__name(VocabTermEncoder, "VocabTermEncoder");
|
2936
2938
|
|
2937
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2939
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateEncoder.js
|
2938
2940
|
var XsdDateEncoder = class extends CborldEncoder {
|
2939
2941
|
constructor({ value, parsed } = {}) {
|
2940
2942
|
super();
|
@@ -2964,7 +2966,7 @@ var XsdDateEncoder = class extends CborldEncoder {
|
|
2964
2966
|
};
|
2965
2967
|
__name(XsdDateEncoder, "XsdDateEncoder");
|
2966
2968
|
|
2967
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
2969
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeEncoder.js
|
2968
2970
|
var XsdDateTimeEncoder = class extends CborldEncoder {
|
2969
2971
|
constructor({ value, parsed } = {}) {
|
2970
2972
|
super();
|
@@ -2977,14 +2979,18 @@ var XsdDateTimeEncoder = class extends CborldEncoder {
|
|
2977
2979
|
const secondsToken = new Token(Type.uint, secondsSinceEpoch);
|
2978
2980
|
const millisecondIndex = value.indexOf(".");
|
2979
2981
|
if (millisecondIndex === -1) {
|
2980
|
-
const expectedDate2 = new Date(
|
2982
|
+
const expectedDate2 = new Date(
|
2983
|
+
secondsSinceEpoch * 1e3
|
2984
|
+
).toISOString().replace(".000Z", "Z");
|
2981
2985
|
if (value !== expectedDate2) {
|
2982
2986
|
return new Token(Type.string, value);
|
2983
2987
|
}
|
2984
2988
|
return secondsToken;
|
2985
2989
|
}
|
2986
2990
|
const milliseconds = parseInt(value.substr(millisecondIndex + 1), 10);
|
2987
|
-
const expectedDate = new Date(
|
2991
|
+
const expectedDate = new Date(
|
2992
|
+
secondsSinceEpoch * 1e3 + milliseconds
|
2993
|
+
).toISOString();
|
2988
2994
|
if (value !== expectedDate) {
|
2989
2995
|
return new Token(Type.string, value);
|
2990
2996
|
}
|
@@ -3007,7 +3013,7 @@ var XsdDateTimeEncoder = class extends CborldEncoder {
|
|
3007
3013
|
};
|
3008
3014
|
__name(XsdDateTimeEncoder, "XsdDateTimeEncoder");
|
3009
3015
|
|
3010
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
3016
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/Compressor.js
|
3011
3017
|
var TYPE_ENCODERS = /* @__PURE__ */ new Map([
|
3012
3018
|
["@id", UriEncoder],
|
3013
3019
|
["@vocab", VocabTermEncoder],
|
@@ -3059,7 +3065,9 @@ var Compressor = class extends Transformer {
|
|
3059
3065
|
const isArray = Array.isArray(context);
|
3060
3066
|
const contexts = isArray ? context : [context];
|
3061
3067
|
for (const value of contexts) {
|
3062
|
-
const encoder = ContextEncoder.createEncoder(
|
3068
|
+
const encoder = ContextEncoder.createEncoder(
|
3069
|
+
{ value, transformer: this }
|
3070
|
+
);
|
3063
3071
|
entries.push(encoder || value);
|
3064
3072
|
}
|
3065
3073
|
const id = isArray ? CONTEXT_TERM_ID_PLURAL2 : CONTEXT_TERM_ID2;
|
@@ -3074,7 +3082,10 @@ var Compressor = class extends Transformer {
|
|
3074
3082
|
}
|
3075
3083
|
const def = termMap.get(key);
|
3076
3084
|
if (def === void 0 && !(key.startsWith("@") && KEYWORDS.has(key))) {
|
3077
|
-
throw new CborldError(
|
3085
|
+
throw new CborldError(
|
3086
|
+
"ERR_UNKNOWN_CBORLD_TERM",
|
3087
|
+
`Unknown term '${key}' was detected in the JSON-LD input.`
|
3088
|
+
);
|
3078
3089
|
}
|
3079
3090
|
const value = obj[key];
|
3080
3091
|
const plural = Array.isArray(value);
|
@@ -3085,7 +3096,9 @@ var Compressor = class extends Transformer {
|
|
3085
3096
|
}
|
3086
3097
|
_transformObjectId({ transformMap, termInfo, value }) {
|
3087
3098
|
const { termId } = termInfo;
|
3088
|
-
const encoder = UriEncoder.createEncoder(
|
3099
|
+
const encoder = UriEncoder.createEncoder(
|
3100
|
+
{ value, transformer: this, termInfo }
|
3101
|
+
);
|
3089
3102
|
transformMap.set(termId, encoder || value);
|
3090
3103
|
}
|
3091
3104
|
_transformObjectType({ transformMap, termInfo, value }) {
|
@@ -3093,14 +3106,18 @@ var Compressor = class extends Transformer {
|
|
3093
3106
|
const values = plural ? value : [value];
|
3094
3107
|
const entries = [];
|
3095
3108
|
for (const value2 of values) {
|
3096
|
-
const encoder = VocabTermEncoder.createEncoder(
|
3109
|
+
const encoder = VocabTermEncoder.createEncoder(
|
3110
|
+
{ value: value2, transformer: this, termInfo }
|
3111
|
+
);
|
3097
3112
|
entries.push(encoder || value2);
|
3098
3113
|
}
|
3099
3114
|
transformMap.set(termId, plural ? entries : entries[0]);
|
3100
3115
|
}
|
3101
3116
|
_transformTypedValue({ entries, termType, value, termInfo }) {
|
3102
3117
|
const EncoderClass = TYPE_ENCODERS.get(termType);
|
3103
|
-
const encoder = EncoderClass && EncoderClass.createEncoder(
|
3118
|
+
const encoder = EncoderClass && EncoderClass.createEncoder(
|
3119
|
+
{ value, transformer: this, termInfo }
|
3120
|
+
);
|
3104
3121
|
if (encoder) {
|
3105
3122
|
entries.push(encoder);
|
3106
3123
|
return true;
|
@@ -3127,7 +3144,7 @@ var Compressor = class extends Transformer {
|
|
3127
3144
|
};
|
3128
3145
|
__name(Compressor, "Compressor");
|
3129
3146
|
|
3130
|
-
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.
|
3147
|
+
// ../../../node_modules/.pnpm/@digitalbazaar+cborld@5.2.0/node_modules/@digitalbazaar/cborld/lib/encode.js
|
3131
3148
|
async function encode5({
|
3132
3149
|
jsonldDocument,
|
3133
3150
|
documentLoader,
|
@@ -3136,7 +3153,9 @@ async function encode5({
|
|
3136
3153
|
diagnose
|
3137
3154
|
} = {}) {
|
3138
3155
|
if (!(compressionMode === 0 || compressionMode === 1)) {
|
3139
|
-
throw new TypeError(
|
3156
|
+
throw new TypeError(
|
3157
|
+
'"compressionMode" must be "0" (no compression) or "1" for compression mode version 1.'
|
3158
|
+
);
|
3140
3159
|
}
|
3141
3160
|
const prefix = new Uint8Array([217, 5, compressionMode]);
|
3142
3161
|
let suffix;
|
@@ -3222,7 +3241,7 @@ __name(base32Encode, "base32Encode");
|
|
3222
3241
|
// ../../../node_modules/.pnpm/@digitalbazaar+vpqr@3.0.0/node_modules/@digitalbazaar/vpqr/lib/vpqr.js
|
3223
3242
|
var import_base32_decode = __toESM(require_base32_decode(), 1);
|
3224
3243
|
|
3225
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
3244
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/qrcode/common/Mode.js
|
3226
3245
|
var Mode;
|
3227
3246
|
(function(Mode2) {
|
3228
3247
|
Mode2[Mode2["Terminator"] = 0] = "Terminator";
|
@@ -3234,43 +3253,19 @@ var Mode;
|
|
3234
3253
|
Mode2[Mode2["ECI"] = 7] = "ECI";
|
3235
3254
|
})(Mode || (Mode = {}));
|
3236
3255
|
|
3237
|
-
// ../../../node_modules/.pnpm
|
3238
|
-
var
|
3239
|
-
|
3240
|
-
d2.__proto__ = b2;
|
3241
|
-
} || function(d2, b2) {
|
3242
|
-
for (var p in b2)
|
3243
|
-
if (Object.prototype.hasOwnProperty.call(b2, p))
|
3244
|
-
d2[p] = b2[p];
|
3245
|
-
};
|
3246
|
-
return extendStatics(d, b);
|
3247
|
-
}, "extendStatics");
|
3248
|
-
function __extends(d, b) {
|
3249
|
-
if (typeof b !== "function" && b !== null)
|
3250
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
3251
|
-
extendStatics(d, b);
|
3252
|
-
function __() {
|
3253
|
-
this.constructor = d;
|
3254
|
-
}
|
3255
|
-
__name(__, "__");
|
3256
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
3257
|
-
}
|
3258
|
-
__name(__extends, "__extends");
|
3259
|
-
|
3260
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.3.5/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRData.js
|
3261
|
-
var QRData = /* @__PURE__ */ function() {
|
3262
|
-
function QRData2(mode, data) {
|
3256
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRData.js
|
3257
|
+
var QRData = class {
|
3258
|
+
constructor(mode, data) {
|
3263
3259
|
this.bytes = [];
|
3264
3260
|
this.mode = mode;
|
3265
3261
|
this.data = data;
|
3266
3262
|
}
|
3267
|
-
|
3268
|
-
QRData2.prototype.getLength = function() {
|
3263
|
+
getLength() {
|
3269
3264
|
return this.bytes.length;
|
3270
|
-
}
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3265
|
+
}
|
3266
|
+
getLengthInBits(version2) {
|
3267
|
+
const mode = this.mode;
|
3268
|
+
const error = new Error(`illegal mode: ${mode}`);
|
3274
3269
|
if (1 <= version2 && version2 < 10) {
|
3275
3270
|
switch (mode) {
|
3276
3271
|
case Mode.Numeric:
|
@@ -3311,19 +3306,19 @@ var QRData = /* @__PURE__ */ function() {
|
|
3311
3306
|
throw error;
|
3312
3307
|
}
|
3313
3308
|
} else {
|
3314
|
-
throw new Error(
|
3309
|
+
throw new Error(`illegal version: ${version2}`);
|
3315
3310
|
}
|
3316
|
-
}
|
3317
|
-
|
3318
|
-
|
3311
|
+
}
|
3312
|
+
};
|
3313
|
+
__name(QRData, "QRData");
|
3319
3314
|
|
3320
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
3315
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/encoding/UTF8.js
|
3321
3316
|
function encode6(text) {
|
3322
|
-
|
3323
|
-
|
3324
|
-
|
3325
|
-
for (
|
3326
|
-
|
3317
|
+
let pos = 0;
|
3318
|
+
const { length } = text;
|
3319
|
+
const bytes = [];
|
3320
|
+
for (let i = 0; i < length; i++) {
|
3321
|
+
let code = text.charCodeAt(i);
|
3327
3322
|
if (code < 128) {
|
3328
3323
|
bytes[pos++] = code;
|
3329
3324
|
} else if (code < 2048) {
|
@@ -3345,48 +3340,42 @@ function encode6(text) {
|
|
3345
3340
|
}
|
3346
3341
|
__name(encode6, "encode");
|
3347
3342
|
|
3348
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
3349
|
-
var QRByte =
|
3350
|
-
|
3351
|
-
|
3352
|
-
|
3353
|
-
_this.encoding = -1;
|
3343
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRByte.js
|
3344
|
+
var QRByte = class extends QRData {
|
3345
|
+
constructor(data, encode$1) {
|
3346
|
+
super(Mode.Byte, data);
|
3347
|
+
this.encoding = -1;
|
3354
3348
|
if (typeof encode$1 === "function") {
|
3355
|
-
|
3356
|
-
|
3357
|
-
|
3349
|
+
const { encoding, bytes } = encode$1(data);
|
3350
|
+
this.bytes = bytes;
|
3351
|
+
this.encoding = encoding;
|
3358
3352
|
} else {
|
3359
|
-
|
3360
|
-
|
3353
|
+
this.bytes = encode6(data);
|
3354
|
+
this.encoding = 26;
|
3361
3355
|
}
|
3362
|
-
return _this;
|
3363
3356
|
}
|
3364
|
-
|
3365
|
-
|
3366
|
-
|
3367
|
-
for (var _i = 0, bytes_1 = bytes; _i < bytes_1.length; _i++) {
|
3368
|
-
var byte = bytes_1[_i];
|
3357
|
+
writeTo(buffer2) {
|
3358
|
+
const { bytes } = this;
|
3359
|
+
for (const byte of bytes) {
|
3369
3360
|
buffer2.put(byte, 8);
|
3370
3361
|
}
|
3371
|
-
}
|
3372
|
-
|
3373
|
-
|
3362
|
+
}
|
3363
|
+
};
|
3364
|
+
__name(QRByte, "QRByte");
|
3374
3365
|
|
3375
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
3366
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRMath.js
|
3376
3367
|
var EXP_TABLE = [];
|
3377
3368
|
var LOG_TABLE = [];
|
3378
|
-
for (i = 0; i < 256; i++) {
|
3369
|
+
for (let i = 0; i < 256; i++) {
|
3379
3370
|
LOG_TABLE[i] = 0;
|
3380
3371
|
EXP_TABLE[i] = i < 8 ? 1 << i : EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
|
3381
3372
|
}
|
3382
|
-
|
3383
|
-
for (i = 0; i < 255; i++) {
|
3373
|
+
for (let i = 0; i < 255; i++) {
|
3384
3374
|
LOG_TABLE[EXP_TABLE[i]] = i;
|
3385
3375
|
}
|
3386
|
-
var i;
|
3387
3376
|
function glog(n) {
|
3388
3377
|
if (n < 1) {
|
3389
|
-
throw new Error(
|
3378
|
+
throw new Error(`illegal log: ${n}`);
|
3390
3379
|
}
|
3391
3380
|
return LOG_TABLE[n];
|
3392
3381
|
}
|
@@ -3402,69 +3391,65 @@ function gexp(n) {
|
|
3402
3391
|
}
|
3403
3392
|
__name(gexp, "gexp");
|
3404
3393
|
|
3405
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
3406
|
-
var Polynomial =
|
3407
|
-
|
3408
|
-
|
3409
|
-
|
3410
|
-
}
|
3411
|
-
var offset = 0;
|
3412
|
-
var length = num.length;
|
3394
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/Polynomial.js
|
3395
|
+
var Polynomial = class {
|
3396
|
+
constructor(num, shift = 0) {
|
3397
|
+
let offset = 0;
|
3398
|
+
let { length } = num;
|
3413
3399
|
while (offset < length && num[offset] === 0) {
|
3414
3400
|
offset++;
|
3415
3401
|
}
|
3416
3402
|
length -= offset;
|
3417
|
-
|
3418
|
-
for (
|
3403
|
+
const numbers = [];
|
3404
|
+
for (let i = 0; i < length; i++) {
|
3419
3405
|
numbers.push(num[offset + i]);
|
3420
3406
|
}
|
3421
|
-
for (
|
3407
|
+
for (let i = 0; i < shift; i++) {
|
3422
3408
|
numbers.push(0);
|
3423
3409
|
}
|
3424
3410
|
this.num = numbers;
|
3425
3411
|
}
|
3426
|
-
|
3427
|
-
Polynomial2.prototype.getAt = function(index) {
|
3412
|
+
getAt(index) {
|
3428
3413
|
return this.num[index];
|
3429
|
-
}
|
3430
|
-
|
3414
|
+
}
|
3415
|
+
getLength() {
|
3431
3416
|
return this.num.length;
|
3432
|
-
}
|
3433
|
-
|
3434
|
-
|
3435
|
-
|
3436
|
-
|
3437
|
-
|
3438
|
-
for (
|
3417
|
+
}
|
3418
|
+
multiply(e) {
|
3419
|
+
const num = [];
|
3420
|
+
const eLength = e.getLength();
|
3421
|
+
const tLength = this.getLength();
|
3422
|
+
const dLength = tLength + eLength - 1;
|
3423
|
+
for (let i = 0; i < dLength; i++) {
|
3439
3424
|
num.push(0);
|
3440
3425
|
}
|
3441
|
-
for (
|
3442
|
-
for (
|
3426
|
+
for (let i = 0; i < tLength; i++) {
|
3427
|
+
for (let j = 0; j < eLength; j++) {
|
3443
3428
|
num[i + j] ^= gexp(glog(this.getAt(i)) + glog(e.getAt(j)));
|
3444
3429
|
}
|
3445
3430
|
}
|
3446
|
-
return new
|
3447
|
-
}
|
3448
|
-
|
3449
|
-
|
3450
|
-
|
3431
|
+
return new Polynomial(num);
|
3432
|
+
}
|
3433
|
+
mod(e) {
|
3434
|
+
const eLength = e.getLength();
|
3435
|
+
const tLength = this.getLength();
|
3451
3436
|
if (tLength - eLength < 0) {
|
3452
3437
|
return this;
|
3453
3438
|
}
|
3454
|
-
|
3455
|
-
|
3456
|
-
for (
|
3439
|
+
const ratio = glog(this.getAt(0)) - glog(e.getAt(0));
|
3440
|
+
const num = [];
|
3441
|
+
for (let i = 0; i < tLength; i++) {
|
3457
3442
|
num.push(this.getAt(i));
|
3458
3443
|
}
|
3459
|
-
for (
|
3444
|
+
for (let i = 0; i < eLength; i++) {
|
3460
3445
|
num[i] ^= gexp(glog(e.getAt(i)) + ratio);
|
3461
3446
|
}
|
3462
|
-
return new
|
3463
|
-
}
|
3464
|
-
|
3465
|
-
|
3447
|
+
return new Polynomial(num).mod(e);
|
3448
|
+
}
|
3449
|
+
};
|
3450
|
+
__name(Polynomial, "Polynomial");
|
3466
3451
|
|
3467
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
3452
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRUtil.js
|
3468
3453
|
var N1 = 3;
|
3469
3454
|
var N2 = 3;
|
3470
3455
|
var N3 = 40;
|
@@ -3519,15 +3504,15 @@ function getAlignmentPattern(version2) {
|
|
3519
3504
|
}
|
3520
3505
|
__name(getAlignmentPattern, "getAlignmentPattern");
|
3521
3506
|
function getErrorCorrectionPolynomial(errorCorrectionLength) {
|
3522
|
-
|
3523
|
-
for (
|
3507
|
+
let e = new Polynomial([1]);
|
3508
|
+
for (let i = 0; i < errorCorrectionLength; i++) {
|
3524
3509
|
e = e.multiply(new Polynomial([1, gexp(i)]));
|
3525
3510
|
}
|
3526
3511
|
return e;
|
3527
3512
|
}
|
3528
3513
|
__name(getErrorCorrectionPolynomial, "getErrorCorrectionPolynomial");
|
3529
3514
|
function getBCHDigit(data) {
|
3530
|
-
|
3515
|
+
let digit = 0;
|
3531
3516
|
while (data !== 0) {
|
3532
3517
|
digit++;
|
3533
3518
|
data >>>= 1;
|
@@ -3537,7 +3522,7 @@ function getBCHDigit(data) {
|
|
3537
3522
|
__name(getBCHDigit, "getBCHDigit");
|
3538
3523
|
var G18_BCH = getBCHDigit(G18);
|
3539
3524
|
function getBCHVersion(data) {
|
3540
|
-
|
3525
|
+
let offset = data << 12;
|
3541
3526
|
while (getBCHDigit(offset) - G18_BCH >= 0) {
|
3542
3527
|
offset ^= G18 << getBCHDigit(offset) - G18_BCH;
|
3543
3528
|
}
|
@@ -3546,7 +3531,7 @@ function getBCHVersion(data) {
|
|
3546
3531
|
__name(getBCHVersion, "getBCHVersion");
|
3547
3532
|
var G15_BCH = getBCHDigit(G15);
|
3548
3533
|
function getBCHVersionInfo(data) {
|
3549
|
-
|
3534
|
+
let offset = data << 10;
|
3550
3535
|
while (getBCHDigit(offset) - G15_BCH >= 0) {
|
3551
3536
|
offset ^= G15 << getBCHDigit(offset) - G15_BCH;
|
3552
3537
|
}
|
@@ -3554,13 +3539,13 @@ function getBCHVersionInfo(data) {
|
|
3554
3539
|
}
|
3555
3540
|
__name(getBCHVersionInfo, "getBCHVersionInfo");
|
3556
3541
|
function applyMaskPenaltyRule1Internal(qrcode, isHorizontal) {
|
3557
|
-
|
3558
|
-
|
3559
|
-
for (
|
3560
|
-
|
3561
|
-
|
3562
|
-
for (
|
3563
|
-
|
3542
|
+
const matrixSize = qrcode.getMatrixSize();
|
3543
|
+
let penalty = 0;
|
3544
|
+
for (let i = 0; i < matrixSize; i++) {
|
3545
|
+
let prevBit = false;
|
3546
|
+
let numSameBitCells = 0;
|
3547
|
+
for (let j = 0; j < matrixSize; j++) {
|
3548
|
+
const bit = isHorizontal ? qrcode.isDark(i, j) : qrcode.isDark(j, i);
|
3564
3549
|
if (bit === prevBit) {
|
3565
3550
|
numSameBitCells++;
|
3566
3551
|
if (numSameBitCells === 5) {
|
@@ -3582,11 +3567,11 @@ function applyMaskPenaltyRule1(qrcode) {
|
|
3582
3567
|
}
|
3583
3568
|
__name(applyMaskPenaltyRule1, "applyMaskPenaltyRule1");
|
3584
3569
|
function applyMaskPenaltyRule2(qrcode) {
|
3585
|
-
|
3586
|
-
|
3587
|
-
for (
|
3588
|
-
for (
|
3589
|
-
|
3570
|
+
const matrixSize = qrcode.getMatrixSize();
|
3571
|
+
let penalty = 0;
|
3572
|
+
for (let y = 0; y < matrixSize - 1; y++) {
|
3573
|
+
for (let x = 0; x < matrixSize - 1; x++) {
|
3574
|
+
const value = qrcode.isDark(y, x);
|
3590
3575
|
if (value === qrcode.isDark(y, x + 1) && value === qrcode.isDark(y + 1, x) && value === qrcode.isDark(y + 1, x + 1)) {
|
3591
3576
|
penalty += N2;
|
3592
3577
|
}
|
@@ -3598,8 +3583,8 @@ __name(applyMaskPenaltyRule2, "applyMaskPenaltyRule2");
|
|
3598
3583
|
function isFourWhite(qrcode, rangeIndex, from, to, isHorizontal) {
|
3599
3584
|
from = Math.max(from, 0);
|
3600
3585
|
to = Math.min(to, qrcode.getMatrixSize());
|
3601
|
-
for (
|
3602
|
-
|
3586
|
+
for (let i = from; i < to; i++) {
|
3587
|
+
const value = isHorizontal ? qrcode.isDark(rangeIndex, i) : qrcode.isDark(i, rangeIndex);
|
3603
3588
|
if (value) {
|
3604
3589
|
return false;
|
3605
3590
|
}
|
@@ -3608,10 +3593,10 @@ function isFourWhite(qrcode, rangeIndex, from, to, isHorizontal) {
|
|
3608
3593
|
}
|
3609
3594
|
__name(isFourWhite, "isFourWhite");
|
3610
3595
|
function applyMaskPenaltyRule3(qrcode) {
|
3611
|
-
|
3612
|
-
|
3613
|
-
for (
|
3614
|
-
for (
|
3596
|
+
const matrixSize = qrcode.getMatrixSize();
|
3597
|
+
let penalty = 0;
|
3598
|
+
for (let y = 0; y < matrixSize; y++) {
|
3599
|
+
for (let x = 0; x < matrixSize; x++) {
|
3615
3600
|
if (x + 6 < matrixSize && qrcode.isDark(y, x) && !qrcode.isDark(y, x + 1) && qrcode.isDark(y, x + 2) && qrcode.isDark(y, x + 3) && qrcode.isDark(y, x + 4) && !qrcode.isDark(y, x + 5) && qrcode.isDark(y, x + 6) && (isFourWhite(qrcode, y, x - 4, x, true) || isFourWhite(qrcode, y, x + 7, x + 11, true))) {
|
3616
3601
|
penalty += N3;
|
3617
3602
|
}
|
@@ -3624,17 +3609,17 @@ function applyMaskPenaltyRule3(qrcode) {
|
|
3624
3609
|
}
|
3625
3610
|
__name(applyMaskPenaltyRule3, "applyMaskPenaltyRule3");
|
3626
3611
|
function applyMaskPenaltyRule4(qrcode) {
|
3627
|
-
|
3628
|
-
|
3629
|
-
for (
|
3630
|
-
for (
|
3612
|
+
const matrixSize = qrcode.getMatrixSize();
|
3613
|
+
let numDarkCells = 0;
|
3614
|
+
for (let y = 0; y < matrixSize; y++) {
|
3615
|
+
for (let x = 0; x < matrixSize; x++) {
|
3631
3616
|
if (qrcode.isDark(y, x)) {
|
3632
3617
|
numDarkCells++;
|
3633
3618
|
}
|
3634
3619
|
}
|
3635
3620
|
}
|
3636
|
-
|
3637
|
-
|
3621
|
+
const numTotalCells = matrixSize * matrixSize;
|
3622
|
+
const fivePercentVariances = Math.floor(Math.abs(numDarkCells * 20 - numTotalCells * 10) / numTotalCells);
|
3638
3623
|
return fivePercentVariances * N4;
|
3639
3624
|
}
|
3640
3625
|
__name(applyMaskPenaltyRule4, "applyMaskPenaltyRule4");
|
@@ -3643,7 +3628,7 @@ function calculateMaskPenalty(qrcode) {
|
|
3643
3628
|
}
|
3644
3629
|
__name(calculateMaskPenalty, "calculateMaskPenalty");
|
3645
3630
|
|
3646
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
3631
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/qrcode/common/ErrorCorrectionLevel.js
|
3647
3632
|
var ErrorCorrectionLevel;
|
3648
3633
|
(function(ErrorCorrectionLevel2) {
|
3649
3634
|
ErrorCorrectionLevel2[ErrorCorrectionLevel2["L"] = 1] = "L";
|
@@ -3652,235 +3637,233 @@ var ErrorCorrectionLevel;
|
|
3652
3637
|
ErrorCorrectionLevel2[ErrorCorrectionLevel2["H"] = 2] = "H";
|
3653
3638
|
})(ErrorCorrectionLevel || (ErrorCorrectionLevel = {}));
|
3654
3639
|
|
3655
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
3656
|
-
var RSBlock =
|
3657
|
-
|
3640
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/RSBlock.js
|
3641
|
+
var RSBlock = class {
|
3642
|
+
constructor(totalCount, dataCount) {
|
3658
3643
|
this.dataCount = dataCount;
|
3659
3644
|
this.totalCount = totalCount;
|
3660
3645
|
}
|
3661
|
-
|
3662
|
-
RSBlock2.prototype.getDataCount = function() {
|
3646
|
+
getDataCount() {
|
3663
3647
|
return this.dataCount;
|
3664
|
-
}
|
3665
|
-
|
3648
|
+
}
|
3649
|
+
getTotalCount() {
|
3666
3650
|
return this.totalCount;
|
3667
|
-
}
|
3668
|
-
|
3669
|
-
|
3670
|
-
|
3671
|
-
|
3672
|
-
for (
|
3673
|
-
|
3674
|
-
|
3675
|
-
|
3676
|
-
for (
|
3677
|
-
rsBlocks.push(new
|
3651
|
+
}
|
3652
|
+
static getRSBlocks(version2, errorCorrectionLevel) {
|
3653
|
+
const rsBlocks = [];
|
3654
|
+
const rsBlock = RSBlock.getRSBlockTable(version2, errorCorrectionLevel);
|
3655
|
+
const length = rsBlock.length / 3;
|
3656
|
+
for (let i = 0; i < length; i++) {
|
3657
|
+
const count = rsBlock[i * 3 + 0];
|
3658
|
+
const totalCount = rsBlock[i * 3 + 1];
|
3659
|
+
const dataCount = rsBlock[i * 3 + 2];
|
3660
|
+
for (let j = 0; j < count; j++) {
|
3661
|
+
rsBlocks.push(new RSBlock(totalCount, dataCount));
|
3678
3662
|
}
|
3679
3663
|
}
|
3680
3664
|
return rsBlocks;
|
3681
|
-
}
|
3682
|
-
|
3665
|
+
}
|
3666
|
+
static getRSBlockTable(version2, errorCorrectionLevel) {
|
3683
3667
|
switch (errorCorrectionLevel) {
|
3684
3668
|
case ErrorCorrectionLevel.L:
|
3685
|
-
return
|
3669
|
+
return RSBlock.RS_BLOCK_TABLE[(version2 - 1) * 4 + 0];
|
3686
3670
|
case ErrorCorrectionLevel.M:
|
3687
|
-
return
|
3671
|
+
return RSBlock.RS_BLOCK_TABLE[(version2 - 1) * 4 + 1];
|
3688
3672
|
case ErrorCorrectionLevel.Q:
|
3689
|
-
return
|
3673
|
+
return RSBlock.RS_BLOCK_TABLE[(version2 - 1) * 4 + 2];
|
3690
3674
|
case ErrorCorrectionLevel.H:
|
3691
|
-
return
|
3675
|
+
return RSBlock.RS_BLOCK_TABLE[(version2 - 1) * 4 + 3];
|
3692
3676
|
default:
|
3693
|
-
throw new Error(
|
3677
|
+
throw new Error(`illegal error correction level: ${errorCorrectionLevel}`);
|
3694
3678
|
}
|
3695
|
-
}
|
3696
|
-
|
3697
|
-
|
3698
|
-
|
3699
|
-
|
3700
|
-
|
3701
|
-
|
3702
|
-
|
3703
|
-
|
3704
|
-
|
3705
|
-
|
3706
|
-
|
3707
|
-
|
3708
|
-
|
3709
|
-
|
3710
|
-
|
3711
|
-
|
3712
|
-
|
3713
|
-
|
3714
|
-
|
3715
|
-
|
3716
|
-
|
3717
|
-
|
3718
|
-
|
3719
|
-
|
3720
|
-
|
3721
|
-
|
3722
|
-
|
3723
|
-
|
3724
|
-
|
3725
|
-
|
3726
|
-
|
3727
|
-
|
3728
|
-
|
3729
|
-
|
3730
|
-
|
3731
|
-
|
3732
|
-
|
3733
|
-
|
3734
|
-
|
3735
|
-
|
3736
|
-
|
3737
|
-
|
3738
|
-
|
3739
|
-
|
3740
|
-
|
3741
|
-
|
3742
|
-
|
3743
|
-
|
3744
|
-
|
3745
|
-
|
3746
|
-
|
3747
|
-
|
3748
|
-
|
3749
|
-
|
3750
|
-
|
3751
|
-
|
3752
|
-
|
3753
|
-
|
3754
|
-
|
3755
|
-
|
3756
|
-
|
3757
|
-
|
3758
|
-
|
3759
|
-
|
3760
|
-
|
3761
|
-
|
3762
|
-
|
3763
|
-
|
3764
|
-
|
3765
|
-
|
3766
|
-
|
3767
|
-
|
3768
|
-
|
3769
|
-
|
3770
|
-
|
3771
|
-
|
3772
|
-
|
3773
|
-
|
3774
|
-
|
3775
|
-
|
3776
|
-
|
3777
|
-
|
3778
|
-
|
3779
|
-
|
3780
|
-
|
3781
|
-
|
3782
|
-
|
3783
|
-
|
3784
|
-
|
3785
|
-
|
3786
|
-
|
3787
|
-
|
3788
|
-
|
3789
|
-
|
3790
|
-
|
3791
|
-
|
3792
|
-
|
3793
|
-
|
3794
|
-
|
3795
|
-
|
3796
|
-
|
3797
|
-
|
3798
|
-
|
3799
|
-
|
3800
|
-
|
3801
|
-
|
3802
|
-
|
3803
|
-
|
3804
|
-
|
3805
|
-
|
3806
|
-
|
3807
|
-
|
3808
|
-
|
3809
|
-
|
3810
|
-
|
3811
|
-
|
3812
|
-
|
3813
|
-
|
3814
|
-
|
3815
|
-
|
3816
|
-
|
3817
|
-
|
3818
|
-
|
3819
|
-
|
3820
|
-
|
3821
|
-
|
3822
|
-
|
3823
|
-
|
3824
|
-
|
3825
|
-
|
3826
|
-
|
3827
|
-
|
3828
|
-
|
3829
|
-
|
3830
|
-
|
3831
|
-
|
3832
|
-
|
3833
|
-
|
3834
|
-
|
3835
|
-
|
3836
|
-
|
3837
|
-
|
3838
|
-
|
3839
|
-
|
3840
|
-
|
3841
|
-
|
3842
|
-
|
3843
|
-
|
3844
|
-
|
3845
|
-
|
3846
|
-
|
3847
|
-
|
3848
|
-
|
3849
|
-
|
3850
|
-
|
3851
|
-
|
3852
|
-
|
3853
|
-
|
3854
|
-
|
3855
|
-
|
3856
|
-
|
3857
|
-
]
|
3858
|
-
|
3859
|
-
|
3679
|
+
}
|
3680
|
+
};
|
3681
|
+
__name(RSBlock, "RSBlock");
|
3682
|
+
RSBlock.RS_BLOCK_TABLE = [
|
3683
|
+
[1, 26, 19],
|
3684
|
+
[1, 26, 16],
|
3685
|
+
[1, 26, 13],
|
3686
|
+
[1, 26, 9],
|
3687
|
+
[1, 44, 34],
|
3688
|
+
[1, 44, 28],
|
3689
|
+
[1, 44, 22],
|
3690
|
+
[1, 44, 16],
|
3691
|
+
[1, 70, 55],
|
3692
|
+
[1, 70, 44],
|
3693
|
+
[2, 35, 17],
|
3694
|
+
[2, 35, 13],
|
3695
|
+
[1, 100, 80],
|
3696
|
+
[2, 50, 32],
|
3697
|
+
[2, 50, 24],
|
3698
|
+
[4, 25, 9],
|
3699
|
+
[1, 134, 108],
|
3700
|
+
[2, 67, 43],
|
3701
|
+
[2, 33, 15, 2, 34, 16],
|
3702
|
+
[2, 33, 11, 2, 34, 12],
|
3703
|
+
[2, 86, 68],
|
3704
|
+
[4, 43, 27],
|
3705
|
+
[4, 43, 19],
|
3706
|
+
[4, 43, 15],
|
3707
|
+
[2, 98, 78],
|
3708
|
+
[4, 49, 31],
|
3709
|
+
[2, 32, 14, 4, 33, 15],
|
3710
|
+
[4, 39, 13, 1, 40, 14],
|
3711
|
+
[2, 121, 97],
|
3712
|
+
[2, 60, 38, 2, 61, 39],
|
3713
|
+
[4, 40, 18, 2, 41, 19],
|
3714
|
+
[4, 40, 14, 2, 41, 15],
|
3715
|
+
[2, 146, 116],
|
3716
|
+
[3, 58, 36, 2, 59, 37],
|
3717
|
+
[4, 36, 16, 4, 37, 17],
|
3718
|
+
[4, 36, 12, 4, 37, 13],
|
3719
|
+
[2, 86, 68, 2, 87, 69],
|
3720
|
+
[4, 69, 43, 1, 70, 44],
|
3721
|
+
[6, 43, 19, 2, 44, 20],
|
3722
|
+
[6, 43, 15, 2, 44, 16],
|
3723
|
+
[4, 101, 81],
|
3724
|
+
[1, 80, 50, 4, 81, 51],
|
3725
|
+
[4, 50, 22, 4, 51, 23],
|
3726
|
+
[3, 36, 12, 8, 37, 13],
|
3727
|
+
[2, 116, 92, 2, 117, 93],
|
3728
|
+
[6, 58, 36, 2, 59, 37],
|
3729
|
+
[4, 46, 20, 6, 47, 21],
|
3730
|
+
[7, 42, 14, 4, 43, 15],
|
3731
|
+
[4, 133, 107],
|
3732
|
+
[8, 59, 37, 1, 60, 38],
|
3733
|
+
[8, 44, 20, 4, 45, 21],
|
3734
|
+
[12, 33, 11, 4, 34, 12],
|
3735
|
+
[3, 145, 115, 1, 146, 116],
|
3736
|
+
[4, 64, 40, 5, 65, 41],
|
3737
|
+
[11, 36, 16, 5, 37, 17],
|
3738
|
+
[11, 36, 12, 5, 37, 13],
|
3739
|
+
[5, 109, 87, 1, 110, 88],
|
3740
|
+
[5, 65, 41, 5, 66, 42],
|
3741
|
+
[5, 54, 24, 7, 55, 25],
|
3742
|
+
[11, 36, 12, 7, 37, 13],
|
3743
|
+
[5, 122, 98, 1, 123, 99],
|
3744
|
+
[7, 73, 45, 3, 74, 46],
|
3745
|
+
[15, 43, 19, 2, 44, 20],
|
3746
|
+
[3, 45, 15, 13, 46, 16],
|
3747
|
+
[1, 135, 107, 5, 136, 108],
|
3748
|
+
[10, 74, 46, 1, 75, 47],
|
3749
|
+
[1, 50, 22, 15, 51, 23],
|
3750
|
+
[2, 42, 14, 17, 43, 15],
|
3751
|
+
[5, 150, 120, 1, 151, 121],
|
3752
|
+
[9, 69, 43, 4, 70, 44],
|
3753
|
+
[17, 50, 22, 1, 51, 23],
|
3754
|
+
[2, 42, 14, 19, 43, 15],
|
3755
|
+
[3, 141, 113, 4, 142, 114],
|
3756
|
+
[3, 70, 44, 11, 71, 45],
|
3757
|
+
[17, 47, 21, 4, 48, 22],
|
3758
|
+
[9, 39, 13, 16, 40, 14],
|
3759
|
+
[3, 135, 107, 5, 136, 108],
|
3760
|
+
[3, 67, 41, 13, 68, 42],
|
3761
|
+
[15, 54, 24, 5, 55, 25],
|
3762
|
+
[15, 43, 15, 10, 44, 16],
|
3763
|
+
[4, 144, 116, 4, 145, 117],
|
3764
|
+
[17, 68, 42],
|
3765
|
+
[17, 50, 22, 6, 51, 23],
|
3766
|
+
[19, 46, 16, 6, 47, 17],
|
3767
|
+
[2, 139, 111, 7, 140, 112],
|
3768
|
+
[17, 74, 46],
|
3769
|
+
[7, 54, 24, 16, 55, 25],
|
3770
|
+
[34, 37, 13],
|
3771
|
+
[4, 151, 121, 5, 152, 122],
|
3772
|
+
[4, 75, 47, 14, 76, 48],
|
3773
|
+
[11, 54, 24, 14, 55, 25],
|
3774
|
+
[16, 45, 15, 14, 46, 16],
|
3775
|
+
[6, 147, 117, 4, 148, 118],
|
3776
|
+
[6, 73, 45, 14, 74, 46],
|
3777
|
+
[11, 54, 24, 16, 55, 25],
|
3778
|
+
[30, 46, 16, 2, 47, 17],
|
3779
|
+
[8, 132, 106, 4, 133, 107],
|
3780
|
+
[8, 75, 47, 13, 76, 48],
|
3781
|
+
[7, 54, 24, 22, 55, 25],
|
3782
|
+
[22, 45, 15, 13, 46, 16],
|
3783
|
+
[10, 142, 114, 2, 143, 115],
|
3784
|
+
[19, 74, 46, 4, 75, 47],
|
3785
|
+
[28, 50, 22, 6, 51, 23],
|
3786
|
+
[33, 46, 16, 4, 47, 17],
|
3787
|
+
[8, 152, 122, 4, 153, 123],
|
3788
|
+
[22, 73, 45, 3, 74, 46],
|
3789
|
+
[8, 53, 23, 26, 54, 24],
|
3790
|
+
[12, 45, 15, 28, 46, 16],
|
3791
|
+
[3, 147, 117, 10, 148, 118],
|
3792
|
+
[3, 73, 45, 23, 74, 46],
|
3793
|
+
[4, 54, 24, 31, 55, 25],
|
3794
|
+
[11, 45, 15, 31, 46, 16],
|
3795
|
+
[7, 146, 116, 7, 147, 117],
|
3796
|
+
[21, 73, 45, 7, 74, 46],
|
3797
|
+
[1, 53, 23, 37, 54, 24],
|
3798
|
+
[19, 45, 15, 26, 46, 16],
|
3799
|
+
[5, 145, 115, 10, 146, 116],
|
3800
|
+
[19, 75, 47, 10, 76, 48],
|
3801
|
+
[15, 54, 24, 25, 55, 25],
|
3802
|
+
[23, 45, 15, 25, 46, 16],
|
3803
|
+
[13, 145, 115, 3, 146, 116],
|
3804
|
+
[2, 74, 46, 29, 75, 47],
|
3805
|
+
[42, 54, 24, 1, 55, 25],
|
3806
|
+
[23, 45, 15, 28, 46, 16],
|
3807
|
+
[17, 145, 115],
|
3808
|
+
[10, 74, 46, 23, 75, 47],
|
3809
|
+
[10, 54, 24, 35, 55, 25],
|
3810
|
+
[19, 45, 15, 35, 46, 16],
|
3811
|
+
[17, 145, 115, 1, 146, 116],
|
3812
|
+
[14, 74, 46, 21, 75, 47],
|
3813
|
+
[29, 54, 24, 19, 55, 25],
|
3814
|
+
[11, 45, 15, 46, 46, 16],
|
3815
|
+
[13, 145, 115, 6, 146, 116],
|
3816
|
+
[14, 74, 46, 23, 75, 47],
|
3817
|
+
[44, 54, 24, 7, 55, 25],
|
3818
|
+
[59, 46, 16, 1, 47, 17],
|
3819
|
+
[12, 151, 121, 7, 152, 122],
|
3820
|
+
[12, 75, 47, 26, 76, 48],
|
3821
|
+
[39, 54, 24, 14, 55, 25],
|
3822
|
+
[22, 45, 15, 41, 46, 16],
|
3823
|
+
[6, 151, 121, 14, 152, 122],
|
3824
|
+
[6, 75, 47, 34, 76, 48],
|
3825
|
+
[46, 54, 24, 10, 55, 25],
|
3826
|
+
[2, 45, 15, 64, 46, 16],
|
3827
|
+
[17, 152, 122, 4, 153, 123],
|
3828
|
+
[29, 74, 46, 14, 75, 47],
|
3829
|
+
[49, 54, 24, 10, 55, 25],
|
3830
|
+
[24, 45, 15, 46, 46, 16],
|
3831
|
+
[4, 152, 122, 18, 153, 123],
|
3832
|
+
[13, 74, 46, 32, 75, 47],
|
3833
|
+
[48, 54, 24, 14, 55, 25],
|
3834
|
+
[42, 45, 15, 32, 46, 16],
|
3835
|
+
[20, 147, 117, 4, 148, 118],
|
3836
|
+
[40, 75, 47, 7, 76, 48],
|
3837
|
+
[43, 54, 24, 22, 55, 25],
|
3838
|
+
[10, 45, 15, 67, 46, 16],
|
3839
|
+
[19, 148, 118, 6, 149, 119],
|
3840
|
+
[18, 75, 47, 31, 76, 48],
|
3841
|
+
[34, 54, 24, 34, 55, 25],
|
3842
|
+
[20, 45, 15, 61, 46, 16]
|
3843
|
+
];
|
3860
3844
|
|
3861
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
3862
|
-
var BitBuffer =
|
3863
|
-
|
3845
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/BitBuffer.js
|
3846
|
+
var BitBuffer = class {
|
3847
|
+
constructor() {
|
3864
3848
|
this.length = 0;
|
3865
3849
|
this.buffer = [];
|
3866
3850
|
}
|
3867
|
-
|
3868
|
-
BitBuffer2.prototype.getBuffer = function() {
|
3851
|
+
getBuffer() {
|
3869
3852
|
return this.buffer;
|
3870
|
-
}
|
3871
|
-
|
3853
|
+
}
|
3854
|
+
getLengthInBits() {
|
3872
3855
|
return this.length;
|
3873
|
-
}
|
3874
|
-
|
3856
|
+
}
|
3857
|
+
getBit(index) {
|
3875
3858
|
return (this.buffer[index / 8 >> 0] >>> 7 - index % 8 & 1) === 1;
|
3876
|
-
}
|
3877
|
-
|
3878
|
-
for (
|
3859
|
+
}
|
3860
|
+
put(num, length) {
|
3861
|
+
for (let i = 0; i < length; i++) {
|
3879
3862
|
this.putBit((num >>> length - i - 1 & 1) === 1);
|
3880
3863
|
}
|
3881
|
-
}
|
3882
|
-
|
3883
|
-
|
3864
|
+
}
|
3865
|
+
putBit(bit) {
|
3866
|
+
const { buffer: buffer2 } = this;
|
3884
3867
|
if (this.length === buffer2.length * 8) {
|
3885
3868
|
buffer2.push(0);
|
3886
3869
|
}
|
@@ -3888,351 +3871,279 @@ var BitBuffer = /* @__PURE__ */ function() {
|
|
3888
3871
|
buffer2[this.length / 8 >> 0] |= 128 >>> this.length % 8;
|
3889
3872
|
}
|
3890
3873
|
this.length++;
|
3891
|
-
}
|
3892
|
-
|
3893
|
-
|
3874
|
+
}
|
3875
|
+
};
|
3876
|
+
__name(BitBuffer, "BitBuffer");
|
3894
3877
|
|
3895
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
3896
|
-
var
|
3897
|
-
|
3878
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/image/lzw/Dict.js
|
3879
|
+
var MAX_CODE = (1 << 12) - 1;
|
3880
|
+
var Dict = class {
|
3881
|
+
constructor(depth) {
|
3882
|
+
const bof = 1 << depth;
|
3883
|
+
const eof = bof + 1;
|
3884
|
+
this.bof = bof;
|
3885
|
+
this.eof = eof;
|
3886
|
+
this.depth = depth;
|
3887
|
+
this.reset();
|
3898
3888
|
}
|
3899
|
-
|
3900
|
-
|
3901
|
-
|
3902
|
-
|
3889
|
+
reset() {
|
3890
|
+
const bits = this.depth + 1;
|
3891
|
+
this.bits = bits;
|
3892
|
+
this.size = 1 << bits;
|
3893
|
+
this.codes = /* @__PURE__ */ new Map();
|
3894
|
+
this.unused = this.eof + 1;
|
3895
|
+
}
|
3896
|
+
add(code, index) {
|
3897
|
+
let { unused } = this;
|
3898
|
+
if (unused > MAX_CODE) {
|
3899
|
+
return false;
|
3903
3900
|
}
|
3904
|
-
|
3905
|
-
|
3901
|
+
this.codes.set(code << 8 | index, unused++);
|
3902
|
+
let { bits, size } = this;
|
3903
|
+
if (unused > size) {
|
3904
|
+
size = 1 << ++bits;
|
3906
3905
|
}
|
3907
|
-
|
3908
|
-
|
3906
|
+
this.bits = bits;
|
3907
|
+
this.size = size;
|
3908
|
+
this.unused = unused;
|
3909
|
+
return true;
|
3910
|
+
}
|
3911
|
+
get(code, index) {
|
3912
|
+
return this.codes.get(code << 8 | index);
|
3913
|
+
}
|
3914
|
+
};
|
3915
|
+
__name(Dict, "Dict");
|
3916
|
+
|
3917
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/image/lzw/DictStream.js
|
3918
|
+
var DictStream = class {
|
3919
|
+
constructor(dict) {
|
3920
|
+
this.bits = 0;
|
3921
|
+
this.buffer = 0;
|
3922
|
+
this.bytes = [];
|
3923
|
+
this.dict = dict;
|
3924
|
+
}
|
3925
|
+
write(code) {
|
3926
|
+
let { bits } = this;
|
3927
|
+
let buffer2 = this.buffer | code << bits;
|
3928
|
+
bits += this.dict.bits;
|
3929
|
+
const { bytes } = this;
|
3930
|
+
while (bits >= 8) {
|
3931
|
+
bytes.push(buffer2 & 255);
|
3932
|
+
buffer2 >>= 8;
|
3933
|
+
bits -= 8;
|
3934
|
+
}
|
3935
|
+
this.bits = bits;
|
3936
|
+
this.buffer = buffer2;
|
3937
|
+
}
|
3938
|
+
pipe(stream) {
|
3939
|
+
const { bytes } = this;
|
3940
|
+
if (this.bits > 0) {
|
3941
|
+
bytes.push(this.buffer);
|
3942
|
+
}
|
3943
|
+
stream.writeByte(this.dict.depth);
|
3944
|
+
const { length } = bytes;
|
3945
|
+
for (let i = 0; i < length; ) {
|
3946
|
+
const remain = length - i;
|
3947
|
+
if (remain >= 255) {
|
3948
|
+
stream.writeByte(255);
|
3949
|
+
stream.writeBytes(bytes, i, 255);
|
3950
|
+
i += 255;
|
3951
|
+
} else {
|
3952
|
+
stream.writeByte(remain);
|
3953
|
+
stream.writeBytes(bytes, i, remain);
|
3954
|
+
i = length;
|
3955
|
+
}
|
3909
3956
|
}
|
3910
|
-
|
3911
|
-
|
3912
|
-
|
3913
|
-
|
3914
|
-
this.flush();
|
3915
|
-
};
|
3916
|
-
return OutputStream2;
|
3917
|
-
}();
|
3957
|
+
stream.writeByte(0);
|
3958
|
+
}
|
3959
|
+
};
|
3960
|
+
__name(DictStream, "DictStream");
|
3918
3961
|
|
3919
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
3920
|
-
|
3921
|
-
|
3922
|
-
|
3923
|
-
|
3924
|
-
|
3925
|
-
|
3926
|
-
|
3927
|
-
|
3928
|
-
|
3929
|
-
|
3930
|
-
|
3931
|
-
|
3932
|
-
|
3933
|
-
|
3934
|
-
|
3935
|
-
|
3936
|
-
|
3937
|
-
|
3938
|
-
|
3962
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/image/lzw/index.js
|
3963
|
+
function compress(pixels, depth, stream) {
|
3964
|
+
const dict = new Dict(depth);
|
3965
|
+
const buffer2 = new DictStream(dict);
|
3966
|
+
buffer2.write(dict.bof);
|
3967
|
+
if (pixels.length > 0) {
|
3968
|
+
let code = pixels[0];
|
3969
|
+
const { length } = pixels;
|
3970
|
+
for (let i = 1; i < length; i++) {
|
3971
|
+
const pixelIndex = pixels[i];
|
3972
|
+
const nextCode = dict.get(code, pixelIndex);
|
3973
|
+
if (nextCode != null) {
|
3974
|
+
code = nextCode;
|
3975
|
+
} else {
|
3976
|
+
buffer2.write(code);
|
3977
|
+
if (!dict.add(code, pixelIndex)) {
|
3978
|
+
buffer2.write(dict.bof);
|
3979
|
+
dict.reset();
|
3980
|
+
}
|
3981
|
+
code = pixelIndex;
|
3982
|
+
}
|
3983
|
+
}
|
3984
|
+
buffer2.write(code);
|
3985
|
+
}
|
3986
|
+
buffer2.write(dict.eof);
|
3987
|
+
buffer2.pipe(stream);
|
3988
|
+
}
|
3989
|
+
__name(compress, "compress");
|
3990
|
+
|
3991
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/image/ByteStream.js
|
3992
|
+
var ByteStream = class {
|
3993
|
+
constructor() {
|
3994
|
+
this.bytes = [];
|
3995
|
+
}
|
3996
|
+
writeByte(value) {
|
3997
|
+
this.bytes.push(value & 255);
|
3998
|
+
}
|
3999
|
+
writeInt16(value) {
|
4000
|
+
this.bytes.push(value & 255, value >> 8 & 255);
|
4001
|
+
}
|
4002
|
+
writeBytes(bytes, offset = 0, length = bytes.length) {
|
4003
|
+
const buffer2 = this.bytes;
|
4004
|
+
for (let i = 0; i < length; i++) {
|
4005
|
+
buffer2.push(bytes[offset + i] & 255);
|
4006
|
+
}
|
4007
|
+
}
|
4008
|
+
};
|
4009
|
+
__name(ByteStream, "ByteStream");
|
3939
4010
|
|
3940
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
3941
|
-
|
3942
|
-
|
3943
|
-
|
3944
|
-
|
3945
|
-
|
3946
|
-
return
|
3947
|
-
} else if (
|
3948
|
-
return
|
3949
|
-
} else if (
|
4011
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/image/Base64Stream.js
|
4012
|
+
var { fromCharCode } = String;
|
4013
|
+
function encode7(byte) {
|
4014
|
+
byte &= 63;
|
4015
|
+
if (byte >= 0) {
|
4016
|
+
if (byte < 26) {
|
4017
|
+
return 65 + byte;
|
4018
|
+
} else if (byte < 52) {
|
4019
|
+
return 97 + (byte - 26);
|
4020
|
+
} else if (byte < 62) {
|
4021
|
+
return 48 + (byte - 52);
|
4022
|
+
} else if (byte === 62) {
|
3950
4023
|
return 43;
|
3951
|
-
} else if (
|
4024
|
+
} else if (byte === 63) {
|
3952
4025
|
return 47;
|
3953
4026
|
}
|
3954
4027
|
}
|
3955
|
-
throw new Error(
|
4028
|
+
throw new Error(`illegal char: ${fromCharCode(byte)}`);
|
3956
4029
|
}
|
3957
4030
|
__name(encode7, "encode");
|
3958
|
-
var
|
3959
|
-
|
3960
|
-
|
3961
|
-
|
3962
|
-
|
3963
|
-
|
3964
|
-
|
3965
|
-
|
3966
|
-
return
|
3967
|
-
}
|
3968
|
-
|
3969
|
-
|
3970
|
-
|
3971
|
-
this.
|
3972
|
-
|
3973
|
-
|
3974
|
-
|
3975
|
-
this.bufLength -= 6;
|
4031
|
+
var Base64Stream = class {
|
4032
|
+
constructor() {
|
4033
|
+
this.bits = 0;
|
4034
|
+
this.buffer = 0;
|
4035
|
+
this.length = 0;
|
4036
|
+
this.stream = new ByteStream();
|
4037
|
+
}
|
4038
|
+
get bytes() {
|
4039
|
+
return this.stream.bytes;
|
4040
|
+
}
|
4041
|
+
write(byte) {
|
4042
|
+
let bits = this.bits + 8;
|
4043
|
+
const { stream } = this;
|
4044
|
+
const buffer2 = this.buffer << 8 | byte & 255;
|
4045
|
+
while (bits >= 6) {
|
4046
|
+
stream.writeByte(encode7(buffer2 >>> bits - 6));
|
4047
|
+
bits -= 6;
|
3976
4048
|
}
|
3977
|
-
|
3978
|
-
|
3979
|
-
|
3980
|
-
|
4049
|
+
this.length++;
|
4050
|
+
this.bits = bits;
|
4051
|
+
this.buffer = buffer2;
|
4052
|
+
}
|
4053
|
+
close() {
|
4054
|
+
const { bits, stream, length } = this;
|
4055
|
+
if (bits > 0) {
|
4056
|
+
stream.writeByte(encode7(this.buffer << 6 - bits));
|
4057
|
+
this.bits = 0;
|
3981
4058
|
this.buffer = 0;
|
3982
|
-
this.bufLength = 0;
|
3983
4059
|
}
|
3984
|
-
|
3985
|
-
|
3986
|
-
|
3987
|
-
for (var i = 0; i < pad; i++) {
|
4060
|
+
if (length % 3 != 0) {
|
4061
|
+
const pad = 3 - length % 3;
|
4062
|
+
for (let i = 0; i < pad; i++) {
|
3988
4063
|
stream.writeByte(61);
|
3989
4064
|
}
|
3990
4065
|
}
|
3991
|
-
}
|
3992
|
-
|
3993
|
-
|
3994
|
-
};
|
3995
|
-
return Base64EncodeOutputStream2;
|
3996
|
-
}(OutputStream);
|
4066
|
+
}
|
4067
|
+
};
|
4068
|
+
__name(Base64Stream, "Base64Stream");
|
3997
4069
|
|
3998
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
3999
|
-
|
4000
|
-
|
4001
|
-
|
4002
|
-
stream.writeBytes(data);
|
4003
|
-
stream.close();
|
4004
|
-
output.close();
|
4005
|
-
return output.toByteArray();
|
4006
|
-
}
|
4007
|
-
__name(encodeToBase64, "encodeToBase64");
|
4008
|
-
var LZWTable = /* @__PURE__ */ function() {
|
4009
|
-
function LZWTable2() {
|
4010
|
-
this.size = 0;
|
4011
|
-
this.map = {};
|
4012
|
-
}
|
4013
|
-
__name(LZWTable2, "LZWTable");
|
4014
|
-
LZWTable2.prototype.add = function(key) {
|
4015
|
-
if (!this.contains(key)) {
|
4016
|
-
this.map[key] = this.size++;
|
4017
|
-
}
|
4018
|
-
};
|
4019
|
-
LZWTable2.prototype.getSize = function() {
|
4020
|
-
return this.size;
|
4021
|
-
};
|
4022
|
-
LZWTable2.prototype.indexOf = function(key) {
|
4023
|
-
return this.map[key];
|
4024
|
-
};
|
4025
|
-
LZWTable2.prototype.contains = function(key) {
|
4026
|
-
return this.map[key] >= 0;
|
4027
|
-
};
|
4028
|
-
return LZWTable2;
|
4029
|
-
}();
|
4030
|
-
var BitOutputStream = /* @__PURE__ */ function() {
|
4031
|
-
function BitOutputStream2(output) {
|
4032
|
-
this.output = output;
|
4033
|
-
this.bitLength = 0;
|
4034
|
-
this.bitBuffer = 0;
|
4035
|
-
}
|
4036
|
-
__name(BitOutputStream2, "BitOutputStream");
|
4037
|
-
BitOutputStream2.prototype.write = function(data, length) {
|
4038
|
-
if (data >>> length !== 0) {
|
4039
|
-
throw new Error("length overflow");
|
4040
|
-
}
|
4041
|
-
var output = this.output;
|
4042
|
-
while (this.bitLength + length >= 8) {
|
4043
|
-
output.writeByte(255 & (data << this.bitLength | this.bitBuffer));
|
4044
|
-
length -= 8 - this.bitLength;
|
4045
|
-
data >>>= 8 - this.bitLength;
|
4046
|
-
this.bitBuffer = 0;
|
4047
|
-
this.bitLength = 0;
|
4048
|
-
}
|
4049
|
-
this.bitBuffer = data << this.bitLength | this.bitBuffer;
|
4050
|
-
this.bitLength = this.bitLength + length;
|
4051
|
-
};
|
4052
|
-
BitOutputStream2.prototype.flush = function() {
|
4053
|
-
var output = this.output;
|
4054
|
-
if (this.bitLength > 0) {
|
4055
|
-
output.writeByte(this.bitBuffer);
|
4056
|
-
}
|
4057
|
-
output.flush();
|
4058
|
-
};
|
4059
|
-
BitOutputStream2.prototype.close = function() {
|
4060
|
-
this.flush();
|
4061
|
-
this.output.close();
|
4062
|
-
};
|
4063
|
-
return BitOutputStream2;
|
4064
|
-
}();
|
4065
|
-
var GIFImage = /* @__PURE__ */ function() {
|
4066
|
-
function GIFImage2(width, height) {
|
4067
|
-
this.data = [];
|
4070
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/image/GIFImage.js
|
4071
|
+
var GIFImage = class {
|
4072
|
+
constructor(width, height, { foreground = [0, 0, 0], background = [255, 255, 255] } = {}) {
|
4073
|
+
this.pixels = [];
|
4068
4074
|
this.width = width;
|
4069
4075
|
this.height = height;
|
4070
|
-
|
4071
|
-
|
4072
|
-
|
4073
|
-
|
4074
|
-
|
4075
|
-
|
4076
|
-
|
4077
|
-
|
4078
|
-
|
4079
|
-
|
4080
|
-
|
4081
|
-
|
4082
|
-
|
4083
|
-
|
4084
|
-
|
4085
|
-
|
4086
|
-
|
4087
|
-
|
4088
|
-
|
4089
|
-
|
4090
|
-
|
4091
|
-
|
4092
|
-
|
4093
|
-
|
4094
|
-
|
4095
|
-
|
4096
|
-
|
4097
|
-
|
4098
|
-
|
4099
|
-
|
4100
|
-
|
4101
|
-
|
4102
|
-
|
4103
|
-
|
4104
|
-
|
4105
|
-
|
4106
|
-
table.add(words + char);
|
4107
|
-
}
|
4108
|
-
words = char;
|
4109
|
-
}
|
4110
|
-
}
|
4111
|
-
bitOutput.write(table.indexOf(words), bitLength);
|
4112
|
-
bitOutput.write(endCode, bitLength);
|
4113
|
-
} finally {
|
4114
|
-
bitOutput.close();
|
4115
|
-
}
|
4116
|
-
return byteOutput.toByteArray();
|
4117
|
-
};
|
4118
|
-
GIFImage2.prototype.setPixel = function(x, y, pixel) {
|
4119
|
-
var _a = this, width = _a.width, height = _a.height;
|
4120
|
-
if (x < 0 || width <= x)
|
4121
|
-
throw new Error("illegal x axis: ".concat(x));
|
4122
|
-
if (y < 0 || height <= y)
|
4123
|
-
throw new Error("illegal y axis: ".concat(y));
|
4124
|
-
this.data[y * width + x] = pixel;
|
4125
|
-
};
|
4126
|
-
GIFImage2.prototype.getPixel = function(x, y) {
|
4127
|
-
var _a = this, width = _a.width, height = _a.height;
|
4128
|
-
if (x < 0 || width <= x)
|
4129
|
-
throw new Error("illegal x axis: ".concat(x));
|
4130
|
-
if (y < 0 || height <= y)
|
4131
|
-
throw new Error("illegal y axis: ".concat(y));
|
4132
|
-
return this.data[y * width + x];
|
4133
|
-
};
|
4134
|
-
GIFImage2.prototype.write = function(output) {
|
4135
|
-
var _a = this, width = _a.width, height = _a.height;
|
4136
|
-
output.writeByte(71);
|
4137
|
-
output.writeByte(73);
|
4138
|
-
output.writeByte(70);
|
4139
|
-
output.writeByte(56);
|
4140
|
-
output.writeByte(55);
|
4141
|
-
output.writeByte(97);
|
4142
|
-
output.writeInt16(width);
|
4143
|
-
output.writeInt16(height);
|
4144
|
-
output.writeByte(128);
|
4145
|
-
output.writeByte(0);
|
4146
|
-
output.writeByte(0);
|
4147
|
-
output.writeByte(0);
|
4148
|
-
output.writeByte(0);
|
4149
|
-
output.writeByte(0);
|
4150
|
-
output.writeByte(255);
|
4151
|
-
output.writeByte(255);
|
4152
|
-
output.writeByte(255);
|
4153
|
-
output.writeByte(44);
|
4154
|
-
output.writeInt16(0);
|
4155
|
-
output.writeInt16(0);
|
4156
|
-
output.writeInt16(width);
|
4157
|
-
output.writeInt16(height);
|
4158
|
-
output.writeByte(0);
|
4159
|
-
var lzwMinCodeSize = 2;
|
4160
|
-
var raster = this.getLZWRaster(lzwMinCodeSize);
|
4161
|
-
var raLength = raster.length;
|
4162
|
-
output.writeByte(lzwMinCodeSize);
|
4163
|
-
var offset = 0;
|
4164
|
-
while (raLength - offset > 255) {
|
4165
|
-
output.writeByte(255);
|
4166
|
-
output.writeBytes(raster, offset, 255);
|
4167
|
-
offset += 255;
|
4168
|
-
}
|
4169
|
-
var length = raLength - offset;
|
4170
|
-
output.writeByte(length);
|
4171
|
-
output.writeBytes(raster, offset, length);
|
4172
|
-
output.writeByte(0);
|
4173
|
-
output.writeByte(59);
|
4174
|
-
};
|
4175
|
-
GIFImage2.prototype.toDataURL = function() {
|
4176
|
-
var output = new ByteArrayOutputStream();
|
4177
|
-
this.write(output);
|
4178
|
-
var bytes = encodeToBase64(output.toByteArray());
|
4179
|
-
output.close();
|
4180
|
-
var length = bytes.length;
|
4181
|
-
var fromCharCode = String.fromCharCode;
|
4182
|
-
var url = "data:image/gif;base64,";
|
4183
|
-
for (var i = 0; i < length; i++) {
|
4184
|
-
url += fromCharCode(bytes[i]);
|
4076
|
+
this.foreground = foreground;
|
4077
|
+
this.background = background;
|
4078
|
+
}
|
4079
|
+
encodeImpl() {
|
4080
|
+
const stream = new ByteStream();
|
4081
|
+
const { width, height, background, foreground } = this;
|
4082
|
+
stream.writeBytes([71, 73, 70, 56, 57, 97]);
|
4083
|
+
stream.writeInt16(width);
|
4084
|
+
stream.writeInt16(height);
|
4085
|
+
stream.writeBytes([128, 0, 0]);
|
4086
|
+
stream.writeBytes([background[0], background[1], background[2]]);
|
4087
|
+
stream.writeBytes([foreground[0], foreground[1], foreground[2]]);
|
4088
|
+
stream.writeByte(44);
|
4089
|
+
stream.writeInt16(0);
|
4090
|
+
stream.writeInt16(0);
|
4091
|
+
stream.writeInt16(width);
|
4092
|
+
stream.writeInt16(height);
|
4093
|
+
stream.writeByte(0);
|
4094
|
+
compress(this.pixels, 2, stream);
|
4095
|
+
stream.writeByte(59);
|
4096
|
+
return stream.bytes;
|
4097
|
+
}
|
4098
|
+
set(x, y, color) {
|
4099
|
+
this.pixels[y * this.width + x] = color;
|
4100
|
+
}
|
4101
|
+
toDataURL() {
|
4102
|
+
const bytes = this.encodeImpl();
|
4103
|
+
const stream = new Base64Stream();
|
4104
|
+
for (const byte of bytes) {
|
4105
|
+
stream.write(byte);
|
4106
|
+
}
|
4107
|
+
stream.close();
|
4108
|
+
const base64 = stream.bytes;
|
4109
|
+
let url = "data:image/gif;base64,";
|
4110
|
+
for (const byte of base64) {
|
4111
|
+
url += fromCharCode(byte);
|
4185
4112
|
}
|
4186
4113
|
return url;
|
4187
|
-
}
|
4188
|
-
|
4189
|
-
|
4114
|
+
}
|
4115
|
+
};
|
4116
|
+
__name(GIFImage, "GIFImage");
|
4190
4117
|
|
4191
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
4118
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/qrcode/common/MaskPattern.js
|
4192
4119
|
function getMaskFunc(maskPattern) {
|
4193
4120
|
switch (maskPattern) {
|
4194
4121
|
case 0:
|
4195
|
-
return
|
4196
|
-
return (x + y & 1) === 0;
|
4197
|
-
};
|
4122
|
+
return (x, y) => (x + y & 1) === 0;
|
4198
4123
|
case 1:
|
4199
|
-
return
|
4200
|
-
return (y & 1) === 0;
|
4201
|
-
};
|
4124
|
+
return (_x, y) => (y & 1) === 0;
|
4202
4125
|
case 2:
|
4203
|
-
return
|
4204
|
-
return x % 3 === 0;
|
4205
|
-
};
|
4126
|
+
return (x, _y) => x % 3 === 0;
|
4206
4127
|
case 3:
|
4207
|
-
return
|
4208
|
-
return (x + y) % 3 === 0;
|
4209
|
-
};
|
4128
|
+
return (x, y) => (x + y) % 3 === 0;
|
4210
4129
|
case 4:
|
4211
|
-
return
|
4212
|
-
return ((x / 3 >> 0) + (y / 2 >> 0) & 1) === 0;
|
4213
|
-
};
|
4130
|
+
return (x, y) => ((x / 3 >> 0) + (y / 2 >> 0) & 1) === 0;
|
4214
4131
|
case 5:
|
4215
|
-
return
|
4216
|
-
return (x * y & 1) + x * y % 3 === 0;
|
4217
|
-
};
|
4132
|
+
return (x, y) => (x * y & 1) + x * y % 3 === 0;
|
4218
4133
|
case 6:
|
4219
|
-
return
|
4220
|
-
return ((x * y & 1) + x * y % 3 & 1) === 0;
|
4221
|
-
};
|
4134
|
+
return (x, y) => ((x * y & 1) + x * y % 3 & 1) === 0;
|
4222
4135
|
case 7:
|
4223
|
-
return
|
4224
|
-
return (x * y % 3 + (x + y & 1) & 1) === 0;
|
4225
|
-
};
|
4136
|
+
return (x, y) => (x * y % 3 + (x + y & 1) & 1) === 0;
|
4226
4137
|
default:
|
4227
|
-
throw new Error(
|
4138
|
+
throw new Error(`illegal mask: ${maskPattern}`);
|
4228
4139
|
}
|
4229
4140
|
}
|
4230
4141
|
__name(getMaskFunc, "getMaskFunc");
|
4231
4142
|
|
4232
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
4143
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/Writer.js
|
4233
4144
|
var PAD0 = 236;
|
4234
4145
|
var PAD1 = 17;
|
4235
|
-
var toString2 = Object.prototype
|
4146
|
+
var { toString: toString2 } = Object.prototype;
|
4236
4147
|
function appendECI(encoding, buffer2) {
|
4237
4148
|
if (encoding < 0 || encoding >= 1e6) {
|
4238
4149
|
throw new Error("byte mode encoding hint out of range");
|
@@ -4250,11 +4161,10 @@ function appendECI(encoding, buffer2) {
|
|
4250
4161
|
}
|
4251
4162
|
__name(appendECI, "appendECI");
|
4252
4163
|
function prepareData(version2, errorCorrectionLevel, encodingHint, chunks) {
|
4253
|
-
|
4254
|
-
|
4255
|
-
for (
|
4256
|
-
|
4257
|
-
var mode = data.mode;
|
4164
|
+
const buffer2 = new BitBuffer();
|
4165
|
+
const rsBlocks = RSBlock.getRSBlocks(version2, errorCorrectionLevel);
|
4166
|
+
for (const data of chunks) {
|
4167
|
+
const mode = data.mode;
|
4258
4168
|
if (encodingHint && mode === Mode.Byte) {
|
4259
4169
|
appendECI(data.encoding, buffer2);
|
4260
4170
|
}
|
@@ -4262,9 +4172,8 @@ function prepareData(version2, errorCorrectionLevel, encodingHint, chunks) {
|
|
4262
4172
|
buffer2.put(data.getLength(), data.getLengthInBits(version2));
|
4263
4173
|
data.writeTo(buffer2);
|
4264
4174
|
}
|
4265
|
-
|
4266
|
-
for (
|
4267
|
-
var rsBlock = rsBlocks_1[_a];
|
4175
|
+
let maxDataCount = 0;
|
4176
|
+
for (const rsBlock of rsBlocks) {
|
4268
4177
|
maxDataCount += rsBlock.getDataCount();
|
4269
4178
|
}
|
4270
4179
|
maxDataCount *= 8;
|
@@ -4272,45 +4181,45 @@ function prepareData(version2, errorCorrectionLevel, encodingHint, chunks) {
|
|
4272
4181
|
}
|
4273
4182
|
__name(prepareData, "prepareData");
|
4274
4183
|
function createBytes(buffer2, rsBlocks) {
|
4275
|
-
|
4276
|
-
|
4277
|
-
|
4278
|
-
|
4279
|
-
|
4280
|
-
|
4281
|
-
|
4282
|
-
for (
|
4283
|
-
|
4284
|
-
|
4285
|
-
|
4184
|
+
let offset = 0;
|
4185
|
+
let maxDcCount = 0;
|
4186
|
+
let maxEcCount = 0;
|
4187
|
+
const dcData = [];
|
4188
|
+
const ecData = [];
|
4189
|
+
const rsLength = rsBlocks.length;
|
4190
|
+
const bufferData = buffer2.getBuffer();
|
4191
|
+
for (let r = 0; r < rsLength; r++) {
|
4192
|
+
const rsBlock = rsBlocks[r];
|
4193
|
+
const dcCount = rsBlock.getDataCount();
|
4194
|
+
const ecCount = rsBlock.getTotalCount() - dcCount;
|
4286
4195
|
maxDcCount = Math.max(maxDcCount, dcCount);
|
4287
4196
|
maxEcCount = Math.max(maxEcCount, ecCount);
|
4288
4197
|
dcData[r] = [];
|
4289
|
-
for (
|
4198
|
+
for (let i = 0; i < dcCount; i++) {
|
4290
4199
|
dcData[r][i] = 255 & bufferData[i + offset];
|
4291
4200
|
}
|
4292
4201
|
offset += dcCount;
|
4293
|
-
|
4294
|
-
|
4295
|
-
|
4296
|
-
|
4297
|
-
|
4202
|
+
const rsPoly = getErrorCorrectionPolynomial(ecCount);
|
4203
|
+
const ecLength = rsPoly.getLength() - 1;
|
4204
|
+
const rawPoly = new Polynomial(dcData[r], ecLength);
|
4205
|
+
const modPoly = rawPoly.mod(rsPoly);
|
4206
|
+
const mpLength = modPoly.getLength();
|
4298
4207
|
ecData[r] = [];
|
4299
|
-
for (
|
4300
|
-
|
4208
|
+
for (let i = 0; i < ecLength; i++) {
|
4209
|
+
const modIndex = i + mpLength - ecLength;
|
4301
4210
|
ecData[r][i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
|
4302
4211
|
}
|
4303
4212
|
}
|
4304
4213
|
buffer2 = new BitBuffer();
|
4305
|
-
for (
|
4306
|
-
for (
|
4214
|
+
for (let i = 0; i < maxDcCount; i++) {
|
4215
|
+
for (let r = 0; r < rsLength; r++) {
|
4307
4216
|
if (i < dcData[r].length) {
|
4308
4217
|
buffer2.put(dcData[r][i], 8);
|
4309
4218
|
}
|
4310
4219
|
}
|
4311
4220
|
}
|
4312
|
-
for (
|
4313
|
-
for (
|
4221
|
+
for (let i = 0; i < maxEcCount; i++) {
|
4222
|
+
for (let r = 0; r < rsLength; r++) {
|
4314
4223
|
if (i < ecData[r].length) {
|
4315
4224
|
buffer2.put(ecData[r][i], 8);
|
4316
4225
|
}
|
@@ -4339,38 +4248,34 @@ function createData(buffer2, rsBlocks, maxDataCount) {
|
|
4339
4248
|
return createBytes(buffer2, rsBlocks);
|
4340
4249
|
}
|
4341
4250
|
__name(createData, "createData");
|
4342
|
-
var Encoder =
|
4343
|
-
|
4344
|
-
if (options === void 0) {
|
4345
|
-
options = {};
|
4346
|
-
}
|
4251
|
+
var Encoder = class {
|
4252
|
+
constructor(options = {}) {
|
4347
4253
|
this.matrixSize = 0;
|
4348
4254
|
this.chunks = [];
|
4349
4255
|
this.matrix = [];
|
4350
|
-
|
4256
|
+
const { version: version2 = 0, encodingHint = false, errorCorrectionLevel = ErrorCorrectionLevel.L } = options;
|
4351
4257
|
this.setVersion(version2);
|
4352
4258
|
this.setEncodingHint(encodingHint);
|
4353
4259
|
this.setErrorCorrectionLevel(errorCorrectionLevel);
|
4354
4260
|
}
|
4355
|
-
|
4356
|
-
Encoder2.prototype.getMatrix = function() {
|
4261
|
+
getMatrix() {
|
4357
4262
|
return this.matrix;
|
4358
|
-
}
|
4359
|
-
|
4263
|
+
}
|
4264
|
+
getMatrixSize() {
|
4360
4265
|
return this.matrixSize;
|
4361
|
-
}
|
4362
|
-
|
4266
|
+
}
|
4267
|
+
getVersion() {
|
4363
4268
|
return this.version;
|
4364
|
-
}
|
4365
|
-
|
4269
|
+
}
|
4270
|
+
setVersion(version2) {
|
4366
4271
|
this.version = Math.min(40, Math.max(0, version2 >> 0));
|
4367
4272
|
this.auto = this.version === 0;
|
4368
4273
|
return this;
|
4369
|
-
}
|
4370
|
-
|
4274
|
+
}
|
4275
|
+
getErrorCorrectionLevel() {
|
4371
4276
|
return this.errorCorrectionLevel;
|
4372
|
-
}
|
4373
|
-
|
4277
|
+
}
|
4278
|
+
setErrorCorrectionLevel(errorCorrectionLevel) {
|
4374
4279
|
switch (errorCorrectionLevel) {
|
4375
4280
|
case ErrorCorrectionLevel.L:
|
4376
4281
|
case ErrorCorrectionLevel.M:
|
@@ -4379,36 +4284,36 @@ var Encoder = /* @__PURE__ */ function() {
|
|
4379
4284
|
this.errorCorrectionLevel = errorCorrectionLevel;
|
4380
4285
|
}
|
4381
4286
|
return this;
|
4382
|
-
}
|
4383
|
-
|
4287
|
+
}
|
4288
|
+
getEncodingHint() {
|
4384
4289
|
return this.encodingHint;
|
4385
|
-
}
|
4386
|
-
|
4290
|
+
}
|
4291
|
+
setEncodingHint(encodingHint) {
|
4387
4292
|
this.encodingHint = encodingHint;
|
4388
4293
|
return this;
|
4389
|
-
}
|
4390
|
-
|
4391
|
-
|
4294
|
+
}
|
4295
|
+
write(data) {
|
4296
|
+
const { chunks } = this;
|
4392
4297
|
if (data instanceof QRData) {
|
4393
4298
|
chunks.push(data);
|
4394
4299
|
} else {
|
4395
|
-
|
4300
|
+
const type = toString2.call(data);
|
4396
4301
|
if (type === "[object String]") {
|
4397
4302
|
chunks.push(new QRByte(data));
|
4398
4303
|
} else {
|
4399
|
-
throw new Error(
|
4304
|
+
throw new Error(`illegal data: ${data}`);
|
4400
4305
|
}
|
4401
4306
|
}
|
4402
4307
|
return this;
|
4403
|
-
}
|
4404
|
-
|
4308
|
+
}
|
4309
|
+
isDark(row, col) {
|
4405
4310
|
return this.matrix[row][col] === true;
|
4406
|
-
}
|
4407
|
-
|
4408
|
-
|
4409
|
-
|
4410
|
-
for (
|
4411
|
-
for (
|
4311
|
+
}
|
4312
|
+
setupFinderPattern(row, col) {
|
4313
|
+
const { matrix } = this;
|
4314
|
+
const matrixSize = this.matrixSize;
|
4315
|
+
for (let r = -1; r <= 7; r++) {
|
4316
|
+
for (let c = -1; c <= 7; c++) {
|
4412
4317
|
if (row + r <= -1 || matrixSize <= row + r || col + c <= -1 || matrixSize <= col + c) {
|
4413
4318
|
continue;
|
4414
4319
|
}
|
@@ -4419,20 +4324,20 @@ var Encoder = /* @__PURE__ */ function() {
|
|
4419
4324
|
}
|
4420
4325
|
}
|
4421
4326
|
}
|
4422
|
-
}
|
4423
|
-
|
4424
|
-
|
4425
|
-
|
4426
|
-
|
4427
|
-
for (
|
4428
|
-
for (
|
4429
|
-
|
4430
|
-
|
4327
|
+
}
|
4328
|
+
setupAlignmentPattern() {
|
4329
|
+
const { matrix } = this;
|
4330
|
+
const pos = getAlignmentPattern(this.version);
|
4331
|
+
const { length } = pos;
|
4332
|
+
for (let i = 0; i < length; i++) {
|
4333
|
+
for (let j = 0; j < length; j++) {
|
4334
|
+
const row = pos[i];
|
4335
|
+
const col = pos[j];
|
4431
4336
|
if (matrix[row][col] !== null) {
|
4432
4337
|
continue;
|
4433
4338
|
}
|
4434
|
-
for (
|
4435
|
-
for (
|
4339
|
+
for (let r = -2; r <= 2; r++) {
|
4340
|
+
for (let c = -2; c <= 2; c++) {
|
4436
4341
|
if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) {
|
4437
4342
|
matrix[row + r][col + c] = true;
|
4438
4343
|
} else {
|
@@ -4442,12 +4347,12 @@ var Encoder = /* @__PURE__ */ function() {
|
|
4442
4347
|
}
|
4443
4348
|
}
|
4444
4349
|
}
|
4445
|
-
}
|
4446
|
-
|
4447
|
-
|
4448
|
-
|
4449
|
-
for (
|
4450
|
-
|
4350
|
+
}
|
4351
|
+
setupTimingPattern() {
|
4352
|
+
const { matrix } = this;
|
4353
|
+
const count = this.matrixSize - 8;
|
4354
|
+
for (let i = 8; i < count; i++) {
|
4355
|
+
const bit = i % 2 === 0;
|
4451
4356
|
if (matrix[i][6] === null) {
|
4452
4357
|
matrix[i][6] = bit;
|
4453
4358
|
}
|
@@ -4455,14 +4360,14 @@ var Encoder = /* @__PURE__ */ function() {
|
|
4455
4360
|
matrix[6][i] = bit;
|
4456
4361
|
}
|
4457
4362
|
}
|
4458
|
-
}
|
4459
|
-
|
4460
|
-
|
4461
|
-
|
4462
|
-
|
4463
|
-
|
4464
|
-
for (
|
4465
|
-
|
4363
|
+
}
|
4364
|
+
setupFormatInfo(maskPattern) {
|
4365
|
+
const { matrix } = this;
|
4366
|
+
const data = this.errorCorrectionLevel << 3 | maskPattern;
|
4367
|
+
const bits = getBCHVersionInfo(data);
|
4368
|
+
const matrixSize = this.matrixSize;
|
4369
|
+
for (let i = 0; i < 15; i++) {
|
4370
|
+
const bit = (bits >> i & 1) === 1;
|
4466
4371
|
if (i < 6) {
|
4467
4372
|
matrix[i][8] = bit;
|
4468
4373
|
} else if (i < 8) {
|
@@ -4479,42 +4384,42 @@ var Encoder = /* @__PURE__ */ function() {
|
|
4479
4384
|
}
|
4480
4385
|
}
|
4481
4386
|
matrix[matrixSize - 8][8] = true;
|
4482
|
-
}
|
4483
|
-
|
4387
|
+
}
|
4388
|
+
setupVersionInfo() {
|
4484
4389
|
if (this.version >= 7) {
|
4485
|
-
|
4486
|
-
|
4487
|
-
|
4488
|
-
for (
|
4489
|
-
|
4390
|
+
const { matrix } = this;
|
4391
|
+
const matrixSize = this.matrixSize;
|
4392
|
+
const bits = getBCHVersion(this.version);
|
4393
|
+
for (let i = 0; i < 18; i++) {
|
4394
|
+
const bit = (bits >> i & 1) === 1;
|
4490
4395
|
matrix[i / 3 >> 0][i % 3 + matrixSize - 8 - 3] = bit;
|
4491
4396
|
matrix[i % 3 + matrixSize - 8 - 3][i / 3 >> 0] = bit;
|
4492
4397
|
}
|
4493
4398
|
}
|
4494
|
-
}
|
4495
|
-
|
4496
|
-
|
4497
|
-
|
4498
|
-
|
4499
|
-
|
4500
|
-
|
4501
|
-
for (
|
4399
|
+
}
|
4400
|
+
setupCodewords(data, maskPattern) {
|
4401
|
+
const { matrix } = this;
|
4402
|
+
const matrixSize = this.matrixSize;
|
4403
|
+
const bitLength = data.getLengthInBits();
|
4404
|
+
const maskFunc = getMaskFunc(maskPattern);
|
4405
|
+
let bitIndex = 0;
|
4406
|
+
for (let right = matrixSize - 1; right >= 1; right -= 2) {
|
4502
4407
|
if (right === 6) {
|
4503
4408
|
right = 5;
|
4504
4409
|
}
|
4505
|
-
for (
|
4506
|
-
for (
|
4507
|
-
|
4508
|
-
|
4509
|
-
|
4410
|
+
for (let vert = 0; vert < matrixSize; vert++) {
|
4411
|
+
for (let j = 0; j < 2; j++) {
|
4412
|
+
const x = right - j;
|
4413
|
+
const upward = (right + 1 & 2) === 0;
|
4414
|
+
const y = upward ? matrixSize - 1 - vert : vert;
|
4510
4415
|
if (matrix[y][x] !== null) {
|
4511
4416
|
continue;
|
4512
4417
|
}
|
4513
|
-
|
4418
|
+
let bit = false;
|
4514
4419
|
if (bitIndex < bitLength) {
|
4515
4420
|
bit = data.getBit(bitIndex++);
|
4516
4421
|
}
|
4517
|
-
|
4422
|
+
const invert = maskFunc(x, y);
|
4518
4423
|
if (invert) {
|
4519
4424
|
bit = !bit;
|
4520
4425
|
}
|
@@ -4522,13 +4427,13 @@ var Encoder = /* @__PURE__ */ function() {
|
|
4522
4427
|
}
|
4523
4428
|
}
|
4524
4429
|
}
|
4525
|
-
}
|
4526
|
-
|
4527
|
-
|
4528
|
-
|
4529
|
-
for (
|
4430
|
+
}
|
4431
|
+
buildMatrix(data, maskPattern) {
|
4432
|
+
const matrix = [];
|
4433
|
+
const matrixSize = this.matrixSize;
|
4434
|
+
for (let row = 0; row < matrixSize; row++) {
|
4530
4435
|
matrix[row] = [];
|
4531
|
-
for (
|
4436
|
+
for (let col = 0; col < matrixSize; col++) {
|
4532
4437
|
matrix[row][col] = null;
|
4533
4438
|
}
|
4534
4439
|
}
|
@@ -4541,37 +4446,36 @@ var Encoder = /* @__PURE__ */ function() {
|
|
4541
4446
|
this.setupFormatInfo(maskPattern);
|
4542
4447
|
this.setupVersionInfo();
|
4543
4448
|
this.setupCodewords(data, maskPattern);
|
4544
|
-
}
|
4545
|
-
|
4546
|
-
|
4547
|
-
|
4548
|
-
|
4549
|
-
|
4550
|
-
var _c = this, chunks = _c.chunks, errorCorrectionLevel = _c.errorCorrectionLevel;
|
4449
|
+
}
|
4450
|
+
make() {
|
4451
|
+
let buffer2;
|
4452
|
+
let rsBlocks;
|
4453
|
+
let maxDataCount;
|
4454
|
+
const { chunks, errorCorrectionLevel } = this;
|
4551
4455
|
if (this.auto) {
|
4552
|
-
|
4456
|
+
let version2 = 1;
|
4553
4457
|
for (; version2 <= 40; version2++) {
|
4554
|
-
|
4458
|
+
[buffer2, rsBlocks, maxDataCount] = prepareData(version2, errorCorrectionLevel, this.encodingHint, chunks);
|
4555
4459
|
if (buffer2.getLengthInBits() <= maxDataCount)
|
4556
4460
|
break;
|
4557
4461
|
}
|
4558
|
-
|
4462
|
+
const dataLengthInBits = buffer2.getLengthInBits();
|
4559
4463
|
if (dataLengthInBits > maxDataCount) {
|
4560
|
-
throw new Error(
|
4464
|
+
throw new Error(`data overflow: ${dataLengthInBits} > ${maxDataCount}`);
|
4561
4465
|
}
|
4562
4466
|
this.version = version2;
|
4563
4467
|
} else {
|
4564
|
-
|
4468
|
+
[buffer2, rsBlocks, maxDataCount] = prepareData(this.version, errorCorrectionLevel, this.encodingHint, chunks);
|
4565
4469
|
}
|
4566
4470
|
this.matrixSize = this.version * 4 + 17;
|
4567
|
-
|
4568
|
-
|
4569
|
-
|
4570
|
-
|
4571
|
-
for (
|
4471
|
+
const matrices = [];
|
4472
|
+
const data = createData(buffer2, rsBlocks, maxDataCount);
|
4473
|
+
let bestMaskPattern = -1;
|
4474
|
+
let minPenalty = Number.MAX_VALUE;
|
4475
|
+
for (let maskPattern = 0; maskPattern < 8; maskPattern++) {
|
4572
4476
|
this.buildMatrix(data, maskPattern);
|
4573
4477
|
matrices.push(this.matrix);
|
4574
|
-
|
4478
|
+
const penalty = calculateMaskPenalty(this);
|
4575
4479
|
if (penalty < minPenalty) {
|
4576
4480
|
minPenalty = penalty;
|
4577
4481
|
bestMaskPattern = maskPattern;
|
@@ -4579,52 +4483,46 @@ var Encoder = /* @__PURE__ */ function() {
|
|
4579
4483
|
}
|
4580
4484
|
this.matrix = matrices[bestMaskPattern];
|
4581
4485
|
return this;
|
4582
|
-
}
|
4583
|
-
|
4584
|
-
if (moduleSize === void 0) {
|
4585
|
-
moduleSize = 2;
|
4586
|
-
}
|
4587
|
-
if (margin === void 0) {
|
4588
|
-
margin = moduleSize * 4;
|
4589
|
-
}
|
4486
|
+
}
|
4487
|
+
toDataURL(moduleSize = 2, margin = moduleSize * 4, colors) {
|
4590
4488
|
moduleSize = Math.max(1, moduleSize >> 0);
|
4591
4489
|
margin = Math.max(0, margin >> 0);
|
4592
|
-
|
4593
|
-
|
4594
|
-
|
4595
|
-
|
4596
|
-
|
4597
|
-
for (
|
4598
|
-
for (
|
4490
|
+
const matrixSize = this.matrixSize;
|
4491
|
+
const size = moduleSize * matrixSize + margin * 2;
|
4492
|
+
const min = margin;
|
4493
|
+
const max = size - margin;
|
4494
|
+
const gif = new GIFImage(size, size, colors);
|
4495
|
+
for (let y = 0; y < size; y++) {
|
4496
|
+
for (let x = 0; x < size; x++) {
|
4599
4497
|
if (min <= x && x < max && min <= y && y < max) {
|
4600
|
-
|
4601
|
-
|
4602
|
-
gif.
|
4498
|
+
const row = (y - min) / moduleSize >> 0;
|
4499
|
+
const col = (x - min) / moduleSize >> 0;
|
4500
|
+
gif.set(x, y, this.isDark(row, col) ? 1 : 0);
|
4603
4501
|
} else {
|
4604
|
-
gif.
|
4502
|
+
gif.set(x, y, 0);
|
4605
4503
|
}
|
4606
4504
|
}
|
4607
4505
|
}
|
4608
4506
|
return gif.toDataURL();
|
4609
|
-
}
|
4610
|
-
|
4507
|
+
}
|
4508
|
+
clear() {
|
4611
4509
|
this.chunks = [];
|
4612
|
-
}
|
4613
|
-
|
4614
|
-
|
4510
|
+
}
|
4511
|
+
};
|
4512
|
+
__name(Encoder, "Encoder");
|
4615
4513
|
|
4616
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
4514
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/encoding/UTF16.js
|
4617
4515
|
function encode8(text) {
|
4618
|
-
|
4619
|
-
|
4620
|
-
for (
|
4516
|
+
const { length } = text;
|
4517
|
+
const bytes = [];
|
4518
|
+
for (let i = 0; i < length; i++) {
|
4621
4519
|
bytes.push(text.charCodeAt(i));
|
4622
4520
|
}
|
4623
4521
|
return bytes;
|
4624
4522
|
}
|
4625
4523
|
__name(encode8, "encode");
|
4626
4524
|
|
4627
|
-
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.
|
4525
|
+
// ../../../node_modules/.pnpm/@nuintun+qrcode@3.4.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRAlphanumeric.js
|
4628
4526
|
function getByte(byte) {
|
4629
4527
|
if (48 <= byte && byte <= 57) {
|
4630
4528
|
return byte - 48;
|
@@ -4651,23 +4549,20 @@ function getByte(byte) {
|
|
4651
4549
|
case 58:
|
4652
4550
|
return 44;
|
4653
4551
|
default:
|
4654
|
-
throw new Error(
|
4552
|
+
throw new Error(`illegal char: ${String.fromCharCode(byte)}`);
|
4655
4553
|
}
|
4656
4554
|
}
|
4657
4555
|
}
|
4658
4556
|
__name(getByte, "getByte");
|
4659
|
-
var QRAlphanumeric =
|
4660
|
-
|
4661
|
-
|
4662
|
-
|
4663
|
-
|
4664
|
-
|
4665
|
-
|
4666
|
-
|
4667
|
-
|
4668
|
-
var i = 0;
|
4669
|
-
var bytes = this.bytes;
|
4670
|
-
var length = bytes.length;
|
4557
|
+
var QRAlphanumeric = class extends QRData {
|
4558
|
+
constructor(data) {
|
4559
|
+
super(Mode.Alphanumeric, data);
|
4560
|
+
this.bytes = encode8(data);
|
4561
|
+
}
|
4562
|
+
writeTo(buffer2) {
|
4563
|
+
let i = 0;
|
4564
|
+
const { bytes } = this;
|
4565
|
+
const { length } = bytes;
|
4671
4566
|
while (i + 1 < length) {
|
4672
4567
|
buffer2.put(getByte(bytes[i]) * 45 + getByte(bytes[i + 1]), 11);
|
4673
4568
|
i += 2;
|
@@ -4675,9 +4570,9 @@ var QRAlphanumeric = /* @__PURE__ */ function(_super) {
|
|
4675
4570
|
if (i < length) {
|
4676
4571
|
buffer2.put(getByte(bytes[i]), 6);
|
4677
4572
|
}
|
4678
|
-
}
|
4679
|
-
|
4680
|
-
|
4573
|
+
}
|
4574
|
+
};
|
4575
|
+
__name(QRAlphanumeric, "QRAlphanumeric");
|
4681
4576
|
|
4682
4577
|
// ../../../node_modules/.pnpm/@digitalbazaar+vpqr@3.0.0/node_modules/@digitalbazaar/vpqr/lib/vpqr.js
|
4683
4578
|
var VP_QR_VERSION = "VP1";
|
@@ -4788,14 +4683,20 @@ export {
|
|
4788
4683
|
/*!
|
4789
4684
|
* Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved.
|
4790
4685
|
*/
|
4686
|
+
/*!
|
4687
|
+
* Copyright (c) 2020-2023 Digital Bazaar, Inc. All rights reserved.
|
4688
|
+
*/
|
4791
4689
|
/*!
|
4792
4690
|
* Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
|
4793
4691
|
*/
|
4692
|
+
/*!
|
4693
|
+
* Copyright (c) 2021-2023 Digital Bazaar, Inc. All rights reserved.
|
4694
|
+
*/
|
4794
4695
|
/**
|
4795
4696
|
* @module QRCode
|
4796
4697
|
* @package @nuintun/qrcode
|
4797
4698
|
* @license MIT
|
4798
|
-
* @version 3.
|
4699
|
+
* @version 3.4.0
|
4799
4700
|
* @author nuintun <nuintun@qq.com>
|
4800
4701
|
* @description A pure JavaScript QRCode encode and decode library.
|
4801
4702
|
* @see https://github.com/nuintun/qrcode#readme
|