@oila/0account 3.4.8 → 3.4.9
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/cjs/index-ef57218a.js +1948 -0
- package/dist/cjs/index-ef57218a.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/qr-code_2.cjs.entry.js +1550 -0
- package/dist/cjs/qr-code_2.cjs.entry.js.map +1 -0
- package/dist/cjs/zero-account.cjs.js +25 -0
- package/dist/cjs/zero-account.cjs.js.map +1 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/zero-account/enums.js +18 -0
- package/dist/collection/components/zero-account/enums.js.map +1 -0
- package/dist/collection/components/zero-account/logo.js +6 -0
- package/dist/collection/components/zero-account/logo.js.map +1 -0
- package/dist/collection/components/zero-account/qrcode.js +111 -0
- package/dist/collection/components/zero-account/qrcode.js.map +1 -0
- package/dist/collection/components/zero-account/websocket.js +176 -0
- package/dist/collection/components/zero-account/websocket.js.map +1 -0
- package/dist/collection/components/zero-account/zero-account.css +294 -0
- package/dist/collection/components/zero-account/zero-account.e2e.js +26 -0
- package/dist/collection/components/zero-account/zero-account.e2e.js.map +1 -0
- package/dist/collection/components/zero-account/zero-account.js +402 -0
- package/dist/collection/components/zero-account/zero-account.js.map +1 -0
- package/dist/collection/components/zero-account/zero-account.spec.js +35 -0
- package/dist/collection/components/zero-account/zero-account.spec.js.map +1 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/{zero-account/qr-code.entry.js → collection/utils/qrcode/qrcode.js} +3 -35
- package/dist/collection/utils/request.js +45 -0
- package/dist/collection/utils/request.js.map +1 -0
- package/dist/collection/utils/url.js +43 -0
- package/dist/collection/utils/utils.js +16 -0
- package/dist/collection/utils/utils.js.map +1 -0
- package/dist/collection/utils/utils.spec.js +10 -0
- package/dist/collection/utils/utils.spec.js.map +1 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +3 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/qr-code.d.ts +2 -2
- package/dist/components/qr-code.js +8 -0
- package/dist/components/qr-code.js.map +1 -0
- package/dist/components/qrcode.js +1073 -0
- package/dist/components/qrcode.js.map +1 -0
- package/dist/components/zero-account.d.ts +2 -2
- package/dist/components/zero-account.js +535 -0
- package/dist/components/zero-account.js.map +1 -0
- package/dist/esm/index-798be1d4.js +1919 -0
- package/dist/esm/index-798be1d4.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/qr-code_2.entry.js +1545 -0
- package/dist/esm/qr-code_2.entry.js.map +1 -0
- package/dist/esm/zero-account.js +20 -0
- package/dist/esm/zero-account.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/zero-account/enums.d.ts +8 -8
- package/dist/types/components/zero-account/logo.d.ts +2 -2
- package/dist/types/components/zero-account/qrcode.d.ts +5 -5
- package/dist/types/components/zero-account/websocket.d.ts +27 -25
- package/dist/types/components/zero-account/zero-account.d.ts +39 -39
- package/dist/types/stencil-public-runtime.d.ts +46 -5
- package/dist/types/utils/request.d.ts +5 -5
- package/dist/types/utils/utils.d.ts +3 -3
- package/dist/zero-account/index.esm.js +0 -1
- package/dist/zero-account/index.esm.js.map +1 -1
- package/dist/zero-account/p-3b6bbcf5.js +3 -0
- package/dist/zero-account/p-3b6bbcf5.js.map +1 -0
- package/dist/zero-account/p-b6f591cf.entry.js +2 -0
- package/dist/zero-account/p-b6f591cf.entry.js.map +1 -0
- package/dist/zero-account/zero-account.esm.js +1 -64
- package/dist/zero-account/zero-account.esm.js.map +1 -1
- package/loader/index.d.ts +1 -1
- package/package.json +10 -10
- package/dist/zero-account/app-globals-0f993ce5.js +0 -5
- package/dist/zero-account/app-globals-0f993ce5.js.map +0 -1
- package/dist/zero-account/enums-816340c2.js +0 -21
- package/dist/zero-account/enums-816340c2.js.map +0 -1
- package/dist/zero-account/enums-e7827156.js +0 -21
- package/dist/zero-account/enums-e7827156.js.map +0 -1
- package/dist/zero-account/index-57856b47.js +0 -3380
- package/dist/zero-account/index-57856b47.js.map +0 -1
- package/dist/zero-account/qr-code.entry.js.map +0 -1
- package/dist/zero-account/shadow-css-8a6ccf47.js +0 -389
- package/dist/zero-account/shadow-css-8a6ccf47.js.map +0 -1
- package/dist/zero-account/zero-account.entry.js +0 -1994
- package/dist/zero-account/zero-account.entry.js.map +0 -1
|
@@ -0,0 +1,1073 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* QR Code generator library (JavaScript)
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Project Nayuki. (MIT License)
|
|
7
|
+
* https://www.nayuki.io/page/qr-code-generator-library
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
10
|
+
* this software and associated documentation files (the "Software"), to deal in
|
|
11
|
+
* the Software without restriction, including without limitation the rights to
|
|
12
|
+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
13
|
+
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
14
|
+
* subject to the following conditions:
|
|
15
|
+
* - The above copyright notice and this permission notice shall be included in
|
|
16
|
+
* all copies or substantial portions of the Software.
|
|
17
|
+
* - The Software is provided "as is", without warranty of any kind, express or
|
|
18
|
+
* implied, including but not limited to the warranties of merchantability,
|
|
19
|
+
* fitness for a particular purpose and noninfringement. In no event shall the
|
|
20
|
+
* authors or copyright holders be liable for any claim, damages or other
|
|
21
|
+
* liability, whether in an action of contract, tort or otherwise, arising from,
|
|
22
|
+
* out of or in connection with the Software or the use or other dealings in the
|
|
23
|
+
* Software.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
* Module "qrcodegen", public members:
|
|
29
|
+
* - Class QrCode:
|
|
30
|
+
* - Function encodeText(str text, QrCode.Ecc ecl) -> QrCode
|
|
31
|
+
* - Function encodeBinary(list<byte> data, QrCode.Ecc ecl) -> QrCode
|
|
32
|
+
* - Function encodeSegments(list<QrSegment> segs, QrCode.Ecc ecl,
|
|
33
|
+
* int minVersion=1, int maxVersion=40, mask=-1, boostEcl=true) -> QrCode
|
|
34
|
+
* - Constants int MIN_VERSION, MAX_VERSION
|
|
35
|
+
* - Constructor QrCode(int version, QrCode.Ecc ecl, list<byte> dataCodewords, int mask)
|
|
36
|
+
* - Fields int version, size, mask
|
|
37
|
+
* - Field QrCode.Ecc errorCorrectionLevel
|
|
38
|
+
* - Method getModule(int x, int y) -> bool
|
|
39
|
+
* - Method drawCanvas(int scale, int border, HTMLCanvasElement canvas) -> void
|
|
40
|
+
* - Method toSvgString(int border) -> str
|
|
41
|
+
* - Enum Ecc:
|
|
42
|
+
* - Constants LOW, MEDIUM, QUARTILE, HIGH
|
|
43
|
+
* - Field int ordinal
|
|
44
|
+
* - Class QrSegment:
|
|
45
|
+
* - Function makeBytes(list<byte> data) -> QrSegment
|
|
46
|
+
* - Function makeNumeric(str data) -> QrSegment
|
|
47
|
+
* - Function makeAlphanumeric(str data) -> QrSegment
|
|
48
|
+
* - Function makeSegments(str text) -> list<QrSegment>
|
|
49
|
+
* - Function makeEci(int assignVal) -> QrSegment
|
|
50
|
+
* - Constructor QrSegment(QrSegment.Mode mode, int numChars, list<int> bitData)
|
|
51
|
+
* - Field QrSegment.Mode mode
|
|
52
|
+
* - Field int numChars
|
|
53
|
+
* - Method getData() -> list<int>
|
|
54
|
+
* - Constants RegExp NUMERIC_REGEX, ALPHANUMERIC_REGEX
|
|
55
|
+
* - Enum Mode:
|
|
56
|
+
* - Constants NUMERIC, ALPHANUMERIC, BYTE, KANJI, ECI
|
|
57
|
+
*/
|
|
58
|
+
var qrcodegen = new function() {
|
|
59
|
+
|
|
60
|
+
/*---- QR Code symbol class ----*/
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* A class that represents a QR Code symbol, which is a type of two-dimension barcode.
|
|
64
|
+
* Invented by Denso Wave and described in the ISO/IEC 18004 standard.
|
|
65
|
+
* Instances of this class represent an immutable square grid of black and white cells.
|
|
66
|
+
* The class provides static factory functions to create a QR Code from text or binary data.
|
|
67
|
+
* The class covers the QR Code Model 2 specification, supporting all versions (sizes)
|
|
68
|
+
* from 1 to 40, all 4 error correction levels, and 4 character encoding modes.
|
|
69
|
+
*
|
|
70
|
+
* Ways to create a QR Code object:
|
|
71
|
+
* - High level: Take the payload data and call QrCode.encodeText() or QrCode.encodeBinary().
|
|
72
|
+
* - Mid level: Custom-make the list of segments and call QrCode.encodeSegments().
|
|
73
|
+
* - Low level: Custom-make the array of data codeword bytes (including
|
|
74
|
+
* segment headers and final padding, excluding error correction codewords),
|
|
75
|
+
* supply the appropriate version number, and call the QrCode() constructor.
|
|
76
|
+
* (Note that all ways require supplying the desired error correction level.)
|
|
77
|
+
*
|
|
78
|
+
* This constructor creates a new QR Code with the given version number,
|
|
79
|
+
* error correction level, data codeword bytes, and mask number.
|
|
80
|
+
* This is a low-level API that most users should not use directly.
|
|
81
|
+
* A mid-level API is the encodeSegments() function.
|
|
82
|
+
*/
|
|
83
|
+
this.QrCode = function(version, errCorLvl, dataCodewords, mask) {
|
|
84
|
+
|
|
85
|
+
/*---- Constructor (low level) ----*/
|
|
86
|
+
|
|
87
|
+
// Check scalar arguments
|
|
88
|
+
if (version < MIN_VERSION || version > MAX_VERSION)
|
|
89
|
+
throw "Version value out of range";
|
|
90
|
+
if (mask < -1 || mask > 7)
|
|
91
|
+
throw "Mask value out of range";
|
|
92
|
+
if (!(errCorLvl instanceof Ecc))
|
|
93
|
+
throw "QrCode.Ecc expected";
|
|
94
|
+
var size = version * 4 + 17;
|
|
95
|
+
|
|
96
|
+
// Initialize both grids to be size*size arrays of Boolean false
|
|
97
|
+
var row = [];
|
|
98
|
+
for (var i = 0; i < size; i++)
|
|
99
|
+
row.push(false);
|
|
100
|
+
var modules = []; // Initially all white
|
|
101
|
+
var isFunction = [];
|
|
102
|
+
for (var i = 0; i < size; i++) {
|
|
103
|
+
modules .push(row.slice());
|
|
104
|
+
isFunction.push(row.slice());
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Compute ECC, draw modules
|
|
108
|
+
drawFunctionPatterns();
|
|
109
|
+
var allCodewords = addEccAndInterleave(dataCodewords);
|
|
110
|
+
drawCodewords(allCodewords);
|
|
111
|
+
|
|
112
|
+
// Do masking
|
|
113
|
+
if (mask == -1) { // Automatically choose best mask
|
|
114
|
+
var minPenalty = Infinity;
|
|
115
|
+
for (var i = 0; i < 8; i++) {
|
|
116
|
+
drawFormatBits(i);
|
|
117
|
+
applyMask(i);
|
|
118
|
+
var penalty = getPenaltyScore();
|
|
119
|
+
if (penalty < minPenalty) {
|
|
120
|
+
mask = i;
|
|
121
|
+
minPenalty = penalty;
|
|
122
|
+
}
|
|
123
|
+
applyMask(i); // Undoes the mask due to XOR
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (mask < 0 || mask > 7)
|
|
127
|
+
throw "Assertion error";
|
|
128
|
+
drawFormatBits(mask); // Overwrite old format bits
|
|
129
|
+
applyMask(mask); // Apply the final choice of mask
|
|
130
|
+
|
|
131
|
+
isFunction = null;
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
/*---- Read-only instance properties ----*/
|
|
135
|
+
|
|
136
|
+
// The version number of this QR Code, which is between 1 and 40 (inclusive).
|
|
137
|
+
// This determines the size of this barcode.
|
|
138
|
+
Object.defineProperty(this, "version", {value:version});
|
|
139
|
+
|
|
140
|
+
// The width and height of this QR Code, measured in modules, between
|
|
141
|
+
// 21 and 177 (inclusive). This is equal to version * 4 + 17.
|
|
142
|
+
Object.defineProperty(this, "size", {value:size});
|
|
143
|
+
|
|
144
|
+
// The error correction level used in this QR Code.
|
|
145
|
+
Object.defineProperty(this, "errorCorrectionLevel", {value:errCorLvl});
|
|
146
|
+
|
|
147
|
+
// The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
|
|
148
|
+
// Even if a QR Code is created with automatic masking requested (mask = -1),
|
|
149
|
+
// the resulting object still has a mask value between 0 and 7.
|
|
150
|
+
Object.defineProperty(this, "mask", {value:mask});
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
/*---- Accessor methods ----*/
|
|
154
|
+
|
|
155
|
+
// Returns the color of the module (pixel) at the given coordinates, which is false
|
|
156
|
+
// for white or true for black. The top left corner has the coordinates (x=0, y=0).
|
|
157
|
+
// If the given coordinates are out of bounds, then false (white) is returned.
|
|
158
|
+
this.getModule = function(x, y) {
|
|
159
|
+
return 0 <= x && x < size && 0 <= y && y < size && modules[y][x];
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
/*---- Public instance methods ----*/
|
|
164
|
+
|
|
165
|
+
this.circlePath = function(cx, cy, r){
|
|
166
|
+
return 'M '+cx+' '+cy+' m -'+r+', 0 a '+r+','+r+' 0 1,0 '+(r*2)+',0 a '+r+','+r+' 0 1,0 -'+(r*2)+',0';
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
this.svgObject = function(round) {
|
|
170
|
+
var parts = [];
|
|
171
|
+
for (var y = 0; y < size; y++) {
|
|
172
|
+
for (var x = 0; x < size; x++) {
|
|
173
|
+
if (this.getModule(x, y)){
|
|
174
|
+
if (round) {
|
|
175
|
+
parts.push(this.circlePath(x+0.5,y+0.5, 0.5));
|
|
176
|
+
} else {
|
|
177
|
+
parts.push("M" + x + "," + y + "h1v1h-1z");
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
path: parts.join(" "),
|
|
184
|
+
size: size
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
/*---- Private helper methods for constructor: Drawing function modules ----*/
|
|
190
|
+
|
|
191
|
+
// Reads this object's version field, and draws and marks all function modules.
|
|
192
|
+
function drawFunctionPatterns() {
|
|
193
|
+
// Draw horizontal and vertical timing patterns
|
|
194
|
+
for (var i = 0; i < size; i++) {
|
|
195
|
+
setFunctionModule(6, i, i % 2 == 0);
|
|
196
|
+
setFunctionModule(i, 6, i % 2 == 0);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Draw 3 finder patterns (all corners except bottom right; overwrites some timing modules)
|
|
200
|
+
drawFinderPattern(3, 3);
|
|
201
|
+
drawFinderPattern(size - 4, 3);
|
|
202
|
+
drawFinderPattern(3, size - 4);
|
|
203
|
+
|
|
204
|
+
// Draw numerous alignment patterns
|
|
205
|
+
var alignPatPos = getAlignmentPatternPositions();
|
|
206
|
+
var numAlign = alignPatPos.length;
|
|
207
|
+
for (var i = 0; i < numAlign; i++) {
|
|
208
|
+
for (var j = 0; j < numAlign; j++) {
|
|
209
|
+
// Don't draw on the three finder corners
|
|
210
|
+
if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0))
|
|
211
|
+
drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Draw configuration data
|
|
216
|
+
drawFormatBits(0); // Dummy mask value; overwritten later in the constructor
|
|
217
|
+
drawVersion();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
// Draws two copies of the format bits (with its own error correction code)
|
|
222
|
+
// based on the given mask and this object's error correction level field.
|
|
223
|
+
function drawFormatBits(mask) {
|
|
224
|
+
// Calculate error correction code and pack bits
|
|
225
|
+
var data = errCorLvl.formatBits << 3 | mask; // errCorrLvl is uint2, mask is uint3
|
|
226
|
+
var rem = data;
|
|
227
|
+
for (var i = 0; i < 10; i++)
|
|
228
|
+
rem = (rem << 1) ^ ((rem >>> 9) * 0x537);
|
|
229
|
+
var bits = (data << 10 | rem) ^ 0x5412; // uint15
|
|
230
|
+
if (bits >>> 15 != 0)
|
|
231
|
+
throw "Assertion error";
|
|
232
|
+
|
|
233
|
+
// Draw first copy
|
|
234
|
+
for (var i = 0; i <= 5; i++)
|
|
235
|
+
setFunctionModule(8, i, getBit(bits, i));
|
|
236
|
+
setFunctionModule(8, 7, getBit(bits, 6));
|
|
237
|
+
setFunctionModule(8, 8, getBit(bits, 7));
|
|
238
|
+
setFunctionModule(7, 8, getBit(bits, 8));
|
|
239
|
+
for (var i = 9; i < 15; i++)
|
|
240
|
+
setFunctionModule(14 - i, 8, getBit(bits, i));
|
|
241
|
+
|
|
242
|
+
// Draw second copy
|
|
243
|
+
for (var i = 0; i < 8; i++)
|
|
244
|
+
setFunctionModule(size - 1 - i, 8, getBit(bits, i));
|
|
245
|
+
for (var i = 8; i < 15; i++)
|
|
246
|
+
setFunctionModule(8, size - 15 + i, getBit(bits, i));
|
|
247
|
+
setFunctionModule(8, size - 8, true); // Always black
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
// Draws two copies of the version bits (with its own error correction code),
|
|
252
|
+
// based on this object's version field, iff 7 <= version <= 40.
|
|
253
|
+
function drawVersion() {
|
|
254
|
+
if (version < 7)
|
|
255
|
+
return;
|
|
256
|
+
|
|
257
|
+
// Calculate error correction code and pack bits
|
|
258
|
+
var rem = version; // version is uint6, in the range [7, 40]
|
|
259
|
+
for (var i = 0; i < 12; i++)
|
|
260
|
+
rem = (rem << 1) ^ ((rem >>> 11) * 0x1F25);
|
|
261
|
+
var bits = version << 12 | rem; // uint18
|
|
262
|
+
if (bits >>> 18 != 0)
|
|
263
|
+
throw "Assertion error";
|
|
264
|
+
|
|
265
|
+
// Draw two copies
|
|
266
|
+
for (var i = 0; i < 18; i++) {
|
|
267
|
+
var bit = getBit(bits, i);
|
|
268
|
+
var a = size - 11 + i % 3;
|
|
269
|
+
var b = Math.floor(i / 3);
|
|
270
|
+
setFunctionModule(a, b, bit);
|
|
271
|
+
setFunctionModule(b, a, bit);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
// Draws a 9*9 finder pattern including the border separator,
|
|
277
|
+
// with the center module at (x, y). Modules can be out of bounds.
|
|
278
|
+
function drawFinderPattern(x, y) {
|
|
279
|
+
for (var dy = -4; dy <= 4; dy++) {
|
|
280
|
+
for (var dx = -4; dx <= 4; dx++) {
|
|
281
|
+
var dist = Math.max(Math.abs(dx), Math.abs(dy)); // Chebyshev/infinity norm
|
|
282
|
+
var xx = x + dx, yy = y + dy;
|
|
283
|
+
if (0 <= xx && xx < size && 0 <= yy && yy < size)
|
|
284
|
+
setFunctionModule(xx, yy, dist != 2 && dist != 4);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
// Draws a 5*5 alignment pattern, with the center module
|
|
291
|
+
// at (x, y). All modules must be in bounds.
|
|
292
|
+
function drawAlignmentPattern(x, y) {
|
|
293
|
+
for (var dy = -2; dy <= 2; dy++) {
|
|
294
|
+
for (var dx = -2; dx <= 2; dx++)
|
|
295
|
+
setFunctionModule(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) != 1);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
// Sets the color of a module and marks it as a function module.
|
|
301
|
+
// Only used by the constructor. Coordinates must be in bounds.
|
|
302
|
+
function setFunctionModule(x, y, isBlack) {
|
|
303
|
+
modules[y][x] = isBlack;
|
|
304
|
+
isFunction[y][x] = true;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
/*---- Private helper methods for constructor: Codewords and masking ----*/
|
|
309
|
+
|
|
310
|
+
// Returns a new byte string representing the given data with the appropriate error correction
|
|
311
|
+
// codewords appended to it, based on this object's version and error correction level.
|
|
312
|
+
function addEccAndInterleave(data) {
|
|
313
|
+
if (data.length != QrCode.getNumDataCodewords(version, errCorLvl))
|
|
314
|
+
throw "Invalid argument";
|
|
315
|
+
|
|
316
|
+
// Calculate parameter numbers
|
|
317
|
+
var numBlocks = QrCode.NUM_ERROR_CORRECTION_BLOCKS[errCorLvl.ordinal][version];
|
|
318
|
+
var blockEccLen = QrCode.ECC_CODEWORDS_PER_BLOCK [errCorLvl.ordinal][version];
|
|
319
|
+
var rawCodewords = Math.floor(QrCode.getNumRawDataModules(version) / 8);
|
|
320
|
+
var numShortBlocks = numBlocks - rawCodewords % numBlocks;
|
|
321
|
+
var shortBlockLen = Math.floor(rawCodewords / numBlocks);
|
|
322
|
+
|
|
323
|
+
// Split data into blocks and append ECC to each block
|
|
324
|
+
var blocks = [];
|
|
325
|
+
var rs = new ReedSolomonGenerator(blockEccLen);
|
|
326
|
+
for (var i = 0, k = 0; i < numBlocks; i++) {
|
|
327
|
+
var dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));
|
|
328
|
+
k += dat.length;
|
|
329
|
+
var ecc = rs.getRemainder(dat);
|
|
330
|
+
if (i < numShortBlocks)
|
|
331
|
+
dat.push(0);
|
|
332
|
+
blocks.push(dat.concat(ecc));
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// Interleave (not concatenate) the bytes from every block into a single sequence
|
|
336
|
+
var result = [];
|
|
337
|
+
for (var i = 0; i < blocks[0].length; i++) {
|
|
338
|
+
for (var j = 0; j < blocks.length; j++) {
|
|
339
|
+
// Skip the padding byte in short blocks
|
|
340
|
+
if (i != shortBlockLen - blockEccLen || j >= numShortBlocks)
|
|
341
|
+
result.push(blocks[j][i]);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (result.length != rawCodewords)
|
|
345
|
+
throw "Assertion error";
|
|
346
|
+
return result;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
|
|
351
|
+
// data area of this QR Code. Function modules need to be marked off before this is called.
|
|
352
|
+
function drawCodewords(data) {
|
|
353
|
+
if (data.length != Math.floor(QrCode.getNumRawDataModules(version) / 8))
|
|
354
|
+
throw "Invalid argument";
|
|
355
|
+
var i = 0; // Bit index into the data
|
|
356
|
+
// Do the funny zigzag scan
|
|
357
|
+
for (var right = size - 1; right >= 1; right -= 2) { // Index of right column in each column pair
|
|
358
|
+
if (right == 6)
|
|
359
|
+
right = 5;
|
|
360
|
+
for (var vert = 0; vert < size; vert++) { // Vertical counter
|
|
361
|
+
for (var j = 0; j < 2; j++) {
|
|
362
|
+
var x = right - j; // Actual x coordinate
|
|
363
|
+
var upward = ((right + 1) & 2) == 0;
|
|
364
|
+
var y = upward ? size - 1 - vert : vert; // Actual y coordinate
|
|
365
|
+
if (!isFunction[y][x] && i < data.length * 8) {
|
|
366
|
+
modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7));
|
|
367
|
+
i++;
|
|
368
|
+
}
|
|
369
|
+
// If this QR Code has any remainder bits (0 to 7), they were assigned as
|
|
370
|
+
// 0/false/white by the constructor and are left unchanged by this method
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (i != data.length * 8)
|
|
375
|
+
throw "Assertion error";
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
// XORs the codeword modules in this QR Code with the given mask pattern.
|
|
380
|
+
// The function modules must be marked and the codeword bits must be drawn
|
|
381
|
+
// before masking. Due to the arithmetic of XOR, calling applyMask() with
|
|
382
|
+
// the same mask value a second time will undo the mask. A final well-formed
|
|
383
|
+
// QR Code needs exactly one (not zero, two, etc.) mask applied.
|
|
384
|
+
function applyMask(mask) {
|
|
385
|
+
if (mask < 0 || mask > 7)
|
|
386
|
+
throw "Mask value out of range";
|
|
387
|
+
for (var y = 0; y < size; y++) {
|
|
388
|
+
for (var x = 0; x < size; x++) {
|
|
389
|
+
var invert;
|
|
390
|
+
switch (mask) {
|
|
391
|
+
case 0: invert = (x + y) % 2 == 0; break;
|
|
392
|
+
case 1: invert = y % 2 == 0; break;
|
|
393
|
+
case 2: invert = x % 3 == 0; break;
|
|
394
|
+
case 3: invert = (x + y) % 3 == 0; break;
|
|
395
|
+
case 4: invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 == 0; break;
|
|
396
|
+
case 5: invert = x * y % 2 + x * y % 3 == 0; break;
|
|
397
|
+
case 6: invert = (x * y % 2 + x * y % 3) % 2 == 0; break;
|
|
398
|
+
case 7: invert = ((x + y) % 2 + x * y % 3) % 2 == 0; break;
|
|
399
|
+
default: throw "Assertion error";
|
|
400
|
+
}
|
|
401
|
+
if (!isFunction[y][x] && invert)
|
|
402
|
+
modules[y][x] = !modules[y][x];
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
// Calculates and returns the penalty score based on state of this QR Code's current modules.
|
|
409
|
+
// This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
|
|
410
|
+
function getPenaltyScore() {
|
|
411
|
+
var result = 0;
|
|
412
|
+
|
|
413
|
+
// Adjacent modules in row having same color
|
|
414
|
+
for (var y = 0; y < size; y++) {
|
|
415
|
+
for (var x = 0, runX, colorX; x < size; x++) {
|
|
416
|
+
if (x == 0 || modules[y][x] != colorX) {
|
|
417
|
+
colorX = modules[y][x];
|
|
418
|
+
runX = 1;
|
|
419
|
+
} else {
|
|
420
|
+
runX++;
|
|
421
|
+
if (runX == 5)
|
|
422
|
+
result += QrCode.PENALTY_N1;
|
|
423
|
+
else if (runX > 5)
|
|
424
|
+
result++;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
// Adjacent modules in column having same color
|
|
429
|
+
for (var x = 0; x < size; x++) {
|
|
430
|
+
for (var y = 0, runY, colorY; y < size; y++) {
|
|
431
|
+
if (y == 0 || modules[y][x] != colorY) {
|
|
432
|
+
colorY = modules[y][x];
|
|
433
|
+
runY = 1;
|
|
434
|
+
} else {
|
|
435
|
+
runY++;
|
|
436
|
+
if (runY == 5)
|
|
437
|
+
result += QrCode.PENALTY_N1;
|
|
438
|
+
else if (runY > 5)
|
|
439
|
+
result++;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// 2*2 blocks of modules having same color
|
|
445
|
+
for (var y = 0; y < size - 1; y++) {
|
|
446
|
+
for (var x = 0; x < size - 1; x++) {
|
|
447
|
+
var color = modules[y][x];
|
|
448
|
+
if ( color == modules[y][x + 1] &&
|
|
449
|
+
color == modules[y + 1][x] &&
|
|
450
|
+
color == modules[y + 1][x + 1])
|
|
451
|
+
result += QrCode.PENALTY_N2;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// Finder-like pattern in rows
|
|
456
|
+
for (var y = 0; y < size; y++) {
|
|
457
|
+
for (var x = 0, bits = 0; x < size; x++) {
|
|
458
|
+
bits = ((bits << 1) & 0x7FF) | (modules[y][x] ? 1 : 0);
|
|
459
|
+
if (x >= 10 && (bits == 0x05D || bits == 0x5D0)) // Needs 11 bits accumulated
|
|
460
|
+
result += QrCode.PENALTY_N3;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
// Finder-like pattern in columns
|
|
464
|
+
for (var x = 0; x < size; x++) {
|
|
465
|
+
for (var y = 0, bits = 0; y < size; y++) {
|
|
466
|
+
bits = ((bits << 1) & 0x7FF) | (modules[y][x] ? 1 : 0);
|
|
467
|
+
if (y >= 10 && (bits == 0x05D || bits == 0x5D0)) // Needs 11 bits accumulated
|
|
468
|
+
result += QrCode.PENALTY_N3;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// Balance of black and white modules
|
|
473
|
+
var black = 0;
|
|
474
|
+
modules.forEach(function(row) {
|
|
475
|
+
row.forEach(function(color) {
|
|
476
|
+
if (color)
|
|
477
|
+
black++;
|
|
478
|
+
});
|
|
479
|
+
});
|
|
480
|
+
var total = size * size; // Note that size is odd, so black/total != 1/2
|
|
481
|
+
// Compute the smallest integer k >= 0 such that (45-5k)% <= black/total <= (55+5k)%
|
|
482
|
+
var k = Math.ceil(Math.abs(black * 20 - total * 10) / total) - 1;
|
|
483
|
+
result += k * QrCode.PENALTY_N4;
|
|
484
|
+
return result;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
// Returns an ascending list of positions of alignment patterns for this version number.
|
|
489
|
+
// Each position is in the range [0,177), and are used on both the x and y axes.
|
|
490
|
+
// This could be implemented as lookup table of 40 variable-length lists of integers.
|
|
491
|
+
function getAlignmentPatternPositions() {
|
|
492
|
+
if (version == 1)
|
|
493
|
+
return [];
|
|
494
|
+
else {
|
|
495
|
+
var numAlign = Math.floor(version / 7) + 2;
|
|
496
|
+
var step = (version == 32) ? 26 :
|
|
497
|
+
Math.ceil((size - 13) / (numAlign*2 - 2)) * 2;
|
|
498
|
+
var result = [6];
|
|
499
|
+
for (var pos = size - 7; result.length < numAlign; pos -= step)
|
|
500
|
+
result.splice(1, 0, pos);
|
|
501
|
+
return result;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
// Returns true iff the i'th bit of x is set to 1.
|
|
507
|
+
function getBit(x, i) {
|
|
508
|
+
return ((x >>> i) & 1) != 0;
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
/*---- Static factory functions (high level) for QrCode ----*/
|
|
514
|
+
|
|
515
|
+
/*
|
|
516
|
+
* Returns a QR Code representing the given Unicode text string at the given error correction level.
|
|
517
|
+
* As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer
|
|
518
|
+
* Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
|
|
519
|
+
* QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
|
|
520
|
+
* ecl argument if it can be done without increasing the version.
|
|
521
|
+
*/
|
|
522
|
+
this.QrCode.encodeText = function(text, ecl) {
|
|
523
|
+
var segs = qrcodegen.QrSegment.makeSegments(text);
|
|
524
|
+
return this.encodeSegments(segs, ecl);
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
/*
|
|
529
|
+
* Returns a QR Code representing the given binary data at the given error correction level.
|
|
530
|
+
* This function always encodes using the binary segment mode, not any text mode. The maximum number of
|
|
531
|
+
* bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
|
|
532
|
+
* The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
|
533
|
+
*/
|
|
534
|
+
this.QrCode.encodeBinary = function(data, ecl) {
|
|
535
|
+
var seg = qrcodegen.QrSegment.makeBytes(data);
|
|
536
|
+
return this.encodeSegments([seg], ecl);
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
/*---- Static factory functions (mid level) for QrCode ----*/
|
|
541
|
+
|
|
542
|
+
/*
|
|
543
|
+
* Returns a QR Code representing the given segments with the given encoding parameters.
|
|
544
|
+
* The smallest possible QR Code version within the given range is automatically
|
|
545
|
+
* chosen for the output. Iff boostEcl is true, then the ECC level of the result
|
|
546
|
+
* may be higher than the ecl argument if it can be done without increasing the
|
|
547
|
+
* version. The mask number is either between 0 to 7 (inclusive) to force that
|
|
548
|
+
* mask, or -1 to automatically choose an appropriate mask (which may be slow).
|
|
549
|
+
* This function allows the user to create a custom sequence of segments that switches
|
|
550
|
+
* between modes (such as alphanumeric and byte) to encode text in less space.
|
|
551
|
+
* This is a mid-level API; the high-level API is encodeText() and encodeBinary().
|
|
552
|
+
*/
|
|
553
|
+
this.QrCode.encodeSegments = function(segs, ecl, minVersion, maxVersion, mask, boostEcl) {
|
|
554
|
+
if (minVersion == undefined) minVersion = MIN_VERSION;
|
|
555
|
+
if (maxVersion == undefined) maxVersion = MAX_VERSION;
|
|
556
|
+
if (mask == undefined) mask = -1;
|
|
557
|
+
if (boostEcl == undefined) boostEcl = true;
|
|
558
|
+
if (!(MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= MAX_VERSION) || mask < -1 || mask > 7)
|
|
559
|
+
throw "Invalid value";
|
|
560
|
+
|
|
561
|
+
// Find the minimal version number to use
|
|
562
|
+
var version, dataUsedBits;
|
|
563
|
+
for (version = minVersion; ; version++) {
|
|
564
|
+
var dataCapacityBits = QrCode.getNumDataCodewords(version, ecl) * 8; // Number of data bits available
|
|
565
|
+
dataUsedBits = qrcodegen.QrSegment.getTotalBits(segs, version);
|
|
566
|
+
if (dataUsedBits <= dataCapacityBits)
|
|
567
|
+
break; // This version number is found to be suitable
|
|
568
|
+
if (version >= maxVersion) // All versions in the range could not fit the given data
|
|
569
|
+
throw "Data too long";
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// Increase the error correction level while the data still fits in the current version number
|
|
573
|
+
[this.Ecc.MEDIUM, this.Ecc.QUARTILE, this.Ecc.HIGH].forEach(function(newEcl) { // From low to high
|
|
574
|
+
if (boostEcl && dataUsedBits <= QrCode.getNumDataCodewords(version, newEcl) * 8)
|
|
575
|
+
ecl = newEcl;
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
// Concatenate all segments to create the data bit string
|
|
579
|
+
var bb = new BitBuffer();
|
|
580
|
+
segs.forEach(function(seg) {
|
|
581
|
+
bb.appendBits(seg.mode.modeBits, 4);
|
|
582
|
+
bb.appendBits(seg.numChars, seg.mode.numCharCountBits(version));
|
|
583
|
+
seg.getData().forEach(function(bit) {
|
|
584
|
+
bb.push(bit);
|
|
585
|
+
});
|
|
586
|
+
});
|
|
587
|
+
if (bb.length != dataUsedBits)
|
|
588
|
+
throw "Assertion error";
|
|
589
|
+
|
|
590
|
+
// Add terminator and pad up to a byte if applicable
|
|
591
|
+
var dataCapacityBits = QrCode.getNumDataCodewords(version, ecl) * 8;
|
|
592
|
+
if (bb.length > dataCapacityBits)
|
|
593
|
+
throw "Assertion error";
|
|
594
|
+
bb.appendBits(0, Math.min(4, dataCapacityBits - bb.length));
|
|
595
|
+
bb.appendBits(0, (8 - bb.length % 8) % 8);
|
|
596
|
+
if (bb.length % 8 != 0)
|
|
597
|
+
throw "Assertion error";
|
|
598
|
+
|
|
599
|
+
// Pad with alternating bytes until data capacity is reached
|
|
600
|
+
for (var padByte = 0xEC; bb.length < dataCapacityBits; padByte ^= 0xEC ^ 0x11)
|
|
601
|
+
bb.appendBits(padByte, 8);
|
|
602
|
+
|
|
603
|
+
// Pack bits into bytes in big endian
|
|
604
|
+
var dataCodewords = [];
|
|
605
|
+
while (dataCodewords.length * 8 < bb.length)
|
|
606
|
+
dataCodewords.push(0);
|
|
607
|
+
bb.forEach(function(bit, i) {
|
|
608
|
+
dataCodewords[i >>> 3] |= bit << (7 - (i & 7));
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
// Create the QR Code object
|
|
612
|
+
return new this(version, ecl, dataCodewords, mask);
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
/*---- Private static helper functions for QrCode ----*/
|
|
617
|
+
|
|
618
|
+
var QrCode = {}; // Private object to assign properties to. Not the same object as 'this.QrCode'.
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
// Returns the number of data bits that can be stored in a QR Code of the given version number, after
|
|
622
|
+
// all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
|
|
623
|
+
// The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
|
|
624
|
+
QrCode.getNumRawDataModules = function(ver) {
|
|
625
|
+
if (ver < MIN_VERSION || ver > MAX_VERSION)
|
|
626
|
+
throw "Version number out of range";
|
|
627
|
+
var result = (16 * ver + 128) * ver + 64;
|
|
628
|
+
if (ver >= 2) {
|
|
629
|
+
var numAlign = Math.floor(ver / 7) + 2;
|
|
630
|
+
result -= (25 * numAlign - 10) * numAlign - 55;
|
|
631
|
+
if (ver >= 7)
|
|
632
|
+
result -= 36;
|
|
633
|
+
}
|
|
634
|
+
return result;
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
// Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
|
|
639
|
+
// QR Code of the given version number and error correction level, with remainder bits discarded.
|
|
640
|
+
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
|
|
641
|
+
QrCode.getNumDataCodewords = function(ver, ecl) {
|
|
642
|
+
return Math.floor(QrCode.getNumRawDataModules(ver) / 8) -
|
|
643
|
+
QrCode.ECC_CODEWORDS_PER_BLOCK [ecl.ordinal][ver] *
|
|
644
|
+
QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
/*---- Constants and tables for QrCode ----*/
|
|
649
|
+
|
|
650
|
+
var MIN_VERSION = 1; // The minimum version number supported in the QR Code Model 2 standard
|
|
651
|
+
var MAX_VERSION = 40; // The maximum version number supported in the QR Code Model 2 standard
|
|
652
|
+
Object.defineProperty(this.QrCode, "MIN_VERSION", {value:MIN_VERSION});
|
|
653
|
+
Object.defineProperty(this.QrCode, "MAX_VERSION", {value:MAX_VERSION});
|
|
654
|
+
|
|
655
|
+
// For use in getPenaltyScore(), when evaluating which mask is best.
|
|
656
|
+
QrCode.PENALTY_N1 = 3;
|
|
657
|
+
QrCode.PENALTY_N2 = 3;
|
|
658
|
+
QrCode.PENALTY_N3 = 40;
|
|
659
|
+
QrCode.PENALTY_N4 = 10;
|
|
660
|
+
|
|
661
|
+
QrCode.ECC_CODEWORDS_PER_BLOCK = [
|
|
662
|
+
// Version: (note that index 0 is for padding, and is set to an illegal value)
|
|
663
|
+
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
|
|
664
|
+
[null, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], // Low
|
|
665
|
+
[null, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28], // Medium
|
|
666
|
+
[null, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], // Quartile
|
|
667
|
+
[null, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], // High
|
|
668
|
+
];
|
|
669
|
+
|
|
670
|
+
QrCode.NUM_ERROR_CORRECTION_BLOCKS = [
|
|
671
|
+
// Version: (note that index 0 is for padding, and is set to an illegal value)
|
|
672
|
+
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
|
|
673
|
+
[null, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25], // Low
|
|
674
|
+
[null, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49], // Medium
|
|
675
|
+
[null, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68], // Quartile
|
|
676
|
+
[null, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81], // High
|
|
677
|
+
];
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
/*---- Public helper enumeration ----*/
|
|
681
|
+
|
|
682
|
+
/*
|
|
683
|
+
* The error correction level in a QR Code symbol. Immutable.
|
|
684
|
+
*/
|
|
685
|
+
this.QrCode.Ecc = {
|
|
686
|
+
LOW : new Ecc(0, 1), // The QR Code can tolerate about 7% erroneous codewords
|
|
687
|
+
MEDIUM : new Ecc(1, 0), // The QR Code can tolerate about 15% erroneous codewords
|
|
688
|
+
QUARTILE: new Ecc(2, 3), // The QR Code can tolerate about 25% erroneous codewords
|
|
689
|
+
HIGH : new Ecc(3, 2), // The QR Code can tolerate about 30% erroneous codewords
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
// Private constructor.
|
|
694
|
+
function Ecc(ord, fb) {
|
|
695
|
+
// (Public) In the range 0 to 3 (unsigned 2-bit integer)
|
|
696
|
+
Object.defineProperty(this, "ordinal", {value:ord});
|
|
697
|
+
|
|
698
|
+
// (Package-private) In the range 0 to 3 (unsigned 2-bit integer)
|
|
699
|
+
Object.defineProperty(this, "formatBits", {value:fb});
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
/*---- Data segment class ----*/
|
|
705
|
+
|
|
706
|
+
/*
|
|
707
|
+
* A segment of character/binary/control data in a QR Code symbol.
|
|
708
|
+
* Instances of this class are immutable.
|
|
709
|
+
* The mid-level way to create a segment is to take the payload data
|
|
710
|
+
* and call a static factory function such as QrSegment.makeNumeric().
|
|
711
|
+
* The low-level way to create a segment is to custom-make the bit buffer
|
|
712
|
+
* and call the QrSegment() constructor with appropriate values.
|
|
713
|
+
* This segment class imposes no length restrictions, but QR Codes have restrictions.
|
|
714
|
+
* Even in the most favorable conditions, a QR Code can only hold 7089 characters of data.
|
|
715
|
+
* Any segment longer than this is meaningless for the purpose of generating QR Codes.
|
|
716
|
+
* This constructor creates a QR Code segment with the given attributes and data.
|
|
717
|
+
* The character count (numChars) must agree with the mode and the bit buffer length,
|
|
718
|
+
* but the constraint isn't checked. The given bit buffer is cloned and stored.
|
|
719
|
+
*/
|
|
720
|
+
this.QrSegment = function(mode, numChars, bitData) {
|
|
721
|
+
/*---- Constructor (low level) ----*/
|
|
722
|
+
if (numChars < 0 || !(mode instanceof Mode))
|
|
723
|
+
throw "Invalid argument";
|
|
724
|
+
|
|
725
|
+
// The data bits of this segment. Accessed through getData().
|
|
726
|
+
bitData = bitData.slice(); // Make defensive copy
|
|
727
|
+
|
|
728
|
+
// The mode indicator of this segment.
|
|
729
|
+
Object.defineProperty(this, "mode", {value:mode});
|
|
730
|
+
|
|
731
|
+
// The length of this segment's unencoded data. Measured in characters for
|
|
732
|
+
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
|
|
733
|
+
// Always zero or positive. Not the same as the data's bit length.
|
|
734
|
+
Object.defineProperty(this, "numChars", {value:numChars});
|
|
735
|
+
|
|
736
|
+
// Returns a new copy of the data bits of this segment.
|
|
737
|
+
this.getData = function() {
|
|
738
|
+
return bitData.slice(); // Make defensive copy
|
|
739
|
+
};
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
/*---- Static factory functions (mid level) for QrSegment ----*/
|
|
744
|
+
|
|
745
|
+
/*
|
|
746
|
+
* Returns a segment representing the given binary data encoded in
|
|
747
|
+
* byte mode. All input byte arrays are acceptable. Any text string
|
|
748
|
+
* can be converted to UTF-8 bytes and encoded as a byte mode segment.
|
|
749
|
+
*/
|
|
750
|
+
this.QrSegment.makeBytes = function(data) {
|
|
751
|
+
var bb = new BitBuffer();
|
|
752
|
+
data.forEach(function(b) {
|
|
753
|
+
bb.appendBits(b, 8);
|
|
754
|
+
});
|
|
755
|
+
return new this(this.Mode.BYTE, data.length, bb);
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
/*
|
|
760
|
+
* Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
|
761
|
+
*/
|
|
762
|
+
this.QrSegment.makeNumeric = function(digits) {
|
|
763
|
+
if (!this.NUMERIC_REGEX.test(digits))
|
|
764
|
+
throw "String contains non-numeric characters";
|
|
765
|
+
var bb = new BitBuffer();
|
|
766
|
+
for (var i = 0; i < digits.length; ) { // Consume up to 3 digits per iteration
|
|
767
|
+
var n = Math.min(digits.length - i, 3);
|
|
768
|
+
bb.appendBits(parseInt(digits.substr(i, n), 10), n * 3 + 1);
|
|
769
|
+
i += n;
|
|
770
|
+
}
|
|
771
|
+
return new this(this.Mode.NUMERIC, digits.length, bb);
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
/*
|
|
776
|
+
* Returns a segment representing the given text string encoded in alphanumeric mode.
|
|
777
|
+
* The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
|
778
|
+
* dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
779
|
+
*/
|
|
780
|
+
this.QrSegment.makeAlphanumeric = function(text) {
|
|
781
|
+
if (!this.ALPHANUMERIC_REGEX.test(text))
|
|
782
|
+
throw "String contains unencodable characters in alphanumeric mode";
|
|
783
|
+
var bb = new BitBuffer();
|
|
784
|
+
var i;
|
|
785
|
+
for (i = 0; i + 2 <= text.length; i += 2) { // Process groups of 2
|
|
786
|
+
var temp = QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)) * 45;
|
|
787
|
+
temp += QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i + 1));
|
|
788
|
+
bb.appendBits(temp, 11);
|
|
789
|
+
}
|
|
790
|
+
if (i < text.length) // 1 character remaining
|
|
791
|
+
bb.appendBits(QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6);
|
|
792
|
+
return new this(this.Mode.ALPHANUMERIC, text.length, bb);
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
/*
|
|
797
|
+
* Returns a new mutable list of zero or more segments to represent the given Unicode text string.
|
|
798
|
+
* The result may use various segment modes and switch modes to optimize the length of the bit stream.
|
|
799
|
+
*/
|
|
800
|
+
this.QrSegment.makeSegments = function(text) {
|
|
801
|
+
// Select the most efficient segment encoding automatically
|
|
802
|
+
if (text == "")
|
|
803
|
+
return [];
|
|
804
|
+
else if (this.NUMERIC_REGEX.test(text))
|
|
805
|
+
return [this.makeNumeric(text)];
|
|
806
|
+
else if (this.ALPHANUMERIC_REGEX.test(text))
|
|
807
|
+
return [this.makeAlphanumeric(text)];
|
|
808
|
+
else
|
|
809
|
+
return [this.makeBytes(toUtf8ByteArray(text))];
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
/*
|
|
814
|
+
* Returns a segment representing an Extended Channel Interpretation
|
|
815
|
+
* (ECI) designator with the given assignment value.
|
|
816
|
+
*/
|
|
817
|
+
this.QrSegment.makeEci = function(assignVal) {
|
|
818
|
+
var bb = new BitBuffer();
|
|
819
|
+
if (assignVal < 0)
|
|
820
|
+
throw "ECI assignment value out of range";
|
|
821
|
+
else if (assignVal < (1 << 7))
|
|
822
|
+
bb.appendBits(assignVal, 8);
|
|
823
|
+
else if (assignVal < (1 << 14)) {
|
|
824
|
+
bb.appendBits(2, 2);
|
|
825
|
+
bb.appendBits(assignVal, 14);
|
|
826
|
+
} else if (assignVal < 1000000) {
|
|
827
|
+
bb.appendBits(6, 3);
|
|
828
|
+
bb.appendBits(assignVal, 21);
|
|
829
|
+
} else
|
|
830
|
+
throw "ECI assignment value out of range";
|
|
831
|
+
return new this(this.Mode.ECI, 0, bb);
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
// (Package-private) Calculates and returns the number of bits needed to encode the given segments at the
|
|
836
|
+
// given version. The result is infinity if a segment has too many characters to fit its length field.
|
|
837
|
+
this.QrSegment.getTotalBits = function(segs, version) {
|
|
838
|
+
var result = 0;
|
|
839
|
+
for (var i = 0; i < segs.length; i++) {
|
|
840
|
+
var seg = segs[i];
|
|
841
|
+
var ccbits = seg.mode.numCharCountBits(version);
|
|
842
|
+
if (seg.numChars >= (1 << ccbits))
|
|
843
|
+
return Infinity; // The segment's length doesn't fit the field's bit width
|
|
844
|
+
result += 4 + ccbits + seg.getData().length;
|
|
845
|
+
}
|
|
846
|
+
return result;
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
/*---- Constants for QrSegment ----*/
|
|
851
|
+
|
|
852
|
+
var QrSegment = {}; // Private object to assign properties to. Not the same object as 'this.QrSegment'.
|
|
853
|
+
|
|
854
|
+
// (Public) Describes precisely all strings that are encodable in numeric mode.
|
|
855
|
+
// To test whether a string s is encodable: var ok = NUMERIC_REGEX.test(s);
|
|
856
|
+
// A string is encodable iff each character is in the range 0 to 9.
|
|
857
|
+
this.QrSegment.NUMERIC_REGEX = /^[0-9]*$/;
|
|
858
|
+
|
|
859
|
+
// (Public) Describes precisely all strings that are encodable in alphanumeric mode.
|
|
860
|
+
// To test whether a string s is encodable: var ok = ALPHANUMERIC_REGEX.test(s);
|
|
861
|
+
// A string is encodable iff each character is in the following set: 0 to 9, A to Z
|
|
862
|
+
// (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
863
|
+
this.QrSegment.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/;
|
|
864
|
+
|
|
865
|
+
// (Private) The set of all legal characters in alphanumeric mode,
|
|
866
|
+
// where each character value maps to the index in the string.
|
|
867
|
+
QrSegment.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
/*---- Public helper enumeration ----*/
|
|
871
|
+
|
|
872
|
+
/*
|
|
873
|
+
* Describes how a segment's data bits are interpreted. Immutable.
|
|
874
|
+
*/
|
|
875
|
+
this.QrSegment.Mode = { // Constants
|
|
876
|
+
NUMERIC : new Mode(0x1, [10, 12, 14]),
|
|
877
|
+
ALPHANUMERIC: new Mode(0x2, [ 9, 11, 13]),
|
|
878
|
+
BYTE : new Mode(0x4, [ 8, 16, 16]),
|
|
879
|
+
KANJI : new Mode(0x8, [ 8, 10, 12]),
|
|
880
|
+
ECI : new Mode(0x7, [ 0, 0, 0]),
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
// Private constructor.
|
|
885
|
+
function Mode(mode, ccbits) {
|
|
886
|
+
// (Package-private) The mode indicator bits, which is a uint4 value (range 0 to 15).
|
|
887
|
+
Object.defineProperty(this, "modeBits", {value:mode});
|
|
888
|
+
|
|
889
|
+
// (Package-private) Returns the bit width of the character count field for a segment in
|
|
890
|
+
// this mode in a QR Code at the given version number. The result is in the range [0, 16].
|
|
891
|
+
this.numCharCountBits = function(ver) {
|
|
892
|
+
return ccbits[Math.floor((ver + 7) / 17)];
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
/*---- Private helper functions and classes ----*/
|
|
899
|
+
|
|
900
|
+
// Returns a new array of bytes representing the given string encoded in UTF-8.
|
|
901
|
+
function toUtf8ByteArray(str) {
|
|
902
|
+
str = encodeURI(str);
|
|
903
|
+
var result = [];
|
|
904
|
+
for (var i = 0; i < str.length; i++) {
|
|
905
|
+
if (str.charAt(i) != "%")
|
|
906
|
+
result.push(str.charCodeAt(i));
|
|
907
|
+
else {
|
|
908
|
+
result.push(parseInt(str.substr(i + 1, 2), 16));
|
|
909
|
+
i += 2;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
return result;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
/*
|
|
918
|
+
* A private helper class that computes the Reed-Solomon error correction codewords for a sequence of
|
|
919
|
+
* data codewords at a given degree. Objects are immutable, and the state only depends on the degree.
|
|
920
|
+
* This class exists because each data block in a QR Code shares the same the divisor polynomial.
|
|
921
|
+
* This constructor creates a Reed-Solomon ECC generator for the given degree. This could be implemented
|
|
922
|
+
* as a lookup table over all possible parameter values, instead of as an algorithm.
|
|
923
|
+
*/
|
|
924
|
+
function ReedSolomonGenerator(degree) {
|
|
925
|
+
if (degree < 1 || degree > 255)
|
|
926
|
+
throw "Degree out of range";
|
|
927
|
+
|
|
928
|
+
// Coefficients of the divisor polynomial, stored from highest to lowest power, excluding the leading term which
|
|
929
|
+
// is always 1. For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}.
|
|
930
|
+
var coefficients = [];
|
|
931
|
+
|
|
932
|
+
// Start with the monomial x^0
|
|
933
|
+
for (var i = 0; i < degree - 1; i++)
|
|
934
|
+
coefficients.push(0);
|
|
935
|
+
coefficients.push(1);
|
|
936
|
+
|
|
937
|
+
// Compute the product polynomial (x - r^0) * (x - r^1) * (x - r^2) * ... * (x - r^{degree-1}),
|
|
938
|
+
// drop the highest term, and store the rest of the coefficients in order of descending powers.
|
|
939
|
+
// Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D).
|
|
940
|
+
var root = 1;
|
|
941
|
+
for (var i = 0; i < degree; i++) {
|
|
942
|
+
// Multiply the current product by (x - r^i)
|
|
943
|
+
for (var j = 0; j < coefficients.length; j++) {
|
|
944
|
+
coefficients[j] = ReedSolomonGenerator.multiply(coefficients[j], root);
|
|
945
|
+
if (j + 1 < coefficients.length)
|
|
946
|
+
coefficients[j] ^= coefficients[j + 1];
|
|
947
|
+
}
|
|
948
|
+
root = ReedSolomonGenerator.multiply(root, 0x02);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
// Computes and returns the Reed-Solomon error correction codewords for the given
|
|
952
|
+
// sequence of data codewords. The returned object is always a new byte array.
|
|
953
|
+
// This method does not alter this object's state (because it is immutable).
|
|
954
|
+
this.getRemainder = function(data) {
|
|
955
|
+
// Compute the remainder by performing polynomial division
|
|
956
|
+
var result = coefficients.map(function() { return 0; });
|
|
957
|
+
data.forEach(function(b) {
|
|
958
|
+
var factor = b ^ result.shift();
|
|
959
|
+
result.push(0);
|
|
960
|
+
for (var i = 0; i < result.length; i++)
|
|
961
|
+
result[i] ^= ReedSolomonGenerator.multiply(coefficients[i], factor);
|
|
962
|
+
});
|
|
963
|
+
return result;
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
// This static function returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and
|
|
968
|
+
// result are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
|
|
969
|
+
ReedSolomonGenerator.multiply = function(x, y) {
|
|
970
|
+
if (x >>> 8 != 0 || y >>> 8 != 0)
|
|
971
|
+
throw "Byte out of range";
|
|
972
|
+
// Russian peasant multiplication
|
|
973
|
+
var z = 0;
|
|
974
|
+
for (var i = 7; i >= 0; i--) {
|
|
975
|
+
z = (z << 1) ^ ((z >>> 7) * 0x11D);
|
|
976
|
+
z ^= ((y >>> i) & 1) * x;
|
|
977
|
+
}
|
|
978
|
+
if (z >>> 8 != 0)
|
|
979
|
+
throw "Assertion error";
|
|
980
|
+
return z;
|
|
981
|
+
};
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
/*
|
|
986
|
+
* A private helper class that represents an appendable sequence of bits (0s and 1s).
|
|
987
|
+
* Mainly used by QrSegment. This constructor creates an empty bit buffer (length 0).
|
|
988
|
+
*/
|
|
989
|
+
function BitBuffer() {
|
|
990
|
+
Array.call(this);
|
|
991
|
+
|
|
992
|
+
// Appends the given number of low-order bits of the given value
|
|
993
|
+
// to this buffer. Requires 0 <= len <= 31 and 0 <= val < 2^len.
|
|
994
|
+
this.appendBits = function(val, len) {
|
|
995
|
+
if (len < 0 || len > 31 || val >>> len != 0)
|
|
996
|
+
throw "Value out of range";
|
|
997
|
+
for (var i = len - 1; i >= 0; i--) // Append bit by bit
|
|
998
|
+
this.push((val >>> i) & 1);
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
BitBuffer.prototype = Object.create(Array.prototype);
|
|
1003
|
+
BitBuffer.prototype.constructor = BitBuffer;
|
|
1004
|
+
|
|
1005
|
+
};
|
|
1006
|
+
|
|
1007
|
+
var ErrorCorrectionLevel;
|
|
1008
|
+
(function (ErrorCorrectionLevel) {
|
|
1009
|
+
ErrorCorrectionLevel["L"] = "L";
|
|
1010
|
+
ErrorCorrectionLevel["M"] = "M";
|
|
1011
|
+
ErrorCorrectionLevel["Q"] = "Q";
|
|
1012
|
+
ErrorCorrectionLevel["H"] = "H";
|
|
1013
|
+
})(ErrorCorrectionLevel || (ErrorCorrectionLevel = {}));
|
|
1014
|
+
var Environment;
|
|
1015
|
+
(function (Environment) {
|
|
1016
|
+
Environment["production"] = "production";
|
|
1017
|
+
Environment["staging"] = "staging";
|
|
1018
|
+
})(Environment || (Environment = {}));
|
|
1019
|
+
var ThemePreset;
|
|
1020
|
+
(function (ThemePreset) {
|
|
1021
|
+
ThemePreset["light"] = "light";
|
|
1022
|
+
ThemePreset["dark"] = "dark";
|
|
1023
|
+
})(ThemePreset || (ThemePreset = {}));
|
|
1024
|
+
|
|
1025
|
+
const QRC = qrcodegen.QrCode;
|
|
1026
|
+
const QRCode = /*@__PURE__*/ proxyCustomElement(class QRCode extends HTMLElement {
|
|
1027
|
+
constructor() {
|
|
1028
|
+
super();
|
|
1029
|
+
this.__registerHost();
|
|
1030
|
+
this.url = undefined;
|
|
1031
|
+
this.level = ErrorCorrectionLevel.M;
|
|
1032
|
+
this.class = '';
|
|
1033
|
+
this.color = 'black';
|
|
1034
|
+
}
|
|
1035
|
+
render() {
|
|
1036
|
+
const getEcc = (ecc) => {
|
|
1037
|
+
ecc = ecc.toUpperCase();
|
|
1038
|
+
if (ecc === 'L')
|
|
1039
|
+
return QRC.Ecc.LOW;
|
|
1040
|
+
if (ecc === 'M')
|
|
1041
|
+
return QRC.Ecc.MEDIUM;
|
|
1042
|
+
if (ecc === 'Q')
|
|
1043
|
+
return QRC.Ecc.QUARTILE;
|
|
1044
|
+
return QRC.Ecc.HIGH;
|
|
1045
|
+
};
|
|
1046
|
+
const ecc = getEcc(this.level);
|
|
1047
|
+
const qr = QRC.encodeText(this.url, ecc);
|
|
1048
|
+
const qrcode = qr.svgObject();
|
|
1049
|
+
return (h("svg", { class: this.class, viewBox: `0 0 ${qrcode.size} ${qrcode.size}` }, h("path", { d: qrcode.path, fill: this.color })));
|
|
1050
|
+
}
|
|
1051
|
+
}, [0, "qr-code", {
|
|
1052
|
+
"url": [1],
|
|
1053
|
+
"level": [1],
|
|
1054
|
+
"class": [1],
|
|
1055
|
+
"color": [1]
|
|
1056
|
+
}]);
|
|
1057
|
+
function defineCustomElement() {
|
|
1058
|
+
if (typeof customElements === "undefined") {
|
|
1059
|
+
return;
|
|
1060
|
+
}
|
|
1061
|
+
const components = ["qr-code"];
|
|
1062
|
+
components.forEach(tagName => { switch (tagName) {
|
|
1063
|
+
case "qr-code":
|
|
1064
|
+
if (!customElements.get(tagName)) {
|
|
1065
|
+
customElements.define(tagName, QRCode);
|
|
1066
|
+
}
|
|
1067
|
+
break;
|
|
1068
|
+
} });
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
export { Environment as E, QRCode as Q, ThemePreset as T, ErrorCorrectionLevel as a, defineCustomElement as d };
|
|
1072
|
+
|
|
1073
|
+
//# sourceMappingURL=qrcode.js.map
|