qodewk 0.1.10 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2129 -68
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1153,7 +1153,7 @@ var require_command = __commonJS({
|
|
|
1153
1153
|
"use strict";
|
|
1154
1154
|
var EventEmitter2 = require("events").EventEmitter;
|
|
1155
1155
|
var childProcess = require("child_process");
|
|
1156
|
-
var
|
|
1156
|
+
var path8 = require("path");
|
|
1157
1157
|
var fs7 = require("fs");
|
|
1158
1158
|
var process2 = require("process");
|
|
1159
1159
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -2153,9 +2153,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2153
2153
|
let launchWithNode = false;
|
|
2154
2154
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
2155
2155
|
function findFile(baseDir, baseName) {
|
|
2156
|
-
const localBin =
|
|
2156
|
+
const localBin = path8.resolve(baseDir, baseName);
|
|
2157
2157
|
if (fs7.existsSync(localBin)) return localBin;
|
|
2158
|
-
if (sourceExt.includes(
|
|
2158
|
+
if (sourceExt.includes(path8.extname(baseName))) return void 0;
|
|
2159
2159
|
const foundExt = sourceExt.find(
|
|
2160
2160
|
(ext) => fs7.existsSync(`${localBin}${ext}`)
|
|
2161
2161
|
);
|
|
@@ -2173,17 +2173,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2173
2173
|
} catch {
|
|
2174
2174
|
resolvedScriptPath = this._scriptPath;
|
|
2175
2175
|
}
|
|
2176
|
-
executableDir =
|
|
2177
|
-
|
|
2176
|
+
executableDir = path8.resolve(
|
|
2177
|
+
path8.dirname(resolvedScriptPath),
|
|
2178
2178
|
executableDir
|
|
2179
2179
|
);
|
|
2180
2180
|
}
|
|
2181
2181
|
if (executableDir) {
|
|
2182
2182
|
let localFile = findFile(executableDir, executableFile);
|
|
2183
2183
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
2184
|
-
const legacyName =
|
|
2184
|
+
const legacyName = path8.basename(
|
|
2185
2185
|
this._scriptPath,
|
|
2186
|
-
|
|
2186
|
+
path8.extname(this._scriptPath)
|
|
2187
2187
|
);
|
|
2188
2188
|
if (legacyName !== this._name) {
|
|
2189
2189
|
localFile = findFile(
|
|
@@ -2194,7 +2194,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2194
2194
|
}
|
|
2195
2195
|
executableFile = localFile || executableFile;
|
|
2196
2196
|
}
|
|
2197
|
-
launchWithNode = sourceExt.includes(
|
|
2197
|
+
launchWithNode = sourceExt.includes(path8.extname(executableFile));
|
|
2198
2198
|
let proc;
|
|
2199
2199
|
if (process2.platform !== "win32") {
|
|
2200
2200
|
if (launchWithNode) {
|
|
@@ -3041,7 +3041,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3041
3041
|
* @return {Command}
|
|
3042
3042
|
*/
|
|
3043
3043
|
nameFromFilename(filename) {
|
|
3044
|
-
this._name =
|
|
3044
|
+
this._name = path8.basename(filename, path8.extname(filename));
|
|
3045
3045
|
return this;
|
|
3046
3046
|
}
|
|
3047
3047
|
/**
|
|
@@ -3055,9 +3055,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3055
3055
|
* @param {string} [path]
|
|
3056
3056
|
* @return {(string|null|Command)}
|
|
3057
3057
|
*/
|
|
3058
|
-
executableDir(
|
|
3059
|
-
if (
|
|
3060
|
-
this._executableDir =
|
|
3058
|
+
executableDir(path9) {
|
|
3059
|
+
if (path9 === void 0) return this._executableDir;
|
|
3060
|
+
this._executableDir = path9;
|
|
3061
3061
|
return this;
|
|
3062
3062
|
}
|
|
3063
3063
|
/**
|
|
@@ -3403,6 +3403,1940 @@ var require_picocolors = __commonJS({
|
|
|
3403
3403
|
}
|
|
3404
3404
|
});
|
|
3405
3405
|
|
|
3406
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js
|
|
3407
|
+
var require_utils = __commonJS({
|
|
3408
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js"(exports2) {
|
|
3409
|
+
"use strict";
|
|
3410
|
+
var toSJISFunction;
|
|
3411
|
+
var CODEWORDS_COUNT = [
|
|
3412
|
+
0,
|
|
3413
|
+
// Not used
|
|
3414
|
+
26,
|
|
3415
|
+
44,
|
|
3416
|
+
70,
|
|
3417
|
+
100,
|
|
3418
|
+
134,
|
|
3419
|
+
172,
|
|
3420
|
+
196,
|
|
3421
|
+
242,
|
|
3422
|
+
292,
|
|
3423
|
+
346,
|
|
3424
|
+
404,
|
|
3425
|
+
466,
|
|
3426
|
+
532,
|
|
3427
|
+
581,
|
|
3428
|
+
655,
|
|
3429
|
+
733,
|
|
3430
|
+
815,
|
|
3431
|
+
901,
|
|
3432
|
+
991,
|
|
3433
|
+
1085,
|
|
3434
|
+
1156,
|
|
3435
|
+
1258,
|
|
3436
|
+
1364,
|
|
3437
|
+
1474,
|
|
3438
|
+
1588,
|
|
3439
|
+
1706,
|
|
3440
|
+
1828,
|
|
3441
|
+
1921,
|
|
3442
|
+
2051,
|
|
3443
|
+
2185,
|
|
3444
|
+
2323,
|
|
3445
|
+
2465,
|
|
3446
|
+
2611,
|
|
3447
|
+
2761,
|
|
3448
|
+
2876,
|
|
3449
|
+
3034,
|
|
3450
|
+
3196,
|
|
3451
|
+
3362,
|
|
3452
|
+
3532,
|
|
3453
|
+
3706
|
|
3454
|
+
];
|
|
3455
|
+
exports2.getSymbolSize = function getSymbolSize(version) {
|
|
3456
|
+
if (!version) throw new Error('"version" cannot be null or undefined');
|
|
3457
|
+
if (version < 1 || version > 40) throw new Error('"version" should be in range from 1 to 40');
|
|
3458
|
+
return version * 4 + 17;
|
|
3459
|
+
};
|
|
3460
|
+
exports2.getSymbolTotalCodewords = function getSymbolTotalCodewords(version) {
|
|
3461
|
+
return CODEWORDS_COUNT[version];
|
|
3462
|
+
};
|
|
3463
|
+
exports2.getBCHDigit = function(data) {
|
|
3464
|
+
let digit = 0;
|
|
3465
|
+
while (data !== 0) {
|
|
3466
|
+
digit++;
|
|
3467
|
+
data >>>= 1;
|
|
3468
|
+
}
|
|
3469
|
+
return digit;
|
|
3470
|
+
};
|
|
3471
|
+
exports2.setToSJISFunction = function setToSJISFunction(f) {
|
|
3472
|
+
if (typeof f !== "function") {
|
|
3473
|
+
throw new Error('"toSJISFunc" is not a valid function.');
|
|
3474
|
+
}
|
|
3475
|
+
toSJISFunction = f;
|
|
3476
|
+
};
|
|
3477
|
+
exports2.isKanjiModeEnabled = function() {
|
|
3478
|
+
return typeof toSJISFunction !== "undefined";
|
|
3479
|
+
};
|
|
3480
|
+
exports2.toSJIS = function toSJIS(kanji) {
|
|
3481
|
+
return toSJISFunction(kanji);
|
|
3482
|
+
};
|
|
3483
|
+
}
|
|
3484
|
+
});
|
|
3485
|
+
|
|
3486
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js
|
|
3487
|
+
var require_error_correction_level = __commonJS({
|
|
3488
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js"(exports2) {
|
|
3489
|
+
"use strict";
|
|
3490
|
+
exports2.L = { bit: 1 };
|
|
3491
|
+
exports2.M = { bit: 0 };
|
|
3492
|
+
exports2.Q = { bit: 3 };
|
|
3493
|
+
exports2.H = { bit: 2 };
|
|
3494
|
+
function fromString(string) {
|
|
3495
|
+
if (typeof string !== "string") {
|
|
3496
|
+
throw new Error("Param is not a string");
|
|
3497
|
+
}
|
|
3498
|
+
const lcStr = string.toLowerCase();
|
|
3499
|
+
switch (lcStr) {
|
|
3500
|
+
case "l":
|
|
3501
|
+
case "low":
|
|
3502
|
+
return exports2.L;
|
|
3503
|
+
case "m":
|
|
3504
|
+
case "medium":
|
|
3505
|
+
return exports2.M;
|
|
3506
|
+
case "q":
|
|
3507
|
+
case "quartile":
|
|
3508
|
+
return exports2.Q;
|
|
3509
|
+
case "h":
|
|
3510
|
+
case "high":
|
|
3511
|
+
return exports2.H;
|
|
3512
|
+
default:
|
|
3513
|
+
throw new Error("Unknown EC Level: " + string);
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3516
|
+
exports2.isValid = function isValid2(level) {
|
|
3517
|
+
return level && typeof level.bit !== "undefined" && level.bit >= 0 && level.bit < 4;
|
|
3518
|
+
};
|
|
3519
|
+
exports2.from = function from(value, defaultValue) {
|
|
3520
|
+
if (exports2.isValid(value)) {
|
|
3521
|
+
return value;
|
|
3522
|
+
}
|
|
3523
|
+
try {
|
|
3524
|
+
return fromString(value);
|
|
3525
|
+
} catch (e) {
|
|
3526
|
+
return defaultValue;
|
|
3527
|
+
}
|
|
3528
|
+
};
|
|
3529
|
+
}
|
|
3530
|
+
});
|
|
3531
|
+
|
|
3532
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js
|
|
3533
|
+
var require_bit_buffer = __commonJS({
|
|
3534
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js"(exports2, module2) {
|
|
3535
|
+
"use strict";
|
|
3536
|
+
function BitBuffer() {
|
|
3537
|
+
this.buffer = [];
|
|
3538
|
+
this.length = 0;
|
|
3539
|
+
}
|
|
3540
|
+
BitBuffer.prototype = {
|
|
3541
|
+
get: function(index) {
|
|
3542
|
+
const bufIndex = Math.floor(index / 8);
|
|
3543
|
+
return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) === 1;
|
|
3544
|
+
},
|
|
3545
|
+
put: function(num, length) {
|
|
3546
|
+
for (let i2 = 0; i2 < length; i2++) {
|
|
3547
|
+
this.putBit((num >>> length - i2 - 1 & 1) === 1);
|
|
3548
|
+
}
|
|
3549
|
+
},
|
|
3550
|
+
getLengthInBits: function() {
|
|
3551
|
+
return this.length;
|
|
3552
|
+
},
|
|
3553
|
+
putBit: function(bit) {
|
|
3554
|
+
const bufIndex = Math.floor(this.length / 8);
|
|
3555
|
+
if (this.buffer.length <= bufIndex) {
|
|
3556
|
+
this.buffer.push(0);
|
|
3557
|
+
}
|
|
3558
|
+
if (bit) {
|
|
3559
|
+
this.buffer[bufIndex] |= 128 >>> this.length % 8;
|
|
3560
|
+
}
|
|
3561
|
+
this.length++;
|
|
3562
|
+
}
|
|
3563
|
+
};
|
|
3564
|
+
module2.exports = BitBuffer;
|
|
3565
|
+
}
|
|
3566
|
+
});
|
|
3567
|
+
|
|
3568
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js
|
|
3569
|
+
var require_bit_matrix = __commonJS({
|
|
3570
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js"(exports2, module2) {
|
|
3571
|
+
"use strict";
|
|
3572
|
+
function BitMatrix(size) {
|
|
3573
|
+
if (!size || size < 1) {
|
|
3574
|
+
throw new Error("BitMatrix size must be defined and greater than 0");
|
|
3575
|
+
}
|
|
3576
|
+
this.size = size;
|
|
3577
|
+
this.data = new Uint8Array(size * size);
|
|
3578
|
+
this.reservedBit = new Uint8Array(size * size);
|
|
3579
|
+
}
|
|
3580
|
+
BitMatrix.prototype.set = function(row, col, value, reserved) {
|
|
3581
|
+
const index = row * this.size + col;
|
|
3582
|
+
this.data[index] = value;
|
|
3583
|
+
if (reserved) this.reservedBit[index] = true;
|
|
3584
|
+
};
|
|
3585
|
+
BitMatrix.prototype.get = function(row, col) {
|
|
3586
|
+
return this.data[row * this.size + col];
|
|
3587
|
+
};
|
|
3588
|
+
BitMatrix.prototype.xor = function(row, col, value) {
|
|
3589
|
+
this.data[row * this.size + col] ^= value;
|
|
3590
|
+
};
|
|
3591
|
+
BitMatrix.prototype.isReserved = function(row, col) {
|
|
3592
|
+
return this.reservedBit[row * this.size + col];
|
|
3593
|
+
};
|
|
3594
|
+
module2.exports = BitMatrix;
|
|
3595
|
+
}
|
|
3596
|
+
});
|
|
3597
|
+
|
|
3598
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js
|
|
3599
|
+
var require_alignment_pattern = __commonJS({
|
|
3600
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js"(exports2) {
|
|
3601
|
+
"use strict";
|
|
3602
|
+
var getSymbolSize = require_utils().getSymbolSize;
|
|
3603
|
+
exports2.getRowColCoords = function getRowColCoords(version) {
|
|
3604
|
+
if (version === 1) return [];
|
|
3605
|
+
const posCount = Math.floor(version / 7) + 2;
|
|
3606
|
+
const size = getSymbolSize(version);
|
|
3607
|
+
const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;
|
|
3608
|
+
const positions = [size - 7];
|
|
3609
|
+
for (let i2 = 1; i2 < posCount - 1; i2++) {
|
|
3610
|
+
positions[i2] = positions[i2 - 1] - intervals;
|
|
3611
|
+
}
|
|
3612
|
+
positions.push(6);
|
|
3613
|
+
return positions.reverse();
|
|
3614
|
+
};
|
|
3615
|
+
exports2.getPositions = function getPositions(version) {
|
|
3616
|
+
const coords = [];
|
|
3617
|
+
const pos = exports2.getRowColCoords(version);
|
|
3618
|
+
const posLength = pos.length;
|
|
3619
|
+
for (let i2 = 0; i2 < posLength; i2++) {
|
|
3620
|
+
for (let j2 = 0; j2 < posLength; j2++) {
|
|
3621
|
+
if (i2 === 0 && j2 === 0 || // top-left
|
|
3622
|
+
i2 === 0 && j2 === posLength - 1 || // bottom-left
|
|
3623
|
+
i2 === posLength - 1 && j2 === 0) {
|
|
3624
|
+
continue;
|
|
3625
|
+
}
|
|
3626
|
+
coords.push([pos[i2], pos[j2]]);
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
return coords;
|
|
3630
|
+
};
|
|
3631
|
+
}
|
|
3632
|
+
});
|
|
3633
|
+
|
|
3634
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js
|
|
3635
|
+
var require_finder_pattern = __commonJS({
|
|
3636
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js"(exports2) {
|
|
3637
|
+
"use strict";
|
|
3638
|
+
var getSymbolSize = require_utils().getSymbolSize;
|
|
3639
|
+
var FINDER_PATTERN_SIZE = 7;
|
|
3640
|
+
exports2.getPositions = function getPositions(version) {
|
|
3641
|
+
const size = getSymbolSize(version);
|
|
3642
|
+
return [
|
|
3643
|
+
// top-left
|
|
3644
|
+
[0, 0],
|
|
3645
|
+
// top-right
|
|
3646
|
+
[size - FINDER_PATTERN_SIZE, 0],
|
|
3647
|
+
// bottom-left
|
|
3648
|
+
[0, size - FINDER_PATTERN_SIZE]
|
|
3649
|
+
];
|
|
3650
|
+
};
|
|
3651
|
+
}
|
|
3652
|
+
});
|
|
3653
|
+
|
|
3654
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js
|
|
3655
|
+
var require_mask_pattern = __commonJS({
|
|
3656
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js"(exports2) {
|
|
3657
|
+
"use strict";
|
|
3658
|
+
exports2.Patterns = {
|
|
3659
|
+
PATTERN000: 0,
|
|
3660
|
+
PATTERN001: 1,
|
|
3661
|
+
PATTERN010: 2,
|
|
3662
|
+
PATTERN011: 3,
|
|
3663
|
+
PATTERN100: 4,
|
|
3664
|
+
PATTERN101: 5,
|
|
3665
|
+
PATTERN110: 6,
|
|
3666
|
+
PATTERN111: 7
|
|
3667
|
+
};
|
|
3668
|
+
var PenaltyScores = {
|
|
3669
|
+
N1: 3,
|
|
3670
|
+
N2: 3,
|
|
3671
|
+
N3: 40,
|
|
3672
|
+
N4: 10
|
|
3673
|
+
};
|
|
3674
|
+
exports2.isValid = function isValid2(mask) {
|
|
3675
|
+
return mask != null && mask !== "" && !isNaN(mask) && mask >= 0 && mask <= 7;
|
|
3676
|
+
};
|
|
3677
|
+
exports2.from = function from(value) {
|
|
3678
|
+
return exports2.isValid(value) ? parseInt(value, 10) : void 0;
|
|
3679
|
+
};
|
|
3680
|
+
exports2.getPenaltyN1 = function getPenaltyN1(data) {
|
|
3681
|
+
const size = data.size;
|
|
3682
|
+
let points = 0;
|
|
3683
|
+
let sameCountCol = 0;
|
|
3684
|
+
let sameCountRow = 0;
|
|
3685
|
+
let lastCol = null;
|
|
3686
|
+
let lastRow = null;
|
|
3687
|
+
for (let row = 0; row < size; row++) {
|
|
3688
|
+
sameCountCol = sameCountRow = 0;
|
|
3689
|
+
lastCol = lastRow = null;
|
|
3690
|
+
for (let col = 0; col < size; col++) {
|
|
3691
|
+
let module3 = data.get(row, col);
|
|
3692
|
+
if (module3 === lastCol) {
|
|
3693
|
+
sameCountCol++;
|
|
3694
|
+
} else {
|
|
3695
|
+
if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
|
|
3696
|
+
lastCol = module3;
|
|
3697
|
+
sameCountCol = 1;
|
|
3698
|
+
}
|
|
3699
|
+
module3 = data.get(col, row);
|
|
3700
|
+
if (module3 === lastRow) {
|
|
3701
|
+
sameCountRow++;
|
|
3702
|
+
} else {
|
|
3703
|
+
if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
|
|
3704
|
+
lastRow = module3;
|
|
3705
|
+
sameCountRow = 1;
|
|
3706
|
+
}
|
|
3707
|
+
}
|
|
3708
|
+
if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
|
|
3709
|
+
if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
|
|
3710
|
+
}
|
|
3711
|
+
return points;
|
|
3712
|
+
};
|
|
3713
|
+
exports2.getPenaltyN2 = function getPenaltyN2(data) {
|
|
3714
|
+
const size = data.size;
|
|
3715
|
+
let points = 0;
|
|
3716
|
+
for (let row = 0; row < size - 1; row++) {
|
|
3717
|
+
for (let col = 0; col < size - 1; col++) {
|
|
3718
|
+
const last2 = data.get(row, col) + data.get(row, col + 1) + data.get(row + 1, col) + data.get(row + 1, col + 1);
|
|
3719
|
+
if (last2 === 4 || last2 === 0) points++;
|
|
3720
|
+
}
|
|
3721
|
+
}
|
|
3722
|
+
return points * PenaltyScores.N2;
|
|
3723
|
+
};
|
|
3724
|
+
exports2.getPenaltyN3 = function getPenaltyN3(data) {
|
|
3725
|
+
const size = data.size;
|
|
3726
|
+
let points = 0;
|
|
3727
|
+
let bitsCol = 0;
|
|
3728
|
+
let bitsRow = 0;
|
|
3729
|
+
for (let row = 0; row < size; row++) {
|
|
3730
|
+
bitsCol = bitsRow = 0;
|
|
3731
|
+
for (let col = 0; col < size; col++) {
|
|
3732
|
+
bitsCol = bitsCol << 1 & 2047 | data.get(row, col);
|
|
3733
|
+
if (col >= 10 && (bitsCol === 1488 || bitsCol === 93)) points++;
|
|
3734
|
+
bitsRow = bitsRow << 1 & 2047 | data.get(col, row);
|
|
3735
|
+
if (col >= 10 && (bitsRow === 1488 || bitsRow === 93)) points++;
|
|
3736
|
+
}
|
|
3737
|
+
}
|
|
3738
|
+
return points * PenaltyScores.N3;
|
|
3739
|
+
};
|
|
3740
|
+
exports2.getPenaltyN4 = function getPenaltyN4(data) {
|
|
3741
|
+
let darkCount = 0;
|
|
3742
|
+
const modulesCount = data.data.length;
|
|
3743
|
+
for (let i2 = 0; i2 < modulesCount; i2++) darkCount += data.data[i2];
|
|
3744
|
+
const k2 = Math.abs(Math.ceil(darkCount * 100 / modulesCount / 5) - 10);
|
|
3745
|
+
return k2 * PenaltyScores.N4;
|
|
3746
|
+
};
|
|
3747
|
+
function getMaskAt(maskPattern, i2, j2) {
|
|
3748
|
+
switch (maskPattern) {
|
|
3749
|
+
case exports2.Patterns.PATTERN000:
|
|
3750
|
+
return (i2 + j2) % 2 === 0;
|
|
3751
|
+
case exports2.Patterns.PATTERN001:
|
|
3752
|
+
return i2 % 2 === 0;
|
|
3753
|
+
case exports2.Patterns.PATTERN010:
|
|
3754
|
+
return j2 % 3 === 0;
|
|
3755
|
+
case exports2.Patterns.PATTERN011:
|
|
3756
|
+
return (i2 + j2) % 3 === 0;
|
|
3757
|
+
case exports2.Patterns.PATTERN100:
|
|
3758
|
+
return (Math.floor(i2 / 2) + Math.floor(j2 / 3)) % 2 === 0;
|
|
3759
|
+
case exports2.Patterns.PATTERN101:
|
|
3760
|
+
return i2 * j2 % 2 + i2 * j2 % 3 === 0;
|
|
3761
|
+
case exports2.Patterns.PATTERN110:
|
|
3762
|
+
return (i2 * j2 % 2 + i2 * j2 % 3) % 2 === 0;
|
|
3763
|
+
case exports2.Patterns.PATTERN111:
|
|
3764
|
+
return (i2 * j2 % 3 + (i2 + j2) % 2) % 2 === 0;
|
|
3765
|
+
default:
|
|
3766
|
+
throw new Error("bad maskPattern:" + maskPattern);
|
|
3767
|
+
}
|
|
3768
|
+
}
|
|
3769
|
+
exports2.applyMask = function applyMask(pattern, data) {
|
|
3770
|
+
const size = data.size;
|
|
3771
|
+
for (let col = 0; col < size; col++) {
|
|
3772
|
+
for (let row = 0; row < size; row++) {
|
|
3773
|
+
if (data.isReserved(row, col)) continue;
|
|
3774
|
+
data.xor(row, col, getMaskAt(pattern, row, col));
|
|
3775
|
+
}
|
|
3776
|
+
}
|
|
3777
|
+
};
|
|
3778
|
+
exports2.getBestMask = function getBestMask(data, setupFormatFunc) {
|
|
3779
|
+
const numPatterns = Object.keys(exports2.Patterns).length;
|
|
3780
|
+
let bestPattern = 0;
|
|
3781
|
+
let lowerPenalty = Infinity;
|
|
3782
|
+
for (let p2 = 0; p2 < numPatterns; p2++) {
|
|
3783
|
+
setupFormatFunc(p2);
|
|
3784
|
+
exports2.applyMask(p2, data);
|
|
3785
|
+
const penalty = exports2.getPenaltyN1(data) + exports2.getPenaltyN2(data) + exports2.getPenaltyN3(data) + exports2.getPenaltyN4(data);
|
|
3786
|
+
exports2.applyMask(p2, data);
|
|
3787
|
+
if (penalty < lowerPenalty) {
|
|
3788
|
+
lowerPenalty = penalty;
|
|
3789
|
+
bestPattern = p2;
|
|
3790
|
+
}
|
|
3791
|
+
}
|
|
3792
|
+
return bestPattern;
|
|
3793
|
+
};
|
|
3794
|
+
}
|
|
3795
|
+
});
|
|
3796
|
+
|
|
3797
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js
|
|
3798
|
+
var require_error_correction_code = __commonJS({
|
|
3799
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js"(exports2) {
|
|
3800
|
+
"use strict";
|
|
3801
|
+
var ECLevel = require_error_correction_level();
|
|
3802
|
+
var EC_BLOCKS_TABLE = [
|
|
3803
|
+
// L M Q H
|
|
3804
|
+
1,
|
|
3805
|
+
1,
|
|
3806
|
+
1,
|
|
3807
|
+
1,
|
|
3808
|
+
1,
|
|
3809
|
+
1,
|
|
3810
|
+
1,
|
|
3811
|
+
1,
|
|
3812
|
+
1,
|
|
3813
|
+
1,
|
|
3814
|
+
2,
|
|
3815
|
+
2,
|
|
3816
|
+
1,
|
|
3817
|
+
2,
|
|
3818
|
+
2,
|
|
3819
|
+
4,
|
|
3820
|
+
1,
|
|
3821
|
+
2,
|
|
3822
|
+
4,
|
|
3823
|
+
4,
|
|
3824
|
+
2,
|
|
3825
|
+
4,
|
|
3826
|
+
4,
|
|
3827
|
+
4,
|
|
3828
|
+
2,
|
|
3829
|
+
4,
|
|
3830
|
+
6,
|
|
3831
|
+
5,
|
|
3832
|
+
2,
|
|
3833
|
+
4,
|
|
3834
|
+
6,
|
|
3835
|
+
6,
|
|
3836
|
+
2,
|
|
3837
|
+
5,
|
|
3838
|
+
8,
|
|
3839
|
+
8,
|
|
3840
|
+
4,
|
|
3841
|
+
5,
|
|
3842
|
+
8,
|
|
3843
|
+
8,
|
|
3844
|
+
4,
|
|
3845
|
+
5,
|
|
3846
|
+
8,
|
|
3847
|
+
11,
|
|
3848
|
+
4,
|
|
3849
|
+
8,
|
|
3850
|
+
10,
|
|
3851
|
+
11,
|
|
3852
|
+
4,
|
|
3853
|
+
9,
|
|
3854
|
+
12,
|
|
3855
|
+
16,
|
|
3856
|
+
4,
|
|
3857
|
+
9,
|
|
3858
|
+
16,
|
|
3859
|
+
16,
|
|
3860
|
+
6,
|
|
3861
|
+
10,
|
|
3862
|
+
12,
|
|
3863
|
+
18,
|
|
3864
|
+
6,
|
|
3865
|
+
10,
|
|
3866
|
+
17,
|
|
3867
|
+
16,
|
|
3868
|
+
6,
|
|
3869
|
+
11,
|
|
3870
|
+
16,
|
|
3871
|
+
19,
|
|
3872
|
+
6,
|
|
3873
|
+
13,
|
|
3874
|
+
18,
|
|
3875
|
+
21,
|
|
3876
|
+
7,
|
|
3877
|
+
14,
|
|
3878
|
+
21,
|
|
3879
|
+
25,
|
|
3880
|
+
8,
|
|
3881
|
+
16,
|
|
3882
|
+
20,
|
|
3883
|
+
25,
|
|
3884
|
+
8,
|
|
3885
|
+
17,
|
|
3886
|
+
23,
|
|
3887
|
+
25,
|
|
3888
|
+
9,
|
|
3889
|
+
17,
|
|
3890
|
+
23,
|
|
3891
|
+
34,
|
|
3892
|
+
9,
|
|
3893
|
+
18,
|
|
3894
|
+
25,
|
|
3895
|
+
30,
|
|
3896
|
+
10,
|
|
3897
|
+
20,
|
|
3898
|
+
27,
|
|
3899
|
+
32,
|
|
3900
|
+
12,
|
|
3901
|
+
21,
|
|
3902
|
+
29,
|
|
3903
|
+
35,
|
|
3904
|
+
12,
|
|
3905
|
+
23,
|
|
3906
|
+
34,
|
|
3907
|
+
37,
|
|
3908
|
+
12,
|
|
3909
|
+
25,
|
|
3910
|
+
34,
|
|
3911
|
+
40,
|
|
3912
|
+
13,
|
|
3913
|
+
26,
|
|
3914
|
+
35,
|
|
3915
|
+
42,
|
|
3916
|
+
14,
|
|
3917
|
+
28,
|
|
3918
|
+
38,
|
|
3919
|
+
45,
|
|
3920
|
+
15,
|
|
3921
|
+
29,
|
|
3922
|
+
40,
|
|
3923
|
+
48,
|
|
3924
|
+
16,
|
|
3925
|
+
31,
|
|
3926
|
+
43,
|
|
3927
|
+
51,
|
|
3928
|
+
17,
|
|
3929
|
+
33,
|
|
3930
|
+
45,
|
|
3931
|
+
54,
|
|
3932
|
+
18,
|
|
3933
|
+
35,
|
|
3934
|
+
48,
|
|
3935
|
+
57,
|
|
3936
|
+
19,
|
|
3937
|
+
37,
|
|
3938
|
+
51,
|
|
3939
|
+
60,
|
|
3940
|
+
19,
|
|
3941
|
+
38,
|
|
3942
|
+
53,
|
|
3943
|
+
63,
|
|
3944
|
+
20,
|
|
3945
|
+
40,
|
|
3946
|
+
56,
|
|
3947
|
+
66,
|
|
3948
|
+
21,
|
|
3949
|
+
43,
|
|
3950
|
+
59,
|
|
3951
|
+
70,
|
|
3952
|
+
22,
|
|
3953
|
+
45,
|
|
3954
|
+
62,
|
|
3955
|
+
74,
|
|
3956
|
+
24,
|
|
3957
|
+
47,
|
|
3958
|
+
65,
|
|
3959
|
+
77,
|
|
3960
|
+
25,
|
|
3961
|
+
49,
|
|
3962
|
+
68,
|
|
3963
|
+
81
|
|
3964
|
+
];
|
|
3965
|
+
var EC_CODEWORDS_TABLE = [
|
|
3966
|
+
// L M Q H
|
|
3967
|
+
7,
|
|
3968
|
+
10,
|
|
3969
|
+
13,
|
|
3970
|
+
17,
|
|
3971
|
+
10,
|
|
3972
|
+
16,
|
|
3973
|
+
22,
|
|
3974
|
+
28,
|
|
3975
|
+
15,
|
|
3976
|
+
26,
|
|
3977
|
+
36,
|
|
3978
|
+
44,
|
|
3979
|
+
20,
|
|
3980
|
+
36,
|
|
3981
|
+
52,
|
|
3982
|
+
64,
|
|
3983
|
+
26,
|
|
3984
|
+
48,
|
|
3985
|
+
72,
|
|
3986
|
+
88,
|
|
3987
|
+
36,
|
|
3988
|
+
64,
|
|
3989
|
+
96,
|
|
3990
|
+
112,
|
|
3991
|
+
40,
|
|
3992
|
+
72,
|
|
3993
|
+
108,
|
|
3994
|
+
130,
|
|
3995
|
+
48,
|
|
3996
|
+
88,
|
|
3997
|
+
132,
|
|
3998
|
+
156,
|
|
3999
|
+
60,
|
|
4000
|
+
110,
|
|
4001
|
+
160,
|
|
4002
|
+
192,
|
|
4003
|
+
72,
|
|
4004
|
+
130,
|
|
4005
|
+
192,
|
|
4006
|
+
224,
|
|
4007
|
+
80,
|
|
4008
|
+
150,
|
|
4009
|
+
224,
|
|
4010
|
+
264,
|
|
4011
|
+
96,
|
|
4012
|
+
176,
|
|
4013
|
+
260,
|
|
4014
|
+
308,
|
|
4015
|
+
104,
|
|
4016
|
+
198,
|
|
4017
|
+
288,
|
|
4018
|
+
352,
|
|
4019
|
+
120,
|
|
4020
|
+
216,
|
|
4021
|
+
320,
|
|
4022
|
+
384,
|
|
4023
|
+
132,
|
|
4024
|
+
240,
|
|
4025
|
+
360,
|
|
4026
|
+
432,
|
|
4027
|
+
144,
|
|
4028
|
+
280,
|
|
4029
|
+
408,
|
|
4030
|
+
480,
|
|
4031
|
+
168,
|
|
4032
|
+
308,
|
|
4033
|
+
448,
|
|
4034
|
+
532,
|
|
4035
|
+
180,
|
|
4036
|
+
338,
|
|
4037
|
+
504,
|
|
4038
|
+
588,
|
|
4039
|
+
196,
|
|
4040
|
+
364,
|
|
4041
|
+
546,
|
|
4042
|
+
650,
|
|
4043
|
+
224,
|
|
4044
|
+
416,
|
|
4045
|
+
600,
|
|
4046
|
+
700,
|
|
4047
|
+
224,
|
|
4048
|
+
442,
|
|
4049
|
+
644,
|
|
4050
|
+
750,
|
|
4051
|
+
252,
|
|
4052
|
+
476,
|
|
4053
|
+
690,
|
|
4054
|
+
816,
|
|
4055
|
+
270,
|
|
4056
|
+
504,
|
|
4057
|
+
750,
|
|
4058
|
+
900,
|
|
4059
|
+
300,
|
|
4060
|
+
560,
|
|
4061
|
+
810,
|
|
4062
|
+
960,
|
|
4063
|
+
312,
|
|
4064
|
+
588,
|
|
4065
|
+
870,
|
|
4066
|
+
1050,
|
|
4067
|
+
336,
|
|
4068
|
+
644,
|
|
4069
|
+
952,
|
|
4070
|
+
1110,
|
|
4071
|
+
360,
|
|
4072
|
+
700,
|
|
4073
|
+
1020,
|
|
4074
|
+
1200,
|
|
4075
|
+
390,
|
|
4076
|
+
728,
|
|
4077
|
+
1050,
|
|
4078
|
+
1260,
|
|
4079
|
+
420,
|
|
4080
|
+
784,
|
|
4081
|
+
1140,
|
|
4082
|
+
1350,
|
|
4083
|
+
450,
|
|
4084
|
+
812,
|
|
4085
|
+
1200,
|
|
4086
|
+
1440,
|
|
4087
|
+
480,
|
|
4088
|
+
868,
|
|
4089
|
+
1290,
|
|
4090
|
+
1530,
|
|
4091
|
+
510,
|
|
4092
|
+
924,
|
|
4093
|
+
1350,
|
|
4094
|
+
1620,
|
|
4095
|
+
540,
|
|
4096
|
+
980,
|
|
4097
|
+
1440,
|
|
4098
|
+
1710,
|
|
4099
|
+
570,
|
|
4100
|
+
1036,
|
|
4101
|
+
1530,
|
|
4102
|
+
1800,
|
|
4103
|
+
570,
|
|
4104
|
+
1064,
|
|
4105
|
+
1590,
|
|
4106
|
+
1890,
|
|
4107
|
+
600,
|
|
4108
|
+
1120,
|
|
4109
|
+
1680,
|
|
4110
|
+
1980,
|
|
4111
|
+
630,
|
|
4112
|
+
1204,
|
|
4113
|
+
1770,
|
|
4114
|
+
2100,
|
|
4115
|
+
660,
|
|
4116
|
+
1260,
|
|
4117
|
+
1860,
|
|
4118
|
+
2220,
|
|
4119
|
+
720,
|
|
4120
|
+
1316,
|
|
4121
|
+
1950,
|
|
4122
|
+
2310,
|
|
4123
|
+
750,
|
|
4124
|
+
1372,
|
|
4125
|
+
2040,
|
|
4126
|
+
2430
|
|
4127
|
+
];
|
|
4128
|
+
exports2.getBlocksCount = function getBlocksCount(version, errorCorrectionLevel) {
|
|
4129
|
+
switch (errorCorrectionLevel) {
|
|
4130
|
+
case ECLevel.L:
|
|
4131
|
+
return EC_BLOCKS_TABLE[(version - 1) * 4 + 0];
|
|
4132
|
+
case ECLevel.M:
|
|
4133
|
+
return EC_BLOCKS_TABLE[(version - 1) * 4 + 1];
|
|
4134
|
+
case ECLevel.Q:
|
|
4135
|
+
return EC_BLOCKS_TABLE[(version - 1) * 4 + 2];
|
|
4136
|
+
case ECLevel.H:
|
|
4137
|
+
return EC_BLOCKS_TABLE[(version - 1) * 4 + 3];
|
|
4138
|
+
default:
|
|
4139
|
+
return void 0;
|
|
4140
|
+
}
|
|
4141
|
+
};
|
|
4142
|
+
exports2.getTotalCodewordsCount = function getTotalCodewordsCount(version, errorCorrectionLevel) {
|
|
4143
|
+
switch (errorCorrectionLevel) {
|
|
4144
|
+
case ECLevel.L:
|
|
4145
|
+
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0];
|
|
4146
|
+
case ECLevel.M:
|
|
4147
|
+
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1];
|
|
4148
|
+
case ECLevel.Q:
|
|
4149
|
+
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2];
|
|
4150
|
+
case ECLevel.H:
|
|
4151
|
+
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3];
|
|
4152
|
+
default:
|
|
4153
|
+
return void 0;
|
|
4154
|
+
}
|
|
4155
|
+
};
|
|
4156
|
+
}
|
|
4157
|
+
});
|
|
4158
|
+
|
|
4159
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js
|
|
4160
|
+
var require_galois_field = __commonJS({
|
|
4161
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js"(exports2) {
|
|
4162
|
+
"use strict";
|
|
4163
|
+
var EXP_TABLE = new Uint8Array(512);
|
|
4164
|
+
var LOG_TABLE = new Uint8Array(256);
|
|
4165
|
+
(function initTables() {
|
|
4166
|
+
let x2 = 1;
|
|
4167
|
+
for (let i2 = 0; i2 < 255; i2++) {
|
|
4168
|
+
EXP_TABLE[i2] = x2;
|
|
4169
|
+
LOG_TABLE[x2] = i2;
|
|
4170
|
+
x2 <<= 1;
|
|
4171
|
+
if (x2 & 256) {
|
|
4172
|
+
x2 ^= 285;
|
|
4173
|
+
}
|
|
4174
|
+
}
|
|
4175
|
+
for (let i2 = 255; i2 < 512; i2++) {
|
|
4176
|
+
EXP_TABLE[i2] = EXP_TABLE[i2 - 255];
|
|
4177
|
+
}
|
|
4178
|
+
})();
|
|
4179
|
+
exports2.log = function log(n) {
|
|
4180
|
+
if (n < 1) throw new Error("log(" + n + ")");
|
|
4181
|
+
return LOG_TABLE[n];
|
|
4182
|
+
};
|
|
4183
|
+
exports2.exp = function exp(n) {
|
|
4184
|
+
return EXP_TABLE[n];
|
|
4185
|
+
};
|
|
4186
|
+
exports2.mul = function mul(x2, y2) {
|
|
4187
|
+
if (x2 === 0 || y2 === 0) return 0;
|
|
4188
|
+
return EXP_TABLE[LOG_TABLE[x2] + LOG_TABLE[y2]];
|
|
4189
|
+
};
|
|
4190
|
+
}
|
|
4191
|
+
});
|
|
4192
|
+
|
|
4193
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js
|
|
4194
|
+
var require_polynomial = __commonJS({
|
|
4195
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js"(exports2) {
|
|
4196
|
+
"use strict";
|
|
4197
|
+
var GF = require_galois_field();
|
|
4198
|
+
exports2.mul = function mul(p1, p2) {
|
|
4199
|
+
const coeff = new Uint8Array(p1.length + p2.length - 1);
|
|
4200
|
+
for (let i2 = 0; i2 < p1.length; i2++) {
|
|
4201
|
+
for (let j2 = 0; j2 < p2.length; j2++) {
|
|
4202
|
+
coeff[i2 + j2] ^= GF.mul(p1[i2], p2[j2]);
|
|
4203
|
+
}
|
|
4204
|
+
}
|
|
4205
|
+
return coeff;
|
|
4206
|
+
};
|
|
4207
|
+
exports2.mod = function mod(divident, divisor) {
|
|
4208
|
+
let result = new Uint8Array(divident);
|
|
4209
|
+
while (result.length - divisor.length >= 0) {
|
|
4210
|
+
const coeff = result[0];
|
|
4211
|
+
for (let i2 = 0; i2 < divisor.length; i2++) {
|
|
4212
|
+
result[i2] ^= GF.mul(divisor[i2], coeff);
|
|
4213
|
+
}
|
|
4214
|
+
let offset = 0;
|
|
4215
|
+
while (offset < result.length && result[offset] === 0) offset++;
|
|
4216
|
+
result = result.slice(offset);
|
|
4217
|
+
}
|
|
4218
|
+
return result;
|
|
4219
|
+
};
|
|
4220
|
+
exports2.generateECPolynomial = function generateECPolynomial(degree) {
|
|
4221
|
+
let poly = new Uint8Array([1]);
|
|
4222
|
+
for (let i2 = 0; i2 < degree; i2++) {
|
|
4223
|
+
poly = exports2.mul(poly, new Uint8Array([1, GF.exp(i2)]));
|
|
4224
|
+
}
|
|
4225
|
+
return poly;
|
|
4226
|
+
};
|
|
4227
|
+
}
|
|
4228
|
+
});
|
|
4229
|
+
|
|
4230
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js
|
|
4231
|
+
var require_reed_solomon_encoder = __commonJS({
|
|
4232
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js"(exports2, module2) {
|
|
4233
|
+
"use strict";
|
|
4234
|
+
var Polynomial = require_polynomial();
|
|
4235
|
+
function ReedSolomonEncoder(degree) {
|
|
4236
|
+
this.genPoly = void 0;
|
|
4237
|
+
this.degree = degree;
|
|
4238
|
+
if (this.degree) this.initialize(this.degree);
|
|
4239
|
+
}
|
|
4240
|
+
ReedSolomonEncoder.prototype.initialize = function initialize(degree) {
|
|
4241
|
+
this.degree = degree;
|
|
4242
|
+
this.genPoly = Polynomial.generateECPolynomial(this.degree);
|
|
4243
|
+
};
|
|
4244
|
+
ReedSolomonEncoder.prototype.encode = function encode(data) {
|
|
4245
|
+
if (!this.genPoly) {
|
|
4246
|
+
throw new Error("Encoder not initialized");
|
|
4247
|
+
}
|
|
4248
|
+
const paddedData = new Uint8Array(data.length + this.degree);
|
|
4249
|
+
paddedData.set(data);
|
|
4250
|
+
const remainder = Polynomial.mod(paddedData, this.genPoly);
|
|
4251
|
+
const start = this.degree - remainder.length;
|
|
4252
|
+
if (start > 0) {
|
|
4253
|
+
const buff = new Uint8Array(this.degree);
|
|
4254
|
+
buff.set(remainder, start);
|
|
4255
|
+
return buff;
|
|
4256
|
+
}
|
|
4257
|
+
return remainder;
|
|
4258
|
+
};
|
|
4259
|
+
module2.exports = ReedSolomonEncoder;
|
|
4260
|
+
}
|
|
4261
|
+
});
|
|
4262
|
+
|
|
4263
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js
|
|
4264
|
+
var require_version_check = __commonJS({
|
|
4265
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js"(exports2) {
|
|
4266
|
+
"use strict";
|
|
4267
|
+
exports2.isValid = function isValid2(version) {
|
|
4268
|
+
return !isNaN(version) && version >= 1 && version <= 40;
|
|
4269
|
+
};
|
|
4270
|
+
}
|
|
4271
|
+
});
|
|
4272
|
+
|
|
4273
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js
|
|
4274
|
+
var require_regex = __commonJS({
|
|
4275
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js"(exports2) {
|
|
4276
|
+
"use strict";
|
|
4277
|
+
var numeric = "[0-9]+";
|
|
4278
|
+
var alphanumeric = "[A-Z $%*+\\-./:]+";
|
|
4279
|
+
var kanji = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
|
|
4280
|
+
kanji = kanji.replace(/u/g, "\\u");
|
|
4281
|
+
var byte = "(?:(?![A-Z0-9 $%*+\\-./:]|" + kanji + ")(?:.|[\r\n]))+";
|
|
4282
|
+
exports2.KANJI = new RegExp(kanji, "g");
|
|
4283
|
+
exports2.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
|
|
4284
|
+
exports2.BYTE = new RegExp(byte, "g");
|
|
4285
|
+
exports2.NUMERIC = new RegExp(numeric, "g");
|
|
4286
|
+
exports2.ALPHANUMERIC = new RegExp(alphanumeric, "g");
|
|
4287
|
+
var TEST_KANJI = new RegExp("^" + kanji + "$");
|
|
4288
|
+
var TEST_NUMERIC = new RegExp("^" + numeric + "$");
|
|
4289
|
+
var TEST_ALPHANUMERIC = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
|
|
4290
|
+
exports2.testKanji = function testKanji(str) {
|
|
4291
|
+
return TEST_KANJI.test(str);
|
|
4292
|
+
};
|
|
4293
|
+
exports2.testNumeric = function testNumeric(str) {
|
|
4294
|
+
return TEST_NUMERIC.test(str);
|
|
4295
|
+
};
|
|
4296
|
+
exports2.testAlphanumeric = function testAlphanumeric(str) {
|
|
4297
|
+
return TEST_ALPHANUMERIC.test(str);
|
|
4298
|
+
};
|
|
4299
|
+
}
|
|
4300
|
+
});
|
|
4301
|
+
|
|
4302
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js
|
|
4303
|
+
var require_mode = __commonJS({
|
|
4304
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"(exports2) {
|
|
4305
|
+
"use strict";
|
|
4306
|
+
var VersionCheck = require_version_check();
|
|
4307
|
+
var Regex = require_regex();
|
|
4308
|
+
exports2.NUMERIC = {
|
|
4309
|
+
id: "Numeric",
|
|
4310
|
+
bit: 1 << 0,
|
|
4311
|
+
ccBits: [10, 12, 14]
|
|
4312
|
+
};
|
|
4313
|
+
exports2.ALPHANUMERIC = {
|
|
4314
|
+
id: "Alphanumeric",
|
|
4315
|
+
bit: 1 << 1,
|
|
4316
|
+
ccBits: [9, 11, 13]
|
|
4317
|
+
};
|
|
4318
|
+
exports2.BYTE = {
|
|
4319
|
+
id: "Byte",
|
|
4320
|
+
bit: 1 << 2,
|
|
4321
|
+
ccBits: [8, 16, 16]
|
|
4322
|
+
};
|
|
4323
|
+
exports2.KANJI = {
|
|
4324
|
+
id: "Kanji",
|
|
4325
|
+
bit: 1 << 3,
|
|
4326
|
+
ccBits: [8, 10, 12]
|
|
4327
|
+
};
|
|
4328
|
+
exports2.MIXED = {
|
|
4329
|
+
bit: -1
|
|
4330
|
+
};
|
|
4331
|
+
exports2.getCharCountIndicator = function getCharCountIndicator(mode, version) {
|
|
4332
|
+
if (!mode.ccBits) throw new Error("Invalid mode: " + mode);
|
|
4333
|
+
if (!VersionCheck.isValid(version)) {
|
|
4334
|
+
throw new Error("Invalid version: " + version);
|
|
4335
|
+
}
|
|
4336
|
+
if (version >= 1 && version < 10) return mode.ccBits[0];
|
|
4337
|
+
else if (version < 27) return mode.ccBits[1];
|
|
4338
|
+
return mode.ccBits[2];
|
|
4339
|
+
};
|
|
4340
|
+
exports2.getBestModeForData = function getBestModeForData(dataStr) {
|
|
4341
|
+
if (Regex.testNumeric(dataStr)) return exports2.NUMERIC;
|
|
4342
|
+
else if (Regex.testAlphanumeric(dataStr)) return exports2.ALPHANUMERIC;
|
|
4343
|
+
else if (Regex.testKanji(dataStr)) return exports2.KANJI;
|
|
4344
|
+
else return exports2.BYTE;
|
|
4345
|
+
};
|
|
4346
|
+
exports2.toString = function toString(mode) {
|
|
4347
|
+
if (mode && mode.id) return mode.id;
|
|
4348
|
+
throw new Error("Invalid mode");
|
|
4349
|
+
};
|
|
4350
|
+
exports2.isValid = function isValid2(mode) {
|
|
4351
|
+
return mode && mode.bit && mode.ccBits;
|
|
4352
|
+
};
|
|
4353
|
+
function fromString(string) {
|
|
4354
|
+
if (typeof string !== "string") {
|
|
4355
|
+
throw new Error("Param is not a string");
|
|
4356
|
+
}
|
|
4357
|
+
const lcStr = string.toLowerCase();
|
|
4358
|
+
switch (lcStr) {
|
|
4359
|
+
case "numeric":
|
|
4360
|
+
return exports2.NUMERIC;
|
|
4361
|
+
case "alphanumeric":
|
|
4362
|
+
return exports2.ALPHANUMERIC;
|
|
4363
|
+
case "kanji":
|
|
4364
|
+
return exports2.KANJI;
|
|
4365
|
+
case "byte":
|
|
4366
|
+
return exports2.BYTE;
|
|
4367
|
+
default:
|
|
4368
|
+
throw new Error("Unknown mode: " + string);
|
|
4369
|
+
}
|
|
4370
|
+
}
|
|
4371
|
+
exports2.from = function from(value, defaultValue) {
|
|
4372
|
+
if (exports2.isValid(value)) {
|
|
4373
|
+
return value;
|
|
4374
|
+
}
|
|
4375
|
+
try {
|
|
4376
|
+
return fromString(value);
|
|
4377
|
+
} catch (e) {
|
|
4378
|
+
return defaultValue;
|
|
4379
|
+
}
|
|
4380
|
+
};
|
|
4381
|
+
}
|
|
4382
|
+
});
|
|
4383
|
+
|
|
4384
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js
|
|
4385
|
+
var require_version = __commonJS({
|
|
4386
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js"(exports2) {
|
|
4387
|
+
"use strict";
|
|
4388
|
+
var Utils = require_utils();
|
|
4389
|
+
var ECCode = require_error_correction_code();
|
|
4390
|
+
var ECLevel = require_error_correction_level();
|
|
4391
|
+
var Mode = require_mode();
|
|
4392
|
+
var VersionCheck = require_version_check();
|
|
4393
|
+
var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
|
|
4394
|
+
var G18_BCH = Utils.getBCHDigit(G18);
|
|
4395
|
+
function getBestVersionForDataLength(mode, length, errorCorrectionLevel) {
|
|
4396
|
+
for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
|
|
4397
|
+
if (length <= exports2.getCapacity(currentVersion, errorCorrectionLevel, mode)) {
|
|
4398
|
+
return currentVersion;
|
|
4399
|
+
}
|
|
4400
|
+
}
|
|
4401
|
+
return void 0;
|
|
4402
|
+
}
|
|
4403
|
+
function getReservedBitsCount(mode, version) {
|
|
4404
|
+
return Mode.getCharCountIndicator(mode, version) + 4;
|
|
4405
|
+
}
|
|
4406
|
+
function getTotalBitsFromDataArray(segments, version) {
|
|
4407
|
+
let totalBits = 0;
|
|
4408
|
+
segments.forEach(function(data) {
|
|
4409
|
+
const reservedBits = getReservedBitsCount(data.mode, version);
|
|
4410
|
+
totalBits += reservedBits + data.getBitsLength();
|
|
4411
|
+
});
|
|
4412
|
+
return totalBits;
|
|
4413
|
+
}
|
|
4414
|
+
function getBestVersionForMixedData(segments, errorCorrectionLevel) {
|
|
4415
|
+
for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
|
|
4416
|
+
const length = getTotalBitsFromDataArray(segments, currentVersion);
|
|
4417
|
+
if (length <= exports2.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {
|
|
4418
|
+
return currentVersion;
|
|
4419
|
+
}
|
|
4420
|
+
}
|
|
4421
|
+
return void 0;
|
|
4422
|
+
}
|
|
4423
|
+
exports2.from = function from(value, defaultValue) {
|
|
4424
|
+
if (VersionCheck.isValid(value)) {
|
|
4425
|
+
return parseInt(value, 10);
|
|
4426
|
+
}
|
|
4427
|
+
return defaultValue;
|
|
4428
|
+
};
|
|
4429
|
+
exports2.getCapacity = function getCapacity(version, errorCorrectionLevel, mode) {
|
|
4430
|
+
if (!VersionCheck.isValid(version)) {
|
|
4431
|
+
throw new Error("Invalid QR Code version");
|
|
4432
|
+
}
|
|
4433
|
+
if (typeof mode === "undefined") mode = Mode.BYTE;
|
|
4434
|
+
const totalCodewords = Utils.getSymbolTotalCodewords(version);
|
|
4435
|
+
const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
|
|
4436
|
+
const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
|
|
4437
|
+
if (mode === Mode.MIXED) return dataTotalCodewordsBits;
|
|
4438
|
+
const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version);
|
|
4439
|
+
switch (mode) {
|
|
4440
|
+
case Mode.NUMERIC:
|
|
4441
|
+
return Math.floor(usableBits / 10 * 3);
|
|
4442
|
+
case Mode.ALPHANUMERIC:
|
|
4443
|
+
return Math.floor(usableBits / 11 * 2);
|
|
4444
|
+
case Mode.KANJI:
|
|
4445
|
+
return Math.floor(usableBits / 13);
|
|
4446
|
+
case Mode.BYTE:
|
|
4447
|
+
default:
|
|
4448
|
+
return Math.floor(usableBits / 8);
|
|
4449
|
+
}
|
|
4450
|
+
};
|
|
4451
|
+
exports2.getBestVersionForData = function getBestVersionForData(data, errorCorrectionLevel) {
|
|
4452
|
+
let seg;
|
|
4453
|
+
const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M);
|
|
4454
|
+
if (Array.isArray(data)) {
|
|
4455
|
+
if (data.length > 1) {
|
|
4456
|
+
return getBestVersionForMixedData(data, ecl);
|
|
4457
|
+
}
|
|
4458
|
+
if (data.length === 0) {
|
|
4459
|
+
return 1;
|
|
4460
|
+
}
|
|
4461
|
+
seg = data[0];
|
|
4462
|
+
} else {
|
|
4463
|
+
seg = data;
|
|
4464
|
+
}
|
|
4465
|
+
return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl);
|
|
4466
|
+
};
|
|
4467
|
+
exports2.getEncodedBits = function getEncodedBits(version) {
|
|
4468
|
+
if (!VersionCheck.isValid(version) || version < 7) {
|
|
4469
|
+
throw new Error("Invalid QR Code version");
|
|
4470
|
+
}
|
|
4471
|
+
let d = version << 12;
|
|
4472
|
+
while (Utils.getBCHDigit(d) - G18_BCH >= 0) {
|
|
4473
|
+
d ^= G18 << Utils.getBCHDigit(d) - G18_BCH;
|
|
4474
|
+
}
|
|
4475
|
+
return version << 12 | d;
|
|
4476
|
+
};
|
|
4477
|
+
}
|
|
4478
|
+
});
|
|
4479
|
+
|
|
4480
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js
|
|
4481
|
+
var require_format_info = __commonJS({
|
|
4482
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js"(exports2) {
|
|
4483
|
+
"use strict";
|
|
4484
|
+
var Utils = require_utils();
|
|
4485
|
+
var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
|
|
4486
|
+
var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
|
|
4487
|
+
var G15_BCH = Utils.getBCHDigit(G15);
|
|
4488
|
+
exports2.getEncodedBits = function getEncodedBits(errorCorrectionLevel, mask) {
|
|
4489
|
+
const data = errorCorrectionLevel.bit << 3 | mask;
|
|
4490
|
+
let d = data << 10;
|
|
4491
|
+
while (Utils.getBCHDigit(d) - G15_BCH >= 0) {
|
|
4492
|
+
d ^= G15 << Utils.getBCHDigit(d) - G15_BCH;
|
|
4493
|
+
}
|
|
4494
|
+
return (data << 10 | d) ^ G15_MASK;
|
|
4495
|
+
};
|
|
4496
|
+
}
|
|
4497
|
+
});
|
|
4498
|
+
|
|
4499
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js
|
|
4500
|
+
var require_numeric_data = __commonJS({
|
|
4501
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js"(exports2, module2) {
|
|
4502
|
+
"use strict";
|
|
4503
|
+
var Mode = require_mode();
|
|
4504
|
+
function NumericData(data) {
|
|
4505
|
+
this.mode = Mode.NUMERIC;
|
|
4506
|
+
this.data = data.toString();
|
|
4507
|
+
}
|
|
4508
|
+
NumericData.getBitsLength = function getBitsLength(length) {
|
|
4509
|
+
return 10 * Math.floor(length / 3) + (length % 3 ? length % 3 * 3 + 1 : 0);
|
|
4510
|
+
};
|
|
4511
|
+
NumericData.prototype.getLength = function getLength() {
|
|
4512
|
+
return this.data.length;
|
|
4513
|
+
};
|
|
4514
|
+
NumericData.prototype.getBitsLength = function getBitsLength() {
|
|
4515
|
+
return NumericData.getBitsLength(this.data.length);
|
|
4516
|
+
};
|
|
4517
|
+
NumericData.prototype.write = function write(bitBuffer) {
|
|
4518
|
+
let i2, group, value;
|
|
4519
|
+
for (i2 = 0; i2 + 3 <= this.data.length; i2 += 3) {
|
|
4520
|
+
group = this.data.substr(i2, 3);
|
|
4521
|
+
value = parseInt(group, 10);
|
|
4522
|
+
bitBuffer.put(value, 10);
|
|
4523
|
+
}
|
|
4524
|
+
const remainingNum = this.data.length - i2;
|
|
4525
|
+
if (remainingNum > 0) {
|
|
4526
|
+
group = this.data.substr(i2);
|
|
4527
|
+
value = parseInt(group, 10);
|
|
4528
|
+
bitBuffer.put(value, remainingNum * 3 + 1);
|
|
4529
|
+
}
|
|
4530
|
+
};
|
|
4531
|
+
module2.exports = NumericData;
|
|
4532
|
+
}
|
|
4533
|
+
});
|
|
4534
|
+
|
|
4535
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js
|
|
4536
|
+
var require_alphanumeric_data = __commonJS({
|
|
4537
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js"(exports2, module2) {
|
|
4538
|
+
"use strict";
|
|
4539
|
+
var Mode = require_mode();
|
|
4540
|
+
var ALPHA_NUM_CHARS = [
|
|
4541
|
+
"0",
|
|
4542
|
+
"1",
|
|
4543
|
+
"2",
|
|
4544
|
+
"3",
|
|
4545
|
+
"4",
|
|
4546
|
+
"5",
|
|
4547
|
+
"6",
|
|
4548
|
+
"7",
|
|
4549
|
+
"8",
|
|
4550
|
+
"9",
|
|
4551
|
+
"A",
|
|
4552
|
+
"B",
|
|
4553
|
+
"C",
|
|
4554
|
+
"D",
|
|
4555
|
+
"E",
|
|
4556
|
+
"F",
|
|
4557
|
+
"G",
|
|
4558
|
+
"H",
|
|
4559
|
+
"I",
|
|
4560
|
+
"J",
|
|
4561
|
+
"K",
|
|
4562
|
+
"L",
|
|
4563
|
+
"M",
|
|
4564
|
+
"N",
|
|
4565
|
+
"O",
|
|
4566
|
+
"P",
|
|
4567
|
+
"Q",
|
|
4568
|
+
"R",
|
|
4569
|
+
"S",
|
|
4570
|
+
"T",
|
|
4571
|
+
"U",
|
|
4572
|
+
"V",
|
|
4573
|
+
"W",
|
|
4574
|
+
"X",
|
|
4575
|
+
"Y",
|
|
4576
|
+
"Z",
|
|
4577
|
+
" ",
|
|
4578
|
+
"$",
|
|
4579
|
+
"%",
|
|
4580
|
+
"*",
|
|
4581
|
+
"+",
|
|
4582
|
+
"-",
|
|
4583
|
+
".",
|
|
4584
|
+
"/",
|
|
4585
|
+
":"
|
|
4586
|
+
];
|
|
4587
|
+
function AlphanumericData(data) {
|
|
4588
|
+
this.mode = Mode.ALPHANUMERIC;
|
|
4589
|
+
this.data = data;
|
|
4590
|
+
}
|
|
4591
|
+
AlphanumericData.getBitsLength = function getBitsLength(length) {
|
|
4592
|
+
return 11 * Math.floor(length / 2) + 6 * (length % 2);
|
|
4593
|
+
};
|
|
4594
|
+
AlphanumericData.prototype.getLength = function getLength() {
|
|
4595
|
+
return this.data.length;
|
|
4596
|
+
};
|
|
4597
|
+
AlphanumericData.prototype.getBitsLength = function getBitsLength() {
|
|
4598
|
+
return AlphanumericData.getBitsLength(this.data.length);
|
|
4599
|
+
};
|
|
4600
|
+
AlphanumericData.prototype.write = function write(bitBuffer) {
|
|
4601
|
+
let i2;
|
|
4602
|
+
for (i2 = 0; i2 + 2 <= this.data.length; i2 += 2) {
|
|
4603
|
+
let value = ALPHA_NUM_CHARS.indexOf(this.data[i2]) * 45;
|
|
4604
|
+
value += ALPHA_NUM_CHARS.indexOf(this.data[i2 + 1]);
|
|
4605
|
+
bitBuffer.put(value, 11);
|
|
4606
|
+
}
|
|
4607
|
+
if (this.data.length % 2) {
|
|
4608
|
+
bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i2]), 6);
|
|
4609
|
+
}
|
|
4610
|
+
};
|
|
4611
|
+
module2.exports = AlphanumericData;
|
|
4612
|
+
}
|
|
4613
|
+
});
|
|
4614
|
+
|
|
4615
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js
|
|
4616
|
+
var require_byte_data = __commonJS({
|
|
4617
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js"(exports2, module2) {
|
|
4618
|
+
"use strict";
|
|
4619
|
+
var Mode = require_mode();
|
|
4620
|
+
function ByteData(data) {
|
|
4621
|
+
this.mode = Mode.BYTE;
|
|
4622
|
+
if (typeof data === "string") {
|
|
4623
|
+
this.data = new TextEncoder().encode(data);
|
|
4624
|
+
} else {
|
|
4625
|
+
this.data = new Uint8Array(data);
|
|
4626
|
+
}
|
|
4627
|
+
}
|
|
4628
|
+
ByteData.getBitsLength = function getBitsLength(length) {
|
|
4629
|
+
return length * 8;
|
|
4630
|
+
};
|
|
4631
|
+
ByteData.prototype.getLength = function getLength() {
|
|
4632
|
+
return this.data.length;
|
|
4633
|
+
};
|
|
4634
|
+
ByteData.prototype.getBitsLength = function getBitsLength() {
|
|
4635
|
+
return ByteData.getBitsLength(this.data.length);
|
|
4636
|
+
};
|
|
4637
|
+
ByteData.prototype.write = function(bitBuffer) {
|
|
4638
|
+
for (let i2 = 0, l = this.data.length; i2 < l; i2++) {
|
|
4639
|
+
bitBuffer.put(this.data[i2], 8);
|
|
4640
|
+
}
|
|
4641
|
+
};
|
|
4642
|
+
module2.exports = ByteData;
|
|
4643
|
+
}
|
|
4644
|
+
});
|
|
4645
|
+
|
|
4646
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js
|
|
4647
|
+
var require_kanji_data = __commonJS({
|
|
4648
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js"(exports2, module2) {
|
|
4649
|
+
"use strict";
|
|
4650
|
+
var Mode = require_mode();
|
|
4651
|
+
var Utils = require_utils();
|
|
4652
|
+
function KanjiData(data) {
|
|
4653
|
+
this.mode = Mode.KANJI;
|
|
4654
|
+
this.data = data;
|
|
4655
|
+
}
|
|
4656
|
+
KanjiData.getBitsLength = function getBitsLength(length) {
|
|
4657
|
+
return length * 13;
|
|
4658
|
+
};
|
|
4659
|
+
KanjiData.prototype.getLength = function getLength() {
|
|
4660
|
+
return this.data.length;
|
|
4661
|
+
};
|
|
4662
|
+
KanjiData.prototype.getBitsLength = function getBitsLength() {
|
|
4663
|
+
return KanjiData.getBitsLength(this.data.length);
|
|
4664
|
+
};
|
|
4665
|
+
KanjiData.prototype.write = function(bitBuffer) {
|
|
4666
|
+
let i2;
|
|
4667
|
+
for (i2 = 0; i2 < this.data.length; i2++) {
|
|
4668
|
+
let value = Utils.toSJIS(this.data[i2]);
|
|
4669
|
+
if (value >= 33088 && value <= 40956) {
|
|
4670
|
+
value -= 33088;
|
|
4671
|
+
} else if (value >= 57408 && value <= 60351) {
|
|
4672
|
+
value -= 49472;
|
|
4673
|
+
} else {
|
|
4674
|
+
throw new Error(
|
|
4675
|
+
"Invalid SJIS character: " + this.data[i2] + "\nMake sure your charset is UTF-8"
|
|
4676
|
+
);
|
|
4677
|
+
}
|
|
4678
|
+
value = (value >>> 8 & 255) * 192 + (value & 255);
|
|
4679
|
+
bitBuffer.put(value, 13);
|
|
4680
|
+
}
|
|
4681
|
+
};
|
|
4682
|
+
module2.exports = KanjiData;
|
|
4683
|
+
}
|
|
4684
|
+
});
|
|
4685
|
+
|
|
4686
|
+
// ../../node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js
|
|
4687
|
+
var require_dijkstra = __commonJS({
|
|
4688
|
+
"../../node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js"(exports2, module2) {
|
|
4689
|
+
"use strict";
|
|
4690
|
+
var dijkstra = {
|
|
4691
|
+
single_source_shortest_paths: function(graph, s, d) {
|
|
4692
|
+
var predecessors = {};
|
|
4693
|
+
var costs = {};
|
|
4694
|
+
costs[s] = 0;
|
|
4695
|
+
var open = dijkstra.PriorityQueue.make();
|
|
4696
|
+
open.push(s, 0);
|
|
4697
|
+
var closest, u, v, cost_of_s_to_u, adjacent_nodes, cost_of_e, cost_of_s_to_u_plus_cost_of_e, cost_of_s_to_v, first_visit;
|
|
4698
|
+
while (!open.empty()) {
|
|
4699
|
+
closest = open.pop();
|
|
4700
|
+
u = closest.value;
|
|
4701
|
+
cost_of_s_to_u = closest.cost;
|
|
4702
|
+
adjacent_nodes = graph[u] || {};
|
|
4703
|
+
for (v in adjacent_nodes) {
|
|
4704
|
+
if (adjacent_nodes.hasOwnProperty(v)) {
|
|
4705
|
+
cost_of_e = adjacent_nodes[v];
|
|
4706
|
+
cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
|
|
4707
|
+
cost_of_s_to_v = costs[v];
|
|
4708
|
+
first_visit = typeof costs[v] === "undefined";
|
|
4709
|
+
if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
|
|
4710
|
+
costs[v] = cost_of_s_to_u_plus_cost_of_e;
|
|
4711
|
+
open.push(v, cost_of_s_to_u_plus_cost_of_e);
|
|
4712
|
+
predecessors[v] = u;
|
|
4713
|
+
}
|
|
4714
|
+
}
|
|
4715
|
+
}
|
|
4716
|
+
}
|
|
4717
|
+
if (typeof d !== "undefined" && typeof costs[d] === "undefined") {
|
|
4718
|
+
var msg = ["Could not find a path from ", s, " to ", d, "."].join("");
|
|
4719
|
+
throw new Error(msg);
|
|
4720
|
+
}
|
|
4721
|
+
return predecessors;
|
|
4722
|
+
},
|
|
4723
|
+
extract_shortest_path_from_predecessor_list: function(predecessors, d) {
|
|
4724
|
+
var nodes = [];
|
|
4725
|
+
var u = d;
|
|
4726
|
+
var predecessor;
|
|
4727
|
+
while (u) {
|
|
4728
|
+
nodes.push(u);
|
|
4729
|
+
predecessor = predecessors[u];
|
|
4730
|
+
u = predecessors[u];
|
|
4731
|
+
}
|
|
4732
|
+
nodes.reverse();
|
|
4733
|
+
return nodes;
|
|
4734
|
+
},
|
|
4735
|
+
find_path: function(graph, s, d) {
|
|
4736
|
+
var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
|
|
4737
|
+
return dijkstra.extract_shortest_path_from_predecessor_list(
|
|
4738
|
+
predecessors,
|
|
4739
|
+
d
|
|
4740
|
+
);
|
|
4741
|
+
},
|
|
4742
|
+
/**
|
|
4743
|
+
* A very naive priority queue implementation.
|
|
4744
|
+
*/
|
|
4745
|
+
PriorityQueue: {
|
|
4746
|
+
make: function(opts) {
|
|
4747
|
+
var T2 = dijkstra.PriorityQueue, t2 = {}, key;
|
|
4748
|
+
opts = opts || {};
|
|
4749
|
+
for (key in T2) {
|
|
4750
|
+
if (T2.hasOwnProperty(key)) {
|
|
4751
|
+
t2[key] = T2[key];
|
|
4752
|
+
}
|
|
4753
|
+
}
|
|
4754
|
+
t2.queue = [];
|
|
4755
|
+
t2.sorter = opts.sorter || T2.default_sorter;
|
|
4756
|
+
return t2;
|
|
4757
|
+
},
|
|
4758
|
+
default_sorter: function(a, b2) {
|
|
4759
|
+
return a.cost - b2.cost;
|
|
4760
|
+
},
|
|
4761
|
+
/**
|
|
4762
|
+
* Add a new item to the queue and ensure the highest priority element
|
|
4763
|
+
* is at the front of the queue.
|
|
4764
|
+
*/
|
|
4765
|
+
push: function(value, cost) {
|
|
4766
|
+
var item = { value, cost };
|
|
4767
|
+
this.queue.push(item);
|
|
4768
|
+
this.queue.sort(this.sorter);
|
|
4769
|
+
},
|
|
4770
|
+
/**
|
|
4771
|
+
* Return the highest priority element in the queue.
|
|
4772
|
+
*/
|
|
4773
|
+
pop: function() {
|
|
4774
|
+
return this.queue.shift();
|
|
4775
|
+
},
|
|
4776
|
+
empty: function() {
|
|
4777
|
+
return this.queue.length === 0;
|
|
4778
|
+
}
|
|
4779
|
+
}
|
|
4780
|
+
};
|
|
4781
|
+
if (typeof module2 !== "undefined") {
|
|
4782
|
+
module2.exports = dijkstra;
|
|
4783
|
+
}
|
|
4784
|
+
}
|
|
4785
|
+
});
|
|
4786
|
+
|
|
4787
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js
|
|
4788
|
+
var require_segments = __commonJS({
|
|
4789
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js"(exports2) {
|
|
4790
|
+
"use strict";
|
|
4791
|
+
var Mode = require_mode();
|
|
4792
|
+
var NumericData = require_numeric_data();
|
|
4793
|
+
var AlphanumericData = require_alphanumeric_data();
|
|
4794
|
+
var ByteData = require_byte_data();
|
|
4795
|
+
var KanjiData = require_kanji_data();
|
|
4796
|
+
var Regex = require_regex();
|
|
4797
|
+
var Utils = require_utils();
|
|
4798
|
+
var dijkstra = require_dijkstra();
|
|
4799
|
+
function getStringByteLength(str) {
|
|
4800
|
+
return unescape(encodeURIComponent(str)).length;
|
|
4801
|
+
}
|
|
4802
|
+
function getSegments(regex, mode, str) {
|
|
4803
|
+
const segments = [];
|
|
4804
|
+
let result;
|
|
4805
|
+
while ((result = regex.exec(str)) !== null) {
|
|
4806
|
+
segments.push({
|
|
4807
|
+
data: result[0],
|
|
4808
|
+
index: result.index,
|
|
4809
|
+
mode,
|
|
4810
|
+
length: result[0].length
|
|
4811
|
+
});
|
|
4812
|
+
}
|
|
4813
|
+
return segments;
|
|
4814
|
+
}
|
|
4815
|
+
function getSegmentsFromString(dataStr) {
|
|
4816
|
+
const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr);
|
|
4817
|
+
const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr);
|
|
4818
|
+
let byteSegs;
|
|
4819
|
+
let kanjiSegs;
|
|
4820
|
+
if (Utils.isKanjiModeEnabled()) {
|
|
4821
|
+
byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr);
|
|
4822
|
+
kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr);
|
|
4823
|
+
} else {
|
|
4824
|
+
byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr);
|
|
4825
|
+
kanjiSegs = [];
|
|
4826
|
+
}
|
|
4827
|
+
const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs);
|
|
4828
|
+
return segs.sort(function(s1, s2) {
|
|
4829
|
+
return s1.index - s2.index;
|
|
4830
|
+
}).map(function(obj) {
|
|
4831
|
+
return {
|
|
4832
|
+
data: obj.data,
|
|
4833
|
+
mode: obj.mode,
|
|
4834
|
+
length: obj.length
|
|
4835
|
+
};
|
|
4836
|
+
});
|
|
4837
|
+
}
|
|
4838
|
+
function getSegmentBitsLength(length, mode) {
|
|
4839
|
+
switch (mode) {
|
|
4840
|
+
case Mode.NUMERIC:
|
|
4841
|
+
return NumericData.getBitsLength(length);
|
|
4842
|
+
case Mode.ALPHANUMERIC:
|
|
4843
|
+
return AlphanumericData.getBitsLength(length);
|
|
4844
|
+
case Mode.KANJI:
|
|
4845
|
+
return KanjiData.getBitsLength(length);
|
|
4846
|
+
case Mode.BYTE:
|
|
4847
|
+
return ByteData.getBitsLength(length);
|
|
4848
|
+
}
|
|
4849
|
+
}
|
|
4850
|
+
function mergeSegments(segs) {
|
|
4851
|
+
return segs.reduce(function(acc, curr) {
|
|
4852
|
+
const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;
|
|
4853
|
+
if (prevSeg && prevSeg.mode === curr.mode) {
|
|
4854
|
+
acc[acc.length - 1].data += curr.data;
|
|
4855
|
+
return acc;
|
|
4856
|
+
}
|
|
4857
|
+
acc.push(curr);
|
|
4858
|
+
return acc;
|
|
4859
|
+
}, []);
|
|
4860
|
+
}
|
|
4861
|
+
function buildNodes(segs) {
|
|
4862
|
+
const nodes = [];
|
|
4863
|
+
for (let i2 = 0; i2 < segs.length; i2++) {
|
|
4864
|
+
const seg = segs[i2];
|
|
4865
|
+
switch (seg.mode) {
|
|
4866
|
+
case Mode.NUMERIC:
|
|
4867
|
+
nodes.push([
|
|
4868
|
+
seg,
|
|
4869
|
+
{ data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },
|
|
4870
|
+
{ data: seg.data, mode: Mode.BYTE, length: seg.length }
|
|
4871
|
+
]);
|
|
4872
|
+
break;
|
|
4873
|
+
case Mode.ALPHANUMERIC:
|
|
4874
|
+
nodes.push([
|
|
4875
|
+
seg,
|
|
4876
|
+
{ data: seg.data, mode: Mode.BYTE, length: seg.length }
|
|
4877
|
+
]);
|
|
4878
|
+
break;
|
|
4879
|
+
case Mode.KANJI:
|
|
4880
|
+
nodes.push([
|
|
4881
|
+
seg,
|
|
4882
|
+
{ data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
|
|
4883
|
+
]);
|
|
4884
|
+
break;
|
|
4885
|
+
case Mode.BYTE:
|
|
4886
|
+
nodes.push([
|
|
4887
|
+
{ data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
|
|
4888
|
+
]);
|
|
4889
|
+
}
|
|
4890
|
+
}
|
|
4891
|
+
return nodes;
|
|
4892
|
+
}
|
|
4893
|
+
function buildGraph(nodes, version) {
|
|
4894
|
+
const table = {};
|
|
4895
|
+
const graph = { start: {} };
|
|
4896
|
+
let prevNodeIds = ["start"];
|
|
4897
|
+
for (let i2 = 0; i2 < nodes.length; i2++) {
|
|
4898
|
+
const nodeGroup = nodes[i2];
|
|
4899
|
+
const currentNodeIds = [];
|
|
4900
|
+
for (let j2 = 0; j2 < nodeGroup.length; j2++) {
|
|
4901
|
+
const node = nodeGroup[j2];
|
|
4902
|
+
const key = "" + i2 + j2;
|
|
4903
|
+
currentNodeIds.push(key);
|
|
4904
|
+
table[key] = { node, lastCount: 0 };
|
|
4905
|
+
graph[key] = {};
|
|
4906
|
+
for (let n = 0; n < prevNodeIds.length; n++) {
|
|
4907
|
+
const prevNodeId = prevNodeIds[n];
|
|
4908
|
+
if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
|
|
4909
|
+
graph[prevNodeId][key] = getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) - getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);
|
|
4910
|
+
table[prevNodeId].lastCount += node.length;
|
|
4911
|
+
} else {
|
|
4912
|
+
if (table[prevNodeId]) table[prevNodeId].lastCount = node.length;
|
|
4913
|
+
graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) + 4 + Mode.getCharCountIndicator(node.mode, version);
|
|
4914
|
+
}
|
|
4915
|
+
}
|
|
4916
|
+
}
|
|
4917
|
+
prevNodeIds = currentNodeIds;
|
|
4918
|
+
}
|
|
4919
|
+
for (let n = 0; n < prevNodeIds.length; n++) {
|
|
4920
|
+
graph[prevNodeIds[n]].end = 0;
|
|
4921
|
+
}
|
|
4922
|
+
return { map: graph, table };
|
|
4923
|
+
}
|
|
4924
|
+
function buildSingleSegment(data, modesHint) {
|
|
4925
|
+
let mode;
|
|
4926
|
+
const bestMode = Mode.getBestModeForData(data);
|
|
4927
|
+
mode = Mode.from(modesHint, bestMode);
|
|
4928
|
+
if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {
|
|
4929
|
+
throw new Error('"' + data + '" cannot be encoded with mode ' + Mode.toString(mode) + ".\n Suggested mode is: " + Mode.toString(bestMode));
|
|
4930
|
+
}
|
|
4931
|
+
if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {
|
|
4932
|
+
mode = Mode.BYTE;
|
|
4933
|
+
}
|
|
4934
|
+
switch (mode) {
|
|
4935
|
+
case Mode.NUMERIC:
|
|
4936
|
+
return new NumericData(data);
|
|
4937
|
+
case Mode.ALPHANUMERIC:
|
|
4938
|
+
return new AlphanumericData(data);
|
|
4939
|
+
case Mode.KANJI:
|
|
4940
|
+
return new KanjiData(data);
|
|
4941
|
+
case Mode.BYTE:
|
|
4942
|
+
return new ByteData(data);
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
exports2.fromArray = function fromArray(array) {
|
|
4946
|
+
return array.reduce(function(acc, seg) {
|
|
4947
|
+
if (typeof seg === "string") {
|
|
4948
|
+
acc.push(buildSingleSegment(seg, null));
|
|
4949
|
+
} else if (seg.data) {
|
|
4950
|
+
acc.push(buildSingleSegment(seg.data, seg.mode));
|
|
4951
|
+
}
|
|
4952
|
+
return acc;
|
|
4953
|
+
}, []);
|
|
4954
|
+
};
|
|
4955
|
+
exports2.fromString = function fromString(data, version) {
|
|
4956
|
+
const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
|
|
4957
|
+
const nodes = buildNodes(segs);
|
|
4958
|
+
const graph = buildGraph(nodes, version);
|
|
4959
|
+
const path8 = dijkstra.find_path(graph.map, "start", "end");
|
|
4960
|
+
const optimizedSegs = [];
|
|
4961
|
+
for (let i2 = 1; i2 < path8.length - 1; i2++) {
|
|
4962
|
+
optimizedSegs.push(graph.table[path8[i2]].node);
|
|
4963
|
+
}
|
|
4964
|
+
return exports2.fromArray(mergeSegments(optimizedSegs));
|
|
4965
|
+
};
|
|
4966
|
+
exports2.rawSplit = function rawSplit(data) {
|
|
4967
|
+
return exports2.fromArray(
|
|
4968
|
+
getSegmentsFromString(data, Utils.isKanjiModeEnabled())
|
|
4969
|
+
);
|
|
4970
|
+
};
|
|
4971
|
+
}
|
|
4972
|
+
});
|
|
4973
|
+
|
|
4974
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js
|
|
4975
|
+
var require_qrcode = __commonJS({
|
|
4976
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js"(exports2) {
|
|
4977
|
+
"use strict";
|
|
4978
|
+
var Utils = require_utils();
|
|
4979
|
+
var ECLevel = require_error_correction_level();
|
|
4980
|
+
var BitBuffer = require_bit_buffer();
|
|
4981
|
+
var BitMatrix = require_bit_matrix();
|
|
4982
|
+
var AlignmentPattern = require_alignment_pattern();
|
|
4983
|
+
var FinderPattern = require_finder_pattern();
|
|
4984
|
+
var MaskPattern = require_mask_pattern();
|
|
4985
|
+
var ECCode = require_error_correction_code();
|
|
4986
|
+
var ReedSolomonEncoder = require_reed_solomon_encoder();
|
|
4987
|
+
var Version = require_version();
|
|
4988
|
+
var FormatInfo = require_format_info();
|
|
4989
|
+
var Mode = require_mode();
|
|
4990
|
+
var Segments = require_segments();
|
|
4991
|
+
function setupFinderPattern(matrix, version) {
|
|
4992
|
+
const size = matrix.size;
|
|
4993
|
+
const pos = FinderPattern.getPositions(version);
|
|
4994
|
+
for (let i2 = 0; i2 < pos.length; i2++) {
|
|
4995
|
+
const row = pos[i2][0];
|
|
4996
|
+
const col = pos[i2][1];
|
|
4997
|
+
for (let r2 = -1; r2 <= 7; r2++) {
|
|
4998
|
+
if (row + r2 <= -1 || size <= row + r2) continue;
|
|
4999
|
+
for (let c3 = -1; c3 <= 7; c3++) {
|
|
5000
|
+
if (col + c3 <= -1 || size <= col + c3) continue;
|
|
5001
|
+
if (r2 >= 0 && r2 <= 6 && (c3 === 0 || c3 === 6) || c3 >= 0 && c3 <= 6 && (r2 === 0 || r2 === 6) || r2 >= 2 && r2 <= 4 && c3 >= 2 && c3 <= 4) {
|
|
5002
|
+
matrix.set(row + r2, col + c3, true, true);
|
|
5003
|
+
} else {
|
|
5004
|
+
matrix.set(row + r2, col + c3, false, true);
|
|
5005
|
+
}
|
|
5006
|
+
}
|
|
5007
|
+
}
|
|
5008
|
+
}
|
|
5009
|
+
}
|
|
5010
|
+
function setupTimingPattern(matrix) {
|
|
5011
|
+
const size = matrix.size;
|
|
5012
|
+
for (let r2 = 8; r2 < size - 8; r2++) {
|
|
5013
|
+
const value = r2 % 2 === 0;
|
|
5014
|
+
matrix.set(r2, 6, value, true);
|
|
5015
|
+
matrix.set(6, r2, value, true);
|
|
5016
|
+
}
|
|
5017
|
+
}
|
|
5018
|
+
function setupAlignmentPattern(matrix, version) {
|
|
5019
|
+
const pos = AlignmentPattern.getPositions(version);
|
|
5020
|
+
for (let i2 = 0; i2 < pos.length; i2++) {
|
|
5021
|
+
const row = pos[i2][0];
|
|
5022
|
+
const col = pos[i2][1];
|
|
5023
|
+
for (let r2 = -2; r2 <= 2; r2++) {
|
|
5024
|
+
for (let c3 = -2; c3 <= 2; c3++) {
|
|
5025
|
+
if (r2 === -2 || r2 === 2 || c3 === -2 || c3 === 2 || r2 === 0 && c3 === 0) {
|
|
5026
|
+
matrix.set(row + r2, col + c3, true, true);
|
|
5027
|
+
} else {
|
|
5028
|
+
matrix.set(row + r2, col + c3, false, true);
|
|
5029
|
+
}
|
|
5030
|
+
}
|
|
5031
|
+
}
|
|
5032
|
+
}
|
|
5033
|
+
}
|
|
5034
|
+
function setupVersionInfo(matrix, version) {
|
|
5035
|
+
const size = matrix.size;
|
|
5036
|
+
const bits = Version.getEncodedBits(version);
|
|
5037
|
+
let row, col, mod;
|
|
5038
|
+
for (let i2 = 0; i2 < 18; i2++) {
|
|
5039
|
+
row = Math.floor(i2 / 3);
|
|
5040
|
+
col = i2 % 3 + size - 8 - 3;
|
|
5041
|
+
mod = (bits >> i2 & 1) === 1;
|
|
5042
|
+
matrix.set(row, col, mod, true);
|
|
5043
|
+
matrix.set(col, row, mod, true);
|
|
5044
|
+
}
|
|
5045
|
+
}
|
|
5046
|
+
function setupFormatInfo(matrix, errorCorrectionLevel, maskPattern) {
|
|
5047
|
+
const size = matrix.size;
|
|
5048
|
+
const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);
|
|
5049
|
+
let i2, mod;
|
|
5050
|
+
for (i2 = 0; i2 < 15; i2++) {
|
|
5051
|
+
mod = (bits >> i2 & 1) === 1;
|
|
5052
|
+
if (i2 < 6) {
|
|
5053
|
+
matrix.set(i2, 8, mod, true);
|
|
5054
|
+
} else if (i2 < 8) {
|
|
5055
|
+
matrix.set(i2 + 1, 8, mod, true);
|
|
5056
|
+
} else {
|
|
5057
|
+
matrix.set(size - 15 + i2, 8, mod, true);
|
|
5058
|
+
}
|
|
5059
|
+
if (i2 < 8) {
|
|
5060
|
+
matrix.set(8, size - i2 - 1, mod, true);
|
|
5061
|
+
} else if (i2 < 9) {
|
|
5062
|
+
matrix.set(8, 15 - i2 - 1 + 1, mod, true);
|
|
5063
|
+
} else {
|
|
5064
|
+
matrix.set(8, 15 - i2 - 1, mod, true);
|
|
5065
|
+
}
|
|
5066
|
+
}
|
|
5067
|
+
matrix.set(size - 8, 8, 1, true);
|
|
5068
|
+
}
|
|
5069
|
+
function setupData(matrix, data) {
|
|
5070
|
+
const size = matrix.size;
|
|
5071
|
+
let inc = -1;
|
|
5072
|
+
let row = size - 1;
|
|
5073
|
+
let bitIndex = 7;
|
|
5074
|
+
let byteIndex = 0;
|
|
5075
|
+
for (let col = size - 1; col > 0; col -= 2) {
|
|
5076
|
+
if (col === 6) col--;
|
|
5077
|
+
while (true) {
|
|
5078
|
+
for (let c3 = 0; c3 < 2; c3++) {
|
|
5079
|
+
if (!matrix.isReserved(row, col - c3)) {
|
|
5080
|
+
let dark = false;
|
|
5081
|
+
if (byteIndex < data.length) {
|
|
5082
|
+
dark = (data[byteIndex] >>> bitIndex & 1) === 1;
|
|
5083
|
+
}
|
|
5084
|
+
matrix.set(row, col - c3, dark);
|
|
5085
|
+
bitIndex--;
|
|
5086
|
+
if (bitIndex === -1) {
|
|
5087
|
+
byteIndex++;
|
|
5088
|
+
bitIndex = 7;
|
|
5089
|
+
}
|
|
5090
|
+
}
|
|
5091
|
+
}
|
|
5092
|
+
row += inc;
|
|
5093
|
+
if (row < 0 || size <= row) {
|
|
5094
|
+
row -= inc;
|
|
5095
|
+
inc = -inc;
|
|
5096
|
+
break;
|
|
5097
|
+
}
|
|
5098
|
+
}
|
|
5099
|
+
}
|
|
5100
|
+
}
|
|
5101
|
+
function createData(version, errorCorrectionLevel, segments) {
|
|
5102
|
+
const buffer = new BitBuffer();
|
|
5103
|
+
segments.forEach(function(data) {
|
|
5104
|
+
buffer.put(data.mode.bit, 4);
|
|
5105
|
+
buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version));
|
|
5106
|
+
data.write(buffer);
|
|
5107
|
+
});
|
|
5108
|
+
const totalCodewords = Utils.getSymbolTotalCodewords(version);
|
|
5109
|
+
const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
|
|
5110
|
+
const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
|
|
5111
|
+
if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
|
|
5112
|
+
buffer.put(0, 4);
|
|
5113
|
+
}
|
|
5114
|
+
while (buffer.getLengthInBits() % 8 !== 0) {
|
|
5115
|
+
buffer.putBit(0);
|
|
5116
|
+
}
|
|
5117
|
+
const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;
|
|
5118
|
+
for (let i2 = 0; i2 < remainingByte; i2++) {
|
|
5119
|
+
buffer.put(i2 % 2 ? 17 : 236, 8);
|
|
5120
|
+
}
|
|
5121
|
+
return createCodewords(buffer, version, errorCorrectionLevel);
|
|
5122
|
+
}
|
|
5123
|
+
function createCodewords(bitBuffer, version, errorCorrectionLevel) {
|
|
5124
|
+
const totalCodewords = Utils.getSymbolTotalCodewords(version);
|
|
5125
|
+
const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
|
|
5126
|
+
const dataTotalCodewords = totalCodewords - ecTotalCodewords;
|
|
5127
|
+
const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel);
|
|
5128
|
+
const blocksInGroup2 = totalCodewords % ecTotalBlocks;
|
|
5129
|
+
const blocksInGroup1 = ecTotalBlocks - blocksInGroup2;
|
|
5130
|
+
const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);
|
|
5131
|
+
const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);
|
|
5132
|
+
const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;
|
|
5133
|
+
const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;
|
|
5134
|
+
const rs = new ReedSolomonEncoder(ecCount);
|
|
5135
|
+
let offset = 0;
|
|
5136
|
+
const dcData = new Array(ecTotalBlocks);
|
|
5137
|
+
const ecData = new Array(ecTotalBlocks);
|
|
5138
|
+
let maxDataSize = 0;
|
|
5139
|
+
const buffer = new Uint8Array(bitBuffer.buffer);
|
|
5140
|
+
for (let b2 = 0; b2 < ecTotalBlocks; b2++) {
|
|
5141
|
+
const dataSize = b2 < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;
|
|
5142
|
+
dcData[b2] = buffer.slice(offset, offset + dataSize);
|
|
5143
|
+
ecData[b2] = rs.encode(dcData[b2]);
|
|
5144
|
+
offset += dataSize;
|
|
5145
|
+
maxDataSize = Math.max(maxDataSize, dataSize);
|
|
5146
|
+
}
|
|
5147
|
+
const data = new Uint8Array(totalCodewords);
|
|
5148
|
+
let index = 0;
|
|
5149
|
+
let i2, r2;
|
|
5150
|
+
for (i2 = 0; i2 < maxDataSize; i2++) {
|
|
5151
|
+
for (r2 = 0; r2 < ecTotalBlocks; r2++) {
|
|
5152
|
+
if (i2 < dcData[r2].length) {
|
|
5153
|
+
data[index++] = dcData[r2][i2];
|
|
5154
|
+
}
|
|
5155
|
+
}
|
|
5156
|
+
}
|
|
5157
|
+
for (i2 = 0; i2 < ecCount; i2++) {
|
|
5158
|
+
for (r2 = 0; r2 < ecTotalBlocks; r2++) {
|
|
5159
|
+
data[index++] = ecData[r2][i2];
|
|
5160
|
+
}
|
|
5161
|
+
}
|
|
5162
|
+
return data;
|
|
5163
|
+
}
|
|
5164
|
+
function createSymbol(data, version, errorCorrectionLevel, maskPattern) {
|
|
5165
|
+
let segments;
|
|
5166
|
+
if (Array.isArray(data)) {
|
|
5167
|
+
segments = Segments.fromArray(data);
|
|
5168
|
+
} else if (typeof data === "string") {
|
|
5169
|
+
let estimatedVersion = version;
|
|
5170
|
+
if (!estimatedVersion) {
|
|
5171
|
+
const rawSegments = Segments.rawSplit(data);
|
|
5172
|
+
estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel);
|
|
5173
|
+
}
|
|
5174
|
+
segments = Segments.fromString(data, estimatedVersion || 40);
|
|
5175
|
+
} else {
|
|
5176
|
+
throw new Error("Invalid data");
|
|
5177
|
+
}
|
|
5178
|
+
const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel);
|
|
5179
|
+
if (!bestVersion) {
|
|
5180
|
+
throw new Error("The amount of data is too big to be stored in a QR Code");
|
|
5181
|
+
}
|
|
5182
|
+
if (!version) {
|
|
5183
|
+
version = bestVersion;
|
|
5184
|
+
} else if (version < bestVersion) {
|
|
5185
|
+
throw new Error(
|
|
5186
|
+
"\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: " + bestVersion + ".\n"
|
|
5187
|
+
);
|
|
5188
|
+
}
|
|
5189
|
+
const dataBits = createData(version, errorCorrectionLevel, segments);
|
|
5190
|
+
const moduleCount = Utils.getSymbolSize(version);
|
|
5191
|
+
const modules = new BitMatrix(moduleCount);
|
|
5192
|
+
setupFinderPattern(modules, version);
|
|
5193
|
+
setupTimingPattern(modules);
|
|
5194
|
+
setupAlignmentPattern(modules, version);
|
|
5195
|
+
setupFormatInfo(modules, errorCorrectionLevel, 0);
|
|
5196
|
+
if (version >= 7) {
|
|
5197
|
+
setupVersionInfo(modules, version);
|
|
5198
|
+
}
|
|
5199
|
+
setupData(modules, dataBits);
|
|
5200
|
+
if (isNaN(maskPattern)) {
|
|
5201
|
+
maskPattern = MaskPattern.getBestMask(
|
|
5202
|
+
modules,
|
|
5203
|
+
setupFormatInfo.bind(null, modules, errorCorrectionLevel)
|
|
5204
|
+
);
|
|
5205
|
+
}
|
|
5206
|
+
MaskPattern.applyMask(maskPattern, modules);
|
|
5207
|
+
setupFormatInfo(modules, errorCorrectionLevel, maskPattern);
|
|
5208
|
+
return {
|
|
5209
|
+
modules,
|
|
5210
|
+
version,
|
|
5211
|
+
errorCorrectionLevel,
|
|
5212
|
+
maskPattern,
|
|
5213
|
+
segments
|
|
5214
|
+
};
|
|
5215
|
+
}
|
|
5216
|
+
exports2.create = function create(data, options) {
|
|
5217
|
+
if (typeof data === "undefined" || data === "") {
|
|
5218
|
+
throw new Error("No input text");
|
|
5219
|
+
}
|
|
5220
|
+
let errorCorrectionLevel = ECLevel.M;
|
|
5221
|
+
let version;
|
|
5222
|
+
let mask;
|
|
5223
|
+
if (typeof options !== "undefined") {
|
|
5224
|
+
errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M);
|
|
5225
|
+
version = Version.from(options.version);
|
|
5226
|
+
mask = MaskPattern.from(options.maskPattern);
|
|
5227
|
+
if (options.toSJISFunc) {
|
|
5228
|
+
Utils.setToSJISFunction(options.toSJISFunc);
|
|
5229
|
+
}
|
|
5230
|
+
}
|
|
5231
|
+
return createSymbol(data, version, errorCorrectionLevel, mask);
|
|
5232
|
+
};
|
|
5233
|
+
}
|
|
5234
|
+
});
|
|
5235
|
+
|
|
5236
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal/terminal.js
|
|
5237
|
+
var require_terminal = __commonJS({
|
|
5238
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal/terminal.js"(exports2) {
|
|
5239
|
+
"use strict";
|
|
5240
|
+
exports2.render = function(qrData, options, cb) {
|
|
5241
|
+
const size = qrData.modules.size;
|
|
5242
|
+
const data = qrData.modules.data;
|
|
5243
|
+
const black = "\x1B[40m \x1B[0m";
|
|
5244
|
+
const white = "\x1B[47m \x1B[0m";
|
|
5245
|
+
let output = "";
|
|
5246
|
+
const hMargin = Array(size + 3).join(white);
|
|
5247
|
+
const vMargin = Array(2).join(white);
|
|
5248
|
+
output += hMargin + "\n";
|
|
5249
|
+
for (let i2 = 0; i2 < size; ++i2) {
|
|
5250
|
+
output += white;
|
|
5251
|
+
for (let j2 = 0; j2 < size; j2++) {
|
|
5252
|
+
output += data[i2 * size + j2] ? black : white;
|
|
5253
|
+
}
|
|
5254
|
+
output += vMargin + "\n";
|
|
5255
|
+
}
|
|
5256
|
+
output += hMargin + "\n";
|
|
5257
|
+
if (typeof cb === "function") {
|
|
5258
|
+
cb(null, output);
|
|
5259
|
+
}
|
|
5260
|
+
return output;
|
|
5261
|
+
};
|
|
5262
|
+
}
|
|
5263
|
+
});
|
|
5264
|
+
|
|
5265
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal/terminal-small.js
|
|
5266
|
+
var require_terminal_small = __commonJS({
|
|
5267
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal/terminal-small.js"(exports2) {
|
|
5268
|
+
"use strict";
|
|
5269
|
+
var backgroundWhite = "\x1B[47m";
|
|
5270
|
+
var backgroundBlack = "\x1B[40m";
|
|
5271
|
+
var foregroundWhite = "\x1B[37m";
|
|
5272
|
+
var foregroundBlack = "\x1B[30m";
|
|
5273
|
+
var reset = "\x1B[0m";
|
|
5274
|
+
var lineSetupNormal = backgroundWhite + foregroundBlack;
|
|
5275
|
+
var lineSetupInverse = backgroundBlack + foregroundWhite;
|
|
5276
|
+
var createPalette = function(lineSetup, foregroundWhite2, foregroundBlack2) {
|
|
5277
|
+
return {
|
|
5278
|
+
// 1 ... white, 2 ... black, 0 ... transparent (default)
|
|
5279
|
+
"00": reset + " " + lineSetup,
|
|
5280
|
+
"01": reset + foregroundWhite2 + "\u2584" + lineSetup,
|
|
5281
|
+
"02": reset + foregroundBlack2 + "\u2584" + lineSetup,
|
|
5282
|
+
10: reset + foregroundWhite2 + "\u2580" + lineSetup,
|
|
5283
|
+
11: " ",
|
|
5284
|
+
12: "\u2584",
|
|
5285
|
+
20: reset + foregroundBlack2 + "\u2580" + lineSetup,
|
|
5286
|
+
21: "\u2580",
|
|
5287
|
+
22: "\u2588"
|
|
5288
|
+
};
|
|
5289
|
+
};
|
|
5290
|
+
var mkCodePixel = function(modules, size, x2, y2) {
|
|
5291
|
+
const sizePlus = size + 1;
|
|
5292
|
+
if (x2 >= sizePlus || y2 >= sizePlus || y2 < -1 || x2 < -1) return "0";
|
|
5293
|
+
if (x2 >= size || y2 >= size || y2 < 0 || x2 < 0) return "1";
|
|
5294
|
+
const idx = y2 * size + x2;
|
|
5295
|
+
return modules[idx] ? "2" : "1";
|
|
5296
|
+
};
|
|
5297
|
+
var mkCode = function(modules, size, x2, y2) {
|
|
5298
|
+
return mkCodePixel(modules, size, x2, y2) + mkCodePixel(modules, size, x2, y2 + 1);
|
|
5299
|
+
};
|
|
5300
|
+
exports2.render = function(qrData, options, cb) {
|
|
5301
|
+
const size = qrData.modules.size;
|
|
5302
|
+
const data = qrData.modules.data;
|
|
5303
|
+
const inverse = !!(options && options.inverse);
|
|
5304
|
+
const lineSetup = options && options.inverse ? lineSetupInverse : lineSetupNormal;
|
|
5305
|
+
const white = inverse ? foregroundBlack : foregroundWhite;
|
|
5306
|
+
const black = inverse ? foregroundWhite : foregroundBlack;
|
|
5307
|
+
const palette = createPalette(lineSetup, white, black);
|
|
5308
|
+
const newLine = reset + "\n" + lineSetup;
|
|
5309
|
+
let output = lineSetup;
|
|
5310
|
+
for (let y2 = -1; y2 < size + 1; y2 += 2) {
|
|
5311
|
+
for (let x2 = -1; x2 < size; x2++) {
|
|
5312
|
+
output += palette[mkCode(data, size, x2, y2)];
|
|
5313
|
+
}
|
|
5314
|
+
output += palette[mkCode(data, size, size, y2)] + newLine;
|
|
5315
|
+
}
|
|
5316
|
+
output += reset;
|
|
5317
|
+
if (typeof cb === "function") {
|
|
5318
|
+
cb(null, output);
|
|
5319
|
+
}
|
|
5320
|
+
return output;
|
|
5321
|
+
};
|
|
5322
|
+
}
|
|
5323
|
+
});
|
|
5324
|
+
|
|
5325
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal.js
|
|
5326
|
+
var require_terminal2 = __commonJS({
|
|
5327
|
+
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal.js"(exports2) {
|
|
5328
|
+
"use strict";
|
|
5329
|
+
var big = require_terminal();
|
|
5330
|
+
var small = require_terminal_small();
|
|
5331
|
+
exports2.render = function(qrData, options, cb) {
|
|
5332
|
+
if (options && options.small) {
|
|
5333
|
+
return small.render(qrData, options, cb);
|
|
5334
|
+
}
|
|
5335
|
+
return big.render(qrData, options, cb);
|
|
5336
|
+
};
|
|
5337
|
+
}
|
|
5338
|
+
});
|
|
5339
|
+
|
|
3406
5340
|
// ../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js
|
|
3407
5341
|
var require_ms = __commonJS({
|
|
3408
5342
|
"../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(exports2, module2) {
|
|
@@ -4067,10 +6001,10 @@ var require_src2 = __commonJS({
|
|
|
4067
6001
|
var fs_1 = require("fs");
|
|
4068
6002
|
var debug_1 = __importDefault(require_src());
|
|
4069
6003
|
var log = debug_1.default("@kwsites/file-exists");
|
|
4070
|
-
function check(
|
|
4071
|
-
log(`checking %s`,
|
|
6004
|
+
function check(path8, isFile, isDirectory) {
|
|
6005
|
+
log(`checking %s`, path8);
|
|
4072
6006
|
try {
|
|
4073
|
-
const stat = fs_1.statSync(
|
|
6007
|
+
const stat = fs_1.statSync(path8);
|
|
4074
6008
|
if (stat.isFile() && isFile) {
|
|
4075
6009
|
log(`[OK] path represents a file`);
|
|
4076
6010
|
return true;
|
|
@@ -4090,8 +6024,8 @@ var require_src2 = __commonJS({
|
|
|
4090
6024
|
throw e;
|
|
4091
6025
|
}
|
|
4092
6026
|
}
|
|
4093
|
-
function exists2(
|
|
4094
|
-
return check(
|
|
6027
|
+
function exists2(path8, type = exports2.READABLE) {
|
|
6028
|
+
return check(path8, (type & exports2.FILE) > 0, (type & exports2.FOLDER) > 0);
|
|
4095
6029
|
}
|
|
4096
6030
|
exports2.exists = exists2;
|
|
4097
6031
|
exports2.FILE = 1;
|
|
@@ -4156,6 +6090,7 @@ var require_dist2 = __commonJS({
|
|
|
4156
6090
|
|
|
4157
6091
|
// src/index.ts
|
|
4158
6092
|
var fs6 = __toESM(require("fs"), 1);
|
|
6093
|
+
var path7 = __toESM(require("path"), 1);
|
|
4159
6094
|
|
|
4160
6095
|
// ../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/esm.mjs
|
|
4161
6096
|
var import_index = __toESM(require_commander(), 1);
|
|
@@ -4177,6 +6112,19 @@ var {
|
|
|
4177
6112
|
// src/index.ts
|
|
4178
6113
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
4179
6114
|
|
|
6115
|
+
// src/qr.ts
|
|
6116
|
+
var import_qrcode = __toESM(require_qrcode(), 1);
|
|
6117
|
+
var import_terminal = __toESM(require_terminal2(), 1);
|
|
6118
|
+
function renderTerminalQr(text) {
|
|
6119
|
+
try {
|
|
6120
|
+
const data = import_qrcode.default.create(text, { errorCorrectionLevel: "M" });
|
|
6121
|
+
const rendered = import_terminal.default.render(data, { small: true });
|
|
6122
|
+
return rendered.split("\n").filter((r2) => r2.length > 0);
|
|
6123
|
+
} catch {
|
|
6124
|
+
return [];
|
|
6125
|
+
}
|
|
6126
|
+
}
|
|
6127
|
+
|
|
4180
6128
|
// ../core/dist/index.js
|
|
4181
6129
|
var crypto2 = __toESM(require("crypto"), 1);
|
|
4182
6130
|
|
|
@@ -4658,8 +6606,8 @@ function getErrorMap() {
|
|
|
4658
6606
|
|
|
4659
6607
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
4660
6608
|
var makeIssue = (params) => {
|
|
4661
|
-
const { data, path:
|
|
4662
|
-
const fullPath = [...
|
|
6609
|
+
const { data, path: path8, errorMaps, issueData } = params;
|
|
6610
|
+
const fullPath = [...path8, ...issueData.path || []];
|
|
4663
6611
|
const fullIssue = {
|
|
4664
6612
|
...issueData,
|
|
4665
6613
|
path: fullPath
|
|
@@ -4775,11 +6723,11 @@ var errorUtil;
|
|
|
4775
6723
|
|
|
4776
6724
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
4777
6725
|
var ParseInputLazyPath = class {
|
|
4778
|
-
constructor(parent, value,
|
|
6726
|
+
constructor(parent, value, path8, key) {
|
|
4779
6727
|
this._cachedPath = [];
|
|
4780
6728
|
this.parent = parent;
|
|
4781
6729
|
this.data = value;
|
|
4782
|
-
this._path =
|
|
6730
|
+
this._path = path8;
|
|
4783
6731
|
this._key = key;
|
|
4784
6732
|
}
|
|
4785
6733
|
get path() {
|
|
@@ -8891,8 +10839,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
8891
10839
|
function forEachLineWithContent(input, callback) {
|
|
8892
10840
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
8893
10841
|
}
|
|
8894
|
-
function folderExists(
|
|
8895
|
-
return (0, import_file_exists.exists)(
|
|
10842
|
+
function folderExists(path8) {
|
|
10843
|
+
return (0, import_file_exists.exists)(path8, import_file_exists.FOLDER);
|
|
8896
10844
|
}
|
|
8897
10845
|
function append(target, item) {
|
|
8898
10846
|
if (Array.isArray(target)) {
|
|
@@ -9294,8 +11242,8 @@ function checkIsRepoRootTask() {
|
|
|
9294
11242
|
commands,
|
|
9295
11243
|
format: "utf-8",
|
|
9296
11244
|
onError,
|
|
9297
|
-
parser(
|
|
9298
|
-
return /^\.(git)?$/.test(
|
|
11245
|
+
parser(path8) {
|
|
11246
|
+
return /^\.(git)?$/.test(path8.trim());
|
|
9299
11247
|
}
|
|
9300
11248
|
};
|
|
9301
11249
|
}
|
|
@@ -9729,11 +11677,11 @@ function parseGrep(grep) {
|
|
|
9729
11677
|
const paths = /* @__PURE__ */ new Set();
|
|
9730
11678
|
const results = {};
|
|
9731
11679
|
forEachLineWithContent(grep, (input) => {
|
|
9732
|
-
const [
|
|
9733
|
-
paths.add(
|
|
9734
|
-
(results[
|
|
11680
|
+
const [path8, line, preview] = input.split(NULL);
|
|
11681
|
+
paths.add(path8);
|
|
11682
|
+
(results[path8] = results[path8] || []).push({
|
|
9735
11683
|
line: asNumber(line),
|
|
9736
|
-
path:
|
|
11684
|
+
path: path8,
|
|
9737
11685
|
preview
|
|
9738
11686
|
});
|
|
9739
11687
|
});
|
|
@@ -10497,14 +12445,14 @@ var init_hash_object = __esm({
|
|
|
10497
12445
|
init_task();
|
|
10498
12446
|
}
|
|
10499
12447
|
});
|
|
10500
|
-
function parseInit(bare,
|
|
12448
|
+
function parseInit(bare, path8, text) {
|
|
10501
12449
|
const response = String(text).trim();
|
|
10502
12450
|
let result;
|
|
10503
12451
|
if (result = initResponseRegex.exec(response)) {
|
|
10504
|
-
return new InitSummary(bare,
|
|
12452
|
+
return new InitSummary(bare, path8, false, result[1]);
|
|
10505
12453
|
}
|
|
10506
12454
|
if (result = reInitResponseRegex.exec(response)) {
|
|
10507
|
-
return new InitSummary(bare,
|
|
12455
|
+
return new InitSummary(bare, path8, true, result[1]);
|
|
10508
12456
|
}
|
|
10509
12457
|
let gitDir = "";
|
|
10510
12458
|
const tokens = response.split(" ");
|
|
@@ -10515,7 +12463,7 @@ function parseInit(bare, path7, text) {
|
|
|
10515
12463
|
break;
|
|
10516
12464
|
}
|
|
10517
12465
|
}
|
|
10518
|
-
return new InitSummary(bare,
|
|
12466
|
+
return new InitSummary(bare, path8, /^re/i.test(response), gitDir);
|
|
10519
12467
|
}
|
|
10520
12468
|
var InitSummary;
|
|
10521
12469
|
var initResponseRegex;
|
|
@@ -10524,9 +12472,9 @@ var init_InitSummary = __esm({
|
|
|
10524
12472
|
"src/lib/responses/InitSummary.ts"() {
|
|
10525
12473
|
"use strict";
|
|
10526
12474
|
InitSummary = class {
|
|
10527
|
-
constructor(bare,
|
|
12475
|
+
constructor(bare, path8, existing, gitDir) {
|
|
10528
12476
|
this.bare = bare;
|
|
10529
|
-
this.path =
|
|
12477
|
+
this.path = path8;
|
|
10530
12478
|
this.existing = existing;
|
|
10531
12479
|
this.gitDir = gitDir;
|
|
10532
12480
|
}
|
|
@@ -10538,7 +12486,7 @@ var init_InitSummary = __esm({
|
|
|
10538
12486
|
function hasBareCommand(command) {
|
|
10539
12487
|
return command.includes(bareCommand);
|
|
10540
12488
|
}
|
|
10541
|
-
function initTask(bare = false,
|
|
12489
|
+
function initTask(bare = false, path8, customArgs) {
|
|
10542
12490
|
const commands = ["init", ...customArgs];
|
|
10543
12491
|
if (bare && !hasBareCommand(commands)) {
|
|
10544
12492
|
commands.splice(1, 0, bareCommand);
|
|
@@ -10547,7 +12495,7 @@ function initTask(bare = false, path7, customArgs) {
|
|
|
10547
12495
|
commands,
|
|
10548
12496
|
format: "utf-8",
|
|
10549
12497
|
parser(text) {
|
|
10550
|
-
return parseInit(commands.includes("--bare"),
|
|
12498
|
+
return parseInit(commands.includes("--bare"), path8, text);
|
|
10551
12499
|
}
|
|
10552
12500
|
};
|
|
10553
12501
|
}
|
|
@@ -11362,12 +13310,12 @@ var init_FileStatusSummary = __esm({
|
|
|
11362
13310
|
"use strict";
|
|
11363
13311
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
11364
13312
|
FileStatusSummary = class {
|
|
11365
|
-
constructor(
|
|
11366
|
-
this.path =
|
|
13313
|
+
constructor(path8, index, working_dir) {
|
|
13314
|
+
this.path = path8;
|
|
11367
13315
|
this.index = index;
|
|
11368
13316
|
this.working_dir = working_dir;
|
|
11369
13317
|
if (index === "R" || working_dir === "R") {
|
|
11370
|
-
const detail = fromPathRegex.exec(
|
|
13318
|
+
const detail = fromPathRegex.exec(path8) || [null, path8, path8];
|
|
11371
13319
|
this.from = detail[2] || "";
|
|
11372
13320
|
this.path = detail[1] || "";
|
|
11373
13321
|
}
|
|
@@ -11398,14 +13346,14 @@ function splitLine(result, lineStr) {
|
|
|
11398
13346
|
default:
|
|
11399
13347
|
return;
|
|
11400
13348
|
}
|
|
11401
|
-
function data(index, workingDir,
|
|
13349
|
+
function data(index, workingDir, path8) {
|
|
11402
13350
|
const raw = `${index}${workingDir}`;
|
|
11403
13351
|
const handler = parsers6.get(raw);
|
|
11404
13352
|
if (handler) {
|
|
11405
|
-
handler(result,
|
|
13353
|
+
handler(result, path8);
|
|
11406
13354
|
}
|
|
11407
13355
|
if (raw !== "##" && raw !== "!!") {
|
|
11408
|
-
result.files.push(new FileStatusSummary(
|
|
13356
|
+
result.files.push(new FileStatusSummary(path8, index, workingDir));
|
|
11409
13357
|
}
|
|
11410
13358
|
}
|
|
11411
13359
|
}
|
|
@@ -11756,9 +13704,9 @@ var init_simple_git_api = __esm({
|
|
|
11756
13704
|
next
|
|
11757
13705
|
);
|
|
11758
13706
|
}
|
|
11759
|
-
hashObject(
|
|
13707
|
+
hashObject(path8, write) {
|
|
11760
13708
|
return this._runTask(
|
|
11761
|
-
hashObjectTask(
|
|
13709
|
+
hashObjectTask(path8, write === true),
|
|
11762
13710
|
trailingFunctionArgument(arguments)
|
|
11763
13711
|
);
|
|
11764
13712
|
}
|
|
@@ -12112,8 +14060,8 @@ var init_branch = __esm({
|
|
|
12112
14060
|
}
|
|
12113
14061
|
});
|
|
12114
14062
|
function toPath(input) {
|
|
12115
|
-
const
|
|
12116
|
-
return
|
|
14063
|
+
const path8 = input.trim().replace(/^["']|["']$/g, "");
|
|
14064
|
+
return path8 && (0, import_node_path.normalize)(path8);
|
|
12117
14065
|
}
|
|
12118
14066
|
var parseCheckIgnore;
|
|
12119
14067
|
var init_CheckIgnore = __esm({
|
|
@@ -12398,8 +14346,8 @@ __export2(sub_module_exports, {
|
|
|
12398
14346
|
subModuleTask: () => subModuleTask,
|
|
12399
14347
|
updateSubModuleTask: () => updateSubModuleTask
|
|
12400
14348
|
});
|
|
12401
|
-
function addSubModuleTask(repo,
|
|
12402
|
-
return subModuleTask(["add", repo,
|
|
14349
|
+
function addSubModuleTask(repo, path8) {
|
|
14350
|
+
return subModuleTask(["add", repo, path8]);
|
|
12403
14351
|
}
|
|
12404
14352
|
function initSubModuleTask(customArgs) {
|
|
12405
14353
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -12713,8 +14661,8 @@ var require_git = __commonJS2({
|
|
|
12713
14661
|
}
|
|
12714
14662
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
12715
14663
|
};
|
|
12716
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
12717
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
14664
|
+
Git2.prototype.submoduleAdd = function(repo, path8, then) {
|
|
14665
|
+
return this._runTask(addSubModuleTask2(repo, path8), trailingFunctionArgument2(arguments));
|
|
12718
14666
|
};
|
|
12719
14667
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
12720
14668
|
return this._runTask(
|
|
@@ -14342,7 +16290,8 @@ function estimateCost(options) {
|
|
|
14342
16290
|
|
|
14343
16291
|
// ../core/dist/format.js
|
|
14344
16292
|
function formatMarkdownReceipt(receipt, publicUrl) {
|
|
14345
|
-
const
|
|
16293
|
+
const baseUrl = process.env.NEXT_PUBLIC_APP_URL || process.env.QODEWK_APP_URL || "https://qodewk.flinkeo.online";
|
|
16294
|
+
const url = publicUrl || `${baseUrl}/r/${receipt.receipt.id}`;
|
|
14346
16295
|
const totalTokens = (receipt.ai.tokens.input + receipt.ai.tokens.output).toLocaleString();
|
|
14347
16296
|
const costPrefix = receipt.ai.mode === "verified" ? "$" : "~$";
|
|
14348
16297
|
const confidencePercent = `${Math.round(receipt.ai.confidence * 100)}%`;
|
|
@@ -14470,7 +16419,7 @@ async function generateReceipt(options = {}) {
|
|
|
14470
16419
|
|
|
14471
16420
|
// src/index.ts
|
|
14472
16421
|
var program2 = new Command();
|
|
14473
|
-
program2.name("qodewk").description("Universal telemetry and digital receipt generator for the AI coding agent era").version("0.1
|
|
16422
|
+
program2.name("qodewk").description("Universal telemetry and digital receipt generator for the AI coding agent era").version("0.2.1").option("-j, --json", "Output receipt in machine-readable JSON format").option("-f, --format <format>", "Output format (terminal, json, markdown)", "terminal").option("-o, --out <path>", "Write receipt output to specified file path").option("-p, --provider <provider>", "Specify AI provider (antigravity, claude, cursor, etc.)").option("-m, --model <model>", "Specify AI model identifier").option("-s, --since <duration>", "Harvest agent footprints since duration (e.g. today, 24h, 7d)").option("--today", "Harvest agent footprints for today").option("--platform <platform>", "Filter agent platform (antigravity, claude, cursor, all)").option("--anon", "Anonymize branch name in output").option("--barcode", "Render 1D barcode simulation instead of scannable 2D QR code").action(async (options) => {
|
|
14474
16423
|
try {
|
|
14475
16424
|
const since = options.today ? "today" : options.since;
|
|
14476
16425
|
const receipt = await generateReceipt({
|
|
@@ -14486,13 +16435,13 @@ program2.name("qodewk").description("Universal telemetry and digital receipt gen
|
|
|
14486
16435
|
db.close();
|
|
14487
16436
|
} catch {
|
|
14488
16437
|
}
|
|
14489
|
-
outputReceipt(receipt, options);
|
|
16438
|
+
await outputReceipt(receipt, options);
|
|
14490
16439
|
} catch (err) {
|
|
14491
16440
|
console.error(import_picocolors.default.red(`Error generating receipt: ${err.message}`));
|
|
14492
16441
|
process.exit(1);
|
|
14493
16442
|
}
|
|
14494
16443
|
});
|
|
14495
|
-
program2.command("audit").description("Audit PR or branch diff against a target base commit").option("-b, --base <base>", "Base git ref or commit SHA (e.g. origin/main)").option("-h, --head <head>", "Head git ref or commit SHA").option("-f, --format <format>", "Output format (terminal, json, markdown)", "terminal").option("-o, --out <path>", "Write receipt output to specified file path").option("-p, --provider <provider>", "Specify AI provider").option("-m, --model <model>", "Specify AI model").action(async (options) => {
|
|
16444
|
+
program2.command("audit").description("Audit PR or branch diff against a target base commit").option("-b, --base <base>", "Base git ref or commit SHA (e.g. origin/main)").option("-h, --head <head>", "Head git ref or commit SHA").option("-f, --format <format>", "Output format (terminal, json, markdown)", "terminal").option("-o, --out <path>", "Write receipt output to specified file path").option("-p, --provider <provider>", "Specify AI provider").option("-m, --model <model>", "Specify AI model").option("--barcode", "Render 1D barcode simulation instead of scannable 2D QR code").action(async (options) => {
|
|
14496
16445
|
try {
|
|
14497
16446
|
const receipt = await generateReceipt({
|
|
14498
16447
|
baseSha: options.base,
|
|
@@ -14500,13 +16449,13 @@ program2.command("audit").description("Audit PR or branch diff against a target
|
|
|
14500
16449
|
provider: options.provider,
|
|
14501
16450
|
model: options.model
|
|
14502
16451
|
});
|
|
14503
|
-
outputReceipt(receipt, options);
|
|
16452
|
+
await outputReceipt(receipt, options);
|
|
14504
16453
|
} catch (err) {
|
|
14505
16454
|
console.error(import_picocolors.default.red(`Error auditing git range: ${err.message}`));
|
|
14506
16455
|
process.exit(1);
|
|
14507
16456
|
}
|
|
14508
16457
|
});
|
|
14509
|
-
program2.command("share").description("Publish privacy-safe receipt to Qodewk cloud and get a shareable URL").option("-p, --provider <provider>", "Specify AI provider").option("-m, --model <model>", "Specify AI model").action(async (options) => {
|
|
16458
|
+
program2.command("share").description("Publish privacy-safe receipt to Qodewk cloud and get a shareable URL").option("-p, --provider <provider>", "Specify AI provider").option("-m, --model <model>", "Specify AI model").option("--barcode", "Render 1D barcode simulation instead of scannable 2D QR code").action(async (options) => {
|
|
14510
16459
|
try {
|
|
14511
16460
|
const receipt = await generateReceipt({
|
|
14512
16461
|
provider: options.provider,
|
|
@@ -14515,10 +16464,10 @@ program2.command("share").description("Publish privacy-safe receipt to Qodewk cl
|
|
|
14515
16464
|
if (process.env.QODEWK_TELEMETRY === "off") {
|
|
14516
16465
|
console.log(import_picocolors.default.yellow("\n\u26A0\uFE0F Cloud publishing is disabled because QODEWK_TELEMETRY=off."));
|
|
14517
16466
|
console.log(import_picocolors.default.dim("Telemetry remains strictly stored in local SQLite (~/.qodewk/state.db).\n"));
|
|
14518
|
-
renderTerminalReceipt(receipt);
|
|
16467
|
+
await renderTerminalReceipt(receipt, void 0, options.barcode);
|
|
14519
16468
|
return;
|
|
14520
16469
|
}
|
|
14521
|
-
const endpoint = process.env.QODEWK_API_URL || "https://qodewk.
|
|
16470
|
+
const endpoint = process.env.QODEWK_API_URL || `${process.env.NEXT_PUBLIC_APP_URL || process.env.QODEWK_APP_URL || "https://qodewk.flinkeo.online"}/api/receipts`;
|
|
14522
16471
|
console.log(import_picocolors.default.dim(`Publishing receipt ${receipt.receipt.id} to ${endpoint}...`));
|
|
14523
16472
|
try {
|
|
14524
16473
|
const response = await fetch(endpoint, {
|
|
@@ -14535,17 +16484,91 @@ program2.command("share").description("Publish privacy-safe receipt to Qodewk cl
|
|
|
14535
16484
|
const db = new LocalStateDB();
|
|
14536
16485
|
db.saveReceipt(receipt, data.claimToken);
|
|
14537
16486
|
db.close();
|
|
14538
|
-
renderTerminalReceipt(receipt, data.url);
|
|
16487
|
+
await renderTerminalReceipt(receipt, data.url, options.barcode);
|
|
14539
16488
|
} catch (networkErr) {
|
|
14540
16489
|
console.log(import_picocolors.default.yellow(`
|
|
14541
16490
|
Could not reach cloud API (${networkErr.message}). Rendered locally:`));
|
|
14542
|
-
renderTerminalReceipt(receipt);
|
|
16491
|
+
await renderTerminalReceipt(receipt, void 0, options.barcode);
|
|
14543
16492
|
}
|
|
14544
16493
|
} catch (err) {
|
|
14545
16494
|
console.error(import_picocolors.default.red(`Error sharing receipt: ${err.message}`));
|
|
14546
16495
|
process.exit(1);
|
|
14547
16496
|
}
|
|
14548
16497
|
});
|
|
16498
|
+
program2.command("record").description("Silently record local telemetry receipt into SQLite (used by git hooks)").action(async () => {
|
|
16499
|
+
try {
|
|
16500
|
+
const receipt = await generateReceipt();
|
|
16501
|
+
const db = new LocalStateDB();
|
|
16502
|
+
db.saveReceipt(receipt);
|
|
16503
|
+
db.close();
|
|
16504
|
+
process.exit(0);
|
|
16505
|
+
} catch {
|
|
16506
|
+
process.exit(0);
|
|
16507
|
+
}
|
|
16508
|
+
});
|
|
16509
|
+
var hookCommand = program2.command("hook").description("Manage non-blocking Git hooks for automatic telemetry recording");
|
|
16510
|
+
hookCommand.command("install").description("Install non-blocking post-commit Git hook into current repository").action(async () => {
|
|
16511
|
+
try {
|
|
16512
|
+
const gitDir = path7.join(process.cwd(), ".git");
|
|
16513
|
+
if (!fs6.existsSync(gitDir)) {
|
|
16514
|
+
console.error(import_picocolors.default.red("Error: Current directory is not a Git repository root (.git not found)."));
|
|
16515
|
+
process.exit(1);
|
|
16516
|
+
}
|
|
16517
|
+
const hooksDir = path7.join(gitDir, "hooks");
|
|
16518
|
+
if (!fs6.existsSync(hooksDir)) {
|
|
16519
|
+
fs6.mkdirSync(hooksDir, { recursive: true });
|
|
16520
|
+
}
|
|
16521
|
+
const hookFile = path7.join(hooksDir, "post-commit");
|
|
16522
|
+
const hookMarkerBegin = "# --- BEGIN QODEWK HOOK ---";
|
|
16523
|
+
const hookMarkerEnd = "# --- END QODEWK HOOK ---";
|
|
16524
|
+
const hookSnippet = `
|
|
16525
|
+
${hookMarkerBegin}
|
|
16526
|
+
# Non-blocking Qodewk background recorder (< 5ms)
|
|
16527
|
+
if command -v qodewk >/dev/null 2>&1 || command -v pnpm >/dev/null 2>&1 || [ -f "./node_modules/.bin/qodewk" ]; then
|
|
16528
|
+
( ( qodewk record || pnpm qodewk record || npx qodewk record ) >/dev/null 2>&1 & )
|
|
16529
|
+
fi
|
|
16530
|
+
${hookMarkerEnd}
|
|
16531
|
+
`;
|
|
16532
|
+
let content = "";
|
|
16533
|
+
if (fs6.existsSync(hookFile)) {
|
|
16534
|
+
content = fs6.readFileSync(hookFile, "utf-8");
|
|
16535
|
+
} else {
|
|
16536
|
+
content = "#!/bin/sh\n";
|
|
16537
|
+
}
|
|
16538
|
+
if (content.includes(hookMarkerBegin)) {
|
|
16539
|
+
console.log(import_picocolors.default.yellow("Qodewk post-commit hook is already installed."));
|
|
16540
|
+
return;
|
|
16541
|
+
}
|
|
16542
|
+
fs6.writeFileSync(hookFile, content + hookSnippet, { mode: 493 });
|
|
16543
|
+
console.log(import_picocolors.default.green("\u2713 Non-blocking Qodewk post-commit hook successfully installed in .git/hooks/post-commit"));
|
|
16544
|
+
} catch (err) {
|
|
16545
|
+
console.error(import_picocolors.default.red(`Failed to install Git hook: ${err.message}`));
|
|
16546
|
+
process.exit(1);
|
|
16547
|
+
}
|
|
16548
|
+
});
|
|
16549
|
+
hookCommand.command("uninstall").description("Remove Qodewk post-commit Git hook").action(async () => {
|
|
16550
|
+
try {
|
|
16551
|
+
const hookFile = path7.join(process.cwd(), ".git", "hooks", "post-commit");
|
|
16552
|
+
if (!fs6.existsSync(hookFile)) {
|
|
16553
|
+
console.log(import_picocolors.default.yellow("No post-commit hook found."));
|
|
16554
|
+
return;
|
|
16555
|
+
}
|
|
16556
|
+
const content = fs6.readFileSync(hookFile, "utf-8");
|
|
16557
|
+
const hookMarkerBegin = "# --- BEGIN QODEWK HOOK ---";
|
|
16558
|
+
const hookMarkerEnd = "# --- END QODEWK HOOK ---";
|
|
16559
|
+
if (!content.includes(hookMarkerBegin)) {
|
|
16560
|
+
console.log(import_picocolors.default.yellow("Qodewk hook is not installed."));
|
|
16561
|
+
return;
|
|
16562
|
+
}
|
|
16563
|
+
const regex = new RegExp(`\\n?${hookMarkerBegin}[\\s\\S]*?${hookMarkerEnd}\\n?`, "g");
|
|
16564
|
+
const updated = content.replace(regex, "");
|
|
16565
|
+
fs6.writeFileSync(hookFile, updated, { mode: 493 });
|
|
16566
|
+
console.log(import_picocolors.default.green("\u2713 Qodewk post-commit hook removed."));
|
|
16567
|
+
} catch (err) {
|
|
16568
|
+
console.error(import_picocolors.default.red(`Failed to uninstall hook: ${err.message}`));
|
|
16569
|
+
process.exit(1);
|
|
16570
|
+
}
|
|
16571
|
+
});
|
|
14549
16572
|
var ansiHex = (hexColor) => {
|
|
14550
16573
|
const num = parseInt(hexColor.replace("#", ""), 16);
|
|
14551
16574
|
const r2 = num >> 16 & 255;
|
|
@@ -14553,7 +16576,7 @@ var ansiHex = (hexColor) => {
|
|
|
14553
16576
|
const b2 = num & 255;
|
|
14554
16577
|
return (text) => `\x1B[38;2;${r2};${g};${b2}m${text}\x1B[39m`;
|
|
14555
16578
|
};
|
|
14556
|
-
function outputReceipt(receipt, options, publicUrl) {
|
|
16579
|
+
async function outputReceipt(receipt, options, publicUrl) {
|
|
14557
16580
|
let content = "";
|
|
14558
16581
|
const format = options.json ? "json" : options.format || "terminal";
|
|
14559
16582
|
if (format === "json") {
|
|
@@ -14566,7 +16589,7 @@ function outputReceipt(receipt, options, publicUrl) {
|
|
|
14566
16589
|
console.log(import_picocolors.default.green(`\u2713 Receipt written to ${options.out}`));
|
|
14567
16590
|
}
|
|
14568
16591
|
if (format === "terminal" && !options.out) {
|
|
14569
|
-
renderTerminalReceipt(receipt, publicUrl);
|
|
16592
|
+
await renderTerminalReceipt(receipt, publicUrl, options.barcode);
|
|
14570
16593
|
} else if (format !== "terminal" && !options.out) {
|
|
14571
16594
|
console.log(content);
|
|
14572
16595
|
}
|
|
@@ -14577,7 +16600,7 @@ var stripAnsi = (str) => {
|
|
|
14577
16600
|
var visibleWidth = (str) => {
|
|
14578
16601
|
return stripAnsi(str).length;
|
|
14579
16602
|
};
|
|
14580
|
-
function renderTerminalReceipt(receipt, publicUrl) {
|
|
16603
|
+
async function renderTerminalReceipt(receipt, publicUrl, useBarcode) {
|
|
14581
16604
|
const coral = ansiHex("#cc785c");
|
|
14582
16605
|
const green = ansiHex("#5db872");
|
|
14583
16606
|
const red = ansiHex("#c64545");
|
|
@@ -14662,10 +16685,38 @@ function renderTerminalReceipt(receipt, publicUrl) {
|
|
|
14662
16685
|
);
|
|
14663
16686
|
printDivider("=");
|
|
14664
16687
|
printRow("");
|
|
14665
|
-
|
|
14666
|
-
const
|
|
14667
|
-
const
|
|
14668
|
-
|
|
16688
|
+
const baseUrl = process.env.NEXT_PUBLIC_APP_URL || process.env.QODEWK_APP_URL || "https://qodewk.flinkeo.online";
|
|
16689
|
+
const isPublished = Boolean(publicUrl);
|
|
16690
|
+
const urlToDisplay = publicUrl || `${baseUrl}/r/${receipt.receipt.id}`;
|
|
16691
|
+
const displayHost = baseUrl.replace(/^https?:\/\//, "");
|
|
16692
|
+
if (useBarcode) {
|
|
16693
|
+
const barChars = ["||| ", "| | ", "|||| ", "|| | ", "|| || "];
|
|
16694
|
+
let barcodePattern = "||| ";
|
|
16695
|
+
for (let i2 = 0; i2 < 7; i2++) {
|
|
16696
|
+
const charCode = receipt.receipt.id.charCodeAt(i2 % receipt.receipt.id.length) + (receipt.receipt.id.charCodeAt((i2 + 7) % receipt.receipt.id.length) || 0);
|
|
16697
|
+
barcodePattern += barChars[charCode % barChars.length];
|
|
16698
|
+
}
|
|
16699
|
+
barcodePattern += "|||";
|
|
16700
|
+
printCenteredRow(import_picocolors.default.bold(barcodePattern));
|
|
16701
|
+
} else {
|
|
16702
|
+
const qrRows = renderTerminalQr(urlToDisplay);
|
|
16703
|
+
if (qrRows.length > 0) {
|
|
16704
|
+
printCenteredRow(import_picocolors.default.dim(isPublished ? "--- SCAN PUBLIC RECEIPT ---" : "--- LOCAL PROOF OF WORK ---"));
|
|
16705
|
+
printRow("");
|
|
16706
|
+
for (const qrRow of qrRows) {
|
|
16707
|
+
printCenteredRow(qrRow);
|
|
16708
|
+
}
|
|
16709
|
+
printRow("");
|
|
16710
|
+
} else {
|
|
16711
|
+
printCenteredRow(import_picocolors.default.bold("||| | ||||| ||| |||| |||||| |||| ||| ||||||| |||"));
|
|
16712
|
+
}
|
|
16713
|
+
}
|
|
16714
|
+
if (isPublished) {
|
|
16715
|
+
printCenteredRow(import_picocolors.default.cyan(displayHost));
|
|
16716
|
+
printCenteredRow(import_picocolors.default.underline(import_picocolors.default.cyan(`r/${receipt.receipt.id}`)));
|
|
16717
|
+
} else {
|
|
16718
|
+
printCenteredRow(import_picocolors.default.yellow("[ LOCAL RECORD \u2014 NOT PUBLISHED ]"));
|
|
16719
|
+
}
|
|
14669
16720
|
printRow("");
|
|
14670
16721
|
if (process.env.QODEWK_TELEMETRY === "off") {
|
|
14671
16722
|
printRow(` ${teal("[\u2713]")} QODEWK_TELEMETRY=off (Cloud sync disabled)`);
|
|
@@ -14673,5 +16724,15 @@ function renderTerminalReceipt(receipt, publicUrl) {
|
|
|
14673
16724
|
printRow(` ${green("[\u2713]")} Source code was never uploaded to Qodewk`);
|
|
14674
16725
|
console.log(" " + import_picocolors.default.bold(coral("\\/".repeat(28))));
|
|
14675
16726
|
console.log("");
|
|
16727
|
+
if (isPublished) {
|
|
16728
|
+
console.log(` ${import_picocolors.default.dim("\u{1F517} Public Receipt:")} ${import_picocolors.default.underline(import_picocolors.default.cyan(urlToDisplay))}`);
|
|
16729
|
+
} else {
|
|
16730
|
+
console.log(` ${import_picocolors.default.dim("\u{1F4BE} Saved to local DB:")} ${import_picocolors.default.dim("~/.qodewk/state.db")}`);
|
|
16731
|
+
console.log(` ${import_picocolors.default.dim("\u{1F4A1} To publish & get shareable URL:")} ${import_picocolors.default.cyan("qodewk share")}`);
|
|
16732
|
+
}
|
|
16733
|
+
if (!useBarcode) {
|
|
16734
|
+
console.log(` ${import_picocolors.default.dim("\u{1F4CA} View classic 1D barcode:")} ${import_picocolors.default.cyan("qodewk --barcode")}`);
|
|
16735
|
+
}
|
|
16736
|
+
console.log("");
|
|
14676
16737
|
}
|
|
14677
16738
|
program2.parse(process.argv);
|