wj-elements 0.1.48 → 0.1.49
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/custom-elements.json +14058 -0
- package/dist/dark.css +1 -0
- package/dist/light.css +1 -0
- package/dist/localize.js +45 -0
- package/dist/popup.element-CWsSOxs2.js +1072 -0
- package/dist/router-links-FtZbFUto.js +146 -0
- package/dist/styles.css +1 -0
- package/dist/web-types.json +3122 -0
- package/dist/wje-accordion-item.js +88 -0
- package/dist/wje-accordion.js +79 -0
- package/dist/wje-animation.js +121 -0
- package/dist/wje-aside.js +55 -0
- package/dist/wje-avatar.js +77 -0
- package/dist/wje-badge.js +50 -0
- package/dist/wje-breadcrumb.js +148 -0
- package/dist/wje-breadcrumbs.js +67 -0
- package/dist/wje-button-group.js +78 -0
- package/dist/wje-button.js +207 -0
- package/dist/wje-card-content.js +48 -0
- package/dist/wje-card-controls.js +48 -0
- package/dist/wje-card-header.js +47 -0
- package/dist/wje-card-subtitle.js +55 -0
- package/dist/wje-card-title.js +55 -0
- package/dist/wje-card.js +50 -0
- package/dist/wje-carousel-item.js +33 -0
- package/dist/wje-carousel.js +177 -0
- package/dist/wje-checkbox.js +96 -0
- package/dist/wje-chip.js +32 -0
- package/dist/wje-col.js +27 -0
- package/dist/wje-color-picker.js +953 -0
- package/dist/wje-container.js +57 -0
- package/dist/wje-copy-button.js +170 -0
- package/dist/wje-dialog.js +86 -0
- package/dist/wje-divider.js +53 -0
- package/dist/wje-dropdown.js +114 -0
- package/dist/wje-element.js +453 -0
- package/dist/wje-fetchAndParseCSS.js +40 -0
- package/dist/wje-file-upload-item.js +115 -0
- package/dist/wje-file-upload.js +297 -0
- package/dist/wje-footer.js +56 -0
- package/dist/wje-form.js +28 -0
- package/dist/wje-format-digital.js +85 -0
- package/dist/wje-grid.js +28 -0
- package/dist/wje-header.js +58 -0
- package/dist/wje-icon-picker.js +221 -0
- package/dist/wje-icon.js +119 -0
- package/dist/wje-img-comparer.js +111 -0
- package/dist/wje-img.js +58 -0
- package/dist/wje-infinite-scroll.js +201 -0
- package/dist/wje-inline-edit.js +145 -0
- package/dist/wje-input-file.js +85 -0
- package/dist/wje-input.js +334 -0
- package/dist/wje-item.js +45 -0
- package/dist/wje-label.js +67 -0
- package/dist/wje-list.js +53 -0
- package/dist/wje-main.js +56 -0
- package/dist/wje-masonry.js +218 -0
- package/dist/wje-master.js +423 -0
- package/dist/wje-menu-button.js +65 -0
- package/dist/wje-menu-item.js +230 -0
- package/dist/wje-menu-label.js +57 -0
- package/dist/wje-menu.js +74 -0
- package/dist/wje-option.js +99 -0
- package/dist/wje-options.js +63 -0
- package/dist/wje-popup.js +5 -0
- package/dist/wje-progress-bar.js +161 -0
- package/dist/wje-qr-code.js +2332 -0
- package/dist/wje-radio-group.js +101 -0
- package/dist/wje-radio.js +46 -0
- package/dist/wje-rate.js +260 -0
- package/dist/wje-relative-time.js +85 -0
- package/dist/wje-reorder-dropzone.js +27 -0
- package/dist/wje-reorder-handle.js +115 -0
- package/dist/wje-reorder-item.js +32 -0
- package/dist/wje-reorder.js +138 -0
- package/dist/wje-route.js +46 -0
- package/dist/wje-router-link.js +64 -0
- package/dist/wje-router-outlet.js +127 -0
- package/dist/wje-routerx.js +1088 -0
- package/dist/wje-row.js +58 -0
- package/dist/wje-select.js +242 -0
- package/dist/wje-slider.js +177 -0
- package/dist/wje-sliding-container.js +277 -0
- package/dist/wje-split-view.js +112 -0
- package/dist/wje-status.js +54 -0
- package/dist/wje-store.js +192 -0
- package/dist/wje-tab-group.js +107 -0
- package/dist/wje-tab-panel.js +52 -0
- package/dist/wje-tab.js +59 -0
- package/dist/wje-textarea.js +116 -0
- package/dist/wje-thumbnail.js +64 -0
- package/dist/wje-toast.js +76 -0
- package/dist/wje-toggle.js +94 -0
- package/dist/wje-toolbar-action.js +63 -0
- package/dist/wje-toolbar.js +61 -0
- package/dist/wje-tooltip.js +116 -0
- package/dist/wje-visually-hidden.js +56 -0
- package/package.json +1 -1
|
@@ -0,0 +1,2332 @@
|
|
|
1
|
+
var oe = Object.defineProperty;
|
|
2
|
+
var ce = (o, b, l) => b in o ? oe(o, b, { enumerable: !0, configurable: !0, writable: !0, value: l }) : o[b] = l;
|
|
3
|
+
var j = (o, b, l) => (ce(o, typeof b != "symbol" ? b + "" : b, l), l);
|
|
4
|
+
import le from "./wje-element.js";
|
|
5
|
+
const de = ".container{display:flex;flex-direction:column;align-items:center;justify-content:center;position:relative;gap:.5rem;padding:.5rem}";
|
|
6
|
+
var ue = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
7
|
+
function he(o) {
|
|
8
|
+
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
9
|
+
}
|
|
10
|
+
var q = { exports: {} };
|
|
11
|
+
(function(o, b) {
|
|
12
|
+
(function(l, O) {
|
|
13
|
+
o.exports = O();
|
|
14
|
+
})(ue, function() {
|
|
15
|
+
var l = (
|
|
16
|
+
/* istanbul ignore next */
|
|
17
|
+
function() {
|
|
18
|
+
}
|
|
19
|
+
), O = Object.prototype.hasOwnProperty, E = Array.prototype.slice;
|
|
20
|
+
function B(t, e) {
|
|
21
|
+
var i;
|
|
22
|
+
return typeof Object.create == "function" ? i = Object.create(t) : (l.prototype = t, i = new l(), l.prototype = null), e && k(!0, i, e), i;
|
|
23
|
+
}
|
|
24
|
+
function d(t, e, i, r) {
|
|
25
|
+
var a = this;
|
|
26
|
+
return typeof t != "string" && (r = i, i = e, e = t, t = null), typeof e != "function" && (r = i, i = e, e = function() {
|
|
27
|
+
return a.apply(this, arguments);
|
|
28
|
+
}), k(!1, e, a, r), e.prototype = B(a.prototype, i), e.prototype.constructor = e, e.class_ = t || a.class_, e.super_ = a, e;
|
|
29
|
+
}
|
|
30
|
+
function k(t, e, i) {
|
|
31
|
+
i = E.call(arguments, 2);
|
|
32
|
+
for (var r, a, x = 0, n = i.length; x < n; x++) {
|
|
33
|
+
a = i[x];
|
|
34
|
+
for (r in a)
|
|
35
|
+
(!t || O.call(a, r)) && (e[r] = a[r]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
var w = d;
|
|
39
|
+
function h() {
|
|
40
|
+
}
|
|
41
|
+
h.class_ = "Nevis", h.super_ = Object, h.extend = w;
|
|
42
|
+
var z = h, u = z, P = u.extend(function(t, e, i) {
|
|
43
|
+
this.qrious = t, this.element = e, this.element.qrious = t, this.enabled = !!i;
|
|
44
|
+
}, {
|
|
45
|
+
/**
|
|
46
|
+
* Draws the specified QR code <code>frame</code> on the underlying element.
|
|
47
|
+
*
|
|
48
|
+
* Implementations of {@link Renderer} <b>must</b> override this method with their own specific logic.
|
|
49
|
+
*
|
|
50
|
+
* @param {Frame} frame - the {@link Frame} to be drawn
|
|
51
|
+
* @return {void}
|
|
52
|
+
* @protected
|
|
53
|
+
* @abstract
|
|
54
|
+
* @memberof Renderer#
|
|
55
|
+
*/
|
|
56
|
+
draw: function(t) {
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Returns the element onto which this {@link Renderer} is rendering the QR code.
|
|
60
|
+
*
|
|
61
|
+
* If this method is called while this {@link Renderer} is disabled, it will be immediately enabled and rendered
|
|
62
|
+
* before the element is returned.
|
|
63
|
+
*
|
|
64
|
+
* @return {*} The element.
|
|
65
|
+
* @public
|
|
66
|
+
* @memberof Renderer#
|
|
67
|
+
*/
|
|
68
|
+
getElement: function() {
|
|
69
|
+
return this.enabled || (this.enabled = !0, this.render()), this.element;
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Calculates the size (in pixel units) to represent an individual module within the QR code based on the
|
|
73
|
+
* <code>frame</code> provided.
|
|
74
|
+
*
|
|
75
|
+
* Any configured padding will be excluded from the returned size.
|
|
76
|
+
*
|
|
77
|
+
* The returned value will be at least one, even in cases where the size of the QR code does not fit its contents.
|
|
78
|
+
* This is done so that the inevitable clipping is handled more gracefully since this way at least something is
|
|
79
|
+
* displayed instead of just a blank space filled by the background color.
|
|
80
|
+
*
|
|
81
|
+
* @param {Frame} frame - the {@link Frame} from which the module size is to be derived
|
|
82
|
+
* @return {number} The pixel size for each module in the QR code which will be no less than one.
|
|
83
|
+
* @protected
|
|
84
|
+
* @memberof Renderer#
|
|
85
|
+
*/
|
|
86
|
+
getModuleSize: function(t) {
|
|
87
|
+
var e = this.qrious, i = e.padding || 0, r = Math.floor((e.size - i * 2) / t.width);
|
|
88
|
+
return Math.max(1, r);
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* Calculates the offset/padding (in pixel units) to be inserted before the QR code based on the <code>frame</code>
|
|
92
|
+
* provided.
|
|
93
|
+
*
|
|
94
|
+
* The returned value will be zero if there is no available offset or if the size of the QR code does not fit its
|
|
95
|
+
* contents. It will never be a negative value. This is done so that the inevitable clipping appears more naturally
|
|
96
|
+
* and it is not clipped from all directions.
|
|
97
|
+
*
|
|
98
|
+
* @param {Frame} frame - the {@link Frame} from which the offset is to be derived
|
|
99
|
+
* @return {number} The pixel offset for the QR code which will be no less than zero.
|
|
100
|
+
* @protected
|
|
101
|
+
* @memberof Renderer#
|
|
102
|
+
*/
|
|
103
|
+
getOffset: function(t) {
|
|
104
|
+
var e = this.qrious, i = e.padding;
|
|
105
|
+
if (i != null)
|
|
106
|
+
return i;
|
|
107
|
+
var r = this.getModuleSize(t), a = Math.floor((e.size - r * t.width) / 2);
|
|
108
|
+
return Math.max(0, a);
|
|
109
|
+
},
|
|
110
|
+
/**
|
|
111
|
+
* Renders a QR code on the underlying element based on the <code>frame</code> provided.
|
|
112
|
+
*
|
|
113
|
+
* @param {Frame} frame - the {@link Frame} to be rendered
|
|
114
|
+
* @return {void}
|
|
115
|
+
* @public
|
|
116
|
+
* @memberof Renderer#
|
|
117
|
+
*/
|
|
118
|
+
render: function(t) {
|
|
119
|
+
this.enabled && (this.resize(), this.reset(), this.draw(t));
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* Resets the underlying element, effectively clearing any previously rendered QR code.
|
|
123
|
+
*
|
|
124
|
+
* Implementations of {@link Renderer} <b>must</b> override this method with their own specific logic.
|
|
125
|
+
*
|
|
126
|
+
* @return {void}
|
|
127
|
+
* @protected
|
|
128
|
+
* @abstract
|
|
129
|
+
* @memberof Renderer#
|
|
130
|
+
*/
|
|
131
|
+
reset: function() {
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* Ensures that the size of the underlying element matches that defined on the associated {@link QRious} instance.
|
|
135
|
+
*
|
|
136
|
+
* Implementations of {@link Renderer} <b>must</b> override this method with their own specific logic.
|
|
137
|
+
*
|
|
138
|
+
* @return {void}
|
|
139
|
+
* @protected
|
|
140
|
+
* @abstract
|
|
141
|
+
* @memberof Renderer#
|
|
142
|
+
*/
|
|
143
|
+
resize: function() {
|
|
144
|
+
}
|
|
145
|
+
}), C = P, I = C.extend({
|
|
146
|
+
/**
|
|
147
|
+
* @override
|
|
148
|
+
*/
|
|
149
|
+
draw: function(t) {
|
|
150
|
+
var e, i, r = this.qrious, a = this.getModuleSize(t), x = this.getOffset(t), n = this.element.getContext("2d");
|
|
151
|
+
for (n.fillStyle = r.foreground, n.globalAlpha = r.foregroundAlpha, e = 0; e < t.width; e++)
|
|
152
|
+
for (i = 0; i < t.width; i++)
|
|
153
|
+
t.buffer[i * t.width + e] && n.fillRect(a * e + x, a * i + x, a, a);
|
|
154
|
+
},
|
|
155
|
+
/**
|
|
156
|
+
* @override
|
|
157
|
+
*/
|
|
158
|
+
reset: function() {
|
|
159
|
+
var t = this.qrious, e = this.element.getContext("2d"), i = t.size;
|
|
160
|
+
e.lineWidth = 1, e.clearRect(0, 0, i, i), e.fillStyle = t.background, e.globalAlpha = t.backgroundAlpha, e.fillRect(0, 0, i, i);
|
|
161
|
+
},
|
|
162
|
+
/**
|
|
163
|
+
* @override
|
|
164
|
+
*/
|
|
165
|
+
resize: function() {
|
|
166
|
+
var t = this.element;
|
|
167
|
+
t.width = t.height = this.qrious.size;
|
|
168
|
+
}
|
|
169
|
+
}), D = I, V = u.extend(null, {
|
|
170
|
+
/**
|
|
171
|
+
* The alignment pattern block.
|
|
172
|
+
*
|
|
173
|
+
* @public
|
|
174
|
+
* @static
|
|
175
|
+
* @type {number[]}
|
|
176
|
+
* @memberof Alignment
|
|
177
|
+
*/
|
|
178
|
+
BLOCK: [
|
|
179
|
+
0,
|
|
180
|
+
11,
|
|
181
|
+
15,
|
|
182
|
+
19,
|
|
183
|
+
23,
|
|
184
|
+
27,
|
|
185
|
+
31,
|
|
186
|
+
16,
|
|
187
|
+
18,
|
|
188
|
+
20,
|
|
189
|
+
22,
|
|
190
|
+
24,
|
|
191
|
+
26,
|
|
192
|
+
28,
|
|
193
|
+
20,
|
|
194
|
+
22,
|
|
195
|
+
24,
|
|
196
|
+
24,
|
|
197
|
+
26,
|
|
198
|
+
28,
|
|
199
|
+
28,
|
|
200
|
+
22,
|
|
201
|
+
24,
|
|
202
|
+
24,
|
|
203
|
+
26,
|
|
204
|
+
26,
|
|
205
|
+
28,
|
|
206
|
+
28,
|
|
207
|
+
24,
|
|
208
|
+
24,
|
|
209
|
+
26,
|
|
210
|
+
26,
|
|
211
|
+
26,
|
|
212
|
+
28,
|
|
213
|
+
28,
|
|
214
|
+
24,
|
|
215
|
+
26,
|
|
216
|
+
26,
|
|
217
|
+
26,
|
|
218
|
+
28,
|
|
219
|
+
28
|
|
220
|
+
]
|
|
221
|
+
}), F = V, G = u.extend(null, {
|
|
222
|
+
/**
|
|
223
|
+
* The error correction blocks.
|
|
224
|
+
*
|
|
225
|
+
* There are four elements per version. The first two indicate the number of blocks, then the data width, and finally
|
|
226
|
+
* the ECC width.
|
|
227
|
+
*
|
|
228
|
+
* @public
|
|
229
|
+
* @static
|
|
230
|
+
* @type {number[]}
|
|
231
|
+
* @memberof ErrorCorrection
|
|
232
|
+
*/
|
|
233
|
+
BLOCKS: [
|
|
234
|
+
1,
|
|
235
|
+
0,
|
|
236
|
+
19,
|
|
237
|
+
7,
|
|
238
|
+
1,
|
|
239
|
+
0,
|
|
240
|
+
16,
|
|
241
|
+
10,
|
|
242
|
+
1,
|
|
243
|
+
0,
|
|
244
|
+
13,
|
|
245
|
+
13,
|
|
246
|
+
1,
|
|
247
|
+
0,
|
|
248
|
+
9,
|
|
249
|
+
17,
|
|
250
|
+
1,
|
|
251
|
+
0,
|
|
252
|
+
34,
|
|
253
|
+
10,
|
|
254
|
+
1,
|
|
255
|
+
0,
|
|
256
|
+
28,
|
|
257
|
+
16,
|
|
258
|
+
1,
|
|
259
|
+
0,
|
|
260
|
+
22,
|
|
261
|
+
22,
|
|
262
|
+
1,
|
|
263
|
+
0,
|
|
264
|
+
16,
|
|
265
|
+
28,
|
|
266
|
+
1,
|
|
267
|
+
0,
|
|
268
|
+
55,
|
|
269
|
+
15,
|
|
270
|
+
1,
|
|
271
|
+
0,
|
|
272
|
+
44,
|
|
273
|
+
26,
|
|
274
|
+
2,
|
|
275
|
+
0,
|
|
276
|
+
17,
|
|
277
|
+
18,
|
|
278
|
+
2,
|
|
279
|
+
0,
|
|
280
|
+
13,
|
|
281
|
+
22,
|
|
282
|
+
1,
|
|
283
|
+
0,
|
|
284
|
+
80,
|
|
285
|
+
20,
|
|
286
|
+
2,
|
|
287
|
+
0,
|
|
288
|
+
32,
|
|
289
|
+
18,
|
|
290
|
+
2,
|
|
291
|
+
0,
|
|
292
|
+
24,
|
|
293
|
+
26,
|
|
294
|
+
4,
|
|
295
|
+
0,
|
|
296
|
+
9,
|
|
297
|
+
16,
|
|
298
|
+
1,
|
|
299
|
+
0,
|
|
300
|
+
108,
|
|
301
|
+
26,
|
|
302
|
+
2,
|
|
303
|
+
0,
|
|
304
|
+
43,
|
|
305
|
+
24,
|
|
306
|
+
2,
|
|
307
|
+
2,
|
|
308
|
+
15,
|
|
309
|
+
18,
|
|
310
|
+
2,
|
|
311
|
+
2,
|
|
312
|
+
11,
|
|
313
|
+
22,
|
|
314
|
+
2,
|
|
315
|
+
0,
|
|
316
|
+
68,
|
|
317
|
+
18,
|
|
318
|
+
4,
|
|
319
|
+
0,
|
|
320
|
+
27,
|
|
321
|
+
16,
|
|
322
|
+
4,
|
|
323
|
+
0,
|
|
324
|
+
19,
|
|
325
|
+
24,
|
|
326
|
+
4,
|
|
327
|
+
0,
|
|
328
|
+
15,
|
|
329
|
+
28,
|
|
330
|
+
2,
|
|
331
|
+
0,
|
|
332
|
+
78,
|
|
333
|
+
20,
|
|
334
|
+
4,
|
|
335
|
+
0,
|
|
336
|
+
31,
|
|
337
|
+
18,
|
|
338
|
+
2,
|
|
339
|
+
4,
|
|
340
|
+
14,
|
|
341
|
+
18,
|
|
342
|
+
4,
|
|
343
|
+
1,
|
|
344
|
+
13,
|
|
345
|
+
26,
|
|
346
|
+
2,
|
|
347
|
+
0,
|
|
348
|
+
97,
|
|
349
|
+
24,
|
|
350
|
+
2,
|
|
351
|
+
2,
|
|
352
|
+
38,
|
|
353
|
+
22,
|
|
354
|
+
4,
|
|
355
|
+
2,
|
|
356
|
+
18,
|
|
357
|
+
22,
|
|
358
|
+
4,
|
|
359
|
+
2,
|
|
360
|
+
14,
|
|
361
|
+
26,
|
|
362
|
+
2,
|
|
363
|
+
0,
|
|
364
|
+
116,
|
|
365
|
+
30,
|
|
366
|
+
3,
|
|
367
|
+
2,
|
|
368
|
+
36,
|
|
369
|
+
22,
|
|
370
|
+
4,
|
|
371
|
+
4,
|
|
372
|
+
16,
|
|
373
|
+
20,
|
|
374
|
+
4,
|
|
375
|
+
4,
|
|
376
|
+
12,
|
|
377
|
+
24,
|
|
378
|
+
2,
|
|
379
|
+
2,
|
|
380
|
+
68,
|
|
381
|
+
18,
|
|
382
|
+
4,
|
|
383
|
+
1,
|
|
384
|
+
43,
|
|
385
|
+
26,
|
|
386
|
+
6,
|
|
387
|
+
2,
|
|
388
|
+
19,
|
|
389
|
+
24,
|
|
390
|
+
6,
|
|
391
|
+
2,
|
|
392
|
+
15,
|
|
393
|
+
28,
|
|
394
|
+
4,
|
|
395
|
+
0,
|
|
396
|
+
81,
|
|
397
|
+
20,
|
|
398
|
+
1,
|
|
399
|
+
4,
|
|
400
|
+
50,
|
|
401
|
+
30,
|
|
402
|
+
4,
|
|
403
|
+
4,
|
|
404
|
+
22,
|
|
405
|
+
28,
|
|
406
|
+
3,
|
|
407
|
+
8,
|
|
408
|
+
12,
|
|
409
|
+
24,
|
|
410
|
+
2,
|
|
411
|
+
2,
|
|
412
|
+
92,
|
|
413
|
+
24,
|
|
414
|
+
6,
|
|
415
|
+
2,
|
|
416
|
+
36,
|
|
417
|
+
22,
|
|
418
|
+
4,
|
|
419
|
+
6,
|
|
420
|
+
20,
|
|
421
|
+
26,
|
|
422
|
+
7,
|
|
423
|
+
4,
|
|
424
|
+
14,
|
|
425
|
+
28,
|
|
426
|
+
4,
|
|
427
|
+
0,
|
|
428
|
+
107,
|
|
429
|
+
26,
|
|
430
|
+
8,
|
|
431
|
+
1,
|
|
432
|
+
37,
|
|
433
|
+
22,
|
|
434
|
+
8,
|
|
435
|
+
4,
|
|
436
|
+
20,
|
|
437
|
+
24,
|
|
438
|
+
12,
|
|
439
|
+
4,
|
|
440
|
+
11,
|
|
441
|
+
22,
|
|
442
|
+
3,
|
|
443
|
+
1,
|
|
444
|
+
115,
|
|
445
|
+
30,
|
|
446
|
+
4,
|
|
447
|
+
5,
|
|
448
|
+
40,
|
|
449
|
+
24,
|
|
450
|
+
11,
|
|
451
|
+
5,
|
|
452
|
+
16,
|
|
453
|
+
20,
|
|
454
|
+
11,
|
|
455
|
+
5,
|
|
456
|
+
12,
|
|
457
|
+
24,
|
|
458
|
+
5,
|
|
459
|
+
1,
|
|
460
|
+
87,
|
|
461
|
+
22,
|
|
462
|
+
5,
|
|
463
|
+
5,
|
|
464
|
+
41,
|
|
465
|
+
24,
|
|
466
|
+
5,
|
|
467
|
+
7,
|
|
468
|
+
24,
|
|
469
|
+
30,
|
|
470
|
+
11,
|
|
471
|
+
7,
|
|
472
|
+
12,
|
|
473
|
+
24,
|
|
474
|
+
5,
|
|
475
|
+
1,
|
|
476
|
+
98,
|
|
477
|
+
24,
|
|
478
|
+
7,
|
|
479
|
+
3,
|
|
480
|
+
45,
|
|
481
|
+
28,
|
|
482
|
+
15,
|
|
483
|
+
2,
|
|
484
|
+
19,
|
|
485
|
+
24,
|
|
486
|
+
3,
|
|
487
|
+
13,
|
|
488
|
+
15,
|
|
489
|
+
30,
|
|
490
|
+
1,
|
|
491
|
+
5,
|
|
492
|
+
107,
|
|
493
|
+
28,
|
|
494
|
+
10,
|
|
495
|
+
1,
|
|
496
|
+
46,
|
|
497
|
+
28,
|
|
498
|
+
1,
|
|
499
|
+
15,
|
|
500
|
+
22,
|
|
501
|
+
28,
|
|
502
|
+
2,
|
|
503
|
+
17,
|
|
504
|
+
14,
|
|
505
|
+
28,
|
|
506
|
+
5,
|
|
507
|
+
1,
|
|
508
|
+
120,
|
|
509
|
+
30,
|
|
510
|
+
9,
|
|
511
|
+
4,
|
|
512
|
+
43,
|
|
513
|
+
26,
|
|
514
|
+
17,
|
|
515
|
+
1,
|
|
516
|
+
22,
|
|
517
|
+
28,
|
|
518
|
+
2,
|
|
519
|
+
19,
|
|
520
|
+
14,
|
|
521
|
+
28,
|
|
522
|
+
3,
|
|
523
|
+
4,
|
|
524
|
+
113,
|
|
525
|
+
28,
|
|
526
|
+
3,
|
|
527
|
+
11,
|
|
528
|
+
44,
|
|
529
|
+
26,
|
|
530
|
+
17,
|
|
531
|
+
4,
|
|
532
|
+
21,
|
|
533
|
+
26,
|
|
534
|
+
9,
|
|
535
|
+
16,
|
|
536
|
+
13,
|
|
537
|
+
26,
|
|
538
|
+
3,
|
|
539
|
+
5,
|
|
540
|
+
107,
|
|
541
|
+
28,
|
|
542
|
+
3,
|
|
543
|
+
13,
|
|
544
|
+
41,
|
|
545
|
+
26,
|
|
546
|
+
15,
|
|
547
|
+
5,
|
|
548
|
+
24,
|
|
549
|
+
30,
|
|
550
|
+
15,
|
|
551
|
+
10,
|
|
552
|
+
15,
|
|
553
|
+
28,
|
|
554
|
+
4,
|
|
555
|
+
4,
|
|
556
|
+
116,
|
|
557
|
+
28,
|
|
558
|
+
17,
|
|
559
|
+
0,
|
|
560
|
+
42,
|
|
561
|
+
26,
|
|
562
|
+
17,
|
|
563
|
+
6,
|
|
564
|
+
22,
|
|
565
|
+
28,
|
|
566
|
+
19,
|
|
567
|
+
6,
|
|
568
|
+
16,
|
|
569
|
+
30,
|
|
570
|
+
2,
|
|
571
|
+
7,
|
|
572
|
+
111,
|
|
573
|
+
28,
|
|
574
|
+
17,
|
|
575
|
+
0,
|
|
576
|
+
46,
|
|
577
|
+
28,
|
|
578
|
+
7,
|
|
579
|
+
16,
|
|
580
|
+
24,
|
|
581
|
+
30,
|
|
582
|
+
34,
|
|
583
|
+
0,
|
|
584
|
+
13,
|
|
585
|
+
24,
|
|
586
|
+
4,
|
|
587
|
+
5,
|
|
588
|
+
121,
|
|
589
|
+
30,
|
|
590
|
+
4,
|
|
591
|
+
14,
|
|
592
|
+
47,
|
|
593
|
+
28,
|
|
594
|
+
11,
|
|
595
|
+
14,
|
|
596
|
+
24,
|
|
597
|
+
30,
|
|
598
|
+
16,
|
|
599
|
+
14,
|
|
600
|
+
15,
|
|
601
|
+
30,
|
|
602
|
+
6,
|
|
603
|
+
4,
|
|
604
|
+
117,
|
|
605
|
+
30,
|
|
606
|
+
6,
|
|
607
|
+
14,
|
|
608
|
+
45,
|
|
609
|
+
28,
|
|
610
|
+
11,
|
|
611
|
+
16,
|
|
612
|
+
24,
|
|
613
|
+
30,
|
|
614
|
+
30,
|
|
615
|
+
2,
|
|
616
|
+
16,
|
|
617
|
+
30,
|
|
618
|
+
8,
|
|
619
|
+
4,
|
|
620
|
+
106,
|
|
621
|
+
26,
|
|
622
|
+
8,
|
|
623
|
+
13,
|
|
624
|
+
47,
|
|
625
|
+
28,
|
|
626
|
+
7,
|
|
627
|
+
22,
|
|
628
|
+
24,
|
|
629
|
+
30,
|
|
630
|
+
22,
|
|
631
|
+
13,
|
|
632
|
+
15,
|
|
633
|
+
30,
|
|
634
|
+
10,
|
|
635
|
+
2,
|
|
636
|
+
114,
|
|
637
|
+
28,
|
|
638
|
+
19,
|
|
639
|
+
4,
|
|
640
|
+
46,
|
|
641
|
+
28,
|
|
642
|
+
28,
|
|
643
|
+
6,
|
|
644
|
+
22,
|
|
645
|
+
28,
|
|
646
|
+
33,
|
|
647
|
+
4,
|
|
648
|
+
16,
|
|
649
|
+
30,
|
|
650
|
+
8,
|
|
651
|
+
4,
|
|
652
|
+
122,
|
|
653
|
+
30,
|
|
654
|
+
22,
|
|
655
|
+
3,
|
|
656
|
+
45,
|
|
657
|
+
28,
|
|
658
|
+
8,
|
|
659
|
+
26,
|
|
660
|
+
23,
|
|
661
|
+
30,
|
|
662
|
+
12,
|
|
663
|
+
28,
|
|
664
|
+
15,
|
|
665
|
+
30,
|
|
666
|
+
3,
|
|
667
|
+
10,
|
|
668
|
+
117,
|
|
669
|
+
30,
|
|
670
|
+
3,
|
|
671
|
+
23,
|
|
672
|
+
45,
|
|
673
|
+
28,
|
|
674
|
+
4,
|
|
675
|
+
31,
|
|
676
|
+
24,
|
|
677
|
+
30,
|
|
678
|
+
11,
|
|
679
|
+
31,
|
|
680
|
+
15,
|
|
681
|
+
30,
|
|
682
|
+
7,
|
|
683
|
+
7,
|
|
684
|
+
116,
|
|
685
|
+
30,
|
|
686
|
+
21,
|
|
687
|
+
7,
|
|
688
|
+
45,
|
|
689
|
+
28,
|
|
690
|
+
1,
|
|
691
|
+
37,
|
|
692
|
+
23,
|
|
693
|
+
30,
|
|
694
|
+
19,
|
|
695
|
+
26,
|
|
696
|
+
15,
|
|
697
|
+
30,
|
|
698
|
+
5,
|
|
699
|
+
10,
|
|
700
|
+
115,
|
|
701
|
+
30,
|
|
702
|
+
19,
|
|
703
|
+
10,
|
|
704
|
+
47,
|
|
705
|
+
28,
|
|
706
|
+
15,
|
|
707
|
+
25,
|
|
708
|
+
24,
|
|
709
|
+
30,
|
|
710
|
+
23,
|
|
711
|
+
25,
|
|
712
|
+
15,
|
|
713
|
+
30,
|
|
714
|
+
13,
|
|
715
|
+
3,
|
|
716
|
+
115,
|
|
717
|
+
30,
|
|
718
|
+
2,
|
|
719
|
+
29,
|
|
720
|
+
46,
|
|
721
|
+
28,
|
|
722
|
+
42,
|
|
723
|
+
1,
|
|
724
|
+
24,
|
|
725
|
+
30,
|
|
726
|
+
23,
|
|
727
|
+
28,
|
|
728
|
+
15,
|
|
729
|
+
30,
|
|
730
|
+
17,
|
|
731
|
+
0,
|
|
732
|
+
115,
|
|
733
|
+
30,
|
|
734
|
+
10,
|
|
735
|
+
23,
|
|
736
|
+
46,
|
|
737
|
+
28,
|
|
738
|
+
10,
|
|
739
|
+
35,
|
|
740
|
+
24,
|
|
741
|
+
30,
|
|
742
|
+
19,
|
|
743
|
+
35,
|
|
744
|
+
15,
|
|
745
|
+
30,
|
|
746
|
+
17,
|
|
747
|
+
1,
|
|
748
|
+
115,
|
|
749
|
+
30,
|
|
750
|
+
14,
|
|
751
|
+
21,
|
|
752
|
+
46,
|
|
753
|
+
28,
|
|
754
|
+
29,
|
|
755
|
+
19,
|
|
756
|
+
24,
|
|
757
|
+
30,
|
|
758
|
+
11,
|
|
759
|
+
46,
|
|
760
|
+
15,
|
|
761
|
+
30,
|
|
762
|
+
13,
|
|
763
|
+
6,
|
|
764
|
+
115,
|
|
765
|
+
30,
|
|
766
|
+
14,
|
|
767
|
+
23,
|
|
768
|
+
46,
|
|
769
|
+
28,
|
|
770
|
+
44,
|
|
771
|
+
7,
|
|
772
|
+
24,
|
|
773
|
+
30,
|
|
774
|
+
59,
|
|
775
|
+
1,
|
|
776
|
+
16,
|
|
777
|
+
30,
|
|
778
|
+
12,
|
|
779
|
+
7,
|
|
780
|
+
121,
|
|
781
|
+
30,
|
|
782
|
+
12,
|
|
783
|
+
26,
|
|
784
|
+
47,
|
|
785
|
+
28,
|
|
786
|
+
39,
|
|
787
|
+
14,
|
|
788
|
+
24,
|
|
789
|
+
30,
|
|
790
|
+
22,
|
|
791
|
+
41,
|
|
792
|
+
15,
|
|
793
|
+
30,
|
|
794
|
+
6,
|
|
795
|
+
14,
|
|
796
|
+
121,
|
|
797
|
+
30,
|
|
798
|
+
6,
|
|
799
|
+
34,
|
|
800
|
+
47,
|
|
801
|
+
28,
|
|
802
|
+
46,
|
|
803
|
+
10,
|
|
804
|
+
24,
|
|
805
|
+
30,
|
|
806
|
+
2,
|
|
807
|
+
64,
|
|
808
|
+
15,
|
|
809
|
+
30,
|
|
810
|
+
17,
|
|
811
|
+
4,
|
|
812
|
+
122,
|
|
813
|
+
30,
|
|
814
|
+
29,
|
|
815
|
+
14,
|
|
816
|
+
46,
|
|
817
|
+
28,
|
|
818
|
+
49,
|
|
819
|
+
10,
|
|
820
|
+
24,
|
|
821
|
+
30,
|
|
822
|
+
24,
|
|
823
|
+
46,
|
|
824
|
+
15,
|
|
825
|
+
30,
|
|
826
|
+
4,
|
|
827
|
+
18,
|
|
828
|
+
122,
|
|
829
|
+
30,
|
|
830
|
+
13,
|
|
831
|
+
32,
|
|
832
|
+
46,
|
|
833
|
+
28,
|
|
834
|
+
48,
|
|
835
|
+
14,
|
|
836
|
+
24,
|
|
837
|
+
30,
|
|
838
|
+
42,
|
|
839
|
+
32,
|
|
840
|
+
15,
|
|
841
|
+
30,
|
|
842
|
+
20,
|
|
843
|
+
4,
|
|
844
|
+
117,
|
|
845
|
+
30,
|
|
846
|
+
40,
|
|
847
|
+
7,
|
|
848
|
+
47,
|
|
849
|
+
28,
|
|
850
|
+
43,
|
|
851
|
+
22,
|
|
852
|
+
24,
|
|
853
|
+
30,
|
|
854
|
+
10,
|
|
855
|
+
67,
|
|
856
|
+
15,
|
|
857
|
+
30,
|
|
858
|
+
19,
|
|
859
|
+
6,
|
|
860
|
+
118,
|
|
861
|
+
30,
|
|
862
|
+
18,
|
|
863
|
+
31,
|
|
864
|
+
47,
|
|
865
|
+
28,
|
|
866
|
+
34,
|
|
867
|
+
34,
|
|
868
|
+
24,
|
|
869
|
+
30,
|
|
870
|
+
20,
|
|
871
|
+
61,
|
|
872
|
+
15,
|
|
873
|
+
30
|
|
874
|
+
],
|
|
875
|
+
/**
|
|
876
|
+
* The final format bits with mask (level << 3 | mask).
|
|
877
|
+
*
|
|
878
|
+
* @public
|
|
879
|
+
* @static
|
|
880
|
+
* @type {number[]}
|
|
881
|
+
* @memberof ErrorCorrection
|
|
882
|
+
*/
|
|
883
|
+
FINAL_FORMAT: [
|
|
884
|
+
// L
|
|
885
|
+
30660,
|
|
886
|
+
29427,
|
|
887
|
+
32170,
|
|
888
|
+
30877,
|
|
889
|
+
26159,
|
|
890
|
+
25368,
|
|
891
|
+
27713,
|
|
892
|
+
26998,
|
|
893
|
+
// M
|
|
894
|
+
21522,
|
|
895
|
+
20773,
|
|
896
|
+
24188,
|
|
897
|
+
23371,
|
|
898
|
+
17913,
|
|
899
|
+
16590,
|
|
900
|
+
20375,
|
|
901
|
+
19104,
|
|
902
|
+
// Q
|
|
903
|
+
13663,
|
|
904
|
+
12392,
|
|
905
|
+
16177,
|
|
906
|
+
14854,
|
|
907
|
+
9396,
|
|
908
|
+
8579,
|
|
909
|
+
11994,
|
|
910
|
+
11245,
|
|
911
|
+
// H
|
|
912
|
+
5769,
|
|
913
|
+
5054,
|
|
914
|
+
7399,
|
|
915
|
+
6608,
|
|
916
|
+
1890,
|
|
917
|
+
597,
|
|
918
|
+
3340,
|
|
919
|
+
2107
|
|
920
|
+
],
|
|
921
|
+
/**
|
|
922
|
+
* A map of human-readable ECC levels.
|
|
923
|
+
*
|
|
924
|
+
* @public
|
|
925
|
+
* @static
|
|
926
|
+
* @type {Object.<string, number>}
|
|
927
|
+
* @memberof ErrorCorrection
|
|
928
|
+
*/
|
|
929
|
+
LEVELS: {
|
|
930
|
+
L: 1,
|
|
931
|
+
M: 2,
|
|
932
|
+
Q: 3,
|
|
933
|
+
H: 4
|
|
934
|
+
}
|
|
935
|
+
}), M = G, K = u.extend(null, {
|
|
936
|
+
/**
|
|
937
|
+
* The Galois field exponent table.
|
|
938
|
+
*
|
|
939
|
+
* @public
|
|
940
|
+
* @static
|
|
941
|
+
* @type {number[]}
|
|
942
|
+
* @memberof Galois
|
|
943
|
+
*/
|
|
944
|
+
EXPONENT: [
|
|
945
|
+
1,
|
|
946
|
+
2,
|
|
947
|
+
4,
|
|
948
|
+
8,
|
|
949
|
+
16,
|
|
950
|
+
32,
|
|
951
|
+
64,
|
|
952
|
+
128,
|
|
953
|
+
29,
|
|
954
|
+
58,
|
|
955
|
+
116,
|
|
956
|
+
232,
|
|
957
|
+
205,
|
|
958
|
+
135,
|
|
959
|
+
19,
|
|
960
|
+
38,
|
|
961
|
+
76,
|
|
962
|
+
152,
|
|
963
|
+
45,
|
|
964
|
+
90,
|
|
965
|
+
180,
|
|
966
|
+
117,
|
|
967
|
+
234,
|
|
968
|
+
201,
|
|
969
|
+
143,
|
|
970
|
+
3,
|
|
971
|
+
6,
|
|
972
|
+
12,
|
|
973
|
+
24,
|
|
974
|
+
48,
|
|
975
|
+
96,
|
|
976
|
+
192,
|
|
977
|
+
157,
|
|
978
|
+
39,
|
|
979
|
+
78,
|
|
980
|
+
156,
|
|
981
|
+
37,
|
|
982
|
+
74,
|
|
983
|
+
148,
|
|
984
|
+
53,
|
|
985
|
+
106,
|
|
986
|
+
212,
|
|
987
|
+
181,
|
|
988
|
+
119,
|
|
989
|
+
238,
|
|
990
|
+
193,
|
|
991
|
+
159,
|
|
992
|
+
35,
|
|
993
|
+
70,
|
|
994
|
+
140,
|
|
995
|
+
5,
|
|
996
|
+
10,
|
|
997
|
+
20,
|
|
998
|
+
40,
|
|
999
|
+
80,
|
|
1000
|
+
160,
|
|
1001
|
+
93,
|
|
1002
|
+
186,
|
|
1003
|
+
105,
|
|
1004
|
+
210,
|
|
1005
|
+
185,
|
|
1006
|
+
111,
|
|
1007
|
+
222,
|
|
1008
|
+
161,
|
|
1009
|
+
95,
|
|
1010
|
+
190,
|
|
1011
|
+
97,
|
|
1012
|
+
194,
|
|
1013
|
+
153,
|
|
1014
|
+
47,
|
|
1015
|
+
94,
|
|
1016
|
+
188,
|
|
1017
|
+
101,
|
|
1018
|
+
202,
|
|
1019
|
+
137,
|
|
1020
|
+
15,
|
|
1021
|
+
30,
|
|
1022
|
+
60,
|
|
1023
|
+
120,
|
|
1024
|
+
240,
|
|
1025
|
+
253,
|
|
1026
|
+
231,
|
|
1027
|
+
211,
|
|
1028
|
+
187,
|
|
1029
|
+
107,
|
|
1030
|
+
214,
|
|
1031
|
+
177,
|
|
1032
|
+
127,
|
|
1033
|
+
254,
|
|
1034
|
+
225,
|
|
1035
|
+
223,
|
|
1036
|
+
163,
|
|
1037
|
+
91,
|
|
1038
|
+
182,
|
|
1039
|
+
113,
|
|
1040
|
+
226,
|
|
1041
|
+
217,
|
|
1042
|
+
175,
|
|
1043
|
+
67,
|
|
1044
|
+
134,
|
|
1045
|
+
17,
|
|
1046
|
+
34,
|
|
1047
|
+
68,
|
|
1048
|
+
136,
|
|
1049
|
+
13,
|
|
1050
|
+
26,
|
|
1051
|
+
52,
|
|
1052
|
+
104,
|
|
1053
|
+
208,
|
|
1054
|
+
189,
|
|
1055
|
+
103,
|
|
1056
|
+
206,
|
|
1057
|
+
129,
|
|
1058
|
+
31,
|
|
1059
|
+
62,
|
|
1060
|
+
124,
|
|
1061
|
+
248,
|
|
1062
|
+
237,
|
|
1063
|
+
199,
|
|
1064
|
+
147,
|
|
1065
|
+
59,
|
|
1066
|
+
118,
|
|
1067
|
+
236,
|
|
1068
|
+
197,
|
|
1069
|
+
151,
|
|
1070
|
+
51,
|
|
1071
|
+
102,
|
|
1072
|
+
204,
|
|
1073
|
+
133,
|
|
1074
|
+
23,
|
|
1075
|
+
46,
|
|
1076
|
+
92,
|
|
1077
|
+
184,
|
|
1078
|
+
109,
|
|
1079
|
+
218,
|
|
1080
|
+
169,
|
|
1081
|
+
79,
|
|
1082
|
+
158,
|
|
1083
|
+
33,
|
|
1084
|
+
66,
|
|
1085
|
+
132,
|
|
1086
|
+
21,
|
|
1087
|
+
42,
|
|
1088
|
+
84,
|
|
1089
|
+
168,
|
|
1090
|
+
77,
|
|
1091
|
+
154,
|
|
1092
|
+
41,
|
|
1093
|
+
82,
|
|
1094
|
+
164,
|
|
1095
|
+
85,
|
|
1096
|
+
170,
|
|
1097
|
+
73,
|
|
1098
|
+
146,
|
|
1099
|
+
57,
|
|
1100
|
+
114,
|
|
1101
|
+
228,
|
|
1102
|
+
213,
|
|
1103
|
+
183,
|
|
1104
|
+
115,
|
|
1105
|
+
230,
|
|
1106
|
+
209,
|
|
1107
|
+
191,
|
|
1108
|
+
99,
|
|
1109
|
+
198,
|
|
1110
|
+
145,
|
|
1111
|
+
63,
|
|
1112
|
+
126,
|
|
1113
|
+
252,
|
|
1114
|
+
229,
|
|
1115
|
+
215,
|
|
1116
|
+
179,
|
|
1117
|
+
123,
|
|
1118
|
+
246,
|
|
1119
|
+
241,
|
|
1120
|
+
255,
|
|
1121
|
+
227,
|
|
1122
|
+
219,
|
|
1123
|
+
171,
|
|
1124
|
+
75,
|
|
1125
|
+
150,
|
|
1126
|
+
49,
|
|
1127
|
+
98,
|
|
1128
|
+
196,
|
|
1129
|
+
149,
|
|
1130
|
+
55,
|
|
1131
|
+
110,
|
|
1132
|
+
220,
|
|
1133
|
+
165,
|
|
1134
|
+
87,
|
|
1135
|
+
174,
|
|
1136
|
+
65,
|
|
1137
|
+
130,
|
|
1138
|
+
25,
|
|
1139
|
+
50,
|
|
1140
|
+
100,
|
|
1141
|
+
200,
|
|
1142
|
+
141,
|
|
1143
|
+
7,
|
|
1144
|
+
14,
|
|
1145
|
+
28,
|
|
1146
|
+
56,
|
|
1147
|
+
112,
|
|
1148
|
+
224,
|
|
1149
|
+
221,
|
|
1150
|
+
167,
|
|
1151
|
+
83,
|
|
1152
|
+
166,
|
|
1153
|
+
81,
|
|
1154
|
+
162,
|
|
1155
|
+
89,
|
|
1156
|
+
178,
|
|
1157
|
+
121,
|
|
1158
|
+
242,
|
|
1159
|
+
249,
|
|
1160
|
+
239,
|
|
1161
|
+
195,
|
|
1162
|
+
155,
|
|
1163
|
+
43,
|
|
1164
|
+
86,
|
|
1165
|
+
172,
|
|
1166
|
+
69,
|
|
1167
|
+
138,
|
|
1168
|
+
9,
|
|
1169
|
+
18,
|
|
1170
|
+
36,
|
|
1171
|
+
72,
|
|
1172
|
+
144,
|
|
1173
|
+
61,
|
|
1174
|
+
122,
|
|
1175
|
+
244,
|
|
1176
|
+
245,
|
|
1177
|
+
247,
|
|
1178
|
+
243,
|
|
1179
|
+
251,
|
|
1180
|
+
235,
|
|
1181
|
+
203,
|
|
1182
|
+
139,
|
|
1183
|
+
11,
|
|
1184
|
+
22,
|
|
1185
|
+
44,
|
|
1186
|
+
88,
|
|
1187
|
+
176,
|
|
1188
|
+
125,
|
|
1189
|
+
250,
|
|
1190
|
+
233,
|
|
1191
|
+
207,
|
|
1192
|
+
131,
|
|
1193
|
+
27,
|
|
1194
|
+
54,
|
|
1195
|
+
108,
|
|
1196
|
+
216,
|
|
1197
|
+
173,
|
|
1198
|
+
71,
|
|
1199
|
+
142,
|
|
1200
|
+
0
|
|
1201
|
+
],
|
|
1202
|
+
/**
|
|
1203
|
+
* The Galois field log table.
|
|
1204
|
+
*
|
|
1205
|
+
* @public
|
|
1206
|
+
* @static
|
|
1207
|
+
* @type {number[]}
|
|
1208
|
+
* @memberof Galois
|
|
1209
|
+
*/
|
|
1210
|
+
LOG: [
|
|
1211
|
+
255,
|
|
1212
|
+
0,
|
|
1213
|
+
1,
|
|
1214
|
+
25,
|
|
1215
|
+
2,
|
|
1216
|
+
50,
|
|
1217
|
+
26,
|
|
1218
|
+
198,
|
|
1219
|
+
3,
|
|
1220
|
+
223,
|
|
1221
|
+
51,
|
|
1222
|
+
238,
|
|
1223
|
+
27,
|
|
1224
|
+
104,
|
|
1225
|
+
199,
|
|
1226
|
+
75,
|
|
1227
|
+
4,
|
|
1228
|
+
100,
|
|
1229
|
+
224,
|
|
1230
|
+
14,
|
|
1231
|
+
52,
|
|
1232
|
+
141,
|
|
1233
|
+
239,
|
|
1234
|
+
129,
|
|
1235
|
+
28,
|
|
1236
|
+
193,
|
|
1237
|
+
105,
|
|
1238
|
+
248,
|
|
1239
|
+
200,
|
|
1240
|
+
8,
|
|
1241
|
+
76,
|
|
1242
|
+
113,
|
|
1243
|
+
5,
|
|
1244
|
+
138,
|
|
1245
|
+
101,
|
|
1246
|
+
47,
|
|
1247
|
+
225,
|
|
1248
|
+
36,
|
|
1249
|
+
15,
|
|
1250
|
+
33,
|
|
1251
|
+
53,
|
|
1252
|
+
147,
|
|
1253
|
+
142,
|
|
1254
|
+
218,
|
|
1255
|
+
240,
|
|
1256
|
+
18,
|
|
1257
|
+
130,
|
|
1258
|
+
69,
|
|
1259
|
+
29,
|
|
1260
|
+
181,
|
|
1261
|
+
194,
|
|
1262
|
+
125,
|
|
1263
|
+
106,
|
|
1264
|
+
39,
|
|
1265
|
+
249,
|
|
1266
|
+
185,
|
|
1267
|
+
201,
|
|
1268
|
+
154,
|
|
1269
|
+
9,
|
|
1270
|
+
120,
|
|
1271
|
+
77,
|
|
1272
|
+
228,
|
|
1273
|
+
114,
|
|
1274
|
+
166,
|
|
1275
|
+
6,
|
|
1276
|
+
191,
|
|
1277
|
+
139,
|
|
1278
|
+
98,
|
|
1279
|
+
102,
|
|
1280
|
+
221,
|
|
1281
|
+
48,
|
|
1282
|
+
253,
|
|
1283
|
+
226,
|
|
1284
|
+
152,
|
|
1285
|
+
37,
|
|
1286
|
+
179,
|
|
1287
|
+
16,
|
|
1288
|
+
145,
|
|
1289
|
+
34,
|
|
1290
|
+
136,
|
|
1291
|
+
54,
|
|
1292
|
+
208,
|
|
1293
|
+
148,
|
|
1294
|
+
206,
|
|
1295
|
+
143,
|
|
1296
|
+
150,
|
|
1297
|
+
219,
|
|
1298
|
+
189,
|
|
1299
|
+
241,
|
|
1300
|
+
210,
|
|
1301
|
+
19,
|
|
1302
|
+
92,
|
|
1303
|
+
131,
|
|
1304
|
+
56,
|
|
1305
|
+
70,
|
|
1306
|
+
64,
|
|
1307
|
+
30,
|
|
1308
|
+
66,
|
|
1309
|
+
182,
|
|
1310
|
+
163,
|
|
1311
|
+
195,
|
|
1312
|
+
72,
|
|
1313
|
+
126,
|
|
1314
|
+
110,
|
|
1315
|
+
107,
|
|
1316
|
+
58,
|
|
1317
|
+
40,
|
|
1318
|
+
84,
|
|
1319
|
+
250,
|
|
1320
|
+
133,
|
|
1321
|
+
186,
|
|
1322
|
+
61,
|
|
1323
|
+
202,
|
|
1324
|
+
94,
|
|
1325
|
+
155,
|
|
1326
|
+
159,
|
|
1327
|
+
10,
|
|
1328
|
+
21,
|
|
1329
|
+
121,
|
|
1330
|
+
43,
|
|
1331
|
+
78,
|
|
1332
|
+
212,
|
|
1333
|
+
229,
|
|
1334
|
+
172,
|
|
1335
|
+
115,
|
|
1336
|
+
243,
|
|
1337
|
+
167,
|
|
1338
|
+
87,
|
|
1339
|
+
7,
|
|
1340
|
+
112,
|
|
1341
|
+
192,
|
|
1342
|
+
247,
|
|
1343
|
+
140,
|
|
1344
|
+
128,
|
|
1345
|
+
99,
|
|
1346
|
+
13,
|
|
1347
|
+
103,
|
|
1348
|
+
74,
|
|
1349
|
+
222,
|
|
1350
|
+
237,
|
|
1351
|
+
49,
|
|
1352
|
+
197,
|
|
1353
|
+
254,
|
|
1354
|
+
24,
|
|
1355
|
+
227,
|
|
1356
|
+
165,
|
|
1357
|
+
153,
|
|
1358
|
+
119,
|
|
1359
|
+
38,
|
|
1360
|
+
184,
|
|
1361
|
+
180,
|
|
1362
|
+
124,
|
|
1363
|
+
17,
|
|
1364
|
+
68,
|
|
1365
|
+
146,
|
|
1366
|
+
217,
|
|
1367
|
+
35,
|
|
1368
|
+
32,
|
|
1369
|
+
137,
|
|
1370
|
+
46,
|
|
1371
|
+
55,
|
|
1372
|
+
63,
|
|
1373
|
+
209,
|
|
1374
|
+
91,
|
|
1375
|
+
149,
|
|
1376
|
+
188,
|
|
1377
|
+
207,
|
|
1378
|
+
205,
|
|
1379
|
+
144,
|
|
1380
|
+
135,
|
|
1381
|
+
151,
|
|
1382
|
+
178,
|
|
1383
|
+
220,
|
|
1384
|
+
252,
|
|
1385
|
+
190,
|
|
1386
|
+
97,
|
|
1387
|
+
242,
|
|
1388
|
+
86,
|
|
1389
|
+
211,
|
|
1390
|
+
171,
|
|
1391
|
+
20,
|
|
1392
|
+
42,
|
|
1393
|
+
93,
|
|
1394
|
+
158,
|
|
1395
|
+
132,
|
|
1396
|
+
60,
|
|
1397
|
+
57,
|
|
1398
|
+
83,
|
|
1399
|
+
71,
|
|
1400
|
+
109,
|
|
1401
|
+
65,
|
|
1402
|
+
162,
|
|
1403
|
+
31,
|
|
1404
|
+
45,
|
|
1405
|
+
67,
|
|
1406
|
+
216,
|
|
1407
|
+
183,
|
|
1408
|
+
123,
|
|
1409
|
+
164,
|
|
1410
|
+
118,
|
|
1411
|
+
196,
|
|
1412
|
+
23,
|
|
1413
|
+
73,
|
|
1414
|
+
236,
|
|
1415
|
+
127,
|
|
1416
|
+
12,
|
|
1417
|
+
111,
|
|
1418
|
+
246,
|
|
1419
|
+
108,
|
|
1420
|
+
161,
|
|
1421
|
+
59,
|
|
1422
|
+
82,
|
|
1423
|
+
41,
|
|
1424
|
+
157,
|
|
1425
|
+
85,
|
|
1426
|
+
170,
|
|
1427
|
+
251,
|
|
1428
|
+
96,
|
|
1429
|
+
134,
|
|
1430
|
+
177,
|
|
1431
|
+
187,
|
|
1432
|
+
204,
|
|
1433
|
+
62,
|
|
1434
|
+
90,
|
|
1435
|
+
203,
|
|
1436
|
+
89,
|
|
1437
|
+
95,
|
|
1438
|
+
176,
|
|
1439
|
+
156,
|
|
1440
|
+
169,
|
|
1441
|
+
160,
|
|
1442
|
+
81,
|
|
1443
|
+
11,
|
|
1444
|
+
245,
|
|
1445
|
+
22,
|
|
1446
|
+
235,
|
|
1447
|
+
122,
|
|
1448
|
+
117,
|
|
1449
|
+
44,
|
|
1450
|
+
215,
|
|
1451
|
+
79,
|
|
1452
|
+
174,
|
|
1453
|
+
213,
|
|
1454
|
+
233,
|
|
1455
|
+
230,
|
|
1456
|
+
231,
|
|
1457
|
+
173,
|
|
1458
|
+
232,
|
|
1459
|
+
116,
|
|
1460
|
+
214,
|
|
1461
|
+
244,
|
|
1462
|
+
234,
|
|
1463
|
+
168,
|
|
1464
|
+
80,
|
|
1465
|
+
88,
|
|
1466
|
+
175
|
|
1467
|
+
]
|
|
1468
|
+
}), p = K, U = u.extend(null, {
|
|
1469
|
+
/**
|
|
1470
|
+
* The version pattern block.
|
|
1471
|
+
*
|
|
1472
|
+
* @public
|
|
1473
|
+
* @static
|
|
1474
|
+
* @type {number[]}
|
|
1475
|
+
* @memberof Version
|
|
1476
|
+
*/
|
|
1477
|
+
BLOCK: [
|
|
1478
|
+
3220,
|
|
1479
|
+
1468,
|
|
1480
|
+
2713,
|
|
1481
|
+
1235,
|
|
1482
|
+
3062,
|
|
1483
|
+
1890,
|
|
1484
|
+
2119,
|
|
1485
|
+
1549,
|
|
1486
|
+
2344,
|
|
1487
|
+
2936,
|
|
1488
|
+
1117,
|
|
1489
|
+
2583,
|
|
1490
|
+
1330,
|
|
1491
|
+
2470,
|
|
1492
|
+
1667,
|
|
1493
|
+
2249,
|
|
1494
|
+
2028,
|
|
1495
|
+
3780,
|
|
1496
|
+
481,
|
|
1497
|
+
4011,
|
|
1498
|
+
142,
|
|
1499
|
+
3098,
|
|
1500
|
+
831,
|
|
1501
|
+
3445,
|
|
1502
|
+
592,
|
|
1503
|
+
2517,
|
|
1504
|
+
1776,
|
|
1505
|
+
2234,
|
|
1506
|
+
1951,
|
|
1507
|
+
2827,
|
|
1508
|
+
1070,
|
|
1509
|
+
2660,
|
|
1510
|
+
1345,
|
|
1511
|
+
3177
|
|
1512
|
+
]
|
|
1513
|
+
}), Q = U, c = u.extend(function(t) {
|
|
1514
|
+
var e, i, r, a, x, n = t.value.length;
|
|
1515
|
+
for (this._badness = [], this._level = M.LEVELS[t.level], this._polynomial = [], this._value = t.value, this._version = 0, this._stringBuffer = []; this._version < 40 && (this._version++, r = (this._level - 1) * 4 + (this._version - 1) * 16, a = M.BLOCKS[r++], x = M.BLOCKS[r++], e = M.BLOCKS[r++], i = M.BLOCKS[r], r = e * (a + x) + x - 3 + (this._version <= 9), !(n <= r)); )
|
|
1516
|
+
;
|
|
1517
|
+
this._dataBlock = e, this._eccBlock = i, this._neccBlock1 = a, this._neccBlock2 = x;
|
|
1518
|
+
var s = this.width = 17 + 4 * this._version;
|
|
1519
|
+
this.buffer = c._createArray(s * s), this._ecc = c._createArray(e + (e + i) * (a + x) + x), this._mask = c._createArray((s * (s + 1) + 1) / 2), this._insertFinders(), this._insertAlignments(), this.buffer[8 + s * (s - 8)] = 1, this._insertTimingGap(), this._reverseMask(), this._insertTimingRowAndColumn(), this._insertVersion(), this._syncMask(), this._convertBitStream(n), this._calculatePolynomial(), this._appendEccToData(), this._interleaveBlocks(), this._pack(), this._finish();
|
|
1520
|
+
}, {
|
|
1521
|
+
_addAlignment: function(t, e) {
|
|
1522
|
+
var i, r = this.buffer, a = this.width;
|
|
1523
|
+
for (r[t + a * e] = 1, i = -2; i < 2; i++)
|
|
1524
|
+
r[t + i + a * (e - 2)] = 1, r[t - 2 + a * (e + i + 1)] = 1, r[t + 2 + a * (e + i)] = 1, r[t + i + 1 + a * (e + 2)] = 1;
|
|
1525
|
+
for (i = 0; i < 2; i++)
|
|
1526
|
+
this._setMask(t - 1, e + i), this._setMask(t + 1, e - i), this._setMask(t - i, e - 1), this._setMask(t + i, e + 1);
|
|
1527
|
+
},
|
|
1528
|
+
_appendData: function(t, e, i, r) {
|
|
1529
|
+
var a, x, n, s = this._polynomial, f = this._stringBuffer;
|
|
1530
|
+
for (x = 0; x < r; x++)
|
|
1531
|
+
f[i + x] = 0;
|
|
1532
|
+
for (x = 0; x < e; x++) {
|
|
1533
|
+
if (a = p.LOG[f[t + x] ^ f[i]], a !== 255)
|
|
1534
|
+
for (n = 1; n < r; n++)
|
|
1535
|
+
f[i + n - 1] = f[i + n] ^ p.EXPONENT[c._modN(a + s[r - n])];
|
|
1536
|
+
else
|
|
1537
|
+
for (n = i; n < i + r; n++)
|
|
1538
|
+
f[n] = f[n + 1];
|
|
1539
|
+
f[i + r - 1] = a === 255 ? 0 : p.EXPONENT[c._modN(a + s[0])];
|
|
1540
|
+
}
|
|
1541
|
+
},
|
|
1542
|
+
_appendEccToData: function() {
|
|
1543
|
+
var t, e = 0, i = this._dataBlock, r = this._calculateMaxLength(), a = this._eccBlock;
|
|
1544
|
+
for (t = 0; t < this._neccBlock1; t++)
|
|
1545
|
+
this._appendData(e, i, r, a), e += i, r += a;
|
|
1546
|
+
for (t = 0; t < this._neccBlock2; t++)
|
|
1547
|
+
this._appendData(e, i + 1, r, a), e += i + 1, r += a;
|
|
1548
|
+
},
|
|
1549
|
+
_applyMask: function(t) {
|
|
1550
|
+
var e, i, r, a, x = this.buffer, n = this.width;
|
|
1551
|
+
switch (t) {
|
|
1552
|
+
case 0:
|
|
1553
|
+
for (a = 0; a < n; a++)
|
|
1554
|
+
for (r = 0; r < n; r++)
|
|
1555
|
+
!(r + a & 1) && !this._isMasked(r, a) && (x[r + a * n] ^= 1);
|
|
1556
|
+
break;
|
|
1557
|
+
case 1:
|
|
1558
|
+
for (a = 0; a < n; a++)
|
|
1559
|
+
for (r = 0; r < n; r++)
|
|
1560
|
+
!(a & 1) && !this._isMasked(r, a) && (x[r + a * n] ^= 1);
|
|
1561
|
+
break;
|
|
1562
|
+
case 2:
|
|
1563
|
+
for (a = 0; a < n; a++)
|
|
1564
|
+
for (e = 0, r = 0; r < n; r++, e++)
|
|
1565
|
+
e === 3 && (e = 0), !e && !this._isMasked(r, a) && (x[r + a * n] ^= 1);
|
|
1566
|
+
break;
|
|
1567
|
+
case 3:
|
|
1568
|
+
for (i = 0, a = 0; a < n; a++, i++)
|
|
1569
|
+
for (i === 3 && (i = 0), e = i, r = 0; r < n; r++, e++)
|
|
1570
|
+
e === 3 && (e = 0), !e && !this._isMasked(r, a) && (x[r + a * n] ^= 1);
|
|
1571
|
+
break;
|
|
1572
|
+
case 4:
|
|
1573
|
+
for (a = 0; a < n; a++)
|
|
1574
|
+
for (e = 0, i = a >> 1 & 1, r = 0; r < n; r++, e++)
|
|
1575
|
+
e === 3 && (e = 0, i = !i), !i && !this._isMasked(r, a) && (x[r + a * n] ^= 1);
|
|
1576
|
+
break;
|
|
1577
|
+
case 5:
|
|
1578
|
+
for (i = 0, a = 0; a < n; a++, i++)
|
|
1579
|
+
for (i === 3 && (i = 0), e = 0, r = 0; r < n; r++, e++)
|
|
1580
|
+
e === 3 && (e = 0), !((r & a & 1) + !(!e | !i)) && !this._isMasked(r, a) && (x[r + a * n] ^= 1);
|
|
1581
|
+
break;
|
|
1582
|
+
case 6:
|
|
1583
|
+
for (i = 0, a = 0; a < n; a++, i++)
|
|
1584
|
+
for (i === 3 && (i = 0), e = 0, r = 0; r < n; r++, e++)
|
|
1585
|
+
e === 3 && (e = 0), !((r & a & 1) + (e && e === i) & 1) && !this._isMasked(r, a) && (x[r + a * n] ^= 1);
|
|
1586
|
+
break;
|
|
1587
|
+
case 7:
|
|
1588
|
+
for (i = 0, a = 0; a < n; a++, i++)
|
|
1589
|
+
for (i === 3 && (i = 0), e = 0, r = 0; r < n; r++, e++)
|
|
1590
|
+
e === 3 && (e = 0), !((e && e === i) + (r + a & 1) & 1) && !this._isMasked(r, a) && (x[r + a * n] ^= 1);
|
|
1591
|
+
break;
|
|
1592
|
+
}
|
|
1593
|
+
},
|
|
1594
|
+
_calculateMaxLength: function() {
|
|
1595
|
+
return this._dataBlock * (this._neccBlock1 + this._neccBlock2) + this._neccBlock2;
|
|
1596
|
+
},
|
|
1597
|
+
_calculatePolynomial: function() {
|
|
1598
|
+
var t, e, i = this._eccBlock, r = this._polynomial;
|
|
1599
|
+
for (r[0] = 1, t = 0; t < i; t++) {
|
|
1600
|
+
for (r[t + 1] = 1, e = t; e > 0; e--)
|
|
1601
|
+
r[e] = r[e] ? r[e - 1] ^ p.EXPONENT[c._modN(p.LOG[r[e]] + t)] : r[e - 1];
|
|
1602
|
+
r[0] = p.EXPONENT[c._modN(p.LOG[r[0]] + t)];
|
|
1603
|
+
}
|
|
1604
|
+
for (t = 0; t <= i; t++)
|
|
1605
|
+
r[t] = p.LOG[r[t]];
|
|
1606
|
+
},
|
|
1607
|
+
_checkBadness: function() {
|
|
1608
|
+
var t, e, i, r, a, x = 0, n = this._badness, s = this.buffer, f = this.width;
|
|
1609
|
+
for (a = 0; a < f - 1; a++)
|
|
1610
|
+
for (r = 0; r < f - 1; r++)
|
|
1611
|
+
(s[r + f * a] && s[r + 1 + f * a] && s[r + f * (a + 1)] && s[r + 1 + f * (a + 1)] || // All background colour.
|
|
1612
|
+
!(s[r + f * a] || s[r + 1 + f * a] || s[r + f * (a + 1)] || s[r + 1 + f * (a + 1)])) && (x += c.N2);
|
|
1613
|
+
var _ = 0;
|
|
1614
|
+
for (a = 0; a < f; a++) {
|
|
1615
|
+
for (i = 0, n[0] = 0, t = 0, r = 0; r < f; r++)
|
|
1616
|
+
e = s[r + f * a], t === e ? n[i]++ : n[++i] = 1, t = e, _ += t ? 1 : -1;
|
|
1617
|
+
x += this._getBadness(i);
|
|
1618
|
+
}
|
|
1619
|
+
_ < 0 && (_ = -_);
|
|
1620
|
+
var R = 0, y = _;
|
|
1621
|
+
for (y += y << 2, y <<= 1; y > f * f; )
|
|
1622
|
+
y -= f * f, R++;
|
|
1623
|
+
for (x += R * c.N4, r = 0; r < f; r++) {
|
|
1624
|
+
for (i = 0, n[0] = 0, t = 0, a = 0; a < f; a++)
|
|
1625
|
+
e = s[r + f * a], t === e ? n[i]++ : n[++i] = 1, t = e;
|
|
1626
|
+
x += this._getBadness(i);
|
|
1627
|
+
}
|
|
1628
|
+
return x;
|
|
1629
|
+
},
|
|
1630
|
+
_convertBitStream: function(t) {
|
|
1631
|
+
var e, i, r = this._ecc, a = this._version;
|
|
1632
|
+
for (i = 0; i < t; i++)
|
|
1633
|
+
r[i] = this._value.charCodeAt(i);
|
|
1634
|
+
var x = this._stringBuffer = r.slice(), n = this._calculateMaxLength();
|
|
1635
|
+
t >= n - 2 && (t = n - 2, a > 9 && t--);
|
|
1636
|
+
var s = t;
|
|
1637
|
+
if (a > 9) {
|
|
1638
|
+
for (x[s + 2] = 0, x[s + 3] = 0; s--; )
|
|
1639
|
+
e = x[s], x[s + 3] |= 255 & e << 4, x[s + 2] = e >> 4;
|
|
1640
|
+
x[2] |= 255 & t << 4, x[1] = t >> 4, x[0] = 64 | t >> 12;
|
|
1641
|
+
} else {
|
|
1642
|
+
for (x[s + 1] = 0, x[s + 2] = 0; s--; )
|
|
1643
|
+
e = x[s], x[s + 2] |= 255 & e << 4, x[s + 1] = e >> 4;
|
|
1644
|
+
x[1] |= 255 & t << 4, x[0] = 64 | t >> 4;
|
|
1645
|
+
}
|
|
1646
|
+
for (s = t + 3 - (a < 10); s < n; )
|
|
1647
|
+
x[s++] = 236, x[s++] = 17;
|
|
1648
|
+
},
|
|
1649
|
+
_getBadness: function(t) {
|
|
1650
|
+
var e, i = 0, r = this._badness;
|
|
1651
|
+
for (e = 0; e <= t; e++)
|
|
1652
|
+
r[e] >= 5 && (i += c.N1 + r[e] - 5);
|
|
1653
|
+
for (e = 3; e < t - 1; e += 2)
|
|
1654
|
+
r[e - 2] === r[e + 2] && r[e + 2] === r[e - 1] && r[e - 1] === r[e + 1] && r[e - 1] * 3 === r[e] && // Background around the foreground pattern? Not part of the specs.
|
|
1655
|
+
(r[e - 3] === 0 || e + 3 > t || r[e - 3] * 3 >= r[e] * 4 || r[e + 3] * 3 >= r[e] * 4) && (i += c.N3);
|
|
1656
|
+
return i;
|
|
1657
|
+
},
|
|
1658
|
+
_finish: function() {
|
|
1659
|
+
this._stringBuffer = this.buffer.slice();
|
|
1660
|
+
var t, e, i = 0, r = 3e4;
|
|
1661
|
+
for (e = 0; e < 8 && (this._applyMask(e), t = this._checkBadness(), t < r && (r = t, i = e), i !== 7); e++)
|
|
1662
|
+
this.buffer = this._stringBuffer.slice();
|
|
1663
|
+
i !== e && this._applyMask(i), r = M.FINAL_FORMAT[i + (this._level - 1 << 3)];
|
|
1664
|
+
var a = this.buffer, x = this.width;
|
|
1665
|
+
for (e = 0; e < 8; e++, r >>= 1)
|
|
1666
|
+
r & 1 && (a[x - 1 - e + x * 8] = 1, e < 6 ? a[8 + x * e] = 1 : a[8 + x * (e + 1)] = 1);
|
|
1667
|
+
for (e = 0; e < 7; e++, r >>= 1)
|
|
1668
|
+
r & 1 && (a[8 + x * (x - 7 + e)] = 1, e ? a[6 - e + x * 8] = 1 : a[7 + x * 8] = 1);
|
|
1669
|
+
},
|
|
1670
|
+
_interleaveBlocks: function() {
|
|
1671
|
+
var t, e, i = this._dataBlock, r = this._ecc, a = this._eccBlock, x = 0, n = this._calculateMaxLength(), s = this._neccBlock1, f = this._neccBlock2, _ = this._stringBuffer;
|
|
1672
|
+
for (t = 0; t < i; t++) {
|
|
1673
|
+
for (e = 0; e < s; e++)
|
|
1674
|
+
r[x++] = _[t + e * i];
|
|
1675
|
+
for (e = 0; e < f; e++)
|
|
1676
|
+
r[x++] = _[s * i + t + e * (i + 1)];
|
|
1677
|
+
}
|
|
1678
|
+
for (e = 0; e < f; e++)
|
|
1679
|
+
r[x++] = _[s * i + t + e * (i + 1)];
|
|
1680
|
+
for (t = 0; t < a; t++)
|
|
1681
|
+
for (e = 0; e < s + f; e++)
|
|
1682
|
+
r[x++] = _[n + t + e * a];
|
|
1683
|
+
this._stringBuffer = r;
|
|
1684
|
+
},
|
|
1685
|
+
_insertAlignments: function() {
|
|
1686
|
+
var t, e, i, r = this._version, a = this.width;
|
|
1687
|
+
if (r > 1)
|
|
1688
|
+
for (t = F.BLOCK[r], i = a - 7; ; ) {
|
|
1689
|
+
for (e = a - 7; e > t - 3 && (this._addAlignment(e, i), !(e < t)); )
|
|
1690
|
+
e -= t;
|
|
1691
|
+
if (i <= t + 9)
|
|
1692
|
+
break;
|
|
1693
|
+
i -= t, this._addAlignment(6, i), this._addAlignment(i, 6);
|
|
1694
|
+
}
|
|
1695
|
+
},
|
|
1696
|
+
_insertFinders: function() {
|
|
1697
|
+
var t, e, i, r, a = this.buffer, x = this.width;
|
|
1698
|
+
for (t = 0; t < 3; t++) {
|
|
1699
|
+
for (e = 0, r = 0, t === 1 && (e = x - 7), t === 2 && (r = x - 7), a[r + 3 + x * (e + 3)] = 1, i = 0; i < 6; i++)
|
|
1700
|
+
a[r + i + x * e] = 1, a[r + x * (e + i + 1)] = 1, a[r + 6 + x * (e + i)] = 1, a[r + i + 1 + x * (e + 6)] = 1;
|
|
1701
|
+
for (i = 1; i < 5; i++)
|
|
1702
|
+
this._setMask(r + i, e + 1), this._setMask(r + 1, e + i + 1), this._setMask(r + 5, e + i), this._setMask(r + i + 1, e + 5);
|
|
1703
|
+
for (i = 2; i < 4; i++)
|
|
1704
|
+
a[r + i + x * (e + 2)] = 1, a[r + 2 + x * (e + i + 1)] = 1, a[r + 4 + x * (e + i)] = 1, a[r + i + 1 + x * (e + 4)] = 1;
|
|
1705
|
+
}
|
|
1706
|
+
},
|
|
1707
|
+
_insertTimingGap: function() {
|
|
1708
|
+
var t, e, i = this.width;
|
|
1709
|
+
for (e = 0; e < 7; e++)
|
|
1710
|
+
this._setMask(7, e), this._setMask(i - 8, e), this._setMask(7, e + i - 7);
|
|
1711
|
+
for (t = 0; t < 8; t++)
|
|
1712
|
+
this._setMask(t, 7), this._setMask(t + i - 8, 7), this._setMask(t, i - 8);
|
|
1713
|
+
},
|
|
1714
|
+
_insertTimingRowAndColumn: function() {
|
|
1715
|
+
var t, e = this.buffer, i = this.width;
|
|
1716
|
+
for (t = 0; t < i - 14; t++)
|
|
1717
|
+
t & 1 ? (this._setMask(8 + t, 6), this._setMask(6, 8 + t)) : (e[8 + t + i * 6] = 1, e[6 + i * (8 + t)] = 1);
|
|
1718
|
+
},
|
|
1719
|
+
_insertVersion: function() {
|
|
1720
|
+
var t, e, i, r, a = this.buffer, x = this._version, n = this.width;
|
|
1721
|
+
if (x > 6)
|
|
1722
|
+
for (t = Q.BLOCK[x - 7], e = 17, i = 0; i < 6; i++)
|
|
1723
|
+
for (r = 0; r < 3; r++, e--)
|
|
1724
|
+
1 & (e > 11 ? x >> e - 12 : t >> e) ? (a[5 - i + n * (2 - r + n - 11)] = 1, a[2 - r + n - 11 + n * (5 - i)] = 1) : (this._setMask(5 - i, 2 - r + n - 11), this._setMask(2 - r + n - 11, 5 - i));
|
|
1725
|
+
},
|
|
1726
|
+
_isMasked: function(t, e) {
|
|
1727
|
+
var i = c._getMaskBit(t, e);
|
|
1728
|
+
return this._mask[i] === 1;
|
|
1729
|
+
},
|
|
1730
|
+
_pack: function() {
|
|
1731
|
+
var t, e, i, r = 1, a = 1, x = this.width, n = x - 1, s = x - 1, f = (this._dataBlock + this._eccBlock) * (this._neccBlock1 + this._neccBlock2) + this._neccBlock2;
|
|
1732
|
+
for (e = 0; e < f; e++)
|
|
1733
|
+
for (t = this._stringBuffer[e], i = 0; i < 8; i++, t <<= 1) {
|
|
1734
|
+
128 & t && (this.buffer[n + x * s] = 1);
|
|
1735
|
+
do
|
|
1736
|
+
a ? n-- : (n++, r ? s !== 0 ? s-- : (n -= 2, r = !r, n === 6 && (n--, s = 9)) : s !== x - 1 ? s++ : (n -= 2, r = !r, n === 6 && (n--, s -= 8))), a = !a;
|
|
1737
|
+
while (this._isMasked(n, s));
|
|
1738
|
+
}
|
|
1739
|
+
},
|
|
1740
|
+
_reverseMask: function() {
|
|
1741
|
+
var t, e, i = this.width;
|
|
1742
|
+
for (t = 0; t < 9; t++)
|
|
1743
|
+
this._setMask(t, 8);
|
|
1744
|
+
for (t = 0; t < 8; t++)
|
|
1745
|
+
this._setMask(t + i - 8, 8), this._setMask(8, t);
|
|
1746
|
+
for (e = 0; e < 7; e++)
|
|
1747
|
+
this._setMask(8, e + i - 7);
|
|
1748
|
+
},
|
|
1749
|
+
_setMask: function(t, e) {
|
|
1750
|
+
var i = c._getMaskBit(t, e);
|
|
1751
|
+
this._mask[i] = 1;
|
|
1752
|
+
},
|
|
1753
|
+
_syncMask: function() {
|
|
1754
|
+
var t, e, i = this.width;
|
|
1755
|
+
for (e = 0; e < i; e++)
|
|
1756
|
+
for (t = 0; t <= e; t++)
|
|
1757
|
+
this.buffer[t + i * e] && this._setMask(t, e);
|
|
1758
|
+
}
|
|
1759
|
+
}, {
|
|
1760
|
+
_createArray: function(t) {
|
|
1761
|
+
var e, i = [];
|
|
1762
|
+
for (e = 0; e < t; e++)
|
|
1763
|
+
i[e] = 0;
|
|
1764
|
+
return i;
|
|
1765
|
+
},
|
|
1766
|
+
_getMaskBit: function(t, e) {
|
|
1767
|
+
var i;
|
|
1768
|
+
return t > e && (i = t, t = e, e = i), i = e, i += e * e, i >>= 1, i += t, i;
|
|
1769
|
+
},
|
|
1770
|
+
_modN: function(t) {
|
|
1771
|
+
for (; t >= 255; )
|
|
1772
|
+
t -= 255, t = (t >> 8) + (t & 255);
|
|
1773
|
+
return t;
|
|
1774
|
+
},
|
|
1775
|
+
// *Badness* coefficients.
|
|
1776
|
+
N1: 3,
|
|
1777
|
+
N2: 3,
|
|
1778
|
+
N3: 40,
|
|
1779
|
+
N4: 10
|
|
1780
|
+
}), X = c, W = C.extend({
|
|
1781
|
+
/**
|
|
1782
|
+
* @override
|
|
1783
|
+
*/
|
|
1784
|
+
draw: function() {
|
|
1785
|
+
this.element.src = this.qrious.toDataURL();
|
|
1786
|
+
},
|
|
1787
|
+
/**
|
|
1788
|
+
* @override
|
|
1789
|
+
*/
|
|
1790
|
+
reset: function() {
|
|
1791
|
+
this.element.src = "";
|
|
1792
|
+
},
|
|
1793
|
+
/**
|
|
1794
|
+
* @override
|
|
1795
|
+
*/
|
|
1796
|
+
resize: function() {
|
|
1797
|
+
var t = this.element;
|
|
1798
|
+
t.width = t.height = this.qrious.size;
|
|
1799
|
+
}
|
|
1800
|
+
}), H = W, J = u.extend(function(t, e, i, r) {
|
|
1801
|
+
this.name = t, this.modifiable = !!e, this.defaultValue = i, this._valueTransformer = r;
|
|
1802
|
+
}, {
|
|
1803
|
+
/**
|
|
1804
|
+
* Transforms the specified <code>value</code> so that it can be applied for this {@link Option}.
|
|
1805
|
+
*
|
|
1806
|
+
* If a value transformer has been specified for this {@link Option}, it will be called upon to transform
|
|
1807
|
+
* <code>value</code>. Otherwise, <code>value</code> will be returned directly.
|
|
1808
|
+
*
|
|
1809
|
+
* @param {*} value - the value to be transformed
|
|
1810
|
+
* @return {*} The transformed value or <code>value</code> if no value transformer is specified.
|
|
1811
|
+
* @public
|
|
1812
|
+
* @memberof Option#
|
|
1813
|
+
*/
|
|
1814
|
+
transform: function(t) {
|
|
1815
|
+
var e = this._valueTransformer;
|
|
1816
|
+
return typeof e == "function" ? e(t, this) : t;
|
|
1817
|
+
}
|
|
1818
|
+
}), v = J, $ = u.extend(null, {
|
|
1819
|
+
/**
|
|
1820
|
+
* Returns the absolute value of a given number.
|
|
1821
|
+
*
|
|
1822
|
+
* This method is simply a convenient shorthand for <code>Math.abs</code> while ensuring that nulls are returned as
|
|
1823
|
+
* <code>null</code> instead of zero.
|
|
1824
|
+
*
|
|
1825
|
+
* @param {number} value - the number whose absolute value is to be returned
|
|
1826
|
+
* @return {number} The absolute value of <code>value</code> or <code>null</code> if <code>value</code> is
|
|
1827
|
+
* <code>null</code>.
|
|
1828
|
+
* @public
|
|
1829
|
+
* @static
|
|
1830
|
+
* @memberof Utilities
|
|
1831
|
+
*/
|
|
1832
|
+
abs: function(t) {
|
|
1833
|
+
return t != null ? Math.abs(t) : null;
|
|
1834
|
+
},
|
|
1835
|
+
/**
|
|
1836
|
+
* Returns whether the specified <code>object</code> has a property with the specified <code>name</code> as an own
|
|
1837
|
+
* (not inherited) property.
|
|
1838
|
+
*
|
|
1839
|
+
* @param {Object} object - the object on which the property is to be checked
|
|
1840
|
+
* @param {string} name - the name of the property to be checked
|
|
1841
|
+
* @return {boolean} <code>true</code> if <code>object</code> has an own property with <code>name</code>.
|
|
1842
|
+
* @public
|
|
1843
|
+
* @static
|
|
1844
|
+
* @memberof Utilities
|
|
1845
|
+
*/
|
|
1846
|
+
hasOwn: function(t, e) {
|
|
1847
|
+
return Object.prototype.hasOwnProperty.call(t, e);
|
|
1848
|
+
},
|
|
1849
|
+
/**
|
|
1850
|
+
* A non-operation method that does absolutely nothing.
|
|
1851
|
+
*
|
|
1852
|
+
* @return {void}
|
|
1853
|
+
* @public
|
|
1854
|
+
* @static
|
|
1855
|
+
* @memberof Utilities
|
|
1856
|
+
*/
|
|
1857
|
+
noop: function() {
|
|
1858
|
+
},
|
|
1859
|
+
/**
|
|
1860
|
+
* Transforms the specified <code>string</code> to upper case while remaining null-safe.
|
|
1861
|
+
*
|
|
1862
|
+
* @param {string} string - the string to be transformed to upper case
|
|
1863
|
+
* @return {string} <code>string</code> transformed to upper case if <code>string</code> is not <code>null</code>.
|
|
1864
|
+
* @public
|
|
1865
|
+
* @static
|
|
1866
|
+
* @memberof Utilities
|
|
1867
|
+
*/
|
|
1868
|
+
toUpperCase: function(t) {
|
|
1869
|
+
return t != null ? t.toUpperCase() : null;
|
|
1870
|
+
}
|
|
1871
|
+
}), m = $, g = u.extend(function(t) {
|
|
1872
|
+
this.options = {}, t.forEach(function(e) {
|
|
1873
|
+
this.options[e.name] = e;
|
|
1874
|
+
}, this);
|
|
1875
|
+
}, {
|
|
1876
|
+
/**
|
|
1877
|
+
* Returns whether an option with the specified <code>name</code> is available.
|
|
1878
|
+
*
|
|
1879
|
+
* @param {string} name - the name of the {@link Option} whose existence is to be checked
|
|
1880
|
+
* @return {boolean} <code>true</code> if an {@link Option} exists with <code>name</code>; otherwise
|
|
1881
|
+
* <code>false</code>.
|
|
1882
|
+
* @public
|
|
1883
|
+
* @memberof OptionManager#
|
|
1884
|
+
*/
|
|
1885
|
+
exists: function(t) {
|
|
1886
|
+
return this.options[t] != null;
|
|
1887
|
+
},
|
|
1888
|
+
/**
|
|
1889
|
+
* Returns the value of the option with the specified <code>name</code> on the <code>target</code> object provided.
|
|
1890
|
+
*
|
|
1891
|
+
* @param {string} name - the name of the {@link Option} whose value on <code>target</code> is to be returned
|
|
1892
|
+
* @param {Object} target - the object from which the value of the named {@link Option} is to be returned
|
|
1893
|
+
* @return {*} The value of the {@link Option} with <code>name</code> on <code>target</code>.
|
|
1894
|
+
* @public
|
|
1895
|
+
* @memberof OptionManager#
|
|
1896
|
+
*/
|
|
1897
|
+
get: function(t, e) {
|
|
1898
|
+
return g._get(this.options[t], e);
|
|
1899
|
+
},
|
|
1900
|
+
/**
|
|
1901
|
+
* Returns a copy of all of the available options on the <code>target</code> object provided.
|
|
1902
|
+
*
|
|
1903
|
+
* @param {Object} target - the object from which the option name/value pairs are to be returned
|
|
1904
|
+
* @return {Object.<string, *>} A hash containing the name/value pairs of all options on <code>target</code>.
|
|
1905
|
+
* @public
|
|
1906
|
+
* @memberof OptionManager#
|
|
1907
|
+
*/
|
|
1908
|
+
getAll: function(t) {
|
|
1909
|
+
var e, i = this.options, r = {};
|
|
1910
|
+
for (e in i)
|
|
1911
|
+
m.hasOwn(i, e) && (r[e] = g._get(i[e], t));
|
|
1912
|
+
return r;
|
|
1913
|
+
},
|
|
1914
|
+
/**
|
|
1915
|
+
* Initializes the available options for the <code>target</code> object provided and then applies the initial values
|
|
1916
|
+
* within the speciifed <code>options</code>.
|
|
1917
|
+
*
|
|
1918
|
+
* This method will throw an error if any of the names within <code>options</code> does not match an available option.
|
|
1919
|
+
*
|
|
1920
|
+
* This involves setting the default values and defining properties for all of the available options on
|
|
1921
|
+
* <code>target</code> before finally calling {@link OptionMananger#setAll} with <code>options</code> and
|
|
1922
|
+
* <code>target</code>. Any options that are configured to be modifiable will have a setter included in their defined
|
|
1923
|
+
* property that will allow its corresponding value to be modified.
|
|
1924
|
+
*
|
|
1925
|
+
* If a change handler is specified, it will be called whenever the value changes on <code>target</code> for a
|
|
1926
|
+
* modifiable option, but only when done so via the defined property's setter.
|
|
1927
|
+
*
|
|
1928
|
+
* @param {Object.<string, *>} options - the name/value pairs of the initial options to be set
|
|
1929
|
+
* @param {Object} target - the object on which the options are to be initialized
|
|
1930
|
+
* @param {Function} [changeHandler] - the function to be called whenever the value of an modifiable option changes on
|
|
1931
|
+
* <code>target</code>
|
|
1932
|
+
* @return {void}
|
|
1933
|
+
* @throws {Error} If <code>options</code> contains an invalid option name.
|
|
1934
|
+
* @public
|
|
1935
|
+
* @memberof OptionManager#
|
|
1936
|
+
*/
|
|
1937
|
+
init: function(t, e, i) {
|
|
1938
|
+
typeof i != "function" && (i = m.noop);
|
|
1939
|
+
var r, a;
|
|
1940
|
+
for (r in this.options)
|
|
1941
|
+
m.hasOwn(this.options, r) && (a = this.options[r], g._set(a, a.defaultValue, e), g._createAccessor(a, e, i));
|
|
1942
|
+
this._setAll(t, e, !0);
|
|
1943
|
+
},
|
|
1944
|
+
/**
|
|
1945
|
+
* Sets the value of the option with the specified <code>name</code> on the <code>target</code> object provided to
|
|
1946
|
+
* <code>value</code>.
|
|
1947
|
+
*
|
|
1948
|
+
* This method will throw an error if <code>name</code> does not match an available option or matches an option that
|
|
1949
|
+
* cannot be modified.
|
|
1950
|
+
*
|
|
1951
|
+
* If <code>value</code> is <code>null</code> and the {@link Option} has a default value configured, then that default
|
|
1952
|
+
* value will be used instead. If the {@link Option} also has a value transformer configured, it will be used to
|
|
1953
|
+
* transform whichever value was determined to be used.
|
|
1954
|
+
*
|
|
1955
|
+
* This method returns whether the value of the underlying field on <code>target</code> was changed as a result.
|
|
1956
|
+
*
|
|
1957
|
+
* @param {string} name - the name of the {@link Option} whose value is to be set
|
|
1958
|
+
* @param {*} value - the value to be set for the named {@link Option} on <code>target</code>
|
|
1959
|
+
* @param {Object} target - the object on which <code>value</code> is to be set for the named {@link Option}
|
|
1960
|
+
* @return {boolean} <code>true</code> if the underlying field on <code>target</code> was changed; otherwise
|
|
1961
|
+
* <code>false</code>.
|
|
1962
|
+
* @throws {Error} If <code>name</code> is invalid or is for an option that cannot be modified.
|
|
1963
|
+
* @public
|
|
1964
|
+
* @memberof OptionManager#
|
|
1965
|
+
*/
|
|
1966
|
+
set: function(t, e, i) {
|
|
1967
|
+
return this._set(t, e, i);
|
|
1968
|
+
},
|
|
1969
|
+
/**
|
|
1970
|
+
* Sets all of the specified <code>options</code> on the <code>target</code> object provided to their corresponding
|
|
1971
|
+
* values.
|
|
1972
|
+
*
|
|
1973
|
+
* This method will throw an error if any of the names within <code>options</code> does not match an available option
|
|
1974
|
+
* or matches an option that cannot be modified.
|
|
1975
|
+
*
|
|
1976
|
+
* If any value within <code>options</code> is <code>null</code> and the corresponding {@link Option} has a default
|
|
1977
|
+
* value configured, then that default value will be used instead. If an {@link Option} also has a value transformer
|
|
1978
|
+
* configured, it will be used to transform whichever value was determined to be used.
|
|
1979
|
+
*
|
|
1980
|
+
* This method returns whether the value for any of the underlying fields on <code>target</code> were changed as a
|
|
1981
|
+
* result.
|
|
1982
|
+
*
|
|
1983
|
+
* @param {Object.<string, *>} options - the name/value pairs of options to be set
|
|
1984
|
+
* @param {Object} target - the object on which the options are to be set
|
|
1985
|
+
* @return {boolean} <code>true</code> if any of the underlying fields on <code>target</code> were changed; otherwise
|
|
1986
|
+
* <code>false</code>.
|
|
1987
|
+
* @throws {Error} If <code>options</code> contains an invalid option name or an option that cannot be modiifed.
|
|
1988
|
+
* @public
|
|
1989
|
+
* @memberof OptionManager#
|
|
1990
|
+
*/
|
|
1991
|
+
setAll: function(t, e) {
|
|
1992
|
+
return this._setAll(t, e);
|
|
1993
|
+
},
|
|
1994
|
+
_set: function(t, e, i, r) {
|
|
1995
|
+
var a = this.options[t];
|
|
1996
|
+
if (!a)
|
|
1997
|
+
throw new Error("Invalid option: " + t);
|
|
1998
|
+
if (!a.modifiable && !r)
|
|
1999
|
+
throw new Error("Option cannot be modified: " + t);
|
|
2000
|
+
return g._set(a, e, i);
|
|
2001
|
+
},
|
|
2002
|
+
_setAll: function(t, e, i) {
|
|
2003
|
+
if (!t)
|
|
2004
|
+
return !1;
|
|
2005
|
+
var r, a = !1;
|
|
2006
|
+
for (r in t)
|
|
2007
|
+
m.hasOwn(t, r) && this._set(r, t[r], e, i) && (a = !0);
|
|
2008
|
+
return a;
|
|
2009
|
+
}
|
|
2010
|
+
}, {
|
|
2011
|
+
_createAccessor: function(t, e, i) {
|
|
2012
|
+
var r = {
|
|
2013
|
+
get: function() {
|
|
2014
|
+
return g._get(t, e);
|
|
2015
|
+
}
|
|
2016
|
+
};
|
|
2017
|
+
t.modifiable && (r.set = function(a) {
|
|
2018
|
+
g._set(t, a, e) && i(a, t);
|
|
2019
|
+
}), Object.defineProperty(e, t.name, r);
|
|
2020
|
+
},
|
|
2021
|
+
_get: function(t, e) {
|
|
2022
|
+
return e["_" + t.name];
|
|
2023
|
+
},
|
|
2024
|
+
_set: function(t, e, i) {
|
|
2025
|
+
var r = "_" + t.name, a = i[r], x = t.transform(e ?? t.defaultValue);
|
|
2026
|
+
return i[r] = x, x !== a;
|
|
2027
|
+
}
|
|
2028
|
+
}), Y = g, Z = u.extend(function() {
|
|
2029
|
+
this._services = {};
|
|
2030
|
+
}, {
|
|
2031
|
+
/**
|
|
2032
|
+
* Returns the {@link Service} being managed with the specified <code>name</code>.
|
|
2033
|
+
*
|
|
2034
|
+
* @param {string} name - the name of the {@link Service} to be returned
|
|
2035
|
+
* @return {Service} The {@link Service} is being managed with <code>name</code>.
|
|
2036
|
+
* @throws {Error} If no {@link Service} is being managed with <code>name</code>.
|
|
2037
|
+
* @public
|
|
2038
|
+
* @memberof ServiceManager#
|
|
2039
|
+
*/
|
|
2040
|
+
getService: function(t) {
|
|
2041
|
+
var e = this._services[t];
|
|
2042
|
+
if (!e)
|
|
2043
|
+
throw new Error("Service is not being managed with name: " + t);
|
|
2044
|
+
return e;
|
|
2045
|
+
},
|
|
2046
|
+
/**
|
|
2047
|
+
* Sets the {@link Service} implementation to be managed for the specified <code>name</code> to the
|
|
2048
|
+
* <code>service</code> provided.
|
|
2049
|
+
*
|
|
2050
|
+
* @param {string} name - the name of the {@link Service} to be managed with <code>name</code>
|
|
2051
|
+
* @param {Service} service - the {@link Service} implementation to be managed
|
|
2052
|
+
* @return {void}
|
|
2053
|
+
* @throws {Error} If a {@link Service} is already being managed with the same <code>name</code>.
|
|
2054
|
+
* @public
|
|
2055
|
+
* @memberof ServiceManager#
|
|
2056
|
+
*/
|
|
2057
|
+
setService: function(t, e) {
|
|
2058
|
+
if (this._services[t])
|
|
2059
|
+
throw new Error("Service is already managed with name: " + t);
|
|
2060
|
+
e && (this._services[t] = e);
|
|
2061
|
+
}
|
|
2062
|
+
}), ee = Z, A = new Y([
|
|
2063
|
+
new v("background", !0, "white"),
|
|
2064
|
+
new v("backgroundAlpha", !0, 1, m.abs),
|
|
2065
|
+
new v("element"),
|
|
2066
|
+
new v("foreground", !0, "black"),
|
|
2067
|
+
new v("foregroundAlpha", !0, 1, m.abs),
|
|
2068
|
+
new v("level", !0, "L", m.toUpperCase),
|
|
2069
|
+
new v("mime", !0, "image/png"),
|
|
2070
|
+
new v("padding", !0, null, m.abs),
|
|
2071
|
+
new v("size", !0, 100, m.abs),
|
|
2072
|
+
new v("value", !0, "")
|
|
2073
|
+
]), S = new ee(), L = u.extend(function(t) {
|
|
2074
|
+
A.init(t, this, this.update.bind(this));
|
|
2075
|
+
var e = A.get("element", this), i = S.getService("element"), r = e && i.isCanvas(e) ? e : i.createCanvas(), a = e && i.isImage(e) ? e : i.createImage();
|
|
2076
|
+
this._canvasRenderer = new D(this, r, !0), this._imageRenderer = new H(this, a, a === e), this.update();
|
|
2077
|
+
}, {
|
|
2078
|
+
/**
|
|
2079
|
+
* Returns all of the options configured for this {@link QRious}.
|
|
2080
|
+
*
|
|
2081
|
+
* Any changes made to the returned object will not be reflected in the options themselves or their corresponding
|
|
2082
|
+
* underlying fields.
|
|
2083
|
+
*
|
|
2084
|
+
* @return {Object.<string, *>} A copy of the applied options.
|
|
2085
|
+
* @public
|
|
2086
|
+
* @memberof QRious#
|
|
2087
|
+
*/
|
|
2088
|
+
get: function() {
|
|
2089
|
+
return A.getAll(this);
|
|
2090
|
+
},
|
|
2091
|
+
/**
|
|
2092
|
+
* Sets all of the specified <code>options</code> and automatically updates this {@link QRious} if any of the
|
|
2093
|
+
* underlying fields are changed as a result.
|
|
2094
|
+
*
|
|
2095
|
+
* This is the preferred method for updating multiple options at one time to avoid unnecessary updates between
|
|
2096
|
+
* changes.
|
|
2097
|
+
*
|
|
2098
|
+
* @param {QRious~Options} options - the options to be set
|
|
2099
|
+
* @return {void}
|
|
2100
|
+
* @throws {Error} If any <code>options</code> are invalid or cannot be modified.
|
|
2101
|
+
* @public
|
|
2102
|
+
* @memberof QRious#
|
|
2103
|
+
*/
|
|
2104
|
+
set: function(t) {
|
|
2105
|
+
A.setAll(t, this) && this.update();
|
|
2106
|
+
},
|
|
2107
|
+
/**
|
|
2108
|
+
* Returns the image data URI for the generated QR code using the <code>mime</code> provided.
|
|
2109
|
+
*
|
|
2110
|
+
* @param {string} [mime] - the MIME type for the image
|
|
2111
|
+
* @return {string} The image data URI for the QR code.
|
|
2112
|
+
* @public
|
|
2113
|
+
* @memberof QRious#
|
|
2114
|
+
*/
|
|
2115
|
+
toDataURL: function(t) {
|
|
2116
|
+
return this.canvas.toDataURL(t || this.mime);
|
|
2117
|
+
},
|
|
2118
|
+
/**
|
|
2119
|
+
* Updates this {@link QRious} by generating a new {@link Frame} and re-rendering the QR code.
|
|
2120
|
+
*
|
|
2121
|
+
* @return {void}
|
|
2122
|
+
* @protected
|
|
2123
|
+
* @memberof QRious#
|
|
2124
|
+
*/
|
|
2125
|
+
update: function() {
|
|
2126
|
+
var t = new X({
|
|
2127
|
+
level: this.level,
|
|
2128
|
+
value: this.value
|
|
2129
|
+
});
|
|
2130
|
+
this._canvasRenderer.render(t), this._imageRenderer.render(t);
|
|
2131
|
+
}
|
|
2132
|
+
}, {
|
|
2133
|
+
/**
|
|
2134
|
+
* Configures the <code>service</code> provided to be used by all {@link QRious} instances.
|
|
2135
|
+
*
|
|
2136
|
+
* @param {Service} service - the {@link Service} to be configured
|
|
2137
|
+
* @return {void}
|
|
2138
|
+
* @throws {Error} If a {@link Service} has already been configured with the same name.
|
|
2139
|
+
* @public
|
|
2140
|
+
* @static
|
|
2141
|
+
* @memberof QRious
|
|
2142
|
+
*/
|
|
2143
|
+
use: function(t) {
|
|
2144
|
+
S.setService(t.getName(), t);
|
|
2145
|
+
}
|
|
2146
|
+
});
|
|
2147
|
+
Object.defineProperties(L.prototype, {
|
|
2148
|
+
canvas: {
|
|
2149
|
+
/**
|
|
2150
|
+
* Returns the <code>canvas</code> element being used to render the QR code for this {@link QRious}.
|
|
2151
|
+
*
|
|
2152
|
+
* @return {*} The <code>canvas</code> element.
|
|
2153
|
+
* @public
|
|
2154
|
+
* @memberof QRious#
|
|
2155
|
+
* @alias canvas
|
|
2156
|
+
*/
|
|
2157
|
+
get: function() {
|
|
2158
|
+
return this._canvasRenderer.getElement();
|
|
2159
|
+
}
|
|
2160
|
+
},
|
|
2161
|
+
image: {
|
|
2162
|
+
/**
|
|
2163
|
+
* Returns the <code>img</code> element being used to render the QR code for this {@link QRious}.
|
|
2164
|
+
*
|
|
2165
|
+
* @return {*} The <code>img</code> element.
|
|
2166
|
+
* @public
|
|
2167
|
+
* @memberof QRious#
|
|
2168
|
+
* @alias image
|
|
2169
|
+
*/
|
|
2170
|
+
get: function() {
|
|
2171
|
+
return this._imageRenderer.getElement();
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
});
|
|
2175
|
+
var te = L, N = te, ie = u.extend({
|
|
2176
|
+
/**
|
|
2177
|
+
* Returns the name of this {@link Service}.
|
|
2178
|
+
*
|
|
2179
|
+
* @return {string} The service name.
|
|
2180
|
+
* @public
|
|
2181
|
+
* @abstract
|
|
2182
|
+
* @memberof Service#
|
|
2183
|
+
*/
|
|
2184
|
+
getName: function() {
|
|
2185
|
+
}
|
|
2186
|
+
}), re = ie, ae = re.extend({
|
|
2187
|
+
/**
|
|
2188
|
+
* Creates an instance of a canvas element.
|
|
2189
|
+
*
|
|
2190
|
+
* Implementations of {@link ElementService} <b>must</b> override this method with their own specific logic.
|
|
2191
|
+
*
|
|
2192
|
+
* @return {*} The newly created canvas element.
|
|
2193
|
+
* @public
|
|
2194
|
+
* @abstract
|
|
2195
|
+
* @memberof ElementService#
|
|
2196
|
+
*/
|
|
2197
|
+
createCanvas: function() {
|
|
2198
|
+
},
|
|
2199
|
+
/**
|
|
2200
|
+
* Creates an instance of a image element.
|
|
2201
|
+
*
|
|
2202
|
+
* Implementations of {@link ElementService} <b>must</b> override this method with their own specific logic.
|
|
2203
|
+
*
|
|
2204
|
+
* @return {*} The newly created image element.
|
|
2205
|
+
* @public
|
|
2206
|
+
* @abstract
|
|
2207
|
+
* @memberof ElementService#
|
|
2208
|
+
*/
|
|
2209
|
+
createImage: function() {
|
|
2210
|
+
},
|
|
2211
|
+
/**
|
|
2212
|
+
* @override
|
|
2213
|
+
*/
|
|
2214
|
+
getName: function() {
|
|
2215
|
+
return "element";
|
|
2216
|
+
},
|
|
2217
|
+
/**
|
|
2218
|
+
* Returns whether the specified <code>element</code> is a canvas.
|
|
2219
|
+
*
|
|
2220
|
+
* Implementations of {@link ElementService} <b>must</b> override this method with their own specific logic.
|
|
2221
|
+
*
|
|
2222
|
+
* @param {*} element - the element to be checked
|
|
2223
|
+
* @return {boolean} <code>true</code> if <code>element</code> is a canvas; otherwise <code>false</code>.
|
|
2224
|
+
* @public
|
|
2225
|
+
* @abstract
|
|
2226
|
+
* @memberof ElementService#
|
|
2227
|
+
*/
|
|
2228
|
+
isCanvas: function(t) {
|
|
2229
|
+
},
|
|
2230
|
+
/**
|
|
2231
|
+
* Returns whether the specified <code>element</code> is an image.
|
|
2232
|
+
*
|
|
2233
|
+
* Implementations of {@link ElementService} <b>must</b> override this method with their own specific logic.
|
|
2234
|
+
*
|
|
2235
|
+
* @param {*} element - the element to be checked
|
|
2236
|
+
* @return {boolean} <code>true</code> if <code>element</code> is an image; otherwise <code>false</code>.
|
|
2237
|
+
* @public
|
|
2238
|
+
* @abstract
|
|
2239
|
+
* @memberof ElementService#
|
|
2240
|
+
*/
|
|
2241
|
+
isImage: function(t) {
|
|
2242
|
+
}
|
|
2243
|
+
}), xe = ae, ne = xe.extend({
|
|
2244
|
+
/**
|
|
2245
|
+
* @override
|
|
2246
|
+
*/
|
|
2247
|
+
createCanvas: function() {
|
|
2248
|
+
return document.createElement("canvas");
|
|
2249
|
+
},
|
|
2250
|
+
/**
|
|
2251
|
+
* @override
|
|
2252
|
+
*/
|
|
2253
|
+
createImage: function() {
|
|
2254
|
+
return document.createElement("img");
|
|
2255
|
+
},
|
|
2256
|
+
/**
|
|
2257
|
+
* @override
|
|
2258
|
+
*/
|
|
2259
|
+
isCanvas: function(t) {
|
|
2260
|
+
return t instanceof HTMLCanvasElement;
|
|
2261
|
+
},
|
|
2262
|
+
/**
|
|
2263
|
+
* @override
|
|
2264
|
+
*/
|
|
2265
|
+
isImage: function(t) {
|
|
2266
|
+
return t instanceof HTMLImageElement;
|
|
2267
|
+
}
|
|
2268
|
+
}), se = ne;
|
|
2269
|
+
N.use(new se());
|
|
2270
|
+
var fe = N;
|
|
2271
|
+
return fe;
|
|
2272
|
+
});
|
|
2273
|
+
})(q);
|
|
2274
|
+
var ve = q.exports;
|
|
2275
|
+
const _e = /* @__PURE__ */ he(ve);
|
|
2276
|
+
class T extends le {
|
|
2277
|
+
constructor() {
|
|
2278
|
+
super();
|
|
2279
|
+
j(this, "className", "QrCode");
|
|
2280
|
+
}
|
|
2281
|
+
static get cssStyleSheet() {
|
|
2282
|
+
return de;
|
|
2283
|
+
}
|
|
2284
|
+
setupAttributes() {
|
|
2285
|
+
this.isShadowRoot = "open";
|
|
2286
|
+
}
|
|
2287
|
+
static get observedAttributes() {
|
|
2288
|
+
return [
|
|
2289
|
+
"value",
|
|
2290
|
+
"background",
|
|
2291
|
+
"backgroundAlpha",
|
|
2292
|
+
"foreground",
|
|
2293
|
+
"foregroundAlpha",
|
|
2294
|
+
"level",
|
|
2295
|
+
"padding",
|
|
2296
|
+
"size"
|
|
2297
|
+
];
|
|
2298
|
+
}
|
|
2299
|
+
draw(l, O, E) {
|
|
2300
|
+
let B = document.createDocumentFragment(), d = document.createElement("div");
|
|
2301
|
+
d.classList.add("container");
|
|
2302
|
+
let k = document.createElement("canvas");
|
|
2303
|
+
k.classList.add("qr"), k.setAttribute("part", "native");
|
|
2304
|
+
let w = document.createElement("slot");
|
|
2305
|
+
w.setAttribute("name", "top");
|
|
2306
|
+
let h = document.createElement("slot");
|
|
2307
|
+
return h.setAttribute("name", "bottom"), d.appendChild(w), d.appendChild(k), d.appendChild(h), B.appendChild(d), B;
|
|
2308
|
+
}
|
|
2309
|
+
afterDraw(l, O, E) {
|
|
2310
|
+
const B = this.shadowRoot.querySelector("canvas"), d = {};
|
|
2311
|
+
[
|
|
2312
|
+
"value",
|
|
2313
|
+
"background",
|
|
2314
|
+
"backgroundAlpha",
|
|
2315
|
+
"foreground",
|
|
2316
|
+
"foregroundAlpha",
|
|
2317
|
+
"level",
|
|
2318
|
+
"padding",
|
|
2319
|
+
"size"
|
|
2320
|
+
].forEach((w) => {
|
|
2321
|
+
const h = this.getAttribute(w);
|
|
2322
|
+
h !== null && (d[w] = h);
|
|
2323
|
+
}), d.hasOwnProperty("value") || (d.value = "empty value"), new _e({
|
|
2324
|
+
element: B,
|
|
2325
|
+
...d
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
T.define("wje-qr-code", T);
|
|
2330
|
+
export {
|
|
2331
|
+
T as default
|
|
2332
|
+
};
|