@unifold/ui-web 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.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +2683 -725
- package/dist/index.mjs +2683 -725
- package/dist/styles-base.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -34394,7 +34394,7 @@ var require_jsx_runtime = __commonJS({
|
|
|
34394
34394
|
});
|
|
34395
34395
|
|
|
34396
34396
|
// src/unifold.tsx
|
|
34397
|
-
var
|
|
34397
|
+
var import_react32 = __toESM(require_react());
|
|
34398
34398
|
var import_client = __toESM(require_client());
|
|
34399
34399
|
|
|
34400
34400
|
// ../connect-react/dist/index.mjs
|
|
@@ -37169,14 +37169,15 @@ var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
|
|
|
37169
37169
|
var import_react19 = __toESM(require_react(), 1);
|
|
37170
37170
|
var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
|
|
37171
37171
|
var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
|
|
37172
|
+
var import_react20 = __toESM(require_react(), 1);
|
|
37172
37173
|
var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
|
|
37173
37174
|
var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
|
|
37174
|
-
var
|
|
37175
|
+
var import_react21 = __toESM(require_react(), 1);
|
|
37175
37176
|
var React242 = __toESM(require_react(), 1);
|
|
37176
37177
|
var React31 = __toESM(require_react(), 1);
|
|
37177
37178
|
var React29 = __toESM(require_react(), 1);
|
|
37178
37179
|
var React26 = __toESM(require_react(), 1);
|
|
37179
|
-
var
|
|
37180
|
+
var import_react22 = __toESM(require_react(), 1);
|
|
37180
37181
|
var ReactDOM3 = __toESM(require_react_dom(), 1);
|
|
37181
37182
|
var React27 = __toESM(require_react(), 1);
|
|
37182
37183
|
var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -37187,13 +37188,13 @@ var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
|
|
|
37187
37188
|
var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
|
|
37188
37189
|
var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1);
|
|
37189
37190
|
var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
|
|
37190
|
-
var
|
|
37191
|
+
var import_react23 = __toESM(require_react(), 1);
|
|
37191
37192
|
var React252 = __toESM(require_react(), 1);
|
|
37192
37193
|
var React35 = __toESM(require_react(), 1);
|
|
37193
37194
|
var ReactDOM4 = __toESM(require_react_dom(), 1);
|
|
37194
|
-
var import_react23 = __toESM(require_react(), 1);
|
|
37195
|
-
var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
|
|
37196
37195
|
var import_react24 = __toESM(require_react(), 1);
|
|
37196
|
+
var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
|
|
37197
|
+
var import_react25 = __toESM(require_react(), 1);
|
|
37197
37198
|
var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
|
|
37198
37199
|
var React33 = __toESM(require_react(), 1);
|
|
37199
37200
|
var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -37206,13 +37207,24 @@ var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1);
|
|
|
37206
37207
|
var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1);
|
|
37207
37208
|
var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1);
|
|
37208
37209
|
var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
|
|
37209
|
-
var
|
|
37210
|
+
var import_react26 = __toESM(require_react(), 1);
|
|
37210
37211
|
var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1);
|
|
37211
37212
|
var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
|
|
37212
37213
|
var React272 = __toESM(require_react(), 1);
|
|
37213
37214
|
var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
|
|
37214
37215
|
var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
|
|
37216
|
+
var import_react27 = __toESM(require_react(), 1);
|
|
37217
|
+
var import_react28 = __toESM(require_react(), 1);
|
|
37215
37218
|
var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
|
|
37219
|
+
var import_react29 = __toESM(require_react(), 1);
|
|
37220
|
+
var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
|
|
37221
|
+
var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
|
|
37222
|
+
var import_react30 = __toESM(require_react(), 1);
|
|
37223
|
+
var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
|
|
37224
|
+
var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
|
|
37225
|
+
var import_react31 = __toESM(require_react(), 1);
|
|
37226
|
+
var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
|
|
37227
|
+
var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
|
|
37216
37228
|
var __create2 = Object.create;
|
|
37217
37229
|
var __defProp2 = Object.defineProperty;
|
|
37218
37230
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -37241,69 +37253,69 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__
|
|
|
37241
37253
|
var require_qr_code_styling = __commonJS2({
|
|
37242
37254
|
"../../node_modules/.pnpm/qr-code-styling@1.9.2/node_modules/qr-code-styling/lib/qr-code-styling.js"(exports, module) {
|
|
37243
37255
|
"use strict";
|
|
37244
|
-
!(function(
|
|
37245
|
-
"object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.QRCodeStyling = e() :
|
|
37256
|
+
!(function(t11, e) {
|
|
37257
|
+
"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();
|
|
37246
37258
|
})(exports, (() => (() => {
|
|
37247
|
-
var
|
|
37259
|
+
var t11 = { 873: (t12, e2) => {
|
|
37248
37260
|
var i2, r3, n = (function() {
|
|
37249
|
-
var
|
|
37250
|
-
var i4 =
|
|
37251
|
-
n3 = (function(
|
|
37252
|
-
for (var e6 = new Array(
|
|
37253
|
-
e6[i5] = new Array(
|
|
37254
|
-
for (var r6 = 0; r6 <
|
|
37261
|
+
var t13 = function(t14, e4) {
|
|
37262
|
+
var i4 = t14, r5 = s[e4], n3 = null, o2 = 0, h2 = null, p2 = [], v2 = {}, m = function(t15, e5) {
|
|
37263
|
+
n3 = (function(t16) {
|
|
37264
|
+
for (var e6 = new Array(t16), i5 = 0; i5 < t16; i5 += 1) {
|
|
37265
|
+
e6[i5] = new Array(t16);
|
|
37266
|
+
for (var r6 = 0; r6 < t16; r6 += 1) e6[i5][r6] = null;
|
|
37255
37267
|
}
|
|
37256
37268
|
return e6;
|
|
37257
|
-
})(o2 = 4 * i4 + 17), b(0, 0), b(o2 - 7, 0), b(0, o2 - 7), x(), y(), C(
|
|
37258
|
-
}, b = function(
|
|
37259
|
-
for (var i5 = -1; i5 <= 7; i5 += 1) if (!(
|
|
37269
|
+
})(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);
|
|
37270
|
+
}, b = function(t15, e5) {
|
|
37271
|
+
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);
|
|
37260
37272
|
}, y = function() {
|
|
37261
|
-
for (var
|
|
37273
|
+
for (var t15 = 8; t15 < o2 - 8; t15 += 1) null == n3[t15][6] && (n3[t15][6] = t15 % 2 == 0);
|
|
37262
37274
|
for (var e5 = 8; e5 < o2 - 8; e5 += 1) null == n3[6][e5] && (n3[6][e5] = e5 % 2 == 0);
|
|
37263
37275
|
}, x = function() {
|
|
37264
|
-
for (var
|
|
37265
|
-
var o3 =
|
|
37276
|
+
for (var t15 = a.getPatternPosition(i4), e5 = 0; e5 < t15.length; e5 += 1) for (var r6 = 0; r6 < t15.length; r6 += 1) {
|
|
37277
|
+
var o3 = t15[e5], s2 = t15[r6];
|
|
37266
37278
|
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;
|
|
37267
37279
|
}
|
|
37268
|
-
}, S = function(
|
|
37280
|
+
}, S = function(t15) {
|
|
37269
37281
|
for (var e5 = a.getBCHTypeNumber(i4), r6 = 0; r6 < 18; r6 += 1) {
|
|
37270
|
-
var s2 = !
|
|
37282
|
+
var s2 = !t15 && 1 == (e5 >> r6 & 1);
|
|
37271
37283
|
n3[Math.floor(r6 / 3)][r6 % 3 + o2 - 8 - 3] = s2;
|
|
37272
37284
|
}
|
|
37273
|
-
for (r6 = 0; r6 < 18; r6 += 1) s2 = !
|
|
37274
|
-
}, C = function(
|
|
37285
|
+
for (r6 = 0; r6 < 18; r6 += 1) s2 = !t15 && 1 == (e5 >> r6 & 1), n3[r6 % 3 + o2 - 8 - 3][Math.floor(r6 / 3)] = s2;
|
|
37286
|
+
}, C = function(t15, e5) {
|
|
37275
37287
|
for (var i5 = r5 << 3 | e5, s2 = a.getBCHTypeInfo(i5), h3 = 0; h3 < 15; h3 += 1) {
|
|
37276
|
-
var d2 = !
|
|
37288
|
+
var d2 = !t15 && 1 == (s2 >> h3 & 1);
|
|
37277
37289
|
h3 < 6 ? n3[h3][8] = d2 : h3 < 8 ? n3[h3 + 1][8] = d2 : n3[o2 - 15 + h3][8] = d2;
|
|
37278
37290
|
}
|
|
37279
|
-
for (h3 = 0; h3 < 15; h3 += 1) d2 = !
|
|
37280
|
-
n3[o2 - 8][8] = !
|
|
37281
|
-
}, A = function(
|
|
37291
|
+
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;
|
|
37292
|
+
n3[o2 - 8][8] = !t15;
|
|
37293
|
+
}, A = function(t15, e5) {
|
|
37282
37294
|
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); ; ) {
|
|
37283
37295
|
for (var c2 = 0; c2 < 2; c2 += 1) if (null == n3[r6][u2 - c2]) {
|
|
37284
37296
|
var l2 = false;
|
|
37285
|
-
h3 <
|
|
37297
|
+
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);
|
|
37286
37298
|
}
|
|
37287
37299
|
if ((r6 += i5) < 0 || o2 <= r6) {
|
|
37288
37300
|
r6 -= i5, i5 = -i5;
|
|
37289
37301
|
break;
|
|
37290
37302
|
}
|
|
37291
37303
|
}
|
|
37292
|
-
}, M = function(
|
|
37293
|
-
for (var r6 = u.getRSBlocks(
|
|
37304
|
+
}, M = function(t15, e5, i5) {
|
|
37305
|
+
for (var r6 = u.getRSBlocks(t15, e5), n4 = c(), o3 = 0; o3 < i5.length; o3 += 1) {
|
|
37294
37306
|
var s2 = i5[o3];
|
|
37295
|
-
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(),
|
|
37307
|
+
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t15)), s2.write(n4);
|
|
37296
37308
|
}
|
|
37297
37309
|
var h3 = 0;
|
|
37298
37310
|
for (o3 = 0; o3 < r6.length; o3 += 1) h3 += r6[o3].dataCount;
|
|
37299
37311
|
if (n4.getLengthInBits() > 8 * h3) throw "code length overflow. (" + n4.getLengthInBits() + ">" + 8 * h3 + ")";
|
|
37300
37312
|
for (n4.getLengthInBits() + 4 <= 8 * h3 && n4.put(0, 4); n4.getLengthInBits() % 8 != 0; ) n4.putBit(false);
|
|
37301
37313
|
for (; !(n4.getLengthInBits() >= 8 * h3 || (n4.put(236, 8), n4.getLengthInBits() >= 8 * h3)); ) n4.put(17, 8);
|
|
37302
|
-
return (function(
|
|
37314
|
+
return (function(t16, e6) {
|
|
37303
37315
|
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) {
|
|
37304
37316
|
var u2 = e6[h4].dataCount, c2 = e6[h4].totalCount - u2;
|
|
37305
37317
|
r7 = Math.max(r7, u2), n5 = Math.max(n5, c2), o4[h4] = new Array(u2);
|
|
37306
|
-
for (var l2 = 0; l2 < o4[h4].length; l2 += 1) o4[h4][l2] = 255 &
|
|
37318
|
+
for (var l2 = 0; l2 < o4[h4].length; l2 += 1) o4[h4][l2] = 255 & t16.getBuffer()[l2 + i6];
|
|
37307
37319
|
i6 += u2;
|
|
37308
37320
|
var g2 = a.getErrorCorrectPolynomial(c2), f2 = d(o4[h4], g2.getLength() - 1).mod(g2);
|
|
37309
37321
|
for (s3[h4] = new Array(g2.getLength() - 1), l2 = 0; l2 < s3[h4].length; l2 += 1) {
|
|
@@ -37319,85 +37331,85 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37319
37331
|
return v3;
|
|
37320
37332
|
})(n4, r6);
|
|
37321
37333
|
};
|
|
37322
|
-
v2.addData = function(
|
|
37334
|
+
v2.addData = function(t15, e5) {
|
|
37323
37335
|
var i5 = null;
|
|
37324
37336
|
switch (e5 = e5 || "Byte") {
|
|
37325
37337
|
case "Numeric":
|
|
37326
|
-
i5 = l(
|
|
37338
|
+
i5 = l(t15);
|
|
37327
37339
|
break;
|
|
37328
37340
|
case "Alphanumeric":
|
|
37329
|
-
i5 = g(
|
|
37341
|
+
i5 = g(t15);
|
|
37330
37342
|
break;
|
|
37331
37343
|
case "Byte":
|
|
37332
|
-
i5 = f(
|
|
37344
|
+
i5 = f(t15);
|
|
37333
37345
|
break;
|
|
37334
37346
|
case "Kanji":
|
|
37335
|
-
i5 = w(
|
|
37347
|
+
i5 = w(t15);
|
|
37336
37348
|
break;
|
|
37337
37349
|
default:
|
|
37338
37350
|
throw "mode:" + e5;
|
|
37339
37351
|
}
|
|
37340
37352
|
p2.push(i5), h2 = null;
|
|
37341
|
-
}, v2.isDark = function(
|
|
37342
|
-
if (
|
|
37343
|
-
return n3[
|
|
37353
|
+
}, v2.isDark = function(t15, e5) {
|
|
37354
|
+
if (t15 < 0 || o2 <= t15 || e5 < 0 || o2 <= e5) throw t15 + "," + e5;
|
|
37355
|
+
return n3[t15][e5];
|
|
37344
37356
|
}, v2.getModuleCount = function() {
|
|
37345
37357
|
return o2;
|
|
37346
37358
|
}, v2.make = function() {
|
|
37347
37359
|
if (i4 < 1) {
|
|
37348
|
-
for (var
|
|
37349
|
-
for (var e5 = u.getRSBlocks(
|
|
37360
|
+
for (var t15 = 1; t15 < 40; t15++) {
|
|
37361
|
+
for (var e5 = u.getRSBlocks(t15, r5), n4 = c(), o3 = 0; o3 < p2.length; o3++) {
|
|
37350
37362
|
var s2 = p2[o3];
|
|
37351
|
-
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(),
|
|
37363
|
+
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t15)), s2.write(n4);
|
|
37352
37364
|
}
|
|
37353
37365
|
var h3 = 0;
|
|
37354
37366
|
for (o3 = 0; o3 < e5.length; o3++) h3 += e5[o3].dataCount;
|
|
37355
37367
|
if (n4.getLengthInBits() <= 8 * h3) break;
|
|
37356
37368
|
}
|
|
37357
|
-
i4 =
|
|
37369
|
+
i4 = t15;
|
|
37358
37370
|
}
|
|
37359
37371
|
m(false, (function() {
|
|
37360
|
-
for (var
|
|
37372
|
+
for (var t16 = 0, e6 = 0, i5 = 0; i5 < 8; i5 += 1) {
|
|
37361
37373
|
m(true, i5);
|
|
37362
37374
|
var r6 = a.getLostPoint(v2);
|
|
37363
|
-
(0 == i5 ||
|
|
37375
|
+
(0 == i5 || t16 > r6) && (t16 = r6, e6 = i5);
|
|
37364
37376
|
}
|
|
37365
37377
|
return e6;
|
|
37366
37378
|
})());
|
|
37367
|
-
}, v2.createTableTag = function(
|
|
37368
|
-
|
|
37379
|
+
}, v2.createTableTag = function(t15, e5) {
|
|
37380
|
+
t15 = t15 || 2;
|
|
37369
37381
|
var i5 = "";
|
|
37370
|
-
i5 += '<table style="', i5 += " border-width: 0px; border-style: none;", i5 += " border-collapse: collapse;", i5 += " padding: 0px; margin: " + (e5 = void 0 === e5 ? 4 *
|
|
37382
|
+
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>";
|
|
37371
37383
|
for (var r6 = 0; r6 < v2.getModuleCount(); r6 += 1) {
|
|
37372
37384
|
i5 += "<tr>";
|
|
37373
|
-
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: " +
|
|
37385
|
+
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 += '"/>';
|
|
37374
37386
|
i5 += "</tr>";
|
|
37375
37387
|
}
|
|
37376
37388
|
return (i5 += "</tbody>") + "</table>";
|
|
37377
|
-
}, v2.createSvgTag = function(
|
|
37389
|
+
}, v2.createSvgTag = function(t15, e5, i5, r6) {
|
|
37378
37390
|
var n4 = {};
|
|
37379
|
-
"object" == typeof arguments[0] && (
|
|
37380
|
-
var o3, s2, a2, h3, d2 = v2.getModuleCount() *
|
|
37381
|
-
for (h3 = "l" +
|
|
37391
|
+
"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;
|
|
37392
|
+
var o3, s2, a2, h3, d2 = v2.getModuleCount() * t15 + 2 * e5, u2 = "";
|
|
37393
|
+
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);
|
|
37382
37394
|
return (u2 += '" stroke="transparent" fill="black"/>') + "</svg>";
|
|
37383
|
-
}, v2.createDataURL = function(
|
|
37384
|
-
|
|
37385
|
-
var i5 = v2.getModuleCount() *
|
|
37395
|
+
}, v2.createDataURL = function(t15, e5) {
|
|
37396
|
+
t15 = t15 || 2, e5 = void 0 === e5 ? 4 * t15 : e5;
|
|
37397
|
+
var i5 = v2.getModuleCount() * t15 + 2 * e5, r6 = e5, n4 = i5 - e5;
|
|
37386
37398
|
return _(i5, i5, (function(e6, i6) {
|
|
37387
37399
|
if (r6 <= e6 && e6 < n4 && r6 <= i6 && i6 < n4) {
|
|
37388
|
-
var o3 = Math.floor((e6 - r6) /
|
|
37400
|
+
var o3 = Math.floor((e6 - r6) / t15), s2 = Math.floor((i6 - r6) / t15);
|
|
37389
37401
|
return v2.isDark(s2, o3) ? 0 : 1;
|
|
37390
37402
|
}
|
|
37391
37403
|
return 1;
|
|
37392
37404
|
}));
|
|
37393
|
-
}, v2.createImgTag = function(
|
|
37394
|
-
|
|
37395
|
-
var r6 = v2.getModuleCount() *
|
|
37396
|
-
return n4 += "<img", n4 += ' src="', n4 += v2.createDataURL(
|
|
37405
|
+
}, v2.createImgTag = function(t15, e5, i5) {
|
|
37406
|
+
t15 = t15 || 2, e5 = void 0 === e5 ? 4 * t15 : e5;
|
|
37407
|
+
var r6 = v2.getModuleCount() * t15 + 2 * e5, n4 = "";
|
|
37408
|
+
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 + "/>";
|
|
37397
37409
|
};
|
|
37398
|
-
var $ = function(
|
|
37399
|
-
for (var e5 = "", i5 = 0; i5 <
|
|
37400
|
-
var r6 =
|
|
37410
|
+
var $ = function(t15) {
|
|
37411
|
+
for (var e5 = "", i5 = 0; i5 < t15.length; i5 += 1) {
|
|
37412
|
+
var r6 = t15.charAt(i5);
|
|
37401
37413
|
switch (r6) {
|
|
37402
37414
|
case "<":
|
|
37403
37415
|
e5 += "<";
|
|
@@ -37417,40 +37429,40 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37417
37429
|
}
|
|
37418
37430
|
return e5;
|
|
37419
37431
|
};
|
|
37420
|
-
return v2.createASCII = function(
|
|
37421
|
-
if ((
|
|
37422
|
-
|
|
37423
|
-
var e6, i6, r7, n5, o4, s3 = 1 * v2.getModuleCount() + 2 *
|
|
37432
|
+
return v2.createASCII = function(t15, e5) {
|
|
37433
|
+
if ((t15 = t15 || 1) < 2) return (function(t16) {
|
|
37434
|
+
t16 = void 0 === t16 ? 2 : t16;
|
|
37435
|
+
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 = "";
|
|
37424
37436
|
for (e6 = 0; e6 < s3; e6 += 2) {
|
|
37425
|
-
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 +=
|
|
37437
|
+
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];
|
|
37426
37438
|
c3 += "\n";
|
|
37427
37439
|
}
|
|
37428
|
-
return s3 % 2 &&
|
|
37440
|
+
return s3 % 2 && t16 > 0 ? c3.substring(0, c3.length - s3 - 1) + Array(s3 + 1).join("\u2580") : c3.substring(0, c3.length - 1);
|
|
37429
37441
|
})(e5);
|
|
37430
|
-
|
|
37431
|
-
var i5, r6, n4, o3, s2 = v2.getModuleCount() *
|
|
37442
|
+
t15 -= 1, e5 = void 0 === e5 ? 2 * t15 : e5;
|
|
37443
|
+
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 = "";
|
|
37432
37444
|
for (i5 = 0; i5 < s2; i5 += 1) {
|
|
37433
|
-
for (n4 = Math.floor((i5 - a2) /
|
|
37434
|
-
for (n4 = 0; n4 <
|
|
37445
|
+
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;
|
|
37446
|
+
for (n4 = 0; n4 < t15; n4 += 1) c2 += l2 + "\n";
|
|
37435
37447
|
}
|
|
37436
37448
|
return c2.substring(0, c2.length - 1);
|
|
37437
|
-
}, v2.renderTo2dContext = function(
|
|
37449
|
+
}, v2.renderTo2dContext = function(t15, e5) {
|
|
37438
37450
|
e5 = e5 || 2;
|
|
37439
|
-
for (var i5 = v2.getModuleCount(), r6 = 0; r6 < i5; r6++) for (var n4 = 0; n4 < i5; n4++)
|
|
37451
|
+
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);
|
|
37440
37452
|
}, v2;
|
|
37441
37453
|
};
|
|
37442
|
-
|
|
37443
|
-
for (var e4 = [], i4 = 0; i4 <
|
|
37444
|
-
var r5 =
|
|
37454
|
+
t13.stringToBytes = (t13.stringToBytesFuncs = { default: function(t14) {
|
|
37455
|
+
for (var e4 = [], i4 = 0; i4 < t14.length; i4 += 1) {
|
|
37456
|
+
var r5 = t14.charCodeAt(i4);
|
|
37445
37457
|
e4.push(255 & r5);
|
|
37446
37458
|
}
|
|
37447
37459
|
return e4;
|
|
37448
|
-
} }).default,
|
|
37460
|
+
} }).default, t13.createStringToBytes = function(t14, e4) {
|
|
37449
37461
|
var i4 = (function() {
|
|
37450
|
-
for (var i5 = v(
|
|
37451
|
-
var
|
|
37452
|
-
if (-1 ==
|
|
37453
|
-
return
|
|
37462
|
+
for (var i5 = v(t14), r6 = function() {
|
|
37463
|
+
var t15 = i5.read();
|
|
37464
|
+
if (-1 == t15) throw "eof";
|
|
37465
|
+
return t15;
|
|
37454
37466
|
}, n3 = 0, o2 = {}; ; ) {
|
|
37455
37467
|
var s2 = i5.read();
|
|
37456
37468
|
if (-1 == s2) break;
|
|
@@ -37460,71 +37472,71 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37460
37472
|
if (n3 != e4) throw n3 + " != " + e4;
|
|
37461
37473
|
return o2;
|
|
37462
37474
|
})(), r5 = "?".charCodeAt(0);
|
|
37463
|
-
return function(
|
|
37464
|
-
for (var e5 = [], n3 = 0; n3 <
|
|
37465
|
-
var o2 =
|
|
37475
|
+
return function(t15) {
|
|
37476
|
+
for (var e5 = [], n3 = 0; n3 < t15.length; n3 += 1) {
|
|
37477
|
+
var o2 = t15.charCodeAt(n3);
|
|
37466
37478
|
if (o2 < 128) e5.push(o2);
|
|
37467
37479
|
else {
|
|
37468
|
-
var s2 = i4[
|
|
37480
|
+
var s2 = i4[t15.charAt(n3)];
|
|
37469
37481
|
"number" == typeof s2 ? (255 & s2) == s2 ? e5.push(s2) : (e5.push(s2 >>> 8), e5.push(255 & s2)) : e5.push(r5);
|
|
37470
37482
|
}
|
|
37471
37483
|
}
|
|
37472
37484
|
return e5;
|
|
37473
37485
|
};
|
|
37474
37486
|
};
|
|
37475
|
-
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(
|
|
37476
|
-
for (var e4 = 0; 0 !=
|
|
37487
|
+
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) {
|
|
37488
|
+
for (var e4 = 0; 0 != t14; ) e4 += 1, t14 >>>= 1;
|
|
37477
37489
|
return e4;
|
|
37478
|
-
}, (n2 = {}).getBCHTypeInfo = function(
|
|
37479
|
-
for (var e4 =
|
|
37480
|
-
return 21522 ^ (
|
|
37481
|
-
}, n2.getBCHTypeNumber = function(
|
|
37482
|
-
for (var e4 =
|
|
37483
|
-
return
|
|
37484
|
-
}, n2.getPatternPosition = function(
|
|
37485
|
-
return e3[
|
|
37486
|
-
}, n2.getMaskFunction = function(
|
|
37487
|
-
switch (
|
|
37490
|
+
}, (n2 = {}).getBCHTypeInfo = function(t14) {
|
|
37491
|
+
for (var e4 = t14 << 10; o(e4) - o(i3) >= 0; ) e4 ^= i3 << o(e4) - o(i3);
|
|
37492
|
+
return 21522 ^ (t14 << 10 | e4);
|
|
37493
|
+
}, n2.getBCHTypeNumber = function(t14) {
|
|
37494
|
+
for (var e4 = t14 << 12; o(e4) - o(r4) >= 0; ) e4 ^= r4 << o(e4) - o(r4);
|
|
37495
|
+
return t14 << 12 | e4;
|
|
37496
|
+
}, n2.getPatternPosition = function(t14) {
|
|
37497
|
+
return e3[t14 - 1];
|
|
37498
|
+
}, n2.getMaskFunction = function(t14) {
|
|
37499
|
+
switch (t14) {
|
|
37488
37500
|
case 0:
|
|
37489
|
-
return function(
|
|
37490
|
-
return (
|
|
37501
|
+
return function(t15, e4) {
|
|
37502
|
+
return (t15 + e4) % 2 == 0;
|
|
37491
37503
|
};
|
|
37492
37504
|
case 1:
|
|
37493
|
-
return function(
|
|
37494
|
-
return
|
|
37505
|
+
return function(t15, e4) {
|
|
37506
|
+
return t15 % 2 == 0;
|
|
37495
37507
|
};
|
|
37496
37508
|
case 2:
|
|
37497
|
-
return function(
|
|
37509
|
+
return function(t15, e4) {
|
|
37498
37510
|
return e4 % 3 == 0;
|
|
37499
37511
|
};
|
|
37500
37512
|
case 3:
|
|
37501
|
-
return function(
|
|
37502
|
-
return (
|
|
37513
|
+
return function(t15, e4) {
|
|
37514
|
+
return (t15 + e4) % 3 == 0;
|
|
37503
37515
|
};
|
|
37504
37516
|
case 4:
|
|
37505
|
-
return function(
|
|
37506
|
-
return (Math.floor(
|
|
37517
|
+
return function(t15, e4) {
|
|
37518
|
+
return (Math.floor(t15 / 2) + Math.floor(e4 / 3)) % 2 == 0;
|
|
37507
37519
|
};
|
|
37508
37520
|
case 5:
|
|
37509
|
-
return function(
|
|
37510
|
-
return
|
|
37521
|
+
return function(t15, e4) {
|
|
37522
|
+
return t15 * e4 % 2 + t15 * e4 % 3 == 0;
|
|
37511
37523
|
};
|
|
37512
37524
|
case 6:
|
|
37513
|
-
return function(
|
|
37514
|
-
return (
|
|
37525
|
+
return function(t15, e4) {
|
|
37526
|
+
return (t15 * e4 % 2 + t15 * e4 % 3) % 2 == 0;
|
|
37515
37527
|
};
|
|
37516
37528
|
case 7:
|
|
37517
|
-
return function(
|
|
37518
|
-
return (
|
|
37529
|
+
return function(t15, e4) {
|
|
37530
|
+
return (t15 * e4 % 3 + (t15 + e4) % 2) % 2 == 0;
|
|
37519
37531
|
};
|
|
37520
37532
|
default:
|
|
37521
|
-
throw "bad maskPattern:" +
|
|
37533
|
+
throw "bad maskPattern:" + t14;
|
|
37522
37534
|
}
|
|
37523
|
-
}, n2.getErrorCorrectPolynomial = function(
|
|
37524
|
-
for (var e4 = d([1], 0), i4 = 0; i4 <
|
|
37535
|
+
}, n2.getErrorCorrectPolynomial = function(t14) {
|
|
37536
|
+
for (var e4 = d([1], 0), i4 = 0; i4 < t14; i4 += 1) e4 = e4.multiply(d([1, h.gexp(i4)], 0));
|
|
37525
37537
|
return e4;
|
|
37526
|
-
}, n2.getLengthInBits = function(
|
|
37527
|
-
if (1 <= e4 && e4 < 10) switch (
|
|
37538
|
+
}, n2.getLengthInBits = function(t14, e4) {
|
|
37539
|
+
if (1 <= e4 && e4 < 10) switch (t14) {
|
|
37528
37540
|
case 1:
|
|
37529
37541
|
return 10;
|
|
37530
37542
|
case 2:
|
|
@@ -37533,9 +37545,9 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37533
37545
|
case 8:
|
|
37534
37546
|
return 8;
|
|
37535
37547
|
default:
|
|
37536
|
-
throw "mode:" +
|
|
37548
|
+
throw "mode:" + t14;
|
|
37537
37549
|
}
|
|
37538
|
-
else if (e4 < 27) switch (
|
|
37550
|
+
else if (e4 < 27) switch (t14) {
|
|
37539
37551
|
case 1:
|
|
37540
37552
|
return 12;
|
|
37541
37553
|
case 2:
|
|
@@ -37545,11 +37557,11 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37545
37557
|
case 8:
|
|
37546
37558
|
return 10;
|
|
37547
37559
|
default:
|
|
37548
|
-
throw "mode:" +
|
|
37560
|
+
throw "mode:" + t14;
|
|
37549
37561
|
}
|
|
37550
37562
|
else {
|
|
37551
37563
|
if (!(e4 < 41)) throw "type:" + e4;
|
|
37552
|
-
switch (
|
|
37564
|
+
switch (t14) {
|
|
37553
37565
|
case 1:
|
|
37554
37566
|
return 14;
|
|
37555
37567
|
case 2:
|
|
@@ -37559,72 +37571,72 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37559
37571
|
case 8:
|
|
37560
37572
|
return 12;
|
|
37561
37573
|
default:
|
|
37562
|
-
throw "mode:" +
|
|
37574
|
+
throw "mode:" + t14;
|
|
37563
37575
|
}
|
|
37564
37576
|
}
|
|
37565
|
-
}, n2.getLostPoint = function(
|
|
37566
|
-
for (var e4 =
|
|
37567
|
-
for (var o2 = 0, s2 =
|
|
37577
|
+
}, n2.getLostPoint = function(t14) {
|
|
37578
|
+
for (var e4 = t14.getModuleCount(), i4 = 0, r5 = 0; r5 < e4; r5 += 1) for (var n3 = 0; n3 < e4; n3 += 1) {
|
|
37579
|
+
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);
|
|
37568
37580
|
o2 > 5 && (i4 += 3 + o2 - 5);
|
|
37569
37581
|
}
|
|
37570
37582
|
for (r5 = 0; r5 < e4 - 1; r5 += 1) for (n3 = 0; n3 < e4 - 1; n3 += 1) {
|
|
37571
37583
|
var d2 = 0;
|
|
37572
|
-
|
|
37584
|
+
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);
|
|
37573
37585
|
}
|
|
37574
|
-
for (r5 = 0; r5 < e4; r5 += 1) for (n3 = 0; n3 < e4 - 6; n3 += 1)
|
|
37575
|
-
for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4 - 6; r5 += 1)
|
|
37586
|
+
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);
|
|
37587
|
+
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);
|
|
37576
37588
|
var u2 = 0;
|
|
37577
|
-
for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4; r5 += 1)
|
|
37589
|
+
for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4; r5 += 1) t14.isDark(r5, n3) && (u2 += 1);
|
|
37578
37590
|
return i4 + Math.abs(100 * u2 / e4 / e4 - 50) / 5 * 10;
|
|
37579
37591
|
}, n2), h = (function() {
|
|
37580
|
-
for (var
|
|
37581
|
-
for (i4 = 8; i4 < 256; i4 += 1)
|
|
37582
|
-
for (i4 = 0; i4 < 255; i4 += 1) e4[
|
|
37583
|
-
return { glog: function(
|
|
37584
|
-
if (
|
|
37585
|
-
return e4[
|
|
37592
|
+
for (var t14 = new Array(256), e4 = new Array(256), i4 = 0; i4 < 8; i4 += 1) t14[i4] = 1 << i4;
|
|
37593
|
+
for (i4 = 8; i4 < 256; i4 += 1) t14[i4] = t14[i4 - 4] ^ t14[i4 - 5] ^ t14[i4 - 6] ^ t14[i4 - 8];
|
|
37594
|
+
for (i4 = 0; i4 < 255; i4 += 1) e4[t14[i4]] = i4;
|
|
37595
|
+
return { glog: function(t15) {
|
|
37596
|
+
if (t15 < 1) throw "glog(" + t15 + ")";
|
|
37597
|
+
return e4[t15];
|
|
37586
37598
|
}, gexp: function(e5) {
|
|
37587
37599
|
for (; e5 < 0; ) e5 += 255;
|
|
37588
37600
|
for (; e5 >= 256; ) e5 -= 255;
|
|
37589
|
-
return
|
|
37601
|
+
return t14[e5];
|
|
37590
37602
|
} };
|
|
37591
37603
|
})();
|
|
37592
|
-
function d(
|
|
37593
|
-
if (void 0 ===
|
|
37604
|
+
function d(t14, e4) {
|
|
37605
|
+
if (void 0 === t14.length) throw t14.length + "/" + e4;
|
|
37594
37606
|
var i4 = (function() {
|
|
37595
|
-
for (var i5 = 0; i5 <
|
|
37596
|
-
for (var r6 = new Array(
|
|
37607
|
+
for (var i5 = 0; i5 < t14.length && 0 == t14[i5]; ) i5 += 1;
|
|
37608
|
+
for (var r6 = new Array(t14.length - i5 + e4), n3 = 0; n3 < t14.length - i5; n3 += 1) r6[n3] = t14[n3 + i5];
|
|
37597
37609
|
return r6;
|
|
37598
|
-
})(), r5 = { getAt: function(
|
|
37599
|
-
return i4[
|
|
37610
|
+
})(), r5 = { getAt: function(t15) {
|
|
37611
|
+
return i4[t15];
|
|
37600
37612
|
}, getLength: function() {
|
|
37601
37613
|
return i4.length;
|
|
37602
|
-
}, multiply: function(
|
|
37603
|
-
for (var e5 = new Array(r5.getLength() +
|
|
37614
|
+
}, multiply: function(t15) {
|
|
37615
|
+
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)));
|
|
37604
37616
|
return d(e5, 0);
|
|
37605
|
-
}, mod: function(
|
|
37606
|
-
if (r5.getLength() -
|
|
37607
|
-
for (var e5 = h.glog(r5.getAt(0)) - h.glog(
|
|
37608
|
-
for (n3 = 0; n3 <
|
|
37609
|
-
return d(i5, 0).mod(
|
|
37617
|
+
}, mod: function(t15) {
|
|
37618
|
+
if (r5.getLength() - t15.getLength() < 0) return r5;
|
|
37619
|
+
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);
|
|
37620
|
+
for (n3 = 0; n3 < t15.getLength(); n3 += 1) i5[n3] ^= h.gexp(h.glog(t15.getAt(n3)) + e5);
|
|
37621
|
+
return d(i5, 0).mod(t15);
|
|
37610
37622
|
} };
|
|
37611
37623
|
return r5;
|
|
37612
37624
|
}
|
|
37613
37625
|
var u = /* @__PURE__ */ (function() {
|
|
37614
|
-
var
|
|
37626
|
+
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) {
|
|
37615
37627
|
var i5 = {};
|
|
37616
|
-
return i5.totalCount =
|
|
37628
|
+
return i5.totalCount = t15, i5.dataCount = e5, i5;
|
|
37617
37629
|
}, i4 = { getRSBlocks: function(i5, r5) {
|
|
37618
37630
|
var n3 = (function(e5, i6) {
|
|
37619
37631
|
switch (i6) {
|
|
37620
37632
|
case s.L:
|
|
37621
|
-
return
|
|
37633
|
+
return t14[4 * (e5 - 1) + 0];
|
|
37622
37634
|
case s.M:
|
|
37623
|
-
return
|
|
37635
|
+
return t14[4 * (e5 - 1) + 1];
|
|
37624
37636
|
case s.Q:
|
|
37625
|
-
return
|
|
37637
|
+
return t14[4 * (e5 - 1) + 2];
|
|
37626
37638
|
case s.H:
|
|
37627
|
-
return
|
|
37639
|
+
return t14[4 * (e5 - 1) + 3];
|
|
37628
37640
|
default:
|
|
37629
37641
|
return;
|
|
37630
37642
|
}
|
|
@@ -37635,48 +37647,48 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37635
37647
|
} };
|
|
37636
37648
|
return i4;
|
|
37637
37649
|
})(), c = function() {
|
|
37638
|
-
var
|
|
37639
|
-
return
|
|
37650
|
+
var t14 = [], e4 = 0, i4 = { getBuffer: function() {
|
|
37651
|
+
return t14;
|
|
37640
37652
|
}, getAt: function(e5) {
|
|
37641
37653
|
var i5 = Math.floor(e5 / 8);
|
|
37642
|
-
return 1 == (
|
|
37643
|
-
}, put: function(
|
|
37644
|
-
for (var r5 = 0; r5 < e5; r5 += 1) i4.putBit(1 == (
|
|
37654
|
+
return 1 == (t14[i5] >>> 7 - e5 % 8 & 1);
|
|
37655
|
+
}, put: function(t15, e5) {
|
|
37656
|
+
for (var r5 = 0; r5 < e5; r5 += 1) i4.putBit(1 == (t15 >>> e5 - r5 - 1 & 1));
|
|
37645
37657
|
}, getLengthInBits: function() {
|
|
37646
37658
|
return e4;
|
|
37647
37659
|
}, putBit: function(i5) {
|
|
37648
37660
|
var r5 = Math.floor(e4 / 8);
|
|
37649
|
-
|
|
37661
|
+
t14.length <= r5 && t14.push(0), i5 && (t14[r5] |= 128 >>> e4 % 8), e4 += 1;
|
|
37650
37662
|
} };
|
|
37651
37663
|
return i4;
|
|
37652
|
-
}, l = function(
|
|
37653
|
-
var e4 =
|
|
37664
|
+
}, l = function(t14) {
|
|
37665
|
+
var e4 = t14, i4 = { getMode: function() {
|
|
37654
37666
|
return 1;
|
|
37655
|
-
}, getLength: function(
|
|
37667
|
+
}, getLength: function(t15) {
|
|
37656
37668
|
return e4.length;
|
|
37657
|
-
}, write: function(
|
|
37658
|
-
for (var i5 = e4, n4 = 0; n4 + 2 < i5.length; )
|
|
37659
|
-
n4 < i5.length && (i5.length - n4 == 1 ?
|
|
37660
|
-
} }, r5 = function(
|
|
37661
|
-
for (var e5 = 0, i5 = 0; i5 <
|
|
37669
|
+
}, write: function(t15) {
|
|
37670
|
+
for (var i5 = e4, n4 = 0; n4 + 2 < i5.length; ) t15.put(r5(i5.substring(n4, n4 + 3)), 10), n4 += 3;
|
|
37671
|
+
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));
|
|
37672
|
+
} }, r5 = function(t15) {
|
|
37673
|
+
for (var e5 = 0, i5 = 0; i5 < t15.length; i5 += 1) e5 = 10 * e5 + n3(t15.charAt(i5));
|
|
37662
37674
|
return e5;
|
|
37663
|
-
}, n3 = function(
|
|
37664
|
-
if ("0" <=
|
|
37665
|
-
throw "illegal char :" +
|
|
37675
|
+
}, n3 = function(t15) {
|
|
37676
|
+
if ("0" <= t15 && t15 <= "9") return t15.charCodeAt(0) - "0".charCodeAt(0);
|
|
37677
|
+
throw "illegal char :" + t15;
|
|
37666
37678
|
};
|
|
37667
37679
|
return i4;
|
|
37668
|
-
}, g = function(
|
|
37669
|
-
var e4 =
|
|
37680
|
+
}, g = function(t14) {
|
|
37681
|
+
var e4 = t14, i4 = { getMode: function() {
|
|
37670
37682
|
return 2;
|
|
37671
|
-
}, getLength: function(
|
|
37683
|
+
}, getLength: function(t15) {
|
|
37672
37684
|
return e4.length;
|
|
37673
|
-
}, write: function(
|
|
37674
|
-
for (var i5 = e4, n3 = 0; n3 + 1 < i5.length; )
|
|
37675
|
-
n3 < i5.length &&
|
|
37676
|
-
} }, r5 = function(
|
|
37677
|
-
if ("0" <=
|
|
37678
|
-
if ("A" <=
|
|
37679
|
-
switch (
|
|
37685
|
+
}, write: function(t15) {
|
|
37686
|
+
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;
|
|
37687
|
+
n3 < i5.length && t15.put(r5(i5.charAt(n3)), 6);
|
|
37688
|
+
} }, r5 = function(t15) {
|
|
37689
|
+
if ("0" <= t15 && t15 <= "9") return t15.charCodeAt(0) - "0".charCodeAt(0);
|
|
37690
|
+
if ("A" <= t15 && t15 <= "Z") return t15.charCodeAt(0) - "A".charCodeAt(0) + 10;
|
|
37691
|
+
switch (t15) {
|
|
37680
37692
|
case " ":
|
|
37681
37693
|
return 36;
|
|
37682
37694
|
case "$":
|
|
@@ -37696,31 +37708,31 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37696
37708
|
case ":":
|
|
37697
37709
|
return 44;
|
|
37698
37710
|
default:
|
|
37699
|
-
throw "illegal char :" +
|
|
37711
|
+
throw "illegal char :" + t15;
|
|
37700
37712
|
}
|
|
37701
37713
|
};
|
|
37702
37714
|
return i4;
|
|
37703
37715
|
}, f = function(e4) {
|
|
37704
|
-
var i4 =
|
|
37716
|
+
var i4 = t13.stringToBytes(e4);
|
|
37705
37717
|
return { getMode: function() {
|
|
37706
37718
|
return 4;
|
|
37707
|
-
}, getLength: function(
|
|
37719
|
+
}, getLength: function(t14) {
|
|
37708
37720
|
return i4.length;
|
|
37709
|
-
}, write: function(
|
|
37710
|
-
for (var e5 = 0; e5 < i4.length; e5 += 1)
|
|
37721
|
+
}, write: function(t14) {
|
|
37722
|
+
for (var e5 = 0; e5 < i4.length; e5 += 1) t14.put(i4[e5], 8);
|
|
37711
37723
|
} };
|
|
37712
37724
|
}, w = function(e4) {
|
|
37713
|
-
var i4 =
|
|
37725
|
+
var i4 = t13.stringToBytesFuncs.SJIS;
|
|
37714
37726
|
if (!i4) throw "sjis not supported.";
|
|
37715
37727
|
!(function() {
|
|
37716
|
-
var
|
|
37717
|
-
if (2 !=
|
|
37728
|
+
var t14 = i4("\u53CB");
|
|
37729
|
+
if (2 != t14.length || 38726 != (t14[0] << 8 | t14[1])) throw "sjis not supported.";
|
|
37718
37730
|
})();
|
|
37719
37731
|
var r5 = i4(e4), n3 = { getMode: function() {
|
|
37720
37732
|
return 8;
|
|
37721
|
-
}, getLength: function(
|
|
37733
|
+
}, getLength: function(t14) {
|
|
37722
37734
|
return ~~(r5.length / 2);
|
|
37723
|
-
}, write: function(
|
|
37735
|
+
}, write: function(t14) {
|
|
37724
37736
|
for (var e5 = r5, i5 = 0; i5 + 1 < e5.length; ) {
|
|
37725
37737
|
var n4 = (255 & e5[i5]) << 8 | 255 & e5[i5 + 1];
|
|
37726
37738
|
if (33088 <= n4 && n4 <= 40956) n4 -= 33088;
|
|
@@ -37728,69 +37740,69 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37728
37740
|
if (!(57408 <= n4 && n4 <= 60351)) throw "illegal char at " + (i5 + 1) + "/" + n4;
|
|
37729
37741
|
n4 -= 49472;
|
|
37730
37742
|
}
|
|
37731
|
-
n4 = 192 * (n4 >>> 8 & 255) + (255 & n4),
|
|
37743
|
+
n4 = 192 * (n4 >>> 8 & 255) + (255 & n4), t14.put(n4, 13), i5 += 2;
|
|
37732
37744
|
}
|
|
37733
37745
|
if (i5 < e5.length) throw "illegal char at " + (i5 + 1);
|
|
37734
37746
|
} };
|
|
37735
37747
|
return n3;
|
|
37736
37748
|
}, p = function() {
|
|
37737
|
-
var
|
|
37738
|
-
|
|
37739
|
-
}, writeShort: function(
|
|
37740
|
-
e4.writeByte(
|
|
37741
|
-
}, writeBytes: function(
|
|
37742
|
-
i4 = i4 || 0, r5 = r5 ||
|
|
37743
|
-
for (var n3 = 0; n3 < r5; n3 += 1) e4.writeByte(
|
|
37744
|
-
}, writeString: function(
|
|
37745
|
-
for (var i4 = 0; i4 <
|
|
37749
|
+
var t14 = [], e4 = { writeByte: function(e5) {
|
|
37750
|
+
t14.push(255 & e5);
|
|
37751
|
+
}, writeShort: function(t15) {
|
|
37752
|
+
e4.writeByte(t15), e4.writeByte(t15 >>> 8);
|
|
37753
|
+
}, writeBytes: function(t15, i4, r5) {
|
|
37754
|
+
i4 = i4 || 0, r5 = r5 || t15.length;
|
|
37755
|
+
for (var n3 = 0; n3 < r5; n3 += 1) e4.writeByte(t15[n3 + i4]);
|
|
37756
|
+
}, writeString: function(t15) {
|
|
37757
|
+
for (var i4 = 0; i4 < t15.length; i4 += 1) e4.writeByte(t15.charCodeAt(i4));
|
|
37746
37758
|
}, toByteArray: function() {
|
|
37747
|
-
return
|
|
37759
|
+
return t14;
|
|
37748
37760
|
}, toString: function() {
|
|
37749
37761
|
var e5 = "";
|
|
37750
37762
|
e5 += "[";
|
|
37751
|
-
for (var i4 = 0; i4 <
|
|
37763
|
+
for (var i4 = 0; i4 < t14.length; i4 += 1) i4 > 0 && (e5 += ","), e5 += t14[i4];
|
|
37752
37764
|
return e5 + "]";
|
|
37753
37765
|
} };
|
|
37754
37766
|
return e4;
|
|
37755
|
-
}, v = function(
|
|
37756
|
-
var e4 =
|
|
37767
|
+
}, v = function(t14) {
|
|
37768
|
+
var e4 = t14, i4 = 0, r5 = 0, n3 = 0, o2 = { read: function() {
|
|
37757
37769
|
for (; n3 < 8; ) {
|
|
37758
37770
|
if (i4 >= e4.length) {
|
|
37759
37771
|
if (0 == n3) return -1;
|
|
37760
37772
|
throw "unexpected end of file./" + n3;
|
|
37761
37773
|
}
|
|
37762
|
-
var
|
|
37763
|
-
if (i4 += 1, "=" ==
|
|
37764
|
-
|
|
37774
|
+
var t15 = e4.charAt(i4);
|
|
37775
|
+
if (i4 += 1, "=" == t15) return n3 = 0, -1;
|
|
37776
|
+
t15.match(/^\s$/) || (r5 = r5 << 6 | s2(t15.charCodeAt(0)), n3 += 6);
|
|
37765
37777
|
}
|
|
37766
37778
|
var o3 = r5 >>> n3 - 8 & 255;
|
|
37767
37779
|
return n3 -= 8, o3;
|
|
37768
|
-
} }, s2 = function(
|
|
37769
|
-
if (65 <=
|
|
37770
|
-
if (97 <=
|
|
37771
|
-
if (48 <=
|
|
37772
|
-
if (43 ==
|
|
37773
|
-
if (47 ==
|
|
37774
|
-
throw "c:" +
|
|
37780
|
+
} }, s2 = function(t15) {
|
|
37781
|
+
if (65 <= t15 && t15 <= 90) return t15 - 65;
|
|
37782
|
+
if (97 <= t15 && t15 <= 122) return t15 - 97 + 26;
|
|
37783
|
+
if (48 <= t15 && t15 <= 57) return t15 - 48 + 52;
|
|
37784
|
+
if (43 == t15) return 62;
|
|
37785
|
+
if (47 == t15) return 63;
|
|
37786
|
+
throw "c:" + t15;
|
|
37775
37787
|
};
|
|
37776
37788
|
return o2;
|
|
37777
|
-
}, _ = function(
|
|
37778
|
-
for (var r5 = (function(
|
|
37779
|
-
var i5 =
|
|
37780
|
-
n4[e6 * i5 +
|
|
37781
|
-
}, write: function(
|
|
37782
|
-
|
|
37789
|
+
}, _ = function(t14, e4, i4) {
|
|
37790
|
+
for (var r5 = (function(t15, e5) {
|
|
37791
|
+
var i5 = t15, r6 = e5, n4 = new Array(t15 * e5), o3 = { setPixel: function(t16, e6, r7) {
|
|
37792
|
+
n4[e6 * i5 + t16] = r7;
|
|
37793
|
+
}, write: function(t16) {
|
|
37794
|
+
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);
|
|
37783
37795
|
var e6 = s3(2);
|
|
37784
|
-
|
|
37785
|
-
for (var n5 = 0; e6.length - n5 > 255; )
|
|
37786
|
-
|
|
37787
|
-
} }, s3 = function(
|
|
37788
|
-
for (var e6 = 1 <<
|
|
37796
|
+
t16.writeByte(2);
|
|
37797
|
+
for (var n5 = 0; e6.length - n5 > 255; ) t16.writeByte(255), t16.writeBytes(e6, n5, 255), n5 += 255;
|
|
37798
|
+
t16.writeByte(e6.length - n5), t16.writeBytes(e6, n5, e6.length - n5), t16.writeByte(0), t16.writeString(";");
|
|
37799
|
+
} }, s3 = function(t16) {
|
|
37800
|
+
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));
|
|
37789
37801
|
o4.add(String.fromCharCode(e6)), o4.add(String.fromCharCode(i6));
|
|
37790
|
-
var h3, d3, u2, c2 = p(), l2 = (h3 = c2, d3 = 0, u2 = 0, { write: function(
|
|
37791
|
-
if (
|
|
37792
|
-
for (; d3 + e7 >= 8; ) h3.writeByte(255 & (
|
|
37793
|
-
u2 |=
|
|
37802
|
+
var h3, d3, u2, c2 = p(), l2 = (h3 = c2, d3 = 0, u2 = 0, { write: function(t17, e7) {
|
|
37803
|
+
if (t17 >>> e7 != 0) throw "length over";
|
|
37804
|
+
for (; d3 + e7 >= 8; ) h3.writeByte(255 & (t17 << d3 | u2)), e7 -= 8 - d3, t17 >>>= 8 - d3, u2 = 0, d3 = 0;
|
|
37805
|
+
u2 |= t17 << d3, d3 += e7;
|
|
37794
37806
|
}, flush: function() {
|
|
37795
37807
|
d3 > 0 && h3.writeByte(u2);
|
|
37796
37808
|
} });
|
|
@@ -37802,95 +37814,95 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37802
37814
|
}
|
|
37803
37815
|
return l2.write(o4.indexOf(f2), r7), l2.write(i6, r7), l2.flush(), c2.toByteArray();
|
|
37804
37816
|
}, a3 = function() {
|
|
37805
|
-
var
|
|
37817
|
+
var t16 = {}, e6 = 0, i6 = { add: function(r7) {
|
|
37806
37818
|
if (i6.contains(r7)) throw "dup key:" + r7;
|
|
37807
|
-
|
|
37819
|
+
t16[r7] = e6, e6 += 1;
|
|
37808
37820
|
}, size: function() {
|
|
37809
37821
|
return e6;
|
|
37810
37822
|
}, indexOf: function(e7) {
|
|
37811
|
-
return
|
|
37823
|
+
return t16[e7];
|
|
37812
37824
|
}, contains: function(e7) {
|
|
37813
|
-
return void 0 !==
|
|
37825
|
+
return void 0 !== t16[e7];
|
|
37814
37826
|
} };
|
|
37815
37827
|
return i6;
|
|
37816
37828
|
};
|
|
37817
37829
|
return o3;
|
|
37818
|
-
})(
|
|
37830
|
+
})(t14, e4), n3 = 0; n3 < e4; n3 += 1) for (var o2 = 0; o2 < t14; o2 += 1) r5.setPixel(o2, n3, i4(o2, n3));
|
|
37819
37831
|
var s2 = p();
|
|
37820
37832
|
r5.write(s2);
|
|
37821
37833
|
for (var a2 = (function() {
|
|
37822
|
-
var
|
|
37823
|
-
r6 += String.fromCharCode(s3(63 &
|
|
37824
|
-
}, s3 = function(
|
|
37825
|
-
if (
|
|
37834
|
+
var t15 = 0, e5 = 0, i5 = 0, r6 = "", n4 = {}, o3 = function(t16) {
|
|
37835
|
+
r6 += String.fromCharCode(s3(63 & t16));
|
|
37836
|
+
}, s3 = function(t16) {
|
|
37837
|
+
if (t16 < 0) ;
|
|
37826
37838
|
else {
|
|
37827
|
-
if (
|
|
37828
|
-
if (
|
|
37829
|
-
if (
|
|
37830
|
-
if (62 ==
|
|
37831
|
-
if (63 ==
|
|
37839
|
+
if (t16 < 26) return 65 + t16;
|
|
37840
|
+
if (t16 < 52) return t16 - 26 + 97;
|
|
37841
|
+
if (t16 < 62) return t16 - 52 + 48;
|
|
37842
|
+
if (62 == t16) return 43;
|
|
37843
|
+
if (63 == t16) return 47;
|
|
37832
37844
|
}
|
|
37833
|
-
throw "n:" +
|
|
37845
|
+
throw "n:" + t16;
|
|
37834
37846
|
};
|
|
37835
37847
|
return n4.writeByte = function(r7) {
|
|
37836
|
-
for (
|
|
37848
|
+
for (t15 = t15 << 8 | 255 & r7, e5 += 8, i5 += 1; e5 >= 6; ) o3(t15 >>> e5 - 6), e5 -= 6;
|
|
37837
37849
|
}, n4.flush = function() {
|
|
37838
|
-
if (e5 > 0 && (o3(
|
|
37850
|
+
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 += "=";
|
|
37839
37851
|
}, n4.toString = function() {
|
|
37840
37852
|
return r6;
|
|
37841
37853
|
}, n4;
|
|
37842
37854
|
})(), h2 = s2.toByteArray(), d2 = 0; d2 < h2.length; d2 += 1) a2.writeByte(h2[d2]);
|
|
37843
37855
|
return a2.flush(), "data:image/gif;base64," + a2;
|
|
37844
37856
|
};
|
|
37845
|
-
return
|
|
37857
|
+
return t13;
|
|
37846
37858
|
})();
|
|
37847
|
-
n.stringToBytesFuncs["UTF-8"] = function(
|
|
37848
|
-
return (function(
|
|
37849
|
-
for (var e3 = [], i3 = 0; i3 <
|
|
37850
|
-
var r4 =
|
|
37851
|
-
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 &
|
|
37859
|
+
n.stringToBytesFuncs["UTF-8"] = function(t13) {
|
|
37860
|
+
return (function(t14) {
|
|
37861
|
+
for (var e3 = [], i3 = 0; i3 < t14.length; i3++) {
|
|
37862
|
+
var r4 = t14.charCodeAt(i3);
|
|
37863
|
+
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));
|
|
37852
37864
|
}
|
|
37853
37865
|
return e3;
|
|
37854
|
-
})(
|
|
37866
|
+
})(t13);
|
|
37855
37867
|
}, void 0 === (r3 = "function" == typeof (i2 = function() {
|
|
37856
37868
|
return n;
|
|
37857
|
-
}) ? i2.apply(e2, []) : i2) || (
|
|
37869
|
+
}) ? i2.apply(e2, []) : i2) || (t12.exports = r3);
|
|
37858
37870
|
} }, e = {};
|
|
37859
37871
|
function i(r3) {
|
|
37860
37872
|
var n = e[r3];
|
|
37861
37873
|
if (void 0 !== n) return n.exports;
|
|
37862
37874
|
var o = e[r3] = { exports: {} };
|
|
37863
|
-
return
|
|
37875
|
+
return t11[r3](o, o.exports, i), o.exports;
|
|
37864
37876
|
}
|
|
37865
|
-
i.n = (
|
|
37866
|
-
var e2 =
|
|
37877
|
+
i.n = (t12) => {
|
|
37878
|
+
var e2 = t12 && t12.__esModule ? () => t12.default : () => t12;
|
|
37867
37879
|
return i.d(e2, { a: e2 }), e2;
|
|
37868
|
-
}, i.d = (
|
|
37869
|
-
for (var r3 in e2) i.o(e2, r3) && !i.o(
|
|
37870
|
-
}, i.o = (
|
|
37880
|
+
}, i.d = (t12, e2) => {
|
|
37881
|
+
for (var r3 in e2) i.o(e2, r3) && !i.o(t12, r3) && Object.defineProperty(t12, r3, { enumerable: true, get: e2[r3] });
|
|
37882
|
+
}, i.o = (t12, e2) => Object.prototype.hasOwnProperty.call(t12, e2);
|
|
37871
37883
|
var r2 = {};
|
|
37872
37884
|
return (() => {
|
|
37873
37885
|
"use strict";
|
|
37874
37886
|
i.d(r2, { default: () => $ });
|
|
37875
|
-
const
|
|
37887
|
+
const t12 = (t13) => !!t13 && "object" == typeof t13 && !Array.isArray(t13);
|
|
37876
37888
|
function e2(i2, ...r3) {
|
|
37877
37889
|
if (!r3.length) return i2;
|
|
37878
37890
|
const n2 = r3.shift();
|
|
37879
|
-
return void 0 !== n2 &&
|
|
37891
|
+
return void 0 !== n2 && t12(i2) && t12(n2) ? (i2 = Object.assign({}, i2), Object.keys(n2).forEach(((r4) => {
|
|
37880
37892
|
const o2 = i2[r4], s2 = n2[r4];
|
|
37881
|
-
Array.isArray(o2) && Array.isArray(s2) ? i2[r4] = s2 :
|
|
37893
|
+
Array.isArray(o2) && Array.isArray(s2) ? i2[r4] = s2 : t12(o2) && t12(s2) ? i2[r4] = e2(Object.assign({}, o2), s2) : i2[r4] = s2;
|
|
37882
37894
|
})), e2(i2, ...r3)) : i2;
|
|
37883
37895
|
}
|
|
37884
|
-
function n(
|
|
37896
|
+
function n(t13, e3) {
|
|
37885
37897
|
const i2 = document.createElement("a");
|
|
37886
|
-
i2.download = e3, i2.href =
|
|
37898
|
+
i2.download = e3, i2.href = t13, document.body.appendChild(i2), i2.click(), document.body.removeChild(i2);
|
|
37887
37899
|
}
|
|
37888
37900
|
const o = { L: 0.07, M: 0.15, Q: 0.25, H: 0.3 };
|
|
37889
37901
|
class s {
|
|
37890
|
-
constructor({ svg:
|
|
37891
|
-
this._svg =
|
|
37902
|
+
constructor({ svg: t13, type: e3, window: i2 }) {
|
|
37903
|
+
this._svg = t13, this._type = e3, this._window = i2;
|
|
37892
37904
|
}
|
|
37893
|
-
draw(
|
|
37905
|
+
draw(t13, e3, i2, r3) {
|
|
37894
37906
|
let n2;
|
|
37895
37907
|
switch (this._type) {
|
|
37896
37908
|
case "dots":
|
|
@@ -37911,100 +37923,100 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37911
37923
|
default:
|
|
37912
37924
|
n2 = this._drawSquare;
|
|
37913
37925
|
}
|
|
37914
|
-
n2.call(this, { x:
|
|
37926
|
+
n2.call(this, { x: t13, y: e3, size: i2, getNeighbor: r3 });
|
|
37915
37927
|
}
|
|
37916
|
-
_rotateFigure({ x:
|
|
37928
|
+
_rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
|
|
37917
37929
|
var o2;
|
|
37918
|
-
const s2 =
|
|
37930
|
+
const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
|
|
37919
37931
|
n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
|
|
37920
37932
|
}
|
|
37921
|
-
_basicDot(
|
|
37922
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37923
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37933
|
+
_basicDot(t13) {
|
|
37934
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37935
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37924
37936
|
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));
|
|
37925
37937
|
} }));
|
|
37926
37938
|
}
|
|
37927
|
-
_basicSquare(
|
|
37928
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37929
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37939
|
+
_basicSquare(t13) {
|
|
37940
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37941
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37930
37942
|
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));
|
|
37931
37943
|
} }));
|
|
37932
37944
|
}
|
|
37933
|
-
_basicSideRounded(
|
|
37934
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37935
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37945
|
+
_basicSideRounded(t13) {
|
|
37946
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37947
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37936
37948
|
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}`);
|
|
37937
37949
|
} }));
|
|
37938
37950
|
}
|
|
37939
|
-
_basicCornerRounded(
|
|
37940
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37941
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37951
|
+
_basicCornerRounded(t13) {
|
|
37952
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37953
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37942
37954
|
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}`);
|
|
37943
37955
|
} }));
|
|
37944
37956
|
}
|
|
37945
|
-
_basicCornerExtraRounded(
|
|
37946
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37947
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37957
|
+
_basicCornerExtraRounded(t13) {
|
|
37958
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37959
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37948
37960
|
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}`);
|
|
37949
37961
|
} }));
|
|
37950
37962
|
}
|
|
37951
|
-
_basicCornersRounded(
|
|
37952
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37953
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37963
|
+
_basicCornersRounded(t13) {
|
|
37964
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37965
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37954
37966
|
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}`);
|
|
37955
37967
|
} }));
|
|
37956
37968
|
}
|
|
37957
|
-
_drawDot({ x:
|
|
37958
|
-
this._basicDot({ x:
|
|
37969
|
+
_drawDot({ x: t13, y: e3, size: i2 }) {
|
|
37970
|
+
this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37959
37971
|
}
|
|
37960
|
-
_drawSquare({ x:
|
|
37961
|
-
this._basicSquare({ x:
|
|
37972
|
+
_drawSquare({ x: t13, y: e3, size: i2 }) {
|
|
37973
|
+
this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37962
37974
|
}
|
|
37963
|
-
_drawRounded({ x:
|
|
37975
|
+
_drawRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
|
|
37964
37976
|
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;
|
|
37965
|
-
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x:
|
|
37977
|
+
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37966
37978
|
else {
|
|
37967
37979
|
if (2 === h2) {
|
|
37968
37980
|
let r4 = 0;
|
|
37969
|
-
return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerRounded({ x:
|
|
37981
|
+
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 });
|
|
37970
37982
|
}
|
|
37971
37983
|
if (1 === h2) {
|
|
37972
37984
|
let r4 = 0;
|
|
37973
|
-
return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x:
|
|
37985
|
+
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 });
|
|
37974
37986
|
}
|
|
37975
37987
|
}
|
|
37976
|
-
else this._basicDot({ x:
|
|
37988
|
+
else this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37977
37989
|
}
|
|
37978
|
-
_drawExtraRounded({ x:
|
|
37990
|
+
_drawExtraRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
|
|
37979
37991
|
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;
|
|
37980
|
-
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x:
|
|
37992
|
+
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37981
37993
|
else {
|
|
37982
37994
|
if (2 === h2) {
|
|
37983
37995
|
let r4 = 0;
|
|
37984
|
-
return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerExtraRounded({ x:
|
|
37996
|
+
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 });
|
|
37985
37997
|
}
|
|
37986
37998
|
if (1 === h2) {
|
|
37987
37999
|
let r4 = 0;
|
|
37988
|
-
return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x:
|
|
38000
|
+
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 });
|
|
37989
38001
|
}
|
|
37990
38002
|
}
|
|
37991
|
-
else this._basicDot({ x:
|
|
38003
|
+
else this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37992
38004
|
}
|
|
37993
|
-
_drawClassy({ x:
|
|
38005
|
+
_drawClassy({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
|
|
37994
38006
|
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;
|
|
37995
|
-
0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x:
|
|
38007
|
+
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 });
|
|
37996
38008
|
}
|
|
37997
|
-
_drawClassyRounded({ x:
|
|
38009
|
+
_drawClassyRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
|
|
37998
38010
|
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;
|
|
37999
|
-
0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x:
|
|
38011
|
+
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 });
|
|
38000
38012
|
}
|
|
38001
38013
|
}
|
|
38002
38014
|
const a = { dot: "dot", square: "square", extraRounded: "extra-rounded" }, h = Object.values(a);
|
|
38003
38015
|
class d {
|
|
38004
|
-
constructor({ svg:
|
|
38005
|
-
this._svg =
|
|
38016
|
+
constructor({ svg: t13, type: e3, window: i2 }) {
|
|
38017
|
+
this._svg = t13, this._type = e3, this._window = i2;
|
|
38006
38018
|
}
|
|
38007
|
-
draw(
|
|
38019
|
+
draw(t13, e3, i2, r3) {
|
|
38008
38020
|
let n2;
|
|
38009
38021
|
switch (this._type) {
|
|
38010
38022
|
case a.square:
|
|
@@ -38016,78 +38028,78 @@ var require_qr_code_styling = __commonJS2({
|
|
|
38016
38028
|
default:
|
|
38017
38029
|
n2 = this._drawDot;
|
|
38018
38030
|
}
|
|
38019
|
-
n2.call(this, { x:
|
|
38031
|
+
n2.call(this, { x: t13, y: e3, size: i2, rotation: r3 });
|
|
38020
38032
|
}
|
|
38021
|
-
_rotateFigure({ x:
|
|
38033
|
+
_rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
|
|
38022
38034
|
var o2;
|
|
38023
|
-
const s2 =
|
|
38035
|
+
const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
|
|
38024
38036
|
n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
|
|
38025
38037
|
}
|
|
38026
|
-
_basicDot(
|
|
38027
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38028
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38038
|
+
_basicDot(t13) {
|
|
38039
|
+
const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
|
|
38040
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38029
38041
|
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`);
|
|
38030
38042
|
} }));
|
|
38031
38043
|
}
|
|
38032
|
-
_basicSquare(
|
|
38033
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38034
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38044
|
+
_basicSquare(t13) {
|
|
38045
|
+
const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
|
|
38046
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38035
38047
|
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");
|
|
38036
38048
|
} }));
|
|
38037
38049
|
}
|
|
38038
|
-
_basicExtraRounded(
|
|
38039
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38040
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38050
|
+
_basicExtraRounded(t13) {
|
|
38051
|
+
const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
|
|
38052
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38041
38053
|
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}`);
|
|
38042
38054
|
} }));
|
|
38043
38055
|
}
|
|
38044
|
-
_drawDot({ x:
|
|
38045
|
-
this._basicDot({ x:
|
|
38056
|
+
_drawDot({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38057
|
+
this._basicDot({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38046
38058
|
}
|
|
38047
|
-
_drawSquare({ x:
|
|
38048
|
-
this._basicSquare({ x:
|
|
38059
|
+
_drawSquare({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38060
|
+
this._basicSquare({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38049
38061
|
}
|
|
38050
|
-
_drawExtraRounded({ x:
|
|
38051
|
-
this._basicExtraRounded({ x:
|
|
38062
|
+
_drawExtraRounded({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38063
|
+
this._basicExtraRounded({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38052
38064
|
}
|
|
38053
38065
|
}
|
|
38054
38066
|
const u = { dot: "dot", square: "square" }, c = Object.values(u);
|
|
38055
38067
|
class l {
|
|
38056
|
-
constructor({ svg:
|
|
38057
|
-
this._svg =
|
|
38068
|
+
constructor({ svg: t13, type: e3, window: i2 }) {
|
|
38069
|
+
this._svg = t13, this._type = e3, this._window = i2;
|
|
38058
38070
|
}
|
|
38059
|
-
draw(
|
|
38071
|
+
draw(t13, e3, i2, r3) {
|
|
38060
38072
|
let n2;
|
|
38061
|
-
n2 = this._type === u.square ? this._drawSquare : this._drawDot, n2.call(this, { x:
|
|
38073
|
+
n2 = this._type === u.square ? this._drawSquare : this._drawDot, n2.call(this, { x: t13, y: e3, size: i2, rotation: r3 });
|
|
38062
38074
|
}
|
|
38063
|
-
_rotateFigure({ x:
|
|
38075
|
+
_rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
|
|
38064
38076
|
var o2;
|
|
38065
|
-
const s2 =
|
|
38077
|
+
const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
|
|
38066
38078
|
n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
|
|
38067
38079
|
}
|
|
38068
|
-
_basicDot(
|
|
38069
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38070
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38080
|
+
_basicDot(t13) {
|
|
38081
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
38082
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38071
38083
|
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));
|
|
38072
38084
|
} }));
|
|
38073
38085
|
}
|
|
38074
|
-
_basicSquare(
|
|
38075
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38076
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38086
|
+
_basicSquare(t13) {
|
|
38087
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
38088
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38077
38089
|
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));
|
|
38078
38090
|
} }));
|
|
38079
38091
|
}
|
|
38080
|
-
_drawDot({ x:
|
|
38081
|
-
this._basicDot({ x:
|
|
38092
|
+
_drawDot({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38093
|
+
this._basicDot({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38082
38094
|
}
|
|
38083
|
-
_drawSquare({ x:
|
|
38084
|
-
this._basicSquare({ x:
|
|
38095
|
+
_drawSquare({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38096
|
+
this._basicSquare({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38085
38097
|
}
|
|
38086
38098
|
}
|
|
38087
38099
|
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]];
|
|
38088
38100
|
class p {
|
|
38089
|
-
constructor(
|
|
38090
|
-
this._roundSize = (
|
|
38101
|
+
constructor(t13, e3) {
|
|
38102
|
+
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;
|
|
38091
38103
|
}
|
|
38092
38104
|
get width() {
|
|
38093
38105
|
return this._options.width;
|
|
@@ -38098,135 +38110,135 @@ var require_qr_code_styling = __commonJS2({
|
|
|
38098
38110
|
getElement() {
|
|
38099
38111
|
return this._element;
|
|
38100
38112
|
}
|
|
38101
|
-
async drawQR(
|
|
38102
|
-
const e3 =
|
|
38113
|
+
async drawQR(t13) {
|
|
38114
|
+
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);
|
|
38103
38115
|
let s2 = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 };
|
|
38104
|
-
if (this._qr =
|
|
38116
|
+
if (this._qr = t13, this._options.image) {
|
|
38105
38117
|
if (await this.loadImage(), !this._image) return;
|
|
38106
|
-
const { imageOptions:
|
|
38107
|
-
s2 = (function({ originalHeight:
|
|
38118
|
+
const { imageOptions: t14, qrOptions: i3 } = this._options, r4 = t14.imageSize * o[i3.errorCorrectionLevel], a2 = Math.floor(r4 * e3 * e3);
|
|
38119
|
+
s2 = (function({ originalHeight: t15, originalWidth: e4, maxHiddenDots: i4, maxHiddenAxisDots: r5, dotSize: n3 }) {
|
|
38108
38120
|
const o2 = { x: 0, y: 0 }, s3 = { x: 0, y: 0 };
|
|
38109
|
-
if (
|
|
38110
|
-
const a3 =
|
|
38121
|
+
if (t15 <= 0 || e4 <= 0 || i4 <= 0 || n3 <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 };
|
|
38122
|
+
const a3 = t15 / e4;
|
|
38111
38123
|
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 };
|
|
38112
38124
|
})({ originalWidth: this._image.width, originalHeight: this._image.height, maxHiddenDots: a2, maxHiddenAxisDots: e3 - 14, dotSize: n2 });
|
|
38113
38125
|
}
|
|
38114
|
-
this.drawBackground(), this.drawDots(((
|
|
38126
|
+
this.drawBackground(), this.drawDots(((t14, i3) => {
|
|
38115
38127
|
var r4, n3, o2, a2, h2, d2;
|
|
38116
|
-
return !(this._options.imageOptions.hideBackgroundDots &&
|
|
38128
|
+
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]));
|
|
38117
38129
|
})), this.drawCorners(), this._options.image && await this.drawImage({ width: s2.width, height: s2.height, count: e3, dotSize: n2 });
|
|
38118
38130
|
}
|
|
38119
38131
|
drawBackground() {
|
|
38120
|
-
var
|
|
38132
|
+
var t13, e3, i2;
|
|
38121
38133
|
const r3 = this._element, n2 = this._options;
|
|
38122
38134
|
if (r3) {
|
|
38123
|
-
const r4 = null === (
|
|
38135
|
+
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;
|
|
38124
38136
|
let s2 = n2.height, a2 = n2.width;
|
|
38125
38137
|
if (r4 || o2) {
|
|
38126
|
-
const
|
|
38127
|
-
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),
|
|
38138
|
+
const t14 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
38139
|
+
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}` });
|
|
38128
38140
|
}
|
|
38129
38141
|
}
|
|
38130
38142
|
}
|
|
38131
|
-
drawDots(
|
|
38143
|
+
drawDots(t13) {
|
|
38132
38144
|
var e3, i2;
|
|
38133
38145
|
if (!this._qr) throw "QR code is not defined";
|
|
38134
38146
|
const r3 = this._options, n2 = this._qr.getModuleCount();
|
|
38135
38147
|
if (n2 > r3.width || n2 > r3.height) throw "The canvas is too small.";
|
|
38136
38148
|
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 });
|
|
38137
38149
|
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}` });
|
|
38138
|
-
for (let e4 = 0; e4 < n2; e4++) for (let r4 = 0; r4 < n2; r4++)
|
|
38150
|
+
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));
|
|
38139
38151
|
if (r3.shape === g) {
|
|
38140
|
-
const
|
|
38152
|
+
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);
|
|
38141
38153
|
for (let i4 = 0; i4 < e4; i4++) {
|
|
38142
38154
|
s2[i4] = [];
|
|
38143
|
-
for (let r5 = 0; r5 < e4; r5++) i4 >=
|
|
38155
|
+
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;
|
|
38144
38156
|
}
|
|
38145
|
-
for (let
|
|
38157
|
+
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) => {
|
|
38146
38158
|
var r5;
|
|
38147
|
-
return !!(null === (r5 = s2[
|
|
38159
|
+
return !!(null === (r5 = s2[t15 + i4]) || void 0 === r5 ? void 0 : r5[n3 + e5]);
|
|
38148
38160
|
})), c2._element && this._dotsClipPath && this._dotsClipPath.appendChild(c2._element));
|
|
38149
38161
|
}
|
|
38150
38162
|
}
|
|
38151
38163
|
drawCorners() {
|
|
38152
38164
|
if (!this._qr) throw "QR code is not defined";
|
|
38153
|
-
const
|
|
38154
|
-
if (!
|
|
38165
|
+
const t13 = this._element, e3 = this._options;
|
|
38166
|
+
if (!t13) throw "Element code is not defined";
|
|
38155
38167
|
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);
|
|
38156
|
-
[[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([
|
|
38168
|
+
[[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([t14, r4, n3]) => {
|
|
38157
38169
|
var g2, _2, m2, b2, y2, x2, S2, C2, A2, M2, $2, O, D, k;
|
|
38158
|
-
const z = p2 +
|
|
38170
|
+
const z = p2 + t14 * o2 * (i2 - 7), B = v2 + r4 * o2 * (i2 - 7);
|
|
38159
38171
|
let P = this._dotsClipPath, I = this._dotsClipPath;
|
|
38160
|
-
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-${
|
|
38161
|
-
const
|
|
38162
|
-
|
|
38172
|
+
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)) {
|
|
38173
|
+
const t15 = new d({ svg: this._element, type: e3.cornersSquareOptions.type, window: this._window });
|
|
38174
|
+
t15.draw(z, B, a2, n3), t15._element && P && P.appendChild(t15._element);
|
|
38163
38175
|
} else {
|
|
38164
|
-
const
|
|
38165
|
-
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]) && (
|
|
38176
|
+
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 });
|
|
38177
|
+
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) => {
|
|
38166
38178
|
var n4;
|
|
38167
|
-
return !!(null === (n4 = f[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 +
|
|
38168
|
-
})),
|
|
38179
|
+
return !!(null === (n4 = f[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t16]);
|
|
38180
|
+
})), t15._element && P && P.appendChild(t15._element));
|
|
38169
38181
|
}
|
|
38170
|
-
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-${
|
|
38171
|
-
const
|
|
38172
|
-
|
|
38182
|
+
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)) {
|
|
38183
|
+
const t15 = new l({ svg: this._element, type: e3.cornersDotOptions.type, window: this._window });
|
|
38184
|
+
t15.draw(z + 2 * o2, B + 2 * o2, u2, n3), t15._element && I && I.appendChild(t15._element);
|
|
38173
38185
|
} else {
|
|
38174
|
-
const
|
|
38175
|
-
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]) && (
|
|
38186
|
+
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 });
|
|
38187
|
+
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) => {
|
|
38176
38188
|
var n4;
|
|
38177
|
-
return !!(null === (n4 = w[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 +
|
|
38178
|
-
})),
|
|
38189
|
+
return !!(null === (n4 = w[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t16]);
|
|
38190
|
+
})), t15._element && I && I.appendChild(t15._element));
|
|
38179
38191
|
}
|
|
38180
38192
|
}));
|
|
38181
38193
|
}
|
|
38182
38194
|
loadImage() {
|
|
38183
|
-
return new Promise(((
|
|
38195
|
+
return new Promise(((t13, e3) => {
|
|
38184
38196
|
var i2;
|
|
38185
38197
|
const r3 = this._options;
|
|
38186
38198
|
if (!r3.image) return e3("Image is not defined");
|
|
38187
38199
|
if (null === (i2 = r3.nodeCanvas) || void 0 === i2 ? void 0 : i2.loadImage) r3.nodeCanvas.loadImage(r3.image).then(((e4) => {
|
|
38188
38200
|
var i3, n2;
|
|
38189
38201
|
if (this._image = e4, this._options.imageOptions.saveAsBlob) {
|
|
38190
|
-
const
|
|
38191
|
-
null === (n2 = null ==
|
|
38202
|
+
const t14 = null === (i3 = r3.nodeCanvas) || void 0 === i3 ? void 0 : i3.createCanvas(this._image.width, this._image.height);
|
|
38203
|
+
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();
|
|
38192
38204
|
}
|
|
38193
|
-
|
|
38205
|
+
t13();
|
|
38194
38206
|
})).catch(e3);
|
|
38195
38207
|
else {
|
|
38196
38208
|
const e4 = new this._window.Image();
|
|
38197
38209
|
"string" == typeof r3.imageOptions.crossOrigin && (e4.crossOrigin = r3.imageOptions.crossOrigin), this._image = e4, e4.onload = async () => {
|
|
38198
|
-
this._options.imageOptions.saveAsBlob && (this._imageUri = await (async function(
|
|
38210
|
+
this._options.imageOptions.saveAsBlob && (this._imageUri = await (async function(t14, e5) {
|
|
38199
38211
|
return new Promise(((i3) => {
|
|
38200
38212
|
const r4 = new e5.XMLHttpRequest();
|
|
38201
38213
|
r4.onload = function() {
|
|
38202
|
-
const
|
|
38203
|
-
|
|
38204
|
-
i3(
|
|
38205
|
-
},
|
|
38206
|
-
}, r4.open("GET",
|
|
38214
|
+
const t15 = new e5.FileReader();
|
|
38215
|
+
t15.onloadend = function() {
|
|
38216
|
+
i3(t15.result);
|
|
38217
|
+
}, t15.readAsDataURL(r4.response);
|
|
38218
|
+
}, r4.open("GET", t14), r4.responseType = "blob", r4.send();
|
|
38207
38219
|
}));
|
|
38208
|
-
})(r3.image || "", this._window)),
|
|
38220
|
+
})(r3.image || "", this._window)), t13();
|
|
38209
38221
|
}, e4.src = r3.image;
|
|
38210
38222
|
}
|
|
38211
38223
|
}));
|
|
38212
38224
|
}
|
|
38213
|
-
async drawImage({ width:
|
|
38214
|
-
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 -
|
|
38225
|
+
async drawImage({ width: t13, height: e3, count: i2, dotSize: r3 }) {
|
|
38226
|
+
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");
|
|
38215
38227
|
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);
|
|
38216
38228
|
}
|
|
38217
|
-
_createColor({ options:
|
|
38229
|
+
_createColor({ options: t13, color: e3, additionalRotation: i2, x: r3, y: n2, height: o2, width: s2, name: a2 }) {
|
|
38218
38230
|
const h2 = s2 > o2 ? s2 : o2, d2 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
38219
|
-
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}')`),
|
|
38231
|
+
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) {
|
|
38220
38232
|
let e4;
|
|
38221
|
-
if ("radial" ===
|
|
38233
|
+
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));
|
|
38222
38234
|
else {
|
|
38223
|
-
const h3 = ((
|
|
38235
|
+
const h3 = ((t13.rotation || 0) + i2) % (2 * Math.PI), d3 = (h3 + 2 * Math.PI) % (2 * Math.PI);
|
|
38224
38236
|
let u2 = r3 + s2 / 2, c2 = n2 + o2 / 2, l2 = r3 + s2 / 2, g2 = n2 + o2 / 2;
|
|
38225
38237
|
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)));
|
|
38226
38238
|
}
|
|
38227
|
-
|
|
38239
|
+
t13.colorStops.forEach((({ offset: t14, color: i3 }) => {
|
|
38228
38240
|
const r4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "stop");
|
|
38229
|
-
r4.setAttribute("offset", 100 *
|
|
38241
|
+
r4.setAttribute("offset", 100 * t14 + "%"), r4.setAttribute("stop-color", i3), e4.appendChild(r4);
|
|
38230
38242
|
})), d2.setAttribute("fill", `url('#${a2}')`), this._defs.appendChild(e4);
|
|
38231
38243
|
} else e3 && d2.setAttribute("fill", e3);
|
|
38232
38244
|
this._element.appendChild(d2);
|
|
@@ -38234,119 +38246,119 @@ var require_qr_code_styling = __commonJS2({
|
|
|
38234
38246
|
}
|
|
38235
38247
|
p.instanceCount = 0;
|
|
38236
38248
|
const v = p, _ = "canvas", m = {};
|
|
38237
|
-
for (let
|
|
38249
|
+
for (let t13 = 0; t13 <= 40; t13++) m[t13] = t13;
|
|
38238
38250
|
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" } };
|
|
38239
|
-
function y(
|
|
38240
|
-
const e3 = Object.assign({},
|
|
38251
|
+
function y(t13) {
|
|
38252
|
+
const e3 = Object.assign({}, t13);
|
|
38241
38253
|
if (!e3.colorStops || !e3.colorStops.length) throw "Field 'colorStops' is required in gradient";
|
|
38242
|
-
return e3.rotation ? e3.rotation = Number(e3.rotation) : e3.rotation = 0, e3.colorStops = e3.colorStops.map(((
|
|
38254
|
+
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;
|
|
38243
38255
|
}
|
|
38244
|
-
function x(
|
|
38245
|
-
const e3 = Object.assign({},
|
|
38256
|
+
function x(t13) {
|
|
38257
|
+
const e3 = Object.assign({}, t13);
|
|
38246
38258
|
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;
|
|
38247
38259
|
}
|
|
38248
38260
|
var S = i(873), C = i.n(S);
|
|
38249
|
-
function A(
|
|
38250
|
-
if (!
|
|
38251
|
-
"." ===
|
|
38252
|
-
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" }[
|
|
38253
|
-
if (!e3) throw new Error(`Extension "${
|
|
38261
|
+
function A(t13) {
|
|
38262
|
+
if (!t13) throw new Error("Extension must be defined");
|
|
38263
|
+
"." === t13[0] && (t13 = t13.substring(1));
|
|
38264
|
+
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()];
|
|
38265
|
+
if (!e3) throw new Error(`Extension "${t13}" is not supported`);
|
|
38254
38266
|
return e3;
|
|
38255
38267
|
}
|
|
38256
38268
|
class M {
|
|
38257
|
-
constructor(
|
|
38258
|
-
(null ==
|
|
38269
|
+
constructor(t13) {
|
|
38270
|
+
(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();
|
|
38259
38271
|
}
|
|
38260
|
-
static _clearContainer(
|
|
38261
|
-
|
|
38272
|
+
static _clearContainer(t13) {
|
|
38273
|
+
t13 && (t13.innerHTML = "");
|
|
38262
38274
|
}
|
|
38263
38275
|
_setupSvg() {
|
|
38264
38276
|
if (!this._qr) return;
|
|
38265
|
-
const
|
|
38266
|
-
this._svg =
|
|
38277
|
+
const t13 = new v(this._options, this._window);
|
|
38278
|
+
this._svg = t13.getElement(), this._svgDrawingPromise = t13.drawQR(this._qr).then((() => {
|
|
38267
38279
|
var e3;
|
|
38268
|
-
this._svg && (null === (e3 = this._extension) || void 0 === e3 || e3.call(this,
|
|
38280
|
+
this._svg && (null === (e3 = this._extension) || void 0 === e3 || e3.call(this, t13.getElement(), this._options));
|
|
38269
38281
|
}));
|
|
38270
38282
|
}
|
|
38271
38283
|
_setupCanvas() {
|
|
38272
|
-
var
|
|
38273
|
-
this._qr && ((null === (
|
|
38274
|
-
var
|
|
38284
|
+
var t13, e3;
|
|
38285
|
+
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((() => {
|
|
38286
|
+
var t14;
|
|
38275
38287
|
if (!this._svg) return;
|
|
38276
38288
|
const e4 = this._svg, i2 = new this._window.XMLSerializer().serializeToString(e4), r3 = btoa(i2), n2 = `data:${A("svg")};base64,${r3}`;
|
|
38277
|
-
if (null === (
|
|
38289
|
+
if (null === (t14 = this._options.nodeCanvas) || void 0 === t14 ? void 0 : t14.loadImage) return this._options.nodeCanvas.loadImage(n2).then(((t15) => {
|
|
38278
38290
|
var e5, i3;
|
|
38279
|
-
|
|
38291
|
+
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);
|
|
38280
38292
|
}));
|
|
38281
38293
|
{
|
|
38282
|
-
const
|
|
38294
|
+
const t15 = new this._window.Image();
|
|
38283
38295
|
return new Promise(((e5) => {
|
|
38284
|
-
|
|
38296
|
+
t15.onload = () => {
|
|
38285
38297
|
var i3, r4;
|
|
38286
|
-
null === (r4 = null === (i3 = this._domCanvas) || void 0 === i3 ? void 0 : i3.getContext("2d")) || void 0 === r4 || r4.drawImage(
|
|
38287
|
-
},
|
|
38298
|
+
null === (r4 = null === (i3 = this._domCanvas) || void 0 === i3 ? void 0 : i3.getContext("2d")) || void 0 === r4 || r4.drawImage(t15, 0, 0), e5();
|
|
38299
|
+
}, t15.src = n2;
|
|
38288
38300
|
}));
|
|
38289
38301
|
}
|
|
38290
38302
|
})));
|
|
38291
38303
|
}
|
|
38292
|
-
async _getElement(
|
|
38304
|
+
async _getElement(t13 = "png") {
|
|
38293
38305
|
if (!this._qr) throw "QR code is empty";
|
|
38294
|
-
return "svg" ===
|
|
38306
|
+
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);
|
|
38295
38307
|
}
|
|
38296
|
-
update(
|
|
38297
|
-
M._clearContainer(this._container), this._options =
|
|
38308
|
+
update(t13) {
|
|
38309
|
+
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) {
|
|
38298
38310
|
switch (true) {
|
|
38299
|
-
case /^[0-9]*$/.test(
|
|
38311
|
+
case /^[0-9]*$/.test(t14):
|
|
38300
38312
|
return "Numeric";
|
|
38301
|
-
case /^[0-9A-Z $%*+\-./:]*$/.test(
|
|
38313
|
+
case /^[0-9A-Z $%*+\-./:]*$/.test(t14):
|
|
38302
38314
|
return "Alphanumeric";
|
|
38303
38315
|
default:
|
|
38304
38316
|
return "Byte";
|
|
38305
38317
|
}
|
|
38306
38318
|
})(this._options.data)), this._qr.make(), this._options.type === _ ? this._setupCanvas() : this._setupSvg(), this.append(this._container));
|
|
38307
38319
|
}
|
|
38308
|
-
append(
|
|
38309
|
-
if (
|
|
38310
|
-
if ("function" != typeof
|
|
38311
|
-
this._options.type === _ ? this._domCanvas &&
|
|
38320
|
+
append(t13) {
|
|
38321
|
+
if (t13) {
|
|
38322
|
+
if ("function" != typeof t13.appendChild) throw "Container should be a single DOM node";
|
|
38323
|
+
this._options.type === _ ? this._domCanvas && t13.appendChild(this._domCanvas) : this._svg && t13.appendChild(this._svg), this._container = t13;
|
|
38312
38324
|
}
|
|
38313
38325
|
}
|
|
38314
|
-
applyExtension(
|
|
38315
|
-
if (!
|
|
38316
|
-
this._extension =
|
|
38326
|
+
applyExtension(t13) {
|
|
38327
|
+
if (!t13) throw "Extension function should be defined.";
|
|
38328
|
+
this._extension = t13, this.update();
|
|
38317
38329
|
}
|
|
38318
38330
|
deleteExtension() {
|
|
38319
38331
|
this._extension = void 0, this.update();
|
|
38320
38332
|
}
|
|
38321
|
-
async getRawData(
|
|
38333
|
+
async getRawData(t13 = "png") {
|
|
38322
38334
|
if (!this._qr) throw "QR code is empty";
|
|
38323
|
-
const e3 = await this._getElement(
|
|
38335
|
+
const e3 = await this._getElement(t13), i2 = A(t13);
|
|
38324
38336
|
if (!e3) return null;
|
|
38325
|
-
if ("svg" ===
|
|
38326
|
-
const
|
|
38337
|
+
if ("svg" === t13.toLowerCase()) {
|
|
38338
|
+
const t14 = `<?xml version="1.0" standalone="no"?>\r
|
|
38327
38339
|
${new this._window.XMLSerializer().serializeToString(e3)}`;
|
|
38328
|
-
return "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(
|
|
38340
|
+
return "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(t14) : new Blob([t14], { type: i2 });
|
|
38329
38341
|
}
|
|
38330
|
-
return new Promise(((
|
|
38342
|
+
return new Promise(((t14) => {
|
|
38331
38343
|
const r3 = e3;
|
|
38332
|
-
if ("toBuffer" in r3) if ("image/png" === i2)
|
|
38333
|
-
else if ("image/jpeg" === i2)
|
|
38344
|
+
if ("toBuffer" in r3) if ("image/png" === i2) t14(r3.toBuffer(i2));
|
|
38345
|
+
else if ("image/jpeg" === i2) t14(r3.toBuffer(i2));
|
|
38334
38346
|
else {
|
|
38335
38347
|
if ("application/pdf" !== i2) throw Error("Unsupported extension");
|
|
38336
|
-
|
|
38348
|
+
t14(r3.toBuffer(i2));
|
|
38337
38349
|
}
|
|
38338
|
-
else "toBlob" in r3 && r3.toBlob(
|
|
38350
|
+
else "toBlob" in r3 && r3.toBlob(t14, i2, 1);
|
|
38339
38351
|
}));
|
|
38340
38352
|
}
|
|
38341
|
-
async download(
|
|
38353
|
+
async download(t13) {
|
|
38342
38354
|
if (!this._qr) throw "QR code is empty";
|
|
38343
38355
|
if ("undefined" == typeof Blob) throw "Cannot download in Node.js, call getRawData instead.";
|
|
38344
38356
|
let e3 = "png", i2 = "qr";
|
|
38345
|
-
"string" == typeof
|
|
38357
|
+
"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));
|
|
38346
38358
|
const r3 = await this._getElement(e3);
|
|
38347
38359
|
if (r3) if ("svg" === e3.toLowerCase()) {
|
|
38348
|
-
let
|
|
38349
|
-
|
|
38360
|
+
let t14 = new XMLSerializer().serializeToString(r3);
|
|
38361
|
+
t14 = '<?xml version="1.0" standalone="no"?>\r\n' + t14, n(`data:${A(e3)};charset=utf-8,${encodeURIComponent(t14)}`, `${i2}.svg`);
|
|
38350
38362
|
} else n(r3.toDataURL(A(e3)), `${i2}.${e3}`);
|
|
38351
38363
|
}
|
|
38352
38364
|
}
|
|
@@ -38476,6 +38488,12 @@ var ArrowLeft = createLucideIcon("ArrowLeft", [
|
|
|
38476
38488
|
["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
|
|
38477
38489
|
["path", { d: "M19 12H5", key: "x3x0zl" }]
|
|
38478
38490
|
]);
|
|
38491
|
+
var ArrowUpDown = createLucideIcon("ArrowUpDown", [
|
|
38492
|
+
["path", { d: "m21 16-4 4-4-4", key: "f6ql7i" }],
|
|
38493
|
+
["path", { d: "M17 20V4", key: "1ejh1v" }],
|
|
38494
|
+
["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
|
|
38495
|
+
["path", { d: "M7 4v16", key: "1glfcx" }]
|
|
38496
|
+
]);
|
|
38479
38497
|
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
38480
38498
|
var ChevronDown = createLucideIcon("ChevronDown", [
|
|
38481
38499
|
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
@@ -38488,6 +38506,20 @@ var CircleCheck = createLucideIcon("CircleCheck", [
|
|
|
38488
38506
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
38489
38507
|
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
38490
38508
|
]);
|
|
38509
|
+
var ClipboardPaste = createLucideIcon("ClipboardPaste", [
|
|
38510
|
+
[
|
|
38511
|
+
"path",
|
|
38512
|
+
{ 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" }
|
|
38513
|
+
],
|
|
38514
|
+
[
|
|
38515
|
+
"path",
|
|
38516
|
+
{
|
|
38517
|
+
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",
|
|
38518
|
+
key: "2ik1ml"
|
|
38519
|
+
}
|
|
38520
|
+
],
|
|
38521
|
+
["path", { d: "m17 10 4 4-4 4", key: "vp2hj1" }]
|
|
38522
|
+
]);
|
|
38491
38523
|
var Clock = createLucideIcon("Clock", [
|
|
38492
38524
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
38493
38525
|
["polyline", { points: "12 6 12 12 16 14", key: "68esgv" }]
|
|
@@ -39479,25 +39511,25 @@ function createFocusGuard() {
|
|
|
39479
39511
|
return element;
|
|
39480
39512
|
}
|
|
39481
39513
|
var __assign = function() {
|
|
39482
|
-
__assign = Object.assign || function __assign2(
|
|
39514
|
+
__assign = Object.assign || function __assign2(t11) {
|
|
39483
39515
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
39484
39516
|
s = arguments[i];
|
|
39485
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
39517
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t11[p] = s[p];
|
|
39486
39518
|
}
|
|
39487
|
-
return
|
|
39519
|
+
return t11;
|
|
39488
39520
|
};
|
|
39489
39521
|
return __assign.apply(this, arguments);
|
|
39490
39522
|
};
|
|
39491
39523
|
function __rest(s, e) {
|
|
39492
|
-
var
|
|
39524
|
+
var t11 = {};
|
|
39493
39525
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39494
|
-
|
|
39526
|
+
t11[p] = s[p];
|
|
39495
39527
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
39496
39528
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
39497
39529
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39498
|
-
|
|
39530
|
+
t11[p[i]] = s[p[i]];
|
|
39499
39531
|
}
|
|
39500
|
-
return
|
|
39532
|
+
return t11;
|
|
39501
39533
|
}
|
|
39502
39534
|
function __spreadArray(to, from, pack) {
|
|
39503
39535
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
@@ -40561,16 +40593,16 @@ var Title = DialogTitle;
|
|
|
40561
40593
|
var Description = DialogDescription;
|
|
40562
40594
|
var Close = DialogClose;
|
|
40563
40595
|
function r(e) {
|
|
40564
|
-
var
|
|
40596
|
+
var t11, f, n = "";
|
|
40565
40597
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
40566
40598
|
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
40567
40599
|
var o = e.length;
|
|
40568
|
-
for (
|
|
40600
|
+
for (t11 = 0; t11 < o; t11++) e[t11] && (f = r(e[t11])) && (n && (n += " "), n += f);
|
|
40569
40601
|
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
40570
40602
|
return n;
|
|
40571
40603
|
}
|
|
40572
40604
|
function clsx() {
|
|
40573
|
-
for (var e,
|
|
40605
|
+
for (var e, t11, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t11 = r(e)) && (n && (n += " "), n += t11);
|
|
40574
40606
|
return n;
|
|
40575
40607
|
}
|
|
40576
40608
|
var CLASS_PART_SEPARATOR = "-";
|
|
@@ -43080,6 +43112,11 @@ function getIconUrlWithCdn(iconPath, assetCdnUrl) {
|
|
|
43080
43112
|
const baseUrl = assetCdnUrl.endsWith("/") ? assetCdnUrl.slice(0, -1) : assetCdnUrl;
|
|
43081
43113
|
return `${baseUrl}/api/public${normalizedPath}`;
|
|
43082
43114
|
}
|
|
43115
|
+
var ActionType = /* @__PURE__ */ ((ActionType2) => {
|
|
43116
|
+
ActionType2["Deposit"] = "deposit";
|
|
43117
|
+
ActionType2["Withdraw"] = "withdraw";
|
|
43118
|
+
return ActionType2;
|
|
43119
|
+
})(ActionType || {});
|
|
43083
43120
|
async function createDepositAddress(overrides, publishableKey) {
|
|
43084
43121
|
if (!overrides?.external_user_id) {
|
|
43085
43122
|
throw new Error("external_user_id is required");
|
|
@@ -43090,6 +43127,7 @@ async function createDepositAddress(overrides, publishableKey) {
|
|
|
43090
43127
|
destination_chain_id: overrides?.destination_chain_id || DEFAULT_CONFIG.destinationChainId || "8453",
|
|
43091
43128
|
destination_token_address: overrides?.destination_token_address || DEFAULT_CONFIG.destinationTokenAddress || "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
43092
43129
|
recipient_address: overrides?.recipient_address || DEFAULT_CONFIG.recipientAddress || "0x309a4154a2CD4153Da886E780890C9cb5161553C",
|
|
43130
|
+
...overrides?.action_type ? { action_type: overrides.action_type } : {},
|
|
43093
43131
|
client_metadata: overrides?.client_metadata || {}
|
|
43094
43132
|
};
|
|
43095
43133
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
@@ -43120,9 +43158,13 @@ var ExecutionStatus = /* @__PURE__ */ ((ExecutionStatus2) => {
|
|
|
43120
43158
|
ExecutionStatus2["WAITING"] = "waiting";
|
|
43121
43159
|
return ExecutionStatus2;
|
|
43122
43160
|
})(ExecutionStatus || {});
|
|
43123
|
-
async function queryExecutions(externalUserId, publishableKey) {
|
|
43161
|
+
async function queryExecutions(externalUserId, publishableKey, actionType) {
|
|
43124
43162
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
43125
43163
|
validatePublishableKey(pk);
|
|
43164
|
+
const body = {
|
|
43165
|
+
external_user_id: externalUserId,
|
|
43166
|
+
...actionType ? { action_type: actionType } : {}
|
|
43167
|
+
};
|
|
43126
43168
|
const response = await fetch(
|
|
43127
43169
|
`${API_BASE_URL}/v1/public/direct_executions/query`,
|
|
43128
43170
|
{
|
|
@@ -43132,9 +43174,7 @@ async function queryExecutions(externalUserId, publishableKey) {
|
|
|
43132
43174
|
"x-publishable-key": pk,
|
|
43133
43175
|
"Content-Type": "application/json"
|
|
43134
43176
|
},
|
|
43135
|
-
body: JSON.stringify(
|
|
43136
|
-
external_user_id: externalUserId
|
|
43137
|
-
})
|
|
43177
|
+
body: JSON.stringify(body)
|
|
43138
43178
|
}
|
|
43139
43179
|
);
|
|
43140
43180
|
if (!response.ok) {
|
|
@@ -43162,6 +43202,26 @@ async function pollDirectExecutions(request, publishableKey) {
|
|
|
43162
43202
|
}
|
|
43163
43203
|
return response.json();
|
|
43164
43204
|
}
|
|
43205
|
+
async function getSupportedDestinationTokens(publishableKey) {
|
|
43206
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
43207
|
+
validatePublishableKey(pk);
|
|
43208
|
+
const response = await fetch(
|
|
43209
|
+
`${API_BASE_URL}/v1/public/tokens/supported_destination_tokens`,
|
|
43210
|
+
{
|
|
43211
|
+
method: "GET",
|
|
43212
|
+
headers: {
|
|
43213
|
+
accept: "application/json",
|
|
43214
|
+
"x-publishable-key": pk
|
|
43215
|
+
}
|
|
43216
|
+
}
|
|
43217
|
+
);
|
|
43218
|
+
if (!response.ok) {
|
|
43219
|
+
throw new Error(
|
|
43220
|
+
`Failed to fetch supported destination tokens: ${response.statusText}`
|
|
43221
|
+
);
|
|
43222
|
+
}
|
|
43223
|
+
return response.json();
|
|
43224
|
+
}
|
|
43165
43225
|
async function getSupportedDepositTokens(publishableKey, options2) {
|
|
43166
43226
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
43167
43227
|
validatePublishableKey(pk);
|
|
@@ -45245,7 +45305,7 @@ var computePosition2 = (reference, floating, options2) => {
|
|
|
45245
45305
|
var isClient = typeof document !== "undefined";
|
|
45246
45306
|
var noop2 = function noop22() {
|
|
45247
45307
|
};
|
|
45248
|
-
var index = isClient ?
|
|
45308
|
+
var index = isClient ? import_react22.useLayoutEffect : noop2;
|
|
45249
45309
|
function deepEqual(a, b) {
|
|
45250
45310
|
if (a === b) {
|
|
45251
45311
|
return true;
|
|
@@ -46354,14 +46414,14 @@ function createCollection(name) {
|
|
|
46354
46414
|
);
|
|
46355
46415
|
const CollectionProvider = (props) => {
|
|
46356
46416
|
const { scope, children } = props;
|
|
46357
|
-
const ref =
|
|
46358
|
-
const itemMap =
|
|
46417
|
+
const ref = import_react24.default.useRef(null);
|
|
46418
|
+
const itemMap = import_react24.default.useRef(/* @__PURE__ */ new Map()).current;
|
|
46359
46419
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
46360
46420
|
};
|
|
46361
46421
|
CollectionProvider.displayName = PROVIDER_NAME2;
|
|
46362
46422
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
46363
46423
|
const CollectionSlotImpl = /* @__PURE__ */ createSlot(COLLECTION_SLOT_NAME);
|
|
46364
|
-
const CollectionSlot =
|
|
46424
|
+
const CollectionSlot = import_react24.default.forwardRef(
|
|
46365
46425
|
(props, forwardedRef) => {
|
|
46366
46426
|
const { scope, children } = props;
|
|
46367
46427
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
@@ -46373,13 +46433,13 @@ function createCollection(name) {
|
|
|
46373
46433
|
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
46374
46434
|
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
46375
46435
|
const CollectionItemSlotImpl = /* @__PURE__ */ createSlot(ITEM_SLOT_NAME);
|
|
46376
|
-
const CollectionItemSlot =
|
|
46436
|
+
const CollectionItemSlot = import_react24.default.forwardRef(
|
|
46377
46437
|
(props, forwardedRef) => {
|
|
46378
46438
|
const { scope, children, ...itemData } = props;
|
|
46379
|
-
const ref =
|
|
46439
|
+
const ref = import_react24.default.useRef(null);
|
|
46380
46440
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
46381
46441
|
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
46382
|
-
|
|
46442
|
+
import_react24.default.useEffect(() => {
|
|
46383
46443
|
context.itemMap.set(ref, { ref, ...itemData });
|
|
46384
46444
|
return () => void context.itemMap.delete(ref);
|
|
46385
46445
|
});
|
|
@@ -46389,7 +46449,7 @@ function createCollection(name) {
|
|
|
46389
46449
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
46390
46450
|
function useCollection2(scope) {
|
|
46391
46451
|
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
46392
|
-
const getItems =
|
|
46452
|
+
const getItems = import_react24.default.useCallback(() => {
|
|
46393
46453
|
const collectionNode = context.collectionRef.current;
|
|
46394
46454
|
if (!collectionNode) return [];
|
|
46395
46455
|
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
@@ -48117,6 +48177,7 @@ function useDepositAddress(params) {
|
|
|
48117
48177
|
destinationChainType,
|
|
48118
48178
|
destinationChainId,
|
|
48119
48179
|
destinationTokenAddress,
|
|
48180
|
+
actionType,
|
|
48120
48181
|
enabled = true
|
|
48121
48182
|
} = params;
|
|
48122
48183
|
return useQuery({
|
|
@@ -48128,6 +48189,7 @@ function useDepositAddress(params) {
|
|
|
48128
48189
|
destinationChainType ?? null,
|
|
48129
48190
|
destinationChainId ?? null,
|
|
48130
48191
|
destinationTokenAddress ?? null,
|
|
48192
|
+
actionType ?? null,
|
|
48131
48193
|
publishableKey
|
|
48132
48194
|
],
|
|
48133
48195
|
queryFn: () => createDepositAddress(
|
|
@@ -48136,7 +48198,8 @@ function useDepositAddress(params) {
|
|
|
48136
48198
|
recipient_address: recipientAddress,
|
|
48137
48199
|
destination_chain_type: destinationChainType,
|
|
48138
48200
|
destination_chain_id: destinationChainId,
|
|
48139
|
-
destination_token_address: destinationTokenAddress
|
|
48201
|
+
destination_token_address: destinationTokenAddress,
|
|
48202
|
+
action_type: actionType
|
|
48140
48203
|
},
|
|
48141
48204
|
publishableKey
|
|
48142
48205
|
),
|
|
@@ -48818,6 +48881,30 @@ var en_default2 = {
|
|
|
48818
48881
|
youReceive: "You receive",
|
|
48819
48882
|
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."
|
|
48820
48883
|
}
|
|
48884
|
+
},
|
|
48885
|
+
withdrawModal: {
|
|
48886
|
+
title: "Withdraw",
|
|
48887
|
+
withdrawCrypto: {
|
|
48888
|
+
title: "Withdraw with Crypto",
|
|
48889
|
+
subtitle: "Send to any wallet address"
|
|
48890
|
+
},
|
|
48891
|
+
selectToken: "Select withdrawal token",
|
|
48892
|
+
receiveToken: "Receive token",
|
|
48893
|
+
receiveChain: "Receive chain",
|
|
48894
|
+
recipientAddress: "Recipient address",
|
|
48895
|
+
recipientAddressPlaceholder: "Enter wallet address",
|
|
48896
|
+
amount: "Amount",
|
|
48897
|
+
amountPlaceholder: "0.00",
|
|
48898
|
+
balance: "Balance",
|
|
48899
|
+
minimum: "min",
|
|
48900
|
+
withdraw: "Withdraw",
|
|
48901
|
+
invalidAddress: "Please enter a valid address",
|
|
48902
|
+
invalidAmount: "Please enter a valid amount",
|
|
48903
|
+
verifyingAddress: "Verifying address...",
|
|
48904
|
+
loading: "Loading...",
|
|
48905
|
+
noTokensAvailable: "No tokens available",
|
|
48906
|
+
review: "Review Withdrawal",
|
|
48907
|
+
back: "Back"
|
|
48821
48908
|
}
|
|
48822
48909
|
};
|
|
48823
48910
|
var i18n2 = en_default2;
|
|
@@ -48896,7 +48983,7 @@ function useDepositPolling({
|
|
|
48896
48983
|
const modalOpenedAt = modalOpenedAtRef.current;
|
|
48897
48984
|
const poll = async () => {
|
|
48898
48985
|
try {
|
|
48899
|
-
const response = await queryExecutions(userId, publishableKey);
|
|
48986
|
+
const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
|
|
48900
48987
|
const cutoff = new Date(modalOpenedAt.getTime() - CUTOFF_BUFFER_MS);
|
|
48901
48988
|
const sortedExecutions = [...response.data].sort((a, b) => {
|
|
48902
48989
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
@@ -49018,7 +49105,8 @@ function formatCurrency(currency) {
|
|
|
49018
49105
|
}
|
|
49019
49106
|
function DepositDetailContent({
|
|
49020
49107
|
execution,
|
|
49021
|
-
className
|
|
49108
|
+
className,
|
|
49109
|
+
variant = "deposit"
|
|
49022
49110
|
}) {
|
|
49023
49111
|
const { colors: colors2, fonts, components } = useTheme();
|
|
49024
49112
|
const [chains, setChains] = (0, import_react13.useState)([]);
|
|
@@ -49424,7 +49512,7 @@ function DepositDetailContent({
|
|
|
49424
49512
|
color: components.card.rowLeftLabel,
|
|
49425
49513
|
fontFamily: fonts.regular
|
|
49426
49514
|
},
|
|
49427
|
-
children: "Deposit Tx"
|
|
49515
|
+
children: variant === "withdraw" ? "Withdrawal Tx" : "Deposit Tx"
|
|
49428
49516
|
}
|
|
49429
49517
|
),
|
|
49430
49518
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
@@ -54550,7 +54638,7 @@ function DepositsModal({
|
|
|
54550
54638
|
if (!open || !userId) return;
|
|
54551
54639
|
const fetchExecutions = async () => {
|
|
54552
54640
|
try {
|
|
54553
|
-
const response = await queryExecutions(userId, publishableKey);
|
|
54641
|
+
const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
|
|
54554
54642
|
const sorted = [...response.data].sort((a, b) => {
|
|
54555
54643
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
54556
54644
|
const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
@@ -54667,7 +54755,7 @@ function saveRecentToken(token) {
|
|
|
54667
54755
|
try {
|
|
54668
54756
|
const recent = getRecentTokens();
|
|
54669
54757
|
const filtered = recent.filter(
|
|
54670
|
-
(
|
|
54758
|
+
(t11) => !(t11.symbol === token.symbol && t11.chainType === token.chainType && t11.chainId === token.chainId)
|
|
54671
54759
|
);
|
|
54672
54760
|
filtered.unshift(token);
|
|
54673
54761
|
const trimmed = filtered.slice(0, MAX_RECENT_TOKENS);
|
|
@@ -54680,7 +54768,7 @@ function removeRecentToken(token) {
|
|
|
54680
54768
|
try {
|
|
54681
54769
|
const recent = getRecentTokens();
|
|
54682
54770
|
const filtered = recent.filter(
|
|
54683
|
-
(
|
|
54771
|
+
(t11) => !(t11.symbol === token.symbol && t11.chainType === token.chainType && t11.chainId === token.chainId)
|
|
54684
54772
|
);
|
|
54685
54773
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(filtered));
|
|
54686
54774
|
return filtered;
|
|
@@ -54719,7 +54807,7 @@ function TokenSelectorSheet({
|
|
|
54719
54807
|
const addOption = (symbol, chainType, chainId, isRecent) => {
|
|
54720
54808
|
const key = `${symbol}-${chainType}:${chainId}`;
|
|
54721
54809
|
if (seen.has(key)) return;
|
|
54722
|
-
const tokenData = tokens.find((
|
|
54810
|
+
const tokenData = tokens.find((t11) => t11.symbol === symbol);
|
|
54723
54811
|
if (!tokenData) return;
|
|
54724
54812
|
const chainData = tokenData.chains.find(
|
|
54725
54813
|
(c) => c.chain_type === chainType && c.chain_id === chainId
|
|
@@ -55175,6 +55263,104 @@ function DepositPollingUi({
|
|
|
55175
55263
|
}
|
|
55176
55264
|
return null;
|
|
55177
55265
|
}
|
|
55266
|
+
var getChainKey = (chainId, chainType) => {
|
|
55267
|
+
return `${chainType}:${chainId}`;
|
|
55268
|
+
};
|
|
55269
|
+
function resolveSourceToken(supportedTokens, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol) {
|
|
55270
|
+
if (!supportedTokens.length) return null;
|
|
55271
|
+
let selectedTokenData;
|
|
55272
|
+
let selectedChainData;
|
|
55273
|
+
const hasChainDefaults = defaultSourceChainType && defaultSourceChainId;
|
|
55274
|
+
if (defaultSourceTokenAddress && hasChainDefaults) {
|
|
55275
|
+
for (const t11 of supportedTokens) {
|
|
55276
|
+
const matchingChain = t11.chains.find(
|
|
55277
|
+
(c) => c.token_address.toLowerCase() === defaultSourceTokenAddress.toLowerCase() && c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
|
|
55278
|
+
);
|
|
55279
|
+
if (matchingChain) {
|
|
55280
|
+
selectedTokenData = t11;
|
|
55281
|
+
selectedChainData = matchingChain;
|
|
55282
|
+
break;
|
|
55283
|
+
}
|
|
55284
|
+
}
|
|
55285
|
+
}
|
|
55286
|
+
if (!selectedTokenData && defaultSourceSymbol && hasChainDefaults) {
|
|
55287
|
+
for (const t11 of supportedTokens) {
|
|
55288
|
+
if (t11.symbol !== defaultSourceSymbol) continue;
|
|
55289
|
+
const matchedChain = t11.chains.find(
|
|
55290
|
+
(c) => c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
|
|
55291
|
+
);
|
|
55292
|
+
if (matchedChain) {
|
|
55293
|
+
selectedTokenData = t11;
|
|
55294
|
+
selectedChainData = matchedChain;
|
|
55295
|
+
break;
|
|
55296
|
+
}
|
|
55297
|
+
}
|
|
55298
|
+
}
|
|
55299
|
+
if (!selectedTokenData) {
|
|
55300
|
+
for (const t11 of supportedTokens) {
|
|
55301
|
+
if (t11.chains.length > 0) {
|
|
55302
|
+
selectedTokenData = t11;
|
|
55303
|
+
selectedChainData = t11.chains[0];
|
|
55304
|
+
break;
|
|
55305
|
+
}
|
|
55306
|
+
}
|
|
55307
|
+
}
|
|
55308
|
+
if (selectedTokenData && selectedChainData) {
|
|
55309
|
+
return { token: selectedTokenData, chain: selectedChainData };
|
|
55310
|
+
}
|
|
55311
|
+
return null;
|
|
55312
|
+
}
|
|
55313
|
+
function useDefaultSourceToken({
|
|
55314
|
+
supportedTokens,
|
|
55315
|
+
defaultSourceChainType,
|
|
55316
|
+
defaultSourceChainId,
|
|
55317
|
+
defaultSourceTokenAddress,
|
|
55318
|
+
defaultSourceSymbol
|
|
55319
|
+
}) {
|
|
55320
|
+
const [token, setToken] = (0, import_react20.useState)(null);
|
|
55321
|
+
const [chain, setChain] = (0, import_react20.useState)(null);
|
|
55322
|
+
const [initialSelectionDone, setInitialSelectionDone] = (0, import_react20.useState)(false);
|
|
55323
|
+
const appliedDefaultsRef = (0, import_react20.useRef)("");
|
|
55324
|
+
(0, import_react20.useEffect)(() => {
|
|
55325
|
+
if (!supportedTokens.length) return;
|
|
55326
|
+
const defaultsKey = `${defaultSourceTokenAddress ?? ""}|${defaultSourceSymbol ?? ""}|${defaultSourceChainType ?? ""}|${defaultSourceChainId ?? ""}`;
|
|
55327
|
+
const defaultsChanged = appliedDefaultsRef.current !== defaultsKey;
|
|
55328
|
+
if (initialSelectionDone && !defaultsChanged) return;
|
|
55329
|
+
const result = resolveSourceToken(
|
|
55330
|
+
supportedTokens,
|
|
55331
|
+
defaultSourceChainType,
|
|
55332
|
+
defaultSourceChainId,
|
|
55333
|
+
defaultSourceTokenAddress,
|
|
55334
|
+
defaultSourceSymbol
|
|
55335
|
+
);
|
|
55336
|
+
if (result) {
|
|
55337
|
+
setToken(result.token.symbol);
|
|
55338
|
+
setChain(getChainKey(result.chain.chain_id, result.chain.chain_type));
|
|
55339
|
+
appliedDefaultsRef.current = defaultsKey;
|
|
55340
|
+
setInitialSelectionDone(true);
|
|
55341
|
+
}
|
|
55342
|
+
}, [
|
|
55343
|
+
supportedTokens,
|
|
55344
|
+
defaultSourceTokenAddress,
|
|
55345
|
+
defaultSourceSymbol,
|
|
55346
|
+
defaultSourceChainType,
|
|
55347
|
+
defaultSourceChainId,
|
|
55348
|
+
initialSelectionDone
|
|
55349
|
+
]);
|
|
55350
|
+
(0, import_react20.useEffect)(() => {
|
|
55351
|
+
if (!supportedTokens.length || !token) return;
|
|
55352
|
+
const currentToken = supportedTokens.find((t11) => t11.symbol === token);
|
|
55353
|
+
if (!currentToken || currentToken.chains.length === 0) return;
|
|
55354
|
+
const isChainAvailable = chain && currentToken.chains.some((c) => {
|
|
55355
|
+
return getChainKey(c.chain_id, c.chain_type) === chain;
|
|
55356
|
+
});
|
|
55357
|
+
if (!isChainAvailable) {
|
|
55358
|
+
const firstChain = currentToken.chains[0];
|
|
55359
|
+
setChain(getChainKey(firstChain.chain_id, firstChain.chain_type));
|
|
55360
|
+
}
|
|
55361
|
+
}, [token, supportedTokens, chain]);
|
|
55362
|
+
return { token, chain, setToken, setChain, initialSelectionDone };
|
|
55363
|
+
}
|
|
55178
55364
|
function DepositFooterLinks({
|
|
55179
55365
|
onGlossaryClick
|
|
55180
55366
|
}) {
|
|
@@ -55334,7 +55520,7 @@ function GlossaryModal({
|
|
|
55334
55520
|
) });
|
|
55335
55521
|
}
|
|
55336
55522
|
function useCopyAddress() {
|
|
55337
|
-
const [copied, setCopied] = (0,
|
|
55523
|
+
const [copied, setCopied] = (0, import_react21.useState)(false);
|
|
55338
55524
|
const handleCopy = (address) => {
|
|
55339
55525
|
if (!address) return;
|
|
55340
55526
|
navigator.clipboard.writeText(address);
|
|
@@ -55380,7 +55566,7 @@ var TooltipContent2 = React242.forwardRef(({ className, sideOffset = 4, ...props
|
|
|
55380
55566
|
});
|
|
55381
55567
|
TooltipContent2.displayName = Content22.displayName;
|
|
55382
55568
|
var t4 = i18n2.transferCrypto;
|
|
55383
|
-
var
|
|
55569
|
+
var getChainKey2 = (chainId, chainType) => {
|
|
55384
55570
|
return `${chainType}:${chainId}`;
|
|
55385
55571
|
};
|
|
55386
55572
|
var parseChainKey = (chainKey) => {
|
|
@@ -55394,6 +55580,10 @@ function TransferCryptoSingleInput({
|
|
|
55394
55580
|
destinationChainType,
|
|
55395
55581
|
destinationChainId,
|
|
55396
55582
|
destinationTokenAddress,
|
|
55583
|
+
defaultSourceChainType,
|
|
55584
|
+
defaultSourceChainId,
|
|
55585
|
+
defaultSourceTokenAddress,
|
|
55586
|
+
defaultSourceSymbol,
|
|
55397
55587
|
depositConfirmationMode = "auto_ui",
|
|
55398
55588
|
onExecutionsChange,
|
|
55399
55589
|
onDepositSuccess,
|
|
@@ -55402,21 +55592,25 @@ function TransferCryptoSingleInput({
|
|
|
55402
55592
|
}) {
|
|
55403
55593
|
const { themeClass, colors: colors2, fonts, components } = useTheme();
|
|
55404
55594
|
const isDarkMode = themeClass.includes("uf-dark");
|
|
55405
|
-
const [token, setToken] = (0, import_react16.useState)("USDC");
|
|
55406
|
-
const [chain, setChain] = (0, import_react16.useState)("solana:mainnet");
|
|
55407
55595
|
const [copied, setCopied] = (0, import_react16.useState)(false);
|
|
55408
55596
|
const { copied: copiedRecipient, handleCopy: handleCopyRecipientAddress } = useCopyAddress();
|
|
55409
55597
|
const [glossaryOpen, setGlossaryOpen] = (0, import_react16.useState)(false);
|
|
55410
55598
|
const [detailsExpanded, setDetailsExpanded] = (0, import_react16.useState)(false);
|
|
55411
55599
|
const [depositsModalOpen, setDepositsModalOpen] = (0, import_react16.useState)(false);
|
|
55412
55600
|
const [tokenSelectorOpen, setTokenSelectorOpen] = (0, import_react16.useState)(false);
|
|
55413
|
-
const [initialSelectionDone, setInitialSelectionDone] = (0, import_react16.useState)(false);
|
|
55414
55601
|
const { data: tokensResponse, isLoading: tokensLoading } = useSupportedDepositTokens(publishableKey, {
|
|
55415
55602
|
destination_token_address: destinationTokenAddress,
|
|
55416
55603
|
destination_chain_id: destinationChainId,
|
|
55417
55604
|
destination_chain_type: destinationChainType
|
|
55418
55605
|
});
|
|
55419
55606
|
const supportedTokens = tokensResponse?.data ?? [];
|
|
55607
|
+
const { token, chain, setToken, setChain, initialSelectionDone } = useDefaultSourceToken({
|
|
55608
|
+
supportedTokens,
|
|
55609
|
+
defaultSourceChainType,
|
|
55610
|
+
defaultSourceChainId,
|
|
55611
|
+
defaultSourceTokenAddress,
|
|
55612
|
+
defaultSourceSymbol
|
|
55613
|
+
});
|
|
55420
55614
|
const {
|
|
55421
55615
|
data: depositAddressResponse,
|
|
55422
55616
|
isLoading: walletsLoading,
|
|
@@ -55436,8 +55630,8 @@ function TransferCryptoSingleInput({
|
|
|
55436
55630
|
const error = walletsError?.message ?? null;
|
|
55437
55631
|
const allAvailableChains = (0, import_react16.useMemo)(() => {
|
|
55438
55632
|
const chainsMap = /* @__PURE__ */ new Map();
|
|
55439
|
-
supportedTokens.forEach((
|
|
55440
|
-
|
|
55633
|
+
supportedTokens.forEach((t11) => {
|
|
55634
|
+
t11.chains.forEach((c) => {
|
|
55441
55635
|
const comboKey = `${c.chain_type}:${c.chain_id}`;
|
|
55442
55636
|
if (!chainsMap.has(comboKey)) {
|
|
55443
55637
|
chainsMap.set(comboKey, c);
|
|
@@ -55446,10 +55640,10 @@ function TransferCryptoSingleInput({
|
|
|
55446
55640
|
});
|
|
55447
55641
|
return Array.from(chainsMap.values());
|
|
55448
55642
|
}, [supportedTokens]);
|
|
55449
|
-
const currentChainCombo = parseChainKey(chain);
|
|
55450
|
-
const currentChainData = allAvailableChains.find(
|
|
55643
|
+
const currentChainCombo = chain ? parseChainKey(chain) : null;
|
|
55644
|
+
const currentChainData = currentChainCombo ? allAvailableChains.find(
|
|
55451
55645
|
(c) => c.chain_type === currentChainCombo.chainType && c.chain_id === currentChainCombo.chainId
|
|
55452
|
-
);
|
|
55646
|
+
) : void 0;
|
|
55453
55647
|
const currentChainType = currentChainData?.chain_type || "ethereum";
|
|
55454
55648
|
const currentWallet = getWalletByChainType(wallets, currentChainType);
|
|
55455
55649
|
const depositAddress = currentWallet?.address || "";
|
|
@@ -55467,84 +55661,26 @@ function TransferCryptoSingleInput({
|
|
|
55467
55661
|
onDepositSuccess,
|
|
55468
55662
|
onDepositError
|
|
55469
55663
|
});
|
|
55470
|
-
(0, import_react16.useEffect)(() => {
|
|
55471
|
-
if (!supportedTokens.length || initialSelectionDone) return;
|
|
55472
|
-
let selectedTokenData;
|
|
55473
|
-
let selectedChainData;
|
|
55474
|
-
if (destinationTokenAddress) {
|
|
55475
|
-
for (const t7 of supportedTokens) {
|
|
55476
|
-
const matchingChain = t7.chains.find(
|
|
55477
|
-
(c) => c.token_address.toLowerCase() === destinationTokenAddress.toLowerCase()
|
|
55478
|
-
);
|
|
55479
|
-
if (matchingChain) {
|
|
55480
|
-
selectedTokenData = t7;
|
|
55481
|
-
selectedChainData = matchingChain;
|
|
55482
|
-
break;
|
|
55483
|
-
}
|
|
55484
|
-
}
|
|
55485
|
-
}
|
|
55486
|
-
if (!selectedTokenData) {
|
|
55487
|
-
selectedTokenData = supportedTokens.find((t7) => t7.symbol === "USDC");
|
|
55488
|
-
if (selectedTokenData && selectedTokenData.chains.length > 0) {
|
|
55489
|
-
selectedChainData = selectedTokenData.chains[0];
|
|
55490
|
-
}
|
|
55491
|
-
}
|
|
55492
|
-
if (!selectedTokenData) {
|
|
55493
|
-
selectedTokenData = supportedTokens.find((t7) => t7.symbol === "USDT");
|
|
55494
|
-
if (selectedTokenData && selectedTokenData.chains.length > 0) {
|
|
55495
|
-
selectedChainData = selectedTokenData.chains[0];
|
|
55496
|
-
}
|
|
55497
|
-
}
|
|
55498
|
-
if (!selectedTokenData) {
|
|
55499
|
-
selectedTokenData = supportedTokens[0];
|
|
55500
|
-
if (selectedTokenData.chains.length > 0) {
|
|
55501
|
-
selectedChainData = selectedTokenData.chains[0];
|
|
55502
|
-
}
|
|
55503
|
-
}
|
|
55504
|
-
if (selectedTokenData) {
|
|
55505
|
-
setToken(selectedTokenData.symbol);
|
|
55506
|
-
}
|
|
55507
|
-
if (selectedChainData) {
|
|
55508
|
-
setChain(
|
|
55509
|
-
getChainKey(selectedChainData.chain_id, selectedChainData.chain_type)
|
|
55510
|
-
);
|
|
55511
|
-
}
|
|
55512
|
-
setInitialSelectionDone(true);
|
|
55513
|
-
}, [supportedTokens, destinationTokenAddress, initialSelectionDone]);
|
|
55514
55664
|
(0, import_react16.useEffect)(() => {
|
|
55515
55665
|
if (onExecutionsChange) {
|
|
55516
55666
|
onExecutionsChange(depositExecutions);
|
|
55517
55667
|
}
|
|
55518
55668
|
}, [depositExecutions, onExecutionsChange]);
|
|
55519
|
-
|
|
55520
|
-
if (!supportedTokens.length) return;
|
|
55521
|
-
const currentToken = supportedTokens.find((t7) => t7.symbol === token);
|
|
55522
|
-
if (!currentToken || currentToken.chains.length === 0) return;
|
|
55523
|
-
const isChainAvailable = currentToken.chains.some((c) => {
|
|
55524
|
-
const key = getChainKey(c.chain_id, c.chain_type);
|
|
55525
|
-
return key === chain;
|
|
55526
|
-
});
|
|
55527
|
-
if (!isChainAvailable) {
|
|
55528
|
-
const firstChain = currentToken.chains[0];
|
|
55529
|
-
const newChain = getChainKey(firstChain.chain_id, firstChain.chain_type);
|
|
55530
|
-
setChain(newChain);
|
|
55531
|
-
}
|
|
55532
|
-
}, [token, supportedTokens, chain]);
|
|
55533
|
-
const selectedToken = supportedTokens.find((t7) => t7.symbol === token);
|
|
55669
|
+
const selectedToken = token ? supportedTokens.find((t11) => t11.symbol === token) : void 0;
|
|
55534
55670
|
const availableChainsForToken = selectedToken?.chains || [];
|
|
55535
|
-
const currentChainFromBackend = availableChainsForToken.find((c) => {
|
|
55536
|
-
const key =
|
|
55671
|
+
const currentChainFromBackend = chain ? availableChainsForToken.find((c) => {
|
|
55672
|
+
const key = getChainKey2(c.chain_id, c.chain_type);
|
|
55537
55673
|
return key === chain;
|
|
55538
55674
|
}) || allAvailableChains.find((c) => {
|
|
55539
|
-
const key =
|
|
55675
|
+
const key = getChainKey2(c.chain_id, c.chain_type);
|
|
55540
55676
|
return key === chain;
|
|
55541
|
-
});
|
|
55677
|
+
}) : void 0;
|
|
55542
55678
|
const handleCopyAddress = () => {
|
|
55543
55679
|
navigator.clipboard.writeText(depositAddress);
|
|
55544
55680
|
setCopied(true);
|
|
55545
55681
|
setTimeout(() => setCopied(false), 2e3);
|
|
55546
55682
|
};
|
|
55547
|
-
const
|
|
55683
|
+
const formatProcessingTime3 = (seconds) => {
|
|
55548
55684
|
if (seconds === null) {
|
|
55549
55685
|
return t4.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
|
|
55550
55686
|
}
|
|
@@ -55573,10 +55709,10 @@ function TransferCryptoSingleInput({
|
|
|
55573
55709
|
"button",
|
|
55574
55710
|
{
|
|
55575
55711
|
onClick: () => setTokenSelectorOpen(true),
|
|
55576
|
-
disabled: tokensLoading || supportedTokens.length === 0,
|
|
55712
|
+
disabled: tokensLoading || !token || supportedTokens.length === 0,
|
|
55577
55713
|
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",
|
|
55578
55714
|
style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` },
|
|
55579
|
-
children: tokensLoading ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3 uf-animate-pulse", children: [
|
|
55715
|
+
children: tokensLoading || !token ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3 uf-animate-pulse", children: [
|
|
55580
55716
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-full uf-bg-muted" }),
|
|
55581
55717
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "uf-flex-1", children: [
|
|
55582
55718
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "uf-h-4 uf-w-16 uf-bg-muted uf-rounded uf-mb-1" }),
|
|
@@ -55650,8 +55786,8 @@ function TransferCryptoSingleInput({
|
|
|
55650
55786
|
open: tokenSelectorOpen,
|
|
55651
55787
|
onOpenChange: setTokenSelectorOpen,
|
|
55652
55788
|
tokens: supportedTokens,
|
|
55653
|
-
selectedToken: token,
|
|
55654
|
-
selectedChainKey: chain,
|
|
55789
|
+
selectedToken: token ?? "",
|
|
55790
|
+
selectedChainKey: chain ?? "",
|
|
55655
55791
|
onSelect: (newToken, newChain) => {
|
|
55656
55792
|
setToken(newToken);
|
|
55657
55793
|
setChain(newChain);
|
|
@@ -55753,7 +55889,7 @@ function TransferCryptoSingleInput({
|
|
|
55753
55889
|
t4.processingTime.label,
|
|
55754
55890
|
":",
|
|
55755
55891
|
" ",
|
|
55756
|
-
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children:
|
|
55892
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime3(processingTime) })
|
|
55757
55893
|
] })
|
|
55758
55894
|
] }),
|
|
55759
55895
|
detailsExpanded ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ChevronUp, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ChevronDown, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } })
|
|
@@ -55989,7 +56125,7 @@ var SelectSeparator2 = React252.forwardRef(({ className, ...props }, ref) => /*
|
|
|
55989
56125
|
));
|
|
55990
56126
|
SelectSeparator2.displayName = Separator.displayName;
|
|
55991
56127
|
var t5 = i18n2.transferCrypto;
|
|
55992
|
-
var
|
|
56128
|
+
var getChainKey3 = (chainId, chainType) => {
|
|
55993
56129
|
return `${chainType}:${chainId}`;
|
|
55994
56130
|
};
|
|
55995
56131
|
var parseChainKey2 = (chainKey) => {
|
|
@@ -56003,6 +56139,10 @@ function TransferCryptoDoubleInput({
|
|
|
56003
56139
|
destinationChainType,
|
|
56004
56140
|
destinationChainId,
|
|
56005
56141
|
destinationTokenAddress,
|
|
56142
|
+
defaultSourceChainType,
|
|
56143
|
+
defaultSourceChainId,
|
|
56144
|
+
defaultSourceTokenAddress,
|
|
56145
|
+
defaultSourceSymbol,
|
|
56006
56146
|
depositConfirmationMode = "auto_ui",
|
|
56007
56147
|
onExecutionsChange,
|
|
56008
56148
|
onDepositSuccess,
|
|
@@ -56011,20 +56151,24 @@ function TransferCryptoDoubleInput({
|
|
|
56011
56151
|
}) {
|
|
56012
56152
|
const { themeClass, colors: colors2, fonts, components } = useTheme();
|
|
56013
56153
|
const isDarkMode = themeClass.includes("uf-dark");
|
|
56014
|
-
const [
|
|
56015
|
-
const [chain, setChain] = (0, import_react22.useState)("solana:mainnet");
|
|
56016
|
-
const [copied, setCopied] = (0, import_react22.useState)(false);
|
|
56154
|
+
const [copied, setCopied] = (0, import_react23.useState)(false);
|
|
56017
56155
|
const { copied: copiedRecipient, handleCopy: handleCopyRecipientAddress } = useCopyAddress();
|
|
56018
|
-
const [glossaryOpen, setGlossaryOpen] = (0,
|
|
56019
|
-
const [detailsExpanded, setDetailsExpanded] = (0,
|
|
56020
|
-
const [depositsModalOpen, setDepositsModalOpen] = (0,
|
|
56021
|
-
const [initialSelectionDone, setInitialSelectionDone] = (0, import_react22.useState)(false);
|
|
56156
|
+
const [glossaryOpen, setGlossaryOpen] = (0, import_react23.useState)(false);
|
|
56157
|
+
const [detailsExpanded, setDetailsExpanded] = (0, import_react23.useState)(false);
|
|
56158
|
+
const [depositsModalOpen, setDepositsModalOpen] = (0, import_react23.useState)(false);
|
|
56022
56159
|
const { data: tokensResponse, isLoading: tokensLoading } = useSupportedDepositTokens(publishableKey, {
|
|
56023
56160
|
destination_token_address: destinationTokenAddress,
|
|
56024
56161
|
destination_chain_id: destinationChainId,
|
|
56025
56162
|
destination_chain_type: destinationChainType
|
|
56026
56163
|
});
|
|
56027
56164
|
const supportedTokens = tokensResponse?.data ?? [];
|
|
56165
|
+
const { token, chain, setToken, setChain, initialSelectionDone } = useDefaultSourceToken({
|
|
56166
|
+
supportedTokens,
|
|
56167
|
+
defaultSourceChainType,
|
|
56168
|
+
defaultSourceChainId,
|
|
56169
|
+
defaultSourceTokenAddress,
|
|
56170
|
+
defaultSourceSymbol
|
|
56171
|
+
});
|
|
56028
56172
|
const {
|
|
56029
56173
|
data: depositAddressResponse,
|
|
56030
56174
|
isLoading: walletsLoading,
|
|
@@ -56042,10 +56186,10 @@ function TransferCryptoDoubleInput({
|
|
|
56042
56186
|
const wallets = externalWallets?.length ? externalWallets : depositAddressResponse?.data ?? [];
|
|
56043
56187
|
const loading = externalWallets?.length ? false : walletsLoading;
|
|
56044
56188
|
const error = walletsError?.message ?? null;
|
|
56045
|
-
const allAvailableChains = (0,
|
|
56189
|
+
const allAvailableChains = (0, import_react23.useMemo)(() => {
|
|
56046
56190
|
const chainsMap = /* @__PURE__ */ new Map();
|
|
56047
|
-
supportedTokens.forEach((
|
|
56048
|
-
|
|
56191
|
+
supportedTokens.forEach((t11) => {
|
|
56192
|
+
t11.chains.forEach((c) => {
|
|
56049
56193
|
const comboKey = `${c.chain_type}:${c.chain_id}`;
|
|
56050
56194
|
if (!chainsMap.has(comboKey)) {
|
|
56051
56195
|
chainsMap.set(comboKey, c);
|
|
@@ -56054,10 +56198,10 @@ function TransferCryptoDoubleInput({
|
|
|
56054
56198
|
});
|
|
56055
56199
|
return Array.from(chainsMap.values());
|
|
56056
56200
|
}, [supportedTokens]);
|
|
56057
|
-
const currentChainCombo = parseChainKey2(chain);
|
|
56058
|
-
const currentChainData = allAvailableChains.find(
|
|
56201
|
+
const currentChainCombo = chain ? parseChainKey2(chain) : null;
|
|
56202
|
+
const currentChainData = currentChainCombo ? allAvailableChains.find(
|
|
56059
56203
|
(c) => c.chain_type === currentChainCombo.chainType && c.chain_id === currentChainCombo.chainId
|
|
56060
|
-
);
|
|
56204
|
+
) : void 0;
|
|
56061
56205
|
const currentChainType = currentChainData?.chain_type || "ethereum";
|
|
56062
56206
|
const currentWallet = getWalletByChainType(wallets, currentChainType);
|
|
56063
56207
|
const depositAddress = currentWallet?.address || "";
|
|
@@ -56075,57 +56219,26 @@ function TransferCryptoDoubleInput({
|
|
|
56075
56219
|
onDepositSuccess,
|
|
56076
56220
|
onDepositError
|
|
56077
56221
|
});
|
|
56078
|
-
(0,
|
|
56079
|
-
if (!supportedTokens.length || initialSelectionDone) return;
|
|
56080
|
-
const allChains = /* @__PURE__ */ new Set();
|
|
56081
|
-
supportedTokens.forEach((t7) => {
|
|
56082
|
-
t7.chains.forEach((c) => {
|
|
56083
|
-
allChains.add(getChainKey2(c.chain_id, c.chain_type));
|
|
56084
|
-
});
|
|
56085
|
-
});
|
|
56086
|
-
if (!allChains.has(chain)) {
|
|
56087
|
-
const firstToken = supportedTokens[0];
|
|
56088
|
-
if (firstToken.chains.length > 0) {
|
|
56089
|
-
const firstChain = firstToken.chains[0];
|
|
56090
|
-
setChain(getChainKey2(firstChain.chain_id, firstChain.chain_type));
|
|
56091
|
-
}
|
|
56092
|
-
}
|
|
56093
|
-
setInitialSelectionDone(true);
|
|
56094
|
-
}, [supportedTokens, chain, initialSelectionDone]);
|
|
56095
|
-
(0, import_react22.useEffect)(() => {
|
|
56222
|
+
(0, import_react23.useEffect)(() => {
|
|
56096
56223
|
if (onExecutionsChange) {
|
|
56097
56224
|
onExecutionsChange(depositExecutions);
|
|
56098
56225
|
}
|
|
56099
56226
|
}, [depositExecutions, onExecutionsChange]);
|
|
56100
|
-
|
|
56101
|
-
if (!supportedTokens.length) return;
|
|
56102
|
-
const currentToken = supportedTokens.find((t7) => t7.symbol === token);
|
|
56103
|
-
if (!currentToken || currentToken.chains.length === 0) return;
|
|
56104
|
-
const isChainAvailable = currentToken.chains.some((c) => {
|
|
56105
|
-
const key = getChainKey2(c.chain_id, c.chain_type);
|
|
56106
|
-
return key === chain;
|
|
56107
|
-
});
|
|
56108
|
-
if (!isChainAvailable) {
|
|
56109
|
-
const firstChain = currentToken.chains[0];
|
|
56110
|
-
const newChain = getChainKey2(firstChain.chain_id, firstChain.chain_type);
|
|
56111
|
-
setChain(newChain);
|
|
56112
|
-
}
|
|
56113
|
-
}, [token, supportedTokens, chain]);
|
|
56114
|
-
const selectedToken = supportedTokens.find((t7) => t7.symbol === token);
|
|
56227
|
+
const selectedToken = token ? supportedTokens.find((t11) => t11.symbol === token) : void 0;
|
|
56115
56228
|
const availableChainsForToken = selectedToken?.chains || [];
|
|
56116
|
-
const currentChainFromBackend = availableChainsForToken.find((c) => {
|
|
56117
|
-
const key =
|
|
56229
|
+
const currentChainFromBackend = chain ? availableChainsForToken.find((c) => {
|
|
56230
|
+
const key = getChainKey3(c.chain_id, c.chain_type);
|
|
56118
56231
|
return key === chain;
|
|
56119
56232
|
}) || allAvailableChains.find((c) => {
|
|
56120
|
-
const key =
|
|
56233
|
+
const key = getChainKey3(c.chain_id, c.chain_type);
|
|
56121
56234
|
return key === chain;
|
|
56122
|
-
});
|
|
56235
|
+
}) : void 0;
|
|
56123
56236
|
const handleCopyAddress = () => {
|
|
56124
56237
|
navigator.clipboard.writeText(depositAddress);
|
|
56125
56238
|
setCopied(true);
|
|
56126
56239
|
setTimeout(() => setCopied(false), 2e3);
|
|
56127
56240
|
};
|
|
56128
|
-
const
|
|
56241
|
+
const formatProcessingTime3 = (seconds) => {
|
|
56129
56242
|
if (seconds === null) {
|
|
56130
56243
|
return t5.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
|
|
56131
56244
|
}
|
|
@@ -56193,11 +56306,11 @@ function TransferCryptoDoubleInput({
|
|
|
56193
56306
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
56194
56307
|
Select2,
|
|
56195
56308
|
{
|
|
56196
|
-
value: token,
|
|
56309
|
+
value: token ?? "",
|
|
56197
56310
|
onValueChange: setToken,
|
|
56198
|
-
disabled: tokensLoading || supportedTokens.length === 0,
|
|
56311
|
+
disabled: tokensLoading || !token || supportedTokens.length === 0,
|
|
56199
56312
|
children: [
|
|
56200
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(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__ */ (0, import_jsx_runtime62.jsx)(SelectValue2, { children: tokensLoading ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t5.loading }) }) : selectedToken ? renderTokenItem(selectedToken) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-normal", children: token }) }) }) }),
|
|
56313
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(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__ */ (0, import_jsx_runtime62.jsx)(SelectValue2, { children: tokensLoading || !token ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t5.loading }) }) : selectedToken ? renderTokenItem(selectedToken) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-normal", children: token }) }) }) }),
|
|
56201
56314
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(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__ */ (0, import_jsx_runtime62.jsx)(
|
|
56202
56315
|
SelectItem2,
|
|
56203
56316
|
{
|
|
@@ -56224,11 +56337,11 @@ function TransferCryptoDoubleInput({
|
|
|
56224
56337
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
56225
56338
|
Select2,
|
|
56226
56339
|
{
|
|
56227
|
-
value: chain,
|
|
56340
|
+
value: chain ?? "",
|
|
56228
56341
|
onValueChange: setChain,
|
|
56229
|
-
disabled: tokensLoading || availableChainsForToken.length === 0,
|
|
56342
|
+
disabled: tokensLoading || !chain || availableChainsForToken.length === 0,
|
|
56230
56343
|
children: [
|
|
56231
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(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__ */ (0, import_jsx_runtime62.jsx)(SelectValue2, { children: tokensLoading ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t5.loading }) }) : currentChainFromBackend ? renderChainItem(currentChainFromBackend) : currentChainData ? renderChainItem(currentChainData) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-normal", children: chain }) }) }) }),
|
|
56344
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(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__ */ (0, import_jsx_runtime62.jsx)(SelectValue2, { children: tokensLoading || !chain ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t5.loading }) }) : currentChainFromBackend ? renderChainItem(currentChainFromBackend) : currentChainData ? renderChainItem(currentChainData) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-normal", children: chain }) }) }) }),
|
|
56232
56345
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
56233
56346
|
SelectContent2,
|
|
56234
56347
|
{
|
|
@@ -56236,7 +56349,7 @@ function TransferCryptoDoubleInput({
|
|
|
56236
56349
|
className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px] uf-min-w-[200px]",
|
|
56237
56350
|
style: { border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`, ...fonts.regular ? { "--uf-font-family": fonts.regular } : {} },
|
|
56238
56351
|
children: availableChainsForToken.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-px-2 uf-py-3 uf-text-xs uf-text-muted-foreground uf-text-center", children: t5.noChainsAvailable }) : availableChainsForToken.map((chainData) => {
|
|
56239
|
-
const chainKey =
|
|
56352
|
+
const chainKey = getChainKey3(
|
|
56240
56353
|
chainData.chain_id,
|
|
56241
56354
|
chainData.chain_type
|
|
56242
56355
|
);
|
|
@@ -56352,7 +56465,7 @@ function TransferCryptoDoubleInput({
|
|
|
56352
56465
|
t5.processingTime.label,
|
|
56353
56466
|
":",
|
|
56354
56467
|
" ",
|
|
56355
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children:
|
|
56468
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime3(processingTime) })
|
|
56356
56469
|
] })
|
|
56357
56470
|
] }),
|
|
56358
56471
|
detailsExpanded ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChevronUp, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChevronDown, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } })
|
|
@@ -57231,8 +57344,8 @@ function ConfirmingView({
|
|
|
57231
57344
|
isPolling = false
|
|
57232
57345
|
}) {
|
|
57233
57346
|
const { colors: colors2, fonts } = useTheme();
|
|
57234
|
-
const [containerEl, setContainerEl] = (0,
|
|
57235
|
-
const containerCallbackRef = (0,
|
|
57347
|
+
const [containerEl, setContainerEl] = (0, import_react26.useState)(null);
|
|
57348
|
+
const containerCallbackRef = (0, import_react26.useCallback)((el) => {
|
|
57236
57349
|
setContainerEl(el);
|
|
57237
57350
|
}, []);
|
|
57238
57351
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(PortalContainerProvider, { value: containerEl, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
@@ -57396,7 +57509,7 @@ function BrowserWalletModal({
|
|
|
57396
57509
|
);
|
|
57397
57510
|
if (cancelled) return;
|
|
57398
57511
|
const supportedToken = response.data.find(
|
|
57399
|
-
(
|
|
57512
|
+
(t11) => t11.symbol.toLowerCase() === token.symbol.toLowerCase()
|
|
57400
57513
|
);
|
|
57401
57514
|
if (supportedToken) {
|
|
57402
57515
|
const chainDetail = supportedToken.chains.find(
|
|
@@ -58604,6 +58717,10 @@ function DepositModal({
|
|
|
58604
58717
|
destinationChainType,
|
|
58605
58718
|
destinationChainId,
|
|
58606
58719
|
destinationTokenAddress,
|
|
58720
|
+
defaultSourceChainType,
|
|
58721
|
+
defaultSourceChainId,
|
|
58722
|
+
defaultSourceTokenAddress,
|
|
58723
|
+
defaultSourceSymbol,
|
|
58607
58724
|
hideDepositTracker = false,
|
|
58608
58725
|
showBalanceHeader = false,
|
|
58609
58726
|
transferInputVariant = "double_input",
|
|
@@ -58700,7 +58817,7 @@ function DepositModal({
|
|
|
58700
58817
|
if (view !== "tracker" || !userId) return;
|
|
58701
58818
|
const fetchExecutions = async () => {
|
|
58702
58819
|
try {
|
|
58703
|
-
const response = await queryExecutions(userId, publishableKey);
|
|
58820
|
+
const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
|
|
58704
58821
|
const sorted = [...response.data].sort((a, b) => {
|
|
58705
58822
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
58706
58823
|
const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
@@ -59036,6 +59153,10 @@ function DepositModal({
|
|
|
59036
59153
|
destinationChainType,
|
|
59037
59154
|
destinationChainId,
|
|
59038
59155
|
destinationTokenAddress,
|
|
59156
|
+
defaultSourceChainType,
|
|
59157
|
+
defaultSourceChainId,
|
|
59158
|
+
defaultSourceTokenAddress,
|
|
59159
|
+
defaultSourceSymbol,
|
|
59039
59160
|
depositConfirmationMode,
|
|
59040
59161
|
onExecutionsChange: setDepositExecutions,
|
|
59041
59162
|
onDepositSuccess,
|
|
@@ -59051,6 +59172,10 @@ function DepositModal({
|
|
|
59051
59172
|
destinationChainType,
|
|
59052
59173
|
destinationChainId,
|
|
59053
59174
|
destinationTokenAddress,
|
|
59175
|
+
defaultSourceChainType,
|
|
59176
|
+
defaultSourceChainId,
|
|
59177
|
+
defaultSourceTokenAddress,
|
|
59178
|
+
defaultSourceSymbol,
|
|
59054
59179
|
depositConfirmationMode,
|
|
59055
59180
|
onExecutionsChange: setDepositExecutions,
|
|
59056
59181
|
onDepositSuccess,
|
|
@@ -59211,83 +59336,1806 @@ function DepositModal({
|
|
|
59211
59336
|
}
|
|
59212
59337
|
) });
|
|
59213
59338
|
}
|
|
59214
|
-
function
|
|
59215
|
-
|
|
59339
|
+
function useSupportedDestinationTokens(publishableKey, enabled = true) {
|
|
59340
|
+
return useQuery({
|
|
59341
|
+
queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
|
|
59342
|
+
queryFn: () => getSupportedDestinationTokens(publishableKey),
|
|
59343
|
+
staleTime: 1e3 * 60 * 5,
|
|
59344
|
+
gcTime: 1e3 * 60 * 30,
|
|
59345
|
+
refetchOnMount: false,
|
|
59346
|
+
refetchOnWindowFocus: false,
|
|
59347
|
+
enabled
|
|
59348
|
+
});
|
|
59349
|
+
}
|
|
59350
|
+
function useSourceTokenValidation(params) {
|
|
59351
|
+
const {
|
|
59352
|
+
sourceChainType,
|
|
59353
|
+
sourceChainId,
|
|
59354
|
+
sourceTokenAddress,
|
|
59355
|
+
sourceTokenSymbol,
|
|
59356
|
+
publishableKey,
|
|
59357
|
+
enabled = true
|
|
59358
|
+
} = params;
|
|
59359
|
+
const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
|
|
59360
|
+
return useQuery({
|
|
59361
|
+
queryKey: [
|
|
59362
|
+
"unifold",
|
|
59363
|
+
"sourceTokenValidation",
|
|
59364
|
+
sourceChainType ?? null,
|
|
59365
|
+
sourceChainId ?? null,
|
|
59366
|
+
sourceTokenAddress ?? null,
|
|
59367
|
+
publishableKey
|
|
59368
|
+
],
|
|
59369
|
+
queryFn: async () => {
|
|
59370
|
+
const res = await getSupportedDepositTokens(publishableKey);
|
|
59371
|
+
let matchedMinUsd = null;
|
|
59372
|
+
let matchedProcessingTime = null;
|
|
59373
|
+
let matchedSlippage = null;
|
|
59374
|
+
let matchedPriceImpact = null;
|
|
59375
|
+
const found = res.data.some(
|
|
59376
|
+
(token) => token.chains.some((chain) => {
|
|
59377
|
+
const match = chain.chain_type === sourceChainType && chain.chain_id === sourceChainId && chain.token_address.toLowerCase() === sourceTokenAddress.toLowerCase();
|
|
59378
|
+
if (match) {
|
|
59379
|
+
matchedMinUsd = chain.minimum_deposit_amount_usd;
|
|
59380
|
+
matchedProcessingTime = chain.estimated_processing_time;
|
|
59381
|
+
matchedSlippage = chain.max_slippage_percent;
|
|
59382
|
+
matchedPriceImpact = chain.estimated_price_impact_percent;
|
|
59383
|
+
}
|
|
59384
|
+
return match;
|
|
59385
|
+
})
|
|
59386
|
+
);
|
|
59387
|
+
return {
|
|
59388
|
+
isSupported: found,
|
|
59389
|
+
minimumAmountUsd: matchedMinUsd,
|
|
59390
|
+
estimatedProcessingTime: matchedProcessingTime,
|
|
59391
|
+
maxSlippagePercent: matchedSlippage,
|
|
59392
|
+
priceImpactPercent: matchedPriceImpact,
|
|
59393
|
+
errorMessage: found ? null : `${sourceTokenSymbol || "Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`
|
|
59394
|
+
};
|
|
59395
|
+
},
|
|
59396
|
+
enabled: enabled && hasParams,
|
|
59397
|
+
staleTime: 1e3 * 60 * 5,
|
|
59398
|
+
gcTime: 1e3 * 60 * 30,
|
|
59399
|
+
refetchOnMount: false,
|
|
59400
|
+
refetchOnWindowFocus: false
|
|
59401
|
+
});
|
|
59402
|
+
}
|
|
59403
|
+
function useAddressBalance(params) {
|
|
59404
|
+
const {
|
|
59405
|
+
address,
|
|
59406
|
+
chainType,
|
|
59407
|
+
chainId,
|
|
59408
|
+
tokenAddress,
|
|
59409
|
+
publishableKey,
|
|
59410
|
+
enabled = true
|
|
59411
|
+
} = params;
|
|
59412
|
+
const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
|
|
59413
|
+
return useQuery({
|
|
59414
|
+
queryKey: [
|
|
59415
|
+
"unifold",
|
|
59416
|
+
"addressBalance",
|
|
59417
|
+
address ?? null,
|
|
59418
|
+
chainType ?? null,
|
|
59419
|
+
chainId ?? null,
|
|
59420
|
+
tokenAddress ?? null,
|
|
59421
|
+
publishableKey
|
|
59422
|
+
],
|
|
59423
|
+
queryFn: async () => {
|
|
59424
|
+
const res = await getAddressBalance(
|
|
59425
|
+
address,
|
|
59426
|
+
chainType,
|
|
59427
|
+
chainId,
|
|
59428
|
+
tokenAddress,
|
|
59429
|
+
publishableKey
|
|
59430
|
+
);
|
|
59431
|
+
if (res.balance) {
|
|
59432
|
+
const decimals = res.balance.token?.decimals ?? 6;
|
|
59433
|
+
const symbol = res.balance.token?.symbol ?? "";
|
|
59434
|
+
const baseUnit = res.balance.amount;
|
|
59435
|
+
const raw = BigInt(baseUnit);
|
|
59436
|
+
const divisor = BigInt(10 ** decimals);
|
|
59437
|
+
const whole = raw / divisor;
|
|
59438
|
+
const frac = raw % divisor;
|
|
59439
|
+
const fracStr = frac.toString().padStart(decimals, "0").replace(/0+$/, "");
|
|
59440
|
+
const balanceHuman = fracStr ? `${whole}.${fracStr}` : whole.toString();
|
|
59441
|
+
return {
|
|
59442
|
+
balanceBaseUnit: baseUnit,
|
|
59443
|
+
balanceHuman,
|
|
59444
|
+
balanceUsd: res.balance.amount_usd,
|
|
59445
|
+
exchangeRate: res.balance.exchange_rate,
|
|
59446
|
+
decimals,
|
|
59447
|
+
symbol
|
|
59448
|
+
};
|
|
59449
|
+
}
|
|
59450
|
+
return { balanceBaseUnit: "0", balanceHuman: "0", balanceUsd: "0", exchangeRate: null, decimals: 6, symbol: "" };
|
|
59451
|
+
},
|
|
59452
|
+
enabled: enabled && hasParams,
|
|
59453
|
+
staleTime: 1e3 * 30,
|
|
59454
|
+
gcTime: 1e3 * 60 * 5,
|
|
59455
|
+
refetchInterval: 1e3 * 30,
|
|
59456
|
+
refetchOnMount: "always",
|
|
59457
|
+
refetchOnWindowFocus: false
|
|
59458
|
+
});
|
|
59459
|
+
}
|
|
59460
|
+
function useExecutions(userId, publishableKey, options2) {
|
|
59461
|
+
const actionType = options2?.actionType ?? ActionType.Deposit;
|
|
59462
|
+
return useQuery({
|
|
59463
|
+
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
59464
|
+
queryFn: () => queryExecutions(userId, publishableKey, actionType),
|
|
59465
|
+
enabled: (options2?.enabled ?? true) && !!userId,
|
|
59466
|
+
refetchInterval: options2?.refetchInterval ?? 3e3,
|
|
59467
|
+
staleTime: 0,
|
|
59468
|
+
gcTime: 1e3 * 60 * 5,
|
|
59469
|
+
refetchOnWindowFocus: false
|
|
59470
|
+
});
|
|
59471
|
+
}
|
|
59472
|
+
var POLL_INTERVAL_MS2 = 2500;
|
|
59473
|
+
var POLL_ENDPOINT_INTERVAL_MS2 = 3e3;
|
|
59474
|
+
var CUTOFF_BUFFER_MS2 = 6e4;
|
|
59475
|
+
function useWithdrawPolling({
|
|
59476
|
+
userId,
|
|
59216
59477
|
publishableKey,
|
|
59217
|
-
|
|
59478
|
+
depositWalletId,
|
|
59479
|
+
enabled = false,
|
|
59480
|
+
onWithdrawSuccess,
|
|
59481
|
+
onWithdrawError
|
|
59218
59482
|
}) {
|
|
59219
|
-
const [
|
|
59220
|
-
const [
|
|
59221
|
-
|
|
59222
|
-
);
|
|
59223
|
-
const
|
|
59224
|
-
(0,
|
|
59225
|
-
|
|
59226
|
-
|
|
59227
|
-
|
|
59228
|
-
}, [
|
|
59229
|
-
|
|
59230
|
-
|
|
59231
|
-
|
|
59232
|
-
|
|
59233
|
-
|
|
59234
|
-
|
|
59235
|
-
|
|
59236
|
-
setResolvedTheme(e.matches ? "dark" : "light");
|
|
59237
|
-
};
|
|
59238
|
-
mediaQuery.addEventListener("change", handler);
|
|
59239
|
-
return () => mediaQuery.removeEventListener("change", handler);
|
|
59240
|
-
} else {
|
|
59241
|
-
setResolvedTheme(appearance);
|
|
59242
|
-
}
|
|
59243
|
-
}, [config?.appearance]);
|
|
59244
|
-
const depositPromiseRef = import_react.default.useRef(null);
|
|
59245
|
-
const depositConfigRef = import_react.default.useRef(null);
|
|
59246
|
-
depositConfigRef.current = depositConfig;
|
|
59247
|
-
const closeTimeoutRef = import_react.default.useRef(null);
|
|
59248
|
-
const closeGuardRef = import_react.default.useRef(false);
|
|
59249
|
-
const beginDeposit = (0, import_react.useCallback)((config2) => {
|
|
59250
|
-
if (closeTimeoutRef.current) {
|
|
59251
|
-
clearTimeout(closeTimeoutRef.current);
|
|
59252
|
-
closeTimeoutRef.current = null;
|
|
59253
|
-
}
|
|
59254
|
-
closeGuardRef.current = false;
|
|
59255
|
-
if (depositPromiseRef.current) {
|
|
59256
|
-
console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit.");
|
|
59257
|
-
depositPromiseRef.current.reject({
|
|
59258
|
-
message: "Deposit cancelled - new deposit started",
|
|
59259
|
-
code: "DEPOSIT_SUPERSEDED"
|
|
59260
|
-
});
|
|
59261
|
-
depositPromiseRef.current = null;
|
|
59262
|
-
}
|
|
59263
|
-
const promise = new Promise((resolve, reject) => {
|
|
59264
|
-
depositPromiseRef.current = { resolve, reject };
|
|
59265
|
-
});
|
|
59266
|
-
promise.catch(() => {
|
|
59267
|
-
});
|
|
59268
|
-
setDepositConfig(config2);
|
|
59269
|
-
setIsOpen(true);
|
|
59270
|
-
return promise;
|
|
59271
|
-
}, []);
|
|
59272
|
-
const closeDeposit = (0, import_react.useCallback)(() => {
|
|
59273
|
-
if (closeGuardRef.current) {
|
|
59274
|
-
return;
|
|
59275
|
-
}
|
|
59276
|
-
closeGuardRef.current = true;
|
|
59277
|
-
const promiseToReject = depositPromiseRef.current;
|
|
59278
|
-
depositPromiseRef.current = null;
|
|
59279
|
-
if (depositConfigRef.current?.onClose) {
|
|
59280
|
-
depositConfigRef.current.onClose();
|
|
59483
|
+
const [executions, setExecutions] = (0, import_react28.useState)([]);
|
|
59484
|
+
const [isPolling, setIsPolling] = (0, import_react28.useState)(false);
|
|
59485
|
+
const enabledAtRef = (0, import_react28.useRef)(/* @__PURE__ */ new Date());
|
|
59486
|
+
const trackedRef = (0, import_react28.useRef)(/* @__PURE__ */ new Map());
|
|
59487
|
+
const prevEnabledRef = (0, import_react28.useRef)(false);
|
|
59488
|
+
const onSuccessRef = (0, import_react28.useRef)(onWithdrawSuccess);
|
|
59489
|
+
const onErrorRef = (0, import_react28.useRef)(onWithdrawError);
|
|
59490
|
+
(0, import_react28.useEffect)(() => {
|
|
59491
|
+
onSuccessRef.current = onWithdrawSuccess;
|
|
59492
|
+
}, [onWithdrawSuccess]);
|
|
59493
|
+
(0, import_react28.useEffect)(() => {
|
|
59494
|
+
onErrorRef.current = onWithdrawError;
|
|
59495
|
+
}, [onWithdrawError]);
|
|
59496
|
+
(0, import_react28.useEffect)(() => {
|
|
59497
|
+
if (enabled && !prevEnabledRef.current) {
|
|
59498
|
+
enabledAtRef.current = /* @__PURE__ */ new Date();
|
|
59499
|
+
trackedRef.current.clear();
|
|
59281
59500
|
}
|
|
59282
|
-
if (
|
|
59283
|
-
|
|
59284
|
-
message: "Deposit cancelled by user",
|
|
59285
|
-
code: "DEPOSIT_CANCELLED"
|
|
59286
|
-
});
|
|
59501
|
+
if (!enabled) {
|
|
59502
|
+
trackedRef.current.clear();
|
|
59287
59503
|
}
|
|
59288
|
-
|
|
59289
|
-
|
|
59290
|
-
|
|
59504
|
+
prevEnabledRef.current = enabled;
|
|
59505
|
+
}, [enabled]);
|
|
59506
|
+
(0, import_react28.useEffect)(() => {
|
|
59507
|
+
if (!userId || !enabled) return;
|
|
59508
|
+
const enabledAt = enabledAtRef.current;
|
|
59509
|
+
const poll = async () => {
|
|
59510
|
+
try {
|
|
59511
|
+
const response = await queryExecutions(userId, publishableKey, ActionType.Withdraw);
|
|
59512
|
+
const cutoff = new Date(enabledAt.getTime() - CUTOFF_BUFFER_MS2);
|
|
59513
|
+
const sorted = [...response.data].sort((a, b) => {
|
|
59514
|
+
const tA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
59515
|
+
const tB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
59516
|
+
return tB - tA;
|
|
59517
|
+
});
|
|
59518
|
+
const inProgress = [ExecutionStatus.PENDING, ExecutionStatus.WAITING, ExecutionStatus.DELAYED];
|
|
59519
|
+
const terminal = [ExecutionStatus.SUCCEEDED, ExecutionStatus.FAILED];
|
|
59520
|
+
let target = null;
|
|
59521
|
+
for (const ex of sorted) {
|
|
59522
|
+
const t11 = ex.created_at ? new Date(ex.created_at) : null;
|
|
59523
|
+
if (!t11 || t11 < cutoff) continue;
|
|
59524
|
+
const prev = trackedRef.current.get(ex.id);
|
|
59525
|
+
if (!prev) {
|
|
59526
|
+
target = ex;
|
|
59527
|
+
break;
|
|
59528
|
+
}
|
|
59529
|
+
if (inProgress.includes(prev) && terminal.includes(ex.status)) {
|
|
59530
|
+
target = ex;
|
|
59531
|
+
break;
|
|
59532
|
+
}
|
|
59533
|
+
}
|
|
59534
|
+
if (target) {
|
|
59535
|
+
const ex = target;
|
|
59536
|
+
const exTime = ex.created_at ? new Date(ex.created_at) : null;
|
|
59537
|
+
if (!exTime || exTime < enabledAtRef.current) return;
|
|
59538
|
+
const prev = trackedRef.current.get(ex.id);
|
|
59539
|
+
trackedRef.current.set(ex.id, ex.status);
|
|
59540
|
+
setExecutions((list) => {
|
|
59541
|
+
const idx = list.findIndex((e) => e.id === ex.id);
|
|
59542
|
+
if (idx >= 0) {
|
|
59543
|
+
const u = [...list];
|
|
59544
|
+
u[idx] = ex;
|
|
59545
|
+
return u;
|
|
59546
|
+
}
|
|
59547
|
+
return [...list, ex];
|
|
59548
|
+
});
|
|
59549
|
+
if (ex.status === ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
|
|
59550
|
+
onSuccessRef.current?.({ message: "Withdrawal completed successfully", executionId: ex.id, transaction: ex });
|
|
59551
|
+
} else if (ex.status === ExecutionStatus.FAILED && prev !== ExecutionStatus.FAILED) {
|
|
59552
|
+
onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
|
|
59553
|
+
}
|
|
59554
|
+
}
|
|
59555
|
+
} catch (error) {
|
|
59556
|
+
console.error("Failed to fetch withdraw executions:", error);
|
|
59557
|
+
onErrorRef.current?.({ message: "Failed to fetch withdrawal status", code: "POLLING_ERROR", error });
|
|
59558
|
+
}
|
|
59559
|
+
};
|
|
59560
|
+
void poll();
|
|
59561
|
+
const interval = setInterval(poll, POLL_INTERVAL_MS2);
|
|
59562
|
+
setIsPolling(true);
|
|
59563
|
+
return () => {
|
|
59564
|
+
clearInterval(interval);
|
|
59565
|
+
setIsPolling(false);
|
|
59566
|
+
};
|
|
59567
|
+
}, [userId, publishableKey, enabled]);
|
|
59568
|
+
(0, import_react28.useEffect)(() => {
|
|
59569
|
+
if (!enabled || !depositWalletId) return;
|
|
59570
|
+
const trigger = async () => {
|
|
59571
|
+
try {
|
|
59572
|
+
await pollDirectExecutions({ deposit_wallet_id: depositWalletId }, publishableKey);
|
|
59573
|
+
} catch {
|
|
59574
|
+
}
|
|
59575
|
+
};
|
|
59576
|
+
trigger();
|
|
59577
|
+
const interval = setInterval(trigger, POLL_ENDPOINT_INTERVAL_MS2);
|
|
59578
|
+
return () => clearInterval(interval);
|
|
59579
|
+
}, [enabled, depositWalletId, publishableKey]);
|
|
59580
|
+
return { executions, isPolling };
|
|
59581
|
+
}
|
|
59582
|
+
var t7 = i18n2.withdrawModal;
|
|
59583
|
+
var getChainKey4 = (chainId, chainType) => `${chainType}:${chainId}`;
|
|
59584
|
+
function WithdrawDoubleInput({
|
|
59585
|
+
tokens,
|
|
59586
|
+
selectedTokenSymbol,
|
|
59587
|
+
selectedChainKey,
|
|
59588
|
+
onTokenChange,
|
|
59589
|
+
onChainChange,
|
|
59590
|
+
isLoading = false
|
|
59591
|
+
}) {
|
|
59592
|
+
const { fonts, components } = useTheme();
|
|
59593
|
+
const isDarkMode = useTheme().themeClass.includes("uf-dark");
|
|
59594
|
+
const selectedToken = selectedTokenSymbol ? tokens.find((t11) => t11.symbol === selectedTokenSymbol) : void 0;
|
|
59595
|
+
const availableChainsForToken = selectedToken?.chains || [];
|
|
59596
|
+
const renderTokenItem = (tokenData) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
59597
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59598
|
+
"img",
|
|
59599
|
+
{
|
|
59600
|
+
src: tokenData.icon_url,
|
|
59601
|
+
alt: tokenData.symbol,
|
|
59602
|
+
width: 20,
|
|
59603
|
+
height: 20,
|
|
59604
|
+
loading: "lazy",
|
|
59605
|
+
className: "uf-rounded-full uf-flex-shrink-0"
|
|
59606
|
+
}
|
|
59607
|
+
),
|
|
59608
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-normal", children: tokenData.symbol })
|
|
59609
|
+
] });
|
|
59610
|
+
const renderChainItem = (chainData) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
59611
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59612
|
+
"img",
|
|
59613
|
+
{
|
|
59614
|
+
src: chainData.icon_url,
|
|
59615
|
+
alt: chainData.chain_name,
|
|
59616
|
+
width: 20,
|
|
59617
|
+
height: 20,
|
|
59618
|
+
loading: "lazy",
|
|
59619
|
+
className: "uf-rounded-full uf-flex-shrink-0"
|
|
59620
|
+
}
|
|
59621
|
+
),
|
|
59622
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-normal", children: chainData.chain_name })
|
|
59623
|
+
] });
|
|
59624
|
+
const currentChainData = selectedChainKey ? availableChainsForToken.find(
|
|
59625
|
+
(c) => getChainKey4(c.chain_id, c.chain_type) === selectedChainKey
|
|
59626
|
+
) : void 0;
|
|
59627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-grid uf-grid-cols-2 uf-gap-2.5", children: [
|
|
59628
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { children: [
|
|
59629
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59630
|
+
"div",
|
|
59631
|
+
{
|
|
59632
|
+
className: "uf-text-xs uf-mb-2 uf-flex uf-items-center uf-gap-1",
|
|
59633
|
+
style: { color: components.card.labelColor },
|
|
59634
|
+
children: t7.receiveToken
|
|
59635
|
+
}
|
|
59636
|
+
),
|
|
59637
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
59638
|
+
Select2,
|
|
59639
|
+
{
|
|
59640
|
+
value: selectedTokenSymbol ?? "",
|
|
59641
|
+
onValueChange: onTokenChange,
|
|
59642
|
+
disabled: isLoading || tokens.length === 0,
|
|
59643
|
+
children: [
|
|
59644
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59645
|
+
SelectTrigger2,
|
|
59646
|
+
{
|
|
59647
|
+
className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50",
|
|
59648
|
+
style: {
|
|
59649
|
+
backgroundColor: components.card.backgroundColor,
|
|
59650
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
59651
|
+
},
|
|
59652
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SelectValue2, { children: isLoading || !selectedTokenSymbol ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t7.loading }) : selectedToken ? renderTokenItem(selectedToken) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-normal", children: selectedTokenSymbol }) })
|
|
59653
|
+
}
|
|
59654
|
+
),
|
|
59655
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59656
|
+
SelectContent2,
|
|
59657
|
+
{
|
|
59658
|
+
className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px]",
|
|
59659
|
+
style: {
|
|
59660
|
+
border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`,
|
|
59661
|
+
...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
|
|
59662
|
+
},
|
|
59663
|
+
children: tokens.map((tokenData) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59664
|
+
SelectItem2,
|
|
59665
|
+
{
|
|
59666
|
+
value: tokenData.symbol,
|
|
59667
|
+
className: "focus:uf-bg-accent focus:uf-text-foreground",
|
|
59668
|
+
children: renderTokenItem(tokenData)
|
|
59669
|
+
},
|
|
59670
|
+
tokenData.symbol
|
|
59671
|
+
))
|
|
59672
|
+
}
|
|
59673
|
+
)
|
|
59674
|
+
]
|
|
59675
|
+
}
|
|
59676
|
+
)
|
|
59677
|
+
] }),
|
|
59678
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { children: [
|
|
59679
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59680
|
+
"div",
|
|
59681
|
+
{
|
|
59682
|
+
className: "uf-text-xs uf-mb-2 uf-flex uf-items-center uf-gap-1",
|
|
59683
|
+
style: { color: components.card.labelColor },
|
|
59684
|
+
children: t7.receiveChain
|
|
59685
|
+
}
|
|
59686
|
+
),
|
|
59687
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
59688
|
+
Select2,
|
|
59689
|
+
{
|
|
59690
|
+
value: selectedChainKey ?? "",
|
|
59691
|
+
onValueChange: onChainChange,
|
|
59692
|
+
disabled: isLoading || availableChainsForToken.length === 0,
|
|
59693
|
+
children: [
|
|
59694
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59695
|
+
SelectTrigger2,
|
|
59696
|
+
{
|
|
59697
|
+
className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50",
|
|
59698
|
+
style: {
|
|
59699
|
+
backgroundColor: components.card.backgroundColor,
|
|
59700
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
59701
|
+
},
|
|
59702
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SelectValue2, { children: isLoading || !selectedChainKey ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t7.loading }) : currentChainData ? renderChainItem(currentChainData) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-normal", children: selectedChainKey }) })
|
|
59703
|
+
}
|
|
59704
|
+
),
|
|
59705
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59706
|
+
SelectContent2,
|
|
59707
|
+
{
|
|
59708
|
+
align: "end",
|
|
59709
|
+
className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px] uf-min-w-[200px]",
|
|
59710
|
+
style: {
|
|
59711
|
+
border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`,
|
|
59712
|
+
...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
|
|
59713
|
+
},
|
|
59714
|
+
children: availableChainsForToken.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("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) => {
|
|
59715
|
+
const chainKey = getChainKey4(chainData.chain_id, chainData.chain_type);
|
|
59716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59717
|
+
SelectItem2,
|
|
59718
|
+
{
|
|
59719
|
+
value: chainKey,
|
|
59720
|
+
className: "focus:uf-bg-accent focus:uf-text-foreground",
|
|
59721
|
+
children: renderChainItem(chainData)
|
|
59722
|
+
},
|
|
59723
|
+
chainKey
|
|
59724
|
+
);
|
|
59725
|
+
})
|
|
59726
|
+
}
|
|
59727
|
+
)
|
|
59728
|
+
]
|
|
59729
|
+
}
|
|
59730
|
+
)
|
|
59731
|
+
] })
|
|
59732
|
+
] });
|
|
59733
|
+
}
|
|
59734
|
+
function useVerifyRecipientAddress(params) {
|
|
59735
|
+
const {
|
|
59736
|
+
chainType,
|
|
59737
|
+
chainId,
|
|
59738
|
+
tokenAddress,
|
|
59739
|
+
recipientAddress,
|
|
59740
|
+
publishableKey,
|
|
59741
|
+
enabled = true
|
|
59742
|
+
} = params;
|
|
59743
|
+
const trimmedAddress = recipientAddress?.trim() || "";
|
|
59744
|
+
const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
|
|
59745
|
+
return useQuery({
|
|
59746
|
+
queryKey: [
|
|
59747
|
+
"unifold",
|
|
59748
|
+
"verifyRecipientAddress",
|
|
59749
|
+
chainType ?? null,
|
|
59750
|
+
chainId ?? null,
|
|
59751
|
+
tokenAddress ?? null,
|
|
59752
|
+
trimmedAddress,
|
|
59753
|
+
publishableKey
|
|
59754
|
+
],
|
|
59755
|
+
queryFn: () => verifyRecipientAddress(
|
|
59756
|
+
{
|
|
59757
|
+
chain_type: chainType,
|
|
59758
|
+
chain_id: chainId,
|
|
59759
|
+
token_address: tokenAddress,
|
|
59760
|
+
recipient_address: trimmedAddress
|
|
59761
|
+
},
|
|
59762
|
+
publishableKey
|
|
59763
|
+
),
|
|
59764
|
+
enabled: enabled && hasAllParams,
|
|
59765
|
+
staleTime: 1e3 * 60 * 5,
|
|
59766
|
+
gcTime: 1e3 * 60 * 30,
|
|
59767
|
+
retry: 1,
|
|
59768
|
+
refetchOnMount: false,
|
|
59769
|
+
refetchOnWindowFocus: false
|
|
59770
|
+
});
|
|
59771
|
+
}
|
|
59772
|
+
async function sendEvmWithdraw(params) {
|
|
59773
|
+
const {
|
|
59774
|
+
provider,
|
|
59775
|
+
fromAddress,
|
|
59776
|
+
depositWalletAddress,
|
|
59777
|
+
sourceTokenAddress,
|
|
59778
|
+
sourceChainId,
|
|
59779
|
+
amountBaseUnit
|
|
59780
|
+
} = params;
|
|
59781
|
+
const currentChainIdHex = await provider.request({
|
|
59782
|
+
method: "eth_chainId",
|
|
59783
|
+
params: []
|
|
59784
|
+
});
|
|
59785
|
+
const currentChainId = parseInt(currentChainIdHex, 16).toString();
|
|
59786
|
+
if (currentChainId !== sourceChainId) {
|
|
59787
|
+
const requiredHex = "0x" + parseInt(sourceChainId).toString(16);
|
|
59788
|
+
try {
|
|
59789
|
+
await provider.request({
|
|
59790
|
+
method: "wallet_switchEthereumChain",
|
|
59791
|
+
params: [{ chainId: requiredHex }]
|
|
59792
|
+
});
|
|
59793
|
+
const newHex = await provider.request({ method: "eth_chainId", params: [] });
|
|
59794
|
+
if (parseInt(newHex, 16).toString() !== sourceChainId) {
|
|
59795
|
+
throw new Error(`Failed to switch to chain ${sourceChainId}. Please switch manually.`);
|
|
59796
|
+
}
|
|
59797
|
+
} catch (err) {
|
|
59798
|
+
if (err && typeof err === "object" && "code" in err) {
|
|
59799
|
+
const e = err;
|
|
59800
|
+
if (e.code === 4902) throw new Error(`Chain ${sourceChainId} is not configured in your wallet.`);
|
|
59801
|
+
if (e.code === 4001) throw new Error("You must approve the network switch to withdraw.");
|
|
59802
|
+
}
|
|
59803
|
+
throw err;
|
|
59804
|
+
}
|
|
59805
|
+
}
|
|
59806
|
+
const isNative = sourceTokenAddress === "native" || sourceTokenAddress === "0x0000000000000000000000000000000000000000" || sourceTokenAddress === "";
|
|
59807
|
+
const amountBig = BigInt(amountBaseUnit);
|
|
59808
|
+
const txParams = isNative ? { from: fromAddress, to: depositWalletAddress, value: "0x" + amountBig.toString(16) } : {
|
|
59809
|
+
from: fromAddress,
|
|
59810
|
+
to: sourceTokenAddress,
|
|
59811
|
+
data: "0xa9059cbb" + depositWalletAddress.slice(2).padStart(64, "0") + amountBig.toString(16).padStart(64, "0")
|
|
59812
|
+
};
|
|
59813
|
+
let gasEstimate;
|
|
59814
|
+
try {
|
|
59815
|
+
const hex = await provider.request({ method: "eth_estimateGas", params: [txParams] });
|
|
59816
|
+
gasEstimate = BigInt(hex);
|
|
59817
|
+
} catch {
|
|
59818
|
+
gasEstimate = isNative ? BigInt(21e3) : BigInt(65e3);
|
|
59819
|
+
}
|
|
59820
|
+
const gasPrice = BigInt(await provider.request({ method: "eth_gasPrice", params: [] }));
|
|
59821
|
+
const gasWithBuffer = gasEstimate * BigInt(120) / BigInt(100);
|
|
59822
|
+
const gasCost = gasWithBuffer * gasPrice;
|
|
59823
|
+
const ethBalance = BigInt(
|
|
59824
|
+
await provider.request({ method: "eth_getBalance", params: [fromAddress, "latest"] })
|
|
59825
|
+
);
|
|
59826
|
+
const totalRequired = isNative ? gasCost + amountBig : gasCost;
|
|
59827
|
+
if (ethBalance < totalRequired) {
|
|
59828
|
+
const gasFmt = (Number(gasCost) / 1e18).toFixed(6);
|
|
59829
|
+
if (isNative) {
|
|
59830
|
+
throw new Error(`Insufficient balance. Need ${(Number(totalRequired) / 1e18).toFixed(6)} ETH (amount + ~${gasFmt} gas).`);
|
|
59831
|
+
}
|
|
59832
|
+
throw new Error(`Insufficient ETH for gas. Need ~${gasFmt} ETH for fees.`);
|
|
59833
|
+
}
|
|
59834
|
+
const txHash = await provider.request({ method: "eth_sendTransaction", params: [txParams] });
|
|
59835
|
+
return txHash;
|
|
59836
|
+
}
|
|
59837
|
+
async function sendSolanaWithdraw(params) {
|
|
59838
|
+
const {
|
|
59839
|
+
provider,
|
|
59840
|
+
fromAddress,
|
|
59841
|
+
depositWalletAddress,
|
|
59842
|
+
sourceTokenAddress,
|
|
59843
|
+
amountBaseUnit,
|
|
59844
|
+
publishableKey
|
|
59845
|
+
} = params;
|
|
59846
|
+
if (!provider.publicKey) {
|
|
59847
|
+
await provider.connect();
|
|
59848
|
+
}
|
|
59849
|
+
const buildResponse = await buildSolanaTransaction(
|
|
59850
|
+
{
|
|
59851
|
+
chain_id: "mainnet",
|
|
59852
|
+
token_address: sourceTokenAddress === "" ? "native" : sourceTokenAddress,
|
|
59853
|
+
source_address: fromAddress,
|
|
59854
|
+
destination_address: depositWalletAddress,
|
|
59855
|
+
amount: amountBaseUnit
|
|
59856
|
+
},
|
|
59857
|
+
publishableKey
|
|
59858
|
+
);
|
|
59859
|
+
const { VersionedTransaction } = await import(
|
|
59860
|
+
/* @vite-ignore */
|
|
59861
|
+
"@solana/web3.js"
|
|
59862
|
+
);
|
|
59863
|
+
const binaryString = atob(buildResponse.transaction);
|
|
59864
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
59865
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
59866
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
59867
|
+
}
|
|
59868
|
+
const transaction = VersionedTransaction.deserialize(bytes);
|
|
59869
|
+
const signedTransaction = await provider.signTransaction(transaction);
|
|
59870
|
+
const serialized = signedTransaction.serialize();
|
|
59871
|
+
let binaryStr = "";
|
|
59872
|
+
for (let i = 0; i < serialized.length; i++) {
|
|
59873
|
+
binaryStr += String.fromCharCode(serialized[i]);
|
|
59874
|
+
}
|
|
59875
|
+
const sendResponse = await sendSolanaTransaction(
|
|
59876
|
+
{ chain_id: "mainnet", signed_transaction: btoa(binaryStr) },
|
|
59877
|
+
publishableKey
|
|
59878
|
+
);
|
|
59879
|
+
return sendResponse.signature;
|
|
59880
|
+
}
|
|
59881
|
+
async function detectBrowserWallet(chainType, senderAddress) {
|
|
59882
|
+
const win = typeof window !== "undefined" ? window : null;
|
|
59883
|
+
if (!win || !senderAddress) return null;
|
|
59884
|
+
const anyWin = win;
|
|
59885
|
+
if (chainType === "solana") {
|
|
59886
|
+
const solProviders = [];
|
|
59887
|
+
if (win.phantom?.solana) solProviders.push({ provider: win.phantom.solana, name: "Phantom" });
|
|
59888
|
+
if (anyWin.solflare) solProviders.push({ provider: anyWin.solflare, name: "Solflare" });
|
|
59889
|
+
if (anyWin.backpack) solProviders.push({ provider: anyWin.backpack, name: "Backpack" });
|
|
59890
|
+
if (anyWin.trustwallet?.solana) solProviders.push({ provider: anyWin.trustwallet.solana, name: "Trust Wallet" });
|
|
59891
|
+
for (const { provider, name } of solProviders) {
|
|
59892
|
+
if (!provider) continue;
|
|
59893
|
+
try {
|
|
59894
|
+
let addr;
|
|
59895
|
+
if (provider.isConnected && provider.publicKey) {
|
|
59896
|
+
addr = provider.publicKey.toString();
|
|
59897
|
+
} else {
|
|
59898
|
+
const resp = await provider.connect({ onlyIfTrusted: true });
|
|
59899
|
+
if (resp?.publicKey) addr = resp.publicKey.toString();
|
|
59900
|
+
}
|
|
59901
|
+
if (addr && addr === senderAddress) {
|
|
59902
|
+
return { chainFamily: "solana", provider, name, address: addr };
|
|
59903
|
+
}
|
|
59904
|
+
} catch {
|
|
59905
|
+
}
|
|
59906
|
+
}
|
|
59907
|
+
}
|
|
59908
|
+
if (chainType === "ethereum") {
|
|
59909
|
+
const evmProviders = [];
|
|
59910
|
+
const seen = /* @__PURE__ */ new Set();
|
|
59911
|
+
const add = (p, name) => {
|
|
59912
|
+
if (p && typeof p.request === "function" && !seen.has(p)) {
|
|
59913
|
+
seen.add(p);
|
|
59914
|
+
evmProviders.push({ provider: p, name });
|
|
59915
|
+
}
|
|
59916
|
+
};
|
|
59917
|
+
add(anyWin.phantom?.ethereum, "Phantom");
|
|
59918
|
+
add(anyWin.coinbaseWalletExtension, "Coinbase");
|
|
59919
|
+
add(anyWin.trustwallet?.ethereum, "Trust Wallet");
|
|
59920
|
+
add(anyWin.okxwallet, "OKX Wallet");
|
|
59921
|
+
if (anyWin.__eip6963Providers) {
|
|
59922
|
+
for (const detail of anyWin.__eip6963Providers) {
|
|
59923
|
+
const rdns = detail.info?.rdns || "";
|
|
59924
|
+
let name = detail.info?.name || "Wallet";
|
|
59925
|
+
if (rdns.includes("metamask")) name = "MetaMask";
|
|
59926
|
+
else if (rdns.includes("rabby")) name = "Rabby";
|
|
59927
|
+
else if (rdns.includes("rainbow")) name = "Rainbow";
|
|
59928
|
+
add(detail.provider, name);
|
|
59929
|
+
}
|
|
59930
|
+
}
|
|
59931
|
+
if (win.ethereum) {
|
|
59932
|
+
const eth = win.ethereum;
|
|
59933
|
+
let name = "Wallet";
|
|
59934
|
+
if (eth.isMetaMask && !eth.isPhantom && !eth.isRabby) name = "MetaMask";
|
|
59935
|
+
else if (eth.isRabby) name = "Rabby";
|
|
59936
|
+
else if (eth.isRainbow) name = "Rainbow";
|
|
59937
|
+
else if (eth.isCoinbaseWallet) name = "Coinbase";
|
|
59938
|
+
add(eth, name);
|
|
59939
|
+
}
|
|
59940
|
+
for (const { provider, name } of evmProviders) {
|
|
59941
|
+
try {
|
|
59942
|
+
const accounts = await provider.request({ method: "eth_accounts" });
|
|
59943
|
+
if (accounts?.length > 0 && accounts[0].toLowerCase() === senderAddress.toLowerCase()) {
|
|
59944
|
+
return { chainFamily: "evm", provider, name, address: accounts[0] };
|
|
59945
|
+
}
|
|
59946
|
+
} catch {
|
|
59947
|
+
}
|
|
59948
|
+
}
|
|
59949
|
+
}
|
|
59950
|
+
return null;
|
|
59951
|
+
}
|
|
59952
|
+
var t8 = i18n2.withdrawModal;
|
|
59953
|
+
var tCrypto = i18n2.transferCrypto;
|
|
59954
|
+
function formatProcessingTime2(seconds) {
|
|
59955
|
+
if (seconds === null) {
|
|
59956
|
+
return tCrypto.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
|
|
59957
|
+
}
|
|
59958
|
+
const minutes = Math.ceil(seconds / 60);
|
|
59959
|
+
if (minutes < 60) {
|
|
59960
|
+
return tCrypto.processingTime.lessThanMinutes.replace("{{minutes}}", String(minutes));
|
|
59961
|
+
}
|
|
59962
|
+
const hours = Math.ceil(minutes / 60);
|
|
59963
|
+
return tCrypto.processingTime.lessThanHours.replace("{{hours}}", String(hours));
|
|
59964
|
+
}
|
|
59965
|
+
function computeBaseUnit(balanceBaseUnit, inputAmount, balanceAmount) {
|
|
59966
|
+
if (balanceAmount <= 0 || inputAmount <= 0) return "0";
|
|
59967
|
+
if (inputAmount >= balanceAmount) return balanceBaseUnit;
|
|
59968
|
+
const PRECISION = 10n ** 18n;
|
|
59969
|
+
const ratioScaled = BigInt(Math.round(inputAmount / balanceAmount * Number(PRECISION)));
|
|
59970
|
+
const result = BigInt(balanceBaseUnit) * ratioScaled / PRECISION;
|
|
59971
|
+
return result.toString();
|
|
59972
|
+
}
|
|
59973
|
+
function toSafeDecimalString(n, maxDecimals) {
|
|
59974
|
+
if (n === 0) return "0";
|
|
59975
|
+
return n.toFixed(maxDecimals).replace(/\.?0+$/, "");
|
|
59976
|
+
}
|
|
59977
|
+
function WithdrawForm({
|
|
59978
|
+
publishableKey,
|
|
59979
|
+
externalUserId,
|
|
59980
|
+
sourceChainType,
|
|
59981
|
+
selectedToken,
|
|
59982
|
+
selectedChain,
|
|
59983
|
+
sourceTokenSymbol,
|
|
59984
|
+
recipientAddressProp,
|
|
59985
|
+
balanceData,
|
|
59986
|
+
isLoadingBalance,
|
|
59987
|
+
minimumWithdrawAmountUsd,
|
|
59988
|
+
estimatedProcessingTime,
|
|
59989
|
+
maxSlippagePercent,
|
|
59990
|
+
priceImpactPercent,
|
|
59991
|
+
detectedWallet,
|
|
59992
|
+
sourceChainId,
|
|
59993
|
+
sourceTokenAddress,
|
|
59994
|
+
isWalletMatch,
|
|
59995
|
+
connectedWalletName,
|
|
59996
|
+
canWithdraw,
|
|
59997
|
+
onWithdraw,
|
|
59998
|
+
onWithdrawError,
|
|
59999
|
+
onDepositWalletCreation,
|
|
60000
|
+
onWithdrawSubmitted,
|
|
60001
|
+
footerLeft
|
|
60002
|
+
}) {
|
|
60003
|
+
const { colors: colors2, fonts, components } = useTheme();
|
|
60004
|
+
const [recipientAddress, setRecipientAddress] = (0, import_react29.useState)(recipientAddressProp || "");
|
|
60005
|
+
const [amount, setAmount] = (0, import_react29.useState)("");
|
|
60006
|
+
const [inputUnit, setInputUnit] = (0, import_react29.useState)("crypto");
|
|
60007
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react29.useState)(false);
|
|
60008
|
+
const [submitError, setSubmitError] = (0, import_react29.useState)(null);
|
|
60009
|
+
const [detailsExpanded, setDetailsExpanded] = (0, import_react29.useState)(false);
|
|
60010
|
+
const [glossaryOpen, setGlossaryOpen] = (0, import_react29.useState)(false);
|
|
60011
|
+
(0, import_react29.useEffect)(() => {
|
|
60012
|
+
setRecipientAddress(recipientAddressProp || "");
|
|
60013
|
+
setAmount("");
|
|
60014
|
+
setInputUnit("crypto");
|
|
60015
|
+
setSubmitError(null);
|
|
60016
|
+
}, [recipientAddressProp]);
|
|
60017
|
+
const trimmedAddress = recipientAddress.trim();
|
|
60018
|
+
const [debouncedAddress, setDebouncedAddress] = (0, import_react29.useState)(trimmedAddress);
|
|
60019
|
+
(0, import_react29.useEffect)(() => {
|
|
60020
|
+
const id = setTimeout(() => setDebouncedAddress(trimmedAddress), 500);
|
|
60021
|
+
return () => clearTimeout(id);
|
|
60022
|
+
}, [trimmedAddress]);
|
|
60023
|
+
const {
|
|
60024
|
+
data: addressVerification,
|
|
60025
|
+
isLoading: isVerifyingAddress,
|
|
60026
|
+
error: verifyError
|
|
60027
|
+
} = useVerifyRecipientAddress({
|
|
60028
|
+
chainType: selectedChain?.chain_type,
|
|
60029
|
+
chainId: selectedChain?.chain_id,
|
|
60030
|
+
tokenAddress: selectedChain?.token_address,
|
|
60031
|
+
recipientAddress: debouncedAddress,
|
|
60032
|
+
publishableKey,
|
|
60033
|
+
enabled: debouncedAddress.length > 5 && !!selectedChain
|
|
60034
|
+
});
|
|
60035
|
+
const isDebouncing = trimmedAddress !== debouncedAddress;
|
|
60036
|
+
const addressError = (0, import_react29.useMemo)(() => {
|
|
60037
|
+
if (!trimmedAddress || trimmedAddress.length <= 5) return null;
|
|
60038
|
+
if (isDebouncing || isVerifyingAddress) return null;
|
|
60039
|
+
if (verifyError) return t8.invalidAddress;
|
|
60040
|
+
if (addressVerification && !addressVerification.valid) {
|
|
60041
|
+
if (addressVerification.failure_code === "account_not_found")
|
|
60042
|
+
return `Account not found on ${selectedChain?.chain_name}`;
|
|
60043
|
+
if (addressVerification.failure_code === "not_opted_in")
|
|
60044
|
+
return `Recipient has not opted in to ${selectedToken?.symbol} on ${selectedChain?.chain_name}`;
|
|
60045
|
+
return t8.invalidAddress;
|
|
60046
|
+
}
|
|
60047
|
+
return null;
|
|
60048
|
+
}, [trimmedAddress, isDebouncing, isVerifyingAddress, verifyError, addressVerification, selectedChain, selectedToken]);
|
|
60049
|
+
const isAddressValid = !isDebouncing && !!addressVerification?.valid && !addressError;
|
|
60050
|
+
const exchangeRate = (0, import_react29.useMemo)(() => {
|
|
60051
|
+
if (!balanceData?.exchangeRate) return 0;
|
|
60052
|
+
return parseFloat(balanceData.exchangeRate);
|
|
60053
|
+
}, [balanceData]);
|
|
60054
|
+
const balanceCrypto = (0, import_react29.useMemo)(() => {
|
|
60055
|
+
if (!balanceData?.balanceHuman) return 0;
|
|
60056
|
+
return parseFloat(balanceData.balanceHuman);
|
|
60057
|
+
}, [balanceData]);
|
|
60058
|
+
const balanceUsdNum = (0, import_react29.useMemo)(() => {
|
|
60059
|
+
if (!balanceData?.balanceUsd) return 0;
|
|
60060
|
+
return parseFloat(balanceData.balanceUsd);
|
|
60061
|
+
}, [balanceData]);
|
|
60062
|
+
const tokenSymbol = sourceTokenSymbol || balanceData?.symbol || "TOKEN";
|
|
60063
|
+
const sourceDecimals = balanceData?.decimals ?? 6;
|
|
60064
|
+
const cryptoAmountFromInput = (0, import_react29.useMemo)(() => {
|
|
60065
|
+
const val = parseFloat(amount);
|
|
60066
|
+
if (!val || val <= 0) return 0;
|
|
60067
|
+
if (inputUnit === "crypto") return val;
|
|
60068
|
+
return exchangeRate > 0 ? val / exchangeRate : 0;
|
|
60069
|
+
}, [amount, inputUnit, exchangeRate]);
|
|
60070
|
+
const fiatAmountFromInput = (0, import_react29.useMemo)(() => {
|
|
60071
|
+
const val = parseFloat(amount);
|
|
60072
|
+
if (!val || val <= 0) return 0;
|
|
60073
|
+
if (inputUnit === "fiat") return val;
|
|
60074
|
+
return val * exchangeRate;
|
|
60075
|
+
}, [amount, inputUnit, exchangeRate]);
|
|
60076
|
+
const convertedDisplay = (0, import_react29.useMemo)(() => {
|
|
60077
|
+
if (!amount || parseFloat(amount) <= 0) return null;
|
|
60078
|
+
if (inputUnit === "crypto") {
|
|
60079
|
+
return `$${fiatAmountFromInput.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
60080
|
+
}
|
|
60081
|
+
return `${cryptoAmountFromInput.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 6 })} ${tokenSymbol}`;
|
|
60082
|
+
}, [amount, inputUnit, fiatAmountFromInput, cryptoAmountFromInput, tokenSymbol]);
|
|
60083
|
+
const balanceDisplay = (0, import_react29.useMemo)(() => {
|
|
60084
|
+
if (isLoadingBalance || !balanceData) return null;
|
|
60085
|
+
if (inputUnit === "crypto") {
|
|
60086
|
+
return `${balanceCrypto.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${tokenSymbol}`;
|
|
60087
|
+
}
|
|
60088
|
+
return `$${balanceUsdNum.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
60089
|
+
}, [isLoadingBalance, balanceData, inputUnit, balanceCrypto, balanceUsdNum, tokenSymbol]);
|
|
60090
|
+
const handleSwitchUnit = (0, import_react29.useCallback)(() => {
|
|
60091
|
+
const val = parseFloat(amount);
|
|
60092
|
+
if (!val || val <= 0 || exchangeRate <= 0) {
|
|
60093
|
+
setInputUnit((u) => u === "crypto" ? "fiat" : "crypto");
|
|
60094
|
+
setAmount("");
|
|
60095
|
+
return;
|
|
60096
|
+
}
|
|
60097
|
+
if (inputUnit === "crypto") {
|
|
60098
|
+
const fiat = val * exchangeRate;
|
|
60099
|
+
setAmount(fiat.toFixed(2));
|
|
60100
|
+
setInputUnit("fiat");
|
|
60101
|
+
} else {
|
|
60102
|
+
const crypto = val / exchangeRate;
|
|
60103
|
+
setAmount(crypto.toFixed(sourceDecimals > 6 ? 6 : sourceDecimals));
|
|
60104
|
+
setInputUnit("crypto");
|
|
60105
|
+
}
|
|
60106
|
+
}, [amount, inputUnit, exchangeRate, sourceDecimals]);
|
|
60107
|
+
const handleMaxClick = (0, import_react29.useCallback)(() => {
|
|
60108
|
+
if (inputUnit === "crypto") {
|
|
60109
|
+
if (balanceCrypto <= 0) return;
|
|
60110
|
+
setAmount(balanceData?.balanceHuman ?? "0");
|
|
60111
|
+
} else {
|
|
60112
|
+
if (balanceUsdNum <= 0) return;
|
|
60113
|
+
setAmount((Math.floor(balanceUsdNum * 100) / 100).toFixed(2));
|
|
60114
|
+
}
|
|
60115
|
+
}, [inputUnit, balanceCrypto, balanceUsdNum, balanceData]);
|
|
60116
|
+
const isBelowMinimum = minimumWithdrawAmountUsd !== null && fiatAmountFromInput > 0 && fiatAmountFromInput < minimumWithdrawAmountUsd;
|
|
60117
|
+
const isOverBalance = inputUnit === "crypto" ? cryptoAmountFromInput > 0 && balanceCrypto > 0 && cryptoAmountFromInput > balanceCrypto : fiatAmountFromInput > 0 && balanceUsdNum > 0 && fiatAmountFromInput > balanceUsdNum;
|
|
60118
|
+
const isFormValid = trimmedAddress.length > 0 && amount.trim().length > 0 && cryptoAmountFromInput > 0 && isAddressValid && !isBelowMinimum && !isOverBalance && !!balanceData;
|
|
60119
|
+
const handleWithdraw = (0, import_react29.useCallback)(async () => {
|
|
60120
|
+
if (!selectedToken || !selectedChain) return;
|
|
60121
|
+
if (!isFormValid) return;
|
|
60122
|
+
setIsSubmitting(true);
|
|
60123
|
+
setSubmitError(null);
|
|
60124
|
+
try {
|
|
60125
|
+
const depositWallet = await onDepositWalletCreation({
|
|
60126
|
+
destinationChainType: selectedChain.chain_type,
|
|
60127
|
+
destinationChainId: selectedChain.chain_id,
|
|
60128
|
+
destinationTokenAddress: selectedChain.token_address,
|
|
60129
|
+
recipientAddress: trimmedAddress
|
|
60130
|
+
});
|
|
60131
|
+
const amountBaseUnit = computeBaseUnit(
|
|
60132
|
+
balanceData.balanceBaseUnit,
|
|
60133
|
+
parseFloat(amount),
|
|
60134
|
+
inputUnit === "crypto" ? balanceCrypto : balanceUsdNum
|
|
60135
|
+
);
|
|
60136
|
+
const humanAmount = toSafeDecimalString(cryptoAmountFromInput, sourceDecimals);
|
|
60137
|
+
const txInfo = {
|
|
60138
|
+
sourceChainType,
|
|
60139
|
+
sourceChainId,
|
|
60140
|
+
sourceTokenAddress,
|
|
60141
|
+
sourceTokenSymbol: tokenSymbol,
|
|
60142
|
+
destinationChainType: selectedChain.chain_type,
|
|
60143
|
+
destinationChainId: selectedChain.chain_id,
|
|
60144
|
+
destinationTokenAddress: selectedChain.token_address,
|
|
60145
|
+
destinationTokenSymbol: selectedToken.symbol,
|
|
60146
|
+
amount: humanAmount,
|
|
60147
|
+
amountBaseUnit,
|
|
60148
|
+
withdrawIntentAddress: depositWallet.address,
|
|
60149
|
+
recipientAddress: trimmedAddress
|
|
60150
|
+
};
|
|
60151
|
+
if (detectedWallet) {
|
|
60152
|
+
if (detectedWallet.chainFamily === "evm") {
|
|
60153
|
+
await sendEvmWithdraw({
|
|
60154
|
+
provider: detectedWallet.provider,
|
|
60155
|
+
fromAddress: detectedWallet.address,
|
|
60156
|
+
depositWalletAddress: depositWallet.address,
|
|
60157
|
+
sourceTokenAddress,
|
|
60158
|
+
sourceChainId,
|
|
60159
|
+
amountBaseUnit
|
|
60160
|
+
});
|
|
60161
|
+
} else if (detectedWallet.chainFamily === "solana") {
|
|
60162
|
+
await sendSolanaWithdraw({
|
|
60163
|
+
provider: detectedWallet.provider,
|
|
60164
|
+
fromAddress: detectedWallet.address,
|
|
60165
|
+
depositWalletAddress: depositWallet.address,
|
|
60166
|
+
sourceTokenAddress,
|
|
60167
|
+
amountBaseUnit,
|
|
60168
|
+
publishableKey
|
|
60169
|
+
});
|
|
60170
|
+
}
|
|
60171
|
+
} else if (onWithdraw) {
|
|
60172
|
+
await onWithdraw(txInfo);
|
|
60173
|
+
} else {
|
|
60174
|
+
throw new Error("No withdrawal method available. Please connect a wallet.");
|
|
60175
|
+
}
|
|
60176
|
+
onWithdrawSubmitted?.(txInfo);
|
|
60177
|
+
} catch (err) {
|
|
60178
|
+
const raw = err instanceof Error ? err.message : "Withdrawal failed. Please try again.";
|
|
60179
|
+
setSubmitError(raw.length > 120 ? "Withdrawal failed. Please try again." : raw);
|
|
60180
|
+
onWithdrawError?.({
|
|
60181
|
+
message: raw,
|
|
60182
|
+
error: err,
|
|
60183
|
+
code: "WITHDRAW_FAILED"
|
|
60184
|
+
});
|
|
60185
|
+
} finally {
|
|
60186
|
+
setIsSubmitting(false);
|
|
60187
|
+
}
|
|
60188
|
+
}, [selectedToken, selectedChain, isFormValid, cryptoAmountFromInput, sourceDecimals, trimmedAddress, publishableKey, onWithdraw, detectedWallet, sourceTokenAddress, sourceChainId, onWithdrawError, onDepositWalletCreation, onWithdrawSubmitted, amount, inputUnit, balanceCrypto, balanceUsdNum, balanceData]);
|
|
60189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
60190
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
|
|
60191
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60192
|
+
"div",
|
|
60193
|
+
{
|
|
60194
|
+
className: "uf-text-xs uf-mb-1.5",
|
|
60195
|
+
style: { color: components.card.labelColor, fontFamily: fonts.medium },
|
|
60196
|
+
children: t8.recipientAddress
|
|
60197
|
+
}
|
|
60198
|
+
),
|
|
60199
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60200
|
+
"style",
|
|
60201
|
+
{
|
|
60202
|
+
dangerouslySetInnerHTML: {
|
|
60203
|
+
__html: `.uf-withdraw-addr::placeholder { color: ${components.search.placeholderColor}; }`
|
|
60204
|
+
}
|
|
60205
|
+
}
|
|
60206
|
+
),
|
|
60207
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
60208
|
+
"div",
|
|
60209
|
+
{
|
|
60210
|
+
className: "uf-flex uf-items-center uf-gap-1 uf-pr-2",
|
|
60211
|
+
style: {
|
|
60212
|
+
backgroundColor: components.search.backgroundColor,
|
|
60213
|
+
borderRadius: components.input.borderRadius,
|
|
60214
|
+
border: `${components.input.borderWidth}px solid ${addressError ? colors2.error : components.input.borderColor}`
|
|
60215
|
+
},
|
|
60216
|
+
children: [
|
|
60217
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60218
|
+
"input",
|
|
60219
|
+
{
|
|
60220
|
+
type: "text",
|
|
60221
|
+
placeholder: t8.recipientAddressPlaceholder,
|
|
60222
|
+
value: recipientAddress,
|
|
60223
|
+
onChange: (e) => {
|
|
60224
|
+
setRecipientAddress(e.target.value);
|
|
60225
|
+
setSubmitError(null);
|
|
60226
|
+
},
|
|
60227
|
+
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",
|
|
60228
|
+
style: {
|
|
60229
|
+
color: components.search.inputColor,
|
|
60230
|
+
fontFamily: fonts.regular
|
|
60231
|
+
}
|
|
60232
|
+
}
|
|
60233
|
+
),
|
|
60234
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60235
|
+
"button",
|
|
60236
|
+
{
|
|
60237
|
+
type: "button",
|
|
60238
|
+
onClick: async () => {
|
|
60239
|
+
try {
|
|
60240
|
+
const text = await navigator.clipboard.readText();
|
|
60241
|
+
if (text) {
|
|
60242
|
+
setRecipientAddress(text.trim());
|
|
60243
|
+
setSubmitError(null);
|
|
60244
|
+
}
|
|
60245
|
+
} catch {
|
|
60246
|
+
}
|
|
60247
|
+
},
|
|
60248
|
+
className: "uf-flex-shrink-0 uf-p-1 uf-rounded uf-transition-colors hover:uf-opacity-70",
|
|
60249
|
+
style: { color: colors2.foregroundMuted },
|
|
60250
|
+
title: "Paste from clipboard",
|
|
60251
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ClipboardPaste, { className: "uf-w-4 uf-h-4" })
|
|
60252
|
+
}
|
|
60253
|
+
)
|
|
60254
|
+
]
|
|
60255
|
+
}
|
|
60256
|
+
),
|
|
60257
|
+
(isDebouncing || isVerifyingAddress) && trimmedAddress.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-1.5", children: [
|
|
60258
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LoaderCircle, { className: "uf-w-3 uf-h-3 uf-animate-spin", style: { color: colors2.foregroundMuted } }),
|
|
60259
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: t8.verifyingAddress })
|
|
60260
|
+
] }),
|
|
60261
|
+
addressError && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-1.5", children: [
|
|
60262
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(TriangleAlert, { className: "uf-w-3 uf-h-3", style: { color: colors2.error } }),
|
|
60263
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "uf-text-xs", style: { color: colors2.error, fontFamily: fonts.regular }, children: addressError })
|
|
60264
|
+
] })
|
|
60265
|
+
] }),
|
|
60266
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
|
|
60267
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-text-xs uf-mb-1.5", style: { color: components.card.labelColor, fontFamily: fonts.medium }, children: [
|
|
60268
|
+
t8.amount,
|
|
60269
|
+
minimumWithdrawAmountUsd != null && minimumWithdrawAmountUsd > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { style: { color: colors2.warning, fontFamily: fonts.regular }, children: ` ($${minimumWithdrawAmountUsd.toFixed(2)} min)` })
|
|
60270
|
+
] }),
|
|
60271
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60272
|
+
"style",
|
|
60273
|
+
{
|
|
60274
|
+
dangerouslySetInnerHTML: {
|
|
60275
|
+
__html: `.uf-withdraw-amt::placeholder { color: ${components.search.placeholderColor}; }`
|
|
60276
|
+
}
|
|
60277
|
+
}
|
|
60278
|
+
),
|
|
60279
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
60280
|
+
"div",
|
|
60281
|
+
{
|
|
60282
|
+
className: "uf-flex uf-items-center uf-gap-2 uf-px-3 uf-py-2.5",
|
|
60283
|
+
style: {
|
|
60284
|
+
backgroundColor: components.search.backgroundColor,
|
|
60285
|
+
borderRadius: components.input.borderRadius,
|
|
60286
|
+
border: `${components.input.borderWidth}px solid ${components.input.borderColor}`
|
|
60287
|
+
},
|
|
60288
|
+
children: [
|
|
60289
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60290
|
+
"input",
|
|
60291
|
+
{
|
|
60292
|
+
type: "text",
|
|
60293
|
+
inputMode: "decimal",
|
|
60294
|
+
placeholder: "0.00",
|
|
60295
|
+
value: amount,
|
|
60296
|
+
onChange: (e) => {
|
|
60297
|
+
const val = e.target.value;
|
|
60298
|
+
if (val === "" || /^\d*\.?\d*$/.test(val)) {
|
|
60299
|
+
setAmount(val);
|
|
60300
|
+
setSubmitError(null);
|
|
60301
|
+
}
|
|
60302
|
+
},
|
|
60303
|
+
className: "uf-withdraw-amt uf-flex-1 uf-min-w-0 uf-bg-transparent uf-text-sm uf-outline-none",
|
|
60304
|
+
style: {
|
|
60305
|
+
color: components.search.inputColor,
|
|
60306
|
+
fontFamily: fonts.regular
|
|
60307
|
+
}
|
|
60308
|
+
}
|
|
60309
|
+
),
|
|
60310
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "uf-text-sm uf-shrink-0", style: { color: colors2.foregroundMuted, fontFamily: fonts.medium }, children: inputUnit === "crypto" ? tokenSymbol : "USD" }),
|
|
60311
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60312
|
+
"button",
|
|
60313
|
+
{
|
|
60314
|
+
type: "button",
|
|
60315
|
+
onClick: handleMaxClick,
|
|
60316
|
+
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",
|
|
60317
|
+
style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium },
|
|
60318
|
+
children: "Max"
|
|
60319
|
+
}
|
|
60320
|
+
)
|
|
60321
|
+
]
|
|
60322
|
+
}
|
|
60323
|
+
),
|
|
60324
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between uf-mt-1.5 uf-px-3", children: [
|
|
60325
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
|
|
60326
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: convertedDisplay || (inputUnit === "crypto" ? "$0.00" : `0.00 ${tokenSymbol}`) }),
|
|
60327
|
+
exchangeRate > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60328
|
+
"button",
|
|
60329
|
+
{
|
|
60330
|
+
type: "button",
|
|
60331
|
+
onClick: handleSwitchUnit,
|
|
60332
|
+
className: "uf-p-0.5 uf-rounded uf-transition-colors hover:uf-opacity-70",
|
|
60333
|
+
style: { color: colors2.foregroundMuted },
|
|
60334
|
+
title: "Switch unit",
|
|
60335
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ArrowUpDown, { className: "uf-w-3 uf-h-3" })
|
|
60336
|
+
}
|
|
60337
|
+
)
|
|
60338
|
+
] }),
|
|
60339
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
|
|
60340
|
+
balanceDisplay && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: [
|
|
60341
|
+
t8.balance,
|
|
60342
|
+
": ",
|
|
60343
|
+
balanceDisplay
|
|
60344
|
+
] }),
|
|
60345
|
+
isLoadingBalance && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-h-3 uf-w-16 uf-bg-muted uf-rounded uf-animate-pulse" })
|
|
60346
|
+
] })
|
|
60347
|
+
] })
|
|
60348
|
+
] }),
|
|
60349
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("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: [
|
|
60350
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
60351
|
+
"button",
|
|
60352
|
+
{
|
|
60353
|
+
type: "button",
|
|
60354
|
+
onClick: () => setDetailsExpanded(!detailsExpanded),
|
|
60355
|
+
className: "uf-w-full uf-flex uf-items-center uf-justify-between uf-py-2.5",
|
|
60356
|
+
children: [
|
|
60357
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
60358
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-rounded-full uf-p-1", style: { backgroundColor: components.card.iconBackgroundColor }, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Clock, { className: "uf-w-3 uf-h-3", style: { color: components.card.iconColor } }) }),
|
|
60359
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
|
|
60360
|
+
tCrypto.processingTime.label,
|
|
60361
|
+
":",
|
|
60362
|
+
" ",
|
|
60363
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime2(estimatedProcessingTime) })
|
|
60364
|
+
] })
|
|
60365
|
+
] }),
|
|
60366
|
+
detailsExpanded ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChevronUp, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChevronDown, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } })
|
|
60367
|
+
]
|
|
60368
|
+
}
|
|
60369
|
+
),
|
|
60370
|
+
detailsExpanded && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-pb-3 uf-space-y-2.5", children: [
|
|
60371
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
60372
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-rounded-full uf-p-1", style: { backgroundColor: components.card.iconBackgroundColor }, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ShieldCheck, { className: "uf-w-3 uf-h-3", style: { color: components.card.iconColor } }) }),
|
|
60373
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
|
|
60374
|
+
tCrypto.slippage.label,
|
|
60375
|
+
":",
|
|
60376
|
+
" ",
|
|
60377
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: [
|
|
60378
|
+
tCrypto.slippage.auto,
|
|
60379
|
+
" \u2022 ",
|
|
60380
|
+
(maxSlippagePercent ?? 0.25).toFixed(2),
|
|
60381
|
+
"%"
|
|
60382
|
+
] })
|
|
60383
|
+
] })
|
|
60384
|
+
] }),
|
|
60385
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
60386
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-rounded-full uf-p-1", style: { backgroundColor: components.card.iconBackgroundColor }, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DollarSign, { className: "uf-w-3 uf-h-3", style: { color: components.card.iconColor } }) }),
|
|
60387
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
|
|
60388
|
+
tCrypto.priceImpact.label,
|
|
60389
|
+
":",
|
|
60390
|
+
" ",
|
|
60391
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: [
|
|
60392
|
+
(priceImpactPercent ?? 0).toFixed(2),
|
|
60393
|
+
"%"
|
|
60394
|
+
] })
|
|
60395
|
+
] })
|
|
60396
|
+
] })
|
|
60397
|
+
] })
|
|
60398
|
+
] }),
|
|
60399
|
+
!canWithdraw && !submitError && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
60400
|
+
"div",
|
|
60401
|
+
{
|
|
60402
|
+
className: "uf-flex uf-items-start uf-gap-2.5 uf-p-3 uf-rounded-xl",
|
|
60403
|
+
style: { backgroundColor: colors2.card, border: `1px solid ${colors2.border}` },
|
|
60404
|
+
children: [
|
|
60405
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Wallet, { className: "uf-w-4 uf-h-4 uf-flex-shrink-0 uf-mt-0.5", style: { color: colors2.warning } }),
|
|
60406
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("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." })
|
|
60407
|
+
]
|
|
60408
|
+
}
|
|
60409
|
+
),
|
|
60410
|
+
isWalletMatch && connectedWalletName ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60411
|
+
"button",
|
|
60412
|
+
{
|
|
60413
|
+
type: "button",
|
|
60414
|
+
onClick: handleWithdraw,
|
|
60415
|
+
disabled: !isFormValid || !canWithdraw || isSubmitting || !selectedToken || !selectedChain,
|
|
60416
|
+
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",
|
|
60417
|
+
style: {
|
|
60418
|
+
backgroundColor: colors2.primary,
|
|
60419
|
+
color: colors2.primaryForeground,
|
|
60420
|
+
fontFamily: fonts.medium,
|
|
60421
|
+
borderRadius: components.button.borderRadius,
|
|
60422
|
+
border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
|
|
60423
|
+
},
|
|
60424
|
+
children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
60425
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }),
|
|
60426
|
+
"Processing..."
|
|
60427
|
+
] }) : isOverBalance ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_jsx_runtime72.Fragment, { children: "Insufficient balance" }) : isBelowMinimum ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_jsx_runtime72.Fragment, { children: "Minimum amount not met" }) : submitError ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_jsx_runtime72.Fragment, { children: "Withdrawal failed. Try again" }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
60428
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Wallet, { className: "uf-w-4 uf-h-4" }),
|
|
60429
|
+
"Withdraw from ",
|
|
60430
|
+
connectedWalletName
|
|
60431
|
+
] })
|
|
60432
|
+
}
|
|
60433
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60434
|
+
"button",
|
|
60435
|
+
{
|
|
60436
|
+
type: "button",
|
|
60437
|
+
onClick: handleWithdraw,
|
|
60438
|
+
disabled: !isFormValid || !canWithdraw || isSubmitting || !selectedToken || !selectedChain,
|
|
60439
|
+
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",
|
|
60440
|
+
style: {
|
|
60441
|
+
backgroundColor: colors2.primary,
|
|
60442
|
+
color: colors2.primaryForeground,
|
|
60443
|
+
fontFamily: fonts.medium,
|
|
60444
|
+
borderRadius: components.button.borderRadius,
|
|
60445
|
+
border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
|
|
60446
|
+
},
|
|
60447
|
+
children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-flex uf-items-center uf-justify-center uf-gap-2", children: [
|
|
60448
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }),
|
|
60449
|
+
"Processing..."
|
|
60450
|
+
] }) : isOverBalance ? "Insufficient balance" : isBelowMinimum ? "Minimum amount not met" : submitError ? "Withdrawal failed. Try again" : t8.withdraw
|
|
60451
|
+
}
|
|
60452
|
+
),
|
|
60453
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between uf-text-xs uf-pt-1", children: [
|
|
60454
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { children: footerLeft }),
|
|
60455
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DepositFooterLinks, { onGlossaryClick: () => setGlossaryOpen(true) })
|
|
60456
|
+
] }),
|
|
60457
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60458
|
+
GlossaryModal,
|
|
60459
|
+
{
|
|
60460
|
+
open: glossaryOpen,
|
|
60461
|
+
onOpenChange: setGlossaryOpen
|
|
60462
|
+
}
|
|
60463
|
+
)
|
|
60464
|
+
] });
|
|
60465
|
+
}
|
|
60466
|
+
function WithdrawExecutionItem({
|
|
60467
|
+
execution,
|
|
60468
|
+
onClick
|
|
60469
|
+
}) {
|
|
60470
|
+
const { colors: colors2, fonts, components } = useTheme();
|
|
60471
|
+
const isPending = execution.status === ExecutionStatus.PENDING || execution.status === ExecutionStatus.WAITING || execution.status === ExecutionStatus.DELAYED;
|
|
60472
|
+
const formatDateTime = (timestamp) => {
|
|
60473
|
+
try {
|
|
60474
|
+
const date = new Date(timestamp);
|
|
60475
|
+
const monthDay = date.toLocaleDateString("en-US", {
|
|
60476
|
+
month: "short",
|
|
60477
|
+
day: "numeric",
|
|
60478
|
+
year: "numeric"
|
|
60479
|
+
});
|
|
60480
|
+
const time = date.toLocaleTimeString("en-US", {
|
|
60481
|
+
hour: "numeric",
|
|
60482
|
+
minute: "2-digit",
|
|
60483
|
+
hour12: true
|
|
60484
|
+
}).toLowerCase();
|
|
60485
|
+
return `${monthDay} at ${time}`;
|
|
60486
|
+
} catch {
|
|
60487
|
+
return timestamp;
|
|
60488
|
+
}
|
|
60489
|
+
};
|
|
60490
|
+
const formatUsdAmount2 = (sourceAmountUsd) => {
|
|
60491
|
+
try {
|
|
60492
|
+
const amount = Number(sourceAmountUsd);
|
|
60493
|
+
return new Intl.NumberFormat("en-US", {
|
|
60494
|
+
style: "currency",
|
|
60495
|
+
currency: "USD",
|
|
60496
|
+
minimumFractionDigits: 2,
|
|
60497
|
+
maximumFractionDigits: 2
|
|
60498
|
+
}).format(amount);
|
|
60499
|
+
} catch {
|
|
60500
|
+
return "$0.00";
|
|
60501
|
+
}
|
|
60502
|
+
};
|
|
60503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
60504
|
+
"button",
|
|
60505
|
+
{
|
|
60506
|
+
onClick,
|
|
60507
|
+
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",
|
|
60508
|
+
style: {
|
|
60509
|
+
backgroundColor: components.card.backgroundColor,
|
|
60510
|
+
borderRadius: components.list.rowBorderRadius,
|
|
60511
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
60512
|
+
},
|
|
60513
|
+
children: [
|
|
60514
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-relative uf-flex-shrink-0 uf-w-9 uf-h-9", children: [
|
|
60515
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60516
|
+
"img",
|
|
60517
|
+
{
|
|
60518
|
+
src: execution.destination_token_metadata?.icon_url || getIconUrl("/icons/tokens/svg/usdc.svg"),
|
|
60519
|
+
alt: "Token",
|
|
60520
|
+
width: 36,
|
|
60521
|
+
height: 36,
|
|
60522
|
+
loading: "lazy",
|
|
60523
|
+
className: "uf-rounded-full uf-w-9 uf-h-9"
|
|
60524
|
+
}
|
|
60525
|
+
),
|
|
60526
|
+
isPending ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60527
|
+
"div",
|
|
60528
|
+
{
|
|
60529
|
+
className: "uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-rounded-full uf-p-0.5",
|
|
60530
|
+
style: { backgroundColor: colors2.warning },
|
|
60531
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60532
|
+
"svg",
|
|
60533
|
+
{
|
|
60534
|
+
width: "10",
|
|
60535
|
+
height: "10",
|
|
60536
|
+
viewBox: "0 0 12 12",
|
|
60537
|
+
fill: "none",
|
|
60538
|
+
className: "uf-animate-spin uf-block",
|
|
60539
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60540
|
+
"path",
|
|
60541
|
+
{
|
|
60542
|
+
d: "M6 1V3M6 9V11M1 6H3M9 6H11M2.5 2.5L4 4M8 8L9.5 9.5M2.5 9.5L4 8M8 4L9.5 2.5",
|
|
60543
|
+
stroke: "white",
|
|
60544
|
+
strokeWidth: "2",
|
|
60545
|
+
strokeLinecap: "round"
|
|
60546
|
+
}
|
|
60547
|
+
)
|
|
60548
|
+
}
|
|
60549
|
+
)
|
|
60550
|
+
}
|
|
60551
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60552
|
+
"div",
|
|
60553
|
+
{
|
|
60554
|
+
className: "uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-rounded-full uf-p-0.5",
|
|
60555
|
+
style: { backgroundColor: colors2.success },
|
|
60556
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60557
|
+
"svg",
|
|
60558
|
+
{
|
|
60559
|
+
width: "10",
|
|
60560
|
+
height: "10",
|
|
60561
|
+
viewBox: "0 0 12 12",
|
|
60562
|
+
fill: "none",
|
|
60563
|
+
className: "uf-block",
|
|
60564
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60565
|
+
"path",
|
|
60566
|
+
{
|
|
60567
|
+
d: "M10 3L4.5 8.5L2 6",
|
|
60568
|
+
stroke: "white",
|
|
60569
|
+
strokeWidth: "2",
|
|
60570
|
+
strokeLinecap: "round",
|
|
60571
|
+
strokeLinejoin: "round"
|
|
60572
|
+
}
|
|
60573
|
+
)
|
|
60574
|
+
}
|
|
60575
|
+
)
|
|
60576
|
+
}
|
|
60577
|
+
)
|
|
60578
|
+
] }),
|
|
60579
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex-1 uf-min-w-0", children: [
|
|
60580
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60581
|
+
"h3",
|
|
60582
|
+
{
|
|
60583
|
+
className: "uf-font-medium uf-text-sm uf-leading-tight",
|
|
60584
|
+
style: {
|
|
60585
|
+
color: components.card.titleColor,
|
|
60586
|
+
fontFamily: fonts.medium
|
|
60587
|
+
},
|
|
60588
|
+
children: isPending ? "Withdrawal processing" : "Withdrawal completed"
|
|
60589
|
+
}
|
|
60590
|
+
),
|
|
60591
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60592
|
+
"p",
|
|
60593
|
+
{
|
|
60594
|
+
className: "uf-text-xs uf-leading-tight",
|
|
60595
|
+
style: {
|
|
60596
|
+
color: components.card.subtitleColor,
|
|
60597
|
+
fontFamily: fonts.regular
|
|
60598
|
+
},
|
|
60599
|
+
children: formatDateTime(execution.created_at || (/* @__PURE__ */ new Date()).toISOString())
|
|
60600
|
+
}
|
|
60601
|
+
)
|
|
60602
|
+
] }),
|
|
60603
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60604
|
+
"span",
|
|
60605
|
+
{
|
|
60606
|
+
className: "uf-font-medium uf-text-sm uf-flex-shrink-0",
|
|
60607
|
+
style: {
|
|
60608
|
+
color: components.card.textRightColor,
|
|
60609
|
+
fontFamily: fonts.medium
|
|
60610
|
+
},
|
|
60611
|
+
children: formatUsdAmount2(execution.source_amount_usd || "0")
|
|
60612
|
+
}
|
|
60613
|
+
),
|
|
60614
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60615
|
+
ChevronRight,
|
|
60616
|
+
{
|
|
60617
|
+
className: "uf-w-4 uf-h-4 uf-flex-shrink-0",
|
|
60618
|
+
style: { color: components.card.actionColor }
|
|
60619
|
+
}
|
|
60620
|
+
)
|
|
60621
|
+
]
|
|
60622
|
+
}
|
|
60623
|
+
);
|
|
60624
|
+
}
|
|
60625
|
+
function truncateAddress4(addr) {
|
|
60626
|
+
if (addr.length <= 12) return addr;
|
|
60627
|
+
return `${addr.slice(0, 6)}...${addr.slice(-4)}`;
|
|
60628
|
+
}
|
|
60629
|
+
var SHOW_BUTTON_DELAY_MS = 5e3;
|
|
60630
|
+
function WithdrawConfirmingView({
|
|
60631
|
+
txInfo,
|
|
60632
|
+
executions,
|
|
60633
|
+
onClose,
|
|
60634
|
+
onViewTracker
|
|
60635
|
+
}) {
|
|
60636
|
+
const { colors: colors2, fonts, components } = useTheme();
|
|
60637
|
+
const [showButton, setShowButton] = (0, import_react30.useState)(false);
|
|
60638
|
+
const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
|
|
60639
|
+
(0, import_react30.useEffect)(() => {
|
|
60640
|
+
if (latestExecution) return;
|
|
60641
|
+
const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
|
|
60642
|
+
return () => clearTimeout(timer);
|
|
60643
|
+
}, [latestExecution]);
|
|
60644
|
+
const btnRadius = components.button.borderRadius;
|
|
60645
|
+
const btnBorder = `${components.button.borderWidth}px solid ${components.button.borderColor}`;
|
|
60646
|
+
if (latestExecution) {
|
|
60647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
60648
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositHeader, { title: "Withdrawal Details", showClose: true, onClose }),
|
|
60649
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositDetailContent, { execution: latestExecution, variant: "withdraw" }),
|
|
60650
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-gap-2 uf-px-2 uf-pt-2", children: [
|
|
60651
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60652
|
+
"button",
|
|
60653
|
+
{
|
|
60654
|
+
type: "button",
|
|
60655
|
+
onClick: onViewTracker,
|
|
60656
|
+
className: "uf-flex-1 uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
|
|
60657
|
+
style: {
|
|
60658
|
+
backgroundColor: components.button.secondaryBackground,
|
|
60659
|
+
color: components.button.secondaryText,
|
|
60660
|
+
fontFamily: fonts.medium,
|
|
60661
|
+
borderRadius: btnRadius,
|
|
60662
|
+
border: btnBorder
|
|
60663
|
+
},
|
|
60664
|
+
children: "Withdrawal History"
|
|
60665
|
+
}
|
|
60666
|
+
),
|
|
60667
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60668
|
+
"button",
|
|
60669
|
+
{
|
|
60670
|
+
type: "button",
|
|
60671
|
+
onClick: onClose,
|
|
60672
|
+
className: "uf-flex-1 uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
|
|
60673
|
+
style: {
|
|
60674
|
+
backgroundColor: components.button.primaryBackground,
|
|
60675
|
+
color: components.button.primaryText,
|
|
60676
|
+
fontFamily: fonts.medium,
|
|
60677
|
+
borderRadius: btnRadius,
|
|
60678
|
+
border: btnBorder
|
|
60679
|
+
},
|
|
60680
|
+
children: "Close"
|
|
60681
|
+
}
|
|
60682
|
+
)
|
|
60683
|
+
] }),
|
|
60684
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60685
|
+
PoweredByUnifold,
|
|
60686
|
+
{
|
|
60687
|
+
color: colors2.foregroundMuted,
|
|
60688
|
+
className: "uf-flex uf-justify-center uf-shrink-0"
|
|
60689
|
+
}
|
|
60690
|
+
) })
|
|
60691
|
+
] });
|
|
60692
|
+
}
|
|
60693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
60694
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositHeader, { title: "Withdrawal Status", showClose: true, onClose }),
|
|
60695
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-16 uf-px-4", children: [
|
|
60696
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60697
|
+
"div",
|
|
60698
|
+
{
|
|
60699
|
+
className: "uf-w-20 uf-h-20 uf-rounded-full uf-flex uf-items-center uf-justify-center uf-mb-6",
|
|
60700
|
+
style: { backgroundColor: `${colors2.primary}20` },
|
|
60701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60702
|
+
"svg",
|
|
60703
|
+
{
|
|
60704
|
+
width: "40",
|
|
60705
|
+
height: "40",
|
|
60706
|
+
viewBox: "0 0 24 24",
|
|
60707
|
+
fill: "none",
|
|
60708
|
+
className: "uf-animate-spin",
|
|
60709
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60710
|
+
"path",
|
|
60711
|
+
{
|
|
60712
|
+
d: "M21 12a9 9 0 1 1-6.22-8.56",
|
|
60713
|
+
stroke: colors2.primary,
|
|
60714
|
+
strokeWidth: "2.5",
|
|
60715
|
+
strokeLinecap: "round"
|
|
60716
|
+
}
|
|
60717
|
+
)
|
|
60718
|
+
}
|
|
60719
|
+
)
|
|
60720
|
+
}
|
|
60721
|
+
),
|
|
60722
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60723
|
+
"h3",
|
|
60724
|
+
{
|
|
60725
|
+
className: "uf-text-xl uf-mb-2",
|
|
60726
|
+
style: { color: colors2.foreground, fontFamily: fonts.medium },
|
|
60727
|
+
children: "Checking Withdrawal"
|
|
60728
|
+
}
|
|
60729
|
+
),
|
|
60730
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
60731
|
+
"p",
|
|
60732
|
+
{
|
|
60733
|
+
className: "uf-text-sm uf-text-center",
|
|
60734
|
+
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
60735
|
+
children: [
|
|
60736
|
+
txInfo.amount,
|
|
60737
|
+
" ",
|
|
60738
|
+
txInfo.sourceTokenSymbol,
|
|
60739
|
+
" to",
|
|
60740
|
+
" ",
|
|
60741
|
+
truncateAddress4(txInfo.recipientAddress)
|
|
60742
|
+
]
|
|
60743
|
+
}
|
|
60744
|
+
)
|
|
60745
|
+
] }),
|
|
60746
|
+
showButton && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-px-1 uf-pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60747
|
+
"button",
|
|
60748
|
+
{
|
|
60749
|
+
type: "button",
|
|
60750
|
+
onClick: onViewTracker,
|
|
60751
|
+
className: "uf-w-full uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
|
|
60752
|
+
style: {
|
|
60753
|
+
backgroundColor: components.button.secondaryBackground,
|
|
60754
|
+
color: components.button.secondaryText,
|
|
60755
|
+
fontFamily: fonts.medium,
|
|
60756
|
+
borderRadius: btnRadius,
|
|
60757
|
+
border: btnBorder
|
|
60758
|
+
},
|
|
60759
|
+
children: "Withdrawal History"
|
|
60760
|
+
}
|
|
60761
|
+
) }),
|
|
60762
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60763
|
+
PoweredByUnifold,
|
|
60764
|
+
{
|
|
60765
|
+
color: colors2.foregroundMuted,
|
|
60766
|
+
className: "uf-flex uf-justify-center uf-shrink-0"
|
|
60767
|
+
}
|
|
60768
|
+
) })
|
|
60769
|
+
] });
|
|
60770
|
+
}
|
|
60771
|
+
var t9 = i18n2.withdrawModal;
|
|
60772
|
+
var getChainKey5 = (chainId, chainType) => `${chainType}:${chainId}`;
|
|
60773
|
+
function WithdrawModal({
|
|
60774
|
+
open,
|
|
60775
|
+
onOpenChange,
|
|
60776
|
+
publishableKey,
|
|
60777
|
+
modalTitle,
|
|
60778
|
+
externalUserId,
|
|
60779
|
+
sourceChainType,
|
|
60780
|
+
sourceChainId,
|
|
60781
|
+
sourceTokenAddress,
|
|
60782
|
+
sourceTokenSymbol,
|
|
60783
|
+
recipientAddress: recipientAddressProp,
|
|
60784
|
+
senderAddress,
|
|
60785
|
+
onWithdraw,
|
|
60786
|
+
onWithdrawSuccess,
|
|
60787
|
+
onWithdrawError,
|
|
60788
|
+
theme = "dark",
|
|
60789
|
+
hideOverlay = false
|
|
60790
|
+
}) {
|
|
60791
|
+
const { colors: colors2, fonts, components } = useTheme();
|
|
60792
|
+
const [containerEl, setContainerEl] = (0, import_react27.useState)(null);
|
|
60793
|
+
const containerCallbackRef = (0, import_react27.useCallback)((el) => {
|
|
60794
|
+
setContainerEl(el);
|
|
60795
|
+
}, []);
|
|
60796
|
+
const [resolvedTheme, setResolvedTheme] = (0, import_react27.useState)(
|
|
60797
|
+
theme === "auto" ? "dark" : theme
|
|
60798
|
+
);
|
|
60799
|
+
(0, import_react27.useEffect)(() => {
|
|
60800
|
+
if (theme === "auto") {
|
|
60801
|
+
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
60802
|
+
setResolvedTheme(mq.matches ? "dark" : "light");
|
|
60803
|
+
const h = (e) => setResolvedTheme(e.matches ? "dark" : "light");
|
|
60804
|
+
mq.addEventListener("change", h);
|
|
60805
|
+
return () => mq.removeEventListener("change", h);
|
|
60806
|
+
}
|
|
60807
|
+
setResolvedTheme(theme);
|
|
60808
|
+
}, [theme]);
|
|
60809
|
+
const themeClass = resolvedTheme === "dark" ? "uf-dark" : "";
|
|
60810
|
+
const { data: tokensResponse, isLoading: tokensLoading } = useSupportedDestinationTokens(publishableKey, open);
|
|
60811
|
+
const destinationTokens = tokensResponse?.data ?? [];
|
|
60812
|
+
const { data: sourceValidation, isLoading: isCheckingSourceToken } = useSourceTokenValidation({
|
|
60813
|
+
sourceChainType,
|
|
60814
|
+
sourceChainId,
|
|
60815
|
+
sourceTokenAddress,
|
|
60816
|
+
sourceTokenSymbol,
|
|
60817
|
+
publishableKey,
|
|
60818
|
+
enabled: open
|
|
60819
|
+
});
|
|
60820
|
+
const { data: balanceData, isLoading: isLoadingBalance } = useAddressBalance({
|
|
60821
|
+
address: senderAddress,
|
|
60822
|
+
chainType: sourceChainType,
|
|
60823
|
+
chainId: sourceChainId,
|
|
60824
|
+
tokenAddress: sourceTokenAddress,
|
|
60825
|
+
publishableKey,
|
|
60826
|
+
enabled: open
|
|
60827
|
+
});
|
|
60828
|
+
const [selectedToken, setSelectedToken] = (0, import_react27.useState)(null);
|
|
60829
|
+
const [selectedChain, setSelectedChain] = (0, import_react27.useState)(null);
|
|
60830
|
+
const [detectedWallet, setDetectedWallet] = (0, import_react27.useState)(null);
|
|
60831
|
+
const connectedWalletName = detectedWallet?.name ?? null;
|
|
60832
|
+
const isWalletMatch = !!detectedWallet;
|
|
60833
|
+
(0, import_react27.useEffect)(() => {
|
|
60834
|
+
if (!senderAddress || !open) {
|
|
60835
|
+
setDetectedWallet(null);
|
|
60836
|
+
return;
|
|
60837
|
+
}
|
|
60838
|
+
let cancelled = false;
|
|
60839
|
+
detectBrowserWallet(sourceChainType, senderAddress).then((wallet) => {
|
|
60840
|
+
if (!cancelled) setDetectedWallet(wallet);
|
|
60841
|
+
});
|
|
60842
|
+
return () => {
|
|
60843
|
+
cancelled = true;
|
|
60844
|
+
};
|
|
60845
|
+
}, [senderAddress, sourceChainType, open]);
|
|
60846
|
+
const [view, setView] = (0, import_react27.useState)("form");
|
|
60847
|
+
const [withdrawDepositWalletId, setWithdrawDepositWalletId] = (0, import_react27.useState)();
|
|
60848
|
+
const [selectedExecution, setSelectedExecution] = (0, import_react27.useState)(null);
|
|
60849
|
+
const [submittedTxInfo, setSubmittedTxInfo] = (0, import_react27.useState)(null);
|
|
60850
|
+
const { executions: realtimeExecutions } = useWithdrawPolling({
|
|
60851
|
+
userId: externalUserId,
|
|
60852
|
+
publishableKey,
|
|
60853
|
+
depositWalletId: withdrawDepositWalletId,
|
|
60854
|
+
enabled: !!withdrawDepositWalletId && open,
|
|
60855
|
+
onWithdrawSuccess: onWithdrawSuccess ? (d) => onWithdrawSuccess({ message: d.message, transaction: d.transaction }) : void 0,
|
|
60856
|
+
onWithdrawError
|
|
60857
|
+
});
|
|
60858
|
+
const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
|
|
60859
|
+
actionType: ActionType.Withdraw,
|
|
60860
|
+
enabled: open,
|
|
60861
|
+
refetchInterval: view === "tracker" || view === "detail" ? 5e3 : 15e3
|
|
60862
|
+
});
|
|
60863
|
+
const allWithdrawals = allWithdrawalsData?.data ?? [];
|
|
60864
|
+
const handleDepositWalletCreation = (0, import_react27.useCallback)(async (params) => {
|
|
60865
|
+
const { data: wallets } = await createDepositAddress(
|
|
60866
|
+
{
|
|
60867
|
+
external_user_id: externalUserId,
|
|
60868
|
+
destination_chain_type: params.destinationChainType,
|
|
60869
|
+
destination_chain_id: params.destinationChainId,
|
|
60870
|
+
destination_token_address: params.destinationTokenAddress,
|
|
60871
|
+
recipient_address: params.recipientAddress,
|
|
60872
|
+
action_type: ActionType.Withdraw
|
|
60873
|
+
},
|
|
60874
|
+
publishableKey
|
|
60875
|
+
);
|
|
60876
|
+
const depositWallet = getWalletByChainType(wallets, sourceChainType);
|
|
60877
|
+
if (!depositWallet) {
|
|
60878
|
+
throw new Error(`No deposit wallet available for ${sourceChainType}`);
|
|
60879
|
+
}
|
|
60880
|
+
setWithdrawDepositWalletId(depositWallet.id);
|
|
60881
|
+
return depositWallet;
|
|
60882
|
+
}, [externalUserId, publishableKey, sourceChainType]);
|
|
60883
|
+
const handleWithdrawSubmitted = (0, import_react27.useCallback)((txInfo) => {
|
|
60884
|
+
setSubmittedTxInfo(txInfo);
|
|
60885
|
+
setView("confirming");
|
|
60886
|
+
}, []);
|
|
60887
|
+
(0, import_react27.useEffect)(() => {
|
|
60888
|
+
if (!destinationTokens.length || selectedToken) return;
|
|
60889
|
+
const first = destinationTokens[0];
|
|
60890
|
+
if (first?.chains.length > 0) {
|
|
60891
|
+
setSelectedToken(first);
|
|
60892
|
+
setSelectedChain(first.chains[0]);
|
|
60893
|
+
}
|
|
60894
|
+
}, [destinationTokens, selectedToken]);
|
|
60895
|
+
const resetViewTimeoutRef = (0, import_react27.useRef)(null);
|
|
60896
|
+
const handleClose = (0, import_react27.useCallback)(() => {
|
|
60897
|
+
onOpenChange(false);
|
|
60898
|
+
if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
|
|
60899
|
+
resetViewTimeoutRef.current = setTimeout(() => {
|
|
60900
|
+
setSelectedToken(null);
|
|
60901
|
+
setSelectedChain(null);
|
|
60902
|
+
setView("form");
|
|
60903
|
+
setSelectedExecution(null);
|
|
60904
|
+
setSubmittedTxInfo(null);
|
|
60905
|
+
setWithdrawDepositWalletId(void 0);
|
|
60906
|
+
resetViewTimeoutRef.current = null;
|
|
60907
|
+
}, 200);
|
|
60908
|
+
}, [onOpenChange]);
|
|
60909
|
+
(0, import_react27.useLayoutEffect)(() => {
|
|
60910
|
+
if (!open) return;
|
|
60911
|
+
if (resetViewTimeoutRef.current) {
|
|
60912
|
+
clearTimeout(resetViewTimeoutRef.current);
|
|
60913
|
+
resetViewTimeoutRef.current = null;
|
|
60914
|
+
}
|
|
60915
|
+
setSelectedToken(null);
|
|
60916
|
+
setSelectedChain(null);
|
|
60917
|
+
setView("form");
|
|
60918
|
+
setSelectedExecution(null);
|
|
60919
|
+
setSubmittedTxInfo(null);
|
|
60920
|
+
setWithdrawDepositWalletId(void 0);
|
|
60921
|
+
}, [open]);
|
|
60922
|
+
(0, import_react27.useEffect)(() => () => {
|
|
60923
|
+
if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
|
|
60924
|
+
}, []);
|
|
60925
|
+
const handleTokenSymbolChange = (0, import_react27.useCallback)((symbol) => {
|
|
60926
|
+
const tok = destinationTokens.find((t11) => t11.symbol === symbol);
|
|
60927
|
+
if (tok) {
|
|
60928
|
+
setSelectedToken(tok);
|
|
60929
|
+
if (tok.chains.length > 0) setSelectedChain(tok.chains[0]);
|
|
60930
|
+
}
|
|
60931
|
+
}, [destinationTokens]);
|
|
60932
|
+
const handleChainKeyChange = (0, import_react27.useCallback)((chainKey) => {
|
|
60933
|
+
if (!selectedToken) return;
|
|
60934
|
+
const chain = selectedToken.chains.find((c) => getChainKey5(c.chain_id, c.chain_type) === chainKey);
|
|
60935
|
+
if (chain) setSelectedChain(chain);
|
|
60936
|
+
}, [selectedToken]);
|
|
60937
|
+
const isSourceSupported = sourceValidation?.isSupported ?? null;
|
|
60938
|
+
const canWithdraw = !!onWithdraw || isWalletMatch;
|
|
60939
|
+
const isAnyLoading = tokensLoading || isCheckingSourceToken;
|
|
60940
|
+
const withdrawPoweredByFooter = /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "uf-pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(PoweredByUnifold, { color: colors2.foregroundMuted, className: "uf-flex uf-justify-center uf-shrink-0" }) });
|
|
60941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(PortalContainerProvider, { value: hideOverlay ? containerEl : null, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Dialog2, { open: hideOverlay || open, onOpenChange: hideOverlay ? void 0 : handleClose, modal: !hideOverlay, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
60942
|
+
DialogContent2,
|
|
60943
|
+
{
|
|
60944
|
+
ref: hideOverlay ? containerCallbackRef : void 0,
|
|
60945
|
+
hideOverlay,
|
|
60946
|
+
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}`}`,
|
|
60947
|
+
style: { backgroundColor: colors2.background },
|
|
60948
|
+
onPointerDownOutside: (e) => e.preventDefault(),
|
|
60949
|
+
onInteractOutside: (e) => e.preventDefault(),
|
|
60950
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ThemeStyleInjector, { children: view === "confirming" && submittedTxInfo ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
60951
|
+
WithdrawConfirmingView,
|
|
60952
|
+
{
|
|
60953
|
+
txInfo: submittedTxInfo,
|
|
60954
|
+
executions: realtimeExecutions,
|
|
60955
|
+
onClose: handleClose,
|
|
60956
|
+
onViewTracker: () => setView("tracker")
|
|
60957
|
+
}
|
|
60958
|
+
) : view === "detail" && selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
60959
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositHeader, { title: "Withdrawal Details", showBack: true, showClose: !hideOverlay, onBack: () => {
|
|
60960
|
+
setSelectedExecution(null);
|
|
60961
|
+
setView("tracker");
|
|
60962
|
+
}, onClose: handleClose }),
|
|
60963
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositDetailContent, { execution: selectedExecution, variant: "withdraw" }),
|
|
60964
|
+
withdrawPoweredByFooter
|
|
60965
|
+
] }) : view === "tracker" ? (
|
|
60966
|
+
/* ---------- Tracker view: execution list ---------- */
|
|
60967
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
60968
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositHeader, { title: "Withdrawal History", showBack: true, showClose: !hideOverlay, onBack: () => setView("form"), onClose: handleClose }),
|
|
60969
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "uf-flex uf-flex-col uf-gap-2", style: { minHeight: 200 }, children: allWithdrawals.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "uf-flex uf-items-center uf-justify-center uf-py-8", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { className: "uf-text-sm", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: "No withdrawals to track yet" }) }) : allWithdrawals.map((ex) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
60970
|
+
WithdrawExecutionItem,
|
|
60971
|
+
{
|
|
60972
|
+
execution: ex,
|
|
60973
|
+
onClick: () => {
|
|
60974
|
+
setSelectedExecution(ex);
|
|
60975
|
+
setView("detail");
|
|
60976
|
+
}
|
|
60977
|
+
},
|
|
60978
|
+
ex.id
|
|
60979
|
+
)) }),
|
|
60980
|
+
withdrawPoweredByFooter
|
|
60981
|
+
] })
|
|
60982
|
+
) : (
|
|
60983
|
+
/* ---------- Form view (default) ---------- */
|
|
60984
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
60985
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositHeader, { title: modalTitle || t9.title, showClose: !hideOverlay, onClose: handleClose }),
|
|
60986
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-3", children: [
|
|
60987
|
+
isAnyLoading ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "uf-space-y-3", children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "uf-w-full uf-bg-secondary uf-rounded-xl uf-p-3 uf-flex uf-items-center uf-animate-pulse", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "uf-bg-muted uf-rounded-lg uf-w-full uf-h-10" }) }, i)) }) : isSourceSupported === false ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
|
|
60988
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("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__ */ (0, import_jsx_runtime75.jsx)(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
|
|
60989
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("h3", { className: "uf-text-lg uf-font-semibold uf-mb-2", style: { color: colors2.foreground, fontFamily: fonts.medium }, children: "Unsupported Source Token" }),
|
|
60990
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { className: "uf-text-sm uf-max-w-[280px]", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: sourceValidation?.errorMessage })
|
|
60991
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
60992
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
60993
|
+
WithdrawDoubleInput,
|
|
60994
|
+
{
|
|
60995
|
+
tokens: destinationTokens,
|
|
60996
|
+
selectedTokenSymbol: selectedToken?.symbol ?? null,
|
|
60997
|
+
selectedChainKey: selectedChain ? getChainKey5(selectedChain.chain_id, selectedChain.chain_type) : null,
|
|
60998
|
+
onTokenChange: handleTokenSymbolChange,
|
|
60999
|
+
onChainChange: handleChainKeyChange,
|
|
61000
|
+
isLoading: tokensLoading
|
|
61001
|
+
}
|
|
61002
|
+
),
|
|
61003
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
61004
|
+
WithdrawForm,
|
|
61005
|
+
{
|
|
61006
|
+
publishableKey,
|
|
61007
|
+
externalUserId,
|
|
61008
|
+
sourceChainType,
|
|
61009
|
+
selectedToken,
|
|
61010
|
+
selectedChain,
|
|
61011
|
+
sourceTokenSymbol,
|
|
61012
|
+
recipientAddressProp,
|
|
61013
|
+
balanceData: balanceData ?? null,
|
|
61014
|
+
isLoadingBalance,
|
|
61015
|
+
minimumWithdrawAmountUsd: sourceValidation?.minimumAmountUsd ?? null,
|
|
61016
|
+
estimatedProcessingTime: sourceValidation?.estimatedProcessingTime ?? null,
|
|
61017
|
+
maxSlippagePercent: sourceValidation?.maxSlippagePercent ?? null,
|
|
61018
|
+
priceImpactPercent: sourceValidation?.priceImpactPercent ?? null,
|
|
61019
|
+
detectedWallet,
|
|
61020
|
+
sourceChainId,
|
|
61021
|
+
sourceTokenAddress,
|
|
61022
|
+
isWalletMatch,
|
|
61023
|
+
connectedWalletName,
|
|
61024
|
+
canWithdraw,
|
|
61025
|
+
onWithdraw,
|
|
61026
|
+
onWithdrawError,
|
|
61027
|
+
onDepositWalletCreation: handleDepositWalletCreation,
|
|
61028
|
+
onWithdrawSubmitted: handleWithdrawSubmitted,
|
|
61029
|
+
footerLeft: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
61030
|
+
"button",
|
|
61031
|
+
{
|
|
61032
|
+
onClick: () => setView("tracker"),
|
|
61033
|
+
className: "uf-flex uf-items-center uf-gap-1 uf-transition-colors hover:uf-opacity-70",
|
|
61034
|
+
style: { color: colors2.foregroundMuted },
|
|
61035
|
+
children: [
|
|
61036
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Clock, { className: "uf-w-3.5 uf-h-3.5" }),
|
|
61037
|
+
"Withdrawal History",
|
|
61038
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ChevronRight, { className: "uf-w-3 uf-h-3" })
|
|
61039
|
+
]
|
|
61040
|
+
}
|
|
61041
|
+
)
|
|
61042
|
+
}
|
|
61043
|
+
)
|
|
61044
|
+
] }),
|
|
61045
|
+
withdrawPoweredByFooter
|
|
61046
|
+
] })
|
|
61047
|
+
] })
|
|
61048
|
+
) })
|
|
61049
|
+
}
|
|
61050
|
+
) }) });
|
|
61051
|
+
}
|
|
61052
|
+
var t10 = i18n2.withdrawModal;
|
|
61053
|
+
function UnifoldProvider2({
|
|
61054
|
+
children,
|
|
61055
|
+
publishableKey,
|
|
61056
|
+
config
|
|
61057
|
+
}) {
|
|
61058
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
61059
|
+
const [depositConfig, setDepositConfig] = (0, import_react.useState)(
|
|
61060
|
+
null
|
|
61061
|
+
);
|
|
61062
|
+
const [isWithdrawOpen, setIsWithdrawOpen] = (0, import_react.useState)(false);
|
|
61063
|
+
const [withdrawConfig, setWithdrawConfig] = (0, import_react.useState)(
|
|
61064
|
+
null
|
|
61065
|
+
);
|
|
61066
|
+
const [resolvedTheme, setResolvedTheme] = import_react.default.useState("dark");
|
|
61067
|
+
(0, import_react.useEffect)(() => {
|
|
61068
|
+
if (publishableKey) {
|
|
61069
|
+
setApiConfig({ publishableKey });
|
|
61070
|
+
}
|
|
61071
|
+
}, [publishableKey]);
|
|
61072
|
+
import_react.default.useEffect(() => {
|
|
61073
|
+
const appearance = config?.appearance || "dark";
|
|
61074
|
+
if (appearance === "auto") {
|
|
61075
|
+
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
61076
|
+
setResolvedTheme(prefersDark ? "dark" : "light");
|
|
61077
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
61078
|
+
const handler = (e) => {
|
|
61079
|
+
setResolvedTheme(e.matches ? "dark" : "light");
|
|
61080
|
+
};
|
|
61081
|
+
mediaQuery.addEventListener("change", handler);
|
|
61082
|
+
return () => mediaQuery.removeEventListener("change", handler);
|
|
61083
|
+
} else {
|
|
61084
|
+
setResolvedTheme(appearance);
|
|
61085
|
+
}
|
|
61086
|
+
}, [config?.appearance]);
|
|
61087
|
+
const depositPromiseRef = import_react.default.useRef(null);
|
|
61088
|
+
const depositConfigRef = import_react.default.useRef(null);
|
|
61089
|
+
depositConfigRef.current = depositConfig;
|
|
61090
|
+
const closeTimeoutRef = import_react.default.useRef(null);
|
|
61091
|
+
const closeGuardRef = import_react.default.useRef(false);
|
|
61092
|
+
const withdrawPromiseRef = import_react.default.useRef(null);
|
|
61093
|
+
const withdrawConfigRef = import_react.default.useRef(null);
|
|
61094
|
+
withdrawConfigRef.current = withdrawConfig;
|
|
61095
|
+
const withdrawCloseTimeoutRef = import_react.default.useRef(null);
|
|
61096
|
+
const withdrawCloseGuardRef = import_react.default.useRef(false);
|
|
61097
|
+
const beginDeposit = (0, import_react.useCallback)((config2) => {
|
|
61098
|
+
if (closeTimeoutRef.current) {
|
|
61099
|
+
clearTimeout(closeTimeoutRef.current);
|
|
61100
|
+
closeTimeoutRef.current = null;
|
|
61101
|
+
}
|
|
61102
|
+
closeGuardRef.current = false;
|
|
61103
|
+
if (depositPromiseRef.current) {
|
|
61104
|
+
console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit.");
|
|
61105
|
+
depositPromiseRef.current.reject({
|
|
61106
|
+
message: "Deposit cancelled - new deposit started",
|
|
61107
|
+
code: "DEPOSIT_SUPERSEDED"
|
|
61108
|
+
});
|
|
61109
|
+
depositPromiseRef.current = null;
|
|
61110
|
+
}
|
|
61111
|
+
const promise = new Promise((resolve, reject) => {
|
|
61112
|
+
depositPromiseRef.current = { resolve, reject };
|
|
61113
|
+
});
|
|
61114
|
+
promise.catch(() => {
|
|
61115
|
+
});
|
|
61116
|
+
setDepositConfig(config2);
|
|
61117
|
+
setIsOpen(true);
|
|
61118
|
+
return promise;
|
|
61119
|
+
}, []);
|
|
61120
|
+
const closeDeposit = (0, import_react.useCallback)(() => {
|
|
61121
|
+
if (closeGuardRef.current) {
|
|
61122
|
+
return;
|
|
61123
|
+
}
|
|
61124
|
+
closeGuardRef.current = true;
|
|
61125
|
+
const promiseToReject = depositPromiseRef.current;
|
|
61126
|
+
depositPromiseRef.current = null;
|
|
61127
|
+
if (depositConfigRef.current?.onClose) {
|
|
61128
|
+
depositConfigRef.current.onClose();
|
|
61129
|
+
}
|
|
61130
|
+
if (promiseToReject) {
|
|
61131
|
+
promiseToReject.reject({
|
|
61132
|
+
message: "Deposit cancelled by user",
|
|
61133
|
+
code: "DEPOSIT_CANCELLED"
|
|
61134
|
+
});
|
|
61135
|
+
}
|
|
61136
|
+
setIsOpen(false);
|
|
61137
|
+
closeTimeoutRef.current = setTimeout(() => {
|
|
61138
|
+
setDepositConfig(null);
|
|
59291
61139
|
closeTimeoutRef.current = null;
|
|
59292
61140
|
}, 200);
|
|
59293
61141
|
}, []);
|
|
@@ -59310,16 +61158,84 @@ function UnifoldProvider2({
|
|
|
59310
61158
|
depositPromiseRef.current = null;
|
|
59311
61159
|
}
|
|
59312
61160
|
}, [depositConfig]);
|
|
61161
|
+
const beginWithdraw = (0, import_react.useCallback)((config2) => {
|
|
61162
|
+
if (withdrawCloseTimeoutRef.current) {
|
|
61163
|
+
clearTimeout(withdrawCloseTimeoutRef.current);
|
|
61164
|
+
withdrawCloseTimeoutRef.current = null;
|
|
61165
|
+
}
|
|
61166
|
+
withdrawCloseGuardRef.current = false;
|
|
61167
|
+
if (withdrawPromiseRef.current) {
|
|
61168
|
+
console.warn("[UnifoldProvider] A withdraw is already in progress. Cancelling previous withdraw.");
|
|
61169
|
+
withdrawPromiseRef.current.reject({
|
|
61170
|
+
message: "Withdraw cancelled - new withdraw started",
|
|
61171
|
+
code: "WITHDRAW_SUPERSEDED"
|
|
61172
|
+
});
|
|
61173
|
+
withdrawPromiseRef.current = null;
|
|
61174
|
+
}
|
|
61175
|
+
const promise = new Promise((resolve, reject) => {
|
|
61176
|
+
withdrawPromiseRef.current = { resolve, reject };
|
|
61177
|
+
});
|
|
61178
|
+
promise.catch(() => {
|
|
61179
|
+
});
|
|
61180
|
+
setWithdrawConfig(config2);
|
|
61181
|
+
setIsWithdrawOpen(true);
|
|
61182
|
+
return promise;
|
|
61183
|
+
}, []);
|
|
61184
|
+
const closeWithdraw = (0, import_react.useCallback)(() => {
|
|
61185
|
+
if (withdrawCloseGuardRef.current) {
|
|
61186
|
+
return;
|
|
61187
|
+
}
|
|
61188
|
+
withdrawCloseGuardRef.current = true;
|
|
61189
|
+
const promiseToReject = withdrawPromiseRef.current;
|
|
61190
|
+
withdrawPromiseRef.current = null;
|
|
61191
|
+
if (withdrawConfigRef.current?.onClose) {
|
|
61192
|
+
withdrawConfigRef.current.onClose();
|
|
61193
|
+
}
|
|
61194
|
+
if (promiseToReject) {
|
|
61195
|
+
promiseToReject.reject({
|
|
61196
|
+
message: "Withdraw cancelled by user",
|
|
61197
|
+
code: "WITHDRAW_CANCELLED"
|
|
61198
|
+
});
|
|
61199
|
+
}
|
|
61200
|
+
setIsWithdrawOpen(false);
|
|
61201
|
+
withdrawCloseTimeoutRef.current = setTimeout(() => {
|
|
61202
|
+
setWithdrawConfig(null);
|
|
61203
|
+
withdrawCloseTimeoutRef.current = null;
|
|
61204
|
+
}, 200);
|
|
61205
|
+
}, []);
|
|
61206
|
+
const handleWithdrawSuccess = (0, import_react.useCallback)((data) => {
|
|
61207
|
+
if (withdrawConfigRef.current?.onSuccess) {
|
|
61208
|
+
withdrawConfigRef.current.onSuccess(data);
|
|
61209
|
+
}
|
|
61210
|
+
if (withdrawPromiseRef.current) {
|
|
61211
|
+
withdrawPromiseRef.current.resolve(data);
|
|
61212
|
+
withdrawPromiseRef.current = null;
|
|
61213
|
+
}
|
|
61214
|
+
}, []);
|
|
61215
|
+
const handleWithdrawError = (0, import_react.useCallback)((error) => {
|
|
61216
|
+
console.error("[UnifoldProvider] Withdraw error:", error);
|
|
61217
|
+
if (withdrawConfigRef.current?.onError) {
|
|
61218
|
+
withdrawConfigRef.current.onError(error);
|
|
61219
|
+
}
|
|
61220
|
+
if (withdrawPromiseRef.current) {
|
|
61221
|
+
withdrawPromiseRef.current.reject(error);
|
|
61222
|
+
withdrawPromiseRef.current = null;
|
|
61223
|
+
}
|
|
61224
|
+
}, []);
|
|
59313
61225
|
const contextValue = (0, import_react.useMemo)(
|
|
59314
61226
|
() => ({
|
|
59315
61227
|
beginDeposit,
|
|
59316
61228
|
closeDeposit,
|
|
59317
61229
|
handleDepositSuccess,
|
|
59318
|
-
handleDepositError
|
|
61230
|
+
handleDepositError,
|
|
61231
|
+
beginWithdraw,
|
|
61232
|
+
closeWithdraw,
|
|
61233
|
+
handleWithdrawSuccess,
|
|
61234
|
+
handleWithdrawError
|
|
59319
61235
|
}),
|
|
59320
|
-
[beginDeposit, closeDeposit, handleDepositSuccess, handleDepositError]
|
|
61236
|
+
[beginDeposit, closeDeposit, handleDepositSuccess, handleDepositError, beginWithdraw, closeWithdraw, handleWithdrawSuccess, handleWithdrawError]
|
|
59321
61237
|
);
|
|
59322
|
-
return /* @__PURE__ */ (0,
|
|
61238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(UnifoldProvider, { publishableKey, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ConnectContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
59323
61239
|
ThemeProvider,
|
|
59324
61240
|
{
|
|
59325
61241
|
mode: resolvedTheme,
|
|
@@ -59330,7 +61246,27 @@ function UnifoldProvider2({
|
|
|
59330
61246
|
components: config?.components,
|
|
59331
61247
|
children: [
|
|
59332
61248
|
children,
|
|
59333
|
-
|
|
61249
|
+
withdrawConfig && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
61250
|
+
WithdrawModal,
|
|
61251
|
+
{
|
|
61252
|
+
open: isWithdrawOpen,
|
|
61253
|
+
onOpenChange: closeWithdraw,
|
|
61254
|
+
publishableKey,
|
|
61255
|
+
modalTitle: config?.withdrawModalTitle,
|
|
61256
|
+
externalUserId: withdrawConfig.externalUserId,
|
|
61257
|
+
sourceChainType: withdrawConfig.sourceChainType,
|
|
61258
|
+
sourceChainId: withdrawConfig.sourceChainId,
|
|
61259
|
+
sourceTokenAddress: withdrawConfig.sourceTokenAddress,
|
|
61260
|
+
sourceTokenSymbol: withdrawConfig.sourceTokenSymbol,
|
|
61261
|
+
recipientAddress: withdrawConfig.recipientAddress,
|
|
61262
|
+
senderAddress: withdrawConfig.senderAddress,
|
|
61263
|
+
onWithdraw: withdrawConfig.withdraw,
|
|
61264
|
+
onWithdrawSuccess: handleWithdrawSuccess,
|
|
61265
|
+
onWithdrawError: handleWithdrawError,
|
|
61266
|
+
theme: resolvedTheme
|
|
61267
|
+
}
|
|
61268
|
+
),
|
|
61269
|
+
depositConfig && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
59334
61270
|
DepositModal,
|
|
59335
61271
|
{
|
|
59336
61272
|
open: isOpen,
|
|
@@ -59343,6 +61279,10 @@ function UnifoldProvider2({
|
|
|
59343
61279
|
destinationChainType: depositConfig.destinationChainType,
|
|
59344
61280
|
destinationChainId: depositConfig.destinationChainId,
|
|
59345
61281
|
destinationTokenAddress: depositConfig.destinationTokenAddress,
|
|
61282
|
+
defaultSourceChainType: depositConfig.defaultSourceChainType,
|
|
61283
|
+
defaultSourceChainId: depositConfig.defaultSourceChainId,
|
|
61284
|
+
defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
|
|
61285
|
+
defaultSourceSymbol: depositConfig.defaultSourceSymbol,
|
|
59346
61286
|
depositConfirmationMode: depositConfig.depositConfirmationMode ?? "auto_ui",
|
|
59347
61287
|
hideDepositTracker: config?.hideDepositTracker,
|
|
59348
61288
|
showBalanceHeader: config?.showBalanceHeader,
|
|
@@ -59376,6 +61316,9 @@ function useUnifold2() {
|
|
|
59376
61316
|
publishableKey: "",
|
|
59377
61317
|
beginDeposit: () => Promise.reject(new Error("SSR not supported")),
|
|
59378
61318
|
closeDeposit: () => {
|
|
61319
|
+
},
|
|
61320
|
+
beginWithdraw: () => Promise.reject(new Error("SSR not supported")),
|
|
61321
|
+
closeWithdraw: () => {
|
|
59379
61322
|
}
|
|
59380
61323
|
};
|
|
59381
61324
|
}
|
|
@@ -59385,21 +61328,25 @@ function useUnifold2() {
|
|
|
59385
61328
|
return {
|
|
59386
61329
|
publishableKey: baseContext.publishableKey,
|
|
59387
61330
|
beginDeposit: connectContext.beginDeposit,
|
|
59388
|
-
closeDeposit: connectContext.closeDeposit
|
|
61331
|
+
closeDeposit: connectContext.closeDeposit,
|
|
61332
|
+
beginWithdraw: connectContext.beginWithdraw,
|
|
61333
|
+
closeWithdraw: connectContext.closeWithdraw
|
|
59389
61334
|
};
|
|
59390
61335
|
}
|
|
59391
61336
|
|
|
59392
61337
|
// src/unifold.tsx
|
|
59393
|
-
var UnifoldBridge = (0,
|
|
59394
|
-
const { beginDeposit, closeDeposit } = useUnifold2();
|
|
59395
|
-
(0,
|
|
61338
|
+
var UnifoldBridge = (0, import_react32.forwardRef)((_, ref) => {
|
|
61339
|
+
const { beginDeposit, closeDeposit, beginWithdraw, closeWithdraw } = useUnifold2();
|
|
61340
|
+
(0, import_react32.useImperativeHandle)(ref, () => ({ beginDeposit, closeDeposit, beginWithdraw, closeWithdraw }), [
|
|
59396
61341
|
beginDeposit,
|
|
59397
|
-
closeDeposit
|
|
61342
|
+
closeDeposit,
|
|
61343
|
+
beginWithdraw,
|
|
61344
|
+
closeWithdraw
|
|
59398
61345
|
]);
|
|
59399
61346
|
return null;
|
|
59400
61347
|
});
|
|
59401
61348
|
UnifoldBridge.displayName = "UnifoldBridge";
|
|
59402
|
-
var RenderErrorBoundary = class extends
|
|
61349
|
+
var RenderErrorBoundary = class extends import_react32.Component {
|
|
59403
61350
|
constructor() {
|
|
59404
61351
|
super(...arguments);
|
|
59405
61352
|
this.state = { hasError: false };
|
|
@@ -59444,6 +61391,15 @@ function createUnifold(publishableKey, config) {
|
|
|
59444
61391
|
return resolvedHandle.beginDeposit(depositConfig);
|
|
59445
61392
|
},
|
|
59446
61393
|
closeDeposit: () => resolvedHandle?.closeDeposit(),
|
|
61394
|
+
beginWithdraw: (withdrawConfig) => {
|
|
61395
|
+
if (!resolvedHandle) {
|
|
61396
|
+
return Promise.reject(
|
|
61397
|
+
new Error("Unifold instance has been destroyed")
|
|
61398
|
+
);
|
|
61399
|
+
}
|
|
61400
|
+
return resolvedHandle.beginWithdraw(withdrawConfig);
|
|
61401
|
+
},
|
|
61402
|
+
closeWithdraw: () => resolvedHandle?.closeWithdraw(),
|
|
59447
61403
|
destroy: cleanup
|
|
59448
61404
|
};
|
|
59449
61405
|
const refCallback = (handle) => {
|
|
@@ -59464,13 +61420,13 @@ function createUnifold(publishableKey, config) {
|
|
|
59464
61420
|
};
|
|
59465
61421
|
try {
|
|
59466
61422
|
root.render(
|
|
59467
|
-
|
|
61423
|
+
import_react32.default.createElement(
|
|
59468
61424
|
RenderErrorBoundary,
|
|
59469
61425
|
{ onError: handleRenderError },
|
|
59470
|
-
|
|
61426
|
+
import_react32.default.createElement(
|
|
59471
61427
|
UnifoldProvider2,
|
|
59472
61428
|
{ publishableKey, config },
|
|
59473
|
-
|
|
61429
|
+
import_react32.default.createElement(UnifoldBridge, { ref: refCallback })
|
|
59474
61430
|
)
|
|
59475
61431
|
)
|
|
59476
61432
|
);
|
|
@@ -59494,11 +61450,13 @@ lucide-react/dist/esm/Icon.js:
|
|
|
59494
61450
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
59495
61451
|
lucide-react/dist/esm/icons/arrow-left-right.js:
|
|
59496
61452
|
lucide-react/dist/esm/icons/arrow-left.js:
|
|
61453
|
+
lucide-react/dist/esm/icons/arrow-up-down.js:
|
|
59497
61454
|
lucide-react/dist/esm/icons/check.js:
|
|
59498
61455
|
lucide-react/dist/esm/icons/chevron-down.js:
|
|
59499
61456
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
59500
61457
|
lucide-react/dist/esm/icons/chevron-up.js:
|
|
59501
61458
|
lucide-react/dist/esm/icons/circle-check.js:
|
|
61459
|
+
lucide-react/dist/esm/icons/clipboard-paste.js:
|
|
59502
61460
|
lucide-react/dist/esm/icons/clock.js:
|
|
59503
61461
|
lucide-react/dist/esm/icons/copy.js:
|
|
59504
61462
|
lucide-react/dist/esm/icons/credit-card.js:
|