@mcistudio/unoui-vue 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -0
- package/dist/alert/Alert.vue.d.ts +67 -0
- package/dist/alert/index.d.ts +40 -0
- package/dist/alert/index.js +2 -0
- package/dist/attrs.d.ts +11 -0
- package/dist/attrs.js +16 -0
- package/dist/attrs.js.map +1 -0
- package/dist/badge/Badge.vue.d.ts +57 -0
- package/dist/badge/BadgeRibbon.vue.d.ts +34 -0
- package/dist/badge/index.d.ts +42 -0
- package/dist/badge/index.js +2 -0
- package/dist/build.d.ts +2 -0
- package/dist/button/Button.vue.d.ts +46 -0
- package/dist/button/ButtonGroup.vue.d.ts +13 -0
- package/dist/button/index.d.ts +13 -0
- package/dist/button/index.js +2 -0
- package/dist/checkbox/Checkbox.vue.d.ts +47 -0
- package/dist/checkbox/CheckboxGroup.vue.d.ts +38 -0
- package/dist/checkbox/index.d.ts +30 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/chunks/Progress-BL4KZ3HE.js +271 -0
- package/dist/chunks/Progress-BL4KZ3HE.js.map +1 -0
- package/dist/chunks/Skeleton-ohStUD4M.js +153 -0
- package/dist/chunks/Skeleton-ohStUD4M.js.map +1 -0
- package/dist/chunks/Table-DhXmuKQd.js +330 -0
- package/dist/chunks/Table-DhXmuKQd.js.map +1 -0
- package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
- package/dist/chunks/alert-CczW_DKs.js +190 -0
- package/dist/chunks/alert-CczW_DKs.js.map +1 -0
- package/dist/chunks/badge-BHOZeImh.js +287 -0
- package/dist/chunks/badge-BHOZeImh.js.map +1 -0
- package/dist/chunks/button-pDObrN_X.js +168 -0
- package/dist/chunks/button-pDObrN_X.js.map +1 -0
- package/dist/chunks/checkbox-9_0oR4kg.js +260 -0
- package/dist/chunks/checkbox-9_0oR4kg.js.map +1 -0
- package/dist/chunks/colorpicker-CcizUCQv.js +594 -0
- package/dist/chunks/colorpicker-CcizUCQv.js.map +1 -0
- package/dist/chunks/datepicker-Cy808x7X.js +1414 -0
- package/dist/chunks/datepicker-Cy808x7X.js.map +1 -0
- package/dist/chunks/drawer-C3JZ28Xo.js +193 -0
- package/dist/chunks/drawer-C3JZ28Xo.js.map +1 -0
- package/dist/chunks/dropdown-0l967g7D.js +329 -0
- package/dist/chunks/dropdown-0l967g7D.js.map +1 -0
- package/dist/chunks/form-Qeqkd-HH.js +642 -0
- package/dist/chunks/form-Qeqkd-HH.js.map +1 -0
- package/dist/chunks/input-BDOXVCrK.js +1281 -0
- package/dist/chunks/input-BDOXVCrK.js.map +1 -0
- package/dist/chunks/inputOtp-Dyxj9lNj.js +261 -0
- package/dist/chunks/inputOtp-Dyxj9lNj.js.map +1 -0
- package/dist/chunks/message-xPfuG0EX.js +107 -0
- package/dist/chunks/message-xPfuG0EX.js.map +1 -0
- package/dist/chunks/millercolumns-Dp3fBrq6.js +426 -0
- package/dist/chunks/millercolumns-Dp3fBrq6.js.map +1 -0
- package/dist/chunks/modal-D6l1iIvE.js +81 -0
- package/dist/chunks/modal-D6l1iIvE.js.map +1 -0
- package/dist/chunks/pagination-Bc583AQX.js +265 -0
- package/dist/chunks/pagination-Bc583AQX.js.map +1 -0
- package/dist/chunks/popconfirm-D6lUfSxG.js +343 -0
- package/dist/chunks/popconfirm-D6lUfSxG.js.map +1 -0
- package/dist/chunks/qrcode-B0t_pZna.js +1099 -0
- package/dist/chunks/qrcode-B0t_pZna.js.map +1 -0
- package/dist/chunks/radio-DnYm59xH.js +477 -0
- package/dist/chunks/radio-DnYm59xH.js.map +1 -0
- package/dist/chunks/rate-0sme__Kb.js +309 -0
- package/dist/chunks/rate-0sme__Kb.js.map +1 -0
- package/dist/chunks/select-ChTfQM5u.js +417 -0
- package/dist/chunks/select-ChTfQM5u.js.map +1 -0
- package/dist/chunks/slider-C-W5GzTP.js +724 -0
- package/dist/chunks/slider-C-W5GzTP.js.map +1 -0
- package/dist/chunks/splitter-CgfiXY65.js +524 -0
- package/dist/chunks/splitter-CgfiXY65.js.map +1 -0
- package/dist/chunks/switch-BULGbODP.js +327 -0
- package/dist/chunks/switch-BULGbODP.js.map +1 -0
- package/dist/chunks/tab-Dxfg1_To.js +663 -0
- package/dist/chunks/tab-Dxfg1_To.js.map +1 -0
- package/dist/chunks/tag-BYmNsrZC.js +167 -0
- package/dist/chunks/tag-BYmNsrZC.js.map +1 -0
- package/dist/chunks/timepicker-DsGIdcf8.js +1059 -0
- package/dist/chunks/timepicker-DsGIdcf8.js.map +1 -0
- package/dist/chunks/tooltip-DMhiAqto.js +242 -0
- package/dist/chunks/tooltip-DMhiAqto.js.map +1 -0
- package/dist/colorpicker/ColorPicker.vue.d.ts +30 -0
- package/dist/colorpicker/color.d.ts +56 -0
- package/dist/colorpicker/color.js +99 -0
- package/dist/colorpicker/color.js.map +1 -0
- package/dist/colorpicker/index.d.ts +12 -0
- package/dist/colorpicker/index.js +2 -0
- package/dist/config.d.ts +55 -0
- package/dist/config.js +260 -0
- package/dist/config.js.map +1 -0
- package/dist/datepicker/DatePicker.vue.d.ts +82 -0
- package/dist/datepicker/RangePicker.vue.d.ts +87 -0
- package/dist/datepicker/index.d.ts +59 -0
- package/dist/datepicker/index.js +2 -0
- package/dist/drawer/Drawer.vue.d.ts +86 -0
- package/dist/drawer/index.d.ts +23 -0
- package/dist/drawer/index.js +2 -0
- package/dist/dropdown/Dropdown.vue.d.ts +118 -0
- package/dist/dropdown/index.d.ts +2 -0
- package/dist/dropdown/index.js +2 -0
- package/dist/form/Form.vue.d.ts +170 -0
- package/dist/form/FormItem.vue.d.ts +83 -0
- package/dist/form/index.d.ts +176 -0
- package/dist/form/index.js +2 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +32 -0
- package/dist/input/Autocomplete.vue.d.ts +121 -0
- package/dist/input/Input.vue.d.ts +142 -0
- package/dist/input/InputI18n.vue.d.ts +80 -0
- package/dist/input/InputTag.vue.d.ts +114 -0
- package/dist/input/index.d.ts +41 -0
- package/dist/input/index.js +2 -0
- package/dist/inputOtp/InputOtp.vue.d.ts +60 -0
- package/dist/inputOtp/index.d.ts +21 -0
- package/dist/inputOtp/index.js +2 -0
- package/dist/message/MessageContainer.vue.d.ts +11 -0
- package/dist/message/index.d.ts +20 -0
- package/dist/message/index.js +2 -0
- package/dist/message/types.d.ts +25 -0
- package/dist/millercolumns/MillerColumns.vue.d.ts +88 -0
- package/dist/millercolumns/index.d.ts +39 -0
- package/dist/millercolumns/index.js +2 -0
- package/dist/modal/Modal.vue.d.ts +54 -0
- package/dist/modal/index.d.ts +2 -0
- package/dist/modal/index.js +2 -0
- package/dist/pagination/Pagination.vue.d.ts +70 -0
- package/dist/pagination/index.d.ts +12 -0
- package/dist/pagination/index.js +2 -0
- package/dist/popconfirm/Popconfirm.vue.d.ts +104 -0
- package/dist/popconfirm/index.d.ts +36 -0
- package/dist/popconfirm/index.js +2 -0
- package/dist/progress/Progress.vue.d.ts +64 -0
- package/dist/progress/index.d.ts +26 -0
- package/dist/progress/index.js +2 -0
- package/dist/qrcode/QRCode.vue.d.ts +87 -0
- package/dist/qrcode/index.d.ts +43 -0
- package/dist/qrcode/index.js +2 -0
- package/dist/qrcode/qr.d.ts +51 -0
- package/dist/qrcode/qrcodegen.d.ts +94 -0
- package/dist/radio/Radio.vue.d.ts +52 -0
- package/dist/radio/RadioGroup.vue.d.ts +44 -0
- package/dist/radio/index.d.ts +55 -0
- package/dist/radio/index.js +2 -0
- package/dist/rate/Rate.vue.d.ts +100 -0
- package/dist/rate/index.d.ts +38 -0
- package/dist/rate/index.js +2 -0
- package/dist/select/Select.vue.d.ts +129 -0
- package/dist/select/index.d.ts +33 -0
- package/dist/select/index.js +2 -0
- package/dist/skeleton/Skeleton.vue.d.ts +31 -0
- package/dist/skeleton/index.d.ts +2 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/slider/Slider.vue.d.ts +81 -0
- package/dist/slider/index.d.ts +61 -0
- package/dist/slider/index.js +2 -0
- package/dist/splitter/Splitter.vue.d.ts +63 -0
- package/dist/splitter/SplitterPanel.vue.d.ts +53 -0
- package/dist/splitter/index.d.ts +39 -0
- package/dist/splitter/index.js +2 -0
- package/dist/style.css +2 -0
- package/dist/switch/Switch.vue.d.ts +97 -0
- package/dist/switch/index.d.ts +31 -0
- package/dist/switch/index.js +2 -0
- package/dist/tab/TabPane.vue.d.ts +32 -0
- package/dist/tab/Tabs.vue.d.ts +87 -0
- package/dist/tab/index.d.ts +78 -0
- package/dist/tab/index.js +2 -0
- package/dist/table/Table.vue.d.ts +96 -0
- package/dist/table/index.d.ts +3 -0
- package/dist/table/index.js +2 -0
- package/dist/table/types.d.ts +35 -0
- package/dist/table/types.js +0 -0
- package/dist/tag/Tag.vue.d.ts +46 -0
- package/dist/tag/index.d.ts +11 -0
- package/dist/tag/index.js +2 -0
- package/dist/timepicker/TimePicker.vue.d.ts +92 -0
- package/dist/timepicker/TimeRangePicker.vue.d.ts +90 -0
- package/dist/timepicker/index.d.ts +39 -0
- package/dist/timepicker/index.js +2 -0
- package/dist/tooltip/Tooltip.vue.d.ts +79 -0
- package/dist/tooltip/index.d.ts +14 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/uno.d.ts +32 -0
- package/dist/uno.js +83 -0
- package/dist/uno.js.map +1 -0
- package/dist/utils/DnD.d.ts +38 -0
- package/package.json +115 -0
|
@@ -0,0 +1,1099 @@
|
|
|
1
|
+
import { cva as e } from "class-variance-authority";
|
|
2
|
+
import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, mergeProps as s, nextTick as c, normalizeClass as l, normalizeProps as u, normalizeStyle as d, onMounted as f, openBlock as p, ref as m, renderSlot as ee, toDisplayString as h, unref as g, watch as te } from "vue";
|
|
3
|
+
import { clsx as _ } from "clsx";
|
|
4
|
+
//#region src/qrcode/qrcodegen.ts
|
|
5
|
+
var v;
|
|
6
|
+
(function(e) {
|
|
7
|
+
class t {
|
|
8
|
+
version;
|
|
9
|
+
errorCorrectionLevel;
|
|
10
|
+
static encodeText(e, n) {
|
|
11
|
+
let r = v.QrSegment.makeSegments(e);
|
|
12
|
+
return t.encodeSegments(r, n);
|
|
13
|
+
}
|
|
14
|
+
static encodeBinary(e, n) {
|
|
15
|
+
let r = v.QrSegment.makeBytes(e);
|
|
16
|
+
return t.encodeSegments([r], n);
|
|
17
|
+
}
|
|
18
|
+
static encodeSegments(e, r, o = 1, s = 40, c = -1, l = !0) {
|
|
19
|
+
if (!(t.MIN_VERSION <= o && o <= s && s <= t.MAX_VERSION) || c < -1 || c > 7) throw RangeError("Invalid value");
|
|
20
|
+
let u, d;
|
|
21
|
+
for (u = o;; u++) {
|
|
22
|
+
let n = t.getNumDataCodewords(u, r) * 8, i = a.getTotalBits(e, u);
|
|
23
|
+
if (i <= n) {
|
|
24
|
+
d = i;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
if (u >= s) throw RangeError("Data too long");
|
|
28
|
+
}
|
|
29
|
+
for (let e of [
|
|
30
|
+
t.Ecc.MEDIUM,
|
|
31
|
+
t.Ecc.QUARTILE,
|
|
32
|
+
t.Ecc.HIGH
|
|
33
|
+
]) l && d <= t.getNumDataCodewords(u, e) * 8 && (r = e);
|
|
34
|
+
let f = [];
|
|
35
|
+
for (let t of e) {
|
|
36
|
+
n(t.mode.modeBits, 4, f), n(t.numChars, t.mode.numCharCountBits(u), f);
|
|
37
|
+
for (let e of t.getData()) f.push(e);
|
|
38
|
+
}
|
|
39
|
+
i(f.length == d);
|
|
40
|
+
let p = t.getNumDataCodewords(u, r) * 8;
|
|
41
|
+
i(f.length <= p), n(0, Math.min(4, p - f.length), f), n(0, (8 - f.length % 8) % 8, f), i(f.length % 8 == 0);
|
|
42
|
+
for (let e = 236; f.length < p; e ^= 253) n(e, 8, f);
|
|
43
|
+
let m = [];
|
|
44
|
+
for (; m.length * 8 < f.length;) m.push(0);
|
|
45
|
+
return f.forEach((e, t) => m[t >>> 3] |= e << 7 - (t & 7)), new t(u, r, m, c);
|
|
46
|
+
}
|
|
47
|
+
size;
|
|
48
|
+
mask;
|
|
49
|
+
modules = [];
|
|
50
|
+
isFunction = [];
|
|
51
|
+
constructor(e, n, r, a) {
|
|
52
|
+
if (this.version = e, this.errorCorrectionLevel = n, e < t.MIN_VERSION || e > t.MAX_VERSION) throw RangeError("Version value out of range");
|
|
53
|
+
if (a < -1 || a > 7) throw RangeError("Mask value out of range");
|
|
54
|
+
this.size = e * 4 + 17;
|
|
55
|
+
let o = [];
|
|
56
|
+
for (let e = 0; e < this.size; e++) o.push(!1);
|
|
57
|
+
for (let e = 0; e < this.size; e++) this.modules.push(o.slice()), this.isFunction.push(o.slice());
|
|
58
|
+
this.drawFunctionPatterns();
|
|
59
|
+
let s = this.addEccAndInterleave(r);
|
|
60
|
+
if (this.drawCodewords(s), a == -1) {
|
|
61
|
+
let e = 1e9;
|
|
62
|
+
for (let t = 0; t < 8; t++) {
|
|
63
|
+
this.applyMask(t), this.drawFormatBits(t);
|
|
64
|
+
let n = this.getPenaltyScore();
|
|
65
|
+
n < e && (a = t, e = n), this.applyMask(t);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
i(0 <= a && a <= 7), this.mask = a, this.applyMask(a), this.drawFormatBits(a), this.isFunction = [];
|
|
69
|
+
}
|
|
70
|
+
getModule(e, t) {
|
|
71
|
+
return 0 <= e && e < this.size && 0 <= t && t < this.size && this.modules[t][e];
|
|
72
|
+
}
|
|
73
|
+
drawFunctionPatterns() {
|
|
74
|
+
for (let e = 0; e < this.size; e++) this.setFunctionModule(6, e, e % 2 == 0), this.setFunctionModule(e, 6, e % 2 == 0);
|
|
75
|
+
this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
|
|
76
|
+
let e = this.getAlignmentPatternPositions(), t = e.length;
|
|
77
|
+
for (let n = 0; n < t; n++) for (let r = 0; r < t; r++) n == 0 && r == 0 || n == 0 && r == t - 1 || n == t - 1 && r == 0 || this.drawAlignmentPattern(e[n], e[r]);
|
|
78
|
+
this.drawFormatBits(0), this.drawVersion();
|
|
79
|
+
}
|
|
80
|
+
drawFormatBits(e) {
|
|
81
|
+
let t = this.errorCorrectionLevel.formatBits << 3 | e, n = t;
|
|
82
|
+
for (let e = 0; e < 10; e++) n = n << 1 ^ (n >>> 9) * 1335;
|
|
83
|
+
let a = (t << 10 | n) ^ 21522;
|
|
84
|
+
i(a >>> 15 == 0);
|
|
85
|
+
for (let e = 0; e <= 5; e++) this.setFunctionModule(8, e, r(a, e));
|
|
86
|
+
this.setFunctionModule(8, 7, r(a, 6)), this.setFunctionModule(8, 8, r(a, 7)), this.setFunctionModule(7, 8, r(a, 8));
|
|
87
|
+
for (let e = 9; e < 15; e++) this.setFunctionModule(14 - e, 8, r(a, e));
|
|
88
|
+
for (let e = 0; e < 8; e++) this.setFunctionModule(this.size - 1 - e, 8, r(a, e));
|
|
89
|
+
for (let e = 8; e < 15; e++) this.setFunctionModule(8, this.size - 15 + e, r(a, e));
|
|
90
|
+
this.setFunctionModule(8, this.size - 8, !0);
|
|
91
|
+
}
|
|
92
|
+
drawVersion() {
|
|
93
|
+
if (this.version < 7) return;
|
|
94
|
+
let e = this.version;
|
|
95
|
+
for (let t = 0; t < 12; t++) e = e << 1 ^ (e >>> 11) * 7973;
|
|
96
|
+
let t = this.version << 12 | e;
|
|
97
|
+
i(t >>> 18 == 0);
|
|
98
|
+
for (let e = 0; e < 18; e++) {
|
|
99
|
+
let n = r(t, e), i = this.size - 11 + e % 3, a = Math.floor(e / 3);
|
|
100
|
+
this.setFunctionModule(i, a, n), this.setFunctionModule(a, i, n);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
drawFinderPattern(e, t) {
|
|
104
|
+
for (let n = -4; n <= 4; n++) for (let r = -4; r <= 4; r++) {
|
|
105
|
+
let i = Math.max(Math.abs(r), Math.abs(n)), a = e + r, o = t + n;
|
|
106
|
+
0 <= a && a < this.size && 0 <= o && o < this.size && this.setFunctionModule(a, o, i != 2 && i != 4);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
drawAlignmentPattern(e, t) {
|
|
110
|
+
for (let n = -2; n <= 2; n++) for (let r = -2; r <= 2; r++) this.setFunctionModule(e + r, t + n, Math.max(Math.abs(r), Math.abs(n)) != 1);
|
|
111
|
+
}
|
|
112
|
+
setFunctionModule(e, t, n) {
|
|
113
|
+
this.modules[t][e] = n, this.isFunction[t][e] = !0;
|
|
114
|
+
}
|
|
115
|
+
addEccAndInterleave(e) {
|
|
116
|
+
let n = this.version, r = this.errorCorrectionLevel;
|
|
117
|
+
if (e.length != t.getNumDataCodewords(n, r)) throw RangeError("Invalid argument");
|
|
118
|
+
let a = t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n], o = t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n], s = Math.floor(t.getNumRawDataModules(n) / 8), c = a - s % a, l = Math.floor(s / a), u = [], d = t.reedSolomonComputeDivisor(o);
|
|
119
|
+
for (let n = 0, r = 0; n < a; n++) {
|
|
120
|
+
let i = e.slice(r, r + l - o + (n < c ? 0 : 1));
|
|
121
|
+
r += i.length;
|
|
122
|
+
let a = t.reedSolomonComputeRemainder(i, d);
|
|
123
|
+
n < c && i.push(0), u.push(i.concat(a));
|
|
124
|
+
}
|
|
125
|
+
let f = [];
|
|
126
|
+
for (let e = 0; e < u[0].length; e++) u.forEach((t, n) => {
|
|
127
|
+
(e != l - o || n >= c) && f.push(t[e]);
|
|
128
|
+
});
|
|
129
|
+
return i(f.length == s), f;
|
|
130
|
+
}
|
|
131
|
+
drawCodewords(e) {
|
|
132
|
+
if (e.length != Math.floor(t.getNumRawDataModules(this.version) / 8)) throw RangeError("Invalid argument");
|
|
133
|
+
let n = 0;
|
|
134
|
+
for (let t = this.size - 1; t >= 1; t -= 2) {
|
|
135
|
+
t == 6 && (t = 5);
|
|
136
|
+
for (let i = 0; i < this.size; i++) for (let a = 0; a < 2; a++) {
|
|
137
|
+
let o = t - a, s = t + 1 & 2 ? i : this.size - 1 - i;
|
|
138
|
+
!this.isFunction[s][o] && n < e.length * 8 && (this.modules[s][o] = r(e[n >>> 3], 7 - (n & 7)), n++);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
i(n == e.length * 8);
|
|
142
|
+
}
|
|
143
|
+
applyMask(e) {
|
|
144
|
+
if (e < 0 || e > 7) throw RangeError("Mask value out of range");
|
|
145
|
+
for (let t = 0; t < this.size; t++) for (let n = 0; n < this.size; n++) {
|
|
146
|
+
let r;
|
|
147
|
+
switch (e) {
|
|
148
|
+
case 0:
|
|
149
|
+
r = (n + t) % 2 == 0;
|
|
150
|
+
break;
|
|
151
|
+
case 1:
|
|
152
|
+
r = t % 2 == 0;
|
|
153
|
+
break;
|
|
154
|
+
case 2:
|
|
155
|
+
r = n % 3 == 0;
|
|
156
|
+
break;
|
|
157
|
+
case 3:
|
|
158
|
+
r = (n + t) % 3 == 0;
|
|
159
|
+
break;
|
|
160
|
+
case 4:
|
|
161
|
+
r = (Math.floor(n / 3) + Math.floor(t / 2)) % 2 == 0;
|
|
162
|
+
break;
|
|
163
|
+
case 5:
|
|
164
|
+
r = n * t % 2 + n * t % 3 == 0;
|
|
165
|
+
break;
|
|
166
|
+
case 6:
|
|
167
|
+
r = (n * t % 2 + n * t % 3) % 2 == 0;
|
|
168
|
+
break;
|
|
169
|
+
case 7:
|
|
170
|
+
r = ((n + t) % 2 + n * t % 3) % 2 == 0;
|
|
171
|
+
break;
|
|
172
|
+
default: throw Error("Unreachable");
|
|
173
|
+
}
|
|
174
|
+
!this.isFunction[t][n] && r && (this.modules[t][n] = !this.modules[t][n]);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
getPenaltyScore() {
|
|
178
|
+
let e = 0;
|
|
179
|
+
for (let n = 0; n < this.size; n++) {
|
|
180
|
+
let r = !1, i = 0, a = [
|
|
181
|
+
0,
|
|
182
|
+
0,
|
|
183
|
+
0,
|
|
184
|
+
0,
|
|
185
|
+
0,
|
|
186
|
+
0,
|
|
187
|
+
0
|
|
188
|
+
];
|
|
189
|
+
for (let o = 0; o < this.size; o++) this.modules[n][o] == r ? (i++, i == 5 ? e += t.PENALTY_N1 : i > 5 && e++) : (this.finderPenaltyAddHistory(i, a), r || (e += this.finderPenaltyCountPatterns(a) * t.PENALTY_N3), r = this.modules[n][o], i = 1);
|
|
190
|
+
e += this.finderPenaltyTerminateAndCount(r, i, a) * t.PENALTY_N3;
|
|
191
|
+
}
|
|
192
|
+
for (let n = 0; n < this.size; n++) {
|
|
193
|
+
let r = !1, i = 0, a = [
|
|
194
|
+
0,
|
|
195
|
+
0,
|
|
196
|
+
0,
|
|
197
|
+
0,
|
|
198
|
+
0,
|
|
199
|
+
0,
|
|
200
|
+
0
|
|
201
|
+
];
|
|
202
|
+
for (let o = 0; o < this.size; o++) this.modules[o][n] == r ? (i++, i == 5 ? e += t.PENALTY_N1 : i > 5 && e++) : (this.finderPenaltyAddHistory(i, a), r || (e += this.finderPenaltyCountPatterns(a) * t.PENALTY_N3), r = this.modules[o][n], i = 1);
|
|
203
|
+
e += this.finderPenaltyTerminateAndCount(r, i, a) * t.PENALTY_N3;
|
|
204
|
+
}
|
|
205
|
+
for (let n = 0; n < this.size - 1; n++) for (let r = 0; r < this.size - 1; r++) {
|
|
206
|
+
let i = this.modules[n][r];
|
|
207
|
+
i == this.modules[n][r + 1] && i == this.modules[n + 1][r] && i == this.modules[n + 1][r + 1] && (e += t.PENALTY_N2);
|
|
208
|
+
}
|
|
209
|
+
let n = 0;
|
|
210
|
+
for (let e of this.modules) n = e.reduce((e, t) => e + +!!t, n);
|
|
211
|
+
let r = this.size * this.size, a = Math.ceil(Math.abs(n * 20 - r * 10) / r) - 1;
|
|
212
|
+
return i(0 <= a && a <= 9), e += a * t.PENALTY_N4, i(0 <= e && e <= 2568888), e;
|
|
213
|
+
}
|
|
214
|
+
getAlignmentPatternPositions() {
|
|
215
|
+
if (this.version == 1) return [];
|
|
216
|
+
{
|
|
217
|
+
let e = Math.floor(this.version / 7) + 2, t = Math.floor((this.version * 8 + e * 3 + 5) / (e * 4 - 4)) * 2, n = [6];
|
|
218
|
+
for (let r = this.size - 7; n.length < e; r -= t) n.splice(1, 0, r);
|
|
219
|
+
return n;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
static getNumRawDataModules(e) {
|
|
223
|
+
if (e < t.MIN_VERSION || e > t.MAX_VERSION) throw RangeError("Version number out of range");
|
|
224
|
+
let n = (16 * e + 128) * e + 64;
|
|
225
|
+
if (e >= 2) {
|
|
226
|
+
let t = Math.floor(e / 7) + 2;
|
|
227
|
+
n -= (25 * t - 10) * t - 55, e >= 7 && (n -= 36);
|
|
228
|
+
}
|
|
229
|
+
return i(208 <= n && n <= 29648), n;
|
|
230
|
+
}
|
|
231
|
+
static getNumDataCodewords(e, n) {
|
|
232
|
+
return Math.floor(t.getNumRawDataModules(e) / 8) - t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e] * t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e];
|
|
233
|
+
}
|
|
234
|
+
static reedSolomonComputeDivisor(e) {
|
|
235
|
+
if (e < 1 || e > 255) throw RangeError("Degree out of range");
|
|
236
|
+
let n = [];
|
|
237
|
+
for (let t = 0; t < e - 1; t++) n.push(0);
|
|
238
|
+
n.push(1);
|
|
239
|
+
let r = 1;
|
|
240
|
+
for (let i = 0; i < e; i++) {
|
|
241
|
+
for (let e = 0; e < n.length; e++) n[e] = t.reedSolomonMultiply(n[e], r), e + 1 < n.length && (n[e] ^= n[e + 1]);
|
|
242
|
+
r = t.reedSolomonMultiply(r, 2);
|
|
243
|
+
}
|
|
244
|
+
return n;
|
|
245
|
+
}
|
|
246
|
+
static reedSolomonComputeRemainder(e, n) {
|
|
247
|
+
let r = n.map((e) => 0);
|
|
248
|
+
for (let i of e) {
|
|
249
|
+
let e = i ^ r.shift();
|
|
250
|
+
r.push(0), n.forEach((n, i) => r[i] ^= t.reedSolomonMultiply(n, e));
|
|
251
|
+
}
|
|
252
|
+
return r;
|
|
253
|
+
}
|
|
254
|
+
static reedSolomonMultiply(e, t) {
|
|
255
|
+
if (e >>> 8 || t >>> 8) throw RangeError("Byte out of range");
|
|
256
|
+
let n = 0;
|
|
257
|
+
for (let r = 7; r >= 0; r--) n = n << 1 ^ (n >>> 7) * 285, n ^= (t >>> r & 1) * e;
|
|
258
|
+
return i(n >>> 8 == 0), n;
|
|
259
|
+
}
|
|
260
|
+
finderPenaltyCountPatterns(e) {
|
|
261
|
+
let t = e[1];
|
|
262
|
+
i(t <= this.size * 3);
|
|
263
|
+
let n = t > 0 && e[2] == t && e[3] == t * 3 && e[4] == t && e[5] == t;
|
|
264
|
+
return (n && e[0] >= t * 4 && e[6] >= t ? 1 : 0) + (n && e[6] >= t * 4 && e[0] >= t ? 1 : 0);
|
|
265
|
+
}
|
|
266
|
+
finderPenaltyTerminateAndCount(e, t, n) {
|
|
267
|
+
return e && (this.finderPenaltyAddHistory(t, n), t = 0), t += this.size, this.finderPenaltyAddHistory(t, n), this.finderPenaltyCountPatterns(n);
|
|
268
|
+
}
|
|
269
|
+
finderPenaltyAddHistory(e, t) {
|
|
270
|
+
t[0] == 0 && (e += this.size), t.pop(), t.unshift(e);
|
|
271
|
+
}
|
|
272
|
+
static MIN_VERSION = 1;
|
|
273
|
+
static MAX_VERSION = 40;
|
|
274
|
+
static PENALTY_N1 = 3;
|
|
275
|
+
static PENALTY_N2 = 3;
|
|
276
|
+
static PENALTY_N3 = 40;
|
|
277
|
+
static PENALTY_N4 = 10;
|
|
278
|
+
static ECC_CODEWORDS_PER_BLOCK = [
|
|
279
|
+
[
|
|
280
|
+
-1,
|
|
281
|
+
7,
|
|
282
|
+
10,
|
|
283
|
+
15,
|
|
284
|
+
20,
|
|
285
|
+
26,
|
|
286
|
+
18,
|
|
287
|
+
20,
|
|
288
|
+
24,
|
|
289
|
+
30,
|
|
290
|
+
18,
|
|
291
|
+
20,
|
|
292
|
+
24,
|
|
293
|
+
26,
|
|
294
|
+
30,
|
|
295
|
+
22,
|
|
296
|
+
24,
|
|
297
|
+
28,
|
|
298
|
+
30,
|
|
299
|
+
28,
|
|
300
|
+
28,
|
|
301
|
+
28,
|
|
302
|
+
28,
|
|
303
|
+
30,
|
|
304
|
+
30,
|
|
305
|
+
26,
|
|
306
|
+
28,
|
|
307
|
+
30,
|
|
308
|
+
30,
|
|
309
|
+
30,
|
|
310
|
+
30,
|
|
311
|
+
30,
|
|
312
|
+
30,
|
|
313
|
+
30,
|
|
314
|
+
30,
|
|
315
|
+
30,
|
|
316
|
+
30,
|
|
317
|
+
30,
|
|
318
|
+
30,
|
|
319
|
+
30,
|
|
320
|
+
30
|
|
321
|
+
],
|
|
322
|
+
[
|
|
323
|
+
-1,
|
|
324
|
+
10,
|
|
325
|
+
16,
|
|
326
|
+
26,
|
|
327
|
+
18,
|
|
328
|
+
24,
|
|
329
|
+
16,
|
|
330
|
+
18,
|
|
331
|
+
22,
|
|
332
|
+
22,
|
|
333
|
+
26,
|
|
334
|
+
30,
|
|
335
|
+
22,
|
|
336
|
+
22,
|
|
337
|
+
24,
|
|
338
|
+
24,
|
|
339
|
+
28,
|
|
340
|
+
28,
|
|
341
|
+
26,
|
|
342
|
+
26,
|
|
343
|
+
26,
|
|
344
|
+
26,
|
|
345
|
+
28,
|
|
346
|
+
28,
|
|
347
|
+
28,
|
|
348
|
+
28,
|
|
349
|
+
28,
|
|
350
|
+
28,
|
|
351
|
+
28,
|
|
352
|
+
28,
|
|
353
|
+
28,
|
|
354
|
+
28,
|
|
355
|
+
28,
|
|
356
|
+
28,
|
|
357
|
+
28,
|
|
358
|
+
28,
|
|
359
|
+
28,
|
|
360
|
+
28,
|
|
361
|
+
28,
|
|
362
|
+
28,
|
|
363
|
+
28
|
|
364
|
+
],
|
|
365
|
+
[
|
|
366
|
+
-1,
|
|
367
|
+
13,
|
|
368
|
+
22,
|
|
369
|
+
18,
|
|
370
|
+
26,
|
|
371
|
+
18,
|
|
372
|
+
24,
|
|
373
|
+
18,
|
|
374
|
+
22,
|
|
375
|
+
20,
|
|
376
|
+
24,
|
|
377
|
+
28,
|
|
378
|
+
26,
|
|
379
|
+
24,
|
|
380
|
+
20,
|
|
381
|
+
30,
|
|
382
|
+
24,
|
|
383
|
+
28,
|
|
384
|
+
28,
|
|
385
|
+
26,
|
|
386
|
+
30,
|
|
387
|
+
28,
|
|
388
|
+
30,
|
|
389
|
+
30,
|
|
390
|
+
30,
|
|
391
|
+
30,
|
|
392
|
+
28,
|
|
393
|
+
30,
|
|
394
|
+
30,
|
|
395
|
+
30,
|
|
396
|
+
30,
|
|
397
|
+
30,
|
|
398
|
+
30,
|
|
399
|
+
30,
|
|
400
|
+
30,
|
|
401
|
+
30,
|
|
402
|
+
30,
|
|
403
|
+
30,
|
|
404
|
+
30,
|
|
405
|
+
30,
|
|
406
|
+
30
|
|
407
|
+
],
|
|
408
|
+
[
|
|
409
|
+
-1,
|
|
410
|
+
17,
|
|
411
|
+
28,
|
|
412
|
+
22,
|
|
413
|
+
16,
|
|
414
|
+
22,
|
|
415
|
+
28,
|
|
416
|
+
26,
|
|
417
|
+
26,
|
|
418
|
+
24,
|
|
419
|
+
28,
|
|
420
|
+
24,
|
|
421
|
+
28,
|
|
422
|
+
22,
|
|
423
|
+
24,
|
|
424
|
+
24,
|
|
425
|
+
30,
|
|
426
|
+
28,
|
|
427
|
+
28,
|
|
428
|
+
26,
|
|
429
|
+
28,
|
|
430
|
+
30,
|
|
431
|
+
24,
|
|
432
|
+
30,
|
|
433
|
+
30,
|
|
434
|
+
30,
|
|
435
|
+
30,
|
|
436
|
+
30,
|
|
437
|
+
30,
|
|
438
|
+
30,
|
|
439
|
+
30,
|
|
440
|
+
30,
|
|
441
|
+
30,
|
|
442
|
+
30,
|
|
443
|
+
30,
|
|
444
|
+
30,
|
|
445
|
+
30,
|
|
446
|
+
30,
|
|
447
|
+
30,
|
|
448
|
+
30,
|
|
449
|
+
30
|
|
450
|
+
]
|
|
451
|
+
];
|
|
452
|
+
static NUM_ERROR_CORRECTION_BLOCKS = [
|
|
453
|
+
[
|
|
454
|
+
-1,
|
|
455
|
+
1,
|
|
456
|
+
1,
|
|
457
|
+
1,
|
|
458
|
+
1,
|
|
459
|
+
1,
|
|
460
|
+
2,
|
|
461
|
+
2,
|
|
462
|
+
2,
|
|
463
|
+
2,
|
|
464
|
+
4,
|
|
465
|
+
4,
|
|
466
|
+
4,
|
|
467
|
+
4,
|
|
468
|
+
4,
|
|
469
|
+
6,
|
|
470
|
+
6,
|
|
471
|
+
6,
|
|
472
|
+
6,
|
|
473
|
+
7,
|
|
474
|
+
8,
|
|
475
|
+
8,
|
|
476
|
+
9,
|
|
477
|
+
9,
|
|
478
|
+
10,
|
|
479
|
+
12,
|
|
480
|
+
12,
|
|
481
|
+
12,
|
|
482
|
+
13,
|
|
483
|
+
14,
|
|
484
|
+
15,
|
|
485
|
+
16,
|
|
486
|
+
17,
|
|
487
|
+
18,
|
|
488
|
+
19,
|
|
489
|
+
19,
|
|
490
|
+
20,
|
|
491
|
+
21,
|
|
492
|
+
22,
|
|
493
|
+
24,
|
|
494
|
+
25
|
|
495
|
+
],
|
|
496
|
+
[
|
|
497
|
+
-1,
|
|
498
|
+
1,
|
|
499
|
+
1,
|
|
500
|
+
1,
|
|
501
|
+
2,
|
|
502
|
+
2,
|
|
503
|
+
4,
|
|
504
|
+
4,
|
|
505
|
+
4,
|
|
506
|
+
5,
|
|
507
|
+
5,
|
|
508
|
+
5,
|
|
509
|
+
8,
|
|
510
|
+
9,
|
|
511
|
+
9,
|
|
512
|
+
10,
|
|
513
|
+
10,
|
|
514
|
+
11,
|
|
515
|
+
13,
|
|
516
|
+
14,
|
|
517
|
+
16,
|
|
518
|
+
17,
|
|
519
|
+
17,
|
|
520
|
+
18,
|
|
521
|
+
20,
|
|
522
|
+
21,
|
|
523
|
+
23,
|
|
524
|
+
25,
|
|
525
|
+
26,
|
|
526
|
+
28,
|
|
527
|
+
29,
|
|
528
|
+
31,
|
|
529
|
+
33,
|
|
530
|
+
35,
|
|
531
|
+
37,
|
|
532
|
+
38,
|
|
533
|
+
40,
|
|
534
|
+
43,
|
|
535
|
+
45,
|
|
536
|
+
47,
|
|
537
|
+
49
|
|
538
|
+
],
|
|
539
|
+
[
|
|
540
|
+
-1,
|
|
541
|
+
1,
|
|
542
|
+
1,
|
|
543
|
+
2,
|
|
544
|
+
2,
|
|
545
|
+
4,
|
|
546
|
+
4,
|
|
547
|
+
6,
|
|
548
|
+
6,
|
|
549
|
+
8,
|
|
550
|
+
8,
|
|
551
|
+
8,
|
|
552
|
+
10,
|
|
553
|
+
12,
|
|
554
|
+
16,
|
|
555
|
+
12,
|
|
556
|
+
17,
|
|
557
|
+
16,
|
|
558
|
+
18,
|
|
559
|
+
21,
|
|
560
|
+
20,
|
|
561
|
+
23,
|
|
562
|
+
23,
|
|
563
|
+
25,
|
|
564
|
+
27,
|
|
565
|
+
29,
|
|
566
|
+
34,
|
|
567
|
+
34,
|
|
568
|
+
35,
|
|
569
|
+
38,
|
|
570
|
+
40,
|
|
571
|
+
43,
|
|
572
|
+
45,
|
|
573
|
+
48,
|
|
574
|
+
51,
|
|
575
|
+
53,
|
|
576
|
+
56,
|
|
577
|
+
59,
|
|
578
|
+
62,
|
|
579
|
+
65,
|
|
580
|
+
68
|
|
581
|
+
],
|
|
582
|
+
[
|
|
583
|
+
-1,
|
|
584
|
+
1,
|
|
585
|
+
1,
|
|
586
|
+
2,
|
|
587
|
+
4,
|
|
588
|
+
4,
|
|
589
|
+
4,
|
|
590
|
+
5,
|
|
591
|
+
6,
|
|
592
|
+
8,
|
|
593
|
+
8,
|
|
594
|
+
11,
|
|
595
|
+
11,
|
|
596
|
+
16,
|
|
597
|
+
16,
|
|
598
|
+
18,
|
|
599
|
+
16,
|
|
600
|
+
19,
|
|
601
|
+
21,
|
|
602
|
+
25,
|
|
603
|
+
25,
|
|
604
|
+
25,
|
|
605
|
+
34,
|
|
606
|
+
30,
|
|
607
|
+
32,
|
|
608
|
+
35,
|
|
609
|
+
37,
|
|
610
|
+
40,
|
|
611
|
+
42,
|
|
612
|
+
45,
|
|
613
|
+
48,
|
|
614
|
+
51,
|
|
615
|
+
54,
|
|
616
|
+
57,
|
|
617
|
+
60,
|
|
618
|
+
63,
|
|
619
|
+
66,
|
|
620
|
+
70,
|
|
621
|
+
74,
|
|
622
|
+
77,
|
|
623
|
+
81
|
|
624
|
+
]
|
|
625
|
+
];
|
|
626
|
+
}
|
|
627
|
+
e.QrCode = t;
|
|
628
|
+
function n(e, t, n) {
|
|
629
|
+
if (t < 0 || t > 31 || e >>> t) throw RangeError("Value out of range");
|
|
630
|
+
for (let r = t - 1; r >= 0; r--) n.push(e >>> r & 1);
|
|
631
|
+
}
|
|
632
|
+
function r(e, t) {
|
|
633
|
+
return (e >>> t & 1) != 0;
|
|
634
|
+
}
|
|
635
|
+
function i(e) {
|
|
636
|
+
if (!e) throw Error("Assertion error");
|
|
637
|
+
}
|
|
638
|
+
class a {
|
|
639
|
+
mode;
|
|
640
|
+
numChars;
|
|
641
|
+
bitData;
|
|
642
|
+
static makeBytes(e) {
|
|
643
|
+
let t = [];
|
|
644
|
+
for (let r of e) n(r, 8, t);
|
|
645
|
+
return new a(a.Mode.BYTE, e.length, t);
|
|
646
|
+
}
|
|
647
|
+
static makeNumeric(e) {
|
|
648
|
+
if (!a.isNumeric(e)) throw RangeError("String contains non-numeric characters");
|
|
649
|
+
let t = [];
|
|
650
|
+
for (let r = 0; r < e.length;) {
|
|
651
|
+
let i = Math.min(e.length - r, 3);
|
|
652
|
+
n(parseInt(e.substring(r, r + i), 10), i * 3 + 1, t), r += i;
|
|
653
|
+
}
|
|
654
|
+
return new a(a.Mode.NUMERIC, e.length, t);
|
|
655
|
+
}
|
|
656
|
+
static makeAlphanumeric(e) {
|
|
657
|
+
if (!a.isAlphanumeric(e)) throw RangeError("String contains unencodable characters in alphanumeric mode");
|
|
658
|
+
let t = [], r;
|
|
659
|
+
for (r = 0; r + 2 <= e.length; r += 2) {
|
|
660
|
+
let i = a.ALPHANUMERIC_CHARSET.indexOf(e.charAt(r)) * 45;
|
|
661
|
+
i += a.ALPHANUMERIC_CHARSET.indexOf(e.charAt(r + 1)), n(i, 11, t);
|
|
662
|
+
}
|
|
663
|
+
return r < e.length && n(a.ALPHANUMERIC_CHARSET.indexOf(e.charAt(r)), 6, t), new a(a.Mode.ALPHANUMERIC, e.length, t);
|
|
664
|
+
}
|
|
665
|
+
static makeSegments(e) {
|
|
666
|
+
return e == "" ? [] : a.isNumeric(e) ? [a.makeNumeric(e)] : a.isAlphanumeric(e) ? [a.makeAlphanumeric(e)] : [a.makeBytes(a.toUtf8ByteArray(e))];
|
|
667
|
+
}
|
|
668
|
+
static makeEci(e) {
|
|
669
|
+
let t = [];
|
|
670
|
+
if (e < 0) throw RangeError("ECI assignment value out of range");
|
|
671
|
+
if (e < 128) n(e, 8, t);
|
|
672
|
+
else if (e < 16384) n(2, 2, t), n(e, 14, t);
|
|
673
|
+
else if (e < 1e6) n(6, 3, t), n(e, 21, t);
|
|
674
|
+
else throw RangeError("ECI assignment value out of range");
|
|
675
|
+
return new a(a.Mode.ECI, 0, t);
|
|
676
|
+
}
|
|
677
|
+
static isNumeric(e) {
|
|
678
|
+
return a.NUMERIC_REGEX.test(e);
|
|
679
|
+
}
|
|
680
|
+
static isAlphanumeric(e) {
|
|
681
|
+
return a.ALPHANUMERIC_REGEX.test(e);
|
|
682
|
+
}
|
|
683
|
+
constructor(e, t, n) {
|
|
684
|
+
if (this.mode = e, this.numChars = t, this.bitData = n, t < 0) throw RangeError("Invalid argument");
|
|
685
|
+
this.bitData = n.slice();
|
|
686
|
+
}
|
|
687
|
+
getData() {
|
|
688
|
+
return this.bitData.slice();
|
|
689
|
+
}
|
|
690
|
+
static getTotalBits(e, t) {
|
|
691
|
+
let n = 0;
|
|
692
|
+
for (let r of e) {
|
|
693
|
+
let e = r.mode.numCharCountBits(t);
|
|
694
|
+
if (r.numChars >= 1 << e) return Infinity;
|
|
695
|
+
n += 4 + e + r.bitData.length;
|
|
696
|
+
}
|
|
697
|
+
return n;
|
|
698
|
+
}
|
|
699
|
+
static toUtf8ByteArray(e) {
|
|
700
|
+
e = encodeURI(e);
|
|
701
|
+
let t = [];
|
|
702
|
+
for (let n = 0; n < e.length; n++) e.charAt(n) == "%" ? (t.push(parseInt(e.substring(n + 1, n + 3), 16)), n += 2) : t.push(e.charCodeAt(n));
|
|
703
|
+
return t;
|
|
704
|
+
}
|
|
705
|
+
static NUMERIC_REGEX = /^[0-9]*$/;
|
|
706
|
+
static ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+./:-]*$/;
|
|
707
|
+
static ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
708
|
+
}
|
|
709
|
+
e.QrSegment = a;
|
|
710
|
+
})(v ||= {}), (function(e) {
|
|
711
|
+
let t;
|
|
712
|
+
(function(e) {
|
|
713
|
+
class t {
|
|
714
|
+
ordinal;
|
|
715
|
+
formatBits;
|
|
716
|
+
static LOW = new t(0, 1);
|
|
717
|
+
static MEDIUM = new t(1, 0);
|
|
718
|
+
static QUARTILE = new t(2, 3);
|
|
719
|
+
static HIGH = new t(3, 2);
|
|
720
|
+
constructor(e, t) {
|
|
721
|
+
this.ordinal = e, this.formatBits = t;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
e.Ecc = t;
|
|
725
|
+
})(t ||= e.QrCode ||= {});
|
|
726
|
+
})(v ||= {}), (function(e) {
|
|
727
|
+
let t;
|
|
728
|
+
(function(e) {
|
|
729
|
+
class t {
|
|
730
|
+
modeBits;
|
|
731
|
+
numBitsCharCount;
|
|
732
|
+
static NUMERIC = new t(1, [
|
|
733
|
+
10,
|
|
734
|
+
12,
|
|
735
|
+
14
|
|
736
|
+
]);
|
|
737
|
+
static ALPHANUMERIC = new t(2, [
|
|
738
|
+
9,
|
|
739
|
+
11,
|
|
740
|
+
13
|
|
741
|
+
]);
|
|
742
|
+
static BYTE = new t(4, [
|
|
743
|
+
8,
|
|
744
|
+
16,
|
|
745
|
+
16
|
|
746
|
+
]);
|
|
747
|
+
static KANJI = new t(8, [
|
|
748
|
+
8,
|
|
749
|
+
10,
|
|
750
|
+
12
|
|
751
|
+
]);
|
|
752
|
+
static ECI = new t(7, [
|
|
753
|
+
0,
|
|
754
|
+
0,
|
|
755
|
+
0
|
|
756
|
+
]);
|
|
757
|
+
constructor(e, t) {
|
|
758
|
+
this.modeBits = e, this.numBitsCharCount = t;
|
|
759
|
+
}
|
|
760
|
+
numCharCountBits(e) {
|
|
761
|
+
return this.numBitsCharCount[Math.floor((e + 7) / 17)];
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
e.Mode = t;
|
|
765
|
+
})(t ||= e.QrSegment ||= {});
|
|
766
|
+
})(v ||= {});
|
|
767
|
+
//#endregion
|
|
768
|
+
//#region src/qrcode/qr.ts
|
|
769
|
+
var y = v, b = {
|
|
770
|
+
L: y.QrCode.Ecc.LOW,
|
|
771
|
+
M: y.QrCode.Ecc.MEDIUM,
|
|
772
|
+
Q: y.QrCode.Ecc.QUARTILE,
|
|
773
|
+
H: y.QrCode.Ecc.HIGH
|
|
774
|
+
};
|
|
775
|
+
function x(e, t, n) {
|
|
776
|
+
let r = y.QrSegment.makeSegments(e), i = y.QrCode.encodeSegments(r, b[t], 1, 40, -1, n);
|
|
777
|
+
return Array.from({ length: i.size }, (e, t) => Array.from({ length: i.size }, (e, n) => i.getModule(n, t)));
|
|
778
|
+
}
|
|
779
|
+
function S(e) {
|
|
780
|
+
return Number.isFinite(e) ? Math.max(0, Math.floor(Number(e))) : 0;
|
|
781
|
+
}
|
|
782
|
+
function C(e, t = 0) {
|
|
783
|
+
let n = [];
|
|
784
|
+
return e.forEach((e, r) => {
|
|
785
|
+
let i = 0;
|
|
786
|
+
for (; i < e.length;) {
|
|
787
|
+
if (!e[i]) {
|
|
788
|
+
i += 1;
|
|
789
|
+
continue;
|
|
790
|
+
}
|
|
791
|
+
let a = i;
|
|
792
|
+
for (; i < e.length && e[i];) i += 1;
|
|
793
|
+
n.push(`M${a + t} ${r + t}h${i - a}v1H${a + t}z`);
|
|
794
|
+
}
|
|
795
|
+
}), n.join("");
|
|
796
|
+
}
|
|
797
|
+
function w(e, t) {
|
|
798
|
+
if (typeof e == "object") return {
|
|
799
|
+
width: Math.max(0, e.width),
|
|
800
|
+
height: Math.max(0, e.height)
|
|
801
|
+
};
|
|
802
|
+
if (Number.isFinite(e)) {
|
|
803
|
+
let t = Math.max(0, Number(e));
|
|
804
|
+
return {
|
|
805
|
+
width: t,
|
|
806
|
+
height: t
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
let n = Math.max(16, Math.round(t * .25));
|
|
810
|
+
return {
|
|
811
|
+
width: n,
|
|
812
|
+
height: n
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
function T(e, t, n, r) {
|
|
816
|
+
let i = w(r, t), a = (e.length + n * 2) / t, o = i.width * a, s = i.height * a, c = e.length / 2 - o / 2, l = e.length / 2 - s / 2, u = Math.floor(c), d = Math.floor(l);
|
|
817
|
+
return {
|
|
818
|
+
x: c,
|
|
819
|
+
y: l,
|
|
820
|
+
width: o,
|
|
821
|
+
height: s,
|
|
822
|
+
excavation: {
|
|
823
|
+
x: u,
|
|
824
|
+
y: d,
|
|
825
|
+
width: Math.ceil(o + c - u),
|
|
826
|
+
height: Math.ceil(s + l - d)
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
function E(e, t) {
|
|
831
|
+
let { excavation: n } = t;
|
|
832
|
+
return e.map((e, t) => t < n.y || t >= n.y + n.height ? e : e.map((e, t) => t < n.x || t >= n.x + n.width ? e : !1));
|
|
833
|
+
}
|
|
834
|
+
function ne(e) {
|
|
835
|
+
let t = x(e.value, e.errorLevel, e.boostLevel), n = S(e.marginSize), r = e.icon ? T(t, e.size, n, e.iconSize) : void 0, i = r ? E(t, r) : t;
|
|
836
|
+
return {
|
|
837
|
+
modules: i,
|
|
838
|
+
margin: n,
|
|
839
|
+
numCells: i.length + n * 2,
|
|
840
|
+
path: C(i, n),
|
|
841
|
+
iconLayout: r
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
//#endregion
|
|
845
|
+
//#region src/qrcode/QRCode.vue?vue&type=script&setup=true&lang.ts
|
|
846
|
+
var re = ["data-status"], ie = ["aria-label"], ae = [
|
|
847
|
+
"aria-label",
|
|
848
|
+
"width",
|
|
849
|
+
"height",
|
|
850
|
+
"viewBox"
|
|
851
|
+
], oe = { key: 0 }, se = ["fill", "d"], D = ["fill", "d"], O = [
|
|
852
|
+
"href",
|
|
853
|
+
"x",
|
|
854
|
+
"y",
|
|
855
|
+
"width",
|
|
856
|
+
"height"
|
|
857
|
+
], k = ["src"], A = /* @__PURE__ */ o({
|
|
858
|
+
__name: "QRCode",
|
|
859
|
+
props: {
|
|
860
|
+
value: {},
|
|
861
|
+
type: { default: "canvas" },
|
|
862
|
+
size: { default: 160 },
|
|
863
|
+
color: { default: "#111827" },
|
|
864
|
+
bgColor: { default: "#ffffff" },
|
|
865
|
+
icon: { default: "" },
|
|
866
|
+
iconSize: { default: void 0 },
|
|
867
|
+
status: { default: "active" },
|
|
868
|
+
bordered: {
|
|
869
|
+
type: Boolean,
|
|
870
|
+
default: !0
|
|
871
|
+
},
|
|
872
|
+
errorLevel: { default: "M" },
|
|
873
|
+
marginSize: { default: void 0 },
|
|
874
|
+
boostLevel: {
|
|
875
|
+
type: Boolean,
|
|
876
|
+
default: !0
|
|
877
|
+
},
|
|
878
|
+
title: { default: void 0 },
|
|
879
|
+
expiredText: { default: "二维码已过期" },
|
|
880
|
+
refreshText: { default: "刷新" },
|
|
881
|
+
scannedText: { default: "已扫描" },
|
|
882
|
+
loadingText: { default: "加载中" },
|
|
883
|
+
statusRender: {
|
|
884
|
+
type: Function,
|
|
885
|
+
default: void 0
|
|
886
|
+
},
|
|
887
|
+
classNames: { default: void 0 },
|
|
888
|
+
styles: { default: void 0 }
|
|
889
|
+
},
|
|
890
|
+
emits: ["refresh"],
|
|
891
|
+
setup(e, { expose: v, emit: y }) {
|
|
892
|
+
let b = o({
|
|
893
|
+
name: "QRCodeStatusRenderBridge",
|
|
894
|
+
props: {
|
|
895
|
+
render: {
|
|
896
|
+
type: Function,
|
|
897
|
+
required: !0
|
|
898
|
+
},
|
|
899
|
+
info: {
|
|
900
|
+
type: Object,
|
|
901
|
+
required: !0
|
|
902
|
+
}
|
|
903
|
+
},
|
|
904
|
+
setup(e) {
|
|
905
|
+
return () => e.render(e.info);
|
|
906
|
+
}
|
|
907
|
+
}), x = e, S = y, C = m(null), w = m(null), T = m(null), E = m(!1), A = t(() => Math.max(32, Math.floor(x.size))), L = t(() => Math.max(24, A.value - (x.bordered ? 18 : 0))), ce = t(() => _(j({ bordered: x.bordered }), x.classNames?.root)), R = t(() => _(M(), x.classNames?.code)), z = t(() => _(N(), x.classNames?.mask)), B = t(() => _(P(), x.classNames?.status)), V = t(() => _(I(), x.classNames?.refresh)), H = t(() => x.status === "active" ? void 0 : x.status), U = t(() => !!x.icon && (x.type === "svg" || E.value)), W = t(() => ne({
|
|
908
|
+
value: x.value,
|
|
909
|
+
errorLevel: x.errorLevel,
|
|
910
|
+
boostLevel: x.boostLevel,
|
|
911
|
+
marginSize: x.marginSize,
|
|
912
|
+
size: L.value,
|
|
913
|
+
icon: U.value ? x.icon : "",
|
|
914
|
+
iconSize: x.iconSize
|
|
915
|
+
})), G = t(() => ({
|
|
916
|
+
expired: x.expiredText,
|
|
917
|
+
refresh: x.refreshText,
|
|
918
|
+
scanned: x.scannedText,
|
|
919
|
+
loading: x.loadingText
|
|
920
|
+
})), K = t(() => ({
|
|
921
|
+
status: H.value ?? "loading",
|
|
922
|
+
locale: G.value,
|
|
923
|
+
onRefresh: Z
|
|
924
|
+
})), le = t(() => ({
|
|
925
|
+
width: `${A.value}px`,
|
|
926
|
+
height: `${A.value}px`,
|
|
927
|
+
backgroundColor: x.bordered ? x.bgColor : void 0
|
|
928
|
+
})), q = t(() => ({
|
|
929
|
+
width: `${L.value}px`,
|
|
930
|
+
height: `${L.value}px`
|
|
931
|
+
})), J = t(() => x.title || (x.value ? `二维码:${x.value}` : "二维码")), Y = t(() => x.icon || void 0), X = (e) => e;
|
|
932
|
+
function Z(e) {
|
|
933
|
+
S("refresh", e);
|
|
934
|
+
}
|
|
935
|
+
function ue() {
|
|
936
|
+
E.value = !0;
|
|
937
|
+
}
|
|
938
|
+
function Q() {
|
|
939
|
+
E.value = !1;
|
|
940
|
+
}
|
|
941
|
+
function $() {
|
|
942
|
+
if (x.type !== "canvas") return;
|
|
943
|
+
let e = C.value;
|
|
944
|
+
if (!e) return;
|
|
945
|
+
let t = null;
|
|
946
|
+
try {
|
|
947
|
+
t = e.getContext("2d");
|
|
948
|
+
} catch {
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
if (!t) return;
|
|
952
|
+
let n = W.value, r = window.devicePixelRatio || 1, i = L.value, a = i / n.numCells;
|
|
953
|
+
e.width = Math.floor(i * r), e.height = Math.floor(i * r), t.setTransform(r * a, 0, 0, r * a, 0, 0), t.fillStyle = x.bgColor, t.fillRect(0, 0, n.numCells, n.numCells), t.fillStyle = x.color, typeof Path2D < "u" ? t.fill(new Path2D(n.path)) : n.modules.forEach((e, r) => {
|
|
954
|
+
e.forEach((e, i) => {
|
|
955
|
+
e && t?.fillRect(i + n.margin, r + n.margin, 1, 1);
|
|
956
|
+
});
|
|
957
|
+
}), n.iconLayout && T.value?.complete && T.value.naturalWidth > 0 && T.value.naturalHeight > 0 && t.drawImage(T.value, n.iconLayout.x + n.margin, n.iconLayout.y + n.margin, n.iconLayout.width, n.iconLayout.height);
|
|
958
|
+
}
|
|
959
|
+
function de(e = "image/png", t) {
|
|
960
|
+
if (x.type === "canvas") return C.value?.toDataURL(e, t);
|
|
961
|
+
if (!w.value) return;
|
|
962
|
+
let n = new XMLSerializer().serializeToString(w.value);
|
|
963
|
+
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;
|
|
964
|
+
}
|
|
965
|
+
return te(() => [
|
|
966
|
+
x.type,
|
|
967
|
+
x.value,
|
|
968
|
+
x.color,
|
|
969
|
+
x.bgColor,
|
|
970
|
+
x.errorLevel,
|
|
971
|
+
x.marginSize,
|
|
972
|
+
x.boostLevel,
|
|
973
|
+
x.icon,
|
|
974
|
+
x.iconSize,
|
|
975
|
+
L.value,
|
|
976
|
+
E.value
|
|
977
|
+
], () => c($), {
|
|
978
|
+
immediate: !0,
|
|
979
|
+
deep: !0
|
|
980
|
+
}), f($), v({ toDataURL: de }), (t, o) => (p(), i("div", {
|
|
981
|
+
"data-ui-qrcode": "true",
|
|
982
|
+
"data-status": e.status,
|
|
983
|
+
class: l(ce.value),
|
|
984
|
+
style: d([le.value, X(e.styles?.root)])
|
|
985
|
+
}, [
|
|
986
|
+
e.type === "canvas" ? (p(), i("canvas", {
|
|
987
|
+
key: 0,
|
|
988
|
+
ref_key: "canvasRef",
|
|
989
|
+
ref: C,
|
|
990
|
+
"data-ui-qrcode-code": "true",
|
|
991
|
+
role: "img",
|
|
992
|
+
"aria-label": J.value,
|
|
993
|
+
class: l(R.value),
|
|
994
|
+
style: d([q.value, X(e.styles?.code)])
|
|
995
|
+
}, null, 14, ie)) : (p(), i("svg", {
|
|
996
|
+
key: 1,
|
|
997
|
+
ref_key: "svgRef",
|
|
998
|
+
ref: w,
|
|
999
|
+
"data-ui-qrcode-code": "true",
|
|
1000
|
+
role: "img",
|
|
1001
|
+
"aria-label": J.value,
|
|
1002
|
+
width: L.value,
|
|
1003
|
+
height: L.value,
|
|
1004
|
+
viewBox: `0 0 ${W.value.numCells} ${W.value.numCells}`,
|
|
1005
|
+
class: l(R.value),
|
|
1006
|
+
style: d([q.value, X(e.styles?.code)])
|
|
1007
|
+
}, [
|
|
1008
|
+
e.title ? (p(), i("title", oe, h(e.title), 1)) : r("", !0),
|
|
1009
|
+
a("path", {
|
|
1010
|
+
fill: e.bgColor,
|
|
1011
|
+
d: `M0 0h${W.value.numCells}v${W.value.numCells}H0z`,
|
|
1012
|
+
"shape-rendering": "crispEdges"
|
|
1013
|
+
}, null, 8, se),
|
|
1014
|
+
a("path", {
|
|
1015
|
+
fill: e.color,
|
|
1016
|
+
d: W.value.path,
|
|
1017
|
+
"shape-rendering": "crispEdges"
|
|
1018
|
+
}, null, 8, D),
|
|
1019
|
+
W.value.iconLayout && Y.value ? (p(), i("image", {
|
|
1020
|
+
key: 1,
|
|
1021
|
+
href: Y.value,
|
|
1022
|
+
x: W.value.iconLayout.x + W.value.margin,
|
|
1023
|
+
y: W.value.iconLayout.y + W.value.margin,
|
|
1024
|
+
width: W.value.iconLayout.width,
|
|
1025
|
+
height: W.value.iconLayout.height,
|
|
1026
|
+
preserveAspectRatio: "xMidYMid meet"
|
|
1027
|
+
}, null, 8, O)) : r("", !0)
|
|
1028
|
+
], 14, ae)),
|
|
1029
|
+
e.type === "canvas" && e.icon ? (p(), i("img", {
|
|
1030
|
+
key: 2,
|
|
1031
|
+
ref_key: "imageRef",
|
|
1032
|
+
ref: T,
|
|
1033
|
+
src: e.icon,
|
|
1034
|
+
alt: "",
|
|
1035
|
+
class: "hidden",
|
|
1036
|
+
onLoad: ue,
|
|
1037
|
+
onError: Q
|
|
1038
|
+
}, null, 40, k)) : r("", !0),
|
|
1039
|
+
H.value ? (p(), i("div", {
|
|
1040
|
+
key: 3,
|
|
1041
|
+
"data-ui-qrcode-mask": "true",
|
|
1042
|
+
class: l(z.value),
|
|
1043
|
+
style: d(X(e.styles?.mask))
|
|
1044
|
+
}, [t.$slots.status ? ee(t.$slots, "status", u(s({ key: 0 }, K.value))) : e.statusRender ? (p(), n(g(b), {
|
|
1045
|
+
key: 1,
|
|
1046
|
+
render: e.statusRender,
|
|
1047
|
+
info: K.value
|
|
1048
|
+
}, null, 8, ["render", "info"])) : (p(), i("div", {
|
|
1049
|
+
key: 2,
|
|
1050
|
+
"data-ui-qrcode-status": "true",
|
|
1051
|
+
class: l(B.value),
|
|
1052
|
+
style: d(X(e.styles?.status))
|
|
1053
|
+
}, [
|
|
1054
|
+
H.value === "loading" ? (p(), i("span", {
|
|
1055
|
+
key: 0,
|
|
1056
|
+
class: l(g(F)({ status: "loading" })),
|
|
1057
|
+
"aria-hidden": "true"
|
|
1058
|
+
}, [...o[0] ||= [a("span", { class: "i-lucide:loader-2 animate-spin" }, null, -1)]], 2)) : H.value === "expired" ? (p(), i("span", {
|
|
1059
|
+
key: 1,
|
|
1060
|
+
class: l(g(F)({ status: "expired" })),
|
|
1061
|
+
"aria-hidden": "true"
|
|
1062
|
+
}, [...o[1] ||= [a("span", { class: "i-lucide:circle-alert" }, null, -1)]], 2)) : (p(), i("span", {
|
|
1063
|
+
key: 2,
|
|
1064
|
+
class: l(g(F)({ status: "scanned" })),
|
|
1065
|
+
"aria-hidden": "true"
|
|
1066
|
+
}, [...o[2] ||= [a("span", { class: "i-lucide:circle-check" }, null, -1)]], 2)),
|
|
1067
|
+
a("span", null, h(H.value === "loading" ? G.value.loading : H.value === "expired" ? G.value.expired : G.value.scanned), 1),
|
|
1068
|
+
H.value === "expired" ? (p(), i("button", {
|
|
1069
|
+
key: 3,
|
|
1070
|
+
type: "button",
|
|
1071
|
+
"data-ui-qrcode-refresh": "true",
|
|
1072
|
+
class: l(V.value),
|
|
1073
|
+
style: d(X(e.styles?.refresh)),
|
|
1074
|
+
onClick: Z
|
|
1075
|
+
}, [o[3] ||= a("span", {
|
|
1076
|
+
class: "i-lucide:rotate-cw size-3.5",
|
|
1077
|
+
"aria-hidden": "true"
|
|
1078
|
+
}, null, -1), a("span", null, h(G.value.refresh), 1)], 6)) : r("", !0)
|
|
1079
|
+
], 6))], 6)) : r("", !0)
|
|
1080
|
+
], 14, re));
|
|
1081
|
+
}
|
|
1082
|
+
}), j = e("relative inline-flex shrink-0 items-center justify-center overflow-hidden transition-colors duration-150", {
|
|
1083
|
+
variants: { bordered: {
|
|
1084
|
+
true: "rounded-md border border-medium bg-white p-2 shadow-sm dark:bg-white",
|
|
1085
|
+
false: "bg-transparent"
|
|
1086
|
+
} },
|
|
1087
|
+
defaultVariants: { bordered: !0 }
|
|
1088
|
+
}), M = e("block shrink-0 [image-rendering:pixelated]"), N = e("absolute inset-0 z-1 flex flex-col items-center justify-center gap-2 bg-white/95 px-3 text-center backdrop-blur-[1px]"), P = e("flex flex-col items-center justify-center gap-2 text-xs/5 font-medium text-zinc-700"), F = e("inline-flex size-6 items-center justify-center text-xl", {
|
|
1089
|
+
variants: { status: {
|
|
1090
|
+
loading: "text-brand-500",
|
|
1091
|
+
expired: "text-amber-500",
|
|
1092
|
+
scanned: "text-green-500"
|
|
1093
|
+
} },
|
|
1094
|
+
defaultVariants: { status: "loading" }
|
|
1095
|
+
}), I = e("inline-flex h-7 items-center gap-1 rounded px-2 text-xs/5 font-medium text-brand-600 transition-colors hover:bg-brand-500/10 hover:text-brand-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/30");
|
|
1096
|
+
//#endregion
|
|
1097
|
+
export { P as a, j as i, N as n, F as o, I as r, A as s, M as t };
|
|
1098
|
+
|
|
1099
|
+
//# sourceMappingURL=qrcode-B0t_pZna.js.map
|