@unifold/connect-react 0.1.40 → 0.1.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -28,69 +28,69 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var require_qr_code_styling = __commonJS({
29
29
  "../../node_modules/.pnpm/qr-code-styling@1.9.2/node_modules/qr-code-styling/lib/qr-code-styling.js"(exports, module) {
30
30
  "use strict";
31
- !(function(t7, e) {
32
- "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.QRCodeStyling = e() : t7.QRCodeStyling = e();
31
+ !(function(t11, e) {
32
+ "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.QRCodeStyling = e() : t11.QRCodeStyling = e();
33
33
  })(exports, (() => (() => {
34
- var t7 = { 873: (t8, e2) => {
34
+ var t11 = { 873: (t12, e2) => {
35
35
  var i2, r3, n = (function() {
36
- var t9 = function(t10, e4) {
37
- var i4 = t10, r5 = s[e4], n3 = null, o2 = 0, h2 = null, p2 = [], v2 = {}, m = function(t11, e5) {
38
- n3 = (function(t12) {
39
- for (var e6 = new Array(t12), i5 = 0; i5 < t12; i5 += 1) {
40
- e6[i5] = new Array(t12);
41
- for (var r6 = 0; r6 < t12; r6 += 1) e6[i5][r6] = null;
36
+ var t13 = function(t14, e4) {
37
+ var i4 = t14, r5 = s[e4], n3 = null, o2 = 0, h2 = null, p2 = [], v2 = {}, m = function(t15, e5) {
38
+ n3 = (function(t16) {
39
+ for (var e6 = new Array(t16), i5 = 0; i5 < t16; i5 += 1) {
40
+ e6[i5] = new Array(t16);
41
+ for (var r6 = 0; r6 < t16; r6 += 1) e6[i5][r6] = null;
42
42
  }
43
43
  return e6;
44
- })(o2 = 4 * i4 + 17), b(0, 0), b(o2 - 7, 0), b(0, o2 - 7), x(), y(), C(t11, e5), i4 >= 7 && S(t11), null == h2 && (h2 = M(i4, r5, p2)), A(h2, e5);
45
- }, b = function(t11, e5) {
46
- for (var i5 = -1; i5 <= 7; i5 += 1) if (!(t11 + i5 <= -1 || o2 <= t11 + i5)) for (var r6 = -1; r6 <= 7; r6 += 1) e5 + r6 <= -1 || o2 <= e5 + r6 || (n3[t11 + i5][e5 + r6] = 0 <= i5 && i5 <= 6 && (0 == r6 || 6 == r6) || 0 <= r6 && r6 <= 6 && (0 == i5 || 6 == i5) || 2 <= i5 && i5 <= 4 && 2 <= r6 && r6 <= 4);
44
+ })(o2 = 4 * i4 + 17), b(0, 0), b(o2 - 7, 0), b(0, o2 - 7), x(), y(), C(t15, e5), i4 >= 7 && S(t15), null == h2 && (h2 = M(i4, r5, p2)), A(h2, e5);
45
+ }, b = function(t15, e5) {
46
+ for (var i5 = -1; i5 <= 7; i5 += 1) if (!(t15 + i5 <= -1 || o2 <= t15 + i5)) for (var r6 = -1; r6 <= 7; r6 += 1) e5 + r6 <= -1 || o2 <= e5 + r6 || (n3[t15 + i5][e5 + r6] = 0 <= i5 && i5 <= 6 && (0 == r6 || 6 == r6) || 0 <= r6 && r6 <= 6 && (0 == i5 || 6 == i5) || 2 <= i5 && i5 <= 4 && 2 <= r6 && r6 <= 4);
47
47
  }, y = function() {
48
- for (var t11 = 8; t11 < o2 - 8; t11 += 1) null == n3[t11][6] && (n3[t11][6] = t11 % 2 == 0);
48
+ for (var t15 = 8; t15 < o2 - 8; t15 += 1) null == n3[t15][6] && (n3[t15][6] = t15 % 2 == 0);
49
49
  for (var e5 = 8; e5 < o2 - 8; e5 += 1) null == n3[6][e5] && (n3[6][e5] = e5 % 2 == 0);
50
50
  }, x = function() {
51
- for (var t11 = a.getPatternPosition(i4), e5 = 0; e5 < t11.length; e5 += 1) for (var r6 = 0; r6 < t11.length; r6 += 1) {
52
- var o3 = t11[e5], s2 = t11[r6];
51
+ for (var t15 = a.getPatternPosition(i4), e5 = 0; e5 < t15.length; e5 += 1) for (var r6 = 0; r6 < t15.length; r6 += 1) {
52
+ var o3 = t15[e5], s2 = t15[r6];
53
53
  if (null == n3[o3][s2]) for (var h3 = -2; h3 <= 2; h3 += 1) for (var d2 = -2; d2 <= 2; d2 += 1) n3[o3 + h3][s2 + d2] = -2 == h3 || 2 == h3 || -2 == d2 || 2 == d2 || 0 == h3 && 0 == d2;
54
54
  }
55
- }, S = function(t11) {
55
+ }, S = function(t15) {
56
56
  for (var e5 = a.getBCHTypeNumber(i4), r6 = 0; r6 < 18; r6 += 1) {
57
- var s2 = !t11 && 1 == (e5 >> r6 & 1);
57
+ var s2 = !t15 && 1 == (e5 >> r6 & 1);
58
58
  n3[Math.floor(r6 / 3)][r6 % 3 + o2 - 8 - 3] = s2;
59
59
  }
60
- for (r6 = 0; r6 < 18; r6 += 1) s2 = !t11 && 1 == (e5 >> r6 & 1), n3[r6 % 3 + o2 - 8 - 3][Math.floor(r6 / 3)] = s2;
61
- }, C = function(t11, e5) {
60
+ for (r6 = 0; r6 < 18; r6 += 1) s2 = !t15 && 1 == (e5 >> r6 & 1), n3[r6 % 3 + o2 - 8 - 3][Math.floor(r6 / 3)] = s2;
61
+ }, C = function(t15, e5) {
62
62
  for (var i5 = r5 << 3 | e5, s2 = a.getBCHTypeInfo(i5), h3 = 0; h3 < 15; h3 += 1) {
63
- var d2 = !t11 && 1 == (s2 >> h3 & 1);
63
+ var d2 = !t15 && 1 == (s2 >> h3 & 1);
64
64
  h3 < 6 ? n3[h3][8] = d2 : h3 < 8 ? n3[h3 + 1][8] = d2 : n3[o2 - 15 + h3][8] = d2;
65
65
  }
66
- for (h3 = 0; h3 < 15; h3 += 1) d2 = !t11 && 1 == (s2 >> h3 & 1), h3 < 8 ? n3[8][o2 - h3 - 1] = d2 : h3 < 9 ? n3[8][15 - h3 - 1 + 1] = d2 : n3[8][15 - h3 - 1] = d2;
67
- n3[o2 - 8][8] = !t11;
68
- }, A = function(t11, e5) {
66
+ for (h3 = 0; h3 < 15; h3 += 1) d2 = !t15 && 1 == (s2 >> h3 & 1), h3 < 8 ? n3[8][o2 - h3 - 1] = d2 : h3 < 9 ? n3[8][15 - h3 - 1 + 1] = d2 : n3[8][15 - h3 - 1] = d2;
67
+ n3[o2 - 8][8] = !t15;
68
+ }, A = function(t15, e5) {
69
69
  for (var i5 = -1, r6 = o2 - 1, s2 = 7, h3 = 0, d2 = a.getMaskFunction(e5), u2 = o2 - 1; u2 > 0; u2 -= 2) for (6 == u2 && (u2 -= 1); ; ) {
70
70
  for (var c2 = 0; c2 < 2; c2 += 1) if (null == n3[r6][u2 - c2]) {
71
71
  var l2 = false;
72
- h3 < t11.length && (l2 = 1 == (t11[h3] >>> s2 & 1)), d2(r6, u2 - c2) && (l2 = !l2), n3[r6][u2 - c2] = l2, -1 == (s2 -= 1) && (h3 += 1, s2 = 7);
72
+ h3 < t15.length && (l2 = 1 == (t15[h3] >>> s2 & 1)), d2(r6, u2 - c2) && (l2 = !l2), n3[r6][u2 - c2] = l2, -1 == (s2 -= 1) && (h3 += 1, s2 = 7);
73
73
  }
74
74
  if ((r6 += i5) < 0 || o2 <= r6) {
75
75
  r6 -= i5, i5 = -i5;
76
76
  break;
77
77
  }
78
78
  }
79
- }, M = function(t11, e5, i5) {
80
- for (var r6 = u.getRSBlocks(t11, e5), n4 = c(), o3 = 0; o3 < i5.length; o3 += 1) {
79
+ }, M = function(t15, e5, i5) {
80
+ for (var r6 = u.getRSBlocks(t15, e5), n4 = c(), o3 = 0; o3 < i5.length; o3 += 1) {
81
81
  var s2 = i5[o3];
82
- n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t11)), s2.write(n4);
82
+ n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t15)), s2.write(n4);
83
83
  }
84
84
  var h3 = 0;
85
85
  for (o3 = 0; o3 < r6.length; o3 += 1) h3 += r6[o3].dataCount;
86
86
  if (n4.getLengthInBits() > 8 * h3) throw "code length overflow. (" + n4.getLengthInBits() + ">" + 8 * h3 + ")";
87
87
  for (n4.getLengthInBits() + 4 <= 8 * h3 && n4.put(0, 4); n4.getLengthInBits() % 8 != 0; ) n4.putBit(false);
88
88
  for (; !(n4.getLengthInBits() >= 8 * h3 || (n4.put(236, 8), n4.getLengthInBits() >= 8 * h3)); ) n4.put(17, 8);
89
- return (function(t12, e6) {
89
+ return (function(t16, e6) {
90
90
  for (var i6 = 0, r7 = 0, n5 = 0, o4 = new Array(e6.length), s3 = new Array(e6.length), h4 = 0; h4 < e6.length; h4 += 1) {
91
91
  var u2 = e6[h4].dataCount, c2 = e6[h4].totalCount - u2;
92
92
  r7 = Math.max(r7, u2), n5 = Math.max(n5, c2), o4[h4] = new Array(u2);
93
- for (var l2 = 0; l2 < o4[h4].length; l2 += 1) o4[h4][l2] = 255 & t12.getBuffer()[l2 + i6];
93
+ for (var l2 = 0; l2 < o4[h4].length; l2 += 1) o4[h4][l2] = 255 & t16.getBuffer()[l2 + i6];
94
94
  i6 += u2;
95
95
  var g2 = a.getErrorCorrectPolynomial(c2), f2 = d(o4[h4], g2.getLength() - 1).mod(g2);
96
96
  for (s3[h4] = new Array(g2.getLength() - 1), l2 = 0; l2 < s3[h4].length; l2 += 1) {
@@ -106,85 +106,85 @@ var require_qr_code_styling = __commonJS({
106
106
  return v3;
107
107
  })(n4, r6);
108
108
  };
109
- v2.addData = function(t11, e5) {
109
+ v2.addData = function(t15, e5) {
110
110
  var i5 = null;
111
111
  switch (e5 = e5 || "Byte") {
112
112
  case "Numeric":
113
- i5 = l(t11);
113
+ i5 = l(t15);
114
114
  break;
115
115
  case "Alphanumeric":
116
- i5 = g(t11);
116
+ i5 = g(t15);
117
117
  break;
118
118
  case "Byte":
119
- i5 = f(t11);
119
+ i5 = f(t15);
120
120
  break;
121
121
  case "Kanji":
122
- i5 = w(t11);
122
+ i5 = w(t15);
123
123
  break;
124
124
  default:
125
125
  throw "mode:" + e5;
126
126
  }
127
127
  p2.push(i5), h2 = null;
128
- }, v2.isDark = function(t11, e5) {
129
- if (t11 < 0 || o2 <= t11 || e5 < 0 || o2 <= e5) throw t11 + "," + e5;
130
- return n3[t11][e5];
128
+ }, v2.isDark = function(t15, e5) {
129
+ if (t15 < 0 || o2 <= t15 || e5 < 0 || o2 <= e5) throw t15 + "," + e5;
130
+ return n3[t15][e5];
131
131
  }, v2.getModuleCount = function() {
132
132
  return o2;
133
133
  }, v2.make = function() {
134
134
  if (i4 < 1) {
135
- for (var t11 = 1; t11 < 40; t11++) {
136
- for (var e5 = u.getRSBlocks(t11, r5), n4 = c(), o3 = 0; o3 < p2.length; o3++) {
135
+ for (var t15 = 1; t15 < 40; t15++) {
136
+ for (var e5 = u.getRSBlocks(t15, r5), n4 = c(), o3 = 0; o3 < p2.length; o3++) {
137
137
  var s2 = p2[o3];
138
- n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t11)), s2.write(n4);
138
+ n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t15)), s2.write(n4);
139
139
  }
140
140
  var h3 = 0;
141
141
  for (o3 = 0; o3 < e5.length; o3++) h3 += e5[o3].dataCount;
142
142
  if (n4.getLengthInBits() <= 8 * h3) break;
143
143
  }
144
- i4 = t11;
144
+ i4 = t15;
145
145
  }
146
146
  m(false, (function() {
147
- for (var t12 = 0, e6 = 0, i5 = 0; i5 < 8; i5 += 1) {
147
+ for (var t16 = 0, e6 = 0, i5 = 0; i5 < 8; i5 += 1) {
148
148
  m(true, i5);
149
149
  var r6 = a.getLostPoint(v2);
150
- (0 == i5 || t12 > r6) && (t12 = r6, e6 = i5);
150
+ (0 == i5 || t16 > r6) && (t16 = r6, e6 = i5);
151
151
  }
152
152
  return e6;
153
153
  })());
154
- }, v2.createTableTag = function(t11, e5) {
155
- t11 = t11 || 2;
154
+ }, v2.createTableTag = function(t15, e5) {
155
+ t15 = t15 || 2;
156
156
  var i5 = "";
157
- i5 += '<table style="', i5 += " border-width: 0px; border-style: none;", i5 += " border-collapse: collapse;", i5 += " padding: 0px; margin: " + (e5 = void 0 === e5 ? 4 * t11 : e5) + "px;", i5 += '">', i5 += "<tbody>";
157
+ i5 += '<table style="', i5 += " border-width: 0px; border-style: none;", i5 += " border-collapse: collapse;", i5 += " padding: 0px; margin: " + (e5 = void 0 === e5 ? 4 * t15 : e5) + "px;", i5 += '">', i5 += "<tbody>";
158
158
  for (var r6 = 0; r6 < v2.getModuleCount(); r6 += 1) {
159
159
  i5 += "<tr>";
160
- for (var n4 = 0; n4 < v2.getModuleCount(); n4 += 1) i5 += '<td style="', i5 += " border-width: 0px; border-style: none;", i5 += " border-collapse: collapse;", i5 += " padding: 0px; margin: 0px;", i5 += " width: " + t11 + "px;", i5 += " height: " + t11 + "px;", i5 += " background-color: ", i5 += v2.isDark(r6, n4) ? "#000000" : "#ffffff", i5 += ";", i5 += '"/>';
160
+ for (var n4 = 0; n4 < v2.getModuleCount(); n4 += 1) i5 += '<td style="', i5 += " border-width: 0px; border-style: none;", i5 += " border-collapse: collapse;", i5 += " padding: 0px; margin: 0px;", i5 += " width: " + t15 + "px;", i5 += " height: " + t15 + "px;", i5 += " background-color: ", i5 += v2.isDark(r6, n4) ? "#000000" : "#ffffff", i5 += ";", i5 += '"/>';
161
161
  i5 += "</tr>";
162
162
  }
163
163
  return (i5 += "</tbody>") + "</table>";
164
- }, v2.createSvgTag = function(t11, e5, i5, r6) {
164
+ }, v2.createSvgTag = function(t15, e5, i5, r6) {
165
165
  var n4 = {};
166
- "object" == typeof arguments[0] && (t11 = (n4 = arguments[0]).cellSize, e5 = n4.margin, i5 = n4.alt, r6 = n4.title), t11 = t11 || 2, e5 = void 0 === e5 ? 4 * t11 : e5, (i5 = "string" == typeof i5 ? { text: i5 } : i5 || {}).text = i5.text || null, i5.id = i5.text ? i5.id || "qrcode-description" : null, (r6 = "string" == typeof r6 ? { text: r6 } : r6 || {}).text = r6.text || null, r6.id = r6.text ? r6.id || "qrcode-title" : null;
167
- var o3, s2, a2, h3, d2 = v2.getModuleCount() * t11 + 2 * e5, u2 = "";
168
- for (h3 = "l" + t11 + ",0 0," + t11 + " -" + t11 + ",0 0,-" + t11 + "z ", u2 += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"', u2 += n4.scalable ? "" : ' width="' + d2 + 'px" height="' + d2 + 'px"', u2 += ' viewBox="0 0 ' + d2 + " " + d2 + '" ', u2 += ' preserveAspectRatio="xMinYMin meet"', u2 += r6.text || i5.text ? ' role="img" aria-labelledby="' + $([r6.id, i5.id].join(" ").trim()) + '"' : "", u2 += ">", u2 += r6.text ? '<title id="' + $(r6.id) + '">' + $(r6.text) + "</title>" : "", u2 += i5.text ? '<description id="' + $(i5.id) + '">' + $(i5.text) + "</description>" : "", u2 += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>', u2 += '<path d="', s2 = 0; s2 < v2.getModuleCount(); s2 += 1) for (a2 = s2 * t11 + e5, o3 = 0; o3 < v2.getModuleCount(); o3 += 1) v2.isDark(s2, o3) && (u2 += "M" + (o3 * t11 + e5) + "," + a2 + h3);
166
+ "object" == typeof arguments[0] && (t15 = (n4 = arguments[0]).cellSize, e5 = n4.margin, i5 = n4.alt, r6 = n4.title), t15 = t15 || 2, e5 = void 0 === e5 ? 4 * t15 : e5, (i5 = "string" == typeof i5 ? { text: i5 } : i5 || {}).text = i5.text || null, i5.id = i5.text ? i5.id || "qrcode-description" : null, (r6 = "string" == typeof r6 ? { text: r6 } : r6 || {}).text = r6.text || null, r6.id = r6.text ? r6.id || "qrcode-title" : null;
167
+ var o3, s2, a2, h3, d2 = v2.getModuleCount() * t15 + 2 * e5, u2 = "";
168
+ for (h3 = "l" + t15 + ",0 0," + t15 + " -" + t15 + ",0 0,-" + t15 + "z ", u2 += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"', u2 += n4.scalable ? "" : ' width="' + d2 + 'px" height="' + d2 + 'px"', u2 += ' viewBox="0 0 ' + d2 + " " + d2 + '" ', u2 += ' preserveAspectRatio="xMinYMin meet"', u2 += r6.text || i5.text ? ' role="img" aria-labelledby="' + $([r6.id, i5.id].join(" ").trim()) + '"' : "", u2 += ">", u2 += r6.text ? '<title id="' + $(r6.id) + '">' + $(r6.text) + "</title>" : "", u2 += i5.text ? '<description id="' + $(i5.id) + '">' + $(i5.text) + "</description>" : "", u2 += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>', u2 += '<path d="', s2 = 0; s2 < v2.getModuleCount(); s2 += 1) for (a2 = s2 * t15 + e5, o3 = 0; o3 < v2.getModuleCount(); o3 += 1) v2.isDark(s2, o3) && (u2 += "M" + (o3 * t15 + e5) + "," + a2 + h3);
169
169
  return (u2 += '" stroke="transparent" fill="black"/>') + "</svg>";
170
- }, v2.createDataURL = function(t11, e5) {
171
- t11 = t11 || 2, e5 = void 0 === e5 ? 4 * t11 : e5;
172
- var i5 = v2.getModuleCount() * t11 + 2 * e5, r6 = e5, n4 = i5 - e5;
170
+ }, v2.createDataURL = function(t15, e5) {
171
+ t15 = t15 || 2, e5 = void 0 === e5 ? 4 * t15 : e5;
172
+ var i5 = v2.getModuleCount() * t15 + 2 * e5, r6 = e5, n4 = i5 - e5;
173
173
  return _(i5, i5, (function(e6, i6) {
174
174
  if (r6 <= e6 && e6 < n4 && r6 <= i6 && i6 < n4) {
175
- var o3 = Math.floor((e6 - r6) / t11), s2 = Math.floor((i6 - r6) / t11);
175
+ var o3 = Math.floor((e6 - r6) / t15), s2 = Math.floor((i6 - r6) / t15);
176
176
  return v2.isDark(s2, o3) ? 0 : 1;
177
177
  }
178
178
  return 1;
179
179
  }));
180
- }, v2.createImgTag = function(t11, e5, i5) {
181
- t11 = t11 || 2, e5 = void 0 === e5 ? 4 * t11 : e5;
182
- var r6 = v2.getModuleCount() * t11 + 2 * e5, n4 = "";
183
- return n4 += "<img", n4 += ' src="', n4 += v2.createDataURL(t11, e5), n4 += '"', n4 += ' width="', n4 += r6, n4 += '"', n4 += ' height="', n4 += r6, n4 += '"', i5 && (n4 += ' alt="', n4 += $(i5), n4 += '"'), n4 + "/>";
180
+ }, v2.createImgTag = function(t15, e5, i5) {
181
+ t15 = t15 || 2, e5 = void 0 === e5 ? 4 * t15 : e5;
182
+ var r6 = v2.getModuleCount() * t15 + 2 * e5, n4 = "";
183
+ return n4 += "<img", n4 += ' src="', n4 += v2.createDataURL(t15, e5), n4 += '"', n4 += ' width="', n4 += r6, n4 += '"', n4 += ' height="', n4 += r6, n4 += '"', i5 && (n4 += ' alt="', n4 += $(i5), n4 += '"'), n4 + "/>";
184
184
  };
185
- var $ = function(t11) {
186
- for (var e5 = "", i5 = 0; i5 < t11.length; i5 += 1) {
187
- var r6 = t11.charAt(i5);
185
+ var $ = function(t15) {
186
+ for (var e5 = "", i5 = 0; i5 < t15.length; i5 += 1) {
187
+ var r6 = t15.charAt(i5);
188
188
  switch (r6) {
189
189
  case "<":
190
190
  e5 += "&lt;";
@@ -204,40 +204,40 @@ var require_qr_code_styling = __commonJS({
204
204
  }
205
205
  return e5;
206
206
  };
207
- return v2.createASCII = function(t11, e5) {
208
- if ((t11 = t11 || 1) < 2) return (function(t12) {
209
- t12 = void 0 === t12 ? 2 : t12;
210
- var e6, i6, r7, n5, o4, s3 = 1 * v2.getModuleCount() + 2 * t12, a3 = t12, h4 = s3 - t12, d3 = { "\u2588\u2588": "\u2588", "\u2588 ": "\u2580", " \u2588": "\u2584", " ": " " }, u3 = { "\u2588\u2588": "\u2580", "\u2588 ": "\u2580", " \u2588": " ", " ": " " }, c3 = "";
207
+ return v2.createASCII = function(t15, e5) {
208
+ if ((t15 = t15 || 1) < 2) return (function(t16) {
209
+ t16 = void 0 === t16 ? 2 : t16;
210
+ var e6, i6, r7, n5, o4, s3 = 1 * v2.getModuleCount() + 2 * t16, a3 = t16, h4 = s3 - t16, d3 = { "\u2588\u2588": "\u2588", "\u2588 ": "\u2580", " \u2588": "\u2584", " ": " " }, u3 = { "\u2588\u2588": "\u2580", "\u2588 ": "\u2580", " \u2588": " ", " ": " " }, c3 = "";
211
211
  for (e6 = 0; e6 < s3; e6 += 2) {
212
- for (r7 = Math.floor((e6 - a3) / 1), n5 = Math.floor((e6 + 1 - a3) / 1), i6 = 0; i6 < s3; i6 += 1) o4 = "\u2588", a3 <= i6 && i6 < h4 && a3 <= e6 && e6 < h4 && v2.isDark(r7, Math.floor((i6 - a3) / 1)) && (o4 = " "), a3 <= i6 && i6 < h4 && a3 <= e6 + 1 && e6 + 1 < h4 && v2.isDark(n5, Math.floor((i6 - a3) / 1)) ? o4 += " " : o4 += "\u2588", c3 += t12 < 1 && e6 + 1 >= h4 ? u3[o4] : d3[o4];
212
+ for (r7 = Math.floor((e6 - a3) / 1), n5 = Math.floor((e6 + 1 - a3) / 1), i6 = 0; i6 < s3; i6 += 1) o4 = "\u2588", a3 <= i6 && i6 < h4 && a3 <= e6 && e6 < h4 && v2.isDark(r7, Math.floor((i6 - a3) / 1)) && (o4 = " "), a3 <= i6 && i6 < h4 && a3 <= e6 + 1 && e6 + 1 < h4 && v2.isDark(n5, Math.floor((i6 - a3) / 1)) ? o4 += " " : o4 += "\u2588", c3 += t16 < 1 && e6 + 1 >= h4 ? u3[o4] : d3[o4];
213
213
  c3 += "\n";
214
214
  }
215
- return s3 % 2 && t12 > 0 ? c3.substring(0, c3.length - s3 - 1) + Array(s3 + 1).join("\u2580") : c3.substring(0, c3.length - 1);
215
+ return s3 % 2 && t16 > 0 ? c3.substring(0, c3.length - s3 - 1) + Array(s3 + 1).join("\u2580") : c3.substring(0, c3.length - 1);
216
216
  })(e5);
217
- t11 -= 1, e5 = void 0 === e5 ? 2 * t11 : e5;
218
- var i5, r6, n4, o3, s2 = v2.getModuleCount() * t11 + 2 * e5, a2 = e5, h3 = s2 - e5, d2 = Array(t11 + 1).join("\u2588\u2588"), u2 = Array(t11 + 1).join(" "), c2 = "", l2 = "";
217
+ t15 -= 1, e5 = void 0 === e5 ? 2 * t15 : e5;
218
+ var i5, r6, n4, o3, s2 = v2.getModuleCount() * t15 + 2 * e5, a2 = e5, h3 = s2 - e5, d2 = Array(t15 + 1).join("\u2588\u2588"), u2 = Array(t15 + 1).join(" "), c2 = "", l2 = "";
219
219
  for (i5 = 0; i5 < s2; i5 += 1) {
220
- for (n4 = Math.floor((i5 - a2) / t11), l2 = "", r6 = 0; r6 < s2; r6 += 1) o3 = 1, a2 <= r6 && r6 < h3 && a2 <= i5 && i5 < h3 && v2.isDark(n4, Math.floor((r6 - a2) / t11)) && (o3 = 0), l2 += o3 ? d2 : u2;
221
- for (n4 = 0; n4 < t11; n4 += 1) c2 += l2 + "\n";
220
+ for (n4 = Math.floor((i5 - a2) / t15), l2 = "", r6 = 0; r6 < s2; r6 += 1) o3 = 1, a2 <= r6 && r6 < h3 && a2 <= i5 && i5 < h3 && v2.isDark(n4, Math.floor((r6 - a2) / t15)) && (o3 = 0), l2 += o3 ? d2 : u2;
221
+ for (n4 = 0; n4 < t15; n4 += 1) c2 += l2 + "\n";
222
222
  }
223
223
  return c2.substring(0, c2.length - 1);
224
- }, v2.renderTo2dContext = function(t11, e5) {
224
+ }, v2.renderTo2dContext = function(t15, e5) {
225
225
  e5 = e5 || 2;
226
- for (var i5 = v2.getModuleCount(), r6 = 0; r6 < i5; r6++) for (var n4 = 0; n4 < i5; n4++) t11.fillStyle = v2.isDark(r6, n4) ? "black" : "white", t11.fillRect(r6 * e5, n4 * e5, e5, e5);
226
+ for (var i5 = v2.getModuleCount(), r6 = 0; r6 < i5; r6++) for (var n4 = 0; n4 < i5; n4++) t15.fillStyle = v2.isDark(r6, n4) ? "black" : "white", t15.fillRect(r6 * e5, n4 * e5, e5, e5);
227
227
  }, v2;
228
228
  };
229
- t9.stringToBytes = (t9.stringToBytesFuncs = { default: function(t10) {
230
- for (var e4 = [], i4 = 0; i4 < t10.length; i4 += 1) {
231
- var r5 = t10.charCodeAt(i4);
229
+ t13.stringToBytes = (t13.stringToBytesFuncs = { default: function(t14) {
230
+ for (var e4 = [], i4 = 0; i4 < t14.length; i4 += 1) {
231
+ var r5 = t14.charCodeAt(i4);
232
232
  e4.push(255 & r5);
233
233
  }
234
234
  return e4;
235
- } }).default, t9.createStringToBytes = function(t10, e4) {
235
+ } }).default, t13.createStringToBytes = function(t14, e4) {
236
236
  var i4 = (function() {
237
- for (var i5 = v(t10), r6 = function() {
238
- var t11 = i5.read();
239
- if (-1 == t11) throw "eof";
240
- return t11;
237
+ for (var i5 = v(t14), r6 = function() {
238
+ var t15 = i5.read();
239
+ if (-1 == t15) throw "eof";
240
+ return t15;
241
241
  }, n3 = 0, o2 = {}; ; ) {
242
242
  var s2 = i5.read();
243
243
  if (-1 == s2) break;
@@ -247,71 +247,71 @@ var require_qr_code_styling = __commonJS({
247
247
  if (n3 != e4) throw n3 + " != " + e4;
248
248
  return o2;
249
249
  })(), r5 = "?".charCodeAt(0);
250
- return function(t11) {
251
- for (var e5 = [], n3 = 0; n3 < t11.length; n3 += 1) {
252
- var o2 = t11.charCodeAt(n3);
250
+ return function(t15) {
251
+ for (var e5 = [], n3 = 0; n3 < t15.length; n3 += 1) {
252
+ var o2 = t15.charCodeAt(n3);
253
253
  if (o2 < 128) e5.push(o2);
254
254
  else {
255
- var s2 = i4[t11.charAt(n3)];
255
+ var s2 = i4[t15.charAt(n3)];
256
256
  "number" == typeof s2 ? (255 & s2) == s2 ? e5.push(s2) : (e5.push(s2 >>> 8), e5.push(255 & s2)) : e5.push(r5);
257
257
  }
258
258
  }
259
259
  return e5;
260
260
  };
261
261
  };
262
- var e3, i3, r4, n2, o, s = { L: 1, M: 0, Q: 3, H: 2 }, a = (e3 = [[], [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]], i3 = 1335, r4 = 7973, o = function(t10) {
263
- for (var e4 = 0; 0 != t10; ) e4 += 1, t10 >>>= 1;
262
+ var e3, i3, r4, n2, o, s = { L: 1, M: 0, Q: 3, H: 2 }, a = (e3 = [[], [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]], i3 = 1335, r4 = 7973, o = function(t14) {
263
+ for (var e4 = 0; 0 != t14; ) e4 += 1, t14 >>>= 1;
264
264
  return e4;
265
- }, (n2 = {}).getBCHTypeInfo = function(t10) {
266
- for (var e4 = t10 << 10; o(e4) - o(i3) >= 0; ) e4 ^= i3 << o(e4) - o(i3);
267
- return 21522 ^ (t10 << 10 | e4);
268
- }, n2.getBCHTypeNumber = function(t10) {
269
- for (var e4 = t10 << 12; o(e4) - o(r4) >= 0; ) e4 ^= r4 << o(e4) - o(r4);
270
- return t10 << 12 | e4;
271
- }, n2.getPatternPosition = function(t10) {
272
- return e3[t10 - 1];
273
- }, n2.getMaskFunction = function(t10) {
274
- switch (t10) {
265
+ }, (n2 = {}).getBCHTypeInfo = function(t14) {
266
+ for (var e4 = t14 << 10; o(e4) - o(i3) >= 0; ) e4 ^= i3 << o(e4) - o(i3);
267
+ return 21522 ^ (t14 << 10 | e4);
268
+ }, n2.getBCHTypeNumber = function(t14) {
269
+ for (var e4 = t14 << 12; o(e4) - o(r4) >= 0; ) e4 ^= r4 << o(e4) - o(r4);
270
+ return t14 << 12 | e4;
271
+ }, n2.getPatternPosition = function(t14) {
272
+ return e3[t14 - 1];
273
+ }, n2.getMaskFunction = function(t14) {
274
+ switch (t14) {
275
275
  case 0:
276
- return function(t11, e4) {
277
- return (t11 + e4) % 2 == 0;
276
+ return function(t15, e4) {
277
+ return (t15 + e4) % 2 == 0;
278
278
  };
279
279
  case 1:
280
- return function(t11, e4) {
281
- return t11 % 2 == 0;
280
+ return function(t15, e4) {
281
+ return t15 % 2 == 0;
282
282
  };
283
283
  case 2:
284
- return function(t11, e4) {
284
+ return function(t15, e4) {
285
285
  return e4 % 3 == 0;
286
286
  };
287
287
  case 3:
288
- return function(t11, e4) {
289
- return (t11 + e4) % 3 == 0;
288
+ return function(t15, e4) {
289
+ return (t15 + e4) % 3 == 0;
290
290
  };
291
291
  case 4:
292
- return function(t11, e4) {
293
- return (Math.floor(t11 / 2) + Math.floor(e4 / 3)) % 2 == 0;
292
+ return function(t15, e4) {
293
+ return (Math.floor(t15 / 2) + Math.floor(e4 / 3)) % 2 == 0;
294
294
  };
295
295
  case 5:
296
- return function(t11, e4) {
297
- return t11 * e4 % 2 + t11 * e4 % 3 == 0;
296
+ return function(t15, e4) {
297
+ return t15 * e4 % 2 + t15 * e4 % 3 == 0;
298
298
  };
299
299
  case 6:
300
- return function(t11, e4) {
301
- return (t11 * e4 % 2 + t11 * e4 % 3) % 2 == 0;
300
+ return function(t15, e4) {
301
+ return (t15 * e4 % 2 + t15 * e4 % 3) % 2 == 0;
302
302
  };
303
303
  case 7:
304
- return function(t11, e4) {
305
- return (t11 * e4 % 3 + (t11 + e4) % 2) % 2 == 0;
304
+ return function(t15, e4) {
305
+ return (t15 * e4 % 3 + (t15 + e4) % 2) % 2 == 0;
306
306
  };
307
307
  default:
308
- throw "bad maskPattern:" + t10;
308
+ throw "bad maskPattern:" + t14;
309
309
  }
310
- }, n2.getErrorCorrectPolynomial = function(t10) {
311
- for (var e4 = d([1], 0), i4 = 0; i4 < t10; i4 += 1) e4 = e4.multiply(d([1, h.gexp(i4)], 0));
310
+ }, n2.getErrorCorrectPolynomial = function(t14) {
311
+ for (var e4 = d([1], 0), i4 = 0; i4 < t14; i4 += 1) e4 = e4.multiply(d([1, h.gexp(i4)], 0));
312
312
  return e4;
313
- }, n2.getLengthInBits = function(t10, e4) {
314
- if (1 <= e4 && e4 < 10) switch (t10) {
313
+ }, n2.getLengthInBits = function(t14, e4) {
314
+ if (1 <= e4 && e4 < 10) switch (t14) {
315
315
  case 1:
316
316
  return 10;
317
317
  case 2:
@@ -320,9 +320,9 @@ var require_qr_code_styling = __commonJS({
320
320
  case 8:
321
321
  return 8;
322
322
  default:
323
- throw "mode:" + t10;
323
+ throw "mode:" + t14;
324
324
  }
325
- else if (e4 < 27) switch (t10) {
325
+ else if (e4 < 27) switch (t14) {
326
326
  case 1:
327
327
  return 12;
328
328
  case 2:
@@ -332,11 +332,11 @@ var require_qr_code_styling = __commonJS({
332
332
  case 8:
333
333
  return 10;
334
334
  default:
335
- throw "mode:" + t10;
335
+ throw "mode:" + t14;
336
336
  }
337
337
  else {
338
338
  if (!(e4 < 41)) throw "type:" + e4;
339
- switch (t10) {
339
+ switch (t14) {
340
340
  case 1:
341
341
  return 14;
342
342
  case 2:
@@ -346,72 +346,72 @@ var require_qr_code_styling = __commonJS({
346
346
  case 8:
347
347
  return 12;
348
348
  default:
349
- throw "mode:" + t10;
349
+ throw "mode:" + t14;
350
350
  }
351
351
  }
352
- }, n2.getLostPoint = function(t10) {
353
- for (var e4 = t10.getModuleCount(), i4 = 0, r5 = 0; r5 < e4; r5 += 1) for (var n3 = 0; n3 < e4; n3 += 1) {
354
- for (var o2 = 0, s2 = t10.isDark(r5, n3), a2 = -1; a2 <= 1; a2 += 1) if (!(r5 + a2 < 0 || e4 <= r5 + a2)) for (var h2 = -1; h2 <= 1; h2 += 1) n3 + h2 < 0 || e4 <= n3 + h2 || 0 == a2 && 0 == h2 || s2 == t10.isDark(r5 + a2, n3 + h2) && (o2 += 1);
352
+ }, n2.getLostPoint = function(t14) {
353
+ for (var e4 = t14.getModuleCount(), i4 = 0, r5 = 0; r5 < e4; r5 += 1) for (var n3 = 0; n3 < e4; n3 += 1) {
354
+ for (var o2 = 0, s2 = t14.isDark(r5, n3), a2 = -1; a2 <= 1; a2 += 1) if (!(r5 + a2 < 0 || e4 <= r5 + a2)) for (var h2 = -1; h2 <= 1; h2 += 1) n3 + h2 < 0 || e4 <= n3 + h2 || 0 == a2 && 0 == h2 || s2 == t14.isDark(r5 + a2, n3 + h2) && (o2 += 1);
355
355
  o2 > 5 && (i4 += 3 + o2 - 5);
356
356
  }
357
357
  for (r5 = 0; r5 < e4 - 1; r5 += 1) for (n3 = 0; n3 < e4 - 1; n3 += 1) {
358
358
  var d2 = 0;
359
- t10.isDark(r5, n3) && (d2 += 1), t10.isDark(r5 + 1, n3) && (d2 += 1), t10.isDark(r5, n3 + 1) && (d2 += 1), t10.isDark(r5 + 1, n3 + 1) && (d2 += 1), 0 != d2 && 4 != d2 || (i4 += 3);
359
+ t14.isDark(r5, n3) && (d2 += 1), t14.isDark(r5 + 1, n3) && (d2 += 1), t14.isDark(r5, n3 + 1) && (d2 += 1), t14.isDark(r5 + 1, n3 + 1) && (d2 += 1), 0 != d2 && 4 != d2 || (i4 += 3);
360
360
  }
361
- for (r5 = 0; r5 < e4; r5 += 1) for (n3 = 0; n3 < e4 - 6; n3 += 1) t10.isDark(r5, n3) && !t10.isDark(r5, n3 + 1) && t10.isDark(r5, n3 + 2) && t10.isDark(r5, n3 + 3) && t10.isDark(r5, n3 + 4) && !t10.isDark(r5, n3 + 5) && t10.isDark(r5, n3 + 6) && (i4 += 40);
362
- for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4 - 6; r5 += 1) t10.isDark(r5, n3) && !t10.isDark(r5 + 1, n3) && t10.isDark(r5 + 2, n3) && t10.isDark(r5 + 3, n3) && t10.isDark(r5 + 4, n3) && !t10.isDark(r5 + 5, n3) && t10.isDark(r5 + 6, n3) && (i4 += 40);
361
+ for (r5 = 0; r5 < e4; r5 += 1) for (n3 = 0; n3 < e4 - 6; n3 += 1) t14.isDark(r5, n3) && !t14.isDark(r5, n3 + 1) && t14.isDark(r5, n3 + 2) && t14.isDark(r5, n3 + 3) && t14.isDark(r5, n3 + 4) && !t14.isDark(r5, n3 + 5) && t14.isDark(r5, n3 + 6) && (i4 += 40);
362
+ for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4 - 6; r5 += 1) t14.isDark(r5, n3) && !t14.isDark(r5 + 1, n3) && t14.isDark(r5 + 2, n3) && t14.isDark(r5 + 3, n3) && t14.isDark(r5 + 4, n3) && !t14.isDark(r5 + 5, n3) && t14.isDark(r5 + 6, n3) && (i4 += 40);
363
363
  var u2 = 0;
364
- for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4; r5 += 1) t10.isDark(r5, n3) && (u2 += 1);
364
+ for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4; r5 += 1) t14.isDark(r5, n3) && (u2 += 1);
365
365
  return i4 + Math.abs(100 * u2 / e4 / e4 - 50) / 5 * 10;
366
366
  }, n2), h = (function() {
367
- for (var t10 = new Array(256), e4 = new Array(256), i4 = 0; i4 < 8; i4 += 1) t10[i4] = 1 << i4;
368
- for (i4 = 8; i4 < 256; i4 += 1) t10[i4] = t10[i4 - 4] ^ t10[i4 - 5] ^ t10[i4 - 6] ^ t10[i4 - 8];
369
- for (i4 = 0; i4 < 255; i4 += 1) e4[t10[i4]] = i4;
370
- return { glog: function(t11) {
371
- if (t11 < 1) throw "glog(" + t11 + ")";
372
- return e4[t11];
367
+ for (var t14 = new Array(256), e4 = new Array(256), i4 = 0; i4 < 8; i4 += 1) t14[i4] = 1 << i4;
368
+ for (i4 = 8; i4 < 256; i4 += 1) t14[i4] = t14[i4 - 4] ^ t14[i4 - 5] ^ t14[i4 - 6] ^ t14[i4 - 8];
369
+ for (i4 = 0; i4 < 255; i4 += 1) e4[t14[i4]] = i4;
370
+ return { glog: function(t15) {
371
+ if (t15 < 1) throw "glog(" + t15 + ")";
372
+ return e4[t15];
373
373
  }, gexp: function(e5) {
374
374
  for (; e5 < 0; ) e5 += 255;
375
375
  for (; e5 >= 256; ) e5 -= 255;
376
- return t10[e5];
376
+ return t14[e5];
377
377
  } };
378
378
  })();
379
- function d(t10, e4) {
380
- if (void 0 === t10.length) throw t10.length + "/" + e4;
379
+ function d(t14, e4) {
380
+ if (void 0 === t14.length) throw t14.length + "/" + e4;
381
381
  var i4 = (function() {
382
- for (var i5 = 0; i5 < t10.length && 0 == t10[i5]; ) i5 += 1;
383
- for (var r6 = new Array(t10.length - i5 + e4), n3 = 0; n3 < t10.length - i5; n3 += 1) r6[n3] = t10[n3 + i5];
382
+ for (var i5 = 0; i5 < t14.length && 0 == t14[i5]; ) i5 += 1;
383
+ for (var r6 = new Array(t14.length - i5 + e4), n3 = 0; n3 < t14.length - i5; n3 += 1) r6[n3] = t14[n3 + i5];
384
384
  return r6;
385
- })(), r5 = { getAt: function(t11) {
386
- return i4[t11];
385
+ })(), r5 = { getAt: function(t15) {
386
+ return i4[t15];
387
387
  }, getLength: function() {
388
388
  return i4.length;
389
- }, multiply: function(t11) {
390
- for (var e5 = new Array(r5.getLength() + t11.getLength() - 1), i5 = 0; i5 < r5.getLength(); i5 += 1) for (var n3 = 0; n3 < t11.getLength(); n3 += 1) e5[i5 + n3] ^= h.gexp(h.glog(r5.getAt(i5)) + h.glog(t11.getAt(n3)));
389
+ }, multiply: function(t15) {
390
+ for (var e5 = new Array(r5.getLength() + t15.getLength() - 1), i5 = 0; i5 < r5.getLength(); i5 += 1) for (var n3 = 0; n3 < t15.getLength(); n3 += 1) e5[i5 + n3] ^= h.gexp(h.glog(r5.getAt(i5)) + h.glog(t15.getAt(n3)));
391
391
  return d(e5, 0);
392
- }, mod: function(t11) {
393
- if (r5.getLength() - t11.getLength() < 0) return r5;
394
- for (var e5 = h.glog(r5.getAt(0)) - h.glog(t11.getAt(0)), i5 = new Array(r5.getLength()), n3 = 0; n3 < r5.getLength(); n3 += 1) i5[n3] = r5.getAt(n3);
395
- for (n3 = 0; n3 < t11.getLength(); n3 += 1) i5[n3] ^= h.gexp(h.glog(t11.getAt(n3)) + e5);
396
- return d(i5, 0).mod(t11);
392
+ }, mod: function(t15) {
393
+ if (r5.getLength() - t15.getLength() < 0) return r5;
394
+ for (var e5 = h.glog(r5.getAt(0)) - h.glog(t15.getAt(0)), i5 = new Array(r5.getLength()), n3 = 0; n3 < r5.getLength(); n3 += 1) i5[n3] = r5.getAt(n3);
395
+ for (n3 = 0; n3 < t15.getLength(); n3 += 1) i5[n3] ^= h.gexp(h.glog(t15.getAt(n3)) + e5);
396
+ return d(i5, 0).mod(t15);
397
397
  } };
398
398
  return r5;
399
399
  }
400
400
  var u = /* @__PURE__ */ (function() {
401
- var t10 = [[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]], e4 = function(t11, e5) {
401
+ var t14 = [[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]], e4 = function(t15, e5) {
402
402
  var i5 = {};
403
- return i5.totalCount = t11, i5.dataCount = e5, i5;
403
+ return i5.totalCount = t15, i5.dataCount = e5, i5;
404
404
  }, i4 = { getRSBlocks: function(i5, r5) {
405
405
  var n3 = (function(e5, i6) {
406
406
  switch (i6) {
407
407
  case s.L:
408
- return t10[4 * (e5 - 1) + 0];
408
+ return t14[4 * (e5 - 1) + 0];
409
409
  case s.M:
410
- return t10[4 * (e5 - 1) + 1];
410
+ return t14[4 * (e5 - 1) + 1];
411
411
  case s.Q:
412
- return t10[4 * (e5 - 1) + 2];
412
+ return t14[4 * (e5 - 1) + 2];
413
413
  case s.H:
414
- return t10[4 * (e5 - 1) + 3];
414
+ return t14[4 * (e5 - 1) + 3];
415
415
  default:
416
416
  return;
417
417
  }
@@ -422,48 +422,48 @@ var require_qr_code_styling = __commonJS({
422
422
  } };
423
423
  return i4;
424
424
  })(), c = function() {
425
- var t10 = [], e4 = 0, i4 = { getBuffer: function() {
426
- return t10;
425
+ var t14 = [], e4 = 0, i4 = { getBuffer: function() {
426
+ return t14;
427
427
  }, getAt: function(e5) {
428
428
  var i5 = Math.floor(e5 / 8);
429
- return 1 == (t10[i5] >>> 7 - e5 % 8 & 1);
430
- }, put: function(t11, e5) {
431
- for (var r5 = 0; r5 < e5; r5 += 1) i4.putBit(1 == (t11 >>> e5 - r5 - 1 & 1));
429
+ return 1 == (t14[i5] >>> 7 - e5 % 8 & 1);
430
+ }, put: function(t15, e5) {
431
+ for (var r5 = 0; r5 < e5; r5 += 1) i4.putBit(1 == (t15 >>> e5 - r5 - 1 & 1));
432
432
  }, getLengthInBits: function() {
433
433
  return e4;
434
434
  }, putBit: function(i5) {
435
435
  var r5 = Math.floor(e4 / 8);
436
- t10.length <= r5 && t10.push(0), i5 && (t10[r5] |= 128 >>> e4 % 8), e4 += 1;
436
+ t14.length <= r5 && t14.push(0), i5 && (t14[r5] |= 128 >>> e4 % 8), e4 += 1;
437
437
  } };
438
438
  return i4;
439
- }, l = function(t10) {
440
- var e4 = t10, i4 = { getMode: function() {
439
+ }, l = function(t14) {
440
+ var e4 = t14, i4 = { getMode: function() {
441
441
  return 1;
442
- }, getLength: function(t11) {
442
+ }, getLength: function(t15) {
443
443
  return e4.length;
444
- }, write: function(t11) {
445
- for (var i5 = e4, n4 = 0; n4 + 2 < i5.length; ) t11.put(r5(i5.substring(n4, n4 + 3)), 10), n4 += 3;
446
- n4 < i5.length && (i5.length - n4 == 1 ? t11.put(r5(i5.substring(n4, n4 + 1)), 4) : i5.length - n4 == 2 && t11.put(r5(i5.substring(n4, n4 + 2)), 7));
447
- } }, r5 = function(t11) {
448
- for (var e5 = 0, i5 = 0; i5 < t11.length; i5 += 1) e5 = 10 * e5 + n3(t11.charAt(i5));
444
+ }, write: function(t15) {
445
+ for (var i5 = e4, n4 = 0; n4 + 2 < i5.length; ) t15.put(r5(i5.substring(n4, n4 + 3)), 10), n4 += 3;
446
+ n4 < i5.length && (i5.length - n4 == 1 ? t15.put(r5(i5.substring(n4, n4 + 1)), 4) : i5.length - n4 == 2 && t15.put(r5(i5.substring(n4, n4 + 2)), 7));
447
+ } }, r5 = function(t15) {
448
+ for (var e5 = 0, i5 = 0; i5 < t15.length; i5 += 1) e5 = 10 * e5 + n3(t15.charAt(i5));
449
449
  return e5;
450
- }, n3 = function(t11) {
451
- if ("0" <= t11 && t11 <= "9") return t11.charCodeAt(0) - "0".charCodeAt(0);
452
- throw "illegal char :" + t11;
450
+ }, n3 = function(t15) {
451
+ if ("0" <= t15 && t15 <= "9") return t15.charCodeAt(0) - "0".charCodeAt(0);
452
+ throw "illegal char :" + t15;
453
453
  };
454
454
  return i4;
455
- }, g = function(t10) {
456
- var e4 = t10, i4 = { getMode: function() {
455
+ }, g = function(t14) {
456
+ var e4 = t14, i4 = { getMode: function() {
457
457
  return 2;
458
- }, getLength: function(t11) {
458
+ }, getLength: function(t15) {
459
459
  return e4.length;
460
- }, write: function(t11) {
461
- for (var i5 = e4, n3 = 0; n3 + 1 < i5.length; ) t11.put(45 * r5(i5.charAt(n3)) + r5(i5.charAt(n3 + 1)), 11), n3 += 2;
462
- n3 < i5.length && t11.put(r5(i5.charAt(n3)), 6);
463
- } }, r5 = function(t11) {
464
- if ("0" <= t11 && t11 <= "9") return t11.charCodeAt(0) - "0".charCodeAt(0);
465
- if ("A" <= t11 && t11 <= "Z") return t11.charCodeAt(0) - "A".charCodeAt(0) + 10;
466
- switch (t11) {
460
+ }, write: function(t15) {
461
+ for (var i5 = e4, n3 = 0; n3 + 1 < i5.length; ) t15.put(45 * r5(i5.charAt(n3)) + r5(i5.charAt(n3 + 1)), 11), n3 += 2;
462
+ n3 < i5.length && t15.put(r5(i5.charAt(n3)), 6);
463
+ } }, r5 = function(t15) {
464
+ if ("0" <= t15 && t15 <= "9") return t15.charCodeAt(0) - "0".charCodeAt(0);
465
+ if ("A" <= t15 && t15 <= "Z") return t15.charCodeAt(0) - "A".charCodeAt(0) + 10;
466
+ switch (t15) {
467
467
  case " ":
468
468
  return 36;
469
469
  case "$":
@@ -483,31 +483,31 @@ var require_qr_code_styling = __commonJS({
483
483
  case ":":
484
484
  return 44;
485
485
  default:
486
- throw "illegal char :" + t11;
486
+ throw "illegal char :" + t15;
487
487
  }
488
488
  };
489
489
  return i4;
490
490
  }, f = function(e4) {
491
- var i4 = t9.stringToBytes(e4);
491
+ var i4 = t13.stringToBytes(e4);
492
492
  return { getMode: function() {
493
493
  return 4;
494
- }, getLength: function(t10) {
494
+ }, getLength: function(t14) {
495
495
  return i4.length;
496
- }, write: function(t10) {
497
- for (var e5 = 0; e5 < i4.length; e5 += 1) t10.put(i4[e5], 8);
496
+ }, write: function(t14) {
497
+ for (var e5 = 0; e5 < i4.length; e5 += 1) t14.put(i4[e5], 8);
498
498
  } };
499
499
  }, w = function(e4) {
500
- var i4 = t9.stringToBytesFuncs.SJIS;
500
+ var i4 = t13.stringToBytesFuncs.SJIS;
501
501
  if (!i4) throw "sjis not supported.";
502
502
  !(function() {
503
- var t10 = i4("\u53CB");
504
- if (2 != t10.length || 38726 != (t10[0] << 8 | t10[1])) throw "sjis not supported.";
503
+ var t14 = i4("\u53CB");
504
+ if (2 != t14.length || 38726 != (t14[0] << 8 | t14[1])) throw "sjis not supported.";
505
505
  })();
506
506
  var r5 = i4(e4), n3 = { getMode: function() {
507
507
  return 8;
508
- }, getLength: function(t10) {
508
+ }, getLength: function(t14) {
509
509
  return ~~(r5.length / 2);
510
- }, write: function(t10) {
510
+ }, write: function(t14) {
511
511
  for (var e5 = r5, i5 = 0; i5 + 1 < e5.length; ) {
512
512
  var n4 = (255 & e5[i5]) << 8 | 255 & e5[i5 + 1];
513
513
  if (33088 <= n4 && n4 <= 40956) n4 -= 33088;
@@ -515,69 +515,69 @@ var require_qr_code_styling = __commonJS({
515
515
  if (!(57408 <= n4 && n4 <= 60351)) throw "illegal char at " + (i5 + 1) + "/" + n4;
516
516
  n4 -= 49472;
517
517
  }
518
- n4 = 192 * (n4 >>> 8 & 255) + (255 & n4), t10.put(n4, 13), i5 += 2;
518
+ n4 = 192 * (n4 >>> 8 & 255) + (255 & n4), t14.put(n4, 13), i5 += 2;
519
519
  }
520
520
  if (i5 < e5.length) throw "illegal char at " + (i5 + 1);
521
521
  } };
522
522
  return n3;
523
523
  }, p = function() {
524
- var t10 = [], e4 = { writeByte: function(e5) {
525
- t10.push(255 & e5);
526
- }, writeShort: function(t11) {
527
- e4.writeByte(t11), e4.writeByte(t11 >>> 8);
528
- }, writeBytes: function(t11, i4, r5) {
529
- i4 = i4 || 0, r5 = r5 || t11.length;
530
- for (var n3 = 0; n3 < r5; n3 += 1) e4.writeByte(t11[n3 + i4]);
531
- }, writeString: function(t11) {
532
- for (var i4 = 0; i4 < t11.length; i4 += 1) e4.writeByte(t11.charCodeAt(i4));
524
+ var t14 = [], e4 = { writeByte: function(e5) {
525
+ t14.push(255 & e5);
526
+ }, writeShort: function(t15) {
527
+ e4.writeByte(t15), e4.writeByte(t15 >>> 8);
528
+ }, writeBytes: function(t15, i4, r5) {
529
+ i4 = i4 || 0, r5 = r5 || t15.length;
530
+ for (var n3 = 0; n3 < r5; n3 += 1) e4.writeByte(t15[n3 + i4]);
531
+ }, writeString: function(t15) {
532
+ for (var i4 = 0; i4 < t15.length; i4 += 1) e4.writeByte(t15.charCodeAt(i4));
533
533
  }, toByteArray: function() {
534
- return t10;
534
+ return t14;
535
535
  }, toString: function() {
536
536
  var e5 = "";
537
537
  e5 += "[";
538
- for (var i4 = 0; i4 < t10.length; i4 += 1) i4 > 0 && (e5 += ","), e5 += t10[i4];
538
+ for (var i4 = 0; i4 < t14.length; i4 += 1) i4 > 0 && (e5 += ","), e5 += t14[i4];
539
539
  return e5 + "]";
540
540
  } };
541
541
  return e4;
542
- }, v = function(t10) {
543
- var e4 = t10, i4 = 0, r5 = 0, n3 = 0, o2 = { read: function() {
542
+ }, v = function(t14) {
543
+ var e4 = t14, i4 = 0, r5 = 0, n3 = 0, o2 = { read: function() {
544
544
  for (; n3 < 8; ) {
545
545
  if (i4 >= e4.length) {
546
546
  if (0 == n3) return -1;
547
547
  throw "unexpected end of file./" + n3;
548
548
  }
549
- var t11 = e4.charAt(i4);
550
- if (i4 += 1, "=" == t11) return n3 = 0, -1;
551
- t11.match(/^\s$/) || (r5 = r5 << 6 | s2(t11.charCodeAt(0)), n3 += 6);
549
+ var t15 = e4.charAt(i4);
550
+ if (i4 += 1, "=" == t15) return n3 = 0, -1;
551
+ t15.match(/^\s$/) || (r5 = r5 << 6 | s2(t15.charCodeAt(0)), n3 += 6);
552
552
  }
553
553
  var o3 = r5 >>> n3 - 8 & 255;
554
554
  return n3 -= 8, o3;
555
- } }, s2 = function(t11) {
556
- if (65 <= t11 && t11 <= 90) return t11 - 65;
557
- if (97 <= t11 && t11 <= 122) return t11 - 97 + 26;
558
- if (48 <= t11 && t11 <= 57) return t11 - 48 + 52;
559
- if (43 == t11) return 62;
560
- if (47 == t11) return 63;
561
- throw "c:" + t11;
555
+ } }, s2 = function(t15) {
556
+ if (65 <= t15 && t15 <= 90) return t15 - 65;
557
+ if (97 <= t15 && t15 <= 122) return t15 - 97 + 26;
558
+ if (48 <= t15 && t15 <= 57) return t15 - 48 + 52;
559
+ if (43 == t15) return 62;
560
+ if (47 == t15) return 63;
561
+ throw "c:" + t15;
562
562
  };
563
563
  return o2;
564
- }, _ = function(t10, e4, i4) {
565
- for (var r5 = (function(t11, e5) {
566
- var i5 = t11, r6 = e5, n4 = new Array(t11 * e5), o3 = { setPixel: function(t12, e6, r7) {
567
- n4[e6 * i5 + t12] = r7;
568
- }, write: function(t12) {
569
- t12.writeString("GIF87a"), t12.writeShort(i5), t12.writeShort(r6), t12.writeByte(128), t12.writeByte(0), t12.writeByte(0), t12.writeByte(0), t12.writeByte(0), t12.writeByte(0), t12.writeByte(255), t12.writeByte(255), t12.writeByte(255), t12.writeString(","), t12.writeShort(0), t12.writeShort(0), t12.writeShort(i5), t12.writeShort(r6), t12.writeByte(0);
564
+ }, _ = function(t14, e4, i4) {
565
+ for (var r5 = (function(t15, e5) {
566
+ var i5 = t15, r6 = e5, n4 = new Array(t15 * e5), o3 = { setPixel: function(t16, e6, r7) {
567
+ n4[e6 * i5 + t16] = r7;
568
+ }, write: function(t16) {
569
+ t16.writeString("GIF87a"), t16.writeShort(i5), t16.writeShort(r6), t16.writeByte(128), t16.writeByte(0), t16.writeByte(0), t16.writeByte(0), t16.writeByte(0), t16.writeByte(0), t16.writeByte(255), t16.writeByte(255), t16.writeByte(255), t16.writeString(","), t16.writeShort(0), t16.writeShort(0), t16.writeShort(i5), t16.writeShort(r6), t16.writeByte(0);
570
570
  var e6 = s3(2);
571
- t12.writeByte(2);
572
- for (var n5 = 0; e6.length - n5 > 255; ) t12.writeByte(255), t12.writeBytes(e6, n5, 255), n5 += 255;
573
- t12.writeByte(e6.length - n5), t12.writeBytes(e6, n5, e6.length - n5), t12.writeByte(0), t12.writeString(";");
574
- } }, s3 = function(t12) {
575
- for (var e6 = 1 << t12, i6 = 1 + (1 << t12), r7 = t12 + 1, o4 = a3(), s4 = 0; s4 < e6; s4 += 1) o4.add(String.fromCharCode(s4));
571
+ t16.writeByte(2);
572
+ for (var n5 = 0; e6.length - n5 > 255; ) t16.writeByte(255), t16.writeBytes(e6, n5, 255), n5 += 255;
573
+ t16.writeByte(e6.length - n5), t16.writeBytes(e6, n5, e6.length - n5), t16.writeByte(0), t16.writeString(";");
574
+ } }, s3 = function(t16) {
575
+ for (var e6 = 1 << t16, i6 = 1 + (1 << t16), r7 = t16 + 1, o4 = a3(), s4 = 0; s4 < e6; s4 += 1) o4.add(String.fromCharCode(s4));
576
576
  o4.add(String.fromCharCode(e6)), o4.add(String.fromCharCode(i6));
577
- var h3, d3, u2, c2 = p(), l2 = (h3 = c2, d3 = 0, u2 = 0, { write: function(t13, e7) {
578
- if (t13 >>> e7 != 0) throw "length over";
579
- for (; d3 + e7 >= 8; ) h3.writeByte(255 & (t13 << d3 | u2)), e7 -= 8 - d3, t13 >>>= 8 - d3, u2 = 0, d3 = 0;
580
- u2 |= t13 << d3, d3 += e7;
577
+ var h3, d3, u2, c2 = p(), l2 = (h3 = c2, d3 = 0, u2 = 0, { write: function(t17, e7) {
578
+ if (t17 >>> e7 != 0) throw "length over";
579
+ for (; d3 + e7 >= 8; ) h3.writeByte(255 & (t17 << d3 | u2)), e7 -= 8 - d3, t17 >>>= 8 - d3, u2 = 0, d3 = 0;
580
+ u2 |= t17 << d3, d3 += e7;
581
581
  }, flush: function() {
582
582
  d3 > 0 && h3.writeByte(u2);
583
583
  } });
@@ -589,95 +589,95 @@ var require_qr_code_styling = __commonJS({
589
589
  }
590
590
  return l2.write(o4.indexOf(f2), r7), l2.write(i6, r7), l2.flush(), c2.toByteArray();
591
591
  }, a3 = function() {
592
- var t12 = {}, e6 = 0, i6 = { add: function(r7) {
592
+ var t16 = {}, e6 = 0, i6 = { add: function(r7) {
593
593
  if (i6.contains(r7)) throw "dup key:" + r7;
594
- t12[r7] = e6, e6 += 1;
594
+ t16[r7] = e6, e6 += 1;
595
595
  }, size: function() {
596
596
  return e6;
597
597
  }, indexOf: function(e7) {
598
- return t12[e7];
598
+ return t16[e7];
599
599
  }, contains: function(e7) {
600
- return void 0 !== t12[e7];
600
+ return void 0 !== t16[e7];
601
601
  } };
602
602
  return i6;
603
603
  };
604
604
  return o3;
605
- })(t10, e4), n3 = 0; n3 < e4; n3 += 1) for (var o2 = 0; o2 < t10; o2 += 1) r5.setPixel(o2, n3, i4(o2, n3));
605
+ })(t14, e4), n3 = 0; n3 < e4; n3 += 1) for (var o2 = 0; o2 < t14; o2 += 1) r5.setPixel(o2, n3, i4(o2, n3));
606
606
  var s2 = p();
607
607
  r5.write(s2);
608
608
  for (var a2 = (function() {
609
- var t11 = 0, e5 = 0, i5 = 0, r6 = "", n4 = {}, o3 = function(t12) {
610
- r6 += String.fromCharCode(s3(63 & t12));
611
- }, s3 = function(t12) {
612
- if (t12 < 0) ;
609
+ var t15 = 0, e5 = 0, i5 = 0, r6 = "", n4 = {}, o3 = function(t16) {
610
+ r6 += String.fromCharCode(s3(63 & t16));
611
+ }, s3 = function(t16) {
612
+ if (t16 < 0) ;
613
613
  else {
614
- if (t12 < 26) return 65 + t12;
615
- if (t12 < 52) return t12 - 26 + 97;
616
- if (t12 < 62) return t12 - 52 + 48;
617
- if (62 == t12) return 43;
618
- if (63 == t12) return 47;
614
+ if (t16 < 26) return 65 + t16;
615
+ if (t16 < 52) return t16 - 26 + 97;
616
+ if (t16 < 62) return t16 - 52 + 48;
617
+ if (62 == t16) return 43;
618
+ if (63 == t16) return 47;
619
619
  }
620
- throw "n:" + t12;
620
+ throw "n:" + t16;
621
621
  };
622
622
  return n4.writeByte = function(r7) {
623
- for (t11 = t11 << 8 | 255 & r7, e5 += 8, i5 += 1; e5 >= 6; ) o3(t11 >>> e5 - 6), e5 -= 6;
623
+ for (t15 = t15 << 8 | 255 & r7, e5 += 8, i5 += 1; e5 >= 6; ) o3(t15 >>> e5 - 6), e5 -= 6;
624
624
  }, n4.flush = function() {
625
- if (e5 > 0 && (o3(t11 << 6 - e5), t11 = 0, e5 = 0), i5 % 3 != 0) for (var n5 = 3 - i5 % 3, s4 = 0; s4 < n5; s4 += 1) r6 += "=";
625
+ if (e5 > 0 && (o3(t15 << 6 - e5), t15 = 0, e5 = 0), i5 % 3 != 0) for (var n5 = 3 - i5 % 3, s4 = 0; s4 < n5; s4 += 1) r6 += "=";
626
626
  }, n4.toString = function() {
627
627
  return r6;
628
628
  }, n4;
629
629
  })(), h2 = s2.toByteArray(), d2 = 0; d2 < h2.length; d2 += 1) a2.writeByte(h2[d2]);
630
630
  return a2.flush(), "data:image/gif;base64," + a2;
631
631
  };
632
- return t9;
632
+ return t13;
633
633
  })();
634
- n.stringToBytesFuncs["UTF-8"] = function(t9) {
635
- return (function(t10) {
636
- for (var e3 = [], i3 = 0; i3 < t10.length; i3++) {
637
- var r4 = t10.charCodeAt(i3);
638
- r4 < 128 ? e3.push(r4) : r4 < 2048 ? e3.push(192 | r4 >> 6, 128 | 63 & r4) : r4 < 55296 || r4 >= 57344 ? e3.push(224 | r4 >> 12, 128 | r4 >> 6 & 63, 128 | 63 & r4) : (i3++, r4 = 65536 + ((1023 & r4) << 10 | 1023 & t10.charCodeAt(i3)), e3.push(240 | r4 >> 18, 128 | r4 >> 12 & 63, 128 | r4 >> 6 & 63, 128 | 63 & r4));
634
+ n.stringToBytesFuncs["UTF-8"] = function(t13) {
635
+ return (function(t14) {
636
+ for (var e3 = [], i3 = 0; i3 < t14.length; i3++) {
637
+ var r4 = t14.charCodeAt(i3);
638
+ r4 < 128 ? e3.push(r4) : r4 < 2048 ? e3.push(192 | r4 >> 6, 128 | 63 & r4) : r4 < 55296 || r4 >= 57344 ? e3.push(224 | r4 >> 12, 128 | r4 >> 6 & 63, 128 | 63 & r4) : (i3++, r4 = 65536 + ((1023 & r4) << 10 | 1023 & t14.charCodeAt(i3)), e3.push(240 | r4 >> 18, 128 | r4 >> 12 & 63, 128 | r4 >> 6 & 63, 128 | 63 & r4));
639
639
  }
640
640
  return e3;
641
- })(t9);
641
+ })(t13);
642
642
  }, void 0 === (r3 = "function" == typeof (i2 = function() {
643
643
  return n;
644
- }) ? i2.apply(e2, []) : i2) || (t8.exports = r3);
644
+ }) ? i2.apply(e2, []) : i2) || (t12.exports = r3);
645
645
  } }, e = {};
646
646
  function i(r3) {
647
647
  var n = e[r3];
648
648
  if (void 0 !== n) return n.exports;
649
649
  var o = e[r3] = { exports: {} };
650
- return t7[r3](o, o.exports, i), o.exports;
650
+ return t11[r3](o, o.exports, i), o.exports;
651
651
  }
652
- i.n = (t8) => {
653
- var e2 = t8 && t8.__esModule ? () => t8.default : () => t8;
652
+ i.n = (t12) => {
653
+ var e2 = t12 && t12.__esModule ? () => t12.default : () => t12;
654
654
  return i.d(e2, { a: e2 }), e2;
655
- }, i.d = (t8, e2) => {
656
- for (var r3 in e2) i.o(e2, r3) && !i.o(t8, r3) && Object.defineProperty(t8, r3, { enumerable: true, get: e2[r3] });
657
- }, i.o = (t8, e2) => Object.prototype.hasOwnProperty.call(t8, e2);
655
+ }, i.d = (t12, e2) => {
656
+ for (var r3 in e2) i.o(e2, r3) && !i.o(t12, r3) && Object.defineProperty(t12, r3, { enumerable: true, get: e2[r3] });
657
+ }, i.o = (t12, e2) => Object.prototype.hasOwnProperty.call(t12, e2);
658
658
  var r2 = {};
659
659
  return (() => {
660
660
  "use strict";
661
661
  i.d(r2, { default: () => $ });
662
- const t8 = (t9) => !!t9 && "object" == typeof t9 && !Array.isArray(t9);
662
+ const t12 = (t13) => !!t13 && "object" == typeof t13 && !Array.isArray(t13);
663
663
  function e2(i2, ...r3) {
664
664
  if (!r3.length) return i2;
665
665
  const n2 = r3.shift();
666
- return void 0 !== n2 && t8(i2) && t8(n2) ? (i2 = Object.assign({}, i2), Object.keys(n2).forEach(((r4) => {
666
+ return void 0 !== n2 && t12(i2) && t12(n2) ? (i2 = Object.assign({}, i2), Object.keys(n2).forEach(((r4) => {
667
667
  const o2 = i2[r4], s2 = n2[r4];
668
- Array.isArray(o2) && Array.isArray(s2) ? i2[r4] = s2 : t8(o2) && t8(s2) ? i2[r4] = e2(Object.assign({}, o2), s2) : i2[r4] = s2;
668
+ Array.isArray(o2) && Array.isArray(s2) ? i2[r4] = s2 : t12(o2) && t12(s2) ? i2[r4] = e2(Object.assign({}, o2), s2) : i2[r4] = s2;
669
669
  })), e2(i2, ...r3)) : i2;
670
670
  }
671
- function n(t9, e3) {
671
+ function n(t13, e3) {
672
672
  const i2 = document.createElement("a");
673
- i2.download = e3, i2.href = t9, document.body.appendChild(i2), i2.click(), document.body.removeChild(i2);
673
+ i2.download = e3, i2.href = t13, document.body.appendChild(i2), i2.click(), document.body.removeChild(i2);
674
674
  }
675
675
  const o = { L: 0.07, M: 0.15, Q: 0.25, H: 0.3 };
676
676
  class s {
677
- constructor({ svg: t9, type: e3, window: i2 }) {
678
- this._svg = t9, this._type = e3, this._window = i2;
677
+ constructor({ svg: t13, type: e3, window: i2 }) {
678
+ this._svg = t13, this._type = e3, this._window = i2;
679
679
  }
680
- draw(t9, e3, i2, r3) {
680
+ draw(t13, e3, i2, r3) {
681
681
  let n2;
682
682
  switch (this._type) {
683
683
  case "dots":
@@ -698,100 +698,100 @@ var require_qr_code_styling = __commonJS({
698
698
  default:
699
699
  n2 = this._drawSquare;
700
700
  }
701
- n2.call(this, { x: t9, y: e3, size: i2, getNeighbor: r3 });
701
+ n2.call(this, { x: t13, y: e3, size: i2, getNeighbor: r3 });
702
702
  }
703
- _rotateFigure({ x: t9, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
703
+ _rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
704
704
  var o2;
705
- const s2 = t9 + i2 / 2, a2 = e3 + i2 / 2;
705
+ const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
706
706
  n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
707
707
  }
708
- _basicDot(t9) {
709
- const { size: e3, x: i2, y: r3 } = t9;
710
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
708
+ _basicDot(t13) {
709
+ const { size: e3, x: i2, y: r3 } = t13;
710
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
711
711
  this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(i2 + e3 / 2)), this._element.setAttribute("cy", String(r3 + e3 / 2)), this._element.setAttribute("r", String(e3 / 2));
712
712
  } }));
713
713
  }
714
- _basicSquare(t9) {
715
- const { size: e3, x: i2, y: r3 } = t9;
716
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
714
+ _basicSquare(t13) {
715
+ const { size: e3, x: i2, y: r3 } = t13;
716
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
717
717
  this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(i2)), this._element.setAttribute("y", String(r3)), this._element.setAttribute("width", String(e3)), this._element.setAttribute("height", String(e3));
718
718
  } }));
719
719
  }
720
- _basicSideRounded(t9) {
721
- const { size: e3, x: i2, y: r3 } = t9;
722
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
720
+ _basicSideRounded(t13) {
721
+ const { size: e3, x: i2, y: r3 } = t13;
722
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
723
723
  this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${i2} ${r3}v ${e3}h ` + e3 / 2 + `a ${e3 / 2} ${e3 / 2}, 0, 0, 0, 0 ${-e3}`);
724
724
  } }));
725
725
  }
726
- _basicCornerRounded(t9) {
727
- const { size: e3, x: i2, y: r3 } = t9;
728
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
726
+ _basicCornerRounded(t13) {
727
+ const { size: e3, x: i2, y: r3 } = t13;
728
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
729
729
  this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${i2} ${r3}v ${e3}h ${e3}v ` + -e3 / 2 + `a ${e3 / 2} ${e3 / 2}, 0, 0, 0, ${-e3 / 2} ${-e3 / 2}`);
730
730
  } }));
731
731
  }
732
- _basicCornerExtraRounded(t9) {
733
- const { size: e3, x: i2, y: r3 } = t9;
734
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
732
+ _basicCornerExtraRounded(t13) {
733
+ const { size: e3, x: i2, y: r3 } = t13;
734
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
735
735
  this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${i2} ${r3}v ${e3}h ${e3}a ${e3} ${e3}, 0, 0, 0, ${-e3} ${-e3}`);
736
736
  } }));
737
737
  }
738
- _basicCornersRounded(t9) {
739
- const { size: e3, x: i2, y: r3 } = t9;
740
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
738
+ _basicCornersRounded(t13) {
739
+ const { size: e3, x: i2, y: r3 } = t13;
740
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
741
741
  this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${i2} ${r3}v ` + e3 / 2 + `a ${e3 / 2} ${e3 / 2}, 0, 0, 0, ${e3 / 2} ${e3 / 2}h ` + e3 / 2 + "v " + -e3 / 2 + `a ${e3 / 2} ${e3 / 2}, 0, 0, 0, ${-e3 / 2} ${-e3 / 2}`);
742
742
  } }));
743
743
  }
744
- _drawDot({ x: t9, y: e3, size: i2 }) {
745
- this._basicDot({ x: t9, y: e3, size: i2, rotation: 0 });
744
+ _drawDot({ x: t13, y: e3, size: i2 }) {
745
+ this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
746
746
  }
747
- _drawSquare({ x: t9, y: e3, size: i2 }) {
748
- this._basicSquare({ x: t9, y: e3, size: i2, rotation: 0 });
747
+ _drawSquare({ x: t13, y: e3, size: i2 }) {
748
+ this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
749
749
  }
750
- _drawRounded({ x: t9, y: e3, size: i2, getNeighbor: r3 }) {
750
+ _drawRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
751
751
  const n2 = r3 ? +r3(-1, 0) : 0, o2 = r3 ? +r3(1, 0) : 0, s2 = r3 ? +r3(0, -1) : 0, a2 = r3 ? +r3(0, 1) : 0, h2 = n2 + o2 + s2 + a2;
752
- if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t9, y: e3, size: i2, rotation: 0 });
752
+ if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
753
753
  else {
754
754
  if (2 === h2) {
755
755
  let r4 = 0;
756
- return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerRounded({ x: t9, y: e3, size: i2, rotation: r4 });
756
+ return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerRounded({ x: t13, y: e3, size: i2, rotation: r4 });
757
757
  }
758
758
  if (1 === h2) {
759
759
  let r4 = 0;
760
- return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x: t9, y: e3, size: i2, rotation: r4 });
760
+ return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x: t13, y: e3, size: i2, rotation: r4 });
761
761
  }
762
762
  }
763
- else this._basicDot({ x: t9, y: e3, size: i2, rotation: 0 });
763
+ else this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
764
764
  }
765
- _drawExtraRounded({ x: t9, y: e3, size: i2, getNeighbor: r3 }) {
765
+ _drawExtraRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
766
766
  const n2 = r3 ? +r3(-1, 0) : 0, o2 = r3 ? +r3(1, 0) : 0, s2 = r3 ? +r3(0, -1) : 0, a2 = r3 ? +r3(0, 1) : 0, h2 = n2 + o2 + s2 + a2;
767
- if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t9, y: e3, size: i2, rotation: 0 });
767
+ if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
768
768
  else {
769
769
  if (2 === h2) {
770
770
  let r4 = 0;
771
- return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerExtraRounded({ x: t9, y: e3, size: i2, rotation: r4 });
771
+ return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerExtraRounded({ x: t13, y: e3, size: i2, rotation: r4 });
772
772
  }
773
773
  if (1 === h2) {
774
774
  let r4 = 0;
775
- return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x: t9, y: e3, size: i2, rotation: r4 });
775
+ return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x: t13, y: e3, size: i2, rotation: r4 });
776
776
  }
777
777
  }
778
- else this._basicDot({ x: t9, y: e3, size: i2, rotation: 0 });
778
+ else this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
779
779
  }
780
- _drawClassy({ x: t9, y: e3, size: i2, getNeighbor: r3 }) {
780
+ _drawClassy({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
781
781
  const n2 = r3 ? +r3(-1, 0) : 0, o2 = r3 ? +r3(1, 0) : 0, s2 = r3 ? +r3(0, -1) : 0, a2 = r3 ? +r3(0, 1) : 0;
782
- 0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x: t9, y: e3, size: i2, rotation: 0 }) : this._basicCornerRounded({ x: t9, y: e3, size: i2, rotation: Math.PI / 2 }) : this._basicCornerRounded({ x: t9, y: e3, size: i2, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: t9, y: e3, size: i2, rotation: Math.PI / 2 });
782
+ 0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 }) : this._basicCornerRounded({ x: t13, y: e3, size: i2, rotation: Math.PI / 2 }) : this._basicCornerRounded({ x: t13, y: e3, size: i2, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: t13, y: e3, size: i2, rotation: Math.PI / 2 });
783
783
  }
784
- _drawClassyRounded({ x: t9, y: e3, size: i2, getNeighbor: r3 }) {
784
+ _drawClassyRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
785
785
  const n2 = r3 ? +r3(-1, 0) : 0, o2 = r3 ? +r3(1, 0) : 0, s2 = r3 ? +r3(0, -1) : 0, a2 = r3 ? +r3(0, 1) : 0;
786
- 0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x: t9, y: e3, size: i2, rotation: 0 }) : this._basicCornerExtraRounded({ x: t9, y: e3, size: i2, rotation: Math.PI / 2 }) : this._basicCornerExtraRounded({ x: t9, y: e3, size: i2, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: t9, y: e3, size: i2, rotation: Math.PI / 2 });
786
+ 0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 }) : this._basicCornerExtraRounded({ x: t13, y: e3, size: i2, rotation: Math.PI / 2 }) : this._basicCornerExtraRounded({ x: t13, y: e3, size: i2, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: t13, y: e3, size: i2, rotation: Math.PI / 2 });
787
787
  }
788
788
  }
789
789
  const a = { dot: "dot", square: "square", extraRounded: "extra-rounded" }, h = Object.values(a);
790
790
  class d {
791
- constructor({ svg: t9, type: e3, window: i2 }) {
792
- this._svg = t9, this._type = e3, this._window = i2;
791
+ constructor({ svg: t13, type: e3, window: i2 }) {
792
+ this._svg = t13, this._type = e3, this._window = i2;
793
793
  }
794
- draw(t9, e3, i2, r3) {
794
+ draw(t13, e3, i2, r3) {
795
795
  let n2;
796
796
  switch (this._type) {
797
797
  case a.square:
@@ -803,78 +803,78 @@ var require_qr_code_styling = __commonJS({
803
803
  default:
804
804
  n2 = this._drawDot;
805
805
  }
806
- n2.call(this, { x: t9, y: e3, size: i2, rotation: r3 });
806
+ n2.call(this, { x: t13, y: e3, size: i2, rotation: r3 });
807
807
  }
808
- _rotateFigure({ x: t9, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
808
+ _rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
809
809
  var o2;
810
- const s2 = t9 + i2 / 2, a2 = e3 + i2 / 2;
810
+ const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
811
811
  n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
812
812
  }
813
- _basicDot(t9) {
814
- const { size: e3, x: i2, y: r3 } = t9, n2 = e3 / 7;
815
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
813
+ _basicDot(t13) {
814
+ const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
815
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
816
816
  this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${i2 + e3 / 2} ${r3}a ${e3 / 2} ${e3 / 2} 0 1 0 0.1 0zm 0 ${n2}a ${e3 / 2 - n2} ${e3 / 2 - n2} 0 1 1 -0.1 0Z`);
817
817
  } }));
818
818
  }
819
- _basicSquare(t9) {
820
- const { size: e3, x: i2, y: r3 } = t9, n2 = e3 / 7;
821
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
819
+ _basicSquare(t13) {
820
+ const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
821
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
822
822
  this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${i2} ${r3}v ${e3}h ${e3}v ` + -e3 + `zM ${i2 + n2} ${r3 + n2}h ` + (e3 - 2 * n2) + "v " + (e3 - 2 * n2) + "h " + (2 * n2 - e3) + "z");
823
823
  } }));
824
824
  }
825
- _basicExtraRounded(t9) {
826
- const { size: e3, x: i2, y: r3 } = t9, n2 = e3 / 7;
827
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
825
+ _basicExtraRounded(t13) {
826
+ const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
827
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
828
828
  this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${i2} ${r3 + 2.5 * n2}v ` + 2 * n2 + `a ${2.5 * n2} ${2.5 * n2}, 0, 0, 0, ${2.5 * n2} ${2.5 * n2}h ` + 2 * n2 + `a ${2.5 * n2} ${2.5 * n2}, 0, 0, 0, ${2.5 * n2} ${2.5 * -n2}v ` + -2 * n2 + `a ${2.5 * n2} ${2.5 * n2}, 0, 0, 0, ${2.5 * -n2} ${2.5 * -n2}h ` + -2 * n2 + `a ${2.5 * n2} ${2.5 * n2}, 0, 0, 0, ${2.5 * -n2} ${2.5 * n2}M ${i2 + 2.5 * n2} ${r3 + n2}h ` + 2 * n2 + `a ${1.5 * n2} ${1.5 * n2}, 0, 0, 1, ${1.5 * n2} ${1.5 * n2}v ` + 2 * n2 + `a ${1.5 * n2} ${1.5 * n2}, 0, 0, 1, ${1.5 * -n2} ${1.5 * n2}h ` + -2 * n2 + `a ${1.5 * n2} ${1.5 * n2}, 0, 0, 1, ${1.5 * -n2} ${1.5 * -n2}v ` + -2 * n2 + `a ${1.5 * n2} ${1.5 * n2}, 0, 0, 1, ${1.5 * n2} ${1.5 * -n2}`);
829
829
  } }));
830
830
  }
831
- _drawDot({ x: t9, y: e3, size: i2, rotation: r3 }) {
832
- this._basicDot({ x: t9, y: e3, size: i2, rotation: r3 });
831
+ _drawDot({ x: t13, y: e3, size: i2, rotation: r3 }) {
832
+ this._basicDot({ x: t13, y: e3, size: i2, rotation: r3 });
833
833
  }
834
- _drawSquare({ x: t9, y: e3, size: i2, rotation: r3 }) {
835
- this._basicSquare({ x: t9, y: e3, size: i2, rotation: r3 });
834
+ _drawSquare({ x: t13, y: e3, size: i2, rotation: r3 }) {
835
+ this._basicSquare({ x: t13, y: e3, size: i2, rotation: r3 });
836
836
  }
837
- _drawExtraRounded({ x: t9, y: e3, size: i2, rotation: r3 }) {
838
- this._basicExtraRounded({ x: t9, y: e3, size: i2, rotation: r3 });
837
+ _drawExtraRounded({ x: t13, y: e3, size: i2, rotation: r3 }) {
838
+ this._basicExtraRounded({ x: t13, y: e3, size: i2, rotation: r3 });
839
839
  }
840
840
  }
841
841
  const u = { dot: "dot", square: "square" }, c = Object.values(u);
842
842
  class l {
843
- constructor({ svg: t9, type: e3, window: i2 }) {
844
- this._svg = t9, this._type = e3, this._window = i2;
843
+ constructor({ svg: t13, type: e3, window: i2 }) {
844
+ this._svg = t13, this._type = e3, this._window = i2;
845
845
  }
846
- draw(t9, e3, i2, r3) {
846
+ draw(t13, e3, i2, r3) {
847
847
  let n2;
848
- n2 = this._type === u.square ? this._drawSquare : this._drawDot, n2.call(this, { x: t9, y: e3, size: i2, rotation: r3 });
848
+ n2 = this._type === u.square ? this._drawSquare : this._drawDot, n2.call(this, { x: t13, y: e3, size: i2, rotation: r3 });
849
849
  }
850
- _rotateFigure({ x: t9, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
850
+ _rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
851
851
  var o2;
852
- const s2 = t9 + i2 / 2, a2 = e3 + i2 / 2;
852
+ const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
853
853
  n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
854
854
  }
855
- _basicDot(t9) {
856
- const { size: e3, x: i2, y: r3 } = t9;
857
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
855
+ _basicDot(t13) {
856
+ const { size: e3, x: i2, y: r3 } = t13;
857
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
858
858
  this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(i2 + e3 / 2)), this._element.setAttribute("cy", String(r3 + e3 / 2)), this._element.setAttribute("r", String(e3 / 2));
859
859
  } }));
860
860
  }
861
- _basicSquare(t9) {
862
- const { size: e3, x: i2, y: r3 } = t9;
863
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
861
+ _basicSquare(t13) {
862
+ const { size: e3, x: i2, y: r3 } = t13;
863
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
864
864
  this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(i2)), this._element.setAttribute("y", String(r3)), this._element.setAttribute("width", String(e3)), this._element.setAttribute("height", String(e3));
865
865
  } }));
866
866
  }
867
- _drawDot({ x: t9, y: e3, size: i2, rotation: r3 }) {
868
- this._basicDot({ x: t9, y: e3, size: i2, rotation: r3 });
867
+ _drawDot({ x: t13, y: e3, size: i2, rotation: r3 }) {
868
+ this._basicDot({ x: t13, y: e3, size: i2, rotation: r3 });
869
869
  }
870
- _drawSquare({ x: t9, y: e3, size: i2, rotation: r3 }) {
871
- this._basicSquare({ x: t9, y: e3, size: i2, rotation: r3 });
870
+ _drawSquare({ x: t13, y: e3, size: i2, rotation: r3 }) {
871
+ this._basicSquare({ x: t13, y: e3, size: i2, rotation: r3 });
872
872
  }
873
873
  }
874
874
  const g = "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]], w = [[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]];
875
875
  class p {
876
- constructor(t9, e3) {
877
- this._roundSize = (t10) => this._options.dotsOptions.roundSize ? Math.floor(t10) : t10, this._window = e3, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(t9.width)), this._element.setAttribute("height", String(t9.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), t9.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${t9.width} ${t9.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = t9.image, this._instanceId = p.instanceCount++, this._options = t9;
876
+ constructor(t13, e3) {
877
+ this._roundSize = (t14) => this._options.dotsOptions.roundSize ? Math.floor(t14) : t14, this._window = e3, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(t13.width)), this._element.setAttribute("height", String(t13.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), t13.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${t13.width} ${t13.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = t13.image, this._instanceId = p.instanceCount++, this._options = t13;
878
878
  }
879
879
  get width() {
880
880
  return this._options.width;
@@ -885,135 +885,135 @@ var require_qr_code_styling = __commonJS({
885
885
  getElement() {
886
886
  return this._element;
887
887
  }
888
- async drawQR(t9) {
889
- const e3 = t9.getModuleCount(), i2 = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, r3 = this._options.shape === g ? i2 / Math.sqrt(2) : i2, n2 = this._roundSize(r3 / e3);
888
+ async drawQR(t13) {
889
+ const e3 = t13.getModuleCount(), i2 = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, r3 = this._options.shape === g ? i2 / Math.sqrt(2) : i2, n2 = this._roundSize(r3 / e3);
890
890
  let s2 = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 };
891
- if (this._qr = t9, this._options.image) {
891
+ if (this._qr = t13, this._options.image) {
892
892
  if (await this.loadImage(), !this._image) return;
893
- const { imageOptions: t10, qrOptions: i3 } = this._options, r4 = t10.imageSize * o[i3.errorCorrectionLevel], a2 = Math.floor(r4 * e3 * e3);
894
- s2 = (function({ originalHeight: t11, originalWidth: e4, maxHiddenDots: i4, maxHiddenAxisDots: r5, dotSize: n3 }) {
893
+ const { imageOptions: t14, qrOptions: i3 } = this._options, r4 = t14.imageSize * o[i3.errorCorrectionLevel], a2 = Math.floor(r4 * e3 * e3);
894
+ s2 = (function({ originalHeight: t15, originalWidth: e4, maxHiddenDots: i4, maxHiddenAxisDots: r5, dotSize: n3 }) {
895
895
  const o2 = { x: 0, y: 0 }, s3 = { x: 0, y: 0 };
896
- if (t11 <= 0 || e4 <= 0 || i4 <= 0 || n3 <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 };
897
- const a3 = t11 / e4;
896
+ if (t15 <= 0 || e4 <= 0 || i4 <= 0 || n3 <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 };
897
+ const a3 = t15 / e4;
898
898
  return o2.x = Math.floor(Math.sqrt(i4 / a3)), o2.x <= 0 && (o2.x = 1), r5 && r5 < o2.x && (o2.x = r5), o2.x % 2 == 0 && o2.x--, s3.x = o2.x * n3, o2.y = 1 + 2 * Math.ceil((o2.x * a3 - 1) / 2), s3.y = Math.round(s3.x * a3), (o2.y * o2.x > i4 || r5 && r5 < o2.y) && (r5 && r5 < o2.y ? (o2.y = r5, o2.y % 2 == 0 && o2.x--) : o2.y -= 2, s3.y = o2.y * n3, o2.x = 1 + 2 * Math.ceil((o2.y / a3 - 1) / 2), s3.x = Math.round(s3.y / a3)), { height: s3.y, width: s3.x, hideYDots: o2.y, hideXDots: o2.x };
899
899
  })({ originalWidth: this._image.width, originalHeight: this._image.height, maxHiddenDots: a2, maxHiddenAxisDots: e3 - 14, dotSize: n2 });
900
900
  }
901
- this.drawBackground(), this.drawDots(((t10, i3) => {
901
+ this.drawBackground(), this.drawDots(((t14, i3) => {
902
902
  var r4, n3, o2, a2, h2, d2;
903
- return !(this._options.imageOptions.hideBackgroundDots && t10 >= (e3 - s2.hideYDots) / 2 && t10 < (e3 + s2.hideYDots) / 2 && i3 >= (e3 - s2.hideXDots) / 2 && i3 < (e3 + s2.hideXDots) / 2 || (null === (r4 = f[t10]) || void 0 === r4 ? void 0 : r4[i3]) || (null === (n3 = f[t10 - e3 + 7]) || void 0 === n3 ? void 0 : n3[i3]) || (null === (o2 = f[t10]) || void 0 === o2 ? void 0 : o2[i3 - e3 + 7]) || (null === (a2 = w[t10]) || void 0 === a2 ? void 0 : a2[i3]) || (null === (h2 = w[t10 - e3 + 7]) || void 0 === h2 ? void 0 : h2[i3]) || (null === (d2 = w[t10]) || void 0 === d2 ? void 0 : d2[i3 - e3 + 7]));
903
+ return !(this._options.imageOptions.hideBackgroundDots && t14 >= (e3 - s2.hideYDots) / 2 && t14 < (e3 + s2.hideYDots) / 2 && i3 >= (e3 - s2.hideXDots) / 2 && i3 < (e3 + s2.hideXDots) / 2 || (null === (r4 = f[t14]) || void 0 === r4 ? void 0 : r4[i3]) || (null === (n3 = f[t14 - e3 + 7]) || void 0 === n3 ? void 0 : n3[i3]) || (null === (o2 = f[t14]) || void 0 === o2 ? void 0 : o2[i3 - e3 + 7]) || (null === (a2 = w[t14]) || void 0 === a2 ? void 0 : a2[i3]) || (null === (h2 = w[t14 - e3 + 7]) || void 0 === h2 ? void 0 : h2[i3]) || (null === (d2 = w[t14]) || void 0 === d2 ? void 0 : d2[i3 - e3 + 7]));
904
904
  })), this.drawCorners(), this._options.image && await this.drawImage({ width: s2.width, height: s2.height, count: e3, dotSize: n2 });
905
905
  }
906
906
  drawBackground() {
907
- var t9, e3, i2;
907
+ var t13, e3, i2;
908
908
  const r3 = this._element, n2 = this._options;
909
909
  if (r3) {
910
- const r4 = null === (t9 = n2.backgroundOptions) || void 0 === t9 ? void 0 : t9.gradient, o2 = null === (e3 = n2.backgroundOptions) || void 0 === e3 ? void 0 : e3.color;
910
+ const r4 = null === (t13 = n2.backgroundOptions) || void 0 === t13 ? void 0 : t13.gradient, o2 = null === (e3 = n2.backgroundOptions) || void 0 === e3 ? void 0 : e3.color;
911
911
  let s2 = n2.height, a2 = n2.width;
912
912
  if (r4 || o2) {
913
- const t10 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
914
- 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), (null === (i2 = n2.backgroundOptions) || void 0 === i2 ? void 0 : i2.round) && (s2 = a2 = Math.min(n2.width, n2.height), t10.setAttribute("rx", String(s2 / 2 * n2.backgroundOptions.round))), t10.setAttribute("x", String(this._roundSize((n2.width - a2) / 2))), t10.setAttribute("y", String(this._roundSize((n2.height - s2) / 2))), t10.setAttribute("width", String(a2)), t10.setAttribute("height", String(s2)), this._backgroundClipPath.appendChild(t10), this._createColor({ options: r4, color: o2, additionalRotation: 0, x: 0, y: 0, height: n2.height, width: n2.width, name: `background-color-${this._instanceId}` });
913
+ const t14 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
914
+ 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), (null === (i2 = n2.backgroundOptions) || void 0 === i2 ? void 0 : i2.round) && (s2 = a2 = Math.min(n2.width, n2.height), t14.setAttribute("rx", String(s2 / 2 * n2.backgroundOptions.round))), t14.setAttribute("x", String(this._roundSize((n2.width - a2) / 2))), t14.setAttribute("y", String(this._roundSize((n2.height - s2) / 2))), t14.setAttribute("width", String(a2)), t14.setAttribute("height", String(s2)), this._backgroundClipPath.appendChild(t14), this._createColor({ options: r4, color: o2, additionalRotation: 0, x: 0, y: 0, height: n2.height, width: n2.width, name: `background-color-${this._instanceId}` });
915
915
  }
916
916
  }
917
917
  }
918
- drawDots(t9) {
918
+ drawDots(t13) {
919
919
  var e3, i2;
920
920
  if (!this._qr) throw "QR code is not defined";
921
921
  const r3 = this._options, n2 = this._qr.getModuleCount();
922
922
  if (n2 > r3.width || n2 > r3.height) throw "The canvas is too small.";
923
923
  const o2 = Math.min(r3.width, r3.height) - 2 * r3.margin, a2 = r3.shape === g ? o2 / Math.sqrt(2) : o2, h2 = this._roundSize(a2 / n2), d2 = this._roundSize((r3.width - n2 * h2) / 2), u2 = this._roundSize((r3.height - n2 * h2) / 2), c2 = new s({ svg: this._element, type: r3.dotsOptions.type, window: this._window });
924
924
  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: null === (e3 = r3.dotsOptions) || void 0 === e3 ? void 0 : e3.gradient, color: r3.dotsOptions.color, additionalRotation: 0, x: 0, y: 0, height: r3.height, width: r3.width, name: `dot-color-${this._instanceId}` });
925
- for (let e4 = 0; e4 < n2; e4++) for (let r4 = 0; r4 < n2; r4++) t9 && !t9(e4, r4) || (null === (i2 = this._qr) || void 0 === i2 ? void 0 : i2.isDark(e4, r4)) && (c2.draw(d2 + r4 * h2, u2 + e4 * h2, h2, ((i3, o3) => !(r4 + i3 < 0 || e4 + o3 < 0 || r4 + i3 >= n2 || e4 + o3 >= n2) && !(t9 && !t9(e4 + o3, r4 + i3)) && !!this._qr && this._qr.isDark(e4 + o3, r4 + i3))), c2._element && this._dotsClipPath && this._dotsClipPath.appendChild(c2._element));
925
+ for (let e4 = 0; e4 < n2; e4++) for (let r4 = 0; r4 < n2; r4++) t13 && !t13(e4, r4) || (null === (i2 = this._qr) || void 0 === i2 ? void 0 : i2.isDark(e4, r4)) && (c2.draw(d2 + r4 * h2, u2 + e4 * h2, h2, ((i3, o3) => !(r4 + i3 < 0 || e4 + o3 < 0 || r4 + i3 >= n2 || e4 + o3 >= n2) && !(t13 && !t13(e4 + o3, r4 + i3)) && !!this._qr && this._qr.isDark(e4 + o3, r4 + i3))), c2._element && this._dotsClipPath && this._dotsClipPath.appendChild(c2._element));
926
926
  if (r3.shape === g) {
927
- const t10 = this._roundSize((o2 / h2 - n2) / 2), e4 = n2 + 2 * t10, i3 = d2 - t10 * h2, r4 = u2 - t10 * h2, s2 = [], a3 = this._roundSize(e4 / 2);
927
+ const t14 = this._roundSize((o2 / h2 - n2) / 2), e4 = n2 + 2 * t14, i3 = d2 - t14 * h2, r4 = u2 - t14 * h2, s2 = [], a3 = this._roundSize(e4 / 2);
928
928
  for (let i4 = 0; i4 < e4; i4++) {
929
929
  s2[i4] = [];
930
- for (let r5 = 0; r5 < e4; r5++) i4 >= t10 - 1 && i4 <= e4 - t10 && r5 >= t10 - 1 && r5 <= e4 - t10 || Math.sqrt((i4 - a3) * (i4 - a3) + (r5 - a3) * (r5 - a3)) > a3 ? s2[i4][r5] = 0 : s2[i4][r5] = this._qr.isDark(r5 - 2 * t10 < 0 ? r5 : r5 >= n2 ? r5 - 2 * t10 : r5 - t10, i4 - 2 * t10 < 0 ? i4 : i4 >= n2 ? i4 - 2 * t10 : i4 - t10) ? 1 : 0;
930
+ for (let r5 = 0; r5 < e4; r5++) i4 >= t14 - 1 && i4 <= e4 - t14 && r5 >= t14 - 1 && r5 <= e4 - t14 || Math.sqrt((i4 - a3) * (i4 - a3) + (r5 - a3) * (r5 - a3)) > a3 ? s2[i4][r5] = 0 : s2[i4][r5] = this._qr.isDark(r5 - 2 * t14 < 0 ? r5 : r5 >= n2 ? r5 - 2 * t14 : r5 - t14, i4 - 2 * t14 < 0 ? i4 : i4 >= n2 ? i4 - 2 * t14 : i4 - t14) ? 1 : 0;
931
931
  }
932
- for (let t11 = 0; t11 < e4; t11++) for (let n3 = 0; n3 < e4; n3++) s2[t11][n3] && (c2.draw(i3 + n3 * h2, r4 + t11 * h2, h2, ((e5, i4) => {
932
+ for (let t15 = 0; t15 < e4; t15++) for (let n3 = 0; n3 < e4; n3++) s2[t15][n3] && (c2.draw(i3 + n3 * h2, r4 + t15 * h2, h2, ((e5, i4) => {
933
933
  var r5;
934
- return !!(null === (r5 = s2[t11 + i4]) || void 0 === r5 ? void 0 : r5[n3 + e5]);
934
+ return !!(null === (r5 = s2[t15 + i4]) || void 0 === r5 ? void 0 : r5[n3 + e5]);
935
935
  })), c2._element && this._dotsClipPath && this._dotsClipPath.appendChild(c2._element));
936
936
  }
937
937
  }
938
938
  drawCorners() {
939
939
  if (!this._qr) throw "QR code is not defined";
940
- const t9 = this._element, e3 = this._options;
941
- if (!t9) throw "Element code is not defined";
940
+ const t13 = this._element, e3 = this._options;
941
+ if (!t13) throw "Element code is not defined";
942
942
  const i2 = this._qr.getModuleCount(), r3 = Math.min(e3.width, e3.height) - 2 * e3.margin, n2 = e3.shape === g ? r3 / Math.sqrt(2) : r3, o2 = this._roundSize(n2 / i2), a2 = 7 * o2, u2 = 3 * o2, p2 = this._roundSize((e3.width - i2 * o2) / 2), v2 = this._roundSize((e3.height - i2 * o2) / 2);
943
- [[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([t10, r4, n3]) => {
943
+ [[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([t14, r4, n3]) => {
944
944
  var g2, _2, m2, b2, y2, x2, S2, C2, A2, M2, $2, O, D, k;
945
- const z = p2 + t10 * o2 * (i2 - 7), B = v2 + r4 * o2 * (i2 - 7);
945
+ const z = p2 + t14 * o2 * (i2 - 7), B = v2 + r4 * o2 * (i2 - 7);
946
946
  let P = this._dotsClipPath, I = this._dotsClipPath;
947
- if (((null === (g2 = e3.cornersSquareOptions) || void 0 === g2 ? void 0 : g2.gradient) || (null === (_2 = e3.cornersSquareOptions) || void 0 === _2 ? void 0 : _2.color)) && (P = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), P.setAttribute("id", `clip-path-corners-square-color-${t10}-${r4}-${this._instanceId}`), this._defs.appendChild(P), this._cornersSquareClipPath = this._cornersDotClipPath = I = P, this._createColor({ options: null === (m2 = e3.cornersSquareOptions) || void 0 === m2 ? void 0 : m2.gradient, color: null === (b2 = e3.cornersSquareOptions) || void 0 === b2 ? void 0 : b2.color, additionalRotation: n3, x: z, y: B, height: a2, width: a2, name: `corners-square-color-${t10}-${r4}-${this._instanceId}` })), (null === (y2 = e3.cornersSquareOptions) || void 0 === y2 ? void 0 : y2.type) && h.includes(e3.cornersSquareOptions.type)) {
948
- const t11 = new d({ svg: this._element, type: e3.cornersSquareOptions.type, window: this._window });
949
- t11.draw(z, B, a2, n3), t11._element && P && P.appendChild(t11._element);
947
+ if (((null === (g2 = e3.cornersSquareOptions) || void 0 === g2 ? void 0 : g2.gradient) || (null === (_2 = e3.cornersSquareOptions) || void 0 === _2 ? void 0 : _2.color)) && (P = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), P.setAttribute("id", `clip-path-corners-square-color-${t14}-${r4}-${this._instanceId}`), this._defs.appendChild(P), this._cornersSquareClipPath = this._cornersDotClipPath = I = P, this._createColor({ options: null === (m2 = e3.cornersSquareOptions) || void 0 === m2 ? void 0 : m2.gradient, color: null === (b2 = e3.cornersSquareOptions) || void 0 === b2 ? void 0 : b2.color, additionalRotation: n3, x: z, y: B, height: a2, width: a2, name: `corners-square-color-${t14}-${r4}-${this._instanceId}` })), (null === (y2 = e3.cornersSquareOptions) || void 0 === y2 ? void 0 : y2.type) && h.includes(e3.cornersSquareOptions.type)) {
948
+ const t15 = new d({ svg: this._element, type: e3.cornersSquareOptions.type, window: this._window });
949
+ t15.draw(z, B, a2, n3), t15._element && P && P.appendChild(t15._element);
950
950
  } else {
951
- const t11 = new s({ svg: this._element, type: (null === (x2 = e3.cornersSquareOptions) || void 0 === x2 ? void 0 : x2.type) || e3.dotsOptions.type, window: this._window });
952
- for (let e4 = 0; e4 < f.length; e4++) for (let i3 = 0; i3 < f[e4].length; i3++) (null === (S2 = f[e4]) || void 0 === S2 ? void 0 : S2[i3]) && (t11.draw(z + i3 * o2, B + e4 * o2, o2, ((t12, r5) => {
951
+ const t15 = new s({ svg: this._element, type: (null === (x2 = e3.cornersSquareOptions) || void 0 === x2 ? void 0 : x2.type) || e3.dotsOptions.type, window: this._window });
952
+ for (let e4 = 0; e4 < f.length; e4++) for (let i3 = 0; i3 < f[e4].length; i3++) (null === (S2 = f[e4]) || void 0 === S2 ? void 0 : S2[i3]) && (t15.draw(z + i3 * o2, B + e4 * o2, o2, ((t16, r5) => {
953
953
  var n4;
954
- return !!(null === (n4 = f[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t12]);
955
- })), t11._element && P && P.appendChild(t11._element));
954
+ return !!(null === (n4 = f[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t16]);
955
+ })), t15._element && P && P.appendChild(t15._element));
956
956
  }
957
- if (((null === (C2 = e3.cornersDotOptions) || void 0 === C2 ? void 0 : C2.gradient) || (null === (A2 = e3.cornersDotOptions) || void 0 === A2 ? void 0 : A2.color)) && (I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), I.setAttribute("id", `clip-path-corners-dot-color-${t10}-${r4}-${this._instanceId}`), this._defs.appendChild(I), this._cornersDotClipPath = I, this._createColor({ options: null === (M2 = e3.cornersDotOptions) || void 0 === M2 ? void 0 : M2.gradient, color: null === ($2 = e3.cornersDotOptions) || void 0 === $2 ? void 0 : $2.color, additionalRotation: n3, x: z + 2 * o2, y: B + 2 * o2, height: u2, width: u2, name: `corners-dot-color-${t10}-${r4}-${this._instanceId}` })), (null === (O = e3.cornersDotOptions) || void 0 === O ? void 0 : O.type) && c.includes(e3.cornersDotOptions.type)) {
958
- const t11 = new l({ svg: this._element, type: e3.cornersDotOptions.type, window: this._window });
959
- t11.draw(z + 2 * o2, B + 2 * o2, u2, n3), t11._element && I && I.appendChild(t11._element);
957
+ if (((null === (C2 = e3.cornersDotOptions) || void 0 === C2 ? void 0 : C2.gradient) || (null === (A2 = e3.cornersDotOptions) || void 0 === A2 ? void 0 : A2.color)) && (I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), I.setAttribute("id", `clip-path-corners-dot-color-${t14}-${r4}-${this._instanceId}`), this._defs.appendChild(I), this._cornersDotClipPath = I, this._createColor({ options: null === (M2 = e3.cornersDotOptions) || void 0 === M2 ? void 0 : M2.gradient, color: null === ($2 = e3.cornersDotOptions) || void 0 === $2 ? void 0 : $2.color, additionalRotation: n3, x: z + 2 * o2, y: B + 2 * o2, height: u2, width: u2, name: `corners-dot-color-${t14}-${r4}-${this._instanceId}` })), (null === (O = e3.cornersDotOptions) || void 0 === O ? void 0 : O.type) && c.includes(e3.cornersDotOptions.type)) {
958
+ const t15 = new l({ svg: this._element, type: e3.cornersDotOptions.type, window: this._window });
959
+ t15.draw(z + 2 * o2, B + 2 * o2, u2, n3), t15._element && I && I.appendChild(t15._element);
960
960
  } else {
961
- const t11 = new s({ svg: this._element, type: (null === (D = e3.cornersDotOptions) || void 0 === D ? void 0 : D.type) || e3.dotsOptions.type, window: this._window });
962
- for (let e4 = 0; e4 < w.length; e4++) for (let i3 = 0; i3 < w[e4].length; i3++) (null === (k = w[e4]) || void 0 === k ? void 0 : k[i3]) && (t11.draw(z + i3 * o2, B + e4 * o2, o2, ((t12, r5) => {
961
+ const t15 = new s({ svg: this._element, type: (null === (D = e3.cornersDotOptions) || void 0 === D ? void 0 : D.type) || e3.dotsOptions.type, window: this._window });
962
+ for (let e4 = 0; e4 < w.length; e4++) for (let i3 = 0; i3 < w[e4].length; i3++) (null === (k = w[e4]) || void 0 === k ? void 0 : k[i3]) && (t15.draw(z + i3 * o2, B + e4 * o2, o2, ((t16, r5) => {
963
963
  var n4;
964
- return !!(null === (n4 = w[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t12]);
965
- })), t11._element && I && I.appendChild(t11._element));
964
+ return !!(null === (n4 = w[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t16]);
965
+ })), t15._element && I && I.appendChild(t15._element));
966
966
  }
967
967
  }));
968
968
  }
969
969
  loadImage() {
970
- return new Promise(((t9, e3) => {
970
+ return new Promise(((t13, e3) => {
971
971
  var i2;
972
972
  const r3 = this._options;
973
973
  if (!r3.image) return e3("Image is not defined");
974
974
  if (null === (i2 = r3.nodeCanvas) || void 0 === i2 ? void 0 : i2.loadImage) r3.nodeCanvas.loadImage(r3.image).then(((e4) => {
975
975
  var i3, n2;
976
976
  if (this._image = e4, this._options.imageOptions.saveAsBlob) {
977
- const t10 = null === (i3 = r3.nodeCanvas) || void 0 === i3 ? void 0 : i3.createCanvas(this._image.width, this._image.height);
978
- null === (n2 = null == t10 ? void 0 : t10.getContext("2d")) || void 0 === n2 || n2.drawImage(e4, 0, 0), this._imageUri = null == t10 ? void 0 : t10.toDataURL();
977
+ const t14 = null === (i3 = r3.nodeCanvas) || void 0 === i3 ? void 0 : i3.createCanvas(this._image.width, this._image.height);
978
+ null === (n2 = null == t14 ? void 0 : t14.getContext("2d")) || void 0 === n2 || n2.drawImage(e4, 0, 0), this._imageUri = null == t14 ? void 0 : t14.toDataURL();
979
979
  }
980
- t9();
980
+ t13();
981
981
  })).catch(e3);
982
982
  else {
983
983
  const e4 = new this._window.Image();
984
984
  "string" == typeof r3.imageOptions.crossOrigin && (e4.crossOrigin = r3.imageOptions.crossOrigin), this._image = e4, e4.onload = async () => {
985
- this._options.imageOptions.saveAsBlob && (this._imageUri = await (async function(t10, e5) {
985
+ this._options.imageOptions.saveAsBlob && (this._imageUri = await (async function(t14, e5) {
986
986
  return new Promise(((i3) => {
987
987
  const r4 = new e5.XMLHttpRequest();
988
988
  r4.onload = function() {
989
- const t11 = new e5.FileReader();
990
- t11.onloadend = function() {
991
- i3(t11.result);
992
- }, t11.readAsDataURL(r4.response);
993
- }, r4.open("GET", t10), r4.responseType = "blob", r4.send();
989
+ const t15 = new e5.FileReader();
990
+ t15.onloadend = function() {
991
+ i3(t15.result);
992
+ }, t15.readAsDataURL(r4.response);
993
+ }, r4.open("GET", t14), r4.responseType = "blob", r4.send();
994
994
  }));
995
- })(r3.image || "", this._window)), t9();
995
+ })(r3.image || "", this._window)), t13();
996
996
  }, e4.src = r3.image;
997
997
  }
998
998
  }));
999
999
  }
1000
- async drawImage({ width: t9, height: e3, count: i2, dotSize: r3 }) {
1001
- const n2 = this._options, o2 = this._roundSize((n2.width - i2 * r3) / 2), s2 = this._roundSize((n2.height - i2 * r3) / 2), a2 = o2 + this._roundSize(n2.imageOptions.margin + (i2 * r3 - t9) / 2), h2 = s2 + this._roundSize(n2.imageOptions.margin + (i2 * r3 - e3) / 2), d2 = t9 - 2 * n2.imageOptions.margin, u2 = e3 - 2 * n2.imageOptions.margin, c2 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image");
1000
+ async drawImage({ width: t13, height: e3, count: i2, dotSize: r3 }) {
1001
+ const n2 = this._options, o2 = this._roundSize((n2.width - i2 * r3) / 2), s2 = this._roundSize((n2.height - i2 * r3) / 2), a2 = o2 + this._roundSize(n2.imageOptions.margin + (i2 * r3 - t13) / 2), h2 = s2 + this._roundSize(n2.imageOptions.margin + (i2 * r3 - e3) / 2), d2 = t13 - 2 * n2.imageOptions.margin, u2 = e3 - 2 * n2.imageOptions.margin, c2 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image");
1002
1002
  c2.setAttribute("href", this._imageUri || ""), c2.setAttribute("xlink:href", this._imageUri || ""), c2.setAttribute("x", String(a2)), c2.setAttribute("y", String(h2)), c2.setAttribute("width", `${d2}px`), c2.setAttribute("height", `${u2}px`), this._element.appendChild(c2);
1003
1003
  }
1004
- _createColor({ options: t9, color: e3, additionalRotation: i2, x: r3, y: n2, height: o2, width: s2, name: a2 }) {
1004
+ _createColor({ options: t13, color: e3, additionalRotation: i2, x: r3, y: n2, height: o2, width: s2, name: a2 }) {
1005
1005
  const h2 = s2 > o2 ? s2 : o2, d2 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
1006
- if (d2.setAttribute("x", String(r3)), d2.setAttribute("y", String(n2)), d2.setAttribute("height", String(o2)), d2.setAttribute("width", String(s2)), d2.setAttribute("clip-path", `url('#clip-path-${a2}')`), t9) {
1006
+ if (d2.setAttribute("x", String(r3)), d2.setAttribute("y", String(n2)), d2.setAttribute("height", String(o2)), d2.setAttribute("width", String(s2)), d2.setAttribute("clip-path", `url('#clip-path-${a2}')`), t13) {
1007
1007
  let e4;
1008
- if ("radial" === t9.type) e4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), e4.setAttribute("id", a2), e4.setAttribute("gradientUnits", "userSpaceOnUse"), e4.setAttribute("fx", String(r3 + s2 / 2)), e4.setAttribute("fy", String(n2 + o2 / 2)), e4.setAttribute("cx", String(r3 + s2 / 2)), e4.setAttribute("cy", String(n2 + o2 / 2)), e4.setAttribute("r", String(h2 / 2));
1008
+ if ("radial" === t13.type) e4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), e4.setAttribute("id", a2), e4.setAttribute("gradientUnits", "userSpaceOnUse"), e4.setAttribute("fx", String(r3 + s2 / 2)), e4.setAttribute("fy", String(n2 + o2 / 2)), e4.setAttribute("cx", String(r3 + s2 / 2)), e4.setAttribute("cy", String(n2 + o2 / 2)), e4.setAttribute("r", String(h2 / 2));
1009
1009
  else {
1010
- const h3 = ((t9.rotation || 0) + i2) % (2 * Math.PI), d3 = (h3 + 2 * Math.PI) % (2 * Math.PI);
1010
+ const h3 = ((t13.rotation || 0) + i2) % (2 * Math.PI), d3 = (h3 + 2 * Math.PI) % (2 * Math.PI);
1011
1011
  let u2 = r3 + s2 / 2, c2 = n2 + o2 / 2, l2 = r3 + s2 / 2, g2 = n2 + o2 / 2;
1012
1012
  d3 >= 0 && d3 <= 0.25 * Math.PI || d3 > 1.75 * Math.PI && d3 <= 2 * Math.PI ? (u2 -= s2 / 2, c2 -= o2 / 2 * Math.tan(h3), l2 += s2 / 2, g2 += o2 / 2 * Math.tan(h3)) : d3 > 0.25 * Math.PI && d3 <= 0.75 * Math.PI ? (c2 -= o2 / 2, u2 -= s2 / 2 / Math.tan(h3), g2 += o2 / 2, l2 += s2 / 2 / Math.tan(h3)) : d3 > 0.75 * Math.PI && d3 <= 1.25 * Math.PI ? (u2 += s2 / 2, c2 += o2 / 2 * Math.tan(h3), l2 -= s2 / 2, g2 -= o2 / 2 * Math.tan(h3)) : d3 > 1.25 * Math.PI && d3 <= 1.75 * Math.PI && (c2 += o2 / 2, u2 += s2 / 2 / Math.tan(h3), g2 -= o2 / 2, l2 -= s2 / 2 / Math.tan(h3)), e4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"), e4.setAttribute("id", a2), e4.setAttribute("gradientUnits", "userSpaceOnUse"), e4.setAttribute("x1", String(Math.round(u2))), e4.setAttribute("y1", String(Math.round(c2))), e4.setAttribute("x2", String(Math.round(l2))), e4.setAttribute("y2", String(Math.round(g2)));
1013
1013
  }
1014
- t9.colorStops.forEach((({ offset: t10, color: i3 }) => {
1014
+ t13.colorStops.forEach((({ offset: t14, color: i3 }) => {
1015
1015
  const r4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "stop");
1016
- r4.setAttribute("offset", 100 * t10 + "%"), r4.setAttribute("stop-color", i3), e4.appendChild(r4);
1016
+ r4.setAttribute("offset", 100 * t14 + "%"), r4.setAttribute("stop-color", i3), e4.appendChild(r4);
1017
1017
  })), d2.setAttribute("fill", `url('#${a2}')`), this._defs.appendChild(e4);
1018
1018
  } else e3 && d2.setAttribute("fill", e3);
1019
1019
  this._element.appendChild(d2);
@@ -1021,119 +1021,119 @@ var require_qr_code_styling = __commonJS({
1021
1021
  }
1022
1022
  p.instanceCount = 0;
1023
1023
  const v = p, _ = "canvas", m = {};
1024
- for (let t9 = 0; t9 <= 40; t9++) m[t9] = t9;
1024
+ for (let t13 = 0; t13 <= 40; t13++) m[t13] = t13;
1025
1025
  const b = { type: _, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: m[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: true, hideBackgroundDots: true, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: true }, backgroundOptions: { round: 0, color: "#fff" } };
1026
- function y(t9) {
1027
- const e3 = Object.assign({}, t9);
1026
+ function y(t13) {
1027
+ const e3 = Object.assign({}, t13);
1028
1028
  if (!e3.colorStops || !e3.colorStops.length) throw "Field 'colorStops' is required in gradient";
1029
- return e3.rotation ? e3.rotation = Number(e3.rotation) : e3.rotation = 0, e3.colorStops = e3.colorStops.map(((t10) => Object.assign(Object.assign({}, t10), { offset: Number(t10.offset) }))), e3;
1029
+ return e3.rotation ? e3.rotation = Number(e3.rotation) : e3.rotation = 0, e3.colorStops = e3.colorStops.map(((t14) => Object.assign(Object.assign({}, t14), { offset: Number(t14.offset) }))), e3;
1030
1030
  }
1031
- function x(t9) {
1032
- const e3 = Object.assign({}, t9);
1031
+ function x(t13) {
1032
+ const e3 = Object.assign({}, t13);
1033
1033
  return e3.width = Number(e3.width), e3.height = Number(e3.height), e3.margin = Number(e3.margin), e3.imageOptions = Object.assign(Object.assign({}, e3.imageOptions), { hideBackgroundDots: Boolean(e3.imageOptions.hideBackgroundDots), imageSize: Number(e3.imageOptions.imageSize), margin: Number(e3.imageOptions.margin) }), e3.margin > Math.min(e3.width, e3.height) && (e3.margin = Math.min(e3.width, e3.height)), e3.dotsOptions = Object.assign({}, e3.dotsOptions), e3.dotsOptions.gradient && (e3.dotsOptions.gradient = y(e3.dotsOptions.gradient)), e3.cornersSquareOptions && (e3.cornersSquareOptions = Object.assign({}, e3.cornersSquareOptions), e3.cornersSquareOptions.gradient && (e3.cornersSquareOptions.gradient = y(e3.cornersSquareOptions.gradient))), e3.cornersDotOptions && (e3.cornersDotOptions = Object.assign({}, e3.cornersDotOptions), e3.cornersDotOptions.gradient && (e3.cornersDotOptions.gradient = y(e3.cornersDotOptions.gradient))), e3.backgroundOptions && (e3.backgroundOptions = Object.assign({}, e3.backgroundOptions), e3.backgroundOptions.gradient && (e3.backgroundOptions.gradient = y(e3.backgroundOptions.gradient))), e3;
1034
1034
  }
1035
1035
  var S = i(873), C = i.n(S);
1036
- function A(t9) {
1037
- if (!t9) throw new Error("Extension must be defined");
1038
- "." === t9[0] && (t9 = t9.substring(1));
1039
- const e3 = { 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" }[t9.toLowerCase()];
1040
- if (!e3) throw new Error(`Extension "${t9}" is not supported`);
1036
+ function A(t13) {
1037
+ if (!t13) throw new Error("Extension must be defined");
1038
+ "." === t13[0] && (t13 = t13.substring(1));
1039
+ const e3 = { 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" }[t13.toLowerCase()];
1040
+ if (!e3) throw new Error(`Extension "${t13}" is not supported`);
1041
1041
  return e3;
1042
1042
  }
1043
1043
  class M {
1044
- constructor(t9) {
1045
- (null == t9 ? void 0 : t9.jsdom) ? this._window = new t9.jsdom("", { resources: "usable" }).window : this._window = window, this._options = t9 ? x(e2(b, t9)) : b, this.update();
1044
+ constructor(t13) {
1045
+ (null == t13 ? void 0 : t13.jsdom) ? this._window = new t13.jsdom("", { resources: "usable" }).window : this._window = window, this._options = t13 ? x(e2(b, t13)) : b, this.update();
1046
1046
  }
1047
- static _clearContainer(t9) {
1048
- t9 && (t9.innerHTML = "");
1047
+ static _clearContainer(t13) {
1048
+ t13 && (t13.innerHTML = "");
1049
1049
  }
1050
1050
  _setupSvg() {
1051
1051
  if (!this._qr) return;
1052
- const t9 = new v(this._options, this._window);
1053
- this._svg = t9.getElement(), this._svgDrawingPromise = t9.drawQR(this._qr).then((() => {
1052
+ const t13 = new v(this._options, this._window);
1053
+ this._svg = t13.getElement(), this._svgDrawingPromise = t13.drawQR(this._qr).then((() => {
1054
1054
  var e3;
1055
- this._svg && (null === (e3 = this._extension) || void 0 === e3 || e3.call(this, t9.getElement(), this._options));
1055
+ this._svg && (null === (e3 = this._extension) || void 0 === e3 || e3.call(this, t13.getElement(), this._options));
1056
1056
  }));
1057
1057
  }
1058
1058
  _setupCanvas() {
1059
- var t9, e3;
1060
- this._qr && ((null === (t9 = this._options.nodeCanvas) || void 0 === t9 ? void 0 : t9.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 = null === (e3 = this._svgDrawingPromise) || void 0 === e3 ? void 0 : e3.then((() => {
1061
- var t10;
1059
+ var t13, e3;
1060
+ this._qr && ((null === (t13 = this._options.nodeCanvas) || void 0 === t13 ? void 0 : t13.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 = null === (e3 = this._svgDrawingPromise) || void 0 === e3 ? void 0 : e3.then((() => {
1061
+ var t14;
1062
1062
  if (!this._svg) return;
1063
1063
  const e4 = this._svg, i2 = new this._window.XMLSerializer().serializeToString(e4), r3 = btoa(i2), n2 = `data:${A("svg")};base64,${r3}`;
1064
- if (null === (t10 = this._options.nodeCanvas) || void 0 === t10 ? void 0 : t10.loadImage) return this._options.nodeCanvas.loadImage(n2).then(((t11) => {
1064
+ if (null === (t14 = this._options.nodeCanvas) || void 0 === t14 ? void 0 : t14.loadImage) return this._options.nodeCanvas.loadImage(n2).then(((t15) => {
1065
1065
  var e5, i3;
1066
- t11.width = this._options.width, t11.height = this._options.height, null === (i3 = null === (e5 = this._nodeCanvas) || void 0 === e5 ? void 0 : e5.getContext("2d")) || void 0 === i3 || i3.drawImage(t11, 0, 0);
1066
+ t15.width = this._options.width, t15.height = this._options.height, null === (i3 = null === (e5 = this._nodeCanvas) || void 0 === e5 ? void 0 : e5.getContext("2d")) || void 0 === i3 || i3.drawImage(t15, 0, 0);
1067
1067
  }));
1068
1068
  {
1069
- const t11 = new this._window.Image();
1069
+ const t15 = new this._window.Image();
1070
1070
  return new Promise(((e5) => {
1071
- t11.onload = () => {
1071
+ t15.onload = () => {
1072
1072
  var i3, r4;
1073
- null === (r4 = null === (i3 = this._domCanvas) || void 0 === i3 ? void 0 : i3.getContext("2d")) || void 0 === r4 || r4.drawImage(t11, 0, 0), e5();
1074
- }, t11.src = n2;
1073
+ null === (r4 = null === (i3 = this._domCanvas) || void 0 === i3 ? void 0 : i3.getContext("2d")) || void 0 === r4 || r4.drawImage(t15, 0, 0), e5();
1074
+ }, t15.src = n2;
1075
1075
  }));
1076
1076
  }
1077
1077
  })));
1078
1078
  }
1079
- async _getElement(t9 = "png") {
1079
+ async _getElement(t13 = "png") {
1080
1080
  if (!this._qr) throw "QR code is empty";
1081
- return "svg" === t9.toLowerCase() ? (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);
1081
+ return "svg" === t13.toLowerCase() ? (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);
1082
1082
  }
1083
- update(t9) {
1084
- M._clearContainer(this._container), this._options = t9 ? x(e2(this._options, t9)) : this._options, this._options.data && (this._qr = C()(this._options.qrOptions.typeNumber, this._options.qrOptions.errorCorrectionLevel), this._qr.addData(this._options.data, this._options.qrOptions.mode || (function(t10) {
1083
+ update(t13) {
1084
+ M._clearContainer(this._container), this._options = t13 ? x(e2(this._options, t13)) : this._options, this._options.data && (this._qr = C()(this._options.qrOptions.typeNumber, this._options.qrOptions.errorCorrectionLevel), this._qr.addData(this._options.data, this._options.qrOptions.mode || (function(t14) {
1085
1085
  switch (true) {
1086
- case /^[0-9]*$/.test(t10):
1086
+ case /^[0-9]*$/.test(t14):
1087
1087
  return "Numeric";
1088
- case /^[0-9A-Z $%*+\-./:]*$/.test(t10):
1088
+ case /^[0-9A-Z $%*+\-./:]*$/.test(t14):
1089
1089
  return "Alphanumeric";
1090
1090
  default:
1091
1091
  return "Byte";
1092
1092
  }
1093
1093
  })(this._options.data)), this._qr.make(), this._options.type === _ ? this._setupCanvas() : this._setupSvg(), this.append(this._container));
1094
1094
  }
1095
- append(t9) {
1096
- if (t9) {
1097
- if ("function" != typeof t9.appendChild) throw "Container should be a single DOM node";
1098
- this._options.type === _ ? this._domCanvas && t9.appendChild(this._domCanvas) : this._svg && t9.appendChild(this._svg), this._container = t9;
1095
+ append(t13) {
1096
+ if (t13) {
1097
+ if ("function" != typeof t13.appendChild) throw "Container should be a single DOM node";
1098
+ this._options.type === _ ? this._domCanvas && t13.appendChild(this._domCanvas) : this._svg && t13.appendChild(this._svg), this._container = t13;
1099
1099
  }
1100
1100
  }
1101
- applyExtension(t9) {
1102
- if (!t9) throw "Extension function should be defined.";
1103
- this._extension = t9, this.update();
1101
+ applyExtension(t13) {
1102
+ if (!t13) throw "Extension function should be defined.";
1103
+ this._extension = t13, this.update();
1104
1104
  }
1105
1105
  deleteExtension() {
1106
1106
  this._extension = void 0, this.update();
1107
1107
  }
1108
- async getRawData(t9 = "png") {
1108
+ async getRawData(t13 = "png") {
1109
1109
  if (!this._qr) throw "QR code is empty";
1110
- const e3 = await this._getElement(t9), i2 = A(t9);
1110
+ const e3 = await this._getElement(t13), i2 = A(t13);
1111
1111
  if (!e3) return null;
1112
- if ("svg" === t9.toLowerCase()) {
1113
- const t10 = `<?xml version="1.0" standalone="no"?>\r
1112
+ if ("svg" === t13.toLowerCase()) {
1113
+ const t14 = `<?xml version="1.0" standalone="no"?>\r
1114
1114
  ${new this._window.XMLSerializer().serializeToString(e3)}`;
1115
- return "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(t10) : new Blob([t10], { type: i2 });
1115
+ return "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(t14) : new Blob([t14], { type: i2 });
1116
1116
  }
1117
- return new Promise(((t10) => {
1117
+ return new Promise(((t14) => {
1118
1118
  const r3 = e3;
1119
- if ("toBuffer" in r3) if ("image/png" === i2) t10(r3.toBuffer(i2));
1120
- else if ("image/jpeg" === i2) t10(r3.toBuffer(i2));
1119
+ if ("toBuffer" in r3) if ("image/png" === i2) t14(r3.toBuffer(i2));
1120
+ else if ("image/jpeg" === i2) t14(r3.toBuffer(i2));
1121
1121
  else {
1122
1122
  if ("application/pdf" !== i2) throw Error("Unsupported extension");
1123
- t10(r3.toBuffer(i2));
1123
+ t14(r3.toBuffer(i2));
1124
1124
  }
1125
- else "toBlob" in r3 && r3.toBlob(t10, i2, 1);
1125
+ else "toBlob" in r3 && r3.toBlob(t14, i2, 1);
1126
1126
  }));
1127
1127
  }
1128
- async download(t9) {
1128
+ async download(t13) {
1129
1129
  if (!this._qr) throw "QR code is empty";
1130
1130
  if ("undefined" == typeof Blob) throw "Cannot download in Node.js, call getRawData instead.";
1131
1131
  let e3 = "png", i2 = "qr";
1132
- "string" == typeof t9 ? (e3 = t9, console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")) : "object" == typeof t9 && null !== t9 && (t9.name && (i2 = t9.name), t9.extension && (e3 = t9.extension));
1132
+ "string" == typeof t13 ? (e3 = t13, console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")) : "object" == typeof t13 && null !== t13 && (t13.name && (i2 = t13.name), t13.extension && (e3 = t13.extension));
1133
1133
  const r3 = await this._getElement(e3);
1134
1134
  if (r3) if ("svg" === e3.toLowerCase()) {
1135
- let t10 = new XMLSerializer().serializeToString(r3);
1136
- t10 = '<?xml version="1.0" standalone="no"?>\r\n' + t10, n(`data:${A(e3)};charset=utf-8,${encodeURIComponent(t10)}`, `${i2}.svg`);
1135
+ let t14 = new XMLSerializer().serializeToString(r3);
1136
+ t14 = '<?xml version="1.0" standalone="no"?>\r\n' + t14, n(`data:${A(e3)};charset=utf-8,${encodeURIComponent(t14)}`, `${i2}.svg`);
1137
1137
  } else n(r3.toDataURL(A(e3)), `${i2}.${e3}`);
1138
1138
  }
1139
1139
  }
@@ -1145,7 +1145,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
1145
1145
 
1146
1146
  // src/provider.tsx
1147
1147
  import React38, {
1148
- useState as useState28,
1148
+ useState as useState33,
1149
1149
  useCallback as useCallback12,
1150
1150
  useMemo as useMemo15,
1151
1151
  useEffect as useEffect29
@@ -1219,11 +1219,11 @@ function useUnifold() {
1219
1219
 
1220
1220
  // ../ui-react/dist/index.mjs
1221
1221
  import {
1222
- useState as useState26,
1223
- useEffect as useEffect20,
1222
+ useState as useState27,
1223
+ useEffect as useEffect21,
1224
1224
  useLayoutEffect as useLayoutEffect22,
1225
1225
  useCallback as useCallback42,
1226
- useRef as useRef52,
1226
+ useRef as useRef62,
1227
1227
  useMemo as useMemo92
1228
1228
  } from "react";
1229
1229
 
@@ -1312,6 +1312,14 @@ var ArrowLeft = createLucideIcon("ArrowLeft", [
1312
1312
  ["path", { d: "M19 12H5", key: "x3x0zl" }]
1313
1313
  ]);
1314
1314
 
1315
+ // ../../node_modules/.pnpm/lucide-react@0.454.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/arrow-up-down.js
1316
+ var ArrowUpDown = createLucideIcon("ArrowUpDown", [
1317
+ ["path", { d: "m21 16-4 4-4-4", key: "f6ql7i" }],
1318
+ ["path", { d: "M17 20V4", key: "1ejh1v" }],
1319
+ ["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
1320
+ ["path", { d: "M7 4v16", key: "1glfcx" }]
1321
+ ]);
1322
+
1315
1323
  // ../../node_modules/.pnpm/lucide-react@0.454.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/check.js
1316
1324
  var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
1317
1325
 
@@ -1334,6 +1342,22 @@ var CircleCheck = createLucideIcon("CircleCheck", [
1334
1342
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
1335
1343
  ]);
1336
1344
 
1345
+ // ../../node_modules/.pnpm/lucide-react@0.454.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/clipboard-paste.js
1346
+ var ClipboardPaste = createLucideIcon("ClipboardPaste", [
1347
+ [
1348
+ "path",
1349
+ { d: "M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z", key: "1pp7kr" }
1350
+ ],
1351
+ [
1352
+ "path",
1353
+ {
1354
+ d: "M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",
1355
+ key: "2ik1ml"
1356
+ }
1357
+ ],
1358
+ ["path", { d: "m17 10 4 4-4 4", key: "vp2hj1" }]
1359
+ ]);
1360
+
1337
1361
  // ../../node_modules/.pnpm/lucide-react@0.454.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/clock.js
1338
1362
  var Clock = createLucideIcon("Clock", [
1339
1363
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
@@ -2420,25 +2444,25 @@ function createFocusGuard() {
2420
2444
 
2421
2445
  // ../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
2422
2446
  var __assign = function() {
2423
- __assign = Object.assign || function __assign2(t7) {
2447
+ __assign = Object.assign || function __assign2(t11) {
2424
2448
  for (var s, i = 1, n = arguments.length; i < n; i++) {
2425
2449
  s = arguments[i];
2426
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t7[p] = s[p];
2450
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t11[p] = s[p];
2427
2451
  }
2428
- return t7;
2452
+ return t11;
2429
2453
  };
2430
2454
  return __assign.apply(this, arguments);
2431
2455
  };
2432
2456
  function __rest(s, e) {
2433
- var t7 = {};
2457
+ var t11 = {};
2434
2458
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2435
- t7[p] = s[p];
2459
+ t11[p] = s[p];
2436
2460
  if (s != null && typeof Object.getOwnPropertySymbols === "function")
2437
2461
  for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2438
2462
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
2439
- t7[p[i]] = s[p[i]];
2463
+ t11[p[i]] = s[p[i]];
2440
2464
  }
2441
- return t7;
2465
+ return t11;
2442
2466
  }
2443
2467
  function __spreadArray(to, from, pack) {
2444
2468
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
@@ -3565,16 +3589,16 @@ var Close = DialogClose;
3565
3589
 
3566
3590
  // ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
3567
3591
  function r(e) {
3568
- var t7, f, n = "";
3592
+ var t11, f, n = "";
3569
3593
  if ("string" == typeof e || "number" == typeof e) n += e;
3570
3594
  else if ("object" == typeof e) if (Array.isArray(e)) {
3571
3595
  var o = e.length;
3572
- for (t7 = 0; t7 < o; t7++) e[t7] && (f = r(e[t7])) && (n && (n += " "), n += f);
3596
+ for (t11 = 0; t11 < o; t11++) e[t11] && (f = r(e[t11])) && (n && (n += " "), n += f);
3573
3597
  } else for (f in e) e[f] && (n && (n += " "), n += f);
3574
3598
  return n;
3575
3599
  }
3576
3600
  function clsx() {
3577
- for (var e, t7, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t7 = r(e)) && (n && (n += " "), n += t7);
3601
+ for (var e, t11, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t11 = r(e)) && (n && (n += " "), n += t11);
3578
3602
  return n;
3579
3603
  }
3580
3604
 
@@ -6099,6 +6123,11 @@ function getIconUrlWithCdn(iconPath, assetCdnUrl) {
6099
6123
  const baseUrl = assetCdnUrl.endsWith("/") ? assetCdnUrl.slice(0, -1) : assetCdnUrl;
6100
6124
  return `${baseUrl}/api/public${normalizedPath}`;
6101
6125
  }
6126
+ var ActionType = /* @__PURE__ */ ((ActionType2) => {
6127
+ ActionType2["Deposit"] = "deposit";
6128
+ ActionType2["Withdraw"] = "withdraw";
6129
+ return ActionType2;
6130
+ })(ActionType || {});
6102
6131
  async function createDepositAddress(overrides, publishableKey) {
6103
6132
  if (!overrides?.external_user_id) {
6104
6133
  throw new Error("external_user_id is required");
@@ -6109,6 +6138,7 @@ async function createDepositAddress(overrides, publishableKey) {
6109
6138
  destination_chain_id: overrides?.destination_chain_id || DEFAULT_CONFIG.destinationChainId || "8453",
6110
6139
  destination_token_address: overrides?.destination_token_address || DEFAULT_CONFIG.destinationTokenAddress || "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
6111
6140
  recipient_address: overrides?.recipient_address || DEFAULT_CONFIG.recipientAddress || "0x309a4154a2CD4153Da886E780890C9cb5161553C",
6141
+ ...overrides?.action_type ? { action_type: overrides.action_type } : {},
6112
6142
  client_metadata: overrides?.client_metadata || {}
6113
6143
  };
6114
6144
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
@@ -6140,9 +6170,13 @@ var ExecutionStatus = /* @__PURE__ */ ((ExecutionStatus2) => {
6140
6170
  return ExecutionStatus2;
6141
6171
  })(ExecutionStatus || {});
6142
6172
  var SOLANA_USDC_ADDRESS = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
6143
- async function queryExecutions(externalUserId, publishableKey) {
6173
+ async function queryExecutions(externalUserId, publishableKey, actionType) {
6144
6174
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
6145
6175
  validatePublishableKey(pk);
6176
+ const body = {
6177
+ external_user_id: externalUserId,
6178
+ ...actionType ? { action_type: actionType } : {}
6179
+ };
6146
6180
  const response = await fetch(
6147
6181
  `${API_BASE_URL}/v1/public/direct_executions/query`,
6148
6182
  {
@@ -6152,9 +6186,7 @@ async function queryExecutions(externalUserId, publishableKey) {
6152
6186
  "x-publishable-key": pk,
6153
6187
  "Content-Type": "application/json"
6154
6188
  },
6155
- body: JSON.stringify({
6156
- external_user_id: externalUserId
6157
- })
6189
+ body: JSON.stringify(body)
6158
6190
  }
6159
6191
  );
6160
6192
  if (!response.ok) {
@@ -6182,6 +6214,26 @@ async function pollDirectExecutions(request, publishableKey) {
6182
6214
  }
6183
6215
  return response.json();
6184
6216
  }
6217
+ async function getSupportedDestinationTokens(publishableKey) {
6218
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
6219
+ validatePublishableKey(pk);
6220
+ const response = await fetch(
6221
+ `${API_BASE_URL}/v1/public/tokens/supported_destination_tokens`,
6222
+ {
6223
+ method: "GET",
6224
+ headers: {
6225
+ accept: "application/json",
6226
+ "x-publishable-key": pk
6227
+ }
6228
+ }
6229
+ );
6230
+ if (!response.ok) {
6231
+ throw new Error(
6232
+ `Failed to fetch supported destination tokens: ${response.statusText}`
6233
+ );
6234
+ }
6235
+ return response.json();
6236
+ }
6185
6237
  async function getSupportedDepositTokens(publishableKey, options) {
6186
6238
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
6187
6239
  validatePublishableKey(pk);
@@ -6640,6 +6692,32 @@ var en_default = {
6640
6692
  youReceive: "You receive",
6641
6693
  intentAddressNote: "The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."
6642
6694
  }
6695
+ },
6696
+ withdrawModal: {
6697
+ title: "Withdraw",
6698
+ withdrawCrypto: {
6699
+ title: "Withdraw with Crypto",
6700
+ subtitle: "Send to any wallet address"
6701
+ },
6702
+ selectToken: "Select withdrawal token",
6703
+ receiveToken: "Receive token",
6704
+ receiveChain: "Receive chain",
6705
+ recipientAddress: "Recipient address",
6706
+ recipientAddressPlaceholder: "Enter wallet address",
6707
+ amount: "Amount",
6708
+ amountPlaceholder: "0.00",
6709
+ balance: "Balance",
6710
+ minimum: "min",
6711
+ withdraw: "Withdraw",
6712
+ invalidAddress: "Please enter a valid address",
6713
+ invalidAmount: "Please enter a valid amount",
6714
+ verifyingAddress: "Verifying address...",
6715
+ loading: "Loading...",
6716
+ noTokensAvailable: "No tokens available",
6717
+ sourceToken: "Source token",
6718
+ review: "Review",
6719
+ confirm: "Confirm Withdrawal",
6720
+ back: "Back"
6643
6721
  }
6644
6722
  };
6645
6723
  var i18n = en_default;
@@ -6854,7 +6932,7 @@ import { useQuery as useQuery5 } from "@tanstack/react-query";
6854
6932
  import { useQuery as useQuery6 } from "@tanstack/react-query";
6855
6933
  import { useQuery as useQuery7 } from "@tanstack/react-query";
6856
6934
  import { useQuery as useQuery8 } from "@tanstack/react-query";
6857
- import { useState as useState212, useEffect as useEffect162, useMemo as useMemo52 } from "react";
6935
+ import { useState as useState222, useEffect as useEffect172, useMemo as useMemo52 } from "react";
6858
6936
  var import_qr_code_styling = __toESM(require_qr_code_styling(), 1);
6859
6937
  import { useEffect as useEffect122, useRef as useRef42 } from "react";
6860
6938
  import { jsx as jsx322 } from "react/jsx-runtime";
@@ -6866,9 +6944,10 @@ import { Fragment as Fragment32, jsx as jsx35, jsxs as jsxs30 } from "react/jsx-
6866
6944
  import { useState as useState182, useMemo as useMemo42, useEffect as useEffect152 } from "react";
6867
6945
  import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
6868
6946
  import { jsx as jsx37, jsxs as jsxs322 } from "react/jsx-runtime";
6947
+ import { useState as useState192, useEffect as useEffect162, useRef as useRef52 } from "react";
6869
6948
  import { jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
6870
6949
  import { jsx as jsx39, jsxs as jsxs34 } from "react/jsx-runtime";
6871
- import { useState as useState192 } from "react";
6950
+ import { useState as useState202 } from "react";
6872
6951
  import * as React242 from "react";
6873
6952
 
6874
6953
  // ../../node_modules/.pnpm/@radix-ui+react-tooltip@1.2.8_@types+react-dom@19.2.3_@types+react@19.2.9__@types+react@19.2._aqltx4jspgwttwvtzmq3z5uagy/node_modules/@radix-ui/react-tooltip/dist/index.mjs
@@ -9608,7 +9687,7 @@ var Content22 = TooltipContent;
9608
9687
  // ../ui-react/dist/index.mjs
9609
9688
  import { jsx as jsx40 } from "react/jsx-runtime";
9610
9689
  import { Fragment as Fragment42, jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
9611
- import { useState as useState222, useEffect as useEffect172, useMemo as useMemo62 } from "react";
9690
+ import { useState as useState232, useEffect as useEffect182, useMemo as useMemo62 } from "react";
9612
9691
  import * as React252 from "react";
9613
9692
 
9614
9693
  // ../../node_modules/.pnpm/@radix-ui+react-select@2.2.6_@types+react-dom@19.2.3_@types+react@19.2.9__@types+react@19.2.9_5n4syhs66qrtkkphe44qzgdimq/node_modules/@radix-ui/react-select/dist/index.mjs
@@ -10851,12 +10930,34 @@ import { jsx as jsx44 } from "react/jsx-runtime";
10851
10930
  import { jsx as jsx45, jsxs as jsxs38 } from "react/jsx-runtime";
10852
10931
  import { Fragment as Fragment52, jsx as jsx46, jsxs as jsxs39 } from "react/jsx-runtime";
10853
10932
  import { Fragment as Fragment62, jsx as jsx47, jsxs as jsxs40 } from "react/jsx-runtime";
10854
- import { useCallback as useCallback22, useState as useState232 } from "react";
10933
+ import { useCallback as useCallback22, useState as useState242 } from "react";
10855
10934
  import { Fragment as Fragment72, jsx as jsx48, jsxs as jsxs41 } from "react/jsx-runtime";
10856
10935
  import { Fragment as Fragment82, jsx as jsx49, jsxs as jsxs422 } from "react/jsx-runtime";
10857
10936
  import * as React272 from "react";
10858
10937
  import { jsx as jsx50, jsxs as jsxs43 } from "react/jsx-runtime";
10859
10938
  import { Fragment as Fragment9, jsx as jsx51, jsxs as jsxs44 } from "react/jsx-runtime";
10939
+ import {
10940
+ useState as useState31,
10941
+ useEffect as useEffect252,
10942
+ useLayoutEffect as useLayoutEffect32,
10943
+ useCallback as useCallback62,
10944
+ useRef as useRef82
10945
+ } from "react";
10946
+ import { useQuery as useQuery9 } from "@tanstack/react-query";
10947
+ import { useQuery as useQuery10 } from "@tanstack/react-query";
10948
+ import { useQuery as useQuery11 } from "@tanstack/react-query";
10949
+ import { useQuery as useQuery12 } from "@tanstack/react-query";
10950
+ import { useState as useState28, useEffect as useEffect222, useRef as useRef72 } from "react";
10951
+ import { jsx as jsx522, jsxs as jsxs45 } from "react/jsx-runtime";
10952
+ import { useState as useState29, useCallback as useCallback52, useMemo as useMemo102, useEffect as useEffect232 } from "react";
10953
+ import { useQuery as useQuery13 } from "@tanstack/react-query";
10954
+ import { Fragment as Fragment10, jsx as jsx53, jsxs as jsxs46 } from "react/jsx-runtime";
10955
+ import { jsx as jsx54, jsxs as jsxs47 } from "react/jsx-runtime";
10956
+ import { useState as useState30, useEffect as useEffect242 } from "react";
10957
+ import { Fragment as Fragment11, jsx as jsx55, jsxs as jsxs48 } from "react/jsx-runtime";
10958
+ import { Fragment as Fragment12, jsx as jsx56, jsxs as jsxs49 } from "react/jsx-runtime";
10959
+ import { useState as useState32, useMemo as useMemo112 } from "react";
10960
+ import { jsx as jsx57, jsxs as jsxs50 } from "react/jsx-runtime";
10860
10961
  function cn(...inputs) {
10861
10962
  return twMerge(clsx(inputs));
10862
10963
  }
@@ -11422,6 +11523,7 @@ function useDepositAddress(params) {
11422
11523
  destinationChainType,
11423
11524
  destinationChainId,
11424
11525
  destinationTokenAddress,
11526
+ actionType,
11425
11527
  enabled = true
11426
11528
  } = params;
11427
11529
  return useQuery2({
@@ -11433,6 +11535,7 @@ function useDepositAddress(params) {
11433
11535
  destinationChainType ?? null,
11434
11536
  destinationChainId ?? null,
11435
11537
  destinationTokenAddress ?? null,
11538
+ actionType ?? null,
11436
11539
  publishableKey
11437
11540
  ],
11438
11541
  queryFn: () => createDepositAddress(
@@ -11441,7 +11544,8 @@ function useDepositAddress(params) {
11441
11544
  recipient_address: recipientAddress,
11442
11545
  destination_chain_type: destinationChainType,
11443
11546
  destination_chain_id: destinationChainId,
11444
- destination_token_address: destinationTokenAddress
11547
+ destination_token_address: destinationTokenAddress,
11548
+ action_type: actionType
11445
11549
  },
11446
11550
  publishableKey
11447
11551
  ),
@@ -12123,6 +12227,30 @@ var en_default2 = {
12123
12227
  youReceive: "You receive",
12124
12228
  intentAddressNote: "The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."
12125
12229
  }
12230
+ },
12231
+ withdrawModal: {
12232
+ title: "Withdraw",
12233
+ withdrawCrypto: {
12234
+ title: "Withdraw with Crypto",
12235
+ subtitle: "Send to any wallet address"
12236
+ },
12237
+ selectToken: "Select withdrawal token",
12238
+ receiveToken: "Receive token",
12239
+ receiveChain: "Receive chain",
12240
+ recipientAddress: "Recipient address",
12241
+ recipientAddressPlaceholder: "Enter wallet address",
12242
+ amount: "Amount",
12243
+ amountPlaceholder: "0.00",
12244
+ balance: "Balance",
12245
+ minimum: "min",
12246
+ withdraw: "Withdraw",
12247
+ invalidAddress: "Please enter a valid address",
12248
+ invalidAmount: "Please enter a valid amount",
12249
+ verifyingAddress: "Verifying address...",
12250
+ loading: "Loading...",
12251
+ noTokensAvailable: "No tokens available",
12252
+ review: "Review Withdrawal",
12253
+ back: "Back"
12126
12254
  }
12127
12255
  };
12128
12256
  var i18n2 = en_default2;
@@ -12201,7 +12329,7 @@ function useDepositPolling({
12201
12329
  const modalOpenedAt = modalOpenedAtRef.current;
12202
12330
  const poll = async () => {
12203
12331
  try {
12204
- const response = await queryExecutions(userId, publishableKey);
12332
+ const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
12205
12333
  const cutoff = new Date(modalOpenedAt.getTime() - CUTOFF_BUFFER_MS);
12206
12334
  const sortedExecutions = [...response.data].sort((a, b) => {
12207
12335
  const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
@@ -12323,7 +12451,8 @@ function formatCurrency(currency) {
12323
12451
  }
12324
12452
  function DepositDetailContent({
12325
12453
  execution,
12326
- className
12454
+ className,
12455
+ variant = "deposit"
12327
12456
  }) {
12328
12457
  const { colors: colors2, fonts, components } = useTheme();
12329
12458
  const [chains, setChains] = useState62([]);
@@ -12729,7 +12858,7 @@ function DepositDetailContent({
12729
12858
  color: components.card.rowLeftLabel,
12730
12859
  fontFamily: fonts.regular
12731
12860
  },
12732
- children: "Deposit Tx"
12861
+ children: variant === "withdraw" ? "Withdrawal Tx" : "Deposit Tx"
12733
12862
  }
12734
12863
  ),
12735
12864
  /* @__PURE__ */ jsx72(
@@ -17855,7 +17984,7 @@ function DepositsModal({
17855
17984
  if (!open || !userId) return;
17856
17985
  const fetchExecutions = async () => {
17857
17986
  try {
17858
- const response = await queryExecutions(userId, publishableKey);
17987
+ const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
17859
17988
  const sorted = [...response.data].sort((a, b) => {
17860
17989
  const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
17861
17990
  const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
@@ -17972,7 +18101,7 @@ function saveRecentToken(token) {
17972
18101
  try {
17973
18102
  const recent = getRecentTokens();
17974
18103
  const filtered = recent.filter(
17975
- (t7) => !(t7.symbol === token.symbol && t7.chainType === token.chainType && t7.chainId === token.chainId)
18104
+ (t11) => !(t11.symbol === token.symbol && t11.chainType === token.chainType && t11.chainId === token.chainId)
17976
18105
  );
17977
18106
  filtered.unshift(token);
17978
18107
  const trimmed = filtered.slice(0, MAX_RECENT_TOKENS);
@@ -17985,7 +18114,7 @@ function removeRecentToken(token) {
17985
18114
  try {
17986
18115
  const recent = getRecentTokens();
17987
18116
  const filtered = recent.filter(
17988
- (t7) => !(t7.symbol === token.symbol && t7.chainType === token.chainType && t7.chainId === token.chainId)
18117
+ (t11) => !(t11.symbol === token.symbol && t11.chainType === token.chainType && t11.chainId === token.chainId)
17989
18118
  );
17990
18119
  localStorage.setItem(STORAGE_KEY, JSON.stringify(filtered));
17991
18120
  return filtered;
@@ -18024,7 +18153,7 @@ function TokenSelectorSheet({
18024
18153
  const addOption = (symbol, chainType, chainId, isRecent) => {
18025
18154
  const key = `${symbol}-${chainType}:${chainId}`;
18026
18155
  if (seen.has(key)) return;
18027
- const tokenData = tokens.find((t7) => t7.symbol === symbol);
18156
+ const tokenData = tokens.find((t11) => t11.symbol === symbol);
18028
18157
  if (!tokenData) return;
18029
18158
  const chainData = tokenData.chains.find(
18030
18159
  (c) => c.chain_type === chainType && c.chain_id === chainId
@@ -18480,6 +18609,104 @@ function DepositPollingUi({
18480
18609
  }
18481
18610
  return null;
18482
18611
  }
18612
+ var getChainKey = (chainId, chainType) => {
18613
+ return `${chainType}:${chainId}`;
18614
+ };
18615
+ function resolveSourceToken(supportedTokens, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol) {
18616
+ if (!supportedTokens.length) return null;
18617
+ let selectedTokenData;
18618
+ let selectedChainData;
18619
+ const hasChainDefaults = defaultSourceChainType && defaultSourceChainId;
18620
+ if (defaultSourceTokenAddress && hasChainDefaults) {
18621
+ for (const t11 of supportedTokens) {
18622
+ const matchingChain = t11.chains.find(
18623
+ (c) => c.token_address.toLowerCase() === defaultSourceTokenAddress.toLowerCase() && c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
18624
+ );
18625
+ if (matchingChain) {
18626
+ selectedTokenData = t11;
18627
+ selectedChainData = matchingChain;
18628
+ break;
18629
+ }
18630
+ }
18631
+ }
18632
+ if (!selectedTokenData && defaultSourceSymbol && hasChainDefaults) {
18633
+ for (const t11 of supportedTokens) {
18634
+ if (t11.symbol !== defaultSourceSymbol) continue;
18635
+ const matchedChain = t11.chains.find(
18636
+ (c) => c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
18637
+ );
18638
+ if (matchedChain) {
18639
+ selectedTokenData = t11;
18640
+ selectedChainData = matchedChain;
18641
+ break;
18642
+ }
18643
+ }
18644
+ }
18645
+ if (!selectedTokenData) {
18646
+ for (const t11 of supportedTokens) {
18647
+ if (t11.chains.length > 0) {
18648
+ selectedTokenData = t11;
18649
+ selectedChainData = t11.chains[0];
18650
+ break;
18651
+ }
18652
+ }
18653
+ }
18654
+ if (selectedTokenData && selectedChainData) {
18655
+ return { token: selectedTokenData, chain: selectedChainData };
18656
+ }
18657
+ return null;
18658
+ }
18659
+ function useDefaultSourceToken({
18660
+ supportedTokens,
18661
+ defaultSourceChainType,
18662
+ defaultSourceChainId,
18663
+ defaultSourceTokenAddress,
18664
+ defaultSourceSymbol
18665
+ }) {
18666
+ const [token, setToken] = useState192(null);
18667
+ const [chain, setChain] = useState192(null);
18668
+ const [initialSelectionDone, setInitialSelectionDone] = useState192(false);
18669
+ const appliedDefaultsRef = useRef52("");
18670
+ useEffect162(() => {
18671
+ if (!supportedTokens.length) return;
18672
+ const defaultsKey = `${defaultSourceTokenAddress ?? ""}|${defaultSourceSymbol ?? ""}|${defaultSourceChainType ?? ""}|${defaultSourceChainId ?? ""}`;
18673
+ const defaultsChanged = appliedDefaultsRef.current !== defaultsKey;
18674
+ if (initialSelectionDone && !defaultsChanged) return;
18675
+ const result = resolveSourceToken(
18676
+ supportedTokens,
18677
+ defaultSourceChainType,
18678
+ defaultSourceChainId,
18679
+ defaultSourceTokenAddress,
18680
+ defaultSourceSymbol
18681
+ );
18682
+ if (result) {
18683
+ setToken(result.token.symbol);
18684
+ setChain(getChainKey(result.chain.chain_id, result.chain.chain_type));
18685
+ appliedDefaultsRef.current = defaultsKey;
18686
+ setInitialSelectionDone(true);
18687
+ }
18688
+ }, [
18689
+ supportedTokens,
18690
+ defaultSourceTokenAddress,
18691
+ defaultSourceSymbol,
18692
+ defaultSourceChainType,
18693
+ defaultSourceChainId,
18694
+ initialSelectionDone
18695
+ ]);
18696
+ useEffect162(() => {
18697
+ if (!supportedTokens.length || !token) return;
18698
+ const currentToken = supportedTokens.find((t11) => t11.symbol === token);
18699
+ if (!currentToken || currentToken.chains.length === 0) return;
18700
+ const isChainAvailable = chain && currentToken.chains.some((c) => {
18701
+ return getChainKey(c.chain_id, c.chain_type) === chain;
18702
+ });
18703
+ if (!isChainAvailable) {
18704
+ const firstChain = currentToken.chains[0];
18705
+ setChain(getChainKey(firstChain.chain_id, firstChain.chain_type));
18706
+ }
18707
+ }, [token, supportedTokens, chain]);
18708
+ return { token, chain, setToken, setChain, initialSelectionDone };
18709
+ }
18483
18710
  function DepositFooterLinks({
18484
18711
  onGlossaryClick
18485
18712
  }) {
@@ -18639,7 +18866,7 @@ function GlossaryModal({
18639
18866
  ) });
18640
18867
  }
18641
18868
  function useCopyAddress() {
18642
- const [copied, setCopied] = useState192(false);
18869
+ const [copied, setCopied] = useState202(false);
18643
18870
  const handleCopy = (address) => {
18644
18871
  if (!address) return;
18645
18872
  navigator.clipboard.writeText(address);
@@ -18685,7 +18912,7 @@ var TooltipContent2 = React242.forwardRef(({ className, sideOffset = 4, ...props
18685
18912
  });
18686
18913
  TooltipContent2.displayName = Content22.displayName;
18687
18914
  var t4 = i18n2.transferCrypto;
18688
- var getChainKey = (chainId, chainType) => {
18915
+ var getChainKey2 = (chainId, chainType) => {
18689
18916
  return `${chainType}:${chainId}`;
18690
18917
  };
18691
18918
  var parseChainKey = (chainKey) => {
@@ -18699,6 +18926,10 @@ function TransferCryptoSingleInput({
18699
18926
  destinationChainType,
18700
18927
  destinationChainId,
18701
18928
  destinationTokenAddress,
18929
+ defaultSourceChainType,
18930
+ defaultSourceChainId,
18931
+ defaultSourceTokenAddress,
18932
+ defaultSourceSymbol,
18702
18933
  depositConfirmationMode = "auto_ui",
18703
18934
  onExecutionsChange,
18704
18935
  onDepositSuccess,
@@ -18707,21 +18938,25 @@ function TransferCryptoSingleInput({
18707
18938
  }) {
18708
18939
  const { themeClass, colors: colors2, fonts, components } = useTheme();
18709
18940
  const isDarkMode = themeClass.includes("uf-dark");
18710
- const [token, setToken] = useState212("USDC");
18711
- const [chain, setChain] = useState212("solana:mainnet");
18712
- const [copied, setCopied] = useState212(false);
18941
+ const [copied, setCopied] = useState222(false);
18713
18942
  const { copied: copiedRecipient, handleCopy: handleCopyRecipientAddress } = useCopyAddress();
18714
- const [glossaryOpen, setGlossaryOpen] = useState212(false);
18715
- const [detailsExpanded, setDetailsExpanded] = useState212(false);
18716
- const [depositsModalOpen, setDepositsModalOpen] = useState212(false);
18717
- const [tokenSelectorOpen, setTokenSelectorOpen] = useState212(false);
18718
- const [initialSelectionDone, setInitialSelectionDone] = useState212(false);
18943
+ const [glossaryOpen, setGlossaryOpen] = useState222(false);
18944
+ const [detailsExpanded, setDetailsExpanded] = useState222(false);
18945
+ const [depositsModalOpen, setDepositsModalOpen] = useState222(false);
18946
+ const [tokenSelectorOpen, setTokenSelectorOpen] = useState222(false);
18719
18947
  const { data: tokensResponse, isLoading: tokensLoading } = useSupportedDepositTokens(publishableKey, {
18720
18948
  destination_token_address: destinationTokenAddress,
18721
18949
  destination_chain_id: destinationChainId,
18722
18950
  destination_chain_type: destinationChainType
18723
18951
  });
18724
18952
  const supportedTokens = tokensResponse?.data ?? [];
18953
+ const { token, chain, setToken, setChain, initialSelectionDone } = useDefaultSourceToken({
18954
+ supportedTokens,
18955
+ defaultSourceChainType,
18956
+ defaultSourceChainId,
18957
+ defaultSourceTokenAddress,
18958
+ defaultSourceSymbol
18959
+ });
18725
18960
  const {
18726
18961
  data: depositAddressResponse,
18727
18962
  isLoading: walletsLoading,
@@ -18741,8 +18976,8 @@ function TransferCryptoSingleInput({
18741
18976
  const error = walletsError?.message ?? null;
18742
18977
  const allAvailableChains = useMemo52(() => {
18743
18978
  const chainsMap = /* @__PURE__ */ new Map();
18744
- supportedTokens.forEach((t7) => {
18745
- t7.chains.forEach((c) => {
18979
+ supportedTokens.forEach((t11) => {
18980
+ t11.chains.forEach((c) => {
18746
18981
  const comboKey = `${c.chain_type}:${c.chain_id}`;
18747
18982
  if (!chainsMap.has(comboKey)) {
18748
18983
  chainsMap.set(comboKey, c);
@@ -18751,10 +18986,10 @@ function TransferCryptoSingleInput({
18751
18986
  });
18752
18987
  return Array.from(chainsMap.values());
18753
18988
  }, [supportedTokens]);
18754
- const currentChainCombo = parseChainKey(chain);
18755
- const currentChainData = allAvailableChains.find(
18989
+ const currentChainCombo = chain ? parseChainKey(chain) : null;
18990
+ const currentChainData = currentChainCombo ? allAvailableChains.find(
18756
18991
  (c) => c.chain_type === currentChainCombo.chainType && c.chain_id === currentChainCombo.chainId
18757
- );
18992
+ ) : void 0;
18758
18993
  const currentChainType = currentChainData?.chain_type || "ethereum";
18759
18994
  const currentWallet = getWalletByChainType(wallets, currentChainType);
18760
18995
  const depositAddress = currentWallet?.address || "";
@@ -18772,84 +19007,26 @@ function TransferCryptoSingleInput({
18772
19007
  onDepositSuccess,
18773
19008
  onDepositError
18774
19009
  });
18775
- useEffect162(() => {
18776
- if (!supportedTokens.length || initialSelectionDone) return;
18777
- let selectedTokenData;
18778
- let selectedChainData;
18779
- if (destinationTokenAddress) {
18780
- for (const t7 of supportedTokens) {
18781
- const matchingChain = t7.chains.find(
18782
- (c) => c.token_address.toLowerCase() === destinationTokenAddress.toLowerCase()
18783
- );
18784
- if (matchingChain) {
18785
- selectedTokenData = t7;
18786
- selectedChainData = matchingChain;
18787
- break;
18788
- }
18789
- }
18790
- }
18791
- if (!selectedTokenData) {
18792
- selectedTokenData = supportedTokens.find((t7) => t7.symbol === "USDC");
18793
- if (selectedTokenData && selectedTokenData.chains.length > 0) {
18794
- selectedChainData = selectedTokenData.chains[0];
18795
- }
18796
- }
18797
- if (!selectedTokenData) {
18798
- selectedTokenData = supportedTokens.find((t7) => t7.symbol === "USDT");
18799
- if (selectedTokenData && selectedTokenData.chains.length > 0) {
18800
- selectedChainData = selectedTokenData.chains[0];
18801
- }
18802
- }
18803
- if (!selectedTokenData) {
18804
- selectedTokenData = supportedTokens[0];
18805
- if (selectedTokenData.chains.length > 0) {
18806
- selectedChainData = selectedTokenData.chains[0];
18807
- }
18808
- }
18809
- if (selectedTokenData) {
18810
- setToken(selectedTokenData.symbol);
18811
- }
18812
- if (selectedChainData) {
18813
- setChain(
18814
- getChainKey(selectedChainData.chain_id, selectedChainData.chain_type)
18815
- );
18816
- }
18817
- setInitialSelectionDone(true);
18818
- }, [supportedTokens, destinationTokenAddress, initialSelectionDone]);
18819
- useEffect162(() => {
19010
+ useEffect172(() => {
18820
19011
  if (onExecutionsChange) {
18821
19012
  onExecutionsChange(depositExecutions);
18822
19013
  }
18823
19014
  }, [depositExecutions, onExecutionsChange]);
18824
- useEffect162(() => {
18825
- if (!supportedTokens.length) return;
18826
- const currentToken = supportedTokens.find((t7) => t7.symbol === token);
18827
- if (!currentToken || currentToken.chains.length === 0) return;
18828
- const isChainAvailable = currentToken.chains.some((c) => {
18829
- const key = getChainKey(c.chain_id, c.chain_type);
18830
- return key === chain;
18831
- });
18832
- if (!isChainAvailable) {
18833
- const firstChain = currentToken.chains[0];
18834
- const newChain = getChainKey(firstChain.chain_id, firstChain.chain_type);
18835
- setChain(newChain);
18836
- }
18837
- }, [token, supportedTokens, chain]);
18838
- const selectedToken = supportedTokens.find((t7) => t7.symbol === token);
19015
+ const selectedToken = token ? supportedTokens.find((t11) => t11.symbol === token) : void 0;
18839
19016
  const availableChainsForToken = selectedToken?.chains || [];
18840
- const currentChainFromBackend = availableChainsForToken.find((c) => {
18841
- const key = getChainKey(c.chain_id, c.chain_type);
19017
+ const currentChainFromBackend = chain ? availableChainsForToken.find((c) => {
19018
+ const key = getChainKey2(c.chain_id, c.chain_type);
18842
19019
  return key === chain;
18843
19020
  }) || allAvailableChains.find((c) => {
18844
- const key = getChainKey(c.chain_id, c.chain_type);
19021
+ const key = getChainKey2(c.chain_id, c.chain_type);
18845
19022
  return key === chain;
18846
- });
19023
+ }) : void 0;
18847
19024
  const handleCopyAddress = () => {
18848
19025
  navigator.clipboard.writeText(depositAddress);
18849
19026
  setCopied(true);
18850
19027
  setTimeout(() => setCopied(false), 2e3);
18851
19028
  };
18852
- const formatProcessingTime2 = (seconds) => {
19029
+ const formatProcessingTime3 = (seconds) => {
18853
19030
  if (seconds === null) {
18854
19031
  return t4.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
18855
19032
  }
@@ -18878,10 +19055,10 @@ function TransferCryptoSingleInput({
18878
19055
  "button",
18879
19056
  {
18880
19057
  onClick: () => setTokenSelectorOpen(true),
18881
- disabled: tokensLoading || supportedTokens.length === 0,
19058
+ disabled: tokensLoading || !token || supportedTokens.length === 0,
18882
19059
  className: "uf-w-full hover:uf-bg-accent uf-p-3 uf-flex uf-items-center uf-gap-3 uf-transition-colors disabled:uf-opacity-50 disabled:uf-cursor-not-allowed",
18883
19060
  style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` },
18884
- children: tokensLoading ? /* @__PURE__ */ jsxs35("div", { className: "uf-flex uf-items-center uf-gap-3 uf-animate-pulse", children: [
19061
+ children: tokensLoading || !token ? /* @__PURE__ */ jsxs35("div", { className: "uf-flex uf-items-center uf-gap-3 uf-animate-pulse", children: [
18885
19062
  /* @__PURE__ */ jsx41("div", { className: "uf-w-10 uf-h-10 uf-rounded-full uf-bg-muted" }),
18886
19063
  /* @__PURE__ */ jsxs35("div", { className: "uf-flex-1", children: [
18887
19064
  /* @__PURE__ */ jsx41("div", { className: "uf-h-4 uf-w-16 uf-bg-muted uf-rounded uf-mb-1" }),
@@ -18955,8 +19132,8 @@ function TransferCryptoSingleInput({
18955
19132
  open: tokenSelectorOpen,
18956
19133
  onOpenChange: setTokenSelectorOpen,
18957
19134
  tokens: supportedTokens,
18958
- selectedToken: token,
18959
- selectedChainKey: chain,
19135
+ selectedToken: token ?? "",
19136
+ selectedChainKey: chain ?? "",
18960
19137
  onSelect: (newToken, newChain) => {
18961
19138
  setToken(newToken);
18962
19139
  setChain(newChain);
@@ -19058,7 +19235,7 @@ function TransferCryptoSingleInput({
19058
19235
  t4.processingTime.label,
19059
19236
  ":",
19060
19237
  " ",
19061
- /* @__PURE__ */ jsx41("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime2(processingTime) })
19238
+ /* @__PURE__ */ jsx41("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime3(processingTime) })
19062
19239
  ] })
19063
19240
  ] }),
19064
19241
  detailsExpanded ? /* @__PURE__ */ jsx41(ChevronUp, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } }) : /* @__PURE__ */ jsx41(ChevronDown, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } })
@@ -19294,7 +19471,7 @@ var SelectSeparator2 = React252.forwardRef(({ className, ...props }, ref) => /*
19294
19471
  ));
19295
19472
  SelectSeparator2.displayName = Separator.displayName;
19296
19473
  var t5 = i18n2.transferCrypto;
19297
- var getChainKey2 = (chainId, chainType) => {
19474
+ var getChainKey3 = (chainId, chainType) => {
19298
19475
  return `${chainType}:${chainId}`;
19299
19476
  };
19300
19477
  var parseChainKey2 = (chainKey) => {
@@ -19308,6 +19485,10 @@ function TransferCryptoDoubleInput({
19308
19485
  destinationChainType,
19309
19486
  destinationChainId,
19310
19487
  destinationTokenAddress,
19488
+ defaultSourceChainType,
19489
+ defaultSourceChainId,
19490
+ defaultSourceTokenAddress,
19491
+ defaultSourceSymbol,
19311
19492
  depositConfirmationMode = "auto_ui",
19312
19493
  onExecutionsChange,
19313
19494
  onDepositSuccess,
@@ -19316,20 +19497,24 @@ function TransferCryptoDoubleInput({
19316
19497
  }) {
19317
19498
  const { themeClass, colors: colors2, fonts, components } = useTheme();
19318
19499
  const isDarkMode = themeClass.includes("uf-dark");
19319
- const [token, setToken] = useState222("USDC");
19320
- const [chain, setChain] = useState222("solana:mainnet");
19321
- const [copied, setCopied] = useState222(false);
19500
+ const [copied, setCopied] = useState232(false);
19322
19501
  const { copied: copiedRecipient, handleCopy: handleCopyRecipientAddress } = useCopyAddress();
19323
- const [glossaryOpen, setGlossaryOpen] = useState222(false);
19324
- const [detailsExpanded, setDetailsExpanded] = useState222(false);
19325
- const [depositsModalOpen, setDepositsModalOpen] = useState222(false);
19326
- const [initialSelectionDone, setInitialSelectionDone] = useState222(false);
19502
+ const [glossaryOpen, setGlossaryOpen] = useState232(false);
19503
+ const [detailsExpanded, setDetailsExpanded] = useState232(false);
19504
+ const [depositsModalOpen, setDepositsModalOpen] = useState232(false);
19327
19505
  const { data: tokensResponse, isLoading: tokensLoading } = useSupportedDepositTokens(publishableKey, {
19328
19506
  destination_token_address: destinationTokenAddress,
19329
19507
  destination_chain_id: destinationChainId,
19330
19508
  destination_chain_type: destinationChainType
19331
19509
  });
19332
19510
  const supportedTokens = tokensResponse?.data ?? [];
19511
+ const { token, chain, setToken, setChain, initialSelectionDone } = useDefaultSourceToken({
19512
+ supportedTokens,
19513
+ defaultSourceChainType,
19514
+ defaultSourceChainId,
19515
+ defaultSourceTokenAddress,
19516
+ defaultSourceSymbol
19517
+ });
19333
19518
  const {
19334
19519
  data: depositAddressResponse,
19335
19520
  isLoading: walletsLoading,
@@ -19349,8 +19534,8 @@ function TransferCryptoDoubleInput({
19349
19534
  const error = walletsError?.message ?? null;
19350
19535
  const allAvailableChains = useMemo62(() => {
19351
19536
  const chainsMap = /* @__PURE__ */ new Map();
19352
- supportedTokens.forEach((t7) => {
19353
- t7.chains.forEach((c) => {
19537
+ supportedTokens.forEach((t11) => {
19538
+ t11.chains.forEach((c) => {
19354
19539
  const comboKey = `${c.chain_type}:${c.chain_id}`;
19355
19540
  if (!chainsMap.has(comboKey)) {
19356
19541
  chainsMap.set(comboKey, c);
@@ -19359,10 +19544,10 @@ function TransferCryptoDoubleInput({
19359
19544
  });
19360
19545
  return Array.from(chainsMap.values());
19361
19546
  }, [supportedTokens]);
19362
- const currentChainCombo = parseChainKey2(chain);
19363
- const currentChainData = allAvailableChains.find(
19547
+ const currentChainCombo = chain ? parseChainKey2(chain) : null;
19548
+ const currentChainData = currentChainCombo ? allAvailableChains.find(
19364
19549
  (c) => c.chain_type === currentChainCombo.chainType && c.chain_id === currentChainCombo.chainId
19365
- );
19550
+ ) : void 0;
19366
19551
  const currentChainType = currentChainData?.chain_type || "ethereum";
19367
19552
  const currentWallet = getWalletByChainType(wallets, currentChainType);
19368
19553
  const depositAddress = currentWallet?.address || "";
@@ -19380,57 +19565,26 @@ function TransferCryptoDoubleInput({
19380
19565
  onDepositSuccess,
19381
19566
  onDepositError
19382
19567
  });
19383
- useEffect172(() => {
19384
- if (!supportedTokens.length || initialSelectionDone) return;
19385
- const allChains = /* @__PURE__ */ new Set();
19386
- supportedTokens.forEach((t7) => {
19387
- t7.chains.forEach((c) => {
19388
- allChains.add(getChainKey2(c.chain_id, c.chain_type));
19389
- });
19390
- });
19391
- if (!allChains.has(chain)) {
19392
- const firstToken = supportedTokens[0];
19393
- if (firstToken.chains.length > 0) {
19394
- const firstChain = firstToken.chains[0];
19395
- setChain(getChainKey2(firstChain.chain_id, firstChain.chain_type));
19396
- }
19397
- }
19398
- setInitialSelectionDone(true);
19399
- }, [supportedTokens, chain, initialSelectionDone]);
19400
- useEffect172(() => {
19568
+ useEffect182(() => {
19401
19569
  if (onExecutionsChange) {
19402
19570
  onExecutionsChange(depositExecutions);
19403
19571
  }
19404
19572
  }, [depositExecutions, onExecutionsChange]);
19405
- useEffect172(() => {
19406
- if (!supportedTokens.length) return;
19407
- const currentToken = supportedTokens.find((t7) => t7.symbol === token);
19408
- if (!currentToken || currentToken.chains.length === 0) return;
19409
- const isChainAvailable = currentToken.chains.some((c) => {
19410
- const key = getChainKey2(c.chain_id, c.chain_type);
19411
- return key === chain;
19412
- });
19413
- if (!isChainAvailable) {
19414
- const firstChain = currentToken.chains[0];
19415
- const newChain = getChainKey2(firstChain.chain_id, firstChain.chain_type);
19416
- setChain(newChain);
19417
- }
19418
- }, [token, supportedTokens, chain]);
19419
- const selectedToken = supportedTokens.find((t7) => t7.symbol === token);
19573
+ const selectedToken = token ? supportedTokens.find((t11) => t11.symbol === token) : void 0;
19420
19574
  const availableChainsForToken = selectedToken?.chains || [];
19421
- const currentChainFromBackend = availableChainsForToken.find((c) => {
19422
- const key = getChainKey2(c.chain_id, c.chain_type);
19575
+ const currentChainFromBackend = chain ? availableChainsForToken.find((c) => {
19576
+ const key = getChainKey3(c.chain_id, c.chain_type);
19423
19577
  return key === chain;
19424
19578
  }) || allAvailableChains.find((c) => {
19425
- const key = getChainKey2(c.chain_id, c.chain_type);
19579
+ const key = getChainKey3(c.chain_id, c.chain_type);
19426
19580
  return key === chain;
19427
- });
19581
+ }) : void 0;
19428
19582
  const handleCopyAddress = () => {
19429
19583
  navigator.clipboard.writeText(depositAddress);
19430
19584
  setCopied(true);
19431
19585
  setTimeout(() => setCopied(false), 2e3);
19432
19586
  };
19433
- const formatProcessingTime2 = (seconds) => {
19587
+ const formatProcessingTime3 = (seconds) => {
19434
19588
  if (seconds === null) {
19435
19589
  return t5.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
19436
19590
  }
@@ -19498,11 +19652,11 @@ function TransferCryptoDoubleInput({
19498
19652
  /* @__PURE__ */ jsxs37(
19499
19653
  Select2,
19500
19654
  {
19501
- value: token,
19655
+ value: token ?? "",
19502
19656
  onValueChange: setToken,
19503
- disabled: tokensLoading || supportedTokens.length === 0,
19657
+ disabled: tokensLoading || !token || supportedTokens.length === 0,
19504
19658
  children: [
19505
- /* @__PURE__ */ jsx43(SelectTrigger2, { className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50", style: { backgroundColor: components.card.backgroundColor, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` }, children: /* @__PURE__ */ jsx43(SelectValue2, { children: tokensLoading ? /* @__PURE__ */ jsx43("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ jsx43("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t5.loading }) }) : selectedToken ? renderTokenItem(selectedToken) : /* @__PURE__ */ jsx43("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ jsx43("span", { className: "uf-text-xs uf-font-normal", children: token }) }) }) }),
19659
+ /* @__PURE__ */ jsx43(SelectTrigger2, { className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50", style: { backgroundColor: components.card.backgroundColor, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` }, children: /* @__PURE__ */ jsx43(SelectValue2, { children: tokensLoading || !token ? /* @__PURE__ */ jsx43("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ jsx43("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t5.loading }) }) : selectedToken ? renderTokenItem(selectedToken) : /* @__PURE__ */ jsx43("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ jsx43("span", { className: "uf-text-xs uf-font-normal", children: token }) }) }) }),
19506
19660
  /* @__PURE__ */ jsx43(SelectContent2, { className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px]", style: { border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`, ...fonts.regular ? { "--uf-font-family": fonts.regular } : {} }, children: supportedTokens.map((tokenData) => /* @__PURE__ */ jsx43(
19507
19661
  SelectItem2,
19508
19662
  {
@@ -19529,11 +19683,11 @@ function TransferCryptoDoubleInput({
19529
19683
  /* @__PURE__ */ jsxs37(
19530
19684
  Select2,
19531
19685
  {
19532
- value: chain,
19686
+ value: chain ?? "",
19533
19687
  onValueChange: setChain,
19534
- disabled: tokensLoading || availableChainsForToken.length === 0,
19688
+ disabled: tokensLoading || !chain || availableChainsForToken.length === 0,
19535
19689
  children: [
19536
- /* @__PURE__ */ jsx43(SelectTrigger2, { className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50", style: { backgroundColor: components.card.backgroundColor, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` }, children: /* @__PURE__ */ jsx43(SelectValue2, { children: tokensLoading ? /* @__PURE__ */ jsx43("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ jsx43("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t5.loading }) }) : currentChainFromBackend ? renderChainItem(currentChainFromBackend) : currentChainData ? renderChainItem(currentChainData) : /* @__PURE__ */ jsx43("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ jsx43("span", { className: "uf-text-xs uf-font-normal", children: chain }) }) }) }),
19690
+ /* @__PURE__ */ jsx43(SelectTrigger2, { className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50", style: { backgroundColor: components.card.backgroundColor, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` }, children: /* @__PURE__ */ jsx43(SelectValue2, { children: tokensLoading || !chain ? /* @__PURE__ */ jsx43("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ jsx43("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t5.loading }) }) : currentChainFromBackend ? renderChainItem(currentChainFromBackend) : currentChainData ? renderChainItem(currentChainData) : /* @__PURE__ */ jsx43("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ jsx43("span", { className: "uf-text-xs uf-font-normal", children: chain }) }) }) }),
19537
19691
  /* @__PURE__ */ jsx43(
19538
19692
  SelectContent2,
19539
19693
  {
@@ -19541,7 +19695,7 @@ function TransferCryptoDoubleInput({
19541
19695
  className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px] uf-min-w-[200px]",
19542
19696
  style: { border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`, ...fonts.regular ? { "--uf-font-family": fonts.regular } : {} },
19543
19697
  children: availableChainsForToken.length === 0 ? /* @__PURE__ */ jsx43("div", { className: "uf-px-2 uf-py-3 uf-text-xs uf-text-muted-foreground uf-text-center", children: t5.noChainsAvailable }) : availableChainsForToken.map((chainData) => {
19544
- const chainKey = getChainKey2(
19698
+ const chainKey = getChainKey3(
19545
19699
  chainData.chain_id,
19546
19700
  chainData.chain_type
19547
19701
  );
@@ -19657,7 +19811,7 @@ function TransferCryptoDoubleInput({
19657
19811
  t5.processingTime.label,
19658
19812
  ":",
19659
19813
  " ",
19660
- /* @__PURE__ */ jsx43("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime2(processingTime) })
19814
+ /* @__PURE__ */ jsx43("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime3(processingTime) })
19661
19815
  ] })
19662
19816
  ] }),
19663
19817
  detailsExpanded ? /* @__PURE__ */ jsx43(ChevronUp, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } }) : /* @__PURE__ */ jsx43(ChevronDown, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } })
@@ -20536,7 +20690,7 @@ function ConfirmingView({
20536
20690
  isPolling = false
20537
20691
  }) {
20538
20692
  const { colors: colors2, fonts } = useTheme();
20539
- const [containerEl, setContainerEl] = useState232(null);
20693
+ const [containerEl, setContainerEl] = useState242(null);
20540
20694
  const containerCallbackRef = useCallback22((el) => {
20541
20695
  setContainerEl(el);
20542
20696
  }, []);
@@ -20701,7 +20855,7 @@ function BrowserWalletModal({
20701
20855
  );
20702
20856
  if (cancelled) return;
20703
20857
  const supportedToken = response.data.find(
20704
- (t7) => t7.symbol.toLowerCase() === token.symbol.toLowerCase()
20858
+ (t11) => t11.symbol.toLowerCase() === token.symbol.toLowerCase()
20705
20859
  );
20706
20860
  if (supportedToken) {
20707
20861
  const chainDetail = supportedToken.chains.find(
@@ -21909,6 +22063,10 @@ function DepositModal({
21909
22063
  destinationChainType,
21910
22064
  destinationChainId,
21911
22065
  destinationTokenAddress,
22066
+ defaultSourceChainType,
22067
+ defaultSourceChainId,
22068
+ defaultSourceTokenAddress,
22069
+ defaultSourceSymbol,
21912
22070
  hideDepositTracker = false,
21913
22071
  showBalanceHeader = false,
21914
22072
  transferInputVariant = "double_input",
@@ -21935,28 +22093,28 @@ function DepositModal({
21935
22093
  if (s === "tracker" && hideDepositTracker) return "main";
21936
22094
  return s;
21937
22095
  }, [initialScreen, hideDepositTracker]);
21938
- const [containerEl, setContainerEl] = useState26(null);
22096
+ const [containerEl, setContainerEl] = useState27(null);
21939
22097
  const containerCallbackRef = useCallback42((el) => {
21940
22098
  setContainerEl(el);
21941
22099
  }, []);
21942
- const [view, setView] = useState26(
22100
+ const [view, setView] = useState27(
21943
22101
  effectiveInitialScreen
21944
22102
  );
21945
- const resetViewTimeoutRef = useRef52(null);
21946
- const [cardView, setCardView] = useState26(
22103
+ const resetViewTimeoutRef = useRef62(null);
22104
+ const [cardView, setCardView] = useState27(
21947
22105
  "amount"
21948
22106
  );
21949
- const [exchangeView, setExchangeView] = useState26(
22107
+ const [exchangeView, setExchangeView] = useState27(
21950
22108
  "providers"
21951
22109
  );
21952
- const [browserWalletModalOpen, setBrowserWalletModalOpen] = useState26(false);
21953
- const [browserWalletInfo, setBrowserWalletInfo] = useState26(null);
21954
- const [walletSelectionModalOpen, setWalletSelectionModalOpen] = useState26(false);
21955
- const [browserWalletChainType, setBrowserWalletChainType] = useState26(() => getStoredWalletChainType());
21956
- const [quotesCount, setQuotesCount] = useState26(0);
21957
- const [allExecutions, setAllExecutions] = useState26([]);
21958
- const [selectedExecution, setSelectedExecution] = useState26(null);
21959
- const [depositExecutions, setDepositExecutions] = useState26([]);
22110
+ const [browserWalletModalOpen, setBrowserWalletModalOpen] = useState27(false);
22111
+ const [browserWalletInfo, setBrowserWalletInfo] = useState27(null);
22112
+ const [walletSelectionModalOpen, setWalletSelectionModalOpen] = useState27(false);
22113
+ const [browserWalletChainType, setBrowserWalletChainType] = useState27(() => getStoredWalletChainType());
22114
+ const [quotesCount, setQuotesCount] = useState27(0);
22115
+ const [allExecutions, setAllExecutions] = useState27([]);
22116
+ const [selectedExecution, setSelectedExecution] = useState27(null);
22117
+ const [depositExecutions, setDepositExecutions] = useState27([]);
21960
22118
  const isMobileView = useIsMobileViewport();
21961
22119
  const { data: depositAddressResponse, isLoading: walletsLoading } = useDepositAddress({
21962
22120
  userId,
@@ -21969,10 +22127,10 @@ function DepositModal({
21969
22127
  // Only fetch when modal is open
21970
22128
  });
21971
22129
  const wallets = depositAddressResponse?.data ?? [];
21972
- const [resolvedTheme, setResolvedTheme] = useState26(
22130
+ const [resolvedTheme, setResolvedTheme] = useState27(
21973
22131
  theme === "auto" ? "dark" : theme
21974
22132
  );
21975
- useEffect20(() => {
22133
+ useEffect21(() => {
21976
22134
  if (theme === "auto") {
21977
22135
  const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
21978
22136
  setResolvedTheme(mediaQuery.matches ? "dark" : "light");
@@ -22001,11 +22159,11 @@ function DepositModal({
22001
22159
  chainType: destinationChainType,
22002
22160
  enabled: open
22003
22161
  });
22004
- useEffect20(() => {
22162
+ useEffect21(() => {
22005
22163
  if (view !== "tracker" || !userId) return;
22006
22164
  const fetchExecutions = async () => {
22007
22165
  try {
22008
- const response = await queryExecutions(userId, publishableKey);
22166
+ const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
22009
22167
  const sorted = [...response.data].sort((a, b) => {
22010
22168
  const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
22011
22169
  const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
@@ -22022,7 +22180,7 @@ function DepositModal({
22022
22180
  clearInterval(pollInterval);
22023
22181
  };
22024
22182
  }, [view, userId, publishableKey]);
22025
- useEffect20(() => {
22183
+ useEffect21(() => {
22026
22184
  if (view !== "tracker") {
22027
22185
  setSelectedExecution(null);
22028
22186
  }
@@ -22132,7 +22290,7 @@ function DepositModal({
22132
22290
  setBrowserWalletInfo(null);
22133
22291
  setSelectedExecution(null);
22134
22292
  }, [open, effectiveInitialScreen]);
22135
- useEffect20(
22293
+ useEffect21(
22136
22294
  () => () => {
22137
22295
  if (resetViewTimeoutRef.current) {
22138
22296
  clearTimeout(resetViewTimeoutRef.current);
@@ -22341,6 +22499,10 @@ function DepositModal({
22341
22499
  destinationChainType,
22342
22500
  destinationChainId,
22343
22501
  destinationTokenAddress,
22502
+ defaultSourceChainType,
22503
+ defaultSourceChainId,
22504
+ defaultSourceTokenAddress,
22505
+ defaultSourceSymbol,
22344
22506
  depositConfirmationMode,
22345
22507
  onExecutionsChange: setDepositExecutions,
22346
22508
  onDepositSuccess,
@@ -22356,6 +22518,10 @@ function DepositModal({
22356
22518
  destinationChainType,
22357
22519
  destinationChainId,
22358
22520
  destinationTokenAddress,
22521
+ defaultSourceChainType,
22522
+ defaultSourceChainId,
22523
+ defaultSourceTokenAddress,
22524
+ defaultSourceSymbol,
22359
22525
  depositConfirmationMode,
22360
22526
  onExecutionsChange: setDepositExecutions,
22361
22527
  onDepositSuccess,
@@ -22516,81 +22682,1804 @@ function DepositModal({
22516
22682
  }
22517
22683
  ) });
22518
22684
  }
22519
-
22520
- // src/provider.tsx
22521
- import { jsx as jsx53, jsxs as jsxs45 } from "react/jsx-runtime";
22522
- function UnifoldProvider2({
22523
- children,
22685
+ function useSupportedDestinationTokens(publishableKey, enabled = true) {
22686
+ return useQuery9({
22687
+ queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
22688
+ queryFn: () => getSupportedDestinationTokens(publishableKey),
22689
+ staleTime: 1e3 * 60 * 5,
22690
+ gcTime: 1e3 * 60 * 30,
22691
+ refetchOnMount: false,
22692
+ refetchOnWindowFocus: false,
22693
+ enabled
22694
+ });
22695
+ }
22696
+ function useSourceTokenValidation(params) {
22697
+ const {
22698
+ sourceChainType,
22699
+ sourceChainId,
22700
+ sourceTokenAddress,
22701
+ sourceTokenSymbol,
22702
+ publishableKey,
22703
+ enabled = true
22704
+ } = params;
22705
+ const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
22706
+ return useQuery10({
22707
+ queryKey: [
22708
+ "unifold",
22709
+ "sourceTokenValidation",
22710
+ sourceChainType ?? null,
22711
+ sourceChainId ?? null,
22712
+ sourceTokenAddress ?? null,
22713
+ publishableKey
22714
+ ],
22715
+ queryFn: async () => {
22716
+ const res = await getSupportedDepositTokens(publishableKey);
22717
+ let matchedMinUsd = null;
22718
+ let matchedProcessingTime = null;
22719
+ let matchedSlippage = null;
22720
+ let matchedPriceImpact = null;
22721
+ const found = res.data.some(
22722
+ (token) => token.chains.some((chain) => {
22723
+ const match = chain.chain_type === sourceChainType && chain.chain_id === sourceChainId && chain.token_address.toLowerCase() === sourceTokenAddress.toLowerCase();
22724
+ if (match) {
22725
+ matchedMinUsd = chain.minimum_deposit_amount_usd;
22726
+ matchedProcessingTime = chain.estimated_processing_time;
22727
+ matchedSlippage = chain.max_slippage_percent;
22728
+ matchedPriceImpact = chain.estimated_price_impact_percent;
22729
+ }
22730
+ return match;
22731
+ })
22732
+ );
22733
+ return {
22734
+ isSupported: found,
22735
+ minimumAmountUsd: matchedMinUsd,
22736
+ estimatedProcessingTime: matchedProcessingTime,
22737
+ maxSlippagePercent: matchedSlippage,
22738
+ priceImpactPercent: matchedPriceImpact,
22739
+ errorMessage: found ? null : `${sourceTokenSymbol || "Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`
22740
+ };
22741
+ },
22742
+ enabled: enabled && hasParams,
22743
+ staleTime: 1e3 * 60 * 5,
22744
+ gcTime: 1e3 * 60 * 30,
22745
+ refetchOnMount: false,
22746
+ refetchOnWindowFocus: false
22747
+ });
22748
+ }
22749
+ function useAddressBalance(params) {
22750
+ const {
22751
+ address,
22752
+ chainType,
22753
+ chainId,
22754
+ tokenAddress,
22755
+ publishableKey,
22756
+ enabled = true
22757
+ } = params;
22758
+ const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
22759
+ return useQuery11({
22760
+ queryKey: [
22761
+ "unifold",
22762
+ "addressBalance",
22763
+ address ?? null,
22764
+ chainType ?? null,
22765
+ chainId ?? null,
22766
+ tokenAddress ?? null,
22767
+ publishableKey
22768
+ ],
22769
+ queryFn: async () => {
22770
+ const res = await getAddressBalance(
22771
+ address,
22772
+ chainType,
22773
+ chainId,
22774
+ tokenAddress,
22775
+ publishableKey
22776
+ );
22777
+ if (res.balance) {
22778
+ const decimals = res.balance.token?.decimals ?? 6;
22779
+ const symbol = res.balance.token?.symbol ?? "";
22780
+ const baseUnit = res.balance.amount;
22781
+ const raw = BigInt(baseUnit);
22782
+ const divisor = BigInt(10 ** decimals);
22783
+ const whole = raw / divisor;
22784
+ const frac = raw % divisor;
22785
+ const fracStr = frac.toString().padStart(decimals, "0").replace(/0+$/, "");
22786
+ const balanceHuman = fracStr ? `${whole}.${fracStr}` : whole.toString();
22787
+ return {
22788
+ balanceBaseUnit: baseUnit,
22789
+ balanceHuman,
22790
+ balanceUsd: res.balance.amount_usd,
22791
+ exchangeRate: res.balance.exchange_rate,
22792
+ decimals,
22793
+ symbol
22794
+ };
22795
+ }
22796
+ return { balanceBaseUnit: "0", balanceHuman: "0", balanceUsd: "0", exchangeRate: null, decimals: 6, symbol: "" };
22797
+ },
22798
+ enabled: enabled && hasParams,
22799
+ staleTime: 1e3 * 30,
22800
+ gcTime: 1e3 * 60 * 5,
22801
+ refetchInterval: 1e3 * 30,
22802
+ refetchOnMount: "always",
22803
+ refetchOnWindowFocus: false
22804
+ });
22805
+ }
22806
+ function useExecutions(userId, publishableKey, options) {
22807
+ const actionType = options?.actionType ?? ActionType.Deposit;
22808
+ return useQuery12({
22809
+ queryKey: ["unifold", "executions", actionType, userId, publishableKey],
22810
+ queryFn: () => queryExecutions(userId, publishableKey, actionType),
22811
+ enabled: (options?.enabled ?? true) && !!userId,
22812
+ refetchInterval: options?.refetchInterval ?? 3e3,
22813
+ staleTime: 0,
22814
+ gcTime: 1e3 * 60 * 5,
22815
+ refetchOnWindowFocus: false
22816
+ });
22817
+ }
22818
+ var POLL_INTERVAL_MS2 = 2500;
22819
+ var POLL_ENDPOINT_INTERVAL_MS2 = 3e3;
22820
+ var CUTOFF_BUFFER_MS2 = 6e4;
22821
+ function useWithdrawPolling({
22822
+ userId,
22524
22823
  publishableKey,
22525
- config
22824
+ depositWalletId,
22825
+ enabled = false,
22826
+ onWithdrawSuccess,
22827
+ onWithdrawError
22526
22828
  }) {
22527
- const [isOpen, setIsOpen] = useState28(false);
22528
- const [depositConfig, setDepositConfig] = useState28(
22529
- null
22530
- );
22531
- const [resolvedTheme, setResolvedTheme] = React38.useState("dark");
22532
- useEffect29(() => {
22533
- if (publishableKey) {
22534
- setApiConfig({ publishableKey });
22535
- }
22536
- }, [publishableKey]);
22537
- React38.useEffect(() => {
22538
- const appearance = config?.appearance || "dark";
22539
- if (appearance === "auto") {
22540
- const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
22541
- setResolvedTheme(prefersDark ? "dark" : "light");
22542
- const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
22543
- const handler = (e) => {
22544
- setResolvedTheme(e.matches ? "dark" : "light");
22545
- };
22546
- mediaQuery.addEventListener("change", handler);
22547
- return () => mediaQuery.removeEventListener("change", handler);
22548
- } else {
22549
- setResolvedTheme(appearance);
22550
- }
22551
- }, [config?.appearance]);
22552
- const depositPromiseRef = React38.useRef(null);
22553
- const depositConfigRef = React38.useRef(null);
22554
- depositConfigRef.current = depositConfig;
22555
- const closeTimeoutRef = React38.useRef(null);
22556
- const closeGuardRef = React38.useRef(false);
22557
- const beginDeposit = useCallback12((config2) => {
22558
- if (closeTimeoutRef.current) {
22559
- clearTimeout(closeTimeoutRef.current);
22560
- closeTimeoutRef.current = null;
22561
- }
22562
- closeGuardRef.current = false;
22563
- if (depositPromiseRef.current) {
22564
- console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit.");
22565
- depositPromiseRef.current.reject({
22566
- message: "Deposit cancelled - new deposit started",
22567
- code: "DEPOSIT_SUPERSEDED"
22568
- });
22569
- depositPromiseRef.current = null;
22570
- }
22571
- const promise = new Promise((resolve, reject) => {
22572
- depositPromiseRef.current = { resolve, reject };
22573
- });
22574
- promise.catch(() => {
22575
- });
22576
- setDepositConfig(config2);
22577
- setIsOpen(true);
22578
- return promise;
22579
- }, []);
22580
- const closeDeposit = useCallback12(() => {
22581
- if (closeGuardRef.current) {
22582
- return;
22829
+ const [executions, setExecutions] = useState28([]);
22830
+ const [isPolling, setIsPolling] = useState28(false);
22831
+ const enabledAtRef = useRef72(/* @__PURE__ */ new Date());
22832
+ const trackedRef = useRef72(/* @__PURE__ */ new Map());
22833
+ const prevEnabledRef = useRef72(false);
22834
+ const onSuccessRef = useRef72(onWithdrawSuccess);
22835
+ const onErrorRef = useRef72(onWithdrawError);
22836
+ useEffect222(() => {
22837
+ onSuccessRef.current = onWithdrawSuccess;
22838
+ }, [onWithdrawSuccess]);
22839
+ useEffect222(() => {
22840
+ onErrorRef.current = onWithdrawError;
22841
+ }, [onWithdrawError]);
22842
+ useEffect222(() => {
22843
+ if (enabled && !prevEnabledRef.current) {
22844
+ enabledAtRef.current = /* @__PURE__ */ new Date();
22845
+ trackedRef.current.clear();
22583
22846
  }
22584
- closeGuardRef.current = true;
22585
- const promiseToReject = depositPromiseRef.current;
22586
- depositPromiseRef.current = null;
22587
- if (depositConfigRef.current?.onClose) {
22588
- depositConfigRef.current.onClose();
22847
+ if (!enabled) {
22848
+ trackedRef.current.clear();
22589
22849
  }
22590
- if (promiseToReject) {
22591
- promiseToReject.reject({
22592
- message: "Deposit cancelled by user",
22593
- code: "DEPOSIT_CANCELLED"
22850
+ prevEnabledRef.current = enabled;
22851
+ }, [enabled]);
22852
+ useEffect222(() => {
22853
+ if (!userId || !enabled) return;
22854
+ const enabledAt = enabledAtRef.current;
22855
+ const poll = async () => {
22856
+ try {
22857
+ const response = await queryExecutions(userId, publishableKey, ActionType.Withdraw);
22858
+ const cutoff = new Date(enabledAt.getTime() - CUTOFF_BUFFER_MS2);
22859
+ const sorted = [...response.data].sort((a, b) => {
22860
+ const tA = a.created_at ? new Date(a.created_at).getTime() : 0;
22861
+ const tB = b.created_at ? new Date(b.created_at).getTime() : 0;
22862
+ return tB - tA;
22863
+ });
22864
+ const inProgress = [ExecutionStatus.PENDING, ExecutionStatus.WAITING, ExecutionStatus.DELAYED];
22865
+ const terminal = [ExecutionStatus.SUCCEEDED, ExecutionStatus.FAILED];
22866
+ let target = null;
22867
+ for (const ex of sorted) {
22868
+ const t11 = ex.created_at ? new Date(ex.created_at) : null;
22869
+ if (!t11 || t11 < cutoff) continue;
22870
+ const prev = trackedRef.current.get(ex.id);
22871
+ if (!prev) {
22872
+ target = ex;
22873
+ break;
22874
+ }
22875
+ if (inProgress.includes(prev) && terminal.includes(ex.status)) {
22876
+ target = ex;
22877
+ break;
22878
+ }
22879
+ }
22880
+ if (target) {
22881
+ const ex = target;
22882
+ const exTime = ex.created_at ? new Date(ex.created_at) : null;
22883
+ if (!exTime || exTime < enabledAtRef.current) return;
22884
+ const prev = trackedRef.current.get(ex.id);
22885
+ trackedRef.current.set(ex.id, ex.status);
22886
+ setExecutions((list) => {
22887
+ const idx = list.findIndex((e) => e.id === ex.id);
22888
+ if (idx >= 0) {
22889
+ const u = [...list];
22890
+ u[idx] = ex;
22891
+ return u;
22892
+ }
22893
+ return [...list, ex];
22894
+ });
22895
+ if (ex.status === ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
22896
+ onSuccessRef.current?.({ message: "Withdrawal completed successfully", executionId: ex.id, transaction: ex });
22897
+ } else if (ex.status === ExecutionStatus.FAILED && prev !== ExecutionStatus.FAILED) {
22898
+ onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
22899
+ }
22900
+ }
22901
+ } catch (error) {
22902
+ console.error("Failed to fetch withdraw executions:", error);
22903
+ onErrorRef.current?.({ message: "Failed to fetch withdrawal status", code: "POLLING_ERROR", error });
22904
+ }
22905
+ };
22906
+ void poll();
22907
+ const interval = setInterval(poll, POLL_INTERVAL_MS2);
22908
+ setIsPolling(true);
22909
+ return () => {
22910
+ clearInterval(interval);
22911
+ setIsPolling(false);
22912
+ };
22913
+ }, [userId, publishableKey, enabled]);
22914
+ useEffect222(() => {
22915
+ if (!enabled || !depositWalletId) return;
22916
+ const trigger = async () => {
22917
+ try {
22918
+ await pollDirectExecutions({ deposit_wallet_id: depositWalletId }, publishableKey);
22919
+ } catch {
22920
+ }
22921
+ };
22922
+ trigger();
22923
+ const interval = setInterval(trigger, POLL_ENDPOINT_INTERVAL_MS2);
22924
+ return () => clearInterval(interval);
22925
+ }, [enabled, depositWalletId, publishableKey]);
22926
+ return { executions, isPolling };
22927
+ }
22928
+ var t7 = i18n2.withdrawModal;
22929
+ var getChainKey4 = (chainId, chainType) => `${chainType}:${chainId}`;
22930
+ function WithdrawDoubleInput({
22931
+ tokens,
22932
+ selectedTokenSymbol,
22933
+ selectedChainKey,
22934
+ onTokenChange,
22935
+ onChainChange,
22936
+ isLoading = false
22937
+ }) {
22938
+ const { fonts, components } = useTheme();
22939
+ const isDarkMode = useTheme().themeClass.includes("uf-dark");
22940
+ const selectedToken = selectedTokenSymbol ? tokens.find((t11) => t11.symbol === selectedTokenSymbol) : void 0;
22941
+ const availableChainsForToken = selectedToken?.chains || [];
22942
+ const renderTokenItem = (tokenData) => /* @__PURE__ */ jsxs45("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
22943
+ /* @__PURE__ */ jsx522(
22944
+ "img",
22945
+ {
22946
+ src: tokenData.icon_url,
22947
+ alt: tokenData.symbol,
22948
+ width: 20,
22949
+ height: 20,
22950
+ loading: "lazy",
22951
+ className: "uf-rounded-full uf-flex-shrink-0"
22952
+ }
22953
+ ),
22954
+ /* @__PURE__ */ jsx522("span", { className: "uf-text-xs uf-font-normal", children: tokenData.symbol })
22955
+ ] });
22956
+ const renderChainItem = (chainData) => /* @__PURE__ */ jsxs45("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
22957
+ /* @__PURE__ */ jsx522(
22958
+ "img",
22959
+ {
22960
+ src: chainData.icon_url,
22961
+ alt: chainData.chain_name,
22962
+ width: 20,
22963
+ height: 20,
22964
+ loading: "lazy",
22965
+ className: "uf-rounded-full uf-flex-shrink-0"
22966
+ }
22967
+ ),
22968
+ /* @__PURE__ */ jsx522("span", { className: "uf-text-xs uf-font-normal", children: chainData.chain_name })
22969
+ ] });
22970
+ const currentChainData = selectedChainKey ? availableChainsForToken.find(
22971
+ (c) => getChainKey4(c.chain_id, c.chain_type) === selectedChainKey
22972
+ ) : void 0;
22973
+ return /* @__PURE__ */ jsxs45("div", { className: "uf-grid uf-grid-cols-2 uf-gap-2.5", children: [
22974
+ /* @__PURE__ */ jsxs45("div", { children: [
22975
+ /* @__PURE__ */ jsx522(
22976
+ "div",
22977
+ {
22978
+ className: "uf-text-xs uf-mb-2 uf-flex uf-items-center uf-gap-1",
22979
+ style: { color: components.card.labelColor },
22980
+ children: t7.receiveToken
22981
+ }
22982
+ ),
22983
+ /* @__PURE__ */ jsxs45(
22984
+ Select2,
22985
+ {
22986
+ value: selectedTokenSymbol ?? "",
22987
+ onValueChange: onTokenChange,
22988
+ disabled: isLoading || tokens.length === 0,
22989
+ children: [
22990
+ /* @__PURE__ */ jsx522(
22991
+ SelectTrigger2,
22992
+ {
22993
+ className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50",
22994
+ style: {
22995
+ backgroundColor: components.card.backgroundColor,
22996
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
22997
+ },
22998
+ children: /* @__PURE__ */ jsx522(SelectValue2, { children: isLoading || !selectedTokenSymbol ? /* @__PURE__ */ jsx522("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t7.loading }) : selectedToken ? renderTokenItem(selectedToken) : /* @__PURE__ */ jsx522("span", { className: "uf-text-xs uf-font-normal", children: selectedTokenSymbol }) })
22999
+ }
23000
+ ),
23001
+ /* @__PURE__ */ jsx522(
23002
+ SelectContent2,
23003
+ {
23004
+ className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px]",
23005
+ style: {
23006
+ border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`,
23007
+ ...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
23008
+ },
23009
+ children: tokens.map((tokenData) => /* @__PURE__ */ jsx522(
23010
+ SelectItem2,
23011
+ {
23012
+ value: tokenData.symbol,
23013
+ className: "focus:uf-bg-accent focus:uf-text-foreground",
23014
+ children: renderTokenItem(tokenData)
23015
+ },
23016
+ tokenData.symbol
23017
+ ))
23018
+ }
23019
+ )
23020
+ ]
23021
+ }
23022
+ )
23023
+ ] }),
23024
+ /* @__PURE__ */ jsxs45("div", { children: [
23025
+ /* @__PURE__ */ jsx522(
23026
+ "div",
23027
+ {
23028
+ className: "uf-text-xs uf-mb-2 uf-flex uf-items-center uf-gap-1",
23029
+ style: { color: components.card.labelColor },
23030
+ children: t7.receiveChain
23031
+ }
23032
+ ),
23033
+ /* @__PURE__ */ jsxs45(
23034
+ Select2,
23035
+ {
23036
+ value: selectedChainKey ?? "",
23037
+ onValueChange: onChainChange,
23038
+ disabled: isLoading || availableChainsForToken.length === 0,
23039
+ children: [
23040
+ /* @__PURE__ */ jsx522(
23041
+ SelectTrigger2,
23042
+ {
23043
+ className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50",
23044
+ style: {
23045
+ backgroundColor: components.card.backgroundColor,
23046
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
23047
+ },
23048
+ children: /* @__PURE__ */ jsx522(SelectValue2, { children: isLoading || !selectedChainKey ? /* @__PURE__ */ jsx522("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t7.loading }) : currentChainData ? renderChainItem(currentChainData) : /* @__PURE__ */ jsx522("span", { className: "uf-text-xs uf-font-normal", children: selectedChainKey }) })
23049
+ }
23050
+ ),
23051
+ /* @__PURE__ */ jsx522(
23052
+ SelectContent2,
23053
+ {
23054
+ align: "end",
23055
+ className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px] uf-min-w-[200px]",
23056
+ style: {
23057
+ border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`,
23058
+ ...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
23059
+ },
23060
+ children: availableChainsForToken.length === 0 ? /* @__PURE__ */ jsx522("div", { className: "uf-px-2 uf-py-3 uf-text-xs uf-text-muted-foreground uf-text-center", children: "No chains available" }) : availableChainsForToken.map((chainData) => {
23061
+ const chainKey = getChainKey4(chainData.chain_id, chainData.chain_type);
23062
+ return /* @__PURE__ */ jsx522(
23063
+ SelectItem2,
23064
+ {
23065
+ value: chainKey,
23066
+ className: "focus:uf-bg-accent focus:uf-text-foreground",
23067
+ children: renderChainItem(chainData)
23068
+ },
23069
+ chainKey
23070
+ );
23071
+ })
23072
+ }
23073
+ )
23074
+ ]
23075
+ }
23076
+ )
23077
+ ] })
23078
+ ] });
23079
+ }
23080
+ function useVerifyRecipientAddress(params) {
23081
+ const {
23082
+ chainType,
23083
+ chainId,
23084
+ tokenAddress,
23085
+ recipientAddress,
23086
+ publishableKey,
23087
+ enabled = true
23088
+ } = params;
23089
+ const trimmedAddress = recipientAddress?.trim() || "";
23090
+ const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
23091
+ return useQuery13({
23092
+ queryKey: [
23093
+ "unifold",
23094
+ "verifyRecipientAddress",
23095
+ chainType ?? null,
23096
+ chainId ?? null,
23097
+ tokenAddress ?? null,
23098
+ trimmedAddress,
23099
+ publishableKey
23100
+ ],
23101
+ queryFn: () => verifyRecipientAddress(
23102
+ {
23103
+ chain_type: chainType,
23104
+ chain_id: chainId,
23105
+ token_address: tokenAddress,
23106
+ recipient_address: trimmedAddress
23107
+ },
23108
+ publishableKey
23109
+ ),
23110
+ enabled: enabled && hasAllParams,
23111
+ staleTime: 1e3 * 60 * 5,
23112
+ gcTime: 1e3 * 60 * 30,
23113
+ retry: 1,
23114
+ refetchOnMount: false,
23115
+ refetchOnWindowFocus: false
23116
+ });
23117
+ }
23118
+ async function sendEvmWithdraw(params) {
23119
+ const {
23120
+ provider,
23121
+ fromAddress,
23122
+ depositWalletAddress,
23123
+ sourceTokenAddress,
23124
+ sourceChainId,
23125
+ amountBaseUnit
23126
+ } = params;
23127
+ const currentChainIdHex = await provider.request({
23128
+ method: "eth_chainId",
23129
+ params: []
23130
+ });
23131
+ const currentChainId = parseInt(currentChainIdHex, 16).toString();
23132
+ if (currentChainId !== sourceChainId) {
23133
+ const requiredHex = "0x" + parseInt(sourceChainId).toString(16);
23134
+ try {
23135
+ await provider.request({
23136
+ method: "wallet_switchEthereumChain",
23137
+ params: [{ chainId: requiredHex }]
23138
+ });
23139
+ const newHex = await provider.request({ method: "eth_chainId", params: [] });
23140
+ if (parseInt(newHex, 16).toString() !== sourceChainId) {
23141
+ throw new Error(`Failed to switch to chain ${sourceChainId}. Please switch manually.`);
23142
+ }
23143
+ } catch (err) {
23144
+ if (err && typeof err === "object" && "code" in err) {
23145
+ const e = err;
23146
+ if (e.code === 4902) throw new Error(`Chain ${sourceChainId} is not configured in your wallet.`);
23147
+ if (e.code === 4001) throw new Error("You must approve the network switch to withdraw.");
23148
+ }
23149
+ throw err;
23150
+ }
23151
+ }
23152
+ const isNative = sourceTokenAddress === "native" || sourceTokenAddress === "0x0000000000000000000000000000000000000000" || sourceTokenAddress === "";
23153
+ const amountBig = BigInt(amountBaseUnit);
23154
+ const txParams = isNative ? { from: fromAddress, to: depositWalletAddress, value: "0x" + amountBig.toString(16) } : {
23155
+ from: fromAddress,
23156
+ to: sourceTokenAddress,
23157
+ data: "0xa9059cbb" + depositWalletAddress.slice(2).padStart(64, "0") + amountBig.toString(16).padStart(64, "0")
23158
+ };
23159
+ let gasEstimate;
23160
+ try {
23161
+ const hex = await provider.request({ method: "eth_estimateGas", params: [txParams] });
23162
+ gasEstimate = BigInt(hex);
23163
+ } catch {
23164
+ gasEstimate = isNative ? BigInt(21e3) : BigInt(65e3);
23165
+ }
23166
+ const gasPrice = BigInt(await provider.request({ method: "eth_gasPrice", params: [] }));
23167
+ const gasWithBuffer = gasEstimate * BigInt(120) / BigInt(100);
23168
+ const gasCost = gasWithBuffer * gasPrice;
23169
+ const ethBalance = BigInt(
23170
+ await provider.request({ method: "eth_getBalance", params: [fromAddress, "latest"] })
23171
+ );
23172
+ const totalRequired = isNative ? gasCost + amountBig : gasCost;
23173
+ if (ethBalance < totalRequired) {
23174
+ const gasFmt = (Number(gasCost) / 1e18).toFixed(6);
23175
+ if (isNative) {
23176
+ throw new Error(`Insufficient balance. Need ${(Number(totalRequired) / 1e18).toFixed(6)} ETH (amount + ~${gasFmt} gas).`);
23177
+ }
23178
+ throw new Error(`Insufficient ETH for gas. Need ~${gasFmt} ETH for fees.`);
23179
+ }
23180
+ const txHash = await provider.request({ method: "eth_sendTransaction", params: [txParams] });
23181
+ return txHash;
23182
+ }
23183
+ async function sendSolanaWithdraw(params) {
23184
+ const {
23185
+ provider,
23186
+ fromAddress,
23187
+ depositWalletAddress,
23188
+ sourceTokenAddress,
23189
+ amountBaseUnit,
23190
+ publishableKey
23191
+ } = params;
23192
+ if (!provider.publicKey) {
23193
+ await provider.connect();
23194
+ }
23195
+ const buildResponse = await buildSolanaTransaction(
23196
+ {
23197
+ chain_id: "mainnet",
23198
+ token_address: sourceTokenAddress === "" ? "native" : sourceTokenAddress,
23199
+ source_address: fromAddress,
23200
+ destination_address: depositWalletAddress,
23201
+ amount: amountBaseUnit
23202
+ },
23203
+ publishableKey
23204
+ );
23205
+ const { VersionedTransaction } = await import(
23206
+ /* @vite-ignore */
23207
+ "@solana/web3.js"
23208
+ );
23209
+ const binaryString = atob(buildResponse.transaction);
23210
+ const bytes = new Uint8Array(binaryString.length);
23211
+ for (let i = 0; i < binaryString.length; i++) {
23212
+ bytes[i] = binaryString.charCodeAt(i);
23213
+ }
23214
+ const transaction = VersionedTransaction.deserialize(bytes);
23215
+ const signedTransaction = await provider.signTransaction(transaction);
23216
+ const serialized = signedTransaction.serialize();
23217
+ let binaryStr = "";
23218
+ for (let i = 0; i < serialized.length; i++) {
23219
+ binaryStr += String.fromCharCode(serialized[i]);
23220
+ }
23221
+ const sendResponse = await sendSolanaTransaction(
23222
+ { chain_id: "mainnet", signed_transaction: btoa(binaryStr) },
23223
+ publishableKey
23224
+ );
23225
+ return sendResponse.signature;
23226
+ }
23227
+ async function detectBrowserWallet(chainType, senderAddress) {
23228
+ const win = typeof window !== "undefined" ? window : null;
23229
+ if (!win || !senderAddress) return null;
23230
+ const anyWin = win;
23231
+ if (chainType === "solana") {
23232
+ const solProviders = [];
23233
+ if (win.phantom?.solana) solProviders.push({ provider: win.phantom.solana, name: "Phantom" });
23234
+ if (anyWin.solflare) solProviders.push({ provider: anyWin.solflare, name: "Solflare" });
23235
+ if (anyWin.backpack) solProviders.push({ provider: anyWin.backpack, name: "Backpack" });
23236
+ if (anyWin.trustwallet?.solana) solProviders.push({ provider: anyWin.trustwallet.solana, name: "Trust Wallet" });
23237
+ for (const { provider, name } of solProviders) {
23238
+ if (!provider) continue;
23239
+ try {
23240
+ let addr;
23241
+ if (provider.isConnected && provider.publicKey) {
23242
+ addr = provider.publicKey.toString();
23243
+ } else {
23244
+ const resp = await provider.connect({ onlyIfTrusted: true });
23245
+ if (resp?.publicKey) addr = resp.publicKey.toString();
23246
+ }
23247
+ if (addr && addr === senderAddress) {
23248
+ return { chainFamily: "solana", provider, name, address: addr };
23249
+ }
23250
+ } catch {
23251
+ }
23252
+ }
23253
+ }
23254
+ if (chainType === "ethereum") {
23255
+ const evmProviders = [];
23256
+ const seen = /* @__PURE__ */ new Set();
23257
+ const add = (p, name) => {
23258
+ if (p && typeof p.request === "function" && !seen.has(p)) {
23259
+ seen.add(p);
23260
+ evmProviders.push({ provider: p, name });
23261
+ }
23262
+ };
23263
+ add(anyWin.phantom?.ethereum, "Phantom");
23264
+ add(anyWin.coinbaseWalletExtension, "Coinbase");
23265
+ add(anyWin.trustwallet?.ethereum, "Trust Wallet");
23266
+ add(anyWin.okxwallet, "OKX Wallet");
23267
+ if (anyWin.__eip6963Providers) {
23268
+ for (const detail of anyWin.__eip6963Providers) {
23269
+ const rdns = detail.info?.rdns || "";
23270
+ let name = detail.info?.name || "Wallet";
23271
+ if (rdns.includes("metamask")) name = "MetaMask";
23272
+ else if (rdns.includes("rabby")) name = "Rabby";
23273
+ else if (rdns.includes("rainbow")) name = "Rainbow";
23274
+ add(detail.provider, name);
23275
+ }
23276
+ }
23277
+ if (win.ethereum) {
23278
+ const eth = win.ethereum;
23279
+ let name = "Wallet";
23280
+ if (eth.isMetaMask && !eth.isPhantom && !eth.isRabby) name = "MetaMask";
23281
+ else if (eth.isRabby) name = "Rabby";
23282
+ else if (eth.isRainbow) name = "Rainbow";
23283
+ else if (eth.isCoinbaseWallet) name = "Coinbase";
23284
+ add(eth, name);
23285
+ }
23286
+ for (const { provider, name } of evmProviders) {
23287
+ try {
23288
+ const accounts = await provider.request({ method: "eth_accounts" });
23289
+ if (accounts?.length > 0 && accounts[0].toLowerCase() === senderAddress.toLowerCase()) {
23290
+ return { chainFamily: "evm", provider, name, address: accounts[0] };
23291
+ }
23292
+ } catch {
23293
+ }
23294
+ }
23295
+ }
23296
+ return null;
23297
+ }
23298
+ var t8 = i18n2.withdrawModal;
23299
+ var tCrypto = i18n2.transferCrypto;
23300
+ function formatProcessingTime2(seconds) {
23301
+ if (seconds === null) {
23302
+ return tCrypto.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
23303
+ }
23304
+ const minutes = Math.ceil(seconds / 60);
23305
+ if (minutes < 60) {
23306
+ return tCrypto.processingTime.lessThanMinutes.replace("{{minutes}}", String(minutes));
23307
+ }
23308
+ const hours = Math.ceil(minutes / 60);
23309
+ return tCrypto.processingTime.lessThanHours.replace("{{hours}}", String(hours));
23310
+ }
23311
+ function computeBaseUnit(balanceBaseUnit, inputAmount, balanceAmount) {
23312
+ if (balanceAmount <= 0 || inputAmount <= 0) return "0";
23313
+ if (inputAmount >= balanceAmount) return balanceBaseUnit;
23314
+ const PRECISION = 10n ** 18n;
23315
+ const ratioScaled = BigInt(Math.round(inputAmount / balanceAmount * Number(PRECISION)));
23316
+ const result = BigInt(balanceBaseUnit) * ratioScaled / PRECISION;
23317
+ return result.toString();
23318
+ }
23319
+ function toSafeDecimalString(n, maxDecimals) {
23320
+ if (n === 0) return "0";
23321
+ return n.toFixed(maxDecimals).replace(/\.?0+$/, "");
23322
+ }
23323
+ function WithdrawForm({
23324
+ publishableKey,
23325
+ externalUserId,
23326
+ sourceChainType,
23327
+ selectedToken,
23328
+ selectedChain,
23329
+ sourceTokenSymbol,
23330
+ recipientAddressProp,
23331
+ balanceData,
23332
+ isLoadingBalance,
23333
+ minimumWithdrawAmountUsd,
23334
+ estimatedProcessingTime,
23335
+ maxSlippagePercent,
23336
+ priceImpactPercent,
23337
+ detectedWallet,
23338
+ sourceChainId,
23339
+ sourceTokenAddress,
23340
+ isWalletMatch,
23341
+ connectedWalletName,
23342
+ canWithdraw,
23343
+ onWithdraw,
23344
+ onWithdrawError,
23345
+ onDepositWalletCreation,
23346
+ onWithdrawSubmitted,
23347
+ footerLeft
23348
+ }) {
23349
+ const { colors: colors2, fonts, components } = useTheme();
23350
+ const [recipientAddress, setRecipientAddress] = useState29(recipientAddressProp || "");
23351
+ const [amount, setAmount] = useState29("");
23352
+ const [inputUnit, setInputUnit] = useState29("crypto");
23353
+ const [isSubmitting, setIsSubmitting] = useState29(false);
23354
+ const [submitError, setSubmitError] = useState29(null);
23355
+ const [detailsExpanded, setDetailsExpanded] = useState29(false);
23356
+ const [glossaryOpen, setGlossaryOpen] = useState29(false);
23357
+ useEffect232(() => {
23358
+ setRecipientAddress(recipientAddressProp || "");
23359
+ setAmount("");
23360
+ setInputUnit("crypto");
23361
+ setSubmitError(null);
23362
+ }, [recipientAddressProp]);
23363
+ const trimmedAddress = recipientAddress.trim();
23364
+ const [debouncedAddress, setDebouncedAddress] = useState29(trimmedAddress);
23365
+ useEffect232(() => {
23366
+ const id = setTimeout(() => setDebouncedAddress(trimmedAddress), 500);
23367
+ return () => clearTimeout(id);
23368
+ }, [trimmedAddress]);
23369
+ const {
23370
+ data: addressVerification,
23371
+ isLoading: isVerifyingAddress,
23372
+ error: verifyError
23373
+ } = useVerifyRecipientAddress({
23374
+ chainType: selectedChain?.chain_type,
23375
+ chainId: selectedChain?.chain_id,
23376
+ tokenAddress: selectedChain?.token_address,
23377
+ recipientAddress: debouncedAddress,
23378
+ publishableKey,
23379
+ enabled: debouncedAddress.length > 5 && !!selectedChain
23380
+ });
23381
+ const isDebouncing = trimmedAddress !== debouncedAddress;
23382
+ const addressError = useMemo102(() => {
23383
+ if (!trimmedAddress || trimmedAddress.length <= 5) return null;
23384
+ if (isDebouncing || isVerifyingAddress) return null;
23385
+ if (verifyError) return t8.invalidAddress;
23386
+ if (addressVerification && !addressVerification.valid) {
23387
+ if (addressVerification.failure_code === "account_not_found")
23388
+ return `Account not found on ${selectedChain?.chain_name}`;
23389
+ if (addressVerification.failure_code === "not_opted_in")
23390
+ return `Recipient has not opted in to ${selectedToken?.symbol} on ${selectedChain?.chain_name}`;
23391
+ return t8.invalidAddress;
23392
+ }
23393
+ return null;
23394
+ }, [trimmedAddress, isDebouncing, isVerifyingAddress, verifyError, addressVerification, selectedChain, selectedToken]);
23395
+ const isAddressValid = !isDebouncing && !!addressVerification?.valid && !addressError;
23396
+ const exchangeRate = useMemo102(() => {
23397
+ if (!balanceData?.exchangeRate) return 0;
23398
+ return parseFloat(balanceData.exchangeRate);
23399
+ }, [balanceData]);
23400
+ const balanceCrypto = useMemo102(() => {
23401
+ if (!balanceData?.balanceHuman) return 0;
23402
+ return parseFloat(balanceData.balanceHuman);
23403
+ }, [balanceData]);
23404
+ const balanceUsdNum = useMemo102(() => {
23405
+ if (!balanceData?.balanceUsd) return 0;
23406
+ return parseFloat(balanceData.balanceUsd);
23407
+ }, [balanceData]);
23408
+ const tokenSymbol = sourceTokenSymbol || balanceData?.symbol || "TOKEN";
23409
+ const sourceDecimals = balanceData?.decimals ?? 6;
23410
+ const cryptoAmountFromInput = useMemo102(() => {
23411
+ const val = parseFloat(amount);
23412
+ if (!val || val <= 0) return 0;
23413
+ if (inputUnit === "crypto") return val;
23414
+ return exchangeRate > 0 ? val / exchangeRate : 0;
23415
+ }, [amount, inputUnit, exchangeRate]);
23416
+ const fiatAmountFromInput = useMemo102(() => {
23417
+ const val = parseFloat(amount);
23418
+ if (!val || val <= 0) return 0;
23419
+ if (inputUnit === "fiat") return val;
23420
+ return val * exchangeRate;
23421
+ }, [amount, inputUnit, exchangeRate]);
23422
+ const convertedDisplay = useMemo102(() => {
23423
+ if (!amount || parseFloat(amount) <= 0) return null;
23424
+ if (inputUnit === "crypto") {
23425
+ return `$${fiatAmountFromInput.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
23426
+ }
23427
+ return `${cryptoAmountFromInput.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 6 })} ${tokenSymbol}`;
23428
+ }, [amount, inputUnit, fiatAmountFromInput, cryptoAmountFromInput, tokenSymbol]);
23429
+ const balanceDisplay = useMemo102(() => {
23430
+ if (isLoadingBalance || !balanceData) return null;
23431
+ if (inputUnit === "crypto") {
23432
+ return `${balanceCrypto.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${tokenSymbol}`;
23433
+ }
23434
+ return `$${balanceUsdNum.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
23435
+ }, [isLoadingBalance, balanceData, inputUnit, balanceCrypto, balanceUsdNum, tokenSymbol]);
23436
+ const handleSwitchUnit = useCallback52(() => {
23437
+ const val = parseFloat(amount);
23438
+ if (!val || val <= 0 || exchangeRate <= 0) {
23439
+ setInputUnit((u) => u === "crypto" ? "fiat" : "crypto");
23440
+ setAmount("");
23441
+ return;
23442
+ }
23443
+ if (inputUnit === "crypto") {
23444
+ const fiat = val * exchangeRate;
23445
+ setAmount(fiat.toFixed(2));
23446
+ setInputUnit("fiat");
23447
+ } else {
23448
+ const crypto = val / exchangeRate;
23449
+ setAmount(crypto.toFixed(sourceDecimals > 6 ? 6 : sourceDecimals));
23450
+ setInputUnit("crypto");
23451
+ }
23452
+ }, [amount, inputUnit, exchangeRate, sourceDecimals]);
23453
+ const handleMaxClick = useCallback52(() => {
23454
+ if (inputUnit === "crypto") {
23455
+ if (balanceCrypto <= 0) return;
23456
+ setAmount(balanceData?.balanceHuman ?? "0");
23457
+ } else {
23458
+ if (balanceUsdNum <= 0) return;
23459
+ setAmount((Math.floor(balanceUsdNum * 100) / 100).toFixed(2));
23460
+ }
23461
+ }, [inputUnit, balanceCrypto, balanceUsdNum, balanceData]);
23462
+ const isBelowMinimum = minimumWithdrawAmountUsd !== null && fiatAmountFromInput > 0 && fiatAmountFromInput < minimumWithdrawAmountUsd;
23463
+ const isOverBalance = inputUnit === "crypto" ? cryptoAmountFromInput > 0 && balanceCrypto > 0 && cryptoAmountFromInput > balanceCrypto : fiatAmountFromInput > 0 && balanceUsdNum > 0 && fiatAmountFromInput > balanceUsdNum;
23464
+ const isFormValid = trimmedAddress.length > 0 && amount.trim().length > 0 && cryptoAmountFromInput > 0 && isAddressValid && !isBelowMinimum && !isOverBalance && !!balanceData;
23465
+ const handleWithdraw = useCallback52(async () => {
23466
+ if (!selectedToken || !selectedChain) return;
23467
+ if (!isFormValid) return;
23468
+ setIsSubmitting(true);
23469
+ setSubmitError(null);
23470
+ try {
23471
+ const depositWallet = await onDepositWalletCreation({
23472
+ destinationChainType: selectedChain.chain_type,
23473
+ destinationChainId: selectedChain.chain_id,
23474
+ destinationTokenAddress: selectedChain.token_address,
23475
+ recipientAddress: trimmedAddress
23476
+ });
23477
+ const amountBaseUnit = computeBaseUnit(
23478
+ balanceData.balanceBaseUnit,
23479
+ parseFloat(amount),
23480
+ inputUnit === "crypto" ? balanceCrypto : balanceUsdNum
23481
+ );
23482
+ const humanAmount = toSafeDecimalString(cryptoAmountFromInput, sourceDecimals);
23483
+ const txInfo = {
23484
+ sourceChainType,
23485
+ sourceChainId,
23486
+ sourceTokenAddress,
23487
+ sourceTokenSymbol: tokenSymbol,
23488
+ destinationChainType: selectedChain.chain_type,
23489
+ destinationChainId: selectedChain.chain_id,
23490
+ destinationTokenAddress: selectedChain.token_address,
23491
+ destinationTokenSymbol: selectedToken.symbol,
23492
+ amount: humanAmount,
23493
+ amountBaseUnit,
23494
+ withdrawIntentAddress: depositWallet.address,
23495
+ recipientAddress: trimmedAddress
23496
+ };
23497
+ if (detectedWallet) {
23498
+ if (detectedWallet.chainFamily === "evm") {
23499
+ await sendEvmWithdraw({
23500
+ provider: detectedWallet.provider,
23501
+ fromAddress: detectedWallet.address,
23502
+ depositWalletAddress: depositWallet.address,
23503
+ sourceTokenAddress,
23504
+ sourceChainId,
23505
+ amountBaseUnit
23506
+ });
23507
+ } else if (detectedWallet.chainFamily === "solana") {
23508
+ await sendSolanaWithdraw({
23509
+ provider: detectedWallet.provider,
23510
+ fromAddress: detectedWallet.address,
23511
+ depositWalletAddress: depositWallet.address,
23512
+ sourceTokenAddress,
23513
+ amountBaseUnit,
23514
+ publishableKey
23515
+ });
23516
+ }
23517
+ } else if (onWithdraw) {
23518
+ await onWithdraw(txInfo);
23519
+ } else {
23520
+ throw new Error("No withdrawal method available. Please connect a wallet.");
23521
+ }
23522
+ onWithdrawSubmitted?.(txInfo);
23523
+ } catch (err) {
23524
+ const raw = err instanceof Error ? err.message : "Withdrawal failed. Please try again.";
23525
+ setSubmitError(raw.length > 120 ? "Withdrawal failed. Please try again." : raw);
23526
+ onWithdrawError?.({
23527
+ message: raw,
23528
+ error: err,
23529
+ code: "WITHDRAW_FAILED"
23530
+ });
23531
+ } finally {
23532
+ setIsSubmitting(false);
23533
+ }
23534
+ }, [selectedToken, selectedChain, isFormValid, cryptoAmountFromInput, sourceDecimals, trimmedAddress, publishableKey, onWithdraw, detectedWallet, sourceTokenAddress, sourceChainId, onWithdrawError, onDepositWalletCreation, onWithdrawSubmitted, amount, inputUnit, balanceCrypto, balanceUsdNum, balanceData]);
23535
+ return /* @__PURE__ */ jsxs46(Fragment10, { children: [
23536
+ /* @__PURE__ */ jsxs46("div", { children: [
23537
+ /* @__PURE__ */ jsx53(
23538
+ "div",
23539
+ {
23540
+ className: "uf-text-xs uf-mb-1.5",
23541
+ style: { color: components.card.labelColor, fontFamily: fonts.medium },
23542
+ children: t8.recipientAddress
23543
+ }
23544
+ ),
23545
+ /* @__PURE__ */ jsx53(
23546
+ "style",
23547
+ {
23548
+ dangerouslySetInnerHTML: {
23549
+ __html: `.uf-withdraw-addr::placeholder { color: ${components.search.placeholderColor}; }`
23550
+ }
23551
+ }
23552
+ ),
23553
+ /* @__PURE__ */ jsxs46(
23554
+ "div",
23555
+ {
23556
+ className: "uf-flex uf-items-center uf-gap-1 uf-pr-2",
23557
+ style: {
23558
+ backgroundColor: components.search.backgroundColor,
23559
+ borderRadius: components.input.borderRadius,
23560
+ border: `${components.input.borderWidth}px solid ${addressError ? colors2.error : components.input.borderColor}`
23561
+ },
23562
+ children: [
23563
+ /* @__PURE__ */ jsx53(
23564
+ "input",
23565
+ {
23566
+ type: "text",
23567
+ placeholder: t8.recipientAddressPlaceholder,
23568
+ value: recipientAddress,
23569
+ onChange: (e) => {
23570
+ setRecipientAddress(e.target.value);
23571
+ setSubmitError(null);
23572
+ },
23573
+ className: "uf-withdraw-addr uf-flex-1 uf-min-w-0 uf-px-3 uf-py-2.5 uf-text-sm uf-bg-transparent uf-outline-none",
23574
+ style: {
23575
+ color: components.search.inputColor,
23576
+ fontFamily: fonts.regular
23577
+ }
23578
+ }
23579
+ ),
23580
+ /* @__PURE__ */ jsx53(
23581
+ "button",
23582
+ {
23583
+ type: "button",
23584
+ onClick: async () => {
23585
+ try {
23586
+ const text = await navigator.clipboard.readText();
23587
+ if (text) {
23588
+ setRecipientAddress(text.trim());
23589
+ setSubmitError(null);
23590
+ }
23591
+ } catch {
23592
+ }
23593
+ },
23594
+ className: "uf-flex-shrink-0 uf-p-1 uf-rounded uf-transition-colors hover:uf-opacity-70",
23595
+ style: { color: colors2.foregroundMuted },
23596
+ title: "Paste from clipboard",
23597
+ children: /* @__PURE__ */ jsx53(ClipboardPaste, { className: "uf-w-4 uf-h-4" })
23598
+ }
23599
+ )
23600
+ ]
23601
+ }
23602
+ ),
23603
+ (isDebouncing || isVerifyingAddress) && trimmedAddress.length > 5 && /* @__PURE__ */ jsxs46("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-1.5", children: [
23604
+ /* @__PURE__ */ jsx53(LoaderCircle, { className: "uf-w-3 uf-h-3 uf-animate-spin", style: { color: colors2.foregroundMuted } }),
23605
+ /* @__PURE__ */ jsx53("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: t8.verifyingAddress })
23606
+ ] }),
23607
+ addressError && /* @__PURE__ */ jsxs46("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-1.5", children: [
23608
+ /* @__PURE__ */ jsx53(TriangleAlert, { className: "uf-w-3 uf-h-3", style: { color: colors2.error } }),
23609
+ /* @__PURE__ */ jsx53("span", { className: "uf-text-xs", style: { color: colors2.error, fontFamily: fonts.regular }, children: addressError })
23610
+ ] })
23611
+ ] }),
23612
+ /* @__PURE__ */ jsxs46("div", { children: [
23613
+ /* @__PURE__ */ jsxs46("div", { className: "uf-text-xs uf-mb-1.5", style: { color: components.card.labelColor, fontFamily: fonts.medium }, children: [
23614
+ t8.amount,
23615
+ minimumWithdrawAmountUsd != null && minimumWithdrawAmountUsd > 0 && /* @__PURE__ */ jsx53("span", { style: { color: colors2.warning, fontFamily: fonts.regular }, children: ` ($${minimumWithdrawAmountUsd.toFixed(2)} min)` })
23616
+ ] }),
23617
+ /* @__PURE__ */ jsx53(
23618
+ "style",
23619
+ {
23620
+ dangerouslySetInnerHTML: {
23621
+ __html: `.uf-withdraw-amt::placeholder { color: ${components.search.placeholderColor}; }`
23622
+ }
23623
+ }
23624
+ ),
23625
+ /* @__PURE__ */ jsxs46(
23626
+ "div",
23627
+ {
23628
+ className: "uf-flex uf-items-center uf-gap-2 uf-px-3 uf-py-2.5",
23629
+ style: {
23630
+ backgroundColor: components.search.backgroundColor,
23631
+ borderRadius: components.input.borderRadius,
23632
+ border: `${components.input.borderWidth}px solid ${components.input.borderColor}`
23633
+ },
23634
+ children: [
23635
+ /* @__PURE__ */ jsx53(
23636
+ "input",
23637
+ {
23638
+ type: "text",
23639
+ inputMode: "decimal",
23640
+ placeholder: "0.00",
23641
+ value: amount,
23642
+ onChange: (e) => {
23643
+ const val = e.target.value;
23644
+ if (val === "" || /^\d*\.?\d*$/.test(val)) {
23645
+ setAmount(val);
23646
+ setSubmitError(null);
23647
+ }
23648
+ },
23649
+ className: "uf-withdraw-amt uf-flex-1 uf-min-w-0 uf-bg-transparent uf-text-sm uf-outline-none",
23650
+ style: {
23651
+ color: components.search.inputColor,
23652
+ fontFamily: fonts.regular
23653
+ }
23654
+ }
23655
+ ),
23656
+ /* @__PURE__ */ jsx53("span", { className: "uf-text-sm uf-shrink-0", style: { color: colors2.foregroundMuted, fontFamily: fonts.medium }, children: inputUnit === "crypto" ? tokenSymbol : "USD" }),
23657
+ /* @__PURE__ */ jsx53(
23658
+ "button",
23659
+ {
23660
+ type: "button",
23661
+ onClick: handleMaxClick,
23662
+ className: "uf-shrink-0 uf-px-2 uf-py-0.5 uf-rounded-md uf-text-xs uf-font-medium uf-transition-colors hover:uf-opacity-80",
23663
+ style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium },
23664
+ children: "Max"
23665
+ }
23666
+ )
23667
+ ]
23668
+ }
23669
+ ),
23670
+ /* @__PURE__ */ jsxs46("div", { className: "uf-flex uf-items-center uf-justify-between uf-mt-1.5 uf-px-3", children: [
23671
+ /* @__PURE__ */ jsxs46("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
23672
+ /* @__PURE__ */ jsx53("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: convertedDisplay || (inputUnit === "crypto" ? "$0.00" : `0.00 ${tokenSymbol}`) }),
23673
+ exchangeRate > 0 && /* @__PURE__ */ jsx53(
23674
+ "button",
23675
+ {
23676
+ type: "button",
23677
+ onClick: handleSwitchUnit,
23678
+ className: "uf-p-0.5 uf-rounded uf-transition-colors hover:uf-opacity-70",
23679
+ style: { color: colors2.foregroundMuted },
23680
+ title: "Switch unit",
23681
+ children: /* @__PURE__ */ jsx53(ArrowUpDown, { className: "uf-w-3 uf-h-3" })
23682
+ }
23683
+ )
23684
+ ] }),
23685
+ /* @__PURE__ */ jsxs46("div", { children: [
23686
+ balanceDisplay && /* @__PURE__ */ jsxs46("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: [
23687
+ t8.balance,
23688
+ ": ",
23689
+ balanceDisplay
23690
+ ] }),
23691
+ isLoadingBalance && /* @__PURE__ */ jsx53("div", { className: "uf-h-3 uf-w-16 uf-bg-muted uf-rounded uf-animate-pulse" })
23692
+ ] })
23693
+ ] })
23694
+ ] }),
23695
+ /* @__PURE__ */ jsxs46("div", { className: "uf-px-2.5", style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` }, children: [
23696
+ /* @__PURE__ */ jsxs46(
23697
+ "button",
23698
+ {
23699
+ type: "button",
23700
+ onClick: () => setDetailsExpanded(!detailsExpanded),
23701
+ className: "uf-w-full uf-flex uf-items-center uf-justify-between uf-py-2.5",
23702
+ children: [
23703
+ /* @__PURE__ */ jsxs46("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
23704
+ /* @__PURE__ */ jsx53("div", { className: "uf-rounded-full uf-p-1", style: { backgroundColor: components.card.iconBackgroundColor }, children: /* @__PURE__ */ jsx53(Clock, { className: "uf-w-3 uf-h-3", style: { color: components.card.iconColor } }) }),
23705
+ /* @__PURE__ */ jsxs46("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
23706
+ tCrypto.processingTime.label,
23707
+ ":",
23708
+ " ",
23709
+ /* @__PURE__ */ jsx53("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime2(estimatedProcessingTime) })
23710
+ ] })
23711
+ ] }),
23712
+ detailsExpanded ? /* @__PURE__ */ jsx53(ChevronUp, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } }) : /* @__PURE__ */ jsx53(ChevronDown, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } })
23713
+ ]
23714
+ }
23715
+ ),
23716
+ detailsExpanded && /* @__PURE__ */ jsxs46("div", { className: "uf-pb-3 uf-space-y-2.5", children: [
23717
+ /* @__PURE__ */ jsxs46("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
23718
+ /* @__PURE__ */ jsx53("div", { className: "uf-rounded-full uf-p-1", style: { backgroundColor: components.card.iconBackgroundColor }, children: /* @__PURE__ */ jsx53(ShieldCheck, { className: "uf-w-3 uf-h-3", style: { color: components.card.iconColor } }) }),
23719
+ /* @__PURE__ */ jsxs46("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
23720
+ tCrypto.slippage.label,
23721
+ ":",
23722
+ " ",
23723
+ /* @__PURE__ */ jsxs46("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: [
23724
+ tCrypto.slippage.auto,
23725
+ " \u2022 ",
23726
+ (maxSlippagePercent ?? 0.25).toFixed(2),
23727
+ "%"
23728
+ ] })
23729
+ ] })
23730
+ ] }),
23731
+ /* @__PURE__ */ jsxs46("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
23732
+ /* @__PURE__ */ jsx53("div", { className: "uf-rounded-full uf-p-1", style: { backgroundColor: components.card.iconBackgroundColor }, children: /* @__PURE__ */ jsx53(DollarSign, { className: "uf-w-3 uf-h-3", style: { color: components.card.iconColor } }) }),
23733
+ /* @__PURE__ */ jsxs46("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
23734
+ tCrypto.priceImpact.label,
23735
+ ":",
23736
+ " ",
23737
+ /* @__PURE__ */ jsxs46("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: [
23738
+ (priceImpactPercent ?? 0).toFixed(2),
23739
+ "%"
23740
+ ] })
23741
+ ] })
23742
+ ] })
23743
+ ] })
23744
+ ] }),
23745
+ !canWithdraw && !submitError && /* @__PURE__ */ jsxs46(
23746
+ "div",
23747
+ {
23748
+ className: "uf-flex uf-items-start uf-gap-2.5 uf-p-3 uf-rounded-xl",
23749
+ style: { backgroundColor: colors2.card, border: `1px solid ${colors2.border}` },
23750
+ children: [
23751
+ /* @__PURE__ */ jsx53(Wallet, { className: "uf-w-4 uf-h-4 uf-flex-shrink-0 uf-mt-0.5", style: { color: colors2.warning } }),
23752
+ /* @__PURE__ */ jsx53("div", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: "No connected wallet detected. Please connect a wallet that matches your account to withdraw." })
23753
+ ]
23754
+ }
23755
+ ),
23756
+ isWalletMatch && connectedWalletName ? /* @__PURE__ */ jsx53(
23757
+ "button",
23758
+ {
23759
+ type: "button",
23760
+ onClick: handleWithdraw,
23761
+ disabled: !isFormValid || !canWithdraw || isSubmitting || !selectedToken || !selectedChain,
23762
+ className: "uf-w-full uf-py-3 uf-text-sm uf-font-medium uf-transition-colors disabled:uf-opacity-50 disabled:uf-cursor-not-allowed uf-flex uf-items-center uf-justify-center uf-gap-2",
23763
+ style: {
23764
+ backgroundColor: colors2.primary,
23765
+ color: colors2.primaryForeground,
23766
+ fontFamily: fonts.medium,
23767
+ borderRadius: components.button.borderRadius,
23768
+ border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
23769
+ },
23770
+ children: isSubmitting ? /* @__PURE__ */ jsxs46(Fragment10, { children: [
23771
+ /* @__PURE__ */ jsx53(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }),
23772
+ "Processing..."
23773
+ ] }) : isOverBalance ? /* @__PURE__ */ jsx53(Fragment10, { children: "Insufficient balance" }) : isBelowMinimum ? /* @__PURE__ */ jsx53(Fragment10, { children: "Minimum amount not met" }) : submitError ? /* @__PURE__ */ jsx53(Fragment10, { children: "Withdrawal failed. Try again" }) : /* @__PURE__ */ jsxs46(Fragment10, { children: [
23774
+ /* @__PURE__ */ jsx53(Wallet, { className: "uf-w-4 uf-h-4" }),
23775
+ "Withdraw from ",
23776
+ connectedWalletName
23777
+ ] })
23778
+ }
23779
+ ) : /* @__PURE__ */ jsx53(
23780
+ "button",
23781
+ {
23782
+ type: "button",
23783
+ onClick: handleWithdraw,
23784
+ disabled: !isFormValid || !canWithdraw || isSubmitting || !selectedToken || !selectedChain,
23785
+ className: "uf-w-full uf-py-3 uf-text-sm uf-font-medium uf-transition-colors disabled:uf-opacity-50 disabled:uf-cursor-not-allowed",
23786
+ style: {
23787
+ backgroundColor: colors2.primary,
23788
+ color: colors2.primaryForeground,
23789
+ fontFamily: fonts.medium,
23790
+ borderRadius: components.button.borderRadius,
23791
+ border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
23792
+ },
23793
+ children: isSubmitting ? /* @__PURE__ */ jsxs46("span", { className: "uf-flex uf-items-center uf-justify-center uf-gap-2", children: [
23794
+ /* @__PURE__ */ jsx53(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }),
23795
+ "Processing..."
23796
+ ] }) : isOverBalance ? "Insufficient balance" : isBelowMinimum ? "Minimum amount not met" : submitError ? "Withdrawal failed. Try again" : t8.withdraw
23797
+ }
23798
+ ),
23799
+ /* @__PURE__ */ jsxs46("div", { className: "uf-flex uf-items-center uf-justify-between uf-text-xs uf-pt-1", children: [
23800
+ /* @__PURE__ */ jsx53("div", { children: footerLeft }),
23801
+ /* @__PURE__ */ jsx53(DepositFooterLinks, { onGlossaryClick: () => setGlossaryOpen(true) })
23802
+ ] }),
23803
+ /* @__PURE__ */ jsx53(
23804
+ GlossaryModal,
23805
+ {
23806
+ open: glossaryOpen,
23807
+ onOpenChange: setGlossaryOpen
23808
+ }
23809
+ )
23810
+ ] });
23811
+ }
23812
+ function WithdrawExecutionItem({
23813
+ execution,
23814
+ onClick
23815
+ }) {
23816
+ const { colors: colors2, fonts, components } = useTheme();
23817
+ const isPending = execution.status === ExecutionStatus.PENDING || execution.status === ExecutionStatus.WAITING || execution.status === ExecutionStatus.DELAYED;
23818
+ const formatDateTime = (timestamp) => {
23819
+ try {
23820
+ const date = new Date(timestamp);
23821
+ const monthDay = date.toLocaleDateString("en-US", {
23822
+ month: "short",
23823
+ day: "numeric",
23824
+ year: "numeric"
23825
+ });
23826
+ const time = date.toLocaleTimeString("en-US", {
23827
+ hour: "numeric",
23828
+ minute: "2-digit",
23829
+ hour12: true
23830
+ }).toLowerCase();
23831
+ return `${monthDay} at ${time}`;
23832
+ } catch {
23833
+ return timestamp;
23834
+ }
23835
+ };
23836
+ const formatUsdAmount2 = (sourceAmountUsd) => {
23837
+ try {
23838
+ const amount = Number(sourceAmountUsd);
23839
+ return new Intl.NumberFormat("en-US", {
23840
+ style: "currency",
23841
+ currency: "USD",
23842
+ minimumFractionDigits: 2,
23843
+ maximumFractionDigits: 2
23844
+ }).format(amount);
23845
+ } catch {
23846
+ return "$0.00";
23847
+ }
23848
+ };
23849
+ return /* @__PURE__ */ jsxs47(
23850
+ "button",
23851
+ {
23852
+ onClick,
23853
+ className: "uf-w-full uf-p-3 uf-flex uf-items-center uf-gap-3 hover:uf-bg-secondary/80 uf-transition-colors uf-text-left",
23854
+ style: {
23855
+ backgroundColor: components.card.backgroundColor,
23856
+ borderRadius: components.list.rowBorderRadius,
23857
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
23858
+ },
23859
+ children: [
23860
+ /* @__PURE__ */ jsxs47("div", { className: "uf-relative uf-flex-shrink-0 uf-w-9 uf-h-9", children: [
23861
+ /* @__PURE__ */ jsx54(
23862
+ "img",
23863
+ {
23864
+ src: execution.destination_token_metadata?.icon_url || getIconUrl("/icons/tokens/svg/usdc.svg"),
23865
+ alt: "Token",
23866
+ width: 36,
23867
+ height: 36,
23868
+ loading: "lazy",
23869
+ className: "uf-rounded-full uf-w-9 uf-h-9"
23870
+ }
23871
+ ),
23872
+ isPending ? /* @__PURE__ */ jsx54(
23873
+ "div",
23874
+ {
23875
+ className: "uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-rounded-full uf-p-0.5",
23876
+ style: { backgroundColor: colors2.warning },
23877
+ children: /* @__PURE__ */ jsx54(
23878
+ "svg",
23879
+ {
23880
+ width: "10",
23881
+ height: "10",
23882
+ viewBox: "0 0 12 12",
23883
+ fill: "none",
23884
+ className: "uf-animate-spin uf-block",
23885
+ children: /* @__PURE__ */ jsx54(
23886
+ "path",
23887
+ {
23888
+ d: "M6 1V3M6 9V11M1 6H3M9 6H11M2.5 2.5L4 4M8 8L9.5 9.5M2.5 9.5L4 8M8 4L9.5 2.5",
23889
+ stroke: "white",
23890
+ strokeWidth: "2",
23891
+ strokeLinecap: "round"
23892
+ }
23893
+ )
23894
+ }
23895
+ )
23896
+ }
23897
+ ) : /* @__PURE__ */ jsx54(
23898
+ "div",
23899
+ {
23900
+ className: "uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-rounded-full uf-p-0.5",
23901
+ style: { backgroundColor: colors2.success },
23902
+ children: /* @__PURE__ */ jsx54(
23903
+ "svg",
23904
+ {
23905
+ width: "10",
23906
+ height: "10",
23907
+ viewBox: "0 0 12 12",
23908
+ fill: "none",
23909
+ className: "uf-block",
23910
+ children: /* @__PURE__ */ jsx54(
23911
+ "path",
23912
+ {
23913
+ d: "M10 3L4.5 8.5L2 6",
23914
+ stroke: "white",
23915
+ strokeWidth: "2",
23916
+ strokeLinecap: "round",
23917
+ strokeLinejoin: "round"
23918
+ }
23919
+ )
23920
+ }
23921
+ )
23922
+ }
23923
+ )
23924
+ ] }),
23925
+ /* @__PURE__ */ jsxs47("div", { className: "uf-flex-1 uf-min-w-0", children: [
23926
+ /* @__PURE__ */ jsx54(
23927
+ "h3",
23928
+ {
23929
+ className: "uf-font-medium uf-text-sm uf-leading-tight",
23930
+ style: {
23931
+ color: components.card.titleColor,
23932
+ fontFamily: fonts.medium
23933
+ },
23934
+ children: isPending ? "Withdrawal processing" : "Withdrawal completed"
23935
+ }
23936
+ ),
23937
+ /* @__PURE__ */ jsx54(
23938
+ "p",
23939
+ {
23940
+ className: "uf-text-xs uf-leading-tight",
23941
+ style: {
23942
+ color: components.card.subtitleColor,
23943
+ fontFamily: fonts.regular
23944
+ },
23945
+ children: formatDateTime(execution.created_at || (/* @__PURE__ */ new Date()).toISOString())
23946
+ }
23947
+ )
23948
+ ] }),
23949
+ /* @__PURE__ */ jsx54(
23950
+ "span",
23951
+ {
23952
+ className: "uf-font-medium uf-text-sm uf-flex-shrink-0",
23953
+ style: {
23954
+ color: components.card.textRightColor,
23955
+ fontFamily: fonts.medium
23956
+ },
23957
+ children: formatUsdAmount2(execution.source_amount_usd || "0")
23958
+ }
23959
+ ),
23960
+ /* @__PURE__ */ jsx54(
23961
+ ChevronRight,
23962
+ {
23963
+ className: "uf-w-4 uf-h-4 uf-flex-shrink-0",
23964
+ style: { color: components.card.actionColor }
23965
+ }
23966
+ )
23967
+ ]
23968
+ }
23969
+ );
23970
+ }
23971
+ function truncateAddress4(addr) {
23972
+ if (addr.length <= 12) return addr;
23973
+ return `${addr.slice(0, 6)}...${addr.slice(-4)}`;
23974
+ }
23975
+ var SHOW_BUTTON_DELAY_MS = 5e3;
23976
+ function WithdrawConfirmingView({
23977
+ txInfo,
23978
+ executions,
23979
+ onClose,
23980
+ onViewTracker
23981
+ }) {
23982
+ const { colors: colors2, fonts, components } = useTheme();
23983
+ const [showButton, setShowButton] = useState30(false);
23984
+ const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
23985
+ useEffect242(() => {
23986
+ if (latestExecution) return;
23987
+ const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
23988
+ return () => clearTimeout(timer);
23989
+ }, [latestExecution]);
23990
+ const btnRadius = components.button.borderRadius;
23991
+ const btnBorder = `${components.button.borderWidth}px solid ${components.button.borderColor}`;
23992
+ if (latestExecution) {
23993
+ return /* @__PURE__ */ jsxs48(Fragment11, { children: [
23994
+ /* @__PURE__ */ jsx55(DepositHeader, { title: "Withdrawal Details", showClose: true, onClose }),
23995
+ /* @__PURE__ */ jsx55(DepositDetailContent, { execution: latestExecution, variant: "withdraw" }),
23996
+ /* @__PURE__ */ jsxs48("div", { className: "uf-flex uf-gap-2 uf-px-2 uf-pt-2", children: [
23997
+ /* @__PURE__ */ jsx55(
23998
+ "button",
23999
+ {
24000
+ type: "button",
24001
+ onClick: onViewTracker,
24002
+ className: "uf-flex-1 uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
24003
+ style: {
24004
+ backgroundColor: components.button.secondaryBackground,
24005
+ color: components.button.secondaryText,
24006
+ fontFamily: fonts.medium,
24007
+ borderRadius: btnRadius,
24008
+ border: btnBorder
24009
+ },
24010
+ children: "Withdrawal History"
24011
+ }
24012
+ ),
24013
+ /* @__PURE__ */ jsx55(
24014
+ "button",
24015
+ {
24016
+ type: "button",
24017
+ onClick: onClose,
24018
+ className: "uf-flex-1 uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
24019
+ style: {
24020
+ backgroundColor: components.button.primaryBackground,
24021
+ color: components.button.primaryText,
24022
+ fontFamily: fonts.medium,
24023
+ borderRadius: btnRadius,
24024
+ border: btnBorder
24025
+ },
24026
+ children: "Close"
24027
+ }
24028
+ )
24029
+ ] }),
24030
+ /* @__PURE__ */ jsx55("div", { className: "uf-pt-3", children: /* @__PURE__ */ jsx55(
24031
+ PoweredByUnifold,
24032
+ {
24033
+ color: colors2.foregroundMuted,
24034
+ className: "uf-flex uf-justify-center uf-shrink-0"
24035
+ }
24036
+ ) })
24037
+ ] });
24038
+ }
24039
+ return /* @__PURE__ */ jsxs48(Fragment11, { children: [
24040
+ /* @__PURE__ */ jsx55(DepositHeader, { title: "Withdrawal Status", showClose: true, onClose }),
24041
+ /* @__PURE__ */ jsxs48("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-16 uf-px-4", children: [
24042
+ /* @__PURE__ */ jsx55(
24043
+ "div",
24044
+ {
24045
+ className: "uf-w-20 uf-h-20 uf-rounded-full uf-flex uf-items-center uf-justify-center uf-mb-6",
24046
+ style: { backgroundColor: `${colors2.primary}20` },
24047
+ children: /* @__PURE__ */ jsx55(
24048
+ "svg",
24049
+ {
24050
+ width: "40",
24051
+ height: "40",
24052
+ viewBox: "0 0 24 24",
24053
+ fill: "none",
24054
+ className: "uf-animate-spin",
24055
+ children: /* @__PURE__ */ jsx55(
24056
+ "path",
24057
+ {
24058
+ d: "M21 12a9 9 0 1 1-6.22-8.56",
24059
+ stroke: colors2.primary,
24060
+ strokeWidth: "2.5",
24061
+ strokeLinecap: "round"
24062
+ }
24063
+ )
24064
+ }
24065
+ )
24066
+ }
24067
+ ),
24068
+ /* @__PURE__ */ jsx55(
24069
+ "h3",
24070
+ {
24071
+ className: "uf-text-xl uf-mb-2",
24072
+ style: { color: colors2.foreground, fontFamily: fonts.medium },
24073
+ children: "Checking Withdrawal"
24074
+ }
24075
+ ),
24076
+ /* @__PURE__ */ jsxs48(
24077
+ "p",
24078
+ {
24079
+ className: "uf-text-sm uf-text-center",
24080
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
24081
+ children: [
24082
+ txInfo.amount,
24083
+ " ",
24084
+ txInfo.sourceTokenSymbol,
24085
+ " to",
24086
+ " ",
24087
+ truncateAddress4(txInfo.recipientAddress)
24088
+ ]
24089
+ }
24090
+ )
24091
+ ] }),
24092
+ showButton && /* @__PURE__ */ jsx55("div", { className: "uf-px-1 uf-pb-1", children: /* @__PURE__ */ jsx55(
24093
+ "button",
24094
+ {
24095
+ type: "button",
24096
+ onClick: onViewTracker,
24097
+ className: "uf-w-full uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
24098
+ style: {
24099
+ backgroundColor: components.button.secondaryBackground,
24100
+ color: components.button.secondaryText,
24101
+ fontFamily: fonts.medium,
24102
+ borderRadius: btnRadius,
24103
+ border: btnBorder
24104
+ },
24105
+ children: "Withdrawal History"
24106
+ }
24107
+ ) }),
24108
+ /* @__PURE__ */ jsx55("div", { className: "uf-pt-3", children: /* @__PURE__ */ jsx55(
24109
+ PoweredByUnifold,
24110
+ {
24111
+ color: colors2.foregroundMuted,
24112
+ className: "uf-flex uf-justify-center uf-shrink-0"
24113
+ }
24114
+ ) })
24115
+ ] });
24116
+ }
24117
+ var t9 = i18n2.withdrawModal;
24118
+ var getChainKey5 = (chainId, chainType) => `${chainType}:${chainId}`;
24119
+ function WithdrawModal({
24120
+ open,
24121
+ onOpenChange,
24122
+ publishableKey,
24123
+ modalTitle,
24124
+ externalUserId,
24125
+ sourceChainType,
24126
+ sourceChainId,
24127
+ sourceTokenAddress,
24128
+ sourceTokenSymbol,
24129
+ recipientAddress: recipientAddressProp,
24130
+ senderAddress,
24131
+ onWithdraw,
24132
+ onWithdrawSuccess,
24133
+ onWithdrawError,
24134
+ theme = "dark",
24135
+ hideOverlay = false
24136
+ }) {
24137
+ const { colors: colors2, fonts, components } = useTheme();
24138
+ const [containerEl, setContainerEl] = useState31(null);
24139
+ const containerCallbackRef = useCallback62((el) => {
24140
+ setContainerEl(el);
24141
+ }, []);
24142
+ const [resolvedTheme, setResolvedTheme] = useState31(
24143
+ theme === "auto" ? "dark" : theme
24144
+ );
24145
+ useEffect252(() => {
24146
+ if (theme === "auto") {
24147
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
24148
+ setResolvedTheme(mq.matches ? "dark" : "light");
24149
+ const h = (e) => setResolvedTheme(e.matches ? "dark" : "light");
24150
+ mq.addEventListener("change", h);
24151
+ return () => mq.removeEventListener("change", h);
24152
+ }
24153
+ setResolvedTheme(theme);
24154
+ }, [theme]);
24155
+ const themeClass = resolvedTheme === "dark" ? "uf-dark" : "";
24156
+ const { data: tokensResponse, isLoading: tokensLoading } = useSupportedDestinationTokens(publishableKey, open);
24157
+ const destinationTokens = tokensResponse?.data ?? [];
24158
+ const { data: sourceValidation, isLoading: isCheckingSourceToken } = useSourceTokenValidation({
24159
+ sourceChainType,
24160
+ sourceChainId,
24161
+ sourceTokenAddress,
24162
+ sourceTokenSymbol,
24163
+ publishableKey,
24164
+ enabled: open
24165
+ });
24166
+ const { data: balanceData, isLoading: isLoadingBalance } = useAddressBalance({
24167
+ address: senderAddress,
24168
+ chainType: sourceChainType,
24169
+ chainId: sourceChainId,
24170
+ tokenAddress: sourceTokenAddress,
24171
+ publishableKey,
24172
+ enabled: open
24173
+ });
24174
+ const [selectedToken, setSelectedToken] = useState31(null);
24175
+ const [selectedChain, setSelectedChain] = useState31(null);
24176
+ const [detectedWallet, setDetectedWallet] = useState31(null);
24177
+ const connectedWalletName = detectedWallet?.name ?? null;
24178
+ const isWalletMatch = !!detectedWallet;
24179
+ useEffect252(() => {
24180
+ if (!senderAddress || !open) {
24181
+ setDetectedWallet(null);
24182
+ return;
24183
+ }
24184
+ let cancelled = false;
24185
+ detectBrowserWallet(sourceChainType, senderAddress).then((wallet) => {
24186
+ if (!cancelled) setDetectedWallet(wallet);
24187
+ });
24188
+ return () => {
24189
+ cancelled = true;
24190
+ };
24191
+ }, [senderAddress, sourceChainType, open]);
24192
+ const [view, setView] = useState31("form");
24193
+ const [withdrawDepositWalletId, setWithdrawDepositWalletId] = useState31();
24194
+ const [selectedExecution, setSelectedExecution] = useState31(null);
24195
+ const [submittedTxInfo, setSubmittedTxInfo] = useState31(null);
24196
+ const { executions: realtimeExecutions } = useWithdrawPolling({
24197
+ userId: externalUserId,
24198
+ publishableKey,
24199
+ depositWalletId: withdrawDepositWalletId,
24200
+ enabled: !!withdrawDepositWalletId && open,
24201
+ onWithdrawSuccess: onWithdrawSuccess ? (d) => onWithdrawSuccess({ message: d.message, transaction: d.transaction }) : void 0,
24202
+ onWithdrawError
24203
+ });
24204
+ const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
24205
+ actionType: ActionType.Withdraw,
24206
+ enabled: open,
24207
+ refetchInterval: view === "tracker" || view === "detail" ? 5e3 : 15e3
24208
+ });
24209
+ const allWithdrawals = allWithdrawalsData?.data ?? [];
24210
+ const handleDepositWalletCreation = useCallback62(async (params) => {
24211
+ const { data: wallets } = await createDepositAddress(
24212
+ {
24213
+ external_user_id: externalUserId,
24214
+ destination_chain_type: params.destinationChainType,
24215
+ destination_chain_id: params.destinationChainId,
24216
+ destination_token_address: params.destinationTokenAddress,
24217
+ recipient_address: params.recipientAddress,
24218
+ action_type: ActionType.Withdraw
24219
+ },
24220
+ publishableKey
24221
+ );
24222
+ const depositWallet = getWalletByChainType(wallets, sourceChainType);
24223
+ if (!depositWallet) {
24224
+ throw new Error(`No deposit wallet available for ${sourceChainType}`);
24225
+ }
24226
+ setWithdrawDepositWalletId(depositWallet.id);
24227
+ return depositWallet;
24228
+ }, [externalUserId, publishableKey, sourceChainType]);
24229
+ const handleWithdrawSubmitted = useCallback62((txInfo) => {
24230
+ setSubmittedTxInfo(txInfo);
24231
+ setView("confirming");
24232
+ }, []);
24233
+ useEffect252(() => {
24234
+ if (!destinationTokens.length || selectedToken) return;
24235
+ const first = destinationTokens[0];
24236
+ if (first?.chains.length > 0) {
24237
+ setSelectedToken(first);
24238
+ setSelectedChain(first.chains[0]);
24239
+ }
24240
+ }, [destinationTokens, selectedToken]);
24241
+ const resetViewTimeoutRef = useRef82(null);
24242
+ const handleClose = useCallback62(() => {
24243
+ onOpenChange(false);
24244
+ if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
24245
+ resetViewTimeoutRef.current = setTimeout(() => {
24246
+ setSelectedToken(null);
24247
+ setSelectedChain(null);
24248
+ setView("form");
24249
+ setSelectedExecution(null);
24250
+ setSubmittedTxInfo(null);
24251
+ setWithdrawDepositWalletId(void 0);
24252
+ resetViewTimeoutRef.current = null;
24253
+ }, 200);
24254
+ }, [onOpenChange]);
24255
+ useLayoutEffect32(() => {
24256
+ if (!open) return;
24257
+ if (resetViewTimeoutRef.current) {
24258
+ clearTimeout(resetViewTimeoutRef.current);
24259
+ resetViewTimeoutRef.current = null;
24260
+ }
24261
+ setSelectedToken(null);
24262
+ setSelectedChain(null);
24263
+ setView("form");
24264
+ setSelectedExecution(null);
24265
+ setSubmittedTxInfo(null);
24266
+ setWithdrawDepositWalletId(void 0);
24267
+ }, [open]);
24268
+ useEffect252(() => () => {
24269
+ if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
24270
+ }, []);
24271
+ const handleTokenSymbolChange = useCallback62((symbol) => {
24272
+ const tok = destinationTokens.find((t11) => t11.symbol === symbol);
24273
+ if (tok) {
24274
+ setSelectedToken(tok);
24275
+ if (tok.chains.length > 0) setSelectedChain(tok.chains[0]);
24276
+ }
24277
+ }, [destinationTokens]);
24278
+ const handleChainKeyChange = useCallback62((chainKey) => {
24279
+ if (!selectedToken) return;
24280
+ const chain = selectedToken.chains.find((c) => getChainKey5(c.chain_id, c.chain_type) === chainKey);
24281
+ if (chain) setSelectedChain(chain);
24282
+ }, [selectedToken]);
24283
+ const isSourceSupported = sourceValidation?.isSupported ?? null;
24284
+ const canWithdraw = !!onWithdraw || isWalletMatch;
24285
+ const isAnyLoading = tokensLoading || isCheckingSourceToken;
24286
+ const withdrawPoweredByFooter = /* @__PURE__ */ jsx56("div", { className: "uf-pt-3", children: /* @__PURE__ */ jsx56(PoweredByUnifold, { color: colors2.foregroundMuted, className: "uf-flex uf-justify-center uf-shrink-0" }) });
24287
+ return /* @__PURE__ */ jsx56(PortalContainerProvider, { value: hideOverlay ? containerEl : null, children: /* @__PURE__ */ jsx56(Dialog2, { open: hideOverlay || open, onOpenChange: hideOverlay ? void 0 : handleClose, modal: !hideOverlay, children: /* @__PURE__ */ jsx56(
24288
+ DialogContent2,
24289
+ {
24290
+ ref: hideOverlay ? containerCallbackRef : void 0,
24291
+ hideOverlay,
24292
+ className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden ${hideOverlay ? `uf-p-6 uf-overflow-hidden ${themeClass}` : `uf-p-0 uf-overflow-visible !uf-top-auto !uf-h-auto !uf-max-h-[90vh] sm:!uf-max-h-none sm:!uf-top-[50%] ${themeClass}`}`,
24293
+ style: { backgroundColor: colors2.background },
24294
+ onPointerDownOutside: (e) => e.preventDefault(),
24295
+ onInteractOutside: (e) => e.preventDefault(),
24296
+ children: /* @__PURE__ */ jsx56(ThemeStyleInjector, { children: view === "confirming" && submittedTxInfo ? /* @__PURE__ */ jsx56(
24297
+ WithdrawConfirmingView,
24298
+ {
24299
+ txInfo: submittedTxInfo,
24300
+ executions: realtimeExecutions,
24301
+ onClose: handleClose,
24302
+ onViewTracker: () => setView("tracker")
24303
+ }
24304
+ ) : view === "detail" && selectedExecution ? /* @__PURE__ */ jsxs49(Fragment12, { children: [
24305
+ /* @__PURE__ */ jsx56(DepositHeader, { title: "Withdrawal Details", showBack: true, showClose: !hideOverlay, onBack: () => {
24306
+ setSelectedExecution(null);
24307
+ setView("tracker");
24308
+ }, onClose: handleClose }),
24309
+ /* @__PURE__ */ jsx56(DepositDetailContent, { execution: selectedExecution, variant: "withdraw" }),
24310
+ withdrawPoweredByFooter
24311
+ ] }) : view === "tracker" ? (
24312
+ /* ---------- Tracker view: execution list ---------- */
24313
+ /* @__PURE__ */ jsxs49(Fragment12, { children: [
24314
+ /* @__PURE__ */ jsx56(DepositHeader, { title: "Withdrawal History", showBack: true, showClose: !hideOverlay, onBack: () => setView("form"), onClose: handleClose }),
24315
+ /* @__PURE__ */ jsx56("div", { className: "uf-flex uf-flex-col uf-gap-2", style: { minHeight: 200 }, children: allWithdrawals.length === 0 ? /* @__PURE__ */ jsx56("div", { className: "uf-flex uf-items-center uf-justify-center uf-py-8", children: /* @__PURE__ */ jsx56("p", { className: "uf-text-sm", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: "No withdrawals to track yet" }) }) : allWithdrawals.map((ex) => /* @__PURE__ */ jsx56(
24316
+ WithdrawExecutionItem,
24317
+ {
24318
+ execution: ex,
24319
+ onClick: () => {
24320
+ setSelectedExecution(ex);
24321
+ setView("detail");
24322
+ }
24323
+ },
24324
+ ex.id
24325
+ )) }),
24326
+ withdrawPoweredByFooter
24327
+ ] })
24328
+ ) : (
24329
+ /* ---------- Form view (default) ---------- */
24330
+ /* @__PURE__ */ jsxs49(Fragment12, { children: [
24331
+ /* @__PURE__ */ jsx56(DepositHeader, { title: modalTitle || t9.title, showClose: !hideOverlay, onClose: handleClose }),
24332
+ /* @__PURE__ */ jsxs49("div", { className: "uf-flex uf-flex-col uf-gap-3", children: [
24333
+ isAnyLoading ? /* @__PURE__ */ jsx56("div", { className: "uf-space-y-3", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx56("div", { className: "uf-w-full uf-bg-secondary uf-rounded-xl uf-p-3 uf-flex uf-items-center uf-animate-pulse", children: /* @__PURE__ */ jsx56("div", { className: "uf-bg-muted uf-rounded-lg uf-w-full uf-h-10" }) }, i)) }) : isSourceSupported === false ? /* @__PURE__ */ jsxs49("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
24334
+ /* @__PURE__ */ jsx56("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ jsx56(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
24335
+ /* @__PURE__ */ jsx56("h3", { className: "uf-text-lg uf-font-semibold uf-mb-2", style: { color: colors2.foreground, fontFamily: fonts.medium }, children: "Unsupported Source Token" }),
24336
+ /* @__PURE__ */ jsx56("p", { className: "uf-text-sm uf-max-w-[280px]", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: sourceValidation?.errorMessage })
24337
+ ] }) : /* @__PURE__ */ jsxs49(Fragment12, { children: [
24338
+ /* @__PURE__ */ jsx56(
24339
+ WithdrawDoubleInput,
24340
+ {
24341
+ tokens: destinationTokens,
24342
+ selectedTokenSymbol: selectedToken?.symbol ?? null,
24343
+ selectedChainKey: selectedChain ? getChainKey5(selectedChain.chain_id, selectedChain.chain_type) : null,
24344
+ onTokenChange: handleTokenSymbolChange,
24345
+ onChainChange: handleChainKeyChange,
24346
+ isLoading: tokensLoading
24347
+ }
24348
+ ),
24349
+ /* @__PURE__ */ jsx56(
24350
+ WithdrawForm,
24351
+ {
24352
+ publishableKey,
24353
+ externalUserId,
24354
+ sourceChainType,
24355
+ selectedToken,
24356
+ selectedChain,
24357
+ sourceTokenSymbol,
24358
+ recipientAddressProp,
24359
+ balanceData: balanceData ?? null,
24360
+ isLoadingBalance,
24361
+ minimumWithdrawAmountUsd: sourceValidation?.minimumAmountUsd ?? null,
24362
+ estimatedProcessingTime: sourceValidation?.estimatedProcessingTime ?? null,
24363
+ maxSlippagePercent: sourceValidation?.maxSlippagePercent ?? null,
24364
+ priceImpactPercent: sourceValidation?.priceImpactPercent ?? null,
24365
+ detectedWallet,
24366
+ sourceChainId,
24367
+ sourceTokenAddress,
24368
+ isWalletMatch,
24369
+ connectedWalletName,
24370
+ canWithdraw,
24371
+ onWithdraw,
24372
+ onWithdrawError,
24373
+ onDepositWalletCreation: handleDepositWalletCreation,
24374
+ onWithdrawSubmitted: handleWithdrawSubmitted,
24375
+ footerLeft: /* @__PURE__ */ jsxs49(
24376
+ "button",
24377
+ {
24378
+ onClick: () => setView("tracker"),
24379
+ className: "uf-flex uf-items-center uf-gap-1 uf-transition-colors hover:uf-opacity-70",
24380
+ style: { color: colors2.foregroundMuted },
24381
+ children: [
24382
+ /* @__PURE__ */ jsx56(Clock, { className: "uf-w-3.5 uf-h-3.5" }),
24383
+ "Withdrawal History",
24384
+ /* @__PURE__ */ jsx56(ChevronRight, { className: "uf-w-3 uf-h-3" })
24385
+ ]
24386
+ }
24387
+ )
24388
+ }
24389
+ )
24390
+ ] }),
24391
+ withdrawPoweredByFooter
24392
+ ] })
24393
+ ] })
24394
+ ) })
24395
+ }
24396
+ ) }) });
24397
+ }
24398
+ var t10 = i18n2.withdrawModal;
24399
+
24400
+ // src/provider.tsx
24401
+ import { jsx as jsx58, jsxs as jsxs51 } from "react/jsx-runtime";
24402
+ function UnifoldProvider2({
24403
+ children,
24404
+ publishableKey,
24405
+ config
24406
+ }) {
24407
+ const [isOpen, setIsOpen] = useState33(false);
24408
+ const [depositConfig, setDepositConfig] = useState33(
24409
+ null
24410
+ );
24411
+ const [isWithdrawOpen, setIsWithdrawOpen] = useState33(false);
24412
+ const [withdrawConfig, setWithdrawConfig] = useState33(
24413
+ null
24414
+ );
24415
+ const [resolvedTheme, setResolvedTheme] = React38.useState("dark");
24416
+ useEffect29(() => {
24417
+ if (publishableKey) {
24418
+ setApiConfig({ publishableKey });
24419
+ }
24420
+ }, [publishableKey]);
24421
+ React38.useEffect(() => {
24422
+ const appearance = config?.appearance || "dark";
24423
+ if (appearance === "auto") {
24424
+ const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
24425
+ setResolvedTheme(prefersDark ? "dark" : "light");
24426
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
24427
+ const handler = (e) => {
24428
+ setResolvedTheme(e.matches ? "dark" : "light");
24429
+ };
24430
+ mediaQuery.addEventListener("change", handler);
24431
+ return () => mediaQuery.removeEventListener("change", handler);
24432
+ } else {
24433
+ setResolvedTheme(appearance);
24434
+ }
24435
+ }, [config?.appearance]);
24436
+ const depositPromiseRef = React38.useRef(null);
24437
+ const depositConfigRef = React38.useRef(null);
24438
+ depositConfigRef.current = depositConfig;
24439
+ const closeTimeoutRef = React38.useRef(null);
24440
+ const closeGuardRef = React38.useRef(false);
24441
+ const withdrawPromiseRef = React38.useRef(null);
24442
+ const withdrawConfigRef = React38.useRef(null);
24443
+ withdrawConfigRef.current = withdrawConfig;
24444
+ const withdrawCloseTimeoutRef = React38.useRef(null);
24445
+ const withdrawCloseGuardRef = React38.useRef(false);
24446
+ const beginDeposit = useCallback12((config2) => {
24447
+ if (closeTimeoutRef.current) {
24448
+ clearTimeout(closeTimeoutRef.current);
24449
+ closeTimeoutRef.current = null;
24450
+ }
24451
+ closeGuardRef.current = false;
24452
+ if (depositPromiseRef.current) {
24453
+ console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit.");
24454
+ depositPromiseRef.current.reject({
24455
+ message: "Deposit cancelled - new deposit started",
24456
+ code: "DEPOSIT_SUPERSEDED"
24457
+ });
24458
+ depositPromiseRef.current = null;
24459
+ }
24460
+ const promise = new Promise((resolve, reject) => {
24461
+ depositPromiseRef.current = { resolve, reject };
24462
+ });
24463
+ promise.catch(() => {
24464
+ });
24465
+ setDepositConfig(config2);
24466
+ setIsOpen(true);
24467
+ return promise;
24468
+ }, []);
24469
+ const closeDeposit = useCallback12(() => {
24470
+ if (closeGuardRef.current) {
24471
+ return;
24472
+ }
24473
+ closeGuardRef.current = true;
24474
+ const promiseToReject = depositPromiseRef.current;
24475
+ depositPromiseRef.current = null;
24476
+ if (depositConfigRef.current?.onClose) {
24477
+ depositConfigRef.current.onClose();
24478
+ }
24479
+ if (promiseToReject) {
24480
+ promiseToReject.reject({
24481
+ message: "Deposit cancelled by user",
24482
+ code: "DEPOSIT_CANCELLED"
22594
24483
  });
22595
24484
  }
22596
24485
  setIsOpen(false);
@@ -22618,16 +24507,84 @@ function UnifoldProvider2({
22618
24507
  depositPromiseRef.current = null;
22619
24508
  }
22620
24509
  }, [depositConfig]);
24510
+ const beginWithdraw = useCallback12((config2) => {
24511
+ if (withdrawCloseTimeoutRef.current) {
24512
+ clearTimeout(withdrawCloseTimeoutRef.current);
24513
+ withdrawCloseTimeoutRef.current = null;
24514
+ }
24515
+ withdrawCloseGuardRef.current = false;
24516
+ if (withdrawPromiseRef.current) {
24517
+ console.warn("[UnifoldProvider] A withdraw is already in progress. Cancelling previous withdraw.");
24518
+ withdrawPromiseRef.current.reject({
24519
+ message: "Withdraw cancelled - new withdraw started",
24520
+ code: "WITHDRAW_SUPERSEDED"
24521
+ });
24522
+ withdrawPromiseRef.current = null;
24523
+ }
24524
+ const promise = new Promise((resolve, reject) => {
24525
+ withdrawPromiseRef.current = { resolve, reject };
24526
+ });
24527
+ promise.catch(() => {
24528
+ });
24529
+ setWithdrawConfig(config2);
24530
+ setIsWithdrawOpen(true);
24531
+ return promise;
24532
+ }, []);
24533
+ const closeWithdraw = useCallback12(() => {
24534
+ if (withdrawCloseGuardRef.current) {
24535
+ return;
24536
+ }
24537
+ withdrawCloseGuardRef.current = true;
24538
+ const promiseToReject = withdrawPromiseRef.current;
24539
+ withdrawPromiseRef.current = null;
24540
+ if (withdrawConfigRef.current?.onClose) {
24541
+ withdrawConfigRef.current.onClose();
24542
+ }
24543
+ if (promiseToReject) {
24544
+ promiseToReject.reject({
24545
+ message: "Withdraw cancelled by user",
24546
+ code: "WITHDRAW_CANCELLED"
24547
+ });
24548
+ }
24549
+ setIsWithdrawOpen(false);
24550
+ withdrawCloseTimeoutRef.current = setTimeout(() => {
24551
+ setWithdrawConfig(null);
24552
+ withdrawCloseTimeoutRef.current = null;
24553
+ }, 200);
24554
+ }, []);
24555
+ const handleWithdrawSuccess = useCallback12((data) => {
24556
+ if (withdrawConfigRef.current?.onSuccess) {
24557
+ withdrawConfigRef.current.onSuccess(data);
24558
+ }
24559
+ if (withdrawPromiseRef.current) {
24560
+ withdrawPromiseRef.current.resolve(data);
24561
+ withdrawPromiseRef.current = null;
24562
+ }
24563
+ }, []);
24564
+ const handleWithdrawError = useCallback12((error) => {
24565
+ console.error("[UnifoldProvider] Withdraw error:", error);
24566
+ if (withdrawConfigRef.current?.onError) {
24567
+ withdrawConfigRef.current.onError(error);
24568
+ }
24569
+ if (withdrawPromiseRef.current) {
24570
+ withdrawPromiseRef.current.reject(error);
24571
+ withdrawPromiseRef.current = null;
24572
+ }
24573
+ }, []);
22621
24574
  const contextValue = useMemo15(
22622
24575
  () => ({
22623
24576
  beginDeposit,
22624
24577
  closeDeposit,
22625
24578
  handleDepositSuccess,
22626
- handleDepositError
24579
+ handleDepositError,
24580
+ beginWithdraw,
24581
+ closeWithdraw,
24582
+ handleWithdrawSuccess,
24583
+ handleWithdrawError
22627
24584
  }),
22628
- [beginDeposit, closeDeposit, handleDepositSuccess, handleDepositError]
24585
+ [beginDeposit, closeDeposit, handleDepositSuccess, handleDepositError, beginWithdraw, closeWithdraw, handleWithdrawSuccess, handleWithdrawError]
22629
24586
  );
22630
- return /* @__PURE__ */ jsx53(UnifoldProvider, { publishableKey, children: /* @__PURE__ */ jsx53(ConnectContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs45(
24587
+ return /* @__PURE__ */ jsx58(UnifoldProvider, { publishableKey, children: /* @__PURE__ */ jsx58(ConnectContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs51(
22631
24588
  ThemeProvider,
22632
24589
  {
22633
24590
  mode: resolvedTheme,
@@ -22638,7 +24595,27 @@ function UnifoldProvider2({
22638
24595
  components: config?.components,
22639
24596
  children: [
22640
24597
  children,
22641
- depositConfig && /* @__PURE__ */ jsx53(
24598
+ withdrawConfig && /* @__PURE__ */ jsx58(
24599
+ WithdrawModal,
24600
+ {
24601
+ open: isWithdrawOpen,
24602
+ onOpenChange: closeWithdraw,
24603
+ publishableKey,
24604
+ modalTitle: config?.withdrawModalTitle,
24605
+ externalUserId: withdrawConfig.externalUserId,
24606
+ sourceChainType: withdrawConfig.sourceChainType,
24607
+ sourceChainId: withdrawConfig.sourceChainId,
24608
+ sourceTokenAddress: withdrawConfig.sourceTokenAddress,
24609
+ sourceTokenSymbol: withdrawConfig.sourceTokenSymbol,
24610
+ recipientAddress: withdrawConfig.recipientAddress,
24611
+ senderAddress: withdrawConfig.senderAddress,
24612
+ onWithdraw: withdrawConfig.withdraw,
24613
+ onWithdrawSuccess: handleWithdrawSuccess,
24614
+ onWithdrawError: handleWithdrawError,
24615
+ theme: resolvedTheme
24616
+ }
24617
+ ),
24618
+ depositConfig && /* @__PURE__ */ jsx58(
22642
24619
  DepositModal,
22643
24620
  {
22644
24621
  open: isOpen,
@@ -22651,6 +24628,10 @@ function UnifoldProvider2({
22651
24628
  destinationChainType: depositConfig.destinationChainType,
22652
24629
  destinationChainId: depositConfig.destinationChainId,
22653
24630
  destinationTokenAddress: depositConfig.destinationTokenAddress,
24631
+ defaultSourceChainType: depositConfig.defaultSourceChainType,
24632
+ defaultSourceChainId: depositConfig.defaultSourceChainId,
24633
+ defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
24634
+ defaultSourceSymbol: depositConfig.defaultSourceSymbol,
22654
24635
  depositConfirmationMode: depositConfig.depositConfirmationMode ?? "auto_ui",
22655
24636
  hideDepositTracker: config?.hideDepositTracker,
22656
24637
  showBalanceHeader: config?.showBalanceHeader,
@@ -22684,6 +24665,9 @@ function useUnifold2() {
22684
24665
  publishableKey: "",
22685
24666
  beginDeposit: () => Promise.reject(new Error("SSR not supported")),
22686
24667
  closeDeposit: () => {
24668
+ },
24669
+ beginWithdraw: () => Promise.reject(new Error("SSR not supported")),
24670
+ closeWithdraw: () => {
22687
24671
  }
22688
24672
  };
22689
24673
  }
@@ -22693,7 +24677,9 @@ function useUnifold2() {
22693
24677
  return {
22694
24678
  publishableKey: baseContext.publishableKey,
22695
24679
  beginDeposit: connectContext.beginDeposit,
22696
- closeDeposit: connectContext.closeDeposit
24680
+ closeDeposit: connectContext.closeDeposit,
24681
+ beginWithdraw: connectContext.beginWithdraw,
24682
+ closeWithdraw: connectContext.closeWithdraw
22697
24683
  };
22698
24684
  }
22699
24685
  function useAllowedCountry2() {
@@ -22701,6 +24687,7 @@ function useAllowedCountry2() {
22701
24687
  return useAllowedCountry(publishableKey);
22702
24688
  }
22703
24689
  export {
24690
+ ActionType,
22704
24691
  Button,
22705
24692
  ConfirmingView,
22706
24693
  ExecutionStatus,
@@ -22719,10 +24706,12 @@ export {
22719
24706
  getPreferredIconUrl,
22720
24707
  getProjectConfig,
22721
24708
  getSupportedDepositTokens,
24709
+ getSupportedDestinationTokens,
22722
24710
  getTokenChains,
22723
24711
  getWalletByChainType,
22724
24712
  i18n,
22725
24713
  queryExecutions,
24714
+ sendSolanaTransaction,
22726
24715
  setApiConfig,
22727
24716
  useAllowedCountry2 as useAllowedCountry,
22728
24717
  useUnifold2 as useUnifold,
@@ -22736,11 +24725,13 @@ lucide-react/dist/esm/Icon.js:
22736
24725
  lucide-react/dist/esm/createLucideIcon.js:
22737
24726
  lucide-react/dist/esm/icons/arrow-left-right.js:
22738
24727
  lucide-react/dist/esm/icons/arrow-left.js:
24728
+ lucide-react/dist/esm/icons/arrow-up-down.js:
22739
24729
  lucide-react/dist/esm/icons/check.js:
22740
24730
  lucide-react/dist/esm/icons/chevron-down.js:
22741
24731
  lucide-react/dist/esm/icons/chevron-right.js:
22742
24732
  lucide-react/dist/esm/icons/chevron-up.js:
22743
24733
  lucide-react/dist/esm/icons/circle-check.js:
24734
+ lucide-react/dist/esm/icons/clipboard-paste.js:
22744
24735
  lucide-react/dist/esm/icons/clock.js:
22745
24736
  lucide-react/dist/esm/icons/copy.js:
22746
24737
  lucide-react/dist/esm/icons/credit-card.js: