@lydianpay/sdk-web 3.13.0 → 3.14.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,1365 @@
1
+ import { r as xt, c as st, h as _, g as Ct } from "./index-FAg0du7P.js";
2
+ const It = {
3
+ fontFamily: '"Euclid Circular B", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
4
+ }, Nt = ({ className: A }, B) => _("div", { style: It, class: A }, B), Dt = () => _(
5
+ "svg",
6
+ { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
7
+ _("path", { d: "M10.4249 12.6668C10.0613 12.6668 9.81883 12.4002 9.81883 12.0002C9.81883 11.6002 10.0613 11.3335 10.4249 11.3335C12.1219 11.3335 13.4552 9.86683 13.4552 8.00016C13.4552 6.1335 12.1219 4.66683 10.4249 4.66683C8.72792 4.66683 7.39459 6.1335 7.39459 8.00016C7.39459 8.40016 7.15217 8.66683 6.78853 8.66683C6.42489 8.66683 6.18247 8.40016 6.18247 8.00016C6.18247 5.40016 8.06126 3.3335 10.4249 3.3335C12.7885 3.3335 14.6673 5.40016 14.6673 8.00016C14.6673 10.6002 12.7885 12.6668 10.4249 12.6668ZM5.4552 12.5335C3.15217 12.5335 1.33398 10.4668 1.33398 8.00016C1.33398 5.5335 3.15217 3.46683 5.4552 3.46683C5.81883 3.46683 6.06126 3.7335 6.06126 4.1335C6.06126 4.5335 5.81883 4.80016 5.4552 4.80016C3.81883 4.80016 2.54611 6.26683 2.54611 8.00016C2.54611 9.7335 3.81883 11.2002 5.4552 11.2002C7.09156 11.2002 8.36429 9.80016 8.36429 8.00016C8.36429 7.60016 8.60671 7.3335 8.97035 7.3335C9.33398 7.3335 9.57641 7.60016 9.57641 8.00016C9.5158 10.4668 7.69762 12.5335 5.4552 12.5335Z", fill: "white" })
8
+ ), Mt = Dt, Tt = () => _(
9
+ "svg",
10
+ { width: "12", height: "11", viewBox: "0 0 12 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
11
+ _("path", { d: "M1.25861 10.9543C1.08083 10.9543 0.962312 10.895 0.843793 10.7765C0.606756 10.5394 0.606756 10.1839 0.843793 9.94686L10.3253 0.465375C10.5623 0.228338 10.9179 0.228338 11.1549 0.465375C11.3919 0.702412 11.3919 1.05797 11.1549 1.295L1.67342 10.7765C1.5549 10.895 1.43639 10.9543 1.25861 10.9543Z", fill: "#141618" }),
12
+ _("path", { d: "M10.7401 10.9543C10.5623 10.9543 10.4438 10.895 10.3253 10.7765L0.843793 1.295C0.606756 1.05797 0.606756 0.702412 0.843793 0.465375C1.08083 0.228338 1.43639 0.228338 1.67342 0.465375L11.1549 9.94686C11.3919 10.1839 11.3919 10.5394 11.1549 10.7765C11.0364 10.895 10.9179 10.9543 10.7401 10.9543Z", fill: "#141618" })
13
+ ), St = Tt;
14
+ var Lt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
15
+ function jt(A) {
16
+ return A && A.__esModule && Object.prototype.hasOwnProperty.call(A, "default") ? A.default : A;
17
+ }
18
+ var Ot = { exports: {} };
19
+ (function(A, B) {
20
+ (function(j, X) {
21
+ A.exports = X();
22
+ })(Lt, (() => (() => {
23
+ var j = { 873: (R, U) => {
24
+ var W, gt, dt = (function() {
25
+ var J = function(g, h) {
26
+ var d = g, e = nt[h], t = null, n = 0, o = null, i = [], a = {}, f = function(r, l) {
27
+ t = (function(s) {
28
+ for (var c = new Array(s), u = 0; u < s; u += 1) {
29
+ c[u] = new Array(s);
30
+ for (var b = 0; b < s; b += 1) c[u][b] = null;
31
+ }
32
+ return c;
33
+ })(n = 4 * d + 17), p(0, 0), p(n - 7, 0), p(0, n - 7), w(), v(), m(r, l), d >= 7 && y(r), o == null && (o = I(d, e, i)), M(o, l);
34
+ }, p = function(r, l) {
35
+ for (var s = -1; s <= 7; s += 1) if (!(r + s <= -1 || n <= r + s)) for (var c = -1; c <= 7; c += 1) l + c <= -1 || n <= l + c || (t[r + s][l + c] = 0 <= s && s <= 6 && (c == 0 || c == 6) || 0 <= c && c <= 6 && (s == 0 || s == 6) || 2 <= s && s <= 4 && 2 <= c && c <= 4);
36
+ }, v = function() {
37
+ for (var r = 8; r < n - 8; r += 1) t[r][6] == null && (t[r][6] = r % 2 == 0);
38
+ for (var l = 8; l < n - 8; l += 1) t[6][l] == null && (t[6][l] = l % 2 == 0);
39
+ }, w = function() {
40
+ for (var r = F.getPatternPosition(d), l = 0; l < r.length; l += 1) for (var s = 0; s < r.length; s += 1) {
41
+ var c = r[l], u = r[s];
42
+ if (t[c][u] == null) for (var b = -2; b <= 2; b += 1) for (var N = -2; N <= 2; N += 1) t[c + b][u + N] = b == -2 || b == 2 || N == -2 || N == 2 || b == 0 && N == 0;
43
+ }
44
+ }, y = function(r) {
45
+ for (var l = F.getBCHTypeNumber(d), s = 0; s < 18; s += 1) {
46
+ var c = !r && (l >> s & 1) == 1;
47
+ t[Math.floor(s / 3)][s % 3 + n - 8 - 3] = c;
48
+ }
49
+ for (s = 0; s < 18; s += 1) c = !r && (l >> s & 1) == 1, t[s % 3 + n - 8 - 3][Math.floor(s / 3)] = c;
50
+ }, m = function(r, l) {
51
+ for (var s = e << 3 | l, c = F.getBCHTypeInfo(s), u = 0; u < 15; u += 1) {
52
+ var b = !r && (c >> u & 1) == 1;
53
+ u < 6 ? t[u][8] = b : u < 8 ? t[u + 1][8] = b : t[n - 15 + u][8] = b;
54
+ }
55
+ for (u = 0; u < 15; u += 1) b = !r && (c >> u & 1) == 1, u < 8 ? t[8][n - u - 1] = b : u < 9 ? t[8][15 - u - 1 + 1] = b : t[8][15 - u - 1] = b;
56
+ t[n - 8][8] = !r;
57
+ }, M = function(r, l) {
58
+ for (var s = -1, c = n - 1, u = 7, b = 0, N = F.getMaskFunction(l), O = n - 1; O > 0; O -= 2) for (O == 6 && (O -= 1); ; ) {
59
+ for (var D = 0; D < 2; D += 1) if (t[c][O - D] == null) {
60
+ var T = !1;
61
+ b < r.length && (T = (r[b] >>> u & 1) == 1), N(c, O - D) && (T = !T), t[c][O - D] = T, (u -= 1) == -1 && (b += 1, u = 7);
62
+ }
63
+ if ((c += s) < 0 || n <= c) {
64
+ c -= s, s = -s;
65
+ break;
66
+ }
67
+ }
68
+ }, I = function(r, l, s) {
69
+ for (var c = pt.getRSBlocks(r, l), u = lt(), b = 0; b < s.length; b += 1) {
70
+ var N = s[b];
71
+ u.put(N.getMode(), 4), u.put(N.getLength(), F.getLengthInBits(N.getMode(), r)), N.write(u);
72
+ }
73
+ var O = 0;
74
+ for (b = 0; b < c.length; b += 1) O += c[b].dataCount;
75
+ if (u.getLengthInBits() > 8 * O) throw "code length overflow. (" + u.getLengthInBits() + ">" + 8 * O + ")";
76
+ for (u.getLengthInBits() + 4 <= 8 * O && u.put(0, 4); u.getLengthInBits() % 8 != 0; ) u.putBit(!1);
77
+ for (; !(u.getLengthInBits() >= 8 * O || (u.put(236, 8), u.getLengthInBits() >= 8 * O)); ) u.put(17, 8);
78
+ return (function(D, T) {
79
+ for (var E = 0, Y = 0, q = 0, z = new Array(T.length), L = new Array(T.length), x = 0; x < T.length; x += 1) {
80
+ var P = T[x].dataCount, Q = T[x].totalCount - P;
81
+ Y = Math.max(Y, P), q = Math.max(q, Q), z[x] = new Array(P);
82
+ for (var S = 0; S < z[x].length; S += 1) z[x][S] = 255 & D.getBuffer()[S + E];
83
+ E += P;
84
+ var K = F.getErrorCorrectPolynomial(Q), Z = ot(z[x], K.getLength() - 1).mod(K);
85
+ for (L[x] = new Array(K.getLength() - 1), S = 0; S < L[x].length; S += 1) {
86
+ var G = S + Z.getLength() - L[x].length;
87
+ L[x][S] = G >= 0 ? Z.getAt(G) : 0;
88
+ }
89
+ }
90
+ var _t = 0;
91
+ for (S = 0; S < T.length; S += 1) _t += T[S].totalCount;
92
+ var ut = new Array(_t), it = 0;
93
+ for (S = 0; S < Y; S += 1) for (x = 0; x < T.length; x += 1) S < z[x].length && (ut[it] = z[x][S], it += 1);
94
+ for (S = 0; S < q; S += 1) for (x = 0; x < T.length; x += 1) S < L[x].length && (ut[it] = L[x][S], it += 1);
95
+ return ut;
96
+ })(u, c);
97
+ };
98
+ a.addData = function(r, l) {
99
+ var s = null;
100
+ switch (l = l || "Byte") {
101
+ case "Numeric":
102
+ s = ft(r);
103
+ break;
104
+ case "Alphanumeric":
105
+ s = wt(r);
106
+ break;
107
+ case "Byte":
108
+ s = ct(r);
109
+ break;
110
+ case "Kanji":
111
+ s = mt(r);
112
+ break;
113
+ default:
114
+ throw "mode:" + l;
115
+ }
116
+ i.push(s), o = null;
117
+ }, a.isDark = function(r, l) {
118
+ if (r < 0 || n <= r || l < 0 || n <= l) throw r + "," + l;
119
+ return t[r][l];
120
+ }, a.getModuleCount = function() {
121
+ return n;
122
+ }, a.make = function() {
123
+ if (d < 1) {
124
+ for (var r = 1; r < 40; r++) {
125
+ for (var l = pt.getRSBlocks(r, e), s = lt(), c = 0; c < i.length; c++) {
126
+ var u = i[c];
127
+ s.put(u.getMode(), 4), s.put(u.getLength(), F.getLengthInBits(u.getMode(), r)), u.write(s);
128
+ }
129
+ var b = 0;
130
+ for (c = 0; c < l.length; c++) b += l[c].dataCount;
131
+ if (s.getLengthInBits() <= 8 * b) break;
132
+ }
133
+ d = r;
134
+ }
135
+ f(!1, (function() {
136
+ for (var N = 0, O = 0, D = 0; D < 8; D += 1) {
137
+ f(!0, D);
138
+ var T = F.getLostPoint(a);
139
+ (D == 0 || N > T) && (N = T, O = D);
140
+ }
141
+ return O;
142
+ })());
143
+ }, a.createTableTag = function(r, l) {
144
+ r = r || 2;
145
+ var s = "";
146
+ s += '<table style="', s += " border-width: 0px; border-style: none;", s += " border-collapse: collapse;", s += " padding: 0px; margin: " + (l = l === void 0 ? 4 * r : l) + "px;", s += '">', s += "<tbody>";
147
+ for (var c = 0; c < a.getModuleCount(); c += 1) {
148
+ s += "<tr>";
149
+ for (var u = 0; u < a.getModuleCount(); u += 1) s += '<td style="', s += " border-width: 0px; border-style: none;", s += " border-collapse: collapse;", s += " padding: 0px; margin: 0px;", s += " width: " + r + "px;", s += " height: " + r + "px;", s += " background-color: ", s += a.isDark(c, u) ? "#000000" : "#ffffff", s += ";", s += '"/>';
150
+ s += "</tr>";
151
+ }
152
+ return (s += "</tbody>") + "</table>";
153
+ }, a.createSvgTag = function(r, l, s, c) {
154
+ var u = {};
155
+ typeof arguments[0] == "object" && (r = (u = arguments[0]).cellSize, l = u.margin, s = u.alt, c = u.title), r = r || 2, l = l === void 0 ? 4 * r : l, (s = typeof s == "string" ? { text: s } : s || {}).text = s.text || null, s.id = s.text ? s.id || "qrcode-description" : null, (c = typeof c == "string" ? { text: c } : c || {}).text = c.text || null, c.id = c.text ? c.id || "qrcode-title" : null;
156
+ var b, N, O, D, T = a.getModuleCount() * r + 2 * l, E = "";
157
+ for (D = "l" + r + ",0 0," + r + " -" + r + ",0 0,-" + r + "z ", E += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"', E += u.scalable ? "" : ' width="' + T + 'px" height="' + T + 'px"', E += ' viewBox="0 0 ' + T + " " + T + '" ', E += ' preserveAspectRatio="xMinYMin meet"', E += c.text || s.text ? ' role="img" aria-labelledby="' + C([c.id, s.id].join(" ").trim()) + '"' : "", E += ">", E += c.text ? '<title id="' + C(c.id) + '">' + C(c.text) + "</title>" : "", E += s.text ? '<description id="' + C(s.id) + '">' + C(s.text) + "</description>" : "", E += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>', E += '<path d="', N = 0; N < a.getModuleCount(); N += 1) for (O = N * r + l, b = 0; b < a.getModuleCount(); b += 1) a.isDark(N, b) && (E += "M" + (b * r + l) + "," + O + D);
158
+ return (E += '" stroke="transparent" fill="black"/>') + "</svg>";
159
+ }, a.createDataURL = function(r, l) {
160
+ r = r || 2, l = l === void 0 ? 4 * r : l;
161
+ var s = a.getModuleCount() * r + 2 * l, c = l, u = s - l;
162
+ return ht(s, s, (function(b, N) {
163
+ if (c <= b && b < u && c <= N && N < u) {
164
+ var O = Math.floor((b - c) / r), D = Math.floor((N - c) / r);
165
+ return a.isDark(D, O) ? 0 : 1;
166
+ }
167
+ return 1;
168
+ }));
169
+ }, a.createImgTag = function(r, l, s) {
170
+ r = r || 2, l = l === void 0 ? 4 * r : l;
171
+ var c = a.getModuleCount() * r + 2 * l, u = "";
172
+ return u += "<img", u += ' src="', u += a.createDataURL(r, l), u += '"', u += ' width="', u += c, u += '"', u += ' height="', u += c, u += '"', s && (u += ' alt="', u += C(s), u += '"'), u + "/>";
173
+ };
174
+ var C = function(r) {
175
+ for (var l = "", s = 0; s < r.length; s += 1) {
176
+ var c = r.charAt(s);
177
+ switch (c) {
178
+ case "<":
179
+ l += "&lt;";
180
+ break;
181
+ case ">":
182
+ l += "&gt;";
183
+ break;
184
+ case "&":
185
+ l += "&amp;";
186
+ break;
187
+ case '"':
188
+ l += "&quot;";
189
+ break;
190
+ default:
191
+ l += c;
192
+ }
193
+ }
194
+ return l;
195
+ };
196
+ return a.createASCII = function(r, l) {
197
+ if ((r = r || 1) < 2) return (function(z) {
198
+ z = z === void 0 ? 2 : z;
199
+ var L, x, P, Q, S, K = 1 * a.getModuleCount() + 2 * z, Z = z, G = K - z, _t = { "██": "█", "█ ": "▀", " █": "▄", " ": " " }, ut = { "██": "▀", "█ ": "▀", " █": " ", " ": " " }, it = "";
200
+ for (L = 0; L < K; L += 2) {
201
+ for (P = Math.floor((L - Z) / 1), Q = Math.floor((L + 1 - Z) / 1), x = 0; x < K; x += 1) S = "█", Z <= x && x < G && Z <= L && L < G && a.isDark(P, Math.floor((x - Z) / 1)) && (S = " "), Z <= x && x < G && Z <= L + 1 && L + 1 < G && a.isDark(Q, Math.floor((x - Z) / 1)) ? S += " " : S += "█", it += z < 1 && L + 1 >= G ? ut[S] : _t[S];
202
+ it += `
203
+ `;
204
+ }
205
+ return K % 2 && z > 0 ? it.substring(0, it.length - K - 1) + Array(K + 1).join("▀") : it.substring(0, it.length - 1);
206
+ })(l);
207
+ r -= 1, l = l === void 0 ? 2 * r : l;
208
+ var s, c, u, b, N = a.getModuleCount() * r + 2 * l, O = l, D = N - l, T = Array(r + 1).join("██"), E = Array(r + 1).join(" "), Y = "", q = "";
209
+ for (s = 0; s < N; s += 1) {
210
+ for (u = Math.floor((s - O) / r), q = "", c = 0; c < N; c += 1) b = 1, O <= c && c < D && O <= s && s < D && a.isDark(u, Math.floor((c - O) / r)) && (b = 0), q += b ? T : E;
211
+ for (u = 0; u < r; u += 1) Y += q + `
212
+ `;
213
+ }
214
+ return Y.substring(0, Y.length - 1);
215
+ }, a.renderTo2dContext = function(r, l) {
216
+ l = l || 2;
217
+ for (var s = a.getModuleCount(), c = 0; c < s; c++) for (var u = 0; u < s; u++) r.fillStyle = a.isDark(c, u) ? "black" : "white", r.fillRect(c * l, u * l, l, l);
218
+ }, a;
219
+ };
220
+ J.stringToBytes = (J.stringToBytesFuncs = { default: function(g) {
221
+ for (var h = [], d = 0; d < g.length; d += 1) {
222
+ var e = g.charCodeAt(d);
223
+ h.push(255 & e);
224
+ }
225
+ return h;
226
+ } }).default, J.createStringToBytes = function(g, h) {
227
+ var d = (function() {
228
+ for (var t = yt(g), n = function() {
229
+ var v = t.read();
230
+ if (v == -1) throw "eof";
231
+ return v;
232
+ }, o = 0, i = {}; ; ) {
233
+ var a = t.read();
234
+ if (a == -1) break;
235
+ var f = n(), p = n() << 8 | n();
236
+ i[String.fromCharCode(a << 8 | f)] = p, o += 1;
237
+ }
238
+ if (o != h) throw o + " != " + h;
239
+ return i;
240
+ })(), e = 63;
241
+ return function(t) {
242
+ for (var n = [], o = 0; o < t.length; o += 1) {
243
+ var i = t.charCodeAt(o);
244
+ if (i < 128) n.push(i);
245
+ else {
246
+ var a = d[t.charAt(o)];
247
+ typeof a == "number" ? (255 & a) == a ? n.push(a) : (n.push(a >>> 8), n.push(255 & a)) : n.push(e);
248
+ }
249
+ }
250
+ return n;
251
+ };
252
+ };
253
+ var rt, tt, V, k, et, nt = { L: 1, M: 0, Q: 3, H: 2 }, F = (rt = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], tt = 1335, V = 7973, et = function(g) {
254
+ for (var h = 0; g != 0; ) h += 1, g >>>= 1;
255
+ return h;
256
+ }, (k = {}).getBCHTypeInfo = function(g) {
257
+ for (var h = g << 10; et(h) - et(tt) >= 0; ) h ^= tt << et(h) - et(tt);
258
+ return 21522 ^ (g << 10 | h);
259
+ }, k.getBCHTypeNumber = function(g) {
260
+ for (var h = g << 12; et(h) - et(V) >= 0; ) h ^= V << et(h) - et(V);
261
+ return g << 12 | h;
262
+ }, k.getPatternPosition = function(g) {
263
+ return rt[g - 1];
264
+ }, k.getMaskFunction = function(g) {
265
+ switch (g) {
266
+ case 0:
267
+ return function(h, d) {
268
+ return (h + d) % 2 == 0;
269
+ };
270
+ case 1:
271
+ return function(h, d) {
272
+ return h % 2 == 0;
273
+ };
274
+ case 2:
275
+ return function(h, d) {
276
+ return d % 3 == 0;
277
+ };
278
+ case 3:
279
+ return function(h, d) {
280
+ return (h + d) % 3 == 0;
281
+ };
282
+ case 4:
283
+ return function(h, d) {
284
+ return (Math.floor(h / 2) + Math.floor(d / 3)) % 2 == 0;
285
+ };
286
+ case 5:
287
+ return function(h, d) {
288
+ return h * d % 2 + h * d % 3 == 0;
289
+ };
290
+ case 6:
291
+ return function(h, d) {
292
+ return (h * d % 2 + h * d % 3) % 2 == 0;
293
+ };
294
+ case 7:
295
+ return function(h, d) {
296
+ return (h * d % 3 + (h + d) % 2) % 2 == 0;
297
+ };
298
+ default:
299
+ throw "bad maskPattern:" + g;
300
+ }
301
+ }, k.getErrorCorrectPolynomial = function(g) {
302
+ for (var h = ot([1], 0), d = 0; d < g; d += 1) h = h.multiply(ot([1, H.gexp(d)], 0));
303
+ return h;
304
+ }, k.getLengthInBits = function(g, h) {
305
+ if (1 <= h && h < 10) switch (g) {
306
+ case 1:
307
+ return 10;
308
+ case 2:
309
+ return 9;
310
+ case 4:
311
+ case 8:
312
+ return 8;
313
+ default:
314
+ throw "mode:" + g;
315
+ }
316
+ else if (h < 27) switch (g) {
317
+ case 1:
318
+ return 12;
319
+ case 2:
320
+ return 11;
321
+ case 4:
322
+ return 16;
323
+ case 8:
324
+ return 10;
325
+ default:
326
+ throw "mode:" + g;
327
+ }
328
+ else {
329
+ if (!(h < 41)) throw "type:" + h;
330
+ switch (g) {
331
+ case 1:
332
+ return 14;
333
+ case 2:
334
+ return 13;
335
+ case 4:
336
+ return 16;
337
+ case 8:
338
+ return 12;
339
+ default:
340
+ throw "mode:" + g;
341
+ }
342
+ }
343
+ }, k.getLostPoint = function(g) {
344
+ for (var h = g.getModuleCount(), d = 0, e = 0; e < h; e += 1) for (var t = 0; t < h; t += 1) {
345
+ for (var n = 0, o = g.isDark(e, t), i = -1; i <= 1; i += 1) if (!(e + i < 0 || h <= e + i)) for (var a = -1; a <= 1; a += 1) t + a < 0 || h <= t + a || i == 0 && a == 0 || o == g.isDark(e + i, t + a) && (n += 1);
346
+ n > 5 && (d += 3 + n - 5);
347
+ }
348
+ for (e = 0; e < h - 1; e += 1) for (t = 0; t < h - 1; t += 1) {
349
+ var f = 0;
350
+ g.isDark(e, t) && (f += 1), g.isDark(e + 1, t) && (f += 1), g.isDark(e, t + 1) && (f += 1), g.isDark(e + 1, t + 1) && (f += 1), f != 0 && f != 4 || (d += 3);
351
+ }
352
+ for (e = 0; e < h; e += 1) for (t = 0; t < h - 6; t += 1) g.isDark(e, t) && !g.isDark(e, t + 1) && g.isDark(e, t + 2) && g.isDark(e, t + 3) && g.isDark(e, t + 4) && !g.isDark(e, t + 5) && g.isDark(e, t + 6) && (d += 40);
353
+ for (t = 0; t < h; t += 1) for (e = 0; e < h - 6; e += 1) g.isDark(e, t) && !g.isDark(e + 1, t) && g.isDark(e + 2, t) && g.isDark(e + 3, t) && g.isDark(e + 4, t) && !g.isDark(e + 5, t) && g.isDark(e + 6, t) && (d += 40);
354
+ var p = 0;
355
+ for (t = 0; t < h; t += 1) for (e = 0; e < h; e += 1) g.isDark(e, t) && (p += 1);
356
+ return d + Math.abs(100 * p / h / h - 50) / 5 * 10;
357
+ }, k), H = (function() {
358
+ for (var g = new Array(256), h = new Array(256), d = 0; d < 8; d += 1) g[d] = 1 << d;
359
+ for (d = 8; d < 256; d += 1) g[d] = g[d - 4] ^ g[d - 5] ^ g[d - 6] ^ g[d - 8];
360
+ for (d = 0; d < 255; d += 1) h[g[d]] = d;
361
+ return { glog: function(e) {
362
+ if (e < 1) throw "glog(" + e + ")";
363
+ return h[e];
364
+ }, gexp: function(e) {
365
+ for (; e < 0; ) e += 255;
366
+ for (; e >= 256; ) e -= 255;
367
+ return g[e];
368
+ } };
369
+ })();
370
+ function ot(g, h) {
371
+ if (g.length === void 0) throw g.length + "/" + h;
372
+ var d = (function() {
373
+ for (var t = 0; t < g.length && g[t] == 0; ) t += 1;
374
+ for (var n = new Array(g.length - t + h), o = 0; o < g.length - t; o += 1) n[o] = g[o + t];
375
+ return n;
376
+ })(), e = { getAt: function(t) {
377
+ return d[t];
378
+ }, getLength: function() {
379
+ return d.length;
380
+ }, multiply: function(t) {
381
+ for (var n = new Array(e.getLength() + t.getLength() - 1), o = 0; o < e.getLength(); o += 1) for (var i = 0; i < t.getLength(); i += 1) n[o + i] ^= H.gexp(H.glog(e.getAt(o)) + H.glog(t.getAt(i)));
382
+ return ot(n, 0);
383
+ }, mod: function(t) {
384
+ if (e.getLength() - t.getLength() < 0) return e;
385
+ for (var n = H.glog(e.getAt(0)) - H.glog(t.getAt(0)), o = new Array(e.getLength()), i = 0; i < e.getLength(); i += 1) o[i] = e.getAt(i);
386
+ for (i = 0; i < t.getLength(); i += 1) o[i] ^= H.gexp(H.glog(t.getAt(i)) + n);
387
+ return ot(o, 0).mod(t);
388
+ } };
389
+ return e;
390
+ }
391
+ var pt = /* @__PURE__ */ (function() {
392
+ var g = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12, 7, 37, 13], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]], h = function(e, t) {
393
+ var n = {};
394
+ return n.totalCount = e, n.dataCount = t, n;
395
+ }, d = { getRSBlocks: function(e, t) {
396
+ var n = (function(y, m) {
397
+ switch (m) {
398
+ case nt.L:
399
+ return g[4 * (y - 1) + 0];
400
+ case nt.M:
401
+ return g[4 * (y - 1) + 1];
402
+ case nt.Q:
403
+ return g[4 * (y - 1) + 2];
404
+ case nt.H:
405
+ return g[4 * (y - 1) + 3];
406
+ default:
407
+ return;
408
+ }
409
+ })(e, t);
410
+ if (n === void 0) throw "bad rs block @ typeNumber:" + e + "/errorCorrectionLevel:" + t;
411
+ for (var o = n.length / 3, i = [], a = 0; a < o; a += 1) for (var f = n[3 * a + 0], p = n[3 * a + 1], v = n[3 * a + 2], w = 0; w < f; w += 1) i.push(h(p, v));
412
+ return i;
413
+ } };
414
+ return d;
415
+ })(), lt = function() {
416
+ var g = [], h = 0, d = { getBuffer: function() {
417
+ return g;
418
+ }, getAt: function(e) {
419
+ var t = Math.floor(e / 8);
420
+ return (g[t] >>> 7 - e % 8 & 1) == 1;
421
+ }, put: function(e, t) {
422
+ for (var n = 0; n < t; n += 1) d.putBit((e >>> t - n - 1 & 1) == 1);
423
+ }, getLengthInBits: function() {
424
+ return h;
425
+ }, putBit: function(e) {
426
+ var t = Math.floor(h / 8);
427
+ g.length <= t && g.push(0), e && (g[t] |= 128 >>> h % 8), h += 1;
428
+ } };
429
+ return d;
430
+ }, ft = function(g) {
431
+ var h = g, d = { getMode: function() {
432
+ return 1;
433
+ }, getLength: function(n) {
434
+ return h.length;
435
+ }, write: function(n) {
436
+ for (var o = h, i = 0; i + 2 < o.length; ) n.put(e(o.substring(i, i + 3)), 10), i += 3;
437
+ i < o.length && (o.length - i == 1 ? n.put(e(o.substring(i, i + 1)), 4) : o.length - i == 2 && n.put(e(o.substring(i, i + 2)), 7));
438
+ } }, e = function(n) {
439
+ for (var o = 0, i = 0; i < n.length; i += 1) o = 10 * o + t(n.charAt(i));
440
+ return o;
441
+ }, t = function(n) {
442
+ if ("0" <= n && n <= "9") return n.charCodeAt(0) - 48;
443
+ throw "illegal char :" + n;
444
+ };
445
+ return d;
446
+ }, wt = function(g) {
447
+ var h = g, d = { getMode: function() {
448
+ return 2;
449
+ }, getLength: function(t) {
450
+ return h.length;
451
+ }, write: function(t) {
452
+ for (var n = h, o = 0; o + 1 < n.length; ) t.put(45 * e(n.charAt(o)) + e(n.charAt(o + 1)), 11), o += 2;
453
+ o < n.length && t.put(e(n.charAt(o)), 6);
454
+ } }, e = function(t) {
455
+ if ("0" <= t && t <= "9") return t.charCodeAt(0) - 48;
456
+ if ("A" <= t && t <= "Z") return t.charCodeAt(0) - 65 + 10;
457
+ switch (t) {
458
+ case " ":
459
+ return 36;
460
+ case "$":
461
+ return 37;
462
+ case "%":
463
+ return 38;
464
+ case "*":
465
+ return 39;
466
+ case "+":
467
+ return 40;
468
+ case "-":
469
+ return 41;
470
+ case ".":
471
+ return 42;
472
+ case "/":
473
+ return 43;
474
+ case ":":
475
+ return 44;
476
+ default:
477
+ throw "illegal char :" + t;
478
+ }
479
+ };
480
+ return d;
481
+ }, ct = function(g) {
482
+ var h = J.stringToBytes(g);
483
+ return { getMode: function() {
484
+ return 4;
485
+ }, getLength: function(d) {
486
+ return h.length;
487
+ }, write: function(d) {
488
+ for (var e = 0; e < h.length; e += 1) d.put(h[e], 8);
489
+ } };
490
+ }, mt = function(g) {
491
+ var h = J.stringToBytesFuncs.SJIS;
492
+ if (!h) throw "sjis not supported.";
493
+ (function() {
494
+ var t = h("友");
495
+ if (t.length != 2 || (t[0] << 8 | t[1]) != 38726) throw "sjis not supported.";
496
+ })();
497
+ var d = h(g), e = { getMode: function() {
498
+ return 8;
499
+ }, getLength: function(t) {
500
+ return ~~(d.length / 2);
501
+ }, write: function(t) {
502
+ for (var n = d, o = 0; o + 1 < n.length; ) {
503
+ var i = (255 & n[o]) << 8 | 255 & n[o + 1];
504
+ if (33088 <= i && i <= 40956) i -= 33088;
505
+ else {
506
+ if (!(57408 <= i && i <= 60351)) throw "illegal char at " + (o + 1) + "/" + i;
507
+ i -= 49472;
508
+ }
509
+ i = 192 * (i >>> 8 & 255) + (255 & i), t.put(i, 13), o += 2;
510
+ }
511
+ if (o < n.length) throw "illegal char at " + (o + 1);
512
+ } };
513
+ return e;
514
+ }, vt = function() {
515
+ var g = [], h = { writeByte: function(d) {
516
+ g.push(255 & d);
517
+ }, writeShort: function(d) {
518
+ h.writeByte(d), h.writeByte(d >>> 8);
519
+ }, writeBytes: function(d, e, t) {
520
+ e = e || 0, t = t || d.length;
521
+ for (var n = 0; n < t; n += 1) h.writeByte(d[n + e]);
522
+ }, writeString: function(d) {
523
+ for (var e = 0; e < d.length; e += 1) h.writeByte(d.charCodeAt(e));
524
+ }, toByteArray: function() {
525
+ return g;
526
+ }, toString: function() {
527
+ var d = "";
528
+ d += "[";
529
+ for (var e = 0; e < g.length; e += 1) e > 0 && (d += ","), d += g[e];
530
+ return d + "]";
531
+ } };
532
+ return h;
533
+ }, yt = function(g) {
534
+ var h = g, d = 0, e = 0, t = 0, n = { read: function() {
535
+ for (; t < 8; ) {
536
+ if (d >= h.length) {
537
+ if (t == 0) return -1;
538
+ throw "unexpected end of file./" + t;
539
+ }
540
+ var i = h.charAt(d);
541
+ if (d += 1, i == "=") return t = 0, -1;
542
+ i.match(/^\s$/) || (e = e << 6 | o(i.charCodeAt(0)), t += 6);
543
+ }
544
+ var a = e >>> t - 8 & 255;
545
+ return t -= 8, a;
546
+ } }, o = function(i) {
547
+ if (65 <= i && i <= 90) return i - 65;
548
+ if (97 <= i && i <= 122) return i - 97 + 26;
549
+ if (48 <= i && i <= 57) return i - 48 + 52;
550
+ if (i == 43) return 62;
551
+ if (i == 47) return 63;
552
+ throw "c:" + i;
553
+ };
554
+ return n;
555
+ }, ht = function(g, h, d) {
556
+ for (var e = (function(p, v) {
557
+ var w = p, y = v, m = new Array(p * v), M = { setPixel: function(r, l, s) {
558
+ m[l * w + r] = s;
559
+ }, write: function(r) {
560
+ r.writeString("GIF87a"), r.writeShort(w), r.writeShort(y), r.writeByte(128), r.writeByte(0), r.writeByte(0), r.writeByte(0), r.writeByte(0), r.writeByte(0), r.writeByte(255), r.writeByte(255), r.writeByte(255), r.writeString(","), r.writeShort(0), r.writeShort(0), r.writeShort(w), r.writeShort(y), r.writeByte(0);
561
+ var l = I(2);
562
+ r.writeByte(2);
563
+ for (var s = 0; l.length - s > 255; ) r.writeByte(255), r.writeBytes(l, s, 255), s += 255;
564
+ r.writeByte(l.length - s), r.writeBytes(l, s, l.length - s), r.writeByte(0), r.writeString(";");
565
+ } }, I = function(r) {
566
+ for (var l = 1 << r, s = 1 + (1 << r), c = r + 1, u = C(), b = 0; b < l; b += 1) u.add(String.fromCharCode(b));
567
+ u.add(String.fromCharCode(l)), u.add(String.fromCharCode(s));
568
+ var N, O, D, T = vt(), E = (N = T, O = 0, D = 0, { write: function(L, x) {
569
+ if (L >>> x) throw "length over";
570
+ for (; O + x >= 8; ) N.writeByte(255 & (L << O | D)), x -= 8 - O, L >>>= 8 - O, D = 0, O = 0;
571
+ D |= L << O, O += x;
572
+ }, flush: function() {
573
+ O > 0 && N.writeByte(D);
574
+ } });
575
+ E.write(l, c);
576
+ var Y = 0, q = String.fromCharCode(m[Y]);
577
+ for (Y += 1; Y < m.length; ) {
578
+ var z = String.fromCharCode(m[Y]);
579
+ Y += 1, u.contains(q + z) ? q += z : (E.write(u.indexOf(q), c), u.size() < 4095 && (u.size() == 1 << c && (c += 1), u.add(q + z)), q = z);
580
+ }
581
+ return E.write(u.indexOf(q), c), E.write(s, c), E.flush(), T.toByteArray();
582
+ }, C = function() {
583
+ var r = {}, l = 0, s = { add: function(c) {
584
+ if (s.contains(c)) throw "dup key:" + c;
585
+ r[c] = l, l += 1;
586
+ }, size: function() {
587
+ return l;
588
+ }, indexOf: function(c) {
589
+ return r[c];
590
+ }, contains: function(c) {
591
+ return r[c] !== void 0;
592
+ } };
593
+ return s;
594
+ };
595
+ return M;
596
+ })(g, h), t = 0; t < h; t += 1) for (var n = 0; n < g; n += 1) e.setPixel(n, t, d(n, t));
597
+ var o = vt();
598
+ e.write(o);
599
+ for (var i = (function() {
600
+ var p = 0, v = 0, w = 0, y = "", m = {}, M = function(C) {
601
+ y += String.fromCharCode(I(63 & C));
602
+ }, I = function(C) {
603
+ if (!(C < 0)) {
604
+ if (C < 26) return 65 + C;
605
+ if (C < 52) return C - 26 + 97;
606
+ if (C < 62) return C - 52 + 48;
607
+ if (C == 62) return 43;
608
+ if (C == 63) return 47;
609
+ }
610
+ throw "n:" + C;
611
+ };
612
+ return m.writeByte = function(C) {
613
+ for (p = p << 8 | 255 & C, v += 8, w += 1; v >= 6; ) M(p >>> v - 6), v -= 6;
614
+ }, m.flush = function() {
615
+ if (v > 0 && (M(p << 6 - v), p = 0, v = 0), w % 3 != 0) for (var C = 3 - w % 3, r = 0; r < C; r += 1) y += "=";
616
+ }, m.toString = function() {
617
+ return y;
618
+ }, m;
619
+ })(), a = o.toByteArray(), f = 0; f < a.length; f += 1) i.writeByte(a[f]);
620
+ return i.flush(), "data:image/gif;base64," + i;
621
+ };
622
+ return J;
623
+ })();
624
+ dt.stringToBytesFuncs["UTF-8"] = function(J) {
625
+ return (function(rt) {
626
+ for (var tt = [], V = 0; V < rt.length; V++) {
627
+ var k = rt.charCodeAt(V);
628
+ k < 128 ? tt.push(k) : k < 2048 ? tt.push(192 | k >> 6, 128 | 63 & k) : k < 55296 || k >= 57344 ? tt.push(224 | k >> 12, 128 | k >> 6 & 63, 128 | 63 & k) : (V++, k = 65536 + ((1023 & k) << 10 | 1023 & rt.charCodeAt(V)), tt.push(240 | k >> 18, 128 | k >> 12 & 63, 128 | k >> 6 & 63, 128 | 63 & k));
629
+ }
630
+ return tt;
631
+ })(J);
632
+ }, (gt = typeof (W = function() {
633
+ return dt;
634
+ }) == "function" ? W.apply(U, []) : W) === void 0 || (R.exports = gt);
635
+ } }, X = {};
636
+ function $(R) {
637
+ var U = X[R];
638
+ if (U !== void 0) return U.exports;
639
+ var W = X[R] = { exports: {} };
640
+ return j[R](W, W.exports, $), W.exports;
641
+ }
642
+ $.n = (R) => {
643
+ var U = R && R.__esModule ? () => R.default : () => R;
644
+ return $.d(U, { a: U }), U;
645
+ }, $.d = (R, U) => {
646
+ for (var W in U) $.o(U, W) && !$.o(R, W) && Object.defineProperty(R, W, { enumerable: !0, get: U[W] });
647
+ }, $.o = (R, U) => Object.prototype.hasOwnProperty.call(R, U);
648
+ var at = {};
649
+ return (() => {
650
+ $.d(at, { default: () => h });
651
+ const R = (d) => !!d && typeof d == "object" && !Array.isArray(d);
652
+ function U(d, ...e) {
653
+ if (!e.length) return d;
654
+ const t = e.shift();
655
+ return t !== void 0 && R(d) && R(t) ? (d = Object.assign({}, d), Object.keys(t).forEach(((n) => {
656
+ const o = d[n], i = t[n];
657
+ Array.isArray(o) && Array.isArray(i) ? d[n] = i : R(o) && R(i) ? d[n] = U(Object.assign({}, o), i) : d[n] = i;
658
+ })), U(d, ...e)) : d;
659
+ }
660
+ function W(d, e) {
661
+ const t = document.createElement("a");
662
+ t.download = e, t.href = d, document.body.appendChild(t), t.click(), document.body.removeChild(t);
663
+ }
664
+ const gt = { L: 0.07, M: 0.15, Q: 0.25, H: 0.3 };
665
+ class dt {
666
+ constructor({ svg: e, type: t, window: n }) {
667
+ this._svg = e, this._type = t, this._window = n;
668
+ }
669
+ draw(e, t, n, o) {
670
+ let i;
671
+ switch (this._type) {
672
+ case "dots":
673
+ i = this._drawDot;
674
+ break;
675
+ case "classy":
676
+ i = this._drawClassy;
677
+ break;
678
+ case "classy-rounded":
679
+ i = this._drawClassyRounded;
680
+ break;
681
+ case "rounded":
682
+ i = this._drawRounded;
683
+ break;
684
+ case "extra-rounded":
685
+ i = this._drawExtraRounded;
686
+ break;
687
+ default:
688
+ i = this._drawSquare;
689
+ }
690
+ i.call(this, { x: e, y: t, size: n, getNeighbor: o });
691
+ }
692
+ _rotateFigure({ x: e, y: t, size: n, rotation: o = 0, draw: i }) {
693
+ var a;
694
+ const f = e + n / 2, p = t + n / 2;
695
+ i(), (a = this._element) === null || a === void 0 || a.setAttribute("transform", `rotate(${180 * o / Math.PI},${f},${p})`);
696
+ }
697
+ _basicDot(e) {
698
+ const { size: t, x: n, y: o } = e;
699
+ this._rotateFigure(Object.assign(Object.assign({}, e), { draw: () => {
700
+ this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(n + t / 2)), this._element.setAttribute("cy", String(o + t / 2)), this._element.setAttribute("r", String(t / 2));
701
+ } }));
702
+ }
703
+ _basicSquare(e) {
704
+ const { size: t, x: n, y: o } = e;
705
+ this._rotateFigure(Object.assign(Object.assign({}, e), { draw: () => {
706
+ this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(n)), this._element.setAttribute("y", String(o)), this._element.setAttribute("width", String(t)), this._element.setAttribute("height", String(t));
707
+ } }));
708
+ }
709
+ _basicSideRounded(e) {
710
+ const { size: t, x: n, y: o } = e;
711
+ this._rotateFigure(Object.assign(Object.assign({}, e), { draw: () => {
712
+ this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${n} ${o}v ${t}h ` + t / 2 + `a ${t / 2} ${t / 2}, 0, 0, 0, 0 ${-t}`);
713
+ } }));
714
+ }
715
+ _basicCornerRounded(e) {
716
+ const { size: t, x: n, y: o } = e;
717
+ this._rotateFigure(Object.assign(Object.assign({}, e), { draw: () => {
718
+ this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${n} ${o}v ${t}h ${t}v ` + -t / 2 + `a ${t / 2} ${t / 2}, 0, 0, 0, ${-t / 2} ${-t / 2}`);
719
+ } }));
720
+ }
721
+ _basicCornerExtraRounded(e) {
722
+ const { size: t, x: n, y: o } = e;
723
+ this._rotateFigure(Object.assign(Object.assign({}, e), { draw: () => {
724
+ this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${n} ${o}v ${t}h ${t}a ${t} ${t}, 0, 0, 0, ${-t} ${-t}`);
725
+ } }));
726
+ }
727
+ _basicCornersRounded(e) {
728
+ const { size: t, x: n, y: o } = e;
729
+ this._rotateFigure(Object.assign(Object.assign({}, e), { draw: () => {
730
+ this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${n} ${o}v ` + t / 2 + `a ${t / 2} ${t / 2}, 0, 0, 0, ${t / 2} ${t / 2}h ` + t / 2 + "v " + -t / 2 + `a ${t / 2} ${t / 2}, 0, 0, 0, ${-t / 2} ${-t / 2}`);
731
+ } }));
732
+ }
733
+ _drawDot({ x: e, y: t, size: n }) {
734
+ this._basicDot({ x: e, y: t, size: n, rotation: 0 });
735
+ }
736
+ _drawSquare({ x: e, y: t, size: n }) {
737
+ this._basicSquare({ x: e, y: t, size: n, rotation: 0 });
738
+ }
739
+ _drawRounded({ x: e, y: t, size: n, getNeighbor: o }) {
740
+ const i = o ? +o(-1, 0) : 0, a = o ? +o(1, 0) : 0, f = o ? +o(0, -1) : 0, p = o ? +o(0, 1) : 0, v = i + a + f + p;
741
+ if (v !== 0) if (v > 2 || i && a || f && p) this._basicSquare({ x: e, y: t, size: n, rotation: 0 });
742
+ else {
743
+ if (v === 2) {
744
+ let w = 0;
745
+ return i && f ? w = Math.PI / 2 : f && a ? w = Math.PI : a && p && (w = -Math.PI / 2), void this._basicCornerRounded({ x: e, y: t, size: n, rotation: w });
746
+ }
747
+ if (v === 1) {
748
+ let w = 0;
749
+ return f ? w = Math.PI / 2 : a ? w = Math.PI : p && (w = -Math.PI / 2), void this._basicSideRounded({ x: e, y: t, size: n, rotation: w });
750
+ }
751
+ }
752
+ else this._basicDot({ x: e, y: t, size: n, rotation: 0 });
753
+ }
754
+ _drawExtraRounded({ x: e, y: t, size: n, getNeighbor: o }) {
755
+ const i = o ? +o(-1, 0) : 0, a = o ? +o(1, 0) : 0, f = o ? +o(0, -1) : 0, p = o ? +o(0, 1) : 0, v = i + a + f + p;
756
+ if (v !== 0) if (v > 2 || i && a || f && p) this._basicSquare({ x: e, y: t, size: n, rotation: 0 });
757
+ else {
758
+ if (v === 2) {
759
+ let w = 0;
760
+ return i && f ? w = Math.PI / 2 : f && a ? w = Math.PI : a && p && (w = -Math.PI / 2), void this._basicCornerExtraRounded({ x: e, y: t, size: n, rotation: w });
761
+ }
762
+ if (v === 1) {
763
+ let w = 0;
764
+ return f ? w = Math.PI / 2 : a ? w = Math.PI : p && (w = -Math.PI / 2), void this._basicSideRounded({ x: e, y: t, size: n, rotation: w });
765
+ }
766
+ }
767
+ else this._basicDot({ x: e, y: t, size: n, rotation: 0 });
768
+ }
769
+ _drawClassy({ x: e, y: t, size: n, getNeighbor: o }) {
770
+ const i = o ? +o(-1, 0) : 0, a = o ? +o(1, 0) : 0, f = o ? +o(0, -1) : 0, p = o ? +o(0, 1) : 0;
771
+ i + a + f + p !== 0 ? i || f ? a || p ? this._basicSquare({ x: e, y: t, size: n, rotation: 0 }) : this._basicCornerRounded({ x: e, y: t, size: n, rotation: Math.PI / 2 }) : this._basicCornerRounded({ x: e, y: t, size: n, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: e, y: t, size: n, rotation: Math.PI / 2 });
772
+ }
773
+ _drawClassyRounded({ x: e, y: t, size: n, getNeighbor: o }) {
774
+ const i = o ? +o(-1, 0) : 0, a = o ? +o(1, 0) : 0, f = o ? +o(0, -1) : 0, p = o ? +o(0, 1) : 0;
775
+ i + a + f + p !== 0 ? i || f ? a || p ? this._basicSquare({ x: e, y: t, size: n, rotation: 0 }) : this._basicCornerExtraRounded({ x: e, y: t, size: n, rotation: Math.PI / 2 }) : this._basicCornerExtraRounded({ x: e, y: t, size: n, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: e, y: t, size: n, rotation: Math.PI / 2 });
776
+ }
777
+ }
778
+ const J = { dot: "dot", square: "square", extraRounded: "extra-rounded" }, rt = Object.values(J);
779
+ class tt {
780
+ constructor({ svg: e, type: t, window: n }) {
781
+ this._svg = e, this._type = t, this._window = n;
782
+ }
783
+ draw(e, t, n, o) {
784
+ let i;
785
+ switch (this._type) {
786
+ case J.square:
787
+ i = this._drawSquare;
788
+ break;
789
+ case J.extraRounded:
790
+ i = this._drawExtraRounded;
791
+ break;
792
+ default:
793
+ i = this._drawDot;
794
+ }
795
+ i.call(this, { x: e, y: t, size: n, rotation: o });
796
+ }
797
+ _rotateFigure({ x: e, y: t, size: n, rotation: o = 0, draw: i }) {
798
+ var a;
799
+ const f = e + n / 2, p = t + n / 2;
800
+ i(), (a = this._element) === null || a === void 0 || a.setAttribute("transform", `rotate(${180 * o / Math.PI},${f},${p})`);
801
+ }
802
+ _basicDot(e) {
803
+ const { size: t, x: n, y: o } = e, i = t / 7;
804
+ this._rotateFigure(Object.assign(Object.assign({}, e), { draw: () => {
805
+ this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${n + t / 2} ${o}a ${t / 2} ${t / 2} 0 1 0 0.1 0zm 0 ${i}a ${t / 2 - i} ${t / 2 - i} 0 1 1 -0.1 0Z`);
806
+ } }));
807
+ }
808
+ _basicSquare(e) {
809
+ const { size: t, x: n, y: o } = e, i = t / 7;
810
+ this._rotateFigure(Object.assign(Object.assign({}, e), { draw: () => {
811
+ this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${n} ${o}v ${t}h ${t}v ` + -t + `zM ${n + i} ${o + i}h ` + (t - 2 * i) + "v " + (t - 2 * i) + "h " + (2 * i - t) + "z");
812
+ } }));
813
+ }
814
+ _basicExtraRounded(e) {
815
+ const { size: t, x: n, y: o } = e, i = t / 7;
816
+ this._rotateFigure(Object.assign(Object.assign({}, e), { draw: () => {
817
+ this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${n} ${o + 2.5 * i}v ` + 2 * i + `a ${2.5 * i} ${2.5 * i}, 0, 0, 0, ${2.5 * i} ${2.5 * i}h ` + 2 * i + `a ${2.5 * i} ${2.5 * i}, 0, 0, 0, ${2.5 * i} ${2.5 * -i}v ` + -2 * i + `a ${2.5 * i} ${2.5 * i}, 0, 0, 0, ${2.5 * -i} ${2.5 * -i}h ` + -2 * i + `a ${2.5 * i} ${2.5 * i}, 0, 0, 0, ${2.5 * -i} ${2.5 * i}M ${n + 2.5 * i} ${o + i}h ` + 2 * i + `a ${1.5 * i} ${1.5 * i}, 0, 0, 1, ${1.5 * i} ${1.5 * i}v ` + 2 * i + `a ${1.5 * i} ${1.5 * i}, 0, 0, 1, ${1.5 * -i} ${1.5 * i}h ` + -2 * i + `a ${1.5 * i} ${1.5 * i}, 0, 0, 1, ${1.5 * -i} ${1.5 * -i}v ` + -2 * i + `a ${1.5 * i} ${1.5 * i}, 0, 0, 1, ${1.5 * i} ${1.5 * -i}`);
818
+ } }));
819
+ }
820
+ _drawDot({ x: e, y: t, size: n, rotation: o }) {
821
+ this._basicDot({ x: e, y: t, size: n, rotation: o });
822
+ }
823
+ _drawSquare({ x: e, y: t, size: n, rotation: o }) {
824
+ this._basicSquare({ x: e, y: t, size: n, rotation: o });
825
+ }
826
+ _drawExtraRounded({ x: e, y: t, size: n, rotation: o }) {
827
+ this._basicExtraRounded({ x: e, y: t, size: n, rotation: o });
828
+ }
829
+ }
830
+ const V = { dot: "dot", square: "square" }, k = Object.values(V);
831
+ class et {
832
+ constructor({ svg: e, type: t, window: n }) {
833
+ this._svg = e, this._type = t, this._window = n;
834
+ }
835
+ draw(e, t, n, o) {
836
+ let i;
837
+ i = this._type === V.square ? this._drawSquare : this._drawDot, i.call(this, { x: e, y: t, size: n, rotation: o });
838
+ }
839
+ _rotateFigure({ x: e, y: t, size: n, rotation: o = 0, draw: i }) {
840
+ var a;
841
+ const f = e + n / 2, p = t + n / 2;
842
+ i(), (a = this._element) === null || a === void 0 || a.setAttribute("transform", `rotate(${180 * o / Math.PI},${f},${p})`);
843
+ }
844
+ _basicDot(e) {
845
+ const { size: t, x: n, y: o } = e;
846
+ this._rotateFigure(Object.assign(Object.assign({}, e), { draw: () => {
847
+ this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(n + t / 2)), this._element.setAttribute("cy", String(o + t / 2)), this._element.setAttribute("r", String(t / 2));
848
+ } }));
849
+ }
850
+ _basicSquare(e) {
851
+ const { size: t, x: n, y: o } = e;
852
+ this._rotateFigure(Object.assign(Object.assign({}, e), { draw: () => {
853
+ this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(n)), this._element.setAttribute("y", String(o)), this._element.setAttribute("width", String(t)), this._element.setAttribute("height", String(t));
854
+ } }));
855
+ }
856
+ _drawDot({ x: e, y: t, size: n, rotation: o }) {
857
+ this._basicDot({ x: e, y: t, size: n, rotation: o });
858
+ }
859
+ _drawSquare({ x: e, y: t, size: n, rotation: o }) {
860
+ this._basicSquare({ x: e, y: t, size: n, rotation: o });
861
+ }
862
+ }
863
+ const nt = "circle", F = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], H = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
864
+ class ot {
865
+ constructor(e, t) {
866
+ this._roundSize = (n) => this._options.dotsOptions.roundSize ? Math.floor(n) : n, this._window = t, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(e.width)), this._element.setAttribute("height", String(e.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), e.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${e.width} ${e.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = e.image, this._instanceId = ot.instanceCount++, this._options = e;
867
+ }
868
+ get width() {
869
+ return this._options.width;
870
+ }
871
+ get height() {
872
+ return this._options.height;
873
+ }
874
+ getElement() {
875
+ return this._element;
876
+ }
877
+ async drawQR(e) {
878
+ const t = e.getModuleCount(), n = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, o = this._options.shape === nt ? n / Math.sqrt(2) : n, i = this._roundSize(o / t);
879
+ let a = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 };
880
+ if (this._qr = e, this._options.image) {
881
+ if (await this.loadImage(), !this._image) return;
882
+ const { imageOptions: f, qrOptions: p } = this._options, v = f.imageSize * gt[p.errorCorrectionLevel], w = Math.floor(v * t * t);
883
+ a = (function({ originalHeight: y, originalWidth: m, maxHiddenDots: M, maxHiddenAxisDots: I, dotSize: C }) {
884
+ const r = { x: 0, y: 0 }, l = { x: 0, y: 0 };
885
+ if (y <= 0 || m <= 0 || M <= 0 || C <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 };
886
+ const s = y / m;
887
+ return r.x = Math.floor(Math.sqrt(M / s)), r.x <= 0 && (r.x = 1), I && I < r.x && (r.x = I), r.x % 2 == 0 && r.x--, l.x = r.x * C, r.y = 1 + 2 * Math.ceil((r.x * s - 1) / 2), l.y = Math.round(l.x * s), (r.y * r.x > M || I && I < r.y) && (I && I < r.y ? (r.y = I, r.y % 2 == 0 && r.x--) : r.y -= 2, l.y = r.y * C, r.x = 1 + 2 * Math.ceil((r.y / s - 1) / 2), l.x = Math.round(l.y / s)), { height: l.y, width: l.x, hideYDots: r.y, hideXDots: r.x };
888
+ })({ originalWidth: this._image.width, originalHeight: this._image.height, maxHiddenDots: w, maxHiddenAxisDots: t - 14, dotSize: i });
889
+ }
890
+ this.drawBackground(), this.drawDots(((f, p) => {
891
+ var v, w, y, m, M, I;
892
+ return !(this._options.imageOptions.hideBackgroundDots && f >= (t - a.hideYDots) / 2 && f < (t + a.hideYDots) / 2 && p >= (t - a.hideXDots) / 2 && p < (t + a.hideXDots) / 2 || !((v = F[f]) === null || v === void 0) && v[p] || !((w = F[f - t + 7]) === null || w === void 0) && w[p] || !((y = F[f]) === null || y === void 0) && y[p - t + 7] || !((m = H[f]) === null || m === void 0) && m[p] || !((M = H[f - t + 7]) === null || M === void 0) && M[p] || !((I = H[f]) === null || I === void 0) && I[p - t + 7]);
893
+ })), this.drawCorners(), this._options.image && await this.drawImage({ width: a.width, height: a.height, count: t, dotSize: i });
894
+ }
895
+ drawBackground() {
896
+ var e, t, n;
897
+ const o = this._element, i = this._options;
898
+ if (o) {
899
+ const a = (e = i.backgroundOptions) === null || e === void 0 ? void 0 : e.gradient, f = (t = i.backgroundOptions) === null || t === void 0 ? void 0 : t.color;
900
+ let p = i.height, v = i.width;
901
+ if (a || f) {
902
+ const w = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
903
+ this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", `clip-path-background-color-${this._instanceId}`), this._defs.appendChild(this._backgroundClipPath), !((n = i.backgroundOptions) === null || n === void 0) && n.round && (p = v = Math.min(i.width, i.height), w.setAttribute("rx", String(p / 2 * i.backgroundOptions.round))), w.setAttribute("x", String(this._roundSize((i.width - v) / 2))), w.setAttribute("y", String(this._roundSize((i.height - p) / 2))), w.setAttribute("width", String(v)), w.setAttribute("height", String(p)), this._backgroundClipPath.appendChild(w), this._createColor({ options: a, color: f, additionalRotation: 0, x: 0, y: 0, height: i.height, width: i.width, name: `background-color-${this._instanceId}` });
904
+ }
905
+ }
906
+ }
907
+ drawDots(e) {
908
+ var t, n;
909
+ if (!this._qr) throw "QR code is not defined";
910
+ const o = this._options, i = this._qr.getModuleCount();
911
+ if (i > o.width || i > o.height) throw "The canvas is too small.";
912
+ const a = Math.min(o.width, o.height) - 2 * o.margin, f = o.shape === nt ? a / Math.sqrt(2) : a, p = this._roundSize(f / i), v = this._roundSize((o.width - i * p) / 2), w = this._roundSize((o.height - i * p) / 2), y = new dt({ svg: this._element, type: o.dotsOptions.type, window: this._window });
913
+ this._dotsClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._dotsClipPath.setAttribute("id", `clip-path-dot-color-${this._instanceId}`), this._defs.appendChild(this._dotsClipPath), this._createColor({ options: (t = o.dotsOptions) === null || t === void 0 ? void 0 : t.gradient, color: o.dotsOptions.color, additionalRotation: 0, x: 0, y: 0, height: o.height, width: o.width, name: `dot-color-${this._instanceId}` });
914
+ for (let m = 0; m < i; m++) for (let M = 0; M < i; M++) e && !e(m, M) || !((n = this._qr) === null || n === void 0) && n.isDark(m, M) && (y.draw(v + M * p, w + m * p, p, ((I, C) => !(M + I < 0 || m + C < 0 || M + I >= i || m + C >= i) && !(e && !e(m + C, M + I)) && !!this._qr && this._qr.isDark(m + C, M + I))), y._element && this._dotsClipPath && this._dotsClipPath.appendChild(y._element));
915
+ if (o.shape === nt) {
916
+ const m = this._roundSize((a / p - i) / 2), M = i + 2 * m, I = v - m * p, C = w - m * p, r = [], l = this._roundSize(M / 2);
917
+ for (let s = 0; s < M; s++) {
918
+ r[s] = [];
919
+ for (let c = 0; c < M; c++) s >= m - 1 && s <= M - m && c >= m - 1 && c <= M - m || Math.sqrt((s - l) * (s - l) + (c - l) * (c - l)) > l ? r[s][c] = 0 : r[s][c] = this._qr.isDark(c - 2 * m < 0 ? c : c >= i ? c - 2 * m : c - m, s - 2 * m < 0 ? s : s >= i ? s - 2 * m : s - m) ? 1 : 0;
920
+ }
921
+ for (let s = 0; s < M; s++) for (let c = 0; c < M; c++) r[s][c] && (y.draw(I + c * p, C + s * p, p, ((u, b) => {
922
+ var N;
923
+ return !!(!((N = r[s + b]) === null || N === void 0) && N[c + u]);
924
+ })), y._element && this._dotsClipPath && this._dotsClipPath.appendChild(y._element));
925
+ }
926
+ }
927
+ drawCorners() {
928
+ if (!this._qr) throw "QR code is not defined";
929
+ const e = this._element, t = this._options;
930
+ if (!e) throw "Element code is not defined";
931
+ const n = this._qr.getModuleCount(), o = Math.min(t.width, t.height) - 2 * t.margin, i = t.shape === nt ? o / Math.sqrt(2) : o, a = this._roundSize(i / n), f = 7 * a, p = 3 * a, v = this._roundSize((t.width - n * a) / 2), w = this._roundSize((t.height - n * a) / 2);
932
+ [[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([y, m, M]) => {
933
+ var I, C, r, l, s, c, u, b, N, O, D, T, E, Y;
934
+ const q = v + y * a * (n - 7), z = w + m * a * (n - 7);
935
+ let L = this._dotsClipPath, x = this._dotsClipPath;
936
+ if ((!((I = t.cornersSquareOptions) === null || I === void 0) && I.gradient || !((C = t.cornersSquareOptions) === null || C === void 0) && C.color) && (L = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), L.setAttribute("id", `clip-path-corners-square-color-${y}-${m}-${this._instanceId}`), this._defs.appendChild(L), this._cornersSquareClipPath = this._cornersDotClipPath = x = L, this._createColor({ options: (r = t.cornersSquareOptions) === null || r === void 0 ? void 0 : r.gradient, color: (l = t.cornersSquareOptions) === null || l === void 0 ? void 0 : l.color, additionalRotation: M, x: q, y: z, height: f, width: f, name: `corners-square-color-${y}-${m}-${this._instanceId}` })), ((s = t.cornersSquareOptions) === null || s === void 0 ? void 0 : s.type) && rt.includes(t.cornersSquareOptions.type)) {
937
+ const P = new tt({ svg: this._element, type: t.cornersSquareOptions.type, window: this._window });
938
+ P.draw(q, z, f, M), P._element && L && L.appendChild(P._element);
939
+ } else {
940
+ const P = new dt({ svg: this._element, type: ((c = t.cornersSquareOptions) === null || c === void 0 ? void 0 : c.type) || t.dotsOptions.type, window: this._window });
941
+ for (let Q = 0; Q < F.length; Q++) for (let S = 0; S < F[Q].length; S++) !((u = F[Q]) === null || u === void 0) && u[S] && (P.draw(q + S * a, z + Q * a, a, ((K, Z) => {
942
+ var G;
943
+ return !!(!((G = F[Q + Z]) === null || G === void 0) && G[S + K]);
944
+ })), P._element && L && L.appendChild(P._element));
945
+ }
946
+ if ((!((b = t.cornersDotOptions) === null || b === void 0) && b.gradient || !((N = t.cornersDotOptions) === null || N === void 0) && N.color) && (x = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), x.setAttribute("id", `clip-path-corners-dot-color-${y}-${m}-${this._instanceId}`), this._defs.appendChild(x), this._cornersDotClipPath = x, this._createColor({ options: (O = t.cornersDotOptions) === null || O === void 0 ? void 0 : O.gradient, color: (D = t.cornersDotOptions) === null || D === void 0 ? void 0 : D.color, additionalRotation: M, x: q + 2 * a, y: z + 2 * a, height: p, width: p, name: `corners-dot-color-${y}-${m}-${this._instanceId}` })), ((T = t.cornersDotOptions) === null || T === void 0 ? void 0 : T.type) && k.includes(t.cornersDotOptions.type)) {
947
+ const P = new et({ svg: this._element, type: t.cornersDotOptions.type, window: this._window });
948
+ P.draw(q + 2 * a, z + 2 * a, p, M), P._element && x && x.appendChild(P._element);
949
+ } else {
950
+ const P = new dt({ svg: this._element, type: ((E = t.cornersDotOptions) === null || E === void 0 ? void 0 : E.type) || t.dotsOptions.type, window: this._window });
951
+ for (let Q = 0; Q < H.length; Q++) for (let S = 0; S < H[Q].length; S++) !((Y = H[Q]) === null || Y === void 0) && Y[S] && (P.draw(q + S * a, z + Q * a, a, ((K, Z) => {
952
+ var G;
953
+ return !!(!((G = H[Q + Z]) === null || G === void 0) && G[S + K]);
954
+ })), P._element && x && x.appendChild(P._element));
955
+ }
956
+ }));
957
+ }
958
+ loadImage() {
959
+ return new Promise(((e, t) => {
960
+ var n;
961
+ const o = this._options;
962
+ if (!o.image) return t("Image is not defined");
963
+ if (!((n = o.nodeCanvas) === null || n === void 0) && n.loadImage) o.nodeCanvas.loadImage(o.image).then(((i) => {
964
+ var a, f;
965
+ if (this._image = i, this._options.imageOptions.saveAsBlob) {
966
+ const p = (a = o.nodeCanvas) === null || a === void 0 ? void 0 : a.createCanvas(this._image.width, this._image.height);
967
+ (f = p == null ? void 0 : p.getContext("2d")) === null || f === void 0 || f.drawImage(i, 0, 0), this._imageUri = p == null ? void 0 : p.toDataURL();
968
+ }
969
+ e();
970
+ })).catch(t);
971
+ else {
972
+ const i = new this._window.Image();
973
+ typeof o.imageOptions.crossOrigin == "string" && (i.crossOrigin = o.imageOptions.crossOrigin), this._image = i, i.onload = async () => {
974
+ this._options.imageOptions.saveAsBlob && (this._imageUri = await (async function(a, f) {
975
+ return new Promise(((p) => {
976
+ const v = new f.XMLHttpRequest();
977
+ v.onload = function() {
978
+ const w = new f.FileReader();
979
+ w.onloadend = function() {
980
+ p(w.result);
981
+ }, w.readAsDataURL(v.response);
982
+ }, v.open("GET", a), v.responseType = "blob", v.send();
983
+ }));
984
+ })(o.image || "", this._window)), e();
985
+ }, i.src = o.image;
986
+ }
987
+ }));
988
+ }
989
+ async drawImage({ width: e, height: t, count: n, dotSize: o }) {
990
+ const i = this._options, a = this._roundSize((i.width - n * o) / 2), f = this._roundSize((i.height - n * o) / 2), p = a + this._roundSize(i.imageOptions.margin + (n * o - e) / 2), v = f + this._roundSize(i.imageOptions.margin + (n * o - t) / 2), w = e - 2 * i.imageOptions.margin, y = t - 2 * i.imageOptions.margin, m = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image");
991
+ m.setAttribute("href", this._imageUri || ""), m.setAttribute("xlink:href", this._imageUri || ""), m.setAttribute("x", String(p)), m.setAttribute("y", String(v)), m.setAttribute("width", `${w}px`), m.setAttribute("height", `${y}px`), this._element.appendChild(m);
992
+ }
993
+ _createColor({ options: e, color: t, additionalRotation: n, x: o, y: i, height: a, width: f, name: p }) {
994
+ const v = f > a ? f : a, w = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
995
+ if (w.setAttribute("x", String(o)), w.setAttribute("y", String(i)), w.setAttribute("height", String(a)), w.setAttribute("width", String(f)), w.setAttribute("clip-path", `url('#clip-path-${p}')`), e) {
996
+ let y;
997
+ if (e.type === "radial") y = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), y.setAttribute("id", p), y.setAttribute("gradientUnits", "userSpaceOnUse"), y.setAttribute("fx", String(o + f / 2)), y.setAttribute("fy", String(i + a / 2)), y.setAttribute("cx", String(o + f / 2)), y.setAttribute("cy", String(i + a / 2)), y.setAttribute("r", String(v / 2));
998
+ else {
999
+ const m = ((e.rotation || 0) + n) % (2 * Math.PI), M = (m + 2 * Math.PI) % (2 * Math.PI);
1000
+ let I = o + f / 2, C = i + a / 2, r = o + f / 2, l = i + a / 2;
1001
+ M >= 0 && M <= 0.25 * Math.PI || M > 1.75 * Math.PI && M <= 2 * Math.PI ? (I -= f / 2, C -= a / 2 * Math.tan(m), r += f / 2, l += a / 2 * Math.tan(m)) : M > 0.25 * Math.PI && M <= 0.75 * Math.PI ? (C -= a / 2, I -= f / 2 / Math.tan(m), l += a / 2, r += f / 2 / Math.tan(m)) : M > 0.75 * Math.PI && M <= 1.25 * Math.PI ? (I += f / 2, C += a / 2 * Math.tan(m), r -= f / 2, l -= a / 2 * Math.tan(m)) : M > 1.25 * Math.PI && M <= 1.75 * Math.PI && (C += a / 2, I += f / 2 / Math.tan(m), l -= a / 2, r -= f / 2 / Math.tan(m)), y = this._window.document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"), y.setAttribute("id", p), y.setAttribute("gradientUnits", "userSpaceOnUse"), y.setAttribute("x1", String(Math.round(I))), y.setAttribute("y1", String(Math.round(C))), y.setAttribute("x2", String(Math.round(r))), y.setAttribute("y2", String(Math.round(l)));
1002
+ }
1003
+ e.colorStops.forEach((({ offset: m, color: M }) => {
1004
+ const I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "stop");
1005
+ I.setAttribute("offset", 100 * m + "%"), I.setAttribute("stop-color", M), y.appendChild(I);
1006
+ })), w.setAttribute("fill", `url('#${p}')`), this._defs.appendChild(y);
1007
+ } else t && w.setAttribute("fill", t);
1008
+ this._element.appendChild(w);
1009
+ }
1010
+ }
1011
+ ot.instanceCount = 0;
1012
+ const pt = ot, lt = "canvas", ft = {};
1013
+ for (let d = 0; d <= 40; d++) ft[d] = d;
1014
+ const wt = { type: lt, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: ft[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } };
1015
+ function ct(d) {
1016
+ const e = Object.assign({}, d);
1017
+ if (!e.colorStops || !e.colorStops.length) throw "Field 'colorStops' is required in gradient";
1018
+ return e.rotation ? e.rotation = Number(e.rotation) : e.rotation = 0, e.colorStops = e.colorStops.map(((t) => Object.assign(Object.assign({}, t), { offset: Number(t.offset) }))), e;
1019
+ }
1020
+ function mt(d) {
1021
+ const e = Object.assign({}, d);
1022
+ return e.width = Number(e.width), e.height = Number(e.height), e.margin = Number(e.margin), e.imageOptions = Object.assign(Object.assign({}, e.imageOptions), { hideBackgroundDots: !!e.imageOptions.hideBackgroundDots, imageSize: Number(e.imageOptions.imageSize), margin: Number(e.imageOptions.margin) }), e.margin > Math.min(e.width, e.height) && (e.margin = Math.min(e.width, e.height)), e.dotsOptions = Object.assign({}, e.dotsOptions), e.dotsOptions.gradient && (e.dotsOptions.gradient = ct(e.dotsOptions.gradient)), e.cornersSquareOptions && (e.cornersSquareOptions = Object.assign({}, e.cornersSquareOptions), e.cornersSquareOptions.gradient && (e.cornersSquareOptions.gradient = ct(e.cornersSquareOptions.gradient))), e.cornersDotOptions && (e.cornersDotOptions = Object.assign({}, e.cornersDotOptions), e.cornersDotOptions.gradient && (e.cornersDotOptions.gradient = ct(e.cornersDotOptions.gradient))), e.backgroundOptions && (e.backgroundOptions = Object.assign({}, e.backgroundOptions), e.backgroundOptions.gradient && (e.backgroundOptions.gradient = ct(e.backgroundOptions.gradient))), e;
1023
+ }
1024
+ var vt = $(873), yt = $.n(vt);
1025
+ function ht(d) {
1026
+ if (!d) throw new Error("Extension must be defined");
1027
+ d[0] === "." && (d = d.substring(1));
1028
+ const e = { bmp: "image/bmp", gif: "image/gif", ico: "image/vnd.microsoft.icon", jpeg: "image/jpeg", jpg: "image/jpeg", png: "image/png", svg: "image/svg+xml", tif: "image/tiff", tiff: "image/tiff", webp: "image/webp", pdf: "application/pdf" }[d.toLowerCase()];
1029
+ if (!e) throw new Error(`Extension "${d}" is not supported`);
1030
+ return e;
1031
+ }
1032
+ class g {
1033
+ constructor(e) {
1034
+ e != null && e.jsdom ? this._window = new e.jsdom("", { resources: "usable" }).window : this._window = window, this._options = e ? mt(U(wt, e)) : wt, this.update();
1035
+ }
1036
+ static _clearContainer(e) {
1037
+ e && (e.innerHTML = "");
1038
+ }
1039
+ _setupSvg() {
1040
+ if (!this._qr) return;
1041
+ const e = new pt(this._options, this._window);
1042
+ this._svg = e.getElement(), this._svgDrawingPromise = e.drawQR(this._qr).then((() => {
1043
+ var t;
1044
+ this._svg && ((t = this._extension) === null || t === void 0 || t.call(this, e.getElement(), this._options));
1045
+ }));
1046
+ }
1047
+ _setupCanvas() {
1048
+ var e, t;
1049
+ this._qr && (!((e = this._options.nodeCanvas) === null || e === void 0) && e.createCanvas ? (this._nodeCanvas = this._options.nodeCanvas.createCanvas(this._options.width, this._options.height), this._nodeCanvas.width = this._options.width, this._nodeCanvas.height = this._options.height) : (this._domCanvas = document.createElement("canvas"), this._domCanvas.width = this._options.width, this._domCanvas.height = this._options.height), this._setupSvg(), this._canvasDrawingPromise = (t = this._svgDrawingPromise) === null || t === void 0 ? void 0 : t.then((() => {
1050
+ var n;
1051
+ if (!this._svg) return;
1052
+ const o = this._svg, i = new this._window.XMLSerializer().serializeToString(o), a = btoa(i), f = `data:${ht("svg")};base64,${a}`;
1053
+ if (!((n = this._options.nodeCanvas) === null || n === void 0) && n.loadImage) return this._options.nodeCanvas.loadImage(f).then(((p) => {
1054
+ var v, w;
1055
+ p.width = this._options.width, p.height = this._options.height, (w = (v = this._nodeCanvas) === null || v === void 0 ? void 0 : v.getContext("2d")) === null || w === void 0 || w.drawImage(p, 0, 0);
1056
+ }));
1057
+ {
1058
+ const p = new this._window.Image();
1059
+ return new Promise(((v) => {
1060
+ p.onload = () => {
1061
+ var w, y;
1062
+ (y = (w = this._domCanvas) === null || w === void 0 ? void 0 : w.getContext("2d")) === null || y === void 0 || y.drawImage(p, 0, 0), v();
1063
+ }, p.src = f;
1064
+ }));
1065
+ }
1066
+ })));
1067
+ }
1068
+ async _getElement(e = "png") {
1069
+ if (!this._qr) throw "QR code is empty";
1070
+ return e.toLowerCase() === "svg" ? (this._svg && this._svgDrawingPromise || this._setupSvg(), await this._svgDrawingPromise, this._svg) : ((this._domCanvas || this._nodeCanvas) && this._canvasDrawingPromise || this._setupCanvas(), await this._canvasDrawingPromise, this._domCanvas || this._nodeCanvas);
1071
+ }
1072
+ update(e) {
1073
+ g._clearContainer(this._container), this._options = e ? mt(U(this._options, e)) : this._options, this._options.data && (this._qr = yt()(this._options.qrOptions.typeNumber, this._options.qrOptions.errorCorrectionLevel), this._qr.addData(this._options.data, this._options.qrOptions.mode || (function(t) {
1074
+ switch (!0) {
1075
+ case /^[0-9]*$/.test(t):
1076
+ return "Numeric";
1077
+ case /^[0-9A-Z $%*+\-./:]*$/.test(t):
1078
+ return "Alphanumeric";
1079
+ default:
1080
+ return "Byte";
1081
+ }
1082
+ })(this._options.data)), this._qr.make(), this._options.type === lt ? this._setupCanvas() : this._setupSvg(), this.append(this._container));
1083
+ }
1084
+ append(e) {
1085
+ if (e) {
1086
+ if (typeof e.appendChild != "function") throw "Container should be a single DOM node";
1087
+ this._options.type === lt ? this._domCanvas && e.appendChild(this._domCanvas) : this._svg && e.appendChild(this._svg), this._container = e;
1088
+ }
1089
+ }
1090
+ applyExtension(e) {
1091
+ if (!e) throw "Extension function should be defined.";
1092
+ this._extension = e, this.update();
1093
+ }
1094
+ deleteExtension() {
1095
+ this._extension = void 0, this.update();
1096
+ }
1097
+ async getRawData(e = "png") {
1098
+ if (!this._qr) throw "QR code is empty";
1099
+ const t = await this._getElement(e), n = ht(e);
1100
+ if (!t) return null;
1101
+ if (e.toLowerCase() === "svg") {
1102
+ const o = `<?xml version="1.0" standalone="no"?>\r
1103
+ ${new this._window.XMLSerializer().serializeToString(t)}`;
1104
+ return typeof Blob > "u" || this._options.jsdom ? Buffer.from(o) : new Blob([o], { type: n });
1105
+ }
1106
+ return new Promise(((o) => {
1107
+ const i = t;
1108
+ if ("toBuffer" in i) if (n === "image/png") o(i.toBuffer(n));
1109
+ else if (n === "image/jpeg") o(i.toBuffer(n));
1110
+ else {
1111
+ if (n !== "application/pdf") throw Error("Unsupported extension");
1112
+ o(i.toBuffer(n));
1113
+ }
1114
+ else "toBlob" in i && i.toBlob(o, n, 1);
1115
+ }));
1116
+ }
1117
+ async download(e) {
1118
+ if (!this._qr) throw "QR code is empty";
1119
+ if (typeof Blob > "u") throw "Cannot download in Node.js, call getRawData instead.";
1120
+ let t = "png", n = "qr";
1121
+ typeof e == "string" ? (t = e, console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")) : typeof e == "object" && e !== null && (e.name && (n = e.name), e.extension && (t = e.extension));
1122
+ const o = await this._getElement(t);
1123
+ if (o) if (t.toLowerCase() === "svg") {
1124
+ let i = new XMLSerializer().serializeToString(o);
1125
+ i = `<?xml version="1.0" standalone="no"?>\r
1126
+ ` + i, W(`data:${ht(t)};charset=utf-8,${encodeURIComponent(i)}`, `${n}.svg`);
1127
+ } else W(o.toDataURL(ht(t)), `${n}.${t}`);
1128
+ }
1129
+ }
1130
+ const h = g;
1131
+ })(), at.default;
1132
+ })()));
1133
+ })(Ot);
1134
+ const kt = /* @__PURE__ */ jt(Ot.exports), bt = {
1135
+ /**
1136
+ * In use
1137
+ */
1138
+ CONNECT_WITH_METAMASK: "Connect with Metamask",
1139
+ USE_EXTENSION: "Use extension",
1140
+ USE_MOBILE: "Use mobile",
1141
+ ONE_CLICK_CONNECT: "Connect in one click to the MetaMask extension.",
1142
+ CONNECT_WITH_EXTENSION: "Connect With Extension",
1143
+ SCAN_TO_CONNECT: "Scan to connect with the MetaMask mobile app.",
1144
+ /**
1145
+ * In use
1146
+ */
1147
+ DESKTOP: "Desktop",
1148
+ MOBILE: "Mobile",
1149
+ META_MASK_MOBILE_APP: "MetaMask mobile app",
1150
+ INSTALL_MODAL: {
1151
+ TRUSTED_BY_USERS: "Trusted by over 30 million users to buy, store, send and swap crypto securely",
1152
+ LEADING_CRYPTO_WALLET: "The leading crypto wallet & gateway to blockchain apps built on Ethereum Mainnet, Polygon, Optimism, and many other networks",
1153
+ CONTROL_DIGITAL_INTERACTIONS: "Puts you in control of your digital interactions by making power of cryptography more accessible",
1154
+ INSTALL_META_MASK_EXTENSION_BUTTON: "Install MetaMask Extension",
1155
+ INSTALL_META_MASK_EXTENSION_TEXT: "Install and try the MetaMask browser extension."
1156
+ },
1157
+ PENDING_MODAL: {
1158
+ OPEN_META_MASK_SELECT_CODE: "Please open the MetaMask wallet app and select the code on the screen OR disconnect",
1159
+ OPEN_META_MASK_CONTINUE: "Open the MetaMask app to continue with your session.",
1160
+ NUMBER_AFTER_OPEN_NOTICE: "If a number doesn't appear after opening MetaMask, please click disconnect and re-scan the QRCode.",
1161
+ DISCONNECT: "Disconnect"
1162
+ },
1163
+ SELECT_MODAL: {
1164
+ CRYPTO_TAKE_CONTROL_TEXT: "Take control of your crypto and explore the blockchain with the wallet trusted by over 30 million people worldwide"
1165
+ },
1166
+ META_MASK_MODAL: {
1167
+ ADDRESS_COPIED: "Address copied to clipboard!",
1168
+ DISCONNECT: "Disconnect",
1169
+ ACTIVE_NETWORK: "Active Network"
1170
+ }
1171
+ };
1172
+ class At {
1173
+ constructor(B) {
1174
+ var j;
1175
+ this.translations = bt, this.supportedLocales = [
1176
+ "es",
1177
+ "fr",
1178
+ "he",
1179
+ "it",
1180
+ "pt",
1181
+ "tr"
1182
+ ], this.baseUrl = (j = B == null ? void 0 : B.baseUrl) !== null && j !== void 0 ? j : "https://raw.githubusercontent.com/MetaMask/metamask-sdk/refs/heads/gh-pages/locales";
1183
+ }
1184
+ getBrowserLanguage() {
1185
+ if ((navigator.languages || [navigator.language]).some((at) => at.toLowerCase().startsWith("en")))
1186
+ return "en";
1187
+ const $ = navigator.language.toLowerCase().split("-")[0];
1188
+ return this.supportedLocales.includes($) ? $ : "en";
1189
+ }
1190
+ async init(B) {
1191
+ const X = this.getBrowserLanguage() || B.fallbackLng;
1192
+ await this.loadTranslations(X);
1193
+ }
1194
+ async loadTranslations(B) {
1195
+ const j = B.split("-")[0];
1196
+ if (j === "en" || !this.supportedLocales.includes(j)) {
1197
+ this.translations = bt;
1198
+ return;
1199
+ }
1200
+ try {
1201
+ const X = `${this.baseUrl}/${j}.json`, $ = await fetch(X);
1202
+ if (!$.ok)
1203
+ throw new Error(`HTTP error! status: ${$.status}`);
1204
+ this.translations = await $.json();
1205
+ } catch (X) {
1206
+ console.warn(`❌ Failed to load ${j} translations, falling back to English:`, X), this.translations = bt;
1207
+ }
1208
+ }
1209
+ t(B) {
1210
+ return this.getNestedTranslation(B, this.translations) || B;
1211
+ }
1212
+ getNestedTranslation(B, j) {
1213
+ const X = B.split(".");
1214
+ let $ = j;
1215
+ for (const at of X) {
1216
+ if (typeof $ != "object")
1217
+ return "";
1218
+ $ = $[at];
1219
+ }
1220
+ return typeof $ == "string" ? $ : "";
1221
+ }
1222
+ }
1223
+ const Et = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAxNDIgMTM3Ij4KICA8cGF0aCBmaWxsPSIjRkY1QzE2IiBkPSJtMTMyLjI0IDEzMS43NTEtMzAuNDgxLTkuMDc2LTIyLjk4NiAxMy43NDEtMTYuMDM4LS4wMDctMjMtMTMuNzM0LTMwLjQ2NyA5LjA3NkwwIDEwMC40NjVsOS4yNjgtMzQuNzIzTDAgMzYuMzg1IDkuMjY4IDBsNDcuNjA3IDI4LjQ0M2gyNy43NTdMMTMyLjI0IDBsOS4yNjggMzYuMzg1LTkuMjY4IDI5LjM1NyA5LjI2OCAzNC43MjMtOS4yNjggMzEuMjg2WiIvPgogIDxwYXRoIGZpbGw9IiNGRjVDMTYiIGQ9Im05LjI3NCAwIDQ3LjYwOCAyOC40NjMtMS44OTMgMTkuNTM0TDkuMjc0IDBabTMwLjQ2OCAxMDAuNDc4IDIwLjk0NyAxNS45NTctMjAuOTQ3IDYuMjR2LTIyLjE5N1ptMTkuMjczLTI2LjM4MUw1NC45ODkgNDguMDFsLTI1Ljc3IDE3Ljc0LS4wMTQtLjAwN3YuMDEzbC4wOCAxOC4yNiAxMC40NS05LjkxOGgxOS4yOFpNMTMyLjI0IDAgODQuNjMyIDI4LjQ2M2wxLjg4NyAxOS41MzRMMTMyLjI0IDBabS0zMC40NjcgMTAwLjQ3OC0yMC45NDggMTUuOTU3IDIwLjk0OCA2LjI0di0yMi4xOTdabTEwLjUyOS0zNC43MjNoLjAwNy0uMDA3di0uMDEzbC0uMDA2LjAwNy0yNS43Ny0xNy43MzlMODIuNSA3NC4wOTdoMTkuMjcybDEwLjQ1NyA5LjkxNy4wNzMtMTguMjU5WiIvPgogIDxwYXRoIGZpbGw9IiNFMzQ4MDciIGQ9Im0zOS43MzUgMTIyLjY3NS0zMC40NjcgOS4wNzZMMCAxMDAuNDc4aDM5LjczNXYyMi4xOTdaTTU5LjAwOCA3NC4wOWw1LjgyIDM3LjcxNC04LjA2Ni0yMC45Ny0yNy40OS02LjgyIDEwLjQ1Ni05LjkyM2gxOS4yOFptNDIuNzY0IDQ4LjU4NSAzMC40NjggOS4wNzYgOS4yNjgtMzEuMjczaC0zOS43MzZ2MjIuMTk3Wk04Mi41IDc0LjA5bC01LjgyIDM3LjcxNCA4LjA2NS0yMC45NyAyNy40OTEtNi44Mi0xMC40NjMtOS45MjNIODIuNVoiLz4KICA8cGF0aCBmaWxsPSIjRkY4RDVEIiBkPSJtMCAxMDAuNDY1IDkuMjY4LTM0LjcyM2gxOS45M2wuMDczIDE4LjI2NiAyNy40OTIgNi44MiA4LjA2NSAyMC45NjktNC4xNDYgNC42MTgtMjAuOTQ3LTE1Ljk1N0gwdi4wMDdabTE0MS41MDggMC05LjI2OC0zNC43MjNoLTE5LjkzMWwtLjA3MyAxOC4yNjYtMjcuNDkgNi44Mi04LjA2NiAyMC45NjkgNC4xNDUgNC42MTggMjAuOTQ4LTE1Ljk1N2gzOS43MzV2LjAwN1pNODQuNjMyIDI4LjQ0M0g1Ni44NzVMNTQuOTkgNDcuOTc3bDkuODM5IDYzLjhINzYuNjhsOS44NDUtNjMuOC0xLjg5My0xOS41MzRaIi8+CiAgPHBhdGggZmlsbD0iIzY2MTgwMCIgZD0iTTkuMjY4IDAgMCAzNi4zODVsOS4yNjggMjkuMzU3aDE5LjkzbDI1Ljc4NC0xNy43NDVMOS4yNjggMFptNDMuOTggODEuNjY1aC05LjAyOWwtNC45MTYgNC44MTkgMTcuNDY2IDQuMzMtMy41MjEtOS4xNTV2LjAwNlpNMTMyLjI0IDBsOS4yNjggMzYuMzg1LTkuMjY4IDI5LjM1N2gtMTkuOTMxTDg2LjUyNiA0Ny45OTcgMTMyLjI0IDBaTTg4LjI3MyA4MS42NjVoOS4wNDJsNC45MTYgNC44MjUtMTcuNDg2IDQuMzM4IDMuNTI4LTkuMTd2LjAwN1ptLTkuNTA3IDQyLjMwNSAyLjA2LTcuNTQyLTQuMTQ2LTQuNjE4SDY0LjgybC00LjE0NSA0LjYxOCAyLjA1OSA3LjU0MiIvPgogIDxwYXRoIGZpbGw9IiNDMEM0Q0QiIGQ9Ik03OC43NjYgMTIzLjk2OXYxMi40NTNINjIuNzM1di0xMi40NTNoMTYuMDNaIi8+CiAgPHBhdGggZmlsbD0iI0U3RUJGNiIgZD0ibTM5Ljc0MiAxMjIuNjYyIDIzLjAwNiAxMy43NTR2LTEyLjQ1M2wtMi4wNi03LjU0MS0yMC45NDYgNi4yNFptNjIuMDMxIDAtMjMuMDA3IDEzLjc1NHYtMTIuNDUzbDIuMDYtNy41NDEgMjAuOTQ3IDYuMjRaIi8+Cjwvc3ZnPgo=", zt = Et, Bt = "@font-face{font-family:'Euclid Circular B';src:url('../assets/fonts/Euclid Circular B Regular.ttf') format('truetype');font-weight:400;font-style:normal;font-display:swap}.flexContainer{display:flex;justify-content:center;align-items:center;flex-direction:row}.flexItem11{flex:11;justify-content:center;align-items:center}.flexItem1{flex:1;justify-content:center;align-items:center}.button{margin-top:41.5px;margin-bottom:20px;width:100%;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px 20px;background:#0376C9;border-radius:32px;color:white;border:0;font-size:14px;cursor:pointer}.backdrop{visibility:visible;position:fixed;top:0;left:0;right:0;bottom:0;width:100%;z-index:99998;background:rgba(0, 0, 0, 0.87);opacity:0.3}.modal{visibility:visible;position:fixed;left:50%;transform:translate(-50%, -50%);z-index:99999;background:white;padding:20px;border-radius:8px;top:50%;max-width:360px;width:460px;min-width:300px;box-shadow:rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;-webkit-font-smoothing:antialiased}.sectionDivider{height:1px;background-color:#B7BBC866;margin-top:17px;margin-bottom:10px}.closeButtonContainer{position:absolute;right:15px;top:15px;padding:10px;user-select:none}.buttonText{margin-left:10px}.closeButton{color:#BBC0C5;cursor:pointer;user-select:none}.right{display:flex;align-items:center;justify-content:right}#sdk-mm-qrcode{margin-top:10px;margin-bottom:10px;display:flex;justify-content:center;align-items:center;border:none !important;outline:none !important;box-shadow:none !important}#sdk-mm-qrcode svg{width:100% !important;height:auto !important;border:none !important;outline:none !important;box-shadow:none !important;stroke:none !important;stroke-width:0 !important;background:transparent !important}*{font-family:'Euclid Circular B', sans-serif}.modalTitle{font-size:16px;font-weight:700;letter-spacing:0px;line-height:24px;color:#141618;margin-top:4px;text-align:center;user-select:none}.sectionTitle{text-align:center;font-size:14px;font-weight:500;margin-bottom:0px;margin-top:20px;font-weight:bold}.sectionDescription{text-align:center;font-size:14px;font-weight:400;margin-top:5px;color:#6A737D}.extensionButton{padding:15px 20px;margin-top:15px;margin-bottom:0px}.qrContainer{display:flex;justify-content:center;align-items:center;width:100%}.qrCode{margin:0 auto;display:flex;justify-content:center;align-items:center}", $t = Bt, Pt = class {
1224
+ constructor(A) {
1225
+ xt(this, A), this.close = st(this, "close"), this.startDesktopOnboarding = st(this, "startDesktopOnboarding"), this.updateLink = st(this, "updateLink"), this.updateExpiresIn = st(this, "updateExpiresIn"), this.link = void 0, this.expiresIn = void 0, this.showInstallModal = void 0, this.translationsLoaded = !1, this.onClose = this.onClose.bind(this), this.onStartDesktopOnboardingHandler = this.onStartDesktopOnboardingHandler.bind(this), this.render = this.render.bind(this), this.i18nInstance = new At();
1226
+ }
1227
+ componentDidLoad() {
1228
+ this.generateQRCode(this.link);
1229
+ }
1230
+ async connectedCallback() {
1231
+ await this.i18nInstance.init({
1232
+ fallbackLng: "en"
1233
+ }), this.translationsLoaded = !0;
1234
+ }
1235
+ generateQRCode(A) {
1236
+ if (!this.qrCodeContainer)
1237
+ return;
1238
+ const B = {
1239
+ data: A,
1240
+ type: "svg",
1241
+ image: zt,
1242
+ imageOptions: {
1243
+ hideBackgroundDots: !0,
1244
+ crossOrigin: void 0,
1245
+ imageSize: 0.3,
1246
+ saveAsBlob: !1
1247
+ },
1248
+ dotsOptions: {
1249
+ color: "#222222",
1250
+ type: "square",
1251
+ gradient: void 0,
1252
+ roundSize: !1
1253
+ },
1254
+ cornersSquareOptions: {
1255
+ color: "#222222",
1256
+ type: "square",
1257
+ gradient: void 0
1258
+ },
1259
+ cornersDotOptions: {
1260
+ color: "#ff5c16"
1261
+ },
1262
+ backgroundOptions: {
1263
+ color: "transparent"
1264
+ },
1265
+ qrOptions: {
1266
+ typeNumber: 0,
1267
+ mode: "Byte",
1268
+ errorCorrectionLevel: "Q"
1269
+ }
1270
+ }, j = new kt(B);
1271
+ this.qrCodeContainer.innerHTML = "", j.append(this.qrCodeContainer);
1272
+ }
1273
+ onClose(A = !1) {
1274
+ this.close.emit({ shouldTerminate: A });
1275
+ }
1276
+ onStartDesktopOnboardingHandler() {
1277
+ this.startDesktopOnboarding.emit();
1278
+ }
1279
+ updateLinkHandler(A) {
1280
+ this.generateQRCode(A);
1281
+ }
1282
+ updateExpiresInHandler(A) {
1283
+ console.debug("QRCode expires in:", A);
1284
+ }
1285
+ render() {
1286
+ if (!this.translationsLoaded)
1287
+ return null;
1288
+ const A = (j) => this.i18nInstance.t(j), B = this.showInstallModal;
1289
+ return _(Nt, { className: "install-model" }, _("div", { class: "backdrop", onClick: () => this.onClose(!0) }), _("div", { class: "modal" }, _("div", { class: "closeButtonContainer" }, _("div", { class: "right" }, _("span", { class: "closeButton", onClick: () => this.onClose(!0) }, _(St, null)))), _("div", { class: "modalHeader" }, _("h2", { class: "modalTitle" }, A("CONNECT_WITH_METAMASK"))), _("div", { class: "modalContent" }, B ? (
1290
+ // Extension first, then mobile
1291
+ _("div", null, _("div", { class: "connectionSection" }, _("h3", { class: "sectionTitle" }, A("USE_EXTENSION")), _("p", { class: "sectionDescription" }, A("ONE_CLICK_CONNECT")), _("button", { class: "button extensionButton", onClick: () => this.onStartDesktopOnboardingHandler() }, _(Mt, null), _("span", { class: "buttonText" }, A("CONNECT_WITH_EXTENSION")))), _("div", { class: "sectionDivider" }), _("div", { class: "connectionSection" }, _("h3", { class: "sectionTitle" }, A("USE_MOBILE")), _("p", { class: "sectionDescription" }, A("SCAN_TO_CONNECT")), _("div", { class: "qrContainer" }, _("div", { id: "sdk-mm-qrcode", class: "qrCode", ref: (j) => {
1292
+ j && (this.qrCodeContainer = j);
1293
+ } }))))
1294
+ ) : (
1295
+ // Mobile first, then extension
1296
+ _("div", null, _("div", { class: "connectionSection" }, _("h3", { class: "sectionTitle" }, A("USE_MOBILE")), _("p", { class: "sectionDescription" }, A("SCAN_TO_CONNECT")), _("div", { class: "qrContainer" }, _("div", { id: "sdk-mm-qrcode", class: "qrCode", ref: (j) => {
1297
+ j && (this.qrCodeContainer = j);
1298
+ } }))), _("div", { class: "sectionDivider" }), _("div", { class: "connectionSection" }, _("h3", { class: "sectionTitle" }, A("USE_EXTENSION")), _("p", { class: "sectionDescription" }, A("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION_TEXT")), _("button", { class: "button extensionButton", onClick: () => this.onStartDesktopOnboardingHandler() }, _(Mt, null), _("span", { class: "buttonText" }, A("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION_BUTTON")))))
1299
+ ))));
1300
+ }
1301
+ get el() {
1302
+ return Ct(this);
1303
+ }
1304
+ static get watchers() {
1305
+ return {
1306
+ link: ["updateLinkHandler"],
1307
+ expiresIn: ["updateExpiresInHandler"]
1308
+ };
1309
+ }
1310
+ };
1311
+ Pt.style = $t;
1312
+ const qt = "@font-face{font-family:'Euclid Circular B';src:url('../assets/fonts/Euclid Circular B Regular.ttf') format('truetype');font-weight:400;font-style:normal;font-display:swap}.flexContainer{display:flex;justify-content:center;align-items:center;flex-direction:row}.flexItem11{flex:11;justify-content:center;align-items:center}.flexItem1{flex:1;justify-content:center;align-items:center}.button{margin-top:41.5px;margin-bottom:20px;width:100%;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px 20px;background:#0376C9;border-radius:32px;color:white;border:0;font-size:14px;cursor:pointer}.backdrop{visibility:visible;position:fixed;top:0;left:0;right:0;bottom:0;width:100%;z-index:99998;background:rgba(0, 0, 0, 0.87);opacity:0.3}.modal{visibility:visible;position:fixed;left:50%;transform:translate(-50%, -50%);z-index:99999;background:white;padding:20px;border-radius:8px;top:50%;max-width:360px;width:460px;min-width:300px;box-shadow:rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;-webkit-font-smoothing:antialiased}.sectionDivider{height:1px;background-color:#B7BBC866;margin-top:17px;margin-bottom:10px}.closeButtonContainer{position:absolute;right:15px;top:15px;padding:10px;user-select:none}.buttonText{margin-left:10px}.closeButton{color:#BBC0C5;cursor:pointer;user-select:none}.right{display:flex;align-items:center;justify-content:right}#sdk-mm-qrcode{margin-top:10px;margin-bottom:10px;display:flex;justify-content:center;align-items:center;border:none !important;outline:none !important;box-shadow:none !important}#sdk-mm-qrcode svg{width:100% !important;height:auto !important;border:none !important;outline:none !important;box-shadow:none !important;stroke:none !important;stroke-width:0 !important;background:transparent !important}*{font-family:'Euclid Circular B', sans-serif}.modalTitle{font-size:16px;font-weight:700;letter-spacing:0px;line-height:24px;color:#141618;margin-top:4px;text-align:center;user-select:none}.sectionTitle{text-align:center;font-size:14px;font-weight:500;margin-bottom:0px;margin-top:20px;font-weight:bold}.sectionDescription{text-align:center;font-size:14px;font-weight:400;margin-top:5px;color:#6A737D}.extensionButton{padding:15px 20px;margin-top:15px;margin-bottom:0px}.qrContainer{display:flex;justify-content:center;align-items:center;width:100%}.qrCode{margin:0 auto;display:flex;justify-content:center;align-items:center}", Rt = qt, Ut = class {
1313
+ constructor(A) {
1314
+ xt(this, A), this.close = st(this, "close"), this.disconnect = st(this, "disconnect"), this.updateOTPCode = st(this, "updateOTPCode"), this.displayOTP = void 0, this.otpCode = void 0, this.translationsLoaded = !1, this.i18nInstance = new At();
1315
+ }
1316
+ async connectedCallback() {
1317
+ await this.i18nInstance.init({
1318
+ fallbackLng: "en"
1319
+ }), this.translationsLoaded = !0;
1320
+ }
1321
+ onClose() {
1322
+ this.close.emit();
1323
+ }
1324
+ onDisconnect() {
1325
+ this.disconnect.emit();
1326
+ }
1327
+ onUpdateOTPValueHandler(A) {
1328
+ this.updateOTPCode.emit({
1329
+ otpCode: A
1330
+ });
1331
+ }
1332
+ disconnectedCallback() {
1333
+ this.onClose();
1334
+ }
1335
+ render() {
1336
+ var A;
1337
+ if (!this.translationsLoaded)
1338
+ return null;
1339
+ const B = (A = this.displayOTP) !== null && A !== void 0 ? A : !0, j = (X) => this.i18nInstance.t(X);
1340
+ return _(Nt, { className: "pending-modal" }, _("div", { class: "backdrop", onClick: () => this.onClose() }), _("div", { class: "modal" }, _("div", { class: "closeButtonContainer" }, _("div", { class: "right" }, _("span", { class: "closeButton", onClick: () => this.onClose() }, _(St, null)))), _("div", { class: "logoContainer" }, _(Mt, null)), _("div", null, _("div", { class: "flexContainer", style: {
1341
+ flexDirection: "column",
1342
+ color: "black"
1343
+ } }, _("div", { class: "flexItem", style: {
1344
+ textAlign: "center",
1345
+ marginTop: "30px",
1346
+ marginBottom: "30px",
1347
+ fontSize: "16px"
1348
+ } }, j(B ? "PENDING_MODAL.OPEN_META_MASK_SELECT_CODE" : "PENDING_MODAL.OPEN_META_MASK_CONTINUE")), _("div", { id: "sdk-mm-otp-value", style: { padding: "10px", fontSize: "32px", display: this.otpCode ? "block" : "none" } }, this.otpCode), B && _("div", { class: "notice" }, "* ", j("PENDING_MODAL.NUMBER_AFTER_OPEN_NOTICE"))), _("div", { style: { marginTop: "20px" } }, _("button", { class: "button blue", style: {
1349
+ marginTop: "5px",
1350
+ color: "#0376C9",
1351
+ borderColor: "#0376C9",
1352
+ borderWidth: "1px",
1353
+ borderStyle: "solid",
1354
+ backgroundColor: "white"
1355
+ }, onClick: () => this.onDisconnect() }, j("PENDING_MODAL.DISCONNECT"))))));
1356
+ }
1357
+ get el() {
1358
+ return Ct(this);
1359
+ }
1360
+ };
1361
+ Ut.style = Rt;
1362
+ export {
1363
+ Pt as mm_install_modal,
1364
+ Ut as mm_otp_modal
1365
+ };