@unifold/ui-web 0.1.41 → 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 +2594 -678
- package/dist/index.mjs +2594 -678
- package/dist/styles-base.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -34407,7 +34407,7 @@ __export(index_exports, {
|
|
|
34407
34407
|
module.exports = __toCommonJS(index_exports);
|
|
34408
34408
|
|
|
34409
34409
|
// src/unifold.tsx
|
|
34410
|
-
var
|
|
34410
|
+
var import_react32 = __toESM(require_react());
|
|
34411
34411
|
var import_client = __toESM(require_client());
|
|
34412
34412
|
|
|
34413
34413
|
// ../connect-react/dist/index.mjs
|
|
@@ -37226,7 +37226,18 @@ var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
|
|
|
37226
37226
|
var React272 = __toESM(require_react(), 1);
|
|
37227
37227
|
var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
|
|
37228
37228
|
var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
|
|
37229
|
+
var import_react27 = __toESM(require_react(), 1);
|
|
37230
|
+
var import_react28 = __toESM(require_react(), 1);
|
|
37229
37231
|
var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
|
|
37232
|
+
var import_react29 = __toESM(require_react(), 1);
|
|
37233
|
+
var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
|
|
37234
|
+
var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
|
|
37235
|
+
var import_react30 = __toESM(require_react(), 1);
|
|
37236
|
+
var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
|
|
37237
|
+
var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
|
|
37238
|
+
var import_react31 = __toESM(require_react(), 1);
|
|
37239
|
+
var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
|
|
37240
|
+
var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
|
|
37230
37241
|
var __create2 = Object.create;
|
|
37231
37242
|
var __defProp2 = Object.defineProperty;
|
|
37232
37243
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -37255,69 +37266,69 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__
|
|
|
37255
37266
|
var require_qr_code_styling = __commonJS2({
|
|
37256
37267
|
"../../node_modules/.pnpm/qr-code-styling@1.9.2/node_modules/qr-code-styling/lib/qr-code-styling.js"(exports2, module2) {
|
|
37257
37268
|
"use strict";
|
|
37258
|
-
!(function(
|
|
37259
|
-
"object" == typeof exports2 && "object" == typeof module2 ? module2.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports2 ? exports2.QRCodeStyling = e() :
|
|
37269
|
+
!(function(t11, e) {
|
|
37270
|
+
"object" == typeof exports2 && "object" == typeof module2 ? module2.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports2 ? exports2.QRCodeStyling = e() : t11.QRCodeStyling = e();
|
|
37260
37271
|
})(exports2, (() => (() => {
|
|
37261
|
-
var
|
|
37272
|
+
var t11 = { 873: (t12, e2) => {
|
|
37262
37273
|
var i2, r3, n = (function() {
|
|
37263
|
-
var
|
|
37264
|
-
var i4 =
|
|
37265
|
-
n3 = (function(
|
|
37266
|
-
for (var e6 = new Array(
|
|
37267
|
-
e6[i5] = new Array(
|
|
37268
|
-
for (var r6 = 0; r6 <
|
|
37274
|
+
var t13 = function(t14, e4) {
|
|
37275
|
+
var i4 = t14, r5 = s[e4], n3 = null, o2 = 0, h2 = null, p2 = [], v2 = {}, m = function(t15, e5) {
|
|
37276
|
+
n3 = (function(t16) {
|
|
37277
|
+
for (var e6 = new Array(t16), i5 = 0; i5 < t16; i5 += 1) {
|
|
37278
|
+
e6[i5] = new Array(t16);
|
|
37279
|
+
for (var r6 = 0; r6 < t16; r6 += 1) e6[i5][r6] = null;
|
|
37269
37280
|
}
|
|
37270
37281
|
return e6;
|
|
37271
|
-
})(o2 = 4 * i4 + 17), b(0, 0), b(o2 - 7, 0), b(0, o2 - 7), x(), y(), C(
|
|
37272
|
-
}, b = function(
|
|
37273
|
-
for (var i5 = -1; i5 <= 7; i5 += 1) if (!(
|
|
37282
|
+
})(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);
|
|
37283
|
+
}, b = function(t15, e5) {
|
|
37284
|
+
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);
|
|
37274
37285
|
}, y = function() {
|
|
37275
|
-
for (var
|
|
37286
|
+
for (var t15 = 8; t15 < o2 - 8; t15 += 1) null == n3[t15][6] && (n3[t15][6] = t15 % 2 == 0);
|
|
37276
37287
|
for (var e5 = 8; e5 < o2 - 8; e5 += 1) null == n3[6][e5] && (n3[6][e5] = e5 % 2 == 0);
|
|
37277
37288
|
}, x = function() {
|
|
37278
|
-
for (var
|
|
37279
|
-
var o3 =
|
|
37289
|
+
for (var t15 = a.getPatternPosition(i4), e5 = 0; e5 < t15.length; e5 += 1) for (var r6 = 0; r6 < t15.length; r6 += 1) {
|
|
37290
|
+
var o3 = t15[e5], s2 = t15[r6];
|
|
37280
37291
|
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;
|
|
37281
37292
|
}
|
|
37282
|
-
}, S = function(
|
|
37293
|
+
}, S = function(t15) {
|
|
37283
37294
|
for (var e5 = a.getBCHTypeNumber(i4), r6 = 0; r6 < 18; r6 += 1) {
|
|
37284
|
-
var s2 = !
|
|
37295
|
+
var s2 = !t15 && 1 == (e5 >> r6 & 1);
|
|
37285
37296
|
n3[Math.floor(r6 / 3)][r6 % 3 + o2 - 8 - 3] = s2;
|
|
37286
37297
|
}
|
|
37287
|
-
for (r6 = 0; r6 < 18; r6 += 1) s2 = !
|
|
37288
|
-
}, C = function(
|
|
37298
|
+
for (r6 = 0; r6 < 18; r6 += 1) s2 = !t15 && 1 == (e5 >> r6 & 1), n3[r6 % 3 + o2 - 8 - 3][Math.floor(r6 / 3)] = s2;
|
|
37299
|
+
}, C = function(t15, e5) {
|
|
37289
37300
|
for (var i5 = r5 << 3 | e5, s2 = a.getBCHTypeInfo(i5), h3 = 0; h3 < 15; h3 += 1) {
|
|
37290
|
-
var d2 = !
|
|
37301
|
+
var d2 = !t15 && 1 == (s2 >> h3 & 1);
|
|
37291
37302
|
h3 < 6 ? n3[h3][8] = d2 : h3 < 8 ? n3[h3 + 1][8] = d2 : n3[o2 - 15 + h3][8] = d2;
|
|
37292
37303
|
}
|
|
37293
|
-
for (h3 = 0; h3 < 15; h3 += 1) d2 = !
|
|
37294
|
-
n3[o2 - 8][8] = !
|
|
37295
|
-
}, A = function(
|
|
37304
|
+
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;
|
|
37305
|
+
n3[o2 - 8][8] = !t15;
|
|
37306
|
+
}, A = function(t15, e5) {
|
|
37296
37307
|
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); ; ) {
|
|
37297
37308
|
for (var c2 = 0; c2 < 2; c2 += 1) if (null == n3[r6][u2 - c2]) {
|
|
37298
37309
|
var l2 = false;
|
|
37299
|
-
h3 <
|
|
37310
|
+
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);
|
|
37300
37311
|
}
|
|
37301
37312
|
if ((r6 += i5) < 0 || o2 <= r6) {
|
|
37302
37313
|
r6 -= i5, i5 = -i5;
|
|
37303
37314
|
break;
|
|
37304
37315
|
}
|
|
37305
37316
|
}
|
|
37306
|
-
}, M = function(
|
|
37307
|
-
for (var r6 = u.getRSBlocks(
|
|
37317
|
+
}, M = function(t15, e5, i5) {
|
|
37318
|
+
for (var r6 = u.getRSBlocks(t15, e5), n4 = c(), o3 = 0; o3 < i5.length; o3 += 1) {
|
|
37308
37319
|
var s2 = i5[o3];
|
|
37309
|
-
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(),
|
|
37320
|
+
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t15)), s2.write(n4);
|
|
37310
37321
|
}
|
|
37311
37322
|
var h3 = 0;
|
|
37312
37323
|
for (o3 = 0; o3 < r6.length; o3 += 1) h3 += r6[o3].dataCount;
|
|
37313
37324
|
if (n4.getLengthInBits() > 8 * h3) throw "code length overflow. (" + n4.getLengthInBits() + ">" + 8 * h3 + ")";
|
|
37314
37325
|
for (n4.getLengthInBits() + 4 <= 8 * h3 && n4.put(0, 4); n4.getLengthInBits() % 8 != 0; ) n4.putBit(false);
|
|
37315
37326
|
for (; !(n4.getLengthInBits() >= 8 * h3 || (n4.put(236, 8), n4.getLengthInBits() >= 8 * h3)); ) n4.put(17, 8);
|
|
37316
|
-
return (function(
|
|
37327
|
+
return (function(t16, e6) {
|
|
37317
37328
|
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) {
|
|
37318
37329
|
var u2 = e6[h4].dataCount, c2 = e6[h4].totalCount - u2;
|
|
37319
37330
|
r7 = Math.max(r7, u2), n5 = Math.max(n5, c2), o4[h4] = new Array(u2);
|
|
37320
|
-
for (var l2 = 0; l2 < o4[h4].length; l2 += 1) o4[h4][l2] = 255 &
|
|
37331
|
+
for (var l2 = 0; l2 < o4[h4].length; l2 += 1) o4[h4][l2] = 255 & t16.getBuffer()[l2 + i6];
|
|
37321
37332
|
i6 += u2;
|
|
37322
37333
|
var g2 = a.getErrorCorrectPolynomial(c2), f2 = d(o4[h4], g2.getLength() - 1).mod(g2);
|
|
37323
37334
|
for (s3[h4] = new Array(g2.getLength() - 1), l2 = 0; l2 < s3[h4].length; l2 += 1) {
|
|
@@ -37333,85 +37344,85 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37333
37344
|
return v3;
|
|
37334
37345
|
})(n4, r6);
|
|
37335
37346
|
};
|
|
37336
|
-
v2.addData = function(
|
|
37347
|
+
v2.addData = function(t15, e5) {
|
|
37337
37348
|
var i5 = null;
|
|
37338
37349
|
switch (e5 = e5 || "Byte") {
|
|
37339
37350
|
case "Numeric":
|
|
37340
|
-
i5 = l(
|
|
37351
|
+
i5 = l(t15);
|
|
37341
37352
|
break;
|
|
37342
37353
|
case "Alphanumeric":
|
|
37343
|
-
i5 = g(
|
|
37354
|
+
i5 = g(t15);
|
|
37344
37355
|
break;
|
|
37345
37356
|
case "Byte":
|
|
37346
|
-
i5 = f(
|
|
37357
|
+
i5 = f(t15);
|
|
37347
37358
|
break;
|
|
37348
37359
|
case "Kanji":
|
|
37349
|
-
i5 = w(
|
|
37360
|
+
i5 = w(t15);
|
|
37350
37361
|
break;
|
|
37351
37362
|
default:
|
|
37352
37363
|
throw "mode:" + e5;
|
|
37353
37364
|
}
|
|
37354
37365
|
p2.push(i5), h2 = null;
|
|
37355
|
-
}, v2.isDark = function(
|
|
37356
|
-
if (
|
|
37357
|
-
return n3[
|
|
37366
|
+
}, v2.isDark = function(t15, e5) {
|
|
37367
|
+
if (t15 < 0 || o2 <= t15 || e5 < 0 || o2 <= e5) throw t15 + "," + e5;
|
|
37368
|
+
return n3[t15][e5];
|
|
37358
37369
|
}, v2.getModuleCount = function() {
|
|
37359
37370
|
return o2;
|
|
37360
37371
|
}, v2.make = function() {
|
|
37361
37372
|
if (i4 < 1) {
|
|
37362
|
-
for (var
|
|
37363
|
-
for (var e5 = u.getRSBlocks(
|
|
37373
|
+
for (var t15 = 1; t15 < 40; t15++) {
|
|
37374
|
+
for (var e5 = u.getRSBlocks(t15, r5), n4 = c(), o3 = 0; o3 < p2.length; o3++) {
|
|
37364
37375
|
var s2 = p2[o3];
|
|
37365
|
-
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(),
|
|
37376
|
+
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t15)), s2.write(n4);
|
|
37366
37377
|
}
|
|
37367
37378
|
var h3 = 0;
|
|
37368
37379
|
for (o3 = 0; o3 < e5.length; o3++) h3 += e5[o3].dataCount;
|
|
37369
37380
|
if (n4.getLengthInBits() <= 8 * h3) break;
|
|
37370
37381
|
}
|
|
37371
|
-
i4 =
|
|
37382
|
+
i4 = t15;
|
|
37372
37383
|
}
|
|
37373
37384
|
m(false, (function() {
|
|
37374
|
-
for (var
|
|
37385
|
+
for (var t16 = 0, e6 = 0, i5 = 0; i5 < 8; i5 += 1) {
|
|
37375
37386
|
m(true, i5);
|
|
37376
37387
|
var r6 = a.getLostPoint(v2);
|
|
37377
|
-
(0 == i5 ||
|
|
37388
|
+
(0 == i5 || t16 > r6) && (t16 = r6, e6 = i5);
|
|
37378
37389
|
}
|
|
37379
37390
|
return e6;
|
|
37380
37391
|
})());
|
|
37381
|
-
}, v2.createTableTag = function(
|
|
37382
|
-
|
|
37392
|
+
}, v2.createTableTag = function(t15, e5) {
|
|
37393
|
+
t15 = t15 || 2;
|
|
37383
37394
|
var i5 = "";
|
|
37384
|
-
i5 += '<table style="', i5 += " border-width: 0px; border-style: none;", i5 += " border-collapse: collapse;", i5 += " padding: 0px; margin: " + (e5 = void 0 === e5 ? 4 *
|
|
37395
|
+
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>";
|
|
37385
37396
|
for (var r6 = 0; r6 < v2.getModuleCount(); r6 += 1) {
|
|
37386
37397
|
i5 += "<tr>";
|
|
37387
|
-
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: " +
|
|
37398
|
+
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 += '"/>';
|
|
37388
37399
|
i5 += "</tr>";
|
|
37389
37400
|
}
|
|
37390
37401
|
return (i5 += "</tbody>") + "</table>";
|
|
37391
|
-
}, v2.createSvgTag = function(
|
|
37402
|
+
}, v2.createSvgTag = function(t15, e5, i5, r6) {
|
|
37392
37403
|
var n4 = {};
|
|
37393
|
-
"object" == typeof arguments[0] && (
|
|
37394
|
-
var o3, s2, a2, h3, d2 = v2.getModuleCount() *
|
|
37395
|
-
for (h3 = "l" +
|
|
37404
|
+
"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;
|
|
37405
|
+
var o3, s2, a2, h3, d2 = v2.getModuleCount() * t15 + 2 * e5, u2 = "";
|
|
37406
|
+
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);
|
|
37396
37407
|
return (u2 += '" stroke="transparent" fill="black"/>') + "</svg>";
|
|
37397
|
-
}, v2.createDataURL = function(
|
|
37398
|
-
|
|
37399
|
-
var i5 = v2.getModuleCount() *
|
|
37408
|
+
}, v2.createDataURL = function(t15, e5) {
|
|
37409
|
+
t15 = t15 || 2, e5 = void 0 === e5 ? 4 * t15 : e5;
|
|
37410
|
+
var i5 = v2.getModuleCount() * t15 + 2 * e5, r6 = e5, n4 = i5 - e5;
|
|
37400
37411
|
return _(i5, i5, (function(e6, i6) {
|
|
37401
37412
|
if (r6 <= e6 && e6 < n4 && r6 <= i6 && i6 < n4) {
|
|
37402
|
-
var o3 = Math.floor((e6 - r6) /
|
|
37413
|
+
var o3 = Math.floor((e6 - r6) / t15), s2 = Math.floor((i6 - r6) / t15);
|
|
37403
37414
|
return v2.isDark(s2, o3) ? 0 : 1;
|
|
37404
37415
|
}
|
|
37405
37416
|
return 1;
|
|
37406
37417
|
}));
|
|
37407
|
-
}, v2.createImgTag = function(
|
|
37408
|
-
|
|
37409
|
-
var r6 = v2.getModuleCount() *
|
|
37410
|
-
return n4 += "<img", n4 += ' src="', n4 += v2.createDataURL(
|
|
37418
|
+
}, v2.createImgTag = function(t15, e5, i5) {
|
|
37419
|
+
t15 = t15 || 2, e5 = void 0 === e5 ? 4 * t15 : e5;
|
|
37420
|
+
var r6 = v2.getModuleCount() * t15 + 2 * e5, n4 = "";
|
|
37421
|
+
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 + "/>";
|
|
37411
37422
|
};
|
|
37412
|
-
var $ = function(
|
|
37413
|
-
for (var e5 = "", i5 = 0; i5 <
|
|
37414
|
-
var r6 =
|
|
37423
|
+
var $ = function(t15) {
|
|
37424
|
+
for (var e5 = "", i5 = 0; i5 < t15.length; i5 += 1) {
|
|
37425
|
+
var r6 = t15.charAt(i5);
|
|
37415
37426
|
switch (r6) {
|
|
37416
37427
|
case "<":
|
|
37417
37428
|
e5 += "<";
|
|
@@ -37431,40 +37442,40 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37431
37442
|
}
|
|
37432
37443
|
return e5;
|
|
37433
37444
|
};
|
|
37434
|
-
return v2.createASCII = function(
|
|
37435
|
-
if ((
|
|
37436
|
-
|
|
37437
|
-
var e6, i6, r7, n5, o4, s3 = 1 * v2.getModuleCount() + 2 *
|
|
37445
|
+
return v2.createASCII = function(t15, e5) {
|
|
37446
|
+
if ((t15 = t15 || 1) < 2) return (function(t16) {
|
|
37447
|
+
t16 = void 0 === t16 ? 2 : t16;
|
|
37448
|
+
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 = "";
|
|
37438
37449
|
for (e6 = 0; e6 < s3; e6 += 2) {
|
|
37439
|
-
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 +=
|
|
37450
|
+
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];
|
|
37440
37451
|
c3 += "\n";
|
|
37441
37452
|
}
|
|
37442
|
-
return s3 % 2 &&
|
|
37453
|
+
return s3 % 2 && t16 > 0 ? c3.substring(0, c3.length - s3 - 1) + Array(s3 + 1).join("\u2580") : c3.substring(0, c3.length - 1);
|
|
37443
37454
|
})(e5);
|
|
37444
|
-
|
|
37445
|
-
var i5, r6, n4, o3, s2 = v2.getModuleCount() *
|
|
37455
|
+
t15 -= 1, e5 = void 0 === e5 ? 2 * t15 : e5;
|
|
37456
|
+
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 = "";
|
|
37446
37457
|
for (i5 = 0; i5 < s2; i5 += 1) {
|
|
37447
|
-
for (n4 = Math.floor((i5 - a2) /
|
|
37448
|
-
for (n4 = 0; n4 <
|
|
37458
|
+
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;
|
|
37459
|
+
for (n4 = 0; n4 < t15; n4 += 1) c2 += l2 + "\n";
|
|
37449
37460
|
}
|
|
37450
37461
|
return c2.substring(0, c2.length - 1);
|
|
37451
|
-
}, v2.renderTo2dContext = function(
|
|
37462
|
+
}, v2.renderTo2dContext = function(t15, e5) {
|
|
37452
37463
|
e5 = e5 || 2;
|
|
37453
|
-
for (var i5 = v2.getModuleCount(), r6 = 0; r6 < i5; r6++) for (var n4 = 0; n4 < i5; n4++)
|
|
37464
|
+
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);
|
|
37454
37465
|
}, v2;
|
|
37455
37466
|
};
|
|
37456
|
-
|
|
37457
|
-
for (var e4 = [], i4 = 0; i4 <
|
|
37458
|
-
var r5 =
|
|
37467
|
+
t13.stringToBytes = (t13.stringToBytesFuncs = { default: function(t14) {
|
|
37468
|
+
for (var e4 = [], i4 = 0; i4 < t14.length; i4 += 1) {
|
|
37469
|
+
var r5 = t14.charCodeAt(i4);
|
|
37459
37470
|
e4.push(255 & r5);
|
|
37460
37471
|
}
|
|
37461
37472
|
return e4;
|
|
37462
|
-
} }).default,
|
|
37473
|
+
} }).default, t13.createStringToBytes = function(t14, e4) {
|
|
37463
37474
|
var i4 = (function() {
|
|
37464
|
-
for (var i5 = v(
|
|
37465
|
-
var
|
|
37466
|
-
if (-1 ==
|
|
37467
|
-
return
|
|
37475
|
+
for (var i5 = v(t14), r6 = function() {
|
|
37476
|
+
var t15 = i5.read();
|
|
37477
|
+
if (-1 == t15) throw "eof";
|
|
37478
|
+
return t15;
|
|
37468
37479
|
}, n3 = 0, o2 = {}; ; ) {
|
|
37469
37480
|
var s2 = i5.read();
|
|
37470
37481
|
if (-1 == s2) break;
|
|
@@ -37474,71 +37485,71 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37474
37485
|
if (n3 != e4) throw n3 + " != " + e4;
|
|
37475
37486
|
return o2;
|
|
37476
37487
|
})(), r5 = "?".charCodeAt(0);
|
|
37477
|
-
return function(
|
|
37478
|
-
for (var e5 = [], n3 = 0; n3 <
|
|
37479
|
-
var o2 =
|
|
37488
|
+
return function(t15) {
|
|
37489
|
+
for (var e5 = [], n3 = 0; n3 < t15.length; n3 += 1) {
|
|
37490
|
+
var o2 = t15.charCodeAt(n3);
|
|
37480
37491
|
if (o2 < 128) e5.push(o2);
|
|
37481
37492
|
else {
|
|
37482
|
-
var s2 = i4[
|
|
37493
|
+
var s2 = i4[t15.charAt(n3)];
|
|
37483
37494
|
"number" == typeof s2 ? (255 & s2) == s2 ? e5.push(s2) : (e5.push(s2 >>> 8), e5.push(255 & s2)) : e5.push(r5);
|
|
37484
37495
|
}
|
|
37485
37496
|
}
|
|
37486
37497
|
return e5;
|
|
37487
37498
|
};
|
|
37488
37499
|
};
|
|
37489
|
-
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(
|
|
37490
|
-
for (var e4 = 0; 0 !=
|
|
37500
|
+
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) {
|
|
37501
|
+
for (var e4 = 0; 0 != t14; ) e4 += 1, t14 >>>= 1;
|
|
37491
37502
|
return e4;
|
|
37492
|
-
}, (n2 = {}).getBCHTypeInfo = function(
|
|
37493
|
-
for (var e4 =
|
|
37494
|
-
return 21522 ^ (
|
|
37495
|
-
}, n2.getBCHTypeNumber = function(
|
|
37496
|
-
for (var e4 =
|
|
37497
|
-
return
|
|
37498
|
-
}, n2.getPatternPosition = function(
|
|
37499
|
-
return e3[
|
|
37500
|
-
}, n2.getMaskFunction = function(
|
|
37501
|
-
switch (
|
|
37503
|
+
}, (n2 = {}).getBCHTypeInfo = function(t14) {
|
|
37504
|
+
for (var e4 = t14 << 10; o(e4) - o(i3) >= 0; ) e4 ^= i3 << o(e4) - o(i3);
|
|
37505
|
+
return 21522 ^ (t14 << 10 | e4);
|
|
37506
|
+
}, n2.getBCHTypeNumber = function(t14) {
|
|
37507
|
+
for (var e4 = t14 << 12; o(e4) - o(r4) >= 0; ) e4 ^= r4 << o(e4) - o(r4);
|
|
37508
|
+
return t14 << 12 | e4;
|
|
37509
|
+
}, n2.getPatternPosition = function(t14) {
|
|
37510
|
+
return e3[t14 - 1];
|
|
37511
|
+
}, n2.getMaskFunction = function(t14) {
|
|
37512
|
+
switch (t14) {
|
|
37502
37513
|
case 0:
|
|
37503
|
-
return function(
|
|
37504
|
-
return (
|
|
37514
|
+
return function(t15, e4) {
|
|
37515
|
+
return (t15 + e4) % 2 == 0;
|
|
37505
37516
|
};
|
|
37506
37517
|
case 1:
|
|
37507
|
-
return function(
|
|
37508
|
-
return
|
|
37518
|
+
return function(t15, e4) {
|
|
37519
|
+
return t15 % 2 == 0;
|
|
37509
37520
|
};
|
|
37510
37521
|
case 2:
|
|
37511
|
-
return function(
|
|
37522
|
+
return function(t15, e4) {
|
|
37512
37523
|
return e4 % 3 == 0;
|
|
37513
37524
|
};
|
|
37514
37525
|
case 3:
|
|
37515
|
-
return function(
|
|
37516
|
-
return (
|
|
37526
|
+
return function(t15, e4) {
|
|
37527
|
+
return (t15 + e4) % 3 == 0;
|
|
37517
37528
|
};
|
|
37518
37529
|
case 4:
|
|
37519
|
-
return function(
|
|
37520
|
-
return (Math.floor(
|
|
37530
|
+
return function(t15, e4) {
|
|
37531
|
+
return (Math.floor(t15 / 2) + Math.floor(e4 / 3)) % 2 == 0;
|
|
37521
37532
|
};
|
|
37522
37533
|
case 5:
|
|
37523
|
-
return function(
|
|
37524
|
-
return
|
|
37534
|
+
return function(t15, e4) {
|
|
37535
|
+
return t15 * e4 % 2 + t15 * e4 % 3 == 0;
|
|
37525
37536
|
};
|
|
37526
37537
|
case 6:
|
|
37527
|
-
return function(
|
|
37528
|
-
return (
|
|
37538
|
+
return function(t15, e4) {
|
|
37539
|
+
return (t15 * e4 % 2 + t15 * e4 % 3) % 2 == 0;
|
|
37529
37540
|
};
|
|
37530
37541
|
case 7:
|
|
37531
|
-
return function(
|
|
37532
|
-
return (
|
|
37542
|
+
return function(t15, e4) {
|
|
37543
|
+
return (t15 * e4 % 3 + (t15 + e4) % 2) % 2 == 0;
|
|
37533
37544
|
};
|
|
37534
37545
|
default:
|
|
37535
|
-
throw "bad maskPattern:" +
|
|
37546
|
+
throw "bad maskPattern:" + t14;
|
|
37536
37547
|
}
|
|
37537
|
-
}, n2.getErrorCorrectPolynomial = function(
|
|
37538
|
-
for (var e4 = d([1], 0), i4 = 0; i4 <
|
|
37548
|
+
}, n2.getErrorCorrectPolynomial = function(t14) {
|
|
37549
|
+
for (var e4 = d([1], 0), i4 = 0; i4 < t14; i4 += 1) e4 = e4.multiply(d([1, h.gexp(i4)], 0));
|
|
37539
37550
|
return e4;
|
|
37540
|
-
}, n2.getLengthInBits = function(
|
|
37541
|
-
if (1 <= e4 && e4 < 10) switch (
|
|
37551
|
+
}, n2.getLengthInBits = function(t14, e4) {
|
|
37552
|
+
if (1 <= e4 && e4 < 10) switch (t14) {
|
|
37542
37553
|
case 1:
|
|
37543
37554
|
return 10;
|
|
37544
37555
|
case 2:
|
|
@@ -37547,9 +37558,9 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37547
37558
|
case 8:
|
|
37548
37559
|
return 8;
|
|
37549
37560
|
default:
|
|
37550
|
-
throw "mode:" +
|
|
37561
|
+
throw "mode:" + t14;
|
|
37551
37562
|
}
|
|
37552
|
-
else if (e4 < 27) switch (
|
|
37563
|
+
else if (e4 < 27) switch (t14) {
|
|
37553
37564
|
case 1:
|
|
37554
37565
|
return 12;
|
|
37555
37566
|
case 2:
|
|
@@ -37559,11 +37570,11 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37559
37570
|
case 8:
|
|
37560
37571
|
return 10;
|
|
37561
37572
|
default:
|
|
37562
|
-
throw "mode:" +
|
|
37573
|
+
throw "mode:" + t14;
|
|
37563
37574
|
}
|
|
37564
37575
|
else {
|
|
37565
37576
|
if (!(e4 < 41)) throw "type:" + e4;
|
|
37566
|
-
switch (
|
|
37577
|
+
switch (t14) {
|
|
37567
37578
|
case 1:
|
|
37568
37579
|
return 14;
|
|
37569
37580
|
case 2:
|
|
@@ -37573,72 +37584,72 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37573
37584
|
case 8:
|
|
37574
37585
|
return 12;
|
|
37575
37586
|
default:
|
|
37576
|
-
throw "mode:" +
|
|
37587
|
+
throw "mode:" + t14;
|
|
37577
37588
|
}
|
|
37578
37589
|
}
|
|
37579
|
-
}, n2.getLostPoint = function(
|
|
37580
|
-
for (var e4 =
|
|
37581
|
-
for (var o2 = 0, s2 =
|
|
37590
|
+
}, n2.getLostPoint = function(t14) {
|
|
37591
|
+
for (var e4 = t14.getModuleCount(), i4 = 0, r5 = 0; r5 < e4; r5 += 1) for (var n3 = 0; n3 < e4; n3 += 1) {
|
|
37592
|
+
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);
|
|
37582
37593
|
o2 > 5 && (i4 += 3 + o2 - 5);
|
|
37583
37594
|
}
|
|
37584
37595
|
for (r5 = 0; r5 < e4 - 1; r5 += 1) for (n3 = 0; n3 < e4 - 1; n3 += 1) {
|
|
37585
37596
|
var d2 = 0;
|
|
37586
|
-
|
|
37597
|
+
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);
|
|
37587
37598
|
}
|
|
37588
|
-
for (r5 = 0; r5 < e4; r5 += 1) for (n3 = 0; n3 < e4 - 6; n3 += 1)
|
|
37589
|
-
for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4 - 6; r5 += 1)
|
|
37599
|
+
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);
|
|
37600
|
+
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);
|
|
37590
37601
|
var u2 = 0;
|
|
37591
|
-
for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4; r5 += 1)
|
|
37602
|
+
for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4; r5 += 1) t14.isDark(r5, n3) && (u2 += 1);
|
|
37592
37603
|
return i4 + Math.abs(100 * u2 / e4 / e4 - 50) / 5 * 10;
|
|
37593
37604
|
}, n2), h = (function() {
|
|
37594
|
-
for (var
|
|
37595
|
-
for (i4 = 8; i4 < 256; i4 += 1)
|
|
37596
|
-
for (i4 = 0; i4 < 255; i4 += 1) e4[
|
|
37597
|
-
return { glog: function(
|
|
37598
|
-
if (
|
|
37599
|
-
return e4[
|
|
37605
|
+
for (var t14 = new Array(256), e4 = new Array(256), i4 = 0; i4 < 8; i4 += 1) t14[i4] = 1 << i4;
|
|
37606
|
+
for (i4 = 8; i4 < 256; i4 += 1) t14[i4] = t14[i4 - 4] ^ t14[i4 - 5] ^ t14[i4 - 6] ^ t14[i4 - 8];
|
|
37607
|
+
for (i4 = 0; i4 < 255; i4 += 1) e4[t14[i4]] = i4;
|
|
37608
|
+
return { glog: function(t15) {
|
|
37609
|
+
if (t15 < 1) throw "glog(" + t15 + ")";
|
|
37610
|
+
return e4[t15];
|
|
37600
37611
|
}, gexp: function(e5) {
|
|
37601
37612
|
for (; e5 < 0; ) e5 += 255;
|
|
37602
37613
|
for (; e5 >= 256; ) e5 -= 255;
|
|
37603
|
-
return
|
|
37614
|
+
return t14[e5];
|
|
37604
37615
|
} };
|
|
37605
37616
|
})();
|
|
37606
|
-
function d(
|
|
37607
|
-
if (void 0 ===
|
|
37617
|
+
function d(t14, e4) {
|
|
37618
|
+
if (void 0 === t14.length) throw t14.length + "/" + e4;
|
|
37608
37619
|
var i4 = (function() {
|
|
37609
|
-
for (var i5 = 0; i5 <
|
|
37610
|
-
for (var r6 = new Array(
|
|
37620
|
+
for (var i5 = 0; i5 < t14.length && 0 == t14[i5]; ) i5 += 1;
|
|
37621
|
+
for (var r6 = new Array(t14.length - i5 + e4), n3 = 0; n3 < t14.length - i5; n3 += 1) r6[n3] = t14[n3 + i5];
|
|
37611
37622
|
return r6;
|
|
37612
|
-
})(), r5 = { getAt: function(
|
|
37613
|
-
return i4[
|
|
37623
|
+
})(), r5 = { getAt: function(t15) {
|
|
37624
|
+
return i4[t15];
|
|
37614
37625
|
}, getLength: function() {
|
|
37615
37626
|
return i4.length;
|
|
37616
|
-
}, multiply: function(
|
|
37617
|
-
for (var e5 = new Array(r5.getLength() +
|
|
37627
|
+
}, multiply: function(t15) {
|
|
37628
|
+
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)));
|
|
37618
37629
|
return d(e5, 0);
|
|
37619
|
-
}, mod: function(
|
|
37620
|
-
if (r5.getLength() -
|
|
37621
|
-
for (var e5 = h.glog(r5.getAt(0)) - h.glog(
|
|
37622
|
-
for (n3 = 0; n3 <
|
|
37623
|
-
return d(i5, 0).mod(
|
|
37630
|
+
}, mod: function(t15) {
|
|
37631
|
+
if (r5.getLength() - t15.getLength() < 0) return r5;
|
|
37632
|
+
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);
|
|
37633
|
+
for (n3 = 0; n3 < t15.getLength(); n3 += 1) i5[n3] ^= h.gexp(h.glog(t15.getAt(n3)) + e5);
|
|
37634
|
+
return d(i5, 0).mod(t15);
|
|
37624
37635
|
} };
|
|
37625
37636
|
return r5;
|
|
37626
37637
|
}
|
|
37627
37638
|
var u = /* @__PURE__ */ (function() {
|
|
37628
|
-
var
|
|
37639
|
+
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) {
|
|
37629
37640
|
var i5 = {};
|
|
37630
|
-
return i5.totalCount =
|
|
37641
|
+
return i5.totalCount = t15, i5.dataCount = e5, i5;
|
|
37631
37642
|
}, i4 = { getRSBlocks: function(i5, r5) {
|
|
37632
37643
|
var n3 = (function(e5, i6) {
|
|
37633
37644
|
switch (i6) {
|
|
37634
37645
|
case s.L:
|
|
37635
|
-
return
|
|
37646
|
+
return t14[4 * (e5 - 1) + 0];
|
|
37636
37647
|
case s.M:
|
|
37637
|
-
return
|
|
37648
|
+
return t14[4 * (e5 - 1) + 1];
|
|
37638
37649
|
case s.Q:
|
|
37639
|
-
return
|
|
37650
|
+
return t14[4 * (e5 - 1) + 2];
|
|
37640
37651
|
case s.H:
|
|
37641
|
-
return
|
|
37652
|
+
return t14[4 * (e5 - 1) + 3];
|
|
37642
37653
|
default:
|
|
37643
37654
|
return;
|
|
37644
37655
|
}
|
|
@@ -37649,48 +37660,48 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37649
37660
|
} };
|
|
37650
37661
|
return i4;
|
|
37651
37662
|
})(), c = function() {
|
|
37652
|
-
var
|
|
37653
|
-
return
|
|
37663
|
+
var t14 = [], e4 = 0, i4 = { getBuffer: function() {
|
|
37664
|
+
return t14;
|
|
37654
37665
|
}, getAt: function(e5) {
|
|
37655
37666
|
var i5 = Math.floor(e5 / 8);
|
|
37656
|
-
return 1 == (
|
|
37657
|
-
}, put: function(
|
|
37658
|
-
for (var r5 = 0; r5 < e5; r5 += 1) i4.putBit(1 == (
|
|
37667
|
+
return 1 == (t14[i5] >>> 7 - e5 % 8 & 1);
|
|
37668
|
+
}, put: function(t15, e5) {
|
|
37669
|
+
for (var r5 = 0; r5 < e5; r5 += 1) i4.putBit(1 == (t15 >>> e5 - r5 - 1 & 1));
|
|
37659
37670
|
}, getLengthInBits: function() {
|
|
37660
37671
|
return e4;
|
|
37661
37672
|
}, putBit: function(i5) {
|
|
37662
37673
|
var r5 = Math.floor(e4 / 8);
|
|
37663
|
-
|
|
37674
|
+
t14.length <= r5 && t14.push(0), i5 && (t14[r5] |= 128 >>> e4 % 8), e4 += 1;
|
|
37664
37675
|
} };
|
|
37665
37676
|
return i4;
|
|
37666
|
-
}, l = function(
|
|
37667
|
-
var e4 =
|
|
37677
|
+
}, l = function(t14) {
|
|
37678
|
+
var e4 = t14, i4 = { getMode: function() {
|
|
37668
37679
|
return 1;
|
|
37669
|
-
}, getLength: function(
|
|
37680
|
+
}, getLength: function(t15) {
|
|
37670
37681
|
return e4.length;
|
|
37671
|
-
}, write: function(
|
|
37672
|
-
for (var i5 = e4, n4 = 0; n4 + 2 < i5.length; )
|
|
37673
|
-
n4 < i5.length && (i5.length - n4 == 1 ?
|
|
37674
|
-
} }, r5 = function(
|
|
37675
|
-
for (var e5 = 0, i5 = 0; i5 <
|
|
37682
|
+
}, write: function(t15) {
|
|
37683
|
+
for (var i5 = e4, n4 = 0; n4 + 2 < i5.length; ) t15.put(r5(i5.substring(n4, n4 + 3)), 10), n4 += 3;
|
|
37684
|
+
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));
|
|
37685
|
+
} }, r5 = function(t15) {
|
|
37686
|
+
for (var e5 = 0, i5 = 0; i5 < t15.length; i5 += 1) e5 = 10 * e5 + n3(t15.charAt(i5));
|
|
37676
37687
|
return e5;
|
|
37677
|
-
}, n3 = function(
|
|
37678
|
-
if ("0" <=
|
|
37679
|
-
throw "illegal char :" +
|
|
37688
|
+
}, n3 = function(t15) {
|
|
37689
|
+
if ("0" <= t15 && t15 <= "9") return t15.charCodeAt(0) - "0".charCodeAt(0);
|
|
37690
|
+
throw "illegal char :" + t15;
|
|
37680
37691
|
};
|
|
37681
37692
|
return i4;
|
|
37682
|
-
}, g = function(
|
|
37683
|
-
var e4 =
|
|
37693
|
+
}, g = function(t14) {
|
|
37694
|
+
var e4 = t14, i4 = { getMode: function() {
|
|
37684
37695
|
return 2;
|
|
37685
|
-
}, getLength: function(
|
|
37696
|
+
}, getLength: function(t15) {
|
|
37686
37697
|
return e4.length;
|
|
37687
|
-
}, write: function(
|
|
37688
|
-
for (var i5 = e4, n3 = 0; n3 + 1 < i5.length; )
|
|
37689
|
-
n3 < i5.length &&
|
|
37690
|
-
} }, r5 = function(
|
|
37691
|
-
if ("0" <=
|
|
37692
|
-
if ("A" <=
|
|
37693
|
-
switch (
|
|
37698
|
+
}, write: function(t15) {
|
|
37699
|
+
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;
|
|
37700
|
+
n3 < i5.length && t15.put(r5(i5.charAt(n3)), 6);
|
|
37701
|
+
} }, r5 = function(t15) {
|
|
37702
|
+
if ("0" <= t15 && t15 <= "9") return t15.charCodeAt(0) - "0".charCodeAt(0);
|
|
37703
|
+
if ("A" <= t15 && t15 <= "Z") return t15.charCodeAt(0) - "A".charCodeAt(0) + 10;
|
|
37704
|
+
switch (t15) {
|
|
37694
37705
|
case " ":
|
|
37695
37706
|
return 36;
|
|
37696
37707
|
case "$":
|
|
@@ -37710,31 +37721,31 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37710
37721
|
case ":":
|
|
37711
37722
|
return 44;
|
|
37712
37723
|
default:
|
|
37713
|
-
throw "illegal char :" +
|
|
37724
|
+
throw "illegal char :" + t15;
|
|
37714
37725
|
}
|
|
37715
37726
|
};
|
|
37716
37727
|
return i4;
|
|
37717
37728
|
}, f = function(e4) {
|
|
37718
|
-
var i4 =
|
|
37729
|
+
var i4 = t13.stringToBytes(e4);
|
|
37719
37730
|
return { getMode: function() {
|
|
37720
37731
|
return 4;
|
|
37721
|
-
}, getLength: function(
|
|
37732
|
+
}, getLength: function(t14) {
|
|
37722
37733
|
return i4.length;
|
|
37723
|
-
}, write: function(
|
|
37724
|
-
for (var e5 = 0; e5 < i4.length; e5 += 1)
|
|
37734
|
+
}, write: function(t14) {
|
|
37735
|
+
for (var e5 = 0; e5 < i4.length; e5 += 1) t14.put(i4[e5], 8);
|
|
37725
37736
|
} };
|
|
37726
37737
|
}, w = function(e4) {
|
|
37727
|
-
var i4 =
|
|
37738
|
+
var i4 = t13.stringToBytesFuncs.SJIS;
|
|
37728
37739
|
if (!i4) throw "sjis not supported.";
|
|
37729
37740
|
!(function() {
|
|
37730
|
-
var
|
|
37731
|
-
if (2 !=
|
|
37741
|
+
var t14 = i4("\u53CB");
|
|
37742
|
+
if (2 != t14.length || 38726 != (t14[0] << 8 | t14[1])) throw "sjis not supported.";
|
|
37732
37743
|
})();
|
|
37733
37744
|
var r5 = i4(e4), n3 = { getMode: function() {
|
|
37734
37745
|
return 8;
|
|
37735
|
-
}, getLength: function(
|
|
37746
|
+
}, getLength: function(t14) {
|
|
37736
37747
|
return ~~(r5.length / 2);
|
|
37737
|
-
}, write: function(
|
|
37748
|
+
}, write: function(t14) {
|
|
37738
37749
|
for (var e5 = r5, i5 = 0; i5 + 1 < e5.length; ) {
|
|
37739
37750
|
var n4 = (255 & e5[i5]) << 8 | 255 & e5[i5 + 1];
|
|
37740
37751
|
if (33088 <= n4 && n4 <= 40956) n4 -= 33088;
|
|
@@ -37742,69 +37753,69 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37742
37753
|
if (!(57408 <= n4 && n4 <= 60351)) throw "illegal char at " + (i5 + 1) + "/" + n4;
|
|
37743
37754
|
n4 -= 49472;
|
|
37744
37755
|
}
|
|
37745
|
-
n4 = 192 * (n4 >>> 8 & 255) + (255 & n4),
|
|
37756
|
+
n4 = 192 * (n4 >>> 8 & 255) + (255 & n4), t14.put(n4, 13), i5 += 2;
|
|
37746
37757
|
}
|
|
37747
37758
|
if (i5 < e5.length) throw "illegal char at " + (i5 + 1);
|
|
37748
37759
|
} };
|
|
37749
37760
|
return n3;
|
|
37750
37761
|
}, p = function() {
|
|
37751
|
-
var
|
|
37752
|
-
|
|
37753
|
-
}, writeShort: function(
|
|
37754
|
-
e4.writeByte(
|
|
37755
|
-
}, writeBytes: function(
|
|
37756
|
-
i4 = i4 || 0, r5 = r5 ||
|
|
37757
|
-
for (var n3 = 0; n3 < r5; n3 += 1) e4.writeByte(
|
|
37758
|
-
}, writeString: function(
|
|
37759
|
-
for (var i4 = 0; i4 <
|
|
37762
|
+
var t14 = [], e4 = { writeByte: function(e5) {
|
|
37763
|
+
t14.push(255 & e5);
|
|
37764
|
+
}, writeShort: function(t15) {
|
|
37765
|
+
e4.writeByte(t15), e4.writeByte(t15 >>> 8);
|
|
37766
|
+
}, writeBytes: function(t15, i4, r5) {
|
|
37767
|
+
i4 = i4 || 0, r5 = r5 || t15.length;
|
|
37768
|
+
for (var n3 = 0; n3 < r5; n3 += 1) e4.writeByte(t15[n3 + i4]);
|
|
37769
|
+
}, writeString: function(t15) {
|
|
37770
|
+
for (var i4 = 0; i4 < t15.length; i4 += 1) e4.writeByte(t15.charCodeAt(i4));
|
|
37760
37771
|
}, toByteArray: function() {
|
|
37761
|
-
return
|
|
37772
|
+
return t14;
|
|
37762
37773
|
}, toString: function() {
|
|
37763
37774
|
var e5 = "";
|
|
37764
37775
|
e5 += "[";
|
|
37765
|
-
for (var i4 = 0; i4 <
|
|
37776
|
+
for (var i4 = 0; i4 < t14.length; i4 += 1) i4 > 0 && (e5 += ","), e5 += t14[i4];
|
|
37766
37777
|
return e5 + "]";
|
|
37767
37778
|
} };
|
|
37768
37779
|
return e4;
|
|
37769
|
-
}, v = function(
|
|
37770
|
-
var e4 =
|
|
37780
|
+
}, v = function(t14) {
|
|
37781
|
+
var e4 = t14, i4 = 0, r5 = 0, n3 = 0, o2 = { read: function() {
|
|
37771
37782
|
for (; n3 < 8; ) {
|
|
37772
37783
|
if (i4 >= e4.length) {
|
|
37773
37784
|
if (0 == n3) return -1;
|
|
37774
37785
|
throw "unexpected end of file./" + n3;
|
|
37775
37786
|
}
|
|
37776
|
-
var
|
|
37777
|
-
if (i4 += 1, "=" ==
|
|
37778
|
-
|
|
37787
|
+
var t15 = e4.charAt(i4);
|
|
37788
|
+
if (i4 += 1, "=" == t15) return n3 = 0, -1;
|
|
37789
|
+
t15.match(/^\s$/) || (r5 = r5 << 6 | s2(t15.charCodeAt(0)), n3 += 6);
|
|
37779
37790
|
}
|
|
37780
37791
|
var o3 = r5 >>> n3 - 8 & 255;
|
|
37781
37792
|
return n3 -= 8, o3;
|
|
37782
|
-
} }, s2 = function(
|
|
37783
|
-
if (65 <=
|
|
37784
|
-
if (97 <=
|
|
37785
|
-
if (48 <=
|
|
37786
|
-
if (43 ==
|
|
37787
|
-
if (47 ==
|
|
37788
|
-
throw "c:" +
|
|
37793
|
+
} }, s2 = function(t15) {
|
|
37794
|
+
if (65 <= t15 && t15 <= 90) return t15 - 65;
|
|
37795
|
+
if (97 <= t15 && t15 <= 122) return t15 - 97 + 26;
|
|
37796
|
+
if (48 <= t15 && t15 <= 57) return t15 - 48 + 52;
|
|
37797
|
+
if (43 == t15) return 62;
|
|
37798
|
+
if (47 == t15) return 63;
|
|
37799
|
+
throw "c:" + t15;
|
|
37789
37800
|
};
|
|
37790
37801
|
return o2;
|
|
37791
|
-
}, _ = function(
|
|
37792
|
-
for (var r5 = (function(
|
|
37793
|
-
var i5 =
|
|
37794
|
-
n4[e6 * i5 +
|
|
37795
|
-
}, write: function(
|
|
37796
|
-
|
|
37802
|
+
}, _ = function(t14, e4, i4) {
|
|
37803
|
+
for (var r5 = (function(t15, e5) {
|
|
37804
|
+
var i5 = t15, r6 = e5, n4 = new Array(t15 * e5), o3 = { setPixel: function(t16, e6, r7) {
|
|
37805
|
+
n4[e6 * i5 + t16] = r7;
|
|
37806
|
+
}, write: function(t16) {
|
|
37807
|
+
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);
|
|
37797
37808
|
var e6 = s3(2);
|
|
37798
|
-
|
|
37799
|
-
for (var n5 = 0; e6.length - n5 > 255; )
|
|
37800
|
-
|
|
37801
|
-
} }, s3 = function(
|
|
37802
|
-
for (var e6 = 1 <<
|
|
37809
|
+
t16.writeByte(2);
|
|
37810
|
+
for (var n5 = 0; e6.length - n5 > 255; ) t16.writeByte(255), t16.writeBytes(e6, n5, 255), n5 += 255;
|
|
37811
|
+
t16.writeByte(e6.length - n5), t16.writeBytes(e6, n5, e6.length - n5), t16.writeByte(0), t16.writeString(";");
|
|
37812
|
+
} }, s3 = function(t16) {
|
|
37813
|
+
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));
|
|
37803
37814
|
o4.add(String.fromCharCode(e6)), o4.add(String.fromCharCode(i6));
|
|
37804
|
-
var h3, d3, u2, c2 = p(), l2 = (h3 = c2, d3 = 0, u2 = 0, { write: function(
|
|
37805
|
-
if (
|
|
37806
|
-
for (; d3 + e7 >= 8; ) h3.writeByte(255 & (
|
|
37807
|
-
u2 |=
|
|
37815
|
+
var h3, d3, u2, c2 = p(), l2 = (h3 = c2, d3 = 0, u2 = 0, { write: function(t17, e7) {
|
|
37816
|
+
if (t17 >>> e7 != 0) throw "length over";
|
|
37817
|
+
for (; d3 + e7 >= 8; ) h3.writeByte(255 & (t17 << d3 | u2)), e7 -= 8 - d3, t17 >>>= 8 - d3, u2 = 0, d3 = 0;
|
|
37818
|
+
u2 |= t17 << d3, d3 += e7;
|
|
37808
37819
|
}, flush: function() {
|
|
37809
37820
|
d3 > 0 && h3.writeByte(u2);
|
|
37810
37821
|
} });
|
|
@@ -37816,95 +37827,95 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37816
37827
|
}
|
|
37817
37828
|
return l2.write(o4.indexOf(f2), r7), l2.write(i6, r7), l2.flush(), c2.toByteArray();
|
|
37818
37829
|
}, a3 = function() {
|
|
37819
|
-
var
|
|
37830
|
+
var t16 = {}, e6 = 0, i6 = { add: function(r7) {
|
|
37820
37831
|
if (i6.contains(r7)) throw "dup key:" + r7;
|
|
37821
|
-
|
|
37832
|
+
t16[r7] = e6, e6 += 1;
|
|
37822
37833
|
}, size: function() {
|
|
37823
37834
|
return e6;
|
|
37824
37835
|
}, indexOf: function(e7) {
|
|
37825
|
-
return
|
|
37836
|
+
return t16[e7];
|
|
37826
37837
|
}, contains: function(e7) {
|
|
37827
|
-
return void 0 !==
|
|
37838
|
+
return void 0 !== t16[e7];
|
|
37828
37839
|
} };
|
|
37829
37840
|
return i6;
|
|
37830
37841
|
};
|
|
37831
37842
|
return o3;
|
|
37832
|
-
})(
|
|
37843
|
+
})(t14, e4), n3 = 0; n3 < e4; n3 += 1) for (var o2 = 0; o2 < t14; o2 += 1) r5.setPixel(o2, n3, i4(o2, n3));
|
|
37833
37844
|
var s2 = p();
|
|
37834
37845
|
r5.write(s2);
|
|
37835
37846
|
for (var a2 = (function() {
|
|
37836
|
-
var
|
|
37837
|
-
r6 += String.fromCharCode(s3(63 &
|
|
37838
|
-
}, s3 = function(
|
|
37839
|
-
if (
|
|
37847
|
+
var t15 = 0, e5 = 0, i5 = 0, r6 = "", n4 = {}, o3 = function(t16) {
|
|
37848
|
+
r6 += String.fromCharCode(s3(63 & t16));
|
|
37849
|
+
}, s3 = function(t16) {
|
|
37850
|
+
if (t16 < 0) ;
|
|
37840
37851
|
else {
|
|
37841
|
-
if (
|
|
37842
|
-
if (
|
|
37843
|
-
if (
|
|
37844
|
-
if (62 ==
|
|
37845
|
-
if (63 ==
|
|
37852
|
+
if (t16 < 26) return 65 + t16;
|
|
37853
|
+
if (t16 < 52) return t16 - 26 + 97;
|
|
37854
|
+
if (t16 < 62) return t16 - 52 + 48;
|
|
37855
|
+
if (62 == t16) return 43;
|
|
37856
|
+
if (63 == t16) return 47;
|
|
37846
37857
|
}
|
|
37847
|
-
throw "n:" +
|
|
37858
|
+
throw "n:" + t16;
|
|
37848
37859
|
};
|
|
37849
37860
|
return n4.writeByte = function(r7) {
|
|
37850
|
-
for (
|
|
37861
|
+
for (t15 = t15 << 8 | 255 & r7, e5 += 8, i5 += 1; e5 >= 6; ) o3(t15 >>> e5 - 6), e5 -= 6;
|
|
37851
37862
|
}, n4.flush = function() {
|
|
37852
|
-
if (e5 > 0 && (o3(
|
|
37863
|
+
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 += "=";
|
|
37853
37864
|
}, n4.toString = function() {
|
|
37854
37865
|
return r6;
|
|
37855
37866
|
}, n4;
|
|
37856
37867
|
})(), h2 = s2.toByteArray(), d2 = 0; d2 < h2.length; d2 += 1) a2.writeByte(h2[d2]);
|
|
37857
37868
|
return a2.flush(), "data:image/gif;base64," + a2;
|
|
37858
37869
|
};
|
|
37859
|
-
return
|
|
37870
|
+
return t13;
|
|
37860
37871
|
})();
|
|
37861
|
-
n.stringToBytesFuncs["UTF-8"] = function(
|
|
37862
|
-
return (function(
|
|
37863
|
-
for (var e3 = [], i3 = 0; i3 <
|
|
37864
|
-
var r4 =
|
|
37865
|
-
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 &
|
|
37872
|
+
n.stringToBytesFuncs["UTF-8"] = function(t13) {
|
|
37873
|
+
return (function(t14) {
|
|
37874
|
+
for (var e3 = [], i3 = 0; i3 < t14.length; i3++) {
|
|
37875
|
+
var r4 = t14.charCodeAt(i3);
|
|
37876
|
+
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));
|
|
37866
37877
|
}
|
|
37867
37878
|
return e3;
|
|
37868
|
-
})(
|
|
37879
|
+
})(t13);
|
|
37869
37880
|
}, void 0 === (r3 = "function" == typeof (i2 = function() {
|
|
37870
37881
|
return n;
|
|
37871
|
-
}) ? i2.apply(e2, []) : i2) || (
|
|
37882
|
+
}) ? i2.apply(e2, []) : i2) || (t12.exports = r3);
|
|
37872
37883
|
} }, e = {};
|
|
37873
37884
|
function i(r3) {
|
|
37874
37885
|
var n = e[r3];
|
|
37875
37886
|
if (void 0 !== n) return n.exports;
|
|
37876
37887
|
var o = e[r3] = { exports: {} };
|
|
37877
|
-
return
|
|
37888
|
+
return t11[r3](o, o.exports, i), o.exports;
|
|
37878
37889
|
}
|
|
37879
|
-
i.n = (
|
|
37880
|
-
var e2 =
|
|
37890
|
+
i.n = (t12) => {
|
|
37891
|
+
var e2 = t12 && t12.__esModule ? () => t12.default : () => t12;
|
|
37881
37892
|
return i.d(e2, { a: e2 }), e2;
|
|
37882
|
-
}, i.d = (
|
|
37883
|
-
for (var r3 in e2) i.o(e2, r3) && !i.o(
|
|
37884
|
-
}, i.o = (
|
|
37893
|
+
}, i.d = (t12, e2) => {
|
|
37894
|
+
for (var r3 in e2) i.o(e2, r3) && !i.o(t12, r3) && Object.defineProperty(t12, r3, { enumerable: true, get: e2[r3] });
|
|
37895
|
+
}, i.o = (t12, e2) => Object.prototype.hasOwnProperty.call(t12, e2);
|
|
37885
37896
|
var r2 = {};
|
|
37886
37897
|
return (() => {
|
|
37887
37898
|
"use strict";
|
|
37888
37899
|
i.d(r2, { default: () => $ });
|
|
37889
|
-
const
|
|
37900
|
+
const t12 = (t13) => !!t13 && "object" == typeof t13 && !Array.isArray(t13);
|
|
37890
37901
|
function e2(i2, ...r3) {
|
|
37891
37902
|
if (!r3.length) return i2;
|
|
37892
37903
|
const n2 = r3.shift();
|
|
37893
|
-
return void 0 !== n2 &&
|
|
37904
|
+
return void 0 !== n2 && t12(i2) && t12(n2) ? (i2 = Object.assign({}, i2), Object.keys(n2).forEach(((r4) => {
|
|
37894
37905
|
const o2 = i2[r4], s2 = n2[r4];
|
|
37895
|
-
Array.isArray(o2) && Array.isArray(s2) ? i2[r4] = s2 :
|
|
37906
|
+
Array.isArray(o2) && Array.isArray(s2) ? i2[r4] = s2 : t12(o2) && t12(s2) ? i2[r4] = e2(Object.assign({}, o2), s2) : i2[r4] = s2;
|
|
37896
37907
|
})), e2(i2, ...r3)) : i2;
|
|
37897
37908
|
}
|
|
37898
|
-
function n(
|
|
37909
|
+
function n(t13, e3) {
|
|
37899
37910
|
const i2 = document.createElement("a");
|
|
37900
|
-
i2.download = e3, i2.href =
|
|
37911
|
+
i2.download = e3, i2.href = t13, document.body.appendChild(i2), i2.click(), document.body.removeChild(i2);
|
|
37901
37912
|
}
|
|
37902
37913
|
const o = { L: 0.07, M: 0.15, Q: 0.25, H: 0.3 };
|
|
37903
37914
|
class s {
|
|
37904
|
-
constructor({ svg:
|
|
37905
|
-
this._svg =
|
|
37915
|
+
constructor({ svg: t13, type: e3, window: i2 }) {
|
|
37916
|
+
this._svg = t13, this._type = e3, this._window = i2;
|
|
37906
37917
|
}
|
|
37907
|
-
draw(
|
|
37918
|
+
draw(t13, e3, i2, r3) {
|
|
37908
37919
|
let n2;
|
|
37909
37920
|
switch (this._type) {
|
|
37910
37921
|
case "dots":
|
|
@@ -37925,100 +37936,100 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37925
37936
|
default:
|
|
37926
37937
|
n2 = this._drawSquare;
|
|
37927
37938
|
}
|
|
37928
|
-
n2.call(this, { x:
|
|
37939
|
+
n2.call(this, { x: t13, y: e3, size: i2, getNeighbor: r3 });
|
|
37929
37940
|
}
|
|
37930
|
-
_rotateFigure({ x:
|
|
37941
|
+
_rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
|
|
37931
37942
|
var o2;
|
|
37932
|
-
const s2 =
|
|
37943
|
+
const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
|
|
37933
37944
|
n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
|
|
37934
37945
|
}
|
|
37935
|
-
_basicDot(
|
|
37936
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37937
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37946
|
+
_basicDot(t13) {
|
|
37947
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37948
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37938
37949
|
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));
|
|
37939
37950
|
} }));
|
|
37940
37951
|
}
|
|
37941
|
-
_basicSquare(
|
|
37942
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37943
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37952
|
+
_basicSquare(t13) {
|
|
37953
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37954
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37944
37955
|
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));
|
|
37945
37956
|
} }));
|
|
37946
37957
|
}
|
|
37947
|
-
_basicSideRounded(
|
|
37948
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37949
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37958
|
+
_basicSideRounded(t13) {
|
|
37959
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37960
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37950
37961
|
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}`);
|
|
37951
37962
|
} }));
|
|
37952
37963
|
}
|
|
37953
|
-
_basicCornerRounded(
|
|
37954
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37955
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37964
|
+
_basicCornerRounded(t13) {
|
|
37965
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37966
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37956
37967
|
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}`);
|
|
37957
37968
|
} }));
|
|
37958
37969
|
}
|
|
37959
|
-
_basicCornerExtraRounded(
|
|
37960
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37961
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37970
|
+
_basicCornerExtraRounded(t13) {
|
|
37971
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37972
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37962
37973
|
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}`);
|
|
37963
37974
|
} }));
|
|
37964
37975
|
}
|
|
37965
|
-
_basicCornersRounded(
|
|
37966
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37967
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37976
|
+
_basicCornersRounded(t13) {
|
|
37977
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37978
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37968
37979
|
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}`);
|
|
37969
37980
|
} }));
|
|
37970
37981
|
}
|
|
37971
|
-
_drawDot({ x:
|
|
37972
|
-
this._basicDot({ x:
|
|
37982
|
+
_drawDot({ x: t13, y: e3, size: i2 }) {
|
|
37983
|
+
this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37973
37984
|
}
|
|
37974
|
-
_drawSquare({ x:
|
|
37975
|
-
this._basicSquare({ x:
|
|
37985
|
+
_drawSquare({ x: t13, y: e3, size: i2 }) {
|
|
37986
|
+
this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37976
37987
|
}
|
|
37977
|
-
_drawRounded({ x:
|
|
37988
|
+
_drawRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
|
|
37978
37989
|
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;
|
|
37979
|
-
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x:
|
|
37990
|
+
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37980
37991
|
else {
|
|
37981
37992
|
if (2 === h2) {
|
|
37982
37993
|
let r4 = 0;
|
|
37983
|
-
return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerRounded({ x:
|
|
37994
|
+
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 });
|
|
37984
37995
|
}
|
|
37985
37996
|
if (1 === h2) {
|
|
37986
37997
|
let r4 = 0;
|
|
37987
|
-
return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x:
|
|
37998
|
+
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 });
|
|
37988
37999
|
}
|
|
37989
38000
|
}
|
|
37990
|
-
else this._basicDot({ x:
|
|
38001
|
+
else this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37991
38002
|
}
|
|
37992
|
-
_drawExtraRounded({ x:
|
|
38003
|
+
_drawExtraRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
|
|
37993
38004
|
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;
|
|
37994
|
-
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x:
|
|
38005
|
+
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37995
38006
|
else {
|
|
37996
38007
|
if (2 === h2) {
|
|
37997
38008
|
let r4 = 0;
|
|
37998
|
-
return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerExtraRounded({ x:
|
|
38009
|
+
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 });
|
|
37999
38010
|
}
|
|
38000
38011
|
if (1 === h2) {
|
|
38001
38012
|
let r4 = 0;
|
|
38002
|
-
return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x:
|
|
38013
|
+
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 });
|
|
38003
38014
|
}
|
|
38004
38015
|
}
|
|
38005
|
-
else this._basicDot({ x:
|
|
38016
|
+
else this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
38006
38017
|
}
|
|
38007
|
-
_drawClassy({ x:
|
|
38018
|
+
_drawClassy({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
|
|
38008
38019
|
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;
|
|
38009
|
-
0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x:
|
|
38020
|
+
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 });
|
|
38010
38021
|
}
|
|
38011
|
-
_drawClassyRounded({ x:
|
|
38022
|
+
_drawClassyRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
|
|
38012
38023
|
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;
|
|
38013
|
-
0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x:
|
|
38024
|
+
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 });
|
|
38014
38025
|
}
|
|
38015
38026
|
}
|
|
38016
38027
|
const a = { dot: "dot", square: "square", extraRounded: "extra-rounded" }, h = Object.values(a);
|
|
38017
38028
|
class d {
|
|
38018
|
-
constructor({ svg:
|
|
38019
|
-
this._svg =
|
|
38029
|
+
constructor({ svg: t13, type: e3, window: i2 }) {
|
|
38030
|
+
this._svg = t13, this._type = e3, this._window = i2;
|
|
38020
38031
|
}
|
|
38021
|
-
draw(
|
|
38032
|
+
draw(t13, e3, i2, r3) {
|
|
38022
38033
|
let n2;
|
|
38023
38034
|
switch (this._type) {
|
|
38024
38035
|
case a.square:
|
|
@@ -38030,78 +38041,78 @@ var require_qr_code_styling = __commonJS2({
|
|
|
38030
38041
|
default:
|
|
38031
38042
|
n2 = this._drawDot;
|
|
38032
38043
|
}
|
|
38033
|
-
n2.call(this, { x:
|
|
38044
|
+
n2.call(this, { x: t13, y: e3, size: i2, rotation: r3 });
|
|
38034
38045
|
}
|
|
38035
|
-
_rotateFigure({ x:
|
|
38046
|
+
_rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
|
|
38036
38047
|
var o2;
|
|
38037
|
-
const s2 =
|
|
38048
|
+
const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
|
|
38038
38049
|
n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
|
|
38039
38050
|
}
|
|
38040
|
-
_basicDot(
|
|
38041
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38042
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38051
|
+
_basicDot(t13) {
|
|
38052
|
+
const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
|
|
38053
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38043
38054
|
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`);
|
|
38044
38055
|
} }));
|
|
38045
38056
|
}
|
|
38046
|
-
_basicSquare(
|
|
38047
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38048
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38057
|
+
_basicSquare(t13) {
|
|
38058
|
+
const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
|
|
38059
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38049
38060
|
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");
|
|
38050
38061
|
} }));
|
|
38051
38062
|
}
|
|
38052
|
-
_basicExtraRounded(
|
|
38053
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38054
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38063
|
+
_basicExtraRounded(t13) {
|
|
38064
|
+
const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
|
|
38065
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38055
38066
|
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}`);
|
|
38056
38067
|
} }));
|
|
38057
38068
|
}
|
|
38058
|
-
_drawDot({ x:
|
|
38059
|
-
this._basicDot({ x:
|
|
38069
|
+
_drawDot({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38070
|
+
this._basicDot({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38060
38071
|
}
|
|
38061
|
-
_drawSquare({ x:
|
|
38062
|
-
this._basicSquare({ x:
|
|
38072
|
+
_drawSquare({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38073
|
+
this._basicSquare({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38063
38074
|
}
|
|
38064
|
-
_drawExtraRounded({ x:
|
|
38065
|
-
this._basicExtraRounded({ x:
|
|
38075
|
+
_drawExtraRounded({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38076
|
+
this._basicExtraRounded({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38066
38077
|
}
|
|
38067
38078
|
}
|
|
38068
38079
|
const u = { dot: "dot", square: "square" }, c = Object.values(u);
|
|
38069
38080
|
class l {
|
|
38070
|
-
constructor({ svg:
|
|
38071
|
-
this._svg =
|
|
38081
|
+
constructor({ svg: t13, type: e3, window: i2 }) {
|
|
38082
|
+
this._svg = t13, this._type = e3, this._window = i2;
|
|
38072
38083
|
}
|
|
38073
|
-
draw(
|
|
38084
|
+
draw(t13, e3, i2, r3) {
|
|
38074
38085
|
let n2;
|
|
38075
|
-
n2 = this._type === u.square ? this._drawSquare : this._drawDot, n2.call(this, { x:
|
|
38086
|
+
n2 = this._type === u.square ? this._drawSquare : this._drawDot, n2.call(this, { x: t13, y: e3, size: i2, rotation: r3 });
|
|
38076
38087
|
}
|
|
38077
|
-
_rotateFigure({ x:
|
|
38088
|
+
_rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
|
|
38078
38089
|
var o2;
|
|
38079
|
-
const s2 =
|
|
38090
|
+
const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
|
|
38080
38091
|
n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
|
|
38081
38092
|
}
|
|
38082
|
-
_basicDot(
|
|
38083
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38084
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38093
|
+
_basicDot(t13) {
|
|
38094
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
38095
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38085
38096
|
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));
|
|
38086
38097
|
} }));
|
|
38087
38098
|
}
|
|
38088
|
-
_basicSquare(
|
|
38089
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38090
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38099
|
+
_basicSquare(t13) {
|
|
38100
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
38101
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38091
38102
|
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));
|
|
38092
38103
|
} }));
|
|
38093
38104
|
}
|
|
38094
|
-
_drawDot({ x:
|
|
38095
|
-
this._basicDot({ x:
|
|
38105
|
+
_drawDot({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38106
|
+
this._basicDot({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38096
38107
|
}
|
|
38097
|
-
_drawSquare({ x:
|
|
38098
|
-
this._basicSquare({ x:
|
|
38108
|
+
_drawSquare({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38109
|
+
this._basicSquare({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38099
38110
|
}
|
|
38100
38111
|
}
|
|
38101
38112
|
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]];
|
|
38102
38113
|
class p {
|
|
38103
|
-
constructor(
|
|
38104
|
-
this._roundSize = (
|
|
38114
|
+
constructor(t13, e3) {
|
|
38115
|
+
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;
|
|
38105
38116
|
}
|
|
38106
38117
|
get width() {
|
|
38107
38118
|
return this._options.width;
|
|
@@ -38112,135 +38123,135 @@ var require_qr_code_styling = __commonJS2({
|
|
|
38112
38123
|
getElement() {
|
|
38113
38124
|
return this._element;
|
|
38114
38125
|
}
|
|
38115
|
-
async drawQR(
|
|
38116
|
-
const e3 =
|
|
38126
|
+
async drawQR(t13) {
|
|
38127
|
+
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);
|
|
38117
38128
|
let s2 = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 };
|
|
38118
|
-
if (this._qr =
|
|
38129
|
+
if (this._qr = t13, this._options.image) {
|
|
38119
38130
|
if (await this.loadImage(), !this._image) return;
|
|
38120
|
-
const { imageOptions:
|
|
38121
|
-
s2 = (function({ originalHeight:
|
|
38131
|
+
const { imageOptions: t14, qrOptions: i3 } = this._options, r4 = t14.imageSize * o[i3.errorCorrectionLevel], a2 = Math.floor(r4 * e3 * e3);
|
|
38132
|
+
s2 = (function({ originalHeight: t15, originalWidth: e4, maxHiddenDots: i4, maxHiddenAxisDots: r5, dotSize: n3 }) {
|
|
38122
38133
|
const o2 = { x: 0, y: 0 }, s3 = { x: 0, y: 0 };
|
|
38123
|
-
if (
|
|
38124
|
-
const a3 =
|
|
38134
|
+
if (t15 <= 0 || e4 <= 0 || i4 <= 0 || n3 <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 };
|
|
38135
|
+
const a3 = t15 / e4;
|
|
38125
38136
|
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 };
|
|
38126
38137
|
})({ originalWidth: this._image.width, originalHeight: this._image.height, maxHiddenDots: a2, maxHiddenAxisDots: e3 - 14, dotSize: n2 });
|
|
38127
38138
|
}
|
|
38128
|
-
this.drawBackground(), this.drawDots(((
|
|
38139
|
+
this.drawBackground(), this.drawDots(((t14, i3) => {
|
|
38129
38140
|
var r4, n3, o2, a2, h2, d2;
|
|
38130
|
-
return !(this._options.imageOptions.hideBackgroundDots &&
|
|
38141
|
+
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]));
|
|
38131
38142
|
})), this.drawCorners(), this._options.image && await this.drawImage({ width: s2.width, height: s2.height, count: e3, dotSize: n2 });
|
|
38132
38143
|
}
|
|
38133
38144
|
drawBackground() {
|
|
38134
|
-
var
|
|
38145
|
+
var t13, e3, i2;
|
|
38135
38146
|
const r3 = this._element, n2 = this._options;
|
|
38136
38147
|
if (r3) {
|
|
38137
|
-
const r4 = null === (
|
|
38148
|
+
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;
|
|
38138
38149
|
let s2 = n2.height, a2 = n2.width;
|
|
38139
38150
|
if (r4 || o2) {
|
|
38140
|
-
const
|
|
38141
|
-
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),
|
|
38151
|
+
const t14 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
38152
|
+
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}` });
|
|
38142
38153
|
}
|
|
38143
38154
|
}
|
|
38144
38155
|
}
|
|
38145
|
-
drawDots(
|
|
38156
|
+
drawDots(t13) {
|
|
38146
38157
|
var e3, i2;
|
|
38147
38158
|
if (!this._qr) throw "QR code is not defined";
|
|
38148
38159
|
const r3 = this._options, n2 = this._qr.getModuleCount();
|
|
38149
38160
|
if (n2 > r3.width || n2 > r3.height) throw "The canvas is too small.";
|
|
38150
38161
|
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 });
|
|
38151
38162
|
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}` });
|
|
38152
|
-
for (let e4 = 0; e4 < n2; e4++) for (let r4 = 0; r4 < n2; r4++)
|
|
38163
|
+
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));
|
|
38153
38164
|
if (r3.shape === g) {
|
|
38154
|
-
const
|
|
38165
|
+
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);
|
|
38155
38166
|
for (let i4 = 0; i4 < e4; i4++) {
|
|
38156
38167
|
s2[i4] = [];
|
|
38157
|
-
for (let r5 = 0; r5 < e4; r5++) i4 >=
|
|
38168
|
+
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;
|
|
38158
38169
|
}
|
|
38159
|
-
for (let
|
|
38170
|
+
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) => {
|
|
38160
38171
|
var r5;
|
|
38161
|
-
return !!(null === (r5 = s2[
|
|
38172
|
+
return !!(null === (r5 = s2[t15 + i4]) || void 0 === r5 ? void 0 : r5[n3 + e5]);
|
|
38162
38173
|
})), c2._element && this._dotsClipPath && this._dotsClipPath.appendChild(c2._element));
|
|
38163
38174
|
}
|
|
38164
38175
|
}
|
|
38165
38176
|
drawCorners() {
|
|
38166
38177
|
if (!this._qr) throw "QR code is not defined";
|
|
38167
|
-
const
|
|
38168
|
-
if (!
|
|
38178
|
+
const t13 = this._element, e3 = this._options;
|
|
38179
|
+
if (!t13) throw "Element code is not defined";
|
|
38169
38180
|
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);
|
|
38170
|
-
[[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([
|
|
38181
|
+
[[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([t14, r4, n3]) => {
|
|
38171
38182
|
var g2, _2, m2, b2, y2, x2, S2, C2, A2, M2, $2, O, D, k;
|
|
38172
|
-
const z = p2 +
|
|
38183
|
+
const z = p2 + t14 * o2 * (i2 - 7), B = v2 + r4 * o2 * (i2 - 7);
|
|
38173
38184
|
let P = this._dotsClipPath, I = this._dotsClipPath;
|
|
38174
|
-
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-${
|
|
38175
|
-
const
|
|
38176
|
-
|
|
38185
|
+
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)) {
|
|
38186
|
+
const t15 = new d({ svg: this._element, type: e3.cornersSquareOptions.type, window: this._window });
|
|
38187
|
+
t15.draw(z, B, a2, n3), t15._element && P && P.appendChild(t15._element);
|
|
38177
38188
|
} else {
|
|
38178
|
-
const
|
|
38179
|
-
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]) && (
|
|
38189
|
+
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 });
|
|
38190
|
+
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) => {
|
|
38180
38191
|
var n4;
|
|
38181
|
-
return !!(null === (n4 = f[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 +
|
|
38182
|
-
})),
|
|
38192
|
+
return !!(null === (n4 = f[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t16]);
|
|
38193
|
+
})), t15._element && P && P.appendChild(t15._element));
|
|
38183
38194
|
}
|
|
38184
|
-
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-${
|
|
38185
|
-
const
|
|
38186
|
-
|
|
38195
|
+
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)) {
|
|
38196
|
+
const t15 = new l({ svg: this._element, type: e3.cornersDotOptions.type, window: this._window });
|
|
38197
|
+
t15.draw(z + 2 * o2, B + 2 * o2, u2, n3), t15._element && I && I.appendChild(t15._element);
|
|
38187
38198
|
} else {
|
|
38188
|
-
const
|
|
38189
|
-
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]) && (
|
|
38199
|
+
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 });
|
|
38200
|
+
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) => {
|
|
38190
38201
|
var n4;
|
|
38191
|
-
return !!(null === (n4 = w[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 +
|
|
38192
|
-
})),
|
|
38202
|
+
return !!(null === (n4 = w[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t16]);
|
|
38203
|
+
})), t15._element && I && I.appendChild(t15._element));
|
|
38193
38204
|
}
|
|
38194
38205
|
}));
|
|
38195
38206
|
}
|
|
38196
38207
|
loadImage() {
|
|
38197
|
-
return new Promise(((
|
|
38208
|
+
return new Promise(((t13, e3) => {
|
|
38198
38209
|
var i2;
|
|
38199
38210
|
const r3 = this._options;
|
|
38200
38211
|
if (!r3.image) return e3("Image is not defined");
|
|
38201
38212
|
if (null === (i2 = r3.nodeCanvas) || void 0 === i2 ? void 0 : i2.loadImage) r3.nodeCanvas.loadImage(r3.image).then(((e4) => {
|
|
38202
38213
|
var i3, n2;
|
|
38203
38214
|
if (this._image = e4, this._options.imageOptions.saveAsBlob) {
|
|
38204
|
-
const
|
|
38205
|
-
null === (n2 = null ==
|
|
38215
|
+
const t14 = null === (i3 = r3.nodeCanvas) || void 0 === i3 ? void 0 : i3.createCanvas(this._image.width, this._image.height);
|
|
38216
|
+
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();
|
|
38206
38217
|
}
|
|
38207
|
-
|
|
38218
|
+
t13();
|
|
38208
38219
|
})).catch(e3);
|
|
38209
38220
|
else {
|
|
38210
38221
|
const e4 = new this._window.Image();
|
|
38211
38222
|
"string" == typeof r3.imageOptions.crossOrigin && (e4.crossOrigin = r3.imageOptions.crossOrigin), this._image = e4, e4.onload = async () => {
|
|
38212
|
-
this._options.imageOptions.saveAsBlob && (this._imageUri = await (async function(
|
|
38223
|
+
this._options.imageOptions.saveAsBlob && (this._imageUri = await (async function(t14, e5) {
|
|
38213
38224
|
return new Promise(((i3) => {
|
|
38214
38225
|
const r4 = new e5.XMLHttpRequest();
|
|
38215
38226
|
r4.onload = function() {
|
|
38216
|
-
const
|
|
38217
|
-
|
|
38218
|
-
i3(
|
|
38219
|
-
},
|
|
38220
|
-
}, r4.open("GET",
|
|
38227
|
+
const t15 = new e5.FileReader();
|
|
38228
|
+
t15.onloadend = function() {
|
|
38229
|
+
i3(t15.result);
|
|
38230
|
+
}, t15.readAsDataURL(r4.response);
|
|
38231
|
+
}, r4.open("GET", t14), r4.responseType = "blob", r4.send();
|
|
38221
38232
|
}));
|
|
38222
|
-
})(r3.image || "", this._window)),
|
|
38233
|
+
})(r3.image || "", this._window)), t13();
|
|
38223
38234
|
}, e4.src = r3.image;
|
|
38224
38235
|
}
|
|
38225
38236
|
}));
|
|
38226
38237
|
}
|
|
38227
|
-
async drawImage({ width:
|
|
38228
|
-
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 -
|
|
38238
|
+
async drawImage({ width: t13, height: e3, count: i2, dotSize: r3 }) {
|
|
38239
|
+
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");
|
|
38229
38240
|
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);
|
|
38230
38241
|
}
|
|
38231
|
-
_createColor({ options:
|
|
38242
|
+
_createColor({ options: t13, color: e3, additionalRotation: i2, x: r3, y: n2, height: o2, width: s2, name: a2 }) {
|
|
38232
38243
|
const h2 = s2 > o2 ? s2 : o2, d2 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
38233
|
-
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}')`),
|
|
38244
|
+
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) {
|
|
38234
38245
|
let e4;
|
|
38235
|
-
if ("radial" ===
|
|
38246
|
+
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));
|
|
38236
38247
|
else {
|
|
38237
|
-
const h3 = ((
|
|
38248
|
+
const h3 = ((t13.rotation || 0) + i2) % (2 * Math.PI), d3 = (h3 + 2 * Math.PI) % (2 * Math.PI);
|
|
38238
38249
|
let u2 = r3 + s2 / 2, c2 = n2 + o2 / 2, l2 = r3 + s2 / 2, g2 = n2 + o2 / 2;
|
|
38239
38250
|
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)));
|
|
38240
38251
|
}
|
|
38241
|
-
|
|
38252
|
+
t13.colorStops.forEach((({ offset: t14, color: i3 }) => {
|
|
38242
38253
|
const r4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "stop");
|
|
38243
|
-
r4.setAttribute("offset", 100 *
|
|
38254
|
+
r4.setAttribute("offset", 100 * t14 + "%"), r4.setAttribute("stop-color", i3), e4.appendChild(r4);
|
|
38244
38255
|
})), d2.setAttribute("fill", `url('#${a2}')`), this._defs.appendChild(e4);
|
|
38245
38256
|
} else e3 && d2.setAttribute("fill", e3);
|
|
38246
38257
|
this._element.appendChild(d2);
|
|
@@ -38248,119 +38259,119 @@ var require_qr_code_styling = __commonJS2({
|
|
|
38248
38259
|
}
|
|
38249
38260
|
p.instanceCount = 0;
|
|
38250
38261
|
const v = p, _ = "canvas", m = {};
|
|
38251
|
-
for (let
|
|
38262
|
+
for (let t13 = 0; t13 <= 40; t13++) m[t13] = t13;
|
|
38252
38263
|
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" } };
|
|
38253
|
-
function y(
|
|
38254
|
-
const e3 = Object.assign({},
|
|
38264
|
+
function y(t13) {
|
|
38265
|
+
const e3 = Object.assign({}, t13);
|
|
38255
38266
|
if (!e3.colorStops || !e3.colorStops.length) throw "Field 'colorStops' is required in gradient";
|
|
38256
|
-
return e3.rotation ? e3.rotation = Number(e3.rotation) : e3.rotation = 0, e3.colorStops = e3.colorStops.map(((
|
|
38267
|
+
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;
|
|
38257
38268
|
}
|
|
38258
|
-
function x(
|
|
38259
|
-
const e3 = Object.assign({},
|
|
38269
|
+
function x(t13) {
|
|
38270
|
+
const e3 = Object.assign({}, t13);
|
|
38260
38271
|
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;
|
|
38261
38272
|
}
|
|
38262
38273
|
var S = i(873), C = i.n(S);
|
|
38263
|
-
function A(
|
|
38264
|
-
if (!
|
|
38265
|
-
"." ===
|
|
38266
|
-
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" }[
|
|
38267
|
-
if (!e3) throw new Error(`Extension "${
|
|
38274
|
+
function A(t13) {
|
|
38275
|
+
if (!t13) throw new Error("Extension must be defined");
|
|
38276
|
+
"." === t13[0] && (t13 = t13.substring(1));
|
|
38277
|
+
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()];
|
|
38278
|
+
if (!e3) throw new Error(`Extension "${t13}" is not supported`);
|
|
38268
38279
|
return e3;
|
|
38269
38280
|
}
|
|
38270
38281
|
class M {
|
|
38271
|
-
constructor(
|
|
38272
|
-
(null ==
|
|
38282
|
+
constructor(t13) {
|
|
38283
|
+
(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();
|
|
38273
38284
|
}
|
|
38274
|
-
static _clearContainer(
|
|
38275
|
-
|
|
38285
|
+
static _clearContainer(t13) {
|
|
38286
|
+
t13 && (t13.innerHTML = "");
|
|
38276
38287
|
}
|
|
38277
38288
|
_setupSvg() {
|
|
38278
38289
|
if (!this._qr) return;
|
|
38279
|
-
const
|
|
38280
|
-
this._svg =
|
|
38290
|
+
const t13 = new v(this._options, this._window);
|
|
38291
|
+
this._svg = t13.getElement(), this._svgDrawingPromise = t13.drawQR(this._qr).then((() => {
|
|
38281
38292
|
var e3;
|
|
38282
|
-
this._svg && (null === (e3 = this._extension) || void 0 === e3 || e3.call(this,
|
|
38293
|
+
this._svg && (null === (e3 = this._extension) || void 0 === e3 || e3.call(this, t13.getElement(), this._options));
|
|
38283
38294
|
}));
|
|
38284
38295
|
}
|
|
38285
38296
|
_setupCanvas() {
|
|
38286
|
-
var
|
|
38287
|
-
this._qr && ((null === (
|
|
38288
|
-
var
|
|
38297
|
+
var t13, e3;
|
|
38298
|
+
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((() => {
|
|
38299
|
+
var t14;
|
|
38289
38300
|
if (!this._svg) return;
|
|
38290
38301
|
const e4 = this._svg, i2 = new this._window.XMLSerializer().serializeToString(e4), r3 = btoa(i2), n2 = `data:${A("svg")};base64,${r3}`;
|
|
38291
|
-
if (null === (
|
|
38302
|
+
if (null === (t14 = this._options.nodeCanvas) || void 0 === t14 ? void 0 : t14.loadImage) return this._options.nodeCanvas.loadImage(n2).then(((t15) => {
|
|
38292
38303
|
var e5, i3;
|
|
38293
|
-
|
|
38304
|
+
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);
|
|
38294
38305
|
}));
|
|
38295
38306
|
{
|
|
38296
|
-
const
|
|
38307
|
+
const t15 = new this._window.Image();
|
|
38297
38308
|
return new Promise(((e5) => {
|
|
38298
|
-
|
|
38309
|
+
t15.onload = () => {
|
|
38299
38310
|
var i3, r4;
|
|
38300
|
-
null === (r4 = null === (i3 = this._domCanvas) || void 0 === i3 ? void 0 : i3.getContext("2d")) || void 0 === r4 || r4.drawImage(
|
|
38301
|
-
},
|
|
38311
|
+
null === (r4 = null === (i3 = this._domCanvas) || void 0 === i3 ? void 0 : i3.getContext("2d")) || void 0 === r4 || r4.drawImage(t15, 0, 0), e5();
|
|
38312
|
+
}, t15.src = n2;
|
|
38302
38313
|
}));
|
|
38303
38314
|
}
|
|
38304
38315
|
})));
|
|
38305
38316
|
}
|
|
38306
|
-
async _getElement(
|
|
38317
|
+
async _getElement(t13 = "png") {
|
|
38307
38318
|
if (!this._qr) throw "QR code is empty";
|
|
38308
|
-
return "svg" ===
|
|
38319
|
+
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);
|
|
38309
38320
|
}
|
|
38310
|
-
update(
|
|
38311
|
-
M._clearContainer(this._container), this._options =
|
|
38321
|
+
update(t13) {
|
|
38322
|
+
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) {
|
|
38312
38323
|
switch (true) {
|
|
38313
|
-
case /^[0-9]*$/.test(
|
|
38324
|
+
case /^[0-9]*$/.test(t14):
|
|
38314
38325
|
return "Numeric";
|
|
38315
|
-
case /^[0-9A-Z $%*+\-./:]*$/.test(
|
|
38326
|
+
case /^[0-9A-Z $%*+\-./:]*$/.test(t14):
|
|
38316
38327
|
return "Alphanumeric";
|
|
38317
38328
|
default:
|
|
38318
38329
|
return "Byte";
|
|
38319
38330
|
}
|
|
38320
38331
|
})(this._options.data)), this._qr.make(), this._options.type === _ ? this._setupCanvas() : this._setupSvg(), this.append(this._container));
|
|
38321
38332
|
}
|
|
38322
|
-
append(
|
|
38323
|
-
if (
|
|
38324
|
-
if ("function" != typeof
|
|
38325
|
-
this._options.type === _ ? this._domCanvas &&
|
|
38333
|
+
append(t13) {
|
|
38334
|
+
if (t13) {
|
|
38335
|
+
if ("function" != typeof t13.appendChild) throw "Container should be a single DOM node";
|
|
38336
|
+
this._options.type === _ ? this._domCanvas && t13.appendChild(this._domCanvas) : this._svg && t13.appendChild(this._svg), this._container = t13;
|
|
38326
38337
|
}
|
|
38327
38338
|
}
|
|
38328
|
-
applyExtension(
|
|
38329
|
-
if (!
|
|
38330
|
-
this._extension =
|
|
38339
|
+
applyExtension(t13) {
|
|
38340
|
+
if (!t13) throw "Extension function should be defined.";
|
|
38341
|
+
this._extension = t13, this.update();
|
|
38331
38342
|
}
|
|
38332
38343
|
deleteExtension() {
|
|
38333
38344
|
this._extension = void 0, this.update();
|
|
38334
38345
|
}
|
|
38335
|
-
async getRawData(
|
|
38346
|
+
async getRawData(t13 = "png") {
|
|
38336
38347
|
if (!this._qr) throw "QR code is empty";
|
|
38337
|
-
const e3 = await this._getElement(
|
|
38348
|
+
const e3 = await this._getElement(t13), i2 = A(t13);
|
|
38338
38349
|
if (!e3) return null;
|
|
38339
|
-
if ("svg" ===
|
|
38340
|
-
const
|
|
38350
|
+
if ("svg" === t13.toLowerCase()) {
|
|
38351
|
+
const t14 = `<?xml version="1.0" standalone="no"?>\r
|
|
38341
38352
|
${new this._window.XMLSerializer().serializeToString(e3)}`;
|
|
38342
|
-
return "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(
|
|
38353
|
+
return "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(t14) : new Blob([t14], { type: i2 });
|
|
38343
38354
|
}
|
|
38344
|
-
return new Promise(((
|
|
38355
|
+
return new Promise(((t14) => {
|
|
38345
38356
|
const r3 = e3;
|
|
38346
|
-
if ("toBuffer" in r3) if ("image/png" === i2)
|
|
38347
|
-
else if ("image/jpeg" === i2)
|
|
38357
|
+
if ("toBuffer" in r3) if ("image/png" === i2) t14(r3.toBuffer(i2));
|
|
38358
|
+
else if ("image/jpeg" === i2) t14(r3.toBuffer(i2));
|
|
38348
38359
|
else {
|
|
38349
38360
|
if ("application/pdf" !== i2) throw Error("Unsupported extension");
|
|
38350
|
-
|
|
38361
|
+
t14(r3.toBuffer(i2));
|
|
38351
38362
|
}
|
|
38352
|
-
else "toBlob" in r3 && r3.toBlob(
|
|
38363
|
+
else "toBlob" in r3 && r3.toBlob(t14, i2, 1);
|
|
38353
38364
|
}));
|
|
38354
38365
|
}
|
|
38355
|
-
async download(
|
|
38366
|
+
async download(t13) {
|
|
38356
38367
|
if (!this._qr) throw "QR code is empty";
|
|
38357
38368
|
if ("undefined" == typeof Blob) throw "Cannot download in Node.js, call getRawData instead.";
|
|
38358
38369
|
let e3 = "png", i2 = "qr";
|
|
38359
|
-
"string" == typeof
|
|
38370
|
+
"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));
|
|
38360
38371
|
const r3 = await this._getElement(e3);
|
|
38361
38372
|
if (r3) if ("svg" === e3.toLowerCase()) {
|
|
38362
|
-
let
|
|
38363
|
-
|
|
38373
|
+
let t14 = new XMLSerializer().serializeToString(r3);
|
|
38374
|
+
t14 = '<?xml version="1.0" standalone="no"?>\r\n' + t14, n(`data:${A(e3)};charset=utf-8,${encodeURIComponent(t14)}`, `${i2}.svg`);
|
|
38364
38375
|
} else n(r3.toDataURL(A(e3)), `${i2}.${e3}`);
|
|
38365
38376
|
}
|
|
38366
38377
|
}
|
|
@@ -38490,6 +38501,12 @@ var ArrowLeft = createLucideIcon("ArrowLeft", [
|
|
|
38490
38501
|
["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
|
|
38491
38502
|
["path", { d: "M19 12H5", key: "x3x0zl" }]
|
|
38492
38503
|
]);
|
|
38504
|
+
var ArrowUpDown = createLucideIcon("ArrowUpDown", [
|
|
38505
|
+
["path", { d: "m21 16-4 4-4-4", key: "f6ql7i" }],
|
|
38506
|
+
["path", { d: "M17 20V4", key: "1ejh1v" }],
|
|
38507
|
+
["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
|
|
38508
|
+
["path", { d: "M7 4v16", key: "1glfcx" }]
|
|
38509
|
+
]);
|
|
38493
38510
|
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
38494
38511
|
var ChevronDown = createLucideIcon("ChevronDown", [
|
|
38495
38512
|
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
@@ -38502,6 +38519,20 @@ var CircleCheck = createLucideIcon("CircleCheck", [
|
|
|
38502
38519
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
38503
38520
|
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
38504
38521
|
]);
|
|
38522
|
+
var ClipboardPaste = createLucideIcon("ClipboardPaste", [
|
|
38523
|
+
[
|
|
38524
|
+
"path",
|
|
38525
|
+
{ 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" }
|
|
38526
|
+
],
|
|
38527
|
+
[
|
|
38528
|
+
"path",
|
|
38529
|
+
{
|
|
38530
|
+
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",
|
|
38531
|
+
key: "2ik1ml"
|
|
38532
|
+
}
|
|
38533
|
+
],
|
|
38534
|
+
["path", { d: "m17 10 4 4-4 4", key: "vp2hj1" }]
|
|
38535
|
+
]);
|
|
38505
38536
|
var Clock = createLucideIcon("Clock", [
|
|
38506
38537
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
38507
38538
|
["polyline", { points: "12 6 12 12 16 14", key: "68esgv" }]
|
|
@@ -39493,25 +39524,25 @@ function createFocusGuard() {
|
|
|
39493
39524
|
return element;
|
|
39494
39525
|
}
|
|
39495
39526
|
var __assign = function() {
|
|
39496
|
-
__assign = Object.assign || function __assign2(
|
|
39527
|
+
__assign = Object.assign || function __assign2(t11) {
|
|
39497
39528
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
39498
39529
|
s = arguments[i];
|
|
39499
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
39530
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t11[p] = s[p];
|
|
39500
39531
|
}
|
|
39501
|
-
return
|
|
39532
|
+
return t11;
|
|
39502
39533
|
};
|
|
39503
39534
|
return __assign.apply(this, arguments);
|
|
39504
39535
|
};
|
|
39505
39536
|
function __rest(s, e) {
|
|
39506
|
-
var
|
|
39537
|
+
var t11 = {};
|
|
39507
39538
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39508
|
-
|
|
39539
|
+
t11[p] = s[p];
|
|
39509
39540
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
39510
39541
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
39511
39542
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39512
|
-
|
|
39543
|
+
t11[p[i]] = s[p[i]];
|
|
39513
39544
|
}
|
|
39514
|
-
return
|
|
39545
|
+
return t11;
|
|
39515
39546
|
}
|
|
39516
39547
|
function __spreadArray(to, from, pack) {
|
|
39517
39548
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
@@ -40575,16 +40606,16 @@ var Title = DialogTitle;
|
|
|
40575
40606
|
var Description = DialogDescription;
|
|
40576
40607
|
var Close = DialogClose;
|
|
40577
40608
|
function r(e) {
|
|
40578
|
-
var
|
|
40609
|
+
var t11, f, n = "";
|
|
40579
40610
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
40580
40611
|
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
40581
40612
|
var o = e.length;
|
|
40582
|
-
for (
|
|
40613
|
+
for (t11 = 0; t11 < o; t11++) e[t11] && (f = r(e[t11])) && (n && (n += " "), n += f);
|
|
40583
40614
|
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
40584
40615
|
return n;
|
|
40585
40616
|
}
|
|
40586
40617
|
function clsx() {
|
|
40587
|
-
for (var e,
|
|
40618
|
+
for (var e, t11, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t11 = r(e)) && (n && (n += " "), n += t11);
|
|
40588
40619
|
return n;
|
|
40589
40620
|
}
|
|
40590
40621
|
var CLASS_PART_SEPARATOR = "-";
|
|
@@ -43094,6 +43125,11 @@ function getIconUrlWithCdn(iconPath, assetCdnUrl) {
|
|
|
43094
43125
|
const baseUrl = assetCdnUrl.endsWith("/") ? assetCdnUrl.slice(0, -1) : assetCdnUrl;
|
|
43095
43126
|
return `${baseUrl}/api/public${normalizedPath}`;
|
|
43096
43127
|
}
|
|
43128
|
+
var ActionType = /* @__PURE__ */ ((ActionType2) => {
|
|
43129
|
+
ActionType2["Deposit"] = "deposit";
|
|
43130
|
+
ActionType2["Withdraw"] = "withdraw";
|
|
43131
|
+
return ActionType2;
|
|
43132
|
+
})(ActionType || {});
|
|
43097
43133
|
async function createDepositAddress(overrides, publishableKey) {
|
|
43098
43134
|
if (!overrides?.external_user_id) {
|
|
43099
43135
|
throw new Error("external_user_id is required");
|
|
@@ -43104,6 +43140,7 @@ async function createDepositAddress(overrides, publishableKey) {
|
|
|
43104
43140
|
destination_chain_id: overrides?.destination_chain_id || DEFAULT_CONFIG.destinationChainId || "8453",
|
|
43105
43141
|
destination_token_address: overrides?.destination_token_address || DEFAULT_CONFIG.destinationTokenAddress || "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
43106
43142
|
recipient_address: overrides?.recipient_address || DEFAULT_CONFIG.recipientAddress || "0x309a4154a2CD4153Da886E780890C9cb5161553C",
|
|
43143
|
+
...overrides?.action_type ? { action_type: overrides.action_type } : {},
|
|
43107
43144
|
client_metadata: overrides?.client_metadata || {}
|
|
43108
43145
|
};
|
|
43109
43146
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
@@ -43134,9 +43171,13 @@ var ExecutionStatus = /* @__PURE__ */ ((ExecutionStatus2) => {
|
|
|
43134
43171
|
ExecutionStatus2["WAITING"] = "waiting";
|
|
43135
43172
|
return ExecutionStatus2;
|
|
43136
43173
|
})(ExecutionStatus || {});
|
|
43137
|
-
async function queryExecutions(externalUserId, publishableKey) {
|
|
43174
|
+
async function queryExecutions(externalUserId, publishableKey, actionType) {
|
|
43138
43175
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
43139
43176
|
validatePublishableKey(pk);
|
|
43177
|
+
const body = {
|
|
43178
|
+
external_user_id: externalUserId,
|
|
43179
|
+
...actionType ? { action_type: actionType } : {}
|
|
43180
|
+
};
|
|
43140
43181
|
const response = await fetch(
|
|
43141
43182
|
`${API_BASE_URL}/v1/public/direct_executions/query`,
|
|
43142
43183
|
{
|
|
@@ -43146,9 +43187,7 @@ async function queryExecutions(externalUserId, publishableKey) {
|
|
|
43146
43187
|
"x-publishable-key": pk,
|
|
43147
43188
|
"Content-Type": "application/json"
|
|
43148
43189
|
},
|
|
43149
|
-
body: JSON.stringify(
|
|
43150
|
-
external_user_id: externalUserId
|
|
43151
|
-
})
|
|
43190
|
+
body: JSON.stringify(body)
|
|
43152
43191
|
}
|
|
43153
43192
|
);
|
|
43154
43193
|
if (!response.ok) {
|
|
@@ -43176,6 +43215,26 @@ async function pollDirectExecutions(request, publishableKey) {
|
|
|
43176
43215
|
}
|
|
43177
43216
|
return response.json();
|
|
43178
43217
|
}
|
|
43218
|
+
async function getSupportedDestinationTokens(publishableKey) {
|
|
43219
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
43220
|
+
validatePublishableKey(pk);
|
|
43221
|
+
const response = await fetch(
|
|
43222
|
+
`${API_BASE_URL}/v1/public/tokens/supported_destination_tokens`,
|
|
43223
|
+
{
|
|
43224
|
+
method: "GET",
|
|
43225
|
+
headers: {
|
|
43226
|
+
accept: "application/json",
|
|
43227
|
+
"x-publishable-key": pk
|
|
43228
|
+
}
|
|
43229
|
+
}
|
|
43230
|
+
);
|
|
43231
|
+
if (!response.ok) {
|
|
43232
|
+
throw new Error(
|
|
43233
|
+
`Failed to fetch supported destination tokens: ${response.statusText}`
|
|
43234
|
+
);
|
|
43235
|
+
}
|
|
43236
|
+
return response.json();
|
|
43237
|
+
}
|
|
43179
43238
|
async function getSupportedDepositTokens(publishableKey, options2) {
|
|
43180
43239
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
43181
43240
|
validatePublishableKey(pk);
|
|
@@ -48131,6 +48190,7 @@ function useDepositAddress(params) {
|
|
|
48131
48190
|
destinationChainType,
|
|
48132
48191
|
destinationChainId,
|
|
48133
48192
|
destinationTokenAddress,
|
|
48193
|
+
actionType,
|
|
48134
48194
|
enabled = true
|
|
48135
48195
|
} = params;
|
|
48136
48196
|
return useQuery({
|
|
@@ -48142,6 +48202,7 @@ function useDepositAddress(params) {
|
|
|
48142
48202
|
destinationChainType ?? null,
|
|
48143
48203
|
destinationChainId ?? null,
|
|
48144
48204
|
destinationTokenAddress ?? null,
|
|
48205
|
+
actionType ?? null,
|
|
48145
48206
|
publishableKey
|
|
48146
48207
|
],
|
|
48147
48208
|
queryFn: () => createDepositAddress(
|
|
@@ -48150,7 +48211,8 @@ function useDepositAddress(params) {
|
|
|
48150
48211
|
recipient_address: recipientAddress,
|
|
48151
48212
|
destination_chain_type: destinationChainType,
|
|
48152
48213
|
destination_chain_id: destinationChainId,
|
|
48153
|
-
destination_token_address: destinationTokenAddress
|
|
48214
|
+
destination_token_address: destinationTokenAddress,
|
|
48215
|
+
action_type: actionType
|
|
48154
48216
|
},
|
|
48155
48217
|
publishableKey
|
|
48156
48218
|
),
|
|
@@ -48832,6 +48894,30 @@ var en_default2 = {
|
|
|
48832
48894
|
youReceive: "You receive",
|
|
48833
48895
|
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."
|
|
48834
48896
|
}
|
|
48897
|
+
},
|
|
48898
|
+
withdrawModal: {
|
|
48899
|
+
title: "Withdraw",
|
|
48900
|
+
withdrawCrypto: {
|
|
48901
|
+
title: "Withdraw with Crypto",
|
|
48902
|
+
subtitle: "Send to any wallet address"
|
|
48903
|
+
},
|
|
48904
|
+
selectToken: "Select withdrawal token",
|
|
48905
|
+
receiveToken: "Receive token",
|
|
48906
|
+
receiveChain: "Receive chain",
|
|
48907
|
+
recipientAddress: "Recipient address",
|
|
48908
|
+
recipientAddressPlaceholder: "Enter wallet address",
|
|
48909
|
+
amount: "Amount",
|
|
48910
|
+
amountPlaceholder: "0.00",
|
|
48911
|
+
balance: "Balance",
|
|
48912
|
+
minimum: "min",
|
|
48913
|
+
withdraw: "Withdraw",
|
|
48914
|
+
invalidAddress: "Please enter a valid address",
|
|
48915
|
+
invalidAmount: "Please enter a valid amount",
|
|
48916
|
+
verifyingAddress: "Verifying address...",
|
|
48917
|
+
loading: "Loading...",
|
|
48918
|
+
noTokensAvailable: "No tokens available",
|
|
48919
|
+
review: "Review Withdrawal",
|
|
48920
|
+
back: "Back"
|
|
48835
48921
|
}
|
|
48836
48922
|
};
|
|
48837
48923
|
var i18n2 = en_default2;
|
|
@@ -48910,7 +48996,7 @@ function useDepositPolling({
|
|
|
48910
48996
|
const modalOpenedAt = modalOpenedAtRef.current;
|
|
48911
48997
|
const poll = async () => {
|
|
48912
48998
|
try {
|
|
48913
|
-
const response = await queryExecutions(userId, publishableKey);
|
|
48999
|
+
const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
|
|
48914
49000
|
const cutoff = new Date(modalOpenedAt.getTime() - CUTOFF_BUFFER_MS);
|
|
48915
49001
|
const sortedExecutions = [...response.data].sort((a, b) => {
|
|
48916
49002
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
@@ -49032,7 +49118,8 @@ function formatCurrency(currency) {
|
|
|
49032
49118
|
}
|
|
49033
49119
|
function DepositDetailContent({
|
|
49034
49120
|
execution,
|
|
49035
|
-
className
|
|
49121
|
+
className,
|
|
49122
|
+
variant = "deposit"
|
|
49036
49123
|
}) {
|
|
49037
49124
|
const { colors: colors2, fonts, components } = useTheme();
|
|
49038
49125
|
const [chains, setChains] = (0, import_react13.useState)([]);
|
|
@@ -49438,7 +49525,7 @@ function DepositDetailContent({
|
|
|
49438
49525
|
color: components.card.rowLeftLabel,
|
|
49439
49526
|
fontFamily: fonts.regular
|
|
49440
49527
|
},
|
|
49441
|
-
children: "Deposit Tx"
|
|
49528
|
+
children: variant === "withdraw" ? "Withdrawal Tx" : "Deposit Tx"
|
|
49442
49529
|
}
|
|
49443
49530
|
),
|
|
49444
49531
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
@@ -54564,7 +54651,7 @@ function DepositsModal({
|
|
|
54564
54651
|
if (!open || !userId) return;
|
|
54565
54652
|
const fetchExecutions = async () => {
|
|
54566
54653
|
try {
|
|
54567
|
-
const response = await queryExecutions(userId, publishableKey);
|
|
54654
|
+
const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
|
|
54568
54655
|
const sorted = [...response.data].sort((a, b) => {
|
|
54569
54656
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
54570
54657
|
const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
@@ -54681,7 +54768,7 @@ function saveRecentToken(token) {
|
|
|
54681
54768
|
try {
|
|
54682
54769
|
const recent = getRecentTokens();
|
|
54683
54770
|
const filtered = recent.filter(
|
|
54684
|
-
(
|
|
54771
|
+
(t11) => !(t11.symbol === token.symbol && t11.chainType === token.chainType && t11.chainId === token.chainId)
|
|
54685
54772
|
);
|
|
54686
54773
|
filtered.unshift(token);
|
|
54687
54774
|
const trimmed = filtered.slice(0, MAX_RECENT_TOKENS);
|
|
@@ -54694,7 +54781,7 @@ function removeRecentToken(token) {
|
|
|
54694
54781
|
try {
|
|
54695
54782
|
const recent = getRecentTokens();
|
|
54696
54783
|
const filtered = recent.filter(
|
|
54697
|
-
(
|
|
54784
|
+
(t11) => !(t11.symbol === token.symbol && t11.chainType === token.chainType && t11.chainId === token.chainId)
|
|
54698
54785
|
);
|
|
54699
54786
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(filtered));
|
|
54700
54787
|
return filtered;
|
|
@@ -54733,7 +54820,7 @@ function TokenSelectorSheet({
|
|
|
54733
54820
|
const addOption = (symbol, chainType, chainId, isRecent) => {
|
|
54734
54821
|
const key = `${symbol}-${chainType}:${chainId}`;
|
|
54735
54822
|
if (seen.has(key)) return;
|
|
54736
|
-
const tokenData = tokens.find((
|
|
54823
|
+
const tokenData = tokens.find((t11) => t11.symbol === symbol);
|
|
54737
54824
|
if (!tokenData) return;
|
|
54738
54825
|
const chainData = tokenData.chains.find(
|
|
54739
54826
|
(c) => c.chain_type === chainType && c.chain_id === chainId
|
|
@@ -55198,35 +55285,35 @@ function resolveSourceToken(supportedTokens, defaultSourceChainType, defaultSour
|
|
|
55198
55285
|
let selectedChainData;
|
|
55199
55286
|
const hasChainDefaults = defaultSourceChainType && defaultSourceChainId;
|
|
55200
55287
|
if (defaultSourceTokenAddress && hasChainDefaults) {
|
|
55201
|
-
for (const
|
|
55202
|
-
const matchingChain =
|
|
55288
|
+
for (const t11 of supportedTokens) {
|
|
55289
|
+
const matchingChain = t11.chains.find(
|
|
55203
55290
|
(c) => c.token_address.toLowerCase() === defaultSourceTokenAddress.toLowerCase() && c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
|
|
55204
55291
|
);
|
|
55205
55292
|
if (matchingChain) {
|
|
55206
|
-
selectedTokenData =
|
|
55293
|
+
selectedTokenData = t11;
|
|
55207
55294
|
selectedChainData = matchingChain;
|
|
55208
55295
|
break;
|
|
55209
55296
|
}
|
|
55210
55297
|
}
|
|
55211
55298
|
}
|
|
55212
55299
|
if (!selectedTokenData && defaultSourceSymbol && hasChainDefaults) {
|
|
55213
|
-
for (const
|
|
55214
|
-
if (
|
|
55215
|
-
const matchedChain =
|
|
55300
|
+
for (const t11 of supportedTokens) {
|
|
55301
|
+
if (t11.symbol !== defaultSourceSymbol) continue;
|
|
55302
|
+
const matchedChain = t11.chains.find(
|
|
55216
55303
|
(c) => c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
|
|
55217
55304
|
);
|
|
55218
55305
|
if (matchedChain) {
|
|
55219
|
-
selectedTokenData =
|
|
55306
|
+
selectedTokenData = t11;
|
|
55220
55307
|
selectedChainData = matchedChain;
|
|
55221
55308
|
break;
|
|
55222
55309
|
}
|
|
55223
55310
|
}
|
|
55224
55311
|
}
|
|
55225
55312
|
if (!selectedTokenData) {
|
|
55226
|
-
for (const
|
|
55227
|
-
if (
|
|
55228
|
-
selectedTokenData =
|
|
55229
|
-
selectedChainData =
|
|
55313
|
+
for (const t11 of supportedTokens) {
|
|
55314
|
+
if (t11.chains.length > 0) {
|
|
55315
|
+
selectedTokenData = t11;
|
|
55316
|
+
selectedChainData = t11.chains[0];
|
|
55230
55317
|
break;
|
|
55231
55318
|
}
|
|
55232
55319
|
}
|
|
@@ -55275,7 +55362,7 @@ function useDefaultSourceToken({
|
|
|
55275
55362
|
]);
|
|
55276
55363
|
(0, import_react20.useEffect)(() => {
|
|
55277
55364
|
if (!supportedTokens.length || !token) return;
|
|
55278
|
-
const currentToken = supportedTokens.find((
|
|
55365
|
+
const currentToken = supportedTokens.find((t11) => t11.symbol === token);
|
|
55279
55366
|
if (!currentToken || currentToken.chains.length === 0) return;
|
|
55280
55367
|
const isChainAvailable = chain && currentToken.chains.some((c) => {
|
|
55281
55368
|
return getChainKey(c.chain_id, c.chain_type) === chain;
|
|
@@ -55556,8 +55643,8 @@ function TransferCryptoSingleInput({
|
|
|
55556
55643
|
const error = walletsError?.message ?? null;
|
|
55557
55644
|
const allAvailableChains = (0, import_react16.useMemo)(() => {
|
|
55558
55645
|
const chainsMap = /* @__PURE__ */ new Map();
|
|
55559
|
-
supportedTokens.forEach((
|
|
55560
|
-
|
|
55646
|
+
supportedTokens.forEach((t11) => {
|
|
55647
|
+
t11.chains.forEach((c) => {
|
|
55561
55648
|
const comboKey = `${c.chain_type}:${c.chain_id}`;
|
|
55562
55649
|
if (!chainsMap.has(comboKey)) {
|
|
55563
55650
|
chainsMap.set(comboKey, c);
|
|
@@ -55592,7 +55679,7 @@ function TransferCryptoSingleInput({
|
|
|
55592
55679
|
onExecutionsChange(depositExecutions);
|
|
55593
55680
|
}
|
|
55594
55681
|
}, [depositExecutions, onExecutionsChange]);
|
|
55595
|
-
const selectedToken = token ? supportedTokens.find((
|
|
55682
|
+
const selectedToken = token ? supportedTokens.find((t11) => t11.symbol === token) : void 0;
|
|
55596
55683
|
const availableChainsForToken = selectedToken?.chains || [];
|
|
55597
55684
|
const currentChainFromBackend = chain ? availableChainsForToken.find((c) => {
|
|
55598
55685
|
const key = getChainKey2(c.chain_id, c.chain_type);
|
|
@@ -55606,7 +55693,7 @@ function TransferCryptoSingleInput({
|
|
|
55606
55693
|
setCopied(true);
|
|
55607
55694
|
setTimeout(() => setCopied(false), 2e3);
|
|
55608
55695
|
};
|
|
55609
|
-
const
|
|
55696
|
+
const formatProcessingTime3 = (seconds) => {
|
|
55610
55697
|
if (seconds === null) {
|
|
55611
55698
|
return t4.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
|
|
55612
55699
|
}
|
|
@@ -55815,7 +55902,7 @@ function TransferCryptoSingleInput({
|
|
|
55815
55902
|
t4.processingTime.label,
|
|
55816
55903
|
":",
|
|
55817
55904
|
" ",
|
|
55818
|
-
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children:
|
|
55905
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime3(processingTime) })
|
|
55819
55906
|
] })
|
|
55820
55907
|
] }),
|
|
55821
55908
|
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 } })
|
|
@@ -56114,8 +56201,8 @@ function TransferCryptoDoubleInput({
|
|
|
56114
56201
|
const error = walletsError?.message ?? null;
|
|
56115
56202
|
const allAvailableChains = (0, import_react23.useMemo)(() => {
|
|
56116
56203
|
const chainsMap = /* @__PURE__ */ new Map();
|
|
56117
|
-
supportedTokens.forEach((
|
|
56118
|
-
|
|
56204
|
+
supportedTokens.forEach((t11) => {
|
|
56205
|
+
t11.chains.forEach((c) => {
|
|
56119
56206
|
const comboKey = `${c.chain_type}:${c.chain_id}`;
|
|
56120
56207
|
if (!chainsMap.has(comboKey)) {
|
|
56121
56208
|
chainsMap.set(comboKey, c);
|
|
@@ -56150,7 +56237,7 @@ function TransferCryptoDoubleInput({
|
|
|
56150
56237
|
onExecutionsChange(depositExecutions);
|
|
56151
56238
|
}
|
|
56152
56239
|
}, [depositExecutions, onExecutionsChange]);
|
|
56153
|
-
const selectedToken = token ? supportedTokens.find((
|
|
56240
|
+
const selectedToken = token ? supportedTokens.find((t11) => t11.symbol === token) : void 0;
|
|
56154
56241
|
const availableChainsForToken = selectedToken?.chains || [];
|
|
56155
56242
|
const currentChainFromBackend = chain ? availableChainsForToken.find((c) => {
|
|
56156
56243
|
const key = getChainKey3(c.chain_id, c.chain_type);
|
|
@@ -56164,7 +56251,7 @@ function TransferCryptoDoubleInput({
|
|
|
56164
56251
|
setCopied(true);
|
|
56165
56252
|
setTimeout(() => setCopied(false), 2e3);
|
|
56166
56253
|
};
|
|
56167
|
-
const
|
|
56254
|
+
const formatProcessingTime3 = (seconds) => {
|
|
56168
56255
|
if (seconds === null) {
|
|
56169
56256
|
return t5.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
|
|
56170
56257
|
}
|
|
@@ -56391,7 +56478,7 @@ function TransferCryptoDoubleInput({
|
|
|
56391
56478
|
t5.processingTime.label,
|
|
56392
56479
|
":",
|
|
56393
56480
|
" ",
|
|
56394
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children:
|
|
56481
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime3(processingTime) })
|
|
56395
56482
|
] })
|
|
56396
56483
|
] }),
|
|
56397
56484
|
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 } })
|
|
@@ -57435,7 +57522,7 @@ function BrowserWalletModal({
|
|
|
57435
57522
|
);
|
|
57436
57523
|
if (cancelled) return;
|
|
57437
57524
|
const supportedToken = response.data.find(
|
|
57438
|
-
(
|
|
57525
|
+
(t11) => t11.symbol.toLowerCase() === token.symbol.toLowerCase()
|
|
57439
57526
|
);
|
|
57440
57527
|
if (supportedToken) {
|
|
57441
57528
|
const chainDetail = supportedToken.chains.find(
|
|
@@ -58743,7 +58830,7 @@ function DepositModal({
|
|
|
58743
58830
|
if (view !== "tracker" || !userId) return;
|
|
58744
58831
|
const fetchExecutions = async () => {
|
|
58745
58832
|
try {
|
|
58746
|
-
const response = await queryExecutions(userId, publishableKey);
|
|
58833
|
+
const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
|
|
58747
58834
|
const sorted = [...response.data].sort((a, b) => {
|
|
58748
58835
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
58749
58836
|
const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
@@ -59262,175 +59349,1989 @@ function DepositModal({
|
|
|
59262
59349
|
}
|
|
59263
59350
|
) });
|
|
59264
59351
|
}
|
|
59265
|
-
function
|
|
59266
|
-
|
|
59352
|
+
function useSupportedDestinationTokens(publishableKey, enabled = true) {
|
|
59353
|
+
return useQuery({
|
|
59354
|
+
queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
|
|
59355
|
+
queryFn: () => getSupportedDestinationTokens(publishableKey),
|
|
59356
|
+
staleTime: 1e3 * 60 * 5,
|
|
59357
|
+
gcTime: 1e3 * 60 * 30,
|
|
59358
|
+
refetchOnMount: false,
|
|
59359
|
+
refetchOnWindowFocus: false,
|
|
59360
|
+
enabled
|
|
59361
|
+
});
|
|
59362
|
+
}
|
|
59363
|
+
function useSourceTokenValidation(params) {
|
|
59364
|
+
const {
|
|
59365
|
+
sourceChainType,
|
|
59366
|
+
sourceChainId,
|
|
59367
|
+
sourceTokenAddress,
|
|
59368
|
+
sourceTokenSymbol,
|
|
59369
|
+
publishableKey,
|
|
59370
|
+
enabled = true
|
|
59371
|
+
} = params;
|
|
59372
|
+
const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
|
|
59373
|
+
return useQuery({
|
|
59374
|
+
queryKey: [
|
|
59375
|
+
"unifold",
|
|
59376
|
+
"sourceTokenValidation",
|
|
59377
|
+
sourceChainType ?? null,
|
|
59378
|
+
sourceChainId ?? null,
|
|
59379
|
+
sourceTokenAddress ?? null,
|
|
59380
|
+
publishableKey
|
|
59381
|
+
],
|
|
59382
|
+
queryFn: async () => {
|
|
59383
|
+
const res = await getSupportedDepositTokens(publishableKey);
|
|
59384
|
+
let matchedMinUsd = null;
|
|
59385
|
+
let matchedProcessingTime = null;
|
|
59386
|
+
let matchedSlippage = null;
|
|
59387
|
+
let matchedPriceImpact = null;
|
|
59388
|
+
const found = res.data.some(
|
|
59389
|
+
(token) => token.chains.some((chain) => {
|
|
59390
|
+
const match = chain.chain_type === sourceChainType && chain.chain_id === sourceChainId && chain.token_address.toLowerCase() === sourceTokenAddress.toLowerCase();
|
|
59391
|
+
if (match) {
|
|
59392
|
+
matchedMinUsd = chain.minimum_deposit_amount_usd;
|
|
59393
|
+
matchedProcessingTime = chain.estimated_processing_time;
|
|
59394
|
+
matchedSlippage = chain.max_slippage_percent;
|
|
59395
|
+
matchedPriceImpact = chain.estimated_price_impact_percent;
|
|
59396
|
+
}
|
|
59397
|
+
return match;
|
|
59398
|
+
})
|
|
59399
|
+
);
|
|
59400
|
+
return {
|
|
59401
|
+
isSupported: found,
|
|
59402
|
+
minimumAmountUsd: matchedMinUsd,
|
|
59403
|
+
estimatedProcessingTime: matchedProcessingTime,
|
|
59404
|
+
maxSlippagePercent: matchedSlippage,
|
|
59405
|
+
priceImpactPercent: matchedPriceImpact,
|
|
59406
|
+
errorMessage: found ? null : `${sourceTokenSymbol || "Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`
|
|
59407
|
+
};
|
|
59408
|
+
},
|
|
59409
|
+
enabled: enabled && hasParams,
|
|
59410
|
+
staleTime: 1e3 * 60 * 5,
|
|
59411
|
+
gcTime: 1e3 * 60 * 30,
|
|
59412
|
+
refetchOnMount: false,
|
|
59413
|
+
refetchOnWindowFocus: false
|
|
59414
|
+
});
|
|
59415
|
+
}
|
|
59416
|
+
function useAddressBalance(params) {
|
|
59417
|
+
const {
|
|
59418
|
+
address,
|
|
59419
|
+
chainType,
|
|
59420
|
+
chainId,
|
|
59421
|
+
tokenAddress,
|
|
59422
|
+
publishableKey,
|
|
59423
|
+
enabled = true
|
|
59424
|
+
} = params;
|
|
59425
|
+
const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
|
|
59426
|
+
return useQuery({
|
|
59427
|
+
queryKey: [
|
|
59428
|
+
"unifold",
|
|
59429
|
+
"addressBalance",
|
|
59430
|
+
address ?? null,
|
|
59431
|
+
chainType ?? null,
|
|
59432
|
+
chainId ?? null,
|
|
59433
|
+
tokenAddress ?? null,
|
|
59434
|
+
publishableKey
|
|
59435
|
+
],
|
|
59436
|
+
queryFn: async () => {
|
|
59437
|
+
const res = await getAddressBalance(
|
|
59438
|
+
address,
|
|
59439
|
+
chainType,
|
|
59440
|
+
chainId,
|
|
59441
|
+
tokenAddress,
|
|
59442
|
+
publishableKey
|
|
59443
|
+
);
|
|
59444
|
+
if (res.balance) {
|
|
59445
|
+
const decimals = res.balance.token?.decimals ?? 6;
|
|
59446
|
+
const symbol = res.balance.token?.symbol ?? "";
|
|
59447
|
+
const baseUnit = res.balance.amount;
|
|
59448
|
+
const raw = BigInt(baseUnit);
|
|
59449
|
+
const divisor = BigInt(10 ** decimals);
|
|
59450
|
+
const whole = raw / divisor;
|
|
59451
|
+
const frac = raw % divisor;
|
|
59452
|
+
const fracStr = frac.toString().padStart(decimals, "0").replace(/0+$/, "");
|
|
59453
|
+
const balanceHuman = fracStr ? `${whole}.${fracStr}` : whole.toString();
|
|
59454
|
+
return {
|
|
59455
|
+
balanceBaseUnit: baseUnit,
|
|
59456
|
+
balanceHuman,
|
|
59457
|
+
balanceUsd: res.balance.amount_usd,
|
|
59458
|
+
exchangeRate: res.balance.exchange_rate,
|
|
59459
|
+
decimals,
|
|
59460
|
+
symbol
|
|
59461
|
+
};
|
|
59462
|
+
}
|
|
59463
|
+
return { balanceBaseUnit: "0", balanceHuman: "0", balanceUsd: "0", exchangeRate: null, decimals: 6, symbol: "" };
|
|
59464
|
+
},
|
|
59465
|
+
enabled: enabled && hasParams,
|
|
59466
|
+
staleTime: 1e3 * 30,
|
|
59467
|
+
gcTime: 1e3 * 60 * 5,
|
|
59468
|
+
refetchInterval: 1e3 * 30,
|
|
59469
|
+
refetchOnMount: "always",
|
|
59470
|
+
refetchOnWindowFocus: false
|
|
59471
|
+
});
|
|
59472
|
+
}
|
|
59473
|
+
function useExecutions(userId, publishableKey, options2) {
|
|
59474
|
+
const actionType = options2?.actionType ?? ActionType.Deposit;
|
|
59475
|
+
return useQuery({
|
|
59476
|
+
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
59477
|
+
queryFn: () => queryExecutions(userId, publishableKey, actionType),
|
|
59478
|
+
enabled: (options2?.enabled ?? true) && !!userId,
|
|
59479
|
+
refetchInterval: options2?.refetchInterval ?? 3e3,
|
|
59480
|
+
staleTime: 0,
|
|
59481
|
+
gcTime: 1e3 * 60 * 5,
|
|
59482
|
+
refetchOnWindowFocus: false
|
|
59483
|
+
});
|
|
59484
|
+
}
|
|
59485
|
+
var POLL_INTERVAL_MS2 = 2500;
|
|
59486
|
+
var POLL_ENDPOINT_INTERVAL_MS2 = 3e3;
|
|
59487
|
+
var CUTOFF_BUFFER_MS2 = 6e4;
|
|
59488
|
+
function useWithdrawPolling({
|
|
59489
|
+
userId,
|
|
59267
59490
|
publishableKey,
|
|
59268
|
-
|
|
59491
|
+
depositWalletId,
|
|
59492
|
+
enabled = false,
|
|
59493
|
+
onWithdrawSuccess,
|
|
59494
|
+
onWithdrawError
|
|
59269
59495
|
}) {
|
|
59270
|
-
const [
|
|
59271
|
-
const [
|
|
59272
|
-
|
|
59273
|
-
);
|
|
59274
|
-
const
|
|
59275
|
-
(0,
|
|
59276
|
-
|
|
59277
|
-
|
|
59278
|
-
|
|
59279
|
-
}, [
|
|
59280
|
-
|
|
59281
|
-
|
|
59282
|
-
|
|
59283
|
-
|
|
59284
|
-
|
|
59285
|
-
|
|
59286
|
-
|
|
59287
|
-
setResolvedTheme(e.matches ? "dark" : "light");
|
|
59288
|
-
};
|
|
59289
|
-
mediaQuery.addEventListener("change", handler);
|
|
59290
|
-
return () => mediaQuery.removeEventListener("change", handler);
|
|
59291
|
-
} else {
|
|
59292
|
-
setResolvedTheme(appearance);
|
|
59293
|
-
}
|
|
59294
|
-
}, [config?.appearance]);
|
|
59295
|
-
const depositPromiseRef = import_react.default.useRef(null);
|
|
59296
|
-
const depositConfigRef = import_react.default.useRef(null);
|
|
59297
|
-
depositConfigRef.current = depositConfig;
|
|
59298
|
-
const closeTimeoutRef = import_react.default.useRef(null);
|
|
59299
|
-
const closeGuardRef = import_react.default.useRef(false);
|
|
59300
|
-
const beginDeposit = (0, import_react.useCallback)((config2) => {
|
|
59301
|
-
if (closeTimeoutRef.current) {
|
|
59302
|
-
clearTimeout(closeTimeoutRef.current);
|
|
59303
|
-
closeTimeoutRef.current = null;
|
|
59304
|
-
}
|
|
59305
|
-
closeGuardRef.current = false;
|
|
59306
|
-
if (depositPromiseRef.current) {
|
|
59307
|
-
console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit.");
|
|
59308
|
-
depositPromiseRef.current.reject({
|
|
59309
|
-
message: "Deposit cancelled - new deposit started",
|
|
59310
|
-
code: "DEPOSIT_SUPERSEDED"
|
|
59311
|
-
});
|
|
59312
|
-
depositPromiseRef.current = null;
|
|
59313
|
-
}
|
|
59314
|
-
const promise = new Promise((resolve, reject) => {
|
|
59315
|
-
depositPromiseRef.current = { resolve, reject };
|
|
59316
|
-
});
|
|
59317
|
-
promise.catch(() => {
|
|
59318
|
-
});
|
|
59319
|
-
setDepositConfig(config2);
|
|
59320
|
-
setIsOpen(true);
|
|
59321
|
-
return promise;
|
|
59322
|
-
}, []);
|
|
59323
|
-
const closeDeposit = (0, import_react.useCallback)(() => {
|
|
59324
|
-
if (closeGuardRef.current) {
|
|
59325
|
-
return;
|
|
59326
|
-
}
|
|
59327
|
-
closeGuardRef.current = true;
|
|
59328
|
-
const promiseToReject = depositPromiseRef.current;
|
|
59329
|
-
depositPromiseRef.current = null;
|
|
59330
|
-
if (depositConfigRef.current?.onClose) {
|
|
59331
|
-
depositConfigRef.current.onClose();
|
|
59332
|
-
}
|
|
59333
|
-
if (promiseToReject) {
|
|
59334
|
-
promiseToReject.reject({
|
|
59335
|
-
message: "Deposit cancelled by user",
|
|
59336
|
-
code: "DEPOSIT_CANCELLED"
|
|
59337
|
-
});
|
|
59338
|
-
}
|
|
59339
|
-
setIsOpen(false);
|
|
59340
|
-
closeTimeoutRef.current = setTimeout(() => {
|
|
59341
|
-
setDepositConfig(null);
|
|
59342
|
-
closeTimeoutRef.current = null;
|
|
59343
|
-
}, 200);
|
|
59344
|
-
}, []);
|
|
59345
|
-
const handleDepositSuccess = (0, import_react.useCallback)((data) => {
|
|
59346
|
-
if (depositConfig?.onSuccess) {
|
|
59347
|
-
depositConfig.onSuccess(data);
|
|
59348
|
-
}
|
|
59349
|
-
if (depositPromiseRef.current) {
|
|
59350
|
-
depositPromiseRef.current.resolve(data);
|
|
59351
|
-
depositPromiseRef.current = null;
|
|
59352
|
-
}
|
|
59353
|
-
}, [depositConfig]);
|
|
59354
|
-
const handleDepositError = (0, import_react.useCallback)((error) => {
|
|
59355
|
-
console.error("[UnifoldProvider] Deposit error:", error);
|
|
59356
|
-
if (depositConfig?.onError) {
|
|
59357
|
-
depositConfig.onError(error);
|
|
59496
|
+
const [executions, setExecutions] = (0, import_react28.useState)([]);
|
|
59497
|
+
const [isPolling, setIsPolling] = (0, import_react28.useState)(false);
|
|
59498
|
+
const enabledAtRef = (0, import_react28.useRef)(/* @__PURE__ */ new Date());
|
|
59499
|
+
const trackedRef = (0, import_react28.useRef)(/* @__PURE__ */ new Map());
|
|
59500
|
+
const prevEnabledRef = (0, import_react28.useRef)(false);
|
|
59501
|
+
const onSuccessRef = (0, import_react28.useRef)(onWithdrawSuccess);
|
|
59502
|
+
const onErrorRef = (0, import_react28.useRef)(onWithdrawError);
|
|
59503
|
+
(0, import_react28.useEffect)(() => {
|
|
59504
|
+
onSuccessRef.current = onWithdrawSuccess;
|
|
59505
|
+
}, [onWithdrawSuccess]);
|
|
59506
|
+
(0, import_react28.useEffect)(() => {
|
|
59507
|
+
onErrorRef.current = onWithdrawError;
|
|
59508
|
+
}, [onWithdrawError]);
|
|
59509
|
+
(0, import_react28.useEffect)(() => {
|
|
59510
|
+
if (enabled && !prevEnabledRef.current) {
|
|
59511
|
+
enabledAtRef.current = /* @__PURE__ */ new Date();
|
|
59512
|
+
trackedRef.current.clear();
|
|
59358
59513
|
}
|
|
59359
|
-
if (
|
|
59360
|
-
|
|
59361
|
-
depositPromiseRef.current = null;
|
|
59514
|
+
if (!enabled) {
|
|
59515
|
+
trackedRef.current.clear();
|
|
59362
59516
|
}
|
|
59363
|
-
|
|
59364
|
-
|
|
59365
|
-
|
|
59366
|
-
|
|
59367
|
-
|
|
59368
|
-
|
|
59369
|
-
|
|
59370
|
-
|
|
59371
|
-
|
|
59372
|
-
|
|
59373
|
-
|
|
59374
|
-
|
|
59375
|
-
|
|
59376
|
-
|
|
59377
|
-
|
|
59378
|
-
|
|
59379
|
-
|
|
59380
|
-
|
|
59381
|
-
|
|
59382
|
-
|
|
59383
|
-
|
|
59384
|
-
|
|
59385
|
-
|
|
59386
|
-
|
|
59387
|
-
open: isOpen,
|
|
59388
|
-
onOpenChange: closeDeposit,
|
|
59389
|
-
userId: depositConfig.externalUserId,
|
|
59390
|
-
publishableKey,
|
|
59391
|
-
modalTitle: config?.modalTitle,
|
|
59392
|
-
destinationTokenSymbol: depositConfig.destinationTokenSymbol,
|
|
59393
|
-
recipientAddress: depositConfig.recipientAddress,
|
|
59394
|
-
destinationChainType: depositConfig.destinationChainType,
|
|
59395
|
-
destinationChainId: depositConfig.destinationChainId,
|
|
59396
|
-
destinationTokenAddress: depositConfig.destinationTokenAddress,
|
|
59397
|
-
defaultSourceChainType: depositConfig.defaultSourceChainType,
|
|
59398
|
-
defaultSourceChainId: depositConfig.defaultSourceChainId,
|
|
59399
|
-
defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
|
|
59400
|
-
defaultSourceSymbol: depositConfig.defaultSourceSymbol,
|
|
59401
|
-
depositConfirmationMode: depositConfig.depositConfirmationMode ?? "auto_ui",
|
|
59402
|
-
hideDepositTracker: config?.hideDepositTracker,
|
|
59403
|
-
showBalanceHeader: config?.showBalanceHeader,
|
|
59404
|
-
transferInputVariant: config?.transferInputVariant,
|
|
59405
|
-
enableConnectWallet: config?.enableConnectWallet,
|
|
59406
|
-
enablePayWithExchange: config?.enablePayWithExchange,
|
|
59407
|
-
onDepositSuccess: handleDepositSuccess,
|
|
59408
|
-
onDepositError: handleDepositError,
|
|
59409
|
-
theme: resolvedTheme,
|
|
59410
|
-
initialScreen: depositConfig.initialScreen ?? config?.defaultInitialScreen,
|
|
59411
|
-
transferCryptoTitle: config?.transferCryptoTitle,
|
|
59412
|
-
depositWithCardTitle: config?.depositWithCardTitle,
|
|
59413
|
-
payWithExchangeTitle: config?.payWithExchangeTitle,
|
|
59414
|
-
depositTrackerTitle: config?.depositTrackerTitle,
|
|
59415
|
-
depositTrackerSubTitle: config?.depositTrackerSubTitle,
|
|
59416
|
-
hideDepositFlowInfo: config?.hideDepositFlowInfo,
|
|
59417
|
-
hideDisplayDescription: config?.hideDisplayDescription,
|
|
59418
|
-
browserWalletAmountQuickSelect: config?.browserWalletAmountQuickSelect
|
|
59517
|
+
prevEnabledRef.current = enabled;
|
|
59518
|
+
}, [enabled]);
|
|
59519
|
+
(0, import_react28.useEffect)(() => {
|
|
59520
|
+
if (!userId || !enabled) return;
|
|
59521
|
+
const enabledAt = enabledAtRef.current;
|
|
59522
|
+
const poll = async () => {
|
|
59523
|
+
try {
|
|
59524
|
+
const response = await queryExecutions(userId, publishableKey, ActionType.Withdraw);
|
|
59525
|
+
const cutoff = new Date(enabledAt.getTime() - CUTOFF_BUFFER_MS2);
|
|
59526
|
+
const sorted = [...response.data].sort((a, b) => {
|
|
59527
|
+
const tA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
59528
|
+
const tB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
59529
|
+
return tB - tA;
|
|
59530
|
+
});
|
|
59531
|
+
const inProgress = [ExecutionStatus.PENDING, ExecutionStatus.WAITING, ExecutionStatus.DELAYED];
|
|
59532
|
+
const terminal = [ExecutionStatus.SUCCEEDED, ExecutionStatus.FAILED];
|
|
59533
|
+
let target = null;
|
|
59534
|
+
for (const ex of sorted) {
|
|
59535
|
+
const t11 = ex.created_at ? new Date(ex.created_at) : null;
|
|
59536
|
+
if (!t11 || t11 < cutoff) continue;
|
|
59537
|
+
const prev = trackedRef.current.get(ex.id);
|
|
59538
|
+
if (!prev) {
|
|
59539
|
+
target = ex;
|
|
59540
|
+
break;
|
|
59419
59541
|
}
|
|
59420
|
-
|
|
59421
|
-
|
|
59422
|
-
|
|
59423
|
-
|
|
59424
|
-
}
|
|
59425
|
-
|
|
59426
|
-
|
|
59427
|
-
|
|
59428
|
-
|
|
59429
|
-
|
|
59430
|
-
|
|
59431
|
-
|
|
59432
|
-
|
|
59542
|
+
if (inProgress.includes(prev) && terminal.includes(ex.status)) {
|
|
59543
|
+
target = ex;
|
|
59544
|
+
break;
|
|
59545
|
+
}
|
|
59546
|
+
}
|
|
59547
|
+
if (target) {
|
|
59548
|
+
const ex = target;
|
|
59549
|
+
const exTime = ex.created_at ? new Date(ex.created_at) : null;
|
|
59550
|
+
if (!exTime || exTime < enabledAtRef.current) return;
|
|
59551
|
+
const prev = trackedRef.current.get(ex.id);
|
|
59552
|
+
trackedRef.current.set(ex.id, ex.status);
|
|
59553
|
+
setExecutions((list) => {
|
|
59554
|
+
const idx = list.findIndex((e) => e.id === ex.id);
|
|
59555
|
+
if (idx >= 0) {
|
|
59556
|
+
const u = [...list];
|
|
59557
|
+
u[idx] = ex;
|
|
59558
|
+
return u;
|
|
59559
|
+
}
|
|
59560
|
+
return [...list, ex];
|
|
59561
|
+
});
|
|
59562
|
+
if (ex.status === ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
|
|
59563
|
+
onSuccessRef.current?.({ message: "Withdrawal completed successfully", executionId: ex.id, transaction: ex });
|
|
59564
|
+
} else if (ex.status === ExecutionStatus.FAILED && prev !== ExecutionStatus.FAILED) {
|
|
59565
|
+
onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
|
|
59566
|
+
}
|
|
59567
|
+
}
|
|
59568
|
+
} catch (error) {
|
|
59569
|
+
console.error("Failed to fetch withdraw executions:", error);
|
|
59570
|
+
onErrorRef.current?.({ message: "Failed to fetch withdrawal status", code: "POLLING_ERROR", error });
|
|
59571
|
+
}
|
|
59572
|
+
};
|
|
59573
|
+
void poll();
|
|
59574
|
+
const interval = setInterval(poll, POLL_INTERVAL_MS2);
|
|
59575
|
+
setIsPolling(true);
|
|
59576
|
+
return () => {
|
|
59577
|
+
clearInterval(interval);
|
|
59578
|
+
setIsPolling(false);
|
|
59579
|
+
};
|
|
59580
|
+
}, [userId, publishableKey, enabled]);
|
|
59581
|
+
(0, import_react28.useEffect)(() => {
|
|
59582
|
+
if (!enabled || !depositWalletId) return;
|
|
59583
|
+
const trigger = async () => {
|
|
59584
|
+
try {
|
|
59585
|
+
await pollDirectExecutions({ deposit_wallet_id: depositWalletId }, publishableKey);
|
|
59586
|
+
} catch {
|
|
59587
|
+
}
|
|
59588
|
+
};
|
|
59589
|
+
trigger();
|
|
59590
|
+
const interval = setInterval(trigger, POLL_ENDPOINT_INTERVAL_MS2);
|
|
59591
|
+
return () => clearInterval(interval);
|
|
59592
|
+
}, [enabled, depositWalletId, publishableKey]);
|
|
59593
|
+
return { executions, isPolling };
|
|
59594
|
+
}
|
|
59595
|
+
var t7 = i18n2.withdrawModal;
|
|
59596
|
+
var getChainKey4 = (chainId, chainType) => `${chainType}:${chainId}`;
|
|
59597
|
+
function WithdrawDoubleInput({
|
|
59598
|
+
tokens,
|
|
59599
|
+
selectedTokenSymbol,
|
|
59600
|
+
selectedChainKey,
|
|
59601
|
+
onTokenChange,
|
|
59602
|
+
onChainChange,
|
|
59603
|
+
isLoading = false
|
|
59604
|
+
}) {
|
|
59605
|
+
const { fonts, components } = useTheme();
|
|
59606
|
+
const isDarkMode = useTheme().themeClass.includes("uf-dark");
|
|
59607
|
+
const selectedToken = selectedTokenSymbol ? tokens.find((t11) => t11.symbol === selectedTokenSymbol) : void 0;
|
|
59608
|
+
const availableChainsForToken = selectedToken?.chains || [];
|
|
59609
|
+
const renderTokenItem = (tokenData) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
59610
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59611
|
+
"img",
|
|
59612
|
+
{
|
|
59613
|
+
src: tokenData.icon_url,
|
|
59614
|
+
alt: tokenData.symbol,
|
|
59615
|
+
width: 20,
|
|
59616
|
+
height: 20,
|
|
59617
|
+
loading: "lazy",
|
|
59618
|
+
className: "uf-rounded-full uf-flex-shrink-0"
|
|
59619
|
+
}
|
|
59620
|
+
),
|
|
59621
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-normal", children: tokenData.symbol })
|
|
59622
|
+
] });
|
|
59623
|
+
const renderChainItem = (chainData) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
59624
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59625
|
+
"img",
|
|
59626
|
+
{
|
|
59627
|
+
src: chainData.icon_url,
|
|
59628
|
+
alt: chainData.chain_name,
|
|
59629
|
+
width: 20,
|
|
59630
|
+
height: 20,
|
|
59631
|
+
loading: "lazy",
|
|
59632
|
+
className: "uf-rounded-full uf-flex-shrink-0"
|
|
59633
|
+
}
|
|
59634
|
+
),
|
|
59635
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-normal", children: chainData.chain_name })
|
|
59636
|
+
] });
|
|
59637
|
+
const currentChainData = selectedChainKey ? availableChainsForToken.find(
|
|
59638
|
+
(c) => getChainKey4(c.chain_id, c.chain_type) === selectedChainKey
|
|
59639
|
+
) : void 0;
|
|
59640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-grid uf-grid-cols-2 uf-gap-2.5", children: [
|
|
59641
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { children: [
|
|
59642
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59643
|
+
"div",
|
|
59644
|
+
{
|
|
59645
|
+
className: "uf-text-xs uf-mb-2 uf-flex uf-items-center uf-gap-1",
|
|
59646
|
+
style: { color: components.card.labelColor },
|
|
59647
|
+
children: t7.receiveToken
|
|
59648
|
+
}
|
|
59649
|
+
),
|
|
59650
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
59651
|
+
Select2,
|
|
59652
|
+
{
|
|
59653
|
+
value: selectedTokenSymbol ?? "",
|
|
59654
|
+
onValueChange: onTokenChange,
|
|
59655
|
+
disabled: isLoading || tokens.length === 0,
|
|
59656
|
+
children: [
|
|
59657
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59658
|
+
SelectTrigger2,
|
|
59659
|
+
{
|
|
59660
|
+
className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50",
|
|
59661
|
+
style: {
|
|
59662
|
+
backgroundColor: components.card.backgroundColor,
|
|
59663
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
59664
|
+
},
|
|
59665
|
+
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 }) })
|
|
59666
|
+
}
|
|
59667
|
+
),
|
|
59668
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59669
|
+
SelectContent2,
|
|
59670
|
+
{
|
|
59671
|
+
className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px]",
|
|
59672
|
+
style: {
|
|
59673
|
+
border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`,
|
|
59674
|
+
...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
|
|
59675
|
+
},
|
|
59676
|
+
children: tokens.map((tokenData) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59677
|
+
SelectItem2,
|
|
59678
|
+
{
|
|
59679
|
+
value: tokenData.symbol,
|
|
59680
|
+
className: "focus:uf-bg-accent focus:uf-text-foreground",
|
|
59681
|
+
children: renderTokenItem(tokenData)
|
|
59682
|
+
},
|
|
59683
|
+
tokenData.symbol
|
|
59684
|
+
))
|
|
59685
|
+
}
|
|
59686
|
+
)
|
|
59687
|
+
]
|
|
59688
|
+
}
|
|
59689
|
+
)
|
|
59690
|
+
] }),
|
|
59691
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { children: [
|
|
59692
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59693
|
+
"div",
|
|
59694
|
+
{
|
|
59695
|
+
className: "uf-text-xs uf-mb-2 uf-flex uf-items-center uf-gap-1",
|
|
59696
|
+
style: { color: components.card.labelColor },
|
|
59697
|
+
children: t7.receiveChain
|
|
59698
|
+
}
|
|
59699
|
+
),
|
|
59700
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
59701
|
+
Select2,
|
|
59702
|
+
{
|
|
59703
|
+
value: selectedChainKey ?? "",
|
|
59704
|
+
onValueChange: onChainChange,
|
|
59705
|
+
disabled: isLoading || availableChainsForToken.length === 0,
|
|
59706
|
+
children: [
|
|
59707
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59708
|
+
SelectTrigger2,
|
|
59709
|
+
{
|
|
59710
|
+
className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50",
|
|
59711
|
+
style: {
|
|
59712
|
+
backgroundColor: components.card.backgroundColor,
|
|
59713
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
59714
|
+
},
|
|
59715
|
+
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 }) })
|
|
59716
|
+
}
|
|
59717
|
+
),
|
|
59718
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59719
|
+
SelectContent2,
|
|
59720
|
+
{
|
|
59721
|
+
align: "end",
|
|
59722
|
+
className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px] uf-min-w-[200px]",
|
|
59723
|
+
style: {
|
|
59724
|
+
border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`,
|
|
59725
|
+
...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
|
|
59726
|
+
},
|
|
59727
|
+
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) => {
|
|
59728
|
+
const chainKey = getChainKey4(chainData.chain_id, chainData.chain_type);
|
|
59729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59730
|
+
SelectItem2,
|
|
59731
|
+
{
|
|
59732
|
+
value: chainKey,
|
|
59733
|
+
className: "focus:uf-bg-accent focus:uf-text-foreground",
|
|
59734
|
+
children: renderChainItem(chainData)
|
|
59735
|
+
},
|
|
59736
|
+
chainKey
|
|
59737
|
+
);
|
|
59738
|
+
})
|
|
59739
|
+
}
|
|
59740
|
+
)
|
|
59741
|
+
]
|
|
59742
|
+
}
|
|
59743
|
+
)
|
|
59744
|
+
] })
|
|
59745
|
+
] });
|
|
59746
|
+
}
|
|
59747
|
+
function useVerifyRecipientAddress(params) {
|
|
59748
|
+
const {
|
|
59749
|
+
chainType,
|
|
59750
|
+
chainId,
|
|
59751
|
+
tokenAddress,
|
|
59752
|
+
recipientAddress,
|
|
59753
|
+
publishableKey,
|
|
59754
|
+
enabled = true
|
|
59755
|
+
} = params;
|
|
59756
|
+
const trimmedAddress = recipientAddress?.trim() || "";
|
|
59757
|
+
const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
|
|
59758
|
+
return useQuery({
|
|
59759
|
+
queryKey: [
|
|
59760
|
+
"unifold",
|
|
59761
|
+
"verifyRecipientAddress",
|
|
59762
|
+
chainType ?? null,
|
|
59763
|
+
chainId ?? null,
|
|
59764
|
+
tokenAddress ?? null,
|
|
59765
|
+
trimmedAddress,
|
|
59766
|
+
publishableKey
|
|
59767
|
+
],
|
|
59768
|
+
queryFn: () => verifyRecipientAddress(
|
|
59769
|
+
{
|
|
59770
|
+
chain_type: chainType,
|
|
59771
|
+
chain_id: chainId,
|
|
59772
|
+
token_address: tokenAddress,
|
|
59773
|
+
recipient_address: trimmedAddress
|
|
59774
|
+
},
|
|
59775
|
+
publishableKey
|
|
59776
|
+
),
|
|
59777
|
+
enabled: enabled && hasAllParams,
|
|
59778
|
+
staleTime: 1e3 * 60 * 5,
|
|
59779
|
+
gcTime: 1e3 * 60 * 30,
|
|
59780
|
+
retry: 1,
|
|
59781
|
+
refetchOnMount: false,
|
|
59782
|
+
refetchOnWindowFocus: false
|
|
59783
|
+
});
|
|
59784
|
+
}
|
|
59785
|
+
async function sendEvmWithdraw(params) {
|
|
59786
|
+
const {
|
|
59787
|
+
provider,
|
|
59788
|
+
fromAddress,
|
|
59789
|
+
depositWalletAddress,
|
|
59790
|
+
sourceTokenAddress,
|
|
59791
|
+
sourceChainId,
|
|
59792
|
+
amountBaseUnit
|
|
59793
|
+
} = params;
|
|
59794
|
+
const currentChainIdHex = await provider.request({
|
|
59795
|
+
method: "eth_chainId",
|
|
59796
|
+
params: []
|
|
59797
|
+
});
|
|
59798
|
+
const currentChainId = parseInt(currentChainIdHex, 16).toString();
|
|
59799
|
+
if (currentChainId !== sourceChainId) {
|
|
59800
|
+
const requiredHex = "0x" + parseInt(sourceChainId).toString(16);
|
|
59801
|
+
try {
|
|
59802
|
+
await provider.request({
|
|
59803
|
+
method: "wallet_switchEthereumChain",
|
|
59804
|
+
params: [{ chainId: requiredHex }]
|
|
59805
|
+
});
|
|
59806
|
+
const newHex = await provider.request({ method: "eth_chainId", params: [] });
|
|
59807
|
+
if (parseInt(newHex, 16).toString() !== sourceChainId) {
|
|
59808
|
+
throw new Error(`Failed to switch to chain ${sourceChainId}. Please switch manually.`);
|
|
59809
|
+
}
|
|
59810
|
+
} catch (err) {
|
|
59811
|
+
if (err && typeof err === "object" && "code" in err) {
|
|
59812
|
+
const e = err;
|
|
59813
|
+
if (e.code === 4902) throw new Error(`Chain ${sourceChainId} is not configured in your wallet.`);
|
|
59814
|
+
if (e.code === 4001) throw new Error("You must approve the network switch to withdraw.");
|
|
59815
|
+
}
|
|
59816
|
+
throw err;
|
|
59817
|
+
}
|
|
59818
|
+
}
|
|
59819
|
+
const isNative = sourceTokenAddress === "native" || sourceTokenAddress === "0x0000000000000000000000000000000000000000" || sourceTokenAddress === "";
|
|
59820
|
+
const amountBig = BigInt(amountBaseUnit);
|
|
59821
|
+
const txParams = isNative ? { from: fromAddress, to: depositWalletAddress, value: "0x" + amountBig.toString(16) } : {
|
|
59822
|
+
from: fromAddress,
|
|
59823
|
+
to: sourceTokenAddress,
|
|
59824
|
+
data: "0xa9059cbb" + depositWalletAddress.slice(2).padStart(64, "0") + amountBig.toString(16).padStart(64, "0")
|
|
59825
|
+
};
|
|
59826
|
+
let gasEstimate;
|
|
59827
|
+
try {
|
|
59828
|
+
const hex = await provider.request({ method: "eth_estimateGas", params: [txParams] });
|
|
59829
|
+
gasEstimate = BigInt(hex);
|
|
59830
|
+
} catch {
|
|
59831
|
+
gasEstimate = isNative ? BigInt(21e3) : BigInt(65e3);
|
|
59832
|
+
}
|
|
59833
|
+
const gasPrice = BigInt(await provider.request({ method: "eth_gasPrice", params: [] }));
|
|
59834
|
+
const gasWithBuffer = gasEstimate * BigInt(120) / BigInt(100);
|
|
59835
|
+
const gasCost = gasWithBuffer * gasPrice;
|
|
59836
|
+
const ethBalance = BigInt(
|
|
59837
|
+
await provider.request({ method: "eth_getBalance", params: [fromAddress, "latest"] })
|
|
59838
|
+
);
|
|
59839
|
+
const totalRequired = isNative ? gasCost + amountBig : gasCost;
|
|
59840
|
+
if (ethBalance < totalRequired) {
|
|
59841
|
+
const gasFmt = (Number(gasCost) / 1e18).toFixed(6);
|
|
59842
|
+
if (isNative) {
|
|
59843
|
+
throw new Error(`Insufficient balance. Need ${(Number(totalRequired) / 1e18).toFixed(6)} ETH (amount + ~${gasFmt} gas).`);
|
|
59844
|
+
}
|
|
59845
|
+
throw new Error(`Insufficient ETH for gas. Need ~${gasFmt} ETH for fees.`);
|
|
59846
|
+
}
|
|
59847
|
+
const txHash = await provider.request({ method: "eth_sendTransaction", params: [txParams] });
|
|
59848
|
+
return txHash;
|
|
59849
|
+
}
|
|
59850
|
+
async function sendSolanaWithdraw(params) {
|
|
59851
|
+
const {
|
|
59852
|
+
provider,
|
|
59853
|
+
fromAddress,
|
|
59854
|
+
depositWalletAddress,
|
|
59855
|
+
sourceTokenAddress,
|
|
59856
|
+
amountBaseUnit,
|
|
59857
|
+
publishableKey
|
|
59858
|
+
} = params;
|
|
59859
|
+
if (!provider.publicKey) {
|
|
59860
|
+
await provider.connect();
|
|
59861
|
+
}
|
|
59862
|
+
const buildResponse = await buildSolanaTransaction(
|
|
59863
|
+
{
|
|
59864
|
+
chain_id: "mainnet",
|
|
59865
|
+
token_address: sourceTokenAddress === "" ? "native" : sourceTokenAddress,
|
|
59866
|
+
source_address: fromAddress,
|
|
59867
|
+
destination_address: depositWalletAddress,
|
|
59868
|
+
amount: amountBaseUnit
|
|
59869
|
+
},
|
|
59870
|
+
publishableKey
|
|
59871
|
+
);
|
|
59872
|
+
const { VersionedTransaction } = await import(
|
|
59873
|
+
/* @vite-ignore */
|
|
59874
|
+
"@solana/web3.js"
|
|
59875
|
+
);
|
|
59876
|
+
const binaryString = atob(buildResponse.transaction);
|
|
59877
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
59878
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
59879
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
59880
|
+
}
|
|
59881
|
+
const transaction = VersionedTransaction.deserialize(bytes);
|
|
59882
|
+
const signedTransaction = await provider.signTransaction(transaction);
|
|
59883
|
+
const serialized = signedTransaction.serialize();
|
|
59884
|
+
let binaryStr = "";
|
|
59885
|
+
for (let i = 0; i < serialized.length; i++) {
|
|
59886
|
+
binaryStr += String.fromCharCode(serialized[i]);
|
|
59887
|
+
}
|
|
59888
|
+
const sendResponse = await sendSolanaTransaction(
|
|
59889
|
+
{ chain_id: "mainnet", signed_transaction: btoa(binaryStr) },
|
|
59890
|
+
publishableKey
|
|
59891
|
+
);
|
|
59892
|
+
return sendResponse.signature;
|
|
59893
|
+
}
|
|
59894
|
+
async function detectBrowserWallet(chainType, senderAddress) {
|
|
59895
|
+
const win = typeof window !== "undefined" ? window : null;
|
|
59896
|
+
if (!win || !senderAddress) return null;
|
|
59897
|
+
const anyWin = win;
|
|
59898
|
+
if (chainType === "solana") {
|
|
59899
|
+
const solProviders = [];
|
|
59900
|
+
if (win.phantom?.solana) solProviders.push({ provider: win.phantom.solana, name: "Phantom" });
|
|
59901
|
+
if (anyWin.solflare) solProviders.push({ provider: anyWin.solflare, name: "Solflare" });
|
|
59902
|
+
if (anyWin.backpack) solProviders.push({ provider: anyWin.backpack, name: "Backpack" });
|
|
59903
|
+
if (anyWin.trustwallet?.solana) solProviders.push({ provider: anyWin.trustwallet.solana, name: "Trust Wallet" });
|
|
59904
|
+
for (const { provider, name } of solProviders) {
|
|
59905
|
+
if (!provider) continue;
|
|
59906
|
+
try {
|
|
59907
|
+
let addr;
|
|
59908
|
+
if (provider.isConnected && provider.publicKey) {
|
|
59909
|
+
addr = provider.publicKey.toString();
|
|
59910
|
+
} else {
|
|
59911
|
+
const resp = await provider.connect({ onlyIfTrusted: true });
|
|
59912
|
+
if (resp?.publicKey) addr = resp.publicKey.toString();
|
|
59913
|
+
}
|
|
59914
|
+
if (addr && addr === senderAddress) {
|
|
59915
|
+
return { chainFamily: "solana", provider, name, address: addr };
|
|
59916
|
+
}
|
|
59917
|
+
} catch {
|
|
59918
|
+
}
|
|
59919
|
+
}
|
|
59920
|
+
}
|
|
59921
|
+
if (chainType === "ethereum") {
|
|
59922
|
+
const evmProviders = [];
|
|
59923
|
+
const seen = /* @__PURE__ */ new Set();
|
|
59924
|
+
const add = (p, name) => {
|
|
59925
|
+
if (p && typeof p.request === "function" && !seen.has(p)) {
|
|
59926
|
+
seen.add(p);
|
|
59927
|
+
evmProviders.push({ provider: p, name });
|
|
59928
|
+
}
|
|
59929
|
+
};
|
|
59930
|
+
add(anyWin.phantom?.ethereum, "Phantom");
|
|
59931
|
+
add(anyWin.coinbaseWalletExtension, "Coinbase");
|
|
59932
|
+
add(anyWin.trustwallet?.ethereum, "Trust Wallet");
|
|
59933
|
+
add(anyWin.okxwallet, "OKX Wallet");
|
|
59934
|
+
if (anyWin.__eip6963Providers) {
|
|
59935
|
+
for (const detail of anyWin.__eip6963Providers) {
|
|
59936
|
+
const rdns = detail.info?.rdns || "";
|
|
59937
|
+
let name = detail.info?.name || "Wallet";
|
|
59938
|
+
if (rdns.includes("metamask")) name = "MetaMask";
|
|
59939
|
+
else if (rdns.includes("rabby")) name = "Rabby";
|
|
59940
|
+
else if (rdns.includes("rainbow")) name = "Rainbow";
|
|
59941
|
+
add(detail.provider, name);
|
|
59942
|
+
}
|
|
59943
|
+
}
|
|
59944
|
+
if (win.ethereum) {
|
|
59945
|
+
const eth = win.ethereum;
|
|
59946
|
+
let name = "Wallet";
|
|
59947
|
+
if (eth.isMetaMask && !eth.isPhantom && !eth.isRabby) name = "MetaMask";
|
|
59948
|
+
else if (eth.isRabby) name = "Rabby";
|
|
59949
|
+
else if (eth.isRainbow) name = "Rainbow";
|
|
59950
|
+
else if (eth.isCoinbaseWallet) name = "Coinbase";
|
|
59951
|
+
add(eth, name);
|
|
59952
|
+
}
|
|
59953
|
+
for (const { provider, name } of evmProviders) {
|
|
59954
|
+
try {
|
|
59955
|
+
const accounts = await provider.request({ method: "eth_accounts" });
|
|
59956
|
+
if (accounts?.length > 0 && accounts[0].toLowerCase() === senderAddress.toLowerCase()) {
|
|
59957
|
+
return { chainFamily: "evm", provider, name, address: accounts[0] };
|
|
59958
|
+
}
|
|
59959
|
+
} catch {
|
|
59960
|
+
}
|
|
59961
|
+
}
|
|
59962
|
+
}
|
|
59963
|
+
return null;
|
|
59964
|
+
}
|
|
59965
|
+
var t8 = i18n2.withdrawModal;
|
|
59966
|
+
var tCrypto = i18n2.transferCrypto;
|
|
59967
|
+
function formatProcessingTime2(seconds) {
|
|
59968
|
+
if (seconds === null) {
|
|
59969
|
+
return tCrypto.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
|
|
59970
|
+
}
|
|
59971
|
+
const minutes = Math.ceil(seconds / 60);
|
|
59972
|
+
if (minutes < 60) {
|
|
59973
|
+
return tCrypto.processingTime.lessThanMinutes.replace("{{minutes}}", String(minutes));
|
|
59974
|
+
}
|
|
59975
|
+
const hours = Math.ceil(minutes / 60);
|
|
59976
|
+
return tCrypto.processingTime.lessThanHours.replace("{{hours}}", String(hours));
|
|
59977
|
+
}
|
|
59978
|
+
function computeBaseUnit(balanceBaseUnit, inputAmount, balanceAmount) {
|
|
59979
|
+
if (balanceAmount <= 0 || inputAmount <= 0) return "0";
|
|
59980
|
+
if (inputAmount >= balanceAmount) return balanceBaseUnit;
|
|
59981
|
+
const PRECISION = 10n ** 18n;
|
|
59982
|
+
const ratioScaled = BigInt(Math.round(inputAmount / balanceAmount * Number(PRECISION)));
|
|
59983
|
+
const result = BigInt(balanceBaseUnit) * ratioScaled / PRECISION;
|
|
59984
|
+
return result.toString();
|
|
59985
|
+
}
|
|
59986
|
+
function toSafeDecimalString(n, maxDecimals) {
|
|
59987
|
+
if (n === 0) return "0";
|
|
59988
|
+
return n.toFixed(maxDecimals).replace(/\.?0+$/, "");
|
|
59989
|
+
}
|
|
59990
|
+
function WithdrawForm({
|
|
59991
|
+
publishableKey,
|
|
59992
|
+
externalUserId,
|
|
59993
|
+
sourceChainType,
|
|
59994
|
+
selectedToken,
|
|
59995
|
+
selectedChain,
|
|
59996
|
+
sourceTokenSymbol,
|
|
59997
|
+
recipientAddressProp,
|
|
59998
|
+
balanceData,
|
|
59999
|
+
isLoadingBalance,
|
|
60000
|
+
minimumWithdrawAmountUsd,
|
|
60001
|
+
estimatedProcessingTime,
|
|
60002
|
+
maxSlippagePercent,
|
|
60003
|
+
priceImpactPercent,
|
|
60004
|
+
detectedWallet,
|
|
60005
|
+
sourceChainId,
|
|
60006
|
+
sourceTokenAddress,
|
|
60007
|
+
isWalletMatch,
|
|
60008
|
+
connectedWalletName,
|
|
60009
|
+
canWithdraw,
|
|
60010
|
+
onWithdraw,
|
|
60011
|
+
onWithdrawError,
|
|
60012
|
+
onDepositWalletCreation,
|
|
60013
|
+
onWithdrawSubmitted,
|
|
60014
|
+
footerLeft
|
|
60015
|
+
}) {
|
|
60016
|
+
const { colors: colors2, fonts, components } = useTheme();
|
|
60017
|
+
const [recipientAddress, setRecipientAddress] = (0, import_react29.useState)(recipientAddressProp || "");
|
|
60018
|
+
const [amount, setAmount] = (0, import_react29.useState)("");
|
|
60019
|
+
const [inputUnit, setInputUnit] = (0, import_react29.useState)("crypto");
|
|
60020
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react29.useState)(false);
|
|
60021
|
+
const [submitError, setSubmitError] = (0, import_react29.useState)(null);
|
|
60022
|
+
const [detailsExpanded, setDetailsExpanded] = (0, import_react29.useState)(false);
|
|
60023
|
+
const [glossaryOpen, setGlossaryOpen] = (0, import_react29.useState)(false);
|
|
60024
|
+
(0, import_react29.useEffect)(() => {
|
|
60025
|
+
setRecipientAddress(recipientAddressProp || "");
|
|
60026
|
+
setAmount("");
|
|
60027
|
+
setInputUnit("crypto");
|
|
60028
|
+
setSubmitError(null);
|
|
60029
|
+
}, [recipientAddressProp]);
|
|
60030
|
+
const trimmedAddress = recipientAddress.trim();
|
|
60031
|
+
const [debouncedAddress, setDebouncedAddress] = (0, import_react29.useState)(trimmedAddress);
|
|
60032
|
+
(0, import_react29.useEffect)(() => {
|
|
60033
|
+
const id = setTimeout(() => setDebouncedAddress(trimmedAddress), 500);
|
|
60034
|
+
return () => clearTimeout(id);
|
|
60035
|
+
}, [trimmedAddress]);
|
|
60036
|
+
const {
|
|
60037
|
+
data: addressVerification,
|
|
60038
|
+
isLoading: isVerifyingAddress,
|
|
60039
|
+
error: verifyError
|
|
60040
|
+
} = useVerifyRecipientAddress({
|
|
60041
|
+
chainType: selectedChain?.chain_type,
|
|
60042
|
+
chainId: selectedChain?.chain_id,
|
|
60043
|
+
tokenAddress: selectedChain?.token_address,
|
|
60044
|
+
recipientAddress: debouncedAddress,
|
|
60045
|
+
publishableKey,
|
|
60046
|
+
enabled: debouncedAddress.length > 5 && !!selectedChain
|
|
60047
|
+
});
|
|
60048
|
+
const isDebouncing = trimmedAddress !== debouncedAddress;
|
|
60049
|
+
const addressError = (0, import_react29.useMemo)(() => {
|
|
60050
|
+
if (!trimmedAddress || trimmedAddress.length <= 5) return null;
|
|
60051
|
+
if (isDebouncing || isVerifyingAddress) return null;
|
|
60052
|
+
if (verifyError) return t8.invalidAddress;
|
|
60053
|
+
if (addressVerification && !addressVerification.valid) {
|
|
60054
|
+
if (addressVerification.failure_code === "account_not_found")
|
|
60055
|
+
return `Account not found on ${selectedChain?.chain_name}`;
|
|
60056
|
+
if (addressVerification.failure_code === "not_opted_in")
|
|
60057
|
+
return `Recipient has not opted in to ${selectedToken?.symbol} on ${selectedChain?.chain_name}`;
|
|
60058
|
+
return t8.invalidAddress;
|
|
60059
|
+
}
|
|
60060
|
+
return null;
|
|
60061
|
+
}, [trimmedAddress, isDebouncing, isVerifyingAddress, verifyError, addressVerification, selectedChain, selectedToken]);
|
|
60062
|
+
const isAddressValid = !isDebouncing && !!addressVerification?.valid && !addressError;
|
|
60063
|
+
const exchangeRate = (0, import_react29.useMemo)(() => {
|
|
60064
|
+
if (!balanceData?.exchangeRate) return 0;
|
|
60065
|
+
return parseFloat(balanceData.exchangeRate);
|
|
60066
|
+
}, [balanceData]);
|
|
60067
|
+
const balanceCrypto = (0, import_react29.useMemo)(() => {
|
|
60068
|
+
if (!balanceData?.balanceHuman) return 0;
|
|
60069
|
+
return parseFloat(balanceData.balanceHuman);
|
|
60070
|
+
}, [balanceData]);
|
|
60071
|
+
const balanceUsdNum = (0, import_react29.useMemo)(() => {
|
|
60072
|
+
if (!balanceData?.balanceUsd) return 0;
|
|
60073
|
+
return parseFloat(balanceData.balanceUsd);
|
|
60074
|
+
}, [balanceData]);
|
|
60075
|
+
const tokenSymbol = sourceTokenSymbol || balanceData?.symbol || "TOKEN";
|
|
60076
|
+
const sourceDecimals = balanceData?.decimals ?? 6;
|
|
60077
|
+
const cryptoAmountFromInput = (0, import_react29.useMemo)(() => {
|
|
60078
|
+
const val = parseFloat(amount);
|
|
60079
|
+
if (!val || val <= 0) return 0;
|
|
60080
|
+
if (inputUnit === "crypto") return val;
|
|
60081
|
+
return exchangeRate > 0 ? val / exchangeRate : 0;
|
|
60082
|
+
}, [amount, inputUnit, exchangeRate]);
|
|
60083
|
+
const fiatAmountFromInput = (0, import_react29.useMemo)(() => {
|
|
60084
|
+
const val = parseFloat(amount);
|
|
60085
|
+
if (!val || val <= 0) return 0;
|
|
60086
|
+
if (inputUnit === "fiat") return val;
|
|
60087
|
+
return val * exchangeRate;
|
|
60088
|
+
}, [amount, inputUnit, exchangeRate]);
|
|
60089
|
+
const convertedDisplay = (0, import_react29.useMemo)(() => {
|
|
60090
|
+
if (!amount || parseFloat(amount) <= 0) return null;
|
|
60091
|
+
if (inputUnit === "crypto") {
|
|
60092
|
+
return `$${fiatAmountFromInput.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
60093
|
+
}
|
|
60094
|
+
return `${cryptoAmountFromInput.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 6 })} ${tokenSymbol}`;
|
|
60095
|
+
}, [amount, inputUnit, fiatAmountFromInput, cryptoAmountFromInput, tokenSymbol]);
|
|
60096
|
+
const balanceDisplay = (0, import_react29.useMemo)(() => {
|
|
60097
|
+
if (isLoadingBalance || !balanceData) return null;
|
|
60098
|
+
if (inputUnit === "crypto") {
|
|
60099
|
+
return `${balanceCrypto.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${tokenSymbol}`;
|
|
60100
|
+
}
|
|
60101
|
+
return `$${balanceUsdNum.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
60102
|
+
}, [isLoadingBalance, balanceData, inputUnit, balanceCrypto, balanceUsdNum, tokenSymbol]);
|
|
60103
|
+
const handleSwitchUnit = (0, import_react29.useCallback)(() => {
|
|
60104
|
+
const val = parseFloat(amount);
|
|
60105
|
+
if (!val || val <= 0 || exchangeRate <= 0) {
|
|
60106
|
+
setInputUnit((u) => u === "crypto" ? "fiat" : "crypto");
|
|
60107
|
+
setAmount("");
|
|
60108
|
+
return;
|
|
60109
|
+
}
|
|
60110
|
+
if (inputUnit === "crypto") {
|
|
60111
|
+
const fiat = val * exchangeRate;
|
|
60112
|
+
setAmount(fiat.toFixed(2));
|
|
60113
|
+
setInputUnit("fiat");
|
|
60114
|
+
} else {
|
|
60115
|
+
const crypto = val / exchangeRate;
|
|
60116
|
+
setAmount(crypto.toFixed(sourceDecimals > 6 ? 6 : sourceDecimals));
|
|
60117
|
+
setInputUnit("crypto");
|
|
60118
|
+
}
|
|
60119
|
+
}, [amount, inputUnit, exchangeRate, sourceDecimals]);
|
|
60120
|
+
const handleMaxClick = (0, import_react29.useCallback)(() => {
|
|
60121
|
+
if (inputUnit === "crypto") {
|
|
60122
|
+
if (balanceCrypto <= 0) return;
|
|
60123
|
+
setAmount(balanceData?.balanceHuman ?? "0");
|
|
60124
|
+
} else {
|
|
60125
|
+
if (balanceUsdNum <= 0) return;
|
|
60126
|
+
setAmount((Math.floor(balanceUsdNum * 100) / 100).toFixed(2));
|
|
60127
|
+
}
|
|
60128
|
+
}, [inputUnit, balanceCrypto, balanceUsdNum, balanceData]);
|
|
60129
|
+
const isBelowMinimum = minimumWithdrawAmountUsd !== null && fiatAmountFromInput > 0 && fiatAmountFromInput < minimumWithdrawAmountUsd;
|
|
60130
|
+
const isOverBalance = inputUnit === "crypto" ? cryptoAmountFromInput > 0 && balanceCrypto > 0 && cryptoAmountFromInput > balanceCrypto : fiatAmountFromInput > 0 && balanceUsdNum > 0 && fiatAmountFromInput > balanceUsdNum;
|
|
60131
|
+
const isFormValid = trimmedAddress.length > 0 && amount.trim().length > 0 && cryptoAmountFromInput > 0 && isAddressValid && !isBelowMinimum && !isOverBalance && !!balanceData;
|
|
60132
|
+
const handleWithdraw = (0, import_react29.useCallback)(async () => {
|
|
60133
|
+
if (!selectedToken || !selectedChain) return;
|
|
60134
|
+
if (!isFormValid) return;
|
|
60135
|
+
setIsSubmitting(true);
|
|
60136
|
+
setSubmitError(null);
|
|
60137
|
+
try {
|
|
60138
|
+
const depositWallet = await onDepositWalletCreation({
|
|
60139
|
+
destinationChainType: selectedChain.chain_type,
|
|
60140
|
+
destinationChainId: selectedChain.chain_id,
|
|
60141
|
+
destinationTokenAddress: selectedChain.token_address,
|
|
60142
|
+
recipientAddress: trimmedAddress
|
|
60143
|
+
});
|
|
60144
|
+
const amountBaseUnit = computeBaseUnit(
|
|
60145
|
+
balanceData.balanceBaseUnit,
|
|
60146
|
+
parseFloat(amount),
|
|
60147
|
+
inputUnit === "crypto" ? balanceCrypto : balanceUsdNum
|
|
60148
|
+
);
|
|
60149
|
+
const humanAmount = toSafeDecimalString(cryptoAmountFromInput, sourceDecimals);
|
|
60150
|
+
const txInfo = {
|
|
60151
|
+
sourceChainType,
|
|
60152
|
+
sourceChainId,
|
|
60153
|
+
sourceTokenAddress,
|
|
60154
|
+
sourceTokenSymbol: tokenSymbol,
|
|
60155
|
+
destinationChainType: selectedChain.chain_type,
|
|
60156
|
+
destinationChainId: selectedChain.chain_id,
|
|
60157
|
+
destinationTokenAddress: selectedChain.token_address,
|
|
60158
|
+
destinationTokenSymbol: selectedToken.symbol,
|
|
60159
|
+
amount: humanAmount,
|
|
60160
|
+
amountBaseUnit,
|
|
60161
|
+
withdrawIntentAddress: depositWallet.address,
|
|
60162
|
+
recipientAddress: trimmedAddress
|
|
60163
|
+
};
|
|
60164
|
+
if (detectedWallet) {
|
|
60165
|
+
if (detectedWallet.chainFamily === "evm") {
|
|
60166
|
+
await sendEvmWithdraw({
|
|
60167
|
+
provider: detectedWallet.provider,
|
|
60168
|
+
fromAddress: detectedWallet.address,
|
|
60169
|
+
depositWalletAddress: depositWallet.address,
|
|
60170
|
+
sourceTokenAddress,
|
|
60171
|
+
sourceChainId,
|
|
60172
|
+
amountBaseUnit
|
|
60173
|
+
});
|
|
60174
|
+
} else if (detectedWallet.chainFamily === "solana") {
|
|
60175
|
+
await sendSolanaWithdraw({
|
|
60176
|
+
provider: detectedWallet.provider,
|
|
60177
|
+
fromAddress: detectedWallet.address,
|
|
60178
|
+
depositWalletAddress: depositWallet.address,
|
|
60179
|
+
sourceTokenAddress,
|
|
60180
|
+
amountBaseUnit,
|
|
60181
|
+
publishableKey
|
|
60182
|
+
});
|
|
60183
|
+
}
|
|
60184
|
+
} else if (onWithdraw) {
|
|
60185
|
+
await onWithdraw(txInfo);
|
|
60186
|
+
} else {
|
|
60187
|
+
throw new Error("No withdrawal method available. Please connect a wallet.");
|
|
60188
|
+
}
|
|
60189
|
+
onWithdrawSubmitted?.(txInfo);
|
|
60190
|
+
} catch (err) {
|
|
60191
|
+
const raw = err instanceof Error ? err.message : "Withdrawal failed. Please try again.";
|
|
60192
|
+
setSubmitError(raw.length > 120 ? "Withdrawal failed. Please try again." : raw);
|
|
60193
|
+
onWithdrawError?.({
|
|
60194
|
+
message: raw,
|
|
60195
|
+
error: err,
|
|
60196
|
+
code: "WITHDRAW_FAILED"
|
|
60197
|
+
});
|
|
60198
|
+
} finally {
|
|
60199
|
+
setIsSubmitting(false);
|
|
60200
|
+
}
|
|
60201
|
+
}, [selectedToken, selectedChain, isFormValid, cryptoAmountFromInput, sourceDecimals, trimmedAddress, publishableKey, onWithdraw, detectedWallet, sourceTokenAddress, sourceChainId, onWithdrawError, onDepositWalletCreation, onWithdrawSubmitted, amount, inputUnit, balanceCrypto, balanceUsdNum, balanceData]);
|
|
60202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
60203
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
|
|
60204
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60205
|
+
"div",
|
|
60206
|
+
{
|
|
60207
|
+
className: "uf-text-xs uf-mb-1.5",
|
|
60208
|
+
style: { color: components.card.labelColor, fontFamily: fonts.medium },
|
|
60209
|
+
children: t8.recipientAddress
|
|
60210
|
+
}
|
|
60211
|
+
),
|
|
60212
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60213
|
+
"style",
|
|
60214
|
+
{
|
|
60215
|
+
dangerouslySetInnerHTML: {
|
|
60216
|
+
__html: `.uf-withdraw-addr::placeholder { color: ${components.search.placeholderColor}; }`
|
|
60217
|
+
}
|
|
60218
|
+
}
|
|
60219
|
+
),
|
|
60220
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
60221
|
+
"div",
|
|
60222
|
+
{
|
|
60223
|
+
className: "uf-flex uf-items-center uf-gap-1 uf-pr-2",
|
|
60224
|
+
style: {
|
|
60225
|
+
backgroundColor: components.search.backgroundColor,
|
|
60226
|
+
borderRadius: components.input.borderRadius,
|
|
60227
|
+
border: `${components.input.borderWidth}px solid ${addressError ? colors2.error : components.input.borderColor}`
|
|
60228
|
+
},
|
|
60229
|
+
children: [
|
|
60230
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60231
|
+
"input",
|
|
60232
|
+
{
|
|
60233
|
+
type: "text",
|
|
60234
|
+
placeholder: t8.recipientAddressPlaceholder,
|
|
60235
|
+
value: recipientAddress,
|
|
60236
|
+
onChange: (e) => {
|
|
60237
|
+
setRecipientAddress(e.target.value);
|
|
60238
|
+
setSubmitError(null);
|
|
60239
|
+
},
|
|
60240
|
+
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",
|
|
60241
|
+
style: {
|
|
60242
|
+
color: components.search.inputColor,
|
|
60243
|
+
fontFamily: fonts.regular
|
|
60244
|
+
}
|
|
60245
|
+
}
|
|
60246
|
+
),
|
|
60247
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60248
|
+
"button",
|
|
60249
|
+
{
|
|
60250
|
+
type: "button",
|
|
60251
|
+
onClick: async () => {
|
|
60252
|
+
try {
|
|
60253
|
+
const text = await navigator.clipboard.readText();
|
|
60254
|
+
if (text) {
|
|
60255
|
+
setRecipientAddress(text.trim());
|
|
60256
|
+
setSubmitError(null);
|
|
60257
|
+
}
|
|
60258
|
+
} catch {
|
|
60259
|
+
}
|
|
60260
|
+
},
|
|
60261
|
+
className: "uf-flex-shrink-0 uf-p-1 uf-rounded uf-transition-colors hover:uf-opacity-70",
|
|
60262
|
+
style: { color: colors2.foregroundMuted },
|
|
60263
|
+
title: "Paste from clipboard",
|
|
60264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ClipboardPaste, { className: "uf-w-4 uf-h-4" })
|
|
60265
|
+
}
|
|
60266
|
+
)
|
|
60267
|
+
]
|
|
60268
|
+
}
|
|
60269
|
+
),
|
|
60270
|
+
(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: [
|
|
60271
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LoaderCircle, { className: "uf-w-3 uf-h-3 uf-animate-spin", style: { color: colors2.foregroundMuted } }),
|
|
60272
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: t8.verifyingAddress })
|
|
60273
|
+
] }),
|
|
60274
|
+
addressError && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-1.5", children: [
|
|
60275
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(TriangleAlert, { className: "uf-w-3 uf-h-3", style: { color: colors2.error } }),
|
|
60276
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "uf-text-xs", style: { color: colors2.error, fontFamily: fonts.regular }, children: addressError })
|
|
60277
|
+
] })
|
|
60278
|
+
] }),
|
|
60279
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
|
|
60280
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-text-xs uf-mb-1.5", style: { color: components.card.labelColor, fontFamily: fonts.medium }, children: [
|
|
60281
|
+
t8.amount,
|
|
60282
|
+
minimumWithdrawAmountUsd != null && minimumWithdrawAmountUsd > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { style: { color: colors2.warning, fontFamily: fonts.regular }, children: ` ($${minimumWithdrawAmountUsd.toFixed(2)} min)` })
|
|
60283
|
+
] }),
|
|
60284
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60285
|
+
"style",
|
|
60286
|
+
{
|
|
60287
|
+
dangerouslySetInnerHTML: {
|
|
60288
|
+
__html: `.uf-withdraw-amt::placeholder { color: ${components.search.placeholderColor}; }`
|
|
60289
|
+
}
|
|
60290
|
+
}
|
|
60291
|
+
),
|
|
60292
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
60293
|
+
"div",
|
|
60294
|
+
{
|
|
60295
|
+
className: "uf-flex uf-items-center uf-gap-2 uf-px-3 uf-py-2.5",
|
|
60296
|
+
style: {
|
|
60297
|
+
backgroundColor: components.search.backgroundColor,
|
|
60298
|
+
borderRadius: components.input.borderRadius,
|
|
60299
|
+
border: `${components.input.borderWidth}px solid ${components.input.borderColor}`
|
|
60300
|
+
},
|
|
60301
|
+
children: [
|
|
60302
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60303
|
+
"input",
|
|
60304
|
+
{
|
|
60305
|
+
type: "text",
|
|
60306
|
+
inputMode: "decimal",
|
|
60307
|
+
placeholder: "0.00",
|
|
60308
|
+
value: amount,
|
|
60309
|
+
onChange: (e) => {
|
|
60310
|
+
const val = e.target.value;
|
|
60311
|
+
if (val === "" || /^\d*\.?\d*$/.test(val)) {
|
|
60312
|
+
setAmount(val);
|
|
60313
|
+
setSubmitError(null);
|
|
60314
|
+
}
|
|
60315
|
+
},
|
|
60316
|
+
className: "uf-withdraw-amt uf-flex-1 uf-min-w-0 uf-bg-transparent uf-text-sm uf-outline-none",
|
|
60317
|
+
style: {
|
|
60318
|
+
color: components.search.inputColor,
|
|
60319
|
+
fontFamily: fonts.regular
|
|
60320
|
+
}
|
|
60321
|
+
}
|
|
60322
|
+
),
|
|
60323
|
+
/* @__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" }),
|
|
60324
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60325
|
+
"button",
|
|
60326
|
+
{
|
|
60327
|
+
type: "button",
|
|
60328
|
+
onClick: handleMaxClick,
|
|
60329
|
+
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",
|
|
60330
|
+
style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium },
|
|
60331
|
+
children: "Max"
|
|
60332
|
+
}
|
|
60333
|
+
)
|
|
60334
|
+
]
|
|
60335
|
+
}
|
|
60336
|
+
),
|
|
60337
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between uf-mt-1.5 uf-px-3", children: [
|
|
60338
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
|
|
60339
|
+
/* @__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}`) }),
|
|
60340
|
+
exchangeRate > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60341
|
+
"button",
|
|
60342
|
+
{
|
|
60343
|
+
type: "button",
|
|
60344
|
+
onClick: handleSwitchUnit,
|
|
60345
|
+
className: "uf-p-0.5 uf-rounded uf-transition-colors hover:uf-opacity-70",
|
|
60346
|
+
style: { color: colors2.foregroundMuted },
|
|
60347
|
+
title: "Switch unit",
|
|
60348
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ArrowUpDown, { className: "uf-w-3 uf-h-3" })
|
|
60349
|
+
}
|
|
60350
|
+
)
|
|
60351
|
+
] }),
|
|
60352
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
|
|
60353
|
+
balanceDisplay && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: [
|
|
60354
|
+
t8.balance,
|
|
60355
|
+
": ",
|
|
60356
|
+
balanceDisplay
|
|
60357
|
+
] }),
|
|
60358
|
+
isLoadingBalance && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-h-3 uf-w-16 uf-bg-muted uf-rounded uf-animate-pulse" })
|
|
60359
|
+
] })
|
|
60360
|
+
] })
|
|
60361
|
+
] }),
|
|
60362
|
+
/* @__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: [
|
|
60363
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
60364
|
+
"button",
|
|
60365
|
+
{
|
|
60366
|
+
type: "button",
|
|
60367
|
+
onClick: () => setDetailsExpanded(!detailsExpanded),
|
|
60368
|
+
className: "uf-w-full uf-flex uf-items-center uf-justify-between uf-py-2.5",
|
|
60369
|
+
children: [
|
|
60370
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
60371
|
+
/* @__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 } }) }),
|
|
60372
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
|
|
60373
|
+
tCrypto.processingTime.label,
|
|
60374
|
+
":",
|
|
60375
|
+
" ",
|
|
60376
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime2(estimatedProcessingTime) })
|
|
60377
|
+
] })
|
|
60378
|
+
] }),
|
|
60379
|
+
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 } })
|
|
60380
|
+
]
|
|
60381
|
+
}
|
|
60382
|
+
),
|
|
60383
|
+
detailsExpanded && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-pb-3 uf-space-y-2.5", children: [
|
|
60384
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
60385
|
+
/* @__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 } }) }),
|
|
60386
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
|
|
60387
|
+
tCrypto.slippage.label,
|
|
60388
|
+
":",
|
|
60389
|
+
" ",
|
|
60390
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: [
|
|
60391
|
+
tCrypto.slippage.auto,
|
|
60392
|
+
" \u2022 ",
|
|
60393
|
+
(maxSlippagePercent ?? 0.25).toFixed(2),
|
|
60394
|
+
"%"
|
|
60395
|
+
] })
|
|
60396
|
+
] })
|
|
60397
|
+
] }),
|
|
60398
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
60399
|
+
/* @__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 } }) }),
|
|
60400
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
|
|
60401
|
+
tCrypto.priceImpact.label,
|
|
60402
|
+
":",
|
|
60403
|
+
" ",
|
|
60404
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: [
|
|
60405
|
+
(priceImpactPercent ?? 0).toFixed(2),
|
|
60406
|
+
"%"
|
|
60407
|
+
] })
|
|
60408
|
+
] })
|
|
60409
|
+
] })
|
|
60410
|
+
] })
|
|
60411
|
+
] }),
|
|
60412
|
+
!canWithdraw && !submitError && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
60413
|
+
"div",
|
|
60414
|
+
{
|
|
60415
|
+
className: "uf-flex uf-items-start uf-gap-2.5 uf-p-3 uf-rounded-xl",
|
|
60416
|
+
style: { backgroundColor: colors2.card, border: `1px solid ${colors2.border}` },
|
|
60417
|
+
children: [
|
|
60418
|
+
/* @__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 } }),
|
|
60419
|
+
/* @__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." })
|
|
60420
|
+
]
|
|
60421
|
+
}
|
|
60422
|
+
),
|
|
60423
|
+
isWalletMatch && connectedWalletName ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60424
|
+
"button",
|
|
60425
|
+
{
|
|
60426
|
+
type: "button",
|
|
60427
|
+
onClick: handleWithdraw,
|
|
60428
|
+
disabled: !isFormValid || !canWithdraw || isSubmitting || !selectedToken || !selectedChain,
|
|
60429
|
+
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",
|
|
60430
|
+
style: {
|
|
60431
|
+
backgroundColor: colors2.primary,
|
|
60432
|
+
color: colors2.primaryForeground,
|
|
60433
|
+
fontFamily: fonts.medium,
|
|
60434
|
+
borderRadius: components.button.borderRadius,
|
|
60435
|
+
border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
|
|
60436
|
+
},
|
|
60437
|
+
children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
60438
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }),
|
|
60439
|
+
"Processing..."
|
|
60440
|
+
] }) : 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: [
|
|
60441
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Wallet, { className: "uf-w-4 uf-h-4" }),
|
|
60442
|
+
"Withdraw from ",
|
|
60443
|
+
connectedWalletName
|
|
60444
|
+
] })
|
|
60445
|
+
}
|
|
60446
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60447
|
+
"button",
|
|
60448
|
+
{
|
|
60449
|
+
type: "button",
|
|
60450
|
+
onClick: handleWithdraw,
|
|
60451
|
+
disabled: !isFormValid || !canWithdraw || isSubmitting || !selectedToken || !selectedChain,
|
|
60452
|
+
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",
|
|
60453
|
+
style: {
|
|
60454
|
+
backgroundColor: colors2.primary,
|
|
60455
|
+
color: colors2.primaryForeground,
|
|
60456
|
+
fontFamily: fonts.medium,
|
|
60457
|
+
borderRadius: components.button.borderRadius,
|
|
60458
|
+
border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
|
|
60459
|
+
},
|
|
60460
|
+
children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-flex uf-items-center uf-justify-center uf-gap-2", children: [
|
|
60461
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }),
|
|
60462
|
+
"Processing..."
|
|
60463
|
+
] }) : isOverBalance ? "Insufficient balance" : isBelowMinimum ? "Minimum amount not met" : submitError ? "Withdrawal failed. Try again" : t8.withdraw
|
|
60464
|
+
}
|
|
60465
|
+
),
|
|
60466
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between uf-text-xs uf-pt-1", children: [
|
|
60467
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { children: footerLeft }),
|
|
60468
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DepositFooterLinks, { onGlossaryClick: () => setGlossaryOpen(true) })
|
|
60469
|
+
] }),
|
|
60470
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60471
|
+
GlossaryModal,
|
|
60472
|
+
{
|
|
60473
|
+
open: glossaryOpen,
|
|
60474
|
+
onOpenChange: setGlossaryOpen
|
|
60475
|
+
}
|
|
60476
|
+
)
|
|
60477
|
+
] });
|
|
60478
|
+
}
|
|
60479
|
+
function WithdrawExecutionItem({
|
|
60480
|
+
execution,
|
|
60481
|
+
onClick
|
|
60482
|
+
}) {
|
|
60483
|
+
const { colors: colors2, fonts, components } = useTheme();
|
|
60484
|
+
const isPending = execution.status === ExecutionStatus.PENDING || execution.status === ExecutionStatus.WAITING || execution.status === ExecutionStatus.DELAYED;
|
|
60485
|
+
const formatDateTime = (timestamp) => {
|
|
60486
|
+
try {
|
|
60487
|
+
const date = new Date(timestamp);
|
|
60488
|
+
const monthDay = date.toLocaleDateString("en-US", {
|
|
60489
|
+
month: "short",
|
|
60490
|
+
day: "numeric",
|
|
60491
|
+
year: "numeric"
|
|
60492
|
+
});
|
|
60493
|
+
const time = date.toLocaleTimeString("en-US", {
|
|
60494
|
+
hour: "numeric",
|
|
60495
|
+
minute: "2-digit",
|
|
60496
|
+
hour12: true
|
|
60497
|
+
}).toLowerCase();
|
|
60498
|
+
return `${monthDay} at ${time}`;
|
|
60499
|
+
} catch {
|
|
60500
|
+
return timestamp;
|
|
60501
|
+
}
|
|
60502
|
+
};
|
|
60503
|
+
const formatUsdAmount2 = (sourceAmountUsd) => {
|
|
60504
|
+
try {
|
|
60505
|
+
const amount = Number(sourceAmountUsd);
|
|
60506
|
+
return new Intl.NumberFormat("en-US", {
|
|
60507
|
+
style: "currency",
|
|
60508
|
+
currency: "USD",
|
|
60509
|
+
minimumFractionDigits: 2,
|
|
60510
|
+
maximumFractionDigits: 2
|
|
60511
|
+
}).format(amount);
|
|
60512
|
+
} catch {
|
|
60513
|
+
return "$0.00";
|
|
60514
|
+
}
|
|
60515
|
+
};
|
|
60516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
60517
|
+
"button",
|
|
60518
|
+
{
|
|
60519
|
+
onClick,
|
|
60520
|
+
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",
|
|
60521
|
+
style: {
|
|
60522
|
+
backgroundColor: components.card.backgroundColor,
|
|
60523
|
+
borderRadius: components.list.rowBorderRadius,
|
|
60524
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
60525
|
+
},
|
|
60526
|
+
children: [
|
|
60527
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-relative uf-flex-shrink-0 uf-w-9 uf-h-9", children: [
|
|
60528
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60529
|
+
"img",
|
|
60530
|
+
{
|
|
60531
|
+
src: execution.destination_token_metadata?.icon_url || getIconUrl("/icons/tokens/svg/usdc.svg"),
|
|
60532
|
+
alt: "Token",
|
|
60533
|
+
width: 36,
|
|
60534
|
+
height: 36,
|
|
60535
|
+
loading: "lazy",
|
|
60536
|
+
className: "uf-rounded-full uf-w-9 uf-h-9"
|
|
60537
|
+
}
|
|
60538
|
+
),
|
|
60539
|
+
isPending ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60540
|
+
"div",
|
|
60541
|
+
{
|
|
60542
|
+
className: "uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-rounded-full uf-p-0.5",
|
|
60543
|
+
style: { backgroundColor: colors2.warning },
|
|
60544
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60545
|
+
"svg",
|
|
60546
|
+
{
|
|
60547
|
+
width: "10",
|
|
60548
|
+
height: "10",
|
|
60549
|
+
viewBox: "0 0 12 12",
|
|
60550
|
+
fill: "none",
|
|
60551
|
+
className: "uf-animate-spin uf-block",
|
|
60552
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60553
|
+
"path",
|
|
60554
|
+
{
|
|
60555
|
+
d: "M6 1V3M6 9V11M1 6H3M9 6H11M2.5 2.5L4 4M8 8L9.5 9.5M2.5 9.5L4 8M8 4L9.5 2.5",
|
|
60556
|
+
stroke: "white",
|
|
60557
|
+
strokeWidth: "2",
|
|
60558
|
+
strokeLinecap: "round"
|
|
60559
|
+
}
|
|
60560
|
+
)
|
|
60561
|
+
}
|
|
60562
|
+
)
|
|
60563
|
+
}
|
|
60564
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60565
|
+
"div",
|
|
60566
|
+
{
|
|
60567
|
+
className: "uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-rounded-full uf-p-0.5",
|
|
60568
|
+
style: { backgroundColor: colors2.success },
|
|
60569
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60570
|
+
"svg",
|
|
60571
|
+
{
|
|
60572
|
+
width: "10",
|
|
60573
|
+
height: "10",
|
|
60574
|
+
viewBox: "0 0 12 12",
|
|
60575
|
+
fill: "none",
|
|
60576
|
+
className: "uf-block",
|
|
60577
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60578
|
+
"path",
|
|
60579
|
+
{
|
|
60580
|
+
d: "M10 3L4.5 8.5L2 6",
|
|
60581
|
+
stroke: "white",
|
|
60582
|
+
strokeWidth: "2",
|
|
60583
|
+
strokeLinecap: "round",
|
|
60584
|
+
strokeLinejoin: "round"
|
|
60585
|
+
}
|
|
60586
|
+
)
|
|
60587
|
+
}
|
|
60588
|
+
)
|
|
60589
|
+
}
|
|
60590
|
+
)
|
|
60591
|
+
] }),
|
|
60592
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex-1 uf-min-w-0", children: [
|
|
60593
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60594
|
+
"h3",
|
|
60595
|
+
{
|
|
60596
|
+
className: "uf-font-medium uf-text-sm uf-leading-tight",
|
|
60597
|
+
style: {
|
|
60598
|
+
color: components.card.titleColor,
|
|
60599
|
+
fontFamily: fonts.medium
|
|
60600
|
+
},
|
|
60601
|
+
children: isPending ? "Withdrawal processing" : "Withdrawal completed"
|
|
60602
|
+
}
|
|
60603
|
+
),
|
|
60604
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60605
|
+
"p",
|
|
60606
|
+
{
|
|
60607
|
+
className: "uf-text-xs uf-leading-tight",
|
|
60608
|
+
style: {
|
|
60609
|
+
color: components.card.subtitleColor,
|
|
60610
|
+
fontFamily: fonts.regular
|
|
60611
|
+
},
|
|
60612
|
+
children: formatDateTime(execution.created_at || (/* @__PURE__ */ new Date()).toISOString())
|
|
60613
|
+
}
|
|
60614
|
+
)
|
|
60615
|
+
] }),
|
|
60616
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60617
|
+
"span",
|
|
60618
|
+
{
|
|
60619
|
+
className: "uf-font-medium uf-text-sm uf-flex-shrink-0",
|
|
60620
|
+
style: {
|
|
60621
|
+
color: components.card.textRightColor,
|
|
60622
|
+
fontFamily: fonts.medium
|
|
60623
|
+
},
|
|
60624
|
+
children: formatUsdAmount2(execution.source_amount_usd || "0")
|
|
60625
|
+
}
|
|
60626
|
+
),
|
|
60627
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60628
|
+
ChevronRight,
|
|
60629
|
+
{
|
|
60630
|
+
className: "uf-w-4 uf-h-4 uf-flex-shrink-0",
|
|
60631
|
+
style: { color: components.card.actionColor }
|
|
60632
|
+
}
|
|
60633
|
+
)
|
|
60634
|
+
]
|
|
60635
|
+
}
|
|
60636
|
+
);
|
|
60637
|
+
}
|
|
60638
|
+
function truncateAddress4(addr) {
|
|
60639
|
+
if (addr.length <= 12) return addr;
|
|
60640
|
+
return `${addr.slice(0, 6)}...${addr.slice(-4)}`;
|
|
60641
|
+
}
|
|
60642
|
+
var SHOW_BUTTON_DELAY_MS = 5e3;
|
|
60643
|
+
function WithdrawConfirmingView({
|
|
60644
|
+
txInfo,
|
|
60645
|
+
executions,
|
|
60646
|
+
onClose,
|
|
60647
|
+
onViewTracker
|
|
60648
|
+
}) {
|
|
60649
|
+
const { colors: colors2, fonts, components } = useTheme();
|
|
60650
|
+
const [showButton, setShowButton] = (0, import_react30.useState)(false);
|
|
60651
|
+
const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
|
|
60652
|
+
(0, import_react30.useEffect)(() => {
|
|
60653
|
+
if (latestExecution) return;
|
|
60654
|
+
const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
|
|
60655
|
+
return () => clearTimeout(timer);
|
|
60656
|
+
}, [latestExecution]);
|
|
60657
|
+
const btnRadius = components.button.borderRadius;
|
|
60658
|
+
const btnBorder = `${components.button.borderWidth}px solid ${components.button.borderColor}`;
|
|
60659
|
+
if (latestExecution) {
|
|
60660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
60661
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositHeader, { title: "Withdrawal Details", showClose: true, onClose }),
|
|
60662
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositDetailContent, { execution: latestExecution, variant: "withdraw" }),
|
|
60663
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-gap-2 uf-px-2 uf-pt-2", children: [
|
|
60664
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60665
|
+
"button",
|
|
60666
|
+
{
|
|
60667
|
+
type: "button",
|
|
60668
|
+
onClick: onViewTracker,
|
|
60669
|
+
className: "uf-flex-1 uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
|
|
60670
|
+
style: {
|
|
60671
|
+
backgroundColor: components.button.secondaryBackground,
|
|
60672
|
+
color: components.button.secondaryText,
|
|
60673
|
+
fontFamily: fonts.medium,
|
|
60674
|
+
borderRadius: btnRadius,
|
|
60675
|
+
border: btnBorder
|
|
60676
|
+
},
|
|
60677
|
+
children: "Withdrawal History"
|
|
60678
|
+
}
|
|
60679
|
+
),
|
|
60680
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60681
|
+
"button",
|
|
60682
|
+
{
|
|
60683
|
+
type: "button",
|
|
60684
|
+
onClick: onClose,
|
|
60685
|
+
className: "uf-flex-1 uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
|
|
60686
|
+
style: {
|
|
60687
|
+
backgroundColor: components.button.primaryBackground,
|
|
60688
|
+
color: components.button.primaryText,
|
|
60689
|
+
fontFamily: fonts.medium,
|
|
60690
|
+
borderRadius: btnRadius,
|
|
60691
|
+
border: btnBorder
|
|
60692
|
+
},
|
|
60693
|
+
children: "Close"
|
|
60694
|
+
}
|
|
60695
|
+
)
|
|
60696
|
+
] }),
|
|
60697
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60698
|
+
PoweredByUnifold,
|
|
60699
|
+
{
|
|
60700
|
+
color: colors2.foregroundMuted,
|
|
60701
|
+
className: "uf-flex uf-justify-center uf-shrink-0"
|
|
60702
|
+
}
|
|
60703
|
+
) })
|
|
60704
|
+
] });
|
|
60705
|
+
}
|
|
60706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
60707
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositHeader, { title: "Withdrawal Status", showClose: true, onClose }),
|
|
60708
|
+
/* @__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: [
|
|
60709
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60710
|
+
"div",
|
|
60711
|
+
{
|
|
60712
|
+
className: "uf-w-20 uf-h-20 uf-rounded-full uf-flex uf-items-center uf-justify-center uf-mb-6",
|
|
60713
|
+
style: { backgroundColor: `${colors2.primary}20` },
|
|
60714
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60715
|
+
"svg",
|
|
60716
|
+
{
|
|
60717
|
+
width: "40",
|
|
60718
|
+
height: "40",
|
|
60719
|
+
viewBox: "0 0 24 24",
|
|
60720
|
+
fill: "none",
|
|
60721
|
+
className: "uf-animate-spin",
|
|
60722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60723
|
+
"path",
|
|
60724
|
+
{
|
|
60725
|
+
d: "M21 12a9 9 0 1 1-6.22-8.56",
|
|
60726
|
+
stroke: colors2.primary,
|
|
60727
|
+
strokeWidth: "2.5",
|
|
60728
|
+
strokeLinecap: "round"
|
|
60729
|
+
}
|
|
60730
|
+
)
|
|
60731
|
+
}
|
|
60732
|
+
)
|
|
60733
|
+
}
|
|
60734
|
+
),
|
|
60735
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60736
|
+
"h3",
|
|
60737
|
+
{
|
|
60738
|
+
className: "uf-text-xl uf-mb-2",
|
|
60739
|
+
style: { color: colors2.foreground, fontFamily: fonts.medium },
|
|
60740
|
+
children: "Checking Withdrawal"
|
|
60741
|
+
}
|
|
60742
|
+
),
|
|
60743
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
60744
|
+
"p",
|
|
60745
|
+
{
|
|
60746
|
+
className: "uf-text-sm uf-text-center",
|
|
60747
|
+
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
60748
|
+
children: [
|
|
60749
|
+
txInfo.amount,
|
|
60750
|
+
" ",
|
|
60751
|
+
txInfo.sourceTokenSymbol,
|
|
60752
|
+
" to",
|
|
60753
|
+
" ",
|
|
60754
|
+
truncateAddress4(txInfo.recipientAddress)
|
|
60755
|
+
]
|
|
60756
|
+
}
|
|
60757
|
+
)
|
|
60758
|
+
] }),
|
|
60759
|
+
showButton && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-px-1 uf-pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60760
|
+
"button",
|
|
60761
|
+
{
|
|
60762
|
+
type: "button",
|
|
60763
|
+
onClick: onViewTracker,
|
|
60764
|
+
className: "uf-w-full uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
|
|
60765
|
+
style: {
|
|
60766
|
+
backgroundColor: components.button.secondaryBackground,
|
|
60767
|
+
color: components.button.secondaryText,
|
|
60768
|
+
fontFamily: fonts.medium,
|
|
60769
|
+
borderRadius: btnRadius,
|
|
60770
|
+
border: btnBorder
|
|
60771
|
+
},
|
|
60772
|
+
children: "Withdrawal History"
|
|
60773
|
+
}
|
|
60774
|
+
) }),
|
|
60775
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60776
|
+
PoweredByUnifold,
|
|
60777
|
+
{
|
|
60778
|
+
color: colors2.foregroundMuted,
|
|
60779
|
+
className: "uf-flex uf-justify-center uf-shrink-0"
|
|
60780
|
+
}
|
|
60781
|
+
) })
|
|
60782
|
+
] });
|
|
60783
|
+
}
|
|
60784
|
+
var t9 = i18n2.withdrawModal;
|
|
60785
|
+
var getChainKey5 = (chainId, chainType) => `${chainType}:${chainId}`;
|
|
60786
|
+
function WithdrawModal({
|
|
60787
|
+
open,
|
|
60788
|
+
onOpenChange,
|
|
60789
|
+
publishableKey,
|
|
60790
|
+
modalTitle,
|
|
60791
|
+
externalUserId,
|
|
60792
|
+
sourceChainType,
|
|
60793
|
+
sourceChainId,
|
|
60794
|
+
sourceTokenAddress,
|
|
60795
|
+
sourceTokenSymbol,
|
|
60796
|
+
recipientAddress: recipientAddressProp,
|
|
60797
|
+
senderAddress,
|
|
60798
|
+
onWithdraw,
|
|
60799
|
+
onWithdrawSuccess,
|
|
60800
|
+
onWithdrawError,
|
|
60801
|
+
theme = "dark",
|
|
60802
|
+
hideOverlay = false
|
|
60803
|
+
}) {
|
|
60804
|
+
const { colors: colors2, fonts, components } = useTheme();
|
|
60805
|
+
const [containerEl, setContainerEl] = (0, import_react27.useState)(null);
|
|
60806
|
+
const containerCallbackRef = (0, import_react27.useCallback)((el) => {
|
|
60807
|
+
setContainerEl(el);
|
|
60808
|
+
}, []);
|
|
60809
|
+
const [resolvedTheme, setResolvedTheme] = (0, import_react27.useState)(
|
|
60810
|
+
theme === "auto" ? "dark" : theme
|
|
60811
|
+
);
|
|
60812
|
+
(0, import_react27.useEffect)(() => {
|
|
60813
|
+
if (theme === "auto") {
|
|
60814
|
+
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
60815
|
+
setResolvedTheme(mq.matches ? "dark" : "light");
|
|
60816
|
+
const h = (e) => setResolvedTheme(e.matches ? "dark" : "light");
|
|
60817
|
+
mq.addEventListener("change", h);
|
|
60818
|
+
return () => mq.removeEventListener("change", h);
|
|
60819
|
+
}
|
|
60820
|
+
setResolvedTheme(theme);
|
|
60821
|
+
}, [theme]);
|
|
60822
|
+
const themeClass = resolvedTheme === "dark" ? "uf-dark" : "";
|
|
60823
|
+
const { data: tokensResponse, isLoading: tokensLoading } = useSupportedDestinationTokens(publishableKey, open);
|
|
60824
|
+
const destinationTokens = tokensResponse?.data ?? [];
|
|
60825
|
+
const { data: sourceValidation, isLoading: isCheckingSourceToken } = useSourceTokenValidation({
|
|
60826
|
+
sourceChainType,
|
|
60827
|
+
sourceChainId,
|
|
60828
|
+
sourceTokenAddress,
|
|
60829
|
+
sourceTokenSymbol,
|
|
60830
|
+
publishableKey,
|
|
60831
|
+
enabled: open
|
|
60832
|
+
});
|
|
60833
|
+
const { data: balanceData, isLoading: isLoadingBalance } = useAddressBalance({
|
|
60834
|
+
address: senderAddress,
|
|
60835
|
+
chainType: sourceChainType,
|
|
60836
|
+
chainId: sourceChainId,
|
|
60837
|
+
tokenAddress: sourceTokenAddress,
|
|
60838
|
+
publishableKey,
|
|
60839
|
+
enabled: open
|
|
60840
|
+
});
|
|
60841
|
+
const [selectedToken, setSelectedToken] = (0, import_react27.useState)(null);
|
|
60842
|
+
const [selectedChain, setSelectedChain] = (0, import_react27.useState)(null);
|
|
60843
|
+
const [detectedWallet, setDetectedWallet] = (0, import_react27.useState)(null);
|
|
60844
|
+
const connectedWalletName = detectedWallet?.name ?? null;
|
|
60845
|
+
const isWalletMatch = !!detectedWallet;
|
|
60846
|
+
(0, import_react27.useEffect)(() => {
|
|
60847
|
+
if (!senderAddress || !open) {
|
|
60848
|
+
setDetectedWallet(null);
|
|
60849
|
+
return;
|
|
60850
|
+
}
|
|
60851
|
+
let cancelled = false;
|
|
60852
|
+
detectBrowserWallet(sourceChainType, senderAddress).then((wallet) => {
|
|
60853
|
+
if (!cancelled) setDetectedWallet(wallet);
|
|
60854
|
+
});
|
|
60855
|
+
return () => {
|
|
60856
|
+
cancelled = true;
|
|
60857
|
+
};
|
|
60858
|
+
}, [senderAddress, sourceChainType, open]);
|
|
60859
|
+
const [view, setView] = (0, import_react27.useState)("form");
|
|
60860
|
+
const [withdrawDepositWalletId, setWithdrawDepositWalletId] = (0, import_react27.useState)();
|
|
60861
|
+
const [selectedExecution, setSelectedExecution] = (0, import_react27.useState)(null);
|
|
60862
|
+
const [submittedTxInfo, setSubmittedTxInfo] = (0, import_react27.useState)(null);
|
|
60863
|
+
const { executions: realtimeExecutions } = useWithdrawPolling({
|
|
60864
|
+
userId: externalUserId,
|
|
60865
|
+
publishableKey,
|
|
60866
|
+
depositWalletId: withdrawDepositWalletId,
|
|
60867
|
+
enabled: !!withdrawDepositWalletId && open,
|
|
60868
|
+
onWithdrawSuccess: onWithdrawSuccess ? (d) => onWithdrawSuccess({ message: d.message, transaction: d.transaction }) : void 0,
|
|
60869
|
+
onWithdrawError
|
|
60870
|
+
});
|
|
60871
|
+
const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
|
|
60872
|
+
actionType: ActionType.Withdraw,
|
|
60873
|
+
enabled: open,
|
|
60874
|
+
refetchInterval: view === "tracker" || view === "detail" ? 5e3 : 15e3
|
|
60875
|
+
});
|
|
60876
|
+
const allWithdrawals = allWithdrawalsData?.data ?? [];
|
|
60877
|
+
const handleDepositWalletCreation = (0, import_react27.useCallback)(async (params) => {
|
|
60878
|
+
const { data: wallets } = await createDepositAddress(
|
|
60879
|
+
{
|
|
60880
|
+
external_user_id: externalUserId,
|
|
60881
|
+
destination_chain_type: params.destinationChainType,
|
|
60882
|
+
destination_chain_id: params.destinationChainId,
|
|
60883
|
+
destination_token_address: params.destinationTokenAddress,
|
|
60884
|
+
recipient_address: params.recipientAddress,
|
|
60885
|
+
action_type: ActionType.Withdraw
|
|
60886
|
+
},
|
|
60887
|
+
publishableKey
|
|
60888
|
+
);
|
|
60889
|
+
const depositWallet = getWalletByChainType(wallets, sourceChainType);
|
|
60890
|
+
if (!depositWallet) {
|
|
60891
|
+
throw new Error(`No deposit wallet available for ${sourceChainType}`);
|
|
60892
|
+
}
|
|
60893
|
+
setWithdrawDepositWalletId(depositWallet.id);
|
|
60894
|
+
return depositWallet;
|
|
60895
|
+
}, [externalUserId, publishableKey, sourceChainType]);
|
|
60896
|
+
const handleWithdrawSubmitted = (0, import_react27.useCallback)((txInfo) => {
|
|
60897
|
+
setSubmittedTxInfo(txInfo);
|
|
60898
|
+
setView("confirming");
|
|
60899
|
+
}, []);
|
|
60900
|
+
(0, import_react27.useEffect)(() => {
|
|
60901
|
+
if (!destinationTokens.length || selectedToken) return;
|
|
60902
|
+
const first = destinationTokens[0];
|
|
60903
|
+
if (first?.chains.length > 0) {
|
|
60904
|
+
setSelectedToken(first);
|
|
60905
|
+
setSelectedChain(first.chains[0]);
|
|
60906
|
+
}
|
|
60907
|
+
}, [destinationTokens, selectedToken]);
|
|
60908
|
+
const resetViewTimeoutRef = (0, import_react27.useRef)(null);
|
|
60909
|
+
const handleClose = (0, import_react27.useCallback)(() => {
|
|
60910
|
+
onOpenChange(false);
|
|
60911
|
+
if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
|
|
60912
|
+
resetViewTimeoutRef.current = setTimeout(() => {
|
|
60913
|
+
setSelectedToken(null);
|
|
60914
|
+
setSelectedChain(null);
|
|
60915
|
+
setView("form");
|
|
60916
|
+
setSelectedExecution(null);
|
|
60917
|
+
setSubmittedTxInfo(null);
|
|
60918
|
+
setWithdrawDepositWalletId(void 0);
|
|
60919
|
+
resetViewTimeoutRef.current = null;
|
|
60920
|
+
}, 200);
|
|
60921
|
+
}, [onOpenChange]);
|
|
60922
|
+
(0, import_react27.useLayoutEffect)(() => {
|
|
60923
|
+
if (!open) return;
|
|
60924
|
+
if (resetViewTimeoutRef.current) {
|
|
60925
|
+
clearTimeout(resetViewTimeoutRef.current);
|
|
60926
|
+
resetViewTimeoutRef.current = null;
|
|
60927
|
+
}
|
|
60928
|
+
setSelectedToken(null);
|
|
60929
|
+
setSelectedChain(null);
|
|
60930
|
+
setView("form");
|
|
60931
|
+
setSelectedExecution(null);
|
|
60932
|
+
setSubmittedTxInfo(null);
|
|
60933
|
+
setWithdrawDepositWalletId(void 0);
|
|
60934
|
+
}, [open]);
|
|
60935
|
+
(0, import_react27.useEffect)(() => () => {
|
|
60936
|
+
if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
|
|
60937
|
+
}, []);
|
|
60938
|
+
const handleTokenSymbolChange = (0, import_react27.useCallback)((symbol) => {
|
|
60939
|
+
const tok = destinationTokens.find((t11) => t11.symbol === symbol);
|
|
60940
|
+
if (tok) {
|
|
60941
|
+
setSelectedToken(tok);
|
|
60942
|
+
if (tok.chains.length > 0) setSelectedChain(tok.chains[0]);
|
|
60943
|
+
}
|
|
60944
|
+
}, [destinationTokens]);
|
|
60945
|
+
const handleChainKeyChange = (0, import_react27.useCallback)((chainKey) => {
|
|
60946
|
+
if (!selectedToken) return;
|
|
60947
|
+
const chain = selectedToken.chains.find((c) => getChainKey5(c.chain_id, c.chain_type) === chainKey);
|
|
60948
|
+
if (chain) setSelectedChain(chain);
|
|
60949
|
+
}, [selectedToken]);
|
|
60950
|
+
const isSourceSupported = sourceValidation?.isSupported ?? null;
|
|
60951
|
+
const canWithdraw = !!onWithdraw || isWalletMatch;
|
|
60952
|
+
const isAnyLoading = tokensLoading || isCheckingSourceToken;
|
|
60953
|
+
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" }) });
|
|
60954
|
+
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)(
|
|
60955
|
+
DialogContent2,
|
|
60956
|
+
{
|
|
60957
|
+
ref: hideOverlay ? containerCallbackRef : void 0,
|
|
60958
|
+
hideOverlay,
|
|
60959
|
+
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}`}`,
|
|
60960
|
+
style: { backgroundColor: colors2.background },
|
|
60961
|
+
onPointerDownOutside: (e) => e.preventDefault(),
|
|
60962
|
+
onInteractOutside: (e) => e.preventDefault(),
|
|
60963
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ThemeStyleInjector, { children: view === "confirming" && submittedTxInfo ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
60964
|
+
WithdrawConfirmingView,
|
|
60965
|
+
{
|
|
60966
|
+
txInfo: submittedTxInfo,
|
|
60967
|
+
executions: realtimeExecutions,
|
|
60968
|
+
onClose: handleClose,
|
|
60969
|
+
onViewTracker: () => setView("tracker")
|
|
60970
|
+
}
|
|
60971
|
+
) : view === "detail" && selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
60972
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositHeader, { title: "Withdrawal Details", showBack: true, showClose: !hideOverlay, onBack: () => {
|
|
60973
|
+
setSelectedExecution(null);
|
|
60974
|
+
setView("tracker");
|
|
60975
|
+
}, onClose: handleClose }),
|
|
60976
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositDetailContent, { execution: selectedExecution, variant: "withdraw" }),
|
|
60977
|
+
withdrawPoweredByFooter
|
|
60978
|
+
] }) : view === "tracker" ? (
|
|
60979
|
+
/* ---------- Tracker view: execution list ---------- */
|
|
60980
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
60981
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositHeader, { title: "Withdrawal History", showBack: true, showClose: !hideOverlay, onBack: () => setView("form"), onClose: handleClose }),
|
|
60982
|
+
/* @__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)(
|
|
60983
|
+
WithdrawExecutionItem,
|
|
60984
|
+
{
|
|
60985
|
+
execution: ex,
|
|
60986
|
+
onClick: () => {
|
|
60987
|
+
setSelectedExecution(ex);
|
|
60988
|
+
setView("detail");
|
|
60989
|
+
}
|
|
60990
|
+
},
|
|
60991
|
+
ex.id
|
|
60992
|
+
)) }),
|
|
60993
|
+
withdrawPoweredByFooter
|
|
60994
|
+
] })
|
|
60995
|
+
) : (
|
|
60996
|
+
/* ---------- Form view (default) ---------- */
|
|
60997
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
60998
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositHeader, { title: modalTitle || t9.title, showClose: !hideOverlay, onClose: handleClose }),
|
|
60999
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-3", children: [
|
|
61000
|
+
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: [
|
|
61001
|
+
/* @__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" }) }),
|
|
61002
|
+
/* @__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" }),
|
|
61003
|
+
/* @__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 })
|
|
61004
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
61005
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
61006
|
+
WithdrawDoubleInput,
|
|
61007
|
+
{
|
|
61008
|
+
tokens: destinationTokens,
|
|
61009
|
+
selectedTokenSymbol: selectedToken?.symbol ?? null,
|
|
61010
|
+
selectedChainKey: selectedChain ? getChainKey5(selectedChain.chain_id, selectedChain.chain_type) : null,
|
|
61011
|
+
onTokenChange: handleTokenSymbolChange,
|
|
61012
|
+
onChainChange: handleChainKeyChange,
|
|
61013
|
+
isLoading: tokensLoading
|
|
61014
|
+
}
|
|
61015
|
+
),
|
|
61016
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
61017
|
+
WithdrawForm,
|
|
61018
|
+
{
|
|
61019
|
+
publishableKey,
|
|
61020
|
+
externalUserId,
|
|
61021
|
+
sourceChainType,
|
|
61022
|
+
selectedToken,
|
|
61023
|
+
selectedChain,
|
|
61024
|
+
sourceTokenSymbol,
|
|
61025
|
+
recipientAddressProp,
|
|
61026
|
+
balanceData: balanceData ?? null,
|
|
61027
|
+
isLoadingBalance,
|
|
61028
|
+
minimumWithdrawAmountUsd: sourceValidation?.minimumAmountUsd ?? null,
|
|
61029
|
+
estimatedProcessingTime: sourceValidation?.estimatedProcessingTime ?? null,
|
|
61030
|
+
maxSlippagePercent: sourceValidation?.maxSlippagePercent ?? null,
|
|
61031
|
+
priceImpactPercent: sourceValidation?.priceImpactPercent ?? null,
|
|
61032
|
+
detectedWallet,
|
|
61033
|
+
sourceChainId,
|
|
61034
|
+
sourceTokenAddress,
|
|
61035
|
+
isWalletMatch,
|
|
61036
|
+
connectedWalletName,
|
|
61037
|
+
canWithdraw,
|
|
61038
|
+
onWithdraw,
|
|
61039
|
+
onWithdrawError,
|
|
61040
|
+
onDepositWalletCreation: handleDepositWalletCreation,
|
|
61041
|
+
onWithdrawSubmitted: handleWithdrawSubmitted,
|
|
61042
|
+
footerLeft: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
61043
|
+
"button",
|
|
61044
|
+
{
|
|
61045
|
+
onClick: () => setView("tracker"),
|
|
61046
|
+
className: "uf-flex uf-items-center uf-gap-1 uf-transition-colors hover:uf-opacity-70",
|
|
61047
|
+
style: { color: colors2.foregroundMuted },
|
|
61048
|
+
children: [
|
|
61049
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Clock, { className: "uf-w-3.5 uf-h-3.5" }),
|
|
61050
|
+
"Withdrawal History",
|
|
61051
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ChevronRight, { className: "uf-w-3 uf-h-3" })
|
|
61052
|
+
]
|
|
61053
|
+
}
|
|
61054
|
+
)
|
|
61055
|
+
}
|
|
61056
|
+
)
|
|
61057
|
+
] }),
|
|
61058
|
+
withdrawPoweredByFooter
|
|
61059
|
+
] })
|
|
61060
|
+
] })
|
|
61061
|
+
) })
|
|
61062
|
+
}
|
|
61063
|
+
) }) });
|
|
61064
|
+
}
|
|
61065
|
+
var t10 = i18n2.withdrawModal;
|
|
61066
|
+
function UnifoldProvider2({
|
|
61067
|
+
children,
|
|
61068
|
+
publishableKey,
|
|
61069
|
+
config
|
|
61070
|
+
}) {
|
|
61071
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
61072
|
+
const [depositConfig, setDepositConfig] = (0, import_react.useState)(
|
|
61073
|
+
null
|
|
61074
|
+
);
|
|
61075
|
+
const [isWithdrawOpen, setIsWithdrawOpen] = (0, import_react.useState)(false);
|
|
61076
|
+
const [withdrawConfig, setWithdrawConfig] = (0, import_react.useState)(
|
|
61077
|
+
null
|
|
61078
|
+
);
|
|
61079
|
+
const [resolvedTheme, setResolvedTheme] = import_react.default.useState("dark");
|
|
61080
|
+
(0, import_react.useEffect)(() => {
|
|
61081
|
+
if (publishableKey) {
|
|
61082
|
+
setApiConfig({ publishableKey });
|
|
61083
|
+
}
|
|
61084
|
+
}, [publishableKey]);
|
|
61085
|
+
import_react.default.useEffect(() => {
|
|
61086
|
+
const appearance = config?.appearance || "dark";
|
|
61087
|
+
if (appearance === "auto") {
|
|
61088
|
+
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
61089
|
+
setResolvedTheme(prefersDark ? "dark" : "light");
|
|
61090
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
61091
|
+
const handler = (e) => {
|
|
61092
|
+
setResolvedTheme(e.matches ? "dark" : "light");
|
|
61093
|
+
};
|
|
61094
|
+
mediaQuery.addEventListener("change", handler);
|
|
61095
|
+
return () => mediaQuery.removeEventListener("change", handler);
|
|
61096
|
+
} else {
|
|
61097
|
+
setResolvedTheme(appearance);
|
|
61098
|
+
}
|
|
61099
|
+
}, [config?.appearance]);
|
|
61100
|
+
const depositPromiseRef = import_react.default.useRef(null);
|
|
61101
|
+
const depositConfigRef = import_react.default.useRef(null);
|
|
61102
|
+
depositConfigRef.current = depositConfig;
|
|
61103
|
+
const closeTimeoutRef = import_react.default.useRef(null);
|
|
61104
|
+
const closeGuardRef = import_react.default.useRef(false);
|
|
61105
|
+
const withdrawPromiseRef = import_react.default.useRef(null);
|
|
61106
|
+
const withdrawConfigRef = import_react.default.useRef(null);
|
|
61107
|
+
withdrawConfigRef.current = withdrawConfig;
|
|
61108
|
+
const withdrawCloseTimeoutRef = import_react.default.useRef(null);
|
|
61109
|
+
const withdrawCloseGuardRef = import_react.default.useRef(false);
|
|
61110
|
+
const beginDeposit = (0, import_react.useCallback)((config2) => {
|
|
61111
|
+
if (closeTimeoutRef.current) {
|
|
61112
|
+
clearTimeout(closeTimeoutRef.current);
|
|
61113
|
+
closeTimeoutRef.current = null;
|
|
61114
|
+
}
|
|
61115
|
+
closeGuardRef.current = false;
|
|
61116
|
+
if (depositPromiseRef.current) {
|
|
61117
|
+
console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit.");
|
|
61118
|
+
depositPromiseRef.current.reject({
|
|
61119
|
+
message: "Deposit cancelled - new deposit started",
|
|
61120
|
+
code: "DEPOSIT_SUPERSEDED"
|
|
61121
|
+
});
|
|
61122
|
+
depositPromiseRef.current = null;
|
|
61123
|
+
}
|
|
61124
|
+
const promise = new Promise((resolve, reject) => {
|
|
61125
|
+
depositPromiseRef.current = { resolve, reject };
|
|
61126
|
+
});
|
|
61127
|
+
promise.catch(() => {
|
|
61128
|
+
});
|
|
61129
|
+
setDepositConfig(config2);
|
|
61130
|
+
setIsOpen(true);
|
|
61131
|
+
return promise;
|
|
61132
|
+
}, []);
|
|
61133
|
+
const closeDeposit = (0, import_react.useCallback)(() => {
|
|
61134
|
+
if (closeGuardRef.current) {
|
|
61135
|
+
return;
|
|
61136
|
+
}
|
|
61137
|
+
closeGuardRef.current = true;
|
|
61138
|
+
const promiseToReject = depositPromiseRef.current;
|
|
61139
|
+
depositPromiseRef.current = null;
|
|
61140
|
+
if (depositConfigRef.current?.onClose) {
|
|
61141
|
+
depositConfigRef.current.onClose();
|
|
61142
|
+
}
|
|
61143
|
+
if (promiseToReject) {
|
|
61144
|
+
promiseToReject.reject({
|
|
61145
|
+
message: "Deposit cancelled by user",
|
|
61146
|
+
code: "DEPOSIT_CANCELLED"
|
|
61147
|
+
});
|
|
61148
|
+
}
|
|
61149
|
+
setIsOpen(false);
|
|
61150
|
+
closeTimeoutRef.current = setTimeout(() => {
|
|
61151
|
+
setDepositConfig(null);
|
|
61152
|
+
closeTimeoutRef.current = null;
|
|
61153
|
+
}, 200);
|
|
61154
|
+
}, []);
|
|
61155
|
+
const handleDepositSuccess = (0, import_react.useCallback)((data) => {
|
|
61156
|
+
if (depositConfig?.onSuccess) {
|
|
61157
|
+
depositConfig.onSuccess(data);
|
|
61158
|
+
}
|
|
61159
|
+
if (depositPromiseRef.current) {
|
|
61160
|
+
depositPromiseRef.current.resolve(data);
|
|
61161
|
+
depositPromiseRef.current = null;
|
|
61162
|
+
}
|
|
61163
|
+
}, [depositConfig]);
|
|
61164
|
+
const handleDepositError = (0, import_react.useCallback)((error) => {
|
|
61165
|
+
console.error("[UnifoldProvider] Deposit error:", error);
|
|
61166
|
+
if (depositConfig?.onError) {
|
|
61167
|
+
depositConfig.onError(error);
|
|
61168
|
+
}
|
|
61169
|
+
if (depositPromiseRef.current) {
|
|
61170
|
+
depositPromiseRef.current.reject(error);
|
|
61171
|
+
depositPromiseRef.current = null;
|
|
61172
|
+
}
|
|
61173
|
+
}, [depositConfig]);
|
|
61174
|
+
const beginWithdraw = (0, import_react.useCallback)((config2) => {
|
|
61175
|
+
if (withdrawCloseTimeoutRef.current) {
|
|
61176
|
+
clearTimeout(withdrawCloseTimeoutRef.current);
|
|
61177
|
+
withdrawCloseTimeoutRef.current = null;
|
|
61178
|
+
}
|
|
61179
|
+
withdrawCloseGuardRef.current = false;
|
|
61180
|
+
if (withdrawPromiseRef.current) {
|
|
61181
|
+
console.warn("[UnifoldProvider] A withdraw is already in progress. Cancelling previous withdraw.");
|
|
61182
|
+
withdrawPromiseRef.current.reject({
|
|
61183
|
+
message: "Withdraw cancelled - new withdraw started",
|
|
61184
|
+
code: "WITHDRAW_SUPERSEDED"
|
|
61185
|
+
});
|
|
61186
|
+
withdrawPromiseRef.current = null;
|
|
61187
|
+
}
|
|
61188
|
+
const promise = new Promise((resolve, reject) => {
|
|
61189
|
+
withdrawPromiseRef.current = { resolve, reject };
|
|
61190
|
+
});
|
|
61191
|
+
promise.catch(() => {
|
|
61192
|
+
});
|
|
61193
|
+
setWithdrawConfig(config2);
|
|
61194
|
+
setIsWithdrawOpen(true);
|
|
61195
|
+
return promise;
|
|
61196
|
+
}, []);
|
|
61197
|
+
const closeWithdraw = (0, import_react.useCallback)(() => {
|
|
61198
|
+
if (withdrawCloseGuardRef.current) {
|
|
61199
|
+
return;
|
|
61200
|
+
}
|
|
61201
|
+
withdrawCloseGuardRef.current = true;
|
|
61202
|
+
const promiseToReject = withdrawPromiseRef.current;
|
|
61203
|
+
withdrawPromiseRef.current = null;
|
|
61204
|
+
if (withdrawConfigRef.current?.onClose) {
|
|
61205
|
+
withdrawConfigRef.current.onClose();
|
|
61206
|
+
}
|
|
61207
|
+
if (promiseToReject) {
|
|
61208
|
+
promiseToReject.reject({
|
|
61209
|
+
message: "Withdraw cancelled by user",
|
|
61210
|
+
code: "WITHDRAW_CANCELLED"
|
|
61211
|
+
});
|
|
61212
|
+
}
|
|
61213
|
+
setIsWithdrawOpen(false);
|
|
61214
|
+
withdrawCloseTimeoutRef.current = setTimeout(() => {
|
|
61215
|
+
setWithdrawConfig(null);
|
|
61216
|
+
withdrawCloseTimeoutRef.current = null;
|
|
61217
|
+
}, 200);
|
|
61218
|
+
}, []);
|
|
61219
|
+
const handleWithdrawSuccess = (0, import_react.useCallback)((data) => {
|
|
61220
|
+
if (withdrawConfigRef.current?.onSuccess) {
|
|
61221
|
+
withdrawConfigRef.current.onSuccess(data);
|
|
61222
|
+
}
|
|
61223
|
+
if (withdrawPromiseRef.current) {
|
|
61224
|
+
withdrawPromiseRef.current.resolve(data);
|
|
61225
|
+
withdrawPromiseRef.current = null;
|
|
61226
|
+
}
|
|
61227
|
+
}, []);
|
|
61228
|
+
const handleWithdrawError = (0, import_react.useCallback)((error) => {
|
|
61229
|
+
console.error("[UnifoldProvider] Withdraw error:", error);
|
|
61230
|
+
if (withdrawConfigRef.current?.onError) {
|
|
61231
|
+
withdrawConfigRef.current.onError(error);
|
|
61232
|
+
}
|
|
61233
|
+
if (withdrawPromiseRef.current) {
|
|
61234
|
+
withdrawPromiseRef.current.reject(error);
|
|
61235
|
+
withdrawPromiseRef.current = null;
|
|
61236
|
+
}
|
|
61237
|
+
}, []);
|
|
61238
|
+
const contextValue = (0, import_react.useMemo)(
|
|
61239
|
+
() => ({
|
|
61240
|
+
beginDeposit,
|
|
61241
|
+
closeDeposit,
|
|
61242
|
+
handleDepositSuccess,
|
|
61243
|
+
handleDepositError,
|
|
61244
|
+
beginWithdraw,
|
|
61245
|
+
closeWithdraw,
|
|
61246
|
+
handleWithdrawSuccess,
|
|
61247
|
+
handleWithdrawError
|
|
61248
|
+
}),
|
|
61249
|
+
[beginDeposit, closeDeposit, handleDepositSuccess, handleDepositError, beginWithdraw, closeWithdraw, handleWithdrawSuccess, handleWithdrawError]
|
|
61250
|
+
);
|
|
61251
|
+
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)(
|
|
61252
|
+
ThemeProvider,
|
|
61253
|
+
{
|
|
61254
|
+
mode: resolvedTheme,
|
|
61255
|
+
accentColor: config?.accentColor,
|
|
61256
|
+
theme: config?.theme,
|
|
61257
|
+
fontFamily: config?.fontFamily,
|
|
61258
|
+
fonts: config?.fonts,
|
|
61259
|
+
components: config?.components,
|
|
61260
|
+
children: [
|
|
61261
|
+
children,
|
|
61262
|
+
withdrawConfig && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
61263
|
+
WithdrawModal,
|
|
61264
|
+
{
|
|
61265
|
+
open: isWithdrawOpen,
|
|
61266
|
+
onOpenChange: closeWithdraw,
|
|
61267
|
+
publishableKey,
|
|
61268
|
+
modalTitle: config?.withdrawModalTitle,
|
|
61269
|
+
externalUserId: withdrawConfig.externalUserId,
|
|
61270
|
+
sourceChainType: withdrawConfig.sourceChainType,
|
|
61271
|
+
sourceChainId: withdrawConfig.sourceChainId,
|
|
61272
|
+
sourceTokenAddress: withdrawConfig.sourceTokenAddress,
|
|
61273
|
+
sourceTokenSymbol: withdrawConfig.sourceTokenSymbol,
|
|
61274
|
+
recipientAddress: withdrawConfig.recipientAddress,
|
|
61275
|
+
senderAddress: withdrawConfig.senderAddress,
|
|
61276
|
+
onWithdraw: withdrawConfig.withdraw,
|
|
61277
|
+
onWithdrawSuccess: handleWithdrawSuccess,
|
|
61278
|
+
onWithdrawError: handleWithdrawError,
|
|
61279
|
+
theme: resolvedTheme
|
|
61280
|
+
}
|
|
61281
|
+
),
|
|
61282
|
+
depositConfig && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
61283
|
+
DepositModal,
|
|
61284
|
+
{
|
|
61285
|
+
open: isOpen,
|
|
61286
|
+
onOpenChange: closeDeposit,
|
|
61287
|
+
userId: depositConfig.externalUserId,
|
|
61288
|
+
publishableKey,
|
|
61289
|
+
modalTitle: config?.modalTitle,
|
|
61290
|
+
destinationTokenSymbol: depositConfig.destinationTokenSymbol,
|
|
61291
|
+
recipientAddress: depositConfig.recipientAddress,
|
|
61292
|
+
destinationChainType: depositConfig.destinationChainType,
|
|
61293
|
+
destinationChainId: depositConfig.destinationChainId,
|
|
61294
|
+
destinationTokenAddress: depositConfig.destinationTokenAddress,
|
|
61295
|
+
defaultSourceChainType: depositConfig.defaultSourceChainType,
|
|
61296
|
+
defaultSourceChainId: depositConfig.defaultSourceChainId,
|
|
61297
|
+
defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
|
|
61298
|
+
defaultSourceSymbol: depositConfig.defaultSourceSymbol,
|
|
61299
|
+
depositConfirmationMode: depositConfig.depositConfirmationMode ?? "auto_ui",
|
|
61300
|
+
hideDepositTracker: config?.hideDepositTracker,
|
|
61301
|
+
showBalanceHeader: config?.showBalanceHeader,
|
|
61302
|
+
transferInputVariant: config?.transferInputVariant,
|
|
61303
|
+
enableConnectWallet: config?.enableConnectWallet,
|
|
61304
|
+
enablePayWithExchange: config?.enablePayWithExchange,
|
|
61305
|
+
onDepositSuccess: handleDepositSuccess,
|
|
61306
|
+
onDepositError: handleDepositError,
|
|
61307
|
+
theme: resolvedTheme,
|
|
61308
|
+
initialScreen: depositConfig.initialScreen ?? config?.defaultInitialScreen,
|
|
61309
|
+
transferCryptoTitle: config?.transferCryptoTitle,
|
|
61310
|
+
depositWithCardTitle: config?.depositWithCardTitle,
|
|
61311
|
+
payWithExchangeTitle: config?.payWithExchangeTitle,
|
|
61312
|
+
depositTrackerTitle: config?.depositTrackerTitle,
|
|
61313
|
+
depositTrackerSubTitle: config?.depositTrackerSubTitle,
|
|
61314
|
+
hideDepositFlowInfo: config?.hideDepositFlowInfo,
|
|
61315
|
+
hideDisplayDescription: config?.hideDisplayDescription,
|
|
61316
|
+
browserWalletAmountQuickSelect: config?.browserWalletAmountQuickSelect
|
|
61317
|
+
}
|
|
61318
|
+
)
|
|
61319
|
+
]
|
|
61320
|
+
}
|
|
61321
|
+
) }) });
|
|
61322
|
+
}
|
|
61323
|
+
var ConnectContext = import_react.default.createContext(null);
|
|
61324
|
+
function useUnifold2() {
|
|
61325
|
+
const baseContext = useUnifold();
|
|
61326
|
+
const connectContext = import_react.default.useContext(ConnectContext);
|
|
61327
|
+
if (typeof window === "undefined") {
|
|
61328
|
+
return {
|
|
61329
|
+
publishableKey: "",
|
|
61330
|
+
beginDeposit: () => Promise.reject(new Error("SSR not supported")),
|
|
59433
61331
|
closeDeposit: () => {
|
|
61332
|
+
},
|
|
61333
|
+
beginWithdraw: () => Promise.reject(new Error("SSR not supported")),
|
|
61334
|
+
closeWithdraw: () => {
|
|
59434
61335
|
}
|
|
59435
61336
|
};
|
|
59436
61337
|
}
|
|
@@ -59440,21 +61341,25 @@ function useUnifold2() {
|
|
|
59440
61341
|
return {
|
|
59441
61342
|
publishableKey: baseContext.publishableKey,
|
|
59442
61343
|
beginDeposit: connectContext.beginDeposit,
|
|
59443
|
-
closeDeposit: connectContext.closeDeposit
|
|
61344
|
+
closeDeposit: connectContext.closeDeposit,
|
|
61345
|
+
beginWithdraw: connectContext.beginWithdraw,
|
|
61346
|
+
closeWithdraw: connectContext.closeWithdraw
|
|
59444
61347
|
};
|
|
59445
61348
|
}
|
|
59446
61349
|
|
|
59447
61350
|
// src/unifold.tsx
|
|
59448
|
-
var UnifoldBridge = (0,
|
|
59449
|
-
const { beginDeposit, closeDeposit } = useUnifold2();
|
|
59450
|
-
(0,
|
|
61351
|
+
var UnifoldBridge = (0, import_react32.forwardRef)((_, ref) => {
|
|
61352
|
+
const { beginDeposit, closeDeposit, beginWithdraw, closeWithdraw } = useUnifold2();
|
|
61353
|
+
(0, import_react32.useImperativeHandle)(ref, () => ({ beginDeposit, closeDeposit, beginWithdraw, closeWithdraw }), [
|
|
59451
61354
|
beginDeposit,
|
|
59452
|
-
closeDeposit
|
|
61355
|
+
closeDeposit,
|
|
61356
|
+
beginWithdraw,
|
|
61357
|
+
closeWithdraw
|
|
59453
61358
|
]);
|
|
59454
61359
|
return null;
|
|
59455
61360
|
});
|
|
59456
61361
|
UnifoldBridge.displayName = "UnifoldBridge";
|
|
59457
|
-
var RenderErrorBoundary = class extends
|
|
61362
|
+
var RenderErrorBoundary = class extends import_react32.Component {
|
|
59458
61363
|
constructor() {
|
|
59459
61364
|
super(...arguments);
|
|
59460
61365
|
this.state = { hasError: false };
|
|
@@ -59499,6 +61404,15 @@ function createUnifold(publishableKey, config) {
|
|
|
59499
61404
|
return resolvedHandle.beginDeposit(depositConfig);
|
|
59500
61405
|
},
|
|
59501
61406
|
closeDeposit: () => resolvedHandle?.closeDeposit(),
|
|
61407
|
+
beginWithdraw: (withdrawConfig) => {
|
|
61408
|
+
if (!resolvedHandle) {
|
|
61409
|
+
return Promise.reject(
|
|
61410
|
+
new Error("Unifold instance has been destroyed")
|
|
61411
|
+
);
|
|
61412
|
+
}
|
|
61413
|
+
return resolvedHandle.beginWithdraw(withdrawConfig);
|
|
61414
|
+
},
|
|
61415
|
+
closeWithdraw: () => resolvedHandle?.closeWithdraw(),
|
|
59502
61416
|
destroy: cleanup
|
|
59503
61417
|
};
|
|
59504
61418
|
const refCallback = (handle) => {
|
|
@@ -59519,13 +61433,13 @@ function createUnifold(publishableKey, config) {
|
|
|
59519
61433
|
};
|
|
59520
61434
|
try {
|
|
59521
61435
|
root.render(
|
|
59522
|
-
|
|
61436
|
+
import_react32.default.createElement(
|
|
59523
61437
|
RenderErrorBoundary,
|
|
59524
61438
|
{ onError: handleRenderError },
|
|
59525
|
-
|
|
61439
|
+
import_react32.default.createElement(
|
|
59526
61440
|
UnifoldProvider2,
|
|
59527
61441
|
{ publishableKey, config },
|
|
59528
|
-
|
|
61442
|
+
import_react32.default.createElement(UnifoldBridge, { ref: refCallback })
|
|
59529
61443
|
)
|
|
59530
61444
|
)
|
|
59531
61445
|
);
|
|
@@ -59550,11 +61464,13 @@ lucide-react/dist/esm/Icon.js:
|
|
|
59550
61464
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
59551
61465
|
lucide-react/dist/esm/icons/arrow-left-right.js:
|
|
59552
61466
|
lucide-react/dist/esm/icons/arrow-left.js:
|
|
61467
|
+
lucide-react/dist/esm/icons/arrow-up-down.js:
|
|
59553
61468
|
lucide-react/dist/esm/icons/check.js:
|
|
59554
61469
|
lucide-react/dist/esm/icons/chevron-down.js:
|
|
59555
61470
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
59556
61471
|
lucide-react/dist/esm/icons/chevron-up.js:
|
|
59557
61472
|
lucide-react/dist/esm/icons/circle-check.js:
|
|
61473
|
+
lucide-react/dist/esm/icons/clipboard-paste.js:
|
|
59558
61474
|
lucide-react/dist/esm/icons/clock.js:
|
|
59559
61475
|
lucide-react/dist/esm/icons/copy.js:
|
|
59560
61476
|
lucide-react/dist/esm/icons/credit-card.js:
|