@lglab/react-qr-code 1.3.4 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.es.js +847 -829
  2. package/package.json +4 -4
package/dist/index.es.js CHANGED
@@ -1,40 +1,237 @@
1
- import { jsx as w, jsxs as K, Fragment as st } from "react/jsx-runtime";
2
- import { useMemo as L, useCallback as it, useRef as at, useImperativeHandle as ct } from "react";
1
+ import { jsx as C, jsxs as K, Fragment as st } from "react/jsx-runtime";
2
+ import { useMemo as v, useCallback as it, useId as at, useRef as ct, useImperativeHandle as lt } from "react";
3
+ const ht = /\.?0+$/;
4
+ function ut(o) {
5
+ return o.toFixed(7).replace(ht, "");
6
+ }
7
+ const W = (o) => {
8
+ const a = o % 360 * (Math.PI / 180), c = Math.max(0, Math.min(100, 50 - 50 * Math.cos(a))), i = Math.max(0, Math.min(100, 50 - 50 * Math.sin(a))), r = Math.max(0, Math.min(100, 50 + 50 * Math.cos(a))), u = Math.max(0, Math.min(100, 50 + 50 * Math.sin(a)));
9
+ return {
10
+ x1: `${c}%`,
11
+ y1: `${i}%`,
12
+ x2: `${r}%`,
13
+ y2: `${u}%`
14
+ };
15
+ }, J = (o, a, c, i) => {
16
+ const r = c / 2, u = r / 2, l = Math.PI / i;
17
+ let p = "";
18
+ for (let f = 0; f < 2 * i; f++) {
19
+ const e = f * l - Math.PI / 2, n = f % 2 === 0 ? r : u, t = o + n * Math.cos(e), s = a + n * Math.sin(e);
20
+ p += `${f === 0 ? "M" : "L"} ${t},${s} `;
21
+ }
22
+ return p + "Z";
23
+ }, tt = (o, a, c, i) => `M ${o} ${a}Q ${o + i} ${a + c / 2}, ${o} ${a + c}Q ${o + c / 2} ${a + c - i}, ${o + c} ${a + c}Q ${o + c - i} ${a + c / 2}, ${o + c} ${a}Q ${o + c / 2} ${a + i}, ${o} ${a}Z`, et = (o, a, c) => {
24
+ const i = c / 8;
25
+ return `M ${o + c} ${a + i * 3}
26
+ V ${a + i}
27
+ h -${i}
28
+ V ${a}
29
+ H ${o + i * 5}
30
+ v ${i}
31
+ H ${o + i * 3}
32
+ V ${a}
33
+ H ${o + i}
34
+ v ${i}
35
+ H ${o}
36
+ v ${i * 2}
37
+ h ${i}
38
+ v ${i * 2}
39
+ H ${o}
40
+ v ${i * 2}
41
+ h ${i}
42
+ v ${i}
43
+ h ${i * 2}
44
+ v -${i}
45
+ h ${i * 2}
46
+ v ${i}
47
+ h ${i * 2}
48
+ v -${i}
49
+ h ${i}
50
+ V ${a + i * 5}
51
+ h -${i}
52
+ V ${a + i * 3}
53
+ h ${i}
54
+ Z`;
55
+ }, ot = (o, a, c) => {
56
+ let i = !1, r = 0;
57
+ return [
58
+ "M",
59
+ 1,
60
+ 0.3262506,
61
+ "c",
62
+ 0,
63
+ 0.0383376,
64
+ -64626e-7,
65
+ 0.0758377,
66
+ -0.0193751,
67
+ 0.1125001,
68
+ "s",
69
+ -0.0356247,
70
+ 0.076875,
71
+ -0.0681248,
72
+ 0.1206252,
73
+ "c",
74
+ -0.0325,
75
+ 0.0437499,
76
+ -0.0762503,
77
+ 0.0931247,
78
+ -0.1312501,
79
+ 0.1481249,
80
+ "C",
81
+ 0.7262502,
82
+ 0.7625008,
83
+ 0.6566626,
84
+ 0.8279132,
85
+ 0.5724999,
86
+ 0.9037505,
87
+ "L",
88
+ 0.5,
89
+ 0.9687506,
90
+ "L",
91
+ 0.4275001,
92
+ 0.9037505,
93
+ "C",
94
+ 0.3433374,
95
+ 0.8279132,
96
+ 0.2737499,
97
+ 0.7625005,
98
+ 0.21875,
99
+ 0.7075007,
100
+ "C",
101
+ 0.1637501,
102
+ 0.6525008,
103
+ 0.1199999,
104
+ 0.6031258,
105
+ 0.0874999,
106
+ 0.5593758,
107
+ "S",
108
+ 0.0322876,
109
+ 0.4754133,
110
+ 0.0193751,
111
+ 0.4387506,
112
+ "S",
113
+ 0,
114
+ 0.3645881,
115
+ 0,
116
+ 0.3262506,
117
+ "c",
118
+ 0,
119
+ -0.0783374,
120
+ 0.0262499,
121
+ -0.1437498,
122
+ 0.07875,
123
+ -0.1962499,
124
+ "s",
125
+ 0.1179124,
126
+ -0.07875,
127
+ 0.1962499,
128
+ -0.07875,
129
+ "c",
130
+ 0.0433376,
131
+ 0,
132
+ 0.0845875,
133
+ 91625e-7,
134
+ 0.12375,
135
+ 0.0274999,
136
+ "S",
137
+ 0.4716623,
138
+ 0.1229131,
139
+ 0.5,
140
+ 0.1562506,
141
+ "c",
142
+ 0.0283374,
143
+ -0.0333375,
144
+ 0.0620874,
145
+ -0.0591625,
146
+ 0.1012502,
147
+ -0.0775,
148
+ "c",
149
+ 0.0391627,
150
+ -0.0183375,
151
+ 0.0804126,
152
+ -0.0274999,
153
+ 0.12375,
154
+ -0.0274999,
155
+ "c",
156
+ 0.0783374,
157
+ 0,
158
+ 0.1437497,
159
+ 0.0262499,
160
+ 0.1962501,
161
+ 0.07875,
162
+ "S",
163
+ 1,
164
+ 0.2479131,
165
+ 1,
166
+ 0.3262506,
167
+ "z"
168
+ ].map((u) => typeof u == "string" ? (r = 0, i = u.toUpperCase() == u, u) : (r++, u = u * c, i && (u += r % 2 == 1 ? o : a), ut(u))).join(" ");
169
+ }, Q = {
170
+ "data-testid": "background"
171
+ }, dt = ({ background: o, bgGradientId: a, numCells: c }) => {
172
+ var r, u;
173
+ if (!o)
174
+ return null;
175
+ if (typeof o == "string")
176
+ return /* @__PURE__ */ C("path", { fill: o, d: `M0,0 h${c}v${c}H0z`, ...Q });
177
+ const i = W((o == null ? void 0 : o.rotation) || 0);
178
+ return /* @__PURE__ */ K(st, { children: [
179
+ /* @__PURE__ */ C("defs", { children: o.type === "linear" ? /* @__PURE__ */ C("linearGradient", { id: a, gradientUnits: "userSpaceOnUse", ...i, children: (r = o.stops) == null ? void 0 : r.map((l, p) => /* @__PURE__ */ C("stop", { offset: l.offset, stopColor: l.color }, p)) }) : /* @__PURE__ */ C(
180
+ "radialGradient",
181
+ {
182
+ id: a,
183
+ gradientUnits: "userSpaceOnUse",
184
+ cx: "50%",
185
+ cy: "50%",
186
+ r: "50%",
187
+ children: (u = o.stops) == null ? void 0 : u.map((l, p) => /* @__PURE__ */ C("stop", { offset: l.offset, stopColor: l.color }, p))
188
+ }
189
+ ) }),
190
+ /* @__PURE__ */ C(
191
+ "path",
192
+ {
193
+ fill: `url(#${a})`,
194
+ d: `M0,0 h${c}v${c}H0z`,
195
+ ...Q
196
+ }
197
+ )
198
+ ] });
199
+ };
3
200
  /**
4
201
  * @license QR Code generator library (TypeScript)
5
202
  * Copyright (c) Project Nayuki.
6
203
  * SPDX-License-Identifier: MIT
7
204
  */
8
- var v;
9
- ((r) => {
10
- const d = class d {
205
+ var S;
206
+ ((o) => {
207
+ const l = class l {
11
208
  /*-- Constructor (low level) and fields --*/
12
209
  // Creates a new QR Code with the given version number,
13
210
  // error correction level, data codeword bytes, and mask number.
14
211
  // This is a low-level API that most users should not use directly.
15
212
  // A mid-level API is the encodeSegments() function.
16
- constructor(o, t, e, c) {
17
- if (this.version = o, this.errorCorrectionLevel = t, this.modules = [], this.isFunction = [], o < d.MIN_VERSION || o > d.MAX_VERSION)
213
+ constructor(e, n, t, s) {
214
+ if (this.version = e, this.errorCorrectionLevel = n, this.modules = [], this.isFunction = [], e < l.MIN_VERSION || e > l.MAX_VERSION)
18
215
  throw new RangeError("Version value out of range");
19
- if (c < -1 || c > 7)
216
+ if (s < -1 || s > 7)
20
217
  throw new RangeError("Mask value out of range");
21
- this.size = o * 4 + 17;
218
+ this.size = e * 4 + 17;
22
219
  let h = [];
23
- for (let $ = 0; $ < this.size; $++)
220
+ for (let d = 0; d < this.size; d++)
24
221
  h.push(!1);
25
- for (let $ = 0; $ < this.size; $++)
222
+ for (let d = 0; d < this.size; d++)
26
223
  this.modules.push(h.slice()), this.isFunction.push(h.slice());
27
224
  this.drawFunctionPatterns();
28
- const f = this.addEccAndInterleave(e);
29
- if (this.drawCodewords(f), c == -1) {
30
- let $ = 1e9;
31
- for (let p = 0; p < 8; p++) {
32
- this.applyMask(p), this.drawFormatBits(p);
33
- const M = this.getPenaltyScore();
34
- M < $ && (c = p, $ = M), this.applyMask(p);
225
+ const $ = this.addEccAndInterleave(t);
226
+ if (this.drawCodewords($), s == -1) {
227
+ let d = 1e9;
228
+ for (let R = 0; R < 8; R++) {
229
+ this.applyMask(R), this.drawFormatBits(R);
230
+ const E = this.getPenaltyScore();
231
+ E < d && (s = R, d = E), this.applyMask(R);
35
232
  }
36
233
  }
37
- n(0 <= c && c <= 7), this.mask = c, this.applyMask(c), this.drawFormatBits(c), this.isFunction = [];
234
+ r(0 <= s && s <= 7), this.mask = s, this.applyMask(s), this.drawFormatBits(s), this.isFunction = [];
38
235
  }
39
236
  /*-- Static factory functions (high level) --*/
40
237
  // Returns a QR Code representing the given Unicode text string at the given error correction level.
@@ -42,17 +239,17 @@ var v;
42
239
  // Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
43
240
  // QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
44
241
  // ecl argument if it can be done without increasing the version.
45
- static encodeText(o, t) {
46
- const e = r.QrSegment.makeSegments(o);
47
- return d.encodeSegments(e, t);
242
+ static encodeText(e, n) {
243
+ const t = o.QrSegment.makeSegments(e);
244
+ return l.encodeSegments(t, n);
48
245
  }
49
246
  // Returns a QR Code representing the given binary data at the given error correction level.
50
247
  // This function always encodes using the binary segment mode, not any text mode. The maximum number of
51
248
  // bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
52
249
  // The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
53
- static encodeBinary(o, t) {
54
- const e = r.QrSegment.makeBytes(o);
55
- return d.encodeSegments([e], t);
250
+ static encodeBinary(e, n) {
251
+ const t = o.QrSegment.makeBytes(e);
252
+ return l.encodeSegments([t], n);
56
253
  }
57
254
  /*-- Static factory functions (mid level) --*/
58
255
  // Returns a QR Code representing the given segments with the given encoding parameters.
@@ -64,43 +261,43 @@ var v;
64
261
  // This function allows the user to create a custom sequence of segments that switches
65
262
  // between modes (such as alphanumeric and byte) to encode text in less space.
66
263
  // This is a mid-level API; the high-level API is encodeText() and encodeBinary().
67
- static encodeSegments(o, t, e = 1, c = 40, h = -1, f = !0) {
68
- if (!(d.MIN_VERSION <= e && e <= c && c <= d.MAX_VERSION) || h < -1 || h > 7)
264
+ static encodeSegments(e, n, t = 1, s = 40, h = -1, $ = !0) {
265
+ if (!(l.MIN_VERSION <= t && t <= s && s <= l.MAX_VERSION) || h < -1 || h > 7)
69
266
  throw new RangeError("Invalid value");
70
- let $, p;
71
- for ($ = e; ; $++) {
72
- const R = d.getNumDataCodewords($, t) * 8, I = l.getTotalBits(o, $);
73
- if (I <= R) {
74
- p = I;
267
+ let d, R;
268
+ for (d = t; ; d++) {
269
+ const m = l.getNumDataCodewords(d, n) * 8, g = u.getTotalBits(e, d);
270
+ if (g <= m) {
271
+ R = g;
75
272
  break;
76
273
  }
77
- if ($ >= c)
274
+ if (d >= s)
78
275
  throw new RangeError("Data too long");
79
276
  }
80
- for (const R of [d.Ecc.MEDIUM, d.Ecc.QUARTILE, d.Ecc.HIGH])
81
- f && p <= d.getNumDataCodewords($, R) * 8 && (t = R);
82
- let M = [];
83
- for (const R of o) {
84
- a(R.mode.modeBits, 4, M), a(R.numChars, R.mode.numCharCountBits($), M);
85
- for (const I of R.getData())
86
- M.push(I);
277
+ for (const m of [l.Ecc.MEDIUM, l.Ecc.QUARTILE, l.Ecc.HIGH])
278
+ $ && R <= l.getNumDataCodewords(d, m) * 8 && (n = m);
279
+ let E = [];
280
+ for (const m of e) {
281
+ c(m.mode.modeBits, 4, E), c(m.numChars, m.mode.numCharCountBits(d), E);
282
+ for (const g of m.getData())
283
+ E.push(g);
87
284
  }
88
- n(M.length == p);
89
- const E = d.getNumDataCodewords($, t) * 8;
90
- n(M.length <= E), a(0, Math.min(4, E - M.length), M), a(0, (8 - M.length % 8) % 8, M), n(M.length % 8 == 0);
91
- for (let R = 236; M.length < E; R ^= 253)
92
- a(R, 8, M);
93
- let m = [];
94
- for (; m.length * 8 < M.length; )
95
- m.push(0);
96
- return M.forEach((R, I) => m[I >>> 3] |= R << 7 - (I & 7)), new d($, t, m, h);
285
+ r(E.length == R);
286
+ const A = l.getNumDataCodewords(d, n) * 8;
287
+ r(E.length <= A), c(0, Math.min(4, A - E.length), E), c(0, (8 - E.length % 8) % 8, E), r(E.length % 8 == 0);
288
+ for (let m = 236; E.length < A; m ^= 253)
289
+ c(m, 8, E);
290
+ let M = [];
291
+ for (; M.length * 8 < E.length; )
292
+ M.push(0);
293
+ return E.forEach((m, g) => M[g >>> 3] |= m << 7 - (g & 7)), new l(d, n, M, h);
97
294
  }
98
295
  /*-- Accessor methods --*/
99
296
  // Returns the color of the module (pixel) at the given coordinates, which is false
100
297
  // for light or true for dark. The top left corner has the coordinates (x=0, y=0).
101
298
  // If the given coordinates are out of bounds, then false (light) is returned.
102
- getModule(o, t) {
103
- return 0 <= o && o < this.size && 0 <= t && t < this.size && this.modules[t][o];
299
+ getModule(e, n) {
300
+ return 0 <= e && e < this.size && 0 <= n && n < this.size && this.modules[n][e];
104
301
  }
105
302
  // Modified to expose modules for easy access
106
303
  getModules() {
@@ -109,33 +306,33 @@ var v;
109
306
  /*-- Private helper methods for constructor: Drawing function modules --*/
110
307
  // Reads this object's version field, and draws and marks all function modules.
111
308
  drawFunctionPatterns() {
112
- for (let e = 0; e < this.size; e++)
113
- this.setFunctionModule(6, e, e % 2 == 0), this.setFunctionModule(e, 6, e % 2 == 0);
309
+ for (let t = 0; t < this.size; t++)
310
+ this.setFunctionModule(6, t, t % 2 == 0), this.setFunctionModule(t, 6, t % 2 == 0);
114
311
  this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
115
- const o = this.getAlignmentPatternPositions(), t = o.length;
116
- for (let e = 0; e < t; e++)
117
- for (let c = 0; c < t; c++)
118
- e == 0 && c == 0 || e == 0 && c == t - 1 || e == t - 1 && c == 0 || this.drawAlignmentPattern(o[e], o[c]);
312
+ const e = this.getAlignmentPatternPositions(), n = e.length;
313
+ for (let t = 0; t < n; t++)
314
+ for (let s = 0; s < n; s++)
315
+ t == 0 && s == 0 || t == 0 && s == n - 1 || t == n - 1 && s == 0 || this.drawAlignmentPattern(e[t], e[s]);
119
316
  this.drawFormatBits(0), this.drawVersion();
120
317
  }
121
318
  // Draws two copies of the format bits (with its own error correction code)
122
319
  // based on the given mask and this object's error correction level field.
123
- drawFormatBits(o) {
124
- const t = this.errorCorrectionLevel.formatBits << 3 | o;
125
- let e = t;
320
+ drawFormatBits(e) {
321
+ const n = this.errorCorrectionLevel.formatBits << 3 | e;
322
+ let t = n;
126
323
  for (let h = 0; h < 10; h++)
127
- e = e << 1 ^ (e >>> 9) * 1335;
128
- const c = (t << 10 | e) ^ 21522;
129
- n(c >>> 15 == 0);
324
+ t = t << 1 ^ (t >>> 9) * 1335;
325
+ const s = (n << 10 | t) ^ 21522;
326
+ r(s >>> 15 == 0);
130
327
  for (let h = 0; h <= 5; h++)
131
- this.setFunctionModule(8, h, s(c, h));
132
- this.setFunctionModule(8, 7, s(c, 6)), this.setFunctionModule(8, 8, s(c, 7)), this.setFunctionModule(7, 8, s(c, 8));
328
+ this.setFunctionModule(8, h, i(s, h));
329
+ this.setFunctionModule(8, 7, i(s, 6)), this.setFunctionModule(8, 8, i(s, 7)), this.setFunctionModule(7, 8, i(s, 8));
133
330
  for (let h = 9; h < 15; h++)
134
- this.setFunctionModule(14 - h, 8, s(c, h));
331
+ this.setFunctionModule(14 - h, 8, i(s, h));
135
332
  for (let h = 0; h < 8; h++)
136
- this.setFunctionModule(this.size - 1 - h, 8, s(c, h));
333
+ this.setFunctionModule(this.size - 1 - h, 8, i(s, h));
137
334
  for (let h = 8; h < 15; h++)
138
- this.setFunctionModule(8, this.size - 15 + h, s(c, h));
335
+ this.setFunctionModule(8, this.size - 15 + h, i(s, h));
139
336
  this.setFunctionModule(8, this.size - 8, !0);
140
337
  }
141
338
  // Draws two copies of the version bits (with its own error correction code),
@@ -143,144 +340,144 @@ var v;
143
340
  drawVersion() {
144
341
  if (this.version < 7)
145
342
  return;
146
- let o = this.version;
147
- for (let e = 0; e < 12; e++)
148
- o = o << 1 ^ (o >>> 11) * 7973;
149
- const t = this.version << 12 | o;
150
- n(t >>> 18 == 0);
151
- for (let e = 0; e < 18; e++) {
152
- const c = s(t, e), h = this.size - 11 + e % 3, f = Math.floor(e / 3);
153
- this.setFunctionModule(h, f, c), this.setFunctionModule(f, h, c);
343
+ let e = this.version;
344
+ for (let t = 0; t < 12; t++)
345
+ e = e << 1 ^ (e >>> 11) * 7973;
346
+ const n = this.version << 12 | e;
347
+ r(n >>> 18 == 0);
348
+ for (let t = 0; t < 18; t++) {
349
+ const s = i(n, t), h = this.size - 11 + t % 3, $ = Math.floor(t / 3);
350
+ this.setFunctionModule(h, $, s), this.setFunctionModule($, h, s);
154
351
  }
155
352
  }
156
353
  // Draws a 9*9 finder pattern including the border separator,
157
354
  // with the center module at (x, y). Modules can be out of bounds.
158
- drawFinderPattern(o, t) {
159
- for (let e = -4; e <= 4; e++)
160
- for (let c = -4; c <= 4; c++) {
161
- const h = Math.max(Math.abs(c), Math.abs(e)), f = o + c, $ = t + e;
162
- 0 <= f && f < this.size && 0 <= $ && $ < this.size && this.setFunctionModule(f, $, h != 2 && h != 4);
355
+ drawFinderPattern(e, n) {
356
+ for (let t = -4; t <= 4; t++)
357
+ for (let s = -4; s <= 4; s++) {
358
+ const h = Math.max(Math.abs(s), Math.abs(t)), $ = e + s, d = n + t;
359
+ 0 <= $ && $ < this.size && 0 <= d && d < this.size && this.setFunctionModule($, d, h != 2 && h != 4);
163
360
  }
164
361
  }
165
362
  // Draws a 5*5 alignment pattern, with the center module
166
363
  // at (x, y). All modules must be in bounds.
167
- drawAlignmentPattern(o, t) {
168
- for (let e = -2; e <= 2; e++)
169
- for (let c = -2; c <= 2; c++)
170
- this.setFunctionModule(o + c, t + e, Math.max(Math.abs(c), Math.abs(e)) != 1);
364
+ drawAlignmentPattern(e, n) {
365
+ for (let t = -2; t <= 2; t++)
366
+ for (let s = -2; s <= 2; s++)
367
+ this.setFunctionModule(e + s, n + t, Math.max(Math.abs(s), Math.abs(t)) != 1);
171
368
  }
172
369
  // Sets the color of a module and marks it as a function module.
173
370
  // Only used by the constructor. Coordinates must be in bounds.
174
- setFunctionModule(o, t, e) {
175
- this.modules[t][o] = e, this.isFunction[t][o] = !0;
371
+ setFunctionModule(e, n, t) {
372
+ this.modules[n][e] = t, this.isFunction[n][e] = !0;
176
373
  }
177
374
  /*-- Private helper methods for constructor: Codewords and masking --*/
178
375
  // Returns a new byte string representing the given data with the appropriate error correction
179
376
  // codewords appended to it, based on this object's version and error correction level.
180
- addEccAndInterleave(o) {
181
- const t = this.version, e = this.errorCorrectionLevel;
182
- if (o.length != d.getNumDataCodewords(t, e))
377
+ addEccAndInterleave(e) {
378
+ const n = this.version, t = this.errorCorrectionLevel;
379
+ if (e.length != l.getNumDataCodewords(n, t))
183
380
  throw new RangeError("Invalid argument");
184
- const c = d.NUM_ERROR_CORRECTION_BLOCKS[e.ordinal][t], h = d.ECC_CODEWORDS_PER_BLOCK[e.ordinal][t], f = Math.floor(d.getNumRawDataModules(t) / 8), $ = c - f % c, p = Math.floor(f / c);
185
- let M = [];
186
- const E = d.reedSolomonComputeDivisor(h);
187
- for (let R = 0, I = 0; R < c; R++) {
188
- let C = o.slice(I, I + p - h + (R < $ ? 0 : 1));
189
- I += C.length;
190
- const A = d.reedSolomonComputeRemainder(C, E);
191
- R < $ && C.push(0), M.push(C.concat(A));
381
+ const s = l.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][n], h = l.ECC_CODEWORDS_PER_BLOCK[t.ordinal][n], $ = Math.floor(l.getNumRawDataModules(n) / 8), d = s - $ % s, R = Math.floor($ / s);
382
+ let E = [];
383
+ const A = l.reedSolomonComputeDivisor(h);
384
+ for (let m = 0, g = 0; m < s; m++) {
385
+ let I = e.slice(g, g + R - h + (m < d ? 0 : 1));
386
+ g += I.length;
387
+ const w = l.reedSolomonComputeRemainder(I, A);
388
+ m < d && I.push(0), E.push(I.concat(w));
192
389
  }
193
- let m = [];
194
- for (let R = 0; R < M[0].length; R++)
195
- M.forEach((I, C) => {
196
- (R != p - h || C >= $) && m.push(I[R]);
390
+ let M = [];
391
+ for (let m = 0; m < E[0].length; m++)
392
+ E.forEach((g, I) => {
393
+ (m != R - h || I >= d) && M.push(g[m]);
197
394
  });
198
- return n(m.length == f), m;
395
+ return r(M.length == $), M;
199
396
  }
200
397
  // Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
201
398
  // data area of this QR Code. Function modules need to be marked off before this is called.
202
- drawCodewords(o) {
203
- if (o.length != Math.floor(d.getNumRawDataModules(this.version) / 8))
399
+ drawCodewords(e) {
400
+ if (e.length != Math.floor(l.getNumRawDataModules(this.version) / 8))
204
401
  throw new RangeError("Invalid argument");
205
- let t = 0;
206
- for (let e = this.size - 1; e >= 1; e -= 2) {
207
- e == 6 && (e = 5);
208
- for (let c = 0; c < this.size; c++)
402
+ let n = 0;
403
+ for (let t = this.size - 1; t >= 1; t -= 2) {
404
+ t == 6 && (t = 5);
405
+ for (let s = 0; s < this.size; s++)
209
406
  for (let h = 0; h < 2; h++) {
210
- const f = e - h, p = (e + 1 & 2) == 0 ? this.size - 1 - c : c;
211
- !this.isFunction[p][f] && t < o.length * 8 && (this.modules[p][f] = s(o[t >>> 3], 7 - (t & 7)), t++);
407
+ const $ = t - h, R = (t + 1 & 2) == 0 ? this.size - 1 - s : s;
408
+ !this.isFunction[R][$] && n < e.length * 8 && (this.modules[R][$] = i(e[n >>> 3], 7 - (n & 7)), n++);
212
409
  }
213
410
  }
214
- n(t == o.length * 8);
411
+ r(n == e.length * 8);
215
412
  }
216
413
  // XORs the codeword modules in this QR Code with the given mask pattern.
217
414
  // The function modules must be marked and the codeword bits must be drawn
218
415
  // before masking. Due to the arithmetic of XOR, calling applyMask() with
219
416
  // the same mask value a second time will undo the mask. A final well-formed
220
417
  // QR Code needs exactly one (not zero, two, etc.) mask applied.
221
- applyMask(o) {
222
- if (o < 0 || o > 7)
418
+ applyMask(e) {
419
+ if (e < 0 || e > 7)
223
420
  throw new RangeError("Mask value out of range");
224
- for (let t = 0; t < this.size; t++)
225
- for (let e = 0; e < this.size; e++) {
226
- let c;
227
- switch (o) {
421
+ for (let n = 0; n < this.size; n++)
422
+ for (let t = 0; t < this.size; t++) {
423
+ let s;
424
+ switch (e) {
228
425
  case 0:
229
- c = (e + t) % 2 == 0;
426
+ s = (t + n) % 2 == 0;
230
427
  break;
231
428
  case 1:
232
- c = t % 2 == 0;
429
+ s = n % 2 == 0;
233
430
  break;
234
431
  case 2:
235
- c = e % 3 == 0;
432
+ s = t % 3 == 0;
236
433
  break;
237
434
  case 3:
238
- c = (e + t) % 3 == 0;
435
+ s = (t + n) % 3 == 0;
239
436
  break;
240
437
  case 4:
241
- c = (Math.floor(e / 3) + Math.floor(t / 2)) % 2 == 0;
438
+ s = (Math.floor(t / 3) + Math.floor(n / 2)) % 2 == 0;
242
439
  break;
243
440
  case 5:
244
- c = e * t % 2 + e * t % 3 == 0;
441
+ s = t * n % 2 + t * n % 3 == 0;
245
442
  break;
246
443
  case 6:
247
- c = (e * t % 2 + e * t % 3) % 2 == 0;
444
+ s = (t * n % 2 + t * n % 3) % 2 == 0;
248
445
  break;
249
446
  case 7:
250
- c = ((e + t) % 2 + e * t % 3) % 2 == 0;
447
+ s = ((t + n) % 2 + t * n % 3) % 2 == 0;
251
448
  break;
252
449
  default:
253
450
  throw new Error("Unreachable");
254
451
  }
255
- !this.isFunction[t][e] && c && (this.modules[t][e] = !this.modules[t][e]);
452
+ !this.isFunction[n][t] && s && (this.modules[n][t] = !this.modules[n][t]);
256
453
  }
257
454
  }
258
455
  // Calculates and returns the penalty score based on state of this QR Code's current modules.
259
456
  // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
260
457
  getPenaltyScore() {
261
- let o = 0;
458
+ let e = 0;
262
459
  for (let h = 0; h < this.size; h++) {
263
- let f = !1, $ = 0, p = [0, 0, 0, 0, 0, 0, 0];
264
- for (let M = 0; M < this.size; M++)
265
- this.modules[h][M] == f ? ($++, $ == 5 ? o += d.PENALTY_N1 : $ > 5 && o++) : (this.finderPenaltyAddHistory($, p), f || (o += this.finderPenaltyCountPatterns(p) * d.PENALTY_N3), f = this.modules[h][M], $ = 1);
266
- o += this.finderPenaltyTerminateAndCount(f, $, p) * d.PENALTY_N3;
460
+ let $ = !1, d = 0, R = [0, 0, 0, 0, 0, 0, 0];
461
+ for (let E = 0; E < this.size; E++)
462
+ this.modules[h][E] == $ ? (d++, d == 5 ? e += l.PENALTY_N1 : d > 5 && e++) : (this.finderPenaltyAddHistory(d, R), $ || (e += this.finderPenaltyCountPatterns(R) * l.PENALTY_N3), $ = this.modules[h][E], d = 1);
463
+ e += this.finderPenaltyTerminateAndCount($, d, R) * l.PENALTY_N3;
267
464
  }
268
465
  for (let h = 0; h < this.size; h++) {
269
- let f = !1, $ = 0, p = [0, 0, 0, 0, 0, 0, 0];
270
- for (let M = 0; M < this.size; M++)
271
- this.modules[M][h] == f ? ($++, $ == 5 ? o += d.PENALTY_N1 : $ > 5 && o++) : (this.finderPenaltyAddHistory($, p), f || (o += this.finderPenaltyCountPatterns(p) * d.PENALTY_N3), f = this.modules[M][h], $ = 1);
272
- o += this.finderPenaltyTerminateAndCount(f, $, p) * d.PENALTY_N3;
466
+ let $ = !1, d = 0, R = [0, 0, 0, 0, 0, 0, 0];
467
+ for (let E = 0; E < this.size; E++)
468
+ this.modules[E][h] == $ ? (d++, d == 5 ? e += l.PENALTY_N1 : d > 5 && e++) : (this.finderPenaltyAddHistory(d, R), $ || (e += this.finderPenaltyCountPatterns(R) * l.PENALTY_N3), $ = this.modules[E][h], d = 1);
469
+ e += this.finderPenaltyTerminateAndCount($, d, R) * l.PENALTY_N3;
273
470
  }
274
471
  for (let h = 0; h < this.size - 1; h++)
275
- for (let f = 0; f < this.size - 1; f++) {
276
- const $ = this.modules[h][f];
277
- $ == this.modules[h][f + 1] && $ == this.modules[h + 1][f] && $ == this.modules[h + 1][f + 1] && (o += d.PENALTY_N2);
472
+ for (let $ = 0; $ < this.size - 1; $++) {
473
+ const d = this.modules[h][$];
474
+ d == this.modules[h][$ + 1] && d == this.modules[h + 1][$] && d == this.modules[h + 1][$ + 1] && (e += l.PENALTY_N2);
278
475
  }
279
- let t = 0;
476
+ let n = 0;
280
477
  for (const h of this.modules)
281
- t = h.reduce((f, $) => f + ($ ? 1 : 0), t);
282
- const e = this.size * this.size, c = Math.ceil(Math.abs(t * 20 - e * 10) / e) - 1;
283
- return n(0 <= c && c <= 9), o += c * d.PENALTY_N4, n(0 <= o && o <= 2568888), o;
478
+ n = h.reduce(($, d) => $ + (d ? 1 : 0), n);
479
+ const t = this.size * this.size, s = Math.ceil(Math.abs(n * 20 - t * 10) / t) - 1;
480
+ return r(0 <= s && s <= 9), e += s * l.PENALTY_N4, r(0 <= e && e <= 2568888), e;
284
481
  }
285
482
  /*-- Private helper functions --*/
286
483
  // Returns an ascending list of positions of alignment patterns for this version number.
@@ -290,86 +487,86 @@ var v;
290
487
  if (this.version == 1)
291
488
  return [];
292
489
  {
293
- const o = Math.floor(this.version / 7) + 2, t = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (o * 2 - 2)) * 2;
294
- let e = [6];
295
- for (let c = this.size - 7; e.length < o; c -= t)
296
- e.splice(1, 0, c);
297
- return e;
490
+ const e = Math.floor(this.version / 7) + 2, n = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (e * 2 - 2)) * 2;
491
+ let t = [6];
492
+ for (let s = this.size - 7; t.length < e; s -= n)
493
+ t.splice(1, 0, s);
494
+ return t;
298
495
  }
299
496
  }
300
497
  // Returns the number of data bits that can be stored in a QR Code of the given version number, after
301
498
  // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
302
499
  // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
303
- static getNumRawDataModules(o) {
304
- if (o < d.MIN_VERSION || o > d.MAX_VERSION)
500
+ static getNumRawDataModules(e) {
501
+ if (e < l.MIN_VERSION || e > l.MAX_VERSION)
305
502
  throw new RangeError("Version number out of range");
306
- let t = (16 * o + 128) * o + 64;
307
- if (o >= 2) {
308
- const e = Math.floor(o / 7) + 2;
309
- t -= (25 * e - 10) * e - 55, o >= 7 && (t -= 36);
503
+ let n = (16 * e + 128) * e + 64;
504
+ if (e >= 2) {
505
+ const t = Math.floor(e / 7) + 2;
506
+ n -= (25 * t - 10) * t - 55, e >= 7 && (n -= 36);
310
507
  }
311
- return n(208 <= t && t <= 29648), t;
508
+ return r(208 <= n && n <= 29648), n;
312
509
  }
313
510
  // Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
314
511
  // QR Code of the given version number and error correction level, with remainder bits discarded.
315
512
  // This stateless pure function could be implemented as a (40*4)-cell lookup table.
316
- static getNumDataCodewords(o, t) {
317
- return Math.floor(d.getNumRawDataModules(o) / 8) - d.ECC_CODEWORDS_PER_BLOCK[t.ordinal][o] * d.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][o];
513
+ static getNumDataCodewords(e, n) {
514
+ return Math.floor(l.getNumRawDataModules(e) / 8) - l.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e] * l.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e];
318
515
  }
319
516
  // Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
320
517
  // implemented as a lookup table over all possible parameter values, instead of as an algorithm.
321
- static reedSolomonComputeDivisor(o) {
322
- if (o < 1 || o > 255)
518
+ static reedSolomonComputeDivisor(e) {
519
+ if (e < 1 || e > 255)
323
520
  throw new RangeError("Degree out of range");
324
- let t = [];
325
- for (let c = 0; c < o - 1; c++)
326
- t.push(0);
327
- t.push(1);
328
- let e = 1;
329
- for (let c = 0; c < o; c++) {
330
- for (let h = 0; h < t.length; h++)
331
- t[h] = d.reedSolomonMultiply(t[h], e), h + 1 < t.length && (t[h] ^= t[h + 1]);
332
- e = d.reedSolomonMultiply(e, 2);
521
+ let n = [];
522
+ for (let s = 0; s < e - 1; s++)
523
+ n.push(0);
524
+ n.push(1);
525
+ let t = 1;
526
+ for (let s = 0; s < e; s++) {
527
+ for (let h = 0; h < n.length; h++)
528
+ n[h] = l.reedSolomonMultiply(n[h], t), h + 1 < n.length && (n[h] ^= n[h + 1]);
529
+ t = l.reedSolomonMultiply(t, 2);
333
530
  }
334
- return t;
531
+ return n;
335
532
  }
336
533
  // Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
337
- static reedSolomonComputeRemainder(o, t) {
338
- let e = t.map((c) => 0);
339
- for (const c of o) {
340
- const h = c ^ e.shift();
341
- e.push(0), t.forEach((f, $) => e[$] ^= d.reedSolomonMultiply(f, h));
534
+ static reedSolomonComputeRemainder(e, n) {
535
+ let t = n.map((s) => 0);
536
+ for (const s of e) {
537
+ const h = s ^ t.shift();
538
+ t.push(0), n.forEach(($, d) => t[d] ^= l.reedSolomonMultiply($, h));
342
539
  }
343
- return e;
540
+ return t;
344
541
  }
345
542
  // Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
346
543
  // are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
347
- static reedSolomonMultiply(o, t) {
348
- if (o >>> 8 || t >>> 8)
544
+ static reedSolomonMultiply(e, n) {
545
+ if (e >>> 8 || n >>> 8)
349
546
  throw new RangeError("Byte out of range");
350
- let e = 0;
351
- for (let c = 7; c >= 0; c--)
352
- e = e << 1 ^ (e >>> 7) * 285, e ^= (t >>> c & 1) * o;
353
- return n(e >>> 8 == 0), e;
547
+ let t = 0;
548
+ for (let s = 7; s >= 0; s--)
549
+ t = t << 1 ^ (t >>> 7) * 285, t ^= (n >>> s & 1) * e;
550
+ return r(t >>> 8 == 0), t;
354
551
  }
355
552
  // Can only be called immediately after a light run is added, and
356
553
  // returns either 0, 1, or 2. A helper function for getPenaltyScore().
357
- finderPenaltyCountPatterns(o) {
358
- const t = o[1];
359
- n(t <= this.size * 3);
360
- const e = t > 0 && o[2] == t && o[3] == t * 3 && o[4] == t && o[5] == t;
361
- return (e && o[0] >= t * 4 && o[6] >= t ? 1 : 0) + (e && o[6] >= t * 4 && o[0] >= t ? 1 : 0);
554
+ finderPenaltyCountPatterns(e) {
555
+ const n = e[1];
556
+ r(n <= this.size * 3);
557
+ const t = n > 0 && e[2] == n && e[3] == n * 3 && e[4] == n && e[5] == n;
558
+ return (t && e[0] >= n * 4 && e[6] >= n ? 1 : 0) + (t && e[6] >= n * 4 && e[0] >= n ? 1 : 0);
362
559
  }
363
560
  // Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
364
- finderPenaltyTerminateAndCount(o, t, e) {
365
- return o && (this.finderPenaltyAddHistory(t, e), t = 0), t += this.size, this.finderPenaltyAddHistory(t, e), this.finderPenaltyCountPatterns(e);
561
+ finderPenaltyTerminateAndCount(e, n, t) {
562
+ return e && (this.finderPenaltyAddHistory(n, t), n = 0), n += this.size, this.finderPenaltyAddHistory(n, t), this.finderPenaltyCountPatterns(t);
366
563
  }
367
564
  // Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
368
- finderPenaltyAddHistory(o, t) {
369
- t[0] == 0 && (o += this.size), t.pop(), t.unshift(o);
565
+ finderPenaltyAddHistory(e, n) {
566
+ n[0] == 0 && (e += this.size), n.pop(), n.unshift(e);
370
567
  }
371
568
  };
372
- d.MIN_VERSION = 1, d.MAX_VERSION = 40, d.PENALTY_N1 = 3, d.PENALTY_N2 = 3, d.PENALTY_N3 = 40, d.PENALTY_N4 = 10, d.ECC_CODEWORDS_PER_BLOCK = [
569
+ l.MIN_VERSION = 1, l.MAX_VERSION = 40, l.PENALTY_N1 = 3, l.PENALTY_N2 = 3, l.PENALTY_N3 = 40, l.PENALTY_N4 = 10, l.ECC_CODEWORDS_PER_BLOCK = [
373
570
  // Version: (note that index 0 is for padding, and is set to an illegal value)
374
571
  //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
375
572
  [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
@@ -380,7 +577,7 @@ var v;
380
577
  // Quartile
381
578
  [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
382
579
  // High
383
- ], d.NUM_ERROR_CORRECTION_BLOCKS = [
580
+ ], l.NUM_ERROR_CORRECTION_BLOCKS = [
384
581
  // Version: (note that index 0 is for padding, and is set to an illegal value)
385
582
  //0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
386
583
  [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
@@ -392,96 +589,96 @@ var v;
392
589
  [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
393
590
  // High
394
591
  ];
395
- let i = d;
396
- r.QrCode = i;
397
- function a(N, o, t) {
398
- if (o < 0 || o > 31 || N >>> o)
592
+ let a = l;
593
+ o.QrCode = a;
594
+ function c(f, e, n) {
595
+ if (e < 0 || e > 31 || f >>> e)
399
596
  throw new RangeError("Value out of range");
400
- for (let e = o - 1; e >= 0; e--)
401
- t.push(N >>> e & 1);
597
+ for (let t = e - 1; t >= 0; t--)
598
+ n.push(f >>> t & 1);
402
599
  }
403
- function s(N, o) {
404
- return (N >>> o & 1) != 0;
600
+ function i(f, e) {
601
+ return (f >>> e & 1) != 0;
405
602
  }
406
- function n(N) {
407
- if (!N)
603
+ function r(f) {
604
+ if (!f)
408
605
  throw new Error("Assertion error");
409
606
  }
410
- const u = class u {
607
+ const p = class p {
411
608
  /*-- Constructor (low level) and fields --*/
412
609
  // Creates a new QR Code segment with the given attributes and data.
413
610
  // The character count (numChars) must agree with the mode and the bit buffer length,
414
611
  // but the constraint isn't checked. The given bit buffer is cloned and stored.
415
- constructor(o, t, e) {
416
- if (this.mode = o, this.numChars = t, this.bitData = e, t < 0)
612
+ constructor(e, n, t) {
613
+ if (this.mode = e, this.numChars = n, this.bitData = t, n < 0)
417
614
  throw new RangeError("Invalid argument");
418
- this.bitData = e.slice();
615
+ this.bitData = t.slice();
419
616
  }
420
617
  /*-- Static factory functions (mid level) --*/
421
618
  // Returns a segment representing the given binary data encoded in
422
619
  // byte mode. All input byte arrays are acceptable. Any text string
423
620
  // can be converted to UTF-8 bytes and encoded as a byte mode segment.
424
- static makeBytes(o) {
425
- let t = [];
426
- for (const e of o)
427
- a(e, 8, t);
428
- return new u(u.Mode.BYTE, o.length, t);
621
+ static makeBytes(e) {
622
+ let n = [];
623
+ for (const t of e)
624
+ c(t, 8, n);
625
+ return new p(p.Mode.BYTE, e.length, n);
429
626
  }
430
627
  // Returns a segment representing the given string of decimal digits encoded in numeric mode.
431
- static makeNumeric(o) {
432
- if (!u.isNumeric(o))
628
+ static makeNumeric(e) {
629
+ if (!p.isNumeric(e))
433
630
  throw new RangeError("String contains non-numeric characters");
434
- let t = [];
435
- for (let e = 0; e < o.length; ) {
436
- const c = Math.min(o.length - e, 3);
437
- a(parseInt(o.substring(e, e + c), 10), c * 3 + 1, t), e += c;
631
+ let n = [];
632
+ for (let t = 0; t < e.length; ) {
633
+ const s = Math.min(e.length - t, 3);
634
+ c(parseInt(e.substring(t, t + s), 10), s * 3 + 1, n), t += s;
438
635
  }
439
- return new u(u.Mode.NUMERIC, o.length, t);
636
+ return new p(p.Mode.NUMERIC, e.length, n);
440
637
  }
441
638
  // Returns a segment representing the given text string encoded in alphanumeric mode.
442
639
  // The characters allowed are: 0 to 9, A to Z (uppercase only), space,
443
640
  // dollar, percent, asterisk, plus, hyphen, period, slash, colon.
444
- static makeAlphanumeric(o) {
445
- if (!u.isAlphanumeric(o))
641
+ static makeAlphanumeric(e) {
642
+ if (!p.isAlphanumeric(e))
446
643
  throw new RangeError("String contains unencodable characters in alphanumeric mode");
447
- let t = [], e;
448
- for (e = 0; e + 2 <= o.length; e += 2) {
449
- let c = u.ALPHANUMERIC_CHARSET.indexOf(o.charAt(e)) * 45;
450
- c += u.ALPHANUMERIC_CHARSET.indexOf(o.charAt(e + 1)), a(c, 11, t);
644
+ let n = [], t;
645
+ for (t = 0; t + 2 <= e.length; t += 2) {
646
+ let s = p.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)) * 45;
647
+ s += p.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t + 1)), c(s, 11, n);
451
648
  }
452
- return e < o.length && a(u.ALPHANUMERIC_CHARSET.indexOf(o.charAt(e)), 6, t), new u(u.Mode.ALPHANUMERIC, o.length, t);
649
+ return t < e.length && c(p.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)), 6, n), new p(p.Mode.ALPHANUMERIC, e.length, n);
453
650
  }
454
651
  // Returns a new mutable list of zero or more segments to represent the given Unicode text string.
455
652
  // The result may use various segment modes and switch modes to optimize the length of the bit stream.
456
- static makeSegments(o) {
457
- return o == "" ? [] : u.isNumeric(o) ? [u.makeNumeric(o)] : u.isAlphanumeric(o) ? [u.makeAlphanumeric(o)] : [u.makeBytes(u.toUtf8ByteArray(o))];
653
+ static makeSegments(e) {
654
+ return e == "" ? [] : p.isNumeric(e) ? [p.makeNumeric(e)] : p.isAlphanumeric(e) ? [p.makeAlphanumeric(e)] : [p.makeBytes(p.toUtf8ByteArray(e))];
458
655
  }
459
656
  // Returns a segment representing an Extended Channel Interpretation
460
657
  // (ECI) designator with the given assignment value.
461
- static makeEci(o) {
462
- let t = [];
463
- if (o < 0)
658
+ static makeEci(e) {
659
+ let n = [];
660
+ if (e < 0)
464
661
  throw new RangeError("ECI assignment value out of range");
465
- if (o < 128)
466
- a(o, 8, t);
467
- else if (o < 16384)
468
- a(2, 2, t), a(o, 14, t);
469
- else if (o < 1e6)
470
- a(6, 3, t), a(o, 21, t);
662
+ if (e < 128)
663
+ c(e, 8, n);
664
+ else if (e < 16384)
665
+ c(2, 2, n), c(e, 14, n);
666
+ else if (e < 1e6)
667
+ c(6, 3, n), c(e, 21, n);
471
668
  else
472
669
  throw new RangeError("ECI assignment value out of range");
473
- return new u(u.Mode.ECI, 0, t);
670
+ return new p(p.Mode.ECI, 0, n);
474
671
  }
475
672
  // Tests whether the given string can be encoded as a segment in numeric mode.
476
673
  // A string is encodable iff each character is in the range 0 to 9.
477
- static isNumeric(o) {
478
- return u.NUMERIC_REGEX.test(o);
674
+ static isNumeric(e) {
675
+ return p.NUMERIC_REGEX.test(e);
479
676
  }
480
677
  // Tests whether the given string can be encoded as a segment in alphanumeric mode.
481
678
  // A string is encodable iff each character is in the following set: 0 to 9, A to Z
482
679
  // (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
483
- static isAlphanumeric(o) {
484
- return u.ALPHANUMERIC_REGEX.test(o);
680
+ static isAlphanumeric(e) {
681
+ return p.ALPHANUMERIC_REGEX.test(e);
485
682
  }
486
683
  /*-- Methods --*/
487
684
  // Returns a new copy of the data bits of this segment.
@@ -490,68 +687,68 @@ var v;
490
687
  }
491
688
  // (Package-private) Calculates and returns the number of bits needed to encode the given segments at
492
689
  // the given version. The result is infinity if a segment has too many characters to fit its length field.
493
- static getTotalBits(o, t) {
494
- let e = 0;
495
- for (const c of o) {
496
- const h = c.mode.numCharCountBits(t);
497
- if (c.numChars >= 1 << h)
690
+ static getTotalBits(e, n) {
691
+ let t = 0;
692
+ for (const s of e) {
693
+ const h = s.mode.numCharCountBits(n);
694
+ if (s.numChars >= 1 << h)
498
695
  return 1 / 0;
499
- e += 4 + h + c.bitData.length;
696
+ t += 4 + h + s.bitData.length;
500
697
  }
501
- return e;
698
+ return t;
502
699
  }
503
700
  // Returns a new array of bytes representing the given string encoded in UTF-8.
504
- static toUtf8ByteArray(o) {
505
- o = encodeURI(o);
506
- let t = [];
507
- for (let e = 0; e < o.length; e++)
508
- o.charAt(e) != "%" ? t.push(o.charCodeAt(e)) : (t.push(parseInt(o.substring(e + 1, e + 3), 16)), e += 2);
509
- return t;
701
+ static toUtf8ByteArray(e) {
702
+ e = encodeURI(e);
703
+ let n = [];
704
+ for (let t = 0; t < e.length; t++)
705
+ e.charAt(t) != "%" ? n.push(e.charCodeAt(t)) : (n.push(parseInt(e.substring(t + 1, t + 3), 16)), t += 2);
706
+ return n;
510
707
  }
511
708
  };
512
- u.NUMERIC_REGEX = /^[0-9]*$/, u.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, u.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
513
- let l = u;
514
- r.QrSegment = l;
515
- })(v || (v = {}));
516
- ((r) => {
517
- ((i) => {
518
- const s = class s {
709
+ p.NUMERIC_REGEX = /^[0-9]*$/, p.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, p.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
710
+ let u = p;
711
+ o.QrSegment = u;
712
+ })(S || (S = {}));
713
+ ((o) => {
714
+ ((a) => {
715
+ const i = class i {
519
716
  // The QR Code can tolerate about 30% erroneous codewords
520
717
  /*-- Constructor and fields --*/
521
- constructor(l, d) {
522
- this.ordinal = l, this.formatBits = d;
718
+ constructor(u, l) {
719
+ this.ordinal = u, this.formatBits = l;
523
720
  }
524
721
  };
525
- s.LOW = new s(0, 1), s.MEDIUM = new s(1, 0), s.QUARTILE = new s(2, 3), s.HIGH = new s(3, 2);
526
- let a = s;
527
- i.Ecc = a;
528
- })(r.QrCode || (r.QrCode = {}));
529
- })(v || (v = {}));
530
- ((r) => {
531
- ((i) => {
532
- const s = class s {
722
+ i.LOW = new i(0, 1), i.MEDIUM = new i(1, 0), i.QUARTILE = new i(2, 3), i.HIGH = new i(3, 2);
723
+ let c = i;
724
+ a.Ecc = c;
725
+ })(o.QrCode || (o.QrCode = {}));
726
+ })(S || (S = {}));
727
+ ((o) => {
728
+ ((a) => {
729
+ const i = class i {
533
730
  /*-- Constructor and fields --*/
534
- constructor(l, d) {
535
- this.modeBits = l, this.numBitsCharCount = d;
731
+ constructor(u, l) {
732
+ this.modeBits = u, this.numBitsCharCount = l;
536
733
  }
537
734
  /*-- Method --*/
538
735
  // (Package-private) Returns the bit width of the character count field for a segment in
539
736
  // this mode in a QR Code at the given version number. The result is in the range [0, 16].
540
- numCharCountBits(l) {
541
- return this.numBitsCharCount[Math.floor((l + 7) / 17)];
737
+ numCharCountBits(u) {
738
+ return this.numBitsCharCount[Math.floor((u + 7) / 17)];
542
739
  }
543
740
  };
544
- s.NUMERIC = new s(1, [10, 12, 14]), s.ALPHANUMERIC = new s(2, [9, 11, 13]), s.BYTE = new s(4, [8, 16, 16]), s.KANJI = new s(8, [8, 10, 12]), s.ECI = new s(7, [0, 0, 0]);
545
- let a = s;
546
- i.Mode = a;
547
- })(r.QrSegment || (r.QrSegment = {}));
548
- })(v || (v = {}));
549
- const S = v, lt = {
550
- L: S.QrCode.Ecc.LOW,
551
- M: S.QrCode.Ecc.MEDIUM,
552
- Q: S.QrCode.Ecc.QUARTILE,
553
- H: S.QrCode.Ecc.HIGH
554
- }, ht = 128, ut = "M", dt = 1, $t = 4, W = 5, _ = "#000000", ft = "square", pt = "square", mt = "square", Et = "react-qr-code", b = "react-qr-code-gradient", F = "react-qr-code-bg-gradient", Mt = 0.1, g = 7, O = 3, B = [
741
+ i.NUMERIC = new i(1, [10, 12, 14]), i.ALPHANUMERIC = new i(2, [9, 11, 13]), i.BYTE = new i(4, [8, 16, 16]), i.KANJI = new i(8, [8, 10, 12]), i.ECI = new i(7, [0, 0, 0]);
742
+ let c = i;
743
+ a.Mode = c;
744
+ })(o.QrSegment || (o.QrSegment = {}));
745
+ })(S || (S = {}));
746
+ const U = S, $t = {
747
+ L: U.QrCode.Ecc.LOW,
748
+ M: U.QrCode.Ecc.MEDIUM,
749
+ Q: U.QrCode.Ecc.QUARTILE,
750
+ H: U.QrCode.Ecc.HIGH
751
+ }, ft = 128, pt = "M", mt = 1, Et = 4, nt = 5, H = "#000000", Mt = "square", Rt = "square", gt = "square", Nt = "react-qr-code", It = "react-qr-code-gradient", Ct = "react-qr-code-bg-gradient", wt = 0.1, N = 7, T = 3, y = [
555
752
  [1, 1, 1, 1, 1, 1, 1],
556
753
  [1, 0, 0, 0, 0, 0, 1],
557
754
  [1, 0, 0, 0, 0, 0, 1],
@@ -559,7 +756,7 @@ const S = v, lt = {
559
756
  [1, 0, 0, 0, 0, 0, 1],
560
757
  [1, 0, 0, 0, 0, 0, 1],
561
758
  [1, 1, 1, 1, 1, 1, 1]
562
- ], J = {
759
+ ], rt = {
563
760
  "inpoint-sm": [0, 90, -90],
564
761
  inpoint: [0, 90, -90],
565
762
  "inpoint-lg": [0, 90, -90],
@@ -569,7 +766,7 @@ const S = v, lt = {
569
766
  "leaf-sm": [0, 90, -90],
570
767
  leaf: [0, 90, -90],
571
768
  "leaf-lg": [0, 90, -90]
572
- }, Q = {
769
+ }, k = {
573
770
  "rounded-sm": 3,
574
771
  rounded: 4,
575
772
  "rounded-lg": 5,
@@ -582,7 +779,7 @@ const S = v, lt = {
582
779
  "outpoint-sm": 3,
583
780
  outpoint: 4,
584
781
  "outpoint-lg": 5
585
- }, k = {
782
+ }, q = {
586
783
  square: 0,
587
784
  diamond: 0,
588
785
  circle: 3,
@@ -598,7 +795,7 @@ const S = v, lt = {
598
795
  "outpoint-sm": 1.5,
599
796
  outpoint: 2,
600
797
  "outpoint-lg": 2.3
601
- }, H = [
798
+ }, B = [
602
799
  [0, 0, 0, 0, 0, 0, 0],
603
800
  [0, 0, 0, 0, 0, 0, 0],
604
801
  [0, 0, 1, 1, 1, 0, 0],
@@ -606,493 +803,300 @@ const S = v, lt = {
606
803
  [0, 0, 1, 1, 1, 0, 0],
607
804
  [0, 0, 0, 0, 0, 0, 0],
608
805
  [0, 0, 0, 0, 0, 0, 0]
609
- ], Rt = /\.?0+$/;
610
- function gt(r) {
611
- return r.toFixed(7).replace(Rt, "");
612
- }
613
- const tt = (r) => {
614
- const i = r % 360 * (Math.PI / 180), a = Math.max(0, Math.min(100, 50 - 50 * Math.cos(i))), s = Math.max(0, Math.min(100, 50 - 50 * Math.sin(i))), n = Math.max(0, Math.min(100, 50 + 50 * Math.cos(i))), l = Math.max(0, Math.min(100, 50 + 50 * Math.sin(i)));
615
- return {
616
- x1: `${a}%`,
617
- y1: `${s}%`,
618
- x2: `${n}%`,
619
- y2: `${l}%`
620
- };
621
- }, et = (r, i, a, s) => {
622
- const n = a / 2, l = n / 2, d = Math.PI / s;
623
- let u = "";
624
- for (let N = 0; N < 2 * s; N++) {
625
- const o = N * d - Math.PI / 2, t = N % 2 === 0 ? n : l, e = r + t * Math.cos(o), c = i + t * Math.sin(o);
626
- u += `${N === 0 ? "M" : "L"} ${e},${c} `;
627
- }
628
- return u + "Z";
629
- }, ot = (r, i, a, s) => `M ${r} ${i}Q ${r + s} ${i + a / 2}, ${r} ${i + a}Q ${r + a / 2} ${i + a - s}, ${r + a} ${i + a}Q ${r + a - s} ${i + a / 2}, ${r + a} ${i}Q ${r + a / 2} ${i + s}, ${r} ${i}Z`, nt = (r, i, a) => {
630
- const s = a / 8;
631
- return `M ${r + a} ${i + s * 3}
632
- V ${i + s}
633
- h -${s}
634
- V ${i}
635
- H ${r + s * 5}
636
- v ${s}
637
- H ${r + s * 3}
638
- V ${i}
639
- H ${r + s}
640
- v ${s}
641
- H ${r}
642
- v ${s * 2}
643
- h ${s}
644
- v ${s * 2}
645
- H ${r}
646
- v ${s * 2}
647
- h ${s}
648
- v ${s}
649
- h ${s * 2}
650
- v -${s}
651
- h ${s * 2}
652
- v ${s}
653
- h ${s * 2}
654
- v -${s}
655
- h ${s}
656
- V ${i + s * 5}
657
- h -${s}
658
- V ${i + s * 3}
659
- h ${s}
660
- Z`;
661
- }, rt = (r, i, a) => {
662
- let s = !1, n = 0;
663
- return [
664
- "M",
665
- 1,
666
- 0.3262506,
667
- "c",
668
- 0,
669
- 0.0383376,
670
- -64626e-7,
671
- 0.0758377,
672
- -0.0193751,
673
- 0.1125001,
674
- "s",
675
- -0.0356247,
676
- 0.076875,
677
- -0.0681248,
678
- 0.1206252,
679
- "c",
680
- -0.0325,
681
- 0.0437499,
682
- -0.0762503,
683
- 0.0931247,
684
- -0.1312501,
685
- 0.1481249,
686
- "C",
687
- 0.7262502,
688
- 0.7625008,
689
- 0.6566626,
690
- 0.8279132,
691
- 0.5724999,
692
- 0.9037505,
693
- "L",
694
- 0.5,
695
- 0.9687506,
696
- "L",
697
- 0.4275001,
698
- 0.9037505,
699
- "C",
700
- 0.3433374,
701
- 0.8279132,
702
- 0.2737499,
703
- 0.7625005,
704
- 0.21875,
705
- 0.7075007,
706
- "C",
707
- 0.1637501,
708
- 0.6525008,
709
- 0.1199999,
710
- 0.6031258,
711
- 0.0874999,
712
- 0.5593758,
713
- "S",
714
- 0.0322876,
715
- 0.4754133,
716
- 0.0193751,
717
- 0.4387506,
718
- "S",
719
- 0,
720
- 0.3645881,
721
- 0,
722
- 0.3262506,
723
- "c",
724
- 0,
725
- -0.0783374,
726
- 0.0262499,
727
- -0.1437498,
728
- 0.07875,
729
- -0.1962499,
730
- "s",
731
- 0.1179124,
732
- -0.07875,
733
- 0.1962499,
734
- -0.07875,
735
- "c",
736
- 0.0433376,
737
- 0,
738
- 0.0845875,
739
- 91625e-7,
740
- 0.12375,
741
- 0.0274999,
742
- "S",
743
- 0.4716623,
744
- 0.1229131,
745
- 0.5,
746
- 0.1562506,
747
- "c",
748
- 0.0283374,
749
- -0.0333375,
750
- 0.0620874,
751
- -0.0591625,
752
- 0.1012502,
753
- -0.0775,
754
- "c",
755
- 0.0391627,
756
- -0.0183375,
757
- 0.0804126,
758
- -0.0274999,
759
- 0.12375,
760
- -0.0274999,
761
- "c",
762
- 0.0783374,
763
- 0,
764
- 0.1437497,
765
- 0.0262499,
766
- 0.1962501,
767
- 0.07875,
768
- "S",
769
- 1,
770
- 0.2479131,
771
- 1,
772
- 0.3262506,
773
- "z"
774
- ].map((l) => typeof l == "string" ? (n = 0, s = l.toUpperCase() == l, l) : (n++, l = l * a, s && (l += n % 2 == 1 ? r : i), gt(l))).join(" ");
775
- }, q = {
776
- "data-testid": "background"
777
- }, Nt = ({ background: r, numCells: i }) => {
778
- var s, n;
779
- if (!r)
780
- return null;
781
- if (typeof r == "string")
782
- return /* @__PURE__ */ w("path", { fill: r, d: `M0,0 h${i}v${i}H0z`, ...q });
783
- const a = tt((r == null ? void 0 : r.rotation) || 0);
784
- return /* @__PURE__ */ K(st, { children: [
785
- /* @__PURE__ */ w("defs", { children: r.type === "linear" ? /* @__PURE__ */ w("linearGradient", { id: F, gradientUnits: "userSpaceOnUse", ...a, children: (s = r.stops) == null ? void 0 : s.map((l, d) => /* @__PURE__ */ w("stop", { offset: l.offset, stopColor: l.color }, d)) }) : /* @__PURE__ */ w(
786
- "radialGradient",
787
- {
788
- id: F,
789
- gradientUnits: "userSpaceOnUse",
790
- cx: "50%",
791
- cy: "50%",
792
- r: "50%",
793
- children: (n = r.stops) == null ? void 0 : n.map((l, d) => /* @__PURE__ */ w("stop", { offset: l.offset, stopColor: l.color }, d))
794
- }
795
- ) }),
796
- /* @__PURE__ */ w(
797
- "path",
798
- {
799
- fill: `url(#${F})`,
800
- d: `M0,0 h${i}v${i}H0z`,
801
- ...q
802
- }
803
- )
804
- ] });
805
- }, It = (r) => r === "square" || r === "circle" || r === "star" || r === "heart" || r === "diamond" || r === "hashtag", Ct = (r, i) => r === "square-sm" ? 0.75 : i ? Math.random() * (1 - 0.75) + 0.75 : 1, D = (r, i, a) => {
806
- const s = {
807
- left: r === 0 ? !1 : a[i][r - 1],
808
- right: r === a[i].length - 1 ? !1 : a[i][r + 1],
809
- top: i === 0 ? !1 : a[i - 1][r],
810
- bottom: i === a.length - 1 ? !1 : a[i + 1][r]
806
+ ], At = (o) => o === "square" || o === "pinched-square" || o === "circle" || o === "star" || o === "heart" || o === "diamond" || o === "hashtag", Pt = (o, a) => o === "square-sm" ? 0.75 : a ? Math.random() * (1 - 0.75) + 0.75 : 1, D = (o, a, c) => {
807
+ const i = {
808
+ left: o === 0 ? !1 : c[a][o - 1],
809
+ right: o === c[a].length - 1 ? !1 : c[a][o + 1],
810
+ top: a === 0 ? !1 : c[a - 1][o],
811
+ bottom: a === c.length - 1 ? !1 : c[a + 1][o]
811
812
  };
812
813
  return {
813
- ...s,
814
- count: Object.values(s).filter(Boolean).length
814
+ ...i,
815
+ count: Object.values(i).filter(Boolean).length
815
816
  };
816
- }, U = (r, i, a) => `M${r},${i}h${a}v${a}h-${a}Z`, y = (r, i, a) => `M${r},${i + a / 2}a${a / 2},${a / 2} 0 1,0 ${a},0a${a / 2},${a / 2} 0 1,0 -${a},0Z`, wt = (r, i, a) => `M${r},${i + a / 2}l${a / 2},-${a / 2}l${a / 2},${a / 2}l-${a / 2},${a / 2}Z`, At = (r, i) => `M ${r} ${i}
817
+ }, b = (o, a, c) => `M${o},${a}h${c}v${c}h-${c}Z`, F = (o, a, c) => `M${o},${a + c / 2}a${c / 2},${c / 2} 0 1,0 ${c},0a${c / 2},${c / 2} 0 1,0 -${c},0Z`, Ot = (o, a, c) => `M${o},${a + c / 2}l${c / 2},-${c / 2}l${c / 2},${c / 2}l-${c / 2},${c / 2}Z`, Tt = (o, a) => `M ${o} ${a}
817
818
  v 1
818
819
  h 1
819
820
  v -0.5
820
- a 0.5 0.5, 0, 0, 0, -0.5 -0.5`, Y = (r, i) => `M ${r + 1} ${i}
821
+ a 0.5 0.5, 0, 0, 0, -0.5 -0.5`, Y = (o, a) => `M ${o + 1} ${a}
821
822
  v 1
822
823
  h -1
823
824
  v -0.5
824
- a 0.5 0.5, 0, 0, 1, 0.5 -0.5`, G = (r, i) => `M ${r} ${i}
825
+ a 0.5 0.5, 0, 0, 1, 0.5 -0.5`, G = (o, a) => `M ${o} ${a}
825
826
  v 1
826
827
  h 0.5
827
828
  a 0.5 0.5, 0, 0, 0, 0.5 -0.5
828
829
  v -0.5
829
- h -1`, Pt = (r, i) => `M ${r + 1} ${i}
830
+ h -1`, Lt = (o, a) => `M ${o + 1} ${a}
830
831
  v 1
831
832
  h -0.5
832
833
  a 0.5 0.5, 0, 0, 1, -0.5 -0.5
833
834
  v -0.5
834
- h 1`, j = (r, i) => `M ${r} ${i}
835
+ h 1`, j = (o, a) => `M ${o} ${a}
835
836
  v 1
836
837
  h 0.5
837
- a 0.5 0.5, 0, 0, 0, 0 -1`, V = (r, i) => `M ${r + 1} ${i}
838
+ a 0.5 0.5, 0, 0, 0, 0 -1`, V = (o, a) => `M ${o + 1} ${a}
838
839
  v 1
839
840
  h -0.5
840
- a 0.5 0.5, 0, 0, 1, 0 -1`, X = (r, i) => `M ${r} ${i + 1}
841
+ a 0.5 0.5, 0, 0, 1, 0 -1`, X = (o, a) => `M ${o} ${a + 1}
841
842
  h 1
842
843
  v -0.5
843
- a 0.5 0.5, 0, 0, 0, -1 0`, Z = (r, i) => `M ${r} ${i}
844
+ a 0.5 0.5, 0, 0, 0, -1 0`, Z = (o, a) => `M ${o} ${a}
844
845
  h 1
845
846
  v 0.5
846
- a 0.5 0.5, 0, 0, 1, -1 0`, Ot = (r, i, a) => `M ${r + 1} ${i}h -${a / 2}a ${a / 2.5} ${a / 2.5}, 0, 0, 0, ${-a / 2.5} ${a / 2.5}v ${a / 2}h ${a / 2}a ${a / 2.5} ${a / 2.5}, 0, 0, 0, ${a / 2.5} ${-a / 2.5}`, Tt = ({
847
- x: r,
848
- y: i,
849
- numCells: a
850
- }) => {
851
- var s, n, l;
852
- return !!((s = H[r]) != null && s[i] || (n = H[r - a + 7]) != null && n[i] || (l = H[r]) != null && l[i - a + 7]);
853
- }, Lt = ({
854
- x: r,
855
- y: i,
856
- radius: a
857
- }) => {
858
- const s = O - a, n = a / 2, l = O - n;
859
- return `M ${r} ${i + n}v ${s}a ${n} ${n}, 0, 0, 0, ${n} ${n}h ${l}v ${-l}a ${n} ${n}, 0, 0, 0, ${-n} ${-n}h ${-s}H ${r}z`;
860
- }, vt = ({
861
- x: r,
862
- y: i,
863
- radius: a
847
+ a 0.5 0.5, 0, 0, 1, -1 0`, vt = (o, a, c) => `M ${o + 1} ${a}h -${c / 2}a ${c / 2.5} ${c / 2.5}, 0, 0, 0, ${-c / 2.5} ${c / 2.5}v ${c / 2}h ${c / 2}a ${c / 2.5} ${c / 2.5}, 0, 0, 0, ${c / 2.5} ${-c / 2.5}`, St = ({
848
+ x: o,
849
+ y: a,
850
+ numCells: c
864
851
  }) => {
865
- const s = O - a, n = a / 2, l = O - n;
866
- return `M ${r} ${i + n}v ${s}a ${n} ${n}, 0, 0, 0, ${n} ${n}h ${l}v ${-l}a ${n} ${n}, 0, 0, 0, ${-n} ${-n}h ${-s}a ${n} ${n}, 0, 0, 0, ${-n} ${n}`;
867
- }, St = ({
868
- x: r,
869
- y: i,
870
- numCells: a
871
- }) => {
872
- var s, n, l;
873
- return !!((s = B[r]) != null && s[i] || (n = B[r - a + 7]) != null && n[i] || (l = B[r]) != null && l[i - a + 7]);
852
+ var i, r, u;
853
+ return !!((i = B[o]) != null && i[a] || (r = B[o - c + 7]) != null && r[a] || (u = B[o]) != null && u[a - c + 7]);
874
854
  }, Ut = ({
875
- x: r,
876
- y: i,
877
- radius: a
855
+ x: o,
856
+ y: a,
857
+ radius: c
878
858
  }) => {
879
- const s = g - a, n = a / 2;
880
- return `M ${r} ${i + n}v ${s}a ${n} ${n}, 0, 0, 0, ${n} ${n}h ${s}a ${n} ${n}, 0, 0, 0, ${n} ${-n}v ${-s}a ${n} ${n}, 0, 0, 0, ${-n} ${-n}h ${-s}a ${n} ${n}, 0, 0, 0, ${-n} ${n}M ${r + n} ${i + 1}h ${s}a ${n - 1} ${n - 1}, 0, 0, 1, ${n - 1} ${n - 1}v ${s}a ${n - 1} ${n - 1}, 0, 0, 1, ${-(n - 1)} ${n - 1}h ${-s}a ${n - 1} ${n - 1}, 0, 0, 1, ${-(n - 1)} ${-(n - 1)}v ${-s}a ${n - 1} ${n - 1}, 0, 0, 1, ${n - 1} ${-(n - 1)}`;
859
+ const i = T - c, r = c / 2, u = T - r;
860
+ return `M ${o} ${a + r}v ${i}a ${r} ${r}, 0, 0, 0, ${r} ${r}h ${u}v ${-u}a ${r} ${r}, 0, 0, 0, ${-r} ${-r}h ${-i}H ${o}z`;
881
861
  }, bt = ({
882
- x: r,
883
- y: i,
884
- radius: a
862
+ x: o,
863
+ y: a,
864
+ radius: c
885
865
  }) => {
886
- const s = g - a, n = a / 2, l = g - n;
887
- return `M ${r} ${i + n}v ${s}a ${n} ${n}, 0, 0, 0, ${n} ${n}h ${l}v ${-l}a ${n} ${n}, 0, 0, 0, ${-n} ${-n}h ${-s}H ${r}zM ${r + n} ${i + 1}h ${s}a ${n - 1} ${n - 1}, 0, 0, 1, ${n - 1} ${n - 1}v ${l - 1}h ${-(l - 1)}a ${n - 1} ${n - 1}, 0, 0, 1, ${-(n - 1)} ${-(n - 1)}v ${-(l - 1)}z`;
866
+ const i = T - c, r = c / 2, u = T - r;
867
+ return `M ${o} ${a + r}v ${i}a ${r} ${r}, 0, 0, 0, ${r} ${r}h ${u}v ${-u}a ${r} ${r}, 0, 0, 0, ${-r} ${-r}h ${-i}a ${r} ${r}, 0, 0, 0, ${-r} ${r}`;
888
868
  }, Dt = ({
889
- x: r,
890
- y: i,
891
- radius: a
869
+ x: o,
870
+ y: a,
871
+ numCells: c
872
+ }) => {
873
+ var i, r, u;
874
+ return !!((i = y[o]) != null && i[a] || (r = y[o - c + 7]) != null && r[a] || (u = y[o]) != null && u[a - c + 7]);
875
+ }, Ft = ({
876
+ x: o,
877
+ y: a,
878
+ radius: c
879
+ }) => {
880
+ const i = N - c, r = c / 2;
881
+ return `M ${o} ${a + r}v ${i}a ${r} ${r}, 0, 0, 0, ${r} ${r}h ${i}a ${r} ${r}, 0, 0, 0, ${r} ${-r}v ${-i}a ${r} ${r}, 0, 0, 0, ${-r} ${-r}h ${-i}a ${r} ${r}, 0, 0, 0, ${-r} ${r}M ${o + r} ${a + 1}h ${i}a ${r - 1} ${r - 1}, 0, 0, 1, ${r - 1} ${r - 1}v ${i}a ${r - 1} ${r - 1}, 0, 0, 1, ${-(r - 1)} ${r - 1}h ${-i}a ${r - 1} ${r - 1}, 0, 0, 1, ${-(r - 1)} ${-(r - 1)}v ${-i}a ${r - 1} ${r - 1}, 0, 0, 1, ${r - 1} ${-(r - 1)}`;
882
+ }, yt = ({
883
+ x: o,
884
+ y: a,
885
+ radius: c
892
886
  }) => {
893
- const s = g - a, n = a / 2, l = g - n;
894
- return `M ${r} ${i + n}v ${s}a ${n} ${n}, 0, 0, 0, ${n} ${n}h ${l}v ${-l}a ${n} ${n}, 0, 0, 0, ${-n} ${-n}h ${-s}a ${n} ${n}, 0, 0, 0, ${-n} ${n}M ${r + n} ${i + 1}h ${s}a ${n - 1} ${n - 1}, 0, 0, 1, ${n - 1} ${n - 1}v ${l - 1}h ${-(l - 1)}a ${n - 1} ${n - 1}, 0, 0, 1, ${-(n - 1)} ${-(n - 1)}v ${-s}a ${n - 1} ${n - 1}, 0, 0, 1, ${n - 1} ${-(n - 1)}`;
895
- }, yt = (r) => ({
896
- color: (r == null ? void 0 : r.color) || _,
897
- style: (r == null ? void 0 : r.style) || mt,
898
- randomSize: (r == null ? void 0 : r.randomSize) || !1
899
- }), Ft = (r) => ({
900
- color: (r == null ? void 0 : r.color) || _,
901
- style: (r == null ? void 0 : r.style) || ft
902
- }), Bt = (r) => ({
903
- color: (r == null ? void 0 : r.color) || _,
904
- style: (r == null ? void 0 : r.style) || pt
905
- }), Ht = ({
906
- modules: r,
907
- margin: i,
908
- settings: a,
909
- gradient: s
887
+ const i = N - c, r = c / 2, u = N - r;
888
+ return `M ${o} ${a + r}v ${i}a ${r} ${r}, 0, 0, 0, ${r} ${r}h ${u}v ${-u}a ${r} ${r}, 0, 0, 0, ${-r} ${-r}h ${-i}H ${o}zM ${o + r} ${a + 1}h ${i}a ${r - 1} ${r - 1}, 0, 0, 1, ${r - 1} ${r - 1}v ${u - 1}h ${-(u - 1)}a ${r - 1} ${r - 1}, 0, 0, 1, ${-(r - 1)} ${-(r - 1)}v ${-(u - 1)}z`;
889
+ }, Bt = ({
890
+ x: o,
891
+ y: a,
892
+ radius: c
910
893
  }) => {
911
- const { color: n, style: l, randomSize: d } = L(
912
- () => yt(a),
913
- [a]
914
- ), u = [], N = r.length, o = It(l) && d, t = it(
915
- () => Ct(l, o),
916
- [l, o]
894
+ const i = N - c, r = c / 2, u = N - r;
895
+ return `M ${o} ${a + r}v ${i}a ${r} ${r}, 0, 0, 0, ${r} ${r}h ${u}v ${-u}a ${r} ${r}, 0, 0, 0, ${-r} ${-r}h ${-i}a ${r} ${r}, 0, 0, 0, ${-r} ${r}M ${o + r} ${a + 1}h ${i}a ${r - 1} ${r - 1}, 0, 0, 1, ${r - 1} ${r - 1}v ${u - 1}h ${-(u - 1)}a ${r - 1} ${r - 1}, 0, 0, 1, ${-(r - 1)} ${-(r - 1)}v ${-i}a ${r - 1} ${r - 1}, 0, 0, 1, ${r - 1} ${-(r - 1)}`;
896
+ }, Ht = (o) => ({
897
+ color: (o == null ? void 0 : o.color) || H,
898
+ style: (o == null ? void 0 : o.style) || gt,
899
+ randomSize: (o == null ? void 0 : o.randomSize) || !1
900
+ }), _t = (o) => ({
901
+ color: (o == null ? void 0 : o.color) || H,
902
+ style: (o == null ? void 0 : o.style) || Mt
903
+ }), zt = (o) => ({
904
+ color: (o == null ? void 0 : o.color) || H,
905
+ style: (o == null ? void 0 : o.style) || Rt
906
+ }), Qt = ({
907
+ modules: o,
908
+ margin: a,
909
+ settings: c,
910
+ gradient: i,
911
+ gradientId: r
912
+ }) => {
913
+ const { color: u, style: l, randomSize: p } = v(
914
+ () => Ht(c),
915
+ [c]
916
+ ), f = [], e = o.length, n = At(l) && p, t = it(
917
+ () => Pt(l, n),
918
+ [l, n]
917
919
  );
918
- return r.forEach((e, c) => {
919
- e.forEach((h, f) => {
920
- if (St({ x: f, y: c, numCells: N }) || Tt({ x: f, y: c, numCells: N }))
920
+ return o.forEach((s, h) => {
921
+ s.forEach(($, d) => {
922
+ if (Dt({ x: d, y: h, numCells: e }) || St({ x: d, y: h, numCells: e }))
921
923
  return;
922
- const $ = t(), p = 1 * $, M = (1 - 1 * $) / 2, E = f + i + M, m = c + i + M;
923
- if (h) {
924
+ const R = t(), E = 1 * R, A = (1 - 1 * R) / 2, M = d + a + A, m = h + a + A;
925
+ if ($) {
924
926
  if (l === "square" || l === "square-sm")
925
- u.push(U(E, m, p));
927
+ f.push(b(M, m, E));
926
928
  else if (l === "pinched-square")
927
- u.push(ot(E, m, p, 0.25));
929
+ f.push(tt(M, m, E, 0.25));
928
930
  else if (l === "circle")
929
- u.push(y(E, m, p));
931
+ f.push(F(M, m, E));
930
932
  else if (l === "diamond")
931
- u.push(wt(E, m, p));
933
+ f.push(Ot(M, m, E));
932
934
  else if (l === "star")
933
- u.push(
934
- et(E + p / 2, m + p / 2, p * 1.1, W)
935
+ f.push(
936
+ J(M + E / 2, m + E / 2, E * 1.1, nt)
935
937
  );
936
938
  else if (l === "heart")
937
- u.push(rt(E, m, p));
939
+ f.push(ot(M, m, E));
938
940
  else if (l === "hashtag")
939
- u.push(nt(E, m, p));
941
+ f.push(et(M, m, E));
940
942
  else if (l === "rounded") {
941
- const { left: R, right: I, top: C, bottom: A, count: P } = D(f, c, r);
942
- P === 0 ? u.push(y(E, m, 1)) : P > 2 || R && I || C && A ? u.push(U(E, m, 1)) : P === 2 ? R && C ? u.push(G(E, m)) : C && I ? u.push(Pt(E, m)) : I && A ? u.push(Y(E, m)) : u.push(At(E, m)) : C ? u.push(Z(E, m)) : I ? u.push(V(E, m)) : A ? u.push(X(E, m)) : u.push(j(E, m));
943
+ const { left: g, right: I, top: w, bottom: P, count: O } = D(d, h, o);
944
+ O === 0 ? f.push(F(M, m, 1)) : O > 2 || g && I || w && P ? f.push(b(M, m, 1)) : O === 2 ? g && w ? f.push(G(M, m)) : w && I ? f.push(Lt(M, m)) : I && P ? f.push(Y(M, m)) : f.push(Tt(M, m)) : w ? f.push(Z(M, m)) : I ? f.push(V(M, m)) : P ? f.push(X(M, m)) : f.push(j(M, m));
943
945
  } else if (l === "leaf") {
944
- const { left: R, right: I, top: C, bottom: A, count: P } = D(f, c, r);
945
- if (P === 0)
946
- u.push(Ot(E, m, p));
947
- else if (!R && !C) {
948
- u.push(Y(E, m));
946
+ const { left: g, right: I, top: w, bottom: P, count: O } = D(d, h, o);
947
+ if (O === 0)
948
+ f.push(vt(M, m, E));
949
+ else if (!g && !w) {
950
+ f.push(Y(M, m));
949
951
  return;
950
- } else !I && !A ? u.push(G(E, m)) : u.push(U(E, m, 1));
952
+ } else !I && !P ? f.push(G(M, m)) : f.push(b(M, m, 1));
951
953
  } else if (l === "vertical-line") {
952
- const { left: R, right: I, top: C, bottom: A, count: P } = D(f, c, r);
953
- P === 0 || R && !(C || A) || I && !(C || A) ? u.push(y(E, m, 1)) : C && A ? u.push(U(E, m, 1)) : C && !A ? u.push(Z(E, m)) : A && !C && u.push(X(E, m));
954
+ const { left: g, right: I, top: w, bottom: P, count: O } = D(d, h, o);
955
+ O === 0 || g && !(w || P) || I && !(w || P) ? f.push(F(M, m, 1)) : w && P ? f.push(b(M, m, 1)) : w && !P ? f.push(Z(M, m)) : P && !w && f.push(X(M, m));
954
956
  } else if (l === "horizontal-line") {
955
- const { left: R, right: I, top: C, bottom: A, count: P } = D(f, c, r);
956
- P === 0 || C && !(R || I) || A && !(R || I) ? u.push(y(E, m, 1)) : R && I ? u.push(U(E, m, 1)) : R && !I ? u.push(j(E, m)) : I && !R && u.push(V(E, m));
957
+ const { left: g, right: I, top: w, bottom: P, count: O } = D(d, h, o);
958
+ O === 0 || w && !(g || I) || P && !(g || I) ? f.push(F(M, m, 1)) : g && I ? f.push(b(M, m, 1)) : g && !I ? f.push(j(M, m)) : I && !g && f.push(V(M, m));
957
959
  }
958
960
  }
959
961
  });
960
- }), /* @__PURE__ */ w(
962
+ }), /* @__PURE__ */ C(
961
963
  "path",
962
964
  {
963
- fill: s ? `url(#${b})` : n,
964
- d: u.join(""),
965
+ fill: i ? `url(#${r})` : u,
966
+ d: f.join(""),
965
967
  shapeRendering: l === "square" ? "crispEdges" : "geometricPrecision",
966
968
  "data-testid": "data-modules"
967
969
  }
968
970
  );
969
- }, T = {
971
+ }, L = {
970
972
  "data-testid": "finder-patterns-inner"
971
- }, _t = ({
972
- modules: r,
973
- margin: i,
974
- settings: a,
975
- gradient: s
973
+ }, kt = ({
974
+ modules: o,
975
+ margin: a,
976
+ settings: c,
977
+ gradient: i,
978
+ gradientId: r
976
979
  }) => {
977
- const { color: n, style: l } = L(
978
- () => Bt(a),
979
- [a]
980
- ), d = s ? `url(#${b})` : n, u = L(
980
+ const { color: u, style: l } = v(
981
+ () => zt(c),
982
+ [c]
983
+ ), p = i ? `url(#${r})` : u, f = v(
981
984
  () => [
982
- { x: i + 2, y: i + 2 },
983
- { x: r.length + i - g + 2, y: i + 2 },
984
- { x: i + 2, y: r.length + i - g + 2 }
985
+ { x: a + 2, y: a + 2 },
986
+ { x: o.length + a - N + 2, y: a + 2 },
987
+ { x: a + 2, y: o.length + a - N + 2 }
985
988
  ],
986
- [i, r.length]
987
- ), N = (o, t) => `finder-patterns-inner-${l}-${o}-${t}`;
989
+ [a, o.length]
990
+ ), e = (n, t) => `finder-patterns-inner-${l}-${n}-${t}`;
988
991
  if (l === "rounded-sm" || l === "rounded" || l === "rounded-lg" || l === "circle" || l === "square")
989
- return u.map((o) => {
990
- const { x: t, y: e } = o;
991
- return /* @__PURE__ */ w(
992
+ return f.map((n) => {
993
+ const { x: t, y: s } = n;
994
+ return /* @__PURE__ */ C(
992
995
  "rect",
993
996
  {
994
997
  x: t,
995
- y: e,
996
- width: O,
997
- height: O,
998
- fill: d,
999
- rx: k[l],
1000
- ...T
998
+ y: s,
999
+ width: T,
1000
+ height: T,
1001
+ fill: p,
1002
+ rx: q[l],
1003
+ ...L
1001
1004
  },
1002
- N(t, e)
1005
+ e(t, s)
1003
1006
  );
1004
1007
  });
1005
1008
  if (l === "pinched-square")
1006
- return u.map((o) => {
1007
- const { x: t, y: e } = o, c = ot(t, e, O, 0.25);
1008
- return /* @__PURE__ */ w("path", { fill: d, d: c, ...T }, N(t, e));
1009
+ return f.map((n) => {
1010
+ const { x: t, y: s } = n, h = tt(t, s, T, 0.25);
1011
+ return /* @__PURE__ */ C("path", { fill: p, d: h, ...L }, e(t, s));
1009
1012
  });
1010
1013
  if (l === "diamond")
1011
- return u.map((o) => {
1012
- const { x: t, y: e } = o, c = Math.sqrt(1.5), h = O / c, f = h - h / c;
1013
- return /* @__PURE__ */ w(
1014
+ return f.map((n) => {
1015
+ const { x: t, y: s } = n, h = Math.sqrt(1.5), $ = T / h, d = $ - $ / h;
1016
+ return /* @__PURE__ */ C(
1014
1017
  "rect",
1015
1018
  {
1016
- x: t + f / 2,
1017
- y: e + f / 2,
1018
- width: h,
1019
- height: h,
1020
- fill: d,
1019
+ x: t + d / 2,
1020
+ y: s + d / 2,
1021
+ width: $,
1022
+ height: $,
1023
+ fill: p,
1021
1024
  style: {
1022
1025
  transform: "rotate(45deg)",
1023
1026
  transformOrigin: "center",
1024
1027
  transformBox: "fill-box"
1025
1028
  },
1026
- ...T
1029
+ ...L
1027
1030
  },
1028
- N(t, e)
1031
+ e(t, s)
1029
1032
  );
1030
1033
  });
1031
1034
  if (l === "inpoint-sm" || l === "inpoint" || l === "inpoint-lg" || l === "outpoint-sm" || l === "outpoint" || l === "outpoint-lg" || l === "leaf-sm" || l === "leaf" || l === "leaf-lg") {
1032
- const o = l === "leaf-sm" || l === "leaf" || l === "leaf-lg" ? Lt : vt;
1033
- return u.map((t, e) => ({
1035
+ const n = l === "leaf-sm" || l === "leaf" || l === "leaf-lg" ? Ut : bt;
1036
+ return f.map((t, s) => ({
1034
1037
  ...t,
1035
- rotation: J[l][e]
1036
- })).map(({ x: t, y: e, rotation: c }) => {
1037
- const h = o({
1038
+ rotation: rt[l][s]
1039
+ })).map(({ x: t, y: s, rotation: h }) => {
1040
+ const $ = n({
1038
1041
  x: t,
1039
- y: e,
1040
- radius: k[l]
1042
+ y: s,
1043
+ radius: q[l]
1041
1044
  });
1042
- return /* @__PURE__ */ w(
1045
+ return /* @__PURE__ */ C(
1043
1046
  "path",
1044
1047
  {
1045
- fill: d,
1046
- d: h,
1048
+ fill: p,
1049
+ d: $,
1047
1050
  style: {
1048
- transform: `rotate(${c}deg)`,
1051
+ transform: `rotate(${h}deg)`,
1049
1052
  transformOrigin: "center",
1050
1053
  transformBox: "fill-box"
1051
1054
  },
1052
- ...T
1055
+ ...L
1053
1056
  },
1054
- N(t, e)
1057
+ e(t, s)
1055
1058
  );
1056
1059
  });
1057
1060
  }
1058
1061
  if (l === "heart")
1059
- return u.map(({ x: o, y: t }) => /* @__PURE__ */ w(
1062
+ return f.map(({ x: n, y: t }) => /* @__PURE__ */ C(
1060
1063
  "path",
1061
1064
  {
1062
- fill: d,
1063
- d: rt(o, t, O),
1064
- ...T
1065
+ fill: p,
1066
+ d: ot(n, t, T),
1067
+ ...L
1065
1068
  },
1066
- N(o, t)
1069
+ e(n, t)
1067
1070
  ));
1068
1071
  if (l === "star")
1069
- return u.map(({ x: o, y: t }) => {
1070
- const e = o + O / 2, c = t + O / 2, h = et(e, c, O * 1.2, W);
1071
- return /* @__PURE__ */ w("path", { fill: d, d: h, ...T }, N(o, t));
1072
+ return f.map(({ x: n, y: t }) => {
1073
+ const s = n + T / 2, h = t + T / 2, $ = J(s, h, T * 1.2, nt);
1074
+ return /* @__PURE__ */ C("path", { fill: p, d: $, ...L }, e(n, t));
1072
1075
  });
1073
1076
  if (l === "hashtag")
1074
- return u.map(({ x: o, y: t }) => {
1075
- const e = nt(o - 0.25, t - 0.25, 3.5);
1076
- return /* @__PURE__ */ w("path", { fill: d, d: e, ...T }, N(o, t));
1077
+ return f.map(({ x: n, y: t }) => {
1078
+ const s = et(n - 0.25, t - 0.25, 3.5);
1079
+ return /* @__PURE__ */ C("path", { fill: p, d: s, ...L }, e(n, t));
1077
1080
  });
1078
1081
  }, x = {
1079
1082
  "data-testid": "finder-patterns-outer"
1080
- }, zt = ({
1081
- modules: r,
1082
- margin: i,
1083
- settings: a,
1084
- gradient: s
1083
+ }, qt = ({
1084
+ modules: o,
1085
+ margin: a,
1086
+ settings: c,
1087
+ gradient: i,
1088
+ gradientId: r
1085
1089
  }) => {
1086
- const { style: n, color: l } = L(
1087
- () => Ft(a),
1088
- [a]
1089
- ), d = s ? `url(#${b})` : l, u = [], N = L(
1090
+ const { style: u, color: l } = v(
1091
+ () => _t(c),
1092
+ [c]
1093
+ ), p = i ? `url(#${r})` : l, f = [], e = v(
1090
1094
  () => [
1091
- { x: i, y: i },
1092
- { x: r.length + i - g, y: i },
1093
- { x: i, y: r.length + i - g }
1095
+ { x: a, y: a },
1096
+ { x: o.length + a - N, y: a },
1097
+ { x: a, y: o.length + a - N }
1094
1098
  ],
1095
- [i, r.length]
1099
+ [a, o.length]
1096
1100
  );
1097
1101
  if ([
1098
1102
  "rounded-sm",
@@ -1101,238 +1105,252 @@ const tt = (r) => {
1101
1105
  "circle",
1102
1106
  "square",
1103
1107
  "pinched-square"
1104
- ].includes(n)) {
1105
- for (const o of N) {
1106
- const { x: t, y: e } = o;
1107
- n === "rounded-sm" || n === "rounded" || n === "rounded-lg" ? u.push(
1108
- Ut({
1108
+ ].includes(u)) {
1109
+ for (const n of e) {
1110
+ const { x: t, y: s } = n;
1111
+ u === "rounded-sm" || u === "rounded" || u === "rounded-lg" ? f.push(
1112
+ Ft({
1109
1113
  x: t,
1110
- y: e,
1111
- radius: Q[n]
1114
+ y: s,
1115
+ radius: k[u]
1112
1116
  })
1113
- ) : n === "circle" ? u.push(
1114
- `M ${t + g / 2} ${e}a ${g / 2} ${g / 2} 0 1 0 0.01 0zzm 0 1a ${g / 2 - 1} ${g / 2 - 1} 0 1 1 -0.01 0Z`
1115
- ) : n === "pinched-square" ? u.push(
1116
- `M ${t} ${e}Q ${t + 0.5} ${e + g / 2}, ${t} ${e + g}Q ${t + g / 2} ${e + g - 0.5}, ${t + g} ${e + g}Q ${t + g - 0.5} ${e + g / 2}, ${t + g} ${e}Q ${t + g / 2} ${e + 0.5}, ${t} ${e}zM ${t + 1} ${e + 1}Q ${t + g / 2} ${e + 1.25}, ${t + g - 1} ${e + 1}Q ${t + g - 1.25} ${e + g / 2}, ${t + g - 1} ${e + g - 1}Q ${t + g / 2} ${e + g - 1.25}, ${t + 1} ${e + g - 1}Q ${t + 1.25} ${e + g / 2}, ${t + 1} ${e + 1}z`
1117
- ) : u.push(
1118
- `M ${t} ${e}v ${g}h ${g}v -7zM ${t + 1} ${e + 1}h ${g - 2}v ${g - 2}h -5z`
1117
+ ) : u === "circle" ? f.push(
1118
+ `M ${t + N / 2} ${s}a ${N / 2} ${N / 2} 0 1 0 0.01 0zzm 0 1a ${N / 2 - 1} ${N / 2 - 1} 0 1 1 -0.01 0Z`
1119
+ ) : u === "pinched-square" ? f.push(
1120
+ `M ${t} ${s}Q ${t + 0.5} ${s + N / 2}, ${t} ${s + N}Q ${t + N / 2} ${s + N - 0.5}, ${t + N} ${s + N}Q ${t + N - 0.5} ${s + N / 2}, ${t + N} ${s}Q ${t + N / 2} ${s + 0.5}, ${t} ${s}zM ${t + 1} ${s + 1}Q ${t + N / 2} ${s + 1.25}, ${t + N - 1} ${s + 1}Q ${t + N - 1.25} ${s + N / 2}, ${t + N - 1} ${s + N - 1}Q ${t + N / 2} ${s + N - 1.25}, ${t + 1} ${s + N - 1}Q ${t + 1.25} ${s + N / 2}, ${t + 1} ${s + 1}z`
1121
+ ) : f.push(
1122
+ `M ${t} ${s}v ${N}h ${N}v -7zM ${t + 1} ${s + 1}h ${N - 2}v ${N - 2}h -5z`
1119
1123
  );
1120
1124
  }
1121
- return /* @__PURE__ */ w("path", { fill: d, d: u.join(""), ...x });
1125
+ return /* @__PURE__ */ C("path", { fill: p, d: f.join(""), ...x });
1122
1126
  }
1123
- if (n === "inpoint-sm" || n === "inpoint" || n === "inpoint-lg" || n === "outpoint-sm" || n === "outpoint" || n === "outpoint-lg" || n === "leaf-sm" || n === "leaf" || n === "leaf-lg") {
1124
- const o = n === "leaf-sm" || n === "leaf" || n === "leaf-lg" ? bt : Dt;
1125
- return N.map((t, e) => ({
1127
+ if (u === "inpoint-sm" || u === "inpoint" || u === "inpoint-lg" || u === "outpoint-sm" || u === "outpoint" || u === "outpoint-lg" || u === "leaf-sm" || u === "leaf" || u === "leaf-lg") {
1128
+ const n = u === "leaf-sm" || u === "leaf" || u === "leaf-lg" ? yt : Bt;
1129
+ return e.map((t, s) => ({
1126
1130
  ...t,
1127
- rotation: J[n][e]
1128
- })).map(({ x: t, y: e, rotation: c }) => {
1129
- const h = o({
1131
+ rotation: rt[u][s]
1132
+ })).map(({ x: t, y: s, rotation: h }) => {
1133
+ const $ = n({
1130
1134
  x: t,
1131
- y: e,
1132
- radius: Q[n]
1135
+ y: s,
1136
+ radius: k[u]
1133
1137
  });
1134
- return /* @__PURE__ */ w(
1138
+ return /* @__PURE__ */ C(
1135
1139
  "path",
1136
1140
  {
1137
- fill: d,
1138
- d: h,
1141
+ fill: p,
1142
+ d: $,
1139
1143
  style: {
1140
- transform: `rotate(${c}deg)`,
1144
+ transform: `rotate(${h}deg)`,
1141
1145
  transformOrigin: "center",
1142
1146
  transformBox: "fill-box"
1143
1147
  },
1144
1148
  ...x
1145
1149
  },
1146
- `finder-patterns-outer-${n}-${t}-${e}`
1150
+ `finder-patterns-outer-${u}-${t}-${s}`
1147
1151
  );
1148
1152
  });
1149
1153
  }
1150
- }, Qt = ({ gradient: r }) => {
1151
- var a, s;
1152
- if (!r)
1154
+ }, Yt = ({ gradient: o, gradientId: a }) => {
1155
+ var i, r;
1156
+ if (!o)
1153
1157
  return null;
1154
- const i = tt((r == null ? void 0 : r.rotation) || 0);
1155
- return /* @__PURE__ */ w("defs", { children: r.type === "linear" ? /* @__PURE__ */ w("linearGradient", { id: b, gradientUnits: "userSpaceOnUse", ...i, children: (a = r.stops) == null ? void 0 : a.map((n, l) => /* @__PURE__ */ w("stop", { offset: n.offset, stopColor: n.color }, l)) }) : /* @__PURE__ */ w(
1158
+ const c = W((o == null ? void 0 : o.rotation) || 0);
1159
+ return /* @__PURE__ */ C("defs", { children: o.type === "linear" ? /* @__PURE__ */ C("linearGradient", { id: a, gradientUnits: "userSpaceOnUse", ...c, children: (i = o.stops) == null ? void 0 : i.map((u, l) => /* @__PURE__ */ C("stop", { offset: u.offset, stopColor: u.color }, l)) }) : /* @__PURE__ */ C(
1156
1160
  "radialGradient",
1157
1161
  {
1158
- id: b,
1162
+ id: a,
1159
1163
  gradientUnits: "userSpaceOnUse",
1160
1164
  cx: "50%",
1161
1165
  cy: "50%",
1162
1166
  r: "50%",
1163
- children: (s = r.stops) == null ? void 0 : s.map((n, l) => /* @__PURE__ */ w("stop", { offset: n.offset, stopColor: n.color }, l))
1167
+ children: (r = o.stops) == null ? void 0 : r.map((u, l) => /* @__PURE__ */ C("stop", { offset: u.offset, stopColor: u.color }, l))
1164
1168
  }
1165
1169
  ) });
1166
- }, kt = (r, i) => r.slice().map((a, s) => s < i.y || s >= i.y + i.h ? a : a.map((n, l) => l < i.x || l >= i.x + i.w ? n : !1)), qt = (r, i, a, s) => {
1167
- if (s == null)
1170
+ }, Gt = () => {
1171
+ const o = at();
1172
+ return {
1173
+ gradientId: `${It}-${o}`,
1174
+ bgGradientId: `${Ct}-${o}`
1175
+ };
1176
+ }, jt = (o, a) => o.slice().map((c, i) => i < a.y || i >= a.y + a.h ? c : c.map((r, u) => u < a.x || u >= a.x + a.w ? r : !1)), Vt = (o, a, c, i) => {
1177
+ if (i == null)
1168
1178
  return null;
1169
- const n = r.length + a * 2, l = Math.floor(i * Mt), d = n / i, u = (s.width || l) * d, N = (s.height || l) * d, o = s.x == null ? r.length / 2 - u / 2 : s.x * d, t = s.y == null ? r.length / 2 - N / 2 : s.y * d, e = s.opacity == null ? 1 : s.opacity;
1170
- let c = null;
1171
- if (s.excavate) {
1172
- const f = Math.floor(o), $ = Math.floor(t), p = Math.ceil(u + o - f), M = Math.ceil(N + t - $);
1173
- c = { x: f, y: $, w: p, h: M };
1179
+ const r = o.length + c * 2, u = Math.floor(a * wt), l = r / a, p = (i.width || u) * l, f = (i.height || u) * l, e = i.x == null ? o.length / 2 - p / 2 : i.x * l, n = i.y == null ? o.length / 2 - f / 2 : i.y * l, t = i.opacity == null ? 1 : i.opacity;
1180
+ let s = null;
1181
+ if (i.excavate) {
1182
+ const $ = Math.floor(e), d = Math.floor(n), R = Math.ceil(p + e - $), E = Math.ceil(f + n - d);
1183
+ s = { x: $, y: d, w: R, h: E };
1174
1184
  }
1175
- const h = s.crossOrigin;
1176
- return { x: o, y: t, h: N, w: u, excavation: c, opacity: e, crossOrigin: h };
1177
- }, Yt = (r) => r != null ? Math.max(Math.floor(r), 0) : $t, Gt = ({
1178
- value: r,
1179
- level: i,
1180
- minVersion: a,
1181
- marginSize: s,
1182
- imageSettings: n,
1183
- size: l,
1184
- boostLevel: d
1185
+ const h = i.crossOrigin;
1186
+ return { x: e, y: n, h: f, w: p, excavation: s, opacity: t, crossOrigin: h };
1187
+ }, Xt = (o) => o != null ? Math.max(Math.floor(o), 0) : Et, Zt = ({
1188
+ value: o,
1189
+ level: a,
1190
+ minVersion: c,
1191
+ marginSize: i,
1192
+ imageSettings: r,
1193
+ size: u,
1194
+ boostLevel: l
1185
1195
  }) => {
1186
- const u = L(() => {
1187
- const h = (Array.isArray(r) ? r : [r]).reduce((f, $) => (f.push(...S.QrSegment.makeSegments($)), f), []);
1188
- return S.QrCode.encodeSegments(
1196
+ const p = v(() => {
1197
+ const h = (Array.isArray(o) ? o : [o]).reduce(($, d) => ($.push(...U.QrSegment.makeSegments(d)), $), []);
1198
+ return U.QrCode.encodeSegments(
1189
1199
  h,
1190
- lt[i],
1191
- a,
1200
+ $t[a],
1201
+ c,
1192
1202
  void 0,
1193
1203
  void 0,
1194
- d
1204
+ l
1195
1205
  );
1196
- }, [r, i, a, d]), { cells: N, margin: o, numCells: t, calculatedImageSettings: e } = L(() => {
1197
- const c = u.getModules(), h = Yt(s), f = c.length + h * 2, $ = qt(c, l, h, n);
1206
+ }, [o, a, c, l]), { cells: f, margin: e, numCells: n, calculatedImageSettings: t } = v(() => {
1207
+ const s = p.getModules(), h = Xt(i), $ = s.length + h * 2, d = Vt(s, u, h, r);
1198
1208
  return {
1199
- cells: c,
1209
+ cells: s,
1200
1210
  margin: h,
1201
- numCells: f,
1202
- calculatedImageSettings: $
1211
+ numCells: $,
1212
+ calculatedImageSettings: d
1203
1213
  };
1204
- }, [u, l, n, s]);
1214
+ }, [p, u, r, i]);
1205
1215
  return {
1206
- qrcode: u,
1207
- margin: o,
1208
- cells: N,
1209
- numCells: t,
1210
- calculatedImageSettings: e
1216
+ qrcode: p,
1217
+ margin: e,
1218
+ cells: f,
1219
+ numCells: n,
1220
+ calculatedImageSettings: t
1211
1221
  };
1212
- }, jt = ({ svgRef: r, fileSize: i, fileName: a }) => {
1213
- if (!r.current) return;
1214
- const s = r.current.cloneNode(!0);
1215
- s.setAttribute("width", i.toString()), s.setAttribute("height", i.toString());
1216
- const n = new XMLSerializer(), l = new Blob([n.serializeToString(s)], {
1222
+ }, xt = ({ svgRef: o, fileSize: a, fileName: c }) => {
1223
+ if (!o.current) return;
1224
+ const i = o.current.cloneNode(!0);
1225
+ i.setAttribute("width", a.toString()), i.setAttribute("height", a.toString());
1226
+ const r = new XMLSerializer(), u = new Blob([r.serializeToString(i)], {
1217
1227
  type: "image/svg+xml"
1218
- }), d = URL.createObjectURL(l), u = document.createElement("a");
1219
- u.href = d, u.download = `${a}.svg`, document.body.appendChild(u), u.click(), document.body.removeChild(u), URL.revokeObjectURL(d);
1220
- }, Vt = ({
1221
- svgRef: r,
1222
- fileSize: i,
1223
- fileName: a,
1224
- fileFormat: s,
1225
- imageSettings: n,
1226
- calculatedImageSettings: l,
1227
- size: d,
1228
- numCells: u,
1229
- margin: N
1228
+ }), l = URL.createObjectURL(u), p = document.createElement("a");
1229
+ p.href = l, p.download = `${c}.svg`, document.body.appendChild(p), p.click(), document.body.removeChild(p), URL.revokeObjectURL(l);
1230
+ }, Kt = ({
1231
+ svgRef: o,
1232
+ fileSize: a,
1233
+ fileName: c,
1234
+ fileFormat: i,
1235
+ imageSettings: r,
1236
+ calculatedImageSettings: u,
1237
+ size: l,
1238
+ numCells: p,
1239
+ margin: f
1230
1240
  }) => {
1231
- if (!r.current) return;
1232
- const o = document.createElement("canvas"), t = o.getContext("2d");
1233
- if (!t) return;
1234
- o.width = i, o.height = i;
1235
- const e = new XMLSerializer().serializeToString(r.current), c = new Blob([e], { type: "image/svg+xml;charset=utf-8" }), h = URL.createObjectURL(c), f = new Image();
1236
- f.crossOrigin = "anonymous", f.src = h, f.onload = () => {
1237
- if (t.drawImage(f, 0, 0, i, i), URL.revokeObjectURL(h), n != null && n.src && l) {
1238
- const $ = new Image();
1239
- $.crossOrigin = "anonymous", $.src = n.src, $.onload = () => {
1240
- const p = i / d, M = u / i, E = n.width * p, m = n.x ? (l.x + N) / M : (i - E) / 2, R = n.y ? (l.y + N) / M : (i - E) / 2;
1241
- t.drawImage($, m, R, E, E);
1242
- const I = s === "png" ? "image/png" : "image/jpeg", C = document.createElement("a");
1243
- C.href = o.toDataURL(I), C.download = `${a}.${s}`, document.body.appendChild(C), C.click(), document.body.removeChild(C);
1244
- }, $.onerror = (p) => console.error("Error loading logo:", p);
1241
+ if (!o.current) return;
1242
+ const e = document.createElement("canvas"), n = e.getContext("2d");
1243
+ if (!n) return;
1244
+ e.width = a, e.height = a;
1245
+ const t = new XMLSerializer().serializeToString(o.current), s = new Blob([t], { type: "image/svg+xml;charset=utf-8" }), h = URL.createObjectURL(s), $ = new Image();
1246
+ $.crossOrigin = "anonymous", $.src = h, $.onload = () => {
1247
+ if (n.drawImage($, 0, 0, a, a), URL.revokeObjectURL(h), r != null && r.src && u) {
1248
+ const d = new Image();
1249
+ d.crossOrigin = "anonymous", d.src = r.src, d.onload = () => {
1250
+ const R = a / l, E = p / a, A = r.width * R, M = r.x ? (u.x + f) / E : (a - A) / 2, m = r.y ? (u.y + f) / E : (a - A) / 2;
1251
+ n.drawImage(d, M, m, A, A);
1252
+ const g = i === "png" ? "image/png" : "image/jpeg", I = document.createElement("a");
1253
+ I.href = e.toDataURL(g), I.download = `${c}.${i}`, document.body.appendChild(I), I.click(), document.body.removeChild(I);
1254
+ }, d.onerror = (R) => console.error("Error loading logo:", R);
1245
1255
  } else {
1246
- const $ = s === "png" ? "image/png" : "image/jpeg", p = document.createElement("a");
1247
- p.href = o.toDataURL($), p.download = `${a}.${s}`, document.body.appendChild(p), p.click(), document.body.removeChild(p);
1256
+ const d = i === "png" ? "image/png" : "image/jpeg", R = document.createElement("a");
1257
+ R.href = e.toDataURL(d), R.download = `${c}.${i}`, document.body.appendChild(R), R.click(), document.body.removeChild(R);
1248
1258
  }
1249
- }, f.onerror = ($) => console.error("Error loading QR code:", $);
1250
- }, Xt = (r) => {
1259
+ }, $.onerror = (d) => console.error("Error loading QR code:", d);
1260
+ }, Wt = (o) => {
1251
1261
  const {
1252
- ref: i,
1253
- value: a,
1254
- size: s = ht,
1255
- level: n = ut,
1256
- background: l,
1257
- gradient: d,
1258
- minVersion: u = dt,
1259
- boostLevel: N,
1260
- marginSize: o,
1261
- finderPatternOuterSettings: t,
1262
- finderPatternInnerSettings: e,
1263
- dataModulesSettings: c,
1262
+ ref: a,
1263
+ value: c,
1264
+ size: i = ft,
1265
+ level: r = pt,
1266
+ background: u,
1267
+ gradient: l,
1268
+ minVersion: p = mt,
1269
+ boostLevel: f,
1270
+ marginSize: e,
1271
+ finderPatternOuterSettings: n,
1272
+ finderPatternInnerSettings: t,
1273
+ dataModulesSettings: s,
1264
1274
  imageSettings: h,
1265
- svgProps: f
1266
- } = r, $ = at(null), { margin: p, cells: M, numCells: E, calculatedImageSettings: m } = Gt({
1267
- value: a,
1268
- level: n,
1269
- minVersion: u,
1270
- boostLevel: N,
1271
- marginSize: o,
1275
+ svgProps: $
1276
+ } = o, d = ct(null), { gradientId: R, bgGradientId: E } = Gt(), { margin: A, cells: M, numCells: m, calculatedImageSettings: g } = Zt({
1277
+ value: c,
1278
+ level: r,
1279
+ minVersion: p,
1280
+ boostLevel: f,
1281
+ marginSize: e,
1272
1282
  imageSettings: h,
1273
- size: s
1283
+ size: i
1274
1284
  });
1275
- ct(i, () => ({
1276
- svg: $.current,
1285
+ lt(a, () => ({
1286
+ svg: d.current,
1277
1287
  download: ({
1278
- name: A = Et,
1279
- format: P = "svg",
1288
+ name: O = Nt,
1289
+ format: _ = "svg",
1280
1290
  size: z = 500
1281
1291
  }) => {
1282
- $.current && (P === "svg" ? jt({ svgRef: $, fileSize: z, fileName: A }) : Vt({
1283
- svgRef: $,
1292
+ d.current && (_ === "svg" ? xt({ svgRef: d, fileSize: z, fileName: O }) : Kt({
1293
+ svgRef: d,
1284
1294
  fileSize: z,
1285
- fileName: A,
1286
- fileFormat: P,
1295
+ fileName: O,
1296
+ fileFormat: _,
1287
1297
  imageSettings: h,
1288
- calculatedImageSettings: m,
1289
- size: s,
1290
- numCells: E,
1291
- margin: p
1298
+ calculatedImageSettings: g,
1299
+ size: i,
1300
+ numCells: m,
1301
+ margin: A
1292
1302
  }));
1293
1303
  }
1294
1304
  }));
1295
- let R = M, I = null;
1296
- h != null && m != null && (m.excavation != null && (R = kt(M, m.excavation)), I = /* @__PURE__ */ w(
1305
+ let I = M, w = null;
1306
+ h != null && g != null && (g.excavation != null && (I = jt(M, g.excavation)), w = /* @__PURE__ */ C(
1297
1307
  "image",
1298
1308
  {
1299
1309
  href: h.src,
1300
- height: m.h,
1301
- width: m.w,
1302
- x: m.x + p,
1303
- y: m.y + p,
1310
+ height: g.h,
1311
+ width: g.w,
1312
+ x: g.x + A,
1313
+ y: g.y + A,
1304
1314
  preserveAspectRatio: "none",
1305
- opacity: m.opacity,
1306
- crossOrigin: m.crossOrigin
1315
+ opacity: g.opacity,
1316
+ crossOrigin: g.crossOrigin
1307
1317
  }
1308
1318
  ));
1309
- const C = {
1310
- modules: R,
1311
- margin: p,
1312
- gradient: d
1319
+ const P = {
1320
+ modules: I,
1321
+ margin: A,
1322
+ gradient: l,
1323
+ gradientId: R
1313
1324
  };
1314
1325
  return /* @__PURE__ */ K(
1315
1326
  "svg",
1316
1327
  {
1317
- height: s,
1318
- width: s,
1319
- viewBox: `0 0 ${E} ${E}`,
1320
- ref: $,
1328
+ height: i,
1329
+ width: i,
1330
+ viewBox: `0 0 ${m} ${m}`,
1331
+ ref: d,
1321
1332
  role: "img",
1322
- "aria-label": (f == null ? void 0 : f["aria-label"]) || "QR Code",
1323
- ...f,
1333
+ "aria-label": ($ == null ? void 0 : $["aria-label"]) || "QR Code",
1334
+ ...$,
1324
1335
  children: [
1325
- /* @__PURE__ */ w(Qt, { gradient: d }),
1326
- /* @__PURE__ */ w(Nt, { background: l, numCells: E }),
1327
- /* @__PURE__ */ w(zt, { settings: t, ...C }),
1328
- /* @__PURE__ */ w(_t, { settings: e, ...C }),
1329
- /* @__PURE__ */ w(Ht, { settings: c, ...C }),
1330
- I
1336
+ /* @__PURE__ */ C(Yt, { gradient: l, gradientId: R }),
1337
+ /* @__PURE__ */ C(
1338
+ dt,
1339
+ {
1340
+ background: u,
1341
+ bgGradientId: E,
1342
+ numCells: m
1343
+ }
1344
+ ),
1345
+ /* @__PURE__ */ C(qt, { settings: n, ...P }),
1346
+ /* @__PURE__ */ C(kt, { settings: t, ...P }),
1347
+ /* @__PURE__ */ C(Qt, { settings: s, ...P }),
1348
+ w
1331
1349
  ]
1332
1350
  }
1333
1351
  );
1334
1352
  };
1335
- Xt.displayName = "ReactQRCode";
1353
+ Wt.displayName = "ReactQRCode";
1336
1354
  export {
1337
- Xt as ReactQRCode
1355
+ Wt as ReactQRCode
1338
1356
  };