@forgerock/login-widget 1.2.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1500 @@
1
+ function St(e, t) {
2
+ for (var i = 0; i < t.length; i++) {
3
+ const o = t[i];
4
+ if (typeof o != "string" && !Array.isArray(o)) {
5
+ for (const r in o)
6
+ if (r !== "default" && !(r in e)) {
7
+ const n = Object.getOwnPropertyDescriptor(o, r);
8
+ n && Object.defineProperty(e, r, n.get ? n : {
9
+ enumerable: !0,
10
+ get: () => o[r]
11
+ });
12
+ }
13
+ }
14
+ }
15
+ return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
16
+ }
17
+ var D = {}, Rt = function() {
18
+ return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
19
+ }, dt = {}, I = {};
20
+ let it;
21
+ const Lt = [
22
+ 0,
23
+ // Not used
24
+ 26,
25
+ 44,
26
+ 70,
27
+ 100,
28
+ 134,
29
+ 172,
30
+ 196,
31
+ 242,
32
+ 292,
33
+ 346,
34
+ 404,
35
+ 466,
36
+ 532,
37
+ 581,
38
+ 655,
39
+ 733,
40
+ 815,
41
+ 901,
42
+ 991,
43
+ 1085,
44
+ 1156,
45
+ 1258,
46
+ 1364,
47
+ 1474,
48
+ 1588,
49
+ 1706,
50
+ 1828,
51
+ 1921,
52
+ 2051,
53
+ 2185,
54
+ 2323,
55
+ 2465,
56
+ 2611,
57
+ 2761,
58
+ 2876,
59
+ 3034,
60
+ 3196,
61
+ 3362,
62
+ 3532,
63
+ 3706
64
+ ];
65
+ I.getSymbolSize = function(t) {
66
+ if (!t) throw new Error('"version" cannot be null or undefined');
67
+ if (t < 1 || t > 40) throw new Error('"version" should be in range from 1 to 40');
68
+ return t * 4 + 17;
69
+ };
70
+ I.getSymbolTotalCodewords = function(t) {
71
+ return Lt[t];
72
+ };
73
+ I.getBCHDigit = function(e) {
74
+ let t = 0;
75
+ for (; e !== 0; )
76
+ t++, e >>>= 1;
77
+ return t;
78
+ };
79
+ I.setToSJISFunction = function(t) {
80
+ if (typeof t != "function")
81
+ throw new Error('"toSJISFunc" is not a valid function.');
82
+ it = t;
83
+ };
84
+ I.isKanjiModeEnabled = function() {
85
+ return typeof it < "u";
86
+ };
87
+ I.toSJIS = function(t) {
88
+ return it(t);
89
+ };
90
+ var j = {};
91
+ (function(e) {
92
+ e.L = { bit: 1 }, e.M = { bit: 0 }, e.Q = { bit: 3 }, e.H = { bit: 2 };
93
+ function t(i) {
94
+ if (typeof i != "string")
95
+ throw new Error("Param is not a string");
96
+ switch (i.toLowerCase()) {
97
+ case "l":
98
+ case "low":
99
+ return e.L;
100
+ case "m":
101
+ case "medium":
102
+ return e.M;
103
+ case "q":
104
+ case "quartile":
105
+ return e.Q;
106
+ case "h":
107
+ case "high":
108
+ return e.H;
109
+ default:
110
+ throw new Error("Unknown EC Level: " + i);
111
+ }
112
+ }
113
+ e.isValid = function(o) {
114
+ return o && typeof o.bit < "u" && o.bit >= 0 && o.bit < 4;
115
+ }, e.from = function(o, r) {
116
+ if (e.isValid(o))
117
+ return o;
118
+ try {
119
+ return t(o);
120
+ } catch {
121
+ return r;
122
+ }
123
+ };
124
+ })(j);
125
+ function ht() {
126
+ this.buffer = [], this.length = 0;
127
+ }
128
+ ht.prototype = {
129
+ get: function(e) {
130
+ const t = Math.floor(e / 8);
131
+ return (this.buffer[t] >>> 7 - e % 8 & 1) === 1;
132
+ },
133
+ put: function(e, t) {
134
+ for (let i = 0; i < t; i++)
135
+ this.putBit((e >>> t - i - 1 & 1) === 1);
136
+ },
137
+ getLengthInBits: function() {
138
+ return this.length;
139
+ },
140
+ putBit: function(e) {
141
+ const t = Math.floor(this.length / 8);
142
+ this.buffer.length <= t && this.buffer.push(0), e && (this.buffer[t] |= 128 >>> this.length % 8), this.length++;
143
+ }
144
+ };
145
+ var Dt = ht;
146
+ function H(e) {
147
+ if (!e || e < 1)
148
+ throw new Error("BitMatrix size must be defined and greater than 0");
149
+ this.size = e, this.data = new Uint8Array(e * e), this.reservedBit = new Uint8Array(e * e);
150
+ }
151
+ H.prototype.set = function(e, t, i, o) {
152
+ const r = e * this.size + t;
153
+ this.data[r] = i, o && (this.reservedBit[r] = !0);
154
+ };
155
+ H.prototype.get = function(e, t) {
156
+ return this.data[e * this.size + t];
157
+ };
158
+ H.prototype.xor = function(e, t, i) {
159
+ this.data[e * this.size + t] ^= i;
160
+ };
161
+ H.prototype.isReserved = function(e, t) {
162
+ return this.reservedBit[e * this.size + t];
163
+ };
164
+ var _t = H, wt = {};
165
+ (function(e) {
166
+ const t = I.getSymbolSize;
167
+ e.getRowColCoords = function(o) {
168
+ if (o === 1) return [];
169
+ const r = Math.floor(o / 7) + 2, n = t(o), s = n === 145 ? 26 : Math.ceil((n - 13) / (2 * r - 2)) * 2, c = [n - 7];
170
+ for (let u = 1; u < r - 1; u++)
171
+ c[u] = c[u - 1] - s;
172
+ return c.push(6), c.reverse();
173
+ }, e.getPositions = function(o) {
174
+ const r = [], n = e.getRowColCoords(o), s = n.length;
175
+ for (let c = 0; c < s; c++)
176
+ for (let u = 0; u < s; u++)
177
+ c === 0 && u === 0 || // top-left
178
+ c === 0 && u === s - 1 || // bottom-left
179
+ c === s - 1 && u === 0 || r.push([n[c], n[u]]);
180
+ return r;
181
+ };
182
+ })(wt);
183
+ var mt = {};
184
+ const Ut = I.getSymbolSize, lt = 7;
185
+ mt.getPositions = function(t) {
186
+ const i = Ut(t);
187
+ return [
188
+ // top-left
189
+ [0, 0],
190
+ // top-right
191
+ [i - lt, 0],
192
+ // bottom-left
193
+ [0, i - lt]
194
+ ];
195
+ };
196
+ var yt = {};
197
+ (function(e) {
198
+ e.Patterns = {
199
+ PATTERN000: 0,
200
+ PATTERN001: 1,
201
+ PATTERN010: 2,
202
+ PATTERN011: 3,
203
+ PATTERN100: 4,
204
+ PATTERN101: 5,
205
+ PATTERN110: 6,
206
+ PATTERN111: 7
207
+ };
208
+ const t = {
209
+ N1: 3,
210
+ N2: 3,
211
+ N3: 40,
212
+ N4: 10
213
+ };
214
+ e.isValid = function(r) {
215
+ return r != null && r !== "" && !isNaN(r) && r >= 0 && r <= 7;
216
+ }, e.from = function(r) {
217
+ return e.isValid(r) ? parseInt(r, 10) : void 0;
218
+ }, e.getPenaltyN1 = function(r) {
219
+ const n = r.size;
220
+ let s = 0, c = 0, u = 0, a = null, l = null;
221
+ for (let B = 0; B < n; B++) {
222
+ c = u = 0, a = l = null;
223
+ for (let w = 0; w < n; w++) {
224
+ let f = r.get(B, w);
225
+ f === a ? c++ : (c >= 5 && (s += t.N1 + (c - 5)), a = f, c = 1), f = r.get(w, B), f === l ? u++ : (u >= 5 && (s += t.N1 + (u - 5)), l = f, u = 1);
226
+ }
227
+ c >= 5 && (s += t.N1 + (c - 5)), u >= 5 && (s += t.N1 + (u - 5));
228
+ }
229
+ return s;
230
+ }, e.getPenaltyN2 = function(r) {
231
+ const n = r.size;
232
+ let s = 0;
233
+ for (let c = 0; c < n - 1; c++)
234
+ for (let u = 0; u < n - 1; u++) {
235
+ const a = r.get(c, u) + r.get(c, u + 1) + r.get(c + 1, u) + r.get(c + 1, u + 1);
236
+ (a === 4 || a === 0) && s++;
237
+ }
238
+ return s * t.N2;
239
+ }, e.getPenaltyN3 = function(r) {
240
+ const n = r.size;
241
+ let s = 0, c = 0, u = 0;
242
+ for (let a = 0; a < n; a++) {
243
+ c = u = 0;
244
+ for (let l = 0; l < n; l++)
245
+ c = c << 1 & 2047 | r.get(a, l), l >= 10 && (c === 1488 || c === 93) && s++, u = u << 1 & 2047 | r.get(l, a), l >= 10 && (u === 1488 || u === 93) && s++;
246
+ }
247
+ return s * t.N3;
248
+ }, e.getPenaltyN4 = function(r) {
249
+ let n = 0;
250
+ const s = r.data.length;
251
+ for (let u = 0; u < s; u++) n += r.data[u];
252
+ return Math.abs(Math.ceil(n * 100 / s / 5) - 10) * t.N4;
253
+ };
254
+ function i(o, r, n) {
255
+ switch (o) {
256
+ case e.Patterns.PATTERN000:
257
+ return (r + n) % 2 === 0;
258
+ case e.Patterns.PATTERN001:
259
+ return r % 2 === 0;
260
+ case e.Patterns.PATTERN010:
261
+ return n % 3 === 0;
262
+ case e.Patterns.PATTERN011:
263
+ return (r + n) % 3 === 0;
264
+ case e.Patterns.PATTERN100:
265
+ return (Math.floor(r / 2) + Math.floor(n / 3)) % 2 === 0;
266
+ case e.Patterns.PATTERN101:
267
+ return r * n % 2 + r * n % 3 === 0;
268
+ case e.Patterns.PATTERN110:
269
+ return (r * n % 2 + r * n % 3) % 2 === 0;
270
+ case e.Patterns.PATTERN111:
271
+ return (r * n % 3 + (r + n) % 2) % 2 === 0;
272
+ default:
273
+ throw new Error("bad maskPattern:" + o);
274
+ }
275
+ }
276
+ e.applyMask = function(r, n) {
277
+ const s = n.size;
278
+ for (let c = 0; c < s; c++)
279
+ for (let u = 0; u < s; u++)
280
+ n.isReserved(u, c) || n.xor(u, c, i(r, u, c));
281
+ }, e.getBestMask = function(r, n) {
282
+ const s = Object.keys(e.Patterns).length;
283
+ let c = 0, u = 1 / 0;
284
+ for (let a = 0; a < s; a++) {
285
+ n(a), e.applyMask(a, r);
286
+ const l = e.getPenaltyN1(r) + e.getPenaltyN2(r) + e.getPenaltyN3(r) + e.getPenaltyN4(r);
287
+ e.applyMask(a, r), l < u && (u = l, c = a);
288
+ }
289
+ return c;
290
+ };
291
+ })(yt);
292
+ var G = {};
293
+ const R = j, K = [
294
+ // L M Q H
295
+ 1,
296
+ 1,
297
+ 1,
298
+ 1,
299
+ 1,
300
+ 1,
301
+ 1,
302
+ 1,
303
+ 1,
304
+ 1,
305
+ 2,
306
+ 2,
307
+ 1,
308
+ 2,
309
+ 2,
310
+ 4,
311
+ 1,
312
+ 2,
313
+ 4,
314
+ 4,
315
+ 2,
316
+ 4,
317
+ 4,
318
+ 4,
319
+ 2,
320
+ 4,
321
+ 6,
322
+ 5,
323
+ 2,
324
+ 4,
325
+ 6,
326
+ 6,
327
+ 2,
328
+ 5,
329
+ 8,
330
+ 8,
331
+ 4,
332
+ 5,
333
+ 8,
334
+ 8,
335
+ 4,
336
+ 5,
337
+ 8,
338
+ 11,
339
+ 4,
340
+ 8,
341
+ 10,
342
+ 11,
343
+ 4,
344
+ 9,
345
+ 12,
346
+ 16,
347
+ 4,
348
+ 9,
349
+ 16,
350
+ 16,
351
+ 6,
352
+ 10,
353
+ 12,
354
+ 18,
355
+ 6,
356
+ 10,
357
+ 17,
358
+ 16,
359
+ 6,
360
+ 11,
361
+ 16,
362
+ 19,
363
+ 6,
364
+ 13,
365
+ 18,
366
+ 21,
367
+ 7,
368
+ 14,
369
+ 21,
370
+ 25,
371
+ 8,
372
+ 16,
373
+ 20,
374
+ 25,
375
+ 8,
376
+ 17,
377
+ 23,
378
+ 25,
379
+ 9,
380
+ 17,
381
+ 23,
382
+ 34,
383
+ 9,
384
+ 18,
385
+ 25,
386
+ 30,
387
+ 10,
388
+ 20,
389
+ 27,
390
+ 32,
391
+ 12,
392
+ 21,
393
+ 29,
394
+ 35,
395
+ 12,
396
+ 23,
397
+ 34,
398
+ 37,
399
+ 12,
400
+ 25,
401
+ 34,
402
+ 40,
403
+ 13,
404
+ 26,
405
+ 35,
406
+ 42,
407
+ 14,
408
+ 28,
409
+ 38,
410
+ 45,
411
+ 15,
412
+ 29,
413
+ 40,
414
+ 48,
415
+ 16,
416
+ 31,
417
+ 43,
418
+ 51,
419
+ 17,
420
+ 33,
421
+ 45,
422
+ 54,
423
+ 18,
424
+ 35,
425
+ 48,
426
+ 57,
427
+ 19,
428
+ 37,
429
+ 51,
430
+ 60,
431
+ 19,
432
+ 38,
433
+ 53,
434
+ 63,
435
+ 20,
436
+ 40,
437
+ 56,
438
+ 66,
439
+ 21,
440
+ 43,
441
+ 59,
442
+ 70,
443
+ 22,
444
+ 45,
445
+ 62,
446
+ 74,
447
+ 24,
448
+ 47,
449
+ 65,
450
+ 77,
451
+ 25,
452
+ 49,
453
+ 68,
454
+ 81
455
+ ], J = [
456
+ // L M Q H
457
+ 7,
458
+ 10,
459
+ 13,
460
+ 17,
461
+ 10,
462
+ 16,
463
+ 22,
464
+ 28,
465
+ 15,
466
+ 26,
467
+ 36,
468
+ 44,
469
+ 20,
470
+ 36,
471
+ 52,
472
+ 64,
473
+ 26,
474
+ 48,
475
+ 72,
476
+ 88,
477
+ 36,
478
+ 64,
479
+ 96,
480
+ 112,
481
+ 40,
482
+ 72,
483
+ 108,
484
+ 130,
485
+ 48,
486
+ 88,
487
+ 132,
488
+ 156,
489
+ 60,
490
+ 110,
491
+ 160,
492
+ 192,
493
+ 72,
494
+ 130,
495
+ 192,
496
+ 224,
497
+ 80,
498
+ 150,
499
+ 224,
500
+ 264,
501
+ 96,
502
+ 176,
503
+ 260,
504
+ 308,
505
+ 104,
506
+ 198,
507
+ 288,
508
+ 352,
509
+ 120,
510
+ 216,
511
+ 320,
512
+ 384,
513
+ 132,
514
+ 240,
515
+ 360,
516
+ 432,
517
+ 144,
518
+ 280,
519
+ 408,
520
+ 480,
521
+ 168,
522
+ 308,
523
+ 448,
524
+ 532,
525
+ 180,
526
+ 338,
527
+ 504,
528
+ 588,
529
+ 196,
530
+ 364,
531
+ 546,
532
+ 650,
533
+ 224,
534
+ 416,
535
+ 600,
536
+ 700,
537
+ 224,
538
+ 442,
539
+ 644,
540
+ 750,
541
+ 252,
542
+ 476,
543
+ 690,
544
+ 816,
545
+ 270,
546
+ 504,
547
+ 750,
548
+ 900,
549
+ 300,
550
+ 560,
551
+ 810,
552
+ 960,
553
+ 312,
554
+ 588,
555
+ 870,
556
+ 1050,
557
+ 336,
558
+ 644,
559
+ 952,
560
+ 1110,
561
+ 360,
562
+ 700,
563
+ 1020,
564
+ 1200,
565
+ 390,
566
+ 728,
567
+ 1050,
568
+ 1260,
569
+ 420,
570
+ 784,
571
+ 1140,
572
+ 1350,
573
+ 450,
574
+ 812,
575
+ 1200,
576
+ 1440,
577
+ 480,
578
+ 868,
579
+ 1290,
580
+ 1530,
581
+ 510,
582
+ 924,
583
+ 1350,
584
+ 1620,
585
+ 540,
586
+ 980,
587
+ 1440,
588
+ 1710,
589
+ 570,
590
+ 1036,
591
+ 1530,
592
+ 1800,
593
+ 570,
594
+ 1064,
595
+ 1590,
596
+ 1890,
597
+ 600,
598
+ 1120,
599
+ 1680,
600
+ 1980,
601
+ 630,
602
+ 1204,
603
+ 1770,
604
+ 2100,
605
+ 660,
606
+ 1260,
607
+ 1860,
608
+ 2220,
609
+ 720,
610
+ 1316,
611
+ 1950,
612
+ 2310,
613
+ 750,
614
+ 1372,
615
+ 2040,
616
+ 2430
617
+ ];
618
+ G.getBlocksCount = function(t, i) {
619
+ switch (i) {
620
+ case R.L:
621
+ return K[(t - 1) * 4 + 0];
622
+ case R.M:
623
+ return K[(t - 1) * 4 + 1];
624
+ case R.Q:
625
+ return K[(t - 1) * 4 + 2];
626
+ case R.H:
627
+ return K[(t - 1) * 4 + 3];
628
+ default:
629
+ return;
630
+ }
631
+ };
632
+ G.getTotalCodewordsCount = function(t, i) {
633
+ switch (i) {
634
+ case R.L:
635
+ return J[(t - 1) * 4 + 0];
636
+ case R.M:
637
+ return J[(t - 1) * 4 + 1];
638
+ case R.Q:
639
+ return J[(t - 1) * 4 + 2];
640
+ case R.H:
641
+ return J[(t - 1) * 4 + 3];
642
+ default:
643
+ return;
644
+ }
645
+ };
646
+ var Ct = {}, Q = {};
647
+ const z = new Uint8Array(512), O = new Uint8Array(256);
648
+ (function() {
649
+ let t = 1;
650
+ for (let i = 0; i < 255; i++)
651
+ z[i] = t, O[t] = i, t <<= 1, t & 256 && (t ^= 285);
652
+ for (let i = 255; i < 512; i++)
653
+ z[i] = z[i - 255];
654
+ })();
655
+ Q.log = function(t) {
656
+ if (t < 1) throw new Error("log(" + t + ")");
657
+ return O[t];
658
+ };
659
+ Q.exp = function(t) {
660
+ return z[t];
661
+ };
662
+ Q.mul = function(t, i) {
663
+ return t === 0 || i === 0 ? 0 : z[O[t] + O[i]];
664
+ };
665
+ (function(e) {
666
+ const t = Q;
667
+ e.mul = function(o, r) {
668
+ const n = new Uint8Array(o.length + r.length - 1);
669
+ for (let s = 0; s < o.length; s++)
670
+ for (let c = 0; c < r.length; c++)
671
+ n[s + c] ^= t.mul(o[s], r[c]);
672
+ return n;
673
+ }, e.mod = function(o, r) {
674
+ let n = new Uint8Array(o);
675
+ for (; n.length - r.length >= 0; ) {
676
+ const s = n[0];
677
+ for (let u = 0; u < r.length; u++)
678
+ n[u] ^= t.mul(r[u], s);
679
+ let c = 0;
680
+ for (; c < n.length && n[c] === 0; ) c++;
681
+ n = n.slice(c);
682
+ }
683
+ return n;
684
+ }, e.generateECPolynomial = function(o) {
685
+ let r = new Uint8Array([1]);
686
+ for (let n = 0; n < o; n++)
687
+ r = e.mul(r, new Uint8Array([1, t.exp(n)]));
688
+ return r;
689
+ };
690
+ })(Ct);
691
+ const Et = Ct;
692
+ function st(e) {
693
+ this.genPoly = void 0, this.degree = e, this.degree && this.initialize(this.degree);
694
+ }
695
+ st.prototype.initialize = function(t) {
696
+ this.degree = t, this.genPoly = Et.generateECPolynomial(this.degree);
697
+ };
698
+ st.prototype.encode = function(t) {
699
+ if (!this.genPoly)
700
+ throw new Error("Encoder not initialized");
701
+ const i = new Uint8Array(t.length + this.degree);
702
+ i.set(t);
703
+ const o = Et.mod(i, this.genPoly), r = this.degree - o.length;
704
+ if (r > 0) {
705
+ const n = new Uint8Array(this.degree);
706
+ return n.set(o, r), n;
707
+ }
708
+ return o;
709
+ };
710
+ var Ft = st, Bt = {}, L = {}, ut = {};
711
+ ut.isValid = function(t) {
712
+ return !isNaN(t) && t >= 1 && t <= 40;
713
+ };
714
+ var M = {};
715
+ const pt = "[0-9]+", kt = "[A-Z $%*+\\-./:]+";
716
+ let V = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
717
+ V = V.replace(/u/g, "\\u");
718
+ const vt = "(?:(?![A-Z0-9 $%*+\\-./:]|" + V + `)(?:.|[\r
719
+ ]))+`;
720
+ M.KANJI = new RegExp(V, "g");
721
+ M.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
722
+ M.BYTE = new RegExp(vt, "g");
723
+ M.NUMERIC = new RegExp(pt, "g");
724
+ M.ALPHANUMERIC = new RegExp(kt, "g");
725
+ const zt = new RegExp("^" + V + "$"), Vt = new RegExp("^" + pt + "$"), Ht = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
726
+ M.testKanji = function(t) {
727
+ return zt.test(t);
728
+ };
729
+ M.testNumeric = function(t) {
730
+ return Vt.test(t);
731
+ };
732
+ M.testAlphanumeric = function(t) {
733
+ return Ht.test(t);
734
+ };
735
+ (function(e) {
736
+ const t = ut, i = M;
737
+ e.NUMERIC = {
738
+ id: "Numeric",
739
+ bit: 1,
740
+ ccBits: [10, 12, 14]
741
+ }, e.ALPHANUMERIC = {
742
+ id: "Alphanumeric",
743
+ bit: 2,
744
+ ccBits: [9, 11, 13]
745
+ }, e.BYTE = {
746
+ id: "Byte",
747
+ bit: 4,
748
+ ccBits: [8, 16, 16]
749
+ }, e.KANJI = {
750
+ id: "Kanji",
751
+ bit: 8,
752
+ ccBits: [8, 10, 12]
753
+ }, e.MIXED = {
754
+ bit: -1
755
+ }, e.getCharCountIndicator = function(n, s) {
756
+ if (!n.ccBits) throw new Error("Invalid mode: " + n);
757
+ if (!t.isValid(s))
758
+ throw new Error("Invalid version: " + s);
759
+ return s >= 1 && s < 10 ? n.ccBits[0] : s < 27 ? n.ccBits[1] : n.ccBits[2];
760
+ }, e.getBestModeForData = function(n) {
761
+ return i.testNumeric(n) ? e.NUMERIC : i.testAlphanumeric(n) ? e.ALPHANUMERIC : i.testKanji(n) ? e.KANJI : e.BYTE;
762
+ }, e.toString = function(n) {
763
+ if (n && n.id) return n.id;
764
+ throw new Error("Invalid mode");
765
+ }, e.isValid = function(n) {
766
+ return n && n.bit && n.ccBits;
767
+ };
768
+ function o(r) {
769
+ if (typeof r != "string")
770
+ throw new Error("Param is not a string");
771
+ switch (r.toLowerCase()) {
772
+ case "numeric":
773
+ return e.NUMERIC;
774
+ case "alphanumeric":
775
+ return e.ALPHANUMERIC;
776
+ case "kanji":
777
+ return e.KANJI;
778
+ case "byte":
779
+ return e.BYTE;
780
+ default:
781
+ throw new Error("Unknown mode: " + r);
782
+ }
783
+ }
784
+ e.from = function(n, s) {
785
+ if (e.isValid(n))
786
+ return n;
787
+ try {
788
+ return o(n);
789
+ } catch {
790
+ return s;
791
+ }
792
+ };
793
+ })(L);
794
+ (function(e) {
795
+ const t = I, i = G, o = j, r = L, n = ut, s = 7973, c = t.getBCHDigit(s);
796
+ function u(w, f, m) {
797
+ for (let y = 1; y <= 40; y++)
798
+ if (f <= e.getCapacity(y, m, w))
799
+ return y;
800
+ }
801
+ function a(w, f) {
802
+ return r.getCharCountIndicator(w, f) + 4;
803
+ }
804
+ function l(w, f) {
805
+ let m = 0;
806
+ return w.forEach(function(y) {
807
+ const T = a(y.mode, f);
808
+ m += T + y.getBitsLength();
809
+ }), m;
810
+ }
811
+ function B(w, f) {
812
+ for (let m = 1; m <= 40; m++)
813
+ if (l(w, m) <= e.getCapacity(m, f, r.MIXED))
814
+ return m;
815
+ }
816
+ e.from = function(f, m) {
817
+ return n.isValid(f) ? parseInt(f, 10) : m;
818
+ }, e.getCapacity = function(f, m, y) {
819
+ if (!n.isValid(f))
820
+ throw new Error("Invalid QR Code version");
821
+ typeof y > "u" && (y = r.BYTE);
822
+ const T = t.getSymbolTotalCodewords(f), h = i.getTotalCodewordsCount(f, m), C = (T - h) * 8;
823
+ if (y === r.MIXED) return C;
824
+ const d = C - a(y, f);
825
+ switch (y) {
826
+ case r.NUMERIC:
827
+ return Math.floor(d / 10 * 3);
828
+ case r.ALPHANUMERIC:
829
+ return Math.floor(d / 11 * 2);
830
+ case r.KANJI:
831
+ return Math.floor(d / 13);
832
+ case r.BYTE:
833
+ default:
834
+ return Math.floor(d / 8);
835
+ }
836
+ }, e.getBestVersionForData = function(f, m) {
837
+ let y;
838
+ const T = o.from(m, o.M);
839
+ if (Array.isArray(f)) {
840
+ if (f.length > 1)
841
+ return B(f, T);
842
+ if (f.length === 0)
843
+ return 1;
844
+ y = f[0];
845
+ } else
846
+ y = f;
847
+ return u(y.mode, y.getLength(), T);
848
+ }, e.getEncodedBits = function(f) {
849
+ if (!n.isValid(f) || f < 7)
850
+ throw new Error("Invalid QR Code version");
851
+ let m = f << 12;
852
+ for (; t.getBCHDigit(m) - c >= 0; )
853
+ m ^= s << t.getBCHDigit(m) - c;
854
+ return f << 12 | m;
855
+ };
856
+ })(Bt);
857
+ var At = {};
858
+ const et = I, Tt = 1335, Kt = 21522, ft = et.getBCHDigit(Tt);
859
+ At.getEncodedBits = function(t, i) {
860
+ const o = t.bit << 3 | i;
861
+ let r = o << 10;
862
+ for (; et.getBCHDigit(r) - ft >= 0; )
863
+ r ^= Tt << et.getBCHDigit(r) - ft;
864
+ return (o << 10 | r) ^ Kt;
865
+ };
866
+ var It = {};
867
+ const Jt = L;
868
+ function _(e) {
869
+ this.mode = Jt.NUMERIC, this.data = e.toString();
870
+ }
871
+ _.getBitsLength = function(t) {
872
+ return 10 * Math.floor(t / 3) + (t % 3 ? t % 3 * 3 + 1 : 0);
873
+ };
874
+ _.prototype.getLength = function() {
875
+ return this.data.length;
876
+ };
877
+ _.prototype.getBitsLength = function() {
878
+ return _.getBitsLength(this.data.length);
879
+ };
880
+ _.prototype.write = function(t) {
881
+ let i, o, r;
882
+ for (i = 0; i + 3 <= this.data.length; i += 3)
883
+ o = this.data.substr(i, 3), r = parseInt(o, 10), t.put(r, 10);
884
+ const n = this.data.length - i;
885
+ n > 0 && (o = this.data.substr(i), r = parseInt(o, 10), t.put(r, n * 3 + 1));
886
+ };
887
+ var Ot = _;
888
+ const Yt = L, Z = [
889
+ "0",
890
+ "1",
891
+ "2",
892
+ "3",
893
+ "4",
894
+ "5",
895
+ "6",
896
+ "7",
897
+ "8",
898
+ "9",
899
+ "A",
900
+ "B",
901
+ "C",
902
+ "D",
903
+ "E",
904
+ "F",
905
+ "G",
906
+ "H",
907
+ "I",
908
+ "J",
909
+ "K",
910
+ "L",
911
+ "M",
912
+ "N",
913
+ "O",
914
+ "P",
915
+ "Q",
916
+ "R",
917
+ "S",
918
+ "T",
919
+ "U",
920
+ "V",
921
+ "W",
922
+ "X",
923
+ "Y",
924
+ "Z",
925
+ " ",
926
+ "$",
927
+ "%",
928
+ "*",
929
+ "+",
930
+ "-",
931
+ ".",
932
+ "/",
933
+ ":"
934
+ ];
935
+ function U(e) {
936
+ this.mode = Yt.ALPHANUMERIC, this.data = e;
937
+ }
938
+ U.getBitsLength = function(t) {
939
+ return 11 * Math.floor(t / 2) + 6 * (t % 2);
940
+ };
941
+ U.prototype.getLength = function() {
942
+ return this.data.length;
943
+ };
944
+ U.prototype.getBitsLength = function() {
945
+ return U.getBitsLength(this.data.length);
946
+ };
947
+ U.prototype.write = function(t) {
948
+ let i;
949
+ for (i = 0; i + 2 <= this.data.length; i += 2) {
950
+ let o = Z.indexOf(this.data[i]) * 45;
951
+ o += Z.indexOf(this.data[i + 1]), t.put(o, 11);
952
+ }
953
+ this.data.length % 2 && t.put(Z.indexOf(this.data[i]), 6);
954
+ };
955
+ var jt = U, Gt = function(t) {
956
+ for (var i = [], o = t.length, r = 0; r < o; r++) {
957
+ var n = t.charCodeAt(r);
958
+ if (n >= 55296 && n <= 56319 && o > r + 1) {
959
+ var s = t.charCodeAt(r + 1);
960
+ s >= 56320 && s <= 57343 && (n = (n - 55296) * 1024 + s - 56320 + 65536, r += 1);
961
+ }
962
+ if (n < 128) {
963
+ i.push(n);
964
+ continue;
965
+ }
966
+ if (n < 2048) {
967
+ i.push(n >> 6 | 192), i.push(n & 63 | 128);
968
+ continue;
969
+ }
970
+ if (n < 55296 || n >= 57344 && n < 65536) {
971
+ i.push(n >> 12 | 224), i.push(n >> 6 & 63 | 128), i.push(n & 63 | 128);
972
+ continue;
973
+ }
974
+ if (n >= 65536 && n <= 1114111) {
975
+ i.push(n >> 18 | 240), i.push(n >> 12 & 63 | 128), i.push(n >> 6 & 63 | 128), i.push(n & 63 | 128);
976
+ continue;
977
+ }
978
+ i.push(239, 191, 189);
979
+ }
980
+ return new Uint8Array(i).buffer;
981
+ };
982
+ const Qt = Gt, qt = L;
983
+ function F(e) {
984
+ this.mode = qt.BYTE, typeof e == "string" && (e = Qt(e)), this.data = new Uint8Array(e);
985
+ }
986
+ F.getBitsLength = function(t) {
987
+ return t * 8;
988
+ };
989
+ F.prototype.getLength = function() {
990
+ return this.data.length;
991
+ };
992
+ F.prototype.getBitsLength = function() {
993
+ return F.getBitsLength(this.data.length);
994
+ };
995
+ F.prototype.write = function(e) {
996
+ for (let t = 0, i = this.data.length; t < i; t++)
997
+ e.put(this.data[t], 8);
998
+ };
999
+ var Wt = F;
1000
+ const Zt = L, Xt = I;
1001
+ function k(e) {
1002
+ this.mode = Zt.KANJI, this.data = e;
1003
+ }
1004
+ k.getBitsLength = function(t) {
1005
+ return t * 13;
1006
+ };
1007
+ k.prototype.getLength = function() {
1008
+ return this.data.length;
1009
+ };
1010
+ k.prototype.getBitsLength = function() {
1011
+ return k.getBitsLength(this.data.length);
1012
+ };
1013
+ k.prototype.write = function(e) {
1014
+ let t;
1015
+ for (t = 0; t < this.data.length; t++) {
1016
+ let i = Xt.toSJIS(this.data[t]);
1017
+ if (i >= 33088 && i <= 40956)
1018
+ i -= 33088;
1019
+ else if (i >= 57408 && i <= 60351)
1020
+ i -= 49472;
1021
+ else
1022
+ throw new Error(
1023
+ "Invalid SJIS character: " + this.data[t] + `
1024
+ Make sure your charset is UTF-8`
1025
+ );
1026
+ i = (i >>> 8 & 255) * 192 + (i & 255), e.put(i, 13);
1027
+ }
1028
+ };
1029
+ var xt = k, Nt = { exports: {} };
1030
+ (function(e) {
1031
+ var t = {
1032
+ single_source_shortest_paths: function(i, o, r) {
1033
+ var n = {}, s = {};
1034
+ s[o] = 0;
1035
+ var c = t.PriorityQueue.make();
1036
+ c.push(o, 0);
1037
+ for (var u, a, l, B, w, f, m, y, T; !c.empty(); ) {
1038
+ u = c.pop(), a = u.value, B = u.cost, w = i[a] || {};
1039
+ for (l in w)
1040
+ w.hasOwnProperty(l) && (f = w[l], m = B + f, y = s[l], T = typeof s[l] > "u", (T || y > m) && (s[l] = m, c.push(l, m), n[l] = a));
1041
+ }
1042
+ if (typeof r < "u" && typeof s[r] > "u") {
1043
+ var h = ["Could not find a path from ", o, " to ", r, "."].join("");
1044
+ throw new Error(h);
1045
+ }
1046
+ return n;
1047
+ },
1048
+ extract_shortest_path_from_predecessor_list: function(i, o) {
1049
+ for (var r = [], n = o; n; )
1050
+ r.push(n), i[n], n = i[n];
1051
+ return r.reverse(), r;
1052
+ },
1053
+ find_path: function(i, o, r) {
1054
+ var n = t.single_source_shortest_paths(i, o, r);
1055
+ return t.extract_shortest_path_from_predecessor_list(
1056
+ n,
1057
+ r
1058
+ );
1059
+ },
1060
+ /**
1061
+ * A very naive priority queue implementation.
1062
+ */
1063
+ PriorityQueue: {
1064
+ make: function(i) {
1065
+ var o = t.PriorityQueue, r = {}, n;
1066
+ i = i || {};
1067
+ for (n in o)
1068
+ o.hasOwnProperty(n) && (r[n] = o[n]);
1069
+ return r.queue = [], r.sorter = i.sorter || o.default_sorter, r;
1070
+ },
1071
+ default_sorter: function(i, o) {
1072
+ return i.cost - o.cost;
1073
+ },
1074
+ /**
1075
+ * Add a new item to the queue and ensure the highest priority element
1076
+ * is at the front of the queue.
1077
+ */
1078
+ push: function(i, o) {
1079
+ var r = { value: i, cost: o };
1080
+ this.queue.push(r), this.queue.sort(this.sorter);
1081
+ },
1082
+ /**
1083
+ * Return the highest priority element in the queue.
1084
+ */
1085
+ pop: function() {
1086
+ return this.queue.shift();
1087
+ },
1088
+ empty: function() {
1089
+ return this.queue.length === 0;
1090
+ }
1091
+ }
1092
+ };
1093
+ e.exports = t;
1094
+ })(Nt);
1095
+ var $t = Nt.exports;
1096
+ (function(e) {
1097
+ const t = L, i = Ot, o = jt, r = Wt, n = xt, s = M, c = I, u = $t;
1098
+ function a(h) {
1099
+ return unescape(encodeURIComponent(h)).length;
1100
+ }
1101
+ function l(h, C, d) {
1102
+ const g = [];
1103
+ let E;
1104
+ for (; (E = h.exec(d)) !== null; )
1105
+ g.push({
1106
+ data: E[0],
1107
+ index: E.index,
1108
+ mode: C,
1109
+ length: E[0].length
1110
+ });
1111
+ return g;
1112
+ }
1113
+ function B(h) {
1114
+ const C = l(s.NUMERIC, t.NUMERIC, h), d = l(s.ALPHANUMERIC, t.ALPHANUMERIC, h);
1115
+ let g, E;
1116
+ return c.isKanjiModeEnabled() ? (g = l(s.BYTE, t.BYTE, h), E = l(s.KANJI, t.KANJI, h)) : (g = l(s.BYTE_KANJI, t.BYTE, h), E = []), C.concat(d, g, E).sort(function(A, N) {
1117
+ return A.index - N.index;
1118
+ }).map(function(A) {
1119
+ return {
1120
+ data: A.data,
1121
+ mode: A.mode,
1122
+ length: A.length
1123
+ };
1124
+ });
1125
+ }
1126
+ function w(h, C) {
1127
+ switch (C) {
1128
+ case t.NUMERIC:
1129
+ return i.getBitsLength(h);
1130
+ case t.ALPHANUMERIC:
1131
+ return o.getBitsLength(h);
1132
+ case t.KANJI:
1133
+ return n.getBitsLength(h);
1134
+ case t.BYTE:
1135
+ return r.getBitsLength(h);
1136
+ }
1137
+ }
1138
+ function f(h) {
1139
+ return h.reduce(function(C, d) {
1140
+ const g = C.length - 1 >= 0 ? C[C.length - 1] : null;
1141
+ return g && g.mode === d.mode ? (C[C.length - 1].data += d.data, C) : (C.push(d), C);
1142
+ }, []);
1143
+ }
1144
+ function m(h) {
1145
+ const C = [];
1146
+ for (let d = 0; d < h.length; d++) {
1147
+ const g = h[d];
1148
+ switch (g.mode) {
1149
+ case t.NUMERIC:
1150
+ C.push([
1151
+ g,
1152
+ { data: g.data, mode: t.ALPHANUMERIC, length: g.length },
1153
+ { data: g.data, mode: t.BYTE, length: g.length }
1154
+ ]);
1155
+ break;
1156
+ case t.ALPHANUMERIC:
1157
+ C.push([
1158
+ g,
1159
+ { data: g.data, mode: t.BYTE, length: g.length }
1160
+ ]);
1161
+ break;
1162
+ case t.KANJI:
1163
+ C.push([
1164
+ g,
1165
+ { data: g.data, mode: t.BYTE, length: a(g.data) }
1166
+ ]);
1167
+ break;
1168
+ case t.BYTE:
1169
+ C.push([
1170
+ { data: g.data, mode: t.BYTE, length: a(g.data) }
1171
+ ]);
1172
+ }
1173
+ }
1174
+ return C;
1175
+ }
1176
+ function y(h, C) {
1177
+ const d = {}, g = { start: {} };
1178
+ let E = ["start"];
1179
+ for (let p = 0; p < h.length; p++) {
1180
+ const A = h[p], N = [];
1181
+ for (let S = 0; S < A.length; S++) {
1182
+ const b = A[S], v = "" + p + S;
1183
+ N.push(v), d[v] = { node: b, lastCount: 0 }, g[v] = {};
1184
+ for (let W = 0; W < E.length; W++) {
1185
+ const P = E[W];
1186
+ d[P] && d[P].node.mode === b.mode ? (g[P][v] = w(d[P].lastCount + b.length, b.mode) - w(d[P].lastCount, b.mode), d[P].lastCount += b.length) : (d[P] && (d[P].lastCount = b.length), g[P][v] = w(b.length, b.mode) + 4 + t.getCharCountIndicator(b.mode, C));
1187
+ }
1188
+ }
1189
+ E = N;
1190
+ }
1191
+ for (let p = 0; p < E.length; p++)
1192
+ g[E[p]].end = 0;
1193
+ return { map: g, table: d };
1194
+ }
1195
+ function T(h, C) {
1196
+ let d;
1197
+ const g = t.getBestModeForData(h);
1198
+ if (d = t.from(C, g), d !== t.BYTE && d.bit < g.bit)
1199
+ throw new Error('"' + h + '" cannot be encoded with mode ' + t.toString(d) + `.
1200
+ Suggested mode is: ` + t.toString(g));
1201
+ switch (d === t.KANJI && !c.isKanjiModeEnabled() && (d = t.BYTE), d) {
1202
+ case t.NUMERIC:
1203
+ return new i(h);
1204
+ case t.ALPHANUMERIC:
1205
+ return new o(h);
1206
+ case t.KANJI:
1207
+ return new n(h);
1208
+ case t.BYTE:
1209
+ return new r(h);
1210
+ }
1211
+ }
1212
+ e.fromArray = function(C) {
1213
+ return C.reduce(function(d, g) {
1214
+ return typeof g == "string" ? d.push(T(g, null)) : g.data && d.push(T(g.data, g.mode)), d;
1215
+ }, []);
1216
+ }, e.fromString = function(C, d) {
1217
+ const g = B(C, c.isKanjiModeEnabled()), E = m(g), p = y(E, d), A = u.find_path(p.map, "start", "end"), N = [];
1218
+ for (let S = 1; S < A.length - 1; S++)
1219
+ N.push(p.table[A[S]].node);
1220
+ return e.fromArray(f(N));
1221
+ }, e.rawSplit = function(C) {
1222
+ return e.fromArray(
1223
+ B(C, c.isKanjiModeEnabled())
1224
+ );
1225
+ };
1226
+ })(It);
1227
+ const q = I, X = j, te = Dt, ee = _t, ne = wt, re = mt, nt = yt, rt = G, oe = Ft, Y = Bt, ie = At, se = L, x = It;
1228
+ function ue(e, t) {
1229
+ const i = e.size, o = re.getPositions(t);
1230
+ for (let r = 0; r < o.length; r++) {
1231
+ const n = o[r][0], s = o[r][1];
1232
+ for (let c = -1; c <= 7; c++)
1233
+ if (!(n + c <= -1 || i <= n + c))
1234
+ for (let u = -1; u <= 7; u++)
1235
+ s + u <= -1 || i <= s + u || (c >= 0 && c <= 6 && (u === 0 || u === 6) || u >= 0 && u <= 6 && (c === 0 || c === 6) || c >= 2 && c <= 4 && u >= 2 && u <= 4 ? e.set(n + c, s + u, !0, !0) : e.set(n + c, s + u, !1, !0));
1236
+ }
1237
+ }
1238
+ function ce(e) {
1239
+ const t = e.size;
1240
+ for (let i = 8; i < t - 8; i++) {
1241
+ const o = i % 2 === 0;
1242
+ e.set(i, 6, o, !0), e.set(6, i, o, !0);
1243
+ }
1244
+ }
1245
+ function ae(e, t) {
1246
+ const i = ne.getPositions(t);
1247
+ for (let o = 0; o < i.length; o++) {
1248
+ const r = i[o][0], n = i[o][1];
1249
+ for (let s = -2; s <= 2; s++)
1250
+ for (let c = -2; c <= 2; c++)
1251
+ s === -2 || s === 2 || c === -2 || c === 2 || s === 0 && c === 0 ? e.set(r + s, n + c, !0, !0) : e.set(r + s, n + c, !1, !0);
1252
+ }
1253
+ }
1254
+ function le(e, t) {
1255
+ const i = e.size, o = Y.getEncodedBits(t);
1256
+ let r, n, s;
1257
+ for (let c = 0; c < 18; c++)
1258
+ r = Math.floor(c / 3), n = c % 3 + i - 8 - 3, s = (o >> c & 1) === 1, e.set(r, n, s, !0), e.set(n, r, s, !0);
1259
+ }
1260
+ function $(e, t, i) {
1261
+ const o = e.size, r = ie.getEncodedBits(t, i);
1262
+ let n, s;
1263
+ for (n = 0; n < 15; n++)
1264
+ s = (r >> n & 1) === 1, n < 6 ? e.set(n, 8, s, !0) : n < 8 ? e.set(n + 1, 8, s, !0) : e.set(o - 15 + n, 8, s, !0), n < 8 ? e.set(8, o - n - 1, s, !0) : n < 9 ? e.set(8, 15 - n - 1 + 1, s, !0) : e.set(8, 15 - n - 1, s, !0);
1265
+ e.set(o - 8, 8, 1, !0);
1266
+ }
1267
+ function fe(e, t) {
1268
+ const i = e.size;
1269
+ let o = -1, r = i - 1, n = 7, s = 0;
1270
+ for (let c = i - 1; c > 0; c -= 2)
1271
+ for (c === 6 && c--; ; ) {
1272
+ for (let u = 0; u < 2; u++)
1273
+ if (!e.isReserved(r, c - u)) {
1274
+ let a = !1;
1275
+ s < t.length && (a = (t[s] >>> n & 1) === 1), e.set(r, c - u, a), n--, n === -1 && (s++, n = 7);
1276
+ }
1277
+ if (r += o, r < 0 || i <= r) {
1278
+ r -= o, o = -o;
1279
+ break;
1280
+ }
1281
+ }
1282
+ }
1283
+ function ge(e, t, i) {
1284
+ const o = new te();
1285
+ i.forEach(function(u) {
1286
+ o.put(u.mode.bit, 4), o.put(u.getLength(), se.getCharCountIndicator(u.mode, e)), u.write(o);
1287
+ });
1288
+ const r = q.getSymbolTotalCodewords(e), n = rt.getTotalCodewordsCount(e, t), s = (r - n) * 8;
1289
+ for (o.getLengthInBits() + 4 <= s && o.put(0, 4); o.getLengthInBits() % 8 !== 0; )
1290
+ o.putBit(0);
1291
+ const c = (s - o.getLengthInBits()) / 8;
1292
+ for (let u = 0; u < c; u++)
1293
+ o.put(u % 2 ? 17 : 236, 8);
1294
+ return de(o, e, t);
1295
+ }
1296
+ function de(e, t, i) {
1297
+ const o = q.getSymbolTotalCodewords(t), r = rt.getTotalCodewordsCount(t, i), n = o - r, s = rt.getBlocksCount(t, i), c = o % s, u = s - c, a = Math.floor(o / s), l = Math.floor(n / s), B = l + 1, w = a - l, f = new oe(w);
1298
+ let m = 0;
1299
+ const y = new Array(s), T = new Array(s);
1300
+ let h = 0;
1301
+ const C = new Uint8Array(e.buffer);
1302
+ for (let A = 0; A < s; A++) {
1303
+ const N = A < u ? l : B;
1304
+ y[A] = C.slice(m, m + N), T[A] = f.encode(y[A]), m += N, h = Math.max(h, N);
1305
+ }
1306
+ const d = new Uint8Array(o);
1307
+ let g = 0, E, p;
1308
+ for (E = 0; E < h; E++)
1309
+ for (p = 0; p < s; p++)
1310
+ E < y[p].length && (d[g++] = y[p][E]);
1311
+ for (E = 0; E < w; E++)
1312
+ for (p = 0; p < s; p++)
1313
+ d[g++] = T[p][E];
1314
+ return d;
1315
+ }
1316
+ function he(e, t, i, o) {
1317
+ let r;
1318
+ if (Array.isArray(e))
1319
+ r = x.fromArray(e);
1320
+ else if (typeof e == "string") {
1321
+ let a = t;
1322
+ if (!a) {
1323
+ const l = x.rawSplit(e);
1324
+ a = Y.getBestVersionForData(l, i);
1325
+ }
1326
+ r = x.fromString(e, a || 40);
1327
+ } else
1328
+ throw new Error("Invalid data");
1329
+ const n = Y.getBestVersionForData(r, i);
1330
+ if (!n)
1331
+ throw new Error("The amount of data is too big to be stored in a QR Code");
1332
+ if (!t)
1333
+ t = n;
1334
+ else if (t < n)
1335
+ throw new Error(
1336
+ `
1337
+ The chosen QR Code version cannot contain this amount of data.
1338
+ Minimum version required to store current data is: ` + n + `.
1339
+ `
1340
+ );
1341
+ const s = ge(t, i, r), c = q.getSymbolSize(t), u = new ee(c);
1342
+ return ue(u, t), ce(u), ae(u, t), $(u, i, 0), t >= 7 && le(u, t), fe(u, s), isNaN(o) && (o = nt.getBestMask(
1343
+ u,
1344
+ $.bind(null, u, i)
1345
+ )), nt.applyMask(o, u), $(u, i, o), {
1346
+ modules: u,
1347
+ version: t,
1348
+ errorCorrectionLevel: i,
1349
+ maskPattern: o,
1350
+ segments: r
1351
+ };
1352
+ }
1353
+ dt.create = function(t, i) {
1354
+ if (typeof t > "u" || t === "")
1355
+ throw new Error("No input text");
1356
+ let o = X.M, r, n;
1357
+ return typeof i < "u" && (o = X.from(i.errorCorrectionLevel, X.M), r = Y.from(i.version), n = nt.from(i.maskPattern), i.toSJISFunc && q.setToSJISFunction(i.toSJISFunc)), he(t, r, o, n);
1358
+ };
1359
+ var bt = {}, ct = {};
1360
+ (function(e) {
1361
+ function t(i) {
1362
+ if (typeof i == "number" && (i = i.toString()), typeof i != "string")
1363
+ throw new Error("Color should be defined as hex string");
1364
+ let o = i.slice().replace("#", "").split("");
1365
+ if (o.length < 3 || o.length === 5 || o.length > 8)
1366
+ throw new Error("Invalid hex color: " + i);
1367
+ (o.length === 3 || o.length === 4) && (o = Array.prototype.concat.apply([], o.map(function(n) {
1368
+ return [n, n];
1369
+ }))), o.length === 6 && o.push("F", "F");
1370
+ const r = parseInt(o.join(""), 16);
1371
+ return {
1372
+ r: r >> 24 & 255,
1373
+ g: r >> 16 & 255,
1374
+ b: r >> 8 & 255,
1375
+ a: r & 255,
1376
+ hex: "#" + o.slice(0, 6).join("")
1377
+ };
1378
+ }
1379
+ e.getOptions = function(o) {
1380
+ o || (o = {}), o.color || (o.color = {});
1381
+ const r = typeof o.margin > "u" || o.margin === null || o.margin < 0 ? 4 : o.margin, n = o.width && o.width >= 21 ? o.width : void 0, s = o.scale || 4;
1382
+ return {
1383
+ width: n,
1384
+ scale: n ? 4 : s,
1385
+ margin: r,
1386
+ color: {
1387
+ dark: t(o.color.dark || "#000000ff"),
1388
+ light: t(o.color.light || "#ffffffff")
1389
+ },
1390
+ type: o.type,
1391
+ rendererOpts: o.rendererOpts || {}
1392
+ };
1393
+ }, e.getScale = function(o, r) {
1394
+ return r.width && r.width >= o + r.margin * 2 ? r.width / (o + r.margin * 2) : r.scale;
1395
+ }, e.getImageWidth = function(o, r) {
1396
+ const n = e.getScale(o, r);
1397
+ return Math.floor((o + r.margin * 2) * n);
1398
+ }, e.qrToImageData = function(o, r, n) {
1399
+ const s = r.modules.size, c = r.modules.data, u = e.getScale(s, n), a = Math.floor((s + n.margin * 2) * u), l = n.margin * u, B = [n.color.light, n.color.dark];
1400
+ for (let w = 0; w < a; w++)
1401
+ for (let f = 0; f < a; f++) {
1402
+ let m = (w * a + f) * 4, y = n.color.light;
1403
+ if (w >= l && f >= l && w < a - l && f < a - l) {
1404
+ const T = Math.floor((w - l) / u), h = Math.floor((f - l) / u);
1405
+ y = B[c[T * s + h] ? 1 : 0];
1406
+ }
1407
+ o[m++] = y.r, o[m++] = y.g, o[m++] = y.b, o[m] = y.a;
1408
+ }
1409
+ };
1410
+ })(ct);
1411
+ (function(e) {
1412
+ const t = ct;
1413
+ function i(r, n, s) {
1414
+ r.clearRect(0, 0, n.width, n.height), n.style || (n.style = {}), n.height = s, n.width = s, n.style.height = s + "px", n.style.width = s + "px";
1415
+ }
1416
+ function o() {
1417
+ try {
1418
+ return document.createElement("canvas");
1419
+ } catch {
1420
+ throw new Error("You need to specify a canvas element");
1421
+ }
1422
+ }
1423
+ e.render = function(n, s, c) {
1424
+ let u = c, a = s;
1425
+ typeof u > "u" && (!s || !s.getContext) && (u = s, s = void 0), s || (a = o()), u = t.getOptions(u);
1426
+ const l = t.getImageWidth(n.modules.size, u), B = a.getContext("2d"), w = B.createImageData(l, l);
1427
+ return t.qrToImageData(w.data, n, u), i(B, a, l), B.putImageData(w, 0, 0), a;
1428
+ }, e.renderToDataURL = function(n, s, c) {
1429
+ let u = c;
1430
+ typeof u > "u" && (!s || !s.getContext) && (u = s, s = void 0), u || (u = {});
1431
+ const a = e.render(n, s, u), l = u.type || "image/png", B = u.rendererOpts || {};
1432
+ return a.toDataURL(l, B.quality);
1433
+ };
1434
+ })(bt);
1435
+ var Mt = {};
1436
+ const we = ct;
1437
+ function gt(e, t) {
1438
+ const i = e.a / 255, o = t + '="' + e.hex + '"';
1439
+ return i < 1 ? o + " " + t + '-opacity="' + i.toFixed(2).slice(1) + '"' : o;
1440
+ }
1441
+ function tt(e, t, i) {
1442
+ let o = e + t;
1443
+ return typeof i < "u" && (o += " " + i), o;
1444
+ }
1445
+ function me(e, t, i) {
1446
+ let o = "", r = 0, n = !1, s = 0;
1447
+ for (let c = 0; c < e.length; c++) {
1448
+ const u = Math.floor(c % t), a = Math.floor(c / t);
1449
+ !u && !n && (n = !0), e[c] ? (s++, c > 0 && u > 0 && e[c - 1] || (o += n ? tt("M", u + i, 0.5 + a + i) : tt("m", r, 0), r = 0, n = !1), u + 1 < t && e[c + 1] || (o += tt("h", s), s = 0)) : r++;
1450
+ }
1451
+ return o;
1452
+ }
1453
+ Mt.render = function(t, i, o) {
1454
+ const r = we.getOptions(i), n = t.modules.size, s = t.modules.data, c = n + r.margin * 2, u = r.color.light.a ? "<path " + gt(r.color.light, "fill") + ' d="M0 0h' + c + "v" + c + 'H0z"/>' : "", a = "<path " + gt(r.color.dark, "stroke") + ' d="' + me(s, n, r.margin) + '"/>', l = 'viewBox="0 0 ' + c + " " + c + '"', w = '<svg xmlns="http://www.w3.org/2000/svg" ' + (r.width ? 'width="' + r.width + '" height="' + r.width + '" ' : "") + l + ' shape-rendering="crispEdges">' + u + a + `</svg>
1455
+ `;
1456
+ return typeof o == "function" && o(null, w), w;
1457
+ };
1458
+ const ye = Rt, ot = dt, Pt = bt, Ce = Mt;
1459
+ function at(e, t, i, o, r) {
1460
+ const n = [].slice.call(arguments, 1), s = n.length, c = typeof n[s - 1] == "function";
1461
+ if (!c && !ye())
1462
+ throw new Error("Callback required as last argument");
1463
+ if (c) {
1464
+ if (s < 2)
1465
+ throw new Error("Too few arguments provided");
1466
+ s === 2 ? (r = i, i = t, t = o = void 0) : s === 3 && (t.getContext && typeof r > "u" ? (r = o, o = void 0) : (r = o, o = i, i = t, t = void 0));
1467
+ } else {
1468
+ if (s < 1)
1469
+ throw new Error("Too few arguments provided");
1470
+ return s === 1 ? (i = t, t = o = void 0) : s === 2 && !t.getContext && (o = i, i = t, t = void 0), new Promise(function(u, a) {
1471
+ try {
1472
+ const l = ot.create(i, o);
1473
+ u(e(l, t, o));
1474
+ } catch (l) {
1475
+ a(l);
1476
+ }
1477
+ });
1478
+ }
1479
+ try {
1480
+ const u = ot.create(i, o);
1481
+ r(null, e(u, t, o));
1482
+ } catch (u) {
1483
+ r(u);
1484
+ }
1485
+ }
1486
+ var Ee = D.create = ot.create, Be = D.toCanvas = at.bind(null, Pt.render), pe = D.toDataURL = at.bind(null, Pt.renderToDataURL), Ae = D.toString = at.bind(null, function(e, t, i) {
1487
+ return Ce.render(e, i);
1488
+ });
1489
+ const Te = /* @__PURE__ */ St({
1490
+ __proto__: null,
1491
+ create: Ee,
1492
+ default: D,
1493
+ toCanvas: Be,
1494
+ toDataURL: pe,
1495
+ toString: Ae
1496
+ }, [D]);
1497
+ export {
1498
+ Te as b
1499
+ };
1500
+ //# sourceMappingURL=browser-DluKPU6C.js.map