asterui 0.12.1 → 0.12.2
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/components/Calendar.d.ts +23 -0
- package/dist/components/Checkbox.d.ts +10 -0
- package/dist/components/Dock.d.ts +38 -0
- package/dist/components/Mask.d.ts +14 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +203 -194
- package/dist/index.js.map +1 -1
- package/dist/index10.js +85 -59
- package/dist/index10.js.map +1 -1
- package/dist/index100.js +45 -7
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +11 -11
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +12 -28
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +7 -17
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +12 -10792
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +31 -5
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +16 -40
- package/dist/index106.js.map +1 -1
- package/dist/index107.js +174 -2
- package/dist/index107.js.map +1 -1
- package/dist/index109.js +10788 -147
- package/dist/index109.js.map +1 -1
- package/dist/index110.js +5 -30
- package/dist/index110.js.map +1 -1
- package/dist/index111.js +39 -27
- package/dist/index111.js.map +1 -1
- package/dist/index113.js +6 -71
- package/dist/index113.js.map +1 -1
- package/dist/index114.js +147 -34
- package/dist/index114.js.map +1 -1
- package/dist/index115.js +28 -24
- package/dist/index115.js.map +1 -1
- package/dist/index116.js +28 -19
- package/dist/index116.js.map +1 -1
- package/dist/index117.js +2 -24
- package/dist/index117.js.map +1 -1
- package/dist/index118.js +71 -19
- package/dist/index118.js.map +1 -1
- package/dist/index119.js +33 -94
- package/dist/index119.js.map +1 -1
- package/dist/index120.js +24 -358
- package/dist/index120.js.map +1 -1
- package/dist/index121.js +19 -23
- package/dist/index121.js.map +1 -1
- package/dist/index122.js +22 -71
- package/dist/index122.js.map +1 -1
- package/dist/index123.js +18 -14
- package/dist/index123.js.map +1 -1
- package/dist/index124.js +92 -58
- package/dist/index124.js.map +1 -1
- package/dist/index125.js +357 -141
- package/dist/index125.js.map +1 -1
- package/dist/index126.js +25 -2
- package/dist/index126.js.map +1 -1
- package/dist/index127.js +70 -53
- package/dist/index127.js.map +1 -1
- package/dist/index128.js +16 -2
- package/dist/index128.js.map +1 -1
- package/dist/index129.js +66 -2
- package/dist/index129.js.map +1 -1
- package/dist/index13.js +35 -95
- package/dist/index13.js.map +1 -1
- package/dist/index130.js +144 -2
- package/dist/index130.js.map +1 -1
- package/dist/index131.js +2 -2
- package/dist/index132.js +56 -2
- package/dist/index132.js.map +1 -1
- package/dist/index133.js +2 -2
- package/dist/index134.js +2 -2
- package/dist/index136.js +2 -32
- package/dist/index136.js.map +1 -1
- package/dist/index137.js +2 -2
- package/dist/index138.js +2 -8
- package/dist/index138.js.map +1 -1
- package/dist/index139.js +2 -2
- package/dist/index14.js +90 -153
- package/dist/index14.js.map +1 -1
- package/dist/index140.js +2 -2
- package/dist/index141.js +31 -20
- package/dist/index141.js.map +1 -1
- package/dist/index142.js +2 -2
- package/dist/index143.js +7 -23
- package/dist/index143.js.map +1 -1
- package/dist/index144.js +2 -71
- package/dist/index144.js.map +1 -1
- package/dist/index145.js +2 -21
- package/dist/index145.js.map +1 -1
- package/dist/index146.js +20 -33
- package/dist/index146.js.map +1 -1
- package/dist/index147.js +2 -70
- package/dist/index147.js.map +1 -1
- package/dist/index148.js +24 -2
- package/dist/index148.js.map +1 -1
- package/dist/index149.js +70 -21
- package/dist/index149.js.map +1 -1
- package/dist/index15.js +154 -146
- package/dist/index15.js.map +1 -1
- package/dist/index150.js +21 -2
- package/dist/index150.js.map +1 -1
- package/dist/index151.js +34 -2
- package/dist/index151.js.map +1 -1
- package/dist/index152.js +70 -2
- package/dist/index152.js.map +1 -1
- package/dist/index153.js +2 -2
- package/dist/index154.js +21 -3
- package/dist/index154.js.map +1 -1
- package/dist/index155.js +5 -0
- package/dist/index155.js.map +1 -0
- package/dist/index156.js +5 -0
- package/dist/index156.js.map +1 -0
- package/dist/index157.js +5 -0
- package/dist/index157.js.map +1 -0
- package/dist/index158.js +5 -0
- package/dist/index158.js.map +1 -0
- package/dist/index159.js +7 -0
- package/dist/index159.js.map +1 -0
- package/dist/index16.js +150 -5
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +5 -71
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +71 -17
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +15 -96
- package/dist/index19.js.map +1 -1
- package/dist/index20.js +89 -105
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +107 -177
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +181 -107
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +110 -19
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +19 -32
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +42 -40
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +31 -11
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +41 -33
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +12 -63
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +33 -80
- package/dist/index29.js.map +1 -1
- package/dist/index30.js +63 -18
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +79 -219
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +16 -1080
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +218 -16
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +1081 -121
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +17 -39
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +121 -190
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +37 -94
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +186 -157
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +89 -138
- package/dist/index39.js.map +1 -1
- package/dist/index40.js +161 -14
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +146 -18
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +14 -20
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +15 -116
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +18 -10
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +119 -35
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +12 -115
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +33 -174
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +10 -147
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +116 -12
- package/dist/index49.js.map +1 -1
- package/dist/index50.js +176 -22
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +147 -14
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +10 -5
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +21 -265
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +10 -13
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +7 -122
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +262 -106
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +14 -167
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +121 -31
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +107 -119
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +161 -77
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +31 -19
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +117 -69
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +82 -53
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +19 -44
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +70 -48
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +55 -60
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +39 -101
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +52 -41
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +58 -64
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +105 -19
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +41 -46
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +63 -129
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +19 -50
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +46 -22
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +132 -29
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +52 -22
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +19 -326
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +31 -56
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +22 -40
- package/dist/index79.js.map +1 -1
- package/dist/index80.js +328 -22
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +55 -94
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +38 -128
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +20 -158
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +93 -63
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +128 -33
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +152 -225
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +63 -32
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +35 -210
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +229 -208
- package/dist/index89.js.map +1 -1
- package/dist/index90.js +34 -295
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +200 -168
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +198 -243
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +293 -12
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +174 -29
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +258 -6
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +13 -13
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +32 -45
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +5 -12
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +13 -14
- package/dist/index99.js.map +1 -1
- package/package.json +2 -1
- package/dist/index108.js +0 -10
- package/dist/index108.js.map +0 -1
package/dist/index123.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { __exports as e } from "./
|
|
2
|
-
import { __require as
|
|
3
|
-
var
|
|
4
|
-
function
|
|
5
|
-
if (
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
return e.
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { __exports as e } from "./index138.js";
|
|
2
|
+
import { __require as s } from "./index118.js";
|
|
3
|
+
var i;
|
|
4
|
+
function f() {
|
|
5
|
+
if (i) return e;
|
|
6
|
+
i = 1;
|
|
7
|
+
const n = s().getSymbolSize, r = 7;
|
|
8
|
+
return e.getPositions = function(o) {
|
|
9
|
+
const t = n(o);
|
|
10
|
+
return [
|
|
11
|
+
// top-left
|
|
12
|
+
[0, 0],
|
|
13
|
+
// top-right
|
|
14
|
+
[t - r, 0],
|
|
15
|
+
// bottom-left
|
|
16
|
+
[0, t - r]
|
|
17
|
+
];
|
|
14
18
|
}, e;
|
|
15
19
|
}
|
|
16
20
|
export {
|
|
17
|
-
|
|
21
|
+
f as __require
|
|
18
22
|
};
|
|
19
23
|
//# sourceMappingURL=index123.js.map
|
package/dist/index123.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index123.js","sources":["../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/
|
|
1
|
+
{"version":3,"file":"index123.js","sources":["../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js"],"sourcesContent":["const getSymbolSize = require('./utils').getSymbolSize\nconst FINDER_PATTERN_SIZE = 7\n\n/**\n * Returns an array containing the positions of each finder pattern.\n * Each array's element represent the top-left point of the pattern as (x, y) coordinates\n *\n * @param {Number} version QR Code version\n * @return {Array} Array of coordinates\n */\nexports.getPositions = function getPositions (version) {\n const size = getSymbolSize(version)\n\n return [\n // top-left\n [0, 0],\n // top-right\n [size - FINDER_PATTERN_SIZE, 0],\n // bottom-left\n [0, size - FINDER_PATTERN_SIZE]\n ]\n}\n"],"names":["getSymbolSize","require$$0","FINDER_PATTERN_SIZE","finderPattern","version","size"],"mappings":";;;;;;AAAA,QAAMA,IAAgBC,IAAmB,eACnCC,IAAsB;AAS5B,SAAAC,EAAA,eAAuB,SAAuBC,GAAS;AACrD,UAAMC,IAAOL,EAAcI,CAAO;AAElC,WAAO;AAAA;AAAA,MAEL,CAAC,GAAG,CAAC;AAAA;AAAA,MAEL,CAACC,IAAOH,GAAqB,CAAC;AAAA;AAAA,MAE9B,CAAC,GAAGG,IAAOH,CAAmB;AAAA,IAClC;AAAA,EACA;;","x_google_ignoreList":[0]}
|
package/dist/index124.js
CHANGED
|
@@ -1,69 +1,103 @@
|
|
|
1
|
-
import { __exports as c } from "./
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
bit: 2,
|
|
15
|
-
ccBits: [9, 11, 13]
|
|
16
|
-
}, i.BYTE = {
|
|
17
|
-
id: "Byte",
|
|
18
|
-
bit: 4,
|
|
19
|
-
ccBits: [8, 16, 16]
|
|
20
|
-
}, i.KANJI = {
|
|
21
|
-
id: "Kanji",
|
|
22
|
-
bit: 8,
|
|
23
|
-
ccBits: [8, 10, 12]
|
|
24
|
-
}, i.MIXED = {
|
|
25
|
-
bit: -1
|
|
26
|
-
}, i.getCharCountIndicator = function(r, n) {
|
|
27
|
-
if (!r.ccBits) throw new Error("Invalid mode: " + r);
|
|
28
|
-
if (!a.isValid(n))
|
|
29
|
-
throw new Error("Invalid version: " + n);
|
|
30
|
-
return n >= 1 && n < 10 ? r.ccBits[0] : n < 27 ? r.ccBits[1] : r.ccBits[2];
|
|
31
|
-
}, i.getBestModeForData = function(r) {
|
|
32
|
-
return e.testNumeric(r) ? i.NUMERIC : e.testAlphanumeric(r) ? i.ALPHANUMERIC : e.testKanji(r) ? i.KANJI : i.BYTE;
|
|
33
|
-
}, i.toString = function(r) {
|
|
34
|
-
if (r && r.id) return r.id;
|
|
35
|
-
throw new Error("Invalid mode");
|
|
36
|
-
}, i.isValid = function(r) {
|
|
37
|
-
return r && r.bit && r.ccBits;
|
|
1
|
+
import { __exports as c } from "./index139.js";
|
|
2
|
+
var T;
|
|
3
|
+
function R() {
|
|
4
|
+
return T ? c : (T = 1, (function(r) {
|
|
5
|
+
r.Patterns = {
|
|
6
|
+
PATTERN000: 0,
|
|
7
|
+
PATTERN001: 1,
|
|
8
|
+
PATTERN010: 2,
|
|
9
|
+
PATTERN011: 3,
|
|
10
|
+
PATTERN100: 4,
|
|
11
|
+
PATTERN101: 5,
|
|
12
|
+
PATTERN110: 6,
|
|
13
|
+
PATTERN111: 7
|
|
38
14
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
15
|
+
const u = {
|
|
16
|
+
N1: 3,
|
|
17
|
+
N2: 3,
|
|
18
|
+
N3: 40,
|
|
19
|
+
N4: 10
|
|
20
|
+
};
|
|
21
|
+
r.isValid = function(t) {
|
|
22
|
+
return t != null && t !== "" && !isNaN(t) && t >= 0 && t <= 7;
|
|
23
|
+
}, r.from = function(t) {
|
|
24
|
+
return r.isValid(t) ? parseInt(t, 10) : void 0;
|
|
25
|
+
}, r.getPenaltyN1 = function(t) {
|
|
26
|
+
const l = t.size;
|
|
27
|
+
let s = 0, n = 0, e = 0, i = null, o = null;
|
|
28
|
+
for (let f = 0; f < l; f++) {
|
|
29
|
+
n = e = 0, i = o = null;
|
|
30
|
+
for (let N = 0; N < l; N++) {
|
|
31
|
+
let a = t.get(f, N);
|
|
32
|
+
a === i ? n++ : (n >= 5 && (s += u.N1 + (n - 5)), i = a, n = 1), a = t.get(N, f), a === o ? e++ : (e >= 5 && (s += u.N1 + (e - 5)), o = a, e = 1);
|
|
33
|
+
}
|
|
34
|
+
n >= 5 && (s += u.N1 + (n - 5)), e >= 5 && (s += u.N1 + (e - 5));
|
|
35
|
+
}
|
|
36
|
+
return s;
|
|
37
|
+
}, r.getPenaltyN2 = function(t) {
|
|
38
|
+
const l = t.size;
|
|
39
|
+
let s = 0;
|
|
40
|
+
for (let n = 0; n < l - 1; n++)
|
|
41
|
+
for (let e = 0; e < l - 1; e++) {
|
|
42
|
+
const i = t.get(n, e) + t.get(n, e + 1) + t.get(n + 1, e) + t.get(n + 1, e + 1);
|
|
43
|
+
(i === 4 || i === 0) && s++;
|
|
44
|
+
}
|
|
45
|
+
return s * u.N2;
|
|
46
|
+
}, r.getPenaltyN3 = function(t) {
|
|
47
|
+
const l = t.size;
|
|
48
|
+
let s = 0, n = 0, e = 0;
|
|
49
|
+
for (let i = 0; i < l; i++) {
|
|
50
|
+
n = e = 0;
|
|
51
|
+
for (let o = 0; o < l; o++)
|
|
52
|
+
n = n << 1 & 2047 | t.get(i, o), o >= 10 && (n === 1488 || n === 93) && s++, e = e << 1 & 2047 | t.get(o, i), o >= 10 && (e === 1488 || e === 93) && s++;
|
|
53
|
+
}
|
|
54
|
+
return s * u.N3;
|
|
55
|
+
}, r.getPenaltyN4 = function(t) {
|
|
56
|
+
let l = 0;
|
|
57
|
+
const s = t.data.length;
|
|
58
|
+
for (let e = 0; e < s; e++) l += t.data[e];
|
|
59
|
+
return Math.abs(Math.ceil(l * 100 / s / 5) - 10) * u.N4;
|
|
60
|
+
};
|
|
61
|
+
function g(P, t, l) {
|
|
62
|
+
switch (P) {
|
|
63
|
+
case r.Patterns.PATTERN000:
|
|
64
|
+
return (t + l) % 2 === 0;
|
|
65
|
+
case r.Patterns.PATTERN001:
|
|
66
|
+
return t % 2 === 0;
|
|
67
|
+
case r.Patterns.PATTERN010:
|
|
68
|
+
return l % 3 === 0;
|
|
69
|
+
case r.Patterns.PATTERN011:
|
|
70
|
+
return (t + l) % 3 === 0;
|
|
71
|
+
case r.Patterns.PATTERN100:
|
|
72
|
+
return (Math.floor(t / 2) + Math.floor(l / 3)) % 2 === 0;
|
|
73
|
+
case r.Patterns.PATTERN101:
|
|
74
|
+
return t * l % 2 + t * l % 3 === 0;
|
|
75
|
+
case r.Patterns.PATTERN110:
|
|
76
|
+
return (t * l % 2 + t * l % 3) % 2 === 0;
|
|
77
|
+
case r.Patterns.PATTERN111:
|
|
78
|
+
return (t * l % 3 + (t + l) % 2) % 2 === 0;
|
|
51
79
|
default:
|
|
52
|
-
throw new Error("
|
|
80
|
+
throw new Error("bad maskPattern:" + P);
|
|
53
81
|
}
|
|
54
82
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
83
|
+
r.applyMask = function(t, l) {
|
|
84
|
+
const s = l.size;
|
|
85
|
+
for (let n = 0; n < s; n++)
|
|
86
|
+
for (let e = 0; e < s; e++)
|
|
87
|
+
l.isReserved(e, n) || l.xor(e, n, g(t, e, n));
|
|
88
|
+
}, r.getBestMask = function(t, l) {
|
|
89
|
+
const s = Object.keys(r.Patterns).length;
|
|
90
|
+
let n = 0, e = 1 / 0;
|
|
91
|
+
for (let i = 0; i < s; i++) {
|
|
92
|
+
l(i), r.applyMask(i, t);
|
|
93
|
+
const o = r.getPenaltyN1(t) + r.getPenaltyN2(t) + r.getPenaltyN3(t) + r.getPenaltyN4(t);
|
|
94
|
+
r.applyMask(i, t), o < e && (e = o, n = i);
|
|
62
95
|
}
|
|
96
|
+
return n;
|
|
63
97
|
};
|
|
64
98
|
})(c), c);
|
|
65
99
|
}
|
|
66
100
|
export {
|
|
67
|
-
|
|
101
|
+
R as __require
|
|
68
102
|
};
|
|
69
103
|
//# sourceMappingURL=index124.js.map
|
package/dist/index124.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index124.js","sources":["../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"],"sourcesContent":["const VersionCheck = require('./version-check')\nconst Regex = require('./regex')\n\n/**\n * Numeric mode encodes data from the decimal digit set (0 - 9)\n * (byte values 30HEX to 39HEX).\n * Normally, 3 data characters are represented by 10 bits.\n *\n * @type {Object}\n */\nexports.NUMERIC = {\n id: 'Numeric',\n bit: 1 << 0,\n ccBits: [10, 12, 14]\n}\n\n/**\n * Alphanumeric mode encodes data from a set of 45 characters,\n * i.e. 10 numeric digits (0 - 9),\n * 26 alphabetic characters (A - Z),\n * and 9 symbols (SP, $, %, *, +, -, ., /, :).\n * Normally, two input characters are represented by 11 bits.\n *\n * @type {Object}\n */\nexports.ALPHANUMERIC = {\n id: 'Alphanumeric',\n bit: 1 << 1,\n ccBits: [9, 11, 13]\n}\n\n/**\n * In byte mode, data is encoded at 8 bits per character.\n *\n * @type {Object}\n */\nexports.BYTE = {\n id: 'Byte',\n bit: 1 << 2,\n ccBits: [8, 16, 16]\n}\n\n/**\n * The Kanji mode efficiently encodes Kanji characters in accordance with\n * the Shift JIS system based on JIS X 0208.\n * The Shift JIS values are shifted from the JIS X 0208 values.\n * JIS X 0208 gives details of the shift coded representation.\n * Each two-byte character value is compacted to a 13-bit binary codeword.\n *\n * @type {Object}\n */\nexports.KANJI = {\n id: 'Kanji',\n bit: 1 << 3,\n ccBits: [8, 10, 12]\n}\n\n/**\n * Mixed mode will contain a sequences of data in a combination of any of\n * the modes described above\n *\n * @type {Object}\n */\nexports.MIXED = {\n bit: -1\n}\n\n/**\n * Returns the number of bits needed to store the data length\n * according to QR Code specifications.\n *\n * @param {Mode} mode Data mode\n * @param {Number} version QR Code version\n * @return {Number} Number of bits\n */\nexports.getCharCountIndicator = function getCharCountIndicator (mode, version) {\n if (!mode.ccBits) throw new Error('Invalid mode: ' + mode)\n\n if (!VersionCheck.isValid(version)) {\n throw new Error('Invalid version: ' + version)\n }\n\n if (version >= 1 && version < 10) return mode.ccBits[0]\n else if (version < 27) return mode.ccBits[1]\n return mode.ccBits[2]\n}\n\n/**\n * Returns the most efficient mode to store the specified data\n *\n * @param {String} dataStr Input data string\n * @return {Mode} Best mode\n */\nexports.getBestModeForData = function getBestModeForData (dataStr) {\n if (Regex.testNumeric(dataStr)) return exports.NUMERIC\n else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC\n else if (Regex.testKanji(dataStr)) return exports.KANJI\n else return exports.BYTE\n}\n\n/**\n * Return mode name as string\n *\n * @param {Mode} mode Mode object\n * @returns {String} Mode name\n */\nexports.toString = function toString (mode) {\n if (mode && mode.id) return mode.id\n throw new Error('Invalid mode')\n}\n\n/**\n * Check if input param is a valid mode object\n *\n * @param {Mode} mode Mode object\n * @returns {Boolean} True if valid mode, false otherwise\n */\nexports.isValid = function isValid (mode) {\n return mode && mode.bit && mode.ccBits\n}\n\n/**\n * Get mode object from its name\n *\n * @param {String} string Mode name\n * @returns {Mode} Mode object\n */\nfunction fromString (string) {\n if (typeof string !== 'string') {\n throw new Error('Param is not a string')\n }\n\n const lcStr = string.toLowerCase()\n\n switch (lcStr) {\n case 'numeric':\n return exports.NUMERIC\n case 'alphanumeric':\n return exports.ALPHANUMERIC\n case 'kanji':\n return exports.KANJI\n case 'byte':\n return exports.BYTE\n default:\n throw new Error('Unknown mode: ' + string)\n }\n}\n\n/**\n * Returns mode from a value.\n * If value is not a valid mode, returns defaultValue\n *\n * @param {Mode|String} value Encoding mode\n * @param {Mode} defaultValue Fallback value\n * @return {Mode} Encoding mode\n */\nexports.from = function from (value, defaultValue) {\n if (exports.isValid(value)) {\n return value\n }\n\n try {\n return fromString(value)\n } catch (e) {\n return defaultValue\n }\n}\n"],"names":["VersionCheck","require$$0","Regex","require$$1","exports","mode","version","dataStr","fromString","string","value","defaultValue"],"mappings":";;;;;;AAAA,UAAMA,IAAeC,EAAA,GACfC,IAAQC,EAAA;AASdC,IAAAA,EAAA,UAAkB;AAAA,MAChB,IAAI;AAAA,MACJ,KAAK;AAAA,MACL,QAAQ,CAAC,IAAI,IA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,YAAW,GAEnB;AAAA,QACX,KAAK;AACH,iBAAOL,EAAQ;AAAA,QACjB,KAAK;AACH,iBAAOA,EAAQ;AAAA,QACjB,KAAK;AACH,iBAAOA,EAAQ;AAAA,QACjB,KAAK;AACH,iBAAOA,EAAQ;AAAA,QACjB;AACE,gBAAM,IAAI,MAAM,mBAAmBK,CAAM;AAAA,MAC/C;AAAA,IACA;AAUAL,IAAAA,EAAA,OAAe,SAAeM,GAAOC,GAAc;AACjD,UAAIP,EAAQ,QAAQM,CAAK;AACvB,eAAOA;AAGT,UAAI;AACF,eAAOF,EAAWE,CAAK;AAAA,MAC3B,QAAc;AACV,eAAOC;AAAA,MACX;AAAA,IACA;AAAA;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index124.js","sources":["../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js"],"sourcesContent":["/**\n * Data mask pattern reference\n * @type {Object}\n */\nexports.Patterns = {\n PATTERN000: 0,\n PATTERN001: 1,\n PATTERN010: 2,\n PATTERN011: 3,\n PATTERN100: 4,\n PATTERN101: 5,\n PATTERN110: 6,\n PATTERN111: 7\n}\n\n/**\n * Weighted penalty scores for the undesirable features\n * @type {Object}\n */\nconst PenaltyScores = {\n N1: 3,\n N2: 3,\n N3: 40,\n N4: 10\n}\n\n/**\n * Check if mask pattern value is valid\n *\n * @param {Number} mask Mask pattern\n * @return {Boolean} true if valid, false otherwise\n */\nexports.isValid = function isValid (mask) {\n return mask != null && mask !== '' && !isNaN(mask) && mask >= 0 && mask <= 7\n}\n\n/**\n * Returns mask pattern from a value.\n * If value is not valid, returns undefined\n *\n * @param {Number|String} value Mask pattern value\n * @return {Number} Valid mask pattern or undefined\n */\nexports.from = function from (value) {\n return exports.isValid(value) ? parseInt(value, 10) : undefined\n}\n\n/**\n* Find adjacent modules in row/column with the same color\n* and assign a penalty value.\n*\n* Points: N1 + i\n* i is the amount by which the number of adjacent modules of the same color exceeds 5\n*/\nexports.getPenaltyN1 = function getPenaltyN1 (data) {\n const size = data.size\n let points = 0\n let sameCountCol = 0\n let sameCountRow = 0\n let lastCol = null\n let lastRow = null\n\n for (let row = 0; row < size; row++) {\n sameCountCol = sameCountRow = 0\n lastCol = lastRow = null\n\n for (let col = 0; col < size; col++) {\n let module = data.get(row, col)\n if (module === lastCol) {\n sameCountCol++\n } else {\n if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5)\n lastCol = module\n sameCountCol = 1\n }\n\n module = data.get(col, row)\n if (module === lastRow) {\n sameCountRow++\n } else {\n if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5)\n lastRow = module\n sameCountRow = 1\n }\n }\n\n if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5)\n if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5)\n }\n\n return points\n}\n\n/**\n * Find 2x2 blocks with the same color and assign a penalty value\n *\n * Points: N2 * (m - 1) * (n - 1)\n */\nexports.getPenaltyN2 = function getPenaltyN2 (data) {\n const size = data.size\n let points = 0\n\n for (let row = 0; row < size - 1; row++) {\n for (let col = 0; col < size - 1; col++) {\n const last = data.get(row, col) +\n data.get(row, col + 1) +\n data.get(row + 1, col) +\n data.get(row + 1, col + 1)\n\n if (last === 4 || last === 0) points++\n }\n }\n\n return points * PenaltyScores.N2\n}\n\n/**\n * Find 1:1:3:1:1 ratio (dark:light:dark:light:dark) pattern in row/column,\n * preceded or followed by light area 4 modules wide\n *\n * Points: N3 * number of pattern found\n */\nexports.getPenaltyN3 = function getPenaltyN3 (data) {\n const size = data.size\n let points = 0\n let bitsCol = 0\n let bitsRow = 0\n\n for (let row = 0; row < size; row++) {\n bitsCol = bitsRow = 0\n for (let col = 0; col < size; col++) {\n bitsCol = ((bitsCol << 1) & 0x7FF) | data.get(row, col)\n if (col >= 10 && (bitsCol === 0x5D0 || bitsCol === 0x05D)) points++\n\n bitsRow = ((bitsRow << 1) & 0x7FF) | data.get(col, row)\n if (col >= 10 && (bitsRow === 0x5D0 || bitsRow === 0x05D)) points++\n }\n }\n\n return points * PenaltyScores.N3\n}\n\n/**\n * Calculate proportion of dark modules in entire symbol\n *\n * Points: N4 * k\n *\n * k is the rating of the deviation of the proportion of dark modules\n * in the symbol from 50% in steps of 5%\n */\nexports.getPenaltyN4 = function getPenaltyN4 (data) {\n let darkCount = 0\n const modulesCount = data.data.length\n\n for (let i = 0; i < modulesCount; i++) darkCount += data.data[i]\n\n const k = Math.abs(Math.ceil((darkCount * 100 / modulesCount) / 5) - 10)\n\n return k * PenaltyScores.N4\n}\n\n/**\n * Return mask value at given position\n *\n * @param {Number} maskPattern Pattern reference value\n * @param {Number} i Row\n * @param {Number} j Column\n * @return {Boolean} Mask value\n */\nfunction getMaskAt (maskPattern, i, j) {\n switch (maskPattern) {\n case exports.Patterns.PATTERN000: return (i + j) % 2 === 0\n case exports.Patterns.PATTERN001: return i % 2 === 0\n case exports.Patterns.PATTERN010: return j % 3 === 0\n case exports.Patterns.PATTERN011: return (i + j) % 3 === 0\n case exports.Patterns.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0\n case exports.Patterns.PATTERN101: return (i * j) % 2 + (i * j) % 3 === 0\n case exports.Patterns.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 === 0\n case exports.Patterns.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 === 0\n\n default: throw new Error('bad maskPattern:' + maskPattern)\n }\n}\n\n/**\n * Apply a mask pattern to a BitMatrix\n *\n * @param {Number} pattern Pattern reference number\n * @param {BitMatrix} data BitMatrix data\n */\nexports.applyMask = function applyMask (pattern, data) {\n const size = data.size\n\n for (let col = 0; col < size; col++) {\n for (let row = 0; row < size; row++) {\n if (data.isReserved(row, col)) continue\n data.xor(row, col, getMaskAt(pattern, row, col))\n }\n }\n}\n\n/**\n * Returns the best mask pattern for data\n *\n * @param {BitMatrix} data\n * @return {Number} Mask pattern reference number\n */\nexports.getBestMask = function getBestMask (data, setupFormatFunc) {\n const numPatterns = Object.keys(exports.Patterns).length\n let bestPattern = 0\n let lowerPenalty = Infinity\n\n for (let p = 0; p < numPatterns; p++) {\n setupFormatFunc(p)\n exports.applyMask(p, data)\n\n // Calculate penalty\n const penalty =\n exports.getPenaltyN1(data) +\n exports.getPenaltyN2(data) +\n exports.getPenaltyN3(data) +\n exports.getPenaltyN4(data)\n\n // Undo previously applied mask\n exports.applyMask(p, data)\n\n if (penalty < lowerPenalty) {\n lowerPenalty = penalty\n bestPattern = p\n }\n }\n\n return bestPattern\n}\n"],"names":["exports","PenaltyScores","mask","value","data","size","points","sameCountCol","sameCountRow","lastCol","lastRow","row","col","module","last","bitsCol","bitsRow","darkCount","modulesCount","i","getMaskAt","maskPattern","j","pattern","setupFormatFunc","numPatterns","bestPattern","lowerPenalty","p","penalty"],"mappings":";;;;AAIAA,IAAAA,EAAA,WAAmB;AAAA,MACjB,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,IACd;AAMA,UAAMC,IAAgB;AAAA,MACpB,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAQAD,IAAAA,EAAA,UAAkB,SAAkBE,GAAM;AACxC,aAAOA,KAAQ,QAAQA,MAAS,MAAM,CAAC,MAAMA,CAAI,KAAKA,KAAQ,KAAKA,KAAQ;AAAA,IAC7E,GASAF,EAAA,OAAe,SAAeG,GAAO;AACnC,aAAOH,EAAQ,QAAQG,CAAK,IAAI,SAASA,GAAO,EAAE,IAAI;AAAA,IACxD,GASAH,EAAA,eAAuB,SAAuBI,GAAM;AAClD,YAAMC,IAAOD,EAAK;AAClB,UAAIE,IAAS,GACTC,IAAe,GACfC,IAAe,GACfC,IAAU,MACVC,IAAU;AAEd,eAASC,IAAM,GAAGA,IAAMN,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